r23779: Change from v2 or later to v3 or later.
[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, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #ifndef _RPC_DS_H /* _RPC_LSA_H */
22 #define _RPC_DS_H 
23
24 /* Opcodes available on PIPE_LSARPC_DS */
25
26 #define DS_GETPRIMDOMINFO      0x00
27 #define DS_NOP                 0xFF     /* no op -- placeholder */
28
29 /* Opcodes available on PIPE_NETLOGON */
30
31 #define DS_ENUM_DOM_TRUSTS      0x28
32
33 /* macros for RPC's */
34
35 /* DSROLE_PRIMARY_DOMAIN_INFO_BASIC */
36
37 /* flags */
38
39 #define DSROLE_PRIMARY_DS_RUNNING           0x00000001
40 #define DSROLE_PRIMARY_DS_MIXED_MODE        0x00000002
41 #define DSROLE_UPGRADE_IN_PROGRESS          0x00000004
42 #define DSROLE_PRIMARY_DOMAIN_GUID_PRESENT  0x01000000
43
44 /* machine role */
45
46 #define DSROLE_DOMAIN_MEMBER_WKS        1
47 #define DSROLE_STANDALONE_SRV           2       
48 #define DSROLE_DOMAIN_MEMBER_SRV        3
49 #define DSROLE_BDC                      4
50 #define DSROLE_PDC                      5
51
52 /* Settings for the domainFunctionality attribute in the rootDSE */
53
54 #define DS_DOMAIN_FUNCTION_2000         0
55 #define DS_DOMAIN_FUCNTION_2003_MIXED   1
56 #define DS_DOMAIN_FUNCTION_2003         2
57
58 typedef struct
59 {
60         uint16          machine_role;
61         uint32          flags;  
62         uint32          netbios_ptr;
63         uint32          dnsname_ptr;
64         uint32          forestname_ptr;
65         
66         struct GUID     domain_guid;    
67         UNISTR2 netbios_domain;
68         UNISTR2 dns_domain;     /* our dns domain */
69         UNISTR2 forest_domain;  /* root domain of the forest to which we belong */
70 } DSROLE_PRIMARY_DOMAIN_INFO_BASIC;
71
72 typedef struct
73 {
74         DSROLE_PRIMARY_DOMAIN_INFO_BASIC        *basic;
75 } DS_DOMINFO_CTR;
76
77 /* info levels for ds_getprimdominfo() */
78
79 #define DsRolePrimaryDomainInfoBasic            1
80
81 /* DS_Q_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() request */
82 typedef struct 
83 {
84         uint16  level;
85 } DS_Q_GETPRIMDOMINFO;
86
87 /* DS_R_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() response */
88 typedef struct 
89 {
90         uint32          ptr;
91                 
92         uint16          level;
93         uint16          unknown0;       /* 0x455c -- maybe just alignment? */
94
95         DS_DOMINFO_CTR  info;
96         
97         NTSTATUS status;
98 } DS_R_GETPRIMDOMINFO;
99
100 typedef struct {
101         /* static portion of structure */
102         uint32          netbios_ptr;
103         uint32          dns_ptr;
104         uint32          flags;
105         uint32          parent_index;
106         uint32          trust_type;
107         uint32          trust_attributes;
108         uint32          sid_ptr;
109         struct GUID     guid;
110         
111         UNISTR2         netbios_domain;
112         UNISTR2         dns_domain;
113         DOM_SID2        sid;
114
115 } DS_DOMAIN_TRUSTS;
116
117 struct ds_domain_trust {
118         /* static portion of structure */
119         uint32          flags;
120         uint32          parent_index;
121         uint32          trust_type;
122         uint32          trust_attributes;
123         struct GUID     guid;
124         
125         DOM_SID sid;
126         char *netbios_domain;
127         char *dns_domain;
128 };
129
130 typedef struct {
131
132         uint32                  ptr;
133         uint32                  max_count;
134         DS_DOMAIN_TRUSTS        *trusts;
135         
136 } DS_DOMAIN_TRUSTS_CTR;
137
138 /* Trust flags */
139
140 #define DS_DOMAIN_IN_FOREST           0x0001    /* domains in the forest to which 
141                                                    we belong; even different domain trees */
142 #define DS_DOMAIN_DIRECT_OUTBOUND     0x0002    /* trusted domains */
143 #define DS_DOMAIN_TREE_ROOT           0x0004    /* root of a forest */
144 #define DS_DOMAIN_PRIMARY             0x0008    /* our domain */
145 #define DS_DOMAIN_NATIVE_MODE         0x0010    /* native mode AD servers */
146 #define DS_DOMAIN_DIRECT_INBOUND      0x0020    /* trusting domains */
147
148 /* Trust types */
149
150 #define DS_DOMAIN_TRUST_TYPE_DOWNLEVEL   0x00000001
151 #define DS_DOMAIN_TRUST_TYPE_UPLEVEL     0x00000002
152
153 /* Trust attributes */
154
155 #define DS_DOMAIN_TRUST_ATTRIB_NON_TRANSITIVE         0x00000001
156 #define DS_DOMAIN_TRUST_ATTRIB_UPLEVEL_ONLY           0x00000002            
157 #define DS_DOMAIN_TRUST_ATTRIB_QUARANTINED_DOMAIN     0x00000004            
158 #define DS_DOMAIN_TRUST_ATTRIB_FOREST_TRANSITIVE      0x00000008            
159 #define DS_DOMAIN_TRUST_ATTRIB_CROSS_ORG              0x00000010            
160 #define DS_DOMAIN_TRUST_ATTRIB_IN_FOREST              0x00000020            
161 #define DS_DOMAIN_TRUST_ATTRIB_EXTERNAL               0x00000040            
162
163
164
165 /* DS_Q_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() request */
166 typedef struct 
167 {
168         uint32          server_ptr;
169         UNISTR2         server;
170         uint32          flags;
171         
172 } DS_Q_ENUM_DOM_TRUSTS;
173
174 /* DS_R_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() response */
175 typedef struct 
176 {
177         uint32                  num_domains;
178         DS_DOMAIN_TRUSTS_CTR    domains;
179                 
180         NTSTATUS status;
181
182 } DS_R_ENUM_DOM_TRUSTS;
183
184
185 #endif /* _RPC_DS_H */