X-Git-Url: http://git.pk910.de/?p=TransparentIRC.git;a=blobdiff_plain;f=src%2FIOHandler.h;fp=src%2FIOHandler.h;h=7d33ce23f9ee070b37be8129e8e0acd5863290bc;hp=34e49d4c2f699bf4256a028c62d91521ba9995de;hb=1f2baa2e7b90ea83c5a0c93598e22e5063fc6d95;hpb=0e2ac9360b71a7d054d7e945be575c0d21fa880c diff --git a/src/IOHandler.h b/src/IOHandler.h index 34e49d4..7d33ce2 100644 --- a/src/IOHandler.h +++ b/src/IOHandler.h @@ -44,21 +44,21 @@ enum IOEventType { IOEVENT_READABLE, /* socket is readable - not read anything yet, could also be disconnect notification */ IOEVENT_RECV, /* client socket received something (recv_str valid) */ IOEVENT_CONNECTED, /* client socket connected successful */ - IOEVENT_NOTCONNECTED, /* client socket could not connect (errno valid) */ - IOEVENT_CLOSED, /* client socket lost connection (errno valid) */ + 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_TIMEOUT /* timer timed out */ }; struct IOBuffer { - char buffer; + char *buffer; size_t bufpos, buflen; }; struct IODescriptor { int fd; - IOType type; - IOStatus state; + enum IOType type; + enum IOStatus state; struct timeval timeout; iohandler_callback *callback; struct IOBuffer readbuf; @@ -70,17 +70,17 @@ struct IODescriptor { }; struct IOEvent { - IOEventType type; + enum IOEventType type; struct IODescriptor *iofd; union { char *recv_str; int accept_fd; - int errno; + int errid; } data; }; -struct IODescriptor *iohandler_add(int sockfd, IOType type, iohandler_callback *callback); -struct IODescriptor *iohandler_timer(timeval timeout, iohandler_callback *callback); +struct IODescriptor *iohandler_add(int sockfd, enum IOType type, iohandler_callback *callback); +struct IODescriptor *iohandler_timer(struct timeval timeout, iohandler_callback *callback); struct IODescriptor *iohandler_connect(const char *hostname, unsigned int port, const char *bind, iohandler_callback *callback); struct IODescriptor *iohandler_listen(const char *hostname, unsigned int port, iohandler_callback *callback); void iohandler_write(struct IODescriptor *iofd, const char *line);