ipc_cmap.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /*
  2. * Copyright (c) 2011 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. };
  53. /**
  54. * @brief The res_cmap_types enum
  55. */
  56. enum res_cmap_types {
  57. MESSAGE_RES_CMAP_SET = 0,
  58. MESSAGE_RES_CMAP_DELETE = 1,
  59. MESSAGE_RES_CMAP_GET = 2,
  60. MESSAGE_RES_CMAP_ADJUST_INT = 3,
  61. MESSAGE_RES_CMAP_ITER_INIT = 4,
  62. MESSAGE_RES_CMAP_ITER_NEXT = 5,
  63. MESSAGE_RES_CMAP_ITER_FINALIZE = 6,
  64. MESSAGE_RES_CMAP_TRACK_ADD = 7,
  65. MESSAGE_RES_CMAP_TRACK_DELETE = 8,
  66. MESSAGE_RES_CMAP_NOTIFY_CALLBACK = 9,
  67. };
  68. /**
  69. * @brief The req_lib_cmap_set struct
  70. */
  71. struct req_lib_cmap_set {
  72. struct qb_ipc_request_header header __attribute__((aligned(8)));
  73. mar_name_t key_name __attribute__((aligned(8)));
  74. mar_size_t value_len __attribute__((aligned(8)));
  75. mar_uint8_t type __attribute__((aligned(8)));
  76. mar_uint8_t value[] __attribute__((aligned(8)));
  77. };
  78. /**
  79. * @brief The res_lib_cmap_set struct
  80. */
  81. struct res_lib_cmap_set {
  82. struct qb_ipc_response_header header __attribute__((aligned(8)));
  83. };
  84. /**
  85. * @brief The req_lib_cmap_delete struct
  86. */
  87. struct req_lib_cmap_delete {
  88. struct qb_ipc_request_header header __attribute__((aligned(8)));
  89. mar_name_t key_name __attribute__((aligned(8)));
  90. };
  91. /**
  92. * @brief The res_lib_cmap_delete struct
  93. */
  94. struct res_lib_cmap_delete {
  95. struct qb_ipc_response_header header __attribute__((aligned(8)));
  96. };
  97. /**
  98. * @brief The req_lib_cmap_get struct
  99. */
  100. struct req_lib_cmap_get {
  101. struct qb_ipc_request_header header __attribute__((aligned(8)));
  102. mar_name_t key_name __attribute__((aligned(8)));
  103. mar_size_t value_len __attribute__((aligned(8)));
  104. };
  105. /**
  106. * @brief The res_lib_cmap_get struct
  107. */
  108. struct res_lib_cmap_get {
  109. struct qb_ipc_response_header header __attribute__((aligned(8)));
  110. mar_size_t value_len __attribute__((aligned(8)));
  111. mar_uint8_t type __attribute__((aligned(8)));
  112. mar_uint8_t value[] __attribute__((aligned(8)));
  113. };
  114. /**
  115. * @brief The req_lib_cmap_adjust_int struct
  116. */
  117. struct req_lib_cmap_adjust_int {
  118. struct qb_ipc_request_header header __attribute__((aligned(8)));
  119. mar_name_t key_name __attribute__((aligned(8)));
  120. mar_int32_t step __attribute__((aligned(8)));
  121. };
  122. /**
  123. * @brief The res_lib_cmap_adjust_int struct
  124. */
  125. struct res_lib_cmap_adjust_int {
  126. struct qb_ipc_response_header header __attribute__((aligned(8)));
  127. };
  128. /**
  129. * @brief The req_lib_cmap_iter_init struct
  130. */
  131. struct req_lib_cmap_iter_init {
  132. struct qb_ipc_request_header header __attribute__((aligned(8)));
  133. mar_name_t prefix __attribute__((aligned(8)));
  134. };
  135. /**
  136. * @brief The res_lib_cmap_iter_init struct
  137. */
  138. struct res_lib_cmap_iter_init {
  139. struct qb_ipc_response_header header __attribute__((aligned(8)));
  140. mar_uint64_t iter_handle __attribute__((aligned(8)));
  141. };
  142. /**
  143. * @brief The req_lib_cmap_iter_next struct
  144. */
  145. struct req_lib_cmap_iter_next {
  146. struct qb_ipc_request_header header __attribute__((aligned(8)));
  147. mar_uint64_t iter_handle __attribute__((aligned(8)));
  148. };
  149. /**
  150. * @brief The res_lib_cmap_iter_next struct
  151. */
  152. struct res_lib_cmap_iter_next {
  153. struct qb_ipc_response_header header __attribute__((aligned(8)));
  154. mar_name_t key_name __attribute__((aligned(8)));
  155. mar_size_t value_len __attribute__((aligned(8)));
  156. mar_uint8_t type __attribute__((aligned(8)));
  157. };
  158. /**
  159. * @brief The req_lib_cmap_iter_finalize struct
  160. */
  161. struct req_lib_cmap_iter_finalize {
  162. struct qb_ipc_request_header header __attribute__((aligned(8)));
  163. mar_uint64_t iter_handle __attribute__((aligned(8)));
  164. };
  165. /**
  166. * @brief The res_lib_cmap_iter_finalize struct
  167. */
  168. struct res_lib_cmap_iter_finalize {
  169. struct qb_ipc_response_header header __attribute__((aligned(8)));
  170. };
  171. /**
  172. * @brief The req_lib_cmap_track_add struct
  173. */
  174. struct req_lib_cmap_track_add {
  175. struct qb_ipc_request_header header __attribute__((aligned(8)));
  176. mar_name_t key_name __attribute__((aligned(8)));
  177. mar_int32_t track_type __attribute__((aligned(8)));
  178. mar_uint64_t track_inst_handle __attribute__((aligned(8)));
  179. };
  180. /**
  181. * @brief The res_lib_cmap_track_add struct
  182. */
  183. struct res_lib_cmap_track_add {
  184. struct qb_ipc_response_header header __attribute__((aligned(8)));
  185. mar_uint64_t track_handle __attribute__((aligned(8)));
  186. };
  187. /**
  188. * @brief The req_lib_cmap_track_delete struct
  189. */
  190. struct req_lib_cmap_track_delete {
  191. struct qb_ipc_request_header header __attribute__((aligned(8)));
  192. mar_uint64_t track_handle __attribute__((aligned(8)));
  193. };
  194. /**
  195. * @brief The res_lib_cmap_track_delete struct
  196. */
  197. struct res_lib_cmap_track_delete {
  198. struct qb_ipc_response_header header __attribute__((aligned(8)));
  199. mar_uint64_t track_inst_handle __attribute__((aligned(8)));
  200. };
  201. /**
  202. * @brief The res_lib_cmap_notify_callback struct
  203. */
  204. struct res_lib_cmap_notify_callback {
  205. struct qb_ipc_response_header header __attribute__((aligned(8)));
  206. mar_uint64_t track_inst_handle __attribute__((aligned(8)));
  207. mar_name_t key_name __attribute__((aligned(8)));
  208. mar_int32_t event __attribute__((aligned(8)));
  209. mar_uint8_t new_value_type __attribute__((aligned(8)));
  210. mar_uint8_t old_value_type __attribute__((aligned(8)));
  211. mar_size_t new_value_len __attribute__((aligned(8)));
  212. mar_size_t old_value_len __attribute__((aligned(8)));
  213. /*
  214. * After old_vale_len, there are two items with length of new_value_len
  215. * and old_value_len, only first (as a pointer) is defined
  216. *
  217. * mar_uint8_t *new_value;
  218. * mar_uint8_t *old_value;
  219. */
  220. mar_uint8_t new_value[];
  221. };
  222. #endif /* IPC_CMAP_H_DEFINED */