diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | asn1/h225/packet-h225-template.c | 161 | ||||
-rw-r--r-- | epan/dissectors/packet-h225.c | 171 | ||||
-rw-r--r-- | ui/cli/Makefile.common | 1 | ||||
-rw-r--r-- | ui/cli/tap-h225rassrt.c | 266 | ||||
-rw-r--r-- | ui/gtk/CMakeLists.txt | 1 | ||||
-rw-r--r-- | ui/gtk/Makefile.common | 1 | ||||
-rw-r--r-- | ui/gtk/h225_ras_srt.c | 346 |
8 files changed, 263 insertions, 685 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f2a4fe355a..82fe700ab4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1152,7 +1152,6 @@ set(TSHARK_TAP_SRC ui/cli/tap-funnel.c ui/cli/tap-gsm_astat.c ui/cli/tap-h225counter.c - ui/cli/tap-h225rassrt.c ui/cli/tap-hosts.c ui/cli/tap-httpstat.c ui/cli/tap-icmpstat.c diff --git a/asn1/h225/packet-h225-template.c b/asn1/h225/packet-h225-template.c index df5a63cecc..17732081a5 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/rtd_table.h> #include "packet-tpkt.h" #include "packet-per.h" #include "packet-h225.h" @@ -154,6 +155,96 @@ static guint32 manufacturerCode; /* TunnelledProtocol */ static const char *tpOID; +static const value_string ras_message_category[] = { + { 0, "Gatekeeper "}, + { 1, "Registration "}, + { 2, "UnRegistration"}, + { 3, "Admission "}, + { 4, "Bandwidth "}, + { 5, "Disengage "}, + { 6, "Location "}, + { 0, NULL } +}; + +typedef enum _ras_type { + RAS_REQUEST, + RAS_CONFIRM, + RAS_REJECT, + RAS_OTHER +}ras_type; + +typedef enum _ras_category { + RAS_GATEKEEPER, + RAS_REGISTRATION, + RAS_UNREGISTRATION, + RAS_ADMISSION, + RAS_BANDWIDTH, + RAS_DISENGAGE, + RAS_LOCATION, + RAS_OTHERS +}ras_category; + +#define NUM_RAS_STATS 7 + +static int +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; + const h225_packet_info *pi=(const h225_packet_info *)phi; + + ras_type rasmsg_type = RAS_OTHER; + ras_category rascategory = RAS_OTHERS; + + if (pi->msg_type != H225_RAS || pi->msg_tag == -1) { + /* No RAS Message or uninitialized msg_tag -> return */ + return 0; + } + + if (pi->msg_tag < 21) { + /* */ + rascategory = (ras_category)(pi->msg_tag / 3); + rasmsg_type = (ras_type)(pi->msg_tag % 3); + } + else { + /* No SRT yet (ToDo) */ + return 0; + } + + switch(rasmsg_type) { + + case RAS_REQUEST: + if(pi->is_duplicate){ + rs->time_stats[rascategory].req_dup_num++; + } + else { + rs->time_stats[rascategory].open_req_num++; + } + break; + + case RAS_CONFIRM: + /* no break - delay stats are identical for Confirm and Reject */ + case RAS_REJECT: + if(pi->is_duplicate){ + /* Duplicate is ignored */ + rs->time_stats[rascategory].rsp_dup_num++; + } + else if (!pi->request_available) { + /* no request was seen, ignore response */ + rs->time_stats[rascategory].disc_rsp_num++; + } + else { + rs->time_stats[rascategory].open_req_num--; + time_stat_update(&(rs->time_stats[rascategory].rtd[0]),&(pi->delta_time), pinfo); + } + break; + + default: + return 0; + } + return 1; +} + #include "packet-h225-fn.c" @@ -369,53 +460,59 @@ void proto_register_h225(void) { &ett_h225, #include "packet-h225-ettarr.c" }; - module_t *h225_module; - - /* Register protocol */ - proto_h225 = proto_register_protocol(PNAME, PSNAME, PFNAME); - /* Register fields and subtrees */ - proto_register_field_array(proto_h225, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - - h225_module = prefs_register_protocol(proto_h225, proto_reg_handoff_h225); - prefs_register_uint_preference(h225_module, "tls.port", - "H.225 TLS Port", - "H.225 Server TLS Port", - 10, &h225_tls_port); - prefs_register_bool_preference(h225_module, "reassembly", + module_t *h225_module; + int proto_h225_ras; + + /* Register protocol */ + proto_h225 = proto_register_protocol(PNAME, PSNAME, PFNAME); + + /* Create a "fake" protocol to get proper display strings for SRT dialogs */ + proto_h225_ras = proto_register_protocol("H.225 RAS", "H.225 RAS", "h225_ras"); + + /* Register fields and subtrees */ + proto_register_field_array(proto_h225, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + h225_module = prefs_register_protocol(proto_h225, proto_reg_handoff_h225); + prefs_register_uint_preference(h225_module, "tls.port", + "H.225 TLS Port", + "H.225 Server TLS Port", + 10, &h225_tls_port); + prefs_register_bool_preference(h225_module, "reassembly", "Reassemble H.225 messages spanning multiple TCP segments", "Whether the H.225 dissector should reassemble messages spanning multiple TCP segments." " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &h225_reassembly); - prefs_register_bool_preference(h225_module, "h245_in_tree", + prefs_register_bool_preference(h225_module, "h245_in_tree", "Display tunnelled H.245 inside H.225.0 tree", "ON - display tunnelled H.245 inside H.225.0 tree, OFF - display tunnelled H.245 in root tree after H.225.0", &h225_h245_in_tree); - prefs_register_bool_preference(h225_module, "tp_in_tree", + prefs_register_bool_preference(h225_module, "tp_in_tree", "Display tunnelled protocols inside H.225.0 tree", "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("h323ui",dissect_h225_H323UserInformation, proto_h225); - new_register_dissector("h225.ras", dissect_h225_h225_RasMessage, proto_h225); + new_register_dissector("h225", 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); - nsp_object_dissector_table = register_dissector_table("h225.nsp.object", "H.225 NonStandardParameter (object)", FT_STRING, BASE_NONE); - nsp_h221_dissector_table = register_dissector_table("h225.nsp.h221", "H.225 NonStandardParameter (h221)", FT_UINT32, BASE_HEX); - tp_dissector_table = register_dissector_table("h225.tp", "H.225 TunnelledProtocol", FT_STRING, BASE_NONE); - gef_name_dissector_table = register_dissector_table("h225.gef.name", "H.225 Generic Extensible Framework (names)", FT_STRING, BASE_NONE); - gef_content_dissector_table = register_dissector_table("h225.gef.content", "H.225 Generic Extensible Framework", FT_STRING, BASE_NONE); + nsp_object_dissector_table = register_dissector_table("h225.nsp.object", "H.225 NonStandardParameter (object)", FT_STRING, BASE_NONE); + nsp_h221_dissector_table = register_dissector_table("h225.nsp.h221", "H.225 NonStandardParameter (h221)", FT_UINT32, BASE_HEX); + tp_dissector_table = register_dissector_table("h225.tp", "H.225 TunnelledProtocol", FT_STRING, BASE_NONE); + gef_name_dissector_table = register_dissector_table("h225.gef.name", "H.225 Generic Extensible Framework (names)", FT_STRING, BASE_NONE); + gef_content_dissector_table = register_dissector_table("h225.gef.content", "H.225 Generic Extensible Framework", FT_STRING, BASE_NONE); - register_init_routine(&h225_init_routine); - h225_tap = register_tap("h225"); + register_init_routine(&h225_init_routine); + h225_tap = register_tap("h225"); - oid_add_from_string("Version 1","0.0.8.2250.0.1"); - oid_add_from_string("Version 2","0.0.8.2250.0.2"); - oid_add_from_string("Version 3","0.0.8.2250.0.3"); - oid_add_from_string("Version 4","0.0.8.2250.0.4"); - oid_add_from_string("Version 5","0.0.8.2250.0.5"); - oid_add_from_string("Version 6","0.0.8.2250.0.6"); + register_rtd_table(proto_h225_ras, "h225", NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL); + oid_add_from_string("Version 1","0.0.8.2250.0.1"); + oid_add_from_string("Version 2","0.0.8.2250.0.2"); + oid_add_from_string("Version 3","0.0.8.2250.0.3"); + oid_add_from_string("Version 4","0.0.8.2250.0.4"); + oid_add_from_string("Version 5","0.0.8.2250.0.5"); + oid_add_from_string("Version 6","0.0.8.2250.0.6"); } diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c index 0b9b789a93..6ecd77cd25 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/rtd_table.h> #include "packet-tpkt.h" #include "packet-per.h" #include "packet-h225.h" @@ -909,7 +910,7 @@ static int hf_h225_stopped = -1; /* NULL */ static int hf_h225_notAvailable = -1; /* NULL */ /*--- End of included file: packet-h225-hf.c ---*/ -#line 130 "../../asn1/h225/packet-h225-template.c" +#line 131 "../../asn1/h225/packet-h225-template.c" /* Initialize the subtree pointers */ static gint ett_h225 = -1; @@ -1157,7 +1158,7 @@ static gint ett_h225_ServiceControlResponse = -1; static gint ett_h225_T_result = -1; /*--- End of included file: packet-h225-ett.c ---*/ -#line 134 "../../asn1/h225/packet-h225-template.c" +#line 135 "../../asn1/h225/packet-h225-template.c" /* Preferences */ static guint h225_tls_port = TLS_PORT_CS; @@ -1181,6 +1182,96 @@ static guint32 manufacturerCode; /* TunnelledProtocol */ static const char *tpOID; +static const value_string ras_message_category[] = { + { 0, "Gatekeeper "}, + { 1, "Registration "}, + { 2, "UnRegistration"}, + { 3, "Admission "}, + { 4, "Bandwidth "}, + { 5, "Disengage "}, + { 6, "Location "}, + { 0, NULL } +}; + +typedef enum _ras_type { + RAS_REQUEST, + RAS_CONFIRM, + RAS_REJECT, + RAS_OTHER +}ras_type; + +typedef enum _ras_category { + RAS_GATEKEEPER, + RAS_REGISTRATION, + RAS_UNREGISTRATION, + RAS_ADMISSION, + RAS_BANDWIDTH, + RAS_DISENGAGE, + RAS_LOCATION, + RAS_OTHERS +}ras_category; + +#define NUM_RAS_STATS 7 + +static int +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; + const h225_packet_info *pi=(const h225_packet_info *)phi; + + ras_type rasmsg_type = RAS_OTHER; + ras_category rascategory = RAS_OTHERS; + + if (pi->msg_type != H225_RAS || pi->msg_tag == -1) { + /* No RAS Message or uninitialized msg_tag -> return */ + return 0; + } + + if (pi->msg_tag < 21) { + /* */ + rascategory = (ras_category)(pi->msg_tag / 3); + rasmsg_type = (ras_type)(pi->msg_tag % 3); + } + else { + /* No SRT yet (ToDo) */ + return 0; + } + + switch(rasmsg_type) { + + case RAS_REQUEST: + if(pi->is_duplicate){ + rs->time_stats[rascategory].req_dup_num++; + } + else { + rs->time_stats[rascategory].open_req_num++; + } + break; + + case RAS_CONFIRM: + /* no break - delay stats are identical for Confirm and Reject */ + case RAS_REJECT: + if(pi->is_duplicate){ + /* Duplicate is ignored */ + rs->time_stats[rascategory].rsp_dup_num++; + } + else if (!pi->request_available) { + /* no request was seen, ignore response */ + rs->time_stats[rascategory].disc_rsp_num++; + } + else { + rs->time_stats[rascategory].open_req_num--; + time_stat_update(&(rs->time_stats[rascategory].rtd[0]),&(pi->delta_time), pinfo); + } + break; + + default: + return 0; + } + return 1; +} + /*--- Included file: packet-h225-fn.c ---*/ #line 1 "../../asn1/h225/packet-h225-fn.c" @@ -7537,7 +7628,7 @@ static int dissect_RasMessage_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro /*--- End of included file: packet-h225-fn.c ---*/ -#line 158 "../../asn1/h225/packet-h225-template.c" +#line 249 "../../asn1/h225/packet-h225-template.c" /* Forward declaration we need below */ @@ -10829,7 +10920,7 @@ void proto_register_h225(void) { NULL, HFILL }}, /*--- End of included file: packet-h225-hfarr.c ---*/ -#line 365 "../../asn1/h225/packet-h225-template.c" +#line 456 "../../asn1/h225/packet-h225-template.c" }; /* List of subtrees */ @@ -11079,55 +11170,61 @@ void proto_register_h225(void) { &ett_h225_T_result, /*--- End of included file: packet-h225-ettarr.c ---*/ -#line 371 "../../asn1/h225/packet-h225-template.c" +#line 462 "../../asn1/h225/packet-h225-template.c" }; - module_t *h225_module; - - /* Register protocol */ - proto_h225 = proto_register_protocol(PNAME, PSNAME, PFNAME); - /* Register fields and subtrees */ - proto_register_field_array(proto_h225, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - - h225_module = prefs_register_protocol(proto_h225, proto_reg_handoff_h225); - prefs_register_uint_preference(h225_module, "tls.port", - "H.225 TLS Port", - "H.225 Server TLS Port", - 10, &h225_tls_port); - prefs_register_bool_preference(h225_module, "reassembly", + module_t *h225_module; + int proto_h225_ras; + + /* Register protocol */ + proto_h225 = proto_register_protocol(PNAME, PSNAME, PFNAME); + + /* Create a "fake" protocol to get proper display strings for SRT dialogs */ + proto_h225_ras = proto_register_protocol("H.225 RAS", "H.225 RAS", "h225_ras"); + + /* Register fields and subtrees */ + proto_register_field_array(proto_h225, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + h225_module = prefs_register_protocol(proto_h225, proto_reg_handoff_h225); + prefs_register_uint_preference(h225_module, "tls.port", + "H.225 TLS Port", + "H.225 Server TLS Port", + 10, &h225_tls_port); + prefs_register_bool_preference(h225_module, "reassembly", "Reassemble H.225 messages spanning multiple TCP segments", "Whether the H.225 dissector should reassemble messages spanning multiple TCP segments." " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &h225_reassembly); - prefs_register_bool_preference(h225_module, "h245_in_tree", + prefs_register_bool_preference(h225_module, "h245_in_tree", "Display tunnelled H.245 inside H.225.0 tree", "ON - display tunnelled H.245 inside H.225.0 tree, OFF - display tunnelled H.245 in root tree after H.225.0", &h225_h245_in_tree); - prefs_register_bool_preference(h225_module, "tp_in_tree", + prefs_register_bool_preference(h225_module, "tp_in_tree", "Display tunnelled protocols inside H.225.0 tree", "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("h323ui",dissect_h225_H323UserInformation, proto_h225); - new_register_dissector("h225.ras", dissect_h225_h225_RasMessage, proto_h225); + new_register_dissector("h225", 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); - nsp_object_dissector_table = register_dissector_table("h225.nsp.object", "H.225 NonStandardParameter (object)", FT_STRING, BASE_NONE); - nsp_h221_dissector_table = register_dissector_table("h225.nsp.h221", "H.225 NonStandardParameter (h221)", FT_UINT32, BASE_HEX); - tp_dissector_table = register_dissector_table("h225.tp", "H.225 TunnelledProtocol", FT_STRING, BASE_NONE); - gef_name_dissector_table = register_dissector_table("h225.gef.name", "H.225 Generic Extensible Framework (names)", FT_STRING, BASE_NONE); - gef_content_dissector_table = register_dissector_table("h225.gef.content", "H.225 Generic Extensible Framework", FT_STRING, BASE_NONE); + nsp_object_dissector_table = register_dissector_table("h225.nsp.object", "H.225 NonStandardParameter (object)", FT_STRING, BASE_NONE); + nsp_h221_dissector_table = register_dissector_table("h225.nsp.h221", "H.225 NonStandardParameter (h221)", FT_UINT32, BASE_HEX); + tp_dissector_table = register_dissector_table("h225.tp", "H.225 TunnelledProtocol", FT_STRING, BASE_NONE); + gef_name_dissector_table = register_dissector_table("h225.gef.name", "H.225 Generic Extensible Framework (names)", FT_STRING, BASE_NONE); + gef_content_dissector_table = register_dissector_table("h225.gef.content", "H.225 Generic Extensible Framework", FT_STRING, BASE_NONE); - register_init_routine(&h225_init_routine); - h225_tap = register_tap("h225"); + register_init_routine(&h225_init_routine); + h225_tap = register_tap("h225"); - oid_add_from_string("Version 1","0.0.8.2250.0.1"); - oid_add_from_string("Version 2","0.0.8.2250.0.2"); - oid_add_from_string("Version 3","0.0.8.2250.0.3"); - oid_add_from_string("Version 4","0.0.8.2250.0.4"); - oid_add_from_string("Version 5","0.0.8.2250.0.5"); - oid_add_from_string("Version 6","0.0.8.2250.0.6"); + register_rtd_table(proto_h225_ras, "h225", NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL); + oid_add_from_string("Version 1","0.0.8.2250.0.1"); + oid_add_from_string("Version 2","0.0.8.2250.0.2"); + oid_add_from_string("Version 3","0.0.8.2250.0.3"); + oid_add_from_string("Version 4","0.0.8.2250.0.4"); + oid_add_from_string("Version 5","0.0.8.2250.0.5"); + oid_add_from_string("Version 6","0.0.8.2250.0.6"); } diff --git a/ui/cli/Makefile.common b/ui/cli/Makefile.common index d903f38112..ff0636d4da 100644 --- a/ui/cli/Makefile.common +++ b/ui/cli/Makefile.common @@ -50,7 +50,6 @@ TSHARK_TAP_SRC = \ tap-funnel.c \ tap-gsm_astat.c \ tap-h225counter.c \ - tap-h225rassrt.c \ tap-hosts.c \ tap-httpstat.c \ tap-icmpstat.c \ diff --git a/ui/cli/tap-h225rassrt.c b/ui/cli/tap-h225rassrt.c deleted file mode 100644 index d8d1effe91..0000000000 --- a/ui/cli/tap-h225rassrt.c +++ /dev/null @@ -1,266 +0,0 @@ -/* tap_h225rassrt.c - * h225 RAS Service Response Time statistics 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 <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "epan/packet.h" -#include <epan/tap.h> -#include <epan/stat_tap_ui.h> -#include "epan/value_string.h" -#include <epan/dissectors/packet-h225.h> -#include "epan/timestats.h" - -/* following values represent the size of their valuestring arrays */ -#define NUM_RAS_STATS 7 - -void register_tap_listener_h225rassrt(void); - -static const value_string ras_message_category[] = { - { 0, "Gatekeeper "}, - { 1, "Registration "}, - { 2, "UnRegistration"}, - { 3, "Admission "}, - { 4, "Bandwidth "}, - { 5, "Disengage "}, - { 6, "Location "}, - { 0, NULL } -}; - -typedef enum _ras_type { - RAS_REQUEST, - RAS_CONFIRM, - RAS_REJECT, - RAS_OTHER -}ras_type; - -typedef enum _ras_category { - RAS_GATEKEEPER, - RAS_REGISTRATION, - RAS_UNREGISTRATION, - RAS_ADMISSION, - RAS_BANDWIDTH, - RAS_DISENGAGE, - RAS_LOCATION, - RAS_OTHERS -}ras_category; - -/* Summary of response-time calculations*/ -typedef struct _h225_rtd_t { - guint32 open_req_num; - guint32 disc_rsp_num; - guint32 req_dup_num; - guint32 rsp_dup_num; - timestat_t stats; -} h225_rtd_t; - -/* used to keep track of the statistics for an entire program interface */ -typedef struct _h225rassrt_t { - char *filter; - h225_rtd_t ras_rtd[NUM_RAS_STATS]; -} h225rassrt_t; - - -static void -h225rassrt_reset(void *phs) -{ - h225rassrt_t *hs = (h225rassrt_t *)phs; - int i; - - for (i=0; i<NUM_RAS_STATS; i++) { - hs->ras_rtd[i].stats.num = 0; - hs->ras_rtd[i].stats.min_num = 0; - hs->ras_rtd[i].stats.max_num = 0; - hs->ras_rtd[i].stats.min.secs = 0; - hs->ras_rtd[i].stats.min.nsecs = 0; - hs->ras_rtd[i].stats.max.secs = 0; - hs->ras_rtd[i].stats.max.nsecs = 0; - hs->ras_rtd[i].stats.tot.secs = 0; - hs->ras_rtd[i].stats.tot.nsecs = 0; - hs->ras_rtd[i].open_req_num = 0; - hs->ras_rtd[i].disc_rsp_num = 0; - hs->ras_rtd[i].req_dup_num = 0; - hs->ras_rtd[i].rsp_dup_num = 0; - } - -} - -static int -h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi) -{ - h225rassrt_t *hs = (h225rassrt_t *)phs; - const h225_packet_info *pi = (const h225_packet_info *)phi; - - ras_type rasmsg_type = RAS_OTHER; - ras_category rascategory = RAS_OTHERS; - - if (pi->msg_type != H225_RAS || pi->msg_tag == -1) { - /* No RAS Message or uninitialized msg_tag -> return */ - return 0; - } - - if (pi->msg_tag < 21) { - /* */ - rascategory = (ras_category)(pi->msg_tag / 3); - rasmsg_type = (ras_type)(pi->msg_tag % 3); - } - else { - /* No SRT yet (ToDo) */ - return 0; - } - - switch (rasmsg_type) { - - case RAS_REQUEST: - if (pi->is_duplicate) { - hs->ras_rtd[rascategory].req_dup_num++; - } - else { - hs->ras_rtd[rascategory].open_req_num++; - } - break; - - case RAS_CONFIRM: - /* no break - delay calculation is identical for Confirm and Reject */ - case RAS_REJECT: - if (pi->is_duplicate) { - /* Duplicate is ignored */ - hs->ras_rtd[rascategory].rsp_dup_num++; - } - else if (!pi->request_available) { - /* no request was seen, ignore response */ - hs->ras_rtd[rascategory].disc_rsp_num++; - } - else { - hs->ras_rtd[rascategory].open_req_num--; - time_stat_update(&(hs->ras_rtd[rascategory].stats), &(pi->delta_time), pinfo); - } - break; - - default: - return 0; - } - return 1; -} - -static void -h225rassrt_draw(void *phs) -{ - h225rassrt_t *hs = (h225rassrt_t *)phs; - int i; - timestat_t *rtd_temp; - gchar* tmp_str; - - printf("======================================== H225 RAS Service Response Time ========================================\n"); - printf("H225 RAS Service Response Time (SRT) Statistics:\n"); - printf("RAS-Messages | Measurements | Min SRT | Max SRT | Avg SRT | Min in Frame | Max in Frame |\n"); - for (i=0; i<NUM_RAS_STATS; i++) { - rtd_temp = &(hs->ras_rtd[i].stats); - if (rtd_temp->num) { - tmp_str = val_to_str_wmem(NULL, i, ras_message_category, "Unknown (%d) "); - printf("%s | %10u | %9.2f msec | %9.2f msec | %9.2f msec | %10u | %10u |\n", - tmp_str, rtd_temp->num, - nstime_to_msec(&(rtd_temp->min)), nstime_to_msec(&(rtd_temp->max)), - get_average(&(rtd_temp->tot), rtd_temp->num), - rtd_temp->min_num, rtd_temp->max_num - ); - wmem_free(NULL, tmp_str); - } - } - printf("================================================================================================================\n"); - printf("RAS-Messages | Open REQ | Discarded RSP | Repeated REQ | Repeated RSP |\n"); - for (i=0; i<NUM_RAS_STATS; i++) { - rtd_temp = &(hs->ras_rtd[i].stats); - if (rtd_temp->num) { - tmp_str = val_to_str_wmem(NULL, i, ras_message_category, "Unknown (%d) "); - printf("%s | %10u | %10u | %10u | %10u |\n", - tmp_str, - hs->ras_rtd[i].open_req_num, hs->ras_rtd[i].disc_rsp_num, - hs->ras_rtd[i].req_dup_num, hs->ras_rtd[i].rsp_dup_num - ); - wmem_free(NULL, tmp_str); - } - } - printf("================================================================================================================\n"); - -} - - -static void -h225rassrt_init(const char *opt_arg, void *userdata _U_) -{ - h225rassrt_t *hs; - GString *error_string; - - hs = g_new(h225rassrt_t, 1); - if (!strncmp(opt_arg, "h225,srt,", 9)) { - hs->filter = g_strdup(opt_arg+9); - } else { - hs->filter = NULL; - } - - h225rassrt_reset(hs); - - error_string = register_tap_listener("h225", hs, hs->filter, 0, NULL, h225rassrt_packet, h225rassrt_draw); - if (error_string) { - /* error, we failed to attach to the tap. clean up */ - g_free(hs->filter); - g_free(hs); - - fprintf(stderr, "tshark: Couldn't register h225,srt tap: %s\n", - error_string->str); - g_string_free(error_string, TRUE); - exit(1); - } -} - -static stat_tap_ui h225rassrt_ui = { - REGISTER_STAT_GROUP_GENERIC, - NULL, - "h225,srt", - h225rassrt_init, - 0, - NULL -}; - -void -register_tap_listener_h225rassrt(void) -{ - register_stat_tap_ui(&h225rassrt_ui, NULL); -} - -/* - * 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/CMakeLists.txt b/ui/gtk/CMakeLists.txt index e69ebd942d..783d3b5d61 100644 --- a/ui/gtk/CMakeLists.txt +++ b/ui/gtk/CMakeLists.txt @@ -209,7 +209,6 @@ set(WIRESHARK_TAP_SRC gsm_map_stat.c gsm_map_summary.c h225_counter.c - h225_ras_srt.c iax2_analysis.c io_stat.c lbm_stream_dlg.c diff --git a/ui/gtk/Makefile.common b/ui/gtk/Makefile.common index 55b9f47140..ab2b8a899f 100644 --- a/ui/gtk/Makefile.common +++ b/ui/gtk/Makefile.common @@ -160,7 +160,6 @@ WIRESHARK_TAP_SRC = \ gsm_map_stat.c \ gsm_map_summary.c \ h225_counter.c \ - h225_ras_srt.c \ iax2_analysis.c \ io_stat.c \ lbm_stream_dlg.c \ diff --git a/ui/gtk/h225_ras_srt.c b/ui/gtk/h225_ras_srt.c deleted file mode 100644 index 7b7ebd7eb9..0000000000 --- a/ui/gtk/h225_ras_srt.c +++ /dev/null @@ -1,346 +0,0 @@ -/* h225_ras_srt.c - * H.225 RAS Service Response Time statistics for Wireshar - * 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 "epan/timestats.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_h225rassrt(void); -static void gtk_h225rassrt_init(const char *opt_arg, void *userdata); - -static tap_param h225_rassrt_params[] = { - { PARAM_FILTER, "filter", "Filter", NULL, TRUE } -}; - -static tap_param_dlg h225_rassrt_dlg = { - "H.225 RAS Service Response Time", - "h225,srt", - gtk_h225rassrt_init, - -1, - G_N_ELEMENTS(h225_rassrt_params), - h225_rassrt_params -}; - -/* following values represent the size of their valuestring arrays */ -#define NUM_RAS_STATS 7 - -static const value_string ras_message_category[] = { - { 0, "Gatekeeper "}, - { 1, "Registration "}, - { 2, "UnRegistration"}, - { 3, "Admission "}, - { 4, "Bandwidth "}, - { 5, "Disengage "}, - { 6, "Location "}, - { 0, NULL } -}; - -typedef enum _ras_type { - RAS_REQUEST, - RAS_CONFIRM, - RAS_REJECT, - RAS_OTHER -}ras_type; - -typedef enum _ras_category { - RAS_GATEKEEPER, - RAS_REGISTRATION, - RAS_UNREGISTRATION, - RAS_ADMISSION, - RAS_BANDWIDTH, - RAS_DISENGAGE, - RAS_LOCATION, - RAS_OTHERS -}ras_category; - -/* Summary of response-time calculations*/ -typedef struct _h225_rtd_t { - guint32 open_req_num; - guint32 disc_rsp_num; - guint32 req_dup_num; - guint32 rsp_dup_num; - timestat_t stats; -} h225_rtd_t; - -/* used to keep track of the statistics for an entire program interface */ -typedef struct _h225rassrt_t { - GtkWidget *win; - GtkWidget *vbox; - char *filter; - GtkWidget *scrolled_window; - GtkTreeView *table; - h225_rtd_t ras_rtd[NUM_RAS_STATS]; -} h225rassrt_t; - - -static void -h225rassrt_reset(void *phs) -{ - h225rassrt_t *hs=(h225rassrt_t *)phs; - int i; - - for(i=0;i<NUM_RAS_STATS;i++) { - hs->ras_rtd[i].stats.num = 0; - hs->ras_rtd[i].stats.min_num = 0; - hs->ras_rtd[i].stats.max_num = 0; - hs->ras_rtd[i].stats.min.secs = 0; - hs->ras_rtd[i].stats.min.nsecs = 0; - hs->ras_rtd[i].stats.max.secs = 0; - hs->ras_rtd[i].stats.max.nsecs = 0; - hs->ras_rtd[i].stats.tot.secs = 0; - hs->ras_rtd[i].stats.tot.nsecs = 0; - hs->ras_rtd[i].open_req_num = 0; - hs->ras_rtd[i].disc_rsp_num = 0; - hs->ras_rtd[i].req_dup_num = 0; - hs->ras_rtd[i].rsp_dup_num = 0; - } - -} - - -static int -h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi) -{ - h225rassrt_t *hs=(h225rassrt_t *)phs; - const h225_packet_info *pi=(const h225_packet_info *)phi; - - ras_type rasmsg_type = RAS_OTHER; - ras_category rascategory = RAS_OTHERS; - - if (pi->msg_type != H225_RAS || pi->msg_tag == -1) { - /* No RAS Message or uninitialized msg_tag -> return */ - return 0; - } - - if (pi->msg_tag < 21) { - /* */ - rascategory = (ras_category)(pi->msg_tag / 3); - rasmsg_type = (ras_type)(pi->msg_tag % 3); - } - else { - /* No SRT yet (ToDo) */ - return 0; - } - - switch(rasmsg_type) { - - case RAS_REQUEST: - if(pi->is_duplicate){ - hs->ras_rtd[rascategory].req_dup_num++; - } - else { - hs->ras_rtd[rascategory].open_req_num++; - } - break; - - case RAS_CONFIRM: - /* no break - delay stats are identical for Confirm and Reject */ - case RAS_REJECT: - if(pi->is_duplicate){ - /* Duplicate is ignored */ - hs->ras_rtd[rascategory].rsp_dup_num++; - } - else if (!pi->request_available) { - /* no request was seen, ignore response */ - hs->ras_rtd[rascategory].disc_rsp_num++; - } - else { - hs->ras_rtd[rascategory].open_req_num--; - time_stat_update(&(hs->ras_rtd[rascategory].stats),&(pi->delta_time), pinfo); - } - break; - - default: - return 0; - } - return 1; -} - -static void -h225rassrt_draw(void *phs) -{ - h225rassrt_t *hs=(h225rassrt_t *)phs; - int i; - char str[3][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<NUM_RAS_STATS;i++) { - /* nothing seen, nothing to do */ - if(hs->ras_rtd[i].stats.num==0){ - continue; - } - g_snprintf(str[0], sizeof(char[256]), - "%8.2f msec", nstime_to_msec(&(hs->ras_rtd[i].stats.min))); - g_snprintf(str[1], sizeof(char[256]), - "%8.2f msec", nstime_to_msec(&(hs->ras_rtd[i].stats.max))); - g_snprintf(str[2], sizeof(char[256]), - "%8.2f msec", get_average(&(hs->ras_rtd[i].stats.tot), hs->ras_rtd[i].stats.num)); - tmp_str = val_to_str_wmem(NULL,i,ras_message_category,"Other (%d)"); - - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, - 0, tmp_str, - 1, hs->ras_rtd[i].stats.num, - 2, str[0], - 3, str[1], - 4, str[2], - 5, hs->ras_rtd[i].stats.min_num, - 6, hs->ras_rtd[i].stats.max_num, - 7, hs->ras_rtd[i].open_req_num, - 8, hs->ras_rtd[i].disc_rsp_num, - 9, hs->ras_rtd[i].req_dup_num, - 10, hs->ras_rtd[i].rsp_dup_num, - -1); - wmem_free(NULL, tmp_str); - } -} - -static void -win_destroy_cb(GtkWindow *win _U_, gpointer data) -{ - h225rassrt_t *hs=(h225rassrt_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, LEFT, "RAS-Type" }, - {G_TYPE_UINT, RIGHT, "Measurements" }, - {G_TYPE_STRING, RIGHT, "Min RTT" }, - {G_TYPE_STRING, RIGHT, "Max RTT" }, - {G_TYPE_STRING, RIGHT, "Avg RTT" }, - {G_TYPE_UINT, RIGHT, "Min in Frame" }, - {G_TYPE_UINT, RIGHT, "Max in Frame" }, - {G_TYPE_UINT, RIGHT, "Open Requests" }, - {G_TYPE_UINT, RIGHT, "Discarded Responses" }, - {G_TYPE_UINT, RIGHT, "Repeated Requests" }, - {G_TYPE_UINT, RIGHT, "Repeated Responses"} -}; - -static void -gtk_h225rassrt_init(const char *opt_arg, void *userdata _U_) -{ - h225rassrt_t *hs; - GString *error_string; - GtkWidget *bbox; - GtkWidget *close_bt; - - hs=(h225rassrt_t *)g_malloc(sizeof(h225rassrt_t)); - - if(strncmp(opt_arg,"h225,srt,",9) == 0){ - hs->filter=g_strdup(opt_arg+9); - } else { - hs->filter=NULL; - } - - h225rassrt_reset(hs); - - hs->win = dlg_window_new("h225-ras-srt"); /* transient_for top_level */ - gtk_window_set_destroy_with_parent (GTK_WINDOW(hs->win), TRUE); - gtk_window_set_default_size(GTK_WINDOW(hs->win), 600, 300); - - 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 RAS Service Response Time", hs->filter); - - /* init a scrolled window*/ - hs->scrolled_window = scrolled_window_new(NULL, NULL); - - hs->table = create_stat_table(hs->scrolled_window, hs->vbox, 11, titles); - - error_string=register_tap_listener("h225", hs, hs->filter, 0, h225rassrt_reset, h225rassrt_packet, h225rassrt_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_h225rassrt(void) -{ - register_param_stat(&h225_rassrt_dlg, "H.225 RAS", - REGISTER_STAT_GROUP_RESPONSE_TIME); -} - -/* - * 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: - */ |