Couchbase C Client  3.2.0
Asynchronous C Client for Couchbase
iops.h File Reference

Public I/O integration interface. More...

Go to the source code of this file.

Data Structures

struct  lcb_IOV
 structure indicating a buffer and its size More...
 
struct  lcb_nameinfo_st
 structure describing a connected socket's endpoints More...
 
struct  lcb_buf_info
 
struct  lcb_sockdata_t
 Socket handle for completion-based I/O. More...
 
struct  lcb_io_writebuf_t
 
struct  lcb_timer_procs
 Common functions for starting and stopping timers. More...
 
struct  lcb_loop_procs
 Common functions for starting and stopping the event loop. More...
 
struct  lcb_bsd_procs
 Functions wrapping the Berkeley Socket API. More...
 
struct  lcb_ev_procs
 Functions handling socket watcher events. More...
 
struct  lcb_completion_procs
 Functions for completion-based I/O. More...
 
struct  lcb_IOCREATEOPTS_BUILTIN
 IO Creation for builtin plugins. More...
 
struct  lcb_create_io_ops_st
 

Macros

#define LCB_IOV_LAYOUT_UIO
 Defined if the lcb_IOV structure conforms to struct iovec
 
#define LCB_IOPS_DEPRECATED(X)
 
#define LCB_IOPS_BASE_FIELDS
 
#define LCB_IOPROCS_VERSION
 This number is bumped up each time a new field is added to any of the function tables. More...
 
#define LCB_IOPS_BASEFLD(iops, fld)
 
#define LCB_IOPS_ERRNO(iops)
 

Typedefs

typedef int lcb_socket_t
 Type representing the native socket type of the operating system.
 
typedef void(* lcb_ioE_callback) (lcb_socket_t sock, short events, void *uarg)
 Callback invoked for all poll-like events. More...
 
typedef void(* lcb_io_start_fn) (lcb_io_opt_t iops)
 Start the event loop. More...
 
typedef void(* lcb_io_tick_fn) (lcb_io_opt_t iops)
 Run a single iteration of the event loop without blocking. More...
 
typedef void(* lcb_io_stop_fn) (lcb_io_opt_t iops)
 Pause the event loop. More...
 
typedef void(* lcb_io_error_cb) (lcb_sockdata_t *socket))
 
typedef 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)
 
typedef void(* lcb__iops3fndummy) (void)
 
typedef lcb_STATUS(* lcb_io_create_fn) (int version, lcb_io_opt_t *io, void *cookie)
 Signature for a loadable plugin's IOPS initializer. More...
 
Timer Callbacks
typedef void *(* lcb_io_timer_create_fn) (lcb_io_opt_t iops)
 Create a new timer object. More...
 
typedef void(* lcb_io_timer_destroy_fn) (lcb_io_opt_t iops, void *timer)
 Destroy a timer handler. More...
 
typedef void(* lcb_io_timer_cancel_fn) (lcb_io_opt_t iops, void *timer)
 Cancel a pending timer callback. More...
 
typedef 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. More...
 

Enumerations

enum  lcb_iomodel_t
 Enumeration defining the I/O model. More...
 
enum  lcb_io_ops_type_t
 
Built-in I/O plugins More...
 

Functions

void lcb_iops_wire_bsd_impl2 (lcb_bsd_procs *procs, int version)
 
More...
 
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. More...
 
lcb_STATUS lcb_destroy_io_ops (lcb_io_opt_t op)
 
Destroy the plugin handle created by lcb_create_io_ops() More...
 

Event Handle Callbacks

#define LCB_READ_EVENT
 Data is available for reading.
 
#define LCB_WRITE_EVENT
 Data can be written.
 
#define LCB_ERROR_EVENT
 Exceptional condition ocurred on socket.
 
#define LCB_RW_EVENT
 
typedef void *(* lcb_ioE_event_create_fn) (lcb_io_opt_t iops)
 Create a new event handle. More...
 
typedef void(* lcb_ioE_event_destroy_fn) (lcb_io_opt_t iops, void *event)
 Destroy an event handle. More...
 
typedef void(* lcb_ioE_event_cancel_fn) (lcb_io_opt_t iops, lcb_socket_t sock, void *event)
 Cancel pending callbacks and unwatch a handle. More...
 
typedef 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' becomes available on the socket. More...
 

BSD-API I/O Routines

#define LCB_IO_SOCKCHECK_PEND_IS_ERROR
 While checking the socket, treat pending data as an error. More...
 
#define LCB_IO_SOCKCHECK_STATUS_CLOSED
 
#define LCB_IO_SOCKCHECK_STATUS_OK
 
#define LCB_IO_SOCKCHECK_STATUS_UNKNOWN
 
#define LCB_IO_CNTL_GET
 For use with io{E,C}_cntl_fn, indicates the setting should be retrieved.
 
#define LCB_IO_CNTL_SET
 For use with lcb_io{E,C}_cntl_fn`, indicates the setting should be modified.
 
#define LCB_IO_CNTL_TCP_NODELAY
 Disable Nagle's algorithm (use an int)
 
#define LCB_IO_CNTL_TCP_KEEPALIVE
 Enable/Disable TCP Keepalive.
 
typedef 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. More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef lcb_socket_t(* lcb_ioE_socket_fn) (lcb_io_opt_t iops, int domain, int type, int protocol)
 Create a new socket. More...
 
typedef 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. More...
 
typedef int(* lcb_ioE_bind_fn) (lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *srcaddr, unsigned int addrlen)
 
typedef int(* lcb_ioE_listen_fn) (lcb_io_opt_t iops, lcb_socket_t bound_sock, unsigned int queuelen)
 
typedef lcb_socket_t(* lcb_ioE_accept_fn) (lcb_io_opt_t iops, lcb_socket_t lsnsock)
 
typedef void(* lcb_ioE_close_fn) (lcb_io_opt_t iops, lcb_socket_t sock)
 Close a socket. More...
 
typedef 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. More...
 
typedef 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. More...
 

Completion Routines

#define lcb_io_read_cb
 
#define lcb_io_write_cb
 
typedef lcb_sockdata_t *(* lcb_ioC_socket_fn) (lcb_io_opt_t iops, int domain, int type, int protocol)
 Create a completion socket handle. More...
 
typedef void(* lcb_io_connect_cb) (lcb_sockdata_t *socket, int status)
 Callback to be invoked upon a connection result. More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef void(* lcb_ioC_read_callback) (lcb_sockdata_t *sd, lcb_SSIZE nread)
 
typedef int(* lcb_ioC_read_fn) (lcb_io_opt_t, lcb_sockdata_t *, lcb_ioC_read_callback)
 
typedef lcb_io_writebuf_t *(* lcb_ioC_wballoc_fn) (lcb_io_opt_t, lcb_sockdata_t *)
 
typedef void(* lcb_ioC_wbfree_fn) (lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *)
 
typedef void(* lcb_ioC_write_callback) (lcb_sockdata_t *, lcb_io_writebuf_t *, int)
 
typedef int(* lcb_ioC_write_fn) (lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *, lcb_ioC_write_callback)
 
typedef void(* lcb_ioC_write2_callback) (lcb_sockdata_t *sd, int status, void *arg)
 Callback received when a buffer has been flushed. More...
 
typedef 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. More...
 
typedef void(* lcb_ioC_read2_callback) (lcb_sockdata_t *sd, lcb_SSIZE nread, void *arg)
 Callback invoked when a read has been completed. More...
 
typedef 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. More...
 
typedef unsigned int(* lcb_ioC_close_fn) (lcb_io_opt_t iops, lcb_sockdata_t *sd)
 Asynchronously shutdown the socket. More...
 
typedef 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. More...
 
typedef int(* lcb_ioC_cntl_fn) (lcb_io_opt_t iops, lcb_sockdata_t *sd, int mode, int option, void *arg)
 

Detailed Description

Public I/O integration interface.

This file provides the public I/O interface for integrating with external event loops.