2
2
* mgcp-statistics for Wireshark
3
3
* Copyright 2003 Lars Roland
5
* $Id: mgcp_stat.c 29099 2009-07-15 00:10:08Z gerald $
5
* $Id: mgcp_stat.c 30389 2009-10-07 10:00:26Z etxrab $
7
7
* Wireshark - Network traffic analyzer
8
8
* By Gerald Combs <gerald@wireshark.org>
191
191
mgcpstat_t *ms=(mgcpstat_t *)pms;
196
str[i]=g_malloc(sizeof(char[256]));
199
197
/* clear list before printing */
200
gtk_clist_clear(ms->table);
198
store = GTK_LIST_STORE(gtk_tree_view_get_model(ms->table));
199
gtk_list_store_clear(store);
202
201
for(i=0;i<NUM_TIMESTATS;i++) {
203
202
/* nothing seen, nothing to do */
208
g_snprintf(str[0], sizeof(char[256]), "%s", val_to_str(i,mgcp_mesage_type,"Other"));
209
g_snprintf(str[1], sizeof(char[256]), "%d", ms->rtd[i].num);
210
g_snprintf(str[2], sizeof(char[256]), "%8.2f msec", nstime_to_msec(&(ms->rtd[i].min)));
211
g_snprintf(str[3], sizeof(char[256]), "%8.2f msec", nstime_to_msec(&(ms->rtd[i].max)));
212
g_snprintf(str[4], sizeof(char[256]), "%8.2f msec", get_average(&(ms->rtd[i].tot), ms->rtd[i].num));
213
g_snprintf(str[5], sizeof(char[256]), "%6u", ms->rtd[i].min_num);
214
g_snprintf(str[6], sizeof(char[256]), "%6u", ms->rtd[i].max_num);
215
gtk_clist_append(ms->table, str);
218
gtk_widget_show(GTK_WIDGET(ms->table));
207
g_snprintf(str[0], sizeof(char[256]), "%8.2f msec", nstime_to_msec(&(ms->rtd[i].min)));
208
g_snprintf(str[1], sizeof(char[256]), "%8.2f msec", nstime_to_msec(&(ms->rtd[i].max)));
209
g_snprintf(str[2], sizeof(char[256]), "%8.2f msec", get_average(&(ms->rtd[i].tot), ms->rtd[i].num));
210
gtk_list_store_append(store, &iter);
211
gtk_list_store_set(store, &iter,
212
0, val_to_str(i, mgcp_mesage_type,"Other"),
217
5, ms->rtd[i].min_num,
218
6, ms->rtd[i].max_num,
240
static const gchar *titles[]={
239
static const stat_column titles[]={
240
{G_TYPE_STRING, LEFT, "Type" },
241
{G_TYPE_UINT, RIGHT, "Messages" },
242
{G_TYPE_STRING, RIGHT, "Min SRT" },
243
{G_TYPE_STRING, RIGHT, "Max SRT" },
244
{G_TYPE_STRING, RIGHT, "Avg SRT" },
245
{G_TYPE_UINT, RIGHT, "Min in Frame" },
246
{G_TYPE_UINT, RIGHT, "Max in Frame" }
250
250
gtk_mgcpstat_init(const char *optarg, void *userdata _U_)
253
const char *filter=NULL;
254
253
GString *error_string;
255
254
GtkWidget *bt_close;
257
ms=g_malloc(sizeof(mgcpstat_t));
258
259
if(strncmp(optarg,"mgcp,srt,",9) == 0){
260
ms->filter=g_strdup(optarg+9);
264
ms=g_malloc(sizeof(mgcpstat_t));
265
ms->filter=g_strdup(filter);
267
265
mgcpstat_reset(ms);
269
267
ms->win = dlg_window_new("MGCP SRT"); /* transient_for top_level */
274
272
ms->vbox=gtk_vbox_new(FALSE, 3);
276
init_main_stat_window(ms->win, ms->vbox, "MGCP Service Response Time (SRT) Statistics", filter);
274
init_main_stat_window(ms->win, ms->vbox, "MGCP Service Response Time (SRT) Statistics", ms->filter);
278
276
/* init a scrolled window*/
279
277
ms->scrolled_window = scrolled_window_new(NULL, NULL);
281
279
ms->table = create_stat_table(ms->scrolled_window, ms->vbox, 7, titles);
283
error_string=register_tap_listener("mgcp", ms, filter, mgcpstat_reset, mgcpstat_packet, mgcpstat_draw);
281
error_string=register_tap_listener("mgcp", ms, ms->filter, 0, mgcpstat_reset, mgcpstat_packet, mgcpstat_draw);
284
282
if(error_string){
285
283
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
286
284
g_string_free(error_string, TRUE);
302
300
gtk_widget_show_all(ms->win);
303
301
window_present(ms->win);
305
cf_retap_packets(&cfile, FALSE);
303
cf_retap_packets(&cfile);
306
304
gdk_window_raise(ms->win->window);