aboutsummaryrefslogtreecommitdiffstats
path: root/proto_hier_stats.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2007-12-03 12:15:21 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2007-12-03 12:15:21 +0000
commitf669af5ebc901aab2c636d038be2cb3e222ba1bf (patch)
tree5e5596e49a00701f61070f60d90aff49a279682a /proto_hier_stats.c
parent4df43619aa5e750daad603bd374384f03cdac0c5 (diff)
Include reassembled protocols, as this probably is the output the user wants.
The Bytes and End Bytes columns will be wrong for reassembled protocols, as they span across several packets, but I don't see any obvious way to display such values. The correct values can be found by looking at the parent protocols. svn path=/trunk/; revision=23700
Diffstat (limited to 'proto_hier_stats.c')
-rw-r--r--proto_hier_stats.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/proto_hier_stats.c b/proto_hier_stats.c
index 231182d348..548ce71377 100644
--- a/proto_hier_stats.c
+++ b/proto_hier_stats.c
@@ -88,18 +88,24 @@ process_node(proto_node *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, gu
finfo = PITEM_FINFO(ptree_node);
g_assert(finfo);
- stat_node = find_stat_node(parent_stat_node, finfo->hfinfo);
+ /* If the field info isn't related to a protocol but to a field,
+ * don't count them, as they don't belong to any protocol.
+ * (happens e.g. for toplevel tree item of desegmentation "[Reassembled TCP Segments]") */
+ if (finfo->hfinfo->parent != -1) {
+ /* Skip this element, use parent status node */
+ stat_node = parent_stat_node;
+ stats = STAT_NODE_STATS(stat_node);
+ } else {
+ stat_node = find_stat_node(parent_stat_node, finfo->hfinfo);
- stats = STAT_NODE_STATS(stat_node);
- stats->num_pkts_total++;
- stats->num_bytes_total += pkt_len;
+ stats = STAT_NODE_STATS(stat_node);
+ stats->num_pkts_total++;
+ stats->num_bytes_total += pkt_len;
+ }
proto_sibling_node = ptree_node->next;
- /* If the field info isn't related to a protocol but to a field (parent != -1),
- * don't count them, as they don't belong to any protocol.
- * (happens e.g. for toplevel tree item of desegmentation "[Reassembled TCP Segments]") */
- if (proto_sibling_node && proto_sibling_node->finfo->hfinfo->parent == -1) {
+ if (proto_sibling_node) {
/* If the name does not exist for this proto_sibling_node, then it is
* not a normal protocol in the top-level tree. It was instead
* added as a normal tree such as IPv6's Hop-by-hop Option Header and