From 8aa586f75cff47db6fe408713f7b2eb8aedaedce Mon Sep 17 00:00:00 2001 From: Laurent Ghigonis Date: Tue, 11 Dec 2012 21:19:01 +0100 Subject: better packet encode / decode and size display, and colorisation of blobs depending on connection id. --- libglouglou/libglouglou.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libglouglou') diff --git a/libglouglou/libglouglou.h b/libglouglou/libglouglou.h index e1d7152..b3e42d0 100644 --- a/libglouglou/libglouglou.h +++ b/libglouglou/libglouglou.h @@ -19,7 +19,13 @@ #define PACKET_BUFFER_SIZE 16384 #define PACKET_SNDBUF_MAX 500 #define GG_PKTARG_MAX 30 + #define GG_PKTDATA_SIZE_FACTOR 20 +#define GG_PKTDATA_SIZE_ENCODE(pktsize, size, response) \ + (pktsize = ((size / GG_PKTDATA_SIZE_FACTOR) & 0x7f) | (response << 7)) +#define GG_PKTDATA_SIZE_DECODE(pktsize, size, response) { \ + response = pktsize >> 7; size = (pktsize & 0x7f) * GG_PKTDATA_SIZE_FACTOR; \ +} #define PACKET_HEADER_SIZE 2 #define PACKET_TYPE_MIN 0x00 -- cgit v1.2.3-59-g8ed1b