summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorMichael Brown2007-01-31 04:04:56 +0100
committerMichael Brown2007-01-31 04:04:56 +0100
commite38e516463cf1e551cca6394bc5cb6cc90821105 (patch)
treebcb8ca301f88eeaa871bfc0c1c72ed6b246e59a1 /src/net
parentAdd null crypto algorithm (diff)
downloadipxe-e38e516463cf1e551cca6394bc5cb6cc90821105.tar.gz
ipxe-e38e516463cf1e551cca6394bc5cb6cc90821105.tar.xz
ipxe-e38e516463cf1e551cca6394bc5cb6cc90821105.zip
Add insert_filter() function
Diffstat (limited to 'src/net')
-rw-r--r--src/net/filter.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/net/filter.c b/src/net/filter.c
index 7d93c61c1..c4542fcbf 100644
--- a/src/net/filter.c
+++ b/src/net/filter.c
@@ -23,6 +23,7 @@
*/
#include <stddef.h>
+#include <errno.h>
#include <gpxe/stream.h>
#include <gpxe/filter.h>
@@ -161,3 +162,26 @@ int filter_kick ( struct stream_connection *conn ) {
return stream_kick ( &filter->downstream );
}
+
+/**
+ * Insert filter into stream
+ *
+ * @v app Stream application
+ * @v filter Filter stream
+ * @ret rc Return status code
+ */
+int insert_filter ( struct stream_application *app,
+ struct filter_stream *filter ) {
+ struct stream_connection *conn = app->conn;
+
+ if ( ! app->conn ) {
+ DBGC ( filter, "Filter %p cannot insert onto closed stream\n",
+ filter );
+ return -ENOTCONN;
+ }
+
+ app->conn = &filter->upstream;
+ conn->app = &filter->downstream;
+
+ return 0;
+}