SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SocketIncludes.h
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 *
5 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
6 *
7 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
8 * license found in the license.txt file in the root directory of this source tree.
9 */
10
11 #ifndef RAKNET_SOCKETINCLUDES_H
12 #define RAKNET_SOCKETINCLUDES_H
13
14 // All this crap just to include type SOCKET
15
16 #ifdef __native_client__
17 #define _PP_Instance_ PP_Instance
18 #else
19 #define _PP_Instance_ int
20 #endif
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 #if defined(WINDOWS_STORE_RT)
42 #include <windows.h>
43 #include "WinRTSockAddr.h"
44 typedef Windows::Networking::Sockets::DatagramSocket^ __UDPSOCKET__;
45 typedef Windows::Networking::Sockets::StreamSocket^ __TCPSOCKET__;
46 typedef unsigned int socklen_t;
47 #define FORMAT_MESSAGE_ALLOCATE_BUFFER 0
48 #define FIONBIO 0
49 #define LocalFree(x)
50 // using Windows.Networking;
51 // using Windows.Networking.Sockets;
52 // See http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.sockets.datagramsocketcontrol
53 #elif defined(_WIN32)
54 // IP_DONTFRAGMENT is different between winsock 1 and winsock 2. Therefore, Winsock2.h must be linked againt Ws2_32.lib
55 // winsock.h must be linked against WSock32.lib. If these two are mixed up the flag won't work correctly
56 // WinRT: http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.sockets
57 // Sample code: http://stackoverflow.com/questions/10290945/correct-use-of-udp-datagramsocket
58 #include <winsock2.h>
59 typedef SOCKET __UDPSOCKET__;
60 typedef SOCKET __TCPSOCKET__;
61 typedef int socklen_t;
62 #else
63 #define closesocket close
64 #include <unistd.h>
65 #include <sys/types.h>
66 #include <sys/socket.h>
67 #include <netinet/in.h>
68 #include <arpa/inet.h>
69 #include <unistd.h>
70 #include <fcntl.h>
71
72 #ifdef __native_client__
73 #include "ppapi/cpp/private/net_address_private.h"
74 #include "ppapi/c/pp_bool.h"
75 #include "ppapi/c/pp_errors.h"
76 #include "ppapi/cpp/completion_callback.h"
77 #include "ppapi/cpp/instance_handle.h"
78 #include "ppapi/cpp/module.h"
79 #include "ppapi/cpp/module_impl.h"
80 #include "ppapi/c/pp_errors.h"
81 #include "ppapi/c/pp_module.h"
82 #include "ppapi/c/pp_var.h"
83 #include "ppapi/c/pp_resource.h"
84 #include "ppapi/c/ppb.h"
85 #include "ppapi/c/ppb_instance.h"
86 #include "ppapi/c/ppb_messaging.h"
87 #include "ppapi/c/ppb_var.h"
88 #include "ppapi/c/ppp.h"
89 #include "ppapi/c/ppb_core.h"
90 #include "ppapi/c/ppp_instance.h"
91 #include "ppapi/c/ppp_messaging.h"
92 #include "ppapi/c/pp_input_event.h"
93 #include "ppapi/c/pp_completion_callback.h"
94 //UDP specific - the 'private' folder was copied from the chromium src/ppapi/c headers folder
95 #include "ppapi/c/private/ppb_udp_socket_private.h"
96 #include "ppapi/cpp/private/net_address_private.h"
97 typedef PP_Resource __UDPSOCKET__;
98 typedef PP_Resource __TCPSOCKET__;
99 #else
100 //#include "memoryoverride.h"
102 typedef int __UDPSOCKET__;
103 typedef int __TCPSOCKET__;
104 #endif
105
106 #endif
107
108 #endif // RAKNET_SOCKETINCLUDES_H