Home | History | Annotate | Line # | Download | only in httpd
bozohttpd.h revision 1.5.8.2.6.1
      1  1.5.8.2.6.1  msaitoh /*	$NetBSD: bozohttpd.h,v 1.5.8.2.6.1 2014/07/09 16:09:39 msaitoh Exp $	*/
      2          1.3      tls 
      3  1.5.8.2.6.1  msaitoh /*	$eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $	*/
      4          1.1      tls 
      5          1.1      tls /*
      6  1.5.8.2.6.1  msaitoh  * Copyright (c) 1997-2014 Matthew R. Green
      7          1.1      tls  * All rights reserved.
      8          1.1      tls  *
      9          1.1      tls  * Redistribution and use in source and binary forms, with or without
     10          1.1      tls  * modification, are permitted provided that the following conditions
     11          1.1      tls  * are met:
     12          1.1      tls  * 1. Redistributions of source code must retain the above copyright
     13          1.1      tls  *    notice, this list of conditions and the following disclaimer.
     14          1.1      tls  * 2. Redistributions in binary form must reproduce the above copyright
     15          1.1      tls  *    notice, this list of conditions and the following disclaimer and
     16          1.1      tls  *    dedication in the documentation and/or other materials provided
     17          1.1      tls  *    with the distribution.
     18          1.1      tls  *
     19          1.1      tls  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20          1.1      tls  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21          1.1      tls  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22          1.1      tls  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23          1.1      tls  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     24          1.1      tls  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     25          1.1      tls  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     26          1.1      tls  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     27          1.1      tls  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28          1.1      tls  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29          1.1      tls  * SUCH DAMAGE.
     30          1.1      tls  *
     31          1.1      tls  */
     32  1.5.8.2.6.1  msaitoh #ifndef BOZOHTTOPD_H_
     33  1.5.8.2.6.1  msaitoh #define BOZOHTTOPD_H_	1
     34  1.5.8.2.6.1  msaitoh 
     35  1.5.8.2.6.1  msaitoh #include "netbsd_queue.h"
     36  1.5.8.2.6.1  msaitoh 
     37          1.1      tls #include <sys/stat.h>
     38          1.5      mrg 
     39  1.5.8.2.6.1  msaitoh #ifndef NO_LUA_SUPPORT
     40  1.5.8.2.6.1  msaitoh #include <lua.h>
     41  1.5.8.2.6.1  msaitoh #endif
     42          1.1      tls #include <stdio.h>
     43          1.1      tls 
     44  1.5.8.2.6.1  msaitoh /* lots of "const" but gets free()'ed etc at times, sigh */
     45  1.5.8.2.6.1  msaitoh 
     46          1.1      tls /* headers */
     47  1.5.8.2.6.1  msaitoh typedef struct bozoheaders {
     48          1.4      rtr 	/*const*/ char *h_header;
     49          1.1      tls 	/*const*/ char *h_value;	/* this gets free()'ed etc at times */
     50  1.5.8.2.6.1  msaitoh 	SIMPLEQ_ENTRY(bozoheaders)	h_next;
     51  1.5.8.2.6.1  msaitoh } bozoheaders_t;
     52  1.5.8.2.6.1  msaitoh 
     53  1.5.8.2.6.1  msaitoh #ifndef NO_LUA_SUPPORT
     54  1.5.8.2.6.1  msaitoh typedef struct lua_handler {
     55  1.5.8.2.6.1  msaitoh 	const char	*name;
     56  1.5.8.2.6.1  msaitoh 	int		 ref;
     57  1.5.8.2.6.1  msaitoh 	SIMPLEQ_ENTRY(lua_handler)	h_next;
     58  1.5.8.2.6.1  msaitoh } lua_handler_t;
     59  1.5.8.2.6.1  msaitoh 
     60  1.5.8.2.6.1  msaitoh typedef struct lua_state_map {
     61  1.5.8.2.6.1  msaitoh 	const char 	*script;
     62  1.5.8.2.6.1  msaitoh 	const char	*prefix;
     63  1.5.8.2.6.1  msaitoh 	lua_State	*L;
     64  1.5.8.2.6.1  msaitoh 	SIMPLEQ_HEAD(, lua_handler)	handlers;
     65  1.5.8.2.6.1  msaitoh 	SIMPLEQ_ENTRY(lua_state_map)	s_next;
     66  1.5.8.2.6.1  msaitoh } lua_state_map_t;
     67  1.5.8.2.6.1  msaitoh #endif
     68          1.1      tls 
     69  1.5.8.2.6.1  msaitoh typedef struct bozo_content_map_t {
     70  1.5.8.2.6.1  msaitoh 	const char	*name;		/* postfix of file */
     71  1.5.8.2.6.1  msaitoh 	size_t	 	 namelen;	/* length of postfix */
     72  1.5.8.2.6.1  msaitoh 	const char	*type;		/* matching content-type */
     73  1.5.8.2.6.1  msaitoh 	const char	*encoding;	/* matching content-encoding */
     74  1.5.8.2.6.1  msaitoh 	const char	*encoding11;	/* matching content-encoding (HTTP/1.1) */
     75  1.5.8.2.6.1  msaitoh 	const char	*cgihandler;	/* optional CGI handler */
     76  1.5.8.2.6.1  msaitoh } bozo_content_map_t;
     77  1.5.8.2.6.1  msaitoh 
     78  1.5.8.2.6.1  msaitoh /* this struct holds the bozo constants */
     79  1.5.8.2.6.1  msaitoh typedef struct bozo_consts_t {
     80  1.5.8.2.6.1  msaitoh 	const char	*http_09;	/* "HTTP/0.9" */
     81  1.5.8.2.6.1  msaitoh 	const char	*http_10;	/* "HTTP/1.0" */
     82  1.5.8.2.6.1  msaitoh 	const char	*http_11;	/* "HTTP/1.1" */
     83  1.5.8.2.6.1  msaitoh 	const char	*text_plain;	/* "text/plain" */
     84  1.5.8.2.6.1  msaitoh } bozo_consts_t;
     85  1.5.8.2.6.1  msaitoh 
     86  1.5.8.2.6.1  msaitoh /* this structure encapsulates all the bozo flags and control vars */
     87  1.5.8.2.6.1  msaitoh typedef struct bozohttpd_t {
     88  1.5.8.2.6.1  msaitoh 	char		*rootdir;	/* root directory */
     89  1.5.8.2.6.1  msaitoh 	char		*username;	/* username to switch to */
     90  1.5.8.2.6.1  msaitoh 	int		 numeric;	/* avoid gethostby*() */
     91  1.5.8.2.6.1  msaitoh 	char		*virtbase;	/* virtual directory base */
     92  1.5.8.2.6.1  msaitoh 	int		 unknown_slash;	/* unknown vhosts go to normal slashdir */
     93  1.5.8.2.6.1  msaitoh 	int		 untrustedref;	/* make sure referrer = me unless url = / */
     94  1.5.8.2.6.1  msaitoh 	int		 logstderr;	/* log to stderr (even if not tty) */
     95  1.5.8.2.6.1  msaitoh 	int		 background;	/* drop into daemon mode */
     96  1.5.8.2.6.1  msaitoh 	int		 foreground;	/* keep daemon mode in foreground */
     97  1.5.8.2.6.1  msaitoh 	char		*pidfile;	/* path to the pid file, if any */
     98  1.5.8.2.6.1  msaitoh 	size_t		 page_size;	/* page size */
     99  1.5.8.2.6.1  msaitoh 	char		*slashdir;	/* www slash directory */
    100  1.5.8.2.6.1  msaitoh 	char		*bindport;	/* bind port; default "http" */
    101  1.5.8.2.6.1  msaitoh 	char		*bindaddress;	/* address for binding - INADDR_ANY */
    102  1.5.8.2.6.1  msaitoh 	int		 debug;		/* debugging level */
    103  1.5.8.2.6.1  msaitoh 	char		*virthostname;	/* my name */
    104  1.5.8.2.6.1  msaitoh 	const char	*server_software;/* our brand :-) */
    105  1.5.8.2.6.1  msaitoh 	const char	*index_html;	/* our home page */
    106  1.5.8.2.6.1  msaitoh 	const char	*public_html;	/* ~user/public_html page */
    107  1.5.8.2.6.1  msaitoh 	int		 enable_users;	/* enable public_html */
    108  1.5.8.2.6.1  msaitoh 	int		*sock;		/* bound sockets */
    109  1.5.8.2.6.1  msaitoh 	int		 nsock;		/* number of above */
    110  1.5.8.2.6.1  msaitoh 	struct pollfd	*fds;		/* current poll fd set */
    111  1.5.8.2.6.1  msaitoh 	int		 request_times;	/* # times a request was processed */
    112  1.5.8.2.6.1  msaitoh 	int		 dir_indexing;	/* handle directories */
    113  1.5.8.2.6.1  msaitoh 	int		 hide_dots;	/* hide .* */
    114  1.5.8.2.6.1  msaitoh 	int		 process_cgi;	/* use the cgi handler */
    115  1.5.8.2.6.1  msaitoh 	char		*cgibin;	/* cgi-bin directory */
    116  1.5.8.2.6.1  msaitoh #ifndef NO_LUA_SUPPORT
    117  1.5.8.2.6.1  msaitoh 	int		 process_lua;	/* use the Lua handler */
    118  1.5.8.2.6.1  msaitoh 	SIMPLEQ_HEAD(, lua_state_map)	lua_states;
    119  1.5.8.2.6.1  msaitoh #endif
    120  1.5.8.2.6.1  msaitoh 	void		*sslinfo;	/* pointer to ssl struct */
    121  1.5.8.2.6.1  msaitoh 	int		dynamic_content_map_size;/* size of dyn cont map */
    122  1.5.8.2.6.1  msaitoh 	bozo_content_map_t	*dynamic_content_map;/* dynamic content map */
    123  1.5.8.2.6.1  msaitoh 	size_t		 mmapsz;	/* size of region to mmap */
    124  1.5.8.2.6.1  msaitoh 	char		*getln_buffer;	/* space for getln buffer */
    125  1.5.8.2.6.1  msaitoh 	ssize_t		 getln_buflen;	/* length of allocated space */
    126  1.5.8.2.6.1  msaitoh 	char		*errorbuf;	/* no dynamic allocation allowed */
    127  1.5.8.2.6.1  msaitoh 	bozo_consts_t	 consts;	/* various constants */
    128  1.5.8.2.6.1  msaitoh } bozohttpd_t;
    129  1.5.8.2.6.1  msaitoh 
    130  1.5.8.2.6.1  msaitoh /* bozo_httpreq_t */
    131  1.5.8.2.6.1  msaitoh typedef struct bozo_httpreq_t {
    132  1.5.8.2.6.1  msaitoh 	bozohttpd_t	*hr_httpd;
    133  1.5.8.2.6.1  msaitoh 	int		hr_method;
    134          1.1      tls #define	HTTP_GET	0x01
    135          1.1      tls #define HTTP_POST	0x02
    136          1.1      tls #define HTTP_HEAD	0x03
    137          1.1      tls #define HTTP_OPTIONS	0x04	/* not supported */
    138          1.1      tls #define HTTP_PUT	0x05	/* not supported */
    139          1.1      tls #define HTTP_DELETE	0x06	/* not supported */
    140          1.1      tls #define HTTP_TRACE	0x07	/* not supported */
    141          1.1      tls #define HTTP_CONNECT	0x08	/* not supported */
    142          1.1      tls 	const char *hr_methodstr;
    143  1.5.8.2.6.1  msaitoh 	char	*hr_virthostname;	/* server name (if not identical
    144  1.5.8.2.6.1  msaitoh 					   to hr_httpd->virthostname) */
    145  1.5.8.2.6.1  msaitoh 	char	*hr_file;
    146  1.5.8.2.6.1  msaitoh 	char	*hr_oldfile;	/* if we added an index_html */
    147  1.5.8.2.6.1  msaitoh 	char	*hr_query;
    148  1.5.8.2.6.1  msaitoh 	char	*hr_host;	/* HTTP/1.1 Host: or virtual hostname,
    149  1.5.8.2.6.1  msaitoh 				   possibly including a port number */
    150          1.1      tls 	const char *hr_proto;
    151          1.1      tls 	const char *hr_content_type;
    152          1.1      tls 	const char *hr_content_length;
    153          1.1      tls 	const char *hr_allow;
    154          1.1      tls 	const char *hr_referrer;
    155          1.5      mrg 	const char *hr_range;
    156      1.5.8.2      snj 	const char *hr_if_modified_since;
    157  1.5.8.2.6.1  msaitoh 	const char *hr_accept_encoding;
    158          1.5      mrg 	int         hr_have_range;
    159          1.5      mrg 	off_t       hr_first_byte_pos;
    160          1.5      mrg 	off_t       hr_last_byte_pos;
    161  1.5.8.2.6.1  msaitoh 	/*const*/ char *hr_remotehost;
    162  1.5.8.2.6.1  msaitoh 	/*const*/ char *hr_remoteaddr;
    163  1.5.8.2.6.1  msaitoh 	/*const*/ char *hr_serverport;
    164          1.1      tls #ifdef DO_HTPASSWD
    165  1.5.8.2.6.1  msaitoh 	/*const*/ char *hr_authrealm;
    166  1.5.8.2.6.1  msaitoh 	/*const*/ char *hr_authuser;
    167  1.5.8.2.6.1  msaitoh 	/*const*/ char *hr_authpass;
    168          1.1      tls #endif
    169  1.5.8.2.6.1  msaitoh 	SIMPLEQ_HEAD(, bozoheaders)	hr_headers;
    170          1.1      tls 	int	hr_nheaders;
    171  1.5.8.2.6.1  msaitoh } bozo_httpreq_t;
    172          1.1      tls 
    173  1.5.8.2.6.1  msaitoh /* helper to access the "active" host name from a httpd/request pair */
    174  1.5.8.2.6.1  msaitoh #define	BOZOHOST(HTTPD,REQUEST)	((REQUEST)->hr_virthostname ?		\
    175  1.5.8.2.6.1  msaitoh 					(REQUEST)->hr_virthostname :	\
    176  1.5.8.2.6.1  msaitoh 					(HTTPD)->virthostname)
    177  1.5.8.2.6.1  msaitoh 
    178  1.5.8.2.6.1  msaitoh /* structure to hold string based (name, value) pairs with preferences */
    179  1.5.8.2.6.1  msaitoh typedef struct bozoprefs_t {
    180  1.5.8.2.6.1  msaitoh 	unsigned	  size;		/* size of the two arrays */
    181  1.5.8.2.6.1  msaitoh 	unsigned	  c;		/* # of entries in arrays */
    182  1.5.8.2.6.1  msaitoh 	char		**name;		/* names of each entry */
    183  1.5.8.2.6.1  msaitoh 	char		**value;	/* values for the name entries */
    184  1.5.8.2.6.1  msaitoh } bozoprefs_t;
    185  1.5.8.2.6.1  msaitoh 
    186  1.5.8.2.6.1  msaitoh /* by default write in upto 64KiB chunks, and mmap in upto 64MiB chunks */
    187  1.5.8.2.6.1  msaitoh #ifndef BOZO_WRSZ
    188  1.5.8.2.6.1  msaitoh #define BOZO_WRSZ	(64 * 1024)
    189  1.5.8.2.6.1  msaitoh #endif
    190  1.5.8.2.6.1  msaitoh #ifndef BOZO_MMAPSZ
    191  1.5.8.2.6.1  msaitoh #define BOZO_MMAPSZ	(BOZO_WRSZ * 1024)
    192  1.5.8.2.6.1  msaitoh #endif
    193          1.1      tls 
    194          1.1      tls /* debug flags */
    195          1.1      tls #define DEBUG_NORMAL	1
    196          1.1      tls #define DEBUG_FAT	2
    197          1.1      tls #define DEBUG_OBESE	3
    198          1.1      tls #define DEBUG_EXPLODING	4
    199          1.1      tls 
    200          1.1      tls #define	strornull(x)	((x) ? (x) : "<null>")
    201          1.1      tls 
    202  1.5.8.2.6.1  msaitoh #if defined(__GNUC__) && __GNUC__ >= 3
    203  1.5.8.2.6.1  msaitoh #define BOZO_PRINTFLIKE(x,y) __attribute__((__format__(__printf__, x,y)))
    204  1.5.8.2.6.1  msaitoh #define BOZO_DEAD __attribute__((__noreturn__))
    205  1.5.8.2.6.1  msaitoh #endif
    206  1.5.8.2.6.1  msaitoh 
    207  1.5.8.2.6.1  msaitoh #ifndef NO_DEBUG
    208  1.5.8.2.6.1  msaitoh void	debug__(bozohttpd_t *, int, const char *, ...) BOZO_PRINTFLIKE(3, 4);
    209          1.1      tls #define debug(x)	debug__ x
    210          1.1      tls #else
    211  1.5.8.2.6.1  msaitoh #define	debug(x)
    212  1.5.8.2.6.1  msaitoh #endif /* NO_DEBUG */
    213          1.1      tls 
    214  1.5.8.2.6.1  msaitoh void	bozo_warn(bozohttpd_t *, const char *, ...)
    215  1.5.8.2.6.1  msaitoh 		BOZO_PRINTFLIKE(2, 3);
    216  1.5.8.2.6.1  msaitoh void	bozo_err(bozohttpd_t *, int, const char *, ...)
    217  1.5.8.2.6.1  msaitoh 		BOZO_PRINTFLIKE(3, 4)
    218  1.5.8.2.6.1  msaitoh 		BOZO_DEAD;
    219  1.5.8.2.6.1  msaitoh int	bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *);
    220  1.5.8.2.6.1  msaitoh 
    221  1.5.8.2.6.1  msaitoh int	bozo_check_special_files(bozo_httpreq_t *, const char *);
    222  1.5.8.2.6.1  msaitoh char	*bozo_http_date(char *, size_t);
    223  1.5.8.2.6.1  msaitoh void	bozo_print_header(bozo_httpreq_t *, struct stat *, const char *, const char *);
    224  1.5.8.2.6.1  msaitoh char	*bozo_escape_rfc3986(bozohttpd_t *httpd, const char *url);
    225  1.5.8.2.6.1  msaitoh char	*bozo_escape_html(bozohttpd_t *httpd, const char *url);
    226          1.1      tls 
    227  1.5.8.2.6.1  msaitoh char	*bozodgetln(bozohttpd_t *, int, ssize_t *, ssize_t (*)(bozohttpd_t *, int, void *, size_t));
    228          1.5      mrg char	*bozostrnsep(char **, const char *, ssize_t *);
    229          1.1      tls 
    230  1.5.8.2.6.1  msaitoh void	*bozomalloc(bozohttpd_t *, size_t);
    231  1.5.8.2.6.1  msaitoh void	*bozorealloc(bozohttpd_t *, void *, size_t);
    232  1.5.8.2.6.1  msaitoh char	*bozostrdup(bozohttpd_t *, const char *);
    233          1.1      tls 
    234          1.1      tls /* ssl-bozo.c */
    235  1.5.8.2.6.1  msaitoh #ifdef NO_SSL_SUPPORT
    236  1.5.8.2.6.1  msaitoh #define bozo_ssl_set_opts(w, x, y)	do { /* nothing */ } while (0)
    237  1.5.8.2.6.1  msaitoh #define bozo_ssl_init(x)		do { /* nothing */ } while (0)
    238  1.5.8.2.6.1  msaitoh #define bozo_ssl_accept(x)		do { /* nothing */ } while (0)
    239  1.5.8.2.6.1  msaitoh #define bozo_ssl_destroy(x)		do { /* nothing */ } while (0)
    240  1.5.8.2.6.1  msaitoh #else
    241  1.5.8.2.6.1  msaitoh void	bozo_ssl_set_opts(bozohttpd_t *, const char *, const char *);
    242  1.5.8.2.6.1  msaitoh void	bozo_ssl_init(bozohttpd_t *);
    243  1.5.8.2.6.1  msaitoh void	bozo_ssl_accept(bozohttpd_t *);
    244  1.5.8.2.6.1  msaitoh void	bozo_ssl_destroy(bozohttpd_t *);
    245          1.1      tls #endif
    246          1.1      tls 
    247          1.1      tls 
    248          1.1      tls /* auth-bozo.c */
    249          1.1      tls #ifdef DO_HTPASSWD
    250  1.5.8.2.6.1  msaitoh int	bozo_auth_check(bozo_httpreq_t *, const char *);
    251  1.5.8.2.6.1  msaitoh void	bozo_auth_cleanup(bozo_httpreq_t *);
    252  1.5.8.2.6.1  msaitoh int	bozo_auth_check_headers(bozo_httpreq_t *, char *, char *, ssize_t);
    253  1.5.8.2.6.1  msaitoh int	bozo_auth_check_special_files(bozo_httpreq_t *, const char *);
    254  1.5.8.2.6.1  msaitoh void	bozo_auth_check_401(bozo_httpreq_t *, int);
    255  1.5.8.2.6.1  msaitoh void	bozo_auth_cgi_setenv(bozo_httpreq_t *, char ***);
    256  1.5.8.2.6.1  msaitoh int	bozo_auth_cgi_count(bozo_httpreq_t *);
    257  1.5.8.2.6.1  msaitoh #else
    258  1.5.8.2.6.1  msaitoh #define	bozo_auth_check(x, y)			0
    259  1.5.8.2.6.1  msaitoh #define	bozo_auth_cleanup(x)			do { /* nothing */ } while (0)
    260  1.5.8.2.6.1  msaitoh #define	bozo_auth_check_headers(y, z, a, b)	0
    261  1.5.8.2.6.1  msaitoh #define	bozo_auth_check_special_files(x, y)	0
    262  1.5.8.2.6.1  msaitoh #define	bozo_auth_check_401(x, y)		do { /* nothing */ } while (0)
    263  1.5.8.2.6.1  msaitoh #define	bozo_auth_cgi_setenv(x, y)		do { /* nothing */ } while (0)
    264  1.5.8.2.6.1  msaitoh #define	bozo_auth_cgi_count(x)			0
    265          1.1      tls #endif /* DO_HTPASSWD */
    266          1.1      tls 
    267          1.1      tls 
    268          1.1      tls /* cgi-bozo.c */
    269  1.5.8.2.6.1  msaitoh #ifdef NO_CGIBIN_SUPPORT
    270  1.5.8.2.6.1  msaitoh #define	bozo_process_cgi(h)				0
    271          1.1      tls #else
    272  1.5.8.2.6.1  msaitoh void	bozo_cgi_setbin(bozohttpd_t *, const char *);
    273  1.5.8.2.6.1  msaitoh void	bozo_setenv(bozohttpd_t *, const char *, const char *, char **);
    274  1.5.8.2.6.1  msaitoh int	bozo_process_cgi(bozo_httpreq_t *);
    275  1.5.8.2.6.1  msaitoh void	bozo_add_content_map_cgi(bozohttpd_t *, const char *, const char *);
    276          1.1      tls #endif /* NO_CGIBIN_SUPPORT */
    277          1.1      tls 
    278          1.1      tls 
    279  1.5.8.2.6.1  msaitoh /* lua-bozo.c */
    280  1.5.8.2.6.1  msaitoh #ifdef NO_LUA_SUPPORT
    281  1.5.8.2.6.1  msaitoh #define bozo_process_lua(h)				0
    282  1.5.8.2.6.1  msaitoh #else
    283  1.5.8.2.6.1  msaitoh void	bozo_add_lua_map(bozohttpd_t *, const char *, const char *);
    284  1.5.8.2.6.1  msaitoh int	bozo_process_lua(bozo_httpreq_t *);
    285  1.5.8.2.6.1  msaitoh #endif /* NO_LUA_SUPPORT */
    286  1.5.8.2.6.1  msaitoh 
    287          1.1      tls 
    288  1.5.8.2.6.1  msaitoh /* daemon-bozo.c */
    289  1.5.8.2.6.1  msaitoh #ifdef NO_DAEMON_MODE
    290  1.5.8.2.6.1  msaitoh #define bozo_daemon_init(x)				do { /* nothing */ } while (0)
    291  1.5.8.2.6.1  msaitoh #define bozo_daemon_fork(x)				0
    292  1.5.8.2.6.1  msaitoh #define bozo_daemon_closefds(x)				do { /* nothing */ } while (0)
    293          1.1      tls #else
    294  1.5.8.2.6.1  msaitoh void	bozo_daemon_init(bozohttpd_t *);
    295  1.5.8.2.6.1  msaitoh int	bozo_daemon_fork(bozohttpd_t *);
    296  1.5.8.2.6.1  msaitoh void	bozo_daemon_closefds(bozohttpd_t *);
    297          1.1      tls #endif /* NO_DAEMON_MODE */
    298          1.1      tls 
    299          1.1      tls 
    300          1.1      tls /* tilde-luzah-bozo.c */
    301  1.5.8.2.6.1  msaitoh #ifdef NO_USER_SUPPORT
    302  1.5.8.2.6.1  msaitoh #define bozo_user_transform(a, c)			0
    303  1.5.8.2.6.1  msaitoh #else
    304  1.5.8.2.6.1  msaitoh int	bozo_user_transform(bozo_httpreq_t *, int *);
    305          1.1      tls #endif /* NO_USER_SUPPORT */
    306          1.1      tls 
    307          1.1      tls 
    308          1.1      tls /* dir-index-bozo.c */
    309  1.5.8.2.6.1  msaitoh #ifdef NO_DIRINDEX_SUPPORT
    310  1.5.8.2.6.1  msaitoh #define bozo_dir_index(a, b, c)				0
    311          1.1      tls #else
    312  1.5.8.2.6.1  msaitoh int	bozo_dir_index(bozo_httpreq_t *, const char *, int);
    313          1.1      tls #endif /* NO_DIRINDEX_SUPPORT */
    314          1.1      tls 
    315          1.1      tls 
    316          1.1      tls /* content-bozo.c */
    317  1.5.8.2.6.1  msaitoh const char *bozo_content_type(bozo_httpreq_t *, const char *);
    318  1.5.8.2.6.1  msaitoh const char *bozo_content_encoding(bozo_httpreq_t *, const char *);
    319  1.5.8.2.6.1  msaitoh bozo_content_map_t *bozo_match_content_map(bozohttpd_t *, const char *, int);
    320  1.5.8.2.6.1  msaitoh bozo_content_map_t *bozo_get_content_map(bozohttpd_t *, const char *);
    321          1.1      tls #ifndef NO_DYNAMIC_CONTENT
    322  1.5.8.2.6.1  msaitoh void	bozo_add_content_map_mime(bozohttpd_t *, const char *, const char *, const char *, const char *);
    323          1.1      tls #endif
    324  1.5.8.2.6.1  msaitoh 
    325  1.5.8.2.6.1  msaitoh /* I/O */
    326  1.5.8.2.6.1  msaitoh int bozo_printf(bozohttpd_t *, const char *, ...) BOZO_PRINTFLIKE(2, 3);;
    327  1.5.8.2.6.1  msaitoh ssize_t bozo_read(bozohttpd_t *, int, void *, size_t);
    328  1.5.8.2.6.1  msaitoh ssize_t bozo_write(bozohttpd_t *, int, const void *, size_t);
    329  1.5.8.2.6.1  msaitoh int bozo_flush(bozohttpd_t *, FILE *);
    330  1.5.8.2.6.1  msaitoh 
    331  1.5.8.2.6.1  msaitoh /* misc */
    332  1.5.8.2.6.1  msaitoh int bozo_init_httpd(bozohttpd_t *);
    333  1.5.8.2.6.1  msaitoh int bozo_init_prefs(bozoprefs_t *);
    334  1.5.8.2.6.1  msaitoh int bozo_set_defaults(bozohttpd_t *, bozoprefs_t *);
    335  1.5.8.2.6.1  msaitoh int bozo_setup(bozohttpd_t *, bozoprefs_t *, const char *, const char *);
    336  1.5.8.2.6.1  msaitoh bozo_httpreq_t *bozo_read_request(bozohttpd_t *);
    337  1.5.8.2.6.1  msaitoh void bozo_process_request(bozo_httpreq_t *);
    338  1.5.8.2.6.1  msaitoh void bozo_clean_request(bozo_httpreq_t *);
    339  1.5.8.2.6.1  msaitoh 
    340  1.5.8.2.6.1  msaitoh /* variables */
    341  1.5.8.2.6.1  msaitoh int bozo_set_pref(bozoprefs_t *, const char *, const char *);
    342  1.5.8.2.6.1  msaitoh char *bozo_get_pref(bozoprefs_t *, const char *);
    343  1.5.8.2.6.1  msaitoh 
    344  1.5.8.2.6.1  msaitoh #endif	/* BOZOHTTOPD_H_ */
    345