2 * Routines for DCERPC over SMB packet disassembly
3 * Copyright 2001, Tim Potter <tpot@samba.org>
5 * $Id: packet-dcerpc-nt.h,v 1.30 2002/08/28 21:00:10 jmayer 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.
26 #ifndef __PACKET_DCERPC_NT_H
27 #define __PACKET_DCEPRC_NT_H
30 * ett_ value for Unicode strings.
32 extern gint ett_nt_unicode_string;
34 /* Routines for parsing simple types */
36 int prs_align(int offset, int n);
38 int prs_uint8(tvbuff_t *tvb, int offset, packet_info *pinfo,
39 proto_tree *tree, guint8 *data, char *name);
41 int prs_uint8s(tvbuff_t *tvb, int offset, packet_info *pinfo,
42 proto_tree *tree, int count, int *data_offset, char *name);
44 int prs_uint16(tvbuff_t *tvb, int offset, packet_info *pinfo,
45 proto_tree *tree, guint16 *data, char *name);
47 int prs_uint16s(tvbuff_t *tvb, int offset, packet_info *pinfo,
48 proto_tree *tree, int count, int *data_offset, char *name);
50 int prs_uint32(tvbuff_t *tvb, int offset, packet_info *pinfo,
51 proto_tree *tree, guint32 *data, char *name);
53 int prs_uint32s(tvbuff_t *tvb, int offset, packet_info *pinfo,
54 proto_tree *tree, int count, int *data_offset, char *name);
56 /* Parse NT status code */
58 int prs_ntstatus(tvbuff_t *tvb, int offset, packet_info *pinfo,
61 /* Parse some common RPC structures */
63 char *fake_unicode(tvbuff_t *tvb, int offset, int len);
65 int prs_UNISTR2(tvbuff_t *tvb, int offset, packet_info *pinfo,
66 proto_tree *tree, int flags, char **data, char *name);
68 /* Routines for handling deferral of referants in NDR */
70 #define PARSE_SCALARS 1
71 #define PARSE_BUFFERS 2
73 int prs_push_ptr(tvbuff_t *tvb, int offset, packet_info *pinfo,
74 proto_tree *tree, GList **ptr_list, char *name);
76 guint32 prs_pop_ptr(GList **ptr_list, char *name);
80 #define ALIGN_TO_4_BYTES \
81 { dcerpc_info *xzdi; \
82 xzdi=pinfo->private_data; \
83 if(!xzdi->conformant_run) { \
85 offset=(offset&0xfffffffc)+4; \
91 dissect_ndr_nt_UNICODE_STRING_str(tvbuff_t *tvb, int offset,
92 packet_info *pinfo, proto_tree *tree,
95 dissect_ndr_nt_UNICODE_STRING(tvbuff_t *tvb, int offset,
96 packet_info *pinfo, proto_tree *parent_tree,
97 char *drep, int hf_index, int levels);
99 dissect_ndr_nt_STRING_string (tvbuff_t *tvb, int offset,
100 packet_info *pinfo, proto_tree *tree,
103 dissect_ndr_nt_STRING (tvbuff_t *tvb, int offset,
104 packet_info *pinfo, proto_tree *parent_tree,
105 char *drep, int hf_index, int levels);
107 dissect_ndr_nt_acct_ctrl(tvbuff_t *tvb, int offset, packet_info *pinfo,
108 proto_tree *parent_tree, char *drep);
110 dissect_ndr_nt_NTTIME (tvbuff_t *tvb, int offset,
111 packet_info *pinfo, proto_tree *tree,
112 char *drep, int hf_index);
114 dissect_ndr_nt_LOGON_HOURS(tvbuff_t *tvb, int offset,
115 packet_info *pinfo, proto_tree *parent_tree,
118 dissect_ndr_nt_SID(tvbuff_t *tvb, int offset,
119 packet_info *pinfo, proto_tree *tree,
122 dissect_ndr_nt_PSID(tvbuff_t *tvb, int offset,
123 packet_info *pinfo, proto_tree *parent_tree,
126 dissect_ndr_nt_PSID_ARRAY(tvbuff_t *tvb, int offset,
127 packet_info *pinfo, proto_tree *parent_tree,
131 dissect_ndr_nt_SID_AND_ATTRIBUTES_ARRAY(tvbuff_t *tvb, int offset,
132 packet_info *pinfo, proto_tree *parent_tree,
135 dissect_ndr_nt_SID_AND_ATTRIBUTES(tvbuff_t *tvb, int offset,
136 packet_info *pinfo, proto_tree *parent_tree,
140 * Policy handle hashing
143 /* Store open and close packet numbers for a policy handle */
146 dcerpc_smb_store_pol_pkts(e_ctx_hnd *policy_hnd, guint32 open_frame,
147 guint32 close_frame);
149 /* Store a name with a policy handle */
152 dcerpc_smb_store_pol_name(e_ctx_hnd *policy_hnd, char *name);
154 /* Fetch details stored with a policy handle */
157 dcerpc_smb_fetch_pol(e_ctx_hnd *policy_hnd, char **name,
158 guint32 *open_frame, guint32 *close_frame);
160 /* Check for unparsed data at the end of a frame */
163 dcerpc_smb_check_long_frame(tvbuff_t *tvb, int offset,
164 packet_info *pinfo, proto_tree *tree);
166 /* Dissect NT specific things */
169 dissect_ntstatus(tvbuff_t *tvb, gint offset, packet_info *pinfo,
170 proto_tree *tree, char *drep,
171 int hfindex, guint32 *pdata);
174 dissect_doserror(tvbuff_t *tvb, gint offset, packet_info *pinfo,
175 proto_tree *tree, char *drep,
176 int hfindex, guint32 *pdata);
179 dissect_nt_policy_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
180 proto_tree *tree, char *drep, int hfindex,
181 e_ctx_hnd *pdata, gboolean is_open, gboolean is_close);
184 dissect_nt_GUID(tvbuff_t *tvb, int offset,
185 packet_info *pinfo, proto_tree *parent_tree,
189 dissect_nt_LUID(tvbuff_t *tvb, int offset,
190 packet_info *pinfo, proto_tree *tree,
193 /* Stored here instead of packet-dcerpc{,-ndr}.c as they are probably not
194 official NDR representations. */
196 int dissect_dcerpc_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
197 proto_tree *tree, char *drep,
198 int hfindex, int length, guint8 **pdata);
200 int dissect_ndr_uint8s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
201 proto_tree *tree, char *drep,
202 int hfindex, int length, guint8 **pdata);
204 int dissect_dcerpc_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
205 proto_tree *tree, char *drep,
206 int hfindex, int length, guint16 **pdata);
208 int dissect_ndr_uint16s(tvbuff_t *tvb, gint offset, packet_info *pinfo,
209 proto_tree *tree, char *drep,
210 int hfindex, int length, guint16 **pdata);
212 /* Dissect an NT access mask */
214 typedef void (nt_access_mask_fn_t)(tvbuff_t *tvb, gint offset,
215 proto_tree *tree, guint32 access);
218 dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo,
219 proto_tree *tree, char *drep, int hfindex,
220 nt_access_mask_fn_t *specific_rights_fn);
222 #endif /* packet-dcerpc-nt.h */