author | Xeli |
Tue, 05 Jul 2011 18:27:18 +0200 | |
branch | hedgeroid |
changeset 5397 | 4ae1b082e4ba |
parent 5317 | 86984c1034a5 |
permissions | -rw-r--r-- |
5317
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
1 |
/* |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
2 |
SDL_net: An example cross-platform network library for use with SDL |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
3 |
Copyright (C) 1997-2004 Sam Lantinga |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
4 |
|
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
5 |
This library is free software; you can redistribute it and/or |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
6 |
modify it under the terms of the GNU Library General Public |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
7 |
License as published by the Free Software Foundation; either |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
8 |
version 2 of the License, or (at your option) any later version. |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
9 |
|
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
10 |
This library is distributed in the hope that it will be useful, |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
13 |
Library General Public License for more details. |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
14 |
|
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
15 |
You should have received a copy of the GNU Library General Public |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
16 |
License along with this library; if not, write to the Free |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
17 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
18 |
|
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
19 |
Sam Lantinga |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
20 |
slouken@libsdl.org |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
21 |
*/ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
22 |
|
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
23 |
/* $Id: SDLnetsys.h 1720 2005-11-23 07:57:10Z icculus $ */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
24 |
|
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
25 |
/* Include normal system headers */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
26 |
#include <stdio.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
27 |
#include <stdlib.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
28 |
#include <string.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
29 |
#include <errno.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
30 |
|
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
31 |
#ifdef macintosh |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
32 |
#ifndef USE_GUSI_SOCKETS |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
33 |
#define MACOS_OPENTRANSPORT |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
34 |
//#error Open Transport driver is broken |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
35 |
#endif |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
36 |
#endif /* macintosh */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
37 |
|
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
38 |
/* Include system network headers */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
39 |
#ifdef MACOS_OPENTRANSPORT |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
40 |
#include <OpenTransport.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
41 |
#include <OpenTptInternet.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
42 |
#else |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
43 |
#if defined(__WIN32__) || defined(WIN32) |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
44 |
#define __USE_W32_SOCKETS |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
45 |
#include <windows.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
46 |
#else /* UNIX */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
47 |
#ifdef __OS2__ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
48 |
#include <types.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
49 |
#include <sys/ioctl.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
50 |
#endif |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
51 |
#include <sys/time.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
52 |
#include <unistd.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
53 |
#include <fcntl.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
54 |
#include <netinet/in.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
55 |
#ifndef __BEOS__ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
56 |
#include <arpa/inet.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
57 |
#endif |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
58 |
#ifdef linux /* FIXME: what other platforms have this? */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
59 |
#include <netinet/tcp.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
60 |
#endif |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
61 |
#include <netdb.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
62 |
#include <sys/socket.h> |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
63 |
#endif /* WIN32 */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
64 |
#endif /* Open Transport */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
65 |
|
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
66 |
/* System-dependent definitions */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
67 |
#ifdef MACOS_OPENTRANSPORT |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
68 |
//#define closesocket OTCloseProvider |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
69 |
#define closesocket OTSndOrderlyDisconnect |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
70 |
#define SOCKET EndpointRef |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
71 |
#define INVALID_SOCKET kOTInvalidEndpointRef |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
72 |
#else |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
73 |
#ifndef __USE_W32_SOCKETS |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
74 |
#ifdef __OS2__ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
75 |
#define closesocket soclose |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
76 |
#else /* !__OS2__ */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
77 |
#define closesocket close |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
78 |
#endif /* __OS2__ */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
79 |
#define SOCKET int |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
80 |
#define INVALID_SOCKET -1 |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
81 |
#define SOCKET_ERROR -1 |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
82 |
#endif /* __USE_W32_SOCKETS */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
83 |
#endif /* Open Transport */ |
86984c1034a5
Added sdl_net from the unofficial android port: http://www.anddev.org/sdl_port_for_android_sdk-ndk_16-t9218.html
Xeli
parents:
diff
changeset
|
84 |