1 #ifndef ACL_MASTER_SERVER_API_INCLUDE_H 2 #define ACL_MASTER_SERVER_API_INCLUDE_H 4 #include "../stdlib/acl_define.h" 9 #include "../stdlib/acl_vstream.h" 10 #include "../ioctl/acl_ioctl.h" 11 #include "../aio/acl_aio.h" 12 #include "../event/acl_events.h" 14 #ifndef ACL_CLIENT_ONLY 20 #define ACL_MASTER_SERVER_END 0 21 #define ACL_MASTER_SERVER_INT_TABLE 1 22 #define ACL_MASTER_SERVER_STR_TABLE 2 23 #define ACL_MASTER_SERVER_BOOL_TABLE 3 24 #define ACL_MASTER_SERVER_TIME_TABLE 4 25 #define ACL_MASTER_SERVER_RAW_TABLE 5 26 #define ACL_MASTER_SERVER_INT64_TABLE 6 27 #define ACL_MASTER_SERVER_IN_FLOW_DELAY 8 29 #define ACL_MASTER_SERVER_PRE_INIT 10 30 #define ACL_MASTER_SERVER_POST_INIT 11 31 #define ACL_MASTER_SERVER_LOOP 12 32 #define ACL_MASTER_SERVER_EXIT 13 33 #define ACL_MASTER_SERVER_SOLITARY 14 34 #define ACL_MASTER_SERVER_UNLIMITED 15 35 #define ACL_MASTER_SERVER_ON_CLOSE 16 36 #define ACL_MASTER_SERVER_ON_ACCEPT 17 37 #define ACL_MASTER_SERVER_ON_TIMEOUT 18 38 #define ACL_MASTER_SERVER_ON_HANDSHAKE 19 40 #define ACL_MASTER_SERVER_THREAD_INIT 20 41 #define ACL_MASTER_SERVER_THREAD_INIT_CTX 21 42 #define ACL_MASTER_SERVER_THREAD_EXIT 22 43 #define ACL_MASTER_SERVER_THREAD_EXIT_CTX 23 44 #define ACL_MASTER_SERVER_CTX 24 45 #define ACL_MASTER_SERVER_DENY_INFO 25 47 #define ACL_MASTER_SERVER_EXIT_TIMER 26 48 #define ACL_MASTER_SERVER_ON_LISTEN 27 49 #define ACL_MASTER_SERVER_ON_BIND ACL_MASTER_SERVER_ON_LISTEN 50 #define ACL_MASTER_SERVER_SIGHUP 28 51 #define ACL_MASTER_SERVER_ON_UNBIND 29 53 #define ACL_APP_CTL_END ACL_MASTER_SERVER_END 54 #define ACL_APP_CTL_CFG_INT ACL_MASTER_SERVER_INT_TABLE 55 #define ACL_APP_CTL_CFG_STR ACL_MASTER_SERVER_STR_TABLE 56 #define ACL_APP_CTL_CFG_BOOL ACL_MASTER_SERVER_BOOL_TABLE 57 #define ACL_APP_CTL_CFG_INT64 ACL_MASTER_SERVER_INT64_TABLE 58 #define ACL_APP_CTL_INIT_FN ACL_MASTER_SERVER_POST_INIT 59 #define ACL_APP_CTL_PRE_JAIL ACL_MASTER_SERVER_PRE_INIT 60 #define ACL_APP_CTL_EXIT_FN ACL_MASTER_SERVER_EXIT 61 #define ACL_APP_CTL_THREAD_INIT ACL_MASTER_SERVER_THREAD_INIT 62 #define ACL_APP_CTL_THREAD_INIT_CTX ACL_MASTER_SERVER_THREAD_INIT_CTX 63 #define ACL_APP_CTL_THREAD_EXIT ACL_MASTER_SERVER_THREAD_EXIT 64 #define ACL_APP_CTL_THREAD_EXIT_CTX ACL_MASTER_SERVER_THREAD_EXIT_CTX 65 #define ACL_APP_CTL_DENY_INFO ACL_MASTER_DENY_INFO 66 #define ACL_APP_CTL_ON_ACCEPT ACL_MASTER_SERVER_ON_ACCEPT 67 #define ACL_APP_CTL_ON_CLOSE ACL_MASTER_SERVER_ON_CLOSE 68 #define ACL_APP_CTL_ON_TIMEOUT ACL_MASTER_SERVER_ON_TIMEOUT 69 #define ACL_APP_CTL_ON_SIGHUP ACL_MASTER_SERVER_SIGHUP 105 #define acl_ioctl_app_main acl_threads_server_main 135 void *arg,
int delay);
150 void *context,
const char *data,
int dlen);
152 void *context,
const char *
fmt, va_list ap);
154 void *context,
const char *
fmt, ...);
167 acl_int64 delay,
int keep);
181 #define ACL_TRIGGER_BUF_SIZE 1024 int(* ACL_MASTER_SERVER_LOOP_FN)(void *)
void(* ACL_MASTER_SERVER_DISCONN_FN)(void *, ACL_VSTREAM *)
int(* ACL_MASTER_SERVER_ON_ACCEPT_FN)(void *, ACL_VSTREAM *)
ACL_API int acl_aio_server_fprintf(ACL_ASTREAM *astream, ACL_AIO_WRITE_FN notify_fn, void *context, const char *fmt,...)
ACL_DEPRECATED void acl_aio_app_main(int argc, char *argv[], ACL_AIO_RUN_FN run_fn, void *run_ctx,...)
void(* ACL_UDP_SERVER_FN)(void *ctx, ACL_VSTREAM *)
void(* ACL_SINGLE_SERVER_FN)(void *, ACL_VSTREAM *)
ACL_API ACL_EVENT * acl_aio_server_event(void)
HTTP_API void const char * name
int(* ACL_MASTER_SERVER_EXIT_TIMER_FN)(void *, size_t, size_t)
void(* ACL_MASTER_SERVER_INIT_FN)(void *)
void(* ACL_AIO_SERVER_FN)(ACL_ASTREAM *, void *)
ACL_API int acl_var_server_gotsighup
ACL_API acl_pthread_pool_t * acl_threads_server_threads(void)
int(* ACL_AIO_RUN2_FN)(ACL_SOCKET fd, void *run_ctx)
ACL_API ACL_EVENT * acl_udp_server_event(void)
ACL_API ACL_EVENT * acl_threads_server_event(void)
ACL_API ACL_EVENT * acl_trigger_server_event(void)
ACL_DEPRECATED void acl_aio_app2_main(int argc, char *argv[], ACL_AIO_RUN2_FN run2_fn, void *run_ctx,...)
ACL_API void acl_udp_server_cancel_timer(ACL_EVENT_NOTIFY_TIME timer_fn, void *arg)
int(* ACL_THREADS_SERVER_FN)(void *, ACL_VSTREAM *)
int(* ACL_MASTER_SERVER_TIMEOUT_FN)(void *, ACL_VSTREAM *)
int(* ACL_AIO_CONNECT_FN)(ACL_ASTREAM *cstream, void *context)
int(* ACL_AIO_RUN_FN)(ACL_ASTREAM *stream, void *run_ctx)
void(* ACL_MASTER_SERVER_THREAD_EXIT_FN)(void *)
void(* ACL_MASTER_SERVER_EXIT_FN)(void *)
void(* ACL_MASTER_SERVER_ON_BIND_FN)(void *, ACL_VSTREAM *)
ACL_API ACL_EVENT * acl_single_server_event(void)
ACL_API int acl_aio_server_connect(const char *saddr, int timeout, ACL_AIO_CONNECT_FN connect_fn, void *context)
ACL_API void acl_aio_server_cancel_rw_timer(ACL_ASTREAM *)
ACL_API ACL_VSTREAM ** acl_single_server_sstreams(void)
void(* ACL_MASTER_SERVER_ON_UNBIND_FN)(void *, ACL_VSTREAM *)
int(* ACL_AIO_WRITE_FN)(ACL_ASTREAM *astream, void *context)
ACL_API ACL_VSTREAM ** acl_udp_server_streams(void)
ACL_API void acl_aio_server_request_timer(ACL_EVENT_NOTIFY_TIME timer_fn, void *arg, int delay)
void(* ACL_MASTER_SERVER_ON_LISTEN_FN)(void *, ACL_VSTREAM *)
int(* ACL_AIO_READ_FN)(ACL_ASTREAM *astream, void *context, char *data, int dlen)
ACL_API const char * acl_udp_server_conf(void)
ACL_API int acl_aio_server_writen(ACL_ASTREAM *astream, ACL_AIO_WRITE_FN notify_fn, void *context, const char *data, int dlen)
ACL_API ACL_AIO * acl_aio_server_handle(void)
ACL_API int acl_aio_server_gets(ACL_ASTREAM *astream, int timeout, ACL_AIO_READ_FN notify_fn, void *context)
ACL_API void acl_server_sighup_setup(void)
ACL_API const char * acl_threads_server_conf(void)
struct acl_pthread_pool_t acl_pthread_pool_t
ACL_API void acl_aio_server_on_close(ACL_ASTREAM *stream)
ACL_API void acl_server_sigterm_setup(void)
int(* ACL_MASTER_SERVER_SIGHUP_FN)(void *, ACL_VSTRING *)
void(* ACL_AIO_SERVER2_FN)(ACL_SOCKET, void *)
ACL_API void acl_udp_server_request_timer(ACL_EVENT_NOTIFY_TIME timer_fn, void *arg, acl_int64 delay, int keep)
struct ACL_EVENT ACL_EVENT
ACL_API void acl_threads_server_enable_read(ACL_EVENT *event, acl_pthread_pool_t *threads, ACL_VSTREAM *stream)
ACL_API int acl_aio_server_readn(ACL_ASTREAM *astream, int count, int timeout, ACL_AIO_READ_FN notify_fn, void *context)
int(* ACL_MASTER_SERVER_HANDSHAKE_FN)(void *, ACL_VSTREAM *)
ACL_API void acl_aio_server_cancel_timer(ACL_EVENT_NOTIFY_TIME timer_fn, void *arg)
ACL_API ACL_VSTREAM ** acl_threads_server_streams(void)
ACL_API const char * acl_single_server_conf(void)
ACL_API void acl_threads_server_disable_read(ACL_EVENT *event, ACL_VSTREAM *stream)
ACL_API void acl_single_server_main(int, char **, ACL_SINGLE_SERVER_FN,...)
ACL_API void acl_aio_server_main(int, char **, ACL_AIO_SERVER_FN,...)
ACL_API void const char * fmt
ACL_API void acl_udp_server_main(int, char **, ACL_UDP_SERVER_FN,...)
void(* ACL_TRIGGER_SERVER_FN)(void *)
ACL_API void acl_trigger_server_main(int, char **, ACL_TRIGGER_SERVER_FN,...)
ACL_API int acl_aio_server_read(ACL_ASTREAM *astream, int timeout, ACL_AIO_READ_FN notify_fn, void *context)
ACL_API const char * acl_aio_server_conf(void)
ACL_API int acl_aio_server_gets_nonl(ACL_ASTREAM *astream, int timeout, ACL_AIO_READ_FN notify_fn, void *context)
int(* ACL_MASTER_SERVER_THREAD_INIT_FN)(void *)
ACL_API void acl_threads_server_main(int argc, char *argv[], ACL_THREADS_SERVER_FN, void *service_ctx, int name,...)
void(* ACL_EVENT_NOTIFY_TIME)(int event_type, ACL_EVENT *event, void *context)
ACL_API void acl_aio_server2_main(int, char **, ACL_AIO_SERVER2_FN,...)
ACL_API ACL_ASTREAM ** acl_aio_server_streams(void)
ACL_API void acl_aio_server_request_rw_timer(ACL_ASTREAM *)
ACL_API const char * acl_trigger_server_conf(void)
ACL_API int acl_aio_server_vfprintf(ACL_ASTREAM *astream, ACL_AIO_WRITE_FN notify_fn, void *context, const char *fmt, va_list ap)