aboutsummaryrefslogtreecommitdiffstats
path: root/packet-rpc.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-10-23 21:17:03 +0000
committerGuy Harris <guy@alum.mit.edu>2002-10-23 21:17:03 +0000
commitd5f34ad8b2c85b08bfdadc3c021c0f24b34cdfbc (patch)
treec89f8870831ade2133bd93de09ca10833fa33f5d /packet-rpc.c
parent6cfdb3c0ed0f3879f238608aed5773ae367d8719 (diff)
Add an extra argument to "rpc_init_proc_table()" that can specify an hf_
value for a field to be used for the procedure number for that version of the protocol; use that field, if specified, instead of just putting in a generic "rpc.procedure" field. Have the ypserv dissector register those fields and supply them to "rpc_init_proc_table()". Supply -1 for other RPC programs (for now), meaning "no such field exists". svn path=/trunk/; revision=6486
Diffstat (limited to 'packet-rpc.c')
-rw-r--r--packet-rpc.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/packet-rpc.c b/packet-rpc.c
index 363ad3f315..128276d146 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.104 2002/09/04 09:40:24 sahlberg Exp $
+ * $Id: packet-rpc.c,v 1.105 2002/10/23 21:17:03 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -265,10 +265,24 @@ rpc_proc_hash(gconstpointer k)
/* insert some entries */
void
-rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table)
+rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table,
+ int procedure_hf)
{
+ rpc_prog_info_key rpc_prog_key;
+ rpc_prog_info_value *rpc_prog;
const vsff *proc;
+ /*
+ * Add the operation number hfinfo value for this version of the
+ * program.
+ */
+ rpc_prog_key.prog = prog;
+ rpc_prog = g_hash_table_lookup(rpc_progs, &rpc_prog_key);
+ g_assert(rpc_prog != NULL);
+ rpc_prog->procedure_hfs = g_array_set_size(rpc_prog->procedure_hfs,
+ vers);
+ g_array_insert_val(rpc_prog->procedure_hfs, vers, procedure_hf);
+
for (proc = proc_table ; proc->strptr!=NULL; proc++) {
rpc_proc_info_key *key;
rpc_proc_info_value *value;
@@ -354,6 +368,7 @@ rpc_init_prog(int proto, guint32 prog, int ett)
value->proto = proto;
value->ett = ett;
value->progname = proto_get_protocol_short_name(proto);
+ value->procedure_hfs = g_array_new(FALSE, TRUE, sizeof (int));
g_hash_table_insert(rpc_progs,key,value);
}
@@ -1442,6 +1457,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
unsigned int gss_svc = 0;
int proto = 0;
int ett = 0;
+ int procedure_hf;
unsigned int reply_state;
unsigned int accept_state;
@@ -2084,9 +2100,15 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (ptree) {
proto_tree_add_uint(ptree,
hf_rpc_programversion, tvb, 0, 0, vers);
- proto_tree_add_uint_format(ptree,
- hf_rpc_procedure, tvb, 0, 0, proc,
- "Procedure: %s (%u)", procname, proc);
+ procedure_hf = g_array_index(rpc_prog->procedure_hfs, int, vers);
+ if (procedure_hf != 0 && procedure_hf != -1) {
+ proto_tree_add_uint(ptree,
+ procedure_hf, tvb, 0, 0, proc);
+ } else {
+ proto_tree_add_uint_format(ptree,
+ hf_rpc_procedure, tvb, 0, 0, proc,
+ "Procedure: %s (%u)", procname, proc);
+ }
}
}