9 #ifndef ACL_AIO_INCLUDE_H 10 #define ACL_AIO_INCLUDE_H 16 #include "../stdlib/acl_define.h" 22 #include "../stdlib/acl_stdlib.h" 23 #include "../event/acl_events.h" 24 #include "../net/acl_netdb.h" 49 void *
context,
char *data,
int dlen);
101 #define ACL_ASTREAM_STATUS_INVALID -1 102 #define ACL_ASTREAM_STATUS_OK 0 103 #define ACL_ASTREAM_STATUS_NS_ERROR 1 104 #define ACL_ASTREAM_STATUS_CONNECT_ERROR 2 105 #define ACL_ASTREAM_STATUS_CONNECT_TIMEOUT 3 146 #define ACL_AIO_FLAG_IOCP_CLOSE (1 << 0) 147 #define ACL_AIO_FLAG_ISRD (1 << 1) 148 #define ACL_AIO_FLAG_ISWR (1 << 2) 149 #define ACL_AIO_FLAG_DELAY_CLOSE (1 << 3) 150 #define ACL_AIO_FLAG_DEAD (1 << 4) 191 #define ACL_AIO_SET_TIMEOUT(stream_ptr, _timeo_) do { \ 192 ACL_ASTREAM *__stream_ptr = stream_ptr; \ 193 __stream_ptr->timeout = _timeo_; \ 199 #define ACL_AIO_SET_CTX(stream_ptr, _ctx_) do { \ 200 ACL_ASTREAM *__stream_ptr = stream_ptr; \ 201 __stream_ptr->context = _ctx_; \ 569 #define ACL_AIO_CTL_END 0 570 #define ACL_AIO_CTL_ACCEPT_FN 1 571 #define ACL_AIO_CTL_LISTEN_FN 2 572 #define ACL_AIO_CTL_CTX 3 573 #define ACL_AIO_CTL_TIMEOUT 4 574 #define ACL_AIO_CTL_LINE_LENGTH 5 575 #define ACL_AIO_CTL_STREAM 10 576 #define ACL_AIO_CTL_READ_NESTED 11 577 #define ACL_AIO_CTL_WRITE_NESTED 12 578 #define ACL_AIO_CTL_KEEP_READ 13 579 #define ACL_AIO_CTL_READ_HOOK_ADD 14 580 #define ACL_AIO_CTL_READ_HOOK_DEL 15 581 #define ACL_AIO_CTL_WRITE_HOOK_ADD 16 582 #define ACL_AIO_CTL_WRITE_HOOK_DEL 17 583 #define ACL_AIO_CTL_CLOSE_HOOK_ADD 18 584 #define ACL_AIO_CTL_CLOSE_HOOK_DEL 19 585 #define ACL_AIO_CTL_TIMEO_HOOK_ADD 20 586 #define ACL_AIO_CTL_TIMEO_HOOK_DEL 21 587 #define ACL_AIO_CTL_CONNECT_HOOK_ADD 22 588 #define ACL_AIO_CTL_CONNECT_HOOK_DEL 23 755 const struct iovec *vector,
int count);
880 acl_int64 idle_limit,
int keep);
900 void *context,
int onoff);
ACL_API int acl_aio_isset(ACL_ASTREAM *astream)
int(* ACL_AIO_CONNECT_ADDR_FN)(const ACL_ASTREAM_CTX *ctx)
ACL_API int acl_aio_can_read(ACL_ASTREAM *astream)
ACL_API void * acl_astream_get_ctx(const ACL_ASTREAM_CTX *ctx)
ACL_API void acl_aio_del_write_hook(ACL_ASTREAM *astream, ACL_AIO_WRITE_FN callback, void *ctx)
ACL_API void * acl_aio_get_ctx(ACL_ASTREAM *stream)
ACL_API void acl_aio_set_accept_nloop(ACL_ASTREAM *astream, int nloop)
HTTP_API void const char * name
ACL_ARRAY * close_handles
ACL_API void acl_aio_clean_read_hooks(ACL_ASTREAM *astream)
ACL_API void ACL_PRINTF(2, 3) acl_aio_fprintf(ACL_ASTREAM *astream
int(* read_ready_fn)(ACL_VSTREAM *, ACL_VSTRING *, int *)
ACL_API ACL_VSTRING * acl_aio_readn_peek(ACL_ASTREAM *astream, int *count)
ACL_API void acl_aio_ctl(ACL_ASTREAM *astream, int name,...)
int(* ACL_AIO_ACCEPT_FN)(ACL_ASTREAM *cstream, void *context)
ACL_API void acl_aio_free(ACL_AIO *aio)
ACL_API void * acl_aio_dns(ACL_AIO *aio)
ACL_API ACL_EVENT * acl_aio_event(ACL_AIO *aio)
ACL_API void acl_aio_clean_close_hooks(ACL_ASTREAM *astream)
ACL_ARRAY * connect_handles
ACL_API void acl_aio_writev(ACL_ASTREAM *astream, const struct iovec *vector, int count)
ACL_API int acl_aio_last_nready(ACL_AIO *aio)
ACL_API void acl_aio_enable_read(ACL_ASTREAM *astream, ACL_AIO_NOTIFY_FN can_read_fn, void *context)
ACL_AIO_NOTIFY_FN can_read_fn
ACL_API int acl_aio_refer_value(ACL_ASTREAM *astream)
ACL_API void acl_aio_free2(ACL_AIO *aio, int keep)
ACL_API void acl_aio_add_write_hook(ACL_ASTREAM *astream, ACL_AIO_WRITE_FN callback, void *ctx)
ACL_API void acl_aio_listen(ACL_ASTREAM *astream)
ACL_API int acl_aio_timer_ifkeep(ACL_AIO *aio, ACL_EVENT_NOTIFY_TIME timer_fn, void *context)
ACL_API ACL_VSTRING * acl_aio_gets_peek(ACL_ASTREAM *astream)
ACL_API int acl_astream_get_status(const ACL_ASTREAM_CTX *ctx)
ACL_API int acl_aio_get_keep_read(ACL_AIO *aio)
ACL_API void acl_aio_add_read_hook(ACL_ASTREAM *astream, ACL_AIO_READ_FN callback, void *ctx)
ACL_API ACL_VSTREAM * acl_aio_cancel(ACL_ASTREAM *astream)
int(* ACL_AIO_CONNECT_FN)(ACL_ASTREAM *cstream, void *context)
ACL_API void acl_aio_writen(ACL_ASTREAM *astream, const char *data, int dlen)
ACL_API void acl_aio_clean_timeo_hooks(ACL_ASTREAM *astream)
ACL_API int acl_aio_get_accept_max(ACL_ASTREAM *astream)
ACL_API void acl_aio_stream_set_line_length(ACL_ASTREAM *astream, int len)
ACL_AIO_ACCEPT_FN accept_fn
ACL_API void const char ACL_API void acl_aio_enable_write(ACL_ASTREAM *astream, ACL_AIO_NOTIFY_FN can_write_fn, void *context)
ACL_API acl_int64 acl_aio_request_timer(ACL_AIO *aio, ACL_EVENT_NOTIFY_TIME timer_fn, void *context, acl_int64 idle_limit, int keep)
int(* ACL_AIO_WRITE_FN)(ACL_ASTREAM *astream, void *context)
ACL_API int acl_aio_connect_addr(ACL_AIO *aio, const char *addr, int timeout, ACL_AIO_CONNECT_ADDR_FN callback, void *context)
ACL_API void acl_aio_disable_read(ACL_ASTREAM *astream)
ACL_API void acl_aio_unrefer(ACL_ASTREAM *astream)
ACL_API void acl_aio_loop(ACL_AIO *aio)
ACL_API void acl_aio_set_ctx(ACL_ASTREAM *stream, void *ctx)
ACL_API void acl_aio_set_accept_max(ACL_ASTREAM *astream, int accept_max)
ACL_API void acl_aio_clean_connect_hooks(ACL_ASTREAM *astream)
ACL_API void acl_aio_set_keep_read(ACL_AIO *aio, int onoff)
ACL_API void acl_aio_clean_hooks(ACL_ASTREAM *astream)
ACL_API void acl_aio_set_rbuf_size(ACL_AIO *aio, int rbuf_size)
void(* event_read_callback)(int event_type, ACL_ASTREAM *astream)
ACL_API ACL_VSTRING * acl_aio_read_peek(ACL_ASTREAM *astream, int *count)
ACL_API void acl_aio_del_read_hook(ACL_ASTREAM *astream, ACL_AIO_READ_FN callback, void *ctx)
int(* ACL_AIO_READ_FN)(ACL_ASTREAM *astream, void *context, char *data, int dlen)
ACL_API ACL_AIO * acl_aio_handle(ACL_ASTREAM *stream)
ACL_API const ACL_SOCKADDR * acl_astream_get_ns_addr(const ACL_ASTREAM_CTX *ctx)
ACL_API ACL_ASTREAM * acl_aio_open(ACL_AIO *aio, ACL_VSTREAM *stream)
ACL_API void acl_aio_set_check_inter(ACL_AIO *aio, int check_inter)
ACL_API void acl_aio_add_close_hook(ACL_ASTREAM *astream, ACL_AIO_CLOSE_FN callback, void *ctx)
ACL_API void acl_aio_del_dns(ACL_AIO *aio, const char *dns_list)
ACL_API ACL_AIO * acl_aio_create3(ACL_EVENT *event)
ACL_AIO_NOTIFY_FN can_write_fn
ACL_API void acl_aio_gets_nonl(ACL_ASTREAM *astream)
ACL_API ACL_AIO * acl_aio_create(int event_mode)
ACL_API void acl_aio_iocp_close(ACL_ASTREAM *astream)
ACL_API void acl_aio_readn(ACL_ASTREAM *astream, int count)
struct ACL_ASTREAM_CTX ACL_ASTREAM_CTX
ACL_API int acl_aio_stream_get_keep_read(ACL_ASTREAM *astream)
ACL_API void acl_aio_stream_set_keep_read(ACL_ASTREAM *astream, int onoff)
ACL_API int acl_aio_isrset(ACL_ASTREAM *astream)
ACL_API void acl_aio_refer(ACL_ASTREAM *astream)
ACL_API void acl_aio_read(ACL_ASTREAM *astream)
ACL_API void acl_aio_check(ACL_AIO *aio)
int(* ACL_AIO_TIMEO_FN)(ACL_ASTREAM *astream, void *context)
ACL_ARRAY * write_handles
ACL_API void acl_aio_set_delay_sec(ACL_AIO *aio, int delay_sec)
struct ACL_EVENT ACL_EVENT
int(* ACL_AIO_LISTEN_FN)(ACL_ASTREAM *sstream, void *context)
ACL_API int acl_aio_stream_get_line_length(ACL_ASTREAM *astream)
ACL_API int acl_aio_iswset(ACL_ASTREAM *astream)
ACL_API void acl_aio_vfprintf(ACL_ASTREAM *astream, const char *fmt, va_list ap)
ACL_API void acl_aio_keep_timer(ACL_AIO *aio, ACL_EVENT_NOTIFY_TIME timer_fn, void *context, int onoff)
ACL_API int acl_aio_event_mode(ACL_AIO *aio)
ACL_API void acl_aio_disable_readwrite(ACL_ASTREAM *astream)
ACL_API void acl_aio_del_timeo_hook(ACL_ASTREAM *astream, ACL_AIO_TIMEO_FN callback, void *ctx)
ACL_API ACL_ASTREAM * acl_astream_get_conn(const ACL_ASTREAM_CTX *ctx)
ACL_API void acl_aio_accept(ACL_ASTREAM *astream)
ACL_API acl_int64 acl_aio_cancel_timer(ACL_AIO *aio, ACL_EVENT_NOTIFY_TIME timer_fn, void *context)
ACL_API void acl_aio_set_delay_usec(ACL_AIO *aio, int delay_usec)
ACL_API ACL_AIO * acl_aio_create2(int event_mode, unsigned int nMsg)
ACL_API void acl_aio_del_connect_hook(ACL_ASTREAM *astream, ACL_AIO_CONNECT_FN callback, void *ctx)
ACL_API void acl_aio_clean_write_hooks(ACL_ASTREAM *astream)
ACL_AIO_LISTEN_FN listen_fn
ACL_API void acl_aio_del_close_hook(ACL_ASTREAM *astream, ACL_AIO_CLOSE_FN callback, void *ctx)
ACL_API ACL_VSTRING * acl_aio_gets_nonl_peek(ACL_ASTREAM *astream)
ACL_API void const char * fmt
ACL_API ACL_ASTREAM * acl_aio_connect(ACL_AIO *aio, const char *addr, int timeout)
ACL_API ACL_VSTREAM * acl_aio_vstream(ACL_ASTREAM *astream)
ACL_API int acl_aio_get_delay_usec(ACL_AIO *aio)
ACL_API void acl_aio_clear_dns(ACL_AIO *aio)
ACL_API const ACL_SOCKADDR * acl_astream_get_serv_addr(const ACL_ASTREAM_CTX *ctx)
ACL_API void acl_aio_disable_write(ACL_ASTREAM *astream)
ACL_API void acl_aio_add_connect_hook(ACL_ASTREAM *astream, ACL_AIO_CONNECT_FN callback, void *ctx)
ACL_API int acl_aio_get_delay_sec(ACL_AIO *aio)
int(* ACL_AIO_CLOSE_FN)(ACL_ASTREAM *astream, void *context)
void(* ACL_EVENT_NOTIFY_TIME)(int event_type, ACL_EVENT *event, void *context)
ACL_API void acl_aio_gets(ACL_ASTREAM *astream)
ACL_ARRAY * timeo_handles
ACL_API void acl_aio_add_timeo_hook(ACL_ASTREAM *astream, ACL_AIO_TIMEO_FN callback, void *ctx)
ACL_API int acl_aio_set_dns(ACL_AIO *aio, const char *dns_list, int timeout)
int(* ACL_AIO_NOTIFY_FN)(ACL_ASTREAM *astream, void *context)