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/tnef.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/tnef.c')
-rw-r--r-- | wiretap/tnef.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/wiretap/tnef.c b/wiretap/tnef.c index 03720773b8..224fbe2809 100644 --- a/wiretap/tnef.c +++ b/wiretap/tnef.c @@ -14,7 +14,7 @@ #include <wsutil/buffer.h> #include "tnef.h" -static gboolean tnef_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, +static gboolean tnef_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, gchar **err_info) { gint64 file_size; @@ -35,14 +35,14 @@ static gboolean tnef_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, } packet_size = (int)file_size; - phdr->rec_type = REC_TYPE_PACKET; - phdr->presence_flags = 0; /* yes, we have no bananas^Wtime stamp */ + rec->rec_type = REC_TYPE_PACKET; + rec->presence_flags = 0; /* yes, we have no bananas^Wtime stamp */ - phdr->caplen = packet_size; - phdr->len = packet_size; + rec->rec_header.packet_header.caplen = packet_size; + rec->rec_header.packet_header.len = packet_size; - phdr->ts.secs = 0; - phdr->ts.nsecs = 0; + rec->ts.secs = 0; + rec->ts.nsecs = 0; return wtap_read_packet_bytes(fh, buf, packet_size, err, err_info); } @@ -61,11 +61,11 @@ static gboolean tnef_read(wtap *wth, int *err, gchar **err_info, gint64 *data_of *data_offset = offset; - return tnef_read_file(wth, wth->fh, &wth->phdr, wth->frame_buffer, err, err_info); + return tnef_read_file(wth, wth->fh, &wth->rec, wth->rec_data, err, err_info); } static gboolean tnef_seek_read(wtap *wth, gint64 seek_off, - struct wtap_pkthdr *phdr, + wtap_rec *rec, Buffer *buf, int *err, gchar **err_info) { /* there is only one packet */ @@ -77,7 +77,7 @@ static gboolean tnef_seek_read(wtap *wth, gint64 seek_off, if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; - return tnef_read_file(wth, wth->random_fh, phdr, buf, err, err_info); + return tnef_read_file(wth, wth->random_fh, rec, buf, err, err_info); } wtap_open_return_val tnef_open(wtap *wth, int *err, gchar **err_info) |