added hcl-s.c and hcl-s.h
This commit is contained in:
parent
34a23ef986
commit
773f09aab2
2002
lib/hcl-s.c
Normal file
2002
lib/hcl-s.c
Normal file
File diff suppressed because it is too large
Load Diff
114
lib/hcl-s.h
Normal file
114
lib/hcl-s.h
Normal file
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
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_S_H_
|
||||
#define _HCL_S_H_
|
||||
|
||||
#include <hcl.h>
|
||||
|
||||
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_STACK_SIZE,
|
||||
HCL_SERVER_ACTOR_HEAP_SIZE
|
||||
};
|
||||
typedef enum hcl_server_option_t hcl_server_option_t;
|
||||
|
||||
enum hcl_server_trait_t
|
||||
{
|
||||
HCL_SERVER_TRAIT_READABLE_PROTO = (1 << 0),
|
||||
HCL_SERVER_TRAIT_USE_LARGE_PAGES = (1 << 1)
|
||||
};
|
||||
typedef enum hcl_server_trait_t hcl_server_trait_t;
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
HCL_EXPORT hcl_server_t* hcl_server_open (
|
||||
hcl_mmgr_t* mmgr,
|
||||
hcl_oow_t xtnsize,
|
||||
unsigned int dbgopt
|
||||
);
|
||||
|
||||
HCL_EXPORT void hcl_server_close (
|
||||
hcl_server_t* server
|
||||
);
|
||||
|
||||
|
||||
HCL_EXPORT int hcl_server_start (
|
||||
hcl_server_t* server,
|
||||
const char* 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
|
||||
);
|
||||
|
||||
|
||||
#if defined(HCL_HAVE_INLINE)
|
||||
static HCL_INLINE hcl_mmgr_t* hcl_server_getmmgr (hcl_server_t* server) { return server->mmgr; }
|
||||
static HCL_INLINE void* hcl_server_getxtn (hcl_server_t* server) { return (void*)(hcl + 1); }
|
||||
|
||||
/*static HCL_INLINE hcl_server_cmgr_t* hcl_server_getcmgr (hcl_server_t* server) { return server->cmgr; }
|
||||
static HCL_INLINE void hcl_server_setcmgr (hcl_server_t* hcl, hcl_server_cmgr_t* cmgr) { server->cmgr = cmgr; }*/
|
||||
|
||||
static HCL_INLINE hcl_server_errnum_t hcl_server_geterrnum (hcl_server_t* server) { return server->errnum; }
|
||||
|
||||
#else
|
||||
# define hcl_server_getmmgr(server) ((server)->mmgr)
|
||||
# define hcl_server_getxtn(server) ((void*)((server) + 1))
|
||||
|
||||
/*# define hcl_server_getcmgr(server) ((server)->cmgr)
|
||||
# define hcl_server_setcmgr(hcl,mgr) ((server)->cmgr = (mgr))*/
|
||||
|
||||
# define hcl_server_geterrnum(server) ((server)->errnum)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user