Refactor Wiretap
authorMichael Mann <mmann78@netscape.net>
Fri, 9 May 2014 02:59:19 +0000 (22:59 -0400)
committerMichael Mann <mmann78@netscape.net>
Fri, 9 May 2014 03:04:39 +0000 (03:04 +0000)
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>
143 files changed:
capinfos.c
capture_info.c
captype.c
cfile.c
cfile.h
editcap.c
epan/wslua/wslua.h
epan/wslua/wslua_dumper.c
epan/wslua/wslua_file.c
file.c
filetap/file_access.c
filetap/ftap.c
frame_tvbuff.c
mergecap.c
randpkt.c
rawshark.c
reordercap.c
summary.c
tfshark.c
tshark.c
ui/gtk/capture_file_dlg.c
ui/gtk/file_import_dlg.c
ui/gtk/iax2_analysis.c
ui/gtk/main.c
ui/gtk/packet_win.c
ui/gtk/rlc_lte_graph.c
ui/gtk/rtp_analysis.c
ui/gtk/sctp_assoc_analyse.c
ui/qt/capture_file_dialog.cpp
ui/qt/import_text_dialog.cpp
ui/qt/packet_list.cpp
ui/tap-tcp-stream.c
ui/tap_export_pdu.c
ui/tap_export_pdu.h
ui/text_import.c
ui/text_import.h
ui/win32/file_dlg_win32.c
wiretap/5views.c
wiretap/5views.h
wiretap/CMakeLists.txt
wiretap/Makefile.common
wiretap/aethra.c
wiretap/aethra.h
wiretap/ascendtext.c
wiretap/ascendtext.h
wiretap/ber.c
wiretap/ber.h
wiretap/btsnoop.c
wiretap/btsnoop.h
wiretap/camins.c
wiretap/camins.h
wiretap/catapult_dct2000.c
wiretap/catapult_dct2000.h
wiretap/commview.c
wiretap/commview.h
wiretap/cosine.c
wiretap/cosine.h
wiretap/csids.c
wiretap/csids.h
wiretap/daintree-sna.c
wiretap/daintree-sna.h
wiretap/dbs-etherwatch.c
wiretap/dbs-etherwatch.h
wiretap/dct3trace.c
wiretap/dct3trace.h
wiretap/erf.c
wiretap/erf.h
wiretap/eyesdn.c
wiretap/eyesdn.h
wiretap/file_access.c
wiretap/hcidump.c
wiretap/hcidump.h
wiretap/i4btrace.c
wiretap/i4btrace.h
wiretap/ipfix.c
wiretap/ipfix.h
wiretap/iptrace.c
wiretap/iptrace.h
wiretap/iseries.c
wiretap/iseries.h
wiretap/k12.c
wiretap/k12.h
wiretap/k12text.l
wiretap/lanalyzer.c
wiretap/lanalyzer.h
wiretap/libpcap.c
wiretap/libpcap.h
wiretap/logcat.c
wiretap/logcat.h
wiretap/merge.c
wiretap/merge.h
wiretap/mime_file.c
wiretap/mime_file.h
wiretap/mp2t.c
wiretap/mp2t.h
wiretap/mpeg.c
wiretap/mpeg.h
wiretap/netmon.c
wiretap/netmon.h
wiretap/netscaler.c
wiretap/netscaler.h
wiretap/netscreen.c
wiretap/netscreen.h
wiretap/nettl.c
wiretap/nettl.h
wiretap/network_instruments.c
wiretap/network_instruments.h
wiretap/netxray.c
wiretap/netxray.h
wiretap/ngsniffer.c
wiretap/ngsniffer.h
wiretap/packetlogger.c
wiretap/packetlogger.h
wiretap/pcap-common.c
wiretap/pcap-common.h
wiretap/pcapng.c
wiretap/pcapng.h
wiretap/peekclassic.c
wiretap/peekclassic.h
wiretap/peektagged.c
wiretap/peektagged.h
wiretap/pppdump.c
wiretap/pppdump.h
wiretap/radcom.c
wiretap/radcom.h
wiretap/snoop.c
wiretap/snoop.h
wiretap/stanag4607.c
wiretap/stanag4607.h
wiretap/tnef.c
wiretap/tnef.h
wiretap/toshiba.c
wiretap/toshiba.h
wiretap/visual.c
wiretap/visual.h
wiretap/vms.c
wiretap/vms.h
wiretap/vwr.c
wiretap/vwr.h
wiretap/wftap-int.h [new file with mode: 0644]
wiretap/wtap-int.h
wiretap/wtap.c
wiretap/wtap.h

index bad557e2ddad8cc001d9cf864e96ec933ef08bfa..dc2a2c9faf8e60f2eee137dcbcd834cebfaf495c 100644 (file)
@@ -408,7 +408,7 @@ time_string(time_t timer, capture_info *cf_info, gboolean want_lf)
       g_snprintf(time_string_buf, 20, "%lu%s", (unsigned long)timer, lf);
       return time_string_buf;
     } else {
-      time_string_ctime = ctime(&timer);
+      time_string_ctime = asctime(localtime(&timer));
       if (time_string_ctime == NULL) {
         g_snprintf(time_string_buf, 20, "Not representable%s", lf);
         return time_string_buf;
@@ -800,7 +800,7 @@ print_stats_table(const gchar *filename, capture_info *cf_info)
 }
 
 static int
-process_cap_file(wtap *wth, const char *filename)
+process_cap_file(wftap *wth, const char *filename)
 {
   int                   status = 0;
   int                   err;
@@ -868,7 +868,7 @@ process_cap_file(wtap *wth, const char *filename)
     }
 
     /* Per-packet encapsulation */
-    if (wtap_file_encap(wth) == WTAP_ENCAP_PER_PACKET) {
+    if (wftap_file_encap(wth) == WTAP_ENCAP_PER_PACKET) {
       if ((phdr->pkt_encap > 0) && (phdr->pkt_encap < WTAP_NUM_ENCAP_TYPES)) {
         cf_info.encap_counts[phdr->pkt_encap] += 1;
       } else {
@@ -905,7 +905,7 @@ process_cap_file(wtap *wth, const char *filename)
   }
 
   /* File size */
-  size = wtap_file_size(wth, &err);
+  size = wftap_file_size(wth, &err);
   if (size == -1) {
     fprintf(stderr,
         "capinfos: Can't get size of \"%s\": %s.\n",
@@ -917,14 +917,14 @@ process_cap_file(wtap *wth, const char *filename)
   cf_info.filesize = size;
 
   /* File Type */
-  cf_info.file_type = wtap_file_type_subtype(wth);
-  cf_info.iscompressed = wtap_iscompressed(wth);
+  cf_info.file_type = wftap_file_type_subtype(wth);
+  cf_info.iscompressed = wftap_iscompressed(wth);
 
   /* File Encapsulation */
-  cf_info.file_encap = wtap_file_encap(wth);
+  cf_info.file_encap = wftap_file_encap(wth);
 
   /* Packet size limit (snaplen) */
-  cf_info.snaplen = wtap_snapshot_length(wth);
+  cf_info.snaplen = wftap_snapshot_length(wth);
   if (cf_info.snaplen > 0)
     cf_info.snap_set = TRUE;
   else
@@ -1098,7 +1098,7 @@ hash_to_str(const unsigned char *hash, size_t length, char *str) {
 int
 main(int argc, char *argv[])
 {
-  wtap  *wth;
+  wftap *wth;
   int    err;
   gchar *err_info;
   int    opt;
index 3ef12df504da1434b085c0c260045a5996d48e40..45a32e1d70e76cd0dc0433b36af0497c7a2559f9 100644 (file)
@@ -68,7 +68,7 @@ packet_counts *counts, gint wtap_linktype, const guchar *pd, guint32 caplen, uni
 
 typedef struct _info_data {
     packet_counts     counts;     /* several packet type counters */
-    struct wtap*      wtap;       /* current wtap file */
+    struct wftap*     wftap;      /* current wftap file */
     capture_info      ui;         /* user interface data */
 } info_data_t;
 
@@ -94,7 +94,7 @@ void capture_info_open(capture_session *cap_session)
     info_data.counts.i2c_event  = 0;
     info_data.counts.i2c_data   = 0;
 
-    info_data.wtap = NULL;
+    info_data.wftap = NULL;
     info_data.ui.counts = &info_data.counts;
 
     capture_info_ui_create(&info_data.ui, cap_session);
@@ -216,12 +216,12 @@ gboolean capture_info_new_file(const char *new_filename)
     gchar *err_msg;
 
 
-    if(info_data.wtap != NULL) {
-        wtap_close(info_data.wtap);
+    if(info_data.wftap != NULL) {
+        wftap_close(info_data.wftap);
     }
 
-    info_data.wtap = wtap_open_offline(new_filename, WTAP_TYPE_AUTO, &err, &err_info, FALSE);
-    if (!info_data.wtap) {
+    info_data.wftap = wtap_open_offline(new_filename, WTAP_TYPE_AUTO, &err, &err_info, FALSE);
+    if (!info_data.wftap) {
         err_msg = g_strdup_printf(cf_open_error_message(err, err_info, FALSE, WTAP_FILE_TYPE_SUBTYPE_UNKNOWN),
                                   new_filename);
         g_warning("capture_info_new_file: %d (%s)", err, err_msg);
@@ -249,12 +249,12 @@ void capture_info_new_packets(int to_read)
     /*g_warning("new packets: %u", to_read);*/
 
     while (to_read > 0) {
-        wtap_cleareof(info_data.wtap);
-        if (wtap_read(info_data.wtap, &err, &err_info, &data_offset)) {
-            phdr = wtap_phdr(info_data.wtap);
+        wftap_cleareof(info_data.wftap);
+        if (wtap_read(info_data.wftap, &err, &err_info, &data_offset)) {
+            phdr = wtap_phdr(info_data.wftap);
             pseudo_header = &phdr->pseudo_header;
             wtap_linktype = phdr->pkt_encap;
-            buf = wtap_buf_ptr(info_data.wtap);
+            buf = wftap_buf_ptr(info_data.wftap);
 
             capture_info_packet(&info_data.counts, wtap_linktype, buf, phdr->caplen, pseudo_header);
 
@@ -271,8 +271,8 @@ void capture_info_new_packets(int to_read)
 void capture_info_close(void)
 {
     capture_info_ui_destroy(&info_data.ui);
-    if(info_data.wtap)
-        wtap_close(info_data.wtap);
+    if(info_data.wftap)
+        wtap_close(info_data.wftap);
 }
 
 
index 3062fb112213d95f865bb5db5ff8304317d0528c..1c4528e27b78b5ef48fa928ff53b862e9885514c 100644 (file)
--- a/captype.c
+++ b/captype.c
@@ -91,7 +91,7 @@ failure_message(const char *msg_format _U_, va_list ap _U_)
 int
 main(int argc, char *argv[])
 {
-  wtap  *wth;
+  wftap *wth;
   int    err;
   gchar *err_info;
   int    i;
@@ -145,8 +145,8 @@ main(int argc, char *argv[])
     wth = wtap_open_offline(argv[i], WTAP_TYPE_AUTO, &err, &err_info, FALSE);
 
     if(wth) {
-      printf("%s: %s\n", argv[i], wtap_file_type_subtype_short_string(wtap_file_type_subtype(wth)));
-      wtap_close(wth);
+      printf("%s: %s\n", argv[i], wtap_file_type_subtype_short_string(wftap_file_type_subtype(wth)));
+      wftap_close(wth);
     } else {
       if (err == WTAP_ERR_FILE_UNKNOWN_FORMAT)
         printf("%s: unknown\n", argv[i]);
diff --git a/cfile.c b/cfile.c
index a689b2e11c1b097d118e8f9533465dd0ce554cec..d12a699a9d1cc5828b588b616a04ea22bd856d48 100644 (file)
--- a/cfile.c
+++ b/cfile.c
@@ -36,7 +36,7 @@ cap_file_get_interface_name(void *data, guint32 interface_id)
   wtapng_iface_descriptions_t *idb_info;
   const wtapng_if_descr_t *wtapng_if_descr = NULL;
 
-  idb_info = wtap_file_get_idb_info(cf->wth);
+  idb_info = wtap_file_get_idb_info(cf->wfth);
 
   if (interface_id < idb_info->number_of_interfaces)
     wtapng_if_descr = &g_array_index(idb_info->interface_data, wtapng_if_descr_t, interface_id);
diff --git a/cfile.h b/cfile.h
index 40ae6057f0e2c800f2a4f5e2654490ed9a4d0a7d..0310d59f6bf69c4b001ba0d80f827f6196aa36d6 100644 (file)
--- a/cfile.h
+++ b/cfile.h
@@ -63,6 +63,11 @@ typedef struct {
 } modified_frame_data;
 #endif
 
+typedef union _phdr_t {
+  struct wtap_pkthdr wtap_hdr;
+  /*** Placeholder for ftap_pkthdr */
+} phdr_t;
+
 typedef struct _capture_file {
   epan_t      *epan;
   file_state   state;           /* Current state of capture file */
@@ -87,7 +92,7 @@ typedef struct _capture_file {
   nstime_t     elapsed_time;    /* Elapsed time */
   gboolean     has_snap;        /* TRUE if maximum capture packet length is known */
   int          snap;            /* Maximum captured packet length */
-  wtap        *wth;             /* Wiretap session */
+  wftap       *wfth;            /* Tap session */
   dfilter_t   *rfcode;          /* Compiled read filter program */
   dfilter_t   *dfcode;          /* Compiled display filter program */
   gchar       *dfilter;         /* Display filter string */
@@ -104,8 +109,7 @@ typedef struct _capture_file {
   search_charset_t scs_type;    /* Character set for text search */
   search_direction dir;         /* Direction in which to do searches */
   gboolean     search_in_progress; /* TRUE if user just clicked OK in the Find dialog or hit <control>N/B */
-  /* packet data */
-  struct wtap_pkthdr phdr;                /* Packet header */
+  phdr_t       hdr;             /* Packet/File header */
   Buffer       buf;             /* Packet data */
   /* frames */
   frame_data_sequence *frames;  /* Sequence of frames, if we're keeping that information */
index 70dfd0859a73aaa4c7c5d6085c18c59416915b87..0aba558e42dfb783dac0baa1e96bc73cae6d2421 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -310,9 +310,9 @@ selected(int recno)
 
 /* is the packet in the selected timeframe */
 static gboolean
-check_timestamp(wtap *wth)
+check_timestamp(wftap *wfth)
 {
-    struct wtap_pkthdr *pkthdr = wtap_phdr(wth);
+    struct wtap_pkthdr *pkthdr = wtap_phdr(wfth);
 
     return (pkthdr->ts.secs >= starttime) && (pkthdr->ts.secs < stoptime);
 }
@@ -838,7 +838,7 @@ failure_message(const char *msg_format _U_, va_list ap _U_)
 int
 main(int argc, char *argv[])
 {
-    wtap         *wth;
+    wftap        *wth;
     int           i, j, err;
     gchar        *err_info;
     int           opt;
@@ -847,7 +847,7 @@ main(int argc, char *argv[])
     guint32       snaplen            = 0; /* No limit               */
     chop_t        chop               = {0, 0, 0, 0, 0, 0}; /* No chop */
     gboolean      adjlen             = FALSE;
-    wtap_dumper  *pdh                = NULL;
+    wftap_dumper *pdh                = NULL;
     unsigned int  count              = 1;
     unsigned int  duplicate_count    = 0;
     gint64        data_offset;
@@ -1016,7 +1016,7 @@ main(int argc, char *argv[])
             break;
 
         case 'E':
-            err_prob = strtod(optarg, &p);
+            err_prob = g_strtod(optarg, &p);
             if (p == optarg || err_prob < 0.0 || err_prob > 1.0) {
                 fprintf(stderr, "editcap: probability \"%s\" must be between 0.0 and 1.0\n",
                         optarg);
@@ -1165,7 +1165,7 @@ main(int argc, char *argv[])
 
     if (verbose) {
         fprintf(stderr, "File %s is a %s capture file.\n", argv[optind],
-                wtap_file_type_subtype_string(wtap_file_type_subtype(wth)));
+                wtap_file_type_subtype_string(wftap_file_type_subtype(wth)));
     }
 
     shb_hdr = wtap_file_get_shb_info(wth);
@@ -1178,7 +1178,7 @@ main(int argc, char *argv[])
 
     if ((argc - optind) >= 2) {
         if (out_frame_type == -2)
-            out_frame_type = wtap_file_encap(wth);
+            out_frame_type = wftap_file_encap(wth);
 
         for (i = optind + 2; i < argc; i++)
             if (add_selection(argv[i]) == FALSE)
@@ -1196,7 +1196,7 @@ main(int argc, char *argv[])
             read_count++;
 
             phdr = wtap_phdr(wth);
-            buf = wtap_buf_ptr(wth);
+            buf = wftap_buf_ptr(wth);
 
             if (nstime_is_unset(&block_start)) {  /* should only be the first packet */
                 block_start.secs = phdr->ts.secs;
@@ -1217,7 +1217,7 @@ main(int argc, char *argv[])
                 }
 
                 pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type,
-                                        snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth),
+                                        snaplen ? MIN(snaplen, wftap_snapshot_length(wth)) : wftap_snapshot_length(wth),
                                         FALSE /* compressed */, shb_hdr, idb_inf, &err);
 
                 if (pdh == NULL) {
@@ -1234,7 +1234,7 @@ main(int argc, char *argv[])
                        || (phdr->ts.secs - block_start.secs == secs_per_block
                            && phdr->ts.nsecs >= block_start.nsecs )) { /* time for the next file */
 
-                    if (!wtap_dump_close(pdh, &err)) {
+                    if (!wftap_dump_close(pdh, &err)) {
                         fprintf(stderr, "editcap: Error writing to %s: %s\n",
                                 filename, wtap_strerror(err));
                         exit(2);
@@ -1248,7 +1248,7 @@ main(int argc, char *argv[])
                         fprintf(stderr, "Continuing writing in file %s\n", filename);
 
                     pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type,
-                                            snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth),
+                                            snaplen ? MIN(snaplen, wftap_snapshot_length(wth)) : wftap_snapshot_length(wth),
                                             FALSE /* compressed */, shb_hdr, idb_inf, &err);
 
                     if (pdh == NULL) {
@@ -1262,7 +1262,7 @@ main(int argc, char *argv[])
             if (split_packet_count > 0) {
                 /* time for the next file? */
                 if (written_count > 0 && written_count % split_packet_count == 0) {
-                    if (!wtap_dump_close(pdh, &err)) {
+                    if (!wftap_dump_close(pdh, &err)) {
                         fprintf(stderr, "editcap: Error writing to %s: %s\n",
                                 filename, wtap_strerror(err));
                         exit(2);
@@ -1276,7 +1276,7 @@ main(int argc, char *argv[])
                         fprintf(stderr, "Continuing writing in file %s\n", filename);
 
                     pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type,
-                                            snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth),
+                                            snaplen ? MIN(snaplen, wftap_snapshot_length(wth)) : wftap_snapshot_length(wth),
                                             FALSE /* compressed */, shb_hdr, idb_inf, &err);
                     if (pdh == NULL) {
                         fprintf(stderr, "editcap: Can't open or create %s: %s\n",
@@ -1470,7 +1470,7 @@ main(int argc, char *argv[])
                     int real_data_start = 0;
 
                     /* Protect non-protocol data */
-                    if (wtap_file_type_subtype(wth) == WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000)
+                    if (wftap_file_type_subtype(wth) == WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000)
                         real_data_start = find_dct2000_real_data(buf);
 
                     for (i = real_data_start; i < (int) phdr->caplen; i++) {
@@ -1581,7 +1581,7 @@ main(int argc, char *argv[])
             filename = g_strdup(argv[optind+1]);
 
             pdh = wtap_dump_open_ng(filename, out_file_type_subtype, out_frame_type,
-                                    snaplen ? MIN(snaplen, wtap_snapshot_length(wth)): wtap_snapshot_length(wth),
+                                    snaplen ? MIN(snaplen, wftap_snapshot_length(wth)): wftap_snapshot_length(wth),
                                     FALSE /* compressed */, shb_hdr, idb_inf, &err);
             if (pdh == NULL) {
                 fprintf(stderr, "editcap: Can't open or create %s: %s\n",
@@ -1593,7 +1593,7 @@ main(int argc, char *argv[])
         g_free(idb_inf);
         idb_inf = NULL;
 
-        if (!wtap_dump_close(pdh, &err)) {
+        if (!wftap_dump_close(pdh, &err)) {
             fprintf(stderr, "editcap: Error writing to %s: %s\n", filename,
                     wtap_strerror(err));
             exit(2);
index 5909027273430208695a4cffe7205bb26fa19f83..f64880fc3ef8acf7365e2a755e17627866e91ec2 100644 (file)
@@ -239,19 +239,19 @@ struct _wslua_tap {
 
 /* a "File" object can be different things under the hood. It can either
    be a FILE_T from wtap struct, which it is during read operations, or it
-   can be a wtap_dumper struct during write operations. A wtap_dumper struct
+   can be a wftap_dumper struct during write operations. A wtap_dumper struct
    has a FILE_T member, but we can't only store its pointer here because
    dump operations need the whole thing to write out with. Ugh. */
 struct _wslua_file {
     FILE_T   file;
-    wtap_dumper *wdh;   /* will be NULL during read usage */
+    wftap_dumper *wdh;   /* will be NULL during read usage */
     gboolean expired;
 };
 
 /* a "CaptureInfo" object can also be different things under the hood. */
 struct _wslua_captureinfo {
-    wtap *wth;          /* will be NULL during write usage */
-    wtap_dumper *wdh;   /* will be NULL during read usage */
+    wftap *wfth;         /* will be NULL during write usage */
+    wftap_dumper *wdh;   /* will be NULL during read usage */
     gboolean expired;
 };
 
@@ -334,7 +334,7 @@ typedef struct _wslua_captureinfo* CaptureInfoConst;
 typedef struct _wslua_phdr* FrameInfo;
 typedef struct _wslua_const_phdr* FrameInfoConst;
 typedef struct _wslua_filehandler* FileHandler;
-typedef wtap_dumper* Dumper;
+typedef wftap_dumper* Dumper;
 typedef struct lua_pseudo_header* PseudoHeader;
 typedef tvbparse_t* Parser;
 typedef tvbparse_wanted_t* Rule;
index 4340304f578e564a6d3c1009b9d801255e9d9ada..6b5818802d9614c212fa051a07070ffe943224f6 100644 (file)
@@ -266,7 +266,7 @@ WSLUA_METHOD Dumper_close(lua_State* L) {
 
     g_hash_table_remove(dumper_encaps,*dp);
 
-    if (!wtap_dump_close(*dp, &err)) {
+    if (!wftap_dump_close(*dp, &err)) {
         luaL_error(L,"error closing: %s",
                    wtap_strerror(err));
     }
@@ -285,7 +285,7 @@ WSLUA_METHOD Dumper_flush(lua_State* L) {
 
     if (!d) return 0;
 
-    wtap_dump_flush(d);
+    wftap_dump_flush(d);
 
     return 0;
 }
@@ -455,7 +455,7 @@ static int Dumper__gc(lua_State* L) {
 
     g_hash_table_remove(dumper_encaps,*dp);
 
-    if (!wtap_dump_close(*dp, &err)) {
+    if (!wftap_dump_close(*dp, &err)) {
         luaL_error(L,"error closing: %s",
                    wtap_strerror(err));
     }
index d7476ad446c4f3a0fac4e238c6ed0c32cbf7d853..b15eccb9be88a8a92084c5cb7b859af693365d14 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "wslua.h"
 #include <errno.h>
+#include <wiretap/wftap-int.h>
 #include <wiretap/wtap-int.h>
 #include <wiretap/file_wrappers.h>
 #include <epan/addr_resolv.h>
@@ -97,7 +98,7 @@ WSLUA_CLASS_DEFINE(File,FAIL_ON_NULL_OR_EXPIRED("File"),NOP);
 
 /* a "File" object can be different things under the hood. It can either
    be a FILE_T from wtap struct, which it is during read operations, or it
-   can be a wtap_dumper struct during write operations. A wtap_dumper struct
+   can be a wftap_dumper struct during write operations. A wtap_dumper struct
    has a FILE_T member, but we can't only store its pointer here because
    dump operations need the whole thing to write out with. Ugh. */
 static File* push_File(lua_State* L, FILE_T ft) {
@@ -108,7 +109,7 @@ static File* push_File(lua_State* L, FILE_T ft) {
     return pushFile(L,f);
 }
 
-static File* push_Wdh(lua_State* L, wtap_dumper *wdh) {
+static File* push_Wdh(lua_State* L, wftap_dumper *wdh) {
     File f = (File) g_malloc(sizeof(struct _wslua_file));
     f->file = (FILE_T)wdh->fh;
     f->wdh = wdh;
@@ -357,7 +358,7 @@ WSLUA_METHOD File_seek(lua_State* L) {
         lua_pushnumber(L, (lua_Number)(file_tell(f->file)));
     }
     else {
-        offset = wtap_dump_file_seek(f->wdh, offset, mode[op], &err);
+        offset = wftap_dump_file_seek(f->wdh, offset, mode[op], &err);
 
         if (offset < 0) {
             lua_pushnil(L);  /* error */
@@ -365,7 +366,7 @@ WSLUA_METHOD File_seek(lua_State* L) {
             return 2;
         }
 
-        offset = wtap_dump_file_tell(f->wdh, &err);
+        offset = wftap_dump_file_tell(f->wdh, &err);
 
         if (offset < 0) {
             lua_pushnil(L);  /* error */
@@ -434,7 +435,7 @@ WSLUA_METHOD File_write(lua_State* L) {
     for (; nargs--; arg++) {
         size_t len;
         const char *s = luaL_checklstring(L, arg, &len);
-        status = wtap_dump_file_write(f->wdh, s, len, &err);
+        status = wftap_dump_file_write(f->wdh, s, len, &err);
         if (!status) break;
         f->wdh->bytes_dumped += len;
     }
@@ -515,7 +516,7 @@ int File_register(lua_State* L) {
 /************
  * The following is for handling private data for the duration of the file
  * read_open/read/close cycle, or write_open/write/write_close cycle.
- * In other words it handles the "priv" member of wtap and wtap_dumper,
+ * In other words it handles the "priv" member of wtap and wftap_dumper,
  * but for the Lua script's use. A Lua script can set a Lua table
  * to CaptureInfo/CaptureInfoConst and have it saved and retrievable this way.
  * We need to offer that, because there needs to be a way for Lua scripts
@@ -531,20 +532,20 @@ typedef struct _file_priv_t {
 } file_priv_t;
 
 /* create and set the wtap->priv private data for the file instance */
-static void create_wth_priv(lua_State* L, wtap *wth) {
+static void create_wth_priv(lua_State* L, wftap *wfth) {
     file_priv_t *priv = (file_priv_t*)g_malloc(sizeof(file_priv_t));
 
-    if (wth->priv != NULL) {
+    if (wfth->priv != NULL) {
         luaL_error(L, "Cannot create wtap private data because there already is private data");
         return;
     }
     priv->table_ref = LUA_NOREF;
-    wth->priv = (void*) priv;
+    wfth->priv = (void*) priv;
 }
 
 /* gets the private data table from wtap */
-static int get_wth_priv_table_ref(lua_State* L, wtap *wth) {
-    file_priv_t *priv = (file_priv_t*) wth->priv;
+static int get_wth_priv_table_ref(lua_State* L, wftap *wfth) {
+    file_priv_t *priv = (file_priv_t*) wfth->priv;
 
     if (!priv) {
         /* shouldn't be possible */
@@ -559,8 +560,8 @@ static int get_wth_priv_table_ref(lua_State* L, wtap *wth) {
 }
 
 /* sets the private data to wtap - the table is presumed on top of stack */
-static int set_wth_priv_table_ref(lua_State* L, wtap *wth) {
-    file_priv_t *priv = (file_priv_t*) wth->priv;
+static int set_wth_priv_table_ref(lua_State* L, wftap *wfth) {
+    file_priv_t *priv = (file_priv_t*) wfth->priv;
 
     if (!priv) {
         /* shouldn't be possible */
@@ -591,8 +592,8 @@ static int set_wth_priv_table_ref(lua_State* L, wtap *wth) {
 }
 
 /* remove, deref, and free the wtap->priv data */
-static void remove_wth_priv(lua_State* L, wtap *wth) {
-    file_priv_t *priv = (file_priv_t*) wth->priv;
+static void remove_wth_priv(lua_State* L, wftap *wfth) {
+    file_priv_t *priv = (file_priv_t*) wfth->priv;
 
     if (!priv) {
         /* shouldn't be possible */
@@ -602,29 +603,29 @@ static void remove_wth_priv(lua_State* L, wtap *wth) {
 
     luaL_unref(L, LUA_REGISTRYINDEX, priv->table_ref);
 
-    g_free(wth->priv);
-    wth->priv = NULL;
+    g_free(wfth->priv);
+    wfth->priv = NULL;
 }
 
-/* create and set the wtap_dumper->priv private data for the file instance */
-static void create_wdh_priv(lua_State* L, wtap_dumper *wdh) {
+/* create and set the wftap_dumper->priv private data for the file instance */
+static void create_wdh_priv(lua_State* L, wftap_dumper *wdh) {
     file_priv_t *priv = (file_priv_t*)g_malloc(sizeof(file_priv_t));
 
     if (wdh->priv != NULL) {
-        luaL_error(L, "Cannot create wtap_dumper private data because there already is private data");
+        luaL_error(L, "Cannot create wftap_dumper private data because there already is private data");
         return;
     }
     priv->table_ref = LUA_NOREF;
     wdh->priv = (void*) priv;
 }
 
-/* get the private data from wtap_dumper */
-static int get_wdh_priv_table_ref(lua_State* L, wtap_dumper *wdh) {
+/* get the private data from wftap_dumper */
+static int get_wdh_priv_table_ref(lua_State* L, wftap_dumper *wdh) {
     file_priv_t *priv = (file_priv_t*) wdh->priv;
 
     if (!priv) {
         /* shouldn't be possible */
-        luaL_error(L, "Cannot get wtap_dumper private data: it is null");
+        luaL_error(L, "Cannot get wftap_dumper private data: it is null");
         return LUA_NOREF;
     }
 
@@ -635,7 +636,7 @@ static int get_wdh_priv_table_ref(lua_State* L, wtap_dumper *wdh) {
 }
 
 /* sets the private data to wtap - the table is presumed on top of stack */
-static int set_wdh_priv_table_ref(lua_State* L, wtap_dumper *wdh) {
+static int set_wdh_priv_table_ref(lua_State* L, wftap_dumper *wdh) {
     file_priv_t *priv = (file_priv_t*) wdh->priv;
 
     if (!priv) {
@@ -666,22 +667,22 @@ static int set_wdh_priv_table_ref(lua_State* L, wtap_dumper *wdh) {
     return 0;
 }
 
-/* remove and deref the wtap_dumper->priv data */
-static void remove_wdh_priv(lua_State* L, wtap_dumper *wdh) {
+/* remove and deref the wftap_dumper->priv data */
+static void remove_wdh_priv(lua_State* L, wftap_dumper *wdh) {
     file_priv_t *priv = (file_priv_t*) wdh->priv;
 
     if (!priv) {
         /* shouldn't be possible */
-        luaL_error(L, "Cannot remove wtap_dumper private data: it is null");
+        luaL_error(L, "Cannot remove wftap_dumper private data: it is null");
         return;
     }
 
     luaL_unref(L, LUA_REGISTRYINDEX, priv->table_ref);
-    /* we do NOT free wtap_dumper's priv member - wtap_dump_close() free's it */
+    /* we do NOT free wftap_dumper's priv member - wftap_dump_close() free's it */
 }
 
 
-WSLUA_CLASS_DEFINE(CaptureInfo,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfo",wth),NOP);
+WSLUA_CLASS_DEFINE(CaptureInfo,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfo",wfth),NOP);
 /*
     A `CaptureInfo` object, passed into Lua as an argument by `FileHandler` callback
     function `read_open()`, `read()`, `seek_read()`, `seq_read_close()`, and `read_close()`.
@@ -696,17 +697,17 @@ WSLUA_CLASS_DEFINE(CaptureInfo,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfo",wth)
     @since 1.11.3
  */
 
-static CaptureInfo* push_CaptureInfo(lua_State* L, wtap *wth, const gboolean first_time) {
+static CaptureInfo* push_CaptureInfo(lua_State* L, wftap *wfth, const gboolean first_time) {
     CaptureInfo f = (CaptureInfo) g_malloc0(sizeof(struct _wslua_captureinfo));
-    f->wth = wth;
+    f->wfth = wfth;
     f->wdh = NULL;
     f->expired = FALSE;
 
     if (first_time) {
         /* XXX: need to do this? */
-        wth->file_encap = WTAP_ENCAP_UNKNOWN;
-        wth->tsprecision = WTAP_FILE_TSPREC_SEC;
-        wth->snapshot_length = 0;
+        wfth->file_encap = WTAP_ENCAP_UNKNOWN;
+        wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
+        wfth->snapshot_length = 0;
     }
 
     return pushCaptureInfo(L,f);
@@ -716,12 +717,13 @@ WSLUA_METAMETHOD CaptureInfo__tostring(lua_State* L) {
     /* Generates a string of debug info for the CaptureInfo */
     CaptureInfo fi = toCaptureInfo(L,1);
 
-    if (!fi || !fi->wth) {
+    if (!fi || !fi->wfth) {
         lua_pushstring(L,"CaptureInfo pointer is NULL!");
     } else {
-        wtap *wth = fi->wth;
+        wftap *wfth = fi->wfth;
+        wtap* wth   = (wtap*)wfth->tap_specific_data;
         lua_pushfstring(L, "CaptureInfo: file_type_subtype=%d, snapshot_length=%d, pkt_encap=%d, tsprecision='%s'",
-            wth->file_type_subtype, wth->snapshot_length, wth->phdr.pkt_encap, wth->tsprecision);
+            wfth->file_type_subtype, wfth->snapshot_length, wth->phdr.pkt_encap, wfth->tsprecision);
     }
 
     WSLUA_RETURN(1); /* String of debug information. */
@@ -740,23 +742,24 @@ static int CaptureInfo__gc(lua_State* L _U_) {
     See `wtap_encaps` in `init.lua` for available types.  Set to `wtap_encaps.PER_PACKET` if packets can
     have different types, then later set `FrameInfo.encap` for each packet during `read()`/`seek_read()`.
  */
-WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfo,encap,wth->file_encap);
-WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,encap,wth->file_encap,int);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfo,encap,wfth->file_encap);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,encap,wfth->file_encap,int);
 
 /* WSLUA_ATTRIBUTE CaptureInfo_time_precision RW The precision of the packet timestamps in the file.
 
     See `wtap_file_tsprec` in `init.lua` for available precisions.
  */
-WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfo,time_precision,wth->tsprecision);
-WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,time_precision,wth->tsprecision,int);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfo,time_precision,wfth->tsprecision);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,time_precision,wfth->tsprecision,int);
 
 /* WSLUA_ATTRIBUTE CaptureInfo_snapshot_length RW The maximum packet length that could be recorded.
 
     Setting it to `0` means unknown.  Wireshark cannot handle anything bigger than 65535 bytes.
  */
-WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfo,snapshot_length,wth->snapshot_length);
-WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,snapshot_length,wth->snapshot_length,guint);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfo,snapshot_length,wfth->snapshot_length);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,snapshot_length,wfth->snapshot_length,guint);
 
+#if FILESHARK /* XXX - FIX ME PLEASE!!!!!! */
 /* WSLUA_ATTRIBUTE CaptureInfo_comment RW A string comment for the whole capture file,
     or nil if there is no `comment`. */
 WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(CaptureInfo,comment,wth->shb_hdr.opt_comment);
@@ -776,6 +779,7 @@ WSLUA_ATTRIBUTE_NAMED_STRING_SETTER(CaptureInfo,os,wth->shb_hdr.shb_os,TRUE);
     the application used to create the capture, or nil if there is no `user_app` string. */
 WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(CaptureInfo,user_app,wth->shb_hdr.shb_user_appl);
 WSLUA_ATTRIBUTE_NAMED_STRING_SETTER(CaptureInfo,user_app,wth->shb_hdr.shb_user_appl,TRUE);
+#endif
 
 /* WSLUA_ATTRIBUTE CaptureInfo_hosts WO Sets resolved ip-to-hostname information.
 
@@ -791,7 +795,8 @@ WSLUA_ATTRIBUTE_NAMED_STRING_SETTER(CaptureInfo,user_app,wth->shb_hdr.shb_user_a
     */
 static int CaptureInfo_set_hosts(lua_State* L) {
     CaptureInfo fi = checkCaptureInfo(L,1);
-    wtap *wth = fi->wth;
+    wftap *wfth = fi->wfth;
+    wtap *wth = (wtap*)wfth->tap_specific_data;
     const char *addr = NULL;
     const char *name = NULL;
     size_t addr_len = 0;
@@ -914,22 +919,24 @@ static int CaptureInfo_set_hosts(lua_State* L) {
 */
 static int CaptureInfo_get_private_table(lua_State* L) {
     CaptureInfo fi = checkCaptureInfo(L,1);
-    return get_wth_priv_table_ref(L, fi->wth);
+    return get_wth_priv_table_ref(L, fi->wfth);
 }
 
 static int CaptureInfo_set_private_table(lua_State* L) {
     CaptureInfo fi = checkCaptureInfo(L,1);
-    return set_wth_priv_table_ref(L, fi->wth);
+    return set_wth_priv_table_ref(L, fi->wfth);
 }
 
 WSLUA_ATTRIBUTES CaptureInfo_attributes[] = {
     WSLUA_ATTRIBUTE_RWREG(CaptureInfo,encap),
     WSLUA_ATTRIBUTE_RWREG(CaptureInfo,time_precision),
     WSLUA_ATTRIBUTE_RWREG(CaptureInfo,snapshot_length),
+#if FILESHARK /* XXX - FIX ME PLEASE!!!!!! */
     WSLUA_ATTRIBUTE_RWREG(CaptureInfo,comment),
     WSLUA_ATTRIBUTE_RWREG(CaptureInfo,hardware),
     WSLUA_ATTRIBUTE_RWREG(CaptureInfo,os),
     WSLUA_ATTRIBUTE_RWREG(CaptureInfo,user_app),
+#endif
     WSLUA_ATTRIBUTE_WOREG(CaptureInfo,hosts),
     WSLUA_ATTRIBUTE_RWREG(CaptureInfo,private_table),
     { NULL, NULL, NULL }
@@ -963,9 +970,9 @@ WSLUA_CLASS_DEFINE(CaptureInfoConst,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfoC
     @since 1.11.3
  */
 
-static CaptureInfoConst* push_CaptureInfoConst(lua_State* L, wtap_dumper *wdh) {
+static CaptureInfoConst* push_CaptureInfoConst(lua_State* L, wftap_dumper *wdh) {
     CaptureInfoConst f = (CaptureInfoConst) g_malloc0(sizeof(struct _wslua_captureinfo));
-    f->wth = NULL;
+    f->wfth = NULL;
     f->wdh = wdh;
     f->expired = FALSE;
     return pushCaptureInfoConst(L,f);
@@ -978,7 +985,7 @@ WSLUA_METAMETHOD CaptureInfoConst__tostring(lua_State* L) {
     if (!fi || !fi->wdh) {
         lua_pushstring(L,"CaptureInfoConst pointer is NULL!");
     } else {
-        wtap_dumper *wdh = fi->wdh;
+        wftap_dumper *wdh = fi->wdh;
         lua_pushfstring(L, "CaptureInfoConst: file_type_subtype=%d, snaplen=%d, encap=%d, compressed=%d, tsprecision='%s'",
             wdh->file_type_subtype, wdh->snaplen, wdh->encap, wdh->compressed, wdh->tsprecision);
     }
@@ -1000,6 +1007,7 @@ WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfoConst,snapshot_length,wdh->snaple
     have different types, in which case each Frame identifies its type, in `FrameInfo.packet_encap`. */
 WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfoConst,encap,wdh->encap);
 
+#if FILESHARK /* XXX - FIX ME PLEASE!!!!!! */
 /* WSLUA_ATTRIBUTE CaptureInfoConst_comment RW A comment for the whole capture file, if the
     `wtap_presence_flags.COMMENTS` was set in the presence flags; nil if there is no comment. */
 WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(CaptureInfoConst,comment,wth->shb_hdr.opt_comment);
@@ -1015,6 +1023,7 @@ WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(CaptureInfoConst,os,wth->shb_hdr.shb_os);
 /* WSLUA_ATTRIBUTE CaptureInfoConst_user_app RO A string containing the name of
     the application used to create the capture, or nil if there is no user_app string. */
 WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(CaptureInfoConst,user_app,wth->shb_hdr.shb_user_appl);
+#endif
 
 /* WSLUA_ATTRIBUTE CaptureInfoConst_hosts RO A ip-to-hostname Lua table of two key-ed names: `ipv4_addresses` and `ipv6_addresses`.
     The value of each of these names are themselves array tables, of key-ed tables, such that the inner table has a key
@@ -1028,7 +1037,8 @@ WSLUA_ATTRIBUTE_NAMED_STRING_GETTER(CaptureInfoConst,user_app,wth->shb_hdr.shb_u
     be nil. */
 static int CaptureInfoConst_get_hosts(lua_State* L) {
     CaptureInfoConst fi = checkCaptureInfoConst(L,1);
-    wtap_dumper *wdh = fi->wdh;
+    wftap_dumper *wfdh = fi->wdh;
+    wtap_dumper *wdh = (wtap_dumper*)wfdh->tap_specific_data;
 
     /* create the main table to return */
     lua_newtable(L);
@@ -1126,10 +1136,12 @@ WSLUA_ATTRIBUTES CaptureInfoConst_attributes[] = {
     WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,encap),
     WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,type),
     WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,snapshot_length),
+#if FILESHARK /* XXX - FIX ME PLEASE!!!!!! */
     WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,comment),
     WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,hardware),
     WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,os),
     WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,user_app),
+#endif
     WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,hosts),
     WSLUA_ATTRIBUTE_RWREG(CaptureInfoConst,private_table),
     { NULL, NULL, NULL }
@@ -1418,7 +1430,7 @@ WSLUA_METHOD FrameInfoConst_write_data(lua_State* L) {
     if (len > fi->phdr->caplen)
         len = fi->phdr->caplen;
 
-    if (!wtap_dump_file_write(fh->wdh, fi->pd, (size_t)(len), &err)) {
+    if (!wftap_dump_file_write(fh->wdh, fi->pd, (size_t)(len), &err)) {
         lua_pushboolean(L, FALSE);
         lua_pushfstring(L, "FrameInfoConst write_data() error: %s", g_strerror(err));
         lua_pushnumber(L, err);
@@ -1618,16 +1630,16 @@ static gboolean in_routine = FALSE;
 
 /* some declarations */
 static gboolean
-wslua_filehandler_read(wtap *wth, int *err, gchar **err_info,
+wslua_filehandler_read(wftap *wfth, int *err, gchar **err_info,
                       gint64 *data_offset);
 static gboolean
-wslua_filehandler_seek_read(wtap *wth, gint64 seek_off,
-    struct wtap_pkthdr *phdr, Buffer *buf,
+wslua_filehandler_seek_read(wftap *wfth, gint64 seek_off,
+    void* header, Buffer *buf,
     int *err, gchar **err_info);
 static void
-wslua_filehandler_close(wtap *wth);
+wslua_filehandler_close(wftap *wfth);
 static void
-wslua_filehandler_sequential_close(wtap *wth);
+wslua_filehandler_sequential_close(wftap *wfth);
 
 
 /* This is our one-and-only open routine for file handling.  When called by
@@ -1642,9 +1654,9 @@ wslua_filehandler_sequential_close(wtap *wth);
  * field in the "struct wtap" to the type of the file.
  */
 static int
-wslua_filehandler_open(wtap *wth, int *err _U_, gchar **err_info)
+wslua_filehandler_open(wftap *wfth, int *err _U_, gchar **err_info)
 {
-    FileHandler fh = (FileHandler)(wth->wslua_data);
+    FileHandler fh = (FileHandler)(wfth->wslua_data);
     int retval = 0;
     lua_State* L = NULL;
     File *fp = NULL;
@@ -1652,10 +1664,10 @@ wslua_filehandler_open(wtap *wth, int *err _U_, gchar **err_info)
 
     INIT_FILEHANDLER_ROUTINE(read_open,0);
 
-    create_wth_priv(L, wth);
+    create_wth_priv(L, wfth);
 
-    fp = push_File(L, wth->fh);
-    fc = push_CaptureInfo(L, wth, TRUE);
+    fp = push_File(L, wfth->fh);
+    fc = push_CaptureInfo(L, wfth, TRUE);
 
     errno = WTAP_ERR_CANT_READ;
     switch ( lua_pcall(L,2,1,1) ) {
@@ -1674,32 +1686,32 @@ wslua_filehandler_open(wtap *wth, int *err _U_, gchar **err_info)
         /* this is our file type - set the routines and settings into wtap */
 
         if (fh->read_ref != LUA_NOREF) {
-            wth->subtype_read = wslua_filehandler_read;
+            wfth->subtype_read = wslua_filehandler_read;
         }
         else return 0;
 
         if (fh->seek_read_ref != LUA_NOREF) {
-            wth->subtype_seek_read = wslua_filehandler_seek_read;
+            wfth->subtype_seek_read = wslua_filehandler_seek_read;
         }
         else return 0;
 
         /* it's ok to not have a close routine */
         if (fh->read_close_ref != LUA_NOREF)
-            wth->subtype_close = wslua_filehandler_close;
+            wfth->subtype_close = wslua_filehandler_close;
         else
-            wth->subtype_close = NULL;
+            wfth->subtype_close = NULL;
 
         /* it's ok to not have a sequential close routine */
         if (fh->seq_read_close_ref != LUA_NOREF)
-            wth->subtype_sequential_close = wslua_filehandler_sequential_close;
+            wfth->subtype_sequential_close = wslua_filehandler_sequential_close;
         else
-            wth->subtype_sequential_close = NULL;
+            wfth->subtype_sequential_close = NULL;
 
-        wth->file_type_subtype = fh->file_type;
+        wfth->file_type_subtype = fh->file_type;
     }
     else {
         /* not our file type */
-        remove_wth_priv(L, wth);
+        remove_wth_priv(L, wfth);
     }
 
     lua_settop(L,0);
@@ -1713,15 +1725,16 @@ wslua_filehandler_open(wtap *wth, int *err _U_, gchar **err_info)
  * This will be the seek_off parameter when this frame is re-read.
 */
 static gboolean
-wslua_filehandler_read(wtap *wth, int *err, gchar **err_info,
+wslua_filehandler_read(wftap *wfth, int *err, gchar **err_info,
                       gint64 *data_offset)
 {
-    FileHandler fh = (FileHandler)(wth->wslua_data);
+    FileHandler fh = (FileHandler)(wfth->wslua_data);
     int retval = -1;
     lua_State* L = NULL;
     File *fp = NULL;
     CaptureInfo *fc = NULL;
     FrameInfo *fi = NULL;
+    wtap *wth = (wtap*)wfth->tap_specific_data;
 
     INIT_FILEHANDLER_ROUTINE(read,FALSE);
 
@@ -1730,9 +1743,9 @@ wslua_filehandler_read(wtap *wth, int *err, gchar **err_info,
 
     wth->phdr.opt_comment = NULL;
 
-    fp = push_File(L, wth->fh);
-    fc = push_CaptureInfo(L, wth, FALSE);
-    fi = push_FrameInfo(L, &wth->phdr, wth->frame_buffer);
+    fp = push_File(L, wfth->fh);
+    fc = push_CaptureInfo(L, wfth, FALSE);
+    fi = push_FrameInfo(L, &wth->phdr, wfth->frame_buffer);
 
     errno = WTAP_ERR_CANT_READ;
     switch ( lua_pcall(L,3,1,1) ) {
@@ -1761,16 +1774,17 @@ wslua_filehandler_read(wtap *wth, int *err, gchar **err_info,
  * success, FALSE on error.
  */
 static gboolean
-wslua_filehandler_seek_read(wtap *wth, gint64 seek_off,
-    struct wtap_pkthdr *phdr, Buffer *buf,
+wslua_filehandler_seek_read(wftap *wfth, gint64 seek_off,
+    void* header, Buffer *buf,
     int *err, gchar **err_info)
 {
-    FileHandler fh = (FileHandler)(wth->wslua_data);
+    FileHandler fh = (FileHandler)(wfth->wslua_data);
     int retval = -1;
     lua_State* L = NULL;
     File *fp = NULL;
     CaptureInfo *fc = NULL;
     FrameInfo *fi = NULL;
+    struct wtap_pkthdr *phdr = (struct wtap_pkthdr*)header;
 
     INIT_FILEHANDLER_ROUTINE(seek_read,FALSE);
 
@@ -1778,8 +1792,8 @@ wslua_filehandler_seek_read(wtap *wth, gint64 seek_off,
     *err = errno = 0;
     phdr->opt_comment = NULL;
 
-    fp = push_File(L, wth->random_fh);
-    fc = push_CaptureInfo(L, wth, FALSE);
+    fp = push_File(L, wfth->random_fh);
+    fc = push_CaptureInfo(L, wfth, FALSE);
     fi = push_FrameInfo(L, phdr, buf);
     lua_pushnumber(L, (lua_Number)seek_off);
 
@@ -1812,17 +1826,17 @@ wslua_filehandler_seek_read(wtap *wth, gint64 seek_off,
 /* Classic wtap close function, called by wtap core.
  */
 static void
-wslua_filehandler_close(wtap *wth)
+wslua_filehandler_close(wftap *wfth)
 {
-    FileHandler fh = (FileHandler)(wth->wslua_data);
+    FileHandler fh = (FileHandler)(wfth->wslua_data);
     lua_State* L = NULL;
     File *fp = NULL;
     CaptureInfo *fc = NULL;
 
     INIT_FILEHANDLER_ROUTINE(read_close,);
 
-    fp = push_File(L, wth->fh);
-    fc = push_CaptureInfo(L, wth, FALSE);
+    fp = push_File(L, wfth->fh);
+    fc = push_CaptureInfo(L, wfth, FALSE);
 
     switch ( lua_pcall(L,2,1,1) ) {
         case 0:
@@ -1832,7 +1846,7 @@ wslua_filehandler_close(wtap *wth)
 
     END_FILEHANDLER_ROUTINE();
 
-    remove_wth_priv(L, wth);
+    remove_wth_priv(L, wfth);
 
     (*fp)->expired = TRUE;
     (*fc)->expired = TRUE;
@@ -1844,17 +1858,17 @@ wslua_filehandler_close(wtap *wth)
 /* Classic wtap sequential close function, called by wtap core.
  */
 static void
-wslua_filehandler_sequential_close(wtap *wth)
+wslua_filehandler_sequential_close(wftap *wfth)
 {
-    FileHandler fh = (FileHandler)(wth->wslua_data);
+    FileHandler fh = (FileHandler)(wfth->wslua_data);
     lua_State* L = NULL;
     File *fp = NULL;
     CaptureInfo *fc = NULL;
 
     INIT_FILEHANDLER_ROUTINE(seq_read_close,);
 
-    fp = push_File(L, wth->fh);
-    fc = push_CaptureInfo(L, wth, FALSE);
+    fp = push_File(L, wfth->fh);
+    fc = push_CaptureInfo(L, wfth, FALSE);
 
     switch ( lua_pcall(L,2,1,1) ) {
         case 0:
@@ -1918,17 +1932,17 @@ wslua_filehandler_can_write_encap(int encap, void* data)
 
 /* some declarations */
 static gboolean
-wslua_filehandler_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
+wslua_filehandler_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
                       const guint8 *pd, int *err);
 static gboolean
-wslua_filehandler_dump_close(wtap_dumper *wdh, int *err);
+wslua_filehandler_dump_close(wftap_dumper *wdh, int *err);
 
 
 /* The classic wtap dump_open function.
  * This returns 1 (TRUE) on success.
  */
 static int
-wslua_filehandler_dump_open(wtap_dumper *wdh, int *err)
+wslua_filehandler_dump_open(wftap_dumper *wdh, int *err)
 {
     FileHandler fh = (FileHandler)(wdh->wslua_data);
     int retval = 0;
@@ -1987,7 +2001,7 @@ wslua_filehandler_dump_open(wtap_dumper *wdh, int *err)
  * else FALSE.
 */
 static gboolean
-wslua_filehandler_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
+wslua_filehandler_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
                       const guint8 *pd, int *err)
 {
     FileHandler fh = (FileHandler)(wdh->wslua_data);
@@ -2027,7 +2041,7 @@ wslua_filehandler_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
  * else FALSE.
 */
 static gboolean
-wslua_filehandler_dump_close(wtap_dumper *wdh, int *err)
+wslua_filehandler_dump_close(wftap_dumper *wdh, int *err)
 {
     FileHandler fh = (FileHandler)(wdh->wslua_data);
     int retval = -1;
diff --git a/file.c b/file.c
index 6f743961f3b62758d4665d9ef219dbb37c054c8f..d588dd96de7dc6d5738137095cabf94dfa8fbbc1 100644 (file)
--- a/file.c
+++ b/file.c
@@ -237,7 +237,7 @@ cf_timestamp_auto_precision(capture_file *cf)
      prec == TS_PREC_AUTO_USEC ||
      prec == TS_PREC_AUTO_NSEC)
   {
-    switch(wtap_file_tsprecision(cf->wth)) {
+    switch(wftap_file_tsprecision(cf->wfth)) {
     case(WTAP_FILE_TSPREC_SEC):
       timestamp_set_precision(TS_PREC_AUTO_SEC);
       break;
@@ -336,7 +336,7 @@ ws_epan_new(capture_file *cf)
 cf_status_t
 cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_tempfile, int *err)
 {
-  wtap  *wth;
+  wftap *wth;
   gchar *err_info;
 
   wth = wtap_open_offline(fname, type, err, &err_info, TRUE);
@@ -359,7 +359,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
   /* We're about to start reading the file. */
   cf->state = FILE_READ_IN_PROGRESS;
 
-  cf->wth = wth;
+  cf->wfth = wth;
   cf->f_datalen = 0;
 
   /* Set the file name because we need it to set the follow stream filter.
@@ -375,7 +375,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
 
   cf->computed_elapsed = 0;
 
-  cf->cd_t        = wtap_file_type_subtype(cf->wth);
+  cf->cd_t        = wftap_file_type_subtype(cf->wfth);
   cf->open_type   = type;
   cf->linktypes = g_array_sized_new(FALSE, FALSE, (guint) sizeof(int), 1);
   cf->count     = 0;
@@ -386,7 +386,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
   cf->ref_time_count = 0;
   cf->drops_known = FALSE;
   cf->drops     = 0;
-  cf->snap      = wtap_snapshot_length(cf->wth);
+  cf->snap      = wftap_snapshot_length(cf->wfth);
   if (cf->snap == 0) {
     /* Snapshot length not known. */
     cf->has_snap = FALSE;
@@ -414,8 +414,8 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
     ber_set_filename(cf->filename);
   }
 
-  wtap_set_cb_new_ipv4(cf->wth, add_ipv4_name);
-  wtap_set_cb_new_ipv6(cf->wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
+  wtap_set_cb_new_ipv4(cf->wfth, add_ipv4_name);
+  wtap_set_cb_new_ipv6(cf->wfth, (wtap_new_ipv6_callback_t) add_ipv6_name);
 
   return CF_OK;
 
@@ -456,9 +456,9 @@ cf_reset_state(capture_file *cf)
   /* Die if we're in the middle of reading a file. */
   g_assert(cf->state != FILE_READ_IN_PROGRESS);
 
-  if (cf->wth) {
-    wtap_close(cf->wth);
-    cf->wth = NULL;
+  if (cf->wfth) {
+    wtap_close(cf->wfth);
+    cf->wfth = NULL;
   }
   /* We have no file open... */
   if (cf->filename != NULL) {
@@ -549,12 +549,12 @@ calc_progbar_val(capture_file *cf, gint64 size, gint64 file_pos, gchar *status_s
     /*  The file probably grew while we were reading it.
      *  Update file size, and try again.
      */
-    size = wtap_file_size(cf->wth, NULL);
+    size = wftap_file_size(cf->wfth, NULL);
 
     if (size >= 0)
       progbar_val = (gfloat) file_pos / (gfloat) size;
 
-    /*  If it's still > 1, either "wtap_file_size()" failed (in which
+    /*  If it's still > 1, either "wftap_file_size()" failed (in which
      *  case there's not much we can do about it), or the file
      *  *shrank* (in which case there's not much we can do about
      *  it); just clip the progress value at 1.0.
@@ -608,7 +608,7 @@ cf_read(capture_file *cf, gboolean reloading)
 
   /* Record whether the file is compressed.
      XXX - do we know this at open time? */
-  cf->iscompressed = wtap_iscompressed(cf->wth);
+  cf->iscompressed = wftap_iscompressed(cf->wfth);
 
   /* The packet list window will be empty until the file is completly loaded */
   packet_list_freeze();
@@ -638,7 +638,7 @@ cf_read(capture_file *cf, gboolean reloading)
     cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
 
     /* Find the size of the file. */
-    size = wtap_file_size(cf->wth, NULL);
+    size = wftap_file_size(cf->wfth, NULL);
 
     /* Update the progress bar when it gets to this value. */
     progbar_nextstep = 0;
@@ -651,10 +651,10 @@ cf_read(capture_file *cf, gboolean reloading)
     }else
       progbar_quantum = 0;
 
-    while ((wtap_read(cf->wth, &err, &err_info, &data_offset))) {
+    while ((wtap_read(cf->wfth, &err, &err_info, &data_offset))) {
       if (size >= 0) {
         count++;
-        file_pos = wtap_read_so_far(cf->wth);
+        file_pos = wftap_read_so_far(cf->wfth);
 
         /* Create the progress bar if necessary.
          * Check whether it should be created or not every MIN_NUMBER_OF_PACKET
@@ -736,7 +736,7 @@ cf_read(capture_file *cf, gboolean reloading)
   cf->state = FILE_READ_DONE;
 
   /* Close the sequential I/O side, to free up memory it requires. */
-  wtap_sequential_close(cf->wth);
+  wftap_sequential_close(cf->wfth);
 
   /* Allow the protocol dissectors to free up memory that they
    * don't need after the sequential run-through of the packets. */
@@ -749,7 +749,7 @@ cf_read(capture_file *cf, gboolean reloading)
      we've looked at all the packets, as we don't know until then whether
      there's more than one type (and thus whether it's
      WTAP_ENCAP_PER_PACKET). */
-  cf->lnk_t = wtap_file_encap(cf->wth);
+  cf->lnk_t = wftap_file_encap(cf->wfth);
 
   cf->current_frame = frame_data_sequence_find(cf->frames, cf->first_displayed);
   cf->current_row = 0;
@@ -874,8 +874,8 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
     cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
 
     while (to_read != 0) {
-      wtap_cleareof(cf->wth);
-      if (!wtap_read(cf->wth, err, &err_info, &data_offset)) {
+      wftap_cleareof(cf->wfth);
+      if (!wtap_read(cf->wfth, err, &err_info, &data_offset)) {
         break;
       }
       if (cf->state == FILE_READ_ABORTED) {
@@ -907,7 +907,7 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
 
   /* Update the file encapsulation; it might have changed based on the
      packets we've read. */
-  cf->lnk_t = wtap_file_encap(cf->wth);
+  cf->lnk_t = wftap_file_encap(cf->wfth);
 
   /* Cleanup and release all dfilter resources */
   if (dfcode != NULL) {
@@ -981,7 +981,7 @@ cf_finish_tail(capture_file *cf, int *err)
   create_proto_tree =
     (dfcode != NULL || have_filtering_tap_listeners() || (tap_flags & TL_REQUIRES_PROTO_TREE));
 
-  if (cf->wth == NULL) {
+  if (cf->wfth == NULL) {
     cf_close(cf);
     return CF_READ_ERROR;
   }
@@ -992,7 +992,7 @@ cf_finish_tail(capture_file *cf, int *err)
 
   epan_dissect_init(&edt, cf->epan, create_proto_tree, FALSE);
 
-  while ((wtap_read(cf->wth, err, &err_info, &data_offset))) {
+  while ((wtap_read(cf->wfth, err, &err_info, &data_offset))) {
     if (cf->state == FILE_READ_ABORTED) {
       /* Well, the user decided to abort the read.  Break out of the
          loop, and let the code below (which is called even if there
@@ -1030,7 +1030,7 @@ cf_finish_tail(capture_file *cf, int *err)
 
   /* We're done reading sequentially through the file; close the
      sequential I/O side, to free up memory it requires. */
-  wtap_sequential_close(cf->wth);
+  wftap_sequential_close(cf->wfth);
 
   /* Allow the protocol dissectors to free up memory that they
    * don't need after the sequential run-through of the packets. */
@@ -1038,7 +1038,7 @@ cf_finish_tail(capture_file *cf, int *err)
 
   /* Update the file encapsulation; it might have changed based on the
      packets we've read. */
-  cf->lnk_t = wtap_file_encap(cf->wth);
+  cf->lnk_t = wftap_file_encap(cf->wfth);
 
   /* Update the details in the file-set dialog, as the capture file
    * has likely grown since we first stat-ed it */
@@ -1235,8 +1235,8 @@ static int
 read_packet(capture_file *cf, dfilter_t *dfcode, epan_dissect_t *edt,
             column_info *cinfo, gint64 offset)
 {
-  struct wtap_pkthdr *phdr = wtap_phdr(cf->wth);
-  const guint8 *buf = wtap_buf_ptr(cf->wth);
+  struct wtap_pkthdr *phdr = wtap_phdr(cf->wfth);
+  const guint8 *buf = wftap_buf_ptr(cf->wfth);
   frame_data    fdlocal;
   guint32       framenum;
   frame_data   *fdata;
@@ -1294,7 +1294,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
   char            *out_filename;
   char            *tmpname;
   int              out_fd;
-  wtap_dumper     *pdh;
+  wftap_dumper    *pdh;
   int              open_err, read_err, write_err, close_err;
   gchar           *err_info;
   int              err_fileno;
@@ -1361,7 +1361,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
 
     fake_interface_ids = TRUE;
     /* Create SHB info */
-    shb_hdr      = wtap_file_get_shb_info(in_files[0].wth);
+    shb_hdr      = wtap_file_get_shb_info(in_files[0].wfth);
     comment_gstr = g_string_new("");
     g_string_append_printf(comment_gstr, "%s \n",shb_hdr->opt_comment);
     g_string_append_printf(comment_gstr, "File created by merging: \n");
@@ -1388,7 +1388,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
     idb_inf->interface_data = g_array_new(FALSE, FALSE, sizeof(wtapng_if_descr_t));
 
     for (i = 0; i < in_file_count; i++) {
-      idb_inf_merge_file               = wtap_file_get_idb_info(in_files[i].wth);
+      idb_inf_merge_file               = wtap_file_get_idb_info(in_files[i].wfth);
       /* read the interface data from the in file to our combined interfca data */
       file_int_data = &g_array_index (idb_inf_merge_file->interface_data, wtapng_if_descr_t, 0);
       int_data.wtap_encap            = file_int_data->wtap_encap;
@@ -1504,7 +1504,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
         /* Get the sum of the seek positions in all of the files. */
         file_pos = 0;
         for (i = 0; i < in_file_count; i++)
-          file_pos += wtap_read_so_far(in_files[i].wth);
+          file_pos += wftap_read_so_far(in_files[i].wfth);
         progbar_val = (gfloat) file_pos / (gfloat) f_len;
         if (progbar_val > 1.0f) {
           /* Some file probably grew while we were reading it.
@@ -1534,12 +1534,12 @@ cf_merge_files(char **out_filenamep, int in_file_count,
     if (fake_interface_ids) {
       struct wtap_pkthdr *phdr;
 
-      phdr = wtap_phdr(in_file->wth);
+      phdr = wtap_phdr(in_file->wfth);
       phdr->interface_id = in_file->interface_id;
       phdr->presence_flags = phdr->presence_flags | WTAP_HAS_INTERFACE_ID;
     }
-    if (!wtap_dump(pdh, wtap_phdr(in_file->wth),
-                   wtap_buf_ptr(in_file->wth), &write_err)) {
+    if (!wtap_dump(pdh, wtap_phdr(in_file->wfth),
+                   wftap_buf_ptr(in_file->wfth), &write_err)) {
       got_write_error = TRUE;
       break;
     }
@@ -1551,7 +1551,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
 
   merge_close_in_files(in_file_count, in_files);
   if (!got_write_error) {
-    if (!wtap_dump_close(pdh, &write_err))
+    if (!wftap_dump_close(pdh, &write_err))
       got_write_error = TRUE;
   } else {
     /*
@@ -1560,7 +1560,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
      *
      * Don't overwrite the earlier write error.
      */
-    (void)wtap_dump_close(pdh, &close_err);
+    (void)wftap_dump_close(pdh, &close_err);
   }
 
   if (got_read_error) {
@@ -1778,7 +1778,7 @@ cf_read_frame_r(capture_file *cf, const frame_data *fdata,
   }
 #endif
 
-  if (!wtap_seek_read(cf->wth, fdata->file_off, phdr, buf, &err, &err_info)) {
+  if (!wftap_seek_read(cf->wfth, fdata->file_off, phdr, buf, &err, &err_info)) {
     display_basename = g_filename_display_basename(cf->filename);
     switch (err) {
 
@@ -1809,7 +1809,7 @@ cf_read_frame_r(capture_file *cf, const frame_data *fdata,
 gboolean
 cf_read_frame(capture_file *cf, frame_data *fdata)
 {
-  return cf_read_frame_r(cf, fdata, &cf->phdr, &cf->buf);
+  return cf_read_frame_r(cf, fdata, &cf->hdr.wtap_hdr, &cf->buf);
 }
 
 /* Rescan the list of packets, reconstructing the CList.
@@ -2017,7 +2017,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
     }
 
     add_packet_to_packet_list(fdata, cf, &edt, dfcode,
-                                    cinfo, &cf->phdr,
+                                    cinfo, &cf->hdr.wtap_hdr,
                                     buffer_start_ptr(&cf->buf),
                                     add_to_packet_list);
 
@@ -3117,7 +3117,7 @@ match_protocol_tree(capture_file *cf, frame_data *fdata, void *criterion)
   /* Construct the protocol tree, including the displayed text */
   epan_dissect_init(&edt, cf->epan, TRUE, TRUE);
   /* We don't need the column information */
-  epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+  epan_dissect_run(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
 
   /* Iterate through all the nodes, seeing if they have text that matches. */
   mdata->cf = cf;
@@ -3221,7 +3221,7 @@ match_summary_line(capture_file *cf, frame_data *fdata, void *criterion)
   /* Don't bother constructing the protocol tree */
   epan_dissect_init(&edt, cf->epan, FALSE, FALSE);
   /* Get the column information */
-  epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata,
+  epan_dissect_run(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata,
                    &cf->cinfo);
 
   /* Find the Info column */
@@ -3529,7 +3529,7 @@ match_dfilter(capture_file *cf, frame_data *fdata, void *criterion)
 
   epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
   epan_dissect_prime_dfilter(&edt, sfcode);
-  epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+  epan_dissect_run(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
   result = dfilter_apply_edt(sfcode, &edt) ? MR_MATCHED : MR_NOTMATCHED;
   epan_dissect_cleanup(&edt);
   return result;
@@ -3862,7 +3862,7 @@ cf_select_packet(capture_file *cf, int row)
   cf->edt = epan_dissect_new(cf->epan, TRUE, TRUE);
 
   tap_build_interesting(cf->edt);
-  epan_dissect_run(cf->edt, &cf->phdr, frame_tvbuff_new_buffer(cf->current_frame, &cf->buf),
+  epan_dissect_run(cf->edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(cf->current_frame, &cf->buf),
                    cf->current_frame, NULL);
 
   dfilter_macro_build_ftv_cache(cf->edt->tree);
@@ -3968,7 +3968,7 @@ cf_read_shb_comment(capture_file *cf)
   const gchar      *temp_str;
 
   /* Get info from SHB */
-  shb_inf = wtap_file_get_shb_info(cf->wth);
+  shb_inf = wtap_file_get_shb_info(cf->wfth);
   if (shb_inf == NULL)
         return NULL;
   temp_str = shb_inf->opt_comment;
@@ -3984,7 +3984,7 @@ cf_update_capture_comment(capture_file *cf, gchar *comment)
   wtapng_section_t *shb_inf;
 
   /* Get info from SHB */
-  shb_inf = wtap_file_get_shb_info(cf->wth);
+  shb_inf = wtap_file_get_shb_info(cf->wfth);
 
   /* See if the comment has changed or not */
   if (shb_inf && shb_inf->opt_comment) {
@@ -3998,7 +3998,7 @@ cf_update_capture_comment(capture_file *cf, gchar *comment)
   g_free(shb_inf);
 
   /* The comment has changed, let's update it */
-  wtap_write_shb_comment(cf->wth, comment);
+  wtap_write_shb_comment(cf->wfth, comment);
   /* Mark the file as having unsaved changes */
   cf->unsaved_changes = TRUE;
 }
@@ -4097,9 +4097,9 @@ cf_comment_types(capture_file *cf)
 }
 
 typedef struct {
-  wtap_dumper *pdh;
-  const char  *fname;
-  int          file_type;
+  wftap_dumper *pdh;
+  const char   *fname;
+  int           file_type;
 } save_callback_args_t;
 
 /*
@@ -4341,7 +4341,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
 #endif
 
   /* Close the old handle. */
-  wtap_close(cf->wth);
+  wtap_close(cf->wfth);
 
   /* Open the new file. */
   /* XXX: this will go through all open_routines for a matching one. But right
@@ -4349,8 +4349,8 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
      format than the original, and the user is not given a choice of which
      reader to use (only which format to save it in), so doing this makes
      sense for now. */
-  cf->wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, err, &err_info, TRUE);
-  if (cf->wth == NULL) {
+  cf->wfth = wtap_open_offline(fname, WTAP_TYPE_AUTO, err, &err_info, TRUE);
+  if (cf->wfth == NULL) {
     cf_open_failure_alert_box(fname, *err, err_info, FALSE, 0);
     return CF_READ_ERROR;
   }
@@ -4370,10 +4370,10 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
   /* No user changes yet. */
   cf->unsaved_changes = FALSE;
 
-  cf->cd_t        = wtap_file_type_subtype(cf->wth);
+  cf->cd_t        = wftap_file_type_subtype(cf->wfth);
   cf->linktypes = g_array_sized_new(FALSE, FALSE, (guint) sizeof(int), 1);
 
-  cf->snap      = wtap_snapshot_length(cf->wth);
+  cf->snap      = wftap_snapshot_length(cf->wfth);
   if (cf->snap == 0) {
     /* Snapshot length not known. */
     cf->has_snap = FALSE;
@@ -4387,10 +4387,10 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
 
   /* Record whether the file is compressed.
      XXX - do we know this at open time? */
-  cf->iscompressed = wtap_iscompressed(cf->wth);
+  cf->iscompressed = wftap_iscompressed(cf->wfth);
 
   /* Find the size of the file. */
-  size = wtap_file_size(cf->wth, NULL);
+  size = wftap_file_size(cf->wfth, NULL);
 
   /* Update the progress bar when it gets to this value. */
   progbar_nextstep = 0;
@@ -4407,14 +4407,14 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
   g_get_current_time(&start_time);
 
   framenum = 0;
-  phdr = wtap_phdr(cf->wth);
-  while ((wtap_read(cf->wth, err, &err_info, &data_offset))) {
+  phdr = wtap_phdr(cf->wfth);
+  while ((wtap_read(cf->wfth, err, &err_info, &data_offset))) {
     framenum++;
     fdata = frame_data_sequence_find(cf->frames, framenum);
     fdata->file_off = data_offset;
     if (size >= 0) {
       count++;
-      file_pos = wtap_read_so_far(cf->wth);
+      file_pos = wftap_read_so_far(cf->wfth);
 
       /* Create the progress bar if necessary.
        * Check whether it should be created or not every MIN_NUMBER_OF_PACKET
@@ -4475,7 +4475,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
   cf->state = FILE_READ_DONE;
 
   /* Close the sequential I/O side, to free up memory it requires. */
-  wtap_sequential_close(cf->wth);
+  wftap_sequential_close(cf->wfth);
 
   /* compute the time it took to load the file */
   compute_elapsed(cf, &start_time);
@@ -4484,7 +4484,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
      we've looked at all the packets, as we don't know until then whether
      there's more than one type (and thus whether it's
      WTAP_ENCAP_PER_PACKET). */
-  cf->lnk_t = wtap_file_encap(cf->wth);
+  cf->lnk_t = wftap_file_encap(cf->wfth);
 
   cf_callback_invoke(cf_cb_file_rescan_finished, cf);
 
@@ -4557,7 +4557,7 @@ cf_save_packets(capture_file *cf, const char *fname, guint save_format,
 {
   gchar           *err_info;
   gchar           *fname_new = NULL;
-  wtap_dumper     *pdh;
+  wftap_dumper    *pdh;
   frame_data      *fdata;
   addrinfo_lists_t *addr_lists;
   guint            framenum;
@@ -4662,8 +4662,8 @@ cf_save_packets(capture_file *cf, const char *fname, guint save_format,
     wtapng_iface_descriptions_t *idb_inf = NULL;
     int encap;
 
-    shb_hdr = wtap_file_get_shb_info(cf->wth);
-    idb_inf = wtap_file_get_idb_info(cf->wth);
+    shb_hdr = wtap_file_get_shb_info(cf->wfth);
+    idb_inf = wtap_file_get_idb_info(cf->wfth);
 
     /* Determine what file encapsulation type we should use. */
     encap = wtap_dump_file_encap_type(cf->linktypes);
@@ -4710,7 +4710,7 @@ cf_save_packets(capture_file *cf, const char *fname, guint save_format,
          If we're writing to a temporary file, remove it.
          XXX - should we do so even if we're not writing to a
          temporary file? */
-      wtap_dump_close(pdh, &err);
+      wftap_dump_close(pdh, &err);
       if (fname_new != NULL)
         ws_unlink(fname_new);
       cf_callback_invoke(cf_cb_file_save_stopped, NULL);
@@ -4721,11 +4721,11 @@ cf_save_packets(capture_file *cf, const char *fname, guint save_format,
          If we're writing to a temporary file, remove it. */
       if (fname_new != NULL)
         ws_unlink(fname_new);
-      wtap_dump_close(pdh, &err);
+      wftap_dump_close(pdh, &err);
       goto fail;
     }
 
-    if (!wtap_dump_close(pdh, &err)) {
+    if (!wftap_dump_close(pdh, &err)) {
       cf_close_failure_alert_box(fname, err);
       goto fail;
     }
@@ -4739,7 +4739,7 @@ cf_save_packets(capture_file *cf, const char *fname, guint save_format,
        on Windows.  However, on Windows, we first need to close whatever
        file descriptors we have open for fname. */
 #ifdef _WIN32
-    wtap_fdclose(cf->wth);
+    wftap_fdclose(cf->wfth);
 #endif
     /* Now do the rename. */
     if (ws_rename(fname_new, fname) == -1) {
@@ -4749,7 +4749,7 @@ cf_save_packets(capture_file *cf, const char *fname, guint save_format,
       /* Attempt to reopen the random file descriptor using the
          current file's filename.  (At this point, the sequential
          file descriptor is closed.) */
-      if (!wtap_fdreopen(cf->wth, cf->filename, &err)) {
+      if (!wftap_fdreopen(cf->wfth, cf->filename, &err)) {
         /* Oh, well, we're screwed. */
         display_basename = g_filename_display_basename(cf->filename);
         simple_error_message_box(
@@ -4782,13 +4782,13 @@ cf_save_packets(capture_file *cf, const char *fname, guint save_format,
       /* We just copied the file, s all the information other than
          the wtap structure, the filename, and the "is temporary"
          status applies to the new file; just update that. */
-      wtap_close(cf->wth);
+      wtap_close(cf->wfth);
       /* Although we're just "copying" and then opening the copy, it will
          try all open_routine readers to open the copy, so we need to
          reset the cfile's open_type. */
       cf->open_type = WTAP_TYPE_AUTO;
-      cf->wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
-      if (cf->wth == NULL) {
+      cf->wfth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
+      if (cf->wfth == NULL) {
         cf_open_failure_alert_box(fname, err, err_info, FALSE, 0);
         cf_close(cf);
       } else {
@@ -4834,7 +4834,7 @@ cf_save_packets(capture_file *cf, const char *fname, guint save_format,
     /* If we were told to discard the comments, do so. */
     if (discard_comments) {
       /* Remove SHB comment, if any. */
-      wtap_write_shb_comment(cf->wth, NULL);
+      wtap_write_shb_comment(cf->wfth, NULL);
 
       /* remove all user comments */
       for (framenum = 1; framenum <= cf->count; framenum++) {
@@ -4876,7 +4876,7 @@ cf_export_specified_packets(capture_file *cf, const char *fname,
 {
   gchar                       *fname_new = NULL;
   int                          err;
-  wtap_dumper                 *pdh;
+  wftap_dumper                *pdh;
   save_callback_args_t         callback_args;
   wtapng_section_t            *shb_hdr;
   wtapng_iface_descriptions_t *idb_inf;
@@ -4891,8 +4891,8 @@ cf_export_specified_packets(capture_file *cf, const char *fname,
      written, don't special-case the operation - read each packet
      and then write it out if it's one of the specified ones. */
 
-  shb_hdr = wtap_file_get_shb_info(cf->wth);
-  idb_inf = wtap_file_get_idb_info(cf->wth);
+  shb_hdr = wtap_file_get_shb_info(cf->wfth);
+  idb_inf = wtap_file_get_idb_info(cf->wfth);
 
   /* Determine what file encapsulation type we should use. */
   encap = wtap_dump_file_encap_type(cf->linktypes);
@@ -4945,7 +4945,7 @@ cf_export_specified_packets(capture_file *cf, const char *fname,
          If we're writing to a temporary file, remove it.
          XXX - should we do so even if we're not writing to a
          temporary file? */
-      wtap_dump_close(pdh, &err);
+      wftap_dump_close(pdh, &err);
       if (fname_new != NULL)
         ws_unlink(fname_new);
       cf_callback_invoke(cf_cb_file_export_specified_packets_stopped, NULL);
@@ -4957,11 +4957,11 @@ cf_export_specified_packets(capture_file *cf, const char *fname,
        If we're writing to a temporary file, remove it. */
     if (fname_new != NULL)
       ws_unlink(fname_new);
-    wtap_dump_close(pdh, &err);
+    wftap_dump_close(pdh, &err);
     goto fail;
   }
 
-  if (!wtap_dump_close(pdh, &err)) {
+  if (!wftap_dump_close(pdh, &err)) {
     cf_close_failure_alert_box(fname, err);
     goto fail;
   }
index e82905f84075be8ee5ad664679f64aca7ce8d26a..90bc06bfee9afcc10ecdf7362f1b0a63e2bc1894 100644 (file)
@@ -538,7 +538,7 @@ ftap* ftap_open_offline(const char *filename, int *err, char **err_info,
        if (use_stdin) {
                /*
                 * We dup FD 0, so that we don't have to worry about
-                * a file_close of wth->fh closing the standard
+                * a file_close of wfth->fh closing the standard
                 * input of the process.
                 */
                fd = ws_dup(0);
index 0a8c6fa66fafac7de48e4d2573f69667252c3b9f..ef35611b8426fe6b59a4fd5ae64affd1883228b6 100644 (file)
@@ -378,7 +378,7 @@ ftap_read(ftap *fth, int *err, gchar **err_info, gint64 *data_offset)
         * *is* FTAP_ENCAP_PER_RECORD, the caller needs to set it
         * anyway.
         */
-       wth->phdr.pkt_encap = wth->file_encap;
+       wth->phdr.pkt_encap = wfth->file_encap;
 #endif
 
        if (!fth->subtype_read(fth, err, err_info, data_offset)) {
@@ -460,12 +460,6 @@ wtap_phdr(wtap *wth)
 {
        return &wth->phdr;
 }
-
-guint8 *
-wtap_buf_ptr(wtap *wth)
-{
-       return buffer_start_ptr(wth->frame_buffer);
-}
 #endif
 
 gboolean
index b47d206f07bbc4426421d13f02707d9f85acc857..2358af2a7eebe4bd6c4a318da6603e0e25f362ed 100644 (file)
 #include "frame_tvbuff.h"
 #include "globals.h"
 
-#include "wtap-int.h" /* for ->random_fh */
+#include "wftap-int.h" /* for ->random_fh */
 
 struct tvb_frame {
        struct tvbuff tvb;
 
        Buffer *buf;         /* Packet data */
 
-       wtap *wth;           /**< Wiretap session */
+       wftap *wth;          /**< Wiretap session */
        gint64 file_off;     /**< File offset */
 
        guint offset;
@@ -51,13 +51,13 @@ frame_read(struct tvb_frame *frame_tvb, struct wtap_pkthdr *phdr, Buffer *buf)
        gchar *err_info;
 
        /* sanity check, capture file was closed? */
-       if (cfile.wth != frame_tvb->wth)
+       if (cfile.wfth != frame_tvb->wth)
                return FALSE;
 
        /* XXX, what if phdr->caplen isn't equal to
         * frame_tvb->tvb.length + frame_tvb->offset?
         */
-       if (!wtap_seek_read(frame_tvb->wth, frame_tvb->file_off, phdr, buf, &err, &err_info)) {
+       if (!wftap_seek_read(frame_tvb->wth, frame_tvb->file_off, phdr, buf, &err, &err_info)) {
                switch (err) {
                        case WTAP_ERR_UNSUPPORTED_ENCAP:
                        case WTAP_ERR_BAD_FILE:
@@ -212,12 +212,12 @@ frame_tvbuff_new(const frame_data *fd, const guint8 *buf)
        frame_tvb = (struct tvb_frame *) tvb;
 
        /* XXX, wtap_can_seek() */
-       if (cfile.wth && cfile.wth->random_fh
+       if (cfile.wfth && cfile.wfth->random_fh
 #ifdef WANT_PACKET_EDITOR
                && fd->file_off != -1 /* generic clone for modified packets */
 #endif
        ) {
-               frame_tvb->wth = cfile.wth;
+               frame_tvb->wth = cfile.wfth;
                frame_tvb->file_off = fd->file_off;
                frame_tvb->offset = 0;
        } else
@@ -317,12 +317,12 @@ file_tvbuff_new(const frame_data *fd, const guint8 *buf)
        frame_tvb = (struct tvb_frame *) tvb;
 
        /* XXX, wtap_can_seek() */
-       if (cfile.wth && cfile.wth->random_fh
+       if (cfile.wfth && cfile.wfth->random_fh
 #ifdef WANT_PACKET_EDITOR
                && fd->file_off != -1 /* generic clone for modified packets */
 #endif
        ) {
-               frame_tvb->wth = cfile.wth;
+               frame_tvb->wth = cfile.wfth;
                frame_tvb->file_off = fd->file_off;
                frame_tvb->offset = 0;
        } else
index a9c1ef9e08b4d37d31be282aa71c049ba93a5cd9..14ecca8e2272db53da1f64d918f746b52b3db1a2 100644 (file)
@@ -225,7 +225,7 @@ main(int argc, char *argv[])
   merge_in_file_t    *in_files           = NULL, *in_file;
   int                 i;
   struct wtap_pkthdr *phdr, snap_phdr;
-  wtap_dumper        *pdh;
+  wftap_dumper       *pdh;
   int                 open_err, read_err = 0, write_err, close_err;
   gchar              *err_info;
   int                 err_fileno;
@@ -333,7 +333,7 @@ main(int argc, char *argv[])
   if (verbose) {
     for (i = 0; i < in_file_count; i++)
       fprintf(stderr, "mergecap: %s is type %s.\n", argv[optind + i],
-              wtap_file_type_subtype_string(wtap_file_type_subtype(in_files[i].wth)));
+              wtap_file_type_subtype_string(wftap_file_type_subtype(in_files[i].wfth)));
   }
 
   if (snaplen == 0) {
@@ -357,9 +357,9 @@ main(int argc, char *argv[])
          */
         int first_frame_type, this_frame_type;
 
-        first_frame_type = wtap_file_encap(in_files[0].wth);
+        first_frame_type = wftap_file_encap(in_files[0].wfth);
         for (i = 1; i < in_file_count; i++) {
-          this_frame_type = wtap_file_encap(in_files[i].wth);
+          this_frame_type = wftap_file_encap(in_files[i].wfth);
           if (first_frame_type != this_frame_type) {
             fprintf(stderr, "mergecap: multiple frame encapsulation types detected\n");
             fprintf(stderr, "          defaulting to WTAP_ENCAP_PER_PACKET\n");
@@ -452,14 +452,14 @@ main(int argc, char *argv[])
 
     /* We simply write it, perhaps after truncating it; we could do other
      * things, like modify it. */
-    phdr = wtap_phdr(in_file->wth);
+    phdr = wtap_phdr(in_file->wfth);
     if (snaplen != 0 && phdr->caplen > snaplen) {
       snap_phdr = *phdr;
       snap_phdr.caplen = snaplen;
       phdr = &snap_phdr;
     }
 
-    if (!wtap_dump(pdh, phdr, wtap_buf_ptr(in_file->wth), &write_err)) {
+    if (!wtap_dump(pdh, phdr, wftap_buf_ptr(in_file->wfth), &write_err)) {
       got_write_error = TRUE;
       break;
     }
@@ -467,7 +467,7 @@ main(int argc, char *argv[])
 
   merge_close_in_files(in_file_count, in_files);
   if (!got_write_error) {
-    if (!wtap_dump_close(pdh, &write_err))
+    if (!wftap_dump_close(pdh, &write_err))
       got_write_error = TRUE;
   } else {
     /*
@@ -476,7 +476,7 @@ main(int argc, char *argv[])
      *
      * Don't overwrite the earlier write error.
      */
-    (void)wtap_dump_close(pdh, &close_err);
+    (void)wftap_dump_close(pdh, &close_err);
   }
 
   if (got_read_error) {
index 67cb821e48ec86247ac5c07f262b30989d1cbfaa..abd1c568593155767bbfa2e86369f2d3517d6103 100644 (file)
--- a/randpkt.c
+++ b/randpkt.c
@@ -494,7 +494,7 @@ int
 main(int argc, char **argv)
 {
 
-       wtap_dumper             *dump;
+       wftap_dumper            *dump;
        struct wtap_pkthdr      pkthdr;
        union wtap_pseudo_header *ps_header = &pkthdr.pseudo_header;
        int                     i, j, len_this_pkt, len_random, err;
@@ -620,7 +620,7 @@ main(int argc, char **argv)
                wtap_dump(dump, &pkthdr, &buffer[0], &err);
        }
 
-       wtap_dump_close(dump, &err);
+       wftap_dump_close(dump, &err);
 
        return 0;
 
index 54fc338f106ac247f39039b805a17f638f657055..a679caee16fe27b5671c021beb28bb98b58762e3 100644 (file)
@@ -867,7 +867,7 @@ main(int argc, char *argv[])
         /* Set timestamp precision; there should arguably be a command-line
            option to let the user set this. */
 #if 0
-        switch(wtap_file_tsprecision(cfile.wth)) {
+        switch(wftap_file_tsprecision(cfile.wth)) {
             case(WTAP_FILE_TSPREC_SEC):
                 timestamp_set_precision(TS_PREC_AUTO_SEC);
                 break;
@@ -1665,7 +1665,7 @@ raw_cf_open(capture_file *cf, const char *fname)
     epan_free(cf->epan);
     cf->epan = raw_epan_new(cf);
 
-    cf->wth = NULL;
+    cf->wfth = NULL;
     cf->f_datalen = 0; /* not used, but set it anyway */
 
     /* Set the file name because we need it to set the follow stream filter.
index 4b363b84b149b7329d0c47c86e956514ba9a279e..09b5df1f8fc7f2ab5d1e9defea154811e24fd5ed 100644 (file)
@@ -89,7 +89,7 @@ typedef struct FrameRecord_t {
 
 
 static void
-frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh, Buffer *buf,
+frame_write(FrameRecord_t *frame, wftap *wth, wftap_dumper *pdh, Buffer *buf,
             const char *infile)
 {
     int    err;
@@ -103,7 +103,7 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh, Buffer *buf,
 
 
     /* Re-read the first frame from the stored location */
-    if (!wtap_seek_read(wth, frame->offset, &phdr, buf, &err, &err_info)) {
+    if (!wftap_seek_read(wth, frame->offset, &phdr, buf, &err, &err_info)) {
         if (err != 0) {
             /* Print a message noting that the read failed somewhere along the line. */
             fprintf(stderr,
@@ -174,8 +174,8 @@ frames_compare(gconstpointer a, gconstpointer b)
 /********************************************************************/
 int main(int argc, char *argv[])
 {
-    wtap *wth = NULL;
-    wtap_dumper *pdh = NULL;
+    wftap *wth = NULL;
+    wftap_dumper *pdh = NULL;
     Buffer buf;
     int err;
     gchar *err_info;
@@ -241,13 +241,13 @@ int main(int argc, char *argv[])
         }
         exit(1);
     }
-    DEBUG_PRINT("file_type_subtype is %u\n", wtap_file_type_subtype(wth));
+    DEBUG_PRINT("file_type_subtype is %u\n", wftap_file_type_subtype(wth));
 
     shb_hdr = wtap_file_get_shb_info(wth);
     idb_inf = wtap_file_get_idb_info(wth);
 
     /* Open outfile (same filetype/encap as input file) */
-    pdh = wtap_dump_open_ng(outfile, wtap_file_type_subtype(wth), wtap_file_encap(wth),
+    pdh = wtap_dump_open_ng(outfile, wftap_file_type_subtype(wth), wftap_file_encap(wth),
                             65535, FALSE, shb_hdr, idb_inf, &err);
     g_free(idb_inf);
     if (pdh == NULL) {
@@ -322,7 +322,7 @@ int main(int argc, char *argv[])
     g_ptr_array_free(frames, TRUE);
 
     /* Close outfile */
-    if (!wtap_dump_close(pdh, &err)) {
+    if (!wftap_dump_close(pdh, &err)) {
         fprintf(stderr, "reordercap: Error closing %s: %s\n", outfile,
                 wtap_strerror(err));
         g_free(shb_hdr);
@@ -331,7 +331,7 @@ int main(int argc, char *argv[])
     g_free(shb_hdr);
 
     /* Finally, close infile */
-    wtap_fdclose(wth);
+    wftap_fdclose(wth);
 
     return 0;
 }
index dee1808f5b171dd91fca687409ecee7ae4a71637..67c63ef4aa365a2598867b60e300a012d02b92ba 100644 (file)
--- a/summary.c
+++ b/summary.c
@@ -156,7 +156,7 @@ summary_fill_in(capture_file *cf, summary_tally *st)
   st->dfilter = cf->dfilter;
 
   /* Get info from SHB */
-  shb_inf = wtap_file_get_shb_info(cf->wth);
+  shb_inf = wtap_file_get_shb_info(cf->wfth);
   if(shb_inf == NULL){
     st->opt_comment    = NULL;
     st->shb_hardware   = NULL;
@@ -171,7 +171,7 @@ summary_fill_in(capture_file *cf, summary_tally *st)
   }
 
   st->ifaces  = g_array_new(FALSE, FALSE, sizeof(iface_options));
-  idb_info = wtap_file_get_idb_info(cf->wth);
+  idb_info = wtap_file_get_idb_info(cf->wfth);
   for (i = 0; i < idb_info->number_of_interfaces; i++) {
     wtapng_if_descr = g_array_index(idb_info->interface_data, wtapng_if_descr_t, i);
     iface.cfilter = g_strdup(wtapng_if_descr.if_filter_str);
index e62350400f8a59d592f60bca267811d919040f98..cd4e3d9f45b5018d1fd74406a1b24353684c54fa 100644 (file)
--- a/tfshark.c
+++ b/tfshark.c
@@ -89,6 +89,7 @@
 #include <epan/timestamp.h>
 #include <epan/ex-opt.h>
 #include <filetap/ftap.h>
+#include <wiretap/wftap-int.h>
 #include <wiretap/wtap-int.h>
 #include <wiretap/file_wrappers.h>
 
@@ -166,28 +167,6 @@ static void write_failure_message(const char *filename, int err);
 
 capture_file cfile;
 
-#if 0
-struct string_elem {
-  const char *sstr;   /* The short string */
-  const char *lstr;   /* The long string */
-};
-
-static gint
-string_compare(gconstpointer a, gconstpointer b)
-{
-  return strcmp(((const struct string_elem *)a)->sstr,
-                ((const struct string_elem *)b)->sstr);
-}
-
-static void
-string_elem_print(gpointer data, gpointer not_used _U_)
-{
-  fprintf(stderr, "    %s - %s\n",
-          ((struct string_elem *)data)->sstr,
-          ((struct string_elem *)data)->lstr);
-}
-#endif
-
 static void
 print_usage(gboolean print_ver)
 {
@@ -1145,7 +1124,7 @@ main(int argc, char *argv[])
       rfilter = optarg;
       break;
     case 'S':        /* Set the line Separator to be printed between packets */
-      separator = strdup(optarg);
+      separator = g_strdup(optarg);
       break;
     case 't':        /* Time stamp type */
       if (strcmp(optarg, "r") == 0)
@@ -1504,7 +1483,7 @@ tfshark_get_frame_ts(void *data, guint32 frame_num)
 static const char *
 no_interface_name(void *data _U_, guint32 interface_id _U_)
 {
-    return "";
+    return NULL;
 }
 
 static epan_t *
@@ -1688,13 +1667,13 @@ gboolean
 local_wtap_read(capture_file *cf, struct wtap_pkthdr* file_phdr, int *err, gchar **err_info, gint64 *data_offset _U_, guint8** data_buffer)
 {
     int bytes_read;
-    gint64 packet_size = wtap_file_size(cf->wth, err);
+    gint64 packet_size = wftap_file_size(cf->wfth, err);
 
     *data_buffer = (guint8*)g_malloc((gsize)packet_size);
-    bytes_read = file_read(*data_buffer, (unsigned int)packet_size, cf->wth->fh);
+    bytes_read = file_read(*data_buffer, (unsigned int)packet_size, cf->wfth->fh);
 
     if (bytes_read < 0) {
-        *err = file_error(cf->wth->fh, err_info);
+        *err = file_error(cf->wfth->fh, err_info);
         if (*err == 0)
             *err = FTAP_ERR_SHORT_READ;
         return FALSE;
@@ -1717,9 +1696,9 @@ local_wtap_read(capture_file *cf, struct wtap_pkthdr* file_phdr, int *err, gchar
      * *is* WTAP_ENCAP_PER_PACKET, the caller needs to set it
      * anyway.
      */
-    wth->phdr.pkt_encap = wth->file_encap;
+    wth->phdr.pkt_encap = wfth->file_encap;
 
-    if (!wth->subtype_read(wth, err, err_info, data_offset)) {
+    if (!wfth->subtype_read(wth, err, err_info, data_offset)) {
         /*
          * If we didn't get an error indication, we read
          * the last packet.  See if there's any deferred
@@ -1730,7 +1709,7 @@ local_wtap_read(capture_file *cf, struct wtap_pkthdr* file_phdr, int *err, gchar
          * last packet of the file.
          */
         if (*err == 0)
-            *err = file_error(wth->fh, err_info);
+            *err = file_error(wfth->fh, err_info);
         return FALSE;    /* failure */
     }
 
@@ -1805,8 +1784,8 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
       edt = epan_dissect_new(cf->epan, create_proto_tree, FALSE);
     }
     while (local_wtap_read(cf, &file_phdr, &err, &err_info, &data_offset, &raw_data)) {
-      if (process_packet_first_pass(cf, edt, data_offset, &file_phdr/*wtap_phdr(cf->wth)*/,
-                         wtap_buf_ptr(cf->wth))) {
+      if (process_packet_first_pass(cf, edt, data_offset, &file_phdr/*wtap_phdr(cf->wfth)*/,
+                         wftap_buf_ptr(cf->wfth))) {
 
         /* Stop reading if we have the maximum number of packets;
          * When the -c option has not been used, max_packet_count
@@ -1827,7 +1806,7 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
 
 #if 0
     /* Close the sequential I/O side, to free up memory it requires. */
-    wtap_sequential_close(cf->wth);
+    wtap_sequential_close(cf->wfth);
 #endif
 
     /* Allow the protocol dissectors to free up memory that they
@@ -1857,12 +1836,12 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
     for (framenum = 1; err == 0 && framenum <= cf->count; framenum++) {
       fdata = frame_data_sequence_find(cf->frames, framenum);
 #if 0
-      if (wtap_seek_read(cf->wth, fdata->file_off,
+      if (wtap_seek_read(cf->wfth, fdata->file_off,
           &buf, fdata->cap_len, &err, &err_info)) {
-        process_packet_second_pass(cf, edt, fdata, &cf->phdr, &buf, tap_flags);
+        process_packet_second_pass(cf, edt, fdata, &cf->hdr.wtap_hdr, &buf, tap_flags);
       }
 #else
-        process_packet_second_pass(cf, edt, fdata, &cf->phdr, &buf, tap_flags);
+        process_packet_second_pass(cf, edt, fdata, &cf->hdr.wtap_hdr, &buf, tap_flags);
 #endif
     }
 
@@ -1896,7 +1875,7 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
 
       framenum++;
 
-      process_packet(cf, edt, data_offset, &file_phdr/*wtap_phdr(cf->wth)*/,
+      process_packet(cf, edt, data_offset, &file_phdr/*wtap_phdr(cf->wfth)*/,
                              raw_data, tap_flags);
 
         /* Stop reading if we have the maximum number of packets;
@@ -1991,8 +1970,8 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
   }
 
 out:
-  wtap_close(cf->wth);
-  cf->wth = NULL;
+  wtap_close(cf->wfth);
+  cf->wfth = NULL;
 
   return err;
 }
@@ -2509,7 +2488,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
 #if USE_FTAP
   ftap  *fth;
 #else
-  wtap  *wth;
+  wftap  *wth;
 #endif
   gchar *err_info;
   char   err_msg[2048+1];
@@ -2531,9 +2510,9 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
   cf->epan = tfshark_epan_new(cf);
 
 #if USE_FTAP
-  cf->wth = (struct wtap*)fth; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
+  cf->wfth = (struct wtap*)fth; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
 #else
-  cf->wth = wth;
+  cf->wfth = wth;
 #endif
   cf->f_datalen = 0; /* not used, but set it anyway */
 
@@ -2548,12 +2527,12 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
   /* No user changes yet. */
   cf->unsaved_changes = FALSE;
 
-  cf->cd_t      = ftap_file_type_subtype((struct ftap*)cf->wth); /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
+  cf->cd_t      = ftap_file_type_subtype((struct ftap*)cf->wfth); /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
   cf->open_type = type;
   cf->count     = 0;
   cf->drops_known = FALSE;
   cf->drops     = 0;
-  cf->snap      = ftap_snapshot_length((struct ftap*)cf->wth); /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
+  cf->snap      = ftap_snapshot_length((struct ftap*)cf->wfth); /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
   if (cf->snap == 0) {
     /* Snapshot length not known. */
     cf->has_snap = FALSE;
index c5b3d8b61a7e9f2ecab78100de1482ecbc9f87c9..896b897605e6b3d31b0d006ad60ecff6016a368a 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -2043,7 +2043,7 @@ main(int argc, char *argv[])
 
     /* Set timestamp precision; there should arguably be a command-line
        option to let the user set this. */
-    switch(wtap_file_tsprecision(cfile.wth)) {
+    switch(wftap_file_tsprecision(cfile.wfth)) {
     case(WTAP_FILE_TSPREC_SEC):
       timestamp_set_precision(TS_PREC_AUTO_SEC);
       break;
@@ -2611,9 +2611,9 @@ capture_input_new_file(capture_session *cap_session, gchar *new_file)
 
     /* we start a new capture file, close the old one (if we had one before) */
     if ( ((capture_file *) cap_session->cf)->state != FILE_CLOSED) {
-      if ( ((capture_file *) cap_session->cf)->wth != NULL) {
-        wtap_close(((capture_file *) cap_session->cf)->wth);
-       ((capture_file *) cap_session->cf)->wth = NULL;
+      if ( ((capture_file *) cap_session->cf)->wfth != NULL) {
+        wtap_close(((capture_file *) cap_session->cf)->wfth);
+        ((capture_file *) cap_session->cf)->wfth = NULL;
       }
       ((capture_file *) cap_session->cf)->state = FILE_CLOSED;
     }
@@ -2694,17 +2694,17 @@ capture_input_new_packets(capture_session *cap_session, int to_read)
        ("packet_details" is true). */
     edt = epan_dissect_new(cf->epan, create_proto_tree, print_packet_info && print_details);
 
-    while (to_read-- && cf->wth) {
-      wtap_cleareof(cf->wth);
-      ret = wtap_read(cf->wth, &err, &err_info, &data_offset);
+    while (to_read-- && cf->wfth) {
+      wftap_cleareof(cf->wfth);
+      ret = wtap_read(cf->wfth, &err, &err_info, &data_offset);
       if (ret == FALSE) {
         /* read from file failed, tell the capture child to stop */
         sync_pipe_stop(cap_session);
-        wtap_close(cf->wth);
-        cf->wth = NULL;
+        wtap_close(cf->wfth);
+        cf->wfth = NULL;
       } else {
-        ret = process_packet(cf, edt, data_offset, wtap_phdr(cf->wth),
-                             wtap_buf_ptr(cf->wth),
+        ret = process_packet(cf, edt, data_offset, wtap_phdr(cf->wfth),
+                             wftap_buf_ptr(cf->wfth),
                              tap_flags);
       }
       if (ret != FALSE) {
@@ -2809,8 +2809,8 @@ capture_input_closed(capture_session *cap_session, gchar *msg)
 
   report_counts();
 
-  if (cf != NULL && cf->wth != NULL) {
-    wtap_close(cf->wth);
+  if (cf != NULL && cf->wfth != NULL) {
+    wtap_close(cf->wfth);
     if (cf->is_tempfile) {
       ws_unlink(cf->filename);
     }
@@ -3060,7 +3060,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
 {
   gint         linktype;
   int          snapshot_length;
-  wtap_dumper *pdh;
+  wftap_dumper *pdh;
   guint32      framenum;
   int          err;
   gchar       *err_info = NULL;
@@ -3077,23 +3077,23 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
 
   memset(&phdr, 0, sizeof(struct wtap_pkthdr));
 
-  shb_hdr = wtap_file_get_shb_info(cf->wth);
-  idb_inf = wtap_file_get_idb_info(cf->wth);
+  shb_hdr = wtap_file_get_shb_info(cf->wfth);
+  idb_inf = wtap_file_get_idb_info(cf->wfth);
 #ifdef PCAP_NG_DEFAULT
   if (idb_inf->number_of_interfaces > 1) {
     linktype = WTAP_ENCAP_PER_PACKET;
   } else {
-    linktype = wtap_file_encap(cf->wth);
+    linktype = wftap_file_encap(cf->wfth);
   }
 #else
-  linktype = wtap_file_encap(cf->wth);
+  linktype = wftap_file_encap(cf->wfth);
 #endif
   if (save_file != NULL) {
     /* Get a string that describes what we're writing to */
     save_file_string = output_file_description(save_file);
 
     /* Set up to write to the capture file. */
-    snapshot_length = wtap_snapshot_length(cf->wth);
+    snapshot_length = wftap_snapshot_length(cf->wfth);
     if (snapshot_length == 0) {
       /* Snapshot length of input file not known. */
       snapshot_length = WTAP_MAX_PACKET_SIZE;
@@ -3191,9 +3191,9 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
       edt = epan_dissect_new(cf->epan, create_proto_tree, FALSE);
     }
 
-    while (wtap_read(cf->wth, &err, &err_info, &data_offset)) {
-      if (process_packet_first_pass(cf, edt, data_offset, wtap_phdr(cf->wth),
-                         wtap_buf_ptr(cf->wth))) {
+    while (wtap_read(cf->wfth, &err, &err_info, &data_offset)) {
+      if (process_packet_first_pass(cf, edt, data_offset, wtap_phdr(cf->wfth),
+                         wftap_buf_ptr(cf->wfth))) {
         /* Stop reading if we have the maximum number of packets;
          * When the -c option has not been used, max_packet_count
          * starts at 0, which practically means, never stop reading.
@@ -3212,7 +3212,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
     }
 
     /* Close the sequential I/O side, to free up memory it requires. */
-    wtap_sequential_close(cf->wth);
+    wftap_sequential_close(cf->wfth);
 
     /* Allow the protocol dissectors to free up memory that they
      * don't need after the sequential run-through of the packets. */
@@ -3240,7 +3240,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
 
     for (framenum = 1; err == 0 && framenum <= cf->count; framenum++) {
       fdata = frame_data_sequence_find(cf->frames, framenum);
-      if (wtap_seek_read(cf->wth, fdata->file_off, &phdr, &buf, &err,
+      if (wftap_seek_read(cf->wfth, fdata->file_off, &phdr, &buf, &err,
                          &err_info)) {
         if (process_packet_second_pass(cf, edt, fdata, &phdr, &buf,
                                        tap_flags)) {
@@ -3286,7 +3286,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
                 show_capture_file_io_error(save_file, err, FALSE);
                 break;
               }
-              wtap_dump_close(pdh, &err);
+              wftap_dump_close(pdh, &err);
               g_free(shb_hdr);
               exit(2);
             }
@@ -3321,17 +3321,17 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
       edt = epan_dissect_new(cf->epan, create_proto_tree, print_packet_info && print_details);
     }
 
-    while (wtap_read(cf->wth, &err, &err_info, &data_offset)) {
+    while (wtap_read(cf->wfth, &err, &err_info, &data_offset)) {
       framenum++;
 
-      if (process_packet(cf, edt, data_offset, wtap_phdr(cf->wth),
-                         wtap_buf_ptr(cf->wth),
+      if (process_packet(cf, edt, data_offset, wtap_phdr(cf->wfth),
+                         wftap_buf_ptr(cf->wfth),
                          tap_flags)) {
         /* Either there's no read filtering or this packet passed the
            filter, so, if we're writing to a capture file, write
            this packet out. */
         if (pdh != NULL) {
-          if (!wtap_dump(pdh, wtap_phdr(cf->wth), wtap_buf_ptr(cf->wth), &err)) {
+          if (!wtap_dump(pdh, wtap_phdr(cf->wfth), wftap_buf_ptr(cf->wfth), &err)) {
             /* Error writing to a capture file */
             switch (err) {
 
@@ -3363,7 +3363,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
               show_capture_file_io_error(save_file, err, FALSE);
               break;
             }
-            wtap_dump_close(pdh, &err);
+            wftap_dump_close(pdh, &err);
             g_free(shb_hdr);
             exit(2);
           }
@@ -3453,13 +3453,13 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
     }
     if (save_file != NULL) {
       /* Now close the capture file. */
-      if (!wtap_dump_close(pdh, &err))
+      if (!wftap_dump_close(pdh, &err))
         show_capture_file_io_error(save_file, err, TRUE);
     }
   } else {
     if (save_file != NULL) {
       /* Now close the capture file. */
-      if (!wtap_dump_close(pdh, &err))
+      if (!wftap_dump_close(pdh, &err))
         show_capture_file_io_error(save_file, err, TRUE);
     } else {
       if (print_packet_info) {
@@ -3472,8 +3472,8 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
   }
 
 out:
-  wtap_close(cf->wth);
-  cf->wth = NULL;
+  wtap_close(cf->wfth);
+  cf->wfth = NULL;
 
   g_free(save_file_string);
   g_free(shb_hdr);
@@ -3995,7 +3995,7 @@ write_finale(void)
 cf_status_t
 cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_tempfile, int *err)
 {
-  wtap  *wth;
+  wftap  *wth;
   gchar *err_info;
   char   err_msg[2048+1];
 
@@ -4009,7 +4009,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
   epan_free(cf->epan);
   cf->epan = tshark_epan_new(cf);
 
-  cf->wth = wth;
+  cf->wfth = wth;
   cf->f_datalen = 0; /* not used, but set it anyway */
 
   /* Set the file name because we need it to set the follow stream filter.
@@ -4023,12 +4023,12 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
   /* No user changes yet. */
   cf->unsaved_changes = FALSE;
 
-  cf->cd_t      = wtap_file_type_subtype(cf->wth);
+  cf->cd_t      = wftap_file_type_subtype(cf->wfth);
   cf->open_type = type;
   cf->count     = 0;
   cf->drops_known = FALSE;
   cf->drops     = 0;
-  cf->snap      = wtap_snapshot_length(cf->wth);
+  cf->snap      = wftap_snapshot_length(cf->wfth);
   if (cf->snap == 0) {
     /* Snapshot length not known. */
     cf->has_snap = FALSE;
@@ -4042,8 +4042,8 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
 
   cf->state = FILE_READ_IN_PROGRESS;
 
-  wtap_set_cb_new_ipv4(cf->wth, add_ipv4_name);
-  wtap_set_cb_new_ipv6(cf->wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
+  wtap_set_cb_new_ipv4(cf->wfth, add_ipv4_name);
+  wtap_set_cb_new_ipv6(cf->wfth, (wtap_new_ipv6_callback_t) add_ipv6_name);
 
   return CF_OK;
 
index baef2baed97aacf21bb91613229bc537187bf292..a2b2b7819b098c18d0055efdd224e80b01b3f438 100644 (file)
@@ -105,11 +105,11 @@ static gboolean        color_selected;
 
 
 /* set a new filename for the preview widget */
-static wtap *
+static wftap *
 preview_set_filename(GtkWidget *prev, const gchar *cf_name)
 {
   GtkWidget *label;
-  wtap      *wth;
+  wftap     *wth;
   int        err = 0;
   gchar     *err_info;
   gchar      string_buff[PREVIEW_STR_MAX];
@@ -150,7 +150,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
   }
 
   /* Find the size of the file. */
-  filesize = wtap_file_size(wth, &err);
+  filesize = wftap_file_size(wth, &err);
   if (filesize == -1) {
     gtk_label_set_text(GTK_LABEL(label), "error getting file size");
     wtap_close(wth);
@@ -161,7 +161,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
   gtk_label_set_text(GTK_LABEL(label), string_buff);
 
   /* type */
-  g_strlcpy(string_buff, wtap_file_type_subtype_string(wtap_file_type_subtype(wth)), PREVIEW_STR_MAX);
+  g_strlcpy(string_buff, wtap_file_type_subtype_string(wftap_file_type_subtype(wth)), PREVIEW_STR_MAX);
   label = (GtkWidget *)g_object_get_data(G_OBJECT(prev), PREVIEW_FORMAT_KEY);
   gtk_label_set_text(GTK_LABEL(label), string_buff);
 
@@ -171,7 +171,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
 
 /* do a preview run on the currently selected capture file */
 static void
-preview_do(GtkWidget *prev, wtap *wth)
+preview_do(GtkWidget *prev, wftap *wth)
 {
   GtkWidget    *label;
   unsigned int  elapsed_time;
@@ -299,7 +299,7 @@ file_open_entry_changed(GtkWidget *w _U_, gpointer file_sel)
   GtkWidget *prev = (GtkWidget *)g_object_get_data(G_OBJECT(file_sel), PREVIEW_TABLE_KEY);
   gchar     *cf_name;
   gboolean   have_preview;
-  wtap      *wth;
+  wftap      *wth;
 
   /* get the filename */
   cf_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_sel));
index cd1298525719500b8d5cf65fb7bdb9ac11ddf7be..b3e5342b1dd0161493b686093054f39a4332c4bf 100644 (file)
@@ -535,7 +535,7 @@ file_import_open(text_import_info_t *info)
         read_failure_alert_box(info->import_text_filename, errno);
     }
 
-    if (!wtap_dump_close(info->wdh, &err)) {
+    if (!wftap_dump_close(info->wdh, &err)) {
         write_failure_alert_box(capfile_name, err);
     }
 
index 6f7fe77c730777a21fd9433fddf7ea4ff2e87dd9..da4996f5c597597ebea17546f763a6c5062e38c9 100644 (file)
@@ -3715,7 +3715,7 @@ void iax2_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
                return; /* error reading the frame */
        epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
        epan_dissect_prime_dfilter(&edt, sfcode);
-       epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf),
+       epan_dissect_run(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf),
            fdata, NULL);
 
        /* if it is not an iax2 frame, show an error dialog */
index 56264fb305a55de2f8bece724e96448bda02debd..6635c69b2e3ea6ce6e8ec8000b85469541f30a8d 100644 (file)
@@ -549,7 +549,7 @@ get_ip_address_list_from_packet_list_row(gpointer data)
         epan_dissect_init(&edt, cfile.epan, FALSE, FALSE);
         col_custom_prime_edt(&edt, &cfile.cinfo);
 
-        epan_dissect_run(&edt, &cfile.phdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
+        epan_dissect_run(&edt, &cfile.hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
             fdata, &cfile.cinfo);
         epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
 
@@ -590,7 +590,7 @@ get_filter_from_packet_list_row_and_column(gpointer data)
         epan_dissect_init(&edt, cfile.epan, have_custom_cols(&cfile.cinfo), FALSE);
         col_custom_prime_edt(&edt, &cfile.cinfo);
 
-        epan_dissect_run(&edt, &cfile.phdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
+        epan_dissect_run(&edt, &cfile.hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
                          fdata, &cfile.cinfo);
         epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
 
index c25d62b48aac29ae51cdb644bc0fd3a863c202d7..47c637bfcdd6eadadf363d4f544b536fae405e4b 100644 (file)
@@ -972,7 +972,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _
        /* XXX, protect cfile.epan from closing (ref counting?) */
        DataPtr->epan  = cfile.epan;
        DataPtr->frame = fd;
-       DataPtr->phdr  = cfile.phdr;
+       DataPtr->phdr  = cfile.hdr.wtap_hdr;
        DataPtr->pd = (guint8 *)g_malloc(DataPtr->frame->cap_len);
        memcpy(DataPtr->pd, buffer_start_ptr(&cfile.buf), DataPtr->frame->cap_len);
 
index aeb5b9996ba810e7f871c7986d0670f2f77ff3b5..ab238b83441320726249362f309052c43cd0e895 100644 (file)
@@ -917,7 +917,7 @@ static rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf, struct segment
 
     epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
     epan_dissect_prime_dfilter(&edt, sfcode);
-    epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+    epan_dissect_run_with_taps(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
     rel_ts = edt.pi.rel_ts;
     epan_dissect_cleanup(&edt);
     remove_tap_listener(&th);
index 0305b0a26afe09215ce159b0eaaa03a8d0975823..578273d6bf3b2013130e167bb8b1915e7dd050f5 100644 (file)
@@ -3950,7 +3950,7 @@ rtp_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
                return; /* error reading the frame */
        epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
        epan_dissect_prime_dfilter(&edt, sfcode);
-       epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+       epan_dissect_run(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
 
        /* if it is not an rtp frame, show the rtpstream dialog */
        frame_matched = dfilter_apply_edt(sfcode, &edt);
index 2b751f7135d5f1d1b8fc53f75b15b78b02414a02..84d37c301029af73871be808183ec470f1015b5e 100644 (file)
@@ -980,7 +980,7 @@ sctp_analyse_cb(struct sctp_analyse *u_data, gboolean ext)
 
        epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
        epan_dissect_prime_dfilter(&edt, sfcode);
-       epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+       epan_dissect_run(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
        frame_matched = dfilter_apply_edt(sfcode, &edt);
 
        /* if it is not an sctp frame, show the dialog */
index 03d48924114be569b82a4ede56f7089e605ba113..1fa58515d6fddc66ad77de7385706e4993ef3fab 100644 (file)
@@ -786,10 +786,10 @@ void CaptureFileDialog::preview(const QString & path)
     }
 
     // Format
-    preview_format_.setText(QString::fromUtf8(wtap_file_type_subtype_string(wtap_file_type_subtype(wth))));
+    preview_format_.setText(QString::fromUtf8(wtap_file_type_subtype_string(wftap_file_type_subtype(wth))));
 
     // Size
-    preview_size_.setText(QString(tr("%1 bytes")).arg(wtap_file_size(wth, &err)));
+    preview_size_.setText(QString(tr("%1 bytes")).arg(wftap_file_size(wth, &err)));
 
     time(&time_preview);
     while ( (wtap_read(wth, &err, &err_info, &data_offset)) ) {
index 39cf304bcdf7295b2baf3674d3c0d82c925091a2..344c3e6faf346ea80ea28495321d1f633c0d297e 100644 (file)
@@ -142,7 +142,7 @@ void ImportTextDialog::convertTextFile() {
         read_failure_alert_box(import_info_.import_text_filename, errno);
     }
 
-    if (!wtap_dump_close(import_info_.wdh, &err))
+    if (!wftap_dump_close(import_info_.wdh, &err))
     {
         write_failure_alert_box(capfile_name_.toUtf8().constData(), err);
     }
index 7e9ff9413220ab3c5c40c7ececa7d5bbc70af775..1a2c07e6b7bdd6c7e49bdec5c836afd00f64e439 100644 (file)
@@ -661,7 +661,7 @@ QString &PacketList::getFilterFromRowAndColumn()
         epan_dissect_init(&edt, cap_file_->epan, have_custom_cols(&cap_file_->cinfo), FALSE);
         col_custom_prime_edt(&edt, &cap_file_->cinfo);
 
-        epan_dissect_run(&edt, &cap_file_->phdr, frame_tvbuff_new_buffer(fdata, &cap_file_->buf), fdata, &cap_file_->cinfo);
+        epan_dissect_run(&edt, &cap_file_->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cap_file_->buf), fdata, &cap_file_->cinfo);
         epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
 
         if ((cap_file_->cinfo.col_custom_occurrence[ctx_column_]) ||
index 9dd1e46381712aae5677fd038fa8982a94c53852..e91604bcbcc477b077107d47d134d73f0cce3c8e 100644 (file)
@@ -319,7 +319,7 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs)
 
     epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
     epan_dissect_prime_dfilter(&edt, sfcode);
-    epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+    epan_dissect_run_with_taps(&edt, &cf->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
     rel_ts = edt.pi.rel_ts;
     epan_dissect_cleanup(&edt);
     remove_tap_listener(&th);
index ec8c78130ff2d259b90a05aeb3692803a3782fab..c3a23fcc89213d6891bc972c55ce13cb7115d146 100644 (file)
@@ -154,7 +154,7 @@ exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data)
     cf_retap_packets(&cfile);
 
 
-    if (!wtap_dump_close(exp_pdu_tap_data->wdh, &err)) {
+    if (!wftap_dump_close(exp_pdu_tap_data->wdh, &err)) {
         write_failure_alert_box(capfile_name, err);
     }
 
index 25c39d733aed899d87ebc2e45fe121a39fbb7c53..998959b9b7d64485a02cb011ab5d69568d5dd567 100644 (file)
@@ -29,7 +29,7 @@ extern "C" {
 
 typedef struct _exp_pdu_t {
     int          pkt_encap;
-    wtap_dumper* wdh;
+    wftap_dumper* wdh;
 } exp_pdu_t;
 
 void exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data);
index 05fcc25b8fe7cde63ea58ab056972947f00b3b5f..8a05da023c071321f1e9befaf24131a3bd89782a 100644 (file)
@@ -191,7 +191,7 @@ static guint32 ts_usec = 0;
 static char *ts_fmt = NULL;
 static struct tm timecode_default;
 
-static wtap_dumper* wdh;
+static wftap_dumper* wdh;
 
 /* HDR_ETH Offset base to parse */
 static guint32 offset_base = 16;
index 9a92576f8e319eadab829b20418a9d01108ef593..64410d61c516ee3a22167073fc2a7763e364bd91 100644 (file)
@@ -71,7 +71,7 @@ typedef struct
 
     /* Import info */
     guint encapsulation;
-    wtap_dumper* wdh;
+    wftap_dumper* wdh;
 
     /* Dummy header info (if encapsulation == 1) */
     enum dummy_header_type dummy_header_type;
index a65aaf4d0fd5bc3264b2412ffecb69e198b42685..21b1ed9dacf2d39f8900275831305e4978387c95 100644 (file)
@@ -1114,7 +1114,7 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
     HWND        cur_ctrl;
     int         i;
     gboolean    enable = FALSE;
-    wtap       *wth;
+    wftap       *wth;
     const struct wtap_pkthdr *phdr;
     int         err = 0;
     gchar      *err_info;
@@ -1177,10 +1177,10 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
 
     /* Format */
     cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_FORMAT);
-    SetWindowText(cur_ctrl, utf_8to16(wtap_file_type_subtype_string(wtap_file_type_subtype(wth))));
+    SetWindowText(cur_ctrl, utf_8to16(wtap_file_type_subtype_string(wftap_file_type_subtype(wth))));
 
     /* Size */
-    filesize = wtap_file_size(wth, &err);
+    filesize = wftap_file_size(wth, &err);
     utf_8to16_snprintf(string_buff, PREVIEW_STR_MAX, "%" G_GINT64_FORMAT " bytes", filesize);
     cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_SIZE);
     SetWindowText(cur_ctrl, string_buff);
index db377b15702a02de27dfd843573f6aeff2f39a21..5af6687747476d9feda8ee42d843cb05cb999c7b 100644 (file)
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <time.h>
 
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "file_wrappers.h"
 #include "buffer.h"
@@ -99,27 +100,27 @@ typedef struct
 #define CST_5VW_CAPTURES_RECORD                (CST_5VW_SECTION_CAPTURES << 28)        /* 0x80000000 */
 #define CST_5VW_SYSTEM_RECORD          0x00000000U
 
-static gboolean _5views_read(wtap *wth, int *err, gchar **err_info,
+static gboolean _5views_read(wftap *wfth, int *err, gchar **err_info,
     gint64 *data_offset);
-static gboolean _5views_seek_read(wtap *wth, gint64 seek_off,
+static gboolean _5views_seek_read(wftap *wth, gint64 seek_off,
     struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-static int _5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
+static int _5views_read_header(wftap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
     struct wtap_pkthdr *phdr, int *err, gchar **err_info);
 
-static gboolean _5views_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const guint8 *pd, int *err);
-static gboolean _5views_dump_close(wtap_dumper *wdh, int *err);
+static gboolean _5views_dump(wftap_dumper *wdh, void* header, const guint8 *pd, int *err);
+static gboolean _5views_dump_close(wftap_dumper *wdh, int *err);
 
 
-int _5views_open(wtap *wth, int *err, gchar **err_info)
+int _5views_open(wftap *wfth, int *err, gchar **err_info)
 {
        int bytes_read;
        t_5VW_Capture_Header Capture_Header;
        int encap = WTAP_ENCAP_UNKNOWN;
 
        errno = WTAP_ERR_CANT_READ;
-       bytes_read = file_read(&Capture_Header.Info_Header, sizeof(t_5VW_Info_Header), wth->fh);
+       bytes_read = file_read(&Capture_Header.Info_Header, sizeof(t_5VW_Info_Header), wfth->fh);
        if (bytes_read != sizeof(t_5VW_Info_Header)) {
-               *err = file_error(wth->fh, err_info);
+               *err = file_error(wfth->fh, err_info);
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
@@ -171,30 +172,31 @@ int _5views_open(wtap *wth, int *err, gchar **err_info)
        }
 
        /* read the remaining header information */
-       bytes_read = file_read(&Capture_Header.HeaderDateCreation, sizeof (t_5VW_Capture_Header) - sizeof(t_5VW_Info_Header), wth->fh);
+       bytes_read = file_read(&Capture_Header.HeaderDateCreation, sizeof (t_5VW_Capture_Header) - sizeof(t_5VW_Info_Header), wfth->fh);
        if (bytes_read != sizeof (t_5VW_Capture_Header)- sizeof(t_5VW_Info_Header) ) {
-               *err = file_error(wth->fh, err_info);
+               *err = file_error(wfth->fh, err_info);
                if (*err == 0)
                        *err = WTAP_ERR_SHORT_READ;
                return -1;
        }
 
        /* This is a 5views capture file */
-       wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_5VIEWS;
-       wth->subtype_read = _5views_read;
-       wth->subtype_seek_read = _5views_seek_read;
-       wth->file_encap = encap;
-       wth->snapshot_length = 0;       /* not available in header */
-       wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+       wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_5VIEWS;
+       wfth->subtype_read = _5views_read;
+       wfth->subtype_seek_read = _5views_seek_read;
+       wfth->file_encap = encap;
+       wfth->snapshot_length = 0;      /* not available in header */
+       wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
 
        return 1;
 }
 
 /* Read the next packet */
 static gboolean
-_5views_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
+_5views_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
 {
        t_5VW_TimeStamped_Header TimeStamped_Header;
+       wtap* wth = (wtap*)wfth->tap_specific_data;
 
        /*
         * Keep reading until we see a record with a subtype of
@@ -202,10 +204,10 @@ _5views_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
         */
        do
        {
-               *data_offset = file_tell(wth->fh);
+               *data_offset = file_tell(wfth->fh);
 
                /* Read record header. */
-               if (!_5views_read_header(wth, wth->fh, &TimeStamped_Header,
+               if (!_5views_read_header(wfth, wfth->fh, &TimeStamped_Header,
                    &wth->phdr, err, err_info))
                        return FALSE;
 
@@ -219,7 +221,7 @@ _5views_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                /*
                 * Not a packet - skip to the next record.
                 */
-               if (file_seek(wth->fh, TimeStamped_Header.RecSize, SEEK_CUR, err) == -1)
+               if (file_seek(wfth->fh, TimeStamped_Header.RecSize, SEEK_CUR, err) == -1)
                        return FALSE;
        } while (1);
 
@@ -234,23 +236,23 @@ _5views_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                return FALSE;
        }
 
-       return wtap_read_packet_bytes(wth->fh, wth->frame_buffer,
+       return wtap_read_packet_bytes(wfth->fh, wfth->frame_buffer,
            wth->phdr.caplen, err, err_info);
 }
 
 static gboolean
-_5views_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
+_5views_seek_read(wftap *wfth, gint64 seek_off, struct wtap_pkthdr *phdr,
     Buffer *buf, int *err, gchar **err_info)
 {
        t_5VW_TimeStamped_Header TimeStamped_Header;
 
-       if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+       if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
                return FALSE;
 
        /*
         * Read the header.
         */
-       if (!_5views_read_header(wth, wth->random_fh, &TimeStamped_Header,
+       if (!_5views_read_header(wfth, wfth->random_fh, &TimeStamped_Header,
            phdr, err, err_info)) {
                if (*err == 0)
                        *err = WTAP_ERR_SHORT_READ;
@@ -260,14 +262,14 @@ _5views_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
        /*
         * Read the packet data.
         */
-       return wtap_read_packet_bytes(wth->random_fh, buf, phdr->caplen,
+       return wtap_read_packet_bytes(wfth->random_fh, buf, phdr->caplen,
            err, err_info);
 }
 
 /* Read the header of the next packet.  Return TRUE on success, FALSE
    on error. */
 static gboolean
-_5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
+_5views_read_header(wftap *wfth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
     struct wtap_pkthdr *phdr, int *err, gchar **err_info)
 {
        int     bytes_read, bytes_to_read;
@@ -303,7 +305,7 @@ _5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
        phdr->caplen = hdr->RecSize;
        phdr->len = hdr->RecSize;
 
-       switch (wth->file_encap) {
+       switch (wfth->file_encap) {
 
        case WTAP_ENCAP_ETHERNET:
                /* We assume there's no FCS in this frame. */
@@ -340,7 +342,7 @@ int _5views_dump_can_write_encap(int encap)
 
 /* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
    failure */
-gboolean _5views_dump_open(wtap_dumper *wdh, int *err)
+gboolean _5views_dump_open(wftap_dumper *wdh, int *err)
 {
        _5views_dump_t *_5views;
 
@@ -348,7 +350,7 @@ gboolean _5views_dump_open(wtap_dumper *wdh, int *err)
           haven't yet written any packets.  As we'll have to rewrite
           the header when we've written out all the packets, we just
           skip over the header for now. */
-       if (wtap_dump_file_seek(wdh, sizeof(t_5VW_Capture_Header), SEEK_SET, err) == -1)
+       if (wftap_dump_file_seek(wdh, sizeof(t_5VW_Capture_Header), SEEK_SET, err) == -1)
                return FALSE;
 
        /* This is a 5Views file */
@@ -363,12 +365,12 @@ gboolean _5views_dump_open(wtap_dumper *wdh, int *err)
 
 /* Write a record for a packet to a dump file.
    Returns TRUE on success, FALSE on failure. */
-static gboolean _5views_dump(wtap_dumper *wdh,
-       const struct wtap_pkthdr *phdr,
+static gboolean _5views_dump(wftap_dumper *wdh,        void* header,
        const guint8 *pd, int *err)
 {
        _5views_dump_t *_5views = (_5views_dump_t *)wdh->priv;
        t_5VW_TimeStamped_Header HeaderFrame;
+       const struct wtap_pkthdr *phdr = (const struct wtap_pkthdr*)header;
 
        /* Don't write out something bigger than we can read. */
        if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
@@ -392,12 +394,12 @@ static gboolean _5views_dump(wtap_dumper *wdh,
        HeaderFrame.RecInfo = GUINT32_TO_LE(0);
 
        /* write the record header */
-       if (!wtap_dump_file_write(wdh, &HeaderFrame,
+       if (!wftap_dump_file_write(wdh, &HeaderFrame,
            sizeof(t_5VW_TimeStamped_Header), err))
                return FALSE;
 
        /* write the data */
-       if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
+       if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
                return FALSE;
 
        _5views->nframes ++;
@@ -405,12 +407,12 @@ static gboolean _5views_dump(wtap_dumper *wdh,
        return TRUE;
 }
 
-static gboolean _5views_dump_close(wtap_dumper *wdh, int *err)
+static gboolean _5views_dump_close(wftap_dumper *wdh, int *err)
 {
        _5views_dump_t *_5views = (_5views_dump_t *)wdh->priv;
        t_5VW_Capture_Header file_hdr;
 
-       if (wtap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
+       if (wftap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
                return FALSE;
 
        /* fill in the Info_Header */
@@ -447,7 +449,7 @@ static gboolean _5views_dump_close(wtap_dumper *wdh, int *err)
        file_hdr.TramesStockeesInFile = GUINT32_TO_LE(_5views->nframes);
 
        /* Write the file header. */
-       if (!wtap_dump_file_write(wdh, &file_hdr, sizeof(t_5VW_Capture_Header),
+       if (!wftap_dump_file_write(wdh, &file_hdr, sizeof(t_5VW_Capture_Header),
            err))
                return FALSE;
 
index 79d4477cb1783a6995f496dc763a6360ef3bed65..7ac7957ca5894b17b73371951ea420c3e8bf94bf 100644 (file)
@@ -23,8 +23,8 @@
 #include <glib.h>
 #include <wtap.h>
 
-int _5views_open(wtap *wth, int *err, gchar **err_info);
-gboolean _5views_dump_open(wtap_dumper *wdh, int *err);
+int _5views_open(wftap *wfth, int *err, gchar **err_info);
+gboolean _5views_dump_open(wftap_dumper *wdh, int *err);
 int _5views_dump_can_write_encap(int encap);
 
 #endif
index 37432cbeb51aa7645163d5b28f1ce301a7e16c95..ca6beba211274dd254974973ba60787367bb5bff 100644 (file)
@@ -51,8 +51,8 @@ set(CLEAN_FILES
        libpcap.c
        logcat.c
        merge.c
-       mpeg.c
        mime_file.c
+       mpeg.c
        mp2t.c
        netmon.c
        netscaler.c
index 1929ecf3303bea106835829766c928e2b5cf9de6..71f1b76f21e4b2951027b6b68c513ac4bd521fc3 100644 (file)
@@ -51,12 +51,12 @@ NONGENERATED_C_FILES = \
        ipfix.c                 \
        iptrace.c               \
        iseries.c               \
-       mime_file.c             \
        k12.c                   \
        lanalyzer.c             \
        logcat.c                \
        libpcap.c               \
        merge.c                 \
+       mime_file.c             \
        mpeg.c                  \
        mp2t.c                  \
        netmon.c                \
@@ -69,8 +69,8 @@ NONGENERATED_C_FILES = \
        packetlogger.c          \
        pcap-common.c           \
        pcapng.c                \
-       peekclassic.c           \
-       peektagged.c            \
+       peekclassic.c   \
+       peektagged.c    \
        pppdump.c               \
        radcom.c                \
        snoop.c                 \
@@ -79,7 +79,7 @@ NONGENERATED_C_FILES = \
        toshiba.c               \
        visual.c                \
        vms.c                   \
-       vwr.c           \
+       vwr.c                   \
        wtap.c
 
 # Header files that are not generated from other files
@@ -128,7 +128,7 @@ NONGENERATED_HEADER_FILES = \
        pcap-common.h           \
        pcap-encap.h            \
        pcapng.h                \
-       peekclassic.h           \
+       peekclassic.h   \
        peektagged.h            \
        pppdump.h               \
        radcom.h                \
@@ -138,7 +138,8 @@ NONGENERATED_HEADER_FILES = \
        toshiba.h               \
        visual.h                \
        vms.h                   \
-       vwr.h           \
+       vwr.h                   \
+       wftap-int.h             \
        wtap.h                  \
        wtap-int.h
 
index a0b783b3495872e0788d62f22bfe5d4fc417d8f3..ef9b5fd3c25f26e9f3fb7f8637b15db26c6a15d5 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #include <errno.h>
 #include <string.h>
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "file_wrappers.h"
 #include "buffer.h"
@@ -112,14 +113,14 @@ typedef struct {
        time_t  start;
 } aethra_t;
 
-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);
+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);
 
-int aethra_open(wtap *wth, int *err, gchar **err_info)
+int aethra_open(wftap *wfth, int *err, gchar **err_info)
 {
        int bytes_read;
        struct aethra_hdr hdr;
@@ -128,9 +129,9 @@ int aethra_open(wtap *wth, 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, wth->fh);
+       bytes_read = file_read(hdr.magic, sizeof hdr.magic, wfth->fh);
        if (bytes_read != sizeof hdr.magic) {
-               *err = file_error(wth->fh, err_info);
+               *err = file_error(wfth->fh, err_info);
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
@@ -142,18 +143,18 @@ int aethra_open(wtap *wth, 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, wth->fh);
+           sizeof hdr - sizeof hdr.magic, wfth->fh);
        if (bytes_read != sizeof hdr - sizeof hdr.magic) {
-               *err = file_error(wth->fh, err_info);
+               *err = file_error(wfth->fh, err_info);
                if (*err == 0)
                        *err = WTAP_ERR_SHORT_READ;
                return -1;
        }
-       wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_AETHRA;
+       wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_AETHRA;
        aethra = (aethra_t *)g_malloc(sizeof(aethra_t));
-       wth->priv = (void *)aethra;
-       wth->subtype_read = aethra_read;
-       wth->subtype_seek_read = aethra_seek_read;
+       wfth->priv = (void *)aethra;
+       wfth->subtype_read = aethra_read;
+       wfth->subtype_seek_read = aethra_seek_read;
 
        /*
         * Convert the time stamp to a "time_t".
@@ -171,9 +172,9 @@ int aethra_open(wtap *wth, int *err, gchar **err_info)
         * We've only seen ISDN files, so, for now, we treat all
         * files as ISDN.
         */
-       wth->file_encap = WTAP_ENCAP_ISDN;
-       wth->snapshot_length = 0;       /* not available in header */
-       wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
+       wfth->file_encap = WTAP_ENCAP_ISDN;
+       wfth->snapshot_length = 0;      /* not available in header */
+       wfth->tsprecision = WTAP_FILE_TSPREC_MSEC;
        return 1;
 }
 
@@ -182,20 +183,21 @@ static guint packet = 0;
 #endif
 
 /* Read the next packet */
-static gboolean aethra_read(wtap *wth, int *err, gchar **err_info,
+static gboolean aethra_read(wftap *wfth, 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(wth->fh);
+               *data_offset = file_tell(wfth->fh);
 
                /* Read record header. */
-               if (!aethra_read_rec_header(wth, wth->fh, &hdr, &wth->phdr, err, err_info))
+               if (!aethra_read_rec_header(wfth, wfth->fh, &hdr, &wth->phdr, err, err_info))
                        return FALSE;
 
                /*
@@ -203,7 +205,7 @@ static gboolean aethra_read(wtap *wth, int *err, gchar **err_info,
                 * growing the buffer to handle it.
                 */
                if (wth->phdr.caplen != 0) {
-                       if (!wtap_read_packet_bytes(wth->fh, wth->frame_buffer,
+                       if (!wtap_read_packet_bytes(wfth->fh, wfth->frame_buffer,
                            wth->phdr.caplen, err, err_info))
                                return FALSE;   /* Read error */
                }
@@ -274,15 +276,15 @@ found:
 }
 
 static gboolean
-aethra_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
+aethra_seek_read(wftap *wfth, gint64 seek_off, struct wtap_pkthdr *phdr,
     Buffer *buf, int *err, gchar **err_info)
 {
        struct aethrarec_hdr hdr;
 
-       if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+       if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
                return FALSE;
 
-       if (!aethra_read_rec_header(wth, wth->random_fh, &hdr, phdr, err,
+       if (!aethra_read_rec_header(wfth, wfth->random_fh, &hdr, phdr, err,
            err_info)) {
                if (*err == 0)
                        *err = WTAP_ERR_SHORT_READ;
@@ -292,17 +294,17 @@ aethra_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
        /*
         * Read the packet data.
         */
-       if (!wtap_read_packet_bytes(wth->random_fh, buf, phdr->caplen, err, err_info))
+       if (!wtap_read_packet_bytes(wfth->random_fh, buf, phdr->caplen, err, err_info))
                return FALSE;   /* failed */
 
        return TRUE;
 }
 
 static gboolean
-aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr,
+aethra_read_rec_header(wftap *wfth, FILE_T fh, struct aethrarec_hdr *hdr,
     struct wtap_pkthdr *phdr, int *err, gchar **err_info)
 {
-       aethra_t *aethra = (aethra_t *)wth->priv;
+       aethra_t *aethra = (aethra_t *)wfth->priv;
        int     bytes_read;
        guint32 rec_size;
        guint32 packet_size;
index 5c36ff4499c08d3777e7adcf38953c7a1f893b88..992264d500aa16066ae2c9face4413fa90df4eda 100644 (file)
@@ -24,6 +24,6 @@
 #include <glib.h>
 #include <wtap.h>
 
-int aethra_open(wtap *wth, int *err, gchar **err_info);
+int aethra_open(wftap *wfth, int *err, gchar **err_info);
 
 #endif
index 32d4d494184c65c34d7a6903ddfdacfd5f9b230f..e034fab1d2df03192b08394d0e6675084e3cf53b 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "config.h"
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "buffer.h"
 #include "ascendtext.h"
@@ -74,26 +75,27 @@ static const ascend_magic_string ascend_magic[] = {
   { ASCEND_PFX_ETHER,  "ETHER" },
 };
 
-static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
+static gboolean ascend_read(wftap *wfth, int *err, gchar **err_info,
        gint64 *data_offset);
-static gboolean ascend_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf,
+static gboolean ascend_seek_read(wftap *wfth, gint64 seek_off,
+       void* header, Buffer *buf,
        int *err, gchar **err_info);
 
 /* Seeks to the beginning of the next packet, and returns the
    byte offset at which the header for that packet begins.
    Returns -1 on failure. */
-static gint64 ascend_seek(wtap *wth, int *err, gchar **err_info)
+static gint64 ascend_seek(wftap *wfth, int *err, gchar **err_info)
 {
   int byte;
   gint64 date_off = -1, cur_off, packet_off;
   size_t string_level[ASCEND_MAGIC_STRINGS];
   guint string_i = 0, type = 0;
   guint excessive_read_count = 262144;
+  wtap* wth = (wtap*)wfth->tap_specific_data;
 
   memset(&string_level, 0, sizeof(string_level));
 
-  while (((byte = file_getc(wth->fh)) != EOF)) {
+  while (((byte = file_getc(wfth->fh)) != EOF)) {
     excessive_read_count--;
 
     if (!excessive_read_count) {
@@ -108,16 +110,16 @@ static gint64 ascend_seek(wtap *wth, int *err, gchar **err_info)
       if (byte == *(strptr + string_level[string_i])) {
         string_level[string_i]++;
         if (string_level[string_i] >= len) {
-          cur_off = file_tell(wth->fh);
+          cur_off = file_tell(wfth->fh);
           if (cur_off == -1) {
             /* Error. */
-            *err = file_error(wth->fh, err_info);
+            *err = file_error(wfth->fh, err_info);
             return -1;
           }
 
           /* Date: header is a special case. Remember the offset,
              but keep looking for other headers. */
-         if (strcmp(strptr, ASCEND_DATE) == 0) {
+      if (strcmp(strptr, ASCEND_DATE) == 0) {
             date_off = cur_off - len;
           } else {
             if (date_off == -1) {
@@ -140,7 +142,7 @@ static gint64 ascend_seek(wtap *wth, int *err, gchar **err_info)
     }
   }
 
-  *err = file_error(wth->fh, err_info);
+  *err = file_error(wfth->fh, err_info);
   return -1;
 
 found:
@@ -148,7 +150,7 @@ found:
    * Move to where the read for this packet should start, and return
    * that seek offset.
    */
-  if (file_seek(wth->fh, packet_off, SEEK_SET, err) == -1)
+  if (file_seek(wfth->fh, packet_off, SEEK_SET, err) == -1)
     return -1;
 
   wth->phdr.pseudo_header.ascend.type = type;
@@ -156,18 +158,19 @@ found:
   return packet_off;
 }
 
-int ascend_open(wtap *wth, int *err, gchar **err_info)
+int ascend_open(wftap *wfth, int *err, gchar **err_info)
 {
   gint64 offset;
   ws_statb64 statbuf;
   ascend_t *ascend;
+  wtap* wth = (wtap*)wfth->tap_specific_data;
 
   /* We haven't yet allocated a data structure for our private stuff;
      set the pointer to null, so that "ascend_seek()" knows not to
      fill it in. */
-  wth->priv = NULL;
+  wfth->priv = NULL;
 
-  offset = ascend_seek(wth, err, err_info);
+  offset = ascend_seek(wfth, err, err_info);
   if (offset == -1) {
     if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
       return -1;
@@ -176,31 +179,31 @@ int ascend_open(wtap *wth, int *err, gchar **err_info)
 
   /* Do a trial parse of the first packet just found to see if we might really have an Ascend file */
   init_parse_ascend();
-  if (!check_ascend(wth->fh, &wth->phdr)) {
+  if (!check_ascend(wfth->fh, &wth->phdr)) {
     return 0;
   }
 
-  wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ASCEND;
+  wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ASCEND;
 
   switch(wth->phdr.pseudo_header.ascend.type) {
     case ASCEND_PFX_ISDN_X:
     case ASCEND_PFX_ISDN_R:
-      wth->file_encap = WTAP_ENCAP_ISDN;
+      wfth->file_encap = WTAP_ENCAP_ISDN;
       break;
 
     case ASCEND_PFX_ETHER:
-      wth->file_encap = WTAP_ENCAP_ETHERNET;
+      wfth->file_encap = WTAP_ENCAP_ETHERNET;
       break;
 
     default:
-      wth->file_encap = WTAP_ENCAP_ASCEND;
+      wfth->file_encap = WTAP_ENCAP_ASCEND;
   }
 
-  wth->snapshot_length = ASCEND_MAX_PKT_LEN;
-  wth->subtype_read = ascend_read;
-  wth->subtype_seek_read = ascend_seek_read;
+  wfth->snapshot_length = ASCEND_MAX_PKT_LEN;
+  wfth->subtype_read = ascend_read;
+  wfth->subtype_seek_read = ascend_seek_read;
   ascend = (ascend_t *)g_malloc(sizeof(ascend_t));
-  wth->priv = (void *)ascend;
+  wfth->priv = (void *)ascend;
 
   /* The first packet we want to read is the one that "ascend_seek()"
      just found; start searching for it at the offset at which it
@@ -212,12 +215,12 @@ int ascend_open(wtap *wth, int *err, gchar **err_info)
      packet's timestamp from the capture file's ctime, which gives us an
      offset that we can apply to each packet.
    */
-  if (wtap_fstat(wth, &statbuf, err) == -1) {
+  if (wftap_fstat(wfth, &statbuf, err) == -1) {
     return -1;
   }
   ascend->inittime = statbuf.st_ctime;
   ascend->adjusted = FALSE;
-  wth->tsprecision = WTAP_FILE_TSPREC_USEC;
+  wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
 
   init_parse_ascend();
 
@@ -225,25 +228,26 @@ int ascend_open(wtap *wth, int *err, gchar **err_info)
 }
 
 /* Read the next packet; called from wtap_read(). */
-static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
+static gboolean ascend_read(wftap *wfth, int *err, gchar **err_info,
        gint64 *data_offset)
 {
-  ascend_t *ascend = (ascend_t *)wth->priv;
+  ascend_t *ascend = (ascend_t *)wfth->priv;
   gint64 offset;
+  wtap* wth = (wtap*)wfth->tap_specific_data;
 
   /* parse_ascend() will advance the point at which to look for the next
      packet's header, to just after the last packet's header (ie. at the
      start of the last packet's data). We have to get past the last
      packet's header because we might mistake part of it for a new header. */
-  if (file_seek(wth->fh, ascend->next_packet_seek_start,
+  if (file_seek(wfth->fh, ascend->next_packet_seek_start,
                 SEEK_SET, err) == -1)
     return FALSE;
 
-  offset = ascend_seek(wth, err, err_info);
+  offset = ascend_seek(wfth, err, err_info);
   if (offset == -1)
     return FALSE;
-  if (parse_ascend(ascend, wth->fh, &wth->phdr, wth->frame_buffer,
-                   wth->snapshot_length) != PARSED_RECORD) {
+  if (parse_ascend(ascend, wfth->fh, &wth->phdr, wfth->frame_buffer,
+                   wfth->snapshot_length) != PARSED_RECORD) {
     *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup((ascend_parse_error != NULL) ? ascend_parse_error : "parse error");
     return FALSE;
@@ -253,16 +257,17 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
   return TRUE;
 }
 
-static gboolean ascend_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf,
+static gboolean ascend_seek_read(wftap *wfth, gint64 seek_off,
+       void* header, Buffer *buf,
        int *err, gchar **err_info)
 {
-  ascend_t *ascend = (ascend_t *)wth->priv;
+  ascend_t *ascend = (ascend_t *)wfth->priv;
+  struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
 
-  if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+  if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
     return FALSE;
-  if (parse_ascend(ascend, wth->random_fh, phdr, buf,
-                   wth->snapshot_length) != PARSED_RECORD) {
+  if (parse_ascend(ascend, wfth->random_fh, phdr, buf,
+                   wfth->snapshot_length) != PARSED_RECORD) {
     *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup((ascend_parse_error != NULL) ? ascend_parse_error : "parse error");
     return FALSE;
index 369ffa1cd2a3131535912ca01de6b1d2d5e60396..cb4c6c9c73a7ecdb1b1e5057fb13cbabb7527cf3 100644 (file)
@@ -27,6 +27,6 @@
 #define ASCEND_MAX_DATA_COLS 16
 #define ASCEND_MAX_PKT_LEN (ASCEND_MAX_DATA_ROWS * ASCEND_MAX_DATA_COLS)
 
-int ascend_open(wtap *wth, int *err, gchar **err_info);
+int ascend_open(wftap *wfth, int *err, gchar **err_info);
 
 #endif
index 59e7e28f3964a1d9f0ed82ce7d54ae5cbe445781..c022d9bb4574de01de0706a4834efdab56d29644 100644 (file)
@@ -25,6 +25,7 @@
 #include <sys/stat.h>
 #endif
 
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "file_wrappers.h"
 #include "buffer.h"
 #define BER_UNI_TAG_SEQ        16      /* SEQUENCE, SEQUENCE OF */
 #define BER_UNI_TAG_SET        17      /* SET, SET OF */
 
-static gboolean ber_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
+static gboolean ber_read_file(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
                               Buffer *buf, int *err, gchar **err_info)
 {
   gint64 file_size;
   int packet_size;
 
-  if ((file_size = wtap_file_size(wth, err)) == -1)
+  if ((file_size = wftap_file_size(wfth, err)) == -1)
     return FALSE;
 
   if (file_size > WTAP_MAX_PACKET_SIZE) {
@@ -54,7 +55,7 @@ static gboolean ber_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
      */
     *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup_printf("ber: File has %" G_GINT64_MODIFIER "d-byte packet, bigger than maximum of %u",
-                               file_size, WTAP_MAX_PACKET_SIZE);
+                                file_size, WTAP_MAX_PACKET_SIZE);
     return FALSE;
   }
   packet_size = (int)file_size;
@@ -70,13 +71,14 @@ static gboolean ber_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
   return wtap_read_packet_bytes(fh, buf, packet_size, err, err_info);
 }
 
-static gboolean ber_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
+static gboolean ber_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
 {
   gint64 offset;
+  wtap* wth = (wtap*)wfth->tap_specific_data;
 
   *err = 0;
 
-  offset = file_tell(wth->fh);
+  offset = file_tell(wfth->fh);
 
   /* there is only ever one packet */
   if (offset != 0)
@@ -84,25 +86,27 @@ static gboolean ber_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off
 
   *data_offset = offset;
 
-  return ber_read_file(wth, wth->fh, &wth->phdr, wth->frame_buffer, err, err_info);
+  return ber_read_file(wfth, wfth->fh, &wth->phdr, wfth->frame_buffer, err, err_info);
 }
 
-static gboolean ber_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr _U_,
-                             Buffer *buf, int *err, gchar **err_info)
+static gboolean ber_seek_read(wftap *wfth, gint64 seek_off, void* header,
+                              Buffer *buf, int *err, gchar **err_info)
 {
+  struct wtap_pkthdr *phdr = (struct wtap_pkthdr*)header;
+
   /* there is only one packet */
   if(seek_off > 0) {
     *err = 0;
     return FALSE;
   }
 
-  if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+  if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
     return FALSE;
 
-  return ber_read_file(wth, wth->random_fh, phdr, buf, err, err_info);
+  return ber_read_file(wfth, wfth->random_fh, phdr, buf, err, err_info);
 }
 
-int ber_open(wtap *wth, int *err, gchar **err_info)
+int ber_open(wftap *wfth, int *err, gchar **err_info)
 {
 #define BER_BYTES_TO_CHECK 8
   guint8 bytes[BER_BYTES_TO_CHECK];
@@ -116,9 +120,9 @@ int ber_open(wtap *wth, int *err, gchar **err_info)
   gint64 file_size;
   int offset = 0, i;
 
-  bytes_read = file_read(&bytes, BER_BYTES_TO_CHECK, wth->fh);
+  bytes_read = file_read(&bytes, BER_BYTES_TO_CHECK, wfth->fh);
   if (bytes_read != BER_BYTES_TO_CHECK) {
-    *err = file_error(wth->fh, err_info);
+    *err = file_error(wfth->fh, err_info);
     if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
       return -1;
     return 0;
@@ -161,7 +165,7 @@ int ber_open(wtap *wth, int *err, gchar **err_info)
     }
 
     len += (2 + nlb); /* add back Tag and Length bytes */
-    file_size = wtap_file_size(wth, err);
+    file_size = wftap_file_size(wfth, err);
 
     if(len != file_size) {
       return 0; /* not ASN.1 */
@@ -171,16 +175,16 @@ int ber_open(wtap *wth, int *err, gchar **err_info)
   }
 
   /* seek back to the start of the file  */
-  if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
+  if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
     return -1;
 
-  wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_BER;
-  wth->file_encap = WTAP_ENCAP_BER;
-  wth->snapshot_length = 0;
+  wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_BER;
+  wfth->file_encap = WTAP_ENCAP_BER;
+  wfth->snapshot_length = 0;
 
-  wth->subtype_read = ber_read;
-  wth->subtype_seek_read = ber_seek_read;
-  wth->tsprecision = WTAP_FILE_TSPREC_SEC;
+  wfth->subtype_read = ber_read;
+  wfth->subtype_seek_read = ber_seek_read;
+  wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
 
   return 1;
 }
index 0448ad6bb85e3f3b300776a328dffdff7e8f8f0a..40b336a00616aee226ef1a84134976a930d62207 100644 (file)
@@ -23,6 +23,6 @@
 #include <glib.h>
 #include "ws_symbol_export.h"
 
-int ber_open(wtap *wth, int *err, gchar **err_info);
+int ber_open(wftap *wfth, int *err, gchar **err_info);
 
 #endif
index b7c0b4c5c55168d304d13f1a06be568b447485c9..569371b328562a962e7a344ed5489dbca46519f1 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #include <errno.h>
 #include <string.h>
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "file_wrappers.h"
 #include "buffer.h"
@@ -73,14 +74,14 @@ struct btsnooprec_hdr {
 
 static const gint64 KUnixTimeBase = G_GINT64_CONSTANT(0x00dcddb30f2f8000); /* offset from symbian - unix time */
 
-static gboolean btsnoop_read(wtap *wth, int *err, gchar **err_info,
-    gint64 *data_offset);
-static gboolean btsnoop_seek_read(wtap *wth, gint64 seek_off,
-    struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-static gboolean btsnoop_read_record(wtap *wth, FILE_T fh,
+static gboolean btsnoop_read(wftap *wfth, int *err, gchar **err_info,
+     gint64 *data_offset);
+static gboolean btsnoop_seek_read(wftap *wfth, gint64 seek_off,
+    void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean btsnoop_read_record(wftap *wfth, FILE_T fh,
     struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
 
-int btsnoop_open(wtap *wth, int *err, gchar **err_info)
+int btsnoop_open(wftap *wfth, int *err, gchar **err_info)
 {
        int bytes_read;
        char magic[sizeof btsnoop_magic];
@@ -90,9 +91,9 @@ int btsnoop_open(wtap *wth, int *err, gchar **err_info)
 
        /* Read in the string that should be at the start of a "btsnoop" file */
        errno = WTAP_ERR_CANT_READ;
-       bytes_read = file_read(magic, sizeof magic, wth->fh);
+       bytes_read = file_read(magic, sizeof magic, wfth->fh);
        if (bytes_read != sizeof magic) {
-               *err = file_error(wth->fh, err_info);
+               *err = file_error(wfth->fh, err_info);
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
@@ -104,9 +105,9 @@ int btsnoop_open(wtap *wth, int *err, gchar **err_info)
 
        /* Read the rest of the header. */
        errno = WTAP_ERR_CANT_READ;
-       bytes_read = file_read(&hdr, sizeof hdr, wth->fh);
+       bytes_read = file_read(&hdr, sizeof hdr, wfth->fh);
        if (bytes_read != sizeof hdr) {
-               *err = file_error(wth->fh, err_info);
+               *err = file_error(wfth->fh, err_info);
                if (*err == 0)
                        *err = WTAP_ERR_SHORT_READ;
                return -1;
@@ -151,34 +152,36 @@ int btsnoop_open(wtap *wth, int *err, gchar **err_info)
                return -1;
        }
 
-       wth->subtype_read = btsnoop_read;
-       wth->subtype_seek_read = btsnoop_seek_read;
-       wth->file_encap = file_encap;
-       wth->snapshot_length = 0;       /* not available in header */
-       wth->tsprecision = WTAP_FILE_TSPREC_USEC;
-       wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_BTSNOOP;
+       wfth->subtype_read = btsnoop_read;
+       wfth->subtype_seek_read = btsnoop_seek_read;
+       wfth->file_encap = file_encap;
+       wfth->snapshot_length = 0;      /* not available in header */
+       wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+       wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_BTSNOOP;
        return 1;
 }
 
-static gboolean btsnoop_read(wtap *wth, int *err, gchar **err_info,
+static gboolean btsnoop_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 btsnoop_read_record(wth, wth->fh, &wth->phdr, wth->frame_buffer,
+       return btsnoop_read_record(wfth, wfth->fh, &wth->phdr, wfth->frame_buffer,
            err, err_info);
 }
 
-static gboolean btsnoop_seek_read(wtap *wth, gint64 seek_off,
-    struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
+static gboolean btsnoop_seek_read(wftap *wfth, gint64 seek_off,
+    void* header, Buffer *buf, int *err, gchar **err_info)
 {
-       if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+       struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
+       if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
                return FALSE;
 
-       return btsnoop_read_record(wth, wth->random_fh, phdr, buf, err, err_info);
+       return btsnoop_read_record(wfth, wfth->random_fh, phdr, buf, err, err_info);
 }
 
-static gboolean btsnoop_read_record(wtap *wth, FILE_T fh,
+static gboolean btsnoop_read_record(wftap *wfth, FILE_T fh,
     struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
 {
        int     bytes_read;
@@ -221,10 +224,12 @@ static gboolean btsnoop_read_record(wtap *wth, FILE_T fh,
        phdr->ts.nsecs = (guint)((ts % 1000000) * 1000);
        phdr->caplen = packet_size;
        phdr->len = orig_size;
-       if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR)
+       switch(wfth->file_encap)
        {
+       case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
                phdr->pseudo_header.p2p.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE;
-       } else if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_HCI) {
+               break;
+       case WTAP_ENCAP_BLUETOOTH_HCI:
                phdr->pseudo_header.bthci.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE;
                if(flags & KHciLoggerCommandOrEvent)
                {
@@ -241,12 +246,13 @@ static gboolean btsnoop_read_record(wtap *wth, FILE_T fh,
                {
                        phdr->pseudo_header.bthci.channel = BTHCI_CHANNEL_ACL;
                }
-       } else  if (wth->file_encap == WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR) {
+               break;
+       case WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR:
                phdr->pseudo_header.btmon.opcode = flags & 0xFFFF;
                phdr->pseudo_header.btmon.adapter_id = flags >> 16;
+               break;
        }
 
-
        /* Read packet data. */
        return wtap_read_packet_bytes(fh, buf, phdr->caplen, err, err_info);
 }
@@ -297,7 +303,7 @@ static guint8 btsnoop_lookup_flags(guint8 hci_type, gboolean sent, guint8 *flags
     return FALSE;
 }
 
-static gboolean btsnoop_dump_partial_rec_hdr(wtap_dumper *wdh _U_,
+static gboolean btsnoop_dump_partial_rec_hdr(wftap_dumper *wdh _U_,
     const struct wtap_pkthdr *phdr,
     const union wtap_pseudo_header *pseudo_header,
     const guint8 *pd, int *err,
@@ -324,10 +330,10 @@ static gboolean btsnoop_dump_partial_rec_hdr(wtap_dumper *wdh _U_,
 }
 
 /* FIXME: How do we support multiple backends?*/
-static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
-    const struct wtap_pkthdr *phdr,
+static gboolean btsnoop_dump_h1(wftap_dumper *wdh, void* header,
     const guint8 *pd, int *err)
 {
+    const struct wtap_pkthdr *phdr = (const struct wtap_pkthdr *)header;
     const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
     struct btsnooprec_hdr rec_hdr;
 
@@ -346,7 +352,7 @@ static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
     rec_hdr.incl_len = GUINT32_TO_BE(phdr->caplen-1);
     rec_hdr.orig_len = GUINT32_TO_BE(phdr->len-1);
 
-    if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
+    if (!wftap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
         return FALSE;
 
     wdh->bytes_dumped += sizeof rec_hdr;
@@ -354,7 +360,7 @@ static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
     /* Skip HCI packet type */
     ++pd;
 
-    if (!wtap_dump_file_write(wdh, pd, phdr->caplen-1, err))
+    if (!wftap_dump_file_write(wdh, pd, phdr->caplen-1, err))
         return FALSE;
 
     wdh->bytes_dumped += phdr->caplen-1;
@@ -362,7 +368,7 @@ static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
     return TRUE;
 }
 
-static gboolean btsnoop_dump_h4(wtap_dumper *wdh,
+static gboolean btsnoop_dump_h4(wftap_dumper *wdh,
     const struct wtap_pkthdr *phdr,
     const guint8 *pd, int *err)
 {
@@ -381,12 +387,12 @@ static gboolean btsnoop_dump_h4(wtap_dumper *wdh,
     rec_hdr.incl_len = GUINT32_TO_BE(phdr->caplen);
     rec_hdr.orig_len = GUINT32_TO_BE(phdr->len);
 
-    if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
+    if (!wftap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
         return FALSE;
 
     wdh->bytes_dumped += sizeof rec_hdr;
 
-    if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
+    if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
         return FALSE;
 
     wdh->bytes_dumped += phdr->caplen;
@@ -395,7 +401,7 @@ static gboolean btsnoop_dump_h4(wtap_dumper *wdh,
 }
 
 /* FIXME: How do we support multiple backends?*/
-gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err)
+gboolean btsnoop_dump_open_h1(wftap_dumper *wdh, int *err)
 {
     struct btsnoop_hdr file_hdr;
 
@@ -417,7 +423,7 @@ gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err)
         return FALSE;
     }
 
-    if (!wtap_dump_file_write(wdh, btsnoop_magic, sizeof btsnoop_magic, err))
+    if (!wftap_dump_file_write(wdh, btsnoop_magic, sizeof btsnoop_magic, err))
         return FALSE;
 
     wdh->bytes_dumped += sizeof btsnoop_magic;
@@ -427,7 +433,7 @@ gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err)
     /* HCI type encoded in first byte */
     file_hdr.datalink = GUINT32_TO_BE(KHciLoggerDatalinkTypeH1);
 
-    if (!wtap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
+    if (!wftap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
         return FALSE;
 
     wdh->bytes_dumped += sizeof file_hdr;
@@ -437,7 +443,7 @@ gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err)
 
 /* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
    failure */
-gboolean btsnoop_dump_open_h4(wtap_dumper *wdh, int *err)
+gboolean btsnoop_dump_open_h4(wftap_dumper *wdh, int *err)
 {
     struct btsnoop_hdr file_hdr;
 
@@ -459,7 +465,7 @@ gboolean btsnoop_dump_open_h4(wtap_dumper *wdh, int *err)
         return FALSE;
     }
 
-    if (!wtap_dump_file_write(wdh, btsnoop_magic, sizeof btsnoop_magic, err))
+    if (!wftap_dump_file_write(wdh, btsnoop_magic, sizeof btsnoop_magic, err))
         return FALSE;
 
     wdh->bytes_dumped += sizeof btsnoop_magic;
@@ -469,7 +475,7 @@ gboolean btsnoop_dump_open_h4(wtap_dumper *wdh, int *err)
     /* HCI type encoded in first byte */
     file_hdr.datalink = GUINT32_TO_BE(KHciLoggerDatalinkTypeH4);
 
-    if (!wtap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
+    if (!wftap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
         return FALSE;
 
     wdh->bytes_dumped += sizeof file_hdr;
index 66f699b448950d8cd243aefd338eb5d585690abd..01794b5f92fc1f09a9402be8106d632f3860e4d8 100644 (file)
@@ -23,9 +23,9 @@
 #include <glib.h>
 #include "ws_symbol_export.h"
 
-int btsnoop_open(wtap *wth, int *err, gchar **err_info);
-gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err);
-gboolean btsnoop_dump_open_h4(wtap_dumper *wdh, int *err);
+int btsnoop_open(wftap *wfth, int *err, gchar **err_info);
+gboolean btsnoop_dump_open_h1(wftap_dumper *wfdh, int *err);
+gboolean btsnoop_dump_open_h4(wftap_dumper *wfdh, int *err);
 int btsnoop_dump_can_write_encap(int encap);
 
 #endif
index ccc618498aa1b55a14e6187a8223457f53fa7ce7..b1edeff158a8bea5863fcc8a4402729320776e8d 100644 (file)
@@ -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;
index 785488e361f9a74d225f46b992f485b8f36cc35d..993bedad0e1929e47842b10b3b78047dc8452760 100644 (file)
@@ -28,6 +28,6 @@
 #include <glib.h>
 #include <wiretap/wtap.h>
 
-int camins_open(wtap *wth, int *err, gchar **err_info);
+int camins_open(wftap *wfth, int *err, gchar **err_info);
 
 #endif /* _CAMINS_H */
index 8b29a23880a2bf049b967712660549621f1adbfc..e129e9a6ea8d0d87ad57b165a75f4ffc93b6f77d 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "file_wrappers.h"
 #include "buffer.h"
@@ -103,15 +104,15 @@ static const gchar catapult_dct2000_magic[] = "Session Transcript";
 
 /************************************************************/
 /* Functions called from wiretap core                       */
-static gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
+static gboolean catapult_dct2000_read(wftap *wfth, int *err, gchar **err_info,
                                       gint64 *data_offset);
-static gboolean catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
-                                           struct wtap_pkthdr *phdr,
+static gboolean catapult_dct2000_seek_read(wftap *wfth, gint64 seek_off,
+                                           void* header,
                                            Buffer *buf, int *err,
                                            gchar **err_info);
-static void catapult_dct2000_close(wtap *wth);
+static void catapult_dct2000_close(wftap *wfth);
 
-static gboolean catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static gboolean catapult_dct2000_dump(wftap_dumper *wdh, void* header,
                                       const guint8 *pd, int *err);
 
 
@@ -131,7 +132,7 @@ static gboolean parse_line(char *linebuff, gint line_length,
                            gchar *context_name, guint8 *context_portp,
                            gchar *protocol_name, gchar *variant_name,
                            gchar *outhdr_name);
-static void process_parsed_line(wtap *wth,
+static void process_parsed_line(wftap *wfth,
                                 dct2000_file_externals_t *file_externals,
                                 struct wtap_pkthdr *phdr,
                                 Buffer *buf, gint64 file_offset,
@@ -167,7 +168,7 @@ static gboolean free_line_prefix_info(gpointer key, gpointer value, gpointer use
 /* Open file (for reading)                 */
 /********************************************/
 int
-catapult_dct2000_open(wtap *wth, int *err, gchar **err_info)
+catapult_dct2000_open(wftap *wfth, int *err, gchar **err_info)
 {
     gint64  offset = 0;
     time_t  timestamp;
@@ -184,7 +185,7 @@ catapult_dct2000_open(wtap *wth, int *err, gchar **err_info)
     /********************************************************************/
     /* First line needs to contain at least as many characters as magic */
 
-    if (!read_new_line(wth->fh, &offset, &firstline_length, linebuff,
+    if (!read_new_line(wfth->fh, &offset, &firstline_length, linebuff,
                        sizeof linebuff, err, err_info)) {
         if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
             return -1;
@@ -223,7 +224,7 @@ catapult_dct2000_open(wtap *wth, int *err, gchar **err_info)
     /* Second line contains file timestamp                     */
     /* Store this offset in in file_externals                  */
 
-    if (!read_new_line(wth->fh, &offset, &(file_externals->secondline_length),
+    if (!read_new_line(wfth->fh, &offset, &(file_externals->secondline_length),
                        linebuff, sizeof linebuff, err, err_info)) {
         g_free(file_externals);
         if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
@@ -250,18 +251,18 @@ catapult_dct2000_open(wtap *wth, int *err, gchar **err_info)
     /* File is for us. Fill in details so packets can be read   */
 
     /* Set our file type */
-    wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000;
+    wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000;
 
     /* Use our own encapsulation to send all packets to our stub dissector */
-    wth->file_encap = WTAP_ENCAP_CATAPULT_DCT2000;
+    wfth->file_encap = WTAP_ENCAP_CATAPULT_DCT2000;
 
     /* Callbacks for reading operations */
-    wth->subtype_read = catapult_dct2000_read;
-    wth->subtype_seek_read = catapult_dct2000_seek_read;
-    wth->subtype_close = catapult_dct2000_close;
+    wfth->subtype_read = catapult_dct2000_read;
+    wfth->subtype_seek_read = catapult_dct2000_seek_read;
+    wfth->subtype_close = catapult_dct2000_close;
 
     /* Choose microseconds (have 4 decimal places...) */
-    wth->tsprecision = WTAP_FILE_TSPREC_USEC;
+    wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
 
 
     /***************************************************************/
@@ -270,7 +271,7 @@ catapult_dct2000_open(wtap *wth, int *err, gchar **err_info)
         g_hash_table_new(packet_offset_hash_func, packet_offset_equal);
 
     /* Set this wtap to point to the file_externals */
-    wth->priv = (void*)file_externals;
+    wfth->priv = (void*)file_externals;
 
     *err = errno;
     return 1;
@@ -334,17 +335,18 @@ static void write_timestamp_string(char *timestamp_string, int secs, int tenthou
 /* - return TRUE and details if found             */
 /**************************************************/
 static gboolean
-catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
+catapult_dct2000_read(wftap *wfth, int *err, gchar **err_info,
                       gint64 *data_offset)
 {
-    gint64 offset = file_tell(wth->fh);
+    gint64 offset = file_tell(wfth->fh);
     long dollar_offset, before_time_offset, after_time_offset;
     packet_direction_t direction;
     int encap;
+    wtap* wth = (wtap*)wfth->tap_specific_data;
 
     /* Get wtap external structure for this wtap */
     dct2000_file_externals_t *file_externals =
-        (dct2000_file_externals_t*)wth->priv;
+        (dct2000_file_externals_t*)wfth->priv;
 
     /* Search for a line containing a usable packet */
     while (1) {
@@ -361,13 +363,13 @@ catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
         gchar outhdr_name[MAX_OUTHDR_NAME+1];
 
         /* Are looking for first packet after 2nd line */
-        if (file_tell(wth->fh) == 0) {
+        if (file_tell(wfth->fh) == 0) {
             this_offset += (file_externals->firstline_length+1+
                             file_externals->secondline_length+1);
         }
 
         /* Read a new line from file into linebuff */
-        if (!read_new_line(wth->fh, &offset, &line_length, linebuff,
+        if (!read_new_line(wfth->fh, &offset, &line_length, linebuff,
                            sizeof linebuff, err, err_info)) {
             if (*err != 0)
                 return FALSE;  /* error */
@@ -394,9 +396,9 @@ catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
             */
             *data_offset = this_offset;
 
-            process_parsed_line(wth, file_externals,
+            process_parsed_line(wfth, file_externals,
                                 &wth->phdr,
-                                wth->frame_buffer, this_offset,
+                                wfth->frame_buffer, this_offset,
                                 linebuff, dollar_offset,
                                 seconds, useconds, timestamp_string,
                                 direction, encap,
@@ -447,8 +449,8 @@ catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
 /* Read & seek function.                          */
 /**************************************************/
 static gboolean
-catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
-                           struct wtap_pkthdr *phdr, Buffer *buf,
+catapult_dct2000_seek_read(wftap *wfth, gint64 seek_off,
+                           void* header, Buffer *buf,
                            int *err, gchar **err_info)
 {
     gint64 offset = 0;
@@ -466,21 +468,22 @@ catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
     packet_direction_t direction;
     int encap;
     int seconds, useconds, data_chars;
+    struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
 
     /* Get wtap external structure for this wtap */
     dct2000_file_externals_t *file_externals =
-        (dct2000_file_externals_t*)wth->priv;
+        (dct2000_file_externals_t*)wfth->priv;
 
     /* Reset errno */
     *err = errno = 0;
 
     /* Seek to beginning of packet */
-    if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
+    if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1) {
         return FALSE;
     }
 
     /* Re-read whole line (this really should succeed) */
-    if (!read_new_line(wth->random_fh, &offset, &length, linebuff,
+    if (!read_new_line(wfth->random_fh, &offset, &length, linebuff,
                       sizeof linebuff, err, err_info)) {
         return FALSE;
     }
@@ -497,7 +500,7 @@ catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
 
         write_timestamp_string(timestamp_string, seconds, useconds/100);
 
-        process_parsed_line(wth, file_externals,
+        process_parsed_line(wfth, file_externals,
                             phdr, buf, seek_off,
                             linebuff, dollar_offset,
                             seconds, useconds, timestamp_string,
@@ -524,11 +527,11 @@ catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
 /* Free dct2000-specific capture info from file that was open for reading  */
 /***************************************************************************/
 static void
-catapult_dct2000_close(wtap *wth)
+catapult_dct2000_close(wftap *wfth)
 {
     /* Get externals for this file */
     dct2000_file_externals_t *file_externals =
-        (dct2000_file_externals_t*)wth->priv;
+        (dct2000_file_externals_t*)wfth->priv;
 
     /* Free up its line prefix values */
     g_hash_table_foreach_remove(file_externals->packet_prefix_table,
@@ -554,7 +557,7 @@ typedef struct {
 /* Set other dump callbacks.                         */
 /*****************************************************/
 gboolean
-catapult_dct2000_dump_open(wtap_dumper *wdh, int *err _U_)
+catapult_dct2000_dump_open(wftap_dumper *wdh, int *err _U_)
 {
     /* Fill in other dump callbacks */
     wdh->subtype_write = catapult_dct2000_dump;
@@ -586,7 +589,7 @@ catapult_dct2000_dump_can_write_encap(int encap)
 /*****************************************/
 
 static gboolean
-catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
+catapult_dct2000_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
                       const guint8 *pd, int *err)
 {
     const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
@@ -603,28 +606,28 @@ catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
     /* Get the file_externals structure for this file */
     /* Find wtap external structure for this wtap */
     dct2000_file_externals_t *file_externals =
-        (dct2000_file_externals_t*)pseudo_header->dct2000.wth->priv;
+        (dct2000_file_externals_t*)pseudo_header->dct2000.wfth->priv;
 
     dct2000 = (dct2000_dump_t *)wdh->priv;
     if (dct2000 == NULL) {
 
         /* Write out saved first line */
-        if (!wtap_dump_file_write(wdh, file_externals->firstline,
+        if (!wftap_dump_file_write(wdh, file_externals->firstline,
                                   file_externals->firstline_length, err)) {
             return FALSE;
         }
-        if (!wtap_dump_file_write(wdh, "\n", 1, err)) {
+        if (!wftap_dump_file_write(wdh, "\n", 1, err)) {
             return FALSE;
         }
 
         /* Also write out saved second line with timestamp corresponding to the
            opening time of the log.
         */
-        if (!wtap_dump_file_write(wdh, file_externals->secondline,
+        if (!wftap_dump_file_write(wdh, file_externals->secondline,
                                   file_externals->secondline_length, err)) {
             return FALSE;
         }
-        if (!wtap_dump_file_write(wdh, "\n", 1, err)) {
+        if (!wftap_dump_file_write(wdh, "\n", 1, err)) {
             return FALSE;
         }
 
@@ -650,7 +653,7 @@ catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
                                                       (const void*)&(pseudo_header->dct2000.seek_off));
 
     /* Write out text before timestamp */
-    if (!wtap_dump_file_write(wdh, prefix->before_time,
+    if (!wftap_dump_file_write(wdh, prefix->before_time,
                               strlen(prefix->before_time), err)) {
         return FALSE;
     }
@@ -680,18 +683,18 @@ catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
     }
 
     /* Write out the calculated timestamp */
-    if (!wtap_dump_file_write(wdh, time_string, strlen(time_string), err)) {
+    if (!wftap_dump_file_write(wdh, time_string, strlen(time_string), err)) {
         return FALSE;
     }
 
     /* Write out text between timestamp and start of hex data */
     if (prefix->after_time == NULL) {
-        if (!wtap_dump_file_write(wdh, " l ", strlen(" l "), err)) {
+        if (!wftap_dump_file_write(wdh, " l ", strlen(" l "), err)) {
             return FALSE;
         }
     }
     else {
-        if (!wtap_dump_file_write(wdh, prefix->after_time,
+        if (!wftap_dump_file_write(wdh, prefix->after_time,
                                   strlen(prefix->after_time), err)) {
             return FALSE;
         }
@@ -733,7 +736,7 @@ catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
 
     /**************************************/
     /* Remainder is encapsulated protocol */
-    if (!wtap_dump_file_write(wdh, is_sprint ? " " : "$", 1, err)) {
+    if (!wftap_dump_file_write(wdh, is_sprint ? " " : "$", 1, err)) {
         return FALSE;
     }
 
@@ -745,7 +748,7 @@ catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
             c[1] = char_from_hex((guint8)(pd[n] & 0x0f));
 
             /* Write both hex chars of byte together */
-            if (!wtap_dump_file_write(wdh, c, 2, err)) {
+            if (!wftap_dump_file_write(wdh, c, 2, err)) {
                 return FALSE;
             }
         }
@@ -756,14 +759,14 @@ catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
             c[0] = pd[n];
 
             /* Write both hex chars of byte together */
-            if (!wtap_dump_file_write(wdh, c, 1, err)) {
+            if (!wftap_dump_file_write(wdh, c, 1, err)) {
                 return FALSE;
             }
         }
     }
 
     /* End the line */
-    if (!wtap_dump_file_write(wdh, "\n", 1, err)) {
+    if (!wftap_dump_file_write(wdh, "\n", 1, err)) {
         return FALSE;
     }
 
@@ -1260,7 +1263,7 @@ parse_line(gchar *linebuff, gint line_length,
 /* Process results of parse_line() */
 /***********************************/
 static void
-process_parsed_line(wtap *wth, dct2000_file_externals_t *file_externals,
+process_parsed_line(wftap *wfth, dct2000_file_externals_t *file_externals,
                     struct wtap_pkthdr *phdr,
                     Buffer *buf, gint64 file_offset,
                     char *linebuff, long dollar_offset,
@@ -1361,7 +1364,7 @@ process_parsed_line(wtap *wth, dct2000_file_externals_t *file_externals,
     /*****************************************/
     /* Set packet pseudo-header if necessary */
     phdr->pseudo_header.dct2000.seek_off = file_offset;
-    phdr->pseudo_header.dct2000.wth = wth;
+    phdr->pseudo_header.dct2000.wfth = wfth;
 
     switch (encap) {
         case WTAP_ENCAP_ATM_PDUS_UNTRUNCATED:
index e145a643d9b756669ef5135f3606f36fe91c444d..be0d89d9cdf1b9400e1fab1ed1835da7bfee2468 100644 (file)
@@ -24,8 +24,8 @@
 #include <glib.h>
 #include "ws_symbol_export.h"
 
-int catapult_dct2000_open(wtap *wth, int *err, gchar **err_info);
-gboolean catapult_dct2000_dump_open(wtap_dumper *wdh, int *err);
+int catapult_dct2000_open(wftap *wfth, int *err, gchar **err_info);
+gboolean catapult_dct2000_dump_open(wftap_dumper *wdh, int *err);
 int catapult_dct2000_dump_can_write_encap(int encap);
 
 #define DCT2000_ENCAP_UNHANDLED 0
index e2a868a6b27c0cb80122c2dcdfa08bcf29632095..3dd05472188e018cf108cf525a8b50f4bbd7172d 100644 (file)
@@ -37,6 +37,7 @@
 #include <string.h>
 
 #include "wtap.h"
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "buffer.h"
 #include "file_wrappers.h"
@@ -78,21 +79,20 @@ typedef struct commview_header {
 #define MEDIUM_WIFI            1
 #define MEDIUM_TOKEN_RING      2
 
-static gboolean commview_read(wtap *wth, int *err, gchar **err_info,
-                             gint64 *data_offset);
-static gboolean commview_seek_read(wtap *wth, gint64 seek_off,
-                                  struct wtap_pkthdr *phdr,
-                                  Buffer *buf, int *err, gchar **err_info);
+static gboolean commview_read(wftap *wfth, int *err, gchar **err_info,
+                              gint64 *data_offset);
+static gboolean commview_seek_read(wftap *wfth, gint64 seek_off,
+                              void* header, Buffer *buf, int *err, gchar **err_info);
 static gboolean commview_read_header(commview_header_t *cv_hdr, FILE_T fh,
-                                    int *err, gchar **err_info);
-static gboolean commview_dump(wtap_dumper *wdh,        const struct wtap_pkthdr *phdr,
-                             const guint8 *pd, int *err);
+                                     int *err, gchar **err_info);
+static gboolean commview_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+                              const guint8 *pd, int *err);
 
-int commview_open(wtap *wth, int *err, gchar **err_info)
+int commview_open(wftap *wfth, int *err, gchar **err_info)
 {
        commview_header_t cv_hdr;
 
-       if(!commview_read_header(&cv_hdr, wth->fh, err, err_info)) {
+       if(!commview_read_header(&cv_hdr, wfth->fh, err, err_info)) {
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
@@ -114,16 +114,16 @@ int commview_open(wtap *wth, int *err, gchar **err_info)
                return 0; /* Not our kind of file */
 
        /* No file header. Reset the fh to 0 so we can read the first packet */
-       if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
+       if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
                return -1;
 
        /* Set up the pointers to the handlers for this file type */
-       wth->subtype_read = commview_read;
-       wth->subtype_seek_read = commview_seek_read;
+       wfth->subtype_read = commview_read;
+       wfth->subtype_seek_read = commview_seek_read;
 
-       wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_COMMVIEW;
-       wth->file_encap = WTAP_ENCAP_PER_PACKET;
-       wth->tsprecision = WTAP_FILE_TSPREC_USEC;
+       wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_COMMVIEW;
+       wfth->file_encap = WTAP_ENCAP_PER_PACKET;
+       wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
 
        return 1; /* Our kind of file */
 }
@@ -185,22 +185,24 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
 }
 
 static gboolean
-commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
+commview_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 commview_read_packet(wth->fh, &wth->phdr, wth->frame_buffer, err,
+       return commview_read_packet(wfth->fh, &wth->phdr, wfth->frame_buffer, err,
            err_info);
 }
 
 static gboolean
-commview_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
+commview_seek_read(wftap *wfth, gint64 seek_off, void* header,
                   Buffer *buf, int *err, gchar **err_info)
 {
-       if(file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+       struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
+       if(file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
                return FALSE;
 
-       return commview_read_packet(wth->random_fh, phdr, buf, err, err_info);
+       return commview_read_packet(wfth->random_fh, phdr, buf, err, err_info);
 }
 
 static gboolean
@@ -255,7 +257,7 @@ int commview_dump_can_write_encap(int encap)
 
 /* Returns TRUE on success, FALSE on failure;
    sets "*err" to an error code on failure */
-gboolean commview_dump_open(wtap_dumper *wdh, int *err _U_)
+gboolean commview_dump_open(wftap_dumper *wdh, int *err _U_)
 {
        wdh->subtype_write = commview_dump;
        wdh->subtype_close = NULL;
@@ -268,7 +270,7 @@ gboolean commview_dump_open(wtap_dumper *wdh, int *err _U_)
 
 /* Write a record for a packet to a dump file.
  * Returns TRUE on success, FALSE on failure. */
-static gboolean commview_dump(wtap_dumper *wdh,
+static gboolean commview_dump(wftap_dumper *wdh,
                              const struct wtap_pkthdr *phdr,
                              const guint8 *pd, int *err)
 {
@@ -326,45 +328,45 @@ static gboolean commview_dump(wtap_dumper *wdh,
                return FALSE;
        }
 
-       if (!wtap_dump_file_write(wdh, &cv_hdr.data_len, 2, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.data_len, 2, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.source_data_len, 2, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.source_data_len, 2, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.version, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.version, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.year, 2, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.year, 2, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.month, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.month, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.day, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.day, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.hours, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.hours, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.minutes, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.minutes, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.seconds, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.seconds, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.usecs, 4, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.usecs, 4, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.flags, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.flags, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.signal_level_percent, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.signal_level_percent, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.rate, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.rate, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.band, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.band, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.channel, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.channel, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.direction, 1, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.direction, 1, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.signal_level_dbm, 2, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.signal_level_dbm, 2, err))
                return FALSE;
-       if (!wtap_dump_file_write(wdh, &cv_hdr.noise_level, 2, err))
+       if (!wftap_dump_file_write(wdh, &cv_hdr.noise_level, 2, err))
                return FALSE;
        wdh->bytes_dumped += COMMVIEW_HEADER_SIZE;
 
-       if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
+       if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
                return FALSE;
        wdh->bytes_dumped += phdr->caplen;
 
index 7c02006b48b32db636ec9e94641420fe63e8db81..87f3d2d9ae88db9ff8d79327f3893d03919e7ef9 100644 (file)
@@ -25,9 +25,9 @@
 #include <glib.h>
 #include "ws_symbol_export.h"
 
-int commview_open(wtap *wth, int *err, gchar **err_info _U_);
+int commview_open(wftap *wfth, int *err, gchar **err_info _U_);
 int commview_dump_can_write_encap(int encap);
-gboolean commview_dump_open(wtap_dumper *wdh, int *err);
+gboolean commview_dump_open(wftap_dumper *wdh, int *err);
 
 #endif /* __COMMVIEW_H__ */
 
index d9370187968385bf4e7988f26928f2b975223971..8d6b905d8611af0dfcf58f5635ad2a556589ea7e 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "config.h"
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "buffer.h"
 #include "cosine.h"
 #define COSINE_MAX_PACKET_LEN  65536
 
 static gboolean empty_line(const gchar *line);
-static gint64 cosine_seek_next_packet(wtap *wth, int *err, gchar **err_info,
+static gint64 cosine_seek_next_packet(wftap *wfth, int *err, gchar **err_info,
        char *hdr);
-static gboolean cosine_check_file_type(wtap *wth, int *err, gchar **err_info);
-static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
+static gboolean cosine_check_file_type(wftap *wfth, int *err, gchar **err_info);
+static gboolean cosine_read(wftap *wfth, int *err, gchar **err_info,
        gint64 *data_offset);
-static gboolean cosine_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean cosine_seek_read(wftap *wfth, gint64 seek_off,
+       void* header, Buffer *buf, int *err, gchar **err_info);
 static int parse_cosine_rec_hdr(struct wtap_pkthdr *phdr, const char *line,
        int *err, gchar **err_info);
 static gboolean parse_cosine_hex_dump(FILE_T fh, struct wtap_pkthdr *phdr,
@@ -199,21 +200,21 @@ static gboolean empty_line(const gchar *line)
    byte offset. Copy the header line to hdr. Returns -1 on failure,
    and sets "*err" to the error and sets "*err_info" to null or an
    additional error string. */
-static gint64 cosine_seek_next_packet(wtap *wth, int *err, gchar **err_info,
+static gint64 cosine_seek_next_packet(wftap *wfth, int *err, gchar **err_info,
        char *hdr)
 {
        gint64 cur_off;
        char buf[COSINE_LINE_LENGTH];
 
        while (1) {
-               cur_off = file_tell(wth->fh);
+               cur_off = file_tell(wfth->fh);
                if (cur_off == -1) {
                        /* Error */
-                       *err = file_error(wth->fh, err_info);
+                       *err = file_error(wfth->fh, err_info);
                        return -1;
                }
-               if (file_gets(buf, sizeof(buf), wth->fh) == NULL) {
-                       *err = file_error(wth->fh, err_info);
+               if (file_gets(buf, sizeof(buf), wfth->fh) == NULL) {
+                       *err = file_error(wfth->fh, err_info);
                        return -1;
                }
                if (strstr(buf, COSINE_REC_MAGIC_STR1) ||
@@ -232,7 +233,7 @@ static gint64 cosine_seek_next_packet(wtap *wth, int *err, gchar **err_info,
  * if we get an I/O error, "*err" will be set to a non-zero value and
  * "*err_info" will be set to null or an additional error string.
  */
-static gboolean cosine_check_file_type(wtap *wth, int *err, gchar **err_info)
+static gboolean cosine_check_file_type(wftap *wfth, int *err, gchar **err_info)
 {
        char    buf[COSINE_LINE_LENGTH];
        gsize   reclen;
@@ -241,9 +242,9 @@ static gboolean cosine_check_file_type(wtap *wth, int *err, gchar **err_info)
        buf[COSINE_LINE_LENGTH-1] = '\0';
 
        for (line = 0; line < COSINE_HEADER_LINES_TO_CHECK; line++) {
-               if (file_gets(buf, COSINE_LINE_LENGTH, wth->fh) == NULL) {
+               if (file_gets(buf, COSINE_LINE_LENGTH, wfth->fh) == NULL) {
                        /* EOF or error. */
-                       *err = file_error(wth->fh, err_info);
+                       *err = file_error(wfth->fh, err_info);
                        return FALSE;
                }
 
@@ -263,38 +264,39 @@ static gboolean cosine_check_file_type(wtap *wth, int *err, gchar **err_info)
 }
 
 
-int cosine_open(wtap *wth, int *err, gchar **err_info)
+int cosine_open(wftap *wfth, int *err, gchar **err_info)
 {
        /* Look for CoSine header */
-       if (!cosine_check_file_type(wth, err, err_info)) {
+       if (!cosine_check_file_type(wfth, err, err_info)) {
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
        }
 
-       if (file_seek(wth->fh, 0L, SEEK_SET, err) == -1)        /* rewind */
+       if (file_seek(wfth->fh, 0L, SEEK_SET, err) == -1)       /* rewind */
                return -1;
 
-       wth->file_encap = WTAP_ENCAP_COSINE;
-       wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_COSINE;
-       wth->snapshot_length = 0; /* not known */
-       wth->subtype_read = cosine_read;
-       wth->subtype_seek_read = cosine_seek_read;
-       wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
+       wfth->file_encap = WTAP_ENCAP_COSINE;
+       wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_COSINE;
+       wfth->snapshot_length = 0; /* not known */
+       wfth->subtype_read = cosine_read;
+       wfth->subtype_seek_read = cosine_seek_read;
+       wfth->tsprecision = WTAP_FILE_TSPREC_CSEC;
 
        return 1;
 }
 
 /* Find the next packet and parse it; called from wtap_read(). */
-static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
+static gboolean cosine_read(wftap *wfth, int *err, gchar **err_info,
     gint64 *data_offset)
 {
        gint64  offset;
        int     pkt_len;
        char    line[COSINE_LINE_LENGTH];
+       wtap* wth = (wtap*)wfth->tap_specific_data;
 
        /* Find the next packet */
-       offset = cosine_seek_next_packet(wth, err, err_info, line);
+       offset = cosine_seek_next_packet(wfth, err, err_info, line);
        if (offset < 0)
                return FALSE;
        *data_offset = offset;
@@ -305,23 +307,24 @@ static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
                return FALSE;
 
        /* Convert the ASCII hex dump to binary data */
-       return parse_cosine_hex_dump(wth->fh, &wth->phdr, pkt_len,
-           wth->frame_buffer, err, err_info);
+       return parse_cosine_hex_dump(wfth->fh, &wth->phdr, pkt_len,
+           wfth->frame_buffer, err, err_info);
 }
 
 /* Used to read packets in random-access fashion */
 static gboolean
-cosine_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
+cosine_seek_read(wftap *wfth, gint64 seek_off, void* header,
        Buffer *buf, int *err, gchar **err_info)
 {
        int     pkt_len;
        char    line[COSINE_LINE_LENGTH];
+       struct wtap_pkthdr *phdr = (struct wtap_pkthdr*)header;
 
-       if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+       if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
                return FALSE;
 
-       if (file_gets(line, COSINE_LINE_LENGTH, wth->random_fh) == NULL) {
-               *err = file_error(wth->random_fh, err_info);
+       if (file_gets(line, COSINE_LINE_LENGTH, wfth->random_fh) == NULL) {
+               *err = file_error(wfth->random_fh, err_info);
                if (*err == 0) {
                        *err = WTAP_ERR_SHORT_READ;
                }
@@ -334,7 +337,7 @@ cosine_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
                return FALSE;
 
        /* Convert the ASCII hex dump to binary data */
-       return parse_cosine_hex_dump(wth->random_fh, phdr, pkt_len, buf, err,
+       return parse_cosine_hex_dump(wfth->random_fh, phdr, pkt_len, buf, err,
            err_info);
 }
 
index c6bb42425163cd9dc60a0c21553f5bd43cbc72e3..37958fba6e15ee6bf8832f371b44460c91cb8ea5 100644 (file)
@@ -28,6 +28,6 @@
 #include <wtap.h>
 #include "ws_symbol_export.h"
 
-int cosine_open(wtap *wth, int *err, gchar **err_info);
+int cosine_open(wftap *wfth, int *err, gchar **err_info);
 
 #endif
index bc640f639d1e87d794d18b6b0e29c38e05d2ebc6..7c2a4f1f8795e8886b809da2183456bfdf2c6223 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "config.h"
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "buffer.h"
 #include "csids.h"
@@ -44,10 +45,10 @@ typedef struct {
        gboolean byteswapped;
 } csids_t;
 
-static gboolean csids_read(wtap *wth, int *err, gchar **err_info,
+static gboolean csids_read(wftap *wfth, int *err, gchar **err_info,
        gint64 *data_offset);
-static gboolean csids_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean csids_seek_read(wftap *wfth, gint64 seek_off,
+       void* header, Buffer *buf, int *err, gchar **err_info);
 static gboolean csids_read_packet(FILE_T fh, csids_t *csids,
        struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
 
@@ -58,7 +59,7 @@ struct csids_header {
 };
 
 /* XXX - return -1 on I/O error and actually do something with 'err'. */
-int csids_open(wtap *wth, int *err, gchar **err_info)
+int csids_open(wftap *wfth, int *err, gchar **err_info)
 {
   /* There is no file header. There is only a header for each packet
    * so we read a packet header and compare the caplen with iplen. They
@@ -75,30 +76,30 @@ int csids_open(wtap *wth, int *err, gchar **err_info)
   csids_t *csids;
 
   /* check the file to make sure it is a csids file. */
-  bytesRead = file_read( &hdr, sizeof( struct csids_header), wth->fh );
+  bytesRead = file_read( &hdr, sizeof( struct csids_header), wfth->fh );
   if( bytesRead != sizeof( struct csids_header) ) {
-    *err = file_error( wth->fh, err_info );
+    *err = file_error( wfth->fh, err_info );
     if( *err != 0 && *err != WTAP_ERR_SHORT_READ ) {
       return -1;
     }
     return 0;
   }
   if( hdr.zeropad != 0 || hdr.caplen == 0 ) {
-       return 0;
+    return 0;
   }
   hdr.seconds = pntoh32( &hdr.seconds );
   hdr.caplen = pntoh16( &hdr.caplen );
-  bytesRead = file_read( &tmp, 2, wth->fh );
+  bytesRead = file_read( &tmp, 2, wfth->fh );
   if( bytesRead != 2 ) {
-    *err = file_error( wth->fh, err_info );
+    *err = file_error( wfth->fh, err_info );
     if( *err != 0 && *err != WTAP_ERR_SHORT_READ ) {
       return -1;
     }
     return 0;
   }
-  bytesRead = file_read( &iplen, 2, wth->fh );
+  bytesRead = file_read( &iplen, 2, wfth->fh );
   if( bytesRead != 2 ) {
-    *err = file_error( wth->fh, err_info );
+    *err = file_error( wfth->fh, err_info );
     if( *err != 0 && *err != WTAP_ERR_SHORT_READ ) {
       return -1;
     }
@@ -127,49 +128,51 @@ int csids_open(wtap *wth, int *err, gchar **err_info)
   }
 
   /* no file header. So reset the fh to 0 so we can read the first packet */
-  if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
+  if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
     return -1;
 
   csids = (csids_t *)g_malloc(sizeof(csids_t));
-  wth->priv = (void *)csids;
+  wfth->priv = (void *)csids;
   csids->byteswapped = byteswap;
-  wth->file_encap = WTAP_ENCAP_RAW_IP;
-  wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CSIDS;
-  wth->snapshot_length = 0; /* not known */
-  wth->subtype_read = csids_read;
-  wth->subtype_seek_read = csids_seek_read;
-  wth->tsprecision = WTAP_FILE_TSPREC_SEC;
+  wfth->file_encap = WTAP_ENCAP_RAW_IP;
+  wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CSIDS;
+  wfth->snapshot_length = 0; /* not known */
+  wfth->subtype_read = csids_read;
+  wfth->subtype_seek_read = csids_seek_read;
+  wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
 
   return 1;
 }
 
 /* Find the next packet and parse it; called from wtap_read(). */
-static gboolean csids_read(wtap *wth, int *err, gchar **err_info,
+static gboolean csids_read(wftap *wfth, int *err, gchar **err_info,
     gint64 *data_offset)
 {
-  csids_t *csids = (csids_t *)wth->priv;
+  csids_t *csids = (csids_t *)wfth->priv;
+  wtap* wth = (wtap*)wfth->tap_specific_data;
 
-  *data_offset = file_tell(wth->fh);
+  *data_offset = file_tell(wfth->fh);
 
-  return csids_read_packet( wth->fh, csids, &wth->phdr, wth->frame_buffer,
+  return csids_read_packet( wfth->fh, csids, &wth->phdr, wfth->frame_buffer,
                             err, err_info );
 }
 
 /* Used to read packets in random-access fashion */
 static gboolean
-csids_seek_read(wtap *wth,
+csids_seek_read(wftap *wfth,
                 gint64 seek_off,
-                struct wtap_pkthdr *phdr,
+                void* header,
                 Buffer *buf,
                 int *err,
                 gchar **err_info)
 {
-  csids_t *csids = (csids_t *)wth->priv;
+  csids_t *csids = (csids_t *)wfth->priv;
+  struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
 
-  if( file_seek( wth->random_fh, seek_off, SEEK_SET, err ) == -1 )
+  if( file_seek( wfth->random_fh, seek_off, SEEK_SET, err ) == -1 )
     return FALSE;
 
-  if( !csids_read_packet( wth->random_fh, csids, phdr, buf, err, err_info ) ) {
+  if( !csids_read_packet( wfth->random_fh, csids, phdr, buf, err, err_info ) ) {
     if( *err == 0 )
       *err = WTAP_ERR_SHORT_READ;
     return FALSE;
index 8f19f63964d2e12653c515f319aec2ffe1c774fa..8c2684780af9873743c62f88b5437d50fc1b15b2 100644 (file)
@@ -25,6 +25,6 @@
 #include <wtap.h>
 #include "ws_symbol_export.h"
 
-int csids_open(wtap *wth, int *err, gchar **err_info);
+int csids_open(wftap *wfth, int *err, gchar **err_info);
 
 #endif
index 23785548d27d27703c84fa997fc88f89cbc96b2b..08821c825bb0fefc03f00960ff9836a38a180dba 100644 (file)
@@ -1,4 +1,4 @@
-/* daintree_sna.c
+/* daintree-sna.c
  * Routines for opening .dcf capture files created by Daintree's
  * Sensor Network Analyzer for 802.15.4 radios
  * Copyright 2009, Exegin Technologies Limited <fff@exegin.com>
@@ -54,6 +54,7 @@
 #include <ctype.h>
 
 #include "wtap.h"
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "buffer.h"
 #include "file_wrappers.h"
@@ -77,11 +78,11 @@ static const char daintree_magic_text[] =
 
 #define COMMENT_LINE daintree_magic_text[0]
 
-static gboolean daintree_sna_read(wtap *wth, int *err, gchar **err_info,
+static gboolean daintree_sna_read(wftap *wfth, int *err, gchar **err_info,
        gint64 *data_offset);
 
-static gboolean daintree_sna_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean daintree_sna_seek_read(wftap *wfth, gint64 seek_off,
+       void* header, Buffer *buf, int *err, gchar **err_info);
 
 static gboolean daintree_sna_scan_header(struct wtap_pkthdr *phdr,
        char *readLine, char *readData, int *err, gchar **err_info);
@@ -90,14 +91,14 @@ static gboolean daintree_sna_process_hex_data(struct wtap_pkthdr *phdr,
        Buffer *buf, char *readData, int *err, gchar **err_info);
 
 /* Open a file and determine if it's a Daintree file */
-int daintree_sna_open(wtap *wth, int *err, gchar **err_info)
+int daintree_sna_open(wftap *wfth, int *err, gchar **err_info)
 {
        char readLine[DAINTREE_MAX_LINE_SIZE];
        guint i;
 
        /* get first line of file header */
-       if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wth->fh)==NULL) {
-               *err = file_error(wth->fh, err_info);
+       if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wfth->fh)==NULL) {
+               *err = file_error(wfth->fh, err_info);
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
@@ -111,8 +112,8 @@ int daintree_sna_open(wtap *wth, int *err, gchar **err_info)
        }
 
        /* read second header line */
-       if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wth->fh)==NULL) {
-               *err = file_error(wth->fh, err_info);
+       if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wfth->fh)==NULL) {
+               *err = file_error(wfth->fh, err_info);
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
@@ -120,14 +121,14 @@ int daintree_sna_open(wtap *wth, int *err, gchar **err_info)
        if (readLine[0] != COMMENT_LINE) return 0; /* daintree files have a two line header */
 
        /* set up the pointers to the handlers for this file type */
-       wth->subtype_read = daintree_sna_read;
-       wth->subtype_seek_read = daintree_sna_seek_read;
+       wfth->subtype_read = daintree_sna_read;
+       wfth->subtype_seek_read = daintree_sna_seek_read;
 
        /* set up for file type */
-       wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DAINTREE_SNA;
-       wth->file_encap = WTAP_ENCAP_IEEE802_15_4_NOFCS;
-       wth->tsprecision = WTAP_FILE_TSPREC_USEC;
-       wth->snapshot_length = 0; /* not available in header */
+       wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DAINTREE_SNA;
+       wfth->file_encap = WTAP_ENCAP_IEEE802_15_4_NOFCS;
+       wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+       wfth->snapshot_length = 0; /* not available in header */
 
        return 1; /* it's a Daintree file */
 }
@@ -135,18 +136,19 @@ int daintree_sna_open(wtap *wth, int *err, gchar **err_info)
 /* Read the capture file sequentially
  * Wireshark scans the file with sequential reads during preview and initial display. */
 static gboolean
-daintree_sna_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
+daintree_sna_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
 {
        char readLine[DAINTREE_MAX_LINE_SIZE];
        char readData[READDATA_BUF_SIZE];
+       wtap* wth = (wtap*)wfth->tap_specific_data;
 
-       *data_offset = file_tell(wth->fh);
+       *data_offset = file_tell(wfth->fh);
 
        /* we've only seen file header lines starting with '#', but
         * if others appear in the file, they are tossed */
        do {
-               if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wth->fh) == NULL) {
-                       *err = file_error(wth->fh, err_info);
+               if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wfth->fh) == NULL) {
+                       *err = file_error(wfth->fh, err_info);
                        return FALSE; /* all done */
                }
        } while (readLine[0] == COMMENT_LINE);
@@ -157,27 +159,28 @@ daintree_sna_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                return FALSE;
 
        /* process packet data */
-       return daintree_sna_process_hex_data(&wth->phdr, wth->frame_buffer,
+       return daintree_sna_process_hex_data(&wth->phdr, wfth->frame_buffer,
            readData, err, err_info);
 }
 
 /* Read the capture file randomly
  * Wireshark opens the capture file for random access when displaying user-selected packets */
 static gboolean
-daintree_sna_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
+daintree_sna_seek_read(wftap *wfth, gint64 seek_off, void* header,
        Buffer *buf, int *err, gchar **err_info)
 {
        char readLine[DAINTREE_MAX_LINE_SIZE];
        char readData[READDATA_BUF_SIZE];
+       struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
 
-       if(file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+       if(file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
                return FALSE;
 
        /* It appears only file header lines start with '#', but
         * if we find any others, we toss them */
        do {
-               if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wth->random_fh) == NULL) {
-                       *err = file_error(wth->random_fh, err_info);
+               if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wfth->random_fh) == NULL) {
+                       *err = file_error(wfth->random_fh, err_info);
                        return FALSE; /* all done */
                }
        } while (readLine[0] == COMMENT_LINE);
index 1ad396a4e3a4a51b631e4e23a9c94545eff2e116..8e9490298480e11516fa02acdbb39e5b0873e4f0 100644 (file)
@@ -27,7 +27,7 @@
 #include <wtap.h>
 #include "ws_symbol_export.h"
 
-int daintree_sna_open(wtap *wth, int *err, gchar **err_info _U_);
+int daintree_sna_open(wftap *wfth, int *err, gchar **err_info _U_);
 
 #endif /* __DAINTREE_SNA_H__ */
 
index 0a3e9f57e12e110cdceb14b9e916c5d8e58cff82..6cc1e98db789d5768ed919002dfc5feddab769cd 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "config.h"
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "buffer.h"
 #include "dbs-etherwatch.h"
@@ -84,10 +85,10 @@ static const char dbs_etherwatch_rec_magic[]  =
  */
 #define DBS_ETHERWATCH_MAX_PACKET_LEN  16384
 
-static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info,
+static gboolean dbs_etherwatch_read(wftap *wfth, int *err, gchar **err_info,
        gint64 *data_offset);
-static gboolean dbs_etherwatch_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean dbs_etherwatch_seek_read(wftap *wth, gint64 seek_off,
+       void* header, Buffer *buf, int *err, gchar **err_info);
 static gboolean parse_dbs_etherwatch_packet(struct wtap_pkthdr *phdr, FILE_T fh,
        Buffer* buf, int *err, gchar **err_info);
 static guint parse_single_hex_dump_line(char* rec, guint8 *buf,
@@ -97,22 +98,22 @@ static guint parse_hex_dump(char* dump, guint8 *buf, char seperator, char end);
 /* Seeks to the beginning of the next packet, and returns the
    byte offset.  Returns -1 on failure, and sets "*err" to the error
    and "*err_info" to null or an additional error string. */
-static gint64 dbs_etherwatch_seek_next_packet(wtap *wth, int *err,
+static gint64 dbs_etherwatch_seek_next_packet(wftap *wfth, int *err,
     gchar **err_info)
 {
   int byte;
   unsigned int level = 0;
   gint64 cur_off;
 
-  while ((byte = file_getc(wth->fh)) != EOF) {
+  while ((byte = file_getc(wfth->fh)) != EOF) {
     if (byte == dbs_etherwatch_rec_magic[level]) {
       level++;
       if (level >= DBS_ETHERWATCH_REC_MAGIC_SIZE) {
         /* note: we're leaving file pointer right after the magic characters */
-        cur_off = file_tell(wth->fh);
+        cur_off = file_tell(wfth->fh);
         if (cur_off == -1) {
           /* Error. */
-          *err = file_error(wth->fh, err_info);
+          *err = file_error(wfth->fh, err_info);
           return -1;
         }
         return cur_off + 1;
@@ -122,7 +123,7 @@ static gint64 dbs_etherwatch_seek_next_packet(wtap *wth, int *err,
     }
   }
   /* EOF or error. */
-  *err = file_error(wth->fh, err_info);
+  *err = file_error(wfth->fh, err_info);
   return -1;
 }
 
@@ -136,7 +137,7 @@ static gint64 dbs_etherwatch_seek_next_packet(wtap *wth, int *err,
  * if we get an I/O error, "*err" will be set to a non-zero value and
  * "*err_info" will be set to null or an error string.
  */
-static gboolean dbs_etherwatch_check_file_type(wtap *wth, int *err,
+static gboolean dbs_etherwatch_check_file_type(wftap *wfth, int *err,
     gchar **err_info)
 {
        char    buf[DBS_ETHERWATCH_LINE_LENGTH];
@@ -147,9 +148,9 @@ static gboolean dbs_etherwatch_check_file_type(wtap *wth, int *err,
        buf[DBS_ETHERWATCH_LINE_LENGTH-1] = 0;
 
        for (line = 0; line < DBS_ETHERWATCH_HEADER_LINES_TO_CHECK; line++) {
-               if (file_gets(buf, DBS_ETHERWATCH_LINE_LENGTH, wth->fh) == NULL) {
+               if (file_gets(buf, DBS_ETHERWATCH_LINE_LENGTH, wfth->fh) == NULL) {
                        /* EOF or error. */
-                       *err = file_error(wth->fh, err_info);
+                       *err = file_error(wfth->fh, err_info);
                        return FALSE;
                }
 
@@ -176,51 +177,53 @@ static gboolean dbs_etherwatch_check_file_type(wtap *wth, int *err,
 }
 
 
-int dbs_etherwatch_open(wtap *wth, int *err, gchar **err_info)
+int dbs_etherwatch_open(wftap *wfth, int *err, gchar **err_info)
 {
        /* Look for DBS ETHERWATCH header */
-       if (!dbs_etherwatch_check_file_type(wth, err, err_info)) {
+       if (!dbs_etherwatch_check_file_type(wfth, err, err_info)) {
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
        }
 
-       wth->file_encap = WTAP_ENCAP_ETHERNET;
-       wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DBS_ETHERWATCH;
-       wth->snapshot_length = 0;       /* not known */
-       wth->subtype_read = dbs_etherwatch_read;
-       wth->subtype_seek_read = dbs_etherwatch_seek_read;
-       wth->tsprecision = WTAP_FILE_TSPREC_CSEC;
+       wfth->file_encap = WTAP_ENCAP_ETHERNET;
+       wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DBS_ETHERWATCH;
+       wfth->snapshot_length = 0;      /* not known */
+       wfth->subtype_read = dbs_etherwatch_read;
+       wfth->subtype_seek_read = dbs_etherwatch_seek_read;
+       wfth->tsprecision = WTAP_FILE_TSPREC_CSEC;
 
        return 1;
 }
 
 /* Find the next packet and parse it; called from wtap_read(). */
-static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info,
+static gboolean dbs_etherwatch_read(wftap *wfth, int *err, gchar **err_info,
     gint64 *data_offset)
 {
        gint64  offset;
+       wtap* wth = (wtap*)wfth->tap_specific_data;
 
        /* Find the next packet */
-       offset = dbs_etherwatch_seek_next_packet(wth, err, err_info);
+       offset = dbs_etherwatch_seek_next_packet(wfth, err, err_info);
        if (offset < 1)
                return FALSE;
        *data_offset = offset;
 
        /* Parse the packet */
-       return parse_dbs_etherwatch_packet(&wth->phdr, wth->fh,
-            wth->frame_buffer, err, err_info);
+       return parse_dbs_etherwatch_packet(&wth->phdr, wfth->fh,
+            wfth->frame_buffer, err, err_info);
 }
 
 /* Used to read packets in random-access fashion */
 static gboolean
-dbs_etherwatch_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
+dbs_etherwatch_seek_read(wftap *wfth, gint64 seek_off,
+       void* header, Buffer *buf, int *err, gchar **err_info)
 {
-       if (file_seek(wth->random_fh, seek_off - 1, SEEK_SET, err) == -1)
+       struct wtap_pkthdr *phdr = (struct wtap_pkthdr*)header;
+       if (file_seek(wfth->random_fh, seek_off - 1, SEEK_SET, err) == -1)
                return FALSE;
 
-       return parse_dbs_etherwatch_packet(phdr, wth->random_fh, buf, err,
+       return parse_dbs_etherwatch_packet(phdr, wfth->random_fh, buf, err,
            err_info);
 }
 
index d28e33dae192dff345955f7e64266705dbcfd9e4..a371da1ac8de40b6fecc55362b1a180f4c372543 100644 (file)
@@ -25,6 +25,6 @@
 #include <wtap.h>
 #include "ws_symbol_export.h"
 
-int dbs_etherwatch_open(wtap *wth, int *err, gchar **err_info);
+int dbs_etherwatch_open(wftap *wfth, int *err, gchar **err_info);
 
 #endif
index 2a0eb9103ac4d3738ad09471fc2787ae6a04e506..36df2ab822e1075e58f4b29f293826aaa1d7328d 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include "config.h"
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "buffer.h"
 #include "dct3trace.h"
@@ -73,10 +74,10 @@ static const char dct3trace_magic_end[]  = "</dump>";
 
 #define MAX_PACKET_LEN 23
 
-static gboolean dct3trace_read(wtap *wth, int *err, gchar **err_info,
+static gboolean dct3trace_read(wftap *wfth, int *err, gchar **err_info,
        gint64 *data_offset);
-static gboolean dct3trace_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean dct3trace_seek_read(wftap *wfth, gint64 seek_off,
+       void* header, Buffer *buf, int *err, gchar **err_info);
 
 /*
  * Following 3 functions taken from gsmdecode-0.7bis, with permission - http://wiki.thc.org/gsm
@@ -155,15 +156,15 @@ xml_get_int(int *val, const char *str, const char *pattern)
 }
 
 
-int dct3trace_open(wtap *wth, int *err, gchar **err_info)
+int dct3trace_open(wftap *wfth, int *err, gchar **err_info)
 {
        char line1[64], line2[64];
 
        /* Look for Gammu DCT3 trace header */
-       if (file_gets(line1, sizeof(line1), wth->fh) == NULL ||
-               file_gets(line2, sizeof(line2), wth->fh) == NULL)
+       if (file_gets(line1, sizeof(line1), wfth->fh) == NULL ||
+               file_gets(line2, sizeof(line2), wfth->fh) == NULL)
        {
-               *err = file_error(wth->fh, err_info);
+               *err = file_error(wfth->fh, err_info);
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
@@ -176,12 +177,12 @@ int dct3trace_open(wtap *wth, int *err, gchar **err_info)
                return 0;
        }
 
-       wth->file_encap = WTAP_ENCAP_GSM_UM;
-       wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DCT3TRACE;
-       wth->snapshot_length = 0; /* not known */
-       wth->subtype_read = dct3trace_read;
-       wth->subtype_seek_read = dct3trace_seek_read;
-       wth->tsprecision = WTAP_FILE_TSPREC_SEC;
+       wfth->file_encap = WTAP_ENCAP_GSM_UM;
+       wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_DCT3TRACE;
+       wfth->snapshot_length = 0; /* not known */
+       wfth->subtype_read = dct3trace_read;
+       wfth->subtype_seek_read = dct3trace_seek_read;
+       wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
 
        return 1;
 }
@@ -346,24 +347,26 @@ baddata:
 
 
 /* Find the next packet and parse it; called from wtap_read(). */
-static gboolean dct3trace_read(wtap *wth, int *err, gchar **err_info,
+static gboolean dct3trace_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 dct3trace_get_packet(wth->fh, &wth->phdr, wth->frame_buffer,
+       return dct3trace_get_packet(wfth->fh, &wth->phdr, wfth->frame_buffer,
            err, err_info);
 }
 
 
 /* Used to read packets in random-access fashion */
-static gboolean dct3trace_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
+static gboolean dct3trace_seek_read(wftap *wfth, gint64 seek_off,
+       void* header, Buffer *buf, int *err, gchar **err_info)
 {
-       if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+       struct wtap_pkthdr *phdr = (struct wtap_pkthdr*)header;
+       if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
        {
                return FALSE;
        }
 
-       return dct3trace_get_packet(wth->random_fh, phdr, buf, err, err_info);
+       return dct3trace_get_packet(wfth->random_fh, phdr, buf, err, err_info);
 }
index d7bfc9cad93792d26f1f4f493ace1c8713d64c9e..a660c56bf78787150aa2051f3b85cd5d7ba5df44 100644 (file)
@@ -24,6 +24,6 @@
 #include <wtap.h>
 #include "ws_symbol_export.h"
 
-int dct3trace_open(wtap *wth, int *err, gchar **err_info);
+int dct3trace_open(wftap *wfth, int *err, gchar **err_info);
 
 #endif
index 9edef0ecbbd0388c372dfb1bce8772754d2d4d11..5ea60844492d3f421b14903f317e9d2493c8ed49 100644 (file)
@@ -1,4 +1,4 @@
-/*
+/* erf.c
  * Copyright (c) 2003 Endace Technology Ltd, Hamilton, New Zealand.
  * All rights reserved.
  *
@@ -50,6 +50,7 @@
 
 #include <wsutil/crc32.h>
 
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "file_wrappers.h"
 #include "buffer.h"
@@ -64,10 +65,10 @@ static int erf_read_header(FILE_T fh,
                            gchar **err_info,
                            guint32 *bytes_read,
                            guint32 *packet_size);
-static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
+static gboolean erf_read(wftap *wfth, int *err, gchar **err_info,
                          gint64 *data_offset);
-static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
-                              struct wtap_pkthdr *phdr, Buffer *buf,
+static gboolean erf_seek_read(wftap *wfth, gint64 seek_off,
+                              void* header, Buffer *buf,
                               int *err, gchar **err_info);
 
 static const struct {
@@ -86,7 +87,7 @@ static const struct {
 
 #define NUM_ERF_ENCAPS (sizeof erf_to_wtap_map / sizeof erf_to_wtap_map[0])
 
-extern int erf_open(wtap *wth, int *err, gchar **err_info)
+extern int erf_open(wftap *wfth, int *err, gchar **err_info)
 {
   int              i, n, records_for_erf_check = RECORDS_FOR_ERF_CHECK;
   int              valid_prev                  = 0;
@@ -101,6 +102,7 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
   guint8           type;
   size_t           r;
   gchar *          buffer;
+  wtap*            wth = (wtap*)wfth->tap_specific_data;
 
   memset(&prevts, 0, sizeof(prevts));
 
@@ -119,11 +121,11 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
 
   for (i = 0; i < records_for_erf_check; i++) {  /* records_for_erf_check */
 
-    r = file_read(&header,sizeof(header),wth->fh);
+    r = file_read(&header,sizeof(header),wfth->fh);
 
     if (r == 0 ) break;
     if (r != sizeof(header)) {
-      *err = file_error(wth->fh, err_info);
+      *err = file_error(wfth->fh, err_info);
       if (*err != 0 && *err != WTAP_ERR_SHORT_READ) {
         return -1;
       } else {
@@ -158,7 +160,7 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
 
     /* Skip PAD records, timestamps may not be set */
     if ((header.type & 0x7F) == ERF_TYPE_PAD) {
-      if (file_seek(wth->fh, packet_size, SEEK_CUR, err) == -1) {
+      if (file_seek(wfth->fh, packet_size, SEEK_CUR, err) == -1) {
         return -1;
       }
       continue;
@@ -192,8 +194,8 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
     /* Read over the extension headers */
     type = header.type;
     while (type & 0x80){
-      if (file_read(&erf_ext_header, sizeof(erf_ext_header),wth->fh) != sizeof(erf_ext_header)) {
-        *err = file_error(wth->fh, err_info);
+      if (file_read(&erf_ext_header, sizeof(erf_ext_header),wfth->fh) != sizeof(erf_ext_header)) {
+        *err = file_error(wfth->fh, err_info);
         if (*err == 0)
           *err = WTAP_ERR_SHORT_READ;
         return -1;
@@ -213,8 +215,8 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
       case ERF_TYPE_MC_AAL2:
       case ERF_TYPE_COLOR_MC_HDLC_POS:
       case ERF_TYPE_AAL2: /* not an MC type but has a similar 'AAL2 ext' header */
-        if (file_read(&mc_hdr,sizeof(mc_hdr),wth->fh) != sizeof(mc_hdr)) {
-          *err = file_error(wth->fh, err_info);
+        if (file_read(&mc_hdr,sizeof(mc_hdr),wfth->fh) != sizeof(mc_hdr)) {
+          *err = file_error(wfth->fh, err_info);
           return -1;
         }
         packet_size -= (guint32)sizeof(mc_hdr);
@@ -222,8 +224,8 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
       case ERF_TYPE_ETH:
       case ERF_TYPE_COLOR_ETH:
       case ERF_TYPE_DSM_COLOR_ETH:
-        if (file_read(&eth_hdr,sizeof(eth_hdr),wth->fh) != sizeof(eth_hdr)) {
-          *err = file_error(wth->fh, err_info);
+        if (file_read(&eth_hdr,sizeof(eth_hdr),wfth->fh) != sizeof(eth_hdr)) {
+          *err = file_error(wfth->fh, err_info);
           return -1;
         }
         packet_size -= (guint32)sizeof(eth_hdr);
@@ -242,7 +244,7 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
       return 0;
     }
     buffer=(gchar *)g_malloc(packet_size);
-    r = file_read(buffer, packet_size, wth->fh);
+    r = file_read(buffer, packet_size, wfth->fh);
     g_free(buffer);
 
     if (r != packet_size) {
@@ -257,22 +259,22 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
 
   } /* records_for_erf_check */
 
-  if (file_seek(wth->fh, 0L, SEEK_SET, err) == -1) {   /* rewind */
+  if (file_seek(wfth->fh, 0L, SEEK_SET, err) == -1) {   /* rewind */
     return -1;
   }
 
   /* This is an ERF file */
-  wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ERF;
-  wth->snapshot_length = 0;     /* not available in header, only in frame */
+  wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ERF;
+  wfth->snapshot_length = 0;     /* not available in header, only in frame */
 
   /*
    * Use the encapsulation for ERF records.
    */
-  wth->file_encap = WTAP_ENCAP_ERF;
+  wfth->file_encap = WTAP_ENCAP_ERF;
 
-  wth->subtype_read = erf_read;
-  wth->subtype_seek_read = erf_seek_read;
-  wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+  wfth->subtype_read = erf_read;
+  wfth->subtype_seek_read = erf_seek_read;
+  wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
 
   erf_populate_interfaces(wth);
 
@@ -280,22 +282,23 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
 }
 
 /* Read the next packet */
-static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
+static gboolean erf_read(wftap *wfth, int *err, gchar **err_info,
                          gint64 *data_offset)
 {
   erf_header_t erf_header;
   guint32      packet_size, bytes_read;
+  wtap*        wth = (wtap*)wfth->tap_specific_data;
 
-  *data_offset = file_tell(wth->fh);
+  *data_offset = file_tell(wfth->fh);
 
   do {
-    if (!erf_read_header(wth->fh,
+    if (!erf_read_header(wfth->fh,
                          &wth->phdr, &erf_header,
                          err, err_info, &bytes_read, &packet_size)) {
       return FALSE;
     }
 
-    if (!wtap_read_packet_bytes(wth->fh, wth->frame_buffer, packet_size,
+    if (!wtap_read_packet_bytes(wfth->fh, wfth->frame_buffer, packet_size,
                                 err, err_info))
       return FALSE;
 
@@ -304,23 +307,24 @@ static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
   return TRUE;
 }
 
-static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
-                              struct wtap_pkthdr *phdr, Buffer *buf,
+static gboolean erf_seek_read(wftap *wfth, gint64 seek_off,
+                              void* header, Buffer *buf,
                               int *err, gchar **err_info)
 {
   erf_header_t erf_header;
   guint32      packet_size;
+  struct wtap_pkthdr *phdr = (struct wtap_pkthdr*)header;
 
-  if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+  if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
     return FALSE;
 
   do {
-    if (!erf_read_header(wth->random_fh, phdr, &erf_header,
+    if (!erf_read_header(wfth->random_fh, phdr, &erf_header,
                          err, err_info, NULL, &packet_size))
       return FALSE;
   } while ( erf_header.type == ERF_TYPE_PAD );
 
-  return wtap_read_packet_bytes(wth->random_fh, buf, packet_size,
+  return wtap_read_packet_bytes(wfth->random_fh, buf, packet_size,
                                 err, err_info);
 }
 
@@ -502,7 +506,7 @@ static int wtap_wtap_encap_to_erf_encap(int encap)
   return -1;
 }
 
-static gboolean erf_write_phdr(wtap_dumper *wdh, int encap, const union wtap_pseudo_header *pseudo_header, int * err)
+static gboolean erf_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *pseudo_header, int * err)
 {
   guint8 erf_hdr[sizeof(struct erf_mc_phdr)];
   guint8 erf_subhdr[((sizeof(struct erf_mc_hdr) > sizeof(struct erf_eth_hdr))?
@@ -549,7 +553,7 @@ static gboolean erf_write_phdr(wtap_dumper *wdh, int encap, const union wtap_pse
       return FALSE;
 
   }
-  if (!wtap_dump_file_write(wdh, erf_hdr, size, err))
+  if (!wftap_dump_file_write(wdh, erf_hdr, size, err))
     return FALSE;
   wdh->bytes_dumped += size;
 
@@ -562,12 +566,12 @@ static gboolean erf_write_phdr(wtap_dumper *wdh, int encap, const union wtap_pse
       has_more = ehdr[i*8] & 0x80;
       i++;
     }while(has_more && i < MAX_ERF_EHDR);
-    if (!wtap_dump_file_write(wdh, ehdr, 8*i, err))
+    if (!wftap_dump_file_write(wdh, ehdr, 8*i, err))
       return FALSE;
     wdh->bytes_dumped += 8*i;
   }
 
-  if(!wtap_dump_file_write(wdh, erf_subhdr, subhdr_size, err))
+  if(!wftap_dump_file_write(wdh, erf_subhdr, subhdr_size, err))
     return FALSE;
   wdh->bytes_dumped += subhdr_size;
 
@@ -575,7 +579,7 @@ static gboolean erf_write_phdr(wtap_dumper *wdh, int encap, const union wtap_pse
 }
 
 static gboolean erf_dump(
-    wtap_dumper                    *wdh,
+    wftap_dumper                   *wdh,
     const struct wtap_pkthdr       *phdr,
     const guint8                   *pd,
     int                            *err)
@@ -607,7 +611,7 @@ static gboolean erf_dump(
 
     if(!erf_write_phdr(wdh, encap, pseudo_header, err)) return FALSE;
 
-    if(!wtap_dump_file_write(wdh, pd, phdr->caplen, err)) return FALSE;
+    if(!wftap_dump_file_write(wdh, pd, phdr->caplen, err)) return FALSE;
     wdh->bytes_dumped += phdr->caplen;
 
     /*XXX: this pads the record to its original length, which is fine in most
@@ -616,7 +620,7 @@ static gboolean erf_dump(
      * More than 8 extension headers is unusual though, only the first 8 are
      * written out anyway and fixing properly would require major refactor.*/
     while(wdh->bytes_dumped < alignbytes){
-      if(!wtap_dump_file_write(wdh, "", 1, err)) return FALSE;
+      if(!wftap_dump_file_write(wdh, "", 1, err)) return FALSE;
       wdh->bytes_dumped++;
     }
     return TRUE;
@@ -669,18 +673,18 @@ static gboolean erf_dump(
   }
 
   if(!erf_write_phdr(wdh, WTAP_ENCAP_ERF, &other_phdr, err)) return FALSE;
-  if(!wtap_dump_file_write(wdh, pd, phdr->caplen - round_down, err)) return FALSE;
+  if(!wftap_dump_file_write(wdh, pd, phdr->caplen - round_down, err)) return FALSE;
   wdh->bytes_dumped += phdr->caplen - round_down;
 
   /*add the 4 byte CRC if necessary*/
   if(must_add_crc){
-    if(!wtap_dump_file_write(wdh, &crc32, 4, err)) return FALSE;
+    if(!wftap_dump_file_write(wdh, &crc32, 4, err)) return FALSE;
     wdh->bytes_dumped += 4;
   }
   /*records should be 8byte aligned, so we add padding*/
   if(round_down == 0){
     for(i = (gint16)alignbytes; i > 0; i--){
-      if(!wtap_dump_file_write(wdh, "", 1, err)) return FALSE;
+      if(!wftap_dump_file_write(wdh, "", 1, err)) return FALSE;
       wdh->bytes_dumped++;
     }
   }
@@ -700,7 +704,7 @@ int erf_dump_can_write_encap(int encap)
   return 0;
 }
 
-int erf_dump_open(wtap_dumper *wdh, int *err)
+int erf_dump_open(wftap_dumper *wdh, int *err)
 {
   wdh->subtype_write = erf_dump;
   wdh->subtype_close = NULL;
index 44a293f4640cb00e47449c66776dcccb7c6670a3..7bc0fa0e6440865ec495c682a23a3e3f190cf80a 100644 (file)
@@ -103,9 +103,9 @@ union erf_subhdr {
 #define RECORDS_FOR_ERF_CHECK 20
 #define FCS_BITS       32
 
-int erf_open(wtap *wth, int *err, gchar **err_info);
+int erf_open(wftap *wfth, int *err, gchar **err_info);
 int erf_dump_can_write_encap(int encap);
-int erf_dump_open(wtap_dumper *wdh, int *err);
+int erf_dump_open(wftap_dumper *wdh, int *err);
 
 int erf_populate_interfaces(wtap *wth);
 
index 8bd32c224970cb4607d404147965f4de12526539..be8b34dc372fac541e25857bdd9b853d1d414142 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "config.h"
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "buffer.h"
 #include "eyesdn.h"
@@ -90,47 +91,47 @@ static const unsigned char eyesdn_hdr_magic[]  =
  */
 #define EYESDN_MAX_PACKET_LEN  16384
 
-static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
+static gboolean eyesdn_read(wftap *wfth, int *err, gchar **err_info,
        gint64 *data_offset);
-static gboolean eyesdn_seek_read(wtap *wth, gint64 seek_off,
-       struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean eyesdn_seek_read(wftap *wfth, gint64 seek_off,
+       void* header, Buffer *buf, int *err, gchar **err_info);
 static int read_eyesdn_rec(FILE_T fh, struct wtap_pkthdr *phdr, Buffer* buf,
        int *err, gchar **err_info);
 
 /* Seeks to the beginning of the next packet, and returns the
    byte offset.  Returns -1 on failure, and sets "*err" to the error
    and "*err_info" to null or an additional error string. */
-static gint64 eyesdn_seek_next_packet(wtap *wth, int *err, gchar **err_info)
+static gint64 eyesdn_seek_next_packet(wftap *wfth, int *err, gchar **err_info)
 {
        int byte;
        gint64 cur_off;
 
-       while ((byte = file_getc(wth->fh)) != EOF) {
+       while ((byte = file_getc(wfth->fh)) != EOF) {
                if (byte == 0xff) {
-                       cur_off = file_tell(wth->fh);
+                       cur_off = file_tell(wfth->fh);
                        if (cur_off == -1) {
                                /* Error. */
-                               *err = file_error(wth->fh, err_info);
+                               *err = file_error(wfth->fh, err_info);
                                return -1;
                        }
                        return cur_off;
                }
        }
        /* EOF or error. */
-       *err = file_error(wth->fh, err_info);
+       *err = file_error(wfth->fh, err_info);
        return -1;
 }
 
-int eyesdn_open(wtap *wth, int *err, gchar **err_info)
+int eyesdn_open(wftap *wfth, int *err, gchar **err_info)
 {
        int     bytes_read;
        char    magic[EYESDN_HDR_MAGIC_SIZE];
 
        /* Look for eyesdn header */
        errno = WTAP_ERR_CANT_READ;
-       bytes_read = file_read(&magic, sizeof magic, wth->fh);
+       bytes_read = file_read(&magic, sizeof magic, wfth->fh);
        if (bytes_read != sizeof magic) {
-               *err = file_error(wth->fh, err_info);
+               *err = file_error(wfth->fh, err_info);
                if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
                        return -1;
                return 0;
@@ -138,42 +139,44 @@ int eyesdn_open(wtap *wth, int *err, gchar **err_info)
        if (memcmp(magic, eyesdn_hdr_magic, EYESDN_HDR_MAGIC_SIZE) != 0)
                return 0;
 
-       wth->file_encap = WTAP_ENCAP_PER_PACKET;
-       wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_EYESDN;
-       wth->snapshot_length = 0; /* not known */
-       wth->subtype_read = eyesdn_read;
-       wth->subtype_seek_read = eyesdn_seek_read;
-       wth->tsprecision = WTAP_FILE_TSPREC_USEC;
+       wfth->file_encap = WTAP_ENCAP_PER_PACKET;
+       wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_EYESDN;
+       wfth->snapshot_length = 0; /* not known */
+       wfth->subtype_read = eyesdn_read;
+       wfth->subtype_seek_read = eyesdn_seek_read;
+       wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
 
        return 1;
 }
 
 /* Find the next packet and parse it; called from wtap_read(). */
-static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
+static gboolean eyesdn_read(wftap *wfth, int *err, gchar **err_info,
     gint64 *data_offset)
 {
        gint64  offset;
+       wtap* wth = (wtap*)wfth->tap_specific_data;
 
        /* Find the next record */
-       offset = eyesdn_seek_next_packet(wth, err, err_info);
+       offset = eyesdn_seek_next_packet(wfth, err, err_info);
        if (offset < 1)
                return FALSE;
        *data_offset = offset;
 
        /* Parse the record */
-       return read_eyesdn_rec(wth->fh, &wth->phdr, wth->frame_buffer,
+       return read_eyesdn_rec(wfth->fh, &wth->phdr, wfth->frame_buffer,
            err, err_info);
 }
 
 /* Used to read packets in random-access fashion */
 static gboolean
-eyesdn_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
+eyesdn_seek_read(wftap *wfth, gint64 seek_off, void* header,
        Buffer *buf, int *err, gchar **err_info)
 {
-       if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+       struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
+       if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
                return FALSE;
 
-       return read_eyesdn_rec(wth->random_fh, phdr, buf, err, err_info);
+       return read_eyesdn_rec(wfth->random_fh, phdr, buf, err, err_info);
 }
 
 /* Parses a record. */
@@ -187,8 +190,8 @@ read_eyesdn_rec(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err,
        int             usecs;
        int             pkt_len;
        guint8          channel, direction;
-        int            bytes_read;
-        guint8         *pd;
+       int             bytes_read;
+       guint8          *pd;
 
        /* Our file pointer should be at the summary information header
         * for a packet. Read in that header and extract the useful
@@ -342,7 +345,7 @@ read_eyesdn_rec(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err,
 
 
 static gboolean
-esc_write(wtap_dumper *wdh, const guint8 *buf, int len, int *err)
+esc_write(wftap_dumper *wdh, const guint8 *buf, int len, int *err)
 {
        int i;
        guint8 byte;
@@ -354,26 +357,26 @@ esc_write(wtap_dumper *wdh, const guint8 *buf, int len, int *err)
                        /*
                         * Escape the frame delimiter and escape byte.
                         */
-                       if (!wtap_dump_file_write(wdh, &esc, sizeof esc, err))
+                       if (!wftap_dump_file_write(wdh, &esc, sizeof esc, err))
                                return FALSE;
                        byte-=2;
                }
-               if (!wtap_dump_file_write(wdh, &byte, sizeof byte, err))
+               if (!wftap_dump_file_write(wdh, &byte, sizeof byte, err))
                        return FALSE;
        }
        return TRUE;
 }
 
-static gboolean eyesdn_dump(wtap_dumper *wdh,
+static gboolean eyesdn_dump(wftap_dumper *wdh,
                            const struct wtap_pkthdr *phdr,
                            const guint8 *pd, int *err);
 
-gboolean eyesdn_dump_open(wtap_dumper *wdh, int *err)
+gboolean eyesdn_dump_open(wftap_dumper *wdh, int *err)
 {
        wdh->subtype_write=eyesdn_dump;
        wdh->subtype_close=NULL;
 
-       if (!wtap_dump_file_write(wdh, eyesdn_hdr_magic,
+       if (!wftap_dump_file_write(wdh, eyesdn_hdr_magic,
            EYESDN_HDR_MAGIC_SIZE, err))
                return FALSE;
        wdh->bytes_dumped += EYESDN_HDR_MAGIC_SIZE;
@@ -401,7 +404,7 @@ int eyesdn_dump_can_write_encap(int encap)
 
 /* Write a record for a packet to a dump file.
  *    Returns TRUE on success, FALSE on failure. */
-static gboolean eyesdn_dump(wtap_dumper *wdh,
+static gboolean eyesdn_dump(wftap_dumper *wdh,
                            const struct wtap_pkthdr *phdr,
                            const guint8 *pd, int *err)
 {
@@ -488,7 +491,7 @@ static gboolean eyesdn_dump(wtap_dumper *wdh,
        phtons(&buf[10], size);
 
        /* start flag */
-       if (!wtap_dump_file_write(wdh, &start_flag, sizeof start_flag, err))
+       if (!wftap_dump_file_write(wdh, &start_flag, sizeof start_flag, err))
                return FALSE;
        if (!esc_write(wdh, buf, 12, err))
                return FALSE;
index c000a8bf6ad9ad761f968732e4295248576ad1eb..97c5194e148efb34bfa0cae222fb8776fbeddb98 100644 (file)
@@ -26,7 +26,7 @@
 #include <wtap.h>
 #include "ws_symbol_export.h"
 
-int eyesdn_open(wtap *wth, int *err, gchar **err_info);
+int eyesdn_open(wftap *wfth, int *err, gchar **err_info);
 
 enum EyeSDN_TYPES {
     EYESDN_ENCAP_ISDN=0,
@@ -40,7 +40,7 @@ enum EyeSDN_TYPES {
     EYESDN_ENCAP_V5_EF
 };
 
-gboolean eyesdn_dump_open(wtap_dumper *wdh, int *err);
+gboolean eyesdn_dump_open(wftap_dumper *wdh, int *err);
 int eyesdn_dump_can_write_encap(int encap);
 
 #endif
index 9a9a34d7c454481f215b3526bcd702290388767e..ec83e87aa62909d7bbc0392a901c490e119d3d21 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <wsutil/file_util.h>
 
+#include "wftap-int.h"
 #include "wtap-int.h"
 #include "file_wrappers.h"
 #include "buffer.h"
@@ -673,12 +674,13 @@ static gboolean heuristic_uses_extension(unsigned int i, const char *extension)
    so that it can do sequential I/O to a capture file that's being
    written to as new packets arrive independently of random I/O done
    to display protocol trees for packets when they're selected. */
-wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char **err_info,
+wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char **err_info,
                        gboolean do_random)
 {
        int     fd;
        ws_statb64 statb;
        wtap    *wth;
+       wftap   *wfth;
        unsigned int    i;
        gboolean use_stdin = FALSE;
        gchar *extension;
@@ -742,76 +744,79 @@ wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
        }
 
        errno = ENOMEM;
-       wth = (wtap *)g_malloc0(sizeof(wtap));
+       wfth = (wftap *)g_malloc0(sizeof(wtap));
 
        /* Open the file */
        errno = WTAP_ERR_CANT_OPEN;
        if (use_stdin) {
                /*
                 * We dup FD 0, so that we don't have to worry about
-                * a file_close of wth->fh closing the standard
+                * a file_close of wfth->fh closing the standard
                 * input of the process.
                 */
                fd = ws_dup(0);
                if (fd < 0) {
                        *err = errno;
-                       g_free(wth);
+                       g_free(wfth);
                        return NULL;
                }
 #ifdef _WIN32
                if (_setmode(fd, O_BINARY) == -1) {
                        /* "Shouldn't happen" */
                        *err = errno;
-                       g_free(wth);
+                       g_free(wfth);
                        return NULL;
                }
 #endif
-               if (!(wth->fh = file_fdopen(fd))) {
+               if (!(wfth->fh = file_fdopen(fd))) {
                        *err = errno;
                        ws_close(fd);
-                       g_free(wth);
+                       g_free(wfth);
                        return NULL;
                }
        } else {
-               if (!(wth->fh = file_open(filename))) {
+               if (!(wfth->fh = file_open(filename))) {
                        *err = errno;
-                       g_free(wth);
+                       g_free(wfth);
                        return NULL;
                }
        }
 
        if (do_random) {
-               if (!(wth->random_fh = file_open(filename))) {
+               if (!(wfth->random_fh = file_open(filename))) {
                        *err = errno;
-                       file_close(wth->fh);
-                       g_free(wth);
+                       file_close(wfth->fh);
+                       g_free(wfth);
                        return NULL;
                }
        } else
-               wth->random_fh = NULL;
-
-       /* initialization */
-       wth->file_encap = WTAP_ENCAP_UNKNOWN;
-       wth->subtype_sequential_close = NULL;
-       wth->subtype_close = NULL;
-       wth->tsprecision = WTAP_FILE_TSPREC_USEC;
-       wth->priv = NULL;
-       wth->wslua_data = NULL;
+               wfth->random_fh = NULL;
 
-       if (wth->random_fh) {
-               wth->fast_seek = g_ptr_array_new();
+       wth = (wtap *)g_malloc0(sizeof(wtap));
+       wfth->tap_specific_data = wth;
 
-               file_set_random_access(wth->fh, FALSE, wth->fast_seek);
-               file_set_random_access(wth->random_fh, TRUE, wth->fast_seek);
+       /* initialization */
+       wfth->file_encap = WTAP_ENCAP_UNKNOWN;
+       wfth->subtype_sequential_close = NULL;
+       wfth->subtype_close = NULL;
+       wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+       wfth->priv = NULL;
+       wfth->wslua_data = NULL;
+
+       if (wfth->random_fh) {
+               wfth->fast_seek = g_ptr_array_new();
+
+               file_set_random_access(wfth->fh, FALSE, wfth->fast_seek);
+               file_set_random_access(wfth->random_fh, TRUE, wfth->fast_seek);
        }
 
        /* 'type' is 1 greater than the array index */
        if (type != WTAP_TYPE_AUTO && type <= open_info_arr->len) {
                int result;
 
-               if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
+               if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
                        /* I/O error - give up */
-                       wtap_close(wth);
+                       wtap_close(wfth);
                        return NULL;
                }
 
@@ -819,14 +824,14 @@ wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
                 * to the file reader, kinda like the priv member but not free'd later.
                 * It's ok for this to copy a NULL.
                 */
-               wth->wslua_data = open_routines[type - 1].wslua_data;
+               wfth->wslua_data = open_routines[type - 1].wslua_data;
 
-               result = (*open_routines[type - 1].open_routine)(wth, err, err_info);
+               result = (*open_routines[type - 1].open_routine)(wfth, err, err_info);
 
                switch (result) {
                        case -1:
                                /* I/O error - give up */
-                               wtap_close(wth);
+                               wtap_close(wfth);
                                return NULL;
 
                        case 0:
@@ -848,9 +853,9 @@ wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
                   to start reading at the beginning.
 
                   Initialize the data offset while we're at it. */
-               if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
+               if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
                        /* I/O error - give up */
-                       wtap_close(wth);
+                       wtap_close(wfth);
                        return NULL;
                }
 
@@ -858,13 +863,13 @@ wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
                 * to the file reader, kinda like the priv member but not free'd later.
                 * It's ok for this to copy a NULL.
                 */
-               wth->wslua_data = open_routines[i].wslua_data;
+               wfth->wslua_data = open_routines[i].wslua_data;
 
-               switch ((*open_routines[i].open_routine)(wth, err, err_info)) {
+               switch ((*open_routines[i].open_routine)(wfth, err, err_info)) {
 
                case -1:
                        /* I/O error - give up */
-                       wtap_close(wth);
+                       wtap_close(wfth);
                        return NULL;
 
                case 0:
@@ -886,25 +891,25 @@ wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
                        /* Does this type use that extension? */
                        if (heuristic_uses_extension(i, extension)) {
                                /* Yes. */
-                               if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
+                               if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
                                        /* I/O error - give up */
                                        g_free(extension);
-                                       wtap_close(wth);
+                                       wtap_close(wfth);
                                        return NULL;
                                }
 
                                /* Set wth with wslua data if any - this is how we pass the data
                                 * to the file reader, kind of like priv but not free'd later.
                                 */
-                               wth->wslua_data = open_routines[i].wslua_data;
+                               wfth->wslua_data = open_routines[i].wslua_data;
 
-                               switch ((*open_routines[i].open_routine)(wth,
+                               switch ((*open_routines[i].open_routine)(wfth,
                                    err, err_info)) {
 
                                case -1:
                                        /* I/O error - give up */
                                        g_free(extension);
-                                       wtap_close(wth);
+                                       wtap_close(wfth);
                                        return NULL;
 
                                case 0:
@@ -924,25 +929,25 @@ wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
                        /* Does this type use that extension? */
                        if (!heuristic_uses_extension(i, extension)) {
                                /* No. */
-                               if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
+                               if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
                                        /* I/O error - give up */
                                        g_free(extension);
-                                       wtap_close(wth);
+                                       wtap_close(wfth);
                                        return NULL;
                                }
 
                                /* Set wth with wslua data if any - this is how we pass the data
                                 * to the file reader, kind of like priv but not free'd later.
                                 */
-                               wth->wslua_data = open_routines[i].wslua_data;
+                               wfth->wslua_data = open_routines[i].wslua_data;
 
-                               switch ((*open_routines[i].open_routine)(wth,
+                               switch ((*open_routines[i].open_routine)(wfth,
                                    err, err_info)) {
 
                                case -1:
                                        /* I/O error - give up */
                                        g_free(extension);
-                                       wtap_close(wth);
+                                       wtap_close(wfth);
                                        return NULL;
 
                                case 0:
@@ -961,22 +966,22 @@ wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
                /* No - try all the heuristics types in order. */
                for (i = heuristic_open_routine_idx; i < open_info_arr->len; i++) {
 
-                       if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
+                       if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
                                /* I/O error - give up */
-                               wtap_close(wth);
+                               wtap_close(wfth);
                                return NULL;
                        }
 
                        /* Set wth with wslua data if any - this is how we pass the data
                         * to the file reader, kind of like priv but not free'd later.
                         */
-                       wth->wslua_data = open_routines[i].wslua_data;
+                       wfth->wslua_data = open_routines[i].wslua_data;
 
-                       switch ((*open_routines[i].open_routine)(wth, err, err_info)) {
+                       switch ((*open_routines[i].open_routine)(wfth, err, err_info)) {
 
                        case -1:
                                /* I/O error - give up */
-                               wtap_close(wth);
+                               wtap_close(wfth);
                                return NULL;
 
                        case 0:
@@ -993,22 +998,22 @@ wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
 fail:
 
        /* Well, it's not one of the types of file we know about. */
-       wtap_close(wth);
+       wtap_close(wfth);
        *err = WTAP_ERR_FILE_UNKNOWN_FORMAT;
        return NULL;
 
 success:
-       wth->frame_buffer = (struct Buffer *)g_malloc(sizeof(struct Buffer));
-       buffer_init(wth->frame_buffer, 1500);
+       wfth->frame_buffer = (struct Buffer *)g_malloc(sizeof(struct Buffer));
+       buffer_init(wfth->frame_buffer, 1500);
 
-       if(wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP){
+       if(wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP){
 
                wtapng_if_descr_t descr;
 
-               descr.wtap_encap = wth->file_encap;
+               descr.wtap_encap = wfth->file_encap;
                descr.time_units_per_second = 1000000; /* default microsecond resolution */
-               descr.link_type = wtap_wtap_encap_to_pcap_encap(wth->file_encap);
-               descr.snap_len = wth->snapshot_length;
+               descr.link_type = wtap_wtap_encap_to_pcap_encap(wfth->file_encap);
+               descr.snap_len = wfth->snapshot_length;
                descr.opt_comment = NULL;
                descr.if_name = NULL;
                descr.if_description = NULL;
@@ -1026,7 +1031,7 @@ success:
                g_array_append_val(wth->interface_data, descr);
 
        }
-       return wth;
+       return wfth;
 }
 
 /*
@@ -1042,7 +1047,7 @@ success:
  * reopens the random stream.
  */
 gboolean
-wtap_fdreopen(wtap *wth, const char *filename, int *err)
+wftap_fdreopen(wftap *wfth, const char *filename, int *err)
 {
        ws_statb64 statb;
 
@@ -1084,7 +1089,7 @@ wtap_fdreopen(wtap *wth, const char *filename, int *err)
 
        /* Open the file */
        errno = WTAP_ERR_CANT_OPEN;
-       if (!file_fdreopen(wth->random_fh, filename)) {
+       if (!file_fdreopen(wfth->random_fh, filename)) {
                *err = errno;
                return FALSE;
        }
@@ -1956,31 +1961,40 @@ gboolean wtap_dump_supports_comment_types(int file_type_subtype, guint32 comment
 }
 
 static gboolean wtap_dump_open_check(int file_type_subtype, int encap, gboolean comressed, int *err);
-static wtap_dumper* wtap_dump_alloc_wdh(int file_type_subtype, int encap, int snaplen,
+static wftap_dumper* wtap_dump_alloc_wfdh(int file_type_subtype, int encap, int snaplen,
                                        gboolean compressed, int *err);
-static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err);
+static gboolean wtap_dump_open_finish(wftap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err);
 
-static WFILE_T wtap_dump_file_open(wtap_dumper *wdh, const char *filename);
-static WFILE_T wtap_dump_file_fdopen(wtap_dumper *wdh, int fd);
-static int wtap_dump_file_close(wtap_dumper *wdh);
+static WFILE_T wftap_dump_file_open(wftap_dumper *wdh, const char *filename);
+static WFILE_T wftap_dump_file_fdopen(wftap_dumper *wdh, int fd);
+static int wtap_dump_file_close(wftap_dumper *wdh);
 
-wtap_dumper* wtap_dump_open(const char *filename, int file_type_subtype, int encap,
+wftap_dumper* wtap_dump_open(const char *filename, int file_type_subtype, int encap,
                                int snaplen, gboolean compressed, int *err)
 {
        return wtap_dump_open_ng(filename, file_type_subtype, encap,snaplen, compressed, NULL, NULL, err);
 }
 
-static wtap_dumper *
+static wftap_dumper *
 wtap_dump_init_dumper(int file_type_subtype, int encap, int snaplen, gboolean compressed,
     wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err)
 {
-       wtap_dumper *wdh;
+       wftap_dumper *wfdh;
+       wtap_dumper* wdh;
 
        /* Allocate a data structure for the output stream. */
-       wdh = wtap_dump_alloc_wdh(file_type_subtype, encap, snaplen, compressed, err);
-       if (wdh == NULL)
+       wfdh = wtap_dump_alloc_wfdh(file_type_subtype, encap, snaplen, compressed, err);
+       if (wfdh == NULL)
                return NULL;    /* couldn't allocate it */
 
+       wdh = (wtap_dumper *)g_malloc0(sizeof (wtap_dumper));
+       if (wdh == NULL) {
+               *err = errno;
+               g_free(wfdh);
+               return NULL;
+       }
+       wfdh->tap_specific_data = wdh;
+
        /* Set Section Header Block data */
        wdh->shb_hdr = shb_hdr;
        /* Set Interface Description Block data */
@@ -2010,13 +2024,14 @@ wtap_dump_init_dumper(int file_type_subtype, int encap, int snaplen, gboolean co
                wdh->interface_data= g_array_new(FALSE, FALSE, sizeof(wtapng_if_descr_t));
                g_array_append_val(wdh->interface_data, descr);
        }
-       return wdh;
+       return wfdh;
 }
 
-wtap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int encap,
+wftap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int encap,
                                int snaplen, gboolean compressed, wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err)
 {
-       wtap_dumper *wdh;
+       wftap_dumper *wfdh;
+       wtap_dumper* wdh;
        WFILE_T fh;
 
        /* Check whether we can open a capture file with that file type
@@ -2025,16 +2040,19 @@ wtap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int
                return NULL;
 
        /* Allocate and initialize a data structure for the output stream. */
-       wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
+       wfdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
            shb_hdr, idb_inf, err);
-       if (wdh == NULL)
+       if (wfdh == NULL)
                return NULL;
 
+       wdh = wfdh->tap_specific_data;
+
        /* "-" means stdout */
        if (strcmp(filename, "-") == 0) {
                if (compressed) {
                        *err = EINVAL;  /* XXX - return a Wiretap error code for this */
                        g_free(wdh);
+                       g_free(wfdh);
                        return NULL;    /* compress won't work on stdout */
                }
 #ifdef _WIN32
@@ -2042,46 +2060,49 @@ wtap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int
                        /* "Should not happen" */
                        *err = errno;
                        g_free(wdh);
+                       g_free(wfdh);
                        return NULL;    /* couldn't put standard output in binary mode */
                }
 #endif
-               wdh->fh = stdout;
+               wfdh->fh = stdout;
        } else {
                /* In case "fopen()" fails but doesn't set "errno", set "errno"
                   to a generic "the open failed" error. */
                errno = WTAP_ERR_CANT_OPEN;
-               fh = wtap_dump_file_open(wdh, filename);
+               fh = wftap_dump_file_open(wfdh, filename);
                if (fh == NULL) {
                        *err = errno;
                        g_free(wdh);
+                       g_free(wfdh);
                        return NULL;    /* can't create file */
                }
-               wdh->fh = fh;
+               wfdh->fh = fh;
        }
 
-       if (!wtap_dump_open_finish(wdh, file_type_subtype, compressed, err)) {
+       if (!wtap_dump_open_finish(wfdh, file_type_subtype, compressed, err)) {
                /* Get rid of the file we created; we couldn't finish
                   opening it. */
-               if (wdh->fh != stdout) {
-                       wtap_dump_file_close(wdh);
+               if (wfdh->fh != stdout) {
+                       wtap_dump_file_close(wfdh);
                        ws_unlink(filename);
                }
                g_free(wdh);
+               g_free(wfdh);
                return NULL;
        }
-       return wdh;
+       return wfdh;
 }
 
-wtap_dumper* wtap_dump_fdopen(int fd, int file_type_subtype, int encap, int snaplen,
+wftap_dumper* wtap_dump_fdopen(int fd, int file_type_subtype, int encap, int snaplen,
                                gboolean compressed, int *err)
 {
        return wtap_dump_fdopen_ng(fd, file_type_subtype, encap, snaplen, compressed, NULL, NULL, err);
 }
 
-wtap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int snaplen,
+wftap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int snaplen,
                                gboolean compressed, wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err)
 {
-       wtap_dumper *wdh;
+       wftap_dumper *wfdh;
        WFILE_T fh;
 
        /* Check whether we can open a capture file with that file type
@@ -2090,9 +2111,9 @@ wtap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int s
                return NULL;
 
        /* Allocate and initialize a data structure for the output stream. */
-       wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
+       wfdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
            shb_hdr, idb_inf, err);
-       if (wdh == NULL)
+       if (wfdh == NULL)
                return NULL;
 
 #ifdef _WIN32
@@ -2100,7 +2121,7 @@ wtap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int s
                if (_setmode(fileno(stdout), O_BINARY) == -1) {
                        /* "Should not happen" */
                        *err = errno;
-                       g_free(wdh);
+                       g_free(wfdh);
                        return NULL;    /* couldn't put standard output in binary mode */
                }
        }
@@ -2109,20 +2130,20 @@ wtap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int s
        /* In case "fopen()" fails but doesn't set "errno", set "errno"
           to a generic "the open failed" error. */
        errno = WTAP_ERR_CANT_OPEN;
-       fh = wtap_dump_file_fdopen(wdh, fd);
+       fh = wftap_dump_file_fdopen(wfdh, fd);
        if (fh == NULL) {
                *err = errno;
-               g_free(wdh);
+               g_free(wfdh);
                return NULL;    /* can't create standard I/O stream */
        }
-       wdh->fh = fh;
+       w