2 * Routines for DCERPC over SMB packet disassembly
3 * Copyright 2001-2003 Tim Potter <tpot@samba.org>
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.
26 #ifndef __PACKET_DCERPC_NT_H
27 #define __PACKET_DCERPC_NT_H
30 * ett_ value for Unicode strings.
32 extern gint ett_nt_unicode_string;
35 * Platform ID values, used by several dissectors.
37 extern const value_string platform_id_vals[];
39 /* Routines for handling deferral of referants in NDR */
41 #define ALIGN_TO_8_BYTES \
42 { dcerpc_info *xzdi; \
43 xzdi=pinfo->private_data; \
44 if(!xzdi->conformant_run) { \
46 offset=(offset&0xfffffff8)+8; \
50 #define ALIGN_TO_4_BYTES \
51 { dcerpc_info *xzdi; \
52 xzdi=pinfo->private_data; \
53 if(!xzdi->conformant_run) { \
55 offset=(offset&0xfffffffc)+4; \
59 #define ALIGN_TO_2_BYTES \
60 { dcerpc_info *xzdi; \
61 xzdi=pinfo->private_data; \
62 if(!xzdi->conformant_run) { \
64 offset=(offset&0xfffffffe)+2; \
70 dissect_ndr_counted_string_cb(tvbuff_t *tvb, int offset,
71 packet_info *pinfo, proto_tree *tree,
72 guint8 *drep, int hf_index,
73 dcerpc_callback_fnct_t *callback,
77 dissect_ndr_counted_string_ptr(tvbuff_t *tvb, int offset,
78 packet_info *pinfo, proto_tree *parent_tree,
82 dissect_ndr_counted_string(tvbuff_t *tvb, int offset,
83 packet_info *pinfo, proto_tree *parent_tree,
84 guint8 *drep, int hf_index, int levels);
87 dissect_ndr_counted_byte_array(tvbuff_t *tvb, int offset,
88 packet_info *pinfo, proto_tree *parent_tree,
89 guint8 *drep, int hf_index);
92 dissect_ndr_counted_byte_array_cb(tvbuff_t *tvb, int offset,
93 packet_info *pinfo, proto_tree *tree,
94 guint8 *drep, int hf_index,
95 dcerpc_callback_fnct_t *callback,
99 dissect_ndr_nt_acct_ctrl(tvbuff_t *tvb, int offset, packet_info *pinfo,
100 proto_tree *parent_tree, guint8 *drep);
102 dissect_ndr_nt_NTTIME (tvbuff_t *tvb, int offset,
103 packet_info *pinfo, proto_tree *tree,
104 guint8 *drep, int hf_index);
106 dissect_ndr_nt_LOGON_HOURS(tvbuff_t *tvb, int offset,
107 packet_info *pinfo, proto_tree *parent_tree,
110 dissect_ndr_nt_SID(tvbuff_t *tvb, int offset,
111 packet_info *pinfo, proto_tree *tree,
114 dissect_ndr_nt_PSID(tvbuff_t *tvb, int offset,
115 packet_info *pinfo, proto_tree *parent_tree,
118 dissect_ndr_nt_PSID_ARRAY(tvbuff_t *tvb, int offset,
119 packet_info *pinfo, proto_tree *parent_tree,
123 dissect_ndr_nt_SID_AND_ATTRIBUTES_ARRAY(tvbuff_t *tvb, int offset,
124 packet_info *pinfo, proto_tree *parent_tree,
127 dissect_ndr_nt_SID_AND_ATTRIBUTES(tvbuff_t *tvb, int offset,
128 packet_info *pinfo, proto_tree *parent_tree,
132 * Policy handle hashing
135 /* Store open and close packet numbers for a policy handle */
138 dcerpc_smb_store_pol_pkts(e_ctx_hnd *policy_hnd, packet_info *pinfo,
139 gboolean is_open, gboolean is_close);
141 /* Store a name with a policy handle */
144 dcerpc_smb_store_pol_name(e_ctx_hnd *policy_hnd, packet_info *pinfo,
147 /* Fetch details stored with a policy handle */
150 dcerpc_smb_fetch_pol(e_ctx_hnd *policy_hnd, char **name,
151 guint32 *open_frame, guint32 *close_frame,
154 /* Dissect NT specific things */
157 dissect_ntstatus(tvbuff_t *tvb, gint offset, packet_info *pinfo,
158 proto_tree *tree, guint8 *drep,
159 int hfindex, guint32 *pdata);
162 dissect_doserror(tvbuff_t *tvb, gint offset, packet_info *pinfo,
163 proto_tree *tree, guint8 *drep,
164 int hfindex, guint32 *pdata);
167 dissect_nt_policy_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
168 proto_tree *tree, guint8 *drep, int hfindex,
169 e_ctx_hnd *pdata, proto_item **pitem,
170 gboolean is_open, gboolean is_close);
173 dissect_nt_GUID(tvbuff_t *tvb, int offset,
174 packet_info *pinfo, proto_tree *parent_tree,
178 dissect_nt_LUID(tvbuff_t *tvb, int offset,
179 packet_info *pinfo, proto_tree *tree,
182 /* Stored here instead of packet-dcerpc{,-ndr}.c as they are probably not
183 official NDR representations. */
185 int dissect_dcerpc_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
186 proto_tree *tree, guint8 *drep,
187 int hfindex, int length, const guint8 **pdata);
189 int dissect_ndr_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
190 proto_tree *tree, guint8 *drep,
191 int hfindex, int length, const guint8 **pdata);
193 int dissect_dcerpc_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
194 proto_tree *tree, guint8 *drep,
195 int hfindex, int length);
197 int dissect_ndr_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
198 proto_tree *tree, guint8 *drep,
199 int hfindex, int length);
201 int dissect_ndr_str_pointer_item(tvbuff_t *tvb, gint offset,
202 packet_info *pinfo, proto_tree *tree,
203 guint8 *drep, int type, char *text,
204 int hf_index, int levels);
207 * Helper routines for dissecting NDR strings
210 /* Number of levels to go up appending string to pointer item */
211 #define CB_STR_ITEM_LEVELS(x) ((x) & 0xFFFF)
212 #define CB_STR_COL_INFO 0x10000 /* Append string to COL_INFO */
213 #define CB_STR_SAVE 0x20000 /* Save string to dcv->private_data */
215 void cb_wstr_postprocess(packet_info *pinfo, proto_tree *tree _U_,
216 proto_item *item, tvbuff_t *tvb,
217 int start_offset, int end_offset,
218 void *callback_args);
219 void cb_str_postprocess(packet_info *pinfo, proto_tree *tree _U_,
220 proto_item *item, tvbuff_t *tvb,
221 int start_offset, int end_offset,
222 void *callback_args);
224 /* Initialise DCERPC over SMB */
226 void dcerpc_smb_init(int proto_dcerpc);
228 #endif /* packet-dcerpc-nt.h */