Disable MEGACO service response time statistics when context tracking is disabled.
authorrbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 6 Jan 2009 14:42:20 +0000 (14:42 +0000)
committerrbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 6 Jan 2009 14:42:20 +0000 (14:42 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27167 f5534014-38df-0310-8fa8-9805f1628bb7

gtk/megaco_stat.c
tap-megaco-common.c
tap-megacostat.c

index ab4022069fd27d72d3528c57d37353b71e334c67..e4d60d416fccd3c3f4ebb6ce33bceb8a0ec41f83 100644 (file)
@@ -42,6 +42,7 @@
 #include <epan/value_string.h>
 #include <epan/tap.h>
 #include "epan/gcp.h"
+#include <epan/prefs-int.h>
 
 #include "../register.h"
 #include "../timestats.h"
@@ -153,7 +154,16 @@ gtk_megacostat_init(const char *optarg, void *userdata _U_)
        GString *error_string;
        GtkWidget *bt_close;
        GtkWidget *bbox;
+       pref_t *megaco_ctx_track,*h248_ctx_track;
 
+       megaco_ctx_track = prefs_find_preference(prefs_find_module("megaco"),"ctx_info");
+       h248_ctx_track = prefs_find_preference(prefs_find_module("h248"),"ctx_info");
+       
+       if (!*megaco_ctx_track->varp.boolp || !*h248_ctx_track->varp.boolp) {
+               simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", "Track Context option at Protocols -> MEGACO and Protocols -> H248 preferences has to be set to true to enable measurement of service reponse times.");
+               return;
+       }
+       
        if(strncmp(optarg,"megaco,srt,",11) == 0){
                filter=optarg+11;
        } else {
index f3ba4d46731204fd9bd7ffa4facaadab8db109b3..a6aa587436f4b55b6ddc19b81e5d47634ff75a8d 100644 (file)
@@ -119,7 +119,13 @@ megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const
        switch (mi->type) {
 
         GCP_CMD_REQ_CASE
-               if(mi->trx->initial->framenum != mi->msg->framenum){
+               if(!mi->trx->initial) {
+                       /* Track Context is probably disabled, we cannot 
+                        * measure service response time */
+                       return 0;
+               }
+                       
+               else if(mi->trx->initial->framenum != mi->msg->framenum){
                        /* Duplicate is ignored */
                        ms->req_dup_num++;
                }
index efd431ab4f935bb62ef91652327e528372096e5d..dfe9fdb92cffea8012b0c4dd0d5a3db56448d79d 100644 (file)
@@ -42,6 +42,7 @@
 #include "register.h"
 #include "epan/gcp.h"
 #include "timestats.h"
+#include <epan/prefs-int.h>
 
 #include "tap-megaco-common.h"
 
@@ -84,7 +85,16 @@ megacostat_init(const char *optarg, void* userdata _U_)
        int i;
        const char *filter=NULL;
        GString *error_string;
-
+       pref_t *megaco_ctx_track,*h248_ctx_track;
+       
+       megaco_ctx_track = prefs_find_preference(prefs_find_module("megaco"),"ctx_info");
+       h248_ctx_track = prefs_find_preference(prefs_find_module("h248"),"ctx_info");
+       if (!*megaco_ctx_track->varp.boolp || !*h248_ctx_track->varp.boolp) {
+               printf("Track Context option at Protocols -> MEGACO and Protocols -> H248 preferences\n");
+               printf("has to be set to true to enable measurement of service reponse times.\n");
+               exit(1);
+       }
+       
        if(!strncmp(optarg,"megaco,rtd,",11)){
                filter=optarg+11;
        } else {