aboutsummaryrefslogtreecommitdiffstats
path: root/packet-dcerpc.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-06-26 04:30:31 +0000
committerTim Potter <tpot@samba.org>2003-06-26 04:30:31 +0000
commit623f5b865d67fbdd54811628579feac4226c5a0b (patch)
tree6693a34e2ad66d7b8e9a1c29a3cb6ef9d391dd18 /packet-dcerpc.c
parent599a7bfd3968aefe1f38b52f7cded11a6367b2f9 (diff)
Dynamically create DCERPC opnum value_strings from the subdissector
list rather than duplicating this information in the dissector. Some of the opnum strings were starting to get out of date as developers forgot to update the information in both places. svn path=/trunk/; revision=7936
Diffstat (limited to 'packet-dcerpc.c')
-rw-r--r--packet-dcerpc.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/packet-dcerpc.c b/packet-dcerpc.c
index e8f4200a1b..2dfa8b26e6 100644
--- a/packet-dcerpc.c
+++ b/packet-dcerpc.c
@@ -2,7 +2,7 @@
* Routines for DCERPC packet disassembly
* Copyright 2001, Todd Sabin <tas@webspan.net>
*
- * $Id: packet-dcerpc.c,v 1.132 2003/06/19 10:01:49 guy Exp $
+ * $Id: packet-dcerpc.c,v 1.133 2003/06/26 04:30:31 tpot Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -524,6 +524,28 @@ dcerpc_get_proto_name(e_uuid_t *uuid, guint16 ver)
return sub_proto->name;
}
+/* Create a value_string consisting of DCERPC opnum and name from a
+ subdissector array. */
+
+value_string *value_string_from_subdissectors(dcerpc_sub_dissector *sd,
+ int num_sds)
+{
+ value_string *vs;
+ int i;
+
+ vs = g_malloc((num_sds + 1) * sizeof(value_string));
+
+ for (i = 0; i < num_sds; i++) {
+ vs[i].value = sd[i].num;
+ vs[i].strptr = sd[i].name;
+ }
+
+ vs[num_sds].value = 0;
+ vs[num_sds].strptr = NULL;
+
+ return vs;
+}
+
/* Function to find the subdissector table of a registered protocol
* or NULL if the protocol/version is not known to ethereal.
*/