parse.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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 <sys/select.h>
  35. #include <netinet/in.h>
  36. #include "../include/ais_types.h"
  37. #include "../include/list.h"
  38. #include "poll.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 saAmfUnit {
  55. SaNameT name;
  56. struct list_head saAmfComponentHead;
  57. struct list_head saAmfUnitList;
  58. enum amfOperationalAdministrativeState operationalAdministrativeState;
  59. struct saAmfGroup *saAmfGroup;
  60. };
  61. struct saAmfProtectionGroup {
  62. SaNameT name;
  63. struct list_head saAmfMembersHead;
  64. struct list_head saAmfProtectionGroupList;
  65. };
  66. struct saAmfGroup {
  67. SaNameT name;
  68. SaAmfGroupCapabilityModelT model;
  69. SaUint32T saAmfActiveUnitsDesired;
  70. SaUint32T saAmfStandbyUnitsDesired;
  71. struct list_head saAmfGroupList;
  72. struct list_head saAmfProtectionGroupHead;
  73. struct list_head saAmfUnitHead;
  74. };
  75. /*
  76. * State machines for states in AMF
  77. */
  78. enum amfOperationalState {
  79. AMF_OPER_DISABLED,
  80. AMF_OPER_ENABLED
  81. };
  82. enum amfAdministrativeState {
  83. AMF_ADMIN_UNLOCKED,
  84. AMF_ADMIN_LOCKED,
  85. AMF_ADMIN_STOPPING
  86. };
  87. enum amfEnabledUnlockedState {
  88. AMF_ENABLED_UNLOCKED_INITIAL = 0,
  89. AMF_ENABLED_UNLOCKED_IN_SERVICE_REQUESTED,
  90. AMF_ENABLED_UNLOCKED_IN_SERVICE_COMPLETED,
  91. AMF_ENABLED_UNLOCKED_ACTIVE_REQUESTED,
  92. AMF_ENABLED_UNLOCKED_ACTIVE_COMPLETED,
  93. AMF_ENABLED_UNLOCKED_STANDBY_REQUESTED,
  94. AMF_ENABLED_UNLOCKED_STANDBY_COMPLETED,
  95. };
  96. enum amfDisabledUnlockedState {
  97. AMF_DISABLED_UNLOCKED_REGISTEREDORERRORCANCEL = 0,
  98. AMF_DISABLED_UNLOCKED_FAILED,
  99. AMF_DISABLED_UNLOCKED_QUIESCED_REQUESTED,
  100. AMF_DISABLED_UNLOCKED_QUIESCED_COMPLETED,
  101. AMF_DISABLED_UNLOCKED_OUT_OF_SERVICE_REQUESTED,
  102. AMF_DISABLED_UNLOCKED_OUT_OF_SERVICE_COMPLETED
  103. };
  104. enum amfDisabledLockedState {
  105. AMF_DISABLED_LOCKED_INITIAL = 0,
  106. AMF_DISABLED_LOCKED_QUIESCED_REQUESTED,
  107. AMF_DISABLED_LOCKED_QUIESCED_COMPLETED,
  108. AMF_DISABLED_LOCKED_OUT_OF_SERVICE_REQUESTED,
  109. AMF_DISABLED_LOCKED_OUT_OF_SERVICE_COMPLETED
  110. };
  111. enum amfEnabledStoppingState {
  112. AMF_ENABLED_STOPPING_INITIAL = 0,
  113. AMF_ENABLED_STOPPING_STOPPING_REQUESTED,
  114. AMF_ENABLED_STOPPING_STOPPING_COMPLETED,
  115. };
  116. struct saAmfComponent {
  117. int registered;
  118. int local;
  119. int fd;
  120. SaNameT name;
  121. SaAmfReadinessStateT currentReadinessState;
  122. SaAmfReadinessStateT newReadinessState;
  123. SaAmfHAStateT currentHAState;
  124. SaAmfHAStateT newHAState;
  125. enum amfEnabledUnlockedState enabledUnlockedState;
  126. enum amfDisabledUnlockedState disabledUnlockedState;
  127. SaAmfComponentCapabilityModelT componentCapabilityModel;
  128. SaAmfProbableCauseT probableCause;
  129. int healthcheckInterval;
  130. poll_timer_handle timer_healthcheck;
  131. int healthcheck_outstanding;
  132. struct saAmfComponent *saAmfProxyComponent;
  133. struct list_head saAmfComponentList;
  134. struct list_head saAmfProtectionGroupList;
  135. struct saAmfUnit *saAmfUnit;
  136. struct saAmfProtectionGroup *saAmfProtectionGroup;
  137. };
  138. extern struct list_head saAmfGroupHead;
  139. extern struct saAmfComponent *findComponent (SaNameT *name);
  140. extern int SaNameTisNameT (SaNameT *name1, SaNameT *name2);
  141. extern int amfReadGroups (char **error_string);
  142. extern int amfReadNetwork (char **error_string, struct sockaddr_in *mcast_addr, struct sockaddr_in *bindnet_addr);
  143. #endif /* PARSE_H_DEFINED */