reorganized some files
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
118
lib/hcl-x.h
118
lib/hcl-x.h
@ -177,6 +177,68 @@ struct hcl_client_prim_t
|
||||
typedef struct hcl_client_prim_t hcl_client_prim_t;
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
#if (HCL_SIZEOF_SOCKLEN_T == 1)
|
||||
#if defined(HCL_SOCKLEN_T_IS_SIGNED)
|
||||
typedef hcl_int8_t hcl_scklen_t;
|
||||
#else
|
||||
typedef hcl_uint8_t hcl_scklen_t;
|
||||
#endif
|
||||
#elif (HCL_SIZEOF_SOCKLEN_T == 2)
|
||||
#if defined(HCL_SOCKLEN_T_IS_SIGNED)
|
||||
typedef hcl_int16_t hcl_scklen_t;
|
||||
#else
|
||||
typedef hcl_uint16_t hcl_scklen_t;
|
||||
#endif
|
||||
#elif (HCL_SIZEOF_SOCKLEN_T == 4)
|
||||
#if defined(HCL_SOCKLEN_T_IS_SIGNED)
|
||||
typedef hcl_int32_t hcl_scklen_t;
|
||||
#else
|
||||
typedef hcl_uint32_t hcl_scklen_t;
|
||||
#endif
|
||||
#elif (HCL_SIZEOF_SOCKLEN_T == 8)
|
||||
#if defined(HCL_SOCKLEN_T_IS_SIGNED)
|
||||
typedef hcl_int64_t hcl_scklen_t;
|
||||
#else
|
||||
typedef hcl_uint64_t hcl_scklen_t;
|
||||
#endif
|
||||
#else
|
||||
#undef HCL_SIZEOF_SOCKLEN_T
|
||||
#define HCL_SIZEOF_SOCKLEN_T HCL_SIZEOF_INT
|
||||
#define HCL_SOCKLEN_T_IS_SIGNED
|
||||
typedef int hcl_scklen_t;
|
||||
#endif
|
||||
|
||||
struct hcl_sckaddr_t
|
||||
{
|
||||
#define HCL_SCKADDR_DATA_SIZE 0
|
||||
|
||||
#if (HCL_SIZEOF_STRUCT_SOCKADDR_IN > HCL_SCKADDR_DATA_SIZE)
|
||||
#undef HCL_SCKADDR_DATA_SIZE
|
||||
#define HCL_SCKADDR_DATA_SIZE HCL_SIZEOF_STRUCT_SOCKADDR_IN
|
||||
#endif
|
||||
#if (HCL_SIZEOF_STRUCT_SOCKADDR_IN6 > HCL_SCKADDR_DATA_SIZE)
|
||||
#undef HCL_SCKADDR_DATA_SIZE
|
||||
#define HCL_SCKADDR_DATA_SIZE HCL_SIZEOF_STRUCT_SOCKADDR_IN6
|
||||
#endif
|
||||
#if (HCL_SIZEOF_STRUCT_SOCKADDR_UN > HCL_SCKADDR_DATA_SIZE)
|
||||
#undef HCL_SCKADDR_DATA_SIZE
|
||||
#define HCL_SCKADDR_DATA_SIZE HCL_SIZEOF_STRUCT_SOCKADDR_UN
|
||||
#endif
|
||||
#if (HCL_SIZEOF_STRUCT_SOCKADDR_LL > HCL_SCKADDR_DATA_SIZE)
|
||||
#undef HCL_SCKADDR_DATA_SIZE
|
||||
#define HCL_SCKADDR_DATA_SIZE HCL_SIZEOF_STRUCT_SOCKADDR_LL
|
||||
#endif
|
||||
|
||||
#if (HCL_SCKADDR_DATA_SIZE == 0)
|
||||
#undef HCL_SCKADDR_DATA_SIZE
|
||||
#define HCL_SCKADDR_DATA_SIZE 64
|
||||
#endif
|
||||
hcl_uint8_t storage[HCL_SCKADDR_DATA_SIZE];
|
||||
};
|
||||
typedef struct hcl_sckaddr_t hcl_sckaddr_t;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
@ -479,9 +541,9 @@ HCL_EXPORT int hcl_xproto_process (
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
HCL_EXPORT int hcl_sys_send (
|
||||
int sck,
|
||||
const void* data,
|
||||
hcl_oow_t* size /* [IN] number of bytes to write, [OUT] number of bytes written */
|
||||
int sck,
|
||||
const void* data,
|
||||
hcl_oow_t* size
|
||||
);
|
||||
|
||||
HCL_EXPORT int hcl_sys_send_iov (
|
||||
@ -513,6 +575,56 @@ HCL_EXPORT int hcl_sys_is_errno_wb (
|
||||
int no
|
||||
);
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
HCL_EXPORT int hcl_ucharstosckaddr (
|
||||
hcl_t* hcl,
|
||||
const hcl_uch_t* str,
|
||||
hcl_oow_t len,
|
||||
hcl_sckaddr_t* sckaddr,
|
||||
hcl_scklen_t* scklen
|
||||
);
|
||||
|
||||
HCL_EXPORT int hcl_bcharstosckaddr (
|
||||
hcl_t* hcl,
|
||||
const hcl_bch_t* str,
|
||||
hcl_oow_t len,
|
||||
hcl_sckaddr_t* sckaddr,
|
||||
hcl_scklen_t* scklen
|
||||
);
|
||||
|
||||
#if defined(HCL_HAVE_INLINE)
|
||||
static HCL_INLINE int hcl_uchars_to_sckaddr (const hcl_uch_t* str, hcl_oow_t len, hcl_sckaddr_t* sckaddr, hcl_scklen_t* scklen)
|
||||
{
|
||||
return hcl_ucharstosckaddr(HCL_NULL, str, len, sckaddr, scklen);
|
||||
}
|
||||
static HCL_INLINE int hcl_bchars_to_sckaddr (const hcl_bch_t* str, hcl_oow_t len, hcl_sckaddr_t* sckaddr, hcl_scklen_t* scklen)
|
||||
{
|
||||
return hcl_bcharstosckaddr(HCL_NULL, str, len, sckaddr, scklen);
|
||||
}
|
||||
#else
|
||||
#define hcl_uchars_to_sckaddr(str,len,sckaddr,scklen) hcl_ucharstosckaddr(HCL_NULL,str,len,sckaddr,scklen)
|
||||
#define hcl_bchars_to_sckaddr(str,len,sckaddr,scklen) hcl_bcharstosckaddr(HCL_NULL,str,len,sckaddr,scklen)
|
||||
#endif
|
||||
|
||||
#if defined(HCL_OOCH_IS_UCH)
|
||||
# define hcl_oocharstosckaddr hcl_ucharstosckaddr
|
||||
# define hcl_oochars_to_sckaddr hcl_uchars_to_sckaddr
|
||||
#else
|
||||
# define hcl_oocharstosckaddr hcl_bcharstosckaddr
|
||||
# define hcl_oochars_to_sckaddr hcl_bchars_to_sckaddr
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The hcl_get_sckaddr_info() function returns the socket family.
|
||||
* if \a scklen is not #HCL_NULL, it also sets the actual address length
|
||||
* in the memory pointed to by it.
|
||||
*/
|
||||
HCL_EXPORT int hcl_get_sckaddr_info (
|
||||
const hcl_sckaddr_t* sckaddr,
|
||||
hcl_scklen_t* scklen
|
||||
);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user