1.\" $NetBSD: libbozohttpd.3,v 1.3 2014/03/18 18:20:38 riastradh Exp $ 2.\" 3.\" $eterna: libbozohttpd.3,v 1.2 2010/05/10 02:48:23 mrg Exp $ 4.\" 5.\" Copyright (c) 2009 The NetBSD Foundation, Inc. 6.\" All rights reserved. 7.\" 8.\" This manual page is derived from software contributed to The 9.\" NetBSD Foundation by Alistair Crooks (agc@NetBSD.org) 10.\" 11.\" Redistribution and use in source and binary forms, with or without 12.\" modification, are permitted provided that the following conditions 13.\" are met: 14.\" 1. Redistributions of source code must retain the above copyright 15.\" notice, this list of conditions and the following disclaimer. 16.\" 2. Redistributions in binary form must reproduce the above copyright 17.\" notice, this list of conditions and the following disclaimer in the 18.\" documentation and/or other materials provided with the distribution. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30.\" POSSIBILITY OF SUCH DAMAGE. 31.\" 32.Dd November 5, 2009 33.Dt LIBBOZOHTTPD 3 34.Os 35.Sh NAME 36.Nm libbozohttpd 37.Nd embedded web server library 38.Sh LIBRARY 39.Lb libbozohttpd 40.Sh SYNOPSIS 41.In bozohttpd.h 42.Ft int 43.Fo bozo_set_pref 44.Fa "bozoprefs_t *prefs" "char *name" "char *value" 45.Fc 46.Ft char * 47.Fo bozo_get_pref 48.Fa "bozoprefs_t *prefs" "char *name" 49.Fc 50.Ft int 51.Fo bozo_set_defaults 52.Fa "bozohttpd_t *httpd" "bozoprefs_t *prefs" 53.Fc 54.Ft void 55.Fo bozo_setup 56.Fa "bozohttpd_t *httpd" "bozoprefs_t *prefs" "const char *vhost" "char *slash" 57.Fc 58.Ft bozo_httpreq_t * 59.Fo bozo_read_request 60.Fa "bozohttpd_t *httpd" 61.Fc 62.Ft void 63.Fo bozo_process_request 64.Fa "bozo_httpreq_t *" 65.Fc 66.Ft void 67.Fo bozo_clean_request 68.Fa "bozo_httpreq_t *" 69.Fc 70.Sh DESCRIPTION 71.Nm 72is a library interface to the 73.Xr bozohttpd 8 74web server. 75The 76.Nm 77library can be used to embed a webserver 78in your applications. 79.Pp 80Normal operation sees the 81.Nm 82process be initialised using the 83.Fn bozo_set_defaults 84function, which will set up the default port 85and other internal settings, allocating 86any necessary space as needed. 87The 88.Fn bozo_set_defaults 89function returns 1 on sucess, 0 on failure. 90.Pp 91The 92.Fn bozo_setup 93function is used to specify the virtual host name 94for the web server. 95A NULL host name will mean that 96.Nm 97will use the local value for the host name, 98as returned by 99.Xr gethostname 3 . 100This virtual hostname should be a fully qualified domain name. 101The final argument to 102.Fn bozo_setup 103is the name of the directory to serve as the root 104directory of the web server tree. 105.Pp 106Once the server has been set up, it serves 107requests by using the 108.Fn bozo_read_request 109function, which returns a pointer to a request structure, 110and 111.Fn bozo_process_request , 112which deals with the request, and answers the client. 113The request space is de-allocated 114using the 115.Fn bozo_clean_request 116function. 117.Pp 118Preferences are set 119using the function 120.Fn bozo_set_pref 121function 122and queried using the two 123.Fn bozo_get_pref 124function. 125This is the main interface for selecting options, and for 126setting preferences. 127.Sh SEE ALSO 128.Xr gethostname 3 , 129.Xr ssl 3 , 130.Xr services 5 , 131.Xr httpd 8 132.Sh HISTORY 133The 134.Nm 135library first appeared in 136.Nx 6.0 . 137.Sh AUTHORS 138.An Matthew R. Green Aq Mt mrg@eterna.com.au 139.An Alistair Crooks Aq Mt agc@NetBSD.org 140wrote this high-level interface. 141.Pp 142This manual page was written by 143.An Alistair Crooks . 144