~ubuntu-branches/ubuntu/karmic/gtk-gnutella/karmic

« back to all changes in this revision

Viewing changes to src/rx.h

  • Committer: Bazaar Package Importer
  • Author(s): Anand Kumria
  • Date: 2005-08-04 11:32:05 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050804113205-q746i4lgo3rtlegn
Tags: 0.95.4-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * $Id: rx.h,v 1.6 2003/07/15 09:07:58 rmanfredi Exp $
3
 
 *
4
 
 * Copyright (c) 2002-2003, Raphael Manfredi
5
 
 *
6
 
 * Network driver.
7
 
 *
8
 
 *----------------------------------------------------------------------
9
 
 * This file is part of gtk-gnutella.
10
 
 *
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.
15
 
 *
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.
20
 
 *
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
23
 
 *  Foundation, Inc.:
24
 
 *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
 
 *----------------------------------------------------------------------
26
 
 */
27
 
 
28
 
#ifndef _rx_h_
29
 
#define _rx_h_
30
 
 
31
 
#include <stdarg.h>
32
 
#include <glib.h>
33
 
 
34
 
#include "pmsg.h"
35
 
 
36
 
struct rxdrv_ops;
37
 
struct rxdriver;
38
 
struct bio_source;
39
 
 
40
 
typedef void (*rx_data_t)(struct rxdriver *, pmsg_t *mb);
41
 
 
42
 
/*
43
 
 * A network driver
44
 
 *
45
 
 */
46
 
typedef struct rxdriver {
47
 
        struct gnutella_node *node;             /* Node to which this driver belongs */
48
 
        struct rxdrv_ops *ops;                  /* Dynamically dispatched operations */
49
 
        struct rxdriver *upper;                 /* Layer above, NULL if none */
50
 
        struct rxdriver *lower;                 /* Layer underneath, NULL if none */
51
 
        gint flags;                                             /* Driver flags */
52
 
        rx_data_t data_ind;                             /* Data indication routine */
53
 
        gpointer opaque;                                /* Used by heirs to store specific info */
54
 
} rxdrv_t;
55
 
 
56
 
#define rx_node(r)      ((r)->node)
57
 
 
58
 
/*
59
 
 * Driver flags.
60
 
 */
61
 
 
62
 
/*
63
 
 * Operations defined on all drivers.
64
 
 */
65
 
 
66
 
struct rxdrv_ops {
67
 
        gpointer (*init)(rxdrv_t *tx, gpointer args);
68
 
        void (*destroy)(rxdrv_t *tx);
69
 
        void (*recv)(rxdrv_t *tx, pmsg_t *mb);
70
 
        void (*enable)(rxdrv_t *tx);
71
 
        void (*disable)(rxdrv_t *tx);
72
 
        struct bio_source *(*bio_source)(rxdrv_t *tx);
73
 
};
74
 
 
75
 
/*
76
 
 * Public interface
77
 
 */
78
 
 
79
 
rxdrv_t *rx_make(
80
 
        struct gnutella_node *n,
81
 
        struct rxdrv_ops *ops,
82
 
        rx_data_t data_ind,
83
 
        gpointer args);
84
 
rxdrv_t *rx_make_under(rxdrv_t *urx, struct rxdrv_ops *ops, gpointer args);
85
 
void rx_free(rxdrv_t *d);
86
 
void rx_recv(rxdrv_t *rx, pmsg_t *mb);
87
 
void rx_enable(rxdrv_t *rx);
88
 
void rx_disable(rxdrv_t *rx);
89
 
rxdrv_t *rx_bottom(rxdrv_t *rx);
90
 
struct bio_source *rx_bio_source(rxdrv_t *rx);
91
 
 
92
 
#endif  /* _rx_h_ */
93
 
 
94
 
/* vi: set ts=4: */
95