david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Add insert_filter() function

This commit is contained in:
Michael Brown 2007-01-31 03:04:56 +00:00
parent a008f9e85b
commit e38e516463
2 changed files with 27 additions and 0 deletions

View File

@ -41,4 +41,7 @@ extern int filter_send ( struct stream_connection *conn,
void *data, size_t len );
extern int filter_kick ( struct stream_connection *conn );
extern int insert_filter ( struct stream_application *app,
struct filter_stream *filter );
#endif /* _GPXE_FILTER_H */

View File

@ -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;
}