parse.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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_RETRANSMITS_BEFORE_LOSS,
  62. TOTEM_TOKEN,
  63. TOTEM_RETRANSMIT_TOKEN,
  64. TOTEM_HOLD_TOKEN,
  65. TOTEM_JOIN,
  66. TOTEM_CONSENSUS,
  67. TOTEM_MERGE,
  68. TOTEM_DOWNCHECK,
  69. TOTEM_FAIL_RECV_CONST,
  70. MAX_TOTEM_TIMEOUTS /* Last item */
  71. } totem_timeout_types;
  72. struct openais_config {
  73. /*
  74. * network
  75. */
  76. struct totem_interface *interfaces;
  77. int interface_count;
  78. struct sockaddr_in mcast_addr;
  79. /*
  80. * logging
  81. */
  82. int logmode;
  83. char *logfile;
  84. /*
  85. * key
  86. */
  87. unsigned char *key;
  88. int keylen;
  89. /*
  90. * Timeout
  91. */
  92. unsigned int timeouts[MAX_TOTEM_TIMEOUTS];
  93. /*
  94. * Event service
  95. */
  96. unsigned int evt_delivery_queue_size;
  97. unsigned int evt_delivery_queue_resume;
  98. };
  99. struct saAmfUnit {
  100. SaNameT name;
  101. struct list_head saAmfComponentHead;
  102. struct list_head saAmfUnitList;
  103. enum amfOperationalAdministrativeState operationalAdministrativeState;
  104. struct saAmfGroup *saAmfGroup;
  105. };
  106. struct saAmfProtectionGroup {
  107. SaNameT name;
  108. struct list_head saAmfMembersHead;
  109. struct list_head saAmfProtectionGroupList;
  110. };
  111. struct saAmfGroup {
  112. SaNameT name;
  113. SaAmfGroupCapabilityModelT model;
  114. SaUint32T saAmfActiveUnitsDesired;
  115. SaUint32T saAmfStandbyUnitsDesired;
  116. struct list_head saAmfGroupList;
  117. struct list_head saAmfProtectionGroupHead;
  118. struct list_head saAmfUnitHead;
  119. };
  120. /*
  121. * State machines for states in AMF
  122. */
  123. enum amfOperationalState {
  124. AMF_OPER_DISABLED,
  125. AMF_OPER_ENABLED
  126. };
  127. enum amfAdministrativeState {
  128. AMF_ADMIN_UNLOCKED,
  129. AMF_ADMIN_LOCKED,
  130. AMF_ADMIN_STOPPING
  131. };
  132. enum amfEnabledUnlockedState {
  133. AMF_ENABLED_UNLOCKED_INITIAL = 0,
  134. AMF_ENABLED_UNLOCKED_IN_SERVICE_REQUESTED,
  135. AMF_ENABLED_UNLOCKED_IN_SERVICE_COMPLETED,
  136. AMF_ENABLED_UNLOCKED_ACTIVE_REQUESTED,
  137. AMF_ENABLED_UNLOCKED_ACTIVE_COMPLETED,
  138. AMF_ENABLED_UNLOCKED_STANDBY_REQUESTED,
  139. AMF_ENABLED_UNLOCKED_STANDBY_COMPLETED
  140. };
  141. enum amfDisabledUnlockedState {
  142. AMF_DISABLED_UNLOCKED_REGISTEREDORERRORCANCEL = 0,
  143. AMF_DISABLED_UNLOCKED_FAILED,
  144. AMF_DISABLED_UNLOCKED_QUIESCED_REQUESTED,
  145. AMF_DISABLED_UNLOCKED_QUIESCED_COMPLETED,
  146. AMF_DISABLED_UNLOCKED_OUT_OF_SERVICE_REQUESTED,
  147. AMF_DISABLED_UNLOCKED_OUT_OF_SERVICE_COMPLETED
  148. };
  149. enum amfDisabledLockedState {
  150. AMF_DISABLED_LOCKED_INITIAL = 0,
  151. AMF_DISABLED_LOCKED_QUIESCED_REQUESTED,
  152. AMF_DISABLED_LOCKED_QUIESCED_COMPLETED,
  153. AMF_DISABLED_LOCKED_OUT_OF_SERVICE_REQUESTED,
  154. AMF_DISABLED_LOCKED_OUT_OF_SERVICE_COMPLETED
  155. };
  156. enum amfEnabledStoppingState {
  157. AMF_ENABLED_STOPPING_INITIAL = 0,
  158. AMF_ENABLED_STOPPING_STOPPING_REQUESTED,
  159. AMF_ENABLED_STOPPING_STOPPING_COMPLETED
  160. };
  161. struct saAmfComponent {
  162. int registered;
  163. int local;
  164. struct conn_info *conn_info;
  165. struct in_addr source_addr;
  166. SaNameT name;
  167. SaAmfReadinessStateT currentReadinessState;
  168. SaAmfReadinessStateT newReadinessState;
  169. SaAmfHAStateT currentHAState;
  170. SaAmfHAStateT newHAState;
  171. enum amfEnabledUnlockedState enabledUnlockedState;
  172. enum amfDisabledUnlockedState disabledUnlockedState;
  173. SaAmfComponentCapabilityModelT componentCapabilityModel;
  174. SaAmfProbableCauseT probableCause;
  175. int healthcheckInterval;
  176. poll_timer_handle timer_healthcheck;
  177. int healthcheck_outstanding;
  178. struct saAmfComponent *saAmfProxyComponent;
  179. struct list_head saAmfComponentList;
  180. struct list_head saAmfProtectionGroupList;
  181. struct saAmfUnit *saAmfUnit;
  182. struct saAmfProtectionGroup *saAmfProtectionGroup;
  183. };
  184. extern struct list_head saAmfGroupHead;
  185. extern struct saAmfComponent *findComponent (SaNameT *name);
  186. extern int openais_amf_config_read (char **error_string);
  187. extern int openais_main_config_read (char **error_string,
  188. struct openais_config *openais_config,
  189. int interface_max);
  190. #endif /* PARSE_H_DEFINED */