diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-02-18 02:24:51 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-02-18 02:24:51 +0000 |
commit | 29ef39f7042e90b6c4cfb73f0db98d2bd2a9df42 (patch) | |
tree | 41b8048ca55a24a34438aac9aca43518f017685f /packet-giop.c | |
parent | 2222b7c0012d228b97596775824c470cb7375a08 (diff) |
Add a function to dissect service contexts whose values don't
necessarily use the section 15.3.3 encapsulation rules, and use that to
dissect service contexts with unknown IDs.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7163 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-giop.c')
-rw-r--r-- | packet-giop.c | 112 |
1 files changed, 78 insertions, 34 deletions
diff --git a/packet-giop.c b/packet-giop.c index 01242fac6a..6af348d58b 100644 --- a/packet-giop.c +++ b/packet-giop.c @@ -9,7 +9,7 @@ * Frank Singleton <frank.singleton@ericsson.com> * Trevor Shepherd <eustrsd@am1.ericsson.se> * - * $Id: packet-giop.c,v 1.70 2003/02/18 02:03:29 guy Exp $ + * $Id: packet-giop.c,v 1.71 2003/02/18 02:24:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -4696,6 +4696,46 @@ static void decode_UnknownServiceContext(tvbuff_t *tvb, proto_tree *tree, int *o g_free(p_context_data); } +static guint32 decode_UnencodedServiceContext(tvbuff_t *tvb, proto_tree *tree, + int *offset, + gboolean stream_is_big_endian, + guint32 boundary){ + + guint32 seqlen; /* sequence length */ + gchar *p_context_data; + gchar *context_data; + + /* Get sequence length of parameter list */ + seqlen = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); + if (tree) { + proto_tree_add_uint(tree,hf_giop_sequence_length,tvb, + *offset-sizeof(seqlen),4,seqlen); + } + + /* + * Decode sequence according to vendor ServiceId, but I don't + * have that yet, so just dump it as data. + */ + + /* fetch all octets in this sequence */ + + get_CDR_octet_seq(tvb, &context_data, offset, seqlen); + + /* Make a printable string */ + + p_context_data = make_printable_string( context_data, seqlen ); + + if(tree) { + proto_tree_add_text (tree, tvb, *offset - seqlen, seqlen, + "context_data: %s", p_context_data); + } + + g_free(context_data); + g_free(p_context_data); + + return seqlen; +} + /* * Corba , chp 13.7 * @@ -4793,40 +4833,43 @@ void decode_ServiceContextList(tvbuff_t *tvb, proto_tree *ptree, int *offset, sub_tree1 = proto_item_add_subtree (tf_st1, ett_giop_scl_st1); } - /* See CORBA 3.0.2 standard, section Section 15.3.3 "Encapsulation", - * for how CDR types can be marshalled into a sequence<octet>. - * The first octet in the sequence determines endian order, - * 0 == big-endian, 1 == little-endian - */ + if( vscid != 0 || scid > max_service_context_id ) { + seqlen_cd = decode_UnencodedServiceContext(tvb, sub_tree1, offset, + stream_is_be, boundary); + if (tf_st1) + proto_item_set_len(tf_st1, sizeof(seqlen_cd) + seqlen_cd); + } else { + /* See CORBA 3.0.2 standard, section Section 15.3.3 "Encapsulation", + * for how CDR types can be marshalled into a sequence<octet>. + * The first octet in the sequence determines endian order, + * 0 == big-endian, 1 == little-endian + */ - /* get sequence length, new endianness and boundary for encapsulation */ - seqlen_cd = get_CDR_encap_info(tvb, sub_tree1, offset, - stream_is_be, boundary, - &encapsulation_is_be, &encapsulation_boundary); - if (tf_st1) - proto_item_set_len(tf_st1, sizeof(seqlen_cd) + seqlen_cd); - - if (seqlen_cd == 0) - continue; - - /* "get_CDR_encap_info()" has already processed the byte order octet, - * so "*offset" points past it; however, "seqlen_cd" includes the - * byte order offset, so update it not to include it, so that - * "seqlen_cd" refers to the amount of data remaining in the - * encapsulation starting at the offset "*offset". - */ - seqlen_cd -= 1; + /* get sequence length, new endianness and boundary for encapsulation */ + seqlen_cd = get_CDR_encap_info(tvb, sub_tree1, offset, + stream_is_be, boundary, + &encapsulation_is_be, + &encapsulation_boundary); + if (tf_st1) + proto_item_set_len(tf_st1, sizeof(seqlen_cd) + seqlen_cd); + + if (seqlen_cd == 0) + continue; + + /* "get_CDR_encap_info()" has already processed the byte order octet, + * so "*offset" points past it; however, "seqlen_cd" includes the + * byte order offset, so update it not to include it, so that + * "seqlen_cd" refers to the amount of data remaining in the + * encapsulation starting at the offset "*offset". + */ + seqlen_cd -= 1; - if (seqlen_cd == 0) - continue; /* what is the byte order of one hand clapping? */ + if (seqlen_cd == 0) + continue; /* what is the byte order of one hand clapping? */ - /* Save the offset of the start of the encapsulated data */ - encap_start_offset = *offset; + /* Save the offset of the start of the encapsulated data */ + encap_start_offset = *offset; - /* The OMG has vscid of 0 reserved */ - if( vscid != 0 || scid > max_service_context_id ) { - decode_UnknownServiceContext(tvb, tree, offset, seqlen_cd); - } else { switch(scid) { case 1: /* CodeSets */ @@ -4842,10 +4885,11 @@ void decode_ServiceContextList(tvbuff_t *tvb, proto_tree *ptree, int *offset, decode_UnknownServiceContext(tvb, sub_tree1, offset, seqlen_cd); break; } - } - /* Skip past the end of the encapsulated data */ - *offset = encap_start_offset + seqlen_cd; + /* Skip past the end of the encapsulated data */ + *offset = encap_start_offset + seqlen_cd; + + } } /* for seqlen */ |