28 #include "ac-stdint.h" 33 # ifdef JABBERD2_EXPORTS 34 # define JABBERD2_API __declspec(dllexport) 36 # define JABBERD2_API __declspec(dllimport) 39 # define JABBERD2_API extern 44 # define MIO_MAXFD FD_SETSIZE 46 # define MIO_MAXFD 1024 58 #ifdef HAVE_SYS_SOCKET_H 59 # include <sys/socket.h> 66 #ifdef HAVE_SYS_IOCTL_H 67 # include <sys/ioctl.h> 70 #ifdef HAVE_SYS_FILIO_H 71 # include <sys/filio.h> 137 #define mio_free(m) (*m)->mio_free(m) 140 #define mio_listen(m, port, sourceip, app, arg) \ 141 (*m)->mio_listen(m, port, sourceip, app, arg) 144 #define mio_connect(m, port, hostip, srcip, app, arg) \ 145 (*m)->mio_connect(m, port, hostip, srcip, app, arg) 148 #define mio_register(m, fd, app, arg) \ 149 (*m)->mio_register(m, fd, app, arg) 152 #define mio_app(m, fd, app, arg) (*m)->mio_app(m, fd, app, arg) 155 #define mio_close(m, fd) (*m)->mio_close(m, fd) 158 #define mio_write(m, fd) (*m)->mio_write(m, fd) 161 #define mio_read(m, fd) (*m)->mio_read(m, fd) 164 #define mio_run(m, timeout) (*m)->mio_run(m, timeout) 168 # define MIO_ERROR errno 169 # define MIO_SETERROR(e) (errno = e) 170 # define MIO_STRERROR(e) strerror(e) 171 # define MIO_WOULDBLOCK (errno == EWOULDBLOCK || errno == EINTR || errno == EAGAIN) 174 # define MIO_ERROR WSAGetLastError() 175 # define MIO_SETERROR(e) WSASetLastError(e) 176 # define MIO_STRERROR(e) mio_strerror(e) 177 # define MIO_WOULDBLOCK (WSAGetLastError() == WSAEWOULDBLOCK) #define mio_run(m, timeout)
give some cpu time to mio to check it's sockets, 0 is non-blocking
JABBERD2_API mio_t mio_new(int maxfd)
create/free the mio subsytem
mio_action_t
these are the actions and a handler type assigned by the applicaiton using mio
struct mio_fd_st * mio_fd_t
#define mio_read(m, fd)
process read events for this fd
int(* mio_handler_t)(struct mio_st **m, mio_action_t a, struct mio_fd_st *fd, void *data, void *arg)
#define mio_app(m, fd, app, arg)
re-set the app handler
#define mio_close(m, fd)
request that mio close this fd
#define mio_write(m, fd)
mio should try the write action on this fd now