2009-07-29 12:07:54 +02:00
|
|
|
/*
|
2016-01-28 15:07:31 +01:00
|
|
|
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
2009-07-29 12:07:54 +02:00
|
|
|
|
2015-06-02 22:33:55 +02:00
|
|
|
This file is part of libzmq, the ZeroMQ core engine in C++.
|
2009-07-29 12:07:54 +02:00
|
|
|
|
2015-06-02 22:33:55 +02:00
|
|
|
libzmq is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License (LGPL) as published
|
|
|
|
by the Free Software Foundation; either version 3 of the License, or
|
2009-07-29 12:07:54 +02:00
|
|
|
(at your option) any later version.
|
|
|
|
|
2015-06-02 22:33:55 +02:00
|
|
|
As a special exception, the Contributors give you permission to link
|
|
|
|
this library with independent modules to produce an executable,
|
|
|
|
regardless of the license terms of these independent modules, and to
|
|
|
|
copy and distribute the resulting executable under terms of your choice,
|
|
|
|
provided that you also meet, for each linked independent module, the
|
|
|
|
terms and conditions of the license of that module. An independent
|
|
|
|
module is a module which is not derived from or based on this library.
|
|
|
|
If you modify this library, you must extend this exception to your
|
|
|
|
version of the library.
|
|
|
|
|
|
|
|
libzmq 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.
|
2009-07-29 12:07:54 +02:00
|
|
|
|
2010-10-30 15:08:28 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2009-07-29 12:07:54 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2009-08-03 11:30:13 +02:00
|
|
|
#ifndef __ZMQ_WINDOWS_HPP_INCLUDED__
|
|
|
|
#define __ZMQ_WINDOWS_HPP_INCLUDED__
|
2009-07-29 12:07:54 +02:00
|
|
|
|
2011-12-15 14:03:43 +01:00
|
|
|
#ifndef _CRT_SECURE_NO_WARNINGS
|
|
|
|
#define _CRT_SECURE_NO_WARNINGS
|
|
|
|
#endif
|
2014-01-14 10:27:40 +00:00
|
|
|
#ifndef NOMINMAX
|
|
|
|
#define NOMINMAX // Macros min(a,b) and max(a,b)
|
|
|
|
#endif
|
2009-10-05 15:06:40 +02:00
|
|
|
|
2016-05-20 15:37:09 +01:00
|
|
|
// Set target version to Windows Server 2008, Windows Vista or higher.
|
|
|
|
// Windows XP (0x0501) is supported but without client & server socket types.
|
2017-04-04 10:50:33 +02:00
|
|
|
#if !defined _WIN32_WINNT && !defined ZMQ_HAVE_WINDOWS_UWP
|
2015-04-25 23:21:27 +03:00
|
|
|
#define _WIN32_WINNT 0x0600
|
2009-11-03 14:06:25 +01:00
|
|
|
#endif
|
|
|
|
|
2017-04-04 10:50:33 +02:00
|
|
|
#if defined ZMQ_HAVE_WINDOWS_UWP
|
|
|
|
#define _WIN32_WINNT _WIN32_WINNT_WIN10
|
|
|
|
#endif
|
|
|
|
|
2011-06-18 20:44:03 +02:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
// Require Windows XP or higher with MinGW for getaddrinfo().
|
2017-06-29 01:12:15 +02:00
|
|
|
#if(_WIN32_WINNT >= 0x0501)
|
2009-07-29 12:07:54 +02:00
|
|
|
#else
|
2017-06-29 01:12:15 +02:00
|
|
|
#error You need at least Windows XP target
|
2011-06-18 20:44:03 +02:00
|
|
|
#endif
|
2009-07-29 12:07:54 +02:00
|
|
|
#endif
|
2015-12-18 15:54:18 +06:00
|
|
|
|
2011-06-18 20:44:03 +02:00
|
|
|
#include <winsock2.h>
|
2014-01-13 18:38:59 +08:00
|
|
|
#include <windows.h>
|
2011-06-18 20:44:03 +02:00
|
|
|
#include <mswsock.h>
|
2015-12-18 15:54:18 +06:00
|
|
|
#include <iphlpapi.h>
|
2014-01-13 18:38:59 +08:00
|
|
|
|
2014-02-18 21:24:24 +08:00
|
|
|
#if !defined __MINGW32__
|
2016-12-08 16:35:44 +01:00
|
|
|
#include <mstcpip.h>
|
2014-01-13 18:38:59 +08:00
|
|
|
#endif
|
2009-07-29 12:07:54 +02:00
|
|
|
|
2016-12-08 16:35:44 +01:00
|
|
|
// Workaround missing mstcpip.h in mingw32 (MinGW64 provides this)
|
2014-04-14 13:56:01 +02:00
|
|
|
// __MINGW64_VERSION_MAJOR is only defined when using in mingw-w64
|
2016-05-20 15:37:09 +01:00
|
|
|
#if defined __MINGW32__ && !defined SIO_KEEPALIVE_VALS && \
|
|
|
|
!defined __MINGW64_VERSION_MAJOR
|
2014-02-18 21:24:24 +08:00
|
|
|
struct tcp_keepalive {
|
|
|
|
u_long onoff;
|
|
|
|
u_long keepalivetime;
|
|
|
|
u_long keepaliveinterval;
|
|
|
|
};
|
|
|
|
#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4)
|
|
|
|
#endif
|
|
|
|
|
2009-07-29 12:07:54 +02:00
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#include <ipexport.h>
|
2013-02-19 16:49:23 +01:00
|
|
|
#if !defined _WIN32_WCE
|
2009-07-29 12:07:54 +02:00
|
|
|
#include <process.h>
|
2012-03-14 19:12:28 +04:00
|
|
|
#endif
|
2009-07-29 12:07:54 +02:00
|
|
|
|
2017-04-20 15:44:35 +02:00
|
|
|
#if defined ZMQ_USE_POLL
|
2016-06-11 19:14:25 +02:00
|
|
|
static inline int poll(struct pollfd *pfd, unsigned long nfds, int timeout) { return WSAPoll(pfd, nfds, timeout); }
|
|
|
|
#endif
|
|
|
|
|
2011-06-18 20:44:03 +02:00
|
|
|
// In MinGW environment AI_NUMERICSERV is not defined.
|
2010-01-27 20:58:40 +01:00
|
|
|
#ifndef AI_NUMERICSERV
|
|
|
|
#define AI_NUMERICSERV 0x0400
|
|
|
|
#endif
|
2009-07-29 12:07:54 +02:00
|
|
|
#endif
|