CUBRID Engine  latest
shard_proxy_io.c File Reference
#include <assert.h>
#include <signal.h>
#include <string.h>
#include "porting.h"
#include "shard_proxy_io.h"
#include "shard_proxy_handler.h"
#include "shard_proxy_function.h"
#include "cas_protocol.h"
#include "cas_error.h"
#include "shard_shm.h"
#include "broker_acl.h"
Include dependency graph for shard_proxy_io.c:

Go to the source code of this file.

Macros

#define min(a, b)   ((a) < (b) ? (a) : (b))
 
#define max(a, b)   ((a) > (b) ? (a) : (b))
 
#define PROC_TYPE_CLIENT   0
 
#define PROC_TYPE_CAS   1
 
#define PROC_TYPE_BROKER   2
 
#define READ_TYPE   1
 
#define WRITE_TYPE   2
 
#define CLIENT_READ_ERROR(i)   io_error(i, PROC_TYPE_CLIENT, READ_TYPE)
 
#define CLIENT_WRITE_ERROR(i)   io_error(i, PROC_TYPE_CLIENT, WRITE_TYPE)
 
#define CAS_READ_ERROR(i)   io_error(i, PROC_TYPE_CAS, READ_TYPE)
 
#define CAS_WRITE_ERROR(i)   io_error(i, PROC_TYPE_CAS, WRITE_TYPE)
 
#define MAX_NUM_NEW_CLIENT   5
 
#define PROXY_START_PORT   1
 
#define GET_CLIENT_PORT(broker_port, proxy_index)   (broker_port) + PROXY_START_PORT + (proxy_index)
 
#define GET_CAS_PORT(broker_port, proxy_index, proxy_max_count)   (broker_port) + PROXY_START_PORT + (proxy_max_count) + (proxy_index)
 

Typedefs

typedef T_CAS_IO *(* T_FUNC_FIND_CAS) (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid)
 

Functions

void proxy_term (void)
 
const char * rel_build_number (void)
 
static int shard_io_set_fl (int fd, int flags)
 
static void proxy_socket_io_clear (T_SOCKET_IO *sock_io_p)
 
static int proxy_socket_io_initialize (void)
 
static void proxy_socket_io_destroy (void)
 
static T_SOCKET_IOproxy_socket_io_add (SOCKET fd, bool from_cas)
 
static T_SOCKET_IOproxy_socket_io_find (SOCKET fd)
 
static int proxy_socket_io_new_client (SOCKET lsnr_fd)
 
static int proxy_process_client_register (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_client_request (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_client_conn_error (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_client_write_error (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_client_read_error (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_client_message (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_cas_register (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_cas_response (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_cas_conn_error (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_cas_write_error (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_cas_read_error (T_SOCKET_IO *sock_io_p)
 
static int proxy_process_cas_message (T_SOCKET_IO *sock_io_p)
 
static int proxy_socket_io_write_internal (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_write_to_cas (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_write_to_client (T_SOCKET_IO *sock_io_p)
 
static int proxy_socket_io_read_internal (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_read_from_cas_next (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_read_from_cas_first (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_read_from_cas (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_read_from_client_next (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_read_from_client_first (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_read_from_client (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_write (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_write_error (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_read (T_SOCKET_IO *sock_io_p)
 
static void proxy_socket_io_read_error (T_SOCKET_IO *sock_io_p)
 
static int proxy_client_io_initialize (void)
 
static void proxy_client_io_destroy (void)
 
static T_CLIENT_IOproxy_client_io_new (SOCKET fd, char *driver_info)
 
static int proxy_cas_io_initialize (int shard_id, T_CAS_IO **cas_io_pp, int size)
 
static int proxy_shard_io_initialize (void)
 
static void proxy_shard_io_destroy (void)
 
static T_SHARD_IOproxy_shard_io_find (int shard_id)
 
static T_CAS_IOproxy_cas_io_new (int shard_id, int cas_id, SOCKET fd)
 
static void proxy_cas_io_free (int shard_id, int cas_id)
 
static T_CAS_IOproxy_cas_io_find_by_fd (int shard_id, int cas_id, SOCKET fd)
 
static int proxy_client_add_waiter_by_shard (T_SHARD_IO *shard_io_p, int ctx_cid, int ctx_uid, int timeout)
 
static void proxy_client_check_waiter_and_wakeup (T_SHARD_IO *shard_io_p, T_CAS_IO *cas_io_p)
 
static SOCKET proxy_io_connect_to_broker (void)
 
static int proxy_io_register_to_broker (void)
 
static int proxy_io_unixd_lsnr (char *unixd_sock_name)
 
static int proxy_io_cas_lsnr (void)
 
static SOCKET proxy_io_accept (SOCKET lsnr_fd)
 
static SOCKET proxy_io_cas_accept (SOCKET lsnr_fd)
 
static void proxy_init_net_buf (T_NET_BUF *net_buf)
 
static int proxy_io_make_ex_get_int (char *driver_info, char **buffer, int *argv)
 
static void proxy_set_conn_info (int func_code, int ctx_cid, int ctx_uid, int shard_id, int cas_id)
 
static T_CAS_IOproxy_find_idle_cas_by_asc (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid)
 
static T_CAS_IOproxy_find_idle_cas_by_desc (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid)
 
static T_CAS_IOproxy_find_idle_cas_by_conn_info (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid)
 
static T_CAS_IOproxy_cas_alloc_by_shard_and_cas_id (int client_id, int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid)
 
static T_CAS_IOproxy_cas_alloc_anything (int client_id, int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid, T_FUNC_FIND_CAS function)
 
static int proxy_check_authorization (T_PROXY_CONTEXT *ctx_p, const char *db_name, const char *db_user, const char *db_passwd)
 
void init_msg_header (MSG_HEADER *header)
 
void set_data_length (char *buffer, int length)
 
int get_data_length (char *buffer)
 
int get_msg_length (char *buffer)
 
static int get_dbinfo_length (char *driver_info)
 
int net_decode_str (char *msg, int msg_size, char *func_code, void ***ret_argv)
 
char * proxy_dup_msg (char *msg)
 
void proxy_set_con_status_in_tran (char *msg)
 
void proxy_set_con_status_out_tran (char *msg)
 
void proxy_set_force_out_tran (char *msg)
 
void proxy_unset_force_out_tran (char *msg)
 
int proxy_make_net_buf (T_NET_BUF *net_buf, int size, T_BROKER_VERSION client_version)
 
int proxy_io_make_error_msg (char *driver_info, char **buffer, int error_ind, int error_code, const char *error_msg, char is_in_tran)
 
int proxy_io_make_no_error (char *driver_info, char **buffer)
 
int proxy_io_make_con_close_ok (char *driver_info, char **buffer)
 
int proxy_io_make_end_tran_ok (char *driver_info, char **buffer)
 
int proxy_io_make_check_cas_ok (char *driver_info, char **buffer)
 
int proxy_io_make_set_db_parameter_ok (char *driver_info, char **buffer)
 
int proxy_io_make_ex_get_isolation_level (char *driver_info, char **buffer, void *argv)
 
int proxy_io_make_ex_get_lock_timeout (char *driver_info, char **buffer, void *argv)
 
int proxy_io_make_end_tran_request (char *driver_info, char **buffer, bool commit)
 
int proxy_io_make_end_tran_abort (char *driver_info, char **buffer)
 
int proxy_io_make_close_req_handle_ok (char *driver_info, char **buffer, bool is_in_tran)
 
int proxy_io_make_close_req_handle_out_tran_ok (char *driver_info, char **buffer)
 
int proxy_io_make_cursor_close_out_tran_ok (char *driver_info, char **buffer)
 
int proxy_io_make_get_db_version (char *driver_info, char **buffer)
 
int proxy_io_make_client_conn_ok (char *driver_info, char **buffer)
 
int proxy_io_make_client_proxy_alive (char *driver_info, char **buffer)
 
int proxy_io_make_client_dbinfo_ok (char *driver_info, char **buffer)
 
int proxy_io_make_client_acl_fail (char *driver_info, char **buffer)
 
int proxy_io_make_shard_info (char *driver_info, char **buffer)
 
int proxy_io_make_check_cas (char *driver_info, char **buffer)
 
void proxy_io_buffer_clear (T_IO_BUFFER *io_buffer)
 
int proxy_socket_io_delete (SOCKET fd)
 
int proxy_io_set_established_by_ctx (T_PROXY_CONTEXT *ctx_p)
 
int proxy_socket_set_write_event (T_SOCKET_IO *sock_io_p, T_PROXY_EVENT *event_p)
 
char * proxy_str_client_io (T_CLIENT_IO *cli_io_p)
 
void proxy_client_io_free (T_CLIENT_IO *cli_io_p)
 
void proxy_client_io_free_by_ctx (int client_id, int ctx_cid, int ctx_uid)
 
T_CLIENT_IOproxy_client_io_find_by_ctx (int client_id, int ctx_cid, unsigned int ctx_uid)
 
T_CLIENT_IOproxy_client_io_find_by_fd (int client_id, SOCKET fd)
 
int proxy_client_io_write (T_CLIENT_IO *cli_io_p, T_PROXY_EVENT *event_p)
 
int proxy_cas_io_write (T_CAS_IO *cas_io_p, T_PROXY_EVENT *event_p)
 
char * proxy_str_cas_io (T_CAS_IO *cas_io_p)
 
void proxy_cas_io_free_by_ctx (int shard_id, int cas_id, int ctx_cid, int unsigned ctx_uid)
 
T_CAS_IOproxy_cas_find_io_by_ctx (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid)
 
T_CAS_IOproxy_cas_alloc_by_ctx (int client_id, int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid, int timeout, int func_code)
 
void proxy_cas_release_by_ctx (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid)
 
int proxy_io_initialize (void)
 
void proxy_io_destroy (void)
 
int proxy_io_close_all_fd (void)
 
int proxy_io_process (void)
 
char * proxy_get_driver_info_by_ctx (T_PROXY_CONTEXT *ctx_p)
 
char * proxy_get_driver_info_by_fd (T_SOCKET_IO *sock_io_p)
 
void proxy_available_cas_wait_timer (void)
 
int proxy_convert_error_code (int error_ind, int error_code, char *driver_info, T_BROKER_VERSION client_version, bool to_new)
 

Variables

T_SHM_APPL_SERVERshm_as_p
 
T_SHM_PROXYshm_proxy_p
 
T_PROXY_INFOproxy_info_p
 
T_SHM_SHARD_USERshm_user_p
 
T_SHM_SHARD_CONNshm_conn_p
 
int proxy_id
 
T_PROXY_HANDLER proxy_Handler
 
T_PROXY_CONTEXT proxy_Context
 
bool proxy_Keep_running
 
int maxfd = 0
 
fd_set rset
 
fd_set wset
 
fd_set allset
 
fd_set wnewset
 
fd_set wallset
 
SOCKET broker_conn_fd = INVALID_SOCKET
 
SOCKET cas_lsnr_fd = INVALID_SOCKET
 
T_SOCKET_IO_GLOBAL proxy_Socket_io
 
T_CLIENT_IO_GLOBAL proxy_Client_io
 
T_SHARD_IO_GLOBAL proxy_Shard_io
 
int cas_info_size = CAS_INFO_SIZE
 

Macro Definition Documentation

#define CAS_READ_ERROR (   i)    io_error(i, PROC_TYPE_CAS, READ_TYPE)

Definition at line 71 of file shard_proxy_io.c.

#define CAS_WRITE_ERROR (   i)    io_error(i, PROC_TYPE_CAS, WRITE_TYPE)

Definition at line 72 of file shard_proxy_io.c.

#define CLIENT_READ_ERROR (   i)    io_error(i, PROC_TYPE_CLIENT, READ_TYPE)

Definition at line 69 of file shard_proxy_io.c.

#define CLIENT_WRITE_ERROR (   i)    io_error(i, PROC_TYPE_CLIENT, WRITE_TYPE)

Definition at line 70 of file shard_proxy_io.c.

#define GET_CAS_PORT (   broker_port,
  proxy_index,
  proxy_max_count 
)    (broker_port) + PROXY_START_PORT + (proxy_max_count) + (proxy_index)

Definition at line 78 of file shard_proxy_io.c.

Referenced by proxy_io_cas_lsnr().

#define GET_CLIENT_PORT (   broker_port,
  proxy_index 
)    (broker_port) + PROXY_START_PORT + (proxy_index)

Definition at line 77 of file shard_proxy_io.c.

Referenced by proxy_io_cas_lsnr().

#define MAX_NUM_NEW_CLIENT   5

Definition at line 74 of file shard_proxy_io.c.

#define PROC_TYPE_BROKER   2

Definition at line 64 of file shard_proxy_io.c.

#define PROC_TYPE_CAS   1

Definition at line 63 of file shard_proxy_io.c.

#define PROC_TYPE_CLIENT   0

Definition at line 62 of file shard_proxy_io.c.

#define PROXY_START_PORT   1

Definition at line 76 of file shard_proxy_io.c.

#define READ_TYPE   1

Definition at line 66 of file shard_proxy_io.c.

#define WRITE_TYPE   2

Definition at line 67 of file shard_proxy_io.c.

Typedef Documentation

typedef T_CAS_IO*(* T_FUNC_FIND_CAS) (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid)

Definition at line 90 of file shard_proxy_io.c.

Function Documentation

int get_data_length ( char *  buffer)

Definition at line 238 of file shard_proxy_io.c.

References assert, and ntohl().

Referenced by get_msg_length(), and proxy_handler_process_client_request().

Here is the caller graph for this function:

static int get_dbinfo_length ( char *  driver_info)
static

Definition at line 256 of file shard_proxy_io.c.

References CAS_MAKE_PROTO_VER, CAS_MAKE_VER, SRV_CON_DB_INFO_SIZE, SRV_CON_DB_INFO_SIZE_PRIOR_8_2_0, and SRV_CON_DB_INFO_SIZE_PRIOR_8_4_0.

Referenced by proxy_socket_io_read_from_client_first().

Here is the caller graph for this function:

int net_decode_str ( char *  msg,
int  msg_size,
char *  func_code,
void ***  ret_argv 
)
void proxy_available_cas_wait_timer ( void  )
static T_CAS_IO * proxy_cas_alloc_anything ( int  client_id,
int  shard_id,
int  cas_id,
int  ctx_cid,
unsigned int  ctx_uid,
T_FUNC_FIND_CAS  function 
)
static
static T_CAS_IO * proxy_cas_alloc_by_shard_and_cas_id ( int  client_id,
int  shard_id,
int  cas_id,
int  ctx_cid,
unsigned int  ctx_uid 
)
static
T_CAS_IO* proxy_cas_find_io_by_ctx ( int  shard_id,
int  cas_id,
int  ctx_cid,
unsigned int  ctx_uid 
)
static T_CAS_IO * proxy_cas_io_find_by_fd ( int  shard_id,
int  cas_id,
SOCKET  fd 
)
static
static int proxy_cas_io_initialize ( int  shard_id,
T_CAS_IO **  cas_io_pp,
int  size 
)
static
static int proxy_check_authorization ( T_PROXY_CONTEXT ctx_p,
const char *  db_name,
const char *  db_user,
const char *  db_passwd 
)
static
static int proxy_client_add_waiter_by_shard ( T_SHARD_IO shard_io_p,
int  ctx_cid,
int  ctx_uid,
int  timeout 
)
static
static void proxy_client_check_waiter_and_wakeup ( T_SHARD_IO shard_io_p,
T_CAS_IO cas_io_p 
)
static
T_CLIENT_IO* proxy_client_io_find_by_ctx ( int  client_id,
int  ctx_cid,
unsigned int  ctx_uid 
)
T_CLIENT_IO* proxy_client_io_find_by_fd ( int  client_id,
SOCKET  fd 
)
void proxy_client_io_free_by_ctx ( int  client_id,
int  ctx_cid,
int  ctx_uid 
)

Definition at line 3083 of file shard_proxy_io.c.

References NULL, proxy_client_io_find_by_ctx(), and proxy_client_io_free().

Referenced by proxy_context_free_client().

Here is the caller graph for this function:

int proxy_client_io_write ( T_CLIENT_IO cli_io_p,
T_PROXY_EVENT event_p 
)
char* proxy_dup_msg ( char *  msg)

Definition at line 440 of file shard_proxy_io.c.

References get_msg_length(), and p.

Referenced by fn_proxy_cas_prepare(), proxy_client_execute_internal(), proxy_send_prepared_stmt_to_client(), and shard_stmt_save_prepare_request().

Here is the caller graph for this function:

static T_CAS_IO * proxy_find_idle_cas_by_asc ( int  shard_id,
int  cas_id,
int  ctx_cid,
unsigned int  ctx_uid 
)
static

Definition at line 4666 of file shard_proxy_io.c.

References CAS_IO_CONNECTED, t_shard_io::cur_num_cas, t_shard_io::ent, t_shard_io_global::ent, i, t_cas_io::is_in_tran, NULL, and t_cas_io::status.

Referenced by proxy_cas_alloc_by_ctx().

Here is the caller graph for this function:

static T_CAS_IO * proxy_find_idle_cas_by_conn_info ( int  shard_id,
int  cas_id,
int  ctx_cid,
unsigned int  ctx_uid 
)
static
static T_CAS_IO * proxy_find_idle_cas_by_desc ( int  shard_id,
int  cas_id,
int  ctx_cid,
unsigned int  ctx_uid 
)
static

Definition at line 4690 of file shard_proxy_io.c.

References CAS_IO_CONNECTED, t_shard_io::cur_num_cas, t_shard_io::ent, t_shard_io_global::ent, i, t_cas_io::is_in_tran, NULL, and t_cas_io::status.

Referenced by proxy_cas_alloc_by_ctx().

Here is the caller graph for this function:

static SOCKET proxy_io_accept ( SOCKET  lsnr_fd)
static

Definition at line 4110 of file shard_proxy_io.c.

References IS_INVALID_SOCKET, and shard_sock_addr.

Referenced by proxy_io_cas_accept().

Here is the caller graph for this function:

void proxy_io_buffer_clear ( T_IO_BUFFER io_buffer)

Definition at line 1123 of file shard_proxy_io.c.

References assert, t_io_buffer::data, FREE_MEM, t_io_buffer::length, and t_io_buffer::offset.

Referenced by proxy_event_free().

Here is the caller graph for this function:

static SOCKET proxy_io_cas_accept ( SOCKET  lsnr_fd)
static

Definition at line 4135 of file shard_proxy_io.c.

References proxy_io_accept().

Referenced by proxy_io_process().

Here is the caller graph for this function:

int proxy_io_close_all_fd ( void  )

Definition at line 4254 of file shard_proxy_io.c.

References broker_conn_fd, cas_lsnr_fd, CLOSE_SOCKET, t_socket_io_global::ent, t_socket_io::fd, i, INVALID_SOCKET, and t_socket_io_global::max_socket.

Referenced by proxy_io_destroy().

Here is the caller graph for this function:

static SOCKET proxy_io_connect_to_broker ( void  )
static

Definition at line 3858 of file shard_proxy_io.c.

References CLOSESOCKET, NULL, t_shm_appl_server::port_name, PROXY_LOG, PROXY_LOG_MODE_NOTICE, and strlen.

Referenced by proxy_io_register_to_broker().

Here is the caller graph for this function:

void proxy_io_destroy ( void  )

Definition at line 4239 of file shard_proxy_io.c.

References FREE_MEM, proxy_client_io_destroy(), proxy_io_close_all_fd(), proxy_shard_io_destroy(), and proxy_socket_io_destroy().

Referenced by proxy_term().

Here is the caller graph for this function:

int proxy_io_make_check_cas ( char *  driver_info,
char **  buffer 
)
int proxy_io_make_check_cas_ok ( char *  driver_info,
char **  buffer 
)

Definition at line 682 of file shard_proxy_io.c.

References proxy_io_make_no_error().

Referenced by fn_proxy_client_check_cas().

Here is the caller graph for this function:

int proxy_io_make_client_acl_fail ( char *  driver_info,
char **  buffer 
)
int proxy_io_make_client_conn_ok ( char *  driver_info,
char **  buffer 
)

Definition at line 878 of file shard_proxy_io.c.

References NULL.

Referenced by proxy_socket_io_new_client().

Here is the caller graph for this function:

int proxy_io_make_client_proxy_alive ( char *  driver_info,
char **  buffer 
)
int proxy_io_make_close_req_handle_out_tran_ok ( char *  driver_info,
char **  buffer 
)

Definition at line 820 of file shard_proxy_io.c.

References proxy_io_make_close_req_handle_ok().

Referenced by fn_proxy_client_close_req_handle().

Here is the caller graph for this function:

int proxy_io_make_con_close_ok ( char *  driver_info,
char **  buffer 
)

Definition at line 670 of file shard_proxy_io.c.

References proxy_io_make_no_error().

Referenced by fn_proxy_cas_end_tran(), and fn_proxy_client_con_close().

Here is the caller graph for this function:

int proxy_io_make_cursor_close_out_tran_ok ( char *  driver_info,
char **  buffer 
)

Definition at line 826 of file shard_proxy_io.c.

References proxy_io_make_close_req_handle_ok().

Referenced by fn_proxy_client_cursor_close().

Here is the caller graph for this function:

int proxy_io_make_end_tran_abort ( char *  driver_info,
char **  buffer 
)

Definition at line 759 of file shard_proxy_io.c.

References proxy_io_make_end_tran_request().

Referenced by fn_proxy_client_con_close(), and fn_proxy_client_conn_error().

Here is the caller graph for this function:

int proxy_io_make_end_tran_ok ( char *  driver_info,
char **  buffer 
)

Definition at line 676 of file shard_proxy_io.c.

References proxy_io_make_no_error().

Referenced by fn_proxy_client_end_tran().

Here is the caller graph for this function:

static int proxy_io_make_ex_get_int ( char *  driver_info,
char **  buffer,
int *  argv 
)
static
int proxy_io_make_ex_get_isolation_level ( char *  driver_info,
char **  buffer,
void *  argv 
)

Definition at line 694 of file shard_proxy_io.c.

References proxy_io_make_ex_get_int().

Referenced by fn_proxy_client_get_db_parameter().

Here is the caller graph for this function:

int proxy_io_make_ex_get_lock_timeout ( char *  driver_info,
char **  buffer,
void *  argv 
)

Definition at line 700 of file shard_proxy_io.c.

References proxy_io_make_ex_get_int().

Referenced by fn_proxy_client_get_db_parameter().

Here is the caller graph for this function:

int proxy_io_make_get_db_version ( char *  driver_info,
char **  buffer 
)
int proxy_io_make_no_error ( char *  driver_info,
char **  buffer 
)

Definition at line 664 of file shard_proxy_io.c.

References CAS_NO_ERROR, NULL, and proxy_io_make_error_msg().

Referenced by proxy_io_make_check_cas_ok(), proxy_io_make_con_close_ok(), proxy_io_make_end_tran_ok(), and proxy_io_make_set_db_parameter_ok().

Here is the caller graph for this function:

int proxy_io_make_set_db_parameter_ok ( char *  driver_info,
char **  buffer 
)

Definition at line 688 of file shard_proxy_io.c.

References proxy_io_make_no_error().

Referenced by fn_proxy_client_set_db_parameter().

Here is the caller graph for this function:

static int proxy_io_register_to_broker ( void  )
static
static int proxy_io_unixd_lsnr ( char *  unixd_sock_name)
static

Definition at line 3995 of file shard_proxy_io.c.

References CLOSESOCKET, and strlen.

Referenced by proxy_io_cas_lsnr().

Here is the caller graph for this function:

static int proxy_process_cas_message ( T_SOCKET_IO sock_io_p)
static

Definition at line 2389 of file shard_proxy_io.c.

References assert, error(), proxy_process_cas_register(), proxy_process_cas_response(), SOCK_IO_ESTABLISHED, SOCK_IO_REG_WAIT, and t_socket_io::status.

Referenced by proxy_socket_io_read_from_cas_next().

Here is the caller graph for this function:

int proxy_process_cas_read_error ( T_SOCKET_IO sock_io_p)
static

Definition at line 2356 of file shard_proxy_io.c.

References assert, CLOSE_SOCKET, error(), t_socket_io::fd, INVALID_SOCKET, NULL, proxy_event_free(), proxy_process_cas_conn_error(), and t_socket_io::read_event.

Referenced by proxy_socket_io_read_error().

Here is the caller graph for this function:

int proxy_process_cas_write_error ( T_SOCKET_IO sock_io_p)
static
static int proxy_process_client_message ( T_SOCKET_IO sock_io_p)
static
static int proxy_process_client_read_error ( T_SOCKET_IO sock_io_p)
static

Definition at line 2005 of file shard_proxy_io.c.

References assert, CLOSE_SOCKET, error(), t_socket_io::fd, INVALID_SOCKET, NULL, proxy_event_free(), proxy_process_client_conn_error(), and t_socket_io::read_event.

Referenced by proxy_socket_io_read_error().

Here is the caller graph for this function:

static int proxy_process_client_register ( T_SOCKET_IO sock_io_p)
static

Definition at line 1609 of file shard_proxy_io.c.

References t_shm_appl_server::access_control, access_control_check_right(), t_shm_appl_server::access_log, assert, t_proxy_event::buffer, CAS_ER_NOT_AUTHORIZED_CLIENT, CAS_MAKE_PROTO_VER, CAS_MAKE_VER, CAS_NO_ERROR, CAS_PROTO_TO_VER_STR, CAS_PROTO_VER_MASK, CAS_VER_TO_MAJOR, CAS_VER_TO_MINOR, CAS_VER_TO_PATCH, t_proxy_event::cid, t_proxy_handler::cli_rcv_q, t_socket_io::client_id, t_io_buffer::data, db_name, DBMS_ERROR_INDICATOR, DOES_CLIENT_UNDERSTAND_THE_PROTOCOL, t_client_info::driver_version, ENTER_FUNC, error(), EXIT_FUNC, t_socket_io::fd, t_proxy_info::fixed_shard_user, HEALTH_CHECK_DUMMY_DB, t_socket_io::id, t_socket_io::ip_addr, NULL, t_proxy_info::num_connect_rejected, ON, PROTOCOL_V1, PROTOCOL_V5, proxy_access_log(), proxy_check_authorization(), proxy_context_clear_error(), proxy_context_find_by_socket_client_io(), proxy_context_free(), proxy_context_send_error(), proxy_context_set_error_with_msg(), PROXY_DEBUG_LOG, PROXY_EVENT_CLIENT_REQUEST, proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_event_new_with_rsp(), proxy_event_set_context(), proxy_get_driver_info_by_fd(), proxy_io_make_check_cas(), proxy_io_make_client_dbinfo_ok(), proxy_io_make_client_proxy_alive(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_socket_io_read_error(), proxy_socket_set_write_event(), proxy_str_context(), proxy_str_event(), read_buffer(), t_socket_io::read_event, shard_queue_enqueue(), shard_shm_get_client_info(), SOCK_IO_ESTABLISHED, SRV_CON_DBNAME_SIZE, SRV_CON_DBPASSWD_SIZE, SRV_CON_DBSESS_ID_SIZE, SRV_CON_DBUSER_SIZE, SRV_CON_URL_SIZE, SRV_CON_VER_STR_MAX_SIZE, t_socket_io::status, strlen, and strncpy_bufsize.

Referenced by proxy_process_client_message().

Here is the caller graph for this function:

static int proxy_process_client_write_error ( T_SOCKET_IO sock_io_p)
static

Definition at line 1982 of file shard_proxy_io.c.

References CLOSE_SOCKET, error(), t_socket_io::fd, INVALID_SOCKET, NULL, proxy_event_free(), proxy_process_client_conn_error(), and t_socket_io::write_event.

Referenced by proxy_socket_io_write_error().

Here is the caller graph for this function:

void proxy_set_con_status_in_tran ( char *  msg)

Definition at line 457 of file shard_proxy_io.c.

References assert, CAS_INFO_STATUS, CAS_INFO_STATUS_ACTIVE, and MSG_HEADER_INFO_SIZE.

Referenced by fn_proxy_cas_prepare(), fn_proxy_client_check_cas(), and proxy_io_make_error_msg().

Here is the caller graph for this function:

void proxy_set_con_status_out_tran ( char *  msg)
static void proxy_set_conn_info ( int  func_code,
int  ctx_cid,
int  ctx_uid,
int  shard_id,
int  cas_id 
)
static
void proxy_set_force_out_tran ( char *  msg)

Definition at line 485 of file shard_proxy_io.c.

References assert, CAS_INFO_ADDITIONAL_FLAG, CAS_INFO_FLAG_MASK_FORCE_OUT_TRAN, and MSG_HEADER_INFO_SIZE.

Referenced by fn_proxy_client_check_cas(), fn_proxy_client_prepare(), and proxy_io_make_check_cas().

Here is the caller graph for this function:

static T_SHARD_IO * proxy_shard_io_find ( int  shard_id)
static

Definition at line 3362 of file shard_proxy_io.c.

References t_shard_io_global::ent, t_shard_io_global::max_shard, NULL, and PROXY_DEBUG_LOG.

Referenced by proxy_process_cas_register().

Here is the caller graph for this function:

static T_SOCKET_IO * proxy_socket_io_find ( SOCKET  fd)
static

Definition at line 1449 of file shard_proxy_io.c.

References assert, t_socket_io_global::ent, NULL, SOCK_IO_IDLE, and t_socket_io::status.

Referenced by proxy_cas_io_write(), proxy_client_io_write(), and proxy_io_set_established_by_ctx().

Here is the caller graph for this function:

static int proxy_socket_io_initialize ( void  )
static
static void proxy_socket_io_read_from_cas ( T_SOCKET_IO sock_io_p)
static
static void proxy_socket_io_read_from_cas_first ( T_SOCKET_IO sock_io_p)
static
static void proxy_socket_io_read_from_cas_next ( T_SOCKET_IO sock_io_p)
static
static void proxy_socket_io_read_from_client ( T_SOCKET_IO sock_io_p)
static
static void proxy_socket_io_read_from_client_first ( T_SOCKET_IO sock_io_p)
static
static void proxy_socket_io_read_from_client_next ( T_SOCKET_IO sock_io_p)
static
static void proxy_socket_io_write ( T_SOCKET_IO sock_io_p)
static
static void proxy_socket_io_write_error ( T_SOCKET_IO sock_io_p)
static
static int proxy_socket_io_write_internal ( T_SOCKET_IO sock_io_p)
static
static void proxy_socket_io_write_to_cas ( T_SOCKET_IO sock_io_p)
static

Definition at line 2493 of file shard_proxy_io.c.

References assert, proxy_socket_io_write_error(), and proxy_socket_io_write_internal().

Referenced by proxy_socket_io_write().

Here is the caller graph for this function:

int proxy_socket_set_write_event ( T_SOCKET_IO sock_io_p,
T_PROXY_EVENT event_p 
)
char* proxy_str_client_io ( T_CLIENT_IO cli_io_p)
void proxy_term ( void  )

Definition at line 65 of file shard_proxy.c.

References proxy_access_log_close(), proxy_handler_destroy(), proxy_io_destroy(), proxy_log_close(), shard_stmt_destroy(), and SLEEP_MILISEC.

Referenced by cleanup(), and main().

Here is the caller graph for this function:

void proxy_unset_force_out_tran ( char *  msg)

Definition at line 499 of file shard_proxy_io.c.

References assert, CAS_INFO_ADDITIONAL_FLAG, CAS_INFO_FLAG_MASK_FORCE_OUT_TRAN, and MSG_HEADER_INFO_SIZE.

Referenced by proxy_client_execute_internal(), and proxy_handler_process_client_request().

Here is the caller graph for this function:

const char* rel_build_number ( void  )
static int shard_io_set_fl ( int  fd,
int  flags 
)
static

Definition at line 326 of file shard_proxy_io.c.

References PROXY_LOG, and PROXY_LOG_MODE_ERROR.

Referenced by proxy_io_cas_lsnr(), proxy_io_register_to_broker(), and proxy_socket_io_add().

Here is the caller graph for this function:

Variable Documentation

SOCKET broker_conn_fd = INVALID_SOCKET
int cas_info_size = CAS_INFO_SIZE

Definition at line 208 of file shard_proxy_io.c.

Referenced by proxy_io_make_client_dbinfo_ok().

SOCKET cas_lsnr_fd = INVALID_SOCKET

Definition at line 201 of file shard_proxy_io.c.

Referenced by proxy_io_cas_lsnr(), proxy_io_close_all_fd(), and proxy_io_process().

T_CLIENT_IO_GLOBAL proxy_Client_io

Definition at line 204 of file shard_proxy_io.c.

T_PROXY_CONTEXT proxy_Context

Definition at line 55 of file shard_proxy_handler.c.

T_PROXY_HANDLER proxy_Handler

Definition at line 54 of file shard_proxy_handler.c.

Referenced by proxy_handler_process().

int proxy_id

Definition at line 45 of file shard_proxy.c.

Referenced by proxy_io_make_client_dbinfo_ok(), and proxy_io_register_to_broker().

T_PROXY_INFO* proxy_info_p

Definition at line 48 of file shard_proxy.c.

bool proxy_Keep_running
T_SHARD_IO_GLOBAL proxy_Shard_io

Definition at line 205 of file shard_proxy_io.c.

T_SOCKET_IO_GLOBAL proxy_Socket_io

Definition at line 203 of file shard_proxy_io.c.

fd_set rset

Definition at line 191 of file shard_proxy_io.c.

Referenced by proxy_io_process(), and proxy_listener_thr_f().

T_SHM_APPL_SERVER* shm_as_p

Definition at line 43 of file shard_proxy.c.

T_SHM_PROXY* shm_proxy_p

Definition at line 109 of file broker_admin_pub.c.

fd_set wallset

Definition at line 191 of file shard_proxy_io.c.

Referenced by proxy_io_process().

fd_set wset

Definition at line 191 of file shard_proxy_io.c.

Referenced by proxy_io_process().