Couchbase C Client  3.2.2
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
63 extern "C" {
64 #endif
65 
67 #ifdef _WIN32
68 typedef SOCKET lcb_socket_t;
69 #else
70 typedef int lcb_socket_t;
71 #endif
72 
73 struct sockaddr;
74 
75 #ifndef _WIN32
76 
77 #define LCB_IOV_LAYOUT_UIO
78 typedef struct lcb_iovec_st {
79  void *iov_base;
80  size_t iov_len;
81 } lcb_IOV;
82 #else
83 
84 #define LCB_IOV_LAYOUT_WSABUF
85 typedef 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 
122 typedef struct lcb_io_opt_st *lcb_io_opt_t;
123 
133 typedef void (*lcb_ioE_callback)(lcb_socket_t sock, short events, void *uarg);
134 
145 typedef void *(*lcb_io_timer_create_fn)(lcb_io_opt_t iops);
146 
155 typedef void (*lcb_io_timer_destroy_fn)(lcb_io_opt_t iops, void *timer);
156 
167 typedef void (*lcb_io_timer_cancel_fn)(lcb_io_opt_t iops, void *timer);
168 
179 typedef int (*lcb_io_timer_schedule_fn)(lcb_io_opt_t iops, void *timer, lcb_U32 usecs, void *uarg,
180  lcb_ioE_callback callback);
181 
196 typedef void *(*lcb_ioE_event_create_fn)(lcb_io_opt_t iops);
197 
205 typedef void (*lcb_ioE_event_destroy_fn)(lcb_io_opt_t iops, void *event);
206 
218 typedef void (*lcb_ioE_event_cancel_fn)(lcb_io_opt_t iops, lcb_socket_t sock, void *event);
219 
221 #define LCB_READ_EVENT 0x02
222 
223 #define LCB_WRITE_EVENT 0x04
224 
225 #define LCB_ERROR_EVENT 0x08
226 #define LCB_RW_EVENT (LCB_READ_EVENT | LCB_WRITE_EVENT)
227 
253 typedef 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 
265 typedef 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 
271 typedef 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 
276 typedef lcb_SSIZE (*lcb_ioE_recvv_fn)(lcb_io_opt_t iops, lcb_socket_t sock, lcb_IOV *iov, lcb_SIZE niov);
277 
280 typedef lcb_SSIZE (*lcb_ioE_sendv_fn)(lcb_io_opt_t iops, lcb_socket_t sock, lcb_IOV *iov, lcb_SIZE niov);
281 
284 typedef lcb_socket_t (*lcb_ioE_socket_fn)(lcb_io_opt_t iops, int domain, int type, int protocol);
285 
288 typedef int (*lcb_ioE_connect_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *dst,
289  unsigned int addrlen);
290 
292 typedef int (*lcb_ioE_bind_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *srcaddr,
293  unsigned int addrlen);
294 
296 typedef int (*lcb_ioE_listen_fn)(lcb_io_opt_t iops, lcb_socket_t bound_sock, unsigned int queuelen);
297 
299 typedef lcb_socket_t (*lcb_ioE_accept_fn)(lcb_io_opt_t iops, lcb_socket_t lsnsock);
300 
303 typedef 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 
336 typedef int (*lcb_ioE_chkclosed_fn)(lcb_io_opt_t iops, lcb_socket_t sock, int flags);
337 
339 #define LCB_IO_CNTL_GET 0
340 
341 #define LCB_IO_CNTL_SET 1
344 #define LCB_IO_CNTL_TCP_NODELAY 1
345 
347 #define LCB_IO_CNTL_TCP_KEEPALIVE 2
348 
358 typedef int (*lcb_ioE_cntl_fn)(lcb_io_opt_t iops, lcb_socket_t sock, int mode, int option, void *arg);
361 struct ringbuffer_st;
362 struct lcb_connection_st;
363 struct lcbio_SOCKET;
364 
366 struct lcb_buf_info {
367  char *root;
368  lcb_SIZE size;
369  struct ringbuffer_st *ringbuffer;
370  struct lcb_iovec_st iov[2];
371 };
372 
379 typedef struct lcb_sockdata_st {
380  lcb_socket_t socket;
381  lcb_io_opt_t parent;
382  struct lcbio_SOCKET *lcbconn;
383  int closed;
384  int is_reading;
385  struct lcb_buf_info read_buffer;
389 typedef struct lcb_io_writebuf_st {
390  struct lcb_io_opt_st *parent;
391  struct lcb_buf_info buffer;
393 
407 typedef lcb_sockdata_t *(*lcb_ioC_socket_fn)(lcb_io_opt_t iops, int domain, int type, int protocol);
408 
415 typedef void (*lcb_io_connect_cb)(lcb_sockdata_t *socket, int status);
416 
426 typedef 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 
435 typedef void(lcb_ioC_serve_callback)(lcb_sockdata_t *sd_server, lcb_sockdata_t *sd_client, int status);
436 
445 typedef 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 
454 typedef int (*lcb_ioC_nameinfo_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sock, struct lcb_nameinfo_st *ni);
455 
457 typedef void (*lcb_ioC_read_callback)(lcb_sockdata_t *sd, lcb_SSIZE nread);
458 #define lcb_io_read_cb lcb_ioC_read_callback
459 
460 typedef int (*lcb_ioC_read_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_ioC_read_callback);
462 typedef lcb_io_writebuf_t *(*lcb_ioC_wballoc_fn)(lcb_io_opt_t, lcb_sockdata_t *);
464 typedef void (*lcb_ioC_wbfree_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *);
466 typedef void (*lcb_ioC_write_callback)(lcb_sockdata_t *, lcb_io_writebuf_t *, int);
467 #define lcb_io_write_cb lcb_ioC_write_callback
468 
470 typedef int (*lcb_ioC_write_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *, lcb_ioC_write_callback);
471 
478 typedef void (*lcb_ioC_write2_callback)(lcb_sockdata_t *sd, int status, void *arg);
479 
497 typedef 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 
506 typedef void (*lcb_ioC_read2_callback)(lcb_sockdata_t *sd, lcb_SSIZE nread, void *arg);
522 typedef 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 
539 typedef unsigned int (*lcb_ioC_close_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd);
540 
550 typedef int (*lcb_ioC_chkclosed_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, int flags);
551 
562 typedef int (*lcb_ioC_cntl_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, int mode, int option, void *arg);
563 
574 typedef void (*lcb_io_start_fn)(lcb_io_opt_t iops);
575 
581 typedef void (*lcb_io_tick_fn)(lcb_io_opt_t iops);
582 
590 typedef void (*lcb_io_stop_fn)(lcb_io_opt_t iops);
591 
592 LCB_DEPRECATED(typedef void (*lcb_io_error_cb)(lcb_sockdata_t *socket));
594 #define LCB_IOPS_BASE_FIELDS \
595  void *cookie; \
596  int error; \
597  int need_cleanup;
598 
599 struct 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 
620 struct 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 
642 typedef struct lcb_timerprocs_st {
643  lcb_io_timer_create_fn create;
644  lcb_io_timer_destroy_fn destroy;
646  lcb_io_timer_schedule_fn schedule;
648 
650 typedef struct lcb_loopprocs_st {
651  lcb_io_start_fn start;
652  lcb_io_stop_fn stop;
655 
657 typedef struct lcb_bsdprocs_st {
658  lcb_ioE_socket_fn socket0;
659  lcb_ioE_connect_fn connect0;
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;
670 } lcb_bsd_procs;
671 
673 typedef struct lcb_evprocs_st {
675  lcb_ioE_event_destroy_fn destroy;
678 } lcb_ev_procs;
679 
681 typedef struct {
682  lcb_ioC_socket_fn socket;
683  lcb_ioC_close_fn close;
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 
700 typedef enum {
788 typedef 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);
792 struct lcbio_TABLE;
793 struct 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  */
808 typedef void (*lcb__iops3fndummy)(void);
809 struct 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 
826 struct 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 
851 typedef lcb_STATUS (*lcb_io_create_fn)(int version, lcb_io_opt_t *io, void *cookie);
852 
884 LIBCOUCHBASE_API
885 void lcb_iops_wire_bsd_impl2(lcb_bsd_procs *procs, int version);
886 
887 /******************************************************************************
888  ******************************************************************************
889  ** IO CREATION **
890  ******************************************************************************
891  ******************************************************************************/
892 
897 typedef enum {
898  LCB_IO_OPS_INVALID = 0x00,
899  LCB_IO_OPS_DEFAULT = 0x01,
904  LCB_IO_OPS_LIBEV = 0x04,
905  LCB_IO_OPS_SELECT = 0x05,
906  LCB_IO_OPS_WINIOCP = 0x06,
907  LCB_IO_OPS_LIBUV = 0x07
911 typedef struct {
912  lcb_io_ops_type_t type;
913  void *cookie;
915 
916 #ifndef __LCB_DOXYGEN__
917 /* These are mostly internal structures which may be in use by older applications.*/
918 typedef struct {
919  const char *sofile;
920  const char *symbol;
921  void *cookie;
922 } lcb_IOCREATEOPTS_DSO;
923 typedef struct {
924  lcb_io_create_fn create;
925  void *cookie;
926 } lcb_IOCREATEOPS_FUNCTIONPOINTER;
927 #endif
928 
930 struct lcb_create_io_ops_st {
931  int version;
932  union {
934  lcb_IOCREATEOPTS_DSO v1;
935  lcb_IOCREATEOPS_FUNCTIONPOINTER v2;
936  } v;
937 };
938 
961 LIBCOUCHBASE_API
962 lcb_STATUS lcb_create_io_ops(lcb_io_opt_t *op, const struct lcb_create_io_ops_st *options);
963 
970 LIBCOUCHBASE_API
971 lcb_STATUS lcb_destroy_io_ops(lcb_io_opt_t op);
972 
973 #ifdef __cplusplus
974 }
975 #endif
976 
979 #endif
void(* lcb_io_stop_fn)(lcb_io_opt_t iops)
Pause the event loop.
Definition: iops.h:593
IO Creation for builtin plugins.
Definition: iops.h:919
void(* lcb_io_timer_destroy_fn)(lcb_io_opt_t iops, void *timer)
Destroy a timer handler.
Definition: iops.h:155
void(* lcb_ioC_wbfree_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *)
Definition: iops.h:467
void lcb_iops_wire_bsd_impl2(lcb_bsd_procs *procs, int version)
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
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:339
int(* lcb_ioE_listen_fn)(lcb_io_opt_t iops, lcb_socket_t bound_sock, unsigned int queuelen)
Definition: iops.h:298
void *(* lcb_ioE_event_create_fn)(lcb_io_opt_t iops)
Create a new event handle.
Definition: iops.h:196
void(* lcb_ioE_close_fn)(lcb_io_opt_t iops, lcb_socket_t sock)
Close a socket.
Definition: iops.h:306
int(* lcb_ioC_cntl_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, int mode, int option, void *arg)
Definition: iops.h:565
void(* lcb_io_connect_cb)(lcb_sockdata_t *socket, int status)
Callback to be invoked upon a connection result.
Definition: iops.h:418
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:448
Socket handle for completion-based I/O.
Definition: iops.h:382
Definition: iops.h:369
structure indicating a buffer and its size
Definition: iops.h:78
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.
structure describing a connected socket's endpoints
Definition: iops.h:100
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_STATUS
Error codes returned by the library.
Definition: error.h:210
lcb_io_writebuf_t *(* lcb_ioC_wballoc_fn)(lcb_io_opt_t, lcb_sockdata_t *)
Definition: iops.h:465
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:854
void(* lcb_io_tick_fn)(lcb_io_opt_t iops)
Run a single iteration of the event loop without blocking.
Definition: iops.h:584
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:525
void * cookie
Plugin-specific argument.
Definition: iops.h:921
Definition: iops.h:939
Definition: iops.h:910
void(* lcb_ioE_event_destroy_fn)(lcb_io_opt_t iops, void *event)
Destroy an event handle.
Definition: iops.h:205
void(* lcb_io_start_fn)(lcb_io_opt_t iops)
Start the event loop.
Definition: iops.h:577
Definition: iops.h:392
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:410
Common functions for starting and stopping the event loop.
Definition: iops.h:653
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
int(* lcb_ioC_read_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_ioC_read_callback)
Definition: iops.h:463
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:500
void(* lcb_io_timer_cancel_fn)(lcb_io_opt_t iops, void *timer)
Cancel a pending timer callback.
Definition: iops.h:167
void(* lcb_ioC_write_callback)(lcb_sockdata_t *, lcb_io_writebuf_t *, int)
Definition: iops.h:469
Common functions for starting and stopping timers.
Definition: iops.h:645
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
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:791
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
unsigned int(* lcb_ioC_close_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd)
Asynchronously shutdown the socket.
Definition: iops.h:542
lcb_io_ops_type_t
Built-in I/O plugins
Definition: iops.h:902
void(* lcb_ioE_callback)(lcb_socket_t sock, short events, void *uarg)
Callback invoked for all poll-like events.
Definition: iops.h:133
int(* lcb_ioC_write_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *, lcb_ioC_write_callback)
Definition: iops.h:473
Functions handling socket watcher events.
Definition: iops.h:676
Integrate with the libevent loop.
Definition: iops.h:909
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:361
lcb_iomodel_t
Enumeration defining the I/O model.
Definition: iops.h:703
lcb_STATUS lcb_destroy_io_ops(lcb_io_opt_t op)
Destroy the plugin handle created by lcb_create_io_ops()
Definition: iops.h:903
void *(* lcb_io_timer_create_fn)(lcb_io_opt_t iops)
Create a new timer object.
Definition: iops.h:145
lcb_socket_t(* lcb_ioE_accept_fn)(lcb_io_opt_t iops, lcb_socket_t lsnsock)
Definition: iops.h:302
void(* lcb_ioC_read_callback)(lcb_sockdata_t *sd, lcb_SSIZE nread)
Definition: iops.h:460
IOCP/Completion style.
Definition: iops.h:705
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:553
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:438
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:509
int lcb_socket_t
Type representing the native socket type of the operating system.
Definition: iops.h:70
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
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:457
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
int(* lcb_ioE_bind_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *srcaddr, unsigned int addrlen)
Definition: iops.h:293
Functions for completion-based I/O.
Definition: iops.h:684
Definition: iops.h:905
void(* lcb_ioC_write2_callback)(lcb_sockdata_t *sd, int status, void *arg)
Callback received when a buffer has been flushed.
Definition: iops.h:481
Functions wrapping the Berkeley Socket API.
Definition: iops.h:660
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:429
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
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
Event/Poll style.
Definition: iops.h:704