gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 171/335: mhd_socket_type.h: new internal header, renamed


From: gnunet
Subject: [libmicrohttpd] 171/335: mhd_socket_type.h: new internal header, renamed MHD_socket -> MHD_Socket
Date: Sat, 27 Jul 2024 22:01:07 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to tag stf-m2
in repository libmicrohttpd.

commit 6144ce9ba415f7079f1afc9b8ddf57b6b2e1e7b2
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu May 16 14:54:47 2024 +0200

    mhd_socket_type.h: new internal header, renamed MHD_socket -> MHD_Socket
---
 src/include/mhd_future.h                           |  2 +-
 src/include/microhttpd2.h                          | 16 +++---
 src/include/microhttpd2_generated_daemon_options.h | 10 ++--
 src/include/microhttpd2_portability.h              | 12 ++---
 src/mhd2/daemon_options.h                          |  6 ++-
 src/mhd2/mhd_socket_type.h                         | 61 ++++++++++++++++++++++
 6 files changed, 85 insertions(+), 22 deletions(-)

diff --git a/src/include/mhd_future.h b/src/include/mhd_future.h
index b0e761a6..e2d2221c 100644
--- a/src/include/mhd_future.h
+++ b/src/include/mhd_future.h
@@ -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
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
index 955c6220..e1ba16d8 100644
--- a/src/include/microhttpd2.h
+++ b/src/include/microhttpd2.h
@@ -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
diff --git a/src/include/microhttpd2_generated_daemon_options.h 
b/src/include/microhttpd2_generated_daemon_options.h
index fff6b18c..7388aa14 100644
--- a/src/include/microhttpd2_generated_daemon_options.h
+++ b/src/include/microhttpd2_generated_daemon_options.h
@@ -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;
diff --git a/src/include/microhttpd2_portability.h 
b/src/include/microhttpd2_portability.h
index 0fc0c1fa..5d53103c 100644
--- a/src/include/microhttpd2_portability.h
+++ b/src/include/microhttpd2_portability.h
@@ -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 */
diff --git a/src/mhd2/daemon_options.h b/src/mhd2/daemon_options.h
index 29f44c17..96a1fafd 100644
--- a/src/mhd2/daemon_options.h
+++ b/src/mhd2/daemon_options.h
@@ -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;
 
 
   /**
diff --git a/src/mhd2/mhd_socket_type.h b/src/mhd2/mhd_socket_type.h
new file mode 100644
index 00000000..5acea931
--- /dev/null
+++ b/src/mhd2/mhd_socket_type.h
@@ -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 */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]