Couchbase C Client  3.3.12
Asynchronous C Client for Couchbase
iops.h
Go to the documentation of this file.
1/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2017-2020 Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef LIBCOUCHBASE_COUCHBASE_H
19#error "include libcouchbase/couchbase.h first"
20#endif
21
22#ifndef LCB_IOPS_H
23#define LCB_IOPS_H
24
62#ifdef __cplusplus
63extern "C" {
64#endif
65
67#ifdef _WIN32
68typedef SOCKET lcb_socket_t;
69#else
70typedef int lcb_socket_t;
71#endif
72
73struct sockaddr;
74
75#ifndef _WIN32
77#define LCB_IOV_LAYOUT_UIO
78typedef struct lcb_iovec_st {
79 void *iov_base;
80 size_t iov_len;
81} lcb_IOV;
82#else
84#define LCB_IOV_LAYOUT_WSABUF
85typedef struct lcb_iovec_st {
86 ULONG iov_len;
87 void *iov_base;
88} lcb_IOV;
89#endif
90
91#if defined(LIBCOUCHBASE_INTERNAL) && !defined(LCB_IOPS_V12_NO_DEPRECATE)
92#define LCB__IOPS_CONCAT2(X, Y) X##Y
93#define LCB__IOPS_CONCAT(X, Y) LCB__IOPS_CONCAT2(X, Y)
94#define LCB_IOPS_DEPRECATED(X) void (*LCB__IOPS_CONCAT(lcb__iops__dummy, __LINE__))(void)
95#else
96#define LCB_IOPS_DEPRECATED(X) X
97#endif
98
101 struct {
102 struct sockaddr *name;
103 int *len;
104 } local;
105
106 struct {
107 struct sockaddr *name;
108 int *len;
109 } remote;
110};
111
122typedef struct lcb_io_opt_st *lcb_io_opt_t;
123
133typedef void (*lcb_ioE_callback)(lcb_socket_t sock, short events, void *uarg);
134
145typedef void *(*lcb_io_timer_create_fn)(lcb_io_opt_t iops);
146
155typedef void (*lcb_io_timer_destroy_fn)(lcb_io_opt_t iops, void *timer);
156
167typedef void (*lcb_io_timer_cancel_fn)(lcb_io_opt_t iops, void *timer);
168
179typedef int (*lcb_io_timer_schedule_fn)(lcb_io_opt_t iops, void *timer, lcb_U32 usecs, void *uarg,
180 lcb_ioE_callback callback);
181
196typedef void *(*lcb_ioE_event_create_fn)(lcb_io_opt_t iops);
197
205typedef void (*lcb_ioE_event_destroy_fn)(lcb_io_opt_t iops, void *event);
206
218typedef void (*lcb_ioE_event_cancel_fn)(lcb_io_opt_t iops, lcb_socket_t sock, void *event);
219
221#define LCB_READ_EVENT 0x02
223#define LCB_WRITE_EVENT 0x04
225#define LCB_ERROR_EVENT 0x08
226#define LCB_RW_EVENT (LCB_READ_EVENT | LCB_WRITE_EVENT)
227
253typedef int (*lcb_ioE_event_watch_fn)(lcb_io_opt_t iops, lcb_socket_t socket, void *event, short evflags, void *uarg,
254 lcb_ioE_callback callback);
255
265typedef lcb_SSIZE (*lcb_ioE_recv_fn)(lcb_io_opt_t iops, lcb_socket_t sock, void *target_buf, lcb_SIZE buflen,
266 int _unused_flags);
267
271typedef lcb_SSIZE (*lcb_ioE_send_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const void *srcbuf, lcb_SIZE buflen,
272 int _ignored);
273
276typedef lcb_SSIZE (*lcb_ioE_recvv_fn)(lcb_io_opt_t iops, lcb_socket_t sock, lcb_IOV *iov, lcb_SIZE niov);
277
280typedef lcb_SSIZE (*lcb_ioE_sendv_fn)(lcb_io_opt_t iops, lcb_socket_t sock, lcb_IOV *iov, lcb_SIZE niov);
281
284typedef lcb_socket_t (*lcb_ioE_socket_fn)(lcb_io_opt_t iops, int domain, int type, int protocol);
285
288typedef int (*lcb_ioE_connect_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *dst,
289 unsigned int addrlen);
290
292typedef int (*lcb_ioE_bind_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *srcaddr,
293 unsigned int addrlen);
294
296typedef int (*lcb_ioE_listen_fn)(lcb_io_opt_t iops, lcb_socket_t bound_sock, unsigned int queuelen);
297
299typedef lcb_socket_t (*lcb_ioE_accept_fn)(lcb_io_opt_t iops, lcb_socket_t lsnsock);
300
303typedef void (*lcb_ioE_close_fn)(lcb_io_opt_t iops, lcb_socket_t sock);
304
315#define LCB_IO_SOCKCHECK_PEND_IS_ERROR 1
316
317#define LCB_IO_SOCKCHECK_STATUS_CLOSED 1
318#define LCB_IO_SOCKCHECK_STATUS_OK 0
319#define LCB_IO_SOCKCHECK_STATUS_UNKNOWN -1
320
336typedef int (*lcb_ioE_chkclosed_fn)(lcb_io_opt_t iops, lcb_socket_t sock, int flags);
337
339#define LCB_IO_CNTL_GET 0
341#define LCB_IO_CNTL_SET 1
342
344#define LCB_IO_CNTL_TCP_NODELAY 1
345
347#define LCB_IO_CNTL_TCP_KEEPALIVE 2
348
358typedef int (*lcb_ioE_cntl_fn)(lcb_io_opt_t iops, lcb_socket_t sock, int mode, int option, void *arg);
361struct ringbuffer_st;
362struct lcb_connection_st;
363struct lcbio_SOCKET;
364
367 char *root;
368 lcb_SIZE size;
369 struct ringbuffer_st *ringbuffer;
370 struct lcb_iovec_st iov[2];
371};
372
379typedef struct lcb_sockdata_st {
381 lcb_io_opt_t parent;
382 struct lcbio_SOCKET *lcbconn;
383 int closed;
385 struct lcb_buf_info read_buffer;
387
389typedef struct lcb_io_writebuf_st {
390 struct lcb_io_opt_st *parent;
391 struct lcb_buf_info buffer;
393
407typedef lcb_sockdata_t *(*lcb_ioC_socket_fn)(lcb_io_opt_t iops, int domain, int type, int protocol);
408
415typedef void (*lcb_io_connect_cb)(lcb_sockdata_t *socket, int status);
416
426typedef int (*lcb_ioC_connect_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, const struct sockaddr *dst, unsigned int naddr,
427 lcb_io_connect_cb callback);
428
435typedef void(lcb_ioC_serve_callback)(lcb_sockdata_t *sd_server, lcb_sockdata_t *sd_client, int status);
436
445typedef int (*lcb_ioC_serve_fn)(lcb_io_opt_t iops, lcb_sockdata_t *server_socket, const struct sockaddr *listen_addr,
446 lcb_ioC_serve_callback callback);
447
454typedef int (*lcb_ioC_nameinfo_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sock, struct lcb_nameinfo_st *ni);
455
457typedef void (*lcb_ioC_read_callback)(lcb_sockdata_t *sd, lcb_SSIZE nread);
458#define lcb_io_read_cb lcb_ioC_read_callback
460typedef int (*lcb_ioC_read_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_ioC_read_callback);
462typedef lcb_io_writebuf_t *(*lcb_ioC_wballoc_fn)(lcb_io_opt_t, lcb_sockdata_t *);
464typedef void (*lcb_ioC_wbfree_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *);
467#define lcb_io_write_cb lcb_ioC_write_callback
468
471
478typedef void (*lcb_ioC_write2_callback)(lcb_sockdata_t *sd, int status, void *arg);
479
497typedef int (*lcb_ioC_write2_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, lcb_IOV *iov, lcb_SIZE niov, void *uarg,
498 lcb_ioC_write2_callback callback);
499
506typedef void (*lcb_ioC_read2_callback)(lcb_sockdata_t *sd, lcb_SSIZE nread, void *arg);
522typedef int (*lcb_ioC_read2_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, lcb_IOV *iov, lcb_SIZE niov, void *uarg,
523 lcb_ioC_read2_callback callback);
524
539typedef unsigned int (*lcb_ioC_close_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd);
540
550typedef int (*lcb_ioC_chkclosed_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, int flags);
551
562typedef int (*lcb_ioC_cntl_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, int mode, int option, void *arg);
563
574typedef void (*lcb_io_start_fn)(lcb_io_opt_t iops);
575
581typedef void (*lcb_io_tick_fn)(lcb_io_opt_t iops);
582
590typedef void (*lcb_io_stop_fn)(lcb_io_opt_t iops);
591
592LCB_DEPRECATED(typedef void (*lcb_io_error_cb)(lcb_sockdata_t *socket));
593
594#define LCB_IOPS_BASE_FIELDS \
595 void *cookie; \
596 int error; \
597 int need_cleanup;
598
599struct lcb_iops_evented_st {
600 LCB_IOPS_BASE_FIELDS
601 LCB_IOPS_DEPRECATED(lcb_ioE_socket_fn socket);
602 LCB_IOPS_DEPRECATED(lcb_ioE_connect_fn connect);
603 LCB_IOPS_DEPRECATED(lcb_ioE_recv_fn recv);
604 LCB_IOPS_DEPRECATED(lcb_ioE_send_fn send);
605 LCB_IOPS_DEPRECATED(lcb_ioE_recvv_fn recvv);
606 LCB_IOPS_DEPRECATED(lcb_ioE_sendv_fn sendv);
607 LCB_IOPS_DEPRECATED(lcb_ioE_close_fn close);
608 LCB_IOPS_DEPRECATED(lcb_io_timer_create_fn create_timer);
609 LCB_IOPS_DEPRECATED(lcb_io_timer_destroy_fn destroy_timer);
610 LCB_IOPS_DEPRECATED(lcb_io_timer_cancel_fn delete_timer);
611 LCB_IOPS_DEPRECATED(lcb_io_timer_schedule_fn update_timer);
612 LCB_IOPS_DEPRECATED(lcb_ioE_event_create_fn create_event);
613 LCB_IOPS_DEPRECATED(lcb_ioE_event_destroy_fn destroy_event);
614 LCB_IOPS_DEPRECATED(lcb_ioE_event_watch_fn update_event);
615 LCB_IOPS_DEPRECATED(lcb_ioE_event_cancel_fn delete_event);
616 LCB_IOPS_DEPRECATED(lcb_io_stop_fn stop_event_loop);
617 LCB_IOPS_DEPRECATED(lcb_io_start_fn run_event_loop);
618};
619
620struct lcb_iops_completion_st {
621 LCB_IOPS_BASE_FIELDS
622 LCB_IOPS_DEPRECATED(lcb_ioC_socket_fn create_socket);
623 LCB_IOPS_DEPRECATED(lcb_ioC_connect_fn start_connect);
624 LCB_IOPS_DEPRECATED(lcb_ioC_wballoc_fn create_writebuf);
625 LCB_IOPS_DEPRECATED(lcb_ioC_wbfree_fn release_writebuf);
626 LCB_IOPS_DEPRECATED(lcb_ioC_write_fn start_write);
627 LCB_IOPS_DEPRECATED(lcb_ioC_read_fn start_read);
628 LCB_IOPS_DEPRECATED(lcb_ioC_close_fn close_socket);
629 LCB_IOPS_DEPRECATED(lcb_io_timer_create_fn create_timer);
630 LCB_IOPS_DEPRECATED(lcb_io_timer_destroy_fn destroy_timer);
631 LCB_IOPS_DEPRECATED(lcb_io_timer_cancel_fn delete_timer);
632 LCB_IOPS_DEPRECATED(lcb_io_timer_schedule_fn update_timer);
633 LCB_IOPS_DEPRECATED(lcb_ioC_nameinfo_fn get_nameinfo);
634 void (*pad1)(void);
635 void (*pad2)(void);
636 LCB_IOPS_DEPRECATED(void (*send_error)(struct lcb_io_opt_st *, lcb_sockdata_t *, void (*)(lcb_sockdata_t *)));
637 LCB_IOPS_DEPRECATED(lcb_io_stop_fn stop_event_loop);
638 LCB_IOPS_DEPRECATED(lcb_io_start_fn run_event_loop);
639};
640
642typedef struct lcb_timerprocs_st {
648
650typedef struct lcb_loopprocs_st {
651 lcb_io_start_fn start;
652 lcb_io_stop_fn stop;
653 lcb_io_tick_fn tick;
655
657typedef struct lcb_bsdprocs_st {
658 lcb_ioE_socket_fn socket0;
659 lcb_ioE_connect_fn connect0;
660 lcb_ioE_recv_fn recv;
661 lcb_ioE_recvv_fn recvv;
662 lcb_ioE_send_fn send;
663 lcb_ioE_sendv_fn sendv;
664 lcb_ioE_close_fn close;
665 lcb_ioE_bind_fn bind;
666 lcb_ioE_listen_fn listen;
667 lcb_ioE_accept_fn accept;
668 lcb_ioE_chkclosed_fn is_closed;
669 lcb_ioE_cntl_fn cntl;
671
673typedef struct lcb_evprocs_st {
679
681typedef struct {
682 lcb_ioC_socket_fn socket;
683 lcb_ioC_close_fn close;
684 lcb_ioC_read_fn read;
685 lcb_ioC_connect_fn connect;
686 lcb_ioC_wballoc_fn wballoc;
687 lcb_ioC_wbfree_fn wbfree;
688 lcb_ioC_write_fn write;
689 lcb_ioC_write2_fn write2;
690 lcb_ioC_read2_fn read2;
691 lcb_ioC_serve_fn serve;
692 lcb_ioC_nameinfo_fn nameinfo;
693 lcb_ioC_chkclosed_fn is_closed;
694 lcb_ioC_cntl_fn cntl;
696
704
788typedef void (*lcb_io_procs_fn)(int version, lcb_loop_procs *loop_procs, lcb_timer_procs *timer_procs,
789 lcb_bsd_procs *bsd_procs, lcb_ev_procs *ev_procs,
790 lcb_completion_procs *completion_procs, lcb_iomodel_t *iomodel);
791
792struct lcbio_TABLE;
793struct lcb_iops2_st {
794 LCB_IOPS_BASE_FIELDS
795 lcb_io_procs_fn get_procs;
796 struct lcbio_TABLE *iot;
797};
798
799/* This is here to provide backwards compatibility with older (broken) clients
800 * which attempt to 'subclass' the select plugin, or similar. In this case we
801 * provide 17 callback fields (unused here) which the plugin implementation
802 * may set, so that the older code can continue to function without upgrading
803 * the client to a newer version. This should not be used except by internal
804 * plugins; specifically the ABI layout of this field is subject to change
805 * (for example, additional fields may be added or existing fields may be
806 * renamed/removed) without notice.
807 */
808typedef void (*lcb__iops3fndummy)(void);
809struct lcb_iops3_st {
810 LCB_IOPS_BASE_FIELDS
811 lcb__iops3fndummy pads[17];
812 lcb_io_procs_fn get_procs;
813 struct lcbio_TABLE *iot;
814};
815
821#define LCB_IOPROCS_VERSION 4
822
823#define LCB_IOPS_BASEFLD(iops, fld) ((iops)->v.base).fld
824#define LCB_IOPS_ERRNO(iops) LCB_IOPS_BASEFLD(iops, error)
825
826struct lcb_io_opt_st {
827 int version;
828 void *dlhandle;
829 void (*destructor)(struct lcb_io_opt_st *iops);
830 union {
831 struct {
832 LCB_IOPS_BASE_FIELDS
833 } base;
834
836 struct lcb_iops_evented_st v0;
837 struct lcb_iops_completion_st v1;
838 struct lcb_iops2_st v2;
839 struct lcb_iops3_st v3;
840 } v;
841};
842
851typedef lcb_STATUS (*lcb_io_create_fn)(int version, lcb_io_opt_t *io, void *cookie);
852
884LIBCOUCHBASE_API
885void lcb_iops_wire_bsd_impl2(lcb_bsd_procs *procs, int version);
886
887/******************************************************************************
888 ******************************************************************************
889 ** IO CREATION **
890 ******************************************************************************
891 ******************************************************************************/
892
897typedef enum {
904 LCB_IO_OPS_LIBEV = 0x04,
905 LCB_IO_OPS_SELECT = 0x05,
906 LCB_IO_OPS_WINIOCP = 0x06,
907 LCB_IO_OPS_LIBUV = 0x07
909
915
916#ifndef __LCB_DOXYGEN__
917/* These are mostly internal structures which may be in use by older applications.*/
918typedef struct {
919 const char *sofile;
920 const char *symbol;
921 void *cookie;
922} lcb_IOCREATEOPTS_DSO;
923typedef struct {
924 lcb_io_create_fn create;
925 void *cookie;
926} lcb_IOCREATEOPS_FUNCTIONPOINTER;
927#endif
928
931 int version;
932 union {
934 lcb_IOCREATEOPTS_DSO v1;
935 lcb_IOCREATEOPS_FUNCTIONPOINTER v2;
936 } v;
937};
938
961LIBCOUCHBASE_API
962lcb_STATUS lcb_create_io_ops(lcb_io_opt_t *op, const struct lcb_create_io_ops_st *options);
963
970LIBCOUCHBASE_API
972
973#ifdef __cplusplus
974}
975#endif
976
979#endif
lcb_STATUS
Error codes returned by the library.
Definition error.h:212
lcb_socket_t socket
System socket, for informational purposes.
Definition iops.h:380
int is_reading
Internally used by lcbio.
Definition iops.h:384
lcb_io_ops_type_t type
The predefined type you want to create.
Definition iops.h:912
void * cookie
Plugin-specific argument.
Definition iops.h:913
struct lcbio_SOCKET * lcbconn
Internal socket equivalent.
Definition iops.h:382
int closed
Definition iops.h:383
lcb_io_opt_t parent
Parent I/O context.
Definition iops.h:381
lcb_io_writebuf_t *(* lcb_ioC_wballoc_fn)(lcb_io_opt_t, lcb_sockdata_t *)
Definition iops.h:462
lcb_socket_t(* lcb_ioE_accept_fn)(lcb_io_opt_t iops, lcb_socket_t lsnsock)
Definition iops.h:299
lcb_STATUS(* lcb_io_create_fn)(int version, lcb_io_opt_t *io, void *cookie)
Signature for a loadable plugin's IOPS initializer.
Definition iops.h:851
lcb_SSIZE(* lcb_ioE_send_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const void *srcbuf, lcb_SIZE buflen, int _ignored)
Send data from a single buffer.
Definition iops.h:271
int(* lcb_ioC_write2_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, lcb_IOV *iov, lcb_SIZE niov, void *uarg, lcb_ioC_write2_callback callback)
Schedule a flush of a series of buffers to the network.
Definition iops.h:497
void lcb_ioC_serve_callback(lcb_sockdata_t *sd_server, lcb_sockdata_t *sd_client, int status)
Callback invoked when a new client connection has been established.
Definition iops.h:435
int(* lcb_ioC_serve_fn)(lcb_io_opt_t iops, lcb_sockdata_t *server_socket, const struct sockaddr *listen_addr, lcb_ioC_serve_callback callback)
Specify that the socket start accepting connections.
Definition iops.h:445
void(* lcb_io_tick_fn)(lcb_io_opt_t iops)
Run a single iteration of the event loop without blocking.
Definition iops.h:581
void *(* lcb_io_timer_create_fn)(lcb_io_opt_t iops)
Create a new timer object.
Definition iops.h:145
void lcb_iops_wire_bsd_impl2(lcb_bsd_procs *procs, int version)
int(* lcb_io_timer_schedule_fn)(lcb_io_opt_t iops, void *timer, lcb_U32 usecs, void *uarg, lcb_ioE_callback callback)
Schedule a callback to be invoked within a given interval.
Definition iops.h:179
void(* lcb_ioE_close_fn)(lcb_io_opt_t iops, lcb_socket_t sock)
Close a socket.
Definition iops.h:303
lcb_SSIZE(* lcb_ioE_recvv_fn)(lcb_io_opt_t iops, lcb_socket_t sock, lcb_IOV *iov, lcb_SIZE niov)
Read data into a series of buffers.
Definition iops.h:276
void(* lcb_ioC_write_callback)(lcb_sockdata_t *, lcb_io_writebuf_t *, int)
Definition iops.h:466
int(* lcb_ioC_nameinfo_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sock, struct lcb_nameinfo_st *ni)
Request address information on a connected socket.
Definition iops.h:454
void(* lcb_io_connect_cb)(lcb_sockdata_t *socket, int status)
Callback to be invoked upon a connection result.
Definition iops.h:415
int(* lcb_ioC_read2_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, lcb_IOV *iov, lcb_SIZE niov, void *uarg, lcb_ioC_read2_callback callback)
Schedule a read from the network.
Definition iops.h:522
void *(* lcb_ioE_event_create_fn)(lcb_io_opt_t iops)
Create a new event handle.
Definition iops.h:196
int(* lcb_ioC_write_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *, lcb_ioC_write_callback)
Definition iops.h:470
void(* lcb_ioE_event_cancel_fn)(lcb_io_opt_t iops, lcb_socket_t sock, void *event)
Cancel pending callbacks and unwatch a handle.
Definition iops.h:218
int(* lcb_ioE_connect_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *dst, unsigned int addrlen)
Connect a created socket.
Definition iops.h:288
lcb_SSIZE(* lcb_ioE_sendv_fn)(lcb_io_opt_t iops, lcb_socket_t sock, lcb_IOV *iov, lcb_SIZE niov)
Write data from multiple buffers.
Definition iops.h:280
void(* lcb_io_start_fn)(lcb_io_opt_t iops)
Start the event loop.
Definition iops.h:574
int(* lcb_ioC_read_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_ioC_read_callback)
Definition iops.h:460
void(* lcb_io_timer_cancel_fn)(lcb_io_opt_t iops, void *timer)
Cancel a pending timer callback.
Definition iops.h:167
lcb_SSIZE(* lcb_ioE_recv_fn)(lcb_io_opt_t iops, lcb_socket_t sock, void *target_buf, lcb_SIZE buflen, int _unused_flags)
Receive data into a single buffer.
Definition iops.h:265
void(* lcb_ioE_event_destroy_fn)(lcb_io_opt_t iops, void *event)
Destroy an event handle.
Definition iops.h:205
lcb_iomodel_t
Enumeration defining the I/O model.
Definition iops.h:700
lcb_io_ops_type_t
Built-in I/O plugins.
Definition iops.h:897
int(* lcb_ioC_chkclosed_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, int flags)
This is the completion variant of lcb_ioE_chkclosed_fn.
Definition iops.h:550
lcb_STATUS lcb_destroy_io_ops(lcb_io_opt_t op)
Destroy the plugin handle created by lcb_create_io_ops()
void(* lcb_io_procs_fn)(int version, lcb_loop_procs *loop_procs, lcb_timer_procs *timer_procs, lcb_bsd_procs *bsd_procs, lcb_ev_procs *ev_procs, lcb_completion_procs *completion_procs, lcb_iomodel_t *iomodel)
Definition iops.h:788
void(* lcb_ioC_wbfree_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *)
Definition iops.h:464
int(* lcb_ioE_event_watch_fn)(lcb_io_opt_t iops, lcb_socket_t socket, void *event, short evflags, void *uarg, lcb_ioE_callback callback)
Associate an event with a socket, requesting notification when one of the events specified in 'flags'...
Definition iops.h:253
void(* lcb_io_timer_destroy_fn)(lcb_io_opt_t iops, void *timer)
Destroy a timer handler.
Definition iops.h:155
void(* lcb_ioC_read_callback)(lcb_sockdata_t *sd, lcb_SSIZE nread)
Definition iops.h:457
int(* lcb_ioE_listen_fn)(lcb_io_opt_t iops, lcb_socket_t bound_sock, unsigned int queuelen)
Definition iops.h:296
void(* lcb_io_stop_fn)(lcb_io_opt_t iops)
Pause the event loop.
Definition iops.h:590
int(* lcb_ioC_cntl_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, int mode, int option, void *arg)
Definition iops.h:562
int lcb_socket_t
Type representing the native socket type of the operating system.
Definition iops.h:70
void(* lcb_ioE_callback)(lcb_socket_t sock, short events, void *uarg)
Callback invoked for all poll-like events.
Definition iops.h:133
unsigned int(* lcb_ioC_close_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd)
Asynchronously shutdown the socket.
Definition iops.h:539
int(* lcb_ioE_chkclosed_fn)(lcb_io_opt_t iops, lcb_socket_t sock, int flags)
Check if a socket has been closed or not.
Definition iops.h:336
void(* lcb_ioC_write2_callback)(lcb_sockdata_t *sd, int status, void *arg)
Callback received when a buffer has been flushed.
Definition iops.h:478
void(* lcb_ioC_read2_callback)(lcb_sockdata_t *sd, lcb_SSIZE nread, void *arg)
Callback invoked when a read has been completed.
Definition iops.h:506
int(* lcb_ioC_connect_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, const struct sockaddr *dst, unsigned int naddr, lcb_io_connect_cb callback)
Request a connection for a socket.
Definition iops.h:426
lcb_sockdata_t *(* lcb_ioC_socket_fn)(lcb_io_opt_t iops, int domain, int type, int protocol)
Create a completion socket handle.
Definition iops.h:407
lcb_STATUS lcb_create_io_ops(lcb_io_opt_t *op, const struct lcb_create_io_ops_st *options)
Create a new instance of one of the library-supplied io ops types.
int(* lcb_ioE_bind_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *srcaddr, unsigned int addrlen)
Definition iops.h:292
lcb_socket_t(* lcb_ioE_socket_fn)(lcb_io_opt_t iops, int domain, int type, int protocol)
Create a new socket.
Definition iops.h:284
int(* lcb_ioE_cntl_fn)(lcb_io_opt_t iops, lcb_socket_t sock, int mode, int option, void *arg)
Execute a specificied operation on a socket.
Definition iops.h:358
@ LCB_IOMODEL_COMPLETION
IOCP/Completion style.
Definition iops.h:702
@ LCB_IOMODEL_EVENT
Event/Poll style.
Definition iops.h:701
@ LCB_IO_OPS_LIBEVENT
Integrate with the libevent loop.
Definition iops.h:902
@ LCB_IO_OPS_DEFAULT
Definition iops.h:899
@ LCB_IO_OPS_WINSOCK
Definition iops.h:903
@ LCB_IO_OPS_INVALID
Definition iops.h:898
IO Creation for builtin plugins.
Definition iops.h:911
structure indicating a buffer and its size
Definition iops.h:78
Functions wrapping the Berkeley Socket API.
Definition iops.h:657
Definition iops.h:366
Functions for completion-based I/O.
Definition iops.h:681
Definition iops.h:930
Functions handling socket watcher events.
Definition iops.h:673
Definition iops.h:389
Common functions for starting and stopping the event loop.
Definition iops.h:650
structure describing a connected socket's endpoints
Definition iops.h:100
Socket handle for completion-based I/O.
Definition iops.h:379
Common functions for starting and stopping timers.
Definition iops.h:642