]> The Tcpdump Group git mirrors - tcpdump/blobdiff - netdissect.h
Add program_name field in the netdissect_options structure
[tcpdump] / netdissect.h
index 24a9ed7270dc56656e9dc176019301ad34e7c80e..458732b8d7cdb9d3b050c3bc6622432fc046fd63 100644 (file)
@@ -54,7 +54,7 @@ int vsnprintf (char *str, size_t sz, const char *format, va_list ap)
      __attribute__((format (printf, 3, 0)))
 #endif /* __ATTRIBUTE___FORMAT_OK */
      ;
-#endif /* !defined(HAVE_SNPRINTF) */
+#endif /* !defined(HAVE_VSNPRINTF) */
 
 #ifndef HAVE_STRLCAT
 extern size_t strlcat (char *, const char *, size_t);
@@ -76,7 +76,6 @@ struct tok {
        const char *s;          /* string */
 };
 
-#define TOKBUFSIZE 128
 extern const char *tok2strbuf(const struct tok *, const char *, u_int,
                              char *buf, size_t bufsize);
 
@@ -85,11 +84,9 @@ extern const char *tok2str(const struct tok *, const char *, u_int);
 extern char *bittok2str(const struct tok *, const char *, u_int);
 extern char *bittok2str_nosep(const struct tok *, const char *, u_int);
 
-
 typedef struct netdissect_options netdissect_options;
 
 struct netdissect_options {
-  int ndo_aflag;               /* translate network and broadcast addresses */
   int ndo_bflag;               /* print 4 byte ASes in ASDOT notation */
   int ndo_eflag;               /* print ethernet header */
   int ndo_fflag;               /* don't translate "foreign" IP address */
@@ -114,39 +111,27 @@ struct netdissect_options {
   int ndo_Hflag;               /* dissect 802.11s draft mesh standard */
   int ndo_packet_number;       /* print a packet number in the beginning of line */
   int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */
-  int ndo_tstamp_precision;   /* requested time stamp precision */
+  int ndo_tstamp_precision;    /* requested time stamp precision */
   const char *ndo_dltname;
+  const char *program_name;    /* Name of the program using the library */
 
   char *ndo_espsecret;
   struct sa_list *ndo_sa_list_head;  /* used by print-esp.c */
   struct sa_list *ndo_sa_default;
 
-  char *ndo_sigsecret;         /* Signature verification secret key */
-
-  struct esp_algorithm *ndo_espsecret_xform;   /* cache of decoded  */
-  char                 *ndo_espsecret_key;
+  char *ndo_sigsecret;         /* Signature verification secret key */
 
   int   ndo_packettype;        /* as specified by -T */
 
-  char *ndo_program_name;      /*used to generate self-identifying messages */
-
-  int32_t ndo_thiszone;        /* seconds offset from gmt to local time */
-
   int   ndo_snaplen;
 
   /*global pointers to beginning and end of current packet (during printing) */
   const u_char *ndo_packetp;
   const u_char *ndo_snapend;
 
-  /* bookkeeping for ^T output */
-  int ndo_infodelay;
-
   /* pointer to void function to output stuff */
   void (*ndo_default_print)(netdissect_options *,
-                     register const u_char *bp, register u_int length);
-
-  /* pointer to function to print ^T output */
-  void (*ndo_info)(netdissect_options *, int verbose);
+                     register const u_char *bp, register u_int length);
 
   /* pointer to function to do regular output */
   int  (*ndo_printf)(netdissect_options *,
@@ -297,11 +282,6 @@ extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char
 extern void txtproto_print(netdissect_options *, const u_char *, u_int,
     const char *, const char **, u_int);
 
-#if 0
-extern char *read_infile(netdissect_options *, char *);
-extern char *copy_argv(netdissect_options *, char **);
-#endif
-
 /*
  * Locale-independent macros for testing character properties and
  * stripping the 8th bit from characters.  Assumed to be handed
@@ -344,10 +324,16 @@ extern int unaligned_memcmp(const void *, const void *, size_t);
 #define PLURAL_SUFFIX(n) \
        (((n) != 1) ? "s" : "")
 
-#if 0
 extern const char *dnname_string(netdissect_options *, u_short);
 extern const char *dnnum_string(netdissect_options *, u_short);
-#endif
+
+extern int mask2plen(uint32_t);
+extern const char *tok2strary_internal(const char **, int, const char *, int);
+#define        tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i)
+
+#ifdef INET6
+extern int mask62plen(const u_char *);
+#endif /*INET6*/
 
 /* The printer routines. */
 
@@ -570,12 +556,8 @@ extern void geneve_print(netdissect_options *, const u_char *, u_int);
 
 /* stuff that has not yet been rototiled */
 
-#if 0
-extern void ascii_print(netdissect_options *,u_int);
-extern void default_print(netdissect_options *,const u_char *, u_int);
-extern char *smb_errstr(netdissect_options *,int, int);
-extern const char *nt_errstr(netdissect_options *, uint32_t);
-#endif
+extern char *smb_errstr(int, int);
+extern const char *nt_errstr(uint32_t);
 
 extern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
 extern u_int ppi_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
@@ -600,6 +582,11 @@ extern void ospf6_print(netdissect_options *, const u_char *, u_int);
 extern void babel_print(netdissect_options *, const u_char *, u_int);
 #endif /*INET6*/
 
+/* checksum routines */
+extern void init_checksum(void);
+extern uint16_t verify_crc10_cksum(uint16_t, const u_char *, int);
+extern uint16_t create_osi_cksum(const uint8_t *, int, int);
+
 struct cksum_vec {
        const uint8_t   *ptr;
        int             len;