1/*
2   Unix SMB/CIFS implementation.
3
4   Copyright (C) Stefan Metzmacher <metze@samba.org> 2006
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 _LIBNET_BECOME_DC_H
21#define _LIBNET_BECOME_DC_H
22
23#include "librpc/gen_ndr/drsuapi.h"
24
25struct libnet_BecomeDC_Domain {
26	/* input */
27	const char *dns_name;
28	const char *netbios_name;
29	const struct dom_sid *sid;
30
31	/* constructed */
32	struct GUID guid;
33	const char *dn_str;
34	uint32_t behavior_version;
35	uint32_t w2k3_update_revision;
36};
37
38struct libnet_BecomeDC_Forest {
39	/* constructed */
40	const char *dns_name;
41	const char *root_dn_str;
42	const char *config_dn_str;
43	uint32_t crossref_behavior_version;
44	const char *schema_dn_str;
45	uint32_t schema_object_version;
46};
47
48struct libnet_BecomeDC_SourceDSA {
49	/* input */
50	const char *address;
51
52	/* constructed */
53	const char *dns_name;
54	const char *netbios_name;
55	const char *site_name;
56	const char *server_dn_str;
57	const char *ntds_dn_str;
58};
59
60struct libnet_BecomeDC_CheckOptions {
61	const struct libnet_BecomeDC_Domain *domain;
62	const struct libnet_BecomeDC_Forest *forest;
63	const struct libnet_BecomeDC_SourceDSA *source_dsa;
64};
65
66struct libnet_BecomeDC_DestDSA {
67	/* input */
68	const char *netbios_name;
69
70	/* constructed */
71	const char *dns_name;
72	const char *site_name;
73	struct GUID site_guid;
74	const char *computer_dn_str;
75	const char *server_dn_str;
76	const char *ntds_dn_str;
77	struct GUID ntds_guid;
78	struct GUID invocation_id;
79	uint32_t user_account_control;
80};
81
82struct libnet_BecomeDC_PrepareDB {
83	const struct libnet_BecomeDC_Domain *domain;
84	const struct libnet_BecomeDC_Forest *forest;
85	const struct libnet_BecomeDC_SourceDSA *source_dsa;
86	const struct libnet_BecomeDC_DestDSA *dest_dsa;
87};
88
89struct libnet_BecomeDC_StoreChunk;
90
91struct libnet_BecomeDC_Partition {
92	struct drsuapi_DsReplicaObjectIdentifier nc;
93	struct GUID destination_dsa_guid;
94	struct GUID source_dsa_guid;
95	struct GUID source_dsa_invocation_id;
96	struct drsuapi_DsReplicaHighWaterMark highwatermark;
97	bool more_data;
98	uint32_t replica_flags;
99
100	NTSTATUS (*store_chunk)(void *private_data,
101				const struct libnet_BecomeDC_StoreChunk *info);
102};
103
104struct libnet_BecomeDC_StoreChunk {
105	const struct libnet_BecomeDC_Domain *domain;
106	const struct libnet_BecomeDC_Forest *forest;
107	const struct libnet_BecomeDC_SourceDSA *source_dsa;
108	const struct libnet_BecomeDC_DestDSA *dest_dsa;
109	const struct libnet_BecomeDC_Partition *partition;
110	uint32_t ctr_level;
111	const struct drsuapi_DsGetNCChangesCtr1 *ctr1;
112	const struct drsuapi_DsGetNCChangesCtr6 *ctr6;
113	const DATA_BLOB *gensec_skey;
114};
115
116struct libnet_BecomeDC_Callbacks {
117	void *private_data;
118	NTSTATUS (*check_options)(void *private_data,
119				  const struct libnet_BecomeDC_CheckOptions *info);
120	NTSTATUS (*prepare_db)(void *private_data,
121			       const struct libnet_BecomeDC_PrepareDB *info);
122	NTSTATUS (*schema_chunk)(void *private_data,
123				 const struct libnet_BecomeDC_StoreChunk *info);
124	NTSTATUS (*config_chunk)(void *private_data,
125				 const struct libnet_BecomeDC_StoreChunk *info);
126	NTSTATUS (*domain_chunk)(void *private_data,
127				 const struct libnet_BecomeDC_StoreChunk *info);
128};
129
130struct libnet_BecomeDC {
131	struct {
132		const char *domain_dns_name;
133		const char *domain_netbios_name;
134		const struct dom_sid *domain_sid;
135		const char *source_dsa_address;
136		const char *dest_dsa_netbios_name;
137
138		struct libnet_BecomeDC_Callbacks callbacks;
139	} in;
140
141	struct {
142		const char *error_string;
143	} out;
144};
145
146#endif /* _LIBNET_BECOME_DC_H */
147