From 1d18e14e60bafe755fe1ff69dc269fb5bf9a8f87 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Mon, 13 Jan 2025 11:36:34 +0100 Subject: [PATCH] Renamed some configuration macros for clarity and consistency --- configure.ac | 42 ++--- doc/examples/Makefile.am | 2 +- src/incl_priv/mhd_sys_options.h | 6 +- src/mhd2/Makefile.am | 8 +- src/mhd2/action.c | 12 +- src/mhd2/conn_data_send.c | 12 +- src/mhd2/daemon_add_conn.c | 28 ++-- src/mhd2/daemon_funcs.c | 8 +- src/mhd2/daemon_funcs.h | 6 +- src/mhd2/daemon_get_info.c | 2 +- src/mhd2/daemon_logger.c | 4 +- src/mhd2/daemon_logger.h | 6 +- src/mhd2/daemon_logger_default.c | 4 +- src/mhd2/daemon_logger_default.h | 4 +- src/mhd2/daemon_start.c | 260 +++++++++++++++--------------- src/mhd2/events_process.c | 78 ++++----- src/mhd2/lib_get_info.c | 16 +- src/mhd2/mhd_action.h | 34 ++-- src/mhd2/mhd_atomic_counter.h | 6 +- src/mhd2/mhd_connection.h | 24 +-- src/mhd2/mhd_daemon.h | 60 +++---- src/mhd2/mhd_lib_init.c | 4 +- src/mhd2/mhd_locks.h | 6 +- src/mhd2/mhd_panic.c | 4 +- src/mhd2/mhd_panic.h | 2 +- src/mhd2/mhd_reply.h | 4 +- src/mhd2/mhd_request.h | 14 +- src/mhd2/mhd_response.h | 8 +- src/mhd2/mhd_send.c | 4 +- src/mhd2/mhd_send.h | 2 +- src/mhd2/mhd_str.c | 4 +- src/mhd2/mhd_str.h | 4 +- src/mhd2/mhd_threads.c | 14 +- src/mhd2/mhd_threads.h | 18 +-- src/mhd2/mhd_tls_choice.h | 12 +- src/mhd2/mhd_tls_funcs.c | 8 +- src/mhd2/mhd_tls_funcs.h | 4 +- src/mhd2/request_get_value.c | 12 +- src/mhd2/respond_with_error.h | 2 +- src/mhd2/response_from.c | 4 +- src/mhd2/stream_funcs.c | 26 +-- src/mhd2/stream_funcs.h | 14 +- src/mhd2/stream_process_reply.c | 28 ++-- src/mhd2/stream_process_request.c | 40 ++--- src/mhd2/stream_process_states.c | 28 ++-- src/mhd2/sys_poll.h | 4 +- src/mhd2/sys_select.h | 4 +- src/mhd2/sys_sendfile.h | 4 +- src/mhd2/tls_gnu_conn_data.h | 2 +- src/mhd2/tls_gnu_daemon_data.h | 2 +- src/mhd2/tls_gnu_funcs.h | 2 +- src/mhd2/tls_gnu_tls_lib.h | 2 +- src/mhd2/tls_multi_conn_data.h | 8 +- src/mhd2/tls_multi_daemon_data.h | 8 +- src/mhd2/tls_multi_funcs.c | 160 +++++++++--------- src/mhd2/tls_multi_tls_lib.h | 4 +- src/mhd2/tls_open_conn_data.h | 2 +- src/mhd2/tls_open_daemon_data.h | 2 +- src/mhd2/tls_open_funcs.c | 2 +- src/mhd2/tls_open_funcs.h | 2 +- src/mhd2/tls_open_tls_lib.h | 2 +- src/mhd2/upgraded_net.c | 41 ++--- src/microhttpd/Makefile.am | 8 +- src/testcurl/Makefile.am | 4 +- src/testcurl/https/Makefile.am | 2 +- src/tests/Makefile.am | 2 +- src/tests/basic/Makefile.am | 14 +- src/tools/Makefile.am | 2 +- 68 files changed, 586 insertions(+), 585 deletions(-) diff --git a/configure.ac b/configure.ac index ead48cc8..1d137150 100644 --- a/configure.ac +++ b/configure.ac @@ -1746,7 +1746,7 @@ AS_IF([test "x$USE_THREADS" = "xposix"], [AC_DEFINE([mhd_THREADS_KIND_W32],[1],[define to use W32 threads])])]) AM_CONDITIONAL([USE_POSIX_THREADS], [test "x$USE_THREADS" = "xposix"]) AM_CONDITIONAL([USE_W32_THREADS], [test "x$USE_THREADS" = "xw32"]) -AM_CONDITIONAL([MHD_USE_THREADS], [test "x$USE_THREADS" != "xnone"]) +AM_CONDITIONAL([MHD_SUPPORT_THREADS], [test "x$USE_THREADS" != "xnone"]) AM_CONDITIONAL([DISABLE_THREADS], [test "x$USE_THREADS" = "xnone"]) AC_MSG_RESULT([$USE_THREADS]) @@ -2809,7 +2809,7 @@ AS_VAR_IF([mhd_cv_func_select],["yes"], AS_IF([test "x$enable_select" != "xno"], [ enable_select="yes" - AC_DEFINE([[MHD_USE_SELECT]],[[1]],[Define to '1' to enable use of select() system call]) + AC_DEFINE([[MHD_SUPPORT_SELECT]],[[1]],[Define to '1' to enable use of select() system call]) ] ) ], @@ -2819,7 +2819,7 @@ AS_VAR_IF([mhd_cv_func_select],["yes"], ) ] ) -AM_CONDITIONAL([MHD_USE_SELECT],[test "x${enable_select}" = "xyes"]) +AM_CONDITIONAL([MHD_SUPPORT_SELECT],[test "x${enable_select}" = "xyes"]) AC_ARG_ENABLE([[poll]], [AS_HELP_STRING([[--enable-poll[=ARG]]], [enable 'poll()' support (yes, no, auto) [auto]]) @@ -2871,7 +2871,7 @@ AS_VAR_IF([have_poll],["yes"], AS_IF([test "x$enable_poll" != "xno"], [ enable_poll="yes" - AC_DEFINE([[MHD_USE_POLL]],[[1]],[Define to '1' to enable use of select() system call]) + AC_DEFINE([[MHD_SUPPORT_POLL]],[[1]],[Define to '1' to enable use of select() system call]) ] ) ], @@ -2881,7 +2881,7 @@ AS_VAR_IF([have_poll],["yes"], ) ] ) -AM_CONDITIONAL([MHD_USE_POLL],[test "x${enable_poll}" = "xyes"]) +AM_CONDITIONAL([MHD_SUPPORT_POLL],[test "x${enable_poll}" = "xyes"]) AC_ARG_ENABLE([[epoll]], [AS_HELP_STRING([[--enable-epoll[=ARG]]], [enable epoll support (yes, no, auto) [auto]]) @@ -2903,7 +2903,7 @@ AS_IF([test "$enable_epoll" != "no"], [cacheVar="assuming yes"], [ AC_DEFINE([[HAVE_EPOLL]],[[1]],[Define to '1' if epoll is supported on your platform]) - AC_DEFINE([[MHD_USE_EPOLL]],[[1]],[Define to '1' to enable 'epoll' functionality]) + AC_DEFINE([[MHD_SUPPORT_EPOLL]],[[1]],[Define to '1' to enable 'epoll' functionality]) enable_epoll='yes' ], [ @@ -2932,7 +2932,7 @@ WARNING: " ) ] ) -AM_CONDITIONAL([MHD_USE_EPOLL], [[test "x${enable_epoll}" = "xyes"]]) +AM_CONDITIONAL([MHD_SUPPORT_EPOLL], [[test "x${enable_epoll}" = "xyes"]]) AS_IF([test "x$enable_epoll" = "xyes"], [ @@ -4851,11 +4851,11 @@ AC_ARG_ENABLE([log-messages], [],[enable_log_messages="$enable_messages"] ) AS_VAR_IF([enable_log_messages],["yes"], - [AC_DEFINE([HAVE_LOG_FUNCTIONALITY],[1],[Define to '1' to enable internal logging and log messages.])], + [AC_DEFINE([MHD_SUPPORT_LOG_FUNCTIONALITY],[1],[Define to '1' to enable internal logging and log messages.])], [enable_log_messages="no"] ) AC_MSG_RESULT([[$enable_log_messages]]) -AM_CONDITIONAL([HAVE_LOG_FUNCTIONALITY], [test "x$enable_log_messages" != "xno"]) +AM_CONDITIONAL([MHD_SUPPORT_LOG_FUNCTIONALITY], [test "x$enable_log_messages" != "xno"]) AC_MSG_CHECKING([[whether to build text bodies for automatic HTTP response messages]]) AC_ARG_ENABLE([http-messages], @@ -4866,11 +4866,11 @@ AC_ARG_ENABLE([http-messages], [],[enable_http_messages="$enable_messages"] ) AS_VAR_IF([enable_http_messages],["yes"], - [AC_DEFINE([HAVE_HTTP_AUTO_MESSAGES_BODIES],[1],[Define to '1' to enable verbose text bodies for automatic HTTP replies.])], + [AC_DEFINE([MHD_ENABLE_AUTO_MESSAGES_BODIES],[1],[Define to '1' to enable verbose text bodies for automatic HTTP replies.])], [enable_http_messages="no"] ) AC_MSG_RESULT([[$enable_http_messages]]) -AM_CONDITIONAL([HAVE_HTTP_AUTO_MESSAGES_BODIES], [test "x$enable_http_messages" != "xno"]) +AM_CONDITIONAL([MHD_ENABLE_AUTO_MESSAGES_BODIES], [test "x$enable_http_messages" != "xno"]) # optional: have postprocessor? @@ -4882,8 +4882,8 @@ AC_ARG_ENABLE([postparser], [enable_postparser=yes]) AS_IF([[test "x$enable_postparser" != "xno"]], [ enable_postparser=yes - AC_DEFINE([HAVE_POST_PARSER],[1],[Define to 1 if libmicrohttpd is compiled with POST parser support.]) ]) -AM_CONDITIONAL([HAVE_POST_PARSER], [test "x$enable_postparser" != "xno"]) + AC_DEFINE([MHD_SUPPORT_POST_PARSER],[1],[Define to 1 if libmicrohttpd is compiled with POST parser support.]) ]) +AM_CONDITIONAL([MHD_SUPPORT_POST_PARSER], [test "x$enable_postparser" != "xno"]) AC_MSG_RESULT([[$enable_postparser]]) have_gnutls=no @@ -5261,7 +5261,7 @@ choke me now multiple_tls="yes" ] ) - AC_DEFINE([MHD_USE_GNUTLS],[1],[Define to '1' i][f GnuTLS library should be used]) + AC_DEFINE([MHD_SUPPORT_GNUTLS],[1],[Define to '1' i][f GnuTLS library should be used]) MSG_TLS_BACKENDS="${MSG_TLS_BACKENDS}GnuTLS" MHD_APPEND_FLAG_TO_VAR([MHD_TLS_LIB_CPPFLAGS],[$GNUTLS_CPPFLAGS]) MHD_APPEND_FLAG_TO_VAR([MHD_TLS_LIB_LDFLAGS],[$GNUTLS_LDFLAGS]) @@ -5276,7 +5276,7 @@ choke me now multiple_tls="yes" ] ) - AC_DEFINE([MHD_USE_OPENSSL],[1],[Define to '1' i][f OpenSSL library should be used]) + AC_DEFINE([MHD_SUPPORT_OPENSSL],[1],[Define to '1' i][f OpenSSL library should be used]) MSG_TLS_BACKENDS="${MSG_TLS_BACKENDS}OpenSSL" MHD_APPEND_FLAG_TO_VAR([MHD_TLS_LIB_CPPFLAGS],[$OPENSSL_CPPFLAGS]) MHD_APPEND_FLAG_TO_VAR([MHD_TLS_LIB_LDFLAGS],[$OPENSSL_LDFLAGS]) @@ -5329,11 +5329,11 @@ AS_VAR_IF([enable_https],["yes"], ) AC_MSG_RESULT([$MSG_HTTPS]) -AM_CONDITIONAL([MHD_USE_GNUTLS], [[test "x$have_gnutls" = "xyes"]]) +AM_CONDITIONAL([MHD_SUPPORT_GNUTLS], [[test "x$have_gnutls" = "xyes"]]) AC_SUBST([GNUTLS_CPPFLAGS]) AC_SUBST([GNUTLS_LDFLAGS]) AC_SUBST([GNUTLS_LIBS]) -AM_CONDITIONAL([MHD_USE_OPENSSL], [[test "x$have_openssl" = "xyes"]]) +AM_CONDITIONAL([MHD_SUPPORT_OPENSSL], [[test "x$have_openssl" = "xyes"]]) AC_SUBST([OPENSSL_CPPFLAGS]) AC_SUBST([OPENSSL_LDFLAGS]) AC_SUBST([OPENSSL_LIBS]) @@ -5515,8 +5515,8 @@ AC_ARG_ENABLE([[httpupgrade]], [[enable_httpupgrade='yes']]) AS_VAR_IF([[enable_httpupgrade]],[["yes"]], [ - AC_DEFINE([[MHD_UPGRADE_SUPPORT]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTP Upgrade support.]) ]) -AM_CONDITIONAL([MHD_UPGRADE_SUPPORT], [[test "x$enable_httpupgrade" = "xyes"]]) + AC_DEFINE([[MHD_SUPPORT_UPGRADE]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTP Upgrade support.]) ]) +AM_CONDITIONAL([MHD_SUPPORT_UPGRADE], [[test "x$enable_httpupgrade" = "xyes"]]) AC_MSG_RESULT([[$enable_httpupgrade]]) # optional: HTTP cookie parsing support. Enabled by default @@ -5527,8 +5527,8 @@ AC_ARG_ENABLE([[cookie]], [[enable_cookie='yes']]) AS_VAR_IF([[enable_cookie]],[["yes"]], [ - AC_DEFINE([[COOKIE_SUPPORT]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTP cookie parsing support.]) ]) -AM_CONDITIONAL([ENABLE_COOKIE], [[test "x$enable_cookie" = "xyes"]]) + AC_DEFINE([[MHD_SUPPORT_COOKIES]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTP cookie parsing support.]) ]) +AM_CONDITIONAL([MHD_SUPPORT_COOKIES], [[test "x$enable_cookie" = "xyes"]]) AC_MSG_RESULT([[$enable_cookie]]) # optional: MD5 support for Digest Auth. Enabled by default. diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index d2a4077a..8226dfc2 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -34,7 +34,7 @@ noinst_PROGRAMS += \ endif endif -if HAVE_POST_PARSER +if MHD_SUPPORT_POST_PARSER noinst_PROGRAMS += simplepost largepost sessions endif diff --git a/src/incl_priv/mhd_sys_options.h b/src/incl_priv/mhd_sys_options.h index ef993808..a50be27c 100644 --- a/src/incl_priv/mhd_sys_options.h +++ b/src/incl_priv/mhd_sys_options.h @@ -322,13 +322,13 @@ #if defined(HAVE_LINUX_SENDFILE) || defined(HAVE_FREEBSD_SENDFILE) || \ defined(HAVE_DARWIN_SENDFILE) /* Have any supported sendfile() function. */ -# define MHD_USE_SENDFILE 1 +# define mhd_USE_SENDFILE 1 #endif /* HAVE_LINUX_SENDFILE || HAVE_FREEBSD_SENDFILE || HAVE_DARWIN_SENDFILE */ #if defined(mhd_THREADS_KIND_POSIX) || defined(mhd_THREADS_KIND_W32) -# ifndef MHD_USE_THREADS -# define MHD_USE_THREADS 1 +# ifndef MHD_SUPPORT_THREADS +# define MHD_SUPPORT_THREADS 1 # endif #endif /* mhd_THREADS_KIND_POSIX || mhd_THREADS_KIND_W32 */ diff --git a/src/mhd2/Makefile.am b/src/mhd2/Makefile.am index b395b1d3..bd05fb7f 100644 --- a/src/mhd2/Makefile.am +++ b/src/mhd2/Makefile.am @@ -175,7 +175,7 @@ tls_open_OPTSOURCES = \ tls_open_tls_lib.h tls_open_daemon_data.h tls_open_conn_data.h \ tls_open_funcs.c tls_open_funcs.h -if HAVE_POST_PARSER +if MHD_SUPPORT_POST_PARSER libmicrohttpd2_la_SOURCES += $(post_parser_OPTSOURCES) endif @@ -191,7 +191,7 @@ if MHD_SUPPORT_AUTH_DIGEST libmicrohttpd2_la_SOURCES += $(auth_digest_OPTSOURCES) endif -if MHD_UPGRADE_SUPPORT +if MHD_SUPPORT_UPGRADE libmicrohttpd2_la_SOURCES += $(upgrade_OPTSOURCES) endif @@ -202,11 +202,11 @@ if MHD_ENABLE_MULTITLS libmicrohttpd2_la_SOURCES += $(tls_multi_OPTSOURCES) endif -if MHD_USE_GNUTLS +if MHD_SUPPORT_GNUTLS libmicrohttpd2_la_SOURCES += $(tls_gnu_OPTSOURCES) endif -if MHD_USE_OPENSSL +if MHD_SUPPORT_OPENSSL libmicrohttpd2_la_SOURCES += $(tls_open_OPTSOURCES) endif endif diff --git a/src/mhd2/action.c b/src/mhd2/action.c index 2c741122..3ed76a08 100644 --- a/src/mhd2/action.c +++ b/src/mhd2/action.c @@ -38,7 +38,7 @@ #include "response_funcs.h" #include "response_destroy.h" -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE # include "upgrade_prep.h" #endif @@ -143,7 +143,7 @@ MHD_action_parse_post (struct MHD_Request *request, MHD_PostDataFinished done_cb, void *done_cb_cls) { -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER struct MHD_Action *const restrict head_act = &(request->app_act.head_act); if (mhd_ACTION_NO_ACTION != head_act->act) @@ -161,16 +161,16 @@ MHD_action_parse_post (struct MHD_Request *request, head_act->data.post_parse.done_cb_cls = done_cb_cls; return head_act; -#else /* ! HAVE_POST_PARSER */ +#else /* ! MHD_SUPPORT_POST_PARSER */ (void) request; (void) buffer_size; (void) max_nonstream_size; (void) enc; (void) stream_reader; (void) reader_cls; (void) done_cb; (void) done_cb_cls; return NULL; -#endif /* ! HAVE_POST_PARSER */ +#endif /* ! MHD_SUPPORT_POST_PARSER */ } -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE MHD_EXTERN_ MHD_FN_PAR_NONNULL_ (1) @@ -243,7 +243,7 @@ MHD_upload_action_upgrade ( } -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ MHD_EXTERN_ MHD_FN_PAR_NONNULL_ALL_ diff --git a/src/mhd2/conn_data_send.c b/src/mhd2/conn_data_send.c index d37a9305..803425f6 100644 --- a/src/mhd2/conn_data_send.c +++ b/src/mhd2/conn_data_send.c @@ -218,7 +218,7 @@ mhd_conn_data_send (struct MHD_Connection *restrict c) true, &sent); } - #if defined(MHD_USE_SENDFILE) + #if defined(mhd_USE_SENDFILE) else if (mhd_REPLY_CNTN_LOC_FILE == c->rp.cntn_loc) { mhd_assert (mhd_RESPONSE_CONTENT_DATA_FILE == resp->cntn_dtype); @@ -234,7 +234,7 @@ mhd_conn_data_send (struct MHD_Connection *restrict c) } } } - #endif /* MHD_USE_SENDFILE */ + #endif /* mhd_USE_SENDFILE */ else { mhd_assert (0 && "Should be unreachable"); @@ -286,7 +286,7 @@ mhd_conn_data_send (struct MHD_Connection *restrict c) mhd_HTTP_STAGE_FULL_REPLY_SENT); } break; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_HTTP_STAGE_UPGRADE_HEADERS_SENDING: res = mhd_send_data (c, c->write_buffer_append_offset @@ -298,7 +298,7 @@ mhd_conn_data_send (struct MHD_Connection *restrict c) if (mhd_SOCKET_ERR_NO_ERROR == res) c->write_buffer_send_offset += sent; break; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ case mhd_HTTP_STAGE_INIT: case mhd_HTTP_STAGE_REQ_LINE_RECEIVING: case mhd_HTTP_STAGE_REQ_LINE_RECEIVED: @@ -319,11 +319,11 @@ mhd_conn_data_send (struct MHD_Connection *restrict c) case mhd_HTTP_STAGE_FULL_REPLY_SENT: case mhd_HTTP_STAGE_PRE_CLOSING: case mhd_HTTP_STAGE_CLOSED: -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_HTTP_STAGE_UPGRADING: case mhd_HTTP_STAGE_UPGRADED: case mhd_HTTP_STAGE_UPGRADED_CLEANING: -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ mhd_assert (0 && "Should be unreachable"); mhd_UNREACHABLE (); res = mhd_SOCKET_ERR_INTERNAL; diff --git a/src/mhd2/daemon_add_conn.c b/src/mhd2/daemon_add_conn.c index 33f96946..304e8577 100644 --- a/src/mhd2/daemon_add_conn.c +++ b/src/mhd2/daemon_add_conn.c @@ -44,7 +44,7 @@ #include "sys_ip_headers.h" #include -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL # include #endif @@ -230,9 +230,9 @@ new_connection_prepare_ (struct MHD_Daemon *restrict daemon, c->sk.props.is_nonblck = non_blck; c->sk.props.is_nonip = sk_is_nonip; c->sk.props.has_spipe_supp = sk_spipe_supprs; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS mhd_thread_handle_ID_set_invalid (&c->tid); -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ c->daemon = daemon; c->connection_timeout_ms = daemon->conns.cfg.timeout; c->event_loop_info = MHD_EVENT_LOOP_INFO_RECV; @@ -333,7 +333,7 @@ new_connection_process_ (struct MHD_Daemon *restrict daemon, notify_app_conn (daemon, connection, false); -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS if (mhd_DAEMON_TYPE_LISTEN_ONLY == daemon->threading.d_type) { mhd_assert ((mhd_POLL_TYPE_SELECT == daemon->events.poll_type) || \ @@ -366,14 +366,14 @@ new_connection_process_ (struct MHD_Daemon *restrict daemon, return MHD_SC_OK; /* *** Function success exit point *** */ } else -#else /* ! MHD_USE_THREADS */ +#else /* ! MHD_SUPPORT_THREADS */ if (1) -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ { /* No 'thread-per-connection' */ -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS connection->tid = daemon->threading.tid; -#endif /* MHD_USE_THREADS */ -#ifdef MHD_USE_EPOLL +#endif /* MHD_SUPPORT_THREADS */ +#ifdef MHD_SUPPORT_EPOLL if (mhd_POLL_TYPE_EPOLL == daemon->events.poll_type) { struct epoll_event event; @@ -401,7 +401,7 @@ new_connection_process_ (struct MHD_Daemon *restrict daemon, } } else /* No 'epoll' */ -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ return MHD_SC_OK; /* *** Function success exit point *** */ } @@ -710,7 +710,7 @@ MHD_daemon_add_connection (struct MHD_Daemon *daemon, addrstorage.ss_len = addrlen; /* Force set the right length */ #endif /* HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN */ -#if defined(MHD_USE_THREADS) +#if defined(MHD_SUPPORT_THREADS) if (mhd_D_TYPE_HAS_WORKERS (daemon->threading.d_type)) { unsigned int i; @@ -753,7 +753,7 @@ MHD_daemon_add_connection (struct MHD_Daemon *daemon, (void) mhd_socket_close (client_socket); return MHD_SC_LIMIT_CONNECTIONS_REACHED; } -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ return internal_add_connection (daemon, client_socket, @@ -785,11 +785,11 @@ mhd_daemon_accept_connection (struct MHD_Daemon *restrict daemon) static const bool use_accept4 = false; #endif /* ! USE_ACCEPT4 && ! _DEBUG */ -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS mhd_assert ((! mhd_D_HAS_THREADS (daemon)) || \ mhd_thread_handle_ID_is_current_thread (daemon->threading.tid)); mhd_assert (! mhd_D_TYPE_HAS_WORKERS (daemon->threading.d_type)); -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ fd = daemon->net.listen.fd; mhd_assert (MHD_INVALID_SOCKET != fd); diff --git a/src/mhd2/daemon_funcs.c b/src/mhd2/daemon_funcs.c index 18373007..66f27624 100644 --- a/src/mhd2/daemon_funcs.c +++ b/src/mhd2/daemon_funcs.c @@ -41,15 +41,15 @@ MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_ MHD_FN_MUST_CHECK_RESULT_ struct MHD_Daemon * mhd_daemon_get_master_daemon (struct MHD_Daemon *restrict d) { -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS if (mhd_D_HAS_MASTER (d)) return d->threading.hier.master; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ return d; } -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS MHD_INTERNAL bool mhd_daemon_trigger_itc (struct MHD_Daemon *restrict d) @@ -65,7 +65,7 @@ mhd_daemon_trigger_itc (struct MHD_Daemon *restrict d) } -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ MHD_NORETURN_ // TODO: implement diff --git a/src/mhd2/daemon_funcs.h b/src/mhd2/daemon_funcs.h index d0c070f7..457e6a21 100644 --- a/src/mhd2/daemon_funcs.h +++ b/src/mhd2/daemon_funcs.h @@ -45,7 +45,7 @@ MHD_INTERNAL struct MHD_Daemon * mhd_daemon_get_master_daemon (struct MHD_Daemon *restrict d) MHD_FN_PAR_NONNULL_ALL_ MHD_FN_MUST_CHECK_RESULT_; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * Trigger daemon ITC. @@ -57,10 +57,10 @@ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_MUST_CHECK_RESULT_; MHD_INTERNAL bool mhd_daemon_trigger_itc (struct MHD_Daemon *restrict d); -#else /* ! MHD_USE_THREADS */ +#else /* ! MHD_SUPPORT_THREADS */ #define mhd_daemon_trigger_itc (d) ((void) d, ! 0) -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ /** diff --git a/src/mhd2/daemon_get_info.c b/src/mhd2/daemon_get_info.c index 222946bd..b2d7a11e 100644 --- a/src/mhd2/daemon_get_info.c +++ b/src/mhd2/daemon_get_info.c @@ -53,7 +53,7 @@ MHD_daemon_get_info_fixed_sz (struct MHD_Daemon *daemon, return_value->v_socket = daemon->net.listen.fd; return MHD_SC_OK; case MHD_DAEMON_INFO_FIXED_AGGREAGATE_FD: -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL if (! mhd_D_IS_USING_EPOLL (daemon)) return MHD_SC_INFO_GET_TYPE_UNSUPPORTED; if (sizeof(int) > return_value_size) diff --git a/src/mhd2/daemon_logger.c b/src/mhd2/daemon_logger.c index 6624455b..eccf2894 100644 --- a/src/mhd2/daemon_logger.c +++ b/src/mhd2/daemon_logger.c @@ -26,7 +26,7 @@ #include "mhd_sys_options.h" -#ifdef HAVE_LOG_FUNCTIONALITY +#ifdef MHD_SUPPORT_LOG_FUNCTIONALITY #include #include "sys_null_macro.h" #include "mhd_daemon.h" @@ -50,4 +50,4 @@ mhd_logger (struct MHD_Daemon *daemon, } -#endif /* ! HAVE_LOG_FUNCTIONALITY */ +#endif /* ! MHD_SUPPORT_LOG_FUNCTIONALITY */ diff --git a/src/mhd2/daemon_logger.h b/src/mhd2/daemon_logger.h index 25e9112f..7325dd28 100644 --- a/src/mhd2/daemon_logger.h +++ b/src/mhd2/daemon_logger.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifdef HAVE_LOG_FUNCTIONALITY +#ifdef MHD_SUPPORT_LOG_FUNCTIONALITY #include "mhd_public_api.h" /* For enum MHD_StatusCode */ @@ -76,7 +76,7 @@ mhd_logger (struct MHD_Daemon *daemon, */ #define mhd_LOG_FMT(format_string) format_string -#else /* ! HAVE_LOG_FUNCTIONALITY */ +#else /* ! MHD_SUPPORT_LOG_FUNCTIONALITY */ #ifdef HAVE_MACRO_VARIADIC @@ -138,6 +138,6 @@ mhd_LOG_PRINT (struct MHD_Daemon *daemon, */ #define mhd_LOG_FMT(format_string) NULL -#endif /* ! HAVE_LOG_FUNCTIONALITY */ +#endif /* ! MHD_SUPPORT_LOG_FUNCTIONALITY */ #endif /* ! MHD_DAEMON_LOGGER_H */ diff --git a/src/mhd2/daemon_logger_default.c b/src/mhd2/daemon_logger_default.c index b783a594..e5a4e606 100644 --- a/src/mhd2/daemon_logger_default.c +++ b/src/mhd2/daemon_logger_default.c @@ -26,7 +26,7 @@ #include "mhd_sys_options.h" -#ifdef HAVE_LOG_FUNCTIONALITY +#ifdef MHD_SUPPORT_LOG_FUNCTIONALITY #include @@ -54,4 +54,4 @@ mhd_logger_default (void *cls, } -#endif /* ! HAVE_LOG_FUNCTIONALITY */ +#endif /* ! MHD_SUPPORT_LOG_FUNCTIONALITY */ diff --git a/src/mhd2/daemon_logger_default.h b/src/mhd2/daemon_logger_default.h index 6b213eb7..c19e4025 100644 --- a/src/mhd2/daemon_logger_default.h +++ b/src/mhd2/daemon_logger_default.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifdef HAVE_LOG_FUNCTIONALITY +#ifdef MHD_SUPPORT_LOG_FUNCTIONALITY #include "mhd_public_api.h" /* For enum MHD_StatusCode */ @@ -49,7 +49,7 @@ mhd_logger_default (void *cls, const char *fm, va_list ap); -#else /* ! HAVE_LOG_FUNCTIONALITY */ +#else /* ! MHD_SUPPORT_LOG_FUNCTIONALITY */ #include "sys_null_macro.h" diff --git a/src/mhd2/daemon_start.c b/src/mhd2/daemon_start.c index 608f6b94..766e4286 100644 --- a/src/mhd2/daemon_start.c +++ b/src/mhd2/daemon_start.c @@ -39,13 +39,13 @@ #ifdef MHD_SOCKETS_KIND_POSIX # include "sys_errno.h" #endif -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL # include #endif #ifdef MHD_SOCKETS_KIND_POSIX # include -# ifdef MHD_USE_SELECT +# ifdef MHD_SUPPORT_SELECT # ifdef HAVE_SYS_SELECT_H # include /* For FD_SETSIZE */ # else @@ -79,7 +79,7 @@ # include "mhd_tls_funcs.h" #endif -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS # include "mhd_itc.h" # include "mhd_threads.h" # include "events_process.h" @@ -156,7 +156,7 @@ daemon_set_work_mode (struct MHD_Daemon *restrict d, "is not compatible with requested socket polling syscall."); return MHD_SC_SYSCALL_WORK_MODE_COMBINATION_INVALID; } -#ifndef MHD_USE_EPOLL +#ifndef MHD_SUPPORT_EPOLL mhd_LOG_MSG ( \ d, MHD_SC_FEATURE_DISABLED, \ "The epoll is required for the requested work mode " \ @@ -178,19 +178,19 @@ daemon_set_work_mode (struct MHD_Daemon *restrict d, } /* Intentional fallthrough */ case MHD_WM_WORKER_THREADS: -#ifndef MHD_USE_THREADS +#ifndef MHD_SUPPORT_THREADS mhd_LOG_MSG (d, MHD_SC_FEATURE_DISABLED, \ "The internal threads modes are not supported by this " \ "build of MHD."); return MHD_SC_FEATURE_DISABLED; -#else /* MHD_USE_THREADS */ +#else /* MHD_SUPPORT_THREADS */ if (MHD_WM_THREAD_PER_CONNECTION == s->work_mode.mode) d->wmode_int = mhd_WM_INT_INTERNAL_EVENTS_THREAD_PER_CONNECTION; else if (1 >= s->work_mode.params.num_worker_threads) /* && (MHD_WM_WORKER_THREADS == s->work_mode.mode) */ d->wmode_int = mhd_WM_INT_INTERNAL_EVENTS_ONE_THREAD; else d->wmode_int = mhd_WM_INT_INTERNAL_EVENTS_THREAD_POOL; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ break; default: mhd_LOG_MSG (d, MHD_SC_CONFIGURATION_UNEXPECTED_WM, \ @@ -1067,7 +1067,7 @@ detect_listen_type_and_port (struct MHD_Daemon *restrict d) #endif -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL /** * Initialise daemon's epoll FD @@ -1138,7 +1138,7 @@ deinit_epoll (struct MHD_Daemon *restrict d) } -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ /** * Choose sockets monitoring syscall and pre-initialise it @@ -1175,36 +1175,36 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, break; case MHD_SPS_SELECT: mhd_assert (! mhd_WM_INT_HAS_EXT_EVENTS (d->wmode_int)); -#ifndef MHD_USE_SELECT +#ifndef MHD_SUPPORT_SELECT mhd_LOG_MSG (d, MHD_SC_SELECT_SYSCALL_NOT_AVAILABLE, \ "'select()' is not supported by the platform or " \ "this MHD build"); return MHD_SC_SELECT_SYSCALL_NOT_AVAILABLE; -#else /* MHD_USE_SELECT */ +#else /* MHD_SUPPORT_SELECT */ chosen_type = mhd_POLL_TYPE_SELECT; -#endif /* MHD_USE_SELECT */ +#endif /* MHD_SUPPORT_SELECT */ break; case MHD_SPS_POLL: mhd_assert (! mhd_WM_INT_HAS_EXT_EVENTS (d->wmode_int)); -#ifndef MHD_USE_POLL +#ifndef MHD_SUPPORT_POLL mhd_LOG_MSG (d, MHD_SC_POLL_SYSCALL_NOT_AVAILABLE, \ "'poll()' is not supported by the platform or " \ "this MHD build"); return MHD_SC_POLL_SYSCALL_NOT_AVAILABLE; -#else /* MHD_USE_POLL */ +#else /* MHD_SUPPORT_POLL */ chosen_type = mhd_POLL_TYPE_POLL; -#endif /* MHD_USE_POLL */ +#endif /* MHD_SUPPORT_POLL */ break; case MHD_SPS_EPOLL: mhd_assert (! mhd_WM_INT_HAS_EXT_EVENTS (d->wmode_int)); -#ifndef MHD_USE_EPOLL +#ifndef MHD_SUPPORT_EPOLL mhd_LOG_MSG (d, MHD_SC_EPOLL_SYSCALL_NOT_AVAILABLE, \ "'epoll' is not supported by the platform or " \ "this MHD build"); return MHD_SC_EPOLL_SYSCALL_NOT_AVAILABLE; -#else /* MHD_USE_EPOLL */ +#else /* MHD_SUPPORT_EPOLL */ chosen_type = mhd_POLL_TYPE_EPOLL; -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ break; default: mhd_LOG_MSG (d, MHD_SC_CONFIGURATION_UNEXPECTED_SPS, @@ -1216,7 +1216,7 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, if (mhd_POLL_TYPE_NOT_SET_YET == chosen_type) { -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL bool edge_trig_allowed; edge_trig_allowed = true; # ifdef MHD_ENABLE_HTTPS @@ -1224,14 +1224,14 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, (MHD_TLS_BACKEND_NONE != s->tls)) edge_trig_allowed = mhd_tls_is_edge_trigg_supported (s); # endif /* MHD_ENABLE_HTTPS */ -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ fallback_syscall_allowed = true; if (mhd_WM_INT_HAS_EXT_EVENTS (d->wmode_int)) { chosen_type = mhd_POLL_TYPE_EXT; } -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL else if (MHD_WM_EXTERNAL_SINGLE_FD_WATCH == s->work_mode.mode) { fallback_syscall_allowed = false; @@ -1244,9 +1244,9 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, #endif else { -#if defined(MHD_USE_POLL) +#if defined(MHD_SUPPORT_POLL) chosen_type = mhd_POLL_TYPE_POLL; -#elif defined(MHD_USE_SELECT) +#elif defined(MHD_SUPPORT_SELECT) chosen_type = mhd_POLL_TYPE_SELECT; #else (void) 0; /* Do nothing. Mute compiler warning */ @@ -1257,7 +1257,7 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, fallback_syscall_allowed = false; /* Try 'epoll' if possible */ -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL if (mhd_POLL_TYPE_EPOLL == chosen_type) { enum MHD_StatusCode epoll_res; @@ -1275,15 +1275,15 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, } mhd_assert ((mhd_POLL_TYPE_EPOLL != d->events.poll_type) || \ (0 < d->events.data.epoll.e_fd)); -#else /* ! MHD_USE_EPOLL */ +#else /* ! MHD_SUPPORT_EPOLL */ (void) fallback_syscall_allowed; /* Mute compiler warning */ -#endif /* ! MHD_USE_EPOLL */ +#endif /* ! MHD_SUPPORT_EPOLL */ if (mhd_POLL_TYPE_NOT_SET_YET == chosen_type) { -#if defined(MHD_USE_POLL) +#if defined(MHD_SUPPORT_POLL) chosen_type = mhd_POLL_TYPE_POLL; -#elif defined(MHD_USE_SELECT) +#elif defined(MHD_SUPPORT_SELECT) chosen_type = mhd_POLL_TYPE_SELECT; #else mhd_LOG_MSG (d, MHD_SC_FEATURE_DISABLED, \ @@ -1306,7 +1306,7 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, d->events.data.ext.cls = s->work_mode.params.v_external_event_loop_cb.reg_cb_cls; break; -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT case mhd_POLL_TYPE_SELECT: mhd_assert (! mhd_WM_INT_HAS_EXT_EVENTS (d->wmode_int)); mhd_assert (MHD_WM_EXTERNAL_SINGLE_FD_WATCH != s->work_mode.mode); @@ -1315,8 +1315,8 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, d->events.data.select.wfds = NULL; /* Memory allocated during event and threads init */ d->events.data.select.efds = NULL; /* Memory allocated during event and threads init */ break; -#endif /* MHD_USE_SELECT */ -#ifdef MHD_USE_POLL +#endif /* MHD_SUPPORT_SELECT */ +#ifdef MHD_SUPPORT_POLL case mhd_POLL_TYPE_POLL: mhd_assert (! mhd_WM_INT_HAS_EXT_EVENTS (d->wmode_int)); mhd_assert (MHD_WM_EXTERNAL_SINGLE_FD_WATCH != s->work_mode.mode); @@ -1324,8 +1324,8 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, d->events.data.poll.fds = NULL; /* Memory allocated during event and threads init */ d->events.data.poll.rel = NULL; /* Memory allocated during event and threads init */ break; -#endif /* MHD_USE_POLL */ -#ifdef MHD_USE_EPOLL +#endif /* MHD_SUPPORT_POLL */ +#ifdef MHD_SUPPORT_EPOLL case mhd_POLL_TYPE_EPOLL: mhd_assert (! mhd_WM_INT_HAS_EXT_EVENTS (d->wmode_int)); /* Pre-initialised by init_epoll() */ @@ -1333,16 +1333,16 @@ daemon_choose_and_preinit_events (struct MHD_Daemon *restrict d, mhd_assert (0 <= d->events.data.epoll.e_fd); mhd_assert (NULL == d->events.data.epoll.events); break; -#endif /* MHD_USE_EPOLL */ -#ifndef MHD_USE_SELECT +#endif /* MHD_SUPPORT_EPOLL */ +#ifndef MHD_SUPPORT_SELECT case mhd_POLL_TYPE_SELECT: -#endif /* ! MHD_USE_SELECT */ -#ifndef MHD_USE_POLL +#endif /* ! MHD_SUPPORT_SELECT */ +#ifndef MHD_SUPPORT_POLL case mhd_POLL_TYPE_POLL: -#endif /* ! MHD_USE_POLL */ -#ifndef MHD_USE_EPOLL +#endif /* ! MHD_SUPPORT_POLL */ +#ifndef MHD_SUPPORT_EPOLL case mhd_POLL_TYPE_EPOLL: -#endif /* ! MHD_USE_EPOLL */ +#endif /* ! MHD_SUPPORT_EPOLL */ case mhd_POLL_TYPE_NOT_SET_YET: default: mhd_UNREACHABLE (); @@ -1382,14 +1382,14 @@ daemon_init_net (struct MHD_Daemon *restrict d, /* No direct return of error codes is allowed beyond this point. Deinit/cleanup must be performed before return of any error. */ -#if defined(MHD_SOCKETS_KIND_POSIX) && defined(MHD_USE_SELECT) +#if defined(MHD_SOCKETS_KIND_POSIX) && defined(MHD_SUPPORT_SELECT) if (mhd_POLL_TYPE_SELECT == d->events.poll_type) { if ((MHD_INVALID_SOCKET == d->net.cfg.max_fd_num) || (FD_SETSIZE < d->net.cfg.max_fd_num)) d->net.cfg.max_fd_num = FD_SETSIZE; } -#endif /* MHD_SOCKETS_KIND_POSIX && MHD_USE_SELECT */ +#endif /* MHD_SOCKETS_KIND_POSIX && MHD_SUPPORT_SELECT */ if (MHD_SC_OK == ret) { @@ -1427,10 +1427,10 @@ daemon_init_net (struct MHD_Daemon *restrict d, } } -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL if ((mhd_POLL_TYPE_EPOLL == d->events.poll_type)) close (d->events.data.epoll.e_fd); -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ mhd_assert (MHD_SC_OK != ret); @@ -1448,10 +1448,10 @@ daemon_deinit_net (struct MHD_Daemon *restrict d) mhd_assert (d->dbg.net_inited); mhd_assert (! d->dbg.net_deinited); mhd_assert (mhd_POLL_TYPE_NOT_SET_YET != d->events.poll_type); -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL if (mhd_POLL_TYPE_EPOLL == d->events.poll_type) deinit_epoll (d); -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ if (MHD_INVALID_SOCKET != d->net.listen.fd) mhd_socket_close (d->net.listen.fd); @@ -1724,20 +1724,20 @@ static MHD_FN_PAR_NONNULL_ (1) MHD_FN_MUST_CHECK_RESULT_ enum MHD_StatusCode allocate_events (struct MHD_Daemon *restrict d) { -#if defined(MHD_USE_POLL) || defined(MHD_USE_EPOLL) +#if defined(MHD_SUPPORT_POLL) || defined(MHD_SUPPORT_EPOLL) /** * The number of elements to be monitored by sockets polling function */ unsigned int num_elements; num_elements = 0; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS ++num_elements; /* For the ITC */ #endif if (MHD_INVALID_SOCKET != d->net.listen.fd) ++num_elements; /* For the listening socket */ if (! mhd_D_HAS_THR_PER_CONN (d)) num_elements += d->conns.cfg.count_limit; -#endif /* MHD_USE_POLL || MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_POLL || MHD_SUPPORT_EPOLL */ mhd_assert (0 != d->conns.cfg.count_limit); mhd_assert (mhd_D_TYPE_HAS_EVENTS_PROCESSING (d->threading.d_type)); @@ -1753,7 +1753,7 @@ allocate_events (struct MHD_Daemon *restrict d) #endif return MHD_SC_OK; /* Success exit point */ break; -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT case mhd_POLL_TYPE_SELECT: /* The pointers have been set to NULL during pre-initialisations of the events */ mhd_assert (NULL == d->events.data.select.rfds); @@ -1783,8 +1783,8 @@ allocate_events (struct MHD_Daemon *restrict d) "Failed to allocate memory for fd_sets for the daemon"); return MHD_SC_FD_SET_MEMORY_ALLOCATE_FAILURE; break; -#endif /* MHD_USE_SELECT */ -#ifdef MHD_USE_POLL +#endif /* MHD_SUPPORT_SELECT */ +#ifdef MHD_SUPPORT_POLL case mhd_POLL_TYPE_POLL: /* The pointers have been set to NULL during pre-initialisations of the events */ mhd_assert (NULL == d->events.data.poll.fds); @@ -1814,8 +1814,8 @@ allocate_events (struct MHD_Daemon *restrict d) "Failed to allocate memory for poll fds for the daemon"); return MHD_SC_POLL_FDS_MEMORY_ALLOCATE_FAILURE; break; -#endif /* MHD_USE_POLL */ -#ifdef MHD_USE_EPOLL +#endif /* MHD_SUPPORT_POLL */ +#ifdef MHD_SUPPORT_EPOLL case mhd_POLL_TYPE_EPOLL: mhd_assert (! mhd_D_HAS_THR_PER_CONN (d)); /* The event FD has been created during pre-initialisations of the events */ @@ -1850,16 +1850,16 @@ allocate_events (struct MHD_Daemon *restrict d) "Failed to allocate memory for epoll events for the daemon"); return MHD_SC_EPOLL_EVENTS_MEMORY_ALLOCATE_FAILURE; break; -#endif /* MHD_USE_EPOLL */ -#ifndef MHD_USE_SELECT +#endif /* MHD_SUPPORT_EPOLL */ +#ifndef MHD_SUPPORT_SELECT case mhd_POLL_TYPE_SELECT: -#endif /* ! MHD_USE_SELECT */ -#ifndef MHD_USE_POLL +#endif /* ! MHD_SUPPORT_SELECT */ +#ifndef MHD_SUPPORT_POLL case mhd_POLL_TYPE_POLL: -#endif /* ! MHD_USE_POLL */ -#ifndef MHD_USE_EPOLL +#endif /* ! MHD_SUPPORT_POLL */ +#ifndef MHD_SUPPORT_EPOLL case mhd_POLL_TYPE_EPOLL: -#endif /* ! MHD_USE_EPOLL */ +#endif /* ! MHD_SUPPORT_EPOLL */ case mhd_POLL_TYPE_NOT_SET_YET: default: mhd_UNREACHABLE (); @@ -1887,7 +1887,7 @@ deallocate_events (struct MHD_Daemon *restrict d) mhd_UNREACHABLE (); return; } -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT else if (mhd_POLL_TYPE_SELECT == d->events.poll_type) { mhd_assert (NULL != d->events.data.select.efds); @@ -1897,8 +1897,8 @@ deallocate_events (struct MHD_Daemon *restrict d) free (d->events.data.select.wfds); free (d->events.data.select.rfds); } -#endif /* MHD_USE_SELECT */ -#ifdef MHD_USE_POLL +#endif /* MHD_SUPPORT_SELECT */ +#ifdef MHD_SUPPORT_POLL else if (mhd_POLL_TYPE_POLL == d->events.poll_type) { mhd_assert (NULL != d->events.data.poll.rel); @@ -1906,15 +1906,15 @@ deallocate_events (struct MHD_Daemon *restrict d) free (d->events.data.poll.rel); free (d->events.data.poll.fds); } -#endif /* MHD_USE_POLL */ -#ifdef MHD_USE_EPOLL +#endif /* MHD_SUPPORT_POLL */ +#ifdef MHD_SUPPORT_EPOLL else if (mhd_POLL_TYPE_EPOLL == d->events.poll_type) { mhd_assert (0 != d->events.data.epoll.num_elements); mhd_assert (NULL != d->events.data.epoll.events); free (d->events.data.epoll.events); } -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ #ifndef NDEBUG d->dbg.events_allocated = false; #endif @@ -1934,7 +1934,7 @@ init_itc (struct MHD_Daemon *restrict d) { mhd_assert (mhd_D_TYPE_IS_VALID (d->threading.d_type)); mhd_assert (mhd_D_TYPE_HAS_EVENTS_PROCESSING (d->threading.d_type)); -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS // TODO: add and process "thread unsafe" daemon's option if (! mhd_itc_init (&(d->threading.itc))) { @@ -1967,7 +1967,7 @@ init_itc (struct MHD_Daemon *restrict d) mhd_itc_set_invalid (&(d->threading.itc)); return MHD_SC_ITC_FD_OUTSIDE_OF_SET_RANGE; } -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ return MHD_SC_OK; } @@ -1983,11 +1983,11 @@ deinit_itc (struct MHD_Daemon *restrict d) { mhd_assert (mhd_D_TYPE_IS_VALID (d->threading.d_type)); mhd_assert (mhd_D_TYPE_HAS_EVENTS_PROCESSING (d->threading.d_type)); -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS // TODO: add and process "thread unsafe" daemon's option mhd_assert (! mhd_ITC_IS_INVALID (d->threading.itc)); (void) mhd_itc_destroy (d->threading.itc); -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ } @@ -2007,7 +2007,7 @@ add_itc_and_listen_to_monitoring (struct MHD_Daemon *restrict d) mhd_assert (d->dbg.events_allocated); mhd_assert (! d->dbg.events_fully_inited); mhd_assert (mhd_D_TYPE_HAS_EVENTS_PROCESSING (d->threading.d_type)); -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS mhd_assert (mhd_ITC_IS_VALID (d->threading.itc)); #endif @@ -2019,7 +2019,7 @@ add_itc_and_listen_to_monitoring (struct MHD_Daemon *restrict d) // FIXME: Register the ITC and the listening NOW? return MHD_SC_OK; break; -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT case mhd_POLL_TYPE_SELECT: mhd_assert (NULL != d->events.data.select.rfds); mhd_assert (NULL != d->events.data.select.wfds); @@ -2027,8 +2027,8 @@ add_itc_and_listen_to_monitoring (struct MHD_Daemon *restrict d) /* Nothing to do when using 'select()' */ return MHD_SC_OK; break; -#endif /* MHD_USE_SELECT */ -#ifdef MHD_USE_POLL +#endif /* MHD_SUPPORT_SELECT */ +#ifdef MHD_SUPPORT_POLL case mhd_POLL_TYPE_POLL: mhd_assert (NULL != d->events.data.poll.fds); mhd_assert (NULL != d->events.data.poll.rel); @@ -2036,7 +2036,7 @@ add_itc_and_listen_to_monitoring (struct MHD_Daemon *restrict d) { unsigned int i; i = 0; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS d->events.data.poll.fds[i].fd = mhd_itc_r_fd (d->threading.itc); d->events.data.poll.fds[i].events = POLLIN; d->events.data.poll.rel[i].fd_id = mhd_SOCKET_REL_MARKER_ITC; @@ -2051,8 +2051,8 @@ add_itc_and_listen_to_monitoring (struct MHD_Daemon *restrict d) } return MHD_SC_OK; break; -#endif /* MHD_USE_POLL */ -#ifdef MHD_USE_EPOLL +#endif /* MHD_SUPPORT_POLL */ +#ifdef MHD_SUPPORT_EPOLL case mhd_POLL_TYPE_EPOLL: mhd_assert (MHD_INVALID_SOCKET != d->events.data.epoll.e_fd); mhd_assert (NULL != d->events.data.epoll.events); @@ -2060,7 +2060,7 @@ add_itc_and_listen_to_monitoring (struct MHD_Daemon *restrict d) if (1) { struct epoll_event reg_event; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS reg_event.events = EPOLLIN; reg_event.data.u64 = (uint64_t) mhd_SOCKET_REL_MARKER_ITC; /* uint64_t is used in the epoll header */ if (0 != epoll_ctl (d->events.data.epoll.e_fd, EPOLL_CTL_ADD, @@ -2086,16 +2086,16 @@ add_itc_and_listen_to_monitoring (struct MHD_Daemon *restrict d) } return MHD_SC_OK; break; -#endif /* MHD_USE_EPOLL */ -#ifndef MHD_USE_SELECT +#endif /* MHD_SUPPORT_EPOLL */ +#ifndef MHD_SUPPORT_SELECT case mhd_POLL_TYPE_SELECT: -#endif /* ! MHD_USE_SELECT */ -#ifndef MHD_USE_POLL +#endif /* ! MHD_SUPPORT_SELECT */ +#ifndef MHD_SUPPORT_POLL case mhd_POLL_TYPE_POLL: -#endif /* ! MHD_USE_POLL */ -#ifndef MHD_USE_EPOLL +#endif /* ! MHD_SUPPORT_POLL */ +#ifndef MHD_SUPPORT_EPOLL case mhd_POLL_TYPE_EPOLL: -#endif /* ! MHD_USE_EPOLL */ +#endif /* ! MHD_SUPPORT_EPOLL */ case mhd_POLL_TYPE_NOT_SET_YET: default: mhd_UNREACHABLE (); @@ -2133,7 +2133,7 @@ init_individual_conns (struct MHD_Daemon *restrict d, else if (256 > d->conns.cfg.mem_pool_size) d->conns.cfg.mem_pool_size = 256; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE mhd_DLINKEDL_INIT_LIST (&(d->conns.upgr),upgr_cleanup); if (! mhd_mutex_init (&(d->conns.upgr.ucu_lock))) { @@ -2142,7 +2142,7 @@ init_individual_conns (struct MHD_Daemon *restrict d, "connection list."); return MHD_SC_MUTEX_INIT_FAILURE; } -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ #ifndef NDEBUG d->dbg.connections_inited = true; @@ -2158,12 +2158,12 @@ init_individual_conns (struct MHD_Daemon *restrict d, static MHD_FN_PAR_NONNULL_ (1) void deinit_individual_conns (struct MHD_Daemon *restrict d) { -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE mhd_assert (NULL == mhd_DLINKEDL_GET_FIRST (&(d->conns.upgr),upgr_cleanup)); mhd_assert (NULL == mhd_DLINKEDL_GET_LAST (&(d->conns.upgr),upgr_cleanup)); mhd_mutex_destroy_chk (&(d->conns.upgr.ucu_lock)); -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ mhd_assert (0 != d->conns.cfg.mem_pool_size); mhd_assert (0 == d->conns.count); @@ -2210,10 +2210,10 @@ init_individual_thread_data_events_conns (struct MHD_Daemon *restrict d, #ifndef NDEBUG d->dbg.events_fully_inited = true; #endif -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS mhd_thread_handle_ID_set_invalid (&(d->threading.tid)); d->threading.stop_requested = false; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ #ifndef NDEBUG d->dbg.threading_inited = true; #endif @@ -2291,10 +2291,10 @@ set_connections_total_limits (struct MHD_Daemon *restrict d, } } num_worker_daemons = 1; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS if (mhd_D_TYPE_HAS_WORKERS (d->threading.d_type)) num_worker_daemons = s->work_mode.params.num_worker_threads; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ limit_by_conf = s->global_connection_limit; limit_by_num = UINT_MAX; @@ -2311,9 +2311,9 @@ set_connections_total_limits (struct MHD_Daemon *restrict d, The real limit is lower, as any other process FDs will use the slots in the allowed numbers range */ limit_by_num -= 3; /* The numbers zero, one and two are used typically */ -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS limit_by_num -= mhd_ITC_NUM_FDS * num_worker_daemons; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ if (MHD_INVALID_SOCKET != d->net.listen.fd) --limit_by_num; /* One FD is used for the listening socket */ if ((num_worker_daemons > limit_by_num) || @@ -2340,7 +2340,7 @@ set_connections_total_limits (struct MHD_Daemon *restrict d, #elif defined(MHD_SOCKETS_KIND_WINSOCK) if (1) { -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT if ((mhd_DAEMON_TYPE_SINGLE == d->threading.d_type) && (mhd_POLL_TYPE_SELECT == d->events.poll_type)) { @@ -2350,9 +2350,9 @@ set_connections_total_limits (struct MHD_Daemon *restrict d, limit_per_worker = FD_SETSIZE; if (MHD_INVALID_SOCKET != d->net.listen.fd) --limit_per_worker; /* The slot for the listening socket */ -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS --limit_per_worker; /* The slot for the ITC */ -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ if ((0 == limit_per_worker) || (limit_per_worker > FD_SETSIZE)) error_by_fd_setsize = true; else @@ -2362,7 +2362,7 @@ set_connections_total_limits (struct MHD_Daemon *restrict d, limit_by_select = UINT_MAX; } } -#endif /* MHD_USE_SELECT */ +#endif /* MHD_SUPPORT_SELECT */ (void) 0; /* Mute compiler warning */ } #endif /* MHD_SOCKETS_KIND_POSIX */ @@ -2388,9 +2388,9 @@ set_connections_total_limits (struct MHD_Daemon *restrict d, #define TYPICAL_NOFILES_LIMIT (1024) /* The usual limit for the number of open FDs */ suggested_limit = TYPICAL_NOFILES_LIMIT; suggested_limit -= 3; /* The numbers zero, one and two are used typically */ -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS suggested_limit -= mhd_ITC_NUM_FDS * num_worker_daemons; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ if (MHD_INVALID_SOCKET != d->net.listen.fd) --suggested_limit; /* One FD is used for the listening socket */ if (suggested_limit > TYPICAL_NOFILES_LIMIT) @@ -2443,18 +2443,18 @@ set_d_threading_type (struct MHD_Daemon *restrict d) mhd_assert (! mhd_WM_INT_HAS_THREADS (d->wmode_int)); mhd_assert (mhd_POLL_TYPE_EXT == d->events.poll_type); mhd_assert (NULL != d->events.data.ext.cb); -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS d->threading.d_type = mhd_DAEMON_TYPE_SINGLE; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ return MHD_SC_OK; case mhd_WM_INT_INTERNAL_EVENTS_NO_THREADS: mhd_assert (! mhd_WM_INT_HAS_THREADS (d->wmode_int)); mhd_assert (mhd_POLL_TYPE_EXT != d->events.poll_type); -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS d->threading.d_type = mhd_DAEMON_TYPE_SINGLE; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ return MHD_SC_OK; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS case mhd_WM_INT_INTERNAL_EVENTS_ONE_THREAD: mhd_assert (mhd_WM_INT_HAS_THREADS (d->wmode_int)); mhd_assert (mhd_POLL_TYPE_EXT != d->events.poll_type); @@ -2471,11 +2471,11 @@ set_d_threading_type (struct MHD_Daemon *restrict d) mhd_assert (mhd_POLL_TYPE_EXT != d->events.poll_type); d->threading.d_type = mhd_DAEMON_TYPE_MASTER_CONTROL_ONLY; return MHD_SC_OK; -#else /* ! MHD_USE_THREADS */ +#else /* ! MHD_SUPPORT_THREADS */ case mhd_WM_INT_INTERNAL_EVENTS_ONE_THREAD: case mhd_WM_INT_INTERNAL_EVENTS_THREAD_PER_CONNECTION: case mhd_WM_INT_INTERNAL_EVENTS_THREAD_POOL: -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ default: break; } @@ -2484,7 +2484,7 @@ set_d_threading_type (struct MHD_Daemon *restrict d) } -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * De-initialise workers pool, including workers daemons. @@ -2513,10 +2513,10 @@ deinit_workers_pool (struct MHD_Daemon *restrict d, { /* Note: loop exits after underflow of 'i' */ struct MHD_Daemon *const worker = d->threading.hier.pool.workers + i; deinit_individual_thread_data_events_conns (worker); -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL if (mhd_POLL_TYPE_EPOLL == worker->events.poll_type) deinit_epoll (worker); -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ } free (d->threading.hier.pool.workers); #ifndef NDEBUG @@ -2614,7 +2614,7 @@ init_workers_pool (struct MHD_Daemon *restrict d, worker->conns.cfg.count_limit = conn_per_daemon; if (conn_remainder > i) worker->conns.cfg.count_limit++; /* Distribute the reminder */ -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL if (mhd_POLL_TYPE_EPOLL == worker->events.poll_type) { if (0 == i) @@ -2627,7 +2627,7 @@ init_workers_pool (struct MHD_Daemon *restrict d, else res = init_epoll (worker); } -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ if (MHD_SC_OK == res) { res = init_individual_thread_data_events_conns (worker, s); @@ -2636,10 +2636,10 @@ init_workers_pool (struct MHD_Daemon *restrict d, /* Below is a clean-up of the current slot */ -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL if (mhd_POLL_TYPE_EPOLL == worker->events.poll_type) deinit_epoll (worker); -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ } break; } @@ -2662,7 +2662,7 @@ init_workers_pool (struct MHD_Daemon *restrict d, } -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ /** * Initialise threading and inter-thread communications. @@ -2697,7 +2697,7 @@ daemon_init_threading_and_conn (struct MHD_Daemon *restrict d, if (! mhd_D_TYPE_HAS_WORKERS (d->threading.d_type)) res = init_individual_thread_data_events_conns (d, s); -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS else { res = init_workers_pool (d, s); @@ -2708,7 +2708,7 @@ daemon_init_threading_and_conn (struct MHD_Daemon *restrict d, d->threading.hier.pool.workers[0].conns.cfg.mem_pool_size; } } -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ if (MHD_SC_OK == res) { mhd_assert (d->dbg.events_allocated || \ @@ -2753,22 +2753,22 @@ daemon_deinit_threading_and_conn (struct MHD_Daemon *restrict d) } else { -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS mhd_assert (mhd_WM_INT_INTERNAL_EVENTS_THREAD_POOL == d->wmode_int); mhd_assert (! d->dbg.connections_inited); mhd_assert (! d->dbg.events_allocated); mhd_assert (d->dbg.thread_pool_inited); deinit_workers_pool (d, d->threading.hier.pool.num); -#else /* ! MHD_USE_THREADS */ +#else /* ! MHD_SUPPORT_THREADS */ mhd_assert (0 && "Impossible value"); mhd_UNREACHABLE (); (void) 0; -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ } } -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * Start the daemon individual single thread. @@ -2958,7 +2958,7 @@ start_worker_pool_threads (struct MHD_Daemon *restrict d) } -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ /** * Start the daemon internal threads, if the daemon configured to use them. @@ -2976,7 +2976,7 @@ daemon_start_threads (struct MHD_Daemon *restrict d) mhd_assert (! mhd_D_TYPE_IS_INTERNAL_ONLY (d->threading.d_type)); if (mhd_WM_INT_HAS_THREADS (d->wmode_int)) { -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS if (mhd_WM_INT_INTERNAL_EVENTS_THREAD_POOL != d->wmode_int) { mhd_assert (d->dbg.threading_inited); @@ -2989,11 +2989,11 @@ daemon_start_threads (struct MHD_Daemon *restrict d) mhd_assert (mhd_DAEMON_TYPE_MASTER_CONTROL_ONLY == d->threading.d_type); return start_worker_pool_threads (d); } -#else /* ! MHD_USE_THREADS */ +#else /* ! MHD_SUPPORT_THREADS */ mhd_assert (0 && "Impossible value"); mhd_UNREACHABLE (); return MHD_SC_INTERNAL_ERROR; -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ } return MHD_SC_OK; } @@ -3013,7 +3013,7 @@ daemon_stop_threads (struct MHD_Daemon *restrict d) mhd_assert (d->dbg.threading_inited); if (mhd_WM_INT_HAS_THREADS (d->wmode_int)) { -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS if (mhd_WM_INT_INTERNAL_EVENTS_THREAD_POOL != d->wmode_int) { mhd_assert (d->dbg.threading_inited); @@ -3028,11 +3028,11 @@ daemon_stop_threads (struct MHD_Daemon *restrict d) stop_worker_pool_threads (d, d->threading.hier.pool.num); return; } -#else /* ! MHD_USE_THREADS */ +#else /* ! MHD_SUPPORT_THREADS */ mhd_assert (0 && "Impossible value"); mhd_UNREACHABLE (); return MHD_SC_INTERNAL_ERROR; -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ } } diff --git a/src/mhd2/events_process.c b/src/mhd2/events_process.c index d0eac9f0..58f52561 100644 --- a/src/mhd2/events_process.c +++ b/src/mhd2/events_process.c @@ -35,7 +35,7 @@ #include "mhd_socket_type.h" #include "sys_poll.h" #include "sys_select.h" -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL # include #endif #ifdef MHD_SOCKETS_KIND_POSIX @@ -58,9 +58,9 @@ #include "conn_data_process.h" #include "stream_funcs.h" -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE # include "upgrade_proc.h" -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ #include "mhd_public_api.h" @@ -140,7 +140,7 @@ daemon_accept_new_conns (struct MHD_Daemon *restrict d) if (slots_left < num_to_accept) num_to_accept = slots_left; } -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS else { /* Has workers thread pool. Care must be taken to evenly distribute @@ -221,7 +221,7 @@ daemon_accept_new_conns (struct MHD_Daemon *restrict d) else if (slots_left > num_to_accept) num_to_accept = slots_left; } -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ } while (0 != --num_to_accept) @@ -247,14 +247,14 @@ daemon_accept_new_conns (struct MHD_Daemon *restrict d) MHD_static_inline_ MHD_FN_PAR_NONNULL_ALL_ bool is_conn_excluded_from_http_comm (struct MHD_Connection *restrict c) { -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE if (NULL != c->upgr.c) { mhd_assert ((mhd_HTTP_STAGE_UPGRADED == c->stage) || \ (mhd_HTTP_STAGE_UPGRADED_CLEANING == c->stage)); return true; } -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ // TODO: Support suspended connection @@ -286,7 +286,7 @@ daemon_process_all_active_conns (struct MHD_Daemon *restrict d) } -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE /** * Clean-up all HTTP-Upgraded connections scheduled for clean-up * @param d the daemon to process @@ -318,9 +318,9 @@ daemon_cleanup_upgraded_conns (struct MHD_Daemon *restrict d) } -#else /* ! MHD_UPGRADE_SUPPORT */ +#else /* ! MHD_SUPPORT_UPGRADE */ #define daemon_cleanup_upgraded_conns(d) ((void) d) -#endif /* ! MHD_UPGRADE_SUPPORT */ +#endif /* ! MHD_SUPPORT_UPGRADE */ static void close_all_daemon_conns (struct MHD_Daemon *d) @@ -335,7 +335,7 @@ close_all_daemon_conns (struct MHD_Daemon *d) NULL != c; c = mhd_DLINKEDL_GET_LAST (&(d->conns),all_conn)) { -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE mhd_assert (mhd_HTTP_STAGE_UPGRADING != c->stage); mhd_assert (mhd_HTTP_STAGE_UPGRADED_CLEANING != c->stage); if (NULL != c->upgr.c) @@ -364,7 +364,7 @@ close_all_daemon_conns (struct MHD_Daemon *d) } -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT /** * Add socket to the fd_set @@ -434,7 +434,7 @@ select_update_fdsets (struct MHD_Daemon *restrict d, FD_ZERO (efds); ret = 0; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS mhd_assert (mhd_ITC_IS_VALID (d->threading.itc)); fd_set_wrap (mhd_itc_r_fd (d->threading.itc), rfds, @@ -504,7 +504,7 @@ select_update_statuses_from_fdsets (struct MHD_Daemon *d, return true; #endif /* MHD_FAVOR_SMALL_CODE */ -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS mhd_assert (mhd_ITC_IS_VALID (d->threading.itc)); if (FD_ISSET (mhd_itc_r_fd (d->threading.itc), efds)) { @@ -528,7 +528,7 @@ select_update_statuses_from_fdsets (struct MHD_Daemon *d, if (0 == num_events) return true; #endif /* MHD_FAVOR_SMALL_CODE */ -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ if (MHD_INVALID_SOCKET != d->net.listen.fd) { @@ -679,10 +679,10 @@ get_all_net_updates_by_select (struct MHD_Daemon *restrict d, } -#endif /* MHD_USE_SELECT */ +#endif /* MHD_SUPPORT_SELECT */ -#ifdef MHD_USE_POLL +#ifdef MHD_SUPPORT_POLL static MHD_FN_PAR_NONNULL_ (1) unsigned int poll_update_fds (struct MHD_Daemon *restrict d, @@ -698,7 +698,7 @@ poll_update_fds (struct MHD_Daemon *restrict d, mhd_assert (mhd_POLL_TYPE_POLL == d->events.poll_type); i_s = 0; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS mhd_assert (mhd_ITC_IS_VALID (d->threading.itc)); mhd_assert (d->events.data.poll.fds[i_s].fd == \ mhd_itc_r_fd (d->threading.itc)); @@ -765,7 +765,7 @@ poll_update_statuses_from_fds (struct MHD_Daemon *restrict d, return true; i_s = 0; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS mhd_assert (mhd_ITC_IS_VALID (d->threading.itc)); mhd_assert (d->events.data.poll.fds[i_s].fd == \ mhd_itc_r_fd (d->threading.itc)); @@ -792,7 +792,7 @@ poll_update_statuses_from_fds (struct MHD_Daemon *restrict d, if (0 == num_events) return true; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ if (MHD_INVALID_SOCKET != d->net.listen.fd) { @@ -932,9 +932,9 @@ get_all_net_updates_by_poll (struct MHD_Daemon *restrict d, } -#endif /* MHD_USE_POLL */ +#endif /* MHD_SUPPORT_POLL */ -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL /** * Map events provided by epoll to connection states, ITC and @@ -1059,7 +1059,7 @@ get_all_net_updates_by_epoll (struct MHD_Daemon *restrict d) } -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ static MHD_FN_PAR_NONNULL_ (1) bool @@ -1070,33 +1070,33 @@ process_all_events_and_data (struct MHD_Daemon *restrict d) case mhd_POLL_TYPE_EXT: return false; // TODO: implement break; -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT case mhd_POLL_TYPE_SELECT: if (! get_all_net_updates_by_select (d, false)) return false; break; -#endif /* MHD_USE_SELECT */ -#ifdef MHD_USE_POLL +#endif /* MHD_SUPPORT_SELECT */ +#ifdef MHD_SUPPORT_POLL case mhd_POLL_TYPE_POLL: if (! get_all_net_updates_by_poll (d, false)) return false; break; -#endif /* MHD_USE_POLL */ -#ifdef MHD_USE_EPOLL +#endif /* MHD_SUPPORT_POLL */ +#ifdef MHD_SUPPORT_EPOLL case mhd_POLL_TYPE_EPOLL: if (! get_all_net_updates_by_epoll (d)) return false; break; -#endif /* MHD_USE_EPOLL */ -#ifndef MHD_USE_SELECT +#endif /* MHD_SUPPORT_EPOLL */ +#ifndef MHD_SUPPORT_SELECT case mhd_POLL_TYPE_SELECT: -#endif /* ! MHD_USE_SELECT */ -#ifndef MHD_USE_POLL +#endif /* ! MHD_SUPPORT_SELECT */ +#ifndef MHD_SUPPORT_POLL case mhd_POLL_TYPE_POLL: -#endif /* ! MHD_USE_POLL */ -#ifndef MHD_USE_EPOLL +#endif /* ! MHD_SUPPORT_POLL */ +#ifndef MHD_SUPPORT_EPOLL case mhd_POLL_TYPE_EPOLL: -#endif /* ! MHD_USE_EPOLL */ +#endif /* ! MHD_SUPPORT_EPOLL */ case mhd_POLL_TYPE_NOT_SET_YET: default: mhd_UNREACHABLE (); @@ -1160,19 +1160,19 @@ process_listening_and_itc_only (struct MHD_Daemon *restrict d) { if (false) (void) 0; -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT else if (mhd_POLL_TYPE_SELECT == d->events.poll_type) { return false; // TODO: implement } -#endif /* MHD_USE_SELECT */ -#ifdef MHD_USE_POLL +#endif /* MHD_SUPPORT_SELECT */ +#ifdef MHD_SUPPORT_POLL else if (mhd_POLL_TYPE_POLL == d->events.poll_type) { if (! get_all_net_updates_by_poll (d, true)) return false; } -#endif /* MHD_USE_POLL */ +#endif /* MHD_SUPPORT_POLL */ else { mhd_assert (0 && "Impossible value"); diff --git a/src/mhd2/lib_get_info.c b/src/mhd2/lib_get_info.c index 97e893ff..a30c7316 100644 --- a/src/mhd2/lib_get_info.c +++ b/src/mhd2/lib_get_info.c @@ -41,10 +41,10 @@ #ifdef MHD_ENABLE_HTTPS # include "mhd_tls_choice.h" /* Include all supported TLS backends headers */ -# if defined(MHD_USE_GNUTLS) +# if defined(MHD_SUPPORT_GNUTLS) # include "tls_gnu_funcs.h" # endif -# if defined(MHD_USE_OPENSSL) +# if defined(MHD_SUPPORT_OPENSSL) # include "tls_open_funcs.h" # endif #endif @@ -164,16 +164,16 @@ MHD_lib_get_info_fixed_sz (enum MHD_LibInfoFixed info_type, return_data->v_tls.backend_openssl = MHD_NO; #else return_data->v_tls.tls_supported = MHD_YES; -# ifdef MHD_USE_GNUTLS +# ifdef MHD_SUPPORT_GNUTLS return_data->v_tls.backend_gnutls = MHD_YES; -# else /* ! MHD_USE_GNUTLS */ +# else /* ! MHD_SUPPORT_GNUTLS */ return_data->v_tls.backend_gnutls = MHD_NO; -# endif /* ! MHD_USE_GNUTLS */ -# ifdef MHD_USE_OPENSSL +# endif /* ! MHD_SUPPORT_GNUTLS */ +# ifdef MHD_SUPPORT_OPENSSL return_data->v_tls.backend_openssl = MHD_YES; -# else /* ! MHD_USE_OPENSSL */ +# else /* ! MHD_SUPPORT_OPENSSL */ return_data->v_tls.backend_openssl = MHD_NO; -# endif /* ! MHD_USE_OPENSSL */ +# endif /* ! MHD_SUPPORT_OPENSSL */ #endif return MHD_SC_OK; } diff --git a/src/mhd2/mhd_action.h b/src/mhd2/mhd_action.h index 16badf03..d742ffbe 100644 --- a/src/mhd2/mhd_action.h +++ b/src/mhd2/mhd_action.h @@ -33,7 +33,7 @@ #include "mhd_str_types.h" -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER # include "http_post_enc.h" # include "mhd_bool.h" # include "mhd_post_result.h" @@ -61,25 +61,25 @@ enum mhd_ActionType * Process clients upload by application callback */ mhd_ACTION_UPLOAD -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER , /** * Process POST data clients upload by POST parser */ mhd_ACTION_POST_PARSE -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ , /** * Suspend requests (connection) */ mhd_ACTION_SUSPEND -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE , /** * Perform HTTP "upgrade" */ mhd_ACTION_UPGRADE -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ , /** * Hard close request with no response @@ -143,7 +143,7 @@ struct mhd_UploadCallbacks struct mhd_UploadCallbackData inc; }; -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER #ifndef MHD_POST_DATA_READER_DEFINED typedef const struct MHD_UploadAction * @@ -208,10 +208,10 @@ struct mhd_PostParseActionData void *done_cb_cls; }; -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE struct MHD_UpgradedHandle; /* forward declaration */ @@ -242,7 +242,7 @@ struct mhd_UpgradeActionData void *cb_cls; }; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ /** @@ -260,18 +260,18 @@ union mhd_ActionData */ struct mhd_UploadCallbacks upload; -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER /** * The data for the action #mhd_ACTION_POST_PARSE */ struct mhd_PostParseActionData post_parse; -#endif /* HAVE_POST_PARSER */ -#ifdef MHD_UPGRADE_SUPPORT +#endif /* MHD_SUPPORT_POST_PARSER */ +#ifdef MHD_SUPPORT_UPGRADE /** * The data for "Upgrade" action */ struct mhd_UpgradeActionData upgrd; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ }; @@ -315,13 +315,13 @@ enum mhd_UploadActionType * Suspend requests (connection) */ mhd_UPLOAD_ACTION_SUSPEND -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE , /** * Perform HTTP "upgrade" */ mhd_UPLOAD_ACTION_UPGRADE -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ , /** * Hard close request with no response @@ -346,12 +346,12 @@ union mhd_UploadActionData * The data for the action #mhd_ACTION_RESPONSE */ struct MHD_Response *response; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE /** * The data for "Upgrade" action */ struct mhd_UpgradeActionData upgrd; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ }; /** diff --git a/src/mhd2/mhd_atomic_counter.h b/src/mhd2/mhd_atomic_counter.h index e2ec4743..f0d4f35f 100644 --- a/src/mhd2/mhd_atomic_counter.h +++ b/src/mhd2/mhd_atomic_counter.h @@ -46,20 +46,20 @@ #define mhd_ATOMIC_COUNTER_MAX \ ((mhd_ATOMIC_COUNTER_TYPE) (~((mhd_ATOMIC_COUNTER_TYPE) 0))) -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * Atomic operations are based on locks */ # define mhd_ATOMIC_BY_LOCKS 1 -#else /* ! MHD_USE_THREADS */ +#else /* ! MHD_SUPPORT_THREADS */ /** * Atomic because single thread environment is used */ # define mhd_ATOMIC_SINGLE_THREAD 1 -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ #if defined(mhd_ATOMIC_BY_LOCKS) diff --git a/src/mhd2/mhd_connection.h b/src/mhd2/mhd_connection.h index 44a14b51..a0dadf80 100644 --- a/src/mhd2/mhd_connection.h +++ b/src/mhd2/mhd_connection.h @@ -48,9 +48,9 @@ #include "mhd_request.h" #include "mhd_reply.h" -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE # include "mhd_upgrade.h" -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ #include "mhd_socket_error.h" @@ -205,13 +205,13 @@ enum MHD_FIXED_FLAGS_ENUM_ MHD_ConnectionEventLoopInfo * We are finished and are awaiting cleanup. */ MHD_EVENT_LOOP_INFO_CLEANUP = 1 << 5 -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE , /** * We are finished and are awaiting cleanup. */ MHD_EVENT_LOOP_INFO_UPGRADED = 1 << 6 -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ }; #define MHD_EVENT_LOOP_INFO_PROCESS_READ \ @@ -378,13 +378,13 @@ enum MHD_FIXED_ENUM_ mhd_HttpStage * We have sent the response headers. Get ready to send the body. */ mhd_HTTP_STAGE_HEADERS_SENT -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE , /** * Sending special HTTP "Upgrade" headers */ mhd_HTTP_STAGE_UPGRADE_HEADERS_SENDING -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ , /** * We are waiting for the client to provide more @@ -422,7 +422,7 @@ enum MHD_FIXED_ENUM_ mhd_HttpStage * Shutdown connection or restart processing to get a new request. */ mhd_HTTP_STAGE_FULL_REPLY_SENT -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE , /** * Transition to "Upgraded" state @@ -440,7 +440,7 @@ enum MHD_FIXED_ENUM_ mhd_HttpStage * Closing HTTP-Upgraded connection */ mhd_HTTP_STAGE_UPGRADED_CLEANING -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ , /** * Finished regular connection processing. @@ -541,7 +541,7 @@ struct MHD_Connection */ mhd_DLNKDL_LINKS (MHD_Connection,by_timeout); -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE /** * The data for handling HTTP-Upgraded connection */ @@ -551,7 +551,7 @@ struct MHD_Connection * Double-linke list of HTTP-Upgraded connections waiting for clean-up */ mhd_DLNKDL_LINKS (MHD_Connection,upgr_cleanup); -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ /** * True if connection is suspended @@ -617,7 +617,7 @@ struct MHD_Connection */ char *write_buffer; -#if defined(MHD_USE_THREADS) +#if defined(MHD_SUPPORT_THREADS) /** * Thread handle for this connection (if we are using * one thread per connection). @@ -691,7 +691,7 @@ struct MHD_Connection */ bool discard_request; -#if defined(MHD_USE_THREADS) +#if defined(MHD_SUPPORT_THREADS) /** * Set to `true` if the thread has been joined. */ diff --git a/src/mhd2/mhd_daemon.h b/src/mhd2/mhd_daemon.h index 9686a9b5..4512a996 100644 --- a/src/mhd2/mhd_daemon.h +++ b/src/mhd2/mhd_daemon.h @@ -46,7 +46,7 @@ # include "mhd_tls_choice.h" #endif -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS # include "mhd_threads.h" # include "mhd_itc_types.h" # include "mhd_locks.h" @@ -54,7 +54,7 @@ #include "sys_select.h" #include "sys_poll.h" -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL # include #endif @@ -238,7 +238,7 @@ union mhd_SocketRelation struct MHD_Connection *connection; }; -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT /** * Daemon's pointers to the preallocated arrays for running sockets monitoring @@ -260,9 +260,9 @@ struct mhd_DaemonEventsSelectData fd_set *efds; }; -#endif /* MHD_USE_SELECT */ +#endif /* MHD_SUPPORT_SELECT */ -#ifdef MHD_USE_POLL +#ifdef MHD_SUPPORT_POLL /** * Daemon's pointers to the preallocated arrays for running sockets monitoring @@ -289,9 +289,9 @@ struct mhd_DaemonEventsPollData union mhd_SocketRelation *rel; }; -#endif /* MHD_USE_POLL */ +#endif /* MHD_SUPPORT_POLL */ -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL /** * Daemon's parameters and pointers to the preallocated memory for running * sockets monitoring by epoll. @@ -336,23 +336,23 @@ struct mhd_DaemonEventsExternal */ union mhd_DaemonEventMonitoringTypeSpecificData { -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT /** * Daemon's pointers to the preallocated arrays for running sockets monitoring * by poll(). */ struct mhd_DaemonEventsSelectData select; -#endif /* MHD_USE_SELECT */ +#endif /* MHD_SUPPORT_SELECT */ -#ifdef MHD_USE_POLL +#ifdef MHD_SUPPORT_POLL /** * Daemon's pointers to the preallocated arrays for running sockets monitoring * by poll(). */ struct mhd_DaemonEventsPollData poll; -#endif /* MHD_USE_POLL */ +#endif /* MHD_SUPPORT_POLL */ -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL /** * Daemon's parameters and pointers to the preallocated memory for running * sockets monitoring by epoll. @@ -493,7 +493,7 @@ struct mhd_DaemonNetwork */ struct mhd_ListenSocket listen; -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL /** * The epoll FD. * Set to '-1' when epoll is not used. @@ -581,7 +581,7 @@ struct mhd_DaemonAuthDigestData */ struct mhd_AtomicCounter num_gen_nonces; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * The mutex to change or access the @a nonces data */ @@ -596,7 +596,7 @@ struct mhd_DaemonAuthDigestData #endif /* MHD_SUPPORT_AUTH_DIGEST */ -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * The type of the daemon @@ -667,7 +667,7 @@ enum MHD_FIXED_ENUM_ mhd_DaemonType #define mhd_D_TYPE_HAS_MASTER_DAEMON(t) \ (mhd_DAEMON_TYPE_WORKER == (t)) -#else /* ! MHD_USE_THREADS */ +#else /* ! MHD_SUPPORT_THREADS */ /** * Check whether the daemon type is allowed to have internal thread with @@ -695,9 +695,9 @@ enum MHD_FIXED_ENUM_ mhd_DaemonType */ #define mhd_D_TYPE_HAS_MASTER_DAEMON(t) (0) -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * Workers pool data @@ -791,7 +791,7 @@ struct mhd_DaemonThreadingData struct mhd_DaemonThreadingDataSettings cfg; }; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ /** * Configured settings for the daemon's connections @@ -814,7 +814,7 @@ struct mhd_DaemonConnectionsSettings size_t mem_pool_size; }; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE /** * The data for HTTP-Upgraded connections @@ -827,7 +827,7 @@ struct mhd_DaemonConnectionsUpgraded */ mhd_DLNKDL_LIST (MHD_Connection,upgr_cleanup); -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * The mutex to change or check the @a upgr_cleanup list values */ @@ -835,7 +835,7 @@ struct mhd_DaemonConnectionsUpgraded #endif }; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ /** * Connections handling data @@ -878,12 +878,12 @@ struct mhd_DaemonConnections */ struct mhd_DaemonConnectionsSettings cfg; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE /** * The data for HTTP-Upgraded connections */ struct mhd_DaemonConnectionsUpgraded upgr; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ }; /** @@ -911,7 +911,7 @@ struct mhd_DeamonLargeBuffer */ size_t space_left; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * The mutex to change or check the @a space_left value */ @@ -953,7 +953,7 @@ struct mhd_DaemonRequestProcessingSettings /** * Suppress "Date:" header in responses */ - bool suppress_date; // TODO: set from settings + bool suppress_date; }; @@ -1031,7 +1031,7 @@ struct MHD_Daemon struct mhd_TlsDaemonData *tls; #endif -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /* Threading data */ /** @@ -1088,7 +1088,7 @@ struct MHD_Daemon # define mhd_FD_FITS_DAEMON(d_ptr,fd) (! 0) #endif -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL # define mhd_D_IS_USING_EPOLL(d) \ (mhd_POLL_TYPE_EPOLL == ((d)->events.poll_type)) #else @@ -1102,13 +1102,13 @@ struct MHD_Daemon ((mhd_WM_INT_EXTERNAL_EVENTS_EDGE == (d)->wmode_int) || \ mhd_D_IS_USING_EPOLL (d)) -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS # define mhd_D_HAS_THREADS(d) mhd_WM_INT_HAS_THREADS ((d)->wmode_int) #else # define mhd_D_HAS_THREADS(d) (0) #endif -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS # define mhd_D_HAS_THR_PER_CONN(d) \ (mhd_WM_INT_INTERNAL_EVENTS_THREAD_PER_CONNECTION == \ ((d)->wmode_int)) diff --git a/src/mhd2/mhd_lib_init.c b/src/mhd2/mhd_lib_init.c index 0ab7b657..13e2ee34 100644 --- a/src/mhd2/mhd_lib_init.c +++ b/src/mhd2/mhd_lib_init.c @@ -129,13 +129,13 @@ static volatile size_t mhd_lib_use_counter; * global initialisation (after deinitialisation). */ static volatile bool mhd_lib_fully_inited_once; -# ifdef MHD_USE_THREADS +# ifdef MHD_SUPPORT_THREADS /** * The mutex to control access to full global initialisers and deinitialisers */ static mhd_mutex mhd_init_mutex; -# endif /* MHD_USE_THREADS */ +# endif /* MHD_SUPPORT_THREADS */ #else /* mhd_INIT_LAZY_BY_STATIC */ /* Markers of performed lazy initialisation */ /** diff --git a/src/mhd2/mhd_locks.h b/src/mhd2/mhd_locks.h index 66a2efc0..6a3fc23d 100644 --- a/src/mhd2/mhd_locks.h +++ b/src/mhd2/mhd_locks.h @@ -39,7 +39,7 @@ #include "mhd_sys_options.h" -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS #if defined(mhd_THREADS_KIND_W32) # define mhd_MUTEX_KIND_W32_CS 1 @@ -235,7 +235,7 @@ typedef CRITICAL_SECTION mhd_mutex; MHD_PANIC ("Failed to unlock mutex.\n"); \ } while (0) -#else /* ! MHD_USE_THREADS */ +#else /* ! MHD_SUPPORT_THREADS */ # define mhd_mutex_init(ignored) (! 0) # define mhd_MUTEX_INITIALISER_STAT /* empty */ @@ -247,6 +247,6 @@ typedef CRITICAL_SECTION mhd_mutex; # define mhd_mutex_unlock(ignored) (! 0) # define mhd_mutex_unlock_chk(ignored) (void) 0 -#endif /* ! MHD_USE_THREADS */ +#endif /* ! MHD_SUPPORT_THREADS */ #endif /* ! MHD_LOCKS_H */ diff --git a/src/mhd2/mhd_panic.c b/src/mhd2/mhd_panic.c index 037dcb1b..3fb5c775 100644 --- a/src/mhd2/mhd_panic.c +++ b/src/mhd2/mhd_panic.c @@ -78,7 +78,7 @@ mhd_panic (const char *file, if (NULL != user_panic_handler) user_panic_handler (user_panic_handler_cls, file, func, line, message); -#ifdef HAVE_LOG_FUNCTIONALITY +#ifdef MHD_SUPPORT_LOG_FUNCTIONALITY if (0 == file[0]) fprintf (stderr, "Unrecoverable error detected in GNU libmicrohttpd%s%s\n", @@ -105,6 +105,6 @@ mhd_panic (const char *file, message); } } -#endif /* HAVE_LOG_FUNCTIONALITY */ +#endif /* MHD_SUPPORT_LOG_FUNCTIONALITY */ abort (); } diff --git a/src/mhd2/mhd_panic.h b/src/mhd2/mhd_panic.h index 27c769be..faea11e0 100644 --- a/src/mhd2/mhd_panic.h +++ b/src/mhd2/mhd_panic.h @@ -64,7 +64,7 @@ mhd_panic (const char *file, #error MHD_PANIC macro is already defined. Check other headers. #endif /* MHD_PANIC */ -#ifdef HAVE_LOG_FUNCTIONALITY +#ifdef MHD_SUPPORT_LOG_FUNCTIONALITY # ifdef MHD_HAVE_MHD_FUNC_ /** * Panic processing for unrecoverable errors. diff --git a/src/mhd2/mhd_reply.h b/src/mhd2/mhd_reply.h index cbe682a8..f255b41d 100644 --- a/src/mhd2/mhd_reply.h +++ b/src/mhd2/mhd_reply.h @@ -109,12 +109,12 @@ struct MHD_Reply */ struct MHD_DynamicContentCreatorContext app_act_ctx; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE /** * Set to 'true' when "100 Continue" response has been sent */ bool sent_100_cntn; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ /** * Response to transmit (initially NULL). diff --git a/src/mhd2/mhd_request.h b/src/mhd2/mhd_request.h index 88e3f83c..2eef2815 100644 --- a/src/mhd2/mhd_request.h +++ b/src/mhd2/mhd_request.h @@ -41,7 +41,7 @@ #include "mhd_action.h" #include "mhd_buffer.h" -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER # include "mhd_postfield_int.h" # include "mhd_post_parser.h" #endif @@ -205,7 +205,7 @@ struct mhd_RequestField mhd_DLINKEDL_LIST_DEF (mhd_RequestField); -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER struct mhd_RequestPostField; /* forward declarations */ @@ -238,7 +238,7 @@ struct mhd_RequestPostField mhd_DLINKEDL_LIST_DEF (mhd_RequestPostField); -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ /** @@ -274,12 +274,12 @@ struct mhd_ReqContentData union mhd_ReqContentParsingData { -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER /** * The POST parsing data */ struct mhd_PostParserData post; -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ // TODO: move "raw" upload processing data here }; @@ -394,12 +394,12 @@ struct MHD_Request */ mhd_DLNKDL_LIST (mhd_RequestField,fields); -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER /** * Linked list of parsed POST fields. */ mhd_DLNKDL_LIST (mhd_RequestPostField,post_fields); -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ /** * The action set by the application diff --git a/src/mhd2/mhd_response.h b/src/mhd2/mhd_response.h index f5d177a6..f2abbd49 100644 --- a/src/mhd2/mhd_response.h +++ b/src/mhd2/mhd_response.h @@ -42,7 +42,7 @@ #include "mhd_iovec.h" -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS # include "mhd_locks.h" #endif @@ -129,7 +129,7 @@ struct mhd_ResponseFD */ bool is_pipe; -#ifdef MHD_USE_SENDFILE +#ifdef mhd_USE_SENDFILE /** * Use 'sendfile()' function for the @a FD * Initially 'true' (except for pipes) but can be flipped to 'false' if @@ -212,13 +212,13 @@ struct mhd_ResponseReuseData */ struct mhd_AtomicCounter counter; -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS /** * The mutex for @a settings access. * Used only when @a reusable is 'true'. */ mhd_mutex settings_lock; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ }; struct mhd_ResponseConfiguration diff --git a/src/mhd2/mhd_send.c b/src/mhd2/mhd_send.c index 88178a26..63b4c952 100644 --- a/src/mhd2/mhd_send.c +++ b/src/mhd2/mhd_send.c @@ -1148,7 +1148,7 @@ mhd_send_hdr_and_body (struct MHD_Connection *restrict connection, } -#if defined(MHD_USE_SENDFILE) +#if defined(mhd_USE_SENDFILE) #if defined(HAVE_LINUX_SENDFILE) && defined(HAVE_SENDFILE64) # define mhd_off_t off64_t @@ -1377,7 +1377,7 @@ mhd_send_sendfile (struct MHD_Connection *restrict c, } -#endif /* MHD_USE_SENDFILE */ +#endif /* mhd_USE_SENDFILE */ #if defined(mhd_USE_VECT_SEND) diff --git a/src/mhd2/mhd_send.h b/src/mhd2/mhd_send.h index 8000c063..004f2abf 100644 --- a/src/mhd2/mhd_send.h +++ b/src/mhd2/mhd_send.h @@ -102,7 +102,7 @@ mhd_send_hdr_and_body (struct MHD_Connection *restrict connection, MHD_FN_PAR_NONNULL_(1) MHD_FN_PAR_NONNULL_(3) MHD_FN_PAR_IN_SIZE_ (3,2) MHD_FN_PAR_IN_SIZE_ (6,5) MHD_FN_PAR_OUT_ (8); -#if defined(MHD_USE_SENDFILE) +#if defined(mhd_USE_SENDFILE) /** * Function for sending responses backed by file FD. * diff --git a/src/mhd2/mhd_str.c b/src/mhd2/mhd_str.c index 3484d564..a8a3f107 100644 --- a/src/mhd2/mhd_str.c +++ b/src/mhd2/mhd_str.c @@ -2007,7 +2007,7 @@ mhd_str_equal_caseless_quoted_bin_n (const char *quoted, #endif /* MHD_SUPPORT_AUTH_DIGEST */ -#if defined(MHD_SUPPORT_AUTH_DIGEST) || defined(HAVE_POST_PARSER) +#if defined(MHD_SUPPORT_AUTH_DIGEST) || defined(MHD_SUPPORT_POST_PARSER) MHD_INTERNAL size_t mhd_str_unquote (const char *quoted, @@ -2034,7 +2034,7 @@ mhd_str_unquote (const char *quoted, } -#endif /* MHD_SUPPORT_AUTH_DIGEST HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_AUTH_DIGEST || MHD_SUPPORT_POST_PARSER */ #if defined(MHD_SUPPORT_AUTH_DIGEST) || defined(MHD_SUPPORT_AUTH_BASIC) diff --git a/src/mhd2/mhd_str.h b/src/mhd2/mhd_str.h index 4e70fd61..61cead3d 100644 --- a/src/mhd2/mhd_str.h +++ b/src/mhd2/mhd_str.h @@ -691,7 +691,7 @@ mhd_str_equal_caseless_quoted_bin_n (const char *quoted, #endif /* MHD_SUPPORT_AUTH_DIGEST */ -#if defined(MHD_SUPPORT_AUTH_DIGEST) || defined(HAVE_POST_PARSER) +#if defined(MHD_SUPPORT_AUTH_DIGEST) || defined(MHD_SUPPORT_POST_PARSER) /** * Convert string from quoted to unquoted form as specified by @@ -713,7 +713,7 @@ mhd_str_unquote (const char *quoted, size_t quoted_len, char *result); -#endif /* MHD_SUPPORT_AUTH_DIGEST HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_AUTH_DIGEST || MHD_SUPPORT_POST_PARSER */ #if defined(MHD_SUPPORT_AUTH_DIGEST) || defined(MHD_SUPPORT_AUTH_BASIC) diff --git a/src/mhd2/mhd_threads.c b/src/mhd2/mhd_threads.c index d7b90b52..e65fbb82 100644 --- a/src/mhd2/mhd_threads.c +++ b/src/mhd2/mhd_threads.c @@ -31,23 +31,23 @@ #ifdef mhd_THREADS_KIND_W32 # include #endif -#if defined(MHD_USE_THREAD_NAME_) +#if defined(mhd_USE_THREAD_NAME) # if ! defined(MHD_USE_THREAD_ATTR_SETNAME) # include "sys_malloc.h" # endif # ifdef HAVE_PTHREAD_NP_H # include # endif /* HAVE_PTHREAD_NP_H */ -#endif /* MHD_USE_THREAD_NAME_ */ +#endif /* mhd_USE_THREAD_NAME */ #include "sys_errno.h" #include "mhd_assert.h" -#ifndef MHD_USE_THREAD_NAME_ +#ifndef mhd_USE_THREAD_NAME # define mhd_set_thread_name(t, n) (void) # define mhd_set_cur_thread_name(n) (void) -#else /* MHD_USE_THREAD_NAME_ */ +#else /* mhd_USE_THREAD_NAME */ # if defined(mhd_THREADS_KIND_POSIX) # if defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || \ @@ -171,7 +171,7 @@ mhd_set_thread_name (const mhd_thread_ID_native thread_id, # endif /* _MSC_FULL_VER */ # endif /* mhd_THREADS_KIND_W32 */ -#endif /* MHD_USE_THREAD_NAME_ */ +#endif /* mhd_USE_THREAD_NAME */ /** @@ -268,7 +268,7 @@ mhd_create_thread (mhd_thread_handle_ID *handle_id, } -#ifdef MHD_USE_THREAD_NAME_ +#ifdef mhd_USE_THREAD_NAME # ifndef MHD_USE_THREAD_ATTR_SETNAME struct mhd_named_helper_param @@ -419,4 +419,4 @@ mhd_create_named_thread (mhd_thread_handle_ID *handle_id, } -#endif /* MHD_USE_THREAD_NAME_ */ +#endif /* mhd_USE_THREAD_NAME */ diff --git a/src/mhd2/mhd_threads.h b/src/mhd2/mhd_threads.h index cf4a0094..5ae1c4de 100644 --- a/src/mhd2/mhd_threads.h +++ b/src/mhd2/mhd_threads.h @@ -40,13 +40,13 @@ #if defined(mhd_THREADS_KIND_POSIX) # include -# ifndef MHD_USE_THREADS -# define MHD_USE_THREADS 1 +# ifndef MHD_SUPPORT_THREADS +# define MHD_SUPPORT_THREADS 1 # endif #elif defined(mhd_THREADS_KIND_W32) # include -# ifndef MHD_USE_THREADS -# define MHD_USE_THREADS 1 +# ifndef MHD_SUPPORT_THREADS +# define MHD_SUPPORT_THREADS 1 # endif #else # error No threading API is available. @@ -68,12 +68,12 @@ defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) || \ defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || \ defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) -# define MHD_USE_THREAD_NAME_ +# define mhd_USE_THREAD_NAME # endif /* HAVE_PTHREAD_SETNAME_NP */ # elif defined(mhd_THREADS_KIND_W32) # ifdef _MSC_FULL_VER /* Thread names only available with VC compiler */ -# define MHD_USE_THREAD_NAME_ +# define mhd_USE_THREAD_NAME # endif /* _MSC_FULL_VER */ # endif #endif @@ -520,9 +520,9 @@ mhd_create_thread (mhd_thread_handle_ID *handle_id, mhd_THREAD_START_ROUTINE start_routine, void *arg); -#ifndef MHD_USE_THREAD_NAME_ +#ifndef mhd_USE_THREAD_NAME #define mhd_create_named_thread(t,n,s,r,a) mhd_create_thread ((t),(s),(r),(a)) -#else /* MHD_USE_THREAD_NAME_ */ +#else /* mhd_USE_THREAD_NAME */ /** * Create a named thread and set the attributes according to our options. * @@ -540,6 +540,6 @@ mhd_create_named_thread (mhd_thread_handle_ID *handle_id, mhd_THREAD_START_ROUTINE start_routine, void *arg); -#endif /* MHD_USE_THREAD_NAME_ */ +#endif /* mhd_USE_THREAD_NAME */ #endif /* ! MHD_THREADS_H */ diff --git a/src/mhd2/mhd_tls_choice.h b/src/mhd2/mhd_tls_choice.h index a38d84a9..d59b217b 100644 --- a/src/mhd2/mhd_tls_choice.h +++ b/src/mhd2/mhd_tls_choice.h @@ -49,7 +49,7 @@ /* * GnuTLS * */ -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS /** * Defined to one if GnuTLS is enabled at build time or to zero if not enabled */ @@ -68,7 +68,7 @@ /* * OpenSSL * */ -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL /** * Defined to one if OpenSSL is enabled at build time or to zero if not enabled */ @@ -142,7 +142,7 @@ * The TLS back-end identifier for macro names */ # define mhd_TLS_MACRO_NAME_ID MULTI -#elif defined(MHD_USE_GNUTLS) +#elif defined(MHD_SUPPORT_GNUTLS) /** * The TLS back-end identifier for function names */ @@ -155,7 +155,7 @@ * The TLS back-end identifier for macro names */ # define mhd_TLS_MACRO_NAME_ID GNU -#elif defined(MHD_USE_OPENSSL) +#elif defined(MHD_SUPPORT_OPENSSL) /** * The TLS back-end identifier for function names */ @@ -173,14 +173,14 @@ /* ** Functions replacement macros to simplify the code ** */ -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS /** * Check whether GnuTLS backend was successfully initialised globally */ # define mhd_tls_gnu_is_inited_fine() (! ! 0) #endif -#ifndef MHD_USE_OPENSSL +#ifndef MHD_SUPPORT_OPENSSL /** * Check whether OpenSSL backend was successfully initialised globally */ diff --git a/src/mhd2/mhd_tls_funcs.c b/src/mhd2/mhd_tls_funcs.c index a5af4b28..12ea80dd 100644 --- a/src/mhd2/mhd_tls_funcs.c +++ b/src/mhd2/mhd_tls_funcs.c @@ -29,10 +29,10 @@ #include "mhd_tls_funcs.h" /* Include all supported TLS backends headers */ -#if defined(MHD_USE_GNUTLS) +#if defined(MHD_SUPPORT_GNUTLS) # include "tls_gnu_funcs.h" #endif -#if defined(MHD_USE_OPENSSL) +#if defined(MHD_SUPPORT_OPENSSL) # include "tls_open_funcs.h" #endif @@ -51,13 +51,13 @@ mhd_tls_is_backend_available (struct DaemonOptions *s) || mhd_tls_open_is_inited_fine ()) ? mhd_TLS_BACKEND_AVAIL_OK : mhd_TLS_BACKEND_AVAIL_NOT_AVAILABLE; -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS if (MHD_TLS_BACKEND_GNUTLS == s->tls) return mhd_tls_gnu_is_inited_fine () ? mhd_TLS_BACKEND_AVAIL_OK : mhd_TLS_BACKEND_AVAIL_NOT_AVAILABLE; #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL if (MHD_TLS_BACKEND_OPENSSL == s->tls) return mhd_tls_open_is_inited_fine () ? mhd_TLS_BACKEND_AVAIL_OK : diff --git a/src/mhd2/mhd_tls_funcs.h b/src/mhd2/mhd_tls_funcs.h index 31eb8835..afe074d2 100644 --- a/src/mhd2/mhd_tls_funcs.h +++ b/src/mhd2/mhd_tls_funcs.h @@ -39,9 +39,9 @@ #if defined(MHD_USE_MULTITLS) # include "tls_multi_funcs.h" -#elif defined(MHD_USE_GNUTLS) +#elif defined(MHD_SUPPORT_GNUTLS) # include "tls_gnu_funcs.h" -#elif defined(MHD_USE_OPENSSL) +#elif defined(MHD_SUPPORT_OPENSSL) # include "tls_open_funcs.h" #endif diff --git a/src/mhd2/request_get_value.c b/src/mhd2/request_get_value.c index 358bd954..7ee09b50 100644 --- a/src/mhd2/request_get_value.c +++ b/src/mhd2/request_get_value.c @@ -68,7 +68,7 @@ mhd_request_get_value_n (struct MHD_Request *restrict request, } } -#if HAVE_POST_PARSER +#if MHD_SUPPORT_POST_PARSER if (0 != (MHD_VK_POSTDATA & kind)) { struct mhd_RequestPostField *f; @@ -93,7 +93,7 @@ mhd_request_get_value_n (struct MHD_Request *restrict request, } } } -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ return NULL; } @@ -173,7 +173,7 @@ MHD_request_get_values_cb (struct MHD_Request *request, } } -#if HAVE_POST_PARSER +#if MHD_SUPPORT_POST_PARSER if (0 != (MHD_VK_POSTDATA & kind)) { struct mhd_RequestPostField *f; @@ -202,13 +202,13 @@ MHD_request_get_values_cb (struct MHD_Request *request, } } } -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ return count; } -#if HAVE_POST_PARSER +#if MHD_SUPPORT_POST_PARSER MHD_EXTERN_ MHD_FN_PAR_NONNULL_ (1) size_t @@ -278,4 +278,4 @@ MHD_request_get_post_data_cb (struct MHD_Request *request, } -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ diff --git a/src/mhd2/respond_with_error.h b/src/mhd2/respond_with_error.h index 8eecc4f1..712704b0 100644 --- a/src/mhd2/respond_with_error.h +++ b/src/mhd2/respond_with_error.h @@ -57,7 +57,7 @@ respond_with_error_len (struct MHD_Connection *c, MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_CSTR_ (4) MHD_FN_PAR_CSTR_ (6); -#ifdef HAVE_HTTP_AUTO_MESSAGES_BODIES +#ifdef MHD_ENABLE_AUTO_MESSAGES_BODIES /** * Transmit static string as error response */ diff --git a/src/mhd2/response_from.c b/src/mhd2/response_from.c index 5955f6df..e1067b7b 100644 --- a/src/mhd2/response_from.c +++ b/src/mhd2/response_from.c @@ -335,7 +335,7 @@ MHD_response_from_fd (enum MHD_HTTP_StatusCode sc, res->cntn_dtype = mhd_RESPONSE_CONTENT_DATA_FILE; res->cntn.file.fd = fd; res->cntn.file.offset = offset; -#ifdef MHD_USE_SENDFILE +#ifdef mhd_USE_SENDFILE res->cntn.file.use_sf = (size < MHD_SIZE_UNKNOWN); #endif res->cntn.file.is_pipe = false; /* Not necessary */ @@ -356,7 +356,7 @@ MHD_response_from_pipe (enum MHD_HTTP_StatusCode sc, res->cntn_dtype = mhd_RESPONSE_CONTENT_DATA_FILE; res->cntn.file.fd = fd; res->cntn.file.offset = 0; /* Not necessary */ -#ifdef MHD_USE_SENDFILE +#ifdef mhd_USE_SENDFILE res->cntn.file.use_sf = false; /* Not necessary */ #endif res->cntn.file.is_pipe = true; diff --git a/src/mhd2/stream_funcs.c b/src/mhd2/stream_funcs.c index 6873bf0d..2c4cd983 100644 --- a/src/mhd2/stream_funcs.c +++ b/src/mhd2/stream_funcs.c @@ -32,7 +32,7 @@ #include "mhd_unreachable.h" #include -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL # include #endif #include "sys_malloc.h" @@ -649,9 +649,9 @@ MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_ void mhd_stream_update_activity_mark (struct MHD_Connection *restrict c) { struct MHD_Daemon *const restrict d = c->daemon; -#if defined(MHD_USE_THREADS) +#if defined(MHD_SUPPORT_THREADS) mhd_assert (! mhd_D_HAS_WORKERS (d)); -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ mhd_assert (! c->suspended); @@ -813,12 +813,12 @@ mhd_conn_start_closing (struct MHD_Connection *restrict c, MHD_REQUEST_ENDED_NO_RESOURCES : MHD_REQUEST_ENDED_HTTP_PROTOCOL_ERROR; break; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_CONN_CLOSE_UPGRADE: close_hard = false; end_code = MHD_REQUEST_ENDED_COMPLETED_OK_UPGRADE; break; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ case mhd_CONN_CLOSE_HTTP_COMPLETED: close_hard = false; end_code = MHD_REQUEST_ENDED_COMPLETED_OK; @@ -834,14 +834,14 @@ mhd_conn_start_closing (struct MHD_Connection *restrict c, mhd_assert ((NULL == log_msg) || (MHD_SC_INTERNAL_ERROR != sc)); -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE if (mhd_CONN_CLOSE_UPGRADE == reason) { mhd_assert (mhd_HTTP_STAGE_UPGRADING == c->stage); c->event_loop_info = MHD_EVENT_LOOP_INFO_UPGRADED; } else -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ /* Make changes on the socket early to let the kernel and the remote * to process the changes in parallel. */ if (close_hard) @@ -892,14 +892,14 @@ mhd_conn_start_closing (struct MHD_Connection *restrict c, } } -#ifdef HAVE_LOG_FUNCTIONALITY +#ifdef MHD_SUPPORT_LOG_FUNCTIONALITY if (NULL != log_msg) { mhd_LOG_MSG (c->daemon, sc, log_msg); } -#else /* ! HAVE_LOG_FUNCTIONALITY */ +#else /* ! MHD_SUPPORT_LOG_FUNCTIONALITY */ (void) log_msg; -#endif /* ! HAVE_LOG_FUNCTIONALITY */ +#endif /* ! MHD_SUPPORT_LOG_FUNCTIONALITY */ #if 0 // TODO: notification callback mhd_assert ((mhd_HTTP_STAGE_INIT != c->stage) || (! c->rq.app_aware)); @@ -941,7 +941,7 @@ mhd_conn_pre_clean_part1 (struct MHD_Connection *restrict c) if (NULL != c->rq.cntn.lbuf.data) mhd_daemon_free_lbuf (c->daemon, &(c->rq.cntn.lbuf)); -#ifdef MHD_USE_EPOLL +#ifdef MHD_SUPPORT_EPOLL if (mhd_POLL_TYPE_EPOLL == c->daemon->events.poll_type) { struct epoll_event event; @@ -957,7 +957,7 @@ mhd_conn_pre_clean_part1 (struct MHD_Connection *restrict c) "Failed to remove connection socket from epoll."); } } -#endif /* MHD_USE_EPOLL */ +#endif /* MHD_SUPPORT_EPOLL */ } @@ -970,7 +970,7 @@ mhd_conn_pre_clean (struct MHD_Connection *restrict c) mhd_assert (c->dbg.closing_started); mhd_assert (! c->dbg.pre_cleaned); -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE if (NULL == c->upgr.c) #endif mhd_conn_pre_clean_part1 (c); diff --git a/src/mhd2/stream_funcs.h b/src/mhd2/stream_funcs.h index 248edc92..e45ccda0 100644 --- a/src/mhd2/stream_funcs.h +++ b/src/mhd2/stream_funcs.h @@ -260,7 +260,7 @@ enum mhd_ConnCloseReason mhd_CONN_CLOSE_ERR_REPLY_SENT , -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE /* Transition to another protocol */ /** @@ -270,7 +270,7 @@ enum mhd_ConnCloseReason */ mhd_CONN_CLOSE_UPGRADE , -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ /* Graceful closing */ /** @@ -307,11 +307,11 @@ MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_CSTR_ (3); /** * Abort the stream and log message */ -#ifdef HAVE_LOG_FUNCTIONALITY +#ifdef MHD_SUPPORT_LOG_FUNCTIONALITY # define mhd_STREAM_ABORT(c,r,m) (mhd_conn_start_closing ((c),(r),(m))) -#else /* ! HAVE_LOG_FUNCTIONALITY */ +#else /* ! MHD_SUPPORT_LOG_FUNCTIONALITY */ # define mhd_STREAM_ABORT(c,r,m) (mhd_conn_start_closing ((c),(r),NULL)) -#endif /* ! HAVE_LOG_FUNCTIONALITY */ +#endif /* ! MHD_SUPPORT_LOG_FUNCTIONALITY */ /** * Perform initial clean-up and mark for closing. @@ -361,7 +361,7 @@ MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_CSTR_ (3); #define mhd_conn_start_closing_no_sys_res(c) \ mhd_conn_start_closing ((c), mhd_CONN_CLOSE_NO_SYS_RESOURCES, NULL) -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE /** * Perform initial clean-up and prepare for HTTP Upgrade. * Set the reason to "upgrading". @@ -369,7 +369,7 @@ MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_CSTR_ (3); */ # define mhd_conn_pre_upgrade(c) \ mhd_conn_start_closing ((c), mhd_CONN_CLOSE_UPGRADE, NULL) -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ /** diff --git a/src/mhd2/stream_process_reply.c b/src/mhd2/stream_process_reply.c index 14542877..7b7d6c9f 100644 --- a/src/mhd2/stream_process_reply.c +++ b/src/mhd2/stream_process_reply.c @@ -162,7 +162,7 @@ get_conn_reuse (struct MHD_Connection *c) "keep-alive")) return mhd_CONN_MUST_CLOSE; -#if 0 // def MHD_UPGRADE_SUPPORT // TODO: Implement upgrade support +#if 0 // def MHD_SUPPORT_UPGRADE // TODO: Implement upgrade support /* TODO: Move below the next check when MHD stops closing connections * when response is queued in first callback */ if (NULL != r->upgrade_handler) @@ -174,7 +174,7 @@ get_conn_reuse (struct MHD_Connection *c) mhd_assert (! c->stop_with_error); return mhd_CONN_MUST_UPGRADE; } -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ return mhd_CONN_KEEPALIVE_POSSIBLE; } @@ -206,10 +206,10 @@ is_reply_body_needed (struct MHD_Connection *restrict c, #if 0 /* This check is not needed as upgrade handler is used only with code 101 */ -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE if (NULL != rp.response->upgrade_handler) return RP_BODY_NONE; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ #endif #if 0 @@ -262,10 +262,10 @@ setup_reply_properties (struct MHD_Connection *restrict c) c->rp.props.send_reply_body = (use_rp_body > RP_BODY_HEADERS_ONLY); c->rp.props.use_reply_body_headers = (use_rp_body >= RP_BODY_HEADERS_ONLY); -#if 0 // def MHD_UPGRADE_SUPPORT // TODO: upgrade support +#if 0 // def MHD_SUPPORT_UPGRADE // TODO: upgrade support mhd_assert ( (NULL == r->upgrade_handler) || (RP_BODY_NONE == use_rp_body) ); -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ use_chunked = false; end_by_closing = false; @@ -315,7 +315,7 @@ setup_reply_properties (struct MHD_Connection *restrict c) c->rp.cntn_loc = mhd_REPLY_CNTN_LOC_CONN_BUF; break; } -#ifdef MHD_USE_SENDFILE +#ifdef mhd_USE_SENDFILE if (r->cntn.file.use_sf) { c->rp.cntn_loc = mhd_REPLY_CNTN_LOC_FILE; @@ -680,21 +680,21 @@ build_header_response_inn (struct MHD_Connection *restrict c) mhd_assert ((mhd_CONN_MUST_CLOSE == c->conn_reuse) || \ (mhd_CONN_KEEPALIVE_POSSIBLE == c->conn_reuse) || \ (mhd_CONN_MUST_UPGRADE == c->conn_reuse)); -#if 0 // def MHD_UPGRADE_SUPPORT // TODO: upgrade support +#if 0 // def MHD_SUPPORT_UPGRADE // TODO: upgrade support mhd_assert ((NULL == r->upgrade_handler) || \ (mhd_CONN_MUST_UPGRADE == c->keepalive)); -#else /* ! MHD_UPGRADE_SUPPORT */ +#else /* ! MHD_SUPPORT_UPGRADE */ mhd_assert (mhd_CONN_MUST_UPGRADE != c->conn_reuse); -#endif /* ! MHD_UPGRADE_SUPPORT */ +#endif /* ! MHD_SUPPORT_UPGRADE */ mhd_assert ((! c->rp.props.chunked) || c->rp.props.use_reply_body_headers); mhd_assert ((! c->rp.props.send_reply_body) || \ c->rp.props.use_reply_body_headers); mhd_assert ((! c->rp.props.end_by_closing) || \ (mhd_CONN_MUST_CLOSE == c->conn_reuse)); -#if 0 // def MHD_UPGRADE_SUPPORT // TODO: upgrade support +#if 0 // def MHD_SUPPORT_UPGRADE // TODO: upgrade support mhd_assert (NULL == r->upgrade_handler || \ ! c->rp.props.use_reply_body_headers); -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ check_connection_reply (c); @@ -1214,12 +1214,12 @@ mhd_stream_prep_unchunked_body (struct MHD_Connection *restrict c) c->rp.resp_iov.cnt = r->cntn.iovec.cnt; c->rp.resp_iov.sent = 0; } -#if defined(MHD_USE_SENDFILE) +#if defined(mhd_USE_SENDFILE) else if (mhd_REPLY_CNTN_LOC_FILE == c->rp.cntn_loc) { (void) 0; /* Nothing to do, file should be read directly */ } -#endif /* MHD_USE_SENDFILE */ +#endif /* mhd_USE_SENDFILE */ else { mhd_assert (0 && "Impossible value"); diff --git a/src/mhd2/stream_process_request.c b/src/mhd2/stream_process_request.c index 9b6ede8f..9c686840 100644 --- a/src/mhd2/stream_process_request.c +++ b/src/mhd2/stream_process_request.c @@ -60,9 +60,9 @@ #include "stream_funcs.h" #include "daemon_funcs.h" -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER # include "post_parser_funcs.h" -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ #include "mhd_public_api.h" @@ -2221,7 +2221,7 @@ mhd_stream_get_request_headers (struct MHD_Connection *restrict c, } -#ifdef COOKIE_SUPPORT +#ifdef MHD_SUPPORT_COOKIES /** * Cookie parsing result @@ -2568,7 +2568,7 @@ handle_req_cookie_no_space (struct MHD_Connection *restrict c) } -#endif /* COOKIE_SUPPORT */ +#endif /* MHD_SUPPORT_COOKIES */ MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_ void @@ -2743,7 +2743,7 @@ mhd_stream_parse_request_headers (struct MHD_Connection *restrict c) continue; } -#ifdef COOKIE_SUPPORT +#ifdef MHD_SUPPORT_COOKIES /* "Cookie:" */ if (mhd_str_equal_caseless_n_st (MHD_HTTP_HEADER_COOKIE, f->field.nv.name.cstr, @@ -2758,7 +2758,7 @@ mhd_stream_parse_request_headers (struct MHD_Connection *restrict c) } continue; } -#endif /* COOKIE_SUPPORT */ +#endif /* MHD_SUPPORT_COOKIES */ /* "Expect: 100-continue" */ if (mhd_str_equal_caseless_n_st (MHD_HTTP_HEADER_EXPECT, @@ -2974,7 +2974,7 @@ mhd_stream_call_app_request_cb (struct MHD_Connection *restrict c) } c->stage = mhd_HTTP_STAGE_FULL_REQ_RECEIVED; return true; -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER case mhd_ACTION_POST_PARSE: if (0 == c->rq.cntn.cntn_size) { @@ -2994,16 +2994,16 @@ mhd_stream_call_app_request_cb (struct MHD_Connection *restrict c) } c->stage = mhd_HTTP_STAGE_BODY_RECEIVING; return true; -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ case mhd_ACTION_SUSPEND: c->suspended = true; return false; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_ACTION_UPGRADE: mhd_assert (0 == c->rq.cntn.cntn_size); c->stage = mhd_HTTP_STAGE_UPGRADE_HEADERS_SENDING; return false; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ case mhd_ACTION_ABORT: mhd_conn_start_closing_app_abort (c); return true; @@ -3059,14 +3059,14 @@ mhd_stream_process_upload_action (struct MHD_Connection *restrict c, case mhd_UPLOAD_ACTION_SUSPEND: c->suspended = true; return false; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_UPLOAD_ACTION_UPGRADE: mhd_assert (c->rq.cntn.recv_size == c->rq.cntn.cntn_size); mhd_assert (! c->rq.have_chunked_upload || \ mhd_HTTP_STAGE_FULL_REQ_RECEIVED == c->stage); c->stage = mhd_HTTP_STAGE_UPGRADE_HEADERS_SENDING; return false; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ case mhd_UPLOAD_ACTION_ABORT: mhd_conn_start_closing_app_abort (c); return true; @@ -3287,7 +3287,7 @@ process_request_chunked_body (struct MHD_Connection *restrict c) } mhd_assert (c->rq.app_aware); -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER if (mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act) { size_t size_provided; @@ -3307,7 +3307,7 @@ process_request_chunked_body (struct MHD_Connection *restrict c) c->rq.cntn.recv_size += size_provided; } else -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ if (1) { mhd_assert (mhd_ACTION_UPLOAD == c->rq.app_act.head_act.act); @@ -3421,7 +3421,7 @@ process_request_nonchunked_body (struct MHD_Connection *restrict c) read_buf_reuse = false; state_updated = false; -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER if (mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act) { size_t size_provided; @@ -3448,7 +3448,7 @@ process_request_nonchunked_body (struct MHD_Connection *restrict c) } } else -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ if (1) { mhd_assert (mhd_ACTION_UPLOAD == c->rq.app_act.head_act.act); @@ -3518,10 +3518,10 @@ mhd_stream_call_app_final_upload_cb (struct MHD_Connection *restrict c) mhd_assert (mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act || \ mhd_ACTION_UPLOAD == c->rq.app_act.head_act.act); -#ifdef HAVE_POST_PARSER +#ifdef MHD_SUPPORT_POST_PARSER if (mhd_ACTION_POST_PARSE == c->rq.app_act.head_act.act) return mhd_stream_process_post_finish (c); -#endif /* HAVE_POST_PARSER */ +#endif /* MHD_SUPPORT_POST_PARSER */ mhd_assert (mhd_ACTION_UPLOAD == c->rq.app_act.head_act.act); @@ -3934,12 +3934,12 @@ mhd_stream_check_and_grow_read_buffer_space (struct MHD_Connection *restrict c) case mhd_HTTP_STAGE_FULL_REPLY_SENT: case mhd_HTTP_STAGE_PRE_CLOSING: case mhd_HTTP_STAGE_CLOSED: -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_HTTP_STAGE_UPGRADE_HEADERS_SENDING: case mhd_HTTP_STAGE_UPGRADING: case mhd_HTTP_STAGE_UPGRADED: case mhd_HTTP_STAGE_UPGRADED_CLEANING: -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ default: mhd_UNREACHABLE (); stage = MHD_PROC_RECV_BODY_NORMAL; diff --git a/src/mhd2/stream_process_states.c b/src/mhd2/stream_process_states.c index 20f09647..e5e13f16 100644 --- a/src/mhd2/stream_process_states.c +++ b/src/mhd2/stream_process_states.c @@ -51,9 +51,9 @@ #include "conn_mark_ready.h" -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE # include "upgrade_proc.h" -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_ void mhd_conn_event_loop_state_update (struct MHD_Connection *restrict c) @@ -120,11 +120,11 @@ mhd_conn_event_loop_state_update (struct MHD_Connection *restrict c) mhd_assert (0 && "Impossible value"); mhd_UNREACHABLE (); break; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_HTTP_STAGE_UPGRADE_HEADERS_SENDING: c->event_loop_info = MHD_EVENT_LOOP_INFO_SEND; break; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ case mhd_HTTP_STAGE_UNCHUNKED_BODY_UNREADY: mhd_assert (0 && "Should not be possible"); c->event_loop_info = MHD_EVENT_LOOP_INFO_PROCESS; @@ -150,7 +150,7 @@ mhd_conn_event_loop_state_update (struct MHD_Connection *restrict c) mhd_assert (0 && "Impossible value"); mhd_UNREACHABLE (); break; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_HTTP_STAGE_UPGRADING: mhd_assert (0 && "Impossible value"); mhd_UNREACHABLE (); @@ -163,7 +163,7 @@ mhd_conn_event_loop_state_update (struct MHD_Connection *restrict c) mhd_assert (0 && "Should be unreachable"); c->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP; break; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ case mhd_HTTP_STAGE_PRE_CLOSING: mhd_assert (0 && "Should be unreachable"); c->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP; @@ -269,9 +269,9 @@ mhd_conn_process_data (struct MHD_Connection *restrict c) } daemon_closing = (mhd_DAEMON_STATE_STOPPING == d->state); -#ifdef MHD_USE_THREADS +#ifdef MHD_SUPPORT_THREADS daemon_closing = daemon_closing || d->threading.stop_requested; -#endif /* MHD_USE_THREADS */ +#endif /* MHD_SUPPORT_THREADS */ if (daemon_closing) { mhd_conn_start_closing_d_shutdown (c); @@ -329,9 +329,9 @@ mhd_conn_process_data (struct MHD_Connection *restrict c) if (c->continue_message_write_offset == mhd_SSTR_LEN (mdh_HTTP_1_1_100_CONTINUE_REPLY)) { -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE c->rp.sent_100_cntn = true; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ c->stage = mhd_HTTP_STAGE_BODY_RECEIVING; continue; } @@ -406,12 +406,12 @@ mhd_conn_process_data (struct MHD_Connection *restrict c) else c->stage = mhd_HTTP_STAGE_FULL_REPLY_SENT; continue; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_HTTP_STAGE_UPGRADE_HEADERS_SENDING: if (! mhd_upgrade_try_start_upgrading (c)) break; continue; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ case mhd_HTTP_STAGE_UNCHUNKED_BODY_READY: mhd_assert (c->rp.props.send_reply_body); mhd_assert (! c->rp.props.chunked); @@ -469,7 +469,7 @@ mhd_conn_process_data (struct MHD_Connection *restrict c) && ! c->discard_request && ! c->sk.state.rmt_shut_wr); continue; -#ifdef MHD_UPGRADE_SUPPORT +#ifdef MHD_SUPPORT_UPGRADE case mhd_HTTP_STAGE_UPGRADING: if (mhd_upgrade_finish_switch_to_upgraded (c)) return true; /* Do not close connection */ @@ -483,7 +483,7 @@ mhd_conn_process_data (struct MHD_Connection *restrict c) mhd_assert (0 && "Should be unreachable"); mhd_UNREACHABLE (); break; -#endif /* MHD_UPGRADE_SUPPORT */ +#endif /* MHD_SUPPORT_UPGRADE */ case mhd_HTTP_STAGE_PRE_CLOSING: return false; case mhd_HTTP_STAGE_CLOSED: diff --git a/src/mhd2/sys_poll.h b/src/mhd2/sys_poll.h index ce37c9f3..3cd197de 100644 --- a/src/mhd2/sys_poll.h +++ b/src/mhd2/sys_poll.h @@ -32,7 +32,7 @@ #include "mhd_sys_options.h" -#ifdef MHD_USE_POLL +#ifdef MHD_SUPPORT_POLL # include "mhd_socket_type.h" # if defined(MHD_SOCKETS_KIND_POSIX) # include @@ -81,6 +81,6 @@ # define MHD_POLLHUP_ON_REM_SHUT_WR 1 # endif -#endif /* MHD_USE_POLL */ +#endif /* MHD_SUPPORT_POLL */ #endif /* ! MHD_SYS_POLL_H */ diff --git a/src/mhd2/sys_select.h b/src/mhd2/sys_select.h index a4301410..2582e049 100644 --- a/src/mhd2/sys_select.h +++ b/src/mhd2/sys_select.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifdef MHD_USE_SELECT +#ifdef MHD_SUPPORT_SELECT # include "mhd_socket_type.h" # if defined(MHD_SOCKETS_KIND_POSIX) # ifdef HAVE_SYS_SELECT_H @@ -56,6 +56,6 @@ #error Uknown sockets type # endif -#endif /* MHD_USE_SELECT */ +#endif /* MHD_SUPPORT_SELECT */ #endif /* ! MHD_SYS_SELECT_H */ diff --git a/src/mhd2/sys_sendfile.h b/src/mhd2/sys_sendfile.h index 50a9734d..e6cf5fdb 100644 --- a/src/mhd2/sys_sendfile.h +++ b/src/mhd2/sys_sendfile.h @@ -42,8 +42,8 @@ # include # endif # include -#elif defined(MHD_USE_SENDFILE) -#error MHD_USE_SENDFILE is defined, while no HAVE_xxx_SENDFILE defined +#elif defined(mhd_USE_SENDFILE) +#error mhd_USE_SENDFILE is defined, while no HAVE_xxx_SENDFILE defined #endif #endif /* ! MHD_SYS_SENDFILE_H */ diff --git a/src/mhd2/tls_gnu_conn_data.h b/src/mhd2/tls_gnu_conn_data.h index b3ec5526..4ff41927 100644 --- a/src/mhd2/tls_gnu_conn_data.h +++ b/src/mhd2/tls_gnu_conn_data.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS #error This header can be used only if GnuTLS is enabled #endif diff --git a/src/mhd2/tls_gnu_daemon_data.h b/src/mhd2/tls_gnu_daemon_data.h index eec4e85b..af6b07f3 100644 --- a/src/mhd2/tls_gnu_daemon_data.h +++ b/src/mhd2/tls_gnu_daemon_data.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS #error This header can be used only if GnuTLS is enabled #endif diff --git a/src/mhd2/tls_gnu_funcs.h b/src/mhd2/tls_gnu_funcs.h index 80a4f2bf..1934977f 100644 --- a/src/mhd2/tls_gnu_funcs.h +++ b/src/mhd2/tls_gnu_funcs.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS #error This header can be used only if GnuTLS is enabled #endif diff --git a/src/mhd2/tls_gnu_tls_lib.h b/src/mhd2/tls_gnu_tls_lib.h index 44c78167..51719c94 100644 --- a/src/mhd2/tls_gnu_tls_lib.h +++ b/src/mhd2/tls_gnu_tls_lib.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS #error This header can be used only if GnuTLS is enabled #endif diff --git a/src/mhd2/tls_multi_conn_data.h b/src/mhd2/tls_multi_conn_data.h index 446b9640..395163c7 100644 --- a/src/mhd2/tls_multi_conn_data.h +++ b/src/mhd2/tls_multi_conn_data.h @@ -35,10 +35,10 @@ #error This header can be used only if MultiTLS is enabled #endif -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS struct mhd_TlsGnuConnData; /* forward declaration */ #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL struct mhd_TlsOpenConnData; /* forward declaration */ #endif @@ -47,13 +47,13 @@ struct mhd_TlsOpenConnData; /* forward declaration */ */ struct mhd_TlsMultiConnRoutePtr { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS /** * Pointer to GnuTLS connection-specific data */ struct mhd_TlsGnuConnData *gnutls; #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL /** * Pointer to OpenSSL connection-specific data */ diff --git a/src/mhd2/tls_multi_daemon_data.h b/src/mhd2/tls_multi_daemon_data.h index c2356f8a..36ae22a6 100644 --- a/src/mhd2/tls_multi_daemon_data.h +++ b/src/mhd2/tls_multi_daemon_data.h @@ -35,10 +35,10 @@ #error This header can be used only if MultiTLS is enabled #endif -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS struct mhd_TlsGnuDaemonData; /* forward declaration */ #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL struct mhd_TlsOpenDaemonData; /* forward declaration */ #endif @@ -47,13 +47,13 @@ struct mhd_TlsOpenDaemonData; /* forward declaration */ */ struct mhd_TlsMultiDaemonRoutePtr { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS /** * Pointer to GnuTLS daemon-specific data */ struct mhd_TlsGnuDaemonData *gnutls; #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL /** * Pointer to OpenSSL daemon-specific data */ diff --git a/src/mhd2/tls_multi_funcs.c b/src/mhd2/tls_multi_funcs.c index f75a89b6..6cef3b03 100644 --- a/src/mhd2/tls_multi_funcs.c +++ b/src/mhd2/tls_multi_funcs.c @@ -43,10 +43,10 @@ #include "tls_multi_funcs.h" /* Include all supported TLS backends headers */ -#if defined(MHD_USE_GNUTLS) +#if defined(MHD_SUPPORT_GNUTLS) # include "tls_gnu_funcs.h" #endif -#if defined(MHD_USE_OPENSSL) +#if defined(MHD_SUPPORT_OPENSSL) # include "tls_open_funcs.h" #endif @@ -77,10 +77,10 @@ MHD_INTERNAL void mhd_tls_multi_global_init_once (void) { -#if defined(MHD_USE_GNUTLS) +#if defined(MHD_SUPPORT_GNUTLS) mhd_tls_gnu_global_init_once (); #endif -#if defined(MHD_USE_OPENSSL) +#if defined(MHD_SUPPORT_OPENSSL) mhd_tls_open_global_init_once (); #endif } @@ -90,10 +90,10 @@ MHD_INTERNAL void mhd_tls_multi_global_deinit (void) { /* Note: the order is reversed to match the initialisation */ -#if defined(MHD_USE_OPENSSL) +#if defined(MHD_SUPPORT_OPENSSL) mhd_tls_open_global_deinit (); #endif -#if defined(MHD_USE_GNUTLS) +#if defined(MHD_SUPPORT_GNUTLS) mhd_tls_gnu_global_deinit (); #endif } @@ -102,10 +102,10 @@ mhd_tls_multi_global_deinit (void) MHD_INTERNAL void mhd_tls_multi_global_re_init (void) { -#if defined(MHD_USE_GNUTLS) +#if defined(MHD_SUPPORT_GNUTLS) mhd_tls_gnu_global_re_init (); #endif -#if defined(MHD_USE_OPENSSL) +#if defined(MHD_SUPPORT_OPENSSL) mhd_tls_open_global_re_init (); #endif } @@ -122,26 +122,26 @@ mhd_tls_multi_is_edge_trigg_supported (struct DaemonOptions *s) mhd_UNREACHABLE (); return false; case MHD_TLS_BACKEND_ANY: -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS if (mhd_tls_gnu_is_edge_trigg_supported (s) && mhd_tls_gnu_is_inited_fine ()) return true; #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL if (mhd_tls_open_is_edge_trigg_supported (s) && mhd_tls_open_is_inited_fine ()) return true; #endif return false; case MHD_TLS_BACKEND_GNUTLS: -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS /* Ignore "backend inited" status here, it will be checked on daemon TLS init */ return mhd_tls_gnu_is_edge_trigg_supported (s); #endif break; case MHD_TLS_BACKEND_OPENSSL: -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL /* Ignore "backend inited" status here, it will be checked on daemon TLS init */ return mhd_tls_open_is_edge_trigg_supported (s); @@ -175,13 +175,13 @@ tls_daemon_init_try (enum mhd_TlsMultiRoute route, { mhd_StatusCodeInt res; -#ifndef MHD_USE_OPENSSL +#ifndef MHD_SUPPORT_OPENSSL (void) sk_edge_trigg; /* Unused, mute compiler warning */ -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ switch (route) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: if (! mhd_tls_gnu_is_inited_fine ()) return MHD_SC_TLS_BACKEND_UNAVAILABLE; @@ -200,7 +200,7 @@ tls_daemon_init_try (enum mhd_TlsMultiRoute route, "the daemon, error code: %u", (unsigned) res); return res; #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: if (! mhd_tls_open_is_inited_fine ()) return MHD_SC_TLS_BACKEND_UNAVAILABLE; @@ -252,10 +252,10 @@ mhd_tls_multi_daemon_init (struct MHD_Daemon *restrict d, { size_t i; enum mhd_TlsMultiRoute backends[] = { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS mhd_TLS_MULTI_ROUTE_GNU, #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL mhd_TLS_MULTI_ROUTE_OPEN, #endif mhd_TLS_MULTI_ROUTE_NONE /* Not used */ @@ -273,7 +273,7 @@ mhd_tls_multi_daemon_init (struct MHD_Daemon *restrict d, } } break; -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: mhd_assert (mhd_tls_gnu_is_inited_fine ()); /* Must be checked earlier */ res = tls_daemon_init_try (mhd_TLS_MULTI_ROUTE_GNU, @@ -282,8 +282,8 @@ mhd_tls_multi_daemon_init (struct MHD_Daemon *restrict d, s, d_tls); break; -#endif /* MHD_USE_GNUTLS */ -#ifdef MHD_USE_OPENSSL +#endif /* MHD_SUPPORT_GNUTLS */ +#ifdef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: mhd_assert (mhd_tls_open_is_inited_fine ()); /* Must be checked earlier */ res = tls_daemon_init_try (mhd_TLS_MULTI_ROUTE_OPEN, @@ -291,15 +291,15 @@ mhd_tls_multi_daemon_init (struct MHD_Daemon *restrict d, sk_edge_trigg, s, d_tls); -#endif /* MHD_USE_OPENSSL */ +#endif /* MHD_SUPPORT_OPENSSL */ break; -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case MHD_TLS_BACKEND_NONE: default: mhd_UNREACHABLE (); @@ -323,22 +323,22 @@ mhd_tls_multi_daemon_deinit (struct mhd_TlsMultiDaemonData *restrict d_tls) { switch (d_tls->choice) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: mhd_tls_gnu_daemon_deinit (d_tls->data.gnutls); break; #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: mhd_tls_open_daemon_deinit (d_tls->data.openssl); break; #endif -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case mhd_TLS_MULTI_ROUTE_NONE: default: mhd_UNREACHABLE (); @@ -358,22 +358,22 @@ mhd_tls_multi_conn_get_tls_size (struct mhd_TlsMultiDaemonData *restrict d_tls) data_size = sizeof(struct mhd_TlsMultiConnData); switch (d_tls->choice) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: data_size += mhd_tls_gnu_conn_get_tls_size (d_tls->data.gnutls); break; #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: data_size += mhd_tls_open_conn_get_tls_size (d_tls->data.openssl); break; #endif -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case mhd_TLS_MULTI_ROUTE_NONE: default: mhd_UNREACHABLE (); @@ -392,7 +392,7 @@ mhd_tls_multi_conn_init (const struct mhd_TlsMultiDaemonData *restrict d_tls, c_tls->choice = d_tls->choice; switch (c_tls->choice) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: /* Assume the same alignment requirements for both structures */ c_tls->data.gnutls = (struct mhd_TlsGnuConnData *) (c_tls + 1); @@ -400,7 +400,7 @@ mhd_tls_multi_conn_init (const struct mhd_TlsMultiDaemonData *restrict d_tls, sk, c_tls->data.gnutls); #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: /* Assume the same alignment requirements for both structures */ c_tls->data.openssl = (struct mhd_TlsOpenConnData *) (c_tls + 1); @@ -408,12 +408,12 @@ mhd_tls_multi_conn_init (const struct mhd_TlsMultiDaemonData *restrict d_tls, sk, c_tls->data.openssl); #endif -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case mhd_TLS_MULTI_ROUTE_NONE: default: mhd_UNREACHABLE (); @@ -434,22 +434,22 @@ mhd_tls_multi_conn_deinit (struct mhd_TlsMultiConnData *restrict c_tls) { switch (c_tls->choice) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: mhd_tls_gnu_conn_deinit (c_tls->data.gnutls); break; #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: mhd_tls_open_conn_deinit (c_tls->data.openssl); break; #endif -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case mhd_TLS_MULTI_ROUTE_NONE: default: mhd_UNREACHABLE (); @@ -465,20 +465,20 @@ mhd_tls_multi_conn_handshake (struct mhd_TlsMultiConnData *restrict c_tls) { switch (c_tls->choice) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: return mhd_tls_gnu_conn_handshake (c_tls->data.gnutls); #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: return mhd_tls_open_conn_handshake (c_tls->data.openssl); #endif -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case mhd_TLS_MULTI_ROUTE_NONE: default: mhd_UNREACHABLE (); @@ -494,20 +494,20 @@ mhd_tls_multi_conn_shutdown (struct mhd_TlsMultiConnData *restrict c_tls) { switch (c_tls->choice) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: return mhd_tls_gnu_conn_shutdown (c_tls->data.gnutls); #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: return mhd_tls_open_conn_shutdown (c_tls->data.openssl); #endif -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case mhd_TLS_MULTI_ROUTE_NONE: default: mhd_UNREACHABLE (); @@ -529,26 +529,26 @@ mhd_tls_multi_conn_recv (struct mhd_TlsMultiConnData *restrict c_tls, { switch (c_tls->choice) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: return mhd_tls_gnu_conn_recv (c_tls->data.gnutls, buf_size, buf, received); #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: return mhd_tls_open_conn_recv (c_tls->data.openssl, buf_size, buf, received); #endif -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case mhd_TLS_MULTI_ROUTE_NONE: default: mhd_UNREACHABLE (); @@ -563,20 +563,20 @@ mhd_tls_multi_conn_has_data_in (struct mhd_TlsMultiConnData *restrict c_tls) { switch (c_tls->choice) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: return mhd_tls_gnu_conn_has_data_in (c_tls->data.gnutls); #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: return mhd_tls_open_conn_has_data_in (c_tls->data.openssl); #endif -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case mhd_TLS_MULTI_ROUTE_NONE: default: mhd_UNREACHABLE (); @@ -596,26 +596,26 @@ mhd_tls_multi_conn_send (struct mhd_TlsMultiConnData *restrict c_tls, { switch (c_tls->choice) { -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS case mhd_TLS_MULTI_ROUTE_GNU: return mhd_tls_gnu_conn_send (c_tls->data.gnutls, buf_size, buf, sent); #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL case mhd_TLS_MULTI_ROUTE_OPEN: return mhd_tls_open_conn_send (c_tls->data.openssl, buf_size, buf, sent); #endif -#ifndef MHD_USE_GNUTLS +#ifndef MHD_SUPPORT_GNUTLS case MHD_TLS_BACKEND_GNUTLS: -#endif /* ! MHD_USE_GNUTLS */ -#ifndef MHD_USE_OPENSSL +#endif /* ! MHD_SUPPORT_GNUTLS */ +#ifndef MHD_SUPPORT_OPENSSL case MHD_TLS_BACKEND_OPENSSL: -#endif /* ! MHD_USE_OPENSSL */ +#endif /* ! MHD_SUPPORT_OPENSSL */ case mhd_TLS_MULTI_ROUTE_NONE: default: mhd_UNREACHABLE (); diff --git a/src/mhd2/tls_multi_tls_lib.h b/src/mhd2/tls_multi_tls_lib.h index 12ecea45..eb60b74a 100644 --- a/src/mhd2/tls_multi_tls_lib.h +++ b/src/mhd2/tls_multi_tls_lib.h @@ -45,14 +45,14 @@ enum mhd_TlsMultiRoute * Invalid value if TLS is used. */ mhd_TLS_MULTI_ROUTE_NONE = 0 -#ifdef MHD_USE_GNUTLS +#ifdef MHD_SUPPORT_GNUTLS , /** * Use GnuTLS backend */ mhd_TLS_MULTI_ROUTE_GNU #endif -#ifdef MHD_USE_OPENSSL +#ifdef MHD_SUPPORT_OPENSSL , /** * Use OpenSSL backend diff --git a/src/mhd2/tls_open_conn_data.h b/src/mhd2/tls_open_conn_data.h index 162cd88c..b2043143 100644 --- a/src/mhd2/tls_open_conn_data.h +++ b/src/mhd2/tls_open_conn_data.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifndef MHD_USE_OPENSSL +#ifndef MHD_SUPPORT_OPENSSL #error This header can be used only if GnuTLS is enabled #endif diff --git a/src/mhd2/tls_open_daemon_data.h b/src/mhd2/tls_open_daemon_data.h index 112462f1..2e3bff02 100644 --- a/src/mhd2/tls_open_daemon_data.h +++ b/src/mhd2/tls_open_daemon_data.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifndef MHD_USE_OPENSSL +#ifndef MHD_SUPPORT_OPENSSL #error This header can be used only if GnuTLS is enabled #endif diff --git a/src/mhd2/tls_open_funcs.c b/src/mhd2/tls_open_funcs.c index 6b05e3ca..c58160a6 100644 --- a/src/mhd2/tls_open_funcs.c +++ b/src/mhd2/tls_open_funcs.c @@ -417,7 +417,7 @@ daemon_init_ctx (struct MHD_Daemon *restrict d, { uint64_t ctx_opts; -#ifndef HAVE_LOG_FUNCTIONALITY +#ifndef MHD_SUPPORT_LOG_FUNCTIONALITY (void) d; /* Mute compiler warning */ #endif (void) s; // TODO: support configuration options diff --git a/src/mhd2/tls_open_funcs.h b/src/mhd2/tls_open_funcs.h index 4f37c380..40c2151f 100644 --- a/src/mhd2/tls_open_funcs.h +++ b/src/mhd2/tls_open_funcs.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifndef MHD_USE_OPENSSL +#ifndef MHD_SUPPORT_OPENSSL #error This header can be used only if OpenSSL is enabled #endif diff --git a/src/mhd2/tls_open_tls_lib.h b/src/mhd2/tls_open_tls_lib.h index 13dbf906..bb19bbf2 100644 --- a/src/mhd2/tls_open_tls_lib.h +++ b/src/mhd2/tls_open_tls_lib.h @@ -29,7 +29,7 @@ #include "mhd_sys_options.h" -#ifndef MHD_USE_OPENSSL +#ifndef MHD_SUPPORT_OPENSSL #error This header can be used only if GnuTLS is enabled #endif diff --git a/src/mhd2/upgraded_net.c b/src/mhd2/upgraded_net.c index ab37e96f..0a0e5d32 100644 --- a/src/mhd2/upgraded_net.c +++ b/src/mhd2/upgraded_net.c @@ -32,7 +32,7 @@ #include "sys_base_types.h" #include "sys_poll.h" -#ifndef MHD_USE_POLL +#ifndef MHD_SUPPORT_POLL # include "sys_select.h" #endif #include "mhd_limits.h" @@ -50,8 +50,8 @@ #include "mhd_public_api.h" -#if ! defined (MHD_USE_POLL) && \ - (defined(MHD_SOCKETS_KIND_POSIX) || ! defined(MHD_USE_SELECT)) +#if ! defined (MHD_SUPPORT_POLL) && \ + (defined(MHD_SOCKETS_KIND_POSIX) || ! defined(MHD_SUPPORT_SELECT)) # if defined(_WIN32) || defined(HAVE_NANOSLEEP) || defined(HAVE_USLEEP) # define mhd_HAVE_MHD_SLEEP 1 @@ -95,7 +95,8 @@ mhd_sleep (uint_fast32_t millisec) #endif /* _WIN32 || HAVE_NANOSLEEP || HAVE_USLEEP */ -#endif /* ! MHD_USE_POLL) && (MHD_SOCKETS_KIND_POSIX || ! MHD_USE_SELECT) */ +#endif /* ! MHD_SUPPORT_POLL && + (MHD_SOCKETS_KIND_POSIX || ! MHD_SUPPORT_SELECT) */ MHD_EXTERN_ @@ -109,9 +110,9 @@ MHD_upgraded_recv (struct MHD_UpgradedHandle *MHD_RESTRICT urh, uint_fast64_t max_wait_millisec) { struct MHD_Connection *restrict c = urh->c; -#if defined(MHD_USE_POLL) || defined(MHD_USE_SELECT) +#if defined(MHD_SUPPORT_POLL) || defined(MHD_SUPPORT_SELECT) const MHD_Socket socket_fd = c->sk.fd; -#endif /* MHD_USE_POLL || MHD_USE_SELECT */ +#endif /* MHD_SUPPORT_POLL || MHD_SUPPORT_SELECT */ char *restrict buf_char = (char *) recv_buf; size_t last_block_size; enum mhd_SocketError res; @@ -178,7 +179,7 @@ MHD_upgraded_recv (struct MHD_UpgradedHandle *MHD_RESTRICT urh, { while (0 != max_wait_millisec) { -#if defined(MHD_USE_POLL) +#if defined(MHD_SUPPORT_POLL) if (1) { struct pollfd fds[1]; @@ -216,8 +217,8 @@ MHD_upgraded_recv (struct MHD_UpgradedHandle *MHD_RESTRICT urh, } max_wait_millisec = 0; /* Re-try only one time */ } -#else /* ! MHD_USE_POLL */ -# if defined(MHD_USE_SELECT) +#else /* ! MHD_SUPPORT_POLL */ +# if defined(MHD_SUPPORT_SELECT) bool use_select; # ifdef MHD_SOCKETS_KIND_POSIX use_select = (sk.fd < FD_SETSIZE); @@ -270,7 +271,7 @@ MHD_upgraded_recv (struct MHD_UpgradedHandle *MHD_RESTRICT urh, max_wait_millisec = 0; /* Re-try only one time */ } else /* combined with the next 'if()' */ -# endif /* MHD_USE_SELECT */ +# endif /* MHD_SUPPORT_SELECT */ if (1) { # ifndef mhd_HAVE_MHD_SLEEP @@ -286,7 +287,7 @@ MHD_upgraded_recv (struct MHD_UpgradedHandle *MHD_RESTRICT urh, max_wait_millisec -= wait_millisec; # endif /* mhd_HAVE_MHD_SLEEP */ } -#endif /* ! MHD_USE_POLL */ +#endif /* ! MHD_SUPPORT_POLL */ last_block_size = 0; res = mhd_recv (c, recv_buf_size - *received_size, @@ -326,9 +327,9 @@ MHD_upgraded_send (struct MHD_UpgradedHandle *MHD_RESTRICT urh, enum MHD_Bool more_data_to_come) { struct MHD_Connection *restrict c = urh->c; -#if defined(MHD_USE_POLL) || defined(MHD_USE_SELECT) +#if defined(MHD_SUPPORT_POLL) || defined(MHD_SUPPORT_SELECT) const MHD_Socket socket_fd = c->sk.fd; -#endif /* MHD_USE_POLL || MHD_USE_SELECT */ +#endif /* MHD_SUPPORT_POLL || MHD_SUPPORT_SELECT */ const char *restrict buf_char = (const char *) send_buf; const bool push_data = (MHD_NO == more_data_to_come); bool finish_time_set; @@ -350,9 +351,9 @@ MHD_upgraded_send (struct MHD_UpgradedHandle *MHD_RESTRICT urh, enum mhd_SocketError res; size_t last_block_size; uint_fast64_t wait_left; -#if ! defined(MHD_USE_POLL) && defined(MHD_USE_SELECT) +#if ! defined(MHD_SUPPORT_POLL) && defined(MHD_SUPPORT_SELECT) bool use_select; -#endif /* ! MHD_USE_POLL */ +#endif /* ! MHD_SUPPORT_POLL */ last_block_size = 0; res = mhd_send_data (c, @@ -407,7 +408,7 @@ MHD_upgraded_send (struct MHD_UpgradedHandle *MHD_RESTRICT urh, } } -#if defined(MHD_USE_POLL) +#if defined(MHD_SUPPORT_POLL) if (1) { struct pollfd fds[1]; @@ -449,8 +450,8 @@ MHD_upgraded_send (struct MHD_UpgradedHandle *MHD_RESTRICT urh, ! mhd_SCKT_ERR_IS_LOW_RESOURCES (wait_err)) return MHD_SC_UPGRADED_NET_HARD_ERROR; } -#else /* ! MHD_USE_POLL */ -# if defined(MHD_USE_SELECT) +#else /* ! MHD_SUPPORT_POLL */ +# if defined(MHD_SUPPORT_SELECT) # ifdef MHD_SOCKETS_KIND_POSIX use_select = (sk.fd < FD_SETSIZE); # else /* MHD_SOCKETS_KIND_WINSOCK */ @@ -516,7 +517,7 @@ MHD_upgraded_send (struct MHD_UpgradedHandle *MHD_RESTRICT urh, return MHD_SC_UPGRADED_NET_HARD_ERROR; } else /* combined with the next 'if()' */ -# endif /* MHD_USE_SELECT */ +# endif /* MHD_SUPPORT_SELECT */ if (1) { # ifndef mhd_HAVE_MHD_SLEEP @@ -530,7 +531,7 @@ MHD_upgraded_send (struct MHD_UpgradedHandle *MHD_RESTRICT urh, mhd_sleep (wait_millisec); # endif /* mhd_HAVE_MHD_SLEEP */ } -#endif /* ! MHD_USE_POLL */ +#endif /* ! MHD_SUPPORT_POLL */ } return MHD_SC_OK; diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am index 65c39be8..39dba6e5 100644 --- a/src/microhttpd/Makefile.am +++ b/src/microhttpd/Makefile.am @@ -162,7 +162,7 @@ libmicrohttpd_la_SOURCES += \ tsearch.c tsearch.h endif -if HAVE_POST_PARSER +if MHD_SUPPORT_POST_PARSER libmicrohttpd_la_SOURCES += \ postprocessor.c postprocessor.h endif @@ -258,7 +258,7 @@ check_PROGRAMS += \ endif if HAVE_POSIX_THREADS -if MHD_UPGRADE_SUPPORT +if MHD_SUPPORT_UPGRADE if USE_THREADS check_PROGRAMS += test_upgrade test_upgrade_large test_upgrade_vlarge if MHD_ENABLE_HTTPS @@ -270,7 +270,7 @@ endif endif endif -if HAVE_POST_PARSER +if MHD_SUPPORT_POST_PARSER check_PROGRAMS += \ test_postprocessor \ test_postprocessor_large \ @@ -295,7 +295,7 @@ endif endif if MHD_SUPPORT_AUTH -if HAVE_LOG_FUNCTIONALITY +if MHD_SUPPORT_LOG_FUNCTIONALITY check_PROGRAMS += \ test_auth_parse endif diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am index 1c7acf86..b81bc4c7 100644 --- a/src/testcurl/Makefile.am +++ b/src/testcurl/Makefile.am @@ -149,7 +149,7 @@ check_PROGRAMS = \ test_put_header_double_fold_large \ $(EMPTY_ITEM) -if ENABLE_COOKIE +if MHD_SUPPORT_COOKIES check_PROGRAMS += \ test_parse_cookies_discp_p2 \ test_parse_cookies_discp_p1 \ @@ -169,7 +169,7 @@ check_PROGRAMS += \ test_basicauth_oldapi test_basicauth_preauth_oldapi endif -if HAVE_POST_PARSER +if MHD_SUPPORT_POST_PARSER check_PROGRAMS += \ test_post \ test_postform \ diff --git a/src/testcurl/https/Makefile.am b/src/testcurl/https/Makefile.am index a90d3fbf..603d71e1 100644 --- a/src/testcurl/https/Makefile.am +++ b/src/testcurl/https/Makefile.am @@ -57,7 +57,7 @@ THREAD_ONLY_TESTS = \ check_PROGRAMS = \ test_https_get_select -if MHD_USE_THREADS +if MHD_SUPPORT_THREADS check_PROGRAMS += \ $(THREAD_ONLY_TESTS) endif diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 1fb39cff..e52efc8c 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = basic -if MHD_UPGRADE_SUPPORT +if MHD_SUPPORT_UPGRADE SUBDIRS += upgrade endif diff --git a/src/tests/basic/Makefile.am b/src/tests/basic/Makefile.am index 5617ac14..54c104b9 100644 --- a/src/tests/basic/Makefile.am +++ b/src/tests/basic/Makefile.am @@ -34,7 +34,7 @@ check_PROGRAMS = \ test_create_start_destroy_ipbest \ $(EMPTY_ITEM) -if MHD_USE_SELECT +if MHD_SUPPORT_SELECT check_PROGRAMS += \ test_create_destroy_select \ test_create_start_destroy_select \ @@ -43,7 +43,7 @@ check_PROGRAMS += \ $(EMPTY_ITEM) endif -if MHD_USE_POLL +if MHD_SUPPORT_POLL check_PROGRAMS += \ test_create_destroy_poll \ test_create_start_destroy_poll \ @@ -52,7 +52,7 @@ check_PROGRAMS += \ $(EMPTY_ITEM) endif -if MHD_USE_EPOLL +if MHD_SUPPORT_EPOLL check_PROGRAMS += \ test_create_destroy_epoll \ test_create_start_destroy_epoll \ @@ -61,7 +61,7 @@ check_PROGRAMS += \ $(EMPTY_ITEM) endif -if MHD_USE_THREADS +if MHD_SUPPORT_THREADS check_PROGRAMS += \ test_create_destroy_int_thread \ test_create_start_destroy_int_thread \ @@ -74,21 +74,21 @@ check_PROGRAMS += \ test_create_start_destroy_thread_pool_ipv4 \ $(EMPTY_ITEM) -if MHD_USE_SELECT +if MHD_SUPPORT_SELECT check_PROGRAMS += \ test_create_start_destroy_select_int_thread_ipv4 \ test_create_start_destroy_select_thread_per_conn_ipv4 \ $(EMPTY_ITEM) endif -if MHD_USE_POLL +if MHD_SUPPORT_POLL check_PROGRAMS += \ test_create_start_destroy_poll_int_thread_ipv4 \ test_create_start_destroy_poll_thread_per_conn_ipv4 \ $(EMPTY_ITEM) endif -if MHD_USE_EPOLL +if MHD_SUPPORT_EPOLL check_PROGRAMS += \ test_create_start_destroy_epoll_int_thread_ipv4 \ test_create_start_destroy_epoll_thread_pool_ipv4 \ diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am index 4795f6bb..335783e1 100644 --- a/src/tools/Makefile.am +++ b/src/tools/Makefile.am @@ -29,7 +29,7 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la: $(top_builddir)/src/microhttpd/ # Tools noinst_PROGRAMS = -if MHD_USE_THREADS +if MHD_SUPPORT_THREADS noinst_PROGRAMS += \ perf_replies endif