summaryrefslogtreecommitdiff
path: root/wiretap/5views.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/5views.c
parentc4dd5ca6f3bb794c9f1736adf8a8f02c641a76e6 (diff)
downloadwireshark-17392a865ac79a9f631e63652dff45b6bb1c64d2.tar.gz
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/5views.c')
-rw-r--r--wiretap/5views.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/wiretap/5views.c b/wiretap/5views.c
index b153e652fe..3eeb28eb5c 100644
--- a/wiretap/5views.c
+++ b/wiretap/5views.c
@@ -339,6 +339,10 @@ _5views_seek_read(wtap *wth, gint64 seek_off,
+typedef struct {
+ guint32 nframes;
+} _5views_dump_t;
+
static const int wtap_encap[] = {
-1, /* WTAP_ENCAP_UNKNOWN -> unsupported */
CST_5VW_CAPTURE_ETH_FILEID, /* WTAP_ENCAP_ETHERNET -> Ehernet Ethernet */
@@ -375,6 +379,7 @@ int _5views_dump_can_write_encap(int encap)
failure */
gboolean _5views_dump_open(wtap_dumper *wdh, gboolean cant_seek _U_, int *err)
{
+ _5views_dump_t *_5views;
/* We can't fill in all the fields in the file header, as we
haven't yet written any packets. As we'll have to rewrite
@@ -388,8 +393,9 @@ gboolean _5views_dump_open(wtap_dumper *wdh, gboolean cant_seek _U_, int *err)
/* This is a 5Views file */
wdh->subtype_write = _5views_dump;
wdh->subtype_close = _5views_dump_close;
- wdh->dump._5views = (_5views_dump_t *)g_malloc(sizeof(_5views_dump_t));
- wdh->dump._5views->nframes = 0;
+ _5views = (_5views_dump_t *)g_malloc(sizeof(_5views_dump_t));
+ wdh->priv = (void *)_5views;
+ _5views->nframes = 0;
return TRUE;
}
@@ -401,7 +407,7 @@ static gboolean _5views_dump(wtap_dumper *wdh,
const union wtap_pseudo_header *pseudo_header _U_,
const guchar *pd, int *err)
{
-
+ _5views_dump_t *_5views = (_5views_dump_t *)wdh->priv;
size_t nwritten;
static t_5VW_TimeStamped_Header HeaderFrame;
@@ -440,13 +446,14 @@ static gboolean _5views_dump(wtap_dumper *wdh,
return FALSE;
}
- wdh->dump._5views->nframes ++;
+ _5views->nframes ++;
return TRUE;
}
static gboolean _5views_dump_close(wtap_dumper *wdh, int *err)
{
+ _5views_dump_t *_5views = (_5views_dump_t *)wdh->priv;
t_5VW_Capture_Header file_hdr;
size_t nwritten;
@@ -486,7 +493,7 @@ static gboolean _5views_dump_close(wtap_dumper *wdh, int *err)
file_hdr.HeaderNbFrames.Nb = htoles(1); /* Number of elements */
/* fill in the number of frames saved */
- file_hdr.TramesStockeesInFile = htolel(wdh->dump._5views->nframes);
+ file_hdr.TramesStockeesInFile = htolel(_5views->nframes);
/* Write the file header. */
nwritten = fwrite(&file_hdr, 1, sizeof(t_5VW_Capture_Header), wdh->fh);