]> The Tcpdump Group git mirrors - tcpdump/blobdiff - netdissect.h
Add CAP_FCNTL and use cap_fcntls_limit().
[tcpdump] / netdissect.h
index 87a976a0d0f127f4f0fab694e560c72b5e40111c..515d839d733b1bcd7f2a0d668218bbdb374ac623 100644 (file)
@@ -115,6 +115,7 @@ struct netdissect_options {
   int ndo_dlt;                  /* if != -1, ask libpcap for the DLT it names*/
   int ndo_jflag;                /* packet time stamp source */
   int ndo_pflag;                /* don't go promiscuous */
+  int ndo_immediate;            /* use immediate mode */
 
   int ndo_Cflag;                /* rotate dump files after this many bytes */
   int ndo_Cflag_count;      /* Keep track of which file number we're writing */
@@ -156,14 +157,18 @@ 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);
+
+  /* pointer to function to print ^T output */
   void (*ndo_info)(netdissect_options *, int verbose);
 
+  /* pointer to function to do regular output */
   int  (*ndo_printf)(netdissect_options *,
                     const char *fmt, ...)
 #ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
                     __attribute__ ((format (printf, 2, 3)))
 #endif
                     ;
+  /* pointer to function to output errors */
   void (*ndo_error)(netdissect_options *,
                    const char *fmt, ...)
 #ifdef __ATTRIBUTE___NORETURN_OK_FOR_FUNCTION_POINTERS
@@ -173,6 +178,7 @@ struct netdissect_options {
                     __attribute__ ((format (printf, 2, 3)))
 #endif /* __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS */
                     ;
+  /* pointer to function to output warnings */
   void (*ndo_warning)(netdissect_options *,
                      const char *fmt, ...)
 #ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
@@ -209,15 +215,26 @@ struct netdissect_options {
  * Maximum snapshot length.  This should be enough to capture the full
  * packet on most network interfaces.
  *
- * Somewhat arbitrary, but chosen to be 1) big enough for maximum-size
- * Linux loopback packets and 2) small enough not to cause attempts to
- * allocate huge amounts of memory; some applications might use the
- * snapshot length in a savefile header to control the size of the buffer
- * they allocate, so a size of, say, 2^31-1 might not work well.
+ *
+ * Somewhat arbitrary, but chosen to be:
+ *
+ *    1) big enough for maximum-size Linux loopback packets (65549)
+ *       and some USB packets captured with USBPcap:
+ *
+ *           http://desowin.org/usbpcap/
+ *
+ *       (> 131072, < 262144)
+ *
+ * and
+ *
+ *    2) small enough not to cause attempts to allocate huge amounts of
+ *       memory; some applications might use the snapshot length in a
+ *       savefile header to control the size of the buffer they allocate,
+ *       so a size of, say, 2^31-1 might not work well.
  *
  * XXX - does it need to be bigger still?
  */
-#define MAXIMUM_SNAPLEN        131072
+#define MAXIMUM_SNAPLEN        262144
 
 /*
  * The default snapshot length is the maximum.
@@ -265,6 +282,14 @@ extern int fn_printn(netdissect_options *, const u_char *, u_int, const u_char *
 extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char *);
 extern const char *tok2str(const struct tok *, const char *, int);
 
+/*
+ * Flags for txtproto_print().
+ */
+#define RESP_CODE_SECOND_TOKEN 0x00000001      /* response code is second token in response line */
+
+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 **);
@@ -321,6 +346,8 @@ extern const char *dnnum_string(netdissect_options *, u_short);
 
 #include <pcap.h>
 
+extern char *q922_string(netdissect_options *ndo, const u_char *, u_int);
+
 typedef u_int (*if_ndo_printer)(struct netdissect_options *ndo,
                                const struct pcap_pkthdr *, const u_char *);
 typedef u_int (*if_printer)(const struct pcap_pkthdr *, const u_char *);
@@ -454,7 +481,7 @@ extern u_int atm_if_print(netdissect_options *, const struct pcap_pkthdr *, cons
 extern void vtp_print(netdissect_options *, const u_char *, u_int);
 extern int mptcp_print(netdissect_options *, const u_char *, u_int, u_char);
 extern void ntp_print(netdissect_options *, const u_char *, u_int);
-extern void cnfp_print(netdissect_options *, const u_char *, const u_char *);
+extern void cnfp_print(netdissect_options *, const u_char *);
 extern void dvmrp_print(netdissect_options *, const u_char *, u_int);
 extern void egp_print(netdissect_options *, const u_char *, u_int);
 extern u_int enc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
@@ -528,6 +555,11 @@ extern void rsvp_print(netdissect_options *, const u_char *, u_int);
 extern void timed_print(netdissect_options *, const u_char *);
 extern void m3ua_print(netdissect_options *, const u_char *, const u_int);
 extern void aoe_print(netdissect_options *, const u_char *, const u_int);
+extern void ftp_print(netdissect_options *, const u_char *, u_int);
+extern void http_print(netdissect_options *, const u_char *, u_int);
+extern void rtsp_print(netdissect_options *, const u_char *, u_int);
+extern void smtp_print(netdissect_options *, const u_char *, u_int);
+extern void geneve_print(netdissect_options *, const u_char *, u_int);
 
 /* stuff that has not yet been rototiled */
 
@@ -548,8 +580,8 @@ extern u_int ieee802_11_if_print(netdissect_options *, const struct pcap_pkthdr
 extern u_int ieee802_11_radio_avs_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
 extern u_int prism_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
 
-#ifdef INET6
 extern void ip6_print(netdissect_options *,const u_char *, u_int);
+#ifdef INET6
 extern int frag6_print(netdissect_options *, const u_char *, const u_char *);
 extern int rt6_print(netdissect_options *, const u_char *, const u_char *);
 extern int hbhopt_print(netdissect_options *, const u_char *);