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.

408 lines
7.8 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. FmUpdateMaxAuto = 0x10000,
  66. FmUpdateFailureCount,
  67. FmUpdateGroupOwner,
  68. FmUpdateCreateGroup,
  69. FmUpdateCreateResource,
  70. FmUpdateJoin,
  71. FmUpdateAddPossibleNode,
  72. FmUpdateRemovePossibleNode,
  73. FmUpdateCreateResourceType,
  74. FmUpdateDeleteResourceType,
  75. FmUpdateChangeGroup,
  76. FmUpdateMaximum
  77. } FM_GUM_MESSAGE_TYPES;
  78. DWORD
  79. EpUpdateClusWidePostEvent(
  80. IN BOOL SourceNode,
  81. IN PCLUSTER_EVENT pEvent,
  82. IN LPDWORD pdwFlags,
  83. IN PVOID Context1,
  84. IN PVOID Context2
  85. );
  86. //
  87. // Define public interfaces
  88. //
  89. //
  90. // Initialization and shutdown
  91. //
  92. DWORD
  93. WINAPI
  94. GumInitialize(
  95. VOID
  96. );
  97. DWORD
  98. WINAPI
  99. GumOnline(
  100. VOID
  101. );
  102. VOID
  103. WINAPI
  104. GumShutdown(
  105. VOID
  106. );
  107. DWORD
  108. GumCreateRpcBindings(
  109. PNM_NODE Node
  110. );
  111. //
  112. // Routines to send updates
  113. //
  114. DWORD
  115. WINAPI
  116. GumSendUpdate(
  117. IN GUM_UPDATE_TYPE UpdateType,
  118. IN DWORD Context,
  119. IN DWORD BufferLength,
  120. IN PVOID Buffer
  121. );
  122. DWORD
  123. WINAPI
  124. GumPostUpdate(
  125. IN GUM_UPDATE_TYPE UpdateType,
  126. IN DWORD Context,
  127. IN DWORD BufferLength,
  128. IN PVOID Buffer
  129. );
  130. DWORD
  131. GumPostUpdateEx(
  132. IN GUM_UPDATE_TYPE UpdateType,
  133. IN DWORD DispatchIndex,
  134. IN DWORD ArgCount,
  135. ...
  136. );
  137. DWORD
  138. GumSendUpdateEx(
  139. IN GUM_UPDATE_TYPE UpdateType,
  140. IN DWORD DispatchIndex,
  141. IN DWORD ArgCount,
  142. ...
  143. );
  144. DWORD
  145. WINAPI
  146. GumAttemptUpdate(
  147. IN DWORD Sequence,
  148. IN GUM_UPDATE_TYPE UpdateType,
  149. IN DWORD Context,
  150. IN DWORD BufferLength,
  151. IN PVOID Buffer
  152. );
  153. DWORD
  154. WINAPI
  155. GumGetCurrentSequence(
  156. IN GUM_UPDATE_TYPE UpdateType
  157. );
  158. VOID
  159. WINAPI
  160. GumSetCurrentSequence(
  161. IN GUM_UPDATE_TYPE UpdateType,
  162. DWORD Sequence
  163. );
  164. PVOID GumMarshallArgs(
  165. OUT LPDWORD lpdwBufLength,
  166. IN DWORD dwArgCount,
  167. ...);
  168. // logging routine
  169. typedef
  170. DWORD
  171. (WINAPI *PGUM_LOG_ROUTINE) (
  172. IN DWORD dwGumDispatch,
  173. IN DWORD dwSequence,
  174. IN DWORD dwType,
  175. IN PVOID pVoid,
  176. IN DWORD dwDataSize
  177. );
  178. //
  179. // Routines to receive updates
  180. //
  181. typedef
  182. DWORD
  183. (WINAPI *PGUM_UPDATE_ROUTINE) (
  184. IN DWORD Context,
  185. IN BOOL SourceNode,
  186. IN DWORD BufferLength,
  187. IN PVOID Buffer
  188. );
  189. #define GUM_MAX_DISPATCH_ARGS 5
  190. typedef
  191. DWORD
  192. (WINAPI *PGUM_DISPATCH_ROUTINE1) (
  193. IN BOOL SourceNode,
  194. IN PVOID Arg1
  195. );
  196. typedef
  197. DWORD
  198. (WINAPI *PGUM_DISPATCH_ROUTINE2) (
  199. IN BOOL SourceNode,
  200. IN PVOID Arg1,
  201. IN PVOID Arg2
  202. );
  203. typedef
  204. DWORD
  205. (WINAPI *PGUM_DISPATCH_ROUTINE3) (
  206. IN BOOL SourceNode,
  207. IN PVOID Arg1,
  208. IN PVOID Arg2,
  209. IN PVOID Arg3
  210. );
  211. typedef
  212. DWORD
  213. (WINAPI *PGUM_DISPATCH_ROUTINE4) (
  214. IN BOOL SourceNode,
  215. IN PVOID Arg1,
  216. IN PVOID Arg2,
  217. IN PVOID Arg3,
  218. IN PVOID Arg4
  219. );
  220. typedef
  221. DWORD
  222. (WINAPI *PGUM_DISPATCH_ROUTINE5) (
  223. IN BOOL SourceNode,
  224. IN PVOID Arg1,
  225. IN PVOID Arg2,
  226. IN PVOID Arg3,
  227. IN PVOID Arg4,
  228. IN PVOID Arg5
  229. );
  230. typedef struct _GUM_DISPATCH_ENTRY {
  231. DWORD ArgCount;
  232. union {
  233. PGUM_DISPATCH_ROUTINE1 Dispatch1;
  234. PGUM_DISPATCH_ROUTINE2 Dispatch2;
  235. PGUM_DISPATCH_ROUTINE3 Dispatch3;
  236. PGUM_DISPATCH_ROUTINE4 Dispatch4;
  237. PGUM_DISPATCH_ROUTINE5 Dispatch5;
  238. };
  239. } GUM_DISPATCH_ENTRY, *PGUM_DISPATCH_ENTRY;
  240. typedef struct _GUM_VOTE_DECISION_CONTEXT{
  241. GUM_UPDATE_TYPE UpdateType;
  242. DWORD dwContext;
  243. DWORD dwInputBufLength; //input data to make judgement upon
  244. PVOID pInputBuf; //size of the input data
  245. DWORD dwVoteLength;
  246. PVOID pContext;
  247. }GUM_VOTE_DECISION_CONTEXT, *PGUM_VOTE_DECISION_CONTEXT;
  248. //
  249. // Routines to collect and dispatch vote
  250. //
  251. typedef
  252. DWORD
  253. (WINAPI *PGUM_VOTE_DECISION_CB) (
  254. IN PGUM_VOTE_DECISION_CONTEXT pDecisionContext,
  255. IN DWORD dwVoteBufLength,
  256. IN PVOID pVoteBuf,
  257. IN DWORD dwNumVotes,
  258. IN BOOL bDidAllActiveNodesVote,
  259. OUT LPDWORD pdwOutputBufSize,
  260. OUT PVOID *pOutputBuf
  261. );
  262. // routine to vote for a gum update type
  263. typedef
  264. DWORD
  265. (WINAPI *PGUM_VOTE_ROUTINE) (
  266. IN DWORD dwContext,
  267. IN DWORD dwInputBufLength,
  268. IN PVOID pInputBuf,
  269. IN DWORD dwVoteLength,
  270. OUT PVOID pVoteBuf
  271. );
  272. #define GUM_VOTE_VALID 0x00000001
  273. #pragma warning( disable : 4200 ) // nonstandard extension used : zero-sized array in struct/union
  274. typedef struct _GUM_VOTE_ENTRY{
  275. DWORD dwFlags;
  276. DWORD dwNodeId;
  277. DWORD dwNumBytes;
  278. BYTE VoteBuf[];
  279. }GUM_VOTE_ENTRY, *PGUM_VOTE_ENTRY;
  280. #pragma warning( default : 4200 )
  281. #define GETVOTEFROMBUF(pVoteBuf, dwVoteLength, i, pdwNodeId) \
  282. (((((PGUM_VOTE_ENTRY)((PBYTE)pVoteBuf + ((sizeof(GUM_VOTE_ENTRY) + dwVoteLength) * ((i)-1))))->dwFlags) & GUM_VOTE_VALID) ? \
  283. (PVOID)((PBYTE)pVoteBuf + (sizeof(GUM_VOTE_ENTRY) * (i)) + (dwVoteLength * ((i)-1))) : (NULL)), \
  284. (*(pdwNodeId) = ((PGUM_VOTE_ENTRY)((PBYTE)pVoteBuf + ((sizeof(GUM_VOTE_ENTRY) + dwVoteLength) * ((i)-1))))->dwNodeId)
  285. DWORD
  286. GumSendUpdateOnVote(
  287. IN GUM_UPDATE_TYPE UpdateType,
  288. IN DWORD dwContext,
  289. IN DWORD dwInputBufLength,
  290. IN PVOID pInputBuffer,
  291. IN DWORD dwVoteLength,
  292. IN PGUM_VOTE_DECISION_CB pfnGumDecisionCb,
  293. IN PVOID pContext
  294. );
  295. VOID
  296. WINAPI
  297. GumReceiveUpdates(
  298. IN BOOL IsJoining,
  299. IN GUM_UPDATE_TYPE UpdateType,
  300. IN PGUM_UPDATE_ROUTINE UpdateRoutine,
  301. IN PGUM_LOG_ROUTINE LogRoutine,
  302. IN DWORD DispatchCount,
  303. IN OPTIONAL PGUM_DISPATCH_ENTRY DispatchTable,
  304. IN OPTIONAL PGUM_VOTE_ROUTINE VoteRoutine
  305. );
  306. VOID
  307. WINAPI
  308. GumIgnoreUpdates(
  309. IN GUM_UPDATE_TYPE UpdateType,
  310. IN PGUM_UPDATE_ROUTINE UpdateRoutine
  311. );
  312. // Interface for a component to request gum to request NM
  313. // shoot a node down to avoid consistency
  314. VOID
  315. GumCommFailure(
  316. IN GUM_UPDATE_TYPE GumUpdateType,
  317. IN DWORD NodeId,
  318. IN DWORD ErrorCode,
  319. IN BOOL Wait
  320. );
  321. //
  322. // Interfaces for special join updates
  323. //
  324. DWORD
  325. WINAPI
  326. GumBeginJoinUpdate(
  327. IN GUM_UPDATE_TYPE UpdateType,
  328. OUT DWORD *Sequence
  329. );
  330. DWORD
  331. WINAPI
  332. GumEndJoinUpdate(
  333. IN DWORD Sequence,
  334. IN GUM_UPDATE_TYPE UpdateType,
  335. IN DWORD Context,
  336. IN DWORD BufferLength,
  337. IN PVOID Buffer
  338. );
  339. #endif // _GUM_H
  340.