Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

rx.h

Go to the documentation of this file.
00001 /*
00002  * $Id: rx.h,v 1.8 2005/11/29 22:14:56 rmanfredi Exp $
00003  *
00004  * Copyright (c) 2002-2003, Raphael Manfredi
00005  *
00006  *----------------------------------------------------------------------
00007  * This file is part of gtk-gnutella.
00008  *
00009  *  gtk-gnutella is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  gtk-gnutella is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with gtk-gnutella; if not, write to the Free Software
00021  *  Foundation, Inc.:
00022  *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *----------------------------------------------------------------------
00024  */
00025 
00036 #ifndef _core_rx_h_
00037 #define _core_rx_h_
00038 
00039 #include <glib.h>
00040 
00041 #include "pmsg.h"
00042 #include "if/core/hosts.h"
00043 
00044 struct rxdriver;
00045 struct gnutella_node;
00046 
00047 typedef void (*rx_data_t)(struct rxdriver *, pmsg_t *mb);
00048 
00053 typedef struct rxdriver {
00054     gpointer owner;                 
00055     gnet_host_t host;               
00056     const struct rxdrv_ops *ops;    
00057     struct rxdriver *upper;         
00058     struct rxdriver *lower;         
00059     gint flags;                     
00060     rx_data_t data_ind;             
00061     gpointer opaque;                
00062 } rxdrv_t;
00063 
00064 #define rx_owner(r) ((r)->owner)
00065 
00066 /*
00067  * Driver flags.
00068  */
00069 
00074 struct rxdrv_ops {
00075     gpointer (*init)(rxdrv_t *tx, gconstpointer args);
00076     void (*destroy)(rxdrv_t *tx);
00077     void (*recv)(rxdrv_t *tx, pmsg_t *mb);
00078     void (*enable)(rxdrv_t *tx);
00079     void (*disable)(rxdrv_t *tx);
00080     struct bio_source *(*bio_source)(rxdrv_t *tx);
00081 };
00082 
00083 /*
00084  * Public interface
00085  */
00086 
00087 rxdrv_t *rx_make(gpointer owner, gnet_host_t *host,
00088     const struct rxdrv_ops *ops, gpointer args);
00089 
00090 rxdrv_t *rx_make_above(rxdrv_t *lrx, const struct rxdrv_ops *ops,
00091     gconstpointer args);
00092 
00093 void rx_set_data_ind(rxdrv_t *rx, rx_data_t data_ind);
00094 void rx_free(rxdrv_t *d);
00095 void rx_collect(void);
00096 void rx_recv(rxdrv_t *rx, pmsg_t *mb);
00097 void rx_enable(rxdrv_t *rx);
00098 void rx_disable(rxdrv_t *rx);
00099 rxdrv_t *rx_bottom(rxdrv_t *rx);
00100 struct bio_source *rx_bio_source(rxdrv_t *rx);
00101 struct bio_source *rx_no_source(rxdrv_t *rx);
00102 
00103 #endif  /* _core_rx_h_ */
00104 
00105 /* vi: set ts=4 sw=4 cindent: */

Generated on Sun Feb 12 10:49:57 2006 for Gtk-Gnutella by doxygen 1.3.6