/* summary.c
* Routines for capture file summary info
*
- * $Id$
- *
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include <config.h>
#include <wiretap/pcap-encap.h>
+#include <wiretap/wtap_opttypes.h>
+#include <wiretap/pcapng.h>
#include <epan/packet.h>
#include "cfile.h"
#include "summary.h"
-#ifdef HAVE_LIBPCAP
-#include "capture_ui_utils.h"
+#if 0
+#include "ui/capture_ui_utils.h"
#endif
{
frame_data *first_frame, *cur_frame;
guint32 framenum;
- wtapng_section_t* shb_inf;
iface_options iface;
guint i;
wtapng_iface_descriptions_t* idb_info;
- wtapng_if_descr_t wtapng_if_descr;
- wtapng_if_stats_t *if_stats;
+ wtap_block_t wtapng_if_descr;
+ wtapng_if_descr_mandatory_t *wtapng_if_descr_mand;
+ wtap_block_t if_stats;
+ guint64 isb_ifdrop;
+ char* if_string;
+ wtapng_if_descr_filter_t* if_filter;
st->packet_count_ts = 0;
st->start_time = 0;
st->file_type = cf->cd_t;
st->iscompressed = cf->iscompressed;
st->is_tempfile = cf->is_tempfile;
- st->encap_type = cf->lnk_t;
+ st->file_encap_type = cf->lnk_t;
+ st->packet_encap_types = cf->linktypes;
st->has_snap = cf->has_snap;
st->snap = cf->snap;
st->elapsed_time = nstime_to_sec(&cf->elapsed_time);
st->drops = cf->drops;
st->dfilter = cf->dfilter;
- /* Get info from SHB */
- shb_inf = wtap_file_get_shb_info(cf->wth);
- if(shb_inf == NULL){
- st->opt_comment = NULL;
- st->shb_hardware = NULL;
- st->shb_os = NULL;
- st->shb_user_appl = NULL;
- }else{
- st->opt_comment = shb_inf->opt_comment;
- st->shb_hardware = shb_inf->shb_hardware;
- st->shb_os = shb_inf->shb_os;
- st->shb_user_appl = shb_inf->shb_user_appl;
- g_free(shb_inf);
- }
-
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->number_of_interfaces; i++) {
- wtapng_if_descr = g_array_index(idb_info->interface_data, wtapng_if_descr_t, i);
- iface.cfilter = g_strdup(wtapng_if_descr.if_filter_str);
- iface.name = g_strdup(wtapng_if_descr.if_name);
- iface.descr = g_strdup(wtapng_if_descr.if_description);
+ for (i = 0; i < idb_info->interface_data->len; i++) {
+ 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.snap_len;
+ iface.snap = wtapng_if_descr_mand->snap_len;
iface.has_snap = (iface.snap != 65535);
- iface.encap_type = wtapng_if_descr.wtap_encap;
- if(wtapng_if_descr.num_stat_entries == 1){
+ iface.encap_type = wtapng_if_descr_mand->wtap_encap;
+ 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.interface_statistics, wtapng_if_stats_t, 0);
- iface.drops_known = TRUE;
- iface.drops = if_stats->isb_ifdrop;
- iface.isb_comment = if_stats->opt_comment;
+ 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 */
+ /* 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);
}
g_free(idb_info);
}
-
#ifdef HAVE_LIBPCAP
void
summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_tally *st)
}
}
#endif
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local Variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=2 tabstop=8 expandtab:
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */