aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/aethra.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-05-09 05:18:49 +0000
committerGuy Harris <guy@alum.mit.edu>2014-05-09 05:21:01 +0000
commita1b1c8bed54b1576e4f0e9e7f583844a12d142bf (patch)
treefcadd72c61f9d936451163e83cc1be843073f3b4 /wiretap/aethra.c
parenta651f3e5edb2f148a0e5f495b5cba0e7fa43e002 (diff)
Revert "Refactor Wiretap"
This reverts commit 1abeb277f5e6bd27fbaebfecc8184e37ba9d008a. This isn't building, and looks as if it requires significant work to fix. Change-Id: I622b1bb243e353e874883a302ab419532b7601f2 Reviewed-on: https://code.wireshark.org/review/1568 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/aethra.c')
-rw-r--r--wiretap/aethra.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/wiretap/aethra.c b/wiretap/aethra.c
index ef9b5fd3c2..a0b783b349 100644
--- a/wiretap/aethra.c
+++ b/wiretap/aethra.c
@@ -21,7 +21,6 @@
#include "config.h"
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -113,14 +112,14 @@ typedef struct {
time_t start;
} aethra_t;
-static gboolean aethra_read(wftap *wfth, int *err, gchar **err_info,
- gint64 *data_offset);
-static gboolean aethra_seek_read(wftap *wth, gint64 seek_off,
- struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-static gboolean aethra_read_rec_header(wftap *wth, FILE_T fh, struct aethrarec_hdr *hdr,
- struct wtap_pkthdr *phdr, int *err, gchar **err_info);
+static gboolean aethra_read(wtap *wth, int *err, gchar **err_info,
+ gint64 *data_offset);
+static gboolean aethra_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr,
+ struct wtap_pkthdr *phdr, int *err, gchar **err_info);
-int aethra_open(wftap *wfth, int *err, gchar **err_info)
+int aethra_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
struct aethra_hdr hdr;
@@ -129,9 +128,9 @@ int aethra_open(wftap *wfth, int *err, gchar **err_info)
/* Read in the string that should be at the start of a "aethra" file */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(hdr.magic, sizeof hdr.magic, wfth->fh);
+ bytes_read = file_read(hdr.magic, sizeof hdr.magic, wth->fh);
if (bytes_read != sizeof hdr.magic) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -143,18 +142,18 @@ int aethra_open(wftap *wfth, int *err, gchar **err_info)
/* Read the rest of the header. */
errno = WTAP_ERR_CANT_READ;
bytes_read = file_read((char *)&hdr + sizeof hdr.magic,
- sizeof hdr - sizeof hdr.magic, wfth->fh);
+ sizeof hdr - sizeof hdr.magic, wth->fh);
if (bytes_read != sizeof hdr - sizeof hdr.magic) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
}
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_AETHRA;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_AETHRA;
aethra = (aethra_t *)g_malloc(sizeof(aethra_t));
- wfth->priv = (void *)aethra;
- wfth->subtype_read = aethra_read;
- wfth->subtype_seek_read = aethra_seek_read;
+ wth->priv = (void *)aethra;
+ wth->subtype_read = aethra_read;
+ wth->subtype_seek_read = aethra_seek_read;
/*
* Convert the time stamp to a "time_t".
@@ -172,9 +171,9 @@ int aethra_open(wftap *wfth, int *err, gchar **err_info)
* We've only seen ISDN files, so, for now, we treat all
* files as ISDN.
*/
- wfth->file_encap = WTAP_ENCAP_ISDN;
- wfth->snapshot_length = 0; /* not available in header */
- wfth->tsprecision = WTAP_FILE_TSPREC_MSEC;
+ wth->file_encap = WTAP_ENCAP_ISDN;
+ wth->snapshot_length = 0; /* not available in header */
+ wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
return 1;
}
@@ -183,21 +182,20 @@ static guint packet = 0;
#endif
/* Read the next packet */
-static gboolean aethra_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean aethra_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
struct aethrarec_hdr hdr;
- wtap* wth = (wtap*)wfth->tap_specific_data;
/*
* Keep reading until we see an AETHRA_ISDN_LINK with a subtype
* of AETHRA_ISDN_LINK_LAPD record or get an end-of-file.
*/
for (;;) {
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* Read record header. */
- if (!aethra_read_rec_header(wfth, wfth->fh, &hdr, &wth->phdr, err, err_info))
+ if (!aethra_read_rec_header(wth, wth->fh, &hdr, &wth->phdr, err, err_info))
return FALSE;
/*
@@ -205,7 +203,7 @@ static gboolean aethra_read(wftap *wfth, int *err, gchar **err_info,
* growing the buffer to handle it.
*/
if (wth->phdr.caplen != 0) {
- if (!wtap_read_packet_bytes(wfth->fh, wfth->frame_buffer,
+ if (!wtap_read_packet_bytes(wth->fh, wth->frame_buffer,
wth->phdr.caplen, err, err_info))
return FALSE; /* Read error */
}
@@ -276,15 +274,15 @@ found:
}
static gboolean
-aethra_seek_read(wftap *wfth, gint64 seek_off, struct wtap_pkthdr *phdr,
+aethra_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
struct aethrarec_hdr hdr;
- 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;
- if (!aethra_read_rec_header(wfth, wfth->random_fh, &hdr, phdr, err,
+ if (!aethra_read_rec_header(wth, wth->random_fh, &hdr, phdr, err,
err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -294,17 +292,17 @@ aethra_seek_read(wftap *wfth, gint64 seek_off, struct wtap_pkthdr *phdr,
/*
* Read the packet data.
*/
- if (!wtap_read_packet_bytes(wfth->random_fh, buf, phdr->caplen, err, err_info))
+ if (!wtap_read_packet_bytes(wth->random_fh, buf, phdr->caplen, err, err_info))
return FALSE; /* failed */
return TRUE;
}
static gboolean
-aethra_read_rec_header(wftap *wfth, FILE_T fh, struct aethrarec_hdr *hdr,
+aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr,
struct wtap_pkthdr *phdr, int *err, gchar **err_info)
{
- aethra_t *aethra = (aethra_t *)wfth->priv;
+ aethra_t *aethra = (aethra_t *)wth->priv;
int bytes_read;
guint32 rec_size;
guint32 packet_size;