preparing for release of alpha.0.0
[Samba.git] / source / include / rpc_misc.h
blobed8cbd96bb443f9cecf5c28fd7b45b8c09edf101
1 /*
2 Unix SMB/Netbios implementation.
3 Version 1.9.
4 SMB parameters and setup
5 Copyright (C) Andrew Tridgell 1992-1997
6 Copyright (C) Luke Kenneth Casson Leighton 1996-1997
7 Copyright (C) Paul Ashton 1997
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef _RPC_MISC_H /* _RPC_MISC_H */
25 #define _RPC_MISC_H
28 * macros to wrap prs_xxxx routines.
30 #define prs_uint8(name, ps, depth, data8) \
31 if (!_prs_uint8(name, ps, depth, data8)) \
33 ps->offset = 0;\
34 return False;\
36 #define prs_uint16(name, ps, depth, data16) \
37 if (!_prs_uint16(name, ps, depth, data16)) \
39 ps->offset = 0;\
40 return False;\
42 #define prs_hash1(x_ps, x_offset, x_sess_key) \
43 if (!_prs_hash1(x_ps, x_offset, x_sess_key)) \
45 x_ps->offset = 0;\
46 return False;\
48 #define prs_uint32(name, ps, depth, data32) \
49 if (!_prs_uint32(name, ps, depth, data32)) \
51 ps->offset = 0;\
52 return False;\
54 #define prs_uint8s(charmode, name, ps, depth, data8s, len) \
55 if (!_prs_uint8s(charmode, name, ps, depth, data8s, len)) \
57 ps->offset = 0;\
58 return False;\
60 #define prs_uint16s(charmode, name, ps, depth, data16s, len) \
61 if (!_prs_uint16s(charmode, name, ps, depth, data16s, len)) \
63 ps->offset = 0;\
64 return False;\
66 #define prs_uint32s(charmode, name, ps, depth, data32s, len) \
67 if (!_prs_uint32s(charmode, name, ps, depth, data32s, len)) \
69 ps->offset = 0;\
70 return False;\
72 #define prs_buffer2(charmode, name, ps, depth, str) \
73 if (!_prs_buffer2(charmode, name, ps, depth, str)) \
75 ps->offset = 0;\
76 return False;\
78 #define prs_string2(charmode, name, ps, depth, str) \
79 if (!_prs_string2(charmode, name, ps, depth, str)) \
81 ps->offset = 0;\
82 return False;\
84 #define prs_unistr2(charmode, name, ps, depth, str) \
85 if (!_prs_unistr2(charmode, name, ps, depth, str)) \
87 ps->offset = 0;\
88 return False;\
90 #define prs_unistr3(charmode, name, str, ps, depth) \
91 if (!_prs_unistr3(charmode, name, str, ps, depth)) \
93 ps->offset = 0;\
94 return False;\
96 #define prs_unistr(name, ps, depth, str) \
97 if (!_prs_unistr(name, ps, depth, str)) \
99 ps->offset = 0;\
100 return False;\
102 #define prs_string(name, ps, depth, str, len, max_buf_size) \
103 if (!_prs_string(name, ps, depth, str, len, max_buf_size)) \
105 ps->offset = 0;\
106 return False;\
108 #define prs_uint16_pre(x_name, x_ps, x_depth, x_data16, x_offset) \
109 if (!_prs_uint16_pre(x_name, x_ps, x_depth, x_data16, x_offset)) \
111 x_ps->offset = 0;\
112 return False;\
114 #define prs_uint16_post(name, ps, depth, data16, ptr_uint16, data_size) \
115 if (!_prs_uint16_post(name, ps, depth, data16, ptr_uint16, data_size)) \
117 ps->offset = 0;\
118 return False;\
120 #define prs_uint32_pre(x_name, x_ps, x_depth, x_data32, x_offset) \
121 if (!_prs_uint32_pre(x_name, x_ps, x_depth, x_data32, x_offset)) \
123 x_ps->offset = 0;\
124 return False;\
126 #define prs_uint32_post(name, ps, depth, data32, ptr_uint32, data_size) \
127 if (!_prs_uint32_post(name, ps, depth, data32, ptr_uint32, data_size)) \
129 ps->offset = 0;\
130 return False;\
133 #include "rpc_dce.h"
135 /* well-known RIDs - Relative IDs */
137 /* RIDs - Well-known users ... */
138 #define DOMAIN_USER_RID_ADMIN (0x000001F4L)
139 #define DOMAIN_USER_RID_GUEST (0x000001F5L)
141 /* RIDs - well-known groups ... */
142 #define DOMAIN_GROUP_RID_ADMINS (0x00000200L)
143 #define DOMAIN_GROUP_RID_USERS (0x00000201L)
144 #define DOMAIN_GROUP_RID_GUESTS (0x00000202L)
146 /* RIDs - well-known aliases ... */
147 #define BUILTIN_ALIAS_RID_ADMINS (0x00000220L)
148 #define BUILTIN_ALIAS_RID_USERS (0x00000221L)
149 #define BUILTIN_ALIAS_RID_GUESTS (0x00000222L)
150 #define BUILTIN_ALIAS_RID_POWER_USERS (0x00000223L)
151 #define BUILTIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L)
152 #define BUILTIN_ALIAS_RID_SYSTEM_OPS (0x00000225L)
153 #define BUILTIN_ALIAS_RID_PRINT_OPS (0x00000226L)
154 #define BUILTIN_ALIAS_RID_BACKUP_OPS (0x00000227L)
155 #define BUILTIN_ALIAS_RID_REPLICATOR (0x00000228L)
158 * Masks for mappings between unix uid and gid types and
159 * NT RIDS.
162 /* Take the bottom bits. */
163 #define RID_TYPE_MASK 2
164 #define RID_MULTIPLIER 4
166 /* The three common types. */
167 #define RID_TYPE_USER 0
168 #define RID_TYPE_GROUP 1
169 #define RID_TYPE_ALIAS 2
171 /* BIGINT - NT-style 64-bit integer */
172 typedef struct bigint_info
174 uint32 low;
175 uint32 high;
177 } BIGINT;
180 /* ENUM_HND */
181 typedef struct enum_hnd_info
183 uint32 ptr_hnd; /* pointer to enumeration handle */
184 uint32 handle; /* enumeration handle */
186 } ENUM_HND;
188 /* LOOKUP_LEVEL - switch value */
189 typedef struct lookup_level_info
191 uint16 value;
193 } LOOKUP_LEVEL;
195 /* DOM_SID2 - security id */
196 typedef struct sid_info_2
198 uint32 num_auths; /* length, bytes, including length of len :-) */
200 DOM_SID sid;
202 } DOM_SID2;
204 /* STRHDR - string header */
205 typedef struct header_info
207 uint16 str_str_len;
208 uint16 str_max_len;
209 uint32 buffer; /* non-zero */
211 } STRHDR;
213 /* STRHDR2 - string header, 32-bit lengths */
214 typedef struct header2_info
216 uint32 str_str_len;
217 uint32 str_max_len;
218 uint32 buffer;
220 } STRHDR2;
222 /* UNIHDR - unicode string header */
223 typedef struct unihdr_info
225 uint16 uni_str_len;
226 uint16 uni_max_len;
227 uint32 buffer; /* usually has a value of 4 */
229 } UNIHDR;
231 /* UNIHDR2 - unicode string header and undocumented buffer */
232 typedef struct unihdr2_info
234 UNIHDR unihdr;
235 uint32 buffer; /* 32 bit buffer pointer */
237 } UNIHDR2;
239 /* clueless as to what maximum length should be */
240 #define MAX_UNISTRLEN 256
241 #define MAX_STRINGLEN 256
242 #define MAX_BUFFERLEN 512
244 /* UNISTR - unicode string size and buffer */
245 typedef struct unistr_info
247 uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. ***MUST*** be null-terminated */
249 } UNISTR;
251 /* BUFHDR - buffer header */
252 typedef struct bufhdr_info
254 uint32 buf_max_len;
255 uint32 buf_len;
257 } BUFHDR;
259 /* BUFHDR2 - another buffer header, with info level */
260 typedef struct bufhdr2_info
262 uint32 info_level;
263 uint32 length; /* uint8 chars */
264 uint32 buffer;
266 } BUFHDR2;
268 /* BUFFER2 - unicode string, size (in uint8 ascii chars) and buffer */
269 /* pathetic. some stupid team of \PIPE\winreg writers got the concept */
270 /* of a unicode string different from the other \PIPE\ writers */
271 typedef struct buffer2_info
273 uint32 buf_max_len;
274 uint32 undoc;
275 uint32 buf_len;
276 uint8 buffer[MAX_UNISTRLEN];
278 } BUFFER2;
280 /* BUFFER3 */
281 typedef struct buffer3_info
283 uint32 buf_max_len;
284 uint8 buffer[MAX_BUFFERLEN]; /* data */
285 uint32 buf_len;
287 } BUFFER3;
289 /* BUFFER4 - simple length and buffer */
290 typedef struct buffer4_info
292 uint32 buf_len;
293 uint8 buffer[MAX_BUFFERLEN];
295 } BUFFER4;
297 /* BUFFER5 */
298 typedef struct buffer5_info
300 uint32 buf_len;
301 uint16 *buffer; /* data */
302 } BUFFER5;
304 /* UNISTR2 - unicode string size (in uint16 unicode chars) and buffer */
305 typedef struct unistr2_info
307 uint32 uni_max_len;
308 uint32 undoc;
309 uint32 uni_str_len;
310 uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. **NOT** necessarily null-terminated */
312 } UNISTR2;
314 /* STRING2 - string size (in uint8 chars) and buffer */
315 typedef struct string2_info
317 uint32 str_max_len;
318 uint32 undoc;
319 uint32 str_str_len;
320 uint8 buffer[MAX_STRINGLEN]; /* uint8 characters. **NOT** necessarily null-terminated */
322 } STRING2;
324 /* UNISTR3 - XXXX not sure about this structure */
325 typedef struct unistr3_info
327 uint32 uni_str_len;
328 UNISTR str;
330 } UNISTR3;
333 /* DOM_RID2 - domain RID structure for ntlsa pipe */
334 typedef struct domrid2_info
336 uint8 type; /* value is SID_NAME_USE enum */
337 uint32 rid;
338 uint32 rid_idx; /* referenced domain index */
340 } DOM_RID2;
342 /* DOM_RID3 - domain RID structure for samr pipe */
343 typedef struct domrid3_info
345 uint32 rid; /* domain-relative (to a SID) id */
346 uint32 type1; /* value is 0x1 */
347 uint32 ptr_type; /* undocumented pointer */
348 uint32 type2; /* value is 0x1 */
349 uint32 unk; /* value is 0x2 */
351 } DOM_RID3;
353 /* DOM_CLNT_SRV - client / server names */
354 typedef struct clnt_srv_info
356 uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */
357 UNISTR2 uni_logon_srv; /* logon server name */
358 uint32 undoc_buffer2; /* undocumented 32 bit buffer pointer */
359 UNISTR2 uni_comp_name; /* client machine name */
361 } DOM_CLNT_SRV;
363 /* DOM_LOG_INFO - login info */
364 typedef struct log_info
366 uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */
367 UNISTR2 uni_logon_srv; /* logon server name */
368 UNISTR2 uni_acct_name; /* account name */
369 uint16 sec_chan; /* secure channel type */
370 UNISTR2 uni_comp_name; /* client machine name */
372 } DOM_LOG_INFO;
374 /* DOM_CLNT_INFO - client info */
375 typedef struct clnt_info
377 DOM_LOG_INFO login;
378 DOM_CRED cred;
380 } DOM_CLNT_INFO;
382 /* DOM_CLNT_INFO2 - client info */
383 typedef struct clnt_info2
385 DOM_CLNT_SRV login;
386 uint32 ptr_cred;
387 DOM_CRED cred;
389 } DOM_CLNT_INFO2;
391 /* DOM_LOGON_ID - logon id */
392 typedef struct logon_info
394 uint32 low;
395 uint32 high;
397 } DOM_LOGON_ID;
399 /* OWF INFO */
400 typedef struct owf_info
402 uint8 data[16];
404 } OWF_INFO;
407 /* DOM_GID - group id + user attributes */
408 typedef struct gid_info
410 uint32 g_rid; /* a group RID */
411 uint32 attr;
413 } DOM_GID;
415 #define POL_HND_SIZE 20
417 /* POLICY_HND */
418 typedef struct lsa_policy_info
420 uint8 data[POL_HND_SIZE]; /* policy handle */
422 } POLICY_HND;
424 #endif /* _RPC_MISC_H */