aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/hcidump.c
diff options
context:
space:
mode:
Diffstat (limited to 'wiretap/hcidump.c')
-rw-r--r--wiretap/hcidump.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c
index cc38a62154..cb3123e7f0 100644
--- a/wiretap/hcidump.c
+++ b/wiretap/hcidump.c
@@ -19,6 +19,7 @@
#include "config.h"
+#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -71,33 +72,35 @@ static gboolean hcidump_process_packet(FILE_T fh, struct wtap_pkthdr *phdr,
return wtap_read_packet_bytes(fh, buf, packet_size, err, err_info);
}
-static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info,
+static gboolean hcidump_read(wftap *wfth, int *err, gchar **err_info,
gint64 *data_offset)
{
- *data_offset = file_tell(wth->fh);
+ wtap* wth = (wtap*)wfth->tap_specific_data;
+ *data_offset = file_tell(wfth->fh);
- return hcidump_process_packet(wth->fh, &wth->phdr, wth->frame_buffer,
+ return hcidump_process_packet(wfth->fh, &wth->phdr, wfth->frame_buffer,
err, err_info);
}
-static gboolean hcidump_seek_read(wtap *wth, gint64 seek_off,
- struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
+static gboolean hcidump_seek_read(wftap *wfth, gint64 seek_off,
+ void* header, Buffer *buf, int *err, gchar **err_info)
{
- if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+ struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
+ if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- return hcidump_process_packet(wth->random_fh, phdr, buf, err, err_info);
+ return hcidump_process_packet(wfth->random_fh, phdr, buf, err, err_info);
}
-int hcidump_open(wtap *wth, int *err, gchar **err_info)
+int hcidump_open(wftap *wfth, int *err, gchar **err_info)
{
struct dump_hdr dh;
guint8 type;
int bytes_read;
- bytes_read = file_read(&dh, DUMP_HDR_SIZE, wth->fh);
+ bytes_read = file_read(&dh, DUMP_HDR_SIZE, wfth->fh);
if (bytes_read != DUMP_HDR_SIZE) {
- *err = file_error(wth->fh, err_info);
+ *err = file_error(wfth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -107,9 +110,9 @@ int hcidump_open(wtap *wth, int *err, gchar **err_info)
|| GUINT16_FROM_LE(dh.len) < 1)
return 0;
- bytes_read = file_read(&type, 1, wth->fh);
+ bytes_read = file_read(&type, 1, wfth->fh);
if (bytes_read != 1) {
- *err = file_error(wth->fh, err_info);
+ *err = file_error(wfth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -118,16 +121,16 @@ int hcidump_open(wtap *wth, int *err, gchar **err_info)
if (type < 1 || type > 4)
return 0;
- if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
return -1;
- wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_HCIDUMP;
- wth->file_encap = WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR;
- wth->snapshot_length = 0;
+ wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_HCIDUMP;
+ wfth->file_encap = WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR;
+ wfth->snapshot_length = 0;
- wth->subtype_read = hcidump_read;
- wth->subtype_seek_read = hcidump_seek_read;
- wth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wfth->subtype_read = hcidump_read;
+ wfth->subtype_seek_read = hcidump_seek_read;
+ wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}