ipc_cmap.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /*
  2. * Copyright (c) 2011-2017 Red Hat, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Author: Jan Friesse (jfriesse@redhat.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 Red Hat, 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. #ifndef IPC_CMAP_H_DEFINED
  35. #define IPC_CMAP_H_DEFINED
  36. #include <netinet/in.h>
  37. #include <corosync/corotypes.h>
  38. #include <corosync/mar_gen.h>
  39. /**
  40. * @brief The req_cmap_types enum
  41. */
  42. enum req_cmap_types {
  43. MESSAGE_REQ_CMAP_SET = 0,
  44. MESSAGE_REQ_CMAP_DELETE = 1,
  45. MESSAGE_REQ_CMAP_GET = 2,
  46. MESSAGE_REQ_CMAP_ADJUST_INT = 3,
  47. MESSAGE_REQ_CMAP_ITER_INIT = 4,
  48. MESSAGE_REQ_CMAP_ITER_NEXT = 5,
  49. MESSAGE_REQ_CMAP_ITER_FINALIZE = 6,
  50. MESSAGE_REQ_CMAP_TRACK_ADD = 7,
  51. MESSAGE_REQ_CMAP_TRACK_DELETE = 8,
  52. MESSAGE_REQ_CMAP_SET_CURRENT_MAP = 9,
  53. };
  54. /**
  55. * @brief The res_cmap_types enum
  56. */
  57. enum res_cmap_types {
  58. MESSAGE_RES_CMAP_SET = 0,
  59. MESSAGE_RES_CMAP_DELETE = 1,
  60. MESSAGE_RES_CMAP_GET = 2,
  61. MESSAGE_RES_CMAP_ADJUST_INT = 3,
  62. MESSAGE_RES_CMAP_ITER_INIT = 4,
  63. MESSAGE_RES_CMAP_ITER_NEXT = 5,
  64. MESSAGE_RES_CMAP_ITER_FINALIZE = 6,
  65. MESSAGE_RES_CMAP_TRACK_ADD = 7,
  66. MESSAGE_RES_CMAP_TRACK_DELETE = 8,
  67. MESSAGE_RES_CMAP_NOTIFY_CALLBACK = 9,
  68. MESSAGE_RES_CMAP_SET_CURRENT_MAP = 10,
  69. };
  70. enum {
  71. CMAP_SETMAP_DEFAULT = 0,
  72. CMAP_SETMAP_STATS = 1,
  73. };
  74. /**
  75. * @brief The req_lib_cmap_set struct
  76. */
  77. struct req_lib_cmap_set {
  78. struct qb_ipc_request_header header __attribute__((aligned(8)));
  79. mar_name_t key_name __attribute__((aligned(8)));
  80. mar_size_t value_len __attribute__((aligned(8)));
  81. mar_uint8_t type __attribute__((aligned(8)));
  82. mar_uint8_t value[] __attribute__((aligned(8)));
  83. };
  84. /**
  85. * @brief The res_lib_cmap_set struct
  86. */
  87. struct res_lib_cmap_set {
  88. struct qb_ipc_response_header header __attribute__((aligned(8)));
  89. };
  90. /**
  91. * @brief The req_lib_cmap_delete struct
  92. */
  93. struct req_lib_cmap_delete {
  94. struct qb_ipc_request_header header __attribute__((aligned(8)));
  95. mar_name_t key_name __attribute__((aligned(8)));
  96. };
  97. /**
  98. * @brief The res_lib_cmap_delete struct
  99. */
  100. struct res_lib_cmap_delete {
  101. struct qb_ipc_response_header header __attribute__((aligned(8)));
  102. };
  103. /**
  104. * @brief The req_lib_cmap_get struct
  105. */
  106. struct req_lib_cmap_get {
  107. struct qb_ipc_request_header header __attribute__((aligned(8)));
  108. mar_name_t key_name __attribute__((aligned(8)));
  109. mar_size_t value_len __attribute__((aligned(8)));
  110. };
  111. /**
  112. * @brief The res_lib_cmap_get struct
  113. */
  114. struct res_lib_cmap_get {
  115. struct qb_ipc_response_header header __attribute__((aligned(8)));
  116. mar_size_t value_len __attribute__((aligned(8)));
  117. mar_uint8_t type __attribute__((aligned(8)));
  118. mar_uint8_t value[] __attribute__((aligned(8)));
  119. };
  120. /**
  121. * @brief The req_lib_cmap_adjust_int struct
  122. */
  123. struct req_lib_cmap_adjust_int {
  124. struct qb_ipc_request_header header __attribute__((aligned(8)));
  125. mar_name_t key_name __attribute__((aligned(8)));
  126. mar_int32_t step __attribute__((aligned(8)));
  127. };
  128. /**
  129. * @brief The res_lib_cmap_adjust_int struct
  130. */
  131. struct res_lib_cmap_adjust_int {
  132. struct qb_ipc_response_header header __attribute__((aligned(8)));
  133. };
  134. /**
  135. * @brief The req_lib_cmap_iter_init struct
  136. */
  137. struct req_lib_cmap_iter_init {
  138. struct qb_ipc_request_header header __attribute__((aligned(8)));
  139. mar_name_t prefix __attribute__((aligned(8)));
  140. };
  141. /**
  142. * @brief The res_lib_cmap_iter_init struct
  143. */
  144. struct res_lib_cmap_iter_init {
  145. struct qb_ipc_response_header header __attribute__((aligned(8)));
  146. mar_uint64_t iter_handle __attribute__((aligned(8)));
  147. };
  148. /**
  149. * @brief The req_lib_cmap_iter_next struct
  150. */
  151. struct req_lib_cmap_iter_next {
  152. struct qb_ipc_request_header header __attribute__((aligned(8)));
  153. mar_uint64_t iter_handle __attribute__((aligned(8)));
  154. };
  155. /**
  156. * @brief The res_lib_cmap_iter_next struct
  157. */
  158. struct res_lib_cmap_iter_next {
  159. struct qb_ipc_response_header header __attribute__((aligned(8)));
  160. mar_name_t key_name __attribute__((aligned(8)));
  161. mar_size_t value_len __attribute__((aligned(8)));
  162. mar_uint8_t type __attribute__((aligned(8)));
  163. };
  164. /**
  165. * @brief The req_lib_cmap_iter_finalize struct
  166. */
  167. struct req_lib_cmap_iter_finalize {
  168. struct qb_ipc_request_header header __attribute__((aligned(8)));
  169. mar_uint64_t iter_handle __attribute__((aligned(8)));
  170. };
  171. /**
  172. * @brief The res_lib_cmap_iter_finalize struct
  173. */
  174. struct res_lib_cmap_iter_finalize {
  175. struct qb_ipc_response_header header __attribute__((aligned(8)));
  176. };
  177. /**
  178. * @brief The req_lib_cmap_track_add struct
  179. */
  180. struct req_lib_cmap_track_add {
  181. struct qb_ipc_request_header header __attribute__((aligned(8)));
  182. mar_name_t key_name __attribute__((aligned(8)));
  183. mar_int32_t track_type __attribute__((aligned(8)));
  184. mar_uint64_t track_inst_handle __attribute__((aligned(8)));
  185. };
  186. /**
  187. * @brief The res_lib_cmap_track_add struct
  188. */
  189. struct res_lib_cmap_track_add {
  190. struct qb_ipc_response_header header __attribute__((aligned(8)));
  191. mar_uint64_t track_handle __attribute__((aligned(8)));
  192. };
  193. /**
  194. * @brief The req_lib_cmap_track_delete struct
  195. */
  196. struct req_lib_cmap_track_delete {
  197. struct qb_ipc_request_header header __attribute__((aligned(8)));
  198. mar_uint64_t track_handle __attribute__((aligned(8)));
  199. };
  200. /**
  201. * @brief The res_lib_cmap_track_delete struct
  202. */
  203. struct res_lib_cmap_track_delete {
  204. struct qb_ipc_response_header header __attribute__((aligned(8)));
  205. mar_uint64_t track_inst_handle __attribute__((aligned(8)));
  206. };
  207. /**
  208. * @brief The res_lib_cmap_notify_callback struct
  209. */
  210. struct res_lib_cmap_notify_callback {
  211. struct qb_ipc_response_header header __attribute__((aligned(8)));
  212. mar_uint64_t track_inst_handle __attribute__((aligned(8)));
  213. mar_name_t key_name __attribute__((aligned(8)));
  214. mar_int32_t event __attribute__((aligned(8)));
  215. mar_uint8_t new_value_type __attribute__((aligned(8)));
  216. mar_uint8_t old_value_type __attribute__((aligned(8)));
  217. mar_size_t new_value_len __attribute__((aligned(8)));
  218. mar_size_t old_value_len __attribute__((aligned(8)));
  219. /*
  220. * After old_vale_len, there are two items with length of new_value_len
  221. * and old_value_len, only first (as a pointer) is defined
  222. *
  223. * mar_uint8_t *new_value;
  224. * mar_uint8_t *old_value;
  225. */
  226. mar_uint8_t new_value[];
  227. };
  228. /**
  229. * @brief The req_lib_cmap_set_current_map struct
  230. * used by cmap_initialize_map()
  231. */
  232. struct req_lib_cmap_set_current_map {
  233. struct qb_ipc_request_header header __attribute__((aligned(8)));
  234. mar_int32_t map __attribute__((aligned(8)));
  235. };
  236. #endif /* IPC_CMAP_H_DEFINED */