CUBRID Engine  latest
wintcp.c File Reference
#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"
Include dependency graph for wintcp.c:

Go to the source code of this file.

Macros

#define HOST_ID_ARRAY_SIZE   8
 

Functions

static unsigned int css_fd_error (SOCKET fd)
 
bool css_windows_blocking_hook (void)
 
int css_windows_startup (void)
 
void css_windows_shutdown (void)
 
SOCKET css_tcp_client_open (const char *host_name, int port)
 
SOCKET css_tcp_client_open_with_retry (const char *host_name, int port, bool will_retry)
 
void css_shutdown_socket (SOCKET fd)
 
int css_gethostname (char *name, size_t namelen)
 
unsigned int css_gethostid (void)
 
bool css_tcp_setup_server_datagram (char *pathname, SOCKET *sockfd)
 
bool css_tcp_listen_server_datagram (SOCKET sockfd, SOCKET *newfd)
 
bool css_tcp_master_datagram (char *pathname, SOCKET *sockfd)
 
SOCKET css_open_new_socket_from_master (SOCKET fd, unsigned short *rid)
 
bool css_transfer_fd (SOCKET server_fd, SOCKET client_fd, unsigned short rid, CSS_SERVER_REQUEST request)
 
int css_tcp_master_open (int port, SOCKET *sockfd)
 
static SOCKET css_accept (SOCKET sockfd)
 
SOCKET css_master_accept (SOCKET sockfd)
 
int css_open_server_connection_socket (void)
 
void css_close_server_connection_socket (void)
 
SOCKET css_server_accept (SOCKET sockfd)
 
int css_get_max_socket_fds (void)
 
int css_get_peer_name (SOCKET sockfd, char *hostname, size_t len)
 
int css_get_sock_name (SOCKET sockfd, char *hostname, size_t len)
 
int css_hostname_to_ip (const char *host, unsigned char *ip_addr)
 

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
 

Macro Definition Documentation

#define HOST_ID_ARRAY_SIZE   8

Definition at line 52 of file wintcp.c.

Function Documentation

static SOCKET css_accept ( SOCKET  sockfd)
static

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().

Here is the caller graph for this function:

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 unsigned int css_fd_error ( SOCKET  fd)
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 
)

Definition at line 771 of file wintcp.c.

References NULL.

int css_get_sock_name ( SOCKET  sockfd,
char *  hostname,
size_t  len 
)

Definition at line 793 of file wintcp.c.

References NULL.

int css_gethostname ( char *  name,
size_t  namelen 
)
SOCKET css_open_new_socket_from_master ( SOCKET  fd,
unsigned short *  rid 
)
SOCKET css_server_accept ( SOCKET  sockfd)

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().

Here is the caller graph for this function:

SOCKET css_tcp_client_open ( const char *  host_name,
int  port 
)
bool css_tcp_listen_server_datagram ( SOCKET  sockfd,
SOCKET newfd 
)
bool css_tcp_setup_server_datagram ( char *  pathname,
SOCKET sockfd 
)

Definition at line 447 of file wintcp.c.

bool css_transfer_fd ( SOCKET  server_fd,
SOCKET  client_fd,
unsigned short  rid,
CSS_SERVER_REQUEST  request 
)
bool css_windows_blocking_hook ( void  )

Definition at line 84 of file wintcp.c.

Referenced by css_windows_startup().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

Variable Documentation

const int css_Maximum_server_count = 1000
static

Definition at line 55 of file wintcp.c.

Referenced by css_open_server_connection_socket(), and css_tcp_master_open().

const int css_Tcp_max_connect_tries = 3
static

Definition at line 54 of file wintcp.c.

Referenced by css_tcp_client_open_with_retry().

int css_Wsa_error = CSS_ER_WINSOCK_NOERROR
static

Definition at line 58 of file wintcp.c.

Referenced by css_gethostid(), and css_windows_startup().

int max_socket_fds = _SYS_OPEN
static

Definition at line 60 of file wintcp.c.

Referenced by css_get_max_socket_fds(), and css_windows_startup().

FARPROC old_hook = NULL
static

Definition at line 59 of file wintcp.c.

Referenced by css_windows_shutdown(), and css_windows_startup().

unsigned int wsa_Init_count = 0
static

Definition at line 62 of file wintcp.c.

Referenced by css_windows_shutdown(), and css_windows_startup().