24#ifndef XCOM_TRANSPORT_H
25#define XCOM_TRANSPORT_H
30#include "xdr_gen/xcom_vp.h"
33#define MSG_HDR_SIZE (3 * XDR_INT_SIZE)
54#define SERIALIZED_BUFLEN(x) ((x) + MSG_HDR_SIZE)
56#define VERS_PTR(buf) (buf)
57#define LENGTH_PTR(buf) &((buf)[XDR_INT_SIZE])
58#define X_TYPE (2 * XDR_INT_SIZE)
59#define X_TAG (X_TYPE + 1)
60#define X_TAG_PTR(buf) &((buf)[X_TAG])
62#define CHECK_PTR(buf) &((buf)[3 * XDR_INT_SIZE])
64#define MSG_PTR(buf) &((buf)[MSG_HDR_SIZE])
68extern xcom_proto
const
149int send_msg(
server *s, node_no from, node_no to, uint32_t group_id,
188#ifndef XCOM_WITHOUT_OPENSSL
200 x_msg_type x_type,
unsigned int tag, int64_t *ret);
202 x_msg_type *x_type,
unsigned int *tag, int64_t *ret);
222#define IP_MAX_SIZE 512
255#define INITIAL_CONNECT_WAIT 0.1
256#define MAX_CONNECT_WAIT 10.0
257#define CONNECT_WAIT_INCREASE 1.0
static constexpr int default_connection_timeout()
Definition: network_provider.h:457
const char * p
Definition: ctype-mb.cc:1225
#define SUPPRESS_UBSAN
Definition: my_compiler.h:120
Definition: buf0block_hint.cc:30
static loglevel log_level(const Sql_condition *condition)
Definition: histogram.cc:1644
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
network_provider_dynamic_log_level
Dynamic log level enum values.
Definition: network_provider.h:103
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
site_def * new_site_def()
Definition: site_def.cc:296
struct pax_msg pax_msg
Definition: site_struct.h:37
Definition: node_connection.h:47
Definition: xcom_transport.h:79
int crash_on_error
Definition: xcom_transport.h:83
xcom_port port
Definition: xcom_transport.h:81
pax_msg * p
Definition: xcom_transport.h:82
char * srv
Definition: xcom_transport.h:80
Definition: server_struct.h:39
Definition: site_struct.h:43
Definition: server_struct.h:31
Definition: task_arg.h:42
unsigned short xcom_port
Definition: xcom_common.h:46
int send_to_others(site_def const *s, pax_msg *p, const char *dbg)
Definition: xcom_transport.cc:959
int send_msg(server *s, node_no from, node_no to, uint32_t group_id, pax_msg *p)
Definition: xcom_transport.cc:850
int deserialize_msg(pax_msg *p, xcom_proto x_proto, char *buf, uint32_t buflen)
Definition: xcom_transport.cc:558
int incoming_connection_task(task_arg arg)
Definition: xcom_transport.cc:773
int send_proto(connection_descriptor *con, xcom_proto x_proto, x_msg_type x_type, unsigned int tag, int64_t *ret)
Definition: xcom_transport.cc:396
int close_open_connection(connection_descriptor *conn)
Definition: xcom_transport.cc:103
int is_new_node_eligible_for_ipv6(xcom_proto incoming_proto, const site_def *current_site_def)
Checks if an incoming node is eligible to enter the group.
Definition: xcom_transport.cc:258
xcom_proto set_latest_common_proto(xcom_proto x_proto)
Definition: xcom_transport.cc:1916
int serialize_msg(pax_msg *p, xcom_proto x_proto, uint32_t *buflen, char **buf)
Definition: xcom_transport.cc:549
char const * xcom_proto_name(xcom_proto proto_vers)
int recv_proto(connection_descriptor const *rfd, xcom_proto *x_proto, x_msg_type *x_type, unsigned int *tag, int64_t *ret)
int connect_tcp(char *server, xcom_port port, int *ret)
int tcp_reaper_task(task_arg arg)
Definition: xcom_transport.cc:1839
void get_header_1_0(unsigned char header_buf[], uint32_t *msgsize, x_msg_type *x_type, unsigned int *tag)
Definition: xcom_transport.cc:1137
xcom_proto minimum_ipv6_version()
Returns the version from which nodes are able to speak IPv6.
Definition: xcom_transport.cc:1936
xcom_proto get_latest_common_proto()
Definition: xcom_transport.cc:1920
int srv_ref(server *s)
Definition: xcom_transport.cc:756
void garbage_collect_servers()
Definition: xcom_transport.cc:722
int read_msg(connection_descriptor *rfd, pax_msg *p, server *s, int64_t *ret)
Reads message from connection rfd without buffering reads.
Definition: xcom_transport.cc:1154
void init_crc32c()
Definition: xcom_transport.cc:575
int send_to_all_except_self(site_def const *s, pax_msg *p, const char *dbg)
Definition: xcom_transport.cc:925
int flush_srv_buf(server *s, int64_t *ret)
Definition: xcom_transport.cc:215
void server_detected(server *s)
Updates timestamp of server.
Definition: xcom_transport.cc:804
int send_server_msg(site_def const *s, node_no i, pax_msg *p)
Definition: xcom_transport.cc:878
x_msg_type
Definition: xcom_transport.h:72
@ x_normal
Definition: xcom_transport.h:73
@ x_version_reply
Definition: xcom_transport.h:75
@ x_version_req
Definition: xcom_transport.h:74
uint32_t crc32c_hash(char *buf, char *end)
void write_protoversion(unsigned char *buf, xcom_proto proto_vers)
Definition: xcom_transport.cc:379
void reset_srv_buf(srv_buf *sb)
Definition: xcom_transport.cc:168
#define IP_MAX_SIZE
Definition: xcom_transport.h:222
int tcp_reconnection_task(task_arg arg)
int check_protoversion(xcom_proto x_proto, xcom_proto negotiated)
Definition: xcom_transport.cc:385
int sender_task(task_arg arg)
Definition: xcom_transport.cc:1463
xcom_proto const my_xcom_version
Definition: xcom_transport.cc:83
void init_xcom_transport(xcom_port listen_port)
Definition: xcom_transport.cc:161
void put_header_1_0(unsigned char header_buf[], uint32_t msgsize, x_msg_type x_type, unsigned int tag)
Definition: xcom_transport.cc:1145
int send_to_someone(site_def const *s, pax_msg *p, const char *dbg)
Definition: xcom_transport.cc:966
int get_ip_and_port(char const *address, char ip[IP_MAX_SIZE], xcom_port *port)
Get the ip and port object from a given address in the authorized input format.
Definition: xcom_transport.cc:2075
int srv_unref(server *s)
Definition: xcom_transport.cc:762
int send_to_all(pax_msg *p, const char *dbg)
Definition: xcom_transport.cc:933
void update_servers(site_def *s, cargo_type operation)
Definition: xcom_transport.cc:1733
int local_sender_task(task_arg arg)
Definition: xcom_transport.cc:1693
int apply_xdr(void *buff, uint32_t bufflen, xdrproc_t xdrfunc, void *xdrdata, enum xdr_op op) SUPPRESS_UBSAN
Definition: xcom_transport.cc:436
xcom_port xcom_get_port(char *a)
linkage connect_wait
Definition: xcom_transport.cc:1424
xcom_proto const my_min_xcom_version
Definition: xcom_transport.cc:81
char * xcom_get_name(char *a)
int buffered_read_msg(connection_descriptor *rfd, srv_buf *buf, pax_msg *p, server *s, int64_t *ret)
Reads message from connection rfd with buffering reads.
Definition: xcom_transport.cc:1268
connection_descriptor * open_new_connection(const char *server, xcom_port port, int connection_timeout=Network_provider::default_connection_timeout(), network_provider_dynamic_log_level log_level=network_provider_dynamic_log_level::PROVIDED)
Definition: xcom_transport.cc:107
int send_to_all_site(site_def const *s, pax_msg *p, const char *dbg)
Definition: xcom_transport.cc:917
double server_active(site_def const *s, node_no i)
Definition: xcom_transport.cc:737
int send_to_self_site(site_def const *s, pax_msg *p)
void shutdown_connection(connection_descriptor *con)
Definition: xcom_transport.cc:1883
xcom_proto read_protoversion(unsigned char *p)
Definition: xcom_transport.cc:383
bool is_able_to_connect_to_node(const char *server, const xcom_port port)
Tests connectivity to another node under the current configuration setup.
Definition: xcom_transport.cc:135
void close_connection(connection_descriptor *con)
Definition: xcom_transport.cc:1878
connection_descriptor * open_new_local_connection(const char *server, xcom_port port)
Definition: xcom_transport.cc:116
xcom_proto negotiate_protocol(xcom_proto proto_vers)
Definition: xcom_transport.cc:1924
void wakeup_sender()
Definition: xcom_transport.cc:1428
xcom_proto common_xcom_version(site_def const *site)
Definition: xcom_transport.cc:1905
void invalidate_servers(const site_def *old_site_def, const site_def *new_site_def)
Definition: xcom_transport.cc:1812
int send_to_acceptors(pax_msg *p, const char *dbg)
Definition: xcom_transport.cc:1006
void reset_connection(connection_descriptor *con)
Definition: xcom_transport.cc:1893
void ssl_free_con(connection_descriptor *con)
Definition: xcom_transport.cc:1871
bool_t(* xdrproc_t)(XDR *, void *,...)
Definition: xdr.h:143
xdr_op
Definition: xdr.h:79