summaryrefslogtreecommitdiff
path: root/evbuffer-internal.h
diff options
context:
space:
mode:
authorJoachim Bauch <mail@joachim-bauch.de>2011-06-09 23:33:58 +0200
committerJoachim Bauch <mail@joachim-bauch.de>2011-08-09 23:08:46 +0200
commit9d7368ae2db526ad678f9aa332c21b2f2b1d8493 (patch)
tree0b8c01565bb38b79169610dbd5c95604c9e2eebc /evbuffer-internal.h
parent5419803d3abcd9705b71cb98223dc00709ed5b33 (diff)
downloadlibevent-9d7368ae2db526ad678f9aa332c21b2f2b1d8493.tar.gz
support adding buffers to other buffers non-destructively
Diffstat (limited to 'evbuffer-internal.h')
-rw-r--r--evbuffer-internal.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/evbuffer-internal.h b/evbuffer-internal.h
index 6bb3e2c1..75d026d3 100644
--- a/evbuffer-internal.h
+++ b/evbuffer-internal.h
@@ -183,6 +183,11 @@ struct evbuffer_chain {
/** a chain that should be freed, but can't be freed until it is
* un-pinned. */
#define EVBUFFER_DANGLING 0x0040
+ /** a chain that is a referenced copy of another chain */
+#define EVBUFFER_MULTICAST 0x0080
+
+ /** number of multicast references to this chain */
+ int refcnt;
/** Usually points to the read-write memory belonging to this
* buffer allocated as part of the evbuffer_chain allocation.
@@ -240,6 +245,16 @@ struct evbuffer_file_segment {
ev_off_t length;
};
+/** Information about the multicast parent of a chain. Lives at the
+ * end of an evbuffer_chain with the EVBUFFER_MULTICAST flag set. */
+struct evbuffer_multicast_parent {
+#ifndef _EVENT_DISABLE_THREAD_SUPPORT
+ void *lock; /**< lock prevent concurrent access to the parent */
+#endif
+ /** multicast parent for this chain */
+ struct evbuffer_chain *parent;
+};
+
#define EVBUFFER_CHAIN_SIZE sizeof(struct evbuffer_chain)
/** Return a pointer to extra data allocated along with an evbuffer. */
#define EVBUFFER_CHAIN_EXTRA(t, c) (t *)((struct evbuffer_chain *)(c) + 1)