File diff r23482:de566f8c088d → r23483:3733e6b8ff17
src/network/core/os_abstraction.h
Show inline comments
 
@@ -9,26 +9,24 @@
 

	
 
/**
 
 * @file os_abstraction.h Network stuff has many things that needs to be
 
 *                        included and/or implemented by default.
 
 *                        All those things are in this file.
 
 */
 

	
 
#ifndef NETWORK_CORE_OS_ABSTRACTION_H
 
#define NETWORK_CORE_OS_ABSTRACTION_H
 

	
 
/* Include standard stuff per OS */
 

	
 
#ifdef ENABLE_NETWORK
 

	
 
/* Windows stuff */
 
#if defined(_WIN32)
 
#include <errno.h>
 
#include <winsock2.h>
 
#include <ws2tcpip.h>
 
#include <windows.h>
 

	
 
#define GET_LAST_ERROR() WSAGetLastError()
 
#undef EWOULDBLOCK
 
#define EWOULDBLOCK WSAEWOULDBLOCK
 
/* Windows has some different names for some types */
 
typedef unsigned long in_addr_t;
 
@@ -163,15 +161,13 @@ static inline bool SetNonBlocking(SOCKET
 
static inline bool SetNoDelay(SOCKET d)
 
{
 
	/* XXX should this be done at all? */
 
	int b = 1;
 
	/* The (const char*) cast is needed for windows */
 
	return setsockopt(d, IPPROTO_TCP, TCP_NODELAY, (const char*)&b, sizeof(b)) == 0;
 
}
 

	
 
/* Make sure these structures have the size we expect them to be */
 
assert_compile(sizeof(in_addr)  ==  4); ///< IPv4 addresses should be 4 bytes.
 
assert_compile(sizeof(in6_addr) == 16); ///< IPv6 addresses should be 16 bytes.
 

	
 
#endif /* ENABLE_NETWORK */
 

	
 
#endif /* NETWORK_CORE_OS_ABSTRACTION_H */