User guide

In this case we create a new tree node, to handle the total packets, and as a child of that we create a
pivot table to handle the stats about different packet types.
Example 9.24. Generating the stats
static int foo_stats_tree_packet(stats_tree* st, packet_info* pinfo,
epan_dissect_t* edt, const void* p) {
struct FooTap *pi = (struct FooTap *)p;
tick_stat_node(st, st_str_packets, 0, FALSE);
stats_tree_tick_pivot(st, st_node_packet_types,
val_to_str(pi->packet_type, msgtypevalues, "Unknown packet type (%d)"));
return 1;
}
In this case the processing of the stats is quite simple. First we call the tick_stat_node for the
st_str_packets packet node, to count packets. Then a call to stats_tree_tick_pivot on the
st_node_packet_types subtree allows us to record statistics by packet type.
Packet dissection
117