amfconfig.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * Copyright (c) 2002-2005 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/saAis.h"
  36. #include "../include/saAmf.h"
  37. #include "../include/list.h"
  38. #include "aispoll.h"
  39. #include "../include/openaisCfg.h"
  40. #ifndef AMFCONFIG_H_DEFINED
  41. #define AMFCONFIG_H_DEFINED
  42. typedef enum {
  43. GROUPCAPABILITYMODEL_2N,
  44. GROUPCAPABILITYMODEL_NPLUSM,
  45. GROUPCAPABILITYMODEL_NWAY,
  46. GROUPCAPABILITYMODEL_NWAYACTIVE,
  47. GROUPCAPABILITYMODEL_NOREDUNDANCY
  48. } SaAmfGroupCapabilityModelT;
  49. #ifdef COMPILE_OUT
  50. enum amfOperationalAdministrativeState {
  51. AMF_DISABLED_UNLOCKED = 0,
  52. AMF_DISABLED_LOCKED = 1,
  53. AMF_ENABLED_UNLOCKED = 2,
  54. AMF_ENABLED_STOPPING = 3
  55. };
  56. #endif
  57. struct amf_healthcheck {
  58. SaAmfHealthcheckKeyT key;
  59. SaTimeT period;
  60. SaTimeT maximum_duration;
  61. struct amf_comp *comp;
  62. struct list_head list;
  63. };
  64. enum escalation_levels {
  65. ESCALATION_LEVEL_NO_ESCALATION = 1, /* execute component restart */
  66. ESCALATION_LEVEL_ONE = 2, /* escalate to service unit restart */
  67. ESCALATION_LEVEL_TWO = 3, /* escalate to service unit failover */
  68. ESCALATION_LEVEL_THREE = 4 /* escalate to node failover */
  69. };
  70. struct amf_unit {
  71. SaNameT name;
  72. struct list_head comp_head;
  73. struct list_head unit_list;
  74. struct amf_group *amf_group;
  75. struct list_head si_head;
  76. struct list_head si_list;
  77. int si_count;
  78. OpenaisCfgPresenceStateT presence_state;
  79. OpenaisCfgOperationalStateT operational_state;
  80. OpenaisCfgReadinessStateT readiness_state;
  81. SaAmfHAStateT assigned_ha_state;
  82. SaAmfHAStateT requested_ha_state;
  83. unsigned char clccli_path[1024];
  84. unsigned char binary_path[1024];
  85. poll_timer_handle restart_timer;
  86. int restart_count;
  87. enum escalation_levels escalation_level;
  88. };
  89. struct amf_si;
  90. struct amf_csi {
  91. SaNameT name;
  92. struct list_head list;
  93. struct amf_unit *unit;
  94. struct list_head csi_list;
  95. struct list_head unit_head;
  96. struct amf_si *si;
  97. int pg_set;
  98. };
  99. struct amf_si {
  100. SaNameT name;
  101. int csi_count;
  102. struct list_head list;
  103. struct amf_group *group;
  104. struct list_head csi_head;
  105. struct list_head pg_head;
  106. struct list_head unit_list;
  107. OpenaisCfgAdministrativeStateT administrative_state;
  108. OpenaisCfgOperationalStateT operational_state;
  109. };
  110. struct amf_pg {
  111. SaNameT name;
  112. struct amf_comp *comp;
  113. struct list_head pg_list;
  114. struct list_head pg_comp_head;
  115. };
  116. struct amf_pg_comp {
  117. struct amf_comp *comp;
  118. struct amf_csi *csi;
  119. struct list_head list;
  120. };
  121. struct amf_group {
  122. SaNameT name;
  123. SaAmfGroupCapabilityModelT model;
  124. SaUint32T preferred_active_units;;
  125. SaUint32T preferred_standby_units;
  126. SaUint32T maximum_active_instances;
  127. SaUint32T maximum_standby_instances;
  128. OpenaisCfgAdministrativeStateT administrativeState;
  129. struct list_head group_list;
  130. struct list_head unit_head;
  131. struct list_head si_head;
  132. unsigned char clccli_path[1024];
  133. unsigned char binary_path[1024];
  134. unsigned int component_restart_probation;
  135. unsigned int component_restart_max;
  136. unsigned int unit_restart_probation;
  137. unsigned int unit_restart_max;
  138. };
  139. enum clc_component_types {
  140. clc_component_sa_aware = 0, /* sa aware */
  141. clc_component_proxied_pre = 1, /* proxied, pre-instantiable */
  142. clc_component_proxied_non_pre = 2, /* proxied, non pre-instantiable */
  143. clc_component_non_proxied_non_sa_aware = 3 /* non-proxied, non sa aware */
  144. };
  145. struct amf_comp {
  146. int registered;
  147. int local;
  148. struct conn_info *conn_info;
  149. SaNameT name;
  150. struct in_addr source_addr;
  151. struct amf_comp *proxy_comp;
  152. struct amf_unit *unit;
  153. struct amf_pg *pg;
  154. struct amf_csi *csi;
  155. struct list_head comp_list;
  156. struct list_head healthcheck_list;
  157. enum clc_component_types comptype;
  158. unsigned char clccli_path[1024];
  159. unsigned char binary_path[1024];
  160. unsigned char binary_name[1024];
  161. unsigned char instantiate_cmd[1024];
  162. unsigned char terminate_cmd[1024];
  163. unsigned char cleanup_cmd[1024];
  164. unsigned char am_start_cmd[1024];
  165. unsigned char am_stop_cmd[1024];
  166. OpenaisCfgAdministrativeStateT administrative_state;
  167. OpenaisCfgOperationalStateT operational_state;
  168. OpenaisCfgReadinessStateT readiness_state;
  169. SaAmfHAStateT ha_state;
  170. OpenaisCfgPresenceStateT presence_state;
  171. };
  172. extern struct list_head amf_group_head;
  173. extern struct amf_comp *find_comp (SaNameT *name);
  174. extern struct amf_unit *find_unit (SaNameT *name);
  175. extern struct amf_healthcheck *find_healthcheck (SaAmfHealthcheckKeyT *key);
  176. #endif /* AMFCONFIG_H_DEFINED */