X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2FIOHandler.h;h=82781d61e0be415f1ad662b0154b8b461316b820;hp=ea7b44396a6d8ea481338f63286e18a5021a982b;hb=259cd63d66c9870dc57aac7c34ef9b2033d9daf0;hpb=8ce78bf760720d04385821abba8f888b5de03140 diff --git a/src/IOHandler.h b/src/IOHandler.h index ea7b443..82781d6 100644 --- a/src/IOHandler.h +++ b/src/IOHandler.h @@ -68,6 +68,7 @@ enum IOEventType { IOEVENT_NOTCONNECTED, /* client socket could not connect (errid valid) */ IOEVENT_CLOSED, /* client socket lost connection (errid valid) */ IOEVENT_ACCEPT, /* server socket accepted new connection (accept_fd valid) */ + IOEVENT_SSLACCEPT, /* SSL server socket accepted new connection (accept_iofd valid) */ IOEVENT_TIMEOUT, /* timer timed out */ IOEVENT_SSLFAILED /* failed to initialize SSL session */ }; @@ -82,12 +83,14 @@ struct IODescriptor { enum IOType type; enum IOStatus state; struct timeval timeout; + int constant_timeout; iohandler_callback *callback; struct IOBuffer readbuf; struct IOBuffer writebuf; void *data; int read_lines : 1; int ssl : 1; + int ssl_server_hs : 1; int ssl_active : 1; int ssl_hs_read : 1; int ssl_hs_write : 1; @@ -103,13 +106,29 @@ struct IOEvent { char *recv_str; int accept_fd; int errid; + struct IODescriptor *accept_iofd; } data; }; +#define IOHANDLER_LISTEN_IPV4 0x01 +#define IOHANDLER_LISTEN_IPV6 0x02 /* overrides IOHANDLER_LISTEN_IPV4 */ + +#define IOHANDLER_CONNECT_IPV4 0x01 +#define IOHANDLER_CONNECT_IPV6 0x02 /* overrides IOHANDLER_CONNECT_IPV4 */ + +#define IOHANDLER_SETTING_HIGH_PRECISION_TIMER 0x01 + +void iohandler_set(int setting, int value); + struct IODescriptor *iohandler_add(int sockfd, enum IOType type, struct timeval *timeout, iohandler_callback *callback); struct IODescriptor *iohandler_timer(struct timeval timeout, iohandler_callback *callback); +struct IODescriptor *iohandler_constant_timer(int msec, iohandler_callback *callback); struct IODescriptor *iohandler_connect(const char *hostname, unsigned int port, int ssl, const char *bind, iohandler_callback *callback); +struct IODescriptor *iohandler_connect_flags(const char *hostname, unsigned int port, int ssl, const char *bindhost, iohandler_callback *callback, int flags); struct IODescriptor *iohandler_listen(const char *hostname, unsigned int port, iohandler_callback *callback); +struct IODescriptor *iohandler_listen_flags(const char *hostname, unsigned int port, iohandler_callback *callback, int flags); +struct IODescriptor *iohandler_listen_ssl(const char *hostname, unsigned int port, const char *certfile, const char *keyfile, iohandler_callback *callback); +struct IODescriptor *iohandler_listen_ssl_flags(const char *hostname, unsigned int port, const char *certfile, const char *keyfile, iohandler_callback *callback, int flags); void iohandler_write(struct IODescriptor *iofd, const char *line); void iohandler_send(struct IODescriptor *iofd, const char *data, size_t datalen); void iohandler_printf(struct IODescriptor *iofd, const char *text, ...);