Skip to content

File cas_net_buf.h

FileList > broker > cas_net_buf.h

Go to the source code of this file

  • #include <arpa/inet.h>
  • #include "cas_protocol.h"
  • #include "dbtype_def.h"
  • #include "cas_common_vars.h"

Classes

Type Name
struct t_net_buf

Public Types

Type Name
typedef struct t_net_buf T_NET_BUF

Public Functions

Type Name
int get_net_buf_size (void)
void net_arg_get_bigint (DB_BIGINT * value, void * arg)
void net_arg_get_cache_time (void * ct, void * arg)
void net_arg_get_cci_object (int * pageid, short * slotid, short * volid, void * arg)
void net_arg_get_date (short * year, short * mon, short * day, 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_dbobject (DB_OBJECT ** obj, void * arg)
void net_arg_get_double (double * value, void * arg)
void net_arg_get_float (float * value, void * arg)
void net_arg_get_int (int * value, 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_get_object (T_OBJECT * obj, void * arg)
void net_arg_get_short (short * value, void * arg)
void net_arg_get_size (int * size, void * arg)
void net_arg_get_str (char ** value, int * size, 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_put_int (void * arg, int * value)
void net_buf_clear (T_NET_BUF * net_buf)
void net_buf_column_info_set (T_NET_BUF * net_buf, char ut, short scale, int prec, char charset, const char * name)
int net_buf_cp_bigint (T_NET_BUF * net_buf, DB_BIGINT value, int * begin_offset)
int net_buf_cp_byte (T_NET_BUF * net_buf, char ch)
int net_buf_cp_cas_type_and_charset (T_NET_BUF * net_buf, unsigned char cas_type, unsigned char charset)
int net_buf_cp_double (T_NET_BUF * net_buf, double value)
int net_buf_cp_float (T_NET_BUF * net_buf, float value)
int net_buf_cp_int (T_NET_BUF * net_buf, int value, int * begin_offset)
int net_buf_cp_lob_handle (T_NET_BUF * net_buf, T_LOB_HANDLE * lob)
int net_buf_cp_object (T_NET_BUF * net_buf, T_OBJECT * oid)
int net_buf_cp_post_send_file (T_NET_BUF * net_buf, int size, char * str)
int net_buf_cp_short (T_NET_BUF * net_buf, short value)
int net_buf_cp_str (T_NET_BUF * net_buf, const char * buf, int size)
void net_buf_destroy (T_NET_BUF * net_buf)
void net_buf_error_msg_set (T_NET_BUF * net_buf, int errindicator, int errcode, char * errstr, const char * file, int line)
void net_buf_init (T_NET_BUF * net_buf, T_BROKER_VERSION client_version)
void net_buf_overwrite_bigint (T_NET_BUF * net_buf, int offset, DB_BIGINT value)
void net_buf_overwrite_int (T_NET_BUF * net_buf, int offset, int value)
size_t net_error_append_shard_info (char * err_buf, const char * err_msg, int buf_size)
double net_htond (double from)
float net_htonf (float from)
INT64 net_htoni64 (INT64 from)
void set_net_buf_size (void)

Macros

Type Name
define CHECK_NET_BUF_SIZE (n, size) ([**NET\_BUF\_CURR\_SIZE**](cas__net__buf_8h.md#define-net_buf_curr_size)(n) &lt; (size) ? 1 : 0)
define INT_DEFAULE_NET_BUF_SIZE (16 \* [**NET\_BUF\_KBYTE**](cas__net__buf_8h.md#define-net_buf_kbyte))
define MAX_SHARD_INFO_LENGTH (30)
define NET_BUF_ALLOC_SIZE ([**NET\_BUF\_SIZE**](cas__net__buf_8h.md#define-net_buf_size) + [**NET\_BUF\_EXTRA\_SIZE**](cas__net__buf_8h.md#define-net_buf_extra_size))
define NET_BUF_CURR_PTR (n) ((n)-&gt;data + [**NET\_BUF\_CURR\_SIZE**](cas__net__buf_8h.md#define-net_buf_curr_size)(n))
define NET_BUF_CURR_SIZE (n) (((n)-&gt;alloc\_size &gt; 0) ? ([**NET\_BUF\_HEADER\_SIZE**](cas__net__buf_8h.md#define-net_buf_header_size) + (n)-&gt;data\_size) : 0)
define NET_BUF_ERROR_MSG_SET (NET_BUF, ERR_INDICATOR, ERR_CODE, ERR_MSG) [**net\_buf\_error\_msg\_set**](cas__net__buf_8c.md#function-net_buf_error_msg_set)([**NET\_BUF**](broker__monitor_8c.md#function-timeout), [**ERR\_INDICATOR**](broker__monitor_8c.md#function-timeout), [**ERR\_CODE**](broker__monitor_8c.md#function-timeout), [**ERR\_MSG**](broker__monitor_8c.md#function-timeout), [**\_\_FILE\_\_**](broker__monitor_8c.md#function-timeout), [**\_\_LINE\_\_**](broker__monitor_8c.md#function-timeout))
define NET_BUF_EXTRA_SIZE (64 \* [**NET\_BUF\_KBYTE**](cas__net__buf_8h.md#define-net_buf_kbyte))
define NET_BUF_FREE_SIZE (n) ((n)-&gt;alloc\_size - [**NET\_BUF\_CURR\_SIZE**](cas__net__buf_8h.md#define-net_buf_curr_size)(n))
define NET_BUF_HEADER_MSG_SIZE ([**NET\_SIZE\_INT**](cas__net__buf_8h.md#define-net_size_int))
define NET_BUF_HEADER_SIZE ([**NET\_BUF\_HEADER\_MSG\_SIZE**](cas__net__buf_8h.md#define-net_buf_header_msg_size) + [**cas\_info\_size**](cas__common__vars_8c.md#variable-cas_info_size))
define NET_BUF_KBYTE 1024
define NET_BUF_SIZE ([**get\_net\_buf\_size**](cas__net__buf_8c.md#function-get_net_buf_size) ())
define NET_BUF_TYPE_SIZE (net_buf) /* multi line expression */
define NET_SIZE_BIGINT [**NET\_SIZE\_INT64**](cas__net__buf_8h.md#define-net_size_int64)
define NET_SIZE_BYTE (([**int**](broker__monitor_8c.md#function-timeout)) [**sizeof**](broker__monitor_8c.md#function-timeout)([**char**](broker__monitor_8c.md#function-timeout)))
define NET_SIZE_DATE ([**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short) + [**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short) + [**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short))
define NET_SIZE_DATETIME ([**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short) \* 7)
define NET_SIZE_DOUBLE (([**int**](broker__monitor_8c.md#function-timeout)) [**sizeof**](broker__monitor_8c.md#function-timeout)([**double**](broker__monitor_8c.md#function-timeout)))
define NET_SIZE_FLOAT (([**int**](broker__monitor_8c.md#function-timeout)) [**sizeof**](broker__monitor_8c.md#function-timeout)([**float**](broker__monitor_8c.md#function-timeout)))
define NET_SIZE_INT (([**int**](broker__monitor_8c.md#function-timeout)) [**sizeof**](broker__monitor_8c.md#function-timeout)([**int**](broker__monitor_8c.md#function-timeout)))
define NET_SIZE_INT64 (([**int**](broker__monitor_8c.md#function-timeout)) [**sizeof**](broker__monitor_8c.md#function-timeout)([**INT64**](broker__monitor_8c.md#function-timeout)))
define NET_SIZE_OBJECT ([**NET\_SIZE\_INT**](cas__net__buf_8h.md#define-net_size_int) + [**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short) + [**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short))
define NET_SIZE_SHORT (([**int**](broker__monitor_8c.md#function-timeout)) [**sizeof**](broker__monitor_8c.md#function-timeout)([**short**](broker__monitor_8c.md#function-timeout)))
define NET_SIZE_TIME ([**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short) + [**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short) + [**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short))
define NET_SIZE_TIMESTAMP ([**NET\_SIZE\_SHORT**](cas__net__buf_8h.md#define-net_size_short) \* 6)
define SHARD_NET_BUF_ALLOC_SIZE ([**SHARD\_NET\_BUF\_SIZE**](cas__net__buf_8h.md#define-shard_net_buf_size) + [**NET\_BUF\_EXTRA\_SIZE**](cas__net__buf_8h.md#define-net_buf_extra_size))
define SHARD_NET_BUF_SIZE (512 \* [**NET\_BUF\_KBYTE**](cas__net__buf_8h.md#define-net_buf_kbyte))
define net_arg_get_char (value, arg) ((value)= \*(([**char**](broker__monitor_8c.md#function-timeout) \*) (arg) + [**NET\_SIZE\_INT**](cas__net__buf_8h.md#define-net_size_int)));
define net_ntohd (X) [**net\_htond**](cas__net__buf_8c.md#function-net_htond)([**X**](broker__monitor_8c.md#function-timeout))
define net_ntohf (X) [**net\_htonf**](cas__net__buf_8c.md#function-net_htonf)([**X**](broker__monitor_8c.md#function-timeout))
define net_ntohi64 (X) [**net\_htoni64**](cas__net__buf_8c.md#function-net_htoni64)([**X**](broker__monitor_8c.md#function-timeout))

Public Types Documentation

typedef T_NET_BUF

typedef struct t_net_buf T_NET_BUF;

Public Functions Documentation

function get_net_buf_size

int get_net_buf_size (
    void
) 

function net_arg_get_bigint

void net_arg_get_bigint (
    DB_BIGINT * value,
    void * arg
) 

function net_arg_get_cache_time

void net_arg_get_cache_time (
    void * ct,
    void * arg
) 

function net_arg_get_cci_object

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

function net_arg_get_date

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

function net_arg_get_datetime

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

function net_arg_get_datetimetz

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
) 

function net_arg_get_dbobject

void net_arg_get_dbobject (
    DB_OBJECT ** obj,
    void * arg
) 

function net_arg_get_double

void net_arg_get_double (
    double * value,
    void * arg
) 

function net_arg_get_float

void net_arg_get_float (
    float * value,
    void * arg
) 

function net_arg_get_int

void net_arg_get_int (
    int * value,
    void * arg
) 

function net_arg_get_lob_handle

void net_arg_get_lob_handle (
    T_LOB_HANDLE * lob,
    void * arg
) 

function net_arg_get_lob_value

void net_arg_get_lob_value (
    DB_VALUE * db_lob,
    void * arg
) 

function net_arg_get_object

void net_arg_get_object (
    T_OBJECT * obj,
    void * arg
) 

function net_arg_get_short

void net_arg_get_short (
    short * value,
    void * arg
) 

function net_arg_get_size

void net_arg_get_size (
    int * size,
    void * arg
) 

function net_arg_get_str

void net_arg_get_str (
    char ** value,
    int * size,
    void * arg
) 

function net_arg_get_time

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

function net_arg_get_timestamp

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

function net_arg_get_timestamptz

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

function net_arg_put_int

void net_arg_put_int (
    void * arg,
    int * value
) 

function net_buf_clear

void net_buf_clear (
    T_NET_BUF * net_buf
) 

function net_buf_column_info_set

void net_buf_column_info_set (
    T_NET_BUF * net_buf,
    char ut,
    short scale,
    int prec,
    char charset,
    const  char * name
) 

function net_buf_cp_bigint

int net_buf_cp_bigint (
    T_NET_BUF * net_buf,
    DB_BIGINT value,
    int * begin_offset
) 

function net_buf_cp_byte

int net_buf_cp_byte (
    T_NET_BUF * net_buf,
    char ch
) 

function net_buf_cp_cas_type_and_charset

int net_buf_cp_cas_type_and_charset (
    T_NET_BUF * net_buf,
    unsigned  char cas_type,
    unsigned  char charset
) 

function net_buf_cp_double

int net_buf_cp_double (
    T_NET_BUF * net_buf,
    double value
) 

function net_buf_cp_float

int net_buf_cp_float (
    T_NET_BUF * net_buf,
    float value
) 

function net_buf_cp_int

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

function net_buf_cp_lob_handle

int net_buf_cp_lob_handle (
    T_NET_BUF * net_buf,
    T_LOB_HANDLE * lob
) 

function net_buf_cp_object

int net_buf_cp_object (
    T_NET_BUF * net_buf,
    T_OBJECT * oid
) 

function net_buf_cp_post_send_file

int net_buf_cp_post_send_file (
    T_NET_BUF * net_buf,
    int size,
    char * str
) 

function net_buf_cp_short

int net_buf_cp_short (
    T_NET_BUF * net_buf,
    short value
) 

function net_buf_cp_str

int net_buf_cp_str (
    T_NET_BUF * net_buf,
    const  char * buf,
    int size
) 

function net_buf_destroy

void net_buf_destroy (
    T_NET_BUF * net_buf
) 

function net_buf_error_msg_set

void net_buf_error_msg_set (
    T_NET_BUF * net_buf,
    int errindicator,
    int errcode,
    char * errstr,
    const  char * file,
    int line
) 

function net_buf_init

void net_buf_init (
    T_NET_BUF * net_buf,
    T_BROKER_VERSION client_version
) 

function net_buf_overwrite_bigint

void net_buf_overwrite_bigint (
    T_NET_BUF * net_buf,
    int offset,
    DB_BIGINT value
) 

function net_buf_overwrite_int

void net_buf_overwrite_int (
    T_NET_BUF * net_buf,
    int offset,
    int value
) 

function net_error_append_shard_info

size_t net_error_append_shard_info (
    char * err_buf,
    const  char * err_msg,
    int buf_size
) 

function net_htond

double net_htond (
    double from
) 

function net_htonf

float net_htonf (
    float from
) 

function net_htoni64

INT64 net_htoni64 (
    INT64 from
) 

function set_net_buf_size

void set_net_buf_size (
    void
) 

Macro Definition Documentation

define CHECK_NET_BUF_SIZE

#define CHECK_NET_BUF_SIZE (
    n,
    size
) `( NET_BUF_CURR_SIZE (n) < (size) ? 1 : 0)`

define INT_DEFAULE_NET_BUF_SIZE

#define INT_DEFAULE_NET_BUF_SIZE `(16 * NET_BUF_KBYTE )`

define MAX_SHARD_INFO_LENGTH

#define MAX_SHARD_INFO_LENGTH `(30)`

define NET_BUF_ALLOC_SIZE

#define NET_BUF_ALLOC_SIZE `( NET_BUF_SIZE + NET_BUF_EXTRA_SIZE )`

define NET_BUF_CURR_PTR

#define NET_BUF_CURR_PTR (
    n
) `((n)->data + NET_BUF_CURR_SIZE (n))`

define NET_BUF_CURR_SIZE

#define NET_BUF_CURR_SIZE (
    n
) `(((n)->alloc_size > 0) ? ( NET_BUF_HEADER_SIZE + (n)->data_size) : 0)`

define NET_BUF_ERROR_MSG_SET

#define NET_BUF_ERROR_MSG_SET (
    NET_BUF,
    ERR_INDICATOR,
    ERR_CODE,
    ERR_MSG
) `net_buf_error_msg_set ( NET_BUF , ERR_INDICATOR , ERR_CODE , ERR_MSG , __FILE__ , __LINE__ )`

define NET_BUF_EXTRA_SIZE

#define NET_BUF_EXTRA_SIZE `(64 * NET_BUF_KBYTE )`

define NET_BUF_FREE_SIZE

#define NET_BUF_FREE_SIZE (
    n
) `((n)->alloc_size - NET_BUF_CURR_SIZE (n))`

define NET_BUF_HEADER_MSG_SIZE

#define NET_BUF_HEADER_MSG_SIZE `( NET_SIZE_INT )`

define NET_BUF_HEADER_SIZE

#define NET_BUF_HEADER_SIZE `( NET_BUF_HEADER_MSG_SIZE + cas_info_size )`

define NET_BUF_KBYTE

#define NET_BUF_KBYTE `1024`

define NET_BUF_SIZE

#define NET_BUF_SIZE `( get_net_buf_size ())`

define NET_BUF_TYPE_SIZE

#define NET_BUF_TYPE_SIZE (
    net_buf
) `/* multi line expression */`

define NET_SIZE_BIGINT

#define NET_SIZE_BIGINT `NET_SIZE_INT64`

define NET_SIZE_BYTE

#define NET_SIZE_BYTE `(( int ) sizeof ( char ))`

define NET_SIZE_DATE

#define NET_SIZE_DATE `( NET_SIZE_SHORT + NET_SIZE_SHORT + NET_SIZE_SHORT )`

define NET_SIZE_DATETIME

#define NET_SIZE_DATETIME `( NET_SIZE_SHORT * 7)`

define NET_SIZE_DOUBLE

#define NET_SIZE_DOUBLE `(( int ) sizeof ( double ))`

define NET_SIZE_FLOAT

#define NET_SIZE_FLOAT `(( int ) sizeof ( float ))`

define NET_SIZE_INT

#define NET_SIZE_INT `(( int ) sizeof ( int ))`

define NET_SIZE_INT64

#define NET_SIZE_INT64 `(( int ) sizeof ( INT64 ))`

define NET_SIZE_OBJECT

#define NET_SIZE_OBJECT `( NET_SIZE_INT + NET_SIZE_SHORT + NET_SIZE_SHORT )`

define NET_SIZE_SHORT

#define NET_SIZE_SHORT `(( int ) sizeof ( short ))`

define NET_SIZE_TIME

#define NET_SIZE_TIME `( NET_SIZE_SHORT + NET_SIZE_SHORT + NET_SIZE_SHORT )`

define NET_SIZE_TIMESTAMP

#define NET_SIZE_TIMESTAMP `( NET_SIZE_SHORT * 6)`

define SHARD_NET_BUF_ALLOC_SIZE

#define SHARD_NET_BUF_ALLOC_SIZE `( SHARD_NET_BUF_SIZE + NET_BUF_EXTRA_SIZE )`

define SHARD_NET_BUF_SIZE

#define SHARD_NET_BUF_SIZE `(512 * NET_BUF_KBYTE )`

define net_arg_get_char

#define net_arg_get_char (
    value,
    arg
) `((value)= *(( char *) (arg) + NET_SIZE_INT ));`

define net_ntohd

#define net_ntohd (
    X
) `net_htond ( X )`

define net_ntohf

#define net_ntohf (
    X
) `net_htonf ( X )`

define net_ntohi64

#define net_ntohi64 (
    X
) `net_htoni64 ( X )`


The documentation for this class was generated from the following file cubrid/src/broker/cas_net_buf.h