2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2009, 2010 Daniel Borkmann.
4 * Subject to the GPL, version 2.
15 void empty(struct pkt_buff
*pkt __maybe_unused
) {}
17 static void _hex(uint8_t *ptr
, size_t len
)
23 for (; ptr
&& len
-- > 0; ptr
++)
24 tprintf(" %.2x", *ptr
);
28 void hex(struct pkt_buff
*pkt
)
30 size_t len
= pkt_len(pkt
);
35 _hex(pkt_pull(pkt
, len
), len
);
39 static void _ascii(uint8_t *ptr
, size_t len
)
45 for (; ptr
&& len
-- > 0; ptr
++)
46 tprintf("%c", isprint(*ptr
) ? *ptr
: '.');
50 void ascii(struct pkt_buff
*pkt
)
52 size_t len
= pkt_len(pkt
);
57 _ascii(pkt_pull(pkt
, len
), len
);
61 void hex_ascii(struct pkt_buff
*pkt
)
63 size_t len
= pkt_len(pkt
);
64 uint8_t *ptr
= pkt_pull(pkt
, len
);
74 static void none_less(struct pkt_buff
*pkt __maybe_unused
)
79 struct protocol none_ops
= {
81 .print_full
= hex_ascii
,
82 .print_less
= none_less
,