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.

479 lines
9.7 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. gum.h
  5. Abstract:
  6. Public data structures and procedure prototypes for the
  7. Global Update Manager (Gum) subcomponent of the NT Cluster Service
  8. Author:
  9. John Vert (jvert) 16-Apr-1996
  10. Revision History:
  11. --*/
  12. #ifndef _GUM_H
  13. #define _GUM_H
  14. //
  15. // Define public structures and types
  16. //
  17. #define PRE_GUM_DISPATCH 1
  18. #define POST_GUM_DISPATCH 2
  19. //marshalling macros
  20. #define GET_ARG(b, x) (PVOID)(*((PULONG)(b) + (x)) + (PUCHAR)(b))
  21. // if you add new modules to GUM, this number needs to get adjusted
  22. #define GUM_UPDATE_JOINSEQUENCE 2
  23. //
  24. // Predefined update types. Add new update types before
  25. // GumUpdateMaximum!
  26. //
  27. typedef enum _GUM_UPDATE_TYPE {
  28. GumUpdateFailoverManager,
  29. GumUpdateRegistry,
  30. GumUpdateMembership,
  31. GumUpdateTesting,
  32. GumUpdateMaximum
  33. } GUM_UPDATE_TYPE;
  34. //
  35. // John Vert (jvert) 4/3/1997
  36. // Update types used by FM. Temporarily here so the EP doesn't need its own
  37. // update type
  38. //
  39. //
  40. // Gum update message types.
  41. //
  42. // The first entries in this list are auto-marshalled through Gum...Ex.
  43. // Any updates that are not auto-marshalled must come after FmUpdateMaxAuto
  44. //
  45. typedef enum {
  46. FmUpdateChangeResourceName = 0,
  47. FmUpdateChangeGroupName,
  48. FmUpdateDeleteResource,
  49. FmUpdateDeleteGroup,
  50. FmUpdateAddDependency,
  51. FmUpdateRemoveDependency,
  52. FmUpdateChangeClusterName,
  53. FmUpdateChangeQuorumResource,
  54. FmUpdateResourceState,
  55. FmUpdateGroupState,
  56. EmUpdateClusWidePostEvent,
  57. FmUpdateGroupNode,
  58. FmUpdatePossibleNodeForResType,
  59. FmUpdateGroupIntendedOwner,
  60. FmUpdateAssignOwnerToGroups,
  61. FmUpdateApproveJoin,
  62. FmUpdateCompleteGroupMove,
  63. FmUpdateCheckAndSetGroupOwner,
  64. FmUpdateUseRandomizedNodeListForGroups,
  65. FmUpdateChangeQuorumResource2, //added for whistler
  66. FmUpdateMaxAuto = 0x10000,
  67. FmUpdateFailureCount,
  68. FmUpdateGroupOwner,
  69. FmUpdateCreateGroup,
  70. FmUpdateCreateResource,
  71. FmUpdateJoin,
  72. FmUpdateAddPossibleNode,
  73. FmUpdateRemovePossibleNode,
  74. FmUpdateCreateResourceType,
  75. FmUpdateDeleteResourceType,
  76. FmUpdateChangeGroup,
  77. FmUpdateMaximum
  78. } FM_GUM_MESSAGE_TYPES;
  79. DWORD
  80. EpUpdateClusWidePostEvent(
  81. IN BOOL SourceNode,
  82. IN PCLUSTER_EVENT pEvent,
  83. IN LPDWORD pdwFlags,
  84. IN PVOID Context1,
  85. IN PVOID Context2
  86. );
  87. //
  88. // Structure used to provide the value returned by an update handler
  89. // on a node.
  90. //
  91. typedef struct _GUM_NODE_UPDATE_HANDLER_STATUS {
  92. BOOLEAN UpdateAttempted;
  93. DWORD ReturnStatus;
  94. } GUM_NODE_UPDATE_HANDLER_STATUS, *PGUM_NODE_UPDATE_HANDLER_STATUS;
  95. //
  96. // Define public interfaces
  97. //
  98. //
  99. // Initialization and shutdown
  100. //
  101. DWORD
  102. WINAPI
  103. GumInitialize(
  104. VOID
  105. );
  106. DWORD
  107. WINAPI
  108. GumOnline(
  109. VOID
  110. );
  111. VOID
  112. WINAPI
  113. GumShutdown(
  114. VOID
  115. );
  116. DWORD
  117. GumCreateRpcBindings(
  118. PNM_NODE Node
  119. );
  120. //
  121. // Routines to send updates
  122. //
  123. DWORD
  124. WINAPI
  125. GumSendUpdate(
  126. IN GUM_UPDATE_TYPE UpdateType,
  127. IN DWORD Context,
  128. IN DWORD BufferLength,
  129. IN PVOID Buffer
  130. );
  131. DWORD
  132. WINAPI
  133. GumSendUpdateReturnInfo(
  134. IN GUM_UPDATE_TYPE UpdateType,
  135. IN DWORD Context,
  136. OUT PGUM_NODE_UPDATE_HANDLER_STATUS ReturnStatusArray,
  137. IN DWORD BufferLength,
  138. IN PVOID Buffer
  139. );
  140. DWORD
  141. WINAPI
  142. GumPostUpdate(
  143. IN GUM_UPDATE_TYPE UpdateType,
  144. IN DWORD Context,
  145. IN DWORD BufferLength,
  146. IN PVOID Buffer
  147. );
  148. DWORD
  149. GumPostUpdateEx(
  150. IN GUM_UPDATE_TYPE UpdateType,
  151. IN DWORD DispatchIndex,
  152. IN DWORD ArgCount,
  153. ...
  154. );
  155. DWORD
  156. GumSendUpdateEx(
  157. IN GUM_UPDATE_TYPE UpdateType,
  158. IN DWORD DispatchIndex,
  159. IN DWORD ArgCount,
  160. ...
  161. );
  162. DWORD
  163. GumSendUpdateExReturnInfo(
  164. IN GUM_UPDATE_TYPE UpdateType,
  165. IN DWORD DispatchIndex,
  166. OUT PGUM_NODE_UPDATE_HANDLER_STATUS ReturnStatusBuffer,
  167. IN DWORD ArgCount,
  168. ...
  169. );
  170. DWORD
  171. WINAPI
  172. GumAttemptUpdate(
  173. IN DWORD Sequence,
  174. IN GUM_UPDATE_TYPE UpdateType,
  175. IN DWORD Context,
  176. IN DWORD BufferLength,
  177. IN PVOID Buffer
  178. );
  179. DWORD
  180. WINAPI
  181. GumGetCurrentSequence(
  182. IN GUM_UPDATE_TYPE UpdateType
  183. );
  184. VOID
  185. WINAPI
  186. GumSetCurrentSequence(
  187. IN GUM_UPDATE_TYPE UpdateType,
  188. DWORD Sequence
  189. );
  190. PVOID GumMarshallArgs(
  191. OUT LPDWORD lpdwBufLength,
  192. IN DWORD dwArgCount,
  193. ...);
  194. // logging routine
  195. typedef
  196. DWORD
  197. (WINAPI *PGUM_LOG_ROUTINE) (
  198. IN DWORD dwGumDispatch,
  199. IN DWORD dwSequence,
  200. IN DWORD dwType,
  201. IN PVOID pVoid,
  202. IN DWORD dwDataSize
  203. );
  204. //
  205. // Routines to receive updates
  206. //
  207. typedef
  208. DWORD
  209. (WINAPI *PGUM_UPDATE_ROUTINE) (
  210. IN DWORD Context,
  211. IN BOOL SourceNode,
  212. IN DWORD BufferLength,
  213. IN PVOID Buffer
  214. );
  215. #define GUM_MAX_DISPATCH_ARGS 8
  216. typedef
  217. DWORD
  218. (WINAPI *PGUM_DISPATCH_ROUTINE1) (
  219. IN BOOL SourceNode,
  220. IN PVOID Arg1
  221. );
  222. typedef
  223. DWORD
  224. (WINAPI *PGUM_DISPATCH_ROUTINE2) (
  225. IN BOOL SourceNode,
  226. IN PVOID Arg1,
  227. IN PVOID Arg2
  228. );
  229. typedef
  230. DWORD
  231. (WINAPI *PGUM_DISPATCH_ROUTINE3) (
  232. IN BOOL SourceNode,
  233. IN PVOID Arg1,
  234. IN PVOID Arg2,
  235. IN PVOID Arg3
  236. );
  237. typedef
  238. DWORD
  239. (WINAPI *PGUM_DISPATCH_ROUTINE4) (
  240. IN BOOL SourceNode,
  241. IN PVOID Arg1,
  242. IN PVOID Arg2,
  243. IN PVOID Arg3,
  244. IN PVOID Arg4
  245. );
  246. typedef
  247. DWORD
  248. (WINAPI *PGUM_DISPATCH_ROUTINE5) (
  249. IN BOOL SourceNode,
  250. IN PVOID Arg1,
  251. IN PVOID Arg2,
  252. IN PVOID Arg3,
  253. IN PVOID Arg4,
  254. IN PVOID Arg5
  255. );
  256. typedef
  257. DWORD
  258. (WINAPI *PGUM_DISPATCH_ROUTINE6) (
  259. IN BOOL SourceNode,
  260. IN PVOID Arg1,
  261. IN PVOID Arg2,
  262. IN PVOID Arg3,
  263. IN PVOID Arg4,
  264. IN PVOID Arg5,
  265. IN PVOID Arg6
  266. );
  267. typedef
  268. DWORD
  269. (WINAPI *PGUM_DISPATCH_ROUTINE7) (
  270. IN BOOL SourceNode,
  271. IN PVOID Arg1,
  272. IN PVOID Arg2,
  273. IN PVOID Arg3,
  274. IN PVOID Arg4,
  275. IN PVOID Arg5,
  276. IN PVOID Arg6,
  277. IN PVOID Arg7
  278. );
  279. typedef
  280. DWORD
  281. (WINAPI *PGUM_DISPATCH_ROUTINE8) (
  282. IN BOOL SourceNode,
  283. IN PVOID Arg1,
  284. IN PVOID Arg2,
  285. IN PVOID Arg3,
  286. IN PVOID Arg4,
  287. IN PVOID Arg5,
  288. IN PVOID Arg6,
  289. IN PVOID Arg7,
  290. IN PVOID Arg8
  291. );
  292. typedef struct _GUM_DISPATCH_ENTRY {
  293. DWORD ArgCount;
  294. union {
  295. PGUM_DISPATCH_ROUTINE1 Dispatch1;
  296. PGUM_DISPATCH_ROUTINE2 Dispatch2;
  297. PGUM_DISPATCH_ROUTINE3 Dispatch3;
  298. PGUM_DISPATCH_ROUTINE4 Dispatch4;
  299. PGUM_DISPATCH_ROUTINE5 Dispatch5;
  300. PGUM_DISPATCH_ROUTINE6 Dispatch6;
  301. PGUM_DISPATCH_ROUTINE7 Dispatch7;
  302. PGUM_DISPATCH_ROUTINE8 Dispatch8;
  303. };
  304. } GUM_DISPATCH_ENTRY, *PGUM_DISPATCH_ENTRY;
  305. typedef struct _GUM_VOTE_DECISION_CONTEXT{
  306. GUM_UPDATE_TYPE UpdateType;
  307. DWORD dwContext;
  308. DWORD dwInputBufLength; //input data to make judgement upon
  309. PVOID pInputBuf; //size of the input data
  310. DWORD dwVoteLength;
  311. PVOID pContext;
  312. }GUM_VOTE_DECISION_CONTEXT, *PGUM_VOTE_DECISION_CONTEXT;
  313. //
  314. // Routines to collect and dispatch vote
  315. //
  316. typedef
  317. DWORD
  318. (WINAPI *PGUM_VOTE_DECISION_CB) (
  319. IN PGUM_VOTE_DECISION_CONTEXT pDecisionContext,
  320. IN DWORD dwVoteBufLength,
  321. IN PVOID pVoteBuf,
  322. IN DWORD dwNumVotes,
  323. IN BOOL bDidAllActiveNodesVote,
  324. OUT LPDWORD pdwOutputBufSize,
  325. OUT PVOID *pOutputBuf
  326. );
  327. // routine to vote for a gum update type
  328. typedef
  329. DWORD
  330. (WINAPI *PGUM_VOTE_ROUTINE) (
  331. IN DWORD dwContext,
  332. IN DWORD dwInputBufLength,
  333. IN PVOID pInputBuf,
  334. IN DWORD dwVoteLength,
  335. OUT PVOID pVoteBuf
  336. );
  337. #define GUM_VOTE_VALID 0x00000001
  338. #pragma warning( disable : 4200 ) // nonstandard extension used : zero-sized array in struct/union
  339. typedef struct _GUM_VOTE_ENTRY{
  340. DWORD dwFlags;
  341. DWORD dwNodeId;
  342. DWORD dwNumBytes;
  343. BYTE VoteBuf[];
  344. }GUM_VOTE_ENTRY, *PGUM_VOTE_ENTRY;
  345. #pragma warning( default : 4200 )
  346. #define GETVOTEFROMBUF(pVoteBuf, dwVoteLength, i, pdwNodeId) \
  347. (((((PGUM_VOTE_ENTRY)((PBYTE)pVoteBuf + ((sizeof(GUM_VOTE_ENTRY) + dwVoteLength) * ((i)-1))))->dwFlags) & GUM_VOTE_VALID) ? \
  348. (PVOID)((PBYTE)pVoteBuf + (sizeof(GUM_VOTE_ENTRY) * (i)) + (dwVoteLength * ((i)-1))) : (NULL)), \
  349. (*(pdwNodeId) = ((PGUM_VOTE_ENTRY)((PBYTE)pVoteBuf + ((sizeof(GUM_VOTE_ENTRY) + dwVoteLength) * ((i)-1))))->dwNodeId)
  350. DWORD
  351. GumSendUpdateOnVote(
  352. IN GUM_UPDATE_TYPE UpdateType,
  353. IN DWORD dwContext,
  354. IN DWORD dwInputBufLength,
  355. IN PVOID pInputBuffer,
  356. IN DWORD dwVoteLength,
  357. IN PGUM_VOTE_DECISION_CB pfnGumDecisionCb,
  358. IN PVOID pContext
  359. );
  360. VOID
  361. WINAPI
  362. GumReceiveUpdates(
  363. IN BOOL IsJoining,
  364. IN GUM_UPDATE_TYPE UpdateType,
  365. IN PGUM_UPDATE_ROUTINE UpdateRoutine,
  366. IN PGUM_LOG_ROUTINE LogRoutine,
  367. IN DWORD DispatchCount,
  368. IN OPTIONAL PGUM_DISPATCH_ENTRY DispatchTable,
  369. IN OPTIONAL PGUM_VOTE_ROUTINE VoteRoutine
  370. );
  371. VOID
  372. WINAPI
  373. GumIgnoreUpdates(
  374. IN GUM_UPDATE_TYPE UpdateType,
  375. IN PGUM_UPDATE_ROUTINE UpdateRoutine
  376. );
  377. // Interface for a component to request gum to request NM
  378. // shoot a node down to avoid consistency
  379. VOID
  380. GumCommFailure(
  381. IN GUM_UPDATE_TYPE GumUpdateType,
  382. IN DWORD NodeId,
  383. IN DWORD ErrorCode,
  384. IN BOOL Wait
  385. );
  386. //
  387. // Interfaces for special join updates
  388. //
  389. DWORD
  390. WINAPI
  391. GumBeginJoinUpdate(
  392. IN GUM_UPDATE_TYPE UpdateType,
  393. OUT DWORD *Sequence
  394. );
  395. DWORD
  396. WINAPI
  397. GumEndJoinUpdate(
  398. IN DWORD Sequence,
  399. IN GUM_UPDATE_TYPE UpdateType,
  400. IN DWORD Context,
  401. IN DWORD BufferLength,
  402. IN PVOID Buffer
  403. );
  404. #endif // _GUM_H