summaryrefslogtreecommitdiff
path: root/print-cip.c
diff options
context:
space:
mode:
authorDenis Ovsienko <infrastation@yandex.ru>2014-02-28 13:42:37 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2014-02-28 18:42:47 +0400
commit207f31f2bd0a007f978b60ad0881a30c055f32ee (patch)
tree8bf967fc5a00b6ad441ded146b933e7a5dddebd1 /print-cip.c
parent88e479b75ea97730bf265a2371c0658a401eae92 (diff)
downloadtcpdump-207f31f2bd0a007f978b60ad0881a30c055f32ee.tar.gz
NDOize CIP, IPComp and IPFC decoders
Also remove some unneeded includes while at it.
Diffstat (limited to 'print-cip.c')
-rw-r--r--print-cip.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/print-cip.c b/print-cip.c
index 83e08ded..8ac2f04e 100644
--- a/print-cip.c
+++ b/print-cip.c
@@ -28,12 +28,8 @@
#include <tcpdump-stdinc.h>
-#include <stdio.h>
-
#include "interface.h"
#include "addrtoname.h"
-#include "ethertype.h"
-#include "ether.h"
#define RFC1483LLC_LEN 8
@@ -46,12 +42,12 @@ static const unsigned char rfcllc[] = {
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));
}
/*
@@ -61,19 +57,19 @@ cip_print(int 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) {
/*
@@ -82,20 +78,20 @@ cip_if_print(const struct pcap_pkthdr *h, const u_char *p)
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);