From Kari Tiirikainen:

Req/resp tracking and service response time stats for GTP-C

svn path=/trunk/; revision=26361
This commit is contained in:
Anders Broman 2008-10-06 20:11:44 +00:00
parent 81633df2db
commit cee238507d
5 changed files with 5626 additions and 5046 deletions

View File

@ -585,6 +585,7 @@ DISSECTOR_SRC = \
packet-mip6.c \
packet-ms-mms.c \
packet-mmse.c \
packet-mos.c \
packet-mount.c \
packet-mp2t.c \
packet-mp4ves.c \
@ -974,6 +975,7 @@ DISSECTOR_INCLUDES = \
packet-gsm_map.h \
packet-gsm_sms.h \
packet-gssapi.h \
packet-gtp.h \
packet-h223.h \
packet-h225.h \
packet-h235.h \

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,118 @@
/* packet-gtp.h
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* 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.
*/
#ifndef __PACKET_GTP_H
#define __PACKET_GTP_H
/*structure used to track responses to requests using sequence number*/
typedef struct gtp_msg_hash_entry {
gboolean is_request; /*TRUE/FALSE*/
guint32 req_frame; /*frame with request */
nstime_t req_time; /*req time */
guint32 rep_frame; /*frame with reply */
gint seq_nr; /*sequence number*/
guint msgtype; /*messagetype*/
} gtp_msg_hash_t;
/* definitions of GTP messages */
#define GTP_MSG_UNKNOWN 0x00
#define GTP_MSG_ECHO_REQ 0x01
#define GTP_MSG_ECHO_RESP 0x02
#define GTP_MSG_VER_NOT_SUPP 0x03
#define GTP_MSG_NODE_ALIVE_REQ 0x04
#define GTP_MSG_NODE_ALIVE_RESP 0x05
#define GTP_MSG_REDIR_REQ 0x06
#define GTP_MSG_REDIR_RESP 0x07
#define GTP_MSG_CREATE_PDP_REQ 0x10
#define GTP_MSG_CREATE_PDP_RESP 0x11
#define GTP_MSG_UPDATE_PDP_REQ 0x12
#define GTP_MSG_UPDATE_PDP_RESP 0x13
#define GTP_MSG_DELETE_PDP_REQ 0x14
#define GTP_MSG_DELETE_PDP_RESP 0x15
#define GTP_MSG_CREATE_AA_PDP_REQ 0x16 /* 2G */
#define GTP_MSG_CREATE_AA_PDP_RESP 0x17 /* 2G */
#define GTP_MSG_DELETE_AA_PDP_REQ 0x18 /* 2G */
#define GTP_MSG_DELETE_AA_PDP_RESP 0x19 /* 2G */
#define GTP_MSG_ERR_IND 0x1A
#define GTP_MSG_PDU_NOTIFY_REQ 0x1B
#define GTP_MSG_PDU_NOTIFY_RESP 0x1C
#define GTP_MSG_PDU_NOTIFY_REJ_REQ 0x1D
#define GTP_MSG_PDU_NOTIFY_REJ_RESP 0x1E
#define GTP_MSG_SUPP_EXT_HDR 0x1F
#define GTP_MSG_SEND_ROUT_INFO_REQ 0x20
#define GTP_MSG_SEND_ROUT_INFO_RESP 0x21
#define GTP_MSG_FAIL_REP_REQ 0x22
#define GTP_MSG_FAIL_REP_RESP 0x23
#define GTP_MSG_MS_PRESENT_REQ 0x24
#define GTP_MSG_MS_PRESENT_RESP 0x25
#define GTP_MSG_IDENT_REQ 0x30
#define GTP_MSG_IDENT_RESP 0x31
#define GTP_MSG_SGSN_CNTXT_REQ 0x32
#define GTP_MSG_SGSN_CNTXT_RESP 0x33
#define GTP_MSG_SGSN_CNTXT_ACK 0x34
#define GTP_MSG_FORW_RELOC_REQ 0x35
#define GTP_MSG_FORW_RELOC_RESP 0x36
#define GTP_MSG_FORW_RELOC_COMP 0x37
#define GTP_MSG_RELOC_CANCEL_REQ 0x38
#define GTP_MSG_RELOC_CANCEL_RESP 0x39
#define GTP_MSG_FORW_SRNS_CNTXT 0x3A
#define GTP_MSG_FORW_RELOC_ACK 0x3B
#define GTP_MSG_FORW_SRNS_CNTXT_ACK 0x3C
#define GTP_MSG_RAN_INFO_RELAY 70
#define GTP_MBMS_NOTIFY_REQ 96
#define GTP_MBMS_NOTIFY_RES 97
#define GTP_MBMS_NOTIFY_REJ_REQ 98
#define GTP_MBMS_NOTIFY_REJ_RES 99
#define GTP_CREATE_MBMS_CNTXT_REQ 100
#define GTP_CREATE_MBMS_CNTXT_RES 101
#define GTP_UPD_MBMS_CNTXT_REQ 102
#define GTP_UPD_MBMS_CNTXT_RES 103
#define GTP_DEL_MBMS_CNTXT_REQ 104
#define GTP_DEL_MBMS_CNTXT_RES 105
#define GTP_MBMS_REG_REQ 112
#define GTP_MBMS_REG_RES 113
#define GTP_MBMS_DE_REG_REQ 114
#define GTP_MBMS_DE_REG_RES 115
#define GTP_MBMS_SES_START_REQ 116
#define GTP_MBMS_SES_START_RES 117
#define GTP_MBMS_SES_STOP_REQ 118
#define GTP_MBMS_SES_STOP_RES 119
#define GTP_MBMS_SES_UPD_REQ 120
#define GTP_MBMS_SES_UPD_RES 121
/* 122-127 For future use. Shall not be sent.
* If received, shall be treated as an Unknown message.
*/
#define GTP_MS_INFO_CNG_NOT_REQ 121
#define GTP_MS_INFO_CNG_NOT_RES 122
/* 130-239 For future use. Shall not be sent.
* If received, shall be treated as an Unknown message.
*/
#define GTP_MSG_DATA_TRANSF_REQ 0xF0
#define GTP_MSG_DATA_TRANSF_RESP 0xF1
/* 242-254 For future use. Shall not be sent.
* If received, shall be treated as an Unknown message.
*/
#define GTP_MSG_TPDU 0xFF
#endif /* __PACKET_GTP_H*/

View File

@ -158,6 +158,7 @@ WIRESHARK_TAP_SRC = \
gsm_a_stat.c \
gsm_map_stat.c \
gsm_map_summary.c \
gtp_stat.c \
h225_counter.c \
h225_ras_srt.c \
hostlist_eth.c \

233
gtk/gtp_stat.c Normal file
View File

@ -0,0 +1,233 @@
/* gtp_stat.c
* gtp_stat 2008 Kari Tiirikainen
* Largely based on ldap_stat by Ronnie Sahlberg, all mistakes added by KTi
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* 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.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <string.h>
#include <gtk/gtk.h>
#include <epan/packet_info.h>
#include <epan/epan.h>
#include <epan/value_string.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-gtp.h>
#include "../register.h"
#include "../timestats.h"
#include "../simple_dialog.h"
#include "../file.h"
#include "../globals.h"
#include "../stat_menu.h"
#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
#include "gtk/filter_dlg.h"
#include "gtk/service_response_time_table.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gtkglobals.h"
#include "gtk/main.h"
/* used to keep track of the statistics for an entire program interface */
typedef struct _gtpstat_t {
GtkWidget *win;
srt_stat_table gtp_srt_table;
} gtpstat_t;
static void
gtpstat_set_title(gtpstat_t *gtp)
{
char *title;
title = g_strdup_printf("GTP Control Plane Response Time statistics: %s",
cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(gtp->win), title);
g_free(title);
}
static void
gtpstat_reset(void *pgtp)
{
gtpstat_t *gtp=(gtpstat_t *)pgtp;
reset_srt_table_data(&gtp->gtp_srt_table);
gtpstat_set_title(gtp);
}
static int
gtpstat_packet(void *pgtp, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi)
{
const gtp_msg_hash_t *gtp=psi;
gtpstat_t *fs=(gtpstat_t *)pgtp;
int index=0;
/* we are only interested in reply packets */
if(gtp->is_request){
return 0;
}
/* if we have not seen the request, just ignore it */
if(!gtp->req_frame){
return 0;
}
/* Only use the commands we know how to handle, this is not a comprehensive list */
/* Redoing the message indexing is bit reduntant,*/
/* but using message type as such would yield a long gtp_srt_table.*/
/* Only a fragtion of the messages are matchable req/resp pairs,*/
/* it's just doesn't feel feasible*/
switch(gtp->msgtype){
case GTP_MSG_ECHO_REQ: index=0;
break;
case GTP_MSG_CREATE_PDP_REQ: index=1;
break;
case GTP_MSG_UPDATE_PDP_REQ: index=2;
break;
case GTP_MSG_DELETE_PDP_REQ: index=3;
break;
default:
return 0;
}
add_srt_table_data(&fs->gtp_srt_table, index, &gtp->req_time, pinfo);
return 1;
}
static void
gtpstat_draw(void *pgtp)
{
gtpstat_t *gtp=(gtpstat_t *)pgtp;
draw_srt_table_data(&gtp->gtp_srt_table);
}
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
gtpstat_t *gtp=(gtpstat_t *)data;
protect_thread_critical_region();
remove_tap_listener(gtp);
unprotect_thread_critical_region();
free_srt_table_data(&gtp->gtp_srt_table);
g_free(gtp);
}
static void
gtk_gtpstat_init(const char *optarg, void *userdata _U_)
{
gtpstat_t *gtp;
const char *filter=NULL;
GtkWidget *label;
char *filter_string;
GString *error_string;
GtkWidget *vbox;
GtkWidget *bbox;
GtkWidget *close_bt;
if(!strncmp(optarg,"gtp,",4)){
filter=optarg+4;
} else {
filter="gtp"; /*NULL doesn't work here like in LDAP. Too little time/lazy to find out why ?*/
}
gtp=g_malloc(sizeof(gtpstat_t));
gtp->win=window_new(GTK_WINDOW_TOPLEVEL, "gtp-stat");
gtk_window_set_default_size(GTK_WINDOW(gtp->win), 550, 400);
gtpstat_set_title(gtp);
vbox=gtk_vbox_new(FALSE, 3);
gtk_container_add(GTK_CONTAINER(gtp->win), vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
label=gtk_label_new("GTP Service Response Time statistics");
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
filter_string = g_strdup_printf("Filter: %s", filter ? filter : "");
label=gtk_label_new(filter_string);
g_free(filter_string);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
label=gtk_label_new("GTP Requests");
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
/* We must display TOP LEVEL Widget before calling init_srt_table() */
gtk_widget_show_all(gtp->win);
init_srt_table(&gtp->gtp_srt_table, 4, vbox, NULL);
init_srt_table_row(&gtp->gtp_srt_table, 0, "Echo");
init_srt_table_row(&gtp->gtp_srt_table, 1, "Create PDP context");
init_srt_table_row(&gtp->gtp_srt_table, 2, "Update PDP context");
init_srt_table_row(&gtp->gtp_srt_table, 3, "Delete PDP context");
error_string=register_tap_listener("gtp", gtp, filter, gtpstat_reset, gtpstat_packet, gtpstat_draw);
if(error_string){
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str);
g_string_free(error_string, TRUE);
g_free(gtp);
return;
}
/* Button row. */
bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL);
gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
close_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE);
window_set_cancel_button(gtp->win, close_bt, window_cancel_button_cb);
g_signal_connect(gtp->win, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
g_signal_connect(gtp->win, "destroy", G_CALLBACK(win_destroy_cb), gtp);
gtk_widget_show_all(gtp->win);
window_present(gtp->win);
cf_retap_packets(&cfile, FALSE);
}
static tap_dfilter_dlg gtp_stat_dlg = {
"GTP Control Plane Response Time Statistics",
"gtp",
gtk_gtpstat_init,
-1
};
void
register_tap_listener_gtkgtpstat(void)
{
register_dfilter_stat(&gtp_stat_dlg, "GTP",
REGISTER_STAT_GROUP_RESPONSE_TIME);
}