GNU libmicrohttpd 0.9.71
platform.h
Go to the documentation of this file.
1/*
2 This file is part of libmicrohttpd
3 Copyright (C) 2008 Christian Grothoff (and other contributing authors)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
34#ifndef MHD_PLATFORM_H
35#define MHD_PLATFORM_H
36
37#include "mhd_options.h"
38
39#include <stdio.h>
40#include <stdlib.h>
41#include <stdint.h>
42#include <string.h>
43#ifdef HAVE_UNISTD_H
44#include <unistd.h>
45#endif
46#include <stdarg.h>
47#include <errno.h>
48#include <fcntl.h>
49#include <signal.h>
50#include <stddef.h>
51
52/* different OSes have fd_set in
53 a broad range of header files;
54 we just include most of them (if they
55 are available) */
56
57
58#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS)
59#include <stdarg.h>
60#include <sys/mman.h>
61#ifdef HAVE_SOCKLIB_H
62#include <sockLib.h>
63#endif /* HAVE_SOCKLIB_H */
64#ifdef HAVE_INETLIB_H
65#include <inetLib.h>
66#endif /* HAVE_INETLIB_H */
67#endif /* __VXWORKS__ */
68
69#if HAVE_MEMORY_H
70#include <memory.h>
71#endif
72
73#if HAVE_SYS_SELECT_H
74#include <sys/select.h>
75#endif
76#if HAVE_SYS_TYPES_H
77#include <sys/types.h>
78#endif
79#if HAVE_SYS_TIME_H
80#include <sys/time.h>
81#endif
82#if HAVE_SYS_STAT_H
83#include <sys/stat.h>
84#endif
85#if HAVE_SYS_MSG_H
86#include <sys/msg.h>
87#endif
88#if HAVE_SYS_MMAN_H
89#include <sys/mman.h>
90#endif
91#if HAVE_TIME_H
92#include <time.h>
93#endif
94#if HAVE_SYS_SOCKET_H
95#include <sys/socket.h>
96#endif
97#if defined(_WIN32) && ! defined(__CYGWIN__)
98#ifndef WIN32_LEAN_AND_MEAN
99/* Do not include unneeded parts of W32 headers. */
100#define WIN32_LEAN_AND_MEAN 1
101#endif /* !WIN32_LEAN_AND_MEAN */
102#include <winsock2.h>
103#include <ws2tcpip.h>
104#endif /* _WIN32 && !__CYGWIN__ */
105
106#if defined(__CYGWIN__) && ! defined(_SYS_TYPES_FD_SET)
107/* Do not define __USE_W32_SOCKETS under Cygwin! */
108#error Cygwin with winsock fd_set is not supported
109#endif
110
111#if defined(_WIN32) && ! defined(__CYGWIN__)
112#define sleep(seconds) ((SleepEx ((seconds) * 1000, 1)==0) ? 0 : (seconds))
113#define usleep(useconds) ((SleepEx ((useconds) / 1000, 1)==0) ? 0 : -1)
114#endif
115
116#if defined(_MSC_FULL_VER) && ! defined (_SSIZE_T_DEFINED)
117#define _SSIZE_T_DEFINED
118typedef intptr_t ssize_t;
119#endif /* !_SSIZE_T_DEFINED */
120
121#if ! defined(_WIN32) || defined(__CYGWIN__)
123#else /* _WIN32 && ! __CYGWIN__ */
124typedef long _MHD_TIMEVAL_TV_SEC_TYPE;
125#endif /* _WIN32 && ! __CYGWIN__ */
126
127#if ! defined(IPPROTO_IPV6) && defined(_MSC_FULL_VER) && _WIN32_WINNT >= 0x0501
128/* VC use IPPROTO_IPV6 as part of enum */
129#define IPPROTO_IPV6 IPPROTO_IPV6
130#endif
131
132#endif
additional automatic macros for MHD_config.h
time_t _MHD_TIMEVAL_TV_SEC_TYPE
Definition: platform.h:122