parse.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /*
  2. * Copyright (c) 2002-2004 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. #include <netinet/in.h>
  35. #include "../include/ais_types.h"
  36. #include "../include/list.h"
  37. #include "aispoll.h"
  38. #include "totempg.h"
  39. #ifndef PARSE_H_DEFINED
  40. #define PARSE_H_DEFINED
  41. typedef enum {
  42. GROUPCAPABILITYMODEL_2N,
  43. GROUPCAPABILITYMODEL_NPLUSM,
  44. GROUPCAPABILITYMODEL_NWAY,
  45. GROUPCAPABILITYMODEL_NWAYACTIVE,
  46. GROUPCAPABILITYMODEL_NOREDUNDANCY
  47. } SaAmfGroupCapabilityModelT;
  48. enum amfOperationalAdministrativeState {
  49. AMF_DISABLED_UNLOCKED = 0,
  50. AMF_DISABLED_LOCKED = 1,
  51. AMF_ENABLED_UNLOCKED = 2,
  52. AMF_ENABLED_STOPPING = 3
  53. };
  54. /*
  55. * Array location of various timeouts as
  56. * specified in openais.conf. The last enum
  57. * specifies the size of the timeouts array and
  58. * needs to remain the last item in the list.
  59. */
  60. enum {
  61. TOTEM_TOKEN,
  62. TOTEM_RETRANSMIT_TOKEN,
  63. TOTEM_JOIN,
  64. TOTEM_CONSENSUS,
  65. TOTEM_MERGE,
  66. TOTEM_DOWNCHECK,
  67. TOTEM_FAIL_RECV_CONST,
  68. MAX_TOTEM_TIMEOUTS /* Last item */
  69. } totem_timeout_types;
  70. struct openais_config {
  71. /*
  72. * network
  73. */
  74. struct totem_interface *interfaces;
  75. int interface_count;
  76. struct sockaddr_in mcast_addr;
  77. /*
  78. * logging
  79. */
  80. int logmode;
  81. char *logfile;
  82. /*
  83. * key
  84. */
  85. unsigned char *key;
  86. int keylen;
  87. /*
  88. * Timeout
  89. */
  90. unsigned int timeouts[MAX_TOTEM_TIMEOUTS];
  91. /*
  92. * Event service
  93. */
  94. unsigned int evt_delivery_queue_size;
  95. unsigned int evt_delivery_queue_resume;
  96. };
  97. struct saAmfUnit {
  98. SaNameT name;
  99. struct list_head saAmfComponentHead;
  100. struct list_head saAmfUnitList;
  101. enum amfOperationalAdministrativeState operationalAdministrativeState;
  102. struct saAmfGroup *saAmfGroup;
  103. };
  104. struct saAmfProtectionGroup {
  105. SaNameT name;
  106. struct list_head saAmfMembersHead;
  107. struct list_head saAmfProtectionGroupList;
  108. };
  109. struct saAmfGroup {
  110. SaNameT name;
  111. SaAmfGroupCapabilityModelT model;
  112. SaUint32T saAmfActiveUnitsDesired;
  113. SaUint32T saAmfStandbyUnitsDesired;
  114. struct list_head saAmfGroupList;
  115. struct list_head saAmfProtectionGroupHead;
  116. struct list_head saAmfUnitHead;
  117. };
  118. /*
  119. * State machines for states in AMF
  120. */
  121. enum amfOperationalState {
  122. AMF_OPER_DISABLED,
  123. AMF_OPER_ENABLED
  124. };
  125. enum amfAdministrativeState {
  126. AMF_ADMIN_UNLOCKED,
  127. AMF_ADMIN_LOCKED,
  128. AMF_ADMIN_STOPPING
  129. };
  130. enum amfEnabledUnlockedState {
  131. AMF_ENABLED_UNLOCKED_INITIAL = 0,
  132. AMF_ENABLED_UNLOCKED_IN_SERVICE_REQUESTED,
  133. AMF_ENABLED_UNLOCKED_IN_SERVICE_COMPLETED,
  134. AMF_ENABLED_UNLOCKED_ACTIVE_REQUESTED,
  135. AMF_ENABLED_UNLOCKED_ACTIVE_COMPLETED,
  136. AMF_ENABLED_UNLOCKED_STANDBY_REQUESTED,
  137. AMF_ENABLED_UNLOCKED_STANDBY_COMPLETED
  138. };
  139. enum amfDisabledUnlockedState {
  140. AMF_DISABLED_UNLOCKED_REGISTEREDORERRORCANCEL = 0,
  141. AMF_DISABLED_UNLOCKED_FAILED,
  142. AMF_DISABLED_UNLOCKED_QUIESCED_REQUESTED,
  143. AMF_DISABLED_UNLOCKED_QUIESCED_COMPLETED,
  144. AMF_DISABLED_UNLOCKED_OUT_OF_SERVICE_REQUESTED,
  145. AMF_DISABLED_UNLOCKED_OUT_OF_SERVICE_COMPLETED
  146. };
  147. enum amfDisabledLockedState {
  148. AMF_DISABLED_LOCKED_INITIAL = 0,
  149. AMF_DISABLED_LOCKED_QUIESCED_REQUESTED,
  150. AMF_DISABLED_LOCKED_QUIESCED_COMPLETED,
  151. AMF_DISABLED_LOCKED_OUT_OF_SERVICE_REQUESTED,
  152. AMF_DISABLED_LOCKED_OUT_OF_SERVICE_COMPLETED
  153. };
  154. enum amfEnabledStoppingState {
  155. AMF_ENABLED_STOPPING_INITIAL = 0,
  156. AMF_ENABLED_STOPPING_STOPPING_REQUESTED,
  157. AMF_ENABLED_STOPPING_STOPPING_COMPLETED
  158. };
  159. struct saAmfComponent {
  160. int registered;
  161. int local;
  162. struct conn_info *conn_info;
  163. struct in_addr source_addr;
  164. SaNameT name;
  165. SaAmfReadinessStateT currentReadinessState;
  166. SaAmfReadinessStateT newReadinessState;
  167. SaAmfHAStateT currentHAState;
  168. SaAmfHAStateT newHAState;
  169. enum amfEnabledUnlockedState enabledUnlockedState;
  170. enum amfDisabledUnlockedState disabledUnlockedState;
  171. SaAmfComponentCapabilityModelT componentCapabilityModel;
  172. SaAmfProbableCauseT probableCause;
  173. int healthcheckInterval;
  174. poll_timer_handle timer_healthcheck;
  175. int healthcheck_outstanding;
  176. struct saAmfComponent *saAmfProxyComponent;
  177. struct list_head saAmfComponentList;
  178. struct list_head saAmfProtectionGroupList;
  179. struct saAmfUnit *saAmfUnit;
  180. struct saAmfProtectionGroup *saAmfProtectionGroup;
  181. };
  182. extern struct list_head saAmfGroupHead;
  183. extern struct saAmfComponent *findComponent (SaNameT *name);
  184. extern int openais_amf_config_read (char **error_string);
  185. extern int openais_main_config_read (char **error_string,
  186. struct openais_config *openais_config,
  187. int interface_max);
  188. #endif /* PARSE_H_DEFINED */