tinywebd
changeset 11:b13fda5c01bc
comments in tinyweb.h and README file
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 18 Apr 2015 23:55:34 +0300 |
parents | 0dd50a23f3dd |
children | 86f703031228 |
files | README.rst libtinyweb/src/tinyweb.h |
diffstat | 2 files changed, 38 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/README.rst Sat Apr 18 23:55:34 2015 +0300 1.3 @@ -0,0 +1,22 @@ 1.4 +tinyweb - tiny web server library and daemon 1.5 +============================================ 1.6 + 1.7 +The tinyweb project includes a rudimentary web server in library form 1.8 +(libtinyweb), and a simple web server daemon (tinywebd) which uses it. 1.9 + 1.10 +Author: John Tsiombikas <nuclear@member.fsf.org> 1.11 + 1.12 +I disclaim all copyright to this program, and place it in the public domain. 1.13 +Feel free to use it any way you like. I'd appreciate a mention and an email 1.14 +saying hi, but whatever. 1.15 + 1.16 +Download 1.17 +-------- 1.18 +Latest release: no releases yet, just grab the source from the repo. 1.19 + 1.20 +Code repository: https://github.com/jtsiomb/tinyweb 1.21 + 1.22 +Usage 1.23 +----- 1.24 +See ``src/main.c`` as an example on how to use libtinyweb, and read the header 1.25 +file ``libtinyweb/src/tinyweb.h`` which is very simple, and heavily commented.
2.1 --- a/libtinyweb/src/tinyweb.h Sat Apr 18 22:47:57 2015 +0300 2.2 +++ b/libtinyweb/src/tinyweb.h Sat Apr 18 23:55:34 2015 +0300 2.3 @@ -8,8 +8,24 @@ 2.4 int tw_start(void); 2.5 int tw_stop(void); 2.6 2.7 +/* tw_get_sockets returns the number of active sockets managed by tinyweb 2.8 + * (clients plus the listening socket), and fills in the array sockets 2.9 + * passed through the socks pointer, if it's not null. 2.10 + * 2.11 + * Call it with a null pointer initially to get the number of sockets, then 2.12 + * make sure you have enough space in the array and pass it in a second call 2.13 + * to fill it. 2.14 + */ 2.15 int tw_get_sockets(int *socks); 2.16 + 2.17 +/* returns the maximum file descriptor number in the set of sockets managed 2.18 + * by the library (useful for calling select). 2.19 + */ 2.20 int tw_get_maxfd(void); 2.21 + 2.22 +/* call tw_handle_socket to let tinyweb handle incoming traffic to any of the 2.23 + * tinyweb managed sockets. 2.24 + */ 2.25 int tw_handle_socket(int s); 2.26 2.27