diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-05-24 11:28:30 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-05-24 18:31:25 +0000 |
commit | 6db77b000fe58173eeed23b91b32c92c681feda2 (patch) | |
tree | 5113821a7f5e1b43734eccf94783d37962b37712 /wiretap/visual.c | |
parent | 33ae4cb024e36192ff7c6fa1d3d6bdcce9b25b7a (diff) | |
download | wireshark-6db77b000fe58173eeed23b91b32c92c681feda2.tar.gz wireshark-6db77b000fe58173eeed23b91b32c92c681feda2.tar.bz2 wireshark-6db77b000fe58173eeed23b91b32c92c681feda2.zip |
Allow wtap_read() and wtap_seek_read() to return records other than packets.
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be
REC_TYPE_PACKET, for a record containing a packet, or
REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific
data.
Modify code that reads packets to be able to handle non-packet records,
even if that just means ignoring them.
Rename some routines to indicate that they handle more than just
packets.
We don't yet have any libwiretap code that supplies records other than
REC_TYPE_PACKET or that supporting writing records other than
REC_TYPE_PACKET, or any code to support plugins for handling
REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug
8590.
Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813
Reviewed-on: https://code.wireshark.org/review/1773
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/visual.c')
-rw-r--r-- | wiretap/visual.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/wiretap/visual.c b/wiretap/visual.c index cfa03bceac..c10594b615 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -350,6 +350,7 @@ visual_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, /* Get the included length of data. This includes extra headers + payload */ packet_size = pletoh16(&vpkt_hdr.incl_len); + phdr->rec_type = REC_TYPE_PACKET; phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN; /* Set the packet time and length. */ @@ -674,6 +675,12 @@ static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, guint delta_msec; guint32 packet_status; + /* We can only write packet records. */ + if (phdr->rec_type != REC_TYPE_PACKET) { + *err = WTAP_ERR_REC_TYPE_UNSUPPORTED; + return FALSE; + } + /* Don't write anything we're not willing to read. */ if (phdr->caplen > WTAP_MAX_PACKET_SIZE) { *err = WTAP_ERR_PACKET_TOO_LARGE; |