14 #ifndef NETWORK_CORE_OS_ABSTRACTION_H 15 #define NETWORK_CORE_OS_ABSTRACTION_H 26 #define GET_LAST_ERROR() WSAGetLastError() 28 #define EWOULDBLOCK WSAEWOULDBLOCK 30 typedef unsigned long in_addr_t;
33 #if defined(__MINGW32__) && !defined(AI_ADDRCONFIG) 34 # define AI_ADDRCONFIG 0x00000400 37 #if !(defined(__MINGW32__) || defined(__CYGWIN__)) 39 typedef SSIZE_T ssize_t;
40 typedef int socklen_t;
41 # define IPPROTO_IPV6 41 46 #if defined(UNIX) && !defined(__OS2__) 47 # if defined(OPENBSD) || defined(__NetBSD__) 48 # define AI_ADDRCONFIG 0 51 # define INVALID_SOCKET -1 52 # define ioctlsocket ioctl 53 # define closesocket close 54 # define GET_LAST_ERROR() (errno) 60 # include <sys/ioctl.h> 61 # include <sys/socket.h> 62 # include <netinet/in.h> 63 # include <netinet/tcp.h> 64 # include <arpa/inet.h> 67 # if !defined(__sgi__) && !defined(SUNOS) && !defined(__INNOTEK_LIBC__) \ 68 && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) 73 # define HAVE_GETIFADDRS 75 # if !defined(INADDR_NONE) 76 # define INADDR_NONE 0xffffffff 79 # if defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 1) 80 typedef uint32_t in_addr_t;
84 # include <sys/time.h> 91 # define INVALID_SOCKET -1 92 # define ioctlsocket ioctl 93 # define closesocket close 94 # define GET_LAST_ERROR() (sock_errno()) 99 # include <sys/ioctl.h> 100 # include <sys/socket.h> 101 # include <netinet/in.h> 102 # include <netinet/tcp.h> 103 # include <arpa/inet.h> 106 # include <sys/time.h> 109 # define INADDR_NONE 0xffffffff 110 # include "../../3rdparty/os2/getaddrinfo.h" 111 # include "../../3rdparty/os2/getnameinfo.h" 113 #define IPV6_V6ONLY 27 120 uint8_t __u6_addr8[16];
121 uint16_t __u6_addr16[8];
122 uint32_t __u6_addr32[4];
126 #define s6_addr __u6_addr.__u6_addr8 128 struct sockaddr_in6 {
130 sa_family_t sin6_family;
132 uint32_t sin6_flowinfo;
133 struct in6_addr sin6_addr;
134 uint32_t sin6_scope_id;
137 typedef int socklen_t;
138 #if !defined(__INNOTEK_LIBC__) 139 typedef unsigned long in_addr_t;
152 u_long nonblocking = 1;
156 return ioctlsocket(d, FIONBIO, &nonblocking) == 0;
169 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.