mhd_socket_type.h: new internal header, renamed MHD_socket -> MHD_Socket

This commit is contained in:
Evgeny Grin (Karlson2k)
2024-05-16 15:52:04 +02:00
parent d0c8dc6996
commit 6144ce9ba4
6 changed files with 85 additions and 22 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ struct MHD_WatchedFD
* The watched socket.
* Ignored if set by application to #MHD_INVALID_SOCKET. TODO: Improve wording
*/
MHD_socket fd;
MHD_Socket fd;
/**
* Indicates that socket should be watched for specific network state
+8 -8
View File
@@ -1771,7 +1771,7 @@ MHD_FN_PAR_NONNULL_ (1) MHD_FN_MUST_CHECK_RESULT_;
* was never started, or has no listen socket.
* @ingroup daemon
*/
MHD_EXTERN_ MHD_socket
MHD_EXTERN_ MHD_Socket
MHD_daemon_quiesce (struct MHD_Daemon *daemon)
MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_INOUT_ (1);
@@ -1978,7 +1978,7 @@ typedef MHD_APP_SOCKET_CNTX_TYPE *
(MHD_FN_PAR_NONNULL_ (5)
*MHD_SocketRegistrationUpdateCallback)(
void *cls,
MHD_socket fd,
MHD_Socket fd,
enum MHD_FdState watch_for,
MHD_APP_SOCKET_CNTX_TYPE *app_cntx_old,
struct MHD_EventUpdateContext *ecb_cntx);
@@ -3188,7 +3188,7 @@ If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(),
*/
struct MHD_DaemonOptionAndValue
MHD_D_OPTION_LISTEN_SOCKET (
MHD_socket listen_fd
MHD_Socket listen_fd
);
/**
@@ -3458,7 +3458,7 @@ MHD_D_OPTION_STACK_SIZE (
*/
struct MHD_DaemonOptionAndValue
MHD_D_OPTION_FD_NUMBER_LIMIT (
MHD_socket max_fd
MHD_Socket max_fd
);
/**
@@ -3989,7 +3989,7 @@ MHD_FN_PAR_NONNULL_ (1);
*/
MHD_EXTERN_ enum MHD_StatusCode
MHD_daemon_add_connection (struct MHD_Daemon *daemon,
MHD_socket client_socket,
MHD_Socket client_socket,
size_t addrlen,
const struct sockaddr *addr,
void *connection_cntx)
@@ -5620,7 +5620,7 @@ typedef void
struct MHD_Request *request,
size_t extra_in_size,
const char *extra_in,
MHD_socket sock,
MHD_Socket sock,
struct MHD_UpgradeHandle *urh);
@@ -7267,7 +7267,7 @@ union MHD_DaemonInfoFixedData
/**
* The socket type of data.
*/
MHD_socket v_socket;
MHD_Socket v_socket;
/**
* File descriptor, except sockets
@@ -7487,7 +7487,7 @@ union MHD_ConnectionInfoFixedData
/**
* Socket type
*/
MHD_socket v_fd;
MHD_Socket v_fd;
/**
* Daemon handler type
@@ -1,3 +1,5 @@
/* EDITED MANUALLY */
/**
* The options (parameters) for MHD daemon
*/
@@ -615,7 +617,7 @@ union MHD_DaemonOptionValue
* Value for #MHD_D_O_LISTEN_SOCKET.
* the listen socket to use, ignored if set to #MHD_INVALID_SOCKET
*/
MHD_socket listen_socket;
MHD_Socket listen_socket;
/**
* Value for #MHD_D_O_LISTEN_ADDR_REUSE.
@@ -740,7 +742,7 @@ union MHD_DaemonOptionValue
* Value for #MHD_D_O_FD_NUMBER_LIMIT.
* FIXME
*/
MHD_socket fd_number_limit;
MHD_Socket fd_number_limit;
/**
* Value for #MHD_D_O_TURBO.
@@ -1596,7 +1598,7 @@ If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(),
*/
static MHD_INLINE struct MHD_daemonOptionAndValue
MHD_D_OPTION_LISTEN_SOCKET (
MHD_socket listen_fd
MHD_Socket listen_fd
)
{
struct MHD_DaemonOptionAndValue opt_val;
@@ -2071,7 +2073,7 @@ MHD_D_OPTION_STACK_SIZE (
*/
static MHD_INLINE struct MHD_daemonOptionAndValue
MHD_D_OPTION_FD_NUMBER_LIMIT (
MHD_socket max_fd
MHD_Socket max_fd
)
{
struct MHD_DaemonOptionAndValue opt_val;
+5 -7
View File
@@ -59,22 +59,20 @@ MHD_C_DECLRATIONS_START_HERE_
# endif
#endif
#ifndef MHD_SOCKET_DEFINED
#ifndef MHD_INVALID_SOCKET
/**
* MHD_socket is type for socket FDs
* MHD_Socket is type for socket FDs
*/
# if ! defined(_WIN32) || defined(_SYS_TYPES_FD_SET)
# define MHD_POSIX_SOCKETS 1
typedef int MHD_socket;
typedef int MHD_Socket;
# define MHD_INVALID_SOCKET (-1)
# else /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
# define MHD_WINSOCK_SOCKETS 1
# include <winsock2.h>
typedef SOCKET MHD_socket;
typedef SOCKET MHD_Socket;
# define MHD_INVALID_SOCKET (INVALID_SOCKET)
# endif /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
# define MHD_SOCKET_DEFINED 1
#endif /* MHD_SOCKET_DEFINED */
#endif /* MHD_INVALID_SOCKET */
/* Compiler macros for internal needs */
+4 -2
View File
@@ -6,6 +6,8 @@
/* @author daemon-options-generator.c
*/
/* EDITED MANUALLY */
#include "microhttpd2.h"
#include "internal.h"
@@ -51,7 +53,7 @@ struct DaemonOptions {
* Value for #MHD_D_O_LISTEN_SOCKET.
* the listen socket to use, ignored if set to #MHD_INVALID_SOCKET
*/
MHD_socket listen_socket;
MHD_Socket listen_socket;
/**
@@ -198,7 +200,7 @@ struct DaemonOptions {
* Value for #MHD_D_O_FD_NUMBER_LIMIT.
* FIXME
*/
MHD_socket fd_number_limit;
MHD_Socket fd_number_limit;
/**
+61
View File
@@ -0,0 +1,61 @@
/*
This file is part of GNU libmicrohttpd
Copyright (C) 2024 Evgeny Grin (Karlson2k)
GNU libmicrohttpd is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
GNU libmicrohttpd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file src/mhd2/mhd_sockets_types.h
* @brief The header for MHD_Socket types and relevant macros
* @author Karlson2k (Evgeny Grin)
*
* This header provides 'MHD_Socket' type and 'MHD_INVALID_SOCKET' value.
*/
#ifndef MHD_SOCKET_TYPE_H
#define MHD_SOCKET_TYPE_H 1
#include "mhd_sys_options.h"
#ifndef MHD_INVALID_SOCKET
# if ! defined(_WIN32) || defined(_SYS_TYPES_FD_SET)
# define MHD_POSIX_SOCKETS 1 /* The POSIX-style sockets are used */
/**
* MHD_Socket is type for socket FDs
*
* This type is always 'int' on POSIX platforms.
*/
typedef int MHD_Socket;
/**
* Invalid value for MHD_Socket
*/
# define MHD_INVALID_SOCKET (-1)
# else /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
# define MHD_WINSOCK_SOCKETS 1 /* The WinSock-style sockets are used */
# include <winsock2.h>
/**
* MHD_Socket is type for socket FDs
*/
typedef SOCKET MHD_Socket;
/**
* Invalid value for MHD_Socket
*/
# define MHD_INVALID_SOCKET (INVALID_SOCKET)
# endif /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
#endif /* MHD_INVALID_SOCKET */
#endif /* ! MHD_SOCKET_TYPE_H */