summaryrefslogtreecommitdiff
path: root/wiretap/merge.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-05-08 22:59:19 -0400
committerMichael Mann <mmann78@netscape.net>2014-05-09 03:04:39 +0000
commit1abeb277f5e6bd27fbaebfecc8184e37ba9d008a (patch)
tree8cc6eaa5a6982454a00adc600fa4aab02bec3d73 /wiretap/merge.c
parentaa3a968eb6e85c47014a4cec4a2b955357b0e77f (diff)
downloadwireshark-1abeb277f5e6bd27fbaebfecc8184e37ba9d008a.tar.gz
Refactor Wiretap
Start of refactoring Wiretap and breaking structures down into "generally useful fields for dissection" and "capture specific". Since this in intended as a "base" for Wiretap and Filetap, the "wft" prefix is used for "common" functionality. The "architectural" changes can be found in cfile.h, wtap.h, wtap-int.h and (new file) wftap-int.h. Most of the other (painstaking) changes were really just the result of compiling those new architecture changes. bug:9607 Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae Reviewed-on: https://code.wireshark.org/review/1485 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wiretap/merge.c')
-rw-r--r--wiretap/merge.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/wiretap/merge.c b/wiretap/merge.c
index bea6b53220..c47fe7f67b 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -1,4 +1,5 @@
-/* Combine multiple dump files, either by appending or by merging by timestamp
+/* merge.c
+ * 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
@@ -60,21 +61,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].wth = wtap_open_offline(in_file_names[i], WTAP_TYPE_AUTO, err, err_info, FALSE);
+ files[i].wfth = 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].wth) {
+ if (!files[i].wfth) {
/* Close the files we've already opened. */
for (j = 0; j < i; j++)
- wtap_close(files[j].wth);
+ wtap_close(files[j].wfth);
*err_fileno = i;
return FALSE;
}
- size = wtap_file_size(files[i].wth, err);
+ size = wftap_file_size(files[i].wfth, err);
if (size == -1) {
for (j = 0; j <= i; j++)
- wtap_close(files[j].wth);
+ wtap_close(files[j].wfth);
*err_fileno = i;
return FALSE;
}
@@ -91,7 +92,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].wth);
+ wtap_close(in_files[i].wfth);
}
}
@@ -109,10 +110,10 @@ merge_select_frame_type(int count, merge_in_file_t files[])
int i;
int selected_frame_type;
- selected_frame_type = wtap_file_encap(files[0].wth);
+ selected_frame_type = wftap_file_encap(files[0].wfth);
for (i = 1; i < count; i++) {
- int this_frame_type = wtap_file_encap(files[i].wth);
+ int this_frame_type = wftap_file_encap(files[i].wfth);
if (selected_frame_type != this_frame_type) {
selected_frame_type = WTAP_ENCAP_PER_PACKET;
break;
@@ -133,7 +134,7 @@ merge_max_snapshot_length(int count, merge_in_file_t in_files[])
int snapshot_length;
for (i = 0; i < count; i++) {
- snapshot_length = wtap_snapshot_length(in_files[i].wth);
+ snapshot_length = wftap_snapshot_length(in_files[i].wfth);
if (snapshot_length == 0) {
/* Snapshot length of input file not known. */
snapshot_length = WTAP_MAX_PACKET_SIZE;
@@ -196,7 +197,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].wth, err, err_info, &in_files[i].data_offset)) {
+ if (!wtap_read(in_files[i].wfth, err, err_info, &in_files[i].data_offset)) {
if (*err != 0) {
in_files[i].state = GOT_ERROR;
return &in_files[i];
@@ -207,7 +208,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].wth);
+ phdr = wtap_phdr(in_files[i].wfth);
if (is_earlier(&phdr->ts, &tv)) {
tv = phdr->ts;
ei = i;
@@ -260,7 +261,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].wth, err, err_info, &in_files[i].data_offset))
+ if (wtap_read(in_files[i].wfth, err, err_info, &in_files[i].data_offset))
break; /* We have a packet */
if (*err != 0) {
/* Read error - quit immediately. */