Revert SVN #32360 until Windows compilation errors corrected.
[obnox/wireshark/wip.git] / capture_info.c
index 5206230676f945d086635fb5addceead855cb0bc..1e0c7cae4a5912f630a82a9294958980ffc1500b 100644 (file)
@@ -46,6 +46,7 @@
 #include <epan/dissectors/packet-fddi.h>
 #include <epan/dissectors/packet-fr.h>
 #include <epan/dissectors/packet-null.h>
+#include <epan/dissectors/packet-ppi.h>
 #include <epan/dissectors/packet-ppp.h>
 #include <epan/dissectors/packet-raw.h>
 #include <epan/dissectors/packet-sll.h>
 #include <epan/dissectors/packet-ieee80211.h>
 #include <epan/dissectors/packet-radiotap.h>
 #include <epan/dissectors/packet-chdlc.h>
-#include <epan/dissectors/packet-prism.h>
 #include <epan/dissectors/packet-ipfc.h>
 #include <epan/dissectors/packet-arcnet.h>
 #include <epan/dissectors/packet-enc.h>
+#include <epan/dissectors/packet-i2c.h>
 
 static void capture_info_packet(
 packet_counts *counts, gint wtap_linktype, const guchar *pd, guint32 caplen, union wtap_pseudo_header *pseudo_header);
@@ -74,7 +75,7 @@ info_data_t info_data;
 
 
 /* open the info */
-void capture_info_open(const char *iface)
+void capture_info_open(capture_options *capture_opts)
 {
     info_data.counts.total      = 0;
     info_data.counts.sctp       = 0;
@@ -88,11 +89,13 @@ void capture_info_open(const char *iface)
     info_data.counts.vines      = 0;
     info_data.counts.other      = 0;
     info_data.counts.arp        = 0;
+    info_data.counts.i2c_event  = 0;
+    info_data.counts.i2c_data   = 0;
 
     info_data.wtap = NULL;
     info_data.ui.counts = &info_data.counts;
 
-    capture_info_ui_create(&info_data.ui, iface);
+    capture_info_ui_create(&info_data.ui, capture_opts);
 }
 
 
@@ -113,13 +116,13 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
 
     case WTAP_ERR_FILE_UNKNOWN_FORMAT:
       /* Seen only when opening a capture file for reading. */
-      errmsg = "The file \"%s\" isn't a capture file in a format Twireshark understands.";
+      errmsg = "The file \"%s\" isn't a capture file in a format TShark understands.";
       break;
 
     case WTAP_ERR_UNSUPPORTED:
       /* Seen only when opening a capture file for reading. */
       g_snprintf(errmsg_errno, sizeof(errmsg_errno),
-               "The file \"%%s\" isn't a capture file in a format Twireshark understands.\n"
+               "The file \"%%s\" isn't a capture file in a format TShark understands.\n"
                "(%s)", err_info);
       g_free(err_info);
       errmsg = errmsg_errno;
@@ -135,15 +138,15 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
 
     case WTAP_ERR_UNSUPPORTED_FILE_TYPE:
       /* Seen only when opening a capture file for writing. */
-      errmsg = "Twireshark doesn't support writing capture files in that format.";
+      errmsg = "TShark doesn't support writing capture files in that format.";
       break;
 
     case WTAP_ERR_UNSUPPORTED_ENCAP:
       if (for_writing)
-        errmsg = "Twireshark can't save this capture in that format.";
+        errmsg = "TShark can't save this capture in that format.";
       else {
         g_snprintf(errmsg_errno, sizeof(errmsg_errno),
-                 "The file \"%%s\" is a capture for a network type that Twireshark doesn't support.\n"
+                 "The file \"%%s\" is a capture for a network type that TShark doesn't support.\n"
                  "(%s)", err_info);
         g_free(err_info);
         errmsg = errmsg_errno;
@@ -152,9 +155,9 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
 
     case WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED:
       if (for_writing)
-        errmsg = "Twireshark can't save this capture in that format.";
+        errmsg = "TShark can't save this capture in that format.";
       else
-        errmsg = "The file \"%s\" is a capture for a network type that Twireshark doesn't support.";
+        errmsg = "The file \"%s\" is a capture for a network type that TShark doesn't support.";
       break;
 
     case WTAP_ERR_BAD_RECORD:
@@ -212,7 +215,7 @@ gboolean capture_info_new_file(const char *new_filename)
         g_snprintf(err_msg, sizeof err_msg,
                    cf_open_error_message(err, err_info, FALSE, WTAP_FILE_PCAP),
                    new_filename);
-        g_warning("capture_info_new_file: %s", err_msg);
+        g_warning("capture_info_new_file: %d (%s)", err, err_msg);
         return FALSE;
     } else
         return TRUE;
@@ -224,7 +227,7 @@ void capture_info_new_packets(int to_read)
 {
     int err;
     gchar *err_info;
-    long data_offset;
+    gint64 data_offset;
     const struct wtap_pkthdr *phdr;
     union wtap_pseudo_header *pseudo_header;
     int wtap_linktype;
@@ -300,6 +303,9 @@ capture_info_packet(packet_counts *counts, gint wtap_linktype, const guchar *pd,
     case WTAP_ENCAP_IEEE_802_11_WLAN_RADIOTAP:
       capture_radiotap(pd, 0, caplen, counts);
       break;
+    case WTAP_ENCAP_IEEE_802_11_WLAN_AVS:
+      capture_wlancap(pd, 0, caplen, counts);
+      break;
     case WTAP_ENCAP_CHDLC:
       capture_chdlc(pd, 0, caplen, counts);
       break;
@@ -328,6 +334,12 @@ capture_info_packet(packet_counts *counts, gint wtap_linktype, const guchar *pd,
     case WTAP_ENCAP_ENC:
       capture_enc(pd, caplen, counts);
       break;
+    case WTAP_ENCAP_PPI:
+      capture_ppi(pd, caplen, counts);
+      break;
+    case WTAP_ENCAP_I2C:
+      capture_i2c(pseudo_header, counts);
+      break;
     /* XXX - some ATM drivers on FreeBSD might prepend a 4-byte ATM
        pseudo-header to DLT_ATM_RFC1483, with LLC header following;
        we might have to implement that at some point. */