corosync  2.3.5
ipc_cpg.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006-2015 Red Hat, Inc.
3  *
4  * All rights reserved.
5  *
6  * Author: Christine Caulfield (ccaulfie@redhat.com)
7  * Author: Jan Friesse (jfriesse@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_CPG_H_DEFINED
36 #define IPC_CPG_H_DEFINED
37 
38 #include <netinet/in.h>
39 #include <qb/qbipc_common.h>
40 #include <corosync/corotypes.h>
41 #include <corosync/mar_gen.h>
42 
43 #define CPG_ZC_PATH_LEN 128
44 
59 };
60 
81 };
82 
89 };
90 
95 };
96 
97 typedef struct {
98  uint32_t length __attribute__((aligned(8)));
99  char value[CPG_MAX_NAME_LENGTH] __attribute__((aligned(8)));
101 
102 static inline void swab_mar_cpg_name_t (mar_cpg_name_t *to_swab)
103 {
104  swab_mar_uint32_t (&to_swab->length);
105 }
106 
107 static inline void marshall_from_mar_cpg_name_t (
108  struct cpg_name *dest,
109  const mar_cpg_name_t *src)
110 {
111  dest->length = src->length;
112  memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
113 }
114 
115 static inline void marshall_to_mar_cpg_name_t (
116  mar_cpg_name_t *dest,
117  const struct cpg_name *src)
118 {
119  dest->length = src->length;
120  memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
121 }
122 
123 typedef struct {
124  mar_uint32_t nodeid __attribute__((aligned(8)));
125  mar_uint32_t pid __attribute__((aligned(8)));
126  mar_uint32_t reason __attribute__((aligned(8)));
128 
129 static inline void marshall_from_mar_cpg_address_t (
130  struct cpg_address *dest,
131  const mar_cpg_address_t *src)
132 {
133  dest->nodeid = src->nodeid;
134  dest->pid = src->pid;
135  dest->reason = src->reason;
136 }
137 
138 static inline void marshall_to_mar_cpg_address_t (
139  mar_cpg_address_t *dest,
140  const struct cpg_address *src)
141 {
142  dest->nodeid = src->nodeid;
143  dest->pid = src->pid;
144  dest->reason = src->reason;
145 }
146 
147 static inline int mar_name_compare (
148  const mar_cpg_name_t *g1,
149  const mar_cpg_name_t *g2)
150 {
151  return (g1->length == g2->length?
152  memcmp (g1->value, g2->value, g1->length):
153  g1->length - g2->length);
154 }
155 
156 typedef struct {
161 
162 static inline void marshall_from_mar_cpg_iteration_description_t(
163  struct cpg_iteration_description_t *dest,
165 {
166  dest->nodeid = src->nodeid;
167  dest->pid = src->pid;
168  marshall_from_mar_cpg_name_t (&dest->group, &src->group);
169 };
170 
171 typedef struct {
172  mar_uint32_t nodeid __attribute__((aligned(8)));
173  mar_uint64_t seq __attribute__((aligned(8)));
175 
176 static inline void marshall_from_mar_cpg_ring_id_t (
177  struct cpg_ring_id *dest,
178  const mar_cpg_ring_id_t *src)
179 {
180  dest->nodeid = src->nodeid;
181  dest->seq = src->seq;
182 }
183 
185  struct qb_ipc_request_header header __attribute__((aligned(8)));
186  mar_cpg_name_t group_name __attribute__((aligned(8)));
187  mar_uint32_t pid __attribute__((aligned(8)));
188  mar_uint32_t flags __attribute__((aligned(8)));
189 };
190 
192  struct qb_ipc_response_header header __attribute__((aligned(8)));
193 };
194 
196  struct qb_ipc_request_header header __attribute__((aligned(8)));
197 };
198 
200  struct qb_ipc_response_header header __attribute__((aligned(8)));
201 };
202 
204  struct qb_ipc_request_header header __attribute__((aligned(8)));
205 };
206 
208  struct qb_ipc_response_header header __attribute__((aligned(8)));
209  mar_uint32_t local_nodeid __attribute__((aligned(8)));
210 };
211 
213  struct qb_ipc_response_header header __attribute__((aligned(8)));
214 };
215 
217  struct qb_ipc_response_header header __attribute__((aligned(8)));
218  mar_uint32_t guarantee __attribute__((aligned(8)));
219  mar_uint32_t msglen __attribute__((aligned(8)));
220  mar_uint8_t message[] __attribute__((aligned(8)));
221 };
222 
224  struct qb_ipc_response_header header __attribute__((aligned(8)));
225  mar_uint32_t guarantee __attribute__((aligned(8)));
226  mar_uint32_t msglen __attribute__((aligned(8)));
227  mar_uint32_t fraglen __attribute__((aligned(8)));
228  mar_uint32_t type __attribute__((aligned(8)));
229  mar_uint8_t message[] __attribute__((aligned(8)));
230 };
231 
233  struct qb_ipc_response_header header __attribute__((aligned(8)));
234 };
235 
240  struct qb_ipc_response_header header __attribute__((aligned(8)));
241  mar_cpg_name_t group_name __attribute__((aligned(8)));
242  mar_uint32_t msglen __attribute__((aligned(8)));
243  mar_uint32_t nodeid __attribute__((aligned(8)));
244  mar_uint32_t pid __attribute__((aligned(8)));
245  mar_uint8_t message[] __attribute__((aligned(8)));
246 };
247 
249  struct qb_ipc_response_header header __attribute__((aligned(8)));
250  mar_cpg_name_t group_name __attribute__((aligned(8)));
251  mar_uint32_t msglen __attribute__((aligned(8)));
252  mar_uint32_t fraglen __attribute__((aligned(8)));
253  mar_uint32_t nodeid __attribute__((aligned(8)));
254  mar_uint32_t pid __attribute__((aligned(8)));
255  mar_uint32_t type __attribute__((aligned(8)));
256  mar_uint8_t message[] __attribute__((aligned(8)));
257 };
258 
260  struct qb_ipc_response_header header __attribute__((aligned(8)));
261  mar_uint32_t flow_control_state __attribute__((aligned(8)));
262 };
263 
265  struct qb_ipc_request_header header __attribute__((aligned(8)));
266  mar_cpg_name_t group_name __attribute__((aligned(8)));
267 };
268 
270  struct qb_ipc_response_header header __attribute__((aligned(8)));
271  mar_uint32_t member_count __attribute__((aligned(8)));
273 };
274 
276  struct qb_ipc_response_header header __attribute__((aligned(8)));
277  mar_cpg_name_t group_name __attribute__((aligned(8)));
278  mar_uint32_t member_list_entries __attribute__((aligned(8)));
279  mar_uint32_t joined_list_entries __attribute__((aligned(8)));
280  mar_uint32_t left_list_entries __attribute__((aligned(8)));
281  mar_cpg_address_t member_list[];
282 // struct cpg_address left_list[];
283 // struct cpg_address joined_list[];
284 };
285 
287  struct qb_ipc_response_header header __attribute__((aligned(8)));
289  mar_uint32_t member_list_entries __attribute__((aligned(8)));
290  mar_uint32_t member_list[];
291 };
292 
294  struct qb_ipc_request_header header __attribute__((aligned(8)));
295  mar_cpg_name_t group_name __attribute__((aligned(8)));
296  mar_uint32_t pid __attribute__((aligned(8)));
297 };
298 
300  struct qb_ipc_response_header header __attribute__((aligned(8)));
301 };
302 
304  struct qb_ipc_request_header header __attribute__((aligned(8)));
305  mar_cpg_name_t group_name __attribute__((aligned(8)));
306  mar_uint32_t iteration_type __attribute__((aligned(8)));
307 };
308 
310  struct qb_ipc_response_header header __attribute__((aligned(8)));
311  hdb_handle_t iteration_handle __attribute__((aligned(8)));
312 };
313 
315  struct qb_ipc_request_header header __attribute__((aligned(8)));
316  hdb_handle_t iteration_handle __attribute__((aligned(8)));
317 };
318 
320  struct qb_ipc_response_header header __attribute__((aligned(8)));
321  mar_cpg_iteration_description_t description __attribute__((aligned(8)));
322 };
323 
325  struct qb_ipc_request_header header __attribute__((aligned(8)));
326  hdb_handle_t iteration_handle __attribute__((aligned(8)));
327 };
328 
330  struct qb_ipc_response_header header __attribute__((aligned(8)));
331 };
332 
333 typedef struct {
334  struct qb_ipc_request_header header __attribute__((aligned(8)));
335  size_t map_size __attribute__((aligned(8)));
336  char path_to_file[CPG_ZC_PATH_LEN] __attribute__((aligned(8)));
338 
339 typedef struct {
340  struct qb_ipc_request_header header __attribute__((aligned(8)));
341  size_t map_size __attribute__((aligned(8)));
342  uint64_t server_address __attribute__((aligned(8)));
344 
345 typedef struct {
346  struct qb_ipc_request_header header __attribute__((aligned(8)));
347  uint64_t server_address __attribute__((aligned(8)));
349 
351  int map_size;
352  uint64_t server_address;
353 };
354 #endif /* IPC_CPG_H_DEFINED */
uint32_t pid
Definition: cpg.h:87
req_cpg_types
Definition: ipc_cpg.h:45
#define CPG_MAX_NAME_LENGTH
Definition: cpg.h:91
lib_cpg_confchg_reason
Definition: ipc_cpg.h:83
uint32_t value
Definition: cpg.h:92
int guarantee
Definition: totemsrp.c:66
unsigned long long seq
Definition: coroapi.h:66
uint64_t server_address
Definition: ipc_cpg.h:352
uint64_t mar_uint64_t
Definition: mar_gen.h:54
uint32_t flags
char value[CPG_MAX_NAME_LENGTH]
Definition: cpg.h:94
uint8_t mar_uint8_t
Definition: mar_gen.h:51
struct cpg_name group
Definition: cpg.h:100
typedef __attribute__
uint32_t nodeid
Definition: cpg.h:86
uint32_t nodeid
Definition: cpg.h:106
#define CPG_ZC_PATH_LEN
Definition: ipc_cpg.h:43
uint32_t mar_uint32_t
Definition: mar_gen.h:53
#define PROCESSOR_COUNT_MAX
Definition: coroapi.h:83
qb_handle_t hdb_handle_t
Definition: hdb.h:52
uint32_t reason
Definition: cpg.h:88
res_cpg_types
Definition: ipc_cpg.h:61
char type
Definition: totemrrp.c:518
uint32_t length
Definition: cpg.h:93
unsigned int nodeid
Definition: coroapi.h:65
struct memb_ring_id ring_id
Definition: totemsrp.c:64
uint64_t seq
Definition: cpg.h:107
lib_cpg_partial_types
Definition: ipc_cpg.h:91
Message from another node.
Definition: ipc_cpg.h:239