6 * Data transfer filters
10 FILE_LICENCE ( GPL2_OR_LATER
);
13 #include <gpxe/xfer.h>
16 * Half of a data transfer filter
18 * Embed two of these structures within a structure implementing a
19 * data transfer filter, and intialise with filter_init(). You can
20 * then use the filter_xxx() methods as the data transfer interface
21 * methods as required.
23 struct xfer_filter_half
{
24 /** Data transfer interface */
25 struct xfer_interface xfer
;
26 /** Other half of the data transfer filter */
27 struct xfer_filter_half
*other
;
31 * Get data transfer interface for the other half of a data transfer filter
33 * @v xfer Data transfer interface
34 * @ret other Other half's data transfer interface
36 static inline __attribute__ (( always_inline
)) struct xfer_interface
*
37 filter_other_half ( struct xfer_interface
*xfer
) {
38 struct xfer_filter_half
*half
=
39 container_of ( xfer
, struct xfer_filter_half
, xfer
);
40 return &half
->other
->xfer
;
43 extern void filter_close ( struct xfer_interface
*xfer
, int rc
);
44 extern int filter_vredirect ( struct xfer_interface
*xfer
, int type
,
46 extern size_t filter_window ( struct xfer_interface
*xfer
);
47 extern struct io_buffer
* filter_alloc_iob ( struct xfer_interface
*xfer
,
49 extern int filter_deliver_iob ( struct xfer_interface
*xfer
,
50 struct io_buffer
*iobuf
,
51 struct xfer_metadata
*meta
);
52 extern int filter_deliver_raw ( struct xfer_interface
*xfer
, const void *data
,
56 * Initialise a data transfer filter
58 * @v left "Left" half of the filter
59 * @v left_op Data transfer interface operations for "left" half
60 * @v right "Right" half of the filter
61 * @v right_op Data transfer interface operations for "right" half
62 * @v refcnt Containing object reference counter, or NULL
64 static inline void filter_init ( struct xfer_filter_half
*left
,
65 struct xfer_interface_operations
*left_op
,
66 struct xfer_filter_half
*right
,
67 struct xfer_interface_operations
*right_op
,
68 struct refcnt
*refcnt
) {
69 xfer_init ( &left
->xfer
, left_op
, refcnt
);
70 xfer_init ( &right
->xfer
, right_op
, refcnt
);
75 #endif /* _GPXE_FILTER_H */