X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/b57f37fb6a4d30ac9aaba3bbca06f5a3307c804a..c7c9aa764d9cbdc653a2212e0ecad4fdf4ddcd1c:/libratbox/include/commio-int.h diff --git a/libratbox/include/commio-int.h b/libratbox/include/commio-int.h index ae84625..da281da 100644 --- a/libratbox/include/commio-int.h +++ b/libratbox/include/commio-int.h @@ -32,7 +32,7 @@ #define FD_DESC_SZ 128 /* hostlen + comment */ -#ifdef WIN32 +#ifdef _WIN32 #define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0) #else #define rb_get_errno() @@ -41,31 +41,31 @@ #define rb_hash_fd(x) ((x ^ (x >> RB_FD_HASH_BITS) ^ (x >> (RB_FD_HASH_BITS * 2))) & RB_FD_HASH_MASK) #ifdef HAVE_WRITEV - #ifndef UIO_MAXIOV - # if defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__) +#ifndef UIO_MAXIOV +# if defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__) /* FreeBSD 4.7 defines it in sys/uio.h only if _KERNEL is specified */ - # define RB_UIO_MAXIOV 1024 - # elif defined(__sgi) +# define RB_UIO_MAXIOV 1024 +# elif defined(__sgi) /* IRIX 6.5 has sysconf(_SC_IOV_MAX) which might return 512 or bigger */ - # define RB_UIO_MAXIOV 512 - # elif defined(__sun) +# define RB_UIO_MAXIOV 512 +# elif defined(__sun) /* Solaris (and SunOS?) defines IOV_MAX instead */ - # ifndef IOV_MAX - # define RB_UIO_MAXIOV 16 - # else - # define RB_UIO_MAXIOV IOV_MAX - # endif - - # elif defined(IOV_MAX) - # define RB_UIO_MAXIOV IOV_MAX - # else - # define RB_UIO_MAXIOV 16 - # endif - #else - #define RB_UIO_MAXIOV UIO_MAXIOV - #endif +# ifndef IOV_MAX +# define RB_UIO_MAXIOV 16 +# else +# define RB_UIO_MAXIOV IOV_MAX +# endif + +# elif defined(IOV_MAX) +# define RB_UIO_MAXIOV IOV_MAX +# else +# define RB_UIO_MAXIOV 16 +# endif #else - #define RB_UIO_MAXIOV 16 +#define RB_UIO_MAXIOV UIO_MAXIOV +#endif +#else +#define RB_UIO_MAXIOV 16 #endif struct conndata { @@ -83,7 +83,7 @@ struct acceptdata struct rb_sockaddr_storage S; rb_socklen_t addrlen; ACCB *callback; - ACPRE *precb; + ACPRE *precb; void *data; }; @@ -103,8 +103,8 @@ struct _fde */ rb_dlink_node node; int fd; /* So we can use the rb_fde_t as a callback ptr */ - rb_uint8_t flags; - rb_uint8_t type; + uint8_t flags; + uint8_t type; int pflags; char *desc; PF *read_handler; @@ -115,15 +115,17 @@ struct _fde struct conndata *connect; struct acceptdata *accept; void *ssl; + unsigned int handshake_count; unsigned long ssl_errno; }; -typedef void (*comm_event_cb_t)(void *); +typedef void (*comm_event_cb_t) (void *); #ifdef USE_TIMER_CREATE -typedef struct timer_data { - timer_t td_timer_id; - comm_event_cb_t td_cb; +typedef struct timer_data +{ + timer_t td_timer_id; + comm_event_cb_t td_cb; void *td_udata; int td_repeat; } *comm_event_id; @@ -136,8 +138,8 @@ rb_find_fd(int fd) { rb_dlink_list *hlist; rb_dlink_node *ptr; - - if(unlikely(fd < 0)) + + if(rb_unlikely(fd < 0)) return NULL; hlist = &rb_fd_table[rb_hash_fd(fd)]; @@ -150,7 +152,7 @@ rb_find_fd(int fd) rb_fde_t *F = ptr->data; if(F->fd == fd) return F; - } + } return NULL; } @@ -160,7 +162,7 @@ void rb_connect_callback(rb_fde_t *F, int status); int rb_io_sched_event(struct ev_entry *ev, int when); -void rb_io_unsched_event(struct ev_entry *ev); +void rb_io_unsched_event(struct ev_entry *ev); int rb_io_supports_event(void); void rb_io_init_event(void); @@ -174,7 +176,7 @@ void rb_epoll_init_event(void); int rb_epoll_sched_event(struct ev_entry *event, int when); void rb_epoll_unsched_event(struct ev_entry *event); int rb_epoll_supports_event(void); - + /* poll versions */ void rb_setselect_poll(rb_fde_t *F, unsigned int type, PF * handler, void *client_data); @@ -229,4 +231,3 @@ void rb_setselect_win32(rb_fde_t *F, unsigned int type, PF * handler, void *clie int rb_init_netio_win32(void); int rb_select_win32(long); int rb_setup_fd_win32(rb_fde_t *F); -