summaryrefslogtreecommitdiff
path: root/dissector.h
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2015-04-27 21:36:08 +0300
committerTobias Klauser <tklauser@distanz.ch>2015-05-02 17:14:38 +0200
commit6b85cfef15902cac483e922c0bcf1f055ba7ed4e (patch)
treeb3159175f6bb7d0723d3df917c7b353085bfe7e5 /dissector.h
parentf17e4b94287025f8223364cb9aee9b4b780b8c10 (diff)
netsniff-ng: Show packet number
Show the packet number as part of the dissector output. Example: > wlp3s0 107 1430159373s.693002029ns (#5) [ Eth MAC (6c:88:14:ac:51:e4 => 10:fe:ed:90:22:12), Proto (0x0800, IPv4) ] Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'dissector.h')
-rw-r--r--dissector.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/dissector.h b/dissector.h
index d749205..04b2e92 100644
--- a/dissector.h
+++ b/dissector.h
@@ -51,7 +51,7 @@ static inline const char *__show_ts_source(uint32_t status)
static inline void __show_frame_hdr(uint8_t *packet, size_t len, int linktype,
struct sockaddr_ll *s_ll, void *raw_hdr,
- int mode, bool v3)
+ int mode, bool v3, unsigned long count)
{
char tmp[IFNAMSIZ];
union tpacket_uhdr hdr;
@@ -76,27 +76,31 @@ static inline void __show_frame_hdr(uint8_t *packet, size_t len, int linktype,
hdr.raw = raw_hdr;
switch (mode) {
case PRINT_LESS:
- tprintf("%s %s %u",
+ tprintf("%s %s %u (#%lu) ",
packet_types[pkttype] ? : "?",
if_indextoname(s_ll->sll_ifindex, tmp) ? : "?",
- tpacket_uhdr(hdr, tp_len, v3));
+ tpacket_uhdr(hdr, tp_len, v3),
+ count);
break;
default:
- tprintf("%s %s %u %us.%uns %s\n",
+ tprintf("%s %s %u %us.%uns %s (#%lu)\n",
packet_types[pkttype] ? : "?",
if_indextoname(s_ll->sll_ifindex, tmp) ? : "?",
tpacket_uhdr(hdr, tp_len, v3),
tpacket_uhdr(hdr, tp_sec, v3),
tpacket_uhdr(hdr, tp_nsec, v3),
- v3 ? "" : __show_ts_source(hdr.h2->tp_status));
+ v3 ? "" : __show_ts_source(hdr.h2->tp_status),
+ count);
break;
}
}
static inline void show_frame_hdr(uint8_t *packet, size_t len, int linktype,
- struct frame_map *hdr, int mode)
+ struct frame_map *hdr, int mode,
+ unsigned long count)
{
- __show_frame_hdr(packet, len, linktype, &hdr->s_ll, &hdr->tp_h, mode, false);
+ __show_frame_hdr(packet, len, linktype, &hdr->s_ll, &hdr->tp_h, mode,
+ false, count);
}
extern void dissector_init_all(int fnttype);