summaryrefslogtreecommitdiff
path: root/wiretap/csids.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/csids.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/csids.c')
-rw-r--r--wiretap/csids.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/wiretap/csids.c b/wiretap/csids.c
index bd84755210..c70c212466 100644
--- a/wiretap/csids.c
+++ b/wiretap/csids.c
@@ -49,7 +49,6 @@ static gboolean csids_read(wtap *wth, int *err, gchar **err_info,
static gboolean csids_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
int *err, gchar **err_info);
-static void csids_close(wtap *wth);
struct csids_header {
guint32 seconds; /* seconds since epoch */
@@ -57,6 +56,10 @@ struct csids_header {
guint16 caplen; /* the capture length */
};
+typedef struct {
+ gboolean byteswapped;
+} csids_t;
+
/* XXX - return -1 on I/O error and actually do something with 'err'. */
int csids_open(wtap *wth, int *err, gchar **err_info _U_)
{
@@ -72,6 +75,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info _U_)
gboolean byteswap = FALSE;
struct csids_header hdr;
+ csids_t *csids;
/* check the file to make sure it is a csids file. */
bytesRead = file_read( &hdr, 1, sizeof( struct csids_header), wth->fh );
@@ -133,14 +137,14 @@ int csids_open(wtap *wth, int *err, gchar **err_info _U_)
return -1;
wth->data_offset = 0;
- wth->capture.csids = g_malloc(sizeof(csids_t));
- wth->capture.csids->byteswapped = byteswap;
+ csids = (csids_t *)g_malloc(sizeof(csids_t));
+ wth->priv = (void *)csids;
+ csids->byteswapped = byteswap;
wth->file_encap = WTAP_ENCAP_RAW_IP;
wth->file_type = WTAP_FILE_CSIDS;
wth->snapshot_length = 0; /* not known */
wth->subtype_read = csids_read;
wth->subtype_seek_read = csids_seek_read;
- wth->subtype_close = csids_close;
wth->tsprecision = WTAP_FILE_TSPREC_SEC;
return 1;
@@ -150,6 +154,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info _U_)
static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_,
gint64 *data_offset)
{
+ csids_t *csids = (csids_t *)wth->priv;
guint8 *buf;
int bytesRead = 0;
struct csids_header hdr;
@@ -187,7 +192,7 @@ static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_,
wth->phdr.ts.secs = hdr.seconds;
wth->phdr.ts.nsecs = 0;
- if( wth->capture.csids->byteswapped ) {
+ if( csids->byteswapped ) {
PBSWAP16(buf); /* the ip len */
PBSWAP16(buf+2); /* ip id */
PBSWAP16(buf+4); /* ip flags and fragoff */
@@ -206,6 +211,7 @@ csids_seek_read (wtap *wth,
int *err,
gchar **err_info)
{
+ csids_t *csids = (csids_t *)wth->priv;
int bytesRead;
struct csids_header hdr;
@@ -239,7 +245,7 @@ csids_seek_read (wtap *wth,
return FALSE;
}
- if( wth->capture.csids->byteswapped ) {
+ if( csids->byteswapped ) {
PBSWAP16(pd); /* the ip len */
PBSWAP16(pd+2); /* ip id */
PBSWAP16(pd+4); /* ip flags and fragoff */
@@ -247,9 +253,3 @@ csids_seek_read (wtap *wth,
return TRUE;
}
-
-static void
-csids_close(wtap *wth)
-{
- g_free(wth->capture.csids);
-}