corosync 3.1.7
Data Structures | Macros | Enumerations | Functions | Variables
totempg.c File Reference
#include <config.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/uio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#include <errno.h>
#include <limits.h>
#include <corosync/swab.h>
#include <qb/qblist.h>
#include <qb/qbloop.h>
#include <qb/qbipcs.h>
#include <corosync/totem/totempg.h>
#include <corosync/logsys.h>
#include "util.h"
#include "totemsrp.h"
Include dependency graph for totempg.c:

Go to the source code of this file.

Data Structures

struct  totempg_mcast_header
 
struct  totempg_mcast
 
struct  assembly
 
struct  totempg_group_instance
 

Macros

#define LOGSYS_UTILS_ONLY   1
 
#define TOTEMPG_NEED_ALIGN   1
 
#define TOTEMPG_PACKET_SIZE
 
#define log_printf(level, format, args...)
 
#define MESSAGE_QUEUE_MAX   ((4 * MESSAGE_SIZE_MAX) / totempg_totem_config->net_mtu)
 
#define MAX_IOVECS_FROM_APP   32
 
#define MAX_GROUPS_PER_MSG   32
 
#define ONE_IFACE_LEN   63
 

Enumerations

enum  throw_away_mode { THROW_AWAY_INACTIVE , THROW_AWAY_ACTIVE }
 

Functions

 QB_LIST_DECLARE (assembly_list_inuse)
 
 QB_LIST_DECLARE (assembly_list_free)
 
 QB_LIST_DECLARE (assembly_list_inuse_trans)
 
 QB_LIST_DECLARE (totempg_groups_list)
 
int totempg_initialize (qb_loop_t *poll_handle, struct totem_config *totem_config)
 Initialize the totem process groups abstraction. More...
 
void totempg_finalize (void)
 
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)
 
void totempg_callback_token_destroy (void *handle_out)
 
int totempg_groups_initialize (void **totempg_groups_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. More...
 
int totempg_groups_join (void *totempg_groups_instance, const struct totempg_group *groups, size_t group_cnt)
 
int totempg_groups_leave (void *totempg_groups_instance, const struct totempg_group *groups, size_t group_cnt)
 
int totempg_groups_mcast_joined (void *totempg_groups_instance, const struct iovec *iovec, unsigned int iov_len, int guarantee)
 
void totempg_check_q_level (void *totempg_groups_instance)
 
int totempg_groups_joined_reserve (void *totempg_groups_instance, const struct iovec *iovec, unsigned int iov_len)
 
int totempg_groups_joined_release (int msg_count)
 
int totempg_groups_mcast_groups (void *totempg_groups_instance, int guarantee, const struct totempg_group *groups, size_t groups_cnt, const struct iovec *iovec, unsigned int iov_len)
 
int totempg_groups_send_ok_groups (void *totempg_groups_instance, const struct totempg_group *groups, size_t groups_cnt, const struct iovec *iovec, unsigned int iov_len)
 
int totempg_iface_set (struct totem_ip_address *interface_addr, unsigned short ip_port, unsigned int iface_no)
 
int totempg_nodestatus_get (unsigned int nodeid, struct totem_node_status *node_status)
 
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)
 
void totempg_event_signal (enum totem_event_type type, int value)
 
void * totempg_get_stats (void)
 
int totempg_crypto_set (const char *cipher_type, const char *hash_type)
 
const char * totempg_ifaces_print (unsigned int nodeid)
 
unsigned int totempg_my_nodeid_get (void)
 
int totempg_my_family_get (void)
 
void totempg_service_ready_register (void(*totem_service_ready)(void))
 
void totempg_queue_level_register_callback (totem_queue_level_changed_fn fn)
 
int totempg_member_add (const struct totem_ip_address *member, int ring_no)
 
int totempg_member_remove (const struct totem_ip_address *member, int ring_no)
 
int totempg_reconfigure (void)
 
int totempg_crypto_reconfigure_phase (cfg_message_crypto_reconfig_phase_t phase)
 
void totempg_stats_clear (int flags)
 
void totempg_threaded_mode_enable (void)
 
void totempg_trans_ack (void)
 
void totempg_force_gather (void)
 
void totempg_get_config (struct totem_config *config)
 
void totempg_put_config (struct totem_config *config)
 

Variables

static void(*) struct totem_config totempg_totem_config )
 
void * callback_token_received_handle
 

Macro Definition Documentation

◆ log_printf

#define log_printf (   level,
  format,
  args... 
)
Value:
do { \
totempg_log_printf(level, \
totempg_subsys_id, \
__FUNCTION__, __FILE__, __LINE__, \
format, ##args); \
} while (0);

Definition at line 272 of file totempg.c.

◆ LOGSYS_UTILS_ONLY

#define LOGSYS_UTILS_ONLY   1

Definition at line 108 of file totempg.c.

◆ MAX_GROUPS_PER_MSG

#define MAX_GROUPS_PER_MSG   32

Definition at line 1230 of file totempg.c.

◆ MAX_IOVECS_FROM_APP

#define MAX_IOVECS_FROM_APP   32

Definition at line 1229 of file totempg.c.

◆ MESSAGE_QUEUE_MAX

#define MESSAGE_QUEUE_MAX   ((4 * MESSAGE_SIZE_MAX) / totempg_totem_config->net_mtu)

Definition at line 1091 of file totempg.c.

◆ ONE_IFACE_LEN

#define ONE_IFACE_LEN   63

Definition at line 1500 of file totempg.c.

◆ TOTEMPG_NEED_ALIGN

#define TOTEMPG_NEED_ALIGN   1

Definition at line 123 of file totempg.c.

◆ TOTEMPG_PACKET_SIZE

#define TOTEMPG_PACKET_SIZE
Value:
sizeof (struct totempg_mcast))
unsigned int net_mtu
Definition: totem.h:210
static void(*) struct totem_config totempg_totem_config)
Definition: totempg.c:190

Definition at line 153 of file totempg.c.

Enumeration Type Documentation

◆ throw_away_mode

Enumerator
THROW_AWAY_INACTIVE 
THROW_AWAY_ACTIVE 

Definition at line 194 of file totempg.c.

Function Documentation

◆ QB_LIST_DECLARE() [1/4]

QB_LIST_DECLARE ( assembly_list_free  )

◆ QB_LIST_DECLARE() [2/4]

QB_LIST_DECLARE ( assembly_list_inuse  )

◆ QB_LIST_DECLARE() [3/4]

QB_LIST_DECLARE ( assembly_list_inuse_trans  )

◆ QB_LIST_DECLARE() [4/4]

QB_LIST_DECLARE ( totempg_groups_list  )

◆ totempg_callback_token_create()

int totempg_callback_token_create ( void **  handle_out,
enum totem_callback_token_type  type,
int  delete,
int(*)(enum totem_callback_token_type type, const void *)  callback_fn,
const void *  data 
)

Definition at line 1099 of file totempg.c.

◆ totempg_callback_token_destroy()

void totempg_callback_token_destroy ( void *  handle_out)

Definition at line 1118 of file totempg.c.

◆ totempg_check_q_level()

void totempg_check_q_level ( void *  totempg_groups_instance)

Definition at line 1294 of file totempg.c.

Referenced by corosync_recheck_the_q_level().

◆ totempg_crypto_reconfigure_phase()

int totempg_crypto_reconfigure_phase ( cfg_message_crypto_reconfig_phase_t  phase)

Definition at line 1571 of file totempg.c.

References totemsrp_crypto_reconfigure_phase().

◆ totempg_crypto_set()

int totempg_crypto_set ( const char *  cipher_type,
const char *  hash_type 
)

Definition at line 1489 of file totempg.c.

References totemsrp_crypto_set().

◆ totempg_event_signal()

void totempg_event_signal ( enum totem_event_type  type,
int  value 
)

Definition at line 1479 of file totempg.c.

References totemsrp_event_signal().

◆ totempg_finalize()

void totempg_finalize ( void  )

Definition at line 855 of file totempg.c.

◆ totempg_force_gather()

void totempg_force_gather ( void  )

Definition at line 1596 of file totempg.c.

References totemsrp_force_gather().

◆ totempg_get_config()

void totempg_get_config ( struct totem_config config)

◆ totempg_get_stats()

void * totempg_get_stats ( void  )

Definition at line 1484 of file totempg.c.

◆ totempg_groups_initialize()

int totempg_groups_initialize ( void **  totempg_groups_instance,
void(*)(unsigned int nodeid, const void *msg, unsigned int msg_len, int endian_conversion_required)  deliver_fn,
void(*)(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 confchg_fn 
)

Initialize a groups instance.

Definition at line 1134 of file totempg.c.

Referenced by sync_init().

◆ totempg_groups_join()

int totempg_groups_join ( void *  totempg_groups_instance,
const struct totempg_group groups,
size_t  group_cnt 
)

Definition at line 1182 of file totempg.c.

◆ totempg_groups_joined_release()

int totempg_groups_joined_release ( int  msg_count)

Definition at line 1346 of file totempg.c.

Referenced by corosync_sending_allowed_release().

◆ totempg_groups_joined_reserve()

int totempg_groups_joined_reserve ( void *  totempg_groups_instance,
const struct iovec *  iovec,
unsigned int  iov_len 
)

Definition at line 1302 of file totempg.c.

Referenced by corosync_sending_allowed().

◆ totempg_groups_leave()

int totempg_groups_leave ( void *  totempg_groups_instance,
const struct totempg_group groups,
size_t  group_cnt 
)

Definition at line 1214 of file totempg.c.

◆ totempg_groups_mcast_groups()

int totempg_groups_mcast_groups ( void *  totempg_groups_instance,
int  guarantee,
const struct totempg_group groups,
size_t  groups_cnt,
const struct iovec *  iovec,
unsigned int  iov_len 
)

Definition at line 1360 of file totempg.c.

References MAX_GROUPS_PER_MSG, and MAX_IOVECS_FROM_APP.

◆ totempg_groups_mcast_joined()

int totempg_groups_mcast_joined ( void *  totempg_groups_instance,
const struct iovec *  iovec,
unsigned int  iov_len,
int  guarantee 
)

Definition at line 1232 of file totempg.c.

References MAX_GROUPS_PER_MSG, and MAX_IOVECS_FROM_APP.

Referenced by main_mcast().

◆ totempg_groups_send_ok_groups()

int totempg_groups_send_ok_groups ( void *  totempg_groups_instance,
const struct totempg_group groups,
size_t  groups_cnt,
const struct iovec *  iovec,
unsigned int  iov_len 
)

Definition at line 1404 of file totempg.c.

◆ totempg_iface_set()

int totempg_iface_set ( struct totem_ip_address interface_addr,
unsigned short  ip_port,
unsigned int  iface_no 
)

Definition at line 1434 of file totempg.c.

References totemsrp_iface_set().

◆ 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 at line 1457 of file totempg.c.

References totemsrp_ifaces_get().

Referenced by totempg_ifaces_print().

◆ totempg_ifaces_print()

const char * totempg_ifaces_print ( unsigned int  nodeid)

Definition at line 1501 of file totempg.c.

References family, INTERFACE_MAX, nodeid, ONE_IFACE_LEN, totemip_print(), and totempg_ifaces_get().

◆ totempg_initialize()

int totempg_initialize ( qb_loop_t *  poll_handle,
struct totem_config totem_config 
)

Initialize the totem process groups abstraction.

Definition at line 802 of file totempg.c.

References totempg_totem_config.

◆ totempg_member_add()

int totempg_member_add ( const struct totem_ip_address member,
int  ring_no 
)

Definition at line 1552 of file totempg.c.

References totemsrp_member_add().

◆ totempg_member_remove()

int totempg_member_remove ( const struct totem_ip_address member,
int  ring_no 
)

Definition at line 1559 of file totempg.c.

References totemsrp_member_remove().

◆ totempg_my_family_get()

int totempg_my_family_get ( void  )

Definition at line 1537 of file totempg.c.

References totemsrp_my_family_get().

◆ totempg_my_nodeid_get()

unsigned int totempg_my_nodeid_get ( void  )

Definition at line 1532 of file totempg.c.

References totemsrp_my_nodeid_get().

Referenced by message_source_is_local(), and message_source_set().

◆ totempg_nodestatus_get()

int totempg_nodestatus_get ( unsigned int  nodeid,
struct totem_node_status node_status 
)

Definition at line 1450 of file totempg.c.

References totemsrp_nodestatus_get().

◆ totempg_put_config()

void totempg_put_config ( struct totem_config config)

Definition at line 1612 of file totempg.c.

References INTERFACE_MAX, totem_config::interfaces, and totempg_totem_config.

◆ totempg_queue_level_register_callback()

void totempg_queue_level_register_callback ( totem_queue_level_changed_fn  fn)

Definition at line 1547 of file totempg.c.

◆ totempg_reconfigure()

int totempg_reconfigure ( void  )

Definition at line 1566 of file totempg.c.

References totemsrp_reconfigure().

◆ totempg_service_ready_register()

void totempg_service_ready_register ( void(*)(void)  totem_service_ready)

Definition at line 1541 of file totempg.c.

References totemsrp_service_ready_register().

◆ totempg_stats_clear()

void totempg_stats_clear ( int  flags)

Definition at line 1576 of file totempg.c.

References flags, and TOTEMPG_STATS_CLEAR_TOTEM.

Referenced by stats_map_set().

◆ totempg_threaded_mode_enable()

void totempg_threaded_mode_enable ( void  )

Definition at line 1585 of file totempg.c.

◆ totempg_trans_ack()

void totempg_trans_ack ( void  )

Definition at line 1591 of file totempg.c.

References totemsrp_trans_ack().

Variable Documentation

◆ callback_token_received_handle

void* callback_token_received_handle

Definition at line 746 of file totempg.c.

◆ totempg_totem_config

void(*) struct totem_config totempg_totem_config)

Definition at line 190 of file totempg.c.

Referenced by totempg_get_config(), totempg_initialize(), and totempg_put_config().