16 #ifndef NETWORK_CORE_OS_ABSTRACTION_H 17 #define NETWORK_CORE_OS_ABSTRACTION_H 30 #define GET_LAST_ERROR() WSAGetLastError() 32 #define EWOULDBLOCK WSAEWOULDBLOCK 34 typedef unsigned long in_addr_t;
36 #if !(defined(__MINGW32__) || defined(__CYGWIN__)) 38 typedef SSIZE_T ssize_t;
39 typedef int socklen_t;
40 # define IPPROTO_IPV6 41 45 #if defined(UNIX) && !defined(__OS2__) 46 # if defined(OPENBSD) || defined(__NetBSD__) 47 # define AI_ADDRCONFIG 0 50 # define INVALID_SOCKET -1 51 # if !defined(__MORPHOS__) && !defined(__AMIGA__) 52 # define ioctlsocket ioctl 53 # if !defined(BEOS_NET_SERVER) 54 # define closesocket close 56 # define GET_LAST_ERROR() (errno) 63 # include <sys/ioctl.h> 64 # if defined(__BEOS__) && defined(BEOS_NET_SERVER) 65 # include <be/net/socket.h> 66 # include <be/kernel/OS.h> 67 # include <be/net/netdb.h> 68 typedef unsigned long in_addr_t;
69 # define INADDR_NONE INADDR_BROADCAST 71 # include <sys/socket.h> 72 # include <netinet/in.h> 73 # include <netinet/tcp.h> 74 # include <arpa/inet.h> 77 # if !defined(__sgi__) && !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \ 78 && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) 83 # define HAVE_GETIFADDRS 85 # if !defined(INADDR_NONE) 86 # define INADDR_NONE 0xffffffff 88 # if defined(__BEOS__) && !defined(BEOS_NET_SERVER) 90 # include <sys/sockio.h> 94 # if !defined(__BEOS__) && defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 1) 95 typedef uint32_t in_addr_t;
99 # include <sys/time.h> 104 typedef int socklen_t;
108 #define IPV6_V6ONLY 27 114 # define INVALID_SOCKET -1 115 # define ioctlsocket ioctl 116 # define closesocket close 117 # define GET_LAST_ERROR() (sock_errno()) 122 # include <sys/ioctl.h> 123 # include <sys/socket.h> 124 # include <netinet/in.h> 125 # include <netinet/tcp.h> 126 # include <arpa/inet.h> 129 # include <sys/time.h> 132 # define INADDR_NONE 0xffffffff 133 # include "../../3rdparty/os2/getaddrinfo.h" 134 # include "../../3rdparty/os2/getnameinfo.h" 136 #define IPV6_V6ONLY 27 143 uint8_t __u6_addr8[16];
144 uint16_t __u6_addr16[8];
145 uint32_t __u6_addr32[4];
149 #define s6_addr __u6_addr.__u6_addr8 151 struct sockaddr_in6 {
153 sa_family_t sin6_family;
155 uint32_t sin6_flowinfo;
156 struct in6_addr sin6_addr;
157 uint32_t sin6_scope_id;
160 typedef int socklen_t;
161 #if !defined(__INNOTEK_LIBC__) 162 typedef unsigned long in_addr_t;
168 #if defined(__MORPHOS__) || defined(__AMIGA__) 169 # include <exec/types.h> 170 # include <proto/exec.h> 174 # if defined(__MORPHOS__) 175 # include <sys/filio.h> 176 # include <sys/sockio.h> 177 # include <netinet/in.h> 179 # include <proto/socket.h> 183 # define closesocket(s) CloseSocket(s) 184 # define GET_LAST_ERROR() Errno() 185 # define ioctlsocket(s, request, status) IoctlSocket((LONG)s, (ULONG)request, (char*)status) 186 # define ioctl ioctlsocket 188 typedef unsigned int in_addr_t;
189 typedef long socklen_t;
190 extern struct Library *SocketBase;
194 extern struct Device *TimerBase;
195 extern struct MsgPort *TimerPort;
196 extern struct timerequest *TimerRequest;
208 u_long nonblocking = 1;
212 #if (defined(__BEOS__) && defined(BEOS_NET_SERVER)) 213 return setsockopt(d, SOL_SOCKET, SO_NONBLOCK, &nonblocking,
sizeof(nonblocking)) == 0;
215 return ioctlsocket(d, FIONBIO, &nonblocking) == 0;
227 #if !defined(BEOS_NET_SERVER) 230 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.