diff options
Diffstat (limited to 'summary.c')
-rw-r--r-- | summary.c | 39 |
1 files changed, 25 insertions, 14 deletions
@@ -110,9 +110,9 @@ summary_fill_in(capture_file *cf, summary_tally *st) iface_options iface; guint i; wtapng_iface_descriptions_t* idb_info; - wtap_optionblock_t wtapng_if_descr; + wtap_block_t wtapng_if_descr; wtapng_if_descr_mandatory_t *wtapng_if_descr_mand; - wtap_optionblock_t if_stats; + wtap_block_t if_stats; guint64 isb_ifdrop; char* if_string; wtapng_if_descr_filter_t* if_filter; @@ -163,14 +163,23 @@ 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->wth); for (i = 0; i < idb_info->interface_data->len; i++) { - wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_optionblock_t, i); - wtapng_if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_optionblock_get_mandatory_data(wtapng_if_descr); - wtap_optionblock_get_option_custom(wtapng_if_descr, OPT_IDB_FILTER, (void**)&if_filter); - iface.cfilter = g_strdup(if_filter->if_filter_str); - wtap_optionblock_get_option_string(wtapng_if_descr, OPT_IDB_NAME, &if_string); - iface.name = g_strdup(if_string); - wtap_optionblock_get_option_string(wtapng_if_descr, OPT_IDB_DESCR, &if_string); - iface.descr = g_strdup(if_string); + wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, i); + wtapng_if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(wtapng_if_descr); + if (wtap_block_get_custom_option_value(wtapng_if_descr, OPT_IDB_FILTER, (void**)&if_filter) == WTAP_OPTTYPE_SUCCESS) { + iface.cfilter = g_strdup(if_filter->if_filter_str); + } else { + iface.cfilter = NULL; + } + if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &if_string) == WTAP_OPTTYPE_SUCCESS) { + iface.name = g_strdup(if_string); + } else { + iface.name = NULL; + } + if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &if_string) == WTAP_OPTTYPE_SUCCESS) { + iface.descr = g_strdup(if_string); + } else { + iface.descr = NULL; + } iface.drops_known = FALSE; iface.drops = 0; iface.snap = wtapng_if_descr_mand->snap_len; @@ -179,14 +188,16 @@ summary_fill_in(capture_file *cf, summary_tally *st) iface.isb_comment = NULL; if(wtapng_if_descr_mand->num_stat_entries == 1){ /* dumpcap only writes one ISB, only handle that for now */ - if_stats = g_array_index(wtapng_if_descr_mand->interface_statistics, wtap_optionblock_t, 0); - wtap_optionblock_get_option_uint64(if_stats, OPT_ISB_IFDROP, &isb_ifdrop); - if (isb_ifdrop != G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF)) { + if_stats = g_array_index(wtapng_if_descr_mand->interface_statistics, wtap_block_t, 0); + if (wtap_block_get_uint64_option_value(if_stats, OPT_ISB_IFDROP, &isb_ifdrop) == WTAP_OPTTYPE_SUCCESS) { iface.drops_known = TRUE; iface.drops = isb_ifdrop; } /* XXX: this doesn't get used, and might need to be g_strdup'ed when it does */ - wtap_optionblock_get_option_string(if_stats, OPT_COMMENT, &iface.isb_comment); + /* XXX - support multiple comments */ + if (wtap_block_get_nth_string_option_value(if_stats, OPT_COMMENT, 0, &iface.isb_comment) != WTAP_OPTTYPE_SUCCESS) { + iface.isb_comment = NULL; + } } g_array_append_val(st->ifaces, iface); } |