Support for dissecting XDR arrays, from Ronnie Sahlberg.

svn path=/trunk/; revision=3400
This commit is contained in:
Guy Harris 2001-05-07 20:36:39 +00:00
parent b9580ae826
commit 6ca59937d8
3 changed files with 49 additions and 3 deletions

View File

@ -507,6 +507,7 @@ Ronnie Sahlberg <rsahlber@bigpond.net.au> {
KLM support
SPRAY support
rquota support completed
XDR array support
}
Borosa Tomislav <tomislav.borosa@SIEMENS.HR> {

View File

@ -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",

View File

@ -1,6 +1,6 @@
/* packet-rpc.h
*
* $Id: packet-rpc.h,v 1.26 2001/02/09 07:59:00 guy Exp $
* $Id: packet-rpc.h,v 1.27 2001/05/07 20:36:39 guy Exp $
*
* (c) 1999 Uwe Girlich
*
@ -113,6 +113,9 @@ extern int dissect_rpc_list(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, old_dissect_function_t *rpc_list_dissector);
extern int dissect_rpc_list_tvb(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, int offset, dissect_function_t *rpc_list_dissector);
extern int dissect_rpc_array_tvb(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, int offset, dissect_function_t *rpc_array_dissector,
int hfindex);
extern int dissect_rpc_uint32(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, char* name);
extern int dissect_rpc_uint32_tvb(tvbuff_t *tvb, packet_info *pinfo,