corosync  2.3.5
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 <corosync/list.h>
#include <qb/qbdefs.h>
#include <qb/qbloop.h>
#include <corosync/logsys.h>
#include "totemudp.h"
#include "util.h"
#include "totemcrypto.h"
#include <nss.h>
#include <pk11pub.h>
#include <pkcs11.h>
#include <prerror.h>
Include dependency graph for totemudp.c:

Go to the source code of this file.

Data Structures

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 MESSAGE_TYPE_MEMB_JOIN   3
 
#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, 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 * 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)
 
void totemudp_net_mtu_adjust (void *udp_context, struct totem_config *totem_config)
 
const char * totemudp_iface_print (void *udp_context)
 
int totemudp_iface_get (void *udp_context, struct totem_ip_address *addr)
 
int totemudp_token_target_set (void *udp_context, const struct totem_ip_address *token_target)
 
int totemudp_recv_mcast_empty (void *udp_context)
 

Macro Definition Documentation

#define BIND_STATE_LOOPBACK   2

Definition at line 89 of file totemudp.c.

Referenced by totemudp_finalize().

#define BIND_STATE_REGULAR   1

Definition at line 88 of file totemudp.c.

Referenced by totemudp_finalize().

#define BIND_STATE_UNBOUND   0

Definition at line 87 of file totemudp.c.

#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.

Referenced by totemudp_crypto_set(), and totemudp_finalize().

#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:85

Definition at line 239 of file totemudp.c.

Referenced by totemudp_crypto_set(), and totemudp_finalize().

#define LOGSYS_UTILS_ONLY   1

Definition at line 67 of file totemudp.c.

#define MCAST_SOCKET_BUFFER_SIZE   (TRANSMITS_ALLOWED * FRAME_SIZE_MAX)

Definition at line 83 of file totemudp.c.

Referenced by totemudp_finalize().

#define MESSAGE_TYPE_MEMB_JOIN   3

Definition at line 91 of file totemudp.c.

Referenced by totemudp_finalize().

#define MSG_NOSIGNAL   0

Definition at line 80 of file totemudp.c.

Referenced by totemudp_crypto_set(), totemudp_finalize(), and totemudp_recv_mcast_empty().

#define NETIF_STATE_REPORT_DOWN   2

Definition at line 85 of file totemudp.c.

Referenced by totemudp_finalize().

#define NETIF_STATE_REPORT_UP   1

Definition at line 84 of file totemudp.c.

Referenced by totemudp_finalize().

Function Documentation

void* totemudp_buffer_alloc ( void  )

Definition at line 1197 of file totemudp.c.

References FRAME_SIZE_MAX.

void totemudp_buffer_release ( void *  ptr)

Definition at line 1202 of file totemudp.c.

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

Definition at line 413 of file totemudp.c.

References BIND_STATE_LOOPBACK, BIND_STATE_REGULAR, totem_interface::bindnet, totem_interface::boundto, totem_config::broadcast_use, totem_config::clear_node_high_bit, totemudp_instance::context, crypto_authenticate_and_decrypt(), totemudp_instance::crypto_inst, totem_config::downcheck_timeout, totem_ip_address::family, totemudp_instance::flushing, FRAME_SIZE_MAX, totem_interface::ip_port, totemudp_socket::local_mcast_loop, log_printf, LOGSYS_PERROR, totemudp_instance::mcast_address, totemudp_socket::mcast_recv, totemudp_socket::mcast_send, MCAST_SOCKET_BUFFER_SIZE, MESSAGE_TYPE_MEMB_JOIN, MSG_NOSIGNAL, totemudp_instance::my_id, totemudp_instance::my_memb_entries, totemudp_instance::netif_bind_state, totemudp_instance::netif_state_report, NETIF_STATE_REPORT_DOWN, NETIF_STATE_REPORT_UP, totemudp_instance::stats_recv, system_from, totemudp_instance::timer_netif_check_timeout, totemudp_socket::token, totemudp_instance::totem_config, totemudp_instance::totem_interface, totemip_copy(), totemip_iface_check(), totemip_nosigpipe, totemip_print(), totemip_totemip_to_sockaddr_convert(), totemudp_instance::totemudp_deliver_fn, totemudp_instance::totemudp_iface_change_fn, totemudp_instance::totemudp_iov_recv, totemudp_instance::totemudp_iov_recv_flush, totemudp_instance::totemudp_log_level_debug, totemudp_instance::totemudp_log_level_notice, totemudp_instance::totemudp_log_level_security, totemudp_instance::totemudp_log_level_warning, totemudp_instance::totemudp_poll_handle, totemudp_instance::totemudp_sockets, and totem_interface::ttl.

int totemudp_iface_check ( void *  udp_context)

Definition at line 1308 of file totemudp.c.

int totemudp_iface_get ( void *  udp_context,
struct totem_ip_address addr 
)

Definition at line 1337 of file totemudp.c.

References totemudp_instance::my_id.

const char* totemudp_iface_print ( void *  udp_context)

Definition at line 1328 of file totemudp.c.

References totemudp_instance::my_id, and totemip_print().

int totemudp_initialize ( qb_loop_t *  poll_handle,
void **  udp_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 
)
int totemudp_mcast_flush_send ( void *  udp_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 1282 of file totemudp.c.

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

Definition at line 1295 of file totemudp.c.

void totemudp_net_mtu_adjust ( void *  udp_context,
struct totem_config totem_config 
)
int totemudp_processor_count_set ( void *  udp_context,
int  processor_count 
)
int totemudp_recv_flush ( void *  udp_context)
int totemudp_recv_mcast_empty ( void *  udp_context)
int totemudp_send_flush ( void *  udp_context)

Definition at line 1265 of file totemudp.c.

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

Definition at line 1270 of file totemudp.c.

References totemudp_instance::token_target.

int totemudp_token_target_set ( void *  udp_context,
const struct totem_ip_address token_target 
)