nuclear@12: /* tinyweb - tiny web server library and daemon nuclear@12: * Author: John Tsiombikas nuclear@12: * nuclear@12: * This program is placed in the public domain. Feel free to use it any nuclear@12: * way you like. Mentions and retaining this attribution header will be nuclear@12: * appreciated, but not required. nuclear@12: */ nuclear@7: #ifndef TINYWEB_H_ nuclear@7: #define TINYWEB_H_ nuclear@7: nuclear@7: void tw_set_port(int port); nuclear@7: int tw_set_root(const char *path); nuclear@7: int tw_set_logfile(const char *fname); nuclear@7: nuclear@7: int tw_start(void); nuclear@7: int tw_stop(void); nuclear@7: nuclear@11: /* tw_get_sockets returns the number of active sockets managed by tinyweb nuclear@11: * (clients plus the listening socket), and fills in the array sockets nuclear@11: * passed through the socks pointer, if it's not null. nuclear@11: * nuclear@11: * Call it with a null pointer initially to get the number of sockets, then nuclear@11: * make sure you have enough space in the array and pass it in a second call nuclear@11: * to fill it. nuclear@11: */ nuclear@7: int tw_get_sockets(int *socks); nuclear@11: nuclear@11: /* returns the maximum file descriptor number in the set of sockets managed nuclear@11: * by the library (useful for calling select). nuclear@11: */ nuclear@7: int tw_get_maxfd(void); nuclear@11: nuclear@11: /* call tw_handle_socket to let tinyweb handle incoming traffic to any of the nuclear@11: * tinyweb managed sockets. nuclear@11: */ nuclear@7: int tw_handle_socket(int s); nuclear@7: nuclear@7: nuclear@7: #endif /* TINYWEB_H_ */