update expert info LED also while doing live capturing
[obnox/wireshark/wip.git] / gtk / mgcp_stat.c
index 26654350191dcf5acaf7b593548ed6d9642982f8..7fe9f62a0d4f55eb546f9083ffbf2ef79ec87457 100644 (file)
@@ -1,11 +1,11 @@
 /* mgcp_stat.c
- * mgcp-statistics for ethereal
+ * mgcp-statistics for Wireshark
  * Copyright 2003 Lars Roland
  *
  * $Id$
  *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * 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
@@ -41,7 +41,7 @@
 
 #include <epan/tap.h>
 #include "../register.h"
-#include "../plugins/mgcp/packet-mgcp.h"
+#include "../epan/dissectors/packet-mgcp.h"
 #include "../timestats.h"
 #include "gui_stat_util.h"
 #include "compat_macros.h"
 #include "../tap_dfilter_dlg.h"
 #include "gui_utils.h"
 
+#ifdef NEED_G_ASCII_STRCASECMP_H
+#include "../epan/g_ascii_strcasecmp.h"
+#endif
+
 
 #define NUM_TIMESTATS 10
 
@@ -114,6 +118,7 @@ mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
        mgcpstat_t *ms=(mgcpstat_t *)pms;
        const mgcp_info_t *mi=pmi;
        nstime_t delta;
+       int ret = 0;
 
        switch (mi->mgcp_type) {
 
@@ -121,69 +126,66 @@ mgcpstat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
                if(mi->is_duplicate){
                        /* Duplicate is ignored */
                        ms->req_dup_num++;
-                       return 0;
                }
                else {
                        ms->open_req_num++;
-                       return 0;
                }
-       break;
+               break;
 
        case MGCP_RESPONSE:
                if(mi->is_duplicate){
                        /* Duplicate is ignored */
                        ms->rsp_dup_num++;
-                       return 0;
                }
                else if (!mi->request_available) {
                        /* no request was seen */
                        ms->disc_rsp_num++;
-                       return 0;
                }
                else {
                        ms->open_req_num--;
                        /* calculate time delta between request and response */
                        nstime_delta(&delta, &pinfo->fd->abs_ts, &mi->req_time);
 
-                       if (strncasecmp(mi->code, "EPCF", 4) == 0 ) {
+                       if (g_ascii_strncasecmp(mi->code, "EPCF", 4) == 0 ) {
                                time_stat_update(&(ms->rtd[0]),&delta, pinfo);
                        }
-                       else if (strncasecmp(mi->code, "CRCX", 4) == 0 ) {
+                       else if (g_ascii_strncasecmp(mi->code, "CRCX", 4) == 0 ) {
                                time_stat_update(&(ms->rtd[1]),&delta, pinfo);
                        }
-                       else if (strncasecmp(mi->code, "MDCX", 4) == 0 ) {
+                       else if (g_ascii_strncasecmp(mi->code, "MDCX", 4) == 0 ) {
                                time_stat_update(&(ms->rtd[2]),&delta, pinfo);
                        }
-                       else if (strncasecmp(mi->code, "DLCX", 4) == 0 ) {
+                       else if (g_ascii_strncasecmp(mi->code, "DLCX", 4) == 0 ) {
                                time_stat_update(&(ms->rtd[3]),&delta, pinfo);
                        }
-                       else if (strncasecmp(mi->code, "RQNT", 4) == 0 ) {
+                       else if (g_ascii_strncasecmp(mi->code, "RQNT", 4) == 0 ) {
                                time_stat_update(&(ms->rtd[4]),&delta, pinfo);
                        }
-                       else if (strncasecmp(mi->code, "NTFY", 4) == 0 ) {
+                       else if (g_ascii_strncasecmp(mi->code, "NTFY", 4) == 0 ) {
                                time_stat_update(&(ms->rtd[5]),&delta, pinfo);
                        }
-                       else if (strncasecmp(mi->code, "AUEP", 4) == 0 ) {
+                       else if (g_ascii_strncasecmp(mi->code, "AUEP", 4) == 0 ) {
                                time_stat_update(&(ms->rtd[6]),&delta, pinfo);
                        }
-                       else if (strncasecmp(mi->code, "AUCX", 4) == 0 ) {
+                       else if (g_ascii_strncasecmp(mi->code, "AUCX", 4) == 0 ) {
                                time_stat_update(&(ms->rtd[7]),&delta, pinfo);
                        }
-                       else if (strncasecmp(mi->code, "RSIP", 4) == 0 ) {
+                       else if (g_ascii_strncasecmp(mi->code, "RSIP", 4) == 0 ) {
                                time_stat_update(&(ms->rtd[8]),&delta, pinfo);
                        }
                        else {
                                time_stat_update(&(ms->rtd[9]),&delta, pinfo);
                        }
 
-                       return 1;
+                       ret = 1;
                }
-       break;
+               break;
 
        default:
-               return 0;
-       break;
+               break;
        }
+
+       return ret;
 }
 
 static void
@@ -251,7 +253,7 @@ static const gchar *titles[]={
                        "Max in Frame" };
 
 static void
-gtk_mgcpstat_init(const char *optarg)
+gtk_mgcpstat_init(const char *optarg, void *userdata _U_)
 {
        mgcpstat_t *ms;
        const char *filter=NULL;