Added support for dissecting RSVP Bundle Messages

svn path=/trunk/; revision=5881
This commit is contained in:
Ashok Narayanan 2002-07-15 21:19:56 +00:00
parent e0dc69929e
commit 7f7af9143a
1 changed files with 310 additions and 223 deletions

View File

@ -3,7 +3,7 @@
* *
* (c) Copyright Ashok Narayanan <ashokn@cisco.com> * (c) Copyright Ashok Narayanan <ashokn@cisco.com>
* *
* $Id: packet-rsvp.c,v 1.69 2002/07/14 19:33:16 guy Exp $ * $Id: packet-rsvp.c,v 1.70 2002/07/15 21:19:56 ashokn Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -68,6 +68,7 @@
#include <epan/tvbuff.h> #include <epan/tvbuff.h>
#include <epan/packet.h> #include <epan/packet.h>
#include <prefs.h>
#include "in_cksum.h" #include "in_cksum.h"
#include "etypes.h" #include "etypes.h"
#include "ipproto.h" #include "ipproto.h"
@ -114,8 +115,11 @@ static gint ett_rsvp_admin_status = -1;
static gint ett_rsvp_admin_status_flags = -1; static gint ett_rsvp_admin_status_flags = -1;
static gint ett_rsvp_gen_uni = -1; static gint ett_rsvp_gen_uni = -1;
static gint ett_rsvp_gen_uni_subobj = -1; static gint ett_rsvp_gen_uni_subobj = -1;
static gint ett_rsvp_bundle_compmsg = -1;
static gint ett_rsvp_unknown_class = -1; static gint ett_rsvp_unknown_class = -1;
/* Should we dissect bundle messages? */
static gboolean rsvp_bundle_dissect = TRUE;
/* /*
* RSVP message types. * RSVP message types.
@ -3569,47 +3573,44 @@ dissect_rsvp_gen_uni (proto_tree *ti, tvbuff_t *tvb,
} }
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The main loop * Dissect a single RSVP message in a tree
*------------------------------------------------------------------------------*/ *------------------------------------------------------------------------------*/
static void static void
dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_rsvp_msg_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int tree_mode)
{ {
int offset = 0; proto_tree *rsvp_tree = NULL;
proto_tree *rsvp_tree = NULL, *ti;
proto_tree *rsvp_header_tree; proto_tree *rsvp_header_tree;
proto_tree *rsvp_object_tree; proto_tree *rsvp_object_tree;
guint8 ver_flags; proto_tree *ti;
guint8 message_type;
guint16 cksum, computed_cksum; guint16 cksum, computed_cksum;
vec_t cksum_vec[1]; vec_t cksum_vec[1];
int offset = 0;
int len; int len;
guint8 ver_flags;
guint8 message_type;
int session_off, tempfilt_off;
int msg_length; int msg_length;
int obj_length; int obj_length;
int offset2; int offset2;
int session_off, tempfilt_off;
if (check_col(pinfo->cinfo, COL_PROTOCOL)) offset = 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RSVP"); len = 0;
if (check_col(pinfo->cinfo, COL_INFO)) ver_flags = tvb_get_guint8(tvb, 0);
col_clear(pinfo->cinfo, COL_INFO); msg_length = tvb_get_ntohs(tvb, 6);
message_type = tvb_get_guint8(tvb, 1);
ver_flags = tvb_get_guint8(tvb, offset+0);
message_type = tvb_get_guint8(tvb, offset+1);
if (check_col(pinfo->cinfo, COL_INFO)) {
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(message_type, message_type_vals, "Unknown (%u). "));
find_rsvp_session_tempfilt(tvb, offset, &session_off, &tempfilt_off);
if (session_off)
col_append_str(pinfo->cinfo, COL_INFO, summary_session(tvb, session_off));
if (tempfilt_off)
col_append_str(pinfo->cinfo, COL_INFO, summary_template(tvb, tempfilt_off));
}
if (tree) {
msg_length = tvb_get_ntohs(tvb, offset+6);
ti = proto_tree_add_item(tree, proto_rsvp, tvb, offset, msg_length, ti = proto_tree_add_item(tree, proto_rsvp, tvb, offset, msg_length,
FALSE); FALSE);
rsvp_tree = proto_item_add_subtree(ti, ett_rsvp); rsvp_tree = proto_item_add_subtree(ti, tree_mode);
proto_item_append_text(rsvp_tree, ": ");
proto_item_append_text(rsvp_tree, val_to_str(message_type, message_type_vals,
"Unknown (%u). "));
find_rsvp_session_tempfilt(tvb, 0, &session_off, &tempfilt_off);
if (session_off)
proto_item_append_text(rsvp_tree, summary_session(tvb, session_off));
if (tempfilt_off)
proto_item_append_text(rsvp_tree, summary_template(tvb, tempfilt_off));
ti = proto_tree_add_text(rsvp_tree, tvb, offset, 8, "RSVP Header. %s", ti = proto_tree_add_text(rsvp_tree, tvb, offset, 8, "RSVP Header. %s",
val_to_str(message_type, message_type_vals, val_to_str(message_type, message_type_vals,
@ -3674,8 +3675,28 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_text(rsvp_header_tree, tvb, offset+6, 2, proto_tree_add_text(rsvp_header_tree, tvb, offset+6, 2,
"Message length: %u", msg_length); "Message length: %u", msg_length);
offset += 8; offset = 8;
len = 8; len = 8;
if (message_type == RSVP_MSG_BUNDLE) {
/* Bundle message. Dissect component messages */
if (rsvp_bundle_dissect) {
int len = 8;
while (len < msg_length) {
gint sub_len;
tvbuff_t *tvb_sub;
sub_len = tvb_get_ntohs(tvb, len+6);
tvb_sub = tvb_new_subset(tvb, len, sub_len, sub_len);
dissect_rsvp_msg_tree(tvb_sub, pinfo, rsvp_tree, ett_rsvp_bundle_compmsg);
len += sub_len;
}
} else {
proto_tree_add_text(rsvp_tree, tvb, offset, msg_length - len,
"Bundle Component Messages Not Dissected");
}
return;
}
while (len < msg_length) { while (len < msg_length) {
guint8 class; guint8 class;
guint8 type; guint8 type;
@ -3817,7 +3838,71 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += obj_length; offset += obj_length;
len += obj_length; len += obj_length;
} }
}
/*------------------------------------------------------------------------------
* The main loop
*------------------------------------------------------------------------------*/
static void
dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint8 ver_flags;
guint8 message_type;
int msg_length;
int session_off, tempfilt_off;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RSVP");
if (check_col(pinfo->cinfo, COL_INFO))
col_clear(pinfo->cinfo, COL_INFO);
ver_flags = tvb_get_guint8(tvb, 0);
message_type = tvb_get_guint8(tvb, 1);
msg_length = tvb_get_ntohs(tvb, 6);
if (check_col(pinfo->cinfo, COL_INFO)) {
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(message_type, message_type_vals, "Unknown (%u). "));
find_rsvp_session_tempfilt(tvb, 0, &session_off, &tempfilt_off);
if (session_off)
col_append_str(pinfo->cinfo, COL_INFO, summary_session(tvb, session_off));
if (tempfilt_off)
col_append_str(pinfo->cinfo, COL_INFO, summary_template(tvb, tempfilt_off));
} }
if (check_col(pinfo->cinfo, COL_INFO)) {
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(message_type, message_type_vals, "Unknown (%u). "));
if (message_type == RSVP_MSG_BUNDLE) {
col_add_str(pinfo->cinfo, COL_INFO,
rsvp_bundle_dissect ?
"Component Messages Dissected" :
"Component Messages Not Dissected");
} else {
find_rsvp_session_tempfilt(tvb, 0, &session_off, &tempfilt_off);
if (session_off)
col_append_str(pinfo->cinfo, COL_INFO, summary_session(tvb, session_off));
if (tempfilt_off)
col_append_str(pinfo->cinfo, COL_INFO, summary_template(tvb, tempfilt_off));
}
}
if (tree) {
dissect_rsvp_msg_tree(tvb, pinfo, tree, ett_rsvp);
}
}
static void
register_rsvp_prefs (void)
{
module_t *rsvp_module;
rsvp_module = prefs_register_protocol(proto_rsvp, NULL);
prefs_register_bool_preference(
rsvp_module, "rsvp_process_bundle",
"Dissect sub-messages in BUNDLE message",
"Specifies whether Ethereal should decode and display sub-messages within BUNDLE messages",
&rsvp_bundle_dissect);
} }
void void
@ -3860,6 +3945,7 @@ proto_register_rsvp(void)
&ett_rsvp_admin_status_flags, &ett_rsvp_admin_status_flags,
&ett_rsvp_gen_uni, &ett_rsvp_gen_uni,
&ett_rsvp_gen_uni_subobj, &ett_rsvp_gen_uni_subobj,
&ett_rsvp_bundle_compmsg,
&ett_rsvp_unknown_class, &ett_rsvp_unknown_class,
}; };
@ -3867,6 +3953,7 @@ proto_register_rsvp(void)
"RSVP", "rsvp"); "RSVP", "rsvp");
proto_register_field_array(proto_rsvp, rsvpf_info, array_length(rsvpf_info)); proto_register_field_array(proto_rsvp, rsvpf_info, array_length(rsvpf_info));
proto_register_subtree_array(ett, array_length(ett)); proto_register_subtree_array(ett, array_length(ett));
register_rsvp_prefs();
} }
void void