bfe5179490c5203c9e6e438ca28913f9657d7d41
[samba.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 2 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
34 /* macros for RPC's */
35
36 /* DSROLE_PRIMARY_DOMAIN_INFO_BASIC */
37
38 /* flags */
39
40 #define DSROLE_PRIMARY_DS_RUNNING           0x00000001
41 #define DSROLE_PRIMARY_DS_MIXED_MODE        0x00000002
42 #define DSROLE_UPGRADE_IN_PROGRESS          0x00000004
43 #define DSROLE_PRIMARY_DOMAIN_GUID_PRESENT  0x01000000
44
45 /* machine role */
46
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
59
60 typedef struct
61 {
62         uint16          machine_role;
63         uint16          unknown;                /* 0x6173 -- maybe just alignment? */
64         
65         uint32          flags;
66         
67         uint32          netbios_ptr;
68         uint32          dnsname_ptr;
69         uint32          forestname_ptr;
70         
71         struct GUID     domain_guid;
72         
73         UNISTR2 netbios_domain;
74
75         UNISTR2 dns_domain;     /* our dns domain */
76         UNISTR2 forest_domain;  /* root domain of the forest to which we belong */
77 } DSROLE_PRIMARY_DOMAIN_INFO_BASIC;
78
79 typedef struct
80 {
81         DSROLE_PRIMARY_DOMAIN_INFO_BASIC        *basic;
82 } DS_DOMINFO_CTR;
83
84 /* info levels for ds_getprimdominfo() */
85
86 #define DsRolePrimaryDomainInfoBasic            1
87
88
89 /* DS_Q_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() request */
90 typedef struct 
91 {
92         uint16  level;
93 } DS_Q_GETPRIMDOMINFO;
94
95 /* DS_R_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() response */
96 typedef struct 
97 {
98         uint32          ptr;
99                 
100         uint16          level;
101         uint16          unknown0;       /* 0x455c -- maybe just alignment? */
102
103         DS_DOMINFO_CTR  info;
104         
105         NTSTATUS status;
106 } DS_R_GETPRIMDOMINFO;
107
108 typedef struct {
109         /* static portion of structure */
110         uint32          netbios_ptr;
111         uint32          dns_ptr;
112         uint32          flags;
113         uint32          parent_index;
114         uint32          trust_type;
115         uint32          trust_attributes;
116         uint32          sid_ptr;
117         struct GUID     guid;
118         
119         UNISTR2         netbios_domain;
120         UNISTR2         dns_domain;
121         DOM_SID2        sid;
122
123 } DS_DOMAIN_TRUSTS;
124
125 struct ds_domain_trust {
126         /* static portion of structure */
127         uint32          flags;
128         uint32          parent_index;
129         uint32          trust_type;
130         uint32          trust_attributes;
131         struct GUID     guid;
132         
133         DOM_SID sid;
134         char *netbios_domain;
135         char *dns_domain;
136 };
137
138 typedef struct {
139
140         uint32                  ptr;
141         uint32                  max_count;
142         DS_DOMAIN_TRUSTS        *trusts;
143         
144 } DS_DOMAIN_TRUSTS_CTR;
145
146 #define DS_DOMAIN_IN_FOREST           0x0001    /* domains in the forest to which 
147                                                    we belong; even different domain trees */
148 #define DS_DOMAIN_DIRECT_OUTBOUND     0x0002    /* trusted domains */
149 #define DS_DOMAIN_TREE_ROOT           0x0004    /* root of our forest; also available in
150                                                    DsRoleGetPrimaryDomainInfo() */
151 #define DS_DOMAIN_PRIMARY             0x0008    /* our domain */
152 #define DS_DOMAIN_NATIVE_MODE         0x0010    /* native mode AD servers */
153 #define DS_DOMAIN_DIRECT_INBOUND      0x0020    /* trusting domains */
154
155 /* DS_Q_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() request */
156 typedef struct 
157 {
158         uint32          server_ptr;
159         UNISTR2         server;
160         uint32          flags;
161         
162 } DS_Q_ENUM_DOM_TRUSTS;
163
164 /* DS_R_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() response */
165 typedef struct 
166 {
167         uint32                  num_domains;
168         DS_DOMAIN_TRUSTS_CTR    domains;
169                 
170         NTSTATUS status;
171
172 } DS_R_ENUM_DOM_TRUSTS;
173
174
175 #endif /* _RPC_DS_H */