2003-04-16 07:25:12 +00:00
|
|
|
/* mgcp_stat.c
|
2006-05-22 07:29:40 +00:00
|
|
|
* mgcp-statistics for Wireshark
|
2003-04-16 07:25:12 +00:00
|
|
|
* Copyright 2003 Lars Roland
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2003-04-16 07:25:12 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2003-04-16 07:25:12 +00:00
|
|
|
* 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>
|
2004-02-13 00:53:37 +00:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include <epan/packet_info.h>
|
|
|
|
#include <epan/epan.h>
|
|
|
|
#include <epan/value_string.h>
|
|
|
|
|
2004-09-29 00:06:36 +00:00
|
|
|
#include <epan/tap.h>
|
2003-04-16 07:25:12 +00:00
|
|
|
#include "../register.h"
|
2007-10-16 05:45:03 +00:00
|
|
|
#include "../epan/dissectors/packet-mgcp.h"
|
2003-04-16 07:25:12 +00:00
|
|
|
#include "../timestats.h"
|
2005-08-21 19:24:11 +00:00
|
|
|
#include "gui_stat_util.h"
|
2003-04-16 07:25:12 +00:00
|
|
|
#include "compat_macros.h"
|
|
|
|
#include "../simple_dialog.h"
|
2003-09-26 02:09:44 +00:00
|
|
|
#include "dlg_utils.h"
|
2003-04-16 07:25:12 +00:00
|
|
|
#include "../file.h"
|
|
|
|
#include "../globals.h"
|
2005-08-21 09:48:27 +00:00
|
|
|
#include "../stat_menu.h"
|
2003-12-19 23:41:55 +00:00
|
|
|
#include "../tap_dfilter_dlg.h"
|
2005-08-20 12:09:48 +00:00
|
|
|
#include "gui_utils.h"
|
2004-02-06 19:19:12 +00:00
|
|
|
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
#ifdef NEED_G_ASCII_STRCASECMP_H
|
2007-11-28 01:31:23 +00:00
|
|
|
#include "../epan/g_ascii_strcasecmp.h"
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
#endif
|
|
|
|
|
2003-04-16 07:25:12 +00:00
|
|
|
|
2003-08-21 17:48:04 +00:00
|
|
|
#define NUM_TIMESTATS 10
|
2003-04-16 07:25:12 +00:00
|
|
|
|
|
|
|
/* used to keep track of the statistics for an entire program interface */
|
|
|
|
typedef struct _mgcpstat_t {
|
|
|
|
GtkWidget *win;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
char *filter;
|
2003-04-27 21:50:59 +00:00
|
|
|
GtkWidget *scrolled_window;
|
|
|
|
GtkCList *table;
|
2003-04-16 07:25:12 +00:00
|
|
|
timestat_t rtd[NUM_TIMESTATS];
|
|
|
|
guint32 open_req_num;
|
|
|
|
guint32 disc_rsp_num;
|
|
|
|
guint32 req_dup_num;
|
|
|
|
guint32 rsp_dup_num;
|
|
|
|
} mgcpstat_t;
|
|
|
|
|
|
|
|
static const value_string mgcp_mesage_type[] = {
|
2003-08-21 17:48:04 +00:00
|
|
|
{ 0, "EPCF"},
|
|
|
|
{ 1, "CRCX"},
|
|
|
|
{ 2, "MDCX"},
|
|
|
|
{ 3, "DLCX"},
|
|
|
|
{ 4, "RQNT"},
|
|
|
|
{ 5, "NTFY"},
|
|
|
|
{ 6, "AUEP"},
|
|
|
|
{ 7, "AUCX"},
|
|
|
|
{ 8, "RSIP"},
|
|
|
|
{ 0, NULL}
|
2003-04-16 07:25:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
mgcpstat_reset(void *pms)
|
|
|
|
{
|
|
|
|
mgcpstat_t *ms=(mgcpstat_t *)pms;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i=0;i<NUM_TIMESTATS;i++) {
|
|
|
|
ms->rtd[i].num=0;
|
|
|
|
ms->rtd[i].min_num=0;
|
|
|
|
ms->rtd[i].max_num=0;
|
|
|
|
ms->rtd[i].min.secs=0;
|
|
|
|
ms->rtd[i].min.nsecs=0;
|
|
|
|
ms->rtd[i].max.secs=0;
|
|
|
|
ms->rtd[i].max.nsecs=0;
|
|
|
|
ms->rtd[i].tot.secs=0;
|
|
|
|
ms->rtd[i].tot.nsecs=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ms->open_req_num=0;
|
|
|
|
ms->disc_rsp_num=0;
|
|
|
|
ms->req_dup_num=0;
|
|
|
|
ms->rsp_dup_num=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2005-01-01 02:57:02 +00:00
|
|
|
mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pmi)
|
2003-04-16 07:25:12 +00:00
|
|
|
{
|
|
|
|
mgcpstat_t *ms=(mgcpstat_t *)pms;
|
2005-01-01 02:57:02 +00:00
|
|
|
const mgcp_info_t *mi=pmi;
|
2003-04-16 07:25:12 +00:00
|
|
|
nstime_t delta;
|
2008-02-07 12:52:08 +00:00
|
|
|
int ret = 0;
|
2003-04-16 07:25:12 +00:00
|
|
|
|
|
|
|
switch (mi->mgcp_type) {
|
|
|
|
|
|
|
|
case MGCP_REQUEST:
|
|
|
|
if(mi->is_duplicate){
|
|
|
|
/* Duplicate is ignored */
|
|
|
|
ms->req_dup_num++;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ms->open_req_num++;
|
|
|
|
}
|
2008-02-07 12:52:08 +00:00
|
|
|
break;
|
2003-04-16 07:25:12 +00:00
|
|
|
|
|
|
|
case MGCP_RESPONSE:
|
|
|
|
if(mi->is_duplicate){
|
|
|
|
/* Duplicate is ignored */
|
|
|
|
ms->rsp_dup_num++;
|
|
|
|
}
|
|
|
|
else if (!mi->request_available) {
|
|
|
|
/* no request was seen */
|
|
|
|
ms->disc_rsp_num++;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ms->open_req_num--;
|
|
|
|
/* calculate time delta between request and response */
|
2005-08-24 21:31:56 +00:00
|
|
|
nstime_delta(&delta, &pinfo->fd->abs_ts, &mi->req_time);
|
2003-04-16 07:25:12 +00:00
|
|
|
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
if (g_ascii_strncasecmp(mi->code, "EPCF", 4) == 0 ) {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[0]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
else if (g_ascii_strncasecmp(mi->code, "CRCX", 4) == 0 ) {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[1]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
else if (g_ascii_strncasecmp(mi->code, "MDCX", 4) == 0 ) {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[2]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
else if (g_ascii_strncasecmp(mi->code, "DLCX", 4) == 0 ) {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[3]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
else if (g_ascii_strncasecmp(mi->code, "RQNT", 4) == 0 ) {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[4]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
else if (g_ascii_strncasecmp(mi->code, "NTFY", 4) == 0 ) {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[5]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
else if (g_ascii_strncasecmp(mi->code, "AUEP", 4) == 0 ) {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[6]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
else if (g_ascii_strncasecmp(mi->code, "AUCX", 4) == 0 ) {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[7]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).
In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.
We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot. This causes strings that should
match not to match.
This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.
svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
|
|
|
else if (g_ascii_strncasecmp(mi->code, "RSIP", 4) == 0 ) {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[8]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
|
|
|
else {
|
2003-08-21 17:48:04 +00:00
|
|
|
time_stat_update(&(ms->rtd[9]),&delta, pinfo);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
|
|
|
|
2008-02-07 12:52:08 +00:00
|
|
|
ret = 1;
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
2008-02-07 12:52:08 +00:00
|
|
|
break;
|
2003-04-16 07:25:12 +00:00
|
|
|
|
|
|
|
default:
|
2008-02-07 12:52:08 +00:00
|
|
|
break;
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
2008-02-07 12:52:08 +00:00
|
|
|
|
|
|
|
return ret;
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
mgcpstat_draw(void *pms)
|
|
|
|
{
|
|
|
|
mgcpstat_t *ms=(mgcpstat_t *)pms;
|
|
|
|
int i;
|
2003-08-21 17:48:04 +00:00
|
|
|
/* gtk1 using a scrollable clist*/
|
2003-04-27 21:50:59 +00:00
|
|
|
char *str[7];
|
|
|
|
|
|
|
|
for(i=0;i<7;i++) {
|
|
|
|
str[i]=g_malloc(sizeof(char[256]));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear list before printing */
|
|
|
|
gtk_clist_clear(ms->table);
|
|
|
|
|
|
|
|
for(i=0;i<NUM_TIMESTATS;i++) {
|
|
|
|
/* nothing seen, nothing to do */
|
|
|
|
if(ms->rtd[i].num==0){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-03-13 12:09:27 +00:00
|
|
|
g_snprintf(str[0], 256, "%s", val_to_str(i,mgcp_mesage_type,"Other"));
|
|
|
|
g_snprintf(str[1], 256, "%d", ms->rtd[i].num);
|
|
|
|
g_snprintf(str[2], 256, "%8.2f msec", nstime_to_msec(&(ms->rtd[i].min)));
|
|
|
|
g_snprintf(str[3], 256, "%8.2f msec", nstime_to_msec(&(ms->rtd[i].max)));
|
|
|
|
g_snprintf(str[4], 256, "%8.2f msec", get_average(&(ms->rtd[i].tot), ms->rtd[i].num));
|
|
|
|
g_snprintf(str[5], 256, "%6u", ms->rtd[i].min_num);
|
|
|
|
g_snprintf(str[6], 256, "%6u", ms->rtd[i].max_num);
|
2003-04-27 21:50:59 +00:00
|
|
|
gtk_clist_append(ms->table, str);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show(GTK_WIDGET(ms->table));
|
|
|
|
for(i=0;i<7;i++) {
|
|
|
|
g_free(str[i]);
|
|
|
|
}
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void protect_thread_critical_region(void);
|
|
|
|
void unprotect_thread_critical_region(void);
|
|
|
|
static void
|
|
|
|
win_destroy_cb(GtkWindow *win _U_, gpointer data)
|
|
|
|
{
|
|
|
|
mgcpstat_t *ms=(mgcpstat_t *)data;
|
|
|
|
|
|
|
|
protect_thread_critical_region();
|
|
|
|
remove_tap_listener(ms);
|
|
|
|
unprotect_thread_critical_region();
|
|
|
|
|
|
|
|
if(ms->filter){
|
|
|
|
g_free(ms->filter);
|
|
|
|
ms->filter=NULL;
|
|
|
|
}
|
|
|
|
g_free(ms);
|
|
|
|
}
|
|
|
|
|
2005-08-06 03:44:55 +00:00
|
|
|
static const gchar *titles[]={
|
|
|
|
"Type",
|
2003-04-27 21:50:59 +00:00
|
|
|
"Messages",
|
2003-08-21 17:48:04 +00:00
|
|
|
"Min SRT",
|
|
|
|
"Max SRT",
|
|
|
|
"Avg SRT",
|
2003-04-27 21:50:59 +00:00
|
|
|
"Min in Frame",
|
|
|
|
"Max in Frame" };
|
|
|
|
|
2005-08-20 14:02:00 +00:00
|
|
|
static void
|
2006-02-12 00:54:56 +00:00
|
|
|
gtk_mgcpstat_init(const char *optarg, void *userdata _U_)
|
2003-04-16 07:25:12 +00:00
|
|
|
{
|
|
|
|
mgcpstat_t *ms;
|
2005-08-06 03:44:55 +00:00
|
|
|
const char *filter=NULL;
|
2003-04-27 21:50:59 +00:00
|
|
|
GString *error_string;
|
2005-08-06 03:44:55 +00:00
|
|
|
GtkWidget *bt_close;
|
|
|
|
GtkWidget *bbox;
|
2003-04-16 07:25:12 +00:00
|
|
|
|
2003-08-21 17:48:04 +00:00
|
|
|
if(strncmp(optarg,"mgcp,srt,",9) == 0){
|
2003-04-16 07:25:12 +00:00
|
|
|
filter=optarg+9;
|
|
|
|
} else {
|
2005-08-06 03:44:55 +00:00
|
|
|
filter="";
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ms=g_malloc(sizeof(mgcpstat_t));
|
2004-03-13 14:07:14 +00:00
|
|
|
ms->filter=g_strdup(filter);
|
2003-04-16 07:25:12 +00:00
|
|
|
|
|
|
|
mgcpstat_reset(ms);
|
|
|
|
|
2004-05-23 23:24:07 +00:00
|
|
|
ms->win=window_new(GTK_WINDOW_TOPLEVEL, "MGCP SRT");
|
2004-05-27 19:59:50 +00:00
|
|
|
gtk_window_set_default_size(GTK_WINDOW(ms->win), 550, 150);
|
2003-04-16 07:25:12 +00:00
|
|
|
|
2004-05-23 23:24:07 +00:00
|
|
|
ms->vbox=gtk_vbox_new(FALSE, 3);
|
2003-04-16 07:25:12 +00:00
|
|
|
|
2003-08-21 17:48:04 +00:00
|
|
|
init_main_stat_window(ms->win, ms->vbox, "MGCP Service Response Time (SRT) Statistics", filter);
|
2003-04-16 07:25:12 +00:00
|
|
|
|
2003-08-21 17:48:04 +00:00
|
|
|
/* GTK1 using a scrollable clist*/
|
2003-04-27 21:50:59 +00:00
|
|
|
/* init a scrolled window*/
|
2004-02-06 19:19:12 +00:00
|
|
|
ms->scrolled_window = scrolled_window_new(NULL, NULL);
|
2003-04-27 21:50:59 +00:00
|
|
|
|
|
|
|
ms->table = create_stat_table(ms->scrolled_window, ms->vbox, 7, titles);
|
|
|
|
|
2003-04-23 08:20:06 +00:00
|
|
|
error_string=register_tap_listener("mgcp", ms, filter, mgcpstat_reset, mgcpstat_packet, mgcpstat_draw);
|
|
|
|
if(error_string){
|
2004-01-31 03:22:42 +00:00
|
|
|
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str);
|
2003-04-23 08:20:06 +00:00
|
|
|
g_string_free(error_string, TRUE);
|
2003-04-16 07:25:12 +00:00
|
|
|
g_free(ms->filter);
|
|
|
|
g_free(ms);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-05-23 23:24:07 +00:00
|
|
|
/* Button row. */
|
2005-08-06 03:44:55 +00:00
|
|
|
bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL);
|
|
|
|
gtk_box_pack_start(GTK_BOX(ms->vbox), bbox, FALSE, FALSE, 0);
|
2004-05-23 23:24:07 +00:00
|
|
|
|
2005-08-06 03:44:55 +00:00
|
|
|
bt_close = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE);
|
|
|
|
window_set_cancel_button(ms->win, bt_close, window_cancel_button_cb);
|
2004-05-23 23:24:07 +00:00
|
|
|
|
2005-08-06 03:44:55 +00:00
|
|
|
SIGNAL_CONNECT(ms->win, "delete_event", window_delete_event_cb, NULL);
|
2004-05-23 23:24:07 +00:00
|
|
|
SIGNAL_CONNECT(ms->win, "destroy", win_destroy_cb, ms);
|
|
|
|
|
2005-08-06 03:44:55 +00:00
|
|
|
gtk_widget_show_all(ms->win);
|
|
|
|
window_present(ms->win);
|
2004-05-23 23:24:07 +00:00
|
|
|
|
2005-09-14 08:59:41 +00:00
|
|
|
cf_retap_packets(&cfile, FALSE);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
|
|
|
|
2004-03-27 11:13:03 +00:00
|
|
|
static tap_dfilter_dlg mgcp_srt_dlg = {
|
|
|
|
"MGCP Service Response Time (SRT) Statistics",
|
|
|
|
"mgcp,srt",
|
|
|
|
gtk_mgcpstat_init,
|
|
|
|
-1
|
|
|
|
};
|
2003-04-25 20:54:18 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
register_tap_listener_gtkmgcpstat(void)
|
|
|
|
{
|
2005-02-20 15:53:11 +00:00
|
|
|
/* We don't register this tap, if we don't have the mgcp plugin loaded.*/
|
|
|
|
if (find_tap_id("mgcp")) {
|
2005-08-21 10:29:47 +00:00
|
|
|
register_dfilter_stat(&mgcp_srt_dlg, "MGCP",
|
2005-08-21 09:48:27 +00:00
|
|
|
REGISTER_STAT_GROUP_RESPONSE_TIME);
|
2005-02-20 15:53:11 +00:00
|
|
|
}
|
2003-04-23 05:37:23 +00:00
|
|
|
}
|