corosync 3.1.7
totempg.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003-2005 MontaVista Software, Inc.
3 * Copyright (c) 2006-2011 Red Hat, Inc.
4 *
5 * All rights reserved.
6 *
7 * Author: Steven Dake (sdake@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
43#ifndef TOTEMPG_H_DEFINED
44#define TOTEMPG_H_DEFINED
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50#include <sys/types.h>
51#include <netinet/in.h>
52#include "totem.h"
53#include <qb/qbloop.h>
54
56 const void *group;
57 size_t group_len;
58};
59
60#define TOTEMPG_AGREED 0
61#define TOTEMPG_SAFE 1
62
66extern int totempg_initialize (
67 qb_loop_t* poll_handle,
69);
70
71extern void totempg_finalize (void);
72
73extern int totempg_callback_token_create (void **handle_out,
75 int delete,
76 int (*callback_fn) (enum totem_callback_token_type type, const void *),
77 const void *data);
78
79extern void totempg_callback_token_destroy (void *handle);
80
85 void **instance,
86
87 void (*deliver_fn) (
88 unsigned int nodeid,
89 const void *msg,
90 unsigned int msg_len,
91 int endian_conversion_required),
92
93 void (*confchg_fn) (
94 enum totem_configuration_type configuration_type,
95 const unsigned int *member_list, size_t member_list_entries,
96 const unsigned int *left_list, size_t left_list_entries,
97 const unsigned int *joined_list, size_t joined_list_entries,
98 const struct memb_ring_id *ring_id));
99
100extern int totempg_groups_finalize (void *instance);
101
102extern int totempg_groups_join (
103 void *instance,
104 const struct totempg_group *groups,
105 size_t group_cnt);
106
107extern int totempg_groups_leave (
108 void *instance,
109 const struct totempg_group *groups,
110 size_t group_cnt);
111
113 void *instance,
114 const struct iovec *iovec,
115 unsigned int iov_len,
116 int guarantee);
117
119 void *instance,
120 const struct iovec *iovec,
121 unsigned int iov_len);
122
124 int msg_count);
125
127 void *instance,
128 int guarantee,
129 const struct totempg_group *groups,
130 size_t groups_cnt,
131 const struct iovec *iovec,
132 unsigned int iov_len);
133
135 void *instance,
136 const struct totempg_group *groups,
137 size_t groups_cnt,
138 const struct iovec *iovec,
139 unsigned int iov_len);
140
141extern int totempg_ifaces_get (
142 unsigned int nodeid,
143 unsigned int *interface_id,
144 struct totem_ip_address *interfaces,
145 unsigned int interfaces_size,
146 char ***status,
147 unsigned int *iface_count);
148
149extern int totempg_nodestatus_get (unsigned int nodeid,
150 struct totem_node_status *node_status);
151
152extern void* totempg_get_stats (void);
153
155
156extern const char *totempg_ifaces_print (unsigned int nodeid);
157
158extern unsigned int totempg_my_nodeid_get (void);
159
160extern int totempg_my_family_get (void);
161
162extern int totempg_crypto_set (const char *cipher_type, const char *hash_type);
163
165 void (*totem_service_ready) (void));
166
167extern int totempg_iface_set (
168 struct totem_ip_address *interface_addr,
169 unsigned short ip_port,
170 unsigned int iface_no);
171
172extern int totempg_member_add (
173 const struct totem_ip_address *member,
174 int ring_no);
175
176extern int totempg_member_remove (
177 const struct totem_ip_address *member,
178 int ring_no);
179
186
187void totempg_check_q_level(void *instance);
188
189typedef void (*totem_queue_level_changed_fn) (enum totem_q_level level);
191
192extern void totempg_threaded_mode_enable (void);
193
194extern void totempg_trans_ack (void);
195
196extern int totempg_reconfigure (void);
197
199
200extern void totempg_force_gather (void);
201
202extern void totempg_get_config(struct totem_config *config);
203
204extern void totempg_put_config(struct totem_config *config);
205
206#ifdef __cplusplus
207}
208#endif
209
210#endif /* TOTEMPG_H_DEFINED */
totem_configuration_type
The totem_configuration_type enum.
Definition: coroapi.h:132
unsigned int nodeid
Definition: coroapi.h:0
totem_callback_token_type
The totem_callback_token_type enum.
Definition: coroapi.h:142
uint32_t value
The memb_ring_id struct.
Definition: coroapi.h:122
The totem_ip_address struct.
Definition: coroapi.h:111
const void * group
Definition: totempg.h:56
size_t group_len
Definition: totempg.h:57
totem_event_type
Definition: totem.h:290
cfg_message_crypto_reconfig_phase_t
Definition: totem.h:154
char type
Definition: totem.h:2
int totempg_my_family_get(void)
Definition: totempg.c:1537
unsigned int totempg_my_nodeid_get(void)
Definition: totempg.c:1532
int totempg_callback_token_create(void **handle_out, enum totem_callback_token_type type, int delete, int(*callback_fn)(enum totem_callback_token_type type, const void *), const void *data)
Definition: totempg.c:1099
const char * totempg_ifaces_print(unsigned int nodeid)
Definition: totempg.c:1501
int totempg_crypto_set(const char *cipher_type, const char *hash_type)
Definition: totempg.c:1489
void totempg_get_config(struct totem_config *config)
Definition: totempg.c:1602
void(* totem_queue_level_changed_fn)(enum totem_q_level level)
Definition: totempg.h:189
void totempg_queue_level_register_callback(totem_queue_level_changed_fn)
Definition: totempg.c:1547
int totempg_iface_set(struct totem_ip_address *interface_addr, unsigned short ip_port, unsigned int iface_no)
Definition: totempg.c:1434
int totempg_nodestatus_get(unsigned int nodeid, struct totem_node_status *node_status)
Definition: totempg.c:1450
void totempg_put_config(struct totem_config *config)
Definition: totempg.c:1612
int totempg_reconfigure(void)
Definition: totempg.c:1566
void totempg_check_q_level(void *instance)
Definition: totempg.c:1294
int totempg_groups_leave(void *instance, const struct totempg_group *groups, size_t group_cnt)
Definition: totempg.c:1214
int totempg_groups_finalize(void *instance)
int totempg_crypto_reconfigure_phase(cfg_message_crypto_reconfig_phase_t phase)
Definition: totempg.c:1571
void totempg_callback_token_destroy(void *handle)
Definition: totempg.c:1118
int totempg_groups_mcast_joined(void *instance, const struct iovec *iovec, unsigned int iov_len, int guarantee)
Definition: totempg.c:1232
void totempg_trans_ack(void)
Definition: totempg.c:1591
void totempg_force_gather(void)
Definition: totempg.c:1596
int totempg_member_remove(const struct totem_ip_address *member, int ring_no)
Definition: totempg.c:1559
int totempg_initialize(qb_loop_t *poll_handle, struct totem_config *totem_config)
Initialize the totem process groups abstraction.
Definition: totempg.c:802
int totempg_groups_joined_release(int msg_count)
Definition: totempg.c:1346
void totempg_service_ready_register(void(*totem_service_ready)(void))
Definition: totempg.c:1541
int totempg_ifaces_get(unsigned int nodeid, unsigned int *interface_id, struct totem_ip_address *interfaces, unsigned int interfaces_size, char ***status, unsigned int *iface_count)
Definition: totempg.c:1457
int totempg_groups_joined_reserve(void *instance, const struct iovec *iovec, unsigned int iov_len)
Definition: totempg.c:1302
int totempg_groups_join(void *instance, const struct totempg_group *groups, size_t group_cnt)
Definition: totempg.c:1182
int totempg_groups_mcast_groups(void *instance, int guarantee, const struct totempg_group *groups, size_t groups_cnt, const struct iovec *iovec, unsigned int iov_len)
Definition: totempg.c:1360
void totempg_event_signal(enum totem_event_type type, int value)
Definition: totempg.c:1479
void totempg_finalize(void)
Definition: totempg.c:855
int totempg_groups_send_ok_groups(void *instance, const struct totempg_group *groups, size_t groups_cnt, const struct iovec *iovec, unsigned int iov_len)
Definition: totempg.c:1404
void * totempg_get_stats(void)
Definition: totempg.c:1484
totem_q_level
Definition: totempg.h:180
@ TOTEM_Q_LEVEL_GOOD
Definition: totempg.h:182
@ TOTEM_Q_LEVEL_HIGH
Definition: totempg.h:183
@ TOTEM_Q_LEVEL_LOW
Definition: totempg.h:181
@ TOTEM_Q_LEVEL_CRITICAL
Definition: totempg.h:184
int totempg_groups_initialize(void **instance, void(*deliver_fn)(unsigned int nodeid, const void *msg, unsigned int msg_len, int endian_conversion_required), void(*confchg_fn)(enum totem_configuration_type configuration_type, const unsigned int *member_list, size_t member_list_entries, const unsigned int *left_list, size_t left_list_entries, const unsigned int *joined_list, size_t joined_list_entries, const struct memb_ring_id *ring_id))
Initialize a groups instance.
Definition: totempg.c:1134
void totempg_threaded_mode_enable(void)
Definition: totempg.c:1585
int totempg_member_add(const struct totem_ip_address *member, int ring_no)
Definition: totempg.c:1552
int guarantee
Definition: totemsrp.c:6
struct memb_ring_id ring_id
Definition: totemsrp.c:4