view src/io/rx_layer.h @ 0:d39e1d0d75b6

initial add
author paulo@hit-nxdomain.opendns.com
date Sat, 20 Feb 2010 21:18:28 -0800
parents
children
line source
1 /*
2 * $Id: rx_layer.h,v 1.3 2004/02/01 08:17:12 hipnod Exp $
3 *
4 * Copyright (C) 2003 giFT project (gift.sourceforge.net)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 */
17 #ifndef GIFT_GT_RX_LAYER_H_
18 #define GIFT_GT_RX_LAYER_H_
20 /*****************************************************************************/
22 #include "rx_stack.h"
23 #include "io_buf.h"
25 /*****************************************************************************/
27 struct gt_rx_stack;
28 struct rx_layer;
30 struct rx_layer_ops
31 {
32 BOOL (*init) (struct rx_layer *layer, void *udata);
33 void (*destroy) (struct rx_layer *layer);
34 void (*enable) (struct rx_layer *layer);
35 void (*disable) (struct rx_layer *layer);
36 void (*recv) (struct rx_layer *layer, struct io_buf *io_buf);
37 };
39 struct rx_layer
40 {
41 const char *name;
42 void *udata;
43 struct rx_layer_ops *ops;
44 BOOL enabled;
46 struct rx_layer *upper;
47 struct rx_layer *lower;
49 struct gt_rx_stack *stack;
50 };
52 /*****************************************************************************/
54 struct rx_layer *gt_rx_layer_new (struct gt_rx_stack *stack,
55 const char *name,
56 struct rx_layer_ops *ops, void *udata);
57 void gt_rx_layer_free (struct rx_layer *layer);
59 void gt_rx_layer_disable (struct rx_layer *layer);
60 void gt_rx_layer_enable (struct rx_layer *layer);
62 /* pass a message buffer up to preceding layers */
63 void gt_rx_layer_recv (struct rx_layer *layer,
64 struct io_buf *io_buf);
66 /*****************************************************************************/
68 #endif /* GIFT_GT_RX_LAYER_H_ */