diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-02-08 16:19:12 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-02-09 00:29:51 +0000 |
commit | 1f5f63f8ef98bfe9c4d734674cee0df64855555d (patch) | |
tree | 133dd3563cc8d2d29dd85d4d43cd9a4636283192 /wiretap/camins.c | |
parent | e4c5efafb7da2d25b7d47fe2dac3b1556c0b67b0 (diff) |
Generalize wtap_pkthdr into a structure for packet and non-packet records.
Separate the stuff that any record could have from the stuff that only
particular record types have; put the latter into a union, and put all
that into a wtap_rec structure.
Add some record-type checks as necessary.
Change-Id: Id6b3486858f826fce4b096c59231f463e44bfaa2
Reviewed-on: https://code.wireshark.org/review/25696
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/camins.c')
-rw-r--r-- | wiretap/camins.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/wiretap/camins.c b/wiretap/camins.c index 1b3df7b48b..7ce669b64b 100644 --- a/wiretap/camins.c +++ b/wiretap/camins.c @@ -291,7 +291,7 @@ create_pseudo_hdr(guint8 *buf, guint8 dat_trans_type, guint16 dat_len) static gboolean -camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, +camins_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, gchar **err_info) { guint8 dat_trans_type; @@ -327,11 +327,11 @@ camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, return FALSE; offset += bytes_read; - phdr->rec_type = REC_TYPE_PACKET; - phdr->pkt_encap = WTAP_ENCAP_DVBCI; + rec->rec_type = REC_TYPE_PACKET; + rec->rec_header.packet_header.pkt_encap = WTAP_ENCAP_DVBCI; /* timestamps aren't supported for now */ - phdr->caplen = offset; - phdr->len = offset; + rec->rec_header.packet_header.caplen = offset; + rec->rec_header.packet_header.len = offset; return TRUE; } @@ -342,19 +342,19 @@ camins_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { *data_offset = file_tell(wth->fh); - return camins_read_packet(wth->fh, &wth->phdr, wth->frame_buffer, err, + return camins_read_packet(wth->fh, &wth->rec, wth->rec_data, err, err_info); } static gboolean -camins_seek_read(wtap *wth, gint64 seek_off, - struct wtap_pkthdr *pkthdr, Buffer *buf, int *err, gchar **err_info) +camins_seek_read(wtap *wth, gint64 seek_off, wtap_rec *rec, Buffer *buf, + int *err, gchar **err_info) { if (-1 == file_seek(wth->random_fh, seek_off, SEEK_SET, err)) return FALSE; - return camins_read_packet(wth->random_fh, pkthdr, buf, err, err_info); + return camins_read_packet(wth->random_fh, rec, buf, err, err_info); } |