rpc_parse/parse_misc.c : defined a new BUFFER5 struct
[samba.git] / source / include / rpc_misc.h
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
8    
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.
13    
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.
18    
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.
22 */
23
24 #ifndef _RPC_MISC_H /* _RPC_MISC_H */
25 #define _RPC_MISC_H 
26
27
28 #include "rpc_dce.h"
29
30 /* well-known RIDs - Relative IDs */
31
32 /* RIDs - Well-known users ... */
33 #define DOMAIN_USER_RID_ADMIN          (0x000001F4L)
34 #define DOMAIN_USER_RID_GUEST          (0x000001F5L)
35
36 /* RIDs - well-known groups ... */
37 #define DOMAIN_GROUP_RID_ADMINS        (0x00000200L)
38 #define DOMAIN_GROUP_RID_USERS         (0x00000201L)
39 #define DOMAIN_GROUP_RID_GUESTS        (0x00000202L)
40
41 /* RIDs - well-known aliases ... */
42 #define BUILTIN_ALIAS_RID_ADMINS        (0x00000220L)
43 #define BUILTIN_ALIAS_RID_USERS         (0x00000221L)
44 #define BUILTIN_ALIAS_RID_GUESTS        (0x00000222L)
45 #define BUILTIN_ALIAS_RID_POWER_USERS   (0x00000223L)
46 #define BUILTIN_ALIAS_RID_ACCOUNT_OPS   (0x00000224L)
47 #define BUILTIN_ALIAS_RID_SYSTEM_OPS    (0x00000225L)
48 #define BUILTIN_ALIAS_RID_PRINT_OPS     (0x00000226L)
49 #define BUILTIN_ALIAS_RID_BACKUP_OPS    (0x00000227L)
50 #define BUILTIN_ALIAS_RID_REPLICATOR    (0x00000228L)
51
52 /*
53  * Masks for mappings between unix uid and gid types and
54  * NT RIDS.
55  */
56
57 /* Take the bottom bits. */
58 #define RID_TYPE_MASK 2
59 #define RID_MULTIPLIER 4
60
61 /* The three common types. */
62 #define RID_TYPE_USER    0
63 #define RID_TYPE_GROUP   1
64 #define RID_TYPE_ALIAS   2
65
66 /* BIGINT - NT-style 64-bit integer */
67 typedef struct bigint_info
68 {
69         uint32 low;
70         uint32 high;
71
72 } BIGINT;
73
74
75 /* ENUM_HND */
76 typedef struct enum_hnd_info
77 {
78         uint32 ptr_hnd;          /* pointer to enumeration handle */
79         uint32 handle;           /* enumeration handle */
80
81 } ENUM_HND;
82
83 /* LOOKUP_LEVEL - switch value */
84 typedef struct lookup_level_info
85 {
86   uint16 value;
87
88 } LOOKUP_LEVEL;
89
90 /* DOM_SID2 - security id */
91 typedef struct sid_info_2
92 {
93         uint32 num_auths; /* length, bytes, including length of len :-) */
94
95         DOM_SID sid;
96
97 } DOM_SID2;
98
99 /* STRHDR - string header */
100 typedef struct header_info
101 {
102   uint16 str_str_len;
103   uint16 str_max_len;
104   uint32 buffer; /* non-zero */
105
106 } STRHDR;
107
108 /* STRHDR2 - string header, 32-bit lengths */
109 typedef struct header2_info
110 {
111   uint32 str_str_len;
112   uint32 str_max_len;
113   uint32 buffer;
114
115 } STRHDR2;
116
117 /* UNIHDR - unicode string header */
118 typedef struct unihdr_info
119 {
120   uint16 uni_str_len;
121   uint16 uni_max_len;
122   uint32 buffer; /* usually has a value of 4 */
123
124 } UNIHDR;
125
126 /* UNIHDR2 - unicode string header and undocumented buffer */
127 typedef struct unihdr2_info
128 {
129   UNIHDR unihdr;
130   uint32 buffer; /* 32 bit buffer pointer */
131
132 } UNIHDR2;
133
134 /* clueless as to what maximum length should be */
135 #define MAX_UNISTRLEN 256
136 #define MAX_STRINGLEN 256
137 #define MAX_BUFFERLEN 512
138
139 /* UNISTR - unicode string size and buffer */
140 typedef struct unistr_info
141 {
142   uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. ***MUST*** be null-terminated */
143
144 } UNISTR;
145
146 /* BUFHDR - buffer header */
147 typedef struct bufhdr_info
148 {
149   uint32 buf_max_len;
150   uint32 buf_len;
151
152 } BUFHDR;
153
154 /* BUFHDR2 - another buffer header, with info level */
155 typedef struct bufhdr2_info
156 {
157   uint32 info_level;
158   uint32 length; /* uint8 chars */
159   uint32 buffer;
160
161 } BUFHDR2;
162
163 /* BUFFER2 - unicode string, size (in uint8 ascii chars) and buffer */
164 /* pathetic.  some stupid team of \PIPE\winreg writers got the concept */
165 /* of a unicode string different from the other \PIPE\ writers */
166 typedef struct buffer2_info
167 {
168   uint32 buf_max_len;
169   uint32 undoc;
170   uint32 buf_len;
171   uint8 buffer[MAX_UNISTRLEN];
172
173 } BUFFER2;
174
175 /* BUFFER3 */
176 typedef struct buffer3_info
177 {
178   uint32 buf_max_len;
179   uint8  buffer[MAX_BUFFERLEN]; /* data */
180   uint32 buf_len;
181
182 } BUFFER3;
183
184 /* BUFFER4 - simple length and buffer */
185 typedef struct buffer4_info
186 {
187   uint32 buf_len;
188   uint8  buffer[MAX_BUFFERLEN];
189
190 } BUFFER4;
191
192 /* BUFFER5 */
193 typedef struct buffer5_info
194 {
195   uint32 buf_len;
196   uint16 *buffer; /* data */
197 } BUFFER5;
198
199 /* UNISTR2 - unicode string size (in uint16 unicode chars) and buffer */
200 typedef struct unistr2_info
201 {
202   uint32 uni_max_len;
203   uint32 undoc;
204   uint32 uni_str_len;
205   uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. **NOT** necessarily null-terminated */
206
207 } UNISTR2;
208
209 /* STRING2 - string size (in uint8 chars) and buffer */
210 typedef struct string2_info
211 {
212   uint32 str_max_len;
213   uint32 undoc;
214   uint32 str_str_len;
215   uint8  buffer[MAX_STRINGLEN]; /* uint8 characters. **NOT** necessarily null-terminated */
216
217 } STRING2;
218
219 /* UNISTR3 - XXXX not sure about this structure */
220 typedef struct unistr3_info
221 {
222         uint32 uni_str_len;
223         UNISTR str;
224
225 } UNISTR3;
226
227
228 /* DOM_RID2 - domain RID structure for ntlsa pipe */
229 typedef struct domrid2_info
230 {
231         uint8 type; /* value is SID_NAME_USE enum */
232         uint32 rid;
233         uint32 rid_idx; /* referenced domain index */
234
235 } DOM_RID2;
236
237 /* DOM_RID3 - domain RID structure for samr pipe */
238 typedef struct domrid3_info
239 {
240         uint32 rid;        /* domain-relative (to a SID) id */
241         uint32 type1;      /* value is 0x1 */
242         uint32 ptr_type;   /* undocumented pointer */
243         uint32 type2;      /* value is 0x1 */
244         uint32 unk; /* value is 0x2 */
245
246 } DOM_RID3;
247
248 /* DOM_CLNT_SRV - client / server names */
249 typedef struct clnt_srv_info
250 {
251   uint32  undoc_buffer; /* undocumented 32 bit buffer pointer */
252   UNISTR2 uni_logon_srv; /* logon server name */
253   uint32  undoc_buffer2; /* undocumented 32 bit buffer pointer */
254   UNISTR2 uni_comp_name; /* client machine name */
255
256 } DOM_CLNT_SRV;
257
258 /* DOM_LOG_INFO - login info */
259 typedef struct log_info
260 {
261   uint32  undoc_buffer; /* undocumented 32 bit buffer pointer */
262   UNISTR2 uni_logon_srv; /* logon server name */
263   UNISTR2 uni_acct_name; /* account name */
264   uint16  sec_chan;      /* secure channel type */
265   UNISTR2 uni_comp_name; /* client machine name */
266
267 } DOM_LOG_INFO;
268
269 /* DOM_CLNT_INFO - client info */
270 typedef struct clnt_info
271 {
272   DOM_LOG_INFO login;
273   DOM_CRED     cred;
274
275 } DOM_CLNT_INFO;
276
277 /* DOM_CLNT_INFO2 - client info */
278 typedef struct clnt_info2
279 {
280   DOM_CLNT_SRV login;
281   uint32        ptr_cred;
282   DOM_CRED      cred;
283
284 } DOM_CLNT_INFO2;
285
286 /* DOM_LOGON_ID - logon id */
287 typedef struct logon_info
288 {
289   uint32 low;
290   uint32 high;
291
292 } DOM_LOGON_ID;
293
294 /* OWF INFO */
295 typedef struct owf_info
296 {
297   uint8 data[16];
298
299 } OWF_INFO;
300
301
302 /* DOM_GID - group id + user attributes */
303 typedef struct gid_info
304 {
305   uint32 g_rid;  /* a group RID */
306   uint32 attr;
307
308 } DOM_GID;
309
310 #define POL_HND_SIZE 20
311
312 /* POLICY_HND */
313 typedef struct lsa_policy_info
314 {
315   uint8 data[POL_HND_SIZE]; /* policy handle */
316
317 } POLICY_HND;
318
319 #endif /* _RPC_MISC_H */
320