aboutsummaryrefslogtreecommitdiffstats
path: root/packet-rpc.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-05-07 20:36:39 +0000
committerGuy Harris <guy@alum.mit.edu>2001-05-07 20:36:39 +0000
commit6ca59937d8fd2487a38a2d34db353560e7a2e048 (patch)
treee6b449c7b6c0731b2a870bfa2a79f4d32f840f41 /packet-rpc.c
parentb9580ae826671fdf055ecd29486f6583e228a718 (diff)
downloadwireshark-6ca59937d8fd2487a38a2d34db353560e7a2e048.tar.gz
wireshark-6ca59937d8fd2487a38a2d34db353560e7a2e048.tar.bz2
wireshark-6ca59937d8fd2487a38a2d34db353560e7a2e048.zip
Support for dissecting XDR arrays, from Ronnie Sahlberg.
svn path=/trunk/; revision=3400
Diffstat (limited to 'packet-rpc.c')
-rw-r--r--packet-rpc.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/packet-rpc.c b/packet-rpc.c
index 6e99670966..d1d0fb7559 100644
--- a/packet-rpc.c
+++ b/packet-rpc.c
@@ -2,7 +2,7 @@
* Routines for rpc dissection
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
*
- * $Id: packet-rpc.c,v 1.56 2001/04/18 20:27:42 guy Exp $
+ * $Id: packet-rpc.c,v 1.57 2001/05/07 20:36:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -166,6 +166,7 @@ static int hf_rpc_dup = -1;
static int hf_rpc_call_dup = -1;
static int hf_rpc_reply_dup = -1;
static int hf_rpc_value_follows = -1;
+static int hf_rpc_array_len = -1;
static gint ett_rpc = -1;
static gint ett_rpc_string = -1;
@@ -173,6 +174,7 @@ static gint ett_rpc_cred = -1;
static gint ett_rpc_verf = -1;
static gint ett_rpc_gids = -1;
static gint ett_rpc_gss_data = -1;
+static gint ett_rpc_array = -1;
/* Hash table with info on RPC program numbers */
static GHashTable *rpc_progs;
@@ -789,6 +791,42 @@ dissect_rpc_list_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
return offset;
}
+int
+dissect_rpc_array_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, dissect_function_t *rpc_array_dissector,
+ int hfindex)
+{
+ proto_item* lock_item;
+ proto_tree* lock_tree;
+ guint32 num;
+ int old_offset = offset;
+
+ num = tvb_get_ntohl(tvb, offset);
+
+ if( num == 0 ){
+ proto_tree_add_none_format(tree, hfindex, tvb, offset, 4,
+ "no values");
+ offset += 4;
+
+ return offset;
+ }
+
+ lock_item = proto_tree_add_item(tree, hfindex, tvb, offset,
+ 0, FALSE);
+
+ lock_tree = proto_item_add_subtree(lock_item, ett_rpc_array);
+
+ offset = dissect_rpc_uint32_tvb(tvb, pinfo, lock_tree,
+ hf_rpc_array_len, offset);
+
+ while (num--) {
+ offset = rpc_array_dissector(tvb, offset, pinfo, lock_tree);
+ }
+
+ proto_item_set_len(lock_item, offset-old_offset);
+ return offset;
+}
+
static int
dissect_rpc_authunix_cred(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, int offset)
{
@@ -2066,7 +2104,10 @@ proto_register_rpc(void)
NULL, 0, "Duplicate Reply" }},
{ &hf_rpc_value_follows, {
"Value Follows", "rpc.value_follows", FT_BOOLEAN, BASE_NONE,
- &yesno, 0, "Value Follows" }}
+ &yesno, 0, "Value Follows" }},
+ { &hf_rpc_array_len, {
+ "num", "rpc.array.len", FT_UINT32, BASE_DEC,
+ NULL, 0, "Length of RPC array" }},
};
static gint *ett[] = {
&ett_rpc,
@@ -2074,6 +2115,7 @@ proto_register_rpc(void)
&ett_rpc_cred,
&ett_rpc_verf,
&ett_rpc_gids,
+ &ett_rpc_array,
};
proto_rpc = proto_register_protocol("Remote Procedure Call",