18#ifndef LIBCOUCHBASE_COUCHBASE_H
19#error "include libcouchbase/couchbase.h first"
77#define LCB_IOV_LAYOUT_UIO
78typedef struct lcb_iovec_st {
84#define LCB_IOV_LAYOUT_WSABUF
85typedef struct lcb_iovec_st {
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)
96#define LCB_IOPS_DEPRECATED(X) X
102 struct sockaddr *name;
107 struct sockaddr *name;
122typedef struct lcb_io_opt_st *lcb_io_opt_t;
145typedef void *(*lcb_io_timer_create_fn)(lcb_io_opt_t iops);
196typedef void *(*lcb_ioE_event_create_fn)(lcb_io_opt_t iops);
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)
289 unsigned int addrlen);
293 unsigned int addrlen);
315#define LCB_IO_SOCKCHECK_PEND_IS_ERROR 1
317#define LCB_IO_SOCKCHECK_STATUS_CLOSED 1
318#define LCB_IO_SOCKCHECK_STATUS_OK 0
319#define LCB_IO_SOCKCHECK_STATUS_UNKNOWN -1
339#define LCB_IO_CNTL_GET 0
341#define LCB_IO_CNTL_SET 1
344#define LCB_IO_CNTL_TCP_NODELAY 1
347#define LCB_IO_CNTL_TCP_KEEPALIVE 2
362struct lcb_connection_st;
369 struct ringbuffer_st *ringbuffer;
370 struct lcb_iovec_st iov[2];
379typedef struct lcb_sockdata_st {
389typedef struct lcb_io_writebuf_st {
390 struct lcb_io_opt_st *parent;
407typedef lcb_sockdata_t *(*lcb_ioC_socket_fn)(lcb_io_opt_t iops,
int domain,
int type,
int protocol);
458#define lcb_io_read_cb lcb_ioC_read_callback
467#define lcb_io_write_cb lcb_ioC_write_callback
592LCB_DEPRECATED(
typedef void (*lcb_io_error_cb)(
lcb_sockdata_t *socket));
594#define LCB_IOPS_BASE_FIELDS \
599struct lcb_iops_evented_st {
620struct lcb_iops_completion_st {
642typedef struct lcb_timerprocs_st {
650typedef struct lcb_loopprocs_st {
657typedef struct lcb_bsdprocs_st {
673typedef struct lcb_evprocs_st {
796 struct lcbio_TABLE *iot;
808typedef void (*lcb__iops3fndummy)(void);
811 lcb__iops3fndummy pads[17];
813 struct lcbio_TABLE *iot;
821#define LCB_IOPROCS_VERSION 4
823#define LCB_IOPS_BASEFLD(iops, fld) ((iops)->v.base).fld
824#define LCB_IOPS_ERRNO(iops) LCB_IOPS_BASEFLD(iops, error)
826struct lcb_io_opt_st {
829 void (*destructor)(
struct lcb_io_opt_st *iops);
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;
904 LCB_IO_OPS_LIBEV = 0x04,
905 LCB_IO_OPS_SELECT = 0x05,
906 LCB_IO_OPS_WINIOCP = 0x06,
907 LCB_IO_OPS_LIBUV = 0x07
916#ifndef __LCB_DOXYGEN__
922} lcb_IOCREATEOPTS_DSO;
926} lcb_IOCREATEOPS_FUNCTIONPOINTER;
934 lcb_IOCREATEOPTS_DSO v1;
935 lcb_IOCREATEOPS_FUNCTIONPOINTER v2;
lcb_STATUS
Error codes returned by the library.
Definition error.h:213
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
Functions for completion-based I/O.
Definition iops.h:681
Functions handling socket watcher events.
Definition iops.h:673
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