aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/nettl.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2010-02-26 07:59:54 +0000
committerGuy Harris <guy@alum.mit.edu>2010-02-26 07:59:54 +0000
commit17392a865ac79a9f631e63652dff45b6bb1c64d2 (patch)
tree42c7ec409a0e898eea7c0ebf4ba34f2f633797b6 /wiretap/nettl.c
parentc4dd5ca6f3bb794c9f1736adf8a8f02c641a76e6 (diff)
Move the definitions of all the private data structures out of
wtap-int.h, and change the unions of pointers to those private data structures into just void *'s. Have the generic wtap close routine free up the private data, rather than the type-specific close routine, just as the wtap_dumper close routine does for its private data. Get rid of close routines that don't do anything any more. svn path=/trunk/; revision=32015
Diffstat (limited to 'wiretap/nettl.c')
-rw-r--r--wiretap/nettl.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 2bccaca99c..14fd6877ee 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -175,6 +175,10 @@ struct nettlrec_ns_ls_drv_eth_hdr {
/* header is followed by data and once again the total length (2 bytes) ! */
+typedef struct {
+ gboolean is_hpux_11;
+} nettl_t;
+
static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
static gboolean nettl_seek_read(wtap *wth, gint64 seek_off,
@@ -185,7 +189,6 @@ static int nettl_read_rec_header(wtap *wth, FILE_T fh,
int *err, gchar **err_info, gboolean *fddihack);
static gboolean nettl_read_rec_data(FILE_T fh, guchar *pd, int length,
int *err, gboolean fddihack);
-static void nettl_close(wtap *wth);
static gboolean nettl_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err);
@@ -195,6 +198,7 @@ int nettl_open(wtap *wth, int *err, gchar **err_info _U_)
guint16 dummy[2];
int subsys;
int bytes_read;
+ nettl_t *nettl;
/* Read in the string that should be at the start of a HP file */
errno = WTAP_ERR_CANT_READ;
@@ -223,14 +227,14 @@ int nettl_open(wtap *wth, int *err, gchar **err_info _U_)
/* This is an nettl file */
wth->file_type = WTAP_FILE_NETTL;
- wth->capture.nettl = g_malloc(sizeof(nettl_t));
+ nettl = g_malloc(sizeof(nettl_t));
+ wth->priv = (void *)nettl;
if (file_hdr.os_vers[2] == '1' && file_hdr.os_vers[3] == '1')
- wth->capture.nettl->is_hpux_11 = TRUE;
+ nettl->is_hpux_11 = TRUE;
else
- wth->capture.nettl->is_hpux_11 = FALSE;
+ nettl->is_hpux_11 = FALSE;
wth->subtype_read = nettl_read;
wth->subtype_seek_read = nettl_seek_read;
- wth->subtype_close = nettl_close;
wth->snapshot_length = 0; /* not available */
/* read the first header to take a guess at the file encap */
@@ -240,7 +244,7 @@ int nettl_open(wtap *wth, int *err, gchar **err_info _U_)
return -1;
if (bytes_read != 0) {
*err = WTAP_ERR_SHORT_READ;
- g_free(wth->capture.nettl);
+ g_free(nettl);
return -1;
}
return 0;
@@ -280,7 +284,7 @@ int nettl_open(wtap *wth, int *err, gchar **err_info _U_)
}
if (file_seek(wth->fh, FILE_HDR_SIZE, SEEK_SET, err) == -1) {
- g_free(wth->capture.nettl);
+ g_free(nettl);
return -1;
}
wth->data_offset = FILE_HDR_SIZE;
@@ -367,6 +371,7 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
union wtap_pseudo_header *pseudo_header, int *err,
gchar **err_info, gboolean *fddihack)
{
+ nettl_t *nettl = (nettl_t *)wth->priv;
int bytes_read;
struct nettlrec_hdr rec_hdr;
guint16 hdr_len;
@@ -562,7 +567,7 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
*
* And what are the extra two bytes?
*/
- if (wth->capture.nettl->is_hpux_11) {
+ if (nettl->is_hpux_11) {
if (file_seek(fh, 2, SEEK_CUR, err) == -1) return -1;
offset += 2;
}
@@ -674,11 +679,6 @@ nettl_read_rec_data(FILE_T fh, guchar *pd, int length, int *err, gboolean fddiha
return TRUE;
}
-static void nettl_close(wtap *wth)
-{
- g_free(wth->capture.nettl);
-}
-
/* Returns 0 if we could write the specified encapsulation type,
an error indication otherwise. nettl files are WTAP_ENCAP_UNKNOWN