Also remove some unneeded includes while at it.
extern void igmp_print(const u_char *, u_int);
extern void igrp_print(const u_char *, u_int, const u_char *);
extern void ipN_print(const u_char *, u_int);
-extern u_int ipfc_if_print(const struct pcap_pkthdr *, const u_char *);
extern void ipx_print(const u_char *, u_int);
extern void isoclns_print(const u_char *, u_int, u_int);
extern void krb_print(const u_char *);
extern u_int sl_if_print(const struct pcap_pkthdr *, const u_char *);
extern void lane_print(const u_char *, u_int, u_int);
extern u_int lane_if_print(const struct pcap_pkthdr *, const u_char *);
-extern u_int cip_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sl_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int chdlc_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int chdlc_print(register 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 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 ipx_netbios_print(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);
+extern u_int cip_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
+extern int ipcomp_print(netdissect_options *, register const u_char *, int *);
+extern u_int ipfc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
/* stuff that has not yet been rototiled */
extern const u_char * ns_nprint (register const u_char *, register const u_char *);
extern void sl_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
extern void lane_if_print(u_char *,const struct pcap_pkthdr *,const u_char *);
-extern void cip_if_print(u_char *,const struct pcap_pkthdr *,const u_char *);
extern void sl_bsdos_if_print(u_char *,
const struct pcap_pkthdr *, const u_char *);
extern void sll_if_print(u_char *,
const u_char *, int);
extern void wb_print(netdissect_options *,const void *, u_int);
extern void esp_print_decodesecret(netdissect_options *ndo);
-extern int ipcomp_print(netdissect_options *,register const u_char *,
- register const u_char *, int *);
extern void rx_print(netdissect_options *,register const u_char *,
int, int, int, u_char *);
extern void netbeui_print(netdissect_options *,u_short,
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-
#include "interface.h"
#include "addrtoname.h"
-#include "ethertype.h"
-#include "ether.h"
#define RFC1483LLC_LEN 8
0x00 };
static inline void
-cip_print(int length)
+cip_print(netdissect_options *ndo, int length)
{
/*
* There is no MAC-layer header, so just print the length.
*/
- printf("%d: ", length);
+ ND_PRINT((ndo, "%d: ", length));
}
/*
* is the number of bytes actually captured.
*/
u_int
-cip_if_print(const struct pcap_pkthdr *h, const u_char *p)
+cip_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
{
u_int caplen = h->caplen;
u_int length = h->len;
u_short extracted_ethertype;
if (memcmp(rfcllc, p, sizeof(rfcllc))==0 && caplen < RFC1483LLC_LEN) {
- printf("[|cip]");
+ ND_PRINT((ndo, "[|cip]"));
return (0);
}
- if (eflag)
- cip_print(length);
+ if (ndo->ndo_eflag)
+ cip_print(ndo, length);
if (memcmp(rfcllc, p, sizeof(rfcllc)) == 0) {
/*
if (llc_print(p, length, caplen, NULL, NULL,
&extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
- if (!eflag)
- cip_print(length);
+ if (!ndo->ndo_eflag)
+ cip_print(ndo, length);
if (extracted_ethertype) {
- printf("(LLC %s) ",
- etherproto_string(htons(extracted_ethertype)));
+ ND_PRINT((ndo, "(LLC %s) ",
+ etherproto_string(htons(extracted_ethertype))));
}
- if (!suppress_default_print)
- default_print(p, caplen);
+ if (!ndo->ndo_suppress_default_print)
+ ndo->ndo_default_print(ndo, p, caplen);
}
} else {
/*
* LLC header is absent; treat it as just IP.
*/
- ip_print(gndo, p, length);
+ ip_print(ndo, p, length);
}
return (0);
case IPPROTO_IPCOMP:
{
int enh;
- ipds->advance = ipcomp_print(ipds->cp, &enh);
+ ipds->advance = ipcomp_print(ndo, ipds->cp, &enh);
if (ipds->advance <= 0)
break;
ipds->cp += ipds->advance;
case IPPROTO_IPCOMP:
{
int enh;
- advance = ipcomp_print(cp, &enh);
+ advance = ipcomp_print(ndo, cp, &enh);
nh = enh & 0xff;
break;
}
#include "config.h"
#endif
-#include <string.h>
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-
struct ipcomp {
u_int8_t comp_nxt; /* Next Header */
u_int8_t comp_flags; /* Length of data, in 32bit */
#include <zlib.h>
#endif
-#include "interface.h"
+#include "netdissect.h"
#include "extract.h"
int
-ipcomp_print(register const u_char *bp, int *nhdr _U_)
+ipcomp_print(netdissect_options *ndo, register const u_char *bp, int *nhdr _U_)
{
register const struct ipcomp *ipcomp;
register const u_char *ep;
cpi = EXTRACT_16BITS(&ipcomp->comp_cpi);
/* 'ep' points to the end of available data. */
- ep = snapend;
+ ep = ndo->ndo_snapend;
if ((u_char *)(ipcomp + 1) >= ep - sizeof(struct ipcomp)) {
- fputs("[|IPCOMP]", stdout);
+ ND_PRINT((ndo, "[|IPCOMP]"));
goto fail;
}
- printf("IPComp(cpi=0x%04x)", cpi);
+ ND_PRINT((ndo, "IPComp(cpi=0x%04x)", cpi));
#if defined(HAVE_LIBZ) && defined(HAVE_ZLIB_H)
if (1)
*nhdr = ipcomp->comp_nxt;
advance = sizeof(struct ipcomp);
- printf(": ");
+ ND_PRINT((ndo, ": "));
return advance;
#endif
#include <tcpdump-stdinc.h>
-#include <stdio.h>
#include <string.h>
#include "interface.h"
#include "addrtoname.h"
-#include "ethertype.h"
#include "ether.h"
* Print the Network_Header
*/
static inline void
-ipfc_hdr_print(register const struct ipfc_header *ipfcp _U_,
+ipfc_hdr_print(netdissect_options *ndo,
+ register const struct ipfc_header *ipfcp _U_,
register u_int length, register const u_char *ipfcsrc,
register const u_char *ipfcdst)
{
/*
* XXX - show the upper 16 bits? Do so only if "vflag" is set?
*/
- (void) printf("%s %s %d: ", srcname, dstname, length);
+ ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length));
}
static void
-ipfc_print(const u_char *p, u_int length, u_int caplen)
+ipfc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
{
const struct ipfc_header *ipfcp = (const struct ipfc_header *)p;
struct ether_header ehdr;
u_short extracted_ethertype;
if (caplen < IPFC_HDRLEN) {
- printf("[|ipfc]");
+ ND_PRINT((ndo, "[|ipfc]"));
return;
}
/*
*/
extract_ipfc_addrs(ipfcp, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
- if (eflag)
- ipfc_hdr_print(ipfcp, length, ESRC(&ehdr), EDST(&ehdr));
+ if (ndo->ndo_eflag)
+ ipfc_hdr_print(ndo, ipfcp, length, ESRC(&ehdr), EDST(&ehdr));
/* Skip over Network_Header */
length -= IPFC_HDRLEN;
* Some kinds of LLC packet we cannot
* handle intelligently
*/
- if (!eflag)
- ipfc_hdr_print(ipfcp, length + IPFC_HDRLEN,
+ if (!ndo->ndo_eflag)
+ ipfc_hdr_print(ndo, ipfcp, length + IPFC_HDRLEN,
ESRC(&ehdr), EDST(&ehdr));
if (extracted_ethertype) {
- printf("(LLC %s) ",
- etherproto_string(htons(extracted_ethertype)));
+ ND_PRINT((ndo, "(LLC %s) ",
+ etherproto_string(htons(extracted_ethertype))));
}
- if (!suppress_default_print)
- default_print(p, caplen);
+ if (!ndo->ndo_suppress_default_print)
+ ndo->ndo_default_print(ndo, p, caplen);
}
}
* is the number of bytes actually captured.
*/
u_int
-ipfc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
+ipfc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p)
{
- ipfc_print(p, h->len, h->caplen);
+ ipfc_print(ndo, p, h->len, h->caplen);
return (IPFC_HDRLEN);
}
{ token_if_print, DLT_IEEE802 },
#ifdef DLT_LANE8023
{ lane_if_print, DLT_LANE8023 },
-#endif
-#ifdef DLT_CIP
- { cip_if_print, DLT_CIP },
-#endif
-#ifdef DLT_ATM_CLIP
- { cip_if_print, DLT_ATM_CLIP },
#endif
{ sl_if_print, DLT_SLIP },
#ifdef DLT_SLIP_BSDOS
#ifdef DLT_SUNATM
{ sunatm_if_print, DLT_SUNATM },
#endif
-#ifdef DLT_IP_OVER_FC
- { ipfc_if_print, DLT_IP_OVER_FC },
-#endif
#ifdef DLT_PRISM_HEADER
{ prism_if_print, DLT_PRISM_HEADER },
#endif
#endif
#if defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H)
{ nflog_if_print, DLT_NFLOG},
+#endif
+#ifdef DLT_CIP
+ { cip_if_print, DLT_CIP },
+#endif
+#ifdef DLT_ATM_CLIP
+ { cip_if_print, DLT_ATM_CLIP },
+#endif
+#ifdef DLT_IP_OVER_FC
+ { ipfc_if_print, DLT_IP_OVER_FC },
#endif
{ NULL, 0 },
};