6 #ifndef BITCOIN_COMPAT_H
7 #define BITCOIN_COMPAT_H
9 #if defined(HAVE_CONFIG_H)
10 #include "config/bitcoin-config.h"
17 #define _WIN32_WINNT 0x0501
18 #ifndef WIN32_LEAN_AND_MEAN
19 #define WIN32_LEAN_AND_MEAN 1
27 #define FD_SETSIZE 1024
35 #include <sys/fcntl.h>
37 #include <sys/select.h>
38 #include <sys/socket.h>
39 #include <sys/types.h>
41 #include <netinet/in.h>
42 #include <netinet/tcp.h>
43 #include <arpa/inet.h>
51 #define MSG_DONTWAIT 0
55 #define WSAGetLastError() errno
56 #define WSAEINVAL EINVAL
57 #define WSAEALREADY EALREADY
58 #define WSAEWOULDBLOCK EWOULDBLOCK
59 #define WSAEMSGSIZE EMSGSIZE
60 #define WSAEINTR EINTR
61 #define WSAEINPROGRESS EINPROGRESS
62 #define WSAEADDRINUSE EADDRINUSE
63 #define WSAENOTSOCK EBADF
64 #define INVALID_SOCKET (SOCKET)(~0)
65 #define SOCKET_ERROR -1
78 #if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL)
79 #define MSG_NOSIGNAL 0
82 #if HAVE_DECL_STRNLEN == 0
83 size_t strnlen(
const char *start,
size_t max_len);
86 bool static inline IsSelectableSocket(
SOCKET s) {
90 return (s < FD_SETSIZE);
size_t strnlen(const char *start, size_t max_len)