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 /gg_map | |
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 'gg_map')
-rw-r--r-- | gg_map/gg_map.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/gg_map/gg_map.c b/gg_map/gg_map.c index d91859f..7a08b28 100644 --- a/gg_map/gg_map.c +++ b/gg_map/gg_map.c @@ -49,12 +49,17 @@ _node_to_vertice(struct ggnet_node *n) } static void -_conn_add(u_int id, u_int src, u_int dst, u_int proto, u_int size) +_conn_add(u_int id, u_int src, u_int dst, u_int proto, u_int8_t pktsize) { struct ggnet_conn *conn; Egraph_Vertice *a, *b; Egraph_Edge *e; struct in_addr srcaddr, dstaddr; + int size, response; + + GG_PKTDATA_SIZE_DECODE(pktsize, size, response); + if (response > 0) /* cannot have a new connection that is a response */ + return; srcaddr.s_addr = src; dstaddr.s_addr = dst; @@ -91,24 +96,26 @@ _conn_del(int id) { } static void -_conn_data(int id, u_int8_t size) { +_conn_data(int id, u_int8_t pktsize) { struct ggnet_conn *conn; Egraph_Vertice *a, *b, *tmp; - int response; + int size, response; + u_int32_t color; conn = ggnet_conn_find_by_id(_ggnet, id); if (!conn) return; - response = size >> 7; - size = size & 0xe; - a = ggnet_node_usrdata_get(ggnet_conn_src_get(conn)); b = ggnet_node_usrdata_get(ggnet_conn_dst_get(conn)); + + GG_PKTDATA_SIZE_DECODE(pktsize, size, response); if (response) { tmp = a; a = b; b = tmp; } - egraph_vertice_send_blob(_egraph, a, b, 8 + size * 2, 0xFF000000); + size = log(size) * 2; + color = (id * 0x98765400) % 0xFFFFFF00; + egraph_vertice_send_blob(_egraph, a, b, size, color); } int |