#include <pcap.h>
extern void ascii_print(const u_char *, u_int);
-extern void hex_and_ascii_print_with_offset(const char *, const u_char *,
- u_int, u_int);
-extern void hex_and_ascii_print(const char *, const u_char *, u_int);
extern void telnet_print(const u_char *, u_int);
extern int llc_print(const u_char *, u_int, u_int, const u_char *,
const u_char *, u_short *);
extern void hex_print_with_offset(netdissect_options *, const char *ident, const u_char *cp,
u_int, u_int);
extern void hex_print(netdissect_options *,const char *ident, const u_char *cp,u_int);
+extern void hex_and_ascii_print_with_offset(netdissect_options *, const char *, const u_char *, u_int, u_int);
+extern void hex_and_ascii_print(netdissect_options *, const char *, const u_char *, u_int);
+
extern int ah_print(netdissect_options *, register const u_char *);
extern void beep_print(netdissect_options *, const u_char *, u_int);
extern void dtp_print(netdissect_options *, const u_char *, u_int);
#if 0
extern void ascii_print(netdissect_options *,u_int);
-extern void hex_and_ascii_print_with_offset(netdissect_options *,const char *,
- u_int, u_int);
-extern void hex_and_ascii_print(netdissect_options *,const char *, u_int);
extern void telnet_print(netdissect_options *,const u_char *, u_int);
extern int llc_print(netdissect_options *,
const u_char *, u_int, u_int, const u_char *,
}
void
-hex_and_ascii_print_with_offset(register const char *ident,
+hex_and_ascii_print_with_offset(netdissect_options *ndo, register const char *ident,
register const u_char *cp, register u_int length, register u_int oset)
{
register u_int i;
i++;
if (i >= HEXDUMP_SHORTS_PER_LINE) {
*hsp = *asp = '\0';
- (void)printf("%s0x%04x: %-*s %s",
+ ND_PRINT((ndo, "%s0x%04x: %-*s %s",
ident, oset, HEXDUMP_HEXSTUFF_PER_LINE,
- hexstuff, asciistuff);
+ hexstuff, asciistuff));
i = 0; hsp = hexstuff; asp = asciistuff;
oset += HEXDUMP_BYTES_PER_LINE;
}
}
if (i > 0) {
*hsp = *asp = '\0';
- (void)printf("%s0x%04x: %-*s %s",
+ ND_PRINT((ndo, "%s0x%04x: %-*s %s",
ident, oset, HEXDUMP_HEXSTUFF_PER_LINE,
- hexstuff, asciistuff);
+ hexstuff, asciistuff));
}
}
void
-hex_and_ascii_print(register const char *ident, register const u_char *cp,
- register u_int length)
+hex_and_ascii_print(netdissect_options *ndo, register const char *ident,
+ register const u_char *cp, register u_int length)
{
- hex_and_ascii_print_with_offset(ident, cp, length, 0);
+ hex_and_ascii_print_with_offset(ndo, ident, cp, length, 0);
}
/*
printf("\n\t data (%u octets)", len);
TCHECK2(*cp, len);
if (vflag >= 2)
- hex_and_ascii_print("\n\t ", cp, len);
+ hex_and_ascii_print(gndo, "\n\t ", cp, len);
return cp + len;
trunc:
body_len_printed = MIN(VBYTES + 1, body_len_printed);
if (body_len_printed > 1) {
printf(", first %" PRIu64 " byte(s) of body:", body_len_printed - 1);
- hex_and_ascii_print("\n\t ", cp + header_len + 1, body_len_printed - 1);
+ hex_and_ascii_print(gndo, "\n\t ", cp + header_len + 1, body_len_printed - 1);
printf("\n");
}
}
len_printed = MIN(VBYTES, len_printed);
if (len_printed > 1) {
printf(", first %"PRIu64" byte(s):", len_printed);
- hex_and_ascii_print("\n\t ", cp, len_printed);
+ hex_and_ascii_print(gndo, "\n\t ", cp, len_printed);
printf("\n");
}
}
/*
* Include the link-layer header.
*/
- hex_and_ascii_print("\n\t", sp, h->caplen);
+ hex_and_ascii_print(ndo, "\n\t", sp, h->caplen);
} else {
/*
* Don't include the link-layer header - and if
* print nothing.
*/
if (h->caplen > hdrlen)
- hex_and_ascii_print("\n\t", sp + hdrlen,
+ hex_and_ascii_print(ndo, "\n\t", sp + hdrlen,
h->caplen - hdrlen);
}
} else if (ndo->ndo_xflag) {
* By default, print the specified data out in hex and ASCII.
*/
static void
-ndo_default_print(netdissect_options *ndo _U_, const u_char *bp, u_int length)
+ndo_default_print(netdissect_options *ndo, const u_char *bp, u_int length)
{
- hex_and_ascii_print("\n\t", bp, length); /* pass on lf and identation string */
+ hex_and_ascii_print(ndo, "\n\t", bp, length); /* pass on lf and identation string */
}
void