summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-08-03 10:30:04 -0700
committerGerald Combs <gerald@wireshark.org>2015-08-04 16:36:22 +0000
commit03802cc53eefdc152f9c2160ebebf9717e5f07b2 (patch)
tree95c56e0072d656f4eef7cf6f786bbbbebb39edef
parent632b4023faaa2b77e69d35148a8b6e98f032cc3d (diff)
downloadwireshark-03802cc53eefdc152f9c2160ebebf9717e5f07b2.tar.gz
Convert H.225 tap stats to new "generic stat API".
Migrate the H.225 stats similar to the recent BOOTP migration. Change-Id: I70ff7ab6cf3e9796f257412ba7d65ec9fe7f77ad Reviewed-on: https://code.wireshark.org/review/9859 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--asn1/h225/packet-h225-template.c441
-rw-r--r--asn1/h225/packet-h225-template.h2
-rw-r--r--epan/dissectors/packet-bootp.c2
-rw-r--r--epan/dissectors/packet-h225.c451
-rw-r--r--epan/dissectors/packet-h225.h2
-rw-r--r--epan/stat_tap_ui.c2
-rw-r--r--epan/stat_tap_ui.h2
-rw-r--r--ui/gtk/CMakeLists.txt1
-rw-r--r--ui/gtk/Makefile.common1
-rw-r--r--ui/gtk/h225_counter.c594
-rw-r--r--ui/gtk/tap_param_dlg.h2
11 files changed, 863 insertions, 637 deletions
diff --git a/asn1/h225/packet-h225-template.c b/asn1/h225/packet-h225-template.c
index e4de6ada83..b6e413688f 100644
--- a/asn1/h225/packet-h225-template.c
+++ b/asn1/h225/packet-h225-template.c
@@ -41,6 +41,7 @@
#include <epan/asn1.h>
#include <epan/t35.h>
#include <epan/tap.h>
+#include <epan/stat_tap_ui.h>
#include <epan/rtd_table.h>
#include "packet-tpkt.h"
#include "packet-per.h"
@@ -84,7 +85,7 @@ typedef struct _h225ras_call_info_key {
conversation_t *conversation;
} h225ras_call_info_key;
-static h225_packet_info pi_arr[5]; /* We assuming a maximum of 5 H225 messaages per packet */
+static h225_packet_info pi_arr[5]; /* We assuming a maximum of 5 H.225 messages per packet */
static int pi_current=0;
static h225_packet_info *h225_pi=&pi_arr[0];
@@ -186,11 +187,11 @@ typedef enum _ras_category {
#define NUM_RAS_STATS 7
-static int
+static gboolean
h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
{
- rtd_data_t* rtd_data = (rtd_data_t*)phs;
- rtd_stat_table* rs = &rtd_data->stat_table;
+ rtd_data_t* rtd_data = (rtd_data_t*)phs;
+ rtd_stat_table* rs = &rtd_data->stat_table;
const h225_packet_info *pi=(const h225_packet_info *)phi;
ras_type rasmsg_type = RAS_OTHER;
@@ -198,7 +199,7 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
if (pi->msg_type != H225_RAS || pi->msg_tag == -1) {
/* No RAS Message or uninitialized msg_tag -> return */
- return 0;
+ return FALSE;
}
if (pi->msg_tag < 21) {
@@ -208,7 +209,7 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
}
else {
/* No SRT yet (ToDo) */
- return 0;
+ return FALSE;
}
switch(rasmsg_type) {
@@ -240,9 +241,9 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
break;
default:
- return 0;
+ return FALSE;
}
- return 1;
+ return TRUE;
}
#include "packet-h225-fn.c"
@@ -430,6 +431,394 @@ dissect_h225_h225_RasMessage(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
return offset;
}
+
+/* The following values represent the size of their valuestring arrays */
+
+#define RAS_MSG_TYPES (sizeof(h225_RasMessage_vals) / sizeof(value_string))
+#define CS_MSG_TYPES (sizeof(T_h323_message_body_vals) / sizeof(value_string))
+
+#define GRJ_REASONS (sizeof(GatekeeperRejectReason_vals) / sizeof(value_string))
+#define RRJ_REASONS (sizeof(RegistrationRejectReason_vals) / sizeof(value_string))
+#define URQ_REASONS (sizeof(UnregRequestReason_vals) / sizeof(value_string))
+#define URJ_REASONS (sizeof(UnregRejectReason_vals) / sizeof(value_string))
+#define ARJ_REASONS (sizeof(AdmissionRejectReason_vals) / sizeof(value_string))
+#define BRJ_REASONS (sizeof(BandRejectReason_vals) / sizeof(value_string))
+#define DRQ_REASONS (sizeof(DisengageReason_vals) / sizeof(value_string))
+#define DRJ_REASONS (sizeof(DisengageRejectReason_vals) / sizeof(value_string))
+#define LRJ_REASONS (sizeof(LocationRejectReason_vals) / sizeof(value_string))
+#define IRQNAK_REASONS (sizeof(InfoRequestNakReason_vals) / sizeof(value_string))
+#define REL_CMP_REASONS (sizeof(h225_ReleaseCompleteReason_vals) / sizeof(value_string))
+#define FACILITY_REASONS (sizeof(FacilityReason_vals) / sizeof(value_string))
+
+/* TAP STAT INFO */
+typedef enum
+{
+ MESSAGE_TYPE_COLUMN = 0,
+ COUNT_COLUMN
+} h225_stat_columns;
+
+typedef struct _h225_table_item {
+ guint count; /* Message count */
+ guint table_idx; /* stat_table index */
+} h225_table_item_t;
+
+static stat_tap_table_item h225_stat_fields[] = {{TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "Message Type or Reason", "%-25s"}, {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Count", "%d"}};
+
+static guint ras_msg_idx[RAS_MSG_TYPES];
+static guint cs_msg_idx[CS_MSG_TYPES];
+
+static guint grj_reason_idx[GRJ_REASONS];
+static guint rrj_reason_idx[RRJ_REASONS];
+static guint urq_reason_idx[URQ_REASONS];
+static guint urj_reason_idx[URJ_REASONS];
+static guint arj_reason_idx[ARJ_REASONS];
+static guint brj_reason_idx[BRJ_REASONS];
+static guint drq_reason_idx[DRQ_REASONS];
+static guint drj_reason_idx[DRJ_REASONS];
+static guint lrj_reason_idx[LRJ_REASONS];
+static guint irqnak_reason_idx[IRQNAK_REASONS];
+static guint rel_cmp_reason_idx[REL_CMP_REASONS];
+static guint facility_reason_idx[FACILITY_REASONS];
+
+static guint other_idx;
+
+void h225_stat_init(new_stat_tap_ui* new_stat, new_stat_tap_gui_init_cb gui_callback, void* gui_data)
+{
+ int num_fields = sizeof(h225_stat_fields)/sizeof(stat_tap_table_item);
+ new_stat_tap_table* table = new_stat_tap_init_table("H.225 Messages and Message Reasons", num_fields, 0, NULL, gui_callback, gui_data);
+ int row_idx = 0, msg_idx;
+ stat_tap_table_item_type items[sizeof(h225_stat_fields)/sizeof(stat_tap_table_item)];
+
+ new_stat_tap_add_table(new_stat, table);
+
+ items[MESSAGE_TYPE_COLUMN].type = TABLE_ITEM_STRING;
+ items[COUNT_COLUMN].type = TABLE_ITEM_UINT;
+ items[COUNT_COLUMN].value.uint_value = 0;
+
+ /* Add a row for each value type */
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ h225_RasMessage_vals[msg_idx].strptr
+ ? h225_RasMessage_vals[msg_idx].strptr
+ : "Unknown RAS message";
+ ras_msg_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (h225_RasMessage_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ T_h323_message_body_vals[msg_idx].strptr
+ ? T_h323_message_body_vals[msg_idx].strptr
+ : "Unknown CS message";
+ cs_msg_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (T_h323_message_body_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ GatekeeperRejectReason_vals[msg_idx].strptr
+ ? GatekeeperRejectReason_vals[msg_idx].strptr
+ : "Unknown gatekeeper reject reason";
+ grj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (GatekeeperRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ RegistrationRejectReason_vals[msg_idx].strptr
+ ? RegistrationRejectReason_vals[msg_idx].strptr
+ : "Unknown registration reject reason";
+ rrj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (RegistrationRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ UnregRequestReason_vals[msg_idx].strptr
+ ? UnregRequestReason_vals[msg_idx].strptr
+ : "Unknown unregistration request reason";
+ urq_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (UnregRequestReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ UnregRejectReason_vals[msg_idx].strptr
+ ? UnregRejectReason_vals[msg_idx].strptr
+ : "Unknown unregistration reject reason";
+ urj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (UnregRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ AdmissionRejectReason_vals[msg_idx].strptr
+ ? AdmissionRejectReason_vals[msg_idx].strptr
+ : "Unknown admission reject reason";
+ arj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (AdmissionRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ BandRejectReason_vals[msg_idx].strptr
+ ? BandRejectReason_vals[msg_idx].strptr
+ : "Unknown band reject reason";
+ brj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (BandRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ DisengageReason_vals[msg_idx].strptr
+ ? DisengageReason_vals[msg_idx].strptr
+ : "Unknown disengage reason";
+ drq_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (DisengageReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ DisengageRejectReason_vals[msg_idx].strptr
+ ? DisengageRejectReason_vals[msg_idx].strptr
+ : "Unknown disengage reject reason";
+ drj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (DisengageRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ LocationRejectReason_vals[msg_idx].strptr
+ ? LocationRejectReason_vals[msg_idx].strptr
+ : "Unknown location reject reason";
+ lrj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (LocationRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ InfoRequestNakReason_vals[msg_idx].strptr
+ ? InfoRequestNakReason_vals[msg_idx].strptr
+ : "Unknown info request nak reason";
+ irqnak_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (InfoRequestNakReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ h225_ReleaseCompleteReason_vals[msg_idx].strptr
+ ? h225_ReleaseCompleteReason_vals[msg_idx].strptr
+ : "Unknown release complete reason";
+ rel_cmp_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (h225_ReleaseCompleteReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ FacilityReason_vals[msg_idx].strptr
+ ? FacilityReason_vals[msg_idx].strptr
+ : "Unknown facility reason";
+ facility_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (FacilityReason_vals[msg_idx].strptr);
+
+
+ items[MESSAGE_TYPE_COLUMN].value.string_value = "Unknown H.225 message";
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ other_idx = row_idx;
+}
+
+static gboolean
+h225_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *hpi_ptr)
+{
+ new_stat_data_t* stat_data = (new_stat_data_t*)tapdata;
+ const h225_packet_info *hpi = (const h225_packet_info *)hpi_ptr;
+ int tag_idx = -1;
+ int reason_idx = -1;
+
+ if(hpi->msg_tag < 0) { /* uninitialized */
+ return FALSE;
+ }
+
+ switch (hpi->msg_type) {
+
+ case H225_RAS:
+ tag_idx = ras_msg_idx[MIN(hpi->msg_tag, (int)RAS_MSG_TYPES-1)];
+
+ /* Look for reason tag */
+ if(hpi->reason < 0) { /* uninitialized */
+ break;
+ }
+
+ switch(hpi->msg_tag) {
+
+ case 2: /* GRJ */
+ reason_idx = grj_reason_idx[MIN(hpi->reason, (int)GRJ_REASONS-1)];
+ break;
+ case 5: /* RRJ */
+ reason_idx = rrj_reason_idx[MIN(hpi->reason, (int)RRJ_REASONS-1)];
+ break;
+ case 6: /* URQ */
+ reason_idx = urq_reason_idx[MIN(hpi->reason, (int)URQ_REASONS-1)];
+ break;
+ case 8: /* URJ */
+ reason_idx = urj_reason_idx[MIN(hpi->reason, (int)URJ_REASONS-1)];
+ break;
+ case 11: /* ARJ */
+ reason_idx = arj_reason_idx[MIN(hpi->reason, (int)ARJ_REASONS-1)];
+ break;
+ case 14: /* BRJ */
+ reason_idx = brj_reason_idx[MIN(hpi->reason, (int)BRJ_REASONS-1)];
+ break;
+ case 15: /* DRQ */
+ reason_idx = drq_reason_idx[MIN(hpi->reason, (int)DRQ_REASONS-1)];
+ break;
+ case 17: /* DRJ */
+ reason_idx = drj_reason_idx[MIN(hpi->reason, (int)DRJ_REASONS-1)];
+ break;
+ case 20: /* LRJ */
+ reason_idx = lrj_reason_idx[MIN(hpi->reason, (int)LRJ_REASONS-1)];
+ break;
+ case 29: /* IRQ Nak */
+ reason_idx = irqnak_reason_idx[MIN(hpi->reason, (int)IRQNAK_REASONS-1)];
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+
+ break;
+
+ case H225_CS:
+ tag_idx = cs_msg_idx[MIN(hpi->msg_tag, (int)CS_MSG_TYPES-1)];
+
+ /* Look for reason tag */
+ if(hpi->reason < 0) { /* uninitialized */
+ break;
+ }
+
+ switch(hpi->msg_tag) {
+
+ case 5: /* ReleaseComplete */
+ reason_idx = rel_cmp_reason_idx[MIN(hpi->reason, (int)REL_CMP_REASONS-1)];
+ break;
+ case 6: /* Facility */
+ reason_idx = facility_reason_idx[MIN(hpi->reason, (int)FACILITY_REASONS-1)];
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+
+ break;
+
+ case H225_OTHERS:
+ default:
+ tag_idx = other_idx;
+ }
+
+ if (tag_idx >= 0) {
+ new_stat_tap_table*table = g_array_index(stat_data->new_stat_tap_data->tables, new_stat_tap_table*, 0);
+ stat_tap_table_item_type* msg_data = new_stat_tap_get_field_data(table, tag_idx, COUNT_COLUMN);;
+ msg_data->value.uint_value++;
+ new_stat_tap_set_field_data(table, tag_idx, COUNT_COLUMN, msg_data);
+
+ if (reason_idx >= 0) {
+ msg_data = new_stat_tap_get_field_data(table, reason_idx, COUNT_COLUMN);;
+ msg_data->value.uint_value++;
+ new_stat_tap_set_field_data(table, reason_idx, COUNT_COLUMN, msg_data);
+ }
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+h225_stat_reset(new_stat_tap_table* table)
+{
+ guint element;
+ stat_tap_table_item_type* item_data;
+
+ for (element = 0; element < table->num_elements; element++)
+ {
+ item_data = new_stat_tap_get_field_data(table, element, COUNT_COLUMN);
+ item_data->value.uint_value = 0;
+ new_stat_tap_set_field_data(table, element, COUNT_COLUMN, item_data);
+ }
+}
+
/*--- proto_register_h225 -------------------------------------------*/
void proto_register_h225(void) {
@@ -455,13 +844,33 @@ void proto_register_h225(void) {
NULL, 0, NULL, HFILL }},
#include "packet-h225-hfarr.c"
- };
+ };
/* List of subtrees */
- static gint *ett[] = {
- &ett_h225,
+ static gint *ett[] = {
+ &ett_h225,
#include "packet-h225-ettarr.c"
- };
+ };
+
+ static tap_param h225_stat_params[] = {
+ { PARAM_FILTER, "filter", "Filter", NULL, TRUE }
+ };
+
+ static new_stat_tap_ui h225_stat_table = {
+ REGISTER_STAT_GROUP_TELEPHONY,
+ "H.225",
+ PFNAME,
+ "h225,counter",
+ h225_stat_init,
+ h225_stat_packet,
+ h225_stat_reset,
+ NULL,
+ NULL,
+ sizeof(h225_stat_fields)/sizeof(stat_tap_table_item), h225_stat_fields,
+ sizeof(h225_stat_params)/sizeof(tap_param), h225_stat_params,
+ NULL
+ };
+
module_t *h225_module;
int proto_h225_ras;
@@ -494,7 +903,7 @@ void proto_register_h225(void) {
"ON - display tunnelled protocols inside H.225.0 tree, OFF - display tunnelled protocols in root tree after H.225.0",
&h225_tp_in_tree);
- new_register_dissector("h225", dissect_h225_H323UserInformation, proto_h225);
+ new_register_dissector(PFNAME, dissect_h225_H323UserInformation, proto_h225);
new_register_dissector("h323ui",dissect_h225_H323UserInformation, proto_h225);
new_register_dissector("h225.ras", dissect_h225_h225_RasMessage, proto_h225);
@@ -506,9 +915,11 @@ void proto_register_h225(void) {
register_init_routine(&h225_init_routine);
register_cleanup_routine(&h225_cleanup_routine);
- h225_tap = register_tap("h225");
+ h225_tap = register_tap(PFNAME);
+
+ register_rtd_table(proto_h225_ras, PFNAME, NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL);
- register_rtd_table(proto_h225_ras, "h225", NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL);
+ register_new_stat_tap_ui(&h225_stat_table);
oid_add_from_string("Version 1","0.0.8.2250.0.1");
oid_add_from_string("Version 2","0.0.8.2250.0.2");
diff --git a/asn1/h225/packet-h225-template.h b/asn1/h225/packet-h225-template.h
index 9166603cce..6559fcbc39 100644
--- a/asn1/h225/packet-h225-template.h
+++ b/asn1/h225/packet-h225-template.h
@@ -65,7 +65,7 @@ typedef struct _h225_packet_info {
guint16 h245_port;
gchar dialedDigits[129]; /* Dialed Digits in the LRQ and LCF used for voip analysis */
gboolean is_destinationInfo;
- gchar frame_label[50]; /* the Fram label used by graph_analysis, what is a abreviation of cinfo */
+ gchar frame_label[50]; /* the Frame label used by graph_analysis, what is a abreviation of cinfo */
} h225_packet_info;
/*
diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c
index bc59c299ec..bc34efaec6 100644
--- a/epan/dissectors/packet-bootp.c
+++ b/epan/dissectors/packet-bootp.c
@@ -5391,7 +5391,7 @@ void bootp_stat_init(new_stat_tap_ui* new_stat, new_stat_tap_gui_init_cb gui_cal
new_stat_tap_add_table(new_stat, table);
- /* Add a fow for each value type */
+ /* Add a row for each value type */
while (opt53_text[i].strptr)
{
items[MESSAGE_TYPE_COLUMN].type = TABLE_ITEM_STRING;
diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c
index 662796b9a1..efc7e784b4 100644
--- a/epan/dissectors/packet-h225.c
+++ b/epan/dissectors/packet-h225.c
@@ -49,6 +49,7 @@
#include <epan/asn1.h>
#include <epan/t35.h>
#include <epan/tap.h>
+#include <epan/stat_tap_ui.h>
#include <epan/rtd_table.h>
#include "packet-tpkt.h"
#include "packet-per.h"
@@ -92,7 +93,7 @@ typedef struct _h225ras_call_info_key {
conversation_t *conversation;
} h225ras_call_info_key;
-static h225_packet_info pi_arr[5]; /* We assuming a maximum of 5 H225 messaages per packet */
+static h225_packet_info pi_arr[5]; /* We assuming a maximum of 5 H.225 messages per packet */
static int pi_current=0;
static h225_packet_info *h225_pi=&pi_arr[0];
@@ -910,7 +911,7 @@ static int hf_h225_stopped = -1; /* NULL */
static int hf_h225_notAvailable = -1; /* NULL */
/*--- End of included file: packet-h225-hf.c ---*/
-#line 131 "../../asn1/h225/packet-h225-template.c"
+#line 132 "../../asn1/h225/packet-h225-template.c"
/* Initialize the subtree pointers */
static gint ett_h225 = -1;
@@ -1158,7 +1159,7 @@ static gint ett_h225_ServiceControlResponse = -1;
static gint ett_h225_T_result = -1;
/*--- End of included file: packet-h225-ett.c ---*/
-#line 135 "../../asn1/h225/packet-h225-template.c"
+#line 136 "../../asn1/h225/packet-h225-template.c"
/* Preferences */
static guint h225_tls_port = TLS_PORT_CS;
@@ -1213,11 +1214,11 @@ typedef enum _ras_category {
#define NUM_RAS_STATS 7
-static int
+static gboolean
h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
{
- rtd_data_t* rtd_data = (rtd_data_t*)phs;
- rtd_stat_table* rs = &rtd_data->stat_table;
+ rtd_data_t* rtd_data = (rtd_data_t*)phs;
+ rtd_stat_table* rs = &rtd_data->stat_table;
const h225_packet_info *pi=(const h225_packet_info *)phi;
ras_type rasmsg_type = RAS_OTHER;
@@ -1225,7 +1226,7 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
if (pi->msg_type != H225_RAS || pi->msg_tag == -1) {
/* No RAS Message or uninitialized msg_tag -> return */
- return 0;
+ return FALSE;
}
if (pi->msg_tag < 21) {
@@ -1235,7 +1236,7 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
}
else {
/* No SRT yet (ToDo) */
- return 0;
+ return FALSE;
}
switch(rasmsg_type) {
@@ -1267,9 +1268,9 @@ h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, co
break;
default:
- return 0;
+ return FALSE;
}
- return 1;
+ return TRUE;
}
@@ -7628,7 +7629,7 @@ static int dissect_RasMessage_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro
/*--- End of included file: packet-h225-fn.c ---*/
-#line 249 "../../asn1/h225/packet-h225-template.c"
+#line 250 "../../asn1/h225/packet-h225-template.c"
/* Forward declaration we need below */
@@ -7813,6 +7814,394 @@ dissect_h225_h225_RasMessage(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
return offset;
}
+
+/* The following values represent the size of their valuestring arrays */
+
+#define RAS_MSG_TYPES (sizeof(h225_RasMessage_vals) / sizeof(value_string))
+#define CS_MSG_TYPES (sizeof(T_h323_message_body_vals) / sizeof(value_string))
+
+#define GRJ_REASONS (sizeof(GatekeeperRejectReason_vals) / sizeof(value_string))
+#define RRJ_REASONS (sizeof(RegistrationRejectReason_vals) / sizeof(value_string))
+#define URQ_REASONS (sizeof(UnregRequestReason_vals) / sizeof(value_string))
+#define URJ_REASONS (sizeof(UnregRejectReason_vals) / sizeof(value_string))
+#define ARJ_REASONS (sizeof(AdmissionRejectReason_vals) / sizeof(value_string))
+#define BRJ_REASONS (sizeof(BandRejectReason_vals) / sizeof(value_string))
+#define DRQ_REASONS (sizeof(DisengageReason_vals) / sizeof(value_string))
+#define DRJ_REASONS (sizeof(DisengageRejectReason_vals) / sizeof(value_string))
+#define LRJ_REASONS (sizeof(LocationRejectReason_vals) / sizeof(value_string))
+#define IRQNAK_REASONS (sizeof(InfoRequestNakReason_vals) / sizeof(value_string))
+#define REL_CMP_REASONS (sizeof(h225_ReleaseCompleteReason_vals) / sizeof(value_string))
+#define FACILITY_REASONS (sizeof(FacilityReason_vals) / sizeof(value_string))
+
+/* TAP STAT INFO */
+typedef enum
+{
+ MESSAGE_TYPE_COLUMN = 0,
+ COUNT_COLUMN
+} h225_stat_columns;
+
+typedef struct _h225_table_item {
+ guint count; /* Message count */
+ guint table_idx; /* stat_table index */
+} h225_table_item_t;
+
+static stat_tap_table_item h225_stat_fields[] = {{TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "Message Type or Reason", "%-25s"}, {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Count", "%d"}};
+
+static guint ras_msg_idx[RAS_MSG_TYPES];
+static guint cs_msg_idx[CS_MSG_TYPES];
+
+static guint grj_reason_idx[GRJ_REASONS];
+static guint rrj_reason_idx[RRJ_REASONS];
+static guint urq_reason_idx[URQ_REASONS];
+static guint urj_reason_idx[URJ_REASONS];
+static guint arj_reason_idx[ARJ_REASONS];
+static guint brj_reason_idx[BRJ_REASONS];
+static guint drq_reason_idx[DRQ_REASONS];
+static guint drj_reason_idx[DRJ_REASONS];
+static guint lrj_reason_idx[LRJ_REASONS];
+static guint irqnak_reason_idx[IRQNAK_REASONS];
+static guint rel_cmp_reason_idx[REL_CMP_REASONS];
+static guint facility_reason_idx[FACILITY_REASONS];
+
+static guint other_idx;
+
+void h225_stat_init(new_stat_tap_ui* new_stat, new_stat_tap_gui_init_cb gui_callback, void* gui_data)
+{
+ int num_fields = sizeof(h225_stat_fields)/sizeof(stat_tap_table_item);
+ new_stat_tap_table* table = new_stat_tap_init_table("H.225 Messages and Message Reasons", num_fields, 0, NULL, gui_callback, gui_data);
+ int row_idx = 0, msg_idx;
+ stat_tap_table_item_type items[sizeof(h225_stat_fields)/sizeof(stat_tap_table_item)];
+
+ new_stat_tap_add_table(new_stat, table);
+
+ items[MESSAGE_TYPE_COLUMN].type = TABLE_ITEM_STRING;
+ items[COUNT_COLUMN].type = TABLE_ITEM_UINT;
+ items[COUNT_COLUMN].value.uint_value = 0;
+
+ /* Add a row for each value type */
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ h225_RasMessage_vals[msg_idx].strptr
+ ? h225_RasMessage_vals[msg_idx].strptr
+ : "Unknown RAS message";
+ ras_msg_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (h225_RasMessage_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ T_h323_message_body_vals[msg_idx].strptr
+ ? T_h323_message_body_vals[msg_idx].strptr
+ : "Unknown CS message";
+ cs_msg_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (T_h323_message_body_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ GatekeeperRejectReason_vals[msg_idx].strptr
+ ? GatekeeperRejectReason_vals[msg_idx].strptr
+ : "Unknown gatekeeper reject reason";
+ grj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (GatekeeperRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ RegistrationRejectReason_vals[msg_idx].strptr
+ ? RegistrationRejectReason_vals[msg_idx].strptr
+ : "Unknown registration reject reason";
+ rrj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (RegistrationRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ UnregRequestReason_vals[msg_idx].strptr
+ ? UnregRequestReason_vals[msg_idx].strptr
+ : "Unknown unregistration request reason";
+ urq_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (UnregRequestReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ UnregRejectReason_vals[msg_idx].strptr
+ ? UnregRejectReason_vals[msg_idx].strptr
+ : "Unknown unregistration reject reason";
+ urj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (UnregRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ AdmissionRejectReason_vals[msg_idx].strptr
+ ? AdmissionRejectReason_vals[msg_idx].strptr
+ : "Unknown admission reject reason";
+ arj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (AdmissionRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ BandRejectReason_vals[msg_idx].strptr
+ ? BandRejectReason_vals[msg_idx].strptr
+ : "Unknown band reject reason";
+ brj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (BandRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ DisengageReason_vals[msg_idx].strptr
+ ? DisengageReason_vals[msg_idx].strptr
+ : "Unknown disengage reason";
+ drq_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (DisengageReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ DisengageRejectReason_vals[msg_idx].strptr
+ ? DisengageRejectReason_vals[msg_idx].strptr
+ : "Unknown disengage reject reason";
+ drj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (DisengageRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ LocationRejectReason_vals[msg_idx].strptr
+ ? LocationRejectReason_vals[msg_idx].strptr
+ : "Unknown location reject reason";
+ lrj_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (LocationRejectReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ InfoRequestNakReason_vals[msg_idx].strptr
+ ? InfoRequestNakReason_vals[msg_idx].strptr
+ : "Unknown info request nak reason";
+ irqnak_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (InfoRequestNakReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ h225_ReleaseCompleteReason_vals[msg_idx].strptr
+ ? h225_ReleaseCompleteReason_vals[msg_idx].strptr
+ : "Unknown release complete reason";
+ rel_cmp_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (h225_ReleaseCompleteReason_vals[msg_idx].strptr);
+
+ msg_idx = 0;
+ do
+ {
+ items[MESSAGE_TYPE_COLUMN].value.string_value =
+ FacilityReason_vals[msg_idx].strptr
+ ? FacilityReason_vals[msg_idx].strptr
+ : "Unknown facility reason";
+ facility_reason_idx[msg_idx] = row_idx;
+
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ row_idx++;
+ msg_idx++;
+ } while (FacilityReason_vals[msg_idx].strptr);
+
+
+ items[MESSAGE_TYPE_COLUMN].value.string_value = "Unknown H.225 message";
+ new_stat_tap_init_table_row(table, row_idx, num_fields, items);
+ other_idx = row_idx;
+}
+
+static gboolean
+h225_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *hpi_ptr)
+{
+ new_stat_data_t* stat_data = (new_stat_data_t*)tapdata;
+ const h225_packet_info *hpi = (const h225_packet_info *)hpi_ptr;
+ int tag_idx = -1;
+ int reason_idx = -1;
+
+ if(hpi->msg_tag < 0) { /* uninitialized */
+ return FALSE;
+ }
+
+ switch (hpi->msg_type) {
+
+ case H225_RAS:
+ tag_idx = ras_msg_idx[MIN(hpi->msg_tag, (int)RAS_MSG_TYPES-1)];
+
+ /* Look for reason tag */
+ if(hpi->reason < 0) { /* uninitialized */
+ break;
+ }
+
+ switch(hpi->msg_tag) {
+
+ case 2: /* GRJ */
+ reason_idx = grj_reason_idx[MIN(hpi->reason, (int)GRJ_REASONS-1)];
+ break;
+ case 5: /* RRJ */
+ reason_idx = rrj_reason_idx[MIN(hpi->reason, (int)RRJ_REASONS-1)];
+ break;
+ case 6: /* URQ */
+ reason_idx = urq_reason_idx[MIN(hpi->reason, (int)URQ_REASONS-1)];
+ break;
+ case 8: /* URJ */
+ reason_idx = urj_reason_idx[MIN(hpi->reason, (int)URJ_REASONS-1)];
+ break;
+ case 11: /* ARJ */
+ reason_idx = arj_reason_idx[MIN(hpi->reason, (int)ARJ_REASONS-1)];
+ break;
+ case 14: /* BRJ */
+ reason_idx = brj_reason_idx[MIN(hpi->reason, (int)BRJ_REASONS-1)];
+ break;
+ case 15: /* DRQ */
+ reason_idx = drq_reason_idx[MIN(hpi->reason, (int)DRQ_REASONS-1)];
+ break;
+ case 17: /* DRJ */
+ reason_idx = drj_reason_idx[MIN(hpi->reason, (int)DRJ_REASONS-1)];
+ break;
+ case 20: /* LRJ */
+ reason_idx = lrj_reason_idx[MIN(hpi->reason, (int)LRJ_REASONS-1)];
+ break;
+ case 29: /* IRQ Nak */
+ reason_idx = irqnak_reason_idx[MIN(hpi->reason, (int)IRQNAK_REASONS-1)];
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+
+ break;
+
+ case H225_CS:
+ tag_idx = cs_msg_idx[MIN(hpi->msg_tag, (int)CS_MSG_TYPES-1)];
+
+ /* Look for reason tag */
+ if(hpi->reason < 0) { /* uninitialized */
+ break;
+ }
+
+ switch(hpi->msg_tag) {
+
+ case 5: /* ReleaseComplete */
+ reason_idx = rel_cmp_reason_idx[MIN(hpi->reason, (int)REL_CMP_REASONS-1)];
+ break;
+ case 6: /* Facility */
+ reason_idx = facility_reason_idx[MIN(hpi->reason, (int)FACILITY_REASONS-1)];
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+
+ break;
+
+ case H225_OTHERS:
+ default:
+ tag_idx = other_idx;
+ }
+
+ if (tag_idx >= 0) {
+ new_stat_tap_table*table = g_array_index(stat_data->new_stat_tap_data->tables, new_stat_tap_table*, 0);
+ stat_tap_table_item_type* msg_data = new_stat_tap_get_field_data(table, tag_idx, COUNT_COLUMN);;
+ msg_data->value.uint_value++;
+ new_stat_tap_set_field_data(table, tag_idx, COUNT_COLUMN, msg_data);
+
+ if (reason_idx >= 0) {
+ msg_data = new_stat_tap_get_field_data(table, reason_idx, COUNT_COLUMN);;
+ msg_data->value.uint_value++;
+ new_stat_tap_set_field_data(table, reason_idx, COUNT_COLUMN, msg_data);
+ }
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+h225_stat_reset(new_stat_tap_table* table)
+{
+ guint element;
+ stat_tap_table_item_type* item_data;
+
+ for (element = 0; element < table->num_elements; element++)
+ {
+ item_data = new_stat_tap_get_field_data(table, element, COUNT_COLUMN);
+ item_data->value.uint_value = 0;
+ new_stat_tap_set_field_data(table, element, COUNT_COLUMN, item_data);
+ }
+}
+
/*--- proto_register_h225 -------------------------------------------*/
void proto_register_h225(void) {
@@ -10922,12 +11311,12 @@ void proto_register_h225(void) {
NULL, HFILL }},
/*--- End of included file: packet-h225-hfarr.c ---*/
-#line 458 "../../asn1/h225/packet-h225-template.c"
- };
+#line 847 "../../asn1/h225/packet-h225-template.c"
+ };
/* List of subtrees */
- static gint *ett[] = {
- &ett_h225,
+ static gint *ett[] = {
+ &ett_h225,
/*--- Included file: packet-h225-ettarr.c ---*/
#line 1 "../../asn1/h225/packet-h225-ettarr.c"
@@ -11172,8 +11561,28 @@ void proto_register_h225(void) {
&ett_h225_T_result,
/*--- End of included file: packet-h225-ettarr.c ---*/
-#line 464 "../../asn1/h225/packet-h225-template.c"
- };
+#line 853 "../../asn1/h225/packet-h225-template.c"
+ };
+
+ static tap_param h225_stat_params[] = {
+ { PARAM_FILTER, "filter", "Filter", NULL, TRUE }
+ };
+
+ static new_stat_tap_ui h225_stat_table = {
+ REGISTER_STAT_GROUP_TELEPHONY,
+ "H.225",
+ PFNAME,
+ "h225,counter",
+ h225_stat_init,
+ h225_stat_packet,
+ h225_stat_reset,
+ NULL,
+ NULL,
+ sizeof(h225_stat_fields)/sizeof(stat_tap_table_item), h225_stat_fields,
+ sizeof(h225_stat_params)/sizeof(tap_param), h225_stat_params,
+ NULL
+ };
+
module_t *h225_module;
int proto_h225_ras;
@@ -11206,7 +11615,7 @@ void proto_register_h225(void) {
"ON - display tunnelled protocols inside H.225.0 tree, OFF - display tunnelled protocols in root tree after H.225.0",
&h225_tp_in_tree);
- new_register_dissector("h225", dissect_h225_H323UserInformation, proto_h225);
+ new_register_dissector(PFNAME, dissect_h225_H323UserInformation, proto_h225);
new_register_dissector("h323ui",dissect_h225_H323UserInformation, proto_h225);
new_register_dissector("h225.ras", dissect_h225_h225_RasMessage, proto_h225);
@@ -11218,9 +11627,11 @@ void proto_register_h225(void) {
register_init_routine(&h225_init_routine);
register_cleanup_routine(&h225_cleanup_routine);
- h225_tap = register_tap("h225");
+ h225_tap = register_tap(PFNAME);
+
+ register_rtd_table(proto_h225_ras, PFNAME, NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL);
- register_rtd_table(proto_h225_ras, "h225", NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL);
+ register_new_stat_tap_ui(&h225_stat_table);
oid_add_from_string("Version 1","0.0.8.2250.0.1");
oid_add_from_string("Version 2","0.0.8.2250.0.2");
diff --git a/epan/dissectors/packet-h225.h b/epan/dissectors/packet-h225.h
index b016f72d0d..ad5e9bf3a2 100644
--- a/epan/dissectors/packet-h225.h
+++ b/epan/dissectors/packet-h225.h
@@ -73,7 +73,7 @@ typedef struct _h225_packet_info {
guint16 h245_port;
gchar dialedDigits[129]; /* Dialed Digits in the LRQ and LCF used for voip analysis */
gboolean is_destinationInfo;
- gchar frame_label[50]; /* the Fram label used by graph_analysis, what is a abreviation of cinfo */
+ gchar frame_label[50]; /* the Frame label used by graph_analysis, what is a abreviation of cinfo */
} h225_packet_info;
/*
diff --git a/epan/stat_tap_ui.c b/epan/stat_tap_ui.c
index 3f8a15f458..91699419e1 100644
--- a/epan/stat_tap_ui.c
+++ b/epan/stat_tap_ui.c
@@ -192,7 +192,7 @@ void new_stat_tap_add_table(new_stat_tap_ui* new_stat, new_stat_tap_table* table
g_array_insert_val(new_stat->tables, new_stat->tables->len, table);
}
-void new_stat_tap_init_table_row(new_stat_tap_table *stat_table, guint table_index, guint num_fields, stat_tap_table_item_type* fields)
+void new_stat_tap_init_table_row(new_stat_tap_table *stat_table, guint table_index, guint num_fields, const stat_tap_table_item_type* fields)
{
/* we have discovered a new procedure. Extend the table accordingly */
if(table_index>=stat_table->num_elements){
diff --git a/epan/stat_tap_ui.h b/epan/stat_tap_ui.h
index b8661b778c..cba5d46dc3 100644
--- a/epan/stat_tap_ui.h
+++ b/epan/stat_tap_ui.h
@@ -163,7 +163,7 @@ WS_DLL_PUBLIC new_stat_tap_table* new_stat_tap_init_table(const char *name, int
const char *filter_string, new_stat_tap_gui_init_cb gui_callback, void* gui_data);
WS_DLL_PUBLIC void new_stat_tap_add_table(new_stat_tap_ui* new_stat, new_stat_tap_table* table);
-WS_DLL_PUBLIC void new_stat_tap_init_table_row(new_stat_tap_table *stat_table, guint table_index, guint num_fields, stat_tap_table_item_type* fields);
+WS_DLL_PUBLIC void new_stat_tap_init_table_row(new_stat_tap_table *stat_table, guint table_index, guint num_fields, const stat_tap_table_item_type* fields);
WS_DLL_PUBLIC stat_tap_table_item_type* new_stat_tap_get_field_data(const new_stat_tap_table *stat_table, guint table_index, guint field_index);
WS_DLL_PUBLIC void new_stat_tap_set_field_data(new_stat_tap_table *stat_table, guint table_index, guint field_index, stat_tap_table_item_type* field_data);
WS_DLL_PUBLIC void reset_stat_table(new_stat_tap_ui* new_stat, new_stat_tap_gui_reset_cb gui_callback, void *callback_data);
diff --git a/ui/gtk/CMakeLists.txt b/ui/gtk/CMakeLists.txt
index 197ea46793..6ef954d7b2 100644
--- a/ui/gtk/CMakeLists.txt
+++ b/ui/gtk/CMakeLists.txt
@@ -206,7 +206,6 @@ set(WIRESHARK_TAP_SRC
gsm_a_stat.c
gsm_map_stat.c
gsm_map_summary.c
- h225_counter.c
iax2_analysis.c
io_stat.c
lbm_stream_dlg.c
diff --git a/ui/gtk/Makefile.common b/ui/gtk/Makefile.common
index b684b186e4..f359409618 100644
--- a/ui/gtk/Makefile.common
+++ b/ui/gtk/Makefile.common
@@ -157,7 +157,6 @@ WIRESHARK_TAP_SRC = \
gsm_a_stat.c \
gsm_map_stat.c \
gsm_map_summary.c \
- h225_counter.c \
iax2_analysis.c \
io_stat.c \
lbm_stream_dlg.c \
diff --git a/ui/gtk/h225_counter.c b/ui/gtk/h225_counter.c
deleted file mode 100644
index 69d6526226..0000000000
--- a/ui/gtk/h225_counter.c
+++ /dev/null
@@ -1,594 +0,0 @@
-/* h225_counter.c
- * H.225 message counter for Wireshark
- * Copyright 2003 Lars Roland
- *
- * 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
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-
-
-#include <epan/packet.h>
-#include <epan/value_string.h>
-#include <epan/tap.h>
-#include <epan/dissectors/packet-h225.h>
-
-#include "ui/simple_dialog.h"
-
-#include "ui/gtk/gui_stat_util.h"
-#include "ui/gtk/dlg_utils.h"
-#include "ui/gtk/tap_param_dlg.h"
-#include "ui/gtk/gui_utils.h"
-#include "ui/gtk/main.h"
-
-
-void register_tap_listener_gtk_h225counter(void);
-static void gtk_h225counter_init(const char *opt_arg, void *userdata);
-
-static tap_param h225_counter_params[] = {
- { PARAM_FILTER, "filter", "Filter", NULL, TRUE }
-};
-
-static tap_param_dlg h225_counter_dlg = {
- "H.225 Messages and Message Reasons",
- "h225,counter",
- gtk_h225counter_init,
- -1,
- G_N_ELEMENTS(h225_counter_params),
- h225_counter_params,
- NULL
-};
-
-/* following values represent the size of their valuestring arrays */
-
-#define RAS_MSG_TYPES 33
-#define CS_MSG_TYPES 13
-
-#define GRJ_REASONS 8
-#define RRJ_REASONS 18
-#define URQ_REASONS 6
-#define URJ_REASONS 6
-#define ARJ_REASONS 22
-#define BRJ_REASONS 8
-#define DRQ_REASONS 3
-#define DRJ_REASONS 4
-#define LRJ_REASONS 16
-#define IRQNAK_REASONS 4
-#define REL_CMP_REASONS 26
-#define FACILITY_REASONS 11
-
-
-/* used to keep track of the statistics for an entire program interface */
-typedef struct _h225counter_t {
- GtkWidget *win;
- GtkWidget *vbox;
- char *filter;
- GtkWidget *scrolled_window;
- GtkTreeView *table;
- guint32 ras_msg[RAS_MSG_TYPES + 1];
- guint32 cs_msg[CS_MSG_TYPES + 1];
- guint32 grj_reason[GRJ_REASONS + 1];
- guint32 rrj_reason[RRJ_REASONS + 1];
- guint32 urq_reason[URQ_REASONS + 1];
- guint32 urj_reason[URJ_REASONS + 1];
- guint32 arj_reason[ARJ_REASONS + 1];
- guint32 brj_reason[BRJ_REASONS + 1];
- guint32 drq_reason[DRQ_REASONS + 1];
- guint32 drj_reason[DRJ_REASONS + 1];
- guint32 lrj_reason[LRJ_REASONS + 1];
- guint32 irqnak_reason[IRQNAK_REASONS + 1];
- guint32 rel_cmp_reason[REL_CMP_REASONS + 1];
- guint32 facility_reason[FACILITY_REASONS + 1];
-} h225counter_t;
-
-
-static void
-h225counter_reset(void *phs)
-{
- h225counter_t *hs=(h225counter_t *)phs;
- int i;
-
- for(i=0;i<=RAS_MSG_TYPES;i++) {
- hs->ras_msg[i] = 0;
- }
- for(i=0;i<=CS_MSG_TYPES;i++) {
- hs->cs_msg[i] = 0;
- }
- for(i=0;i<=GRJ_REASONS;i++) {
- hs->grj_reason[i] = 0;
- }
- for(i=0;i<=RRJ_REASONS;i++) {
- hs->rrj_reason[i] = 0;
- }
- for(i=0;i<=URQ_REASONS;i++) {
- hs->urq_reason[i] = 0;
- }
- for(i=0;i<=URJ_REASONS;i++) {
- hs->urj_reason[i] = 0;
- }
- for(i=0;i<=ARJ_REASONS;i++) {
- hs->arj_reason[i] = 0;
- }
- for(i=0;i<=BRJ_REASONS;i++) {
- hs->brj_reason[i] = 0;
- }
- for(i=0;i<=DRQ_REASONS;i++) {
- hs->drq_reason[i] = 0;
- }
- for(i=0;i<=DRJ_REASONS;i++) {
- hs->drj_reason[i] = 0;
- }
- for(i=0;i<=LRJ_REASONS;i++) {
- hs->lrj_reason[i] = 0;
- }
- for(i=0;i<=IRQNAK_REASONS;i++) {
- hs->irqnak_reason[i] = 0;
- }
- for(i=0;i<=REL_CMP_REASONS;i++) {
- hs->rel_cmp_reason[i] = 0;
- }
- for(i=0;i<=FACILITY_REASONS;i++) {
- hs->facility_reason[i] = 0;
- }
-}
-
-static int
-h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
-{
- h225counter_t *hs=(h225counter_t *)phs;
- const h225_packet_info *pi=(const h225_packet_info *)phi;
-
- switch (pi->msg_type) {
-
- case H225_RAS:
- if(pi->msg_tag==-1) { /* uninitialized */
- return 0;
- }
- else if (pi->msg_tag >= RAS_MSG_TYPES) { /* unknown */
- hs->ras_msg[RAS_MSG_TYPES]++;
- }
- else {
- hs->ras_msg[pi->msg_tag]++;
- }
-
- /* Look for reason tag */
- if(pi->reason==-1) { /* uninitialized */
- break;
- }
-
- switch(pi->msg_tag) {
-
- case 2: /* GRJ */
- if(pi->reason < GRJ_REASONS)
- hs->grj_reason[pi->reason]++;
- else
- hs->grj_reason[GRJ_REASONS]++;
- break;
- case 5: /* RRJ */
- if(pi->reason < RRJ_REASONS)
- hs->rrj_reason[pi->reason]++;
- else
- hs->rrj_reason[RRJ_REASONS]++;
- break;
- case 6: /* URQ */
- if(pi->reason < URQ_REASONS)
- hs->urq_reason[pi->reason]++;
- else
- hs->urq_reason[URQ_REASONS]++;
- break;
- case 8: /* URJ */
- if(pi->reason < URJ_REASONS)
- hs->urj_reason[pi->reason]++;
- else
- hs->urj_reason[URJ_REASONS]++;
- break;
- case 11: /* ARJ */
- if(pi->reason < ARJ_REASONS)
- hs->arj_reason[pi->reason]++;
- else
- hs->arj_reason[ARJ_REASONS]++;
- break;
- case 14: /* BRJ */
- if(pi->reason < BRJ_REASONS)
- hs->brj_reason[pi->reason]++;
- else
- hs->brj_reason[BRJ_REASONS]++;
- break;
- case 15: /* DRQ */
- if(pi->reason < DRQ_REASONS)
- hs->drq_reason[pi->reason]++;
- else
- hs->drq_reason[DRQ_REASONS]++;
- break;
- case 17: /* DRJ */
- if(pi->reason < DRJ_REASONS)
- hs->drj_reason[pi->reason]++;
- else
- hs->drj_reason[DRJ_REASONS]++;
- break;
- case 20: /* LRJ */
- if(pi->reason < LRJ_REASONS)
- hs->lrj_reason[pi->reason]++;
- else
- hs->lrj_reason[LRJ_REASONS]++;
- break;
- case 29: /* IRQ Nak */
- if(pi->reason < IRQNAK_REASONS)
- hs->irqnak_reason[pi->reason]++;
- else
- hs->irqnak_reason[IRQNAK_REASONS]++;
- break;
-
- default:
- /* do nothing */
- break;
- }
-
- break;
-
- case H225_CS:
- if(pi->msg_tag==-1) { /* uninitialized */
- return 0;
- }
- else if (pi->msg_tag >= CS_MSG_TYPES) { /* unknown */
- hs->cs_msg[CS_MSG_TYPES]++;
- }
- else {
- hs->cs_msg[pi->msg_tag]++;
- }
-
- /* Look for reason tag */
- if(pi->reason==-1) { /* uninitialized */
- break;
- }
-
- switch(pi->msg_tag) {
-
- case 5: /* ReleaseComplete */
- if(pi->reason < REL_CMP_REASONS)
- hs->rel_cmp_reason[pi->reason]++;
- else
- hs->rel_cmp_reason[REL_CMP_REASONS]++;
- break;
- case 6: /* Facility */
- if(pi->reason < FACILITY_REASONS)
- hs->facility_reason[pi->reason]++;
- else
- hs->facility_reason[FACILITY_REASONS]++;
- break;
- default:
- /* do nothing */
- break;
- }
-
- break;
-
- default:
- return 0;
- }
-
- return 1;
-}
-
-static void
-h225counter_draw(void *phs)
-{
- h225counter_t *hs=(h225counter_t *)phs;
- int i,j;
- char str[256];
- gchar* tmp_str;
- GtkListStore *store;
- GtkTreeIter iter;
-
- /* Now print Message and Reason Counter Table */
- /* clear list before printing */
- store = GTK_LIST_STORE(gtk_tree_view_get_model(hs->table));
- gtk_list_store_clear(store);
-
- for(i=0;i<=RAS_MSG_TYPES;i++) {
- if(hs->ras_msg[i]!=0) {
- tmp_str = val_to_str_wmem(NULL,i,h225_RasMessage_vals,"unknown ras-messages (%d)");
- g_snprintf(str, 256, "%s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->ras_msg[i], -1);
-
- /* reason counter */
- switch(i) {
- case 2: /* GRJ */
- for(j=0;j<=GRJ_REASONS;j++) {
- if(hs->grj_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,GatekeeperRejectReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->grj_reason[j], -1);
- }
- }
- break;
- case 5: /* RRJ */
- for(j=0;j<=RRJ_REASONS;j++) {
- if(hs->rrj_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,RegistrationRejectReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->rrj_reason[j], -1);
- }
- }
- break;
- case 6: /* URQ */
- for(j=0;j<=URQ_REASONS;j++) {
- if(hs->urq_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,UnregRequestReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->urq_reason[j], -1);
- }
- }
- break;
- case 8: /* URJ */
- for(j=0;j<=URJ_REASONS;j++) {
- if(hs->urj_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,UnregRejectReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->urj_reason[j], -1);
- }
- }
- break;
- case 11: /* ARJ */
- for(j=0;j<=ARJ_REASONS;j++) {
- if(hs->arj_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,AdmissionRejectReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->arj_reason[j], -1);
- }
- }
- break;
- case 14: /* BRJ */
- for(j=0;j<=BRJ_REASONS;j++) {
- if(hs->brj_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,BandRejectReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->brj_reason[j], -1);
- }
- }
- break;
- case 15: /* DRQ */
- for(j=0;j<=DRQ_REASONS;j++) {
- if(hs->drq_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,DisengageReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->drq_reason[j], -1);
- }
- }
- break;
- case 17: /* DRJ */
- for(j=0;j<=DRJ_REASONS;j++) {
- if(hs->drj_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,DisengageRejectReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->drj_reason[j], -1);
- }
- }
- break;
- case 20: /* LRJ */
- for(j=0;j<=LRJ_REASONS;j++) {
- if(hs->lrj_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,LocationRejectReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->lrj_reason[j], -1);
- }
- }
- break;
- case 29: /* IRQNak */
- for(j=0;j<=IRQNAK_REASONS;j++) {
- if(hs->irqnak_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,InfoRequestNakReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->irqnak_reason[j], -1);
- }
- }
- break;
- default:
- break;
- }
- /* end of reason counter*/
- }
- }
-
- for(i=0;i<=CS_MSG_TYPES;i++) {
- if(hs->cs_msg[i]!=0) {
- tmp_str = val_to_str_wmem(NULL,i,T_h323_message_body_vals,"unknown cs-messages");
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, tmp_str,
- 1, hs->cs_msg[i], -1);
- wmem_free(NULL, tmp_str);
-
- /* reason counter */
- switch(i) {
- case 5: /* ReleaseComplete */
- for(j=0;j<=REL_CMP_REASONS;j++) {
- if(hs->rel_cmp_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,h225_ReleaseCompleteReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->rel_cmp_reason[j], -1);
- }
- }
- break;
- case 6: /* Facility */
- for(j=0;j<=FACILITY_REASONS;j++) {
- if(hs->facility_reason[j]!=0) {
- tmp_str = val_to_str_wmem(NULL,j,FacilityReason_vals,"unknown reason (%d)");
- g_snprintf(str, 256," %s", tmp_str);
- wmem_free(NULL, tmp_str);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, str,
- 1, hs->facility_reason[j], -1);
- }
- }
- break;
- default:
- break;
- }
- }
- }
-}
-
-static void
-win_destroy_cb(GtkWindow *win _U_, gpointer data)
-{
- h225counter_t *hs=(h225counter_t *)data;
-
- remove_tap_listener(hs);
-
- if(hs->filter){
- g_free(hs->filter);
- hs->filter=NULL;
- }
- g_free(hs);
-}
-
-static const stat_column titles[]={
- {G_TYPE_STRING, TAP_ALIGN_LEFT, "Message Type or Reason"},
- {G_TYPE_UINT, TAP_ALIGN_RIGHT, "Count" }
-};
-
-static void
-gtk_h225counter_init(const char *opt_arg, void *userdata _U_)
-{
- h225counter_t *hs;
- GString *error_string;
- GtkWidget *bbox;
- GtkWidget *close_bt;
-
- hs=(h225counter_t *)g_malloc(sizeof(h225counter_t));
-
- if(strncmp(opt_arg,"h225,counter,",13) == 0){
- hs->filter=g_strdup(opt_arg+13);
- } else {
- hs->filter=NULL;
- }
-
- h225counter_reset(hs);
-
- hs->win = dlg_window_new("Wireshark: H.225 counters"); /* transient_for top_level */
- gtk_window_set_destroy_with_parent (GTK_WINDOW(hs->win), TRUE);
-
- gtk_window_set_default_size(GTK_WINDOW(hs->win), 400, 200);
-
- hs->vbox=ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 3, FALSE);
- gtk_container_set_border_width(GTK_CONTAINER(hs->vbox), 12);
-
- init_main_stat_window(hs->win, hs->vbox, "H.225 Message and Message Reason Counter", hs->filter);
-
- /* init a scrolled window*/
- hs->scrolled_window = scrolled_window_new(NULL, NULL);
-
- hs->table = create_stat_table(hs->scrolled_window, hs->vbox, 2, titles);
-
- error_string=register_tap_listener("h225", hs, hs->filter, 0, h225counter_reset, h225counter_packet, h225counter_draw);
- if(error_string){
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
- g_string_free(error_string, TRUE);
- g_free(hs->filter);
- g_free(hs);
- return;
- }
-
- /* Button row. */
- bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL);
- gtk_box_pack_end(GTK_BOX(hs->vbox), bbox, FALSE, FALSE, 0);
-
- close_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE);
- window_set_cancel_button(hs->win, close_bt, window_cancel_button_cb);
-
- g_signal_connect(hs->win, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
- g_signal_connect(hs->win, "destroy", G_CALLBACK(win_destroy_cb), hs);
-
- gtk_widget_show_all(hs->win);
- window_present(hs->win);
-
- cf_retap_packets(&cfile);
- gdk_window_raise(gtk_widget_get_window(hs->win));
-}
-
-void
-register_tap_listener_gtk_h225counter(void)
-{
- register_param_stat(&h225_counter_dlg, "_H.225",
- REGISTER_STAT_GROUP_TELEPHONY);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/ui/gtk/tap_param_dlg.h b/ui/gtk/tap_param_dlg.h
index 608fb987a7..858304e112 100644
--- a/ui/gtk/tap_param_dlg.h
+++ b/ui/gtk/tap_param_dlg.h
@@ -57,7 +57,7 @@
* REGISTER_STAT_GROUP_my_group);
* }
*
- * See also: h225_ras_srt.c or h225_counter.c
+ * See also: h225_ras_srt.c
*
*/