summaryrefslogtreecommitdiff
path: root/src/network/core/os_abstraction.h
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-02-11 13:57:35 +0000
committertruelight <truelight@openttd.org>2007-02-11 13:57:35 +0000
commitc8c9c0c8316b8d43c53a7fd83eeecdbb8c5d1d36 (patch)
tree221561506effc0c4c1a3f46200cc308b8a4ee5a5 /src/network/core/os_abstraction.h
parent9d545a69c5648bdf238e6a6789fc8edfcbcf56b6 (diff)
downloadopenttd-c8c9c0c8316b8d43c53a7fd83eeecdbb8c5d1d36.tar.xz
(svn r8674) [PSP] -Add: added network code for PSP, based on the work of Turulo
-Add: added general header-inclusing for PSP
Diffstat (limited to 'src/network/core/os_abstraction.h')
-rw-r--r--src/network/core/os_abstraction.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h
index 00545c70f..8c5e4b9d3 100644
--- a/src/network/core/os_abstraction.h
+++ b/src/network/core/os_abstraction.h
@@ -91,6 +91,29 @@ typedef unsigned long in_addr_t;
typedef int socklen_t;
#endif
+#if defined(PSP)
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <pspnet.h>
+# include <pspnet_inet.h>
+# include <pspnet_apctl.h>
+# include <pspnet_resolver.h>
+# include <errno.h>
+# include <unistd.h>
+# include <sys/select.h>
+# include <sys/time.h>
+# include <sys/fd_set.h>
+
+# define TCP_NODELAY 1
+# define SO_NONBLOCK 0x1009
+# define SOCKET int
+# define INVALID_SOCKET -1
+# define INADDR_NONE 0xffffffff
+# define closesocket close
+# define GET_LAST_ERROR() sceNetInetGetErrno()
+#endif /* PSP */
+
/* OS/2 stuff */
#if defined(__OS2__)
# define SOCKET int
@@ -160,7 +183,7 @@ static inline bool SetNonBlocking(SOCKET d)
#else
int nonblocking = 1;
#endif
-#if defined(__BEOS__) && defined(BEOS_NET_SERVER)
+#if (defined(__BEOS__) && defined(BEOS_NET_SERVER)) || defined(PSP)
return setsockopt(d, SOL_SOCKET, SO_NONBLOCK, &nonblocking, sizeof(nonblocking)) == 0;
#else
return ioctlsocket(d, FIONBIO, &nonblocking) == 0;