amfconfig.h 5.5 KB

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