*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdlib.h>
#include <string.h>
#include "print.h"
#include "netdissect-alloc.h"
-#include "pcap-missing.h"
-
struct printer {
if_printer f;
int type;
#ifdef DLT_PPI
{ ppi_if_print, DLT_PPI },
#endif
-#ifdef DLT_PPP_BSDOS
- { ppp_bsdos_if_print, DLT_PPP_BSDOS },
-#endif
#ifdef DLT_PPP_SERIAL
{ ppp_hdlc_if_print, DLT_PPP_SERIAL },
#endif
{ NULL, 0 },
};
+// Both localnet and mask are in network byte order.
void
init_print(netdissect_options *ndo, uint32_t localnet, uint32_t mask)
{
-
init_addrtoname(ndo, localnet, mask);
- init_checksum();
}
if_printer
if (ndo->ndo_packet_number)
ND_PRINT("%5u ", packets_captured);
+ if (ndo->ndo_lengths)
+ ND_PRINT("caplen %u len %u ", h->caplen, h->len);
+
/* Sanity checks on packet length / capture length */
if (h->caplen == 0) {
invalid_header = 1;
profile_func_level = pretty_print_packet_level;
#endif
break;
- case ND_BUG:
- /*
- * A printer or helper routine quit because a bug was
- * detected; report it.
- */
- ND_PRINT(" [Bug in %s protocol printer]", ndo->ndo_protocol);
- break;
}
hdrlen = ndo->ndo_ll_hdr_len;
nd_pop_all_packet_info(ndo);
/*
- * Restore the original snapend, as a printer might have
- * changed it.
+ * Restore the originals snapend and packetp, as a printer
+ * might have changed them.
+ *
+ * XXX - nd_pop_all_packet_info() should have restored the
+ * original values, but, just in case....
*/
ndo->ndo_snapend = sp + h->caplen;
+ ndo->ndo_packetp = sp;
if (ndo->ndo_Xflag) {
/*
* Print the raw packet data in hex and ASCII.