X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/89e2e0c7bedb2d3ea19b90dea2c1d31198307961..1ee09c1510704191a14df4eb914dba3d5dc9ab58:/netdissect.h diff --git a/netdissect.h b/netdissect.h index 86621472..c4e34eed 100644 --- a/netdissect.h +++ b/netdissect.h @@ -21,7 +21,7 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.9 2004-07-16 14:06:00 hannes Exp $ (LBL) + * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.16 2005-04-07 00:28:17 mcr Exp $ (LBL) */ #ifndef netdissect_h @@ -31,7 +31,6 @@ #include "os-proto.h" #endif #include -#include #ifndef HAVE___ATTRIBUTE__ #define __attribute__(x) @@ -62,6 +61,10 @@ extern size_t strlcpy (char *, const char *, size_t); extern char *strdup (const char *str); #endif +#ifndef HAVE_STRSEP +extern char *strsep(char **, const char *); +#endif + struct tok { int v; /* value */ const char *s; /* string */ @@ -80,7 +83,6 @@ typedef struct netdissect_options netdissect_options; struct netdissect_options { int ndo_aflag; /* translate network and broadcast addresses */ - int ndo_dflag; /* print filter code */ int ndo_eflag; /* print ethernet header */ int ndo_fflag; /* don't translate "foreign" IP address */ int ndo_nflag; /* leave addresses as numbers */ @@ -135,8 +137,6 @@ struct netdissect_options { /* pointer to void function to output stuff */ void (*ndo_default_print)(netdissect_options *, register const u_char *bp, register u_int length); - void (*ndo_default_print_unaligned)(netdissect_options *, - register const u_char *bp, register u_int length); void (*ndo_info)(netdissect_options *, int verbose); int (*ndo_printf)(netdissect_options *, @@ -189,8 +189,16 @@ struct netdissect_options { #define HTONS(x) (x) = htons(x) #endif -/* True if "l" bytes of "var" were captured */ -#define ND_TTEST2(var, l) ((u_char *)&(var) <= ndo->ndo_snapend - (l)) +/* + * True if "l" bytes of "var" were captured. + * + * The "ndo->ndo_snapend - (l) <= ndo->ndo_snapend" checks to make sure + * "l" isn't so large that "ndo->ndo_snapend - (l)" underflows. + * + * The check is for <= rather than < because "l" might be 0. + */ +#define ND_TTEST2(var, l) (ndo->ndo_snapend - (l) <= ndo->ndo_snapend && \ + (const u_char *)&(var) <= ndo->ndo_snapend - (l)) /* True if "var" was captured */ #define ND_TTEST(var) ND_TTEST2(var, sizeof(var)) @@ -242,15 +250,24 @@ extern int esp_print(netdissect_options *, register const u_char *bp, int len, register const u_char *bp2, int *nhdr, int *padlen); extern void arp_print(netdissect_options *,const u_char *, u_int, u_int); +extern void isakmp_print(netdissect_options *,const u_char *, + u_int, const u_char *); +extern void isakmp_rfc3948_print(netdissect_options *,const u_char *, + u_int, const u_char *); +extern void ip_print(netdissect_options *,const u_char *, u_int); +extern void ip_print_inner(netdissect_options *ndo, + const u_char *bp, u_int length, u_int nh, + const u_char *bp2); +/* stuff that has not yet been rototiled */ #if 0 -extern void ascii_print_with_offset(netdissect_options *, const u_char *, +extern void ascii_print_with_offset(netdissect_options *, const char *, u_int, u_int); -extern void ascii_print(netdissect_options *,const u_char *, u_int); -extern void hex_print_with_offset(netdissect_options *,const u_char *, +extern void ascii_print(netdissect_options *,const char *, u_int); +extern void hex_print_with_offset(netdissect_options *,const char *, u_int, u_int); extern void telnet_print(netdissect_options *,const u_char *, u_int); -extern void hex_print(netdissect_options *,const u_char *, u_int); +extern void hex_print(netdissect_options *,const char *, u_int); extern int ether_encap_print(netdissect_options *,u_short, const u_char *, u_int, u_int, u_short *); extern int llc_print(netdissect_options *, @@ -274,8 +291,6 @@ extern void cnfp_print(netdissect_options *,const u_char *cp, extern void decnet_print(netdissect_options *,const u_char *, u_int, u_int); extern void default_print(netdissect_options *,const u_char *, u_int); -extern void default_print_unaligned(netdissect_options *,const u_char *, - u_int); extern void dvmrp_print(netdissect_options *,const u_char *, u_int); extern void egp_print(netdissect_options *,const u_char *, u_int, const u_char *); @@ -295,7 +310,6 @@ extern void igmp_print(netdissect_options *, register const u_char *, u_int); extern void igrp_print(netdissect_options *,const u_char *, u_int, const u_char *); -extern void ip_print(netdissect_options *,const u_char *, u_int); extern void ipN_print(netdissect_options *,const u_char *, u_int); extern void ipx_print(netdissect_options *,const u_char *, u_int); extern void isoclns_print(netdissect_options *,const u_char *, @@ -368,8 +382,6 @@ 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 void isakmp_print(netdissect_options *,const u_char *, - u_int, const u_char *); 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 *, @@ -383,6 +395,7 @@ extern void nbt_udp137_print(netdissect_options *, extern void nbt_udp138_print(netdissect_options *, const u_char *data, int); extern char *smb_errstr(netdissect_options *,int, int); +extern const char *nt_errstr(netdissect_options *, u_int32_t); extern void print_data(netdissect_options *,const unsigned char *, int); extern void l2tp_print(netdissect_options *,const u_char *, u_int); extern void lcp_print(netdissect_options *,const u_char *, u_int);