xref: /netbsd-src/external/mpl/bind/dist/lib/isc/include/isc/httpd.h (revision bcda20f65a8566e103791ec395f7f499ef322704)
1 /*	$NetBSD: httpd.h,v 1.8 2025/01/26 16:25:41 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 #pragma once
17 
18 /*! \file */
19 
20 #include <stdbool.h>
21 
22 #include <isc/mutex.h>
23 #include <isc/time.h>
24 #include <isc/types.h>
25 #include <isc/url.h>
26 
27 #define HTTPD_EVENTCLASS ISC_EVENTCLASS(4300)
28 #define HTTPD_SHUTDOWN	 (HTTPD_EVENTCLASS + 0x0001)
29 
30 #define ISC_HTTPDMGR_SHUTTINGDOWN 0x00000001
31 
32 typedef isc_result_t(isc_httpdaction_t)(
33 	const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo, void *arg,
34 	unsigned int *retcode, const char **retmsg, const char **mimetype,
35 	isc_buffer_t *body, isc_httpdfree_t **freecb, void **freecb_args);
36 
37 typedef bool(isc_httpdclientok_t)(const isc_sockaddr_t *, void *);
38 
39 isc_result_t
40 isc_httpdmgr_create(isc_nm_t *nm, isc_mem_t *mctx, isc_sockaddr_t *addr,
41 		    isc_httpdclientok_t	 *client_ok,
42 		    isc_httpdondestroy_t *ondestroy, void *cb_arg,
43 		    isc_httpdmgr_t **httpdmgrp);
44 
45 void
46 isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdp);
47 
48 isc_result_t
49 isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url, bool isstatic,
50 		    isc_httpdaction_t *func, void *arg);
51 
52 void
53 isc_httpd_setfinishhook(void (*fn)(void));
54 
55 bool
56 isc_httpdurl_isstatic(const isc_httpdurl_t *url);
57 
58 const isc_time_t *
59 isc_httpdurl_loadtime(const isc_httpdurl_t *url);
60 
61 const isc_time_t *
62 isc_httpd_if_modified_since(const isc_httpd_t *httpd);
63