corosync 3.1.7
Data Structures | Macros | Functions | Variables
totemknet.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 <net/ethernet.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <pthread.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/swab.h>
#include <corosync/logsys.h>
#include <corosync/icmap.h>
#include <corosync/totem/totemip.h>
#include "totemknet.h"
#include "main.h"
#include "util.h"
#include <libknet.h>
#include <corosync/totem/totemstats.h>
Include dependency graph for totemknet.c:

Go to the source code of this file.

Data Structures

struct  totemknet_instance
 
struct  work_item
 

Macros

#define MSG_NOSIGNAL   0
 
#define CFG_INTERFACE_STATUS_MAX_LEN   512
 
#define knet_log_printf_lock(level, subsys, function, file, line, format, args...)
 
#define knet_log_printf(level, format, args...)
 
#define libknet_log_printf(level, format, args...)
 
#define KNET_LOGSYS_PERROR(err_num, level, fmt, args...)
 
#define OWN_INDEX_NONE   -1
 

Functions

int totemknet_member_list_rebind_ip (void *knet_context)
 
int totemknet_crypto_set (void *knet_context, const char *cipher_type, const char *hash_type)
 
int totemknet_nodestatus_get (void *knet_context, unsigned int nodeid, struct totem_node_status *node_status)
 
int totemknet_ifaces_get (void *knet_context, char ***status, unsigned int *iface_count)
 
int totemknet_finalize (void *knet_context)
 
void totemknet_configure_log_level ()
 
int totemknet_initialize (qb_loop_t *poll_handle, void **knet_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 link_no), void(*mtu_changed)(void *context, int net_mtu), void(*target_set_completed)(void *context))
 
void * totemknet_buffer_alloc (void)
 
void totemknet_buffer_release (void *ptr)
 
int totemknet_processor_count_set (void *knet_context, int processor_count)
 
int totemknet_recv_flush (void *knet_context)
 
int totemknet_send_flush (void *knet_context)
 
int totemknet_token_send (void *knet_context, const void *msg, unsigned int msg_len)
 
int totemknet_mcast_flush_send (void *knet_context, const void *msg, unsigned int msg_len)
 
int totemknet_mcast_noflush_send (void *knet_context, const void *msg, unsigned int msg_len)
 
int totemknet_iface_check (void *knet_context)
 
void totemknet_net_mtu_adjust (void *knet_context, struct totem_config *totem_config)
 
int totemknet_token_target_set (void *knet_context, unsigned int nodeid)
 
int totemknet_recv_mcast_empty (void *knet_context)
 
int totemknet_iface_set (void *knet_context, const struct totem_ip_address *local_addr, unsigned short ip_port, unsigned int iface_no)
 
int totemknet_member_add (void *knet_context, const struct totem_ip_address *local, const struct totem_ip_address *member, int link_no)
 
int totemknet_member_remove (void *knet_context, const struct totem_ip_address *token_target, int link_no)
 
int totemknet_reconfigure (void *knet_context, struct totem_config *totem_config)
 
int totemknet_crypto_reconfigure_phase (void *knet_context, struct totem_config *totem_config, cfg_message_crypto_reconfig_phase_t phase)
 
void totemknet_stats_clear (void *knet_context)
 
int totemknet_link_get_status (knet_node_id_t node, uint8_t link_no, struct knet_link_status *status)
 
int totemknet_handle_get_stats (struct knet_handle_stats *stats)
 

Variables

struct totemknet_instanceglobal_instance
 

Macro Definition Documentation

◆ CFG_INTERFACE_STATUS_MAX_LEN

#define CFG_INTERFACE_STATUS_MAX_LEN   512

Definition at line 91 of file totemknet.c.

◆ knet_log_printf

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

Definition at line 233 of file totemknet.c.

◆ knet_log_printf_lock

#define knet_log_printf_lock (   level,
  subsys,
  function,
  file,
  line,
  format,
  args... 
)
Value:
do { \
(void)pthread_mutex_lock(&instance->log_mutex); \
instance->totemknet_log_printf ( \
level, subsys, function, file, line, \
(const char *)format, ##args); \
(void)pthread_mutex_unlock(&instance->log_mutex); \
} while (0);

Definition at line 224 of file totemknet.c.

◆ KNET_LOGSYS_PERROR

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

Definition at line 249 of file totemknet.c.

◆ libknet_log_printf

#define libknet_log_printf (   level,
  format,
  args... 
)
Value:
do { \
knet_log_printf_lock ( \
level, instance->knet_subsys_id, \
__FUNCTION__, "libknet.h", __LINE__, \
(const char *)format, ##args); \
} while (0);

Definition at line 241 of file totemknet.c.

◆ MSG_NOSIGNAL

#define MSG_NOSIGNAL   0

Definition at line 83 of file totemknet.c.

◆ OWN_INDEX_NONE

#define OWN_INDEX_NONE   -1

Definition at line 488 of file totemknet.c.

Function Documentation

◆ totemknet_buffer_alloc()

void * totemknet_buffer_alloc ( void  )

Definition at line 1358 of file totemknet.c.

◆ totemknet_buffer_release()

void totemknet_buffer_release ( void *  ptr)

Definition at line 1364 of file totemknet.c.

◆ totemknet_configure_log_level()

void totemknet_configure_log_level ( void  )

◆ totemknet_crypto_reconfigure_phase()

int totemknet_crypto_reconfigure_phase ( void *  knet_context,
struct totem_config totem_config,
cfg_message_crypto_reconfig_phase_t  phase 
)

◆ totemknet_crypto_set()

int totemknet_crypto_set ( void *  knet_context,
const char *  cipher_type,
const char *  hash_type 
)

Definition at line 363 of file totemknet.c.

◆ totemknet_finalize()

int totemknet_finalize ( void *  knet_context)

◆ totemknet_handle_get_stats()

int totemknet_handle_get_stats ( struct knet_handle_stats *  stats)

◆ totemknet_iface_check()

int totemknet_iface_check ( void *  knet_context)

Definition at line 1425 of file totemknet.c.

References totemknet_instance::knet_context, and knet_log_printf.

◆ totemknet_iface_set()

int totemknet_iface_set ( void *  knet_context,
const struct totem_ip_address local_addr,
unsigned short  ip_port,
unsigned int  iface_no 
)

◆ totemknet_ifaces_get()

int totemknet_ifaces_get ( void *  knet_context,
char ***  status,
unsigned int *  iface_count 
)

◆ totemknet_initialize()

int totemknet_initialize ( qb_loop_t *  poll_handle,
void **  knet_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 link_no)  iface_change_fn,
void(*)(void *context, int net_mtu)  mtu_changed,
void(*)(void *context)  target_set_completed 
)

Definition at line 1099 of file totemknet.c.

◆ totemknet_link_get_status()

int totemknet_link_get_status ( knet_node_id_t  node,
uint8_t  link_no,
struct knet_link_status *  status 
)

◆ totemknet_mcast_flush_send()

int totemknet_mcast_flush_send ( void *  knet_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 1398 of file totemknet.c.

References totemknet_instance::knet_context.

◆ totemknet_mcast_noflush_send()

int totemknet_mcast_noflush_send ( void *  knet_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 1411 of file totemknet.c.

References totemknet_instance::knet_context.

◆ totemknet_member_add()

int totemknet_member_add ( void *  knet_context,
const struct totem_ip_address local,
const struct totem_ip_address member,
int  link_no 
)

◆ totemknet_member_list_rebind_ip()

int totemknet_member_list_rebind_ip ( void *  knet_context)

Definition at line 1693 of file totemknet.c.

◆ totemknet_member_remove()

int totemknet_member_remove ( void *  knet_context,
const struct totem_ip_address token_target,
int  link_no 
)

◆ totemknet_net_mtu_adjust()

void totemknet_net_mtu_adjust ( void *  knet_context,
struct totem_config totem_config 
)

◆ totemknet_nodestatus_get()

int totemknet_nodestatus_get ( void *  knet_context,
unsigned int  nodeid,
struct totem_node_status node_status 
)

◆ totemknet_processor_count_set()

int totemknet_processor_count_set ( void *  knet_context,
int  processor_count 
)

Definition at line 1369 of file totemknet.c.

◆ totemknet_reconfigure()

int totemknet_reconfigure ( void *  knet_context,
struct totem_config totem_config 
)

Definition at line 1720 of file totemknet.c.

References totemknet_instance::knet_context.

◆ totemknet_recv_flush()

int totemknet_recv_flush ( void *  knet_context)

Definition at line 1376 of file totemknet.c.

◆ totemknet_recv_mcast_empty()

int totemknet_recv_mcast_empty ( void *  knet_context)

◆ totemknet_send_flush()

int totemknet_send_flush ( void *  knet_context)

Definition at line 1381 of file totemknet.c.

◆ totemknet_stats_clear()

void totemknet_stats_clear ( void *  knet_context)

◆ totemknet_token_send()

int totemknet_token_send ( void *  knet_context,
const void *  msg,
unsigned int  msg_len 
)

Definition at line 1386 of file totemknet.c.

References totemknet_instance::knet_context.

◆ totemknet_token_target_set()

int totemknet_token_target_set ( void *  knet_context,
unsigned int  nodeid 
)

Variable Documentation

◆ global_instance

struct totemknet_instance* global_instance