ipc_cfg.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. /*
  2. * Copyright (c) 2005 MontaVista Software, Inc.
  3. * Copyright (c) 2009-2013 Red Hat, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Author: Steven Dake (sdake@redhat.com)
  8. *
  9. * This software licensed under BSD license, the text of which follows:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * - Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. * THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. #ifndef IPC_CFG_H_DEFINED
  36. #define IPC_CFG_H_DEFINED
  37. #include <netinet/in.h>
  38. #include <corosync/corotypes.h>
  39. #include <corosync/mar_gen.h>
  40. #define CFG_INTERFACE_NAME_MAX_LEN 128
  41. #define CFG_INTERFACE_STATUS_MAX_LEN 512
  42. /*
  43. * Too keep future ABI compatibility, this value
  44. * is intentionaly bigger then INTERFACE_MAX
  45. */
  46. #define CFG_MAX_INTERFACES 16
  47. /**
  48. * @brief The req_lib_cfg_types enum
  49. */
  50. enum req_lib_cfg_types {
  51. MESSAGE_REQ_CFG_RINGSTATUSGET = 0,
  52. MESSAGE_REQ_CFG_RINGREENABLE = 1,
  53. MESSAGE_REQ_CFG_KILLNODE = 2,
  54. MESSAGE_REQ_CFG_TRYSHUTDOWN = 3,
  55. MESSAGE_REQ_CFG_REPLYTOSHUTDOWN = 4,
  56. MESSAGE_REQ_CFG_GET_NODE_ADDRS = 5,
  57. MESSAGE_REQ_CFG_LOCAL_GET = 6,
  58. MESSAGE_REQ_CFG_RELOAD_CONFIG = 7,
  59. MESSAGE_REQ_CFG_REOPEN_LOG_FILES = 8,
  60. MESSAGE_REQ_CFG_NODESTATUSGET = 9,
  61. MESSAGE_REQ_CFG_TRACKSTART = 10,
  62. MESSAGE_REQ_CFG_TRACKSTOP = 11
  63. };
  64. /**
  65. * @brief The res_lib_cfg_types enum
  66. */
  67. enum res_lib_cfg_types {
  68. MESSAGE_RES_CFG_RINGSTATUSGET = 0,
  69. MESSAGE_RES_CFG_RINGREENABLE = 1,
  70. MESSAGE_RES_CFG_STATETRACKSTART = 2,
  71. MESSAGE_RES_CFG_STATETRACKSTOP = 3,
  72. MESSAGE_RES_CFG_ADMINISTRATIVESTATESET = 4,
  73. MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET = 5,
  74. MESSAGE_RES_CFG_SERVICELOAD = 6,
  75. MESSAGE_RES_CFG_SERVICEUNLOAD = 7,
  76. MESSAGE_RES_CFG_KILLNODE = 8,
  77. MESSAGE_RES_CFG_TRYSHUTDOWN = 9,
  78. MESSAGE_RES_CFG_TESTSHUTDOWN = 10,
  79. MESSAGE_RES_CFG_GET_NODE_ADDRS = 11,
  80. MESSAGE_RES_CFG_LOCAL_GET = 12,
  81. MESSAGE_RES_CFG_REPLYTOSHUTDOWN = 13,
  82. MESSAGE_RES_CFG_RELOAD_CONFIG = 14,
  83. MESSAGE_RES_CFG_REOPEN_LOG_FILES = 15,
  84. MESSAGE_RES_CFG_NODESTATUSGET = 16
  85. };
  86. /**
  87. * @brief The req_lib_cfg_ringstatusget struct
  88. */
  89. struct req_lib_cfg_ringstatusget {
  90. struct qb_ipc_request_header header __attribute__((aligned(8)));
  91. };
  92. /**
  93. * @brief The res_lib_cfg_ringstatusget struct
  94. */
  95. struct res_lib_cfg_ringstatusget {
  96. struct qb_ipc_response_header header __attribute__((aligned(8)));
  97. mar_uint32_t interface_count __attribute__((aligned(8)));
  98. char interface_name[CFG_MAX_INTERFACES][CFG_INTERFACE_NAME_MAX_LEN] __attribute__((aligned(8)));
  99. char interface_status[CFG_MAX_INTERFACES][CFG_INTERFACE_STATUS_MAX_LEN] __attribute__((aligned(8)));
  100. };
  101. /**
  102. * @brief The req_lib_cfg_nodestatusget struct
  103. */
  104. struct req_lib_cfg_nodestatusget {
  105. struct qb_ipc_request_header header __attribute__((aligned(8)));
  106. unsigned int nodeid __attribute__((aligned(8)));
  107. mar_uint32_t version __attribute__((aligned(8)));
  108. };
  109. struct res_lib_cfg_nodestatusget_version {
  110. struct qb_ipc_response_header header __attribute__((aligned(8)));
  111. corosync_cfg_node_status_version_t version __attribute__((aligned(8)));
  112. };
  113. /**
  114. * @brief The res_lib_cfg_nodestatusget struct
  115. */
  116. struct res_lib_cfg_nodestatusget_v1 {
  117. struct qb_ipc_response_header header __attribute__((aligned(8)));
  118. struct corosync_cfg_node_status_v1 node_status __attribute__((aligned(8)));
  119. };
  120. /**
  121. * @brief The req_lib_cfg_ringreenable struct
  122. */
  123. struct req_lib_cfg_ringreenable {
  124. struct qb_ipc_request_header header __attribute__((aligned(8)));
  125. };
  126. /**
  127. * @brief The res_lib_cfg_ringreenable struct
  128. */
  129. struct res_lib_cfg_ringreenable {
  130. struct qb_ipc_response_header header __attribute__((aligned(8)));
  131. };
  132. /**
  133. * @brief The req_lib_cfg_killnode struct
  134. */
  135. struct req_lib_cfg_killnode {
  136. struct qb_ipc_request_header header __attribute__((aligned(8)));
  137. unsigned int nodeid __attribute__((aligned(8)));
  138. cs_name_t reason __attribute__((aligned(8)));
  139. };
  140. /**
  141. * @brief The res_lib_cfg_killnode struct
  142. */
  143. struct res_lib_cfg_killnode {
  144. struct qb_ipc_response_header header __attribute__((aligned(8)));
  145. };
  146. /**
  147. * @brief The req_lib_cfg_tryshutdown struct
  148. */
  149. struct req_lib_cfg_tryshutdown {
  150. struct qb_ipc_request_header header __attribute__((aligned(8)));
  151. unsigned int flags;
  152. };
  153. /**
  154. * @brief The res_lib_cfg_tryshutdown struct
  155. */
  156. struct res_lib_cfg_tryshutdown {
  157. struct qb_ipc_response_header header __attribute__((aligned(8)));
  158. };
  159. /**
  160. * @brief The req_lib_cfg_replytoshutdown struct
  161. */
  162. struct req_lib_cfg_replytoshutdown {
  163. struct qb_ipc_request_header header __attribute__((aligned(8)));
  164. unsigned int response;
  165. };
  166. /**
  167. * @brief The res_lib_cfg_replytoshutdown struct
  168. */
  169. struct res_lib_cfg_replytoshutdown {
  170. struct qb_ipc_response_header header __attribute__((aligned(8)));
  171. };
  172. /**
  173. * @brief The res_lib_cfg_testshutdown struct
  174. */
  175. struct res_lib_cfg_testshutdown {
  176. struct qb_ipc_response_header header __attribute__((aligned(8)));
  177. unsigned int flags;
  178. };
  179. /**
  180. * @brief The req_lib_cfg_get_node_addrs struct
  181. */
  182. struct req_lib_cfg_get_node_addrs {
  183. struct qb_ipc_request_header header __attribute__((aligned(8)));
  184. unsigned int nodeid;
  185. };
  186. /**
  187. * @brief The res_lib_cfg_get_node_addrs struct
  188. */
  189. struct res_lib_cfg_get_node_addrs {
  190. struct qb_ipc_response_header header __attribute__((aligned(8)));
  191. unsigned int family;
  192. unsigned int num_addrs;
  193. /* array of TOTEMIP_ADDRLEN items */
  194. char addrs[];
  195. };
  196. /**
  197. * @brief The req_lib_cfg_local_get struct
  198. */
  199. struct req_lib_cfg_local_get {
  200. struct qb_ipc_request_header header __attribute__((aligned(8)));
  201. };
  202. /**
  203. * @brief The res_lib_cfg_local_get struct
  204. */
  205. struct res_lib_cfg_local_get {
  206. struct qb_ipc_response_header header __attribute__((aligned(8)));
  207. mar_uint32_t local_nodeid __attribute__((aligned(8)));
  208. };
  209. /**
  210. * @brief The req_lib_cfg_reload_config struct
  211. */
  212. struct req_lib_cfg_reload_config {
  213. struct qb_ipc_request_header header __attribute__((aligned(8)));
  214. };
  215. /**
  216. * @brief The res_lib_cfg_reload_config struct
  217. */
  218. struct res_lib_cfg_reload_config {
  219. struct qb_ipc_response_header header __attribute__((aligned(8)));
  220. };
  221. /**
  222. * @brief The req_lib_cfg_reopen_log_files struct
  223. */
  224. struct req_lib_cfg_reopen_log_files {
  225. struct qb_ipc_request_header header __attribute__((aligned(8)));
  226. };
  227. /**
  228. * @brief The res_lib_cfg_reopen_log_files struct
  229. */
  230. struct res_lib_cfg_reopen_log_files {
  231. struct qb_ipc_response_header header __attribute__((aligned(8)));
  232. };
  233. struct req_lib_cfg_trackstart {
  234. struct qb_ipc_request_header header;
  235. uint8_t track_flags;
  236. };
  237. struct res_lib_cfg_trackstart {
  238. struct qb_ipc_response_header header;
  239. };
  240. struct req_lib_cfg_trackstop {
  241. struct qb_ipc_request_header header;
  242. };
  243. struct res_lib_cfg_trackstop {
  244. struct qb_ipc_response_header header;
  245. };
  246. /**
  247. * @brief corosync_administrative_target_t enum
  248. */
  249. typedef enum {
  250. AIS_AMF_ADMINISTRATIVETARGET_SERVICEUNIT = 0,
  251. AIS_AMF_ADMINISTRATIVETARGET_SERVICEGROUP = 1,
  252. AIS_AMF_ADMINISTRATIVETARGET_COMPONENTSERVICEINSTANCE = 2,
  253. AIS_AMF_ADMINISTRATIVETARGET_NODE = 3
  254. } corosync_administrative_target_t;
  255. /**
  256. * @brief corosync_administrative_state_t enum
  257. */
  258. typedef enum {
  259. AIS_AMF_ADMINISTRATIVESTATE_UNLOCKED = 0,
  260. AIS_AMF_ADMINISTRATIVESTATE_LOCKED = 1,
  261. AIS_AMF_ADMINISTRATIVESTATE_STOPPING = 2
  262. } corosync_administrative_state_t;
  263. /**
  264. * @brief corosync_shutdown_flags_t enum
  265. */
  266. typedef enum {
  267. CFG_SHUTDOWN_FLAG_REQUEST = 0,
  268. CFG_SHUTDOWN_FLAG_REGARDLESS = 1,
  269. CFG_SHUTDOWN_FLAG_IMMEDIATE = 2,
  270. } corosync_shutdown_flags_t;
  271. #endif /* IPC_CFG_H_DEFINED */