57 RequestedConnectionListMutex = 0,
58 OfflinePingResponseMutex = 1,
59 NumberOfRakpeerMutexes = 2,
66 ::ll::TypedStorage<8, 8, char*> IP;
67 ::ll::TypedStorage<4, 4, uint> timeout;
75 ::ll::TypedStorage<2, 2, ushort> pingTime;
76 ::ll::TypedStorage<8, 8, uint64> clockDifferential;
83 enum class ConnectMode :
int {
86 DisconnectAsapSilently = 2,
87 DisconnectOnNoAck = 3,
88 RequestedConnection = 4,
89 HandlingConnectionRequest = 5,
97 ::ll::TypedStorage<1, 1, bool> isActive;
98 ::ll::TypedStorage<8, 136, ::RakNet::SystemAddress> systemAddress;
99 ::ll::TypedStorage<8, 136, ::RakNet::SystemAddress> myExternalSystemAddress;
100 ::ll::TypedStorage<8, 2720, ::RakNet::SystemAddress[20]> theirInternalSystemAddress;
101 ::ll::TypedStorage<8, 6704, ::RakNet::ReliabilityLayer> reliabilityLayer;
102 ::ll::TypedStorage<1, 1, bool> weInitiatedTheConnection;
103 ::ll::TypedStorage<8, 80, ::RakNet::RakPeer::PingAndClockDifferential[5]> pingAndClockDifferential;
104 ::ll::TypedStorage<8, 8, uint64> pingAndClockDifferentialWriteIndex;
105 ::ll::TypedStorage<2, 2, ushort> lowestPing;
106 ::ll::TypedStorage<8, 8, uint64> nextPingTime;
107 ::ll::TypedStorage<8, 8, uint64> lastReliableSend;
108 ::ll::TypedStorage<8, 8, uint64> connectionTime;
109 ::ll::TypedStorage<8, 16, ::RakNet::RakNetGUID> guid;
110 ::ll::TypedStorage<4, 4, int> MTUSize;
111 ::ll::TypedStorage<8, 8, ::RakNet::RakNetSocket2*> rakNetSocket;
112 ::ll::TypedStorage<2, 2, ushort> remoteSystemIndex;
113 ::ll::TypedStorage<4, 4, ::RakNet::RakPeer::RemoteSystemStruct::ConnectMode> connectMode;
114 ::ll::TypedStorage<1, 1, bool> applicationHandshakeCompleted;
115 ::ll::TypedStorage<1, 1, bool> addressVerified;
123 ::ll::TypedStorage<4, 4, uint> numberOfBitsToSend;
124 ::ll::TypedStorage<4, 4, ::PacketPriority> priority;
125 ::ll::TypedStorage<4, 4, ::PacketReliability> reliability;
126 ::ll::TypedStorage<1, 1, char> orderingChannel;
127 ::ll::TypedStorage<8, 152, ::RakNet::AddressOrGUID> systemIdentifier;
128 ::ll::TypedStorage<1, 1, bool> broadcast;
129 ::ll::TypedStorage<4, 4, ::RakNet::RakPeer::RemoteSystemStruct::ConnectMode> connectionMode;
130 ::ll::TypedStorage<8, 8, uint64> networkID;
131 ::ll::TypedStorage<1, 1, bool> blockingCommand;
132 ::ll::TypedStorage<8, 8, char*> data;
133 ::ll::TypedStorage<1, 1, bool> haveRakNetCloseSocket;
134 ::ll::TypedStorage<4, 4, uint> connectionSocketIndex;
135 ::ll::TypedStorage<2, 2, ushort> remotePortRakNetWasStartedOn_PS3;
136 ::ll::TypedStorage<4, 4, uint> extraSocketOptions;
137 ::ll::TypedStorage<8, 8, ::RakNet::RakNetSocket2*> socket;
138 ::ll::TypedStorage<2, 2, ushort> port;
139 ::ll::TypedStorage<4, 4, uint> receipt;
144 ChangeSystemAddress = 3,
154 ::ll::TypedStorage<8, 136, ::RakNet::SystemAddress> systemAddress;
155 ::ll::TypedStorage<8, 8, uint64> nextRequestTime;
156 ::ll::TypedStorage<1, 1, uchar> requestsMade;
157 ::ll::TypedStorage<8, 8, char*> data;
158 ::ll::TypedStorage<2, 2, ushort> dataLength;
159 ::ll::TypedStorage<1, 256, char[256]> outgoingPassword;
160 ::ll::TypedStorage<1, 1, uchar> outgoingPasswordLength;
161 ::ll::TypedStorage<4, 4, uint> socketIndex;
162 ::ll::TypedStorage<4, 4, uint> extraData;
163 ::ll::TypedStorage<4, 4, uint> sendConnectionAttemptCount;
164 ::ll::TypedStorage<4, 4, uint> timeBetweenSendConnectionAttemptsMS;
165 ::ll::TypedStorage<4, 4, uint> timeoutTime;
166 ::ll::TypedStorage<4, 4, ::RakNet::PublicKeyMode> publicKeyMode;
167 ::ll::TypedStorage<8, 8, ::RakNet::RakNetSocket2*> socket;
178 ::ll::TypedStorage<8, 16, ::DataStructures::List<::RakNet::RakNetSocket2*>> sockets;
185 ::ll::TypedStorage<1, 1, bool volatile> endThreads;
186 ::ll::TypedStorage<1, 1, bool volatile> isMainLoopThreadActive;
187 ::ll::TypedStorage<1, 1, bool> occasionalPing;
188 ::ll::TypedStorage<4, 4, uint> maximumNumberOfPeers;
189 ::ll::TypedStorage<4, 4, uint> maximumIncomingConnections;
190 ::ll::TypedStorage<8, 288, ::RakNet::BitStream> offlinePingResponse;
191 ::ll::TypedStorage<1, 256, char[256]> incomingPassword;
192 ::ll::TypedStorage<1, 1, uchar> incomingPasswordLength;
193 ::ll::TypedStorage<8, 8, ::RakNet::RakPeer::RemoteSystemStruct*> remoteSystemList;
194 ::ll::TypedStorage<8, 8, ::RakNet::RakPeer::RemoteSystemStruct**> activeSystemList;
195 ::ll::TypedStorage<4, 4, uint> activeSystemListSize;
196 ::ll::TypedStorage<8, 8, ::RakNet::RemoteSystemIndex**> remoteSystemLookup;
197 ::ll::TypedStorage<8, 32, ::DataStructures::MemoryPool<::RakNet::RemoteSystemIndex>> remoteSystemIndexPool;
198 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::RakNet::ShadowBanList>> shadowBanList;
199 ::ll::TypedStorage<8, 80, ::RakNet::SimpleMutex[2]> rakPeerMutexes;
200 ::ll::TypedStorage<1, 1, bool> updateCycleIsRunning;
201 ::ll::TypedStorage<4, 4, uint> bytesSentPerSecond;
202 ::ll::TypedStorage<4, 4, uint> bytesReceivedPerSecond;
203 ::ll::TypedStorage<4, 4, uint> validationInteger;
204 ::ll::TypedStorage<8, 40, ::RakNet::SimpleMutex> incomingQueueMutex;
205 ::ll::TypedStorage<8, 40, ::RakNet::SimpleMutex> banListMutex;
206 ::ll::TypedStorage<8, 16, ::DataStructures::List<::RakNet::RakPeer::BanStruct*>> banList;
207 ::ll::TypedStorage<8, 16, ::DataStructures::List<::RakNet::PluginInterface2*>> pluginListTS;
208 ::ll::TypedStorage<8, 16, ::DataStructures::List<::RakNet::PluginInterface2*>> pluginListNTS;
209 ::ll::TypedStorage<8, 24, ::DataStructures::Queue<::RakNet::RakPeer::RequestedConnectionStruct*>>
210 requestedConnectionQueue;
211 ::ll::TypedStorage<8, 40, ::RakNet::SimpleMutex> requestedConnectionQueueMutex;
212 ::ll::TypedStorage<8, 136, ::DataStructures::ThreadsafeAllocatingQueue<::RakNet::RakPeer::BufferedCommandStruct>>
214 ::ll::TypedStorage<8, 24, ::DataStructures::Queue<::RakNet::RNS2RecvStruct*>> bufferedPacketsFreePool;
215 ::ll::TypedStorage<8, 40, ::RakNet::SimpleMutex> bufferedPacketsFreePoolMutex;
216 ::ll::TypedStorage<8, 24, ::DataStructures::Queue<::RakNet::RNS2RecvStruct*>> bufferedPacketsQueue;
217 ::ll::TypedStorage<8, 40, ::RakNet::SimpleMutex> bufferedPacketsQueueMutex;
218 ::ll::TypedStorage<8, 136, ::DataStructures::ThreadsafeAllocatingQueue<::RakNet::RakPeer::SocketQueryOutput>>
220 ::ll::TypedStorage<8, 40, ::RakNet::SimpleMutex> securityExceptionMutex;
221 ::ll::TypedStorage<4, 4, int> defaultMTUSize;
222 ::ll::TypedStorage<1, 1, bool> trackFrequencyTable;
223 ::ll::TypedStorage<8, 16, ::DataStructures::List<::std::shared_ptr<::RakNet::RakNetSocket2>>> socketList;
224 ::ll::TypedStorage<8, 8, ::RakNet::BitStream*> replyFromTargetBS;
225 ::ll::TypedStorage<8, 136, ::RakNet::SystemAddress> replyFromTargetPlayer;
226 ::ll::TypedStorage<1, 1, bool> replyFromTargetBroadcast;
227 ::ll::TypedStorage<4, 4, uint> defaultTimeoutTime;
228 ::ll::TypedStorage<8, 16, ::RakNet::RakNetGUID> myGuid;
229 ::ll::TypedStorage<4, 4, uint> maxOutgoingBPS;
230 ::ll::TypedStorage<1, 1, bool> allowConnectionResponseIPMigration;
231 ::ll::TypedStorage<8, 136, ::RakNet::SystemAddress> firstExternalID;
232 ::ll::TypedStorage<4, 4, int> splitMessageProgressInterval;
233 ::ll::TypedStorage<4, 4, uint> unreliableTimeout;
235 ::ll::TypedStorage<8, 16, ::DataStructures::List<::RakNet::RakString>> securityExceptionList;
236 ::ll::TypedStorage<8, 2856, ::RakNet::SystemAddress[21]> ipList;
237 ::ll::TypedStorage<8, 31592, ::RakNet::NetworkAdapter[11]> adapterList;
238 ::ll::TypedStorage<1, 1, bool> allowInternalRouting;
239 ::ll::TypedStorage<1, 1, bool> allowUnconnectedPings;
241 ::ll::TypedStorage<8, 8, void*> userUpdateThreadData;
242 ::ll::TypedStorage<8, 8, ::RakNet::SignaledEvent> quitAndDataEvents;
243 ::ll::TypedStorage<1, 1, bool> limitConnectionFrequencyFromTheSameIP;
244 ::ll::TypedStorage<8, 40, ::RakNet::SimpleMutex> packetAllocationPoolMutex;
245 ::ll::TypedStorage<8, 32, ::DataStructures::MemoryPool<::RakNet::Packet>> packetAllocationPool;
246 ::ll::TypedStorage<8, 40, ::RakNet::SimpleMutex> packetReturnMutex;
247 ::ll::TypedStorage<8, 24, ::DataStructures::Queue<::RakNet::Packet*>> packetReturnQueue;
248 ::ll::TypedStorage<8, 40, ::RakNet::SimpleMutex> sendReceiptSerialMutex;
249 ::ll::TypedStorage<4, 4, uint> sendReceiptSerial;
255 virtual ~RakPeer() =
default;
257 virtual void InitializeConfiguration(::std::unique_ptr<::RakNet::ShadowBanList> banList) ;
259 virtual ::RakNet::StartupResult Startup(
262 uint socketDescriptorCount,
267 InitializeSecurity(
char const* public_key,
char const* private_key,
bool bRequireClientKey) ;
269 virtual void DisableSecurity() ;
271 virtual void AddToSecurityExceptionList(
char const* ip) ;
273 virtual void RemoveFromSecurityExceptionList(
char const* ip) ;
275 virtual bool IsInSecurityExceptionList(
char const* ip) ;
277 virtual void SetMaximumIncomingConnections(ushort numberAllowed) ;
279 virtual uint GetMaximumIncomingConnections() const ;
281 virtual ushort NumberOfConnections() const ;
283 virtual
void SetIncomingPassword(
char const* passwordData,
int passwordDataLength) ;
285 virtual
void GetIncomingPassword(
char* passwordData,
int* passwordDataLength) ;
287 virtual ::RakNet::ConnectionAttemptResult Connect(
290 char const* passwordData,
291 int passwordDataLength,
293 uint connectionSocketIndex,
294 uint sendConnectionAttemptCount,
295 uint timeBetweenSendConnectionAttemptsMS,
299 virtual ::RakNet::ConnectionAttemptResult ConnectWithSocket(
302 char const* passwordData,
303 int passwordDataLength,
306 uint sendConnectionAttemptCount,
307 uint timeBetweenSendConnectionAttemptsMS,
311 virtual
void Shutdown(
313 uchar orderingChannel,
314 ::PacketPriority disconnectionNotificationPriority
317 virtual
bool SetApplicationHandshakeCompleted(::RakNet::
AddressOrGUID systemIdentifier) ;
319 virtual
bool IsActive() const ;
321 virtual
bool GetConnectionList(::RakNet::
SystemAddress* remoteSystems, ushort* numberOfSystems) const ;
323 virtual uint GetNextSendReceipt() ;
325 virtual uint IncrementNextSendReceipt() ;
330 ::PacketPriority priority,
331 ::PacketReliability reliability,
332 char orderingChannel,
335 uint forceReceiptNumber
340 ::PacketPriority priority,
341 ::PacketReliability reliability,
342 char orderingChannel,
345 uint forceReceiptNumber
348 virtual
void SendLoopback(
char const* data,
int const length) ;
350 virtual uint SendList(
353 int const numParameters,
354 ::PacketPriority priority,
355 ::PacketReliability reliability,
356 char orderingChannel,
359 uint forceReceiptNumber
362 virtual ::RakNet::
Packet* Receive() ;
364 virtual
void DeallocatePacket(::RakNet::
Packet* packet) ;
366 virtual uint GetMaximumNumberOfPeers() const ;
368 virtual
void CloseConnection(
370 bool sendDisconnectionNotification,
371 uchar orderingChannel,
372 ::PacketPriority disconnectionNotificationPriority
375 virtual ::RakNet::ConnectionState GetConnectionState(::RakNet::
AddressOrGUID const systemIdentifier) ;
377 virtual
int GetIndexFromSystemAddress(::RakNet::
SystemAddress const systemAddress) const ;
379 virtual ::RakNet::
RakNetGUID GetGUIDFromIndex(uint index) ;
381 virtual
void GetSystemList(
383 ::DataStructures::List<::RakNet::
RakNetGUID>& guids
386 virtual
void AddToBanList(
char const* IP, uint milliseconds) ;
388 virtual
void RemoveFromBanList(
char const* IP) ;
390 virtual
void ClearBanList() ;
392 virtual
bool IsBanned(
char const* IP) ;
399 bool onlyReplyOnAcceptingConnections,
400 uint connectionSocketIndex
403 virtual
int GetAveragePing(::RakNet::
AddressOrGUID const systemIdentifier) ;
405 virtual
int GetLastPing(::RakNet::
AddressOrGUID const systemIdentifier) const ;
407 virtual
int GetLowestPing(::RakNet::
AddressOrGUID const systemIdentifier) const ;
409 virtual
void SetOccasionalPing(
bool doPing) ;
411 virtual uint64 GetClockDifferential(::RakNet::
AddressOrGUID const systemIdentifier) ;
413 virtual
void SetOfflinePingResponse(
char const* data, uint const length) ;
420 virtual ::RakNet::
RakNetGUID const GetMyGUID() const ;
422 virtual
void resetMyGUID() ;
424 virtual ::RakNet::
SystemAddress GetMyBoundAddress(
int const socketIndex) ;
426 virtual
void SetAllowUnconnectedPings(
bool unconnectedPings) ;
428 virtual
bool GetAllowUnconnectedPings() const ;
435 virtual
void SetTimeoutTime(uint timeMS, ::RakNet::
SystemAddress const target) ;
437 virtual uint GetTimeoutTime(::RakNet::
SystemAddress const target) ;
439 virtual
int GetMTUSize(::RakNet::
SystemAddress const target) const ;
441 virtual uint GetNumberOfAdapters() ;
445 virtual uint GetNumberOfAddresses() ;
447 virtual
char const* GetLocalIP(uint index) ;
449 virtual
bool IsLocalIP(
char const* ip) ;
451 virtual
void AllowConnectionResponseIPMigration(
bool allow) ;
453 virtual
bool AdvertiseSystem(
458 uint connectionSocketIndex
461 virtual
void SetSplitMessageProgressInterval(
int interval) ;
463 virtual
int GetSplitMessageProgressInterval() const ;
465 virtual
void SetUnreliableTimeout(uint timeoutMS) ;
467 virtual
void SendTTL(
char const* host, ushort remotePort,
int ttl, uint connectionSocketIndex) ;
473 virtual
void PushBackPacket(::RakNet::
Packet* packet,
bool pushAtHead) ;
478 virtual ::RakNet::
Packet* AllocatePacket(uint dataSize) ;
482 virtual
void GetSockets(::DataStructures::List<::RakNet::
RakNetSocket2*>& sockets) ;
484 virtual
void ReleaseSockets(::DataStructures::List<::RakNet::
RakNetSocket2*>& sockets) ;
486 virtual
void WriteOutOfBandHeader(::RakNet::
BitStream* bitStream) ;
488 virtual
void SetUserUpdateThread(
490 void* _userUpdateThreadData
494 SetIncomingDatagramEventHandler(
bool (*_incomingDatagramEventHandler)(::RakNet::
RNS2RecvStruct*)) ;
496 virtual
void ApplyNetworkSimulator(
float packetloss, ushort minExtraPing, ushort extraPingVariance) ;
498 virtual
void SetPerConnectionOutgoingBandwidthLimit(uint maxBitsPerSecond) ;
500 virtual
bool IsNetworkSimulatorActive() ;
505 virtual
bool GetStatistics(uint const index, ::RakNet::
RakNetStatistics* rns) ;
507 virtual
void GetStatisticsList(
509 ::DataStructures::List<::RakNet::
RakNetGUID>& guids,
513 virtual uint GetReceiveBufferSize() ;
515 virtual
bool RunUpdateCycle(::RakNet::
BitStream& updateBitStream) ;
517 virtual
bool SendOutOfBand(
522 uint connectionSocketIndex
525 virtual
void DeallocRNS2RecvStruct(::RakNet::
RNS2RecvStruct* s,
char const* file, uint line) ;
527 virtual ::RakNet::
RNS2RecvStruct* AllocRNS2RecvStruct(
char const* file, uint line) ;
545 bool* thisIPConnectedRecently,
558 bool sendDisconnectionNotification,
559 bool performImmediate,
560 uchar orderingChannel,
561 ::PacketPriority disconnectionNotificationPriority
569 GetIndexFromSystemAddress(::RakNet::
SystemAddress const systemAddress,
bool calledFromNetworkThread) const;
573 bool calledFromNetworkThread,
583 bool performImmediate,
584 uchar orderingChannel,
585 ::PacketPriority disconnectionNotificationPriority
606 uint numberOfBitsToSend,
607 ::PacketPriority priority,
608 ::PacketReliability reliability,
609 char orderingChannel,
618 uint numberOfBitsToSend,
619 ::PacketPriority priority,
620 ::PacketReliability reliability,
621 char orderingChannel,
624 bool useCallerDataAllocation,
651 uint socketDescriptorCount,
678 char const* passwordData,
679 int passwordDataLength,
681 uint connectionSocketIndex,
682 uint sendConnectionAttemptCount,
683 uint timeBetweenSendConnectionAttemptsMS,
690 char const* passwordData,
691 int passwordDataLength,
694 uint sendConnectionAttemptCount,
695 uint timeBetweenSendConnectionAttemptsMS,
699 MCAPI
void $Shutdown(uint blockDuration, uchar orderingChannel, ::PacketPriority disconnectionNotificationPriority);
714 ::PacketPriority priority,
715 ::PacketReliability reliability,
716 char orderingChannel,
719 uint forceReceiptNumber
724 ::PacketPriority priority,
725 ::PacketReliability reliability,
726 char orderingChannel,
729 uint forceReceiptNumber
737 int const numParameters,
738 ::PacketPriority priority,
739 ::PacketReliability reliability,
740 char orderingChannel,
743 uint forceReceiptNumber
754 bool sendDisconnectionNotification,
755 uchar orderingChannel,
756 ::PacketPriority disconnectionNotificationPriority
767 ::DataStructures::List<::RakNet::
RakNetGUID>& guids
781 $Ping(
char const* host, ushort remotePort,
bool onlyReplyOnAcceptingConnections, uint connectionSocketIndex);
793 MCAPI
void $SetOfflinePingResponse(
char const* data, uint const length);
832 $AdvertiseSystem(
char const* host, ushort remotePort,
char const* data,
int dataLength, uint connectionSocketIndex);
840 MCNAPI
void $SendTTL(
char const* host, ushort remotePort,
int ttl, uint connectionSocketIndex);
878 ::DataStructures::List<::RakNet::
RakNetGUID>& guids,
887 $SendOutOfBand(
char const* host, ushort remotePort,
char const* data, uint dataLength, uint connectionSocketIndex);