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 /frame_tvbuff.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 'frame_tvbuff.c')
-rw-r--r-- | frame_tvbuff.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/frame_tvbuff.c b/frame_tvbuff.c index 513aefb8d3..0707b46ac5 100644 --- a/frame_tvbuff.c +++ b/frame_tvbuff.c @@ -32,7 +32,7 @@ struct tvb_frame { }; static gboolean -frame_read(struct tvb_frame *frame_tvb, struct wtap_pkthdr *phdr, Buffer *buf) +frame_read(struct tvb_frame *frame_tvb, wtap_rec *rec, Buffer *buf) { int err; gchar *err_info; @@ -40,7 +40,7 @@ frame_read(struct tvb_frame *frame_tvb, struct wtap_pkthdr *phdr, Buffer *buf) /* XXX, what if phdr->caplen isn't equal to * frame_tvb->tvb.length + frame_tvb->offset? */ - if (!wtap_seek_read(frame_tvb->prov->wth, frame_tvb->file_off, phdr, buf, &err, &err_info)) { + if (!wtap_seek_read(frame_tvb->prov->wth, frame_tvb->file_off, rec, buf, &err, &err_info)) { /* XXX - report error! */ switch (err) { case WTAP_ERR_BAD_FILE: @@ -57,9 +57,9 @@ static GPtrArray *buffer_cache = NULL; static void frame_cache(struct tvb_frame *frame_tvb) { - struct wtap_pkthdr phdr; /* Packet header */ + wtap_rec rec; /* Record metadata */ - wtap_phdr_init(&phdr); + wtap_rec_init(&rec); if (frame_tvb->buf == NULL) { if G_UNLIKELY(!buffer_cache) buffer_cache = g_ptr_array_sized_new(1024); @@ -72,13 +72,13 @@ frame_cache(struct tvb_frame *frame_tvb) ws_buffer_init(frame_tvb->buf, frame_tvb->tvb.length + frame_tvb->offset); - if (!frame_read(frame_tvb, &phdr, frame_tvb->buf)) + if (!frame_read(frame_tvb, &rec, frame_tvb->buf)) { /* TODO: THROW(???); */ } } frame_tvb->tvb.real_data = ws_buffer_start_ptr(frame_tvb->buf) + frame_tvb->offset; - wtap_phdr_cleanup(&phdr); + wtap_rec_cleanup(&rec); } static void |