libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 8d78a6e687bae84947852f1256a6277b8e15a59f
parent 57ec09aa8871679de2b9cb9ffbf47e906fe9a9be
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Mon,  8 Apr 2024 20:35:54 +0200

microhttpd2.h: fixed and updated

Diffstat:
Msrc/include/microhttpd2.h | 1341++++++++++++++++++++++++++++++++++++++++---------------------------------------
1 file changed, 674 insertions(+), 667 deletions(-)

diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h @@ -18,138 +18,143 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/** - * Main goals for the libmicrohttpd 2.0 API: - * - * - simplify application callbacks by splitting header/upload/post - * functionality currently provided by calling the same - * MHD_AccessHandlerCallback 3+ times into separate callbacks. - * - keep the API very simple for simple requests, but allow - * more complex logic to be incrementally introduced - * (via new struct MHD_Action construction) - * - avoid repeated scans for URL matches via the new - * struct MHD_Action construction - * - better types, in particular avoid varargs for options - * - make it harder to pass inconsistent options - * - combine options and flags into more uniform API (at least - * exterally!) - * - simplify API use by using sane defaults (benefiting from - * breaking backwards compatibility) and making all options - * really optional, and where applicable avoid having options - * where the default works if nothing is specified - * - simplify API by moving rarely used http_version into - * MHD_request_get_info_fixed() - * - avoid 'int' for MHD_YES/MHD_NO by introducing `enum MHD_Bool` - * - improve terminology by eliminating confusion between - * 'request' and 'connection'; add 'session' for HTTP2/3; - * use clear separation between connection and request. Do not mix the kind - * data in the callbacks. Currently we are mixing things in - * MHD_AccessHandlerCallback and MHD_RequestCompletedCallback. Instead of - * pointers to struct MHD_Connection we should use pointers to (new) struct - * MHD_Request. - * - prepare API for having multiple TLS backends - * - use more consistent prefixes for related functions - * by using MHD_subject_verb_object naming convention, also - * at the same time avoid symbol conflict with legacy names - * (so we can have one binary implementing old and new - * library API at the same time via compatibility layer). - * - make it impossible to queue a response at the wrong time - * - make it impossible to suspend a connection/request at the - * wrong time (improves thread-safety) - * - make it clear which response status codes are "properly" - * supported (include the descriptive string) by using an enum; - * - simplify API for common-case of one-shot responses by - * eliminating need for destroy response in most cases; - * - avoid fixed types, like uint32_t. They may not exist on some - * platforms. Instead use uint_fast32_t. - * It is also better for future-proof. - * - check portability for embedded platforms. Some of them support - * 64 bits, but 'int' could be just 16 bits resulting of silently - * dropping enum values higher than 65535. - * => in general, more functions, fewer enums for setup - * - Avoid returning pointers to internal members. It is not thread-safe and - * even in single thread the value could change over the time. Prefer pointers to - * app-allocated memory with the size, like MHD_daemon_get_static_info(enum - * MHD_enum_name info_type, void *buf, size_t buf_size). - * => Except in cases where zero-copy matters. - * - Use separate app calls/functions for data the will not change for the - * lifetime of the object and dynamic data. The only difference should be the - * name. Like MHD_daemon_get_static_info(enum MHD_enum_name info_type, void *buf, - * size_t buf_size) MHD_daemon_get_dynamic_info(enum MHD_enum_name info_type, - * void *buf, size_t buf_size) Examples of static data: listen socket, number of - * workers, daemon flags. Examples of dynamic data: number of connections, - * quiesce status. It should give a clear idea whether the data could be changed - * over the time (could be not obvious for some data) and thus may change the - * approach how to use the data in app. The same for: library, daemon, - * connection, request. Not sure that dynamic data makes sense for the library. - * - Define response code in response object. There are a very little - * chance that response body designed for 404 or 403 codes will be used with - * 200 code. However, the responses body for 307 and 308 could be the same. So: - * Add default response code in response object. - * - Make responses unmodifiable after first use. It is not thread-safe. - * MHD-generated headers (Date, Connection/Keep-Alive) are again - * part of the *request* and do not count as part of the "response" here. - * - Remove "footers" from responses. With unmodifiable responses everything should - * be "headers". Add footers to *requests* instead. - * - Add API for adding request-specific response headers and footers. To - * simplify the things it should just copy the strings (to avoid dealing with - * complicated deinit of possible dynamic strings). After this change it should - * be possible to simplify DAuth handling as response could be reused (currently - * 403 responses are modified for each reply). - * - Control response behaviour mainly by response flags, not by additional - * headers (like MHD_RF_FORCE_CLOSE instead of "Connection: close"). - * It is easier&faster for both: app and MHD. - * - Move response codes from MHD_HTTP_xxx namespace to MHD_HTTP_CODE_xxx - * namespace. It already may clash with other HTTP values. - * - Postprocessor is unusable night-mare when doing "stream processing" - * for tiny values where the application basically has to copy together - * the stream back into a single compact heap value, just making the - * parsing highly more complicated (see examples in Challenger) - * - non-stream processing variant for request bodies, give apps a - * way to request the full body in one buffer; give apps a way - * to request a 'large new allocation' for such buffers; give apps - * a way to specify a global quota for large allocations to ensure - * memory usage has a hard bound - * - * - Internals: carefully check where locking is really required. Probably - * separate locks. Check out-of-thread value reading. Currently code assumes - * atomic reading of values used in other threads, which mostly true on x86, - * but not OK on other arches. Probably use read/write locking to minimize - * the threads interference. - * - Internals: figure out how to do portable variant of cork/uncork - * - Internals: remove request data from memory pool when response is queued - * (IF no callbacks and thus data cannot be used anymore, or IF - * application permits explictly per daemon) to get more space - * for building response; - * - Internals: Fix TCP FIN graceful closure issue for upgraded - * connections (API implications?) - * - * - Enable providing default logarithmic implementation of URL scan - * => reduce strcmp(url) from >= 3n operations to "log n" - * per request. Match on method + URL (longest-prefix /foo/bar/* /foo/ /foo /fo, etc). - * "GET /foo/$ARG/$BAR/match" - * struct MHD_Dispatcher; - * - * struct MHD_Dispatcher * - * MHD_dispatcher_create (...); - * enum {no_url, no_method, found} - * MHD_dispatcher_dispatch (dispatcher, url, method, *result); - * MHD_RequestCallback - * MHD_dispatcher_get_callback (struct MHD_Dispatcher *dispatcher); - * struct MHD_dispatcher_destroy (*dispatcher); - * +/* + Main goals for the libmicrohttpd 2.0 API: + + - simplify application callbacks by splitting header/upload/post + functionality currently provided by calling the same + MHD_AccessHandlerCallback 3+ times into separate callbacks. + - keep the API very simple for simple requests, but allow + more complex logic to be incrementally introduced + (via new struct MHD_Action construction) + - avoid repeated scans for URL matches via the new + struct MHD_Action construction + - better types, in particular avoid varargs for options + - make it harder to pass inconsistent options + - combine options and flags into more uniform API (at least + exterally!) + - simplify API use by using sane defaults (benefiting from + breaking backwards compatibility) and making all options + really optional, and where applicable avoid having options + where the default works if nothing is specified + - simplify API by moving rarely used http_version into + MHD_request_get_info_fixed() + - avoid 'int' for MHD_YES/MHD_NO by introducing `enum MHD_Bool` + - improve terminology by eliminating confusion between + 'request' and 'connection'; add 'session' for HTTP2/3; + use clear separation between connection and request. Do not mix the kind + data in the callbacks. Currently we are mixing things in + MHD_AccessHandlerCallback and MHD_RequestCompletedCallback. Instead of + pointers to struct MHD_Connection we should use pointers to (new) struct + MHD_Request. + - prepare API for having multiple TLS backends + - use more consistent prefixes for related functions + by using MHD_subject_verb_object naming convention, also + at the same time avoid symbol conflict with legacy names + (so we can have one binary implementing old and new + library API at the same time via compatibility layer). + - make it impossible to queue a response at the wrong time + - make it impossible to suspend a connection/request at the + wrong time (improves thread-safety) + - make it clear which response status codes are "properly" + supported (include the descriptive string) by using an enum; + - simplify API for common-case of one-shot responses by + eliminating need for destroy response in most cases; + - avoid fixed types, like uint32_t. They may not exist on some + platforms. Instead use uint_fast32_t. + It is also better for future-proof. + - check portability for embedded platforms. Some of them support + 64 bits, but 'int' could be just 16 bits resulting of silently + dropping enum values higher than 65535. + => in general, more functions, fewer enums for setup + - Avoid returning pointers to internal members. It is not thread-safe and + even in single thread the value could change over the time. Prefer pointers to + app-allocated memory with the size, like MHD_daemon_get_static_info(enum + MHD_enum_name info_type, void *buf, size_t buf_size). + => Except in cases where zero-copy matters. + - Use separate app calls/functions for data the will not change for the + lifetime of the object and dynamic data. The only difference should be the + name. Like MHD_daemon_get_static_info(enum MHD_enum_name info_type, void *buf, + size_t buf_size) MHD_daemon_get_dynamic_info(enum MHD_enum_name info_type, + void *buf, size_t buf_size) Examples of static data: listen socket, number of + workers, daemon flags. Examples of dynamic data: number of connections, + quiesce status. It should give a clear idea whether the data could be changed + over the time (could be not obvious for some data) and thus may change the + approach how to use the data in app. The same for: library, daemon, + connection, request. Not sure that dynamic data makes sense for the library. + - Define response code in response object. There are a very little + chance that response body designed for 404 or 403 codes will be used with + 200 code. However, the responses body for 307 and 308 could be the same. So: + Add default response code in response object. + - Make responses unmodifiable after first use. It is not thread-safe. + MHD-generated headers (Date, Connection/Keep-Alive) are again + part of the *request* and do not count as part of the "response" here. + - Remove "footers" from responses. With unmodifiable responses everything should + be "headers". Add footers to *requests* instead. + - Add API for adding request-specific response headers and footers. To + simplify the things it should just copy the strings (to avoid dealing with + complicated deinit of possible dynamic strings). After this change it should + be possible to simplify DAuth handling as response could be reused (currently + 403 responses are modified for each reply). + - Control response behaviour mainly by response flags, not by additional + headers (like MHD_RF_FORCE_CLOSE instead of "Connection: close"). + It is easier&faster for both: app and MHD. + - Move response codes from MHD_HTTP_xxx namespace to MHD_HTTP_CODE_xxx + namespace. It already may clash with other HTTP values. + - Postprocessor is unusable night-mare when doing "stream processing" + for tiny values where the application basically has to copy together + the stream back into a single compact heap value, just making the + parsing highly more complicated (see examples in Challenger) + - non-stream processing variant for request bodies, give apps a + way to request the full body in one buffer; give apps a way + to request a 'large new allocation' for such buffers; give apps + a way to specify a global quota for large allocations to ensure + memory usage has a hard bound + + - Internals: carefully check where locking is really required. Probably + separate locks. Check out-of-thread value reading. Currently code assumes + atomic reading of values used in other threads, which mostly true on x86, + but not OK on other arches. Probably use read/write locking to minimize + the threads interference. + - Internals: figure out how to do portable variant of cork/uncork + - Internals: remove request data from memory pool when response is queued + (IF no callbacks and thus data cannot be used anymore, or IF + application permits explictly per daemon) to get more space + for building response; + - Internals: Fix TCP FIN graceful closure issue for upgraded + connections (API implications?) + + - Enable providing default logarithmic implementation of URL scan + => reduce strcmp(url) from >= 3n operations to "log n" + per request. Match on method + URL (longest-prefix /foo/bar/* /foo/ /foo /fo, etc). + "GET /foo/$ARG/$BAR/match" + struct MHD_Dispatcher; + + struct MHD_Dispatcher * + MHD_dispatcher_create (...); + enum {no_url, no_method, found} + MHD_dispatcher_dispatch (dispatcher, url, method, *result); + MHD_RequestCallback + MHD_dispatcher_get_callback (struct MHD_Dispatcher *dispatcher); + struct MHD_dispatcher_destroy (*dispatcher); + */ + #ifndef MICROHTTPD2_H #define MICROHTTPD2_H +#ifndef __cplusplus +# define MHD_C_DECLRATIONS_START_HERE_ /* Empty */ +# define MHD_C_DECLRATIONS_FINISH_HERE_ /* Empty */ +#else /* __cplusplus */ +/* *INDENT-OFF* */ +# define MHD_C_DECLRATIONS_START_HERE_ extern "C" { +# define MHD_C_DECLRATIONS_FINISH_HERE_ } +/* *INDENT-ON* */ +#endif /* __cplusplus */ -#ifdef __cplusplus -extern "C" -{ -#if 0 /* keep Emacsens' auto-indent happy */ -} -#endif -#endif + +MHD_C_DECLRATIONS_START_HERE_ /* While we generally would like users to use a configure-driven build process which detects which headers are present and @@ -157,24 +162,18 @@ extern "C" to build out-of-the-box for beginning users on common systems. If generic headers don't work on your platform, include headers - which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', - 'uint16_t', 'uint32_t', 'uint64_t', 'off_t', 'struct sockaddr', - 'socklen_t', 'fd_set' and "#define MHD_PLATFORM_H" before - including "microhttpd.h". Then the following "standard" + which define 'va_list', 'size_t', 'uint_fast16_t', 'uint_fat32_t', + 'uint_fast64_t', 'struct sockaddr', and "#define MHD_PLATFORM_H" + before including "microhttpd.h". Then the following "standard" includes won't be used (which might be a good idea, especially on platforms where they do not exist). */ -// TODO: review the list of includes, reduce it #ifndef MHD_PLATFORM_H #include <stdarg.h> #include <stdint.h> #include <sys/types.h> #if defined(_WIN32) && ! defined(__CYGWIN__) #include <ws2tcpip.h> -#if defined(_MSC_FULL_VER) && ! defined(_SSIZE_T_DEFINED) -#define _SSIZE_T_DEFINED -typedef intptr_t ssize_t; -#endif /* !_SSIZE_T_DEFINED */ #else #include <unistd.h> #include <sys/time.h> @@ -189,9 +188,9 @@ typedef intptr_t ssize_t; /** * Current version of the library. - * 0x01093001 = 1.9.30-1. + * Packed BCD: 0x01093001 = 1.9.30-1. */ -#define MHD_VERSION 0x02000001 +#define MHD_VERSION 0x01990001 /** * Representation of 'bool' in the public API as stdbool.h may not @@ -520,8 +519,7 @@ typedef SOCKET MHD_socket; /* Use variable-length arrays? */ #if ! defined(MHD_NO_VLA) # if ! defined(MHD_USE_VLA) -# if MHD_C_MINV_99 && \ - (! defined(__STDC_NO_VLA__) || __STDC_NO_VLA__ + 0 != 0) +# if MHD_C_MINV_99 && (! defined(__STDC_NO_VLA__)) # if defined(__GNUC__) || defined(__clang__) # define MHD_USE_VLA 1 # elif defined(_MSC_VER) @@ -1125,6 +1123,18 @@ struct MHD_Request; */ struct MHD_Action; +/** + * @defgroup general Primary MHD functions and data + */ + +/** + * @defgroup specialized Introspection and other special control + */ + +/** + * @defgroup authentication Digest and other HTTP authentications + */ + /** * Return values for reporting errors, also used for logging. @@ -2548,7 +2558,6 @@ MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_IN_ (1); * @param[in,out] daemon daemon to start; you can no longer set * options on this daemon after this call! * @return #MHD_SC_OK on success - * @ingroup event * @ingroup daemon */ MHD_EXTERN_ enum MHD_StatusCode @@ -2569,7 +2578,6 @@ MHD_FN_PAR_NONNULL_ (1); * @return the old listen socket on success, #MHD_INVALID_SOCKET if * the daemon was already not listening anymore, or * was never started, or has no listen socket. - * @ingroup specialized * @ingroup daemon */ MHD_EXTERN_ MHD_socket @@ -2581,7 +2589,6 @@ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_INOUT_ (1); * Shutdown and destroy an HTTP daemon. * * @param[in] daemon daemon to stop - * @ingroup event * @ingroup daemon */ MHD_EXTERN_ void @@ -2591,6 +2598,10 @@ MHD_FN_PAR_NONNULL_ALL_; /* ******************* External event loop ************************ */ /** + * @defgroup event External network events processing + */ + +/** * The network status of the socket. * When set by MHD (by #MHD_get_watched_fds(), #MHD_get_watched_fds_update() and * similar) it indicates a request to watch for specific socket state: @@ -2621,14 +2632,16 @@ enum MHD_FIXED_ENUM_ MHD_FdState * / socket has incoming data ready to read (when used for * #MHD_process_watched_fds()) */ - MHD_FD_STATE_RECV = 1 << 0, + MHD_FD_STATE_RECV = 1 << 0 + , /** * Indicates that socket should be watched for availability for sending * (when set by #MHD_get_watched_fds()) * / socket has ability to send data (when used for * #MHD_process_watched_fds()) */ - MHD_FD_STATE_SEND = 1 << 1, + MHD_FD_STATE_SEND = 1 << 1 + , /** * Indicates that socket should be watched for disconnect, out-of-band * data available or high priority data available (when set by @@ -2640,7 +2653,8 @@ enum MHD_FIXED_ENUM_ MHD_FdState * Note: #MHD_get_watched_fds() always set it as exceptions must be * always watched. */ - MHD_FD_STATE_EXCEPT = 1 << 2, + MHD_FD_STATE_EXCEPT = 1 << 2 + , /* The rest of the list is a bit-wise combination of three main * states. Application may use three main states directly as @@ -2650,15 +2664,18 @@ enum MHD_FIXED_ENUM_ MHD_FdState /** * Combination of #MHD_FD_STATE_RECV and #MHD_FD_STATE_SEND states. */ - MHD_FD_STATE_RECV_SEND = MHD_FD_STATE_RECV | MHD_FD_STATE_SEND, + MHD_FD_STATE_RECV_SEND = MHD_FD_STATE_RECV | MHD_FD_STATE_SEND + , /** * Combination of #MHD_FD_STATE_RECV and #MHD_FD_STATE_EXCEPT states. */ - MHD_FD_STATE_RECV_EXCEPT = MHD_FD_STATE_RECV | MHD_FD_STATE_EXCEPT, + MHD_FD_STATE_RECV_EXCEPT = MHD_FD_STATE_RECV | MHD_FD_STATE_EXCEPT + , /** * Combination of #MHD_FD_STATE_RECV and #MHD_FD_STATE_EXCEPT states. */ - MHD_FD_STATE_SEND_EXCEPT = MHD_FD_STATE_RECV | MHD_FD_STATE_EXCEPT, + MHD_FD_STATE_SEND_EXCEPT = MHD_FD_STATE_RECV | MHD_FD_STATE_EXCEPT + , /** * Combination of #MHD_FD_STATE_RECV, #MHD_FD_STATE_SEND and * #MHD_FD_STATE_EXCEPT states. @@ -2732,11 +2749,6 @@ enum MHD_FIXED_ENUM_ MHD_FdState MHD_FD_STATE_CLEAR ((var),MHD_FD_STATE_EXCEPT) -/* Changes: - * + status update callback replaced with function - * + status update accepts array of updates - */ - /** * The context data to be used for updates of the socket state */ @@ -2784,15 +2796,15 @@ typedef MHD_APP_SOCKET_CNTX_TYPE * /** * Update the sockets state. * Must be called for every socket that got state updated. - * For #MHD_TM_EXTERNAL_EVENT_LOOP_CB_LEVEL mode should be called for each - * socket. - * Available only for daemons stated in #MHD_TM_EXTERNAL_EVENT_LOOP_CB_LEVEL or - * #MHD_TM_EXTERNAL_EVENT_LOOP_CB_EDGE modes. + * For #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL() mode + * should be called for each socket. + * Available only for daemons stated in + * #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL or + * #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE modes. * @param daemon the daemon handle * @param ecb_cntx the context handle provided * for #MHD_SocketRegistrationUpdateCallback * @param fd_current_state the current state of the socket - * @ingroup daemon * @ingroup event */ MHD_EXTERN_ void @@ -2819,7 +2831,6 @@ MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (2); * polling function, can be NULL * @return #MHD_SC_OK on success, * error code otherwise - * @ingroup daemon * @ingroup event */ MHD_EXTERN_ enum MHD_StatusCode @@ -2840,6 +2851,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_WorkMode * The application periodically calls #MHD_daemon_process_blocking(), where * MHD internally checks all sockets automatically. * This is the default mode. + * Use helper macro #MHD_D_OPTION_WM_EXTERNAL_PERIODIC() to enable + * this mode. */ MHD_WM_EXTERNAL_PERIODIC = 0 , @@ -2847,6 +2860,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_WorkMode * Work mode with an external event loop with level triggers. * Application uses #MHD_SocketRegistrationUpdateCallback, level triggered * sockets polling (like select() or poll()) and #MHD_daemon_event_update(). + * Use helper macro #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL() to enable + * this mode. */ MHD_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL = 8 , @@ -2854,6 +2869,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_WorkMode * Work mode with an external event loop with edge triggers. * Application uses #MHD_SocketRegistrationUpdateCallback, edge triggered * sockets polling (like epoll with EPOLLET) and #MHD_daemon_event_update(). + * Use helper macro #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE() to enable + * this mode. */ MHD_WM_EXTERNAL_EVENT_LOOP_CB_EDGE = 9 , @@ -2866,17 +2883,21 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_WorkMode * GNU/Linux only), see #MHD_LIB_INFO_FIXED_HAS_AGGREGATE_FD. * When the FD is triggered, #MHD_daemon_process_nonblocking() should * be called. + * Use helper macro #MHD_D_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH() to enable + * this mode. */ MHD_WM_EXTERNAL_SINGLE_FD_WATCH = 16 , /** * Work mode with one or more worker threads. - * If #MHD_DAEMON_OPTION_UINT_NUM_WORKERS is not specified + * If #MHD_D_OPTION_UINT_NUM_WORKERS is not specified * then daemon starts with single worker thread that process * all connections. - * If #MHD_DAEMON_OPTION_UINT_NUM_WORKERS used with value more + * If #MHD_D_OPTION_UINT_NUM_WORKERS used with value more * than one, then that number of worker threads and distributed * processing of requests among the workers. + * Use helper macro #MHD_D_OPTION_WM_WORKER_THREADS() to enable + * this mode. */ MHD_WM_WORKER_THREADS = 24 , @@ -2885,6 +2906,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_WorkMode * per every connection. Use this if handling requests is CPU-intensive or * blocking, your application is thread-safe and you have plenty of * memory (per connection). + * Use helper macro #MHD_D_OPTION_WM_THREAD_PER_CONNECTION() to enable + * this mode. */ MHD_WM_THREAD_PER_CONNECTION = 32 }; @@ -3196,6 +3219,10 @@ MHD_WM_OPTION_THREAD_PER_CONNECTION (void) MHD_RESTORE_WARN_UNUSED_FUNC_ #endif /* !MHD_USE_COMPOUND_LITERALS || !MHD_USE_DESIG_NEST_INIT */ +/** + * @defgroup logging Log events and control + */ + /** * Type of a callback function used for logging by MHD. @@ -3223,19 +3250,19 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOptionBindType * The listen socket bind to the networks address without sharing the address. * Default. */ - MHD_DAEMON_OPTION_BIND_TYPE_NOT_SHARED = 0 + MHD_D_OPTION_BIND_TYPE_NOT_SHARED = 0 , /** * The listen socket bind to the networks address with sharing the address. * Several sockets can bind to the same address. */ - MHD_DAEMON_OPTION_BIND_TYPE_SHARED = 1 + MHD_D_OPTION_BIND_TYPE_SHARED = 1 , /** * The list socket bind to the networks address in explicit exclusive mode. * Ignored on platforms without support for the explicit exclusive socket use. */ - MHD_DAEMON_OPTION_BIND_TYPE_EXCLUSIVE = 2 + MHD_D_OPTION_BIND_TYPE_EXCLUSIVE = 2 }; @@ -3356,8 +3383,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_ProtocolStrictLevel * Be particularly permissive about the protocol, within * the limits set by RFCs for HTTP servers. */ - MHD_PSL_PERMISSIVE = -1, - + MHD_PSL_PERMISSIVE = -1 + , /* * Special levels * */ /** * Stricter protocol interpretation, even stricter then allowed @@ -3396,8 +3423,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_ProtocolStrictLevel * allows whitespaces in cookie values. * This level can be used in isolated environments. */ - MHD_PSL_VERY_PERMISSIVE = -2, - + MHD_PSL_VERY_PERMISSIVE = -2 + , /** * The most flexible protocol interpretation, beyond * RFCs' "MUST" type of restrictions for HTTP server. @@ -3491,13 +3518,13 @@ enum MHD_FIXED_FLAGS_ENUM_APP_SET_ MHD_DaemonOptionValueDAuthBindNonce * when clients' requests are intensive. * This value cannot be biwise-OR combined with other values. */ - MHD_DAEMON_OPTION_VALUE_DAUTH_BIND_NONCE_NONE = 0, - + MHD_D_OPTION_VALUE_DAUTH_BIND_NONCE_NONE = 0 + , /** * Generated nonces are valid only for the same realm. */ - MHD_DAEMON_OPTION_VALUE_DAUTH_BIND_NONCE_REALM = 1 << 0, - + MHD_D_OPTION_VALUE_DAUTH_BIND_NONCE_REALM = (1 << 0) + , /** * Generated nonces are valid only for the same URI (excluding parameters * after '?' in URI) and request method (GET, POST etc). @@ -3505,10 +3532,9 @@ enum MHD_FIXED_FLAGS_ENUM_APP_SET_ MHD_DaemonOptionValueDAuthBindNonce * RFC 7616 allows clients to re-use server-generated nonces for any URI * in the same "protection space" which by default consists of all server * URIs. - * Before #MHD_VERSION 0x00097701 this was default (and only supported) - * nonce bind type. */ - MHD_DAEMON_OPTION_VALUE_DAUTH_BIND_NONCE_URI = 1 << 1, + MHD_D_OPTION_VALUE_DAUTH_BIND_NONCE_URI = (1 << 1) + , /** * Generated nonces are valid only for the same URI including URI parameters @@ -3516,7 +3542,8 @@ enum MHD_FIXED_FLAGS_ENUM_APP_SET_ MHD_DaemonOptionValueDAuthBindNonce * This value implies #MHD_DAUTH_BIND_NONCE_URI. * Not recommended for that same reasons as #MHD_DAUTH_BIND_NONCE_URI. */ - MHD_DAEMON_OPTION_VALUE_DAUTH_BIND_NONCE_URI_PARAMS = 1 << 2, + MHD_D_OPTION_VALUE_DAUTH_BIND_NONCE_URI_PARAMS = (1 << 2) + , /** * Generated nonces are valid only for the single client's IP. @@ -3525,7 +3552,7 @@ enum MHD_FIXED_FLAGS_ENUM_APP_SET_ MHD_DaemonOptionValueDAuthBindNonce * Multi-NAT, different proxy chain and other reasons), while IP address * spoofing could be used relatively easily. */ - MHD_DAEMON_OPTION_VALUE_DAUTH_BIND_NONCE_CLIENT_IP = 1 << 3 + MHD_D_OPTION_VALUE_DAUTH_BIND_NONCE_CLIENT_IP = (1 << 3) }; @@ -3789,13 +3816,13 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption /* = MHD Daemon Option enum values below are generated automatically = */ /** * Set MHD work (threading and polling) mode. - * Consider use of #MHD_DAEMON_OPTION_WM_EXTERNAL_PERIODIC(), - * #MHD_DAEMON_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), - * #MHD_DAEMON_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), - * #MHD_DAEMON_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), - * #MHD_DAEMON_OPTION_WM_WORKER_THREADS() or - * #MHD_DAEMON_OPTION_WM_THREAD_PER_CONNECTION() instead of direct use of - * this parameter. + * Consider use of #MHD_D_OPTION_WM_EXTERNAL_PERIODIC(), + * #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), + * #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), + * #MHD_D_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), + * #MHD_D_OPTION_WM_WORKER_THREADS() or + * #MHD_D_OPTION_WM_THREAD_PER_CONNECTION() instead of direct use of this + * parameter. * The parameter value must be placed to the * @a v_work_mode member. */ @@ -3818,12 +3845,12 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption /** * Bind to the given TCP port and address family. * - * Does not work with #MHD_DAEMON_OPTION_BIND_SA() or - * #MHD_DAEMON_OPTION_LISTEN_SOCKET(). + * Does not work with #MHD_D_OPTION_BIND_SA() or + * #MHD_D_OPTION_LISTEN_SOCKET(). * - * If no listen socket optins (#MHD_DAEMON_OPTION_BIND_PORT(), - * #MHD_DAEMON_OPTION_BIND_SA(), #MHD_DAEMON_OPTION_LISTEN_SOCKET()) are - * used, MHD does not listen for incoming connection. + * If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), + * #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does + * not listen for incoming connection. * The parameter value must be placed to the * @a v_bind_port member. */ @@ -3832,12 +3859,12 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption /** * Bind to the given socket address. * - * Does not work with #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_LISTEN_SOCKET(). + * Does not work with #MHD_D_OPTION_BIND_PORT() or + * #MHD_D_OPTION_LISTEN_SOCKET(). * - * If no listen socket optins (#MHD_DAEMON_OPTION_BIND_PORT(), - * #MHD_DAEMON_OPTION_BIND_SA(), #MHD_DAEMON_OPTION_LISTEN_SOCKET()) are - * used, MHD does not listen for incoming connection. + * If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), + * #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does + * not listen for incoming connection. * The parameter value must be placed to the * @a v_bind_sa member. */ @@ -3847,12 +3874,11 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption * Accept connections from the given socket. Socket * must be a TCP or UNIX domain (SOCK_STREAM) socket. * - * Does not work with #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA(). + * Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA(). * - * If no listen socket optins (#MHD_DAEMON_OPTION_BIND_PORT(), - * #MHD_DAEMON_OPTION_BIND_SA(), #MHD_DAEMON_OPTION_LISTEN_SOCKET()) are - * used, MHD does not listen for incoming connection. + * If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), + * #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does + * not listen for incoming connection. * The parameter value must be placed to the * @a v_listen_socket member. */ @@ -3861,8 +3887,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption /** * Select mode of reusing address:port listen address. * - * Works only when #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA() are used. + * Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are + * used. * The parameter value must be placed to the * @a v_listen_addr_reuse member. */ @@ -3876,8 +3902,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption * attack as the TCP stack has to now allocate resources for the SYN * packet along with its DATA. * - * Works only when #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA() are used. + * Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are + * used. * The parameter value must be placed to the * @a v_tcp_fastopen member. */ @@ -3886,8 +3912,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption /** * Use the given backlog for the listen() call. * - * Works only when #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA() are used. + * Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are + * used. * The parameter value must be placed to the * @a v_listen_backlog member. */ @@ -4059,8 +4085,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption /** * Desired size of the stack for the threads started by MHD. * Use 0 for system default, which is also MHD default. - * Works only with ##MHD_DAEMON_OPTION_WORKER_THREADS() or - * #MHD_DAEMON_OPTION_THREAD_PER_CONNECTION(). + * Works only with #MHD_D_OPTION_WM_WORKER_THREADS() or + * #MHD_D_OPTION_WM_THREAD_PER_CONNECTION(). * The parameter value must be placed to the * @a v_stack_size member. */ @@ -4075,8 +4101,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption * connection is rejected. * Useful if application uses select() for polling the sockets, system * FD_SETSIZE is good value for this option in such case. - * Does not work with ##MHD_DAEMON_OPTION_WORKER_THREADS() or - * #MHD_DAEMON_OPTION_THREAD_PER_CONNECTION(). + * Does not work with #MHD_D_OPTION_WM_WORKER_THREADS() or + * #MHD_D_OPTION_WM_THREAD_PER_CONNECTION(). * Does not work on W32 (WinSock sockets). * The parameter value must be placed to the * @a v_fd_number_limit member. @@ -4192,7 +4218,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption * This option allows bitwise OR combination of * #MHD_DaemonOptionValueDAuthBindNonce values. * When this option is not used then default value is - * #MHD_DAEMON_OPTION_VALUE_DAUTH_BIND_NONCE_NONE. + * #MHD_D_OPTION_VALUE_DAUTH_BIND_NONCE_NONE. * The parameter value must be placed to the * @a v_dauth_nonce_bind_type member. */ @@ -4304,12 +4330,10 @@ struct MHD_DaemonOptionValueTlsCert * The private key loaded into memory (not a filename) */ const char *v_mem_key; - /** * The certificate loaded into memory (not a filename) */ const char *v_mem_cert; - /** * The option passphrase phrase to decrypt the private key, * could be NULL is private does not need a password @@ -4629,12 +4653,12 @@ struct MHD_DaemonOptionAndValue /* = MHD Daemon Option macros below are generated automatically = */ /** * Set MHD work (threading and polling) mode. - * Consider use of #MHD_DAEMON_OPTION_WM_EXTERNAL_PERIODIC(), - * #MHD_DAEMON_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), - * #MHD_DAEMON_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), - * #MHD_DAEMON_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), - * #MHD_DAEMON_OPTION_WM_WORKER_THREADS() or - * #MHD_DAEMON_OPTION_WM_THREAD_PER_CONNECTION() instead of direct use of this + * Consider use of #MHD_D_OPTION_WM_EXTERNAL_PERIODIC(), + * #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), + * #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), + * #MHD_D_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), + * #MHD_D_OPTION_WM_WORKER_THREADS() or + * #MHD_D_OPTION_WM_THREAD_PER_CONNECTION() instead of direct use of this * parameter. * @param wmp the object created by one of the next functions/macros: * #MHD_WM_OPTION_EXTERNAL_PERIODIC(), @@ -4647,13 +4671,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_WORK_MODE(wmp) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_WORK_MODE), \ - .val.v_work_mode = (wmp) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_WORK_MODE), \ + .val.v_work_mode = (wmp) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Select a sockets watch system call used for internal polling. @@ -4662,13 +4686,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_POLL_SYSCALL(els) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_POLL_SYSCALL), \ - .val.v_poll_syscall = (els) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_POLL_SYSCALL), \ + .val.v_poll_syscall = (els) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Set a callback to use for logging @@ -4679,24 +4703,23 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_LOG_CALLBACK(log_cb,lob_cb_cls) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_LOG_CALLBACK), \ - .val.v_log_callback.v_log_cb = (log_cb), \ - .val.v_log_callback.v_lob_cb_cls = (lob_cb_cls) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_LOG_CALLBACK), \ + .val.v_log_callback.v_log_cb = (log_cb), \ + .val.v_log_callback.v_lob_cb_cls = (lob_cb_cls) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Bind to the given TCP port and address family. * - * Does not work with #MHD_DAEMON_OPTION_BIND_SA() or - * #MHD_DAEMON_OPTION_LISTEN_SOCKET(). + * Does not work with #MHD_D_OPTION_BIND_SA() or #MHD_D_OPTION_LISTEN_SOCKET(). * - * If no listen socket optins (#MHD_DAEMON_OPTION_BIND_PORT(), - * #MHD_DAEMON_OPTION_BIND_SA(), #MHD_DAEMON_OPTION_LISTEN_SOCKET()) are used, - * MHD does not listen for incoming connection. + * If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), + * #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does + * not listen for incoming connection. * @param af the address family to use, * the #MHD_AF_NONE to disable listen socket (the same effect as if * this option is not used) @@ -4706,24 +4729,24 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_BIND_PORT(af,port) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_BIND_PORT), \ - .val.v_bind_port.v_af = (af), \ - .val.v_bind_port.v_port = (port) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_BIND_PORT), \ + .val.v_bind_port.v_af = (af), \ + .val.v_bind_port.v_port = (port) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Bind to the given socket address. * - * Does not work with #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_LISTEN_SOCKET(). + * Does not work with #MHD_D_OPTION_BIND_PORT() or + * #MHD_D_OPTION_LISTEN_SOCKET(). * - * If no listen socket optins (#MHD_DAEMON_OPTION_BIND_PORT(), - * #MHD_DAEMON_OPTION_BIND_SA(), #MHD_DAEMON_OPTION_LISTEN_SOCKET()) are used, - * MHD does not listen for incoming connection. + * If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), + * #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does + * not listen for incoming connection. * @param sa_len the size of the socket address pointed by @a sa. * @param sa the address to bind to; can be IPv4 (AF_INET), IPv6 (AF_INET6) or * even a UNIX domain socket (AF_UNIX) @@ -4731,56 +4754,55 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_BIND_SA(sa_len,sa) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_BIND_SA), \ - .val.v_bind_sa.v_sa_len = (sa_len), \ - .val.v_bind_sa.v_sa = (sa) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_BIND_SA), \ + .val.v_bind_sa.v_sa_len = (sa_len), \ + .val.v_bind_sa.v_sa = (sa) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Accept connections from the given socket. Socket * must be a TCP or UNIX domain (SOCK_STREAM) socket. * - * Does not work with #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA(). + * Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA(). * - * If no listen socket optins (#MHD_DAEMON_OPTION_BIND_PORT(), - * #MHD_DAEMON_OPTION_BIND_SA(), #MHD_DAEMON_OPTION_LISTEN_SOCKET()) are used, - * MHD does not listen for incoming connection. + * If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), + * #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does + * not listen for incoming connection. * @param listen_fd the listen socket to use, ignored if set to * #MHD_INVALID_SOCKET * @return the object of struct MHD_DaemonOptionAndValue with the requested * values */ # define MHD_D_OPTION_LISTEN_SOCKET(listen_fd) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_LISTEN_SOCKET), \ - .val.v_listen_socket = (listen_fd) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_LISTEN_SOCKET), \ + .val.v_listen_socket = (listen_fd) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Select mode of reusing address:port listen address. * - * Works only when #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA() are used. + * Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are + * used. * @param reuse_type the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested * values */ # define MHD_D_OPTION_LISTEN_ADDR_REUSE(reuse_type) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_LISTEN_ADDR_REUSE), \ - .val.v_listen_addr_reuse = (reuse_type) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_LISTEN_ADDR_REUSE), \ + .val.v_listen_addr_reuse = (reuse_type) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Configure TCP_FASTOPEN option, including setting a @@ -4790,8 +4812,8 @@ struct MHD_DaemonOptionAndValue * attack as the TCP stack has to now allocate resources for the SYN * packet along with its DATA. * - * Works only when #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA() are used. + * Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are + * used. * @param option the type use of of TCP FastOpen * @param queue_length the length of the queue, zero to use system or MHD * default, @@ -4801,32 +4823,32 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_TCP_FASTOPEN(option,queue_length) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_TCP_FASTOPEN), \ - .val.v_tcp_fastopen.v_option = (option), \ - .val.v_tcp_fastopen.v_queue_length = (queue_length) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_TCP_FASTOPEN), \ + .val.v_tcp_fastopen.v_option = (option), \ + .val.v_tcp_fastopen.v_queue_length = (queue_length) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Use the given backlog for the listen() call. * - * Works only when #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA() are used. + * Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are + * used. * @param backlog_size the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested * values */ # define MHD_D_OPTION_LISTEN_BACKLOG(backlog_size) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_LISTEN_BACKLOG), \ - .val.v_listen_backlog = (backlog_size) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_LISTEN_BACKLOG), \ + .val.v_listen_backlog = (backlog_size) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Inform that SIGPIPE is suppressed or handled by application. @@ -4839,13 +4861,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_SIGPIPE_SUPPRESSED(bool_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_SIGPIPE_SUPPRESSED), \ - .val.v_sigpipe_suppressed = (bool_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_SIGPIPE_SUPPRESSED), \ + .val.v_sigpipe_suppressed = (bool_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Enable TLS (HTTPS) and select TLS backend @@ -4855,34 +4877,34 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_TLS(backend) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_TLS), \ - .val.v_tls = (backend) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_TLS), \ + .val.v_tls = (backend) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Provide TLS key and certificate data in-memory. * Works only if TLS mode is enabled. * @param mem_key the private key loaded into memory (not a filename) * @param mem_cert the certificate loaded into memory (not a filename) - * @param mem_cert the option passphrase phrase to decrypt the private key, + * @param mem_pass the option passphrase phrase to decrypt the private key, * could be NULL is private does not need a password * @return the object of struct MHD_DaemonOptionAndValue with the requested * values */ -# define MHD_D_OPTION_TLS_KEY_CERT(mem_key,mem_cert,mem_cert) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ +# define MHD_D_OPTION_TLS_KEY_CERT(mem_key,mem_cert,mem_pass) \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_TLS_KEY_CERT), \ - .val.v_tls_key_cert.v_mem_key = (mem_key), \ - .val.v_tls_key_cert.v_mem_cert = (mem_cert), \ - .val.v_tls_key_cert.v_mem_cert = (mem_cert) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_TLS_KEY_CERT), \ + .val.v_tls_key_cert.v_mem_key = (mem_key), \ + .val.v_tls_key_cert.v_mem_cert = (mem_cert), \ + .val.v_tls_key_cert.v_mem_pass = (mem_pass) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Provide the certificate of the certificate authority (CA) to be used by the @@ -4893,13 +4915,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_TLS_CLIENT_CA(mem_client_ca) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_TLS_CLIENT_CA), \ - .val.v_tls_client_ca = (mem_client_ca) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_TLS_CLIENT_CA), \ + .val.v_tls_client_ca = (mem_client_ca) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Configure PSK to use for the TLS key exchange. @@ -4909,14 +4931,14 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_TLS_PSK_CALLBACK(psk_cb,psk_cb_cls) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_TLS_PSK_CALLBACK), \ - .val.v_tls_psk_callback.v_psk_cb = (psk_cb), \ - .val.v_tls_psk_callback.v_psk_cb_cls = (psk_cb_cls) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_TLS_PSK_CALLBACK), \ + .val.v_tls_psk_callback.v_psk_cb = (psk_cb), \ + .val.v_tls_psk_callback.v_psk_cb_cls = (psk_cb_cls) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Control ALPN for TLS connection. @@ -4927,13 +4949,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_NO_ALPN(bool_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_NO_ALPN), \ - .val.v_no_alpn = (bool_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_NO_ALPN), \ + .val.v_no_alpn = (bool_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Specify inactivity timeout for connection. @@ -4945,13 +4967,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_DEFAULT_TIMEOUT(timeout) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DEFAULT_TIMEOUT), \ - .val.v_default_timeout = (timeout) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DEFAULT_TIMEOUT), \ + .val.v_default_timeout = (timeout) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Maximum number of (concurrent) network connections served by daemon @@ -4960,13 +4982,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT(glob_limit) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_GLOBAL_CONNECTION_LIMIT), \ - .val.v_global_connection_limit = (glob_limit) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_GLOBAL_CONNECTION_LIMIT), \ + .val.v_global_connection_limit = (glob_limit) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Limit on the number of (concurrent) network connections made to the server @@ -4979,13 +5001,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_PER_IP_LIMIT(per_ip_limit) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_PER_IP_LIMIT), \ - .val.v_per_ip_limit = (per_ip_limit) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_PER_IP_LIMIT), \ + .val.v_per_ip_limit = (per_ip_limit) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Set a policy callback that accepts/rejects connections based on the client's @@ -4997,14 +5019,14 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_ACCEPT_POLICY(apc,apc_cls) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_ACCEPT_POLICY), \ - .val.v_accept_policy.v_apc = (apc), \ - .val.v_accept_policy.v_apc_cls = (apc_cls) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_ACCEPT_POLICY), \ + .val.v_accept_policy.v_apc = (apc), \ + .val.v_accept_policy.v_apc_cls = (apc_cls) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Set how strictly MHD will enforce the HTTP protocol. @@ -5014,14 +5036,14 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_PROTOCOL_STRICT_LEVEL(sl,how) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_PROTOCOL_STRICT_LEVEL), \ - .val.v_protocol_strict_level.v_sl = (sl), \ - .val.v_protocol_strict_level.v_how = (how) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_PROTOCOL_STRICT_LEVEL), \ + .val.v_protocol_strict_level.v_sl = (sl), \ + .val.v_protocol_strict_level.v_how = (how) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Set a callback to be called first for every request when the request line is @@ -5036,14 +5058,14 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_EARLY_URI_LOGGER(cb,cls) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_EARLY_URI_LOGGER), \ - .val.v_early_uri_logger.v_cb = (cb), \ - .val.v_early_uri_logger.v_cls = (cls) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_EARLY_URI_LOGGER), \ + .val.v_early_uri_logger.v_cb = (cb), \ + .val.v_early_uri_logger.v_cls = (cls) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Disable converting plus ('+') character to space in GET parameters (URI part @@ -5057,13 +5079,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE(bool_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DISABLE_URI_QUERY_PLUS_AS_SPACE), \ - .val.v_disable_uri_query_plus_as_space = (bool_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DISABLE_URI_QUERY_PLUS_AS_SPACE), \ + .val.v_disable_uri_query_plus_as_space = (bool_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Suppresse use of "Date:" header. @@ -5074,13 +5096,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_SUPPRESS_DATE_HEADER(bool_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_SUPPRESS_DATE_HEADER), \ - .val.v_suppress_date_header = (bool_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_SUPPRESS_DATE_HEADER), \ + .val.v_suppress_date_header = (bool_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Use SHOUTcast for responses. @@ -5091,13 +5113,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_ENABLE_SHOUTCAST(bool_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_ENABLE_SHOUTCAST), \ - .val.v_enable_shoutcast = (bool_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_ENABLE_SHOUTCAST), \ + .val.v_enable_shoutcast = (bool_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Maximum memory size per connection. @@ -5112,13 +5134,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_CONN_MEMORY_LIMIT(sizet_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_CONN_MEMORY_LIMIT), \ - .val.v_conn_memory_limit = (sizet_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_CONN_MEMORY_LIMIT), \ + .val.v_conn_memory_limit = (sizet_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * The size of the shared memory pool for accamulated upload processing. @@ -5132,31 +5154,31 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_LARGE_POOL_SIZE(sizet_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_LARGE_POOL_SIZE), \ - .val.v_large_pool_size = (sizet_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_LARGE_POOL_SIZE), \ + .val.v_large_pool_size = (sizet_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Desired size of the stack for the threads started by MHD. * Use 0 for system default, which is also MHD default. - * Works only with ##MHD_DAEMON_OPTION_WORKER_THREADS() or - * #MHD_DAEMON_OPTION_THREAD_PER_CONNECTION(). + * Works only with #MHD_D_OPTION_WM_WORKER_THREADS() or + * #MHD_D_OPTION_WM_THREAD_PER_CONNECTION(). * @param sizet_val the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested * values */ # define MHD_D_OPTION_STACK_SIZE(sizet_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_STACK_SIZE), \ - .val.v_stack_size = (sizet_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_STACK_SIZE), \ + .val.v_stack_size = (sizet_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * The the maximum FD value. @@ -5167,21 +5189,21 @@ struct MHD_DaemonOptionAndValue * is rejected. * Useful if application uses select() for polling the sockets, system * FD_SETSIZE is good value for this option in such case. - * Does not work with ##MHD_DAEMON_OPTION_WORKER_THREADS() or - * #MHD_DAEMON_OPTION_THREAD_PER_CONNECTION(). + * Does not work with #MHD_D_OPTION_WM_WORKER_THREADS() or + * #MHD_D_OPTION_WM_THREAD_PER_CONNECTION(). * Does not work on W32 (WinSock sockets). * @param max_fd the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested * values */ # define MHD_D_OPTION_FD_NUMBER_LIMIT(max_fd) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_FD_NUMBER_LIMIT), \ - .val.v_fd_number_limit = (max_fd) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_FD_NUMBER_LIMIT), \ + .val.v_fd_number_limit = (max_fd) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Enable `turbo`. @@ -5194,13 +5216,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_TURBO(bool_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_TURBO), \ - .val.v_turbo = (bool_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_TURBO), \ + .val.v_turbo = (bool_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Disable some internal thread safety. @@ -5218,13 +5240,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_DISABLE_THREAD_SAFETY(bool_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DISABLE_THREAD_SAFETY), \ - .val.v_disable_thread_safety = (bool_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DISABLE_THREAD_SAFETY), \ + .val.v_disable_thread_safety = (bool_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * You need to set this option if you want to disable use of HTTP "Upgrade". @@ -5238,13 +5260,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_DISALLOW_UPGRADE(bool_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DISALLOW_UPGRADE), \ - .val.v_disallow_upgrade = (bool_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DISALLOW_UPGRADE), \ + .val.v_disallow_upgrade = (bool_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Disable #MHD_action_suspend() functionality. @@ -5257,13 +5279,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_DISALLOW_SUSPEND_RESUME(bool_val) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DISALLOW_SUSPEND_RESUME), \ - .val.v_disallow_suspend_resume = (bool_val) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DISALLOW_SUSPEND_RESUME), \ + .val.v_disallow_suspend_resume = (bool_val) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Set a callback to be called for pre-start finalisation. @@ -5277,14 +5299,14 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_DAEMON_READY_CALLBACK(cb,cb_cls) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DAEMON_READY_CALLBACK), \ - .val.v_daemon_ready_callback.v_cb = (cb), \ - .val.v_daemon_ready_callback.v_cb_cls = (cb_cls) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DAEMON_READY_CALLBACK), \ + .val.v_daemon_ready_callback.v_cb = (cb), \ + .val.v_daemon_ready_callback.v_cb_cls = (cb_cls) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Set a function that should be called whenever a connection is started or @@ -5295,14 +5317,14 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_NOTIFY_CONNECTION(ncc,cls) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_NOTIFY_CONNECTION), \ - .val.v_notify_connection.v_ncc = (ncc), \ - .val.v_notify_connection.v_cls = (cls) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_NOTIFY_CONNECTION), \ + .val.v_notify_connection.v_ncc = (ncc), \ + .val.v_notify_connection.v_cls = (cls) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Register a function that should be called whenever a stream is started or @@ -5314,14 +5336,14 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_NOTIFY_STREAM(nsc,cls) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_NOTIFY_STREAM), \ - .val.v_notify_stream.v_nsc = (nsc), \ - .val.v_notify_stream.v_cls = (cls) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_NOTIFY_STREAM), \ + .val.v_notify_stream.v_nsc = (nsc), \ + .val.v_notify_stream.v_cls = (cls) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Set strong random data to be used by MHD. @@ -5337,14 +5359,14 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_RANDOM_ENTROPY(buf_size,buf) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_RANDOM_ENTROPY), \ - .val.v_random_entropy.v_buf_size = (buf_size), \ - .val.v_random_entropy.v_buf = (buf) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_RANDOM_ENTROPY), \ + .val.v_random_entropy.v_buf_size = (buf_size), \ + .val.v_random_entropy.v_buf = (buf) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Specify the size of the internal hash map array that tracks generated digest @@ -5357,13 +5379,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_DAUTH_MAP_SIZE(size) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DAUTH_MAP_SIZE), \ - .val.v_dauth_map_size = (size) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DAUTH_MAP_SIZE), \ + .val.v_dauth_map_size = (size) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Control the scope of validity of MHD-generated nonces. @@ -5372,19 +5394,19 @@ struct MHD_DaemonOptionAndValue * This option allows bitwise OR combination of * #MHD_DaemonOptionValueDAuthBindNonce values. * When this option is not used then default value is - * #MHD_DAEMON_OPTION_VALUE_DAUTH_BIND_NONCE_NONE. + * #MHD_D_OPTION_VALUE_DAUTH_BIND_NONCE_NONE. * @param bind_type the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested * values */ # define MHD_D_OPTION_DAUTH_NONCE_BIND_TYPE(bind_type) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DAUTH_NONCE_BIND_TYPE), \ - .val.v_dauth_nonce_bind_type = (bind_type) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DAUTH_NONCE_BIND_TYPE), \ + .val.v_dauth_nonce_bind_type = (bind_type) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Default nonce timeout value (in seconds) used for Digest Auth. @@ -5395,13 +5417,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_DAUTH_DEF_NONCE_TIMEOUT(timeout) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DAUTH_DEF_NONCE_TIMEOUT), \ - .val.v_dauth_def_nonce_timeout = (timeout) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DAUTH_DEF_NONCE_TIMEOUT), \ + .val.v_dauth_def_nonce_timeout = (timeout) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /** * Default maximum nc (nonce count) value used for Digest Auth. @@ -5412,13 +5434,13 @@ struct MHD_DaemonOptionAndValue * values */ # define MHD_D_OPTION_DAUTH_DEF_MAX_NC(max_nc) \ - MHD_NOWARN_COMPOUND_LITERALS_ \ + MHD_NOWARN_COMPOUND_LITERALS_ \ (const struct MHD_DaemonOptionAndValue) \ - { \ - .opt = (MHD_D_O_DAUTH_DEF_MAX_NC), \ - .val.v_dauth_def_max_nc = (max_nc) \ - } \ - MHD_RESTORE_WARN_COMPOUND_LITERALS_ + { \ + .opt = (MHD_D_O_DAUTH_DEF_MAX_NC), \ + .val.v_dauth_def_max_nc = (max_nc) \ + } \ + MHD_RESTORE_WARN_COMPOUND_LITERALS_ /* = MHD Daemon Option macros above are generated automatically = */ @@ -5439,12 +5461,12 @@ MHD_NOWARN_UNUSED_FUNC_ /* = MHD Daemon Option static functions below are generated automatically = */ /** * Set MHD work (threading and polling) mode. - * Consider use of #MHD_DAEMON_OPTION_WM_EXTERNAL_PERIODIC(), - * #MHD_DAEMON_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), - * #MHD_DAEMON_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), - * #MHD_DAEMON_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), - * #MHD_DAEMON_OPTION_WM_WORKER_THREADS() or - * #MHD_DAEMON_OPTION_WM_THREAD_PER_CONNECTION() instead of direct use of this + * Consider use of #MHD_D_OPTION_WM_EXTERNAL_PERIODIC(), + * #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), + * #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), + * #MHD_D_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), + * #MHD_D_OPTION_WM_WORKER_THREADS() or + * #MHD_D_OPTION_WM_THREAD_PER_CONNECTION() instead of direct use of this * parameter. * @param wmp the object created by one of the next functions/macros: * #MHD_WM_OPTION_EXTERNAL_PERIODIC(), @@ -5512,12 +5534,11 @@ MHD_D_OPTION_LOG_CALLBACK ( /** * Bind to the given TCP port and address family. * - * Does not work with #MHD_DAEMON_OPTION_BIND_SA() or - * #MHD_DAEMON_OPTION_LISTEN_SOCKET(). + * Does not work with #MHD_D_OPTION_BIND_SA() or #MHD_D_OPTION_LISTEN_SOCKET(). * - * If no listen socket optins (#MHD_DAEMON_OPTION_BIND_PORT(), - * #MHD_DAEMON_OPTION_BIND_SA(), #MHD_DAEMON_OPTION_LISTEN_SOCKET()) are used, - * MHD does not listen for incoming connection. + * If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), + * #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does + * not listen for incoming connection. * @param af the address family to use, * the #MHD_AF_NONE to disable listen socket (the same effect as if * this option is not used) @@ -5544,12 +5565,12 @@ MHD_D_OPTION_BIND_PORT ( /** * Bind to the given socket address. * - * Does not work with #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_LISTEN_SOCKET(). + * Does not work with #MHD_D_OPTION_BIND_PORT() or + * #MHD_D_OPTION_LISTEN_SOCKET(). * - * If no listen socket optins (#MHD_DAEMON_OPTION_BIND_PORT(), - * #MHD_DAEMON_OPTION_BIND_SA(), #MHD_DAEMON_OPTION_LISTEN_SOCKET()) are used, - * MHD does not listen for incoming connection. + * If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), + * #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does + * not listen for incoming connection. * @param sa_len the size of the socket address pointed by @a sa. * @param sa the address to bind to; can be IPv4 (AF_INET), IPv6 (AF_INET6) or * even a UNIX domain socket (AF_UNIX) @@ -5575,12 +5596,11 @@ MHD_D_OPTION_BIND_SA ( * Accept connections from the given socket. Socket * must be a TCP or UNIX domain (SOCK_STREAM) socket. * - * Does not work with #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA(). + * Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA(). * - * If no listen socket optins (#MHD_DAEMON_OPTION_BIND_PORT(), - * #MHD_DAEMON_OPTION_BIND_SA(), #MHD_DAEMON_OPTION_LISTEN_SOCKET()) are used, - * MHD does not listen for incoming connection. + * If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), + * #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does + * not listen for incoming connection. * @param listen_fd the listen socket to use, ignored if set to * #MHD_INVALID_SOCKET * @return the object of struct MHD_DaemonOptionAndValue with the requested @@ -5601,8 +5621,8 @@ MHD_D_OPTION_LISTEN_SOCKET (MHD_socket listen_fd) /** * Select mode of reusing address:port listen address. * - * Works only when #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA() are used. + * Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are + * used. * @param reuse_type the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested * values @@ -5627,8 +5647,8 @@ MHD_D_OPTION_LISTEN_ADDR_REUSE (enum MHD_DaemonOptionBindType reuse_type) * attack as the TCP stack has to now allocate resources for the SYN * packet along with its DATA. * - * Works only when #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA() are used. + * Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are + * used. * @param option the type use of of TCP FastOpen * @param queue_length the length of the queue, zero to use system or MHD * default, @@ -5655,8 +5675,8 @@ MHD_D_OPTION_TCP_FASTOPEN ( /** * Use the given backlog for the listen() call. * - * Works only when #MHD_DAEMON_OPTION_BIND_PORT() or - * #MHD_DAEMON_OPTION_BIND_SA() are used. + * Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are + * used. * @param backlog_size the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested * values @@ -5719,7 +5739,7 @@ MHD_D_OPTION_TLS (enum MHD_TlsBackend backend) * Works only if TLS mode is enabled. * @param mem_key the private key loaded into memory (not a filename) * @param mem_cert the certificate loaded into memory (not a filename) - * @param mem_cert the option passphrase phrase to decrypt the private key, + * @param mem_pass the option passphrase phrase to decrypt the private key, * could be NULL is private does not need a password * @return the object of struct MHD_DaemonOptionAndValue with the requested * values @@ -5728,14 +5748,14 @@ static MHD_INLINE struct MHD_DaemonOptionAndValue MHD_D_OPTION_TLS_KEY_CERT ( const char *mem_key, const char *mem_cert, - const char *mem_cert) + const char *mem_pass) { struct MHD_DaemonOptionAndValue opt_val; opt_val.opt = MHD_D_O_TLS_KEY_CERT; opt_val.val.v_tls_key_cert.v_mem_key = mem_key; opt_val.val.v_tls_key_cert.v_mem_cert = mem_cert; - opt_val.val.v_tls_key_cert.v_mem_cert = mem_cert; + opt_val.val.v_tls_key_cert.v_mem_pass = mem_pass; return opt_val; } @@ -6050,8 +6070,8 @@ MHD_D_OPTION_LARGE_POOL_SIZE (size_t sizet_val) /** * Desired size of the stack for the threads started by MHD. * Use 0 for system default, which is also MHD default. - * Works only with ##MHD_DAEMON_OPTION_WORKER_THREADS() or - * #MHD_DAEMON_OPTION_THREAD_PER_CONNECTION(). + * Works only with #MHD_D_OPTION_WM_WORKER_THREADS() or + * #MHD_D_OPTION_WM_THREAD_PER_CONNECTION(). * @param sizet_val the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested * values @@ -6077,8 +6097,8 @@ MHD_D_OPTION_STACK_SIZE (size_t sizet_val) * is rejected. * Useful if application uses select() for polling the sockets, system * FD_SETSIZE is good value for this option in such case. - * Does not work with ##MHD_DAEMON_OPTION_WORKER_THREADS() or - * #MHD_DAEMON_OPTION_THREAD_PER_CONNECTION(). + * Does not work with #MHD_D_OPTION_WM_WORKER_THREADS() or + * #MHD_D_OPTION_WM_THREAD_PER_CONNECTION(). * Does not work on W32 (WinSock sockets). * @param max_fd the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested @@ -6320,7 +6340,7 @@ MHD_D_OPTION_DAUTH_MAP_SIZE (size_t size) * This option allows bitwise OR combination of * #MHD_DaemonOptionValueDAuthBindNonce values. * When this option is not used then default value is - * #MHD_DAEMON_OPTION_VALUE_DAUTH_BIND_NONCE_NONE. + * #MHD_D_OPTION_VALUE_DAUTH_BIND_NONCE_NONE. * @param bind_type the value of the parameter * @return the object of struct MHD_DaemonOptionAndValue with the requested * values @@ -6536,10 +6556,9 @@ MHD_NOWARN_VARIADIC_MACROS_ MHD_OPTIONS_ARRAY_MAX_SIZE) \ MHD_RESTORE_WARN_COMPOUND_LITERALS_ # elif defined(MHD_USE_CPP_INIT_LIST) -} /* extern "C" */ +MHD_C_DECLRATIONS_FINISH_HERE_ # include <vector> -extern "C" -{ +MHD_C_DECLRATIONS_START_HERE_ /** * Set the requested options for the daemon. * @@ -6879,10 +6898,9 @@ MHD_NOWARN_VARIADIC_MACROS_ MHD_OPTIONS_ARRAY_MAX_SIZE) \ MHD_RESTORE_WARN_COMPOUND_LITERALS_ # elif defined(MHD_USE_CPP_INIT_LIST) -} /* extern "C" */ +MHD_C_DECLRATIONS_FINISH_HERE_ # include <vector> -extern "C" -{ +MHD_C_DECLRATIONS_START_HERE_ /** * Set the requested options for the connection. * @@ -6923,18 +6941,18 @@ enum MHD_FLAGS_ENUM_ MHD_ValueKind /** * HTTP header. */ - MHD_VK_HEADER = 1 + MHD_VK_HEADER = (1 << 0) , /** * Cookies. Note that the original HTTP header containing * the cookie(s) will still be available and intact. */ - MHD_VK_COOKIE = 2 + MHD_VK_COOKIE = (1 << 1) , /** * GET (URI) arguments. */ - MHD_VK_GET_ARGUMENT = 4 + MHD_VK_GET_ARGUMENT = (1 << 2) , /** * POST data. @@ -6948,18 +6966,18 @@ enum MHD_FLAGS_ENUM_ MHD_ValueKind * important to check used "Transfer-Encoding". While it is deprecated and * not used by modern clients, hypothetically it can be used. */ - MHD_VK_POSTDATA = 8 + MHD_VK_POSTDATA = (1 << 3) , /** * HTTP footer (only for HTTP 1.1 chunked encodings). */ - MHD_VK_FOOTER = 16 + MHD_VK_FOOTER = (1 << 4) , /** * Header and footer values */ - MHD_VK_HEADER_FOOTER = MHD_VK_HEADER | MHD_VK_FOOTER, - + MHD_VK_HEADER_FOOTER = MHD_VK_HEADER | MHD_VK_FOOTER + , /** * Values from get arguments or post data */ @@ -7323,6 +7341,11 @@ MHD_FN_PAR_NONNULL_ALL_; /* ************** Action and Response manipulation functions **************** */ /** + * @defgroup response Response objects control + */ + + +/** * Name with value pair as C strings */ struct MHD_NameValueCStr @@ -8155,10 +8178,9 @@ MHD_NOWARN_VARIADIC_MACROS_ MHD_OPTIONS_ARRAY_MAX_SIZE) \ MHD_RESTORE_WARN_COMPOUND_LITERALS_ # elif defined(MHD_USE_CPP_INIT_LIST) -} /* extern "C" */ +MHD_C_DECLRATIONS_FINISH_HERE_ # include <vector> -extern "C" -{ +MHD_C_DECLRATIONS_START_HERE_ /** * Set the requested options for the daemon. * @@ -8331,9 +8353,6 @@ MHD_FN_RETURNS_NONNULL_; * the sum of all data sizes provided by this callback * @param[out] buf where to copy the data * @param max maximum number of bytes to copy to @a buf (size of @a buf) - * @param[out] action the action to set, - * the pointer is only valid until - * the callback returns * @return action to use, * NULL in case of any error (the response will be aborted) */ @@ -9046,14 +9065,14 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_DigestBaseAlgo * MD5 hash algorithm. * As specified by RFC1321 */ - MHD_DIGEST_BASE_ALGO_MD5 = (1 << 0), - + MHD_DIGEST_BASE_ALGO_MD5 = (1 << 0) + , /** * SHA-256 hash algorithm. * As specified by FIPS PUB 180-4 */ - MHD_DIGEST_BASE_ALGO_SHA256 = (1 << 1), - + MHD_DIGEST_BASE_ALGO_SHA256 = (1 << 1) + , /** * SHA-512/256 hash algorithm. * As specified by FIPS PUB 180-4 @@ -9089,34 +9108,34 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_DigestAuthAlgo * The 'MD5' algorithm, non-session version. */ MHD_DIGEST_AUTH_ALGO_MD5 = - MHD_DIGEST_BASE_ALGO_MD5 | MHD_DIGEST_AUTH_ALGO_NON_SESSION, - + MHD_DIGEST_BASE_ALGO_MD5 | MHD_DIGEST_AUTH_ALGO_NON_SESSION + , /** * The 'MD5-sess' algorithm. * Not supported by MHD for authentication. */ MHD_DIGEST_AUTH_ALGO_MD5_SESSION = - MHD_DIGEST_BASE_ALGO_MD5 | MHD_DIGEST_AUTH_ALGO_SESSION, - + MHD_DIGEST_BASE_ALGO_MD5 | MHD_DIGEST_AUTH_ALGO_SESSION + , /** * The 'SHA-256' algorithm, non-session version. */ MHD_DIGEST_AUTH_ALGO_SHA256 = - MHD_DIGEST_BASE_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO_NON_SESSION, - + MHD_DIGEST_BASE_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO_NON_SESSION + , /** * The 'SHA-256-sess' algorithm. * Not supported by MHD for authentication. */ MHD_DIGEST_AUTH_ALGO_SHA256_SESSION = - MHD_DIGEST_BASE_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO_SESSION, - + MHD_DIGEST_BASE_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO_SESSION + , /** * The 'SHA-512-256' (SHA-512/256) algorithm. */ MHD_DIGEST_AUTH_ALGO_SHA512_256 = - MHD_DIGEST_BASE_ALGO_SHA512_256 | MHD_DIGEST_AUTH_ALGO_NON_SESSION, - + MHD_DIGEST_BASE_ALGO_SHA512_256 | MHD_DIGEST_AUTH_ALGO_NON_SESSION + , /** * The 'SHA-512-256-sess' (SHA-512/256 session) algorithm. * Not supported by MHD for authentication. @@ -9154,60 +9173,60 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_DigestAuthMultiAlgo /** * Unknown or wrong algorithm type. */ - MHD_DIGEST_AUTH_MULT_ALGO_INVALID = MHD_DIGEST_AUTH_ALGO_INVALID, - + MHD_DIGEST_AUTH_MULT_ALGO_INVALID = MHD_DIGEST_AUTH_ALGO_INVALID + , /** * The 'MD5' algorithm, non-session version. */ - MHD_DIGEST_AUTH_MULT_ALGO_MD5 = MHD_DIGEST_AUTH_ALGO_MD5, - + MHD_DIGEST_AUTH_MULT_ALGO_MD5 = MHD_DIGEST_AUTH_ALGO_MD5 + , /** * The 'MD5-sess' algorithm. * Not supported by MHD for authentication. * Reserved value. */ - MHD_DIGEST_AUTH_MULT_ALGO_MD5_SESSION = MHD_DIGEST_AUTH_ALGO_MD5_SESSION, - + MHD_DIGEST_AUTH_MULT_ALGO_MD5_SESSION = MHD_DIGEST_AUTH_ALGO_MD5_SESSION + , /** * The 'SHA-256' algorithm, non-session version. */ - MHD_DIGEST_AUTH_MULT_ALGO_SHA256 = MHD_DIGEST_AUTH_ALGO_SHA256, - + MHD_DIGEST_AUTH_MULT_ALGO_SHA256 = MHD_DIGEST_AUTH_ALGO_SHA256 + , /** * The 'SHA-256-sess' algorithm. * Not supported by MHD for authentication. * Reserved value. */ MHD_DIGEST_AUTH_MULT_ALGO_SHA256_SESSION = - MHD_DIGEST_AUTH_ALGO_SHA256_SESSION, - + MHD_DIGEST_AUTH_ALGO_SHA256_SESSION + , /** * The 'SHA-512-256' (SHA-512/256) algorithm, non-session version. */ - MHD_DIGEST_AUTH_MULT_ALGO_SHA512_256 = MHD_DIGEST_AUTH_ALGO_SHA512_256, - + MHD_DIGEST_AUTH_MULT_ALGO_SHA512_256 = MHD_DIGEST_AUTH_ALGO_SHA512_256 + , /** * The 'SHA-512-256-sess' (SHA-512/256 session) algorithm. * Not supported by MHD for authentication. * Reserved value. */ MHD_DIGEST_AUTH_MULT_ALGO_SHA512_256_SESSION = - MHD_DIGEST_AUTH_ALGO_SHA512_256_SESSION, - + MHD_DIGEST_AUTH_ALGO_SHA512_256_SESSION + , /** * SHA-256 or SHA-512/256 non-session algorithm, MHD will choose * the preferred or the matching one. */ MHD_DIGEST_AUTH_MULT_ALGO_SHA_ANY_NON_SESSION = - MHD_DIGEST_AUTH_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO_SHA512_256, - + MHD_DIGEST_AUTH_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO_SHA512_256 + , /** * Any non-session algorithm, MHD will choose the preferred or * the matching one. */ MHD_DIGEST_AUTH_MULT_ALGO_ANY_NON_SESSION = - (0x3F) | MHD_DIGEST_AUTH_ALGO_NON_SESSION, - + (0x3F) | MHD_DIGEST_AUTH_ALGO_NON_SESSION + , /** * The SHA-256 or SHA-512/256 session algorithm. * Not supported by MHD. @@ -9215,47 +9234,47 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_DigestAuthMultiAlgo */ MHD_DIGEST_AUTH_MULT_ALGO_SHA_ANY_SESSION = MHD_DIGEST_AUTH_ALGO_SHA256_SESSION - | MHD_DIGEST_AUTH_ALGO_SHA512_256_SESSION, - + | MHD_DIGEST_AUTH_ALGO_SHA512_256_SESSION + , /** * Any session algorithm. * Not supported by MHD. * Reserved value. */ MHD_DIGEST_AUTH_MULT_ALGO_ANY_SESSION = - (0x3F) | MHD_DIGEST_AUTH_ALGO_SESSION, - + (0x3F) | MHD_DIGEST_AUTH_ALGO_SESSION + , /** * The MD5 algorithm, session or non-session. * Currently supported as non-session only. */ MHD_DIGEST_AUTH_MULT_ALGO_MD5_ANY = - MHD_DIGEST_AUTH_MULT_ALGO_MD5 | MHD_DIGEST_AUTH_MULT_ALGO_MD5_SESSION, - + MHD_DIGEST_AUTH_MULT_ALGO_MD5 | MHD_DIGEST_AUTH_MULT_ALGO_MD5_SESSION + , /** * The SHA-256 algorithm, session or non-session. * Currently supported as non-session only. */ MHD_DIGEST_AUTH_MULT_ALGO_SHA256_ANY = MHD_DIGEST_AUTH_MULT_ALGO_SHA256 - | MHD_DIGEST_AUTH_MULT_ALGO_SHA256_SESSION, - + | MHD_DIGEST_AUTH_MULT_ALGO_SHA256_SESSION + , /** * The SHA-512/256 algorithm, session or non-session. * Currently supported as non-session only. */ MHD_DIGEST_AUTH_MULT_ALGO_SHA512_256_ANY = MHD_DIGEST_AUTH_MULT_ALGO_SHA512_256 - | MHD_DIGEST_AUTH_MULT_ALGO_SHA512_256_SESSION, - + | MHD_DIGEST_AUTH_MULT_ALGO_SHA512_256_SESSION + , /** * The SHA-256 or SHA-512/256 algorithm, session or non-session. * Currently supported as non-session only. */ MHD_DIGEST_AUTH_MULT_ALGO_SHA_ANY_ANY = MHD_DIGEST_AUTH_MULT_ALGO_SHA_ANY_NON_SESSION - | MHD_DIGEST_AUTH_MULT_ALGO_SHA_ANY_SESSION, - + | MHD_DIGEST_AUTH_MULT_ALGO_SHA_ANY_SESSION + , /** * Any algorithm, MHD will choose the preferred or the matching one. */ @@ -9307,10 +9326,8 @@ MHD_digest_auth_calc_userhash (enum MHD_DigestAuthAlgo algo, const char *realm, size_t bin_buf_size, void *userhash_bin) -MHD_FN_PURE_ -MHD_FN_PAR_NONNULL_ALL_ - MHD_FN_PAR_CSTR_ (2) MHD_FN_PAR_CSTR_ (3) -MHD_FN_PAR_OUT_SIZE_ (4,3); +MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_CSTR_ (2) +MHD_FN_PAR_CSTR_ (3) MHD_FN_PAR_OUT_SIZE_ (4,3); /** @@ -9348,7 +9365,6 @@ MHD_FN_PAR_OUT_SIZE_ (4,3); * @return MHD_SC_OK on success, * error code otherwise * @sa #MHD_digest_auth_calc_userhash() - * @note Available since #MHD_VERSION 0x00097701 * @ingroup authentication */ MHD_EXTERN_ enum MHD_StatusCode @@ -9358,12 +9374,8 @@ MHD_digest_auth_calc_userhash_hex ( const char *realm, size_t hex_buf_size, char userhash_hex[MHD_FN_PAR_DYN_ARR_SIZE_ (hex_buf_size)]) -MHD_FN_PURE_ -MHD_FN_PAR_NONNULL_ALL_ - MHD_FN_PAR_CSTR_ (2) MHD_FN_PAR_CSTR_ (3) -MHD_FN_PAR_OUT_SIZE_ (4,3); - -; +MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_CSTR_ (2) +MHD_FN_PAR_CSTR_ (3) MHD_FN_PAR_OUT_SIZE_ (4,3); /** @@ -9389,23 +9401,23 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_DigestAuthUsernameType /** * The 'username' parameter is used to specify the username. */ - MHD_DIGEST_AUTH_UNAME_TYPE_STANDARD = (1 << 2), - + MHD_DIGEST_AUTH_UNAME_TYPE_STANDARD = (1 << 2) + , /** * The username is specified by 'username*' parameter with * the extended notation (see RFC 5987 #section-3.2.1). * The only difference between standard and extended types is * the way how username value is encoded in the header. */ - MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED = (1 << 3), - + MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED = (1 << 3) + , /** * The username provided in form of 'userhash' as * specified by RFC 7616 #section-3.4.4. * @sa #MHD_digest_auth_calc_userhash_hex(), #MHD_digest_auth_calc_userhash() */ - MHD_DIGEST_AUTH_UNAME_TYPE_USERHASH = (1 << 1), - + MHD_DIGEST_AUTH_UNAME_TYPE_USERHASH = (1 << 1) + , /** * The invalid combination of username parameters are used by client. * Either: @@ -9437,13 +9449,13 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_DigestAuthQOP * parameter). * This mode is less secure than other modes and inefficient. */ - MHD_DIGEST_AUTH_QOP_NONE = 1 << 0, - + MHD_DIGEST_AUTH_QOP_NONE = 1 << 0 + , /** * The 'auth' QOP type. */ - MHD_DIGEST_AUTH_QOP_AUTH = 1 << 1, - + MHD_DIGEST_AUTH_QOP_AUTH = 1 << 1 + , /** * The 'auth-int' QOP type. * Not supported by MHD for authentication. @@ -9462,8 +9474,8 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_DigestAuthMultiQOP /** * Invalid/unknown QOP. */ - MHD_DIGEST_AUTH_MULT_QOP_INVALID = MHD_DIGEST_AUTH_QOP_INVALID, - + MHD_DIGEST_AUTH_MULT_QOP_INVALID = MHD_DIGEST_AUTH_QOP_INVALID + , /** * No QOP parameter. * As described in old RFC 2069 original specification. @@ -9472,20 +9484,20 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_DigestAuthMultiQOP * parameter). * This mode is less secure than other modes and inefficient. */ - MHD_DIGEST_AUTH_MULT_QOP_NONE = MHD_DIGEST_AUTH_QOP_NONE, - + MHD_DIGEST_AUTH_MULT_QOP_NONE = MHD_DIGEST_AUTH_QOP_NONE + , /** * The 'auth' QOP type. */ - MHD_DIGEST_AUTH_MULT_QOP_AUTH = MHD_DIGEST_AUTH_QOP_AUTH, - + MHD_DIGEST_AUTH_MULT_QOP_AUTH = MHD_DIGEST_AUTH_QOP_AUTH + , /** * The 'auth-int' QOP type. * Not supported by MHD. * Reserved value. */ - MHD_DIGEST_AUTH_MULT_QOP_AUTH_INT = MHD_DIGEST_AUTH_QOP_AUTH_INT, - + MHD_DIGEST_AUTH_MULT_QOP_AUTH_INT = MHD_DIGEST_AUTH_QOP_AUTH_INT + , /** * The 'auth' QOP type OR the old RFC2069 (no QOP) type. * In other words: any types except 'auth-int'. @@ -9493,8 +9505,8 @@ enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_DigestAuthMultiQOP * when it is really necessary. */ MHD_DIGEST_AUTH_MULT_QOP_ANY_NON_INT = - MHD_DIGEST_AUTH_QOP_NONE | MHD_DIGEST_AUTH_QOP_AUTH, - + MHD_DIGEST_AUTH_QOP_NONE | MHD_DIGEST_AUTH_QOP_AUTH + , /** * Any 'auth' QOP type ('auth' or 'auth-int'). * Currently supported as 'auth' QOP type only. @@ -9690,38 +9702,38 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_DigestAuthResult * Also may be returned if required parameters in client Authorisation header * are missing or broken (in invalid format). */ - MHD_DAUTH_WRONG_HEADER = -1, - + MHD_DAUTH_WRONG_HEADER = -1 + , /** * Wrong 'username'. */ - MHD_DAUTH_WRONG_USERNAME = -2, - + MHD_DAUTH_WRONG_USERNAME = -2 + , /** * Wrong 'realm'. */ - MHD_DAUTH_WRONG_REALM = -3, - + MHD_DAUTH_WRONG_REALM = -3 + , /** * Wrong 'URI' (or URI parameters). */ - MHD_DAUTH_WRONG_URI = -4, - + MHD_DAUTH_WRONG_URI = -4 + , /** * Wrong 'qop'. */ - MHD_DAUTH_WRONG_QOP = -5, - + MHD_DAUTH_WRONG_QOP = -5 + , /** * Wrong 'algorithm'. */ - MHD_DAUTH_WRONG_ALGO = -6, - + MHD_DAUTH_WRONG_ALGO = -6 + , /** * Too large (>64 KiB) Authorization parameter value. */ - MHD_DAUTH_TOO_LARGE = -15, - + MHD_DAUTH_TOO_LARGE = -15 + , /* The different form of naming is intentionally used for the results below, * as they are more important */ @@ -9730,8 +9742,8 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_DigestAuthResult * username and password to get the fresh 'nonce'. * The validity of the 'nonce' may be not checked. */ - MHD_DAUTH_NONCE_STALE = -17, - + MHD_DAUTH_NONCE_STALE = -17 + , /** * The 'nonce' was generated by MHD for other conditions. * This value is only returned if #MHD_OPTION_DIGEST_AUTH_NONCE_BIND_TYPE @@ -9744,13 +9756,13 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_DigestAuthResult * it is know that clients have fixed IP addresses, this return code could * be handled like #MHD_DAUTH_NONCE_WRONG. */ - MHD_DAUTH_NONCE_OTHER_COND = -18, - + MHD_DAUTH_NONCE_OTHER_COND = -18 + , /** * The 'nonce' is wrong. May indicate an attack attempt. */ - MHD_DAUTH_NONCE_WRONG = -33, - + MHD_DAUTH_NONCE_WRONG = -33 + , /** * The 'response' is wrong. May indicate an attack attempt. */ @@ -9841,7 +9853,7 @@ MHD_digest_auth_calc_userdigest (enum MHD_DigestAuthAlgo algo, size_t bin_buf_size, void *userdigest_bin) MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_ - MHD_FN_PAR_CSTR_ (2) +MHD_FN_PAR_CSTR_ (2) MHD_FN_PAR_CSTR_ (3) MHD_FN_PAR_CSTR_ (4) MHD_FN_PAR_OUT_SIZE_ (6,5); @@ -9899,7 +9911,7 @@ MHD_digest_auth_check_digest (struct MHD_Request *request, enum MHD_DigestAuthMultiQOP mqop, enum MHD_DigestAuthMultiAlgo malgo) MHD_FN_PAR_NONNULL_ALL_ - MHD_FN_PAR_CSTR_ (2) +MHD_FN_PAR_CSTR_ (2) MHD_FN_PAR_CSTR_ (3) MHD_FN_PAR_CSTR_ (4); @@ -9963,7 +9975,6 @@ MHD_FN_PAR_CSTR_ (4); * @return pointer to the action on success, * NULL on failure * @ingroup authentication - * @ingroup action */ MHD_EXTERN_ const struct MHD_Action * MHD_action_digest_auth_required_response ( @@ -10030,7 +10041,6 @@ struct MHD_BasicAuthInfo * @return pointer to the action on success, * NULL on failure * @ingroup authentication - * @ingroup action */ MHD_EXTERN_ const struct MHD_Action * MHD_action_basic_auth_required_response ( @@ -10133,8 +10143,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed /** * Get whether the early version the Digest Authorization (RFC 2069) is * supported (digest authorisation without QOP parameter). - * Since #MHD_VERSION 0x00097701 it is always supported if Digest Auth - * module is built. + * Currently it is always supported if Digest Auth module is built. * The result is placed in @a v_bool member. */ MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH_RFC2069 = 22 @@ -10605,7 +10614,7 @@ enum MHD_DaemonInfoFixedType /** * Request the port number of daemon's listen socket. * No extra arguments should be passed. - * Note: if port '0' was specified for #MHD_option_port(), returned + * Note: if port '0' was specified for #MHD_D_OPTION_BIND_PORT(), returned * value will be real port number. * The result is placed in @a v_port member. */ @@ -10709,9 +10718,9 @@ enum MHD_DaemonInfoDynamicType * If resulting value is zero then daemon data processing function should be * called as soon as possible as some data processing is already pending. * The data processing function can also be called earlier as well. - * Available only for daemons stated in #MHD_TM_EXTERNAL_PERIODIC, - * #MHD_TM_EXTERNAL_EVENT_LOOP_CB_LEVEL, #MHD_TM_EXTERNAL_EVENT_LOOP_CB_EDGE - * or #MHD_TM_EXTERNAL_SINGLE_FD_WATCH modes. + * Available only for daemons stated in #MHD_WM_EXTERNAL_PERIODIC, + * #MHD_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL, #MHD_WM_EXTERNAL_EVENT_LOOP_CB_EDGE + * or #MHD_WM_EXTERNAL_SINGLE_FD_WATCH modes. * The result is placed in @a v_uint64 member. */ MHD_DAEMON_INFO_DYNAMIC_MAX_TIME_TO_WAIT = 1 @@ -10719,9 +10728,9 @@ enum MHD_DaemonInfoDynamicType /** * Request the number of current connections handled by the daemon. * No extra arguments should be passed. - * Note: when using MHD in external polling mode, this type of request - * could be used only when #MHD_run()/#MHD_run_from_select is not - * working in other thread at the same time. + * Note: when using MHD without internal threads, this type of request + * could be used only when MHD is is not processing the connection data + * in other thread at the same time. * The result is placed in @a v_uint member. */ MHD_DAEMON_INFO_DYNAMIC_CURRENT_CONNECTIONS = 20 @@ -11498,7 +11507,6 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType */ MHD_REQUEST_INFO_DYNAMIC_HEADER_SIZE = 21 , - /** * Returns the client-specific pointer to a `void *` that * is specific to this request. // TODO: check reference @@ -11506,7 +11514,6 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType */ MHD_REQUEST_INFO_DYNAMIC_CLIENT_CONTEXT = 31 , - /** * Returns pointer to information about username in client's digest auth * request. @@ -11539,7 +11546,6 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType */ MHD_REQUEST_INFO_DYNAMIC_BAUTH_REQ_INFO = 51 , - /* * Sentinel * */ /** * The sentinel value. @@ -11677,5 +11683,6 @@ MHD_lib_set_panic_func (MHD_PanicCallback cb, #define MHD_lib_set_panic_func_default() \ MHD_lib_set_panic_func (MHD_STATIC_CAST_ (MHD_PanicCallback,NULL),NULL) +MHD_C_DECLRATIONS_FINISH_HERE_ -#endif +#endif /* ! MICROHTTPD2_H */