diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | asn1/camel/packet-camel-template.c | 119 | ||||
-rw-r--r-- | asn1/camel/packet-camel-template.h | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-camel.c | 137 | ||||
-rw-r--r-- | epan/dissectors/packet-camel.h | 1 | ||||
-rw-r--r-- | ui/cli/Makefile.common | 1 | ||||
-rw-r--r-- | ui/cli/tap-camelcounter.c | 148 | ||||
-rw-r--r-- | ui/gtk/CMakeLists.txt | 1 | ||||
-rw-r--r-- | ui/gtk/Makefile.common | 1 | ||||
-rw-r--r-- | ui/gtk/camel_counter.c | 240 | ||||
-rw-r--r-- | ui/qt/main_window.cpp | 3 | ||||
-rw-r--r-- | ui/qt/main_window.ui | 7 |
12 files changed, 231 insertions, 429 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e9008249f4..334613ef51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1140,7 +1140,6 @@ if(ENABLE_EXTCAP) endif() set(TSHARK_TAP_SRC - ui/cli/tap-camelcounter.c ui/cli/tap-camelsrt.c ui/cli/tap-comparestat.c ui/cli/tap-diameter-avp.c diff --git a/asn1/camel/packet-camel-template.c b/asn1/camel/packet-camel-template.c index f0f3e93f0f..152aabad7c 100644 --- a/asn1/camel/packet-camel-template.c +++ b/asn1/camel/packet-camel-template.c @@ -40,6 +40,7 @@ #include <epan/oids.h> #include <epan/tap.h> #include <epan/srt_table.h> +#include <epan/stat_tap_ui.h> #include <epan/asn1.h> #include <epan/expert.h> @@ -342,7 +343,7 @@ camelstat_init(struct register_srt* srt _U_, GArray* srt_array, srt_gui_init_cb } } -static int +static gboolean camelstat_packet(void *pcamel, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi) { guint idx = 0; @@ -361,16 +362,16 @@ camelstat_packet(void *pcamel, packet_info *pinfo, epan_dissect_t *edt _U_, cons add_srt_table_data(camel_srt_table, i, &pi->msginfo[i].req_time, pinfo); } } /* category */ - return 1; + return TRUE; } static char camel_number_to_char(int number) { - if (number < 10) - return (char) (number + 48 ); /* this is ASCII specific */ - else - return (char) (number + 55 ); + if (number < 10) + return (char) (number + 48 ); /* this is ASCII specific */ + else + return (char) (number + 55 ); } /* @@ -1213,6 +1214,78 @@ dissect_camel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* return tvb_captured_length(tvb); } +/* TAP STAT INFO */ +typedef enum +{ + MESSAGE_TYPE_COLUMN = 0, + COUNT_COLUMN +} camel_stat_columns; + +static stat_tap_table_item camel_stat_fields[] = {{TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "Message Type or Reason", "%-25s"}, {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Count", "%d"}}; + +void camel_stat_init(new_stat_tap_ui* new_stat, new_stat_tap_gui_init_cb gui_callback, void* gui_data) +{ + int num_fields = sizeof(camel_stat_fields)/sizeof(stat_tap_table_item); + new_stat_tap_table* table = new_stat_tap_init_table("CAMEL Message Counters", num_fields, 0, NULL, gui_callback, gui_data); + int i; + stat_tap_table_item_type items[sizeof(camel_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 */ + for (i = 0; i < camel_MAX_NUM_OPR_CODES; i++) + { + const char *ocs = try_val_to_str(i, camel_opr_code_strings); + char *col_str; + if (ocs) { + col_str = g_strdup_printf("Request %s", ocs); + } else { + col_str = g_strdup_printf("Unknown op code %d", i); + } + + items[MESSAGE_TYPE_COLUMN].value.string_value = col_str; + new_stat_tap_init_table_row(table, i, num_fields, items); + } +} + +static gboolean +camel_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *csi_ptr) +{ + new_stat_data_t* stat_data = (new_stat_data_t*)tapdata; + const struct camelsrt_info_t *csi = (const struct camelsrt_info_t *) csi_ptr; + new_stat_tap_table* table; + stat_tap_table_item_type* msg_data; + guint i = 0; + + table = g_array_index(stat_data->new_stat_tap_data->tables, new_stat_tap_table*, i); + if (csi->opcode >= table->num_elements) + return FALSE; + msg_data = new_stat_tap_get_field_data(table, csi->opcode, COUNT_COLUMN); + msg_data->value.uint_value++; + new_stat_tap_set_field_data(table, csi->opcode, COUNT_COLUMN, msg_data); + + return TRUE; +} + +static void +camel_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_reg_handoff_camel ---------------------------------------*/ static void range_delete_callback(guint32 ssn) { @@ -1436,10 +1509,10 @@ void proto_register_camel(void) { &ett_camel_cause, &ett_camel_RPcause, &ett_camel_stat, - &ett_camel_calledpartybcdnumber, - &ett_camel_callingpartynumber, - &ett_camel_locationnumber, - &ett_camel_additionalcallingpartynumber, + &ett_camel_calledpartybcdnumber, + &ett_camel_callingpartynumber, + &ett_camel_locationnumber, + &ett_camel_additionalcallingpartynumber, #include "packet-camel-ettarr.c" }; @@ -1452,6 +1525,25 @@ void proto_register_camel(void) { expert_module_t* expert_camel; + static tap_param camel_stat_params[] = { + { PARAM_FILTER, "filter", "Filter", NULL, TRUE } + }; + + static new_stat_tap_ui camel_stat_table = { + REGISTER_STAT_GROUP_TELEPHONY_GSM, + "CAMEL Messages and Response Status", + PSNAME, + "camel,counter", + camel_stat_init, + camel_stat_packet, + camel_stat_reset, + NULL, + NULL, + sizeof(camel_stat_fields)/sizeof(stat_tap_table_item), camel_stat_fields, + sizeof(camel_stat_params)/sizeof(tap_param), camel_stat_params, + NULL + }; + /* Register protocol */ proto_camel = proto_register_protocol(PNAME, PSNAME, PFNAME); @@ -1494,8 +1586,8 @@ void proto_register_camel(void) { &global_ssn_range, MAX_SSN); prefs_register_bool_preference(camel_module, "srt", - "Service Response Time Analyse", - "Activate the analyse for Response Time", + "Analyze Service Response Time", + "Enable response time analysis", &gcamel_HandleSRT); prefs_register_bool_preference(camel_module, "persistentsrt", @@ -1508,6 +1600,7 @@ void proto_register_camel(void) { register_cleanup_routine(&camelsrt_cleanup_routine); camel_tap=register_tap(PSNAME); - register_srt_table(proto_camel, "CAMEL", 1, camelstat_packet, camelstat_init, NULL); + register_srt_table(proto_camel, PSNAME, 1, camelstat_packet, camelstat_init, NULL); + register_new_stat_tap_ui(&camel_stat_table); } diff --git a/asn1/camel/packet-camel-template.h b/asn1/camel/packet-camel-template.h index f73e0d4220..6bff47834c 100644 --- a/asn1/camel/packet-camel-template.h +++ b/asn1/camel/packet-camel-template.h @@ -40,7 +40,6 @@ void proto_register_camel(void); /* Defines for the camel taps */ #define camel_MAX_NUM_OPR_CODES 256 - WS_DLL_PUBLIC const value_string camel_opr_code_strings[]; /* #include "packet-camel-exp.h"*/ diff --git a/epan/dissectors/packet-camel.c b/epan/dissectors/packet-camel.c index 634bbc90f6..1f3000429e 100644 --- a/epan/dissectors/packet-camel.c +++ b/epan/dissectors/packet-camel.c @@ -48,6 +48,7 @@ #include <epan/oids.h> #include <epan/tap.h> #include <epan/srt_table.h> +#include <epan/stat_tap_ui.h> #include <epan/asn1.h> #include <epan/expert.h> @@ -606,7 +607,7 @@ static int hf_camel_present = -1; /* INTEGER */ static int hf_camel_InvokeId_present = -1; /* InvokeId_present */ /*--- End of included file: packet-camel-hf.c ---*/ -#line 113 "../../asn1/camel/packet-camel-template.c" +#line 114 "../../asn1/camel/packet-camel-template.c" static struct camelsrt_info_t * gp_camelsrt_info; @@ -836,7 +837,7 @@ static gint ett_camel_T_problem = -1; static gint ett_camel_InvokeId = -1; /*--- End of included file: packet-camel-ett.c ---*/ -#line 144 "../../asn1/camel/packet-camel-template.c" +#line 145 "../../asn1/camel/packet-camel-template.c" static expert_field ei_camel_unknown_invokeData = EI_INIT; static expert_field ei_camel_unknown_returnResultData = EI_INIT; @@ -1181,7 +1182,7 @@ static const value_string camel_ectTreatmentIndicator_values[] = { #define noInvokeId NULL /*--- End of included file: packet-camel-val.h ---*/ -#line 304 "../../asn1/camel/packet-camel-template.c" +#line 305 "../../asn1/camel/packet-camel-template.c" /*--- Included file: packet-camel-table.c ---*/ @@ -1271,7 +1272,7 @@ static const value_string camel_err_code_string_vals[] = { /*--- End of included file: packet-camel-table.c ---*/ -#line 306 "../../asn1/camel/packet-camel-template.c" +#line 307 "../../asn1/camel/packet-camel-template.c" /* * DEBUG fonctions @@ -1311,7 +1312,7 @@ camelstat_init(struct register_srt* srt _U_, GArray* srt_array, srt_gui_init_cb } } -static int +static gboolean camelstat_packet(void *pcamel, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi) { guint idx = 0; @@ -1330,16 +1331,16 @@ camelstat_packet(void *pcamel, packet_info *pinfo, epan_dissect_t *edt _U_, cons add_srt_table_data(camel_srt_table, i, &pi->msginfo[i].req_time, pinfo); } } /* category */ - return 1; + return TRUE; } static char camel_number_to_char(int number) { - if (number < 10) - return (char) (number + 48 ); /* this is ASCII specific */ - else - return (char) (number + 55 ); + if (number < 10) + return (char) (number + 48 ); /* this is ASCII specific */ + else + return (char) (number + 55 ); } /* @@ -7111,7 +7112,7 @@ static int dissect_CAP_U_ABORT_REASON_PDU(tvbuff_t *tvb _U_, packet_info *pinfo /*--- End of included file: packet-camel-fn.c ---*/ -#line 414 "../../asn1/camel/packet-camel-template.c" +#line 415 "../../asn1/camel/packet-camel-template.c" /*--- Included file: packet-camel-table2.c ---*/ @@ -7318,7 +7319,7 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,a /*--- End of included file: packet-camel-table2.c ---*/ -#line 416 "../../asn1/camel/packet-camel-template.c" +#line 417 "../../asn1/camel/packet-camel-template.c" /* * Functions needed for Hash-Table @@ -8119,6 +8120,78 @@ dissect_camel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* return tvb_captured_length(tvb); } +/* TAP STAT INFO */ +typedef enum +{ + MESSAGE_TYPE_COLUMN = 0, + COUNT_COLUMN +} camel_stat_columns; + +static stat_tap_table_item camel_stat_fields[] = {{TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "Message Type or Reason", "%-25s"}, {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Count", "%d"}}; + +void camel_stat_init(new_stat_tap_ui* new_stat, new_stat_tap_gui_init_cb gui_callback, void* gui_data) +{ + int num_fields = sizeof(camel_stat_fields)/sizeof(stat_tap_table_item); + new_stat_tap_table* table = new_stat_tap_init_table("CAMEL Message Counters", num_fields, 0, NULL, gui_callback, gui_data); + int i; + stat_tap_table_item_type items[sizeof(camel_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 */ + for (i = 0; i < camel_MAX_NUM_OPR_CODES; i++) + { + const char *ocs = try_val_to_str(i, camel_opr_code_strings); + char *col_str; + if (ocs) { + col_str = g_strdup_printf("Request %s", ocs); + } else { + col_str = g_strdup_printf("Unknown op code %d", i); + } + + items[MESSAGE_TYPE_COLUMN].value.string_value = col_str; + new_stat_tap_init_table_row(table, i, num_fields, items); + } +} + +static gboolean +camel_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *csi_ptr) +{ + new_stat_data_t* stat_data = (new_stat_data_t*)tapdata; + const struct camelsrt_info_t *csi = (const struct camelsrt_info_t *) csi_ptr; + new_stat_tap_table* table; + stat_tap_table_item_type* msg_data; + guint i = 0; + + table = g_array_index(stat_data->new_stat_tap_data->tables, new_stat_tap_table*, i); + if (csi->opcode >= table->num_elements) + return FALSE; + msg_data = new_stat_tap_get_field_data(table, csi->opcode, COUNT_COLUMN); + msg_data->value.uint_value++; + new_stat_tap_set_field_data(table, csi->opcode, COUNT_COLUMN, msg_data); + + return TRUE; +} + +static void +camel_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_reg_handoff_camel ---------------------------------------*/ static void range_delete_callback(guint32 ssn) { @@ -8165,7 +8238,7 @@ void proto_reg_handoff_camel(void) { /*--- End of included file: packet-camel-dis-tab.c ---*/ -#line 1255 "../../asn1/camel/packet-camel-template.c" +#line 1328 "../../asn1/camel/packet-camel-template.c" } else { range_foreach(ssn_range, range_delete_callback); g_free(ssn_range); @@ -10279,7 +10352,7 @@ void proto_register_camel(void) { "InvokeId_present", HFILL }}, /*--- End of included file: packet-camel-hfarr.c ---*/ -#line 1428 "../../asn1/camel/packet-camel-template.c" +#line 1501 "../../asn1/camel/packet-camel-template.c" }; /* List of subtrees */ @@ -10291,10 +10364,10 @@ void proto_register_camel(void) { &ett_camel_cause, &ett_camel_RPcause, &ett_camel_stat, - &ett_camel_calledpartybcdnumber, - &ett_camel_callingpartynumber, - &ett_camel_locationnumber, - &ett_camel_additionalcallingpartynumber, + &ett_camel_calledpartybcdnumber, + &ett_camel_callingpartynumber, + &ett_camel_locationnumber, + &ett_camel_additionalcallingpartynumber, /*--- Included file: packet-camel-ettarr.c ---*/ @@ -10495,7 +10568,7 @@ void proto_register_camel(void) { &ett_camel_InvokeId, /*--- End of included file: packet-camel-ettarr.c ---*/ -#line 1445 "../../asn1/camel/packet-camel-template.c" +#line 1518 "../../asn1/camel/packet-camel-template.c" }; static ei_register_info ei[] = { @@ -10506,6 +10579,25 @@ void proto_register_camel(void) { expert_module_t* expert_camel; + static tap_param camel_stat_params[] = { + { PARAM_FILTER, "filter", "Filter", NULL, TRUE } + }; + + static new_stat_tap_ui camel_stat_table = { + REGISTER_STAT_GROUP_TELEPHONY_GSM, + "CAMEL Messages and Response Status", + PSNAME, + "camel,counter", + camel_stat_init, + camel_stat_packet, + camel_stat_reset, + NULL, + NULL, + sizeof(camel_stat_fields)/sizeof(stat_tap_table_item), camel_stat_fields, + sizeof(camel_stat_params)/sizeof(tap_param), camel_stat_params, + NULL + }; + /* Register protocol */ proto_camel = proto_register_protocol(PNAME, PSNAME, PFNAME); @@ -10548,8 +10640,8 @@ void proto_register_camel(void) { &global_ssn_range, MAX_SSN); prefs_register_bool_preference(camel_module, "srt", - "Service Response Time Analyse", - "Activate the analyse for Response Time", + "Analyze Service Response Time", + "Enable response time analysis", &gcamel_HandleSRT); prefs_register_bool_preference(camel_module, "persistentsrt", @@ -10562,6 +10654,7 @@ void proto_register_camel(void) { register_cleanup_routine(&camelsrt_cleanup_routine); camel_tap=register_tap(PSNAME); - register_srt_table(proto_camel, "CAMEL", 1, camelstat_packet, camelstat_init, NULL); + register_srt_table(proto_camel, PSNAME, 1, camelstat_packet, camelstat_init, NULL); + register_new_stat_tap_ui(&camel_stat_table); } diff --git a/epan/dissectors/packet-camel.h b/epan/dissectors/packet-camel.h index 4083bd1c5e..61137a194a 100644 --- a/epan/dissectors/packet-camel.h +++ b/epan/dissectors/packet-camel.h @@ -48,7 +48,6 @@ void proto_register_camel(void); /* Defines for the camel taps */ #define camel_MAX_NUM_OPR_CODES 256 - WS_DLL_PUBLIC const value_string camel_opr_code_strings[]; /* #include "packet-camel-exp.h"*/ diff --git a/ui/cli/Makefile.common b/ui/cli/Makefile.common index 4b0f78ad17..cdaa354f1e 100644 --- a/ui/cli/Makefile.common +++ b/ui/cli/Makefile.common @@ -38,7 +38,6 @@ GENERATOR_FILES = # sources for TShark taps TSHARK_TAP_SRC = \ - tap-camelcounter.c \ tap-camelsrt.c \ tap-comparestat.c \ tap-diameter-avp.c \ diff --git a/ui/cli/tap-camelcounter.c b/ui/cli/tap-camelcounter.c deleted file mode 100644 index 6013a1e772..0000000000 --- a/ui/cli/tap-camelcounter.c +++ /dev/null @@ -1,148 +0,0 @@ -/* tap_camelcounter.c - * camel message counter for tshark - * Copyright 2006 Florent DROUIN - * - * This part of code is extracted from tap-h225counter.c from 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/value_string.h" -#include "epan/stat_tap_ui.h" -#include "epan/dissectors/packet-camel.h" - -void register_tap_listener_camelcounter(void); - -/* used to keep track of the statistics for an entire program interface */ -struct camelcounter_t { - char *filter; - guint32 camel_msg[camel_MAX_NUM_OPR_CODES]; -}; - - -static void camelcounter_reset(void *phs) -{ - struct camelcounter_t * p_counter= ( struct camelcounter_t *) phs; - memset(p_counter, 0, sizeof(struct camelcounter_t)); -} - -static int camelcounter_packet(void *phs, - packet_info *pinfo _U_, - epan_dissect_t *edt _U_, - const void *phi) -{ - struct camelcounter_t * p_counter =(struct camelcounter_t *)phs; - const struct camelsrt_info_t * pi = (const struct camelsrt_info_t *)phi; - if (pi->opcode != 255) - p_counter->camel_msg[pi->opcode]++; - - return 1; -} - - -static void camelcounter_draw(void *phs) -{ - struct camelcounter_t * p_counter= (struct camelcounter_t *)phs; - int i; - gchar *tmp_str; - printf("\n"); - printf("CAMEL Message and Response Status Counter:\n"); - printf("------------------------------------------\n"); - - for (i=0; i<camel_MAX_NUM_OPR_CODES; i++) { - /* Message counter */ - if (p_counter->camel_msg[i] != 0) { - tmp_str = val_to_str_wmem(NULL, i, camel_opr_code_strings, "Unknown message (%d)"); - printf("%30s ", tmp_str); - wmem_free(NULL, tmp_str); - printf("%6u\n", p_counter->camel_msg[i]); - } - } /* Message Type */ - printf("------------------------------------------\n"); -} - -static void camelcounter_init(const char *opt_arg, void *userdata _U_) -{ - struct camelcounter_t *p_camelcounter; - GString *error_string; - - p_camelcounter = g_new(struct camelcounter_t, 1); - if (!strncmp(opt_arg, "camel,counter,", 13)) { - p_camelcounter->filter = g_strdup(opt_arg+13); - } else { - p_camelcounter->filter = NULL; - } - - camelcounter_reset(p_camelcounter); - - error_string = register_tap_listener("CAMEL", - p_camelcounter, - p_camelcounter->filter, - 0, - NULL, - camelcounter_packet, - camelcounter_draw); - - if (error_string) { - /* error, we failed to attach to the tap. clean up */ - g_free(p_camelcounter->filter); - g_free(p_camelcounter); - - fprintf(stderr, "tshark: Couldn't register camel,counter tap: %s\n", - error_string->str); - g_string_free(error_string, TRUE); - exit(1); - } -} - -static stat_tap_ui camelcounter_ui = { - REGISTER_STAT_GROUP_GENERIC, - NULL, - "camel,counter", - camelcounter_init, - 0, - NULL -}; - -void /* Next line mandatory */ -register_tap_listener_camelcounter(void) -{ - register_stat_tap_ui(&camelcounter_ui, NULL); -} - -/* - * Editor modelines - http://www.wireshark.org/tools/modelines.html - * - * Local Variables: - * c-basic-offset: 2 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * ex: set shiftwidth=2 tabstop=8 expandtab: - * :indentSize=2:tabSize=8:noTabs=true: - */ diff --git a/ui/gtk/CMakeLists.txt b/ui/gtk/CMakeLists.txt index 6ef954d7b2..a6f3a3be4d 100644 --- a/ui/gtk/CMakeLists.txt +++ b/ui/gtk/CMakeLists.txt @@ -197,7 +197,6 @@ if(ENABLE_EXTCAP) endif() set(WIRESHARK_TAP_SRC - camel_counter.c compare_stat.c dcerpc_stat.c expert_comp_dlg.c diff --git a/ui/gtk/Makefile.common b/ui/gtk/Makefile.common index f359409618..25a85192ec 100644 --- a/ui/gtk/Makefile.common +++ b/ui/gtk/Makefile.common @@ -147,7 +147,6 @@ prefs_layout.c: layouts.h stock_icons.c: stock_icons.h toolbar_icons.h wsicon.h WIRESHARK_TAP_SRC = \ - camel_counter.c \ compare_stat.c \ dcerpc_stat.c \ expert_comp_dlg.c \ diff --git a/ui/gtk/camel_counter.c b/ui/gtk/camel_counter.c deleted file mode 100644 index e77be0dd33..0000000000 --- a/ui/gtk/camel_counter.c +++ /dev/null @@ -1,240 +0,0 @@ -/* camel_counter.c - * camel message counter for Wireshark - * Copyright 2006 Florent Drouin (based on h225_counter.c from 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 <gtk/gtk.h> - -#include <epan/packet_info.h> -#include <epan/value_string.h> -#include <epan/tap.h> -#include <epan/packet.h> -#include <epan/dissectors/packet-camel.h> - - -#include "ui/simple_dialog.h" - -#include "ui/gtk/main.h" -#include "ui/gtk/dlg_utils.h" -#include "ui/gtk/gui_utils.h" -#include "ui/gtk/gui_stat_util.h" -#include "ui/gtk/tap_param_dlg.h" - - -static void gtk_camelcounter_reset(void *phs); -static int gtk_camelcounter_packet(void *phs, - packet_info *pinfo _U_, - epan_dissect_t *edt _U_, - const void *phi); -static void gtk_camelcounter_draw(void *phs); -static void win_destroy_cb(GtkWindow *win _U_, gpointer data); -static void gtk_camelcounter_init(const char *opt_arg, void *userdata _U_); -void register_tap_listener_gtk_camelcounter(void); - -/* following values represent the size of their valuestring arrays */ - -struct camelcounter_t { - GtkWidget *win; - GtkWidget *vbox; - char *filter; - GtkWidget *scrolled_window; - GtkTreeView *table; - guint32 camel_msg[camel_MAX_NUM_OPR_CODES]; -}; - -static void gtk_camelcounter_reset(void *phs) -{ - struct camelcounter_t * p_counter= ( struct camelcounter_t *) phs; - int i; - - /* Erase Message Type count */ - for(i=0;i<camel_MAX_NUM_OPR_CODES;i++) { - p_counter->camel_msg[i]=0; - } -} - - -/* - * If there is a valid camel operation, increase the value in the array of counter - */ -static int gtk_camelcounter_packet(void *phs, - packet_info *pinfo _U_, - epan_dissect_t *edt _U_, - const void *phi) -{ - struct camelcounter_t * p_counter =(struct camelcounter_t *)phs; - const struct camelsrt_info_t * pi=(const struct camelsrt_info_t *)phi; - if (pi->opcode != 255) - p_counter->camel_msg[pi->opcode]++; - - return 1; -} - -static void gtk_camelcounter_draw(void *phs) -{ - struct camelcounter_t *p_counter=(struct camelcounter_t *)phs; - int i; - 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(p_counter->table)); - gtk_list_store_clear(store); - - for(i=0;i<camel_MAX_NUM_OPR_CODES;i++) { - /* Message counter */ - if(p_counter->camel_msg[i]!=0) { - tmp_str = val_to_str_wmem(NULL, i,camel_opr_code_strings,"Unknown message (%d)"); - g_snprintf(str, 256, "Request %s", tmp_str); - wmem_free(NULL, tmp_str); - - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, - 0, str, - 1, p_counter->camel_msg[i], - -1); - } - } /* Message Type */ -} - -static void win_destroy_cb(GtkWindow *win _U_, gpointer data) -{ - struct camelcounter_t *hs=(struct camelcounter_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_camelcounter_init(const char *opt_arg, void *userdata _U_) -{ - struct camelcounter_t *p_camelcounter; - const char *filter = NULL; - GString *error_string; - GtkWidget *bbox; - GtkWidget *close_bt; - - if(strncmp(opt_arg,"camel,counter,",14) == 0){ - filter=opt_arg+14; - } else { - filter=NULL; - } - - p_camelcounter=(struct camelcounter_t *)g_malloc(sizeof(struct camelcounter_t)); - p_camelcounter->filter=g_strdup(filter); - - gtk_camelcounter_reset(p_camelcounter); - - /* transient_for top_level */ - p_camelcounter->win=dlg_window_new("Wireshark: CAMEL counters"); - gtk_window_set_destroy_with_parent (GTK_WINDOW(p_camelcounter->win), TRUE); - - gtk_window_set_default_size(GTK_WINDOW(p_camelcounter->win), 500, 300); - - p_camelcounter->vbox=ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 3, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(p_camelcounter->vbox), 12); - - init_main_stat_window(p_camelcounter->win, p_camelcounter->vbox, "CAMEL Messages Counters", filter); - - /* init a scrolled window*/ - p_camelcounter->scrolled_window = scrolled_window_new(NULL, NULL); - - p_camelcounter->table = create_stat_table(p_camelcounter->scrolled_window, p_camelcounter->vbox, 2, titles); - - error_string=register_tap_listener("CAMEL", p_camelcounter, filter, 0, - gtk_camelcounter_reset, - gtk_camelcounter_packet, - gtk_camelcounter_draw); - - if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); - g_string_free(error_string, TRUE); - g_free(p_camelcounter); - return; - } - - /* Button row. */ - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - gtk_box_pack_end(GTK_BOX(p_camelcounter->vbox), bbox, FALSE, FALSE, 0); - - close_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE); - window_set_cancel_button(p_camelcounter->win, close_bt, window_cancel_button_cb); - - g_signal_connect(p_camelcounter->win, "delete_event", G_CALLBACK(window_delete_event_cb), NULL); - g_signal_connect(p_camelcounter->win, "destroy", G_CALLBACK(win_destroy_cb), p_camelcounter); - - gtk_widget_show_all(p_camelcounter->win); - window_present(p_camelcounter->win); - - cf_retap_packets(&cfile); - gdk_window_raise(gtk_widget_get_window(p_camelcounter->win)); -} - -static tap_param camel_counter_params[] = { - { PARAM_FILTER, "filter", "Filter", NULL, TRUE } -}; - -static tap_param_dlg camel_counter_dlg = { - "CAMEL Messages and Response Status", - "camel,counter", - gtk_camelcounter_init, - -1, - G_N_ELEMENTS(camel_counter_params), - camel_counter_params, - NULL -}; - -void /* Next line mandatory */ -register_tap_listener_gtk_camelcounter(void) -{ - register_param_stat(&camel_counter_dlg, "CAMEL Messages and Response Status", - REGISTER_STAT_GROUP_TELEPHONY_GSM); - -} - -/* - * Editor modelines - http://www.wireshark.org/tools/modelines.html - * - * Local Variables: - * c-basic-offset: 2 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=2 tabstop=8 expandtab: - * :indentSize=2:tabSize=8:noTabs=true: - */ diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index d0f874e78d..9bcf2b95d7 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -2000,6 +2000,9 @@ void MainWindow::addDynamicMenus() case REGISTER_STAT_GROUP_TELEPHONY_ANSI: main_ui_->menuANSI->addAction(action); break; + case REGISTER_STAT_GROUP_TELEPHONY_GSM: + main_ui_->menuGSM->addAction(action); + break; case REGISTER_TOOLS_GROUP_UNSORTED: { // Allow the creation of submenus. Mimics the behavor of diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui index 9211ed527c..0eb120af46 100644 --- a/ui/qt/main_window.ui +++ b/ui/qt/main_window.ui @@ -515,8 +515,15 @@ </property> <addaction name="actionTelephonyANSIPlaceholder"/> </widget> + <widget class="QMenu" name="menuGSM"> + <property name="title"> + <string>GSM</string> + </property> + <addaction name="actionTelephonyANSIPlaceholder"/> + </widget> <addaction name="actionTelephonyVoipCalls"/> <addaction name="menuANSI"/> + <addaction name="menuGSM"/> <addaction name="actionTelephonyISUPMessages"/> <addaction name="menuRTP"/> <addaction name="menuRTSP"/> |