saAmf.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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_HELATHCHECK_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. #define SA_AMF_CSI_ADD_ONE 0x1
  63. #define SA_AMF_CSI_TARGET_ONE 0x2
  64. #define SA_AMF_CSI_TARGET_ALL 0x4
  65. typedef SaUint32T SaAmfCSIFlagsT;
  66. typedef enum {
  67. SA_AMF_CSI_NEW_ASSIGN = 1,
  68. SA_AMF_CSI_QUIESCED = 2,
  69. SA_AMF_CSI_NOT_QUIESCED = 3,
  70. SA_AMF_CSI_STILL_ACTIVE = 4,
  71. } SaAmfCSITransitionDescriptorT;
  72. typedef struct {
  73. SaAmfCSITransitionDescriptorT transitionDescriptor;
  74. SaNameT activeCompName;
  75. } SaAmfCSIActiveDescriptorT;
  76. typedef struct {
  77. SaNameT activeCompName;
  78. SaUint32T standbyRank;
  79. } SaAmfCSIStandbyDescriptorT;
  80. typedef union {
  81. SaAmfCSIActiveDescriptorT activeDescriptor;
  82. SaAmfCSIStandbyDescriptorT standbyDescriptor;
  83. } SaAmfCSIStateDescriptorT;
  84. typedef struct {
  85. SaUint8T *attrName;
  86. SaUint8T *attrValue;
  87. } SaAmfCSIAttributeT;
  88. typedef struct {
  89. SaAmfCSIAttributeT *attr;
  90. SaUint32T number;
  91. } SaAmfCSIAttributeListT;
  92. typedef struct {
  93. SaAmfCSIFlagsT csiFlags;
  94. SaNameT csiName;
  95. SaAmfCSIStateDescriptorT csiStateDescriptor;
  96. SaAmfCSIAttributeListT csiAttr;
  97. } SaAmfCSIDescriptorT;
  98. typedef struct {
  99. SaNameT compName;
  100. SaAmfHAStateT haState;
  101. SaUint32T rank;
  102. } SaAmfProtectionGroupMemberT;
  103. typedef enum {
  104. SA_AMF_PROTECTION_GROUP_NO_CHANGE = 1,
  105. SA_AMF_PROTECTION_GROUP_ADDED = 2,
  106. SA_AMF_PROTECTION_GROUP_REMOVED = 3,
  107. SA_AMF_PROTECTION_GROUP_STATE_CHANGE = 4
  108. } SaAmfProtectionGroupChangesT;
  109. typedef struct {
  110. SaAmfProtectionGroupMemberT member;
  111. SaAmfProtectionGroupChangesT change;
  112. } SaAmfProtectionGroupNotificationT;
  113. typedef struct {
  114. SaUint32T numberOfItems;
  115. SaAmfProtectionGroupNotificationT *notificaton;
  116. } SaAmfProtectionGruopNotificationBufferT;
  117. typedef enum {
  118. SA_AMF_NO_RECOMMENDATION = 1,
  119. SA_AMF_COMPONENT_RESTART = 2,
  120. SA_AMF_COMPONENT_FAILOVER = 3,
  121. SA_AMF_NODE_SWITCHOVER = 4,
  122. SA_AMF_NODE_FAILOVER = 5,
  123. SA_AMF_NODE_FAILFAST = 6,
  124. SA_AMF_CLUSTER_RESET = 7
  125. } SaAmfRecommendedRecoveryT;
  126. typedef void (*SaAmfHealthcheckCallbackT) (
  127. SaInvocationT invocation,
  128. const SaNameT *compName,
  129. SaAmfHealthcheckKeyT *healthcheckKey);
  130. typedef void (*SaAmfComponentTerminateCallbackT) (
  131. SaInvocationT invocation,
  132. const SaNameT *compName);
  133. typedef void (*SaAmfCSISetCallbackT) (
  134. SaInvocationT invocation,
  135. const SaNameT *compName,
  136. SaAmfHAStateT haState,
  137. SaAmfCSIDescriptorT *csiDescriptor);
  138. typedef void (*SaAmfCSIRemoveCallbackT) (
  139. SaInvocationT invocation,
  140. const SaNameT *compName,
  141. const SaNameT *csiName,
  142. SaAmfCSIFlagsT csiFlags);
  143. typedef void (*SaAmfExternalComponentInstantiateCallbackT) (
  144. SaInvocationT invocation,
  145. const SaNameT *proxiedCompName);
  146. typedef void (*SaAmfExternalComponentCleanupCallbackT) (
  147. SaInvocationT invocation,
  148. const SaNameT *proxiedCompName);
  149. typedef void (*SaAmfProtectionGroupTrackCallbackT) (
  150. const SaNameT *csiName,
  151. SaAmfProtectionGroupNotificationT *notificationBuffer,
  152. SaUint32T numberOfMembers,
  153. SaAisErrorT error);
  154. typedef struct {
  155. SaAmfHealthcheckCallbackT
  156. saAmfHealthcheckCallback;
  157. SaAmfComponentTerminateCallbackT
  158. saAmfComponentTerminateCallback;
  159. SaAmfCSISetCallbackT
  160. saAmfCSISetCallback;
  161. SaAmfCSIRemoveCallbackT
  162. saAmfCSIRemoveCallback;
  163. SaAmfProtectionGroupTrackCallbackT
  164. saAmfProtectionGroupTrackCallback;
  165. SaAmfExternalComponentInstantiateCallbackT
  166. saAmfExternalComponentInstantiateCallback;
  167. SaAmfExternalComponentCleanupCallbackT
  168. saAmfExternalComponentCleanupCallback;
  169. } SaAmfCallbacksT;
  170. /*
  171. * Interfaces
  172. */
  173. #ifdef __cplusplus
  174. extern "C" {
  175. #endif
  176. SaAisErrorT
  177. saAmfInitialize (
  178. SaAmfHandleT *amfHandle,
  179. const SaAmfCallbacksT *amfCallbacks,
  180. SaVersionT *version);
  181. SaAisErrorT
  182. saAmfSelectionObjectGet (
  183. SaAmfHandleT amfHandle,
  184. SaSelectionObjectT *selectionObject);
  185. SaAisErrorT
  186. saAmfDispatch (
  187. SaAmfHandleT amfHandle,
  188. SaDispatchFlagsT dispatchFlags);
  189. SaAisErrorT
  190. saAmfFinalize (
  191. SaAmfHandleT amfHandle);
  192. SaAisErrorT
  193. saAmfComponentRegister (
  194. SaAmfHandleT amfHandle,
  195. const SaNameT *compName,
  196. const SaNameT *proxyCompName);
  197. SaAisErrorT
  198. saAmfComponentUnregister (
  199. SaAmfHandleT amfHandle,
  200. const SaNameT *compName,
  201. const SaNameT *proxyCompName);
  202. SaAisErrorT
  203. saAmfComponentNameGet (
  204. SaAmfHandleT amfHandle,
  205. SaNameT *compName);
  206. SaAisErrorT
  207. saAmfPmStart (
  208. SaAmfHandleT amfHandle,
  209. const SaNameT *compName,
  210. SaUint64T processId,
  211. SaInt32T descendentsTreeDepth,
  212. SaAmfPmErrorsT pmErrors,
  213. SaAmfRecommendedRecoveryT recommendedRecovery);
  214. SaAisErrorT
  215. saAmfPmStop (
  216. SaAmfHandleT amfHandle,
  217. const SaNameT *compName,
  218. SaAmfPmStopQualifierT stopQualifier,
  219. SaInt64T processId,
  220. SaAmfPmErrorsT pmErrors);
  221. SaAisErrorT
  222. saAmfHealthcheckStart (
  223. SaAmfHandleT amfHandle,
  224. const SaNameT *compName,
  225. const SaAmfHealthcheckKeyT *healthcheckKey,
  226. SaAmfHealthcheckInvocationT invocationType,
  227. SaAmfRecommendedRecoveryT recommendedRecovery);
  228. SaAisErrorT
  229. saAmfHealthcheckConfirm (
  230. SaAmfHandleT amfHandle,
  231. const SaNameT *compName,
  232. const SaAmfHealthcheckKeyT *healthcheckKey,
  233. SaAisErrorT healthcheckResult);
  234. SaAisErrorT
  235. saAmfHealthcheckStop (
  236. SaAmfHandleT amfHandle,
  237. const SaNameT *compName,
  238. const SaAmfHealthcheckKeyT *healthcheckKey);
  239. SaAisErrorT
  240. saAmfHAStateGet (
  241. SaAmfHandleT amfHandle,
  242. const SaNameT *compName,
  243. const SaNameT *csiName,
  244. SaAmfHAStateT *haState);
  245. SaAisErrorT
  246. saAmfCSIQuiescingComplete(
  247. SaAmfHandleT amfHandle,
  248. SaInvocationT invocation,
  249. SaAisErrorT error);
  250. SaAisErrorT
  251. saAmfProtectionGroupTrackStart (
  252. SaAmfHandleT amfHandle,
  253. const SaNameT *csiName,
  254. SaUint8T trackFlags,
  255. const SaAmfProtectionGroupNotificationT *notificationBuffer);
  256. SaAisErrorT
  257. saAmfProtectionGroupTrackStop (
  258. SaAmfHandleT amfHandle,
  259. const SaNameT *csiName);
  260. SaAisErrorT
  261. saAmfComponentErrorReport (
  262. SaAmfHandleT amfHandle,
  263. const SaNameT *erroneousComponent,
  264. SaTimeT errorDetectionTime,
  265. SaAmfRecommendedRecoveryT recommendedRecovery,
  266. SaNtfIdentifierT ntfIdentifier);
  267. SaAisErrorT
  268. saAmfComponentErrorClear (
  269. SaAmfHandleT amfHandle,
  270. const SaNameT *compName,
  271. SaNtfIdentifierT ntfIdentifier);
  272. SaAisErrorT
  273. saAmfResponse (
  274. SaAmfHandleT amfHandle,
  275. SaInvocationT invocation,
  276. SaAisErrorT error);
  277. #ifdef __cplusplus
  278. }
  279. #endif
  280. #endif /* AIS_AMF_H_DEFINED */