CUBRID Engine  latest
connection_cl.c File Reference
#include "config.h"
#include <filesystem>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <assert.h>
#include <math.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include "porting.h"
#include "error_manager.h"
#include "connection_globals.h"
#include "filesys.hpp"
#include "filesys_temp.hpp"
#include "memory_alloc.h"
#include "system_parameter.h"
#include "environment_variable.h"
#include "tcp.h"
#include "connection_list_cl.h"
#include "connection_cl.h"
#include "master_util.h"

Go to the source code of this file.

Macros

#define TRACE(string, arg1)
 

Functions

static void css_initialize_conn (CSS_CONN_ENTRY *conn, SOCKET fd)
 
static void css_close_conn (CSS_CONN_ENTRY *conn)
 
static void css_dealloc_conn (CSS_CONN_ENTRY *conn)
 
static int css_read_header (CSS_CONN_ENTRY *conn, NET_HEADER *local_header)
 
static CSS_CONN_ENTRYcss_common_connect (const char *host_name, CSS_CONN_ENTRY *conn, int connect_type, const char *server_name, int server_name_length, int port, int timeout, unsigned short *rid, bool send_magic)
 
static CSS_CONN_ENTRYcss_server_connect (char *host_name, CSS_CONN_ENTRY *conn, char *server_name, unsigned short *rid)
 
static CSS_CONN_ENTRYcss_server_connect_part_two (char *host_name, CSS_CONN_ENTRY *conn, int port_id, unsigned short *rid)
 
static int css_return_queued_data (CSS_CONN_ENTRY *conn, unsigned short request_id, char **buffer, int *buffer_size, int *rc)
 
static int css_return_queued_request (CSS_CONN_ENTRY *conn, unsigned short *rid, int *request, int *buffer_size)
 
void css_shutdown_conn (CSS_CONN_ENTRY *conn)
 
CSS_CONN_ENTRYcss_make_conn (SOCKET fd)
 
void css_free_conn (CSS_CONN_ENTRY *conn)
 
CSS_CONN_ENTRYcss_find_exception_conn (void)
 
CSS_CONN_ENTRYcss_find_conn_from_fd (SOCKET fd)
 
unsigned short css_get_request_id (CSS_CONN_ENTRY *conn)
 
int css_test_for_open_conn (CSS_CONN_ENTRY *conn)
 
int css_send_close_request (CSS_CONN_ENTRY *conn)
 
int css_read_one_request (CSS_CONN_ENTRY *conn, unsigned short *rid, int *request, int *buffer_size)
 
int css_receive_request (CSS_CONN_ENTRY *conn, unsigned short *rid, int *request, int *buffer_size)
 
int css_receive_data (CSS_CONN_ENTRY *conn, unsigned short req_id, char **buffer, int *buffer_size, int timeout)
 
int css_receive_error (CSS_CONN_ENTRY *conn, unsigned short req_id, char **buffer, int *buffer_size)
 
CSS_CONN_ENTRYcss_connect_to_master_server (int master_port_id, const char *server_name, int name_length)
 
CSS_CONN_ENTRYcss_connect_to_cubrid_server (char *host_name, char *server_name)
 
CSS_CONN_ENTRYcss_connect_to_master_for_info (const char *host_name, int port_id, unsigned short *rid)
 
CSS_CONN_ENTRYcss_connect_to_master_timeout (const char *host_name, int port_id, int timeout, unsigned short *rid)
 
bool css_does_master_exist (int port_id)
 
bool css_is_valid_request_id (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
char * css_return_data_buffer (CSS_CONN_ENTRY *conn, unsigned short request_id, int *buffer_size)
 
int css_return_queued_error (CSS_CONN_ENTRY *conn, unsigned short request_id, char **buffer, int *buffer_size, int *rc)
 
void css_remove_all_unexpected_packets (CSS_CONN_ENTRY *conn)
 

Variables

static CSS_CONN_ENTRYcss_Conn_anchor = NULL
 
static int css_Client_id = 0
 

Macro Definition Documentation

#define TRACE (   string,
  arg1 
)

Function Documentation

static void css_close_conn ( CSS_CONN_ENTRY conn)
static

Definition at line 187 of file connection_cl.c.

References css_initialize_conn(), css_shutdown_conn(), css_conn_entry::fd, and IS_INVALID_SOCKET.

Referenced by css_connect_to_cubrid_server(), and css_free_conn().

Here is the caller graph for this function:

static CSS_CONN_ENTRY * css_common_connect ( const char *  host_name,
CSS_CONN_ENTRY conn,
int  connect_type,
const char *  server_name,
int  server_name_length,
int  port,
int  timeout,
unsigned short *  rid,
bool  send_magic 
)
static
CSS_CONN_ENTRY* css_connect_to_master_for_info ( const char *  host_name,
int  port_id,
unsigned short *  rid 
)

Definition at line 1158 of file connection_cl.c.

References css_connect_to_master_timeout().

Referenced by main().

Here is the caller graph for this function:

CSS_CONN_ENTRY* css_connect_to_master_server ( int  master_port_id,
const char *  server_name,
int  name_length 
)

Definition at line 861 of file connection_cl.c.

Referenced by css_init(), and css_reestablish_connection_to_master().

Here is the caller graph for this function:

CSS_CONN_ENTRY* css_connect_to_master_timeout ( const char *  host_name,
int  port_id,
int  timeout,
unsigned short *  rid 
)

Definition at line 1175 of file connection_cl.c.

References css_common_connect(), css_make_conn(), INFO_REQUEST, and NULL.

Referenced by connect_to_master_for_server_monitor(), and css_connect_to_master_for_info().

Here is the caller graph for this function:

static void css_dealloc_conn ( CSS_CONN_ENTRY conn)
static

Definition at line 202 of file connection_cl.c.

References free_and_init, css_conn_entry::next, and p.

Referenced by css_free_conn().

Here is the caller graph for this function:

CSS_CONN_ENTRY* css_find_conn_from_fd ( SOCKET  fd)

Definition at line 256 of file connection_cl.c.

Referenced by css_default_server_timeout_fn(), and css_sprintf_conn_infoids().

Here is the caller graph for this function:

CSS_CONN_ENTRY* css_find_exception_conn ( void  )

Definition at line 245 of file connection_cl.c.

References NULL.

Referenced by css_handle_pipe_shutdown().

Here is the caller graph for this function:

unsigned short css_get_request_id ( CSS_CONN_ENTRY conn)

Definition at line 277 of file connection_cl.c.

Referenced by css_send_request_with_data_buffer().

Here is the caller graph for this function:

static bool css_is_valid_request_id ( CSS_CONN_ENTRY conn,
unsigned short  request_id 
)

Definition at line 1222 of file connection_cl.c.

References css_conn_entry::abort_queue, css_find_queue_entry(), css_conn_entry::data_queue, css_conn_entry::error_queue, NULL, and css_conn_entry::request_queue.

Referenced by css_get_request_id().

Here is the caller graph for this function:

int css_read_one_request ( CSS_CONN_ENTRY conn,
unsigned short *  rid,
int *  request,
int *  buffer_size 
)
int css_receive_request ( CSS_CONN_ENTRY conn,
unsigned short *  rid,
int *  request,
int *  buffer_size 
)

Definition at line 455 of file connection_cl.c.

Referenced by css_internal_request_handler(), css_process_info_request(), and css_process_new_connection().

Here is the caller graph for this function:

void css_remove_all_unexpected_packets ( CSS_CONN_ENTRY conn)

Definition at line 1467 of file connection_cl.c.

Referenced by css_cleanup_client_queues(), css_cleanup_server_queues(), css_end_server_request(), and css_send_close_request().

Here is the caller graph for this function:

char* css_return_data_buffer ( CSS_CONN_ENTRY conn,
unsigned short  request_id,
int *  buffer_size 
)
static int css_return_queued_data ( CSS_CONN_ENTRY conn,
unsigned short  request_id,
char **  buffer,
int *  buffer_size,
int *  rc 
)
static
int css_return_queued_error ( CSS_CONN_ENTRY conn,
unsigned short  request_id,
char **  buffer,
int *  buffer_size,
int *  rc 
)

Definition at line 1364 of file connection_cl.c.

Referenced by css_receive_error(), css_test_for_client_errors(), and css_test_for_server_errors().

Here is the caller graph for this function:

static CSS_CONN_ENTRY * css_server_connect ( char *  host_name,
CSS_CONN_ENTRY conn,
char *  server_name,
unsigned short *  rid 
)
static

Definition at line 776 of file connection_cl.c.

References css_common_connect(), css_Service_id, DATA_REQUEST, prm_get_integer_value(), PRM_ID_TCP_CONNECTION_TIMEOUT, and strlen.

Referenced by css_connect_to_cubrid_server().

Here is the caller graph for this function:

static CSS_CONN_ENTRY * css_server_connect_part_two ( char *  host_name,
CSS_CONN_ENTRY conn,
int  port_id,
unsigned short *  rid 
)
static
void css_shutdown_conn ( CSS_CONN_ENTRY conn)
int css_test_for_open_conn ( CSS_CONN_ENTRY conn)

Definition at line 313 of file connection_cl.c.

References CONN_OPEN, and css_conn_entry::status.

Referenced by css_return_open_entry().

Here is the caller graph for this function:

Variable Documentation

int css_Client_id = 0
static

Definition at line 99 of file connection_cl.c.

Referenced by css_initialize_conn().

CSS_CONN_ENTRY* css_Conn_anchor = NULL
static

Definition at line 98 of file connection_cl.c.

Referenced by css_make_conn().