xref: /netbsd/external/bsd/ntp/dist/lib/isc/include/isc/httpd.h (revision 6550d01e)
1 /*	$NetBSD: httpd.h,v 1.1.1.1 2009/12/13 16:54:24 kardel Exp $	*/
2 
3 /*
4  * Copyright (C) 2006-2008  Internet Systems Consortium, Inc. ("ISC")
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /* Id: httpd.h,v 1.9 2008/08/08 05:06:49 marka Exp */
20 
21 #ifndef ISC_HTTPD_H
22 #define ISC_HTTPD_H 1
23 
24 /*! \file */
25 
26 #include <isc/event.h>
27 #include <isc/eventclass.h>
28 #include <isc/types.h>
29 #include <isc/mutex.h>
30 #include <isc/task.h>
31 
32 #define HTTPD_EVENTCLASS		ISC_EVENTCLASS(4300)
33 #define HTTPD_SHUTDOWN			(HTTPD_EVENTCLASS + 0x0001)
34 
35 #define ISC_HTTPDMGR_FLAGSHUTTINGDOWN	0x00000001
36 
37 /*
38  * Create a new http daemon which will send, once every time period,
39  * a http-like header followed by HTTP data.
40  */
41 isc_result_t
42 isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
43 		    isc_httpdclientok_t *client_ok,
44 		    isc_httpdondestroy_t *ondestory, void *cb_arg,
45 		    isc_timermgr_t *tmgr, isc_httpdmgr_t **httpdp);
46 
47 void
48 isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdp);
49 
50 isc_result_t
51 isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url,
52 		    isc_httpdaction_t *func, void *arg);
53 
54 isc_result_t
55 isc_httpd_response(isc_httpd_t *httpd);
56 
57 isc_result_t
58 isc_httpd_addheader(isc_httpd_t *httpd, const char *name,
59 		    const char *val);
60 
61 isc_result_t
62 isc_httpd_addheaderuint(isc_httpd_t *httpd, const char *name, int val);
63 
64 isc_result_t isc_httpd_endheaders(isc_httpd_t *httpd);
65 
66 #endif /* ISC_HTTPD_H */
67