2
* OpenVPN -- An application to securely tunnel IP networks
3
* over a single TCP/UDP port, with support for SSL/TLS-based
4
* session authentication and key exchange,
5
* packet encryption, packet authentication, and
8
* Copyright (C) 2002-2004 James Yonan <jim@yonan.net>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program (see the file COPYING included with this
22
* distribution); if not, write to the Free Software Foundation, Inc.,
23
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
* Handle both multicast and broadcast functions.
35
/* define this to enable special test mode */
41
struct multi_instance;
43
#define MBUF_INDEX(head, offset, size) (((head) + (offset)) & ((size)-1))
50
# define MF_UNICAST (1<<0)
56
struct mbuf_buffer *buffer;
57
struct multi_instance *instance;
65
unsigned int capacity;
66
unsigned int max_queued;
67
struct mbuf_item *array;
70
struct mbuf_set *mbuf_init (unsigned int size);
71
void mbuf_free (struct mbuf_set *ms);
73
struct mbuf_buffer *mbuf_alloc_buf (const struct buffer *buf);
74
void mbuf_free_buf (struct mbuf_buffer *mb);
76
void mbuf_add_item (struct mbuf_set *ms, const struct mbuf_item *item);
78
bool mbuf_extract_item (struct mbuf_set *ms, struct mbuf_item *item, const bool lock);
80
void mbuf_dereference_instance (struct mbuf_set *ms, struct multi_instance *mi);
83
mbuf_defined (const struct mbuf_set *ms)
89
mbuf_len (const struct mbuf_set *ms)
95
mbuf_maximum_queued (const struct mbuf_set *ms)
97
return (int) ms->max_queued;
100
static inline struct multi_instance *
101
mbuf_peek (struct mbuf_set *ms)
103
struct multi_instance *mbuf_peek_dowork (struct mbuf_set *ms);
104
if (mbuf_defined (ms))
105
return mbuf_peek_dowork (ms);