diff options
author | Laurent Ghigonis <laurent@p1sec.com> | 2012-12-11 21:19:01 +0100 |
---|---|---|
committer | Laurent Ghigonis <laurent@p1sec.com> | 2012-12-11 21:19:01 +0100 |
commit | 8aa586f75cff47db6fe408713f7b2eb8aedaedce (patch) | |
tree | dffaf0d775f7d18f50b6499485f45d608b8e16ac /libglouglou | |
parent | correctly encode packet size and response type (diff) | |
download | glouglou-8aa586f75cff47db6fe408713f7b2eb8aedaedce.tar.xz glouglou-8aa586f75cff47db6fe408713f7b2eb8aedaedce.zip |
better packet encode / decode and size display, and colorisation of blobs
depending on connection id.
Diffstat (limited to 'libglouglou')
-rw-r--r-- | libglouglou/libglouglou.h | 6 |
1 files changed, 6 insertions, 0 deletions
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 |