totempg.h
Go to the documentation of this file.
/*
* Copyright (c) 2003-2005 MontaVista Software, Inc.
* Copyright (c) 2006-2011 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@redhat.com)
*
* This software licensed under BSD license, the text of which follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the MontaVista Software, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TOTEMPG_H_DEFINED
#define TOTEMPG_H_DEFINED
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <netinet/in.h>
#include "totem.h"
#include <qb/qbloop.h>
struct totempg_group {
const void *group;
size_t group_len;
};
#define TOTEMPG_AGREED 0
#define TOTEMPG_SAFE 1
extern int totempg_initialize (
qb_loop_t* poll_handle,
struct totem_config *totem_config
);
extern void totempg_finalize (void);
extern 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);
extern void totempg_callback_token_destroy (void *handle);
extern 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));
extern int totempg_groups_finalize (void *instance);
extern int totempg_groups_join (
void *instance,
const struct totempg_group *groups,
size_t group_cnt);
extern int totempg_groups_leave (
void *instance,
const struct totempg_group *groups,
size_t group_cnt);
extern int totempg_groups_mcast_joined (
void *instance,
const struct iovec *iovec,
unsigned int iov_len,
int guarantee);
extern int totempg_groups_joined_reserve (
void *instance,
const struct iovec *iovec,
unsigned int iov_len);
extern int totempg_groups_joined_release (
int msg_count);
extern 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);
extern 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);
extern 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);
extern int totempg_nodestatus_get (unsigned int nodeid,
struct totem_node_status *node_status);
extern void* totempg_get_stats (void);
void totempg_event_signal (enum totem_event_type type, int value);
extern const char *totempg_ifaces_print (unsigned int nodeid);
extern unsigned int totempg_my_nodeid_get (void);
extern int totempg_my_family_get (void);
extern int totempg_crypto_set (const char *cipher_type, const char *hash_type);
extern void totempg_service_ready_register (
void (*totem_service_ready) (void));
extern int totempg_iface_set (
struct totem_ip_address *interface_addr,
unsigned short ip_port,
unsigned int iface_no);
extern int totempg_member_add (
const struct totem_ip_address *member,
int ring_no);
extern int totempg_member_remove (
const struct totem_ip_address *member,
int ring_no);
enum totem_q_level {
TOTEM_Q_LEVEL_LOW,
TOTEM_Q_LEVEL_GOOD,
TOTEM_Q_LEVEL_HIGH,
TOTEM_Q_LEVEL_CRITICAL
};
void totempg_check_q_level(void *instance);
typedef void (*totem_queue_level_changed_fn) (enum totem_q_level level);
extern void totempg_queue_level_register_callback (totem_queue_level_changed_fn);
extern void totempg_threaded_mode_enable (void);
extern void totempg_trans_ack (void);
extern int totempg_reconfigure (void);
extern int totempg_crypto_reconfigure_phase (cfg_message_crypto_reconfig_phase_t phase);
extern void totempg_force_gather (void);
extern void totempg_get_config(struct totem_config *config);
extern void totempg_put_config(struct totem_config *config);
#ifdef __cplusplus
}
#endif
#endif /* TOTEMPG_H_DEFINED */
totem_configuration_type
totem_configuration_type
The totem_configuration_type enum.
Definition coroapi.h:132
nodeid
unsigned int nodeid
Definition coroapi.h:0
totem_callback_token_type
totem_callback_token_type
The totem_callback_token_type enum.
Definition coroapi.h:142
value
uint32_t value
Definition exec/votequorum.c:2
memb_ring_id
The memb_ring_id struct.
Definition coroapi.h:122
totem_config
Definition totem.h:159
totem_ip_address
The totem_ip_address struct.
Definition coroapi.h:111
totem_node_status
Definition totem.h:265
totempg_group
Definition totempg.h:55
totempg_group::group
const void * group
Definition totempg.h:56
totempg_group::group_len
size_t group_len
Definition totempg.h:57
totem.h
totem_event_type
totem_event_type
Definition totem.h:290
cfg_message_crypto_reconfig_phase_t
cfg_message_crypto_reconfig_phase_t
Definition totem.h:154
type
char type
Definition totem.h:2
totempg_my_family_get
int totempg_my_family_get(void)
Definition totempg.c:1537
totempg_my_nodeid_get
unsigned int totempg_my_nodeid_get(void)
Definition totempg.c:1532
totempg_callback_token_create
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
totempg_ifaces_print
const char * totempg_ifaces_print(unsigned int nodeid)
Definition totempg.c:1501
totempg_crypto_set
int totempg_crypto_set(const char *cipher_type, const char *hash_type)
Definition totempg.c:1489
totempg_get_config
void totempg_get_config(struct totem_config *config)
Definition totempg.c:1602
totem_queue_level_changed_fn
void(* totem_queue_level_changed_fn)(enum totem_q_level level)
Definition totempg.h:189
totempg_queue_level_register_callback
void totempg_queue_level_register_callback(totem_queue_level_changed_fn)
Definition totempg.c:1547
totempg_iface_set
int totempg_iface_set(struct totem_ip_address *interface_addr, unsigned short ip_port, unsigned int iface_no)
Definition totempg.c:1434
totempg_nodestatus_get
int totempg_nodestatus_get(unsigned int nodeid, struct totem_node_status *node_status)
Definition totempg.c:1450
totempg_put_config
void totempg_put_config(struct totem_config *config)
Definition totempg.c:1612
totempg_reconfigure
int totempg_reconfigure(void)
Definition totempg.c:1566
totempg_check_q_level
void totempg_check_q_level(void *instance)
Definition totempg.c:1294
totempg_groups_leave
int totempg_groups_leave(void *instance, const struct totempg_group *groups, size_t group_cnt)
Definition totempg.c:1214
totempg_groups_finalize
int totempg_groups_finalize(void *instance)
totempg_crypto_reconfigure_phase
int totempg_crypto_reconfigure_phase(cfg_message_crypto_reconfig_phase_t phase)
Definition totempg.c:1571
totempg_callback_token_destroy
void totempg_callback_token_destroy(void *handle)
Definition totempg.c:1118
totempg_groups_mcast_joined
int totempg_groups_mcast_joined(void *instance, const struct iovec *iovec, unsigned int iov_len, int guarantee)
Definition totempg.c:1232
totempg_trans_ack
void totempg_trans_ack(void)
Definition totempg.c:1591
totempg_force_gather
void totempg_force_gather(void)
Definition totempg.c:1596
totempg_member_remove
int totempg_member_remove(const struct totem_ip_address *member, int ring_no)
Definition totempg.c:1559
totempg_initialize
int totempg_initialize(qb_loop_t *poll_handle, struct totem_config *totem_config)
Initialize the totem process groups abstraction.
Definition totempg.c:802
totempg_groups_joined_release
int totempg_groups_joined_release(int msg_count)
Definition totempg.c:1346
totempg_service_ready_register
void totempg_service_ready_register(void(*totem_service_ready)(void))
Definition totempg.c:1541
totempg_ifaces_get
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
totempg_groups_joined_reserve
int totempg_groups_joined_reserve(void *instance, const struct iovec *iovec, unsigned int iov_len)
Definition totempg.c:1302
totempg_groups_join
int totempg_groups_join(void *instance, const struct totempg_group *groups, size_t group_cnt)
Definition totempg.c:1182
totempg_groups_mcast_groups
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
totempg_event_signal
void totempg_event_signal(enum totem_event_type type, int value)
Definition totempg.c:1479
totempg_finalize
void totempg_finalize(void)
Definition totempg.c:855
totempg_groups_send_ok_groups
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
totempg_get_stats
void * totempg_get_stats(void)
Definition totempg.c:1484
totem_q_level
totem_q_level
Definition totempg.h:180
TOTEM_Q_LEVEL_GOOD
@ TOTEM_Q_LEVEL_GOOD
Definition totempg.h:182
TOTEM_Q_LEVEL_HIGH
@ TOTEM_Q_LEVEL_HIGH
Definition totempg.h:183
TOTEM_Q_LEVEL_LOW
@ TOTEM_Q_LEVEL_LOW
Definition totempg.h:181
TOTEM_Q_LEVEL_CRITICAL
@ TOTEM_Q_LEVEL_CRITICAL
Definition totempg.h:184
totempg_groups_initialize
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
totempg_threaded_mode_enable
void totempg_threaded_mode_enable(void)
Definition totempg.c:1585
totempg_member_add
int totempg_member_add(const struct totem_ip_address *member, int ring_no)
Definition totempg.c:1552
guarantee
int guarantee
Definition totemsrp.c:6
ring_id
struct memb_ring_id ring_id
Definition totemsrp.c:4