CUBRID Engine
latest
|
#include "config.h"
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <arpa/inet.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <netinet/tcp.h>
#include <assert.h>
#include "porting.h"
#include "connection_cl.h"
#include "error_manager.h"
#include "connection_globals.h"
#include "system_parameter.h"
#include "environment_variable.h"
#include "tcp.h"
#include <pthread.h>
Go to the source code of this file.
Macros | |
#define | HOST_ID_ARRAY_SIZE 8 /* size of the host_id string */ |
#define | TCP_MIN_NUM_RETRIES 3 |
#define | CONTROLLEN (sizeof(struct cmsghdr) + sizeof(int)) |
#define | INADDR_NONE 0xffffffff |
#define | SET_NONBLOCKING(fd) |
#define | SET_NONBLOCKING(fd) |
Variables | |
static pthread_mutex_t | gethostbyname_lock = PTHREAD_MUTEX_INITIALIZER |
static const int | css_Maximum_server_count = 1000 |
#define CONTROLLEN (sizeof(struct cmsghdr) + sizeof(int)) |
Definition at line 87 of file tcp.c.
Referenced by css_open_new_socket_from_master(), css_transfer_fd(), recv_fd(), and send_fd().
#define INADDR_NONE 0xffffffff |
Definition at line 89 of file tcp.c.
Referenced by css_gethostid(), css_hostname_to_ip(), css_sockaddr(), css_tcp_client_open_with_retry(), hb_hostname_to_sin_addr(), and jsp_connect_server().
#define SET_NONBLOCKING | ( | fd | ) |
Definition at line 1320 of file tcp.c.
Referenced by css_peer_alive(), css_tcp_client_open_with_timeout(), and in_cksum().
#define SET_NONBLOCKING | ( | fd | ) |
#define TCP_MIN_NUM_RETRIES 3 |
Definition at line 86 of file tcp.c.
Referenced by css_tcp_client_open_with_retry(), and css_tcp_master_datagram().
void css_close_server_connection_socket | ( | void | ) |
Definition at line 1242 of file tcp.c.
Referenced by css_init().
|
static |
Definition at line 1267 of file tcp.c.
References cubregex::count(), and rc.
char* css_get_master_domain_path | ( | void | ) |
Definition at line 155 of file tcp.c.
References envvar_get(), envvar_prefix(), NULL, and prm_get_master_port_id().
Referenced by css_master_cleanup(), css_process_kill_master(), css_sockaddr(), and css_tcp_master_open().
int css_get_max_socket_fds | ( | void | ) |
Definition at line 1315 of file tcp.c.
Referenced by crash_handler(), css_daemon_start(), and sysprm_final().
int css_get_peer_name | ( | SOCKET | sockfd, |
char * | hostname, | ||
size_t | len | ||
) |
Definition at line 1592 of file tcp.c.
Referenced by css_process_deact_stop_all(), css_process_deactivate_heartbeat(), and css_send_error().
int css_get_sock_name | ( | SOCKET | sockfd, |
char * | hostname, | ||
size_t | len | ||
) |
Definition at line 1618 of file tcp.c.
Referenced by css_send_error().
unsigned int css_gethostid | ( | void | ) |
Definition at line 1209 of file tcp.c.
Referenced by log_2pc_make_global_tran_id().
int css_hostname_to_ip | ( | const char * | host, |
unsigned char * | ip_addr | ||
) |
Definition at line 227 of file tcp.c.
Referenced by boot_make_session_server_key().
Definition at line 836 of file tcp.c.
Referenced by css_check_master_socket_input().
Definition at line 1059 of file tcp.c.
Referenced by css_process_new_client().
int css_open_server_connection_socket | ( | void | ) |
Definition at line 1228 of file tcp.c.
Referenced by css_connect_to_master_server().
Definition at line 1470 of file tcp.c.
References ARG_FILE_LINE, css_ping(), er_log_debug, htons(), and SET_NONBLOCKING.
Referenced by css_connection_handler_thread(), and css_net_recv().
Definition at line 1256 of file tcp.c.
Referenced by css_is_shutdown_timeout_expired().
void css_shutdown_socket | ( | SOCKET | fd | ) |
Definition at line 1179 of file tcp.c.
Referenced by css_does_master_exist(), css_master_cleanup(), css_process_close_packet(), css_process_kill_master(), css_send_io_vector_with_socket(), css_shutdown_conn(), and css_tcp_master_open().
|
static |
Definition at line 307 of file tcp.c.
References ARG_FILE_LINE, css_get_master_domain_path(), ER_ERROR_SEVERITY, er_set_with_oserror(), ERR_CSS_TCP_HOST_NAME_ERROR, gethostbyname_lock, htons(), INADDR_NONE, INVALID_SOCKET, NO_ERROR, NULL, pthread_mutex_lock, and pthread_mutex_unlock.
Referenced by css_tcp_client_open_with_retry(), and css_tcp_client_open_with_timeout().
|
static |
Definition at line 195 of file tcp.c.
References prm_get_bool_value(), prm_get_integer_value(), prm_get_value(), PRM_ID_TCP_KEEPALIVE, PRM_ID_TCP_NODELAY, PRM_ID_TCP_RCVBUF_SIZE, and PRM_ID_TCP_SNDBUF_SIZE.
Referenced by css_open_new_socket_from_master(), css_tcp_client_open_with_retry(), and css_tcp_client_open_with_timeout().
Definition at line 182 of file tcp.c.
Referenced by css_common_connect().
Definition at line 414 of file tcp.c.
Referenced by css_common_connect(), css_does_master_exist(), and css_tcp_client_open().
Definition at line 550 of file tcp.c.
References ARG_FILE_LINE, assert, css_sockaddr(), css_sockopt(), ER_ERROR_SEVERITY, er_log_debug, er_set_with_oserror(), ERR_CSS_TCP_CANNOT_CREATE_SOCKET, INVALID_SOCKET, NO_ERROR, NULL, and SET_NONBLOCKING.
Referenced by css_common_connect().
Definition at line 930 of file tcp.c.
Referenced by css_connect_to_master_server().
Definition at line 967 of file tcp.c.
Referenced by css_accept_new_request(), and css_accept_old_request().
int css_tcp_master_open | ( | int | port, |
SOCKET * | sockfd | ||
) |
Definition at line 663 of file tcp.c.
Referenced by css_master_init().
Definition at line 882 of file tcp.c.
References ARG_FILE_LINE, ER_ERROR_SEVERITY, er_set_with_oserror(), ERR_CSS_TCP_ACCEPT_ERROR, ERR_CSS_TCP_DATAGRAM_BIND, ERR_CSS_TCP_DATAGRAM_SOCKET, IS_INVALID_SOCKET, and strlen.
Referenced by css_connect_to_master_server().
bool css_transfer_fd | ( | SOCKET | server_fd, |
SOCKET | client_fd, | ||
unsigned short | rid, | ||
CSS_SERVER_REQUEST | request_for_server | ||
) |
Definition at line 1122 of file tcp.c.
Referenced by css_send_new_request_to_server().
|
static |
Definition at line 1330 of file tcp.c.
References ARG_FILE_LINE, css_ping(), er_log_debug, htons(), ntohs(), NULL, pid, and SET_NONBLOCKING.
|
static |
Definition at line 92 of file tcp.c.
Referenced by css_tcp_master_open().
|
static |
Definition at line 82 of file tcp.c.
Referenced by css_hostname_to_ip(), css_sockaddr(), and hb_hostname_to_sin_addr().