aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-12-05 09:25:41 +0000
committerGuy Harris <guy@alum.mit.edu>2003-12-05 09:25:41 +0000
commit1d4abd156809fffe8290024de704b778fa6fe881 (patch)
treed8a36f2dff5cc74097b045e18ac1b085570033d1 /plugins
parent2428266b1da2c965f376342e4711833fa26c629b (diff)
Subdissectors must be called regardless of whether a protocol tree is
being built. svn path=/trunk/; revision=9174
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mgcp/packet-mgcp.c128
1 files changed, 61 insertions, 67 deletions
diff --git a/plugins/mgcp/packet-mgcp.c b/plugins/mgcp/packet-mgcp.c
index 86eab58383..25f1e14eb9 100644
--- a/plugins/mgcp/packet-mgcp.c
+++ b/plugins/mgcp/packet-mgcp.c
@@ -2,7 +2,7 @@
* Routines for mgcp packet disassembly
* RFC 2705
*
- * $Id: packet-mgcp.c,v 1.42 2003/09/05 07:44:49 jmayer Exp $
+ * $Id: packet-mgcp.c,v 1.43 2003/12/05 09:25:41 guy Exp $
*
* Copyright (c) 2000 by Ed Warnicke <hagbard@physics.rutgers.edu>
*
@@ -259,42 +259,39 @@ dissect_mgcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* but its cheap and its better than nothing.
*/
if(is_mgcp_verb(tvb,0,tvb_len) || is_mgcp_rspcode(tvb,0,tvb_len)){
+ /*
+ * Loop through however many mgcp messages may be stuck in
+ * this packet using piggybacking
+ */
+ 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);
+ }
- /* Build the info tree if we've been given a root */
- if (tree || global_mgcp_message_count == TRUE) {
- /*
- * Loop through however many mgcp messages may be stuck in
- * this packet using piggybacking
- */
- 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, mgcp_tree,ti);
- tvb_sectionbegin = tvb_sectionend;
- }
- else {
- break;
- }
- } while(tvb_sectionend < tvb_len );
- if(mgcp_tree){
- proto_tree_add_uint_hidden(mgcp_tree, hf_mgcp_messagecount, tvb,
- 0 ,0 , num_messages);
+ 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, mgcp_tree,ti);
+ tvb_sectionbegin = tvb_sectionend;
}
+ else {
+ break;
+ }
+ } while(tvb_sectionend < tvb_len );
+ if(mgcp_tree){
+ proto_tree_add_uint_hidden(mgcp_tree, hf_mgcp_messagecount, tvb,
+ 0 ,0 , num_messages);
}
/*
* Add our column information we do this after dissecting SDP
* in order to prevent the column info changing to reflect the SDP.
+ * XXX - can we do this with a fence?
*/
tvb_sectionbegin = 0;
if (check_col(pinfo->cinfo, COL_PROTOCOL)){
@@ -343,49 +340,46 @@ dissect_mgcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* but its cheap and its better than nothing.
*/
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 && mgcp_tree) {
-
- /* dissect first line */
- tvb_sectionbegin = 0;
- tvb_current_len = tvb_len;
- tvb_sectionend = tvb_sectionbegin;
- sectionlen = tvb_find_line_end(tvb,0,-1,&tvb_sectionend,FALSE);
- if( sectionlen > 0){
- dissect_mgcp_firstline(tvb_new_subset(tvb, tvb_sectionbegin,
- sectionlen,-1), pinfo,
- mgcp_tree, &mi);
- }
+ /* dissect first line */
+ tvb_sectionbegin = 0;
+ tvb_current_len = tvb_len;
+ tvb_sectionend = tvb_sectionbegin;
+ sectionlen = tvb_find_line_end(tvb,0,-1,&tvb_sectionend,FALSE);
+ if( sectionlen > 0){
+ dissect_mgcp_firstline(tvb_new_subset(tvb, tvb_sectionbegin,
+ sectionlen,-1), pinfo,
+ mgcp_tree, &mi);
+ }
+ tvb_sectionbegin = tvb_sectionend;
+
+ /* dissect params */
+ if(tvb_sectionbegin < tvb_len){
+ sectionlen = tvb_find_null_line(tvb, tvb_sectionbegin, -1,
+ &tvb_sectionend);
+ dissect_mgcp_params(tvb_new_subset(tvb, tvb_sectionbegin,
+ sectionlen, -1),
+ mgcp_tree);
tvb_sectionbegin = tvb_sectionend;
+ }
- /* dissect params */
- if(tvb_sectionbegin < tvb_len){
- sectionlen = tvb_find_null_line(tvb, tvb_sectionbegin, -1,
- &tvb_sectionend);
- dissect_mgcp_params(tvb_new_subset(tvb, tvb_sectionbegin,
- sectionlen, -1),
- mgcp_tree);
- tvb_sectionbegin = tvb_sectionend;
- }
-
- /* set the mgcp payload length correctly so we don't include the
- * encapsulated SDP
- */
- sectionlen = tvb_sectionend;
- proto_item_set_len(ti,sectionlen);
+ /* set the mgcp payload length correctly so we don't include the
+ * encapsulated SDP
+ */
+ sectionlen = tvb_sectionend;
+ proto_item_set_len(ti,sectionlen);
- /* Display the raw text of the mgcp message if desired */
+ /* Display the raw text of the mgcp message if desired */
- /* Do we want to display the raw text of our MGCP packet? */
- if(global_mgcp_raw_text)
+ /* Do we want to display the raw text of our MGCP packet? */
+ if(global_mgcp_raw_text) {
+ if (tree)
mgcp_raw_text_add(tvb, mgcp_tree);
+ }
- /* dissect sdp payload */
- if( tvb_sectionend < tvb_len && global_mgcp_dissect_tree == TRUE){
- next_tvb = tvb_new_subset(tvb, tvb_sectionend, -1, -1);
- call_dissector(sdp_handle, next_tvb, pinfo, tree);
- }
+ /* dissect sdp payload */
+ if( tvb_sectionend < tvb_len){
+ next_tvb = tvb_new_subset(tvb, tvb_sectionend, -1, -1);
+ call_dissector(sdp_handle, next_tvb, pinfo, tree);
}
}
}