corosync  2.3.2
ipc_cpg.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006-2011 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 
58 };
59 
78 };
79 
86 };
87 
88 typedef struct {
89  uint32_t length __attribute__((aligned(8)));
90  char value[CPG_MAX_NAME_LENGTH] __attribute__((aligned(8)));
92 
93 static inline void swab_mar_cpg_name_t (mar_cpg_name_t *to_swab)
94 {
95  swab_mar_uint32_t (&to_swab->length);
96 }
97 
98 static inline void marshall_from_mar_cpg_name_t (
99  struct cpg_name *dest,
100  const mar_cpg_name_t *src)
101 {
102  dest->length = src->length;
103  memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
104 }
105 
106 static inline void marshall_to_mar_cpg_name_t (
107  mar_cpg_name_t *dest,
108  const struct cpg_name *src)
109 {
110  dest->length = src->length;
111  memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
112 }
113 
114 typedef struct {
115  mar_uint32_t nodeid __attribute__((aligned(8)));
116  mar_uint32_t pid __attribute__((aligned(8)));
117  mar_uint32_t reason __attribute__((aligned(8)));
119 
120 static inline void marshall_from_mar_cpg_address_t (
121  struct cpg_address *dest,
122  const mar_cpg_address_t *src)
123 {
124  dest->nodeid = src->nodeid;
125  dest->pid = src->pid;
126  dest->reason = src->reason;
127 }
128 
129 static inline void marshall_to_mar_cpg_address_t (
130  mar_cpg_address_t *dest,
131  const struct cpg_address *src)
132 {
133  dest->nodeid = src->nodeid;
134  dest->pid = src->pid;
135  dest->reason = src->reason;
136 }
137 
138 static inline int mar_name_compare (
139  const mar_cpg_name_t *g1,
140  const mar_cpg_name_t *g2)
141 {
142  return (g1->length == g2->length?
143  memcmp (g1->value, g2->value, g1->length):
144  g1->length - g2->length);
145 }
146 
147 typedef struct {
152 
153 static inline void marshall_from_mar_cpg_iteration_description_t(
154  struct cpg_iteration_description_t *dest,
156 {
157  dest->nodeid = src->nodeid;
158  dest->pid = src->pid;
159  marshall_from_mar_cpg_name_t (&dest->group, &src->group);
160 };
161 
162 typedef struct {
163  mar_uint32_t nodeid __attribute__((aligned(8)));
164  mar_uint64_t seq __attribute__((aligned(8)));
166 
167 static inline void marshall_from_mar_cpg_ring_id_t (
168  struct cpg_ring_id *dest,
169  const mar_cpg_ring_id_t *src)
170 {
171  dest->nodeid = src->nodeid;
172  dest->seq = src->seq;
173 }
174 
176  struct qb_ipc_request_header header __attribute__((aligned(8)));
177  mar_cpg_name_t group_name __attribute__((aligned(8)));
178  mar_uint32_t pid __attribute__((aligned(8)));
179  mar_uint32_t flags __attribute__((aligned(8)));
180 };
181 
183  struct qb_ipc_response_header header __attribute__((aligned(8)));
184 };
185 
187  struct qb_ipc_request_header header __attribute__((aligned(8)));
188 };
189 
191  struct qb_ipc_response_header header __attribute__((aligned(8)));
192 };
193 
195  struct qb_ipc_request_header header __attribute__((aligned(8)));
196 };
197 
199  struct qb_ipc_response_header header __attribute__((aligned(8)));
200  mar_uint32_t local_nodeid __attribute__((aligned(8)));
201 };
202 
204  struct qb_ipc_response_header header __attribute__((aligned(8)));
205  mar_uint32_t guarantee __attribute__((aligned(8)));
206  mar_uint32_t msglen __attribute__((aligned(8)));
207  mar_uint8_t message[] __attribute__((aligned(8)));
208 };
209 
211  struct qb_ipc_response_header header __attribute__((aligned(8)));
212 };
213 
218  struct qb_ipc_response_header header __attribute__((aligned(8)));
219  mar_cpg_name_t group_name __attribute__((aligned(8)));
220  mar_uint32_t msglen __attribute__((aligned(8)));
221  mar_uint32_t nodeid __attribute__((aligned(8)));
222  mar_uint32_t pid __attribute__((aligned(8)));
223  mar_uint8_t message[] __attribute__((aligned(8)));
224 };
225 
227  struct qb_ipc_response_header header __attribute__((aligned(8)));
228  mar_uint32_t flow_control_state __attribute__((aligned(8)));
229 };
230 
232  struct qb_ipc_request_header header __attribute__((aligned(8)));
233  mar_cpg_name_t group_name __attribute__((aligned(8)));
234 };
235 
237  struct qb_ipc_response_header header __attribute__((aligned(8)));
238  mar_uint32_t member_count __attribute__((aligned(8)));
240 };
241 
243  struct qb_ipc_response_header header __attribute__((aligned(8)));
244  mar_cpg_name_t group_name __attribute__((aligned(8)));
245  mar_uint32_t member_list_entries __attribute__((aligned(8)));
246  mar_uint32_t joined_list_entries __attribute__((aligned(8)));
247  mar_uint32_t left_list_entries __attribute__((aligned(8)));
249 // struct cpg_address left_list[];
250 // struct cpg_address joined_list[];
251 };
252 
254  struct qb_ipc_response_header header __attribute__((aligned(8)));
256  mar_uint32_t member_list_entries __attribute__((aligned(8)));
258 };
259 
261  struct qb_ipc_request_header header __attribute__((aligned(8)));
262  mar_cpg_name_t group_name __attribute__((aligned(8)));
263  mar_uint32_t pid __attribute__((aligned(8)));
264 };
265 
267  struct qb_ipc_response_header header __attribute__((aligned(8)));
268 };
269 
271  struct qb_ipc_request_header header __attribute__((aligned(8)));
272  mar_cpg_name_t group_name __attribute__((aligned(8)));
273  mar_uint32_t iteration_type __attribute__((aligned(8)));
274 };
275 
277  struct qb_ipc_response_header header __attribute__((aligned(8)));
278  hdb_handle_t iteration_handle __attribute__((aligned(8)));
279 };
280 
282  struct qb_ipc_request_header header __attribute__((aligned(8)));
283  hdb_handle_t iteration_handle __attribute__((aligned(8)));
284 };
285 
287  struct qb_ipc_response_header header __attribute__((aligned(8)));
288  mar_cpg_iteration_description_t description __attribute__((aligned(8)));
289 };
290 
292  struct qb_ipc_request_header header __attribute__((aligned(8)));
293  hdb_handle_t iteration_handle __attribute__((aligned(8)));
294 };
295 
297  struct qb_ipc_response_header header __attribute__((aligned(8)));
298 };
299 
300 typedef struct {
301  struct qb_ipc_request_header header __attribute__((aligned(8)));
302  size_t map_size __attribute__((aligned(8)));
303  char path_to_file[CPG_ZC_PATH_LEN] __attribute__((aligned(8)));
305 
306 typedef struct {
307  struct qb_ipc_request_header header __attribute__((aligned(8)));
308  size_t map_size __attribute__((aligned(8)));
309  uint64_t server_address __attribute__((aligned(8)));
311 
312 typedef struct {
313  struct qb_ipc_request_header header __attribute__((aligned(8)));
314  uint64_t server_address __attribute__((aligned(8)));
316 
318  int map_size;
319  uint64_t server_address;
320 };
321 #endif /* IPC_CPG_H_DEFINED */
uint32_t pid
Definition: cpg.h:87
req_cpg_types
Definition: ipc_cpg.h:45
mar_cpg_address_t member_list[]
Definition: ipc_cpg.h:248
#define CPG_MAX_NAME_LENGTH
Definition: cpg.h:91
struct qb_ipc_request_header header __attribute__((aligned(8)))
lib_cpg_confchg_reason
Definition: ipc_cpg.h:80
uint32_t value
Definition: cpg.h:92
struct qb_ipc_response_header header __attribute__((aligned(8)))
struct qb_ipc_response_header header __attribute__((aligned(8)))
struct qb_ipc_response_header header __attribute__((aligned(8)))
struct qb_ipc_response_header header __attribute__((aligned(8)))
int guarantee
Definition: totemsrp.c:155
unsigned long long seq
Definition: coroapi.h:66
uint64_t server_address
Definition: ipc_cpg.h:319
uint64_t mar_uint64_t
Definition: mar_gen.h:54
uint32_t flags
char value[CPG_MAX_NAME_LENGTH]
Definition: cpg.h:94
mar_cpg_address_t member_list[PROCESSOR_COUNT_MAX]
Definition: ipc_cpg.h:239
uint8_t mar_uint8_t
Definition: mar_gen.h:51
struct cpg_name group
Definition: cpg.h:100
struct qb_ipc_response_header header __attribute__((aligned(8)))
uint32_t nodeid
Definition: cpg.h:86
struct qb_ipc_response_header header __attribute__((aligned(8)))
struct qb_ipc_request_header header __attribute__((aligned(8)))
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
struct qb_ipc_request_header header __attribute__((aligned(8)))
struct qb_ipc_response_header header __attribute__((aligned(8)))
struct qb_ipc_request_header header __attribute__((aligned(8)))
struct qb_ipc_request_header header __attribute__((aligned(8)))
uint32_t reason
Definition: cpg.h:88
res_cpg_types
Definition: ipc_cpg.h:60
struct qb_ipc_response_header header __attribute__((aligned(8)))
struct qb_ipc_response_header header __attribute__((aligned(8)))
typedef __attribute__
uint32_t length
Definition: cpg.h:93
struct qb_ipc_request_header header __attribute__((aligned(8)))
unsigned int nodeid
Definition: coroapi.h:65
struct memb_ring_id ring_id
Definition: totemsrp.c:153
uint64_t seq
Definition: cpg.h:107
Message from another node.
Definition: ipc_cpg.h:217