3 * Copyright 2003, Michael Lum <mlum [AT] telostech.com>
4 * In association with Telos Technology Inc.
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@ethereal.com>
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 GSM 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/dissectors/packet-bssap.h>
46 #include <epan/dissectors/packet-gsm_a.h>
50 typedef struct _gsm_a_stat_t {
51 int bssmap_message_type[0xff];
52 int dtap_mm_message_type[0xff];
53 int dtap_rr_message_type[0xff];
54 int dtap_cc_message_type[0xff];
55 int dtap_gmm_message_type[0xff];
56 int dtap_sms_message_type[0xff];
57 int dtap_sm_message_type[0xff];
58 int dtap_ss_message_type[0xff];
65 packet_info *pinfo _U_,
66 epan_dissect_t *edt _U_,
69 gsm_a_stat_t *stat_p = tapdata;
70 const gsm_a_tap_rec_t *tap_p = data;
72 switch (tap_p->pdu_type)
74 case BSSAP_PDU_TYPE_BSSMAP:
75 stat_p->bssmap_message_type[tap_p->message_type]++;
78 case BSSAP_PDU_TYPE_DTAP:
79 switch (tap_p->protocol_disc)
82 stat_p->dtap_cc_message_type[tap_p->message_type]++;
85 stat_p->dtap_mm_message_type[tap_p->message_type]++;
88 stat_p->dtap_rr_message_type[tap_p->message_type]++;
91 stat_p->dtap_gmm_message_type[tap_p->message_type]++;
94 stat_p->dtap_sms_message_type[tap_p->message_type]++;
97 stat_p->dtap_sm_message_type[tap_p->message_type]++;
100 stat_p->dtap_ss_message_type[tap_p->message_type]++;
112 * unknown PDU type !!!
125 gsm_a_stat_t *stat_p = tapdata;
130 printf("=========== GS=M A-i/f Statistics ============================\n");
132 printf("Message (ID)Type Number\n");
135 while (gsm_a_bssmap_msg_strings[i].strptr)
137 if (stat_p->bssmap_message_type[gsm_a_bssmap_msg_strings[i].value] > 0)
139 printf("0x%02x %-50s%d\n",
140 gsm_a_bssmap_msg_strings[i].value,
141 gsm_a_bssmap_msg_strings[i].strptr,
142 stat_p->bssmap_message_type[gsm_a_bssmap_msg_strings[i].value]);
148 printf("\nDTAP %s\n", gsm_a_pd_str[PD_MM]);
149 printf("Message (ID)Type Number\n");
152 while (gsm_a_dtap_msg_mm_strings[i].strptr)
154 if (stat_p->dtap_mm_message_type[gsm_a_dtap_msg_mm_strings[i].value] > 0)
156 printf("0x%02x %-50s%d\n",
157 gsm_a_dtap_msg_mm_strings[i].value,
158 gsm_a_dtap_msg_mm_strings[i].strptr,
159 stat_p->dtap_mm_message_type[gsm_a_dtap_msg_mm_strings[i].value]);
165 printf("\nDTAP %s\n", gsm_a_pd_str[PD_RR]);
166 printf("Message (ID)Type Number\n");
169 while (gsm_a_dtap_msg_rr_strings[i].strptr)
171 if (stat_p->dtap_rr_message_type[gsm_a_dtap_msg_rr_strings[i].value] > 0)
173 printf("0x%02x %-50s%d\n",
174 gsm_a_dtap_msg_rr_strings[i].value,
175 gsm_a_dtap_msg_rr_strings[i].strptr,
176 stat_p->dtap_rr_message_type[gsm_a_dtap_msg_rr_strings[i].value]);
182 printf("\nDTAP %s\n", gsm_a_pd_str[PD_CC]);
183 printf("Message (ID)Type Number\n");
186 while (gsm_a_dtap_msg_cc_strings[i].strptr)
188 if (stat_p->dtap_cc_message_type[gsm_a_dtap_msg_cc_strings[i].value] > 0)
190 printf("0x%02x %-50s%d\n",
191 gsm_a_dtap_msg_cc_strings[i].value,
192 gsm_a_dtap_msg_cc_strings[i].strptr,
193 stat_p->dtap_cc_message_type[gsm_a_dtap_msg_cc_strings[i].value]);
199 printf("\nDTAP %s\n", gsm_a_pd_str[PD_GMM]);
200 printf("Message (ID)Type Number\n");
203 while (gsm_a_dtap_msg_gmm_strings[i].strptr)
205 if (stat_p->dtap_gmm_message_type[gsm_a_dtap_msg_gmm_strings[i].value] > 0)
207 printf("0x%02x %-50s%d\n",
208 gsm_a_dtap_msg_gmm_strings[i].value,
209 gsm_a_dtap_msg_gmm_strings[i].strptr,
210 stat_p->dtap_gmm_message_type[gsm_a_dtap_msg_gmm_strings[i].value]);
216 printf("\nDTAP %s\n", gsm_a_pd_str[PD_SMS]);
217 printf("Message (ID)Type Number\n");
220 while (gsm_a_dtap_msg_sms_strings[i].strptr)
222 if (stat_p->dtap_sms_message_type[gsm_a_dtap_msg_sms_strings[i].value] > 0)
224 printf("0x%02x %-50s%d\n",
225 gsm_a_dtap_msg_sms_strings[i].value,
226 gsm_a_dtap_msg_sms_strings[i].strptr,
227 stat_p->dtap_sms_message_type[gsm_a_dtap_msg_sms_strings[i].value]);
233 printf("\nDTAP %s\n", gsm_a_pd_str[PD_SM]);
234 printf("Message (ID)Type Number\n");
237 while (gsm_a_dtap_msg_sm_strings[i].strptr)
239 if (stat_p->dtap_sm_message_type[gsm_a_dtap_msg_sm_strings[i].value] > 0)
241 printf("0x%02x %-50s%d\n",
242 gsm_a_dtap_msg_sm_strings[i].value,
243 gsm_a_dtap_msg_sm_strings[i].strptr,
244 stat_p->dtap_sm_message_type[gsm_a_dtap_msg_sm_strings[i].value]);
250 printf("\nDTAP %s\n", gsm_a_pd_str[PD_SS]);
251 printf("Message (ID)Type Number\n");
254 while (gsm_a_dtap_msg_ss_strings[i].strptr)
256 if (stat_p->dtap_ss_message_type[gsm_a_dtap_msg_ss_strings[i].value] > 0)
258 printf("0x%02x %-50s%d\n",
259 gsm_a_dtap_msg_ss_strings[i].value,
260 gsm_a_dtap_msg_ss_strings[i].strptr,
261 stat_p->dtap_ss_message_type[gsm_a_dtap_msg_ss_strings[i].value]);
267 printf("==============================================================\n");
272 gsm_a_stat_init(char *optarg)
274 gsm_a_stat_t *stat_p;
280 stat_p = g_malloc(sizeof(gsm_a_stat_t));
282 memset(stat_p, 0, sizeof(gsm_a_stat_t));
285 register_tap_listener("gsm_a", stat_p, NULL,
293 g_string_free(err_p, TRUE);
301 register_tap_listener_gsm_astat(void)
303 register_tap_listener_cmd_arg("gsm_a,", gsm_a_stat_init);