aboutsummaryrefslogtreecommitdiff
path: root/src/include/microhttpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/microhttpd.h')
-rw-r--r--src/include/microhttpd.h37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 1f8f6d9f..14fe3b31 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -105,12 +105,12 @@ extern "C"
105 "standard" includes won't be used (which might be a good 105 "standard" includes won't be used (which might be a good
106 idea, especially on platforms where they do not exist). */ 106 idea, especially on platforms where they do not exist). */
107#ifndef MHD_PLATFORM_H 107#ifndef MHD_PLATFORM_H
108#include <unistd.h>
109#include <stdarg.h> 108#include <stdarg.h>
110#include <stdint.h> 109#include <stdint.h>
111#ifdef __MINGW32__ 110#if defined(_WIN32) && !defined(__CYGWIN__)
112#include <ws2tcpip.h> 111#include <ws2tcpip.h>
113#else 112#else
113#include <unistd.h>
114#include <sys/time.h> 114#include <sys/time.h>
115#include <sys/types.h> 115#include <sys/types.h>
116#include <sys/socket.h> 116#include <sys/socket.h>
@@ -160,6 +160,23 @@ extern "C"
160#define _MHD_EXTERN extern 160#define _MHD_EXTERN extern
161#endif 161#endif
162 162
163#ifndef MHD_SOCKET_DEFINED
164/**
165 * MHD_socket is type for socket FDs
166 */
167#if !defined(_WIN32) || defined(_SYS_TYPES_FD_SET)
168#define MHD_POSIX_SOCKETS 1
169typedef int MHD_socket;
170#define MHD_INVALID_SOCKET (-1)
171#else /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
172#define MHD_WINSOCK_SOCKETS 1
173#include <winsock2.h>
174typedef SOCKET MHD_socket;
175#define MHD_INVALID_SOCKET (INVALID_SOCKET)
176#endif /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */
177#define MHD_SOCKET_DEFINED 1
178#endif /* MHD_SOCKET_DEFINED */
179
163/** 180/**
164 * Not all architectures and `printf()`'s support the `long long` type. 181 * Not all architectures and `printf()`'s support the `long long` type.
165 * This gives the ability to replace `long long` with just a `long`, 182 * This gives the ability to replace `long long` with just a `long`,
@@ -948,7 +965,7 @@ union MHD_ConnectionInfo
948 /** 965 /**
949 * Connect socket 966 * Connect socket
950 */ 967 */
951 int connect_fd; 968 MHD_socket connect_fd;
952 969
953 /** 970 /**
954 * GNUtls session handle, of type "gnutls_session_t". 971 * GNUtls session handle, of type "gnutls_session_t".
@@ -1335,14 +1352,14 @@ MHD_start_daemon (unsigned int flags,
1335 * Note that some thread modes require the caller to have passed 1352 * Note that some thread modes require the caller to have passed
1336 * #MHD_USE_PIPE_FOR_SHUTDOWN when using this API. If this daemon is 1353 * #MHD_USE_PIPE_FOR_SHUTDOWN when using this API. If this daemon is
1337 * in one of those modes and this option was not given to 1354 * in one of those modes and this option was not given to
1338 * #MHD_start_daemon, this function will return -1. 1355 * #MHD_start_daemon, this function will return #MHD_INVALID_SOCKET.
1339 * 1356 *
1340 * @param daemon daemon to stop accepting new connections for 1357 * @param daemon daemon to stop accepting new connections for
1341 * @return old listen socket on success, -1 if the daemon was 1358 * @return old listen socket on success, #MHD_INVALID_SOCKET if
1342 * already not listening anymore 1359 * the daemon was already not listening anymore
1343 * @ingroup specialized 1360 * @ingroup specialized
1344 */ 1361 */
1345_MHD_EXTERN int 1362_MHD_EXTERN MHD_socket
1346MHD_quiesce_daemon (struct MHD_Daemon *daemon); 1363MHD_quiesce_daemon (struct MHD_Daemon *daemon);
1347 1364
1348 1365
@@ -1387,7 +1404,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon);
1387 */ 1404 */
1388_MHD_EXTERN int 1405_MHD_EXTERN int
1389MHD_add_connection (struct MHD_Daemon *daemon, 1406MHD_add_connection (struct MHD_Daemon *daemon,
1390 int client_socket, 1407 MHD_socket client_socket,
1391 const struct sockaddr *addr, 1408 const struct sockaddr *addr,
1392 socklen_t addrlen); 1409 socklen_t addrlen);
1393 1410
@@ -1414,7 +1431,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
1414 fd_set *read_fd_set, 1431 fd_set *read_fd_set,
1415 fd_set *write_fd_set, 1432 fd_set *write_fd_set,
1416 fd_set *except_fd_set, 1433 fd_set *except_fd_set,
1417 int *max_fd); 1434 MHD_socket *max_fd);
1418 1435
1419 1436
1420/** 1437/**
@@ -2224,7 +2241,7 @@ union MHD_DaemonInfo
2224 /** 2241 /**
2225 * Listen socket file descriptor 2242 * Listen socket file descriptor
2226 */ 2243 */
2227 int listen_fd; 2244 MHD_socket listen_fd;
2228}; 2245};
2229 2246
2230 2247