CUBRID Engine  latest
cas_net_buf.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <arpa/inet.h>
#include "cas.h"
#include "cas_common.h"
#include "cas_net_buf.h"
#include "cas_util.h"
#include "dbi.h"
#include "error_code.h"
#include "dbtype.h"
#include "byte_order.h"
Include dependency graph for cas_net_buf.c:

Go to the source code of this file.

Functions

static int net_buf_realloc (T_NET_BUF *net_buf, int size)
 
void net_buf_init (T_NET_BUF *net_buf, T_BROKER_VERSION client_version)
 
void net_buf_clear (T_NET_BUF *net_buf)
 
void net_buf_destroy (T_NET_BUF *net_buf)
 
int net_buf_cp_post_send_file (T_NET_BUF *net_buf, int size, char *filename)
 
int net_buf_cp_byte (T_NET_BUF *net_buf, char ch)
 
int net_buf_cp_str (T_NET_BUF *net_buf, const char *buf, int size)
 
int net_buf_cp_int (T_NET_BUF *net_buf, int value, int *begin_offset)
 
void net_buf_overwrite_int (T_NET_BUF *net_buf, int offset, int value)
 
int net_buf_cp_bigint (T_NET_BUF *net_buf, DB_BIGINT value, int *begin_offset)
 
int net_buf_cp_float (T_NET_BUF *net_buf, float value)
 
int net_buf_cp_double (T_NET_BUF *net_buf, double value)
 
int net_buf_cp_short (T_NET_BUF *net_buf, short value)
 
int net_buf_cp_object (T_NET_BUF *net_buf, T_OBJECT *oid)
 
int net_buf_cp_lob_handle (T_NET_BUF *net_buf, T_LOB_HANDLE *lob)
 
void net_buf_error_msg_set (T_NET_BUF *net_buf, int err_indicator, int err_code, char *err_str, const char *file, int line)
 
INT64 net_htoni64 (INT64 from)
 
float net_htonf (float from)
 
double net_htond (double from)
 
void net_buf_column_info_set (T_NET_BUF *net_buf, char ut, short scale, int prec, char charset, const char *name)
 
void net_arg_get_size (int *size, void *arg)
 
void net_arg_get_bigint (DB_BIGINT *value, void *arg)
 
void net_arg_get_int (int *value, void *arg)
 
void net_arg_get_short (short *value, void *arg)
 
void net_arg_get_float (float *value, void *arg)
 
void net_arg_get_double (double *value, void *arg)
 
void net_arg_get_str (char **value, int *size, void *arg)
 
void net_arg_get_date (short *year, short *mon, short *day, void *arg)
 
void net_arg_get_time (short *hh, short *mm, short *ss, void *arg)
 
void net_arg_get_timestamp (short *yr, short *mon, short *day, short *hh, short *mm, short *ss, void *arg)
 
void net_arg_get_timestamptz (short *yr, short *mon, short *day, short *hh, short *mm, short *ss, char **tz, int *tz_size, void *arg)
 
void net_arg_get_datetime (short *yr, short *mon, short *day, short *hh, short *mm, short *ss, short *ms, void *arg)
 
void net_arg_get_datetimetz (short *yr, short *mon, short *day, short *hh, short *mm, short *ss, short *ms, char **tz, int *tz_size, void *arg)
 
void net_arg_get_object (T_OBJECT *obj, void *arg)
 
void net_arg_get_cache_time (void *ct, void *arg)
 
void net_arg_get_dbobject (DB_OBJECT **obj, void *arg)
 
void net_arg_get_cci_object (int *pageid, short *slotid, short *volid, void *arg)
 
void net_arg_get_lob_handle (T_LOB_HANDLE *lob, void *arg)
 
void net_arg_get_lob_value (DB_VALUE *db_lob, void *arg)
 
void net_arg_put_int (void *arg, int *value)
 
size_t net_error_append_shard_info (char *err_buf, const char *err_msg, int buf_size)
 
int net_buf_cp_cas_type_and_charset (T_NET_BUF *net_buf, unsigned char cas_type, unsigned char charset)
 

Function Documentation

void net_arg_get_bigint ( DB_BIGINT value,
void *  arg 
)

Definition at line 472 of file cas_net_buf.c.

References NET_SIZE_BIGINT, NET_SIZE_INT, and ntohi64().

Referenced by bind_value_print(), fn_lob_read(), fn_lob_write(), net_arg_get_size(), netval_to_dbval(), and proxy_get_range_by_param().

Here is the caller graph for this function:

void net_arg_get_cache_time ( void *  ct,
void *  arg 
)

Definition at line 688 of file cas_net_buf.c.

References NET_SIZE_INT, ntohl(), cache_time::sec, and cache_time::usec.

Referenced by fn_execute_internal().

Here is the caller graph for this function:

void net_arg_get_cci_object ( int *  pageid,
short *  slotid,
short *  volid,
void *  arg 
)

Definition at line 717 of file cas_net_buf.c.

References NET_SIZE_INT, NET_SIZE_SHORT, ntohl(), and ntohs().

Referenced by bind_value_print(), and fn_oid_get().

Here is the caller graph for this function:

void net_arg_get_date ( short *  year,
short *  mon,
short *  day,
void *  arg 
)

Definition at line 548 of file cas_net_buf.c.

References NET_SIZE_INT, NET_SIZE_SHORT, and ntohs().

Referenced by netval_to_dbval().

Here is the caller graph for this function:

void net_arg_get_datetime ( short *  yr,
short *  mon,
short *  day,
short *  hh,
short *  mm,
short *  ss,
short *  ms,
void *  arg 
)

Definition at line 625 of file cas_net_buf.c.

References NET_SIZE_INT, NET_SIZE_SHORT, and ntohs().

Referenced by bind_value_print(), net_arg_get_datetimetz(), and netval_to_dbval().

Here is the caller graph for this function:

void net_arg_get_datetimetz ( short *  yr,
short *  mon,
short *  day,
short *  hh,
short *  mm,
short *  ss,
short *  ms,
char **  tz,
int *  tz_size,
void *  arg 
)

Definition at line 654 of file cas_net_buf.c.

References net_arg_get_datetime(), NET_SIZE_DATETIME, NET_SIZE_INT, and ntohl().

Referenced by bind_value_print(), and netval_to_dbval().

Here is the caller graph for this function:

void net_arg_get_dbobject ( DB_OBJECT **  obj,
void *  arg 
)
void net_arg_get_double ( double *  value,
void *  arg 
)

Definition at line 517 of file cas_net_buf.c.

References net_ntohd, NET_SIZE_DOUBLE, and NET_SIZE_INT.

Referenced by bind_value_print(), and netval_to_dbval().

Here is the caller graph for this function:

void net_arg_get_float ( float *  value,
void *  arg 
)

Definition at line 506 of file cas_net_buf.c.

References net_ntohf, NET_SIZE_FLOAT, and NET_SIZE_INT.

Referenced by bind_value_print(), and netval_to_dbval().

Here is the caller graph for this function:

void net_arg_get_lob_handle ( T_LOB_HANDLE lob,
void *  arg 
)

Definition at line 735 of file cas_net_buf.c.

References t_lob_handle::db_type, t_lob_handle::lob_size, t_lob_handle::locator, t_lob_handle::locator_size, NET_SIZE_INT, NET_SIZE_INT64, ntohi64(), ntohl(), and NULL.

Referenced by net_arg_get_lob_value(), and netval_to_dbval().

Here is the caller graph for this function:

void net_arg_get_lob_value ( DB_VALUE db_lob,
void *  arg 
)
void net_arg_get_object ( T_OBJECT obj,
void *  arg 
)

Definition at line 670 of file cas_net_buf.c.

References NET_SIZE_INT, NET_SIZE_SHORT, ntohl(), ntohs(), t_object::pageid, t_object::slotid, and t_object::volid.

Referenced by net_arg_get_dbobject().

Here is the caller graph for this function:

void net_arg_get_short ( short *  value,
void *  arg 
)

Definition at line 495 of file cas_net_buf.c.

References NET_SIZE_INT, NET_SIZE_SHORT, and ntohs().

Referenced by bind_value_print(), netval_to_dbval(), and proxy_get_range_by_param().

Here is the caller graph for this function:

void net_arg_get_size ( int *  size,
void *  arg 
)

Definition at line 451 of file cas_net_buf.c.

References net_arg_get_bigint(), NET_SIZE_BIGINT, NET_SIZE_INT, ntohi64(), and ntohl().

Referenced by bind_value_print(), netval_to_dbval(), and proxy_get_range_by_param().

Here is the caller graph for this function:

void net_arg_get_time ( short *  hh,
short *  mm,
short *  ss,
void *  arg 
)

Definition at line 565 of file cas_net_buf.c.

References NET_SIZE_INT, NET_SIZE_SHORT, and ntohs().

Referenced by netval_to_dbval().

Here is the caller graph for this function:

void net_arg_get_timestamp ( short *  yr,
short *  mon,
short *  day,
short *  hh,
short *  mm,
short *  ss,
void *  arg 
)

Definition at line 582 of file cas_net_buf.c.

References NET_SIZE_INT, NET_SIZE_SHORT, and ntohs().

Referenced by net_arg_get_timestamptz(), and netval_to_dbval().

Here is the caller graph for this function:

void net_arg_get_timestamptz ( short *  yr,
short *  mon,
short *  day,
short *  hh,
short *  mm,
short *  ss,
char **  tz,
int *  tz_size,
void *  arg 
)

Definition at line 608 of file cas_net_buf.c.

References net_arg_get_timestamp(), NET_SIZE_INT, NET_SIZE_SHORT, NET_SIZE_TIMESTAMP, and ntohl().

Referenced by netval_to_dbval().

Here is the caller graph for this function:

void net_arg_put_int ( void *  arg,
int *  value 
)
int net_buf_cp_bigint ( T_NET_BUF net_buf,
DB_BIGINT  value,
int *  begin_offset 
)
int net_buf_cp_double ( T_NET_BUF net_buf,
double  value 
)

Definition at line 213 of file cas_net_buf.c.

References CAS_ER_NO_MORE_MEMORY, t_net_buf::data_size, NET_BUF_CURR_PTR, NET_BUF_FREE_SIZE, net_buf_realloc(), net_htond(), and NET_SIZE_DOUBLE.

Referenced by add_res_data_double().

Here is the caller graph for this function:

int net_buf_cp_float ( T_NET_BUF net_buf,
float  value 
)

Definition at line 199 of file cas_net_buf.c.

References CAS_ER_NO_MORE_MEMORY, t_net_buf::data_size, NET_BUF_CURR_PTR, NET_BUF_FREE_SIZE, net_buf_realloc(), net_htonf(), and NET_SIZE_FLOAT.

Referenced by add_res_data_float().

Here is the caller graph for this function:

int net_buf_cp_int ( T_NET_BUF net_buf,
int  value,
int *  begin_offset 
)

Definition at line 126 of file cas_net_buf.c.

References CAS_ER_NO_MORE_MEMORY, t_net_buf::data_size, htonl(), NET_BUF_CURR_PTR, NET_BUF_FREE_SIZE, net_buf_realloc(), and NET_SIZE_INT.

Referenced by add_res_data_bigint(), add_res_data_bytes(), add_res_data_date(), add_res_data_datetime(), add_res_data_datetimetz(), add_res_data_double(), add_res_data_float(), add_res_data_int(), add_res_data_lob_handle(), add_res_data_object(), add_res_data_short(), add_res_data_string(), add_res_data_time(), add_res_data_timestamp(), add_res_data_timestamptz(), dbval_to_net_buf(), execute_info_set(), fetch_attribute(), fetch_call(), fetch_class(), fetch_constraint(), fetch_foreign_keys(), fetch_methfile(), fetch_method(), fetch_privilege(), fetch_result(), fetch_trigger(), fn_close_req_handle(), fn_con_close(), fn_deprecated(), fn_end_session(), fn_end_tran(), fn_execute_array(), fn_get_db_parameter(), fn_lob_new(), fn_lob_read(), fn_lob_write(), fn_oid(), fn_savepoint(), fn_set_db_parameter(), fn_xa_end_tran(), fn_xa_prepare(), fn_xa_recover(), net_buf_column_info_set(), net_buf_cp_lob_handle(), net_buf_cp_object(), net_buf_cp_xid(), net_buf_error_msg_set(), prepare_column_info_set(), prepare_column_list_info_set(), proxy_io_make_close_req_handle_ok(), proxy_io_make_end_tran_request(), proxy_io_make_error_msg(), proxy_io_make_ex_get_int(), proxy_io_make_get_db_version(), proxy_io_make_shard_info(), sch_attr_info(), sch_attr_priv(), sch_class_info(), sch_class_priv(), sch_constraint(), sch_direct_super_class(), sch_exported_keys_or_cross_reference(), sch_imported_keys(), sch_methfile_info(), sch_method_info(), sch_primary_key(), sch_queryspec(), sch_superclass(), sch_trigger(), schema_attr_meta(), schema_attrpriv_meta(), schema_classpriv_meta(), schema_constraint_meta(), schema_directsuper_meta(), schema_fk_info_meta(), schema_method_meta(), schema_methodfile_meta(), schema_primarykey_meta(), schema_query_spec_meta(), schema_superclasss_meta(), schema_table_meta(), schema_trigger_meta(), ux_col_get(), ux_col_seq_drop(), ux_col_seq_insert(), ux_col_seq_put(), ux_col_set_add(), ux_col_set_drop(), ux_col_size(), ux_cursor(), ux_cursor_update(), ux_execute(), ux_execute_all(), ux_execute_array(), ux_execute_batch(), ux_execute_call(), ux_fetch(), ux_get_attr_type_str(), ux_get_class_num_objs(), ux_get_db_version(), ux_get_generated_keys_client_insert(), ux_get_generated_keys_server_insert(), ux_get_last_insert_id(), ux_get_parameter_info(), ux_get_query_info(), ux_get_row_count(), ux_lob_new(), ux_lob_read(), ux_lob_write(), ux_make_out_rs(), ux_next_result(), ux_oid_get(), ux_oid_put(), ux_prepare(), ux_schema_info(), and ux_set_cas_change_mode().

int net_buf_cp_post_send_file ( T_NET_BUF net_buf,
int  size,
char *  filename 
)
void net_buf_destroy ( T_NET_BUF net_buf)

Definition at line 75 of file cas_net_buf.c.

References t_net_buf::alloc_size, t_net_buf::data, FREE_MEM, and net_buf_clear().

Referenced by cas_main(), ux_get_generated_keys_client_insert(), and ux_get_generated_keys_server_insert().

Here is the caller graph for this function:

void net_buf_error_msg_set ( T_NET_BUF net_buf,
int  err_indicator,
int  err_code,
char *  err_str,
const char *  file,
int  line 
)
size_t net_error_append_shard_info ( char *  err_buf,
const char *  err_msg,
int  buf_size 
)

Definition at line 795 of file cas_net_buf.c.

References assert, cas_shard_flag, MAX_SHARD_INFO_LENGTH, NULL, ON, shm_shard_cas_id, shm_shard_id, and strlen.

Referenced by net_buf_error_msg_set(), and net_write_error().

Here is the caller graph for this function:

double net_htond ( double  from)

Definition at line 374 of file cas_net_buf.c.

References p.

Referenced by net_buf_cp_double().

Here is the caller graph for this function:

float net_htonf ( float  from)

Definition at line 357 of file cas_net_buf.c.

References p.

Referenced by net_buf_cp_float().

Here is the caller graph for this function:

INT64 net_htoni64 ( INT64  from)

Definition at line 336 of file cas_net_buf.c.

References p.

Referenced by net_buf_cp_bigint().

Here is the caller graph for this function: