# HG changeset patch # User John Tsiombikas # Date 1429390534 -10800 # Node ID b13fda5c01bc7aebe4282acebe0f0dad12a647b4 # Parent 0dd50a23f3dd1cb7f8a160feb9cd86e88c7e44f0 comments in tinyweb.h and README file diff -r 0dd50a23f3dd -r b13fda5c01bc README.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.rst Sat Apr 18 23:55:34 2015 +0300 @@ -0,0 +1,22 @@ +tinyweb - tiny web server library and daemon +============================================ + +The tinyweb project includes a rudimentary web server in library form +(libtinyweb), and a simple web server daemon (tinywebd) which uses it. + +Author: John Tsiombikas + +I disclaim all copyright to this program, and place it in the public domain. +Feel free to use it any way you like. I'd appreciate a mention and an email +saying hi, but whatever. + +Download +-------- +Latest release: no releases yet, just grab the source from the repo. + +Code repository: https://github.com/jtsiomb/tinyweb + +Usage +----- +See ``src/main.c`` as an example on how to use libtinyweb, and read the header +file ``libtinyweb/src/tinyweb.h`` which is very simple, and heavily commented. diff -r 0dd50a23f3dd -r b13fda5c01bc libtinyweb/src/tinyweb.h --- a/libtinyweb/src/tinyweb.h Sat Apr 18 22:47:57 2015 +0300 +++ b/libtinyweb/src/tinyweb.h Sat Apr 18 23:55:34 2015 +0300 @@ -8,8 +8,24 @@ int tw_start(void); int tw_stop(void); +/* tw_get_sockets returns the number of active sockets managed by tinyweb + * (clients plus the listening socket), and fills in the array sockets + * passed through the socks pointer, if it's not null. + * + * Call it with a null pointer initially to get the number of sockets, then + * make sure you have enough space in the array and pass it in a second call + * to fill it. + */ int tw_get_sockets(int *socks); + +/* returns the maximum file descriptor number in the set of sockets managed + * by the library (useful for calling select). + */ int tw_get_maxfd(void); + +/* call tw_handle_socket to let tinyweb handle incoming traffic to any of the + * tinyweb managed sockets. + */ int tw_handle_socket(int s);