aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/hcidump.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-02-08 16:19:12 -0800
committerGuy Harris <guy@alum.mit.edu>2018-02-09 00:29:51 +0000
commit1f5f63f8ef98bfe9c4d734674cee0df64855555d (patch)
tree133dd3563cc8d2d29dd85d4d43cd9a4636283192 /wiretap/hcidump.c
parente4c5efafb7da2d25b7d47fe2dac3b1556c0b67b0 (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/hcidump.c')
-rw-r--r--wiretap/hcidump.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c
index d0aad8f9f1..683da1d80a 100644
--- a/wiretap/hcidump.c
+++ b/wiretap/hcidump.c
@@ -21,7 +21,7 @@ struct dump_hdr {
#define DUMP_HDR_SIZE (sizeof(struct dump_hdr))
-static gboolean hcidump_read_packet(FILE_T fh, struct wtap_pkthdr *phdr,
+static gboolean hcidump_read_packet(FILE_T fh, wtap_rec *rec,
Buffer *buf, int *err, gchar **err_info)
{
struct dump_hdr dh;
@@ -42,14 +42,14 @@ static gboolean hcidump_read_packet(FILE_T fh, struct wtap_pkthdr *phdr,
return FALSE;
}
- phdr->rec_type = REC_TYPE_PACKET;
- phdr->presence_flags = WTAP_HAS_TS;
- phdr->ts.secs = GUINT32_FROM_LE(dh.ts_sec);
- phdr->ts.nsecs = GUINT32_FROM_LE(dh.ts_usec) * 1000;
- phdr->caplen = packet_size;
- phdr->len = packet_size;
+ rec->rec_type = REC_TYPE_PACKET;
+ rec->presence_flags = WTAP_HAS_TS;
+ rec->ts.secs = GUINT32_FROM_LE(dh.ts_sec);
+ rec->ts.nsecs = GUINT32_FROM_LE(dh.ts_usec) * 1000;
+ rec->rec_header.packet_header.caplen = packet_size;
+ rec->rec_header.packet_header.len = packet_size;
- phdr->pseudo_header.p2p.sent = (dh.in ? FALSE : TRUE);
+ rec->rec_header.packet_header.pseudo_header.p2p.sent = (dh.in ? FALSE : TRUE);
return wtap_read_packet_bytes(fh, buf, packet_size, err, err_info);
}
@@ -59,17 +59,17 @@ static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info,
{
*data_offset = file_tell(wth->fh);
- return hcidump_read_packet(wth->fh, &wth->phdr, wth->frame_buffer,
+ return hcidump_read_packet(wth->fh, &wth->rec, wth->rec_data,
err, err_info);
}
static gboolean hcidump_seek_read(wtap *wth, gint64 seek_off,
- struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
+ wtap_rec *rec, Buffer *buf, int *err, gchar **err_info)
{
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- return hcidump_read_packet(wth->random_fh, phdr, buf, err, err_info);
+ return hcidump_read_packet(wth->random_fh, rec, buf, err, err_info);
}
wtap_open_return_val hcidump_open(wtap *wth, int *err, gchar **err_info)