aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/camins.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-05-08 22:59:19 -0400
committerMichael Mann <mmann78@netscape.net>2014-05-09 03:04:39 +0000
commit1abeb277f5e6bd27fbaebfecc8184e37ba9d008a (patch)
tree8cc6eaa5a6982454a00adc600fa4aab02bec3d73 /wiretap/camins.c
parentaa3a968eb6e85c47014a4cec4a2b955357b0e77f (diff)
Refactor Wiretap
Start of refactoring Wiretap and breaking structures down into "generally useful fields for dissection" and "capture specific". Since this in intended as a "base" for Wiretap and Filetap, the "wft" prefix is used for "common" functionality. The "architectural" changes can be found in cfile.h, wtap.h, wtap-int.h and (new file) wftap-int.h. Most of the other (painstaking) changes were really just the result of compiling those new architecture changes. bug:9607 Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae Reviewed-on: https://code.wireshark.org/review/1485 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wiretap/camins.c')
-rw-r--r--wiretap/camins.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/wiretap/camins.c b/wiretap/camins.c
index ccc618498a..b1edeff158 100644
--- a/wiretap/camins.c
+++ b/wiretap/camins.c
@@ -62,6 +62,7 @@
#include <string.h>
#include <glib.h>
#include <wtap.h>
+#include <wftap-int.h>
#include <wtap-int.h>
#include <file_wrappers.h>
#include <buffer.h>
@@ -297,28 +298,29 @@ camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
static gboolean
-camins_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
+camins_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
{
- *data_offset = file_tell(wth->fh);
+ wtap* wth = (wtap*)wfth->tap_specific_data;
+ *data_offset = file_tell(wfth->fh);
- return camins_read_packet(wth->fh, &wth->phdr, wth->frame_buffer, err,
- err_info);
+ return camins_read_packet(wfth->fh, &wth->phdr, wfth->frame_buffer, err,
+ err_info);
}
static gboolean
-camins_seek_read(wtap *wth, gint64 seek_off,
- struct wtap_pkthdr *pkthdr, Buffer *buf, int *err, gchar **err_info)
+camins_seek_read(wftap *wfth, gint64 seek_off,
+ void* header, Buffer *buf, int *err, gchar **err_info)
{
- if (-1 == file_seek(wth->random_fh, seek_off, SEEK_SET, err))
+ struct wtap_pkthdr *pkthdr = (struct wtap_pkthdr *)header;
+ if (-1 == file_seek(wfth->random_fh, seek_off, SEEK_SET, err))
return FALSE;
- return camins_read_packet(wth->random_fh, pkthdr, buf, err, err_info);
+ return camins_read_packet(wfth->random_fh, pkthdr, buf, err, err_info);
}
-
-int camins_open(wtap *wth, int *err, gchar **err_info _U_)
+int camins_open(wftap *wfth, int *err, gchar **err_info _U_)
{
guint8 found_start_blocks = 0;
guint8 count = 0;
@@ -328,7 +330,7 @@ int camins_open(wtap *wth, int *err, gchar **err_info _U_)
/* all CAM Inspector files I've looked at have at least two blocks of
0x00 0xE1 within the first 20 bytes */
do {
- bytes_read = file_read(block, sizeof(block), wth->fh);
+ bytes_read = file_read(block, sizeof(block), wfth->fh);
if (bytes_read != sizeof(block))
break;
@@ -342,18 +344,18 @@ int camins_open(wtap *wth, int *err, gchar **err_info _U_)
return 0; /* no CAM Inspector file */
/* rewind the fh so we re-read from the beginning */
- if (-1 == file_seek(wth->fh, 0, SEEK_SET, err))
+ if (-1 == file_seek(wfth->fh, 0, SEEK_SET, err))
return -1;
- wth->file_encap = WTAP_ENCAP_DVBCI;
- wth->snapshot_length = 0;
- wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
+ wfth->file_encap = WTAP_ENCAP_DVBCI;
+ wfth->snapshot_length = 0;
+ wfth->tsprecision = WTAP_FILE_TSPREC_MSEC;
- wth->priv = NULL;
+ wfth->priv = NULL;
- wth->subtype_read = camins_read;
- wth->subtype_seek_read = camins_seek_read;
- wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CAMINS;
+ wfth->subtype_read = camins_read;
+ wfth->subtype_seek_read = camins_seek_read;
+ wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CAMINS;
*err = 0;
return 1;