corosync 3.1.7
Data Structures | Macros | Functions
totemudp.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 <sys/uio.h>
#include <limits.h>
#include <corosync/sq.h>
#include <corosync/swab.h>
#include <qb/qbdefs.h>
#include <qb/qbloop.h>
#include <corosync/logsys.h>
#include "totemudp.h"
#include "util.h"
Include dependency graph for totemudp.c:

Go to the source code of this file.

Data Structures

struct  totemudp_member
 
struct  totemudp_socket
 
struct  totemudp_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 totemudp_crypto_set (void *udp_context, const char *cipher_type, const char *hash_type)
 
int totemudp_finalize (void *udp_context)
 
int totemudp_initialize (qb_loop_t *poll_handle, void **udp_context, struct totem_config *totem_config, totemsrp_stats_t *stats, void *context, void(*deliver_fn)(void *context, const void *msg, unsigned int msg_len, const struct sockaddr_storage *system_from), void(*iface_change_fn)(void *context, const struct totem_ip_address *iface_address, unsigned int ring_no), void(*mtu_changed)(void *context, int net_mtu), void(*target_set_completed)(void *context))
 Create an instance. More...
 
void * totemudp_buffer_alloc (void)
 
void totemudp_buffer_release (void *ptr)
 
int totemudp_processor_count_set (void *udp_context, int processor_count)
 
int totemudp_recv_flush (void *udp_context)
 
int totemudp_send_flush (void *udp_context)
 
int totemudp_token_send (void *udp_context, const void *msg, unsigned int msg_len)
 
int totemudp_mcast_flush_send (void *udp_context, const void *msg, unsigned int msg_len)
 
int totemudp_mcast_noflush_send (void *udp_context, const void *msg, unsigned int msg_len)
 
int totemudp_iface_check (void *udp_context)
 
int totemudp_nodestatus_get (void *udp_context, unsigned int nodeid, struct totem_node_status *node_status)
 
int totemudp_ifaces_get (void *net_context, char ***status, unsigned int *iface_count)
 
void totemudp_net_mtu_adjust (void *udp_context, struct totem_config *totem_config)
 
int totemudp_token_target_set (void *udp_context, unsigned int nodeid)
 
int totemudp_recv_mcast_empty (void *udp_context)
 
int totemudp_member_add (void *udp_context, const struct totem_ip_address *local, const struct totem_ip_address *member, int ring_no)
 
int totemudp_member_remove (void *udp_context, const struct totem_ip_address *token_target, int ring_no)
 
int totemudp_iface_set (void *net_context, const struct totem_ip_address *local_addr, unsigned short ip_port, unsigned int iface_no)
 
int totemudp_reconfigure (void *udp_context, struct totem_config *totem_config)
 

Macro Definition Documentation

◆ BIND_STATE_LOOPBACK

#define BIND_STATE_LOOPBACK   2

Definition at line 82 of file totemudp.c.

◆ BIND_STATE_REGULAR

#define BIND_STATE_REGULAR   1

Definition at line 81 of file totemudp.c.

◆ BIND_STATE_UNBOUND

#define BIND_STATE_UNBOUND   0

Definition at line 80 of file totemudp.c.

◆ log_printf

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

Definition at line 231 of file totemudp.c.

◆ 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->totemudp_log_printf ( \
level, instance->totemudp_subsys_id, \
__FUNCTION__, __FILE__, __LINE__, \
fmt ": %s (%d)\n", ##args, _error_ptr, err_num); \
} while(0)
#define LOGSYS_MAX_PERROR_MSG_LEN
Definition: logsys.h:87

Definition at line 239 of file totemudp.c.

◆ LOGSYS_UTILS_ONLY

#define LOGSYS_UTILS_ONLY   1

Definition at line 66 of file totemudp.c.

◆ MCAST_SOCKET_BUFFER_SIZE

#define MCAST_SOCKET_BUFFER_SIZE   (TRANSMITS_ALLOWED * FRAME_SIZE_MAX)

Definition at line 76 of file totemudp.c.

◆ MSG_NOSIGNAL

#define MSG_NOSIGNAL   0

Definition at line 73 of file totemudp.c.

◆ NETIF_STATE_REPORT_DOWN

#define NETIF_STATE_REPORT_DOWN   2

Definition at line 78 of file totemudp.c.

◆ NETIF_STATE_REPORT_UP

#define NETIF_STATE_REPORT_UP   1

Definition at line 77 of file totemudp.c.

Function Documentation

◆ totemudp_buffer_alloc()

void * totemudp_buffer_alloc ( void  )

Definition at line 1216 of file totemudp.c.

References FRAME_SIZE_MAX.

◆ totemudp_buffer_release()

void totemudp_buffer_release ( void *  ptr)

Definition at line 1221 of file totemudp.c.

◆ totemudp_crypto_set()

int totemudp_crypto_set ( void *  udp_context,
const char *  cipher_type,
const char *  hash_type 
)

Definition at line 249 of file totemudp.c.

◆ totemudp_finalize()

int totemudp_finalize ( void *  udp_context)

◆ totemudp_iface_check()

int totemudp_iface_check ( void *  udp_context)

Definition at line 1327 of file totemudp.c.

References totemudp_instance::udp_context.

◆ totemudp_iface_set()

int totemudp_iface_set ( void *  net_context,
const struct totem_ip_address local_addr,
unsigned short  ip_port,
unsigned int  iface_no 
)

Definition at line 1534 of file totemudp.c.

◆ totemudp_ifaces_get()

int totemudp_ifaces_get ( void *  net_context,
char ***  status,
unsigned int *  iface_count 
)

Definition at line 1366 of file totemudp.c.

References INTERFACE_MAX.

◆ totemudp_initialize()

int totemudp_initialize ( qb_loop_t *  poll_handle,
void **  udp_context,
struct totem_config totem_config,
totemsrp_stats_t stats,
void *  context,
void(*)(void *context, const void *msg, unsigned int msg_len, const struct sockaddr_storage *system_from deliver_fn,
void(*)(void *context, const struct totem_ip_address *iface_address, unsigned int ring_no)  iface_change_fn,
void(*)(void *context, int net_mtu)  mtu_changed,
void(*)(void *context)  target_set_completed 
)

Create an instance.

Definition at line 1131 of file totemudp.c.

◆ totemudp_mcast_flush_send()

int totemudp_mcast_flush_send ( void *  udp_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 1301 of file totemudp.c.

References totemudp_instance::udp_context.

◆ totemudp_mcast_noflush_send()

int totemudp_mcast_noflush_send ( void *  udp_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 1314 of file totemudp.c.

References totemudp_instance::udp_context.

◆ totemudp_member_add()

int totemudp_member_add ( void *  udp_context,
const struct totem_ip_address local,
const struct totem_ip_address member,
int  ring_no 
)

◆ totemudp_member_remove()

int totemudp_member_remove ( void *  udp_context,
const struct totem_ip_address token_target,
int  ring_no 
)

◆ totemudp_net_mtu_adjust()

void totemudp_net_mtu_adjust ( void *  udp_context,
struct totem_config totem_config 
)

◆ totemudp_nodestatus_get()

int totemudp_nodestatus_get ( void *  udp_context,
unsigned int  nodeid,
struct totem_node_status node_status 
)

◆ totemudp_processor_count_set()

int totemudp_processor_count_set ( void *  udp_context,
int  processor_count 
)

◆ totemudp_reconfigure()

int totemudp_reconfigure ( void *  udp_context,
struct totem_config totem_config 
)

Definition at line 1543 of file totemudp.c.

◆ totemudp_recv_flush()

int totemudp_recv_flush ( void *  udp_context)

◆ totemudp_recv_mcast_empty()

int totemudp_recv_mcast_empty ( void *  udp_context)

◆ totemudp_send_flush()

int totemudp_send_flush ( void *  udp_context)

Definition at line 1284 of file totemudp.c.

◆ totemudp_token_send()

int totemudp_token_send ( void *  udp_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 1289 of file totemudp.c.

References totemudp_instance::udp_context.

◆ totemudp_token_target_set()

int totemudp_token_target_set ( void *  udp_context,
unsigned int  nodeid 
)