Source code of Windows XP (NT5)
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.

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