aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-12-09 18:49:32 +0000
committerGuy Harris <guy@alum.mit.edu>2003-12-09 18:49:32 +0000
commit15f863dc3c7080b642c32dbce43ba9cc70fdda39 (patch)
treefc531c533bbf6764d99175fec5f17116a301f39d
parent11d8817da0148daa1cda2db873a3ec31c0c02a69 (diff)
From Michael Lum:
new taps for GSM A-interface; fixes for ANSI A-interface taps. svn path=/trunk/; revision=9220
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.nmake3
-rw-r--r--gtk/Makefile.am3
-rw-r--r--gtk/Makefile.nmake3
-rw-r--r--gtk/ansi_a_stat.c15
-rw-r--r--gtk/gsm_a_stat.c307
-rw-r--r--packet-gsm_a.c174
-rw-r--r--packet-gsm_a.h75
-rw-r--r--tap-ansi_astat.c6
-rw-r--r--tap-gsm_astat.c307
10 files changed, 814 insertions, 83 deletions
diff --git a/Makefile.am b/Makefile.am
index cb18f1ce0b..cb1db07dba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
-# $Id: Makefile.am,v 1.664 2003/12/06 16:35:17 gram Exp $
+# $Id: Makefile.am,v 1.665 2003/12/09 18:49:30 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
@@ -664,6 +664,7 @@ noinst_HEADERS = \
packet-frame.h \
packet-giop.h \
packet-gnutella.h \
+ packet-gsm_a.h \
packet-gssapi.h \
packet-gtp.h \
packet-h225.h \
@@ -937,6 +938,7 @@ TETHEREAL_TAP_SRC = \
tap-ansi_astat.c \
tap-bootpstat.c \
tap-dcerpcstat.c \
+ tap-gsm_astat.c \
tap-h225counter.c \
tap-h225rassrt.c \
tap-httpstat.c \
diff --git a/Makefile.nmake b/Makefile.nmake
index c87e3334d7..e1de45f5f9 100644
--- a/Makefile.nmake
+++ b/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.372 2003/12/08 22:28:53 guy Exp $
+# $Id: Makefile.nmake,v 1.373 2003/12/09 18:49:30 guy Exp $
include config.nmake
include <win32.mak>
@@ -423,6 +423,7 @@ TETHEREAL_TAP_SRC = \
tap-ansi_astat.c \
tap-bootpstat.c \
tap-dcerpcstat.c \
+ tap-gsm_astat.c \
tap-h225counter.c \
tap-h225rassrt.c \
tap-httpstat.c \
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);
+}
diff --git a/packet-gsm_a.c b/packet-gsm_a.c
index 660297ed02..af88783646 100644
--- a/packet-gsm_a.c
+++ b/packet-gsm_a.c
@@ -38,7 +38,7 @@
* Formats and coding
* (3GPP TS 24.080 version 4.3.0 Release 4)
*
- * $Id: packet-gsm_a.c,v 1.7 2003/12/08 23:40:12 guy Exp $
+ * $Id: packet-gsm_a.c,v 1.8 2003/12/09 18:49:30 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -70,12 +70,14 @@
#include "epan/packet.h"
#include "prefs.h"
+#include "tap.h"
#include "packet-bssap.h"
+#include "packet-gsm_a.h"
/* PROTOTYPES/FORWARDS */
-static const value_string gsm_bssmap_msg_strings[] = {
+const value_string gsm_a_bssmap_msg_strings[] = {
{ 0x01, "Assignment Request" },
{ 0x02, "Assignment Complete" },
{ 0x03, "Assignment Failure" },
@@ -153,7 +155,7 @@ static const value_string gsm_bssmap_msg_strings[] = {
{ 0, NULL },
};
-static const value_string gsm_dtap_msg_mm_strings[] = {
+const value_string gsm_a_dtap_msg_mm_strings[] = {
{ 0x01, "IMSI Detach Indication" },
{ 0x02, "Location Updating Accept" },
{ 0x04, "Location Updating Reject" },
@@ -180,7 +182,7 @@ static const value_string gsm_dtap_msg_mm_strings[] = {
{ 0, NULL },
};
-static const value_string gsm_dtap_msg_rr_strings[] = {
+const value_string gsm_a_dtap_msg_rr_strings[] = {
{ 0x3c, "RR Initialisation Request" },
{ 0x3b, "Additional Assignment" },
{ 0x3f, "Immediate Assignment" },
@@ -278,7 +280,7 @@ static const value_string gsm_dtap_msg_rr_strings[] = {
{ 0, NULL },
};
-static const value_string gsm_dtap_msg_cc_strings[] = {
+const value_string gsm_a_dtap_msg_cc_strings[] = {
{ 0x01, "Alerting" },
{ 0x08, "Call Confirmed" },
{ 0x02, "Call Proceeding" },
@@ -317,7 +319,7 @@ static const value_string gsm_dtap_msg_cc_strings[] = {
{ 0, NULL },
};
-static const value_string gsm_dtap_msg_gmm_strings[] = {
+const value_string gsm_a_dtap_msg_gmm_strings[] = {
{ 0x01, "Attach Request" },
{ 0x02, "Attach Accept" },
{ 0x03, "Attach Complete" },
@@ -344,14 +346,14 @@ static const value_string gsm_dtap_msg_gmm_strings[] = {
{ 0, NULL },
};
-static const value_string gsm_dtap_msg_sms_strings[] = {
+const value_string gsm_a_dtap_msg_sms_strings[] = {
{ 0x01, "CP-DATA" },
{ 0x04, "CP-ACK" },
{ 0x10, "CP-ERROR" },
{ 0, NULL },
};
-static const value_string gsm_dtap_msg_sm_strings[] = {
+const value_string gsm_a_dtap_msg_sm_strings[] = {
{ 0x41, "Activate PDP Context Request" },
{ 0x42, "Activate PDP Context Accept" },
{ 0x43, "Activate PDP Context Reject" },
@@ -376,7 +378,7 @@ static const value_string gsm_dtap_msg_sm_strings[] = {
{ 0, NULL },
};
-static const value_string gsm_dtap_msg_ss_strings[] = {
+const value_string gsm_a_dtap_msg_ss_strings[] = {
{ 0x2a, "Release Complete" },
{ 0x3a, "Facility" },
{ 0x3b, "Register" },
@@ -596,7 +598,7 @@ static const value_string gsm_dtap_elem_strings[] = {
{ 0, NULL },
};
-static const gchar *pd_str[] = {
+const gchar *gsm_a_pd_str[] = {
"Group Call Control",
"Broadcast Call Control",
"Reserved: was allocated in earlier phases of the protocol",
@@ -656,6 +658,8 @@ static int proto_a_bssmap = -1;
static int proto_a_dtap = -1;
static int proto_a_rp = -1;
+static int gsm_a_tap = -1;
+
static int hf_gsm_a_none = -1;
static int hf_gsm_a_bssmap_msg_type = -1;
static int hf_gsm_a_dtap_msg_mm_type = -1;
@@ -1283,7 +1287,7 @@ be_l3_header_info(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gc
tvb, curr_offset, 1,
"%s : Protocol Discriminator: %s",
a_bigbuf,
- pd_str[oct & DTAP_PD_MASK]);
+ gsm_a_pd_str[oct & DTAP_PD_MASK]);
curr_offset++;
@@ -3442,7 +3446,7 @@ de_pd_sapi(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *ad
proto_tree_add_text(subtree, tvb, curr_offset, 1,
"%s : PD (Protocol Discriminator): %s",
a_bigbuf,
- pd_str[oct & 0x0f]);
+ gsm_a_pd_str[oct & 0x0f]);
curr_offset++;
@@ -7980,7 +7984,7 @@ bssmap_conn_oriented(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
EXTRANEOUS_DATA_CHECK(curr_len, 0);
}
-#define NUM_GSM_BSSMAP_MSG (sizeof(gsm_bssmap_msg_strings)/sizeof(value_string))
+#define NUM_GSM_BSSMAP_MSG (sizeof(gsm_a_bssmap_msg_strings)/sizeof(value_string))
static gint ett_gsm_bssmap_msg[NUM_GSM_BSSMAP_MSG];
static void (*bssmap_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
bssmap_ass_req, /* Assignment Request */
@@ -9851,7 +9855,7 @@ rp_error_ms_n(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
EXTRANEOUS_DATA_CHECK(curr_len, 0);
}
-#define NUM_GSM_DTAP_MSG_MM (sizeof(gsm_dtap_msg_mm_strings)/sizeof(value_string))
+#define NUM_GSM_DTAP_MSG_MM (sizeof(gsm_a_dtap_msg_mm_strings)/sizeof(value_string))
static gint ett_gsm_dtap_msg_mm[NUM_GSM_DTAP_MSG_MM];
static void (*dtap_msg_mm_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
dtap_mm_imsi_det_ind, /* IMSI Detach Indication */
@@ -9880,7 +9884,7 @@ static void (*dtap_msg_mm_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset
NULL, /* NONE */
};
-#define NUM_GSM_DTAP_MSG_RR (sizeof(gsm_dtap_msg_rr_strings)/sizeof(value_string))
+#define NUM_GSM_DTAP_MSG_RR (sizeof(gsm_a_dtap_msg_rr_strings)/sizeof(value_string))
static gint ett_gsm_dtap_msg_rr[NUM_GSM_DTAP_MSG_RR];
static void (*dtap_msg_rr_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
NULL, /* RR Initialisation Request */
@@ -9980,7 +9984,7 @@ static void (*dtap_msg_rr_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset
NULL, /* NONE */
};
-#define NUM_GSM_DTAP_MSG_CC (sizeof(gsm_dtap_msg_cc_strings)/sizeof(value_string))
+#define NUM_GSM_DTAP_MSG_CC (sizeof(gsm_a_dtap_msg_cc_strings)/sizeof(value_string))
static gint ett_gsm_dtap_msg_cc[NUM_GSM_DTAP_MSG_CC];
static void (*dtap_msg_cc_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
dtap_cc_alerting, /* Alerting */
@@ -10021,7 +10025,7 @@ static void (*dtap_msg_cc_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset
NULL, /* NONE */
};
-#define NUM_GSM_DTAP_MSG_GMM (sizeof(gsm_dtap_msg_gmm_strings)/sizeof(value_string))
+#define NUM_GSM_DTAP_MSG_GMM (sizeof(gsm_a_dtap_msg_gmm_strings)/sizeof(value_string))
static gint ett_gsm_dtap_msg_gmm[NUM_GSM_DTAP_MSG_GMM];
static void (*dtap_msg_gmm_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
NULL, /* Attach Request */
@@ -10050,7 +10054,7 @@ static void (*dtap_msg_gmm_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offse
NULL, /* NONE */
};
-#define NUM_GSM_DTAP_MSG_SMS (sizeof(gsm_dtap_msg_sms_strings)/sizeof(value_string))
+#define NUM_GSM_DTAP_MSG_SMS (sizeof(gsm_a_dtap_msg_sms_strings)/sizeof(value_string))
static gint ett_gsm_dtap_msg_sms[NUM_GSM_DTAP_MSG_SMS];
static void (*dtap_msg_sms_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
dtap_sms_cp_data, /* CP-DATA */
@@ -10059,7 +10063,7 @@ static void (*dtap_msg_sms_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offse
NULL, /* NONE */
};
-#define NUM_GSM_DTAP_MSG_SM (sizeof(gsm_dtap_msg_sm_strings)/sizeof(value_string))
+#define NUM_GSM_DTAP_MSG_SM (sizeof(gsm_a_dtap_msg_sm_strings)/sizeof(value_string))
static gint ett_gsm_dtap_msg_sm[NUM_GSM_DTAP_MSG_SM];
static void (*dtap_msg_sm_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
NULL, /* Activate PDP Context Request */
@@ -10086,7 +10090,7 @@ static void (*dtap_msg_sm_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset
NULL, /* NONE */
};
-#define NUM_GSM_DTAP_MSG_SS (sizeof(gsm_dtap_msg_ss_strings)/sizeof(value_string))
+#define NUM_GSM_DTAP_MSG_SS (sizeof(gsm_a_dtap_msg_ss_strings)/sizeof(value_string))
static gint ett_gsm_dtap_msg_ss[NUM_GSM_DTAP_MSG_SS];
static void (*dtap_msg_ss_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
dtap_cc_release_complete, /* Release Complete */
@@ -10209,6 +10213,9 @@ dissect_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void
dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
+ static gsm_a_tap_rec_t tap_rec[4];
+ static gsm_a_tap_rec_t *tap_p;
+ static int tap_current=0;
guint8 oct;
guint32 offset, saved_offset;
guint32 len;
@@ -10224,13 +10231,15 @@ dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/*
- * In the interest of speed, if "tree" is NULL, don't do any work
- * not necessary to generate protocol tree items.
+ * set tap record pointer
*/
- if (!tree)
+ tap_current++;
+ if (tap_current == 4)
{
- return;
+ tap_current = 0;
}
+ tap_p = &tap_rec[tap_current];
+
offset = 0;
saved_offset = offset;
@@ -10245,7 +10254,7 @@ dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
oct = tvb_get_guint8(tvb, offset++);
- str = my_match_strval((guint32) oct, gsm_bssmap_msg_strings, &idx);
+ str = my_match_strval((guint32) oct, gsm_a_bssmap_msg_strings, &idx);
/*
* create the protocol tree
@@ -10280,6 +10289,11 @@ dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint_format(bssmap_tree, hf_gsm_a_bssmap_msg_type,
tvb, saved_offset, 1, oct, "Message Type");
+ tap_p->pdu_type = BSSAP_PDU_TYPE_BSSMAP;
+ tap_p->message_type = oct;
+
+ tap_queue_packet(gsm_a_tap, pinfo, tap_p);
+
if (str == NULL) return;
if ((len - offset) <= 0) return;
@@ -10303,22 +10317,26 @@ dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void
dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- void (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len);
- guint8 oct;
- guint8 pd;
- guint32 offset;
- guint32 len;
- guint32 oct_1, oct_2;
- gint idx;
- proto_item *dtap_item = NULL;
- proto_tree *dtap_tree = NULL;
- proto_item *oct_1_item = NULL;
- proto_tree *pd_tree = NULL;
- gchar *msg_str;
- const gchar *str;
- gint ett_tree;
- gint ti;
- int hf_idx;
+ static gsm_a_tap_rec_t tap_rec[4];
+ static gsm_a_tap_rec_t *tap_p;
+ static int tap_current=0;
+ void (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len);
+ guint8 oct;
+ guint8 pd;
+ guint32 offset;
+ guint32 len;
+ guint32 oct_1, oct_2;
+ gint idx;
+ proto_item *dtap_item = NULL;
+ proto_tree *dtap_tree = NULL;
+ proto_item *oct_1_item = NULL;
+ proto_tree *pd_tree = NULL;
+ gchar *msg_str;
+ const gchar *str;
+ gint ett_tree;
+ gint ti;
+ int hf_idx;
+ gboolean nsd;
len = tvb_length(tvb);
@@ -10338,13 +10356,15 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/*
- * In the interest of speed, if "tree" is NULL, don't do any work
- * not necessary to generate protocol tree items.
+ * set tap record pointer
*/
- if (!tree)
+ tap_current++;
+ if (tap_current == 4)
{
- return;
+ tap_current = 0;
}
+ tap_p = &tap_rec[tap_current];
+
offset = 0;
oct_2 = 0;
@@ -10375,6 +10395,7 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ett_tree = -1;
hf_idx = -1;
msg_fcn = NULL;
+ nsd = FALSE;
/*
* octet 1
@@ -10382,41 +10403,43 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (pd)
{
case 3:
- str = pd_str[pd];
- msg_str = my_match_strval((guint32) (oct & DTAP_CC_IEI_MASK), gsm_dtap_msg_cc_strings, &idx);
+ str = gsm_a_pd_str[pd];
+ msg_str = my_match_strval((guint32) (oct & DTAP_CC_IEI_MASK), gsm_a_dtap_msg_cc_strings, &idx);
ett_tree = ett_gsm_dtap_msg_cc[idx];
hf_idx = hf_gsm_a_dtap_msg_cc_type;
msg_fcn = dtap_msg_cc_fcn[idx];
ti = (oct_1 & DTAP_TI_MASK) >> 4;
+ nsd = TRUE;
break;
case 5:
- str = pd_str[pd];
- msg_str = my_match_strval((guint32) (oct & DTAP_MM_IEI_MASK), gsm_dtap_msg_mm_strings, &idx);
+ str = gsm_a_pd_str[pd];
+ msg_str = my_match_strval((guint32) (oct & DTAP_MM_IEI_MASK), gsm_a_dtap_msg_mm_strings, &idx);
ett_tree = ett_gsm_dtap_msg_mm[idx];
hf_idx = hf_gsm_a_dtap_msg_mm_type;
msg_fcn = dtap_msg_mm_fcn[idx];
+ nsd = TRUE;
break;
case 6:
- str = pd_str[pd];
- msg_str = my_match_strval((guint32) (oct & DTAP_RR_IEI_MASK), gsm_dtap_msg_rr_strings, &idx);
+ str = gsm_a_pd_str[pd];
+ msg_str = my_match_strval((guint32) (oct & DTAP_RR_IEI_MASK), gsm_a_dtap_msg_rr_strings, &idx);
ett_tree = ett_gsm_dtap_msg_rr[idx];
hf_idx = hf_gsm_a_dtap_msg_rr_type;
msg_fcn = dtap_msg_rr_fcn[idx];
break;
case 8:
- str = pd_str[pd];
- msg_str = my_match_strval((guint32) (oct & DTAP_GMM_IEI_MASK), gsm_dtap_msg_gmm_strings, &idx);
+ str = gsm_a_pd_str[pd];
+ msg_str = my_match_strval((guint32) (oct & DTAP_GMM_IEI_MASK), gsm_a_dtap_msg_gmm_strings, &idx);
ett_tree = ett_gsm_dtap_msg_gmm[idx];
hf_idx = hf_gsm_a_dtap_msg_gmm_type;
msg_fcn = dtap_msg_gmm_fcn[idx];
break;
case 9:
- str = pd_str[pd];
- msg_str = my_match_strval((guint32) (oct & DTAP_SMS_IEI_MASK), gsm_dtap_msg_sms_strings, &idx);
+ str = gsm_a_pd_str[pd];
+ msg_str = my_match_strval((guint32) (oct & DTAP_SMS_IEI_MASK), gsm_a_dtap_msg_sms_strings, &idx);
ett_tree = ett_gsm_dtap_msg_sms[idx];
hf_idx = hf_gsm_a_dtap_msg_sms_type;
msg_fcn = dtap_msg_sms_fcn[idx];
@@ -10424,8 +10447,8 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 10:
- str = pd_str[pd];
- msg_str = my_match_strval((guint32) (oct & DTAP_SM_IEI_MASK), gsm_dtap_msg_sm_strings, &idx);
+ str = gsm_a_pd_str[pd];
+ msg_str = my_match_strval((guint32) (oct & DTAP_SM_IEI_MASK), gsm_a_dtap_msg_sm_strings, &idx);
ett_tree = ett_gsm_dtap_msg_sm[idx];
hf_idx = hf_gsm_a_dtap_msg_sm_type;
msg_fcn = dtap_msg_sm_fcn[idx];
@@ -10433,16 +10456,17 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 11:
- str = pd_str[pd];
- msg_str = my_match_strval((guint32) (oct & DTAP_SS_IEI_MASK), gsm_dtap_msg_ss_strings, &idx);
+ str = gsm_a_pd_str[pd];
+ msg_str = my_match_strval((guint32) (oct & DTAP_SS_IEI_MASK), gsm_a_dtap_msg_ss_strings, &idx);
ett_tree = ett_gsm_dtap_msg_ss[idx];
hf_idx = hf_gsm_a_dtap_msg_ss_type;
msg_fcn = dtap_msg_ss_fcn[idx];
ti = (oct_1 & DTAP_TI_MASK) >> 4;
+ nsd = TRUE;
break;
default:
- str = pd_str[pd];
+ str = gsm_a_pd_str[pd];
break;
}
@@ -10544,9 +10568,13 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/*
- * XXX
* N(SD)
*/
+ if ((pinfo->p2p_dir == P2P_DIR_RECV) &&
+ nsd)
+ {
+ /* XXX */
+ }
/*
* add DTAP message name
@@ -10557,6 +10585,12 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset++;
+ tap_p->pdu_type = BSSAP_PDU_TYPE_DTAP;
+ tap_p->message_type = (nsd ? (oct & 0x3f) : oct);
+ tap_p->protocol_disc = pd;
+
+ tap_queue_packet(gsm_a_tap, pinfo, tap_p);
+
if (msg_str == NULL) return;
if ((len - offset) <= 0) return;
@@ -10590,42 +10624,42 @@ proto_register_gsm_a(void)
{
{ &hf_gsm_a_bssmap_msg_type,
{ "BSSMAP Message Type", "gsm_a.bssmap_msgtype",
- FT_UINT8, BASE_HEX, VALS(gsm_bssmap_msg_strings), 0x0,
+ FT_UINT8, BASE_HEX, VALS(gsm_a_bssmap_msg_strings), 0x0,
"", HFILL }
},
{ &hf_gsm_a_dtap_msg_mm_type,
{ "DTAP Mobility Management Message Type", "gsm_a.dtap_msg_mm_type",
- FT_UINT8, BASE_HEX, VALS(gsm_dtap_msg_mm_strings), 0x0,
+ FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_mm_strings), 0x0,
"", HFILL }
},
{ &hf_gsm_a_dtap_msg_rr_type,
{ "DTAP Radio Resources Management Message Type", "gsm_a.dtap_msg_rr_type",
- FT_UINT8, BASE_HEX, VALS(gsm_dtap_msg_rr_strings), 0x0,
+ FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_rr_strings), 0x0,
"", HFILL }
},
{ &hf_gsm_a_dtap_msg_cc_type,
{ "DTAP Call Control Message Type", "gsm_a.dtap_msg_cc_type",
- FT_UINT8, BASE_HEX, VALS(gsm_dtap_msg_cc_strings), 0x0,
+ FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_cc_strings), 0x0,
"", HFILL }
},
{ &hf_gsm_a_dtap_msg_gmm_type,
{ "DTAP GPRS Mobility Management Message Type", "gsm_a.dtap_msg_gmm_type",
- FT_UINT8, BASE_HEX, VALS(gsm_dtap_msg_gmm_strings), 0x0,
+ FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_gmm_strings), 0x0,
"", HFILL }
},
{ &hf_gsm_a_dtap_msg_sms_type,
{ "DTAP Short Message Service Message Type", "gsm_a.dtap_msg_sms_type",
- FT_UINT8, BASE_HEX, VALS(gsm_dtap_msg_sms_strings), 0x0,
+ FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_sms_strings), 0x0,
"", HFILL }
},
{ &hf_gsm_a_dtap_msg_sm_type,
{ "DTAP GPRS Session Management Message Type", "gsm_a.dtap_msg_sm_type",
- FT_UINT8, BASE_HEX, VALS(gsm_dtap_msg_sm_strings), 0x0,
+ FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_sm_strings), 0x0,
"", HFILL }
},
{ &hf_gsm_a_dtap_msg_ss_type,
{ "DTAP Non call Supplementary Service Message Type", "gsm_a.dtap_msg_ss_type",
- FT_UINT8, BASE_HEX, VALS(gsm_dtap_msg_ss_strings), 0x0,
+ FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_ss_strings), 0x0,
"", HFILL }
},
{ &hf_gsm_a_rp_msg_type,
@@ -10817,6 +10851,8 @@ proto_register_gsm_a(void)
FT_UINT8, BASE_DEC);
proto_register_subtree_array(ett, array_length(ett));
+
+ gsm_a_tap = register_tap("gsm_a");
}
diff --git a/packet-gsm_a.h b/packet-gsm_a.h
new file mode 100644
index 0000000000..201e186679
--- /dev/null
+++ b/packet-gsm_a.h
@@ -0,0 +1,75 @@
+/* packet-gsm_a.h
+ *
+ * $Id: packet-gsm_a.h,v 1.1 2003/12/09 18:49:30 guy Exp $
+ *
+ * Copyright 2003, Michael Lum <mlum [AT] telostech.com>,
+ * In association with Telos Technology Inc.
+ *
+ * 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 enum must be kept in-sync with 'gsm_a_pd_str'
+ * it is used as an index into the array
+ */
+typedef enum
+{
+ PD_GCC = 0,
+ PD_BCC,
+ PD_RSVD_1,
+ PD_CC,
+ PD_GTTP,
+ PD_MM,
+ PD_RR,
+ PD_UNK_1,
+ PD_GMM,
+ PD_SMS,
+ PD_SM,
+ PD_SS,
+ PD_LCS,
+ PD_UNK_2,
+ PD_RSVD_EXT,
+ PD_RSVD_TEST
+}
+gsm_a_pd_str_e;
+
+typedef struct _gsm_a_tap_rec_t {
+ /*
+ * value from packet-bssap.h
+ */
+ guint8 pdu_type;
+ guint8 message_type;
+ gsm_a_pd_str_e protocol_disc;
+} gsm_a_tap_rec_t;
+
+
+/*
+ * the following allows TAP code access to the messages
+ * without having to duplicate it
+ */
+extern const value_string gsm_a_bssmap_msg_strings[];
+extern const value_string gsm_a_dtap_msg_mm_strings[];
+extern const value_string gsm_a_dtap_msg_rr_strings[];
+extern const value_string gsm_a_dtap_msg_cc_strings[];
+extern const value_string gsm_a_dtap_msg_gmm_strings[];
+extern const value_string gsm_a_dtap_msg_sms_strings[];
+extern const value_string gsm_a_dtap_msg_sm_strings[];
+extern const value_string gsm_a_dtap_msg_ss_strings[];
+
+extern const gchar *gsm_a_pd_str[];
diff --git a/tap-ansi_astat.c b/tap-ansi_astat.c
index 94b498acca..7091d6fd85 100644
--- a/tap-ansi_astat.c
+++ b/tap-ansi_astat.c
@@ -3,7 +3,7 @@
* Copyright 2003, Michael Lum <mlum [AT] telostech.com>
* In association with Telos Technology Inc.
*
- * $Id: tap-ansi_astat.c,v 1.2 2003/12/03 23:46:22 guy Exp $
+ * $Id: tap-ansi_astat.c,v 1.3 2003/12/09 18:49:30 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -106,7 +106,7 @@ ansi_a_stat_draw(
if (stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value] > 0)
{
printf("0x%02x %-50s%d\n",
- i,
+ ansi_a_ios401_bsmap_strings[i].value,
ansi_a_ios401_bsmap_strings[i].strptr,
stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value]);
}
@@ -123,7 +123,7 @@ ansi_a_stat_draw(
if (stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value] > 0)
{
printf("0x%02x %-50s%d\n",
- i,
+ ansi_a_ios401_dtap_strings[i].value,
ansi_a_ios401_dtap_strings[i].strptr,
stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value]);
}
diff --git a/tap-gsm_astat.c b/tap-gsm_astat.c
new file mode 100644
index 0000000000..a19229acbc
--- /dev/null
+++ b/tap-gsm_astat.c
@@ -0,0 +1,307 @@
+/* tap-gsm_astat.c
+ *
+ * Copyright 2003, Michael Lum <mlum [AT] telostech.com>
+ * In association with Telos Technology Inc.
+ *
+ * $Id: tap-gsm_astat.c,v 1.1 2003/12/09 18:49:30 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);
+}