parse.h 5.3 KB

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