From 1f5f63f8ef98bfe9c4d734674cee0df64855555d Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 8 Feb 2018 16:19:12 -0800 Subject: 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 --- wiretap/wtap-int.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'wiretap/wtap-int.h') diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h index 0bf6279f0d..fb8d78e471 100644 --- a/wiretap/wtap-int.h +++ b/wiretap/wtap-int.h @@ -25,9 +25,8 @@ WS_DLL_PUBLIC int wtap_fstat(wtap *wth, ws_statb64 *statb, int *err); typedef gboolean (*subtype_read_func)(struct wtap*, int*, char**, gint64*); -typedef gboolean (*subtype_seek_read_func)(struct wtap*, gint64, - struct wtap_pkthdr *, Buffer *buf, - int *, char **); +typedef gboolean (*subtype_seek_read_func)(struct wtap*, gint64, wtap_rec *, + Buffer *, int *, char **); /** * Struct holding data of the currently read file. @@ -38,8 +37,8 @@ struct wtap { gboolean ispipe; /**< TRUE if the file is a pipe */ int file_type_subtype; guint snapshot_length; - struct Buffer *frame_buffer; - struct wtap_pkthdr phdr; + wtap_rec rec; + Buffer *rec_data; GArray *shb_hdrs; GArray *interface_data; /**< An array holding the interface data from pcapng IDB:s or equivalent(?)*/ GArray *nrb_hdrs; /**< holds the Name Res Block's comment/custom_opts, or NULL */ @@ -80,7 +79,7 @@ struct wtap_dumper; typedef void *WFILE_T; typedef gboolean (*subtype_write_func)(struct wtap_dumper*, - const struct wtap_pkthdr*, + const wtap_rec *rec, const guint8*, int*, gchar**); typedef gboolean (*subtype_finish_func)(struct wtap_dumper*, int*); -- cgit v1.2.3