/* pinfo_stats_tree.c
* Stats tree for ethernet frames
*
-* (c) 2005, Luis E. G. Ontanon <luis.ontanon@gmail.com>
+* (c) 2005, Luis E. G. Ontanon <luis@ontanon.org>
*
* $Id$
*
-* Ethereal - Network traffic analyzer
-* By Gerald Combs <gerald@ethereal.com>
+* Wireshark - Network traffic analyzer
+* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
/* ip host stats_tree -- basic test */
static int st_node_ip = -1;
-static gchar* st_str_ip = "IP address";
+static const gchar* st_str_ip = "IP Addresses";
static void ip_hosts_stats_tree_init(stats_tree* st) {
st_node_ip = stats_tree_create_node(st, st_str_ip, 0, TRUE);
}
static int ip_hosts_stats_tree_packet(stats_tree *st , packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
- static guint8 str[128];
-
tick_stat_node(st, st_str_ip, 0, FALSE);
-
- g_snprintf(str, sizeof(str),"%s",address_to_str(&pinfo->net_src));
- tick_stat_node(st, str, st_node_ip, FALSE);
-
- g_snprintf(str, sizeof(str),"%s",address_to_str(&pinfo->net_dst));
- tick_stat_node(st, str, st_node_ip, FALSE);
+ tick_stat_node(st, address_to_str(&pinfo->net_src), st_node_ip, FALSE);
+ tick_stat_node(st, address_to_str(&pinfo->net_dst), st_node_ip, FALSE);
return 1;
}
/* packet type stats_tree -- test pivot node */
static int st_node_ptype = -1;
-static gchar* st_str_ptype = "Port Type";
+static const gchar* st_str_ptype = "IP Protocol Types";
static void ptype_stats_tree_init(stats_tree* st) {
st_node_ptype = stats_tree_create_pivot(st, st_str_ptype, 0);
/* packet length stats_tree -- test range node */
static int st_node_plen = -1;
-static gchar* st_str_plen = "Packet Length";
+static const gchar* st_str_plen = "Packet Lengths";
static void plen_stats_tree_init(stats_tree* st) {
- st_node_plen = stats_tree_create_range_node(st, st_str_plen, 0, "0-19","20-39","40-79","80-159","160-319","320-639","640-1279","1280-",NULL);
+ st_node_plen = stats_tree_create_range_node(st, st_str_plen, 0, "0-19","20-39","40-79","80-159","160-319","320-639","640-1279","1280-2559","2560-5119","5120-",NULL);
}
static int plen_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
return 1;
}
-/* a tree exapmple
+/* a tree example
- IP
- PROTO
- PORT
*/
static int st_node_dsts = -1;
-static gchar* st_str_dsts = "Destinations";
+static const gchar* st_str_dsts = "IP Destinations";
static void dsts_stats_tree_init(stats_tree* st) {
st_node_dsts = stats_tree_create_node(st, st_str_dsts, 0, TRUE);
}
static int dsts_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
- static guint8 str[128];
+ static gchar str[128];
int ip_dst_node;
int proto_node;
tick_stat_node(st, st_str_dsts, 0, FALSE);
- g_snprintf(str, sizeof(str),"%s",address_to_str(&pinfo->net_src));
- ip_dst_node = tick_stat_node(st, str, st_node_dsts, TRUE);
+ ip_dst_node = tick_stat_node(st, address_to_str(&pinfo->net_src), st_node_dsts, TRUE);
proto_node = tick_stat_node(st,port_type_to_str(pinfo->ptype),ip_dst_node,TRUE);
/* register all pinfo trees */
void register_pinfo_stat_trees(void) {
- stats_tree_register("ip","ip_hosts",st_str_ip, ip_hosts_stats_tree_packet, ip_hosts_stats_tree_init, NULL );
- stats_tree_register("ip","ptype",st_str_ptype, ptype_stats_tree_packet, ptype_stats_tree_init, NULL );
- stats_tree_register("frame","plen",st_str_plen, plen_stats_tree_packet, plen_stats_tree_init, NULL );
- stats_tree_register("ip","dests",st_str_dsts, dsts_stats_tree_packet, dsts_stats_tree_init, NULL );
+ stats_tree_register("ip","ip_hosts",st_str_ip, 0, ip_hosts_stats_tree_packet, ip_hosts_stats_tree_init, NULL );
+ stats_tree_register("ip","ptype",st_str_ptype, 0, ptype_stats_tree_packet, ptype_stats_tree_init, NULL );
+ stats_tree_register_with_group("frame","plen",st_str_plen, 0, plen_stats_tree_packet, plen_stats_tree_init, NULL, REGISTER_STAT_GROUP_GENERIC );
+ stats_tree_register("ip","dests",st_str_dsts, 0, dsts_stats_tree_packet, dsts_stats_tree_init, NULL );
}