windows.hpp 1.98 KB
Newer Older
Martin Sustrik's avatar
Martin Sustrik committed
1
/*
2
    Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
Martin Sustrik's avatar
Martin Sustrik committed
3 4 5 6

    This file is part of 0MQ.

    0MQ is free software; you can redistribute it and/or modify it under
7
    the terms of the GNU Lesser General Public License as published by
Martin Sustrik's avatar
Martin Sustrik committed
8 9 10 11 12 13
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    0MQ 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
14
    GNU Lesser General Public License for more details.
Martin Sustrik's avatar
Martin Sustrik committed
15

16
    You should have received a copy of the GNU Lesser General Public License
Martin Sustrik's avatar
Martin Sustrik committed
17 18 19
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

Martin Sustrik's avatar
Martin Sustrik committed
20 21
#ifndef __ZMQ_WINDOWS_HPP_INCLUDED__
#define __ZMQ_WINDOWS_HPP_INCLUDED__
Martin Sustrik's avatar
Martin Sustrik committed
22

23 24 25
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
26 27 28
#ifndef NOMINMAX
#define NOMINMAX          // Macros min(a,b) and max(a,b)
#endif
malosek's avatar
malosek committed
29

30
//  Set target version to Windows Server 2003, Windows XP/SP1 or higher.
31
#ifndef _WIN32_WINNT
32
#define _WIN32_WINNT 0x0501
33 34
#endif

35 36 37
#ifdef __MINGW32__
//  Require Windows XP or higher with MinGW for getaddrinfo().
#if(_WIN32_WINNT >= 0x0501)
Martin Sustrik's avatar
Martin Sustrik committed
38
#else
39 40 41
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
Martin Sustrik's avatar
Martin Sustrik committed
42
#endif
43 44
 
#include <winsock2.h>
45
#include <windows.h>
46
#include <mswsock.h>
47

48
#if !defined __MINGW32__
49
#include <Mstcpip.h>
50
#endif
Martin Sustrik's avatar
Martin Sustrik committed
51

V G's avatar
V G committed
52
//  Workaround missing Mstcpip.h in mingw32 (MinGW64 provides this)
Maarten Ditzel's avatar
Maarten Ditzel committed
53 54
//  __MINGW64_VERSION_MAJOR is only defined when using in mingw-w64
#if defined __MINGW32__ && !defined SIO_KEEPALIVE_VALS && !defined __MINGW64_VERSION_MAJOR
55 56 57 58 59 60 61 62
struct tcp_keepalive {
    u_long onoff;
    u_long keepalivetime;
    u_long keepaliveinterval;
};
#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4)
#endif

Martin Sustrik's avatar
Martin Sustrik committed
63 64
#include <ws2tcpip.h>
#include <ipexport.h>
65
#if !defined _WIN32_WCE
Martin Sustrik's avatar
Martin Sustrik committed
66
#include <process.h>
boris@boressoft.ru's avatar
boris@boressoft.ru committed
67
#endif
Martin Sustrik's avatar
Martin Sustrik committed
68

69
//  In MinGW environment AI_NUMERICSERV is not defined.
70 71 72
#ifndef AI_NUMERICSERV
#define AI_NUMERICSERV 0x0400
#endif
Martin Sustrik's avatar
Martin Sustrik committed
73
#endif