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