corosync
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
61
86
97
106
114
119static inline void swab_mar_cpg_name_t (mar_cpg_name_t *to_swab)
120{
121 swab_mar_uint32_t (&to_swab->length);
122}
123
129static inline void marshall_from_mar_cpg_name_t (
130 struct cpg_name *dest,
131 const mar_cpg_name_t *src)
132{
133 dest->length = src->length;
134 memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
135}
136
142static inline void marshall_to_mar_cpg_name_t (
144 const struct cpg_name *src)
145{
146 dest->length = src->length;
147 memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
148}
149
158
164static inline void marshall_from_mar_cpg_address_t (
165 struct cpg_address *dest,
166 const mar_cpg_address_t *src)
167{
168 dest->nodeid = src->nodeid;
169 dest->pid = src->pid;
170 dest->reason = src->reason;
171}
172
178static inline void marshall_to_mar_cpg_address_t (
180 const struct cpg_address *src)
181{
182 dest->nodeid = src->nodeid;
183 dest->pid = src->pid;
184 dest->reason = src->reason;
185}
186
193static inline int mar_name_compare (
194 const mar_cpg_name_t *g1,
195 const mar_cpg_name_t *g2)
196{
197 return (g1->length == g2->length?
198 memcmp (g1->value, g2->value, g1->length):
199 g1->length - g2->length);
200}
201
210
216static inline void marshall_from_mar_cpg_iteration_description_t(
219{
220 dest->nodeid = src->nodeid;
221 dest->pid = src->pid;
222 marshall_from_mar_cpg_name_t (&dest->group, &src->group);
223};
224
232
238static inline void marshall_from_mar_cpg_ring_id_t (
239 struct cpg_ring_id *dest,
240 const mar_cpg_ring_id_t *src)
241{
242 dest->nodeid = src->nodeid;
243 dest->seq = src->seq;
244}
245
255
262
269
276
283
290
298
305
315
327
334
346
360
368
376
385
399
409
418
425
434
442
450
458
466
473#endif /* IPC_CPG_H_DEFINED */
unsigned long long seq
Definition coroapi.h:1
unsigned int nodeid
the ID of the node whose info needs updating
Definition coroapi.h:0
#define PROCESSOR_COUNT_MAX
Definition coroapi.h:96
uint32_t flags
uint32_t value
#define CPG_MAX_NAME_LENGTH
Definition cpg.h:117
qb_handle_t hdb_handle_t
Definition hdb.h:52
lib_cpg_partial_types
The lib_cpg_partial_types enum.
Definition ipc_cpg.h:101
@ LIBCPG_PARTIAL_FIRST
Definition ipc_cpg.h:102
@ LIBCPG_PARTIAL_LAST
Definition ipc_cpg.h:104
@ LIBCPG_PARTIAL_CONTINUED
Definition ipc_cpg.h:103
req_cpg_types
The req_cpg_types enum.
Definition ipc_cpg.h:46
@ MESSAGE_REQ_CPG_LOCAL_GET
Definition ipc_cpg.h:51
@ MESSAGE_REQ_CPG_PAD1
Definition ipc_cpg.h:57
@ MESSAGE_REQ_CPG_NULL
Definition ipc_cpg.h:56
@ MESSAGE_REQ_CPG_ITERATIONFINALIZE
Definition ipc_cpg.h:54
@ MESSAGE_REQ_CPG_PARTIAL_MCAST
Definition ipc_cpg.h:59
@ MESSAGE_REQ_CPG_JOIN
Definition ipc_cpg.h:47
@ MESSAGE_REQ_CPG_ITERATIONINITIALIZE
Definition ipc_cpg.h:52
@ MESSAGE_REQ_CPG_FINALIZE
Definition ipc_cpg.h:55
@ MESSAGE_REQ_CPG_MEMBERSHIP
Definition ipc_cpg.h:50
@ MESSAGE_REQ_CPG_PAD2
Definition ipc_cpg.h:58
@ MESSAGE_REQ_CPG_LEAVE
Definition ipc_cpg.h:48
@ MESSAGE_REQ_CPG_ITERATIONNEXT
Definition ipc_cpg.h:53
@ MESSAGE_REQ_CPG_MCAST
Definition ipc_cpg.h:49
res_cpg_types
The res_cpg_types enum.
Definition ipc_cpg.h:65
@ MESSAGE_RES_CPG_NULL
Definition ipc_cpg.h:80
@ MESSAGE_RES_CPG_ITERATIONFINALIZE
Definition ipc_cpg.h:77
@ MESSAGE_RES_CPG_MEMBERSHIP
Definition ipc_cpg.h:69
@ MESSAGE_RES_CPG_PAD2
Definition ipc_cpg.h:82
@ MESSAGE_RES_CPG_LEAVE
Definition ipc_cpg.h:67
@ MESSAGE_RES_CPG_MCAST
Definition ipc_cpg.h:68
@ MESSAGE_RES_CPG_PARTIAL_DELIVER_CALLBACK
Definition ipc_cpg.h:83
@ MESSAGE_RES_CPG_FINALIZE
Definition ipc_cpg.h:78
@ MESSAGE_RES_CPG_DELIVER_CALLBACK
Definition ipc_cpg.h:71
@ MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK
Definition ipc_cpg.h:79
@ MESSAGE_RES_CPG_ITERATIONNEXT
Definition ipc_cpg.h:76
@ MESSAGE_RES_CPG_CONFCHG_CALLBACK
Definition ipc_cpg.h:70
@ MESSAGE_RES_CPG_PAD1
Definition ipc_cpg.h:81
@ MESSAGE_RES_CPG_FLOWCONTROL_CALLBACK
Definition ipc_cpg.h:74
@ MESSAGE_RES_CPG_PARTIAL_SEND
Definition ipc_cpg.h:84
@ MESSAGE_RES_CPG_ITERATIONINITIALIZE
Definition ipc_cpg.h:75
@ MESSAGE_RES_CPG_LOCAL_GET
Definition ipc_cpg.h:73
@ MESSAGE_RES_CPG_JOIN
Definition ipc_cpg.h:66
@ MESSAGE_RES_CPG_FLOW_CONTROL_STATE_SET
Definition ipc_cpg.h:72
lib_cpg_confchg_reason
The lib_cpg_confchg_reason enum.
Definition ipc_cpg.h:90
@ CONFCHG_CPG_REASON_LEAVE
Definition ipc_cpg.h:92
@ CONFCHG_CPG_REASON_PROCDOWN
Definition ipc_cpg.h:95
@ CONFCHG_CPG_REASON_NODEUP
Definition ipc_cpg.h:94
@ CONFCHG_CPG_REASON_JOIN
Definition ipc_cpg.h:91
@ CONFCHG_CPG_REASON_NODEDOWN
Definition ipc_cpg.h:93
uint32_t mar_uint32_t
Definition mar_gen.h:53
uint8_t mar_uint8_t
Definition mar_gen.h:51
uint64_t mar_uint64_t
Definition mar_gen.h:54
The cpg_address struct.
Definition cpg.h:111
The cpg_iteration_description_t struct.
Definition cpg.h:131
The cpg_name struct.
Definition cpg.h:121
The cpg_ring_id struct.
Definition cpg.h:140
mar_cpg_address_t struct
Definition ipc_cpg.h:153
mar_uint32_t nodeid __attribute__((aligned(8)))
mar_uint32_t pid __attribute__((aligned(8)))
mar_uint32_t reason __attribute__((aligned(8)))
mar_cpg_iteration_description_t struct
Definition ipc_cpg.h:205
mar_cpg_name_t struct
Definition ipc_cpg.h:110
char value[CPG_MAX_NAME_LENGTH] __attribute__((aligned(8)))
uint32_t length __attribute__((aligned(8)))
mar_cpg_ring_id_t struct
Definition ipc_cpg.h:228
mar_uint64_t seq __attribute__((aligned(8)))
mar_uint32_t nodeid __attribute__((aligned(8)))
The req_lib_cpg_finalize struct.
Definition ipc_cpg.h:266
The req_lib_cpg_iterationfinalize struct.
Definition ipc_cpg.h:462
hdb_handle_t iteration_handle __attribute__((aligned(8)))
The req_lib_cpg_iterationinitialize struct.
Definition ipc_cpg.h:429
mar_cpg_name_t group_name __attribute__((aligned(8)))
mar_uint32_t iteration_type __attribute__((aligned(8)))
The req_lib_cpg_iterationnext struct.
Definition ipc_cpg.h:446
hdb_handle_t iteration_handle __attribute__((aligned(8)))
The req_lib_cpg_join struct.
Definition ipc_cpg.h:249
mar_cpg_name_t group_name __attribute__((aligned(8)))
mar_uint32_t pid __attribute__((aligned(8)))
mar_uint32_t flags __attribute__((aligned(8)))
The req_lib_cpg_leave struct.
Definition ipc_cpg.h:413
mar_uint32_t pid __attribute__((aligned(8)))
mar_cpg_name_t group_name __attribute__((aligned(8)))
The req_lib_cpg_local_get struct.
Definition ipc_cpg.h:280
The req_lib_cpg_mcast struct.
Definition ipc_cpg.h:309
mar_uint32_t guarantee __attribute__((aligned(8)))
mar_uint32_t msglen __attribute__((aligned(8)))
mar_uint8_t message[] __attribute__((aligned(8)))
The req_lib_cpg_membership_get struct.
Definition ipc_cpg.h:372
mar_cpg_name_t group_name __attribute__((aligned(8)))
The req_lib_cpg_partial_mcast struct.
Definition ipc_cpg.h:319
mar_uint32_t msglen __attribute__((aligned(8)))
mar_uint32_t guarantee __attribute__((aligned(8)))
mar_uint8_t message[] __attribute__((aligned(8)))
mar_uint32_t type __attribute__((aligned(8)))
mar_uint32_t fraglen __attribute__((aligned(8)))
The res_lib_cpg_confchg_callback struct.
Definition ipc_cpg.h:389
mar_cpg_address_t member_list[]
Definition ipc_cpg.h:395
mar_cpg_name_t group_name __attribute__((aligned(8)))
mar_uint32_t member_list_entries __attribute__((aligned(8)))
mar_uint32_t left_list_entries __attribute__((aligned(8)))
mar_uint32_t joined_list_entries __attribute__((aligned(8)))
Message from another node.
Definition ipc_cpg.h:338
mar_uint32_t nodeid __attribute__((aligned(8)))
mar_cpg_name_t group_name __attribute__((aligned(8)))
mar_uint32_t msglen __attribute__((aligned(8)))
mar_uint32_t pid __attribute__((aligned(8)))
mar_uint8_t message[] __attribute__((aligned(8)))
The res_lib_cpg_finalize struct.
Definition ipc_cpg.h:273
The res_lib_cpg_flowcontrol_callback struct.
Definition ipc_cpg.h:364
mar_uint32_t flow_control_state __attribute__((aligned(8)))
The res_lib_cpg_iterationfinalize struct.
Definition ipc_cpg.h:470
The res_lib_cpg_iterationinitialize struct.
Definition ipc_cpg.h:438
hdb_handle_t iteration_handle __attribute__((aligned(8)))
The res_lib_cpg_iterationnext struct.
Definition ipc_cpg.h:454
mar_cpg_iteration_description_t description __attribute__((aligned(8)))
The res_lib_cpg_join struct.
Definition ipc_cpg.h:259
The res_lib_cpg_leave struct.
Definition ipc_cpg.h:422
The res_lib_cpg_local_get struct.
Definition ipc_cpg.h:294
mar_uint32_t local_nodeid __attribute__((aligned(8)))
The res_lib_cpg_mcast struct.
Definition ipc_cpg.h:331
The res_lib_cpg_membership_get struct.
Definition ipc_cpg.h:380
mar_uint32_t member_count __attribute__((aligned(8)))
mar_cpg_address_t member_list[PROCESSOR_COUNT_MAX]
Definition ipc_cpg.h:383
The res_lib_cpg_null struct.
Definition ipc_cpg.h:287
The res_lib_cpg_partial_deliver_callback struct.
Definition ipc_cpg.h:350
mar_uint32_t pid __attribute__((aligned(8)))
mar_uint32_t nodeid __attribute__((aligned(8)))
mar_uint32_t fraglen __attribute__((aligned(8)))
mar_uint32_t type __attribute__((aligned(8)))
mar_cpg_name_t group_name __attribute__((aligned(8)))
mar_uint32_t msglen __attribute__((aligned(8)))
mar_uint8_t message[] __attribute__((aligned(8)))
The res_lib_cpg_partial_send struct.
Definition ipc_cpg.h:302
The res_lib_cpg_totem_confchg_callback struct.
Definition ipc_cpg.h:403
mar_cpg_ring_id_t ring_id __attribute__((aligned(8)))
mar_uint32_t member_list_entries __attribute__((aligned(8)))
typedef __attribute__
char type
Definition totem.h:2
int guarantee
Definition totemsrp.c:6
struct memb_ring_id ring_id
Definition totemsrp.c:4
struct totem_message_header header
Definition totemsrp.c:0