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
9 #if (_WIN32_WINNT != _WIN_WINNT_WIN7)
10 #define _WIN32_WINNT 0x601
12 #define WIN32_LEAN_AND_MEAN 1
20 #define FD_SETSIZE 1024 // max number of fds in fd_set
25 #include <sys/types.h>
26 #include <sys/socket.h>
30 #include <sys/fcntl.h>
32 #include <arpa/inet.h>
35 #include <netinet/in.h>
42 #define MSG_NOSIGNAL 0
43 #define MSG_DONTWAIT 0
44 typedef int socklen_t;
47 #define WSAGetLastError() errno
48 #define WSAEINVAL EINVAL
49 #define WSAEALREADY EALREADY
50 #define WSAEWOULDBLOCK EWOULDBLOCK
51 #define WSAEMSGSIZE EMSGSIZE
52 #define WSAEINTR EINTR
53 #define WSAEINPROGRESS EINPROGRESS
54 #define WSAEADDRINUSE EADDRINUSE
55 #define WSAENOTSOCK EBADF
56 #define INVALID_SOCKET (SOCKET)(~0)
57 #define SOCKET_ERROR -1