r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
[bbaumbach/samba-autobuild/.git] / source3 / include / rpc_ds.h
1 /* 
2    Unix SMB/CIFS implementation.
3    SMB parameters and setup
4    Copyright (C) Gerald Carter                  2002
5       
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef _RPC_DS_H /* _RPC_LSA_H */
21 #define _RPC_DS_H 
22
23 /* Opcodes available on PIPE_LSARPC_DS */
24
25 #define DS_GETPRIMDOMINFO      0x00
26 #define DS_NOP                 0xFF     /* no op -- placeholder */
27
28 /* Opcodes available on PIPE_NETLOGON */
29
30 #define DS_ENUM_DOM_TRUSTS      0x28
31
32 /* macros for RPC's */
33
34 /* DSROLE_PRIMARY_DOMAIN_INFO_BASIC */
35
36 /* flags */
37
38 #define DSROLE_PRIMARY_DS_RUNNING           0x00000001
39 #define DSROLE_PRIMARY_DS_MIXED_MODE        0x00000002
40 #define DSROLE_UPGRADE_IN_PROGRESS          0x00000004
41 #define DSROLE_PRIMARY_DOMAIN_GUID_PRESENT  0x01000000
42
43 /* machine role */
44
45 #define DSROLE_DOMAIN_MEMBER_WKS        1
46 #define DSROLE_STANDALONE_SRV           2       
47 #define DSROLE_DOMAIN_MEMBER_SRV        3
48 #define DSROLE_BDC                      4
49 #define DSROLE_PDC                      5
50
51 /* Settings for the domainFunctionality attribute in the rootDSE */
52
53 #define DS_DOMAIN_FUNCTION_2000         0
54 #define DS_DOMAIN_FUCNTION_2003_MIXED   1
55 #define DS_DOMAIN_FUNCTION_2003         2
56
57 typedef struct
58 {
59         uint16          machine_role;
60         uint32          flags;  
61         uint32          netbios_ptr;
62         uint32          dnsname_ptr;
63         uint32          forestname_ptr;
64         
65         struct GUID     domain_guid;    
66         UNISTR2 netbios_domain;
67         UNISTR2 dns_domain;     /* our dns domain */
68         UNISTR2 forest_domain;  /* root domain of the forest to which we belong */
69 } DSROLE_PRIMARY_DOMAIN_INFO_BASIC;
70
71 typedef struct
72 {
73         DSROLE_PRIMARY_DOMAIN_INFO_BASIC        *basic;
74 } DS_DOMINFO_CTR;
75
76 /* info levels for ds_getprimdominfo() */
77
78 #define DsRolePrimaryDomainInfoBasic            1
79
80 /* DS_Q_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() request */
81 typedef struct 
82 {
83         uint16  level;
84 } DS_Q_GETPRIMDOMINFO;
85
86 /* DS_R_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() response */
87 typedef struct 
88 {
89         uint32          ptr;
90                 
91         uint16          level;
92         uint16          unknown0;       /* 0x455c -- maybe just alignment? */
93
94         DS_DOMINFO_CTR  info;
95         
96         NTSTATUS status;
97 } DS_R_GETPRIMDOMINFO;
98
99 typedef struct {
100         /* static portion of structure */
101         uint32          netbios_ptr;
102         uint32          dns_ptr;
103         uint32          flags;
104         uint32          parent_index;
105         uint32          trust_type;
106         uint32          trust_attributes;
107         uint32          sid_ptr;
108         struct GUID     guid;
109         
110         UNISTR2         netbios_domain;
111         UNISTR2         dns_domain;
112         DOM_SID2        sid;
113
114 } DS_DOMAIN_TRUSTS;
115
116 struct ds_domain_trust {
117         /* static portion of structure */
118         uint32          flags;
119         uint32          parent_index;
120         uint32          trust_type;
121         uint32          trust_attributes;
122         struct GUID     guid;
123         
124         DOM_SID sid;
125         char *netbios_domain;
126         char *dns_domain;
127 };
128
129 typedef struct {
130
131         uint32                  ptr;
132         uint32                  max_count;
133         DS_DOMAIN_TRUSTS        *trusts;
134         
135 } DS_DOMAIN_TRUSTS_CTR;
136
137 /* Trust flags */
138
139 #define DS_DOMAIN_IN_FOREST           0x0001    /* domains in the forest to which 
140                                                    we belong; even different domain trees */
141 #define DS_DOMAIN_DIRECT_OUTBOUND     0x0002    /* trusted domains */
142 #define DS_DOMAIN_TREE_ROOT           0x0004    /* root of a forest */
143 #define DS_DOMAIN_PRIMARY             0x0008    /* our domain */
144 #define DS_DOMAIN_NATIVE_MODE         0x0010    /* native mode AD servers */
145 #define DS_DOMAIN_DIRECT_INBOUND      0x0020    /* trusting domains */
146
147 /* Trust types */
148
149 #define DS_DOMAIN_TRUST_TYPE_DOWNLEVEL   0x00000001
150 #define DS_DOMAIN_TRUST_TYPE_UPLEVEL     0x00000002
151
152 /* Trust attributes */
153
154 #define DS_DOMAIN_TRUST_ATTRIB_NON_TRANSITIVE         0x00000001
155 #define DS_DOMAIN_TRUST_ATTRIB_UPLEVEL_ONLY           0x00000002            
156 #define DS_DOMAIN_TRUST_ATTRIB_QUARANTINED_DOMAIN     0x00000004            
157 #define DS_DOMAIN_TRUST_ATTRIB_FOREST_TRANSITIVE      0x00000008            
158 #define DS_DOMAIN_TRUST_ATTRIB_CROSS_ORG              0x00000010            
159 #define DS_DOMAIN_TRUST_ATTRIB_IN_FOREST              0x00000020            
160 #define DS_DOMAIN_TRUST_ATTRIB_EXTERNAL               0x00000040            
161
162
163
164 /* DS_Q_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() request */
165 typedef struct 
166 {
167         uint32          server_ptr;
168         UNISTR2         server;
169         uint32          flags;
170         
171 } DS_Q_ENUM_DOM_TRUSTS;
172
173 /* DS_R_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() response */
174 typedef struct 
175 {
176         uint32                  num_domains;
177         DS_DOMAIN_TRUSTS_CTR    domains;
178                 
179         NTSTATUS status;
180
181 } DS_R_ENUM_DOM_TRUSTS;
182
183
184 #endif /* _RPC_DS_H */