Implemented MHD_lib_get_info_{fixed,dynamic}()

This commit is contained in:
Evgeny Grin (Karlson2k)
2025-01-13 14:24:45 +01:00
parent 0dc92ad386
commit 7fcf4eb495
5 changed files with 498 additions and 117 deletions
+99 -50
View File
@@ -8550,46 +8550,57 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* Exceptions are marked explicitly in the description. */
/**
* Get whether messages are supported. If supported then in debug
* mode messages can be printed to stderr or to external logger.
* Get whether messages are supported. If supported then messages can be
* printed to stderr or to an external logger.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_MESSAGES = 11
MHD_LIB_INFO_FIXED_HAS_LOG_MESSAGES = 11
,
/**
* Get whether detailed automatic HTTP reply messages are supported.
* If supported then automatic responses have bodies with text expalining
* the error details.
* Automatic responses are sent by MHD automatically when client is violating
* HTTP specification, for example, the request header has whitespace in
* header name or request's "Content-Length" header has non-number value.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AUTO_REPLIES_BODIES = 12
,
/**
* Get whether MHD was built with debug asserts disabled.
* These asserts enabled only on special debug builds.
* For debug builds the error log is always enabled.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_IS_NON_DEBUG = 13
,
/**
* Get whether MHD supports threads.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_THREADS = 12
,
/**
* Get whether MHD was built with asserts enabled.
* Enabled only on special debug builds.
* For debug builds the error log is always enabled.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_DEBUG = 13
MHD_LIB_INFO_FIXED_HAS_THREADS = 14
,
/**
* Get whether automatic parsing of HTTP Cookie header is supported.
* If disabled, no #MHD_VK_COOKIE will be generated by MHD.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_COOKIE_PARSER = 14
MHD_LIB_INFO_FIXED_HAS_COOKIE_PARSER = 15
,
/**
* Get whether postprocessor is supported. If supported then
* #MHD_action_post_processor() can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_POST_PARSER = 15
MHD_LIB_INFO_FIXED_HAS_POST_PARSER = 16
,
/**
* Get whether HTTP "Upgrade" is supported.
* If supported then #MHD_action_upgrade() can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_UPGRADE = 16
MHD_LIB_INFO_FIXED_HAS_UPGRADE = 17
,
/**
* Get whether HTTP Basic authorization is supported. If supported
@@ -8597,7 +8608,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* and #MHD_REQUEST_INFO_DYNAMIC_AUTH_BASIC_CREDS can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_BASIC_AUTH = 20
MHD_LIB_INFO_FIXED_HAS_AUTH_BASIC = 20
,
/**
* Get whether HTTP Digest authorization is supported. If
@@ -8607,7 +8618,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* #MHD_digest_auth_check() can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH = 21
MHD_LIB_INFO_FIXED_HAS_AUTH_DIGEST = 21
,
/**
* Get whether the early version the Digest Authorization (RFC 2069) is
@@ -8673,66 +8684,80 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* the toolchain.
* Some of the features can be disabled or selected at build-time. */
/**
* Get supported sockets polling function/techniques.
* Get sockets polling functions/techniques supported by this MHD build.
* Some functions can be disabled (like epoll) in kernel, this is not
* checked.
* The result is placed in @a v_polling member.
*/
MHD_LIB_INFO_FIXED_TYPE_SOCKETS_POLLING = 50
MHD_LIB_INFO_FIXED_TYPE_SOCKETS_POLLING = 60
,
/**
* Get whether aggregate FD external polling is supported.
* The result is placed in @a v_polling member.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AGGREGATE_FD = 51
MHD_LIB_INFO_FIXED_HAS_AGGREGATE_FD = 61
,
/**
* Get whether IPv6 is supported on the platform and whether IPv6 without IPv4
* Get whether IPv6 is supported on the platform and IPv6-only listen socket
* can be used.
* The result is placed in @a v_ipv6 member.
* @note The platform may have disabled IPv6 at run-time, it is not checked
* by this information type.
*/
MHD_LIB_INFO_FIXED_TYPE_IPv6 = 52
MHD_LIB_INFO_FIXED_TYPE_IPV6 = 62
,
/**
* Get whether TCP Fast Open is supported by MHD build.
* If supported then option #MHD_D_O_TCP_FASTOPEN can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_TCP_FASTOPEN = 53
MHD_LIB_INFO_FIXED_HAS_TCP_FASTOPEN = 64
,
/**
* Get whether MHD support automatic detection of bind port number.
* @sa #MHD_D_O_BIND_PORT
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AUTODETECT_BIND_PORT = 54
MHD_LIB_INFO_FIXED_HAS_AUTODETECT_BIND_PORT = 65
,
/**
* Get whether MHD use system's sendfile() function to send
* file-FD based responses over non-TLS connections.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_SENDFILE = 55
MHD_LIB_INFO_FIXED_HAS_SENDFILE = 66
,
/**
* Get whether MHD supports automatic SIGPIPE suppression.
* Get whether MHD supports automatic SIGPIPE suppression within internal
* events loop (MHD's managed threads).
* If SIGPIPE suppression is not supported, application must handle
* SIGPIPE signal by itself.
* SIGPIPE signal by itself whem using MHD with internal events loop.
* If the platform does not have SIGPIPE the result is #MHD_YES.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AUTOSUPPRESS_SIGPIPE = 60
MHD_LIB_INFO_FIXED_HAS_AUTOSUPPRESS_SIGPIPE_INT = 80
,
/**
* Get whether MHD supports automatic SIGPIPE suppression when used with
* extenal events loop (in application thread).
* If SIGPIPE suppression is not supported, application must handle
* SIGPIPE signal by itself whem using MHD with external events loop.
* If the platform does not have SIGPIPE the result is #MHD_YES.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AUTOSUPPRESS_SIGPIPE_EXT = 81
,
/**
* Get whether MHD sets names on generated threads.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_THREAD_NAMES = 61
MHD_LIB_INFO_FIXED_HAS_THREAD_NAMES = 82
,
/**
* Get the type of supported inter-thread communication.
* The result is placed in @a v_itc member.
*/
MHD_LIB_INFO_FIXED_TYPE_ITC = 62
MHD_LIB_INFO_FIXED_TYPE_ITC = 83
,
/**
* Get whether reading files beyond 2 GiB boundary is supported.
@@ -8741,7 +8766,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* limited to 2 GiB.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_LARGE_FILE = 63
MHD_LIB_INFO_FIXED_HAS_LARGE_FILE = 84
,
/* * Platform-dependent features, some set on startup and some are
@@ -8759,9 +8784,9 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
,
/**
* Get whether password encrypted private key for HTTPS daemon is
* supported. If supported then option
* #MHD_D_OPTION_TLS_KEY_CERT can be used with non-NULL @a mem_pass
* The result is placed in @a v_bool member.
* supported. If supported then option #MHD_D_OPTION_TLS_KEY_CERT
* can be used with non-NULL @a mem_pass.
* The result is placed in @a v_tls member.
*/
MHD_LIB_INFO_FIXED_HAS_TLS_KEY_PASSWORD = 102
,
@@ -8787,6 +8812,7 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_LibInfoFixedDigestAlgoType
,
/**
* The algorithm is implemented by MHD internal code.
* MHD implementation of hashing can never fail.
*/
MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_BUILT_IN = 1
,
@@ -8837,9 +8863,10 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_LibInfoFixedIPv6Type
MHD_LIB_INFO_FIXED_IPV6_TYPE_DUAL_ONLY = 1
,
/**
* IPv6 is supported as IPv6-only or as "dual stack".
* IPv6 can be used as IPv6-only (without getting IPv4 incoming connections).
* The platform may support "dual stack" too.
*/
MHD_LIB_INFO_FIXED_IPV6_TYPE_BOTH = 2
MHD_LIB_INFO_FIXED_IPV6_TYPE_IPV6_PURE = 2
};
/**
@@ -8848,22 +8875,28 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_LibInfoFixedIPv6Type
*/
enum MHD_FIXED_ENUM_MHD_SET_ MHD_LibInfoFixedITCType
{
/**
* No ITC used.
* This value is returned if MHD is built without threads support
*/
MHD_LIB_INFO_FIXED_ITC_TYPE_NONE = 0
,
/**
* The pair of sockets are used as inter-thread communication.
* The is the least efficient method of communication.
*/
MHD_LIB_INFO_FIXED_ITC_TYPE_SOCKETPAIR = 0
MHD_LIB_INFO_FIXED_ITC_TYPE_SOCKETPAIR = 1
,
/**
* The pipe is used as inter-thread communication.
*/
MHD_LIB_INFO_FIXED_ITC_TYPE_PIPE = 1
MHD_LIB_INFO_FIXED_ITC_TYPE_PIPE = 2
,
/**
* The EventFD is used as inter-thread communication.
* This is the most efficient method of communication.
*/
MHD_LIB_INFO_FIXED_ITC_TYPE_EVENTFD = 2
MHD_LIB_INFO_FIXED_ITC_TYPE_EVENTFD = 3
};
@@ -8906,11 +8939,14 @@ union MHD_LibInfoFixedData
*/
enum MHD_Bool v_bool;
/**
* The type of digest algorithm implemetation
* The type of digest algorithm implementation
*/
enum MHD_LibInfoFixedDigestAlgoType v_d_algo;
/**
* The types of the sockets polling functions/techniques supported
* The types of the sockets polling functions/techniques supported by this MHD
* build.
* Some functions can be disabled (like epoll) in kernel, this is not
* checked.
*/
struct MHD_LibInfoFixedPollingFunc v_polling;
/**
@@ -8973,21 +9009,34 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoDynamic
/* * Basic MHD information * */
/**
* Get whether MHD was successfully initialised.
* The result is #MHD_NO when the library has not been yet initialised or
* when library has been de-initialised.
* Under normal conditions the result must be always #MHD_YES when requested
* by application.
* Get whether MHD has been successfully fully initialised.
* MHD uses lazy initialisation: a minimal initialisation is perfomed at
* startup, complete initialisation is perfomed when any daemon is created
* (or called other function which requires full initialisation).
* The result is #MHD_NO when the library has been not yet initialised
* completely since startup.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_DYNAMIC_INITED = 0
MHD_LIB_INFO_DYNAMIC_INITED_FULLY_ONCE = 0
,
/**
* Get whether MHD has been successfully fully initialised.
* MHD uses lazy initialisation: a minimal initialisation is perfomed at
* startup, complete initialisation is perfomed when any daemon is created
* (or called other function which requires full initialisation).
* The result is #MHD_YES if library is initialised state now (meaning
* that at least one deamon is created and not destroyed or some function
* required full initialisation is running).
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_DYNAMIC_INITED_FULLY_NOW = 1
,
/**
* Get whether HTTPS and which types of TLS backend(s) currently available.
* If any MHD daemonis active (created and not destroyed, not nessesary
* If any MHD daemons active (created and not destroyed, not necessary
* running) the result reflects the current backends availability.
* If no MHD daemon is active, then this function would try to temporarly
* If no MHD daemon is active, then this function would try to temporarily
* enable backends to check for their availability.
* The result is placed in @a v_tls member.
*/
+99 -50
View File
@@ -3928,46 +3928,57 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* Exceptions are marked explicitly in the description. */
/**
* Get whether messages are supported. If supported then in debug
* mode messages can be printed to stderr or to external logger.
* Get whether messages are supported. If supported then messages can be
* printed to stderr or to an external logger.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_MESSAGES = 11
MHD_LIB_INFO_FIXED_HAS_LOG_MESSAGES = 11
,
/**
* Get whether detailed automatic HTTP reply messages are supported.
* If supported then automatic responses have bodies with text expalining
* the error details.
* Automatic responses are sent by MHD automatically when client is violating
* HTTP specification, for example, the request header has whitespace in
* header name or request's "Content-Length" header has non-number value.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AUTO_REPLIES_BODIES = 12
,
/**
* Get whether MHD was built with debug asserts disabled.
* These asserts enabled only on special debug builds.
* For debug builds the error log is always enabled.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_IS_NON_DEBUG = 13
,
/**
* Get whether MHD supports threads.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_THREADS = 12
,
/**
* Get whether MHD was built with asserts enabled.
* Enabled only on special debug builds.
* For debug builds the error log is always enabled.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_DEBUG = 13
MHD_LIB_INFO_FIXED_HAS_THREADS = 14
,
/**
* Get whether automatic parsing of HTTP Cookie header is supported.
* If disabled, no #MHD_VK_COOKIE will be generated by MHD.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_COOKIE_PARSER = 14
MHD_LIB_INFO_FIXED_HAS_COOKIE_PARSER = 15
,
/**
* Get whether postprocessor is supported. If supported then
* #MHD_action_post_processor() can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_POST_PARSER = 15
MHD_LIB_INFO_FIXED_HAS_POST_PARSER = 16
,
/**
* Get whether HTTP "Upgrade" is supported.
* If supported then #MHD_action_upgrade() can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_UPGRADE = 16
MHD_LIB_INFO_FIXED_HAS_UPGRADE = 17
,
/**
* Get whether HTTP Basic authorization is supported. If supported
@@ -3975,7 +3986,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* and #MHD_REQUEST_INFO_DYNAMIC_AUTH_BASIC_CREDS can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_BASIC_AUTH = 20
MHD_LIB_INFO_FIXED_HAS_AUTH_BASIC = 20
,
/**
* Get whether HTTP Digest authorization is supported. If
@@ -3985,7 +3996,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* #MHD_digest_auth_check() can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH = 21
MHD_LIB_INFO_FIXED_HAS_AUTH_DIGEST = 21
,
/**
* Get whether the early version the Digest Authorization (RFC 2069) is
@@ -4051,66 +4062,80 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* the toolchain.
* Some of the features can be disabled or selected at build-time. */
/**
* Get supported sockets polling function/techniques.
* Get sockets polling functions/techniques supported by this MHD build.
* Some functions can be disabled (like epoll) in kernel, this is not
* checked.
* The result is placed in @a v_polling member.
*/
MHD_LIB_INFO_FIXED_TYPE_SOCKETS_POLLING = 50
MHD_LIB_INFO_FIXED_TYPE_SOCKETS_POLLING = 60
,
/**
* Get whether aggregate FD external polling is supported.
* The result is placed in @a v_polling member.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AGGREGATE_FD = 51
MHD_LIB_INFO_FIXED_HAS_AGGREGATE_FD = 61
,
/**
* Get whether IPv6 is supported on the platform and whether IPv6 without IPv4
* Get whether IPv6 is supported on the platform and IPv6-only listen socket
* can be used.
* The result is placed in @a v_ipv6 member.
* @note The platform may have disabled IPv6 at run-time, it is not checked
* by this information type.
*/
MHD_LIB_INFO_FIXED_TYPE_IPv6 = 52
MHD_LIB_INFO_FIXED_TYPE_IPV6 = 62
,
/**
* Get whether TCP Fast Open is supported by MHD build.
* If supported then option #MHD_D_O_TCP_FASTOPEN can be used.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_TCP_FASTOPEN = 53
MHD_LIB_INFO_FIXED_HAS_TCP_FASTOPEN = 64
,
/**
* Get whether MHD support automatic detection of bind port number.
* @sa #MHD_D_O_BIND_PORT
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AUTODETECT_BIND_PORT = 54
MHD_LIB_INFO_FIXED_HAS_AUTODETECT_BIND_PORT = 65
,
/**
* Get whether MHD use system's sendfile() function to send
* file-FD based responses over non-TLS connections.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_SENDFILE = 55
MHD_LIB_INFO_FIXED_HAS_SENDFILE = 66
,
/**
* Get whether MHD supports automatic SIGPIPE suppression.
* Get whether MHD supports automatic SIGPIPE suppression within internal
* events loop (MHD's managed threads).
* If SIGPIPE suppression is not supported, application must handle
* SIGPIPE signal by itself.
* SIGPIPE signal by itself whem using MHD with internal events loop.
* If the platform does not have SIGPIPE the result is #MHD_YES.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AUTOSUPPRESS_SIGPIPE = 60
MHD_LIB_INFO_FIXED_HAS_AUTOSUPPRESS_SIGPIPE_INT = 80
,
/**
* Get whether MHD supports automatic SIGPIPE suppression when used with
* extenal events loop (in application thread).
* If SIGPIPE suppression is not supported, application must handle
* SIGPIPE signal by itself whem using MHD with external events loop.
* If the platform does not have SIGPIPE the result is #MHD_YES.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_AUTOSUPPRESS_SIGPIPE_EXT = 81
,
/**
* Get whether MHD sets names on generated threads.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_THREAD_NAMES = 61
MHD_LIB_INFO_FIXED_HAS_THREAD_NAMES = 82
,
/**
* Get the type of supported inter-thread communication.
* The result is placed in @a v_itc member.
*/
MHD_LIB_INFO_FIXED_TYPE_ITC = 62
MHD_LIB_INFO_FIXED_TYPE_ITC = 83
,
/**
* Get whether reading files beyond 2 GiB boundary is supported.
@@ -4119,7 +4144,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
* limited to 2 GiB.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_FIXED_HAS_LARGE_FILE = 63
MHD_LIB_INFO_FIXED_HAS_LARGE_FILE = 84
,
/* * Platform-dependent features, some set on startup and some are
@@ -4137,9 +4162,9 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoFixed
,
/**
* Get whether password encrypted private key for HTTPS daemon is
* supported. If supported then option
* #MHD_D_OPTION_TLS_KEY_CERT can be used with non-NULL @a mem_pass
* The result is placed in @a v_bool member.
* supported. If supported then option #MHD_D_OPTION_TLS_KEY_CERT
* can be used with non-NULL @a mem_pass.
* The result is placed in @a v_tls member.
*/
MHD_LIB_INFO_FIXED_HAS_TLS_KEY_PASSWORD = 102
,
@@ -4165,6 +4190,7 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_LibInfoFixedDigestAlgoType
,
/**
* The algorithm is implemented by MHD internal code.
* MHD implementation of hashing can never fail.
*/
MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_BUILT_IN = 1
,
@@ -4215,9 +4241,10 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_LibInfoFixedIPv6Type
MHD_LIB_INFO_FIXED_IPV6_TYPE_DUAL_ONLY = 1
,
/**
* IPv6 is supported as IPv6-only or as "dual stack".
* IPv6 can be used as IPv6-only (without getting IPv4 incoming connections).
* The platform may support "dual stack" too.
*/
MHD_LIB_INFO_FIXED_IPV6_TYPE_BOTH = 2
MHD_LIB_INFO_FIXED_IPV6_TYPE_IPV6_PURE = 2
};
/**
@@ -4226,22 +4253,28 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_LibInfoFixedIPv6Type
*/
enum MHD_FIXED_ENUM_MHD_SET_ MHD_LibInfoFixedITCType
{
/**
* No ITC used.
* This value is returned if MHD is built without threads support
*/
MHD_LIB_INFO_FIXED_ITC_TYPE_NONE = 0
,
/**
* The pair of sockets are used as inter-thread communication.
* The is the least efficient method of communication.
*/
MHD_LIB_INFO_FIXED_ITC_TYPE_SOCKETPAIR = 0
MHD_LIB_INFO_FIXED_ITC_TYPE_SOCKETPAIR = 1
,
/**
* The pipe is used as inter-thread communication.
*/
MHD_LIB_INFO_FIXED_ITC_TYPE_PIPE = 1
MHD_LIB_INFO_FIXED_ITC_TYPE_PIPE = 2
,
/**
* The EventFD is used as inter-thread communication.
* This is the most efficient method of communication.
*/
MHD_LIB_INFO_FIXED_ITC_TYPE_EVENTFD = 2
MHD_LIB_INFO_FIXED_ITC_TYPE_EVENTFD = 3
};
@@ -4284,11 +4317,14 @@ union MHD_LibInfoFixedData
*/
enum MHD_Bool v_bool;
/**
* The type of digest algorithm implemetation
* The type of digest algorithm implementation
*/
enum MHD_LibInfoFixedDigestAlgoType v_d_algo;
/**
* The types of the sockets polling functions/techniques supported
* The types of the sockets polling functions/techniques supported by this MHD
* build.
* Some functions can be disabled (like epoll) in kernel, this is not
* checked.
*/
struct MHD_LibInfoFixedPollingFunc v_polling;
/**
@@ -4351,21 +4387,34 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_LibInfoDynamic
/* * Basic MHD information * */
/**
* Get whether MHD was successfully initialised.
* The result is #MHD_NO when the library has not been yet initialised or
* when library has been de-initialised.
* Under normal conditions the result must be always #MHD_YES when requested
* by application.
* Get whether MHD has been successfully fully initialised.
* MHD uses lazy initialisation: a minimal initialisation is perfomed at
* startup, complete initialisation is perfomed when any daemon is created
* (or called other function which requires full initialisation).
* The result is #MHD_NO when the library has been not yet initialised
* completely since startup.
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_DYNAMIC_INITED = 0
MHD_LIB_INFO_DYNAMIC_INITED_FULLY_ONCE = 0
,
/**
* Get whether MHD has been successfully fully initialised.
* MHD uses lazy initialisation: a minimal initialisation is perfomed at
* startup, complete initialisation is perfomed when any daemon is created
* (or called other function which requires full initialisation).
* The result is #MHD_YES if library is initialised state now (meaning
* that at least one deamon is created and not destroyed or some function
* required full initialisation is running).
* The result is placed in @a v_bool member.
*/
MHD_LIB_INFO_DYNAMIC_INITED_FULLY_NOW = 1
,
/**
* Get whether HTTPS and which types of TLS backend(s) currently available.
* If any MHD daemonis active (created and not destroyed, not nessesary
* If any MHD daemons active (created and not destroyed, not necessary
* running) the result reflects the current backends availability.
* If no MHD daemon is active, then this function would try to temporarly
* If no MHD daemon is active, then this function would try to temporarily
* enable backends to check for their availability.
* The result is placed in @a v_tls member.
*/
+273 -17
View File
@@ -34,6 +34,15 @@
#include "mhd_str_types.h"
#include "mhd_str_macros.h"
#include "sys_sockets_headers.h"
#include "sys_ip_headers.h"
#ifdef MHD_SUPPORT_THREADS
# include "mhd_threads.h"
#endif
#include "mhd_itc.h"
#ifndef VERSION
# include "mhd_str.h"
#endif
@@ -49,8 +58,22 @@
# endif
#endif
#ifdef MHD_SUPPORT_MD5
# include "mhd_md5.h"
#endif
#ifdef MHD_SUPPORT_SHA256
# include "mhd_sha256.h"
#endif
#ifdef MHD_SUPPORT_SHA512_256
# include "mhd_sha512_256.h"
#endif
#include "mhd_lib_init.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include "mhd_public_api.h"
@@ -63,6 +86,9 @@ MHD_lib_get_info_fixed_sz (enum MHD_LibInfoFixed info_type,
{
switch (info_type)
{
/* * Basic MHD information * */
case MHD_LIB_INFO_FIXED_VERSION_NUM:
if (sizeof(return_data->v_uint32) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
@@ -110,15 +136,73 @@ MHD_lib_get_info_fixed_sz (enum MHD_LibInfoFixed info_type,
#endif /* ! VERSION */
}
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
case MHD_LIB_INFO_FIXED_HAS_MESSAGES:
/* * Basic MHD features, buid-time configurable * */
case MHD_LIB_INFO_FIXED_HAS_LOG_MESSAGES:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_SUPPORT_LOG_FUNCTIONALITY
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_AUTO_REPLIES_BODIES:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_ENABLE_AUTO_MESSAGES_BODIES
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_IS_NON_DEBUG:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef NDEBUG
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_THREADS:
case MHD_LIB_INFO_FIXED_HAS_DEBUG:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_SUPPORT_THREADS
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_COOKIE_PARSER:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_SUPPORT_COOKIES
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_POST_PARSER:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_SUPPORT_POST_PARSER
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_UPGRADE:
mhd_assert (0 && "Not implemented yet");
break;
case MHD_LIB_INFO_FIXED_HAS_BASIC_AUTH:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_SUPPORT_UPGRADE
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_AUTH_BASIC:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_SUPPORT_AUTH_BASIC
@@ -127,7 +211,9 @@ MHD_lib_get_info_fixed_sz (enum MHD_LibInfoFixed info_type,
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH:
case MHD_LIB_INFO_FIXED_HAS_AUTH_DIGEST:
case MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH_RFC2069:
case MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH_USERHASH:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_SUPPORT_AUTH_DIGEST
@@ -136,26 +222,189 @@ MHD_lib_get_info_fixed_sz (enum MHD_LibInfoFixed info_type,
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH_RFC2069:
case MHD_LIB_INFO_FIXED_TYPE_DIGEST_AUTH_MD5:
if (sizeof(return_data->v_d_algo) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#if ! defined(MHD_SUPPORT_MD5)
return_data->v_d_algo = MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_NOT_AVAILABLE;
#elif ! defined(MHD_MD5_EXTR)
return_data->v_d_algo = MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_BUILT_IN;
#elif ! defined(mhd_MD5_HAS_EXT_ERROR)
return_data->v_d_algo =
MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_EXTERNAL_NEVER_FAIL;
#else
return_data->v_d_algo =
MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_EXTERNAL_MAY_FAIL;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_TYPE_DIGEST_AUTH_SHA256:
if (sizeof(return_data->v_d_algo) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#if ! defined(MHD_SUPPORT_SHA256)
return_data->v_d_algo = MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_NOT_AVAILABLE;
#elif ! defined(MHD_SHA256_EXTR)
return_data->v_d_algo = MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_BUILT_IN;
#elif ! defined(mhd_SHA256_HAS_EXT_ERROR)
return_data->v_d_algo =
MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_EXTERNAL_NEVER_FAIL;
#else
return_data->v_d_algo =
MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_EXTERNAL_MAY_FAIL;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_TYPE_DIGEST_AUTH_SHA512_256:
if (sizeof(return_data->v_d_algo) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#if ! defined(MHD_SUPPORT_SHA512_256)
return_data->v_d_algo = MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_NOT_AVAILABLE;
#elif ! defined(MHD_SHA512_256_EXTR)
return_data->v_d_algo = MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_BUILT_IN;
#elif ! defined(mhd_SHA512_256_HAS_EXT_ERROR)
return_data->v_d_algo =
MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_EXTERNAL_NEVER_FAIL;
#else
return_data->v_d_algo =
MHD_LIB_INFO_FIXED_DIGEST_ALGO_TYPE_EXTERNAL_MAY_FAIL;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH_AUTH_INT:
case MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH_ALGO_SESSION:
case MHD_LIB_INFO_FIXED_HAS_DIGEST_AUTH_USERHASH:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
return_data->v_bool = MHD_NO;
return MHD_SC_OK;
/* * Platform-dependent features, some are configurable at build-time * */
case MHD_LIB_INFO_FIXED_TYPE_SOCKETS_POLLING:
if (sizeof(return_data->v_polling) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_SUPPORT_SELECT
return_data->v_polling.func_select = MHD_YES;
#else
return_data->v_polling.func_select = MHD_NO;
#endif
#ifdef MHD_SUPPORT_POLL
return_data->v_polling.func_poll = MHD_YES;
#else
return_data->v_polling.func_poll = MHD_NO;
#endif
#ifdef MHD_SUPPORT_EPOLL
return_data->v_polling.tech_epoll = MHD_YES;
#else
return_data->v_polling.tech_epoll = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_AGGREGATE_FD:
case MHD_LIB_INFO_FIXED_TYPE_IPv6:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_SUPPORT_EPOLL
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_TYPE_IPV6:
if (sizeof(return_data->v_ipv6) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#if ! defined(HAVE_INET6)
return_data->v_ipv6 = MHD_LIB_INFO_FIXED_IPV6_TYPE_NONE;
#elif ! defined(HAVE_DCLR_IPV6_V6ONLY)
return_data->v_ipv6 = MHD_LIB_INFO_FIXED_IPV6_TYPE_DUAL_ONLY;
#else
return_data->v_ipv6 = MHD_LIB_INFO_FIXED_IPV6_TYPE_IPV6_PURE;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_TCP_FASTOPEN:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef HAVE_DCLR_TCP_FASTOPEN
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_AUTODETECT_BIND_PORT:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef MHD_USE_GETSOCKNAME
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_SENDFILE:
case MHD_LIB_INFO_FIXED_HAS_AUTOSUPPRESS_SIGPIPE:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef mhd_USE_SENDFILE
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_AUTOSUPPRESS_SIGPIPE_INT:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#if ! defined (mhd_SEND_SPIPE_SUPPRESS_NEEDED)
return_data->v_bool = MHD_YES;
#elif defined (mhd_SEND_SPIPE_SUPPRESS_POSSIBLE) \
|| defined(mhd_HAVE_MHD_THREAD_BLOCK_SIGPIPE)
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_AUTOSUPPRESS_SIGPIPE_EXT:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#if ! defined (mhd_SEND_SPIPE_SUPPRESS_NEEDED)
return_data->v_bool = MHD_YES;
#elif defined (mhd_SEND_SPIPE_SUPPRESS_POSSIBLE)
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_THREAD_NAMES:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#ifdef mhd_USE_THREAD_NAME
return_data->v_bool = MHD_YES;
#else
return_data->v_bool = MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_TYPE_ITC:
if (sizeof(return_data->v_itc) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#if ! defined(MHD_SUPPORT_THREADS)
return_data->v_itc = MHD_LIB_INFO_FIXED_ITC_TYPE_NONE;
#elif defined(MHD_ITC_SOCKETPAIR_)
return_data->v_itc = MHD_LIB_INFO_FIXED_ITC_TYPE_SOCKETPAIR;
#elif defined(MHD_ITC_PIPE_)
return_data->v_itc = MHD_LIB_INFO_FIXED_ITC_TYPE_PIPE;
#elif defined(MHD_ITC_EVENTFD_)
return_data->v_itc = MHD_LIB_INFO_FIXED_ITC_TYPE_EVENTFD;
#else
#error The type of ITC is not defined
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_HAS_LARGE_FILE:
mhd_assert (0 && "Not implemented yet");
break;
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
#if ! defined(HAVE_PREAD) && defined(lseek64)
return_data->v_bool = MHD_YES;
#elif defined(HAVE_PREAD64)
return_data->v_bool = MHD_YES;
#elif defined(mhd_W32_NATIVE)
return_data->v_bool = MHD_YES;
#else
return_data->v_bool =
(0x7FFFFFFFFFFFFFFF == ((off_t) 0x7FFFFFFFFFFFFFFF)) ? MHD_YES : MHD_NO;
#endif
return MHD_SC_OK;
case MHD_LIB_INFO_FIXED_TYPE_TLS:
case MHD_LIB_INFO_FIXED_HAS_TLS_KEY_PASSWORD: /* Both backends have support */
if (sizeof(return_data->v_tls) <= return_data_size)
{
#ifndef MHD_ENABLE_HTTPS
@@ -178,8 +427,6 @@ MHD_lib_get_info_fixed_sz (enum MHD_LibInfoFixed info_type,
return MHD_SC_OK;
}
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
case MHD_LIB_INFO_FIXED_HAS_TLS_KEY_PASSWORD:
mhd_assert (0 && "Not implemented yet");
break;
case MHD_LIB_INFO_FIXED_SENTINEL:
default:
@@ -198,9 +445,18 @@ MHD_lib_get_info_dynamic_sz (enum MHD_LibInfoDynamic info_type,
{
switch (info_type)
{
case MHD_LIB_INFO_DYNAMIC_INITED:
mhd_assert (0 && "Not implemented yet");
break;
case MHD_LIB_INFO_DYNAMIC_INITED_FULLY_ONCE:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
return_data->v_bool =
mhd_lib_is_fully_initialised_once () ? MHD_YES : MHD_NO;
return MHD_SC_OK;
case MHD_LIB_INFO_DYNAMIC_INITED_FULLY_NOW:
if (sizeof(return_data->v_bool) > return_data_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
return_data->v_bool =
mhd_lib_is_fully_initialised_now () ? MHD_YES : MHD_NO;
return MHD_SC_OK;
case MHD_LIB_INFO_DYNAMIC_TYPE_TLS:
if (sizeof(return_data->v_tls) <= return_data_size)
{
+14
View File
@@ -447,3 +447,17 @@ mhd_lib_deinit_global_if_needed (void)
mhd_lib_global_full_deinit ();
mhd_mutex_unlock_chk (&mhd_init_mutex);
}
MHD_INTERNAL bool
mhd_lib_is_fully_initialised_once (void)
{
return mhd_lib_fully_inited_once;
}
MHD_INTERNAL bool
mhd_lib_is_fully_initialised_now (void)
{
return mhd_lib_fully_inited_once && (0 != mhd_lib_use_counter);
}
+13
View File
@@ -46,5 +46,18 @@ mhd_lib_init_global_if_needed (void);
MHD_INTERNAL void
mhd_lib_deinit_global_if_needed (void);
/**
* Check whether the library has been successfully completely initialised.
* @return
*/
MHD_INTERNAL bool
mhd_lib_is_fully_initialised_once (void);
/**
* Check whether the library is in fully initialised state now.
* @return
*/
MHD_INTERNAL bool
mhd_lib_is_fully_initialised_now (void);
#endif /* ! MHD_LIB_INIT_H */