* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.2 2004-03-25 03:29:53 mcr Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.16 2005-04-07 00:28:17 mcr Exp $ (LBL)
*/
#ifndef netdissect_h
#include "os-proto.h"
#endif
#include <sys/types.h>
-#include <sys/time.h>
#ifndef HAVE___ATTRIBUTE__
#define __attribute__(x)
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 */
};
+#define TOKBUFSIZE 128
+extern const char *tok2strbuf(const struct tok *, const char *, int,
+ char *buf, size_t bufsize);
+
+/* tok2str is deprecated */
extern const char *tok2str(const struct tok *, const char *, int);
extern char *bittok2str(const struct tok *, const char *, int);
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 */
int ndo_sflag; /* use the libsmi to translate OIDs */
int ndo_Sflag; /* print raw TCP sequence numbers */
int ndo_tflag; /* print packet arrival time */
+ int ndo_Uflag; /* "unbuffered" output of dump files */
int ndo_uflag; /* Print undecoded NFS handles */
int ndo_vflag; /* verbose */
int ndo_xflag; /* print packet in hex */
int ndo_Cflag_count; /* Keep track of which file number we're writing */
int ndo_Wflag; /* recycle output files after this number of files */
int ndo_WflagChars;
- char *ndo_dltname;
+ const char *ndo_dltname;
char *ndo_espsecret;
+ struct sa_list *ndo_sa_list_head; /* used by print-esp.c */
+ struct sa_list *ndo_sa_default;
+
char *ndo_tcpmd5secret; /* TCP-MD5 secret key */
struct esp_algorithm *ndo_espsecret_xform; /* cache of decoded */
/* 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 *,
const char *fmt, ...);
+ void (*ndo_error)(netdissect_options *,
+ const char *fmt, ...);
+ void (*ndo_warning)(netdissect_options *,
+ const char *fmt, ...);
};
#define PT_VAT 1 /* Visual Audio Tool */
#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))
/* Bail if "var" was not captured */
#define ND_TCHECK(var) ND_TCHECK2(var, sizeof(var))
-#define ND_PRINT(fmt, args...) (*ndo->ndo_printf)(ndo, fmt, ##args)
+#define ND_PRINT(STUFF) (*ndo->ndo_printf)STUFF
+#define ND_DEFAULTPRINT(ap, length) (*ndo->ndo_default_print)(ndo, ap, length)
#if 0
extern void ts_print(netdissect_options *ipdo,
extern void wrapup(int);
#if 0
-extern void error(netdissect_options *, const char *, ...)
- __attribute__((noreturn, format (printf, 2, 3)));
-extern void warning(netdissect_options *, const char *, ...)
- __attribute__ ((format (printf, 2, 3)));
-
extern char *read_infile(netdissect_options *, char *);
extern char *copy_argv(netdissect_options *, char **);
#endif
extern void eap_print(netdissect_options *,const u_char *, u_int);
+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 *,
const u_char *, u_int, u_int, const u_char *,
const u_char *, u_short *);
extern void aarp_print(netdissect_options *,const u_char *, u_int);
-extern void arp_print(netdissect_options *,const u_char *, u_int, u_int);
extern void atalk_print(netdissect_options *,const u_char *, u_int);
extern void atm_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
extern void bootp_print(netdissect_options *,const u_char *,
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 *);
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 *,
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 int esp_print(netdissect_options *,
- register const u_char *bp, register const u_char *bp2,
- int *nhdr, int *padlen);
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 *,
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);
#endif
#endif /* netdissect_h */
-\