aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-05-09 05:18:49 +0000
committerGuy Harris <guy@alum.mit.edu>2014-05-09 05:21:01 +0000
commita1b1c8bed54b1576e4f0e9e7f583844a12d142bf (patch)
treefcadd72c61f9d936451163e83cc1be843073f3b4
parenta651f3e5edb2f148a0e5f495b5cba0e7fa43e002 (diff)
Revert "Refactor Wiretap"
This reverts commit 1abeb277f5e6bd27fbaebfecc8184e37ba9d008a. This isn't building, and looks as if it requires significant work to fix. Change-Id: I622b1bb243e353e874883a302ab419532b7601f2 Reviewed-on: https://code.wireshark.org/review/1568 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--capinfos.c18
-rw-r--r--capture_info.c24
-rw-r--r--captype.c6
-rw-r--r--cfile.c2
-rw-r--r--cfile.h10
-rw-r--r--editcap.c32
-rw-r--r--epan/wslua/wslua.h10
-rw-r--r--epan/wslua/wslua_dumper.c6
-rw-r--r--epan/wslua/wslua_file.c200
-rw-r--r--file.c158
-rw-r--r--filetap/file_access.c2
-rw-r--r--filetap/ftap.c8
-rw-r--r--frame_tvbuff.c16
-rw-r--r--mergecap.c16
-rw-r--r--randpkt.c4
-rw-r--r--rawshark.c4
-rw-r--r--reordercap.c16
-rw-r--r--summary.c4
-rw-r--r--tfshark.c67
-rw-r--r--tshark.c80
-rw-r--r--ui/gtk/capture_file_dlg.c12
-rw-r--r--ui/gtk/file_import_dlg.c2
-rw-r--r--ui/gtk/iax2_analysis.c2
-rw-r--r--ui/gtk/main.c4
-rw-r--r--ui/gtk/packet_win.c2
-rw-r--r--ui/gtk/rlc_lte_graph.c2
-rw-r--r--ui/gtk/rtp_analysis.c2
-rw-r--r--ui/gtk/sctp_assoc_analyse.c2
-rw-r--r--ui/qt/capture_file_dialog.cpp4
-rw-r--r--ui/qt/import_text_dialog.cpp2
-rw-r--r--ui/qt/packet_list.cpp2
-rw-r--r--ui/tap-tcp-stream.c2
-rw-r--r--ui/tap_export_pdu.c2
-rw-r--r--ui/tap_export_pdu.h2
-rw-r--r--ui/text_import.c2
-rw-r--r--ui/text_import.h2
-rw-r--r--ui/win32/file_dlg_win32.c6
-rw-r--r--wiretap/5views.c74
-rw-r--r--wiretap/5views.h4
-rw-r--r--wiretap/CMakeLists.txt2
-rw-r--r--wiretap/Makefile.common13
-rw-r--r--wiretap/aethra.c58
-rw-r--r--wiretap/aethra.h2
-rw-r--r--wiretap/ascendtext.c77
-rw-r--r--wiretap/ascendtext.h2
-rw-r--r--wiretap/ber.c46
-rw-r--r--wiretap/ber.h2
-rw-r--r--wiretap/btsnoop.c90
-rw-r--r--wiretap/btsnoop.h6
-rw-r--r--wiretap/camins.c40
-rw-r--r--wiretap/camins.h2
-rw-r--r--wiretap/catapult_dct2000.c99
-rw-r--r--wiretap/catapult_dct2000.h4
-rw-r--r--wiretap/commview.c88
-rw-r--r--wiretap/commview.h4
-rw-r--r--wiretap/cosine.c65
-rw-r--r--wiretap/cosine.h2
-rw-r--r--wiretap/csids.c59
-rw-r--r--wiretap/csids.h2
-rw-r--r--wiretap/daintree-sna.c51
-rw-r--r--wiretap/daintree-sna.h2
-rw-r--r--wiretap/dbs-etherwatch.c57
-rw-r--r--wiretap/dbs-etherwatch.h2
-rw-r--r--wiretap/dct3trace.c43
-rw-r--r--wiretap/dct3trace.h2
-rw-r--r--wiretap/erf.c88
-rw-r--r--wiretap/erf.h4
-rw-r--r--wiretap/eyesdn.c69
-rw-r--r--wiretap/eyesdn.h4
-rw-r--r--wiretap/file_access.c263
-rw-r--r--wiretap/hcidump.c41
-rw-r--r--wiretap/hcidump.h2
-rw-r--r--wiretap/i4btrace.c49
-rw-r--r--wiretap/i4btrace.h2
-rw-r--r--wiretap/ipfix.c53
-rw-r--r--wiretap/ipfix.h2
-rw-r--r--wiretap/iptrace.c83
-rw-r--r--wiretap/iptrace.h2
-rw-r--r--wiretap/iseries.c94
-rw-r--r--wiretap/iseries.h2
-rw-r--r--wiretap/k12.c83
-rw-r--r--wiretap/k12.h8
-rw-r--r--wiretap/k12text.l55
-rw-r--r--wiretap/lanalyzer.c146
-rw-r--r--wiretap/lanalyzer.h4
-rw-r--r--wiretap/libpcap.c169
-rw-r--r--wiretap/libpcap.h4
-rw-r--r--wiretap/logcat.c92
-rw-r--r--wiretap/logcat.h20
-rw-r--r--wiretap/merge.c27
-rw-r--r--wiretap/merge.h2
-rw-r--r--wiretap/mime_file.c40
-rw-r--r--wiretap/mime_file.h2
-rw-r--r--wiretap/mp2t.c55
-rw-r--r--wiretap/mp2t.h2
-rw-r--r--wiretap/mpeg.c43
-rw-r--r--wiretap/mpeg.h2
-rw-r--r--wiretap/netmon.c117
-rw-r--r--wiretap/netmon.h4
-rw-r--r--wiretap/netscaler.c240
-rw-r--r--wiretap/netscaler.h4
-rw-r--r--wiretap/netscreen.c75
-rw-r--r--wiretap/netscreen.h2
-rw-r--r--wiretap/nettl.c507
-rw-r--r--wiretap/nettl.h4
-rw-r--r--wiretap/network_instruments.c115
-rw-r--r--wiretap/network_instruments.h4
-rw-r--r--wiretap/netxray.c137
-rw-r--r--wiretap/netxray.h6
-rw-r--r--wiretap/ngsniffer.c249
-rw-r--r--wiretap/ngsniffer.h4
-rw-r--r--wiretap/packetlogger.c43
-rw-r--r--wiretap/packetlogger.h2
-rw-r--r--wiretap/pcap-common.c25
-rw-r--r--wiretap/pcap-common.h2
-rw-r--r--wiretap/pcapng.c346
-rw-r--r--wiretap/pcapng.h4
-rw-r--r--wiretap/peekclassic.c99
-rw-r--r--wiretap/peekclassic.h2
-rw-r--r--wiretap/peektagged.c227
-rw-r--r--wiretap/peektagged.h2
-rw-r--r--wiretap/pppdump.c65
-rw-r--r--wiretap/pppdump.h2
-rw-r--r--wiretap/radcom.c108
-rw-r--r--wiretap/radcom.h2
-rw-r--r--wiretap/snoop.c91
-rw-r--r--wiretap/snoop.h4
-rw-r--r--wiretap/stanag4607.c45
-rw-r--r--wiretap/stanag4607.h2
-rw-r--r--wiretap/tnef.c44
-rw-r--r--wiretap/tnef.h2
-rw-r--r--wiretap/toshiba.c59
-rw-r--r--wiretap/toshiba.h2
-rw-r--r--wiretap/visual.c89
-rw-r--r--wiretap/visual.h4
-rw-r--r--wiretap/vms.c75
-rw-r--r--wiretap/vms.h2
-rw-r--r--wiretap/vwr.c79
-rw-r--r--wiretap/vwr.h2
-rw-r--r--wiretap/wftap-int.h295
-rw-r--r--wiretap/wtap-int.h54
-rw-r--r--wiretap/wtap.c172
-rw-r--r--wiretap/wtap.h83
143 files changed, 3089 insertions, 3557 deletions
diff --git a/capinfos.c b/capinfos.c
index dc2a2c9faf..bad557e2dd 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -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 = asctime(localtime(&timer));
+ time_string_ctime = ctime(&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(wftap *wth, const char *filename)
+process_cap_file(wtap *wth, const char *filename)
{
int status = 0;
int err;
@@ -868,7 +868,7 @@ process_cap_file(wftap *wth, const char *filename)
}
/* Per-packet encapsulation */
- if (wftap_file_encap(wth) == WTAP_ENCAP_PER_PACKET) {
+ if (wtap_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(wftap *wth, const char *filename)
}
/* File size */
- size = wftap_file_size(wth, &err);
+ size = wtap_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(wftap *wth, const char *filename)
cf_info.filesize = size;
/* File Type */
- cf_info.file_type = wftap_file_type_subtype(wth);
- cf_info.iscompressed = wftap_iscompressed(wth);
+ cf_info.file_type = wtap_file_type_subtype(wth);
+ cf_info.iscompressed = wtap_iscompressed(wth);
/* File Encapsulation */
- cf_info.file_encap = wftap_file_encap(wth);
+ cf_info.file_encap = wtap_file_encap(wth);
/* Packet size limit (snaplen) */
- cf_info.snaplen = wftap_snapshot_length(wth);
+ cf_info.snaplen = wtap_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[])
{
- wftap *wth;
+ wtap *wth;
int err;
gchar *err_info;
int opt;
diff --git a/capture_info.c b/capture_info.c
index 45a32e1d70..3ef12df504 100644
--- a/capture_info.c
+++ b/capture_info.c
@@ -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 wftap* wftap; /* current wftap file */
+ struct wtap* wtap; /* current wtap 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.wftap = NULL;
+ info_data.wtap = 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.wftap != NULL) {
- wftap_close(info_data.wftap);
+ if(info_data.wtap != NULL) {
+ wtap_close(info_data.wtap);
}
- info_data.wftap = wtap_open_offline(new_filename, WTAP_TYPE_AUTO, &err, &err_info, FALSE);
- if (!info_data.wftap) {
+ info_data.wtap = wtap_open_offline(new_filename, WTAP_TYPE_AUTO, &err, &err_info, FALSE);
+ if (!info_data.wtap) {
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) {
- wftap_cleareof(info_data.wftap);
- if (wtap_read(info_data.wftap, &err, &err_info, &data_offset)) {
- phdr = wtap_phdr(info_data.wftap);
+ wtap_cleareof(info_data.wtap);
+ if (wtap_read(info_data.wtap, &err, &err_info, &data_offset)) {
+ phdr = wtap_phdr(info_data.wtap);
pseudo_header = &phdr->pseudo_header;
wtap_linktype = phdr->pkt_encap;
- buf = wftap_buf_ptr(info_data.wftap);
+ buf = wtap_buf_ptr(info_data.wtap);
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.wftap)
- wtap_close(info_data.wftap);
+ if(info_data.wtap)
+ wtap_close(info_data.wtap);
}
diff --git a/captype.c b/captype.c
index 1c4528e27b..3062fb1122 100644
--- 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[])
{
- wftap *wth;
+ wtap *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(wftap_file_type_subtype(wth)));
- wftap_close(wth);
+ printf("%s: %s\n", argv[i], wtap_file_type_subtype_short_string(wtap_file_type_subtype(wth)));
+ wtap_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 d12a699a9d..a689b2e11c 100644
--- 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->wfth);
+ idb_info = wtap_file_get_idb_info(cf->wth);
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 0310d59f6b..40ae6057f0 100644
--- a/cfile.h
+++ b/cfile.h
@@ -63,11 +63,6 @@ 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 */
@@ -92,7 +87,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 */
- wftap *wfth; /* Tap session */
+ wtap *wth; /* Wiretap session */
dfilter_t *rfcode; /* Compiled read filter program */
dfilter_t *dfcode; /* Compiled display filter program */
gchar *dfilter; /* Display filter string */
@@ -109,7 +104,8 @@ 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 */
- phdr_t hdr; /* Packet/File header */
+ /* packet data */
+ struct wtap_pkthdr phdr; /* Packet header */
Buffer buf; /* Packet data */
/* frames */
frame_data_sequence *frames; /* Sequence of frames, if we're keeping that information */
diff --git a/editcap.c b/editcap.c
index 0aba558e42..70dfd0859a 100644
--- a/editcap.c
+++ b/editcap.c
@@ -310,9 +310,9 @@ selected(int recno)
/* is the packet in the selected timeframe */
static gboolean
-check_timestamp(wftap *wfth)
+check_timestamp(wtap *wth)
{
- struct wtap_pkthdr *pkthdr = wtap_phdr(wfth);
+ struct wtap_pkthdr *pkthdr = wtap_phdr(wth);
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[])
{
- wftap *wth;
+ wtap *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;
- wftap_dumper *pdh = NULL;
+ wtap_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 = g_strtod(optarg, &p);
+ err_prob = 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(wftap_file_type_subtype(wth)));
+ wtap_file_type_subtype_string(wtap_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 = wftap_file_encap(wth);
+ out_frame_type = wtap_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 = wftap_buf_ptr(wth);
+ buf = wtap_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, wftap_snapshot_length(wth)) : wftap_snapshot_length(wth),
+ snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_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 (!wftap_dump_close(pdh, &err)) {
+ if (!wtap_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, wftap_snapshot_length(wth)) : wftap_snapshot_length(wth),
+ snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_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 (!wftap_dump_close(pdh, &err)) {
+ if (!wtap_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, wftap_snapshot_length(wth)) : wftap_snapshot_length(wth),
+ snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_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 (wftap_file_type_subtype(wth) == WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000)
+ if (wtap_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, wftap_snapshot_length(wth)): wftap_snapshot_length(wth),
+ snaplen ? MIN(snaplen, wtap_snapshot_length(wth)): wtap_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 (!wftap_dump_close(pdh, &err)) {
+ if (!wtap_dump_close(pdh, &err)) {
fprintf(stderr, "editcap: Error writing to %s: %s\n", filename,
wtap_strerror(err));
exit(2);
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index f64880fc3e..5909027273 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -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 wftap_dumper struct during write operations. A wtap_dumper struct
+ can be a wtap_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;
- wftap_dumper *wdh; /* will be NULL during read usage */
+ wtap_dumper *wdh; /* will be NULL during read usage */
gboolean expired;
};
/* a "CaptureInfo" object can also be different things under the hood. */
struct _wslua_captureinfo {
- wftap *wfth; /* will be NULL during write usage */
- wftap_dumper *wdh; /* will be NULL during read usage */
+ wtap *wth; /* will be NULL during write usage */
+ wtap_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 wftap_dumper* Dumper;
+typedef wtap_dumper* Dumper;
typedef struct lua_pseudo_header* PseudoHeader;
typedef tvbparse_t* Parser;
typedef tvbparse_wanted_t* Rule;
diff --git a/epan/wslua/wslua_dumper.c b/epan/wslua/wslua_dumper.c
index 6b5818802d..4340304f57 100644
--- a/epan/wslua/wslua_dumper.c
+++ b/epan/wslua/wslua_dumper.c
@@ -266,7 +266,7 @@ WSLUA_METHOD Dumper_close(lua_State* L) {
g_hash_table_remove(dumper_encaps,*dp);
- if (!wftap_dump_close(*dp, &err)) {
+ if (!wtap_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;
- wftap_dump_flush(d);
+ wtap_dump_flush(d);
return 0;
}
@@ -455,7 +455,7 @@ static int Dumper__gc(lua_State* L) {
g_hash_table_remove(dumper_encaps,*dp);
- if (!wftap_dump_close(*dp, &err)) {
+ if (!wtap_dump_close(*dp, &err)) {
luaL_error(L,"error closing: %s",
wtap_strerror(err));
}
diff --git a/epan/wslua/wslua_file.c b/epan/wslua/wslua_file.c
index b15eccb9be..d7476ad446 100644
--- a/epan/wslua/wslua_file.c
+++ b/epan/wslua/wslua_file.c
@@ -29,7 +29,6 @@
#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>
@@ -98,7 +97,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 wftap_dumper struct during write operations. A wtap_dumper struct
+ can be a wtap_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) {
@@ -109,7 +108,7 @@ static File* push_File(lua_State* L, FILE_T ft) {
return pushFile(L,f);
}
-static File* push_Wdh(lua_State* L, wftap_dumper *wdh) {
+static File* push_Wdh(lua_State* L, wtap_dumper *wdh) {
File f = (File) g_malloc(sizeof(struct _wslua_file));
f->file = (FILE_T)wdh->fh;
f->wdh = wdh;
@@ -358,7 +357,7 @@ WSLUA_METHOD File_seek(lua_State* L) {
lua_pushnumber(L, (lua_Number)(file_tell(f->file)));
}
else {
- offset = wftap_dump_file_seek(f->wdh, offset, mode[op], &err);
+ offset = wtap_dump_file_seek(f->wdh, offset, mode[op], &err);
if (offset < 0) {
lua_pushnil(L); /* error */
@@ -366,7 +365,7 @@ WSLUA_METHOD File_seek(lua_State* L) {
return 2;
}
- offset = wftap_dump_file_tell(f->wdh, &err);
+ offset = wtap_dump_file_tell(f->wdh, &err);
if (offset < 0) {
lua_pushnil(L); /* error */
@@ -435,7 +434,7 @@ WSLUA_METHOD File_write(lua_State* L) {
for (; nargs--; arg++) {
size_t len;
const char *s = luaL_checklstring(L, arg, &len);
- status = wftap_dump_file_write(f->wdh, s, len, &err);
+ status = wtap_dump_file_write(f->wdh, s, len, &err);
if (!status) break;
f->wdh->bytes_dumped += len;
}
@@ -516,7 +515,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 wftap_dumper,
+ * In other words it handles the "priv" member of wtap and wtap_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
@@ -532,20 +531,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, wftap *wfth) {
+static void create_wth_priv(lua_State* L, wtap *wth) {
file_priv_t *priv = (file_priv_t*)g_malloc(sizeof(file_priv_t));
- if (wfth->priv != NULL) {
+ if (wth->priv != NULL) {
luaL_error(L, "Cannot create wtap private data because there already is private data");
return;
}
priv->table_ref = LUA_NOREF;
- wfth->priv = (void*) priv;
+ wth->priv = (void*) priv;
}
/* gets the private data table from wtap */
-static int get_wth_priv_table_ref(lua_State* L, wftap *wfth) {
- file_priv_t *priv = (file_priv_t*) wfth->priv;
+static int get_wth_priv_table_ref(lua_State* L, wtap *wth) {
+ file_priv_t *priv = (file_priv_t*) wth->priv;
if (!priv) {
/* shouldn't be possible */
@@ -560,8 +559,8 @@ static int get_wth_priv_table_ref(lua_State* L, wftap *wfth) {
}
/* sets the private data to wtap - the table is presumed on top of stack */
-static int set_wth_priv_table_ref(lua_State* L, wftap *wfth) {
- file_priv_t *priv = (file_priv_t*) wfth->priv;
+static int set_wth_priv_table_ref(lua_State* L, wtap *wth) {
+ file_priv_t *priv = (file_priv_t*) wth->priv;
if (!priv) {
/* shouldn't be possible */
@@ -592,8 +591,8 @@ static int set_wth_priv_table_ref(lua_State* L, wftap *wfth) {
}
/* remove, deref, and free the wtap->priv data */
-static void remove_wth_priv(lua_State* L, wftap *wfth) {
- file_priv_t *priv = (file_priv_t*) wfth->priv;
+static void remove_wth_priv(lua_State* L, wtap *wth) {
+ file_priv_t *priv = (file_priv_t*) wth->priv;
if (!priv) {
/* shouldn't be possible */
@@ -603,29 +602,29 @@ static void remove_wth_priv(lua_State* L, wftap *wfth) {
luaL_unref(L, LUA_REGISTRYINDEX, priv->table_ref);
- g_free(wfth->priv);
- wfth->priv = NULL;
+ g_free(wth->priv);
+ wth->priv = NULL;
}
-/* create and set the wftap_dumper->priv private data for the file instance */
-static void create_wdh_priv(lua_State* L, wftap_dumper *wdh) {
+/* create and set the wtap_dumper->priv private data for the file instance */
+static void create_wdh_priv(lua_State* L, wtap_dumper *wdh) {
file_priv_t *priv = (file_priv_t*)g_malloc(sizeof(file_priv_t));
if (wdh->priv != NULL) {
- luaL_error(L, "Cannot create wftap_dumper private data because there already is private data");
+ luaL_error(L, "Cannot create wtap_dumper private data because there already is private data");
return;
}
priv->table_ref = LUA_NOREF;
wdh->priv = (void*) priv;
}
-/* get the private data from wftap_dumper */
-static int get_wdh_priv_table_ref(lua_State* L, wftap_dumper *wdh) {
+/* get the private data from wtap_dumper */
+static int get_wdh_priv_table_ref(lua_State* L, wtap_dumper *wdh) {
file_priv_t *priv = (file_priv_t*) wdh->priv;
if (!priv) {
/* shouldn't be possible */
- luaL_error(L, "Cannot get wftap_dumper private data: it is null");
+ luaL_error(L, "Cannot get wtap_dumper private data: it is null");
return LUA_NOREF;
}
@@ -636,7 +635,7 @@ static int get_wdh_priv_table_ref(lua_State* L, wftap_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, wftap_dumper *wdh) {
+static int set_wdh_priv_table_ref(lua_State* L, wtap_dumper *wdh) {
file_priv_t *priv = (file_priv_t*) wdh->priv;
if (!priv) {
@@ -667,22 +666,22 @@ static int set_wdh_priv_table_ref(lua_State* L, wftap_dumper *wdh) {
return 0;
}
-/* remove and deref the wftap_dumper->priv data */
-static void remove_wdh_priv(lua_State* L, wftap_dumper *wdh) {
+/* remove and deref the wtap_dumper->priv data */
+static void remove_wdh_priv(lua_State* L, wtap_dumper *wdh) {
file_priv_t *priv = (file_priv_t*) wdh->priv;
if (!priv) {
/* shouldn't be possible */
- luaL_error(L, "Cannot remove wftap_dumper private data: it is null");
+ luaL_error(L, "Cannot remove wtap_dumper private data: it is null");
return;
}
luaL_unref(L, LUA_REGISTRYINDEX, priv->table_ref);
- /* we do NOT free wftap_dumper's priv member - wftap_dump_close() free's it */
+ /* we do NOT free wtap_dumper's priv member - wtap_dump_close() free's it */
}
-WSLUA_CLASS_DEFINE(CaptureInfo,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfo",wfth),NOP);
+WSLUA_CLASS_DEFINE(CaptureInfo,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfo",wth),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()`.
@@ -697,17 +696,17 @@ WSLUA_CLASS_DEFINE(CaptureInfo,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfo",wfth
@since 1.11.3
*/
-static CaptureInfo* push_CaptureInfo(lua_State* L, wftap *wfth, const gboolean first_time) {
+static CaptureInfo* push_CaptureInfo(lua_State* L, wtap *wth, const gboolean first_time) {
CaptureInfo f = (CaptureInfo) g_malloc0(sizeof(struct _wslua_captureinfo));
- f->wfth = wfth;
+ f->wth = wth;
f->wdh = NULL;
f->expired = FALSE;
if (first_time) {
/* XXX: need to do this? */
- wfth->file_encap = WTAP_ENCAP_UNKNOWN;
- wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
- wfth->snapshot_length = 0;
+ wth->file_encap = WTAP_ENCAP_UNKNOWN;
+ wth->tsprecision = WTAP_FILE_TSPREC_SEC;
+ wth->snapshot_length = 0;
}
return pushCaptureInfo(L,f);
@@ -717,13 +716,12 @@ WSLUA_METAMETHOD CaptureInfo__tostring(lua_State* L) {
/* Generates a string of debug info for the CaptureInfo */
CaptureInfo fi = toCaptureInfo(L,1);
- if (!fi || !fi->wfth) {
+ if (!fi || !fi->wth) {
lua_pushstring(L,"CaptureInfo pointer is NULL!");
} else {
- wftap *wfth = fi->wfth;
- wtap* wth = (wtap*)wfth->tap_specific_data;
+ wtap *wth = fi->wth;
lua_pushfstring(L, "CaptureInfo: file_type_subtype=%d, snapshot_length=%d, pkt_encap=%d, tsprecision='%s'",
- wfth->file_type_subtype, wfth->snapshot_length, wth->phdr.pkt_encap, wfth->tsprecision);
+ wth->file_type_subtype, wth->snapshot_length, wth->phdr.pkt_encap, wth->tsprecision);
}
WSLUA_RETURN(1); /* String of debug information. */
@@ -742,24 +740,23 @@ 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,wfth->file_encap);
-WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,encap,wfth->file_encap,int);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfo,encap,wth->file_encap);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,encap,wth->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,wfth->tsprecision);
-WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,time_precision,wfth->tsprecision,int);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfo,time_precision,wth->tsprecision);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,time_precision,wth->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,wfth->snapshot_length);
-WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,snapshot_length,wfth->snapshot_length,guint);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_GETTER(CaptureInfo,snapshot_length,wth->snapshot_length);
+WSLUA_ATTRIBUTE_NAMED_NUMBER_SETTER(CaptureInfo,snapshot_length,wth->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);
@@ -779,7 +776,6 @@ 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.
@@ -795,8 +791,7 @@ 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);
- wftap *wfth = fi->wfth;
- wtap *wth = (wtap*)wfth->tap_specific_data;
+ wtap *wth = fi->wth;
const char *addr = NULL;
const char *name = NULL;
size_t addr_len = 0;
@@ -919,24 +914,22 @@ 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->wfth);
+ return get_wth_priv_table_ref(L, fi->wth);
}
static int CaptureInfo_set_private_table(lua_State* L) {
CaptureInfo fi = checkCaptureInfo(L,1);
- return set_wth_priv_table_ref(L, fi->wfth);
+ return set_wth_priv_table_ref(L, fi->wth);
}
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 }
@@ -970,9 +963,9 @@ WSLUA_CLASS_DEFINE(CaptureInfoConst,FAIL_ON_NULL_MEMBER_OR_EXPIRED("CaptureInfoC
@since 1.11.3
*/
-static CaptureInfoConst* push_CaptureInfoConst(lua_State* L, wftap_dumper *wdh) {
+static CaptureInfoConst* push_CaptureInfoConst(lua_State* L, wtap_dumper *wdh) {
CaptureInfoConst f = (CaptureInfoConst) g_malloc0(sizeof(struct _wslua_captureinfo));
- f->wfth = NULL;
+ f->wth = NULL;
f->wdh = wdh;
f->expired = FALSE;
return pushCaptureInfoConst(L,f);
@@ -985,7 +978,7 @@ WSLUA_METAMETHOD CaptureInfoConst__tostring(lua_State* L) {
if (!fi || !fi->wdh) {
lua_pushstring(L,"CaptureInfoConst pointer is NULL!");
} else {
- wftap_dumper *wdh = fi->wdh;
+ wtap_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);
}
@@ -1007,7 +1000,6 @@ 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);
@@ -1023,7 +1015,6 @@ 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
@@ -1037,8 +1028,7 @@ 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);
- wftap_dumper *wfdh = fi->wdh;
- wtap_dumper *wdh = (wtap_dumper*)wfdh->tap_specific_data;
+ wtap_dumper *wdh = fi->wdh;
/* create the main table to return */
lua_newtable(L);
@@ -1136,12 +1126,10 @@ 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 }
@@ -1430,7 +1418,7 @@ WSLUA_METHOD FrameInfoConst_write_data(lua_State* L) {
if (len > fi->phdr->caplen)
len = fi->phdr->caplen;
- if (!wftap_dump_file_write(fh->wdh, fi->pd, (size_t)(len), &err)) {
+ if (!wtap_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);
@@ -1630,16 +1618,16 @@ static gboolean in_routine = FALSE;
/* some declarations */
static gboolean
-wslua_filehandler_read(wftap *wfth, int *err, gchar **err_info,
+wslua_filehandler_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
static gboolean
-wslua_filehandler_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+wslua_filehandler_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info);
static void
-wslua_filehandler_close(wftap *wfth);
+wslua_filehandler_close(wtap *wth);
static void
-wslua_filehandler_sequential_close(wftap *wfth);
+wslua_filehandler_sequential_close(wtap *wth);
/* This is our one-and-only open routine for file handling. When called by
@@ -1654,9 +1642,9 @@ wslua_filehandler_sequential_close(wftap *wfth);
* field in the "struct wtap" to the type of the file.
*/
static int
-wslua_filehandler_open(wftap *wfth, int *err _U_, gchar **err_info)
+wslua_filehandler_open(wtap *wth, int *err _U_, gchar **err_info)
{
- FileHandler fh = (FileHandler)(wfth->wslua_data);
+ FileHandler fh = (FileHandler)(wth->wslua_data);
int retval = 0;
lua_State* L = NULL;
File *fp = NULL;
@@ -1664,10 +1652,10 @@ wslua_filehandler_open(wftap *wfth, int *err _U_, gchar **err_info)
INIT_FILEHANDLER_ROUTINE(read_open,0);
- create_wth_priv(L, wfth);
+ create_wth_priv(L, wth);
- fp = push_File(L, wfth->fh);
- fc = push_CaptureInfo(L, wfth, TRUE);
+ fp = push_File(L, wth->fh);
+ fc = push_CaptureInfo(L, wth, TRUE);
errno = WTAP_ERR_CANT_READ;
switch ( lua_pcall(L,2,1,1) ) {
@@ -1686,32 +1674,32 @@ wslua_filehandler_open(wftap *wfth, int *err _U_, gchar **err_info)
/* this is our file type - set the routines and settings into wtap */
if (fh->read_ref != LUA_NOREF) {
- wfth->subtype_read = wslua_filehandler_read;
+ wth->subtype_read = wslua_filehandler_read;
}
else return 0;
if (fh->seek_read_ref != LUA_NOREF) {
- wfth->subtype_seek_read = wslua_filehandler_seek_read;
+ wth->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)
- wfth->subtype_close = wslua_filehandler_close;
+ wth->subtype_close = wslua_filehandler_close;
else
- wfth->subtype_close = NULL;
+ wth->subtype_close = NULL;
/* it's ok to not have a sequential close routine */
if (fh->seq_read_close_ref != LUA_NOREF)
- wfth->subtype_sequential_close = wslua_filehandler_sequential_close;
+ wth->subtype_sequential_close = wslua_filehandler_sequential_close;
else
- wfth->subtype_sequential_close = NULL;
+ wth->subtype_sequential_close = NULL;
- wfth->file_type_subtype = fh->file_type;
+ wth->file_type_subtype = fh->file_type;
}
else {
/* not our file type */
- remove_wth_priv(L, wfth);
+ remove_wth_priv(L, wth);
}
lua_settop(L,0);
@@ -1725,16 +1713,15 @@ wslua_filehandler_open(wftap *wfth, int *err _U_, gchar **err_info)
* This will be the seek_off parameter when this frame is re-read.
*/
static gboolean
-wslua_filehandler_read(wftap *wfth, int *err, gchar **err_info,
+wslua_filehandler_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- FileHandler fh = (FileHandler)(wfth->wslua_data);
+ FileHandler fh = (FileHandler)(wth->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);
@@ -1743,9 +1730,9 @@ wslua_filehandler_read(wftap *wfth, int *err, gchar **err_info,
wth->phdr.opt_comment = NULL;
- fp = push_File(L, wfth->fh);
- fc = push_CaptureInfo(L, wfth, FALSE);
- fi = push_FrameInfo(L, &wth->phdr, wfth->frame_buffer);
+ fp = push_File(L, wth->fh);
+ fc = push_CaptureInfo(L, wth, FALSE);
+ fi = push_FrameInfo(L, &wth->phdr, wth->frame_buffer);
errno = WTAP_ERR_CANT_READ;
switch ( lua_pcall(L,3,1,1) ) {
@@ -1774,17 +1761,16 @@ wslua_filehandler_read(wftap *wfth, int *err, gchar **err_info,
* success, FALSE on error.
*/
static gboolean
-wslua_filehandler_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+wslua_filehandler_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
- FileHandler fh = (FileHandler)(wfth->wslua_data);
+ FileHandler fh = (FileHandler)(wth->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);
@@ -1792,8 +1778,8 @@ wslua_filehandler_seek_read(wftap *wfth, gint64 seek_off,
*err = errno = 0;
phdr->opt_comment = NULL;
- fp = push_File(L, wfth->random_fh);
- fc = push_CaptureInfo(L, wfth, FALSE);
+ fp = push_File(L, wth->random_fh);
+ fc = push_CaptureInfo(L, wth, FALSE);
fi = push_FrameInfo(L, phdr, buf);
lua_pushnumber(L, (lua_Number)seek_off);
@@ -1826,17 +1812,17 @@ wslua_filehandler_seek_read(wftap *wfth, gint64 seek_off,
/* Classic wtap close function, called by wtap core.
*/
static void
-wslua_filehandler_close(wftap *wfth)
+wslua_filehandler_close(wtap *wth)
{
- FileHandler fh = (FileHandler)(wfth->wslua_data);
+ FileHandler fh = (FileHandler)(wth->wslua_data);
lua_State* L = NULL;
File *fp = NULL;
CaptureInfo *fc = NULL;
INIT_FILEHANDLER_ROUTINE(read_close,);
- fp = push_File(L, wfth->fh);
- fc = push_CaptureInfo(L, wfth, FALSE);
+ fp = push_File(L, wth->fh);
+ fc = push_CaptureInfo(L, wth, FALSE);
switch ( lua_pcall(L,2,1,1) ) {
case 0:
@@ -1846,7 +1832,7 @@ wslua_filehandler_close(wftap *wfth)
END_FILEHANDLER_ROUTINE();
- remove_wth_priv(L, wfth);
+ remove_wth_priv(L, wth);
(*fp)->expired = TRUE;
(*fc)->expired = TRUE;
@@ -1858,17 +1844,17 @@ wslua_filehandler_close(wftap *wfth)
/* Classic wtap sequential close function, called by wtap core.
*/
static void
-wslua_filehandler_sequential_close(wftap *wfth)
+wslua_filehandler_sequential_close(wtap *wth)
{
- FileHandler fh = (FileHandler)(wfth->wslua_data);
+ FileHandler fh = (FileHandler)(wth->wslua_data);
lua_State* L = NULL;
File *fp = NULL;
CaptureInfo *fc = NULL;
INIT_FILEHANDLER_ROUTINE(seq_read_close,);
- fp = push_File(L, wfth->fh);
- fc = push_CaptureInfo(L, wfth, FALSE);
+ fp = push_File(L, wth->fh);
+ fc = push_CaptureInfo(L, wth, FALSE);
switch ( lua_pcall(L,2,1,1) ) {
case 0:
@@ -1932,17 +1918,17 @@ wslua_filehandler_can_write_encap(int encap, void* data)
/* some declarations */
static gboolean
-wslua_filehandler_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+wslua_filehandler_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
static gboolean
-wslua_filehandler_dump_close(wftap_dumper *wdh, int *err);
+wslua_filehandler_dump_close(wtap_dumper *wdh, int *err);
/* The classic wtap dump_open function.
* This returns 1 (TRUE) on success.
*/
static int
-wslua_filehandler_dump_open(wftap_dumper *wdh, int *err)
+wslua_filehandler_dump_open(wtap_dumper *wdh, int *err)
{
FileHandler fh = (FileHandler)(wdh->wslua_data);
int retval = 0;
@@ -2001,7 +1987,7 @@ wslua_filehandler_dump_open(wftap_dumper *wdh, int *err)
* else FALSE.
*/
static gboolean
-wslua_filehandler_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+wslua_filehandler_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
FileHandler fh = (FileHandler)(wdh->wslua_data);
@@ -2041,7 +2027,7 @@ wslua_filehandler_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
* else FALSE.
*/
static gboolean
-wslua_filehandler_dump_close(wftap_dumper *wdh, int *err)
+wslua_filehandler_dump_close(wtap_dumper *wdh, int *err)
{
FileHandler fh = (FileHandler)(wdh->wslua_data);
int retval = -1;
diff --git a/file.c b/file.c
index d588dd96de..6f743961f3 100644
--- 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(wftap_file_tsprecision(cf->wfth)) {
+ switch(wtap_file_tsprecision(cf->wth)) {
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)
{
- wftap *wth;
+ wtap *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->wfth = wth;
+ cf->wth = 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 = wftap_file_type_subtype(cf->wfth);
+ cf->cd_t = wtap_file_type_subtype(cf->wth);
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 = wftap_snapshot_length(cf->wfth);
+ cf->snap = wtap_snapshot_length(cf->wth);
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->wfth, add_ipv4_name);
- wtap_set_cb_new_ipv6(cf->wfth, (wtap_new_ipv6_callback_t) add_ipv6_name);
+ 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);
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->wfth) {
- wtap_close(cf->wfth);
- cf->wfth = NULL;
+ if (cf->wth) {
+ wtap_close(cf->wth);
+ cf->wth = 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 = wftap_file_size(cf->wfth, NULL);
+ size = wtap_file_size(cf->wth, NULL);
if (size >= 0)
progbar_val = (gfloat) file_pos / (gfloat) size;
- /* If it's still > 1, either "wftap_file_size()" failed (in which
+ /* If it's still > 1, either "wtap_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 = wftap_iscompressed(cf->wfth);
+ cf->iscompressed = wtap_iscompressed(cf->wth);
/* 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 = wftap_file_size(cf->wfth, NULL);
+ size = wtap_file_size(cf->wth, 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->wfth, &err, &err_info, &data_offset))) {
+ while ((wtap_read(cf->wth, &err, &err_info, &data_offset))) {
if (size >= 0) {
count++;
- file_pos = wftap_read_so_far(cf->wfth);
+ file_pos = wtap_read_so_far(cf->wth);
/* 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. */
- wftap_sequential_close(cf->wfth);
+ wtap_sequential_close(cf->wth);
/* 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 = wftap_file_encap(cf->wfth);
+ cf->lnk_t = wtap_file_encap(cf->wth);
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) {
- wftap_cleareof(cf->wfth);
- if (!wtap_read(cf->wfth, err, &err_info, &data_offset)) {
+ wtap_cleareof(cf->wth);
+ if (!wtap_read(cf->wth, 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 = wftap_file_encap(cf->wfth);
+ cf->lnk_t = wtap_file_encap(cf->wth);
/* 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->wfth == NULL) {
+ if (cf->wth == 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->wfth, err, &err_info, &data_offset))) {
+ while ((wtap_read(cf->wth, 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. */
- wftap_sequential_close(cf->wfth);
+ wtap_sequential_close(cf->wth);
/* 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 = wftap_file_encap(cf->wfth);
+ cf->lnk_t = wtap_file_encap(cf->wth);
/* 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->wfth);
- const guint8 *buf = wftap_buf_ptr(cf->wfth);
+ struct wtap_pkthdr *phdr = wtap_phdr(cf->wth);
+ const guint8 *buf = wtap_buf_ptr(cf->wth);
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;
- wftap_dumper *pdh;
+ wtap_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].wfth);
+ shb_hdr = wtap_file_get_shb_info(in_files[0].wth);
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].wfth);
+ idb_inf_merge_file = wtap_file_get_idb_info(in_files[i].wth);
/* 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 += wftap_read_so_far(in_files[i].wfth);
+ file_pos += wtap_read_so_far(in_files[i].wth);
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->wfth);
+ phdr = wtap_phdr(in_file->wth);
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->wfth),
- wftap_buf_ptr(in_file->wfth), &write_err)) {
+ if (!wtap_dump(pdh, wtap_phdr(in_file->wth),
+ wtap_buf_ptr(in_file->wth), &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 (!wftap_dump_close(pdh, &write_err))
+ if (!wtap_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)wftap_dump_close(pdh, &close_err);
+ (void)wtap_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 (!wftap_seek_read(cf->wfth, fdata->file_off, phdr, buf, &err, &err_info)) {
+ if (!wtap_seek_read(cf->wth, 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->hdr.wtap_hdr, &cf->buf);
+ return cf_read_frame_r(cf, fdata, &cf->phdr, &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->hdr.wtap_hdr,
+ cinfo, &cf->phdr,
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->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+ epan_dissect_run(&edt, &cf->phdr, 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->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata,
+ epan_dissect_run(&edt, &cf->phdr, 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->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+ epan_dissect_run(&edt, &cf->phdr, 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->hdr.wtap_hdr, frame_tvbuff_new_buffer(cf->current_frame, &cf->buf),
+ epan_dissect_run(cf->edt, &cf->phdr, 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->wfth);
+ shb_inf = wtap_file_get_shb_info(cf->wth);
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->wfth);
+ shb_inf = wtap_file_get_shb_info(cf->wth);
/* 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->wfth, comment);
+ wtap_write_shb_comment(cf->wth, comment);
/* Mark the file as having unsaved changes */
cf->unsaved_changes = TRUE;
}
@@ -4097,9 +4097,9 @@ cf_comment_types(capture_file *cf)
}
typedef struct {
- wftap_dumper *pdh;
- const char *fname;
- int file_type;
+ wtap_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->wfth);
+ wtap_close(cf->wth);
/* 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->wfth = wtap_open_offline(fname, WTAP_TYPE_AUTO, err, &err_info, TRUE);
- if (cf->wfth == NULL) {
+ cf->wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, err, &err_info, TRUE);
+ if (cf->wth == 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 = wftap_file_type_subtype(cf->wfth);
+ cf->cd_t = wtap_file_type_subtype(cf->wth);
cf->linktypes = g_array_sized_new(FALSE, FALSE, (guint) sizeof(int), 1);
- cf->snap = wftap_snapshot_length(cf->wfth);
+ cf->snap = wtap_snapshot_length(cf->wth);
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 = wftap_iscompressed(cf->wfth);
+ cf->iscompressed = wtap_iscompressed(cf->wth);
/* Find the size of the file. */
- size = wftap_file_size(cf->wfth, NULL);
+ size = wtap_file_size(cf->wth, 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->wfth);
- while ((wtap_read(cf->wfth, err, &err_info, &data_offset))) {
+ phdr = wtap_phdr(cf->wth);
+ while ((wtap_read(cf->wth, 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 = wftap_read_so_far(cf->wfth);
+ file_pos = wtap_read_so_far(cf->wth);
/* 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. */
- wftap_sequential_close(cf->wfth);
+ wtap_sequential_close(cf->wth);
/* 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 = wftap_file_encap(cf->wfth);
+ cf->lnk_t = wtap_file_encap(cf->wth);
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;
- wftap_dumper *pdh;
+ wtap_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->wfth);
- idb_inf = wtap_file_get_idb_info(cf->wfth);
+ shb_hdr = wtap_file_get_shb_info(cf->wth);
+ idb_inf = wtap_file_get_idb_info(cf->wth);
/* 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? */
- wftap_dump_close(pdh, &err);
+ wtap_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);
- wftap_dump_close(pdh, &err);
+ wtap_dump_close(pdh, &err);
goto fail;
}
- if (!wftap_dump_close(pdh, &err)) {
+ if (!wtap_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
- wftap_fdclose(cf->wfth);
+ wtap_fdclose(cf->wth);
#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 (!wftap_fdreopen(cf->wfth, cf->filename, &err)) {
+ if (!wtap_fdreopen(cf->wth, 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->wfth);
+ wtap_close(cf->wth);
/* 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->wfth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
- if (cf->wfth == NULL) {
+ cf->wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
+ if (cf->wth == 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->wfth, NULL);
+ wtap_write_shb_comment(cf->wth, 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;
- wftap_dumper *pdh;
+ wtap_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->wfth);
- idb_inf = wtap_file_get_idb_info(cf->wfth);
+ shb_hdr = wtap_file_get_shb_info(cf->wth);
+ idb_inf = wtap_file_get_idb_info(cf->wth);
/* 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? */
- wftap_dump_close(pdh, &err);
+ wtap_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);
- wftap_dump_close(pdh, &err);
+ wtap_dump_close(pdh, &err);
goto fail;
}
- if (!wftap_dump_close(pdh, &err)) {
+ if (!wtap_dump_close(pdh, &err)) {
cf_close_failure_alert_box(fname, err);
goto fail;
}
diff --git a/filetap/file_access.c b/filetap/file_access.c
index 90bc06bfee..e82905f840 100644
--- a/filetap/file_access.c
+++ b/filetap/file_access.c
@@ -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 wfth->fh closing the standard
+ * a file_close of wth->fh closing the standard
* input of the process.
*/
fd = ws_dup(0);
diff --git a/filetap/ftap.c b/filetap/ftap.c
index ef35611b84..0a8c6fa66f 100644
--- a/filetap/ftap.c
+++ b/filetap/ftap.c
@@ -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 = wfth->file_encap;
+ wth->phdr.pkt_encap = wth->file_encap;
#endif
if (!fth->subtype_read(fth, err, err_info, data_offset)) {
@@ -460,6 +460,12 @@ wtap_phdr(wtap *wth)
{
return &wth->phdr;
}
+
+guint8 *
+wtap_buf_ptr(wtap *wth)
+{
+ return buffer_start_ptr(wth->frame_buffer);
+}
#endif
gboolean
diff --git a/frame_tvbuff.c b/frame_tvbuff.c
index 2358af2a7e..b47d206f07 100644
--- a/frame_tvbuff.c
+++ b/frame_tvbuff.c
@@ -31,14 +31,14 @@
#include "frame_tvbuff.h"
#include "globals.h"
-#include "wftap-int.h" /* for ->random_fh */
+#include "wtap-int.h" /* for ->random_fh */
struct tvb_frame {
struct tvbuff tvb;
Buffer *buf; /* Packet data */
- wftap *wth; /**< Wiretap session */
+ wtap *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.wfth != frame_tvb->wth)
+ if (cfile.wth != frame_tvb->wth)
return FALSE;
/* XXX, what if phdr->caplen isn't equal to
* frame_tvb->tvb.length + frame_tvb->offset?
*/
- if (!wftap_seek_read(frame_tvb->wth, frame_tvb->file_off, phdr, buf, &err, &err_info)) {
+ if (!wtap_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.wfth && cfile.wfth->random_fh
+ if (cfile.wth && cfile.wth->random_fh
#ifdef WANT_PACKET_EDITOR
&& fd->file_off != -1 /* generic clone for modified packets */
#endif
) {
- frame_tvb->wth = cfile.wfth;
+ frame_tvb->wth = cfile.wth;
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.wfth && cfile.wfth->random_fh
+ if (cfile.wth && cfile.wth->random_fh
#ifdef WANT_PACKET_EDITOR
&& fd->file_off != -1 /* generic clone for modified packets */
#endif
) {
- frame_tvb->wth = cfile.wfth;
+ frame_tvb->wth = cfile.wth;
frame_tvb->file_off = fd->file_off;
frame_tvb->offset = 0;
} else
diff --git a/mergecap.c b/mergecap.c
index 14ecca8e22..a9c1ef9e08 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -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;
- wftap_dumper *pdh;
+ wtap_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(wftap_file_type_subtype(in_files[i].wfth)));
+ wtap_file_type_subtype_string(wtap_file_type_subtype(in_files[i].wth)));
}
if (snaplen == 0) {
@@ -357,9 +357,9 @@ main(int argc, char *argv[])
*/
int first_frame_type, this_frame_type;
- first_frame_type = wftap_file_encap(in_files[0].wfth);
+ first_frame_type = wtap_file_encap(in_files[0].wth);
for (i = 1; i < in_file_count; i++) {
- this_frame_type = wftap_file_encap(in_files[i].wfth);
+ this_frame_type = wtap_file_encap(in_files[i].wth);
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->wfth);
+ phdr = wtap_phdr(in_file->wth);
if (snaplen != 0 && phdr->caplen > snaplen) {
snap_phdr = *phdr;
snap_phdr.caplen = snaplen;
phdr = &snap_phdr;
}
- if (!wtap_dump(pdh, phdr, wftap_buf_ptr(in_file->wfth), &write_err)) {
+ if (!wtap_dump(pdh, phdr, wtap_buf_ptr(in_file->wth), &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 (!wftap_dump_close(pdh, &write_err))
+ if (!wtap_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)wftap_dump_close(pdh, &close_err);
+ (void)wtap_dump_close(pdh, &close_err);
}
if (got_read_error) {
diff --git a/randpkt.c b/randpkt.c
index abd1c56859..67cb821e48 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -494,7 +494,7 @@ int
main(int argc, char **argv)
{
- wftap_dumper *dump;
+ wtap_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);
}
- wftap_dump_close(dump, &err);
+ wtap_dump_close(dump, &err);
return 0;
diff --git a/rawshark.c b/rawshark.c
index a679caee16..54fc338f10 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -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(wftap_file_tsprecision(cfile.wth)) {
+ switch(wtap_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->wfth = NULL;
+ cf->wth = 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.
diff --git a/reordercap.c b/reordercap.c
index 09b5df1f8f..4b363b84b1 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -89,7 +89,7 @@ typedef struct FrameRecord_t {
static void
-frame_write(FrameRecord_t *frame, wftap *wth, wftap_dumper *pdh, Buffer *buf,
+frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh, Buffer *buf,
const char *infile)
{
int err;
@@ -103,7 +103,7 @@ frame_write(FrameRecord_t *frame, wftap *wth, wftap_dumper *pdh, Buffer *buf,
/* Re-read the first frame from the stored location */
- if (!wftap_seek_read(wth, frame->offset, &phdr, buf, &err, &err_info)) {
+ if (!wtap_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[])
{
- wftap *wth = NULL;
- wftap_dumper *pdh = NULL;
+ wtap *wth = NULL;
+ wtap_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", wftap_file_type_subtype(wth));
+ DEBUG_PRINT("file_type_subtype is %u\n", wtap_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, wftap_file_type_subtype(wth), wftap_file_encap(wth),
+ pdh = wtap_dump_open_ng(outfile, wtap_file_type_subtype(wth), wtap_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 (!wftap_dump_close(pdh, &err)) {
+ if (!wtap_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 */
- wftap_fdclose(wth);
+ wtap_fdclose(wth);
return 0;
}
diff --git a/summary.c b/summary.c
index 67c63ef4aa..dee1808f5b 100644
--- 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->wfth);
+ shb_inf = wtap_file_get_shb_info(cf->wth);
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->wfth);
+ idb_info = wtap_file_get_idb_info(cf->wth);
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);
diff --git a/tfshark.c b/tfshark.c
index cd4e3d9f45..e62350400f 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -89,7 +89,6 @@
#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>
@@ -167,6 +166,28 @@ 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)
{
@@ -1124,7 +1145,7 @@ main(int argc, char *argv[])
rfilter = optarg;
break;
case 'S': /* Set the line Separator to be printed between packets */
- separator = g_strdup(optarg);
+ separator = strdup(optarg);
break;
case 't': /* Time stamp type */
if (strcmp(optarg, "r") == 0)
@@ -1483,7 +1504,7 @@ tfshark_get_frame_ts(void *data, guint32 frame_num)
static const char *
no_interface_name(void *data _U_, guint32 interface_id _U_)
{
- return NULL;
+ return "";
}
static epan_t *
@@ -1667,13 +1688,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 = wftap_file_size(cf->wfth, err);
+ gint64 packet_size = wtap_file_size(cf->wth, err);
*data_buffer = (guint8*)g_malloc((gsize)packet_size);
- bytes_read = file_read(*data_buffer, (unsigned int)packet_size, cf->wfth->fh);
+ bytes_read = file_read(*data_buffer, (unsigned int)packet_size, cf->wth->fh);
if (bytes_read < 0) {
- *err = file_error(cf->wfth->fh, err_info);
+ *err = file_error(cf->wth->fh, err_info);
if (*err == 0)
*err = FTAP_ERR_SHORT_READ;
return FALSE;
@@ -1696,9 +1717,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 = wfth->file_encap;
+ wth->phdr.pkt_encap = wth->file_encap;
- if (!wfth->subtype_read(wth, err, err_info, data_offset)) {
+ if (!wth->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
@@ -1709,7 +1730,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(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return FALSE; /* failure */
}
@@ -1784,8 +1805,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->wfth)*/,
- wftap_buf_ptr(cf->wfth))) {
+ if (process_packet_first_pass(cf, edt, data_offset, &file_phdr/*wtap_phdr(cf->wth)*/,
+ wtap_buf_ptr(cf->wth))) {
/* Stop reading if we have the maximum number of packets;
* When the -c option has not been used, max_packet_count
@@ -1806,7 +1827,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->wfth);
+ wtap_sequential_close(cf->wth);
#endif
/* Allow the protocol dissectors to free up memory that they
@@ -1836,12 +1857,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->wfth, fdata->file_off,
+ if (wtap_seek_read(cf->wth, fdata->file_off,
&buf, fdata->cap_len, &err, &err_info)) {
- process_packet_second_pass(cf, edt, fdata, &cf->hdr.wtap_hdr, &buf, tap_flags);
+ process_packet_second_pass(cf, edt, fdata, &cf->phdr, &buf, tap_flags);
}
#else
- process_packet_second_pass(cf, edt, fdata, &cf->hdr.wtap_hdr, &buf, tap_flags);
+ process_packet_second_pass(cf, edt, fdata, &cf->phdr, &buf, tap_flags);
#endif
}
@@ -1875,7 +1896,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->wfth)*/,
+ process_packet(cf, edt, data_offset, &file_phdr/*wtap_phdr(cf->wth)*/,
raw_data, tap_flags);
/* Stop reading if we have the maximum number of packets;
@@ -1970,8 +1991,8 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
}
out:
- wtap_close(cf->wfth);
- cf->wfth = NULL;
+ wtap_close(cf->wth);
+ cf->wth = NULL;
return err;
}
@@ -2488,7 +2509,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
#if USE_FTAP
ftap *fth;
#else
- wftap *wth;
+ wtap *wth;
#endif
gchar *err_info;
char err_msg[2048+1];
@@ -2510,9 +2531,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->wfth = (struct wtap*)fth; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
+ cf->wth = (struct wtap*)fth; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
#else
- cf->wfth = wth;
+ cf->wth = wth;
#endif
cf->f_datalen = 0; /* not used, but set it anyway */
@@ -2527,12 +2548,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->wfth); /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
+ cf->cd_t = ftap_file_type_subtype((struct ftap*)cf->wth); /**** 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->wfth); /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
+ cf->snap = ftap_snapshot_length((struct ftap*)cf->wth); /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
if (cf->snap == 0) {
/* Snapshot length not known. */
cf->has_snap = FALSE;
diff --git a/tshark.c b/tshark.c
index 896b897605..c5b3d8b61a 100644
--- 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(wftap_file_tsprecision(cfile.wfth)) {
+ switch(wtap_file_tsprecision(cfile.wth)) {
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)->wfth != NULL) {
- wtap_close(((capture_file *) cap_session->cf)->wfth);
- ((capture_file *) cap_session->cf)->wfth = NULL;
+ if ( ((capture_file *) cap_session->cf)->wth != NULL) {
+ wtap_close(((capture_file *) cap_session->cf)->wth);
+ ((capture_file *) cap_session->cf)->wth = 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->wfth) {
- wftap_cleareof(cf->wfth);
- ret = wtap_read(cf->wfth, &err, &err_info, &data_offset);
+ while (to_read-- && cf->wth) {
+ wtap_cleareof(cf->wth);
+ ret = wtap_read(cf->wth, &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->wfth);
- cf->wfth = NULL;
+ wtap_close(cf->wth);
+ cf->wth = NULL;
} else {
- ret = process_packet(cf, edt, data_offset, wtap_phdr(cf->wfth),
- wftap_buf_ptr(cf->wfth),
+ ret = process_packet(cf, edt, data_offset, wtap_phdr(cf->wth),
+ wtap_buf_ptr(cf->wth),
tap_flags);
}
if (ret != FALSE) {
@@ -2809,8 +2809,8 @@ capture_input_closed(capture_session *cap_session, gchar *msg)
report_counts();
- if (cf != NULL && cf->wfth != NULL) {
- wtap_close(cf->wfth);
+ if (cf != NULL && cf->wth != NULL) {
+ wtap_close(cf->wth);
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;
- wftap_dumper *pdh;
+ wtap_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->wfth);
- idb_inf = wtap_file_get_idb_info(cf->wfth);
+ shb_hdr = wtap_file_get_shb_info(cf->wth);
+ idb_inf = wtap_file_get_idb_info(cf->wth);
#ifdef PCAP_NG_DEFAULT
if (idb_inf->number_of_interfaces > 1) {
linktype = WTAP_ENCAP_PER_PACKET;
} else {
- linktype = wftap_file_encap(cf->wfth);
+ linktype = wtap_file_encap(cf->wth);
}
#else
- linktype = wftap_file_encap(cf->wfth);
+ linktype = wtap_file_encap(cf->wth);
#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 = wftap_snapshot_length(cf->wfth);
+ snapshot_length = wtap_snapshot_length(cf->wth);
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->wfth, &err, &err_info, &data_offset)) {
- if (process_packet_first_pass(cf, edt, data_offset, wtap_phdr(cf->wfth),
- wftap_buf_ptr(cf->wfth))) {
+ 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))) {
/* 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. */
- wftap_sequential_close(cf->wfth);
+ wtap_sequential_close(cf->wth);
/* 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 (wftap_seek_read(cf->wfth, fdata->file_off, &phdr, &buf, &err,
+ if (wtap_seek_read(cf->wth, 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;
}
- wftap_dump_close(pdh, &err);
+ wtap_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->wfth, &err, &err_info, &data_offset)) {
+ while (wtap_read(cf->wth, &err, &err_info, &data_offset)) {
framenum++;
- if (process_packet(cf, edt, data_offset, wtap_phdr(cf->wfth),
- wftap_buf_ptr(cf->wfth),
+ if (process_packet(cf, edt, data_offset, wtap_phdr(cf->wth),
+ wtap_buf_ptr(cf->wth),
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->wfth), wftap_buf_ptr(cf->wfth), &err)) {
+ if (!wtap_dump(pdh, wtap_phdr(cf->wth), wtap_buf_ptr(cf->wth), &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;
}
- wftap_dump_close(pdh, &err);
+ wtap_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 (!wftap_dump_close(pdh, &err))
+ if (!wtap_dump_close(pdh, &err))
show_capture_file_io_error(save_file, err, TRUE);
}
} else {
if (save_file != NULL) {
/* Now close the capture file. */
- if (!wftap_dump_close(pdh, &err))
+ if (!wtap_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->wfth);
- cf->wfth = NULL;
+ wtap_close(cf->wth);
+ cf->wth = 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)
{
- wftap *wth;
+ wtap *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->wfth = wth;
+ cf->wth = 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 = wftap_file_type_subtype(cf->wfth);
+ cf->cd_t = wtap_file_type_subtype(cf->wth);
cf->open_type = type;
cf->count = 0;
cf->drops_known = FALSE;
cf->drops = 0;
- cf->snap = wftap_snapshot_length(cf->wfth);
+ cf->snap = wtap_snapshot_length(cf->wth);
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->wfth, add_ipv4_name);
- wtap_set_cb_new_ipv6(cf->wfth, (wtap_new_ipv6_callback_t) add_ipv6_name);
+ 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);
return CF_OK;
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index a2b2b7819b..baef2baed9 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -105,11 +105,11 @@ static gboolean color_selected;
/* set a new filename for the preview widget */
-static wftap *
+static wtap *
preview_set_filename(GtkWidget *prev, const gchar *cf_name)
{
GtkWidget *label;
- wftap *wth;
+ wtap *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 = wftap_file_size(wth, &err);
+ filesize = wtap_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(wftap_file_type_subtype(wth)), PREVIEW_STR_MAX);
+ g_strlcpy(string_buff, wtap_file_type_subtype_string(wtap_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, wftap *wth)
+preview_do(GtkWidget *prev, wtap *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;
- wftap *wth;
+ wtap *wth;
/* get the filename */
cf_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_sel));
diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c
index b3e5342b1d..cd12985257 100644
--- a/ui/gtk/file_import_dlg.c
+++ b/ui/gtk/file_import_dlg.c
@@ -535,7 +535,7 @@ file_import_open(text_import_info_t *info)
read_failure_alert_box(info->import_text_filename, errno);
}
- if (!wftap_dump_close(info->wdh, &err)) {
+ if (!wtap_dump_close(info->wdh, &err)) {
write_failure_alert_box(capfile_name, err);
}
diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c
index da4996f5c5..6f7fe77c73 100644
--- a/ui/gtk/iax2_analysis.c
+++ b/ui/gtk/iax2_analysis.c
@@ -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->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf),
+ epan_dissect_run(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf),
fdata, NULL);
/* if it is not an iax2 frame, show an error dialog */
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index a5b345edd5..e49e0531a0 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -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.hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
+ epan_dissect_run(&edt, &cfile.phdr, 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.hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
+ epan_dissect_run(&edt, &cfile.phdr, frame_tvbuff_new_buffer(fdata, &cfile.buf),
fdata, &cfile.cinfo);
epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c
index 47c637bfcd..c25d62b48a 100644
--- a/ui/gtk/packet_win.c
+++ b/ui/gtk/packet_win.c
@@ -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.hdr.wtap_hdr;
+ DataPtr->phdr = cfile.phdr;
DataPtr->pd = (guint8 *)g_malloc(DataPtr->frame->cap_len);
memcpy(DataPtr->pd, buffer_start_ptr(&cfile.buf), DataPtr->frame->cap_len);
diff --git a/ui/gtk/rlc_lte_graph.c b/ui/gtk/rlc_lte_graph.c
index ab238b8344..aeb5b9996b 100644
--- a/ui/gtk/rlc_lte_graph.c
+++ b/ui/gtk/rlc_lte_graph.c
@@ -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->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+ epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
rel_ts = edt.pi.rel_ts;
epan_dissect_cleanup(&edt);
remove_tap_listener(&th);
diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c
index 578273d6bf..0305b0a26a 100644
--- a/ui/gtk/rtp_analysis.c
+++ b/ui/gtk/rtp_analysis.c
@@ -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->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+ epan_dissect_run(&edt, &cf->phdr, 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);
diff --git a/ui/gtk/sctp_assoc_analyse.c b/ui/gtk/sctp_assoc_analyse.c
index 84d37c3010..2b751f7135 100644
--- a/ui/gtk/sctp_assoc_analyse.c
+++ b/ui/gtk/sctp_assoc_analyse.c
@@ -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->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+ epan_dissect_run(&edt, &cf->phdr, 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 */
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 1fa58515d6..03d4892411 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -786,10 +786,10 @@ void CaptureFileDialog::preview(const QString & path)
}
// Format
- preview_format_.setText(QString::fromUtf8(wtap_file_type_subtype_string(wftap_file_type_subtype(wth))));
+ preview_format_.setText(QString::fromUtf8(wtap_file_type_subtype_string(wtap_file_type_subtype(wth))));
// Size
- preview_size_.setText(QString(tr("%1 bytes")).arg(wftap_file_size(wth, &err)));
+ preview_size_.setText(QString(tr("%1 bytes")).arg(wtap_file_size(wth, &err)));
time(&time_preview);
while ( (wtap_read(wth, &err, &err_info, &data_offset)) ) {
diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp
index 344c3e6faf..39cf304bcd 100644
--- a/ui/qt/import_text_dialog.cpp
+++ b/ui/qt/import_text_dialog.cpp
@@ -142,7 +142,7 @@ void ImportTextDialog::convertTextFile() {
read_failure_alert_box(import_info_.import_text_filename, errno);
}
- if (!wftap_dump_close(import_info_.wdh, &err))
+ if (!wtap_dump_close(import_info_.wdh, &err))
{
write_failure_alert_box(capfile_name_.toUtf8().constData(), err);
}
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index 1a2c07e6b7..7e9ff94132 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -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_->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cap_file_->buf), fdata, &cap_file_->cinfo);
+ epan_dissect_run(&edt, &cap_file_->phdr, 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_]) ||
diff --git a/ui/tap-tcp-stream.c b/ui/tap-tcp-stream.c
index e91604bcbc..9dd1e46381 100644
--- a/ui/tap-tcp-stream.c
+++ b/ui/tap-tcp-stream.c
@@ -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->hdr.wtap_hdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
+ epan_dissect_run_with_taps(&edt, &cf->phdr, frame_tvbuff_new_buffer(fdata, &cf->buf), fdata, NULL);
rel_ts = edt.pi.rel_ts;
epan_dissect_cleanup(&edt);
remove_tap_listener(&th);
diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c
index c3a23fcc89..ec8c78130f 100644
--- a/ui/tap_export_pdu.c
+++ b/ui/tap_export_pdu.c
@@ -154,7 +154,7 @@ exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data)
cf_retap_packets(&cfile);
- if (!wftap_dump_close(exp_pdu_tap_data->wdh, &err)) {
+ if (!wtap_dump_close(exp_pdu_tap_data->wdh, &err)) {
write_failure_alert_box(capfile_name, err);
}
diff --git a/ui/tap_export_pdu.h b/ui/tap_export_pdu.h
index 998959b9b7..25c39d733a 100644
--- a/ui/tap_export_pdu.h
+++ b/ui/tap_export_pdu.h
@@ -29,7 +29,7 @@ extern "C" {
typedef struct _exp_pdu_t {
int pkt_encap;
- wftap_dumper* wdh;
+ wtap_dumper* wdh;
} exp_pdu_t;
void exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data);
diff --git a/ui/text_import.c b/ui/text_import.c
index 8a05da023c..05fcc25b8f 100644
--- a/ui/text_import.c
+++ b/ui/text_import.c
@@ -191,7 +191,7 @@ static guint32 ts_usec = 0;
static char *ts_fmt = NULL;
static struct tm timecode_default;
-static wftap_dumper* wdh;
+static wtap_dumper* wdh;
/* HDR_ETH Offset base to parse */
static guint32 offset_base = 16;
diff --git a/ui/text_import.h b/ui/text_import.h
index 64410d61c5..9a92576f8e 100644
--- a/ui/text_import.h
+++ b/ui/text_import.h
@@ -71,7 +71,7 @@ typedef struct
/* Import info */
guint encapsulation;
- wftap_dumper* wdh;
+ wtap_dumper* wdh;
/* Dummy header info (if encapsulation == 1) */
enum dummy_header_type dummy_header_type;
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index 21b1ed9dac..a65aaf4d0f 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -1114,7 +1114,7 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
HWND cur_ctrl;
int i;
gboolean enable = FALSE;
- wftap *wth;
+ wtap *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(wftap_file_type_subtype(wth))));
+ SetWindowText(cur_ctrl, utf_8to16(wtap_file_type_subtype_string(wtap_file_type_subtype(wth))));
/* Size */
- filesize = wftap_file_size(wth, &err);
+ filesize = wtap_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);
diff --git a/wiretap/5views.c b/wiretap/5views.c
index 5af6687747..db377b1570 100644
--- a/wiretap/5views.c
+++ b/wiretap/5views.c
@@ -23,7 +23,6 @@
#include <string.h>
#include <time.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -100,27 +99,27 @@ typedef struct
#define CST_5VW_CAPTURES_RECORD (CST_5VW_SECTION_CAPTURES << 28) /* 0x80000000 */
#define CST_5VW_SYSTEM_RECORD 0x00000000U
-static gboolean _5views_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean _5views_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean _5views_seek_read(wftap *wth, gint64 seek_off,
+static gboolean _5views_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-static int _5views_read_header(wftap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
+static int _5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
struct wtap_pkthdr *phdr, int *err, gchar **err_info);
-static gboolean _5views_dump(wftap_dumper *wdh, void* header, const guint8 *pd, int *err);
-static gboolean _5views_dump_close(wftap_dumper *wdh, int *err);
+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);
-int _5views_open(wftap *wfth, int *err, gchar **err_info)
+int _5views_open(wtap *wth, 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), wfth->fh);
+ bytes_read = file_read(&Capture_Header.Info_Header, sizeof(t_5VW_Info_Header), wth->fh);
if (bytes_read != sizeof(t_5VW_Info_Header)) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -172,31 +171,30 @@ int _5views_open(wftap *wfth, 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), wfth->fh);
+ bytes_read = file_read(&Capture_Header.HeaderDateCreation, sizeof (t_5VW_Capture_Header) - sizeof(t_5VW_Info_Header), wth->fh);
if (bytes_read != sizeof (t_5VW_Capture_Header)- sizeof(t_5VW_Info_Header) ) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
}
/* This is a 5views capture file */
- 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;
+ 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;
return 1;
}
/* Read the next packet */
static gboolean
-_5views_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+_5views_read(wtap *wth, 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
@@ -204,10 +202,10 @@ _5views_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
*/
do
{
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* Read record header. */
- if (!_5views_read_header(wfth, wfth->fh, &TimeStamped_Header,
+ if (!_5views_read_header(wth, wth->fh, &TimeStamped_Header,
&wth->phdr, err, err_info))
return FALSE;
@@ -221,7 +219,7 @@ _5views_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
/*
* Not a packet - skip to the next record.
*/
- if (file_seek(wfth->fh, TimeStamped_Header.RecSize, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, TimeStamped_Header.RecSize, SEEK_CUR, err) == -1)
return FALSE;
} while (1);
@@ -236,23 +234,23 @@ _5views_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
return FALSE;
}
- return wtap_read_packet_bytes(wfth->fh, wfth->frame_buffer,
+ return wtap_read_packet_bytes(wth->fh, wth->frame_buffer,
wth->phdr.caplen, err, err_info);
}
static gboolean
-_5views_seek_read(wftap *wfth, gint64 seek_off, struct wtap_pkthdr *phdr,
+_5views_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
t_5VW_TimeStamped_Header TimeStamped_Header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/*
* Read the header.
*/
- if (!_5views_read_header(wfth, wfth->random_fh, &TimeStamped_Header,
+ if (!_5views_read_header(wth, wth->random_fh, &TimeStamped_Header,
phdr, err, err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -262,14 +260,14 @@ _5views_seek_read(wftap *wfth, gint64 seek_off, struct wtap_pkthdr *phdr,
/*
* Read the packet data.
*/
- return wtap_read_packet_bytes(wfth->random_fh, buf, phdr->caplen,
+ return wtap_read_packet_bytes(wth->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(wftap *wfth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
+_5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
struct wtap_pkthdr *phdr, int *err, gchar **err_info)
{
int bytes_read, bytes_to_read;
@@ -305,7 +303,7 @@ _5views_read_header(wftap *wfth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
phdr->caplen = hdr->RecSize;
phdr->len = hdr->RecSize;
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_ETHERNET:
/* We assume there's no FCS in this frame. */
@@ -342,7 +340,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(wftap_dumper *wdh, int *err)
+gboolean _5views_dump_open(wtap_dumper *wdh, int *err)
{
_5views_dump_t *_5views;
@@ -350,7 +348,7 @@ gboolean _5views_dump_open(wftap_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 (wftap_dump_file_seek(wdh, sizeof(t_5VW_Capture_Header), SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, sizeof(t_5VW_Capture_Header), SEEK_SET, err) == -1)
return FALSE;
/* This is a 5Views file */
@@ -365,12 +363,12 @@ gboolean _5views_dump_open(wftap_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(wftap_dumper *wdh, void* header,
+static gboolean _5views_dump(wtap_dumper *wdh,
+ const struct wtap_pkthdr *phdr,
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) {
@@ -394,12 +392,12 @@ static gboolean _5views_dump(wftap_dumper *wdh, void* header,
HeaderFrame.RecInfo = GUINT32_TO_LE(0);
/* write the record header */
- if (!wftap_dump_file_write(wdh, &HeaderFrame,
+ if (!wtap_dump_file_write(wdh, &HeaderFrame,
sizeof(t_5VW_TimeStamped_Header), err))
return FALSE;
/* write the data */
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
_5views->nframes ++;
@@ -407,12 +405,12 @@ static gboolean _5views_dump(wftap_dumper *wdh, void* header,
return TRUE;
}
-static gboolean _5views_dump_close(wftap_dumper *wdh, int *err)
+static gboolean _5views_dump_close(wtap_dumper *wdh, int *err)
{
_5views_dump_t *_5views = (_5views_dump_t *)wdh->priv;
t_5VW_Capture_Header file_hdr;
- if (wftap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
return FALSE;
/* fill in the Info_Header */
@@ -449,7 +447,7 @@ static gboolean _5views_dump_close(wftap_dumper *wdh, int *err)
file_hdr.TramesStockeesInFile = GUINT32_TO_LE(_5views->nframes);
/* Write the file header. */
- if (!wftap_dump_file_write(wdh, &file_hdr, sizeof(t_5VW_Capture_Header),
+ if (!wtap_dump_file_write(wdh, &file_hdr, sizeof(t_5VW_Capture_Header),
err))
return FALSE;
diff --git a/wiretap/5views.h b/wiretap/5views.h
index 7ac7957ca5..79d4477cb1 100644
--- a/wiretap/5views.h
+++ b/wiretap/5views.h
@@ -23,8 +23,8 @@
#include <glib.h>
#include <wtap.h>
-int _5views_open(wftap *wfth, int *err, gchar **err_info);
-gboolean _5views_dump_open(wftap_dumper *wdh, int *err);
+int _5views_open(wtap *wth, int *err, gchar **err_info);
+gboolean _5views_dump_open(wtap_dumper *wdh, int *err);
int _5views_dump_can_write_encap(int encap);
#endif
diff --git a/wiretap/CMakeLists.txt b/wiretap/CMakeLists.txt
index ca6beba211..37432cbeb5 100644
--- a/wiretap/CMakeLists.txt
+++ b/wiretap/CMakeLists.txt
@@ -51,8 +51,8 @@ set(CLEAN_FILES
libpcap.c
logcat.c
merge.c
- mime_file.c
mpeg.c
+ mime_file.c
mp2t.c
netmon.c
netscaler.c
diff --git a/wiretap/Makefile.common b/wiretap/Makefile.common
index 71f1b76f21..1929ecf330 100644
--- a/wiretap/Makefile.common
+++ b/wiretap/Makefile.common
@@ -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,8 +138,7 @@ NONGENERATED_HEADER_FILES = \
toshiba.h \
visual.h \
vms.h \
- vwr.h \
- wftap-int.h \
+ vwr.h \
wtap.h \
wtap-int.h
diff --git a/wiretap/aethra.c b/wiretap/aethra.c
index ef9b5fd3c2..a0b783b349 100644
--- a/wiretap/aethra.c
+++ b/wiretap/aethra.c
@@ -21,7 +21,6 @@
#include "config.h"
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -113,14 +112,14 @@ typedef struct {
time_t start;
} aethra_t;
-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);
+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);
-int aethra_open(wftap *wfth, int *err, gchar **err_info)
+int aethra_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
struct aethra_hdr hdr;
@@ -129,9 +128,9 @@ int aethra_open(wftap *wfth, 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, wfth->fh);
+ bytes_read = file_read(hdr.magic, sizeof hdr.magic, wth->fh);
if (bytes_read != sizeof hdr.magic) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -143,18 +142,18 @@ int aethra_open(wftap *wfth, 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, wfth->fh);
+ sizeof hdr - sizeof hdr.magic, wth->fh);
if (bytes_read != sizeof hdr - sizeof hdr.magic) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
}
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_AETHRA;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_AETHRA;
aethra = (aethra_t *)g_malloc(sizeof(aethra_t));
- wfth->priv = (void *)aethra;
- wfth->subtype_read = aethra_read;
- wfth->subtype_seek_read = aethra_seek_read;
+ wth->priv = (void *)aethra;
+ wth->subtype_read = aethra_read;
+ wth->subtype_seek_read = aethra_seek_read;
/*
* Convert the time stamp to a "time_t".
@@ -172,9 +171,9 @@ int aethra_open(wftap *wfth, int *err, gchar **err_info)
* We've only seen ISDN files, so, for now, we treat all
* files as ISDN.
*/
- wfth->file_encap = WTAP_ENCAP_ISDN;
- wfth->snapshot_length = 0; /* not available in header */
- wfth->tsprecision = WTAP_FILE_TSPREC_MSEC;
+ wth->file_encap = WTAP_ENCAP_ISDN;
+ wth->snapshot_length = 0; /* not available in header */
+ wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
return 1;
}
@@ -183,21 +182,20 @@ static guint packet = 0;
#endif
/* Read the next packet */
-static gboolean aethra_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean aethra_read(wtap *wth, 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(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* Read record header. */
- if (!aethra_read_rec_header(wfth, wfth->fh, &hdr, &wth->phdr, err, err_info))
+ if (!aethra_read_rec_header(wth, wth->fh, &hdr, &wth->phdr, err, err_info))
return FALSE;
/*
@@ -205,7 +203,7 @@ static gboolean aethra_read(wftap *wfth, int *err, gchar **err_info,
* growing the buffer to handle it.
*/
if (wth->phdr.caplen != 0) {
- if (!wtap_read_packet_bytes(wfth->fh, wfth->frame_buffer,
+ if (!wtap_read_packet_bytes(wth->fh, wth->frame_buffer,
wth->phdr.caplen, err, err_info))
return FALSE; /* Read error */
}
@@ -276,15 +274,15 @@ found:
}
static gboolean
-aethra_seek_read(wftap *wfth, gint64 seek_off, struct wtap_pkthdr *phdr,
+aethra_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
struct aethrarec_hdr hdr;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (!aethra_read_rec_header(wfth, wfth->random_fh, &hdr, phdr, err,
+ if (!aethra_read_rec_header(wth, wth->random_fh, &hdr, phdr, err,
err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -294,17 +292,17 @@ aethra_seek_read(wftap *wfth, gint64 seek_off, struct wtap_pkthdr *phdr,
/*
* Read the packet data.
*/
- if (!wtap_read_packet_bytes(wfth->random_fh, buf, phdr->caplen, err, err_info))
+ if (!wtap_read_packet_bytes(wth->random_fh, buf, phdr->caplen, err, err_info))
return FALSE; /* failed */
return TRUE;
}
static gboolean
-aethra_read_rec_header(wftap *wfth, FILE_T fh, struct aethrarec_hdr *hdr,
+aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr,
struct wtap_pkthdr *phdr, int *err, gchar **err_info)
{
- aethra_t *aethra = (aethra_t *)wfth->priv;
+ aethra_t *aethra = (aethra_t *)wth->priv;
int bytes_read;
guint32 rec_size;
guint32 packet_size;
diff --git a/wiretap/aethra.h b/wiretap/aethra.h
index 992264d500..5c36ff4499 100644
--- a/wiretap/aethra.h
+++ b/wiretap/aethra.h
@@ -24,6 +24,6 @@
#include <glib.h>
#include <wtap.h>
-int aethra_open(wftap *wfth, int *err, gchar **err_info);
+int aethra_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/ascendtext.c b/wiretap/ascendtext.c
index e034fab1d2..32d4d49418 100644
--- a/wiretap/ascendtext.c
+++ b/wiretap/ascendtext.c
@@ -19,7 +19,6 @@
*/
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "ascendtext.h"
@@ -75,27 +74,26 @@ static const ascend_magic_string ascend_magic[] = {
{ ASCEND_PFX_ETHER, "ETHER" },
};
-static gboolean ascend_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean ascend_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+static gboolean ascend_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, 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(wftap *wfth, int *err, gchar **err_info)
+static gint64 ascend_seek(wtap *wth, 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(wfth->fh)) != EOF)) {
+ while (((byte = file_getc(wth->fh)) != EOF)) {
excessive_read_count--;
if (!excessive_read_count) {
@@ -110,16 +108,16 @@ static gint64 ascend_seek(wftap *wfth, 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(wfth->fh);
+ cur_off = file_tell(wth->fh);
if (cur_off == -1) {
/* Error. */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->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) {
@@ -142,7 +140,7 @@ static gint64 ascend_seek(wftap *wfth, int *err, gchar **err_info)
}
}
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return -1;
found:
@@ -150,7 +148,7 @@ found:
* Move to where the read for this packet should start, and return
* that seek offset.
*/
- if (file_seek(wfth->fh, packet_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, packet_off, SEEK_SET, err) == -1)
return -1;
wth->phdr.pseudo_header.ascend.type = type;
@@ -158,19 +156,18 @@ found:
return packet_off;
}
-int ascend_open(wftap *wfth, int *err, gchar **err_info)
+int ascend_open(wtap *wth, 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. */
- wfth->priv = NULL;
+ wth->priv = NULL;
- offset = ascend_seek(wfth, err, err_info);
+ offset = ascend_seek(wth, err, err_info);
if (offset == -1) {
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
@@ -179,31 +176,31 @@ int ascend_open(wftap *wfth, 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(wfth->fh, &wth->phdr)) {
+ if (!check_ascend(wth->fh, &wth->phdr)) {
return 0;
}
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ASCEND;
+ wth->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:
- wfth->file_encap = WTAP_ENCAP_ISDN;
+ wth->file_encap = WTAP_ENCAP_ISDN;
break;
case ASCEND_PFX_ETHER:
- wfth->file_encap = WTAP_ENCAP_ETHERNET;
+ wth->file_encap = WTAP_ENCAP_ETHERNET;
break;
default:
- wfth->file_encap = WTAP_ENCAP_ASCEND;
+ wth->file_encap = WTAP_ENCAP_ASCEND;
}
- wfth->snapshot_length = ASCEND_MAX_PKT_LEN;
- wfth->subtype_read = ascend_read;
- wfth->subtype_seek_read = ascend_seek_read;
+ wth->snapshot_length = ASCEND_MAX_PKT_LEN;
+ wth->subtype_read = ascend_read;
+ wth->subtype_seek_read = ascend_seek_read;
ascend = (ascend_t *)g_malloc(sizeof(ascend_t));
- wfth->priv = (void *)ascend;
+ wth->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
@@ -215,12 +212,12 @@ int ascend_open(wftap *wfth, 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 (wftap_fstat(wfth, &statbuf, err) == -1) {
+ if (wtap_fstat(wth, &statbuf, err) == -1) {
return -1;
}
ascend->inittime = statbuf.st_ctime;
ascend->adjusted = FALSE;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
init_parse_ascend();
@@ -228,26 +225,25 @@ int ascend_open(wftap *wfth, int *err, gchar **err_info)
}
/* Read the next packet; called from wtap_read(). */
-static gboolean ascend_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- ascend_t *ascend = (ascend_t *)wfth->priv;
+ ascend_t *ascend = (ascend_t *)wth->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(wfth->fh, ascend->next_packet_seek_start,
+ if (file_seek(wth->fh, ascend->next_packet_seek_start,
SEEK_SET, err) == -1)
return FALSE;
- offset = ascend_seek(wfth, err, err_info);
+ offset = ascend_seek(wth, err, err_info);
if (offset == -1)
return FALSE;
- if (parse_ascend(ascend, wfth->fh, &wth->phdr, wfth->frame_buffer,
- wfth->snapshot_length) != PARSED_RECORD) {
+ if (parse_ascend(ascend, wth->fh, &wth->phdr, wth->frame_buffer,
+ wth->snapshot_length) != PARSED_RECORD) {
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup((ascend_parse_error != NULL) ? ascend_parse_error : "parse error");
return FALSE;
@@ -257,17 +253,16 @@ static gboolean ascend_read(wftap *wfth, int *err, gchar **err_info,
return TRUE;
}
-static gboolean ascend_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+static gboolean ascend_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
- ascend_t *ascend = (ascend_t *)wfth->priv;
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
+ ascend_t *ascend = (ascend_t *)wth->priv;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (parse_ascend(ascend, wfth->random_fh, phdr, buf,
- wfth->snapshot_length) != PARSED_RECORD) {
+ if (parse_ascend(ascend, wth->random_fh, phdr, buf,
+ wth->snapshot_length) != PARSED_RECORD) {
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup((ascend_parse_error != NULL) ? ascend_parse_error : "parse error");
return FALSE;
diff --git a/wiretap/ascendtext.h b/wiretap/ascendtext.h
index cb4c6c9c73..369ffa1cd2 100644
--- a/wiretap/ascendtext.h
+++ b/wiretap/ascendtext.h
@@ -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(wftap *wfth, int *err, gchar **err_info);
+int ascend_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/ber.c b/wiretap/ber.c
index c022d9bb45..59e7e28f39 100644
--- a/wiretap/ber.c
+++ b/wiretap/ber.c
@@ -25,7 +25,6 @@
#include <sys/stat.h>
#endif
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -39,13 +38,13 @@
#define BER_UNI_TAG_SEQ 16 /* SEQUENCE, SEQUENCE OF */
#define BER_UNI_TAG_SET 17 /* SET, SET OF */
-static gboolean ber_read_file(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
+static gboolean ber_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
gint64 file_size;
int packet_size;
- if ((file_size = wftap_file_size(wfth, err)) == -1)
+ if ((file_size = wtap_file_size(wth, err)) == -1)
return FALSE;
if (file_size > WTAP_MAX_PACKET_SIZE) {
@@ -55,7 +54,7 @@ static gboolean ber_read_file(wftap *wfth, 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;
@@ -71,14 +70,13 @@ static gboolean ber_read_file(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
return wtap_read_packet_bytes(fh, buf, packet_size, err, err_info);
}
-static gboolean ber_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+static gboolean ber_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
gint64 offset;
- wtap* wth = (wtap*)wfth->tap_specific_data;
*err = 0;
- offset = file_tell(wfth->fh);
+ offset = file_tell(wth->fh);
/* there is only ever one packet */
if (offset != 0)
@@ -86,27 +84,25 @@ static gboolean ber_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_o
*data_offset = offset;
- return ber_read_file(wfth, wfth->fh, &wth->phdr, wfth->frame_buffer, err, err_info);
+ return ber_read_file(wth, wth->fh, &wth->phdr, wth->frame_buffer, err, err_info);
}
-static gboolean ber_seek_read(wftap *wfth, gint64 seek_off, void* header,
- Buffer *buf, int *err, gchar **err_info)
+static gboolean ber_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr _U_,
+ 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(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- return ber_read_file(wfth, wfth->random_fh, phdr, buf, err, err_info);
+ return ber_read_file(wth, wth->random_fh, phdr, buf, err, err_info);
}
-int ber_open(wftap *wfth, int *err, gchar **err_info)
+int ber_open(wtap *wth, int *err, gchar **err_info)
{
#define BER_BYTES_TO_CHECK 8
guint8 bytes[BER_BYTES_TO_CHECK];
@@ -120,9 +116,9 @@ int ber_open(wftap *wfth, int *err, gchar **err_info)
gint64 file_size;
int offset = 0, i;
- bytes_read = file_read(&bytes, BER_BYTES_TO_CHECK, wfth->fh);
+ bytes_read = file_read(&bytes, BER_BYTES_TO_CHECK, wth->fh);
if (bytes_read != BER_BYTES_TO_CHECK) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -165,7 +161,7 @@ int ber_open(wftap *wfth, int *err, gchar **err_info)
}
len += (2 + nlb); /* add back Tag and Length bytes */
- file_size = wftap_file_size(wfth, err);
+ file_size = wtap_file_size(wth, err);
if(len != file_size) {
return 0; /* not ASN.1 */
@@ -175,16 +171,16 @@ int ber_open(wftap *wfth, int *err, gchar **err_info)
}
/* seek back to the start of the file */
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_BER;
- wfth->file_encap = WTAP_ENCAP_BER;
- wfth->snapshot_length = 0;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_BER;
+ wth->file_encap = WTAP_ENCAP_BER;
+ wth->snapshot_length = 0;
- wfth->subtype_read = ber_read;
- wfth->subtype_seek_read = ber_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
+ wth->subtype_read = ber_read;
+ wth->subtype_seek_read = ber_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_SEC;
return 1;
}
diff --git a/wiretap/ber.h b/wiretap/ber.h
index 40b336a006..0448ad6bb8 100644
--- a/wiretap/ber.h
+++ b/wiretap/ber.h
@@ -23,6 +23,6 @@
#include <glib.h>
#include "ws_symbol_export.h"
-int ber_open(wftap *wfth, int *err, gchar **err_info);
+int ber_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/btsnoop.c b/wiretap/btsnoop.c
index 569371b328..b7c0b4c5c5 100644
--- a/wiretap/btsnoop.c
+++ b/wiretap/btsnoop.c
@@ -21,7 +21,6 @@
#include "config.h"
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -74,14 +73,14 @@ struct btsnooprec_hdr {
static const gint64 KUnixTimeBase = G_GINT64_CONSTANT(0x00dcddb30f2f8000); /* offset from symbian - unix time */
-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,
+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,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-int btsnoop_open(wftap *wfth, int *err, gchar **err_info)
+int btsnoop_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
char magic[sizeof btsnoop_magic];
@@ -91,9 +90,9 @@ int btsnoop_open(wftap *wfth, 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, wfth->fh);
+ bytes_read = file_read(magic, sizeof magic, wth->fh);
if (bytes_read != sizeof magic) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -105,9 +104,9 @@ int btsnoop_open(wftap *wfth, int *err, gchar **err_info)
/* Read the rest of the header. */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&hdr, sizeof hdr, wfth->fh);
+ bytes_read = file_read(&hdr, sizeof hdr, wth->fh);
if (bytes_read != sizeof hdr) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -152,36 +151,34 @@ int btsnoop_open(wftap *wfth, int *err, gchar **err_info)
return -1;
}
- 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;
+ 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;
return 1;
}
-static gboolean btsnoop_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean btsnoop_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return btsnoop_read_record(wfth, wfth->fh, &wth->phdr, wfth->frame_buffer,
+ return btsnoop_read_record(wth, wth->fh, &wth->phdr, wth->frame_buffer,
err, err_info);
}
-static gboolean btsnoop_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean btsnoop_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- return btsnoop_read_record(wfth, wfth->random_fh, phdr, buf, err, err_info);
+ return btsnoop_read_record(wth, wth->random_fh, phdr, buf, err, err_info);
}
-static gboolean btsnoop_read_record(wftap *wfth, FILE_T fh,
+static gboolean btsnoop_read_record(wtap *wth, FILE_T fh,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
int bytes_read;
@@ -224,12 +221,10 @@ static gboolean btsnoop_read_record(wftap *wfth, FILE_T fh,
phdr->ts.nsecs = (guint)((ts % 1000000) * 1000);
phdr->caplen = packet_size;
phdr->len = orig_size;
- switch(wfth->file_encap)
+ if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR)
{
- case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
phdr->pseudo_header.p2p.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE;
- break;
- case WTAP_ENCAP_BLUETOOTH_HCI:
+ } else if(wth->file_encap == WTAP_ENCAP_BLUETOOTH_HCI) {
phdr->pseudo_header.bthci.sent = (flags & KHciLoggerControllerToHost) ? FALSE : TRUE;
if(flags & KHciLoggerCommandOrEvent)
{
@@ -246,13 +241,12 @@ static gboolean btsnoop_read_record(wftap *wfth, FILE_T fh,
{
phdr->pseudo_header.bthci.channel = BTHCI_CHANNEL_ACL;
}
- break;
- case WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR:
+ } else if (wth->file_encap == 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);
}
@@ -303,7 +297,7 @@ static guint8 btsnoop_lookup_flags(guint8 hci_type, gboolean sent, guint8 *flags
return FALSE;
}
-static gboolean btsnoop_dump_partial_rec_hdr(wftap_dumper *wdh _U_,
+static gboolean btsnoop_dump_partial_rec_hdr(wtap_dumper *wdh _U_,
const struct wtap_pkthdr *phdr,
const union wtap_pseudo_header *pseudo_header,
const guint8 *pd, int *err,
@@ -330,10 +324,10 @@ static gboolean btsnoop_dump_partial_rec_hdr(wftap_dumper *wdh _U_,
}
/* FIXME: How do we support multiple backends?*/
-static gboolean btsnoop_dump_h1(wftap_dumper *wdh, void* header,
+static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
+ const struct wtap_pkthdr *phdr,
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;
@@ -352,7 +346,7 @@ static gboolean btsnoop_dump_h1(wftap_dumper *wdh, void* header,
rec_hdr.incl_len = GUINT32_TO_BE(phdr->caplen-1);
rec_hdr.orig_len = GUINT32_TO_BE(phdr->len-1);
- if (!wftap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
+ if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
return FALSE;
wdh->bytes_dumped += sizeof rec_hdr;
@@ -360,7 +354,7 @@ static gboolean btsnoop_dump_h1(wftap_dumper *wdh, void* header,
/* Skip HCI packet type */
++pd;
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen-1, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen-1, err))
return FALSE;
wdh->bytes_dumped += phdr->caplen-1;
@@ -368,7 +362,7 @@ static gboolean btsnoop_dump_h1(wftap_dumper *wdh, void* header,
return TRUE;
}
-static gboolean btsnoop_dump_h4(wftap_dumper *wdh,
+static gboolean btsnoop_dump_h4(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -387,12 +381,12 @@ static gboolean btsnoop_dump_h4(wftap_dumper *wdh,
rec_hdr.incl_len = GUINT32_TO_BE(phdr->caplen);
rec_hdr.orig_len = GUINT32_TO_BE(phdr->len);
- if (!wftap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
+ if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
return FALSE;
wdh->bytes_dumped += sizeof rec_hdr;
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
wdh->bytes_dumped += phdr->caplen;
@@ -401,7 +395,7 @@ static gboolean btsnoop_dump_h4(wftap_dumper *wdh,
}
/* FIXME: How do we support multiple backends?*/
-gboolean btsnoop_dump_open_h1(wftap_dumper *wdh, int *err)
+gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err)
{
struct btsnoop_hdr file_hdr;
@@ -423,7 +417,7 @@ gboolean btsnoop_dump_open_h1(wftap_dumper *wdh, int *err)
return FALSE;
}
- if (!wftap_dump_file_write(wdh, btsnoop_magic, sizeof btsnoop_magic, err))
+ if (!wtap_dump_file_write(wdh, btsnoop_magic, sizeof btsnoop_magic, err))
return FALSE;
wdh->bytes_dumped += sizeof btsnoop_magic;
@@ -433,7 +427,7 @@ gboolean btsnoop_dump_open_h1(wftap_dumper *wdh, int *err)
/* HCI type encoded in first byte */
file_hdr.datalink = GUINT32_TO_BE(KHciLoggerDatalinkTypeH1);
- if (!wftap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
+ if (!wtap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
return FALSE;
wdh->bytes_dumped += sizeof file_hdr;
@@ -443,7 +437,7 @@ gboolean btsnoop_dump_open_h1(wftap_dumper *wdh, int *err)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */
-gboolean btsnoop_dump_open_h4(wftap_dumper *wdh, int *err)
+gboolean btsnoop_dump_open_h4(wtap_dumper *wdh, int *err)
{
struct btsnoop_hdr file_hdr;
@@ -465,7 +459,7 @@ gboolean btsnoop_dump_open_h4(wftap_dumper *wdh, int *err)
return FALSE;
}
- if (!wftap_dump_file_write(wdh, btsnoop_magic, sizeof btsnoop_magic, err))
+ if (!wtap_dump_file_write(wdh, btsnoop_magic, sizeof btsnoop_magic, err))
return FALSE;
wdh->bytes_dumped += sizeof btsnoop_magic;
@@ -475,7 +469,7 @@ gboolean btsnoop_dump_open_h4(wftap_dumper *wdh, int *err)
/* HCI type encoded in first byte */
file_hdr.datalink = GUINT32_TO_BE(KHciLoggerDatalinkTypeH4);
- if (!wftap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
+ if (!wtap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
return FALSE;
wdh->bytes_dumped += sizeof file_hdr;
diff --git a/wiretap/btsnoop.h b/wiretap/btsnoop.h
index 01794b5f92..66f699b448 100644
--- a/wiretap/btsnoop.h
+++ b/wiretap/btsnoop.h
@@ -23,9 +23,9 @@
#include <glib.h>
#include "ws_symbol_export.h"
-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_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_dump_can_write_encap(int encap);
#endif
diff --git a/wiretap/camins.c b/wiretap/camins.c
index b1edeff158..ccc618498a 100644
--- a/wiretap/camins.c
+++ b/wiretap/camins.c
@@ -62,7 +62,6 @@
#include <string.h>
#include <glib.h>
#include <wtap.h>
-#include <wftap-int.h>
#include <wtap-int.h>
#include <file_wrappers.h>
#include <buffer.h>
@@ -298,29 +297,28 @@ camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
static gboolean
-camins_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+camins_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return camins_read_packet(wfth->fh, &wth->phdr, wfth->frame_buffer, err,
- err_info);
+ return camins_read_packet(wth->fh, &wth->phdr, wth->frame_buffer, err,
+ err_info);
}
static gboolean
-camins_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+camins_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *pkthdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *pkthdr = (struct wtap_pkthdr *)header;
- if (-1 == file_seek(wfth->random_fh, seek_off, SEEK_SET, err))
+ if (-1 == file_seek(wth->random_fh, seek_off, SEEK_SET, err))
return FALSE;
- return camins_read_packet(wfth->random_fh, pkthdr, buf, err, err_info);
+ return camins_read_packet(wth->random_fh, pkthdr, buf, err, err_info);
}
-int camins_open(wftap *wfth, int *err, gchar **err_info _U_)
+
+int camins_open(wtap *wth, int *err, gchar **err_info _U_)
{
guint8 found_start_blocks = 0;
guint8 count = 0;
@@ -330,7 +328,7 @@ int camins_open(wftap *wfth, 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), wfth->fh);
+ bytes_read = file_read(block, sizeof(block), wth->fh);
if (bytes_read != sizeof(block))
break;
@@ -344,18 +342,18 @@ int camins_open(wftap *wfth, 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(wfth->fh, 0, SEEK_SET, err))
+ if (-1 == file_seek(wth->fh, 0, SEEK_SET, err))
return -1;
- wfth->file_encap = WTAP_ENCAP_DVBCI;
- wfth->snapshot_length = 0;
- wfth->tsprecision = WTAP_FILE_TSPREC_MSEC;
+ wth->file_encap = WTAP_ENCAP_DVBCI;
+ wth->snapshot_length = 0;
+ wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
- wfth->priv = NULL;
+ wth->priv = NULL;
- wfth->subtype_read = camins_read;
- wfth->subtype_seek_read = camins_seek_read;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CAMINS;
+ wth->subtype_read = camins_read;
+ wth->subtype_seek_read = camins_seek_read;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CAMINS;
*err = 0;
return 1;
diff --git a/wiretap/camins.h b/wiretap/camins.h
index 993bedad0e..785488e361 100644
--- a/wiretap/camins.h
+++ b/wiretap/camins.h
@@ -28,6 +28,6 @@
#include <glib.h>
#include <wiretap/wtap.h>
-int camins_open(wftap *wfth, int *err, gchar **err_info);
+int camins_open(wtap *wth, int *err, gchar **err_info);
#endif /* _CAMINS_H */
diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c
index e129e9a6ea..8b29a23880 100644
--- a/wiretap/catapult_dct2000.c
+++ b/wiretap/catapult_dct2000.c
@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <ctype.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -104,15 +103,15 @@ static const gchar catapult_dct2000_magic[] = "Session Transcript";
/************************************************************/
/* Functions called from wiretap core */
-static gboolean catapult_dct2000_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean catapult_dct2000_seek_read(wftap *wfth, gint64 seek_off,
- void* header,
+static gboolean catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr,
Buffer *buf, int *err,
gchar **err_info);
-static void catapult_dct2000_close(wftap *wfth);
+static void catapult_dct2000_close(wtap *wth);
-static gboolean catapult_dct2000_dump(wftap_dumper *wdh, void* header,
+static gboolean catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
@@ -132,7 +131,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(wftap *wfth,
+static void process_parsed_line(wtap *wth,
dct2000_file_externals_t *file_externals,
struct wtap_pkthdr *phdr,
Buffer *buf, gint64 file_offset,
@@ -168,7 +167,7 @@ static gboolean free_line_prefix_info(gpointer key, gpointer value, gpointer use
/* Open file (for reading) */
/********************************************/
int
-catapult_dct2000_open(wftap *wfth, int *err, gchar **err_info)
+catapult_dct2000_open(wtap *wth, int *err, gchar **err_info)
{
gint64 offset = 0;
time_t timestamp;
@@ -185,7 +184,7 @@ catapult_dct2000_open(wftap *wfth, int *err, gchar **err_info)
/********************************************************************/
/* First line needs to contain at least as many characters as magic */
- if (!read_new_line(wfth->fh, &offset, &firstline_length, linebuff,
+ if (!read_new_line(wth->fh, &offset, &firstline_length, linebuff,
sizeof linebuff, err, err_info)) {
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
@@ -224,7 +223,7 @@ catapult_dct2000_open(wftap *wfth, int *err, gchar **err_info)
/* Second line contains file timestamp */
/* Store this offset in in file_externals */
- if (!read_new_line(wfth->fh, &offset, &(file_externals->secondline_length),
+ if (!read_new_line(wth->fh, &offset, &(file_externals->secondline_length),
linebuff, sizeof linebuff, err, err_info)) {
g_free(file_externals);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
@@ -251,18 +250,18 @@ catapult_dct2000_open(wftap *wfth, int *err, gchar **err_info)
/* File is for us. Fill in details so packets can be read */
/* Set our file type */
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000;
/* Use our own encapsulation to send all packets to our stub dissector */
- wfth->file_encap = WTAP_ENCAP_CATAPULT_DCT2000;
+ wth->file_encap = WTAP_ENCAP_CATAPULT_DCT2000;
/* Callbacks for reading operations */
- wfth->subtype_read = catapult_dct2000_read;
- wfth->subtype_seek_read = catapult_dct2000_seek_read;
- wfth->subtype_close = catapult_dct2000_close;
+ wth->subtype_read = catapult_dct2000_read;
+ wth->subtype_seek_read = catapult_dct2000_seek_read;
+ wth->subtype_close = catapult_dct2000_close;
/* Choose microseconds (have 4 decimal places...) */
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
/***************************************************************/
@@ -271,7 +270,7 @@ catapult_dct2000_open(wftap *wfth, 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 */
- wfth->priv = (void*)file_externals;
+ wth->priv = (void*)file_externals;
*err = errno;
return 1;
@@ -335,18 +334,17 @@ static void write_timestamp_string(char *timestamp_string, int secs, int tenthou
/* - return TRUE and details if found */
/**************************************************/
static gboolean
-catapult_dct2000_read(wftap *wfth, int *err, gchar **err_info,
+catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- gint64 offset = file_tell(wfth->fh);
+ gint64 offset = file_tell(wth->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*)wfth->priv;
+ (dct2000_file_externals_t*)wth->priv;
/* Search for a line containing a usable packet */
while (1) {
@@ -363,13 +361,13 @@ catapult_dct2000_read(wftap *wfth, int *err, gchar **err_info,
gchar outhdr_name[MAX_OUTHDR_NAME+1];
/* Are looking for first packet after 2nd line */
- if (file_tell(wfth->fh) == 0) {
+ if (file_tell(wth->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(wfth->fh, &offset, &line_length, linebuff,
+ if (!read_new_line(wth->fh, &offset, &line_length, linebuff,
sizeof linebuff, err, err_info)) {
if (*err != 0)
return FALSE; /* error */
@@ -396,9 +394,9 @@ catapult_dct2000_read(wftap *wfth, int *err, gchar **err_info,
*/
*data_offset = this_offset;
- process_parsed_line(wfth, file_externals,
+ process_parsed_line(wth, file_externals,
&wth->phdr,
- wfth->frame_buffer, this_offset,
+ wth->frame_buffer, this_offset,
linebuff, dollar_offset,
seconds, useconds, timestamp_string,
direction, encap,
@@ -449,8 +447,8 @@ catapult_dct2000_read(wftap *wfth, int *err, gchar **err_info,
/* Read & seek function. */
/**************************************************/
static gboolean
-catapult_dct2000_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
gint64 offset = 0;
@@ -468,22 +466,21 @@ catapult_dct2000_seek_read(wftap *wfth, 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*)wfth->priv;
+ (dct2000_file_externals_t*)wth->priv;
/* Reset errno */
*err = errno = 0;
/* Seek to beginning of packet */
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1) {
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
return FALSE;
}
/* Re-read whole line (this really should succeed) */
- if (!read_new_line(wfth->random_fh, &offset, &length, linebuff,
+ if (!read_new_line(wth->random_fh, &offset, &length, linebuff,
sizeof linebuff, err, err_info)) {
return FALSE;
}
@@ -500,7 +497,7 @@ catapult_dct2000_seek_read(wftap *wfth, gint64 seek_off,
write_timestamp_string(timestamp_string, seconds, useconds/100);
- process_parsed_line(wfth, file_externals,
+ process_parsed_line(wth, file_externals,
phdr, buf, seek_off,
linebuff, dollar_offset,
seconds, useconds, timestamp_string,
@@ -527,11 +524,11 @@ catapult_dct2000_seek_read(wftap *wfth, gint64 seek_off,
/* Free dct2000-specific capture info from file that was open for reading */
/***************************************************************************/
static void
-catapult_dct2000_close(wftap *wfth)
+catapult_dct2000_close(wtap *wth)
{
/* Get externals for this file */
dct2000_file_externals_t *file_externals =
- (dct2000_file_externals_t*)wfth->priv;
+ (dct2000_file_externals_t*)wth->priv;
/* Free up its line prefix values */
g_hash_table_foreach_remove(file_externals->packet_prefix_table,
@@ -557,7 +554,7 @@ typedef struct {
/* Set other dump callbacks. */
/*****************************************************/
gboolean
-catapult_dct2000_dump_open(wftap_dumper *wdh, int *err _U_)
+catapult_dct2000_dump_open(wtap_dumper *wdh, int *err _U_)
{
/* Fill in other dump callbacks */
wdh->subtype_write = catapult_dct2000_dump;
@@ -589,7 +586,7 @@ catapult_dct2000_dump_can_write_encap(int encap)
/*****************************************/
static gboolean
-catapult_dct2000_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
@@ -606,28 +603,28 @@ catapult_dct2000_dump(wftap_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.wfth->priv;
+ (dct2000_file_externals_t*)pseudo_header->dct2000.wth->priv;
dct2000 = (dct2000_dump_t *)wdh->priv;
if (dct2000 == NULL) {
/* Write out saved first line */
- if (!wftap_dump_file_write(wdh, file_externals->firstline,
+ if (!wtap_dump_file_write(wdh, file_externals->firstline,
file_externals->firstline_length, err)) {
return FALSE;
}
- if (!wftap_dump_file_write(wdh, "\n", 1, err)) {
+ if (!wtap_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 (!wftap_dump_file_write(wdh, file_externals->secondline,
+ if (!wtap_dump_file_write(wdh, file_externals->secondline,
file_externals->secondline_length, err)) {
return FALSE;
}
- if (!wftap_dump_file_write(wdh, "\n", 1, err)) {
+ if (!wtap_dump_file_write(wdh, "\n", 1, err)) {
return FALSE;
}
@@ -653,7 +650,7 @@ catapult_dct2000_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
(const void*)&(pseudo_header->dct2000.seek_off));
/* Write out text before timestamp */
- if (!wftap_dump_file_write(wdh, prefix->before_time,
+ if (!wtap_dump_file_write(wdh, prefix->before_time,
strlen(prefix->before_time), err)) {
return FALSE;
}
@@ -683,18 +680,18 @@ catapult_dct2000_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
}
/* Write out the calculated timestamp */
- if (!wftap_dump_file_write(wdh, time_string, strlen(time_string), err)) {
+ if (!wtap_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 (!wftap_dump_file_write(wdh, " l ", strlen(" l "), err)) {
+ if (!wtap_dump_file_write(wdh, " l ", strlen(" l "), err)) {
return FALSE;
}
}
else {
- if (!wftap_dump_file_write(wdh, prefix->after_time,
+ if (!wtap_dump_file_write(wdh, prefix->after_time,
strlen(prefix->after_time), err)) {
return FALSE;
}
@@ -736,7 +733,7 @@ catapult_dct2000_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
/**************************************/
/* Remainder is encapsulated protocol */
- if (!wftap_dump_file_write(wdh, is_sprint ? " " : "$", 1, err)) {
+ if (!wtap_dump_file_write(wdh, is_sprint ? " " : "$", 1, err)) {
return FALSE;
}
@@ -748,7 +745,7 @@ catapult_dct2000_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
c[1] = char_from_hex((guint8)(pd[n] & 0x0f));
/* Write both hex chars of byte together */
- if (!wftap_dump_file_write(wdh, c, 2, err)) {
+ if (!wtap_dump_file_write(wdh, c, 2, err)) {
return FALSE;
}
}
@@ -759,14 +756,14 @@ catapult_dct2000_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
c[0] = pd[n];
/* Write both hex chars of byte together */
- if (!wftap_dump_file_write(wdh, c, 1, err)) {
+ if (!wtap_dump_file_write(wdh, c, 1, err)) {
return FALSE;
}
}
}
/* End the line */
- if (!wftap_dump_file_write(wdh, "\n", 1, err)) {
+ if (!wtap_dump_file_write(wdh, "\n", 1, err)) {
return FALSE;
}
@@ -1263,7 +1260,7 @@ parse_line(gchar *linebuff, gint line_length,
/* Process results of parse_line() */
/***********************************/
static void
-process_parsed_line(wftap *wfth, dct2000_file_externals_t *file_externals,
+process_parsed_line(wtap *wth, dct2000_file_externals_t *file_externals,
struct wtap_pkthdr *phdr,
Buffer *buf, gint64 file_offset,
char *linebuff, long dollar_offset,
@@ -1364,7 +1361,7 @@ process_parsed_line(wftap *wfth, dct2000_file_externals_t *file_externals,
/*****************************************/
/* Set packet pseudo-header if necessary */
phdr->pseudo_header.dct2000.seek_off = file_offset;
- phdr->pseudo_header.dct2000.wfth = wfth;
+ phdr->pseudo_header.dct2000.wth = wth;
switch (encap) {
case WTAP_ENCAP_ATM_PDUS_UNTRUNCATED:
diff --git a/wiretap/catapult_dct2000.h b/wiretap/catapult_dct2000.h
index be0d89d9cd..e145a643d9 100644
--- a/wiretap/catapult_dct2000.h
+++ b/wiretap/catapult_dct2000.h
@@ -24,8 +24,8 @@
#include <glib.h>
#include "ws_symbol_export.h"
-int catapult_dct2000_open(wftap *wfth, int *err, gchar **err_info);
-gboolean catapult_dct2000_dump_open(wftap_dumper *wdh, int *err);
+int catapult_dct2000_open(wtap *wth, int *err, gchar **err_info);
+gboolean catapult_dct2000_dump_open(wtap_dumper *wdh, int *err);
int catapult_dct2000_dump_can_write_encap(int encap);
#define DCT2000_ENCAP_UNHANDLED 0
diff --git a/wiretap/commview.c b/wiretap/commview.c
index 3dd0547218..e2a868a6b2 100644
--- a/wiretap/commview.c
+++ b/wiretap/commview.c
@@ -37,7 +37,6 @@
#include <string.h>
#include "wtap.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "file_wrappers.h"
@@ -79,20 +78,21 @@ typedef struct commview_header {
#define MEDIUM_WIFI 1
#define MEDIUM_TOKEN_RING 2
-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(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_header(commview_header_t *cv_hdr, FILE_T fh,
- int *err, gchar **err_info);
-static gboolean commview_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const guint8 *pd, int *err);
+ int *err, gchar **err_info);
+static gboolean commview_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
+ const guint8 *pd, int *err);
-int commview_open(wftap *wfth, int *err, gchar **err_info)
+int commview_open(wtap *wth, int *err, gchar **err_info)
{
commview_header_t cv_hdr;
- if(!commview_read_header(&cv_hdr, wfth->fh, err, err_info)) {
+ if(!commview_read_header(&cv_hdr, wth->fh, err, err_info)) {
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -114,16 +114,16 @@ int commview_open(wftap *wfth, 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(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
/* Set up the pointers to the handlers for this file type */
- wfth->subtype_read = commview_read;
- wfth->subtype_seek_read = commview_seek_read;
+ wth->subtype_read = commview_read;
+ wth->subtype_seek_read = commview_seek_read;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_COMMVIEW;
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_COMMVIEW;
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1; /* Our kind of file */
}
@@ -185,24 +185,22 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
}
static gboolean
-commview_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return commview_read_packet(wfth->fh, &wth->phdr, wfth->frame_buffer, err,
+ return commview_read_packet(wth->fh, &wth->phdr, wth->frame_buffer, err,
err_info);
}
static gboolean
-commview_seek_read(wftap *wfth, gint64 seek_off, void* header,
+commview_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if(file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if(file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- return commview_read_packet(wfth->random_fh, phdr, buf, err, err_info);
+ return commview_read_packet(wth->random_fh, phdr, buf, err, err_info);
}
static gboolean
@@ -257,7 +255,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(wftap_dumper *wdh, int *err _U_)
+gboolean commview_dump_open(wtap_dumper *wdh, int *err _U_)
{
wdh->subtype_write = commview_dump;
wdh->subtype_close = NULL;
@@ -270,7 +268,7 @@ gboolean commview_dump_open(wftap_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(wftap_dumper *wdh,
+static gboolean commview_dump(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -328,45 +326,45 @@ static gboolean commview_dump(wftap_dumper *wdh,
return FALSE;
}
- if (!wftap_dump_file_write(wdh, &cv_hdr.data_len, 2, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.data_len, 2, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.source_data_len, 2, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.source_data_len, 2, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.version, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.version, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.year, 2, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.year, 2, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.month, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.month, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.day, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.day, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.hours, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.hours, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.minutes, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.minutes, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.seconds, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.seconds, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.usecs, 4, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.usecs, 4, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.flags, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.flags, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.signal_level_percent, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.signal_level_percent, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.rate, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.rate, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.band, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.band, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.channel, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.channel, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.direction, 1, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.direction, 1, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.signal_level_dbm, 2, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.signal_level_dbm, 2, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, &cv_hdr.noise_level, 2, err))
+ if (!wtap_dump_file_write(wdh, &cv_hdr.noise_level, 2, err))
return FALSE;
wdh->bytes_dumped += COMMVIEW_HEADER_SIZE;
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
wdh->bytes_dumped += phdr->caplen;
diff --git a/wiretap/commview.h b/wiretap/commview.h
index 87f3d2d9ae..7c02006b48 100644
--- a/wiretap/commview.h
+++ b/wiretap/commview.h
@@ -25,9 +25,9 @@
#include <glib.h>
#include "ws_symbol_export.h"
-int commview_open(wftap *wfth, int *err, gchar **err_info _U_);
+int commview_open(wtap *wth, int *err, gchar **err_info _U_);
int commview_dump_can_write_encap(int encap);
-gboolean commview_dump_open(wftap_dumper *wdh, int *err);
+gboolean commview_dump_open(wtap_dumper *wdh, int *err);
#endif /* __COMMVIEW_H__ */
diff --git a/wiretap/cosine.c b/wiretap/cosine.c
index 8d6b905d86..d937018796 100644
--- a/wiretap/cosine.c
+++ b/wiretap/cosine.c
@@ -22,7 +22,6 @@
*/
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "cosine.h"
@@ -164,13 +163,13 @@
#define COSINE_MAX_PACKET_LEN 65536
static gboolean empty_line(const gchar *line);
-static gint64 cosine_seek_next_packet(wftap *wfth, int *err, gchar **err_info,
+static gint64 cosine_seek_next_packet(wtap *wth, int *err, gchar **err_info,
char *hdr);
-static gboolean cosine_check_file_type(wftap *wfth, int *err, gchar **err_info);
-static gboolean cosine_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean cosine_check_file_type(wtap *wth, int *err, gchar **err_info);
+static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean cosine_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean cosine_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, 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,
@@ -200,21 +199,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(wftap *wfth, int *err, gchar **err_info,
+static gint64 cosine_seek_next_packet(wtap *wth, int *err, gchar **err_info,
char *hdr)
{
gint64 cur_off;
char buf[COSINE_LINE_LENGTH];
while (1) {
- cur_off = file_tell(wfth->fh);
+ cur_off = file_tell(wth->fh);
if (cur_off == -1) {
/* Error */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return -1;
}
- if (file_gets(buf, sizeof(buf), wfth->fh) == NULL) {
- *err = file_error(wfth->fh, err_info);
+ if (file_gets(buf, sizeof(buf), wth->fh) == NULL) {
+ *err = file_error(wth->fh, err_info);
return -1;
}
if (strstr(buf, COSINE_REC_MAGIC_STR1) ||
@@ -233,7 +232,7 @@ static gint64 cosine_seek_next_packet(wftap *wfth, 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(wftap *wfth, int *err, gchar **err_info)
+static gboolean cosine_check_file_type(wtap *wth, int *err, gchar **err_info)
{
char buf[COSINE_LINE_LENGTH];
gsize reclen;
@@ -242,9 +241,9 @@ static gboolean cosine_check_file_type(wftap *wfth, 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, wfth->fh) == NULL) {
+ if (file_gets(buf, COSINE_LINE_LENGTH, wth->fh) == NULL) {
/* EOF or error. */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return FALSE;
}
@@ -264,39 +263,38 @@ static gboolean cosine_check_file_type(wftap *wfth, int *err, gchar **err_info)
}
-int cosine_open(wftap *wfth, int *err, gchar **err_info)
+int cosine_open(wtap *wth, int *err, gchar **err_info)
{
/* Look for CoSine header */
- if (!cosine_check_file_type(wfth, err, err_info)) {
+ if (!cosine_check_file_type(wth, err, err_info)) {
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
- if (file_seek(wfth->fh, 0L, SEEK_SET, err) == -1) /* rewind */
+ if (file_seek(wth->fh, 0L, SEEK_SET, err) == -1) /* rewind */
return -1;
- 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;
+ 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;
return 1;
}
/* Find the next packet and parse it; called from wtap_read(). */
-static gboolean cosine_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean cosine_read(wtap *wth, 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(wfth, err, err_info, line);
+ offset = cosine_seek_next_packet(wth, err, err_info, line);
if (offset < 0)
return FALSE;
*data_offset = offset;
@@ -307,24 +305,23 @@ static gboolean cosine_read(wftap *wfth, int *err, gchar **err_info,
return FALSE;
/* Convert the ASCII hex dump to binary data */
- return parse_cosine_hex_dump(wfth->fh, &wth->phdr, pkt_len,
- wfth->frame_buffer, err, err_info);
+ return parse_cosine_hex_dump(wth->fh, &wth->phdr, pkt_len,
+ wth->frame_buffer, err, err_info);
}
/* Used to read packets in random-access fashion */
static gboolean
-cosine_seek_read(wftap *wfth, gint64 seek_off, void* header,
+cosine_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
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(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (file_gets(line, COSINE_LINE_LENGTH, wfth->random_fh) == NULL) {
- *err = file_error(wfth->random_fh, err_info);
+ if (file_gets(line, COSINE_LINE_LENGTH, wth->random_fh) == NULL) {
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0) {
*err = WTAP_ERR_SHORT_READ;
}
@@ -337,7 +334,7 @@ cosine_seek_read(wftap *wfth, gint64 seek_off, void* header,
return FALSE;
/* Convert the ASCII hex dump to binary data */
- return parse_cosine_hex_dump(wfth->random_fh, phdr, pkt_len, buf, err,
+ return parse_cosine_hex_dump(wth->random_fh, phdr, pkt_len, buf, err,
err_info);
}
diff --git a/wiretap/cosine.h b/wiretap/cosine.h
index 37958fba6e..c6bb424251 100644
--- a/wiretap/cosine.h
+++ b/wiretap/cosine.h
@@ -28,6 +28,6 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int cosine_open(wftap *wfth, int *err, gchar **err_info);
+int cosine_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/csids.c b/wiretap/csids.c
index 7c2a4f1f87..bc640f639d 100644
--- a/wiretap/csids.c
+++ b/wiretap/csids.c
@@ -19,7 +19,6 @@
*/
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "csids.h"
@@ -45,10 +44,10 @@ typedef struct {
gboolean byteswapped;
} csids_t;
-static gboolean csids_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean csids_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean csids_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean csids_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, 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);
@@ -59,7 +58,7 @@ struct csids_header {
};
/* XXX - return -1 on I/O error and actually do something with 'err'. */
-int csids_open(wftap *wfth, int *err, gchar **err_info)
+int csids_open(wtap *wth, 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
@@ -76,30 +75,30 @@ int csids_open(wftap *wfth, 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), wfth->fh );
+ bytesRead = file_read( &hdr, sizeof( struct csids_header), wth->fh );
if( bytesRead != sizeof( struct csids_header) ) {
- *err = file_error( wfth->fh, err_info );
+ *err = file_error( wth->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, wfth->fh );
+ bytesRead = file_read( &tmp, 2, wth->fh );
if( bytesRead != 2 ) {
- *err = file_error( wfth->fh, err_info );
+ *err = file_error( wth->fh, err_info );
if( *err != 0 && *err != WTAP_ERR_SHORT_READ ) {
return -1;
}
return 0;
}
- bytesRead = file_read( &iplen, 2, wfth->fh );
+ bytesRead = file_read( &iplen, 2, wth->fh );
if( bytesRead != 2 ) {
- *err = file_error( wfth->fh, err_info );
+ *err = file_error( wth->fh, err_info );
if( *err != 0 && *err != WTAP_ERR_SHORT_READ ) {
return -1;
}
@@ -128,51 +127,49 @@ int csids_open(wftap *wfth, int *err, gchar **err_info)
}
/* no file header. So reset the fh to 0 so we can read the first packet */
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
csids = (csids_t *)g_malloc(sizeof(csids_t));
- wfth->priv = (void *)csids;
+ wth->priv = (void *)csids;
csids->byteswapped = byteswap;
- 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;
+ 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;
return 1;
}
/* Find the next packet and parse it; called from wtap_read(). */
-static gboolean csids_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean csids_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- csids_t *csids = (csids_t *)wfth->priv;
- wtap* wth = (wtap*)wfth->tap_specific_data;
+ csids_t *csids = (csids_t *)wth->priv;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return csids_read_packet( wfth->fh, csids, &wth->phdr, wfth->frame_buffer,
+ return csids_read_packet( wth->fh, csids, &wth->phdr, wth->frame_buffer,
err, err_info );
}
/* Used to read packets in random-access fashion */
static gboolean
-csids_seek_read(wftap *wfth,
+csids_seek_read(wtap *wth,
gint64 seek_off,
- void* header,
+ struct wtap_pkthdr *phdr,
Buffer *buf,
int *err,
gchar **err_info)
{
- csids_t *csids = (csids_t *)wfth->priv;
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
+ csids_t *csids = (csids_t *)wth->priv;
- if( file_seek( wfth->random_fh, seek_off, SEEK_SET, err ) == -1 )
+ if( file_seek( wth->random_fh, seek_off, SEEK_SET, err ) == -1 )
return FALSE;
- if( !csids_read_packet( wfth->random_fh, csids, phdr, buf, err, err_info ) ) {
+ if( !csids_read_packet( wth->random_fh, csids, phdr, buf, err, err_info ) ) {
if( *err == 0 )
*err = WTAP_ERR_SHORT_READ;
return FALSE;
diff --git a/wiretap/csids.h b/wiretap/csids.h
index 8c2684780a..8f19f63964 100644
--- a/wiretap/csids.h
+++ b/wiretap/csids.h
@@ -25,6 +25,6 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int csids_open(wftap *wfth, int *err, gchar **err_info);
+int csids_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/daintree-sna.c b/wiretap/daintree-sna.c
index 08821c825b..23785548d2 100644
--- a/wiretap/daintree-sna.c
+++ b/wiretap/daintree-sna.c
@@ -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,7 +54,6 @@
#include <ctype.h>
#include "wtap.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "file_wrappers.h"
@@ -78,11 +77,11 @@ static const char daintree_magic_text[] =
#define COMMENT_LINE daintree_magic_text[0]
-static gboolean daintree_sna_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean daintree_sna_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean daintree_sna_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+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_scan_header(struct wtap_pkthdr *phdr,
char *readLine, char *readData, int *err, gchar **err_info);
@@ -91,14 +90,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(wftap *wfth, int *err, gchar **err_info)
+int daintree_sna_open(wtap *wth, 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, wfth->fh)==NULL) {
- *err = file_error(wfth->fh, err_info);
+ if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wth->fh)==NULL) {
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -112,8 +111,8 @@ int daintree_sna_open(wftap *wfth, int *err, gchar **err_info)
}
/* read second header line */
- if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wfth->fh)==NULL) {
- *err = file_error(wfth->fh, err_info);
+ if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wth->fh)==NULL) {
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -121,14 +120,14 @@ int daintree_sna_open(wftap *wfth, 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 */
- wfth->subtype_read = daintree_sna_read;
- wfth->subtype_seek_read = daintree_sna_seek_read;
+ wth->subtype_read = daintree_sna_read;
+ wth->subtype_seek_read = daintree_sna_seek_read;
/* set up for file type */
- 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 */
+ 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 */
return 1; /* it's a Daintree file */
}
@@ -136,19 +135,18 @@ int daintree_sna_open(wftap *wfth, 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(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+daintree_sna_read(wtap *wth, 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(wfth->fh);
+ *data_offset = file_tell(wth->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, wfth->fh) == NULL) {
- *err = file_error(wfth->fh, err_info);
+ if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wth->fh) == NULL) {
+ *err = file_error(wth->fh, err_info);
return FALSE; /* all done */
}
} while (readLine[0] == COMMENT_LINE);
@@ -159,28 +157,27 @@ daintree_sna_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
return FALSE;
/* process packet data */
- return daintree_sna_process_hex_data(&wth->phdr, wfth->frame_buffer,
+ return daintree_sna_process_hex_data(&wth->phdr, wth->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(wftap *wfth, gint64 seek_off, void* header,
+daintree_sna_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
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(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if(file_seek(wth->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, wfth->random_fh) == NULL) {
- *err = file_error(wfth->random_fh, err_info);
+ if (file_gets(readLine, DAINTREE_MAX_LINE_SIZE, wth->random_fh) == NULL) {
+ *err = file_error(wth->random_fh, err_info);
return FALSE; /* all done */
}
} while (readLine[0] == COMMENT_LINE);
diff --git a/wiretap/daintree-sna.h b/wiretap/daintree-sna.h
index 8e94902984..1ad396a4e3 100644
--- a/wiretap/daintree-sna.h
+++ b/wiretap/daintree-sna.h
@@ -27,7 +27,7 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int daintree_sna_open(wftap *wfth, int *err, gchar **err_info _U_);
+int daintree_sna_open(wtap *wth, int *err, gchar **err_info _U_);
#endif /* __DAINTREE_SNA_H__ */
diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c
index 6cc1e98db7..0a3e9f57e1 100644
--- a/wiretap/dbs-etherwatch.c
+++ b/wiretap/dbs-etherwatch.c
@@ -19,7 +19,6 @@
*/
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "dbs-etherwatch.h"
@@ -85,10 +84,10 @@ static const char dbs_etherwatch_rec_magic[] =
*/
#define DBS_ETHERWATCH_MAX_PACKET_LEN 16384
-static gboolean dbs_etherwatch_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean dbs_etherwatch_seek_read(wftap *wth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean dbs_etherwatch_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, 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,
@@ -98,22 +97,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(wftap *wfth, int *err,
+static gint64 dbs_etherwatch_seek_next_packet(wtap *wth, int *err,
gchar **err_info)
{
int byte;
unsigned int level = 0;
gint64 cur_off;
- while ((byte = file_getc(wfth->fh)) != EOF) {
+ while ((byte = file_getc(wth->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(wfth->fh);
+ cur_off = file_tell(wth->fh);
if (cur_off == -1) {
/* Error. */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return -1;
}
return cur_off + 1;
@@ -123,7 +122,7 @@ static gint64 dbs_etherwatch_seek_next_packet(wftap *wfth, int *err,
}
}
/* EOF or error. */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return -1;
}
@@ -137,7 +136,7 @@ static gint64 dbs_etherwatch_seek_next_packet(wftap *wfth, 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(wftap *wfth, int *err,
+static gboolean dbs_etherwatch_check_file_type(wtap *wth, int *err,
gchar **err_info)
{
char buf[DBS_ETHERWATCH_LINE_LENGTH];
@@ -148,9 +147,9 @@ static gboolean dbs_etherwatch_check_file_type(wftap *wfth, 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, wfth->fh) == NULL) {
+ if (file_gets(buf, DBS_ETHERWATCH_LINE_LENGTH, wth->fh) == NULL) {
/* EOF or error. */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return FALSE;
}
@@ -177,53 +176,51 @@ static gboolean dbs_etherwatch_check_file_type(wftap *wfth, int *err,
}
-int dbs_etherwatch_open(wftap *wfth, int *err, gchar **err_info)
+int dbs_etherwatch_open(wtap *wth, int *err, gchar **err_info)
{
/* Look for DBS ETHERWATCH header */
- if (!dbs_etherwatch_check_file_type(wfth, err, err_info)) {
+ if (!dbs_etherwatch_check_file_type(wth, err, err_info)) {
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
- 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;
+ 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;
return 1;
}
/* Find the next packet and parse it; called from wtap_read(). */
-static gboolean dbs_etherwatch_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean dbs_etherwatch_read(wtap *wth, 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(wfth, err, err_info);
+ offset = dbs_etherwatch_seek_next_packet(wth, err, err_info);
if (offset < 1)
return FALSE;
*data_offset = offset;
/* Parse the packet */
- return parse_dbs_etherwatch_packet(&wth->phdr, wfth->fh,
- wfth->frame_buffer, err, err_info);
+ return parse_dbs_etherwatch_packet(&wth->phdr, wth->fh,
+ wth->frame_buffer, err, err_info);
}
/* Used to read packets in random-access fashion */
static gboolean
-dbs_etherwatch_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+dbs_etherwatch_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr*)header;
- if (file_seek(wfth->random_fh, seek_off - 1, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off - 1, SEEK_SET, err) == -1)
return FALSE;
- return parse_dbs_etherwatch_packet(phdr, wfth->random_fh, buf, err,
+ return parse_dbs_etherwatch_packet(phdr, wth->random_fh, buf, err,
err_info);
}
diff --git a/wiretap/dbs-etherwatch.h b/wiretap/dbs-etherwatch.h
index a371da1ac8..d28e33dae1 100644
--- a/wiretap/dbs-etherwatch.h
+++ b/wiretap/dbs-etherwatch.h
@@ -25,6 +25,6 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int dbs_etherwatch_open(wftap *wfth, int *err, gchar **err_info);
+int dbs_etherwatch_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/dct3trace.c b/wiretap/dct3trace.c
index 36df2ab822..2a0eb9103a 100644
--- a/wiretap/dct3trace.c
+++ b/wiretap/dct3trace.c
@@ -25,7 +25,6 @@
*/
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "dct3trace.h"
@@ -74,10 +73,10 @@ static const char dct3trace_magic_end[] = "</dump>";
#define MAX_PACKET_LEN 23
-static gboolean dct3trace_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean dct3trace_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean dct3trace_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean dct3trace_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
/*
* Following 3 functions taken from gsmdecode-0.7bis, with permission - http://wiki.thc.org/gsm
@@ -156,15 +155,15 @@ xml_get_int(int *val, const char *str, const char *pattern)
}
-int dct3trace_open(wftap *wfth, int *err, gchar **err_info)
+int dct3trace_open(wtap *wth, int *err, gchar **err_info)
{
char line1[64], line2[64];
/* Look for Gammu DCT3 trace header */
- if (file_gets(line1, sizeof(line1), wfth->fh) == NULL ||
- file_gets(line2, sizeof(line2), wfth->fh) == NULL)
+ if (file_gets(line1, sizeof(line1), wth->fh) == NULL ||
+ file_gets(line2, sizeof(line2), wth->fh) == NULL)
{
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -177,12 +176,12 @@ int dct3trace_open(wftap *wfth, int *err, gchar **err_info)
return 0;
}
- 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;
+ 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;
return 1;
}
@@ -347,26 +346,24 @@ baddata:
/* Find the next packet and parse it; called from wtap_read(). */
-static gboolean dct3trace_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean dct3trace_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return dct3trace_get_packet(wfth->fh, &wth->phdr, wfth->frame_buffer,
+ return dct3trace_get_packet(wth->fh, &wth->phdr, wth->frame_buffer,
err, err_info);
}
/* Used to read packets in random-access fashion */
-static gboolean dct3trace_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean dct3trace_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr*)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
{
return FALSE;
}
- return dct3trace_get_packet(wfth->random_fh, phdr, buf, err, err_info);
+ return dct3trace_get_packet(wth->random_fh, phdr, buf, err, err_info);
}
diff --git a/wiretap/dct3trace.h b/wiretap/dct3trace.h
index a660c56bf7..d7bfc9cad9 100644
--- a/wiretap/dct3trace.h
+++ b/wiretap/dct3trace.h
@@ -24,6 +24,6 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int dct3trace_open(wftap *wfth, int *err, gchar **err_info);
+int dct3trace_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/erf.c b/wiretap/erf.c
index 5ea6084449..9edef0ecbb 100644
--- a/wiretap/erf.c
+++ b/wiretap/erf.c
@@ -1,4 +1,4 @@
-/* erf.c
+/*
* Copyright (c) 2003 Endace Technology Ltd, Hamilton, New Zealand.
* All rights reserved.
*
@@ -50,7 +50,6 @@
#include <wsutil/crc32.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -65,10 +64,10 @@ static int erf_read_header(FILE_T fh,
gchar **err_info,
guint32 *bytes_read,
guint32 *packet_size);
-static gboolean erf_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean erf_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info);
static const struct {
@@ -87,7 +86,7 @@ static const struct {
#define NUM_ERF_ENCAPS (sizeof erf_to_wtap_map / sizeof erf_to_wtap_map[0])
-extern int erf_open(wftap *wfth, int *err, gchar **err_info)
+extern int erf_open(wtap *wth, int *err, gchar **err_info)
{
int i, n, records_for_erf_check = RECORDS_FOR_ERF_CHECK;
int valid_prev = 0;
@@ -102,7 +101,6 @@ extern int erf_open(wftap *wfth, int *err, gchar **err_info)
guint8 type;
size_t r;
gchar * buffer;
- wtap* wth = (wtap*)wfth->tap_specific_data;
memset(&prevts, 0, sizeof(prevts));
@@ -121,11 +119,11 @@ extern int erf_open(wftap *wfth, int *err, gchar **err_info)
for (i = 0; i < records_for_erf_check; i++) { /* records_for_erf_check */
- r = file_read(&header,sizeof(header),wfth->fh);
+ r = file_read(&header,sizeof(header),wth->fh);
if (r == 0 ) break;
if (r != sizeof(header)) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ) {
return -1;
} else {
@@ -160,7 +158,7 @@ extern int erf_open(wftap *wfth, int *err, gchar **err_info)
/* Skip PAD records, timestamps may not be set */
if ((header.type & 0x7F) == ERF_TYPE_PAD) {
- if (file_seek(wfth->fh, packet_size, SEEK_CUR, err) == -1) {
+ if (file_seek(wth->fh, packet_size, SEEK_CUR, err) == -1) {
return -1;
}
continue;
@@ -194,8 +192,8 @@ extern int erf_open(wftap *wfth, 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),wfth->fh) != sizeof(erf_ext_header)) {
- *err = file_error(wfth->fh, err_info);
+ if (file_read(&erf_ext_header, sizeof(erf_ext_header),wth->fh) != sizeof(erf_ext_header)) {
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -215,8 +213,8 @@ extern int erf_open(wftap *wfth, 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),wfth->fh) != sizeof(mc_hdr)) {
- *err = file_error(wfth->fh, err_info);
+ if (file_read(&mc_hdr,sizeof(mc_hdr),wth->fh) != sizeof(mc_hdr)) {
+ *err = file_error(wth->fh, err_info);
return -1;
}
packet_size -= (guint32)sizeof(mc_hdr);
@@ -224,8 +222,8 @@ extern int erf_open(wftap *wfth, 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),wfth->fh) != sizeof(eth_hdr)) {
- *err = file_error(wfth->fh, err_info);
+ if (file_read(&eth_hdr,sizeof(eth_hdr),wth->fh) != sizeof(eth_hdr)) {
+ *err = file_error(wth->fh, err_info);
return -1;
}
packet_size -= (guint32)sizeof(eth_hdr);
@@ -244,7 +242,7 @@ extern int erf_open(wftap *wfth, int *err, gchar **err_info)
return 0;
}
buffer=(gchar *)g_malloc(packet_size);
- r = file_read(buffer, packet_size, wfth->fh);
+ r = file_read(buffer, packet_size, wth->fh);
g_free(buffer);
if (r != packet_size) {
@@ -259,22 +257,22 @@ extern int erf_open(wftap *wfth, int *err, gchar **err_info)
} /* records_for_erf_check */
- if (file_seek(wfth->fh, 0L, SEEK_SET, err) == -1) { /* rewind */
+ if (file_seek(wth->fh, 0L, SEEK_SET, err) == -1) { /* rewind */
return -1;
}
/* This is an ERF file */
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ERF;
- wfth->snapshot_length = 0; /* not available in header, only in frame */
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ERF;
+ wth->snapshot_length = 0; /* not available in header, only in frame */
/*
* Use the encapsulation for ERF records.
*/
- wfth->file_encap = WTAP_ENCAP_ERF;
+ wth->file_encap = WTAP_ENCAP_ERF;
- wfth->subtype_read = erf_read;
- wfth->subtype_seek_read = erf_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->subtype_read = erf_read;
+ wth->subtype_seek_read = erf_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
erf_populate_interfaces(wth);
@@ -282,23 +280,22 @@ extern int erf_open(wftap *wfth, int *err, gchar **err_info)
}
/* Read the next packet */
-static gboolean erf_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean erf_read(wtap *wth, 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(wfth->fh);
+ *data_offset = file_tell(wth->fh);
do {
- if (!erf_read_header(wfth->fh,
+ if (!erf_read_header(wth->fh,
&wth->phdr, &erf_header,
err, err_info, &bytes_read, &packet_size)) {
return FALSE;
}
- if (!wtap_read_packet_bytes(wfth->fh, wfth->frame_buffer, packet_size,
+ if (!wtap_read_packet_bytes(wth->fh, wth->frame_buffer, packet_size,
err, err_info))
return FALSE;
@@ -307,24 +304,23 @@ static gboolean erf_read(wftap *wfth, int *err, gchar **err_info,
return TRUE;
}
-static gboolean erf_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, 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(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
do {
- if (!erf_read_header(wfth->random_fh, phdr, &erf_header,
+ if (!erf_read_header(wth->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(wfth->random_fh, buf, packet_size,
+ return wtap_read_packet_bytes(wth->random_fh, buf, packet_size,
err, err_info);
}
@@ -506,7 +502,7 @@ static int wtap_wtap_encap_to_erf_encap(int encap)
return -1;
}
-static gboolean erf_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *pseudo_header, int * err)
+static gboolean erf_write_phdr(wtap_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))?
@@ -553,7 +549,7 @@ static gboolean erf_write_phdr(wftap_dumper *wdh, int encap, const union wtap_ps
return FALSE;
}
- if (!wftap_dump_file_write(wdh, erf_hdr, size, err))
+ if (!wtap_dump_file_write(wdh, erf_hdr, size, err))
return FALSE;
wdh->bytes_dumped += size;
@@ -566,12 +562,12 @@ static gboolean erf_write_phdr(wftap_dumper *wdh, int encap, const union wtap_ps
has_more = ehdr[i*8] & 0x80;
i++;
}while(has_more && i < MAX_ERF_EHDR);
- if (!wftap_dump_file_write(wdh, ehdr, 8*i, err))
+ if (!wtap_dump_file_write(wdh, ehdr, 8*i, err))
return FALSE;
wdh->bytes_dumped += 8*i;
}
- if(!wftap_dump_file_write(wdh, erf_subhdr, subhdr_size, err))
+ if(!wtap_dump_file_write(wdh, erf_subhdr, subhdr_size, err))
return FALSE;
wdh->bytes_dumped += subhdr_size;
@@ -579,7 +575,7 @@ static gboolean erf_write_phdr(wftap_dumper *wdh, int encap, const union wtap_ps
}
static gboolean erf_dump(
- wftap_dumper *wdh,
+ wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd,
int *err)
@@ -611,7 +607,7 @@ static gboolean erf_dump(
if(!erf_write_phdr(wdh, encap, pseudo_header, err)) return FALSE;
- if(!wftap_dump_file_write(wdh, pd, phdr->caplen, err)) return FALSE;
+ if(!wtap_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
@@ -620,7 +616,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(!wftap_dump_file_write(wdh, "", 1, err)) return FALSE;
+ if(!wtap_dump_file_write(wdh, "", 1, err)) return FALSE;
wdh->bytes_dumped++;
}
return TRUE;
@@ -673,18 +669,18 @@ static gboolean erf_dump(
}
if(!erf_write_phdr(wdh, WTAP_ENCAP_ERF, &other_phdr, err)) return FALSE;
- if(!wftap_dump_file_write(wdh, pd, phdr->caplen - round_down, err)) return FALSE;
+ if(!wtap_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(!wftap_dump_file_write(wdh, &crc32, 4, err)) return FALSE;
+ if(!wtap_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(!wftap_dump_file_write(wdh, "", 1, err)) return FALSE;
+ if(!wtap_dump_file_write(wdh, "", 1, err)) return FALSE;
wdh->bytes_dumped++;
}
}
@@ -704,7 +700,7 @@ int erf_dump_can_write_encap(int encap)
return 0;
}
-int erf_dump_open(wftap_dumper *wdh, int *err)
+int erf_dump_open(wtap_dumper *wdh, int *err)
{
wdh->subtype_write = erf_dump;
wdh->subtype_close = NULL;
diff --git a/wiretap/erf.h b/wiretap/erf.h
index 7bc0fa0e64..44a293f464 100644
--- a/wiretap/erf.h
+++ b/wiretap/erf.h
@@ -103,9 +103,9 @@ union erf_subhdr {
#define RECORDS_FOR_ERF_CHECK 20
#define FCS_BITS 32
-int erf_open(wftap *wfth, int *err, gchar **err_info);
+int erf_open(wtap *wth, int *err, gchar **err_info);
int erf_dump_can_write_encap(int encap);
-int erf_dump_open(wftap_dumper *wdh, int *err);
+int erf_dump_open(wtap_dumper *wdh, int *err);
int erf_populate_interfaces(wtap *wth);
diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c
index be8b34dc37..8bd32c2249 100644
--- a/wiretap/eyesdn.c
+++ b/wiretap/eyesdn.c
@@ -19,7 +19,6 @@
*/
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "eyesdn.h"
@@ -91,47 +90,47 @@ static const unsigned char eyesdn_hdr_magic[] =
*/
#define EYESDN_MAX_PACKET_LEN 16384
-static gboolean eyesdn_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean eyesdn_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean eyesdn_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, 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(wftap *wfth, int *err, gchar **err_info)
+static gint64 eyesdn_seek_next_packet(wtap *wth, int *err, gchar **err_info)
{
int byte;
gint64 cur_off;
- while ((byte = file_getc(wfth->fh)) != EOF) {
+ while ((byte = file_getc(wth->fh)) != EOF) {
if (byte == 0xff) {
- cur_off = file_tell(wfth->fh);
+ cur_off = file_tell(wth->fh);
if (cur_off == -1) {
/* Error. */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return -1;
}
return cur_off;
}
}
/* EOF or error. */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return -1;
}
-int eyesdn_open(wftap *wfth, int *err, gchar **err_info)
+int eyesdn_open(wtap *wth, 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, wfth->fh);
+ bytes_read = file_read(&magic, sizeof magic, wth->fh);
if (bytes_read != sizeof magic) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -139,44 +138,42 @@ int eyesdn_open(wftap *wfth, int *err, gchar **err_info)
if (memcmp(magic, eyesdn_hdr_magic, EYESDN_HDR_MAGIC_SIZE) != 0)
return 0;
- 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;
+ 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;
return 1;
}
/* Find the next packet and parse it; called from wtap_read(). */
-static gboolean eyesdn_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean eyesdn_read(wtap *wth, 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(wfth, err, err_info);
+ offset = eyesdn_seek_next_packet(wth, err, err_info);
if (offset < 1)
return FALSE;
*data_offset = offset;
/* Parse the record */
- return read_eyesdn_rec(wfth->fh, &wth->phdr, wfth->frame_buffer,
+ return read_eyesdn_rec(wth->fh, &wth->phdr, wth->frame_buffer,
err, err_info);
}
/* Used to read packets in random-access fashion */
static gboolean
-eyesdn_seek_read(wftap *wfth, gint64 seek_off, void* header,
+eyesdn_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- return read_eyesdn_rec(wfth->random_fh, phdr, buf, err, err_info);
+ return read_eyesdn_rec(wth->random_fh, phdr, buf, err, err_info);
}
/* Parses a record. */
@@ -190,8 +187,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
@@ -345,7 +342,7 @@ read_eyesdn_rec(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err,
static gboolean
-esc_write(wftap_dumper *wdh, const guint8 *buf, int len, int *err)
+esc_write(wtap_dumper *wdh, const guint8 *buf, int len, int *err)
{
int i;
guint8 byte;
@@ -357,26 +354,26 @@ esc_write(wftap_dumper *wdh, const guint8 *buf, int len, int *err)
/*
* Escape the frame delimiter and escape byte.
*/
- if (!wftap_dump_file_write(wdh, &esc, sizeof esc, err))
+ if (!wtap_dump_file_write(wdh, &esc, sizeof esc, err))
return FALSE;
byte-=2;
}
- if (!wftap_dump_file_write(wdh, &byte, sizeof byte, err))
+ if (!wtap_dump_file_write(wdh, &byte, sizeof byte, err))
return FALSE;
}
return TRUE;
}
-static gboolean eyesdn_dump(wftap_dumper *wdh,
+static gboolean eyesdn_dump(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
-gboolean eyesdn_dump_open(wftap_dumper *wdh, int *err)
+gboolean eyesdn_dump_open(wtap_dumper *wdh, int *err)
{
wdh->subtype_write=eyesdn_dump;
wdh->subtype_close=NULL;
- if (!wftap_dump_file_write(wdh, eyesdn_hdr_magic,
+ if (!wtap_dump_file_write(wdh, eyesdn_hdr_magic,
EYESDN_HDR_MAGIC_SIZE, err))
return FALSE;
wdh->bytes_dumped += EYESDN_HDR_MAGIC_SIZE;
@@ -404,7 +401,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(wftap_dumper *wdh,
+static gboolean eyesdn_dump(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -491,7 +488,7 @@ static gboolean eyesdn_dump(wftap_dumper *wdh,
phtons(&buf[10], size);
/* start flag */
- if (!wftap_dump_file_write(wdh, &start_flag, sizeof start_flag, err))
+ if (!wtap_dump_file_write(wdh, &start_flag, sizeof start_flag, err))
return FALSE;
if (!esc_write(wdh, buf, 12, err))
return FALSE;
diff --git a/wiretap/eyesdn.h b/wiretap/eyesdn.h
index 97c5194e14..c000a8bf6a 100644
--- a/wiretap/eyesdn.h
+++ b/wiretap/eyesdn.h
@@ -26,7 +26,7 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int eyesdn_open(wftap *wfth, int *err, gchar **err_info);
+int eyesdn_open(wtap *wth, 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(wftap_dumper *wdh, int *err);
+gboolean eyesdn_dump_open(wtap_dumper *wdh, int *err);
int eyesdn_dump_can_write_encap(int encap);
#endif
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index ec83e87aa6..9a9a34d7c4 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -36,7 +36,6 @@
#include <wsutil/file_util.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -674,13 +673,12 @@ 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. */
-wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char **err_info,
+wtap* 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;
@@ -744,79 +742,76 @@ wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
}
errno = ENOMEM;
- wfth = (wftap *)g_malloc0(sizeof(wtap));
+ wth = (wtap *)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 wfth->fh closing the standard
+ * a file_close of wth->fh closing the standard
* input of the process.
*/
fd = ws_dup(0);
if (fd < 0) {
*err = errno;
- g_free(wfth);
+ g_free(wth);
return NULL;
}
#ifdef _WIN32
if (_setmode(fd, O_BINARY) == -1) {
/* "Shouldn't happen" */
*err = errno;
- g_free(wfth);
+ g_free(wth);
return NULL;
}
#endif
- if (!(wfth->fh = file_fdopen(fd))) {
+ if (!(wth->fh = file_fdopen(fd))) {
*err = errno;
ws_close(fd);
- g_free(wfth);
+ g_free(wth);
return NULL;
}
} else {
- if (!(wfth->fh = file_open(filename))) {
+ if (!(wth->fh = file_open(filename))) {
*err = errno;
- g_free(wfth);
+ g_free(wth);
return NULL;
}
}
if (do_random) {
- if (!(wfth->random_fh = file_open(filename))) {
+ if (!(wth->random_fh = file_open(filename))) {
*err = errno;
- file_close(wfth->fh);
- g_free(wfth);
+ file_close(wth->fh);
+ g_free(wth);
return NULL;
}
} else
- wfth->random_fh = NULL;
-
- wth = (wtap *)g_malloc0(sizeof(wtap));
- wfth->tap_specific_data = wth;
+ wth->random_fh = NULL;
/* 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);
+ 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;
+
+ if (wth->random_fh) {
+ wth->fast_seek = g_ptr_array_new();
+
+ file_set_random_access(wth->fh, FALSE, wth->fast_seek);
+ file_set_random_access(wth->random_fh, TRUE, wth->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(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
}
@@ -824,14 +819,14 @@ wftap* 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.
*/
- wfth->wslua_data = open_routines[type - 1].wslua_data;
+ wth->wslua_data = open_routines[type - 1].wslua_data;
- result = (*open_routines[type - 1].open_routine)(wfth, err, err_info);
+ result = (*open_routines[type - 1].open_routine)(wth, err, err_info);
switch (result) {
case -1:
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -853,9 +848,9 @@ wftap* 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(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
}
@@ -863,13 +858,13 @@ wftap* 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.
*/
- wfth->wslua_data = open_routines[i].wslua_data;
+ wth->wslua_data = open_routines[i].wslua_data;
- switch ((*open_routines[i].open_routine)(wfth, err, err_info)) {
+ switch ((*open_routines[i].open_routine)(wth, err, err_info)) {
case -1:
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -891,25 +886,25 @@ wftap* 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(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
g_free(extension);
- wtap_close(wfth);
+ wtap_close(wth);
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.
*/
- wfth->wslua_data = open_routines[i].wslua_data;
+ wth->wslua_data = open_routines[i].wslua_data;
- switch ((*open_routines[i].open_routine)(wfth,
+ switch ((*open_routines[i].open_routine)(wth,
err, err_info)) {
case -1:
/* I/O error - give up */
g_free(extension);
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -929,25 +924,25 @@ wftap* 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(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
g_free(extension);
- wtap_close(wfth);
+ wtap_close(wth);
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.
*/
- wfth->wslua_data = open_routines[i].wslua_data;
+ wth->wslua_data = open_routines[i].wslua_data;
- switch ((*open_routines[i].open_routine)(wfth,
+ switch ((*open_routines[i].open_routine)(wth,
err, err_info)) {
case -1:
/* I/O error - give up */
g_free(extension);
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -966,22 +961,22 @@ wftap* 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(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
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.
*/
- wfth->wslua_data = open_routines[i].wslua_data;
+ wth->wslua_data = open_routines[i].wslua_data;
- switch ((*open_routines[i].open_routine)(wfth, err, err_info)) {
+ switch ((*open_routines[i].open_routine)(wth, err, err_info)) {
case -1:
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -998,22 +993,22 @@ wftap* 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(wfth);
+ wtap_close(wth);
*err = WTAP_ERR_FILE_UNKNOWN_FORMAT;
return NULL;
success:
- wfth->frame_buffer = (struct Buffer *)g_malloc(sizeof(struct Buffer));
- buffer_init(wfth->frame_buffer, 1500);
+ wth->frame_buffer = (struct Buffer *)g_malloc(sizeof(struct Buffer));
+ buffer_init(wth->frame_buffer, 1500);
- if(wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP){
+ if(wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP){
wtapng_if_descr_t descr;
- descr.wtap_encap = wfth->file_encap;
+ descr.wtap_encap = wth->file_encap;
descr.time_units_per_second = 1000000; /* default microsecond resolution */
- descr.link_type = wtap_wtap_encap_to_pcap_encap(wfth->file_encap);
- descr.snap_len = wfth->snapshot_length;
+ descr.link_type = wtap_wtap_encap_to_pcap_encap(wth->file_encap);
+ descr.snap_len = wth->snapshot_length;
descr.opt_comment = NULL;
descr.if_name = NULL;
descr.if_description = NULL;
@@ -1031,7 +1026,7 @@ success:
g_array_append_val(wth->interface_data, descr);
}
- return wfth;
+ return wth;
}
/*
@@ -1047,7 +1042,7 @@ success:
* reopens the random stream.
*/
gboolean
-wftap_fdreopen(wftap *wfth, const char *filename, int *err)
+wtap_fdreopen(wtap *wth, const char *filename, int *err)
{
ws_statb64 statb;
@@ -1089,7 +1084,7 @@ wftap_fdreopen(wftap *wfth, const char *filename, int *err)
/* Open the file */
errno = WTAP_ERR_CANT_OPEN;
- if (!file_fdreopen(wfth->random_fh, filename)) {
+ if (!file_fdreopen(wth->random_fh, filename)) {
*err = errno;
return FALSE;
}
@@ -1961,40 +1956,31 @@ 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 wftap_dumper* wtap_dump_alloc_wfdh(int file_type_subtype, int encap, int snaplen,
+static wtap_dumper* wtap_dump_alloc_wdh(int file_type_subtype, int encap, int snaplen,
gboolean compressed, int *err);
-static gboolean wtap_dump_open_finish(wftap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err);
+static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err);
-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);
+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);
-wftap_dumper* wtap_dump_open(const char *filename, int file_type_subtype, int encap,
+wtap_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 wftap_dumper *
+static wtap_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)
{
- wftap_dumper *wfdh;
- wtap_dumper* wdh;
+ wtap_dumper *wdh;
/* Allocate a data structure for the output stream. */
- wfdh = wtap_dump_alloc_wfdh(file_type_subtype, encap, snaplen, compressed, err);
- if (wfdh == NULL)
+ wdh = wtap_dump_alloc_wdh(file_type_subtype, encap, snaplen, compressed, err);
+ if (wdh == 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 */
@@ -2024,14 +2010,13 @@ 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 wfdh;
+ return wdh;
}
-wftap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int encap,
+wtap_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)
{
- wftap_dumper *wfdh;
- wtap_dumper* wdh;
+ wtap_dumper *wdh;
WFILE_T fh;
/* Check whether we can open a capture file with that file type
@@ -2040,19 +2025,16 @@ wftap_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. */
- wfdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
+ wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
shb_hdr, idb_inf, err);
- if (wfdh == NULL)
+ if (wdh == 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
@@ -2060,49 +2042,46 @@ wftap_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
- wfdh->fh = stdout;
+ wdh->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 = wftap_dump_file_open(wfdh, filename);
+ fh = wtap_dump_file_open(wdh, filename);
if (fh == NULL) {
*err = errno;
g_free(wdh);
- g_free(wfdh);
return NULL; /* can't create file */
}
- wfdh->fh = fh;
+ wdh->fh = fh;
}
- if (!wtap_dump_open_finish(wfdh, file_type_subtype, compressed, err)) {
+ if (!wtap_dump_open_finish(wdh, file_type_subtype, compressed, err)) {
/* Get rid of the file we created; we couldn't finish
opening it. */
- if (wfdh->fh != stdout) {
- wtap_dump_file_close(wfdh);
+ if (wdh->fh != stdout) {
+ wtap_dump_file_close(wdh);
ws_unlink(filename);
}
g_free(wdh);
- g_free(wfdh);
return NULL;
}
- return wfdh;
+ return wdh;
}
-wftap_dumper* wtap_dump_fdopen(int fd, int file_type_subtype, int encap, int snaplen,
+wtap_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);
}
-wftap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int snaplen,
+wtap_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)
{
- wftap_dumper *wfdh;
+ wtap_dumper *wdh;
WFILE_T fh;
/* Check whether we can open a capture file with that file type
@@ -2111,9 +2090,9 @@ wftap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int
return NULL;
/* Allocate and initialize a data structure for the output stream. */
- wfdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
+ wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
shb_hdr, idb_inf, err);
- if (wfdh == NULL)
+ if (wdh == NULL)
return NULL;
#ifdef _WIN32
@@ -2121,7 +2100,7 @@ wftap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int
if (_setmode(fileno(stdout), O_BINARY) == -1) {
/* "Should not happen" */
*err = errno;
- g_free(wfdh);
+ g_free(wdh);
return NULL; /* couldn't put standard output in binary mode */
}
}
@@ -2130,20 +2109,20 @@ wftap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int
/* In case "fopen()" fails but doesn't set "errno", set "errno"
to a generic "the open failed" error. */
errno = WTAP_ERR_CANT_OPEN;
- fh = wftap_dump_file_fdopen(wfdh, fd);
+ fh = wtap_dump_file_fdopen(wdh, fd);
if (fh == NULL) {
*err = errno;
- g_free(wfdh);
+ g_free(wdh);
return NULL; /* can't create standard I/O stream */
}
- wfdh->fh = fh;
+ wdh->fh = fh;
- if (!wtap_dump_open_finish(wfdh, file_type_subtype, compressed, err)) {
- wtap_dump_file_close(wfdh);
- g_free(wfdh);
+ if (!wtap_dump_open_finish(wdh, file_type_subtype, compressed, err)) {
+ wtap_dump_file_close(wdh);
+ g_free(wdh);
return NULL;
}
- return wfdh;
+ return wdh;
}
static gboolean wtap_dump_open_check(int file_type_subtype, int encap, gboolean compressed, int *err)
@@ -2179,12 +2158,12 @@ static gboolean wtap_dump_open_check(int file_type_subtype, int encap, gboolean
return TRUE;
}
-static wftap_dumper* wtap_dump_alloc_wfdh(int file_type_subtype, int encap, int snaplen,
+static wtap_dumper* wtap_dump_alloc_wdh(int file_type_subtype, int encap, int snaplen,
gboolean compressed, int *err)
{
- wftap_dumper *wdh;
+ wtap_dumper *wdh;
- wdh = (wftap_dumper *)g_malloc0(sizeof (wftap_dumper));
+ wdh = (wtap_dumper *)g_malloc0(sizeof (wtap_dumper));
if (wdh == NULL) {
*err = errno;
return NULL;
@@ -2198,7 +2177,7 @@ static wftap_dumper* wtap_dump_alloc_wfdh(int file_type_subtype, int encap, int
return wdh;
}
-static gboolean wtap_dump_open_finish(wftap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err)
+static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err)
{
int fd;
gboolean cant_seek;
@@ -2238,13 +2217,13 @@ static gboolean wtap_dump_open_finish(wftap_dumper *wdh, int file_type_subtype,
return TRUE; /* success! */
}
-gboolean wtap_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+gboolean wtap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
- return (wdh->subtype_write)(wdh, (void*)phdr, pd, err);
+ return (wdh->subtype_write)(wdh, phdr, pd, err);
}
-void wftap_dump_flush(wftap_dumper *wdh)
+void wtap_dump_flush(wtap_dumper *wdh)
{
#ifdef HAVE_LIBZ
if(wdh->compressed) {
@@ -2256,7 +2235,7 @@ void wftap_dump_flush(wftap_dumper *wdh)
}
}
-gboolean wftap_dump_close(wftap_dumper *wdh, int *err)
+gboolean wtap_dump_close(wtap_dumper *wdh, int *err)
{
gboolean ret = TRUE;
@@ -2280,44 +2259,36 @@ gboolean wftap_dump_close(wftap_dumper *wdh, int *err)
}
} else {
/* as we don't close stdout, at least try to flush it */
- wftap_dump_flush(wdh);
+ wtap_dump_flush(wdh);
}
if (wdh->priv != NULL)
g_free(wdh->priv);
-
- if (wdh->tap_specific_data != NULL)
- g_free(wdh->tap_specific_data);
-
g_free(wdh);
return ret;
}
-gint64 wftap_get_bytes_dumped(wftap_dumper *wdh)
+gint64 wtap_get_bytes_dumped(wtap_dumper *wdh)
{
return wdh->bytes_dumped;
}
-void wftap_set_bytes_dumped(wftap_dumper *wdh, gint64 bytes_dumped)
+void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped)
{
wdh->bytes_dumped = bytes_dumped;
}
-gboolean wtap_dump_set_addrinfo_list(wftap_dumper *wfdh, addrinfo_lists_t *addrinfo_lists)
+gboolean wtap_dump_set_addrinfo_list(wtap_dumper *wdh, addrinfo_lists_t *addrinfo_lists)
{
- wtap_dumper *wdh;
-
- if (!wfdh || wfdh->file_type_subtype < 0 || wfdh->file_type_subtype >= wtap_num_file_types_subtypes
- || dump_open_table[wfdh->file_type_subtype].has_name_resolution == FALSE)
+ if (!wdh || wdh->file_type_subtype < 0 || wdh->file_type_subtype >= wtap_num_file_types_subtypes
+ || dump_open_table[wdh->file_type_subtype].has_name_resolution == FALSE)
return FALSE;
-
- wdh = (wtap_dumper*)wfdh->tap_specific_data;
wdh->addrinfo_lists = addrinfo_lists;
return TRUE;
}
/* internally open a file for writing (compressed or not) */
#ifdef HAVE_LIBZ
-static WFILE_T wftap_dump_file_open(wftap_dumper *wdh, const char *filename)
+static WFILE_T wtap_dump_file_open(wtap_dumper *wdh, const char *filename)
{
if(wdh->compressed) {
return gzwfile_open(filename);
@@ -2326,7 +2297,7 @@ static WFILE_T wftap_dump_file_open(wftap_dumper *wdh, const char *filename)
}
}
#else
-static WFILE_T wftap_dump_file_open(wftap_dumper *wdh _U_, const char *filename)
+static WFILE_T wtap_dump_file_open(wtap_dumper *wdh _U_, const char *filename)
{
return ws_fopen(filename, "wb");
}
@@ -2334,7 +2305,7 @@ static WFILE_T wftap_dump_file_open(wftap_dumper *wdh _U_, const char *filename)
/* internally open a file for writing (compressed or not) */
#ifdef HAVE_LIBZ
-static WFILE_T wftap_dump_file_fdopen(wftap_dumper *wdh, int fd)
+static WFILE_T wtap_dump_file_fdopen(wtap_dumper *wdh, int fd)
{
if(wdh->compressed) {
return gzwfile_fdopen(fd);
@@ -2343,14 +2314,14 @@ static WFILE_T wftap_dump_file_fdopen(wftap_dumper *wdh, int fd)
}
}
#else
-static WFILE_T wftap_dump_file_fdopen(wftap_dumper *wdh, int fd)
+static WFILE_T wtap_dump_file_fdopen(wtap_dumper *wdh _U_, int fd)
{
return fdopen(fd, "wb");
}
#endif
/* internally writing raw bytes (compressed or not) */
-gboolean wftap_dump_file_write(wftap_dumper *wdh, const void *buf, size_t bufsize,
+gboolean wtap_dump_file_write(wtap_dumper *wdh, const void *buf, size_t bufsize,
int *err)
{
size_t nwritten;
@@ -2385,7 +2356,7 @@ gboolean wftap_dump_file_write(wftap_dumper *wdh, const void *buf, size_t bufsiz
}
/* internally close a file for writing (compressed or not) */
-static int wtap_dump_file_close(wftap_dumper *wdh)
+static int wtap_dump_file_close(wtap_dumper *wdh)
{
#ifdef HAVE_LIBZ
if(wdh->compressed) {
@@ -2397,7 +2368,7 @@ static int wtap_dump_file_close(wftap_dumper *wdh)
}
}
-gint64 wftap_dump_file_seek(wftap_dumper *wdh, gint64 offset, int whence, int *err)
+gint64 wtap_dump_file_seek(wtap_dumper *wdh, gint64 offset, int whence, int *err)
{
#ifdef HAVE_LIBZ
if(wdh->compressed) {
@@ -2415,7 +2386,7 @@ gint64 wftap_dump_file_seek(wftap_dumper *wdh, gint64 offset, int whence, int *e
}
}
}
-gint64 wftap_dump_file_tell(wftap_dumper *wdh, int *err)
+gint64 wtap_dump_file_tell(wtap_dumper *wdh, int *err)
{
gint64 rval;
#ifdef HAVE_LIBZ
diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c
index cb3123e7f0..cc38a62154 100644
--- a/wiretap/hcidump.c
+++ b/wiretap/hcidump.c
@@ -19,7 +19,6 @@
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -72,35 +71,33 @@ static gboolean hcidump_process_packet(FILE_T fh, struct wtap_pkthdr *phdr,
return wtap_read_packet_bytes(fh, buf, packet_size, err, err_info);
}
-static gboolean hcidump_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return hcidump_process_packet(wfth->fh, &wth->phdr, wfth->frame_buffer,
+ return hcidump_process_packet(wth->fh, &wth->phdr, wth->frame_buffer,
err, err_info);
}
-static gboolean hcidump_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean hcidump_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- return hcidump_process_packet(wfth->random_fh, phdr, buf, err, err_info);
+ return hcidump_process_packet(wth->random_fh, phdr, buf, err, err_info);
}
-int hcidump_open(wftap *wfth, int *err, gchar **err_info)
+int hcidump_open(wtap *wth, int *err, gchar **err_info)
{
struct dump_hdr dh;
guint8 type;
int bytes_read;
- bytes_read = file_read(&dh, DUMP_HDR_SIZE, wfth->fh);
+ bytes_read = file_read(&dh, DUMP_HDR_SIZE, wth->fh);
if (bytes_read != DUMP_HDR_SIZE) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -110,9 +107,9 @@ int hcidump_open(wftap *wfth, int *err, gchar **err_info)
|| GUINT16_FROM_LE(dh.len) < 1)
return 0;
- bytes_read = file_read(&type, 1, wfth->fh);
+ bytes_read = file_read(&type, 1, wth->fh);
if (bytes_read != 1) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -121,16 +118,16 @@ int hcidump_open(wftap *wfth, int *err, gchar **err_info)
if (type < 1 || type > 4)
return 0;
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_HCIDUMP;
- wfth->file_encap = WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR;
- wfth->snapshot_length = 0;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_HCIDUMP;
+ wth->file_encap = WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR;
+ wth->snapshot_length = 0;
- wfth->subtype_read = hcidump_read;
- wfth->subtype_seek_read = hcidump_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->subtype_read = hcidump_read;
+ wth->subtype_seek_read = hcidump_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
diff --git a/wiretap/hcidump.h b/wiretap/hcidump.h
index 99b4a01cab..96453f9f36 100644
--- a/wiretap/hcidump.h
+++ b/wiretap/hcidump.h
@@ -25,6 +25,6 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int hcidump_open(wftap *wfth, int *err, gchar **err_info);
+int hcidump_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c
index deec81da6e..d474ec2c8f 100644
--- a/wiretap/i4btrace.c
+++ b/wiretap/i4btrace.c
@@ -23,7 +23,6 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -34,11 +33,11 @@ typedef struct {
gboolean byte_swapped;
} i4btrace_t;
-static gboolean i4btrace_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean i4btrace_seek_read(wftap *wth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
-static int i4b_read_rec(wftap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
+static gboolean i4btrace_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static int i4b_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info);
/*
@@ -49,7 +48,7 @@ static int i4b_read_rec(wftap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
(unsigned)hdr.unit > 4 || (unsigned)hdr.type > 4 || \
(unsigned)hdr.dir > 2 || (unsigned)hdr.trunc > 2048))
-int i4btrace_open(wftap *wfth, int *err, gchar **err_info)
+int i4btrace_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
i4b_trace_hdr_t hdr;
@@ -58,9 +57,9 @@ int i4btrace_open(wftap *wfth, int *err, gchar **err_info)
/* I4B trace files have no magic in the header... Sigh */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&hdr, sizeof(hdr), wfth->fh);
+ bytes_read = file_read(&hdr, sizeof(hdr), wth->fh);
if (bytes_read != sizeof(hdr)) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -90,46 +89,44 @@ int i4btrace_open(wftap *wfth, int *err, gchar **err_info)
byte_swapped = TRUE;
}
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
/* Get capture start time */
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_I4BTRACE;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_I4BTRACE;
i4btrace = (i4btrace_t *)g_malloc(sizeof(i4btrace_t));
- wfth->priv = (void *)i4btrace;
- wfth->subtype_read = i4btrace_read;
- wfth->subtype_seek_read = i4btrace_seek_read;
- wfth->snapshot_length = 0; /* not known */
+ wth->priv = (void *)i4btrace;
+ wth->subtype_read = i4btrace_read;
+ wth->subtype_seek_read = i4btrace_seek_read;
+ wth->snapshot_length = 0; /* not known */
i4btrace->byte_swapped = byte_swapped;
- wfth->file_encap = WTAP_ENCAP_ISDN;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->file_encap = WTAP_ENCAP_ISDN;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
/* Read the next packet */
-static gboolean i4btrace_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return i4b_read_rec(wfth, wfth->fh, &wth->phdr, wfth->frame_buffer,
+ return i4b_read_rec(wth, wth->fh, &wth->phdr, wth->frame_buffer,
err, err_info);
}
static gboolean
-i4btrace_seek_read(wftap *wfth, gint64 seek_off, void* header,
+i4btrace_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (!i4b_read_rec(wfth, wfth->random_fh, phdr, buf, err, err_info)) {
+ if (!i4b_read_rec(wth, wth->random_fh, phdr, buf, err, err_info)) {
/* Read error or EOF */
if (*err == 0) {
/* EOF means "short read" in random-access mode */
@@ -141,10 +138,10 @@ i4btrace_seek_read(wftap *wfth, gint64 seek_off, void* header,
}
static int
-i4b_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
+i4b_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
- i4btrace_t *i4btrace = (i4btrace_t *)wfth->priv;
+ i4btrace_t *i4btrace = (i4btrace_t *)wth->priv;
i4b_trace_hdr_t hdr;
int bytes_read;
guint32 length;
diff --git a/wiretap/i4btrace.h b/wiretap/i4btrace.h
index 7f47331fdf..7b94eec88a 100644
--- a/wiretap/i4btrace.h
+++ b/wiretap/i4btrace.h
@@ -26,6 +26,6 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int i4btrace_open(wftap *wfth, int *err, gchar **err_info);
+int i4btrace_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/ipfix.c b/wiretap/ipfix.c
index 8fd5d2000c..061a53d79c 100644
--- a/wiretap/ipfix.c
+++ b/wiretap/ipfix.c
@@ -63,7 +63,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -87,12 +86,13 @@
#define RECORDS_FOR_IPFIX_CHECK 20
static gboolean
-ipfix_read(wftap *wfth, int *err, gchar **err_info,
+ipfix_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
static gboolean
-ipfix_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
-static void ipfix_close(wftap *wth);
+ipfix_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static void
+ipfix_close(wtap *wth);
#define IPFIX_VERSION 10
@@ -184,7 +184,7 @@ ipfix_read_message(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, g
* like malformed format, -1 on bad error like file system
*/
int
-ipfix_open(wftap *wfth, int *err, gchar **err_info)
+ipfix_open(wtap *wth, int *err, gchar **err_info)
{
gint i, n, records_for_ipfix_check = RECORDS_FOR_IPFIX_CHECK;
gchar *s;
@@ -208,7 +208,7 @@ ipfix_open(wftap *wfth, int *err, gchar **err_info)
*/
for (i = 0; i < records_for_ipfix_check; i++) {
/* read first message header to check version */
- if (!ipfix_read_message_header(&msg_hdr, wfth->fh, err, err_info)) {
+ if (!ipfix_read_message_header(&msg_hdr, wth->fh, err, err_info)) {
ipfix_debug3("ipfix_open: couldn't read message header #%d with err code #%d (%s)",
i, *err, *err_info);
if (*err == WTAP_ERR_BAD_FILE) {
@@ -232,7 +232,7 @@ ipfix_open(wftap *wfth, int *err, gchar **err_info)
*/
break;
}
- if (file_seek(wfth->fh, IPFIX_MSG_HDR_SIZE, SEEK_CUR, err) == -1) {
+ if (file_seek(wth->fh, IPFIX_MSG_HDR_SIZE, SEEK_CUR, err) == -1) {
ipfix_debug1("ipfix_open: failed seek to next message in file, %d bytes away",
msg_hdr.message_length);
return 0;
@@ -241,7 +241,7 @@ ipfix_open(wftap *wfth, int *err, gchar **err_info)
/* check each Set in IPFIX Message for sanity */
while (checked_len < msg_hdr.message_length) {
- wtap_file_read_expected_bytes(&set_hdr, IPFIX_SET_HDR_SIZE, wfth->fh, err, err_info);
+ wtap_file_read_expected_bytes(&set_hdr, IPFIX_SET_HDR_SIZE, wth->fh, err, err_info);
set_hdr.set_length = g_ntohs(set_hdr.set_length);
if ((set_hdr.set_length < IPFIX_SET_HDR_SIZE) ||
((set_hdr.set_length + checked_len) > msg_hdr.message_length)) {
@@ -250,7 +250,7 @@ ipfix_open(wftap *wfth, int *err, gchar **err_info)
return 0;
}
- if (file_seek(wfth->fh, set_hdr.set_length - IPFIX_SET_HDR_SIZE,
+ if (file_seek(wth->fh, set_hdr.set_length - IPFIX_SET_HDR_SIZE,
SEEK_CUR, err) == -1)
{
ipfix_debug1("ipfix_open: failed seek to next set in file, %d bytes away",
@@ -262,16 +262,16 @@ ipfix_open(wftap *wfth, int *err, gchar **err_info)
}
/* all's good, this is a IPFIX file */
- wfth->file_encap = WTAP_ENCAP_RAW_IPFIX;
- wfth->snapshot_length = 0;
- wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
- wfth->subtype_read = ipfix_read;
- wfth->subtype_seek_read = ipfix_seek_read;
- wfth->subtype_close = ipfix_close;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_IPFIX;
+ wth->file_encap = WTAP_ENCAP_RAW_IPFIX;
+ wth->snapshot_length = 0;
+ wth->tsprecision = WTAP_FILE_TSPREC_SEC;
+ wth->subtype_read = ipfix_read;
+ wth->subtype_seek_read = ipfix_seek_read;
+ wth->subtype_close = ipfix_close;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_IPFIX;
/* go back to beginning of file */
- if (file_seek (wfth->fh, 0, SEEK_SET, err) != 0)
+ if (file_seek (wth->fh, 0, SEEK_SET, err) != 0)
{
return -1;
}
@@ -281,13 +281,12 @@ ipfix_open(wftap *wfth, int *err, gchar **err_info)
/* classic wtap: read packet */
static gboolean
-ipfix_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+ipfix_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
ipfix_debug1("ipfix_read: data_offset is initially %" G_GINT64_MODIFIER "d", *data_offset);
- if (!ipfix_read_message(wfth->fh, &wth->phdr, wfth->frame_buffer, err, err_info)) {
+ if (!ipfix_read_message(wth->fh, &wth->phdr, wth->frame_buffer, err, err_info)) {
ipfix_debug2("ipfix_read: couldn't read message header with code: %d\n, and error '%s'",
*err, *err_info);
return FALSE;
@@ -299,13 +298,11 @@ ipfix_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
/* classic wtap: seek to file position and read packet */
static gboolean
-ipfix_seek_read(wftap *wfth, gint64 seek_off, void* header,
+ipfix_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
-
/* seek to the right file position */
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1) {
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
ipfix_debug2("ipfix_seek_read: couldn't read message header with code: %d\n, and error '%s'",
*err, *err_info);
return FALSE; /* Seek error */
@@ -313,7 +310,7 @@ ipfix_seek_read(wftap *wfth, gint64 seek_off, void* header,
ipfix_debug1("ipfix_seek_read: reading at offset %" G_GINT64_MODIFIER "u", seek_off);
- if (!ipfix_read_message(wfth->random_fh, phdr, buf, err, err_info)) {
+ if (!ipfix_read_message(wth->random_fh, phdr, buf, err, err_info)) {
ipfix_debug0("ipfix_seek_read: couldn't read message header");
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -325,7 +322,7 @@ ipfix_seek_read(wftap *wfth, gint64 seek_off, void* header,
/* classic wtap: close capture file */
static void
-ipfix_close(wftap *wth _U_)
+ipfix_close(wtap *wth _U_)
{
ipfix_debug0("ipfix_close: closing file");
}
diff --git a/wiretap/ipfix.h b/wiretap/ipfix.h
index 2f66438c58..578af4ca61 100644
--- a/wiretap/ipfix.h
+++ b/wiretap/ipfix.h
@@ -25,6 +25,6 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int ipfix_open(wftap *wfth, int *err, gchar **err_info);
+int ipfix_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c
index 8e2da37a15..67e8e65806 100644
--- a/wiretap/iptrace.c
+++ b/wiretap/iptrace.c
@@ -22,7 +22,6 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -32,15 +31,15 @@
#define IPTRACE_IFT_HF 0x3d /* Support for PERCS IP-HFI*/
#define IPTRACE_IFT_IB 0xc7 /* IP over Infiniband. Number by IANA */
-static gboolean iptrace_read_1_0(wftap *wfth, int *err, gchar **err_info,
+static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean iptrace_seek_read_1_0(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-static gboolean iptrace_read_2_0(wftap *wfth, int *err, gchar **err_info,
+static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean iptrace_seek_read_2_0(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
static int iptrace_read_rec_header(FILE_T fh, guint8 *header, int header_len,
int *err, gchar **err_info);
@@ -50,15 +49,15 @@ static void fill_in_pseudo_header(int encap,
union wtap_pseudo_header *pseudo_header, guint8 *header);
static int wtap_encap_ift(unsigned int ift);
-int iptrace_open(wftap *wfth, int *err, gchar **err_info)
+int iptrace_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
char name[12];
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(name, 11, wfth->fh);
+ bytes_read = file_read(name, 11, wth->fh);
if (bytes_read != 11) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -66,16 +65,16 @@ int iptrace_open(wftap *wfth, int *err, gchar **err_info)
name[11] = '\0';
if (strcmp(name, "iptrace 1.0") == 0) {
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_IPTRACE_1_0;
- wfth->subtype_read = iptrace_read_1_0;
- wfth->subtype_seek_read = iptrace_seek_read_1_0;
- wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_IPTRACE_1_0;
+ wth->subtype_read = iptrace_read_1_0;
+ wth->subtype_seek_read = iptrace_seek_read_1_0;
+ wth->tsprecision = WTAP_FILE_TSPREC_SEC;
}
else if (strcmp(name, "iptrace 2.0") == 0) {
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_IPTRACE_2_0;
- wfth->subtype_read = iptrace_read_2_0;
- wfth->subtype_seek_read = iptrace_seek_read_2_0;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_IPTRACE_2_0;
+ wth->subtype_read = iptrace_read_2_0;
+ wth->subtype_seek_read = iptrace_seek_read_2_0;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
}
else {
return 0;
@@ -215,14 +214,13 @@ iptrace_read_rec_1_0(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
}
/* Read the next packet */
-static gboolean iptrace_read_1_0(wftap *wfth, int *err, gchar **err_info,
+static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* Read the packet */
- if (!iptrace_read_rec_1_0(wfth->fh, &wth->phdr, wfth->frame_buffer,
+ if (!iptrace_read_rec_1_0(wth->fh, &wth->phdr, wth->frame_buffer,
err, err_info)) {
/* Read error or EOF */
return FALSE;
@@ -234,25 +232,24 @@ static gboolean iptrace_read_1_0(wftap *wfth, int *err, gchar **err_info,
If it *is* known, and it isn't this packet's encapsulation,
set it to WTAP_ENCAP_PER_PACKET, as this file doesn't
have a single encapsulation for all packets in the file. */
- if (wfth->file_encap == WTAP_ENCAP_UNKNOWN)
- wfth->file_encap = wth->phdr.pkt_encap;
+ if (wth->file_encap == WTAP_ENCAP_UNKNOWN)
+ wth->file_encap = wth->phdr.pkt_encap;
else {
- if (wfth->file_encap != wth->phdr.pkt_encap)
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
+ if (wth->file_encap != wth->phdr.pkt_encap)
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
}
return TRUE;
}
-static gboolean iptrace_seek_read_1_0(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/* Read the packet */
- if (!iptrace_read_rec_1_0(wfth->random_fh, phdr, buf, err, err_info)) {
+ if (!iptrace_read_rec_1_0(wth->random_fh, phdr, buf, err, err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
@@ -412,14 +409,13 @@ iptrace_read_rec_2_0(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
}
/* Read the next packet */
-static gboolean iptrace_read_2_0(wftap *wfth, int *err, gchar **err_info,
+static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* Read the packet */
- if (!iptrace_read_rec_2_0(wfth->fh, &wth->phdr, wfth->frame_buffer,
+ if (!iptrace_read_rec_2_0(wth->fh, &wth->phdr, wth->frame_buffer,
err, err_info)) {
/* Read error or EOF */
return FALSE;
@@ -431,25 +427,24 @@ static gboolean iptrace_read_2_0(wftap *wfth, int *err, gchar **err_info,
If it *is* known, and it isn't this packet's encapsulation,
set it to WTAP_ENCAP_PER_PACKET, as this file doesn't
have a single encapsulation for all packets in the file. */
- if (wfth->file_encap == WTAP_ENCAP_UNKNOWN)
- wfth->file_encap = wth->phdr.pkt_encap;
+ if (wth->file_encap == WTAP_ENCAP_UNKNOWN)
+ wth->file_encap = wth->phdr.pkt_encap;
else {
- if (wfth->file_encap != wth->phdr.pkt_encap)
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
+ if (wth->file_encap != wth->phdr.pkt_encap)
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
}
return TRUE;
}
-static gboolean iptrace_seek_read_2_0(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/* Read the packet */
- if (!iptrace_read_rec_2_0(wfth->random_fh, phdr, buf, err, err_info)) {
+ if (!iptrace_read_rec_2_0(wth->random_fh, phdr, buf, err, err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
diff --git a/wiretap/iptrace.h b/wiretap/iptrace.h
index e4991a2251..0b44ff684d 100644
--- a/wiretap/iptrace.h
+++ b/wiretap/iptrace.h
@@ -25,6 +25,6 @@
#include <glib.h>
#include <wtap.h>
-int iptrace_open(wftap *wfth, int *err, gchar **err_info);
+int iptrace_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/iseries.c b/wiretap/iseries.c
index cd76507f96..0a171a6341 100644
--- a/wiretap/iseries.c
+++ b/wiretap/iseries.c
@@ -149,7 +149,6 @@ Number S/R Length Timer MAC Address MAC Address
*/
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "iseries.h"
@@ -180,14 +179,15 @@ typedef struct {
int format; /* Trace format type */
} iseries_t;
-static gboolean iseries_read (wftap* wfth, int *err, gchar ** err_info,
+static gboolean iseries_read (wtap * wth, int *err, gchar ** err_info,
gint64 *data_offset);
-static gboolean iseries_seek_read (wftap * wfth, gint64 seek_off, void* header,
+static gboolean iseries_seek_read (wtap * wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr,
Buffer * buf, int *err, gchar ** err_info);
-static gboolean iseries_check_file_type (wftap * wth, int *err, gchar **err_info,
+static gboolean iseries_check_file_type (wtap * wth, int *err, gchar **err_info,
int format);
-static gint64 iseries_seek_next_packet (wftap * wfth, int *err, gchar **err_info);
-static gboolean iseries_parse_packet (wftap * wfth, FILE_T fh,
+static gint64 iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info);
+static gboolean iseries_parse_packet (wtap * wth, FILE_T fh,
struct wtap_pkthdr *phdr,
Buffer * buf, int *err, gchar ** err_info);
static int iseries_UNICODE_to_ASCII (guint8 * buf, guint bytes);
@@ -195,7 +195,7 @@ static gboolean iseries_parse_hex_string (const char * ascii, guint8 * buf,
size_t len);
int
-iseries_open (wftap* wfth, int *err, gchar ** err_info)
+iseries_open (wtap * wth, int *err, gchar ** err_info)
{
int bytes_read;
gint offset;
@@ -211,10 +211,10 @@ iseries_open (wftap* wfth, int *err, gchar ** err_info)
* by scanning for it in the first line
*/
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read (&magic, sizeof magic, wfth->fh);
+ bytes_read = file_read (&magic, sizeof magic, wth->fh);
if (bytes_read != sizeof magic)
{
- *err = file_error (wfth->fh, err_info);
+ *err = file_error (wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -227,7 +227,7 @@ iseries_open (wftap* wfth, int *err, gchar ** err_info)
while ((unsigned)offset < (ISERIES_LINE_LENGTH - (sizeof unicodemagic)))
{
if (memcmp (magic + offset, unicodemagic, sizeof unicodemagic) == 0) {
- if (file_seek (wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek (wth->fh, 0, SEEK_SET, err) == -1)
{
return 0;
}
@@ -235,7 +235,7 @@ iseries_open (wftap* wfth, int *err, gchar ** err_info)
* Do some basic sanity checking to ensure we can handle the
* contents of this trace
*/
- if (!iseries_check_file_type (wfth, err, err_info, ISERIES_FORMAT_UNICODE))
+ if (!iseries_check_file_type (wth, err, err_info, ISERIES_FORMAT_UNICODE))
{
if (*err == 0)
return 0;
@@ -243,14 +243,14 @@ iseries_open (wftap* wfth, int *err, gchar ** err_info)
return -1;
}
- wfth->file_encap = WTAP_ENCAP_ETHERNET;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ISERIES;
- wfth->snapshot_length = 0;
- wfth->subtype_read = iseries_read;
- wfth->subtype_seek_read = iseries_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->file_encap = WTAP_ENCAP_ETHERNET;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ISERIES;
+ wth->snapshot_length = 0;
+ wth->subtype_read = iseries_read;
+ wth->subtype_seek_read = iseries_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
- if (file_seek (wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek (wth->fh, 0, SEEK_SET, err) == -1)
{
return 0;
}
@@ -267,7 +267,7 @@ iseries_open (wftap* wfth, int *err, gchar ** err_info)
{
if (memcmp (magic + offset, ISERIES_HDR_MAGIC_STR, ISERIES_HDR_MAGIC_LEN) == 0)
{
- if (file_seek (wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek (wth->fh, 0, SEEK_SET, err) == -1)
{
return 0;
}
@@ -275,7 +275,7 @@ iseries_open (wftap* wfth, int *err, gchar ** err_info)
* Do some basic sanity checking to ensure we can handle the
* contents of this trace
*/
- if (!iseries_check_file_type (wfth, err, err_info, ISERIES_FORMAT_ASCII))
+ if (!iseries_check_file_type (wth, err, err_info, ISERIES_FORMAT_ASCII))
{
if (*err == 0)
return 0;
@@ -283,14 +283,14 @@ iseries_open (wftap* wfth, int *err, gchar ** err_info)
return -1;
}
- wfth->file_encap = WTAP_ENCAP_ETHERNET;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ISERIES;
- wfth->snapshot_length = 0;
- wfth->subtype_read = iseries_read;
- wfth->subtype_seek_read = iseries_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->file_encap = WTAP_ENCAP_ETHERNET;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_ISERIES;
+ wth->snapshot_length = 0;
+ wth->subtype_read = iseries_read;
+ wth->subtype_seek_read = iseries_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
- if (file_seek (wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek (wth->fh, 0, SEEK_SET, err) == -1)
{
return 0;
}
@@ -309,7 +309,7 @@ iseries_open (wftap* wfth, int *err, gchar ** err_info)
* requisit requirements and additional information.
*/
static gboolean
-iseries_check_file_type (wftap * wfth, int *err, gchar **err_info, int format)
+iseries_check_file_type (wtap * wth, int *err, gchar **err_info, int format)
{
guint line;
int num_items_scanned;
@@ -318,16 +318,16 @@ iseries_check_file_type (wftap * wfth, int *err, gchar **err_info, int format)
/* Save trace format for passing between packets */
iseries = (iseries_t *) g_malloc (sizeof (iseries_t));
- wfth->priv = (void *) iseries;
+ wth->priv = (void *) iseries;
iseries->have_date = FALSE;
iseries->format = format;
for (line = 0; line < ISERIES_HDR_LINES_TO_CHECK; line++)
{
- if (file_gets (buf, ISERIES_LINE_LENGTH, wfth->fh) == NULL)
+ if (file_gets (buf, ISERIES_LINE_LENGTH, wth->fh) == NULL)
{
/* EOF or error. */
- *err = file_error (wfth->fh, err_info);
+ *err = file_error (wth->fh, err_info);
if (*err == WTAP_ERR_SHORT_READ)
*err = 0;
return FALSE;
@@ -371,15 +371,14 @@ iseries_check_file_type (wftap * wfth, int *err, gchar **err_info, int format)
* Find the next packet and parse it; called from wtap_read().
*/
static gboolean
-iseries_read (wftap* wfth, int *err, gchar ** err_info, gint64 *data_offset)
+iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset)
{
gint64 offset;
- wtap* wth = (wtap*)wfth->tap_specific_data;
/*
* Locate the next packet
*/
- offset = iseries_seek_next_packet (wfth, err, err_info);
+ offset = iseries_seek_next_packet (wth, err, err_info);
if (offset < 0)
return FALSE;
*data_offset = offset;
@@ -387,7 +386,7 @@ iseries_read (wftap* wfth, int *err, gchar ** err_info, gint64 *data_offset)
/*
* Parse the packet and extract the various fields
*/
- return iseries_parse_packet (wfth, wfth->fh, &wth->phdr, wfth->frame_buffer,
+ return iseries_parse_packet (wth, wth->fh, &wth->phdr, wth->frame_buffer,
err, err_info);
}
@@ -398,9 +397,9 @@ iseries_read (wftap* wfth, int *err, gchar ** err_info, gint64 *data_offset)
* to null or an additional error string.
*/
static gint64
-iseries_seek_next_packet (wftap* wfth, int *err, gchar **err_info)
+iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info)
{
- iseries_t *iseries = (iseries_t *)wfth->priv;
+ iseries_t *iseries = (iseries_t *)wth->priv;
char buf[ISERIES_LINE_LENGTH],type[5];
int line, num_items_scanned;
gint64 cur_off;
@@ -408,10 +407,10 @@ iseries_seek_next_packet (wftap* wfth, int *err, gchar **err_info)
for (line = 0; line < ISERIES_MAX_TRACE_LEN; line++)
{
- if (file_gets (buf, ISERIES_LINE_LENGTH, wfth->fh) == NULL)
+ if (file_gets (buf, ISERIES_LINE_LENGTH, wth->fh) == NULL)
{
/* EOF or error. */
- *err = file_error (wfth->fh, err_info);
+ *err = file_error (wth->fh, err_info);
return -1;
}
/* Convert UNICODE to ASCII if required and determine */
@@ -434,13 +433,13 @@ iseries_seek_next_packet (wftap* wfth, int *err, gchar **err_info)
if (num_items_scanned == 1)
{
/* Rewind to beginning of line */
- cur_off = file_tell (wfth->fh);
+ cur_off = file_tell (wth->fh);
if (cur_off == -1)
{
- *err = file_error (wfth->fh, err_info);
+ *err = file_error (wth->fh, err_info);
return -1;
}
- if (file_seek (wfth->fh, cur_off - buflen, SEEK_SET, err) == -1)
+ if (file_seek (wth->fh, cur_off - buflen, SEEK_SET, err) == -1)
{
return -1;
}
@@ -459,19 +458,18 @@ iseries_seek_next_packet (wftap* wfth, int *err, gchar **err_info)
* Read packets in random-access fashion
*/
static gboolean
-iseries_seek_read (wftap* wfth, gint64 seek_off, void* header,
+iseries_seek_read (wtap * wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer * buf, int *err, gchar ** err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
/* seek to packet location */
- if (file_seek (wfth->random_fh, seek_off - 1, SEEK_SET, err) == -1)
+ if (file_seek (wth->random_fh, seek_off - 1, SEEK_SET, err) == -1)
return FALSE;
/*
* Parse the packet and extract the various fields
*/
- return iseries_parse_packet (wfth, wfth->random_fh, phdr, buf,
+ return iseries_parse_packet (wth, wth->random_fh, phdr, buf,
err, err_info);
}
@@ -557,10 +555,10 @@ done:
/* Parses a packet. */
static gboolean
-iseries_parse_packet (wftap* wfth, FILE_T fh, struct wtap_pkthdr *phdr,
+iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- iseries_t *iseries = (iseries_t *)wfth->priv;
+ iseries_t *iseries = (iseries_t *)wth->priv;
gint64 cur_off;
gboolean isValid, isCurrentPacket;
int num_items_scanned, line, pktline, buflen;
diff --git a/wiretap/iseries.h b/wiretap/iseries.h
index ed0cef833a..95373e4a61 100644
--- a/wiretap/iseries.h
+++ b/wiretap/iseries.h
@@ -24,6 +24,6 @@
#include <glib.h>
#include <wtap.h>
-int iseries_open(wftap *wfth, int *err, gchar **err_info);
+int iseries_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/k12.c b/wiretap/k12.c
index 209743c582..04245c52bc 100644
--- a/wiretap/k12.c
+++ b/wiretap/k12.c
@@ -28,7 +28,6 @@
#include <string.h>
#include <errno.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "wtap.h"
#include "file_wrappers.h"
@@ -624,9 +623,8 @@ process_packet_data(struct wtap_pkthdr *phdr, Buffer *target, guint8 *buffer,
phdr->pseudo_header.k12.stuff = k12;
}
-static gboolean k12_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset) {
- k12_t *k12 = (k12_t *)wfth->priv;
- wtap* wth = (wtap*)wfth->tap_specific_data;
+static gboolean k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) {
+ k12_t *k12 = (k12_t *)wth->priv;
k12_src_desc_t* src_desc;
guint8* buffer;
gint64 offset;
@@ -634,7 +632,7 @@ static gboolean k12_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_o
guint32 type;
guint32 src_id;
- offset = file_tell(wfth->fh);
+ offset = file_tell(wth->fh);
/* ignore the record if it isn't a packet */
do {
@@ -642,7 +640,7 @@ static gboolean k12_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_o
*data_offset = offset;
- len = get_record(k12, wfth->fh, offset, FALSE, err, err_info);
+ len = get_record(k12, wth->fh, offset, FALSE, err, err_info);
if (len < 0) {
/* read error */
@@ -681,26 +679,25 @@ static gboolean k12_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_o
} while ( ((type & K12_MASK_PACKET) != K12_REC_PACKET && (type & K12_MASK_PACKET) != K12_REC_D0020) || !src_id || !src_desc );
- process_packet_data(&wth->phdr, wfth->frame_buffer, buffer, len, k12);
+ process_packet_data(&wth->phdr, wth->frame_buffer, buffer, len, k12);
return TRUE;
}
-static gboolean k12_seek_read(wftap *wfth, gint64 seek_off, void* header, Buffer *buf, int *err, gchar **err_info) {
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- k12_t *k12 = (k12_t *)wfth->priv;
+static gboolean k12_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) {
+ k12_t *k12 = (k12_t *)wth->priv;
guint8* buffer;
gint len;
K12_DBG(5,("k12_seek_read: ENTER"));
- if ( file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1) {
+ if ( file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
K12_DBG(5,("k12_seek_read: SEEK ERROR"));
return FALSE;
}
- len = get_record(k12, wfth->random_fh, seek_off, TRUE, err, err_info);
+ len = get_record(k12, wth->random_fh, seek_off, TRUE, err, err_info);
if (len < 0) {
K12_DBG(5,("k12_seek_read: READ ERROR"));
return FALSE;
@@ -758,11 +755,11 @@ static void destroy_k12_file_data(k12_t* fd) {
g_free(fd);
}
-static void k12_close(wftap *wfth) {
- k12_t *k12 = (k12_t *)wfth->priv;
+static void k12_close(wtap *wth) {
+ k12_t *k12 = (k12_t *)wth->priv;
destroy_k12_file_data(k12);
- wfth->priv = NULL; /* destroy_k12_file_data freed it */
+ wth->priv = NULL; /* destroy_k12_file_data freed it */
#ifdef DEBUG_K12
K12_DBG(5,("k12_close: CLOSED"));
if (env_file) fclose(dbg_out);
@@ -770,7 +767,7 @@ static void k12_close(wftap *wfth) {
}
-int k12_open(wftap *wfth, int *err, gchar **err_info) {
+int k12_open(wtap *wth, int *err, gchar **err_info) {
k12_src_desc_t* rec;
guint8 header_buffer[0x200];
guint8* read_buffer;
@@ -800,9 +797,9 @@ int k12_open(wftap *wfth, int *err, gchar **err_info) {
K12_DBG(1,("k12_open: ENTER debug_level=%u",debug_level));
#endif
- if ( file_read(header_buffer,0x200,wfth->fh) != 0x200 ) {
+ if ( file_read(header_buffer,0x200,wth->fh) != 0x200 ) {
K12_DBG(1,("k12_open: FILE HEADER TOO SHORT OR READ ERROR"));
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ) {
return -1;
}
@@ -828,7 +825,7 @@ int k12_open(wftap *wfth, int *err, gchar **err_info) {
do {
- len = get_record(file_data, wfth->fh, offset, FALSE, err, err_info);
+ len = get_record(file_data, wth->fh, offset, FALSE, err, err_info);
if ( len < 0 ) {
K12_DBG(1,("k12_open: BAD HEADER RECORD",len));
@@ -866,7 +863,7 @@ int k12_open(wftap *wfth, int *err, gchar **err_info) {
/*
* we are at the first packet record, rewind and leave.
*/
- if (file_seek(wfth->fh, offset, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, offset, SEEK_SET, err) == -1) {
destroy_k12_file_data(file_data);
return -1;
}
@@ -996,14 +993,14 @@ int k12_open(wftap *wfth, int *err, gchar **err_info) {
}
} while(1);
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_K12;
- wfth->file_encap = WTAP_ENCAP_K12;
- wfth->snapshot_length = 0;
- wfth->subtype_read = k12_read;
- wfth->subtype_seek_read = k12_seek_read;
- wfth->subtype_close = k12_close;
- wfth->priv = (void *)file_data;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_K12;
+ wth->file_encap = WTAP_ENCAP_K12;
+ wth->snapshot_length = 0;
+ wth->subtype_read = k12_read;
+ wth->subtype_seek_read = k12_seek_read;
+ wth->subtype_close = k12_close;
+ wth->priv = (void *)file_data;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
return 1;
}
@@ -1027,24 +1024,24 @@ int k12_dump_can_write_encap(int encap) {
static const gchar dumpy_junk[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
-static gboolean k12_dump_record(wftap_dumper *wdh, guint32 len, guint8* buffer, int *err_p) {
+static gboolean k12_dump_record(wtap_dumper *wdh, guint32 len, guint8* buffer, int *err_p) {
k12_dump_t *k12 = (k12_dump_t *)wdh->priv;
guint32 junky_offset = (0x2000 - ( (k12->file_offset - 0x200) % 0x2000 )) % 0x2000;
if (len > junky_offset) {
if (junky_offset) {
- if (! wftap_dump_file_write(wdh, buffer, junky_offset, err_p))
+ if (! wtap_dump_file_write(wdh, buffer, junky_offset, err_p))
return FALSE;
}
- if (! wftap_dump_file_write(wdh, dumpy_junk, 0x10, err_p))
+ if (! wtap_dump_file_write(wdh, dumpy_junk, 0x10, err_p))
return FALSE;
- if (! wftap_dump_file_write(wdh, buffer+junky_offset, len - junky_offset, err_p))
+ if (! wtap_dump_file_write(wdh, buffer+junky_offset, len - junky_offset, err_p))
return FALSE;
k12->file_offset += len + 0x10;
} else {
- if (! wftap_dump_file_write(wdh, buffer, len, err_p))
+ if (! wtap_dump_file_write(wdh, buffer, len, err_p))
return FALSE;
k12->file_offset += len;
}
@@ -1055,7 +1052,7 @@ static gboolean k12_dump_record(wftap_dumper *wdh, guint32 len, guint8* buffer,
static void k12_dump_src_setting(gpointer k _U_, gpointer v, gpointer p) {
k12_src_desc_t* src_desc = (k12_src_desc_t*)v;
- wftap_dumper *wdh = (wftap_dumper *)p;
+ wtap_dumper *wdh = (wtap_dumper *)p;
guint32 len;
guint offset;
guint i;
@@ -1161,7 +1158,7 @@ static void k12_dump_src_setting(gpointer k _U_, gpointer v, gpointer p) {
k12_dump_record(wdh,len,obj.buffer, &errxxx); /* fwrite errs ignored: see k12_dump below */
}
-static gboolean k12_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static gboolean k12_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err) {
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
k12_dump_t *k12 = (k12_dump_t *)wdh->priv;
@@ -1211,41 +1208,41 @@ static gboolean k12_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
static const guint8 k12_eof[] = {0xff,0xff};
-static gboolean k12_dump_close(wftap_dumper *wdh, int *err) {
+static gboolean k12_dump_close(wtap_dumper *wdh, int *err) {
k12_dump_t *k12 = (k12_dump_t *)wdh->priv;
union {
guint8 b[sizeof(guint32)];
guint32 u;
} d;
- if (! wftap_dump_file_write(wdh, k12_eof, 2, err))
+ if (! wtap_dump_file_write(wdh, k12_eof, 2, err))
return FALSE;
- if (wftap_dump_file_seek(wdh, 8, SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, 8, SEEK_SET, err) == -1)
return FALSE;
d.u = g_htonl(k12->file_len);
- if (! wftap_dump_file_write(wdh, d.b, 4, err))
+ if (! wtap_dump_file_write(wdh, d.b, 4, err))
return FALSE;
d.u = g_htonl(k12->num_of_records);
- if (! wftap_dump_file_write(wdh, d.b, 4, err))
+ if (! wtap_dump_file_write(wdh, d.b, 4, err))
return FALSE;
return TRUE;
}
-gboolean k12_dump_open(wftap_dumper *wdh, int *err) {
+gboolean k12_dump_open(wtap_dumper *wdh, int *err) {
k12_dump_t *k12;
- if ( ! wftap_dump_file_write(wdh, k12_file_magic, 8, err)) {
+ if ( ! wtap_dump_file_write(wdh, k12_file_magic, 8, err)) {
return FALSE;
}
- if (wftap_dump_file_seek(wdh, 0x200, SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, 0x200, SEEK_SET, err) == -1)
return FALSE;
wdh->subtype_write = k12_dump;
diff --git a/wiretap/k12.h b/wiretap/k12.h
index 675dfc3d9f..64a46f0d77 100644
--- a/wiretap/k12.h
+++ b/wiretap/k12.h
@@ -24,12 +24,12 @@
#include <glib.h>
#include <wtap.h>
-int k12_open(wftap *wfth, int *err, gchar **err_info);
+int k12_open(wtap *wth, int *err, gchar **err_info);
int k12_dump_can_write_encap(int encap);
-gboolean k12_dump_open(wftap_dumper *wdh, int *err);
-int k12text_open(wftap *wfth, int *err, gchar **err_info _U_);
+gboolean k12_dump_open(wtap_dumper *wdh, int *err);
+int k12text_open(wtap *wth, int *err, gchar **err_info _U_);
int k12text_dump_can_write_encap(int encap);
-gboolean k12text_dump_open(wftap_dumper *wdh, int *err);
+gboolean k12text_dump_open(wtap_dumper *wdh, int *err);
#endif
diff --git a/wiretap/k12text.l b/wiretap/k12text.l
index 1971855c01..42de8e6875 100644
--- a/wiretap/k12text.l
+++ b/wiretap/k12text.l
@@ -72,7 +72,6 @@
#include <string.h>
#include <errno.h>
#include <time.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "wtap.h"
#include "file_wrappers.h"
@@ -246,10 +245,9 @@ k12text_reset(FILE_T fh)
}
static gboolean
-k12text_read(wftap *wfth, int *err, char ** err_info, gint64 *data_offset)
+k12text_read(wtap *wth, int *err, char ** err_info, gint64 *data_offset)
{
- k12text_t *k12text = (k12text_t *)wfth->priv;
- wtap* wth = (wtap*)wfth->tap_specific_data;
+ k12text_t *k12text = (k12text_t *)wth->priv;
/*
* We seek to the file position after the end of the previous frame
@@ -260,10 +258,10 @@ k12text_read(wftap *wfth, int *err, char ** err_info, gint64 *data_offset)
* init vars set by lexer.
*/
- if ( file_seek(wfth->fh, k12text->next_frame_offset, SEEK_SET, err) == -1) {
+ if ( file_seek(wth->fh, k12text->next_frame_offset, SEEK_SET, err) == -1) {
return FALSE;
}
- k12text_reset(wfth->fh); /* init lexer buffer and vars set by lexer */
+ k12text_reset(wth->fh); /* init lexer buffer and vars set by lexer */
BEGIN(NEXT_FRAME);
yylex();
@@ -284,20 +282,19 @@ k12text_read(wftap *wfth, int *err, char ** err_info, gint64 *data_offset)
k12text_set_headers(&wth->phdr);
- buffer_assure_space(wfth->frame_buffer, wth->phdr.caplen);
- memcpy(buffer_start_ptr(wfth->frame_buffer), bb, wth->phdr.caplen);
+ buffer_assure_space(wth->frame_buffer, wth->phdr.caplen);
+ memcpy(buffer_start_ptr(wth->frame_buffer), bb, wth->phdr.caplen);
return TRUE;
}
static gboolean
-k12text_seek_read(wftap *wfth, gint64 seek_off, void* header, Buffer *buf, int *err, char **err_info)
+k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, char **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if ( file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1) {
+ if ( file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
return FALSE;
}
- k12text_reset(wfth->random_fh); /* init lexer buffer and vars set by lexer */
+ k12text_reset(wth->random_fh); /* init lexer buffer and vars set by lexer */
BEGIN(NEXT_FRAME);
yylex();
@@ -322,30 +319,30 @@ k12text_seek_read(wftap *wfth, gint64 seek_off, void* header, Buffer *buf, int *
}
int
-k12text_open(wftap *wfth, int *err, gchar **err_info _U_)
+k12text_open(wtap *wth, int *err, gchar **err_info _U_)
{
k12text_t *k12text;
- k12text_reset(wfth->fh); /* init lexer buffer and vars set by lexer */
+ k12text_reset(wth->fh); /* init lexer buffer and vars set by lexer */
BEGIN(MAGIC);
yylex();
if (! is_k12text) return 0;
- if ( file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if ( file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
return -1;
}
k12text = (k12text_t *)g_malloc(sizeof(k12text_t));
- wfth->priv = (void *)k12text;
+ wth->priv = (void *)k12text;
k12text->next_frame_offset = 0;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_K12TEXT;
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
- wfth->snapshot_length = 0;
- wfth->subtype_read = k12text_read;
- wfth->subtype_seek_read = k12text_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_K12TEXT;
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
+ wth->snapshot_length = 0;
+ wth->subtype_read = k12text_read;
+ wth->subtype_seek_read = k12text_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
return 1;
}
@@ -362,7 +359,7 @@ static const struct { int e; const char* s; } encaps[] = {
};
static gboolean
-k12text_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+k12text_dump(wtap_dumper *wdh _U_, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err) {
#define K12BUF_SIZE 196808
char *buf;
@@ -425,7 +422,7 @@ k12text_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
wl = g_snprintf(p, left, "\r\n\r\n");
left -= wl;
- ret = wftap_dump_file_write(wdh, buf, K12BUF_SIZE - left, err);
+ ret = wtap_dump_file_write(wdh, buf, K12BUF_SIZE - left, err);
g_free(buf);
return ret;
@@ -433,17 +430,17 @@ k12text_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
gboolean
-k12text_dump_open(wftap_dumper *wdh, int *err _U_)
+k12text_dump_open(wtap_dumper *wdh, int *err _U_)
{
- wdh->subtype_write = k12text_dump;
+ wdh->subtype_write = k12text_dump;
- return TRUE;
+ return TRUE;
}
int
k12text_dump_can_write_encap(int encap)
{
- switch (encap) {
+ switch (encap) {
case WTAP_ENCAP_PER_PACKET:
case WTAP_ENCAP_ETHERNET:
case WTAP_ENCAP_MTP3:
@@ -453,7 +450,7 @@ k12text_dump_can_write_encap(int encap)
case WTAP_ENCAP_ATM_PDUS:
default:
return WTAP_ERR_UNSUPPORTED_ENCAP;
- }
+ }
}
/*
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c
index e788aa3635..8c2ce348a1 100644
--- a/wiretap/lanalyzer.c
+++ b/wiretap/lanalyzer.c
@@ -21,7 +21,6 @@
#include "config.h"
#include <stdlib.h>
#include <errno.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -271,13 +270,13 @@ typedef struct {
time_t start;
} lanalyzer_t;
-static gboolean lanalyzer_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean lanalyzer_seek_read(wftap *wth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
-static gboolean lanalyzer_dump_close(wftap_dumper *wdh, int *err);
+static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean lanalyzer_dump_close(wtap_dumper *wdh, int *err);
-int lanalyzer_open(wftap *wfth, int *err, gchar **err_info)
+int lanalyzer_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
LA_RecordHeader rec_header;
@@ -290,12 +289,11 @@ int lanalyzer_open(wftap *wfth, int *err, gchar **err_info)
guint16 cr_year;
struct tm tm;
lanalyzer_t *lanalyzer;
- wtap* wth = (wtap*)wfth->tap_specific_data;
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&rec_header, LA_RecordHeaderSize, wfth->fh);
+ bytes_read = file_read(&rec_header, LA_RecordHeaderSize, wth->fh);
if (bytes_read != LA_RecordHeaderSize) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -315,9 +313,9 @@ int lanalyzer_open(wftap *wfth, int *err, gchar **err_info)
*/
return 0;
}
- bytes_read = file_read(&header_fixed, sizeof header_fixed, wfth->fh);
+ bytes_read = file_read(&header_fixed, sizeof header_fixed, wth->fh);
if (bytes_read != sizeof header_fixed) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -327,9 +325,9 @@ int lanalyzer_open(wftap *wfth, int *err, gchar **err_info)
if (record_length != 0) {
/* Read the rest of the record as a comment. */
comment = (char *)g_malloc(record_length + 1);
- bytes_read = file_read(comment, record_length, wfth->fh);
+ bytes_read = file_read(comment, record_length, wth->fh);
if (bytes_read != record_length) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -339,22 +337,22 @@ int lanalyzer_open(wftap *wfth, int *err, gchar **err_info)
}
/* If we made it this far, then the file is a LANAlyzer file.
- * Let's get some info from it. Note that we get wfth->snapshot_length
+ * Let's get some info from it. Note that we get wth->snapshot_length
* from a record later in the file. */
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_LANALYZER;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_LANALYZER;
lanalyzer = (lanalyzer_t *)g_malloc(sizeof(lanalyzer_t));
- wfth->priv = (void *)lanalyzer;
- wfth->subtype_read = lanalyzer_read;
- wfth->subtype_seek_read = lanalyzer_seek_read;
- wfth->snapshot_length = 0;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->priv = (void *)lanalyzer;
+ wth->subtype_read = lanalyzer_read;
+ wth->subtype_seek_read = lanalyzer_seek_read;
+ wth->snapshot_length = 0;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
/* Read records until we find the start of packets */
while (1) {
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&rec_header, LA_RecordHeaderSize, wfth->fh);
+ bytes_read = file_read(&rec_header, LA_RecordHeaderSize, wth->fh);
if (bytes_read != LA_RecordHeaderSize) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -369,9 +367,9 @@ int lanalyzer_open(wftap *wfth, int *err, gchar **err_info)
case RT_Summary:
errno = WTAP_ERR_CANT_READ;
bytes_read = file_read(summary, sizeof summary,
- wfth->fh);
+ wth->fh);
if (bytes_read != sizeof summary) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -403,15 +401,15 @@ int lanalyzer_open(wftap *wfth, int *err, gchar **err_info)
/*g_message("Day %d Month %d Year %d", tm.tm_mday,
tm.tm_mon, tm.tm_year);*/
mxslc = pletoh16(&summary[30]);
- wfth->snapshot_length = mxslc;
+ wth->snapshot_length = mxslc;
board_type = pletoh16(&summary[188]);
switch (board_type) {
case BOARD_325:
- wfth->file_encap = WTAP_ENCAP_ETHERNET;
+ wth->file_encap = WTAP_ENCAP_ETHERNET;
break;
case BOARD_325TR:
- wfth->file_encap = WTAP_ENCAP_TOKEN_RING;
+ wth->file_encap = WTAP_ENCAP_TOKEN_RING;
break;
default:
*err = WTAP_ERR_UNSUPPORTED_ENCAP;
@@ -425,13 +423,13 @@ int lanalyzer_open(wftap *wfth, int *err, gchar **err_info)
case RT_PacketData:
/* Go back header number of bytes so that lanalyzer_read
* can read this header */
- if (file_seek(wfth->fh, -LA_RecordHeaderSize, SEEK_CUR, err) == -1) {
+ if (file_seek(wth->fh, -LA_RecordHeaderSize, SEEK_CUR, err) == -1) {
return -1;
}
return 1;
default:
- if (file_seek(wfth->fh, record_length, SEEK_CUR, err) == -1) {
+ if (file_seek(wth->fh, record_length, SEEK_CUR, err) == -1) {
return -1;
}
break;
@@ -441,7 +439,7 @@ int lanalyzer_open(wftap *wfth, int *err, gchar **err_info)
#define DESCRIPTOR_LEN 32
-static gboolean lanalyzer_read_trace_record(wftap *wfth, FILE_T fh,
+static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
int bytes_read;
@@ -533,7 +531,7 @@ static gboolean lanalyzer_read_trace_record(wftap *wfth, FILE_T fh,
t = (((guint64)time_low) << 0) + (((guint64)time_med) << 16) +
(((guint64)time_high) << 32);
tsecs = (time_t) (t/2000000);
- lanalyzer = (lanalyzer_t *)wfth->priv;
+ lanalyzer = (lanalyzer_t *)wth->priv;
phdr->ts.secs = tsecs + lanalyzer->start;
phdr->ts.nsecs = ((guint32) (t - tsecs*2000000)) * 500;
@@ -549,7 +547,7 @@ static gboolean lanalyzer_read_trace_record(wftap *wfth, FILE_T fh,
phdr->len = true_size;
phdr->caplen = packet_size;
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_ETHERNET:
/* We assume there's no FCS in this frame. */
@@ -562,26 +560,24 @@ static gboolean lanalyzer_read_trace_record(wftap *wfth, FILE_T fh,
}
/* Read the next packet */
-static gboolean lanalyzer_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* Read the record */
- return lanalyzer_read_trace_record(wfth, wfth->fh, &wth->phdr,
- wfth->frame_buffer, err, err_info);
+ return lanalyzer_read_trace_record(wth, wth->fh, &wth->phdr,
+ wth->frame_buffer, err, err_info);
}
-static gboolean lanalyzer_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/* Read the record */
- if (!lanalyzer_read_trace_record(wfth, wfth->random_fh, phdr, buf,
+ if (!lanalyzer_read_trace_record(wth, wth->random_fh, phdr, buf,
err, err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -594,14 +590,14 @@ static gboolean lanalyzer_seek_read(wftap *wfth, gint64 seek_off,
* Returns TRUE on success, FALSE on error
* Write "cnt" bytes of zero with error control
*---------------------------------------------------*/
-static gboolean s0write(wftap_dumper *wdh, size_t cnt, int *err)
+static gboolean s0write(wtap_dumper *wdh, size_t cnt, int *err)
{
size_t snack;
while (cnt) {
snack = cnt > 64 ? 64 : cnt;
- if (!wftap_dump_file_write(wdh, z64, snack, err))
+ if (!wtap_dump_file_write(wdh, z64, snack, err))
return FALSE;
cnt -= snack;
}
@@ -612,25 +608,25 @@ static gboolean s0write(wftap_dumper *wdh, size_t cnt, int *err)
* Returns TRUE on success, FALSE on error
* Write an 8-bit value with error control
*---------------------------------------------------*/
-static gboolean s8write(wftap_dumper *wdh, const guint8 s8, int *err)
+static gboolean s8write(wtap_dumper *wdh, const guint8 s8, int *err)
{
- return wftap_dump_file_write(wdh, &s8, 1, err);
+ return wtap_dump_file_write(wdh, &s8, 1, err);
}
/*---------------------------------------------------
* Returns TRUE on success, FALSE on error
* Write a 16-bit value with error control
*---------------------------------------------------*/
-static gboolean s16write(wftap_dumper *wdh, const guint16 s16, int *err)
+static gboolean s16write(wtap_dumper *wdh, const guint16 s16, int *err)
{
- return wftap_dump_file_write(wdh, &s16, 2, err);
+ return wtap_dump_file_write(wdh, &s16, 2, err);
}
/*---------------------------------------------------
* Returns TRUE on success, FALSE on error
* Write a 32-bit value with error control
*---------------------------------------------------*/
-static gboolean s32write(wftap_dumper *wdh, const guint32 s32, int *err)
+static gboolean s32write(wtap_dumper *wdh, const guint32 s32, int *err)
{
- return wftap_dump_file_write(wdh, &s32, 4, err);
+ return wtap_dump_file_write(wdh, &s32, 4, err);
}
/*---------------------------------------------------
*
@@ -653,7 +649,7 @@ static void my_timersub(const struct timeval *a,
* Write a record for a packet to a dump file.
* Returns TRUE on success, FALSE on failure.
*---------------------------------------------------*/
-static gboolean lanalyzer_dump(wftap_dumper *wdh,
+static gboolean lanalyzer_dump(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -730,7 +726,7 @@ static gboolean lanalyzer_dump(wftap_dumper *wdh,
if (!s0write(wdh, 12, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
wdh->bytes_dumped += thisSize;
@@ -761,16 +757,16 @@ int lanalyzer_dump_can_write_encap(int encap)
* Returns TRUE on success, FALSE on failure; sets "*err" to an
* error code on failure
*---------------------------------------------------*/
-gboolean lanalyzer_dump_open(wftap_dumper *wdh, int *err)
+gboolean lanalyzer_dump_open(wtap_dumper *wdh, int *err)
{
int jump;
void *tmp;
tmp = g_malloc(sizeof(LA_TmpInfo));
if (!tmp) {
- *err = errno;
- return FALSE;
- }
+ *err = errno;
+ return FALSE;
+ }
((LA_TmpInfo*)tmp)->init = FALSE;
wdh->priv = tmp;
@@ -792,8 +788,8 @@ gboolean lanalyzer_dump_open(wftap_dumper *wdh, int *err)
+ sizeof (LA_CyclicInformationFake)
+ LA_IndexRecordSize;
- if (wftap_dump_file_seek(wdh, jump, SEEK_SET, err) == -1)
- return FALSE;
+ if (wtap_dump_file_seek(wdh, jump, SEEK_SET, err) == -1)
+ return FALSE;
wdh->bytes_dumped = jump;
return TRUE;
@@ -802,7 +798,7 @@ gboolean lanalyzer_dump_open(wftap_dumper *wdh, int *err)
/*---------------------------------------------------
*
*---------------------------------------------------*/
-static gboolean lanalyzer_dump_header(wftap_dumper *wdh, int *err)
+static gboolean lanalyzer_dump_header(wtap_dumper *wdh, int *err)
{
LA_TmpInfo *itmp = (LA_TmpInfo*)(wdh->priv);
guint16 board_type = itmp->encap == WTAP_ENCAP_TOKEN_RING
@@ -822,27 +818,27 @@ static gboolean lanalyzer_dump_header(wftap_dumper *wdh, int *err)
if (fT == NULL)
return FALSE;
- if (wftap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
- return FALSE;
+ if (wtap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
+ return FALSE;
- if (!wftap_dump_file_write(wdh, &LA_HeaderRegularFake,
+ if (!wtap_dump_file_write(wdh, &LA_HeaderRegularFake,
sizeof LA_HeaderRegularFake, err))
- return FALSE;
- if (!wftap_dump_file_write(wdh, &LA_RxChannelNameFake,
+ return FALSE;
+ if (!wtap_dump_file_write(wdh, &LA_RxChannelNameFake,
sizeof LA_RxChannelNameFake, err))
- return FALSE;
- if (!wftap_dump_file_write(wdh, &LA_TxChannelNameFake,
+ return FALSE;
+ if (!wtap_dump_file_write(wdh, &LA_TxChannelNameFake,
sizeof LA_TxChannelNameFake, err))
- return FALSE;
- if (!wftap_dump_file_write(wdh, &LA_RxTemplateNameFake,
+ return FALSE;
+ if (!wtap_dump_file_write(wdh, &LA_RxTemplateNameFake,
sizeof LA_RxTemplateNameFake, err))
- return FALSE;
- if (!wftap_dump_file_write(wdh, &LA_TxTemplateNameFake,
+ return FALSE;
+ if (!wtap_dump_file_write(wdh, &LA_TxTemplateNameFake,
sizeof LA_TxTemplateNameFake, err))
- return FALSE;
- if (!wftap_dump_file_write(wdh, &LA_DisplayOptionsFake,
+ return FALSE;
+ if (!wtap_dump_file_write(wdh, &LA_DisplayOptionsFake,
sizeof LA_DisplayOptionsFake, err))
- return FALSE;
+ return FALSE;
/*-----------------------------------------------------------------*/
if (!s16write(wdh, GUINT16_TO_LE(RT_Summary), err)) /* rid */
return FALSE;
@@ -915,7 +911,7 @@ static gboolean lanalyzer_dump_header(wftap_dumper *wdh, int *err)
if (!s32write(wdh, GUINT32_TO_LE(itmp->pkts), err)) /* ssr.totpkts */
return FALSE;
/*-----------------------------------------------------------------*/
- if (!wftap_dump_file_write(wdh, &LA_CyclicInformationFake,
+ if (!wtap_dump_file_write(wdh, &LA_CyclicInformationFake,
sizeof LA_CyclicInformationFake, err))
return FALSE;
/*-----------------------------------------------------------------*/
@@ -935,7 +931,7 @@ static gboolean lanalyzer_dump_header(wftap_dumper *wdh, int *err)
* Finish writing to a dump file.
* Returns TRUE on success, FALSE on failure.
*---------------------------------------------------*/
-static gboolean lanalyzer_dump_close(wftap_dumper *wdh, int *err)
+static gboolean lanalyzer_dump_close(wtap_dumper *wdh, int *err)
{
lanalyzer_dump_header(wdh,err);
return *err ? FALSE : TRUE;
diff --git a/wiretap/lanalyzer.h b/wiretap/lanalyzer.h
index 8907fcbd63..d36de2711d 100644
--- a/wiretap/lanalyzer.h
+++ b/wiretap/lanalyzer.h
@@ -24,8 +24,8 @@
#include <glib.h>
#include <wtap.h>
-int lanalyzer_open(wftap *wfth, int *err, gchar **err_info);
-gboolean lanalyzer_dump_open(wftap_dumper *wdh, int *err);
+int lanalyzer_open(wtap *wth, int *err, gchar **err_info);
+gboolean lanalyzer_dump_open(wtap_dumper *wdh, int *err);
int lanalyzer_dump_can_write_encap(int encap);
#endif
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c
index e8551cb617..fe9c111261 100644
--- a/wiretap/libpcap.c
+++ b/wiretap/libpcap.c
@@ -23,7 +23,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -62,21 +61,21 @@ typedef enum {
BAD_READ, /* the file is probably not valid */
OTHER_FORMAT /* the file may be valid, but not in this format */
} libpcap_try_t;
-static libpcap_try_t libpcap_try(wftap *wfth, int *err);
+static libpcap_try_t libpcap_try(wtap *wth, int *err);
-static gboolean libpcap_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean libpcap_seek_read(wftap *wth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
-static int libpcap_read_header(wftap *wfth, FILE_T fh, int *err, gchar **err_info,
+static gboolean libpcap_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static int libpcap_read_header(wtap *wth, FILE_T fh, int *err, gchar **err_info,
struct pcaprec_ss990915_hdr *hdr);
-static void adjust_header(wftap *wfth, struct pcaprec_hdr *hdr);
-static gboolean libpcap_read_packet(wftap *wfth, FILE_T fh,
+static void adjust_header(wtap *wth, struct pcaprec_hdr *hdr);
+static gboolean libpcap_read_packet(wtap *wth, FILE_T fh,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-static gboolean libpcap_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
-int libpcap_open(wftap *wfth, int *err, gchar **err_info)
+int libpcap_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
guint32 magic;
@@ -87,13 +86,12 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
int file_encap;
gint64 first_packet_offset;
libpcap_t *libpcap;
- wtap* wth = (wtap*)wfth->tap_specific_data;
/* Read in the number that should be at the start of a "libpcap" file */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&magic, sizeof magic, wfth->fh);
+ bytes_read = file_read(&magic, sizeof magic, wth->fh);
if (bytes_read != sizeof magic) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -106,7 +104,7 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
a program using either standard or ss990417 libpcap. */
byte_swapped = FALSE;
modified = FALSE;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case PCAP_MODIFIED_MAGIC:
@@ -114,7 +112,7 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
a program using either ss990915 or ss991029 libpcap. */
byte_swapped = FALSE;
modified = TRUE;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case PCAP_SWAPPED_MAGIC:
@@ -123,7 +121,7 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
ss990417 libpcap. */
byte_swapped = TRUE;
modified = FALSE;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case PCAP_SWAPPED_MODIFIED_MAGIC:
@@ -132,7 +130,7 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
or ss991029 libpcap. */
byte_swapped = TRUE;
modified = TRUE;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case PCAP_NSEC_MAGIC:
@@ -141,7 +139,7 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
except that the time stamps have nanosecond resolution. */
byte_swapped = FALSE;
modified = FALSE;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
break;
case PCAP_SWAPPED_NSEC_MAGIC:
@@ -151,7 +149,7 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
nanosecond resolution. */
byte_swapped = TRUE;
modified = FALSE;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
break;
default:
@@ -161,9 +159,9 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
/* Read the rest of the header. */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&hdr, sizeof hdr, wfth->fh);
+ bytes_read = file_read(&hdr, sizeof hdr, wth->fh);
if (bytes_read != sizeof hdr) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -258,11 +256,11 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
libpcap->byte_swapped = byte_swapped;
libpcap->version_major = hdr.version_major;
libpcap->version_minor = hdr.version_minor;
- wfth->priv = (void *)libpcap;
- wfth->subtype_read = libpcap_read;
- wfth->subtype_seek_read = libpcap_seek_read;
- wfth->file_encap = file_encap;
- wfth->snapshot_length = hdr.snaplen;
+ wth->priv = (void *)libpcap;
+ wth->subtype_read = libpcap_read;
+ wth->subtype_seek_read = libpcap_seek_read;
+ wth->file_encap = file_encap;
+ wth->snapshot_length = hdr.snaplen;
/* In file format version 2.3, the order of the "incl_len" and
"orig_len" fields in the per-packet header was reversed,
@@ -309,8 +307,8 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
* and for the ERF link-layer header type, and set the
* precision to nanosecond precision.
*/
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
return 1;
}
@@ -354,9 +352,9 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
*
* Try ss991029, the last of his patches, first.
*/
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_SS991029;
- first_packet_offset = file_tell(wfth->fh);
- switch (libpcap_try(wfth, err)) {
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_SS991029;
+ first_packet_offset = file_tell(wth->fh);
+ switch (libpcap_try(wth, err)) {
case BAD_READ:
/*
@@ -370,7 +368,7 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
* Well, it looks as if it might be 991029.
* Put the seek pointer back, and finish.
*/
- if (file_seek(wfth->fh, first_packet_offset, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, first_packet_offset, SEEK_SET, err) == -1) {
return -1;
}
goto done;
@@ -389,8 +387,8 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
* so we put the seek pointer back and treat
* it as 990915.
*/
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990915;
- if (file_seek(wfth->fh, first_packet_offset, SEEK_SET, err) == -1) {
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990915;
+ if (file_seek(wth->fh, first_packet_offset, SEEK_SET, err) == -1) {
return -1;
}
} else {
@@ -399,13 +397,13 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
*
* Try the standard format first.
*/
- if(wfth->tsprecision == WTAP_FILE_TSPREC_NSEC) {
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC;
+ if(wth->tsprecision == WTAP_FILE_TSPREC_NSEC) {
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC;
} else {
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP;
}
- first_packet_offset = file_tell(wfth->fh);
- switch (libpcap_try(wfth, err)) {
+ first_packet_offset = file_tell(wth->fh);
+ switch (libpcap_try(wth, err)) {
case BAD_READ:
/*
@@ -420,7 +418,7 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
* libpcap file.
* Put the seek pointer back, and finish.
*/
- if (file_seek(wfth->fh, first_packet_offset, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, first_packet_offset, SEEK_SET, err) == -1) {
return -1;
}
goto done;
@@ -437,11 +435,11 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
* a standard file. Put the seek pointer back and try
* ss990417.
*/
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990417;
- if (file_seek(wfth->fh, first_packet_offset, SEEK_SET, err) == -1) {
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990417;
+ if (file_seek(wth->fh, first_packet_offset, SEEK_SET, err) == -1) {
return -1;
}
- switch (libpcap_try(wfth, err)) {
+ switch (libpcap_try(wth, err)) {
case BAD_READ:
/*
@@ -455,7 +453,7 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
* Well, it looks as if it might be ss990417.
* Put the seek pointer back, and finish.
*/
- if (file_seek(wfth->fh, first_packet_offset, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, first_packet_offset, SEEK_SET, err) == -1) {
return -1;
}
goto done;
@@ -474,8 +472,8 @@ int libpcap_open(wftap *wfth, int *err, gchar **err_info)
* to try after that, so we put the seek pointer back
* and treat it as a Nokia file.
*/
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA;
- if (file_seek(wfth->fh, first_packet_offset, SEEK_SET, err) == -1) {
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA;
+ if (file_seek(wth->fh, first_packet_offset, SEEK_SET, err) == -1) {
return -1;
}
}
@@ -490,10 +488,10 @@ done:
* If this is a Nokia capture, treat 13 as WTAP_ENCAP_ATM_PDUS,
* rather than as what we normally treat it.
*/
- if (wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA && hdr.network == 13)
- wfth->file_encap = WTAP_ENCAP_ATM_PDUS;
+ if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA && hdr.network == 13)
+ wth->file_encap = WTAP_ENCAP_ATM_PDUS;
- if (wfth->file_encap == WTAP_ENCAP_ERF) {
+ if (wth->file_encap == WTAP_ENCAP_ERF) {
/*
* Populate set of interface IDs for ERF format.
* Currently, this *has* to be done at open time.
@@ -504,7 +502,7 @@ done:
}
/* Try to read the first two records of the capture file. */
-static libpcap_try_t libpcap_try(wftap *wfth, int *err)
+static libpcap_try_t libpcap_try(wtap *wth, int *err)
{
/*
* pcaprec_ss990915_hdr is the largest header type.
@@ -515,7 +513,7 @@ static libpcap_try_t libpcap_try(wftap *wfth, int *err)
/*
* Attempt to read the first record's header.
*/
- if (libpcap_read_header(wfth, wfth->fh, err, NULL, &first_rec_hdr) == -1) {
+ if (libpcap_read_header(wth, wth->fh, err, NULL, &first_rec_hdr) == -1) {
if (*err == 0 || *err == WTAP_ERR_SHORT_READ) {
/*
* EOF or short read - assume the file is in this
@@ -548,13 +546,13 @@ static libpcap_try_t libpcap_try(wftap *wfth, int *err)
* Now skip over the first record's data, under the assumption
* that the header is sane.
*/
- if (file_seek(wfth->fh, first_rec_hdr.hdr.incl_len, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, first_rec_hdr.hdr.incl_len, SEEK_CUR, err) == -1)
return BAD_READ;
/*
* Now attempt to read the second record's header.
*/
- if (libpcap_read_header(wfth, wfth->fh, err, NULL, &second_rec_hdr) == -1) {
+ if (libpcap_read_header(wth, wth->fh, err, NULL, &second_rec_hdr) == -1) {
if (*err == 0 || *err == WTAP_ERR_SHORT_READ) {
/*
* EOF or short read - assume the file is in this
@@ -592,25 +590,23 @@ static libpcap_try_t libpcap_try(wftap *wfth, int *err)
}
/* Read the next packet */
-static gboolean libpcap_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return libpcap_read_packet(wfth, wfth->fh, &wth->phdr,
- wfth->frame_buffer, err, err_info);
+ return libpcap_read_packet(wth, wth->fh, &wth->phdr,
+ wth->frame_buffer, err, err_info);
}
static gboolean
-libpcap_seek_read(wftap *wfth, gint64 seek_off, void* header,
+libpcap_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (!libpcap_read_packet(wfth, wfth->random_fh, phdr, buf, err,
+ if (!libpcap_read_packet(wth, wth->random_fh, phdr, buf, err,
err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -620,7 +616,7 @@ libpcap_seek_read(wftap *wfth, gint64 seek_off, void* header,
}
static gboolean
-libpcap_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
+libpcap_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
struct pcaprec_ss990915_hdr hdr;
@@ -630,7 +626,7 @@ libpcap_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
int phdr_len;
libpcap_t *libpcap;
- bytes_read = libpcap_read_header(wfth, fh, err, err_info, &hdr);
+ bytes_read = libpcap_read_header(wth, fh, err, err_info, &hdr);
if (bytes_read == -1) {
/*
* We failed to read the header.
@@ -645,9 +641,9 @@ libpcap_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
* AIX appears to put 3 bytes of padding in front of FDDI
* frames; strip that crap off.
*/
- if (wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX &&
- (wfth->file_encap == WTAP_ENCAP_FDDI ||
- wfth->file_encap == WTAP_ENCAP_FDDI_BITSWAPPED)) {
+ if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX &&
+ (wth->file_encap == WTAP_ENCAP_FDDI ||
+ wth->file_encap == WTAP_ENCAP_FDDI_BITSWAPPED)) {
/*
* The packet size is really a record size and includes
* the padding.
@@ -662,8 +658,8 @@ libpcap_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
return FALSE;
}
- phdr_len = pcap_process_pseudo_header(fh, wfth->file_type_subtype,
- wfth->file_encap, packet_size, TRUE, phdr, err, err_info);
+ phdr_len = pcap_process_pseudo_header(fh, wth->file_type_subtype,
+ wth->file_encap, packet_size, TRUE, phdr, err, err_info);
if (phdr_len < 0)
return FALSE; /* error */
@@ -676,9 +672,9 @@ libpcap_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
/* Update the timestamp, if not already done */
- if (wfth->file_encap != WTAP_ENCAP_ERF) {
+ if (wth->file_encap != WTAP_ENCAP_ERF) {
phdr->ts.secs = hdr.hdr.ts_sec;
- if (wfth->tsprecision == WTAP_FILE_TSPREC_NSEC)
+ if (wth->tsprecision == WTAP_FILE_TSPREC_NSEC)
phdr->ts.nsecs = hdr.hdr.ts_usec;
else
phdr->ts.nsecs = hdr.hdr.ts_usec * 1000;
@@ -696,8 +692,8 @@ libpcap_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
if (!wtap_read_packet_bytes(fh, buf, packet_size, err, err_info))
return FALSE; /* failed */
- libpcap = (libpcap_t *)wfth->priv;
- pcap_read_post_process(wfth->file_type_subtype, wfth->file_encap,
+ libpcap = (libpcap_t *)wth->priv;
+ pcap_read_post_process(wth->file_type_subtype, wth->file_encap,
phdr, buffer_start_ptr(buf), libpcap->byte_swapped, -1);
return TRUE;
}
@@ -705,14 +701,14 @@ libpcap_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
/* Read the header of the next packet.
Return -1 on an error, or the number of bytes of header read on success. */
-static int libpcap_read_header(wftap *wfth, FILE_T fh, int *err, gchar **err_info,
+static int libpcap_read_header(wtap *wth, FILE_T fh, int *err, gchar **err_info,
struct pcaprec_ss990915_hdr *hdr)
{
int bytes_to_read, bytes_read;
/* Read record header. */
errno = WTAP_ERR_CANT_READ;
- switch (wfth->file_type_subtype) {
+ switch (wth->file_type_subtype) {
case WTAP_FILE_TYPE_SUBTYPE_PCAP:
case WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX:
@@ -746,7 +742,7 @@ static int libpcap_read_header(wftap *wfth, FILE_T fh, int *err, gchar **err_inf
return -1;
}
- adjust_header(wfth, &hdr->hdr);
+ adjust_header(wth, &hdr->hdr);
if (hdr->hdr.incl_len > WTAP_MAX_PACKET_SIZE) {
/*
@@ -793,7 +789,7 @@ static int libpcap_read_header(wftap *wfth, FILE_T fh, int *err, gchar **err_inf
* about fixed-length buffers allocated based on the original
* snapshot length. */
#if 0
- if (hdr->hdr.incl_len > wfth->snapshot_length) {
+ if (hdr->hdr.incl_len > wth->snapshot_length) {
g_warning("pcap: File has packet larger than file's snapshot length.");
}
#endif
@@ -802,12 +798,12 @@ static int libpcap_read_header(wftap *wfth, FILE_T fh, int *err, gchar **err_inf
}
static void
-adjust_header(wftap *wfth, struct pcaprec_hdr *hdr)
+adjust_header(wtap *wth, struct pcaprec_hdr *hdr)
{
guint32 temp;
libpcap_t *libpcap;
- libpcap = (libpcap_t *)wfth->priv;
+ libpcap = (libpcap_t *)wth->priv;
if (libpcap->byte_swapped) {
/* Byte-swap the record header fields. */
hdr->ts_sec = GUINT32_SWAP_LE_BE(hdr->ts_sec);
@@ -856,7 +852,7 @@ int libpcap_dump_can_write_encap(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */
-gboolean libpcap_dump_open(wftap_dumper *wdh, int *err)
+gboolean libpcap_dump_open(wtap_dumper *wdh, int *err)
{
guint32 magic;
struct pcap_hdr file_hdr;
@@ -893,7 +889,7 @@ gboolean libpcap_dump_open(wftap_dumper *wdh, int *err)
return FALSE;
}
- if (!wftap_dump_file_write(wdh, &magic, sizeof magic, err))
+ if (!wtap_dump_file_write(wdh, &magic, sizeof magic, err))
return FALSE;
wdh->bytes_dumped += sizeof magic;
@@ -916,7 +912,7 @@ gboolean libpcap_dump_open(wftap_dumper *wdh, int *err)
file_hdr.snaplen = (wdh->snaplen != 0) ? wdh->snaplen :
WTAP_MAX_PACKET_SIZE;
file_hdr.network = wtap_wtap_encap_to_pcap_encap(wdh->encap);
- if (!wftap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
+ if (!wtap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
return FALSE;
wdh->bytes_dumped += sizeof file_hdr;
@@ -925,7 +921,7 @@ gboolean libpcap_dump_open(wftap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
-static gboolean libpcap_dump(wftap_dumper *wdh,
+static gboolean libpcap_dump(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -1018,16 +1014,15 @@ static gboolean libpcap_dump(wftap_dumper *wdh,
return FALSE;
}
- if (!wftap_dump_file_write(wdh, &rec_hdr, hdr_size, err))
+ if (!wtap_dump_file_write(wdh, &rec_hdr, hdr_size, err))
return FALSE;
wdh->bytes_dumped += hdr_size;
if (!pcap_write_phdr(wdh, wdh->encap, pseudo_header, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
-
- wdh->bytes_dumped += phdr->caplen;
+ wdh->bytes_dumped += phdr->caplen;
return TRUE;
}
diff --git a/wiretap/libpcap.h b/wiretap/libpcap.h
index ab58bda585..4763312fb2 100644
--- a/wiretap/libpcap.h
+++ b/wiretap/libpcap.h
@@ -100,8 +100,8 @@ struct pcaprec_nokia_hdr {
guint8 stuff[4]; /* mysterious stuff */
};
-int libpcap_open(wftap *wfth, int *err, gchar **err_info);
-gboolean libpcap_dump_open(wftap_dumper *wdh, int *err);
+int libpcap_open(wtap *wth, int *err, gchar **err_info);
+gboolean libpcap_dump_open(wtap_dumper *wdh, int *err);
int libpcap_dump_can_write_encap(int encap);
#endif
diff --git a/wiretap/logcat.c b/wiretap/logcat.c
index 53c0e2d455..a1a41c0689 100644
--- a/wiretap/logcat.c
+++ b/wiretap/logcat.c
@@ -22,7 +22,6 @@
#include <string.h>
#include <time.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -96,7 +95,7 @@ static gchar *logcat_log(const struct dumper_t *dumper, guint32 seconds,
}
-static gint detect_version(wftap *wfth, int *err, gchar **err_info)
+static gint detect_version(wtap *wth, int *err, gchar **err_info)
{
gint bytes_read;
guint16 payload_length;
@@ -107,20 +106,20 @@ static gint detect_version(wftap *wfth, int *err, gchar **err_info)
guint32 tag_length;
guint16 tmp;
- file_offset = file_tell(wfth->fh);
+ file_offset = file_tell(wth->fh);
- bytes_read = file_read(&tmp, 2, wfth->fh);
+ bytes_read = file_read(&tmp, 2, wth->fh);
if (bytes_read != 2) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0 && bytes_read != 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
}
payload_length = pletoh16(&tmp);
- bytes_read = file_read(&tmp, 2, wfth->fh);
+ bytes_read = file_read(&tmp, 2, wth->fh);
if (bytes_read != 2) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0 && bytes_read != 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -128,10 +127,10 @@ static gint detect_version(wftap *wfth, int *err, gchar **err_info)
try_header_size = pletoh16(&tmp);
buffer = (guint8 *) g_malloc(5 * 4 + payload_length);
- bytes_read = file_read(buffer, 5 * 4 + payload_length, wfth->fh);
+ bytes_read = file_read(buffer, 5 * 4 + payload_length, wth->fh);
if (bytes_read != 5 * 4 + payload_length) {
if (bytes_read != 4 * 4 + payload_length) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0 && bytes_read != 0)
*err = WTAP_ERR_SHORT_READ;
g_free(buffer);
@@ -151,7 +150,7 @@ static gint detect_version(wftap *wfth, int *err, gchar **err_info)
tag_length = (guint32)strlen(buffer + 4 * 4 + 1) + 1;
log_length = (guint32)strlen(buffer + 4 * 4 + 1 + tag_length) + 1;
if (payload_length == 1 + tag_length + log_length) {
- if (file_seek(wfth->fh, file_offset + 4 * 4 + 1 + tag_length + log_length, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, file_offset + 4 * 4 + 1 + tag_length + log_length, SEEK_SET, err) == -1) {
g_free(buffer);
return -1;
}
@@ -215,24 +214,23 @@ static gboolean logcat_read_packet(struct logcat_phdr *logcat, FILE_T fh,
return TRUE;
}
-static gboolean logcat_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean logcat_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return logcat_read_packet((struct logcat_phdr *) wfth->priv, wfth->fh,
- &wth->phdr, wfth->frame_buffer, err, err_info);
+ return logcat_read_packet((struct logcat_phdr *) wth->priv, wth->fh,
+ &wth->phdr, wth->frame_buffer, err, err_info);
}
-static gboolean logcat_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean logcat_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
+ int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (!logcat_read_packet((struct logcat_phdr *) wfth->priv, wfth->random_fh,
+ if (!logcat_read_packet((struct logcat_phdr *) wth->priv, wth->random_fh,
phdr, buf, err, err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -241,7 +239,7 @@ static gboolean logcat_seek_read(wftap *wfth, gint64 seek_off,
return TRUE;
}
-int logcat_open(wftap *wfth, int *err, gchar **err_info _U_)
+int logcat_open(wtap *wth, int *err, gchar **err_info _U_)
{
int local_err;
gchar *local_err_info;
@@ -250,37 +248,37 @@ int logcat_open(wftap *wfth, int *err, gchar **err_info _U_)
struct logcat_phdr *logcat;
/* check first 3 packets (or 2 or 1 if EOF) versions to check file format is correct */
- version = detect_version(wfth, &local_err, &local_err_info);
+ version = detect_version(wth, &local_err, &local_err_info);
if (version <= 0)
return 0;
- tmp_version = detect_version(wfth, &local_err, &local_err_info);
- if (tmp_version < 0 && !file_eof(wfth->fh)) {
+ tmp_version = detect_version(wth, &local_err, &local_err_info);
+ if (tmp_version < 0 && !file_eof(wth->fh)) {
return 0;
} else if (tmp_version > 0) {
if (tmp_version != version)
return 0;
- tmp_version = detect_version(wfth, &local_err, &local_err_info);
- if (tmp_version != version && !file_eof(wfth->fh))
+ tmp_version = detect_version(wth, &local_err, &local_err_info);
+ if (tmp_version != version && !file_eof(wth->fh))
return 0;
}
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
logcat = (struct logcat_phdr *) g_malloc(sizeof(struct logcat_phdr));
logcat->version = version;
- wfth->priv = logcat;
+ wth->priv = logcat;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_LOGCAT;
- wfth->file_encap = WTAP_ENCAP_LOGCAT;
- wfth->snapshot_length = 0;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_LOGCAT;
+ wth->file_encap = WTAP_ENCAP_LOGCAT;
+ wth->snapshot_length = 0;
- wfth->subtype_read = logcat_read;
- wfth->subtype_seek_read = logcat_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->subtype_read = logcat_read;
+ wth->subtype_seek_read = logcat_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
@@ -296,11 +294,11 @@ int logcat_dump_can_write_encap(int encap)
return 0;
}
-static gboolean logcat_binary_dump(wftap_dumper *wdh,
+static gboolean logcat_binary_dump(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
wdh->bytes_dumped += phdr->caplen;
@@ -308,7 +306,7 @@ static gboolean logcat_binary_dump(wftap_dumper *wdh,
return TRUE;
}
-gboolean logcat_binary_dump_open(wftap_dumper *wdh, int *err)
+gboolean logcat_binary_dump_open(wtap_dumper *wdh, int *err)
{
wdh->subtype_write = logcat_binary_dump;
wdh->subtype_close = NULL;
@@ -326,7 +324,7 @@ gboolean logcat_binary_dump_open(wftap_dumper *wdh, int *err)
return TRUE;
}
-static gboolean logcat_dump_text(wftap_dumper *wdh,
+static gboolean logcat_dump_text(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -382,7 +380,7 @@ static gboolean logcat_dump_text(wftap_dumper *wdh,
g_free(log_part);
length = (guint32)strlen(buf);
- if (!wftap_dump_file_write(wdh, buf, length, err)) {
+ if (!wtap_dump_file_write(wdh, buf, length, err)) {
g_free(buf);
return FALSE;
}
@@ -406,7 +404,7 @@ static gboolean logcat_dump_text(wftap_dumper *wdh,
g_free(log_part);
length = (guint32)strlen(buf);
- if (!wftap_dump_file_write(wdh, buf, length, err)) {
+ if (!wtap_dump_file_write(wdh, buf, length, err)) {
g_free(buf);
return FALSE;
}
@@ -418,7 +416,7 @@ static gboolean logcat_dump_text(wftap_dumper *wdh,
return TRUE;
}
-gboolean logcat_text_brief_dump_open(wftap_dumper *wdh, int *err _U_)
+gboolean logcat_text_brief_dump_open(wtap_dumper *wdh, int *err _U_)
{
struct dumper_t *dumper;
@@ -432,7 +430,7 @@ gboolean logcat_text_brief_dump_open(wftap_dumper *wdh, int *err _U_)
return TRUE;
}
-gboolean logcat_text_process_dump_open(wftap_dumper *wdh, int *err _U_)
+gboolean logcat_text_process_dump_open(wtap_dumper *wdh, int *err _U_)
{
struct dumper_t *dumper;
@@ -446,7 +444,7 @@ gboolean logcat_text_process_dump_open(wftap_dumper *wdh, int *err _U_)
return TRUE;
}
-gboolean logcat_text_tag_dump_open(wftap_dumper *wdh, int *err _U_)
+gboolean logcat_text_tag_dump_open(wtap_dumper *wdh, int *err _U_)
{
struct dumper_t *dumper;
@@ -460,7 +458,7 @@ gboolean logcat_text_tag_dump_open(wftap_dumper *wdh, int *err _U_)
return TRUE;
}
-gboolean logcat_text_time_dump_open(wftap_dumper *wdh, int *err _U_)
+gboolean logcat_text_time_dump_open(wtap_dumper *wdh, int *err _U_)
{
struct dumper_t *dumper;
@@ -474,7 +472,7 @@ gboolean logcat_text_time_dump_open(wftap_dumper *wdh, int *err _U_)
return TRUE;
}
-gboolean logcat_text_thread_dump_open(wftap_dumper *wdh, int *err _U_)
+gboolean logcat_text_thread_dump_open(wtap_dumper *wdh, int *err _U_)
{
struct dumper_t *dumper;
@@ -488,7 +486,7 @@ gboolean logcat_text_thread_dump_open(wftap_dumper *wdh, int *err _U_)
return TRUE;
}
-gboolean logcat_text_threadtime_dump_open(wftap_dumper *wdh, int *err _U_)
+gboolean logcat_text_threadtime_dump_open(wtap_dumper *wdh, int *err _U_)
{
struct dumper_t *dumper;
@@ -502,7 +500,7 @@ gboolean logcat_text_threadtime_dump_open(wftap_dumper *wdh, int *err _U_)
return TRUE;
}
-gboolean logcat_text_long_dump_open(wftap_dumper *wdh, int *err _U_)
+gboolean logcat_text_long_dump_open(wtap_dumper *wdh, int *err _U_)
{
struct dumper_t *dumper;
diff --git a/wiretap/logcat.h b/wiretap/logcat.h
index 268ab10fb0..4167bc21fb 100644
--- a/wiretap/logcat.h
+++ b/wiretap/logcat.h
@@ -25,16 +25,16 @@
#include "wtap.h"
-int logcat_open(wftap *wfth, int *err, gchar **err_info);
-
-gboolean logcat_binary_dump_open(wftap_dumper *wdh, int *err);
-gboolean logcat_text_brief_dump_open(wftap_dumper *wdh, int *err);
-gboolean logcat_text_process_dump_open(wftap_dumper *wdh, int *err);
-gboolean logcat_text_tag_dump_open(wftap_dumper *wdh, int *err);
-gboolean logcat_text_time_dump_open(wftap_dumper *wdh, int *err);
-gboolean logcat_text_thread_dump_open(wftap_dumper *wdh, int *err);
-gboolean logcat_text_threadtime_dump_open(wftap_dumper *wdh, int *err);
-gboolean logcat_text_long_dump_open(wftap_dumper *wdh, int *err);
+int logcat_open(wtap *wth, int *err, gchar **err_info);
+
+gboolean logcat_binary_dump_open(wtap_dumper *wdh, int *err);
+gboolean logcat_text_brief_dump_open(wtap_dumper *wdh, int *err);
+gboolean logcat_text_process_dump_open(wtap_dumper *wdh, int *err);
+gboolean logcat_text_tag_dump_open(wtap_dumper *wdh, int *err);
+gboolean logcat_text_time_dump_open(wtap_dumper *wdh, int *err);
+gboolean logcat_text_thread_dump_open(wtap_dumper *wdh, int *err);
+gboolean logcat_text_threadtime_dump_open(wtap_dumper *wdh, int *err);
+gboolean logcat_text_long_dump_open(wtap_dumper *wdh, int *err);
int logcat_dump_can_write_encap(int encap);
diff --git a/wiretap/merge.c b/wiretap/merge.c
index c47fe7f67b..bea6b53220 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -1,5 +1,4 @@
-/* merge.c
- * Combine multiple dump files, either by appending or by merging by timestamp
+/* Combine multiple dump files, either by appending or by merging by timestamp
*
* Written by Scott Renfro <scott@renfro.org> based on
* editcap by Richard Sharpe and Guy Harris
@@ -61,21 +60,21 @@ merge_open_in_files(int in_file_count, char *const *in_file_names,
for (i = 0; i < in_file_count; i++) {
files[i].filename = in_file_names[i];
- files[i].wfth = wtap_open_offline(in_file_names[i], WTAP_TYPE_AUTO, err, err_info, FALSE);
+ files[i].wth = wtap_open_offline(in_file_names[i], WTAP_TYPE_AUTO, err, err_info, FALSE);
files[i].data_offset = 0;
files[i].state = PACKET_NOT_PRESENT;
files[i].packet_num = 0;
- if (!files[i].wfth) {
+ if (!files[i].wth) {
/* Close the files we've already opened. */
for (j = 0; j < i; j++)
- wtap_close(files[j].wfth);
+ wtap_close(files[j].wth);
*err_fileno = i;
return FALSE;
}
- size = wftap_file_size(files[i].wfth, err);
+ size = wtap_file_size(files[i].wth, err);
if (size == -1) {
for (j = 0; j <= i; j++)
- wtap_close(files[j].wfth);
+ wtap_close(files[j].wth);
*err_fileno = i;
return FALSE;
}
@@ -92,7 +91,7 @@ merge_close_in_files(int count, merge_in_file_t in_files[])
{
int i;
for (i = 0; i < count; i++) {
- wtap_close(in_files[i].wfth);
+ wtap_close(in_files[i].wth);
}
}
@@ -110,10 +109,10 @@ merge_select_frame_type(int count, merge_in_file_t files[])
int i;
int selected_frame_type;
- selected_frame_type = wftap_file_encap(files[0].wfth);
+ selected_frame_type = wtap_file_encap(files[0].wth);
for (i = 1; i < count; i++) {
- int this_frame_type = wftap_file_encap(files[i].wfth);
+ int this_frame_type = wtap_file_encap(files[i].wth);
if (selected_frame_type != this_frame_type) {
selected_frame_type = WTAP_ENCAP_PER_PACKET;
break;
@@ -134,7 +133,7 @@ merge_max_snapshot_length(int count, merge_in_file_t in_files[])
int snapshot_length;
for (i = 0; i < count; i++) {
- snapshot_length = wftap_snapshot_length(in_files[i].wfth);
+ snapshot_length = wtap_snapshot_length(in_files[i].wth);
if (snapshot_length == 0) {
/* Snapshot length of input file not known. */
snapshot_length = WTAP_MAX_PACKET_SIZE;
@@ -197,7 +196,7 @@ merge_read_packet(int in_file_count, merge_in_file_t in_files[],
* No packet available, and we haven't seen an error or EOF yet,
* so try to read the next packet.
*/
- if (!wtap_read(in_files[i].wfth, err, err_info, &in_files[i].data_offset)) {
+ if (!wtap_read(in_files[i].wth, err, err_info, &in_files[i].data_offset)) {
if (*err != 0) {
in_files[i].state = GOT_ERROR;
return &in_files[i];
@@ -208,7 +207,7 @@ merge_read_packet(int in_file_count, merge_in_file_t in_files[],
}
if (in_files[i].state == PACKET_PRESENT) {
- phdr = wtap_phdr(in_files[i].wfth);
+ phdr = wtap_phdr(in_files[i].wth);
if (is_earlier(&phdr->ts, &tv)) {
tv = phdr->ts;
ei = i;
@@ -261,7 +260,7 @@ merge_append_read_packet(int in_file_count, merge_in_file_t in_files[],
for (i = 0; i < in_file_count; i++) {
if (in_files[i].state == AT_EOF)
continue; /* This file is already at EOF */
- if (wtap_read(in_files[i].wfth, err, err_info, &in_files[i].data_offset))
+ if (wtap_read(in_files[i].wth, err, err_info, &in_files[i].data_offset))
break; /* We have a packet */
if (*err != 0) {
/* Read error - quit immediately. */
diff --git a/wiretap/merge.h b/wiretap/merge.h
index 2a10fbe62e..78d093114c 100644
--- a/wiretap/merge.h
+++ b/wiretap/merge.h
@@ -41,7 +41,7 @@ typedef enum {
*/
typedef struct merge_in_file_s {
const char *filename;
- wftap *wfth;
+ wtap *wth;
gint64 data_offset;
in_file_state_e state;
guint32 packet_num; /* current packet number */
diff --git a/wiretap/mime_file.c b/wiretap/mime_file.c
index 5e90448101..2a7d8be0e4 100644
--- a/wiretap/mime_file.c
+++ b/wiretap/mime_file.c
@@ -42,7 +42,6 @@
#include <string.h>
#include <time.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -96,13 +95,13 @@ static const mime_files_t magic_files[] = {
#define MAX_FILE_SIZE (16*1024*1024)
static gboolean
-mime_read_file(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
+mime_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
gint64 file_size;
int packet_size;
- if ((file_size = wftap_file_size(wfth, err)) == -1)
+ if ((file_size = wtap_file_size(wth, err)) == -1)
return FALSE;
if (file_size > MAX_FILE_SIZE) {
@@ -129,14 +128,13 @@ mime_read_file(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
}
static gboolean
-mime_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+mime_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
gint64 offset;
- wtap* wth = (wtap*)wfth->tap_specific_data;
*err = 0;
- offset = file_tell(wfth->fh);
+ offset = file_tell(wth->fh);
/* there is only ever one packet */
if (offset != 0)
@@ -144,28 +142,26 @@ mime_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
*data_offset = offset;
- return mime_read_file(wfth, wfth->fh, &wth->phdr, wfth->frame_buffer, err, err_info);
+ return mime_read_file(wth, wth->fh, &wth->phdr, wth->frame_buffer, err, err_info);
}
static gboolean
-mime_seek_read(wftap *wfth, gint64 seek_off, void* header, Buffer *buf, int *err, gchar **err_info)
+mime_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, 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(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- return mime_read_file(wfth, wfth->random_fh, phdr, buf, err, err_info);
+ return mime_read_file(wth, wth->random_fh, phdr, buf, err, err_info);
}
int
-mime_file_open(wftap *wfth, int *err, gchar **err_info)
+mime_file_open(wtap *wth, int *err, gchar **err_info)
{
char magic_buf[128]; /* increase buffer size when needed */
int bytes_read;
@@ -179,10 +175,10 @@ mime_file_open(wftap *wfth, int *err, gchar **err_info)
read_bytes = MAX(read_bytes, magic_files[i].magic_len);
read_bytes = (guint)MIN(read_bytes, sizeof(magic_buf));
- bytes_read = file_read(magic_buf, read_bytes, wfth->fh);
+ bytes_read = file_read(magic_buf, read_bytes, wth->fh);
if (bytes_read < 0) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return -1;
}
if (bytes_read == 0)
@@ -202,15 +198,15 @@ mime_file_open(wftap *wfth, int *err, gchar **err_info)
if (!found_file)
return 0;
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MIME;
- wfth->file_encap = WTAP_ENCAP_MIME;
- wfth->tsprecision = WTAP_FILE_TSPREC_SEC;
- wfth->subtype_read = mime_read;
- wfth->subtype_seek_read = mime_seek_read;
- wfth->snapshot_length = 0;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MIME;
+ wth->file_encap = WTAP_ENCAP_MIME;
+ wth->tsprecision = WTAP_FILE_TSPREC_SEC;
+ wth->subtype_read = mime_read;
+ wth->subtype_seek_read = mime_seek_read;
+ wth->snapshot_length = 0;
return 1;
}
diff --git a/wiretap/mime_file.h b/wiretap/mime_file.h
index 9fcd56acb8..7c3d05a95e 100644
--- a/wiretap/mime_file.h
+++ b/wiretap/mime_file.h
@@ -24,6 +24,6 @@
#include <glib.h>
#include <wtap.h>
-int mime_file_open(wftap *wfth, int *err, gchar **err_info);
+int mime_file_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/mp2t.c b/wiretap/mp2t.c
index 347af15171..844fb40a13 100644
--- a/wiretap/mp2t.c
+++ b/wiretap/mp2t.c
@@ -32,7 +32,6 @@
#include "mp2t.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "file_wrappers.h"
@@ -104,23 +103,22 @@ mp2t_read_packet(mp2t_filetype_t *mp2t, FILE_T fh, gint64 offset,
}
static gboolean
-mp2t_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+mp2t_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
mp2t_filetype_t *mp2t;
- mp2t = (mp2t_filetype_t*) wfth->priv;
+ mp2t = (mp2t_filetype_t*) wth->priv;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- if (!mp2t_read_packet(mp2t, wfth->fh, *data_offset, &wth->phdr,
- wfth->frame_buffer, err, err_info)) {
+ if (!mp2t_read_packet(mp2t, wth->fh, *data_offset, &wth->phdr,
+ wth->frame_buffer, err, err_info)) {
return FALSE;
}
/* if there's a trailer, skip it and go to the start of the next packet */
if (mp2t->trailer_len!=0) {
- if (-1 == file_seek(wfth->fh, mp2t->trailer_len, SEEK_CUR, err)) {
+ if (-1 == file_seek(wth->fh, mp2t->trailer_len, SEEK_CUR, err)) {
return FALSE;
}
}
@@ -129,19 +127,18 @@ mp2t_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
}
static gboolean
-mp2t_seek_read(wftap *wfth, gint64 seek_off, void* header,
+mp2t_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
mp2t_filetype_t *mp2t;
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (-1 == file_seek(wfth->random_fh, seek_off, SEEK_SET, err)) {
+ if (-1 == file_seek(wth->random_fh, seek_off, SEEK_SET, err)) {
return FALSE;
}
- mp2t = (mp2t_filetype_t*) wfth->priv;
+ mp2t = (mp2t_filetype_t*) wth->priv;
- if (!mp2t_read_packet(mp2t, wfth->random_fh, seek_off, phdr, buf,
+ if (!mp2t_read_packet(mp2t, wth->random_fh, seek_off, phdr, buf,
err, err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -151,7 +148,7 @@ mp2t_seek_read(wftap *wfth, gint64 seek_off, void* header,
}
int
-mp2t_open(wftap *wfth, int *err, gchar **err_info)
+mp2t_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
guint8 buffer[MP2T_SIZE+TRAILER_LEN_MAX];
@@ -163,10 +160,10 @@ mp2t_open(wftap *wfth, int *err, gchar **err_info)
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(buffer, MP2T_SIZE, wfth->fh);
+ bytes_read = file_read(buffer, MP2T_SIZE, wth->fh);
if (MP2T_SIZE != bytes_read) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -183,18 +180,18 @@ mp2t_open(wftap *wfth, int *err, gchar **err_info)
return 0; /* wrong file type - not an mpeg2 ts file */
}
- if (-1 == file_seek(wfth->fh, first, SEEK_SET, err)) {
+ if (-1 == file_seek(wth->fh, first, SEEK_SET, err)) {
return -1;
}
/* read some packets and make sure they all start with a sync byte */
do {
- bytes_read = file_read(buffer, MP2T_SIZE+trailer_len, wfth->fh);
+ bytes_read = file_read(buffer, MP2T_SIZE+trailer_len, wth->fh);
if (bytes_read < 0) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return -1; /* read error */
}
if (bytes_read < MP2T_SIZE+trailer_len) {
- if(sync_steps<2) return 0; /* wrong file type - not an mpeg2 ts file */
+ if(sync_steps<2) return 0; /* wrong file type - not an mpeg2 ts file */
break; /* end of file, that's ok if we're still in sync */
}
if (buffer[0] == MP2T_SYNC_BYTE) {
@@ -213,7 +210,7 @@ mp2t_open(wftap *wfth, int *err, gchar **err_info)
for (i=0; i<TRAILER_LEN_MAX; i++) {
if (buffer[i] == MP2T_SYNC_BYTE) {
trailer_len = i;
- if (-1 == file_seek(wfth->fh, first, SEEK_SET, err)) {
+ if (-1 == file_seek(wth->fh, first, SEEK_SET, err)) {
return -1;
}
sync_steps = 0;
@@ -226,23 +223,23 @@ mp2t_open(wftap *wfth, int *err, gchar **err_info)
}
} while (sync_steps < SYNC_STEPS);
- if (-1 == file_seek(wfth->fh, first, SEEK_SET, err)) {
+ if (-1 == file_seek(wth->fh, first, SEEK_SET, err)) {
return -1;
}
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MPEG_2_TS;
- wfth->file_encap = WTAP_ENCAP_MPEG_2_TS;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
- wfth->subtype_read = mp2t_read;
- wfth->subtype_seek_read = mp2t_seek_read;
- wfth->snapshot_length = 0;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MPEG_2_TS;
+ wth->file_encap = WTAP_ENCAP_MPEG_2_TS;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->subtype_read = mp2t_read;
+ wth->subtype_seek_read = mp2t_seek_read;
+ wth->snapshot_length = 0;
mp2t = (mp2t_filetype_t*) g_malloc(sizeof(mp2t_filetype_t));
if (NULL == mp2t) {
return -1;
}
- wfth->priv = mp2t;
+ wth->priv = mp2t;
mp2t->start_offset = first;
mp2t->trailer_len = trailer_len;
diff --git a/wiretap/mp2t.h b/wiretap/mp2t.h
index f5b777581d..a207b60afb 100644
--- a/wiretap/mp2t.h
+++ b/wiretap/mp2t.h
@@ -26,6 +26,6 @@
#include <glib.h>
#include <wtap.h>
-int mp2t_open(wftap *wfth, int *err, gchar **err_info);
+int mp2t_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/mpeg.c b/wiretap/mpeg.c
index 2d7404700b..abe87a37fe 100644
--- a/wiretap/mpeg.c
+++ b/wiretap/mpeg.c
@@ -33,7 +33,6 @@
#include "mpeg.h"
#include "wsutil/mpeg-audio.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "file_wrappers.h"
@@ -93,10 +92,10 @@ mpeg_read_header(FILE_T fh, int *err, gchar **err_info, guint32 *n)
#define SCRHZ 27000000
static gboolean
-mpeg_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
+mpeg_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
gboolean is_random, int *err, gchar **err_info)
{
- mpeg_t *mpeg = (mpeg_t *)wfth->priv;
+ mpeg_t *mpeg = (mpeg_t *)wth->priv;
guint32 n;
int bytes_read;
unsigned int packet_size;
@@ -222,25 +221,23 @@ mpeg_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
}
static gboolean
-mpeg_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+mpeg_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return mpeg_read_packet(wfth, wfth->fh, &wth->phdr, wfth->frame_buffer,
+ return mpeg_read_packet(wth, wth->fh, &wth->phdr, wth->frame_buffer,
FALSE, err, err_info);
}
static gboolean
-mpeg_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+mpeg_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (!mpeg_read_packet(wfth, wfth->random_fh, phdr, buf, TRUE, err,
+ if (!mpeg_read_packet(wth, wth->random_fh, phdr, buf, TRUE, err,
err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -261,7 +258,7 @@ struct _mpeg_magic {
};
int
-mpeg_open(wftap *wfth, int *err, gchar **err_info)
+mpeg_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
char magic_buf[16];
@@ -269,9 +266,9 @@ mpeg_open(wftap *wfth, int *err, gchar **err_info)
mpeg_t *mpeg;
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(magic_buf, sizeof magic_buf, wfth->fh);
+ bytes_read = file_read(magic_buf, sizeof magic_buf, wth->fh);
if (bytes_read != (int) sizeof magic_buf) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -286,18 +283,18 @@ mpeg_open(wftap *wfth, int *err, gchar **err_info)
good_magic:
/* This appears to be a file with MPEG data. */
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MPEG;
- wfth->file_encap = WTAP_ENCAP_MPEG;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
- wfth->subtype_read = mpeg_read;
- wfth->subtype_seek_read = mpeg_seek_read;
- wfth->snapshot_length = 0;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MPEG;
+ wth->file_encap = WTAP_ENCAP_MPEG;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->subtype_read = mpeg_read;
+ wth->subtype_seek_read = mpeg_seek_read;
+ wth->snapshot_length = 0;
mpeg = (mpeg_t *)g_malloc(sizeof(mpeg_t));
- wfth->priv = (void *)mpeg;
+ wth->priv = (void *)mpeg;
mpeg->now.secs = 0;
mpeg->now.nsecs = 0;
mpeg->t0 = mpeg->now.secs;
diff --git a/wiretap/mpeg.h b/wiretap/mpeg.h
index 7da2e0f04c..6f44af2a95 100644
--- a/wiretap/mpeg.h
+++ b/wiretap/mpeg.h
@@ -26,6 +26,6 @@
#include <glib.h>
#include <wtap.h>
-int mpeg_open(wftap *wfth, int *err, gchar **err_info);
+int mpeg_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index b9af74f756..f12bf43a87 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -21,7 +21,6 @@
#include "config.h"
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -176,20 +175,20 @@ static const int netmon_encap[] = {
#define NETMON_NET_DNS_CACHE 0xFFFE
#define NETMON_NET_NETMON_FILTER 0xFFFF
-static gboolean netmon_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean netmon_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean netmon_seek_read(wftap *wth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean netmon_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
static gboolean netmon_read_atm_pseudoheader(FILE_T fh,
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info);
static int netmon_read_rec_trailer(FILE_T fh, int trlr_size, int *err,
gchar **err_info);
-static void netmon_sequential_close(wftap *wth);
-static gboolean netmon_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static void netmon_sequential_close(wtap *wth);
+static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
-static gboolean netmon_dump_close(wftap_dumper *wdh, int *err);
+static gboolean netmon_dump_close(wtap_dumper *wdh, int *err);
-int netmon_open(wftap *wfth, int *err, gchar **err_info)
+int netmon_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
char magic[MAGIC_SIZE];
@@ -208,9 +207,9 @@ int netmon_open(wftap *wfth, int *err, gchar **err_info)
/* Read in the string that should be at the start of a Network
* Monitor file */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(magic, MAGIC_SIZE, wfth->fh);
+ bytes_read = file_read(magic, MAGIC_SIZE, wth->fh);
if (bytes_read != MAGIC_SIZE) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -223,9 +222,9 @@ int netmon_open(wftap *wfth, int *err, gchar **err_info)
/* Read the rest of the header. */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&hdr, sizeof hdr, wfth->fh);
+ bytes_read = file_read(&hdr, sizeof hdr, wth->fh);
if (bytes_read != sizeof hdr) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -257,21 +256,21 @@ int netmon_open(wftap *wfth, int *err, gchar **err_info)
}
/* This is a netmon file */
- wfth->file_type_subtype = file_type;
+ wth->file_type_subtype = file_type;
netmon = (netmon_t *)g_malloc(sizeof(netmon_t));
- wfth->priv = (void *)netmon;
- wfth->subtype_read = netmon_read;
- wfth->subtype_seek_read = netmon_seek_read;
- wfth->subtype_sequential_close = netmon_sequential_close;
+ wth->priv = (void *)netmon;
+ wth->subtype_read = netmon_read;
+ wth->subtype_seek_read = netmon_seek_read;
+ wth->subtype_sequential_close = netmon_sequential_close;
/* NetMon capture file formats v2.1+ use per-packet encapsulation types. NetMon 3 sets the value in
* the header to 1 (Ethernet) for backwards compability. */
if((hdr.ver_major == 2 && hdr.ver_minor >= 1) || hdr.ver_major > 2)
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
else
- wfth->file_encap = netmon_encap[hdr.network];
+ wth->file_encap = netmon_encap[hdr.network];
- wfth->snapshot_length = 0; /* not available in header */
+ wth->snapshot_length = 0; /* not available in header */
/*
* Convert the time stamp to a "time_t" and a number of
* milliseconds.
@@ -361,7 +360,7 @@ int netmon_open(wftap *wfth, int *err, gchar **err_info)
frame_table_length);
return -1;
}
- if (file_seek(wfth->fh, frame_table_offset, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, frame_table_offset, SEEK_SET, err) == -1) {
return -1;
}
frame_table = (guint32 *)g_try_malloc(frame_table_length);
@@ -370,9 +369,9 @@ int netmon_open(wftap *wfth, int *err, gchar **err_info)
return -1;
}
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(frame_table, frame_table_length, wfth->fh);
+ bytes_read = file_read(frame_table, frame_table_length, wth->fh);
if ((guint32)bytes_read != frame_table_length) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
g_free(frame_table);
@@ -398,7 +397,7 @@ int netmon_open(wftap *wfth, int *err, gchar **err_info)
* Version 1.x of the file format supports
* millisecond precision.
*/
- wfth->tsprecision = WTAP_FILE_TSPREC_MSEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
break;
case 2:
@@ -408,7 +407,7 @@ int netmon_open(wftap *wfth, int *err, gchar **err_info)
* currently support that, so say
* "nanosecond precision" for now.
*/
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
break;
}
return 1;
@@ -477,10 +476,10 @@ netmon_set_pseudo_header_info(int pkt_encap, struct wtap_pkthdr *phdr,
}
}
-static gboolean netmon_process_rec_header(wftap *wfth, FILE_T fh,
+static gboolean netmon_process_rec_header(wtap *wth, FILE_T fh,
struct wtap_pkthdr *phdr, int *err, gchar **err_info)
{
- netmon_t *netmon = (netmon_t *)wfth->priv;
+ netmon_t *netmon = (netmon_t *)wth->priv;
int hdr_size = 0;
union {
struct netmonrec_1_x_hdr hdr_1_x;
@@ -546,7 +545,7 @@ static gboolean netmon_process_rec_header(wftap *wfth, FILE_T fh,
* and the VPI and VCI; read them and generate the pseudo-header
* from them.
*/
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_ATM_PDUS:
if (packet_size < sizeof (struct netmon_atm_hdr)) {
@@ -678,11 +677,10 @@ static process_trailer_retval netmon_process_rec_trailer(netmon_t *netmon,
}
/* Read the next packet */
-static gboolean netmon_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean netmon_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- netmon_t *netmon = (netmon_t *)wfth->priv;
- wtap* wth = (wtap*)wfth->tap_specific_data;
+ netmon_t *netmon = (netmon_t *)wth->priv;
gint64 rec_offset;
again:
@@ -707,19 +705,19 @@ again:
file, but set the frame table up so it's the last
record in sequence. */
rec_offset = netmon->frame_table[netmon->current_frame];
- if (file_tell(wfth->fh) != rec_offset) {
- if (file_seek(wfth->fh, rec_offset, SEEK_SET, err) == -1)
+ if (file_tell(wth->fh) != rec_offset) {
+ if (file_seek(wth->fh, rec_offset, SEEK_SET, err) == -1)
return FALSE;
}
netmon->current_frame++;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- if (!netmon_process_rec_header(wfth, wfth->fh, &wth->phdr,
+ if (!netmon_process_rec_header(wth, wth->fh, &wth->phdr,
err, err_info))
return FALSE;
- if (!wtap_read_packet_bytes(wfth->fh, wfth->frame_buffer,
+ if (!wtap_read_packet_bytes(wth->fh, wth->frame_buffer,
wth->phdr.caplen, err, err_info))
return FALSE; /* Read error */
@@ -727,7 +725,7 @@ again:
* For version 2.1 and later, there's additional information
* after the frame data.
*/
- switch (netmon_process_rec_trailer(netmon, wfth->fh, &wth->phdr,
+ switch (netmon_process_rec_trailer(netmon, wth->fh, &wth->phdr,
err, err_info)) {
case RETRY:
@@ -741,28 +739,27 @@ again:
}
netmon_set_pseudo_header_info(wth->phdr.pkt_encap, &wth->phdr,
- wfth->frame_buffer);
+ wth->frame_buffer);
return TRUE;
}
static gboolean
-netmon_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+netmon_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- netmon_t *netmon = (netmon_t *)wfth->priv;
+ netmon_t *netmon = (netmon_t *)wth->priv;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (!netmon_process_rec_header(wfth, wfth->random_fh, phdr,
+ if (!netmon_process_rec_header(wth, wth->random_fh, phdr,
err, err_info))
return FALSE;
/*
* Read the packet data.
*/
- if (!wtap_read_packet_bytes(wfth->random_fh, buf, phdr->caplen, err,
+ if (!wtap_read_packet_bytes(wth->random_fh, buf, phdr->caplen, err,
err_info))
return FALSE;
@@ -770,7 +767,7 @@ netmon_seek_read(wftap *wfth, gint64 seek_off,
* For version 2.1 and later, there's additional information
* after the frame data.
*/
- switch (netmon_process_rec_trailer(netmon, wfth->random_fh, phdr,
+ switch (netmon_process_rec_trailer(netmon, wth->random_fh, phdr,
err, err_info)) {
case RETRY:
@@ -914,9 +911,9 @@ netmon_read_rec_trailer(FILE_T fh, int trlr_size, int *err, gchar **err_info)
/* Throw away the frame table used by the sequential I/O stream. */
static void
-netmon_sequential_close(wftap *wfth)
+netmon_sequential_close(wtap *wth)
{
- netmon_t *netmon = (netmon_t *)wfth->priv;
+ netmon_t *netmon = (netmon_t *)wth->priv;
if (netmon->frame_table != NULL) {
g_free(netmon->frame_table);
@@ -983,7 +980,7 @@ int netmon_dump_can_write_encap_2_x(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */
-gboolean netmon_dump_open(wftap_dumper *wdh, int *err)
+gboolean netmon_dump_open(wtap_dumper *wdh, int *err)
{
netmon_dump_t *netmon;
@@ -991,7 +988,7 @@ gboolean netmon_dump_open(wftap_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 (wftap_dump_file_seek(wdh, CAPTUREFILE_HEADER_SIZE, SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, CAPTUREFILE_HEADER_SIZE, SEEK_SET, err) == -1)
return FALSE;
wdh->subtype_write = netmon_dump;
@@ -1011,7 +1008,7 @@ gboolean netmon_dump_open(wftap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
-static gboolean netmon_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
@@ -1166,7 +1163,7 @@ static gboolean netmon_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
*/
rec_size = 0;
- if (!wftap_dump_file_write(wdh, hdrp, hdr_size, err))
+ if (!wtap_dump_file_write(wdh, hdrp, hdr_size, err))
return FALSE;
rec_size += hdr_size;
@@ -1179,12 +1176,12 @@ static gboolean netmon_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
memset(&atm_hdr.src, 0, sizeof atm_hdr.src);
atm_hdr.vpi = g_htons(pseudo_header->atm.vpi);
atm_hdr.vci = g_htons(pseudo_header->atm.vci);
- if (!wftap_dump_file_write(wdh, &atm_hdr, sizeof atm_hdr, err))
+ if (!wtap_dump_file_write(wdh, &atm_hdr, sizeof atm_hdr, err))
return FALSE;
rec_size += sizeof atm_hdr;
}
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
rec_size += phdr->caplen;
@@ -1192,7 +1189,7 @@ static gboolean netmon_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
/*
* Write out the trailer.
*/
- if (!wftap_dump_file_write(wdh, &rec_2_x_trlr,
+ if (!wtap_dump_file_write(wdh, &rec_2_x_trlr,
sizeof rec_2_x_trlr, err))
return FALSE;
rec_size += sizeof rec_2_x_trlr;
@@ -1252,7 +1249,7 @@ static gboolean netmon_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
/* Finish writing to a dump file.
Returns TRUE on success, FALSE on failure. */
-static gboolean netmon_dump_close(wftap_dumper *wdh, int *err)
+static gboolean netmon_dump_close(wtap_dumper *wdh, int *err)
{
netmon_dump_t *netmon = (netmon_dump_t *)wdh->priv;
size_t n_to_write;
@@ -1264,11 +1261,11 @@ static gboolean netmon_dump_close(wftap_dumper *wdh, int *err)
/* Write out the frame table. "netmon->frame_table_index" is
the number of entries we've put into it. */
n_to_write = netmon->frame_table_index * sizeof *netmon->frame_table;
- if (!wftap_dump_file_write(wdh, netmon->frame_table, n_to_write, err))
+ if (!wtap_dump_file_write(wdh, netmon->frame_table, n_to_write, err))
return FALSE;
/* Now go fix up the file header. */
- if (wftap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
return FALSE;
memset(&file_hdr, '\0', sizeof file_hdr);
switch (wdh->file_type_subtype) {
@@ -1312,7 +1309,7 @@ static gboolean netmon_dump_close(wftap_dumper *wdh, int *err)
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
return FALSE;
}
- if (!wftap_dump_file_write(wdh, magicp, magic_size, err))
+ if (!wtap_dump_file_write(wdh, magicp, magic_size, err))
return FALSE;
if (wdh->encap == WTAP_ENCAP_PER_PACKET) {
@@ -1346,7 +1343,7 @@ static gboolean netmon_dump_close(wftap_dumper *wdh, int *err)
file_hdr.frametableoffset = GUINT32_TO_LE(netmon->frame_table_offset);
file_hdr.frametablelength =
GUINT32_TO_LE(netmon->frame_table_index * sizeof *netmon->frame_table);
- if (!wftap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
+ if (!wtap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
return FALSE;
return TRUE;
diff --git a/wiretap/netmon.h b/wiretap/netmon.h
index 9c14af0af7..5f5f05ef11 100644
--- a/wiretap/netmon.h
+++ b/wiretap/netmon.h
@@ -24,8 +24,8 @@
#include <glib.h>
#include <wtap.h>
-int netmon_open(wftap *wfth, int *err, gchar **err_info);
-gboolean netmon_dump_open(wftap_dumper *wdh, int *err);
+int netmon_open(wtap *wth, int *err, gchar **err_info);
+gboolean netmon_dump_open(wtap_dumper *wdh, int *err);
int netmon_dump_can_write_encap_1_x(int encap);
int netmon_dump_can_write_encap_2_x(int encap);
diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c
index 0043ba39e0..9772567ae7 100644
--- a/wiretap/netscaler.c
+++ b/wiretap/netscaler.c
@@ -21,7 +21,6 @@
#include "config.h"
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -613,30 +612,33 @@ typedef struct {
guint64 file_size;
} nstrace_t;
-static guint32 nspm_signature_version(wftap*, gchar*, gint32);
-static gboolean nstrace_read_v10(wftap *wfth, int *err, gchar **err_info,
+static guint32 nspm_signature_version(wtap*, gchar*, gint32);
+static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean nstrace_read_v20(wftap *wfth, int *err, gchar **err_info,
+static gboolean nstrace_read_v20(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean nstrace_read_v30(wftap *wfth, int *err, gchar **err_info,
+static gboolean nstrace_read_v30(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean nstrace_seek_read_v10(wftap *wth, gint64 seek_off,
- void* header, Buffer *buf,
+static gboolean nstrace_seek_read_v10(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr,
+ Buffer *buf,
int *err, gchar **err_info);
-static gboolean nstrace_seek_read_v20(wftap *wth, gint64 seek_off,
- void* header, Buffer *buf,
+static gboolean nstrace_seek_read_v20(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr,
+ Buffer *buf,
int *err, gchar **err_info);
-static gboolean nstrace_seek_read_v30(wftap *wth, gint64 seek_off,
- void* header, Buffer *buf,
+static gboolean nstrace_seek_read_v30(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr,
+ Buffer *buf,
int *err, gchar **err_info);
-static void nstrace_close(wftap *wth);
+static void nstrace_close(wtap *wth);
-static gboolean nstrace_set_start_time_v10(wftap *wth);
-static gboolean nstrace_set_start_time_v20(wftap *wth);
-static gboolean nstrace_set_start_time(wftap *wth);
+static gboolean nstrace_set_start_time_v10(wtap *wth);
+static gboolean nstrace_set_start_time_v20(wtap *wth);
+static gboolean nstrace_set_start_time(wtap *wth);
static guint64 ns_hrtime2nsec(guint32 tm);
-static gboolean nstrace_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
@@ -664,35 +666,34 @@ static guint64 ns_hrtime2nsec(guint32 tm)
/*
** Netscaler trace format open routines
*/
-int nstrace_open(wftap *wfth, int *err, gchar **err_info)
+int nstrace_open(wtap *wth, int *err, gchar **err_info)
{
gchar *nstrace_buf;
gint64 file_size;
gint32 page_size;
nstrace_t *nstrace;
int bytes_read;
- wtap* wth = (wtap*)wfth->tap_specific_data;
errno = WTAP_ERR_CANT_READ;
- if ((file_size = wftap_file_size(wfth, err)) == -1)
+ if ((file_size = wtap_file_size(wth, err)) == -1)
return 0;
nstrace_buf = (gchar *)g_malloc(NSPR_PAGESIZE);
page_size = GET_READ_PAGE_SIZE(file_size);
- switch ((wfth->file_type_subtype = nspm_signature_version(wfth, nstrace_buf, page_size)))
+ switch ((wth->file_type_subtype = nspm_signature_version(wth, nstrace_buf, page_size)))
{
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0:
- wfth->file_encap = WTAP_ENCAP_NSTRACE_1_0;
+ wth->file_encap = WTAP_ENCAP_NSTRACE_1_0;
break;
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0:
- wfth->file_encap = WTAP_ENCAP_NSTRACE_2_0;
+ wth->file_encap = WTAP_ENCAP_NSTRACE_2_0;
break;
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_3_0:
- wfth->file_encap = WTAP_ENCAP_NSTRACE_3_0;
+ wth->file_encap = WTAP_ENCAP_NSTRACE_3_0;
g_free(nstrace_buf);
nstrace_buf = (gchar *)g_malloc(NSPR_PAGESIZE_TRACE);
page_size = GET_READ_PAGE_SIZEV3(file_size);
@@ -700,49 +701,49 @@ int nstrace_open(wftap *wfth, int *err, gchar **err_info)
default:
*err = WTAP_ERR_UNSUPPORTED;
- *err_info = g_strdup_printf("nstrace: file type %d unsupported", wfth->file_type_subtype);
+ *err_info = g_strdup_printf("nstrace: file type %d unsupported", wth->file_type_subtype);
g_free(nstrace_buf);
return 0;
}
- if ((file_seek(wfth->fh, 0, SEEK_SET, err)) == -1)
+ if ((file_seek(wth->fh, 0, SEEK_SET, err)) == -1)
{
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
g_free(nstrace_buf);
return 0;
}
- bytes_read = file_read(nstrace_buf, page_size, wfth->fh);
+ bytes_read = file_read(nstrace_buf, page_size, wth->fh);
if (bytes_read != page_size)
{
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
g_free(nstrace_buf);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
- switch (wfth->file_type_subtype)
+ switch (wth->file_type_subtype)
{
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0:
- wfth->subtype_read = nstrace_read_v10;
- wfth->subtype_seek_read = nstrace_seek_read_v10;
+ wth->subtype_read = nstrace_read_v10;
+ wth->subtype_seek_read = nstrace_seek_read_v10;
break;
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0:
- wfth->subtype_read = nstrace_read_v20;
- wfth->subtype_seek_read = nstrace_seek_read_v20;
+ wth->subtype_read = nstrace_read_v20;
+ wth->subtype_seek_read = nstrace_seek_read_v20;
break;
case WTAP_FILE_TYPE_SUBTYPE_NETSCALER_3_0:
- wfth->subtype_read = nstrace_read_v30;
- wfth->subtype_seek_read = nstrace_seek_read_v30;
+ wth->subtype_read = nstrace_read_v30;
+ wth->subtype_seek_read = nstrace_seek_read_v30;
break;
}
- wfth->subtype_close = nstrace_close;
+ wth->subtype_close = nstrace_close;
nstrace = (nstrace_t *)g_malloc(sizeof(nstrace_t));
- wfth->priv = (void *)nstrace;
+ wth->priv = (void *)nstrace;
nstrace->pnstrace_buf = nstrace_buf;
nstrace->xxx_offset = 0;
nstrace->nstrace_buflen = page_size;
@@ -755,22 +756,22 @@ int nstrace_open(wftap *wfth, int *err, gchar **err_info)
/* Set the start time by looking for the abstime record */
- if ((nstrace_set_start_time(wfth)) == FALSE)
+ if ((nstrace_set_start_time(wth)) == FALSE)
{
/* Reset the read pointer to start of the file. */
- if ((file_seek(wfth->fh, 0, SEEK_SET, err)) == -1)
+ if ((file_seek(wth->fh, 0, SEEK_SET, err)) == -1)
{
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
g_free(nstrace->pnstrace_buf);
g_free(nstrace);
return 0;
}
/* Read the first page of data */
- bytes_read = file_read(nstrace_buf, page_size, wfth->fh);
+ bytes_read = file_read(nstrace_buf, page_size, wth->fh);
if (bytes_read != page_size)
{
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
g_free(nstrace->pnstrace_buf);
g_free(nstrace);
return 0;
@@ -780,7 +781,7 @@ int nstrace_open(wftap *wfth, int *err, gchar **err_info)
nstrace->nstrace_buf_offset = 0;
}
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
wth->phdr.ts.secs = nstrace->nspm_curtime;
wth->phdr.ts.nsecs = 0;
@@ -805,12 +806,12 @@ nspm_signature_func(30)
** has to be a file seek to return to the start of the first page.
*/
static guint32
-nspm_signature_version(wftap *wfth, gchar *nstrace_buf, gint32 len)
+nspm_signature_version(wtap *wth, gchar *nstrace_buf, gint32 len)
{
gchar *dp = nstrace_buf;
int bytes_read;
- bytes_read = file_read(dp, len, wfth->fh);
+ bytes_read = file_read(dp, len, wth->fh);
if (bytes_read == len) {
for ( ; len > (gint32)(MIN(sizeof(NSPR_SIGSTR_V10), sizeof(NSPR_SIGSTR_V20))); dp++, len--)
@@ -851,9 +852,9 @@ nspm_signature_version(wftap *wfth, gchar *nstrace_buf, gint32 len)
#define nstrace_set_start_time_ver(ver) \
- gboolean nstrace_set_start_time_v##ver(wftap *wfth) \
+ gboolean nstrace_set_start_time_v##ver(wtap *wth) \
{\
- nstrace_t *nstrace = (nstrace_t *)wfth->priv;\
+ nstrace_t *nstrace = (nstrace_t *)wth->priv;\
gchar* nstrace_buf = nstrace->pnstrace_buf;\
gint32 nstrace_buf_offset = nstrace->nstrace_buf_offset;\
gint32 nstrace_buflen = nstrace->nstrace_buflen;\
@@ -880,7 +881,7 @@ nspm_signature_version(wftap *wfth, gchar *nstrace_buf, gint32 len)
nstrace_buf_offset = 0;\
nstrace->xxx_offset += nstrace_buflen;\
nstrace_buflen = GET_READ_PAGE_SIZE((nstrace->file_size - nstrace->xxx_offset));\
- }while((nstrace_buflen > 0) && (bytes_read = file_read(nstrace_buf, nstrace_buflen, wfth->fh)) && bytes_read == nstrace_buflen); \
+ }while((nstrace_buflen > 0) && (bytes_read = file_read(nstrace_buf, nstrace_buflen, wth->fh)) && bytes_read == nstrace_buflen); \
return FALSE;\
}
@@ -896,14 +897,14 @@ nstrace_set_start_time_ver(20)
** the next record after the ABSTIME record. Inorder to report correct time values, all trace
** records before the ABSTIME record are ignored.
*/
-static gboolean nstrace_set_start_time(wftap *wfth)
+static gboolean nstrace_set_start_time(wtap *wth)
{
- if (wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
- return nstrace_set_start_time_v10(wfth);
- else if (wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
- return nstrace_set_start_time_v20(wfth);
- else if (wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_3_0)
- return nstrace_set_start_time_v20(wfth);
+ if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
+ return nstrace_set_start_time_v10(wth);
+ else if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
+ return nstrace_set_start_time_v20(wth);
+ else if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_3_0)
+ return nstrace_set_start_time_v20(wth);
return FALSE;
}
@@ -924,9 +925,9 @@ static gboolean nstrace_set_start_time(wftap *wfth)
/*
** Netscaler trace format read routines.
*/
-static gboolean nstrace_read_v10(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- nstrace_t *nstrace = (nstrace_t *)wfth->priv;
+ nstrace_t *nstrace = (nstrace_t *)wth->priv;
guint64 nsg_creltime = nstrace->nsg_creltime;
gchar *nstrace_buf = nstrace->pnstrace_buf;
gint32 nstrace_buf_offset = nstrace->nstrace_buf_offset;
@@ -934,7 +935,6 @@ static gboolean nstrace_read_v10(wftap *wfth, int *err, gchar **err_info, gint64
nspr_pktracefull_v10_t *fp;
nspr_pktracepart_v10_t *pp;
int bytes_read;
- wtap* wth = (wtap*)wfth->tap_specific_data;
*err = 0;
*err_info = NULL;
@@ -959,8 +959,8 @@ static gboolean nstrace_read_v10(wftap *wfth, int *err, gchar **err_info, gint64
(phdr)->ts.secs = nstrace->nspm_curtime + (guint32) (nsg_creltime / 1000000000);\
(phdr)->ts.nsecs = (guint32) (nsg_creltime % 1000000000);\
TRACE_FULL_V##type##_REC_LEN_OFF(phdr,v##type##_full,fp,pktracefull_v##type);\
- buffer_assure_space(wfth->frame_buffer, (phdr)->caplen);\
- memcpy(buffer_start_ptr(wfth->frame_buffer), fp, (phdr)->caplen);\
+ buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
+ memcpy(buffer_start_ptr(wth->frame_buffer), fp, (phdr)->caplen);\
*data_offset = nstrace->xxx_offset + nstrace_buf_offset;\
nstrace->nstrace_buf_offset = nstrace_buf_offset + (phdr)->len;\
nstrace->nstrace_buflen = nstrace_buflen;\
@@ -982,8 +982,8 @@ static gboolean nstrace_read_v10(wftap *wfth, int *err, gchar **err_info, gint64
(phdr)->ts.secs = nstrace->nspm_curtime + (guint32) (nsg_creltime / 1000000000);\
(phdr)->ts.nsecs = (guint32) (nsg_creltime % 1000000000);\
TRACE_PART_V##type##_REC_LEN_OFF(phdr,v##type##_part,pp,pktracepart_v##type);\
- buffer_assure_space(wfth->frame_buffer, (phdr)->caplen);\
- memcpy(buffer_start_ptr(wfth->frame_buffer), pp, (phdr)->caplen);\
+ buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
+ memcpy(buffer_start_ptr(wth->frame_buffer), pp, (phdr)->caplen);\
*data_offset = nstrace->xxx_offset + nstrace_buf_offset;\
nstrace->nstrace_buf_offset = nstrace_buf_offset + (phdr)->caplen;\
nstrace->nsg_creltime = nsg_creltime;\
@@ -1028,7 +1028,7 @@ static gboolean nstrace_read_v10(wftap *wfth, int *err, gchar **err_info, gint64
nstrace_buf_offset = 0;
nstrace->xxx_offset += nstrace_buflen;
nstrace_buflen = GET_READ_PAGE_SIZE((nstrace->file_size - nstrace->xxx_offset));
- }while((nstrace_buflen > 0) && (bytes_read = file_read(nstrace_buf, nstrace_buflen, wfth->fh)) && (bytes_read == nstrace_buflen));
+ }while((nstrace_buflen > 0) && (bytes_read = file_read(nstrace_buf, nstrace_buflen, wth->fh)) && (bytes_read == nstrace_buflen));
return FALSE;
}
@@ -1106,8 +1106,8 @@ static gboolean nstrace_read_v10(wftap *wfth, int *err, gchar **err_info, gint64
SIZEDEF##ver((phdr),fp,ver);\
TRACE_V##ver##_REC_LEN_OFF((phdr),enumprefix,type,structname);\
(phdr)->pseudo_header.nstr.rec_type = NSPR_HEADER_VERSION##TYPE;\
- buffer_assure_space(wfth->frame_buffer, (phdr)->caplen);\
- memcpy(buffer_start_ptr(wfth->frame_buffer), fp, (phdr)->caplen);\
+ buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
+ memcpy(buffer_start_ptr(wth->frame_buffer), fp, (phdr)->caplen);\
*data_offset = nstrace->xxx_offset + nstrace_buf_offset;\
nstrace->nstrace_buf_offset = nstrace_buf_offset + nspr_getv20recordsize((nspr_hd_v20_t *)fp);\
nstrace->nstrace_buflen = nstrace_buflen;\
@@ -1115,15 +1115,14 @@ static gboolean nstrace_read_v10(wftap *wfth, int *err, gchar **err_info, gint64
return TRUE;\
}while(0)
-static gboolean nstrace_read_v20(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+static gboolean nstrace_read_v20(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- nstrace_t *nstrace = (nstrace_t *)wfth->priv;
+ nstrace_t *nstrace = (nstrace_t *)wth->priv;
guint64 nsg_creltime = nstrace->nsg_creltime;
gchar *nstrace_buf = nstrace->pnstrace_buf;
gint32 nstrace_buf_offset = nstrace->nstrace_buf_offset;
gint32 nstrace_buflen = nstrace->nstrace_buflen;
int bytes_read;
- wtap* wth = (wtap*)wfth->tap_specific_data;
*err = 0;
*err_info = NULL;
@@ -1218,7 +1217,7 @@ static gboolean nstrace_read_v20(wftap *wfth, int *err, gchar **err_info, gint64
nstrace_buf_offset = 0;
nstrace->xxx_offset += nstrace_buflen;
nstrace_buflen = GET_READ_PAGE_SIZE((nstrace->file_size - nstrace->xxx_offset));
- }while((nstrace_buflen > 0) && (bytes_read = file_read(nstrace_buf, nstrace_buflen, wfth->fh)) && (bytes_read == nstrace_buflen));
+ }while((nstrace_buflen > 0) && (bytes_read = file_read(nstrace_buf, nstrace_buflen, wth->fh)) && (bytes_read == nstrace_buflen));
return FALSE;
}
@@ -1232,7 +1231,7 @@ static gboolean nstrace_read_v20(wftap *wfth, int *err, gchar **err_info, gint64
SIZEDEF##ver((phdr),fp,ver);\
TRACE_V##ver##_REC_LEN_OFF((phdr),enumprefix,type,structname);\
(phdr)->pseudo_header.nstr.rec_type = NSPR_HEADER_VERSION##TYPE;\
- buffer_assure_space(wfth->frame_buffer, (phdr)->caplen);\
+ buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
*data_offset = nstrace->xxx_offset + nstrace_buf_offset;\
while (nstrace_tmpbuff_off < nspr_##structname##_s) {\
nstrace_tmpbuff[nstrace_tmpbuff_off++] = nstrace_buf[nstrace_buf_offset++];\
@@ -1247,7 +1246,7 @@ static gboolean nstrace_read_v20(wftap *wfth, int *err, gchar **err_info, gint64
}\
nstrace_buflen = NSPR_PAGESIZE_TRACE;\
nstrace->xxx_offset += nstrace_buflen;\
- bytes_read = file_read(nstrace_buf, NSPR_PAGESIZE_TRACE, wfth->fh);\
+ bytes_read = file_read(nstrace_buf, NSPR_PAGESIZE_TRACE, wth->fh);\
if (bytes_read != NSPR_PAGESIZE_TRACE) {\
return FALSE;\
} else {\
@@ -1260,16 +1259,16 @@ static gboolean nstrace_read_v20(wftap *wfth, int *err, gchar **err_info, gint64
while (nstrace_tmpbuff_off < nst_dataSize) {\
nstrace_tmpbuff[nstrace_tmpbuff_off++] = nstrace_buf[nstrace_buf_offset++];\
}\
- memcpy(buffer_start_ptr(wfth->frame_buffer), nstrace_tmpbuff, (phdr)->caplen);\
+ memcpy(buffer_start_ptr(wth->frame_buffer), nstrace_tmpbuff, (phdr)->caplen);\
nstrace->nstrace_buf_offset = nstrace_buf_offset;\
nstrace->nstrace_buflen = nstrace_buflen = ((gint32)NSPR_PAGESIZE_TRACE);\
nstrace->nsg_creltime = nsg_creltime;\
return TRUE;\
} while(0)
-static gboolean nstrace_read_v30(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+static gboolean nstrace_read_v30(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- nstrace_t *nstrace = (nstrace_t *)wfth->priv;
+ nstrace_t *nstrace = (nstrace_t *)wth->priv;
guint64 nsg_creltime = nstrace->nsg_creltime;
gchar *nstrace_buf = nstrace->pnstrace_buf;
gint32 nstrace_buf_offset = nstrace->nstrace_buf_offset;
@@ -1278,8 +1277,6 @@ static gboolean nstrace_read_v30(wftap *wfth, int *err, gchar **err_info, gint64
guint32 nstrace_tmpbuff_off=0,nst_dataSize=0,rec_size=0,nsg_nextPageOffset=0;
nspr_hd_v20_t *hdp;
int bytes_read;
- wtap* wth = (wtap*)wfth->tap_specific_data;
-
*err = 0;
*err_info = NULL;
@@ -1325,15 +1322,15 @@ static gboolean nstrace_read_v30(wftap *wfth, int *err, gchar **err_info, gint64
nstrace_buf_offset = 0;
nstrace->xxx_offset += nstrace_buflen;
nstrace_buflen = NSPR_PAGESIZE_TRACE;
- } while((nstrace_buflen > 0) && (bytes_read = file_read(nstrace_buf, nstrace_buflen, wfth->fh)) && (bytes_read == nstrace_buflen));
+ } while((nstrace_buflen > 0) && (bytes_read = file_read(nstrace_buf, nstrace_buflen, wth->fh)) && (bytes_read == nstrace_buflen));
return FALSE;
}
#undef PACKET_DESCRIBE
-static gboolean nstrace_seek_read_v10(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean nstrace_seek_read_v10(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
nspr_hd_v10_t hdr;
int bytes_read;
@@ -1342,19 +1339,18 @@ static gboolean nstrace_seek_read_v10(wftap *wfth, gint64 seek_off,
unsigned int bytes_to_read;
nspr_pktracefull_v10_t *fp;
nspr_pktracepart_v10_t *pp;
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
*err = 0;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/*
** Read the record header.
*/
- bytes_read = file_read((void *)&hdr, sizeof hdr, wfth->random_fh);
+ bytes_read = file_read((void *)&hdr, sizeof hdr, wth->random_fh);
if (bytes_read != sizeof hdr) {
- *err = file_error(wfth->random_fh, err_info);
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
@@ -1372,10 +1368,10 @@ static gboolean nstrace_seek_read_v10(wftap *wfth, gint64 seek_off,
pd = buffer_start_ptr(buf);
memcpy(pd, (void *)&hdr, sizeof hdr);
if (record_length > sizeof hdr) {
- bytes_to_read = (unsigned int)(record_length - sizeof hdr);
- bytes_read = file_read(pd + sizeof hdr, bytes_to_read, wfth->random_fh);
+ bytes_to_read = (unsigned int)(record_length - sizeof hdr);
+ bytes_read = file_read(pd + sizeof hdr, bytes_to_read, wth->random_fh);
if (bytes_read < 0 || (unsigned int)bytes_read != bytes_to_read) {
- *err = file_error(wfth->random_fh, err_info);
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
@@ -1424,8 +1420,8 @@ static gboolean nstrace_seek_read_v10(wftap *wfth, gint64 seek_off,
return TRUE;\
}while(0)
-static gboolean nstrace_seek_read_v20(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean nstrace_seek_read_v20(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
nspr_hd_v20_t hdr;
int bytes_read;
@@ -1433,19 +1429,18 @@ static gboolean nstrace_seek_read_v20(wftap *wfth, gint64 seek_off,
guint hdrlen;
guint8 *pd;
unsigned int bytes_to_read;
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
*err = 0;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/*
** Read the first 2 bytes of the record header.
*/
- bytes_read = file_read((void *)&hdr, 2, wfth->random_fh);
+ bytes_read = file_read((void *)&hdr, 2, wth->random_fh);
if (bytes_read != 2) {
- *err = file_error(wfth->random_fh, err_info);
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
@@ -1456,9 +1451,9 @@ static gboolean nstrace_seek_read_v20(wftap *wfth, gint64 seek_off,
** Is there a third byte? If so, read it.
*/
if (hdr.phd_RecordSizeLow & NSPR_V20RECORDSIZE_2BYTES) {
- bytes_read = file_read((void *)&hdr.phd_RecordSizeHigh, 1, wfth->random_fh);
+ bytes_read = file_read((void *)&hdr.phd_RecordSizeHigh, 1, wth->random_fh);
if (bytes_read != 1) {
- *err = file_error(wfth->random_fh, err_info);
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
@@ -1479,9 +1474,9 @@ static gboolean nstrace_seek_read_v20(wftap *wfth, gint64 seek_off,
memcpy(pd, (void *)&hdr, hdrlen);
if (record_length > hdrlen) {
bytes_to_read = (unsigned int)(record_length - hdrlen);
- bytes_read = file_read(pd + hdrlen, bytes_to_read, wfth->random_fh);
+ bytes_read = file_read(pd + hdrlen, bytes_to_read, wth->random_fh);
if (bytes_read < 0 || (unsigned int)bytes_read != bytes_to_read) {
- *err = file_error(wfth->random_fh, err_info);
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
@@ -1541,8 +1536,8 @@ static gboolean nstrace_seek_read_v20(wftap *wfth, gint64 seek_off,
}
-static gboolean nstrace_seek_read_v30(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean nstrace_seek_read_v30(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
nspr_hd_v20_t hdr;
int bytes_read;
@@ -1550,18 +1545,17 @@ static gboolean nstrace_seek_read_v30(wftap *wfth, gint64 seek_off,
guint hdrlen;
guint8 *pd;
unsigned int bytes_to_read;
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
*err = 0;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/*
** Read the first 2 bytes of the record header.
*/
- bytes_read = file_read((void *)&hdr, 2, wfth->random_fh);
+ bytes_read = file_read((void *)&hdr, 2, wth->random_fh);
if (bytes_read != 2) {
- *err = file_error(wfth->random_fh, err_info);
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
@@ -1572,9 +1566,9 @@ static gboolean nstrace_seek_read_v30(wftap *wfth, gint64 seek_off,
** Is there a third byte? If so, read it.
*/
if (hdr.phd_RecordSizeLow & NSPR_V20RECORDSIZE_2BYTES) {
- bytes_read = file_read((void *)&hdr.phd_RecordSizeHigh, 1, wfth->random_fh);
+ bytes_read = file_read((void *)&hdr.phd_RecordSizeHigh, 1, wth->random_fh);
if (bytes_read != 1) {
- *err = file_error(wfth->random_fh, err_info);
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
@@ -1595,9 +1589,9 @@ static gboolean nstrace_seek_read_v30(wftap *wfth, gint64 seek_off,
memcpy(pd, (void *)&hdr, hdrlen);
if (record_length > hdrlen) {
bytes_to_read = (unsigned int)(record_length - hdrlen);
- bytes_read = file_read(pd + hdrlen, bytes_to_read, wfth->random_fh);
+ bytes_read = file_read(pd + hdrlen, bytes_to_read, wth->random_fh);
if (bytes_read < 0 || (unsigned int)bytes_read != bytes_to_read) {
- *err = file_error(wfth->random_fh, err_info);
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return FALSE;
@@ -1625,9 +1619,9 @@ static gboolean nstrace_seek_read_v30(wftap *wfth, gint64 seek_off,
/*
** Netscaler trace format close routines.
*/
-static void nstrace_close(wftap *wfth)
+static void nstrace_close(wtap *wth)
{
- nstrace_t *nstrace = (nstrace_t *)wfth->priv;
+ nstrace_t *nstrace = (nstrace_t *)wth->priv;
g_free(nstrace->pnstrace_buf);
}
@@ -1672,7 +1666,7 @@ int nstrace_30_dump_can_write_encap(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
** failure */
-gboolean nstrace_dump_open(wftap_dumper *wdh, int *err _U_)
+gboolean nstrace_dump_open(wtap_dumper *wdh, int *err _U_)
{
nstrace_dump_t *nstrace;
@@ -1688,7 +1682,7 @@ gboolean nstrace_dump_open(wftap_dumper *wdh, int *err _U_)
}
-static gboolean nstrace_add_signature(wftap_dumper *wdh, int *err)
+static gboolean nstrace_add_signature(wtap_dumper *wdh, int *err)
{
nstrace_dump_t *nstrace = (nstrace_dump_t *)wdh->priv;
@@ -1706,7 +1700,7 @@ static gboolean nstrace_add_signature(wftap_dumper *wdh, int *err)
g_strlcpy(sig10.sig_Signature, NSPR_SIGSTR_V10, NSPR_SIGSIZE_V10);
/* Write the record into the file */
- if (!wftap_dump_file_write(wdh, &sig10, nspr_signature_v10_s,
+ if (!wtap_dump_file_write(wdh, &sig10, nspr_signature_v10_s,
err))
return FALSE;
@@ -1722,7 +1716,7 @@ static gboolean nstrace_add_signature(wftap_dumper *wdh, int *err)
memcpy(sig20.sig_Signature, NSPR_SIGSTR_V20, sizeof(NSPR_SIGSTR_V20));
/* Write the record into the file */
- if (!wftap_dump_file_write(wdh, &sig20, sig20.sig_RecordSize,
+ if (!wtap_dump_file_write(wdh, &sig20, sig20.sig_RecordSize,
err))
return FALSE;
@@ -1738,7 +1732,7 @@ static gboolean nstrace_add_signature(wftap_dumper *wdh, int *err)
memcpy(sig30.sig_Signature, NSPR_SIGSTR_V30, sizeof(NSPR_SIGSTR_V30));
/* Write the record into the file */
- if (!wftap_dump_file_write(wdh, &sig30, sig30.sig_RecordSize,
+ if (!wtap_dump_file_write(wdh, &sig30, sig30.sig_RecordSize,
err))
return FALSE;
@@ -1755,7 +1749,7 @@ static gboolean nstrace_add_signature(wftap_dumper *wdh, int *err)
static gboolean
-nstrace_add_abstime(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+nstrace_add_abstime(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
nstrace_dump_t *nstrace = (nstrace_dump_t *)wdh->priv;
@@ -1782,7 +1776,7 @@ nstrace_add_abstime(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
memcpy(abs10.abs_Time, &abstime, sizeof abs10.abs_Time);
/* Write the record into the file */
- if (!wftap_dump_file_write(wdh, &abs10, nspr_abstime_v10_s, err))
+ if (!wtap_dump_file_write(wdh, &abs10, nspr_abstime_v10_s, err))
return FALSE;
/* Move forward the page offset */
@@ -1805,7 +1799,7 @@ nstrace_add_abstime(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
memcpy(abs20.abs_RelTime, &abstime, sizeof abs20.abs_RelTime);
/* Write the record into the file */
- if (!wftap_dump_file_write(wdh, &abs20, nspr_abstime_v20_s, err))
+ if (!wtap_dump_file_write(wdh, &abs20, nspr_abstime_v20_s, err))
return FALSE;
/* Move forward the page offset */
@@ -1823,7 +1817,7 @@ nstrace_add_abstime(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
-static gboolean nstrace_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
nstrace_dump_t *nstrace = (nstrace_dump_t *)wdh->priv;
@@ -1862,7 +1856,7 @@ static gboolean nstrace_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
if (nstrace->page_offset + phdr->caplen >= nstrace->page_len)
{
/* Start on the next page */
- if (wftap_dump_file_seek(wdh, (nstrace->page_len - nstrace->page_offset), SEEK_CUR, err) == -1)
+ if (wtap_dump_file_seek(wdh, (nstrace->page_len - nstrace->page_offset), SEEK_CUR, err) == -1)
return FALSE;
nstrace->page_offset = 0;
@@ -1873,7 +1867,7 @@ static gboolean nstrace_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
}
/* Write the actual record as is */
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
nstrace->page_offset += (guint16) phdr->caplen;
@@ -1901,7 +1895,7 @@ static gboolean nstrace_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
if (nstrace->page_offset + phdr->caplen >= nstrace->page_len)
{
/* Start on the next page */
- if (wftap_dump_file_seek(wdh, (nstrace->page_len - nstrace->page_offset), SEEK_CUR, err) == -1)
+ if (wtap_dump_file_seek(wdh, (nstrace->page_len - nstrace->page_offset), SEEK_CUR, err) == -1)
return FALSE;
nstrace->page_offset = 0;
@@ -1912,7 +1906,7 @@ static gboolean nstrace_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
}
/* Write the actual record as is */
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
nstrace->page_offset += (guint16) phdr->caplen;
@@ -1934,7 +1928,7 @@ static gboolean nstrace_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
if (nstrace->page_offset + phdr->caplen >= nstrace->page_len)
{
/* Start on the next page */
- if (wftap_dump_file_seek(wdh, (nstrace->page_len - nstrace->page_offset), SEEK_CUR, err) == -1)
+ if (wtap_dump_file_seek(wdh, (nstrace->page_len - nstrace->page_offset), SEEK_CUR, err) == -1)
return FALSE;
nstrace->page_offset = 0;
@@ -1945,7 +1939,7 @@ static gboolean nstrace_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
}
/* Write the actual record as is */
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
nstrace->page_offset += (guint16) phdr->caplen;
diff --git a/wiretap/netscaler.h b/wiretap/netscaler.h
index 7d8e1a5694..b269ff9e1f 100644
--- a/wiretap/netscaler.h
+++ b/wiretap/netscaler.h
@@ -113,12 +113,12 @@
#define NSPR_HEADER_VERSION206 0x26
#define NSPR_HEADER_VERSION300 0x30
-int nstrace_open(wftap *wfth, int *err, gchar **err_info);
+int nstrace_open(wtap *wth, int *err, gchar **err_info);
int nstrace_10_dump_can_write_encap(int encap);
int nstrace_20_dump_can_write_encap(int encap);
int nstrace_30_dump_can_write_encap(int encap);
-gboolean nstrace_dump_open(wftap_dumper *wdh, int *err);
+gboolean nstrace_dump_open(wtap_dumper *wdh, int *err);
#endif /* _NETSCALER_H */
diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c
index c1ef924fd4..bbb4a535e9 100644
--- a/wiretap/netscreen.c
+++ b/wiretap/netscreen.c
@@ -23,7 +23,6 @@
*/
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "netscreen.h"
@@ -64,14 +63,14 @@
*/
static gboolean info_line(const gchar *line);
-static gint64 netscreen_seek_next_packet(wftap *wfth, int *err, gchar **err_info,
+static gint64 netscreen_seek_next_packet(wtap *wth, int *err, gchar **err_info,
char *hdr);
-static gboolean netscreen_check_file_type(wftap *wfth, int *err,
+static gboolean netscreen_check_file_type(wtap *wth, int *err,
gchar **err_info);
-static gboolean netscreen_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean netscreen_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+static gboolean netscreen_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info);
static int parse_netscreen_rec_hdr(struct wtap_pkthdr *phdr, const char *line,
char *cap_int, gboolean *cap_dir, char *cap_dst,
@@ -103,22 +102,22 @@ static gboolean info_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 netscreen_seek_next_packet(wftap *wfth, int *err, gchar **err_info,
+static gint64 netscreen_seek_next_packet(wtap *wth, int *err, gchar **err_info,
char *hdr)
{
gint64 cur_off;
char buf[NETSCREEN_LINE_LENGTH];
while (1) {
- cur_off = file_tell(wfth->fh);
+ cur_off = file_tell(wth->fh);
if (cur_off == -1) {
/* Error */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return -1;
}
- if (file_gets(buf, sizeof(buf), wfth->fh) == NULL) {
+ if (file_gets(buf, sizeof(buf), wth->fh) == NULL) {
/* EOF or error. */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
break;
}
if (strstr(buf, NETSCREEN_REC_MAGIC_STR1) ||
@@ -137,7 +136,7 @@ static gint64 netscreen_seek_next_packet(wftap *wfth, int *err, gchar **err_info
* if we get an I/O error, "*err" will be set to a non-zero value and
* "*err_info" is set to null or an additional error string.
*/
-static gboolean netscreen_check_file_type(wftap *wfth, int *err, gchar **err_info)
+static gboolean netscreen_check_file_type(wtap *wth, int *err, gchar **err_info)
{
char buf[NETSCREEN_LINE_LENGTH];
guint reclen, line;
@@ -145,9 +144,9 @@ static gboolean netscreen_check_file_type(wftap *wfth, int *err, gchar **err_inf
buf[NETSCREEN_LINE_LENGTH-1] = '\0';
for (line = 0; line < NETSCREEN_HEADER_LINES_TO_CHECK; line++) {
- if (file_gets(buf, NETSCREEN_LINE_LENGTH, wfth->fh) == NULL) {
+ if (file_gets(buf, NETSCREEN_LINE_LENGTH, wth->fh) == NULL) {
/* EOF or error. */
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
return FALSE;
}
@@ -167,31 +166,31 @@ static gboolean netscreen_check_file_type(wftap *wfth, int *err, gchar **err_inf
}
-int netscreen_open(wftap *wfth, int *err, gchar **err_info)
+int netscreen_open(wtap *wth, int *err, gchar **err_info)
{
/* Look for a NetScreen snoop header line */
- if (!netscreen_check_file_type(wfth, err, err_info)) {
+ if (!netscreen_check_file_type(wth, err, err_info)) {
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
- if (file_seek(wfth->fh, 0L, SEEK_SET, err) == -1) /* rewind */
+ if (file_seek(wth->fh, 0L, SEEK_SET, err) == -1) /* rewind */
return -1;
- wfth->file_encap = WTAP_ENCAP_UNKNOWN;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETSCREEN;
- wfth->snapshot_length = 0; /* not known */
- wfth->subtype_read = netscreen_read;
- wfth->subtype_seek_read = netscreen_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_DSEC;
+ wth->file_encap = WTAP_ENCAP_UNKNOWN;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETSCREEN;
+ wth->snapshot_length = 0; /* not known */
+ wth->subtype_read = netscreen_read;
+ wth->subtype_seek_read = netscreen_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_DSEC;
return 1;
}
/* Find the next packet and parse it; called from wtap_read(). */
-static gboolean netscreen_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
gint64 offset;
@@ -200,10 +199,9 @@ static gboolean netscreen_read(wftap *wfth, int *err, gchar **err_info,
char cap_int[NETSCREEN_MAX_INT_NAME_LENGTH];
gboolean cap_dir;
char cap_dst[13];
- wtap* wth = (wtap*)wfth->tap_specific_data;
/* Find the next packet */
- offset = netscreen_seek_next_packet(wfth, err, err_info, line);
+ offset = netscreen_seek_next_packet(wth, err, err_info, line);
if (offset < 0)
return FALSE;
@@ -215,8 +213,8 @@ static gboolean netscreen_read(wftap *wfth, int *err, gchar **err_info,
/* Convert the ASCII hex dump to binary data, and fill in some
struct wtap_pkthdr fields */
- if (!parse_netscreen_hex_dump(wfth->fh, pkt_len, cap_int,
- cap_dst, &wth->phdr, wfth->frame_buffer, err, err_info))
+ if (!parse_netscreen_hex_dump(wth->fh, pkt_len, cap_int,
+ cap_dst, &wth->phdr, wth->frame_buffer, err, err_info))
return FALSE;
/*
@@ -227,11 +225,11 @@ static gboolean netscreen_read(wftap *wfth, int *err, gchar **err_info,
* set it to WTAP_ENCAP_PER_PACKET, as this file doesn't
* have a single encapsulation for all packets in the file.
*/
- if (wfth->file_encap == WTAP_ENCAP_UNKNOWN)
- wfth->file_encap = wth->phdr.pkt_encap;
+ if (wth->file_encap == WTAP_ENCAP_UNKNOWN)
+ wth->file_encap = wth->phdr.pkt_encap;
else {
- if (wfth->file_encap != wth->phdr.pkt_encap)
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
+ if (wth->file_encap != wth->phdr.pkt_encap)
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
}
*data_offset = offset;
@@ -240,8 +238,8 @@ static gboolean netscreen_read(wftap *wfth, int *err, gchar **err_info,
/* Used to read packets in random-access fashion */
static gboolean
-netscreen_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+netscreen_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
int pkt_len;
@@ -249,14 +247,13 @@ netscreen_seek_read(wftap *wfth, gint64 seek_off,
char cap_int[NETSCREEN_MAX_INT_NAME_LENGTH];
gboolean cap_dir;
char cap_dst[13];
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1) {
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
return FALSE;
}
- if (file_gets(line, NETSCREEN_LINE_LENGTH, wfth->random_fh) == NULL) {
- *err = file_error(wfth->random_fh, err_info);
+ if (file_gets(line, NETSCREEN_LINE_LENGTH, wth->random_fh) == NULL) {
+ *err = file_error(wth->random_fh, err_info);
if (*err == 0) {
*err = WTAP_ERR_SHORT_READ;
}
@@ -268,7 +265,7 @@ netscreen_seek_read(wftap *wfth, gint64 seek_off,
if (pkt_len == -1)
return FALSE;
- if (!parse_netscreen_hex_dump(wfth->random_fh, pkt_len, cap_int,
+ if (!parse_netscreen_hex_dump(wth->random_fh, pkt_len, cap_int,
cap_dst, phdr, buf, err, err_info))
return FALSE;
return TRUE;
diff --git a/wiretap/netscreen.h b/wiretap/netscreen.h
index bb6158e28d..78dbc24b66 100644
--- a/wiretap/netscreen.h
+++ b/wiretap/netscreen.h
@@ -49,6 +49,6 @@
#define NETSCREEN_MAX_PACKET_LEN 65536
-int netscreen_open(wftap *wfth, int *err, gchar **err_info);
+int netscreen_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 55af1276de..0c6898bbdb 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -26,7 +26,6 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -176,17 +175,17 @@ typedef struct {
gboolean is_hpux_11;
} nettl_t;
-static gboolean nettl_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean nettl_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+static gboolean nettl_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info);
-static gboolean nettl_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
+static gboolean nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info);
-static gboolean nettl_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
- const guint8 *pd, int *err);
+static gboolean nettl_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
+ const guint8 *pd, int *err);
-int nettl_open(wftap *wfth, int *err, gchar **err_info)
+int nettl_open(wtap *wth, int *err, gchar **err_info)
{
struct nettl_file_hdr file_hdr;
guint16 dummy[2];
@@ -198,42 +197,43 @@ int nettl_open(wftap *wfth, int *err, gchar **err_info)
/* Read in the string that should be at the start of a HP file */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(file_hdr.magic, MAGIC_SIZE, wfth->fh);
+ bytes_read = file_read(file_hdr.magic, MAGIC_SIZE, wth->fh);
if (bytes_read != MAGIC_SIZE) {
- *err = file_error(wfth->fh, err_info);
- if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
- return -1;
- return 0;
+ *err = file_error(wth->fh, err_info);
+ if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
+ return -1;
+ return 0;
}
if (memcmp(file_hdr.magic, nettl_magic_hpux9, MAGIC_SIZE) &&
memcmp(file_hdr.magic, nettl_magic_hpux10, MAGIC_SIZE)) {
- return 0;
+ return 0;
}
/* Read the rest of the file header */
- bytes_read = file_read(file_hdr.file_name, FILE_HDR_SIZE - MAGIC_SIZE, wfth->fh);
+ bytes_read = file_read(file_hdr.file_name, FILE_HDR_SIZE - MAGIC_SIZE,
+ wth->fh);
if (bytes_read != FILE_HDR_SIZE - MAGIC_SIZE) {
- *err = file_error(wfth->fh, err_info);
- if (*err == 0)
- *err = WTAP_ERR_SHORT_READ;
- return -1;
+ *err = file_error(wth->fh, err_info);
+ if (*err == 0)
+ *err = WTAP_ERR_SHORT_READ;
+ return -1;
}
/* This is an nettl file */
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETTL;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETTL;
nettl = g_new(nettl_t,1);
- wfth->priv = (void *)nettl;
+ wth->priv = (void *)nettl;
if (file_hdr.os_vers[2] == '1' && file_hdr.os_vers[3] == '1')
- nettl->is_hpux_11 = TRUE;
+ nettl->is_hpux_11 = TRUE;
else
- nettl->is_hpux_11 = FALSE;
- wfth->subtype_read = nettl_read;
- wfth->subtype_seek_read = nettl_seek_read;
- wfth->snapshot_length = 0; /* not available */
+ nettl->is_hpux_11 = FALSE;
+ wth->subtype_read = nettl_read;
+ wth->subtype_seek_read = nettl_seek_read;
+ wth->snapshot_length = 0; /* not available */
/* read the first header to take a guess at the file encap */
- bytes_read = file_read(dummy, 4, wfth->fh);
+ bytes_read = file_read(dummy, 4, wth->fh);
if (bytes_read != 4) {
if (*err != 0) {
return -1;
@@ -251,50 +251,48 @@ int nettl_open(wftap *wfth, int *err, gchar **err_info)
case NETTL_SUBSYS_EISA_FDDI :
case NETTL_SUBSYS_PCI_FDDI :
case NETTL_SUBSYS_HSC_FDDI :
- wfth->file_encap = WTAP_ENCAP_NETTL_FDDI;
- break;
+ wth->file_encap = WTAP_ENCAP_NETTL_FDDI;
+ break;
case NETTL_SUBSYS_TOKEN :
case NETTL_SUBSYS_PCI_TR :
- wfth->file_encap = WTAP_ENCAP_NETTL_TOKEN_RING;
- break;
+ wth->file_encap = WTAP_ENCAP_NETTL_TOKEN_RING;
+ break;
case NETTL_SUBSYS_NS_LS_IP :
case NETTL_SUBSYS_NS_LS_LOOPBACK :
case NETTL_SUBSYS_NS_LS_TCP :
case NETTL_SUBSYS_NS_LS_UDP :
case NETTL_SUBSYS_NS_LS_IPV6 :
- wfth->file_encap = WTAP_ENCAP_NETTL_RAW_IP;
- break;
+ wth->file_encap = WTAP_ENCAP_NETTL_RAW_IP;
+ break;
case NETTL_SUBSYS_NS_LS_ICMP :
- wfth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
- break;
+ wth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
+ break;
case NETTL_SUBSYS_NS_LS_ICMPV6 :
- wfth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
- break;
+ wth->file_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
+ break;
case NETTL_SUBSYS_NS_LS_TELNET :
- wfth->file_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
- break;
- default:
- /* If this assumption is bad, the read will catch it */
- wfth->file_encap = WTAP_ENCAP_NETTL_ETHERNET;
+ wth->file_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
+ break;
+ default:
+ /* If this assumption is bad, the read will catch it */
+ wth->file_encap = WTAP_ENCAP_NETTL_ETHERNET;
}
- if (file_seek(wfth->fh, FILE_HDR_SIZE, SEEK_SET, err) == -1) {
- return -1;
+ if (file_seek(wth->fh, FILE_HDR_SIZE, SEEK_SET, err) == -1) {
+ return -1;
}
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
/* Read the next packet */
-static gboolean nettl_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
-
/* Read record header. */
- *data_offset = file_tell(wfth->fh);
- if (!nettl_read_rec(wfth, wfth->fh, &wth->phdr, wfth->frame_buffer,
+ *data_offset = file_tell(wth->fh);
+ if (!nettl_read_rec(wth, wth->fh, &wth->phdr, wth->frame_buffer,
err, err_info)) {
/* Read error or EOF */
return FALSE;
@@ -308,43 +306,41 @@ static gboolean nettl_read(wftap *wfth, int *err, gchar **err_info,
* set it to WTAP_ENCAP_PER_PACKET, as this file doesn't
* have a single encapsulation for all packets in the file.
*/
- if (wfth->file_encap == WTAP_ENCAP_UNKNOWN)
- wfth->file_encap = wth->phdr.pkt_encap;
+ if (wth->file_encap == WTAP_ENCAP_UNKNOWN)
+ wth->file_encap = wth->phdr.pkt_encap;
else {
- if (wfth->file_encap != wth->phdr.pkt_encap)
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
+ if (wth->file_encap != wth->phdr.pkt_encap)
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
}
return TRUE;
}
static gboolean
-nettl_seek_read(wftap *wfth, gint64 seek_off, void* header,
+nettl_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
-
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
- return FALSE;
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+ return FALSE;
/* Read record header. */
- if (!nettl_read_rec(wfth, wfth->random_fh, phdr, buf, err, err_info)) {
- /* Read error or EOF */
- if (*err == 0) {
- /* EOF means "short read" in random-access mode */
- *err = WTAP_ERR_SHORT_READ;
- }
- return FALSE;
+ if (!nettl_read_rec(wth, wth->random_fh, phdr, buf, err, err_info)) {
+ /* Read error or EOF */
+ if (*err == 0) {
+ /* EOF means "short read" in random-access mode */
+ *err = WTAP_ERR_SHORT_READ;
+ }
+ return FALSE;
}
return TRUE;
}
static gboolean
-nettl_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
+nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
- nettl_t *nettl = (nettl_t *)wfth->priv;
+ nettl_t *nettl = (nettl_t *)wth->priv;
gboolean fddihack = FALSE;
int bytes_read;
struct nettlrec_hdr rec_hdr;
@@ -362,28 +358,29 @@ nettl_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
errno = WTAP_ERR_CANT_READ;
bytes_read = file_read(&rec_hdr.hdr_len, sizeof rec_hdr.hdr_len, fh);
if (bytes_read != sizeof rec_hdr.hdr_len) {
- *err = file_error(fh, err_info);
- if (*err == 0 && bytes_read != 0)
- *err = WTAP_ERR_SHORT_READ;
- return FALSE;
+ *err = file_error(fh, err_info);
+ if (*err == 0 && bytes_read != 0)
+ *err = WTAP_ERR_SHORT_READ;
+ return FALSE;
}
hdr_len = g_ntohs(rec_hdr.hdr_len);
if (hdr_len < NETTL_REC_HDR_LEN) {
- *err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("nettl: record header length %u too short", hdr_len);
- return FALSE;
+ *err = WTAP_ERR_BAD_FILE;
+ *err_info = g_strdup_printf("nettl: record header length %u too short",
+ hdr_len);
+ return FALSE;
}
bytes_read = file_read(&rec_hdr.subsys, NETTL_REC_HDR_LEN - 2, fh);
if (bytes_read != NETTL_REC_HDR_LEN - 2) {
- *err = file_error(fh, err_info);
- if (*err == 0)
- *err = WTAP_ERR_SHORT_READ;
- return FALSE;
+ *err = file_error(fh, err_info);
+ if (*err == 0)
+ *err = WTAP_ERR_SHORT_READ;
+ return FALSE;
}
subsys = g_ntohs(rec_hdr.subsys);
hdr_len -= NETTL_REC_HDR_LEN;
if (file_seek(fh, hdr_len, SEEK_CUR, err) == -1)
- return FALSE;
+ return FALSE;
if ( (pntoh32(&rec_hdr.kind) & NETTL_HDR_PDU_MASK) == 0 ) {
/* not actually a data packet (PDU) trace record */
@@ -392,72 +389,72 @@ nettl_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
caplen = pntoh32(&rec_hdr.caplen);
padlen = 0;
} else switch (subsys) {
- case NETTL_SUBSYS_LAN100 :
- case NETTL_SUBSYS_EISA100BT :
- case NETTL_SUBSYS_BASE100 :
- case NETTL_SUBSYS_GSC100BT :
- case NETTL_SUBSYS_PCI100BT :
- case NETTL_SUBSYS_SPP100BT :
- case NETTL_SUBSYS_100VG :
- case NETTL_SUBSYS_GELAN :
- case NETTL_SUBSYS_BTLAN :
- case NETTL_SUBSYS_INTL100 :
- case NETTL_SUBSYS_IGELAN :
- case NETTL_SUBSYS_IETHER :
- case NETTL_SUBSYS_IXGBE :
- case NETTL_SUBSYS_HSSN :
- case NETTL_SUBSYS_IGSSN :
- case NETTL_SUBSYS_ICXGBE :
- case NETTL_SUBSYS_IEXGBE :
- case NETTL_SUBSYS_IOCXGBE :
- case NETTL_SUBSYS_IQXGBE :
- case NETTL_SUBSYS_HPPB_FDDI :
- case NETTL_SUBSYS_EISA_FDDI :
+ case NETTL_SUBSYS_LAN100 :
+ case NETTL_SUBSYS_EISA100BT :
+ case NETTL_SUBSYS_BASE100 :
+ case NETTL_SUBSYS_GSC100BT :
+ case NETTL_SUBSYS_PCI100BT :
+ case NETTL_SUBSYS_SPP100BT :
+ case NETTL_SUBSYS_100VG :
+ case NETTL_SUBSYS_GELAN :
+ case NETTL_SUBSYS_BTLAN :
+ case NETTL_SUBSYS_INTL100 :
+ case NETTL_SUBSYS_IGELAN :
+ case NETTL_SUBSYS_IETHER :
+ case NETTL_SUBSYS_IXGBE :
+ case NETTL_SUBSYS_HSSN :
+ case NETTL_SUBSYS_IGSSN :
+ case NETTL_SUBSYS_ICXGBE :
+ case NETTL_SUBSYS_IEXGBE :
+ case NETTL_SUBSYS_IOCXGBE :
+ case NETTL_SUBSYS_IQXGBE :
+ case NETTL_SUBSYS_HPPB_FDDI :
+ case NETTL_SUBSYS_EISA_FDDI :
case NETTL_SUBSYS_PCI_FDDI :
case NETTL_SUBSYS_HSC_FDDI :
case NETTL_SUBSYS_TOKEN :
case NETTL_SUBSYS_PCI_TR :
- case NETTL_SUBSYS_NS_LS_IP :
- case NETTL_SUBSYS_NS_LS_LOOPBACK :
- case NETTL_SUBSYS_NS_LS_TCP :
- case NETTL_SUBSYS_NS_LS_UDP :
- case NETTL_SUBSYS_HP_APAPORT :
- case NETTL_SUBSYS_HP_APALACP :
- case NETTL_SUBSYS_NS_LS_IPV6 :
- case NETTL_SUBSYS_NS_LS_ICMPV6 :
- case NETTL_SUBSYS_NS_LS_ICMP :
- case NETTL_SUBSYS_NS_LS_TELNET :
- case NETTL_SUBSYS_NS_LS_SCTP :
- if( (subsys == NETTL_SUBSYS_NS_LS_IP)
- || (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK)
- || (subsys == NETTL_SUBSYS_NS_LS_UDP)
- || (subsys == NETTL_SUBSYS_NS_LS_TCP)
- || (subsys == NETTL_SUBSYS_NS_LS_SCTP)
- || (subsys == NETTL_SUBSYS_NS_LS_IPV6)) {
- phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_IP;
- } else if (subsys == NETTL_SUBSYS_NS_LS_ICMP) {
- phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
- } else if (subsys == NETTL_SUBSYS_NS_LS_ICMPV6) {
- phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
- } else if (subsys == NETTL_SUBSYS_NS_LS_TELNET) {
- phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
- } else if( (subsys == NETTL_SUBSYS_HPPB_FDDI)
- || (subsys == NETTL_SUBSYS_EISA_FDDI)
- || (subsys == NETTL_SUBSYS_PCI_FDDI)
- || (subsys == NETTL_SUBSYS_HSC_FDDI) ) {
- phdr->pkt_encap = WTAP_ENCAP_NETTL_FDDI;
- } else if( (subsys == NETTL_SUBSYS_PCI_TR)
- || (subsys == NETTL_SUBSYS_TOKEN) ) {
- phdr->pkt_encap = WTAP_ENCAP_NETTL_TOKEN_RING;
- } else {
- phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
- }
-
- length = pntoh32(&rec_hdr.length);
- caplen = pntoh32(&rec_hdr.caplen);
-
- /* HPPB FDDI has different inbound vs outbound trace records */
- if (subsys == NETTL_SUBSYS_HPPB_FDDI) {
+ case NETTL_SUBSYS_NS_LS_IP :
+ case NETTL_SUBSYS_NS_LS_LOOPBACK :
+ case NETTL_SUBSYS_NS_LS_TCP :
+ case NETTL_SUBSYS_NS_LS_UDP :
+ case NETTL_SUBSYS_HP_APAPORT :
+ case NETTL_SUBSYS_HP_APALACP :
+ case NETTL_SUBSYS_NS_LS_IPV6 :
+ case NETTL_SUBSYS_NS_LS_ICMPV6 :
+ case NETTL_SUBSYS_NS_LS_ICMP :
+ case NETTL_SUBSYS_NS_LS_TELNET :
+ case NETTL_SUBSYS_NS_LS_SCTP :
+ if( (subsys == NETTL_SUBSYS_NS_LS_IP)
+ || (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK)
+ || (subsys == NETTL_SUBSYS_NS_LS_UDP)
+ || (subsys == NETTL_SUBSYS_NS_LS_TCP)
+ || (subsys == NETTL_SUBSYS_NS_LS_SCTP)
+ || (subsys == NETTL_SUBSYS_NS_LS_IPV6)) {
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_IP;
+ } else if (subsys == NETTL_SUBSYS_NS_LS_ICMP) {
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMP;
+ } else if (subsys == NETTL_SUBSYS_NS_LS_ICMPV6) {
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_ICMPV6;
+ } else if (subsys == NETTL_SUBSYS_NS_LS_TELNET) {
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_TELNET;
+ } else if( (subsys == NETTL_SUBSYS_HPPB_FDDI)
+ || (subsys == NETTL_SUBSYS_EISA_FDDI)
+ || (subsys == NETTL_SUBSYS_PCI_FDDI)
+ || (subsys == NETTL_SUBSYS_HSC_FDDI) ) {
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_FDDI;
+ } else if( (subsys == NETTL_SUBSYS_PCI_TR)
+ || (subsys == NETTL_SUBSYS_TOKEN) ) {
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_TOKEN_RING;
+ } else {
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
+ }
+
+ length = pntoh32(&rec_hdr.length);
+ caplen = pntoh32(&rec_hdr.caplen);
+
+ /* HPPB FDDI has different inbound vs outbound trace records */
+ if (subsys == NETTL_SUBSYS_HPPB_FDDI) {
if (pntoh32(&rec_hdr.kind) == NETTL_HDR_PDUIN) {
/* inbound is very strange...
there are an extra 3 bytes after the DSAP and SSAP
@@ -466,29 +463,29 @@ nettl_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
fddihack=TRUE;
padlen = 0;
} else {
- /* outbound appears to have variable padding */
- bytes_read = file_read(dummyc, 9, fh);
- if (bytes_read != 9) {
- *err = file_error(fh, err_info);
- if (*err == 0)
- *err = WTAP_ERR_SHORT_READ;
- return FALSE;
- }
+ /* outbound appears to have variable padding */
+ bytes_read = file_read(dummyc, 9, fh);
+ if (bytes_read != 9) {
+ *err = file_error(fh, err_info);
+ if (*err == 0)
+ *err = WTAP_ERR_SHORT_READ;
+ return FALSE;
+ }
/* padding is usually either a total 11 or 16 bytes??? */
- padlen = (int)dummyc[8];
- if (file_seek(fh, padlen, SEEK_CUR, err) == -1)
- return FALSE;
- padlen += 9;
- }
- } else if ( (subsys == NETTL_SUBSYS_PCI_FDDI)
- || (subsys == NETTL_SUBSYS_EISA_FDDI)
- || (subsys == NETTL_SUBSYS_HSC_FDDI) ) {
- /* other flavor FDDI cards have an extra 3 bytes of padding */
+ padlen = (int)dummyc[8];
+ if (file_seek(fh, padlen, SEEK_CUR, err) == -1)
+ return FALSE;
+ padlen += 9;
+ }
+ } else if ( (subsys == NETTL_SUBSYS_PCI_FDDI)
+ || (subsys == NETTL_SUBSYS_EISA_FDDI)
+ || (subsys == NETTL_SUBSYS_HSC_FDDI) ) {
+ /* other flavor FDDI cards have an extra 3 bytes of padding */
if (file_seek(fh, 3, SEEK_CUR, err) == -1)
return FALSE;
padlen = 3;
- } else if (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK) {
- /* LOOPBACK has an extra 26 bytes of padding */
+ } else if (subsys == NETTL_SUBSYS_NS_LS_LOOPBACK) {
+ /* LOOPBACK has an extra 26 bytes of padding */
if (file_seek(fh, 26, SEEK_CUR, err) == -1)
return FALSE;
padlen = 26;
@@ -506,72 +503,72 @@ nettl_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
if (file_seek(fh, 8, SEEK_CUR, err) == -1)
return FALSE;
padlen = 8;
- } else {
- padlen = 0;
- }
- break;
-
- case NETTL_SUBSYS_NS_LS_DRIVER :
- /* XXX we dont know how to identify this as ethernet frames, so
- we assumes everything is. We will crash and burn for anything else */
- /* for encapsulated 100baseT we do this */
- phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
- bytes_read = file_read(&drv_eth_hdr, NS_LS_DRV_ETH_HDR_LEN, fh);
- if (bytes_read != NS_LS_DRV_ETH_HDR_LEN) {
- *err = file_error(fh, err_info);
- if (*err == 0)
- *err = WTAP_ERR_SHORT_READ;
- return FALSE;
- }
-
- length = pntoh16(&drv_eth_hdr.length);
- caplen = pntoh16(&drv_eth_hdr.caplen);
- /*
- * XXX - is there a length field that would give the length
- * of this header, so that we don't have to check for
- * nettl files from HP-UX 11?
- *
- * And what are the extra two bytes?
- */
+ } else {
+ padlen = 0;
+ }
+ break;
+
+ case NETTL_SUBSYS_NS_LS_DRIVER :
+ /* XXX we dont know how to identify this as ethernet frames, so
+ we assumes everything is. We will crash and burn for anything else */
+ /* for encapsulated 100baseT we do this */
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
+ bytes_read = file_read(&drv_eth_hdr, NS_LS_DRV_ETH_HDR_LEN, fh);
+ if (bytes_read != NS_LS_DRV_ETH_HDR_LEN) {
+ *err = file_error(fh, err_info);
+ if (*err == 0)
+ *err = WTAP_ERR_SHORT_READ;
+ return FALSE;
+ }
+
+ length = pntoh16(&drv_eth_hdr.length);
+ caplen = pntoh16(&drv_eth_hdr.caplen);
+ /*
+ * XXX - is there a length field that would give the length
+ * of this header, so that we don't have to check for
+ * nettl files from HP-UX 11?
+ *
+ * And what are the extra two bytes?
+ */
if (nettl->is_hpux_11) {
if (file_seek(fh, 2, SEEK_CUR, err) == -1) return FALSE;
}
- padlen = 0;
- break;
-
- case NETTL_SUBSYS_SX25L2:
- case NETTL_SUBSYS_SX25L3:
- /*
- * XXX - is the 24-byte padding actually a header with
- * packet lengths, time stamps, etc., just as is the case
- * for NETTL_SUBSYS_NS_LS_DRIVER? It might be
- *
- * guint8 caplen[2];
- * guint8 length[2];
- * guint8 xxc[4];
- * guint8 sec[4];
- * guint8 usec[4];
- * guint8 xxd[4];
- *
- * or something such as that - if it has 4 bytes before that
- * (making it 24 bytes), it'd be like struct
- * nettlrec_ns_ls_drv_eth_hdr but with 2 more bytes at the end.
- *
- * And is "from_dce" at xxa[0] in the nettlrec_hdr structure?
- */
- phdr->pkt_encap = WTAP_ENCAP_NETTL_X25;
- length = pntoh32(&rec_hdr.length);
- caplen = pntoh32(&rec_hdr.caplen);
- padlen = 24; /* sizeof (struct nettlrec_sx25l2_hdr) - NETTL_REC_HDR_LEN + 4 */
- if (file_seek(fh, padlen, SEEK_CUR, err) == -1)
- return FALSE;
- break;
+ padlen = 0;
+ break;
+
+ case NETTL_SUBSYS_SX25L2:
+ case NETTL_SUBSYS_SX25L3:
+ /*
+ * XXX - is the 24-byte padding actually a header with
+ * packet lengths, time stamps, etc., just as is the case
+ * for NETTL_SUBSYS_NS_LS_DRIVER? It might be
+ *
+ * guint8 caplen[2];
+ * guint8 length[2];
+ * guint8 xxc[4];
+ * guint8 sec[4];
+ * guint8 usec[4];
+ * guint8 xxd[4];
+ *
+ * or something such as that - if it has 4 bytes before that
+ * (making it 24 bytes), it'd be like struct
+ * nettlrec_ns_ls_drv_eth_hdr but with 2 more bytes at the end.
+ *
+ * And is "from_dce" at xxa[0] in the nettlrec_hdr structure?
+ */
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_X25;
+ length = pntoh32(&rec_hdr.length);
+ caplen = pntoh32(&rec_hdr.caplen);
+ padlen = 24; /* sizeof (struct nettlrec_sx25l2_hdr) - NETTL_REC_HDR_LEN + 4 */
+ if (file_seek(fh, padlen, SEEK_CUR, err) == -1)
+ return FALSE;
+ break;
- default:
+ default:
/* We're going to assume it's ethernet if we don't recognize the
subsystem -- We'll probably spew junks and core if it isn't... */
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
- phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
+ phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
length = pntoh32(&rec_hdr.length);
caplen = pntoh32(&rec_hdr.caplen);
padlen = 0;
@@ -579,18 +576,18 @@ nettl_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
}
if (length < padlen) {
- *err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u",
- length, padlen);
- return FALSE;
+ *err = WTAP_ERR_BAD_FILE;
+ *err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u",
+ length, padlen);
+ return FALSE;
}
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
phdr->len = length - padlen;
if (caplen < padlen) {
- *err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u",
- caplen, padlen);
- return FALSE;
+ *err = WTAP_ERR_BAD_FILE;
+ *err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u",
+ caplen, padlen);
+ return FALSE;
}
datalen = caplen - padlen;
phdr->caplen = datalen;
@@ -604,14 +601,14 @@ nettl_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
pseudo_header->nettl.uid = pntoh16(&rec_hdr.uid);
if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
- /*
- * Probably a corrupt capture file; don't blow up trying
- * to allocate space for an immensely-large packet.
- */
- *err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u",
- phdr->caplen, WTAP_MAX_PACKET_SIZE);
- return FALSE;
+ /*
+ * Probably a corrupt capture file; don't blow up trying
+ * to allocate space for an immensely-large packet.
+ */
+ *err = WTAP_ERR_BAD_FILE;
+ *err_info = g_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u",
+ phdr->caplen, WTAP_MAX_PACKET_SIZE);
+ return FALSE;
}
/*
@@ -650,18 +647,18 @@ nettl_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
datalen -= bytes_read;
if (datalen == 0) {
/* There's nothing past the FC, dest, src, DSAP, SSAP, and 3 bytes to eat */
- return TRUE;
- }
+ return TRUE;
+ }
}
bytes_read = file_read(pd + 15, datalen, fh);
} else
bytes_read = file_read(pd, datalen, fh);
if (bytes_read != datalen) {
- *err = file_error(fh, err_info);
- if (*err == 0)
- *err = WTAP_ERR_SHORT_READ;
- return FALSE;
+ *err = file_error(fh, err_info);
+ if (*err == 0)
+ *err = WTAP_ERR_SHORT_READ;
+ return FALSE;
}
return TRUE;
}
@@ -700,7 +697,7 @@ int nettl_dump_can_write_encap(int encap)
/* Returns TRUE on success, FALSE on failure;
sets "*err" to an error code on failure */
-gboolean nettl_dump_open(wftap_dumper *wdh, int *err)
+gboolean nettl_dump_open(wtap_dumper *wdh, int *err)
{
struct nettl_file_hdr file_hdr;
@@ -718,7 +715,7 @@ gboolean nettl_dump_open(wftap_dumper *wdh, int *err)
file_hdr.os_v=0x55;
g_strlcpy(file_hdr.model,"9000/800",11);
file_hdr.unknown=g_htons(0x406);
- if (!wftap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
+ if (!wtap_dump_file_write(wdh, &file_hdr, sizeof file_hdr, err))
return FALSE;
wdh->bytes_dumped += sizeof(file_hdr);
@@ -727,7 +724,7 @@ gboolean nettl_dump_open(wftap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
-static gboolean nettl_dump(wftap_dumper *wdh,
+static gboolean nettl_dump(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -742,7 +739,7 @@ static gboolean nettl_dump(wftap_dumper *wdh,
}
memset(&rec_hdr,0,sizeof(rec_hdr));
- /* HP-UX 11.X header should be 68 bytes */
+ /* HP-UX 11.X header should be 68 bytes */
rec_hdr.hdr_len = g_htons(sizeof(rec_hdr) + 4);
rec_hdr.kind = g_htonl(NETTL_HDR_PDUIN);
rec_hdr.sec = g_htonl(phdr->ts.secs);
@@ -759,7 +756,7 @@ static gboolean nettl_dump(wftap_dumper *wdh,
/* account for pad bytes */
rec_hdr.caplen = g_htonl(phdr->caplen + 3);
rec_hdr.length = g_htonl(phdr->len + 3);
- /* fall through and fill the rest of the fields */
+ /* fall through and fill the rest of the fields */
case WTAP_ENCAP_NETTL_ETHERNET:
case WTAP_ENCAP_NETTL_TOKEN_RING:
case WTAP_ENCAP_NETTL_RAW_IP:
@@ -809,7 +806,7 @@ static gboolean nettl_dump(wftap_dumper *wdh,
return FALSE;
}
- if (!wftap_dump_file_write(wdh, &rec_hdr, sizeof(rec_hdr), err))
+ if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof(rec_hdr), err))
return FALSE;
wdh->bytes_dumped += sizeof(rec_hdr);
@@ -817,20 +814,20 @@ static gboolean nettl_dump(wftap_dumper *wdh,
* header format.
*/
memset(dummyc, 0, sizeof dummyc);
- if (!wftap_dump_file_write(wdh, dummyc, 4, err))
+ if (!wtap_dump_file_write(wdh, dummyc, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
if ((phdr->pkt_encap == WTAP_ENCAP_FDDI_BITSWAPPED) ||
(phdr->pkt_encap == WTAP_ENCAP_NETTL_FDDI)) {
/* add those weird 3 bytes of padding */
- if (!wftap_dump_file_write(wdh, dummyc, 3, err))
+ if (!wtap_dump_file_write(wdh, dummyc, 3, err))
return FALSE;
- wdh->bytes_dumped += 3;
+ wdh->bytes_dumped += 3;
}
/*
} else if (phdr->pkt_encap == WTAP_ENCAP_NETTL_X25) {
- if (!wftap_dump_file_write(wdh, dummyc, 24, err))
+ if (!wtap_dump_file_write(wdh, dummyc, 24, err))
return FALSE;
wdh->bytes_dumped += 24;
}
@@ -838,9 +835,9 @@ static gboolean nettl_dump(wftap_dumper *wdh,
/* write actual PDU data */
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
- wdh->bytes_dumped += phdr->caplen;
+ wdh->bytes_dumped += phdr->caplen;
return TRUE;
}
diff --git a/wiretap/nettl.h b/wiretap/nettl.h
index 0bf695d02f..e15fd3d1d4 100644
--- a/wiretap/nettl.h
+++ b/wiretap/nettl.h
@@ -128,8 +128,8 @@
#define NETTL_HDR_PDU_MASK 0x30000000
-int nettl_open(wftap *wfth, int *err, gchar **err_info);
-gboolean nettl_dump_open(wftap_dumper *wdh, int *err);
+int nettl_open(wtap *wth, int *err, gchar **err_info);
+gboolean nettl_dump_open(wtap_dumper *wdh, int *err);
int nettl_dump_can_write_encap(int encap);
#endif
diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c
index 1d88680768..38abfab2cd 100644
--- a/wiretap/network_instruments.c
+++ b/wiretap/network_instruments.c
@@ -20,7 +20,6 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -95,25 +94,25 @@ static void init_gmt_to_localtime_offset(void)
}
}
-static gboolean observer_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean observer_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
static int read_packet_header(FILE_T fh, union wtap_pseudo_header *pseudo_header,
packet_entry_header *packet_header, int *err, gchar **err_info);
-static gboolean process_packet_header(wftap *wfth,
+static gboolean process_packet_header(wtap *wth,
packet_entry_header *packet_header, struct wtap_pkthdr *phdr, int *err,
gchar **err_info);
static int read_packet_data(FILE_T fh, int offset_to_frame, int current_offset_from_packet_header,
Buffer *buf, int length, int *err, char **err_info);
-static gboolean skip_to_next_packet(wftap *wfth, int offset_to_next_packet,
+static gboolean skip_to_next_packet(wtap *wth, int offset_to_next_packet,
int current_offset_from_packet_header, int *err, char **err_info);
-static gboolean observer_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static gboolean observer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
static gint observer_to_wtap_encap(int observer_encap);
static gint wtap_to_observer_encap(int wtap_encap);
-int network_instruments_open(wftap *wfth, int *err, gchar **err_info)
+int network_instruments_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
int offset;
@@ -129,9 +128,9 @@ int network_instruments_open(wftap *wfth, int *err, gchar **err_info)
offset = 0;
/* read in the buffer file header */
- bytes_read = file_read(&file_header, sizeof file_header, wfth->fh);
+ bytes_read = file_read(&file_header, sizeof file_header, wth->fh);
if (bytes_read != sizeof file_header) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -147,7 +146,7 @@ int network_instruments_open(wftap *wfth, int *err, gchar **err_info)
/* initialize the private state */
private_state = (observer_dump_private_state *) g_malloc(sizeof(observer_dump_private_state));
private_state->time_format = TIME_INFO_LOCAL;
- wfth->priv = (void *) private_state;
+ wth->priv = (void *) private_state;
/* get the location of the first packet */
/* v15 and newer uses high byte offset, in previous versions it will be 0 */
@@ -160,9 +159,9 @@ int network_instruments_open(wftap *wfth, int *err, gchar **err_info)
break;
/* read the TLV header */
- bytes_read = file_read(&tlvh, sizeof tlvh, wfth->fh);
+ bytes_read = file_read(&tlvh, sizeof tlvh, wth->fh);
if (bytes_read != sizeof tlvh) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -180,9 +179,9 @@ int network_instruments_open(wftap *wfth, int *err, gchar **err_info)
/* process (or skip over) the current TLV */
switch (tlvh.type) {
case INFORMATION_TYPE_TIME_INFO:
- bytes_read = file_read(&private_state->time_format, sizeof private_state->time_format, wfth->fh);
+ bytes_read = file_read(&private_state->time_format, sizeof private_state->time_format, wth->fh);
if (bytes_read != sizeof private_state->time_format) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -193,7 +192,7 @@ int network_instruments_open(wftap *wfth, int *err, gchar **err_info)
default:
seek_increment = tlvh.length - (int)sizeof tlvh;
if (seek_increment > 0) {
- if (file_seek(wfth->fh, seek_increment, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, seek_increment, SEEK_CUR, err) == -1)
return -1;
}
offset += seek_increment;
@@ -209,14 +208,14 @@ int network_instruments_open(wftap *wfth, int *err, gchar **err_info)
}
seek_increment = header_offset - offset;
if (seek_increment > 0) {
- if (file_seek(wfth->fh, seek_increment, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, seek_increment, SEEK_CUR, err) == -1)
return -1;
}
/* pull off the packet header */
- bytes_read = file_read(&packet_header, sizeof packet_header, wfth->fh);
+ bytes_read = file_read(&packet_header, sizeof packet_header, wth->fh);
if (bytes_read != sizeof packet_header) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -236,21 +235,21 @@ int network_instruments_open(wftap *wfth, int *err, gchar **err_info)
*err_info = g_strdup_printf("Observer: network type %u unknown or unsupported", packet_header.network_type);
return -1;
}
- wfth->file_encap = observer_to_wtap_encap(packet_header.network_type);
+ wth->file_encap = observer_to_wtap_encap(packet_header.network_type);
/* set up the rest of the capture parameters */
private_state->packet_count = 0;
- private_state->network_type = wtap_to_observer_encap(wfth->file_encap);
- wfth->subtype_read = observer_read;
- wfth->subtype_seek_read = observer_seek_read;
- wfth->subtype_close = NULL;
- wfth->subtype_sequential_close = NULL;
- wfth->snapshot_length = 0; /* not available in header */
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETWORK_INSTRUMENTS;
+ private_state->network_type = wtap_to_observer_encap(wth->file_encap);
+ wth->subtype_read = observer_read;
+ wth->subtype_seek_read = observer_seek_read;
+ wth->subtype_close = NULL;
+ wth->subtype_sequential_close = NULL;
+ wth->snapshot_length = 0; /* not available in header */
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETWORK_INSTRUMENTS;
/* reset the pointer to the first packet */
- if (file_seek(wfth->fh, header_offset, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, header_offset, SEEK_SET, err) == -1)
return -1;
init_gmt_to_localtime_offset();
@@ -259,20 +258,19 @@ int network_instruments_open(wftap *wfth, int *err, gchar **err_info)
}
/* Reads the next packet. */
-static gboolean observer_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
int header_bytes_consumed;
int data_bytes_consumed;
packet_entry_header packet_header;
- wtap* wth = (wtap*)wfth->tap_specific_data;
/* skip records other than data records */
for (;;) {
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* process the packet header, including TLVs */
- header_bytes_consumed = read_packet_header(wfth->fh, &wth->phdr.pseudo_header, &packet_header, err,
+ header_bytes_consumed = read_packet_header(wth->fh, &wth->phdr.pseudo_header, &packet_header, err,
err_info);
if (header_bytes_consumed <= 0)
return FALSE; /* EOF or error */
@@ -281,25 +279,25 @@ static gboolean observer_read(wftap *wfth, int *err, gchar **err_info,
break;
/* skip to next packet */
- if (!skip_to_next_packet(wfth, packet_header.offset_to_next_packet,
+ if (!skip_to_next_packet(wth, packet_header.offset_to_next_packet,
header_bytes_consumed, err, err_info)) {
return FALSE; /* EOF or error */
}
}
- if (!process_packet_header(wfth, &packet_header, &wth->phdr, err, err_info))
+ if (!process_packet_header(wth, &packet_header, &wth->phdr, err, err_info))
return FALSE;
/* read the frame data */
- data_bytes_consumed = read_packet_data(wfth->fh, packet_header.offset_to_frame,
- header_bytes_consumed, wfth->frame_buffer,
+ data_bytes_consumed = read_packet_data(wth->fh, packet_header.offset_to_frame,
+ header_bytes_consumed, wth->frame_buffer,
wth->phdr.caplen, err, err_info);
if (data_bytes_consumed < 0) {
return FALSE;
}
/* skip over any extra bytes following the frame data */
- if (!skip_to_next_packet(wfth, packet_header.offset_to_next_packet,
+ if (!skip_to_next_packet(wth, packet_header.offset_to_next_packet,
header_bytes_consumed + data_bytes_consumed, err, err_info)) {
return FALSE;
}
@@ -308,29 +306,28 @@ static gboolean observer_read(wftap *wfth, int *err, gchar **err_info,
}
/* Reads a packet at an offset. */
-static gboolean observer_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
packet_entry_header packet_header;
int offset;
int data_bytes_consumed;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/* process the packet header, including TLVs */
- offset = read_packet_header(wfth->random_fh, pseudo_header, &packet_header, err,
+ offset = read_packet_header(wth->random_fh, pseudo_header, &packet_header, err,
err_info);
if (offset <= 0)
return FALSE; /* EOF or error */
- if (!process_packet_header(wfth, &packet_header, phdr, err, err_info))
+ if (!process_packet_header(wth, &packet_header, phdr, err, err_info))
return FALSE;
/* read the frame data */
- data_bytes_consumed = read_packet_data(wfth->random_fh, packet_header.offset_to_frame,
+ data_bytes_consumed = read_packet_data(wth->random_fh, packet_header.offset_to_frame,
offset, buf, phdr->caplen, err, err_info);
if (data_bytes_consumed < 0) {
return FALSE;
@@ -442,13 +439,13 @@ read_packet_header(FILE_T fh, union wtap_pseudo_header *pseudo_header,
}
static gboolean
-process_packet_header(wftap *wfth, packet_entry_header *packet_header,
+process_packet_header(wtap *wth, packet_entry_header *packet_header,
struct wtap_pkthdr *phdr, int *err, gchar **err_info)
{
/* set the wiretap packet header fields */
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
phdr->pkt_encap = observer_to_wtap_encap(packet_header->network_type);
- if(wfth->file_encap == WTAP_ENCAP_FIBRE_CHANNEL_FC2_WITH_FRAME_DELIMS) {
+ if(wth->file_encap == WTAP_ENCAP_FIBRE_CHANNEL_FC2_WITH_FRAME_DELIMS) {
phdr->len = packet_header->network_size;
phdr->caplen = packet_header->captured_size;
} else {
@@ -489,7 +486,7 @@ process_packet_header(wftap *wfth, packet_entry_header *packet_header,
/* adjust to local time, if necessary, also accounting for DST if the frame
was captured while it was in effect */
- if (((observer_dump_private_state*)wfth->priv)->time_format == TIME_INFO_LOCAL)
+ if (((observer_dump_private_state*)wth->priv)->time_format == TIME_INFO_LOCAL)
{
struct tm daylight_tm;
struct tm standard_tm;
@@ -510,7 +507,7 @@ process_packet_header(wftap *wfth, packet_entry_header *packet_header,
}
/* update the pseudo header */
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_ETHERNET:
/* There is no FCS in the frame */
phdr->pseudo_header.eth.fcs_len = 0;
@@ -559,7 +556,7 @@ read_packet_data(FILE_T fh, int offset_to_frame, int current_offset_from_packet_
}
static gboolean
-skip_to_next_packet(wftap *wfth, int offset_to_next_packet, int current_offset_from_packet_header, int *err,
+skip_to_next_packet(wtap *wth, int offset_to_next_packet, int current_offset_from_packet_header, int *err,
char **err_info)
{
int seek_increment;
@@ -575,7 +572,7 @@ skip_to_next_packet(wftap *wfth, int offset_to_next_packet, int current_offset_f
/* skip to the next packet header */
seek_increment = offset_to_next_packet - current_offset_from_packet_header;
if (seek_increment > 0) {
- if (file_seek(wfth->fh, seek_increment, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, seek_increment, SEEK_CUR, err) == -1)
return FALSE;
}
@@ -598,7 +595,7 @@ int network_instruments_dump_can_write_encap(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure. */
-gboolean network_instruments_dump_open(wftap_dumper *wdh, int *err)
+gboolean network_instruments_dump_open(wtap_dumper *wdh, int *err)
{
observer_dump_private_state * private_state = NULL;
capture_file_header file_header;
@@ -655,7 +652,7 @@ gboolean network_instruments_dump_open(wftap_dumper *wdh, int *err)
/* write the file header, swapping any multibyte fields first */
CAPTURE_FILE_HEADER_TO_LE_IN_PLACE(file_header);
- if (!wftap_dump_file_write(wdh, &file_header, sizeof(file_header), err)) {
+ if (!wtap_dump_file_write(wdh, &file_header, sizeof(file_header), err)) {
return FALSE;
}
wdh->bytes_dumped += sizeof(file_header);
@@ -663,12 +660,12 @@ gboolean network_instruments_dump_open(wftap_dumper *wdh, int *err)
/* write the comment TLV */
{
TLV_HEADER_TO_LE_IN_PLACE(comment_header);
- if (!wftap_dump_file_write(wdh, &comment_header, sizeof(comment_header), err)) {
+ if (!wtap_dump_file_write(wdh, &comment_header, sizeof(comment_header), err)) {
return FALSE;
}
wdh->bytes_dumped += sizeof(comment_header);
- if (!wftap_dump_file_write(wdh, &comment, comment_length, err)) {
+ if (!wtap_dump_file_write(wdh, &comment, comment_length, err)) {
return FALSE;
}
wdh->bytes_dumped += comment_length;
@@ -677,7 +674,7 @@ gboolean network_instruments_dump_open(wftap_dumper *wdh, int *err)
/* write the time info TLV */
{
TLV_TIME_INFO_TO_LE_IN_PLACE(time_header);
- if (!wftap_dump_file_write(wdh, &time_header, sizeof(time_header), err)) {
+ if (!wtap_dump_file_write(wdh, &time_header, sizeof(time_header), err)) {
return FALSE;
}
wdh->bytes_dumped += sizeof(time_header);
@@ -690,7 +687,7 @@ gboolean network_instruments_dump_open(wftap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
-static gboolean observer_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static gboolean observer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd,
int *err)
{
@@ -740,13 +737,13 @@ static gboolean observer_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
/* write the packet header */
PACKET_ENTRY_HEADER_TO_LE_IN_PLACE(packet_header);
- if (!wftap_dump_file_write(wdh, &packet_header, sizeof(packet_header), err)) {
+ if (!wtap_dump_file_write(wdh, &packet_header, sizeof(packet_header), err)) {
return FALSE;
}
wdh->bytes_dumped += sizeof(packet_header);
/* write the packet data */
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err)) {
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err)) {
return FALSE;
}
wdh->bytes_dumped += phdr->caplen;
diff --git a/wiretap/network_instruments.h b/wiretap/network_instruments.h
index 1084ef5728..1d6065a172 100644
--- a/wiretap/network_instruments.h
+++ b/wiretap/network_instruments.h
@@ -21,9 +21,9 @@
#include <glib.h>
#include <wtap.h>
-int network_instruments_open(wftap *wfth, int *err, gchar **err_info);
+int network_instruments_open(wtap *wth, int *err, gchar **err_info);
int network_instruments_dump_can_write_encap(int encap);
-gboolean network_instruments_dump_open(wftap_dumper *wdh, int *err);
+gboolean network_instruments_dump_open(wtap_dumper *wdh, int *err);
/*
* In v15 the high_byte was added to allow a larger offset This was done by
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 0a75a63dd8..e6dd704bb3 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -22,7 +22,6 @@
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "netxray.h"
@@ -403,25 +402,25 @@ typedef struct {
guint isdn_type; /* 1 = E1 PRI, 2 = T1 PRI, 3 = BRI */
} netxray_t;
-static gboolean netxray_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean netxray_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean netxray_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
-static int netxray_process_rec_header(wftap *wfth, FILE_T fh,
+static gboolean netxray_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static int netxray_process_rec_header(wtap *wth, FILE_T fh,
struct wtap_pkthdr *phdr, int *err, gchar **err_info);
-static void netxray_guess_atm_type(wftap *wfth, struct wtap_pkthdr *phdr,
+static void netxray_guess_atm_type(wtap *wth, struct wtap_pkthdr *phdr,
Buffer *buf);
-static gboolean netxray_dump_1_1(wftap_dumper *wdh,
+static gboolean netxray_dump_1_1(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
-static gboolean netxray_dump_close_1_1(wftap_dumper *wdh, int *err);
-static gboolean netxray_dump_2_0(wftap_dumper *wdh,
+static gboolean netxray_dump_close_1_1(wtap_dumper *wdh, int *err);
+static gboolean netxray_dump_2_0(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
-static gboolean netxray_dump_close_2_0(wftap_dumper *wdh, int *err);
+static gboolean netxray_dump_close_2_0(wtap_dumper *wdh, int *err);
int
-netxray_open(wftap *wfth, int *err, gchar **err_info)
+netxray_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
char magic[MAGIC_SIZE];
@@ -463,9 +462,9 @@ netxray_open(wftap *wfth, int *err, gchar **err_info)
/* Read in the string that should be at the start of a NetXRay
* file */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(magic, MAGIC_SIZE, wfth->fh);
+ bytes_read = file_read(magic, MAGIC_SIZE, wth->fh);
if (bytes_read != MAGIC_SIZE) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -481,9 +480,9 @@ netxray_open(wftap *wfth, int *err, gchar **err_info)
/* Read the rest of the header. */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&hdr, sizeof hdr, wfth->fh);
+ bytes_read = file_read(&hdr, sizeof hdr, wth->fh);
if (bytes_read != sizeof hdr) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -577,12 +576,12 @@ netxray_open(wftap *wfth, int *err, gchar **err_info)
case WTAP_FILE_TYPE_SUBTYPE_NETXRAY_OLD:
ticks_per_sec = 1000.0;
- wfth->tsprecision = WTAP_FILE_TSPREC_MSEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
break;
case WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_0:
ticks_per_sec = 1000.0;
- wfth->tsprecision = WTAP_FILE_TSPREC_MSEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_MSEC;
break;
case WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_1:
@@ -593,7 +592,7 @@ netxray_open(wftap *wfth, int *err, gchar **err_info)
* and older versions of Windows Sniffer.
*/
ticks_per_sec = 1000000.0;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
case WTAP_FILE_TYPE_SUBTYPE_NETXRAY_2_00x:
@@ -750,9 +749,9 @@ netxray_open(wftap *wfth, int *err, gchar **err_info)
* XXX - Seems reasonable to use nanosecs only if TPS >= 10M
*/
if (ticks_per_sec >= 1e7)
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
else
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
break;
default:
@@ -857,13 +856,13 @@ netxray_open(wftap *wfth, int *err, gchar **err_info)
file_encap = netxray_encap[network_type];
/* This is a netxray file */
- wfth->file_type_subtype = file_type;
+ wth->file_type_subtype = file_type;
netxray = (netxray_t *)g_malloc(sizeof(netxray_t));
- wfth->priv = (void *)netxray;
- wfth->subtype_read = netxray_read;
- wfth->subtype_seek_read = netxray_seek_read;
- wfth->file_encap = file_encap;
- wfth->snapshot_length = 0; /* not available in header */
+ wth->priv = (void *)netxray;
+ wth->subtype_read = netxray_read;
+ wth->subtype_seek_read = netxray_seek_read;
+ wth->file_encap = file_encap;
+ wth->snapshot_length = 0; /* not available in header */
netxray->start_time = pletoh32(&hdr.start_time);
netxray->ticks_per_sec = ticks_per_sec;
netxray->start_timestamp = start_timestamp;
@@ -982,7 +981,7 @@ netxray_open(wftap *wfth, int *err, gchar **err_info)
netxray->end_offset = pletoh32(&hdr.end_offset);
/* Seek to the beginning of the data records. */
- if (file_seek(wfth->fh, netxray->start_offset, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, netxray->start_offset, SEEK_SET, err) == -1) {
return -1;
}
@@ -991,11 +990,10 @@ netxray_open(wftap *wfth, int *err, gchar **err_info)
/* Read the next packet */
static gboolean
-netxray_read(wftap *wfth, int *err, gchar **err_info,
+netxray_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- netxray_t *netxray = (netxray_t *)wfth->priv;
+ netxray_t *netxray = (netxray_t *)wth->priv;
int padding;
reread:
@@ -1003,7 +1001,7 @@ reread:
* Return the offset of the record header, so we can reread it
* if we go back to this frame.
*/
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* Have we reached the end of the packet data? */
if (*data_offset == netxray->end_offset) {
@@ -1013,7 +1011,7 @@ reread:
}
/* Read and process record header. */
- padding = netxray_process_rec_header(wfth, wfth->fh, &wth->phdr, err,
+ padding = netxray_process_rec_header(wth, wth->fh, &wth->phdr, err,
err_info);
if (padding < 0) {
/*
@@ -1054,7 +1052,7 @@ reread:
if (!netxray->wrapped) {
/* Yes. Remember that we did. */
netxray->wrapped = TRUE;
- if (file_seek(wfth->fh, CAPTUREFILE_HEADER_SIZE,
+ if (file_seek(wth->fh, CAPTUREFILE_HEADER_SIZE,
SEEK_SET, err) == -1)
return FALSE;
goto reread;
@@ -1067,14 +1065,14 @@ reread:
/*
* Read the packet data.
*/
- if (!wtap_read_packet_bytes(wfth->fh, wfth->frame_buffer,
+ if (!wtap_read_packet_bytes(wth->fh, wth->frame_buffer,
wth->phdr.caplen, err, err_info))
return FALSE;
/*
* If there's extra stuff at the end of the record, skip it.
*/
- if (file_seek(wfth->fh, padding, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, padding, SEEK_CUR, err) == -1)
return FALSE;
/*
@@ -1082,20 +1080,19 @@ reread:
* from the packet header to determine its type or subtype,
* attempt to guess them from the packet data.
*/
- netxray_guess_atm_type(wfth, &wth->phdr, wfth->frame_buffer);
+ netxray_guess_atm_type(wth, &wth->phdr, wth->frame_buffer);
return TRUE;
}
static gboolean
-netxray_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+netxray_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (netxray_process_rec_header(wfth, wfth->random_fh, phdr, err,
+ if (netxray_process_rec_header(wth, wth->random_fh, phdr, err,
err_info) == -1) {
if (*err == 0) {
/*
@@ -1111,7 +1108,7 @@ netxray_seek_read(wftap *wfth, gint64 seek_off,
/*
* Read the packet data.
*/
- if (!wtap_read_packet_bytes(wfth->random_fh, buf, phdr->caplen, err,
+ if (!wtap_read_packet_bytes(wth->random_fh, buf, phdr->caplen, err,
err_info))
return FALSE;
@@ -1120,15 +1117,15 @@ netxray_seek_read(wftap *wfth, gint64 seek_off,
* from the packet header to determine its type or subtype,
* attempt to guess them from the packet data.
*/
- netxray_guess_atm_type(wfth, phdr, buf);
+ netxray_guess_atm_type(wth, phdr, buf);
return TRUE;
}
static int
-netxray_process_rec_header(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
+netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
int *err, gchar **err_info)
{
- netxray_t *netxray = (netxray_t *)wfth->priv;
+ netxray_t *netxray = (netxray_t *)wth->priv;
union netxrayrec_hdr hdr;
int bytes_read;
int hdr_size = 0;
@@ -1154,7 +1151,7 @@ netxray_process_rec_header(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
errno = WTAP_ERR_CANT_READ;
bytes_read = file_read((void *)&hdr, hdr_size, fh);
if (bytes_read != hdr_size) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0)
return -1;
if (bytes_read != 0) {
@@ -1176,7 +1173,7 @@ netxray_process_rec_header(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
switch (netxray->version_major) {
case 1:
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_ETHERNET:
/*
@@ -1196,7 +1193,7 @@ netxray_process_rec_header(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
break;
case 2:
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_ETHERNET:
/*
@@ -1631,11 +1628,11 @@ netxray_process_rec_header(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
}
static void
-netxray_guess_atm_type(wftap *wfth, struct wtap_pkthdr *phdr, Buffer *buf)
+netxray_guess_atm_type(wtap *wth, struct wtap_pkthdr *phdr, Buffer *buf)
{
const guint8 *pd;
- if (wfth->file_encap == WTAP_ENCAP_ATM_PDUS_UNTRUNCATED &&
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS_UNTRUNCATED &&
!(phdr->pseudo_header.atm.flags & ATM_REASSEMBLY_ERROR)) {
if (phdr->pseudo_header.atm.aal == AAL_UNKNOWN) {
/*
@@ -1704,7 +1701,7 @@ netxray_dump_can_write_encap_1_1(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */
gboolean
-netxray_dump_open_1_1(wftap_dumper *wdh, int *err)
+netxray_dump_open_1_1(wtap_dumper *wdh, int *err)
{
netxray_dump_t *netxray;
@@ -1715,7 +1712,7 @@ netxray_dump_open_1_1(wftap_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 (wftap_dump_file_seek(wdh, CAPTUREFILE_HEADER_SIZE, SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, CAPTUREFILE_HEADER_SIZE, SEEK_SET, err) == -1)
return FALSE;
wdh->bytes_dumped += CAPTUREFILE_HEADER_SIZE;
@@ -1732,7 +1729,7 @@ netxray_dump_open_1_1(wftap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean
-netxray_dump_1_1(wftap_dumper *wdh,
+netxray_dump_1_1(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -1774,12 +1771,12 @@ netxray_dump_1_1(wftap_dumper *wdh,
rec_hdr.orig_len = GUINT16_TO_LE(phdr->len);
rec_hdr.incl_len = GUINT16_TO_LE(phdr->caplen);
- if (!wftap_dump_file_write(wdh, &rec_hdr, sizeof(rec_hdr), err))
+ if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof(rec_hdr), err))
return FALSE;
wdh->bytes_dumped += sizeof(rec_hdr);
/* write the packet data */
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
wdh->bytes_dumped += phdr->caplen;
@@ -1791,22 +1788,22 @@ netxray_dump_1_1(wftap_dumper *wdh,
/* Finish writing to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean
-netxray_dump_close_1_1(wftap_dumper *wdh, int *err)
+netxray_dump_close_1_1(wtap_dumper *wdh, int *err)
{
char hdr_buf[CAPTUREFILE_HEADER_SIZE - sizeof(netxray_magic)];
netxray_dump_t *netxray = (netxray_dump_t *)wdh->priv;
gint64 filelen;
struct netxray_hdr file_hdr;
- if (-1 == (filelen = wftap_dump_file_tell(wdh, err)))
+ if (-1 == (filelen = wtap_dump_file_tell(wdh, err)))
return FALSE;
/* Go back to beginning */
- if (wftap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
return FALSE;
/* Rewrite the file header. */
- if (!wftap_dump_file_write(wdh, netxray_magic, sizeof netxray_magic, err))
+ if (!wtap_dump_file_write(wdh, netxray_magic, sizeof netxray_magic, err))
return FALSE;
/* "sniffer" version ? */
@@ -1823,7 +1820,7 @@ netxray_dump_close_1_1(wftap_dumper *wdh, int *err)
memset(hdr_buf, '\0', sizeof hdr_buf);
memcpy(hdr_buf, &file_hdr, sizeof(file_hdr));
- if (!wftap_dump_file_write(wdh, hdr_buf, sizeof hdr_buf, err))
+ if (!wtap_dump_file_write(wdh, hdr_buf, sizeof hdr_buf, err))
return FALSE;
return TRUE;
@@ -1875,7 +1872,7 @@ netxray_dump_can_write_encap_2_0(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */
gboolean
-netxray_dump_open_2_0(wftap_dumper *wdh, int *err)
+netxray_dump_open_2_0(wtap_dumper *wdh, int *err)
{
netxray_dump_t *netxray;
@@ -1886,7 +1883,7 @@ netxray_dump_open_2_0(wftap_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 (wftap_dump_file_seek(wdh, CAPTUREFILE_HEADER_SIZE, SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, CAPTUREFILE_HEADER_SIZE, SEEK_SET, err) == -1)
return FALSE;
wdh->bytes_dumped += CAPTUREFILE_HEADER_SIZE;
@@ -1904,7 +1901,7 @@ netxray_dump_open_2_0(wftap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean
-netxray_dump_2_0(wftap_dumper *wdh,
+netxray_dump_2_0(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -1964,12 +1961,12 @@ netxray_dump_2_0(wftap_dumper *wdh,
break;
}
- if (!wftap_dump_file_write(wdh, &rec_hdr, sizeof(rec_hdr), err))
+ if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof(rec_hdr), err))
return FALSE;
wdh->bytes_dumped += sizeof(rec_hdr);
/* write the packet data */
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
wdh->bytes_dumped += phdr->caplen;
@@ -1981,22 +1978,22 @@ netxray_dump_2_0(wftap_dumper *wdh,
/* Finish writing to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean
-netxray_dump_close_2_0(wftap_dumper *wdh, int *err)
+netxray_dump_close_2_0(wtap_dumper *wdh, int *err)
{
char hdr_buf[CAPTUREFILE_HEADER_SIZE - sizeof(netxray_magic)];
netxray_dump_t *netxray = (netxray_dump_t *)wdh->priv;
gint64 filelen;
struct netxray_hdr file_hdr;
- if (-1 == (filelen = wftap_dump_file_tell(wdh, err)))
+ if (-1 == (filelen = wtap_dump_file_tell(wdh, err)))
return FALSE;
/* Go back to beginning */
- if (wftap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
+ if (wtap_dump_file_seek(wdh, 0, SEEK_SET, err) == -1)
return FALSE;
/* Rewrite the file header. */
- if (!wftap_dump_file_write(wdh, netxray_magic, sizeof netxray_magic, err))
+ if (!wtap_dump_file_write(wdh, netxray_magic, sizeof netxray_magic, err))
return FALSE;
/* "sniffer" version ? */
@@ -2036,7 +2033,7 @@ netxray_dump_close_2_0(wftap_dumper *wdh, int *err)
memset(hdr_buf, '\0', sizeof hdr_buf);
memcpy(hdr_buf, &file_hdr, sizeof(file_hdr));
- if (!wftap_dump_file_write(wdh, hdr_buf, sizeof hdr_buf, err))
+ if (!wtap_dump_file_write(wdh, hdr_buf, sizeof hdr_buf, err))
return FALSE;
return TRUE;
diff --git a/wiretap/netxray.h b/wiretap/netxray.h
index 4154fa3a64..df28c774e2 100644
--- a/wiretap/netxray.h
+++ b/wiretap/netxray.h
@@ -24,10 +24,10 @@
#include <glib.h>
#include <wtap.h>
-int netxray_open(wftap *wfth, int *err, gchar **err_info);
+int netxray_open(wtap *wth, int *err, gchar **err_info);
int netxray_dump_can_write_encap_1_1(int encap);
-gboolean netxray_dump_open_1_1(wftap_dumper *wdh, int *err);
+gboolean netxray_dump_open_1_1(wtap_dumper *wdh, int *err);
int netxray_dump_can_write_encap_2_0(int encap);
-gboolean netxray_dump_open_2_0(wftap_dumper *wdh, int *err);
+gboolean netxray_dump_open_2_0(wtap_dumper *wdh, int *err);
#endif
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index f8d04367be..8138a31f44 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -56,7 +56,6 @@
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -504,46 +503,46 @@ typedef struct {
#define DOS_DAY_SHIFT 0
#define DOS_DAY_MASK (0x1F<<DOS_DAY_SHIFT)
-static int process_header_records(wftap *wfth, int *err, gchar **err_info,
+static int process_header_records(wtap *wth, int *err, gchar **err_info,
gint16 maj_vers, guint8 network);
-static int process_rec_header2_v2(wftap *wfth, unsigned char *buffer,
+static int process_rec_header2_v2(wtap *wth, unsigned char *buffer,
guint16 length, int *err, gchar **err_info);
-static int process_rec_header2_v145(wftap *wfth, unsigned char *buffer,
+static int process_rec_header2_v145(wtap *wth, unsigned char *buffer,
guint16 length, gint16 maj_vers, int *err, gchar **err_info);
-static gboolean ngsniffer_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean ngsniffer_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean ngsniffer_seek_read(wftap *wtfh, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
-static int ngsniffer_process_record(wftap *wfth, gboolean is_random,
+static gboolean ngsniffer_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static int ngsniffer_process_record(wtap *wth, gboolean is_random,
guint *padding, struct wtap_pkthdr *phdr, Buffer *buf, int *err,
gchar **err_info);
-static void set_pseudo_header_frame2(wftap *wfth,
+static void set_pseudo_header_frame2(wtap *wth,
union wtap_pseudo_header *pseudo_header, struct frame2_rec *frame2);
static void set_pseudo_header_frame4(union wtap_pseudo_header *pseudo_header,
struct frame4_rec *frame4);
-static void set_pseudo_header_frame6(wftap *wfth,
+static void set_pseudo_header_frame6(wtap *wth,
union wtap_pseudo_header *pseudo_header, struct frame6_rec *frame6);
static int infer_pkt_encap(const guint8 *pd, int len);
static int fix_pseudo_header(int encap, Buffer *buf, int len,
union wtap_pseudo_header *pseudo_header);
-static void ngsniffer_sequential_close(wftap *wfth);
-static void ngsniffer_close(wftap *wfth);
-static gboolean ngsniffer_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+static void ngsniffer_sequential_close(wtap *wth);
+static void ngsniffer_close(wtap *wth);
+static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err);
-static gboolean ngsniffer_dump_close(wftap_dumper *wdh, int *err);
+static gboolean ngsniffer_dump_close(wtap_dumper *wdh, int *err);
static int SnifferDecompress( unsigned char * inbuf, size_t inlen,
unsigned char * outbuf, size_t outlen, int *err );
-static gint64 ng_file_read(void *buffer, unsigned int nbytes, wftap *wfth,
+static gint64 ng_file_read(void *buffer, unsigned int nbytes, wtap *wth,
gboolean is_random, int *err, gchar **err_info);
static int read_blob(FILE_T infile, ngsniffer_comp_stream_t *comp_stream,
int *err, gchar **err_info);
-static gboolean ng_file_skip_seq(wftap *wfth, gint64 delta, int *err,
+static gboolean ng_file_skip_seq(wtap *wth, gint64 delta, int *err,
gchar **err_info);
-static gboolean ng_file_seek_rand(wftap *wfth, gint64 offset, int *err,
+static gboolean ng_file_seek_rand(wtap *wth, gint64 offset, int *err,
gchar **err_info);
int
-ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
+ngsniffer_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
char magic[sizeof ngsniffer_magic];
@@ -577,9 +576,9 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
/* Read in the string that should be at the start of a Sniffer file */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(magic, sizeof magic, wfth->fh);
+ bytes_read = file_read(magic, sizeof magic, wth->fh);
if (bytes_read != sizeof magic) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -594,16 +593,16 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
* record.
*/
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(record_type, 2, wfth->fh);
+ bytes_read = file_read(record_type, 2, wth->fh);
if (bytes_read != 2) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
}
- bytes_read = file_read(record_length, 4, wfth->fh);
+ bytes_read = file_read(record_length, 4, wth->fh);
if (bytes_read != 4) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -618,9 +617,9 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
}
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&version, sizeof version, wfth->fh);
+ bytes_read = file_read(&version, sizeof version, wth->fh);
if (bytes_read != sizeof version) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -644,15 +643,15 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
/* compressed or uncompressed Sniffer file? */
if (version.format != 1) {
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_COMPRESSED;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_COMPRESSED;
} else {
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED;
}
/* Set encap type before reading header records because the
* header record may change encap type.
*/
- wfth->file_encap = sniffer_encap[version.network];
+ wth->file_encap = sniffer_encap[version.network];
/*
* We don't know how to handle the remaining header record types,
@@ -668,12 +667,12 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
* the DOS Sniffer understands?
*/
maj_vers = pletoh16(&version.maj_vers);
- if (process_header_records(wfth, err, err_info, maj_vers,
+ if (process_header_records(wth, err, err_info, maj_vers,
version.network) < 0)
return -1;
if ((version.network == NETWORK_SYNCHRO ||
version.network == NETWORK_ASYNC) &&
- wfth->file_encap == WTAP_ENCAP_PER_PACKET) {
+ wth->file_encap == WTAP_ENCAP_PER_PACKET) {
/*
* Well, we haven't determined the internetwork analyzer
* subtype yet...
@@ -689,7 +688,7 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
case 1:
case 2:
- wfth->file_encap = WTAP_ENCAP_ISDN;
+ wth->file_encap = WTAP_ENCAP_ISDN;
break;
}
break;
@@ -702,12 +701,12 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
* one we've seen is a Frame Relay capture,
* so mark it as Frame Relay for now.
*/
- wfth->file_encap = WTAP_ENCAP_FRELAY_WITH_PHDR;
+ wth->file_encap = WTAP_ENCAP_FRELAY_WITH_PHDR;
break;
}
}
- current_offset = file_tell(wfth->fh);
+ current_offset = file_tell(wth->fh);
/*
* Now, if we have a random stream open, position it to the same
@@ -718,14 +717,14 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
* or REC_EOF after this? If not, we can get rid of the loop in
* "ngsniffer_read()".
*/
- if (wfth->random_fh != NULL) {
- if (file_seek(wfth->random_fh, current_offset, SEEK_SET, err) == -1)
+ if (wth->random_fh != NULL) {
+ if (file_seek(wth->random_fh, current_offset, SEEK_SET, err) == -1)
return -1;
}
/* This is a ngsniffer file */
ngsniffer = (ngsniffer_t *)g_malloc(sizeof(ngsniffer_t));
- wfth->priv = (void *)ngsniffer;
+ wth->priv = (void *)ngsniffer;
ngsniffer->maj_vers = maj_vers;
ngsniffer->min_vers = pletoh16(&version.min_vers);
@@ -749,11 +748,11 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
ngsniffer->last_blob = NULL;
ngsniffer->current_blob = NULL;
- wfth->subtype_read = ngsniffer_read;
- wfth->subtype_seek_read = ngsniffer_seek_read;
- wfth->subtype_sequential_close = ngsniffer_sequential_close;
- wfth->subtype_close = ngsniffer_close;
- wfth->snapshot_length = 0; /* not available in header, only in frame */
+ wth->subtype_read = ngsniffer_read;
+ wth->subtype_seek_read = ngsniffer_seek_read;
+ wth->subtype_sequential_close = ngsniffer_sequential_close;
+ wth->subtype_close = ngsniffer_close;
+ wth->snapshot_length = 0; /* not available in header, only in frame */
ngsniffer->timeunit = Psec[version.timeunit];
ngsniffer->network = version.network;
@@ -790,13 +789,13 @@ ngsniffer_open(wftap *wfth, int *err, gchar **err_info)
* isn't stored in the capture file.
*/
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC; /* XXX */
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC; /* XXX */
return 1;
}
static int
-process_header_records(wftap *wfth, int *err, gchar **err_info, gint16 maj_vers,
+process_header_records(wtap *wth, int *err, gchar **err_info, gint16 maj_vers,
guint8 network)
{
int bytes_read;
@@ -809,9 +808,9 @@ process_header_records(wftap *wfth, int *err, gchar **err_info, gint16 maj_vers,
for (;;) {
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(record_type, 2, wfth->fh);
+ bytes_read = file_read(record_type, 2, wth->fh);
if (bytes_read != 2) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0)
return -1;
if (bytes_read != 0) {
@@ -834,15 +833,15 @@ process_header_records(wftap *wfth, int *err, gchar **err_info, gint16 maj_vers,
* which implies data. Seek backwards over the
* two bytes we read, and return.
*/
- if (file_seek(wfth->fh, -2, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, -2, SEEK_CUR, err) == -1)
return -1;
return 0;
}
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(record_length, 4, wfth->fh);
+ bytes_read = file_read(record_length, 4, wth->fh);
if (bytes_read != 4) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -868,9 +867,9 @@ process_header_records(wftap *wfth, int *err, gchar **err_info, gint16 maj_vers,
*/
bytes_to_read = MIN(length, (int)sizeof buffer);
bytes_read = file_read(buffer, bytes_to_read,
- wfth->fh);
+ wth->fh);
if (bytes_read != bytes_to_read) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0) {
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -880,7 +879,7 @@ process_header_records(wftap *wfth, int *err, gchar **err_info, gint16 maj_vers,
switch (maj_vers) {
case 2:
- if (process_rec_header2_v2(wfth, buffer,
+ if (process_rec_header2_v2(wth, buffer,
length, err, err_info) < 0)
return -1;
break;
@@ -888,7 +887,7 @@ process_header_records(wftap *wfth, int *err, gchar **err_info, gint16 maj_vers,
case 1:
case 4:
case 5:
- if (process_rec_header2_v145(wfth, buffer,
+ if (process_rec_header2_v145(wth, buffer,
length, maj_vers, err, err_info) < 0)
return -1;
break;
@@ -898,20 +897,20 @@ process_header_records(wftap *wfth, int *err, gchar **err_info, gint16 maj_vers,
* Skip the rest of the record.
*/
if (length > sizeof buffer) {
- if (file_seek(wfth->fh, length - sizeof buffer,
+ if (file_seek(wth->fh, length - sizeof buffer,
SEEK_CUR, err) == -1)
return -1;
}
} else {
/* Nope, just skip over the data. */
- if (file_seek(wfth->fh, length, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, length, SEEK_CUR, err) == -1)
return -1;
}
}
}
static int
-process_rec_header2_v2(wftap *wfth, unsigned char *buffer, guint16 length,
+process_rec_header2_v2(wtap *wth, unsigned char *buffer, guint16 length,
int *err, gchar **err_info)
{
static const char x_25_str[] = "HDLC\nX.25\n";
@@ -936,7 +935,7 @@ process_rec_header2_v2(wftap *wfth, unsigned char *buffer, guint16 length,
/*
* X.25.
*/
- wfth->file_encap = WTAP_ENCAP_LAPB;
+ wth->file_encap = WTAP_ENCAP_LAPB;
} else {
*err = WTAP_ERR_UNSUPPORTED_ENCAP;
*err_info = g_strdup_printf("ngsniffer: WAN capture protocol string %.*s unknown",
@@ -947,7 +946,7 @@ process_rec_header2_v2(wftap *wfth, unsigned char *buffer, guint16 length,
}
static int
-process_rec_header2_v145(wftap *wfth, unsigned char *buffer, guint16 length,
+process_rec_header2_v145(wtap *wth, unsigned char *buffer, guint16 length,
gint16 maj_vers, int *err, gchar **err_info)
{
/*
@@ -989,15 +988,15 @@ process_rec_header2_v145(wftap *wfth, unsigned char *buffer, guint16 length,
switch (buffer[4]) {
case NET_SDLC:
- wfth->file_encap = WTAP_ENCAP_SDLC;
+ wth->file_encap = WTAP_ENCAP_SDLC;
break;
case NET_HDLC:
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
break;
case NET_FRAME_RELAY:
- wfth->file_encap = WTAP_ENCAP_FRELAY_WITH_PHDR;
+ wth->file_encap = WTAP_ENCAP_FRELAY_WITH_PHDR;
break;
case NET_ROUTER:
@@ -1014,12 +1013,12 @@ process_rec_header2_v145(wftap *wfth, unsigned char *buffer, guint16 length,
* a 0x01 in buffer[6]; none of the non-ISDN version
* 5 captures have it.
*/
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
switch (maj_vers) {
case 4:
if (buffer[1] == 0xfa)
- wfth->file_encap = WTAP_ENCAP_ISDN;
+ wth->file_encap = WTAP_ENCAP_ISDN;
break;
case 5:
@@ -1032,13 +1031,13 @@ process_rec_header2_v145(wftap *wfth, unsigned char *buffer, guint16 length,
return -1;
}
if (buffer[6] == 0x01)
- wfth->file_encap = WTAP_ENCAP_ISDN;
+ wth->file_encap = WTAP_ENCAP_ISDN;
break;
}
break;
case NET_PPP:
- wfth->file_encap = WTAP_ENCAP_PPP_WITH_PHDR;
+ wth->file_encap = WTAP_ENCAP_PPP_WITH_PHDR;
break;
default:
@@ -1055,14 +1054,13 @@ process_rec_header2_v145(wftap *wfth, unsigned char *buffer, guint16 length,
/* Read the next packet */
static gboolean
-ngsniffer_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
ngsniffer_t *ngsniffer;
int ret;
guint padding;
- wtap* wth = (wtap*)wfth->tap_specific_data;
- ngsniffer = (ngsniffer_t *)wfth->priv;
+ ngsniffer = (ngsniffer_t *)wth->priv;
for (;;) {
/*
* We use the uncompressed offset, as that's what
@@ -1073,8 +1071,8 @@ ngsniffer_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
/*
* Process the record.
*/
- ret = ngsniffer_process_record(wfth, FALSE, &padding,
- &wth->phdr, wfth->frame_buffer, err, err_info);
+ ret = ngsniffer_process_record(wth, FALSE, &padding,
+ &wth->phdr, wth->frame_buffer, err, err_info);
if (ret < 0) {
/* Read error or short read */
return FALSE;
@@ -1093,7 +1091,7 @@ ngsniffer_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
* Skip any extra data in the record.
*/
if (padding != 0) {
- if (!ng_file_skip_seq(wfth, padding, err,
+ if (!ng_file_skip_seq(wth, padding, err,
err_info))
return FALSE;
}
@@ -1114,7 +1112,7 @@ ngsniffer_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
* and keep looping.
*/
if (padding != 0) {
- if (!ng_file_skip_seq(wfth, padding, err,
+ if (!ng_file_skip_seq(wth, padding, err,
err_info))
return FALSE;
}
@@ -1124,16 +1122,15 @@ ngsniffer_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
}
static gboolean
-ngsniffer_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+ngsniffer_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr*)header;
int ret;
- if (!ng_file_seek_rand(wfth, seek_off, err, err_info))
+ if (!ng_file_seek_rand(wth, seek_off, err, err_info))
return FALSE;
- ret = ngsniffer_process_record(wfth, TRUE, NULL, phdr, buf, err, err_info);
+ ret = ngsniffer_process_record(wth, TRUE, NULL, phdr, buf, err, err_info);
if (ret < 0) {
/* Read error or short read */
return FALSE;
@@ -1167,7 +1164,7 @@ ngsniffer_seek_read(wftap *wfth, gint64 seek_off,
* the end of the record.
*/
static int
-ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
+ngsniffer_process_record(wtap *wth, gboolean is_random, guint *padding,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
ngsniffer_t *ngsniffer;
@@ -1185,7 +1182,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
/*
* Read the record header.
*/
- bytes_read = ng_file_read(record_type, 2, wfth, is_random, err,
+ bytes_read = ng_file_read(record_type, 2, wth, is_random, err,
err_info);
if (bytes_read != 2) {
if (*err != 0)
@@ -1196,7 +1193,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
}
return REC_EOF;
}
- bytes_read = ng_file_read(record_length, 4, wfth, is_random, err,
+ bytes_read = ng_file_read(record_length, 4, wth, is_random, err,
err_info);
if (bytes_read != 4) {
if (*err == 0)
@@ -1207,7 +1204,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
type = pletoh16(record_type);
length = pletoh16(record_length);
- ngsniffer = (ngsniffer_t *)wfth->priv;
+ ngsniffer = (ngsniffer_t *)wth->priv;
switch (type) {
case REC_FRAME2:
@@ -1223,7 +1220,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
/* Read the f_frame2_struct */
bytes_read = ng_file_read(&frame2, (unsigned int)sizeof frame2,
- wfth, is_random, err, err_info);
+ wth, is_random, err, err_info);
if (bytes_read != sizeof frame2) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -1238,7 +1235,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
length -= sizeof frame2; /* we already read that much */
- set_pseudo_header_frame2(wfth, &phdr->pseudo_header, &frame2);
+ set_pseudo_header_frame2(wth, &phdr->pseudo_header, &frame2);
break;
case REC_FRAME4:
@@ -1254,7 +1251,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
/* Read the f_frame4_struct */
bytes_read = ng_file_read(&frame4, (unsigned int)sizeof frame4,
- wfth, is_random, err, err_info);
+ wth, is_random, err, err_info);
if (bytes_read != sizeof frame4) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -1287,7 +1284,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
case REC_FRAME6:
/* Read the f_frame6_struct */
bytes_read = ng_file_read(&frame6, (unsigned int)sizeof frame6,
- wfth, is_random, err, err_info);
+ wth, is_random, err, err_info);
if (bytes_read != sizeof frame6) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -1302,7 +1299,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
length -= sizeof frame6; /* we already read that much */
- set_pseudo_header_frame6(wfth, &phdr->pseudo_header, &frame6);
+ set_pseudo_header_frame6(wth, &phdr->pseudo_header, &frame6);
break;
case REC_EOF:
@@ -1358,7 +1355,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
* Read the packet data.
*/
buffer_assure_space(buf, size);
- bytes_read = ng_file_read(buffer_start_ptr(buf), size, wfth,
+ bytes_read = ng_file_read(buffer_start_ptr(buf), size, wth,
is_random, err, err_info);
if (bytes_read != (gint64) size) {
if (*err == 0)
@@ -1366,7 +1363,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
return -1;
}
- phdr->pkt_encap = fix_pseudo_header(wfth->file_encap,
+ phdr->pkt_encap = fix_pseudo_header(wth->file_encap,
buf, length, &phdr->pseudo_header);
/*
@@ -1404,7 +1401,7 @@ ngsniffer_process_record(wftap *wfth, gboolean is_random, guint *padding,
}
static void
-set_pseudo_header_frame2(wftap *wfth, union wtap_pseudo_header *pseudo_header,
+set_pseudo_header_frame2(wtap *wth, union wtap_pseudo_header *pseudo_header,
struct frame2_rec *frame2)
{
/*
@@ -1449,7 +1446,7 @@ set_pseudo_header_frame2(wftap *wfth, union wtap_pseudo_header *pseudo_header,
* correlation with anything. See previous comment
* about display filters.
*/
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_ETHERNET:
/*
@@ -1751,12 +1748,12 @@ set_pseudo_header_frame4(union wtap_pseudo_header *pseudo_header,
}
static void
-set_pseudo_header_frame6(wftap *wfth, union wtap_pseudo_header *pseudo_header,
+set_pseudo_header_frame6(wtap *wth, union wtap_pseudo_header *pseudo_header,
struct frame6_rec *frame6 _U_)
{
/* XXX - Once the frame format is divined, something will most likely go here */
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_ETHERNET:
/* XXX - is there an FCS? */
@@ -1952,11 +1949,11 @@ fix_pseudo_header(int encap, Buffer *buf, int len,
/* Throw away the buffers used by the sequential I/O stream, but not
those used by the random I/O stream. */
static void
-ngsniffer_sequential_close(wftap *wfth)
+ngsniffer_sequential_close(wtap *wth)
{
ngsniffer_t *ngsniffer;
- ngsniffer = (ngsniffer_t *)wfth->priv;
+ ngsniffer = (ngsniffer_t *)wth->priv;
if (ngsniffer->seq.buf != NULL) {
g_free(ngsniffer->seq.buf);
ngsniffer->seq.buf = NULL;
@@ -1974,11 +1971,11 @@ free_blob(gpointer data, gpointer user_data _U_)
for a capture file type, it'll be called before the "close" routine
is called, so we don't have to free the sequential buffer here.) */
static void
-ngsniffer_close(wftap *wfth)
+ngsniffer_close(wtap *wth)
{
ngsniffer_t *ngsniffer;
- ngsniffer = (ngsniffer_t *)wfth->priv;
+ ngsniffer = (ngsniffer_t *)wth->priv;
if (ngsniffer->rand.buf != NULL)
g_free(ngsniffer->rand.buf);
if (ngsniffer->first_blob != NULL) {
@@ -2033,7 +2030,7 @@ ngsniffer_dump_can_write_encap(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */
gboolean
-ngsniffer_dump_open(wftap_dumper *wdh, int *err)
+ngsniffer_dump_open(wtap_dumper *wdh, int *err)
{
ngsniffer_dump_t *ngsniffer;
char buf[6] = {REC_VERS, 0x00, 0x12, 0x00, 0x00, 0x00}; /* version record */
@@ -2048,10 +2045,10 @@ ngsniffer_dump_open(wftap_dumper *wdh, int *err)
ngsniffer->start = 0;
/* Write the file header. */
- if (!wftap_dump_file_write(wdh, ngsniffer_magic, sizeof ngsniffer_magic,
+ if (!wtap_dump_file_write(wdh, ngsniffer_magic, sizeof ngsniffer_magic,
err))
return FALSE;
- if (!wftap_dump_file_write(wdh, buf, 6, err))
+ if (!wtap_dump_file_write(wdh, buf, 6, err))
return FALSE;
return TRUE;
@@ -2060,7 +2057,7 @@ ngsniffer_dump_open(wftap_dumper *wdh, int *err)
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean
-ngsniffer_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
@@ -2116,7 +2113,7 @@ ngsniffer_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
version.cmprs_level = 0;
version.rsvd[0] = 0;
version.rsvd[1] = 0;
- if (!wftap_dump_file_write(wdh, &version, sizeof version, err))
+ if (!wtap_dump_file_write(wdh, &version, sizeof version, err))
return FALSE;
}
@@ -2126,7 +2123,7 @@ ngsniffer_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
buf[3] = (char)((phdr->caplen + sizeof(struct frame2_rec))/256);
buf[4] = 0x00;
buf[5] = 0x00;
- if (!wftap_dump_file_write(wdh, buf, 6, err))
+ if (!wtap_dump_file_write(wdh, buf, 6, err))
return FALSE;
/* Seconds since the start of the capture */
tsecs = phdr->ts.secs - ngsniffer->start;
@@ -2182,9 +2179,9 @@ ngsniffer_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
rec_hdr.flags = 0;
rec_hdr.true_size = phdr->len != phdr->caplen ? GUINT16_TO_LE(phdr->len) : 0;
rec_hdr.rsvd = 0;
- if (!wftap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
+ if (!wtap_dump_file_write(wdh, &rec_hdr, sizeof rec_hdr, err))
return FALSE;
- if (!wftap_dump_file_write(wdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
return TRUE;
}
@@ -2192,12 +2189,12 @@ ngsniffer_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
/* Finish writing to a dump file.
Returns TRUE on success, FALSE on failure. */
static gboolean
-ngsniffer_dump_close(wftap_dumper *wdh, int *err)
+ngsniffer_dump_close(wtap_dumper *wdh, int *err)
{
/* EOF record */
char buf[6] = {REC_EOF, 0x00, 0x00, 0x00, 0x00, 0x00};
- if (!wftap_dump_file_write(wdh, buf, 6, err))
+ if (!wtap_dump_file_write(wdh, buf, 6, err))
return FALSE;
return TRUE;
}
@@ -2210,10 +2207,10 @@ ngsniffer_dump_close(wftap_dumper *wdh, int *err)
Parameters
inbuf - buffer of compressed bytes from file, not including
- the preceding length word
+ the preceding length word
inlen - length of inbuf in bytes (max 64k)
outbuf - decompressed contents, could contain a partial Sniffer
- record at the end.
+ record at the end.
outlen - length of outbuf.
Return value is the number of bytes in outbuf on return.
@@ -2416,7 +2413,7 @@ typedef struct {
} blob_info_t;
static gint64
-ng_file_read(void *buffer, unsigned int nbytes, wftap *wfth, gboolean is_random,
+ng_file_read(void *buffer, unsigned int nbytes, wtap *wth, gboolean is_random,
int *err, gchar **err_info)
{
ngsniffer_t *ngsniffer;
@@ -2429,16 +2426,16 @@ ng_file_read(void *buffer, unsigned int nbytes, wftap *wfth, gboolean is_random,
unsigned int bytes_to_copy;
unsigned int bytes_left;
- ngsniffer = (ngsniffer_t *)wfth->priv;
+ ngsniffer = (ngsniffer_t *)wth->priv;
if (is_random) {
- infile = wfth->random_fh;
+ infile = wth->random_fh;
comp_stream = &ngsniffer->rand;
} else {
- infile = wfth->fh;
+ infile = wth->fh;
comp_stream = &ngsniffer->seq;
}
- if (wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) {
+ if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) {
errno = WTAP_ERR_CANT_READ;
copied_bytes = file_read(buffer, copybytes, infile);
if ((unsigned int) copied_bytes != copybytes)
@@ -2465,7 +2462,7 @@ ng_file_read(void *buffer, unsigned int nbytes, wftap *wfth, gboolean is_random,
/* This is the first sequential read; if we also have a
random stream open, allocate the first element for the
list of blobs, and make it the last element as well. */
- if (wfth->random_fh != NULL) {
+ if (wth->random_fh != NULL) {
g_assert(ngsniffer->first_blob == NULL);
blob = g_new(blob_info_t,1);
blob->blob_comp_offset = comp_stream->comp_offset;
@@ -2503,7 +2500,7 @@ ng_file_read(void *buffer, unsigned int nbytes, wftap *wfth, gboolean is_random,
non-empty, as we initialized it on the first sequential
read, so we just add the new element at the end, and
adjust the pointer to the last element to refer to it. */
- if (wfth->random_fh != NULL) {
+ if (wth->random_fh != NULL) {
blob = g_new(blob_info_t,1);
blob->blob_comp_offset = comp_stream->comp_offset;
blob->blob_uncomp_offset = comp_stream->uncomp_offset;
@@ -2598,17 +2595,17 @@ read_blob(FILE_T infile, ngsniffer_comp_stream_t *comp_stream, int *err,
/* Skip some number of bytes forward in the sequential stream. */
static gboolean
-ng_file_skip_seq(wftap *wfth, gint64 delta, int *err, gchar **err_info)
+ng_file_skip_seq(wtap *wth, gint64 delta, int *err, gchar **err_info)
{
ngsniffer_t *ngsniffer;
char *buf;
unsigned int amount_to_read;
- ngsniffer = (ngsniffer_t *)wfth->priv;
+ ngsniffer = (ngsniffer_t *)wth->priv;
- if (wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) {
+ if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) {
ngsniffer->seq.uncomp_offset += delta;
- return file_skip(wfth->fh, delta, err);
+ return file_skip(wth->fh, delta, err);
}
g_assert(delta >= 0);
@@ -2621,7 +2618,7 @@ ng_file_skip_seq(wftap *wfth, gint64 delta, int *err, gchar **err_info)
else
amount_to_read = (unsigned int) delta;
- if (ng_file_read(buf, amount_to_read, wfth, FALSE, err, err_info) < 0) {
+ if (ng_file_read(buf, amount_to_read, wth, FALSE, err, err_info) < 0) {
g_free(buf);
return FALSE; /* error */
}
@@ -2642,17 +2639,17 @@ ng_file_skip_seq(wftap *wfth, gint64 delta, int *err, gchar **err_info)
position within the blob we have in memory (whether it's the blob we
already had in memory or, if necessary, the one we read in). */
static gboolean
-ng_file_seek_rand(wftap *wfth, gint64 offset, int *err, gchar **err_info)
+ng_file_seek_rand(wtap *wth, gint64 offset, int *err, gchar **err_info)
{
ngsniffer_t *ngsniffer;
gint64 delta;
GList *new_list, *next_list;
blob_info_t *next_blob, *new_blob;
- ngsniffer = (ngsniffer_t *)wfth->priv;
+ ngsniffer = (ngsniffer_t *)wth->priv;
- if (wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) {
- if (file_seek(wfth->random_fh, offset, SEEK_SET, err) == -1)
+ if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) {
+ if (file_seek(wth->random_fh, offset, SEEK_SET, err) == -1)
return FALSE;
return TRUE;
}
@@ -2747,7 +2744,7 @@ ng_file_seek_rand(wftap *wfth, gint64 offset, int *err, gchar **err_info)
/* Seek in the compressed file to the offset in the compressed file
of the beginning of that blob. */
- if (file_seek(wfth->random_fh, new_blob->blob_comp_offset, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, new_blob->blob_comp_offset, SEEK_SET, err) == -1)
return FALSE;
/*
@@ -2769,7 +2766,7 @@ ng_file_seek_rand(wftap *wfth, gint64 offset, int *err, gchar **err_info)
ngsniffer->rand.comp_offset = new_blob->blob_comp_offset;
/* Now fill the buffer. */
- if (read_blob(wfth->random_fh, &ngsniffer->rand, err, err_info) < 0)
+ if (read_blob(wth->random_fh, &ngsniffer->rand, err, err_info) < 0)
return FALSE;
/* Set "delta" to the amount to move within this blob; it had
diff --git a/wiretap/ngsniffer.h b/wiretap/ngsniffer.h
index 8e212810ed..db0c525b1e 100644
--- a/wiretap/ngsniffer.h
+++ b/wiretap/ngsniffer.h
@@ -24,8 +24,8 @@
#include <glib.h>
#include <wtap.h>
-int ngsniffer_open(wftap *wfth, int *err, gchar **err_info);
-gboolean ngsniffer_dump_open(wftap_dumper *wdh, int *err);
+int ngsniffer_open(wtap *wth, int *err, gchar **err_info);
+gboolean ngsniffer_dump_open(wtap_dumper *wdh, int *err);
int ngsniffer_dump_can_write_encap(int encap);
#endif
diff --git a/wiretap/packetlogger.c b/wiretap/packetlogger.c
index 4033c78828..313cf3e5b8 100644
--- a/wiretap/packetlogger.c
+++ b/wiretap/packetlogger.c
@@ -34,7 +34,6 @@
#include <string.h>
#include "wtap.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "file_wrappers.h"
@@ -45,10 +44,10 @@ typedef struct packetlogger_header {
guint64 ts;
} packetlogger_header_t;
-static gboolean packetlogger_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean packetlogger_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean packetlogger_seek_read(wftap *wfth, gint64 seek_off,
- void* header,
+static gboolean packetlogger_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info);
static gboolean packetlogger_read_header(packetlogger_header_t *pl_hdr,
FILE_T fh, int *err, gchar **err_info);
@@ -56,19 +55,19 @@ static gboolean packetlogger_read_packet(FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err,
gchar **err_info);
-int packetlogger_open(wftap *wfth, int *err, gchar **err_info)
+int packetlogger_open(wtap *wth, int *err, gchar **err_info)
{
packetlogger_header_t pl_hdr;
guint8 type;
- if(!packetlogger_read_header(&pl_hdr, wfth->fh, err, err_info)) {
+ if(!packetlogger_read_header(&pl_hdr, wth->fh, err, err_info)) {
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
- if (file_read(&type, 1, wfth->fh) <= 0) {
- *err = file_error(wfth->fh, err_info);
+ if (file_read(&type, 1, wth->fh) <= 0) {
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -80,39 +79,37 @@ int packetlogger_open(wftap *wfth, int *err, gchar **err_info)
return 0;
/* No file header. Reset the fh to 0 so we can read the first packet */
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
/* Set up the pointers to the handlers for this file type */
- wfth->subtype_read = packetlogger_read;
- wfth->subtype_seek_read = packetlogger_seek_read;
+ wth->subtype_read = packetlogger_read;
+ wth->subtype_seek_read = packetlogger_seek_read;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PACKETLOGGER;
- wfth->file_encap = WTAP_ENCAP_PACKETLOGGER;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PACKETLOGGER;
+ wth->file_encap = WTAP_ENCAP_PACKETLOGGER;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1; /* Our kind of file */
}
static gboolean
-packetlogger_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+packetlogger_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
- return packetlogger_read_packet(wfth->fh, &wth->phdr,
- wfth->frame_buffer, err, err_info);
+ return packetlogger_read_packet(wth->fh, &wth->phdr,
+ wth->frame_buffer, err, err_info);
}
static gboolean
-packetlogger_seek_read(wftap *wfth, gint64 seek_off, void* header,
+packetlogger_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- if(file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if(file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if(!packetlogger_read_packet(wfth->random_fh, phdr, buf, err, err_info)) {
+ if(!packetlogger_read_packet(wth->random_fh, phdr, buf, err, err_info)) {
if(*err == 0)
*err = WTAP_ERR_SHORT_READ;
diff --git a/wiretap/packetlogger.h b/wiretap/packetlogger.h
index ab671bdca6..199cd36421 100644
--- a/wiretap/packetlogger.h
+++ b/wiretap/packetlogger.h
@@ -27,7 +27,7 @@
#include <glib.h>
#include <wtap.h>
-int packetlogger_open(wftap *wfth, int *err, gchar **err_info _U_);
+int packetlogger_open(wtap *wth, int *err, gchar **err_info _U_);
#endif /* __PACKETLOGGER_H__ */
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c
index 6d6b116fc9..77dd9f3d93 100644
--- a/wiretap/pcap-common.c
+++ b/wiretap/pcap-common.c
@@ -27,7 +27,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "atm.h"
@@ -2067,7 +2066,7 @@ pcap_get_phdr_size(int encap, const union wtap_pseudo_header *pseudo_header)
}
gboolean
-pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *pseudo_header,
+pcap_write_phdr(wtap_dumper *wdh, int encap, const union wtap_pseudo_header *pseudo_header,
int *err)
{
guint8 atm_hdr[SUNATM_LEN];
@@ -2119,7 +2118,7 @@ pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *ps
}
atm_hdr[SUNATM_VPI] = (guint8)pseudo_header->atm.vpi;
phtons(&atm_hdr[SUNATM_VCI], pseudo_header->atm.vci);
- if (!wftap_dump_file_write(wdh, atm_hdr, sizeof(atm_hdr), err))
+ if (!wtap_dump_file_write(wdh, atm_hdr, sizeof(atm_hdr), err))
return FALSE;
wdh->bytes_dumped += sizeof(atm_hdr);
break;
@@ -2132,7 +2131,7 @@ pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *ps
phtons(&irda_hdr[IRDA_SLL_PKTTYPE_OFFSET],
pseudo_header->irda.pkttype);
phtons(&irda_hdr[IRDA_SLL_PROTOCOL_OFFSET], 0x0017);
- if (!wftap_dump_file_write(wdh, irda_hdr, sizeof(irda_hdr), err))
+ if (!wtap_dump_file_write(wdh, irda_hdr, sizeof(irda_hdr), err))
return FALSE;
wdh->bytes_dumped += sizeof(irda_hdr);
break;
@@ -2146,7 +2145,7 @@ pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *ps
mtp2_hdr[MTP2_ANNEX_A_USED_OFFSET] = pseudo_header->mtp2.annex_a_used;
phtons(&mtp2_hdr[MTP2_LINK_NUMBER_OFFSET],
pseudo_header->mtp2.link_number);
- if (!wftap_dump_file_write(wdh, mtp2_hdr, sizeof(mtp2_hdr), err))
+ if (!wtap_dump_file_write(wdh, mtp2_hdr, sizeof(mtp2_hdr), err))
return FALSE;
wdh->bytes_dumped += sizeof(mtp2_hdr);
break;
@@ -2161,7 +2160,7 @@ pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *ps
phtons(&lapd_hdr[LAPD_SLL_PROTOCOL_OFFSET], ETH_P_LAPD);
lapd_hdr[LAPD_SLL_ADDR_OFFSET + 0] =
pseudo_header->lapd.we_network?0x01:0x00;
- if (!wftap_dump_file_write(wdh, lapd_hdr, sizeof(lapd_hdr), err))
+ if (!wtap_dump_file_write(wdh, lapd_hdr, sizeof(lapd_hdr), err))
return FALSE;
wdh->bytes_dumped += sizeof(lapd_hdr);
break;
@@ -2176,7 +2175,7 @@ pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *ps
sita_hdr[SITA_ERRORS1_OFFSET] = pseudo_header->sita.sita_errors1;
sita_hdr[SITA_ERRORS2_OFFSET] = pseudo_header->sita.sita_errors2;
sita_hdr[SITA_PROTO_OFFSET] = pseudo_header->sita.sita_proto;
- if (!wftap_dump_file_write(wdh, sita_hdr, sizeof(sita_hdr), err))
+ if (!wtap_dump_file_write(wdh, sita_hdr, sizeof(sita_hdr), err))
return FALSE;
wdh->bytes_dumped += sizeof(sita_hdr);
break;
@@ -2214,7 +2213,7 @@ pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *ps
default:
break;
}
- if (!wftap_dump_file_write(wdh, erf_hdr, size, err))
+ if (!wtap_dump_file_write(wdh, erf_hdr, size, err))
return FALSE;
wdh->bytes_dumped += size;
@@ -2229,7 +2228,7 @@ pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *ps
do {
phtonll(erf_exhdr, pseudo_header->erf.ehdr_list[i].ehdr);
type = erf_exhdr[0];
- if (!wftap_dump_file_write(wdh, erf_exhdr, 8, err))
+ if (!wtap_dump_file_write(wdh, erf_exhdr, 8, err))
return FALSE;
wdh->bytes_dumped += 8;
i++;
@@ -2245,14 +2244,14 @@ pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *ps
i2c_hdr.bus = pseudo_header->i2c.bus |
(pseudo_header->i2c.is_event ? 0x80 : 0x00);
phtonl((guint8 *)&i2c_hdr.flags, pseudo_header->i2c.flags);
- if (!wftap_dump_file_write(wdh, &i2c_hdr, sizeof(i2c_hdr), err))
+ if (!wtap_dump_file_write(wdh, &i2c_hdr, sizeof(i2c_hdr), err))
return FALSE;
wdh->bytes_dumped += sizeof(i2c_hdr);
break;
case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
bt_hdr.direction = GUINT32_TO_BE(pseudo_header->p2p.sent ? LIBPCAP_BT_PHDR_SENT : LIBPCAP_BT_PHDR_RECV);
- if (!wftap_dump_file_write(wdh, &bt_hdr, sizeof bt_hdr, err))
+ if (!wtap_dump_file_write(wdh, &bt_hdr, sizeof bt_hdr, err))
return FALSE;
wdh->bytes_dumped += sizeof bt_hdr;
break;
@@ -2261,14 +2260,14 @@ pcap_write_phdr(wftap_dumper *wdh, int encap, const union wtap_pseudo_header *ps
bt_monitor_hdr.adapter_id = GUINT16_TO_BE(pseudo_header->btmon.adapter_id);
bt_monitor_hdr.opcode = GUINT16_TO_BE(pseudo_header->btmon.opcode);
- if (!wftap_dump_file_write(wdh, &bt_monitor_hdr, sizeof bt_monitor_hdr, err))
+ if (!wtap_dump_file_write(wdh, &bt_monitor_hdr, sizeof bt_monitor_hdr, err))
return FALSE;
wdh->bytes_dumped += sizeof bt_monitor_hdr;
break;
case WTAP_ENCAP_PPP_WITH_PHDR:
ppp_hdr.direction = (pseudo_header->p2p.sent ? LIBPCAP_PPP_PHDR_SENT : LIBPCAP_PPP_PHDR_RECV);
- if (!wftap_dump_file_write(wdh, &ppp_hdr, sizeof ppp_hdr, err))
+ if (!wtap_dump_file_write(wdh, &ppp_hdr, sizeof ppp_hdr, err))
return FALSE;
wdh->bytes_dumped += sizeof ppp_hdr;
break;
diff --git a/wiretap/pcap-common.h b/wiretap/pcap-common.h
index dfcf5f1be5..d4fc81c507 100644
--- a/wiretap/pcap-common.h
+++ b/wiretap/pcap-common.h
@@ -39,7 +39,7 @@ extern void pcap_read_post_process(int file_type, int wtap_encap,
extern int pcap_get_phdr_size(int encap,
const union wtap_pseudo_header *pseudo_header);
-extern gboolean pcap_write_phdr(wftap_dumper *wdh, int wtap_encap,
+extern gboolean pcap_write_phdr(wtap_dumper *wdh, int wtap_encap,
const union wtap_pseudo_header *pseudo_header, int *err);
#endif
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index 52df466b33..46662ee988 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -34,7 +34,6 @@
#include <errno.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include <epan/addr_resolv.h>
#include "file_wrappers.h"
@@ -57,13 +56,13 @@
#endif
static gboolean
-pcapng_read(wftap *wfth, int *err, gchar **err_info,
+pcapng_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
static gboolean
-pcapng_seek_read(wftap *wth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+pcapng_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
static void
-pcapng_close(wftap *wfth);
+pcapng_close(wtap *wth);
/* pcapng: common block header for every block type */
@@ -2140,7 +2139,7 @@ pcapng_process_idb(wtap *wth, pcapng_t *pcapng, wtapng_block_t *wblock)
/* classic wtap: open capture file */
int
-pcapng_open(wftap *wfth, int *err, gchar **err_info)
+pcapng_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
pcapng_t pn;
@@ -2148,7 +2147,6 @@ pcapng_open(wftap *wfth, int *err, gchar **err_info)
pcapng_t *pcapng;
pcapng_block_header_t bh;
gint64 saved_offset;
- wtap* wth = (wtap*)wfth->tap_specific_data;
pn.shb_read = FALSE;
/* we don't know the byte swapping of the file yet */
@@ -2163,14 +2161,14 @@ pcapng_open(wftap *wfth, int *err, gchar **err_info)
/* we don't expect any packet blocks yet */
wblock.frame_buffer = NULL;
wblock.packet_header = NULL;
- wblock.file_encap = &wfth->file_encap;
+ wblock.file_encap = &wth->file_encap;
pcapng_debug0("pcapng_open: opening file");
/* read first block */
- bytes_read = pcapng_read_block(wfth->fh, TRUE, &pn, &wblock, err, err_info);
+ bytes_read = pcapng_read_block(wth->fh, TRUE, &pn, &wblock, err, err_info);
if (bytes_read <= 0) {
pcapng_debug0("pcapng_open: couldn't read first SHB");
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -2199,17 +2197,17 @@ pcapng_open(wftap *wfth, int *err, gchar **err_info)
wth->shb_hdr.shb_os = wblock.data.section.shb_os;
wth->shb_hdr.shb_user_appl = wblock.data.section.shb_user_appl;
- wfth->file_encap = WTAP_ENCAP_UNKNOWN;
- wfth->snapshot_length = 0;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->file_encap = WTAP_ENCAP_UNKNOWN;
+ wth->snapshot_length = 0;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
pcapng = (pcapng_t *)g_malloc(sizeof(pcapng_t));
- wfth->priv = (void *)pcapng;
+ wth->priv = (void *)pcapng;
*pcapng = pn;
- wfth->subtype_read = pcapng_read;
- wfth->subtype_seek_read = pcapng_seek_read;
- wfth->subtype_close = pcapng_close;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAPNG;
+ wth->subtype_read = pcapng_read;
+ wth->subtype_seek_read = pcapng_seek_read;
+ wth->subtype_close = pcapng_close;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAPNG;
/* Read IDBs */
wth->interface_data = g_array_new(FALSE, FALSE, sizeof(wtapng_if_descr_t));
@@ -2219,15 +2217,15 @@ pcapng_open(wftap *wfth, int *err, gchar **err_info)
while (1) {
/* peek at next block */
/* Try to read the (next) block header */
- saved_offset = file_tell(wfth->fh);
+ saved_offset = file_tell(wth->fh);
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&bh, sizeof bh, wfth->fh);
+ bytes_read = file_read(&bh, sizeof bh, wth->fh);
if (bytes_read == 0) {
pcapng_debug0("No more IDBs available...");
break;
}
if (bytes_read != sizeof bh) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
pcapng_debug3("pcapng_open: Check for more IDB:s, file_read() returned %d instead of %u, err = %d.", bytes_read, (unsigned int)sizeof bh, *err);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -2235,7 +2233,7 @@ pcapng_open(wftap *wfth, int *err, gchar **err_info)
}
/* go back to where we were */
- file_seek(wfth->fh, saved_offset, SEEK_SET, err);
+ file_seek(wth->fh, saved_offset, SEEK_SET, err);
if (pn.byte_swapped) {
bh.block_type = GUINT32_SWAP_LE_BE(bh.block_type);
@@ -2246,14 +2244,14 @@ pcapng_open(wftap *wfth, int *err, gchar **err_info)
if (bh.block_type != BLOCK_TYPE_IDB) {
break; /* No more IDB:s */
}
- bytes_read = pcapng_read_block(wfth->fh, FALSE, &pn, &wblock, err, err_info);
+ bytes_read = pcapng_read_block(wth->fh, FALSE, &pn, &wblock, err, err_info);
if (bytes_read == 0) {
pcapng_debug0("No more IDBs available...");
break;
}
if (bytes_read <= 0) {
pcapng_debug0("pcapng_open: couldn't read IDB");
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
return -1;
@@ -2267,28 +2265,27 @@ pcapng_open(wftap *wfth, int *err, gchar **err_info)
/* classic wtap: read packet */
static gboolean
-pcapng_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
- pcapng_t *pcapng = (pcapng_t *)wfth->priv;
+ pcapng_t *pcapng = (pcapng_t *)wth->priv;
int bytes_read;
wtapng_block_t wblock;
wtapng_if_descr_t *wtapng_if_descr;
wtapng_if_stats_t if_stats;
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
pcapng_debug1("pcapng_read: data_offset is initially %" G_GINT64_MODIFIER "d", *data_offset);
- wblock.frame_buffer = wfth->frame_buffer;
+ wblock.frame_buffer = wth->frame_buffer;
wblock.packet_header = &wth->phdr;
- wblock.file_encap = &wfth->file_encap;
+ wblock.file_encap = &wth->file_encap;
pcapng->add_new_ipv4 = wth->add_new_ipv4;
pcapng->add_new_ipv6 = wth->add_new_ipv6;
/* read next block */
while (1) {
- bytes_read = pcapng_read_block(wfth->fh, FALSE, pcapng, &wblock, err, err_info);
+ bytes_read = pcapng_read_block(wth->fh, FALSE, pcapng, &wblock, err, err_info);
if (bytes_read <= 0) {
pcapng_debug1("pcapng_read: data_offset is finally %" G_GINT64_MODIFIER "d", *data_offset);
pcapng_debug0("pcapng_read: couldn't read packet block");
@@ -2377,18 +2374,18 @@ got_packet:
/* classic wtap: seek to file position and read packet */
static gboolean
-pcapng_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf,
+pcapng_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf,
int *err, gchar **err_info)
{
- pcapng_t *pcapng = (pcapng_t *)wfth->priv;
+ pcapng_t *pcapng = (pcapng_t *)wth->priv;
guint64 bytes_read64;
int bytes_read;
wtapng_block_t wblock;
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
+
/* seek to the right file position */
- bytes_read64 = file_seek(wfth->random_fh, seek_off, SEEK_SET, err);
+ bytes_read64 = file_seek(wth->random_fh, seek_off, SEEK_SET, err);
if (bytes_read64 <= 0) {
return FALSE; /* Seek error */
}
@@ -2396,10 +2393,10 @@ pcapng_seek_read(wftap *wfth, gint64 seek_off,
wblock.frame_buffer = buf;
wblock.packet_header = phdr;
- wblock.file_encap = &wfth->file_encap;
+ wblock.file_encap = &wth->file_encap;
/* read the block */
- bytes_read = pcapng_read_block(wfth->random_fh, FALSE, pcapng, &wblock, err, err_info);
+ bytes_read = pcapng_read_block(wth->random_fh, FALSE, pcapng, &wblock, err, err_info);
if (bytes_read <= 0) {
pcapng_debug3("pcapng_seek_read: couldn't read packet block (err=%d, errno=%d, bytes_read=%d).",
*err, errno, bytes_read);
@@ -2420,9 +2417,9 @@ pcapng_seek_read(wftap *wfth, gint64 seek_off,
/* classic wtap: close capture file */
static void
-pcapng_close(wftap *wfth)
+pcapng_close(wtap *wth)
{
- pcapng_t *pcapng = (pcapng_t *)wfth->priv;
+ pcapng_t *pcapng = (pcapng_t *)wth->priv;
pcapng_debug0("pcapng_close: closing file");
if (pcapng->interface_data != NULL) {
@@ -2438,7 +2435,7 @@ typedef struct {
} pcapng_dump_t;
static gboolean
-pcapng_write_section_header_block(wftap_dumper *wfdh, int *err)
+pcapng_write_section_header_block(wtap_dumper *wdh, int *err)
{
pcapng_block_header_t bh;
pcapng_section_header_block_t shb;
@@ -2448,7 +2445,6 @@ pcapng_write_section_header_block(wftap_dumper *wfdh, int *err)
guint32 options_total_length = 0;
guint32 comment_len = 0, shb_hardware_len = 0, shb_os_len = 0, shb_user_appl_len = 0;
guint32 comment_pad_len = 0, shb_hardware_pad_len = 0, shb_os_pad_len = 0, shb_user_appl_pad_len = 0;
- wtap_dumper* wdh = (wtap_dumper*)wfdh->tap_specific_data;
if (wdh->shb_hdr) {
pcapng_debug0("pcapng_write_section_header_block: Have shb_hdr");
@@ -2510,9 +2506,9 @@ pcapng_write_section_header_block(wftap_dumper *wfdh, int *err)
bh.block_total_length = (guint32)(sizeof(bh) + sizeof(shb) + options_total_length + 4);
pcapng_debug2("pcapng_write_section_header_block: Total len %u, Options total len %u",bh.block_total_length, options_total_length);
- if (!wftap_dump_file_write(wfdh, &bh, sizeof bh, err))
+ if (!wtap_dump_file_write(wdh, &bh, sizeof bh, err))
return FALSE;
- wfdh->bytes_dumped += sizeof bh;
+ wdh->bytes_dumped += sizeof bh;
/* write block fixed content */
/* XXX - get these values from wblock? */
@@ -2521,9 +2517,9 @@ pcapng_write_section_header_block(wftap_dumper *wfdh, int *err)
shb.version_minor = 0;
shb.section_length = -1;
- if (!wftap_dump_file_write(wfdh, &shb, sizeof shb, err))
+ if (!wtap_dump_file_write(wdh, &shb, sizeof shb, err))
return FALSE;
- wfdh->bytes_dumped += sizeof shb;
+ wdh->bytes_dumped += sizeof shb;
/* XXX - write (optional) block options
* opt_comment 1
@@ -2535,84 +2531,84 @@ pcapng_write_section_header_block(wftap_dumper *wfdh, int *err)
if (comment_len) {
option_hdr.type = OPT_COMMENT;
option_hdr.value_length = comment_len;
- if (!wftap_dump_file_write(wfdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
- wfdh->bytes_dumped += 4;
+ wdh->bytes_dumped += 4;
/* Write the comments string */
pcapng_debug3("pcapng_write_section_header_block, comment:'%s' comment_len %u comment_pad_len %u" , wdh->shb_hdr->opt_comment, comment_len, comment_pad_len);
- if (!wftap_dump_file_write(wfdh, wdh->shb_hdr->opt_comment, comment_len, err))
+ if (!wtap_dump_file_write(wdh, wdh->shb_hdr->opt_comment, comment_len, err))
return FALSE;
- wfdh->bytes_dumped += comment_len;
+ wdh->bytes_dumped += comment_len;
/* write padding (if any) */
if (comment_pad_len != 0) {
- if (!wftap_dump_file_write(wfdh, &zero_pad, comment_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, comment_pad_len, err))
return FALSE;
- wfdh->bytes_dumped += comment_pad_len;
+ wdh->bytes_dumped += comment_pad_len;
}
}
if (shb_hardware_len) {
option_hdr.type = OPT_SHB_HARDWARE;
option_hdr.value_length = shb_hardware_len;
- if (!wftap_dump_file_write(wfdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
- wfdh->bytes_dumped += 4;
+ wdh->bytes_dumped += 4;
/* Write the string */
pcapng_debug3("pcapng_write_section_header_block, shb_hardware:'%s' shb_hardware_len %u shb_hardware_pad_len %u" , wdh->shb_hdr->shb_hardware, shb_hardware_len, shb_hardware_pad_len);
- if (!wftap_dump_file_write(wfdh, wdh->shb_hdr->shb_hardware, shb_hardware_len, err))
+ if (!wtap_dump_file_write(wdh, wdh->shb_hdr->shb_hardware, shb_hardware_len, err))
return FALSE;
- wfdh->bytes_dumped += shb_hardware_len;
+ wdh->bytes_dumped += shb_hardware_len;
/* write padding (if any) */
if (shb_hardware_pad_len != 0) {
- if (!wftap_dump_file_write(wfdh, &zero_pad, shb_hardware_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, shb_hardware_pad_len, err))
return FALSE;
- wfdh->bytes_dumped += shb_hardware_pad_len;
+ wdh->bytes_dumped += shb_hardware_pad_len;
}
}
if (shb_os_len) {
option_hdr.type = OPT_SHB_OS;
option_hdr.value_length = shb_os_len;
- if (!wftap_dump_file_write(wfdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
- wfdh->bytes_dumped += 4;
+ wdh->bytes_dumped += 4;
/* Write the string */
pcapng_debug3("pcapng_write_section_header_block, shb_os:'%s' shb_os_len %u shb_os_pad_len %u" , wdh->shb_hdr->shb_os, shb_os_len, shb_os_pad_len);
- if (!wftap_dump_file_write(wfdh, wdh->shb_hdr->shb_os, shb_os_len, err))
+ if (!wtap_dump_file_write(wdh, wdh->shb_hdr->shb_os, shb_os_len, err))
return FALSE;
- wfdh->bytes_dumped += shb_os_len;
+ wdh->bytes_dumped += shb_os_len;
/* write padding (if any) */
if (shb_os_pad_len != 0) {
- if (!wftap_dump_file_write(wfdh, &zero_pad, shb_os_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, shb_os_pad_len, err))
return FALSE;
- wfdh->bytes_dumped += shb_os_pad_len;
+ wdh->bytes_dumped += shb_os_pad_len;
}
}
if (shb_user_appl_len) {
option_hdr.type = OPT_SHB_USERAPPL;
option_hdr.value_length = shb_user_appl_len;
- if (!wftap_dump_file_write(wfdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
- wfdh->bytes_dumped += 4;
+ wdh->bytes_dumped += 4;
/* Write the comments string */
pcapng_debug3("pcapng_write_section_header_block, shb_user_appl:'%s' shb_user_appl_len %u shb_user_appl_pad_len %u" , wdh->shb_hdr->shb_user_appl, shb_user_appl_len, shb_user_appl_pad_len);
- if (!wftap_dump_file_write(wfdh, wdh->shb_hdr->shb_user_appl, shb_user_appl_len, err))
+ if (!wtap_dump_file_write(wdh, wdh->shb_hdr->shb_user_appl, shb_user_appl_len, err))
return FALSE;
- wfdh->bytes_dumped += shb_user_appl_len;
+ wdh->bytes_dumped += shb_user_appl_len;
/* write padding (if any) */
if (shb_user_appl_pad_len != 0) {
- if (!wftap_dump_file_write(wfdh, &zero_pad, shb_user_appl_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, shb_user_appl_pad_len, err))
return FALSE;
- wfdh->bytes_dumped += shb_user_appl_pad_len;
+ wdh->bytes_dumped += shb_user_appl_pad_len;
}
}
@@ -2620,16 +2616,16 @@ pcapng_write_section_header_block(wftap_dumper *wfdh, int *err)
if (have_options) {
option_hdr.type = OPT_EOFOPT;
option_hdr.value_length = 0;
- if (!wftap_dump_file_write(wfdh, &zero_pad, 4, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, 4, err))
return FALSE;
- wfdh->bytes_dumped += 4;
+ wdh->bytes_dumped += 4;
}
/* write block footer */
- if (!wftap_dump_file_write(wfdh, &bh.block_total_length,
+ if (!wtap_dump_file_write(wdh, &bh.block_total_length,
sizeof bh.block_total_length, err))
return FALSE;
- wfdh->bytes_dumped += sizeof bh.block_total_length;
+ wdh->bytes_dumped += sizeof bh.block_total_length;
return TRUE;
}
@@ -2642,7 +2638,7 @@ pcapng_write_section_header_block(wftap_dumper *wfdh, int *err)
#define IDB_OPT_IF_OS 12
static gboolean
-pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int *err)
+pcapng_write_if_descr_block(wtap_dumper *wdh, wtapng_if_descr_t *int_data, int *err)
{
pcapng_block_header_t bh;
pcapng_interface_description_block_t idb;
@@ -2773,7 +2769,7 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
bh.block_type = BLOCK_TYPE_IDB;
bh.block_total_length = (guint32)(sizeof(bh) + sizeof(idb) + options_total_length + 4);
- if (!wftap_dump_file_write(wdh, &bh, sizeof bh, err))
+ if (!wtap_dump_file_write(wdh, &bh, sizeof bh, err))
return FALSE;
wdh->bytes_dumped += sizeof bh;
@@ -2782,7 +2778,7 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
idb.reserved = 0;
idb.snaplen = int_data->snap_len;
- if (!wftap_dump_file_write(wdh, &idb, sizeof idb, err))
+ if (!wtap_dump_file_write(wdh, &idb, sizeof idb, err))
return FALSE;
wdh->bytes_dumped += sizeof idb;
@@ -2790,19 +2786,19 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
if (comment_len != 0) {
option_hdr.type = OPT_COMMENT;
option_hdr.value_length = comment_len;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write the comments string */
pcapng_debug3("pcapng_write_if_descr_block, comment:'%s' comment_len %u comment_pad_len %u" , int_data->opt_comment, comment_len, comment_pad_len);
- if (!wftap_dump_file_write(wdh, int_data->opt_comment, comment_len, err))
+ if (!wtap_dump_file_write(wdh, int_data->opt_comment, comment_len, err))
return FALSE;
wdh->bytes_dumped += comment_len;
/* write padding (if any) */
if (comment_pad_len != 0) {
- if (!wftap_dump_file_write(wdh, &zero_pad, comment_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, comment_pad_len, err))
return FALSE;
wdh->bytes_dumped += comment_pad_len;
}
@@ -2813,19 +2809,19 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
if (if_name_len !=0) {
option_hdr.type = IDB_OPT_IF_NAME;
option_hdr.value_length = if_name_len;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write the comments string */
pcapng_debug3("pcapng_write_if_descr_block, if_name:'%s' if_name_len %u if_name_pad_len %u" , int_data->if_name, if_name_len, if_name_pad_len);
- if (!wftap_dump_file_write(wdh, int_data->if_name, if_name_len, err))
+ if (!wtap_dump_file_write(wdh, int_data->if_name, if_name_len, err))
return FALSE;
wdh->bytes_dumped += if_name_len;
/* write padding (if any) */
if (if_name_pad_len != 0) {
- if (!wftap_dump_file_write(wdh, &zero_pad, if_name_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, if_name_pad_len, err))
return FALSE;
wdh->bytes_dumped += if_name_pad_len;
}
@@ -2836,19 +2832,19 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
if (if_description_len != 0) {
option_hdr.type = IDB_OPT_IF_NAME;
option_hdr.value_length = if_description_len;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write the comments string */
pcapng_debug3("pcapng_write_if_descr_block, if_description:'%s' if_description_len %u if_description_pad_len %u" , int_data->if_description, if_description_len, if_description_pad_len);
- if (!wftap_dump_file_write(wdh, int_data->if_description, if_description_len, err))
+ if (!wtap_dump_file_write(wdh, int_data->if_description, if_description_len, err))
return FALSE;
wdh->bytes_dumped += if_description_len;
/* write padding (if any) */
if (if_description_pad_len != 0) {
- if (!wftap_dump_file_write(wdh, &zero_pad, if_description_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, if_description_pad_len, err))
return FALSE;
wdh->bytes_dumped += if_description_pad_len;
}
@@ -2865,13 +2861,13 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
if (int_data->if_speed != 0) {
option_hdr.type = IDB_OPT_IF_SPEED;
option_hdr.value_length = 8;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write the comments string */
pcapng_debug1("pcapng_write_if_descr_block: if_speed %" G_GINT64_MODIFIER "u (bps)", int_data->if_speed);
- if (!wftap_dump_file_write(wdh, &int_data->if_speed, sizeof(guint64), err))
+ if (!wtap_dump_file_write(wdh, &int_data->if_speed, sizeof(guint64), err))
return FALSE;
wdh->bytes_dumped += 8;
}
@@ -2884,16 +2880,16 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
if (int_data->if_tsresol != 0) {
option_hdr.type = IDB_OPT_IF_TSRESOL;
option_hdr.value_length = 1;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write the time stamp resolution */
pcapng_debug1("pcapng_write_if_descr_block: if_tsresol %u", int_data->if_tsresol);
- if (!wftap_dump_file_write(wdh, &int_data->if_tsresol, 1, err))
+ if (!wtap_dump_file_write(wdh, &int_data->if_tsresol, 1, err))
return FALSE;
wdh->bytes_dumped += 1;
- if (!wftap_dump_file_write(wdh, &zero_pad, 3, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, 3, err))
return FALSE;
wdh->bytes_dumped += 3;
}
@@ -2908,25 +2904,25 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
option_hdr.type = IDB_OPT_IF_FILTER;
option_hdr.value_length = if_filter_str_len;
/* if_filter_str_len includes the leading byte indicating filter type (libpcap str or BPF code) */
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write the zero indicating libpcap filter variant */
- if (!wftap_dump_file_write(wdh, &zero_pad, 1, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, 1, err))
return FALSE;
wdh->bytes_dumped += 1;
/* Write the comments string */
pcapng_debug3("pcapng_write_if_descr_block, if_filter_str:'%s' if_filter_str_len %u if_filter_str_pad_len %u" , int_data->if_filter_str, if_filter_str_len, if_filter_str_pad_len);
/* if_filter_str_len includes the leading byte indicating filter type (libpcap str or BPF code) */
- if (!wftap_dump_file_write(wdh, int_data->if_filter_str, if_filter_str_len-1, err))
+ if (!wtap_dump_file_write(wdh, int_data->if_filter_str, if_filter_str_len-1, err))
return FALSE;
wdh->bytes_dumped += if_filter_str_len - 1;
/* write padding (if any) */
if (if_filter_str_pad_len != 0) {
- if (!wftap_dump_file_write(wdh, &zero_pad, if_filter_str_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, if_filter_str_pad_len, err))
return FALSE;
wdh->bytes_dumped += if_filter_str_pad_len;
}
@@ -2937,19 +2933,19 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
if (if_os_len != 0) {
option_hdr.type = IDB_OPT_IF_OS;
option_hdr.value_length = if_os_len;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write the comments string */
pcapng_debug3("pcapng_write_if_descr_block, if_os:'%s' if_os_len %u if_os_pad_len %u" , int_data->if_os, if_os_len, if_os_pad_len);
- if (!wftap_dump_file_write(wdh, int_data->if_os, if_os_len, err))
+ if (!wtap_dump_file_write(wdh, int_data->if_os, if_os_len, err))
return FALSE;
wdh->bytes_dumped += if_os_len;
/* write padding (if any) */
if (if_os_pad_len != 0) {
- if (!wftap_dump_file_write(wdh, &zero_pad, if_os_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, if_os_pad_len, err))
return FALSE;
wdh->bytes_dumped += if_os_pad_len;
}
@@ -2958,7 +2954,7 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
if (have_options) {
option_hdr.type = OPT_EOFOPT;
option_hdr.value_length = 0;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
}
@@ -2972,7 +2968,7 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
*/
/* write block footer */
- if (!wftap_dump_file_write(wdh, &bh.block_total_length,
+ if (!wtap_dump_file_write(wdh, &bh.block_total_length,
sizeof bh.block_total_length, err))
return FALSE;
wdh->bytes_dumped += sizeof bh.block_total_length;
@@ -2989,7 +2985,7 @@ pcapng_write_if_descr_block(wftap_dumper *wdh, wtapng_if_descr_t *int_data, int
#define ISB_USRDELIV 8
static gboolean
-pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if_stats, int *err)
+pcapng_write_interface_statistics_block(wtap_dumper *wdh, wtapng_if_stats_t *if_stats, int *err)
{
pcapng_block_header_t bh;
@@ -3061,7 +3057,7 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
bh.block_type = BLOCK_TYPE_ISB;
bh.block_total_length = (guint32)(sizeof(bh) + sizeof(isb) + options_total_length + 4);
- if (!wftap_dump_file_write(wdh, &bh, sizeof bh, err))
+ if (!wtap_dump_file_write(wdh, &bh, sizeof bh, err))
return FALSE;
wdh->bytes_dumped += sizeof bh;
@@ -3071,7 +3067,7 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
isb.timestamp_low = if_stats->ts_low;
- if (!wftap_dump_file_write(wdh, &isb, sizeof isb, err))
+ if (!wtap_dump_file_write(wdh, &isb, sizeof isb, err))
return FALSE;
wdh->bytes_dumped += sizeof isb;
@@ -3079,19 +3075,19 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
if (comment_len) {
option_hdr.type = OPT_COMMENT;
option_hdr.value_length = comment_len;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write the comments string */
pcapng_debug3("pcapng_write_interface_statistics_block, comment:'%s' comment_len %u comment_pad_len %u" , if_stats->opt_comment, comment_len, comment_pad_len);
- if (!wftap_dump_file_write(wdh, if_stats->opt_comment, comment_len, err))
+ if (!wtap_dump_file_write(wdh, if_stats->opt_comment, comment_len, err))
return FALSE;
wdh->bytes_dumped += comment_len;
/* write padding (if any) */
if (comment_pad_len != 0) {
- if (!wftap_dump_file_write(wdh, &zero_pad, comment_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, comment_pad_len, err))
return FALSE;
wdh->bytes_dumped += comment_pad_len;
}
@@ -3104,16 +3100,16 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
option_hdr.value_length = 8;
high = (guint32)((if_stats->isb_starttime>>32) & 0xffffffff);
low = (guint32)(if_stats->isb_starttime & 0xffffffff);
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write isb_starttime */
pcapng_debug1("pcapng_write_interface_statistics_block, isb_starttime: %" G_GINT64_MODIFIER "u" , if_stats->isb_starttime);
- if (!wftap_dump_file_write(wdh, &high, 4, err))
+ if (!wtap_dump_file_write(wdh, &high, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
- if (!wftap_dump_file_write(wdh, &low, 4, err))
+ if (!wtap_dump_file_write(wdh, &low, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
}
@@ -3125,16 +3121,16 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
option_hdr.value_length = 8;
high = (guint32)((if_stats->isb_endtime>>32) & 0xffffffff);
low = (guint32)(if_stats->isb_endtime & 0xffffffff);
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write isb_endtime */
pcapng_debug1("pcapng_write_interface_statistics_block, isb_starttime: %" G_GINT64_MODIFIER "u" , if_stats->isb_endtime);
- if (!wftap_dump_file_write(wdh, &high, 4, err))
+ if (!wtap_dump_file_write(wdh, &high, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
- if (!wftap_dump_file_write(wdh, &low, 4, err))
+ if (!wtap_dump_file_write(wdh, &low, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
}
@@ -3142,13 +3138,13 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
if (if_stats->isb_ifrecv != G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF)) {
option_hdr.type = ISB_IFRECV;
option_hdr.value_length = 8;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write isb_ifrecv */
pcapng_debug1("pcapng_write_interface_statistics_block, isb_ifrecv: %" G_GINT64_MODIFIER "u" , if_stats->isb_ifrecv);
- if (!wftap_dump_file_write(wdh, &if_stats->isb_ifrecv, 8, err))
+ if (!wtap_dump_file_write(wdh, &if_stats->isb_ifrecv, 8, err))
return FALSE;
wdh->bytes_dumped += 8;
}
@@ -3156,13 +3152,13 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
if (if_stats->isb_ifdrop != G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF)) {
option_hdr.type = ISB_IFDROP;
option_hdr.value_length = 8;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write isb_ifdrop */
pcapng_debug1("pcapng_write_interface_statistics_block, isb_ifdrop: %" G_GINT64_MODIFIER "u" , if_stats->isb_ifdrop);
- if (!wftap_dump_file_write(wdh, &if_stats->isb_ifdrop, 8, err))
+ if (!wtap_dump_file_write(wdh, &if_stats->isb_ifdrop, 8, err))
return FALSE;
wdh->bytes_dumped += 8;
}
@@ -3170,13 +3166,13 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
if (if_stats->isb_filteraccept != G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF)) {
option_hdr.type = ISB_FILTERACCEPT;
option_hdr.value_length = 8;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write isb_filteraccept */
pcapng_debug1("pcapng_write_interface_statistics_block, isb_filteraccept: %" G_GINT64_MODIFIER "u" , if_stats->isb_filteraccept);
- if (!wftap_dump_file_write(wdh, &if_stats->isb_filteraccept, 8, err))
+ if (!wtap_dump_file_write(wdh, &if_stats->isb_filteraccept, 8, err))
return FALSE;
wdh->bytes_dumped += 8;
}
@@ -3184,13 +3180,13 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
if (if_stats->isb_osdrop != G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF)) {
option_hdr.type = ISB_OSDROP;
option_hdr.value_length = 8;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write isb_osdrop */
pcapng_debug1("pcapng_write_interface_statistics_block, isb_osdrop: %" G_GINT64_MODIFIER "u" , if_stats->isb_osdrop);
- if (!wftap_dump_file_write(wdh, &if_stats->isb_osdrop, 8, err))
+ if (!wtap_dump_file_write(wdh, &if_stats->isb_osdrop, 8, err))
return FALSE;
wdh->bytes_dumped += 8;
}
@@ -3198,13 +3194,13 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
if (if_stats->isb_usrdeliv != G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF)) {
option_hdr.type = ISB_USRDELIV;
option_hdr.value_length = 8;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
/* Write isb_usrdeliv */
pcapng_debug1("pcapng_write_interface_statistics_block, isb_usrdeliv: %" G_GINT64_MODIFIER "u" , if_stats->isb_usrdeliv);
- if (!wftap_dump_file_write(wdh, &if_stats->isb_usrdeliv, 8, err))
+ if (!wtap_dump_file_write(wdh, &if_stats->isb_usrdeliv, 8, err))
return FALSE;
wdh->bytes_dumped += 8;
}
@@ -3212,13 +3208,13 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
if (have_options) {
option_hdr.type = OPT_EOFOPT;
option_hdr.value_length = 0;
- if (!wftap_dump_file_write(wdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
}
/* write block footer */
- if (!wftap_dump_file_write(wdh, &bh.block_total_length,
+ if (!wtap_dump_file_write(wdh, &bh.block_total_length,
sizeof bh.block_total_length, err))
return FALSE;
wdh->bytes_dumped += sizeof bh.block_total_length;
@@ -3229,7 +3225,7 @@ pcapng_write_interface_statistics_block(wftap_dumper *wdh, wtapng_if_stats_t *if
static gboolean
-pcapng_write_enhanced_packet_block(wftap_dumper *wfdh,
+pcapng_write_enhanced_packet_block(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const union wtap_pseudo_header *pseudo_header, const guint8 *pd, int *err)
{
@@ -3244,13 +3240,12 @@ pcapng_write_enhanced_packet_block(wftap_dumper *wfdh,
struct option option_hdr;
guint32 comment_len = 0, comment_pad_len = 0;
wtapng_if_descr_t int_data;
- wtap_dumper* wdh = (wtap_dumper*)wfdh->tap_specific_data;
- /* Don't write anything we're not willing to read. */
- if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
- *err = WTAP_ERR_PACKET_TOO_LARGE;
- return FALSE;
- }
+ /* Don't write anything we're not willing to read. */
+ if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
+ *err = WTAP_ERR_PACKET_TOO_LARGE;
+ return FALSE;
+ }
phdr_len = (guint32)pcap_get_phdr_size(phdr->pkt_encap, pseudo_header);
if ((phdr_len + phdr->caplen) % 4) {
@@ -3283,9 +3278,9 @@ pcapng_write_enhanced_packet_block(wftap_dumper *wfdh,
bh.block_type = BLOCK_TYPE_EPB;
bh.block_total_length = (guint32)sizeof(bh) + (guint32)sizeof(epb) + phdr_len + phdr->caplen + pad_len + options_total_length + 4;
- if (!wftap_dump_file_write(wfdh, &bh, sizeof bh, err))
+ if (!wtap_dump_file_write(wdh, &bh, sizeof bh, err))
return FALSE;
- wfdh->bytes_dumped += sizeof bh;
+ wdh->bytes_dumped += sizeof bh;
/* write block fixed content */
if (phdr->presence_flags & WTAP_HAS_INTERFACE_ID)
@@ -3318,26 +3313,26 @@ pcapng_write_enhanced_packet_block(wftap_dumper *wfdh,
epb.captured_len = phdr->caplen + phdr_len;
epb.packet_len = phdr->len + phdr_len;
- if (!wftap_dump_file_write(wfdh, &epb, sizeof epb, err))
+ if (!wtap_dump_file_write(wdh, &epb, sizeof epb, err))
return FALSE;
- wfdh->bytes_dumped += sizeof epb;
+ wdh->bytes_dumped += sizeof epb;
/* write pseudo header */
- if (!pcap_write_phdr(wfdh, phdr->pkt_encap, pseudo_header, err)) {
+ if (!pcap_write_phdr(wdh, phdr->pkt_encap, pseudo_header, err)) {
return FALSE;
}
- wfdh->bytes_dumped += phdr_len;
+ wdh->bytes_dumped += phdr_len;
/* write packet data */
- if (!wftap_dump_file_write(wfdh, pd, phdr->caplen, err))
+ if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
return FALSE;
- wfdh->bytes_dumped += phdr->caplen;
+ wdh->bytes_dumped += phdr->caplen;
/* write padding (if any) */
if (pad_len != 0) {
- if (!wftap_dump_file_write(wfdh, &zero_pad, pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, pad_len, err))
return FALSE;
- wfdh->bytes_dumped += pad_len;
+ wdh->bytes_dumped += pad_len;
}
/* XXX - write (optional) block options */
@@ -3364,21 +3359,21 @@ pcapng_write_enhanced_packet_block(wftap_dumper *wfdh,
if (phdr->opt_comment) {
option_hdr.type = OPT_COMMENT;
option_hdr.value_length = comment_len;
- if (!wftap_dump_file_write(wfdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
- wfdh->bytes_dumped += 4;
+ wdh->bytes_dumped += 4;
/* Write the comments string */
pcapng_debug3("pcapng_write_enhanced_packet_block, comment:'%s' comment_len %u comment_pad_len %u" , phdr->opt_comment, comment_len, comment_pad_len);
- if (!wftap_dump_file_write(wfdh, phdr->opt_comment, comment_len, err))
+ if (!wtap_dump_file_write(wdh, phdr->opt_comment, comment_len, err))
return FALSE;
- wfdh->bytes_dumped += comment_len;
+ wdh->bytes_dumped += comment_len;
/* write padding (if any) */
if (comment_pad_len != 0) {
- if (!wftap_dump_file_write(wfdh, &zero_pad, comment_pad_len, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, comment_pad_len, err))
return FALSE;
- wfdh->bytes_dumped += comment_pad_len;
+ wdh->bytes_dumped += comment_pad_len;
}
pcapng_debug2("pcapng_write_enhanced_packet_block: Wrote Options comments: comment_len %u, comment_pad_len %u",
@@ -3388,26 +3383,26 @@ pcapng_write_enhanced_packet_block(wftap_dumper *wfdh,
if (phdr->presence_flags & WTAP_HAS_PACK_FLAGS) {
option_hdr.type = OPT_EPB_FLAGS;
option_hdr.value_length = 4;
- if (!wftap_dump_file_write(wfdh, &option_hdr, 4, err))
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
- wfdh->bytes_dumped += 4;
- if (!wftap_dump_file_write(wfdh, &phdr->pack_flags, 4, err))
+ wdh->bytes_dumped += 4;
+ if (!wtap_dump_file_write(wdh, &phdr->pack_flags, 4, err))
return FALSE;
- wfdh->bytes_dumped += 4;
+ wdh->bytes_dumped += 4;
pcapng_debug1("pcapng_write_enhanced_packet_block: Wrote Options packet flags: %x", phdr->pack_flags);
}
/* Write end of options if we have otions */
if (have_options) {
- if (!wftap_dump_file_write(wfdh, &zero_pad, 4, err))
+ if (!wtap_dump_file_write(wdh, &zero_pad, 4, err))
return FALSE;
- wfdh->bytes_dumped += 4;
+ wdh->bytes_dumped += 4;
}
/* write block footer */
- if (!wftap_dump_file_write(wfdh, &bh.block_total_length,
+ if (!wtap_dump_file_write(wdh, &bh.block_total_length,
sizeof bh.block_total_length, err))
return FALSE;
- wfdh->bytes_dumped += sizeof bh.block_total_length;
+ wdh->bytes_dumped += sizeof bh.block_total_length;
return TRUE;
}
@@ -3415,7 +3410,7 @@ pcapng_write_enhanced_packet_block(wftap_dumper *wfdh,
/* Arbitrary. */
#define NRES_REC_MAX_SIZE ((WTAP_MAX_PACKET_SIZE * 4) + 16)
static gboolean
-pcapng_write_name_resolution_block(wftap_dumper *wfdh, int *err)
+pcapng_write_name_resolution_block(wtap_dumper *wdh, int *err)
{
pcapng_block_header_t bh;
pcapng_name_resolution_block_t nrb;
@@ -3424,7 +3419,6 @@ pcapng_write_name_resolution_block(wftap_dumper *wfdh, int *err)
hashipv4_t *ipv4_hash_list_entry;
hashipv6_t *ipv6_hash_list_entry;
int i;
- wtap_dumper* wdh = (wtap_dumper*)wfdh->tap_specific_data;
if ((!wdh->addrinfo_lists) || ((!wdh->addrinfo_lists->ipv4_addr_list)&&(!wdh->addrinfo_lists->ipv6_addr_list))) {
return TRUE;
@@ -3457,11 +3451,11 @@ pcapng_write_name_resolution_block(wftap_dumper *wfdh, int *err)
pcapng_debug2("pcapng_write_name_resolution_block: Write bh.block_total_length bytes %d, rec_off %u", bh.block_total_length, rec_off);
- if (!wftap_dump_file_write(wfdh, rec_data, bh.block_total_length, err)) {
+ if (!wtap_dump_file_write(wdh, rec_data, bh.block_total_length, err)) {
g_free(rec_data);
return FALSE;
}
- wfdh->bytes_dumped += bh.block_total_length;
+ wdh->bytes_dumped += bh.block_total_length;
/*Start a new NRB */
rec_off = 8; /* block type + block total length */
@@ -3511,11 +3505,11 @@ pcapng_write_name_resolution_block(wftap_dumper *wfdh, int *err)
pcapng_debug2("pcapng_write_name_resolution_block: Write bh.block_total_length bytes %d, rec_off %u", bh.block_total_length, rec_off);
- if (!wftap_dump_file_write(wfdh, rec_data, bh.block_total_length, err)) {
+ if (!wtap_dump_file_write(wdh, rec_data, bh.block_total_length, err)) {
g_free(rec_data);
return FALSE;
}
- wfdh->bytes_dumped += bh.block_total_length;
+ wdh->bytes_dumped += bh.block_total_length;
/*Start a new NRB */
rec_off = 8; /* block type + block total length */
@@ -3553,13 +3547,13 @@ pcapng_write_name_resolution_block(wftap_dumper *wfdh, int *err)
pcapng_debug2("pcapng_write_name_resolution_block: Write bh.block_total_length bytes %d, rec_off %u", bh.block_total_length, rec_off);
- if (!wftap_dump_file_write(wfdh, rec_data, bh.block_total_length, err)) {
+ if (!wtap_dump_file_write(wdh, rec_data, bh.block_total_length, err)) {
g_free(rec_data);
return FALSE;
}
g_free(rec_data);
- wfdh->bytes_dumped += bh.block_total_length;
+ wdh->bytes_dumped += bh.block_total_length;
return TRUE;
}
@@ -3581,7 +3575,7 @@ pcapng_lookup_interface_id_by_encap(int wtap_encap, wtap_dumper *wdh)
}
#endif
-static gboolean pcapng_dump(wftap_dumper *wdh,
+static gboolean pcapng_dump(wtap_dumper *wdh,
const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
@@ -3607,11 +3601,10 @@ static gboolean pcapng_dump(wftap_dumper *wdh,
/* Finish writing to a dump file.
Returns TRUE on success, FALSE on failure. */
-static gboolean pcapng_dump_close(wftap_dumper *wfdh, int *err _U_)
+static gboolean pcapng_dump_close(wtap_dumper *wdh, int *err _U_)
{
int i, j;
- pcapng_dump_t *pcapng = (pcapng_dump_t *)wfdh->priv;
- wtap_dumper* wdh = (wtap_dumper*)wfdh->tap_specific_data;
+ pcapng_dump_t *pcapng = (pcapng_dump_t *)wdh->priv;
if ((wdh->number_of_interfaces > 0) && (wdh->interface_data != NULL)) {
for (i = 0; i < (int)wdh->number_of_interfaces; i++) {
@@ -3625,7 +3618,7 @@ static gboolean pcapng_dump_close(wftap_dumper *wfdh, int *err _U_)
if_stats = g_array_index(int_data.interface_statistics, wtapng_if_stats_t, j);
pcapng_debug1("pcapng_dump_close: write ISB for interface %u",if_stats.interface_id);
- if (!pcapng_write_interface_statistics_block(wfdh, &if_stats, err)) {
+ if (!pcapng_write_interface_statistics_block(wdh, &if_stats, err)) {
return FALSE;
}
}
@@ -3642,19 +3635,18 @@ static gboolean pcapng_dump_close(wftap_dumper *wfdh, int *err _U_)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */
gboolean
-pcapng_dump_open(wftap_dumper *wfdh, int *err)
+pcapng_dump_open(wtap_dumper *wdh, int *err)
{
pcapng_dump_t *pcapng;
int i;
interface_data_t interface_data;
- wtap_dumper* wdh = (wtap_dumper*)wfdh->tap_specific_data;
pcapng_debug0("pcapng_dump_open");
/* This is a pcapng file */
- wfdh->subtype_write = pcapng_dump;
- wfdh->subtype_close = pcapng_dump_close;
+ wdh->subtype_write = pcapng_dump;
+ wdh->subtype_close = pcapng_dump_close;
pcapng = (pcapng_dump_t *)g_malloc0(sizeof(pcapng_dump_t));
- wfdh->priv = (void *)pcapng;
+ wdh->priv = (void *)pcapng;
pcapng->interface_data = g_array_new(FALSE, FALSE, sizeof(wtapng_if_descr_t));
if ((wdh->number_of_interfaces == 0) || (wdh->interface_data == NULL)) {
@@ -3664,7 +3656,7 @@ pcapng_dump_open(wftap_dumper *wfdh, int *err)
}
/* write the section header block */
- if (!pcapng_write_section_header_block(wfdh, err)) {
+ if (!pcapng_write_section_header_block(wdh, err)) {
return FALSE;
}
pcapng_debug0("pcapng_dump_open: wrote section header block.");
@@ -3685,7 +3677,7 @@ pcapng_dump_open(wftap_dumper *wfdh, int *err)
g_array_append_val(pcapng->interface_data, interface_data);
pcapng->number_of_interfaces++;
- if (!pcapng_write_if_descr_block(wfdh, &int_data, err)) {
+ if (!pcapng_write_if_descr_block(wdh, &int_data, err)) {
return FALSE;
}
@@ -3715,7 +3707,7 @@ pcapng_dump_open(wftap_dumper *wfdh, int *err)
wblock.file_encap = NULL;
wblock.type = BLOCK_TYPE_IDB;
wblock.data.if_descr.link_type = pcap_encap;
- wblock.data.if_descr.snap_len = (wfdh->snaplen != 0) ? wfdh->snaplen :
+ wblock.data.if_descr.snap_len = (wdh->snaplen != 0) ? wdh->snaplen :
WTAP_MAX_PACKET_SIZE; /* XXX */
/* XXX - options unused */
@@ -3724,7 +3716,7 @@ pcapng_dump_open(wftap_dumper *wfdh, int *err)
wblock.data.if_descr.if_os = NULL;
wblock.data.if_descr.if_fcslen = -1;
- if (!pcapng_write_if_descr_block(wfdh, &wblock, err)) {
+ if (!pcapng_write_if_descr_block(wdh, &wblock, err)) {
return FALSE;
}
diff --git a/wiretap/pcapng.h b/wiretap/pcapng.h
index b92c09367a..92c4ca1136 100644
--- a/wiretap/pcapng.h
+++ b/wiretap/pcapng.h
@@ -25,8 +25,8 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int pcapng_open(wftap *wfth, int *err, gchar **err_info);
-gboolean pcapng_dump_open(wftap_dumper *wdh, int *err);
+int pcapng_open(wtap *wth, int *err, gchar **err_info);
+gboolean pcapng_dump_open(wtap_dumper *wdh, int *err);
int pcapng_dump_can_write_encap(int encap);
#endif
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c
index 8794c090ef..a10ae66fd5 100644
--- a/wiretap/peekclassic.c
+++ b/wiretap/peekclassic.c
@@ -36,7 +36,6 @@
#include "config.h"
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -139,20 +138,20 @@ typedef struct {
struct timeval reference_time;
} peekclassic_t;
-static gboolean peekclassic_read_v7(wftap *wfth, int *err, gchar **err_info,
+static gboolean peekclassic_read_v7(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean peekclassic_seek_read_v7(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
-static int peekclassic_read_packet_v7(wftap *wfth, FILE_T fh,
+static gboolean peekclassic_seek_read_v7(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-static gboolean peekclassic_read_v56(wftap *wfth, int *err, gchar **err_info,
+static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean peekclassic_read_v56(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean peekclassic_seek_read_v56(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
-static gboolean peekclassic_read_packet_v56(wftap *wfth, FILE_T fh,
+static gboolean peekclassic_seek_read_v56(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean peekclassic_read_packet_v56(wtap *wth, FILE_T fh,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-int peekclassic_open(wftap *wfth, int *err, gchar **err_info)
+int peekclassic_open(wtap *wth, int *err, gchar **err_info)
{
peekclassic_header_t ep_hdr;
int bytes_read;
@@ -170,9 +169,9 @@ int peekclassic_open(wftap *wfth, int *err, gchar **err_info)
*/
g_assert(sizeof(ep_hdr.master) == PEEKCLASSIC_MASTER_HDR_SIZE);
bytes_read = file_read(&ep_hdr.master, (int)sizeof(ep_hdr.master),
- wfth->fh);
+ wth->fh);
if (bytes_read != sizeof(ep_hdr.master)) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -202,9 +201,9 @@ int peekclassic_open(wftap *wfth, int *err, gchar **err_info)
g_assert(sizeof(ep_hdr.secondary.v567) ==
PEEKCLASSIC_V567_HDR_SIZE);
bytes_read = file_read(&ep_hdr.secondary.v567,
- (int)sizeof(ep_hdr.secondary.v567), wfth->fh);
+ (int)sizeof(ep_hdr.secondary.v567), wth->fh);
if (bytes_read != sizeof(ep_hdr.secondary.v567)) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -325,27 +324,27 @@ int peekclassic_open(wftap *wfth, int *err, gchar **err_info)
* the whole ep_hdr structure in host byte order.
*/
peekclassic = (peekclassic_t *)g_malloc(sizeof(peekclassic_t));
- wfth->priv = (void *)peekclassic;
+ wth->priv = (void *)peekclassic;
peekclassic->reference_time = reference_time;
switch (ep_hdr.master.version) {
case 5:
case 6:
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V56;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V56;
/*
* XXX - can we get the file encapsulation from the
* header in the same way we do for V7 files?
*/
- wfth->file_encap = WTAP_ENCAP_PER_PACKET;
- wfth->subtype_read = peekclassic_read_v56;
- wfth->subtype_seek_read = peekclassic_seek_read_v56;
+ wth->file_encap = WTAP_ENCAP_PER_PACKET;
+ wth->subtype_read = peekclassic_read_v56;
+ wth->subtype_seek_read = peekclassic_seek_read_v56;
break;
case 7:
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V7;
- wfth->file_encap = file_encap;
- wfth->subtype_read = peekclassic_read_v7;
- wfth->subtype_seek_read = peekclassic_seek_read_v7;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V7;
+ wth->file_encap = file_encap;
+ wth->subtype_read = peekclassic_read_v7;
+ wth->subtype_seek_read = peekclassic_seek_read_v7;
break;
default:
@@ -353,52 +352,49 @@ int peekclassic_open(wftap *wfth, int *err, gchar **err_info)
g_assert_not_reached();
}
- wfth->snapshot_length = 0; /* not available in header */
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->snapshot_length = 0; /* not available in header */
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
-static gboolean peekclassic_read_v7(wftap *wfth, int *err, gchar **err_info,
+static gboolean peekclassic_read_v7(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
int sliceLength;
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* Read the packet. */
- sliceLength = peekclassic_read_packet_v7(wfth, wfth->fh, &wth->phdr,
- wfth->frame_buffer, err, err_info);
+ sliceLength = peekclassic_read_packet_v7(wth, wth->fh, &wth->phdr,
+ wth->frame_buffer, err, err_info);
if (sliceLength < 0)
return FALSE;
/* Skip extra ignored data at the end of the packet. */
if ((guint32)sliceLength > wth->phdr.caplen) {
- if (!file_skip(wfth->fh, sliceLength - wth->phdr.caplen, err))
+ if (!file_skip(wth->fh, sliceLength - wth->phdr.caplen, err))
return FALSE;
}
/* Records are padded to an even length, so if the slice length
is odd, read the padding byte. */
if (sliceLength & 0x01) {
- if (!file_skip(wfth->fh, 1, err))
+ if (!file_skip(wth->fh, 1, err))
return FALSE;
}
return TRUE;
}
-static gboolean peekclassic_seek_read_v7(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean peekclassic_seek_read_v7(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
-
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/* Read the packet. */
- if (peekclassic_read_packet_v7(wfth, wfth->random_fh, phdr, buf,
+ if (peekclassic_read_packet_v7(wth, wth->random_fh, phdr, buf,
err, err_info) == -1) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -407,7 +403,7 @@ static gboolean peekclassic_seek_read_v7(wftap *wfth, gint64 seek_off,
return TRUE;
}
-static int peekclassic_read_packet_v7(wftap *wfth, FILE_T fh,
+static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
guint8 ep_pkt[PEEKCLASSIC_V7_PKT_SIZE];
@@ -459,7 +455,7 @@ static int peekclassic_read_packet_v7(wftap *wfth, FILE_T fh,
phdr->len = length;
phdr->caplen = sliceLength;
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_IEEE_802_11_AIROPEEK:
phdr->pseudo_header.ieee_802_11.fcs_len = 0; /* no FCS */
@@ -497,15 +493,14 @@ static int peekclassic_read_packet_v7(wftap *wfth, FILE_T fh,
return sliceLength;
}
-static gboolean peekclassic_read_v56(wftap *wfth, int *err, gchar **err_info,
+static gboolean peekclassic_read_v56(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* read the packet */
- if (!peekclassic_read_packet_v56(wfth, wfth->fh, &wth->phdr,
- wfth->frame_buffer, err, err_info))
+ if (!peekclassic_read_packet_v56(wth, wth->fh, &wth->phdr,
+ wth->frame_buffer, err, err_info))
return FALSE;
/*
@@ -515,16 +510,14 @@ static gboolean peekclassic_read_v56(wftap *wfth, int *err, gchar **err_info,
return TRUE;
}
-static gboolean peekclassic_seek_read_v56(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+static gboolean peekclassic_seek_read_v56(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
-
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
/* read the packet */
- if (!peekclassic_read_packet_v56(wfth, wfth->random_fh, phdr, buf,
+ if (!peekclassic_read_packet_v56(wth, wth->random_fh, phdr, buf,
err, err_info)) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -533,10 +526,10 @@ static gboolean peekclassic_seek_read_v56(wftap *wfth, gint64 seek_off,
return TRUE;
}
-static gboolean peekclassic_read_packet_v56(wftap *wfth, FILE_T fh,
+static gboolean peekclassic_read_packet_v56(wtap *wth, FILE_T fh,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- peekclassic_t *peekclassic = (peekclassic_t *)wfth->priv;
+ peekclassic_t *peekclassic = (peekclassic_t *)wth->priv;
guint8 ep_pkt[PEEKCLASSIC_V56_PKT_SIZE];
guint16 length;
guint16 sliceLength;
diff --git a/wiretap/peekclassic.h b/wiretap/peekclassic.h
index 66fa9d7549..b3f4201252 100644
--- a/wiretap/peekclassic.h
+++ b/wiretap/peekclassic.h
@@ -26,6 +26,6 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int peekclassic_open(wftap *wfth, int *err, gchar **err_info);
+int peekclassic_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c
index 744df49ce9..05dc8beaef 100644
--- a/wiretap/peektagged.c
+++ b/wiretap/peektagged.c
@@ -34,7 +34,6 @@
#include <errno.h>
#include <string.h>
#include <stdlib.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -124,12 +123,12 @@ typedef struct {
gboolean has_fcs;
} peektagged_t;
-static gboolean peektagged_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean peektagged_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean peektagged_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean peektagged_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-static int wtap_file_read_pattern (wftap *wfth, const char *pattern, int *err,
+static int wtap_file_read_pattern (wtap *wth, const char *pattern, int *err,
gchar **err_info)
{
int c;
@@ -138,29 +137,29 @@ static int wtap_file_read_pattern (wftap *wfth, const char *pattern, int *err,
cp = pattern;
while (*cp)
{
- c = file_getc(wfth->fh);
- if (c == EOF)
- {
- *err = file_error(wfth->fh, err_info);
- if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
- return -1; /* error */
- return 0; /* EOF */
- }
- if (c == *cp)
- cp++;
- else
- {
- if (c == pattern[0])
- cp = &pattern[1];
- else
- cp = pattern;
- }
+ c = file_getc(wth->fh);
+ if (c == EOF)
+ {
+ *err = file_error(wth->fh, err_info);
+ if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
+ return -1; /* error */
+ return 0; /* EOF */
+ }
+ if (c == *cp)
+ cp++;
+ else
+ {
+ if (c == pattern[0])
+ cp = &pattern[1];
+ else
+ cp = pattern;
+ }
}
return (*cp == '\0' ? 1 : 0);
}
-static int wtap_file_read_till_separator (wftap *wfth, char *buffer, int buflen,
+static int wtap_file_read_till_separator (wtap *wth, char *buffer, int buflen,
const char *separators, int *err,
gchar **err_info)
{
@@ -170,27 +169,27 @@ static int wtap_file_read_till_separator (wftap *wfth, char *buffer, int buflen,
for (cp = buffer, i = 0; i < buflen; i++, cp++)
{
- c = file_getc(wfth->fh);
- if (c == EOF)
- {
- *err = file_error(wfth->fh, err_info);
- if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
- return -1; /* error */
- return 0; /* EOF */
- }
- if (strchr (separators, c) != NULL)
- {
- *cp = '\0';
- break;
- }
- else
- *cp = c;
+ c = file_getc(wth->fh);
+ if (c == EOF)
+ {
+ *err = file_error(wth->fh, err_info);
+ if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
+ return -1; /* error */
+ return 0; /* EOF */
+ }
+ if (strchr (separators, c) != NULL)
+ {
+ *cp = '\0';
+ break;
+ }
+ else
+ *cp = c;
}
return i;
}
-static int wtap_file_read_number (wftap *wfth, guint32 *num, int *err,
+static int wtap_file_read_number (wtap *wth, guint32 *num, int *err,
gchar **err_info)
{
int ret;
@@ -198,21 +197,22 @@ static int wtap_file_read_number (wftap *wfth, guint32 *num, int *err,
unsigned long value;
char *p;
- ret = wtap_file_read_till_separator (wfth, str_num, sizeof (str_num)-1, "<", err, err_info);
+ ret = wtap_file_read_till_separator (wth, str_num, sizeof (str_num)-1, "<",
+ err, err_info);
if (ret != 1) {
- /* 0 means EOF, which means "not a valid Peek tagged file";
- -1 means error, and "err" has been set. */
- return ret;
+ /* 0 means EOF, which means "not a valid Peek tagged file";
+ -1 means error, and "err" has been set. */
+ return ret;
}
value = strtoul (str_num, &p, 10);
if (p == str_num || value > G_MAXUINT32)
- return 0;
+ return 0;
*num = (guint32)value;
return 1;
}
-int peektagged_open(wftap *wfth, int *err, gchar **err_info)
+int peektagged_open(wtap *wth, int *err, gchar **err_info)
{
peektagged_section_header_t ap_hdr;
int bytes_read;
@@ -222,24 +222,24 @@ int peektagged_open(wftap *wfth, int *err, gchar **err_info)
guint32 mediaSubType = 0;
int file_encap;
static const int peektagged_encap[] = {
- WTAP_ENCAP_ETHERNET,
- WTAP_ENCAP_IEEE_802_11_WITH_RADIO,
- WTAP_ENCAP_IEEE_802_11_WITH_RADIO,
- WTAP_ENCAP_IEEE_802_11_WITH_RADIO
+ WTAP_ENCAP_ETHERNET,
+ WTAP_ENCAP_IEEE_802_11_WITH_RADIO,
+ WTAP_ENCAP_IEEE_802_11_WITH_RADIO,
+ WTAP_ENCAP_IEEE_802_11_WITH_RADIO
};
#define NUM_PEEKTAGGED_ENCAPS (sizeof peektagged_encap / sizeof peektagged_encap[0])
peektagged_t *peektagged;
- bytes_read = file_read(&ap_hdr, (int)sizeof(ap_hdr), wfth->fh);
+ bytes_read = file_read(&ap_hdr, (int)sizeof(ap_hdr), wth->fh);
if (bytes_read != (int)sizeof(ap_hdr)) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
if (memcmp (ap_hdr.section_id, "\177ver", sizeof(ap_hdr.section_id)) != 0)
- return 0; /* doesn't begin with a "\177ver" section */
+ return 0; /* doesn't begin with a "\177ver" section */
/*
* XXX - we should get the length of the "\177ver" section, check
@@ -249,13 +249,13 @@ int peektagged_open(wftap *wfth, int *err, gchar **err_info)
* we have the file version (and possibly check to make sure all
* tags are properly opened and closed).
*/
- ret = wtap_file_read_pattern (wfth, "<FileVersion>", err, err_info);
+ ret = wtap_file_read_pattern (wth, "<FileVersion>", err, err_info);
if (ret != 1) {
/* 0 means EOF, which means "not a valid Peek tagged file";
-1 means error, and "err" has been set. */
return ret;
}
- ret = wtap_file_read_number (wfth, &fileVersion, err, err_info);
+ ret = wtap_file_read_number (wth, &fileVersion, err, err_info);
if (ret != 1) {
/* 0 means EOF, which means "not a valid Peek tagged file";
-1 means error, and "err" has been set. */
@@ -281,88 +281,88 @@ int peektagged_open(wftap *wfth, int *err, gchar **err_info)
* we have the file version (and possibly check to make sure all
* tags are properly opened and closed).
*/
- ret = wtap_file_read_pattern (wfth, "<MediaType>", err, err_info);
+ ret = wtap_file_read_pattern (wth, "<MediaType>", err, err_info);
if (ret == -1)
- return -1;
+ return -1;
if (ret == 0) {
- *err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup("peektagged: <MediaType> tag not found");
- return -1;
+ *err = WTAP_ERR_BAD_FILE;
+ *err_info = g_strdup("peektagged: <MediaType> tag not found");
+ return -1;
}
/* XXX - this appears to be 0 in both the EtherPeek and AiroPeek
files we've seen; should we require it to be 0? */
- ret = wtap_file_read_number (wfth, &mediaType, err, err_info);
+ ret = wtap_file_read_number (wth, &mediaType, err, err_info);
if (ret == -1)
- return -1;
+ return -1;
if (ret == 0) {
- *err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup("peektagged: <MediaType> value not found");
- return -1;
+ *err = WTAP_ERR_BAD_FILE;
+ *err_info = g_strdup("peektagged: <MediaType> value not found");
+ return -1;
}
- ret = wtap_file_read_pattern (wfth, "<MediaSubType>", err, err_info);
+ ret = wtap_file_read_pattern (wth, "<MediaSubType>", err, err_info);
if (ret == -1)
- return -1;
+ return -1;
if (ret == 0) {
- *err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup("peektagged: <MediaSubType> tag not found");
- return -1;
+ *err = WTAP_ERR_BAD_FILE;
+ *err_info = g_strdup("peektagged: <MediaSubType> tag not found");
+ return -1;
}
- ret = wtap_file_read_number (wfth, &mediaSubType, err, err_info);
+ ret = wtap_file_read_number (wth, &mediaSubType, err, err_info);
if (ret == -1)
- return -1;
+ return -1;
if (ret == 0) {
- *err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup("peektagged: <MediaSubType> value not found");
- return -1;
+ *err = WTAP_ERR_BAD_FILE;
+ *err_info = g_strdup("peektagged: <MediaSubType> value not found");
+ return -1;
}
if (mediaSubType >= NUM_PEEKTAGGED_ENCAPS
|| peektagged_encap[mediaSubType] == WTAP_ENCAP_UNKNOWN) {
- *err = WTAP_ERR_UNSUPPORTED_ENCAP;
- *err_info = g_strdup_printf("peektagged: network type %u unknown or unsupported",
- mediaSubType);
- return -1;
+ *err = WTAP_ERR_UNSUPPORTED_ENCAP;
+ *err_info = g_strdup_printf("peektagged: network type %u unknown or unsupported",
+ mediaSubType);
+ return -1;
}
- ret = wtap_file_read_pattern (wfth, "pkts", err, err_info);
+ ret = wtap_file_read_pattern (wth, "pkts", err, err_info);
if (ret == -1)
- return -1;
+ return -1;
if (ret == 0) {
- *err = WTAP_ERR_SHORT_READ;
- return -1;
+ *err = WTAP_ERR_SHORT_READ;
+ return -1;
}
/* skip 8 zero bytes */
- if (file_seek (wfth->fh, 8L, SEEK_CUR, err) == -1)
- return 0;
+ if (file_seek (wth->fh, 8L, SEEK_CUR, err) == -1)
+ return 0;
/*
* This is an Peek tagged file.
*/
file_encap = peektagged_encap[mediaSubType];
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PEEKTAGGED;
- wfth->file_encap = file_encap;
- wfth->subtype_read = peektagged_read;
- wfth->subtype_seek_read = peektagged_seek_read;
- wfth->tsprecision = WTAP_FILE_TSPREC_NSEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PEEKTAGGED;
+ wth->file_encap = file_encap;
+ wth->subtype_read = peektagged_read;
+ wth->subtype_seek_read = peektagged_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
peektagged = (peektagged_t *)g_malloc(sizeof(peektagged_t));
- wfth->priv = (void *)peektagged;
+ wth->priv = (void *)peektagged;
switch (mediaSubType) {
case PEEKTAGGED_NST_ETHERNET:
case PEEKTAGGED_NST_802_11:
case PEEKTAGGED_NST_802_11_2:
- peektagged->has_fcs = FALSE;
- break;
+ peektagged->has_fcs = FALSE;
+ break;
case PEEKTAGGED_NST_802_11_WITH_FCS:
- peektagged->has_fcs = TRUE;
- break;
+ peektagged->has_fcs = TRUE;
+ break;
}
- wfth->snapshot_length = 0; /* not available in header */
+ wth->snapshot_length = 0; /* not available in header */
return 1;
}
@@ -394,10 +394,10 @@ typedef struct {
* are present.
*/
static int
-peektagged_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
+peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info)
{
- peektagged_t *peektagged = (peektagged_t *)wfth->priv;
+ peektagged_t *peektagged = (peektagged_t *)wth->priv;
hdr_info_t hdr_info;
int header_len = 0;
int bytes_read;
@@ -589,7 +589,7 @@ peektagged_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
phdr->ts.secs = (time_t) t;
phdr->ts.nsecs = (guint32) ((t - phdr->ts.secs)*1000000000);
- switch (wfth->file_encap) {
+ switch (wth->file_encap) {
case WTAP_ENCAP_IEEE_802_11_WITH_RADIO:
phdr->pseudo_header.ieee_802_11 = hdr_info.ieee_802_11;
@@ -633,43 +633,40 @@ peektagged_read_packet(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
return skip_len;
}
-static gboolean peektagged_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean peektagged_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset)
{
int skip_len;
- wtap* wth = (wtap*)wfth->tap_specific_data;
- *data_offset = file_tell(wfth->fh);
+ *data_offset = file_tell(wth->fh);
/* Read the packet. */
- skip_len = peektagged_read_packet(wfth, wfth->fh, &wth->phdr,
- wfth->frame_buffer, err, err_info);
+ skip_len = peektagged_read_packet(wth, wth->fh, &wth->phdr,
+ wth->frame_buffer, err, err_info);
if (skip_len == -1)
- return FALSE;
+ return FALSE;
if (skip_len != 0) {
- /* Skip extra junk at the end of the packet data. */
- if (!file_skip(wfth->fh, skip_len, err))
- return FALSE;
+ /* Skip extra junk at the end of the packet data. */
+ if (!file_skip(wth->fh, skip_len, err))
+ return FALSE;
}
return TRUE;
}
static gboolean
-peektagged_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info)
+peektagged_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
{
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
-
- if (file_seek(wfth->random_fh, seek_off, SEEK_SET, err) == -1)
- return FALSE;
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+ return FALSE;
/* Read the packet. */
- if (peektagged_read_packet(wfth, wfth->random_fh, phdr, buf, err, err_info) == -1) {
+ if (peektagged_read_packet(wth, wth->random_fh, phdr, buf, err, err_info) == -1) {
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
- return FALSE;
+ return FALSE;
}
return TRUE;
}
diff --git a/wiretap/peektagged.h b/wiretap/peektagged.h
index 15536504df..62a42306f9 100644
--- a/wiretap/peektagged.h
+++ b/wiretap/peektagged.h
@@ -23,6 +23,6 @@
#include <glib.h>
#include "ws_symbol_export.h"
-int peektagged_open(wftap *wfth, int *err, gchar **err_info);
+int peektagged_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c
index 79b41c83d4..6ba142485b 100644
--- a/wiretap/pppdump.c
+++ b/wiretap/pppdump.c
@@ -18,7 +18,6 @@
*/
#include "config.h"
-#include "wftap-int.h"
#include "wtap-int.h"
#include "buffer.h"
#include "pppdump.h"
@@ -96,10 +95,10 @@ typedef enum {
DIRECTION_RECV
} direction_enum;
-static gboolean pppdump_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean pppdump_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean pppdump_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
+static gboolean pppdump_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
/*
* Information saved about a packet, during the initial sequential pass
@@ -215,7 +214,7 @@ collate(pppdump_t*, FILE_T fh, int *err, gchar **err_info, guint8 *pd,
gint64 num_bytes_to_skip);
static void
-pppdump_close(wftap *wfth);
+pppdump_close(wtap *wth);
static void
init_state(pppdump_t *state)
@@ -244,7 +243,7 @@ init_state(pppdump_t *state)
int
-pppdump_open(wftap *wfth, int *err, gchar **err_info)
+pppdump_open(wtap *wth, int *err, gchar **err_info)
{
guint8 buffer[6]; /* Looking for: 0x07 t3 t2 t1 t0 ID */
int bytes_read;
@@ -258,9 +257,9 @@ pppdump_open(wftap *wfth, int *err, gchar **err_info)
* representing the timestamp.
*/
- bytes_read = file_read(buffer, sizeof(buffer), wfth->fh);
+ bytes_read = file_read(buffer, sizeof(buffer), wth->fh);
if (bytes_read != (int) sizeof(buffer)) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -281,32 +280,32 @@ pppdump_open(wftap *wfth, int *err, gchar **err_info)
my_file_type:
- if (file_seek(wfth->fh, 5, SEEK_SET, err) == -1)
+ if (file_seek(wth->fh, 5, SEEK_SET, err) == -1)
return -1;
state = (pppdump_t *)g_malloc(sizeof(pppdump_t));
- wfth->priv = (void *)state;
+ wth->priv = (void *)state;
state->timestamp = pntoh32(&buffer[1]);
state->tenths = 0;
init_state(state);
state->offset = 5;
- wfth->file_encap = WTAP_ENCAP_PPP_WITH_PHDR;
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PPPDUMP;
+ wth->file_encap = WTAP_ENCAP_PPP_WITH_PHDR;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PPPDUMP;
- wfth->snapshot_length = PPPD_BUF_SIZE; /* just guessing */
- wfth->subtype_read = pppdump_read;
- wfth->subtype_seek_read = pppdump_seek_read;
- wfth->subtype_close = pppdump_close;
- wfth->tsprecision = WTAP_FILE_TSPREC_DSEC;
+ wth->snapshot_length = PPPD_BUF_SIZE; /* just guessing */
+ wth->subtype_read = pppdump_read;
+ wth->subtype_seek_read = pppdump_seek_read;
+ wth->subtype_close = pppdump_close;
+ wth->tsprecision = WTAP_FILE_TSPREC_DSEC;
state->seek_state = g_new(pppdump_t,1);
/* If we have a random stream open, we're going to be reading
the file randomly; set up a GPtrArray of pointers to
information about how to retrieve the data for each packet. */
- if (wfth->random_fh != NULL)
+ if (wth->random_fh != NULL)
state->pids = g_ptr_array_new();
else
state->pids = NULL;
@@ -329,20 +328,19 @@ pppdump_set_phdr(struct wtap_pkthdr *phdr, int num_bytes,
/* Find the next packet and parse it; called from wtap_read(). */
static gboolean
-pppdump_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
+pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
int num_bytes;
direction_enum direction;
guint8 *buf;
pppdump_t *state;
pkt_id *pid;
- wtap* wth = (wtap*)wfth->tap_specific_data;
- state = (pppdump_t *)wfth->priv;
+ state = (pppdump_t *)wth->priv;
/* If we have a random stream open, allocate a structure to hold
the information needed to read this packet's data again. */
- if (wfth->random_fh != NULL) {
+ if (wth->random_fh != NULL) {
pid = g_new(pkt_id, 1);
if (!pid) {
*err = errno; /* assume a malloc failed and set "errno" */
@@ -352,12 +350,12 @@ pppdump_read(wftap *wfth, int *err, gchar **err_info, gint64 *data_offset)
} else
pid = NULL; /* sequential only */
- buffer_assure_space(wfth->frame_buffer, PPPD_BUF_SIZE);
- buf = buffer_start_ptr(wfth->frame_buffer);
+ buffer_assure_space(wth->frame_buffer, PPPD_BUF_SIZE);
+ buf = buffer_start_ptr(wth->frame_buffer);
- if (!collate(state, wfth->fh, err, err_info, buf, &num_bytes, &direction,
+ if (!collate(state, wth->fh, err, err_info, buf, &num_bytes, &direction,
pid, 0)) {
- if (pid != NULL)
+ if (pid != NULL)
g_free(pid);
return FALSE;
}
@@ -718,9 +716,9 @@ done:
/* Used to read packets in random-access fashion */
static gboolean
-pppdump_seek_read(wftap *wfth,
+pppdump_seek_read(wtap *wth,
gint64 seek_off,
- void* header,
+ struct wtap_pkthdr *phdr,
Buffer *buf,
int *err,
gchar **err_info)
@@ -731,9 +729,8 @@ pppdump_seek_read(wftap *wfth,
pppdump_t *state;
pkt_id *pid;
gint64 num_bytes_to_skip;
- struct wtap_pkthdr *phdr = (struct wtap_pkthdr *)header;
- state = (pppdump_t *)wfth->priv;
+ state = (pppdump_t *)wth->priv;
pid = (pkt_id *)g_ptr_array_index(state->pids, seek_off);
if (!pid) {
@@ -742,7 +739,7 @@ pppdump_seek_read(wftap *wfth,
return FALSE;
}
- if (file_seek(wfth->random_fh, pid->offset, SEEK_SET, err) == -1)
+ if (file_seek(wth->random_fh, pid->offset, SEEK_SET, err) == -1)
return FALSE;
init_state(state->seek_state);
@@ -764,7 +761,7 @@ pppdump_seek_read(wftap *wfth,
*/
num_bytes_to_skip = pid->num_bytes_to_skip;
do {
- if (!collate(state->seek_state, wfth->random_fh, err, err_info,
+ if (!collate(state->seek_state, wth->random_fh, err, err_info,
pd, &num_bytes, &direction, NULL, num_bytes_to_skip))
return FALSE;
num_bytes_to_skip = 0;
@@ -776,11 +773,11 @@ pppdump_seek_read(wftap *wfth,
}
static void
-pppdump_close(wftap *wfth)
+pppdump_close(wtap *wth)
{
pppdump_t *state;
- state = (pppdump_t *)wfth->priv;
+ state = (pppdump_t *)wth->priv;
if (state->seek_state) { /* should always be TRUE */
g_free(state->seek_state);
diff --git a/wiretap/pppdump.h b/wiretap/pppdump.h
index 40dc886c46..67ab1aaa02 100644
--- a/wiretap/pppdump.h
+++ b/wiretap/pppdump.h
@@ -25,6 +25,6 @@
#include <wtap.h>
#include "ws_symbol_export.h"
-int pppdump_open(wftap *wfth, int *err, gchar **err_info);
+int pppdump_open(wtap *wth, int *err, gchar **err_info);
#endif
diff --git a/wiretap/radcom.c b/wiretap/radcom.c
index 582c819f7f..e056cdd691 100644
--- a/wiretap/radcom.c
+++ b/wiretap/radcom.c
@@ -22,7 +22,6 @@
#include <errno.h>
#include <string.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -85,16 +84,16 @@ struct radcomrec_hdr {
char xxw[9]; /* unknown */
};
-static gboolean radcom_read(wftap *wfth, int *err, gchar **err_info,
+static gboolean radcom_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
-static gboolean radcom_seek_read(wftap *wfth, gint64 seek_off,
- void* header, Buffer *buf, int *err, gchar **err_info);
-static gboolean radcom_read_rec(wftap *wfth, FILE_T fh, struct wtap_pkthdr *phdr,
+static gboolean radcom_seek_read(wtap *wth, gint64 seek_off,
+ struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+static gboolean radcom_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err, gchar **err_info);
static gboolean radcom_read_rec_data(FILE_T fh, guint8 *pd, int length,
int *err, gchar **err_info);
-int radcom_open(wftap *wfth, int *err, gchar **err_info)
+int radcom_open(wtap *wth, int *err, gchar **err_info)
{
int bytes_read;
guint8 r_magic[8], t_magic[11], search_encap[7];
@@ -106,9 +105,9 @@ int radcom_open(wftap *wfth, int *err, gchar **err_info)
/* Read in the string that should be at the start of a RADCOM file */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(r_magic, 8, wfth->fh);
+ bytes_read = file_read(r_magic, 8, wth->fh);
if (bytes_read != 8) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
@@ -127,44 +126,45 @@ int radcom_open(wftap *wfth, int *err, gchar **err_info)
/* Look for the "Active Time" string. The "frame_date" structure should
* be located 32 bytes before the beginning of this string */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(t_magic, 11, wfth->fh);
+ bytes_read = file_read(t_magic, 11, wth->fh);
if (bytes_read != 11) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
while (memcmp(t_magic, active_time_magic, 11) != 0)
{
- if (file_seek(wfth->fh, -10, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, -10, SEEK_CUR, err) == -1)
return -1;
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(t_magic, 11, wfth->fh);
+ bytes_read = file_read(t_magic, 11, wth->fh);
if (bytes_read != 11) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
}
- if (file_seek(wfth->fh, -43, SEEK_CUR, err) == -1) return -1;
+ if (file_seek(wth->fh, -43, SEEK_CUR, err) == -1) return -1;
/* Get capture start time */
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(&start_date, sizeof(struct frame_date), wfth->fh);
+ bytes_read = file_read(&start_date, sizeof(struct frame_date),
+ wth->fh);
if (bytes_read != sizeof(struct frame_date)) {
- *err = file_error(wfth->fh, err_info);
+ *err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
/* This is a radcom file */
- wfth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_RADCOM;
- wfth->subtype_read = radcom_read;
- wfth->subtype_seek_read = radcom_seek_read;
- wfth->snapshot_length = 0; /* not available in header, only in frame */
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_RADCOM;
+ wth->subtype_read = radcom_read;
+ wth->subtype_seek_read = radcom_seek_read;
+ wth->snapshot_length = 0; /* not available in header, only in frame */
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
#if 0
tm.tm_year = pletoh16(&start_date.year)-1900;
@@ -176,36 +176,36 @@ int radcom_open(wftap *wfth, int *err, gchar **err_info)
tm.tm_sec = sec%60;
tm.tm_isdst = -1;
#endif
- if (file_seek(wfth->fh, sizeof(struct frame_date), SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, sizeof(struct frame_date), SEEK_CUR, err) == -1)
return -1;
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(search_encap, 4, wfth->fh);
+ bytes_read = file_read(search_encap, 4, wth->fh);
if (bytes_read != 4) {
goto read_error;
}
while (memcmp(encap_magic, search_encap, 4)) {
- if (file_seek(wfth->fh, -3, SEEK_CUR, err) == -1)
+ if (file_seek(wth->fh, -3, SEEK_CUR, err) == -1)
return -1;
errno = WTAP_ERR_CANT_READ;
- bytes_read = file_read(searc