summaryrefslogtreecommitdiff
path: root/src/openvpn/mbuf.h
diff options
context:
space:
mode:
authorAlberto Gonzalez Iniesta <agi@inittab.org>2016-12-27 18:25:47 +0100
committerAlberto Gonzalez Iniesta <agi@inittab.org>2016-12-27 18:25:47 +0100
commit3a2bbdb05ca6a6996e424c9fb225cb0d53804125 (patch)
treef29063da5bec4caf3853d49a22a09c8619eebd21 /src/openvpn/mbuf.h
parentd53dba59e78da865c4fe820386ff2f4f76925f3b (diff)
New upstream version 2.4.0upstream/2.4.0
Diffstat (limited to 'src/openvpn/mbuf.h')
-rw-r--r--src/openvpn/mbuf.h73
1 files changed, 40 insertions, 33 deletions
diff --git a/src/openvpn/mbuf.h b/src/openvpn/mbuf.h
index 1085adc..cfaef58 100644
--- a/src/openvpn/mbuf.h
+++ b/src/openvpn/mbuf.h
@@ -5,7 +5,7 @@
* packet encryption, packet authentication, and
* packet compression.
*
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
+ * Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
@@ -43,67 +43,74 @@ struct multi_instance;
struct mbuf_buffer
{
- struct buffer buf;
- int refcount;
+ struct buffer buf;
+ int refcount;
-# define MF_UNICAST (1<<0)
- unsigned int flags;
+#define MF_UNICAST (1<<0)
+ unsigned int flags;
};
struct mbuf_item
{
- struct mbuf_buffer *buffer;
- struct multi_instance *instance;
+ struct mbuf_buffer *buffer;
+ struct multi_instance *instance;
};
struct mbuf_set
{
- unsigned int head;
- unsigned int len;
- unsigned int capacity;
- unsigned int max_queued;
- struct mbuf_item *array;
+ unsigned int head;
+ unsigned int len;
+ unsigned int capacity;
+ unsigned int max_queued;
+ struct mbuf_item *array;
};
-struct mbuf_set *mbuf_init (unsigned int size);
-void mbuf_free (struct mbuf_set *ms);
+struct mbuf_set *mbuf_init(unsigned int size);
-struct mbuf_buffer *mbuf_alloc_buf (const struct buffer *buf);
-void mbuf_free_buf (struct mbuf_buffer *mb);
+void mbuf_free(struct mbuf_set *ms);
-void mbuf_add_item (struct mbuf_set *ms, const struct mbuf_item *item);
+struct mbuf_buffer *mbuf_alloc_buf(const struct buffer *buf);
-bool mbuf_extract_item (struct mbuf_set *ms, struct mbuf_item *item);
+void mbuf_free_buf(struct mbuf_buffer *mb);
-void mbuf_dereference_instance (struct mbuf_set *ms, struct multi_instance *mi);
+void mbuf_add_item(struct mbuf_set *ms, const struct mbuf_item *item);
+
+bool mbuf_extract_item(struct mbuf_set *ms, struct mbuf_item *item);
+
+void mbuf_dereference_instance(struct mbuf_set *ms, struct multi_instance *mi);
static inline bool
-mbuf_defined (const struct mbuf_set *ms)
+mbuf_defined(const struct mbuf_set *ms)
{
- return ms && ms->len;
+ return ms && ms->len;
}
static inline unsigned int
-mbuf_len (const struct mbuf_set *ms)
+mbuf_len(const struct mbuf_set *ms)
{
- return ms->len;
+ return ms->len;
}
static inline int
-mbuf_maximum_queued (const struct mbuf_set *ms)
+mbuf_maximum_queued(const struct mbuf_set *ms)
{
- return (int) ms->max_queued;
+ return (int) ms->max_queued;
}
static inline struct multi_instance *
-mbuf_peek (struct mbuf_set *ms)
+mbuf_peek(struct mbuf_set *ms)
{
- struct multi_instance *mbuf_peek_dowork (struct mbuf_set *ms);
- if (mbuf_defined (ms))
- return mbuf_peek_dowork (ms);
- else
- return NULL;
+ struct multi_instance *mbuf_peek_dowork(struct mbuf_set *ms);
+
+ if (mbuf_defined(ms))
+ {
+ return mbuf_peek_dowork(ms);
+ }
+ else
+ {
+ return NULL;
+ }
}
-#endif
-#endif
+#endif /* if P2MP */
+#endif /* ifndef MBUF_H */