2
* $Id: tx.h,v 1.8 2003/07/15 09:07:59 rmanfredi Exp $
4
* Copyright (c) 2002-2003, Raphael Manfredi
8
*----------------------------------------------------------------------
9
* This file is part of gtk-gnutella.
11
* gtk-gnutella is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* gtk-gnutella is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with gtk-gnutella; if not, write to the Free Software
24
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
*----------------------------------------------------------------------
37
typedef void (*tx_service_t)(gpointer obj);
43
typedef struct txdriver {
44
struct gnutella_node *node; /* Node to which this driver belongs */
45
struct txdrv_ops *ops; /* Dynamically dispatched operations */
46
gint flags; /* Driver flags */
47
tx_service_t srv_routine; /* Service routine of upper TX layer */
48
gpointer srv_arg; /* Service routine argument */
49
gpointer opaque; /* Used by heirs to store specific info */
56
#define TX_SERVICE 0x00000001 /* Servicing of upper layer needed */
59
* Operations defined on all drivers.
63
gpointer (*init)(txdrv_t *tx, gpointer args);
64
void (*destroy)(txdrv_t *tx);
65
gint (*write)(txdrv_t *tx, gpointer data, gint len);
66
gint (*writev)(txdrv_t *tx, struct iovec *iov, gint iovcnt);
67
void (*enable)(txdrv_t *tx);
68
void (*disable)(txdrv_t *tx);
69
gint (*pending)(txdrv_t *tx);
70
struct bio_source *(*bio_source)(txdrv_t *tx);
77
txdrv_t *tx_make(struct gnutella_node *n, struct txdrv_ops *ops, gpointer args);
78
void tx_free(txdrv_t *d);
79
gint tx_write(txdrv_t *tx, gpointer data, gint len);
80
gint tx_writev(txdrv_t *tx, struct iovec *iov, gint iovcnt);
81
void tx_srv_register(txdrv_t *d, tx_service_t srv_fn, gpointer srv_arg);
82
void tx_srv_enable(txdrv_t *tx);
83
void tx_srv_disable(txdrv_t *tx);
84
gint tx_pending(txdrv_t *tx);
85
struct bio_source *tx_bio_source(txdrv_t *tx);