tinywebd

view libtinyweb/src/tinyweb.h @ 12:86f703031228

Attribution headers
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 19 Apr 2015 00:01:01 +0300
parents b13fda5c01bc
children
line source
1 /* tinyweb - tiny web server library and daemon
2 * Author: John Tsiombikas <nuclear@member.fsf.org>
3 *
4 * This program is placed in the public domain. Feel free to use it any
5 * way you like. Mentions and retaining this attribution header will be
6 * appreciated, but not required.
7 */
8 #ifndef TINYWEB_H_
9 #define TINYWEB_H_
11 void tw_set_port(int port);
12 int tw_set_root(const char *path);
13 int tw_set_logfile(const char *fname);
15 int tw_start(void);
16 int tw_stop(void);
18 /* tw_get_sockets returns the number of active sockets managed by tinyweb
19 * (clients plus the listening socket), and fills in the array sockets
20 * passed through the socks pointer, if it's not null.
21 *
22 * Call it with a null pointer initially to get the number of sockets, then
23 * make sure you have enough space in the array and pass it in a second call
24 * to fill it.
25 */
26 int tw_get_sockets(int *socks);
28 /* returns the maximum file descriptor number in the set of sockets managed
29 * by the library (useful for calling select).
30 */
31 int tw_get_maxfd(void);
33 /* call tw_handle_socket to let tinyweb handle incoming traffic to any of the
34 * tinyweb managed sockets.
35 */
36 int tw_handle_socket(int s);
39 #endif /* TINYWEB_H_ */