CUBRID Engine
latest
|
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include "dbtype.h"
#include "connection_cl.h"
#include "error_manager.h"
#include "error_code.h"
#include "connection_globals.h"
#include "wintcp.h"
#include "porting.h"
#include "system_parameter.h"
#include "client_support.h"
Go to the source code of this file.
Macros | |
#define | HOST_ID_ARRAY_SIZE 8 |
Variables | |
static const int | css_Tcp_max_connect_tries = 3 |
static const int | css_Maximum_server_count = 1000 |
static int | css_Wsa_error = CSS_ER_WINSOCK_NOERROR |
static FARPROC | old_hook = NULL |
static int | max_socket_fds = _SYS_OPEN |
static unsigned int | wsa_Init_count = 0 |
Definition at line 609 of file wintcp.c.
References ARG_FILE_LINE, ER_ERROR_SEVERITY, er_set(), ERR_CSS_WINTCP_ACCEPT_ERROR, error(), INVALID_SOCKET, and IS_INVALID_SOCKET.
Referenced by css_master_accept(), and css_server_accept().
void css_close_server_connection_socket | ( | void | ) |
Definition at line 737 of file wintcp.c.
References css_Server_connection_socket, INVALID_SOCKET, and IS_INVALID_SOCKET.
|
static |
Definition at line 306 of file wintcp.c.
References cubregex::count(), and rc.
int css_get_max_socket_fds | ( | void | ) |
Definition at line 759 of file wintcp.c.
References max_socket_fds.
int css_get_peer_name | ( | SOCKET | sockfd, |
char * | hostname, | ||
size_t | len | ||
) |
int css_get_sock_name | ( | SOCKET | sockfd, |
char * | hostname, | ||
size_t | len | ||
) |
unsigned int css_gethostid | ( | void | ) |
Definition at line 388 of file wintcp.c.
References ARG_FILE_LINE, CSS_ER_WINSOCK_HOSTID, CSS_ER_WINSOCK_HOSTNAME, css_windows_shutdown(), css_windows_startup(), css_Wsa_error, CUB_MAXHOSTNAMELEN, ER_CSS_WINSOCK_HOSTID, ER_CSS_WINSOCK_HOSTNAME, ER_ERROR_SEVERITY, er_set(), INADDR_NONE, and NULL.
int css_gethostname | ( | char * | name, |
size_t | namelen | ||
) |
Definition at line 349 of file wintcp.c.
References ARG_FILE_LINE, css_windows_shutdown(), css_windows_startup(), CUB_MAXHOSTNAMELEN, ER_ERROR_SEVERITY, ER_FAILED, ER_GAI_ERROR, er_set(), err, NO_ERROR, NULL, and strlen.
int css_hostname_to_ip | ( | const char * | host, |
unsigned char * | ip_addr | ||
) |
Definition at line 815 of file wintcp.c.
References ARG_FILE_LINE, css_windows_shutdown(), css_windows_startup(), ER_BO_UNABLE_TO_FIND_HOSTNAME, ER_CSS_WINSOCK_HOSTNAME, ER_CSS_WINSOCK_STARTUP, ER_ERROR_SEVERITY, er_set(), err, gethostbyname_lock, INADDR_NONE, NO_ERROR, NULL, pthread_mutex_lock, and pthread_mutex_unlock.
Definition at line 645 of file wintcp.c.
References ARG_FILE_LINE, css_accept(), ER_ERROR_SEVERITY, er_set_with_oserror(), ERR_CSS_TCP_ACCEPT_ERROR, INVALID_SOCKET, and IS_INVALID_SOCKET.
Definition at line 492 of file wintcp.c.
References ARG_FILE_LINE, CONTROLLEN, css_sockopt(), ER_ERROR_SEVERITY, er_set_with_oserror(), ERR_CSS_TCP_RECVMSG, INVALID_SOCKET, ntohs(), NULL, pid, rc, and TPRINTF.
int css_open_server_connection_socket | ( | void | ) |
Definition at line 657 of file wintcp.c.
References ARG_FILE_LINE, css_Maximum_server_count, css_Server_connection_socket, css_shutdown_socket(), css_windows_startup(), ER_ERROR_SEVERITY, er_set(), ERR_CSS_WINTCP_BIND_ABORT, ERR_CSS_WINTCP_CANNOT_CREATE_STREAM, error(), htonl(), IS_INVALID_SOCKET, ntohs(), prm_get_bool_value(), and PRM_ID_TCP_KEEPALIVE.
Definition at line 753 of file wintcp.c.
References css_accept(), and INVALID_SOCKET.
void css_shutdown_socket | ( | SOCKET | fd | ) |
Definition at line 292 of file wintcp.c.
References ARG_FILE_LINE, ER_ERROR_SEVERITY, ER_GENERIC_ERROR, er_set_with_oserror(), IS_INVALID_SOCKET, and rc.
Referenced by css_open_server_connection_socket(), and css_tcp_master_open().
Definition at line 164 of file wintcp.c.
References ARG_FILE_LINE, css_tcp_client_open_with_retry(), ER_ERROR_SEVERITY, er_set_with_oserror(), ERR_CSS_TCP_CANNOT_CONNECT_TO_MASTER, css_conn_entry::fd, and IS_INVALID_SOCKET.
Definition at line 184 of file wintcp.c.
References ARG_FILE_LINE, assert, css_sockaddr(), css_sockopt(), css_Tcp_max_connect_tries, ER_CSS_WINSOCK_HOSTNAME, ER_ERROR_SEVERITY, er_log_debug, er_set(), er_set_with_oserror(), err, ERR_CSS_TCP_CANNOT_CREATE_SOCKET, ERR_CSS_WINTCP_CANNOT_CREATE_STREAM, htons(), INADDR_NONE, INVALID_SOCKET, IS_INVALID_SOCKET, NO_ERROR, NULL, prm_get_bool_value(), prm_get_integer_value(), PRM_ID_TCP_CONNECTION_TIMEOUT, PRM_ID_TCP_KEEPALIVE, success(), and TCP_MIN_NUM_RETRIES.
Referenced by css_tcp_client_open().
Definition at line 462 of file wintcp.c.
References ARG_FILE_LINE, ER_ERROR_SEVERITY, er_set_with_oserror(), ERR_CSS_TCP_DATAGRAM_ACCEPT, and IS_INVALID_SOCKET.
Definition at line 477 of file wintcp.c.
References ARG_FILE_LINE, ER_ERROR_SEVERITY, er_log_debug, er_set_with_oserror(), ERR_CSS_TCP_DATAGRAM_CONNECT, ERR_CSS_TCP_DATAGRAM_SOCKET, INVALID_SOCKET, IS_INVALID_SOCKET, strlen, success(), and TCP_MIN_NUM_RETRIES.
int css_tcp_master_open | ( | int | port, |
SOCKET * | sockfd | ||
) |
Definition at line 523 of file wintcp.c.
References ARG_FILE_LINE, css_get_master_domain_path(), css_Maximum_server_count, css_shutdown_socket(), css_windows_startup(), ER_CSS_WINSOCK_STARTUP, ER_ERROR_SEVERITY, er_set(), er_set_with_oserror(), ERR_CSS_TCP_ACCEPT_ERROR, ERR_CSS_TCP_BIND_ABORT, ERR_CSS_TCP_CANNOT_CREATE_STREAM, ERR_CSS_TCP_PORT_ERROR, ERR_CSS_UNIX_DOMAIN_SOCKET_FILE_EXIST, ERR_CSS_WINTCP_BIND_ABORT, ERR_CSS_WINTCP_CANNOT_CREATE_STREAM, ERR_CSS_WINTCP_PORT_ERROR, htonl(), htons(), IS_INVALID_SOCKET, and NO_ERROR.
bool css_transfer_fd | ( | SOCKET | server_fd, |
SOCKET | client_fd, | ||
unsigned short | rid, | ||
CSS_SERVER_REQUEST | request | ||
) |
Definition at line 508 of file wintcp.c.
References ARG_FILE_LINE, CONTROLLEN, ER_ERROR_SEVERITY, er_set_with_oserror(), ERR_CSS_TCP_PASSING_FD, htonl(), htons(), and NULL.
bool css_windows_blocking_hook | ( | void | ) |
Definition at line 84 of file wintcp.c.
Referenced by css_windows_startup().
void css_windows_shutdown | ( | void | ) |
Definition at line 140 of file wintcp.c.
References err, NULL, old_hook, and wsa_Init_count.
Referenced by boot_shutdown_client(), css_gethostid(), css_gethostname(), css_hostname_to_ip(), css_init(), css_terminate(), main(), and net_server_start().
int css_windows_startup | ( | void | ) |
Definition at line 94 of file wintcp.c.
References ARG_FILE_LINE, CSS_ER_WINSOCK_BLOCKING_HOOK, CSS_ER_WINSOCK_NOERROR, CSS_ER_WINSOCK_STARTUP, css_windows_blocking_hook(), css_Wsa_error, ER_CSS_WINSOCK_STARTUP, ER_ERROR_SEVERITY, er_set(), err, max_socket_fds, NULL, old_hook, and wsa_Init_count.
Referenced by boot_restart_client(), css_client_init(), css_gethostid(), css_gethostname(), css_hostname_to_ip(), css_init(), css_open_server_connection_socket(), css_tcp_master_open(), main(), and net_server_start().
|
static |
Definition at line 55 of file wintcp.c.
Referenced by css_open_server_connection_socket(), and css_tcp_master_open().
|
static |
Definition at line 54 of file wintcp.c.
Referenced by css_tcp_client_open_with_retry().
|
static |
Definition at line 58 of file wintcp.c.
Referenced by css_gethostid(), and css_windows_startup().
|
static |
Definition at line 60 of file wintcp.c.
Referenced by css_get_max_socket_fds(), and css_windows_startup().
|
static |
Definition at line 59 of file wintcp.c.
Referenced by css_windows_shutdown(), and css_windows_startup().
|
static |
Definition at line 62 of file wintcp.c.
Referenced by css_windows_shutdown(), and css_windows_startup().