Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

416 lines
14 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1991-1999 Microsoft Corporation
  3. Module Name:
  4. lmdfs.h
  5. Abstract:
  6. This file contains structures, function prototypes, and definitions
  7. for the NetDfs API
  8. Environment:
  9. User Mode - Win32
  10. Notes:
  11. You must include <windef.h> and <lmcons.h> before this file.
  12. --*/
  13. #ifndef _LMDFS_
  14. #define _LMDFS_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. //
  22. // DFS Volume state
  23. //
  24. #define DFS_VOLUME_STATES 0xF
  25. #define DFS_VOLUME_STATE_OK 1
  26. #define DFS_VOLUME_STATE_INCONSISTENT 2
  27. #define DFS_VOLUME_STATE_OFFLINE 3
  28. #define DFS_VOLUME_STATE_ONLINE 4
  29. //
  30. // These are valid for setting the volume state on the root
  31. // These are available to force a resynchronize on the root
  32. // volume or to put it in a standby mode.
  33. //
  34. #define DFS_VOLUME_STATE_RESYNCHRONIZE 0x10
  35. #define DFS_VOLUME_STATE_STANDBY 0x20
  36. //
  37. // These are valid on getting the volume state on the root
  38. // These are available to determine the flavor of DFS
  39. // A few bits are reserved to determine the flavor of the DFS root.
  40. // To get the flavor, and the state with DFS_VOLUME_FLAVORS.
  41. //
  42. // (_state & DFS_VOLUME_FLAVORS) will tell you the flavor of the dfs root.
  43. //
  44. //
  45. #define DFS_VOLUME_FLAVORS 0x0300
  46. #define DFS_VOLUME_FLAVOR_UNUSED1 0x0000
  47. #define DFS_VOLUME_FLAVOR_STANDALONE 0x0100
  48. #define DFS_VOLUME_FLAVOR_AD_BLOB 0x0200
  49. #define DFS_STORAGE_FLAVOR_UNUSED2 0x0300
  50. //
  51. // DFS Storage State
  52. //
  53. #define DFS_STORAGE_STATES 0xF
  54. #define DFS_STORAGE_STATE_OFFLINE 1
  55. #define DFS_STORAGE_STATE_ONLINE 2
  56. #define DFS_STORAGE_STATE_ACTIVE 4
  57. //
  58. // Level 1:
  59. //
  60. typedef struct _DFS_INFO_1 {
  61. LPWSTR EntryPath; // Dfs name for the top of this piece of storage
  62. } DFS_INFO_1, *PDFS_INFO_1, *LPDFS_INFO_1;
  63. //
  64. // Level 2:
  65. //
  66. typedef struct _DFS_INFO_2 {
  67. LPWSTR EntryPath; // Dfs name for the top of this volume
  68. LPWSTR Comment; // Comment for this volume
  69. DWORD State; // State of this volume, one of DFS_VOLUME_STATE_*
  70. DWORD NumberOfStorages; // Number of storages for this volume
  71. } DFS_INFO_2, *PDFS_INFO_2, *LPDFS_INFO_2;
  72. typedef struct _DFS_STORAGE_INFO {
  73. ULONG State; // State of this storage, one of DFS_STORAGE_STATE_*
  74. // possibly OR'd with DFS_STORAGE_STATE_ACTIVE
  75. LPWSTR ServerName; // Name of server hosting this storage
  76. LPWSTR ShareName; // Name of share hosting this storage
  77. } DFS_STORAGE_INFO, *PDFS_STORAGE_INFO, *LPDFS_STORAGE_INFO;
  78. //
  79. // Level 3:
  80. //
  81. typedef struct _DFS_INFO_3 {
  82. LPWSTR EntryPath; // Dfs name for the top of this volume
  83. LPWSTR Comment; // Comment for this volume
  84. DWORD State; // State of this volume, one of DFS_VOLUME_STATE_*
  85. DWORD NumberOfStorages; // Number of storage servers for this volume
  86. #ifdef MIDL_PASS
  87. [size_is(NumberOfStorages)] LPDFS_STORAGE_INFO Storage;
  88. #else
  89. LPDFS_STORAGE_INFO Storage; // An array (of NumberOfStorages elements) of storage-specific information.
  90. #endif // MIDL_PASS
  91. } DFS_INFO_3, *PDFS_INFO_3, *LPDFS_INFO_3;
  92. //
  93. // Level 4:
  94. //
  95. typedef struct _DFS_INFO_4 {
  96. LPWSTR EntryPath; // Dfs name for the top of this volume
  97. LPWSTR Comment; // Comment for this volume
  98. DWORD State; // State of this volume, one of DFS_VOLUME_STATE_*
  99. ULONG Timeout; // Timeout, in seconds, of this junction point
  100. GUID Guid; // Guid of this junction point
  101. DWORD NumberOfStorages; // Number of storage servers for this volume
  102. #ifdef MIDL_PASS
  103. [size_is(NumberOfStorages)] LPDFS_STORAGE_INFO Storage;
  104. #else
  105. LPDFS_STORAGE_INFO Storage; // An array (of NumberOfStorages elements) of storage-specific information.
  106. #endif // MIDL_PASS
  107. } DFS_INFO_4, *PDFS_INFO_4, *LPDFS_INFO_4;
  108. //
  109. // Level 100:
  110. //
  111. typedef struct _DFS_INFO_100 {
  112. LPWSTR Comment; // Comment for this volume or storage
  113. } DFS_INFO_100, *PDFS_INFO_100, *LPDFS_INFO_100;
  114. //
  115. // Level 101:
  116. //
  117. typedef struct _DFS_INFO_101 {
  118. DWORD State; // State of this storage, one of DFS_STORAGE_STATE_*
  119. // possibly OR'd with DFS_STORAGE_STATE_ACTIVE
  120. } DFS_INFO_101, *PDFS_INFO_101, *LPDFS_INFO_101;
  121. //
  122. // Level 102:
  123. //
  124. typedef struct _DFS_INFO_102 {
  125. ULONG Timeout; // Timeout, in seconds, of the junction
  126. } DFS_INFO_102, *PDFS_INFO_102, *LPDFS_INFO_102;
  127. //
  128. // Level 200:
  129. //
  130. typedef struct _DFS_INFO_200 {
  131. LPWSTR FtDfsName; // FtDfs name
  132. } DFS_INFO_200, *PDFS_INFO_200, *LPDFS_INFO_200;
  133. //
  134. // Level 300:
  135. //
  136. typedef struct _DFS_INFO_300 {
  137. DWORD Flags;
  138. LPWSTR DfsName; // Dfs name
  139. } DFS_INFO_300, *PDFS_INFO_300, *LPDFS_INFO_300;
  140. //
  141. // Add a new volume or additional storage for an existing volume at
  142. // DfsEntryPath.
  143. //
  144. NET_API_STATUS NET_API_FUNCTION
  145. NetDfsAdd(
  146. IN LPWSTR DfsEntryPath, // DFS entry path for this added volume or storage
  147. IN LPWSTR ServerName, // Name of server hosting the storage
  148. IN LPWSTR ShareName, // Existing share name for the storage
  149. IN LPWSTR Comment OPTIONAL, // Optional comment for this volume or storage
  150. IN DWORD Flags // See below. Zero for no flags.
  151. );
  152. //
  153. // Flags:
  154. //
  155. #define DFS_ADD_VOLUME 1 // Add a new volume to the DFS if not already there
  156. #define DFS_RESTORE_VOLUME 2 // Volume/Replica is being restored - do not verify share etc.
  157. //
  158. // Setup/teardown API's for standard and FtDfs roots.
  159. //
  160. NET_API_STATUS NET_API_FUNCTION
  161. NetDfsAddStdRoot(
  162. IN LPWSTR ServerName, // Server to remote to
  163. IN LPWSTR RootShare, // Share to make Dfs root
  164. IN LPWSTR Comment OPTIONAL, // Comment
  165. IN DWORD Flags // Flags for operation. Zero for no flags.
  166. );
  167. NET_API_STATUS NET_API_FUNCTION
  168. NetDfsRemoveStdRoot(
  169. IN LPWSTR ServerName, // Server to remote to
  170. IN LPWSTR RootShare, // Share that host Dfs root
  171. IN DWORD Flags // Flags for operation. Zero for no flags.
  172. );
  173. NET_API_STATUS NET_API_FUNCTION
  174. NetDfsAddFtRoot(
  175. IN LPWSTR ServerName, // Server to remote to
  176. IN LPWSTR RootShare, // Share to make Dfs root
  177. IN LPWSTR FtDfsName, // Name of FtDfs to create/join
  178. IN LPWSTR Comment, // Comment
  179. IN DWORD Flags // Flags for operation. Zero for no flags.
  180. );
  181. NET_API_STATUS NET_API_FUNCTION
  182. NetDfsRemoveFtRoot(
  183. IN LPWSTR ServerName, // Server to remote to
  184. IN LPWSTR RootShare, // Share that host Dfs root
  185. IN LPWSTR FtDfsName, // Name of FtDfs to remove or unjoin from.
  186. IN DWORD Flags // Flags for operation. Zero for no flags.
  187. );
  188. NET_API_STATUS NET_API_FUNCTION
  189. NetDfsRemoveFtRootForced(
  190. IN LPWSTR DomainName, // Name of domain the server is in
  191. IN LPWSTR ServerName, // Server to remote to
  192. IN LPWSTR RootShare, // Share that host Dfs root
  193. IN LPWSTR FtDfsName, // Name of FtDfs to remove or unjoin from.
  194. IN DWORD Flags // Flags for operation. Zero for no flags.
  195. );
  196. //
  197. // Call to reinitialize the dfsmanager on a machine
  198. //
  199. NET_API_STATUS NET_API_FUNCTION
  200. NetDfsManagerInitialize(
  201. IN LPWSTR ServerName, // Server to remote to
  202. IN DWORD Flags // Flags for operation. Zero for no flags.
  203. );
  204. NET_API_STATUS NET_API_FUNCTION
  205. NetDfsAddStdRootForced(
  206. IN LPWSTR ServerName, // Server to remote to
  207. IN LPWSTR RootShare, // Share to make Dfs root
  208. IN LPWSTR Comment OPTIONAL, // Comment
  209. IN LPWSTR Store // Drive:\dir backing the share
  210. );
  211. NET_API_STATUS NET_API_FUNCTION
  212. NetDfsGetDcAddress(
  213. IN LPWSTR ServerName, // Server to remote to
  214. IN OUT LPWSTR *DcIpAddress, // The IP address of the DC to use
  215. IN OUT BOOLEAN *IsRoot, // TRUE if server is a Dfs root, FALSE otherwise
  216. IN OUT ULONG *Timeout // Time, in sec, that we stay with this DC
  217. );
  218. //
  219. // Flags for NetDfsSetDcAddress()
  220. //
  221. #define NET_DFS_SETDC_FLAGS 0x00000000
  222. #define NET_DFS_SETDC_TIMEOUT 0x00000001
  223. #define NET_DFS_SETDC_INITPKT 0x00000002
  224. //
  225. // Structures used for site reporting
  226. //
  227. typedef struct {
  228. ULONG SiteFlags; // Below
  229. #ifdef MIDL_PASS
  230. [string,unique] LPWSTR SiteName;
  231. #else
  232. LPWSTR SiteName;
  233. #endif
  234. } DFS_SITENAME_INFO, *PDFS_SITENAME_INFO, *LPDFS_SITENAME_INFO;
  235. // SiteFlags
  236. #define DFS_SITE_PRIMARY 0x1 // This site returned by DsGetSiteName()
  237. typedef struct {
  238. ULONG cSites;
  239. #ifdef MIDL_PASS
  240. [size_is(cSites)] DFS_SITENAME_INFO Site[];
  241. #else
  242. DFS_SITENAME_INFO Site[1];
  243. #endif
  244. } DFS_SITELIST_INFO, *PDFS_SITELIST_INFO, *LPDFS_SITELIST_INFO;
  245. //
  246. // Remove a volume or additional storage for volume from the Dfs at
  247. // DfsEntryPath. When applied to the last storage in a volume, removes
  248. // the volume from the DFS.
  249. //
  250. NET_API_STATUS NET_API_FUNCTION
  251. NetDfsRemove(
  252. IN LPWSTR DfsEntryPath, // DFS entry path for this added volume or storage
  253. IN LPWSTR ServerName, // Name of server hosting the storage
  254. IN LPWSTR ShareName // Name of share hosting the storage
  255. );
  256. //
  257. // Get information about all of the volumes in the Dfs. DfsName is
  258. // the "server" part of the UNC name used to refer to this particular Dfs.
  259. //
  260. // Valid levels are 1-4, 200
  261. //
  262. NET_API_STATUS NET_API_FUNCTION
  263. NetDfsEnum(
  264. IN LPWSTR DfsName, // Name of the Dfs for enumeration
  265. IN DWORD Level, // Level of information requested
  266. IN DWORD PrefMaxLen, // Advisory, but -1 means "get it all"
  267. OUT LPBYTE* Buffer, // API allocates and returns buffer with requested info
  268. OUT LPDWORD EntriesRead, // Number of entries returned
  269. IN OUT LPDWORD ResumeHandle // Must be 0 on first call, reused on subsequent calls
  270. );
  271. //
  272. // Get information about the volume or storage.
  273. // If ServerName and ShareName are specified, the information returned
  274. // is specific to that server and share, else the information is specific
  275. // to the volume as a whole.
  276. //
  277. // Valid levels are 1-4, 100
  278. //
  279. NET_API_STATUS NET_API_FUNCTION
  280. NetDfsGetInfo(
  281. IN LPWSTR DfsEntryPath, // DFS entry path for the volume
  282. IN LPWSTR ServerName OPTIONAL,// Name of server hosting a storage
  283. IN LPWSTR ShareName OPTIONAL, // Name of share on server serving the volume
  284. IN DWORD Level, // Level of information requested
  285. OUT LPBYTE* Buffer // API allocates and returns buffer with requested info
  286. );
  287. //
  288. // Set info about the volume or storage.
  289. // If ServerName and ShareName are specified, the information set is
  290. // specific to that server and share, else the information is specific
  291. // to the volume as a whole.
  292. //
  293. // Valid levels are 100, 101 and 102
  294. //
  295. NET_API_STATUS NET_API_FUNCTION
  296. NetDfsSetInfo(
  297. IN LPWSTR DfsEntryPath, // DFS entry path for the volume
  298. IN LPWSTR ServerName OPTIONAL, // Name of server hosting a storage
  299. IN LPWSTR ShareName OPTIONAL, // Name of share hosting a storage
  300. IN DWORD Level, // Level of information to be set
  301. IN LPBYTE Buffer // Buffer holding information
  302. );
  303. //
  304. // Get client's cached information about the volume or storage.
  305. // If ServerName and ShareName are specified, the information returned
  306. // is specific to that server and share, else the information is specific
  307. // to the volume as a whole.
  308. //
  309. // Valid levels are 1-4
  310. //
  311. NET_API_STATUS NET_API_FUNCTION
  312. NetDfsGetClientInfo(
  313. IN LPWSTR DfsEntryPath, // DFS entry path for the volume
  314. IN LPWSTR ServerName OPTIONAL,// Name of server hosting a storage
  315. IN LPWSTR ShareName OPTIONAL, // Name of share on server serving the volume
  316. IN DWORD Level, // Level of information requested
  317. OUT LPBYTE* Buffer // API allocates and returns buffer with requested info
  318. );
  319. //
  320. // Set client's cached info about the volume or storage.
  321. // If ServerName and ShareName are specified, the information set is
  322. // specific to that server and share, else the information is specific
  323. // to the volume as a whole.
  324. //
  325. // Valid levels are 101 and 102.
  326. //
  327. NET_API_STATUS NET_API_FUNCTION
  328. NetDfsSetClientInfo(
  329. IN LPWSTR DfsEntryPath, // DFS entry path for the volume
  330. IN LPWSTR ServerName OPTIONAL, // Name of server hosting a storage
  331. IN LPWSTR ShareName OPTIONAL, // Name of share hosting a storage
  332. IN DWORD Level, // Level of information to be set
  333. IN LPBYTE Buffer // Buffer holding information
  334. );
  335. //
  336. // Move a DFS volume and all subordinate volumes from one place in the
  337. // DFS to another place in the DFS.
  338. //
  339. NET_API_STATUS NET_API_FUNCTION
  340. NetDfsMove(
  341. IN LPWSTR DfsEntryPath, // Current DFS entry path for this volume
  342. IN LPWSTR DfsNewEntryPath // New DFS entry path for this volume
  343. );
  344. NET_API_STATUS NET_API_FUNCTION
  345. NetDfsRename(
  346. IN LPWSTR Path, // Current Win32 path in a Dfs
  347. IN LPWSTR NewPath // New Win32 path in the same Dfs
  348. );
  349. #ifdef __cplusplus
  350. }
  351. #endif
  352. #endif // _LMDFS_