From 623f5b865d67fbdd54811628579feac4226c5a0b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 26 Jun 2003 04:30:31 +0000 Subject: 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 --- packet-dcerpc-mgmt.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'packet-dcerpc-mgmt.c') diff --git a/packet-dcerpc-mgmt.c b/packet-dcerpc-mgmt.c index 372001c9c8..3562fb5802 100644 --- a/packet-dcerpc-mgmt.c +++ b/packet-dcerpc-mgmt.c @@ -2,7 +2,7 @@ * Routines for dcerpc mgmt dissection * Copyright 2001, Todd Sabin * - * $Id: packet-dcerpc-mgmt.c,v 1.5 2002/08/02 23:35:48 jmayer Exp $ + * $Id: packet-dcerpc-mgmt.c,v 1.6 2003/06/26 04:30:28 tpot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -36,6 +36,7 @@ static int proto_mgmt = -1; +static int hf_opnum = -1; static gint ett_mgmt = -1; @@ -57,24 +58,31 @@ static dcerpc_sub_dissector mgmt_dissectors[] = { void proto_register_mgmt (void) { -#if 0 static hf_register_info hf[] = { + { &hf_opnum, + { "Operation", "mgmt.opnum", FT_UINT16, BASE_DEC, + NULL, 0x0, "", HFILL }}, }; -#endif static gint *ett[] = { &ett_mgmt }; proto_mgmt = proto_register_protocol ("DCE/RPC Remote Management", "MGMT", "mgmt"); -#if 0 proto_register_field_array (proto_mgmt, hf, array_length (hf)); -#endif proto_register_subtree_array (ett, array_length (ett)); } void proto_reg_handoff_mgmt (void) { + header_field_info *hf_info; + /* Register the protocol as dcerpc */ - dcerpc_init_uuid (proto_mgmt, ett_mgmt, &uuid_mgmt, ver_mgmt, mgmt_dissectors, -1); + dcerpc_init_uuid (proto_mgmt, ett_mgmt, &uuid_mgmt, ver_mgmt, mgmt_dissectors, hf_opnum); + + /* Set opnum strings from subdissector list */ + + hf_info = proto_registrar_get_nth(hf_opnum); + hf_info->strings = value_string_from_subdissectors( + mgmt_dissectors, array_length(mgmt_dissectors)); } -- cgit v1.2.3