1 #ifndef __RAKNET_DEFINES_H
2 #define __RAKNET_DEFINES_H
3 
4 // If you want to change these defines, put them in RakNetDefinesOverrides so your changes are not lost when updating RakNet
5 // The user should not edit this file
6 #include "RakNetDefinesOverrides.h"
7 
8 /// Define __GET_TIME_64BIT to have RakNetTime use a 64, rather than 32 bit value.  A 32 bit value will overflow after about 5 weeks.
9 /// However, this doubles the bandwidth use for sending times, so don't do it unless you have a reason to.
10 /// Comment out if you are using the iPod Touch TG. See http://www.jenkinssoftware.com/forum/index.php?topic=2717.0
11 #ifndef __GET_TIME_64BIT
12 #define __GET_TIME_64BIT 1
13 #endif
14 
15 /// Makes RakNet threadsafe
16 /// Do not undefine!
17 #define _RAKNET_THREADSAFE
18 
19 /// Define __BITSTREAM_NATIVE_END to NOT support endian swapping in the BitStream class.  This is faster and is what you should use
20 /// unless you actually plan to have different endianness systems connect to each other
21 /// Enabled by default.
22 // #define __BITSTREAM_NATIVE_END
23 
24 /// Maximum (stack) size to use with _alloca before using new and delete instead.
25 #ifndef MAX_ALLOCA_STACK_ALLOCATION
26 #define MAX_ALLOCA_STACK_ALLOCATION 1048576
27 #endif
28 
29 // Use WaitForSingleObject instead of sleep.
30 // Defining it plays nicer with other systems, and uses less CPU, but gives worse RakNet performance
31 // Undefining it uses more CPU time, but is more responsive and faster.
32 #ifndef _WIN32_WCE
33 #define USE_WAIT_FOR_MULTIPLE_EVENTS
34 #endif
35 
36 /// Uncomment to use RakMemoryOverride for custom memory tracking
37 /// See RakMemoryOverride.h.
38 #ifndef _USE_RAK_MEMORY_OVERRIDE
39 #define _USE_RAK_MEMORY_OVERRIDE 0
40 #endif
41 
42 /// If defined, OpenSSL is enabled for the class TCPInterface
43 /// This is necessary to use the SendEmail class with Google POP servers
44 /// Note that OpenSSL carries its own license restrictions that you should be aware of. If you don't agree, don't enable this define
45 /// This also requires that you enable header search paths to DependentExtensions\openssl-0.9.8g
46 // #define OPEN_SSL_CLIENT_SUPPORT
47 #ifndef OPEN_SSL_CLIENT_SUPPORT
48 #define OPEN_SSL_CLIENT_SUPPORT 0
49 #endif
50 
51 /// Threshold at which to do a malloc / free rather than pushing data onto a fixed stack for the bitstream class
52 /// Arbitrary size, just picking something likely to be larger than most packets
53 #ifndef BITSTREAM_STACK_ALLOCATION_SIZE
54 #define BITSTREAM_STACK_ALLOCATION_SIZE 256
55 #endif
56 
57 // Redefine if you want to disable or change the target for debug RAKNET_DEBUG_PRINTF
58 #ifndef RAKNET_DEBUG_PRINTF
59 #define RAKNET_DEBUG_PRINTF printf
60 #endif
61 
62 // 16 * 4 * 8 = 512 bit. Used for InitializeSecurity()
63 #ifndef RAKNET_RSA_FACTOR_LIMBS
64 #define RAKNET_RSA_FACTOR_LIMBS 16
65 #endif
66 
67 // Enable to support peer to peer with NetworkIDs. Disable to save memory if doing client/server only
68 #ifndef NETWORK_ID_SUPPORTS_PEER_TO_PEER
69 #define NETWORK_ID_SUPPORTS_PEER_TO_PEER 1
70 #endif
71 
72 // O(1) instead of O(log2n) but takes more memory if less than 1/3 of the mappings are used.
73 // Only supported if NETWORK_ID_SUPPORTS_PEER_TO_PEER is commented out
74 // #define NETWORK_ID_USE_PTR_TABLE
75 
76 // Maximum number of local IP addresses supported
77 #ifndef MAXIMUM_NUMBER_OF_INTERNAL_IDS
78 #define MAXIMUM_NUMBER_OF_INTERNAL_IDS 10
79 #endif
80 
81 #ifndef RakAssert
82 
83 
84 
85 #if defined(_DEBUG)
86 #define RakAssert(x) assert(x);
87 #else
88 #define RakAssert(x)
89 #endif
90 
91 #endif
92 
93 /// This controls the amount of memory used per connection. If more than this many datagrams are sent without an ack, then the ack has no effect
94 #ifndef DATAGRAM_MESSAGE_ID_ARRAY_LENGTH
95 #define DATAGRAM_MESSAGE_ID_ARRAY_LENGTH 512
96 #endif
97 
98 /// This is the maximum number of reliable user messages that can be on the wire at a time
99 #ifndef RESEND_BUFFER_ARRAY_LENGTH
100 #define RESEND_BUFFER_ARRAY_LENGTH 512
101 #define RESEND_BUFFER_ARRAY_MASK 511
102 #endif
103 
104 /// Uncomment if you want to link in the DLMalloc library to use with RakMemoryOverride
105 // #define _LINK_DL_MALLOC
106 
107 #ifndef GET_TIME_SPIKE_LIMIT
108 /// Workaround for http://support.microsoft.com/kb/274323
109 /// If two calls between RakNet::GetTime() happen farther apart than this time in microseconds, this delta will be returned instead
110 /// Note: This will cause ID_TIMESTAMP to be temporarily inaccurate if you set a breakpoint that pauses the UpdateNetworkLoop() thread in RakPeer
111 /// Define in RakNetDefinesOverrides.h to enable (non-zero) or disable (0)
112 #define GET_TIME_SPIKE_LIMIT 0
113 #endif
114 
115 // Use sliding window congestion control instead of ping based congestion control
116 #ifndef USE_SLIDING_WINDOW_CONGESTION_CONTROL
117 #define USE_SLIDING_WINDOW_CONGESTION_CONTROL 1
118 #endif
119 
120 // When a large message is arriving, preallocate the memory for the entire block
121 // 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
122 #ifndef PREALLOCATE_LARGE_MESSAGES
123 #define PREALLOCATE_LARGE_MESSAGES 0
124 #endif
125 
126 #endif // __RAKNET_DEFINES_H
127