enum MHD_DaemonInfoFixedType: sorted, assigned numeric values

This commit is contained in:
Evgeny Grin (Karlson2k)
2025-01-17 13:22:38 +01:00
parent d1481395ba
commit fb9fa457db
3 changed files with 47 additions and 45 deletions
+16 -15
View File
@@ -9165,6 +9165,19 @@ MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_OUT_ (2);
enum MHD_DaemonInfoFixedType
{
/**
* Request the port number of daemon's listen socket.
* Note: if port '0' (auto port) was specified for #MHD_D_OPTION_BIND_PORT(),
* returned value will be the real port number.
* The function returns #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the daemon
* does not have listening socket or if listening socket is non-IP.
* The function returns #MHD_SC_INFO_GET_TYPE_UNOBTAINABLE if the port number
* detection failed or not supported by the platform.
* If the function succeed, the returned port number is never zero.
* The result is placed in @a v_port member.
*/
MHD_DAEMON_INFO_FIXED_BIND_PORT = 1
,
/**
* Request the file descriptor for the listening socket.
* The provided socket must be used as 'read-only': only select() or similar
@@ -9174,7 +9187,7 @@ enum MHD_DaemonInfoFixedType
* does not have listening socket.
* The result is placed in @a v_socket member.
*/
MHD_DAEMON_INFO_FIXED_LISTEN_SOCKET = 1
MHD_DAEMON_INFO_FIXED_LISTEN_SOCKET = 2
,
/**
* Request the file descriptor for the single FD that triggered when
@@ -9189,21 +9202,9 @@ enum MHD_DaemonInfoFixedType
* is not configured to use this mode.
* The result is placed in @a v_fd member.
*/
MHD_DAEMON_INFO_FIXED_AGGREAGATE_FD
,
/**
* Request the port number of daemon's listen socket.
* Note: if port '0' (auto port) was specified for #MHD_D_OPTION_BIND_PORT(),
* returned value will be the real port number.
* The function returns #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the daemon
* does not have listening socket or if listening socket is non-IP.
* The function returns #MHD_SC_INFO_GET_TYPE_UNOBTAINABLE if the port number
* detection failed or not supported by the platform.
* If the function succeed, the returned port number is never zero.
* The result is placed in @a v_port member.
*/
MHD_DAEMON_INFO_FIXED_BIND_PORT
MHD_DAEMON_INFO_FIXED_AGGREAGATE_FD = 3
,
/* * Sentinel * */
/**
* The sentinel value.
+16 -15
View File
@@ -4543,6 +4543,19 @@ MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_OUT_ (2);
enum MHD_DaemonInfoFixedType
{
/**
* Request the port number of daemon's listen socket.
* Note: if port '0' (auto port) was specified for #MHD_D_OPTION_BIND_PORT(),
* returned value will be the real port number.
* The function returns #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the daemon
* does not have listening socket or if listening socket is non-IP.
* The function returns #MHD_SC_INFO_GET_TYPE_UNOBTAINABLE if the port number
* detection failed or not supported by the platform.
* If the function succeed, the returned port number is never zero.
* The result is placed in @a v_port member.
*/
MHD_DAEMON_INFO_FIXED_BIND_PORT = 1
,
/**
* Request the file descriptor for the listening socket.
* The provided socket must be used as 'read-only': only select() or similar
@@ -4552,7 +4565,7 @@ enum MHD_DaemonInfoFixedType
* does not have listening socket.
* The result is placed in @a v_socket member.
*/
MHD_DAEMON_INFO_FIXED_LISTEN_SOCKET = 1
MHD_DAEMON_INFO_FIXED_LISTEN_SOCKET = 2
,
/**
* Request the file descriptor for the single FD that triggered when
@@ -4567,21 +4580,9 @@ enum MHD_DaemonInfoFixedType
* is not configured to use this mode.
* The result is placed in @a v_fd member.
*/
MHD_DAEMON_INFO_FIXED_AGGREAGATE_FD
,
/**
* Request the port number of daemon's listen socket.
* Note: if port '0' (auto port) was specified for #MHD_D_OPTION_BIND_PORT(),
* returned value will be the real port number.
* The function returns #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the daemon
* does not have listening socket or if listening socket is non-IP.
* The function returns #MHD_SC_INFO_GET_TYPE_UNOBTAINABLE if the port number
* detection failed or not supported by the platform.
* If the function succeed, the returned port number is never zero.
* The result is placed in @a v_port member.
*/
MHD_DAEMON_INFO_FIXED_BIND_PORT
MHD_DAEMON_INFO_FIXED_AGGREAGATE_FD = 3
,
/* * Sentinel * */
/**
* The sentinel value.
+15 -15
View File
@@ -50,6 +50,21 @@ MHD_daemon_get_info_fixed_sz (struct MHD_Daemon *daemon,
switch (info_type)
{
case MHD_DAEMON_INFO_FIXED_BIND_PORT:
if (MHD_INVALID_SOCKET == daemon->net.listen.fd)
return MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE;
if (mhd_SOCKET_TYPE_UNKNOWN > daemon->net.listen.type)
return MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE;
if (0 == daemon->net.listen.port)
{
if (mhd_SOCKET_TYPE_IP != daemon->net.listen.type)
return MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE;
return MHD_SC_INFO_GET_TYPE_UNOBTAINABLE;
}
if (sizeof(output_buf->v_port) > output_buf_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
output_buf->v_port = daemon->net.listen.port;
return MHD_SC_OK;
case MHD_DAEMON_INFO_FIXED_LISTEN_SOCKET:
if (MHD_INVALID_SOCKET == daemon->net.listen.fd)
return MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE;
@@ -69,21 +84,6 @@ MHD_daemon_get_info_fixed_sz (struct MHD_Daemon *daemon,
return MHD_SC_INFO_GET_TYPE_NOT_SUPP_BY_BUILD;
#endif
break;
case MHD_DAEMON_INFO_FIXED_BIND_PORT:
if (MHD_INVALID_SOCKET == daemon->net.listen.fd)
return MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE;
if (mhd_SOCKET_TYPE_UNKNOWN > daemon->net.listen.type)
return MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE;
if (0 == daemon->net.listen.port)
{
if (mhd_SOCKET_TYPE_IP != daemon->net.listen.type)
return MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE;
return MHD_SC_INFO_GET_TYPE_UNOBTAINABLE;
}
if (sizeof(output_buf->v_port) > output_buf_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
output_buf->v_port = daemon->net.listen.port;
return MHD_SC_OK;
case MHD_DAEMON_INFO_FIXED_SENTINEL:
default:
break;