Also remove some unnecessary passages.
extern int oam_print(const u_char *, u_int, u_int);
extern void bootp_print(const u_char *, u_int);
extern void bgp_print(const u_char *, int);
-extern void beep_print(const u_char *, u_int);
extern void cnfp_print(const u_char *, const u_char *);
extern void decnet_print(const u_char *, u_int, u_int);
extern void default_print(const u_char *, u_int);
extern void udp_print(const u_char *, u_int, const u_char *, int);
extern void vtp_print(const u_char *, u_int);
extern void wb_print(const void *, u_int);
-extern int ah_print(register const u_char *);
extern int ipcomp_print(register const u_char *, int *);
extern void rx_print(register const u_char *, int, int, int, u_char *);
extern void netbeui_print(u_short, const u_char *, int);
extern void cfm_print(const u_char *, u_int);
extern void pgm_print(const u_char *, u_int, const u_char *);
extern void cdp_print(const u_char *, u_int, u_int);
-extern void dtp_print(const u_char *, u_int);
extern void stp_print(const u_char *, u_int);
extern void radius_print(const u_char *, u_int);
extern void lwres_print(const u_char *, u_int);
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 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);
/* stuff that has not yet been rototiled */
extern const u_char * ns_nprint (register const u_char *, register const u_char *);
extern void udp_print(netdissect_options *,const u_char *, u_int,
const u_char *, int);
extern void wb_print(netdissect_options *,const void *, u_int);
-extern int ah_print(netdissect_options *,register const u_char *,
- register const u_char *);
extern void esp_print_decodesecret(netdissect_options *ndo);
extern int ipcomp_print(netdissect_options *,register const u_char *,
register const u_char *, int *);
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-
#include "ah.h"
-#include "interface.h"
+#include "netdissect.h"
#include "extract.h"
int
-ah_print(register const u_char *bp)
+ah_print(netdissect_options *ndo, register const u_char *bp)
{
register const struct ah *ah;
register const u_char *ep;
u_int32_t spi;
ah = (const struct ah *)bp;
- ep = snapend; /* 'ep' points to the end of available data. */
+ ep = ndo->ndo_snapend; /* 'ep' points to the end of available data. */
- TCHECK(*ah);
+ ND_TCHECK(*ah);
sumlen = ah->ah_len << 2;
spi = EXTRACT_32BITS(&ah->ah_spi);
- printf("AH(spi=0x%08x", spi);
- if (vflag)
- printf(",sumlen=%d", sumlen);
- printf(",seq=0x%x", EXTRACT_32BITS(ah + 1));
+ ND_PRINT((ndo, "AH(spi=0x%08x", spi));
+ if (ndo->ndo_vflag)
+ ND_PRINT((ndo, ",sumlen=%d", sumlen));
+ ND_PRINT((ndo, ",seq=0x%x", EXTRACT_32BITS(ah + 1)));
if (bp + sizeof(struct ah) + sumlen > ep)
- fputs("[truncated]", stdout);
- fputs("): ", stdout);
+ ND_PRINT((ndo, "[truncated]"));
+ ND_PRINT((ndo, "): "));
return sizeof(struct ah) + sumlen;
trunc:
- fputs("[|AH]", stdout);
+ ND_PRINT((ndo, "[|AH]"));
return -1;
}
#include <tcpdump-stdinc.h>
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#include "interface.h"
-#include "extract.h"
+#include "netdissect.h"
/* Check for a string but not go beyond length
* Return TRUE on match, FALSE otherwise
* Looks at the first few chars up to tl1 ...
*/
-static int l_strnstart(const char *, u_int, const char *, u_int);
-
static int
l_strnstart(const char *tstr1, u_int tl1, const char *str2, u_int l2)
{
}
void
-beep_print(const u_char *bp, u_int length)
+beep_print(netdissect_options *ndo, const u_char *bp, u_int length)
{
if (l_strnstart("MSG", 4, (const char *)bp, length)) /* A REQuest */
- printf(" BEEP MSG");
+ ND_PRINT((ndo, " BEEP MSG"));
else if (l_strnstart("RPY ", 4, (const char *)bp, length))
- printf(" BEEP RPY");
+ ND_PRINT((ndo, " BEEP RPY"));
else if (l_strnstart("ERR ", 4, (const char *)bp, length))
- printf(" BEEP ERR");
+ ND_PRINT((ndo, " BEEP ERR"));
else if (l_strnstart("ANS ", 4, (const char *)bp, length))
- printf(" BEEP ANS");
+ ND_PRINT((ndo, " BEEP ANS"));
else if (l_strnstart("NUL ", 4, (const char *)bp, length))
- printf(" BEEP NUL");
+ ND_PRINT((ndo, " BEEP NUL"));
else if (l_strnstart("SEQ ", 4, (const char *)bp, length))
- printf(" BEEP SEQ");
+ ND_PRINT((ndo, " BEEP SEQ"));
else if (l_strnstart("END", 4, (const char *)bp, length))
- printf(" BEEP END");
+ ND_PRINT((ndo, " BEEP END"));
else
- printf(" BEEP (payload or undecoded)");
+ ND_PRINT((ndo, " BEEP (payload or undecoded)"));
}
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "interface.h"
+#include "netdissect.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))
+ if (!ND_TTEST2(*tptr, DTP_HEADER_LEN))
goto trunc;
- 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))
+ if (!ND_TTEST2(*tptr, 4))
goto trunc;
type = EXTRACT_16BITS(tptr);
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(tptr+4)));
break;
default:
return;
trunc:
- printf("[|dtp]");
+ ND_PRINT((ndo, "[|dtp]"));
}
/*
case IPPROTO_AH:
ipds->nh = *ipds->cp;
- ipds->advance = ah_print(ipds->cp);
+ ipds->advance = ah_print(gndo, ipds->cp);
if (ipds->advance <= 0)
break;
ipds->cp += ipds->advance;
icmp6_print(ndo, cp, len, (const u_char *)ip6, fragmented);
return;
case IPPROTO_AH:
- advance = ah_print(cp);
+ advance = ah_print(gndo, cp);
nh = *cp;
break;
case IPPROTO_ESP:
cdp_print(p, length, caplen);
return (1);
case PID_CISCO_DTP:
- dtp_print(p, length);
+ dtp_print(gndo, p, length);
return (1);
case PID_CISCO_UDLD:
udld_print(p, length);
smb_tcp_print(bp, length);
#endif
else if (sport == BEEP_PORT || dport == BEEP_PORT)
- beep_print(bp, length);
+ beep_print(gndo, bp, length);
else if (sport == OPENFLOW_PORT || dport == OPENFLOW_PORT)
openflow_print(bp, length);
else if (length > 2 &&