|
Packit |
875988 |
/*
|
|
Packit |
875988 |
This file is part of libmicrohttpd
|
|
Packit |
875988 |
Copyright (C) 2008 Christian Grothoff (and other contributing authors)
|
|
Packit |
875988 |
|
|
Packit |
875988 |
This library is free software; you can redistribute it and/or
|
|
Packit |
875988 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
875988 |
License as published by the Free Software Foundation; either
|
|
Packit |
875988 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
875988 |
|
|
Packit |
875988 |
This library is distributed in the hope that it will be useful,
|
|
Packit |
875988 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
875988 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
875988 |
Lesser General Public License for more details.
|
|
Packit |
875988 |
|
|
Packit |
875988 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
875988 |
License along with this library; if not, write to the Free Software
|
|
Packit |
875988 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
875988 |
*/
|
|
Packit |
875988 |
|
|
Packit |
875988 |
/**
|
|
Packit |
875988 |
* @file platform.h
|
|
Packit |
875988 |
* @brief platform-specific includes for libmicrohttpd
|
|
Packit |
875988 |
* @author Christian Grothoff
|
|
Packit |
875988 |
*
|
|
Packit |
875988 |
* This file is included by the libmicrohttpd code
|
|
Packit |
875988 |
* before "microhttpd.h"; it provides the required
|
|
Packit |
875988 |
* standard headers (which are platform-specific).
|
|
Packit |
875988 |
*
|
|
Packit |
875988 |
* Note that this file depends on our configure.ac
|
|
Packit |
875988 |
* build process and the generated config.h file.
|
|
Packit |
875988 |
* Hence you cannot include it directly in applications
|
|
Packit |
875988 |
* that use libmicrohttpd.
|
|
Packit |
875988 |
*/
|
|
Packit |
875988 |
#ifndef MHD_PLATFORM_H
|
|
Packit |
875988 |
#define MHD_PLATFORM_H
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#include "mhd_options.h"
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#include <stdio.h>
|
|
Packit |
875988 |
#include <stdlib.h>
|
|
Packit |
875988 |
#include <stdint.h>
|
|
Packit |
875988 |
#include <string.h>
|
|
Packit |
875988 |
#ifdef HAVE_UNISTD_H
|
|
Packit |
875988 |
#include <unistd.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#include <stdarg.h>
|
|
Packit |
875988 |
#include <errno.h>
|
|
Packit |
875988 |
#include <fcntl.h>
|
|
Packit |
875988 |
#include <signal.h>
|
|
Packit |
875988 |
#include <stddef.h>
|
|
Packit |
875988 |
|
|
Packit |
875988 |
/* different OSes have fd_set in
|
|
Packit |
875988 |
a broad range of header files;
|
|
Packit |
875988 |
we just include most of them (if they
|
|
Packit |
875988 |
are available) */
|
|
Packit |
875988 |
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS)
|
|
Packit |
875988 |
#include <stdarg.h>
|
|
Packit |
875988 |
#include <sys/mman.h>
|
|
Packit |
875988 |
#ifdef HAVE_SOCKLIB_H
|
|
Packit |
875988 |
#include <sockLib.h>
|
|
Packit |
875988 |
#endif /* HAVE_SOCKLIB_H */
|
|
Packit |
875988 |
#ifdef HAVE_INETLIB_H
|
|
Packit |
875988 |
#include <inetLib.h>
|
|
Packit |
875988 |
#endif /* HAVE_INETLIB_H */
|
|
Packit |
875988 |
#endif /* __VXWORKS__ */
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#if HAVE_MEMORY_H
|
|
Packit |
875988 |
#include <memory.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#if HAVE_SYS_SELECT_H
|
|
Packit |
875988 |
#include <sys/select.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_SYS_TYPES_H
|
|
Packit |
875988 |
#include <sys/types.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_SYS_TIME_H
|
|
Packit |
875988 |
#include <sys/time.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_SYS_STAT_H
|
|
Packit |
875988 |
#include <sys/stat.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_SYS_MSG_H
|
|
Packit |
875988 |
#include <sys/msg.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_SYS_MMAN_H
|
|
Packit |
875988 |
#include <sys/mman.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_TIME_H
|
|
Packit |
875988 |
#include <time.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if HAVE_SYS_SOCKET_H
|
|
Packit |
875988 |
#include <sys/socket.h>
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
Packit |
875988 |
#ifndef WIN32_LEAN_AND_MEAN
|
|
Packit |
875988 |
/* Do not include unneeded parts of W32 headers. */
|
|
Packit |
875988 |
#define WIN32_LEAN_AND_MEAN 1
|
|
Packit |
875988 |
#endif /* !WIN32_LEAN_AND_MEAN */
|
|
Packit |
875988 |
#include <winsock2.h>
|
|
Packit |
875988 |
#include <ws2tcpip.h>
|
|
Packit |
875988 |
#endif /* _WIN32 && !__CYGWIN__ */
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#if defined(__CYGWIN__) && !defined(_SYS_TYPES_FD_SET)
|
|
Packit |
875988 |
/* Do not define __USE_W32_SOCKETS under Cygwin! */
|
|
Packit |
875988 |
#error Cygwin with winsock fd_set is not supported
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
Packit |
875988 |
#define sleep(seconds) ((SleepEx((seconds)*1000, 1)==0)?0:(seconds))
|
|
Packit |
875988 |
#define usleep(useconds) ((SleepEx((useconds)/1000, 1)==0)?0:-1)
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED)
|
|
Packit |
875988 |
#define _SSIZE_T_DEFINED
|
|
Packit |
875988 |
typedef intptr_t ssize_t;
|
|
Packit |
875988 |
#endif /* !_SSIZE_T_DEFINED */
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#if !defined(_WIN32) || defined(__CYGWIN__)
|
|
Packit |
875988 |
typedef time_t _MHD_TIMEVAL_TV_SEC_TYPE;
|
|
Packit |
875988 |
#else /* _WIN32 && ! __CYGWIN__ */
|
|
Packit |
875988 |
typedef long _MHD_TIMEVAL_TV_SEC_TYPE;
|
|
Packit |
875988 |
#endif /* _WIN32 && ! __CYGWIN__ */
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#if !defined(IPPROTO_IPV6) && defined(_MSC_FULL_VER) && _WIN32_WINNT >= 0x0501
|
|
Packit |
875988 |
/* VC use IPPROTO_IPV6 as part of enum */
|
|
Packit |
875988 |
#define IPPROTO_IPV6 IPPROTO_IPV6
|
|
Packit |
875988 |
#endif
|
|
Packit |
875988 |
|
|
Packit |
875988 |
#endif
|