Example #1
0
void
summary_fill_in(capture_file *cf, summary_tally *st)
{
  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;

  st->packet_count_ts = 0;
  st->start_time = 0;
  st->stop_time = 0;
  st->bytes = 0;
  st->filtered_count = 0;
  st->filtered_count_ts = 0;
  st->filtered_start = 0;
  st->filtered_stop = 0;
  st->filtered_bytes = 0;
  st->marked_count = 0;
  st->marked_count_ts = 0;
  st->marked_start = 0;
  st->marked_stop = 0;
  st->marked_bytes = 0;
  st->ignored_count = 0;

  /* initialize the tally */
  if (cf->count != 0) {
    first_frame = frame_data_sequence_find(cf->frames, 1);
    st->start_time = nstime_to_sec(&first_frame->abs_ts);
    st->stop_time = nstime_to_sec(&first_frame->abs_ts);

    for (framenum = 1; framenum <= cf->count; framenum++) {
      cur_frame = frame_data_sequence_find(cf->frames, framenum);
      tally_frame_data(cur_frame, st);
    }
  }

  st->filename = cf->filename;
  st->file_length = cf->f_datalen;
  st->file_type = cf->cd_t;
  st->iscompressed = cf->iscompressed;
  st->is_tempfile = cf->is_tempfile;
  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->packet_count = cf->count;
  st->drops_known = cf->drops_known;
  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->interface_data->len; 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);
    iface.drops_known = FALSE;
    iface.drops = 0;
    iface.snap = wtapng_if_descr.snap_len;
    iface.has_snap = (iface.snap != 65535);
    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);
      iface.drops_known = TRUE;
      iface.drops = if_stats->isb_ifdrop;
      iface.isb_comment = if_stats->opt_comment;
    }
    g_array_append_val(st->ifaces, iface);
  }
  g_free(idb_info);
}
Example #2
0
void
summary_fill_in(capture_file *cf, summary_tally *st)
{

  frame_data    *first_frame, *cur_frame;
  guint32        framenum;
  wtapng_section_t* shb_inf;

  st->packet_count_ts = 0;
  st->start_time = 0;
  st->stop_time = 0;
  st->bytes = 0;
  st->filtered_count = 0;
  st->filtered_count_ts = 0;
  st->filtered_start = 0;
  st->filtered_stop = 0;
  st->filtered_bytes = 0;
  st->marked_count = 0;
  st->marked_count_ts = 0;
  st->marked_start = 0;
  st->marked_stop = 0;
  st->marked_bytes = 0;
  st->ignored_count = 0;

  /* initialize the tally */
  if (cf->count != 0) {
    first_frame = frame_data_sequence_find(cf->frames, 1);
    st->start_time = nstime_to_sec(&first_frame->abs_ts);
    st->stop_time = nstime_to_sec(&first_frame->abs_ts);

    for (framenum = 1; framenum <= cf->count; framenum++) {
      cur_frame = frame_data_sequence_find(cf->frames, framenum);
      tally_frame_data(cur_frame, st);
    }
  }

  st->filename = cf->filename;
  st->file_length = cf->f_datalen;
  st->file_type = cf->cd_t;
  st->is_tempfile = cf->is_tempfile;
  st->encap_type = cf->lnk_t;
  st->has_snap = cf->has_snap;
  st->snap = cf->snap;
  st->elapsed_time = nstime_to_sec(&cf->elapsed_time);
  st->packet_count = cf->count;
  st->drops_known = cf->drops_known;
  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));
}