1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 //! This file contains structures, function prototypes, and definitions for the replicator APIs
7 use shared::lmcons::{NET_API_STATUS, PARMNUM_BASE_INFOLEVEL};
8 use shared::minwindef::{DWORD, LPBYTE, LPDWORD};
9 use um::winnt::{LPCWSTR, LPWSTR};
10 pub const REPL_ROLE_EXPORT: DWORD = 1;
11 pub const REPL_ROLE_IMPORT: DWORD = 2;
12 pub const REPL_ROLE_BOTH: DWORD = 3;
13 pub const REPL_INTERVAL_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 0;
14 pub const REPL_PULSE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 1;
15 pub const REPL_GUARDTIME_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 2;
16 pub const REPL_RANDOM_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 3;
17 STRUCT!{struct REPL_INFO_0 {
18     rp0_role: DWORD,
19     rp0_exportpath: LPWSTR,
20     rp0_exportlist: LPWSTR,
21     rp0_importpath: LPWSTR,
22     rp0_importlist: LPWSTR,
23     rp0_logonusername: LPWSTR,
24     rp0_interval: DWORD,
25     rp0_pulse: DWORD,
26     rp0_guardtime: DWORD,
27     rp0_random: DWORD,
28 }}
29 pub type PREPL_INFO_0 = *mut REPL_INFO_0;
30 pub type LPREPL_INFO_0 = *mut REPL_INFO_0;
31 STRUCT!{struct REPL_INFO_1000 {
32     rp1000_interval: DWORD,
33 }}
34 pub type PREPL_INFO_1000 = *mut REPL_INFO_1000;
35 pub type LPREPL_INFO_1000 = *mut REPL_INFO_1000;
36 STRUCT!{struct REPL_INFO_1001 {
37     rp1001_pulse: DWORD,
38 }}
39 pub type PREPL_INFO_1001 = *mut REPL_INFO_1001;
40 pub type LPREPL_INFO_1001 = *mut REPL_INFO_1001;
41 STRUCT!{struct REPL_INFO_1002 {
42     rp1002_guardtime: DWORD,
43 }}
44 pub type PREPL_INFO_1002 = *mut REPL_INFO_1002;
45 pub type LPREPL_INFO_1002 = *mut REPL_INFO_1002;
46 STRUCT!{struct REPL_INFO_1003 {
47     rp1003_random: DWORD,
48 }}
49 pub type PREPL_INFO_1003 = *mut REPL_INFO_1003;
50 pub type LPREPL_INFO_1003 = *mut REPL_INFO_1003;
51 extern "system" {
NetReplGetInfo( servername: LPCWSTR, level: DWORD, bufptr: *mut LPBYTE, ) -> NET_API_STATUS52     pub fn NetReplGetInfo(
53         servername: LPCWSTR,
54         level: DWORD,
55         bufptr: *mut LPBYTE,
56     ) -> NET_API_STATUS;
NetReplSetInfo( servername: LPCWSTR, level: DWORD, buf: LPBYTE, parm_err: LPDWORD, ) -> NET_API_STATUS57     pub fn NetReplSetInfo(
58         servername: LPCWSTR,
59         level: DWORD,
60         buf: LPBYTE,
61         parm_err: LPDWORD,
62     ) -> NET_API_STATUS;
63 }
64 pub const REPL_INTEGRITY_FILE: DWORD = 1;
65 pub const REPL_INTEGRITY_TREE: DWORD = 2;
66 pub const REPL_EXTENT_FILE: DWORD = 1;
67 pub const REPL_EXTENT_TREE: DWORD = 2;
68 pub const REPL_EXPORT_INTEGRITY_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 0;
69 pub const REPL_EXPORT_EXTENT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 1;
70 STRUCT!{struct REPL_EDIR_INFO_0 {
71     rped0_dirname: LPWSTR,
72 }}
73 pub type PREPL_EDIR_INFO_0 = *mut REPL_EDIR_INFO_0;
74 pub type LPREPL_EDIR_INFO_0 = *mut REPL_EDIR_INFO_0;
75 STRUCT!{struct REPL_EDIR_INFO_1 {
76     rped1_dirname: LPWSTR,
77     rped1_integrity: DWORD,
78     rped1_extent: DWORD,
79 }}
80 pub type PREPL_EDIR_INFO_1 = *mut REPL_EDIR_INFO_1;
81 pub type LPREPL_EDIR_INFO_1 = *mut REPL_EDIR_INFO_1;
82 STRUCT!{struct REPL_EDIR_INFO_2 {
83     rped2_dirname: LPWSTR,
84     rped2_integrity: DWORD,
85     rped2_extent: DWORD,
86     rped2_lockcount: DWORD,
87     rped2_locktime: DWORD,
88 }}
89 pub type PREPL_EDIR_INFO_2 = *mut REPL_EDIR_INFO_2;
90 pub type LPREPL_EDIR_INFO_2 = *mut REPL_EDIR_INFO_2;
91 STRUCT!{struct REPL_EDIR_INFO_1000 {
92     rped1000_integrity: DWORD,
93 }}
94 pub type PREPL_EDIR_INFO_1000 = *mut REPL_EDIR_INFO_1000;
95 pub type LPREPL_EDIR_INFO_1000 = *mut REPL_EDIR_INFO_1000;
96 STRUCT!{struct REPL_EDIR_INFO_1001 {
97     rped1001_extent: DWORD,
98 }}
99 pub type PREPL_EDIR_INFO_1001 = *mut REPL_EDIR_INFO_1001;
100 pub type LPREPL_EDIR_INFO_1001 = *mut REPL_EDIR_INFO_1001;
101 extern "system" {
NetReplExportDirAdd( servername: LPCWSTR, level: DWORD, buf: LPBYTE, parm_err: LPDWORD, ) -> NET_API_STATUS102     pub fn NetReplExportDirAdd(
103         servername: LPCWSTR,
104         level: DWORD,
105         buf: LPBYTE,
106         parm_err: LPDWORD,
107     ) -> NET_API_STATUS;
NetReplExportDirDel( servername: LPCWSTR, dirname: LPCWSTR, ) -> NET_API_STATUS108     pub fn NetReplExportDirDel(
109         servername: LPCWSTR,
110         dirname: LPCWSTR,
111     ) -> NET_API_STATUS;
NetReplExportDirEnum( servername: LPCWSTR, level: DWORD, bufptr: *mut LPBYTE, prefmaxlen: DWORD, entriesread: LPDWORD, totalentries: LPDWORD, resumehandle: LPDWORD, ) -> NET_API_STATUS112     pub fn NetReplExportDirEnum(
113         servername: LPCWSTR,
114         level: DWORD,
115         bufptr: *mut LPBYTE,
116         prefmaxlen: DWORD,
117         entriesread: LPDWORD,
118         totalentries: LPDWORD,
119         resumehandle: LPDWORD,
120     ) -> NET_API_STATUS;
NetReplExportDirGetInfo( servername: LPCWSTR, dirname: LPCWSTR, level: DWORD, bufptr: *mut LPBYTE, ) -> NET_API_STATUS121     pub fn NetReplExportDirGetInfo(
122         servername: LPCWSTR,
123         dirname: LPCWSTR,
124         level: DWORD,
125         bufptr: *mut LPBYTE,
126     ) -> NET_API_STATUS;
NetReplExportDirSetInfo( servername: LPCWSTR, dirname: LPCWSTR, level: DWORD, buf: LPBYTE, parm_err: LPDWORD, ) -> NET_API_STATUS127     pub fn NetReplExportDirSetInfo(
128         servername: LPCWSTR,
129         dirname: LPCWSTR,
130         level: DWORD,
131         buf: LPBYTE,
132         parm_err: LPDWORD,
133     ) -> NET_API_STATUS;
NetReplExportDirLock( servername: LPCWSTR, dirname: LPCWSTR, ) -> NET_API_STATUS134     pub fn NetReplExportDirLock(
135         servername: LPCWSTR,
136         dirname: LPCWSTR,
137     ) -> NET_API_STATUS;
NetReplExportDirUnlock( servername: LPCWSTR, dirname: LPCWSTR, unlockforce: DWORD, ) -> NET_API_STATUS138     pub fn NetReplExportDirUnlock(
139         servername: LPCWSTR,
140         dirname: LPCWSTR,
141         unlockforce: DWORD,
142     ) -> NET_API_STATUS;
143 }
144 pub const REPL_UNLOCK_NOFORCE: DWORD = 0;
145 pub const REPL_UNLOCK_FORCE: DWORD = 1;
146 STRUCT!{struct REPL_IDIR_INFO_0 {
147     rpid0_dirname: LPWSTR,
148 }}
149 pub type PREPL_IDIR_INFO_0 = *mut REPL_IDIR_INFO_0;
150 pub type LPREPL_IDIR_INFO_0 = *mut REPL_IDIR_INFO_0;
151 STRUCT!{struct REPL_IDIR_INFO_1 {
152     rpid1_dirname: LPWSTR,
153     rpid1_state: DWORD,
154     rpid1_mastername: LPWSTR,
155     rpid1_last_update_time: DWORD,
156     rpid1_lockcount: DWORD,
157     rpid1_locktime: DWORD,
158 }}
159 pub type PREPL_IDIR_INFO_1 = *mut REPL_IDIR_INFO_1;
160 pub type LPREPL_IDIR_INFO_1 = *mut REPL_IDIR_INFO_1;
161 extern "system" {
NetReplImportDirAdd( servername: LPCWSTR, level: DWORD, buf: LPBYTE, parm_err: LPDWORD, ) -> NET_API_STATUS162     pub fn NetReplImportDirAdd(
163         servername: LPCWSTR,
164         level: DWORD,
165         buf: LPBYTE,
166         parm_err: LPDWORD,
167     ) -> NET_API_STATUS;
NetReplImportDirDel( servername: LPCWSTR, dirname: LPCWSTR, ) -> NET_API_STATUS168     pub fn NetReplImportDirDel(
169         servername: LPCWSTR,
170         dirname: LPCWSTR,
171     ) -> NET_API_STATUS;
NetReplImportDirEnum( servername: LPCWSTR, level: DWORD, bufptr: *mut LPBYTE, prefmaxlen: DWORD, entriesread: LPDWORD, totalentries: LPDWORD, resumehandle: LPDWORD, ) -> NET_API_STATUS172     pub fn NetReplImportDirEnum(
173         servername: LPCWSTR,
174         level: DWORD,
175         bufptr: *mut LPBYTE,
176         prefmaxlen: DWORD,
177         entriesread: LPDWORD,
178         totalentries: LPDWORD,
179         resumehandle: LPDWORD,
180     ) -> NET_API_STATUS;
NetReplImportDirGetInfo( servername: LPCWSTR, dirname: LPCWSTR, level: DWORD, bufptr: *mut LPBYTE, ) -> NET_API_STATUS181     pub fn NetReplImportDirGetInfo(
182         servername: LPCWSTR,
183         dirname: LPCWSTR,
184         level: DWORD,
185         bufptr: *mut LPBYTE,
186     ) -> NET_API_STATUS;
NetReplImportDirLock( servername: LPCWSTR, dirname: LPCWSTR, ) -> NET_API_STATUS187     pub fn NetReplImportDirLock(
188         servername: LPCWSTR,
189         dirname: LPCWSTR,
190     ) -> NET_API_STATUS;
NetReplImportDirUnlock( servername: LPCWSTR, dirname: LPCWSTR, unlockforce: DWORD, ) -> NET_API_STATUS191     pub fn NetReplImportDirUnlock(
192         servername: LPCWSTR,
193         dirname: LPCWSTR,
194         unlockforce: DWORD,
195     ) -> NET_API_STATUS;
196 }
197 pub const REPL_STATE_OK: DWORD = 0;
198 pub const REPL_STATE_NO_MASTER: DWORD = 1;
199 pub const REPL_STATE_NO_SYNC: DWORD = 2;
200 pub const REPL_STATE_NEVER_REPLICATED: DWORD = 3;
201