commit 701a7f2a1f2d6169b4a600004c227f9555858527 parent f6ca9e905d134211fb5648b208bf1529318898b3 Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Jan 22 14:10:13 +0200 Take 2 Diffstat:
platform_network.h | | | 10 | ---------- |
unix_network.h | | | 6 | ++++++ |
win32_network.h | | | 6 | ++++++ |
diff --git a/platform_network.h b/platform_network.h @@ -8,16 +8,6 @@ enum TransportProtocol { NET_UDP, NET_TCP }; enum IPvX { NET_IPV4, NET_IPV6 }; enum NonblockingBool { NET_BLOCKING, NET_NONBLOCKING }; -#if PLATFORM_UNIX -typedef int SOCKET; -#endif - -struct Socket { - SOCKET fd; - TransportProtocol transport; - IPvX ipvx; -}; - #if PLATFORM_WINDOWS #include "win32_network.h" #elif PLATFORM_UNIX diff --git a/unix_network.h b/unix_network.h @@ -9,6 +9,12 @@ #include <netdb.h> #include <unistd.h> +struct Socket { + int fd; + TransportProtocol transport; + IPvX ipvx; +}; + #define INVALID_SOCKET ( -1 ) #define SOCKET_ERROR ( -1 ) diff --git a/win32_network.h b/win32_network.h @@ -7,6 +7,12 @@ typedef int ssize_t; #endif +struct Socket { + SOCKET fd; + TransportProtocol transport; + IPvX ipvx; +}; + inline void net_init() { WSADATA wsa_data; if( WSAStartup( MAKEWORD( 2, 2 ), &wsa_data ) == SOCKET_ERROR ) {