1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
26 */
27
28#ifndef _DSSETUP_NDL_
29#define	_DSSETUP_NDL_
30
31/*
32 * Active Directory Service Setup
33 *
34 * Originally this interface contained a number of operations, as listed
35 * below, but due to a buffer overflow security issue, all operations
36 * except DsRoleGetPrimaryDomainInfo have been deprecated (MS04-011).
37 */
38
39#include <libmlrpc/ndrtypes.ndl>
40
41
42#define	DSSETUP_OPNUM_DsRoleGetPrimaryDomainInfo	0x00
43#define	DSSETUP_OPNUM_DsRoleDnsNameToFlatName		0x01
44#define	DSSETUP_OPNUM_DsRoleDcAsDc			0x02
45#define	DSSETUP_OPNUM_DsRoleDcAsReplica			0x03
46#define	DSSETUP_OPNUM_DsRoleDemoteDc			0x04
47#define	DSSETUP_OPNUM_DsRoleGetDcOperationProgress	0x05
48#define	DSSETUP_OPNUM_DsRoleGetDcOperationResults	0x06
49#define	DSSETUP_OPNUM_DsRoleCancel			0x07
50#define	DSSETUP_OPNUM_DsRoleServerSaveStateForUpgrade	0x08
51#define	DSSETUP_OPNUM_DsRoleUpgradeDownlevelServer	0x09
52#define	DSSETUP_OPNUM_DsRoleAbortDownlevelServerUpgrade	0x0a
53
54/*
55 * DS roles
56 */
57#define	DS_ROLE_STANDALONE_WORKSTATION	0
58#define	DS_ROLE_MEMBER_WORKSTATION	1
59#define	DS_ROLE_STANDALONE_SERVER	2
60#define	DS_ROLE_MEMBER_SERVER		3
61#define	DS_ROLE_BACKUP_DC		4
62#define	DS_ROLE_PRIMARY_DC		5
63
64/*
65 * DS role flags
66 */
67#define	DS_ROLE_PRIMARY_DS_RUNNING              0x00000001
68#define	DS_ROLE_PRIMARY_DS_MIXED_MODE           0x00000002
69#define	DS_ROLE_UPGRADE_IN_PROGRESS             0x00000004
70#define	DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT	0x01000000
71
72/*
73 * DS role upgrade
74 */
75#define	DS_ROLE_NOT_UPGRADING		0
76#define	DS_ROLE_UPGRADING		1
77
78/*
79 * DS role previous
80 */
81#define	DS_ROLE_PREVIOUS_UNKNOWN	0
82#define	DS_ROLE_PREVIOUS_PRIMARY	1
83#define	DS_ROLE_PREVIOUS_BACKUP		2
84
85/*
86 * DS role state
87 */
88#define	DS_ROLE_OP_IDLE			0
89#define	DS_ROLE_OP_ACTIVE		1
90#define	DS_ROLE_OP_NEEDS_REBOOT		2
91
92/*
93 * DS role information levels
94 */
95#define	DS_ROLE_BASIC_INFORMATION	1
96#define	DS_ROLE_UPGRADE_STATUS		2
97#define	DS_ROLE_OP_STATUS		3
98
99struct dssetup_uuid {
100	DWORD	data1;
101	WORD	data2;
102	WORD	data3;
103	BYTE	data4[8];
104};
105typedef struct dssetup_uuid dssetup_uuid_t;
106
107/*
108 * DS_ROLE_BASIC_INFORMATION
109 */
110struct dssetup_DsRolePrimaryDomInfo1 {
111	DWORD role;
112	DWORD flags;
113	LPTSTR nt_domain;
114	LPTSTR dns_domain;
115	LPTSTR forest;
116	dssetup_uuid_t domain_guid;
117};
118typedef struct dssetup_DsRolePrimaryDomInfo1 ds_primary_domain_info_t;
119
120/*
121 * DS_ROLE_UPGRADE_STATUS
122 */
123struct dssetup_DsRolePrimaryDomInfo2 {
124	DWORD upgrade_state;
125	DWORD previous_role;
126};
127
128/*
129 * DS_ROLE_OP_STATUS
130 */
131struct dssetup_DsRolePrimaryDomInfo3 {
132	DWORD status;
133};
134
135union dssetup_GetPrimaryDomainInfo_ru {
136	UNION_INFO_ENT(1,dssetup_DsRolePrimaryDomInfo);
137	UNION_INFO_ENT(2,dssetup_DsRolePrimaryDomInfo);
138	UNION_INFO_ENT(3,dssetup_DsRolePrimaryDomInfo);
139	DEFAULT	char *nullptr;
140};
141
142struct dssetup_GetPrimaryDomainInfo {
143	WORD switch_value;
144    SWITCH(switch_value)
145	union dssetup_GetPrimaryDomainInfo_ru ru;
146};
147typedef struct dssetup_GetPrimaryDomainInfo dssetup_GetPrimaryDomainInfo_t;
148
149OPERATION(DSSETUP_OPNUM_DsRoleGetPrimaryDomainInfo)
150struct dssetup_DsRoleGetPrimaryDomainInfo {
151	IN	WORD level;
152	OUT	struct dssetup_GetPrimaryDomainInfo *info;
153	OUT	DWORD status;
154};
155typedef struct dssetup_DsRoleGetPrimaryDomainInfo
156    dssetup_DsRoleGetPrimaryDomainInfo_t;
157
158
159/*
160 ***********************************************************************
161 * DSSETUP interface definiton.
162 ***********************************************************************
163 */
164INTERFACE(0)
165union dssetup_interface {
166	CASE(DSSETUP_OPNUM_DsRoleGetPrimaryDomainInfo)
167		struct dssetup_DsRoleGetPrimaryDomainInfo GetPrimaryDomainInfo;
168};
169typedef union dssetup_interface dssetup_interface_t;
170EXTERNTYPEINFO(dssetup_interface)
171
172#endif /* _DSSETUP_NDL_ */
173