Ethereal-dev: [Ethereal-dev] GIOP GUI Pref patch

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Frank Singleton <frank.singleton@xxxxxxxxxxxx>
Date: Thu, 28 Jun 2001 14:58:04 -0500
Hi,

I have added a GUI pref for GIOP to allow enabling/disabling
of (the not too far away..) giop subdissectors.

ie: packet-giop-CosNaming
    packet-giop-CosEvent
       ...

So now you need a 1600 pixel wide monitor :^)

/Frank..

-- 
EUS/SV/Z Frank Singleton      ASO Americas BSS
Office : +1 972 583 3251      ECN 800 33251  
Mobile : +1 214 228 0874      Amateur Radio: VK3FCS/KM5WS   
Email : frank.singleton@xxxxxxxxxxxx

Hardware: HP Omnibook 4150 running Redhat Linux 7.1 (2.4.3-12 kernel).
--- ../ethereal-2001-06-28/packet-giop.c	Wed Jun 27 15:38:56 2001
+++ ../ethereal-2001-06-28.updated/packet-giop.c	Thu Jun 28 14:36:05 2001
@@ -9,7 +9,7 @@
  * Frank Singleton <frank.singleton@xxxxxxxxxxxx>
  * Trevor Shepherd <eustrsd@xxxxxxxxxxxxxxx>
  *
- * $Id: packet-giop.c,v 1.38 2001/06/27 20:38:56 guy Exp $
+ * $Id: packet-giop.c,v 1.1 2001/06/28 19:36:05 frank Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@xxxxxxxxxxxx>
@@ -298,9 +298,15 @@
 #include "strerror.h"
 #endif
 
+#include "prefs.h"
 #include "packet.h"
 #include "packet-giop.h"
 
+/* Enable GIOP Subdissectors by default, can toggle off in GUI  */
+
+static gboolean giop_pref_sub_enable = TRUE;
+
+
 /*
  * This affects how we handle context_data inside ServiceContext structs.
  * According to CORBA 2.4.2,  Context data is encapsulated in octet sequences,
@@ -317,12 +323,6 @@
 
 #define DEBUG   0
 
-/*
- * To allow calling (or not) of subdissectors, for testing buggy stuff.
- * TODO - make this a runtime option in GUI
- */
-
-#define DEBUG_CALL_SUB_DISSECTORS  1
 
 
 /*
@@ -2956,20 +2956,22 @@
        * fails, try the heuristic method.
        */
 
-#if DEBUG_CALL_SUB_DISSECTORS
+      /* Only call sub dissectors if user has not disables pref */
 
-      if(entry->repoid) {    
-	exres = try_explicit_giop_dissector(tvb,pinfo,clnp_tree, &offset, header, entry->operation, entry->repoid );
-      }
+      if (giop_pref_sub_enable) {
 
-      /* Only call heuristic if no explicit dixxector was found */
+	if(entry->repoid) {    
+	  exres = try_explicit_giop_dissector(tvb,pinfo,clnp_tree, &offset, header, entry->operation, entry->repoid );
+	}
 
-      if(! exres) {
-	try_heuristic_giop_dissector(tvb,pinfo,clnp_tree,&offset,header,entry->operation);
-      } 
+	/* Only call heuristic if no explicit dixxector was found */
 
+	if(! exres) {
+	  try_heuristic_giop_dissector(tvb,pinfo,clnp_tree,&offset,header,entry->operation);
+	} 
 
-#endif
+      }	/* giop_pref_sub_enable */
+      
       break;
       
     case LOCATION_FORWARD:
@@ -3399,19 +3401,23 @@
   header->req_id = request_id;	        /* save for sub dissector */
   repoid = get_repoid_from_objkey(giop_objkey_hash,objkey,objkey_len);
 
-#if DEBUG_CALL_SUB_DISSECTORS
 
-  if(repoid) {    
-    exres = try_explicit_giop_dissector(tvb,pinfo,tree,&offset,header,operation,repoid);
-  }
+  /* Only call sub dissectors if user has not disables pref */
+  
+  if (giop_pref_sub_enable) {
 
-  /* Only call heuristic if no explicit dissector was found */
+    if(repoid) {    
+      exres = try_explicit_giop_dissector(tvb,pinfo,tree,&offset,header,operation,repoid);
+    }
 
-  if (! exres) {
-    try_heuristic_giop_dissector(tvb,pinfo,tree,&offset,header,operation);
-  }
+    /* Only call heuristic if no explicit dissector was found */
+    
+    if (! exres) {
+      try_heuristic_giop_dissector(tvb,pinfo,tree,&offset,header,operation);
+    }
+    
+  }	/* giop_pref_sub_enable */
   
-#endif
 
   g_free( print_objkey );  
   g_free( objkey );
@@ -3543,20 +3549,22 @@
    * fails, try the heuristic method.
    */
   
-#if DEBUG_CALL_SUB_DISSECTORS
+  /* Only call sub dissectors if user has not disables pref */
 
-  if(repoid) {    
-    exres = try_explicit_giop_dissector(tvb,pinfo,tree,&offset,header,operation,repoid);
-  }
+  if (giop_pref_sub_enable) {
 
-  /* Only call heuristic if no explicit dissector was found */
+    if(repoid) {    
+      exres = try_explicit_giop_dissector(tvb,pinfo,tree,&offset,header,operation,repoid);
+    }
 
-  if (! exres) {
-    try_heuristic_giop_dissector(tvb,pinfo,tree,&offset,header,operation);
-  }
+    /* Only call heuristic if no explicit dissector was found */
+
+    if (! exres) {
+      try_heuristic_giop_dissector(tvb,pinfo,tree,&offset,header,operation);
+    }
   
+  } /* giop_pref_sub_enable */
 
-#endif
 
   g_free(operation);
   g_free(reserved);
@@ -4173,6 +4181,8 @@
 
   };
 
+  module_t *giop_module;
+  
   static gint *ett[] = {
     &ett_giop,
     &ett_giop_reply,
@@ -4186,6 +4196,14 @@
 				       "giop");
   proto_register_field_array (proto_giop, hf, array_length (hf));
   proto_register_subtree_array (ett, array_length (ett));
+
+  /* Register configuration preferences */
+
+  giop_module = prefs_register_protocol(proto_giop, NULL);
+  prefs_register_bool_preference(giop_module, "giop_pref_sub_enable",
+				 "Enable GIOP Subdissectors",
+				 "Enable GIOP Subdissectors",
+				 &giop_pref_sub_enable);
 
 
   /* register init routine */