*/
+#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-#include <string.h>
-
#include "interface.h"
#include "addrtoname.h"
#include "extract.h"
-#include "nlpid.h"
#define DTP_HEADER_LEN 1
#define DTP_DOMAIN_TLV 0x0001
};
void
-dtp_print (const u_char *pptr, u_int length)
+dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
{
int type, len;
const u_char *tptr;
tptr = pptr;
- if (!TTEST2(*tptr, DTP_HEADER_LEN))
- goto trunc;
+ ND_TCHECK2(*tptr, DTP_HEADER_LEN);
- printf("DTPv%u, length %u",
+ ND_PRINT((ndo, "DTPv%u, length %u",
(*tptr),
- length);
+ length));
/*
* In non-verbose mode, just print version.
*/
- if (vflag < 1) {
+ if (ndo->ndo_vflag < 1) {
return;
}
while (tptr < (pptr+length)) {
- if (!TTEST2(*tptr, 4))
- goto trunc;
+ ND_TCHECK2(*tptr, 4);
type = EXTRACT_16BITS(tptr);
len = EXTRACT_16BITS(tptr+2);
return;
}
- printf("\n\t%s (0x%04x) TLV, length %u",
+ ND_PRINT((ndo, "\n\t%s (0x%04x) TLV, length %u",
tok2str(dtp_tlv_values, "Unknown", type),
- type, len);
+ type, len));
switch (type) {
case DTP_DOMAIN_TLV:
- printf(", %s", tptr+4);
+ ND_PRINT((ndo, ", %s", tptr+4));
break;
case DTP_STATUS_TLV:
case DTP_DTP_TYPE_TLV:
- printf(", 0x%x", *(tptr+4));
+ ND_PRINT((ndo, ", 0x%x", *(tptr+4)));
break;
case DTP_NEIGHBOR_TLV:
- printf(", %s", etheraddr_string(tptr+4));
+ ND_PRINT((ndo, ", %s", etheraddr_string(ndo, tptr+4)));
break;
default:
return;
trunc:
- printf("[|dtp]");
+ ND_PRINT((ndo, "[|dtp]"));
}
/*