sharkd_json_value_anyf(TRUE, "count", "%d", node->counter);
if (node->counter && ((node->st_flags & ST_FLG_AVERAGE) || node->rng))
{
- sharkd_json_value_anyf(TRUE, "avg", "%.2f", ((float)node->total) / node->counter);
- sharkd_json_value_anyf(TRUE, "min", "%d", node->minvalue);
- sharkd_json_value_anyf(TRUE, "max", "%d", node->maxvalue);
+ switch(node->datatype)
+ {
+ case STAT_DT_INT:
+ sharkd_json_value_anyf(TRUE, "avg", "%.2f", ((float)node->total.int_total) / node->counter);
+ sharkd_json_value_anyf(TRUE, "min", "%d", node->minvalue.int_min);
+ sharkd_json_value_anyf(TRUE, "max", "%d", node->maxvalue.int_max);
+ break;
+ case STAT_DT_FLOAT:
+ sharkd_json_value_anyf(TRUE, "avg", "%.2f", node->total.float_total / node->counter);
+ sharkd_json_value_anyf(TRUE, "min", "%f", node->minvalue.float_min);
+ sharkd_json_value_anyf(TRUE, "max", "%f", node->maxvalue.float_max);
+ break;
+ }
}
if (node->st->elapsed)
else
sharkd_json_value_anyf(TRUE, "burstrate", "%.4f", ((double)node->max_burst) / prefs.st_burst_windowlen);
- sharkd_json_value_anyf(TRUE, "bursttime", "%.3f", ((double)node->burst_time / 1000.0));
+ sharkd_json_value_anyf(TRUE, "bursttime", "%.3f", (node->burst_time / 1000.0));
}
if (node->children)
putchar(',');
}
-static gboolean
+static tap_packet_status
sharkd_session_packet_tap_expert_cb(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pointer)
{
struct sharkd_expert_tap *etd = (struct sharkd_expert_tap *) tapdata;
expert_info_t *ei_copy;
if (ei == NULL)
- return FALSE;
+ return TAP_PACKET_DONT_REDRAW;
ei_copy = g_new(expert_info_t, 1);
/* Note: this is a shallow copy */
etd->details = g_slist_prepend(etd->details, ei_copy);
- return TRUE;
+ return TAP_PACKET_REDRAW;
}
static void
g_free(rtp_req);
}
-static gboolean
+static tap_packet_status
sharkd_session_packet_tap_rtp_analyse_cb(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pointer)
{
struct sharkd_analyse_rtp *rtp_req = (struct sharkd_analyse_rtp *) tapdata;
rtp_req->packets = g_slist_append(rtp_req->packets, item);
}
- return TRUE;
+ return TAP_PACKET_REDRAW;
}
/**
GString *error;
};
-static gboolean
+static tap_packet_status
sharkd_iograph_packet(void *g, packet_info *pinfo, epan_dissect_t *edt, const void *dummy _U_)
{
struct sharkd_iograph *graph = (struct sharkd_iograph *) g;
int idx;
+ gboolean update_succeeded;
idx = get_io_graph_index(pinfo, graph->interval);
if (idx < 0 || idx >= SHARKD_IOGRAPH_MAX_ITEMS)
- return FALSE;
+ return TAP_PACKET_DONT_REDRAW;
if (idx + 1 > graph->num_items)
{
graph->num_items = idx + 1;
}
- return update_io_graph_item(graph->items, idx, pinfo, edt, graph->hf_index, graph->calc_type, graph->interval);
+ update_succeeded = update_io_graph_item(graph->items, idx, pinfo, edt, graph->hf_index, graph->calc_type, graph->interval);
+ /* XXX - TAP_PACKET_FAILED if the item couldn't be updated, with an error message? */
+ return update_succeeded ? TAP_PACKET_REDRAW : TAP_PACKET_DONT_REDRAW;
}
/**
g_hash_table_destroy(decoders_hash_);
}
-static gboolean
+static tap_packet_status
sharkd_session_packet_download_tap_rtp_cb(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const void *data)
{
const struct _rtp_info *rtp_info = (const struct _rtp_info *) data;
/* do not consider RTP packets without a setup frame */
if (rtp_info->info_setup_frame_num == 0)
- return FALSE;
+ return TAP_PACKET_DONT_REDRAW;
if (rtpstream_id_equal_pinfo_rtp_info(&req_rtp->id, pinfo, rtp_info))
{
req_rtp->packets = g_slist_append(req_rtp->packets, rtp_packet);
}
- return FALSE;
+ return TAP_PACKET_DONT_REDRAW;
}
/**