2 * netsniff-ng - the packet sniffing beast
3 * By Daniel Borkmann <daniel@netsniff-ng.org>
4 * Copyright 2009, 2010 Daniel Borkmann.
5 * Subject to the GPL, version 2.
15 #include "proto_struct.h"
18 static inline void empty(struct pkt_buff
*pkt
) {}
20 static inline void _hex(uint8_t *ptr
, size_t len
)
26 for (; ptr
&& len
-- > 0; ptr
++)
27 tprintf(" %.2x", *ptr
);
31 static inline void hex(struct pkt_buff
*pkt
)
33 size_t len
= pkt_len(pkt
);
38 _hex(pkt_pull(pkt
, len
), len
);
42 static inline void _ascii(uint8_t *ptr
, size_t len
)
48 for (; ptr
&& len
-- > 0; ptr
++)
49 tprintf(" %c ", isprint(*ptr
) ? *ptr
: '.');
53 static inline void ascii(struct pkt_buff
*pkt
)
55 size_t len
= pkt_len(pkt
);
60 _ascii(pkt_pull(pkt
, len
), len
);
64 static inline void hex_ascii(struct pkt_buff
*pkt
)
66 size_t len
= pkt_len(pkt
);
67 uint8_t *ptr
= pkt_pull(pkt
, len
);
78 static inline void none_less(struct pkt_buff
*pkt
)
83 struct protocol none_ops
= {
85 .print_full
= hex_ascii
,
86 .print_less
= none_less
,
88 #endif /* __without_ops */
89 #endif /* PROTO_NONE_H */