corosync  2.4.3
Data Structures | Macros | Functions
totemudpu.c File Reference
#include <config.h>
#include <assert.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 <sys/uio.h>
#include <limits.h>
#include <qb/qbdefs.h>
#include <qb/qbloop.h>
#include <corosync/sq.h>
#include <corosync/list.h>
#include <corosync/swab.h>
#include <corosync/logsys.h>
#include "totemudpu.h"
#include "util.h"
#include "totemcrypto.h"
#include <nss.h>
#include <pk11pub.h>
#include <pkcs11.h>
#include <prerror.h>
Include dependency graph for totemudpu.c:

Go to the source code of this file.

Data Structures

struct  totemudpu_member
 
struct  totemudpu_instance
 
struct  work_item
 

Macros

#define LOGSYS_UTILS_ONLY   1
 
#define MSG_NOSIGNAL   0
 
#define MCAST_SOCKET_BUFFER_SIZE   (TRANSMITS_ALLOWED * FRAME_SIZE_MAX)
 
#define NETIF_STATE_REPORT_UP   1
 
#define NETIF_STATE_REPORT_DOWN   2
 
#define BIND_STATE_UNBOUND   0
 
#define BIND_STATE_REGULAR   1
 
#define BIND_STATE_LOOPBACK   2
 
#define log_printf(level, format, args...)
 
#define LOGSYS_PERROR(err_num, level, fmt, args...)
 

Functions

int totemudpu_member_list_rebind_ip (void *udpu_context)
 
int totemudpu_crypto_set (void *udpu_context, const char *cipher_type, const char *hash_type)
 
int totemudpu_finalize (void *udpu_context)
 
int totemudpu_initialize (qb_loop_t *poll_handle, void **udpu_context, struct totem_config *totem_config, totemsrp_stats_t *stats, int interface_no, 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_address), void(*target_set_completed)(void *context))
 Create an instance. More...
 
void * totemudpu_buffer_alloc (void)
 
void totemudpu_buffer_release (void *ptr)
 
int totemudpu_processor_count_set (void *udpu_context, int processor_count)
 
int totemudpu_recv_flush (void *udpu_context)
 
int totemudpu_send_flush (void *udpu_context)
 
int totemudpu_token_send (void *udpu_context, const void *msg, unsigned int msg_len)
 
int totemudpu_mcast_flush_send (void *udpu_context, const void *msg, unsigned int msg_len)
 
int totemudpu_mcast_noflush_send (void *udpu_context, const void *msg, unsigned int msg_len)
 
int totemudpu_iface_check (void *udpu_context)
 
void totemudpu_net_mtu_adjust (void *udpu_context, struct totem_config *totem_config)
 
const char * totemudpu_iface_print (void *udpu_context)
 
int totemudpu_iface_get (void *udpu_context, struct totem_ip_address *addr)
 
int totemudpu_token_target_set (void *udpu_context, const struct totem_ip_address *token_target)
 
int totemudpu_recv_mcast_empty (void *udpu_context)
 
int totemudpu_member_add (void *udpu_context, const struct totem_ip_address *member)
 
int totemudpu_member_remove (void *udpu_context, const struct totem_ip_address *token_target)
 
int totemudpu_member_set_active (void *udpu_context, const struct totem_ip_address *member_ip, int active)
 

Macro Definition Documentation

◆ BIND_STATE_LOOPBACK

#define BIND_STATE_LOOPBACK   2

Definition at line 89 of file totemudpu.c.

◆ BIND_STATE_REGULAR

#define BIND_STATE_REGULAR   1

Definition at line 88 of file totemudpu.c.

◆ BIND_STATE_UNBOUND

#define BIND_STATE_UNBOUND   0

Definition at line 87 of file totemudpu.c.

◆ log_printf

#define log_printf (   level,
  format,
  args... 
)
Value:
do { \
instance->totemudpu_log_printf ( \
level, instance->totemudpu_subsys_id, \
__FUNCTION__, __FILE__, __LINE__, \
(const char *)format, ##args); \
} while (0);

Definition at line 233 of file totemudpu.c.

Referenced by totemudpu_member_add(), totemudpu_member_remove(), and totemudpu_member_set_active().

◆ LOGSYS_PERROR

#define LOGSYS_PERROR (   err_num,
  level,
  fmt,
  args... 
)
Value:
do { \
char _error_str[LOGSYS_MAX_PERROR_MSG_LEN]; \
const char *_error_ptr = qb_strerror_r(err_num, _error_str, sizeof(_error_str)); \
instance->totemudpu_log_printf ( \
level, instance->totemudpu_subsys_id, \
__FUNCTION__, __FILE__, __LINE__, \
fmt ": %s (%d)", ##args, _error_ptr, err_num); \
} while(0)
#define LOGSYS_MAX_PERROR_MSG_LEN
Definition: logsys.h:85

Definition at line 240 of file totemudpu.c.

◆ LOGSYS_UTILS_ONLY

#define LOGSYS_UTILS_ONLY   1

Definition at line 67 of file totemudpu.c.

◆ MCAST_SOCKET_BUFFER_SIZE

#define MCAST_SOCKET_BUFFER_SIZE   (TRANSMITS_ALLOWED * FRAME_SIZE_MAX)

Definition at line 83 of file totemudpu.c.

◆ MSG_NOSIGNAL

#define MSG_NOSIGNAL   0

Definition at line 80 of file totemudpu.c.

Referenced by totemudpu_recv_mcast_empty().

◆ NETIF_STATE_REPORT_DOWN

#define NETIF_STATE_REPORT_DOWN   2

Definition at line 85 of file totemudpu.c.

◆ NETIF_STATE_REPORT_UP

#define NETIF_STATE_REPORT_UP   1

Definition at line 84 of file totemudpu.c.

Function Documentation

◆ totemudpu_buffer_alloc()

void* totemudpu_buffer_alloc ( void  )

Definition at line 881 of file totemudpu.c.

References FRAME_SIZE_MAX.

◆ totemudpu_buffer_release()

void totemudpu_buffer_release ( void *  ptr)

Definition at line 886 of file totemudpu.c.

◆ totemudpu_crypto_set()

int totemudpu_crypto_set ( void *  udpu_context,
const char *  cipher_type,
const char *  hash_type 
)

Definition at line 250 of file totemudpu.c.

◆ totemudpu_finalize()

int totemudpu_finalize ( void *  udpu_context)

◆ totemudpu_iface_check()

int totemudpu_iface_check ( void *  udpu_context)

Definition at line 965 of file totemudpu.c.

◆ totemudpu_iface_get()

int totemudpu_iface_get ( void *  udpu_context,
struct totem_ip_address addr 
)

Definition at line 994 of file totemudpu.c.

References totemudpu_instance::my_id.

◆ totemudpu_iface_print()

const char* totemudpu_iface_print ( void *  udpu_context)

Definition at line 985 of file totemudpu.c.

References totemudpu_instance::my_id, and totemip_print().

◆ totemudpu_initialize()

int totemudpu_initialize ( qb_loop_t *  poll_handle,
void **  udpu_context,
struct totem_config totem_config,
totemsrp_stats_t stats,
int  interface_no,
void *  context,
void(*)(void *context, const void *msg, unsigned int msg_len)  deliver_fn,
void(*)(void *context, const struct totem_ip_address *iface_address)  iface_change_fn,
void(*)(void *context)  target_set_completed 
)

Create an instance.

Definition at line 785 of file totemudpu.c.

◆ totemudpu_mcast_flush_send()

int totemudpu_mcast_flush_send ( void *  udpu_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 939 of file totemudpu.c.

◆ totemudpu_mcast_noflush_send()

int totemudpu_mcast_noflush_send ( void *  udpu_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 952 of file totemudpu.c.

◆ totemudpu_member_add()

int totemudpu_member_add ( void *  udpu_context,
const struct totem_ip_address member 
)

Definition at line 1131 of file totemudpu.c.

References log_printf, LOGSYS_LEVEL_NOTICE, and totemip_print().

◆ totemudpu_member_list_rebind_ip()

int totemudpu_member_list_rebind_ip ( void *  udpu_context)

◆ totemudpu_member_remove()

int totemudpu_member_remove ( void *  udpu_context,
const struct totem_ip_address token_target 
)

◆ totemudpu_member_set_active()

int totemudpu_member_set_active ( void *  udpu_context,
const struct totem_ip_address member_ip,
int  active 
)

◆ totemudpu_net_mtu_adjust()

void totemudpu_net_mtu_adjust ( void *  udpu_context,
struct totem_config totem_config 
)

◆ totemudpu_processor_count_set()

int totemudpu_processor_count_set ( void *  udpu_context,
int  processor_count 
)

◆ totemudpu_recv_flush()

int totemudpu_recv_flush ( void *  udpu_context)

Definition at line 913 of file totemudpu.c.

◆ totemudpu_recv_mcast_empty()

int totemudpu_recv_mcast_empty ( void *  udpu_context)

◆ totemudpu_send_flush()

int totemudpu_send_flush ( void *  udpu_context)

Definition at line 920 of file totemudpu.c.

◆ totemudpu_token_send()

int totemudpu_token_send ( void *  udpu_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 927 of file totemudpu.c.

◆ totemudpu_token_target_set()

int totemudpu_token_target_set ( void *  udpu_context,
const struct totem_ip_address token_target 
)