diff options
Diffstat (limited to 'wiretap/dct3trace.c')
-rw-r--r-- | wiretap/dct3trace.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/wiretap/dct3trace.c b/wiretap/dct3trace.c index 2a0eb9103a..36df2ab822 100644 --- a/wiretap/dct3trace.c +++ b/wiretap/dct3trace.c @@ -25,6 +25,7 @@ */ #include "config.h" +#include "wftap-int.h" #include "wtap-int.h" #include "buffer.h" #include "dct3trace.h" @@ -73,10 +74,10 @@ static const char dct3trace_magic_end[] = "</dump>"; #define MAX_PACKET_LEN 23 -static gboolean dct3trace_read(wtap *wth, int *err, gchar **err_info, +static gboolean dct3trace_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset); -static gboolean dct3trace_seek_read(wtap *wth, gint64 seek_off, - struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info); +static gboolean dct3trace_seek_read(wftap *wfth, gint64 seek_off, + void* header, Buffer *buf, int *err, gchar **err_info); /* * Following 3 functions taken from gsmdecode-0.7bis, with permission - http://wiki.thc.org/gsm @@ -155,15 +156,15 @@ xml_get_int(int *val, const char *str, const char *pattern) } -int dct3trace_open(wtap *wth, int *err, gchar **err_info) +int dct3trace_open(wftap *wfth, int *err, gchar **err_info) { char line1[64], line2[64]; /* Look for Gammu DCT3 trace header */ - if (file_gets(line1, sizeof(line1), wth->fh) == NULL || - file_gets(line2, sizeof(line2), wth->fh) == NULL) + if (file_gets(line1, sizeof(line1), wfth->fh) == NULL || + file_gets(line2, sizeof(line2), wfth->fh) == NULL) { - *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; @@ -176,12 +177,12 @@ int dct3trace_open(wtap *wth, int *err, gchar **err_info) return 0; } - wth->file_encap = WTAP_ENCAP_GSM_UM; - wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DCT3TRACE; - wth->snapshot_length = 0; /* not known */ - wth->subtype_read = dct3trace_read; - wth->subtype_seek_read = dct3trace_seek_read; - wth->tsprecision = WTAP_FILE_TSPREC_SEC; + wfth->file_encap = WTAP_ENCAP_GSM_UM; + wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DCT3TRACE; + wfth->snapshot_length = 0; /* not known */ + wfth->subtype_read = dct3trace_read; + wfth->subtype_seek_read = dct3trace_seek_read; + wfth->tsprecision = WTAP_FILE_TSPREC_SEC; return 1; } @@ -346,24 +347,26 @@ baddata: /* Find the next packet and parse it; called from wtap_read(). */ -static gboolean dct3trace_read(wtap *wth, int *err, gchar **err_info, +static gboolean dct3trace_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 dct3trace_get_packet(wth->fh, &wth->phdr, wth->frame_buffer, + return dct3trace_get_packet(wfth->fh, &wth->phdr, wfth->frame_buffer, err, err_info); } /* Used to read packets in random-access fashion */ -static gboolean dct3trace_seek_read(wtap *wth, gint64 seek_off, - struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) +static gboolean dct3trace_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 dct3trace_get_packet(wth->random_fh, phdr, buf, err, err_info); + return dct3trace_get_packet(wfth->random_fh, phdr, buf, err, err_info); } |