|
@@ -23,6 +23,7 @@
|
23
|
23
|
*/
|
24
|
24
|
|
25
|
25
|
#include <stddef.h>
|
|
26
|
+#include <errno.h>
|
26
|
27
|
#include <gpxe/stream.h>
|
27
|
28
|
#include <gpxe/filter.h>
|
28
|
29
|
|
|
@@ -161,3 +162,26 @@ int filter_kick ( struct stream_connection *conn ) {
|
161
|
162
|
|
162
|
163
|
return stream_kick ( &filter->downstream );
|
163
|
164
|
}
|
|
165
|
+
|
|
166
|
+/**
|
|
167
|
+ * Insert filter into stream
|
|
168
|
+ *
|
|
169
|
+ * @v app Stream application
|
|
170
|
+ * @v filter Filter stream
|
|
171
|
+ * @ret rc Return status code
|
|
172
|
+ */
|
|
173
|
+int insert_filter ( struct stream_application *app,
|
|
174
|
+ struct filter_stream *filter ) {
|
|
175
|
+ struct stream_connection *conn = app->conn;
|
|
176
|
+
|
|
177
|
+ if ( ! app->conn ) {
|
|
178
|
+ DBGC ( filter, "Filter %p cannot insert onto closed stream\n",
|
|
179
|
+ filter );
|
|
180
|
+ return -ENOTCONN;
|
|
181
|
+ }
|
|
182
|
+
|
|
183
|
+ app->conn = &filter->upstream;
|
|
184
|
+ conn->app = &filter->downstream;
|
|
185
|
+
|
|
186
|
+ return 0;
|
|
187
|
+}
|