3 * Copyright 2003, Michael Lum <mlum [AT] telostech.com>
4 * In association with Telos Technology Inc.
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 * This TAP provides statistics for the ANSI A Interface:
37 #ifdef HAVE_SYS_TYPES_H
38 # include <sys/types.h>
42 #include "epan/packet_info.h"
43 #include "epan/value_string.h"
45 #include <epan/stat_cmd_args.h>
46 #include <epan/dissectors/packet-bssap.h>
47 #include <epan/dissectors/packet-ansi_a.h>
51 typedef struct _ansi_a_stat_t {
52 int bsmap_message_type[0xff];
53 int dtap_message_type[0xff];
60 packet_info *pinfo _U_,
61 epan_dissect_t *edt _U_,
64 ansi_a_stat_t *stat_p = tapdata;
65 const ansi_a_tap_rec_t *tap_p = data;
68 switch (tap_p->pdu_type)
70 case BSSAP_PDU_TYPE_BSMAP:
71 stat_p->bsmap_message_type[tap_p->message_type]++;
74 case BSSAP_PDU_TYPE_DTAP:
75 stat_p->dtap_message_type[tap_p->message_type]++;
80 * unknown PDU type !!!
93 ansi_a_stat_t *stat_p = tapdata;
98 printf("=========== ANSI A-i/f Statistics ============================\n");
100 printf("Message (ID)Type Number\n");
103 while (ansi_a_ios401_bsmap_strings[i].strptr)
105 if (stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value] > 0)
107 printf("0x%02x %-50s%d\n",
108 ansi_a_ios401_bsmap_strings[i].value,
109 ansi_a_ios401_bsmap_strings[i].strptr,
110 stat_p->bsmap_message_type[ansi_a_ios401_bsmap_strings[i].value]);
117 printf("Message (ID)Type Number\n");
120 while (ansi_a_ios401_dtap_strings[i].strptr)
122 if (stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value] > 0)
124 printf("0x%02x %-50s%d\n",
125 ansi_a_ios401_dtap_strings[i].value,
126 ansi_a_ios401_dtap_strings[i].strptr,
127 stat_p->dtap_message_type[ansi_a_ios401_dtap_strings[i].value]);
133 printf("==============================================================\n");
138 ansi_a_stat_init(const char *optarg _U_, void* userdata _U_)
140 ansi_a_stat_t *stat_p;
143 stat_p = g_malloc(sizeof(ansi_a_stat_t));
145 memset(stat_p, 0, sizeof(ansi_a_stat_t));
148 register_tap_listener("ansi_a", stat_p, NULL,
156 g_string_free(err_p, TRUE);
164 register_tap_listener_ansi_astat(void)
166 register_stat_cmd_arg("ansi_a,", ansi_a_stat_init,NULL);