Add pcapng variables to wtap_pkthdr.

svn path=/trunk/; revision=40947
This commit is contained in:
Anders Broman 2012-02-09 22:24:00 +00:00
parent 05a76ae7fa
commit 7be6e75c13
3 changed files with 24 additions and 8 deletions

View 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;

View 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;

View 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;