* 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
#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 */
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 */
/* 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 *,
#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))
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 *,
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 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 *,
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);