Add pcapng variables to wtap_pkthdr.
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 9 Feb 2012 22:24:00 +0000 (22:24 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 9 Feb 2012 22:24:00 +0000 (22:24 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40947 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/pcapng.c
wiretap/wtap-int.h
wiretap/wtap.h

index 1892e34854cb7c258f80423e6ac4fdf5831cb6c3..ee781964a52b57e61fccd52129f237ac784da9c4 100644 (file)
@@ -70,7 +70,7 @@
 #include "pcap-encap.h"
 #include "pcapng.h"
 
-#if 0
+#if 1
 #define pcapng_debug0(str) g_warning(str)
 #define pcapng_debug1(str,p1) g_warning(str,p1)
 #define pcapng_debug2(str,p1,p2) g_warning(str,p1,p2)
@@ -151,7 +151,7 @@ typedef struct pcapng_simple_packet_block_s {
        /* ... Padding ... */
 } pcapng_simple_packet_block_t;
 
-/* pcapng: simple packet block */
+/* pcapng: name resolution block */
 typedef struct pcapng_name_resolution_block_s {
        guint16 record_type;
        guint16 record_len;
@@ -1558,6 +1558,12 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                wth->phdr.pkt_encap = int_data.wtap_encap;
                wth->phdr.ts.secs = (time_t)(ts / time_units_per_second);
                wth->phdr.ts.nsecs = (int)(((ts % time_units_per_second) * 1000000000) / time_units_per_second);
+
+               wth->phdr.interface_id = wblock.data.packet.interface_id;
+               wth->phdr.drops_count  = wblock.data.packet.drops_count;
+               wth->phdr.opt_comment  = wblock.data.packet.opt_comment;
+               wth->phdr.drop_count   = wblock.data.packet.drop_count;
+               wth->phdr.pack_flags   = wblock.data.packet.pack_flags;
        } else {
                wth->phdr.pkt_encap = WTAP_ENCAP_UNKNOWN;
                *err = WTAP_ERR_BAD_FILE;
index 2d0dd94fda7842cfb88bb66bf8fa5c27b48bd45f..0e00d688666a33479be2eec3bd474882888de28c 100644 (file)
@@ -62,11 +62,13 @@ struct wtap {
        void                    (*subtype_sequential_close)(struct wtap*);
        void                    (*subtype_close)(struct wtap*);
        int                     file_encap;     /* per-file, for those
-                                                  file formats that have
-                                                  per-file encapsulation
-                                                  types */
+                                                                                        * file formats that have
+                                                                                        * per-file encapsulation
+                                                                                        * types
+                                                                                        */
        int                     tsprecision;    /* timestamp precision of the lower 32bits
-                                                * e.g. WTAP_FILE_TSPREC_USEC */
+                                                                                                * e.g. WTAP_FILE_TSPREC_USEC
+                                                                                                */
        wtap_new_ipv4_callback_t add_new_ipv4;
        wtap_new_ipv6_callback_t add_new_ipv6;
        GPtrArray *fast_seek;
index 1d002de72cd2abb3c7d91ff3cad9b2a241aeacff..d070f91fb36be5e03acda29517a5860b8dbfc00f 100644 (file)
@@ -822,9 +822,17 @@ struct wtap_nstime {
 
 struct wtap_pkthdr {
        struct wtap_nstime ts;
-       guint32 caplen;
-       guint32 len;
+       guint32                         caplen;                 /* data length in the file */
+       guint32                         len;                    /* data length on the wire */
        int pkt_encap;
+       /* pcapng variables */
+       guint32                         interface_id;   /* identifier of the interface. */
+       guint16                         drops_count;    /* drops count, only valid for packet block */
+                                                                               /* 0xffff if information not available */
+       /* options */
+       gchar                           *opt_comment;   /* NULL if not available */
+       guint64                         drop_count;
+       guint32                         pack_flags;     /* XXX - 0 for now (any value for "we don't have it"?) */
 };
 
 struct Buffer;