#ifndef __SERVER_H #define __SERVER_H #include #include // Open the server. // Parameters: // - host - hostname or IP address (domain names are OK) // - port - port to use // Returns: // - -1 on failure // - file descriptor of the server on success // Remarks: // - call only after server_init // - you must add returned fd to epoll with EPOLLIN events int server_open(const char* host, int port); // Close the server. // Remarks: // - the socket is automatically removed from epoll void server_close(); // Notify the server that an event happened on its socket. // Returns: // - true on success // - false on failure // Remarks: // - the server accepts the connection and starts managing // it with connection.h // - you should stop close the server if this function // returns false bool server_event(int fd, uint32_t events); #endif