corosync  2.4.2
Data Structures | Macros | Functions | Variables
totemrrp.c File Reference
#include <config.h>
#include <assert.h>
#include <pthread.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sched.h>
#include <time.h>
#include <sys/time.h>
#include <sys/poll.h>
#include <limits.h>
#include <corosync/sq.h>
#include <corosync/list.h>
#include <corosync/swab.h>
#include <qb/qbdefs.h>
#include <qb/qbloop.h>
#include <corosync/logsys.h>
#include "totemnet.h"
#include "totemrrp.h"
Include dependency graph for totemrrp.c:

Go to the source code of this file.

Data Structures

struct  passive_instance
 
struct  active_instance
 
struct  rrp_algo
 
struct  totemrrp_instance
 
struct  message_header
 
struct  deliver_fn_context
 

Macros

#define LOGSYS_UTILS_ONLY   1
 
#define STATUS_STR_LEN   512
 
#define MESSAGE_TYPE_RING_TEST_ACTIVE   6
 
#define MESSAGE_TYPE_RING_TEST_ACTIVATE   7
 
#define ENDIAN_LOCAL   0xff22
 
#define ARR_SEQNO_START_TOKEN   0x0
 
#define PASSIVE_RECV_COUNT_THRESHOLD   (INT_MAX / 2)
 
#define RRP_ALGOS_COUNT   3
 
#define log_printf(level, format, args...)
 

Functions

void rrp_deliver_fn (void *context, const void *msg, unsigned int msg_len)
 
void rrp_iface_change_fn (void *context, const struct totem_ip_address *iface_addr)
 
struct message_header __attribute__ ((packed))
 
int totemrrp_finalize (void *rrp_context)
 
int totemrrp_initialize (qb_loop_t *poll_handle, void **rrp_context, struct totem_config *totem_config, totemsrp_stats_t *stats, void *context, void(*deliver_fn)(void *context, const void *msg, unsigned int msg_len), void(*iface_change_fn)(void *context, const struct totem_ip_address *iface_addr, unsigned int iface_no), void(*token_seqid_get)(const void *msg, unsigned int *seqid, unsigned int *token_is), unsigned int(*msgs_missing)(void), void(*target_set_completed)(void *context))
 Create an instance. More...
 
void * totemrrp_buffer_alloc (void *rrp_context)
 
void totemrrp_buffer_release (void *rrp_context, void *ptr)
 
int totemrrp_processor_count_set (void *rrp_context, unsigned int processor_count)
 
int totemrrp_token_target_set (void *rrp_context, struct totem_ip_address *addr, unsigned int iface_no)
 
int totemrrp_recv_flush (void *rrp_context)
 
int totemrrp_send_flush (void *rrp_context)
 
int totemrrp_token_send (void *rrp_context, const void *msg, unsigned int msg_len)
 
int totemrrp_mcast_flush_send (void *rrp_context, const void *msg, unsigned int msg_len)
 
int totemrrp_mcast_noflush_send (void *rrp_context, const void *msg, unsigned int msg_len)
 
int totemrrp_iface_check (void *rrp_context)
 
int totemrrp_ifaces_get (void *rrp_context, char ***status, unsigned int *iface_count)
 
int totemrrp_crypto_set (void *rrp_context, const char *cipher_type, const char *hash_type)
 
int totemrrp_ring_reenable (void *rrp_context, unsigned int iface_no)
 
int totemrrp_mcast_recv_empty (void *rrp_context)
 
int totemrrp_member_add (void *rrp_context, const struct totem_ip_address *member, int iface_no)
 
int totemrrp_member_remove (void *rrp_context, const struct totem_ip_address *member, int iface_no)
 
void totemrrp_membership_changed (void *rrp_context, enum totem_configuration_type configuration_type, const struct srp_addr *member_list, size_t member_list_entries, const struct srp_addr *left_list, size_t left_list_entries, const struct srp_addr *joined_list, size_t joined_list_entries, const struct memb_ring_id *ring_id)
 

Variables

char type
 
char encapsulated
 
unsigned short endian_detector
 
int ring_number
 
int nodeid_activator
 
struct deliver_fn_context __attribute__
 
struct rrp_algo none_algo
 
struct rrp_algo passive_algo
 
struct rrp_algo active_algo
 
struct rrp_algorrp_algos []
 

Macro Definition Documentation

◆ ARR_SEQNO_START_TOKEN

#define ARR_SEQNO_START_TOKEN   0x0

Definition at line 537 of file totemrrp.c.

◆ ENDIAN_LOCAL

#define ENDIAN_LOCAL   0xff22

Definition at line 526 of file totemrrp.c.

Referenced by rrp_deliver_fn().

◆ log_printf

#define log_printf (   level,
  format,
  args... 
)
Value:
do { \
rrp_instance->totemrrp_log_printf ( \
level, rrp_instance->totemrrp_subsys_id, \
__FUNCTION__, __FILE__, __LINE__, \
format, ##args); \
} while (0);

Definition at line 634 of file totemrrp.c.

Referenced by rrp_deliver_fn().

◆ LOGSYS_UTILS_ONLY

#define LOGSYS_UTILS_ONLY   1

Definition at line 66 of file totemrrp.c.

◆ MESSAGE_TYPE_RING_TEST_ACTIVATE

#define MESSAGE_TYPE_RING_TEST_ACTIVATE   7

Definition at line 524 of file totemrrp.c.

◆ MESSAGE_TYPE_RING_TEST_ACTIVE

#define MESSAGE_TYPE_RING_TEST_ACTIVE   6

Definition at line 523 of file totemrrp.c.

Referenced by rrp_deliver_fn().

◆ PASSIVE_RECV_COUNT_THRESHOLD

#define PASSIVE_RECV_COUNT_THRESHOLD   (INT_MAX / 2)

Definition at line 550 of file totemrrp.c.

◆ RRP_ALGOS_COUNT

#define RRP_ALGOS_COUNT   3

Definition at line 632 of file totemrrp.c.

◆ STATUS_STR_LEN

#define STATUS_STR_LEN   512

Definition at line 190 of file totemrrp.c.

Referenced by totemrrp_ring_reenable().

Function Documentation

◆ __attribute__()

struct message_header __attribute__ ( (packed)  )

◆ rrp_deliver_fn()

void rrp_deliver_fn ( void *  context,
const void *  msg,
unsigned int  msg_len 
)

◆ rrp_iface_change_fn()

void rrp_iface_change_fn ( void *  context,
const struct totem_ip_address iface_addr 
)

◆ totemrrp_buffer_alloc()

void* totemrrp_buffer_alloc ( void *  rrp_context)

Definition at line 2118 of file totemrrp.c.

References totemrrp_instance::net_handles, and totemnet_buffer_alloc().

◆ totemrrp_buffer_release()

void totemrrp_buffer_release ( void *  rrp_context,
void *  ptr 
)

Definition at line 2125 of file totemrrp.c.

References totemrrp_instance::net_handles, and totemnet_buffer_release().

◆ totemrrp_crypto_set()

int totemrrp_crypto_set ( void *  rrp_context,
const char *  cipher_type,
const char *  hash_type 
)

Definition at line 2240 of file totemrrp.c.

References totemrrp_instance::net_handles, and totemnet_crypto_set().

Referenced by totemsrp_crypto_set().

◆ totemrrp_finalize()

int totemrrp_finalize ( void *  rrp_context)

◆ totemrrp_iface_check()

int totemrrp_iface_check ( void *  rrp_context)

Definition at line 2216 of file totemrrp.c.

References rrp_algo::iface_check, and totemrrp_instance::rrp_algo.

◆ totemrrp_ifaces_get()

int totemrrp_ifaces_get ( void *  rrp_context,
char ***  status,
unsigned int *  iface_count 
)

Definition at line 2225 of file totemrrp.c.

References totemrrp_instance::interface_count, and totemrrp_instance::status.

Referenced by totemsrp_ifaces_get().

◆ totemrrp_initialize()

int totemrrp_initialize ( qb_loop_t *  poll_handle,
void **  rrp_context,
struct totem_config totem_config,
totemsrp_stats_t stats,
void *  context,
void(*)(void *context, const void *msg, unsigned int msg_len)  deliver_fn,
void(*)(void *context, const struct totem_ip_address *iface_addr, unsigned int iface_no)  iface_change_fn,
void(*)(const void *msg, unsigned int *seqid, unsigned int *token_is)  token_seqid_get,
unsigned int(*)(void)  msgs_missing,
void(*)(void *context)  target_set_completed 
)

Create an instance.

Definition at line 2003 of file totemrrp.c.

◆ totemrrp_mcast_flush_send()

int totemrrp_mcast_flush_send ( void *  rrp_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 2182 of file totemrrp.c.

References rrp_algo::mcast_flush_send, and totemrrp_instance::rrp_algo.

◆ totemrrp_mcast_noflush_send()

int totemrrp_mcast_noflush_send ( void *  rrp_context,
const void *  msg,
unsigned int  msg_len 
)

◆ totemrrp_mcast_recv_empty()

int totemrrp_mcast_recv_empty ( void *  rrp_context)

Definition at line 2282 of file totemrrp.c.

References rrp_algo::mcast_recv_empty, and totemrrp_instance::rrp_algo.

◆ totemrrp_member_add()

int totemrrp_member_add ( void *  rrp_context,
const struct totem_ip_address member,
int  iface_no 
)

Definition at line 2293 of file totemrrp.c.

References rrp_algo::member_add, and totemrrp_instance::rrp_algo.

Referenced by totemsrp_member_add().

◆ totemrrp_member_remove()

int totemrrp_member_remove ( void *  rrp_context,
const struct totem_ip_address member,
int  iface_no 
)

Definition at line 2306 of file totemrrp.c.

References rrp_algo::member_remove, and totemrrp_instance::rrp_algo.

Referenced by totemsrp_member_remove().

◆ totemrrp_membership_changed()

void totemrrp_membership_changed ( void *  rrp_context,
enum totem_configuration_type  configuration_type,
const struct srp_addr member_list,
size_t  member_list_entries,
const struct srp_addr left_list,
size_t  left_list_entries,
const struct srp_addr joined_list,
size_t  joined_list_entries,
const struct memb_ring_id ring_id 
)

Definition at line 2319 of file totemrrp.c.

References rrp_algo::membership_changed, and totemrrp_instance::rrp_algo.

◆ totemrrp_processor_count_set()

int totemrrp_processor_count_set ( void *  rrp_context,
unsigned int  processor_count 
)

◆ totemrrp_recv_flush()

int totemrrp_recv_flush ( void *  rrp_context)

Definition at line 2154 of file totemrrp.c.

References rrp_algo::recv_flush, and totemrrp_instance::rrp_algo.

◆ totemrrp_ring_reenable()

int totemrrp_ring_reenable ( void *  rrp_context,
unsigned int  iface_no 
)

◆ totemrrp_send_flush()

int totemrrp_send_flush ( void *  rrp_context)

Definition at line 2163 of file totemrrp.c.

References totemrrp_instance::rrp_algo, and rrp_algo::send_flush.

◆ totemrrp_token_send()

int totemrrp_token_send ( void *  rrp_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 2171 of file totemrrp.c.

References totemrrp_instance::rrp_algo, and rrp_algo::token_send.

◆ totemrrp_token_target_set()

int totemrrp_token_target_set ( void *  rrp_context,
struct totem_ip_address addr,
unsigned int  iface_no 
)

Definition at line 2144 of file totemrrp.c.

References totemrrp_instance::rrp_algo, and rrp_algo::token_target_set.

Variable Documentation

◆ __attribute__

struct deliver_fn_context __attribute__

◆ active_algo

struct rrp_algo active_algo
Initial value:
= {
.name = "active",
.initialize = active_instance_initialize,
.mcast_recv = active_mcast_recv,
.mcast_noflush_send = active_mcast_noflush_send,
.mcast_flush_send = active_mcast_flush_send,
.token_recv = active_token_recv,
.token_send = active_token_send,
.recv_flush = active_recv_flush,
.send_flush = active_send_flush,
.iface_check = active_iface_check,
.processor_count_set = active_processor_count_set,
.token_target_set = active_token_target_set,
.ring_reenable = active_ring_reenable,
.mcast_recv_empty = active_mcast_recv_empty,
.member_add = active_member_add,
.member_remove = active_member_remove,
.membership_changed = active_membership_changed
}

Definition at line 606 of file totemrrp.c.

◆ encapsulated

char encapsulated

Definition at line 519 of file totemrrp.c.

◆ endian_detector

unsigned short endian_detector

Definition at line 520 of file totemrrp.c.

◆ nodeid_activator

int nodeid_activator

Definition at line 522 of file totemrrp.c.

◆ none_algo

struct rrp_algo none_algo
Initial value:
= {
.name = "none",
.initialize = NULL,
.mcast_recv = none_mcast_recv,
.mcast_noflush_send = none_mcast_noflush_send,
.mcast_flush_send = none_mcast_flush_send,
.token_recv = none_token_recv,
.token_send = none_token_send,
.recv_flush = none_recv_flush,
.send_flush = none_send_flush,
.iface_check = none_iface_check,
.processor_count_set = none_processor_count_set,
.token_target_set = none_token_target_set,
.ring_reenable = none_ring_reenable,
.mcast_recv_empty = none_mcast_recv_empty,
.member_add = none_member_add,
.member_remove = none_member_remove,
.membership_changed = none_membership_changed
}

Definition at line 566 of file totemrrp.c.

◆ passive_algo

struct rrp_algo passive_algo
Initial value:
= {
.name = "passive",
.initialize = passive_instance_initialize,
.mcast_recv = passive_mcast_recv,
.mcast_noflush_send = passive_mcast_noflush_send,
.mcast_flush_send = passive_mcast_flush_send,
.token_recv = passive_token_recv,
.token_send = passive_token_send,
.recv_flush = passive_recv_flush,
.send_flush = passive_send_flush,
.iface_check = passive_iface_check,
.processor_count_set = passive_processor_count_set,
.token_target_set = passive_token_target_set,
.ring_reenable = passive_ring_reenable,
.mcast_recv_empty = passive_mcast_recv_empty,
.member_add = passive_member_add,
.member_remove = passive_member_remove,
.membership_changed = passive_membership_changed
}

Definition at line 586 of file totemrrp.c.

◆ ring_number

int ring_number

Definition at line 521 of file totemrrp.c.

◆ rrp_algos

struct rrp_algo* rrp_algos[]
Initial value:
= {
}
struct rrp_algo active_algo
Definition: totemrrp.c:606
struct rrp_algo passive_algo
Definition: totemrrp.c:586
struct rrp_algo none_algo
Definition: totemrrp.c:566

Definition at line 626 of file totemrrp.c.

◆ type

char type

Definition at line 518 of file totemrrp.c.

Referenced by cmap_get_string().