saAmf.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. /*
  2. * Copyright (c) 2002-2003 MontaVista Software, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Author: Steven Dake (sdake@redhat.com)
  7. *
  8. * This software licensed under BSD license, the text of which follows:
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions are met:
  12. *
  13. * - Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * - Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  26. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  27. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  28. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  29. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  30. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  31. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  32. * THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #ifndef AIS_AMF_H_DEFINED
  35. #define AIS_AMF_H_DEFINED
  36. #include "saAis.h"
  37. typedef SaUint64T SaAmfHandleT;
  38. #define SA_AMF_PM_ZERO_EXIT 0x1
  39. #define SA_AMF_PM_NON_ZERO_EXIT 0x2
  40. #define SA_AMF_PM_ABNORMAL_END 0x4
  41. #define SA_AMF_PM_ALL_ERRORS (SA_AMF_PM_ZERO_EXIT | SA_AMF_PM_NON_ZERO_EXIT | SA_AMF_PM_ABNORMAL_END)
  42. typedef SaUint32T SaAmfPmErrorsT;
  43. typedef enum {
  44. SA_AMF_PM_PROC = 1,
  45. SA_AMF_PM_PROC_AND_DESCENDENTS = 2,
  46. SA_AMF_PM_ALL_PROCESSES =3
  47. } SaAmfPmStopQualifierT;
  48. typedef enum {
  49. SA_AMF_HEALTHCHECK_AMF_INVOKED = 1,
  50. SA_AMF_HEALTHCHECK_COMPONENT_INVOKED =2
  51. } SaAmfHealthcheckInvocationT;
  52. #define SA_AMF_HEALTHCHECK_KEY_MAX 32
  53. typedef struct {
  54. SaUint8T key[SA_AMF_HEALTHCHECK_KEY_MAX];
  55. SaUint16T keyLen;
  56. } SaAmfHealthcheckKeyT;
  57. typedef enum {
  58. SA_AMF_HA_ACTIVE = 1,
  59. SA_AMF_HA_STANDBY = 2,
  60. SA_AMF_HA_QUIESCED = 3,
  61. SA_AMF_HA_QUIESCING = 4
  62. } SaAmfHAStateT;
  63. typedef enum {
  64. SA_AMF_READINESS_OUT_OF_SERVICE = 1,
  65. SA_AMF_READINESS_IN_SERVICE = 2,
  66. SA_AMF_READINESS_STOPPING = 3
  67. } SaAmfReadinessStateT;
  68. typedef enum {
  69. SA_AMF_PRESENCE_UNINSTANTIATED = 1,
  70. SA_AMF_PRESENCE_INSTANTIATING = 2,
  71. SA_AMF_PRESENCE_INSTANTIATED = 3,
  72. SA_AMF_PRESENCE_TERMINATING = 4,
  73. SA_AMF_PRESENCE_RESTARTING = 5,
  74. SA_AMF_PRESENCE_INSTANTIATION_FAILED = 6,
  75. SA_AMF_PRESENCE_TERMINATION_FAILED = 7
  76. } SaAmfPresenceStateT;
  77. typedef enum {
  78. SA_AMF_OPERATIONAL_ENABLED = 1,
  79. SA_AMF_OPERATIONAL_DISABLED = 2
  80. } SaAmfOperationalStateT;
  81. typedef enum {
  82. SA_AMF_ADMIN_UNLOCKED = 1,
  83. SA_AMF_ADMIN_LOCKED = 2,
  84. SA_AMF_ADMIN_LOCKED_INSTANTIATION = 3,
  85. SA_AMF_ADMIN_SHUTTING_DOWN = 4
  86. } SaAmfAdminStateT;
  87. typedef enum {
  88. SA_AMF_ASSIGNMENT_UNASSIGNED = 1,
  89. SA_AMF_ASSIGNMENT_FULLY_ASSIGNED = 2,
  90. SA_AMF_ASSIGNMENT_PARTIALLY_ASSIGNED = 3
  91. } SaAmfAssignmentStateT;
  92. typedef enum {
  93. SA_AMF_PROXY_STATUS_UNPROXIED = 1,
  94. SA_AMF_PROXY_STATUS_PROXIED = 2
  95. } SaAmfProxyStatusT;
  96. typedef enum {
  97. SA_AMF_READINESS_STATE = 1,
  98. SA_AMF_HA_STATE = 2,
  99. SA_AMF_PRESENCE_STATE = 3,
  100. SA_AMF_OP_STATE = 4,
  101. SA_AMF_ADMIN_STATE = 5,
  102. SA_AMF_ASSIGNMENT_STATE = 6,
  103. SA_AMF_PROXY_STATUS = 7
  104. } SaAmfStateT;
  105. #define SA_AMF_CSI_ADD_ONE 0x1
  106. #define SA_AMF_CSI_TARGET_ONE 0x2
  107. #define SA_AMF_CSI_TARGET_ALL 0x4
  108. typedef SaUint32T SaAmfCSIFlagsT;
  109. typedef enum {
  110. SA_AMF_CSI_NEW_ASSIGN = 1,
  111. SA_AMF_CSI_QUIESCED = 2,
  112. SA_AMF_CSI_NOT_QUIESCED = 3,
  113. SA_AMF_CSI_STILL_ACTIVE = 4,
  114. } SaAmfCSITransitionDescriptorT;
  115. typedef struct {
  116. SaAmfCSITransitionDescriptorT transitionDescriptor;
  117. SaNameT activeCompName;
  118. } SaAmfCSIActiveDescriptorT;
  119. typedef struct {
  120. SaNameT activeCompName;
  121. SaUint32T standbyRank;
  122. } SaAmfCSIStandbyDescriptorT;
  123. typedef union {
  124. SaAmfCSIActiveDescriptorT activeDescriptor;
  125. SaAmfCSIStandbyDescriptorT standbyDescriptor;
  126. } SaAmfCSIStateDescriptorT;
  127. typedef struct {
  128. SaUint8T *attrName;
  129. SaUint8T *attrValue;
  130. } SaAmfCSIAttributeT;
  131. typedef struct {
  132. SaAmfCSIAttributeT *attr;
  133. SaUint32T number;
  134. } SaAmfCSIAttributeListT;
  135. typedef struct {
  136. SaAmfCSIFlagsT csiFlags;
  137. SaNameT csiName;
  138. SaAmfCSIStateDescriptorT csiStateDescriptor;
  139. SaAmfCSIAttributeListT csiAttr;
  140. } SaAmfCSIDescriptorT;
  141. typedef struct {
  142. SaNameT compName;
  143. SaAmfHAStateT haState;
  144. SaUint32T rank;
  145. } SaAmfProtectionGroupMemberT;
  146. typedef enum {
  147. SA_AMF_PROTECTION_GROUP_NO_CHANGE = 1,
  148. SA_AMF_PROTECTION_GROUP_ADDED = 2,
  149. SA_AMF_PROTECTION_GROUP_REMOVED = 3,
  150. SA_AMF_PROTECTION_GROUP_STATE_CHANGE = 4
  151. } SaAmfProtectionGroupChangesT;
  152. typedef struct {
  153. SaAmfProtectionGroupMemberT member;
  154. SaAmfProtectionGroupChangesT change;
  155. } SaAmfProtectionGroupNotificationT;
  156. typedef struct {
  157. SaUint32T numberOfItems;
  158. SaAmfProtectionGroupNotificationT *notification;
  159. } SaAmfProtectionGroupNotificationBufferT;
  160. typedef enum {
  161. SA_AMF_NO_RECOMMENDATION = 1,
  162. SA_AMF_COMPONENT_RESTART = 2,
  163. SA_AMF_COMPONENT_FAILOVER = 3,
  164. SA_AMF_NODE_SWITCHOVER = 4,
  165. SA_AMF_NODE_FAILOVER = 5,
  166. SA_AMF_NODE_FAILFAST = 6,
  167. SA_AMF_CLUSTER_RESET = 7,
  168. SA_AMF_APPLICATION_RESTART = 8
  169. } SaAmfRecommendedRecoveryT;
  170. #define SA_AMF_COMP_SA_AWARE 0x0001
  171. #define SA_AMF_COMP_PROXY 0x0002
  172. #define SA_AMF_COMP_PROXIED 0x0004
  173. #define SA_AMF_COMP_LOCAL 0x0008
  174. typedef SaUint32T saAmfCompCategoryT;
  175. typedef enum {
  176. SA_AMF_2N_REDUNDANCY_MODEL = 1,
  177. SA_AMF_NPM_REDUNDANCY_MODEL = 2,
  178. SA_AMF_N_WAY_REDUNDANCY_MODEL = 3,
  179. SA_AMF_N_WAY_ACTIVE_REDUNDACY_MODEL = 4,
  180. SA_AMF_NO_REDUNDANCY_MODEL= 5
  181. } saAmfRedundancyModelT;
  182. typedef enum {
  183. SA_AMF_COMP_X_ACTIVE_AND_Y_STANDBY = 1,
  184. SA_AMF_COMP_X_ACTIVE_OR_Y_STANDBY = 2,
  185. SA_AMF_COMP_ONE_ACTIVE_OR_Y_STANDBY = 3,
  186. SA_AMF_COMP_ONE_ACTIVE_OR_ONE_STANDBY = 4,
  187. SA_AMF_COMP_X_ACTIVE = 5,
  188. SA_AMF_COMP_1_ACTIVE = 6,
  189. SA_AMF_COMP_NON_PRE_INSTANTIABLE = 7
  190. } saAmfCompCapabilityModelT;
  191. typedef enum {
  192. SA_AMF_NODE_NAME = 1,
  193. SA_AMF_SI_NAME = 2
  194. } SaAmfAdditionalInfoIdT;
  195. typedef void (*SaAmfHealthcheckCallbackT) (
  196. SaInvocationT invocation,
  197. const SaNameT *compName,
  198. SaAmfHealthcheckKeyT *healthcheckKey);
  199. typedef void (*SaAmfComponentTerminateCallbackT) (
  200. SaInvocationT invocation,
  201. const SaNameT *compName);
  202. typedef void (*SaAmfCSISetCallbackT) (
  203. SaInvocationT invocation,
  204. const SaNameT *compName,
  205. SaAmfHAStateT haState,
  206. SaAmfCSIDescriptorT *csiDescriptor);
  207. typedef void (*SaAmfCSIRemoveCallbackT) (
  208. SaInvocationT invocation,
  209. const SaNameT *compName,
  210. const SaNameT *csiName,
  211. SaAmfCSIFlagsT csiFlags);
  212. typedef void (*SaAmfExternalComponentInstantiateCallbackT) (
  213. SaInvocationT invocation,
  214. const SaNameT *proxiedCompName);
  215. typedef void (*SaAmfExternalComponentCleanupCallbackT) (
  216. SaInvocationT invocation,
  217. const SaNameT *proxiedCompName);
  218. typedef void (*SaAmfProtectionGroupTrackCallbackT) (
  219. const SaNameT *csiName,
  220. SaAmfProtectionGroupNotificationBufferT *notificationBuffer,
  221. SaUint32T numberOfMembers,
  222. SaAisErrorT error);
  223. typedef struct {
  224. SaAmfHealthcheckCallbackT
  225. saAmfHealthcheckCallback;
  226. SaAmfComponentTerminateCallbackT
  227. saAmfComponentTerminateCallback;
  228. SaAmfCSISetCallbackT
  229. saAmfCSISetCallback;
  230. SaAmfCSIRemoveCallbackT
  231. saAmfCSIRemoveCallback;
  232. SaAmfProtectionGroupTrackCallbackT
  233. saAmfProtectionGroupTrackCallback;
  234. SaAmfExternalComponentInstantiateCallbackT
  235. saAmfExternalComponentInstantiateCallback;
  236. SaAmfExternalComponentCleanupCallbackT
  237. saAmfExternalComponentCleanupCallback;
  238. } SaAmfCallbacksT;
  239. /*
  240. * Interfaces
  241. */
  242. #ifdef __cplusplus
  243. extern "C" {
  244. #endif
  245. SaAisErrorT
  246. saAmfInitialize (
  247. SaAmfHandleT *amfHandle,
  248. const SaAmfCallbacksT *amfCallbacks,
  249. SaVersionT *version);
  250. SaAisErrorT
  251. saAmfSelectionObjectGet (
  252. SaAmfHandleT amfHandle,
  253. SaSelectionObjectT *selectionObject);
  254. SaAisErrorT
  255. saAmfDispatch (
  256. SaAmfHandleT amfHandle,
  257. SaDispatchFlagsT dispatchFlags);
  258. SaAisErrorT
  259. saAmfFinalize (
  260. SaAmfHandleT amfHandle);
  261. SaAisErrorT
  262. saAmfComponentRegister (
  263. SaAmfHandleT amfHandle,
  264. const SaNameT *compName,
  265. const SaNameT *proxyCompName);
  266. SaAisErrorT
  267. saAmfComponentUnregister (
  268. SaAmfHandleT amfHandle,
  269. const SaNameT *compName,
  270. const SaNameT *proxyCompName);
  271. SaAisErrorT
  272. saAmfComponentNameGet (
  273. SaAmfHandleT amfHandle,
  274. SaNameT *compName);
  275. SaAisErrorT
  276. saAmfPmStart (
  277. SaAmfHandleT amfHandle,
  278. const SaNameT *compName,
  279. SaUint64T processId,
  280. SaInt32T descendentsTreeDepth,
  281. SaAmfPmErrorsT pmErrors,
  282. SaAmfRecommendedRecoveryT recommendedRecovery);
  283. SaAisErrorT
  284. saAmfPmStop (
  285. SaAmfHandleT amfHandle,
  286. const SaNameT *compName,
  287. SaAmfPmStopQualifierT stopQualifier,
  288. SaInt64T processId,
  289. SaAmfPmErrorsT pmErrors);
  290. SaAisErrorT
  291. saAmfHealthcheckStart (
  292. SaAmfHandleT amfHandle,
  293. const SaNameT *compName,
  294. const SaAmfHealthcheckKeyT *healthcheckKey,
  295. SaAmfHealthcheckInvocationT invocationType,
  296. SaAmfRecommendedRecoveryT recommendedRecovery);
  297. SaAisErrorT
  298. saAmfHealthcheckConfirm (
  299. SaAmfHandleT amfHandle,
  300. const SaNameT *compName,
  301. const SaAmfHealthcheckKeyT *healthcheckKey,
  302. SaAisErrorT healthcheckResult);
  303. SaAisErrorT
  304. saAmfHealthcheckStop (
  305. SaAmfHandleT amfHandle,
  306. const SaNameT *compName,
  307. const SaAmfHealthcheckKeyT *healthcheckKey);
  308. SaAisErrorT
  309. saAmfHAStateGet (
  310. SaAmfHandleT amfHandle,
  311. const SaNameT *compName,
  312. const SaNameT *csiName,
  313. SaAmfHAStateT *haState);
  314. SaAisErrorT
  315. saAmfCSIQuiescingComplete(
  316. SaAmfHandleT amfHandle,
  317. SaInvocationT invocation,
  318. SaAisErrorT error);
  319. SaAisErrorT
  320. saAmfProtectionGroupTrack (
  321. SaAmfHandleT amfHandle,
  322. const SaNameT *csiName,
  323. SaUint8T trackFlags,
  324. SaAmfProtectionGroupNotificationBufferT *notificationBuffer);
  325. SaAisErrorT
  326. saAmfProtectionGroupTrackStop (
  327. SaAmfHandleT amfHandle,
  328. const SaNameT *csiName);
  329. SaAisErrorT
  330. saAmfComponentErrorReport (
  331. SaAmfHandleT amfHandle,
  332. const SaNameT *erroneousComponent,
  333. SaTimeT errorDetectionTime,
  334. SaAmfRecommendedRecoveryT recommendedRecovery,
  335. SaNtfIdentifierT ntfIdentifier);
  336. SaAisErrorT
  337. saAmfComponentErrorClear (
  338. SaAmfHandleT amfHandle,
  339. const SaNameT *compName,
  340. SaNtfIdentifierT ntfIdentifier);
  341. SaAisErrorT
  342. saAmfResponse (
  343. SaAmfHandleT amfHandle,
  344. SaInvocationT invocation,
  345. SaAisErrorT error);
  346. #ifdef __cplusplus
  347. }
  348. #endif
  349. #endif /* AIS_AMF_H_DEFINED */