summaryrefslogtreecommitdiff
path: root/event_tagging.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-10-29 16:35:20 +0000
committerNick Mathewson <nickm@torproject.org>2009-10-29 16:35:20 +0000
commit5b3fb5bfa50a23d2a3d973a66b1a0d76195a3cca (patch)
tree10da14e2191ad60f6a8f764bc0fbd668135fcd4b /event_tagging.c
parent1eadb3e3a299da5c384422792a672ff022870f4c (diff)
downloadlibevent-5b3fb5bfa50a23d2a3d973a66b1a0d76195a3cca.tar.gz
More documentation and unit tests for event_tagging.
svn:r1476
Diffstat (limited to 'event_tagging.c')
-rw-r--r--event_tagging.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/event_tagging.c b/event_tagging.c
index c5654d30..f1d7a992 100644
--- a/event_tagging.c
+++ b/event_tagging.c
@@ -67,6 +67,30 @@
#include "mm-internal.h"
#include "util-internal.h"
+/*
+ Here's our wire format:
+
+ Stream = TaggedData*
+
+ TaggedData = Tag Length Data
+ where the integer value of 'Length' is the length of 'data'.
+
+ Tag = HByte* LByte
+ where HByte is a byte with the high bit set, and LByte is a byte
+ with the high bit clear. The integer value of the tag is taken
+ by concatenating the lower 7 bits from all the tags. So for example,
+ the tag 0x66 is encoded as [66], whereas the tag 0x166 is encoded as
+ [82 66]
+
+ Length = Integer
+
+ Integer = NNibbles Nibble* Padding?
+ where NNibbles is a 4-bit value encoding the number of nibbles-1,
+ and each Nibble is 4 bits worth of encoded integer, in big-endian
+ order. If the total encoded integer size is an odd number of nibbles,
+ a final padding nibble with value 0 is appended.
+*/
+
int evtag_decode_int(ev_uint32_t *pnumber, struct evbuffer *evbuf);
int evtag_decode_int64(ev_uint64_t *pnumber, struct evbuffer *evbuf);
int evtag_encode_tag(struct evbuffer *evbuf, ev_uint32_t tag);