Speak of records, not packets.
authorGuy Harris <guy@alum.mit.edu>
Mon, 5 Feb 2018 20:55:00 +0000 (12:55 -0800)
committerGuy Harris <guy@alum.mit.edu>
Mon, 5 Feb 2018 20:55:46 +0000 (20:55 +0000)
Not everything wtap_read() returns is a packet.

Change-Id: I3784bbfa308da52f4c55db2a90f9b55f8bfbb2ef
Reviewed-on: https://code.wireshark.org/review/25617
Reviewed-by: Guy Harris <guy@alum.mit.edu>
file.c
mergecap.c
wiretap/merge.c
wiretap/merge.h

diff --git a/file.c b/file.c
index be2441d73711b5ee02c460c1849bc932c4e2261b..2718c30125f5c2f8a53922ea873d8853abe1a3ee 100644 (file)
--- a/file.c
+++ b/file.c
@@ -1246,7 +1246,7 @@ merge_callback(merge_event event, int num _U_,
       g_get_current_time(&cb_data->start_time);
       break;
 
-    case MERGE_EVENT_PACKET_WAS_READ:
+    case MERGE_EVENT_RECORD_WAS_READ:
       {
         gint64 data_offset = 0;
 
index ba95059d17ddb6540b0e70c435f6fba37faf1f47..98a32b8b2d429a35ae36a04489a0e37ae0c4d4d4 100644 (file)
@@ -211,7 +211,7 @@ merge_callback(merge_event event, int num,
       fprintf(stderr, "mergecap: ready to merge records\n");
       break;
 
-    case MERGE_EVENT_PACKET_WAS_READ:
+    case MERGE_EVENT_RECORD_WAS_READ:
       /* for this event, num = count */
       fprintf(stderr, "Record: %d\n", num);
       break;
index 7b42ff9140dffe50ac69510ee9a34edbb7653aa7..f1931052df917d6b3cf2af275ed136b66f8665f6 100644 (file)
@@ -125,7 +125,7 @@ merge_open_in_files(guint in_file_count, const char *const *in_file_names,
         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].data_offset = 0;
-        files[i].state       = PACKET_NOT_PRESENT;
+        files[i].state       = RECORD_NOT_PRESENT;
         files[i].packet_num  = 0;
 
         if (!files[i].wth) {
@@ -254,7 +254,7 @@ merge_read_packet(int in_file_count, merge_in_file_t in_files[],
      * with the earliest time stamp.
      */
     for (i = 0; i < in_file_count; i++) {
-        if (in_files[i].state == PACKET_NOT_PRESENT) {
+        if (in_files[i].state == RECORD_NOT_PRESENT) {
             /*
              * No packet available, and we haven't seen an error or EOF yet,
              * so try to read the next packet.
@@ -266,10 +266,10 @@ merge_read_packet(int in_file_count, merge_in_file_t in_files[],
                 }
                 in_files[i].state = AT_EOF;
             } else
-                in_files[i].state = PACKET_PRESENT;
+                in_files[i].state = RECORD_PRESENT;
         }
 
-        if (in_files[i].state == PACKET_PRESENT) {
+        if (in_files[i].state == RECORD_PRESENT) {
             phdr = wtap_phdr(in_files[i].wth);
             if (is_earlier(&phdr->ts, &tv)) {
                 tv = phdr->ts;
@@ -285,7 +285,7 @@ merge_read_packet(int in_file_count, merge_in_file_t in_files[],
     }
 
     /* We'll need to read another packet from this file. */
-    in_files[ei].state = PACKET_NOT_PRESENT;
+    in_files[ei].state = RECORD_NOT_PRESENT;
 
     /* Count this packet. */
     in_files[ei].packet_num++;
@@ -834,7 +834,7 @@ merge_process_packets(wtap_dumper *pdh, const int file_type,
 
         count++;
         if (cb)
-            stop_flag = cb->callback_func(MERGE_EVENT_PACKET_WAS_READ, count, in_files, in_file_count, cb->data);
+            stop_flag = cb->callback_func(MERGE_EVENT_RECORD_WAS_READ, count, in_files, in_file_count, cb->data);
 
         if (stop_flag) {
             /* The user decided to abort the merge. */
index 76ef3adf2d3211c7d99c847112e1e3da5f6dc931..ff3daa24f77b4d7f2222416d8ecad8f3139f5177 100644 (file)
@@ -18,8 +18,8 @@ extern "C" {
 #endif /* __cplusplus */
 
 typedef enum {
-    PACKET_PRESENT,
-    PACKET_NOT_PRESENT,
+    RECORD_PRESENT,
+    RECORD_NOT_PRESENT,
     AT_EOF,
     GOT_ERROR
 } in_file_state_e;
@@ -57,7 +57,7 @@ typedef enum {
     MERGE_EVENT_INPUT_FILES_OPENED,
     MERGE_EVENT_FRAME_TYPE_SELECTED,
     MERGE_EVENT_READY_TO_MERGE,
-    MERGE_EVENT_PACKET_WAS_READ,
+    MERGE_EVENT_RECORD_WAS_READ,
     MERGE_EVENT_DONE
 } merge_event;