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.

437 lines
7.8 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. nm.h
  5. Abstract:
  6. Public interface definitions for the Node Manager component.
  7. Author:
  8. Mike Massa (mikemas) 12-Mar-1996
  9. Revision History:
  10. --*/
  11. #include <ntlsa.h>
  12. #include <ntmsv1_0.h>
  13. #include <wincrypt.h>
  14. #ifndef _NM_INCLUDED
  15. #define _NM_INCLUDED
  16. //
  17. // Types
  18. //
  19. typedef struct _NM_NODE *PNM_NODE;
  20. typedef struct _NM_NETWORK *PNM_NETWORK;
  21. typedef struct _NM_INTERFACE *PNM_INTERFACE;
  22. //the callback registered for object notifications
  23. typedef DWORD (WINAPI *NM_FIXUP_NOTIFYCB)(
  24. IN DWORD dwFixupType,
  25. OUT PVOID *ppPropertyList,
  26. OUT LPDWORD pdwPropertyListSize,
  27. OUT LPWSTR * szKeyName
  28. );
  29. //
  30. // Data
  31. //
  32. #define NM_DEFAULT_NODE_LIMIT 2 // This is the default if
  33. // MaxNodesInCluster is not set
  34. #define NM_FORM_FIXUP 1
  35. #define NM_JOIN_FIXUP 2
  36. extern ULONG NmMaxNodes;
  37. extern CL_NODE_ID NmMaxNodeId;
  38. extern CL_NODE_ID NmLocalNodeId;
  39. extern PNM_NODE NmLocalNode;
  40. extern WCHAR NmLocalNodeName[];
  41. extern WCHAR NmLocalNodeIdString[];
  42. extern HANDLE NmClusnetHandle;
  43. extern BOOL NmLocalNodeVersionChanged;
  44. extern RESUTIL_PROPERTY_ITEM NmJoinFixupSDProperties[];
  45. extern RESUTIL_PROPERTY_ITEM NmJoinFixupWINSProperties[];
  46. extern RESUTIL_PROPERTY_ITEM NmJoinFixupDHCPProperties[];
  47. extern RESUTIL_PROPERTY_ITEM NmJoinFixupSMTPProperties[];
  48. extern RESUTIL_PROPERTY_ITEM NmJoinFixupNNTPProperties[];
  49. extern RESUTIL_PROPERTY_ITEM NmJoinFixupIISProperties[];
  50. extern RESUTIL_PROPERTY_ITEM NmJoinFixupNewMSMQProperties[];
  51. extern RESUTIL_PROPERTY_ITEM NmJoinFixupMSDTCProperties[];
  52. extern RESUTIL_PROPERTY_ITEM NmFixupVersionInfo[];
  53. extern RESUTIL_PROPERTY_ITEM NmFixupClusterProperties[];
  54. extern HCRYPTPROV NmCryptServiceProvider;
  55. //
  56. // Macros
  57. //
  58. #define NmIsValidNodeId(_id) ( ((_id) >= ClusterMinNodeId) && \
  59. ((_id) <= NmMaxNodeId) )
  60. //
  61. // Init/Shutdown Routines
  62. //
  63. DWORD
  64. NmInitialize(
  65. VOID
  66. );
  67. VOID
  68. NmShutdown(
  69. VOID
  70. );
  71. DWORD
  72. NmFormNewCluster(
  73. VOID
  74. );
  75. DWORD
  76. NmJoinCluster(
  77. IN RPC_BINDING_HANDLE SponsorBinding
  78. );
  79. DWORD
  80. NmJoinComplete(
  81. OUT DWORD *EndSeq
  82. );
  83. VOID
  84. NmLeaveCluster(
  85. VOID
  86. );
  87. DWORD
  88. NmCreateNodeBindings(
  89. IN LPCWSTR lpszNodeId,
  90. IN LPCWSTR SponsorNetworkId
  91. );
  92. BOOL
  93. NmCreateActiveNodeBindingsCallback(
  94. IN PVOID Context1,
  95. IN PVOID Context2,
  96. IN PVOID Object,
  97. IN LPCWSTR Name
  98. );
  99. DWORD
  100. NmJoinNodeToCluster(
  101. CL_NODE_ID JoiningNodeId
  102. );
  103. VOID
  104. NmTimerTick(
  105. IN DWORD MsTickInterval
  106. );
  107. DWORD
  108. NmGetJoinSequence(
  109. VOID
  110. );
  111. DWORD NmGetClusterOperationalVersion(
  112. OUT LPDWORD pdwClusterHighestVersion,
  113. OUT LPDWORD pdwClusterLowestVersion,
  114. OUT LPDWORD pdwFlags
  115. );
  116. //
  117. // Node Object Management Routines
  118. //
  119. PNM_NODE
  120. NmReferenceNodeById(
  121. IN DWORD NodeId
  122. );
  123. CLUSTER_NODE_STATE
  124. NmGetNodeState(
  125. IN PNM_NODE Node
  126. );
  127. DWORD
  128. NmPauseNode(
  129. IN PNM_NODE Node
  130. );
  131. DWORD
  132. NmResumeNode(
  133. IN PNM_NODE Node
  134. );
  135. DWORD
  136. NmEvictNode(
  137. IN PNM_NODE Node
  138. );
  139. VOID
  140. NmAdviseNodeFailure(
  141. IN DWORD NodeId,
  142. IN DWORD ErrorCode
  143. );
  144. DWORD
  145. NmEnumNodeInterfaces(
  146. IN PNM_NODE Node,
  147. OUT LPDWORD InterfaceCount,
  148. OUT PNM_INTERFACE * InterfaceList[]
  149. );
  150. DWORD
  151. NmGetNodeId(
  152. IN PNM_NODE Node
  153. );
  154. HANDLE
  155. NmGetNodeStateDownEvent(
  156. IN PNM_NODE Node
  157. );
  158. DWORD
  159. NmGetCurrentNumberOfNodes(
  160. void
  161. );
  162. DWORD
  163. NmGetMaxNodeId(
  164. );
  165. PNM_NODE
  166. NmReferenceJoinerNode(
  167. IN DWORD JoinerSequence,
  168. IN CL_NODE_ID NodeId
  169. );
  170. VOID
  171. NmDereferenceJoinerNode(
  172. PNM_NODE JoinerNode
  173. );
  174. DWORD
  175. WINAPI
  176. NmNodeControl(
  177. IN PNM_NODE Node,
  178. IN PNM_NODE HostNode OPTIONAL,
  179. IN DWORD ControlCode,
  180. IN PUCHAR InBuffer,
  181. IN DWORD InBufferSize,
  182. OUT PUCHAR OutBuffer,
  183. IN DWORD OutBufferSize,
  184. OUT LPDWORD BytesReturned,
  185. OUT LPDWORD Required
  186. );
  187. //
  188. // Network Object Management Routines
  189. //
  190. CLUSTER_NETWORK_STATE
  191. NmGetNetworkState(
  192. IN PNM_NETWORK Network
  193. );
  194. DWORD
  195. NmSetNetworkName(
  196. IN PNM_NETWORK Network,
  197. IN LPCWSTR Name
  198. );
  199. DWORD
  200. NmSetNetworkPriorityOrder(
  201. IN DWORD NetworkCount,
  202. IN LPWSTR * NetworkIdList
  203. );
  204. DWORD
  205. NmEnumInternalNetworks(
  206. OUT LPDWORD NetworkCount,
  207. OUT PNM_NETWORK * NetworkList[]
  208. );
  209. DWORD
  210. NmEnumNetworkInterfaces(
  211. IN PNM_NETWORK Network,
  212. OUT LPDWORD InterfaceCount,
  213. OUT PNM_INTERFACE * InterfaceList[]
  214. );
  215. DWORD
  216. WINAPI
  217. NmNetworkControl(
  218. IN PNM_NETWORK Network,
  219. IN PNM_NODE HostNode OPTIONAL,
  220. IN DWORD ControlCode,
  221. IN PUCHAR InBuffer,
  222. IN DWORD InBufferSize,
  223. OUT PUCHAR OutBuffer,
  224. IN DWORD OutBufferSize,
  225. OUT LPDWORD BytesReturned,
  226. OUT LPDWORD Required
  227. );
  228. //
  229. // Interface Object Management Routines
  230. //
  231. CLUSTER_NETINTERFACE_STATE
  232. NmGetInterfaceState(
  233. IN PNM_INTERFACE Interface
  234. );
  235. DWORD
  236. NmGetInterfaceForNodeAndNetwork(
  237. IN LPCWSTR NodeName,
  238. IN LPCWSTR NetworkName,
  239. OUT LPWSTR * InterfaceName
  240. );
  241. DWORD
  242. WINAPI
  243. NmInterfaceControl(
  244. IN PNM_INTERFACE Interface,
  245. IN PNM_NODE HostNode OPTIONAL,
  246. IN DWORD ControlCode,
  247. IN PUCHAR InBuffer,
  248. IN DWORD InBufferSize,
  249. OUT PUCHAR OutBuffer,
  250. IN DWORD OutBufferSize,
  251. OUT LPDWORD BytesReturned,
  252. OUT LPDWORD Required
  253. );
  254. DWORD NmPerformFixups(
  255. IN DWORD dwFixupType
  256. );
  257. DWORD
  258. NmFixupNotifyCb(VOID);
  259. //
  260. // PnP Routines
  261. //
  262. VOID
  263. NmPostPnpEvent(
  264. IN CLUSNET_EVENT_TYPE EventType,
  265. IN DWORD Context1,
  266. IN DWORD Context2
  267. );
  268. //
  269. // Connectoid related routines
  270. //
  271. VOID
  272. NmCloseConnectoidAdviseSink(
  273. VOID
  274. );
  275. DWORD
  276. NmGetNodeHighestVersion(
  277. IN PNM_NODE Node
  278. );
  279. DWORD
  280. NmSetExtendedNodeState(
  281. IN CLUSTER_NODE_STATE State
  282. );
  283. CLUSTER_NODE_STATE
  284. NmGetExtendedNodeState(
  285. IN PNM_NODE Node
  286. );
  287. //
  288. // Intracluster RPC Monitoring and cancellation routines
  289. //
  290. VOID NmStartRpc(
  291. IN DWORD NodeId
  292. );
  293. VOID NmEndRpc(
  294. IN DWORD NodeId
  295. );
  296. // RPC ext error info dumping routine
  297. VOID NmDumpRpcExtErrorInfo(
  298. RPC_STATUS status
  299. );
  300. DWORD
  301. NmSetServiceAccountPassword(
  302. IN LPCWSTR DomainName,
  303. IN LPCWSTR AccountName,
  304. IN LPWSTR NewPassword,
  305. IN DWORD dwFlags,
  306. OUT PCLUSTER_SET_PASSWORD_STATUS ReturnStatusBuffer,
  307. IN DWORD ReturnStatusBufferSize,
  308. OUT DWORD *SizeReturned,
  309. OUT DWORD *ExpectedBufferSize
  310. );
  311. // Encryption/Decription helpers
  312. // Used by dm file pipes to encrypt/decrypt
  313. // transmission of cryptocheckpoints
  314. typedef struct _NM_CRYTOR {
  315. BYTE* PayloadBuffer;
  316. DWORD PayloadSize;
  317. BYTE* EncryptedBuffer;
  318. DWORD EncryptedSize;
  319. ULONG_PTR CryptProv;
  320. ULONG_PTR CryptKey;
  321. BOOL KeyGenerated;
  322. BOOL EncryptionDisabled;
  323. } NM_CRYPTOR, *PNM_CRYPTOR;
  324. DWORD
  325. NmCryptor_Decrypt(
  326. PNM_CRYPTOR Encryptor,
  327. PVOID Buffer,
  328. DWORD BufferSize);
  329. VOID
  330. NmCryptor_PrepareEncryptionBuffer(
  331. PNM_CRYPTOR Encryptor,
  332. PVOID Buffer,
  333. DWORD BufferSize);
  334. DWORD
  335. NmCryptor_Encrypt(
  336. PNM_CRYPTOR Encryptor,
  337. DWORD DataSize);
  338. VOID
  339. NmCryptor_Init(
  340. PNM_CRYPTOR Cryptor,
  341. BOOL EnableEncryption);
  342. VOID
  343. NmCryptor_Destroy(
  344. PNM_CRYPTOR Encryptor);
  345. // Clussvc to Clusnet Heartbeating.
  346. DWORD
  347. NmInitializeClussvcClusnetHb(
  348. VOID
  349. );
  350. #endif // _NM_INCLUDED