Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] yet another mgcp patch

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

From: Ed Warnicke <hagbard@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 3 Mar 2001 22:22:29 -0500 (EST)
Added a mgcp.messagecount tag to allow filtering by the number of 
MGCP messages in a frame.  Please check in the patch.


Ed

Index: plugins/mgcp/moduleinfo.h
===================================================================
RCS file: /cvsroot/ethereal/plugins/mgcp/moduleinfo.h,v
retrieving revision 1.4
diff -u -r1.4 moduleinfo.h
--- moduleinfo.h	2001/03/04 00:43:56	1.4
+++ moduleinfo.h	2001/03/04 03:19:55
@@ -13,5 +13,5 @@
 #endif
 
 /* Version number of package */
-#define VERSION "0.0.4"
+#define VERSION "0.0.5"
 
Index: plugins/mgcp/packet-mgcp.c
===================================================================
RCS file: /cvsroot/ethereal/plugins/mgcp/packet-mgcp.c,v
retrieving revision 1.17
diff -u -r1.17 packet-mgcp.c
--- packet-mgcp.c	2001/03/04 00:43:56	1.17
+++ packet-mgcp.c	2001/03/04 03:19:56
@@ -2,7 +2,7 @@
  * Routines for mgcp packet disassembly
  * RFC 2705
  *
- * $Id: packet-mgcp.c,v 1.17 2001/03/04 00:43:56 guy Exp $
+ * $Id: packet-mgcp.c,v 1.16 2001/01/26 06:14:53 guy Exp $
  * 
  * Copyright (c) 2000 by Ed Warnicke <hagbard@xxxxxxxxxxxxxxxxxxx>
  *
@@ -163,7 +163,7 @@
  * are written in the same style.
  */ 
 static void dissect_mgcp_message(tvbuff_t *tvb, packet_info *pinfo, 
-				 proto_tree *tree);
+				 proto_tree *tree,proto_tree *mgcp_tree, proto_tree *ti);
 static void dissect_mgcp_firstline(tvbuff_t *tvb, 
 				   packet_info* pinfo, 
 				   proto_tree *tree);
@@ -198,6 +198,7 @@
   gint sectionlen;
   guint32 num_messages;
   gint tvb_sectionend,tvb_sectionbegin, tvb_len, tvb_current_len;
+  proto_tree *mgcp_tree, *ti;
 
   /* Initialize variables */
   tvb_sectionend = 0;
@@ -206,7 +207,9 @@
   tvb_len = tvb_length(tvb);
   tvb_current_len  = tvb_len;
   num_messages = 0;
-
+  mgcp_tree = NULL;
+  ti = NULL;
+  
   /*
    * Set the columns now, so that they'll be set correctly if we throw
    * an exception.  We can set them later as well....
@@ -231,20 +234,28 @@
        */
       do{
 	num_messages++;
+	if(tree){
+	  /* Create out mgcp subtree */
+	  ti = proto_tree_add_item(tree,proto_mgcp,tvb,0,0, FALSE);
+	  mgcp_tree = proto_item_add_subtree(ti, ett_mgcp);
+	}
+
 	sectionlen = tvb_find_dot_line(tvb, tvb_sectionbegin, -1,
 				       &tvb_sectionend);
 	if( sectionlen != -1){
 	  dissect_mgcp_message(tvb_new_subset(tvb, tvb_sectionbegin, 
 					      sectionlen, -1),
-			       pinfo, tree);
+			       pinfo, tree, mgcp_tree,ti);
 	  tvb_sectionbegin = tvb_sectionend;
 	}
 	else {
 	  break;
 	}
       } while(tvb_sectionend < tvb_len );
-      proto_tree_add_uint_hidden(tree, hf_mgcp_messagecount,NullTVB,0,0,
-				 num_messages); 
+      if(mgcp_tree){
+	proto_tree_add_uint_hidden(mgcp_tree, hf_mgcp_messagecount, tvb, 
+				   0 ,0 , num_messages); 
+      }
     } 
 
     /* 
@@ -276,10 +287,10 @@
 }
 
 static void 
-dissect_mgcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){
+dissect_mgcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, 
+		     proto_tree *mgcp_tree, proto_tree *ti){
 
   /* Declare variables */
-  proto_tree *mgcp_tree, *ti;
   gint sectionlen;
   gint tvb_sectionend,tvb_sectionbegin, tvb_len, tvb_current_len;
   tvbuff_t *next_tvb;
@@ -300,11 +311,7 @@
   if(is_mgcp_verb(tvb,0,tvb_len) || is_mgcp_rspcode(tvb,0,tvb_len)){
     
     /* Build the info tree if we've been given a root */
-    if (tree) {  
-      
-      /* Create out mgcp subtree */
-      ti = proto_tree_add_item(tree,proto_mgcp,tvb,0,0, FALSE);
-      mgcp_tree = proto_item_add_subtree(ti, ett_mgcp);
+    if (tree && mgcp_tree) {  
       
       /* dissect first line */
       tvb_sectionbegin = 0;