#ifndef NETWORK_CORE_H #define NETWORK_CORE_H // Network stuff has many things that needs to be included // by default. All those things are in this file. // ============================= // Include standard stuff per OS // Windows stuff #if defined(WIN32) # include # include # include # pragma comment (lib, "ws2_32.lib") # define ENABLE_NETWORK // On windows, the network is always enabled # define GET_LAST_ERROR() WSAGetLastError() # define EWOULDBLOCK WSAEWOULDBLOCK // Windows has some different names for some types.. typedef SSIZE_T ssize_t; typedef unsigned long in_addr_t; typedef INTERFACE_INFO IFREQ; #endif // WIN32 // UNIX stuff #if defined(UNIX) # define SOCKET int # define INVALID_SOCKET -1 typedef struct ifreq IFREQ; # if !defined(__MORPHOS__) && !defined(__AMIGA__) # define ioctlsocket ioctl # if !defined(BEOS_NET_SERVER) # define closesocket close # endif # define GET_LAST_ERROR() (errno) # endif // Need this for FIONREAD on solaris # define BSD_COMP // Includes needed for UNIX-like systems # include # include # if defined(__BEOS__) && defined(BEOS_NET_SERVER) # include # include // snooze() # include typedef unsigned long in_addr_t; # define INADDR_NONE INADDR_BROADCAST # else # include # include # include # include # include # if !defined(SUNOS) # include // If for any reason ifaddrs.h does not exist on a system, remove define below // and an other system will be used to fetch ips from the system # define HAVE_GETIFADDRS # else # define INADDR_NONE 0xffffffff # endif // SUNOS # endif // BEOS_NET_SERVER # include # include # include #endif // UNIX // MorphOS and Amiga stuff #if defined(__MORPHOS__) || defined(__AMIGA__) # include # include // required for Open/CloseLibrary() # if defined(__MORPHOS__) # include // FION#? defines # else // __AMIGA__ # include # endif // Make the names compatible # define closesocket(s) CloseSocket(s) # define GET_LAST_ERROR() Errno() # define ioctlsocket(s,request,status) IoctlSocket((LONG)s,(ULONG)request,(char*)status) struct Library *SocketBase = NULL; #endif // __MORPHOS__ || __AMIGA__ #endif // NETWORK_CORE_H