r560: Fix bugzilla 1279: cannot control individual print jobs using cups
[Samba/gebeck_regimport.git] / source3 / include / ntdomain.h
blob084e56b51e10184e4565a9423b0220f5fd6a9b52
1 /*
2 Unix SMB/CIFS implementation.
3 SMB parameters and setup
4 Copyright (C) Andrew Tridgell 1992-1997
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1997
6 Copyright (C) Paul Ashton 1997
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef _NT_DOMAIN_H /* _NT_DOMAIN_H */
24 #define _NT_DOMAIN_H
26 struct uuid
28 uint32 time_low;
29 uint16 time_mid;
30 uint16 time_hi_and_version;
31 uint8 clock_seq[2];
32 uint8 node[6];
34 #define UUID_SIZE 16
36 #define UUID_FLAT_SIZE 16
37 typedef struct uuid_flat
39 uint8 info[UUID_FLAT_SIZE];
40 } UUID_FLAT;
42 /* dce/rpc support */
43 #include "rpc_dce.h"
45 /* miscellaneous structures / defines */
46 #include "rpc_misc.h"
48 #include "rpc_creds.h"
50 #include "talloc.h"
53 * A bunch of stuff that was put into smb.h
54 * in the NTDOM branch - it didn't belong there.
57 typedef struct _prs_struct
59 BOOL io; /* parsing in or out of data stream */
60 /*
61 * If the (incoming) data is big-endian. On output we are
62 * always little-endian.
63 */
64 BOOL bigendian_data;
65 uint8 align; /* data alignment */
66 BOOL is_dynamic; /* Do we own this memory or not ? */
67 uint32 data_offset; /* Current working offset into data. */
68 uint32 buffer_size; /* Current allocated size of the buffer. */
69 uint32 grow_size; /* size requested via prs_grow() calls */
70 char *data_p; /* The buffer itself. */
71 TALLOC_CTX *mem_ctx; /* When unmarshalling, use this.... */
72 } prs_struct;
75 * Defines for io member of prs_struct.
78 #define MARSHALL 0
79 #define UNMARSHALL 1
81 #define MARSHALLING(ps) (!(ps)->io)
82 #define UNMARSHALLING(ps) ((ps)->io)
84 #define RPC_BIG_ENDIAN 1
85 #define RPC_LITTLE_ENDIAN 0
87 #define RPC_PARSE_ALIGN 4
89 typedef struct _output_data {
91 * Raw RPC output data. This does not include RPC headers or footers.
93 prs_struct rdata;
95 /* The amount of data sent from the current rdata struct. */
96 uint32 data_sent_length;
99 * The current PDU being returned. This inclues
100 * headers, data and authentication footer.
102 unsigned char current_pdu[MAX_PDU_FRAG_LEN];
104 /* The amount of data in the current_pdu buffer. */
105 uint32 current_pdu_len;
107 /* The amount of data sent from the current PDU. */
108 uint32 current_pdu_sent;
109 } output_data;
111 typedef struct _input_data {
113 * This is the current incoming pdu. The data here
114 * is collected via multiple writes until a complete
115 * pdu is seen, then the data is copied into the in_data
116 * structure. The maximum size of this is 0x1630 (MAX_PDU_FRAG_LEN).
118 unsigned char current_in_pdu[MAX_PDU_FRAG_LEN];
121 * The amount of data needed to complete the in_pdu.
122 * If this is zero, then we are at the start of a new
123 * pdu.
125 uint32 pdu_needed_len;
128 * The amount of data received so far in the in_pdu.
129 * If this is zero, then we are at the start of a new
130 * pdu.
132 uint32 pdu_received_len;
135 * This is the collection of input data with all
136 * the rpc headers and auth footers removed.
137 * The maximum length of this (1Mb) is strictly enforced.
139 prs_struct data;
140 } input_data;
143 * Handle database - stored per pipe.
146 struct policy
148 struct policy *next, *prev;
150 POLICY_HND pol_hnd;
152 void *data_ptr;
153 void (*free_fn)(void *);
157 struct handle_list {
158 struct policy *Policy; /* List of policies. */
159 size_t count; /* Current number of handles. */
160 size_t pipe_ref_count; /* Number of pipe handles referring to this list. */
163 /* Domain controller authentication protocol info */
164 struct dcinfo
166 DOM_CHAL clnt_chal; /* Initial challenge received from client */
167 DOM_CHAL srv_chal; /* Initial server challenge */
168 DOM_CRED clnt_cred; /* Last client credential */
169 DOM_CRED srv_cred; /* Last server credential */
171 uchar sess_key[8]; /* Session key */
172 uchar md4pw[16]; /* md4(machine password) */
174 fstring mach_acct; /* Machine name we've authenticated. */
176 fstring remote_machine; /* Machine name we've authenticated. */
178 BOOL challenge_sent;
179 BOOL got_session_key;
180 BOOL authenticated;
184 typedef struct pipe_rpc_fns {
186 struct pipe_rpc_fns *next, *prev;
188 /* RPC function table associated with the current rpc_bind (associated by context) */
190 struct api_struct *cmds;
191 int n_cmds;
192 uint32 context_id;
194 } PIPE_RPC_FNS;
197 * DCE/RPC-specific samba-internal-specific handling of data on
198 * NamedPipes.
201 typedef struct pipes_struct
203 struct pipes_struct *next, *prev;
205 connection_struct *conn;
206 uint16 vuid; /* points to the unauthenticated user that opened this pipe. */
208 fstring name;
209 fstring pipe_srv_name;
211 /* linked list of rpc dispatch tables associated
212 with the open rpc contexts */
214 PIPE_RPC_FNS *contexts;
216 RPC_HDR hdr; /* Incoming RPC header. */
217 RPC_HDR_REQ hdr_req; /* Incoming request header. */
219 uint32 ntlmssp_chal_flags; /* Client challenge flags. */
220 BOOL ntlmssp_auth_requested; /* If the client wanted authenticated rpc. */
221 BOOL ntlmssp_auth_validated; /* If the client *got* authenticated rpc. */
222 unsigned char challenge[8];
223 unsigned char ntlmssp_hash[258];
224 uint32 ntlmssp_seq_num;
225 struct dcinfo dc; /* Keeps the creds data. */
227 /* Hmm. In my understanding the authentication happens
228 implicitly later, so there are no two stages for
229 schannel. */
231 BOOL netsec_auth_validated;
232 struct netsec_auth_struct netsec_auth;
235 * Windows user info.
237 fstring user_name;
238 fstring domain;
239 fstring wks;
242 * Unix user name and credentials.
245 fstring pipe_user_name;
246 struct current_user pipe_user;
248 DATA_BLOB session_key;
251 * Set to true when an RPC bind has been done on this pipe.
254 BOOL pipe_bound;
257 * Set to true when we should return fault PDU's for everything.
260 BOOL fault_state;
263 * Set to true when we should return fault PDU's for a bad handle.
266 BOOL bad_handle_fault_state;
269 * Set to RPC_BIG_ENDIAN when dealing with big-endian PDU's
272 BOOL endian;
275 * Struct to deal with multiple pdu inputs.
278 input_data in_data;
281 * Struct to deal with multiple pdu outputs.
284 output_data out_data;
286 /* talloc context to use when allocating memory on this pipe. */
287 TALLOC_CTX *mem_ctx;
289 /* handle database to use on this pipe. */
290 struct handle_list *pipe_handles;
292 } pipes_struct;
294 typedef struct smb_np_struct
296 struct smb_np_struct *next, *prev;
297 int pnum;
298 connection_struct *conn;
299 uint16 vuid; /* points to the unauthenticated user that opened this pipe. */
300 BOOL open; /* open connection */
301 uint16 device_state;
302 uint16 priority;
303 fstring name;
305 /* When replying to an SMBtrans, this is the maximum amount of
306 data that can be sent in the initial reply. */
307 int max_trans_reply;
310 * NamedPipe state information.
312 * (e.g. typecast a np_struct, above).
314 void *np_state;
317 * NamedPipe functions, to be called to perform
318 * Named Pipe transactions on request from an
319 * SMB client.
322 /* call to create a named pipe connection.
323 * returns: state information representing the connection.
324 * is stored in np_state, above.
326 void * (*namedpipe_create)(char *pipe_name,
327 connection_struct *conn, uint16 vuid);
329 /* call to perform a write / read namedpipe transaction.
330 * TransactNamedPipe is weird: it returns whether there
331 * is more data outstanding to be read, and the
332 * caller is expected to take note and follow up with
333 * read requests.
335 ssize_t (*namedpipe_transact)(void *np_state,
336 char *data, int len,
337 char *rdata, int rlen,
338 BOOL *pipe_outstanding);
340 /* call to perform a write namedpipe operation
342 ssize_t (*namedpipe_write)(void * np_state,
343 char *data, size_t n);
345 /* call to perform a read namedpipe operation.
347 * NOTE: the only reason that the pipe_outstanding
348 * argument is here is because samba does not use
349 * the namedpipe_transact function yet: instead,
350 * it performs the same as what namedpipe_transact
351 * does - a write, followed by a read.
353 * when samba is modified to use namedpipe_transact,
354 * the pipe_outstanding argument may be removed.
356 ssize_t (*namedpipe_read)(void * np_state,
357 char *data, size_t max_len,
358 BOOL *pipe_outstanding);
360 /* call to close a namedpipe.
361 * function is expected to perform all cleanups
362 * necessary, free all memory etc.
364 * returns True if cleanup was successful (not that
365 * we particularly care).
367 BOOL (*namedpipe_close)(void * np_state);
369 } smb_np_struct;
371 struct api_struct
373 const char *name;
374 uint8 opnum;
375 BOOL (*fn) (pipes_struct *);
378 typedef struct
380 uint32 rid;
381 const char *name;
383 } rid_name;
386 * higher order functions for use with msrpc client code
389 #define PRINT_INFO_FN(fn)\
390 void (*fn)(const char*, uint32, uint32, void *const *const)
391 #define JOB_INFO_FN(fn)\
392 void (*fn)(const char*, const char*, uint32, uint32, void *const *const)
394 /* end higher order functions */
397 /* security descriptor structures */
398 #include "rpc_secdes.h"
400 /* pac */
401 #include "authdata.h"
403 /* different dce/rpc pipes */
404 #include "rpc_lsa.h"
405 #include "rpc_netlogon.h"
406 #include "rpc_reg.h"
407 #include "rpc_samr.h"
408 #include "rpc_srvsvc.h"
409 #include "rpc_wkssvc.h"
410 #include "rpc_spoolss.h"
411 #include "rpc_dfs.h"
412 #include "rpc_ds.h"
413 #include "rpc_echo.h"
414 #include "rpc_shutdown.h"
416 #endif /* _NT_DOMAIN_H */