2 * Routines for DCERPC over SMB packet disassembly
3 * Copyright 2001-2003 Tim Potter <tpot@samba.org>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
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.
26 #ifndef __PACKET_DCERPC_NT_H
27 #define __PACKET_DCERPC_NT_H
30 * Platform ID values, used by several dissectors.
32 extern const value_string platform_id_vals[];
34 /* Routines for handling deferral of referants in NDR */
36 #define ALIGN_TO_8_BYTES \
37 { dcerpc_info *xzdi; \
38 xzdi=pinfo->private_data; \
39 if(!xzdi->conformant_run) { \
41 offset=(offset&0xfffffff8)+8; \
45 #define ALIGN_TO_4_BYTES \
46 { dcerpc_info *xzdi; \
47 xzdi=pinfo->private_data; \
48 if(!xzdi->conformant_run) { \
50 offset=(offset&0xfffffffc)+4; \
54 #define ALIGN_TO_2_BYTES \
55 { dcerpc_info *xzdi; \
56 xzdi=pinfo->private_data; \
57 if(!xzdi->conformant_run) { \
59 offset=(offset&0xfffffffe)+2; \
64 #define ALIGN_TO_5_BYTES ALIGN_TO_4_OR_8_BYTES
66 #define ALIGN_TO_4_OR_8_BYTES \
67 { dcerpc_info *xzdi2; \
68 xzdi2=pinfo->private_data; \
69 if (xzdi2->call_data->flags & DCERPC_IS_NDR64) { \
78 dissect_ndr_counted_ascii_string_cb(tvbuff_t *tvb, int offset,
79 packet_info *pinfo, proto_tree *tree,
80 guint8 *drep, int hf_index,
81 dcerpc_callback_fnct_t *callback,
84 dissect_ndr_counted_ascii_string(tvbuff_t *tvb, int offset,
85 packet_info *pinfo, proto_tree *tree,
86 guint8 *drep, int hf_index, int levels);
89 dissect_ndr_counted_string_cb(tvbuff_t *tvb, int offset,
90 packet_info *pinfo, proto_tree *tree,
91 guint8 *drep, int hf_index,
92 dcerpc_callback_fnct_t *callback,
96 dissect_ndr_counted_string_ptr(tvbuff_t *tvb, int offset,
97 packet_info *pinfo, proto_tree *parent_tree,
101 dissect_ndr_counted_string(tvbuff_t *tvb, int offset,
102 packet_info *pinfo, proto_tree *parent_tree,
103 guint8 *drep, int hf_index, int levels);
106 dissect_ndr_counted_byte_array(tvbuff_t *tvb, int offset,
107 packet_info *pinfo, proto_tree *parent_tree,
108 guint8 *drep, int hf_index, int levels);
111 dissect_ndr_counted_byte_array_cb(tvbuff_t *tvb, int offset,
112 packet_info *pinfo, proto_tree *tree,
113 guint8 *drep, int hf_index,
114 dcerpc_callback_fnct_t *callback,
115 void *callback_args);
118 dissect_ndr_nt_acct_ctrl(tvbuff_t *tvb, int offset, packet_info *pinfo,
119 proto_tree *parent_tree, guint8 *drep);
122 dissect_nt_GUID(tvbuff_t *tvb, int offset,
123 packet_info *pinfo, proto_tree *tree,
127 dissect_ndr_lsa_String(tvbuff_t *tvb, int offset, packet_info *pinfo,
128 proto_tree *parent_tree, guint8 *drep,
129 guint32 param, int hfindex);
132 dissect_ndr_nt_NTTIME (tvbuff_t *tvb, int offset,
133 packet_info *pinfo, proto_tree *tree,
134 guint8 *drep, int hf_index);
136 dissect_ndr_nt_LOGON_HOURS(tvbuff_t *tvb, int offset,
137 packet_info *pinfo, proto_tree *parent_tree,
140 dissect_ndr_nt_SID(tvbuff_t *tvb, int offset,
141 packet_info *pinfo, proto_tree *tree,
144 dissect_ndr_nt_SID_with_options(tvbuff_t *tvb, int offset,
145 packet_info *pinfo, proto_tree *tree,
146 guint8 *drep, guint32 options);
148 dissect_ndr_nt_PSID(tvbuff_t *tvb, int offset,
149 packet_info *pinfo, proto_tree *parent_tree,
152 dissect_ndr_nt_PSID_ARRAY(tvbuff_t *tvb, int offset,
153 packet_info *pinfo, proto_tree *parent_tree,
157 dissect_ndr_nt_SID_AND_ATTRIBUTES_ARRAY(tvbuff_t *tvb, int offset,
158 packet_info *pinfo, proto_tree *parent_tree,
161 dissect_ndr_nt_SID_AND_ATTRIBUTES(tvbuff_t *tvb, int offset,
162 packet_info *pinfo, proto_tree *parent_tree,
166 * Policy handle hashing
169 /* Store open and close packet numbers for a policy handle */
172 dcerpc_smb_store_pol_pkts(e_ctx_hnd *policy_hnd, packet_info *pinfo,
173 gboolean is_open, gboolean is_close);
175 /* Store a name with a policy handle */
178 dcerpc_store_polhnd_name(e_ctx_hnd *policy_hnd, packet_info *pinfo,
181 /* Fetch details stored with a policy handle */
184 dcerpc_fetch_polhnd_data(e_ctx_hnd *policy_hnd, char **name, guint32 *type,
185 guint32 *open_frame, guint32 *close_frame,
188 /* Dissect NT specific things */
191 dissect_ntstatus(tvbuff_t *tvb, gint offset, packet_info *pinfo,
192 proto_tree *tree, guint8 *drep,
193 int hfindex, guint32 *pdata);
196 dissect_doserror(tvbuff_t *tvb, gint offset, packet_info *pinfo,
197 proto_tree *tree, guint8 *drep,
198 int hfindex, guint32 *pdata);
201 dissect_nt_policy_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
202 proto_tree *tree, guint8 *drep, int hfindex,
203 e_ctx_hnd *pdata, proto_item **pitem,
204 gboolean is_open, gboolean is_close);
207 PIDL_dissect_policy_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
208 proto_tree *tree, guint8 *drep, int hfindex,
212 dissect_nt_guid_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
213 proto_tree *tree, guint8 *drep, int hfindex,
214 e_ctx_hnd *pdata, proto_item **pitem,
215 gboolean is_open, gboolean is_close);
218 dissect_nt_LUID(tvbuff_t *tvb, int offset,
219 packet_info *pinfo, proto_tree *tree,
222 /* Stored here instead of packet-dcerpc{,-ndr}.c as they are probably not
223 official NDR representations. */
225 int dissect_dcerpc_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
226 proto_tree *tree, guint8 *drep,
227 int hfindex, int length, const guint8 **pdata);
229 int dissect_ndr_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
230 proto_tree *tree, guint8 *drep,
231 int hfindex, int length, const guint8 **pdata);
233 int dissect_dcerpc_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
234 proto_tree *tree, guint8 *drep,
235 int hfindex, int length);
237 int dissect_ndr_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
238 proto_tree *tree, guint8 *drep,
239 int hfindex, int length);
241 int dissect_ndr_str_pointer_item(tvbuff_t *tvb, gint offset,
242 packet_info *pinfo, proto_tree *tree,
243 guint8 *drep, int type, const char *text,
244 int hf_index, int levels);
247 * Helper routines for dissecting NDR strings
250 /* Number of levels to go up appending string to pointer item */
251 #define CB_STR_ITEM_LEVELS(x) ((x) & 0xFFFF)
252 #define CB_STR_SAVE 0x20000000 /* Save string to dcv->private_data */
253 #define CB_STR_COL_INFO 0x10000000 /* Append string to COL_INFO */
255 void cb_wstr_postprocess(packet_info *pinfo, proto_tree *tree _U_,
256 proto_item *item, tvbuff_t *tvb,
257 int start_offset, int end_offset,
258 void *callback_args);
259 void cb_str_postprocess(packet_info *pinfo, proto_tree *tree _U_,
260 proto_item *item, tvbuff_t *tvb,
261 int start_offset, int end_offset,
262 void *callback_args);
264 /* Initialise DCERPC over SMB */
266 void dcerpc_smb_init(int proto_dcerpc);
269 #endif /* packet-dcerpc-nt.h */