corosync
2.3.2
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
include
corosync
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 (ccaulfi@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 COROSYNC_CPG_H_DEFINED
36
#define COROSYNC_CPG_H_DEFINED
37
38
#include <netinet/in.h>
39
#include <
corosync/corotypes.h
>
40
41
#ifdef __cplusplus
42
extern
"C"
{
43
#endif
44
50
typedef
uint64_t
cpg_handle_t
;
51
52
typedef
uint64_t
cpg_iteration_handle_t
;
53
54
typedef
enum
{
55
CPG_TYPE_UNORDERED
,
56
CPG_TYPE_FIFO
,
57
CPG_TYPE_AGREED
,
58
CPG_TYPE_SAFE
59
}
cpg_guarantee_t
;
60
61
typedef
enum
{
62
CPG_FLOW_CONTROL_DISABLED
,
63
CPG_FLOW_CONTROL_ENABLED
64
}
cpg_flow_control_state_t
;
65
66
67
typedef
enum
{
68
CPG_REASON_JOIN
= 1,
69
CPG_REASON_LEAVE
= 2,
70
CPG_REASON_NODEDOWN
= 3,
71
CPG_REASON_NODEUP
= 4,
72
CPG_REASON_PROCDOWN
= 5
73
}
cpg_reason_t
;
74
75
typedef
enum
{
76
CPG_ITERATION_NAME_ONLY
= 1,
77
CPG_ITERATION_ONE_GROUP
= 2,
78
CPG_ITERATION_ALL
= 3,
79
}
cpg_iteration_type_t
;
80
81
typedef
enum
{
82
CPG_MODEL_V1
= 1,
83
}
cpg_model_t
;
84
85
struct
cpg_address
{
86
uint32_t
nodeid
;
87
uint32_t
pid
;
88
uint32_t
reason
;
89
};
90
91
#define CPG_MAX_NAME_LENGTH 128
92
struct
cpg_name
{
93
uint32_t
length
;
94
char
value
[
CPG_MAX_NAME_LENGTH
];
95
};
96
97
#define CPG_MEMBERS_MAX 128
98
99
struct
cpg_iteration_description_t
{
100
struct
cpg_name
group
;
101
uint32_t
nodeid
;
102
uint32_t
pid
;
103
};
104
105
struct
cpg_ring_id
{
106
uint32_t
nodeid
;
107
uint64_t
seq
;
108
};
109
110
typedef
void (*
cpg_deliver_fn_t
) (
111
cpg_handle_t handle,
112
const
struct
cpg_name
*group_name,
113
uint32_t
nodeid
,
114
uint32_t pid,
119
void
*msg,
120
size_t
msg_len);
121
122
typedef
void (*
cpg_confchg_fn_t
) (
123
cpg_handle_t handle,
124
const
struct
cpg_name
*group_name,
125
const
struct
cpg_address
*member_list,
size_t
member_list_entries,
126
const
struct
cpg_address
*left_list,
size_t
left_list_entries,
127
const
struct
cpg_address
*joined_list,
size_t
joined_list_entries);
128
129
typedef
void (*
cpg_totem_confchg_fn_t
) (
130
cpg_handle_t handle,
131
struct
cpg_ring_id
ring_id
,
132
uint32_t member_list_entries,
133
const uint32_t *member_list);
134
135
typedef
struct
{
136
cpg_deliver_fn_t
cpg_deliver_fn
;
137
cpg_confchg_fn_t
cpg_confchg_fn
;
138
}
cpg_callbacks_t
;
139
140
typedef
struct
{
141
cpg_model_t
model
;
142
}
cpg_model_data_t
;
143
144
#define CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF 0x01
145
146
typedef
struct
{
147
cpg_model_t
model
;
148
cpg_deliver_fn_t
cpg_deliver_fn
;
149
cpg_confchg_fn_t
cpg_confchg_fn
;
150
cpg_totem_confchg_fn_t
cpg_totem_confchg_fn
;
151
unsigned
int
flags
;
152
}
cpg_model_v1_data_t
;
153
154
160
cs_error_t
cpg_initialize
(
161
cpg_handle_t *handle,
162
cpg_callbacks_t
*callbacks);
163
167
cs_error_t
cpg_model_initialize
(
168
cpg_handle_t *handle,
169
cpg_model_t
model,
170
cpg_model_data_t
*model_data,
171
void
*context);
172
176
cs_error_t
cpg_finalize
(
177
cpg_handle_t handle);
178
184
cs_error_t
cpg_fd_get
(
185
cpg_handle_t handle,
186
int
*fd);
187
191
cs_error_t
cpg_context_get
(
192
cpg_handle_t handle,
193
void
**context);
194
198
cs_error_t
cpg_context_set
(
199
cpg_handle_t handle,
200
void
*context);
201
202
206
cs_error_t
cpg_dispatch
(
207
cpg_handle_t handle,
208
cs_dispatch_flags_t
dispatch_types);
209
217
cs_error_t
cpg_join
(
218
cpg_handle_t handle,
219
const
struct
cpg_name
*group);
220
224
cs_error_t
cpg_leave
(
225
cpg_handle_t handle,
226
const
struct
cpg_name
*group);
227
237
cs_error_t
cpg_mcast_joined
(
238
cpg_handle_t handle,
239
cpg_guarantee_t
guarantee
,
240
const
struct
iovec *iovec,
241
unsigned
int
iov_len);
242
246
cs_error_t
cpg_membership_get
(
247
cpg_handle_t handle,
248
struct
cpg_name
*groupName,
249
struct
cpg_address
*member_list,
250
int
*member_list_entries);
251
252
cs_error_t
cpg_local_get
(
253
cpg_handle_t handle,
254
unsigned
int
*local_nodeid);
255
256
cs_error_t
cpg_flow_control_state_get
(
257
cpg_handle_t handle,
258
cpg_flow_control_state_t
*flow_control_enabled);
259
260
cs_error_t
cpg_zcb_alloc
(
261
cpg_handle_t handle,
262
size_t
size,
263
void
**buffer);
264
265
cs_error_t
cpg_zcb_free
(
266
cpg_handle_t handle,
267
void
*buffer);
268
269
cs_error_t
cpg_zcb_mcast_joined
(
270
cpg_handle_t handle,
271
cpg_guarantee_t
guarantee
,
272
void
*msg,
273
size_t
msg_len);
274
278
cs_error_t
cpg_iteration_initialize
(
279
cpg_handle_t handle,
280
cpg_iteration_type_t
iteration_type,
281
const
struct
cpg_name
*group,
282
cpg_iteration_handle_t *cpg_iteration_handle);
283
284
cs_error_t
cpg_iteration_next
(
285
cpg_iteration_handle_t handle,
286
struct
cpg_iteration_description_t
*description);
287
288
cs_error_t
cpg_iteration_finalize
(
289
cpg_iteration_handle_t handle);
290
291
#ifdef __cplusplus
292
}
293
#endif
294
295
#endif
/* COROSYNC_CPG_H_DEFINED */
Generated on Mon Feb 3 2014 11:07:20 for corosync by
1.8.3.1