Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F3151771
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
47 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/kronosnetd/cfg.h b/kronosnetd/cfg.h
index dfaf847a..83d803c7 100644
--- a/kronosnetd/cfg.h
+++ b/kronosnetd/cfg.h
@@ -1,55 +1,55 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __CFG_H__
-#define __CFG_H__
+#ifndef __KNETD_CFG_H__
+#define __KNETD_CFG_H__
#include <stdint.h>
#include <net/if.h>
#include "libtap.h"
#include "libknet.h"
#define KNET_RING_DEFPORT 50000
struct knet_cfg_eth {
tap_t tap;
int auto_mtu;
knet_node_id_t node_id;
};
struct knet_cfg_ring {
knet_handle_t knet_h;
int data_mtu;
int base_port;
};
struct knet_cfg {
struct knet_cfg_eth cfg_eth;
struct knet_cfg_ring cfg_ring;
int active;
struct knet_handle_crypto_cfg knet_handle_crypto_cfg;
struct knet_cfg *next;
};
struct knet_cfg_top {
char *conffile;
char *logfile;
char *vty_ipv4;
char *vty_ipv6;
char *vty_port;
struct knet_cfg *knet_cfg;
};
struct knet_cfg *knet_get_iface(const char *name, const int create);
void knet_destroy_iface(struct knet_cfg *knet_iface);
extern struct knet_cfg_top knet_cfg_head;
#endif
diff --git a/kronosnetd/etherfilter.h b/kronosnetd/etherfilter.h
index d78b7627..f7358f3e 100644
--- a/kronosnetd/etherfilter.h
+++ b/kronosnetd/etherfilter.h
@@ -1,25 +1,25 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __ETHERFILTER_H__
-#define __ETHERFILTER_H__
+#ifndef __KNETD_ETHERFILTER_H__
+#define __KNETD_ETHERFILTER_H__
#include <stdint.h>
#include "libknet.h"
int ether_host_filter_fn (void *private_data,
const unsigned char *outdata,
ssize_t outdata_len,
uint8_t tx_rx,
knet_node_id_t this_host_id,
knet_node_id_t src_host_id,
int8_t *channel,
knet_node_id_t *dst_host_ids,
size_t *dst_host_ids_entries);
#endif
diff --git a/kronosnetd/logging.h b/kronosnetd/logging.h
index 25ff531e..4e979c41 100644
--- a/kronosnetd/logging.h
+++ b/kronosnetd/logging.h
@@ -1,29 +1,29 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __LOGGING_H__
-#define __LOGGING_H__
+#ifndef __KNETD_LOGGING_H__
+#define __KNETD_LOGGING_H__
#include <qb/qblog.h>
#define log_debug(fmt, args...) qb_log(LOG_DEBUG, "(%s:%i|%s): " fmt, __FILE__, __LINE__, __FUNCTION__, ##args);
#define log_kdebug(fmt, args...) qb_log(LOG_DEBUG, fmt, ##args);
#define log_info(fmt, args...) qb_log(LOG_INFO, fmt, ##args);
#define log_warn(fmt, args...) qb_log(LOG_WARNING, fmt, ##args);
#define log_error(fmt, args...) qb_log(LOG_ERR, fmt, ##args);
void logging_init_defaults(int debug, int daemonize, const char *logfile);
void logging_fini(void);
#endif
diff --git a/kronosnetd/vty.h b/kronosnetd/vty.h
index 5f67b42c..87cfa198 100644
--- a/kronosnetd/vty.h
+++ b/kronosnetd/vty.h
@@ -1,74 +1,74 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __VTY_H__
-#define __VTY_H__
+#ifndef __KNETD_VTY_H__
+#define __KNETD_VTY_H__
#include <pthread.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "libknet.h"
#define KNET_VTY_DEFAULT_PORT 50000
#define KNET_VTY_DEFAULT_MAX_CONN 4
#define KNET_VTY_TOTAL_MAX_CONN 16
#define KNET_VTY_CLI_TIMEOUT 300
#define KNET_VTY_MAX_LINE 512
#define KNET_VTY_MAX_HIST 50
struct knet_vty_global_conf {
int idle_timeout;
};
struct knet_vty {
pthread_t vty_thread; /* thread struct for this vty */
struct sockaddr_storage src_sa; /* source IP */
socklen_t src_sa_len; /* sa len */
char ip[128]; /* ip addr of source */
char username[64]; /* username */
char line[KNET_VTY_MAX_LINE]; /* input line */
char *history[KNET_VTY_MAX_HIST]; /* history */
int history_idx; /* index to history */
int history_pos; /* position in the history */
int insert_mode; /* add or insert */
int line_idx; /* index on the input line */
int cursor_pos; /* position of the cursor in the line */
int escape; /* escape status */
int escape_code; /* escape code buffer */
int user_can_enable;/* user is in group kronosnetadm */
int vty_sock; /* tcp socket for this vty */
int conn_num; /* vty number */
int active; /* vty is active */
int got_epipe; /* vty_sock has been closed */
int idle; /* idle time */
int idle_timeout; /* in seconds or 0 to disable automatic logout */
int node; /* node number of the menus */
int prevnode; /* node number of the menus (used by VTY node) */
void *param; /* pointer to cmd param */
int paramoffset; /* required if param is set */
int logfd; /* fd to pass to iface create */
int loglevel; /* loglevel (debug, etc) */
void *iface; /* pointer to iface we are working on */
knet_node_id_t host_id; /* peer/host we are working on */
uint8_t link_id; /* link id we are working on */
int filemode; /* tell print_conf to add or not carriage return */
struct knet_vty_global_conf *vty_global_conf; /* pointer to vty global config */
};
extern pthread_mutex_t knet_vty_mutex;
extern int knet_vty_config;
extern struct knet_vty knet_vtys[KNET_VTY_TOTAL_MAX_CONN];
int knet_vty_main_loop(int debug);
#endif
diff --git a/kronosnetd/vty_auth.h b/kronosnetd/vty_auth.h
index 51dd1e69..79c75118 100644
--- a/kronosnetd/vty_auth.h
+++ b/kronosnetd/vty_auth.h
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __VTY_AUTH_H__
-#define __VTY_AUTH_H__
+#ifndef __KNETD_VTY_AUTH_H__
+#define __KNETD_VTY_AUTH_H__
#include "vty.h"
#define AUTH_MAX_RETRY 3
int knet_vty_auth_user(struct knet_vty *vty, const char *user);
#endif
diff --git a/kronosnetd/vty_cli.h b/kronosnetd/vty_cli.h
index caac115c..0509c381 100644
--- a/kronosnetd/vty_cli.h
+++ b/kronosnetd/vty_cli.h
@@ -1,20 +1,20 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __VTY_CLI_H__
-#define __VTY_CLI_H__
+#ifndef __KNETD_VTY_CLI_H__
+#define __KNETD_VTY_CLI_H__
#include "vty.h"
static const char telnet_backward_char[] = { 0x08, 0x0 };
static const char telnet_newline[] = { '\n', '\r', 0x0 };
static const char file_newline[] = { '\n', 0x0 };
void knet_vty_cli_bind(struct knet_vty *vty);
#endif
diff --git a/kronosnetd/vty_cli_cmds.h b/kronosnetd/vty_cli_cmds.h
index 759196fa..c6d091d5 100644
--- a/kronosnetd/vty_cli_cmds.h
+++ b/kronosnetd/vty_cli_cmds.h
@@ -1,50 +1,50 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __VTY_CLI_CMDS_H__
-#define __VTY_CLI_CMDS_H__
+#ifndef __KNETD_VTY_CLI_CMDS_H__
+#define __KNETD_VTY_CLI_CMDS_H__
#include "vty.h"
typedef struct {
const int param;
} vty_param_t;
typedef struct {
const char *cmd;
const char *help;
const vty_param_t *params;
int (*func) (struct knet_vty *vty);
} vty_node_cmds_t;
typedef struct {
const int node_num;
const char *prompt;
const vty_node_cmds_t *cmds;
const vty_node_cmds_t *no_cmds;
} vty_nodes_t;
enum vty_nodes {
NODE_ROOT = 0,
NODE_CONFIG,
NODE_INTERFACE,
NODE_PEER,
NODE_LINK,
NODE_VTY
};
int knet_vty_execute_cmd(struct knet_vty *vty);
void knet_vty_help(struct knet_vty *vty);
void knet_vty_tab_completion(struct knet_vty *vty);
int knet_read_conf(void);
void knet_close_down(void);
extern vty_nodes_t knet_vty_nodes[];
#endif
diff --git a/kronosnetd/vty_utils.h b/kronosnetd/vty_utils.h
index e58740d2..8dda8853 100644
--- a/kronosnetd/vty_utils.h
+++ b/kronosnetd/vty_utils.h
@@ -1,35 +1,35 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __VTY_UTILS_H__
-#define __VTY_UTILS_H__
+#ifndef __KNETD_VTY_UTILS_H__
+#define __KNETD_VTY_UTILS_H__
#include "vty.h"
#define VTY_MAX_BUFFER_SIZE 4096
int knet_vty_write(struct knet_vty *vty, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
int knet_vty_read(struct knet_vty *vty, unsigned char *buf, size_t bufsize);
int knet_vty_set_echo(struct knet_vty *vty, int on);
void knet_vty_print_banner(struct knet_vty *vty);
int knet_vty_set_iacs(struct knet_vty *vty);
void knet_vty_free_history(struct knet_vty *vty);
void knet_vty_exit_node(struct knet_vty *vty);
int knet_vty_is_line_empty(struct knet_vty *vty);
void knet_vty_prompt(struct knet_vty *vty);
#endif
diff --git a/libknet/common.h b/libknet/common.h
index 1f3e911c..e00861e9 100644
--- a/libknet/common.h
+++ b/libknet/common.h
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __COMMON_H__
-#define __COMMON_H__
+#ifndef __KNET_COMMON_H__
+#define __KNET_COMMON_H__
int _fdset_cloexec(int fd);
int _fdset_nonblock(int fd);
#endif
diff --git a/libknet/compat.h b/libknet/compat.h
index 6f6cccfc..8a00c14f 100644
--- a/libknet/compat.h
+++ b/libknet/compat.h
@@ -1,50 +1,50 @@
/*
* Copyright (C) 2016 Red Hat, Inc. All rights reserved.
*
* Authors: Jan Friesse <jfriesse@redhat.com>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __COMPAT_H__
-#define __COMPAT_H__
+#ifndef __KNET_COMPAT_H__
+#define __KNET_COMPAT_H__
#include "config.h"
#include <sys/socket.h>
#include <stdint.h>
#ifndef ETIME
#define ETIME ETIMEDOUT
#endif
#ifdef HAVE_SYS_EPOLL_H
#include <sys/epoll.h>
#else
#ifdef HAVE_KEVENT
#include <poll.h>
#define EPOLL_CTL_ADD 1
#define EPOLL_CTL_MOD 2
#define EPOLL_CTL_DEL 3
#define EPOLLIN POLLIN
#define EPOLLOUT POLLOUT
typedef union epoll_data {
void *ptr;
int fd;
uint32_t u32;
uint64_t u64;
} epoll_data_t;
struct epoll_event {
uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
int epoll_create(int size);
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout_ms);
#endif /* HAVE_KEVENT */
#endif /* HAVE_SYS_EPOLL_H */
-#endif /* __COMPAT_H__ */
+#endif /* __KNET_COMPAT_H__ */
diff --git a/libknet/crypto.h b/libknet/crypto.h
index 1c8ac5c5..bac3359c 100644
--- a/libknet/crypto.h
+++ b/libknet/crypto.h
@@ -1,69 +1,69 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __CRYPTO_H__
-#define __CRYPTO_H__
+#ifndef __KNET_CRYPTO_H__
+#define __KNET_CRYPTO_H__
#include "internals.h"
struct crypto_instance {
int model;
void *model_instance;
};
typedef struct {
const char *model_name;
int (*init) (knet_handle_t knet_h,
struct knet_handle_crypto_cfg *knet_handle_crypto_cfg);
void (*fini) (knet_handle_t knet_h);
int (*crypt) (knet_handle_t knet_h,
const unsigned char *buf_in,
const ssize_t buf_in_len,
unsigned char *buf_out,
ssize_t *buf_out_len);
int (*cryptv) (knet_handle_t knet_h,
const struct iovec *iov_in,
int iovcnt_in,
unsigned char *buf_out,
ssize_t *buf_out_len);
int (*decrypt) (knet_handle_t knet_h,
const unsigned char *buf_in,
const ssize_t buf_in_len,
unsigned char *buf_out,
ssize_t *buf_out_len);
} crypto_model_t;
int crypto_authenticate_and_decrypt (
knet_handle_t knet_h,
const unsigned char *buf_in,
const ssize_t buf_in_len,
unsigned char *buf_out,
ssize_t *buf_out_len);
int crypto_encrypt_and_sign (
knet_handle_t knet_h,
const unsigned char *buf_in,
const ssize_t buf_in_len,
unsigned char *buf_out,
ssize_t *buf_out_len);
int crypto_encrypt_and_signv (
knet_handle_t knet_h,
const struct iovec *iov_in,
int iovcnt_in,
unsigned char *buf_out,
ssize_t *buf_out_len);
int crypto_init(
knet_handle_t knet_h,
struct knet_handle_crypto_cfg *knet_handle_crypto_cfg);
void crypto_fini(
knet_handle_t knet_h);
#endif
diff --git a/libknet/host.h b/libknet/host.h
index 2d6aa007..1b36c882 100644
--- a/libknet/host.h
+++ b/libknet/host.h
@@ -1,22 +1,22 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __HOST_H__
-#define __HOST_H__
+#ifndef __KNET_HOST_H__
+#define __KNET_HOST_H__
#include "internals.h"
int _seq_num_lookup(struct knet_host *host, seq_num_t seq_num, int defrag_buf, int clear_buf);
void _seq_num_set(struct knet_host *host, seq_num_t seq_num, int defrag_buf);
int _send_host_info(knet_handle_t knet_h, const void *data, const size_t datalen);
int _host_dstcache_update_async(knet_handle_t knet_h, struct knet_host *host);
int _host_dstcache_update_sync(knet_handle_t knet_h, struct knet_host *host);
#endif
diff --git a/libknet/internals.h b/libknet/internals.h
index ddb06d61..20bae927 100644
--- a/libknet/internals.h
+++ b/libknet/internals.h
@@ -1,467 +1,467 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __INTERNALS_H__
-#define __INTERNALS_H__
+#ifndef __KNET_INTERNALS_H__
+#define __KNET_INTERNALS_H__
/*
* NOTE: you shouldn't need to include this header normally
*/
#include "libknet.h"
#include "onwire.h"
#include "compat.h"
#define KNET_DATABUFSIZE KNET_MAX_PACKET_SIZE + KNET_HEADER_ALL_SIZE
#define KNET_DATABUFSIZE_CRYPT_PAD 1024
#define KNET_DATABUFSIZE_CRYPT KNET_DATABUFSIZE + KNET_DATABUFSIZE_CRYPT_PAD
#define KNET_RING_RCVBUFF 8388608
#define PCKT_FRAG_MAX UINT8_MAX
#define KNET_EPOLL_MAX_EVENTS KNET_DATAFD_MAX
typedef void *knet_transport_link_t; /* per link transport handle */
typedef void *knet_transport_t; /* per knet_h transport handle */
struct knet_transport_ops; /* Forward because of circular dependancy */
struct knet_mmsghdr {
struct msghdr msg_hdr; /* Message header */
unsigned int msg_len; /* Number of bytes transmitted */
};
struct knet_link {
/* required */
struct sockaddr_storage src_addr;
struct sockaddr_storage dst_addr;
/* configurable */
unsigned int dynamic; /* see KNET_LINK_DYN_ define above */
uint8_t priority; /* higher priority == preferred for A/P */
unsigned long long ping_interval; /* interval */
unsigned long long pong_timeout; /* timeout */
unsigned int latency_fix; /* precision */
uint8_t pong_count; /* how many ping/pong to send/receive before link is up */
/* status */
struct knet_link_status status;
/* internals */
uint8_t link_id;
uint8_t transport_type; /* #defined constant from API */
knet_transport_link_t transport_link; /* link_info_t from transport */
int outsock;
unsigned int configured:1; /* set to 1 if src/dst have been configured transport initialized on this link*/
unsigned int transport_connected:1; /* set to 1 if lower level transport is connected */
unsigned int latency_exp;
uint8_t received_pong;
struct timespec ping_last;
/* used by PMTUD thread as temp per-link variables and should always contain the onwire_len value! */
uint32_t proto_overhead;
struct timespec pmtud_last;
uint32_t last_ping_size;
uint32_t last_good_mtu;
uint32_t last_bad_mtu;
uint32_t last_sent_mtu;
uint32_t last_recv_mtu;
uint8_t has_valid_mtu;
};
#define KNET_CBUFFER_SIZE 4096
struct knet_host_defrag_buf {
char buf[KNET_DATABUFSIZE];
uint8_t in_use; /* 0 buffer is free, 1 is in use */
seq_num_t pckt_seq; /* identify the pckt we are receiving */
uint8_t frag_recv; /* how many frags did we receive */
uint8_t frag_map[PCKT_FRAG_MAX];/* bitmap of what we received? */
uint8_t last_first; /* special case if we receive the last fragment first */
uint16_t frag_size; /* normal frag size (not the last one) */
uint16_t last_frag_size; /* the last fragment might not be aligned with MTU size */
struct timespec last_update; /* keep time of the last pckt */
};
struct knet_host {
/* required */
knet_node_id_t host_id;
/* configurable */
uint8_t link_handler_policy;
char name[KNET_MAX_HOST_LEN];
/* status */
struct knet_host_status status;
/* internals */
char circular_buffer[KNET_CBUFFER_SIZE];
seq_num_t rx_seq_num;
seq_num_t untimed_rx_seq_num;
seq_num_t timed_rx_seq_num;
uint8_t got_data;
/* defrag/reassembly buffers */
struct knet_host_defrag_buf defrag_buf[KNET_MAX_LINK];
char circular_buffer_defrag[KNET_CBUFFER_SIZE];
/* link stuff */
struct knet_link link[KNET_MAX_LINK];
uint8_t active_link_entries;
uint8_t active_links[KNET_MAX_LINK];
struct knet_host *next;
};
struct knet_sock {
int sockfd[2]; /* sockfd[0] will always be application facing
* and sockfd[1] internal if sockpair has been created by knet */
int is_socket; /* check if it's a socket for recvmmsg usage */
int is_created; /* knet created this socket and has to clean up on exit/del */
int in_use; /* set to 1 if it's use, 0 if free */
int has_error; /* set to 1 if there were errors reading from the sock
* and socket has been removed from epoll */
};
struct knet_fd_trackers {
uint8_t transport; /* transport type (UDP/SCTP...) */
uint8_t data_type; /* internal use for transport to define what data are associated
* to this fd */
void *data; /* pointer to the data */
};
#define KNET_MAX_FDS KNET_MAX_HOST * KNET_MAX_LINK * 4
struct knet_handle {
knet_node_id_t host_id;
unsigned int enabled:1;
struct knet_sock sockfd[KNET_DATAFD_MAX];
int logfd;
uint8_t log_levels[KNET_MAX_SUBSYSTEMS];
int hostsockfd[2];
int dstsockfd[2];
int send_to_links_epollfd;
int recv_from_links_epollfd;
int dst_link_handler_epollfd;
unsigned int pmtud_interval;
unsigned int data_mtu; /* contains the max data size that we can send onwire
* without frags */
struct knet_host *host_head;
struct knet_host *host_index[KNET_MAX_HOST];
knet_transport_t transports[KNET_MAX_TRANSPORTS+1];
struct knet_transport_ops *transport_ops[KNET_MAX_TRANSPORTS+1];
struct knet_fd_trackers knet_transport_fd_tracker[KNET_MAX_FDS]; /* track status for each fd handled by transports */
knet_node_id_t host_ids[KNET_MAX_HOST];
size_t host_ids_entries;
struct knet_header *recv_from_sock_buf[PCKT_FRAG_MAX];
struct knet_header *send_to_links_buf[PCKT_FRAG_MAX];
struct knet_header *recv_from_links_buf[PCKT_FRAG_MAX];
struct knet_header *pingbuf;
struct knet_header *pmtudbuf;
pthread_t send_to_links_thread;
pthread_t recv_from_links_thread;
pthread_t heartbt_thread;
pthread_t dst_link_handler_thread;
pthread_t pmtud_link_handler_thread;
int lock_init_done;
pthread_rwlock_t global_rwlock; /* global config lock */
pthread_mutex_t pmtud_mutex; /* pmtud mutex to handle conditional send/recv + timeout */
pthread_cond_t pmtud_cond; /* conditional for above */
pthread_mutex_t tx_mutex; /* used to protect knet_send_sync and TX thread */
pthread_mutex_t hb_mutex; /* used to protect heartbeat thread and seq_num broadcasting */
struct crypto_instance *crypto_instance;
uint16_t sec_header_size;
uint16_t sec_block_size;
uint16_t sec_hash_size;
uint16_t sec_salt_size;
unsigned char *send_to_links_buf_crypt[PCKT_FRAG_MAX];
unsigned char *recv_from_links_buf_crypt;
unsigned char *recv_from_links_buf_decrypt;
unsigned char *pingbuf_crypt;
unsigned char *pmtudbuf_crypt;
seq_num_t tx_seq_num;
pthread_mutex_t tx_seq_num_mutex;
void *dst_host_filter_fn_private_data;
int (*dst_host_filter_fn) (
void *private_data,
const unsigned char *outdata,
ssize_t outdata_len,
uint8_t tx_rx,
knet_node_id_t this_host_id,
knet_node_id_t src_node_id,
int8_t *channel,
knet_node_id_t *dst_host_ids,
size_t *dst_host_ids_entries);
void *pmtud_notify_fn_private_data;
void (*pmtud_notify_fn) (
void *private_data,
unsigned int data_mtu);
void *host_status_change_notify_fn_private_data;
void (*host_status_change_notify_fn) (
void *private_data,
knet_node_id_t host_id,
uint8_t reachable,
uint8_t remote,
uint8_t external);
void *sock_notify_fn_private_data;
void (*sock_notify_fn) (
void *private_data,
int datafd,
int8_t channel,
uint8_t tx_rx,
int error,
int errorno);
int fini_in_progress;
};
/*
* NOTE: every single operation must be implementend
* for every protocol.
*/
typedef struct knet_transport_ops {
/*
* transport generic information
*/
const char *transport_name;
const uint8_t transport_id;
uint32_t transport_mtu_overhead;
/*
* transport init must allocate the new transport
* and perform all internal initializations
* (threads, lists, etc).
*/
int (*transport_init)(knet_handle_t knet_h);
/*
* transport free must releases _all_ resources
* allocated by tranport_init
*/
int (*transport_free)(knet_handle_t knet_h);
/*
* link operations should take care of all the
* sockets and epoll management for a given link/transport set
* transport_link_disable should return err = -1 and errno = EBUSY
* if listener is still in use, and any other errno in case
* the link cannot be disabled.
*
* set_config/clear_config are invoked in global write lock context
*/
int (*transport_link_set_config)(knet_handle_t knet_h, struct knet_link *link);
int (*transport_link_clear_config)(knet_handle_t knet_h, struct knet_link *link);
/*
* transport callback for incoming dynamic connections
* this is called in global read lock context
*/
int (*transport_link_dyn_connect)(knet_handle_t knet_h, int sockfd, struct knet_link *link);
/*
* per transport error handling of recvmmsg
* (see _handle_recv_from_links comments for details)
*/
/*
* transport_rx_sock_error is invoked when recvmmsg returns <= 0
*
* transport_rx_sock_error is invoked with both global_rdlock
*/
int (*transport_rx_sock_error)(knet_handle_t knet_h, int sockfd, int recv_err, int recv_errno);
/*
* transport_tx_sock_error is invoked with global_rwlock and
* it's invoked when sendto or sendmmsg returns =< 0
*
* it should return:
* -1 on internal error
* 0 ignore error and continue
* 1 retry
* any sleep or wait action should happen inside the transport code
*/
int (*transport_tx_sock_error)(knet_handle_t knet_h, int sockfd, int recv_err, int recv_errno);
/*
* this function is called on _every_ received packet
* to verify if the packet is data or internal protocol error handling
*
* it should return:
* -1 on error
* 0 packet is not data and we should continue the packet process loop
* 1 packet is not data and we should STOP the packet process loop
* 2 packet is data and should be parsed as such
*
* transport_rx_is_data is invoked with both global_rwlock
* and fd_tracker read lock (from RX thread)
*/
int (*transport_rx_is_data)(knet_handle_t knet_h, int sockfd, struct knet_mmsghdr *msg);
} knet_transport_ops_t;
socklen_t sockaddr_len(const struct sockaddr_storage *ss);
/**
* This is a kernel style list implementation.
*
* @author Steven Dake <sdake@redhat.com>
*/
struct knet_list_head {
struct knet_list_head *next;
struct knet_list_head *prev;
};
/**
* @def KNET_LIST_DECLARE()
* Declare and initialize a list head.
*/
#define KNET_LIST_DECLARE(name) \
struct knet_list_head name = { &(name), &(name) }
#define KNET_INIT_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
/**
* Initialize the list entry.
*
* Points next and prev pointers to head.
* @param head pointer to the list head
*/
static inline void knet_list_init(struct knet_list_head *head)
{
head->next = head;
head->prev = head;
}
/**
* Add this element to the list.
*
* @param element the new element to insert.
* @param head pointer to the list head
*/
static inline void knet_list_add(struct knet_list_head *element,
struct knet_list_head *head)
{
head->next->prev = element;
element->next = head->next;
element->prev = head;
head->next = element;
}
/**
* Add to the list (but at the end of the list).
*
* @param element pointer to the element to add
* @param head pointer to the list head
* @see knet_list_add()
*/
static inline void knet_list_add_tail(struct knet_list_head *element,
struct knet_list_head *head)
{
head->prev->next = element;
element->next = head;
element->prev = head->prev;
head->prev = element;
}
/**
* Delete an entry from the list.
*
* @param _remove the list item to remove
*/
static inline void knet_list_del(struct knet_list_head *_remove)
{
_remove->next->prev = _remove->prev;
_remove->prev->next = _remove->next;
}
/**
* Replace old entry by new one
* @param old: the element to be replaced
* @param new: the new element to insert
*/
static inline void knet_list_replace(struct knet_list_head *old,
struct knet_list_head *new)
{
new->next = old->next;
new->next->prev = new;
new->prev = old->prev;
new->prev->next = new;
}
/**
* Tests whether list is the last entry in list head
* @param list: the entry to test
* @param head: the head of the list
* @return boolean true/false
*/
static inline int knet_list_is_last(const struct knet_list_head *list,
const struct knet_list_head *head)
{
return list->next == head;
}
/**
* A quick test to see if the list is empty (pointing to it's self).
* @param head pointer to the list head
* @return boolean true/false
*/
static inline int32_t knet_list_empty(const struct knet_list_head *head)
{
return head->next == head;
}
/**
* Get the struct for this entry
* @param ptr: the &struct list_head pointer.
* @param type: the type of the struct this is embedded in.
* @param member: the name of the list_struct within the struct.
*/
#define knet_list_entry(ptr,type,member)\
((type *)((char *)(ptr)-(char*)(&((type *)0)->member)))
/**
* Get the first element from a list
* @param ptr: the &struct list_head pointer.
* @param type: the type of the struct this is embedded in.
* @param member: the name of the list_struct within the struct.
*/
#define knet_list_first_entry(ptr, type, member) \
knet_list_entry((ptr)->next, type, member)
/**
* Iterate over a list
* @param pos: the &struct list_head to use as a loop counter.
* @param head: the head for your list.
*/
#define knet_list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
/**
* Iterate over a list backwards
* @param pos: the &struct list_head to use as a loop counter.
* @param head: the head for your list.
*/
#define knet_list_for_each_reverse(pos, head) \
for (pos = (head)->prev; pos != (head); pos = pos->prev)
/**
* Iterate over a list safe against removal of list entry
* @param pos: the &struct list_head to use as a loop counter.
* @param n: another &struct list_head to use as temporary storage
* @param head: the head for your list.
*/
#define knet_list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
/**
* Iterate over list of given type
* @param pos: the type * to use as a loop counter.
* @param head: the head for your list.
* @param member: the name of the list_struct within the struct.
*/
#define knet_list_for_each_entry(pos, head, member) \
for (pos = knet_list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = knet_list_entry(pos->member.next, typeof(*pos), member))
#endif
diff --git a/libknet/link.h b/libknet/link.h
index 698675ae..5f2c27b3 100644
--- a/libknet/link.h
+++ b/libknet/link.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __LINK_H__
-#define __LINK_H__
+#ifndef __KNET_LINK_H__
+#define __KNET_LINK_H__
#include "internals.h"
#define KNET_LINK_STATIC 0 /* link has static ip on both ends */
#define KNET_LINK_DYNIP 1 /* link has dynamic destination ip */
int _link_updown(knet_handle_t knet_h, knet_node_id_t node_id, uint8_t link_id,
unsigned int enabled, unsigned int connected);
#endif
diff --git a/libknet/logging.h b/libknet/logging.h
index 17c799bf..c5cd99e2 100644
--- a/libknet/logging.h
+++ b/libknet/logging.h
@@ -1,30 +1,30 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __LOGGING_H__
-#define __LOGGING_H__
+#ifndef __KNET_LOGGING_H__
+#define __KNET_LOGGING_H__
#include "internals.h"
void log_msg(knet_handle_t knet_h, uint8_t subsystem, uint8_t msglevel,
const char *fmt, ...) __attribute__((format(printf, 4, 5)));;
#define log_err(knet_h, subsys, fmt, args...) \
log_msg(knet_h, subsys, KNET_LOG_ERR, fmt, ##args)
#define log_warn(knet_h, subsys, fmt, args...) \
log_msg(knet_h, subsys, KNET_LOG_WARN, fmt, ##args)
#define log_info(knet_h, subsys, fmt, args...) \
log_msg(knet_h, subsys, KNET_LOG_INFO, fmt, ##args)
#define log_debug(knet_h, subsys, fmt, args...) \
log_msg(knet_h, subsys, KNET_LOG_DEBUG, fmt, ##args)
#endif
diff --git a/libknet/netutils.h b/libknet/netutils.h
index 4be7c3e0..7879d0b9 100644
--- a/libknet/netutils.h
+++ b/libknet/netutils.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __NETUTILS_H__
-#define __NETUTILS_H__
+#ifndef __KNET_NETUTILS_H__
+#define __KNET_NETUTILS_H__
#include <sys/socket.h>
int cmpaddr(const struct sockaddr_storage *ss1, socklen_t sslen1, const struct sockaddr_storage *ss2, socklen_t sslen2);
int cpyaddrport(struct sockaddr_storage *dst, const struct sockaddr_storage *src);
socklen_t knet_sockaddr_len(const struct sockaddr_storage *ss);
#endif
diff --git a/libknet/nsscrypto.h b/libknet/nsscrypto.h
index d80b36a9..d839f891 100644
--- a/libknet/nsscrypto.h
+++ b/libknet/nsscrypto.h
@@ -1,44 +1,44 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __NSSCRYPTO_H__
-#define __NSSCRYPTO_H__
+#ifndef __KNET_NSSCRYPTO_H__
+#define __KNET_NSSCRYPTO_H__
#include "internals.h"
struct nsscrypto_instance;
int nsscrypto_authenticate_and_decrypt (
knet_handle_t knet_h,
const unsigned char *buf_in,
const ssize_t buf_in_len,
unsigned char *buf_out,
ssize_t *buf_out_len);
int nsscrypto_encrypt_and_sign (
knet_handle_t knet_h,
const unsigned char *buf_in,
const ssize_t buf_in_len,
unsigned char *buf_out,
ssize_t *buf_out_len);
int nsscrypto_encrypt_and_signv (
knet_handle_t knet_h,
const struct iovec *iov_in,
int iovcnt_in,
unsigned char *buf_out,
ssize_t *buf_out_len);
int nsscrypto_init(
knet_handle_t knet_h,
struct knet_handle_crypto_cfg *knet_handle_crypto_cfg);
void nsscrypto_fini(
knet_handle_t knet_h);
#endif
diff --git a/libknet/onwire.h b/libknet/onwire.h
index 05e1ddd6..5d51701c 100644
--- a/libknet/onwire.h
+++ b/libknet/onwire.h
@@ -1,201 +1,201 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __ONWIRE_H__
-#define __ONWIRE_H__
+#ifndef __KNET_ONWIRE_H__
+#define __KNET_ONWIRE_H__
/*
* data structures to define network packets.
* Start from knet_header at the bottom
*/
#include <stdint.h>
#include "libknet.h"
#if 0
/*
* for future protocol extension (re-switching table calculation)
*/
struct knet_hinfo_link {
uint8_t khl_link_id;
uint8_t khl_link_dynamic;
uint8_t khl_link_priority;
uint64_t khl_link_latency;
char khl_link_dst_ipaddr[KNET_MAX_HOST_LEN];
char khl_link_dst_port[KNET_MAX_PORT_LEN];
} __attribute__((packed));
struct knet_hinfo_link_table {
knet_node_id_t khlt_node_id;
uint8_t khlt_local; /* we have this node connected locally */
struct knet_hinfo_link khlt_link[KNET_MAX_LINK]; /* info we send about each link in the node */
} __attribute__((packed));
struct link_table {
knet_node_id_t khdt_host_entries;
uint8_t khdt_host_maps[0]; /* array of knet_hinfo_link_table[khdt_host_entries] */
} __attribute__((packed));
#endif
#define KNET_HOSTINFO_LINK_STATUS_DOWN 0
#define KNET_HOSTINFO_LINK_STATUS_UP 1
struct knet_hostinfo_payload_link_status {
uint8_t khip_link_status_link_id; /* link id */
uint8_t khip_link_status_status; /* up/down status */
} __attribute__((packed));
/*
* union to reference possible individual payloads
*/
union knet_hostinfo_payload {
struct knet_hostinfo_payload_link_status knet_hostinfo_payload_link_status;
} __attribute__((packed));
/*
* due to the nature of knet_hostinfo, we are currently
* sending those data as part of knet_header_payload_data.khp_data_userdata
* and avoid a union that increses knet_header_payload_data size
* unnecessarely.
* This might change later on depending on how we implement
* host info exchange
*/
#define KNET_HOSTINFO_TYPE_LINK_UP_DOWN 0 // UNUSED
#define KNET_HOSTINFO_TYPE_LINK_TABLE 1 // NOT IMPLEMENTED
#define KNET_HOSTINFO_UCAST 0 /* send info to a specific host */
#define KNET_HOSTINFO_BCAST 1 /* send info to all known / connected hosts */
struct knet_hostinfo {
uint8_t khi_type; /* type of hostinfo we are sending */
uint8_t khi_bcast; /* hostinfo destination bcast/ucast */
knet_node_id_t khi_dst_node_id;/* used only if in ucast mode */
union knet_hostinfo_payload khi_payload;
} __attribute__((packed));
#define KNET_HOSTINFO_ALL_SIZE sizeof(struct knet_hostinfo)
#define KNET_HOSTINFO_SIZE (KNET_HOSTINFO_ALL_SIZE - sizeof(union knet_hostinfo_payload))
#define KNET_HOSTINFO_LINK_STATUS_SIZE (KNET_HOSTINFO_SIZE + sizeof(struct knet_hostinfo_payload_link_status))
#define khip_link_status_status khi_payload.knet_hostinfo_payload_link_status.khip_link_status_status
#define khip_link_status_link_id khi_payload.knet_hostinfo_payload_link_status.khip_link_status_link_id
/*
* typedef uint64_t seq_num_t;
* #define SEQ_MAX UINT64_MAX
*/
typedef uint16_t seq_num_t;
#define SEQ_MAX UINT16_MAX
struct knet_header_payload_data {
seq_num_t khp_data_seq_num; /* pckt seq number used to deduplicate pkcts */
uint8_t khp_data_pad1; /* make sure to have space in the header to grow features */
uint8_t khp_data_pad2;
uint8_t khp_data_bcast; /* data destination bcast/ucast */
uint8_t khp_data_frag_num; /* number of fragments of this pckt. 1 is not fragmented */
uint8_t khp_data_frag_seq; /* as above, indicates the frag sequence number */
int8_t khp_data_channel; /* transport channel data for localsock <-> knet <-> localsock mapping */
uint8_t khp_data_userdata[0]; /* pointer to the real user data */
} __attribute__((packed));
struct knet_header_payload_ping {
uint8_t khp_ping_link; /* source link id */
uint32_t khp_ping_time[4]; /* ping timestamp */
seq_num_t khp_ping_seq_num; /* transport host seq_num */
uint8_t khp_ping_timed; /* timed pinged (1) or forced by seq_num (0) */
} __attribute__((packed));
/* taken from tracepath6 */
#define KNET_PMTUD_SIZE_V4 65535
#define KNET_PMTUD_SIZE_V6 KNET_PMTUD_SIZE_V4
/* These two get the protocol-specific overheads added to them */
#define KNET_PMTUD_OVERHEAD_V4 20
#define KNET_PMTUD_OVERHEAD_V6 40
#define KNET_PMTUD_MIN_MTU_V4 576
#define KNET_PMTUD_MIN_MTU_V6 1280
struct knet_header_payload_pmtud {
uint8_t khp_pmtud_link; /* source link id */
uint16_t khp_pmtud_size; /* size of the current packet */
uint8_t khp_pmtud_data[0]; /* pointer to empty/random data/fill buffer */
} __attribute__((packed));
/*
* union to reference possible individual payloads
*/
union knet_header_payload {
struct knet_header_payload_data khp_data; /* pure data packet struct */
struct knet_header_payload_ping khp_ping; /* heartbeat packet struct */
struct knet_header_payload_pmtud khp_pmtud; /* Path MTU discovery packet struct */
} __attribute__((packed));
/*
* starting point
*/
#define KNET_HEADER_VERSION 0x01 /* we currently support only one version */
#define KNET_HEADER_TYPE_DATA 0x00 /* pure data packet */
#define KNET_HEADER_TYPE_HOST_INFO 0x01 /* host status information pckt */
#define KNET_HEADER_TYPE_PMSK 0x80 /* packet mask */
#define KNET_HEADER_TYPE_PING 0x81 /* heartbeat */
#define KNET_HEADER_TYPE_PONG 0x82 /* reply to heartbeat */
#define KNET_HEADER_TYPE_PMTUD 0x83 /* Used to determine Path MTU */
#define KNET_HEADER_TYPE_PMTUD_REPLY 0x84 /* reply from remote host */
struct knet_header {
uint8_t kh_version; /* pckt format/version */
uint8_t kh_type; /* from above defines. Tells what kind of pckt it is */
knet_node_id_t kh_node; /* host id of the source host for this pckt */
uint8_t kh_pad1; /* make sure to have space in the header to grow features */
uint8_t kh_pad2;
union knet_header_payload kh_payload; /* union of potential data struct based on kh_type */
} __attribute__((packed));
/*
* commodoty defines to hide structure nesting
* (needs review and cleanup)
*/
#define khp_data_seq_num kh_payload.khp_data.khp_data_seq_num
#define khp_data_frag_num kh_payload.khp_data.khp_data_frag_num
#define khp_data_frag_seq kh_payload.khp_data.khp_data_frag_seq
#define khp_data_userdata kh_payload.khp_data.khp_data_userdata
#define khp_data_bcast kh_payload.khp_data.khp_data_bcast
#define khp_data_channel kh_payload.khp_data.khp_data_channel
#define khp_ping_link kh_payload.khp_ping.khp_ping_link
#define khp_ping_time kh_payload.khp_ping.khp_ping_time
#define khp_ping_seq_num kh_payload.khp_ping.khp_ping_seq_num
#define khp_ping_timed kh_payload.khp_ping.khp_ping_timed
#define khp_pmtud_link kh_payload.khp_pmtud.khp_pmtud_link
#define khp_pmtud_size kh_payload.khp_pmtud.khp_pmtud_size
#define khp_pmtud_data kh_payload.khp_pmtud.khp_pmtud_data
/*
* extra defines to avoid mingling with sizeof() too much
*/
#define KNET_HEADER_ALL_SIZE sizeof(struct knet_header)
#define KNET_HEADER_SIZE (KNET_HEADER_ALL_SIZE - sizeof(union knet_header_payload))
#define KNET_HEADER_PING_SIZE (KNET_HEADER_SIZE + sizeof(struct knet_header_payload_ping))
#define KNET_HEADER_PMTUD_SIZE (KNET_HEADER_SIZE + sizeof(struct knet_header_payload_pmtud))
#define KNET_HEADER_DATA_SIZE (KNET_HEADER_SIZE + sizeof(struct knet_header_payload_data))
#endif
diff --git a/libknet/tests/test-common.h b/libknet/tests/test-common.h
index d20fb4b1..ce532c6f 100644
--- a/libknet/tests/test-common.h
+++ b/libknet/tests/test-common.h
@@ -1,71 +1,71 @@
/*
* Copyright (C) 2016 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __TEST_COMMON_H__
-#define __TEST_COMMON_H__
+#ifndef __KNET_TEST_COMMON_H__
+#define __KNET_TEST_COMMON_H__
#include "internals.h"
#include <sched.h>
/*
* error codes from automake test-driver
*/
#define PASS 0
#define SKIP 77
#define ERROR 99
#define FAIL -1
/* For *BSD compatibility */
#ifndef s6_addr16
#define s6_addr8 __u6_addr.__u6_addr8
#define s6_addr16 __u6_addr.__u6_addr16
#define s6_addr32 __u6_addr.__u6_addr32
#endif
/*
* common facilities
*/
int execute_shell(const char *command, char **error_string);
int is_memcheck(void);
int is_helgrind(void);
int need_root(void);
void set_scheduler(int policy);
/*
* consider moving this one as official API
*/
int knet_handle_stop(knet_handle_t knet_h);
/*
* high level logging function.
* automatically setup logpipes and start/stop logging thread.
*
* start_logging exit(FAIL) on error or fd to pass to knet_handle_new
* and it will install an atexit handle to close logging properly
*
* WARNING: DO NOT use start_logging for api_ or int_ testing.
* while start_logging would work just fine, the output
* of the logs is more complex to read because of the way
* the thread would interleave the output of printf from api_/int_ testing
* with knet logs. Functionally speaking you get the exact same logs,
* but a lot harder to read due to the thread latency in printing logs.
*/
int start_logging(FILE *std);
int setup_logpipes(int *logfds);
void close_logpipes(int *logfds);
void flush_logs(int logfd, FILE *std);
int start_logthread(int logfd, FILE *std);
int stop_logthread(void);
#endif
diff --git a/libknet/threads_common.h b/libknet/threads_common.h
index f5ea2315..d849e6c7 100644
--- a/libknet/threads_common.h
+++ b/libknet/threads_common.h
@@ -1,28 +1,28 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __THREADS_COMMON_H__
-#define __THREADS_COMMON_H__
+#ifndef __KNET_THREADS_COMMON_H__
+#define __KNET_THREADS_COMMON_H__
#include "internals.h"
#define KNET_THREADS_TIMERES 200000
#define timespec_diff(start, end, diff) \
do { \
if (end.tv_sec > start.tv_sec) \
*(diff) = ((end.tv_sec - start.tv_sec) * 1000000000llu) \
+ end.tv_nsec - start.tv_nsec; \
else \
*(diff) = end.tv_nsec - start.tv_nsec; \
} while (0);
int shutdown_in_progress(knet_handle_t knet_h);
#endif
diff --git a/libknet/threads_dsthandler.h b/libknet/threads_dsthandler.h
index cd5c4249..155a547a 100644
--- a/libknet/threads_dsthandler.h
+++ b/libknet/threads_dsthandler.h
@@ -1,15 +1,15 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __THREADS_DSTHANDLER_H__
-#define __THREADS_DSTHANDLER_H__
+#ifndef __KNET_THREADS_DSTHANDLER_H__
+#define __KNET_THREADS_DSTHANDLER_H__
void *_handle_dst_link_handler_thread(void *data);
#endif
diff --git a/libknet/threads_heartbeat.h b/libknet/threads_heartbeat.h
index eb763622..a966586f 100644
--- a/libknet/threads_heartbeat.h
+++ b/libknet/threads_heartbeat.h
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __THREADS_HEARTBEAT_H__
-#define __THREADS_HEARTBEAT_H__
+#ifndef __KNET_THREADS_HEARTBEAT_H__
+#define __KNET_THREADS_HEARTBEAT_H__
void _send_pings(knet_handle_t knet_h, int timed);
void *_handle_heartbt_thread(void *data);
#endif
diff --git a/libknet/threads_pmtud.h b/libknet/threads_pmtud.h
index ddd40e6a..ed386435 100644
--- a/libknet/threads_pmtud.h
+++ b/libknet/threads_pmtud.h
@@ -1,15 +1,15 @@
/*
* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __THREADS_PMTUD_H__
-#define __THREADS_PMTUD_H__
+#ifndef __KNET_THREADS_PMTUD_H__
+#define __KNET_THREADS_PMTUD_H__
void *_handle_pmtud_link_thread(void *data);
#endif
diff --git a/libknet/threads_rx.h b/libknet/threads_rx.h
index 54f3a6d8..bca43027 100644
--- a/libknet/threads_rx.h
+++ b/libknet/threads_rx.h
@@ -1,15 +1,15 @@
/*
* Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __THREADS_RX_H__
-#define __THREADS_RX_H__
+#ifndef __KNET_THREADS_RX_H__
+#define __KNET_THREADS_RX_H__
void *_handle_recv_from_links_thread(void *data);
#endif
diff --git a/libknet/threads_tx.h b/libknet/threads_tx.h
index bf8c1d8f..46563e17 100644
--- a/libknet/threads_tx.h
+++ b/libknet/threads_tx.h
@@ -1,15 +1,15 @@
/*
* Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
* Federico Simoncelli <fsimon@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __THREADS_TX_H__
-#define __THREADS_TX_H__
+#ifndef __KNET_THREADS_TX_H__
+#define __KNET_THREADS_TX_H__
void *_handle_send_to_links_thread(void *data);
#endif
diff --git a/libknet/transports.h b/libknet/transports.h
index e6f65f8f..343a13fe 100644
--- a/libknet/transports.h
+++ b/libknet/transports.h
@@ -1,27 +1,27 @@
/*
* Copyright (C) 2016 Red Hat, Inc. All rights reserved.
*
* Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
-#ifndef __TRANSPORTS_H__
-#define __TRANSPORTS_H__
+#ifndef __KNET_TRANSPORTS_H__
+#define __KNET_TRANSPORTS_H__
knet_transport_ops_t *get_udp_transport(void);
knet_transport_ops_t *get_sctp_transport(void);
int _configure_common_socket(knet_handle_t knet_h, int sock, const char *type);
int _configure_transport_socket(knet_handle_t knet_h, int sock, struct sockaddr_storage *address, const char *type);
int _init_socketpair(knet_handle_t knet_h, int *sock);
void _close_socketpair(knet_handle_t knet_h, int *sock);
int _set_fd_tracker(knet_handle_t knet_h, int sockfd, uint8_t transport, uint8_t data_type, void *data);
int _is_valid_fd(knet_handle_t knet_h, int sockfd);
int _sendmmsg(int sockfd, struct knet_mmsghdr *msgvec, unsigned int vlen, unsigned int flags);
int _recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int flags);
#endif
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Feb 24, 10:34 AM (16 h, 37 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1464141
Default Alt Text
(47 KB)
Attached To
Mode
rK kronosnet
Attached
Detach File
Event Timeline
Log In to Comment