diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-05-28 00:31:27 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-05-28 00:31:27 +0000 |
commit | 53375198ec6e69374c4a1c21f2b5deff3f4ff810 (patch) | |
tree | 1106e567a265d264fee8b21bda57866a89462f96 | |
parent | fb68fa844cfbb002b648cad4231883e6ef12a914 (diff) |
Don't use pcap LINKTYPE_ values in the iface_options structure, use
Wiretap encapsulation values; rename the field in question encap_type to
emphasize that. (Code that looks at that field already assumes it's a
Wiretap encapsulation value.)
For live captures, map the LINKTYPE_ value to a Wiretap encapsulation
value.
wtap_encap_string() never returns NULL, so don't check for a null return
value.
svn path=/trunk/; revision=42871
-rw-r--r-- | summary.c | 8 | ||||
-rw-r--r-- | summary.h | 2 | ||||
-rw-r--r-- | ui/gtk/summary_dlg.c | 8 |
3 files changed, 6 insertions, 12 deletions
@@ -26,6 +26,8 @@ # include "config.h" #endif +#include <wiretap/pcap-encap.h> + #include <epan/packet.h> #include "cfile.h" #include "summary.h" @@ -171,7 +173,6 @@ summary_fill_in(capture_file *cf, summary_tally *st) } -#ifdef HAVE_LIBPCAP void summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_tally *st) { @@ -202,7 +203,7 @@ summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_ iface.drops = cf->drops; iface.has_snap = device.has_snaplen; iface.snap = device.snaplen; - iface.linktype = device.active_dlt; + iface.encap_type = wtap_pcap_encap_to_wtap_encap(device.active_dlt); g_array_append_val(st->ifaces, iface); } } else { @@ -216,7 +217,7 @@ summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_ iface.drops = 0; iface.snap = wtapng_if_descr.snap_len; iface.has_snap = (iface.snap != 65535); - iface.linktype = wtapng_if_descr.link_type; + iface.encap_type = wtapng_if_descr.wtap_encap; if(wtapng_if_descr.num_stat_entries == 1){ /* dumpcap only writes one ISB, only handle that for now */ if_stats = &g_array_index(wtapng_if_descr.interface_statistics, wtapng_if_stats_t, 0); @@ -229,4 +230,3 @@ summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_ g_free(idb_info); } } -#endif @@ -38,7 +38,7 @@ typedef struct iface_options_tag { gboolean drops_known; /**< TRUE if number of packet drops is known */ gboolean has_snap; /**< TRUE if maximum capture packet length is known */ int snap; /**< Maximum captured packet length */ - int linktype; /**< wiretap encapsulation type */ + int encap_type; /**< wiretap encapsulation type */ } iface_options; typedef struct _summary_tally { diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c index c23f239314..02febe2253 100644 --- a/ui/gtk/summary_dlg.c +++ b/ui/gtk/summary_dlg.c @@ -171,7 +171,6 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) GtkTreeIter iter; GtkCellRenderer *renderer; GtkTreeViewColumn *column; - const char *dl_description; static const char *titles[] = { "Traffic", "Captured", "Displayed", "Marked" }; gchar string_buff[SUM_STR_MAX]; @@ -388,12 +387,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) g_snprintf(string_buff3, SUM_STR_MAX, "unknown"); } } - dl_description = wtap_encap_string(iface.linktype); - if (dl_description != NULL) - g_snprintf(string_buff4, SUM_STR_MAX, "%s", dl_description); - else - g_snprintf(string_buff4, SUM_STR_MAX, "DLT %d", iface.linktype); - + g_snprintf(string_buff4, SUM_STR_MAX, "%s", wtap_encap_string(iface.encap_type)); g_snprintf(string_buff5, SUM_STR_MAX, "%u bytes", iface.snap); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, string_buff, 1, string_buff2, 2, string_buff3, 3, string_buff4, 4, string_buff5,-1); |