dsdb: Rework DSDB code to use WERROR
[sfrench/samba-autobuild/.git] / source4 / libnet / libnet_become_dc.h
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
25 struct 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
38 struct 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
48 struct 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
60 struct 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
66 struct 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
82 struct 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
89 struct libnet_BecomeDC_StoreChunk;
90
91 struct 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         WERROR (*store_chunk)(void *private_data,
101                               const struct libnet_BecomeDC_StoreChunk *info);
102 };
103
104 struct 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 req_level;
111         const struct drsuapi_DsGetNCChangesRequest5 *req5;
112         const struct drsuapi_DsGetNCChangesRequest8 *req8;
113         const struct drsuapi_DsGetNCChangesRequest10 *req10;
114         uint32_t ctr_level;
115         const struct drsuapi_DsGetNCChangesCtr1 *ctr1;
116         const struct drsuapi_DsGetNCChangesCtr6 *ctr6;
117         const DATA_BLOB *gensec_skey;
118 };
119
120 struct libnet_BecomeDC_Callbacks {
121         void *private_data;
122         NTSTATUS (*check_options)(void *private_data,
123                                   const struct libnet_BecomeDC_CheckOptions *info);
124         NTSTATUS (*prepare_db)(void *private_data,
125                                const struct libnet_BecomeDC_PrepareDB *info);
126         WERROR (*schema_chunk)(void *private_data,
127                                const struct libnet_BecomeDC_StoreChunk *info);
128         WERROR (*config_chunk)(void *private_data,
129                                const struct libnet_BecomeDC_StoreChunk *info);
130         WERROR (*domain_chunk)(void *private_data,
131                                const struct libnet_BecomeDC_StoreChunk *info);
132 };
133
134 struct libnet_BecomeDC {
135         struct {
136                 const char *domain_dns_name;
137                 const char *domain_netbios_name;
138                 const struct dom_sid *domain_sid;
139                 const char *source_dsa_address;
140                 const char *dest_dsa_netbios_name;
141
142                 struct libnet_BecomeDC_Callbacks callbacks;
143
144                 bool rodc_join;
145         } in;
146
147         struct {
148                 const char *error_string;
149         } out;
150 };
151
152 #endif /* _LIBNET_BECOME_DC_H */