From 3a2bbdb05ca6a6996e424c9fb225cb0d53804125 Mon Sep 17 00:00:00 2001 From: Alberto Gonzalez Iniesta Date: Tue, 27 Dec 2016 18:25:47 +0100 Subject: New upstream version 2.4.0 --- src/openvpn/mbuf.h | 73 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 33 deletions(-) (limited to 'src/openvpn/mbuf.h') 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. + * Copyright (C) 2002-2017 OpenVPN Technologies, Inc. * * 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 */ -- cgit v1.2.3