aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/tnef.c
diff options
context:
space:
mode:
Diffstat (limited to 'wiretap/tnef.c')
-rw-r--r--wiretap/tnef.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/wiretap/tnef.c b/wiretap/tnef.c
index 240a5fbcc5..5bd2fa1463 100644
--- a/wiretap/tnef.c
+++ b/wiretap/tnef.c
@@ -25,19 +25,18 @@
#include <sys/stat.h>
#endif
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "tnef.h"
-static gboolean tnef_read_file(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
+static gboolean tnef_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
gint64 file_size;
int packet_size;
- if ((file_size = wftap_file_size(wfth, err)) == -1)
+ if ((file_size = wtap_file_size(wth, err)) == -1)
return FALSE;
if (file_size > WTAP_MAX_PACKET_SIZE) {
@@ -47,7 +46,7 @@ static gboolean tnef_read_file(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
*/
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup_printf("tnef: File has %" G_GINT64_MODIFIER "d-byte packet, bigger than maximum of %u",
- file_size, WTAP_MAX_PACKET_SIZE);
+ file_size, WTAP_MAX_PACKET_SIZE);
return FALSE;
}
packet_size = (int)file_size;
@@ -63,14 +62,13 @@ static gboolean tnef_read_file(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
return wtap_read_packet_bytes(fh, buf, packet_size, err, err_info);
}
-static gboolean tnef_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+static gboolean tnef_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
gint64 offset;
- wtap* wth = (wtap*)wfth->tap_specific_data;
*err = 0;
- offset = file_tell(wfth->fh);
+ offset = file_tell(wth->fh);
/* there is only ever one packet */
if (offset)
@@ -78,35 +76,33 @@ static gboolean tnef_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_
*data_offset = offset;
- return tnef_read_file(wfth, wfth->fh, &wth->phdr, wfth->frame_buffer, err, err_info);
+ return tnef_read_file(wth, wth->fh, &wth->phdr, wth->frame_buffer, err, err_info);
}
-static gboolean tnef_seek_read(wftap *wfth, gint64 seek_off,
- void* header,
+static gboolean tnef_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
-
/* there is only one packet */
if(seek_off > 0) {
*err = 0;
return FALSE;
}
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- return tnef_read_file(wfth, wfth->random_fh, phdr, buf, err, err_info);
+ return tnef_read_file(wth, wth->random_fh, phdr, buf, err, err_info);
}
-int tnef_open(wftap *wfth, int *err, gchar **err_info)
+int tnef_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
guint32 magic;
- bytes_read = file_read(&magic, sizeof magic, wfth->fh);
+ bytes_read = file_read(&magic, sizeof magic, wth->fh);
if (bytes_read != sizeof magic) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return (*err != 0) ? -1 : 0;
}
@@ -115,16 +111,16 @@ int tnef_open(wftap *wfth, int *err, gchar **err_info)
return 0;
/* seek back to the start of the file */
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_TNEF;
- wfth->file_encap = WTAP_ENCAP_TNEF;
- wfth->snapshot_length = 0;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_TNEF;
+ wth->file_encap = WTAP_ENCAP_TNEF;
+ wth->snapshot_length = 0;
- wfth->subtype_read = tnef_read;
- wfth->subtype_seek_read = tnef_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
+ wth->subtype_read = tnef_read;
+ wth->subtype_seek_read = tnef_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_SEC;
return 1;
}