Files
@ r4381:c965d1f3016a
Branch filter:
Location: cpp/openttd-patchpack/source/network_core.h - annotation
r4381:c965d1f3016a
4.7 KiB
text/x-c
(svn r6131) -Codechange : Complete all missing _ttdpatch_flags entries
-Feature : both unifiedmaglevmode are now set.
Maglev and monorail are not allowed to run on each other tracks and will not be.
Setting those flags will allow grfsets as the Norvegian one to be loaded
-Codechange : link the TTDPatch's irregularstations with OTTD's nonuniform_stations
-Codechange : Reformat the whole array (thanks Rubidium, it sure looks better now)
-Feature : both unifiedmaglevmode are now set.
Maglev and monorail are not allowed to run on each other tracks and will not be.
Setting those flags will allow grfsets as the Norvegian one to be loaded
-Codechange : link the TTDPatch's irregularstations with OTTD's nonuniform_stations
-Codechange : Reformat the whole array (thanks Rubidium, it sure looks better now)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r1812:a78a2f58cdc8 r1812:a78a2f58cdc8 r3294:48afb2c79c16 r2741:b45a34e10aea r2741:b45a34e10aea r2741:b45a34e10aea r2741:b45a34e10aea r543:efdb197f91ad r2482:52d443ba6369 r796:56ed7be83467 r796:56ed7be83467 r2482:52d443ba6369 r792:aa02017763d6 r1505:828542268bb1 r796:56ed7be83467 r796:56ed7be83467 r1342:eda5f9dc2b6c r796:56ed7be83467 r796:56ed7be83467 r796:56ed7be83467 r796:56ed7be83467 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r1412:45e7a02a2248 r1810:48efaaf44514 r1687:397187114acd r1412:45e7a02a2248 r1412:45e7a02a2248 r1412:45e7a02a2248 r706:247d1848bb5f r706:247d1848bb5f r1412:45e7a02a2248 r1412:45e7a02a2248 r706:247d1848bb5f r1412:45e7a02a2248 r1051:a98935952e20 r1051:a98935952e20 r1051:a98935952e20 r1051:a98935952e20 r543:efdb197f91ad r789:b184e8e395c5 r1812:a78a2f58cdc8 r789:b184e8e395c5 r1412:45e7a02a2248 r789:b184e8e395c5 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r1429:3fe68a428bb0 r1441:17f23e6bddfd r1429:3fe68a428bb0 r1429:3fe68a428bb0 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r810:08bcb4bf8186 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r810:08bcb4bf8186 r781:13ab6b3c1f17 r1507:737dd01be3a2 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r781:13ab6b3c1f17 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r770:be3f6b12cf89 r770:be3f6b12cf89 r1343:ea7fb505ae74 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r770:be3f6b12cf89 r543:efdb197f91ad r770:be3f6b12cf89 r1343:ea7fb505ae74 r770:be3f6b12cf89 r770:be3f6b12cf89 r770:be3f6b12cf89 r770:be3f6b12cf89 r770:be3f6b12cf89 r770:be3f6b12cf89 r770:be3f6b12cf89 r770:be3f6b12cf89 r543:efdb197f91ad r543:efdb197f91ad r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1466:9cfba64ec230 r1466:9cfba64ec230 r1466:9cfba64ec230 r1332:902c53ca8ff2 r1466:9cfba64ec230 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1332:902c53ca8ff2 r1812:a78a2f58cdc8 r1812:a78a2f58cdc8 r1812:a78a2f58cdc8 | /* $Id$ */
#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
#ifdef ENABLE_NETWORK
#if defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_2)
// OSX 10.2 don't have socklen_t defined, so we will define it here
typedef int socklen_t;
#endif
// Windows stuff
#if defined(WIN32) || defined(WIN64)
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#if !(defined(__MINGW32__) || defined(__CYGWIN__))
// Windows has some different names for some types..
typedef SSIZE_T ssize_t;
typedef int socklen_t;
#endif
#define GET_LAST_ERROR() WSAGetLastError()
#define EWOULDBLOCK WSAEWOULDBLOCK
// Windows has some different names for some types..
typedef unsigned long in_addr_t;
#endif // WIN32
// UNIX stuff
#if defined(UNIX)
# define SOCKET int
# define INVALID_SOCKET -1
# 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 <unistd.h>
# include <sys/ioctl.h>
# if defined(__BEOS__) && defined(BEOS_NET_SERVER)
# include <be/net/socket.h>
# include <be/kernel/OS.h> // snooze()
# include <be/net/netdb.h>
typedef unsigned long in_addr_t;
# define INADDR_NONE INADDR_BROADCAST
# else
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <arpa/inet.h>
# include <net/if.h>
// According to glibc/NEWS, <ifaddrs.h> appeared in glibc-2.3.
# if !defined(__sgi__) && !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) \
&& !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__)
// If for any reason ifaddrs.h does not exist on your system, comment out
// the following two lines and an alternative way will be used to fetch
// the list of IPs from the system.
# include <ifaddrs.h>
# define HAVE_GETIFADDRS
# endif
# if defined(SUNOS) || defined(__MORPHOS__) || defined(__BEOS__)
# define INADDR_NONE 0xffffffff
# endif
# if defined(__BEOS__) && !defined(BEOS_NET_SERVER)
// needed on Zeta
# include <sys/sockio.h>
# endif
# endif // BEOS_NET_SERVER
# if !defined(__BEOS__) && defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 1)
typedef uint32_t in_addr_t;
# endif
# include <errno.h>
# include <sys/time.h>
# include <netdb.h>
#endif // UNIX
#ifdef __BEOS__
typedef int socklen_t;
#endif
// OS/2 stuff
#if defined(__OS2__)
# define SOCKET int
# define INVALID_SOCKET -1
# define ioctlsocket ioctl
# define closesocket close
# define GET_LAST_ERROR() (sock_errno())
// Includes needed for OS/2 systems
# include <types.h>
# include <unistd.h>
# include <sys/ioctl.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <arpa/inet.h>
# include <net/if.h>
# include <errno.h>
# include <sys/time.h>
# include <netdb.h>
# include <nerrno.h>
# define INADDR_NONE 0xffffffff
typedef int socklen_t;
typedef unsigned long in_addr_t;
#endif // OS/2
// MorphOS and Amiga stuff
#if defined(__MORPHOS__) || defined(__AMIGA__)
# include <exec/types.h>
# include <proto/exec.h> // required for Open/CloseLibrary()
# if defined(__MORPHOS__)
# include <sys/filio.h> // FIO* defines
# include <sys/sockio.h> // SIO* defines
# include <netinet/in.h>
# else // __AMIGA__
# include <proto/socket.h>
# 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)
# define ioctl ioctlsocket
typedef unsigned int in_addr_t;
typedef long socklen_t;
extern struct Library *SocketBase;
# ifdef __AMIGA__
// for usleep() implementation
extern struct Device *TimerBase;
extern struct MsgPort *TimerPort;
extern struct timerequest *TimerRequest;
# endif
#endif // __MORPHOS__ || __AMIGA__
static inline bool SetNonBlocking(int d)
{
#ifdef WIN32
u_long nonblocking = 1;
#else
int nonblocking = 1;
#endif
#if defined(__BEOS__) && defined(BEOS_NET_SERVER)
return setsockopt(d, SOL_SOCKET, SO_NONBLOCK, &nonblocking, sizeof(nonblocking)) == 0;
#else
return ioctlsocket(d, FIONBIO, &nonblocking) == 0;
#endif
}
static inline bool SetNoDelay(int d)
{
// XXX should this be done at all?
#if !defined(BEOS_NET_SERVER) // not implemented on BeOS net_server
int b = 1;
// The (const char*) cast is needed for windows
return setsockopt(d, IPPROTO_TCP, TCP_NODELAY, (const char*)&b, sizeof(b)) == 0;
#else
return true;
#endif
}
#endif /* ENABLE_NETWORK */
#endif /* NETWORK_CORE_H */
|