- added DCE/RPC "fault" PDU support.
[samba.git] / source / include / ntdomain.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 _NT_DOMAIN_H /* _NT_DOMAIN_H */
25 #define _NT_DOMAIN_H 
26
27
28 /* dce/rpc support */
29 #include "rpc_dce.h"
30
31 /* miscellaneous structures / defines */
32 #include "rpc_misc.h"
33
34 /* security descriptor structures */
35 #include "rpc_secdes.h" 
36
37 /* different dce/rpc pipes */
38 #include "rpc_lsa.h"
39 #include "rpc_netlogon.h"
40 #include "rpc_reg.h"
41 #include "rpc_samr.h"
42 #include "rpc_srvsvc.h"
43 #include "rpc_svcctl.h"
44 #include "rpc_wkssvc.h"
45 #include "rpc_atsvc.h"
46 #include "rpc_spoolss.h"
47 #include "rpc_eventlog.h"
48
49 /* 
50  * A bunch of stuff that was put into smb.h
51  * in the NTDOM branch - it didn't belong there.
52  */
53  
54 typedef struct
55 {
56         struct mem_buf *data; /* memory buffer */
57         uint32 offset; /* offset currently being accessed in memory buffer */
58         uint8 align; /* data alignment */
59         BOOL io; /* parsing in or out of data stream */
60         BOOL error; /* error occurred */
61
62 } prs_struct;
63
64 typedef struct pipes_struct
65 {
66         struct pipes_struct *next, *prev;
67         int pnum;
68         connection_struct *conn;
69         uint16 vuid;
70         BOOL open; /* open connection */
71         uint16 device_state;
72         uint16 priority;
73         fstring name;
74         fstring pipe_srv_name;
75
76         prs_struct rhdr; /* output header */
77         prs_struct rfault; /* fault */
78         prs_struct rdata; /* output data */
79         prs_struct rdata_i; /* output data (intermediate, for fragments) */
80         prs_struct rauth; /* output authentication verifier */
81         prs_struct rverf; /* output verifier */
82         prs_struct rntlm; /* output ntlmssp */
83
84         RPC_HDR       hdr;
85         RPC_HDR_BA    hdr_ba;
86         RPC_HDR_RB    hdr_rb;
87         RPC_HDR_REQ   hdr_req;
88         RPC_HDR_RESP  hdr_resp;
89         RPC_HDR_FAULT hdr_fault;
90         RPC_HDR_AUTH  auth_info;
91         RPC_HDR_AUTHA autha_info;
92
93         RPC_AUTH_NTLMSSP_VERIFIER auth_verifier;
94         RPC_AUTH_NTLMSSP_NEG      ntlmssp_neg;
95         RPC_AUTH_NTLMSSP_CHAL     ntlmssp_chal;
96         RPC_AUTH_NTLMSSP_RESP     ntlmssp_resp;
97         RPC_AUTH_NTLMSSP_CHK      ntlmssp_chk;
98
99         BOOL ntlmssp_auth;
100         BOOL ntlmssp_validated;
101         unsigned char ntlmssp_hash[258];
102         uint32 ntlmssp_seq_num;
103         fstring user_name;
104         fstring domain;
105         fstring wks;
106
107         uint32 file_offset;
108         uint32 prev_pdu_file_offset;
109         uint32 hdr_offsets;
110
111 } pipes_struct;
112
113 struct api_struct
114 {  
115   char *name;
116   uint8 opnum;
117   void (*fn) (pipes_struct*, prs_struct*, prs_struct*);
118 };
119
120 struct mem_desc
121 {  
122         /* array memory offsets */
123         uint32 start; 
124         uint32 end;
125 };
126    
127 struct mem_buf
128 {  
129         BOOL dynamic; /* True iff data has been dynamically allocated
130                                          (and therefore can be freed) */
131         char *data;
132         uint32 data_size;
133         uint32 data_used;
134
135         uint32 margin; /* safety margin when reallocing. */
136                                    /* this can be abused quite nicely */
137         uint8 align;   /* alignment of data structures (smb, dce/rpc, udp etc) */
138
139         struct mem_desc offset;
140
141         struct mem_buf *next;
142 };
143
144 struct acct_info
145 {
146     fstring acct_name; /* account name */
147     fstring acct_desc; /* account description */
148     uint32  rid; /* domain-relative RID */
149 };
150
151 /*
152  * higher order functions for use with msrpc client code
153  */
154
155 #define ALIAS_FN(fn)\
156         void (*fn)(const char*, const DOM_SID*, uint32, const char*)
157 #define ALIAS_INFO_FN(fn)\
158         void (*fn)(const char*, const DOM_SID*, uint32, ALIAS_INFO_CTR *const)
159 #define ALIAS_MEM_FN(fn)\
160         void(*fn)(const char*, const DOM_SID*, uint32, const char*,\
161                   uint32, DOM_SID *const *const, char *const *const,\
162                   uint8*const)
163
164 #define GROUP_FN(fn)\
165         void (*fn)(const char*, const DOM_SID*, uint32, const char*)
166 #define GROUP_INFO_FN(fn)\
167         void (*fn)(const char*, const DOM_SID*, uint32, GROUP_INFO_CTR *const)
168 #define GROUP_MEM_FN(fn)\
169         void(*fn)(const char*, const DOM_SID*, uint32, const char*,\
170                   uint32, const uint32*, char *const *const,\
171                   uint32*const)
172
173 #define USER_FN(fn)\
174         void (*fn)(const char*, const DOM_SID*, uint32, const char*)
175 #define USER_INFO_FN(fn)\
176         void (*fn)(const char*, const DOM_SID*, uint32,\
177                    SAM_USER_INFO_21 *const)
178 #define USER_MEM_FN(fn)\
179         void (*fn)(const char*, const DOM_SID*, uint32, const char*,\
180                    uint32, const uint32*, char *const *const, uint32* const)
181
182 #define REG_FN(fn)\
183         void (*fn)(int, const char *, int)
184 #define REG_KEY_FN(fn)\
185         void (*fn)(const char*, const char*, time_t)
186 #define REG_VAL_FN(fn)\
187         void (*fn)(const char *, const char*, uint32, const BUFFER2 *)
188
189 #define SVC_QUERY_FN(fn)\
190         void (*fn)(const QUERY_SERVICE_CONFIG *)
191 #define SVC_INFO_FN(fn)\
192         void (*fn)(const ENUM_SRVC_STATUS *)
193
194 #define TPRT_INFO_FN(fn)\
195         void (*fn)(const SRV_TPRT_INFO_CTR *)
196
197 #define PRINT_INFO_FN(fn)\
198         void (*fn)(const char*, uint32, uint32, void  *const *const)
199 #define JOB_INFO_FN(fn)\
200         void (*fn)(const char*, const char*, uint32, uint32, void *const *const)
201
202 #endif /* _NT_DOMAIN_H */
203