wip - reworking hcl server/client code
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
hyung-hwan 2024-04-14 18:33:15 +09:00
parent f9ee45cf41
commit 59dfe8cbb7
16 changed files with 1158 additions and 816 deletions

View File

@ -25,6 +25,7 @@
*/ */
#include "hcl-c.h" #include "hcl-c.h"
#include "hcl-x.h"
#include "hcl-opt.h" #include "hcl-opt.h"
#include "hcl-utl.h" #include "hcl-utl.h"
#include "hcl-xutl.h" #include "hcl-xutl.h"
@ -53,6 +54,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <poll.h>
/* ========================================================================= */ /* ========================================================================= */
@ -138,7 +140,6 @@ static int write_log (hcl_client_t* client, int fd, const hcl_bch_t* ptr, hcl_oo
{ {
client_xtn_t* xtn; client_xtn_t* xtn;
xtn = hcl_client_getxtn(client); xtn = hcl_client_getxtn(client);
while (len > 0) while (len > 0)
@ -453,119 +454,6 @@ static int handle_logopt (hcl_client_t* client, const hcl_bch_t* str)
return 0; return 0;
} }
static int start_reply (hcl_client_t* client, hcl_client_reply_type_t type, const hcl_ooch_t* dptr, hcl_oow_t dlen)
{
client_xtn_t* client_xtn;
client_xtn = hcl_client_getxtn(client);
if (client_xtn->reply_count > 0)
{
hcl_client_seterrbfmt (client, HCL_EFLOOD, "\n<<WARNING>> redundant reply received\n");
return -1;
}
if (dptr)
{
/* short-form response - no end_reply will be called */
if (type == HCL_CLIENT_REPLY_TYPE_ERROR)
{
#if defined(HCL_OOCH_IS_UCH)
hcl_bch_t bcs[256];
hcl_oow_t bcslen;
/* NOTE: the error may get truncated without looping */
bcslen = HCL_COUNTOF(bcs);
hcl_conv_uchars_to_bchars_with_cmgr (dptr, &dlen, bcs, &bcslen, hcl_client_getcmgr(client));
printf ("\nERROR - [%.*s]\n", (int)bcslen, bcs);
#else
printf ("\nERROR - [%.*s]\n", (int)dlen, dptr);
#endif
}
else
{
#if defined(HCL_OOCH_IS_UCH)
hcl_oow_t drem = dlen;
while (drem > 0)
{
hcl_bch_t bcs[256];
hcl_oow_t ucslen, bcslen;
ucslen = drem;
bcslen = HCL_COUNTOF(bcs);
hcl_conv_uchars_to_bchars_with_cmgr(dptr, &ucslen, bcs, &bcslen, hcl_client_getcmgr(client));
client_xtn->data_length += bcslen;
if (write_all(0, bcs, bcslen) <= -1)
{
hcl_client_seterrbfmt (client, HCL_EIOERR, "unable to write data");
return -1;
}
drem -= ucslen;
dptr += ucslen;
}
#else
client_xtn->data_length += dlen;
if (write_all(0, dptr, dlen) <= -1)
{
hcl_client_seterrbfmt (client, HCL_EIOERR, "unable to write data");
return -1;
}
#endif
}
printf ("\nTOTAL DATA %lu bytes\n", (unsigned long int)client_xtn->data_length);
/*fflush (stdout);*/
client_xtn->reply_count++;
}
else
{
/* long-form response */
}
return 0;
}
static int end_reply (hcl_client_t* client, hcl_client_end_reply_state_t state)
{
client_xtn_t* client_xtn;
client_xtn = hcl_client_getxtn(client);
if (state == HCL_CLIENT_END_REPLY_STATE_REVOKED)
{
/* nothing to do here */
printf ("\n<<WARNING>> REPLY(%lu bytes) received so far has been revoked\n", (unsigned long int)client_xtn->data_length);
client_xtn->data_length = 0;
}
else
{
client_xtn->reply_count++;
/*fflush (stdout);*/
printf ("\nTOTAL DATA %lu bytes\n", (unsigned long int)client_xtn->data_length);
}
return 0;
}
static int feed_attr (hcl_client_t* client, const hcl_oocs_t* key, const hcl_oocs_t* val)
{
return 0;
}
static int feed_data (hcl_client_t* client, const void* ptr, hcl_oow_t len)
{
client_xtn_t* client_xtn;
client_xtn = hcl_client_getxtn(client);
client_xtn->data_length += len;
if (write_all(0, ptr, len) <= -1)
{
hcl_client_seterrbfmt (client, HCL_EIOERR, "unable to write data");
return -1;
}
return 0;
}
/* ========================================================================= */ /* ========================================================================= */
static int send_iov (int sck, struct iovec* iov, int count) static int send_iov (int sck, struct iovec* iov, int count)
@ -602,48 +490,104 @@ static int send_iov (int sck, struct iovec* iov, int count)
return 0; return 0;
} }
static int send_script_line (int sck, const char* line, size_t len) /* ========================================================================= */
enum hcl_xproto_rcv_state_t
{ {
struct iovec iov[3]; HCL_XPROTO_RCV_HEADER,
int count; HCL_XPROTO_RCV_PAYLOAD,
};
typedef enum hcl_xproto_rcv_state_t hcl_xproto_rcv_state_t;
count = 0;
iov[count].iov_base = ".SCRIPT ";
iov[count++].iov_len = 8;
iov[count].iov_base = (char*)line;
iov[count++].iov_len = len;
iov[count].iov_base = "\n";
iov[count++].iov_len = 1;
return send_iov(sck, iov, count); struct hcl_xproto_t
}
static int send_begin_line (int sck)
{ {
struct iovec iov[2]; hcl_t* hcl;
int count;
count = 0; struct
iov[count].iov_base = ".BEGIN"; {
iov[count++].iov_len = 6; hcl_xproto_rcv_state_t state;
iov[count].iov_base = "\n"; hcl_oow_t len_needed;
iov[count++].iov_len = 1; unsigned int eof: 1;
unsigned int polled: 1;
return send_iov(sck, iov, count); hcl_oow_t len;
} hcl_uint8_t buf[4096];
static int send_end_line (int sck) hcl_xpkt_hdr_t hdr;
} rcv;
};
typedef struct hcl_xproto_t hcl_xproto_t;
static int receive_raw_bytes (hcl_xproto_t* proto, int sck, hcl_ntime_t* idle_tmout)
{ {
struct iovec iov[2]; hcl_t* hcl = proto->hcl;
int count; struct pollfd pfd;
int tmout, actual_tmout;
ssize_t x;
int n;
count = 0; HCL_ASSERT (hcl, proto->rcv.len < proto->rcv.len_needed);
iov[count].iov_base = ".END";
iov[count++].iov_len = 4;
iov[count].iov_base = "\n";
iov[count++].iov_len = 1;
return send_iov(sck, iov, count); if (HCL_UNLIKELY(proto->rcv.eof))
{
hcl_seterrbfmt (hcl, HCL_EGENERIC, "connection closed");
return -1;
}
if (HCL_LIKELY(!proto->rcv.polled))
{
tmout = idle_tmout? HCL_SECNSEC_TO_MSEC(idle_tmout->sec, idle_tmout->nsec): -1;
actual_tmout = (tmout <= 0)? 10000: tmout;
pfd.fd = sck;
pfd.events = POLLIN | POLLERR;
pfd.revents = 0;
n = poll(&pfd, 1, actual_tmout);
if (n <= -1)
{
if (errno == EINTR) return 0;
hcl_seterrwithsyserr (hcl, 0, errno);
return -1;
}
else if (n == 0)
{
/* timed out - no activity on the pfd */
if (tmout > 0)
{
/* timeout explicity set. no activity for that duration. considered idle */
hcl_seterrbfmt (hcl, HCL_EGENERIC, "no activity on the socket %d", sck);
return -1;
}
return 0; /* didn't read yet */
}
if (pfd.revents & POLLERR)
{
hcl_seterrbfmt (hcl, HCL_EGENERIC, "error condition detected on socket %d", sck);
return -1;
}
proto->rcv.polled = 1;
}
x = recv(sck, &proto->rcv.buf[proto->rcv.len], HCL_COUNTOF(proto->rcv.buf) - proto->rcv.len, 0);
if (x <= -1)
{
if (errno == EINTR) return 0; /* didn't read read */
proto->rcv.polled = 0;
hcl_seterrwithsyserr (hcl, 0, errno);
return -1;
}
proto->rcv.polled = 0;
if (x == 0) proto->rcv.eof = 1;
proto->rcv.len += x;
return 1; /* read some data */
} }
static int handle_request (hcl_client_t* client, const char* ipaddr, const char* script, int reuse_addr, int shut_wr_after_req) static int handle_request (hcl_client_t* client, const char* ipaddr, const char* script, int reuse_addr, int shut_wr_after_req)
@ -658,6 +602,9 @@ static int handle_request (hcl_client_t* client, const char* ipaddr, const char*
hcl_bch_t buf[256]; hcl_bch_t buf[256];
ssize_t n; ssize_t n;
const char* scptr; const char* scptr;
const char* sccur;
hcl_xproto_t proto;
client_xtn_t* client_xtn; client_xtn_t* client_xtn;
@ -705,68 +652,78 @@ static int handle_request (hcl_client_t* client, const char* ipaddr, const char*
goto oops; goto oops;
} }
if (send_begin_line(sck) <= -1) goto oops;
scptr = script;
/* TODO: create hcl_xproto_open... */
memset (&proto, 0, HCL_SIZEOF(proto));
proto.hcl = hcl_openstdwithmmgr(hcl_client_getmmgr(client), 0, HCL_NULL); // TODO:
proto.rcv.state = HCL_XPROTO_RCV_HEADER;
proto.rcv.len_needed = HCL_SIZEOF(proto.rcv.hdr);
proto.rcv.eof = 0;
proto.rcv.polled = 0;
scptr = sccur = script;
while (1) while (1)
{ {
const char* nl; struct pollfd pfd;
nl = strchr(scptr, '\n');
if (send_script_line(sck, scptr, (nl? (nl - scptr): strlen(scptr))) <= -1) goto oops; pfd.fd = sck;
if (!nl) break; pfd.events = POLLIN | POLLERR;
scptr = nl + 1; if (*sccur != '\0') pfd.events |= POLLOUT;
pfd.revents = 0;
n = poll(&pfd, 1, 1000);
if (n <= -1)
{
fprintf (stderr, "poll error on %d - %s\n", sck, strerror(n));
goto oops;
}
if (n == 0)
{
/* TODO: proper timeout handling */
continue;
}
if (pfd.revents & POLLERR)
{
fprintf (stderr, "error condition detected on %d\n", sck);
goto oops;
}
if (pfd.revents & POLLOUT)
{
hcl_xpkt_hdr_t hdr;
struct iovec iov[2];
while (*sccur != '\0' && sccur - scptr < 255) sccur++;
hdr.type = HCL_XPKT_CODEIN;
hdr.id = 1; /* TODO: */
hdr.len = sccur - scptr;
iov[0].iov_base = &hdr;
iov[0].iov_len = HCL_SIZEOF(hdr);
iov[1].iov_base = scptr;
iov[1].iov_len = sccur - scptr;
send_iov (sck, iov, 2); /* TODO: error check */
scptr = sccur;
if (*sccur == '\0' && shut_wr_after_req) shutdown (sck, SHUT_WR);
}
if (pfd.revents & POLLIN)
{
printf ("receiving...\n");
if (receive_raw_bytes(&proto, sck, HCL_NULL) <= -1) break;
}
} }
if (send_end_line(sck) <= -1) goto oops;
if (shut_wr_after_req) shutdown (sck, SHUT_WR);
client_xtn->data_length = 0; client_xtn->data_length = 0;
client_xtn->reply_count = 0; client_xtn->reply_count = 0;
/* TODO: implement timeout? */
avail = 0;
while (client_xtn->reply_count == 0)
{
n = recv(sck, &buf[avail], HCL_SIZEOF(buf) - avail, 0);
if (n <= -1)
{
fprintf (stderr, "Unable to read from %d - %s\n", sck, strerror(n));
goto oops;
}
if (n == 0)
{
if (hcl_client_getstate(client) != HCL_CLIENT_STATE_START)
{
fprintf (stderr, "Sudden end of reply\n");
goto oops;
}
break;
}
avail += n;;
x = hcl_client_feed(client, buf, avail, &used);
if (x <= -1)
{
#if defined(HCL_OOCH_IS_UCH)
hcl_errnum_t errnum = hcl_client_geterrnum(client);
const hcl_ooch_t* errmsg = hcl_client_geterrmsg(client);
hcl_bch_t errbuf[2048];
hcl_oow_t ucslen, bcslen;
bcslen = HCL_COUNTOF(errbuf);
hcl_conv_ucstr_to_bcstr_with_cmgr (errmsg, &ucslen, errbuf, &bcslen, hcl_client_getcmgr(client));
fprintf (stderr, "Client error [%d] - %s\n", (int)errnum, errbuf);
#else
fprintf (stderr, "Client error [%d] - %s\n", (int)hcl_client_geterrnum(client), hcl_client_geterrmsg(client));
#endif
goto oops;
}
avail -= used;
if (avail > 0) memmove (&buf[0], &buf[used], avail);
}
/* TODO: we can check if the buffer has all been consumed. if not, there is trailing garbage.. */ /* TODO: we can check if the buffer has all been consumed. if not, there is trailing garbage.. */
/*shutdown (sck, (shut_wr_after_req? SHUT_RD: SHUT_RDWR));*/ /*shutdown (sck, (shut_wr_after_req? SHUT_RD: SHUT_RDWR));*/
@ -861,10 +818,6 @@ int main (int argc, char* argv[])
memset (&client_prim, 0, HCL_SIZEOF(client_prim)); memset (&client_prim, 0, HCL_SIZEOF(client_prim));
client_prim.log_write = log_write; client_prim.log_write = log_write;
client_prim.start_reply = start_reply;
client_prim.feed_attr = feed_attr;
client_prim.feed_data = feed_data;
client_prim.end_reply = end_reply;
client = hcl_client_open(&sys_mmgr, HCL_SIZEOF(client_xtn_t), &client_prim, HCL_NULL); client = hcl_client_open(&sys_mmgr, HCL_SIZEOF(client_xtn_t), &client_prim, HCL_NULL);
if (!client) if (!client)

View File

@ -24,7 +24,7 @@
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "hcl-s.h" #include "hcl-x.h"
#include "hcl-opt.h" #include "hcl-opt.h"
#include "hcl-utl.h" #include "hcl-utl.h"
#include "hcl-xutl.h" #include "hcl-xutl.h"

View File

@ -106,12 +106,13 @@ endif
if ENABLE_HCLX if ENABLE_HCLX
pkglib_LTLIBRARIES += libhclx.la pkglib_LTLIBRARIES += libhclx.la
pkginclude_HEADERS += hcl-c.h hcl-s.h hcl-tmr.h hcl-xutl.h hcl-json.h pkginclude_HEADERS += hcl-c.h hcl-s.h hcl-x.h hcl-tmr.h hcl-xutl.h hcl-json.h
libhclx_la_SOURCES = \ libhclx_la_SOURCES = \
tmr.c hcl-tmr.h \ tmr.c hcl-tmr.h \
xutl.c xutl-sa.h hcl-xutl.h \ xutl.c xutl-sa.h hcl-xutl.h \
json.c hcl-json.h \ json.c hcl-json.h \
hcl-s.c hcl-s2.c hcl-s.h \ hcl-s.c hcl-s.h \
hcl-x.c hcl-x.h \
hcl-c.c hcl-c.h hcl-c.c hcl-c.h
libhclx_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD) libhclx_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD)
libhclx_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) libhclx_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)

View File

@ -97,7 +97,7 @@ host_triplet = @host@
@ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-str.la \ @ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-str.la \
@ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-sys.la @ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-sys.la
@ENABLE_HCLX_TRUE@am__append_7 = libhclx.la @ENABLE_HCLX_TRUE@am__append_7 = libhclx.la
@ENABLE_HCLX_TRUE@am__append_8 = hcl-c.h hcl-s.h hcl-tmr.h hcl-xutl.h hcl-json.h @ENABLE_HCLX_TRUE@am__append_8 = hcl-c.h hcl-s.h hcl-x.h hcl-tmr.h hcl-xutl.h hcl-json.h
subdir = lib subdir = lib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
@ -171,11 +171,11 @@ libhcl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@ENABLE_HCLX_TRUE@libhclx_la_DEPENDENCIES = libhcl.la \ @ENABLE_HCLX_TRUE@libhclx_la_DEPENDENCIES = libhcl.la \
@ENABLE_HCLX_TRUE@ $(am__DEPENDENCIES_5) @ENABLE_HCLX_TRUE@ $(am__DEPENDENCIES_5)
am__libhclx_la_SOURCES_DIST = tmr.c hcl-tmr.h xutl.c xutl-sa.h \ am__libhclx_la_SOURCES_DIST = tmr.c hcl-tmr.h xutl.c xutl-sa.h \
hcl-xutl.h json.c hcl-json.h hcl-s.c hcl-s2.c hcl-s.h hcl-c.c \ hcl-xutl.h json.c hcl-json.h hcl-s.c hcl-s.h hcl-x.c hcl-x.h \
hcl-c.h hcl-c.c hcl-c.h
@ENABLE_HCLX_TRUE@am_libhclx_la_OBJECTS = libhclx_la-tmr.lo \ @ENABLE_HCLX_TRUE@am_libhclx_la_OBJECTS = libhclx_la-tmr.lo \
@ENABLE_HCLX_TRUE@ libhclx_la-xutl.lo libhclx_la-json.lo \ @ENABLE_HCLX_TRUE@ libhclx_la-xutl.lo libhclx_la-json.lo \
@ENABLE_HCLX_TRUE@ libhclx_la-hcl-s.lo libhclx_la-hcl-s2.lo \ @ENABLE_HCLX_TRUE@ libhclx_la-hcl-s.lo libhclx_la-hcl-x.lo \
@ENABLE_HCLX_TRUE@ libhclx_la-hcl-c.lo @ENABLE_HCLX_TRUE@ libhclx_la-hcl-c.lo
libhclx_la_OBJECTS = $(am_libhclx_la_OBJECTS) libhclx_la_OBJECTS = $(am_libhclx_la_OBJECTS)
libhclx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ libhclx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@ -213,7 +213,7 @@ am__depfiles_remade = ./$(DEPDIR)/libhcl_la-bigint.Plo \
./$(DEPDIR)/libhcl_la-utl.Plo ./$(DEPDIR)/libhcl_la-xchg.Plo \ ./$(DEPDIR)/libhcl_la-utl.Plo ./$(DEPDIR)/libhcl_la-xchg.Plo \
./$(DEPDIR)/libhcl_la-xma.Plo ./$(DEPDIR)/libhclx_la-hcl-c.Plo \ ./$(DEPDIR)/libhcl_la-xma.Plo ./$(DEPDIR)/libhclx_la-hcl-c.Plo \
./$(DEPDIR)/libhclx_la-hcl-s.Plo \ ./$(DEPDIR)/libhclx_la-hcl-s.Plo \
./$(DEPDIR)/libhclx_la-hcl-s2.Plo \ ./$(DEPDIR)/libhclx_la-hcl-x.Plo \
./$(DEPDIR)/libhclx_la-json.Plo ./$(DEPDIR)/libhclx_la-tmr.Plo \ ./$(DEPDIR)/libhclx_la-json.Plo ./$(DEPDIR)/libhclx_la-tmr.Plo \
./$(DEPDIR)/libhclx_la-xutl.Plo ./$(DEPDIR)/libhclx_la-xutl.Plo
am__mv = mv -f am__mv = mv -f
@ -244,7 +244,7 @@ am__can_run_installinfo = \
esac esac
am__pkginclude_HEADERS_DIST = hcl.h hcl-chr.h hcl-cmn.h hcl-fmt.h \ am__pkginclude_HEADERS_DIST = hcl.h hcl-chr.h hcl-cmn.h hcl-fmt.h \
hcl-opt.h hcl-pac1.h hcl-rbt.h hcl-upac.h hcl-utl.h hcl-xma.h \ hcl-opt.h hcl-pac1.h hcl-rbt.h hcl-upac.h hcl-utl.h hcl-xma.h \
hcl-c.h hcl-s.h hcl-tmr.h hcl-xutl.h hcl-json.h hcl-c.h hcl-s.h hcl-x.h hcl-tmr.h hcl-xutl.h hcl-json.h
HEADERS = $(pkginclude_HEADERS) HEADERS = $(pkginclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
hcl-cfg.h.in hcl-cfg.h.in
@ -479,7 +479,8 @@ libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_6)
@ENABLE_HCLX_TRUE@ tmr.c hcl-tmr.h \ @ENABLE_HCLX_TRUE@ tmr.c hcl-tmr.h \
@ENABLE_HCLX_TRUE@ xutl.c xutl-sa.h hcl-xutl.h \ @ENABLE_HCLX_TRUE@ xutl.c xutl-sa.h hcl-xutl.h \
@ENABLE_HCLX_TRUE@ json.c hcl-json.h \ @ENABLE_HCLX_TRUE@ json.c hcl-json.h \
@ENABLE_HCLX_TRUE@ hcl-s.c hcl-s2.c hcl-s.h \ @ENABLE_HCLX_TRUE@ hcl-s.c hcl-s.h \
@ENABLE_HCLX_TRUE@ hcl-x.c hcl-x.h \
@ENABLE_HCLX_TRUE@ hcl-c.c hcl-c.h @ENABLE_HCLX_TRUE@ hcl-c.c hcl-c.h
@ENABLE_HCLX_TRUE@libhclx_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD) @ENABLE_HCLX_TRUE@libhclx_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD)
@ -612,7 +613,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-xma.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-xma.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-hcl-c.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-hcl-c.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-hcl-s.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-hcl-s.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-hcl-s2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-hcl-x.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-json.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-json.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-tmr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-tmr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-xutl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-xutl.Plo@am__quote@ # am--include-marker
@ -871,12 +872,12 @@ libhclx_la-hcl-s.lo: hcl-s.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-hcl-s.lo `test -f 'hcl-s.c' || echo '$(srcdir)/'`hcl-s.c @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-hcl-s.lo `test -f 'hcl-s.c' || echo '$(srcdir)/'`hcl-s.c
libhclx_la-hcl-s2.lo: hcl-s2.c libhclx_la-hcl-x.lo: hcl-x.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclx_la-hcl-s2.lo -MD -MP -MF $(DEPDIR)/libhclx_la-hcl-s2.Tpo -c -o libhclx_la-hcl-s2.lo `test -f 'hcl-s2.c' || echo '$(srcdir)/'`hcl-s2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclx_la-hcl-x.lo -MD -MP -MF $(DEPDIR)/libhclx_la-hcl-x.Tpo -c -o libhclx_la-hcl-x.lo `test -f 'hcl-x.c' || echo '$(srcdir)/'`hcl-x.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhclx_la-hcl-s2.Tpo $(DEPDIR)/libhclx_la-hcl-s2.Plo @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhclx_la-hcl-x.Tpo $(DEPDIR)/libhclx_la-hcl-x.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hcl-s2.c' object='libhclx_la-hcl-s2.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hcl-x.c' object='libhclx_la-hcl-x.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-hcl-s2.lo `test -f 'hcl-s2.c' || echo '$(srcdir)/'`hcl-s2.c @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-hcl-x.lo `test -f 'hcl-x.c' || echo '$(srcdir)/'`hcl-x.c
libhclx_la-hcl-c.lo: hcl-c.c libhclx_la-hcl-c.lo: hcl-c.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclx_la-hcl-c.lo -MD -MP -MF $(DEPDIR)/libhclx_la-hcl-c.Tpo -c -o libhclx_la-hcl-c.lo `test -f 'hcl-c.c' || echo '$(srcdir)/'`hcl-c.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclx_la-hcl-c.lo -MD -MP -MF $(DEPDIR)/libhclx_la-hcl-c.Tpo -c -o libhclx_la-hcl-c.lo `test -f 'hcl-c.c' || echo '$(srcdir)/'`hcl-c.c
@ -1069,7 +1070,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/libhcl_la-xma.Plo -rm -f ./$(DEPDIR)/libhcl_la-xma.Plo
-rm -f ./$(DEPDIR)/libhclx_la-hcl-c.Plo -rm -f ./$(DEPDIR)/libhclx_la-hcl-c.Plo
-rm -f ./$(DEPDIR)/libhclx_la-hcl-s.Plo -rm -f ./$(DEPDIR)/libhclx_la-hcl-s.Plo
-rm -f ./$(DEPDIR)/libhclx_la-hcl-s2.Plo -rm -f ./$(DEPDIR)/libhclx_la-hcl-x.Plo
-rm -f ./$(DEPDIR)/libhclx_la-json.Plo -rm -f ./$(DEPDIR)/libhclx_la-json.Plo
-rm -f ./$(DEPDIR)/libhclx_la-tmr.Plo -rm -f ./$(DEPDIR)/libhclx_la-tmr.Plo
-rm -f ./$(DEPDIR)/libhclx_la-xutl.Plo -rm -f ./$(DEPDIR)/libhclx_la-xutl.Plo
@ -1149,7 +1150,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/libhcl_la-xma.Plo -rm -f ./$(DEPDIR)/libhcl_la-xma.Plo
-rm -f ./$(DEPDIR)/libhclx_la-hcl-c.Plo -rm -f ./$(DEPDIR)/libhclx_la-hcl-c.Plo
-rm -f ./$(DEPDIR)/libhclx_la-hcl-s.Plo -rm -f ./$(DEPDIR)/libhclx_la-hcl-s.Plo
-rm -f ./$(DEPDIR)/libhclx_la-hcl-s2.Plo -rm -f ./$(DEPDIR)/libhclx_la-hcl-x.Plo
-rm -f ./$(DEPDIR)/libhclx_la-json.Plo -rm -f ./$(DEPDIR)/libhclx_la-json.Plo
-rm -f ./$(DEPDIR)/libhclx_la-tmr.Plo -rm -f ./$(DEPDIR)/libhclx_la-tmr.Plo
-rm -f ./$(DEPDIR)/libhclx_la-xutl.Plo -rm -f ./$(DEPDIR)/libhclx_la-xutl.Plo

View File

@ -21,6 +21,7 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#if 0
#include "hcl-c.h" #include "hcl-c.h"
#include "hcl-prv.h" #include "hcl-prv.h"
@ -1044,3 +1045,5 @@ int hcl_client_feed (hcl_client_t* client, const void* ptr, hcl_oow_t len, hcl_o
*xlen = total; *xlen = total;
return 0; return 0;
} }
#endif

View File

@ -21,6 +21,7 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#if 0
#ifndef _HCL_C_H_ #ifndef _HCL_C_H_
#define _HCL_C_H_ #define _HCL_C_H_
@ -265,3 +266,6 @@ HCL_EXPORT void hcl_client_freemem (
#endif #endif
#endif #endif
#endif

View File

@ -21,6 +21,7 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#if 0
#include "hcl-s.h" #include "hcl-s.h"
#include "hcl-prv.h" #include "hcl-prv.h"
@ -515,8 +516,8 @@ start_over:
#if defined(HCL_OOCH_IS_UCH) #if defined(HCL_OOCH_IS_UCH)
bcslen = bb->len; bcslen = bb->len;
ucslen = HCL_COUNTOF(arg->buf); ucslen = HCL_COUNTOF(arg->buf.c);
y = hcl_convbtooochars(hcl, bb->buf, &bcslen, arg->buf, &ucslen); y = hcl_convbtooochars(hcl, bb->buf, &bcslen, arg->buf.c, &ucslen);
if (y <= -1 && ucslen <= 0) if (y <= -1 && ucslen <= 0)
{ {
if (y == -3 && x != 0) goto start_over; /* incomplete sequence and not EOF yet */ if (y == -3 && x != 0) goto start_over; /* incomplete sequence and not EOF yet */
@ -525,9 +526,9 @@ start_over:
/* if ucslen is greater than 0, i see that some characters have been /* if ucslen is greater than 0, i see that some characters have been
* converted properly */ * converted properly */
#else #else
bcslen = (bb->len < HCL_COUNTOF(arg->buf))? bb->len: HCL_COUNTOF(arg->buf); bcslen = (bb->len < HCL_COUNTOF(arg->buf.b))? bb->len: HCL_COUNTOF(arg->buf.b);
ucslen = bcslen; ucslen = bcslen;
hcl_copy_bchars (arg->buf, bb->buf, bcslen); hcl_copy_bchars (arg->buf.b, bb->buf, bcslen);
#endif #endif
remlen = bb->len - bcslen; remlen = bb->len - bcslen;
@ -2555,3 +2556,5 @@ void hcl_server_freemem (hcl_server_t* server, void* ptr)
{ {
HCL_MMGR_FREE (server->_mmgr, ptr); HCL_MMGR_FREE (server->_mmgr, ptr);
} }
#endif

View File

@ -22,6 +22,7 @@
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#if 0
#ifndef _HCL_S_H_ #ifndef _HCL_S_H_
#define _HCL_S_H_ #define _HCL_S_H_
@ -219,3 +220,7 @@ HCL_EXPORT int hcl_server_proto_handle_request (
#endif #endif
#endif #endif
#endif

File diff suppressed because it is too large Load Diff

401
lib/hcl-x.h Normal file
View File

@ -0,0 +1,401 @@
/*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _HCL_X_T_
#define _HCL_X_T_
/*#include <hcl-cmn.h>*/
#include <hcl.h>
enum hcl_xpkt_type_t
{
HCL_XPKT_CODEIN,
HCL_XPKT_CODEOUT, /* return value is passed over this? */
HCL_XPKT_STDIN,
HCL_XPKT_STDOUT,
HCL_XPKT_LIST_WORKERS,
HCL_XPKT_KILL_WORKER
};
typedef enum hcl_xpkt_type_t hcl_xpkt_type_t;
struct hcl_xpkt_hdr_t
{
hcl_uint8_t type;
hcl_uint8_t id;
hcl_uint8_t len;
};
typedef struct hcl_xpkt_hdr_t hcl_xpkt_hdr_t;
/* ---------------------------------------------------------------------- */
typedef struct hcl_server_proto_t hcl_server_proto_t;
typedef struct hcl_server_worker_t hcl_server_worker_t;
typedef struct hcl_server_t hcl_server_t;
enum hcl_server_option_t
{
HCL_SERVER_TRAIT,
HCL_SERVER_LOG_MASK,
HCL_SERVER_WORKER_MAX_COUNT,
HCL_SERVER_WORKER_STACK_SIZE,
HCL_SERVER_WORKER_IDLE_TIMEOUT,
HCL_SERVER_ACTOR_HEAP_SIZE,
HCL_SERVER_ACTOR_MAX_RUNTIME,
HCL_SERVER_SCRIPT_INCLUDE_PATH,
HCL_SERVER_MODULE_INCTX
};
typedef enum hcl_server_option_t hcl_server_option_t;
enum hcl_server_trait_t
{
#if defined(HCL_BUILD_DEBUG)
HCL_SERVER_TRAIT_DEBUG_GC = (1 << 0),
HCL_SERVER_TRAIT_DEBUG_BIGINT = (1 << 1)
#endif
};
typedef enum hcl_server_trait_t hcl_server_trait_t;
#define HCL_SERVER_WID_INVALID ((hcl_oow_t)-1)
#define HCL_SERVER_WID_MAX (HCL_SERVER_WID_INVALID - 1)
typedef void (*hcl_server_log_write_t) (
hcl_server_t* server,
hcl_oow_t wid,
hcl_bitmask_t mask,
const hcl_ooch_t* msg,
hcl_oow_t len
);
struct hcl_server_prim_t
{
hcl_server_log_write_t log_write;
};
typedef struct hcl_server_prim_t hcl_server_prim_t;
/* ---------------------------------------------------------------------- */
typedef struct hcl_client_t hcl_client_t;
enum hcl_client_option_t
{
HCL_CLIENT_TRAIT,
HCL_CLIENT_LOG_MASK,
};
typedef enum hcl_client_option_t hcl_client_option_t;
enum hcl_client_trait_t
{
/* no trait defined at this moment. XXXX is just a placeholder */
HCL_CLIENT_XXXX = (1 << 0)
};
typedef enum hcl_client_trait_t hcl_client_trait_t;
typedef void (*hcl_client_log_write_t) (
hcl_client_t* client,
hcl_bitmask_t mask,
const hcl_ooch_t* msg,
hcl_oow_t len
);
struct hcl_client_prim_t
{
hcl_client_log_write_t log_write;
};
typedef struct hcl_client_prim_t hcl_client_prim_t;
/* ---------------------------------------------------------------------- */
#if defined(__cplusplus)
extern "C" {
#endif
HCL_EXPORT hcl_server_t* hcl_server_open (
hcl_mmgr_t* mmgr,
hcl_oow_t xtnsize,
hcl_server_prim_t* prim,
hcl_errnum_t* errnum
);
HCL_EXPORT void hcl_server_close (
hcl_server_t* server
);
HCL_EXPORT int hcl_server_start (
hcl_server_t* server,
const hcl_bch_t* addrs
);
HCL_EXPORT void hcl_server_stop (
hcl_server_t* server
);
HCL_EXPORT int hcl_server_setoption (
hcl_server_t* server,
hcl_server_option_t id,
const void* value
);
HCL_EXPORT int hcl_server_getoption (
hcl_server_t* server,
hcl_server_option_t id,
void* value
);
HCL_EXPORT void* hcl_server_getxtn (
hcl_server_t* server
);
HCL_EXPORT hcl_mmgr_t* hcl_server_getmmgr (
hcl_server_t* server
);
HCL_EXPORT hcl_cmgr_t* hcl_server_getcmgr (
hcl_server_t* server
);
HCL_EXPORT void hcl_server_setcmgr (
hcl_server_t* server,
hcl_cmgr_t* cmgr
);
HCL_EXPORT hcl_errnum_t hcl_server_geterrnum (
hcl_server_t* server
);
HCL_EXPORT const hcl_ooch_t* hcl_server_geterrstr (
hcl_server_t* server
);
HCL_EXPORT const hcl_ooch_t* hcl_server_geterrmsg (
hcl_server_t* server
);
HCL_EXPORT void hcl_server_seterrnum (
hcl_server_t* server,
hcl_errnum_t errnum
);
HCL_EXPORT void hcl_server_seterrbfmt (
hcl_server_t* server,
hcl_errnum_t errnum,
const hcl_bch_t* fmt,
...
);
HCL_EXPORT void hcl_server_seterrufmt (
hcl_server_t* server,
hcl_errnum_t errnum,
const hcl_uch_t* fmt,
...
);
HCL_EXPORT void hcl_server_logbfmt (
hcl_server_t* server,
hcl_bitmask_t mask,
const hcl_bch_t* fmt,
...
);
HCL_EXPORT void hcl_server_logufmt (
hcl_server_t* server,
hcl_bitmask_t mask,
const hcl_uch_t* fmt,
...
);
HCL_EXPORT void* hcl_server_allocmem (
hcl_server_t* server,
hcl_oow_t size
);
HCL_EXPORT void* hcl_server_callocmem (
hcl_server_t* server,
hcl_oow_t size
);
HCL_EXPORT void* hcl_server_reallocmem (
hcl_server_t* server,
void* ptr,
hcl_oow_t size
);
HCL_EXPORT void hcl_server_freemem (
hcl_server_t* server,
void* ptr
);
HCL_EXPORT int hcl_server_proto_feed_reply (
hcl_server_proto_t* proto,
const hcl_ooch_t* ptr,
hcl_oow_t len,
int escape
);
HCL_EXPORT int hcl_server_proto_feed_reply_bytes (
hcl_server_proto_t* proto,
const hcl_bch_t* ptr,
hcl_oow_t len
);
HCL_EXPORT int hcl_server_proto_handle_incoming (
hcl_server_proto_t* proto
);
/* ---------------------------------------------------------------------- */
HCL_EXPORT hcl_client_t* hcl_client_open (
hcl_mmgr_t* mmgr,
hcl_oow_t xtnsize,
hcl_client_prim_t* prim,
hcl_errnum_t* errnum
);
HCL_EXPORT void hcl_client_close (
hcl_client_t* client
);
HCL_EXPORT void hcl_client_reset (
hcl_client_t* client
);
HCL_EXPORT int hcl_client_feed (
hcl_client_t* client,
const void* ptr,
hcl_oow_t len,
hcl_oow_t* xlen
);
HCL_EXPORT int hcl_client_setoption (
hcl_client_t* client,
hcl_client_option_t id,
const void* value
);
HCL_EXPORT int hcl_client_getoption (
hcl_client_t* client,
hcl_client_option_t id,
void* value
);
HCL_EXPORT void* hcl_client_getxtn (
hcl_client_t* client
);
HCL_EXPORT hcl_mmgr_t* hcl_client_getmmgr (
hcl_client_t* client
);
HCL_EXPORT hcl_cmgr_t* hcl_client_getcmgr (
hcl_client_t* client
);
HCL_EXPORT void hcl_client_setcmgr (
hcl_client_t* client,
hcl_cmgr_t* cmgr
);
HCL_EXPORT hcl_errnum_t hcl_client_geterrnum (
hcl_client_t* client
);
HCL_EXPORT const hcl_ooch_t* hcl_client_geterrstr (
hcl_client_t* client
);
HCL_EXPORT const hcl_ooch_t* hcl_client_geterrmsg (
hcl_client_t* client
);
HCL_EXPORT void hcl_client_seterrnum (
hcl_client_t* client,
hcl_errnum_t errnum
);
HCL_EXPORT void hcl_client_seterrbfmt (
hcl_client_t* client,
hcl_errnum_t errnum,
const hcl_bch_t* fmt,
...
);
HCL_EXPORT void hcl_client_seterrufmt (
hcl_client_t* client,
hcl_errnum_t errnum,
const hcl_uch_t* fmt,
...
);
HCL_EXPORT void hcl_client_logbfmt (
hcl_client_t* client,
hcl_bitmask_t mask,
const hcl_bch_t* fmt,
...
);
HCL_EXPORT void hcl_client_logufmt (
hcl_client_t* client,
hcl_bitmask_t mask,
const hcl_uch_t* fmt,
...
);
HCL_EXPORT void* hcl_client_allocmem (
hcl_client_t* client,
hcl_oow_t size
);
HCL_EXPORT void* hcl_client_callocmem (
hcl_client_t* client,
hcl_oow_t size
);
HCL_EXPORT void* hcl_client_reallocmem (
hcl_client_t* client,
void* ptr,
hcl_oow_t size
);
HCL_EXPORT void hcl_client_freemem (
hcl_client_t* client,
void* ptr
);
#if defined(__cplusplus)
}
#endif
#endif