1146773Ssam/*
2146773Ssam * Copyright (c) 1988-1997
3146773Ssam *	The Regents of the University of California.  All rights reserved.
4146773Ssam *
5251158Sdelphij * Copyright (c) 1998-2012  Michael Richardson <mcr@tcpdump.org>
6146773Ssam *      The TCPDUMP project
7146773Ssam *
8146773Ssam * Redistribution and use in source and binary forms, with or without
9146773Ssam * modification, are permitted provided that: (1) source code distributions
10146773Ssam * retain the above copyright notice and this paragraph in its entirety, (2)
11146773Ssam * distributions including binary code include the above copyright notice and
12146773Ssam * this paragraph in its entirety in the documentation or other materials
13146773Ssam * provided with the distribution, and (3) all advertising materials mentioning
14146773Ssam * features or use of this software display the following acknowledgement:
15146773Ssam * ``This product includes software developed by the University of California,
16146773Ssam * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
17146773Ssam * the University nor the names of its contributors may be used to endorse
18146773Ssam * or promote products derived from this software without specific prior
19146773Ssam * written permission.
20146773Ssam * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
21146773Ssam * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
22146773Ssam * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23146773Ssam *
24214478Srpaulo * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.27 2008-08-16 11:36:20 hannes Exp $ (LBL)
25146773Ssam */
26146773Ssam
27146773Ssam#ifndef netdissect_h
28146773Ssam#define netdissect_h
29146773Ssam
30146773Ssam#ifdef HAVE_OS_PROTO_H
31146773Ssam#include "os-proto.h"
32146773Ssam#endif
33146773Ssam#include <sys/types.h>
34146773Ssam
35146773Ssam#ifndef HAVE___ATTRIBUTE__
36146773Ssam#define __attribute__(x)
37146773Ssam#endif
38146773Ssam
39146773Ssam/* snprintf et al */
40146773Ssam
41146773Ssam#include <stdarg.h>
42146773Ssam
43146773Ssam#if !defined(HAVE_SNPRINTF)
44146773Ssamint snprintf (char *str, size_t sz, const char *format, ...)
45146773Ssam     __attribute__ ((format (printf, 3, 4)));
46146773Ssam#endif
47146773Ssam
48146773Ssam#if !defined(HAVE_VSNPRINTF)
49146773Ssamint vsnprintf (char *str, size_t sz, const char *format, va_list ap)
50146773Ssam     __attribute__((format (printf, 3, 0)));
51146773Ssam#endif
52146773Ssam
53146773Ssam#ifndef HAVE_STRLCAT
54146773Ssamextern size_t strlcat (char *, const char *, size_t);
55146773Ssam#endif
56146773Ssam#ifndef HAVE_STRLCPY
57146773Ssamextern size_t strlcpy (char *, const char *, size_t);
58146773Ssam#endif
59146773Ssam
60146773Ssam#ifndef HAVE_STRDUP
61146773Ssamextern char *strdup (const char *str);
62146773Ssam#endif
63146773Ssam
64146773Ssam#ifndef HAVE_STRSEP
65146773Ssamextern char *strsep(char **, const char *);
66146773Ssam#endif
67146773Ssam
68146773Ssamstruct tok {
69146773Ssam	int v;			/* value */
70146773Ssam	const char *s;		/* string */
71146773Ssam};
72146773Ssam
73146773Ssam#define TOKBUFSIZE 128
74146773Ssamextern const char *tok2strbuf(const struct tok *, const char *, int,
75146773Ssam			      char *buf, size_t bufsize);
76146773Ssam
77146773Ssam/* tok2str is deprecated */
78146773Ssamextern const char *tok2str(const struct tok *, const char *, int);
79146773Ssamextern char *bittok2str(const struct tok *, const char *, int);
80190207Srpauloextern char *bittok2str_nosep(const struct tok *, const char *, int);
81146773Ssam
82146773Ssam
83146773Ssamtypedef struct netdissect_options netdissect_options;
84146773Ssam
85146773Ssamstruct netdissect_options {
86146773Ssam  int ndo_aflag;		/* translate network and broadcast addresses */
87214478Srpaulo  int ndo_bflag;		/* print 4 byte ASes in ASDOT notation */
88146773Ssam  int ndo_eflag;		/* print ethernet header */
89146773Ssam  int ndo_fflag;		/* don't translate "foreign" IP address */
90190207Srpaulo  int ndo_Kflag;		/* don't check TCP checksums */
91146773Ssam  int ndo_nflag;		/* leave addresses as numbers */
92146773Ssam  int ndo_Nflag;		/* remove domains from printed host names */
93146773Ssam  int ndo_qflag;		/* quick (shorter) output */
94146773Ssam  int ndo_Rflag;		/* print sequence # field in AH/ESP*/
95146773Ssam  int ndo_sflag;		/* use the libsmi to translate OIDs */
96146773Ssam  int ndo_Sflag;		/* print raw TCP sequence numbers */
97146773Ssam  int ndo_tflag;		/* print packet arrival time */
98146773Ssam  int ndo_Uflag;		/* "unbuffered" output of dump files */
99146773Ssam  int ndo_uflag;		/* Print undecoded NFS handles */
100146773Ssam  int ndo_vflag;		/* verbose */
101146773Ssam  int ndo_xflag;		/* print packet in hex */
102146773Ssam  int ndo_Xflag;		/* print packet in hex/ascii */
103146773Ssam  int ndo_Aflag;		/* print packet only in ascii observing TAB,
104146773Ssam				 * LF, CR and SPACE as graphical chars
105146773Ssam				 */
106190207Srpaulo  int ndo_Bflag;		/* buffer size */
107190207Srpaulo  int ndo_Iflag;		/* rfmon (monitor) mode */
108146773Ssam  int ndo_Oflag;                /* run filter code optimizer */
109146773Ssam  int ndo_dlt;                  /* if != -1, ask libpcap for the DLT it names*/
110235530Sdelphij  int ndo_jflag;                /* packet time stamp source */
111146773Ssam  int ndo_pflag;                /* don't go promiscuous */
112146773Ssam
113251158Sdelphij  int ndo_Cflag;                /* rotate dump files after this many bytes */
114146773Ssam  int ndo_Cflag_count;      /* Keep track of which file number we're writing */
115190207Srpaulo  int ndo_Gflag;            /* rotate dump files after this many seconds */
116190207Srpaulo  int ndo_Gflag_count;      /* number of files created with Gflag rotation */
117190207Srpaulo  time_t ndo_Gflag_time;    /* The last time_t the dump file was rotated. */
118146773Ssam  int ndo_Wflag;          /* recycle output files after this number of files */
119162017Ssam  int ndo_WflagChars;
120235530Sdelphij  int ndo_Hflag;		/* dissect 802.11s draft mesh standard */
121162017Ssam  int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */
122146773Ssam  const char *ndo_dltname;
123146773Ssam
124146773Ssam  char *ndo_espsecret;
125146773Ssam  struct sa_list *ndo_sa_list_head;  /* used by print-esp.c */
126146773Ssam  struct sa_list *ndo_sa_default;
127146773Ssam
128214478Srpaulo  char *ndo_sigsecret;     	/* Signature verification secret key */
129146773Ssam
130146773Ssam  struct esp_algorithm *ndo_espsecret_xform;   /* cache of decoded  */
131146773Ssam  char                 *ndo_espsecret_key;
132146773Ssam
133146773Ssam  int   ndo_packettype;	/* as specified by -T */
134146773Ssam
135146773Ssam  char *ndo_program_name;	/*used to generate self-identifying messages */
136146773Ssam
137146773Ssam  int32_t ndo_thiszone;	/* seconds offset from gmt to local time */
138146773Ssam
139146773Ssam  int   ndo_snaplen;
140146773Ssam
141146773Ssam  /*global pointers to beginning and end of current packet (during printing) */
142146773Ssam  const u_char *ndo_packetp;
143146773Ssam  const u_char *ndo_snapend;
144146773Ssam
145146773Ssam  /* bookkeeping for ^T output */
146146773Ssam  int ndo_infodelay;
147146773Ssam
148146773Ssam  /* pointer to void function to output stuff */
149146773Ssam  void (*ndo_default_print)(netdissect_options *,
150146773Ssam  		      register const u_char *bp, register u_int length);
151146773Ssam  void (*ndo_info)(netdissect_options *, int verbose);
152146773Ssam
153146773Ssam  int  (*ndo_printf)(netdissect_options *,
154214478Srpaulo		     const char *fmt, ...)
155214478Srpaulo#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
156214478Srpaulo		     __attribute__ ((format (printf, 2, 3)))
157214478Srpaulo#endif
158214478Srpaulo		     ;
159146773Ssam  void (*ndo_error)(netdissect_options *,
160214478Srpaulo		    const char *fmt, ...)
161214478Srpaulo#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
162235530Sdelphij		     __attribute__ ((noreturn, format (printf, 2, 3)))
163214478Srpaulo#endif
164214478Srpaulo		     ;
165146773Ssam  void (*ndo_warning)(netdissect_options *,
166214478Srpaulo		      const char *fmt, ...)
167214478Srpaulo#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
168214478Srpaulo		     __attribute__ ((format (printf, 2, 3)))
169214478Srpaulo#endif
170214478Srpaulo		     ;
171146773Ssam};
172146773Ssam
173146773Ssam#define PT_VAT		1	/* Visual Audio Tool */
174146773Ssam#define PT_WB		2	/* distributed White Board */
175146773Ssam#define PT_RPC		3	/* Remote Procedure Call */
176146773Ssam#define PT_RTP		4	/* Real-Time Applications protocol */
177146773Ssam#define PT_RTCP		5	/* Real-Time Applications control protocol */
178146773Ssam#define PT_SNMP		6	/* Simple Network Management Protocol */
179146773Ssam#define PT_CNFP		7	/* Cisco NetFlow protocol */
180251158Sdelphij#define PT_TFTP		8	/* trivial file transfer protocol */
181251158Sdelphij#define PT_AODV		9	/* Ad-hoc On-demand Distance Vector Protocol */
182251158Sdelphij#define PT_CARP		10	/* Common Address Redundancy Protocol */
183251158Sdelphij#define PT_RADIUS	11	/* RADIUS authentication Protocol */
184251158Sdelphij#define PT_ZMTP1	12	/* ZeroMQ Message Transport Protocol 1.0 */
185251158Sdelphij#define PT_VXLAN	13	/* Virtual eXtensible Local Area Network */
186146773Ssam
187146773Ssam#ifndef min
188146773Ssam#define min(a,b) ((a)>(b)?(b):(a))
189146773Ssam#endif
190146773Ssam#ifndef max
191146773Ssam#define max(a,b) ((b)>(a)?(b):(a))
192146773Ssam#endif
193146773Ssam
194146773Ssam/*
195214478Srpaulo * Maximum snapshot length.  This should be enough to capture the full
196214478Srpaulo * packet on most network interfaces.
197214478Srpaulo *
198214478Srpaulo * XXX - could it be larger?  If so, should it?  Some applications might
199214478Srpaulo * use the snapshot length in a savefile header to control the size of
200214478Srpaulo * the buffer they allocate, so a size of, say, 2^31-1 might not work
201214478Srpaulo * well.
202146773Ssam */
203214478Srpaulo#define MAXIMUM_SNAPLEN	65535
204146773Ssam
205214478Srpaulo/*
206214478Srpaulo * The default snapshot length is the maximum.
207214478Srpaulo */
208214478Srpaulo#define DEFAULT_SNAPLEN	MAXIMUM_SNAPLEN
209146773Ssam
210146773Ssam#define ESRC(ep) ((ep)->ether_shost)
211146773Ssam#define EDST(ep) ((ep)->ether_dhost)
212146773Ssam
213146773Ssam#ifndef NTOHL
214146773Ssam#define NTOHL(x)	(x) = ntohl(x)
215146773Ssam#define NTOHS(x)	(x) = ntohs(x)
216146773Ssam#define HTONL(x)	(x) = htonl(x)
217146773Ssam#define HTONS(x)	(x) = htons(x)
218146773Ssam#endif
219146773Ssam
220146773Ssam/*
221146773Ssam * True if "l" bytes of "var" were captured.
222146773Ssam *
223146773Ssam * The "ndo->ndo_snapend - (l) <= ndo->ndo_snapend" checks to make sure
224146773Ssam * "l" isn't so large that "ndo->ndo_snapend - (l)" underflows.
225146773Ssam *
226146773Ssam * The check is for <= rather than < because "l" might be 0.
227146773Ssam */
228146773Ssam#define ND_TTEST2(var, l) (ndo->ndo_snapend - (l) <= ndo->ndo_snapend && \
229146773Ssam			(const u_char *)&(var) <= ndo->ndo_snapend - (l))
230146773Ssam
231146773Ssam/* True if "var" was captured */
232146773Ssam#define ND_TTEST(var) ND_TTEST2(var, sizeof(var))
233146773Ssam
234146773Ssam/* Bail if "l" bytes of "var" were not captured */
235146773Ssam#define ND_TCHECK2(var, l) if (!ND_TTEST2(var, l)) goto trunc
236146773Ssam
237146773Ssam/* Bail if "var" was not captured */
238146773Ssam#define ND_TCHECK(var) ND_TCHECK2(var, sizeof(var))
239146773Ssam
240146773Ssam#define ND_PRINT(STUFF) (*ndo->ndo_printf)STUFF
241146773Ssam#define ND_DEFAULTPRINT(ap, length) (*ndo->ndo_default_print)(ndo, ap, length)
242146773Ssam
243251158Sdelphij#if 0
244146773Ssamextern void ts_print(netdissect_options *ipdo,
245146773Ssam		     const struct timeval *);
246146773Ssamextern void relts_print(int);
247146773Ssam#endif
248146773Ssam
249146773Ssamextern int fn_print(const u_char *, const u_char *);
250146773Ssamextern int fn_printn(const u_char *, u_int, const u_char *);
251146773Ssamextern const char *tok2str(const struct tok *, const char *, int);
252146773Ssam
253146773Ssamextern void wrapup(int);
254146773Ssam
255146773Ssam#if 0
256146773Ssamextern char *read_infile(netdissect_options *, char *);
257146773Ssamextern char *copy_argv(netdissect_options *, char **);
258146773Ssam#endif
259146773Ssam
260146773Ssamextern void safeputchar(int);
261172683Smlaierextern void safeputs(const char *, int);
262146773Ssam
263235530Sdelphij#define PLURAL_SUFFIX(n) \
264235530Sdelphij	(((n) != 1) ? "s" : "")
265235530Sdelphij
266146773Ssam#if 0
267146773Ssamextern const char *isonsap_string(netdissect_options *, const u_char *);
268146773Ssamextern const char *protoid_string(netdissect_options *, const u_char *);
269146773Ssamextern const char *dnname_string(netdissect_options *, u_short);
270146773Ssamextern const char *dnnum_string(netdissect_options *, u_short);
271146773Ssam#endif
272146773Ssam
273146773Ssam/* The printer routines. */
274146773Ssam
275146773Ssam#include <pcap.h>
276146773Ssam
277235530Sdelphijtypedef u_int (*if_ndo_printer)(struct netdissect_options *ndo,
278235530Sdelphij				const struct pcap_pkthdr *, const u_char *);
279235530Sdelphijtypedef u_int (*if_printer)(const struct pcap_pkthdr *, const u_char *);
280146773Ssam
281235530Sdelphijextern if_ndo_printer lookup_ndo_printer(int);
282235530Sdelphijextern if_printer lookup_printer(int);
283235530Sdelphij
284190207Srpauloextern void eap_print(netdissect_options *,const u_char *, u_int);
285146773Ssamextern int esp_print(netdissect_options *,
286146773Ssam		     register const u_char *bp, int len, register const u_char *bp2,
287146773Ssam		     int *nhdr, int *padlen);
288146773Ssamextern void arp_print(netdissect_options *,const u_char *, u_int, u_int);
289241235Sdelphijextern void tipc_print(netdissect_options *, const u_char *, u_int, u_int);
290251158Sdelphijextern void msnlb_print(netdissect_options *, const u_char *, u_int);
291214478Srpauloextern void icmp6_print(netdissect_options *ndo, const u_char *,
292214478Srpaulo                        u_int, const u_char *, int);
293146773Ssamextern void isakmp_print(netdissect_options *,const u_char *,
294146773Ssam			 u_int, const u_char *);
295146773Ssamextern void isakmp_rfc3948_print(netdissect_options *,const u_char *,
296146773Ssam				 u_int, const u_char *);
297146773Ssamextern void ip_print(netdissect_options *,const u_char *, u_int);
298146773Ssamextern void ip_print_inner(netdissect_options *ndo,
299146773Ssam			   const u_char *bp, u_int length, u_int nh,
300146773Ssam			   const u_char *bp2);
301190207Srpauloextern void rrcp_print(netdissect_options *,const u_char *, u_int);
302146773Ssam
303235530Sdelphijextern void ether_print(netdissect_options *,
304235530Sdelphij                        const u_char *, u_int, u_int,
305235530Sdelphij                        void (*)(netdissect_options *, const u_char *),
306235530Sdelphij                        const u_char *);
307235530Sdelphij
308251158Sdelphijextern u_int ether_if_print(netdissect_options *,
309235530Sdelphij                            const struct pcap_pkthdr *,const u_char *);
310251158Sdelphijextern u_int netanalyzer_if_print(netdissect_options *,
311235530Sdelphij                                  const struct pcap_pkthdr *,const u_char *);
312251158Sdelphijextern u_int netanalyzer_transparent_if_print(netdissect_options *,
313235530Sdelphij                                              const struct pcap_pkthdr *,
314235530Sdelphij                                              const u_char *);
315235530Sdelphij
316235530Sdelphijextern int ethertype_print(netdissect_options *,u_short, const u_char *,
317235530Sdelphij			     u_int, u_int);
318235530Sdelphij
319146773Ssam/* stuff that has not yet been rototiled */
320146773Ssam#if 0
321162017Ssamextern void ascii_print(netdissect_options *,u_int);
322162017Ssamextern void hex_and_ascii_print_with_offset(netdissect_options *,const char *,
323162017Ssam				    u_int, u_int);
324162017Ssamextern void hex_and_ascii_print(netdissect_options *,const char *, u_int);
325146773Ssamextern void hex_print_with_offset(netdissect_options *,const char *,
326162017Ssam				  u_int, u_int);
327162017Ssamextern void hex_print(netdissect_options *,const char *, u_int);
328162017Ssamextern void telnet_print(netdissect_options *,const u_char *, u_int);
329146773Ssamextern int llc_print(netdissect_options *,
330146773Ssam		     const u_char *, u_int, u_int, const u_char *,
331146773Ssam		     const u_char *, u_short *);
332146773Ssamextern void aarp_print(netdissect_options *,const u_char *, u_int);
333146773Ssamextern void atalk_print(netdissect_options *,const u_char *, u_int);
334146773Ssamextern void atm_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
335146773Ssamextern void bootp_print(netdissect_options *,const u_char *,
336146773Ssam			u_int, u_short, u_short);
337146773Ssamextern void bgp_print(netdissect_options *,const u_char *, int);
338146773Ssamextern void bxxp_print(netdissect_options *,const u_char *, u_int);
339146773Ssamextern void chdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
340146773Ssam			   register const u_char *p);
341146773Ssamextern void chdlc_print(netdissect_options *ndo,
342146773Ssam			register const u_char *p, u_int length, u_int caplen);
343146773Ssamextern void cisco_autorp_print(netdissect_options *,
344146773Ssam			       const u_char *, u_int);
345146773Ssamextern void cnfp_print(netdissect_options *,const u_char *cp,
346146773Ssam		       u_int len, const u_char *bp);
347146773Ssamextern void decnet_print(netdissect_options *,const u_char *,
348146773Ssam			 u_int, u_int);
349146773Ssamextern void default_print(netdissect_options *,const u_char *, u_int);
350146773Ssamextern void dvmrp_print(netdissect_options *,const u_char *, u_int);
351146773Ssamextern void egp_print(netdissect_options *,const u_char *, u_int,
352146773Ssam		      const u_char *);
353146773Ssam
354146773Ssamextern void arcnet_if_print(u_char*,const struct pcap_pkthdr *,const u_char *);
355146773Ssamextern void token_if_print(u_char *,const struct pcap_pkthdr *,const u_char *);
356146773Ssamextern void fddi_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
357146773Ssam
358146773Ssamextern void gre_print(netdissect_options *,const u_char *, u_int);
359146773Ssamextern void icmp_print(netdissect_options *,const u_char *, u_int,
360146773Ssam		       const u_char *);
361146773Ssamextern void hsrp_print(netdissect_options *ndo,
362146773Ssam		       register const u_char *bp, register u_int len);
363146773Ssamextern void ieee802_11_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
364146773Ssamextern void igmp_print(netdissect_options *,
365146773Ssam		       register const u_char *, u_int);
366146773Ssamextern void igrp_print(netdissect_options *,const u_char *, u_int,
367146773Ssam		       const u_char *);
368235530Sdelphijextern int nextproto4_cksum(const struct ip *, const u_int8_t *, u_int, u_int);
369146773Ssamextern void ipN_print(netdissect_options *,const u_char *, u_int);
370146773Ssamextern void ipx_print(netdissect_options *,const u_char *, u_int);
371146773Ssamextern void isoclns_print(netdissect_options *,const u_char *,
372146773Ssam			  u_int, u_int, const u_char *,	const u_char *);
373146773Ssamextern void krb_print(netdissect_options *,const u_char *, u_int);
374146773Ssamextern void llap_print(netdissect_options *,const u_char *, u_int);
375146773Ssamextern const char *linkaddr_string(netdissect_options *ndo,
376146773Ssam				   const u_char *ep, const unsigned int len);
377146773Ssamextern void ltalk_if_print(netdissect_options *ndo,
378146773Ssam			   u_char *user, const struct pcap_pkthdr *h,
379146773Ssam			   const u_char *p);
380146773Ssamextern void mpls_print(netdissect_options *ndo,
381146773Ssam		       const u_char *bp, u_int length);
382146773Ssamextern void msdp_print(netdissect_options *ndo,
383146773Ssam		       const unsigned char *sp, u_int length);
384146773Ssamextern void nfsreply_print(netdissect_options *,const u_char *,
385146773Ssam			   u_int, const u_char *);
386146773Ssamextern void nfsreq_print(netdissect_options *,const u_char *,
387146773Ssam			 u_int, const u_char *);
388146773Ssamextern void ns_print(netdissect_options *,const u_char *, u_int);
389146773Ssamextern void ntp_print(netdissect_options *,const u_char *, u_int);
390146773Ssamextern void null_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
391146773Ssamextern void ospf_print(netdissect_options *,const u_char *,
392146773Ssam		       u_int, const u_char *);
393146773Ssamextern void pimv1_print(netdissect_options *,const u_char *, u_int);
394146773Ssamextern void mobile_print(netdissect_options *,const u_char *, u_int);
395214478Srpauloextern void pim_print(netdissect_options *,const u_char *, u_int, u_int);
396146773Ssamextern void pppoe_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
397146773Ssamextern void pppoe_print(netdissect_options *,const u_char *, u_int);
398146773Ssamextern void ppp_print(netdissect_options *,
399146773Ssam		      register const u_char *, u_int);
400146773Ssam
401146773Ssamextern void ppp_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
402146773Ssamextern void ppp_hdlc_if_print(u_char *,
403146773Ssam			      const struct pcap_pkthdr *, const u_char *);
404146773Ssamextern void ppp_bsdos_if_print(u_char *,
405146773Ssam			       const struct pcap_pkthdr *, const u_char *);
406146773Ssam
407146773Ssamextern int vjc_print(netdissect_options *,register const char *,
408146773Ssam		     register u_int, u_short);
409146773Ssam
410146773Ssamextern void raw_if_print(u_char *,
411146773Ssam			 const struct pcap_pkthdr *, const u_char *);
412146773Ssam
413146773Ssamextern void rip_print(netdissect_options *,const u_char *, u_int);
414235530Sdelphijextern void rpki_rtr_print(netdissect_options *,const u_char *, u_int);
415146773Ssam
416146773Ssamextern void sctp_print(netdissect_options *ndo,
417251158Sdelphij		       const u_char *bp, const u_char *bp2,
418146773Ssam		       u_int sctpPacketLength);
419146773Ssam
420146773Ssamextern void sl_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
421146773Ssam
422146773Ssamextern void lane_if_print(u_char *,const struct pcap_pkthdr *,const u_char *);
423146773Ssamextern void cip_if_print(u_char *,const struct pcap_pkthdr *,const u_char *);
424146773Ssamextern void sl_bsdos_if_print(u_char *,
425146773Ssam			      const struct pcap_pkthdr *, const u_char *);
426146773Ssamextern void sll_if_print(u_char *,
427146773Ssam			 const struct pcap_pkthdr *, const u_char *);
428146773Ssam
429146773Ssamextern void snmp_print(netdissect_options *,const u_char *, u_int);
430146773Ssamextern void sunrpcrequest_print(netdissect_options *,const u_char *,
431146773Ssam				u_int, const u_char *);
432146773Ssamextern void tcp_print(netdissect_options *,const u_char *, u_int,
433146773Ssam		      const u_char *, int);
434146773Ssamextern void tftp_print(netdissect_options *,const u_char *, u_int);
435146773Ssamextern void timed_print(netdissect_options *,const u_char *, u_int);
436146773Ssamextern void udp_print(netdissect_options *,const u_char *, u_int,
437146773Ssam		      const u_char *, int);
438146773Ssamextern void wb_print(netdissect_options *,const void *, u_int);
439146773Ssamextern int ah_print(netdissect_options *,register const u_char *,
440146773Ssam		    register const u_char *);
441146773Ssamextern void esp_print_decodesecret(netdissect_options *ndo);
442146773Ssamextern int ipcomp_print(netdissect_options *,register const u_char *,
443146773Ssam			register const u_char *, int *);
444146773Ssamextern void rx_print(netdissect_options *,register const u_char *,
445146773Ssam		     int, int, int, u_char *);
446146773Ssamextern void netbeui_print(netdissect_options *,u_short,
447146773Ssam			  const u_char *, int);
448146773Ssamextern void ipx_netbios_print(netdissect_options *,const u_char *, u_int);
449146773Ssamextern void nbt_tcp_print(netdissect_options *,const u_char *, int);
450146773Ssamextern void nbt_udp137_print(netdissect_options *,
451146773Ssam			     const u_char *data, int);
452146773Ssamextern void nbt_udp138_print(netdissect_options *,
453146773Ssam			     const u_char *data, int);
454146773Ssamextern char *smb_errstr(netdissect_options *,int, int);
455146773Ssamextern const char *nt_errstr(netdissect_options *, u_int32_t);
456146773Ssamextern void print_data(netdissect_options *,const unsigned char *, int);
457146773Ssamextern void l2tp_print(netdissect_options *,const u_char *, u_int);
458146773Ssamextern void lcp_print(netdissect_options *,const u_char *, u_int);
459146773Ssamextern void vrrp_print(netdissect_options *,const u_char *bp,
460146773Ssam		       u_int len, int ttl);
461235530Sdelphijextern void carp_print(netdissect_options *,const u_char *bp,
462235530Sdelphij		       u_int len, int ttl);
463146773Ssamextern void cdp_print(netdissect_options *,const u_char *,
464146773Ssam		      u_int, u_int, const u_char *, const u_char *);
465146773Ssamextern void stp_print(netdissect_options *,const u_char *p, u_int length);
466146773Ssamextern void radius_print(netdissect_options *,const u_char *, u_int);
467146773Ssamextern void lwres_print(netdissect_options *,const u_char *, u_int);
468146773Ssamextern void pptp_print(netdissect_options *,const u_char *, u_int);
469214478Srpaulo#endif
470146773Ssam
471214478Srpauloextern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
472235530Sdelphijextern u_int ppi_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
473214478Srpaulo
474235530Sdelphijextern u_int ieee802_15_4_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
475235530Sdelphij
476146773Ssam#ifdef INET6
477146773Ssamextern void ip6_print(netdissect_options *,const u_char *, u_int);
478235530Sdelphij#if 0
479146773Ssamextern void ip6_opt_print(netdissect_options *,const u_char *, int);
480235530Sdelphijextern int nextproto6_cksum(const struct ip6_hdr *, const u_int8_t *, u_int, u_int);
481146773Ssamextern int hbhopt_print(netdissect_options *,const u_char *);
482146773Ssamextern int dstopt_print(netdissect_options *,const u_char *);
483146773Ssamextern int frag6_print(netdissect_options *,const u_char *,
484146773Ssam		       const u_char *);
485146773Ssamextern void icmp6_print(netdissect_options *,const u_char *,
486146773Ssam			const u_char *);
487146773Ssamextern void ripng_print(netdissect_options *,const u_char *, int);
488146773Ssamextern int rt6_print(netdissect_options *,const u_char *, const u_char *);
489146773Ssamextern void ospf6_print(netdissect_options *,const u_char *, u_int);
490146773Ssamextern void dhcp6_print(netdissect_options *,const u_char *,
491146773Ssam			u_int, u_int16_t, u_int16_t);
492146773Ssam
493146773Ssamextern void zephyr_print(netdissect_options * ndo,
494146773Ssam			 const u_char *cp, int length);
495235530Sdelphij#endif /* 0 */
496146773Ssam
497146773Ssam#endif /*INET6*/
498146773Ssam
499235530Sdelphij#if 0
500235530Sdelphijstruct cksum_vec {
501235530Sdelphij	const u_int8_t	*ptr;
502235530Sdelphij	int		len;
503235530Sdelphij};
504235530Sdelphijextern u_int16_t in_cksum(const struct cksum_vec *, int);
505235530Sdelphijextern u_int16_t in_cksum_shouldbe(u_int16_t, u_int16_t);
506146773Ssam#endif
507146773Ssam
508214478Srpauloextern void esp_print_decodesecret(netdissect_options *ndo);
509214478Srpauloextern int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
510214478Srpaulo					     int initiator,
511214478Srpaulo					     u_char spii[8], u_char spir[8],
512214478Srpaulo					     u_char *buf, u_char *end);
513214478Srpaulo
514214478Srpaulo
515146773Ssam#endif  /* netdissect_h */
516