16 #ifndef NETWORK_CORE_OS_ABSTRACTION_H 17 #define NETWORK_CORE_OS_ABSTRACTION_H 28 #define GET_LAST_ERROR() WSAGetLastError() 30 #define EWOULDBLOCK WSAEWOULDBLOCK 32 typedef unsigned long in_addr_t;
35 #if defined(__MINGW32__) && !defined(AI_ADDRCONFIG) 36 # define AI_ADDRCONFIG 0x00000400 39 #if !(defined(__MINGW32__) || defined(__CYGWIN__)) 41 typedef SSIZE_T ssize_t;
42 typedef int socklen_t;
43 # define IPPROTO_IPV6 41 48 #if defined(UNIX) && !defined(__OS2__) 49 # if defined(OPENBSD) || defined(__NetBSD__) 50 # define AI_ADDRCONFIG 0 53 # define INVALID_SOCKET -1 54 # define ioctlsocket ioctl 55 # define closesocket close 56 # define GET_LAST_ERROR() (errno) 62 # include <sys/ioctl.h> 63 # include <sys/socket.h> 64 # include <netinet/in.h> 65 # include <netinet/tcp.h> 66 # include <arpa/inet.h> 69 # if !defined(__sgi__) && !defined(SUNOS) && !defined(__INNOTEK_LIBC__) \ 70 && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) 75 # define HAVE_GETIFADDRS 77 # if !defined(INADDR_NONE) 78 # define INADDR_NONE 0xffffffff 81 # if defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 1) 82 typedef uint32_t in_addr_t;
86 # include <sys/time.h> 93 # define INVALID_SOCKET -1 94 # define ioctlsocket ioctl 95 # define closesocket close 96 # define GET_LAST_ERROR() (sock_errno()) 101 # include <sys/ioctl.h> 102 # include <sys/socket.h> 103 # include <netinet/in.h> 104 # include <netinet/tcp.h> 105 # include <arpa/inet.h> 108 # include <sys/time.h> 111 # define INADDR_NONE 0xffffffff 112 # include "../../3rdparty/os2/getaddrinfo.h" 113 # include "../../3rdparty/os2/getnameinfo.h" 115 #define IPV6_V6ONLY 27 122 uint8_t __u6_addr8[16];
123 uint16_t __u6_addr16[8];
124 uint32_t __u6_addr32[4];
128 #define s6_addr __u6_addr.__u6_addr8 130 struct sockaddr_in6 {
132 sa_family_t sin6_family;
134 uint32_t sin6_flowinfo;
135 struct in6_addr sin6_addr;
136 uint32_t sin6_scope_id;
139 typedef int socklen_t;
140 #if !defined(__INNOTEK_LIBC__) 141 typedef unsigned long in_addr_t;
154 u_long nonblocking = 1;
158 return ioctlsocket(d, FIONBIO, &nonblocking) == 0;
171 return setsockopt(d, IPPROTO_TCP, TCP_NODELAY, (
const char*)&b,
sizeof(b)) == 0;
static bool SetNonBlocking(SOCKET d)
Try to set the socket into non-blocking mode.
assert_compile(sizeof(in_addr)==4)
IPv4 addresses should be 4 bytes.
static bool SetNoDelay(SOCKET d)
Try to set the socket to not delay sending.