netdissect.h revision 285275
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 */ 24146773Ssam 25146773Ssam#ifndef netdissect_h 26146773Ssam#define netdissect_h 27146773Ssam 28146773Ssam#ifdef HAVE_OS_PROTO_H 29146773Ssam#include "os-proto.h" 30146773Ssam#endif 31146773Ssam#include <sys/types.h> 32146773Ssam 33146773Ssam#ifndef HAVE___ATTRIBUTE__ 34146773Ssam#define __attribute__(x) 35146773Ssam#endif 36146773Ssam 37146773Ssam/* snprintf et al */ 38146773Ssam 39146773Ssam#include <stdarg.h> 40146773Ssam 41276788Sdelphij#include "ip.h" /* struct ip for nextproto4_cksum() */ 42276788Sdelphij 43146773Ssam#if !defined(HAVE_SNPRINTF) 44146773Ssamint snprintf (char *str, size_t sz, const char *format, ...) 45276788Sdelphij#ifdef __ATTRIBUTE___FORMAT_OK 46276788Sdelphij __attribute__((format (printf, 3, 4))) 47276788Sdelphij#endif /* __ATTRIBUTE___FORMAT_OK */ 48276788Sdelphij ; 49276788Sdelphij#endif /* !defined(HAVE_SNPRINTF) */ 50146773Ssam 51146773Ssam#if !defined(HAVE_VSNPRINTF) 52146773Ssamint vsnprintf (char *str, size_t sz, const char *format, va_list ap) 53276788Sdelphij#ifdef __ATTRIBUTE___FORMAT_OK 54276788Sdelphij __attribute__((format (printf, 3, 0))) 55276788Sdelphij#endif /* __ATTRIBUTE___FORMAT_OK */ 56276788Sdelphij ; 57276788Sdelphij#endif /* !defined(HAVE_SNPRINTF) */ 58146773Ssam 59146773Ssam#ifndef HAVE_STRLCAT 60146773Ssamextern size_t strlcat (char *, const char *, size_t); 61146773Ssam#endif 62146773Ssam#ifndef HAVE_STRLCPY 63146773Ssamextern size_t strlcpy (char *, const char *, size_t); 64146773Ssam#endif 65146773Ssam 66146773Ssam#ifndef HAVE_STRDUP 67146773Ssamextern char *strdup (const char *str); 68146773Ssam#endif 69146773Ssam 70146773Ssam#ifndef HAVE_STRSEP 71146773Ssamextern char *strsep(char **, const char *); 72146773Ssam#endif 73146773Ssam 74146773Ssamstruct tok { 75276788Sdelphij u_int v; /* value */ 76146773Ssam const char *s; /* string */ 77146773Ssam}; 78146773Ssam 79146773Ssam#define TOKBUFSIZE 128 80276788Sdelphijextern const char *tok2strbuf(const struct tok *, const char *, u_int, 81146773Ssam char *buf, size_t bufsize); 82146773Ssam 83146773Ssam/* tok2str is deprecated */ 84285275Spkelseyextern const char *tok2str(const struct tok *, const char *, u_int); 85285275Spkelseyextern char *bittok2str(const struct tok *, const char *, u_int); 86285275Spkelseyextern char *bittok2str_nosep(const struct tok *, const char *, u_int); 87146773Ssam 88146773Ssam 89146773Ssamtypedef struct netdissect_options netdissect_options; 90146773Ssam 91146773Ssamstruct netdissect_options { 92146773Ssam int ndo_aflag; /* translate network and broadcast addresses */ 93214478Srpaulo int ndo_bflag; /* print 4 byte ASes in ASDOT notation */ 94146773Ssam int ndo_eflag; /* print ethernet header */ 95146773Ssam int ndo_fflag; /* don't translate "foreign" IP address */ 96190207Srpaulo int ndo_Kflag; /* don't check TCP checksums */ 97146773Ssam int ndo_nflag; /* leave addresses as numbers */ 98146773Ssam int ndo_Nflag; /* remove domains from printed host names */ 99146773Ssam int ndo_qflag; /* quick (shorter) output */ 100146773Ssam int ndo_Rflag; /* print sequence # field in AH/ESP*/ 101146773Ssam int ndo_sflag; /* use the libsmi to translate OIDs */ 102146773Ssam int ndo_Sflag; /* print raw TCP sequence numbers */ 103146773Ssam int ndo_tflag; /* print packet arrival time */ 104146773Ssam int ndo_Uflag; /* "unbuffered" output of dump files */ 105146773Ssam int ndo_uflag; /* Print undecoded NFS handles */ 106146773Ssam int ndo_vflag; /* verbose */ 107146773Ssam int ndo_xflag; /* print packet in hex */ 108146773Ssam int ndo_Xflag; /* print packet in hex/ascii */ 109146773Ssam int ndo_Aflag; /* print packet only in ascii observing TAB, 110146773Ssam * LF, CR and SPACE as graphical chars 111146773Ssam */ 112190207Srpaulo int ndo_Bflag; /* buffer size */ 113190207Srpaulo int ndo_Iflag; /* rfmon (monitor) mode */ 114146773Ssam int ndo_Oflag; /* run filter code optimizer */ 115146773Ssam int ndo_dlt; /* if != -1, ask libpcap for the DLT it names*/ 116235530Sdelphij int ndo_jflag; /* packet time stamp source */ 117146773Ssam int ndo_pflag; /* don't go promiscuous */ 118285275Spkelsey int ndo_immediate; /* use immediate mode */ 119146773Ssam 120251158Sdelphij int ndo_Cflag; /* rotate dump files after this many bytes */ 121146773Ssam int ndo_Cflag_count; /* Keep track of which file number we're writing */ 122190207Srpaulo int ndo_Gflag; /* rotate dump files after this many seconds */ 123190207Srpaulo int ndo_Gflag_count; /* number of files created with Gflag rotation */ 124190207Srpaulo time_t ndo_Gflag_time; /* The last time_t the dump file was rotated. */ 125146773Ssam int ndo_Wflag; /* recycle output files after this number of files */ 126162017Ssam int ndo_WflagChars; 127235530Sdelphij int ndo_Hflag; /* dissect 802.11s draft mesh standard */ 128276788Sdelphij int ndo_packet_number; /* print a packet number in the beginning of line */ 129162017Ssam int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */ 130276788Sdelphij int ndo_tstamp_precision; /* requested time stamp precision */ 131146773Ssam const char *ndo_dltname; 132146773Ssam 133146773Ssam char *ndo_espsecret; 134146773Ssam struct sa_list *ndo_sa_list_head; /* used by print-esp.c */ 135146773Ssam struct sa_list *ndo_sa_default; 136146773Ssam 137214478Srpaulo char *ndo_sigsecret; /* Signature verification secret key */ 138146773Ssam 139146773Ssam struct esp_algorithm *ndo_espsecret_xform; /* cache of decoded */ 140146773Ssam char *ndo_espsecret_key; 141146773Ssam 142146773Ssam int ndo_packettype; /* as specified by -T */ 143146773Ssam 144146773Ssam char *ndo_program_name; /*used to generate self-identifying messages */ 145146773Ssam 146146773Ssam int32_t ndo_thiszone; /* seconds offset from gmt to local time */ 147146773Ssam 148146773Ssam int ndo_snaplen; 149146773Ssam 150146773Ssam /*global pointers to beginning and end of current packet (during printing) */ 151146773Ssam const u_char *ndo_packetp; 152146773Ssam const u_char *ndo_snapend; 153146773Ssam 154146773Ssam /* bookkeeping for ^T output */ 155146773Ssam int ndo_infodelay; 156146773Ssam 157146773Ssam /* pointer to void function to output stuff */ 158146773Ssam void (*ndo_default_print)(netdissect_options *, 159146773Ssam register const u_char *bp, register u_int length); 160285275Spkelsey 161285275Spkelsey /* pointer to function to print ^T output */ 162146773Ssam void (*ndo_info)(netdissect_options *, int verbose); 163146773Ssam 164285275Spkelsey /* pointer to function to do regular output */ 165146773Ssam int (*ndo_printf)(netdissect_options *, 166214478Srpaulo const char *fmt, ...) 167214478Srpaulo#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS 168214478Srpaulo __attribute__ ((format (printf, 2, 3))) 169214478Srpaulo#endif 170214478Srpaulo ; 171285275Spkelsey /* pointer to function to output errors */ 172146773Ssam void (*ndo_error)(netdissect_options *, 173214478Srpaulo const char *fmt, ...) 174276788Sdelphij#ifdef __ATTRIBUTE___NORETURN_OK_FOR_FUNCTION_POINTERS 175276788Sdelphij __attribute__ ((noreturn)) 176276788Sdelphij#endif /* __ATTRIBUTE___NORETURN_OK_FOR_FUNCTION_POINTERS */ 177214478Srpaulo#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS 178276788Sdelphij __attribute__ ((format (printf, 2, 3))) 179276788Sdelphij#endif /* __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS */ 180214478Srpaulo ; 181285275Spkelsey /* pointer to function to output warnings */ 182146773Ssam void (*ndo_warning)(netdissect_options *, 183214478Srpaulo const char *fmt, ...) 184214478Srpaulo#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS 185214478Srpaulo __attribute__ ((format (printf, 2, 3))) 186214478Srpaulo#endif 187214478Srpaulo ; 188146773Ssam}; 189146773Ssam 190146773Ssam#define PT_VAT 1 /* Visual Audio Tool */ 191146773Ssam#define PT_WB 2 /* distributed White Board */ 192146773Ssam#define PT_RPC 3 /* Remote Procedure Call */ 193146773Ssam#define PT_RTP 4 /* Real-Time Applications protocol */ 194146773Ssam#define PT_RTCP 5 /* Real-Time Applications control protocol */ 195146773Ssam#define PT_SNMP 6 /* Simple Network Management Protocol */ 196146773Ssam#define PT_CNFP 7 /* Cisco NetFlow protocol */ 197251158Sdelphij#define PT_TFTP 8 /* trivial file transfer protocol */ 198251158Sdelphij#define PT_AODV 9 /* Ad-hoc On-demand Distance Vector Protocol */ 199251158Sdelphij#define PT_CARP 10 /* Common Address Redundancy Protocol */ 200251158Sdelphij#define PT_RADIUS 11 /* RADIUS authentication Protocol */ 201251158Sdelphij#define PT_ZMTP1 12 /* ZeroMQ Message Transport Protocol 1.0 */ 202251158Sdelphij#define PT_VXLAN 13 /* Virtual eXtensible Local Area Network */ 203276788Sdelphij#define PT_PGM 14 /* [UDP-encapsulated] Pragmatic General Multicast */ 204276788Sdelphij#define PT_PGM_ZMTP1 15 /* ZMTP/1.0 inside PGM (native or UDP-encapsulated) */ 205276788Sdelphij#define PT_LMP 16 /* Link Management Protocol */ 206146773Ssam 207146773Ssam#ifndef min 208146773Ssam#define min(a,b) ((a)>(b)?(b):(a)) 209146773Ssam#endif 210146773Ssam#ifndef max 211146773Ssam#define max(a,b) ((b)>(a)?(b):(a)) 212146773Ssam#endif 213146773Ssam 214146773Ssam/* 215214478Srpaulo * Maximum snapshot length. This should be enough to capture the full 216214478Srpaulo * packet on most network interfaces. 217214478Srpaulo * 218276788Sdelphij * 219276788Sdelphij * Somewhat arbitrary, but chosen to be: 220276788Sdelphij * 221276788Sdelphij * 1) big enough for maximum-size Linux loopback packets (65549) 222276788Sdelphij * and some USB packets captured with USBPcap: 223276788Sdelphij * 224276788Sdelphij * http://desowin.org/usbpcap/ 225276788Sdelphij * 226276788Sdelphij * (> 131072, < 262144) 227276788Sdelphij * 228276788Sdelphij * and 229276788Sdelphij * 230276788Sdelphij * 2) small enough not to cause attempts to allocate huge amounts of 231276788Sdelphij * memory; some applications might use the snapshot length in a 232276788Sdelphij * savefile header to control the size of the buffer they allocate, 233276788Sdelphij * so a size of, say, 2^31-1 might not work well. 234276788Sdelphij * 235276788Sdelphij * XXX - does it need to be bigger still? 236146773Ssam */ 237276788Sdelphij#define MAXIMUM_SNAPLEN 262144 238146773Ssam 239214478Srpaulo/* 240214478Srpaulo * The default snapshot length is the maximum. 241214478Srpaulo */ 242214478Srpaulo#define DEFAULT_SNAPLEN MAXIMUM_SNAPLEN 243146773Ssam 244146773Ssam#define ESRC(ep) ((ep)->ether_shost) 245146773Ssam#define EDST(ep) ((ep)->ether_dhost) 246146773Ssam 247146773Ssam#ifndef NTOHL 248146773Ssam#define NTOHL(x) (x) = ntohl(x) 249146773Ssam#define NTOHS(x) (x) = ntohs(x) 250146773Ssam#define HTONL(x) (x) = htonl(x) 251146773Ssam#define HTONS(x) (x) = htons(x) 252146773Ssam#endif 253146773Ssam 254146773Ssam/* 255146773Ssam * True if "l" bytes of "var" were captured. 256146773Ssam * 257146773Ssam * The "ndo->ndo_snapend - (l) <= ndo->ndo_snapend" checks to make sure 258146773Ssam * "l" isn't so large that "ndo->ndo_snapend - (l)" underflows. 259146773Ssam * 260146773Ssam * The check is for <= rather than < because "l" might be 0. 261285275Spkelsey * 262285275Spkelsey * We cast the pointers to uintptr_t to make sure that the compiler 263285275Spkelsey * doesn't optimize away any of these tests (which it is allowed to 264285275Spkelsey * do, as adding an integer to, or subtracting an integer from, a 265285275Spkelsey * pointer assumes that the pointer is a pointer to an element of an 266285275Spkelsey * array and that the result of the addition or subtraction yields a 267285275Spkelsey * pointer to another member of the array, so that, for example, if 268285275Spkelsey * you subtract a positive integer from a pointer, the result is 269285275Spkelsey * guaranteed to be less than the original pointer value). See 270285275Spkelsey * 271285275Spkelsey * http://www.kb.cert.org/vuls/id/162289 272146773Ssam */ 273285275Spkelsey#define ND_TTEST2(var, l) \ 274285275Spkelsey ((l) >= 0 && \ 275285275Spkelsey ((uintptr_t)ndo->ndo_snapend - (l) <= (uintptr_t)ndo->ndo_snapend && \ 276285275Spkelsey (uintptr_t)&(var) <= (uintptr_t)ndo->ndo_snapend - (l))) 277146773Ssam 278146773Ssam/* True if "var" was captured */ 279146773Ssam#define ND_TTEST(var) ND_TTEST2(var, sizeof(var)) 280146773Ssam 281146773Ssam/* Bail if "l" bytes of "var" were not captured */ 282146773Ssam#define ND_TCHECK2(var, l) if (!ND_TTEST2(var, l)) goto trunc 283146773Ssam 284146773Ssam/* Bail if "var" was not captured */ 285146773Ssam#define ND_TCHECK(var) ND_TCHECK2(var, sizeof(var)) 286146773Ssam 287146773Ssam#define ND_PRINT(STUFF) (*ndo->ndo_printf)STUFF 288146773Ssam#define ND_DEFAULTPRINT(ap, length) (*ndo->ndo_default_print)(ndo, ap, length) 289146773Ssam 290276788Sdelphijextern void ts_print(netdissect_options *, const struct timeval *); 291276788Sdelphijextern void relts_print(netdissect_options *, int); 292146773Ssam 293276788Sdelphijextern int fn_print(netdissect_options *, const u_char *, const u_char *); 294276788Sdelphijextern int fn_printn(netdissect_options *, const u_char *, u_int, const u_char *); 295276788Sdelphijextern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char *); 296146773Ssam 297285275Spkelsey/* 298285275Spkelsey * Flags for txtproto_print(). 299285275Spkelsey */ 300285275Spkelsey#define RESP_CODE_SECOND_TOKEN 0x00000001 /* response code is second token in response line */ 301285275Spkelsey 302285275Spkelseyextern void txtproto_print(netdissect_options *, const u_char *, u_int, 303285275Spkelsey const char *, const char **, u_int); 304285275Spkelsey 305146773Ssam#if 0 306146773Ssamextern char *read_infile(netdissect_options *, char *); 307146773Ssamextern char *copy_argv(netdissect_options *, char **); 308146773Ssam#endif 309146773Ssam 310276788Sdelphij/* 311276788Sdelphij * Locale-independent macros for testing character properties and 312276788Sdelphij * stripping the 8th bit from characters. Assumed to be handed 313276788Sdelphij * a value between 0 and 255, i.e. don't hand them a char, as 314276788Sdelphij * those might be in the range -128 to 127. 315276788Sdelphij */ 316276788Sdelphij#define ND_ISASCII(c) (!((c) & 0x80)) /* value is an ASCII code point */ 317276788Sdelphij#define ND_ISPRINT(c) ((c) >= 0x20 && (c) <= 0x7E) 318276788Sdelphij#define ND_ISGRAPH(c) ((c) > 0x20 && (c) <= 0x7E) 319276788Sdelphij#define ND_TOASCII(c) ((c) & 0x7F) 320146773Ssam 321276788Sdelphijextern void safeputchar(netdissect_options *, const u_char); 322276788Sdelphijextern void safeputs(netdissect_options *, const u_char *, const u_int); 323276788Sdelphij 324276788Sdelphij#ifdef LBL_ALIGN 325276788Sdelphij/* 326276788Sdelphij * The processor doesn't natively handle unaligned loads, 327276788Sdelphij * and the compiler might "helpfully" optimize memcpy() 328276788Sdelphij * and memcmp(), when handed pointers that would normally 329276788Sdelphij * be properly aligned, into sequences that assume proper 330276788Sdelphij * alignment. 331276788Sdelphij * 332276788Sdelphij * Do copies and compares of possibly-unaligned data by 333276788Sdelphij * calling routines that wrap memcpy() and memcmp(), to 334276788Sdelphij * prevent that optimization. 335276788Sdelphij */ 336276788Sdelphijextern void unaligned_memcpy(void *, const void *, size_t); 337276788Sdelphijextern int unaligned_memcmp(const void *, const void *, size_t); 338276788Sdelphij#define UNALIGNED_MEMCPY(p, q, l) unaligned_memcpy((p), (q), (l)) 339276788Sdelphij#define UNALIGNED_MEMCMP(p, q, l) unaligned_memcmp((p), (q), (l)) 340276788Sdelphij#else 341276788Sdelphij/* 342276788Sdelphij * The procesor natively handles unaligned loads, so just use memcpy() 343276788Sdelphij * and memcmp(), to enable those optimizations. 344276788Sdelphij */ 345276788Sdelphij#define UNALIGNED_MEMCPY(p, q, l) memcpy((p), (q), (l)) 346276788Sdelphij#define UNALIGNED_MEMCMP(p, q, l) memcmp((p), (q), (l)) 347276788Sdelphij#endif 348276788Sdelphij 349235530Sdelphij#define PLURAL_SUFFIX(n) \ 350235530Sdelphij (((n) != 1) ? "s" : "") 351235530Sdelphij 352146773Ssam#if 0 353146773Ssamextern const char *dnname_string(netdissect_options *, u_short); 354146773Ssamextern const char *dnnum_string(netdissect_options *, u_short); 355146773Ssam#endif 356146773Ssam 357146773Ssam/* The printer routines. */ 358146773Ssam 359146773Ssam#include <pcap.h> 360146773Ssam 361285275Spkelseyextern char *q922_string(netdissect_options *ndo, const u_char *, u_int); 362285275Spkelsey 363235530Sdelphijtypedef u_int (*if_ndo_printer)(struct netdissect_options *ndo, 364235530Sdelphij const struct pcap_pkthdr *, const u_char *); 365235530Sdelphijtypedef u_int (*if_printer)(const struct pcap_pkthdr *, const u_char *); 366146773Ssam 367235530Sdelphijextern if_ndo_printer lookup_ndo_printer(int); 368235530Sdelphijextern if_printer lookup_printer(int); 369235530Sdelphij 370190207Srpauloextern void eap_print(netdissect_options *,const u_char *, u_int); 371146773Ssamextern int esp_print(netdissect_options *, 372276788Sdelphij const u_char *bp, const int length, const u_char *bp2, 373146773Ssam int *nhdr, int *padlen); 374146773Ssamextern void arp_print(netdissect_options *,const u_char *, u_int, u_int); 375241235Sdelphijextern void tipc_print(netdissect_options *, const u_char *, u_int, u_int); 376276788Sdelphijextern void msnlb_print(netdissect_options *, const u_char *); 377214478Srpauloextern void icmp6_print(netdissect_options *ndo, const u_char *, 378214478Srpaulo u_int, const u_char *, int); 379146773Ssamextern void isakmp_print(netdissect_options *,const u_char *, 380146773Ssam u_int, const u_char *); 381146773Ssamextern void isakmp_rfc3948_print(netdissect_options *,const u_char *, 382146773Ssam u_int, const u_char *); 383146773Ssamextern void ip_print(netdissect_options *,const u_char *, u_int); 384146773Ssamextern void ip_print_inner(netdissect_options *ndo, 385146773Ssam const u_char *bp, u_int length, u_int nh, 386146773Ssam const u_char *bp2); 387190207Srpauloextern void rrcp_print(netdissect_options *,const u_char *, u_int); 388276788Sdelphijextern void loopback_print(netdissect_options *, const u_char *, const u_int); 389276788Sdelphijextern void carp_print(netdissect_options *, const u_char *, u_int, int); 390146773Ssam 391235530Sdelphijextern void ether_print(netdissect_options *, 392235530Sdelphij const u_char *, u_int, u_int, 393235530Sdelphij void (*)(netdissect_options *, const u_char *), 394235530Sdelphij const u_char *); 395235530Sdelphij 396251158Sdelphijextern u_int ether_if_print(netdissect_options *, 397235530Sdelphij const struct pcap_pkthdr *,const u_char *); 398251158Sdelphijextern u_int netanalyzer_if_print(netdissect_options *, 399235530Sdelphij const struct pcap_pkthdr *,const u_char *); 400251158Sdelphijextern u_int netanalyzer_transparent_if_print(netdissect_options *, 401235530Sdelphij const struct pcap_pkthdr *, 402235530Sdelphij const u_char *); 403235530Sdelphij 404235530Sdelphijextern int ethertype_print(netdissect_options *,u_short, const u_char *, 405235530Sdelphij u_int, u_int); 406235530Sdelphij 407276788Sdelphijextern int print_unknown_data(netdissect_options *,const u_char *, const char *,int); 408276788Sdelphijextern void ascii_print(netdissect_options *, const u_char *, u_int); 409276788Sdelphijextern void hex_print_with_offset(netdissect_options *, const char *ident, const u_char *cp, 410276788Sdelphij u_int, u_int); 411276788Sdelphijextern void hex_print(netdissect_options *,const char *ident, const u_char *cp,u_int); 412276788Sdelphijextern void hex_and_ascii_print_with_offset(netdissect_options *, const char *, const u_char *, u_int, u_int); 413276788Sdelphijextern void hex_and_ascii_print(netdissect_options *, const char *, const u_char *, u_int); 414276788Sdelphij 415276788Sdelphijextern int ah_print(netdissect_options *, register const u_char *); 416276788Sdelphijextern void beep_print(netdissect_options *, const u_char *, u_int); 417276788Sdelphijextern void dtp_print(netdissect_options *, const u_char *, u_int); 418276788Sdelphijextern u_int cip_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 419276788Sdelphijextern int ipcomp_print(netdissect_options *, register const u_char *, int *); 420276788Sdelphijextern u_int ipfc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 421276788Sdelphijextern void udld_print(netdissect_options *, const u_char *, u_int); 422276788Sdelphijextern void hsrp_print(netdissect_options *, const u_char *, u_int); 423276788Sdelphijextern void igrp_print(netdissect_options *, const u_char *, u_int); 424276788Sdelphijextern void msdp_print(netdissect_options *, const u_char *, u_int); 425276788Sdelphijextern u_int null_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 426276788Sdelphijextern void mobile_print(netdissect_options *, const u_char *, u_int); 427276788Sdelphijextern u_int ap1394_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 428276788Sdelphijextern u_int bt_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 429276788Sdelphijextern void lane_print(netdissect_options *, const u_char *, u_int, u_int); 430276788Sdelphijextern u_int lane_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 431276788Sdelphijextern void otv_print(netdissect_options *, const u_char *, u_int); 432276788Sdelphijextern void ahcp_print(netdissect_options *, const u_char *, const u_int); 433276788Sdelphijextern void vxlan_print(netdissect_options *, const u_char *, u_int); 434276788Sdelphijextern u_int arcnet_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 435276788Sdelphijextern u_int arcnet_linux_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 436276788Sdelphijextern void bfd_print(netdissect_options *, const u_char *, u_int, u_int); 437276788Sdelphijextern void gre_print(netdissect_options *, const u_char *, u_int); 438276788Sdelphijextern int vjc_print(netdissect_options *, register const char *, u_short); 439276788Sdelphijextern void ipN_print(netdissect_options *, const u_char *, u_int); 440276788Sdelphijextern u_int raw_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 441276788Sdelphijextern u_int usb_linux_48_byte_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 442276788Sdelphijextern u_int usb_linux_64_byte_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 443276788Sdelphijextern u_int symantec_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 444276788Sdelphijextern u_int chdlc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 445276788Sdelphijextern u_int chdlc_print(netdissect_options *, register const u_char *, u_int); 446276788Sdelphijextern void zmtp1_print(netdissect_options *, const u_char *, u_int); 447276788Sdelphijextern void zmtp1_print_datagram(netdissect_options *, const u_char *, const u_int); 448276788Sdelphijextern void ipx_print(netdissect_options *, const u_char *, u_int); 449276788Sdelphijextern void mpls_print(netdissect_options *, const u_char *, u_int); 450276788Sdelphijextern u_int pppoe_print(netdissect_options *, const u_char *, u_int); 451276788Sdelphijextern u_int pppoe_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 452276788Sdelphijextern void sunrpcrequest_print(netdissect_options *, const u_char *, u_int, const u_char *); 453276788Sdelphijextern u_int pflog_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 454276788Sdelphijextern u_int token_print(netdissect_options *, const u_char *, u_int, u_int); 455276788Sdelphijextern u_int token_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 456276788Sdelphijextern void vqp_print(netdissect_options *, register const u_char *, register u_int); 457276788Sdelphijextern void zephyr_print(netdissect_options *, const u_char *, int); 458276788Sdelphijextern void fddi_print(netdissect_options *, const u_char *, u_int, u_int); 459276788Sdelphijextern u_int fddi_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 460276788Sdelphijextern void mpcp_print(netdissect_options *, const u_char *, u_int); 461276788Sdelphijextern void rpki_rtr_print(netdissect_options *, const u_char *, u_int); 462276788Sdelphijextern u_int sll_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 463276788Sdelphijextern void dccp_print(netdissect_options *, const u_char *, const u_char *, u_int); 464276788Sdelphijextern int llc_print(netdissect_options *, const u_char *, u_int, u_int, const u_char *, const u_char *, u_short *); 465276788Sdelphijextern int snap_print(netdissect_options *, const u_char *, u_int, u_int, u_int); 466276788Sdelphijextern void eigrp_print(netdissect_options *, const u_char *, u_int); 467276788Sdelphijextern void stp_print(netdissect_options *, const u_char *, u_int); 468276788Sdelphijextern void l2tp_print(netdissect_options *, const u_char *, u_int); 469276788Sdelphijextern void udp_print(netdissect_options *, const u_char *, u_int, const u_char *, int); 470276788Sdelphijextern void icmp_print(netdissect_options *, const u_char *, u_int, const u_char *, int); 471276788Sdelphijextern void openflow_print(netdissect_options *, const u_char *, const u_int); 472276788Sdelphijextern void telnet_print(netdissect_options *, const u_char *, u_int); 473276788Sdelphijextern void slow_print(netdissect_options *, const u_char *, u_int); 474276788Sdelphijextern void radius_print(netdissect_options *, const u_char *, u_int); 475276788Sdelphijextern void lmp_print(netdissect_options *, const u_char *, u_int); 476276788Sdelphijextern u_int fr_print(netdissect_options *, register const u_char *, u_int); 477276788Sdelphijextern u_int mfr_print(netdissect_options *, register const u_char *, u_int); 478276788Sdelphijextern u_int fr_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 479276788Sdelphijextern u_int mfr_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 480276788Sdelphijextern void q933_print(netdissect_options *, const u_char *, u_int); 481276788Sdelphijextern void igmp_print(netdissect_options *, const u_char *, u_int); 482276788Sdelphijextern void rip_print(netdissect_options *, const u_char *, u_int); 483276788Sdelphijextern void lwapp_control_print(netdissect_options *, const u_char *, u_int, int); 484276788Sdelphijextern void lwapp_data_print(netdissect_options *, const u_char *, u_int); 485276788Sdelphijextern void pgm_print(netdissect_options *, const u_char *, u_int, const u_char *); 486276788Sdelphijextern void pptp_print(netdissect_options *, const u_char *); 487276788Sdelphijextern void ldp_print(netdissect_options *, const u_char *, u_int); 488276788Sdelphijextern void wb_print(netdissect_options *, const void *, u_int); 489276788Sdelphijextern int oam_print(netdissect_options *, const u_char *, u_int, u_int); 490276788Sdelphijextern void atm_print(netdissect_options *, u_int, u_int, u_int, const u_char *, u_int, u_int); 491276788Sdelphijextern u_int sunatm_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 492276788Sdelphijextern u_int atm_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 493276788Sdelphijextern void vtp_print(netdissect_options *, const u_char *, u_int); 494276788Sdelphijextern int mptcp_print(netdissect_options *, const u_char *, u_int, u_char); 495276788Sdelphijextern void ntp_print(netdissect_options *, const u_char *, u_int); 496285275Spkelseyextern void cnfp_print(netdissect_options *, const u_char *); 497276788Sdelphijextern void dvmrp_print(netdissect_options *, const u_char *, u_int); 498276788Sdelphijextern void egp_print(netdissect_options *, const u_char *, u_int); 499276788Sdelphijextern u_int enc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 500276788Sdelphijextern u_int sl_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 501276788Sdelphijextern u_int sl_bsdos_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 502276788Sdelphijextern void tftp_print(netdissect_options *, const u_char *, u_int); 503276788Sdelphijextern void vrrp_print(netdissect_options *, const u_char *, u_int, const u_char *, int); 504276788Sdelphijextern void pimv1_print(netdissect_options *, const u_char *, u_int); 505276788Sdelphijextern void cisco_autorp_print(netdissect_options *, const u_char *, u_int); 506276788Sdelphijextern void pim_print(netdissect_options *, const u_char *, u_int, u_int); 507276788Sdelphijextern const u_char * ns_nprint (netdissect_options *, register const u_char *, register const u_char *); 508276788Sdelphijextern void ns_print(netdissect_options *, const u_char *, u_int, int); 509276788Sdelphijextern void bootp_print(netdissect_options *, const u_char *, u_int); 510276788Sdelphijextern void sflow_print(netdissect_options *, const u_char *, u_int); 511276788Sdelphijextern void aodv_print(netdissect_options *, const u_char *, u_int, int); 512276788Sdelphijextern void sctp_print(netdissect_options *, const u_char *, const u_char *, u_int); 513276788Sdelphijextern char *bgp_vpn_rd_print (netdissect_options *, const u_char *); 514276788Sdelphijextern void bgp_print(netdissect_options *, const u_char *, int); 515276788Sdelphijextern void olsr_print(netdissect_options *, const u_char *, u_int, int); 516276788Sdelphijextern void forces_print(netdissect_options *, const u_char *, u_int); 517276788Sdelphijextern void lspping_print(netdissect_options *, const u_char *, u_int); 518276788Sdelphijextern void isoclns_print(netdissect_options *, const u_char *, u_int, u_int); 519276788Sdelphijextern void krb_print(netdissect_options *, const u_char *); 520276788Sdelphijextern void cdp_print(netdissect_options *, const u_char *, u_int, u_int); 521276788Sdelphijextern void atalk_print(netdissect_options *, const u_char *, u_int); 522276788Sdelphijextern u_int ltalk_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 523276788Sdelphijextern u_int llap_print(netdissect_options *, const u_char *, u_int); 524276788Sdelphijextern void aarp_print(netdissect_options *, const u_char *, u_int); 525276788Sdelphijextern u_int juniper_atm1_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 526276788Sdelphijextern u_int juniper_atm2_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 527276788Sdelphijextern u_int juniper_mfr_print(netdissect_options *, const struct pcap_pkthdr *, register const u_char *); 528276788Sdelphijextern u_int juniper_mlfr_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 529276788Sdelphijextern u_int juniper_mlppp_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 530276788Sdelphijextern u_int juniper_pppoe_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 531276788Sdelphijextern u_int juniper_pppoe_atm_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 532276788Sdelphijextern u_int juniper_ggsn_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 533276788Sdelphijextern u_int juniper_es_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 534276788Sdelphijextern u_int juniper_monitor_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 535276788Sdelphijextern u_int juniper_services_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 536276788Sdelphijextern u_int juniper_ether_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 537276788Sdelphijextern u_int juniper_ppp_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 538276788Sdelphijextern u_int juniper_frelay_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 539276788Sdelphijextern u_int juniper_chdlc_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 540276788Sdelphijextern void snmp_print(netdissect_options *, const u_char *, u_int); 541276788Sdelphijextern void rx_print(netdissect_options *, register const u_char *, int, int, int, u_char *); 542276788Sdelphijextern void nfsreply_print(netdissect_options *, const u_char *, u_int, const u_char *); 543276788Sdelphijextern void nfsreply_print_noaddr(netdissect_options *, const u_char *, u_int, const u_char *); 544276788Sdelphijextern void nfsreq_print_noaddr(netdissect_options *, const u_char *, u_int, const u_char *); 545276788Sdelphijextern void sip_print(netdissect_options *, const u_char *, u_int); 546276788Sdelphijextern void syslog_print(netdissect_options *, const u_char *, u_int); 547276788Sdelphijextern void lwres_print(netdissect_options *, const u_char *, u_int); 548276788Sdelphijextern void cfm_print(netdissect_options *, const u_char *, u_int); 549276788Sdelphijextern void nbt_tcp_print(netdissect_options *, const u_char *, int); 550276788Sdelphijextern void nbt_udp137_print(netdissect_options *, const u_char *, int); 551276788Sdelphijextern void nbt_udp138_print(netdissect_options *, const u_char *, int); 552276788Sdelphijextern void smb_tcp_print(netdissect_options *, const u_char *, int); 553276788Sdelphijextern void netbeui_print(netdissect_options *, u_short, const u_char *, int); 554276788Sdelphijextern void ipx_netbios_print(netdissect_options *, const u_char *, u_int); 555276788Sdelphijextern void print_data(netdissect_options *, const unsigned char *, int); 556276788Sdelphijextern void decnet_print(netdissect_options *, const u_char *, u_int, u_int); 557276788Sdelphijextern void tcp_print(netdissect_options *, const u_char *, u_int, const u_char *, int); 558276788Sdelphijextern void ospf_print(netdissect_options *, const u_char *, u_int, const u_char *); 559276788Sdelphijextern int ospf_print_te_lsa(netdissect_options *, const uint8_t *, u_int); 560276788Sdelphijextern int ospf_print_grace_lsa(netdissect_options *, const uint8_t *, u_int); 561276788Sdelphijextern u_int ppp_print(netdissect_options *, register const u_char *, u_int); 562276788Sdelphijextern u_int ppp_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 563276788Sdelphijextern u_int ppp_hdlc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 564276788Sdelphijextern u_int ppp_bsdos_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 565276788Sdelphijextern void lldp_print(netdissect_options *, const u_char *, u_int); 566276788Sdelphijextern void rsvp_print(netdissect_options *, const u_char *, u_int); 567276788Sdelphijextern void timed_print(netdissect_options *, const u_char *); 568276788Sdelphijextern void m3ua_print(netdissect_options *, const u_char *, const u_int); 569276788Sdelphijextern void aoe_print(netdissect_options *, const u_char *, const u_int); 570285275Spkelseyextern void ftp_print(netdissect_options *, const u_char *, u_int); 571285275Spkelseyextern void http_print(netdissect_options *, const u_char *, u_int); 572285275Spkelseyextern void rtsp_print(netdissect_options *, const u_char *, u_int); 573285275Spkelseyextern void smtp_print(netdissect_options *, const u_char *, u_int); 574285275Spkelseyextern void geneve_print(netdissect_options *, const u_char *, u_int); 575276788Sdelphij 576281938Sbrooksextern void pfsync_ip_print(netdissect_options *, const u_char *, u_int); 577281938Sbrooks 578146773Ssam/* stuff that has not yet been rototiled */ 579276788Sdelphij 580146773Ssam#if 0 581162017Ssamextern void ascii_print(netdissect_options *,u_int); 582146773Ssamextern void default_print(netdissect_options *,const u_char *, u_int); 583146773Ssamextern char *smb_errstr(netdissect_options *,int, int); 584276788Sdelphijextern const char *nt_errstr(netdissect_options *, uint32_t); 585214478Srpaulo#endif 586146773Ssam 587214478Srpauloextern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *); 588235530Sdelphijextern u_int ppi_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *); 589276788Sdelphijextern u_int nflog_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *); 590235530Sdelphijextern u_int ieee802_15_4_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *); 591276788Sdelphijextern u_int pktap_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *); 592276788Sdelphijextern u_int ieee802_11_radio_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 593276788Sdelphijextern u_int ieee802_11_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 594276788Sdelphijextern u_int ieee802_11_radio_avs_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 595276788Sdelphijextern u_int prism_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); 596235530Sdelphij 597285275Spkelseyextern void ip6_print(netdissect_options *,const u_char *, u_int); 598146773Ssam#ifdef INET6 599276788Sdelphijextern int frag6_print(netdissect_options *, const u_char *, const u_char *); 600276788Sdelphijextern int rt6_print(netdissect_options *, const u_char *, const u_char *); 601276788Sdelphijextern int hbhopt_print(netdissect_options *, const u_char *); 602276788Sdelphijextern int dstopt_print(netdissect_options *, const u_char *); 603276788Sdelphijextern void ripng_print(netdissect_options *, const u_char *, unsigned int); 604276788Sdelphijextern int mobility_print(netdissect_options *, const u_char *, const u_char *); 605276788Sdelphijextern void dhcp6_print(netdissect_options *, const u_char *, u_int); 606276788Sdelphijextern void ospf6_print(netdissect_options *, const u_char *, u_int); 607276788Sdelphijextern void babel_print(netdissect_options *, const u_char *, u_int); 608146773Ssam#endif /*INET6*/ 609146773Ssam 610235530Sdelphij#if 0 611235530Sdelphijstruct cksum_vec { 612276788Sdelphij const uint8_t *ptr; 613235530Sdelphij int len; 614235530Sdelphij}; 615276788Sdelphijextern uint16_t in_cksum(const struct cksum_vec *, int); 616276788Sdelphijextern uint16_t in_cksum_shouldbe(uint16_t, uint16_t); 617146773Ssam#endif 618276788Sdelphijextern int nextproto4_cksum(netdissect_options *ndo, const struct ip *, const uint8_t *, u_int, u_int, u_int); 619276788Sdelphijextern int decode_prefix4(netdissect_options *ndo, const u_char *, u_int, char *, u_int); 620276788Sdelphij#ifdef INET6 621276788Sdelphijextern int decode_prefix6(netdissect_options *ndo, const u_char *, u_int, char *, u_int); 622276788Sdelphij#endif 623146773Ssam 624214478Srpauloextern void esp_print_decodesecret(netdissect_options *ndo); 625214478Srpauloextern int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo, 626214478Srpaulo int initiator, 627214478Srpaulo u_char spii[8], u_char spir[8], 628214478Srpaulo u_char *buf, u_char *end); 629214478Srpaulo 630214478Srpaulo 631276788Sdelphijextern void geonet_print(netdissect_options *ndo,const u_char *eth_hdr,const u_char *geo_pck, u_int len); 632276788Sdelphijextern void calm_fast_print(netdissect_options *ndo,const u_char *eth_hdr,const u_char *calm_pck, u_int len); 633276788Sdelphij 634146773Ssam#endif /* netdissect_h */ 635