diff options
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/pcapng.c | 9 | ||||
-rw-r--r-- | wiretap/wtap.c | 7 | ||||
-rw-r--r-- | wiretap/wtap.h | 10 |
3 files changed, 22 insertions, 4 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index 7e60cfc040..8e96ebe38a 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -3710,6 +3710,10 @@ pcapng_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, /*ws_debug("Read length: %u Packet length: %u", bytes_read, rec->rec_header.packet_header.caplen);*/ ws_debug("data_offset is finally %" PRId64, *data_offset); + /* Provide the section number */ + rec->presence_flags |= WTAP_HAS_SECTION_NUMBER; + rec->section_number = pcapng->current_section_number; + return TRUE; } @@ -3781,6 +3785,11 @@ pcapng_seek_read(wtap *wth, gint64 seek_off, } wtap_block_unref(wblock.block); + + /* Provide the section number */ + rec->presence_flags |= WTAP_HAS_SECTION_NUMBER; + rec->section_number = section_number; + return TRUE; } diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 7af38a8977..847bbd54ab 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -1524,6 +1524,13 @@ wtap_init_rec(wtap *wth, wtap_rec *rec) rec->tsprec = wth->file_tsprec; rec->block = NULL; rec->block_was_modified = FALSE; + + /* + * Assume the file has only one section; the module for the + * file type needs to indicate the section number if there's + * more than one section. + */ + rec->section_number = 0; } gboolean diff --git a/wiretap/wtap.h b/wiretap/wtap.h index fb6de882fa..162f8b7228 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1338,6 +1338,7 @@ typedef struct { typedef struct { guint rec_type; /* what type of record is this? */ guint32 presence_flags; /* what stuff do we have? */ + guint section_number; /* section, within file, containing this record */ nstime_t ts; /* time stamp */ int tsprec; /* WTAP_TSPREC_ value for this record */ union { @@ -1378,11 +1379,12 @@ typedef struct { * absent, use the file encapsulation - but it's not clear that's useful; * we currently do that in the module for the file format. * - * Only WTAP_HAS_TS applies to all record types. + * Only WTAP_HAS_TS and WTAP_HAS_SECTION_NUMBER apply to all record types. */ -#define WTAP_HAS_TS 0x00000001 /**< time stamp */ -#define WTAP_HAS_CAP_LEN 0x00000002 /**< captured length separate from on-the-network length */ -#define WTAP_HAS_INTERFACE_ID 0x00000004 /**< interface ID */ +#define WTAP_HAS_TS 0x00000001 /**< time stamp */ +#define WTAP_HAS_CAP_LEN 0x00000002 /**< captured length separate from on-the-network length */ +#define WTAP_HAS_INTERFACE_ID 0x00000004 /**< interface ID */ +#define WTAP_HAS_SECTION_NUMBER 0x00000008 /**< section number */ #ifndef MAXNAMELEN #define MAXNAMELEN 64 /* max name length (hostname and port name) */ |