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) darkvater@796: #include darkvater@796: #include darkvater@796: #include darkvater@792: darkvater@792: #ifdef _MSC_VER darkvater@796: #pragma comment (lib, "ws2_32.lib") darkvater@792: #endif //_MSC_VER darkvater@792: darkvater@796: #if ! (defined(__MINGW32__) || defined(__CYGWIN__)) darkvater@796: #define ENABLE_NETWORK // On windows, the network is always enabled darkvater@796: // Windows has some different names for some types.. darkvater@796: typedef SSIZE_T ssize_t; darkvater@796: #endif darkvater@796: darkvater@796: #define GET_LAST_ERROR() WSAGetLastError() darkvater@796: #define EWOULDBLOCK WSAEWOULDBLOCK truelight@543: // Windows has some different names for some types.. 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@1051: # if !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) 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 tron@1051: # if defined(__BEOS__) && !defined(BEOS_NET_SERVER) tron@1051: // needed on Zeta tron@1051: # include tron@1051: # endif truelight@543: # endif // BEOS_NET_SERVER truelight@789: truelight@789: /* GLibc 2.1 does not support GetIfAddr() */ truelight@789: # if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 1) truelight@789: # undef HAVE_GETIFADDRS truelight@789: typedef uint32_t in_addr_t; truelight@789: # endif /* __GLIBC__ && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 1) */ truelight@789: truelight@543: # include truelight@543: # include truelight@543: # include truelight@543: #endif // UNIX truelight@543: truelight@781: // OS/2 stuff truelight@781: #if defined(__OS2__) truelight@781: # define SOCKET int truelight@781: # define INVALID_SOCKET -1 truelight@781: typedef struct ifreq IFREQ; truelight@781: # define ioctlsocket ioctl truelight@781: # define closesocket close truelight@810: # define GET_LAST_ERROR() (sock_errno()) truelight@781: truelight@781: // Includes needed for OS/2 systems truelight@781: # include truelight@781: # include truelight@781: # include truelight@781: # include truelight@781: # include truelight@781: # include truelight@781: # include truelight@781: # include truelight@781: # include truelight@781: # include truelight@781: # include truelight@781: # include truelight@810: # define INADDR_NONE 0xffffffff truelight@781: truelight@781: typedef unsigned long in_addr_t; truelight@781: #endif // OS/2 truelight@781: 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__) bjarni@770: # include // FIO* defines bjarni@770: # include // SIO* 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) bjarni@770: # define ioctl ioctlsocket truelight@543: bjarni@770: typedef unsigned int in_addr_t; bjarni@770: extern struct Library *SocketBase; bjarni@770: bjarni@770: # ifdef __AMIGA__ bjarni@770: // for usleep() implementation bjarni@770: extern struct Device *TimerBase; bjarni@770: extern struct MsgPort *TimerPort; bjarni@770: extern struct timerequest *TimerRequest; bjarni@770: # endif truelight@543: #endif // __MORPHOS__ || __AMIGA__ truelight@543: truelight@543: #endif // NETWORK_CORE_H