2 * Routines for dcerpc endpoint mapper dissection
3 * Copyright 2001, Todd Sabin <tas@webspan.net>
5 * $Id: packet-dcerpc-epm.c,v 1.4 2002/01/21 07:36:33 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #ifdef HAVE_SYS_TYPES_H
32 #include <sys/types.h>
38 #include <epan/packet.h>
39 #include "packet-dcerpc.h"
42 static int proto_epm = -1;
44 static int hf_epm_inquiry_type = -1;
45 static int hf_epm_object_p = -1;
46 static int hf_epm_object = -1;
47 static int hf_epm_if_id_p = -1;
48 static int hf_epm_if_id = -1;
49 static int hf_epm_ver_maj = -1;
50 static int hf_epm_ver_min = -1;
51 static int hf_epm_ver_opt = -1;
52 static int hf_epm_lookup_hnd = -1;
53 static int hf_epm_max_ents = -1;
54 static int hf_epm_num_ents = -1;
56 static gint ett_epm = -1;
59 static e_uuid_t uuid_epm = { 0xe1af8308, 0x5d1f, 0x11c9, { 0x91, 0xa4, 0x08, 0x00, 0x2b, 0x14, 0xa0, 0xfa } };
60 static guint16 ver_epm = 3;
64 epm_dissect_ept_lookup_rqst (tvbuff_t *tvb, int offset,
65 packet_info *pinfo, proto_tree *tree,
69 offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
70 hf_epm_inquiry_type, NULL);
71 offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
72 hf_epm_object_p, &dummy);
74 offset = dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep,
77 offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
78 hf_epm_if_id_p, &dummy);
80 offset = dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep,
82 offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
83 hf_epm_ver_maj, NULL);
84 offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep,
85 hf_epm_ver_min, NULL);
87 offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
88 hf_epm_ver_opt, NULL);
90 proto_tree_add_bytes (tree, hf_epm_lookup_hnd, tvb, offset, 20,
91 tvb_get_ptr (tvb, offset, 20));
95 offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
96 hf_epm_max_ents, NULL);
102 epm_dissect_ept_lookup_resp (tvbuff_t *tvb, int offset,
103 packet_info *pinfo, proto_tree *tree,
109 offset = dissect_ndr_ctx_hnd (tvb, offset, pinfo, tree, drep,
110 hf_epm_lookup_hnd, NULL);
112 offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
113 hf_epm_num_ents, NULL);
114 /* FIXME: more to do here */
119 static dcerpc_sub_dissector epm_dissectors[] = {
120 { 0, "ept_insert", NULL, NULL },
121 { 1, "ept_delete", NULL, NULL },
122 { 2, "ept_lookup", epm_dissect_ept_lookup_rqst, epm_dissect_ept_lookup_resp },
123 { 3, "ept_map", NULL, NULL },
124 { 4, "ept_lookup_handle_free", NULL, NULL },
125 { 5, "ept_inq_object", NULL, NULL },
126 { 6, "ept_mgmt_delete", NULL, NULL },
127 { 0, NULL, NULL, NULL },
132 proto_register_epm (void)
134 static hf_register_info hf[] = {
135 { &hf_epm_inquiry_type,
136 { "Inquiry type", "epm.inq_type", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
138 { "Object pointer", "epm.object_p", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
140 { "Object", "epm.object", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }},
142 { "Interface pointer", "epm.if_id_p", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
144 { "Interface", "epm.if_id", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }},
146 { "Version Major", "epm.ver_maj", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
148 { "Version Minor", "epm.ver_min", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
150 { "Version Option", "epm.ver_opt", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
151 { &hf_epm_lookup_hnd,
152 { "Lookup Handle", "epm.lookup_hnd", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL }},
154 { "Max entries", "epm.max_ents", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
156 { "Num entries", "epm.num_ents", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},
159 static gint *ett[] = {
162 proto_epm = proto_register_protocol ("DCE/RPC Endpoint Mapper", "EPM", "epm");
163 proto_register_field_array (proto_epm, hf, array_length (hf));
164 proto_register_subtree_array (ett, array_length (ett));
168 proto_reg_handoff_epm (void)
170 /* Register the protocol as dcerpc */
171 dcerpc_init_uuid (proto_epm, ett_epm, &uuid_epm, ver_epm, epm_dissectors);