Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright (C) 2007 Michael Brown <mbrown (at) fensystems.co.uk>.
      3  *
      4  * This program is free software; you can redistribute it and/or
      5  * modify it under the terms of the GNU General Public License as
      6  * published by the Free Software Foundation; either version 2 of the
      7  * License, or any later version.
      8  *
      9  * This program is distributed in the hope that it will be useful, but
     10  * WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12  * General Public License for more details.
     13  *
     14  * You should have received a copy of the GNU General Public License
     15  * along with this program; if not, write to the Free Software
     16  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     17  */
     18 
     19 FILE_LICENCE ( GPL2_OR_LATER );
     20 
     21 #include <gpxe/xfer.h>
     22 #include <gpxe/filter.h>
     23 
     24 /** @file
     25  *
     26  * Data transfer filters
     27  *
     28  */
     29 
     30 /*
     31  * Pass-through methods to be used by filters which don't want to
     32  * intercept all events.
     33  *
     34  */
     35 
     36 void filter_close ( struct xfer_interface *xfer, int rc ) {
     37 	struct xfer_interface *other = filter_other_half ( xfer );
     38 
     39 	xfer_close ( other, rc );
     40 }
     41 
     42 int filter_vredirect ( struct xfer_interface *xfer, int type,
     43 			va_list args ) {
     44 	struct xfer_interface *other = filter_other_half ( xfer );
     45 
     46 	return xfer_vredirect ( other, type, args );
     47 }
     48 
     49 size_t filter_window ( struct xfer_interface *xfer ) {
     50 	struct xfer_interface *other = filter_other_half ( xfer );
     51 
     52 	return xfer_window ( other );
     53 }
     54 
     55 struct io_buffer * filter_alloc_iob ( struct xfer_interface *xfer,
     56 				      size_t len ) {
     57 	struct xfer_interface *other = filter_other_half ( xfer );
     58 
     59 	return xfer_alloc_iob ( other, len );
     60 }
     61 
     62 int filter_deliver_iob ( struct xfer_interface *xfer, struct io_buffer *iobuf,
     63 			 struct xfer_metadata *meta ) {
     64 	struct xfer_interface *other = filter_other_half ( xfer );
     65 
     66 	return xfer_deliver_iob_meta ( other, iobuf, meta );
     67 }
     68 
     69 int filter_deliver_raw ( struct xfer_interface *xfer, const void *data,
     70 			 size_t len ) {
     71 	struct xfer_interface *other = filter_other_half ( xfer );
     72 
     73 	return xfer_deliver_raw ( other, data, len );
     74 }
     75