aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-osmux.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/epan/dissectors/packet-osmux.c b/epan/dissectors/packet-osmux.c
index e800d7a..2c9a1a2 100644
--- a/epan/dissectors/packet-osmux.c
+++ b/epan/dissectors/packet-osmux.c
@@ -23,10 +23,15 @@
#include "config.h"
+#include <string.h>
+#include <stdio.h>
+
#include <epan/packet.h>
#include <epan/stats_tree.h>
#include <epan/tap.h>
#include <epan/prefs.h>
+#include <epan/to_str.h>
+#include <epan/strutil.h>
#include <epan/conversation.h>
void proto_register_osmux(void);
@@ -168,6 +173,66 @@ dissect_osmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
return offset;
}
+static const gchar *st_str_pkts = "Osmux Packets";
+static const gchar *st_str_pkts_by_cid = "Osmux Packets by CID";
+static const gchar *st_str_pkts_by_ctr = "Osmux Packets by AMR frame count";
+static const gchar *st_str_pkts_by_src = "Osmux Packets by src Addr";
+static const gchar *st_str_pkts_by_dst = "Osmux Packets by dst Addr";
+static const gchar *st_str_pkts_by_conn = "Osmux Packets by stream";
+
+static int st_osmux_stats = -1;
+static int st_osmux_stats_cid = -1;
+static int st_osmux_stats_ctr = -1;
+static int st_osmux_stats_src = -1;
+static int st_osmux_stats_dst = -1;
+static int st_osmux_stats_conn = -1;
+
+extern void osmux_stats_tree_init(stats_tree *st)
+{
+ st_osmux_stats = stats_tree_create_node(st, st_str_pkts, 0, TRUE);
+ st_osmux_stats_cid = stats_tree_create_node(st, st_str_pkts_by_cid, st_osmux_stats, TRUE);
+ st_osmux_stats_ctr = stats_tree_create_node(st, st_str_pkts_by_ctr, st_osmux_stats, TRUE);
+ st_osmux_stats_src = stats_tree_create_node(st, st_str_pkts_by_src, st_osmux_stats, TRUE);
+ st_osmux_stats_dst = stats_tree_create_node(st, st_str_pkts_by_dst, st_osmux_stats, TRUE);
+ st_osmux_stats_conn = stats_tree_create_node(st, st_str_pkts_by_conn, st_osmux_stats, TRUE);
+}
+
+extern int osmux_stats_tree_packet(stats_tree *st, packet_info *pinfo,
+ epan_dissect_t *edt _U_, const void *p _U_)
+{
+ gchar *ip_str, *ip2_str;
+ gchar temp[40];
+ struct osmux_hdr *osmuxh = (struct osmux_hdr*) p;
+
+
+ tick_stat_node(st, st_str_pkts, 0, FALSE);
+
+ tick_stat_node(st, st_str_pkts_by_cid, st_osmux_stats, FALSE);
+ snprintf(temp, 30, "%i", osmuxh->circuit_id);
+ tick_stat_node(st, temp, st_osmux_stats_cid, TRUE);
+
+ tick_stat_node(st, st_str_pkts_by_ctr, st_osmux_stats, FALSE);
+ snprintf(temp, 30, "%i", osmuxh->ctr);
+ tick_stat_node(st, temp, st_osmux_stats_ctr, TRUE);
+
+ tick_stat_node(st, st_str_pkts_by_src, 0, FALSE);
+ ip_str = address_to_str(NULL, &pinfo->src);
+ tick_stat_node(st, ip_str, st_osmux_stats_src, TRUE);
+
+ tick_stat_node(st, st_str_pkts_by_dst, 0, FALSE);
+ ip2_str = address_to_str(NULL, &pinfo->dst);
+ tick_stat_node(st, ip2_str, st_osmux_stats_dst, TRUE);
+
+ tick_stat_node(st, st_str_pkts_by_conn, 0, FALSE);
+ snprintf(temp, 40, "%s->%s:%i", ip_str, ip2_str, osmuxh->circuit_id);
+ tick_stat_node(st, temp, st_osmux_stats_conn, TRUE);
+
+ wmem_free(NULL, ip_str);
+ wmem_free(NULL, ip2_str);
+
+ return 1;
+}
+
void proto_register_osmux(void)
{
static hf_register_info hf[] = {
@@ -246,6 +311,9 @@ void proto_reg_handoff_osmux(void)
osmux_initialized = TRUE;
}
osmux_tap = register_tap("osmux");
+ stats_tree_register_plugin("osmux", "osmux", "Osmux/Pakets", 0,
+ osmux_stats_tree_packet, osmux_stats_tree_init,
+ NULL);
}
/*