]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/journal-remote/microhttpd-util.h
tree-wide: beautify remaining copyright statements
[thirdparty/systemd.git] / src / journal-remote / microhttpd-util.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
0ef6f454
LP
2#pragma once
3
e64690a8 4/***
96b2fb93 5 Copyright © 2012 Zbigniew Jędrzejewski-Szmek
e64690a8
ZJS
6***/
7
f12be7e8 8#include <microhttpd.h>
71d35b6b 9#include <stdarg.h>
e64690a8 10
b1e2b33c
CR
11#include "macro.h"
12
e2e8683e
YW
13/* Those defines are added when options are renamed. If the old names
14 * are not '#define'd, then they are not deprecated yet and there are
15 * enum elements with the same name. Hence let's check for the *old* name,
16 * and define the new name by the value of the old name. */
21b6ff36 17
58eb2798
ZJS
18/* Renamed in µhttpd 0.9.51 */
19#ifndef MHD_USE_PIPE_FOR_SHUTDOWN
20# define MHD_USE_ITC MHD_USE_PIPE_FOR_SHUTDOWN
21#endif
22
21b6ff36
ZJS
23/* Renamed in µhttpd 0.9.52 */
24#ifndef MHD_USE_EPOLL_LINUX_ONLY
25# define MHD_USE_EPOLL MHD_USE_EPOLL_LINUX_ONLY
26#endif
27
c831aa75
YW
28/* Renamed in µhttpd 0.9.52 */
29#ifndef MHD_USE_SSL
30# define MHD_USE_TLS MHD_USE_SSL
31#endif
32
315629a8
YW
33/* Renamed in µhttpd 0.9.53 */
34#ifndef MHD_USE_POLL_INTERNALLY
35# define MHD_USE_POLL_INTERNAL_THREAD MHD_USE_POLL_INTERNALLY
36#endif
37
58eb2798
ZJS
38/* Both the old and new names are defines, check for the new one. */
39
e2e8683e
YW
40/* Compatiblity with libmicrohttpd < 0.9.38 */
41#ifndef MHD_HTTP_NOT_ACCEPTABLE
42# define MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE
43#endif
44
58eb2798
ZJS
45/* Renamed in µhttpd 0.9.53 */
46#ifndef MHD_HTTP_PAYLOAD_TOO_LARGE
47# define MHD_HTTP_PAYLOAD_TOO_LARGE MHD_HTTP_REQUEST_ENTITY_TOO_LARGE
ce7229a2
ZJS
48#endif
49
b3b0c23a 50#if MHD_VERSION < 0x00094203
21b6ff36 51# define MHD_create_response_from_fd_at_offset64 MHD_create_response_from_fd_at_offset
b3b0c23a
ZJS
52#endif
53
44b601bc 54void microhttpd_logger(void *arg, const char *fmt, va_list ap) _printf_(2, 0);
cafc7f91 55
f12be7e8 56/* respond_oom() must be usable with return, hence this form. */
e7216d11
ZJS
57#define respond_oom(connection) log_oom(), mhd_respond_oom(connection)
58
59int mhd_respondf(struct MHD_Connection *connection,
1b4cd646 60 int error,
e7216d11 61 unsigned code,
1b4cd646 62 const char *format, ...) _printf_(4,5);
e7216d11
ZJS
63
64int mhd_respond(struct MHD_Connection *connection,
65 unsigned code,
66 const char *message);
f12be7e8 67
e7216d11 68int mhd_respond_oom(struct MHD_Connection *connection);
cafc7f91 69
8201af08 70int check_permissions(struct MHD_Connection *connection, int *code, char **hostname);
f12be7e8 71
d357562c
ZJS
72/* Set gnutls internal logging function to a callback which uses our
73 * own logging framework.
74 *
75 * gnutls categories are additionally filtered by our internal log
76 * level, so it should be set fairly high to capture all potentially
77 * interesting events without overwhelming detail.
cafc7f91 78 */
d357562c 79int setup_gnutls_logger(char **categories);