Add data structure to hold information from ISB:s
[metze/wireshark/wip.git] / wiretap / wtap.h
index 1f0a23baac1ee6d49078b1f4191bf6f6c8536c2f..2ab8b10f0e014928cb937e13f15cfa33d4a54472 100644 (file)
@@ -227,7 +227,9 @@ extern "C" {
 #define WTAP_ENCAP_NETANALYZER                  135
 #define WTAP_ENCAP_NETANALYZER_TRANSPARENT      136
 #define WTAP_ENCAP_IP_OVER_IB                   137
-#define WTAP_ENCAP_MPEG_2_TS                   138
+#define WTAP_ENCAP_MPEG_2_TS                    138
+#define WTAP_ENCAP_PPP_ETHER                   139
+#define WTAP_ENCAP_NFC_LLCP                     140
 
 #define WTAP_NUM_ENCAP_TYPES                    wtap_get_num_encap_types()
 
@@ -294,7 +296,8 @@ extern "C" {
 #define WTAP_FILE_JPEG_JFIF                     57 /* obsoleted by WTAP_FILE_MIME */
 #define WTAP_FILE_IPFIX                         58
 #define WTAP_FILE_MIME                          59
-#define WTAP_FILE_AETHRA                       60
+#define WTAP_FILE_AETHRA                        60
+#define WTAP_FILE_MPEG_2_TS                     61
 
 #define WTAP_NUM_FILE_TYPES                     wtap_get_num_file_types()
 
@@ -683,6 +686,12 @@ struct erf_mc_phdr {
   } subhdr;
 };
 
+#define LLCP_PHDR_FLAG_SENT 0
+struct llcp_phdr {
+       guint8 adapter;
+       guint8 flags;
+};
+
 #define SITA_FRAME_DIR_TXED            (0x00)          /* values of sita_phdr.flags */
 #define SITA_FRAME_DIR_RXED            (0x01)
 #define SITA_FRAME_DIR                 (0x01)          /* mask */
@@ -813,6 +822,7 @@ union wtap_pseudo_header {
        struct i2c_phdr         i2c;
        struct gsm_um_phdr      gsm_um;
        struct nstr_phdr        nstr;
+       struct llcp_phdr        llcp;
 };
 
 struct wtap_nstime {
@@ -905,32 +915,54 @@ typedef struct wtapng_iface_descriptions_s {
  * Interface description data
  */
 typedef struct wtapng_if_descr_s {
-       int                                     wtap_encap;    /**< link_type translated to wtap_encap */
+       int                                     wtap_encap;                             /**< link_type translated to wtap_encap */
        guint64                         time_units_per_second;
        /* mandatory */
        guint16                         link_type;
        guint32                         snap_len;
        /* options */
-       gchar                           *opt_comment;   /**< NULL if not available */
-       gchar                           *if_name;               /**< NULL if not available, opt 2 A UTF-8 string containing the name of the device used to capture data. */
-       gchar                           *if_description;/**< NULL if not available, opt 3 A UTF-8 string containing the description of the device used to capture data. */
+       gchar                           *opt_comment;                   /**< NULL if not available */
+       gchar                           *if_name;                               /**< NULL if not available, opt 2 A UTF-8 string containing the name of the device used to capture data. */
+       gchar                           *if_description;                /**< NULL if not available, opt 3 A UTF-8 string containing the description of the device used to capture data. */
        /* XXX: if_IPv4addr opt 4  Interface network address and netmask.*/
        /* XXX: if_IPv6addr opt 5  Interface network address and prefix length (stored in the last byte).*/
        /* XXX: if_MACaddr  opt 6  Interface Hardware MAC address (48 bits).*/
        /* XXX: if_EUIaddr  opt 7  Interface Hardware EUI address (64 bits)*/
-       guint64                         if_speed;       /**< 0xFFFFFFFF if unknown, opt 8  Interface speed (in bps). 100000000 for 100Mbps */
-       guint8                          if_tsresol;     /**< default is 6 for microsecond resolution, opt 9  Resolution of timestamps. 
-                                                                        * If the Most Significant Bit is equal to zero, the remaining bits indicates the resolution of the timestamp as as a negative power of 10
-                                                                        */
+       guint64                         if_speed;                               /**< 0xFFFFFFFF if unknown, opt 8  Interface speed (in bps). 100000000 for 100Mbps */
+       guint8                          if_tsresol;                             /**< default is 6 for microsecond resolution, opt 9  Resolution of timestamps. 
+                                                                                                * If the Most Significant Bit is equal to zero, the remaining bits indicates the resolution of the timestamp as as a negative power of 10
+                                                                                                */
        /* XXX: if_tzone      10  Time zone for GMT support (TODO: specify better). */
-       gchar                           *if_filter;     /**< NULL if not available, opt 11  The filter (e.g. "capture only TCP traffic") used to capture traffic.
-                                                                        * The first byte of the Option Data keeps a code of the filter used (e.g. if this is a libpcap string, or BPF bytecode, and more).
-                                                                        */
-       gchar                           *if_os;         /**< NULL if not available, 12  A UTF-8 string containing the name of the operating system of the machine in which this interface is installed. */
-       gint8                           if_fcslen;      /**< -1 if unknown or changes between packets, opt 13  An integer value that specified the length of the Frame Check Sequence (in bits) for this interface. */
+       gchar                           *if_filter_str;                 /**< NULL if not available, opt 11  libpcap string. */
+       guint16                         bpf_filter_len;                 /** Opt 11 variant II BPF filter len 0 if not used*/
+       gchar                           *if_filter_bpf_bytes;   /** Opt 11 BPF filter or NULL */
+       gchar                           *if_os;                                 /**< NULL if not available, 12  A UTF-8 string containing the name of the operating system of the machine in which this interface is installed. */
+       gint8                           if_fcslen;                              /**< -1 if unknown or changes between packets, opt 13  An integer value that specified the length of the Frame Check Sequence (in bits) for this interface. */
        /* XXX: guint64 if_tsoffset; opt 14  A 64 bits integer value that specifies an offset (in seconds)...*/
+       guint8                          num_stat_entries;
+       GArray                          *interface_statistics;          /**< An array holding the interface statistics from pcapng ISB:s or equivalent(?)*/
 } wtapng_if_descr_t;
 
+
+/** 
+ * Interface Statistics. pcap-ng Interface Statistics Block (ISB).
+ */
+typedef struct wtapng_if_stats_s {
+       /* mandatory */
+       guint32                         interface_id;
+       guint32                         ts_high;
+       guint32                         ts_low;
+       /* options */
+       gchar                           *opt_comment;   /**< NULL if not available */
+       guint64                         isb_starttime;
+       guint64                         isb_endtime;
+       guint64                         isb_ifrecv;
+       guint64                         isb_ifdrop;
+       guint64                         isb_filteraccept;
+       guint64                         isb_osdrop;
+       guint64                         isb_usrdeliv;
+} wtapng_if_stats_t;
+
 struct Buffer;
 struct wtap_dumper;
 
@@ -1036,6 +1068,7 @@ int wtap_file_encap(wtap *wth);
 int wtap_file_tsprecision(wtap *wth);
 wtapng_section_t* wtap_file_get_shb_info(wtap *wth);
 wtapng_iface_descriptions_t *wtap_file_get_idb_info(wtap *wth);
+void wtap_write_shb_comment(wtap *wth, gchar *comment);
 
 /*** close the current file ***/
 void wtap_sequential_close(wtap *wth);