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