Set _WIN32_WINNT to windows 7
[novacoin.git] / src / compat.h
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2012 The Bitcoin developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef _BITCOIN_COMPAT_H
6 #define _BITCOIN_COMPAT_H 1
7
8 #ifdef WIN32
9 #define _WIN32_WINNT 0x0601
10 #define WIN32_LEAN_AND_MEAN 1
11 #ifndef NOMINMAX
12 #define NOMINMAX
13 #endif
14 #ifndef _MSC_VER
15 #ifdef FD_SETSIZE
16 #undef FD_SETSIZE
17 #endif
18 #define FD_SETSIZE 1024 // max number of fds in fd_set
19 #endif
20 #include <mswsock.h>
21 #include <ws2tcpip.h>
22 #else
23 #include <sys/types.h>
24 #include <sys/socket.h>
25 #ifdef ANDROID
26 #include <fcntl.h>
27 #else
28 #include <sys/fcntl.h>
29 #endif
30 #include <arpa/inet.h>
31 #include <netdb.h>
32 #include <net/if.h>
33 #include <netinet/in.h>
34 #include <ifaddrs.h>
35
36 typedef u_int SOCKET;
37 #endif
38
39 #ifdef WIN32
40 #define MSG_NOSIGNAL        0
41 #define MSG_DONTWAIT        0
42 typedef int socklen_t;
43 #else
44 #include "errno.h"
45 #define WSAGetLastError()   errno
46 #define WSAEINVAL           EINVAL
47 #define WSAEALREADY         EALREADY
48 #define WSAEWOULDBLOCK      EWOULDBLOCK
49 #define WSAEMSGSIZE         EMSGSIZE
50 #define WSAEINTR            EINTR
51 #define WSAEINPROGRESS      EINPROGRESS
52 #define WSAEADDRINUSE       EADDRINUSE
53 #define WSAENOTSOCK         EBADF
54 #define INVALID_SOCKET      (SOCKET)(~0)
55 #define SOCKET_ERROR        -1
56 #endif
57
58 #endif