]>
Commit | Line | Data |
---|---|---|
e64690a8 ZJS |
1 | /*** |
2 | This file is part of systemd. | |
3 | ||
4 | Copyright 2012 Zbigniew Jędrzejewski-Szmek | |
5 | ||
6 | systemd is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU Lesser General Public License as published by | |
8 | the Free Software Foundation; either version 2.1 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | systemd is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public License | |
17 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
18 | ***/ | |
19 | ||
20 | #pragma once | |
21 | ||
f12be7e8 | 22 | #include <microhttpd.h> |
71d35b6b | 23 | #include <stdarg.h> |
e64690a8 | 24 | |
b1e2b33c CR |
25 | #include "macro.h" |
26 | ||
ce7229a2 ZJS |
27 | /* Compatiblity with libmicrohttpd < 0.9.38 */ |
28 | #ifndef MHD_HTTP_NOT_ACCEPTABLE | |
29 | #define MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE | |
30 | #endif | |
31 | ||
b3b0c23a ZJS |
32 | #if MHD_VERSION < 0x00094203 |
33 | #define MHD_create_response_from_fd_at_offset64 MHD_create_response_from_fd_at_offset | |
34 | #endif | |
35 | ||
44b601bc | 36 | void microhttpd_logger(void *arg, const char *fmt, va_list ap) _printf_(2, 0); |
cafc7f91 | 37 | |
f12be7e8 | 38 | /* respond_oom() must be usable with return, hence this form. */ |
e7216d11 ZJS |
39 | #define respond_oom(connection) log_oom(), mhd_respond_oom(connection) |
40 | ||
41 | int mhd_respondf(struct MHD_Connection *connection, | |
42 | unsigned code, | |
43 | const char *format, ...) _printf_(3,4); | |
44 | ||
45 | int mhd_respond(struct MHD_Connection *connection, | |
46 | unsigned code, | |
47 | const char *message); | |
f12be7e8 | 48 | |
e7216d11 | 49 | int mhd_respond_oom(struct MHD_Connection *connection); |
cafc7f91 | 50 | |
8201af08 | 51 | int check_permissions(struct MHD_Connection *connection, int *code, char **hostname); |
f12be7e8 | 52 | |
d357562c ZJS |
53 | /* Set gnutls internal logging function to a callback which uses our |
54 | * own logging framework. | |
55 | * | |
56 | * gnutls categories are additionally filtered by our internal log | |
57 | * level, so it should be set fairly high to capture all potentially | |
58 | * interesting events without overwhelming detail. | |
cafc7f91 | 59 | */ |
d357562c | 60 | int setup_gnutls_logger(char **categories); |