Couchbase C Client  2.10.7
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 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)
134  (lcb_socket_t sock, short events, void *uarg);
135 
146 typedef void *(*lcb_io_timer_create_fn)
147  (lcb_io_opt_t iops);
148 
157 typedef void (*lcb_io_timer_destroy_fn)
158  (lcb_io_opt_t iops, void *timer);
159 
170 typedef void (*lcb_io_timer_cancel_fn)
171  (lcb_io_opt_t iops, void *timer);
172 
183 typedef int (*lcb_io_timer_schedule_fn)
184  (lcb_io_opt_t iops, void *timer,
185  lcb_U32 usecs,
186  void *uarg,
187  lcb_ioE_callback callback);
188 
204 typedef void *(*lcb_ioE_event_create_fn)
205  (lcb_io_opt_t iops);
206 
214 typedef void (*lcb_ioE_event_destroy_fn)
215  (lcb_io_opt_t iops, void *event);
216 
228 typedef void (*lcb_ioE_event_cancel_fn)
229  (lcb_io_opt_t iops, lcb_socket_t sock, void *event);
230 
231 
233 #define LCB_READ_EVENT 0x02
234 
235 #define LCB_WRITE_EVENT 0x04
236 
237 #define LCB_ERROR_EVENT 0x08
238 #define LCB_RW_EVENT (LCB_READ_EVENT|LCB_WRITE_EVENT)
239 
265 typedef int (*lcb_ioE_event_watch_fn)
266  (lcb_io_opt_t iops,
267  lcb_socket_t socket,
268  void *event,
269  short evflags,
270  void *uarg,
271  lcb_ioE_callback callback);
272 
282 typedef lcb_SSIZE (*lcb_ioE_recv_fn)
283  (lcb_io_opt_t iops, lcb_socket_t sock, void *target_buf,
284  lcb_SIZE buflen, int _unused_flags);
285 
289 typedef lcb_SSIZE (*lcb_ioE_send_fn)
290  (lcb_io_opt_t iops, lcb_socket_t sock, const void *srcbuf,
291  lcb_SIZE buflen, int _ignored);
292 
295 typedef lcb_SSIZE (*lcb_ioE_recvv_fn)
296  (lcb_io_opt_t iops, lcb_socket_t sock, lcb_IOV *iov, lcb_SIZE niov);
297 
300 typedef lcb_SSIZE (*lcb_ioE_sendv_fn)
301  (lcb_io_opt_t iops, lcb_socket_t sock, lcb_IOV *iov, lcb_SIZE niov);
302 
306  (lcb_io_opt_t iops, int domain, int type, int protocol);
307 
310 typedef int (*lcb_ioE_connect_fn)
311  (lcb_io_opt_t iops,
312  lcb_socket_t sock,
313  const struct sockaddr *dst,
314  unsigned int addrlen);
315 
317 typedef int (*lcb_ioE_bind_fn)
318  (lcb_io_opt_t iops,
319  lcb_socket_t sock,
320  const struct sockaddr *srcaddr,
321  unsigned int addrlen);
322 
324 typedef int (*lcb_ioE_listen_fn)
325  (lcb_io_opt_t iops,
326  lcb_socket_t bound_sock,
327  unsigned int queuelen);
328 
331  (lcb_io_opt_t iops,
332  lcb_socket_t lsnsock);
333 
336 typedef void (*lcb_ioE_close_fn)
337  (lcb_io_opt_t iops, lcb_socket_t sock);
338 
339 
350 #define LCB_IO_SOCKCHECK_PEND_IS_ERROR 1
351 
352 #define LCB_IO_SOCKCHECK_STATUS_CLOSED 1
353 #define LCB_IO_SOCKCHECK_STATUS_OK 0
354 #define LCB_IO_SOCKCHECK_STATUS_UNKNOWN -1
355 
371 typedef int (*lcb_ioE_chkclosed_fn)
372  (lcb_io_opt_t iops, lcb_socket_t sock, int flags);
373 
374 
376 #define LCB_IO_CNTL_GET 0
377 
378 #define LCB_IO_CNTL_SET 1
379 
381 #define LCB_IO_CNTL_TCP_NODELAY 1
382 
384 #define LCB_IO_CNTL_TCP_KEEPALIVE 2
385 
395 typedef int (*lcb_ioE_cntl_fn)
396  (lcb_io_opt_t iops, lcb_socket_t sock, int mode, int option, void *arg);
400 struct ringbuffer_st;
401 struct lcb_connection_st;
402 struct lcbio_SOCKET;
403 
405 struct lcb_buf_info {
406  char *root;
407  lcb_SIZE size;
408  struct ringbuffer_st *ringbuffer;
409  struct lcb_iovec_st iov[2];
410 };
411 
418 typedef struct lcb_sockdata_st {
420  lcb_io_opt_t parent;
421  struct lcbio_SOCKET *lcbconn;
422  int closed;
425 } lcb_sockdata_t;
426 
428 typedef struct lcb_io_writebuf_st {
429  struct lcb_io_opt_st *parent;
430  struct lcb_buf_info buffer;
431 } lcb_io_writebuf_t;
432 
446 typedef lcb_sockdata_t* (*lcb_ioC_socket_fn)
447  (lcb_io_opt_t iops, int domain, int type, int protocol);
448 
455 typedef void (*lcb_io_connect_cb)(lcb_sockdata_t *socket, int status);
456 
466 typedef int (*lcb_ioC_connect_fn)
467  (lcb_io_opt_t iops, lcb_sockdata_t *sd,
468  const struct sockaddr *dst,
469  unsigned int naddr,
470  lcb_io_connect_cb callback);
471 
478 typedef void (lcb_ioC_serve_callback)
479  (lcb_sockdata_t *sd_server,
480  lcb_sockdata_t *sd_client,
481  int status);
482 
491 typedef int (*lcb_ioC_serve_fn)
492  (lcb_io_opt_t iops,
493  lcb_sockdata_t *server_socket,
494  const struct sockaddr *listen_addr,
495  lcb_ioC_serve_callback callback);
496 
503 typedef int (*lcb_ioC_nameinfo_fn)
504  (lcb_io_opt_t iops,
505  lcb_sockdata_t *sock,
506  struct lcb_nameinfo_st *ni);
507 
509 typedef void (*lcb_ioC_read_callback)(lcb_sockdata_t *sd, lcb_SSIZE nread);
510 #define lcb_io_read_cb lcb_ioC_read_callback
511 
512 typedef int (*lcb_ioC_read_fn)(lcb_io_opt_t,lcb_sockdata_t*,lcb_ioC_read_callback);
514 typedef lcb_io_writebuf_t* (*lcb_ioC_wballoc_fn)(lcb_io_opt_t,lcb_sockdata_t *);
516 typedef void (*lcb_ioC_wbfree_fn)(lcb_io_opt_t,lcb_sockdata_t*,lcb_io_writebuf_t*);
518 typedef void (*lcb_ioC_write_callback)(lcb_sockdata_t*,lcb_io_writebuf_t*,int);
519 #define lcb_io_write_cb lcb_ioC_write_callback
520 
522 typedef int (*lcb_ioC_write_fn)
523  (lcb_io_opt_t,lcb_sockdata_t*,lcb_io_writebuf_t*,lcb_ioC_write_callback);
524 
525 
532 typedef void (*lcb_ioC_write2_callback)
533  (lcb_sockdata_t *sd,
534  int status,
535  void *arg);
536 
554 typedef int (*lcb_ioC_write2_fn)
555  (lcb_io_opt_t iops,
556  lcb_sockdata_t *sd,
557  lcb_IOV *iov,
558  lcb_SIZE niov,
559  void *uarg,
560  lcb_ioC_write2_callback callback);
561 
562 
569 typedef void (*lcb_ioC_read2_callback)
570  (lcb_sockdata_t *sd, lcb_SSIZE nread, void *arg);
586 typedef int (*lcb_ioC_read2_fn)
587  (lcb_io_opt_t iops,
588  lcb_sockdata_t *sd,
589  lcb_IOV *iov,
590  lcb_SIZE niov,
591  void *uarg,
592  lcb_ioC_read2_callback callback);
593 
608 typedef unsigned int (*lcb_ioC_close_fn)
609  (lcb_io_opt_t iops,
610  lcb_sockdata_t *sd);
611 
621 typedef int (*lcb_ioC_chkclosed_fn)
622  (lcb_io_opt_t iops, lcb_sockdata_t *sd, int flags);
623 
634 typedef int (*lcb_ioC_cntl_fn)
635  (lcb_io_opt_t iops, lcb_sockdata_t *sd, int mode, int option, void *arg);
636 
647 typedef void (*lcb_io_start_fn)(lcb_io_opt_t iops);
648 
654 typedef void (*lcb_io_tick_fn)(lcb_io_opt_t iops);
655 
663 typedef void (*lcb_io_stop_fn)(lcb_io_opt_t iops);
664 
665 LCB_DEPRECATED(typedef void (*lcb_io_error_cb)(lcb_sockdata_t *socket));
666 
667 #define LCB_IOPS_BASE_FIELDS \
668  void *cookie; \
669  int error; \
670  int need_cleanup;
671 
672 struct lcb_iops_evented_st {
673  LCB_IOPS_BASE_FIELDS
674  LCB_IOPS_DEPRECATED(lcb_ioE_socket_fn socket);
675  LCB_IOPS_DEPRECATED(lcb_ioE_connect_fn connect);
676  LCB_IOPS_DEPRECATED(lcb_ioE_recv_fn recv);
677  LCB_IOPS_DEPRECATED(lcb_ioE_send_fn send);
678  LCB_IOPS_DEPRECATED(lcb_ioE_recvv_fn recvv);
679  LCB_IOPS_DEPRECATED(lcb_ioE_sendv_fn sendv);
680  LCB_IOPS_DEPRECATED(lcb_ioE_close_fn close);
681  LCB_IOPS_DEPRECATED(lcb_io_timer_create_fn create_timer);
682  LCB_IOPS_DEPRECATED(lcb_io_timer_destroy_fn destroy_timer);
683  LCB_IOPS_DEPRECATED(lcb_io_timer_cancel_fn delete_timer);
684  LCB_IOPS_DEPRECATED(lcb_io_timer_schedule_fn update_timer);
685  LCB_IOPS_DEPRECATED(lcb_ioE_event_create_fn create_event);
686  LCB_IOPS_DEPRECATED(lcb_ioE_event_destroy_fn destroy_event);
687  LCB_IOPS_DEPRECATED(lcb_ioE_event_watch_fn update_event);
688  LCB_IOPS_DEPRECATED(lcb_ioE_event_cancel_fn delete_event);
689  LCB_IOPS_DEPRECATED(lcb_io_stop_fn stop_event_loop);
690  LCB_IOPS_DEPRECATED(lcb_io_start_fn run_event_loop);
691 };
692 
693 struct lcb_iops_completion_st {
694  LCB_IOPS_BASE_FIELDS
695  LCB_IOPS_DEPRECATED(lcb_ioC_socket_fn create_socket);
696  LCB_IOPS_DEPRECATED(lcb_ioC_connect_fn start_connect);
697  LCB_IOPS_DEPRECATED(lcb_ioC_wballoc_fn create_writebuf);
698  LCB_IOPS_DEPRECATED(lcb_ioC_wbfree_fn release_writebuf);
699  LCB_IOPS_DEPRECATED(lcb_ioC_write_fn start_write);
700  LCB_IOPS_DEPRECATED(lcb_ioC_read_fn start_read);
701  LCB_IOPS_DEPRECATED(lcb_ioC_close_fn close_socket);
702  LCB_IOPS_DEPRECATED(lcb_io_timer_create_fn create_timer);
703  LCB_IOPS_DEPRECATED(lcb_io_timer_destroy_fn destroy_timer);
704  LCB_IOPS_DEPRECATED(lcb_io_timer_cancel_fn delete_timer);
705  LCB_IOPS_DEPRECATED(lcb_io_timer_schedule_fn update_timer);
706  LCB_IOPS_DEPRECATED(lcb_ioC_nameinfo_fn get_nameinfo);
707  void (*pad1)(void);
708  void (*pad2)(void);
709  LCB_IOPS_DEPRECATED(void (*send_error)(struct lcb_io_opt_st*, lcb_sockdata_t*,void(*)(lcb_sockdata_t*)));
710  LCB_IOPS_DEPRECATED(lcb_io_stop_fn stop_event_loop);
711  LCB_IOPS_DEPRECATED(lcb_io_start_fn run_event_loop);
712 };
713 
715 typedef struct lcb_timerprocs_st {
716  lcb_io_timer_create_fn create;
717  lcb_io_timer_destroy_fn destroy;
718  lcb_io_timer_cancel_fn cancel;
719  lcb_io_timer_schedule_fn schedule;
720 } lcb_timer_procs;
721 
723 typedef struct lcb_loopprocs_st {
724  lcb_io_start_fn start;
725  lcb_io_stop_fn stop;
726  lcb_io_tick_fn tick;
727 } lcb_loop_procs;
728 
730 typedef struct lcb_bsdprocs_st {
731  lcb_ioE_socket_fn socket0;
732  lcb_ioE_connect_fn connect0;
733  lcb_ioE_recv_fn recv;
734  lcb_ioE_recvv_fn recvv;
735  lcb_ioE_send_fn send;
736  lcb_ioE_sendv_fn sendv;
737  lcb_ioE_close_fn close;
738  lcb_ioE_bind_fn bind;
739  lcb_ioE_listen_fn listen;
740  lcb_ioE_accept_fn accept;
741  lcb_ioE_chkclosed_fn is_closed;
742  lcb_ioE_cntl_fn cntl;
743 } lcb_bsd_procs;
744 
746 typedef struct lcb_evprocs_st {
748  lcb_ioE_event_destroy_fn destroy;
751 } lcb_ev_procs;
752 
754 typedef struct {
755  lcb_ioC_socket_fn socket;
756  lcb_ioC_close_fn close;
757  lcb_ioC_read_fn read;
758  lcb_ioC_connect_fn connect;
759  lcb_ioC_wballoc_fn wballoc;
760  lcb_ioC_wbfree_fn wbfree;
761  lcb_ioC_write_fn write;
762  lcb_ioC_write2_fn write2;
763  lcb_ioC_read2_fn read2;
764  lcb_ioC_serve_fn serve;
765  lcb_ioC_nameinfo_fn nameinfo;
766  lcb_ioC_chkclosed_fn is_closed;
767  lcb_ioC_cntl_fn cntl;
769 
773 typedef enum {
776 } lcb_iomodel_t;
777 
861 typedef void (*lcb_io_procs_fn)
862  (int version,
863  lcb_loop_procs *loop_procs,
864  lcb_timer_procs *timer_procs,
865  lcb_bsd_procs *bsd_procs,
866  lcb_ev_procs *ev_procs,
867  lcb_completion_procs *completion_procs,
868  lcb_iomodel_t *iomodel);
869 
870 struct lcbio_TABLE;
871 struct lcb_iops2_st {
872  LCB_IOPS_BASE_FIELDS
873  lcb_io_procs_fn get_procs;
874  struct lcbio_TABLE *iot;
875 };
876 
877 /* This is here to provide backwards compatibility with older (broken) clients
878  * which attempt to 'subclass' the select plugin, or similar. In this case we
879  * provide 17 callback fields (unused here) which the plugin implementation
880  * may set, so that the older code can continue to function without upgrading
881  * the client to a newer version. This should not be used except by internal
882  * plugins; specifically the ABI layout of this field is subject to change
883  * (for example, additional fields may be added or existing fields may be
884  * renamed/removed) without notice.
885  */
886 typedef void (*lcb__iops3fndummy)(void);
887 struct lcb_iops3_st {
888  LCB_IOPS_BASE_FIELDS
889  lcb__iops3fndummy pads[17];
890  lcb_io_procs_fn get_procs;
891  struct lcbio_TABLE *iot;
892 };
893 
899 #define LCB_IOPROCS_VERSION 4
900 
901 #define LCB_IOPS_BASEFLD(iops, fld) ((iops)->v.base).fld
902 #define LCB_IOPS_ERRNO(iops) LCB_IOPS_BASEFLD(iops, error)
903 
904 struct lcb_io_opt_st {
905  int version;
906  void *dlhandle;
907  void (*destructor)(struct lcb_io_opt_st *iops);
908  union {
909  struct {
910  LCB_IOPS_BASE_FIELDS
911  } base;
912 
914  struct lcb_iops_evented_st v0;
915  struct lcb_iops_completion_st v1;
916  struct lcb_iops2_st v2;
917  struct lcb_iops3_st v3;
918  } v;
919 };
920 
929 typedef lcb_error_t (*lcb_io_create_fn)
930  (int version, lcb_io_opt_t *io, void *cookie);
931 
932 
964 LIBCOUCHBASE_API
965 void
966 lcb_iops_wire_bsd_impl2(lcb_bsd_procs *procs, int version);
967 
968 /******************************************************************************
969  ******************************************************************************
970  ** IO CREATION **
971  ******************************************************************************
972  ******************************************************************************/
973 
978 typedef enum {
979  LCB_IO_OPS_INVALID = 0x00,
980  LCB_IO_OPS_DEFAULT = 0x01,
985  LCB_IO_OPS_LIBEV = 0x04,
986  LCB_IO_OPS_SELECT = 0x05,
987  LCB_IO_OPS_WINIOCP = 0x06,
988  LCB_IO_OPS_LIBUV = 0x07
990 
992 typedef struct {
994  void *cookie;
996 
997 #ifndef __LCB_DOXYGEN__
998 /* These are mostly internal structures which may be in use by older applications.*/
999 typedef struct { const char *sofile; const char *symbol; void *cookie; } lcb_IOCREATEOPTS_DSO;
1000 typedef struct { lcb_io_create_fn create; void *cookie; } lcb_IOCREATEOPS_FUNCTIONPOINTER;
1001 #endif
1002 
1005  int version;
1006  union {
1008  lcb_IOCREATEOPTS_DSO v1;
1009  lcb_IOCREATEOPS_FUNCTIONPOINTER v2;
1010  } v;
1011 };
1012 
1035 LIBCOUCHBASE_API
1036 lcb_error_t lcb_create_io_ops(lcb_io_opt_t *op, const struct lcb_create_io_ops_st *options);
1037 
1044 LIBCOUCHBASE_API
1045 lcb_error_t lcb_destroy_io_ops(lcb_io_opt_t op);
1046 
1047 #ifdef __cplusplus
1048 }
1049 #endif
1050 
1053 #endif
lcb_ioE_callback
void(* lcb_ioE_callback)(lcb_socket_t sock, short events, void *uarg)
Callback invoked for all poll-like events.
Definition: iops.h:134
lcb_IOCREATEOPTS_BUILTIN::type
lcb_io_ops_type_t type
The predefined type you want to create.
Definition: iops.h:993
lcb_io_start_fn
void(* lcb_io_start_fn)(lcb_io_opt_t iops)
Start the event loop.
Definition: iops.h:647
lcb_io_timer_cancel_fn
void(* lcb_io_timer_cancel_fn)(lcb_io_opt_t iops, void *timer)
Cancel a pending timer callback.
Definition: iops.h:171
lcb_ioE_sendv_fn
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:301
lcb_ioC_read2_callback
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:570
lcb_evprocs_st
Functions handling socket watcher events.
Definition: iops.h:746
lcb_ioC_wbfree_fn
void(* lcb_ioC_wbfree_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *)
Definition: iops.h:516
lcb_io_writebuf_st
Definition: iops.h:428
LCB_IO_OPS_LIBEVENT
@ LCB_IO_OPS_LIBEVENT
Integrate with the libevent loop.
Definition: iops.h:987
lcb_ioC_wballoc_fn
lcb_io_writebuf_t *(* lcb_ioC_wballoc_fn)(lcb_io_opt_t, lcb_sockdata_t *)
Definition: iops.h:514
lcb_nameinfo_st
structure describing a connected socket's endpoints
Definition: iops.h:100
LCB_IOMODEL_EVENT
@ LCB_IOMODEL_EVENT
Event/Poll style.
Definition: iops.h:774
LCB_IO_OPS_DEFAULT
@ LCB_IO_OPS_DEFAULT
Definition: iops.h:984
lcb_socket_t
int lcb_socket_t
Type representing the native socket type of the operating system.
Definition: iops.h:70
lcb_io_stop_fn
void(* lcb_io_stop_fn)(lcb_io_opt_t iops)
Pause the event loop.
Definition: iops.h:663
lcb_ioC_read_fn
int(* lcb_ioC_read_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_ioC_read_callback)
Definition: iops.h:512
lcb_ioE_event_watch_fn
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:266
lcb_ioE_recvv_fn
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:296
LCB_IOMODEL_COMPLETION
@ LCB_IOMODEL_COMPLETION
IOCP/Completion style.
Definition: iops.h:775
lcb_IOV
structure indicating a buffer and its size
lcb_IOCREATEOPTS_BUILTIN::cookie
void * cookie
Plugin-specific argument.
Definition: iops.h:994
lcb_destroy_io_ops
lcb_error_t lcb_destroy_io_ops(lcb_io_opt_t op)
Destroy the plugin handle created by lcb_create_io_ops()
lcb_ioE_chkclosed_fn
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:372
lcb_sockdata_st::lcbconn
struct lcbio_SOCKET * lcbconn
Internal socket equivalent.
Definition: iops.h:421
lcb_sockdata_st::read_buffer
struct lcb_buf_info read_buffer
Definition: iops.h:424
LCB_IO_OPS_INVALID
@ LCB_IO_OPS_INVALID
Definition: iops.h:983
lcb_ioC_write2_fn
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:555
lcb_create_io_ops
lcb_error_t 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.
lcb_ioC_close_fn
unsigned int(* lcb_ioC_close_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd)
Asynchronously shutdown the socket.
Definition: iops.h:609
lcb_buf_info
Definition: iops.h:405
lcb_create_io_ops_st
Definition: iops.h:1004
lcb_io_connect_cb
void(* lcb_io_connect_cb)(lcb_sockdata_t *socket, int status)
Callback to be invoked upon a connection result.
Definition: iops.h:455
lcb_iomodel_t
lcb_iomodel_t
Enumeration defining the I/O model.
Definition: iops.h:773
lcb_error_t
lcb_error_t
Error codes returned by the library.
Definition: error.h:476
lcb_ioC_write2_callback
void(* lcb_ioC_write2_callback)(lcb_sockdata_t *sd, int status, void *arg)
Callback received when a buffer has been flushed.
Definition: iops.h:533
lcb_ioE_event_destroy_fn
void(* lcb_ioE_event_destroy_fn)(lcb_io_opt_t iops, void *event)
Destroy an event handle.
Definition: iops.h:215
lcb_ioE_connect_fn
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:311
lcb_sockdata_st::closed
int closed
Definition: iops.h:422
lcb_sockdata_st::is_reading
int is_reading
Internally used by lcbio.
Definition: iops.h:423
lcb_ioE_send_fn
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:290
lcb_ioE_bind_fn
int(* lcb_ioE_bind_fn)(lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *srcaddr, unsigned int addrlen)
Definition: iops.h:318
lcb_IOCREATEOPTS_BUILTIN
IO Creation for builtin plugins.
Definition: iops.h:992
lcb_ioE_cntl_fn
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:396
lcb_ioE_socket_fn
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:306
lcb_timerprocs_st
Common functions for starting and stopping timers.
Definition: iops.h:715
lcb_io_timer_create_fn
void *(* lcb_io_timer_create_fn)(lcb_io_opt_t iops)
Create a new timer object.
Definition: iops.h:147
lcb_ioC_read_callback
void(* lcb_ioC_read_callback)(lcb_sockdata_t *sd, lcb_SSIZE nread)
Definition: iops.h:509
lcb_io_timer_schedule_fn
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:184
lcb_ioE_listen_fn
int(* lcb_ioE_listen_fn)(lcb_io_opt_t iops, lcb_socket_t bound_sock, unsigned int queuelen)
Definition: iops.h:325
lcb_ioC_nameinfo_fn
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:504
lcb_io_tick_fn
void(* lcb_io_tick_fn)(lcb_io_opt_t iops)
Run a single iteration of the event loop without blocking.
Definition: iops.h:654
lcb_sockdata_st::socket
lcb_socket_t socket
System socket, for informational purposes.
Definition: iops.h:419
lcb_ioC_socket_fn
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:447
lcb_loopprocs_st
Common functions for starting and stopping the event loop.
Definition: iops.h:723
lcb_io_timer_destroy_fn
void(* lcb_io_timer_destroy_fn)(lcb_io_opt_t iops, void *timer)
Destroy a timer handler.
Definition: iops.h:158
lcb_io_create_fn
lcb_error_t(* lcb_io_create_fn)(int version, lcb_io_opt_t *io, void *cookie)
Signature for a loadable plugin's IOPS initializer.
Definition: iops.h:930
lcb_ioE_recv_fn
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:283
lcb_bsdprocs_st
Functions wrapping the Berkeley Socket API.
Definition: iops.h:730
lcb_sockdata_st
Socket handle for completion-based I/O.
Definition: iops.h:418
lcb_ioC_write_fn
int(* lcb_ioC_write_fn)(lcb_io_opt_t, lcb_sockdata_t *, lcb_io_writebuf_t *, lcb_ioC_write_callback)
Definition: iops.h:523
lcb_completion_procs
Functions for completion-based I/O.
Definition: iops.h:754
lcb_ioE_event_cancel_fn
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:229
lcb_io_procs_fn
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:862
lcb_ioC_serve_callback
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:479
lcb_ioC_read2_fn
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:587
lcb_ioE_event_create_fn
void *(* lcb_ioE_event_create_fn)(lcb_io_opt_t iops)
Create a new event handle.
Definition: iops.h:205
LCB_IO_OPS_WINSOCK
@ LCB_IO_OPS_WINSOCK
Definition: iops.h:988
lcb_ioC_connect_fn
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:467
lcb_ioC_chkclosed_fn
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:622
lcb_iops_wire_bsd_impl2
void lcb_iops_wire_bsd_impl2(lcb_bsd_procs *procs, int version)
lcb_io_ops_type_t
lcb_io_ops_type_t
Built-in I/O plugins.
Definition: iops.h:978
lcb_sockdata_st::parent
lcb_io_opt_t parent
Parent I/O context.
Definition: iops.h:420
lcb_ioC_write_callback
void(* lcb_ioC_write_callback)(lcb_sockdata_t *, lcb_io_writebuf_t *, int)
Definition: iops.h:518
lcb_ioE_accept_fn
lcb_socket_t(* lcb_ioE_accept_fn)(lcb_io_opt_t iops, lcb_socket_t lsnsock)
Definition: iops.h:331
lcb_ioC_cntl_fn
int(* lcb_ioC_cntl_fn)(lcb_io_opt_t iops, lcb_sockdata_t *sd, int mode, int option, void *arg)
Definition: iops.h:635
lcb_ioE_close_fn
void(* lcb_ioE_close_fn)(lcb_io_opt_t iops, lcb_socket_t sock)
Close a socket.
Definition: iops.h:337
lcb_ioC_serve_fn
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:492