Hi This set starts the merging of the lib branch, and contains the quick to review parts: examples, docs, and tests.
- Lauri
>From 76e60a8fee8381b848c803c975d2523a8971afff Mon Sep 17 00:00:00 2001 From: Lauri Kasanen <[email protected]> Date: Wed, 18 Jul 2012 19:33:53 +0300 Subject: [PATCH 1/3] lib: Add the generated man pages, plus the asciidoc sources Signed-off-by: Lauri Kasanen <[email protected]> --- man/asc-src/Makefile | 14 +++ man/asc-src/asciidoc.conf | 2 + man/asc-src/mklib_callback_set.txt | 95 ++++++++++++++++ man/asc-src/mklib_config.txt | 95 ++++++++++++++++ man/asc-src/mklib_init.txt | 49 ++++++++ man/asc-src/mklib_mimetype_add.txt | 52 +++++++++ man/asc-src/mklib_scheduler_worker_info.txt | 46 ++++++++ man/asc-src/mklib_start.txt | 36 ++++++ man/asc-src/mklib_vhost_config.txt | 50 ++++++++ man/asc-src/mklib_vhost_list.txt | 49 ++++++++ man/mklib_callback_set.3 | 154 +++++++++++++++++++++++++ man/mklib_config.3 | 161 +++++++++++++++++++++++++++ man/mklib_init.3 | 61 ++++++++++ man/mklib_mimetype_add.3 | 65 +++++++++++ man/mklib_mimetype_list.3 | 1 + man/mklib_scheduler_worker_info.3 | 63 +++++++++++ man/mklib_start.3 | 52 +++++++++ man/mklib_stop.3 | 1 + man/mklib_vhost_config.3 | 73 ++++++++++++ man/mklib_vhost_list.3 | 66 +++++++++++ 20 files changed, 1185 insertions(+), 0 deletions(-) create mode 100644 man/asc-src/Makefile create mode 100644 man/asc-src/asciidoc.conf create mode 100644 man/asc-src/mklib_callback_set.txt create mode 100644 man/asc-src/mklib_config.txt create mode 100644 man/asc-src/mklib_init.txt create mode 100644 man/asc-src/mklib_mimetype_add.txt create mode 100644 man/asc-src/mklib_scheduler_worker_info.txt create mode 100644 man/asc-src/mklib_start.txt create mode 100644 man/asc-src/mklib_vhost_config.txt create mode 100644 man/asc-src/mklib_vhost_list.txt create mode 100644 man/mklib_callback_set.3 create mode 100644 man/mklib_config.3 create mode 100644 man/mklib_init.3 create mode 100644 man/mklib_mimetype_add.3 create mode 100644 man/mklib_mimetype_list.3 create mode 100644 man/mklib_scheduler_worker_info.3 create mode 100644 man/mklib_start.3 create mode 100644 man/mklib_stop.3 create mode 100644 man/mklib_vhost_config.3 create mode 100644 man/mklib_vhost_list.3 diff --git a/man/asc-src/Makefile b/man/asc-src/Makefile new file mode 100644 index 0000000..802bf2b --- /dev/null +++ b/man/asc-src/Makefile @@ -0,0 +1,14 @@ +.PHONY: all clean + +SRC = $(wildcard *.txt) +DST = $(SRC:.txt=.o) + +all: $(DST) + -mv *.[0-9] .. + +%.o : %.txt + a2x -f manpage $< + touch $@ + +clean: + rm -f *.o *.[0-9] diff --git a/man/asc-src/asciidoc.conf b/man/asc-src/asciidoc.conf new file mode 100644 index 0000000..1209473 --- /dev/null +++ b/man/asc-src/asciidoc.conf @@ -0,0 +1,2 @@ +[specialwords] +emphasizedwords=MKLIB_TRUE MKLIB_FALSE diff --git a/man/asc-src/mklib_callback_set.txt b/man/asc-src/mklib_callback_set.txt new file mode 100644 index 0000000..6d0e303 --- /dev/null +++ b/man/asc-src/mklib_callback_set.txt @@ -0,0 +1,95 @@ +mklib_callback_set(3) +===================== + +NAME +---- +mklib_callback_set - sets up a callback function + +SYNOPSIS +-------- +*#include <monkey.h>* + +*int (*cb_ipcheck)(const char *'ip');* + +*int (*cb_urlcheck)(const char *'url');* + +[verse] +*int (*cb_data)(const mklib_session *'sr', const char *'vhost', const char *'url', + const char *'get', unsigned long 'get_len', + const char *'post', unsigned long 'post_len', + unsigned int *'status', const char `**`'content', + unsigned long *'content_len', char *'header');* + +*void (*cb_close)(const mklib_session *'sr');* + +*int mklib_callback_set(mklib_ctx 'ctx', enum mklib_cb 'cb', void *'func');* + +DESCRIPTION +----------- +The *mklib_callback_set*() function binds the passed function as the passed callback. + +You may use NULL for the 'func' argument to reset it. There can be only one callback +of each type. + +VALID OPTIONS +------------- +*MKCB_IPCHECK*:: + The 'func' argument is a function compliant with the *cb_ipcheck* declaration. +*MKCB_URLCHECK*:: + The 'func' argument is a function compliant with the *cb_urlcheck* declaration. +*MKCB_DATA*:: + The 'func' argument is a function compliant with the *cb_data* declaration. +*MKCB_CLOSE*:: + The 'func' argument is a function compliant with the *cb_close* declaration. + +CALLBACKS +--------- + +The *cb_ipcheck*() callback is called right after a new connection is established. +It is given the IP in text form, and is expected to return MKLIB_FALSE if the connection +is to be dropped. + +The *cb_urlcheck*() callback is called when the requested URL is known. You may use this +callback to check whether the URL is valid. Return MKLIB_FALSE to drop this connection. + +The *cb_data*() callback is the main entry point for dynamic applications. +Return MKLIB_FALSE if you don't want to handle this connection, and MKLIB_TRUE if you +sent any data. + +*Input arguments*:: + The 'sr' argument is a unique identifier for this request. You may use it to match + any dynamically allocated memory later in the *cb_close*() callback. + + The 'vhost' argument is a unique string identifying this virtual host. It is + "default" for the default/fallback virtual host. + + The 'url' argument contains the request url, same as passed to the *cb_urlcheck*() + callback. + + The 'get' and 'post' arguments contain data sent via HTTP GET and POST, if any. They + are NULL if no data was sent via that channel. + +*Output arguments*:: + The 'status' argument will be sent as the HTTP status code. If not set, it defaults + to 200 "OK". + + The 'content' argument will contain the main response you want to send for this + request. It must stay available until the *cb_close*() callback is called. + + The 'content_len' argument will contain the length of 'content', in bytes. + + The 'header' argument has 256 bytes of static space for any custom headers. + For example, one could write the content type there: "Content-type: text/html" + + +The *cb_close*() callback is called after all data for this request is served. You may use +the callback for freeing any per-request dynamic memory, for example. + +RETURN VALUE +------------ +On success, returns MKLIB_TRUE. On failure MKLIB_FALSE is returned. + +SEE ALSO +-------- +*mklib_config*(3), *mklib_vhost_config*(3), *mklib_start*(3), *mklib_stop*(3), +*mklib_init*(3), *mklib_vhost_list*(3), *mklib_scheduler_worker_info*(3), +*mklib_mimetype_add*(3) + +RESOURCES +--------- +See http://monkey-project.com + diff --git a/man/asc-src/mklib_config.txt b/man/asc-src/mklib_config.txt new file mode 100644 index 0000000..1670180 --- /dev/null +++ b/man/asc-src/mklib_config.txt @@ -0,0 +1,95 @@ +mklib_config(3) +============= + +NAME +---- +mklib_config - configure your libmonkey instance + +SYNOPSIS +-------- +*#include <monkey.h>* + +*int mklib_config(mklib_ctx 'ctx', ...);* + +DESCRIPTION +----------- +*mklib_config*() is a NULL-terminated call for configuring the libmonkey context. + +You may call it several times with different options or all at once. + +VALID OPTIONS +------------- +*MKC_WORKERS*:: + How many worker threads to spawn, the next argument is an int. Default 1. + +*MKC_TIMEOUT*:: + How many seconds to wait for a response, the next argument is an int. Default 15. + +*MKC_USERDIR*:: + What is the users' www space named. The next argument is a char *. + The default is NULL, that is, no www space is allowed. + + Example: set it to "public_html", and /~user redirects to /home/user/public_html. + +*MKC_INDEXFILE*:: + A space-delimited list of accepted index files. The next argument is a char *. + The default is NULL, that is, when trying to access a directory, a 403 forbidden is + returned. + + Example: "index.html index.htm" + +*MKC_HIDEVERSION*:: + Whether to hide the libmonkey version in headers and error pages. The next argument + is either MKLIB_TRUE or MKLIB_FALSE. The default is MKLIB_TRUE, no version is shown. + +*MKC_RESUME*:: + Whether to support resuming. The next argument is either MKLIB_TRUE or MKLIB_FALSE. + The default is MKLIB_TRUE. + +*MKC_KEEPALIVE*:: + Whether to support keep-alives. The next argument is either MKLIB_TRUE or + MKLIB_FALSE. The default is MKLIB_TRUE. + +*MKC_KEEPALIVETIMEOUT*:: + How many seconds to keep a keep-alive connection open. The next argument is an int. + The default is 15. + +*MKC_MAXKEEPALIVEREQUEST*:: + How many keep-alive requests to handle at once. The next argument is an int. + The default is 50. + +*MKC_MAXREQUESTSIZE*:: + The maximum size of a request, in KiB. The next argument is an int. + The default is 32 KiB. + +*MKC_SYMLINK*:: + Whether to support symlinks. The next argument is either MKLIB_TRUE or MKLIB_FALSE. + The default is MKLIB_FALSE. + +*MKC_DEFAULTMIMETYPE*:: + The default mimetype when a file has an unknown extension. The next argument is a + char *. + The default is "text/plain". + +EXAMPLE +------- +[verse] +`//` Set workers to 3 +mklib_config(ctx, MKC_WORKERS, 3, NULL); +`//` Set timeout and keep-alive timeout to 5s +mklib_config(ctx, MKC_TIMEOUT, 5, MKC_KEEPALIVETIMEOUT, 5, NULL); + +RETURN VALUE +------------ +On success, returns MKLIB_TRUE. On failure MKLIB_FALSE is returned. + +SEE ALSO +-------- +*mklib_init*(3), *mklib_vhost_config*(3), *mklib_start*(3), *mklib_stop*(3), +*mklib_callback_set*(3), *mklib_vhost_list*(3), *mklib_scheduler_worker_info*(3), +*mklib_mimetype_add*(3) + +RESOURCES +--------- +See http://monkey-project.com + diff --git a/man/asc-src/mklib_init.txt b/man/asc-src/mklib_init.txt new file mode 100644 index 0000000..5086755 --- /dev/null +++ b/man/asc-src/mklib_init.txt @@ -0,0 +1,49 @@ +mklib_init(3) +============= + +NAME +---- +mklib_init - sets up a libmonkey context + +SYNOPSIS +-------- +*#include <monkey.h>* + +[verse] +*mklib_ctx mklib_init(const char *'address', unsigned int 'port', + unsigned int 'plugins', const char *'documentroot');* + +DESCRIPTION +----------- +The *mklib_init*() function creates a libmonkey context with the given settings. + +You may use NULL for the char */function pointer and 0 for the int arguments to +use the defaults for each. + +The 'address' argument gives the IP to which to bind. The default is to bind to all. + +The 'port' argument gives the port to bind to. The default is 2001. Note that ports +`<=` 1024 require root permissions. + +The 'plugins' argument is an OR'ed result of valid, library-compliant plugins. +Currently the allowed options are 'MKLIB_LIANA' and 'MKLIB_LIANA_SSL'. The default is +'MKLIB_LIANA'. + +The 'documentroot' argument gives the path from where to serve pages. The default is +none, that is, no files will be served no matter the request. This often makes sense +if you plan to serve all requests dynamically yourself via the data callback. + +RETURN VALUE +------------ +On success, returns a valid mklib_ctx. On failure NULL is returned. + +SEE ALSO +-------- +*mklib_config*(3), *mklib_vhost_config*(3), *mklib_start*(3), *mklib_stop*(3), +*mklib_callback_set*(3), *mklib_vhost_list*(3), *mklib_scheduler_worker_info*(3), +*mklib_mimetype_add*(3) + +RESOURCES +--------- +See http://monkey-project.com + diff --git a/man/asc-src/mklib_mimetype_add.txt b/man/asc-src/mklib_mimetype_add.txt new file mode 100644 index 0000000..32cb3bb --- /dev/null +++ b/man/asc-src/mklib_mimetype_add.txt @@ -0,0 +1,52 @@ +mklib_mimetype_add(3) +===================== + +NAME +---- +mklib_mimetype_add, mklib_mimetype_list - add a mimetype, list the mimetypes + +SYNOPSIS +-------- +*#include <monkey.h>* + +[verse] +*struct mklib_mime { + const char *'name'; + const char *'type'; +};* + +*int mklib_mimetype_add(mklib_ctx 'ctx', char *'name', char *'type');* + +*struct mklib_mime **mklib_mimetype_list(mklib_ctx 'ctx');* + +*mklib_mimetype_foreach(struct mklib_mime *'cur', struct mklib_mime `**`'list')* + +DESCRIPTION +----------- +The *mklib_mimetype_add*() function adds this mimetype to the internal array, if it is not +added already. The 'name' argument is the file extension, for example "html". The 'type' +argument is the mime type, for example "text/html". + +The *mklib_mimetype_list*() function returns a list of all known mime types. Note that the +'type' member is pre-processed to contain CRLF after it, so for matching 'type' use only the +beginning of the string. + +The convenience macro *mklib_mimetype_foreach* may be used to loop over a list of such mime +types. + +RETURN VALUE +------------ +On success, *mklib_mimetype_add*() returns MKLIB_TRUE. On failure MKLIB_FALSE is returned. + +On success, *mklib_mimetype_list*() returns a NULL-terminated list. On failure NULL +is returned. + +SEE ALSO +-------- +*mklib_config*(3), *mklib_vhost_config*(3), *mklib_init*(3), *mklib_callback_set*(3), +*mklib_vhost_list*(3), *mklib_scheduler_worker_info*(3) + +RESOURCES +--------- +See http://monkey-project.com + diff --git a/man/asc-src/mklib_scheduler_worker_info.txt b/man/asc-src/mklib_scheduler_worker_info.txt new file mode 100644 index 0000000..4aaa12d --- /dev/null +++ b/man/asc-src/mklib_scheduler_worker_info.txt @@ -0,0 +1,46 @@ +mklib_scheduler_worker_info(3) +============================== + +NAME +---- +mklib_scheduler_worker_info - list all worker threads and their stats + +SYNOPSIS +-------- +*#include <monkey.h>* + +[verse] +*struct mklib_worker_info { + unsigned long long 'active_connections'; + int 'pid'; +};* + +*mklib_worker_info_foreach(struct mklib_worker_info *'cur', struct mklib_worker_info `**`'list')* + +*struct mklib_worker_info **mklib_vhost_list(mklib_ctx 'ctx');* + +DESCRIPTION +----------- +*mklib_vhost_list*() returns a list of all existing worker threads. + +The 'active_connections' member has the number of currently ongoing connections to this +worker. + +The 'pid' member has the thread ID of this worker. + + +The *mklib_worker_info_foreach* convenience macro may be used to loop over all the workers. + +RETURN VALUE +------------ +On success, returns a NULL-terminated list. On failure NULL is returned. + +SEE ALSO +-------- +*mklib_config*(3), *mklib_init*(3), *mklib_start*(3), *mklib_stop*(3), +*mklib_callback_set*(3), *mklib_vhost_list*(3), *mklib_mimetype_add*(3) + +RESOURCES +--------- +See http://monkey-project.com + diff --git a/man/asc-src/mklib_start.txt b/man/asc-src/mklib_start.txt new file mode 100644 index 0000000..cb0b317 --- /dev/null +++ b/man/asc-src/mklib_start.txt @@ -0,0 +1,36 @@ +mklib_start(3) +============= + +NAME +---- +mklib_start, mklib_stop - start/stop a monkey server instance + +SYNOPSIS +-------- +*#include <monkey.h>* + +*int mklib_start(mklib_ctx 'ctx');* + +*int mklib_stop(mklib_ctx 'ctx');* + +DESCRIPTION +----------- +The *mklib_start*() function starts the server instance identified by +the context 'ctx'. It runs in a thread in the current process. + +The *mklib_stop*() function stops the server instance 'ctx' and frees +all memory associated with it. 'ctx' is invalid after the call. + +RETURN VALUE +------------ +On success, these functions return MKLIB_TRUE. On failure MKLIB_FALSE is returned. + +SEE ALSO +-------- +*mklib_config*(3), *mklib_vhost_config*(3), *mklib_init*(3), *mklib_callback_set*(3), +*mklib_vhost_list*(3), *mklib_scheduler_worker_info*(3), *mklib_mimetype_add*(3) + +RESOURCES +--------- +See http://monkey-project.com + diff --git a/man/asc-src/mklib_vhost_config.txt b/man/asc-src/mklib_vhost_config.txt new file mode 100644 index 0000000..32726cf --- /dev/null +++ b/man/asc-src/mklib_vhost_config.txt @@ -0,0 +1,50 @@ +mklib_vhost_config(3) +===================== + +NAME +---- +mklib_vhost_config - configure a new virtual host + +SYNOPSIS +-------- +*#include <monkey.h>* + +*int mklib_vhost_config(mklib_ctx 'ctx', char *'name', ...);* + +DESCRIPTION +----------- +*mklib_vhost_config*() is a NULL-terminated call creating a new virtual host +with the supplied options. + +The 'name' argument is a unique identifier, not used for anything else. + +VALID OPTIONS +------------- +*MKV_SERVERNAME*:: + The next argument is a char *, pointing to a space-delimited list of + server names. Example: "example.com www.example.com" + +*MKV_DOCUMENT*:: + The next argument is a char *, a string containing the absolute path + to the document root. + +EXAMPLE +------- +[verse] +int retval = mklib_vhost_config(ctx, "example", MKV_SERVERNAME, "example.com", + MKV_DOCUMENTROOT, "/var/www/example", NULL); + +RETURN VALUE +------------ +On success, returns MKLIB_TRUE. On failure MKLIB_FALSE is returned. + +SEE ALSO +-------- +*mklib_config*(3), *mklib_init*(3), *mklib_start*(3), *mklib_stop*(3), +*mklib_callback_set*(3), *mklib_vhost_list*(3), *mklib_scheduler_worker_info*(3), +*mklib_mimetype_add*(3) + +RESOURCES +--------- +See http://monkey-project.com + diff --git a/man/asc-src/mklib_vhost_list.txt b/man/asc-src/mklib_vhost_list.txt new file mode 100644 index 0000000..2373e67 --- /dev/null +++ b/man/asc-src/mklib_vhost_list.txt @@ -0,0 +1,49 @@ +mklib_vhost_list(3) +=================== + +NAME +---- +mklib_vhost_list - list all existing virtual hosts + +SYNOPSIS +-------- +*#include <monkey.h>* + +[verse] +*struct mklib_vhost { + const char *'name'; + const char *'document_root'; + const char *'server_names'; +};* + +*mklib_vhost_foreach(struct mklib_vhost *'cur', struct mklib_vhost `**`'list')* + +*struct mklib_vhost **mklib_vhost_list(mklib_ctx 'ctx');* + +DESCRIPTION +----------- +*mklib_vhost_list*() returns a list of all existing virtual hosts. + +The 'name' member is a unique identifier. + +The 'document_root' member gives the path to this vhost's root. + +The 'server_names' member is a space-separated list of the names the vhost +can be accessed as. + + +The *mklib_vhost_foreach* convenience macro may be used to loop over all the virtual hosts. + +RETURN VALUE +------------ +On success, returns a NULL-terminated list. On failure NULL is returned. + +SEE ALSO +-------- +*mklib_config*(3), *mklib_init*(3), *mklib_start*(3), *mklib_stop*(3), +*mklib_callback_set*(3), *mklib_scheduler_worker_info*(3), *mklib_mimetype_add*(3) + +RESOURCES +--------- +See http://monkey-project.com + diff --git a/man/mklib_callback_set.3 b/man/mklib_callback_set.3 new file mode 100644 index 0000000..f46b70c --- /dev/null +++ b/man/mklib_callback_set.3 @@ -0,0 +1,154 @@ +'\" t +.\" Title: mklib_callback_set +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> +.\" Date: 06/06/2012 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "MKLIB_CALLBACK_SET" "3" "06/06/2012" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +mklib_callback_set \- sets up a callback function +.SH "SYNOPSIS" +.sp +\fB#include <monkey\&.h>\fR +.sp +\fBint (*cb_ipcheck)(const char *\fR\fB\fIip\fR\fR\fB);\fR +.sp +\fBint (*cb_urlcheck)(const char *\fR\fB\fIurl\fR\fR\fB);\fR +.sp +.nf +\fBint (*cb_data)(const mklib_session *\fR\fB\fIsr\fR\fR\fB, const char *\fR\fB\fIvhost\fR\fR\fB, const char *\fR\fB\fIurl\fR\fR\fB, + const char *\fR\fB\fIget\fR\fR\fB, unsigned long \fR\fB\fIget_len\fR\fR\fB, + const char *\fR\fB\fIpost\fR\fR\fB, unsigned long \fR\fB\fIpost_len\fR\fR\fB, + unsigned int *\fR\fB\fIstatus\fR\fR\fB, const char \fR\fB**\fR\fB\fIcontent\fR\fR\fB, + unsigned long *\fR\fB\fIcontent_len\fR\fR\fB, char *\fR\fB\fIheader\fR\fR\fB);\fR +.fi +.sp +\fBvoid (*cb_close)(const mklib_session *\fR\fB\fIsr\fR\fR\fB);\fR +.sp +\fBint mklib_callback_set(mklib_ctx \fR\fB\fIctx\fR\fR\fB, enum mklib_cb \fR\fB\fIcb\fR\fR\fB, void *\fR\fB\fIfunc\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fBmklib_callback_set\fR() function binds the passed function as the passed callback\&. +.sp +You may use NULL for the \fIfunc\fR argument to reset it\&. There can be only one callback of each type\&. +.SH "VALID OPTIONS" +.PP +\fBMKCB_IPCHECK\fR +.RS 4 +The +\fIfunc\fR +argument is a function compliant with the +\fBcb_ipcheck\fR +declaration\&. +.RE +.PP +\fBMKCB_URLCHECK\fR +.RS 4 +The +\fIfunc\fR +argument is a function compliant with the +\fBcb_urlcheck\fR +declaration\&. +.RE +.PP +\fBMKCB_DATA\fR +.RS 4 +The +\fIfunc\fR +argument is a function compliant with the +\fBcb_data\fR +declaration\&. +.RE +.PP +\fBMKCB_CLOSE\fR +.RS 4 +The +\fIfunc\fR +argument is a function compliant with the +\fBcb_close\fR +declaration\&. +.RE +.SH "CALLBACKS" +.sp +The \fBcb_ipcheck\fR() callback is called right after a new connection is established\&. It is given the IP in text form, and is expected to return \fIMKLIB_FALSE\fR if the connection is to be dropped\&. +.sp +The \fBcb_urlcheck\fR() callback is called when the requested URL is known\&. You may use this callback to check whether the URL is valid\&. Return \fIMKLIB_FALSE\fR to drop this connection\&. +.sp +The \fBcb_data\fR() callback is the main entry point for dynamic applications\&. Return \fIMKLIB_FALSE\fR if you don\(cqt want to handle this connection, and \fIMKLIB_TRUE\fR if you sent any data\&. +.PP +\fBInput arguments\fR +.RS 4 +The +\fIsr\fR +argument is a unique identifier for this request\&. You may use it to match any dynamically allocated memory later in the +\fBcb_close\fR() callback\&. + +The +\fIvhost\fR +argument is a unique string identifying this virtual host\&. It is "default" for the default/fallback virtual host\&. + +The +\fIurl\fR +argument contains the request url, same as passed to the +\fBcb_urlcheck\fR() callback\&. + +The +\fIget\fR +and +\fIpost\fR +arguments contain data sent via HTTP GET and POST, if any\&. They are NULL if no data was sent via that channel\&. +.RE +.PP +\fBOutput arguments\fR +.RS 4 +The +\fIstatus\fR +argument will be sent as the HTTP status code\&. If not set, it defaults to 200 "OK"\&. + +The +\fIcontent\fR +argument will contain the main response you want to send for this request\&. It must stay available until the +\fBcb_close\fR() callback is called\&. + +The +\fIcontent_len\fR +argument will contain the length of +\fIcontent\fR, in bytes\&. + +The +\fIheader\fR +argument has 256 bytes of static space for any custom headers\&. For example, one could write the content type there: "Content\-type: text/html" +.RE +.sp +The \fBcb_close\fR() callback is called after all data for this request is served\&. You may use the callback for freeing any per\-request dynamic memory, for example\&. +.SH "RETURN VALUE" +.sp +On success, returns \fIMKLIB_TRUE\fR\&. On failure \fIMKLIB_FALSE\fR is returned\&. +.SH "SEE ALSO" +.sp +\fBmklib_config\fR(3), \fBmklib_vhost_config\fR(3), \fBmklib_start\fR(3), \fBmklib_stop\fR(3), \fBmklib_init\fR(3), \fBmklib_vhost_list\fR(3), \fBmklib_scheduler_worker_info\fR(3), \fBmklib_mimetype_add\fR(3) +.SH "RESOURCES" +.sp +See http://monkey\-project\&.com diff --git a/man/mklib_config.3 b/man/mklib_config.3 new file mode 100644 index 0000000..337b503 --- /dev/null +++ b/man/mklib_config.3 @@ -0,0 +1,161 @@ +'\" t +.\" Title: mklib_config +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> +.\" Date: 06/06/2012 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "MKLIB_CONFIG" "3" "06/06/2012" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +mklib_config \- configure your libmonkey instance +.SH "SYNOPSIS" +.sp +\fB#include <monkey\&.h>\fR +.sp +\fBint mklib_config(mklib_ctx \fR\fB\fIctx\fR\fR\fB, \&...);\fR +.SH "DESCRIPTION" +.sp +\fBmklib_config\fR() is a NULL\-terminated call for configuring the libmonkey context\&. +.sp +You may call it several times with different options or all at once\&. +.SH "VALID OPTIONS" +.PP +\fBMKC_WORKERS\fR +.RS 4 +How many worker threads to spawn, the next argument is an int\&. Default 1\&. +.RE +.PP +\fBMKC_TIMEOUT\fR +.RS 4 +How many seconds to wait for a response, the next argument is an int\&. Default 15\&. +.RE +.PP +\fBMKC_USERDIR\fR +.RS 4 +What is the users\*(Aq www space named\&. The next argument is a char *\&. The default is NULL, that is, no www space is allowed\&. +.sp +.if n \{\ +.RS 4 +.\} +.nf +Example: set it to "public_html", and /~user redirects to /home/user/public_html\&. +.fi +.if n \{\ +.RE +.\} +.RE +.PP +\fBMKC_INDEXFILE\fR +.RS 4 +A space\-delimited list of accepted index files\&. The next argument is a char *\&. The default is NULL, that is, when trying to access a directory, a 403 forbidden is returned\&. +.sp +.if n \{\ +.RS 4 +.\} +.nf +Example: "index\&.html index\&.htm" +.fi +.if n \{\ +.RE +.\} +.RE +.PP +\fBMKC_HIDEVERSION\fR +.RS 4 +Whether to hide the libmonkey version in headers and error pages\&. The next argument is either +\fIMKLIB_TRUE\fR +or +\fIMKLIB_FALSE\fR\&. The default is +\fIMKLIB_TRUE\fR, no version is shown\&. +.RE +.PP +\fBMKC_RESUME\fR +.RS 4 +Whether to support resuming\&. The next argument is either +\fIMKLIB_TRUE\fR +or +\fIMKLIB_FALSE\fR\&. The default is +\fIMKLIB_TRUE\fR\&. +.RE +.PP +\fBMKC_KEEPALIVE\fR +.RS 4 +Whether to support keep\-alives\&. The next argument is either +\fIMKLIB_TRUE\fR +or +\fIMKLIB_FALSE\fR\&. The default is +\fIMKLIB_TRUE\fR\&. +.RE +.PP +\fBMKC_KEEPALIVETIMEOUT\fR +.RS 4 +How many seconds to keep a keep\-alive connection open\&. The next argument is an int\&. The default is 15\&. +.RE +.PP +\fBMKC_MAXKEEPALIVEREQUEST\fR +.RS 4 +How many keep\-alive requests to handle at once\&. The next argument is an int\&. The default is 50\&. +.RE +.PP +\fBMKC_MAXREQUESTSIZE\fR +.RS 4 +The maximum size of a request, in KiB\&. The next argument is an int\&. The default is 32 KiB\&. +.RE +.PP +\fBMKC_SYMLINK\fR +.RS 4 +Whether to support symlinks\&. The next argument is either +\fIMKLIB_TRUE\fR +or +\fIMKLIB_FALSE\fR\&. The default is +\fIMKLIB_FALSE\fR\&. +.RE +.PP +\fBMKC_DEFAULTMIMETYPE\fR +.RS 4 +The default mimetype when a file has an unknown extension\&. The next argument is a char *\&. The default is "text/plain"\&. +.RE +.SH "EXAMPLE" +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Set workers to 3 +mklib_config(ctx, MKC_WORKERS, 3, NULL); +// Set timeout and keep\-alive timeout to 5s +mklib_config(ctx, MKC_TIMEOUT, 5, MKC_KEEPALIVETIMEOUT, 5, NULL); +.fi +.if n \{\ +.RE +.\} +.SH "RETURN VALUE" +.sp +On success, returns \fIMKLIB_TRUE\fR\&. On failure \fIMKLIB_FALSE\fR is returned\&. +.SH "SEE ALSO" +.sp +\fBmklib_init\fR(3), \fBmklib_vhost_config\fR(3), \fBmklib_start\fR(3), \fBmklib_stop\fR(3), \fBmklib_callback_set\fR(3), \fBmklib_vhost_list\fR(3), \fBmklib_scheduler_worker_info\fR(3), \fBmklib_mimetype_add\fR(3) +.SH "RESOURCES" +.sp +See http://monkey\-project\&.com diff --git a/man/mklib_init.3 b/man/mklib_init.3 new file mode 100644 index 0000000..0db1029 --- /dev/null +++ b/man/mklib_init.3 @@ -0,0 +1,61 @@ +'\" t +.\" Title: mklib_init +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> +.\" Date: 06/06/2012 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "MKLIB_INIT" "3" "06/06/2012" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +mklib_init \- sets up a libmonkey context +.SH "SYNOPSIS" +.sp +\fB#include <monkey\&.h>\fR +.sp +.nf +\fBmklib_ctx mklib_init(const char *\fR\fB\fIaddress\fR\fR\fB, unsigned int \fR\fB\fIport\fR\fR\fB, + unsigned int \fR\fB\fIplugins\fR\fR\fB, const char *\fR\fB\fIdocumentroot\fR\fR\fB);\fR +.fi +.SH "DESCRIPTION" +.sp +The \fBmklib_init\fR() function creates a libmonkey context with the given settings\&. +.sp +You may use NULL for the char */function pointer and 0 for the int arguments to use the defaults for each\&. +.sp +The \fIaddress\fR argument gives the IP to which to bind\&. The default is to bind to all\&. +.sp +The \fIport\fR argument gives the port to bind to\&. The default is 2001\&. Note that ports <= 1024 require root permissions\&. +.sp +The \fIplugins\fR argument is an OR\(cqed result of valid, library\-compliant plugins\&. Currently the allowed options are \fIMKLIB_LIANA\fR and \fIMKLIB_LIANA_SSL\fR\&. The default is \fIMKLIB_LIANA\fR\&. +.sp +The \fIdocumentroot\fR argument gives the path from where to serve pages\&. The default is none, that is, no files will be served no matter the request\&. This often makes sense if you plan to serve all requests dynamically yourself via the data callback\&. +.SH "RETURN VALUE" +.sp +On success, returns a valid mklib_ctx\&. On failure NULL is returned\&. +.SH "SEE ALSO" +.sp +\fBmklib_config\fR(3), \fBmklib_vhost_config\fR(3), \fBmklib_start\fR(3), \fBmklib_stop\fR(3), \fBmklib_callback_set\fR(3), \fBmklib_vhost_list\fR(3), \fBmklib_scheduler_worker_info\fR(3), \fBmklib_mimetype_add\fR(3) +.SH "RESOURCES" +.sp +See http://monkey\-project\&.com diff --git a/man/mklib_mimetype_add.3 b/man/mklib_mimetype_add.3 new file mode 100644 index 0000000..051a2de --- /dev/null +++ b/man/mklib_mimetype_add.3 @@ -0,0 +1,65 @@ +'\" t +.\" Title: mklib_mimetype_add +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> +.\" Date: 06/06/2012 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "MKLIB_MIMETYPE_ADD" "3" "06/06/2012" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +mklib_mimetype_add, mklib_mimetype_list \- add a mimetype, list the mimetypes +.SH "SYNOPSIS" +.sp +\fB#include <monkey\&.h>\fR +.sp +.nf +\fBstruct mklib_mime { + const char *\fR\fB\fIname\fR\fR\fB; + const char *\fR\fB\fItype\fR\fR\fB; +};\fR +.fi +.sp +\fBint mklib_mimetype_add(mklib_ctx \fR\fB\fIctx\fR\fR\fB, char *\fR\fB\fIname\fR\fR\fB, char *\fR\fB\fItype\fR\fR\fB);\fR +.sp +\fBstruct mklib_mime **mklib_mimetype_list(mklib_ctx \fR\fB\fIctx\fR\fR\fB);\fR +.sp +\fBmklib_mimetype_foreach(struct mklib_mime *\fR\fB\fIcur\fR\fR\fB, struct mklib_mime \fR\fB**\fR\fB\fIlist\fR\fR\fB)\fR +.SH "DESCRIPTION" +.sp +The \fBmklib_mimetype_add\fR() function adds this mimetype to the internal array, if it is not added already\&. The \fIname\fR argument is the file extension, for example "html"\&. The \fItype\fR argument is the mime type, for example "text/html"\&. +.sp +The \fBmklib_mimetype_list\fR() function returns a list of all known mime types\&. Note that the \fItype\fR member is pre\-processed to contain CRLF after it, so for matching \fItype\fR use only the beginning of the string\&. +.sp +The convenience macro \fBmklib_mimetype_foreach\fR may be used to loop over a list of such mime types\&. +.SH "RETURN VALUE" +.sp +On success, \fBmklib_mimetype_add\fR() returns \fIMKLIB_TRUE\fR\&. On failure \fIMKLIB_FALSE\fR is returned\&. +.sp +On success, \fBmklib_mimetype_list\fR() returns a NULL\-terminated list\&. On failure NULL is returned\&. +.SH "SEE ALSO" +.sp +\fBmklib_config\fR(3), \fBmklib_vhost_config\fR(3), \fBmklib_init\fR(3), \fBmklib_callback_set\fR(3), \fBmklib_vhost_list\fR(3), \fBmklib_scheduler_worker_info\fR(3) +.SH "RESOURCES" +.sp +See http://monkey\-project\&.com diff --git a/man/mklib_mimetype_list.3 b/man/mklib_mimetype_list.3 new file mode 100644 index 0000000..294f006 --- /dev/null +++ b/man/mklib_mimetype_list.3 @@ -0,0 +1 @@ +.so mklib_mimetype_add.3 diff --git a/man/mklib_scheduler_worker_info.3 b/man/mklib_scheduler_worker_info.3 new file mode 100644 index 0000000..7947e0c --- /dev/null +++ b/man/mklib_scheduler_worker_info.3 @@ -0,0 +1,63 @@ +'\" t +.\" Title: mklib_scheduler_worker_info +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> +.\" Date: 06/06/2012 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "MKLIB_SCHEDULER_WORK" "3" "06/06/2012" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +mklib_scheduler_worker_info \- list all worker threads and their stats +.SH "SYNOPSIS" +.sp +\fB#include <monkey\&.h>\fR +.sp +.nf +\fBstruct mklib_worker_info { + unsigned long long \fR\fB\fIactive_connections\fR\fR\fB; + int \fR\fB\fIpid\fR\fR\fB; +};\fR +.fi +.sp +\fBmklib_worker_info_foreach(struct mklib_worker_info *\fR\fB\fIcur\fR\fR\fB, struct mklib_worker_info \fR\fB**\fR\fB\fIlist\fR\fR\fB)\fR +.sp +\fBstruct mklib_worker_info **mklib_vhost_list(mklib_ctx \fR\fB\fIctx\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +\fBmklib_vhost_list\fR() returns a list of all existing worker threads\&. +.sp +The \fIactive_connections\fR member has the number of currently ongoing connections to this worker\&. +.sp +The \fIpid\fR member has the thread ID of this worker\&. +.sp +The \fBmklib_worker_info_foreach\fR convenience macro may be used to loop over all the workers\&. +.SH "RETURN VALUE" +.sp +On success, returns a NULL\-terminated list\&. On failure NULL is returned\&. +.SH "SEE ALSO" +.sp +\fBmklib_config\fR(3), \fBmklib_init\fR(3), \fBmklib_start\fR(3), \fBmklib_stop\fR(3), \fBmklib_callback_set\fR(3), \fBmklib_vhost_list\fR(3), \fBmklib_mimetype_add\fR(3) +.SH "RESOURCES" +.sp +See http://monkey\-project\&.com diff --git a/man/mklib_start.3 b/man/mklib_start.3 new file mode 100644 index 0000000..6d7f99b --- /dev/null +++ b/man/mklib_start.3 @@ -0,0 +1,52 @@ +'\" t +.\" Title: mklib_start +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> +.\" Date: 06/06/2012 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "MKLIB_START" "3" "06/06/2012" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +mklib_start, mklib_stop \- start/stop a monkey server instance +.SH "SYNOPSIS" +.sp +\fB#include <monkey\&.h>\fR +.sp +\fBint mklib_start(mklib_ctx \fR\fB\fIctx\fR\fR\fB);\fR +.sp +\fBint mklib_stop(mklib_ctx \fR\fB\fIctx\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fBmklib_start\fR() function starts the server instance identified by the context \fIctx\fR\&. It runs in a thread in the current process\&. +.sp +The \fBmklib_stop\fR() function stops the server instance \fIctx\fR and frees all memory associated with it\&. \fIctx\fR is invalid after the call\&. +.SH "RETURN VALUE" +.sp +On success, these functions return \fIMKLIB_TRUE\fR\&. On failure \fIMKLIB_FALSE\fR is returned\&. +.SH "SEE ALSO" +.sp +\fBmklib_config\fR(3), \fBmklib_vhost_config\fR(3), \fBmklib_init\fR(3), \fBmklib_callback_set\fR(3), \fBmklib_vhost_list\fR(3), \fBmklib_scheduler_worker_info\fR(3), \fBmklib_mimetype_add\fR(3) +.SH "RESOURCES" +.sp +See http://monkey\-project\&.com diff --git a/man/mklib_stop.3 b/man/mklib_stop.3 new file mode 100644 index 0000000..3d340fc --- /dev/null +++ b/man/mklib_stop.3 @@ -0,0 +1 @@ +.so mklib_start.3 diff --git a/man/mklib_vhost_config.3 b/man/mklib_vhost_config.3 new file mode 100644 index 0000000..845bb7f --- /dev/null +++ b/man/mklib_vhost_config.3 @@ -0,0 +1,73 @@ +'\" t +.\" Title: mklib_vhost_config +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> +.\" Date: 06/06/2012 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "MKLIB_VHOST_CONFIG" "3" "06/06/2012" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +mklib_vhost_config \- configure a new virtual host +.SH "SYNOPSIS" +.sp +\fB#include <monkey\&.h>\fR +.sp +\fBint mklib_vhost_config(mklib_ctx \fR\fB\fIctx\fR\fR\fB, char *\fR\fB\fIname\fR\fR\fB, \&...);\fR +.SH "DESCRIPTION" +.sp +\fBmklib_vhost_config\fR() is a NULL\-terminated call creating a new virtual host with the supplied options\&. +.sp +The \fIname\fR argument is a unique identifier, not used for anything else\&. +.SH "VALID OPTIONS" +.PP +\fBMKV_SERVERNAME\fR +.RS 4 +The next argument is a char *, pointing to a space\-delimited list of server names\&. Example: "example\&.com www\&.example\&.com" +.RE +.PP +\fBMKV_DOCUMENT\fR +.RS 4 +The next argument is a char *, a string containing the absolute path to the document root\&. +.RE +.SH "EXAMPLE" +.sp +.if n \{\ +.RS 4 +.\} +.nf +int retval = mklib_vhost_config(ctx, "example", MKV_SERVERNAME, "example\&.com", + MKV_DOCUMENTROOT, "/var/www/example", NULL); +.fi +.if n \{\ +.RE +.\} +.SH "RETURN VALUE" +.sp +On success, returns \fIMKLIB_TRUE\fR\&. On failure \fIMKLIB_FALSE\fR is returned\&. +.SH "SEE ALSO" +.sp +\fBmklib_config\fR(3), \fBmklib_init\fR(3), \fBmklib_start\fR(3), \fBmklib_stop\fR(3), \fBmklib_callback_set\fR(3), \fBmklib_vhost_list\fR(3), \fBmklib_scheduler_worker_info\fR(3), \fBmklib_mimetype_add\fR(3) +.SH "RESOURCES" +.sp +See http://monkey\-project\&.com diff --git a/man/mklib_vhost_list.3 b/man/mklib_vhost_list.3 new file mode 100644 index 0000000..c8bd4df --- /dev/null +++ b/man/mklib_vhost_list.3 @@ -0,0 +1,66 @@ +'\" t +.\" Title: mklib_vhost_list +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/> +.\" Date: 06/06/2012 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "MKLIB_VHOST_LIST" "3" "06/06/2012" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +mklib_vhost_list \- list all existing virtual hosts +.SH "SYNOPSIS" +.sp +\fB#include <monkey\&.h>\fR +.sp +.nf +\fBstruct mklib_vhost { + const char *\fR\fB\fIname\fR\fR\fB; + const char *\fR\fB\fIdocument_root\fR\fR\fB; + const char *\fR\fB\fIserver_names\fR\fR\fB; +};\fR +.fi +.sp +\fBmklib_vhost_foreach(struct mklib_vhost *\fR\fB\fIcur\fR\fR\fB, struct mklib_vhost \fR\fB**\fR\fB\fIlist\fR\fR\fB)\fR +.sp +\fBstruct mklib_vhost **mklib_vhost_list(mklib_ctx \fR\fB\fIctx\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +\fBmklib_vhost_list\fR() returns a list of all existing virtual hosts\&. +.sp +The \fIname\fR member is a unique identifier\&. +.sp +The \fIdocument_root\fR member gives the path to this vhost\(cqs root\&. +.sp +The \fIserver_names\fR member is a space\-separated list of the names the vhost can be accessed as\&. +.sp +The \fBmklib_vhost_foreach\fR convenience macro may be used to loop over all the virtual hosts\&. +.SH "RETURN VALUE" +.sp +On success, returns a NULL\-terminated list\&. On failure NULL is returned\&. +.SH "SEE ALSO" +.sp +\fBmklib_config\fR(3), \fBmklib_init\fR(3), \fBmklib_start\fR(3), \fBmklib_stop\fR(3), \fBmklib_callback_set\fR(3), \fBmklib_scheduler_worker_info\fR(3), \fBmklib_mimetype_add\fR(3) +.SH "RESOURCES" +.sp +See http://monkey\-project\&.com -- 1.7.2.1
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
