SLikeNet  0.1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
defines.h
Go to the documentation of this file.
1 /*
2  * Original work: Copyright (c) 2014, Oculus VR, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7  * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8  *
9  *
10  * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11  *
12  * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13  * license found in the license.txt file in the root directory of this source tree.
14  */
15 
16 #ifndef __RAKNET_DEFINES_H
17 #define __RAKNET_DEFINES_H
18 
19 #ifdef _RETAIL
20 // retail builds imply release configurations
21 #define _RELEASE
22 #endif
23 
24 // If you want to change these defines, put them in RakNetDefinesOverrides so your changes are not lost when updating RakNet
25 // The user should not edit this file
26 #include "defineoverrides.h"
27 
32 #ifndef __GET_TIME_64BIT
33 #define __GET_TIME_64BIT 1
34 #endif
35 
36 // Define _FILE_AND_LINE_ to "",0 if you want to strip out file and line info for memory tracking from the EXE
37 // SWIG: This macro must be excluded from generating C# wrappers/interfaces since SWIG would try to handle the
38 // macro as a constant definition and fail to convert it, issuing the following warning:
39 // "warning 305: Bad constant value (ignored)." - see SLNET-227 for details
40 // Since this is not a constant definition at all, the correct solution is to exclude this macro therefore.
41 #ifndef _FILE_AND_LINE_
42 #ifndef SWIG
43 #ifdef _RETAIL
44 // retail builds do not contain source-code related information in order to reduce the overall EXE size
45 #define _FILE_AND_LINE_ "",0
46 #else
47 #define _FILE_AND_LINE_ __FILE__,__LINE__
48 #endif // _RETAIL
49 #endif // SWIG
50 #endif // _FILE_AND_LINE_
51 
56 // #define RAKNET_COMPATIBILITY
57 
61 // #define __BITSTREAM_NATIVE_END
62 
64 #ifndef MAX_ALLOCA_STACK_ALLOCATION
65 #define MAX_ALLOCA_STACK_ALLOCATION 1048576
66 #endif
67 
68 // Use WaitForSingleObject instead of sleep.
69 // Defining it plays nicer with other systems, and uses less CPU, but gives worse RakNet performance
70 // Undefining it uses more CPU time, but is more responsive and faster.
71 #ifndef _WIN32_WCE
72 #define USE_WAIT_FOR_MULTIPLE_EVENTS
73 #endif
74 
77 #ifndef _USE_RAK_MEMORY_OVERRIDE
78 #define _USE_RAK_MEMORY_OVERRIDE 0
79 #endif
80 
85 // #define OPEN_SSL_CLIENT_SUPPORT
86 #ifndef OPEN_SSL_CLIENT_SUPPORT
87 #define OPEN_SSL_CLIENT_SUPPORT 0
88 #endif
89 
92 #ifndef BITSTREAM_STACK_ALLOCATION_SIZE
93 #define BITSTREAM_STACK_ALLOCATION_SIZE 256
94 #endif
95 
96 // Redefine if you want to disable or change the target for debug RAKNET_DEBUG_PRINTF
97 #ifndef RAKNET_DEBUG_PRINTF
98 #define RAKNET_DEBUG_PRINTF printf
99 #endif
100 
101 #ifndef RAKNET_DEBUG_TPRINTF
102 #define RAKNET_DEBUG_TPRINTF _tprintf
103 #endif
104 
105 // Maximum number of local IP addresses supported
106 #ifndef MAXIMUM_NUMBER_OF_INTERNAL_IDS
107 #define MAXIMUM_NUMBER_OF_INTERNAL_IDS 10
108 #endif
109 
110 #ifndef RakAssert
111 
112 
113 
114 #if defined(__native_client__)
115 #define RakAssert(x)
116 #else
117 #if defined(_DEBUG)
118 #define RakAssert(x) assert(x);
119 #else
120 #define RakAssert(x)
121 #endif
122 #endif
123 #endif
124 
128 #ifndef DATAGRAM_MESSAGE_ID_ARRAY_LENGTH
129 #define DATAGRAM_MESSAGE_ID_ARRAY_LENGTH 512
130 #endif
131 
135 #ifndef RESEND_BUFFER_ARRAY_LENGTH
136 #define RESEND_BUFFER_ARRAY_LENGTH 512
137 #define RESEND_BUFFER_ARRAY_MASK 511
138 #endif
139 
141 // #define _LINK_DL_MALLOC
142 
143 #ifndef GET_TIME_SPIKE_LIMIT
144 
145 
146 
147 
148 #define GET_TIME_SPIKE_LIMIT 0
149 #endif
150 
151 // Use sliding window congestion control instead of ping based congestion control
152 #ifndef USE_SLIDING_WINDOW_CONGESTION_CONTROL
153 #define USE_SLIDING_WINDOW_CONGESTION_CONTROL 1
154 #endif
155 
156 // When a large message is arriving, preallocate the memory for the entire block
157 // This results in large messages not taking up time to reassembly with memcpy, but is vulnerable to attackers causing the host to run out of memory
158 #ifndef PREALLOCATE_LARGE_MESSAGES
159 #define PREALLOCATE_LARGE_MESSAGES 0
160 #endif
161 
162 #ifndef RAKNET_SUPPORT_IPV6
163 #define RAKNET_SUPPORT_IPV6 0
164 #endif
165 
166 
167 
168 
169 
170 
171 
172 
173 
174 
175 
176 #ifndef RAKSTRING_TYPE
177 #if defined(_UNICODE)
178 #define RAKSTRING_TYPE RakWString
179 #define RAKSTRING_TYPE_IS_UNICODE 1
180 #else
181 #define RAKSTRING_TYPE RakString
182 #define RAKSTRING_TYPE_IS_UNICODE 0
183 #endif
184 #endif
185 
186 #ifndef RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS
187 #define RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS 48
188 #endif
189 
190 #ifndef RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH
191 #define RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH 48
192 #endif
193 
194 #ifndef XBOX_BYPASS_SECURITY
195 #define XBOX_BYPASS_SECURITY 1
196 #endif
197 
198 // Controls how many allocations occur at once for the memory pool of incoming datagrams waiting to be transferred between the recvfrom thread and the main update thread
199 // Has large effect on memory usage, per instance of RakPeer. Approximately MAXIMUM_MTU_SIZE*BUFFERED_PACKETS_PAGE_SIZE bytes, once after calling RakPeer::Startup()
200 #ifndef BUFFERED_PACKETS_PAGE_SIZE
201 #define BUFFERED_PACKETS_PAGE_SIZE 8
202 #endif
203 
204 // Controls how many allocations occur at once for the memory pool of incoming or outgoing datagrams.
205 // Has small effect on memory usage per connection. Uses about 256 bytes*INTERNAL_PACKET_PAGE_SIZE per connection
206 #ifndef INTERNAL_PACKET_PAGE_SIZE
207 #define INTERNAL_PACKET_PAGE_SIZE 8
208 #endif
209 
210 // If defined to 1, the user is responsible for calling RakPeer::RunUpdateCycle and RakPeer::RunRecvfrom
211 #ifndef RAKPEER_USER_THREADED
212 #define RAKPEER_USER_THREADED 0
213 #endif
214 
215 #ifndef USE_ALLOCA
216 #define USE_ALLOCA 1
217 #endif
218 
219 
220 
221 
222 
223 
224 //#define USE_THREADED_SEND
225 
226 // @since 0.1.1: added
227 // Controls the maximum retrievable filesize for incoming files using FileListTransfer.
228 // The configured limit only applies for files which are transferred incrementally (which basically applies to any larger file).
229 // Note that this also impacts the upper limit for memory allocations. It's suggested to redefine the value to a reasonable smaller size in the defineoverrides.h header file.
230 // For backwards compatibility with RakNet, the default is set to 4 GiB-1.
231 // #low - consider introducing GiB/MiB/KiB-functions and then define as GiB(4)?
232 #ifndef SLNET_MAX_RETRIEVABLE_FILESIZE
233 #define SLNET_MAX_RETRIEVABLE_FILESIZE (0xFFFFFFFF)
234 #endif
235 
236 // #blocker_2_0 - remove RAKNET_COMPATIBILITY
237 #ifdef RAKNET_COMPATIBILITY
238 // note: we cannot use namespace aliases here since we need to ensure ABI compatibility with shared libraries/DLLs
239 // if we'd use a namespace alias, the names in the DLLs would still point to the actual namespace (SLNet) rather
240 // than the alias namespace and old apps would not be able to use the DLL as an in-place replacement
241 // hence, go with a simple preprocessor macro which will replace the SLNet namespace names with RakNet
242 #define SLNet RakNet
243 #endif
244 
245 #endif // __RAKNET_DEFINES_H