diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-12-09 18:49:32 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-12-09 18:49:32 +0000 |
commit | 647c107eece3657da9679701d804b46ee230f8af (patch) | |
tree | fc531c533bbf6764d99175fec5f17116a301f39d /gtk | |
parent | 4978ac5d43cecafeb09a11d1a87f68c6cc3cf082 (diff) |
From Michael Lum:
new taps for GSM A-interface;
fixes for ANSI A-interface taps.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9220 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/Makefile.am | 3 | ||||
-rw-r--r-- | gtk/Makefile.nmake | 3 | ||||
-rw-r--r-- | gtk/ansi_a_stat.c | 15 | ||||
-rw-r--r-- | gtk/gsm_a_stat.c | 307 |
4 files changed, 319 insertions, 9 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 43b9941348..4909db9f5b 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for the GTK interface routines for Ethereal # -# $Id: Makefile.am,v 1.78 2003/12/03 23:46:22 guy Exp $ +# $Id: Makefile.am,v 1.79 2003/12/09 18:49:31 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@ethereal.com> @@ -40,6 +40,7 @@ ETHEREAL_TAP_SRC = \ endpoint_talkers_tr.c \ endpoint_talkers_udpip.c \ fc_stat.c \ + gsm_a_stat.c \ h225_counter.c \ h225_ras_srt.c \ http_stat.c \ diff --git a/gtk/Makefile.nmake b/gtk/Makefile.nmake index 2a62c6c574..dbd239fb10 100644 --- a/gtk/Makefile.nmake +++ b/gtk/Makefile.nmake @@ -1,7 +1,7 @@ ## Makefile for building ethereal.exe with Microsoft C and nmake ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake # -# $Id: Makefile.nmake,v 1.63 2003/12/03 23:46:23 guy Exp $ +# $Id: Makefile.nmake,v 1.64 2003/12/09 18:49:32 guy Exp $ include ..\config.nmake @@ -31,6 +31,7 @@ ETHEREAL_TAP_SRC = \ endpoint_talkers_tr.c \ endpoint_talkers_udpip.c \ fc_stat.c \ + gsm_a_stat.c \ h225_counter.c \ h225_ras_srt.c \ http_stat.c \ diff --git a/gtk/ansi_a_stat.c b/gtk/ansi_a_stat.c index 7d57a9792a..74346329af 100644 --- a/gtk/ansi_a_stat.c +++ b/gtk/ansi_a_stat.c @@ -5,7 +5,7 @@ * * MUCH code modified from service_response_time_table.c. * - * $Id: ansi_a_stat.c,v 1.1 2003/12/03 23:46:23 guy Exp $ + * $Id: ansi_a_stat.c,v 1.2 2003/12/09 18:49:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -288,7 +288,8 @@ ansi_a_stat_gtk_win_destroy_cb( static void ansi_a_stat_gtk_win_create( - ansi_a_stat_dlg_t *dlg_p) + ansi_a_stat_dlg_t *dlg_p, + char *title) { #define INIT_TABLE_NUM_COLUMNS 3 char *default_titles[] = { "IEI", "Message Name", "Count" }; @@ -307,7 +308,7 @@ ansi_a_stat_gtk_win_create( dlg_p->win = gtk_dialog_new(); gtk_window_set_default_size(GTK_WINDOW(dlg_p->win), 480, 450); - gtk_window_set_title(GTK_WINDOW(dlg_p->win), "ANSI A-Interface Statistics"); + gtk_window_set_title(GTK_WINDOW(dlg_p->win), title); SIGNAL_CONNECT(dlg_p->win, "destroy", ansi_a_stat_gtk_win_destroy_cb, dlg_p); dialog_vbox = GTK_DIALOG(dlg_p->win)->vbox; @@ -461,12 +462,12 @@ ansi_a_stat_gtk_bsmap_cb( return; } - ansi_a_stat_gtk_win_create(&dlg_bsmap); + ansi_a_stat_gtk_win_create(&dlg_bsmap, "ANSI A-I/F BSMAP Statistics"); i = 0; while (ansi_a_ios401_bsmap_strings[i].strptr) { - sprintf(str, "0x%02x", i); + sprintf(str, "0x%02x", ansi_a_ios401_bsmap_strings[i].value); dlg_bsmap.entries[0] = g_strdup(str); dlg_bsmap.entries[1] = g_strdup(ansi_a_ios401_bsmap_strings[i].strptr); @@ -501,12 +502,12 @@ ansi_a_stat_gtk_dtap_cb( return; } - ansi_a_stat_gtk_win_create(&dlg_dtap); + ansi_a_stat_gtk_win_create(&dlg_dtap, "ANSI A-I/F DTAP Statistics"); i = 0; while (ansi_a_ios401_dtap_strings[i].strptr) { - sprintf(str, "0x%02x", i); + sprintf(str, "0x%02x", ansi_a_ios401_dtap_strings[i].value); dlg_dtap.entries[0] = g_strdup(str); dlg_dtap.entries[1] = g_strdup(ansi_a_ios401_dtap_strings[i].strptr); diff --git a/gtk/gsm_a_stat.c b/gtk/gsm_a_stat.c new file mode 100644 index 0000000000..fcf044d8d1 --- /dev/null +++ b/gtk/gsm_a_stat.c @@ -0,0 +1,307 @@ +/* tap-gsm_astat.c + * + * Copyright 2003, Michael Lum <mlum [AT] telostech.com> + * In association with Telos Technology Inc. + * + * $Id: gsm_a_stat.c,v 1.1 2003/12/09 18:49:32 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * This TAP provides statistics for the GSM A Interface: + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <stdio.h> + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#include <string.h> +#include "epan/packet_info.h" +#include "epan/value_string.h" +#include "tap.h" +#include "packet-bssap.h" +#include "packet-gsm_a.h" +#include "register.h" + + +typedef struct _gsm_a_stat_t { + int bssmap_message_type[0xff]; + int dtap_mm_message_type[0xff]; + int dtap_rr_message_type[0xff]; + int dtap_cc_message_type[0xff]; + int dtap_gmm_message_type[0xff]; + int dtap_sms_message_type[0xff]; + int dtap_sm_message_type[0xff]; + int dtap_ss_message_type[0xff]; +} gsm_a_stat_t; + + +static int +gsm_a_stat_packet( + void *tapdata, + packet_info *pinfo, + epan_dissect_t *edt _U_, + void *data) +{ + gsm_a_stat_t *stat_p = tapdata; + gsm_a_tap_rec_t *tap_p = data; + + + pinfo = pinfo; + + switch (tap_p->pdu_type) + { + case BSSAP_PDU_TYPE_BSSMAP: + stat_p->bssmap_message_type[tap_p->message_type]++; + break; + + case BSSAP_PDU_TYPE_DTAP: + switch (tap_p->protocol_disc) + { + case PD_CC: + stat_p->dtap_cc_message_type[tap_p->message_type]++; + break; + case PD_MM: + stat_p->dtap_mm_message_type[tap_p->message_type]++; + break; + case PD_RR: + stat_p->dtap_rr_message_type[tap_p->message_type]++; + break; + case PD_GMM: + stat_p->dtap_gmm_message_type[tap_p->message_type]++; + break; + case PD_SMS: + stat_p->dtap_sms_message_type[tap_p->message_type]++; + break; + case PD_SM: + stat_p->dtap_sm_message_type[tap_p->message_type]++; + break; + case PD_SS: + stat_p->dtap_ss_message_type[tap_p->message_type]++; + break; + default: + /* + * unsupported PD + */ + return(0); + } + break; + + default: + /* + * unknown PDU type !!! + */ + return(0); + } + + return(1); +} + + +static void +gsm_a_stat_draw( + void *tapdata) +{ + gsm_a_stat_t *stat_p = tapdata; + guint8 i; + + + printf("\n"); + printf("=========== GS=M A-i/f Statistics ============================\n"); + printf("BSSMAP\n"); + printf("Message (ID)Type Number\n"); + + i = 0; + while (gsm_a_bssmap_msg_strings[i].strptr) + { + if (stat_p->bssmap_message_type[gsm_a_bssmap_msg_strings[i].value] > 0) + { + printf("0x%02x %-50s%d\n", + gsm_a_bssmap_msg_strings[i].value, + gsm_a_bssmap_msg_strings[i].strptr, + stat_p->bssmap_message_type[gsm_a_bssmap_msg_strings[i].value]); + } + + i++; + } + + printf("\nDTAP %s\n", gsm_a_pd_str[PD_MM]); + printf("Message (ID)Type Number\n"); + + i = 0; + while (gsm_a_dtap_msg_mm_strings[i].strptr) + { + if (stat_p->dtap_mm_message_type[gsm_a_dtap_msg_mm_strings[i].value] > 0) + { + printf("0x%02x %-50s%d\n", + gsm_a_dtap_msg_mm_strings[i].value, + gsm_a_dtap_msg_mm_strings[i].strptr, + stat_p->dtap_mm_message_type[gsm_a_dtap_msg_mm_strings[i].value]); + } + + i++; + } + + printf("\nDTAP %s\n", gsm_a_pd_str[PD_RR]); + printf("Message (ID)Type Number\n"); + + i = 0; + while (gsm_a_dtap_msg_rr_strings[i].strptr) + { + if (stat_p->dtap_rr_message_type[gsm_a_dtap_msg_rr_strings[i].value] > 0) + { + printf("0x%02x %-50s%d\n", + gsm_a_dtap_msg_rr_strings[i].value, + gsm_a_dtap_msg_rr_strings[i].strptr, + stat_p->dtap_rr_message_type[gsm_a_dtap_msg_rr_strings[i].value]); + } + + i++; + } + + printf("\nDTAP %s\n", gsm_a_pd_str[PD_CC]); + printf("Message (ID)Type Number\n"); + + i = 0; + while (gsm_a_dtap_msg_cc_strings[i].strptr) + { + if (stat_p->dtap_cc_message_type[gsm_a_dtap_msg_cc_strings[i].value] > 0) + { + printf("0x%02x %-50s%d\n", + gsm_a_dtap_msg_cc_strings[i].value, + gsm_a_dtap_msg_cc_strings[i].strptr, + stat_p->dtap_cc_message_type[gsm_a_dtap_msg_cc_strings[i].value]); + } + + i++; + } + + printf("\nDTAP %s\n", gsm_a_pd_str[PD_GMM]); + printf("Message (ID)Type Number\n"); + + i = 0; + while (gsm_a_dtap_msg_gmm_strings[i].strptr) + { + if (stat_p->dtap_gmm_message_type[gsm_a_dtap_msg_gmm_strings[i].value] > 0) + { + printf("0x%02x %-50s%d\n", + gsm_a_dtap_msg_gmm_strings[i].value, + gsm_a_dtap_msg_gmm_strings[i].strptr, + stat_p->dtap_gmm_message_type[gsm_a_dtap_msg_gmm_strings[i].value]); + } + + i++; + } + + printf("\nDTAP %s\n", gsm_a_pd_str[PD_SMS]); + printf("Message (ID)Type Number\n"); + + i = 0; + while (gsm_a_dtap_msg_sms_strings[i].strptr) + { + if (stat_p->dtap_sms_message_type[gsm_a_dtap_msg_sms_strings[i].value] > 0) + { + printf("0x%02x %-50s%d\n", + gsm_a_dtap_msg_sms_strings[i].value, + gsm_a_dtap_msg_sms_strings[i].strptr, + stat_p->dtap_sms_message_type[gsm_a_dtap_msg_sms_strings[i].value]); + } + + i++; + } + + printf("\nDTAP %s\n", gsm_a_pd_str[PD_SM]); + printf("Message (ID)Type Number\n"); + + i = 0; + while (gsm_a_dtap_msg_sm_strings[i].strptr) + { + if (stat_p->dtap_sm_message_type[gsm_a_dtap_msg_sm_strings[i].value] > 0) + { + printf("0x%02x %-50s%d\n", + gsm_a_dtap_msg_sm_strings[i].value, + gsm_a_dtap_msg_sm_strings[i].strptr, + stat_p->dtap_sm_message_type[gsm_a_dtap_msg_sm_strings[i].value]); + } + + i++; + } + + printf("\nDTAP %s\n", gsm_a_pd_str[PD_SS]); + printf("Message (ID)Type Number\n"); + + i = 0; + while (gsm_a_dtap_msg_ss_strings[i].strptr) + { + if (stat_p->dtap_ss_message_type[gsm_a_dtap_msg_ss_strings[i].value] > 0) + { + printf("0x%02x %-50s%d\n", + gsm_a_dtap_msg_ss_strings[i].value, + gsm_a_dtap_msg_ss_strings[i].strptr, + stat_p->dtap_ss_message_type[gsm_a_dtap_msg_ss_strings[i].value]); + } + + i++; + } + + printf("==============================================================\n"); +} + + +static void +gsm_a_stat_init(char *optarg) +{ + gsm_a_stat_t *stat_p; + GString *err_p; + + + optarg = optarg; + + stat_p = g_malloc(sizeof(gsm_a_stat_t)); + + memset(stat_p, 0, sizeof(gsm_a_stat_t)); + + err_p = + register_tap_listener("gsm_a", stat_p, NULL, + NULL, + gsm_a_stat_packet, + gsm_a_stat_draw); + + if (err_p != NULL) + { + g_free(stat_p); + g_string_free(err_p, TRUE); + + exit(1); + } +} + + +void +register_tap_listener_gsm_astat(void) +{ + register_ethereal_tap("gsm_a,", gsm_a_stat_init); +} |