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. --- gg_sniff/pcap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gg_sniff/pcap.c') diff --git a/gg_sniff/pcap.c b/gg_sniff/pcap.c index 0f95dad..8485eff 100644 --- a/gg_sniff/pcap.c +++ b/gg_sniff/pcap.c @@ -463,9 +463,9 @@ ip_handle(struct ip *ip, const u_char *pend, u_int wirelen) if (!close) { pkt.type = PACKET_DATA; pkt.data_connid = conn->id; - pkt.data_size = size / GG_PKTDATA_SIZE_FACTOR | (response << 7); + GG_PKTDATA_SIZE_ENCODE(pkt.data_size, ip->ip_len, response); gg_client_send(_cap.ggcli, &pkt); - ggnet_conn_data(_cap.net, conn, size, response); + ggnet_conn_data(_cap.net, conn, ip->ip_len, response); } else { pkt.type = PACKET_DELCONN; pkt.delconn_id = conn->id; @@ -474,13 +474,14 @@ ip_handle(struct ip *ip, const u_char *pend, u_int wirelen) } } else { if (!close) { - conn = ggnet_conn_add(_cap.net, &src, src_port, &dst, dst_port, proto, size, -1); + conn = ggnet_conn_add(_cap.net, &src, src_port, &dst, dst_port, proto, + ip->ip_len, -1); pkt.type = PACKET_NEWCONN; pkt.newconn_id = conn->id; pkt.newconn_src = src.s_addr; pkt.newconn_dst = dst.s_addr; pkt.newconn_proto = proto; - pkt.newconn_size = size << 8; + GG_PKTDATA_SIZE_ENCODE(pkt.newconn_size, ip->ip_len, response); gg_client_send(_cap.ggcli, &pkt); } else { gg_log_warn("user: captured connection close w/o open !"); -- cgit v1.2.3-59-g8ed1b