saAmf.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. /*
  2. * Copyright (c) 2002-2003 MontaVista Software, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Author: Steven Dake (sdake@mvista.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. typedef SaUint32T SaAmfPmErrorsT;
  42. typedef enum {
  43. SA_AMF_PM_PROC = 1,
  44. SA_AMF_PM_PROC_AND_DESCENDENTS = 2,
  45. SA_AMF_PM_ALL_PROCESSES =3
  46. } SaAmfPmStopQualifierT;
  47. typedef enum {
  48. SA_AMF_HEALTHCHECK_AMF_INVOKED = 1,
  49. SA_AMF_HEALTHCHECK_COMPONENT_INVOKED =2
  50. } SaAmfHealthcheckInvocationT;
  51. #define SA_AMF_HEALTHCHECK_KEY_MAX 32
  52. typedef struct {
  53. SaUint8T key[SA_AMF_HEALTHCHECK_KEY_MAX];
  54. SaUint16T keyLen;
  55. } SaAmfHealthcheckKeyT;
  56. typedef enum {
  57. SA_AMF_HA_ACTIVE = 1,
  58. SA_AMF_HA_STANDBY = 2,
  59. SA_AMF_HA_QUIESCED = 3,
  60. SA_AMF_HA_QUIESCING = 4
  61. } SaAmfHAStateT;
  62. typedef enum {
  63. SA_AMF_READINESS_OUT_OF_SERVICE = 1,
  64. SA_AMF_READINESS_IN_SERVICE = 2,
  65. SA_AMF_READINESS_STOPPING = 3
  66. } SaAmfReadinessStateT;
  67. typedef enum {
  68. SA_AMF_PRESENCE_UNINSTANTIATED = 1,
  69. SA_AMF_PRESENCE_INSTANTIATING = 2,
  70. SA_AMF_PRESENCE_INSTANTIATED = 3,
  71. SA_AMF_PRESENCE_TERMINATING = 4,
  72. SA_AMF_PRESENCE_RESTARTING = 5,
  73. SA_AMF_PRESENCE_INSTANTIATION_FAILED = 6,
  74. SA_AMF_PRESENCE_TERMINATION_FAILED = 7
  75. } SaAmfPresenceStateT;
  76. typedef enum {
  77. SA_AMF_OPERATIONAL_ENABLED = 1,
  78. SA_AMF_OPERATIONAL_DISABLED = 2
  79. } SaAmfOperationalStateT;
  80. typedef enum {
  81. SA_AMF_ADMIN_UNLOCKED = 1,
  82. SA_AMF_ADMIN_LOCKED = 2,
  83. SA_AMF_ADMIN_LOCKED_INSTANTIATION = 3,
  84. SA_AMF_ADMIN_SHUTTING_DOWN = 4
  85. } SaAmfAdminStateT;
  86. typedef enum {
  87. SA_AMF_ASSIGNMENT_UNASSIGNED = 1,
  88. SA_AMF_ASSIGNMENT_FULLY_ASSIGNED = 2,
  89. SA_AMF_ASSIGNMENT_PARTIALLY_ASSIGNED = 3
  90. } SaAmfAssignmentStateT;
  91. typedef enum {
  92. SA_AMF_PROXY_STATUS_UNPROXIED = 1,
  93. SA_AMF_PROXY_STATUS_PROXIED = 2
  94. } SaAmfProxyStatusT;
  95. typedef enum {
  96. SA_AMF_READINESS_STATE = 1,
  97. SA_AMF_HA_STATE = 2,
  98. SA_AMF_PRESENCE_STATE = 3,
  99. SA_AMF_OP_STATE = 4,
  100. SA_AMF_ADMIN_STATE = 5,
  101. SA_AMF_ASSIGNMENT_STATE = 6,
  102. SA_AMF_PROXY_STATUS = 7
  103. } SaAmfStateT;
  104. #define SA_AMF_CSI_ADD_ONE 0x1
  105. #define SA_AMF_CSI_TARGET_ONE 0x2
  106. #define SA_AMF_CSI_TARGET_ALL 0x4
  107. typedef SaUint32T SaAmfCSIFlagsT;
  108. typedef enum {
  109. SA_AMF_CSI_NEW_ASSIGN = 1,
  110. SA_AMF_CSI_QUIESCED = 2,
  111. SA_AMF_CSI_NOT_QUIESCED = 3,
  112. SA_AMF_CSI_STILL_ACTIVE = 4,
  113. } SaAmfCSITransitionDescriptorT;
  114. typedef struct {
  115. SaAmfCSITransitionDescriptorT transitionDescriptor;
  116. SaNameT activeCompName;
  117. } SaAmfCSIActiveDescriptorT;
  118. typedef struct {
  119. SaNameT activeCompName;
  120. SaUint32T standbyRank;
  121. } SaAmfCSIStandbyDescriptorT;
  122. typedef union {
  123. SaAmfCSIActiveDescriptorT activeDescriptor;
  124. SaAmfCSIStandbyDescriptorT standbyDescriptor;
  125. } SaAmfCSIStateDescriptorT;
  126. typedef struct {
  127. SaUint8T *attrName;
  128. SaUint8T *attrValue;
  129. } SaAmfCSIAttributeT;
  130. typedef struct {
  131. SaAmfCSIAttributeT *attr;
  132. SaUint32T number;
  133. } SaAmfCSIAttributeListT;
  134. typedef struct {
  135. SaAmfCSIFlagsT csiFlags;
  136. SaNameT csiName;
  137. SaAmfCSIStateDescriptorT csiStateDescriptor;
  138. SaAmfCSIAttributeListT csiAttr;
  139. } SaAmfCSIDescriptorT;
  140. typedef struct {
  141. SaNameT compName;
  142. SaAmfHAStateT haState;
  143. SaUint32T rank;
  144. } SaAmfProtectionGroupMemberT;
  145. typedef enum {
  146. SA_AMF_PROTECTION_GROUP_NO_CHANGE = 1,
  147. SA_AMF_PROTECTION_GROUP_ADDED = 2,
  148. SA_AMF_PROTECTION_GROUP_REMOVED = 3,
  149. SA_AMF_PROTECTION_GROUP_STATE_CHANGE = 4
  150. } SaAmfProtectionGroupChangesT;
  151. typedef struct {
  152. SaAmfProtectionGroupMemberT member;
  153. SaAmfProtectionGroupChangesT change;
  154. } SaAmfProtectionGroupNotificationT;
  155. typedef struct {
  156. SaUint32T numberOfItems;
  157. SaAmfProtectionGroupNotificationT *notificaton;
  158. } SaAmfProtectionGruopNotificationBufferT;
  159. typedef enum {
  160. SA_AMF_NO_RECOMMENDATION = 1,
  161. SA_AMF_COMPONENT_RESTART = 2,
  162. SA_AMF_COMPONENT_FAILOVER = 3,
  163. SA_AMF_NODE_SWITCHOVER = 4,
  164. SA_AMF_NODE_FAILOVER = 5,
  165. SA_AMF_NODE_FAILFAST = 6,
  166. SA_AMF_CLUSTER_RESET = 7,
  167. SA_AMF_APPLICATION_RESTART = 8
  168. } SaAmfRecommendedRecoveryT;
  169. #define SA_AMF_COMP_SA_AWARE 0x0001
  170. #define SA_AMF_COMP_PROXY 0x0002
  171. #define SA_AMF_COMP_PROXIED 0x0004
  172. #define SA_AMF_COMP_LOCAL 0x0008
  173. typedef SaUint32T saAmfCompCategoryT;
  174. typedef enum {
  175. SA_AMF_2N_REDUNDANCY_MODEL = 1,
  176. SA_AMF_NPM_REDUNDANCY_MODEL = 2,
  177. SA_AMF_N_WAY_REDUNDANCY_MODEL = 3,
  178. SA_AMF_N_WAY_ACTIVE_REDUNDACY_MODEL = 4,
  179. SA_AMF_NO_REDUNDANCY_MODEL= 5
  180. } saAmfRedundancyModelT;
  181. typedef enum {
  182. SA_AMF_COMP_X_ACTIVE_AND_Y_STANDBY = 1,
  183. SA_AMF_COMP_X_ACTIVE_OR_Y_STANDBY = 2,
  184. SA_AMF_COMP_ONE_ACTIVE_OR_Y_STANDBY = 3,
  185. SA_AMF_COMP_ONE_ACTIVE_OR_ONE_STANDBY = 4,
  186. SA_AMF_COMP_X_ACTIVE = 5,
  187. SA_AMF_COMP_1_ACTIVE = 6,
  188. SA_AMF_COMP_NON_PRE_INSTANTIABLE = 7
  189. } saAmfCompCapabilityModelT;
  190. typedef enum {
  191. SA_AMF_NODE_NAME = 1,
  192. SA_AMF_SI_NAME = 2
  193. } SaAmfAdditionalInfoIdT;
  194. typedef void (*SaAmfHealthcheckCallbackT) (
  195. SaInvocationT invocation,
  196. const SaNameT *compName,
  197. SaAmfHealthcheckKeyT *healthcheckKey);
  198. typedef void (*SaAmfComponentTerminateCallbackT) (
  199. SaInvocationT invocation,
  200. const SaNameT *compName);
  201. typedef void (*SaAmfCSISetCallbackT) (
  202. SaInvocationT invocation,
  203. const SaNameT *compName,
  204. SaAmfHAStateT haState,
  205. SaAmfCSIDescriptorT *csiDescriptor);
  206. typedef void (*SaAmfCSIRemoveCallbackT) (
  207. SaInvocationT invocation,
  208. const SaNameT *compName,
  209. const SaNameT *csiName,
  210. SaAmfCSIFlagsT csiFlags);
  211. typedef void (*SaAmfExternalComponentInstantiateCallbackT) (
  212. SaInvocationT invocation,
  213. const SaNameT *proxiedCompName);
  214. typedef void (*SaAmfExternalComponentCleanupCallbackT) (
  215. SaInvocationT invocation,
  216. const SaNameT *proxiedCompName);
  217. typedef void (*SaAmfProtectionGroupTrackCallbackT) (
  218. const SaNameT *csiName,
  219. SaAmfProtectionGroupNotificationT *notificationBuffer,
  220. SaUint32T numberOfMembers,
  221. SaAisErrorT error);
  222. typedef struct {
  223. SaAmfHealthcheckCallbackT
  224. saAmfHealthcheckCallback;
  225. SaAmfComponentTerminateCallbackT
  226. saAmfComponentTerminateCallback;
  227. SaAmfCSISetCallbackT
  228. saAmfCSISetCallback;
  229. SaAmfCSIRemoveCallbackT
  230. saAmfCSIRemoveCallback;
  231. SaAmfProtectionGroupTrackCallbackT
  232. saAmfProtectionGroupTrackCallback;
  233. SaAmfExternalComponentInstantiateCallbackT
  234. saAmfProxiedComponentInstantiateCallback;
  235. SaAmfExternalComponentCleanupCallbackT
  236. saAmfProxiedComponentCleanupCallback;
  237. } SaAmfCallbacksT;
  238. /*
  239. * Interfaces
  240. */
  241. #ifdef __cplusplus
  242. extern "C" {
  243. #endif
  244. SaAisErrorT
  245. saAmfInitialize (
  246. SaAmfHandleT *amfHandle,
  247. const SaAmfCallbacksT *amfCallbacks,
  248. SaVersionT *version);
  249. SaAisErrorT
  250. saAmfSelectionObjectGet (
  251. SaAmfHandleT amfHandle,
  252. SaSelectionObjectT *selectionObject);
  253. SaAisErrorT
  254. saAmfDispatch (
  255. SaAmfHandleT amfHandle,
  256. SaDispatchFlagsT dispatchFlags);
  257. SaAisErrorT
  258. saAmfFinalize (
  259. SaAmfHandleT amfHandle);
  260. SaAisErrorT
  261. saAmfComponentRegister (
  262. SaAmfHandleT amfHandle,
  263. const SaNameT *compName,
  264. const SaNameT *proxyCompName);
  265. SaAisErrorT
  266. saAmfComponentUnregister (
  267. SaAmfHandleT amfHandle,
  268. const SaNameT *compName,
  269. const SaNameT *proxyCompName);
  270. SaAisErrorT
  271. saAmfComponentNameGet (
  272. SaAmfHandleT amfHandle,
  273. SaNameT *compName);
  274. SaAisErrorT
  275. saAmfPmStart (
  276. SaAmfHandleT amfHandle,
  277. const SaNameT *compName,
  278. SaUint64T processId,
  279. SaInt32T descendentsTreeDepth,
  280. SaAmfPmErrorsT pmErrors,
  281. SaAmfRecommendedRecoveryT recommendedRecovery);
  282. SaAisErrorT
  283. saAmfPmStop (
  284. SaAmfHandleT amfHandle,
  285. const SaNameT *compName,
  286. SaAmfPmStopQualifierT stopQualifier,
  287. SaInt64T processId,
  288. SaAmfPmErrorsT pmErrors);
  289. SaAisErrorT
  290. saAmfHealthcheckStart (
  291. SaAmfHandleT amfHandle,
  292. const SaNameT *compName,
  293. const SaAmfHealthcheckKeyT *healthcheckKey,
  294. SaAmfHealthcheckInvocationT invocationType,
  295. SaAmfRecommendedRecoveryT recommendedRecovery);
  296. SaAisErrorT
  297. saAmfHealthcheckConfirm (
  298. SaAmfHandleT amfHandle,
  299. const SaNameT *compName,
  300. const SaAmfHealthcheckKeyT *healthcheckKey,
  301. SaAisErrorT healthcheckResult);
  302. SaAisErrorT
  303. saAmfHealthcheckStop (
  304. SaAmfHandleT amfHandle,
  305. const SaNameT *compName,
  306. const SaAmfHealthcheckKeyT *healthcheckKey);
  307. SaAisErrorT
  308. saAmfHAStateGet (
  309. SaAmfHandleT amfHandle,
  310. const SaNameT *compName,
  311. const SaNameT *csiName,
  312. SaAmfHAStateT *haState);
  313. SaAisErrorT
  314. saAmfCSIQuiescingComplete(
  315. SaAmfHandleT amfHandle,
  316. SaInvocationT invocation,
  317. SaAisErrorT error);
  318. SaAisErrorT
  319. saAmfProtectionGroupTrack (
  320. SaAmfHandleT amfHandle,
  321. const SaNameT *csiName,
  322. SaUint8T trackFlags,
  323. const SaAmfProtectionGroupNotificationT *notificationBuffer);
  324. SaAisErrorT
  325. saAmfProtectionGroupTrackStop (
  326. SaAmfHandleT amfHandle,
  327. const SaNameT *csiName);
  328. SaAisErrorT
  329. saAmfComponentErrorReport (
  330. SaAmfHandleT amfHandle,
  331. const SaNameT *erroneousComponent,
  332. SaTimeT errorDetectionTime,
  333. SaAmfRecommendedRecoveryT recommendedRecovery,
  334. SaNtfIdentifierT ntfIdentifier);
  335. SaAisErrorT
  336. saAmfComponentErrorClear (
  337. SaAmfHandleT amfHandle,
  338. const SaNameT *compName,
  339. SaNtfIdentifierT ntfIdentifier);
  340. SaAisErrorT
  341. saAmfResponse (
  342. SaAmfHandleT amfHandle,
  343. SaInvocationT invocation,
  344. SaAisErrorT error);
  345. #ifdef __cplusplus
  346. }
  347. #endif
  348. #endif /* AIS_AMF_H_DEFINED */