SLikeNet 0.1.3

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
SLNet::RakPeer Class Reference

Main interface for network communications. More...

`#include <slikenet/peer.h>`

Inheritance diagram for SLNet::RakPeer:

## Classes

struct | BanStruct
struct | BufferedCommandStruct
struct | PingAndClockDifferential
struct | RemoteSystemStruct
struct | RequestedConnectionStruct
struct | SocketQueryOutput

## Public Member Functions

| RakPeer ()
| Constructor.
virtual | ~RakPeer ()
| Destructor.
StartupResult | Startup (unsigned int maxConnections, SocketDescriptor *socketDescriptors, unsigned socketDescriptorCount, int threadPriority=-99999)
| Starts the network threads and opens the listen port.
bool | InitializeSecurity (const char *publicKey, const char *privateKey, bool bRequireClientKey=false)
void | DisableSecurity (void)
void | AddToSecurityExceptionList (const char *ip)
| This is useful if you have a fixed-address internal server behind a LAN.
void | RemoveFromSecurityExceptionList (const char *ip)
| Remove a specific connection previously added via AddToSecurityExceptionList.
bool | IsInSecurityExceptionList (const char *ip)
| Checks to see if a given IP is in the security exception list.
void | SetMaximumIncomingConnections (unsigned short numberAllowed)
| Sets the maximum number of incoming connections allowed.
unsigned int | GetMaximumIncomingConnections (void) const
| Returns the value passed to SetMaximumIncomingConnections().
unsigned short | NumberOfConnections (void) const
| Returns how many open connections exist at this time.
void | SetIncomingPassword (const char *passwordData, int passwordDataLength)
| Sets the password for the incoming connections.
void | GetIncomingPassword (char *passwordData, int *passwordDataLength)
| Gets the password passed to SetIncomingPassword.
ConnectionAttemptResult | Connect (const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, PublicKey *publicKey=0, unsigned connectionSocketIndex=0, unsigned sendConnectionAttemptCount=6, unsigned timeBetweenSendConnectionAttemptsMS=1000, SLNet::TimeMS timeoutTime=0)
| Connect to the specified host (ip or domain name) and server port.
virtual ConnectionAttemptResult | ConnectWithSocket (const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, RakNetSocket2 *socket, PublicKey *publicKey=0, unsigned sendConnectionAttemptCount=6, unsigned timeBetweenSendConnectionAttemptsMS=1000, SLNet::TimeMS timeoutTime=0)
| Connect to the specified host (ip or domain name) and server port.
void | Shutdown (unsigned int blockDuration, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY)
| Stops the network threads and closes all connections.
bool | IsActive (void) const
| Returns true if the network thread is running.
bool | GetConnectionList (SystemAddress *remoteSystems, unsigned short *numberOfSystems) const
| Fills the array remoteSystems with the SystemAddress of all the systems we are connected to.
virtual uint32_t | GetNextSendReceipt (void)
virtual uint32_t | IncrementNextSendReceipt (void)
uint32_t | Send (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)
| Sends a block of data to the specified system that you are connected to.
void | SendLoopback (const char *data, const int length)
| "Send" to yourself rather than a remote system.
uint32_t | Send (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)
| Sends a block of data to the specified system that you are connected to.
uint32_t | SendList (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)
| Sends multiple blocks of data, concatenating them automatically.
Packet * | Receive (void)
| Gets a message from the incoming message queue.
void | DeallocatePacket (Packet *packet)
| Call this to deallocate a message returned by Receive() when you are done handling it.
unsigned int | GetMaximumNumberOfPeers (void) const
| Return the total number of connections we are allowed.
void | CloseConnection (const AddressOrGUID target, bool sendDisconnectionNotification, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY)
| Close the connection to another host (if we initiated the connection it will disconnect, if they did it will kick them out).
void | CancelConnectionAttempt (const SystemAddress target)
| Cancel a pending connection attempt.
ConnectionState | GetConnectionState (const AddressOrGUID systemIdentifier)
int | GetIndexFromSystemAddress (const SystemAddress systemAddress) const
| Given systemAddress, returns its index into remoteSystemList.
SystemAddress | GetSystemAddressFromIndex (unsigned int index)
| Given index into remoteSystemList, will return a SystemAddress. This function is only useful for looping through all systems.
RakNetGUID | GetGUIDFromIndex (unsigned int index)
| Same as GetSystemAddressFromIndex but returns RakNetGUID.
void | GetSystemList (DataStructures::List< SystemAddress > &addresses, DataStructures::List< RakNetGUID > &guids) const
| Same as calling GetSystemAddressFromIndex and GetGUIDFromIndex for all systems, but more efficient Indices match each other, so addresses[0] and guids[0] refer to the same system.
void | AddToBanList (const char *IP, SLNet::TimeMS milliseconds=0)
| Bans an IP from connecting.
void | RemoveFromBanList (const char *IP)
| Allows a previously banned IP to connect. param[in] Dotted IP address. You can use * as a wildcard. An IP such as 128.0.0.* will ban all IP addresses starting with 128.0.0.
void | ClearBanList (void)
| Allows all previously banned IPs to connect.
bool | IsBanned (const char *IP)
| Returns true or false indicating if a particular IP is banned.
void | SetLimitIPConnectionFrequency (bool b)
| Enable or disable allowing frequent connections from the same IP adderss.
void | Ping (const SystemAddress target)
bool | Ping (const char *host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections, unsigned connectionSocketIndex=0)
| Send a ping to the specified unconnected system.
int | GetAveragePing (const AddressOrGUID systemIdentifier)
| Returns the average of all ping times read for the specific system or -1 if none read yet.
int | GetLastPing (const AddressOrGUID systemIdentifier) const
| Returns the last ping time read for the specific system or -1 if none read yet.
int | GetLowestPing (const AddressOrGUID systemIdentifier) const
| Returns the lowest ping time read or -1 if none read yet.
void | SetOccasionalPing (bool doPing)
SLNet::Time | GetClockDifferential (const AddressOrGUID systemIdentifier)
void | SetOfflinePingResponse (const char *data, const unsigned int length)
| Sets the data to send along with a LAN server discovery or offline ping reply.
void | GetOfflinePingResponse (char **data, unsigned int *length)
| Returns pointers to a copy of the data passed to SetOfflinePingResponse.
SystemAddress | GetInternalID (const SystemAddress systemAddress=UNASSIGNED_SYSTEM_ADDRESS, const int index=0) const
| Returns the unique address identifier that represents you or another system on the the network.
void | SetInternalID (SystemAddress systemAddress, int index=0)
| Sets your internal IP address, for platforms that do not support reading it, or to override a value.
SystemAddress | GetExternalID (const SystemAddress target) const
| Returns the unique address identifier that represents the target on the the network and is based on the target's external IP / port.
const RakNetGUID | GetMyGUID (void) const
| Return my own GUID.
SystemAddress | GetMyBoundAddress (const int socketIndex=0)
| Return the address bound to a socket at the specified index.
const RakNetGUID & | GetGuidFromSystemAddress (const SystemAddress input) const
| Given a connected system address, this method gives the unique GUID representing that instance of RakPeer. This will be the same on all systems connected to that instance of RakPeer, even if the external system addresses are different. Complexity is O(log2(n)). If input is UNASSIGNED_SYSTEM_ADDRESS, will return your own GUID.
SystemAddress | GetSystemAddressFromGuid (const RakNetGUID input) const
| Gives the system address of a connected system, given its GUID. The GUID will be the same on all systems connected to that instance of RakPeer, even if the external system addresses are different. Currently O(log(n)), but this may be improved in the future If input is UNASSIGNED_RAKNET_GUID, UNASSIGNED_SYSTEM_ADDRESS is returned.
bool | GetClientPublicKeyFromSystemAddress (const SystemAddress input, char *client_public_key) const
void | SetTimeoutTime (SLNet::TimeMS timeMS, const SystemAddress target)
| Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable message.
SLNet::TimeMS | GetTimeoutTime (const SystemAddress target)
| Returns the Timeout time for the given system.
int | GetMTUSize (const SystemAddress target) const
| Returns the current MTU size.
unsigned | GetNumberOfAddresses (void)
| Returns the number of IP addresses this system has internally.
const char * | GetLocalIP (unsigned int index)
bool | IsLocalIP (const char *ip)
void | AllowConnectionResponseIPMigration (bool allow)
| Allow or disallow connection responses from any IP.
bool | AdvertiseSystem (const char *host, unsigned short remotePort, const char *data, int dataLength, unsigned connectionSocketIndex=0)
| Sends a one byte message ID_ADVERTISE_SYSTEM to the remote unconnected system. This will send our external IP outside the LAN along with some user data to the remote system.
void | SetSplitMessageProgressInterval (int interval)
| Controls how often to return ID_DOWNLOAD_PROGRESS for large message downloads.
int | GetSplitMessageProgressInterval (void) const
| Returns what was passed to SetSplitMessageProgressInterval().
void | SetUnreliableTimeout (SLNet::TimeMS timeoutMS)
| Set how long to wait before giving up on sending an unreliable message. Useful if the network is clogged up. Set to 0 or less to never timeout. Defaults to 0.
void | SendTTL (const char *host, unsigned short remotePort, int ttl, unsigned connectionSocketIndex=0)
| Send a message to a host, with the IP socket option TTL set to 3.
void | AttachPlugin (PluginInterface2 *plugin)
| Attaches a Plugin interface to an instance of the base class (RakPeer or PacketizedTCP) to run code automatically on message receipt in the Receive call. If the plugin returns false from PluginInterface::UsesReliabilityLayer(), which is the case for all plugins except PacketLogger, you can call AttachPlugin() and DetachPlugin() for this plugin while RakPeer is active.
void | DetachPlugin (PluginInterface2 *messageHandler)
| Detaches a Plugin interface from the instance of the base class (RakPeer or PacketizedTCP) it is attached to.
void | PushBackPacket (Packet *packet, bool pushAtHead)
| Puts a message back in the receive queue in case you don't want to deal with it immediately.
void | ChangeSystemAddress (RakNetGUID guid, const SystemAddress &systemAddress)
Packet * | AllocatePacket (unsigned dataSize)
| Returns a packet for you to write to if you want to create a Packet for some reason. You can add it to the receive buffer with PushBackPacket.
virtual RakNetSocket2 * | GetSocket (const SystemAddress target)
| Get the socket used with a particular active connection. The smart pointer reference counts the RakNetSocket object, so the socket will remain active as long as the smart pointer does, even if RakNet were to shutdown or close the connection.
virtual void | GetSockets (DataStructures::List< RakNetSocket2 * > &sockets)
| Gets all sockets in use.
virtual void | ReleaseSockets (DataStructures::List< RakNetSocket2 * > &sockets)
virtual void | WriteOutOfBandHeader (SLNet::BitStream *bitStream)
virtual void | SetUserUpdateThread (void(*_userUpdateThreadPtr)(RakPeerInterface *, void *), void *_userUpdateThreadData)
virtual void | SetIncomingDatagramEventHandler (bool(*_incomingDatagramEventHandler)(RNS2RecvStruct *))
virtual void | ApplyNetworkSimulator (float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance)
virtual void | SetPerConnectionOutgoingBandwidthLimit (unsigned maxBitsPerSecond)
virtual bool | IsNetworkSimulatorActive (void)
RakNetStatistics * | GetStatistics (const SystemAddress systemAddress, RakNetStatistics *rns=0)
| Returns a structure containing a large set of network statistics for the specified system. You can map this data to a string using the C style StatisticsToString() function.
bool | GetStatistics (const unsigned int index, RakNetStatistics *rns)
| Returns the network statistics of the system at the given index in the remoteSystemList.
virtual void | GetStatisticsList (DataStructures::List< SystemAddress > &addresses, DataStructures::List< RakNetGUID > &guids, DataStructures::List< RakNetStatistics > &statistics)
| Returns the list of systems, and statistics for each of those systems Each system has one entry in each of the lists, in the same order.
virtual unsigned int | GetReceiveBufferSize (void)
| how many messages are waiting when you call Receive()
bool | RunUpdateCycle (BitStream &updateBitStream)
bool | SendOutOfBand (const char *host, unsigned short remotePort, const char *data, BitSize_t dataLength, unsigned connectionSocketIndex=0)
Public Member Functions inherited from SLNet::RakPeerInterface
virtual | ~RakPeerInterface ()
| Destructor.
Public Member Functions inherited from SLNet::RNS2EventHandler
| RNS2EventHandler ()
virtual | ~RNS2EventHandler ()

## Protected Types

enum | { requestedConnectionList_Mutex, offlinePingResponse_Mutex, NUMBER_OF_RAKPEER_MUTEXES }

## Protected Member Functions

friend | RAK_THREAD_DECLARATION (UpdateNetworkLoop)
friend | RAK_THREAD_DECLARATION (UDTConnect)
int | GetIndexFromSystemAddress (const SystemAddress systemAddress, bool calledFromNetworkThread) const
int | GetIndexFromGuid (const RakNetGUID guid)
ConnectionAttemptResult | SendConnectionRequest (const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, PublicKey *publicKey, unsigned connectionSocketIndex, unsigned int extraData, unsigned sendConnectionAttemptCount, unsigned timeBetweenSendConnectionAttemptsMS, SLNet::TimeMS timeoutTime, RakNetSocket2 *socket)
ConnectionAttemptResult | SendConnectionRequest (const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, PublicKey *publicKey, unsigned connectionSocketIndex, unsigned int extraData, unsigned sendConnectionAttemptCount, unsigned timeBetweenSendConnectionAttemptsMS, SLNet::TimeMS timeoutTime)
RemoteSystemStruct * | GetRemoteSystemFromSystemAddress (const SystemAddress systemAddress, bool calledFromNetworkThread, bool onlyActive) const
RakPeer::RemoteSystemStruct * | GetRemoteSystem (const AddressOrGUID systemIdentifier, bool calledFromNetworkThread, bool onlyActive) const
void | ValidateRemoteSystemLookup (void) const
RemoteSystemStruct * | GetRemoteSystemFromGUID (const RakNetGUID guid, bool onlyActive) const
void | ParseConnectionRequestPacket (RakPeer::RemoteSystemStruct *remoteSystem, const SystemAddress &systemAddress, const char *data, int byteSize)
| Parse out a connection request packet.
void | OnConnectionRequest (RakPeer::RemoteSystemStruct *remoteSystem, SLNet::Time incomingTimestamp)
void | NotifyAndFlagForShutdown (const SystemAddress systemAddress, bool performImmediate, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority)
| Send a reliable disconnect packet to this player and disconnect them when it is delivered.
unsigned int | GetNumberOfRemoteInitiatedConnections (void) const
| Returns how many remote systems initiated a connection to us.
RemoteSystemStruct * | AssignSystemAddressToRemoteSystemList (const SystemAddress systemAddress, RemoteSystemStruct::ConnectMode connectionMode, RakNetSocket2 *incomingRakNetSocket, bool *thisIPConnectedRecently, SystemAddress bindingAddress, int incomingMTU, RakNetGUID guid, bool useSecurity)
| Get a free remote system from the list and assign our systemAddress to it.
void | ShiftIncomingTimestamp (unsigned char *data, const SystemAddress &systemAddress) const
| Adjust the timestamp of the incoming packet to be relative to this system.
SLNet::Time | GetBestClockDifferential (const SystemAddress systemAddress) const
bool | IsLoopbackAddress (const AddressOrGUID &systemIdentifier, bool matchPort) const
SystemAddress | GetLoopbackAddress (void) const
unsigned int | RemoteSystemLookupHashIndex (const SystemAddress &sa) const
void | ReferenceRemoteSystem (const SystemAddress &sa, unsigned int remoteSystemListIndex)
void | DereferenceRemoteSystem (const SystemAddress &sa)
RemoteSystemStruct * | GetRemoteSystem (const SystemAddress &sa) const
unsigned int | GetRemoteSystemIndex (const SystemAddress &sa) const
void | ClearRemoteSystemLookup (void)
void | AddToActiveSystemList (unsigned int remoteSystemListIndex)
void | RemoveFromActiveSystemList (const SystemAddress &sa)
virtual void | DeallocRNS2RecvStruct (RNS2RecvStruct *s, const char *file, unsigned int line)
virtual RNS2RecvStruct * | AllocRNS2RecvStruct (const char *file, unsigned int line)
void | SetupBufferedPackets (void)
void | PushBufferedPacket (RNS2RecvStruct *p)
RNS2RecvStruct * | PopBufferedPacket (void)
bool | AllowIncomingConnections (void) const
void | PingInternal (const SystemAddress target, bool performImmediate, PacketReliability reliability)
void | CloseConnectionInternal (const AddressOrGUID &systemIdentifier, bool sendDisconnectionNotification, bool performImmediate, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority)
void | SendBuffered (const char *data, BitSize_t numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, RemoteSystemStruct::ConnectMode connectionMode, uint32_t receipt)
void | SendBufferedList (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, RemoteSystemStruct::ConnectMode connectionMode, uint32_t receipt)
bool | SendImmediate (char *data, BitSize_t numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, bool useCallerDataAllocation, SLNet::TimeUS currentTime, uint32_t receipt)
void | ClearBufferedCommands (void)
void | ClearBufferedPackets (void)
void | ClearSocketQueryOutput (void)
void | ClearRequestedConnectionList (void)
void | AddPacketToProducer (SLNet::Packet *p)
unsigned int | GenerateSeedFromGuid (void)
SLNet::Time | GetClockDifferentialInt (RemoteSystemStruct *remoteSystem) const
void | DerefAllSockets (void)
unsigned int | GetRakNetSocketFromUserConnectionSocketIndex (unsigned int userIndex) const
void | GenerateGUID (void)
unsigned int | GetSystemIndexFromGuid (const RakNetGUID input) const
Packet * | AllocPacket (unsigned dataSize, const char *file, unsigned int line)
Packet * | AllocPacket (unsigned dataSize, unsigned char *data, const char *file, unsigned int line)
void | ResetSendReceipt (void)
void | OnConnectedPong (SLNet::Time sendPingTime, SLNet::Time sendPongTime, RemoteSystemStruct *remoteSystem)
void | CallPluginCallbacks (DataStructures::List< PluginInterface2 * > &pluginList, Packet *packet)
virtual void | OnRNS2Recv (RNS2RecvStruct *recvStruct)
void | FillIPList (void)

## Protected Attributes

volatile bool | endThreads
| Set this to true to terminate the Peer thread execution.
volatile bool | isMainLoopThreadActive
| true if the peer thread is active.
bool | occasionalPing
*unsigned int | maximumNumberOfPeers
| Store the maximum number of peers allowed to connect.
unsigned int | maximumIncomingConnections
| Store the maximum number of peers able to connect, including reserved connection slots for pings, etc.
SLNet::BitStream | offlinePingResponse
char | incomingPassword [256]
| Local Player ID.
unsigned char | incomingPasswordLength
RemoteSystemStruct * | remoteSystemList
RemoteSystemStruct ** | activeSystemList
unsigned int | activeSystemListSize
RemoteSystemIndex ** | remoteSystemLookup
DataStructures::MemoryPool < RemoteSystemIndex > | remoteSystemIndexPool
SimpleMutex | rakPeerMutexes [NUMBER_OF_RAKPEER_MUTEXES]
bool | updateCycleIsRunning
| RunUpdateCycle is not thread safe but we don't need to mutex calls. Just skip calls if it is running already.
unsigned int | bytesSentPerSecond
| The list of people we have tried to connect to recently.
unsigned int | bytesReceivedPerSecond
unsigned int | validationInteger
SimpleMutex | incomingQueueMutex
SimpleMutex | banListMutex
DataStructures::List< BanStruct * > | banList
DataStructures::List < PluginInterface2 * > | pluginListTS
DataStructures::List < PluginInterface2 * > | pluginListNTS
DataStructures::Queue < RequestedConnectionStruct * > | requestedConnectionQueue
SimpleMutex | requestedConnectionQueueMutex
DataStructures::ThreadsafeAllocatingQueue < BufferedCommandStruct > | bufferedCommands
DataStructures::Queue < RNS2RecvStruct * > | bufferedPacketsFreePool
SLNet::SimpleMutex | bufferedPacketsFreePoolMutex
DataStructures::Queue < RNS2RecvStruct * > | bufferedPacketsQueue
SLNet::SimpleMutex | bufferedPacketsQueueMutex
DataStructures::ThreadsafeAllocatingQueue < SocketQueryOutput > | socketQueryOutput
SimpleMutex | securityExceptionMutex
int | defaultMTUSize
bool | trackFrequencyTable
DataStructures::List < RakNetSocket2 * > | socketList
SLNet::BitStream * | replyFromTargetBS
SystemAddress | replyFromTargetPlayer
bool | replyFromTargetBroadcast
SLNet::TimeMS | defaultTimeoutTime
RakNetGUID | myGuid
unsigned | maxOutgoingBPS
bool | allowConnectionResponseIPMigration
| How long it has been since things were updated by a call to receiveUpdate thread uses this to determine how long to sleep for.
SystemAddress | firstExternalID
int | splitMessageProgressInterval
SLNet::TimeMS | unreliableTimeout
bool(* | incomingDatagramEventHandler )(RNS2RecvStruct *)
DataStructures::List < SLNet::RakString > | securityExceptionList
SystemAddress | ipList [MAXIMUM_NUMBER_OF_INTERNAL_IDS]
bool | allowInternalRouting
void(* | userUpdateThreadPtr )(RakPeerInterface *, void *)
void * | userUpdateThreadData
SignaledEvent | quitAndDataEvents
bool | limitConnectionFrequencyFromTheSameIP
SimpleMutex | packetAllocationPoolMutex
DataStructures::MemoryPool < Packet > | packetAllocationPool
SimpleMutex | packetReturnMutex
DataStructures::Queue< Packet * > | packetReturnQueue
SimpleMutex | sendReceiptSerialMutex
uint32_t | sendReceiptSerial

## Friends

bool | ProcessOfflineNetworkPacket (SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2 *rakNetSocket, bool *isOfflineMessage, SLNet::TimeUS timeRead)
void | ProcessNetworkPacket (const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, SLNet::TimeUS timeRead, BitStream &updateBitStream)
void | ProcessNetworkPacket (const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2 *rakNetSocket, SLNet::TimeUS timeRead, BitStream &updateBitStream)

## Additional Inherited Members

Static Public Member Functions inherited from SLNet::RakPeerInterface
static uint64_t | Get64BitUniqueRandomNumber (void)
| Get a random number (to generate a GUID)

## Detailed Description

Main interface for network communications.

It implements most of RakNet's functionality and is the primary interface for RakNet.

Inherits RakPeerInterface.

See the individual functions for what the class can do.

Definition at line 62 of file peer.h.

## Class Documentation

struct SLNet::RakPeer::BanStruct

Definition at line 830 of file peer.h.

Class Members
char * | IP |
TimeMS | timeout |

struct SLNet::RakPeer::PingAndClockDifferential

Definition at line 660 of file peer.h.

Class Members
Time | clockDifferential |
unsigned short | pingTime |

## Member Enumeration Documentation

anonymous enum

protected

Enumerator:

  requestedConnectionList_Mutex |
  offlinePingResponse_Mutex |
  NUMBER_OF_RAKPEER_MUTEXES |

Definition at line 806 of file peer.h.

## Constructor & Destructor Documentation

RakPeer::RakPeer | ( |  | ) |

Constructor.

Definition at line 192 of file RakPeer.cpp.

References WSAStartupSingleton::AddRef(), SLNet::StringTable::AddReference(), SLNet::StringCompressor::AddReference(), CAT_AUDIT_PRINTF, MAXIMUM_NUMBER_OF_INTERNAL_IDS, mtuSizes, NUM_MTU_SIZES, SLNet::UNASSIGNED_RAKNET_GUID(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

RakPeer::~RakPeer | ( |  | ) |

virtual

Destructor.

Definition at line 319 of file RakPeer.cpp.

References _FILE_AND_LINE_, CAT_AUDIT_PRINTF, ClearBanList(), SLNet::SignaledEvent::CloseEvent(), WSAStartupSingleton::Deref(), SLNet::OP_DELETE(), quitAndDataEvents, SLNet::StringTable::RemoveReference(), SLNet::StringCompressor::RemoveReference(), and Shutdown().

## Member Function Documentation

void RakPeer::AddPacketToProducer | ( | SLNet::Packet * | p | ) |

inlineprotected

Definition at line 4437 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::SimpleMutex::Lock(), packetReturnMutex, packetReturnQueue, DataStructures::Queue< queue_type >::Push(), and SLNet::SimpleMutex::Unlock().

Referenced by CloseConnection(), SLNet::ProcessOfflineNetworkPacket(), and RunUpdateCycle().

void RakPeer::AddToActiveSystemList | ( | unsigned int | remoteSystemListIndex | ) |

protected

Definition at line 3924 of file RakPeer.cpp.

References activeSystemList, activeSystemListSize, and remoteSystemList.

Referenced by AssignSystemAddressToRemoteSystemList().

void RakPeer::AddToBanList | ( | const char * | IP,
|  | SLNet::TimeMS | milliseconds = `0`
| ) |  |

virtual

Bans an IP from connecting.

Banned IPs persist between connections but are not saved on shutdown nor loaded on startup.

Parameters

  [in] | IP | Dotted IP address. You can use * for a wildcard address, such as 128.0.0. * will ban all IP addresses starting with 128.0.0.
  [in] | milliseconds | Gives time in milli seconds for a temporary ban of the IP address. Use 0 for a permanent ban.

Implements SLNet::RakPeerInterface.

Definition at line 1853 of file RakPeer.cpp.

References _FILE_AND_LINE_, banList, banListMutex, SLNet::GetTimeMS(), DataStructures::List< list_type >::Insert(), SLNet::RakPeer::BanStruct::IP, SLNet::SimpleMutex::Lock(), rakMalloc_Ex, return, DataStructures::List< list_type >::Size(), SLNet::RakPeer::BanStruct::timeout, and SLNet::SimpleMutex::Unlock().

Referenced by RunUpdateCycle().

void RakPeer::AddToSecurityExceptionList | ( | const char * | ip | ) |

virtual

This is useful if you have a fixed-address internal server behind a LAN.

Secure connections are determined by the recipient of an incoming connection. This has no effect if called on the system attempting to connect.

Note
  If secure connections are on, do not use secure connections for a specific IP address.

Parameters

  [in] | ip | IP address to add. * wildcards are supported.

Implements SLNet::RakPeerInterface.

Definition at line 837 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::List< list_type >::Insert(), SLNet::SimpleMutex::Lock(), securityExceptionList, securityExceptionMutex, and SLNet::SimpleMutex::Unlock().

bool RakPeer::AdvertiseSystem | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | data,
|  | int | dataLength,
|  | unsigned | connectionSocketIndex = `0`
| ) |  |

virtual

Sends a one byte message ID_ADVERTISE_SYSTEM to the remote unconnected system. This will send our external IP outside the LAN along with some user data to the remote system.

Precondition
  The sender and recipient must already be started via a successful call to Initialize

Parameters

  [in] | host | Either a dotted IP address or a domain name
  [in] | remotePort | Which port to connect to on the remote machine.
  [in] | data | Optional data to append to the packet.
  [in] | dataLength | Length of data in bytes. Use 0 if no data.
  [in] | connectionSocketIndex | Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to send on.

Returns
  False if IsActive()==false or the host is unresolvable. True otherwise.

Implements SLNet::RakPeerInterface.

Definition at line 2667 of file RakPeer.cpp.

References SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfBytesUsed(), ID_ADVERTISE_SYSTEM, SendOutOfBand(), SLNet::BitStream::Write(), and SLNet::BitStream::WriteAlignedBytes().

Packet * RakPeer::AllocatePacket | ( | unsigned | dataSize | ) |

virtual

Returns a packet for you to write to if you want to create a Packet for some reason. You can add it to the receive buffer with PushBackPacket.

Parameters

  [in] | dataSize | How many bytes to allocate for the buffer

Returns
  A packet.

Implements SLNet::RakPeerInterface.

Definition at line 2842 of file RakPeer.cpp.

References _FILE_AND_LINE_, and AllocPacket().

Packet * RakPeer::AllocPacket | ( | unsigned | dataSize,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

protected

Definition at line 143 of file RakPeer.cpp.

References DataStructures::MemoryPool< MemoryBlockType >::Allocate(), SLNet::Packet::bitSize, BYTES_TO_BITS, SLNet::Packet::data, SLNet::Packet::deleteData, SLNet::Packet::guid, SLNet::Packet::length, SLNet::SimpleMutex::Lock(), packetAllocationPool, packetAllocationPoolMutex, rakMalloc_Ex, SLNet::UNASSIGNED_RAKNET_GUID(), SLNet::SimpleMutex::Unlock(), and SLNet::Packet::wasGeneratedLocally.

Referenced by AllocatePacket(), CloseConnection(), SLNet::ProcessOfflineNetworkPacket(), RunUpdateCycle(), and SendLoopback().

Packet * RakPeer::AllocPacket | ( | unsigned | dataSize,
|  | unsigned char * | data,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

protected

Definition at line 169 of file RakPeer.cpp.

References DataStructures::MemoryPool< MemoryBlockType >::Allocate(), SLNet::Packet::bitSize, BYTES_TO_BITS, SLNet::Packet::data, SLNet::Packet::deleteData, SLNet::Packet::guid, SLNet::Packet::length, SLNet::SimpleMutex::Lock(), packetAllocationPool, packetAllocationPoolMutex, RakAssert, SLNet::UNASSIGNED_RAKNET_GUID(), SLNet::SimpleMutex::Unlock(), and SLNet::Packet::wasGeneratedLocally.

RNS2RecvStruct * RakPeer::AllocRNS2RecvStruct | ( | const char * | file,
|  | unsigned int | line
| ) |  |

protectedvirtual

Implements SLNet::RNS2EventHandler.

Definition at line 4034 of file RakPeer.cpp.

References bufferedPacketsFreePool, bufferedPacketsFreePoolMutex, SLNet::SimpleMutex::Lock(), DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Size(), and SLNet::SimpleMutex::Unlock().

void RakPeer::AllowConnectionResponseIPMigration | ( | bool | allow | ) |

virtual

Allow or disallow connection responses from any IP.

Normally this should be false, but may be necessary when connecting to servers with multiple IP addresses.

Parameters

  [in] | allow | - True to allow this behavior, false to not allow. Defaults to false. Value persists between connections.

Implements SLNet::RakPeerInterface.

Definition at line 2651 of file RakPeer.cpp.

References allowConnectionResponseIPMigration.

bool RakPeer::AllowIncomingConnections | ( | void |  | ) | const

protected

Definition at line 4022 of file RakPeer.cpp.

References GetMaximumIncomingConnections(), and GetNumberOfRemoteInitiatedConnections().

Referenced by SLNet::ProcessOfflineNetworkPacket().

void RakPeer::ApplyNetworkSimulator | ( | float | packetloss,
|  | unsigned short | minExtraPing,
|  | unsigned short | extraPingVariance
| ) |  |

virtual

Adds simulated ping and packet loss to the outgoing data flow. To simulate bi-directional ping and packet loss, you should call this on both the sender and the recipient, with half the total ping and packetloss value on each. You can exclude network simulator code with the _RELEASE #define to decrease code size

Deprecated:
  Use http://www.jenkinssoftware.com/forum/index.php?topic=1671.0 instead.

Note
  Doesn't work past version 3.6201

Parameters

  [in] | packetloss | Chance to lose a packet. Ranges from 0 to 1.
  [in] | minExtraPing | The minimum time to delay sends.
  [in] | extraPingVariance | The additional random time to delay sends.

Implements SLNet::RakPeerInterface.

Definition at line 2926 of file RakPeer.cpp.

References maximumNumberOfPeers, and remoteSystemList.

RakPeer::RemoteSystemStruct * RakPeer::AssignSystemAddressToRemoteSystemList | ( | const SystemAddress | systemAddress,
|  | RemoteSystemStruct::ConnectMode | connectionMode,
|  | RakNetSocket2 * | incomingRakNetSocket,
|  | bool * | thisIPConnectedRecently,
|  | SystemAddress | bindingAddress,
|  | int | incomingMTU,
|  | RakNetGUID | guid,
|  | bool | useSecurity
| ) |  |

protected

Get a free remote system from the list and assign our systemAddress to it.

Note
  Should only be called from the update thread - not the user thread.

Parameters

  [in] | systemAddress | systemAddress to be assigned
  [in] | connectionMode | connection mode of the RemoteSystem.
  [in] | rakNetSocket |
  [in] | thisIPConnectedRecently | Is this IP connected recently? set to False;
  [in] | bindingAddress | Address to be binded with the remote system
  [in] | incomingMTU | MTU for the remote system

Definition at line 3579 of file RakPeer.cpp.

References AddToActiveSystemList(), SLNet::RakPeer::PingAndClockDifferential::clockDifferential, SLNet::RakPeer::RemoteSystemStruct::connectionTime, SLNet::RakPeer::RemoteSystemStruct::connectMode, SLNet::SystemAddress::CopyPort(), defaultMTUSize, defaultTimeoutTime, SLNet::SystemAddress::EqualsExcludingPort(), SLNet::RakNetSocket2::GetBoundAddress(), GetIndexFromSystemAddress(), SLNet::GetTimeMS(), SLNet::RakPeer::RemoteSystemStruct::guid, ipList, SLNet::RakPeer::RemoteSystemStruct::isActive, IsLoopbackAddress(), SLNet::RakPeer::RemoteSystemStruct::lastReliableSend, limitConnectionFrequencyFromTheSameIP, SLNet::RakPeer::RemoteSystemStruct::lowestPing, MAXIMUM_MTU_SIZE, MAXIMUM_NUMBER_OF_INTERNAL_IDS, maximumNumberOfPeers, SLNet::RakPeer::RemoteSystemStruct::MTUSize, SLNet::RakPeer::RemoteSystemStruct::myExternalSystemAddress, SLNet::RakPeer::RemoteSystemStruct::nextPingTime, SLNet::PING_TIMES_ARRAY_SIZE, SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferential, SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferentialWriteIndex, SLNet::RakPeer::PingAndClockDifferential::pingTime, RakAssert, SLNet::RakPeer::RemoteSystemStruct::rakNetSocket, ReferenceRemoteSystem(), SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, remoteSystemList, SLNet::ReliabilityLayer::Reset(), SLNet::ReliabilityLayer::SetSplitMessageProgressInterval(), SLNet::ReliabilityLayer::SetTimeoutTime(), SLNet::ReliabilityLayer::SetUnreliableTimeout(), splitMessageProgressInterval, SLNet::SystemAddress::ToString(), SLNet::UNASSIGNED_SYSTEM_ADDRESS, unreliableTimeout, ValidateRemoteSystemLookup(), and SLNet::RakPeer::RemoteSystemStruct::weInitiatedTheConnection.

Referenced by SLNet::ProcessOfflineNetworkPacket().

void RakPeer::AttachPlugin | ( | PluginInterface2 * | plugin | ) |

virtual

Attaches a Plugin interface to an instance of the base class (RakPeer or PacketizedTCP) to run code automatically on message receipt in the Receive call. If the plugin returns false from PluginInterface::UsesReliabilityLayer(), which is the case for all plugins except PacketLogger, you can call AttachPlugin() and DetachPlugin() for this plugin while RakPeer is active.

Parameters

  [in] | messageHandler | Pointer to the plugin to attach.

Implements SLNet::RakPeerInterface.

Definition at line 2744 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::List< list_type >::GetIndexOf(), DataStructures::List< list_type >::Insert(), MAX_UNSIGNED_LONG, SLNet::PluginInterface2::OnAttach(), pluginListNTS, pluginListTS, SLNet::PluginInterface2::SetRakPeerInterface(), and SLNet::PluginInterface2::UsesReliabilityLayer().

void RakPeer::CallPluginCallbacks | ( | DataStructures::List< PluginInterface2 * > & | pluginList,
|  | Packet * | packet
| ) |  |

protected

Definition at line 6390 of file RakPeer.cpp.

References SLNet::Packet::data, SLNet::FCAR_ALREADY_CONNECTED, SLNet::FCAR_CONNECTION_ATTEMPT_FAILED, SLNet::FCAR_CONNECTION_BANNED, SLNet::FCAR_INCOMPATIBLE_PROTOCOL, SLNet::FCAR_INVALID_PASSWORD, SLNet::FCAR_IP_RECENTLY_CONNECTED, SLNet::FCAR_NO_FREE_INCOMING_CONNECTIONS, SLNet::FCAR_OUR_SYSTEM_REQUIRES_SECURITY, SLNet::FCAR_PUBLIC_KEY_MISMATCH, SLNet::FCAR_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY, SLNet::Packet::guid, ID_ALREADY_CONNECTED, ID_CONNECTION_ATTEMPT_FAILED, ID_CONNECTION_BANNED, ID_CONNECTION_LOST, ID_CONNECTION_REQUEST_ACCEPTED, ID_DISCONNECTION_NOTIFICATION, ID_INCOMPATIBLE_PROTOCOL_VERSION, ID_INVALID_PASSWORD, ID_IP_RECENTLY_CONNECTED, ID_NEW_INCOMING_CONNECTION, ID_NO_FREE_INCOMING_CONNECTIONS, ID_OUR_SYSTEM_REQUIRES_SECURITY, ID_PUBLIC_KEY_MISMATCH, ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY, SLNet::LCR_CONNECTION_LOST, SLNet::LCR_DISCONNECTION_NOTIFICATION, DataStructures::List< list_type >::Size(), and SLNet::Packet::systemAddress.

Referenced by Receive().

void RakPeer::CancelConnectionAttempt | ( | const SystemAddress | target | ) |

virtual

Cancel a pending connection attempt.

If we are already connected, the connection stays open

Parameters

  [in] | target | Target system to cancel.

Implements SLNet::RakPeerInterface.

Definition at line 1683 of file RakPeer.cpp.

References _FILE_AND_LINE_, CAT_AUDIT_PRINTF, SLNet::SimpleMutex::Lock(), SLNet::OP_DELETE(), DataStructures::Queue< queue_type >::RemoveAtIndex(), requestedConnectionQueue, requestedConnectionQueueMutex, DataStructures::Queue< queue_type >::Size(), and SLNet::SimpleMutex::Unlock().

void RakPeer::ChangeSystemAddress | ( | RakNetGUID | guid,
|  | const SystemAddress & | systemAddress
| ) |  |

virtual

Implements SLNet::RakPeerInterface.

Definition at line 2830 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::ThreadsafeAllocatingQueue< structureType >::Allocate(), SLNet::RakPeer::BufferedCommandStruct::BCS_CHANGE_SYSTEM_ADDRESS, bufferedCommands, SLNet::RakPeer::BufferedCommandStruct::command, SLNet::RakPeer::BufferedCommandStruct::data, DataStructures::ThreadsafeAllocatingQueue< structureType >::Push(), SLNet::AddressOrGUID::rakNetGuid, SLNet::AddressOrGUID::systemAddress, and SLNet::RakPeer::BufferedCommandStruct::systemIdentifier.

void RakPeer::ClearBanList | ( | void |  | ) |

virtual

Allows all previously banned IPs to connect.

Implements SLNet::RakPeerInterface.

Definition at line 1940 of file RakPeer.cpp.

References _FILE_AND_LINE_, banList, banListMutex, DataStructures::List< list_type >::Clear(), SLNet::SimpleMutex::Lock(), SLNet::OP_DELETE(), rakFree_Ex, DataStructures::List< list_type >::Size(), and SLNet::SimpleMutex::Unlock().

Referenced by ~RakPeer().

void RakPeer::ClearBufferedCommands | ( | void |  | ) |

protected

Definition at line 4401 of file RakPeer.cpp.

References _FILE_AND_LINE_, bufferedCommands, DataStructures::ThreadsafeAllocatingQueue< structureType >::Clear(), SLNet::RakPeer::BufferedCommandStruct::data, DataStructures::ThreadsafeAllocatingQueue< structureType >::Deallocate(), DataStructures::ThreadsafeAllocatingQueue< structureType >::Pop(), and rakFree_Ex.

Referenced by Shutdown(), and Startup().

void RakPeer::ClearBufferedPackets | ( | void |  | ) |

protected

Definition at line 4050 of file RakPeer.cpp.

References _FILE_AND_LINE_, bufferedPacketsFreePool, bufferedPacketsFreePoolMutex, bufferedPacketsQueue, bufferedPacketsQueueMutex, SLNet::SimpleMutex::Lock(), SLNet::OP_DELETE(), DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Size(), and SLNet::SimpleMutex::Unlock().

Referenced by Shutdown(), and Startup().

void RakPeer::ClearRemoteSystemLookup | ( | void |  | ) |

protected

Definition at line 3917 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::MemoryPool< MemoryBlockType >::Clear(), SLNet::OP_DELETE_ARRAY(), remoteSystemIndexPool, and remoteSystemLookup.

Referenced by Shutdown().

void RakPeer::ClearRequestedConnectionList | ( | void |  | ) |

protected

Definition at line 4420 of file RakPeer.cpp.

References _FILE_AND_LINE_, CAT_AUDIT_PRINTF, SLNet::SimpleMutex::Lock(), SLNet::OP_DELETE(), DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Push(), requestedConnectionQueue, requestedConnectionQueueMutex, DataStructures::Queue< queue_type >::Size(), and SLNet::SimpleMutex::Unlock().

Referenced by Shutdown().

void RakPeer::ClearSocketQueryOutput | ( | void |  | ) |

protected

Definition at line 4415 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::ThreadsafeAllocatingQueue< structureType >::Clear(), and socketQueryOutput.

Referenced by Shutdown(), and Startup().

void RakPeer::CloseConnection | ( | const AddressOrGUID | target,
|  | bool | sendDisconnectionNotification,
|  | unsigned char | orderingChannel = `0`,
|  | PacketPriority | disconnectionNotificationPriority = `LOW_PRIORITY`
| ) |  |

virtual

Close the connection to another host (if we initiated the connection it will disconnect, if they did it will kick them out).

This method closes the connection irrespective of who initiated the connection.

Parameters

  [in] | target | Which system to close the connection to.
  [in] | sendDisconnectionNotification | True to send ID_DISCONNECTION_NOTIFICATION to the recipient. False to close it silently.
  [in] | channel | Which ordering channel to send the disconnection notification on, if any
  [in] | disconnectionNotificationPriority | Priority to send ID_DISCONNECTION_NOTIFICATION on.

Implements SLNet::RakPeerInterface.

Definition at line 1647 of file RakPeer.cpp.

References _FILE_AND_LINE_, AddPacketToProducer(), AllocPacket(), CloseConnectionInternal(), SLNet::Packet::data, GetConnectionState(), GetGuidFromSystemAddress(), GetIndexFromSystemAddress(), GetSystemAddressFromGuid(), SLNet::Packet::guid, ID_CONNECTION_LOST, SLNet::IS_CONNECTED, SLNet::AddressOrGUID::rakNetGuid, SLNet::AddressOrGUID::systemAddress, SLNet::Packet::systemAddress, SLNet::SystemAddress::systemIndex, SLNet::RakNetGUID::systemIndex, SLNet::UNASSIGNED_RAKNET_GUID(), SLNet::UNASSIGNED_SYSTEM_ADDRESS, and SLNet::Packet::wasGeneratedLocally.

void RakPeer::CloseConnectionInternal | ( | const AddressOrGUID & | systemIdentifier,
|  | bool | sendDisconnectionNotification,
|  | bool | performImmediate,
|  | unsigned char | orderingChannel,
|  | PacketPriority | disconnectionNotificationPriority
| ) |  |

protected

Definition at line 4101 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::ThreadsafeAllocatingQueue< structureType >::Allocate(), SLNet::RakPeer::BufferedCommandStruct::BCS_CLOSE_CONNECTION, bufferedCommands, SLNet::RakPeer::BufferedCommandStruct::command, SLNet::RakPeer::BufferedCommandStruct::data, endThreads, SLNet::SystemAddress::FixForIPVersion(), GetRemoteSystemIndex(), GetSystemAddressFromGuid(), SLNet::RakPeer::RemoteSystemStruct::guid, SLNet::RakPeer::RemoteSystemStruct::isActive, SLNet::AddressOrGUID::IsUndefined(), MAXIMUM_MTU_SIZE, NotifyAndFlagForShutdown(), SLNet::RakPeer::BufferedCommandStruct::orderingChannel, SLNet::RakPeer::BufferedCommandStruct::priority, DataStructures::ThreadsafeAllocatingQueue< structureType >::Push(), RakAssert, SLNet::AddressOrGUID::rakNetGuid, SLNet::RakPeer::RemoteSystemStruct::rakNetSocket, SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, remoteSystemList, RemoveFromActiveSystemList(), SLNet::ReliabilityLayer::Reset(), socketList, SLNet::AddressOrGUID::systemAddress, SLNet::RakPeer::BufferedCommandStruct::systemIdentifier, SLNet::UNASSIGNED_RAKNET_GUID(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by CloseConnection(), and RunUpdateCycle().

ConnectionAttemptResult RakPeer::Connect | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | passwordData,
|  | int | passwordDataLength,
|  | PublicKey * | publicKey = `0`,
|  | unsigned | connectionSocketIndex = `0`,
|  | unsigned | sendConnectionAttemptCount = `6`,
|  | unsigned | timeBetweenSendConnectionAttemptsMS = `1000`,
|  | SLNet::TimeMS | timeoutTime = `0`
| ) |  |

virtual

Connect to the specified host (ip or domain name) and server port.

Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client. Calling both acts as a true peer.

This is a non-blocking connection.

The connection is successful when GetConnectionState() returns IS_CONNECTED or Receive() gets a message with the type identifier ID_CONNECTION_REQUEST_ACCEPTED. If the connection is not successful, such as a rejected connection or no response then neither of these things will happen.

Precondition
  Requires that you first call Startup().

Parameters

  [in] | host | Either a dotted IP address or a domain name.
  [in] | remotePort | Port to connect to on the remote machine.
  [in] | passwordData | A data block that must match the data block on the server passed to SetIncomingPassword(). This can be a string or can be a stream of data. Use 0 for no password.
  [in] | passwordDataLength | The length in bytes of passwordData.
  [in] | publicKey | The public key the server is using. If 0, the server is not using security. If non-zero, the publicKeyMode member determines how to connect
  [in] | connectionSocketIndex | Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to determine the one to send on.
  [in] | sendConnectionAttemptCount | Number of datagrams to send to the other system to try to connect.

  [in]

  timeBetweenSendConnectionAttemptsMS

  Time to elapse before a datagram is sent to the other system to try to connect. After sendConnectionAttemptCount number of attempts, ID_CONNECTION_ATTEMPT_FAILED is returned. Under low bandwidth conditions with multiple simultaneous outgoing connections, this value should be raised to 1000 or higher, or else the MTU detection can overrun the available bandwidth.

  [in] | timeoutTime | Time to elapse before dropping the connection if a reliable message could not be sent. 0 to use the default value from SetTimeoutTime(UNASSIGNED_SYSTEM_ADDRESS);

Returns
  CONNECTION_ATTEMPT_STARTED on successful initiation. Otherwise, an appropriate enumeration indicating failure.

Note
  CONNECTION_ATTEMPT_STARTED does not mean you are already connected!
  It is possible to immediately get back ID_CONNECTION_ATTEMPT_FAILED if you exceed the maxConnections parameter passed to Startup(). This could happen if you call CloseConnection() with sendDisconnectionNotificaiton true, then immediately call Connect() before the connection has closed.

Implements SLNet::RakPeerInterface.

Definition at line 990 of file RakPeer.cpp.

References endThreads, GetRakNetSocketFromUserConnectionSocketIndex(), SLNet::INVALID_PARAMETER, RakAssert, SendConnectionRequest(), DataStructures::List< list_type >::Size(), and socketList.

ConnectionAttemptResult RakPeer::ConnectWithSocket | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | passwordData,
|  | int | passwordDataLength,
|  | RakNetSocket2 * | socket,
|  | PublicKey * | publicKey = `0`,
|  | unsigned | sendConnectionAttemptCount = `6`,
|  | unsigned | timeBetweenSendConnectionAttemptsMS = `1000`,
|  | SLNet::TimeMS | timeoutTime = `0`
| ) |  |

virtual

Connect to the specified host (ip or domain name) and server port.

Parameters

  [in] | host | Either a dotted IP address or a domain name.
  [in] | remotePort | Which port to connect to on the remote machine.
  [in] | passwordData | A data block that must match the data block on the server passed to SetIncomingPassword(). This can be a string or can be a stream of data. Use 0 for no password.
  [in] | passwordDataLength | The length in bytes of passwordData.
  [in] | socket | A bound socket returned by another instance of RakPeerInterface.
  [in] | sendConnectionAttemptCount | Number of datagrams to send to the other system to try to connect.

  [in]

  timeBetweenSendConnectionAttemptsMS

  Time to elapse before a datagram is sent to the other system to try to connect. After sendConnectionAttemptCount number of attempts, ID_CONNECTION_ATTEMPT_FAILED is returned.. Under low bandwidth conditions with multiple simultaneous outgoing connections, this value should be raised to 1000 or higher, or else the MTU detection can overrun the available bandwidth.

  [in] | timeoutTime | Time to elapse before dropping the connection if a reliable message could not be sent. 0 to use the default from SetTimeoutTime(UNASSIGNED_SYSTEM_ADDRESS);

Returns
  CONNECTION_ATTEMPT_STARTED on successful initiation. Otherwise, an appropriate enumeration indicating failure.

Note
  CONNECTION_ATTEMPT_STARTED does not mean you are already connected!

Implements SLNet::RakPeerInterface.

Definition at line 1022 of file RakPeer.cpp.

References endThreads, SLNet::INVALID_PARAMETER, and SendConnectionRequest().

void RakPeer::DeallocatePacket | ( | Packet * | packet | ) |

virtual

Call this to deallocate a message returned by Receive() when you are done handling it.

Parameters

  [in] | packet | Message to deallocate.

Implements SLNet::RakPeerInterface.

Definition at line 1610 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::Packet::data, SLNet::Packet::deleteData, SLNet::SimpleMutex::Lock(), packetAllocationPool, packetAllocationPoolMutex, rakFree_Ex, DataStructures::MemoryPool< MemoryBlockType >::Release(), and SLNet::SimpleMutex::Unlock().

Referenced by Receive(), and Shutdown().

void RakPeer::DeallocRNS2RecvStruct | ( | RNS2RecvStruct * | s,
|  | const char * | file,
|  | unsigned int | line
| ) |  |

protectedvirtual

Implements SLNet::RNS2EventHandler.

Definition at line 4027 of file RakPeer.cpp.

References bufferedPacketsFreePool, bufferedPacketsFreePoolMutex, SLNet::SimpleMutex::Lock(), DataStructures::Queue< queue_type >::Push(), and SLNet::SimpleMutex::Unlock().

Referenced by RunUpdateCycle().

void RakPeer::DerefAllSockets | ( | void |  | ) |

protected

Definition at line 5468 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::List< list_type >::Clear(), SLNet::OP_DELETE(), DataStructures::List< list_type >::Size(), and socketList.

Referenced by Shutdown(), and Startup().

void RakPeer::DereferenceRemoteSystem | ( | const SystemAddress & | sa | ) |

protected

Definition at line 3871 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::RemoteSystemIndex::index, SLNet::RemoteSystemIndex::next, DataStructures::MemoryPool< MemoryBlockType >::Release(), remoteSystemIndexPool, remoteSystemList, remoteSystemLookup, RemoteSystemLookupHashIndex(), and SLNet::RakPeer::RemoteSystemStruct::systemAddress.

Referenced by SLNet::ProcessOfflineNetworkPacket(), and ReferenceRemoteSystem().

void RakPeer::DetachPlugin | ( | PluginInterface2 * | messageHandler | ) |

virtual

Detaches a Plugin interface from the instance of the base class (RakPeer or PacketizedTCP) it is attached to.

This method disables the plugin code from running automatically on base class's updates or message receipt. If the plugin returns false from PluginInterface::UsesReliabilityLayer(), which is the case for all plugins except PacketLogger, you can call AttachPlugin() and DetachPlugin() for this plugin while RakPeer is active.

Parameters

  [in] | messageHandler | Pointer to a plugin to detach.

Implements SLNet::RakPeerInterface.

Definition at line 2772 of file RakPeer.cpp.

References DataStructures::List< list_type >::GetIndexOf(), MAX_UNSIGNED_LONG, SLNet::PluginInterface2::OnDetach(), pluginListNTS, pluginListTS, DataStructures::List< list_type >::RemoveFromEnd(), SLNet::PluginInterface2::SetRakPeerInterface(), DataStructures::List< list_type >::Size(), and SLNet::PluginInterface2::UsesReliabilityLayer().

void RakPeer::DisableSecurity | ( | void |  | ) |

virtual

Disables security for incoming connections.

Note
  Must be called while offline

Implements SLNet::RakPeerInterface.

Definition at line 823 of file RakPeer.cpp.

References _FILE_AND_LINE_, CAT_AUDIT_PRINTF, and SLNet::OP_DELETE().

void RakPeer::FillIPList | ( | void |  | ) |

protected

Definition at line 6442 of file RakPeer.cpp.

References SLNet::RakNetSocket2::GetMyIP(), ipList, MAXIMUM_NUMBER_OF_INTERNAL_IDS, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by GetLocalIP(), GetNumberOfAddresses(), and Startup().

void RakPeer::GenerateGUID | ( | void |  | ) |

protected

Definition at line 4509 of file RakPeer.cpp.

References SLNet::RakNetGUID::g, SLNet::RakPeerInterface::Get64BitUniqueRandomNumber(), and myGuid.

Referenced by Startup().

unsigned int RakPeer::GenerateSeedFromGuid | ( | void |  | ) |

protected

Definition at line 5447 of file RakPeer.cpp.

References SLNet::RakNetGUID::g, and myGuid.

Referenced by Startup().

int RakPeer::GetAveragePing | ( | const AddressOrGUID | systemIdentifier | ) |

virtual

Returns the average of all ping times read for the specific system or -1 if none read yet.

Parameters

  [in] | systemAddress | Which system we are referring to

Returns
  The ping time for this system, or -1

Implements SLNet::RakPeerInterface.

Definition at line 2138 of file RakPeer.cpp.

References GetRemoteSystem(), SLNet::PING_TIMES_ARRAY_SIZE, SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferential, and SLNet::RakPeer::PingAndClockDifferential::pingTime.

SLNet::Time RakPeer::GetBestClockDifferential | ( | const SystemAddress | systemAddress | ) | const

protected

Get the most accurate clock differential for a certain player.

Parameters

  [in] | systemAddress | The player with whose clock the time difference is calculated.

Returns
  The clock differential for a certain player.

Definition at line 3775 of file RakPeer.cpp.

References GetClockDifferentialInt(), and GetRemoteSystemFromSystemAddress().

Referenced by ShiftIncomingTimestamp().

bool RakPeer::GetClientPublicKeyFromSystemAddress | ( | const SystemAddress | input,
|  | char * | client_public_key
| ) |  | const

virtual

Given the SystemAddress of a connected system, get the public key they provided as an identity Returns false if system address was not found or client public key is not known

Parameters

  [in] | input | The RakNetGUID of the system
  [in] | client_public_key | The connected client's public key is copied to this address. Buffer must be cat::EasyHandshake::PUBLIC_KEY_BYTES bytes in length.

Implements SLNet::RakPeerInterface.

Definition at line 2464 of file RakPeer.cpp.

References maximumNumberOfPeers, remoteSystemList, SLNet::RakPeer::RemoteSystemStruct::systemAddress, SLNet::SystemAddress::systemIndex, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

SLNet::Time RakPeer::GetClockDifferential | ( | const AddressOrGUID | systemIdentifier | ) |

virtual

Return the clock difference between your system and the specified system Subtract GetClockDifferential() from a time returned by the remote system to get that time relative to your own system Returns 0 if the system is unknown

Parameters

  [in] | systemIdentifier | Which system we are referring to

Return the clock difference between your system and the specified system Subtract the time from a time returned by the remote system to get that time relative to your own system Returns 0 if the system is unknown

Implements SLNet::RakPeerInterface.

Definition at line 2217 of file RakPeer.cpp.

References GetClockDifferentialInt(), and GetRemoteSystem().

SLNet::Time RakPeer::GetClockDifferentialInt | ( | RemoteSystemStruct * | remoteSystem | ) | const

protected

Definition at line 2227 of file RakPeer.cpp.

References SLNet::RakPeer::PingAndClockDifferential::clockDifferential, SLNet::PING_TIMES_ARRAY_SIZE, SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferential, and SLNet::RakPeer::PingAndClockDifferential::pingTime.

Referenced by GetBestClockDifferential(), and GetClockDifferential().

bool RakPeer::GetConnectionList | ( | SystemAddress * | remoteSystems,
|  | unsigned short * | numberOfSystems
| ) |  | const

virtual

Fills the array remoteSystems with the SystemAddress of all the systems we are connected to.

Parameters

  [out] | remoteSystems | An array of SystemAddress structures, to be filled with the SystemAddresss of the systems we are connected to. Pass 0 to remoteSystems to get the number of systems we are connected to.
  [in,out] | numberOfSystems | As input, the size of remoteSystems array. As output, the number of elements put into the array.

Implements SLNet::RakPeerInterface.

Definition at line 1241 of file RakPeer.cpp.

References endThreads, GetSystemList(), remoteSystemList, and DataStructures::List< list_type >::Size().

ConnectionState RakPeer::GetConnectionState | ( | const AddressOrGUID | systemIdentifier | ) |

virtual

Returns if a system is connected, disconnected, connecting in progress, or various other states

Parameters

  [in] | systemIdentifier | The system we are referring to

Note
  This locks a mutex, do not call too frequently during connection attempts or the attempt will take longer and possibly even timeout

Returns
  What state the remote system is in

Implements SLNet::RakPeerInterface.

Definition at line 1711 of file RakPeer.cpp.

References SLNet::RakPeer::RemoteSystemStruct::CONNECTED, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ASAP, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ON_NO_ACK, GetIndexFromGuid(), GetIndexFromSystemAddress(), SLNet::RakPeer::RemoteSystemStruct::HANDLING_CONNECTION_REQUEST, SLNet::IS_CONNECTED, SLNet::IS_CONNECTING, SLNet::IS_DISCONNECTED, SLNet::IS_DISCONNECTING, SLNet::IS_NOT_CONNECTED, SLNet::IS_PENDING, SLNet::IS_SILENTLY_DISCONNECTING, SLNet::SimpleMutex::Lock(), SLNet::AddressOrGUID::rakNetGuid, remoteSystemList, SLNet::RakPeer::RemoteSystemStruct::REQUESTED_CONNECTION, requestedConnectionQueue, requestedConnectionQueueMutex, DataStructures::Queue< queue_type >::Size(), SLNet::AddressOrGUID::systemAddress, SLNet::UNASSIGNED_SYSTEM_ADDRESS, SLNet::SimpleMutex::Unlock(), and SLNet::RakPeer::RemoteSystemStruct::UNVERIFIED_SENDER.

Referenced by CloseConnection().

SystemAddress RakPeer::GetExternalID | ( | const SystemAddress | target | ) | const

virtual

Returns the unique address identifier that represents the target on the the network and is based on the target's external IP / port.

Parameters

  [in] | target | The SystemAddress of the remote system. Usually the same for all systems, unless you have two or more network cards.

Implements SLNet::RakPeerInterface.

Definition at line 2340 of file RakPeer.cpp.

References firstExternalID, maximumNumberOfPeers, SLNet::RakPeer::RemoteSystemStruct::myExternalSystemAddress, remoteSystemList, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

RakNetGUID RakPeer::GetGUIDFromIndex | ( | unsigned int | index | ) |

virtual

Same as GetSystemAddressFromIndex but returns RakNetGUID.

Parameters

  [in] | index | Index should range between 0 and the maximum number of players allowed - 1.

Returns
  The RakNetGUID

Implements SLNet::RakPeerInterface.

Definition at line 1807 of file RakPeer.cpp.

References SLNet::RakPeer::RemoteSystemStruct::CONNECTED, SLNet::RakPeer::RemoteSystemStruct::guid, maximumNumberOfPeers, remoteSystemList, and SLNet::UNASSIGNED_RAKNET_GUID().

const RakNetGUID & RakPeer::GetGuidFromSystemAddress | ( | const SystemAddress | input | ) | const

virtual

Given a connected system address, this method gives the unique GUID representing that instance of RakPeer. This will be the same on all systems connected to that instance of RakPeer, even if the external system addresses are different. Complexity is O(log2(n)). If input is UNASSIGNED_SYSTEM_ADDRESS, will return your own GUID.

Precondition
  Call Startup() first, or the function will return UNASSIGNED_RAKNET_GUID

Parameters

  [in] | input | The system address of the target system we are connected to.

Implements SLNet::RakPeerInterface.

Definition at line 2383 of file RakPeer.cpp.

References SLNet::RakPeer::RemoteSystemStruct::guid, maximumNumberOfPeers, myGuid, remoteSystemList, SLNet::RakPeer::RemoteSystemStruct::systemAddress, SLNet::SystemAddress::systemIndex, SLNet::RakNetGUID::systemIndex, SLNet::UNASSIGNED_RAKNET_GUID(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by CloseConnection(), ParseConnectionRequestPacket(), and SLNet::ProcessOfflineNetworkPacket().

void RakPeer::GetIncomingPassword | ( | char * | passwordData,
|  | int * | passwordDataLength
| ) |  |

virtual

Gets the password passed to SetIncomingPassword.

Parameters

  [out] | passwordData | Should point to a block large enough to hold the password data you passed to SetIncomingPassword()
  [in,out] | passwordDataLength | Maximum size of the passwordData array. Modified to hold the number of bytes actually written.

Implements SLNet::RakPeerInterface.

Definition at line 957 of file RakPeer.cpp.

References incomingPassword, and incomingPasswordLength.

int RakPeer::GetIndexFromGuid | ( | const RakNetGUID | guid | ) |

protected

Definition at line 3153 of file RakPeer.cpp.

References SLNet::RakPeer::RemoteSystemStruct::guid, SLNet::RakPeer::RemoteSystemStruct::isActive, maximumNumberOfPeers, remoteSystemList, SLNet::RakNetGUID::systemIndex, and SLNet::UNASSIGNED_RAKNET_GUID().

Referenced by GetConnectionState().

int RakPeer::GetIndexFromSystemAddress | ( | const SystemAddress | systemAddress | ) | const

virtual

Given systemAddress, returns its index into remoteSystemList.

Values range from 0 to the maximum number of players allowed - 1. This includes systems which were formerly connected, but are now not connected.

Parameters

  [in] | systemAddress | The SystemAddress we are referring to

Returns
  The index of this SystemAddress or -1 on system not found.

Implements SLNet::RakPeerInterface.

Definition at line 1776 of file RakPeer.cpp.

Referenced by AssignSystemAddressToRemoteSystemList(), CloseConnection(), GetConnectionState(), OnConnectionRequest(), SLNet::ProcessOfflineNetworkPacket(), RunUpdateCycle(), and SendImmediate().

int RakPeer::GetIndexFromSystemAddress | ( | const SystemAddress | systemAddress,
|  | bool | calledFromNetworkThread
| ) |  | const

protected

Definition at line 3123 of file RakPeer.cpp.

References GetRemoteSystemIndex(), SLNet::RakPeer::RemoteSystemStruct::isActive, maximumNumberOfPeers, remoteSystemList, SLNet::RakPeer::RemoteSystemStruct::systemAddress, SLNet::SystemAddress::systemIndex, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

SystemAddress RakPeer::GetInternalID | ( | const SystemAddress | systemAddress = `UNASSIGNED_SYSTEM_ADDRESS`,
|  | const int | index = `0`
| ) |  | const

virtual

Returns the unique address identifier that represents you or another system on the the network.

Note
  Not supported by the XBOX

Parameters

  [in] | systemAddress | Use UNASSIGNED_SYSTEM_ADDRESS to get your behind-LAN address. Use a connected system to get their behind-LAN address. This does not return the port.
  [in] | index | When you have multiple internal IDs, which index to return? Currently limited to MAXIMUM_NUMBER_OF_INTERNAL_IDS (so the maximum value of this variable is MAXIMUM_NUMBER_OF_INTERNAL_IDS-1)

Returns
  Identifier of your system internally, which may not be how other systems see if you if you are behind a NAT or proxy.

Implements SLNet::RakPeerInterface.

Definition at line 2290 of file RakPeer.cpp.

References GetRemoteSystemFromSystemAddress(), ipList, SLNet::RakPeer::RemoteSystemStruct::theirInternalSystemAddress, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by GetSystemAddressFromGuid().

int RakPeer::GetLastPing | ( | const AddressOrGUID | systemIdentifier | ) | const

virtual

Returns the last ping time read for the specific system or -1 if none read yet.

Parameters

  [in] | systemAddress | Which system we are referring to

Returns
  The last ping time for this system, or -1.

Implements SLNet::RakPeerInterface.

Definition at line 2167 of file RakPeer.cpp.

References GetRemoteSystem(), SLNet::PING_TIMES_ARRAY_SIZE, SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferential, SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferentialWriteIndex, and SLNet::RakPeer::PingAndClockDifferential::pingTime.

const char * RakPeer::GetLocalIP | ( | unsigned int | index | ) |

virtual

Returns an IP address at index 0 to GetNumberOfAddresses-1 in ipList array.

Parameters

  [in] | index | index into the list of IP addresses

Returns
  The local IP address at this index

Implements SLNet::RakPeerInterface.

Definition at line 2595 of file RakPeer.cpp.

References FillIPList(), ipList, IsActive(), and SLNet::SystemAddress::ToString().

Referenced by IsLocalIP().

SystemAddress RakPeer::GetLoopbackAddress | ( | void |  | ) | const

protected

Definition at line 4013 of file RakPeer.cpp.

References ipList.

Referenced by SendLoopback().

int RakPeer::GetLowestPing | ( | const AddressOrGUID | systemIdentifier | ) | const

virtual

Returns the lowest ping time read or -1 if none read yet.

Parameters

  [in] | systemIdentifier | Which system we are referring to

Returns
  The lowest ping time for this system, or -1.

Implements SLNet::RakPeerInterface.

Definition at line 2189 of file RakPeer.cpp.

References GetRemoteSystem(), and SLNet::RakPeer::RemoteSystemStruct::lowestPing.

unsigned int RakPeer::GetMaximumIncomingConnections | ( | void |  | ) | const

virtual

Returns the value passed to SetMaximumIncomingConnections().

Returns
  Maximum number of incoming connections, which is always <= maxConnections

Implements SLNet::RakPeerInterface.

Definition at line 911 of file RakPeer.cpp.

References maximumIncomingConnections.

Referenced by AllowIncomingConnections().

unsigned int RakPeer::GetMaximumNumberOfPeers | ( | void |  | ) | const

virtual

Return the total number of connections we are allowed.

Returns
  Total number of connections allowed.

Implements SLNet::RakPeerInterface.

Definition at line 1633 of file RakPeer.cpp.

References maximumNumberOfPeers.

int RakPeer::GetMTUSize | ( | const SystemAddress | target | ) | const

virtual

Returns the current MTU size.

Parameters

  [in] | target | Which system to get MTU for. UNASSIGNED_SYSTEM_ADDRESS to get the default

Returns
  The current MTU size of the target system.

Implements SLNet::RakPeerInterface.

Definition at line 2561 of file RakPeer.cpp.

References defaultMTUSize, GetRemoteSystemFromSystemAddress(), SLNet::RakPeer::RemoteSystemStruct::MTUSize, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

SystemAddress RakPeer::GetMyBoundAddress | ( | const int | socketIndex = `0` | ) |

virtual

Return the address bound to a socket at the specified index.

Implements SLNet::RakPeerInterface.

Definition at line 2372 of file RakPeer.cpp.

References GetSockets(), DataStructures::List< list_type >::Size(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

const RakNetGUID RakPeer::GetMyGUID | ( | void |  | ) | const

virtual

Return my own GUID.

Implements SLNet::RakPeerInterface.

Definition at line 2367 of file RakPeer.cpp.

References myGuid.

Referenced by Ping().

uint32_t RakPeer::GetNextSendReceipt | ( | void |  | ) |

virtual

Returns the next uint32_t that Send() will return

Note
  If using RakPeer from multiple threads, this may not be accurate for your thread. Use IncrementNextSendReceipt() in that case.

Returns
  The next uint32_t that Send() or SendList will return

Implements SLNet::RakPeerInterface.

Definition at line 1271 of file RakPeer.cpp.

References SLNet::SimpleMutex::Lock(), sendReceiptSerial, sendReceiptSerialMutex, and SLNet::SimpleMutex::Unlock().

unsigned int RakPeer::GetNumberOfAddresses | ( | void |  | ) |

virtual

Returns the number of IP addresses this system has internally.

Get the actual addresses from GetLocalIP()

Implements SLNet::RakPeerInterface.

Definition at line 2575 of file RakPeer.cpp.

References FillIPList(), ipList, IsActive(), MAXIMUM_NUMBER_OF_INTERNAL_IDS, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by IsLocalIP().

unsigned int RakPeer::GetNumberOfRemoteInitiatedConnections | ( | void |  | ) | const

protected

Returns how many remote systems initiated a connection to us.

Definition at line 3557 of file RakPeer.cpp.

References activeSystemList, activeSystemListSize, SLNet::RakPeer::RemoteSystemStruct::CONNECTED, endThreads, and remoteSystemList.

Referenced by AllowIncomingConnections().

void RakPeer::GetOfflinePingResponse | ( | char ** | data,
|  | unsigned int * | length
| ) |  |

virtual

Returns pointers to a copy of the data passed to SetOfflinePingResponse.

Parameters

  [out] | data | A pointer to a copy of the data passed to SetOfflinePingResponse()
  [out] | length | A pointer filled in with the length parameter passed to SetOfflinePingResponse()

See Also
  SetOfflinePingResponse

Implements SLNet::RakPeerInterface.

Definition at line 2277 of file RakPeer.cpp.

References SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfBytesUsed(), SLNet::SimpleMutex::Lock(), offlinePingResponse, offlinePingResponse_Mutex, rakPeerMutexes, and SLNet::SimpleMutex::Unlock().

unsigned int RakPeer::GetRakNetSocketFromUserConnectionSocketIndex | ( | unsigned int | userIndex | ) | const

protected

Definition at line 5478 of file RakPeer.cpp.

References RakAssert, DataStructures::List< list_type >::Size(), and socketList.

Referenced by Connect(), Ping(), SendOutOfBand(), and SendTTL().

unsigned int RakPeer::GetReceiveBufferSize | ( | void |  | ) |

virtual

how many messages are waiting when you call Receive()

Implements SLNet::RakPeerInterface.

Definition at line 3114 of file RakPeer.cpp.

References SLNet::SimpleMutex::Lock(), packetReturnMutex, packetReturnQueue, DataStructures::Queue< queue_type >::Size(), and SLNet::SimpleMutex::Unlock().

RakPeer::RemoteSystemStruct * RakPeer::GetRemoteSystem | ( | const AddressOrGUID | systemIdentifier,
|  | bool | calledFromNetworkThread,
|  | bool | onlyActive
| ) |  | const

protected

Definition at line 3365 of file RakPeer.cpp.

References GetRemoteSystemFromGUID(), GetRemoteSystemFromSystemAddress(), SLNet::AddressOrGUID::rakNetGuid, SLNet::AddressOrGUID::systemAddress, and SLNet::UNASSIGNED_RAKNET_GUID().

Referenced by GetAveragePing(), GetClockDifferential(), GetLastPing(), GetLowestPing(), ReferenceRemoteSystem(), and RunUpdateCycle().

RakPeer::RemoteSystemStruct * RakPeer::GetRemoteSystem | ( | const SystemAddress & | sa | ) | const

protected

Definition at line 3909 of file RakPeer.cpp.

References GetRemoteSystemIndex(), and remoteSystemList.

RakPeer::RemoteSystemStruct * RakPeer::GetRemoteSystemFromGUID | ( | const RakNetGUID | guid,
|  | bool | onlyActive
| ) |  | const

protected

Definition at line 3415 of file RakPeer.cpp.

References maximumNumberOfPeers, remoteSystemList, and SLNet::UNASSIGNED_RAKNET_GUID().

Referenced by GetRemoteSystem(), and SLNet::ProcessOfflineNetworkPacket().

RakPeer::RemoteSystemStruct * RakPeer::GetRemoteSystemFromSystemAddress | ( | const SystemAddress | systemAddress,
|  | bool | calledFromNetworkThread,
|  | bool | onlyActive
| ) |  | const

protected

Get the reliability layer associated with a systemAddress.

Parameters

  [in] | systemAddress | The player identifier

Returns
  0 if none

Definition at line 3373 of file RakPeer.cpp.

References GetRemoteSystemIndex(), maximumNumberOfPeers, RakAssert, remoteSystemList, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by GetBestClockDifferential(), GetInternalID(), GetMTUSize(), GetRemoteSystem(), GetStatistics(), GetTimeoutTime(), NotifyAndFlagForShutdown(), SLNet::ProcessNetworkPacket(), SLNet::ProcessOfflineNetworkPacket(), SendConnectionRequest(), and SetTimeoutTime().

unsigned int RakPeer::GetRemoteSystemIndex | ( | const SystemAddress & | sa | ) | const

protected

Definition at line 3896 of file RakPeer.cpp.

References SLNet::RemoteSystemIndex::index, SLNet::RemoteSystemIndex::next, remoteSystemList, remoteSystemLookup, RemoteSystemLookupHashIndex(), and SLNet::RakPeer::RemoteSystemStruct::systemAddress.

Referenced by CloseConnectionInternal(), GetIndexFromSystemAddress(), GetRemoteSystem(), GetRemoteSystemFromSystemAddress(), ReferenceRemoteSystem(), and RunUpdateCycle().

RakNetSocket2 * RakPeer::GetSocket | ( | const SystemAddress | target | ) |

virtual

Get the socket used with a particular active connection. The smart pointer reference counts the RakNetSocket object, so the socket will remain active as long as the smart pointer does, even if RakNet were to shutdown or close the connection.

Note
  This sends a query to the thread and blocks on the return value for up to one second. In practice it should only take a millisecond or so.

Parameters

  [in] | target | Which system.

Returns
  A smart pointer object containing the socket information about the target. Be sure to check IsNull() which is returned if the update thread is unresponsive, shutting down, or if this system is not connected.

Implements SLNet::RakPeerInterface.

Definition at line 2847 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::ThreadsafeAllocatingQueue< structureType >::Allocate(), SLNet::RakPeer::BufferedCommandStruct::BCS_GET_SOCKET, bufferedCommands, DataStructures::List< list_type >::Clear(), SLNet::RakPeer::BufferedCommandStruct::command, SLNet::RakPeer::BufferedCommandStruct::data, DataStructures::ThreadsafeAllocatingQueue< structureType >::Deallocate(), SLNet::GetTimeMS(), isMainLoopThreadActive, DataStructures::ThreadsafeAllocatingQueue< structureType >::Pop(), DataStructures::ThreadsafeAllocatingQueue< structureType >::Push(), RakSleep(), DataStructures::List< list_type >::Size(), socketQueryOutput, SLNet::RakPeer::SocketQueryOutput::sockets, and SLNet::RakPeer::BufferedCommandStruct::systemIdentifier.

void RakPeer::GetSockets | ( | DataStructures::List< RakNetSocket2 * > & | sockets | ) |

virtual

Gets all sockets in use.

Note
  This sends a query to the thread and blocks on the return value for up to one second. In practice it should only take a millisecond or so.

Parameters

  [out] | sockets | List of RakNetSocket structures in use.

Implements SLNet::RakPeerInterface.

Definition at line 2882 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::ThreadsafeAllocatingQueue< structureType >::Allocate(), SLNet::RakPeer::BufferedCommandStruct::BCS_GET_SOCKET, bufferedCommands, DataStructures::List< list_type >::Clear(), SLNet::RakPeer::BufferedCommandStruct::command, SLNet::RakPeer::BufferedCommandStruct::data, DataStructures::ThreadsafeAllocatingQueue< structureType >::Deallocate(), isMainLoopThreadActive, DataStructures::ThreadsafeAllocatingQueue< structureType >::Pop(), DataStructures::ThreadsafeAllocatingQueue< structureType >::Push(), RakSleep(), socketQueryOutput, SLNet::RakPeer::SocketQueryOutput::sockets, SLNet::RakPeer::BufferedCommandStruct::systemIdentifier, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by GetMyBoundAddress().

int RakPeer::GetSplitMessageProgressInterval | ( | void |  | ) | const

virtual

Returns what was passed to SetSplitMessageProgressInterval().

Returns
  Number of messages to be recieved before a download progress notification is returned. Default to 0.

Implements SLNet::RakPeerInterface.

Definition at line 2692 of file RakPeer.cpp.

References splitMessageProgressInterval.

RakNetStatistics * RakPeer::GetStatistics | ( | const SystemAddress | systemAddress,
|  | RakNetStatistics * | rns = `0`
| ) |  |

virtual

Returns a structure containing a large set of network statistics for the specified system. You can map this data to a string using the C style StatisticsToString() function.

Parameters

  [in] | systemAddress | Which connected system to get statistics for.
  [in] | rns | If you supply this structure,the network statistics will be written to it. Otherwise the method uses a static struct to write the data, which is not threadsafe.

Returns
  0 if the specified system can't be found. Otherwise a pointer to the struct containing the specified system's network statistics.

See Also
  statistics.h

Implements SLNet::RakPeerInterface.

Definition at line 3035 of file RakPeer.cpp.

References endThreads, GetRemoteSystemFromSystemAddress(), SLNet::ReliabilityLayer::GetStatistics(), maximumNumberOfPeers, SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, remoteSystemList, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

bool RakPeer::GetStatistics | ( | const unsigned int | index,
|  | RakNetStatistics * | rns
| ) |  |

virtual

Returns the network statistics of the system at the given index in the remoteSystemList.

Returns
  True if the index is less than the maximum number of peers allowed and the system is active. False otherwise.

Implements SLNet::RakPeerInterface.

Definition at line 3104 of file RakPeer.cpp.

References SLNet::ReliabilityLayer::GetStatistics(), maximumNumberOfPeers, SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, and remoteSystemList.

void RakPeer::GetStatisticsList | ( | DataStructures::List< SystemAddress > & | addresses,
|  | DataStructures::List< RakNetGUID > & | guids,
|  | DataStructures::List< RakNetStatistics > & | statistics
| ) |  |

virtual

Returns the list of systems, and statistics for each of those systems Each system has one entry in each of the lists, in the same order.

Parameters

  [out] | addresses | SystemAddress for each connected system
  [out] | guids | RakNetGUID for each connected system
  [out] | statistics | Calculated RakNetStatistics for each connected system

Implements SLNet::RakPeerInterface.

Definition at line 3080 of file RakPeer.cpp.

References _FILE_AND_LINE_, activeSystemList, activeSystemListSize, DataStructures::List< list_type >::Clear(), SLNet::RakPeer::RemoteSystemStruct::CONNECTED, endThreads, DataStructures::List< list_type >::Push(), and remoteSystemList.

SystemAddress RakPeer::GetSystemAddressFromGuid | ( | const RakNetGUID | input | ) | const

virtual

Gives the system address of a connected system, given its GUID. The GUID will be the same on all systems connected to that instance of RakPeer, even if the external system addresses are different. Currently O(log(n)), but this may be improved in the future If input is UNASSIGNED_RAKNET_GUID, UNASSIGNED_SYSTEM_ADDRESS is returned.

Parameters

  [in] | input | The RakNetGUID of the target system.

Implements SLNet::RakPeerInterface.

Definition at line 2436 of file RakPeer.cpp.

References GetInternalID(), SLNet::RakPeer::RemoteSystemStruct::guid, maximumNumberOfPeers, myGuid, remoteSystemList, SLNet::RakPeer::RemoteSystemStruct::systemAddress, SLNet::RakNetGUID::systemIndex, SLNet::UNASSIGNED_RAKNET_GUID(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by CloseConnection(), and CloseConnectionInternal().

SystemAddress RakPeer::GetSystemAddressFromIndex | ( | unsigned int | index | ) |

virtual

Given index into remoteSystemList, will return a SystemAddress. This function is only useful for looping through all systems.

Parameters

  [in] | index | Index should range between 0 and the maximum number of players allowed - 1.

Returns
  The SystemAddress structure corresponding to index in remoteSystemList.

Implements SLNet::RakPeerInterface.

Definition at line 1791 of file RakPeer.cpp.

References SLNet::RakPeer::RemoteSystemStruct::CONNECTED, maximumNumberOfPeers, remoteSystemList, SLNet::RakPeer::RemoteSystemStruct::systemAddress, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

unsigned int RakPeer::GetSystemIndexFromGuid | ( | const RakNetGUID | input | ) | const

protected

Definition at line 2408 of file RakPeer.cpp.

References SLNet::RakPeer::RemoteSystemStruct::guid, maximumNumberOfPeers, myGuid, remoteSystemList, SLNet::RakNetGUID::systemIndex, and SLNet::UNASSIGNED_RAKNET_GUID().

Referenced by SendImmediate().

void RakPeer::GetSystemList | ( | DataStructures::List< SystemAddress > & | addresses,
|  | DataStructures::List< RakNetGUID > & | guids
| ) |  | const

virtual

Same as calling GetSystemAddressFromIndex and GetGUIDFromIndex for all systems, but more efficient Indices match each other, so addresses[0] and guids[0] refer to the same system.

Parameters

  [out] | addresses | All system addresses. Size of the list is the number of connections. Size of the addresses list will match the size of the guids list.
  [out] | guids | All guids. Size of the list is the number of connections. Size of the list will match the size of the addresses list.

Implements SLNet::RakPeerInterface.

Definition at line 1824 of file RakPeer.cpp.

References _FILE_AND_LINE_, activeSystemList, activeSystemListSize, DataStructures::List< list_type >::Clear(), SLNet::RakPeer::RemoteSystemStruct::CONNECTED, endThreads, DataStructures::List< list_type >::Push(), and remoteSystemList.

Referenced by GetConnectionList(), and NumberOfConnections().

SLNet::TimeMS RakPeer::GetTimeoutTime | ( | const SystemAddress | target | ) |

virtual

Returns the Timeout time for the given system.

Parameters

  [in] | target | Target system to get the TimeoutTime for. Pass UNASSIGNED_SYSTEM_ADDRESS to get the default value.

Returns
  Timeout time for a given system.

Implements SLNet::RakPeerInterface.

Definition at line 2540 of file RakPeer.cpp.

References defaultTimeoutTime, GetRemoteSystemFromSystemAddress(), SLNet::ReliabilityLayer::GetTimeoutTime(), SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

uint32_t RakPeer::IncrementNextSendReceipt | ( | void |  | ) |

virtual

Returns the next uint32_t that Send() will return, and increments the value by one

Note
  If using RakPeer from multiple threads, pass this to forceReceipt in the send function

Returns
  The next uint32_t that Send() or SendList will return

Implements SLNet::RakPeerInterface.

Definition at line 1279 of file RakPeer.cpp.

References SLNet::SimpleMutex::Lock(), sendReceiptSerial, sendReceiptSerialMutex, and SLNet::SimpleMutex::Unlock().

Referenced by Send(), and SendList().

bool RakPeer::InitializeSecurity | ( | const char * | publicKey,
|  | const char * | privateKey,
|  | bool | bRequireClientKey = `false`
| ) |  |

virtual

If you accept connections, you must call this or else security will not be enabled for incoming connections. This feature requires more round trips, bandwidth, and CPU time for the connection handshake x64 builds require under 25% of the CPU time of other builds See the Encryption sample for example usage

Precondition
  Must be called while offline
  LIBCAT_SECURITY must be defined to 1 in NativeFeatureIncludes.h for this function to have any effect

Parameters

  [in] | publicKey | A pointer to the public key for accepting new connections
  [in] | privateKey | A pointer to the private key for accepting new connections
  [in] | bRequireClientKey,: | Should be set to false for most servers. Allows the server to accept a public key from connecting clients as a proof of identity but eats twice as much CPU time as a normal connection

Implements SLNet::RakPeerInterface.

Definition at line 762 of file RakPeer.cpp.

References _FILE_AND_LINE_, CAT_AUDIT_PRINTF, endThreads, and SLNet::OP_DELETE().

bool RakPeer::IsActive | ( | void |  | ) | const

inlinevirtual

Returns true if the network thread is running.

Returns
  True if the network thread is running, False otherwise

Implements SLNet::RakPeerInterface.

Definition at line 1227 of file RakPeer.cpp.

References endThreads.

Referenced by GetLocalIP(), GetNumberOfAddresses(), PingInternal(), Receive(), SendOutOfBand(), ShiftIncomingTimestamp(), and Startup().

bool RakPeer::IsBanned | ( | const char * | IP | ) |

virtual

Returns true or false indicating if a particular IP is banned.

Parameters

  [in] | IP | Dotted IP address.

Returns
  True if IP matches any IPs in the ban list, accounting for any wildcards. False otherwise.

Implements SLNet::RakPeerInterface.

Definition at line 1973 of file RakPeer.cpp.

References _FILE_AND_LINE_, banList, banListMutex, SLNet::GetTimeMS(), SLNet::RakPeer::BanStruct::IP, SLNet::SimpleMutex::Lock(), SLNet::OP_DELETE(), rakFree_Ex, DataStructures::List< list_type >::RemoveAtIndex(), DataStructures::List< list_type >::Size(), and SLNet::SimpleMutex::Unlock().

Referenced by SLNet::ProcessOfflineNetworkPacket().

bool RakPeer::IsInSecurityExceptionList | ( | const char * | ip | ) |

virtual

Checks to see if a given IP is in the security exception list.

Parameters

  [in] | IP | address to check.

Returns
  True if the IP address is found in security exception list, else returns false.

Implements SLNet::RakPeerInterface.

Definition at line 874 of file RakPeer.cpp.

References SLNet::SimpleMutex::Lock(), securityExceptionList, securityExceptionMutex, DataStructures::List< list_type >::Size(), and SLNet::SimpleMutex::Unlock().

Referenced by SLNet::ProcessOfflineNetworkPacket().

bool RakPeer::IsLocalIP | ( | const char * | ip | ) |

virtual

Is this a local IP? Checks if this ip is in the ipList array.

Parameters

  [in] | An | IP address to check, excluding the port.

Returns
  True if this is one of the IP addresses returned by GetLocalIP

Implements SLNet::RakPeerInterface.

Definition at line 2620 of file RakPeer.cpp.

References GetLocalIP(), and GetNumberOfAddresses().

bool RakPeer::IsLoopbackAddress | ( | const AddressOrGUID & | systemIdentifier,
|  | bool | matchPort
| ) |  | const

protected

Definition at line 3990 of file RakPeer.cpp.

References SLNet::SystemAddress::EqualsExcludingPort(), firstExternalID, ipList, MAXIMUM_NUMBER_OF_INTERNAL_IDS, myGuid, SLNet::AddressOrGUID::rakNetGuid, SLNet::AddressOrGUID::systemAddress, SLNet::UNASSIGNED_RAKNET_GUID(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by AssignSystemAddressToRemoteSystemList(), Send(), and SendBufferedList().

bool RakPeer::IsNetworkSimulatorActive | ( | void |  | ) |

virtual

Returns if you previously called ApplyNetworkSimulator

Returns
  If you previously called ApplyNetworkSimulator

Implements SLNet::RakPeerInterface.

Definition at line 2953 of file RakPeer.cpp.

void RakPeer::NotifyAndFlagForShutdown | ( | const SystemAddress | systemAddress,
|  | bool | performImmediate,
|  | unsigned char | orderingChannel,
|  | PacketPriority | disconnectionNotificationPriority
| ) |  |

protected

Send a reliable disconnect packet to this player and disconnect them when it is delivered.

Definition at line 3541 of file RakPeer.cpp.

References SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ASAP, SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfBitsUsed(), GetRemoteSystemFromSystemAddress(), SLNet::GetTimeUS(), ID_DISCONNECTION_NOTIFICATION, RELIABLE_ORDERED, SendBuffered(), SendImmediate(), and SLNet::BitStream::Write().

Referenced by CloseConnectionInternal(), and Shutdown().

unsigned short RakPeer::NumberOfConnections | ( | void |  | ) | const

virtual

Returns how many open connections exist at this time.

Returns
  Number of open connections.

Implements SLNet::RakPeerInterface.

Definition at line 920 of file RakPeer.cpp.

References GetSystemList(), and DataStructures::List< list_type >::Size().

void RakPeer::OnConnectedPong | ( | SLNet::Time | sendPingTime,
|  | SLNet::Time | sendPongTime,
|  | RemoteSystemStruct * | remoteSystem
| ) |  |

protected

Definition at line 4377 of file RakPeer.cpp.

References SLNet::RakPeer::PingAndClockDifferential::clockDifferential, SLNet::GetTime(), SLNet::RakPeer::RemoteSystemStruct::lowestPing, SLNet::PING_TIMES_ARRAY_SIZE, SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferential, SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferentialWriteIndex, and SLNet::RakPeer::PingAndClockDifferential::pingTime.

Referenced by RunUpdateCycle().

void RakPeer::OnConnectionRequest | ( | RakPeer::RemoteSystemStruct * | remoteSystem,
|  | SLNet::Time | incomingTimestamp
| ) |  |

protected

Definition at line 3524 of file RakPeer.cpp.

References SLNet::BitStream::GetData(), GetIndexFromSystemAddress(), SLNet::BitStream::GetNumberOfBitsUsed(), SLNet::GetTime(), SLNet::GetTimeUS(), ID_CONNECTION_REQUEST_ACCEPTED, IMMEDIATE_PRIORITY, ipList, MAXIMUM_NUMBER_OF_INTERNAL_IDS, RakAssert, RELIABLE_ORDERED, SendImmediate(), SLNet::RakPeer::RemoteSystemStruct::systemAddress, and SLNet::BitStream::Write().

Referenced by ParseConnectionRequestPacket(), and RunUpdateCycle().

void RakPeer::OnRNS2Recv | ( | RNS2RecvStruct * | recvStruct | ) |

protectedvirtual

Implements SLNet::RNS2EventHandler.

Definition at line 6230 of file RakPeer.cpp.

References incomingDatagramEventHandler, PushBufferedPacket(), quitAndDataEvents, and SLNet::SignaledEvent::SetEvent().

void RakPeer::ParseConnectionRequestPacket | ( | RakPeer::RemoteSystemStruct * | remoteSystem,
|  | const SystemAddress & | systemAddress,
|  | const char * | data,
|  | int | byteSize
| ) |  |

protected

Parse out a connection request packet.

Definition at line 3431 of file RakPeer.cpp.

References BITS_TO_BYTES, CAT_AUDIT_PRINTF, SLNet::RakPeer::RemoteSystemStruct::connectMode, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY, SLNet::BitStream::GetData(), GetGuidFromSystemAddress(), SLNet::BitStream::GetNumberOfBytesUsed(), SLNet::BitStream::GetReadOffset(), SLNet::GetTimeUS(), SLNet::RakPeer::RemoteSystemStruct::HANDLING_CONNECTION_REQUEST, ID_INVALID_PASSWORD, ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY, SLNet::BitStream::IgnoreBytes(), IMMEDIATE_PRIORITY, incomingPassword, incomingPasswordLength, OnConnectionRequest(), SLNet::BitStream::Read(), SLNet::BitStream::ReadAlignedBytes(), SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, RELIABLE, SendImmediate(), SLNet::UNASSIGNED_SYSTEM_ADDRESS, and SLNet::BitStream::Write().

Referenced by RunUpdateCycle().

void RakPeer::Ping | ( | const SystemAddress | target | ) |

virtual

Send a ping to the specified connected system.

Precondition
  The sender and recipient must already be started via a successful call to Startup()

Parameters

  [in] | target | Which system to ping

Implements SLNet::RakPeerInterface.

Definition at line 2062 of file RakPeer.cpp.

References PingInternal(), and UNRELIABLE.

bool RakPeer::Ping | ( | const char * | host,
|  | unsigned short | remotePort,
|  | bool | onlyReplyOnAcceptingConnections,
|  | unsigned | connectionSocketIndex = `0`
| ) |  |

virtual

Send a ping to the specified unconnected system.

The remote system, if it is Initialized, will respond with ID_PONG followed by sizeof(SLNet::TimeMS) containing the system time the ping was sent. Default is 4 bytes - See __GET_TIME_64BIT in types.h System should reply with ID_PONG if it is active

Parameters

  [in] | host | Either a dotted IP address or a domain name. Can be 255.255.255.255 for LAN broadcast.
  [in] | remotePort | Which port to connect to on the remote machine.
  [in] | onlyReplyOnAcceptingConnections | Only request a reply if the remote system is accepting connections
  [in] | connectionSocketIndex | Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to send on.

Returns
  true on success, false on failure (unknown hostname)

Implements SLNet::RakPeerInterface.

Definition at line 2079 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::RNS2_SendParameters::data, SLNet::SystemAddress::FixForIPVersion(), SLNet::SystemAddress::FromStringExplicitPort(), GetMyGUID(), GetRakNetSocketFromUserConnectionSocketIndex(), SLNet::GetTime(), ID_UNCONNECTED_PING, ID_UNCONNECTED_PING_OPEN_CONNECTIONS, SLNet::RNS2_SendParameters::length, OFFLINE_MESSAGE_DATA_ID, pluginListNTS, RakAssert, DataStructures::List< list_type >::Size(), socketList, SLNet::RNS2_SendParameters::systemAddress, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

void RakPeer::PingInternal | ( | const SystemAddress | target,
|  | bool | performImmediate,
|  | PacketReliability | reliability
| ) |  |

protected

Definition at line 4087 of file RakPeer.cpp.

References SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfBitsUsed(), SLNet::GetTime(), SLNet::GetTimeUS(), ID_CONNECTED_PING, IMMEDIATE_PRIORITY, IsActive(), return, Send(), SendImmediate(), and SLNet::BitStream::Write().

Referenced by Ping(), and RunUpdateCycle().

RNS2RecvStruct * RakPeer::PopBufferedPacket | ( | void |  | ) |

protected

Definition at line 4074 of file RakPeer.cpp.

References bufferedPacketsQueue, bufferedPacketsQueueMutex, SLNet::SimpleMutex::Lock(), DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Size(), and SLNet::SimpleMutex::Unlock().

Referenced by RunUpdateCycle().

void RakPeer::PushBackPacket | ( | Packet * | packet,
|  | bool | pushAtHead
| ) |  |

virtual

Puts a message back in the receive queue in case you don't want to deal with it immediately.

Parameters

  [in] | packet | The pointer to the packet you want to push back.
  [in] | pushAtHead | True to push the packet at the start of the queue so that the next receive call returns it. False to push it at the end of the queue.

Note
  Setting pushAtHead to false end makes the packets out of order.

Implements SLNet::RakPeerInterface.

Definition at line 2810 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::Packet::bitSize, SLNet::Packet::data, SLNet::SimpleMutex::Lock(), packetReturnMutex, packetReturnQueue, pluginListNTS, pluginListTS, DataStructures::Queue< queue_type >::Push(), DataStructures::Queue< queue_type >::PushAtHead(), DataStructures::List< list_type >::Size(), SLNet::Packet::systemAddress, and SLNet::SimpleMutex::Unlock().

Referenced by SendLoopback().

void RakPeer::PushBufferedPacket | ( | RNS2RecvStruct * | p | ) |

protected

Definition at line 4067 of file RakPeer.cpp.

References _FILE_AND_LINE_, bufferedPacketsQueue, bufferedPacketsQueueMutex, SLNet::SimpleMutex::Lock(), DataStructures::Queue< queue_type >::Push(), and SLNet::SimpleMutex::Unlock().

Referenced by OnRNS2Recv().

SLNet::RakPeer::RAK_THREAD_DECLARATION | ( | UpdateNetworkLoop |  | ) |

protected

SLNet::RakPeer::RAK_THREAD_DECLARATION | ( | UDTConnect |  | ) |

protected

Packet * RakPeer::Receive | ( | void |  | ) |

virtual

Gets a message from the incoming message queue.

Use DeallocatePacket() to deallocate the message after you are done with it. User-thread functions, such as RPC calls and the plugin function PluginInterface::Update occur here.

Returns
  0 if no packets are waiting to be handled, otherwise a pointer to a packet.

Note
  COMMON MISTAKE: Be sure to call this in a loop, once per game tick, until it returns 0. If you only process one packet per game tick they will buffer up.

See Also
  types.h contains struct Packet.

Implements SLNet::RakPeerInterface.

Definition at line 1476 of file RakPeer.cpp.

References CallPluginCallbacks(), SLNet::Packet::data, DeallocatePacket(), ID_TIMESTAMP, IsActive(), DataStructures::Queue< queue_type >::IsEmpty(), SLNet::Packet::length, SLNet::SimpleMutex::Lock(), packetReturnMutex, packetReturnQueue, pluginListNTS, pluginListTS, DataStructures::Queue< queue_type >::Pop(), RakAssert, SLNet::RR_STOP_PROCESSING, SLNet::RR_STOP_PROCESSING_AND_DEALLOCATE, ShiftIncomingTimestamp(), DataStructures::List< list_type >::Size(), SLNet::Packet::systemAddress, and SLNet::SimpleMutex::Unlock().

void RakPeer::ReferenceRemoteSystem | ( | const SystemAddress & | sa,
|  | unsigned int | remoteSystemListIndex
| ) |  |

protected

Definition at line 3790 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::MemoryPool< MemoryBlockType >::Allocate(), DereferenceRemoteSystem(), GetRemoteSystem(), GetRemoteSystemIndex(), SLNet::RemoteSystemIndex::index, SLNet::RemoteSystemIndex::next, RakAssert, remoteSystemIndexPool, remoteSystemList, remoteSystemLookup, RemoteSystemLookupHashIndex(), SLNet::RakPeer::RemoteSystemStruct::systemAddress, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by AssignSystemAddressToRemoteSystemList(), and RunUpdateCycle().

void RakPeer::ReleaseSockets | ( | DataStructures::List< RakNetSocket2 * > & | sockets | ) |

virtual

Implements SLNet::RakPeerInterface.

Definition at line 2916 of file RakPeer.cpp.

References _FILE_AND_LINE_, and DataStructures::List< list_type >::Clear().

unsigned int RakPeer::RemoteSystemLookupHashIndex | ( | const SystemAddress & | sa | ) | const

protected

Definition at line 3785 of file RakPeer.cpp.

References maximumNumberOfPeers, REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE, and SLNet::SystemAddress::ToInteger().

Referenced by DereferenceRemoteSystem(), GetRemoteSystemIndex(), and ReferenceRemoteSystem().

void RakPeer::RemoveFromActiveSystemList | ( | const SystemAddress & | sa | ) |

protected

Definition at line 3929 of file RakPeer.cpp.

References activeSystemList, activeSystemListSize, RakAssert, and SLNet::RakPeer::RemoteSystemStruct::systemAddress.

Referenced by CloseConnectionInternal().

void RakPeer::RemoveFromBanList | ( | const char * | IP | ) |

virtual

Allows a previously banned IP to connect. param[in] Dotted IP address. You can use * as a wildcard. An IP such as 128.0.0.* will ban all IP addresses starting with 128.0.0.

Implements SLNet::RakPeerInterface.

Definition at line 1902 of file RakPeer.cpp.

References _FILE_AND_LINE_, banList, banListMutex, SLNet::RakPeer::BanStruct::IP, SLNet::SimpleMutex::Lock(), SLNet::OP_DELETE(), rakFree_Ex, DataStructures::List< list_type >::RemoveAtIndex(), return, DataStructures::List< list_type >::Size(), and SLNet::SimpleMutex::Unlock().

void RakPeer::RemoveFromSecurityExceptionList | ( | const char * | ip | ) |

virtual

Remove a specific connection previously added via AddToSecurityExceptionList.

Parameters

  [in] | ip | IP address to remove. Pass 0 to remove all IP addresses. * wildcards are supported.

Implements SLNet::RakPeerInterface.

Definition at line 845 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::List< list_type >::Clear(), SLNet::SimpleMutex::Lock(), DataStructures::List< list_type >::RemoveAtIndex(), securityExceptionList, securityExceptionMutex, DataStructures::List< list_type >::Size(), and SLNet::SimpleMutex::Unlock().

void RakPeer::ResetSendReceipt | ( | void |  | ) |

protected

Definition at line 4370 of file RakPeer.cpp.

References SLNet::SimpleMutex::Lock(), sendReceiptSerial, sendReceiptSerialMutex, and SLNet::SimpleMutex::Unlock().

Referenced by Shutdown().

bool RakPeer::RunUpdateCycle | ( | BitStream & | updateBitStream | ) |

virtual

Implements SLNet::RakPeerInterface.

Definition at line 5540 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::ReliabilityLayer::AckTimeout(), SLNet::RakPeer::RequestedConnectionStruct::actionToTake, activeSystemList, activeSystemListSize, AddPacketToProducer(), SLNet::SystemAddress::address, AddToBanList(), DataStructures::ThreadsafeAllocatingQueue< structureType >::Allocate(), AllocPacket(), allowConnectionResponseIPMigration, SLNet::ReliabilityLayer::AreAcksWaiting(), SLNet::RakPeer::BufferedCommandStruct::BCS_CHANGE_SYSTEM_ADDRESS, SLNet::RakPeer::BufferedCommandStruct::BCS_CLOSE_CONNECTION, SLNet::RakPeer::BufferedCommandStruct::BCS_GET_SOCKET, SLNet::RakPeer::BufferedCommandStruct::BCS_SEND, BITS_TO_BYTES, SLNet::Packet::bitSize, SLNet::RakPeer::BufferedCommandStruct::broadcast, bufferedCommands, SLNet::RNS2RecvStruct::bytesRead, CAT_AUDIT_PRINTF, DataStructures::List< list_type >::Clear(), CloseConnectionInternal(), SLNet::RakPeer::BufferedCommandStruct::command, SLNet::RakPeer::RequestedConnectionStruct::CONNECT, SLNet::RakPeer::RemoteSystemStruct::CONNECTED, SLNet::RakPeer::BufferedCommandStruct::connectionMode, SLNet::RakPeer::RemoteSystemStruct::connectionTime, SLNet::RakPeer::RemoteSystemStruct::connectMode, SLNet::RNS2_SendParameters::data, SLNet::RNS2RecvStruct::data, SLNet::Packet::data, SLNet::RakPeer::RequestedConnectionStruct::data, SLNet::RakPeer::BufferedCommandStruct::data, DataStructures::ThreadsafeAllocatingQueue< structureType >::Deallocate(), DeallocRNS2RecvStruct(), SLNet::SystemAddress::debugPort, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ASAP, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ON_NO_ACK, firstExternalID, SLNet::SystemAddress::FixForIPVersion(), SLNet::RakNetSocket2::GetBoundAddress(), SLNet::BitStream::GetData(), GetIndexFromSystemAddress(), SLNet::BitStream::GetNumberOfBitsUsed(), SLNet::BitStream::GetNumberOfBytesUsed(), GetRemoteSystem(), GetRemoteSystemIndex(), SLNet::ReliabilityLayer::GetStatistics(), SLNet::GetTime(), SLNet::ReliabilityLayer::GetTimeoutTime(), SLNet::GetTimeUS(), SLNet::Packet::guid, SLNet::RakPeer::RemoteSystemStruct::guid, SLNet::RakPeer::RemoteSystemStruct::HANDLING_CONNECTION_REQUEST, ID_CONNECTED_PING, ID_CONNECTED_PONG, ID_CONNECTION_ATTEMPT_FAILED, ID_CONNECTION_LOST, ID_CONNECTION_REQUEST, ID_CONNECTION_REQUEST_ACCEPTED, ID_DETECT_LOST_CONNECTIONS, ID_DISCONNECTION_NOTIFICATION, ID_INVALID_PASSWORD, ID_NEW_INCOMING_CONNECTION, ID_OPEN_CONNECTION_REQUEST_1, ID_SND_RECEIPT_ACKED, ID_SND_RECEIPT_LOSS, ID_TIMESTAMP, SLNet::BitStream::IgnoreBits(), SLNet::BitStream::IgnoreBytes(), IMMEDIATE_PRIORITY, ipList, SLNet::RakPeer::RemoteSystemStruct::isActive, SLNet::RakNetSocket2::IsBerkleySocket(), SLNet::ReliabilityLayer::IsDeadConnection(), DataStructures::Queue< queue_type >::IsEmpty(), SLNet::ReliabilityLayer::IsOutgoingDataWaiting(), SLNet::AddressOrGUID::IsUndefined(), SLNet::RakPeer::RemoteSystemStruct::lastReliableSend, SLNet::RNS2_SendParameters::length, SLNet::SimpleMutex::Lock(), LOW_PRIORITY, SLNet::RakPeer::RemoteSystemStruct::lowestPing, MAXIMUM_MTU_SIZE, MAXIMUM_NUMBER_OF_INTERNAL_IDS, maxOutgoingBPS, SLNet::RakNetStatistics::messagesInResendBuffer, SLNet::RakPeer::RemoteSystemStruct::MTUSize, mtuSizes, SLNet::RakPeer::RemoteSystemStruct::myExternalSystemAddress, SLNet::RakPeer::RemoteSystemStruct::nextPingTime, SLNet::RakPeer::RequestedConnectionStruct::nextRequestTime, SLNet::RakPeer::RemoteSystemStruct::NO_ACTION, NUM_MTU_SIZES, SLNet::RakPeer::BufferedCommandStruct::numberOfBitsToSend, occasionalPing, OFFLINE_MESSAGE_DATA_ID, OnConnectedPong(), OnConnectionRequest(), SLNet::OP_DELETE(), SLNet::RakPeer::BufferedCommandStruct::orderingChannel, SLNet::BitStream::PadWithZeroToByteLength(), ParseConnectionRequestPacket(), PingInternal(), pluginListNTS, PopBufferedPacket(), DataStructures::ThreadsafeAllocatingQueue< structureType >::PopInaccurate(), SLNet::RakPeer::BufferedCommandStruct::priority, ProcessNetworkPacket, DataStructures::ThreadsafeAllocatingQueue< structureType >::Push(), DataStructures::List< list_type >::Push(), quitAndDataEvents, RakAssert, rakFree_Ex, RAKNET_DEBUG_PRINTF, RAKNET_PROTOCOL_VERSION, SLNet::AddressOrGUID::rakNetGuid, SLNet::RakPeer::RemoteSystemStruct::rakNetSocket, SLNet::BitStream::Read(), SLNet::RakPeer::BufferedCommandStruct::receipt, SLNet::ReliabilityLayer::Receive(), ReferenceRemoteSystem(), SLNet::RakPeer::BufferedCommandStruct::reliability, SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, RELIABLE, RELIABLE_ORDERED, SLNet::RakPeer::RemoteSystemStruct::remoteSystemIndex, DataStructures::Queue< queue_type >::RemoveAtIndex(), SLNet::RakPeer::RemoteSystemStruct::REQUESTED_CONNECTION, requestedConnectionQueue, requestedConnectionQueueMutex, SLNet::RakPeer::RequestedConnectionStruct::requestsMade, rnr, SLNet::RNS2T_WINDOWS, SLNet::RakNetSocket2::Send(), SLNet::RakPeer::RequestedConnectionStruct::sendConnectionAttemptCount, SendImmediate(), SLNet::SignaledEvent::SetEvent(), DataStructures::Queue< queue_type >::Size(), DataStructures::List< list_type >::Size(), SLNet::RakNetGUID::size(), SLNet::RNS2RecvStruct::socket, SLNet::RakPeer::RequestedConnectionStruct::socket, SLNet::RakPeer::RequestedConnectionStruct::socketIndex, socketList, socketQueryOutput, SLNet::RakPeer::SocketQueryOutput::sockets, SLNet::RNS2_SendParameters::systemAddress, SLNet::RNS2RecvStruct::systemAddress, SLNet::AddressOrGUID::systemAddress, SLNet::Packet::systemAddress, SLNet::RakPeer::RemoteSystemStruct::systemAddress, SLNet::RakPeer::RequestedConnectionStruct::systemAddress, SLNet::RakPeer::BufferedCommandStruct::systemIdentifier, SLNet::SystemAddress::systemIndex, SLNet::RakNetGUID::systemIndex, SLNet::RakPeer::RemoteSystemStruct::theirInternalSystemAddress, SLNet::RakPeer::RequestedConnectionStruct::timeBetweenSendConnectionAttemptsMS, SLNet::RNS2RecvStruct::timeRead, SLNet::SystemAddress::ToString(), UDP_HEADER_SIZE, SLNet::UNASSIGNED_SYSTEM_ADDRESS, SLNet::SimpleMutex::Unlock(), UNRELIABLE, SLNet::RakPeer::RemoteSystemStruct::UNVERIFIED_SENDER, SLNet::ReliabilityLayer::Update(), SLNet::BitStream::Write(), and SLNet::BitStream::WriteAlignedBytes().

Referenced by RAK_THREAD_DECLARATION().

uint32_t RakPeer::Send | ( | const char * | data,
|  | const int | length,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast,
|  | uint32_t | forceReceiptNumber = `0`
| ) |  |

virtual

Sends a block of data to the specified system that you are connected to.

Note
  This function only works while connected.
  The first byte should be a message identifier starting at ID_USER_PACKET_ENUM.

Parameters

  [in] | data | Block of data to send.
  [in] | length | Size in bytes of the data to send.
  [in] | priority | Priority level to send on. See PacketPriority.h
  [in] | reliability | How reliably to send this data. See PacketPriority.h
  [in] | orderingChannel | When using ordered or sequenced messages, the channel to order these on. Messages are only ordered relative to other messages on the same stream.
  [in] | systemIdentifier | Who to send this packet to, or in the case of broadcasting who not to send it to. Pass either a SystemAddress structure or a RakNetGUID structure. Use UNASSIGNED_SYSTEM_ADDRESS or to specify none
  [in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to.
  [in] | forceReceipt | If 0, will automatically determine the receipt number to return. If non-zero, will return what you give it.

Returns
  0 on bad input. Otherwise a number that identifies this message. If reliability is a type that returns a receipt, on a later call to Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS with bytes 1-4 inclusive containing this number

Implements SLNet::RakPeerInterface.

Definition at line 1308 of file RakPeer.cpp.

References endThreads, ID_SND_RECEIPT_ACKED, IncrementNextSendReceipt(), IsLoopbackAddress(), SLNet::AddressOrGUID::IsUndefined(), SLNet::SimpleMutex::Lock(), SLNet::RakPeer::RemoteSystemStruct::NO_ACTION, NUMBER_OF_ORDERED_STREAMS, NUMBER_OF_PRIORITIES, NUMBER_OF_RELIABILITIES, RakAssert, remoteSystemList, SendBuffered(), SendLoopback(), sendReceiptSerial, sendReceiptSerialMutex, SLNet::SimpleMutex::Unlock(), and UNRELIABLE_WITH_ACK_RECEIPT.

Referenced by PingInternal().

uint32_t RakPeer::Send | ( | const SLNet::BitStream * | bitStream,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast,
|  | uint32_t | forceReceiptNumber = `0`
| ) |  |

virtual

Sends a block of data to the specified system that you are connected to.

Same as the above version, but takes a BitStream as input.

Parameters

  [in] | bitStream | Bitstream to send
  [in] | priority | Priority level to send on. See PacketPriority.h
  [in] | reliability | How reliably to send this data. See PacketPriority.h
  [in] | orderingChannel | Channel to order the messages on, when using ordered or sequenced messages. Messages are only ordered relative to other messages on the same stream.
  [in] | systemIdentifier | System Address or RakNetGUID to send this packet to, or in the case of broadcasting, the address not to send it to. Use UNASSIGNED_SYSTEM_ADDRESS to specify none.
  [in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to.
  [in] | forceReceipt | If 0, will automatically determine the receipt number to return. If non-zero, will return what you give it.

Returns
  0 on bad input. Otherwise a number that identifies this message. If reliability is a type that returns a receipt, on a later call to Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS with bytes 1-4 inclusive containing this number

Note
  COMMON MISTAKE: When writing the first byte, bitStream->Write((unsigned char) ID_MY_TYPE) be sure it is casted to a byte, and you are not writing a 4 byte enumeration.

Implements SLNet::RakPeerInterface.

Definition at line 1366 of file RakPeer.cpp.

References endThreads, SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfBitsUsed(), SLNet::BitStream::GetNumberOfBytesUsed(), ID_SND_RECEIPT_ACKED, IncrementNextSendReceipt(), IsLoopbackAddress(), SLNet::AddressOrGUID::IsUndefined(), SLNet::SimpleMutex::Lock(), SLNet::RakPeer::RemoteSystemStruct::NO_ACTION, NUMBER_OF_ORDERED_STREAMS, NUMBER_OF_PRIORITIES, NUMBER_OF_RELIABILITIES, RakAssert, remoteSystemList, SendBuffered(), SendLoopback(), sendReceiptSerial, sendReceiptSerialMutex, SLNet::SimpleMutex::Unlock(), and UNRELIABLE_WITH_ACK_RECEIPT.

void RakPeer::SendBuffered | ( | const char * | data,
|  | BitSize_t | numberOfBitsToSend,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast,
|  | RemoteSystemStruct::ConnectMode | connectionMode,
|  | uint32_t | receipt
| ) |  |

protected

Definition at line 4173 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::ThreadsafeAllocatingQueue< structureType >::Allocate(), SLNet::RakPeer::BufferedCommandStruct::BCS_SEND, BITS_TO_BYTES, SLNet::RakPeer::BufferedCommandStruct::broadcast, bufferedCommands, SLNet::RakPeer::BufferedCommandStruct::command, SLNet::RakPeer::BufferedCommandStruct::connectionMode, SLNet::RakPeer::BufferedCommandStruct::data, DataStructures::ThreadsafeAllocatingQueue< structureType >::Deallocate(), IMMEDIATE_PRIORITY, notifyOutOfMemory, NUMBER_OF_ORDERED_STREAMS, NUMBER_OF_PRIORITIES, NUMBER_OF_RELIABILITIES, SLNet::RakPeer::BufferedCommandStruct::numberOfBitsToSend, SLNet::RakPeer::BufferedCommandStruct::orderingChannel, SLNet::RakPeer::BufferedCommandStruct::priority, DataStructures::ThreadsafeAllocatingQueue< structureType >::Push(), quitAndDataEvents, RakAssert, rakMalloc_Ex, SLNet::RakPeer::BufferedCommandStruct::receipt, SLNet::RakPeer::BufferedCommandStruct::reliability, SLNet::SignaledEvent::SetEvent(), and SLNet::RakPeer::BufferedCommandStruct::systemIdentifier.

Referenced by NotifyAndFlagForShutdown(), and Send().

void RakPeer::SendBufferedList | ( | const char ** | data,
|  | const int * | lengths,
|  | const int | numParameters,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast,
|  | RemoteSystemStruct::ConnectMode | connectionMode,
|  | uint32_t | receipt
| ) |  |

protected

Definition at line 4209 of file RakPeer.cpp.

References _FILE_AND_LINE_, DataStructures::ThreadsafeAllocatingQueue< structureType >::Allocate(), SLNet::RakPeer::BufferedCommandStruct::BCS_SEND, SLNet::RakPeer::BufferedCommandStruct::broadcast, bufferedCommands, BYTES_TO_BITS, SLNet::RakPeer::BufferedCommandStruct::command, SLNet::RakPeer::BufferedCommandStruct::connectionMode, SLNet::RakPeer::BufferedCommandStruct::data, IMMEDIATE_PRIORITY, IsLoopbackAddress(), notifyOutOfMemory, NUMBER_OF_ORDERED_STREAMS, NUMBER_OF_PRIORITIES, NUMBER_OF_RELIABILITIES, SLNet::RakPeer::BufferedCommandStruct::numberOfBitsToSend, SLNet::RakPeer::BufferedCommandStruct::orderingChannel, SLNet::RakPeer::BufferedCommandStruct::priority, DataStructures::ThreadsafeAllocatingQueue< structureType >::Push(), quitAndDataEvents, RakAssert, rakFree_Ex, rakMalloc_Ex, SLNet::RakPeer::BufferedCommandStruct::receipt, SLNet::RakPeer::BufferedCommandStruct::reliability, SendLoopback(), SLNet::SignaledEvent::SetEvent(), and SLNet::RakPeer::BufferedCommandStruct::systemIdentifier.

Referenced by SendList().

ConnectionAttemptResult RakPeer::SendConnectionRequest | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | passwordData,
|  | int | passwordDataLength,
|  | PublicKey * | publicKey,
|  | unsigned | connectionSocketIndex,
|  | unsigned int | extraData,
|  | unsigned | sendConnectionAttemptCount,
|  | unsigned | timeBetweenSendConnectionAttemptsMS,
|  | SLNet::TimeMS | timeoutTime,
|  | RakNetSocket2 * | socket
| ) |  |

protected

Definition at line 3306 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::RakPeer::RequestedConnectionStruct::actionToTake, SLNet::ALREADY_CONNECTED_TO_ENDPOINT, SLNet::RakPeer::RequestedConnectionStruct::CONNECT, SLNet::CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS, SLNet::CONNECTION_ATTEMPT_STARTED, SLNet::RakPeer::RequestedConnectionStruct::data, SLNet::RakPeer::RequestedConnectionStruct::extraData, SLNet::SystemAddress::FromStringExplicitPort(), GetRemoteSystemFromSystemAddress(), SLNet::GetTimeMS(), SLNet::SimpleMutex::Lock(), SLNet::RakPeer::RequestedConnectionStruct::nextRequestTime, SLNet::OP_DELETE(), SLNet::RakPeer::RequestedConnectionStruct::outgoingPassword, SLNet::RakPeer::RequestedConnectionStruct::outgoingPasswordLength, DataStructures::Queue< queue_type >::Push(), RakAssert, requestedConnectionQueue, requestedConnectionQueueMutex, SLNet::RakPeer::RequestedConnectionStruct::requestsMade, SLNet::SECURITY_INITIALIZATION_FAILED, SLNet::RakPeer::RequestedConnectionStruct::sendConnectionAttemptCount, DataStructures::Queue< queue_type >::Size(), SLNet::RakPeer::RequestedConnectionStruct::socket, SLNet::RakPeer::RequestedConnectionStruct::socketIndex, SLNet::RakPeer::RequestedConnectionStruct::systemAddress, SLNet::RakPeer::RequestedConnectionStruct::timeBetweenSendConnectionAttemptsMS, SLNet::RakPeer::RequestedConnectionStruct::timeoutTime, and SLNet::SimpleMutex::Unlock().

Referenced by Connect(), and ConnectWithSocket().

ConnectionAttemptResult RakPeer::SendConnectionRequest | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | passwordData,
|  | int | passwordDataLength,
|  | PublicKey * | publicKey,
|  | unsigned | connectionSocketIndex,
|  | unsigned int | extraData,
|  | unsigned | sendConnectionAttemptCount,
|  | unsigned | timeBetweenSendConnectionAttemptsMS,
|  | SLNet::TimeMS | timeoutTime
| ) |  |

protected

Definition at line 3250 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::RakPeer::RequestedConnectionStruct::actionToTake, SLNet::ALREADY_CONNECTED_TO_ENDPOINT, SLNet::CANNOT_RESOLVE_DOMAIN_NAME, CAT_AUDIT_PRINTF, SLNet::RakPeer::RequestedConnectionStruct::CONNECT, SLNet::CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS, SLNet::CONNECTION_ATTEMPT_STARTED, SLNet::RakPeer::RequestedConnectionStruct::data, SLNet::RakPeer::RequestedConnectionStruct::extraData, SLNet::SystemAddress::FromStringExplicitPort(), GetRemoteSystemFromSystemAddress(), SLNet::GetTimeMS(), SLNet::SimpleMutex::Lock(), SLNet::RakPeer::RequestedConnectionStruct::nextRequestTime, SLNet::OP_DELETE(), SLNet::RakPeer::RequestedConnectionStruct::outgoingPassword, SLNet::RakPeer::RequestedConnectionStruct::outgoingPasswordLength, DataStructures::Queue< queue_type >::Push(), RakAssert, requestedConnectionQueue, requestedConnectionQueueMutex, SLNet::RakPeer::RequestedConnectionStruct::requestsMade, SLNet::SECURITY_INITIALIZATION_FAILED, SLNet::RakPeer::RequestedConnectionStruct::sendConnectionAttemptCount, DataStructures::Queue< queue_type >::Size(), SLNet::RakPeer::RequestedConnectionStruct::socket, SLNet::RakPeer::RequestedConnectionStruct::socketIndex, socketList, SLNet::RakPeer::RequestedConnectionStruct::systemAddress, SLNet::RakPeer::RequestedConnectionStruct::timeBetweenSendConnectionAttemptsMS, SLNet::RakPeer::RequestedConnectionStruct::timeoutTime, and SLNet::SimpleMutex::Unlock().

bool RakPeer::SendImmediate | ( | char * | data,
|  | BitSize_t | numberOfBitsToSend,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast,
|  | bool | useCallerDataAllocation,
|  | SLNet::TimeUS | currentTime,
|  | uint32_t | receipt
| ) |  |

protected

Definition at line 4270 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ASAP, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY, SLNet::RakPeer::RemoteSystemStruct::DISCONNECT_ON_NO_ACK, GetIndexFromSystemAddress(), GetSystemIndexFromGuid(), SLNet::RakPeer::RemoteSystemStruct::lastReliableSend, maximumNumberOfPeers, rakFree_Ex, rakMalloc_Ex, SLNet::AddressOrGUID::rakNetGuid, SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, RELIABLE, RELIABLE_ORDERED, RELIABLE_ORDERED_WITH_ACK_RECEIPT, RELIABLE_SEQUENCED, RELIABLE_WITH_ACK_RECEIPT, remoteSystemList, SLNet::ReliabilityLayer::Send(), SLNet::AddressOrGUID::systemAddress, SLNet::UNASSIGNED_RAKNET_GUID(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by NotifyAndFlagForShutdown(), OnConnectionRequest(), ParseConnectionRequestPacket(), PingInternal(), SLNet::ProcessOfflineNetworkPacket(), and RunUpdateCycle().

uint32_t RakPeer::SendList | ( | const char ** | data,
|  | const int * | lengths,
|  | const int | numParameters,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast,
|  | uint32_t | forceReceiptNumber = `0`
| ) |  |

virtual

Sends multiple blocks of data, concatenating them automatically.

This is equivalent to: SLNet::BitStream bs; bs.WriteAlignedBytes(block1, blockLength1); bs.WriteAlignedBytes(block2, blockLength2); bs.WriteAlignedBytes(block3, blockLength3); Send(&bs, ...)

This function only works when connected.

Parameters

  [in] | data | An array of pointers to blocks of data
  [in] | lengths | An array of integers indicating the length of each block of data
  [in] | numParameters | Length of the arrays data and lengths
  [in] | priority | Priority level to send on. See PacketPriority.h
  [in] | reliability | How reliably to send this data. See PacketPriority.h
  [in] | orderingChannel | Channel to order the messages on, when using ordered or sequenced messages. Messages are only ordered relative to other messages on the same stream.
  [in] | systemIdentifier | System Address or RakNetGUID to send this packet to, or in the case of broadcasting, the address not to send it to. Use UNASSIGNED_SYSTEM_ADDRESS to specify none.
  [in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to.
  [in] | forceReceipt | If 0, will automatically determine the receipt number to return. If non-zero, will return what you give it.

Returns
  0 on bad input. Otherwise a number that identifies this message. If reliability is a type that returns a receipt, on a later call to Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS with bytes 1-4 inclusive containing this number

Implements SLNet::RakPeerInterface.

Definition at line 1434 of file RakPeer.cpp.

References endThreads, IncrementNextSendReceipt(), SLNet::AddressOrGUID::IsUndefined(), SLNet::RakPeer::RemoteSystemStruct::NO_ACTION, RakAssert, remoteSystemList, and SendBufferedList().

void RakPeer::SendLoopback | ( | const char * | data,
|  | const int | length
| ) |  |

virtual

"Send" to yourself rather than a remote system.

The message will be processed through the plugins and returned to the game as usual. This function works anytime

Note
  The first byte should be a message identifier starting at ID_USER_PACKET_ENUM

Parameters

  [in] | data | Block of data to send.
  [in] | length | Size in bytes of the data to send.

Implements SLNet::RakPeerInterface.

Definition at line 1354 of file RakPeer.cpp.

References _FILE_AND_LINE_, AllocPacket(), SLNet::Packet::data, GetLoopbackAddress(), SLNet::Packet::guid, myGuid, PushBackPacket(), and SLNet::Packet::systemAddress.

Referenced by Send(), and SendBufferedList().

bool RakPeer::SendOutOfBand | ( | const char * | host,
|  | unsigned short | remotePort,
|  | const char * | data,
|  | BitSize_t | dataLength,
|  | unsigned | connectionSocketIndex = `0`
| ) |  |

virtual

Implements SLNet::RakPeerInterface.

Definition at line 2981 of file RakPeer.cpp.

References _FILE_AND_LINE_, BYTES_TO_BITS, SLNet::RNS2_SendParameters::data, SLNet::SystemAddress::FixForIPVersion(), SLNet::SystemAddress::FromStringExplicitPort(), SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfBytesUsed(), GetRakNetSocketFromUserConnectionSocketIndex(), IsActive(), SLNet::RNS2_SendParameters::length, MAX_OFFLINE_DATA_LENGTH, OFFLINE_MESSAGE_DATA_ID, pluginListNTS, RakAssert, DataStructures::List< list_type >::Size(), SLNet::RakNetGUID::size(), socketList, SLNet::RNS2_SendParameters::systemAddress, SLNet::BitStream::Write(), and WriteOutOfBandHeader().

Referenced by AdvertiseSystem().

void RakPeer::SendTTL | ( | const char * | host,
|  | unsigned short | remotePort,
|  | int | ttl,
|  | unsigned | connectionSocketIndex = `0`
| ) |  |

virtual

Send a message to a host, with the IP socket option TTL set to 3.

This message will not reach the host, but will open the router.

Parameters

  [in] | host | The address of the remote host in dotted notation.
  [in] | remotePort | The port number to send to.
  [in] | ttl | Max hops of datagram, set to 3
  [in] | connectionSocketIndex | userConnectionSocketIndex.

Remarks
  Used for NAT-Punchthrough

Implements SLNet::RakPeerInterface.

Definition at line 2715 of file RakPeer.cpp.

References _FILE_AND_LINE_, BYTES_TO_BITS, SLNet::RNS2_SendParameters::data, SLNet::SystemAddress::FixForIPVersion(), SLNet::SystemAddress::FromStringExplicitPort(), GetRakNetSocketFromUserConnectionSocketIndex(), SLNet::RNS2_SendParameters::length, pluginListNTS, DataStructures::List< list_type >::Size(), socketList, SLNet::RNS2_SendParameters::systemAddress, and SLNet::RNS2_SendParameters::ttl.

void RakPeer::SetIncomingDatagramEventHandler | ( | bool(*)(RNS2RecvStruct *) | _incomingDatagramEventHandler | ) |

virtual

Set a C callback to be called whenever a datagram arrives Return true from the callback to have RakPeer handle the datagram. Return false and RakPeer will ignore the datagram. This can be used to filter incoming datagrams by system, or to share a recvfrom socket with RakPeer RNS2RecvStruct will only remain valid for the duration of the call

Implements SLNet::RakPeerInterface.

Definition at line 2976 of file RakPeer.cpp.

References incomingDatagramEventHandler.

void RakPeer::SetIncomingPassword | ( | const char * | passwordData,
|  | int | passwordDataLength
| ) |  |

virtual

Sets the password for the incoming connections.

The password must match in the call to Connect (defaults to none). Pass 0 to passwordData to specify no password. This is a way to set a low level password for all incoming connections. To selectively reject connections, implement your own scheme using CloseConnection() to remove unwanted connections.

Parameters

  [in] | passwordData | A data block that incoming connections must match. This can be just a password, or can be a stream of data. Specify 0 for no password data
  [in] | passwordDataLength | The length in bytes of passwordData

Implements SLNet::RakPeerInterface.

Definition at line 938 of file RakPeer.cpp.

References incomingPassword, and incomingPasswordLength.

void RakPeer::SetInternalID | ( | SystemAddress | systemAddress,
|  | int | index = `0`
| ) |  |

virtual

Sets your internal IP address, for platforms that do not support reading it, or to override a value.

Parameters

  [in] | systemAddress. | The address to set. Use SystemAddress::FromString() if you want to use a dotted string
  [in] | index | When you have multiple internal IDs, which index to set?

Implements SLNet::RakPeerInterface.

Definition at line 2325 of file RakPeer.cpp.

References ipList, MAXIMUM_NUMBER_OF_INTERNAL_IDS, and RakAssert.

void RakPeer::SetLimitIPConnectionFrequency | ( | bool | b | ) |

virtual

Enable or disable allowing frequent connections from the same IP adderss.

This is a security measure which is disabled by default, but can be set to true to prevent attackers from using up all connection slots.

Parameters

  [in] | b | True to limit connections from the same ip to at most 1 per 100 milliseconds.

Implements SLNet::RakPeerInterface.

Definition at line 1957 of file RakPeer.cpp.

References limitConnectionFrequencyFromTheSameIP.

void RakPeer::SetMaximumIncomingConnections | ( | unsigned short | numberAllowed | ) |

virtual

Sets the maximum number of incoming connections allowed.

If the number of incoming connections is less than the number of players currently connected, no more players will be allowed to connect. If this is greater than the maximum number of peers allowed, it will be reduced to the maximum number of peers allowed.

Defaults to 0, meaning by default, nobody can connect to you

Parameters

  [in] | numberAllowed | Maximum number of incoming connections allowed.

Implements SLNet::RakPeerInterface.

Definition at line 902 of file RakPeer.cpp.

References maximumIncomingConnections.

void RakPeer::SetOccasionalPing | ( | bool | doPing | ) |

virtual

Ping the remote systems every so often, or not. Can be called anytime. By default this is true. Recommended to leave on, because congestion control uses it to determine how often to resend lost packets. It would be true by default to prevent timestamp drift, since in the event of a clock spike, the timestamp deltas would no longer be accurate

Parameters

  [in] | doPing | True to start occasional pings. False to stop them.

Implements SLNet::RakPeerInterface.

Definition at line 2207 of file RakPeer.cpp.

References occasionalPing.

void RakPeer::SetOfflinePingResponse | ( | const char * | data,
|  | const unsigned int | length
| ) |  |

virtual

Sets the data to send along with a LAN server discovery or offline ping reply.

Parameters

  [in] | data | Block of data to send, or 0 for none
  [in] | length | Length of the data in bytes, or 0 for none

Note
  length should be under 400 bytes, as a security measure against flood attacks

See Also
  Ping.cpp

Implements SLNet::RakPeerInterface.

Definition at line 2258 of file RakPeer.cpp.

References SLNet::SimpleMutex::Lock(), offlinePingResponse, offlinePingResponse_Mutex, RakAssert, rakPeerMutexes, SLNet::BitStream::Reset(), SLNet::SimpleMutex::Unlock(), and SLNet::BitStream::Write().

void RakPeer::SetPerConnectionOutgoingBandwidthLimit | ( | unsigned | maxBitsPerSecond | ) |

virtual

Limits how much outgoing bandwidth can be sent per-connection. This limit does not apply to the sum of all connections! Exceeding the limit queues up outgoing traffic

Parameters

  [in] | maxBitsPerSecond | Maximum bits per second to send. Use 0 for unlimited (default). Once set, it takes effect immedately and persists until called again.

Implements SLNet::RakPeerInterface.

Definition at line 2945 of file RakPeer.cpp.

References maxOutgoingBPS.

void RakPeer::SetSplitMessageProgressInterval | ( | int | interval | ) |

virtual

Controls how often to return ID_DOWNLOAD_PROGRESS for large message downloads.

ID_DOWNLOAD_PROGRESS is returned to indicate a new partial message chunk, roughly the MTU size, has arrived. As it can be slow or cumbersome to get this notification for every chunk, you can set the interval at which it is returned. Defaults to 0 (never return this notification).

Parameters

  [in] | interval | How many messages to use as an interval before a download progress notification is returned.

Implements SLNet::RakPeerInterface.

Definition at line 2681 of file RakPeer.cpp.

References maximumNumberOfPeers, RakAssert, remoteSystemList, and splitMessageProgressInterval.

void RakPeer::SetTimeoutTime | ( | SLNet::TimeMS | timeMS,
|  | const SystemAddress | target
| ) |  |

virtual

Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable message.

Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable message. Default time is 10,000 or 10 seconds in release and 30,000 or 30 seconds in debug. Do not set different values for different computers that are connected to each other, or you won't be able to reconnect after ID_CONNECTION_LOST

Parameters

  [in] | timeMS | Time, in MS
  [in] | target | SystemAddress structure of the target system. Pass UNASSIGNED_SYSTEM_ADDRESS for all systems.

Implements SLNet::RakPeerInterface.

Definition at line 2513 of file RakPeer.cpp.

References defaultTimeoutTime, GetRemoteSystemFromSystemAddress(), maximumNumberOfPeers, SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, remoteSystemList, SLNet::ReliabilityLayer::SetTimeoutTime(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

void RakPeer::SetUnreliableTimeout | ( | SLNet::TimeMS | timeoutMS | ) |

virtual

Set how long to wait before giving up on sending an unreliable message. Useful if the network is clogged up. Set to 0 or less to never timeout. Defaults to 0.

Parameters

  [in] | timeoutMS | How many ms to wait before simply not sending an unreliable message.

Implements SLNet::RakPeerInterface.

Definition at line 2703 of file RakPeer.cpp.

References maximumNumberOfPeers, remoteSystemList, and unreliableTimeout.

void RakPeer::SetupBufferedPackets | ( | void |  | ) |

protected

Definition at line 4063 of file RakPeer.cpp.

void RakPeer::SetUserUpdateThread | ( | void(*)(RakPeerInterface *, void *) | _userUpdateThreadPtr,
|  | void * | _userUpdateThreadData
| ) |  |

virtual

If you need code to run in the same thread as RakNet's update thread, this function can be used for that

Parameters

  [in] | _userUpdateThreadPtr | C callback function
  [in] | _userUpdateThreadData | Passed to C callback function

Implements SLNet::RakPeerInterface.

Definition at line 2970 of file RakPeer.cpp.

References userUpdateThreadData, and userUpdateThreadPtr.

void RakPeer::ShiftIncomingTimestamp | ( | unsigned char * | data,
|  | const SystemAddress & | systemAddress
| ) |  | const

protected

Adjust the timestamp of the incoming packet to be relative to this system.

Parameters

  [in] | data | Data in the incoming packet.
  [in] | systemAddress | Sender of the incoming packet.

Definition at line 3757 of file RakPeer.cpp.

References GetBestClockDifferential(), IsActive(), RakAssert, SLNet::BitStream::Read(), SLNet::BitStream::SetWriteOffset(), and SLNet::BitStream::Write().

Referenced by Receive().

void RakPeer::Shutdown | ( | unsigned int | blockDuration,
|  | unsigned char | orderingChannel = `0`,
|  | PacketPriority | disconnectionNotificationPriority = `LOW_PRIORITY`
| ) |  |

virtual

Stops the network threads and closes all connections.

Parameters

  [in] | blockDuration | Wait time(milli seconds) for all remaining messages to go out, including ID_DISCONNECTION_NOTIFICATION. If 0, it doesn't wait at all.
  [in] | orderingChannel | Channel on which ID_DISCONNECTION_NOTIFICATION will be sent, if blockDuration > 0.
  [in] | disconnectionNotificationPriority | Priority of sending ID_DISCONNECTION_NOTIFICATION. If set to 0, the disconnection notification won't be sent.

Implements SLNet::RakPeerInterface.

Definition at line 1041 of file RakPeer.cpp.

References _FILE_AND_LINE_, activeSystemList, activeSystemListSize, bytesReceivedPerSecond, bytesSentPerSecond, DataStructures::Queue< queue_type >::Clear(), DataStructures::MemoryPool< MemoryBlockType >::Clear(), ClearBufferedCommands(), ClearBufferedPackets(), ClearRemoteSystemLookup(), ClearRequestedConnectionList(), ClearSocketQueryOutput(), DeallocatePacket(), DerefAllSockets(), endThreads, SLNet::GetTimeMS(), SLNet::RakPeer::RemoteSystemStruct::isActive, isMainLoopThreadActive, SLNet::SimpleMutex::Lock(), MAXIMUM_MTU_SIZE, maximumNumberOfPeers, NotifyAndFlagForShutdown(), SLNet::OP_DELETE_ARRAY(), packetAllocationPool, packetAllocationPoolMutex, packetReturnMutex, packetReturnQueue, pluginListNTS, pluginListTS, quitAndDataEvents, RakAssert, SLNet::RakPeer::RemoteSystemStruct::rakNetSocket, RakSleep(), SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, remoteSystemList, SLNet::ReliabilityLayer::Reset(), ResetSendReceipt(), SLNet::SignaledEvent::SetEvent(), DataStructures::Queue< queue_type >::Size(), DataStructures::List< list_type >::Size(), socketList, and SLNet::SimpleMutex::Unlock().

Referenced by Startup(), and ~RakPeer().

StartupResult RakPeer::Startup | ( | unsigned int | maxConnections,
|  | SocketDescriptor * | socketDescriptors,
|  | unsigned | socketDescriptorCount,
|  | int | threadPriority = `-99999`
| ) |  |

virtual

Starts the network threads and opens the listen port.

You must call this before calling Connect().

Precondition
  On the PS3, call Startup() after Client_Login()

Note
  Multiple calls while already active are ignored. To call this function again with different settings, you must first call Shutdown().
  Call SetMaximumIncomingConnections if you want to accept incoming connections.

Parameters

  [in] | maxConnections | Maximum number of connections between this instance of RakPeer and another instance of RakPeer. Required so that the network can preallocate and for thread safety. A pure client would set this to 1. A pure server would set it to the number of allowed clients.A hybrid would set it to the sum of both types of connections.
  [in] | localPort | The port to listen for connections on. On linux the system may be set up so thast ports under 1024 are restricted for everything but the root user. Use a higher port for maximum compatibility.

  [in]

  socketDescriptors

  An array of SocketDescriptor structures to force RakNet to listen on a particular IP address or port (or both). Each SocketDescriptor will represent one unique socket. Do not pass redundant structures. To listen on a specific port, you can pass SocketDescriptor(myPort,0); such as for a server. For a client, it is usually OK to just pass SocketDescriptor(); However, on the XBOX be sure to use IPPROTO_VDP

  [in] | socketDescriptorCount | The size of the socketDescriptors array. Pass 1 if you are not sure what to pass.
  [in] | threadPriority | Passed to the thread creation routine. Use THREAD_PRIORITY_NORMAL for Windows. For Linux based systems, you MUST pass something reasonable based on the thread priorities for your application.

Returns
  RAKNET_STARTED on success, otherwise appropriate failure enumeration.

Implements SLNet::RakPeerInterface.

Definition at line 372 of file RakPeer.cpp.

References _FILE_AND_LINE_, activeSystemList, SLNet::RNS2_BerkleyBindParameters::addressFamily, SLNet::RakNetSocket2Allocator::AllocRNS2(), SLNet::ReliabilityLayer::ApplyNetworkSimulator(), SLNet::BR_FAILED_SEND_TEST, SLNet::BR_FAILED_TO_BIND_SOCKET, SLNet::BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE, SLNet::BR_SUCCESS, SLNet::SocketDescriptor::chromeInstance, ClearBufferedCommands(), ClearBufferedPackets(), ClearSocketQueryOutput(), SLNet::RakPeer::RemoteSystemStruct::connectMode, SLNet::COULD_NOT_GENERATE_GUID, SLNet::RakThread::Create(), SLNet::RakNetSocket2Allocator::DeallocRNS2(), defaultMTUSize, DerefAllSockets(), SLNet::RNS2_BerkleyBindParameters::doNotFragment, endThreads, SLNet::RakNetSocket2::eventHandler, SLNet::RNS2_BerkleyBindParameters::eventHandler, SLNet::SocketDescriptor::extraSocketOptions, SLNet::FAILED_TO_CREATE_NETWORK_THREAD, FillIPList(), firstExternalID, SLNet::RakNetGUID::g, GenerateGUID(), GenerateSeedFromGuid(), SLNet::RakPeer::RemoteSystemStruct::guid, SLNet::RNS2_BerkleyBindParameters::hostAddress, SLNet::INVALID_MAX_CONNECTIONS, SLNet::INVALID_SOCKET_DESCRIPTORS, ipList, IsActive(), SLNet::RakPeer::RemoteSystemStruct::isActive, SLNet::RakNetSocket2::IsBerkleySocket(), isMainLoopThreadActive, MAXIMUM_NUMBER_OF_INTERNAL_IDS, maximumIncomingConnections, maximumNumberOfPeers, SLNet::RakPeer::RemoteSystemStruct::MTUSize, SLNet::RakPeer::RemoteSystemStruct::myExternalSystemAddress, myGuid, SLNet::RakPeer::RemoteSystemStruct::NO_ACTION, SLNet::RNS2_BerkleyBindParameters::nonBlockingSocket, pluginListNTS, pluginListTS, SLNet::RNS2_BerkleyBindParameters::pollingThreadPriority, SLNet::SocketDescriptor::port, SLNet::RNS2_BerkleyBindParameters::port, SLNet::RNS2_BerkleyBindParameters::protocol, DataStructures::List< list_type >::Push(), RakAssert, SLNet::RAKNET_ALREADY_STARTED, SLNet::RAKNET_STARTED, RAKNET_SUPPORT_IPV6, RakSleep(), SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE, SLNet::RNS2_BerkleyBindParameters::remotePortRakNetWasStartedOn_PS3_PS4_PSP2, SLNet::SocketDescriptor::remotePortRakNetWasStartedOn_PS3_PSP2, SLNet::RakPeer::RemoteSystemStruct::remoteSystemIndex, remoteSystemList, remoteSystemLookup, rnr, SLNet::RakNetRandom::SeedMT(), SLNet::RNS2_BerkleyBindParameters::setBroadcast, SLNet::RNS2_BerkleyBindParameters::setIPHdrIncl, SLNet::SystemAddress::SetPortHostOrder(), SLNet::RakNetSocket2::SetUserConnectionSocketIndex(), Shutdown(), DataStructures::List< list_type >::Size(), SLNet::SOCKET_FAILED_TEST_SEND, SLNet::SOCKET_FAILED_TO_BIND, SLNet::SOCKET_FAMILY_NOT_SUPPORTED, SLNet::SOCKET_PORT_ALREADY_IN_USE, SLNet::SocketDescriptor::socketFamily, socketList, SLNet::RakPeer::RemoteSystemStruct::systemAddress, SLNet::RNS2_BerkleyBindParameters::type, SLNet::UNASSIGNED_RAKNET_GUID(), SLNet::UNASSIGNED_SYSTEM_ADDRESS, and updateCycleIsRunning.

void RakPeer::ValidateRemoteSystemLookup | ( | void |  | ) | const

protected

Definition at line 3361 of file RakPeer.cpp.

Referenced by AssignSystemAddressToRemoteSystemList().

void RakPeer::WriteOutOfBandHeader | ( | SLNet::BitStream * | bitStream | ) |

virtual

Implements SLNet::RakPeerInterface.

Definition at line 2963 of file RakPeer.cpp.

References ID_OUT_OF_BAND_INTERNAL, myGuid, OFFLINE_MESSAGE_DATA_ID, SLNet::BitStream::Write(), and SLNet::BitStream::WriteAlignedBytes().

Referenced by SendOutOfBand().

## Friends And Related Function Documentation

void ProcessNetworkPacket | ( | const SystemAddress | systemAddress,
|  | const char * | data,
|  | const int | length,
|  | RakPeer * | rakPeer,
|  | SLNet::TimeUS | timeRead,
|  | BitStream & | updateBitStream
| ) |  |

friend

Definition at line 5398 of file RakPeer.cpp.

Referenced by RunUpdateCycle().

void ProcessNetworkPacket | ( | const SystemAddress | systemAddress,
|  | const char * | data,
|  | const int | length,
|  | RakPeer * | rakPeer,
|  | RakNetSocket2 * | rakNetSocket,
|  | SLNet::TimeUS | timeRead,
|  | BitStream & | updateBitStream
| ) |  |

friend

Definition at line 5402 of file RakPeer.cpp.

bool ProcessOfflineNetworkPacket | ( | SystemAddress | systemAddress,
|  | const char * | data,
|  | const int | length,
|  | RakPeer * | rakPeer,
|  | RakNetSocket2 * | rakNetSocket,
|  | bool * | isOfflineMessage,
|  | SLNet::TimeUS | timeRead
| ) |  |

friend

Definition at line 4524 of file RakPeer.cpp.

## Member Data Documentation

RemoteSystemStruct** SLNet::RakPeer::activeSystemList

protected

activeSystemList holds a list of pointers and is preallocated to be the same size as remoteSystemList. It is updated only by the network thread, but read by both threads When the isActive member of RemoteSystemStruct is set to true or false, that system is added to this list of pointers Threadsafe because RemoteSystemStruct is preallocated, and the list is only added to, not removed from

Definition at line 786 of file peer.h.

Referenced by AddToActiveSystemList(), GetNumberOfRemoteInitiatedConnections(), GetStatisticsList(), GetSystemList(), RemoveFromActiveSystemList(), RunUpdateCycle(), Shutdown(), and Startup().

unsigned int SLNet::RakPeer::activeSystemListSize

protected

Definition at line 787 of file peer.h.

Referenced by AddToActiveSystemList(), GetNumberOfRemoteInitiatedConnections(), GetStatisticsList(), GetSystemList(), RemoveFromActiveSystemList(), RunUpdateCycle(), and Shutdown().

bool SLNet::RakPeer::allowConnectionResponseIPMigration

protected

How long it has been since things were updated by a call to receiveUpdate thread uses this to determine how long to sleep for.

True to allow connection accepted packets from anyone. False to only allow these packets from servers we requested a connection to.

Definition at line 976 of file peer.h.

Referenced by AllowConnectionResponseIPMigration(), and RunUpdateCycle().

bool SLNet::RakPeer::allowInternalRouting

protected

Definition at line 989 of file peer.h.

DataStructures::List<BanStruct*> SLNet::RakPeer::banList

protected

Definition at line 867 of file peer.h.

Referenced by AddToBanList(), ClearBanList(), IsBanned(), and RemoveFromBanList().

SimpleMutex SLNet::RakPeer::banListMutex

protected

Definition at line 826 of file peer.h.

Referenced by AddToBanList(), ClearBanList(), IsBanned(), and RemoveFromBanList().

DataStructures::ThreadsafeAllocatingQueue<BufferedCommandStruct> SLNet::RakPeer::bufferedCommands

protected

Definition at line 901 of file peer.h.

Referenced by ChangeSystemAddress(), ClearBufferedCommands(), CloseConnectionInternal(), GetSocket(), GetSockets(), RunUpdateCycle(), SendBuffered(), and SendBufferedList().

DataStructures::Queue<RNS2RecvStruct*> SLNet::RakPeer::bufferedPacketsFreePool

protected

Definition at line 906 of file peer.h.

Referenced by AllocRNS2RecvStruct(), ClearBufferedPackets(), and DeallocRNS2RecvStruct().

SLNet::SimpleMutex SLNet::RakPeer::bufferedPacketsFreePoolMutex

protected

Definition at line 907 of file peer.h.

Referenced by AllocRNS2RecvStruct(), ClearBufferedPackets(), and DeallocRNS2RecvStruct().

DataStructures::Queue<RNS2RecvStruct*> SLNet::RakPeer::bufferedPacketsQueue

protected

Definition at line 908 of file peer.h.

Referenced by ClearBufferedPackets(), PopBufferedPacket(), and PushBufferedPacket().

SLNet::SimpleMutex SLNet::RakPeer::bufferedPacketsQueueMutex

protected

Definition at line 909 of file peer.h.

Referenced by ClearBufferedPackets(), PopBufferedPacket(), and PushBufferedPacket().

unsigned int SLNet::RakPeer::bytesReceivedPerSecond

protected

Definition at line 822 of file peer.h.

Referenced by Shutdown().

unsigned int SLNet::RakPeer::bytesSentPerSecond

protected

The list of people we have tried to connect to recently.

Data that both the client and the server needs

Definition at line 822 of file peer.h.

Referenced by Shutdown().

int SLNet::RakPeer::defaultMTUSize

protected

Definition at line 946 of file peer.h.

Referenced by AssignSystemAddressToRemoteSystemList(), GetMTUSize(), and Startup().

SLNet::TimeMS SLNet::RakPeer::defaultTimeoutTime

protected

Definition at line 958 of file peer.h.

Referenced by AssignSystemAddressToRemoteSystemList(), GetTimeoutTime(), and SetTimeoutTime().

volatile bool SLNet::RakPeer::endThreads

protected

Set this to true to terminate the Peer thread execution.

Definition at line 757 of file peer.h.

Referenced by CloseConnectionInternal(), Connect(), ConnectWithSocket(), GetConnectionList(), GetNumberOfRemoteInitiatedConnections(), GetStatistics(), GetStatisticsList(), GetSystemList(), InitializeSecurity(), IsActive(), RAK_THREAD_DECLARATION(), Send(), SendList(), Shutdown(), and Startup().

SystemAddress SLNet::RakPeer::firstExternalID

protected

Definition at line 978 of file peer.h.

Referenced by GetExternalID(), IsLoopbackAddress(), RunUpdateCycle(), and Startup().

bool(* SLNet::RakPeer::incomingDatagramEventHandler)(RNS2RecvStruct *)

protected

Definition at line 982 of file peer.h.

Referenced by OnRNS2Recv(), and SetIncomingDatagramEventHandler().

char SLNet::RakPeer::incomingPassword[256]

protected

Local Player ID.

Definition at line 775 of file peer.h.

Referenced by GetIncomingPassword(), ParseConnectionRequestPacket(), and SetIncomingPassword().

unsigned char SLNet::RakPeer::incomingPasswordLength

protected

Definition at line 776 of file peer.h.

Referenced by GetIncomingPassword(), ParseConnectionRequestPacket(), and SetIncomingPassword().

SimpleMutex SLNet::RakPeer::incomingQueueMutex

protected

Definition at line 826 of file peer.h.

SystemAddress SLNet::RakPeer::ipList[MAXIMUM_NUMBER_OF_INTERNAL_IDS]

protected

Definition at line 987 of file peer.h.

Referenced by AssignSystemAddressToRemoteSystemList(), FillIPList(), GetInternalID(), GetLocalIP(), GetLoopbackAddress(), GetNumberOfAddresses(), IsLoopbackAddress(), OnConnectionRequest(), RunUpdateCycle(), SetInternalID(), and Startup().

volatile bool SLNet::RakPeer::isMainLoopThreadActive

protected

true if the peer thread is active.

Definition at line 759 of file peer.h.

Referenced by GetSocket(), GetSockets(), RAK_THREAD_DECLARATION(), Shutdown(), and Startup().

bool SLNet::RakPeer::limitConnectionFrequencyFromTheSameIP

protected

Definition at line 996 of file peer.h.

Referenced by AssignSystemAddressToRemoteSystemList(), and SetLimitIPConnectionFrequency().

unsigned int SLNet::RakPeer::maximumIncomingConnections

protected

Store the maximum number of peers able to connect, including reserved connection slots for pings, etc.

Store the maximum incoming connection allowed

Definition at line 771 of file peer.h.

Referenced by GetMaximumIncomingConnections(), SetMaximumIncomingConnections(), and Startup().

* unsigned int SLNet::RakPeer::maximumNumberOfPeers

protected

Store the maximum number of peers allowed to connect.

Do we occasionally ping the other systems?

Definition at line 766 of file peer.h.

Referenced by ApplyNetworkSimulator(), AssignSystemAddressToRemoteSystemList(), GetClientPublicKeyFromSystemAddress(), GetExternalID(), GetGUIDFromIndex(), GetGuidFromSystemAddress(), GetIndexFromGuid(), GetIndexFromSystemAddress(), GetMaximumNumberOfPeers(), GetRemoteSystemFromGUID(), GetRemoteSystemFromSystemAddress(), GetStatistics(), GetSystemAddressFromGuid(), GetSystemAddressFromIndex(), GetSystemIndexFromGuid(), RemoteSystemLookupHashIndex(), SendImmediate(), SetSplitMessageProgressInterval(), SetTimeoutTime(), SetUnreliableTimeout(), Shutdown(), and Startup().

unsigned SLNet::RakPeer::maxOutgoingBPS

protected

Definition at line 965 of file peer.h.

Referenced by RunUpdateCycle(), and SetPerConnectionOutgoingBandwidthLimit().

RakNetGUID SLNet::RakPeer::myGuid

protected

Definition at line 963 of file peer.h.

Referenced by GenerateGUID(), GenerateSeedFromGuid(), GetGuidFromSystemAddress(), GetMyGUID(), GetSystemAddressFromGuid(), GetSystemIndexFromGuid(), IsLoopbackAddress(), SLNet::ProcessOfflineNetworkPacket(), SendLoopback(), Startup(), and WriteOutOfBandHeader().

bool SLNet::RakPeer::occasionalPing

protected

Definition at line 764 of file peer.h.

Referenced by RunUpdateCycle(), and SetOccasionalPing().

SLNet::BitStream SLNet::RakPeer::offlinePingResponse

protected

Definition at line 772 of file peer.h.

Referenced by GetOfflinePingResponse(), SLNet::ProcessOfflineNetworkPacket(), and SetOfflinePingResponse().

DataStructures::MemoryPool<Packet> SLNet::RakPeer::packetAllocationPool

protected

Definition at line 999 of file peer.h.

Referenced by AllocPacket(), DeallocatePacket(), and Shutdown().

SimpleMutex SLNet::RakPeer::packetAllocationPoolMutex

protected

Definition at line 998 of file peer.h.

Referenced by AllocPacket(), DeallocatePacket(), and Shutdown().

SimpleMutex SLNet::RakPeer::packetReturnMutex

protected

Definition at line 1001 of file peer.h.

Referenced by AddPacketToProducer(), GetReceiveBufferSize(), PushBackPacket(), Receive(), and Shutdown().

DataStructures::Queue<Packet*> SLNet::RakPeer::packetReturnQueue

protected

Definition at line 1002 of file peer.h.

Referenced by AddPacketToProducer(), GetReceiveBufferSize(), PushBackPacket(), Receive(), and Shutdown().

DataStructures::List<PluginInterface2*> SLNet::RakPeer::pluginListNTS

protected

Definition at line 869 of file peer.h.

Referenced by AttachPlugin(), DetachPlugin(), Ping(), SLNet::ProcessNetworkPacket(), SLNet::ProcessOfflineNetworkPacket(), PushBackPacket(), Receive(), RunUpdateCycle(), SendOutOfBand(), SendTTL(), Shutdown(), and Startup().

DataStructures::List<PluginInterface2*> SLNet::RakPeer::pluginListTS

protected

Definition at line 869 of file peer.h.

Referenced by AttachPlugin(), DetachPlugin(), PushBackPacket(), Receive(), Shutdown(), and Startup().

SignaledEvent SLNet::RakPeer::quitAndDataEvents

protected

Definition at line 995 of file peer.h.

Referenced by OnRNS2Recv(), RAK_THREAD_DECLARATION(), RunUpdateCycle(), SendBuffered(), SendBufferedList(), Shutdown(), and ~RakPeer().

SimpleMutex SLNet::RakPeer::rakPeerMutexes[NUMBER_OF_RAKPEER_MUTEXES]

protected

Definition at line 813 of file peer.h.

Referenced by GetOfflinePingResponse(), SLNet::ProcessOfflineNetworkPacket(), and SetOfflinePingResponse().

DataStructures::MemoryPool<RemoteSystemIndex> SLNet::RakPeer::remoteSystemIndexPool

protected

Definition at line 797 of file peer.h.

Referenced by ClearRemoteSystemLookup(), DereferenceRemoteSystem(), and ReferenceRemoteSystem().

RemoteSystemStruct* SLNet::RakPeer::remoteSystemList

protected

This is an array of pointers to RemoteSystemStruct This allows us to preallocate the list when starting, so we don't have to allocate or delete at runtime. Another benefit is that is lets us add and remove active players simply by setting systemAddress and moving elements in the list by copying pointers variables without affecting running threads, even if they are in the reliability layer

Definition at line 782 of file peer.h.

Referenced by AddToActiveSystemList(), ApplyNetworkSimulator(), AssignSystemAddressToRemoteSystemList(), CloseConnectionInternal(), DereferenceRemoteSystem(), GetClientPublicKeyFromSystemAddress(), GetConnectionList(), GetConnectionState(), GetExternalID(), GetGUIDFromIndex(), GetGuidFromSystemAddress(), GetIndexFromGuid(), GetIndexFromSystemAddress(), GetNumberOfRemoteInitiatedConnections(), GetRemoteSystem(), GetRemoteSystemFromGUID(), GetRemoteSystemFromSystemAddress(), GetRemoteSystemIndex(), GetStatistics(), GetStatisticsList(), GetSystemAddressFromGuid(), GetSystemAddressFromIndex(), GetSystemIndexFromGuid(), GetSystemList(), ReferenceRemoteSystem(), Send(), SendImmediate(), SendList(), SetSplitMessageProgressInterval(), SetTimeoutTime(), SetUnreliableTimeout(), Shutdown(), and Startup().

RemoteSystemIndex** SLNet::RakPeer::remoteSystemLookup

protected

Definition at line 790 of file peer.h.

Referenced by ClearRemoteSystemLookup(), DereferenceRemoteSystem(), GetRemoteSystemIndex(), ReferenceRemoteSystem(), and Startup().

bool SLNet::RakPeer::replyFromTargetBroadcast

protected

Definition at line 956 of file peer.h.

SLNet::BitStream* SLNet::RakPeer::replyFromTargetBS

protected

Definition at line 954 of file peer.h.

SystemAddress SLNet::RakPeer::replyFromTargetPlayer

protected

Definition at line 955 of file peer.h.

DataStructures::Queue<RequestedConnectionStruct*> SLNet::RakPeer::requestedConnectionQueue

protected

Definition at line 871 of file peer.h.

Referenced by CancelConnectionAttempt(), ClearRequestedConnectionList(), GetConnectionState(), SLNet::ProcessOfflineNetworkPacket(), RunUpdateCycle(), and SendConnectionRequest().

SimpleMutex SLNet::RakPeer::requestedConnectionQueueMutex

protected

Definition at line 872 of file peer.h.

Referenced by CancelConnectionAttempt(), ClearRequestedConnectionList(), GetConnectionState(), SLNet::ProcessOfflineNetworkPacket(), RunUpdateCycle(), and SendConnectionRequest().

DataStructures::List<SLNet::RakString> SLNet::RakPeer::securityExceptionList

protected

Definition at line 985 of file peer.h.

Referenced by AddToSecurityExceptionList(), IsInSecurityExceptionList(), and RemoveFromSecurityExceptionList().

SimpleMutex SLNet::RakPeer::securityExceptionMutex

protected

Definition at line 943 of file peer.h.

Referenced by AddToSecurityExceptionList(), IsInSecurityExceptionList(), and RemoveFromSecurityExceptionList().

uint32_t SLNet::RakPeer::sendReceiptSerial

protected

Definition at line 1010 of file peer.h.

Referenced by GetNextSendReceipt(), IncrementNextSendReceipt(), ResetSendReceipt(), and Send().

SimpleMutex SLNet::RakPeer::sendReceiptSerialMutex

protected

This is used to return a number to the user when they call Send identifying the message This number will be returned back with ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS and is only returned with the reliability types that contain RECEIPT in the name

Definition at line 1009 of file peer.h.

Referenced by GetNextSendReceipt(), IncrementNextSendReceipt(), ResetSendReceipt(), and Send().

DataStructures::List<RakNetSocket2* > SLNet::RakPeer::socketList

protected

Definition at line 950 of file peer.h.

Referenced by CloseConnectionInternal(), Connect(), DerefAllSockets(), GetRakNetSocketFromUserConnectionSocketIndex(), Ping(), SLNet::ProcessNetworkPacket(), RunUpdateCycle(), SendConnectionRequest(), SendOutOfBand(), SendTTL(), Shutdown(), and Startup().

DataStructures::ThreadsafeAllocatingQueue<SocketQueryOutput> SLNet::RakPeer::socketQueryOutput

protected

Definition at line 924 of file peer.h.

Referenced by ClearSocketQueryOutput(), GetSocket(), GetSockets(), and RunUpdateCycle().

int SLNet::RakPeer::splitMessageProgressInterval

protected

Definition at line 979 of file peer.h.

Referenced by AssignSystemAddressToRemoteSystemList(), GetSplitMessageProgressInterval(), and SetSplitMessageProgressInterval().

bool SLNet::RakPeer::trackFrequencyTable

protected

Definition at line 947 of file peer.h.

SLNet::TimeMS SLNet::RakPeer::unreliableTimeout

protected

Definition at line 980 of file peer.h.

Referenced by AssignSystemAddressToRemoteSystemList(), and SetUnreliableTimeout().

bool SLNet::RakPeer::updateCycleIsRunning

protected

RunUpdateCycle is not thread safe but we don't need to mutex calls. Just skip calls if it is running already.

Definition at line 816 of file peer.h.

Referenced by Startup().

void* SLNet::RakPeer::userUpdateThreadData

protected

Definition at line 992 of file peer.h.

Referenced by RAK_THREAD_DECLARATION(), and SetUserUpdateThread().

void(* SLNet::RakPeer::userUpdateThreadPtr)(RakPeerInterface *, void *)

protected

Definition at line 991 of file peer.h.

Referenced by RAK_THREAD_DECLARATION(), and SetUserUpdateThread().

unsigned int SLNet::RakPeer::validationInteger

protected

Definition at line 825 of file peer.h.

The documentation for this class was generated from the following files:

- Source/include/slikenet/peer.h
- Source/src/RakPeer.cpp