diff options
Diffstat (limited to 'src/include/platform.h')
-rw-r--r-- | src/include/platform.h | 70 |
1 files changed, 19 insertions, 51 deletions
diff --git a/src/include/platform.h b/src/include/platform.h index 5ec2c16f..e9c2fa12 100644 --- a/src/include/platform.h +++ b/src/include/platform.h | |||
@@ -55,13 +55,17 @@ | |||
55 | are available) */ | 55 | are available) */ |
56 | 56 | ||
57 | 57 | ||
58 | #ifdef OS_VXWORKS | 58 | #if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) |
59 | #include <sockLib.h> | ||
60 | #include <netinet/in.h> | ||
61 | #include <stdarg.h> | 59 | #include <stdarg.h> |
62 | #include <sys/mman.h> | 60 | #include <sys/mman.h> |
63 | #define RESTRICT __restrict__ | 61 | #ifdef HAVE_SOCKLIB_H |
64 | #endif | 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 | |||
65 | #if HAVE_MEMORY_H | 69 | #if HAVE_MEMORY_H |
66 | #include <memory.h> | 70 | #include <memory.h> |
67 | #endif | 71 | #endif |
@@ -84,21 +88,20 @@ | |||
84 | #if HAVE_SYS_MMAN_H | 88 | #if HAVE_SYS_MMAN_H |
85 | #include <sys/mman.h> | 89 | #include <sys/mman.h> |
86 | #endif | 90 | #endif |
87 | #if HAVE_NETDB_H | ||
88 | #include <netdb.h> | ||
89 | #endif | ||
90 | #if HAVE_NETINET_IN_H | ||
91 | #include <netinet/in.h> | ||
92 | #endif | ||
93 | #if HAVE_TIME_H | 91 | #if HAVE_TIME_H |
94 | #include <time.h> | 92 | #include <time.h> |
95 | #endif | 93 | #endif |
96 | #if HAVE_SYS_SOCKET_H | 94 | #if HAVE_SYS_SOCKET_H |
97 | #include <sys/socket.h> | 95 | #include <sys/socket.h> |
98 | #endif | 96 | #endif |
99 | #if HAVE_ARPA_INET_H | 97 | #if defined(_WIN32) && !defined(__CYGWIN__) |
100 | #include <arpa/inet.h> | 98 | #ifndef WIN32_LEAN_AND_MEAN |
101 | #endif | 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__ */ | ||
102 | 105 | ||
103 | #if defined(__CYGWIN__) && !defined(_SYS_TYPES_FD_SET) | 106 | #if defined(__CYGWIN__) && !defined(_SYS_TYPES_FD_SET) |
104 | /* Do not define __USE_W32_SOCKETS under Cygwin! */ | 107 | /* Do not define __USE_W32_SOCKETS under Cygwin! */ |
@@ -106,58 +109,23 @@ | |||
106 | #endif | 109 | #endif |
107 | 110 | ||
108 | #if defined(_WIN32) && !defined(__CYGWIN__) | 111 | #if defined(_WIN32) && !defined(__CYGWIN__) |
109 | #include <ws2tcpip.h> | ||
110 | #define sleep(seconds) ((SleepEx((seconds)*1000, 1)==0)?0:(seconds)) | 112 | #define sleep(seconds) ((SleepEx((seconds)*1000, 1)==0)?0:(seconds)) |
111 | #define usleep(useconds) ((SleepEx((useconds)/1000, 1)==0)?0:-1) | 113 | #define usleep(useconds) ((SleepEx((useconds)/1000, 1)==0)?0:-1) |
112 | #endif | 114 | #endif |
113 | 115 | ||
114 | #if !defined(SHUT_WR) && defined(SD_SEND) | ||
115 | #define SHUT_WR SD_SEND | ||
116 | #endif | ||
117 | #if !defined(SHUT_RD) && defined(SD_RECEIVE) | ||
118 | #define SHUT_RD SD_RECEIVE | ||
119 | #endif | ||
120 | #if !defined(SHUT_RDWR) && defined(SD_BOTH) | ||
121 | #define SHUT_RDWR SD_BOTH | ||
122 | #endif | ||
123 | |||
124 | #if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED) | 116 | #if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED) |
125 | #define _SSIZE_T_DEFINED | 117 | #define _SSIZE_T_DEFINED |
126 | typedef intptr_t ssize_t; | 118 | typedef intptr_t ssize_t; |
127 | #endif /* !_SSIZE_T_DEFINED */ | 119 | #endif /* !_SSIZE_T_DEFINED */ |
128 | 120 | ||
129 | #ifndef MHD_SOCKET_DEFINED | ||
130 | /** | ||
131 | * MHD_socket is type for socket FDs | ||
132 | */ | ||
133 | #if !defined(_WIN32) || defined(__CYGWIN__) | ||
134 | #define MHD_POSIX_SOCKETS 1 | ||
135 | typedef int MHD_socket; | ||
136 | #define MHD_INVALID_SOCKET (-1) | ||
137 | #else /* defined(_WIN32) && !defined(__CYGWIN__) */ | ||
138 | #define MHD_WINSOCK_SOCKETS 1 | ||
139 | #include <winsock2.h> | ||
140 | typedef SOCKET MHD_socket; | ||
141 | #define MHD_INVALID_SOCKET (INVALID_SOCKET) | ||
142 | #endif /* defined(_WIN32) && !defined(__CYGWIN__) */ | ||
143 | #define MHD_SOCKET_DEFINED 1 | ||
144 | #endif /* MHD_SOCKET_DEFINED */ | ||
145 | |||
146 | /** | ||
147 | * _MHD_SOCKOPT_BOOL_TYPE is type for bool parameters for setsockopt()/getsockopt() | ||
148 | */ | ||
149 | #ifdef MHD_POSIX_SOCKETS | ||
150 | typedef int _MHD_SOCKOPT_BOOL_TYPE; | ||
151 | #else /* MHD_WINSOCK_SOCKETS */ | ||
152 | typedef BOOL _MHD_SOCKOPT_BOOL_TYPE; | ||
153 | #endif /* MHD_WINSOCK_SOCKETS */ | ||
154 | |||
155 | #ifndef _WIN32 | 121 | #ifndef _WIN32 |
156 | typedef time_t _MHD_TIMEVAL_TV_SEC_TYPE; | 122 | typedef time_t _MHD_TIMEVAL_TV_SEC_TYPE; |
157 | #else /* _WIN32 */ | 123 | #else /* _WIN32 */ |
158 | typedef long _MHD_TIMEVAL_TV_SEC_TYPE; | 124 | typedef long _MHD_TIMEVAL_TV_SEC_TYPE; |
159 | #endif /* _WIN32 */ | 125 | #endif /* _WIN32 */ |
160 | 126 | ||
127 | /* TODO: remove include when pipes implementation is moved to other file */ | ||
128 | #include "../microhttpd/mhd_sockets.h" | ||
161 | /* Force don't use pipes on W32 */ | 129 | /* Force don't use pipes on W32 */ |
162 | #if defined(_WIN32) && !defined(MHD_DONT_USE_PIPES) | 130 | #if defined(_WIN32) && !defined(MHD_DONT_USE_PIPES) |
163 | #define MHD_DONT_USE_PIPES 1 | 131 | #define MHD_DONT_USE_PIPES 1 |