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