filter.h
Go to the documentation of this file.00001 #ifndef _GPXE_FILTER_H
00002 #define _GPXE_FILTER_H
00003
00004
00005
00006
00007
00008
00009
00010 FILE_LICENCE ( GPL2_OR_LATER );
00011
00012 #include <stddef.h>
00013 #include <gpxe/xfer.h>
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 struct xfer_filter_half {
00024
00025 struct xfer_interface xfer;
00026
00027 struct xfer_filter_half *other;
00028 };
00029
00030
00031
00032
00033
00034
00035
00036 static inline __attribute__ (( always_inline )) struct xfer_interface *
00037 filter_other_half ( struct xfer_interface *xfer ) {
00038 struct xfer_filter_half *half =
00039 container_of ( xfer, struct xfer_filter_half, xfer );
00040 return &half->other->xfer;
00041 }
00042
00043 extern void filter_close ( struct xfer_interface *xfer, int rc );
00044 extern int filter_vredirect ( struct xfer_interface *xfer, int type,
00045 va_list args );
00046 extern size_t filter_window ( struct xfer_interface *xfer );
00047 extern struct io_buffer * filter_alloc_iob ( struct xfer_interface *xfer,
00048 size_t len );
00049 extern int filter_deliver_iob ( struct xfer_interface *xfer,
00050 struct io_buffer *iobuf,
00051 struct xfer_metadata *meta );
00052 extern int filter_deliver_raw ( struct xfer_interface *xfer, const void *data,
00053 size_t len );
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 static inline void filter_init ( struct xfer_filter_half *left,
00065 struct xfer_interface_operations *left_op,
00066 struct xfer_filter_half *right,
00067 struct xfer_interface_operations *right_op,
00068 struct refcnt *refcnt ) {
00069 xfer_init ( &left->xfer, left_op, refcnt );
00070 xfer_init ( &right->xfer, right_op, refcnt );
00071 left->other = right;
00072 right->other = left;
00073 }
00074
00075 #endif