FIXUP: WIP: verification_trailer
[wireshark-wip.git] / epan / dissectors / packet-dcerpc-mgmt.c
blob190557bf47d1898876399ee050a015d68e2f3266
1 /* packet-dcerpc-mgmt.c
2 * Routines for dcerpc mgmt dissection
3 * Copyright 2001, Todd Sabin <tas@webspan.net>
4 * Copyright 2011, Matthieu Patou <mat@matws.net>
6 * $Id$
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "config.h"
28 #include <stdio.h>
29 #include <glib.h>
30 #include <epan/packet.h>
31 #include "packet-dcerpc.h"
32 #include "packet-dcerpc-nt.h"
35 static int proto_mgmt = -1;
36 static int hf_mgmt_opnum = -1;
37 static int hf_mgmt_proto = -1;
38 static int hf_mgmt_rc = -1;
39 static int hf_mgmt_princ_size = -1;
40 static int hf_mgmt_princ_name = -1;
41 static gint ett_mgmt = -1;
44 static e_uuid_t uuid_mgmt = { 0xafa8bd80, 0x7d8a, 0x11c9, { 0xbe, 0xf4, 0x08, 0x00, 0x2b, 0x10, 0x29, 0x89 } };
45 static guint16 ver_mgmt = 1;
47 static int
48 mgmtrpc_dissect_inq_princ_name_response(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info *di _U_, guint8 *drep _U_)
51 offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, di, drep,
52 sizeof(guint8), hf_mgmt_princ_name, TRUE, NULL);
54 offset = dissect_ntstatus(tvb, offset, pinfo, tree, di, drep, hf_mgmt_rc, NULL);
57 return offset;
59 static int
60 mgmtrpc_dissect_inq_princ_name_request(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info *di _U_, guint8 *drep _U_)
62 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_mgmt_proto, NULL);
63 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_mgmt_princ_size, NULL);
64 return offset;
69 static dcerpc_sub_dissector mgmt_dissectors[] = {
70 { 0, "rpc__mgmt_inq_if_ids", NULL, NULL },
71 { 1, "rpc__mgmt_inq_stats", NULL, NULL },
72 { 2, "rpc__mgmt_is_server_listening", NULL, NULL },
73 { 3, "rpc__mgmt_stop_server_listening", NULL, NULL },
74 { 4, "rpc__mgmt_inq_princ_name", mgmtrpc_dissect_inq_princ_name_request, mgmtrpc_dissect_inq_princ_name_response},
75 { 0, NULL, NULL, NULL }
78 void
79 proto_register_mgmt (void)
81 static hf_register_info hf[] = {
82 { &hf_mgmt_opnum,
83 { "Operation", "mgmt.opnum", FT_UINT16, BASE_DEC,
84 NULL, 0x0, NULL, HFILL }},
85 { &hf_mgmt_proto,
86 {"Authn Proto", "mgmt.proto", FT_UINT32, BASE_HEX,
87 NULL, 0x0, NULL, HFILL }},
88 { &hf_mgmt_princ_name,
89 {"Principal name", "mgmt.princ_name", FT_STRING, BASE_NONE,
90 NULL, 0, NULL, HFILL }},
91 { &hf_mgmt_princ_size,
92 {"Principal size", "mgmt.princ_size", FT_UINT32, BASE_DEC,
93 NULL, 0x0, "Size of principal", HFILL }},
94 { &hf_mgmt_rc,
95 {"Status", "mgmt.rc", FT_UINT32, BASE_HEX,
96 NULL, 0x0, NULL, HFILL }},
99 static gint *ett[] = {
100 &ett_mgmt
102 proto_mgmt = proto_register_protocol ("DCE/RPC Remote Management", "MGMT", "mgmt");
103 proto_register_field_array (proto_mgmt, hf, array_length (hf));
104 proto_register_subtree_array (ett, array_length (ett));
107 void
108 proto_reg_handoff_mgmt (void)
110 /* Register the protocol as dcerpc */
111 dcerpc_init_uuid (proto_mgmt, ett_mgmt, &uuid_mgmt, ver_mgmt, mgmt_dissectors, hf_mgmt_opnum);