2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2009, 2010 Daniel Borkmann.
4 * Subject to the GPL, version 2.
14 void empty(struct pkt_buff
*pkt __maybe_unused
) {}
16 static void _hex(uint8_t *ptr
, size_t len
)
22 for (; ptr
&& len
-- > 0; ptr
++)
23 tprintf(" %.2x", *ptr
);
27 void hex(struct pkt_buff
*pkt
)
29 size_t len
= pkt_len(pkt
);
34 _hex(pkt_pull(pkt
, len
), len
);
38 static void _ascii(uint8_t *ptr
, size_t len
)
44 for (; ptr
&& len
-- > 0; ptr
++)
45 tprintf("%c", isprint(*ptr
) ? *ptr
: '.');
49 void ascii(struct pkt_buff
*pkt
)
51 size_t len
= pkt_len(pkt
);
56 _ascii(pkt_pull(pkt
, len
), len
);
60 void hex_ascii(struct pkt_buff
*pkt
)
62 size_t len
= pkt_len(pkt
);
63 uint8_t *ptr
= pkt_pull(pkt
, len
);
73 static void none_less(struct pkt_buff
*pkt __maybe_unused
)
78 struct protocol none_ops
= {
80 .print_full
= hex_ascii
,
81 .print_less
= none_less
,