aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.nmake3
-rw-r--r--packet-ansi_a.c102
-rw-r--r--packet-ansi_a.h33
-rw-r--r--packet-bssap.c17
-rw-r--r--tap-ansi_astat.c269
6 files changed, 380 insertions, 48 deletions
diff --git a/Makefile.am b/Makefile.am
index 14b02fdc3f..90f88f3f17 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
-# $Id: Makefile.am,v 1.660 2003/11/25 08:10:55 guy Exp $
+# $Id: Makefile.am,v 1.661 2003/12/01 23:05:08 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
@@ -606,6 +606,7 @@ noinst_HEADERS = \
packet-afs-macros.h \
packet-afs-register-info.h \
packet-afs.h \
+ packet-ansi_a.h \
packet-arcnet.h \
packet-arp.h \
packet-atalk.h \
@@ -931,6 +932,7 @@ ethereal_LDADD = \
@PCAP_LIBS@ @GTK_LIBS@ @ADNS_LIBS@
TETHEREAL_TAP_SRC = \
+ tap-ansi_astat.c \
tap-bootpstat.c \
tap-dcerpcstat.c \
tap-h225counter.c \
diff --git a/Makefile.nmake b/Makefile.nmake
index 2464bc3f9b..31c47e540b 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.367 2003/11/25 08:10:56 guy Exp $
+# $Id: Makefile.nmake,v 1.368 2003/12/01 23:05:08 guy Exp $
include config.nmake
include <win32.mak>
@@ -419,6 +419,7 @@ DISSECTOR_SRC = \
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
TETHEREAL_TAP_SRC = \
+ tap-ansi_astat.c \
tap-bootpstat.c \
tap-dcerpcstat.c \
tap-h225counter.c \
diff --git a/packet-ansi_a.c b/packet-ansi_a.c
index 1f9643ac9f..9052155c0e 100644
--- a/packet-ansi_a.c
+++ b/packet-ansi_a.c
@@ -10,7 +10,7 @@
* 2000 Access Network Interfaces
* 3GPP2 A.S0001-1 TIA/EIA-2001
*
- * $Id: packet-ansi_a.c,v 1.10 2003/11/16 23:17:16 guy Exp $
+ * $Id: packet-ansi_a.c,v 1.11 2003/12/01 23:05:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -41,8 +41,11 @@
#include "epan/packet.h"
#include "prefs.h"
+#include "tap.h"
#include "packet-bssap.h"
+#include "packet-ansi_a.h"
+
/* PROTOTYPES/FORWARDS */
@@ -315,6 +318,8 @@ static gchar *cell_disc_str[] = {
static int proto_a_bsmap = -1;
static int proto_a_dtap = -1;
+static int ansi_a_tap = -1;
+
static int hf_ansi_a_none = -1;
static int hf_ansi_a_bsmap_msgtype = -1;
static int hf_ansi_a_dtap_msgtype = -1;
@@ -7971,13 +7976,17 @@ static void (*dtap_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, g
static void
dissect_bsmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- guint8 oct;
- guint32 offset, saved_offset;
- guint32 len;
- gint idx;
- proto_item *bsmap_item = NULL;
- proto_tree *bsmap_tree = NULL;
- gchar *str;
+ static ansi_a_tap_rec_t tap_rec[4];
+ static ansi_a_tap_rec_t *tap_p;
+ static int tap_current=0;
+ guint8 oct;
+ guint32 offset, saved_offset;
+ guint32 len;
+ gint idx;
+ proto_item *bsmap_item = NULL;
+ proto_tree *bsmap_tree = NULL;
+ gchar *msg_str;
+
if (check_col(pinfo->cinfo, COL_INFO))
{
@@ -7985,13 +7994,15 @@ dissect_bsmap(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;
@@ -8006,12 +8017,12 @@ dissect_bsmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
oct = tvb_get_guint8(tvb, offset++);
- str = my_match_strval((guint32) oct, ansi_bsmap_strings, &idx);
+ msg_str = my_match_strval((guint32) oct, ansi_bsmap_strings, &idx);
/*
* create the a protocol tree
*/
- if (str == NULL)
+ if (msg_str == NULL)
{
bsmap_item =
proto_tree_add_protocol_format(tree, proto_a_bsmap, tvb, 0, len,
@@ -8025,13 +8036,13 @@ dissect_bsmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
bsmap_item =
proto_tree_add_protocol_format(tree, proto_a_bsmap, tvb, 0, -1,
"ANSI A-I/F BSMAP - %s",
- str);
+ msg_str);
bsmap_tree = proto_item_add_subtree(bsmap_item, ett_bsmap_msg[idx]);
if (check_col(pinfo->cinfo, COL_INFO))
{
- col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", str);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", msg_str);
}
}
@@ -8041,7 +8052,12 @@ dissect_bsmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint_format(bsmap_tree, hf_ansi_a_bsmap_msgtype,
tvb, saved_offset, 1, oct, "Message Type");
- if (str == NULL) return;
+ tap_p->pdu_type = BSSAP_PDU_TYPE_BSMAP;
+ tap_p->message_type = oct;
+
+ tap_queue_packet(ansi_a_tap, pinfo, tap_p);
+
+ if (msg_str == NULL) return;
if ((len - offset) <= 0) return;
@@ -8063,16 +8079,21 @@ dissect_bsmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void
dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- guint8 oct;
- guint32 offset, saved_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 *oct_1_tree = NULL;
- gchar *str;
+ static ansi_a_tap_rec_t tap_rec[4];
+ static ansi_a_tap_rec_t *tap_p;
+ static int tap_current=0;
+ guint8 oct;
+ guint32 offset, saved_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 *oct_1_tree = NULL;
+ gchar *msg_str;
+ gchar *str;
+
len = tvb_length(tvb);
@@ -8091,13 +8112,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;
saved_offset = offset;
@@ -8117,12 +8140,12 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
saved_offset = offset;
oct = tvb_get_guint8(tvb, offset++);
- str = my_match_strval((guint32) oct, ansi_dtap_strings, &idx);
+ msg_str = my_match_strval((guint32) oct, ansi_dtap_strings, &idx);
/*
* create the a protocol tree
*/
- if (str == NULL)
+ if (msg_str == NULL)
{
dtap_item =
proto_tree_add_protocol_format(tree, proto_a_dtap, tvb, 0, len,
@@ -8136,13 +8159,13 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dtap_item =
proto_tree_add_protocol_format(tree, proto_a_dtap, tvb, 0, -1,
"ANSI A-I/F DTAP - %s",
- str);
+ msg_str);
dtap_tree = proto_item_add_subtree(dtap_item, ett_dtap_msg[idx]);
if (check_col(pinfo->cinfo, COL_INFO))
{
- col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", str);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", msg_str);
}
}
@@ -8224,7 +8247,12 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb, saved_offset, 1, oct,
"Message Type");
- if (str == NULL) return;
+ tap_p->pdu_type = BSSAP_PDU_TYPE_DTAP;
+ tap_p->message_type = oct;
+
+ tap_queue_packet(ansi_a_tap, pinfo, tap_p);
+
+ if (msg_str == NULL) return;
if ((len - offset) <= 0) return;
@@ -8421,6 +8449,8 @@ proto_register_ansi_a(void)
proto_register_subtree_array(ett, ett_len / sizeof(gint *));
+ ansi_a_tap = register_tap("ansi_a");
+
/*
* setup for preferences
*/
diff --git a/packet-ansi_a.h b/packet-ansi_a.h
new file mode 100644
index 0000000000..37c911d54d
--- /dev/null
+++ b/packet-ansi_a.h
@@ -0,0 +1,33 @@
+/* packet-ansi_a.h
+ *
+ * $Id: packet-ansi_a.h,v 1.1 2003/12/01 23:05:08 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.
+ */
+
+typedef struct _ansi_a_tap_rec_t {
+ /*
+ * value from packet-bssap.h
+ */
+ guint8 pdu_type;
+ guint8 message_type;
+} ansi_a_tap_rec_t;
diff --git a/packet-bssap.c b/packet-bssap.c
index 8f9c1a50b1..f778018af9 100644
--- a/packet-bssap.c
+++ b/packet-bssap.c
@@ -7,7 +7,7 @@
* Copyright 2003, Michael Lum <mlum [AT] telostech.com>
* In association with Telos Technology Inc.
*
- * $Id: packet-bssap.c,v 1.3 2003/10/28 18:08:52 guy Exp $
+ * $Id: packet-bssap.c,v 1.4 2003/12/01 23:05:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -356,15 +356,12 @@ dissect_bssap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, ((bssap_or_bsap_global == BSSAP) ? "BSSAP" : "BSAP"));
}
- if (tree)
- {
- /*
- * create the bssap protocol tree
- */
- proto_tree_add_item_hidden(tree, proto_bssap, tvb, 0, -1, FALSE);
- bssap_item = proto_tree_add_text(tree, tvb, 0, -1, (bssap_or_bsap_global == BSSAP) ? "BSSAP" : "BSAP");
- bssap_tree = proto_item_add_subtree(bssap_item, ett_bssap);
- }
+ /*
+ * create the bssap protocol tree
+ */
+ proto_tree_add_item_hidden(tree, proto_bssap, tvb, 0, -1, FALSE);
+ bssap_item = proto_tree_add_text(tree, tvb, 0, -1, (bssap_or_bsap_global == BSSAP) ? "BSSAP" : "BSAP");
+ bssap_tree = proto_item_add_subtree(bssap_item, ett_bssap);
/* dissect the message */
diff --git a/tap-ansi_astat.c b/tap-ansi_astat.c
new file mode 100644
index 0000000000..eb1e962d81
--- /dev/null
+++ b/tap-ansi_astat.c
@@ -0,0 +1,269 @@
+/* tap-ansi_astat.c
+ *
+ * Copyright 2003, Michael Lum <mlum [AT] telostech.com>
+ * In association with Telos Technology Inc.
+ *
+ * $Id: tap-ansi_astat.c,v 1.1 2003/12/01 23:05:09 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 ANSI 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-ansi_a.h"
+#include "register.h"
+
+
+/*
+ * taken from packet-ansi_a.c
+ * TODO:
+ * Have these moved from packet-ansi_a.c to packet-ansi_a.h
+ * and then we would automatically get them!
+ */
+static const value_string ansi_bsmap_strings[] = {
+ { 0x69, "Additional Service Notification" },
+ { 0x65, "ADDS Page" },
+ { 0x66, "ADDS Page Ack" },
+ { 0x67, "ADDS Transfer" },
+ { 0x68, "ADDS Transfer Ack" },
+ { 0x02, "Assignment Complete" },
+ { 0x03, "Assignment Failure" },
+ { 0x01, "Assignment Request" },
+ { 0x45, "Authentication Request" },
+ { 0x46, "Authentication Response" },
+ { 0x48, "Base Station Challenge" },
+ { 0x49, "Base Station Challenge Response" },
+ { 0x40, "Block" },
+ { 0x41, "Block Acknowledge" },
+ { 0x09, "BS Service Request" },
+ { 0x0A, "BS Service Response" },
+ { 0x20, "Clear Command" },
+ { 0x21, "Clear Complete" },
+ { 0x22, "Clear Request" },
+ { 0x57, "Complete Layer 3 Information" },
+ { 0x60, "Feature Notification" },
+ { 0x61, "Feature Notification Ack" },
+ { 0x13, "Handoff Command" },
+ { 0x15, "Handoff Commenced" },
+ { 0x14, "Handoff Complete" },
+ { 0x16, "Handoff Failure" },
+ { 0x17, "Handoff Performed" },
+ { 0x10, "Handoff Request" },
+ { 0x12, "Handoff Request Acknowledge" },
+ { 0x11, "Handoff Required" },
+ { 0x1A, "Handoff Required Reject" },
+ { 0x6C, "PACA Command" },
+ { 0x6D, "PACA Command Ack" },
+ { 0x6E, "PACA Update" },
+ { 0x6F, "PACA Update Ack" },
+ { 0x52, "Paging Request" },
+ { 0x53, "Privacy Mode Command" },
+ { 0x55, "Privacy Mode Complete" },
+ { 0x23, "Radio Measurements for Position Request" },
+ { 0x25, "Radio Measurements for Position Response" },
+ { 0x56, "Rejection" },
+ { 0x05, "Registration Request" },
+ { 0x30, "Reset" },
+ { 0x31, "Reset Acknowledge" },
+ { 0x34, "Reset Circuit" },
+ { 0x35, "Reset Circuit Acknowledge" },
+ { 0x47, "SSD Update Request" },
+ { 0x4A, "SSD Update Response" },
+ { 0x6A, "Status Request" },
+ { 0x6B, "Status Response" },
+ { 0x39, "Transcoder Control Acknowledge" },
+ { 0x38, "Transcoder Control Request" },
+ { 0x42, "Unblock" },
+ { 0x43, "Unblock Acknowledge" },
+ { 0x0B, "User Zone Reject" },
+ { 0x04, "User Zone Update" },
+ { 0, NULL },
+};
+
+static const value_string ansi_dtap_strings[] = {
+ { 0x62, "Additional Service Request" },
+ { 0x53, "ADDS Deliver" },
+ { 0x54, "ADDS Deliver Ack" },
+ { 0x26, "Alert With Information" },
+ { 0x45, "Authentication Request" },
+ { 0x46, "Authentication Response" },
+ { 0x48, "Base Station Challenge" },
+ { 0x49, "Base Station Challenge Response" },
+ { 0x24, "CM Service Request" },
+ { 0x25, "CM Service Request Continuation" },
+ { 0x07, "Connect" },
+ { 0x10, "Flash with Information" },
+ { 0x50, "Flash with Information Ack" },
+ { 0x02, "Location Updating Accept" },
+ { 0x04, "Location Updating Reject" },
+ { 0x08, "Location Updating Request" },
+ { 0x27, "Paging Response" },
+ { 0x2B, "Parameter Update Confirm" },
+ { 0x2C, "Parameter Update Request" },
+ { 0x56, "Rejection" },
+ { 0x03, "Progress" },
+ { 0x70, "Service Redirection" },
+ { 0x2E, "Service Release" },
+ { 0x2F, "Service Release Complete" },
+ { 0x47, "SSD Update Request" },
+ { 0x4A, "SSD Update Response" },
+ { 0x6A, "Status Request" },
+ { 0x6B, "Status Response" },
+ { 0x0B, "User Zone Reject" },
+ { 0x0C, "User Zone Update" },
+ { 0x0D, "User Zone Update Request" },
+ { 0, NULL },
+};
+
+#define ANSI_A_STAT_NUM_IOS401_BSMAP_MSG (sizeof(ansi_bsmap_strings)/sizeof(value_string))
+#define ANSI_A_STAT_NUM_IOS401_DTAP_MSG (sizeof(ansi_dtap_strings)/sizeof(value_string))
+
+typedef struct _ansi_a_stat_t {
+ int bsmap_message_type[0xff];
+ int dtap_message_type[0xff];
+} ansi_a_stat_t;
+
+
+static int
+ansi_a_stat_packet(
+ void *tapdata,
+ packet_info *pinfo,
+ epan_dissect_t *edt _U_,
+ void *data)
+{
+ ansi_a_stat_t *stat_p = tapdata;
+ ansi_a_tap_rec_t *tap_p = data;
+
+
+ pinfo = pinfo;
+
+ switch (tap_p->pdu_type)
+ {
+ case BSSAP_PDU_TYPE_BSMAP:
+ stat_p->bsmap_message_type[tap_p->message_type]++;
+ break;
+
+ case BSSAP_PDU_TYPE_DTAP:
+ stat_p->dtap_message_type[tap_p->message_type]++;
+ break;
+
+ default:
+ /*
+ * unknown PDU type !!!
+ */
+ return(0);
+ }
+
+ return(1);
+}
+
+
+static void
+ansi_a_stat_draw(
+ void *tapdata)
+{
+ ansi_a_stat_t *stat_p = tapdata;
+ guint8 i;
+
+
+ printf("\n");
+ printf("=========== ANSI A-i/f Statistics ============================\n");
+ printf("BSMAP\n");
+ printf("Message (ID)Type Number\n");
+
+ for (i=0; i < ANSI_A_STAT_NUM_IOS401_BSMAP_MSG; i++)
+ {
+ if (stat_p->bsmap_message_type[ansi_bsmap_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ i,
+ ansi_bsmap_strings[i].strptr,
+ stat_p->bsmap_message_type[ansi_bsmap_strings[i].value]);
+ }
+ }
+
+ printf("\nDTAP\n");
+ printf("Message (ID)Type Number\n");
+
+ for (i=0; i < ANSI_A_STAT_NUM_IOS401_DTAP_MSG; i++)
+ {
+ if (stat_p->dtap_message_type[ansi_dtap_strings[i].value] > 0)
+ {
+ printf("0x%02x %-50s%d\n",
+ i,
+ ansi_dtap_strings[i].strptr,
+ stat_p->dtap_message_type[ansi_dtap_strings[i].value]);
+ }
+ }
+
+ printf("==============================================================\n");
+}
+
+
+static void
+ansi_a_stat_init(char *optarg)
+{
+ ansi_a_stat_t *stat_p;
+ GString *err_p;
+
+
+ optarg = optarg;
+
+ stat_p = g_malloc(sizeof(ansi_a_stat_t));
+
+ memset(stat_p, 0, sizeof(ansi_a_stat_t));
+
+ err_p =
+ register_tap_listener("ansi_a", stat_p, NULL,
+ NULL,
+ ansi_a_stat_packet,
+ ansi_a_stat_draw);
+
+ if (err_p != NULL)
+ {
+ g_free(stat_p);
+ g_string_free(err_p, TRUE);
+
+ exit(1);
+ }
+}
+
+
+void
+register_tap_listener_ansi_astat(void)
+{
+ register_ethereal_tap("ansi_a,", ansi_a_stat_init);
+}