SLikeNet: Deprecated List

SLikeNet 0.1.3
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
Deprecated List
Class SLNet::HTTPConnection
, use HTTPConnection2
Member SLNet::RakPeer::ApplyNetworkSimulator (float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance)
Use http://www.jenkinssoftware.com/forum/index.php?topic=1671.0 instead.
Member SLNet::RakPeerInterface::ApplyNetworkSimulator (float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance)=0
Use http://www.jenkinssoftware.com/forum/index.php?topic=1671.0 instead.
Member SLNet::RM3SR_SERIALIZED_ALWAYS_IDENTICALLY
, use RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION
Member SLNet::RPC4::Call (const char *uniqueID, SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
, use Signal() Send to the specified remote instance of RakPeer.
Member SLNet::RPC4::CallLoopback (const char *uniqueID, SLNet::BitStream *bitStream)
Use RegisterSlot() and Signal() with your own RakNetGUID as the send target Send to the attached instance of RakPeer. See RakPeerInterface::SendLoopback()
Member SLNet::RPC4::RegisterFunction (const char *uniqueID, void(*functionPointer)(SLNet::BitStream *userData, Packet *packet))
Use RegisterSlot
Member SLNet::RPC4::RegisterLocalCallback (const char *uniqueID, MessageID messageId)
Use RegisterSlot and invoke on self only when the packet you want arrives When a RakNet Packet with the specified identifier is returned, execute CallLoopback() on a function previously registered with RegisterFunction() For example, you could call "OnClosedConnection" whenever you get ID_DISCONNECTION_NOTIFICATION or ID_CONNECTION_LOST
Class SLNet::TeamBalancer
Use TeamManager intead
Member SLNet::TeamId
Use TeamManager intead
Group TEAM_BALANCER_GROUP
Use TeamManager intead
File TeamBalancer.h
Use TeamManager intead
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Modules

  • Modules
  • Namespaces
  • Classes
  • Files
Modules
Here is a list of all modules:
[detail level 123]
\ PluginInterface2 |
\ Plugins |
o CloudComputing | Contains the CloudClient and CloudServer plugins
o DirectoryDeltaTransfer | Simple class to send changes between directories
o FileListTransfer | A plugin to provide a simple way to compress and incrementally send the files in the FileList structure
o MessageFilter | Remote incoming packets from unauthorized systems
o NatPunchthrough | Connect systems despite both systems being behind a router
o NatTypeDetection | Use a remote server with multiple IP addresses to determine what type of NAT your router is using
o PacketLogger | Print out incoming messages to a target destination
o ReadyEvent | Peer to peer synchronized ready and unready events
o RelayPlugin | A simple class to relay messages from one system to another through an intermediary
o ReplicaManager3 | Third implementation of object replication
o Router2 | Part of the NAT punchthrough solution, allowing you to connect to systems by routing through a shared connection
o RPC | Remote procedure calls, without external dependencies
o TeamBalancer | Set and network team selection (supports peer to peer or client/server)
o TeamManager | Automates networking and list management for teams
o RakNetTransport | UDP based transport implementation for the ConsoleServer
\ UDPProxy | Forwards UDP datagrams from one system to another. Protocol independent
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: PluginInterface2

  • Files
Modules | Classes | Enumerations
PluginInterface2

Modules

Plugins

Classes

class SLNet::PluginInterface2

Enumerations

enum | SLNet::PluginReceiveResult { SLNet::RR_STOP_PROCESSING_AND_DEALLOCATE =0, SLNet::RR_CONTINUE_PROCESSING, SLNet::RR_STOP_PROCESSING }
enum | SLNet::PI2_LostConnectionReason { SLNet::LCR_CLOSED_BY_USER, SLNet::LCR_DISCONNECTION_NOTIFICATION, SLNet::LCR_CONNECTION_LOST }
enum SLNet::PI2_FailedConnectionAttemptReason {
SLNet::FCAR_CONNECTION_ATTEMPT_FAILED, SLNet::FCAR_ALREADY_CONNECTED, SLNet::FCAR_NO_FREE_INCOMING_CONNECTIONS, SLNet::FCAR_SECURITY_PUBLIC_KEY_MISMATCH,
SLNet::FCAR_CONNECTION_BANNED, SLNet::FCAR_INVALID_PASSWORD, SLNet::FCAR_INCOMPATIBLE_PROTOCOL, SLNet::FCAR_IP_RECENTLY_CONNECTED,
SLNet::FCAR_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY, SLNet::FCAR_OUR_SYSTEM_REQUIRES_SECURITY, SLNet::FCAR_PUBLIC_KEY_MISMATCH
}

Detailed Description

Class Documentation

class SLNet::PluginInterface2

RakNet's plugin system. Each plugin processes the following events: -Connection attempts -The result of connection attempts -Each incoming message -Updates over time, when RakPeer::Receive() is called

Definition at line 94 of file PluginInterface2.h.

+ Inheritance diagram for SLNet::PluginInterface2:

Public Member Functions

PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

PluginInterface2::PluginInterface2 ( )

Definition at line 24 of file PluginInterface2.cpp.

References rakPeerInterface, and tcpInterface.

PluginInterface2::~PluginInterface2 ( )
virtual

Definition at line 31 of file PluginInterface2.cpp.

Member Function Documentation

Packet * PluginInterface2::AllocatePacketUnified ( unsigned dataSize )
protected

Definition at line 103 of file PluginInterface2.cpp.

References _FILE_AND_LINE_, SLNet::TCPInterface::AllocatePacket(), SLNet::RakPeerInterface::AllocatePacket(), SLNet::Packet::bitSize, BYTES_TO_BITS, SLNet::Packet::data, SLNet::Packet::deleteData, SLNet::Packet::guid, rakMalloc_Ex, rakPeerInterface, SLNet::Packet::systemAddress, tcpInterface, SLNet::UNASSIGNED_RAKNET_GUID(), SLNet::UNASSIGNED_SYSTEM_ADDRESS, and SLNet::Packet::wasGeneratedLocally.

void PluginInterface2::DeallocPacketUnified ( Packet * packet )
protected

Definition at line 143 of file PluginInterface2.cpp.

References _FILE_AND_LINE_, SLNet::Packet::data, SLNet::TCPInterface::DeallocatePacket(), SLNet::RakPeerInterface::DeallocatePacket(), SLNet::OP_DELETE(), rakFree_Ex, rakPeerInterface, and tcpInterface.

RakNetGUID PluginInterface2::GetMyGUIDUnified ( void ) const

Definition at line 221 of file PluginInterface2.cpp.

References SLNet::RakPeerInterface::GetMyGUID(), rakPeerInterface, and SLNet::UNASSIGNED_RAKNET_GUID().

Referenced by SendListUnified(), and SendUnified().

RakPeerInterface* SLNet::PluginInterface2::GetRakPeerInterface ( void ) const
inline

Definition at line 184 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnAck | ( | unsigned int | messageNumber,
 |  | SystemAddress | remoteSystemAddress,
 |  | SLNet::TimeMS | time
 | ) |  |
inlinevirtual

Called when we get an ack for a message we reliably sent

Precondition
To be called, UsesReliabilityLayer() must return true
Parameters
[in] | messageNumber | The numerical identifier for which message this is
[in] | remoteSystemAddress | The player we sent or got this packet from
[in] | time | The current time as returned by SLNet::GetTimeMS()

Reimplemented in SLNet::PacketLogger.

Definition at line 176 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnAttach ( void )
inlinevirtual

Called when the interface is attached.

Reimplemented in SLNet::RPC4, SLNet::NatPunchthroughClient, SLNet::TeamBalancer, and SLNet::UDPProxyServer.

Definition at line 101 of file PluginInterface2.h.

Referenced by SLNet::RakPeer::AttachPlugin().

virtual void SLNet::PluginInterface2::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
inlinevirtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented in SLNet::TeamManager, SLNet::ReplicaManager3, SLNet::StatisticsHistoryPlugin, SLNet::ReadyEvent, SLNet::NatPunchthroughClient, SLNet::MessageFilter, SLNet::TeamBalancer, SLNet::CloudServer, SLNet::FileListTransfer, SLNet::RelayPlugin, SLNet::ConnectionGraph2, SLNet::UDPProxyServer, SLNet::Router2, SLNet::NatPunchthroughServer, SLNet::HTTPConnection2, SLNet::RakNetTransport2, SLNet::TwoWayAuthentication, SLNet::NatTypeDetectionServer, SLNet::NatTypeDetectionClient, and SLNet::UDPProxyCoordinator.

Definition at line 124 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnDetach ( void )
inlinevirtual

Called when the interface is detached.

Reimplemented in SLNet::ReplicaManager3, SLNet::NatPunchthroughClient, SLNet::UDPProxyServer, and SLNet::NatTypeDetectionClient.

Definition at line 104 of file PluginInterface2.h.

Referenced by SLNet::RakPeer::DetachPlugin().

virtual void SLNet::PluginInterface2::OnDirectSocketReceive | ( | const char * | data,
 |  | const BitSize_t | bitsUsed,
 |  | SystemAddress | remoteSystemAddress
 | ) |  |
inlinevirtual

Called on a receive from the socket, per datagram, that does not go through the reliability layer

Precondition
To be called, UsesReliabilityLayer() must return true
Parameters
[in] | data | The data being sent
[in] | bitsUsed | How many bits long data is
[in] | remoteSystemAddress | Which system this message is being sent to

Reimplemented in SLNet::PacketLogger.

Definition at line 154 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnDirectSocketSend | ( | const char * | data,
 |  | const BitSize_t | bitsUsed,
 |  | SystemAddress | remoteSystemAddress
 | ) |  |
inlinevirtual

Called on a send to the socket, per datagram, that does not go through the reliability layer

Precondition
To be called, UsesReliabilityLayer() must return true
Parameters
[in] | data | The data being sent
[in] | bitsUsed | How many bits long data is
[in] | remoteSystemAddress | Which system this message is being sent to

Reimplemented in SLNet::PacketLogger.

Definition at line 147 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnFailedConnectionAttempt | ( | Packet * | packet,
 |  | PI2_FailedConnectionAttemptReason | failedConnectionAttemptReason
 | ) |  |
inlinevirtual

Called when a connection attempt fails

Parameters
[in] | packet | Packet to be returned to the user
[in] | failedConnectionReason | Why the connection failed

Reimplemented in SLNet::Router2, and SLNet::HTTPConnection2.

Definition at line 135 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnInternalPacket | ( | InternalPacket * | internalPacket,
 |  | unsigned | frameNumber,
 |  | SystemAddress | remoteSystemAddress,
 |  | SLNet::TimeMS | time,
 |  | int | isSend
 | ) |  |
inlinevirtual

Called on a send or receive of a message within the reliability layer

Precondition
To be called, UsesReliabilityLayer() must return true
Parameters
[in] | internalPacket | The user message, along with all send data.
[in] | frameNumber | The number of frames sent or received so far for this player depending on isSend . Indicates the frame of this user message.
[in] | remoteSystemAddress | The player we sent or got this packet from
[in] | time | The current time as returned by SLNet::GetTimeMS()
[in] | isSend | Is this callback representing a send event or receive event?

Reimplemented in SLNet::PacketLogger.

Definition at line 169 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
inlinevirtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented in SLNet::TeamManager, SLNet::ReplicaManager3, SLNet::StatisticsHistoryPlugin, SLNet::NatPunchthroughClient, SLNet::MessageFilter, SLNet::ConnectionGraph2, SLNet::NatPunchthroughServer, SLNet::HTTPConnection2, and SLNet::RakNetTransport2.

Definition at line 130 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnPushBackPacket | ( | const char * | data,
 |  | const BitSize_t | bitsUsed,
 |  | SystemAddress | remoteSystemAddress
 | ) |  |
inlinevirtual

System called RakPeerInterface::PushBackPacket

Parameters
[in] | data | The data being sent
[in] | bitsUsed | How many bits long data is
[in] | remoteSystemAddress | The player we sent or got this packet from

Reimplemented in SLNet::PacketLogger.

Definition at line 182 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnRakPeerShutdown ( void )
inlinevirtual

Called when RakPeer is shutdown.

Reimplemented in SLNet::ReplicaManager3, SLNet::ReadyEvent, SLNet::NatPunchthroughClient, SLNet::UDPProxyClient, SLNet::CloudServer, SLNet::FileListTransfer, SLNet::UDPProxyServer, SLNet::Router2, SLNet::TwoWayAuthentication, and SLNet::NatTypeDetectionClient.

Definition at line 118 of file PluginInterface2.h.

virtual void SLNet::PluginInterface2::OnRakPeerStartup ( void )
inlinevirtual

Called when RakPeer is initialized.

Reimplemented in SLNet::UDPProxyServer.

Definition at line 115 of file PluginInterface2.h.

virtual PluginReceiveResult SLNet::PluginInterface2::OnReceive ( Packet * packet )
inlinevirtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented in SLNet::TeamManager, SLNet::ReplicaManager3, SLNet::RPC4, SLNet::ReadyEvent, SLNet::NatPunchthroughClient, SLNet::MessageFilter, SLNet::DirectoryDeltaTransfer, SLNet::TeamBalancer, SLNet::UDPProxyClient, SLNet::CloudClient, SLNet::CloudServer, SLNet::FileListTransfer, SLNet::ConnectionGraph2, SLNet::RelayPlugin, SLNet::UDPProxyServer, SLNet::Router2, SLNet::HTTPConnection2, SLNet::NatPunchthroughServer, SLNet::RakNetTransport2, SLNet::TwoWayAuthentication, SLNet::NatTypeDetectionServer, SLNet::NatTypeDetectionClient, and SLNet::UDPProxyCoordinator.

Definition at line 112 of file PluginInterface2.h.

References SLNet::RR_CONTINUE_PROCESSING.

Referenced by PushBackPacketUnified(), and SendUnified().

virtual void SLNet::PluginInterface2::OnReliabilityLayerNotification | ( | const char * | errorMessage,
 |  | const BitSize_t | bitsUsed,
 |  | SystemAddress | remoteSystemAddress,
 |  | bool | isError
 | ) |  |
inlinevirtual

Called when the reliability layer rejects a send or receive

Precondition
To be called, UsesReliabilityLayer() must return true
Parameters
[in] | bitsUsed | How many bits long data is
[in] | remoteSystemAddress | Which system this message is being sent to

Reimplemented in SLNet::PacketLogger.

Definition at line 160 of file PluginInterface2.h.

void PluginInterface2::PushBackPacketUnified | ( | Packet * | packet,
 |  | bool | pushAtHead
 | ) |  |
protected

Definition at line 125 of file PluginInterface2.cpp.

References OnReceive(), SLNet::TCPInterface::PushBackPacket(), SLNet::RakPeerInterface::PushBackPacket(), rakPeerInterface, tcpInterface, and Update().

bool PluginInterface2::SendListUnified | ( | const char ** | data,
 |  | const int * | lengths,
 |  | const int | numParameters,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | char | orderingChannel,
 |  | const AddressOrGUID | systemIdentifier,
 |  | bool | broadcast
 | ) |  |
protected

Definition at line 161 of file PluginInterface2.cpp.

References _FILE_AND_LINE_, GetMyGUIDUnified(), notifyOutOfMemory, rakFree_Ex, rakMalloc_Ex, SLNet::AddressOrGUID::rakNetGuid, rakPeerInterface, SLNet::TCPInterface::SendList(), SLNet::RakPeerInterface::SendList(), SendUnified(), SLNet::AddressOrGUID::systemAddress, and tcpInterface.

void PluginInterface2::SendUnified | ( | const SLNet::BitStream * | bitStream,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | char | orderingChannel,
 |  | const AddressOrGUID | systemIdentifier,
 |  | bool | broadcast
 | ) |  |
protected

Definition at line 35 of file PluginInterface2.cpp.

References SLNet::Packet::bitSize, SLNet::Packet::data, SLNet::Packet::deleteData, SLNet::BitStream::GetData(), GetMyGUIDUnified(), SLNet::BitStream::GetNumberOfBitsUsed(), SLNet::BitStream::GetNumberOfBytesUsed(), SLNet::Packet::guid, SLNet::Packet::length, OnReceive(), SLNet::AddressOrGUID::rakNetGuid, rakPeerInterface, SLNet::TCPInterface::Send(), SLNet::RakPeerInterface::Send(), SLNet::AddressOrGUID::systemAddress, SLNet::Packet::systemAddress, tcpInterface, SLNet::UNASSIGNED_RAKNET_GUID(), SLNet::UNASSIGNED_SYSTEM_ADDRESS, Update(), and SLNet::Packet::wasGeneratedLocally.

Referenced by SendListUnified().

void PluginInterface2::SendUnified | ( | const char * | data,
 |  | const int | length,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | char | orderingChannel,
 |  | const AddressOrGUID | systemIdentifier,
 |  | bool | broadcast
 | ) |  |
protected

Definition at line 69 of file PluginInterface2.cpp.

References SLNet::Packet::bitSize, BYTES_TO_BITS, SLNet::Packet::data, SLNet::Packet::deleteData, GetMyGUIDUnified(), SLNet::Packet::guid, SLNet::Packet::length, OnReceive(), SLNet::AddressOrGUID::rakNetGuid, rakPeerInterface, SLNet::TCPInterface::Send(), SLNet::RakPeerInterface::Send(), SLNet::AddressOrGUID::systemAddress, SLNet::Packet::systemAddress, tcpInterface, SLNet::UNASSIGNED_RAKNET_GUID(), SLNet::UNASSIGNED_SYSTEM_ADDRESS, Update(), and SLNet::Packet::wasGeneratedLocally.

void PluginInterface2::SetRakPeerInterface ( RakPeerInterface * ptr )

Definition at line 211 of file PluginInterface2.cpp.

References rakPeerInterface.

Referenced by SLNet::RakPeer::AttachPlugin(), and SLNet::RakPeer::DetachPlugin().

void SLNet::PluginInterface2::SetTCPInterface ( TCPInterface * ptr )
virtual void SLNet::PluginInterface2::Update ( void )
inlinevirtual

Update is called every time a packet is checked for .

Reimplemented in SLNet::TeamManager, SLNet::ReplicaManager3, SLNet::StatisticsHistoryPlugin, SLNet::NatPunchthroughClient, SLNet::MessageFilter, SLNet::UDPProxyClient, SLNet::CloudServer, SLNet::FileListTransfer, SLNet::UDPProxyServer, SLNet::Router2, SLNet::NatPunchthroughServer, SLNet::TwoWayAuthentication, SLNet::NatTypeDetectionServer, SLNet::NatTypeDetectionClient, SLNet::UDPProxyCoordinator, and SLNet::ThreadsafePacketLogger.

Definition at line 107 of file PluginInterface2.h.

Referenced by PushBackPacketUnified(), and SendUnified().

virtual bool SLNet::PluginInterface2::UsesReliabilityLayer ( void ) const
inlinevirtual

Queried when attached to RakPeer Return true to call OnDirectSocketSend(), OnDirectSocketReceive(), OnReliabilityLayerNotification(), OnInternalPacket(), and OnAck() If true, then you cannot call RakPeer::AttachPlugin() or RakPeer::DetachPlugin() for this plugin, while RakPeer is active

Reimplemented in SLNet::PacketLogger.

Definition at line 140 of file PluginInterface2.h.

Referenced by SLNet::RakPeer::AttachPlugin(), and SLNet::RakPeer::DetachPlugin().

Member Data Documentation

RakPeerInterface* SLNet::PluginInterface2::rakPeerInterface
protected

Definition at line 207 of file PluginInterface2.h.

Referenced by AllocatePacketUnified(), DeallocPacketUnified(), GetMyGUIDUnified(), PluginInterface2(), PushBackPacketUnified(), SendListUnified(), SendUnified(), and SetRakPeerInterface().

TCPInterface* SLNet::PluginInterface2::tcpInterface
protected

Definition at line 209 of file PluginInterface2.h.

Referenced by AllocatePacketUnified(), DeallocPacketUnified(), PluginInterface2(), PushBackPacketUnified(), SendListUnified(), and SendUnified().

Enumeration Type Documentation

enum SLNet::PI2_FailedConnectionAttemptReason

Returns why a connection attempt failed

Enumerator:
FCAR_CONNECTION_ATTEMPT_FAILED
FCAR_ALREADY_CONNECTED
FCAR_NO_FREE_INCOMING_CONNECTIONS
FCAR_SECURITY_PUBLIC_KEY_MISMATCH
FCAR_CONNECTION_BANNED
FCAR_INVALID_PASSWORD
FCAR_INCOMPATIBLE_PROTOCOL
FCAR_IP_RECENTLY_CONNECTED
FCAR_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY
FCAR_OUR_SYSTEM_REQUIRES_SECURITY
FCAR_PUBLIC_KEY_MISMATCH

Definition at line 72 of file PluginInterface2.h.

enum SLNet::PI2_LostConnectionReason

Reasons why a connection was lost

Enumerator:
LCR_CLOSED_BY_USER

Called RakPeer::CloseConnection()

LCR_DISCONNECTION_NOTIFICATION

Got ID_DISCONNECTION_NOTIFICATION.

LCR_CONNECTION_LOST

GOT ID_CONNECTION_LOST.

Definition at line 58 of file PluginInterface2.h.

enum SLNet::PluginReceiveResult

For each message that arrives on an instance of RakPeer, the plugins get an opportunity to process them first. This enumeration represents what to do with the message

Enumerator:
RR_STOP_PROCESSING_AND_DEALLOCATE

The plugin used this message and it shouldn't be given to the user.

RR_CONTINUE_PROCESSING

This message will be processed by other plugins, and at last by the user.

RR_STOP_PROCESSING

The plugin is going to hold on to this message. Do not deallocate it but do not pass it to other plugins either.

Definition at line 44 of file PluginInterface2.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Plugins

Modules | Classes
Plugins
PluginInterface2

Modules

CloudComputing
Contains the CloudClient and CloudServer plugins.
DirectoryDeltaTransfer
Simple class to send changes between directories.
FileListTransfer
A plugin to provide a simple way to compress and incrementally send the files in the FileList structure.
MessageFilter
Remote incoming packets from unauthorized systems.
NatPunchthrough
Connect systems despite both systems being behind a router.
NatTypeDetection
Use a remote server with multiple IP addresses to determine what type of NAT your router is using.
PacketLogger
Print out incoming messages to a target destination.
ReadyEvent
Peer to peer synchronized ready and unready events.
RelayPlugin
A simple class to relay messages from one system to another through an intermediary.
ReplicaManager3
Third implementation of object replication.
Router2
Part of the NAT punchthrough solution, allowing you to connect to systems by routing through a shared connection.
RPC
Remote procedure calls, without external dependencies.
TeamBalancer
Set and network team selection (supports peer to peer or client/server)
TeamManager
Automates networking and list management for teams.
RakNetTransport
UDP based transport implementation for the ConsoleServer.
UDPProxy
Forwards UDP datagrams from one system to another. Protocol independent.

Classes

class | SLNet::StatisticsHistoryPlugin
Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values. More...
class | SLNet::TwoWayAuthentication
Implements two way authentication. More...
struct | SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest
struct | SLNet::TwoWayAuthentication::NonceGenerator
struct | SLNet::TwoWayAuthentication::PendingChallenge

Detailed Description

Class Documentation

class SLNet::StatisticsHistoryPlugin

Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values.

Definition at line 208 of file StatisticsHistory.h.

+ Inheritance diagram for SLNet::StatisticsHistoryPlugin:

Public Member Functions

StatisticsHistoryPlugin ()
virtual | ~StatisticsHistoryPlugin ()
void | SetTrackConnections (bool _addNewConnections, int newConnectionsObjectType, bool _removeLostConnections)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Public Attributes

StatisticsHistory statistics

Protected Member Functions

virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

bool | addNewConnections
bool | removeLostConnections
int | newConnectionsObjectType
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::StatisticsHistoryPlugin::StatisticsHistoryPlugin ( )
virtual SLNet::StatisticsHistoryPlugin::~StatisticsHistoryPlugin ( )
virtual

Member Function Documentation

virtual void SLNet::StatisticsHistoryPlugin::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
protectedvirtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::StatisticsHistoryPlugin::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
protectedvirtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

void SLNet::StatisticsHistoryPlugin::SetTrackConnections | ( | bool | _addNewConnections,
 |  | int | newConnectionsObjectType,
 |  | bool | _removeLostConnections
 | ) |  |
virtual void SLNet::StatisticsHistoryPlugin::Update ( void )
protectedvirtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

bool SLNet::StatisticsHistoryPlugin::addNewConnections
protected

Definition at line 231 of file StatisticsHistory.h.

int SLNet::StatisticsHistoryPlugin::newConnectionsObjectType
protected

Definition at line 233 of file StatisticsHistory.h.

bool SLNet::StatisticsHistoryPlugin::removeLostConnections
protected

Definition at line 232 of file StatisticsHistory.h.

StatisticsHistory SLNet::StatisticsHistoryPlugin::statistics

Definition at line 214 of file StatisticsHistory.h.

class SLNet::TwoWayAuthentication

Implements two way authentication.

Given two systems, each of whom known a common password / identifier pair, verify the password without transmitting it This can be used to determine what permissions are should be allowed to the other system If the other system should not send any data until authentication passes, you can use the MessageFilter plugin for this. Call MessageFilter::SetAllowMessageID() including ID_TWO_WAY_AUTHENTICATION_NEGOTIATION when doing so. Also attach MessageFilter first in the list of plugins

Note
If other systems challenges us, and fails, you will get ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILED.

Definition at line 67 of file TwoWayAuthentication.h.

+ Inheritance diagram for SLNet::TwoWayAuthentication:

Public Member Functions

TwoWayAuthentication ()
virtual | ~TwoWayAuthentication ()
bool | AddPassword (SLNet::RakString identifier, SLNet::RakString password)
Adds a password to the list of passwords the system will accept.
bool | Challenge (SLNet::RakString identifier, AddressOrGUID remoteSystem)
Challenge another system for the specified identifier.
void | Clear (void)
Free all memory.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Public Attributes

DataStructures::Queue
< PendingChallenge > 		outgoingChallenges

Protected Member Functions

void | PushToUser (MessageID messageId, SLNet::RakString password, SLNet::AddressOrGUID remoteSystem)
void | OnNonceRequest (Packet *packet)
void | OnNonceReply (Packet *packet)
PluginReceiveResult | OnHashedNonceAndPassword (Packet *packet)
void | OnPasswordResult (Packet *packet)
void | Hash (char thierNonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], SLNet::RakString password, char out[HASHED_NONCE_AND_PW_LENGTH])
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::Hash
< SLNet::RakString,
SLNet::RakString,
16, SLNet::RakString::ToInteger > 		passwords
SLNet::Time whenLastTimeoutCheck
NonceGenerator nonceGenerator
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::TwoWayAuthentication::TwoWayAuthentication ( )
virtual SLNet::TwoWayAuthentication::~TwoWayAuthentication ( )
virtual

Member Function Documentation

bool SLNet::TwoWayAuthentication::AddPassword | ( | SLNet::RakString | identifier,
 |  | SLNet::RakString | password
 | ) |  |

Adds a password to the list of passwords the system will accept.

Each password, which is secret and not transmitted, is identified by identifier. identifier is transmitted in plaintext with the request. It is only needed because the system supports multiple password. It is used to only hash against once password on the remote system, rather than having to hash against every known password.

Parameters
[in] | identifier | A unique identifier representing this password. This is transmitted in plaintext and should be considered insecure
[in] | password | The password to add
Returns
True on success, false on identifier==password, either identifier or password is blank, or identifier is already in use
bool SLNet::TwoWayAuthentication::Challenge | ( | SLNet::RakString | identifier,
 |  | AddressOrGUID | remoteSystem
 | ) |  |

Challenge another system for the specified identifier.

After calling Challenge, you will get back ID_TWO_WAY_AUTHENTICATION_SUCCESS, ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT, or ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILED ID_TWO_WAY_AUTHENTICATION_SUCCESS will be returned if and only if the other system has called AddPassword() with the same identifier pair as this system.

Parameters
[in] identifier A unique identifier representing this password. This is transmitted in plaintext and should be considered insecure
Returns
True on success, false on remote system not connected, or identifier not previously added with AddPassword()
void SLNet::TwoWayAuthentication::Clear ( void )

Free all memory.

void SLNet::TwoWayAuthentication::Hash | ( | char | thierNonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH],
 |  | SLNet::RakString | password,
 |  | char | out[HASHED_NONCE_AND_PW_LENGTH]
 | ) |  |
protected
virtual void SLNet::TwoWayAuthentication::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

PluginReceiveResult SLNet::TwoWayAuthentication::OnHashedNonceAndPassword ( Packet * packet )
protected
void SLNet::TwoWayAuthentication::OnNonceReply ( Packet * packet )
protected
void SLNet::TwoWayAuthentication::OnNonceRequest ( Packet * packet )
protected
void SLNet::TwoWayAuthentication::OnPasswordResult ( Packet * packet )
protected
virtual void SLNet::TwoWayAuthentication::OnRakPeerShutdown ( void )
virtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::TwoWayAuthentication::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::TwoWayAuthentication::PushToUser | ( | MessageID | messageId,
 |  | SLNet::RakString | password,
 |  | SLNet::AddressOrGUID | remoteSystem
 | ) |  |
protected
virtual void SLNet::TwoWayAuthentication::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

NonceGenerator SLNet::TwoWayAuthentication::nonceGenerator
protected

Definition at line 146 of file TwoWayAuthentication.h.

DataStructures::Queue<PendingChallenge> SLNet::TwoWayAuthentication::outgoingChallenges

Definition at line 113 of file TwoWayAuthentication.h.

DataStructures::Hash<SLNet::RakString, SLNet::RakString, 16, SLNet::RakString::ToInteger > SLNet::TwoWayAuthentication::passwords
protected

Definition at line 142 of file TwoWayAuthentication.h.

SLNet::Time SLNet::TwoWayAuthentication::whenLastTimeoutCheck
protected

Definition at line 144 of file TwoWayAuthentication.h.

struct SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest

Definition at line 116 of file TwoWayAuthentication.h.

Class Members
char | nonce
AddressOrGUID | remoteSystem
unsigned short | requestId
Time | whenGenerated
struct SLNet::TwoWayAuthentication::NonceGenerator

Definition at line 124 of file TwoWayAuthentication.h.

Public Member Functions

NonceGenerator ()
~NonceGenerator ()
void | GetNonce (char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], unsigned short *requestId, SLNet::AddressOrGUID remoteSystem)
void | GenerateNonce (char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH])
bool | GetNonceById (char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], unsigned short requestId, SLNet::AddressOrGUID remoteSystem, bool popIfFound)
void | Clear (void)
void | ClearByAddress (SLNet::AddressOrGUID remoteSystem)
void | Update (SLNet::Time curTime)

Public Attributes

DataStructures::List
< TwoWayAuthentication::NonceAndRemoteSystemRequest * > 		generatedNonces
unsigned short | nextRequestId

Constructor & Destructor Documentation

SLNet::TwoWayAuthentication::NonceGenerator::NonceGenerator ( )
SLNet::TwoWayAuthentication::NonceGenerator::~NonceGenerator ( )

Member Function Documentation

void SLNet::TwoWayAuthentication::NonceGenerator::Clear ( void )
void SLNet::TwoWayAuthentication::NonceGenerator::ClearByAddress ( SLNet::AddressOrGUID remoteSystem )
void SLNet::TwoWayAuthentication::NonceGenerator::GenerateNonce ( char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH] )
void SLNet::TwoWayAuthentication::NonceGenerator::GetNonce | ( | char | nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH],
 |  | unsigned short * | requestId,
 |  | SLNet::AddressOrGUID | remoteSystem
 | ) |  |
bool SLNet::TwoWayAuthentication::NonceGenerator::GetNonceById | ( | char | nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH],
 |  | unsigned short | requestId,
 |  | SLNet::AddressOrGUID | remoteSystem,
 |  | bool | popIfFound
 | ) |  |
void SLNet::TwoWayAuthentication::NonceGenerator::Update ( SLNet::Time curTime )

Member Data Documentation

DataStructures::List<TwoWayAuthentication::NonceAndRemoteSystemRequest*> SLNet::TwoWayAuthentication::NonceGenerator::generatedNonces

Definition at line 135 of file TwoWayAuthentication.h.

unsigned short SLNet::TwoWayAuthentication::NonceGenerator::nextRequestId

Definition at line 136 of file TwoWayAuthentication.h.

struct SLNet::TwoWayAuthentication::PendingChallenge

Definition at line 105 of file TwoWayAuthentication.h.

Class Members
RakString | identifier
AddressOrGUID | remoteSystem
bool | sentHash
Time | time
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: CloudComputing

Classes
CloudComputing
Plugins

Contains the CloudClient and CloudServer plugins. More...

Classes

class | SLNet::CloudClient
Performs Post() and Get() operations on CloudMemoryServer. More...
class | SLNet::CloudClientCallback
class | SLNet::CloudAllocator
struct | SLNet::CloudKey
struct | SLNet::CloudQuery
struct | SLNet::CloudQueryRow
struct | SLNet::CloudQueryResult
class | SLNet::CloudServerQueryFilter
Zero or more instances of CloudServerQueryFilter can be attached to CloudServer to restrict client queries All attached instances of CloudServerQueryFilter on each corresponding operation, from all directly connected clients If any attached instance returns false for a given operation, that operation is silently rejected. More...
class | SLNet::CloudServer
Stores client data, and allows cross-server communication to retrieve this data. More...
struct | SLNet::CloudServer::BufferedGetResponseFromServer
struct | SLNet::CloudServer::CloudData
struct | SLNet::CloudServer::CloudDataList
struct | SLNet::CloudServer::CloudQueryWithAddresses
struct | SLNet::CloudServer::GetRequest
struct | SLNet::CloudServer::KeySubscriberID
struct | SLNet::CloudServer::RemoteCloudClient
struct | SLNet::CloudServer::RemoteServer

Detailed Description

Contains the CloudClient and CloudServer plugins.

The CloudServer plugins operates on requests from the CloudClient plugin. The servers are in a fully connected mesh topology, which the clients are connected to any server. Clients can interact with each other by posting and subscribing to memory updates, without being directly connected or even knowing about each other.

Class Documentation

class SLNet::CloudClient

Performs Post() and Get() operations on CloudMemoryServer.

A CloudClient is a computer connected to one or more servers in a cloud configuration. Operations by one CloudClient can be received and subscribed to by other instances of CloudClient, without those clients being connected, even on different servers.

Definition at line 46 of file CloudClient.h.

+ Inheritance diagram for SLNet::CloudClient:

Public Member Functions

CloudClient ()
virtual | ~CloudClient ()
virtual void | SetDefaultCallbacks (CloudAllocator *_allocator, CloudClientCallback *_callback)
Set the default callbacks for OnGetReponse(), OnSubscriptionNotification(), and OnSubscriptionDataDeleted()
virtual void | Post (CloudKey *cloudKey, const unsigned char *data, uint32_t dataLengthBytes, RakNetGUID systemIdentifier)
Uploads data to the cloud.
virtual void | Release (DataStructures::List< CloudKey > &keys, RakNetGUID systemIdentifier)
Releases one or more data previously uploaded with Post()
virtual bool | Get (CloudQuery *cloudQuery, RakNetGUID systemIdentifier)
Gets data from the cloud.
virtual bool | Get (CloudQuery *cloudQuery, DataStructures::List< RakNetGUID > &specificSystems, RakNetGUID systemIdentifier)
virtual bool | Get (CloudQuery *cloudQuery, DataStructures::List< CloudQueryRow * > &specificSystems, RakNetGUID systemIdentifier)
virtual void | Unsubscribe (DataStructures::List< CloudKey > &keys, RakNetGUID systemIdentifier)
Unsubscribe from updates previously subscribed to using Get() with the CloudQuery::subscribeToResults set to true The keys and specificSystems parameters are logically treated as AND when checking subscriptions on the server The overload that does not take specificSystems unsubscribes to all passed keys, regardless of system You cannot unsubscribe specific systems when previously subscribed to updates from any system. To do this, first Unsubscribe() from all systems, and call Get() with the specificSystems parameter explicilty listing the systems you want to subscribe to.
virtual void | Unsubscribe (DataStructures::List< CloudKey > &keys, DataStructures::List< RakNetGUID > &specificSystems, RakNetGUID systemIdentifier)
virtual void | Unsubscribe (DataStructures::List< CloudKey > &keys, DataStructures::List< CloudQueryRow * > &specificSystems, RakNetGUID systemIdentifier)
virtual void | OnGetReponse (Packet *packet, CloudClientCallback *_callback=0, CloudAllocator *_allocator=0)
Call this when you get ID_CLOUD_GET_RESPONSE If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.
virtual void | OnGetReponse (CloudQueryResult *cloudQueryResult, Packet *packet, CloudAllocator *_allocator=0)
Call this when you get ID_CLOUD_GET_RESPONSE Different form of OnGetReponse that returns to a structure that you pass, instead of using a callback You are responsible for deallocation with this form If allocator is 0, the default callback passed to SetDefaultCallbacks() are used.
virtual void | OnSubscriptionNotification (Packet *packet, CloudClientCallback *_callback=0, CloudAllocator *_allocator=0)
Call this when you get ID_CLOUD_SUBSCRIPTION_NOTIFICATION If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.
virtual void | OnSubscriptionNotification (bool *wasUpdated, CloudQueryRow *row, Packet *packet, CloudAllocator *_allocator=0)
Call this when you get ID_CLOUD_SUBSCRIPTION_NOTIFICATION Different form of OnSubscriptionNotification that returns to a structure that you pass, instead of using a callback You are responsible for deallocation with this form If allocator is 0, the default callback passed to SetDefaultCallbacks() are used.
virtual void | DeallocateWithDefaultAllocator (CloudQueryResult *cloudQueryResult)
If you never specified an allocator, and used the non-callback form of OnGetReponse(), deallocate cloudQueryResult with this function.
virtual void | DeallocateWithDefaultAllocator (CloudQueryRow *row)
If you never specified an allocator, and used the non-callback form of OnSubscriptionNotification(), deallocate row with this function.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

PluginReceiveResult | OnReceive (Packet *packet)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

CloudClientCallback * callback
CloudAllocator * allocator
CloudAllocator unsetDefaultAllocator
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::CloudClient::CloudClient ( )
virtual SLNet::CloudClient::~CloudClient ( )
virtual

Member Function Documentation

virtual void SLNet::CloudClient::DeallocateWithDefaultAllocator ( CloudQueryResult * cloudQueryResult )
virtual

If you never specified an allocator, and used the non-callback form of OnGetReponse(), deallocate cloudQueryResult with this function.

virtual void SLNet::CloudClient::DeallocateWithDefaultAllocator ( CloudQueryRow * row )
virtual

If you never specified an allocator, and used the non-callback form of OnSubscriptionNotification(), deallocate row with this function.

virtual bool SLNet::CloudClient::Get | ( | CloudQuery * | cloudQuery,
 |  | RakNetGUID | systemIdentifier
 | ) |  |
virtual

Gets data from the cloud.

For a given query containing one or more keys, return data that matches those keys. The values will be returned in the ID_CLOUD_GET_RESPONSE packet, which should be passed to OnGetReponse() and will invoke CloudClientCallback::OnGet() CloudQuery::startingRowIndex is used to skip the first n values that would normally be returned.. CloudQuery::maxRowsToReturn is used to limit the number of rows returned. The number of rows returned may also be limited by CloudServer::SetMaxBytesPerDownload(); CloudQuery::subscribeToResults if set to true, will cause ID_CLOUD_SUBSCRIPTION_NOTIFICATION to be returned to us when any of the keys in the query are updated or are deleted. ID_CLOUD_GET_RESPONSE will be returned even if subscribing to the result list. Only later updates will return ID_CLOUD_SUBSCRIPTION_NOTIFICATION. Calling Get() with CloudQuery::subscribeToResults false, when you are already subscribed, does not remove the subscription. Use Unsubscribe() for this. Resubscribing using the same CloudKey but a different or no specificSystems overwrites the subscribed systems for those keys.

Parameters
[in] | cloudQuery | One or more keys, and optional parameters to perform with the Get
[in] | systemIdentifier | A remote system running CloudServer that we are already connected to.
[in] | specificSystems | It is possible to get or subscribe to updates only for specific uploading CloudClient instances. Pass the desired instances here. The overload that does not have the specificSystems parameter is treated as subscribing to all updates from all clients.
virtual bool SLNet::CloudClient::Get | ( | CloudQuery * | cloudQuery,
 |  | DataStructures::List< RakNetGUID > & | specificSystems,
 |  | RakNetGUID | systemIdentifier
 | ) |  |
virtual
virtual bool SLNet::CloudClient::Get | ( | CloudQuery * | cloudQuery,
 |  | DataStructures::List< CloudQueryRow * > & | specificSystems,
 |  | RakNetGUID | systemIdentifier
 | ) |  |
virtual
virtual void SLNet::CloudClient::OnGetReponse | ( | Packet * | packet,
 |  | CloudClientCallback * | _callback = 0,
 |  | CloudAllocator * | _allocator = 0
 | ) |  |
virtual

Call this when you get ID_CLOUD_GET_RESPONSE If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.

Parameters
[in] | packet | Packet structure returned from RakPeerInterface
[in] | _callback | Callback to be called from the function containing output parameters. If 0, default is used.
[in] | _allocator | Allocator to be used to allocate data. If 0, default is used.
virtual void SLNet::CloudClient::OnGetReponse | ( | CloudQueryResult * | cloudQueryResult,
 |  | Packet * | packet,
 |  | CloudAllocator * | _allocator = 0
 | ) |  |
virtual

Call this when you get ID_CLOUD_GET_RESPONSE Different form of OnGetReponse that returns to a structure that you pass, instead of using a callback You are responsible for deallocation with this form If allocator is 0, the default callback passed to SetDefaultCallbacks() are used.

Parameters
[out] | cloudQueryResult | A pointer to a structure that will be filled out with data
[in] | packet | Packet structure returned from RakPeerInterface
[in] | _allocator | Allocator to be used to allocate data. If 0, default is used.
PluginReceiveResult SLNet::CloudClient::OnReceive ( Packet * packet )
protectedvirtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::CloudClient::OnSubscriptionNotification | ( | Packet * | packet,
 |  | CloudClientCallback * | _callback = 0,
 |  | CloudAllocator * | _allocator = 0
 | ) |  |
virtual

Call this when you get ID_CLOUD_SUBSCRIPTION_NOTIFICATION If callback or allocator are 0, the default callbacks passed to SetDefaultCallbacks() are used.

Parameters
[in] | packet | Packet structure returned from RakPeerInterface
[in] | _callback | Callback to be called from the function containing output parameters. If 0, default is used.
[in] | _allocator | Allocator to be used to allocate data. If 0, default is used.
virtual void SLNet::CloudClient::OnSubscriptionNotification | ( | bool * | wasUpdated,
 |  | CloudQueryRow * | row,
 |  | Packet * | packet,
 |  | CloudAllocator * | _allocator = 0
 | ) |  |
virtual

Call this when you get ID_CLOUD_SUBSCRIPTION_NOTIFICATION Different form of OnSubscriptionNotification that returns to a structure that you pass, instead of using a callback You are responsible for deallocation with this form If allocator is 0, the default callback passed to SetDefaultCallbacks() are used.

Parameters
[out] | wasUpdated | If true, the row was updated. If false, it was deleted. result will contain the last value just before deletion
[out] | row | A pointer to a structure that will be filled out with data
[in] | packet | Packet structure returned from RakPeerInterface
[in] | _allocator | Allocator to be used to allocate data. If 0, default is used.
virtual void SLNet::CloudClient::Post | ( | CloudKey * | cloudKey,
 |  | const unsigned char * | data,
 |  | uint32_t | dataLengthBytes,
 |  | RakNetGUID | systemIdentifier
 | ) |  |
virtual

Uploads data to the cloud.

Data uploaded to the cloud will be stored by the server sent to, identified by systemIdentifier. As long as you are connected to this server, the data will persist. Queries for that data by the Get() operation will return the RakNetGUID and SystemAddress of the uploader, as well as the data itself. Furthermore, if any clients are subscribed to the particular CloudKey passed, those clients will get update notices that the data has changed Passing data with the same cloudKey more than once will overwrite the prior value. This call will silently fail if CloudServer::SetMaxUploadBytesPerClient() is exceeded

Parameters
[in] | cloudKey | Identifies the data being uploaded
[in] | data | A pointer to data to upload. This pointer does not need to persist past the call
[in] | dataLengthBytes | The length in bytes of data
[in] | systemIdentifier | A remote system running CloudServer that we are already connected to.
virtual void SLNet::CloudClient::Release | ( | DataStructures::List< CloudKey > & | keys,
 |  | RakNetGUID | systemIdentifier
 | ) |  |
virtual

Releases one or more data previously uploaded with Post()

If a remote system has subscribed to one or more of the keys uploaded, they will get ID_CLOUD_SUBSCRIPTION_NOTIFICATION notifications containing the last value uploaded before deletions

Parameters
[in] | cloudKey | Identifies the data to release. It is possible to remove uploads from multiple Post() calls at once.
[in] | systemIdentifier | A remote system running CloudServer that we are already connected to.
virtual void SLNet::CloudClient::SetDefaultCallbacks | ( | CloudAllocator * | _allocator,
 |  | CloudClientCallback * | _callback
 | ) |  |
virtual

Set the default callbacks for OnGetReponse(), OnSubscriptionNotification(), and OnSubscriptionDataDeleted()

Pointers to CloudAllocator and CloudClientCallback can be stored by the system if desired. If a callback is not provided to OnGetReponse(), OnSubscriptionNotification(), OnSubscriptionDataDeleted(), the callback passed here will be used instead.

Parameters
[in] | _allocator | An instance of CloudAllocator
[in] | _callback | An instance of CloudClientCallback
virtual void SLNet::CloudClient::Unsubscribe | ( | DataStructures::List< CloudKey > & | keys,
 |  | RakNetGUID | systemIdentifier
 | ) |  |
virtual

Unsubscribe from updates previously subscribed to using Get() with the CloudQuery::subscribeToResults set to true The keys and specificSystems parameters are logically treated as AND when checking subscriptions on the server The overload that does not take specificSystems unsubscribes to all passed keys, regardless of system You cannot unsubscribe specific systems when previously subscribed to updates from any system. To do this, first Unsubscribe() from all systems, and call Get() with the specificSystems parameter explicilty listing the systems you want to subscribe to.

virtual void SLNet::CloudClient::Unsubscribe | ( | DataStructures::List< CloudKey > & | keys,
 |  | DataStructures::List< RakNetGUID > & | specificSystems,
 |  | RakNetGUID | systemIdentifier
 | ) |  |
virtual
virtual void SLNet::CloudClient::Unsubscribe | ( | DataStructures::List< CloudKey > & | keys,
 |  | DataStructures::List< CloudQueryRow * > & | specificSystems,
 |  | RakNetGUID | systemIdentifier
 | ) |  |
virtual

Member Data Documentation

CloudAllocator* SLNet::CloudClient::allocator
protected

Definition at line 147 of file CloudClient.h.

CloudClientCallback* SLNet::CloudClient::callback
protected

Definition at line 146 of file CloudClient.h.

CloudAllocator SLNet::CloudClient::unsetDefaultAllocator
protected

Definition at line 149 of file CloudClient.h.

class SLNet::CloudClientCallback

Parses ID_CLOUD_GET_RESPONSE and ID_CLOUD_SUBSCRIPTION_NOTIFICATION in a convenient callback form

Definition at line 154 of file CloudClient.h.

Public Member Functions

CloudClientCallback ()
virtual | ~CloudClientCallback ()
virtual void | OnGet (SLNet::CloudQueryResult *result, bool *deallocateRowsAfterReturn)
Called in response to ID_CLOUD_GET_RESPONSE.
virtual void | OnSubscriptionNotification (SLNet::CloudQueryRow *result, bool wasUpdated, bool *deallocateRowAfterReturn)
Called in response to ID_CLOUD_SUBSCRIPTION_NOTIFICATION.

Constructor & Destructor Documentation

SLNet::CloudClientCallback::CloudClientCallback ( )
inline

Definition at line 157 of file CloudClient.h.

virtual SLNet::CloudClientCallback::~CloudClientCallback ( )
inlinevirtual

Definition at line 158 of file CloudClient.h.

Member Function Documentation

virtual void SLNet::CloudClientCallback::OnGet | ( | SLNet::CloudQueryResult * | result,
 |  | bool * | deallocateRowsAfterReturn
 | ) |  |
inlinevirtual

Called in response to ID_CLOUD_GET_RESPONSE.

Parameters
[out] | result | Contains the original query passed to Get(), and a list of rows returned.
[out] | deallocateRowsAfterReturn | CloudQueryResult::rowsReturned will be deallocated after the function returns by default. Set to false to not deallocate these pointers. The pointers are allocated through CloudAllocator.

Definition at line 163 of file CloudClient.h.

virtual void SLNet::CloudClientCallback::OnSubscriptionNotification | ( | SLNet::CloudQueryRow * | result,
 |  | bool | wasUpdated,
 |  | bool * | deallocateRowAfterReturn
 | ) |  |
inlinevirtual

Called in response to ID_CLOUD_SUBSCRIPTION_NOTIFICATION.

Parameters
[out] | result | Contains the row updated
[out] | wasUpdated | If true, the row was updated. If false, it was deleted. result will contain the last value just before deletion
[out] | deallocateRowAfterReturn | result will be deallocated after the function returns by default. Set to false to not deallocate these pointers. The pointers are allocated through CloudAllocator.

Definition at line 169 of file CloudClient.h.

class SLNet::CloudAllocator

Allocates CloudQueryRow and the row data. Override to use derived classes or different allocators

Definition at line 33 of file CloudCommon.h.

+ Inheritance diagram for SLNet::CloudAllocator:

Public Member Functions

CloudAllocator ()
virtual | ~CloudAllocator ()
virtual CloudQueryRow * | AllocateCloudQueryRow (void)
Allocate a row.
virtual void | DeallocateCloudQueryRow (CloudQueryRow *row)
Free a row.
virtual unsigned char * | AllocateRowData (uint32_t bytesNeededForData)
Allocate CloudQueryRow::data.
virtual void | DeallocateRowData (void *data)
Free CloudQueryRow::data.

Constructor & Destructor Documentation

SLNet::CloudAllocator::CloudAllocator ( )
inline

Definition at line 36 of file CloudCommon.h.

virtual SLNet::CloudAllocator::~CloudAllocator ( )
inlinevirtual

Definition at line 37 of file CloudCommon.h.

Member Function Documentation

virtual CloudQueryRow* SLNet::CloudAllocator::AllocateCloudQueryRow ( void )
virtual

Allocate a row.

virtual unsigned char* SLNet::CloudAllocator::AllocateRowData ( uint32_t bytesNeededForData )
virtual

Allocate CloudQueryRow::data.

virtual void SLNet::CloudAllocator::DeallocateCloudQueryRow ( CloudQueryRow * row )
virtual

Free a row.

virtual void SLNet::CloudAllocator::DeallocateRowData ( void * data )
virtual

Free CloudQueryRow::data.

struct SLNet::CloudKey

Serves as a key to identify data uploaded to or queried from the server.

Definition at line 51 of file CloudCommon.h.

Public Member Functions

CloudKey ()
CloudKey (SLNet::RakString _primaryKey, uint32_t _secondaryKey)
~CloudKey ()
void Serialize (bool writeToBitstream, BitStream *bitStream)

Public Attributes

SLNet::RakString primaryKey
uint32_t secondaryKey
Identifies the secondary key. This is intended to be a subcategory enumeration, such as PLAYER_LIST or RUNNING_SCORES.

Constructor & Destructor Documentation

SLNet::CloudKey::CloudKey ( )
inline

Definition at line 53 of file CloudCommon.h.

SLNet::CloudKey::CloudKey | ( | SLNet::RakString | _primaryKey,
 |  | uint32_t | _secondaryKey
 | ) |  |
inline

Definition at line 54 of file CloudCommon.h.

SLNet::CloudKey::~CloudKey ( )
inline

Definition at line 55 of file CloudCommon.h.

Member Function Documentation

void SLNet::CloudKey::Serialize | ( | bool | writeToBitstream,
 |  | BitStream * | bitStream
 | ) |  |

Member Data Documentation

SLNet::RakString SLNet::CloudKey::primaryKey

Identifies the primary key. This is intended to be a major category, such as the name of the application Must be non-empty

Definition at line 59 of file CloudCommon.h.

uint32_t SLNet::CloudKey::secondaryKey

Identifies the secondary key. This is intended to be a subcategory enumeration, such as PLAYER_LIST or RUNNING_SCORES.

Definition at line 62 of file CloudCommon.h.

struct SLNet::CloudQuery

Data members used to query the cloud

Definition at line 73 of file CloudCommon.h.

Public Member Functions

CloudQuery ()
void | Serialize (bool writeToBitstream, BitStream *bitStream)

Public Attributes

DataStructures::List< CloudKey > keys
uint32_t startingRowIndex
If limiting the number of rows to return, this is the starting offset into the list. Has no effect unless maxRowsToReturn is > 0.
uint32_t maxRowsToReturn
Maximum number of rows to return. Actual number may still be less than this. Pass 0 to mean no-limit.
bool | subscribeToResults
If true, automatically get updates as the results returned to you change. Unsubscribe with CloudMemoryClient::Unsubscribe()

Constructor & Destructor Documentation

SLNet::CloudQuery::CloudQuery ( )
inline

Definition at line 75 of file CloudCommon.h.

Member Function Documentation

void SLNet::CloudQuery::Serialize | ( | bool | writeToBitstream,
 |  | BitStream * | bitStream
 | ) |  |

Member Data Documentation

DataStructures::List<CloudKey> SLNet::CloudQuery::keys

List of keys to query. Must be at least of length 1. This query is run on uploads from all clients, and those that match the combination of primaryKey and secondaryKey are potentially returned If you pass more than one key at a time, the results are concatenated so if you need to differentiate between queries then send two different queries

Definition at line 80 of file CloudCommon.h.

uint32_t SLNet::CloudQuery::maxRowsToReturn

Maximum number of rows to return. Actual number may still be less than this. Pass 0 to mean no-limit.

Definition at line 86 of file CloudCommon.h.

uint32_t SLNet::CloudQuery::startingRowIndex

If limiting the number of rows to return, this is the starting offset into the list. Has no effect unless maxRowsToReturn is > 0.

Definition at line 83 of file CloudCommon.h.

bool SLNet::CloudQuery::subscribeToResults

If true, automatically get updates as the results returned to you change. Unsubscribe with CloudMemoryClient::Unsubscribe()

Definition at line 89 of file CloudCommon.h.

struct SLNet::CloudQueryRow

Definition at line 96 of file CloudCommon.h.

Public Member Functions

void | Serialize (bool writeToBitstream, BitStream *bitStream, CloudAllocator *allocator)

Public Attributes

CloudKey key
Key used to identify this data.
unsigned char * | data
Data uploaded.
uint32_t length
Length of data uploaded.
SystemAddress serverSystemAddress
System address of server that is holding this data, and the client is connected to.
SystemAddress clientSystemAddress
System address of client that uploaded this data.
RakNetGUID serverGUID
RakNetGUID of server that is holding this data, and the client is connected to.
RakNetGUID clientGUID
RakNetGUID of client that uploaded this data.

Member Function Documentation

void SLNet::CloudQueryRow::Serialize | ( | bool | writeToBitstream,
 |  | BitStream * | bitStream,
 |  | CloudAllocator * | allocator
 | ) |  |

Member Data Documentation

RakNetGUID SLNet::CloudQueryRow::clientGUID

RakNetGUID of client that uploaded this data.

Definition at line 117 of file CloudCommon.h.

SystemAddress SLNet::CloudQueryRow::clientSystemAddress

System address of client that uploaded this data.

Definition at line 111 of file CloudCommon.h.

unsigned char* SLNet::CloudQueryRow::data

Data uploaded.

Definition at line 102 of file CloudCommon.h.

CloudKey SLNet::CloudQueryRow::key

Key used to identify this data.

Definition at line 99 of file CloudCommon.h.

uint32_t SLNet::CloudQueryRow::length

Length of data uploaded.

Definition at line 105 of file CloudCommon.h.

RakNetGUID SLNet::CloudQueryRow::serverGUID

RakNetGUID of server that is holding this data, and the client is connected to.

Definition at line 114 of file CloudCommon.h.

SystemAddress SLNet::CloudQueryRow::serverSystemAddress

System address of server that is holding this data, and the client is connected to.

Definition at line 108 of file CloudCommon.h.

struct SLNet::CloudQueryResult

Definition at line 124 of file CloudCommon.h.

Public Member Functions

void | Serialize (bool writeToBitstream, BitStream *bitStream, CloudAllocator *allocator)
void | SerializeHeader (bool writeToBitstream, BitStream *bitStream)
void | SerializeNumRows (bool writeToBitstream, uint32_t &numRows, BitStream *bitStream)
void | SerializeCloudQueryRows (bool writeToBitstream, uint32_t &numRows, BitStream *bitStream, CloudAllocator *allocator)

Public Attributes

CloudQuery cloudQuery
Query originally passed to Download()
DataStructures::List
< CloudQueryRow * > 		rowsReturned
Results returned from query. If there were multiple keys in CloudQuery::keys then see resultKeyIndices.
DataStructures::List< uint32_t > resultKeyIndices
bool | subscribeToResults
Whatever was passed to CloudClient::Get() as CloudQuery::subscribeToResults.

Member Function Documentation

void SLNet::CloudQueryResult::Serialize | ( | bool | writeToBitstream,
 |  | BitStream * | bitStream,
 |  | CloudAllocator * | allocator
 | ) |  |
void SLNet::CloudQueryResult::SerializeCloudQueryRows | ( | bool | writeToBitstream,
 |  | uint32_t & | numRows,
 |  | BitStream * | bitStream,
 |  | CloudAllocator * | allocator
 | ) |  |
void SLNet::CloudQueryResult::SerializeHeader | ( | bool | writeToBitstream,
 |  | BitStream * | bitStream
 | ) |  |
void SLNet::CloudQueryResult::SerializeNumRows | ( | bool | writeToBitstream,
 |  | uint32_t & | numRows,
 |  | BitStream * | bitStream
 | ) |  |

Member Data Documentation

CloudQuery SLNet::CloudQueryResult::cloudQuery

Query originally passed to Download()

Definition at line 127 of file CloudCommon.h.

DataStructures::List<uint32_t> SLNet::CloudQueryResult::resultKeyIndices

If there were multiple keys in CloudQuery::keys, then each key is processed in order and the result concatenated to rowsReturned The starting index of each query is written to resultKeyIndices For example, if CloudQuery::keys had 4 keys, returning 3 rows, 0, rows, 5 rows, and 12 rows then resultKeyIndices would be 0, 3, 3, 8

Definition at line 136 of file CloudCommon.h.

DataStructures::List<CloudQueryRow*> SLNet::CloudQueryResult::rowsReturned

Results returned from query. If there were multiple keys in CloudQuery::keys then see resultKeyIndices.

Definition at line 130 of file CloudCommon.h.

bool SLNet::CloudQueryResult::subscribeToResults

Whatever was passed to CloudClient::Get() as CloudQuery::subscribeToResults.

Definition at line 139 of file CloudCommon.h.

class SLNet::CloudServerQueryFilter

Zero or more instances of CloudServerQueryFilter can be attached to CloudServer to restrict client queries All attached instances of CloudServerQueryFilter on each corresponding operation, from all directly connected clients If any attached instance returns false for a given operation, that operation is silently rejected.

Definition at line 48 of file CloudServer.h.

Public Member Functions

CloudServerQueryFilter ()
virtual | ~CloudServerQueryFilter ()
virtual bool | OnPostRequest (RakNetGUID clientGuid, SystemAddress clientAddress, CloudKey key, uint32_t dataLength, const char *data)=0
virtual bool | OnReleaseRequest (RakNetGUID clientGuid, SystemAddress clientAddress, DataStructures::List< CloudKey > &cloudKeys)=0
virtual bool | OnGetRequest (RakNetGUID clientGuid, SystemAddress clientAddress, CloudQuery &query, DataStructures::List< RakNetGUID > &specificSystems)=0
virtual bool | OnUnsubscribeRequest (RakNetGUID clientGuid, SystemAddress clientAddress, DataStructures::List< CloudKey > &cloudKeys, DataStructures::List< RakNetGUID > &specificSystems)=0

Constructor & Destructor Documentation

SLNet::CloudServerQueryFilter::CloudServerQueryFilter ( )
inline

Definition at line 51 of file CloudServer.h.

virtual SLNet::CloudServerQueryFilter::~CloudServerQueryFilter ( )
inlinevirtual

Definition at line 52 of file CloudServer.h.

Member Function Documentation

virtual bool SLNet::CloudServerQueryFilter::OnGetRequest | ( | RakNetGUID | clientGuid,
 |  | SystemAddress | clientAddress,
 |  | CloudQuery & | query,
 |  | DataStructures::List< RakNetGUID > & | specificSystems
 | ) |  |
pure virtual

Called when a local client wants to query data If you return false, the client will get no response at all

Returns
true to allow, false to reject
virtual bool SLNet::CloudServerQueryFilter::OnPostRequest | ( | RakNetGUID | clientGuid,
 |  | SystemAddress | clientAddress,
 |  | CloudKey | key,
 |  | uint32_t | dataLength,
 |  | const char * | data
 | ) |  |
pure virtual

Called when a local client wants to post data

Returns
true to allow, false to reject
virtual bool SLNet::CloudServerQueryFilter::OnReleaseRequest | ( | RakNetGUID | clientGuid,
 |  | SystemAddress | clientAddress,
 |  | DataStructures::List< CloudKey > & | cloudKeys
 | ) |  |
pure virtual

Called when a local client wants to release data that it has previously uploaded

Returns
true to allow, false to reject
virtual bool SLNet::CloudServerQueryFilter::OnUnsubscribeRequest | ( | RakNetGUID | clientGuid,
 |  | SystemAddress | clientAddress,
 |  | DataStructures::List< CloudKey > & | cloudKeys,
 |  | DataStructures::List< RakNetGUID > & | specificSystems
 | ) |  |
pure virtual

Called when a local client wants to stop getting updates for data If you return false, the client will keep getting updates for that data

Returns
true to allow, false to reject
class SLNet::CloudServer

Stores client data, and allows cross-server communication to retrieve this data.

Definition at line 75 of file CloudServer.h.

+ Inheritance diagram for SLNet::CloudServer:

Public Member Functions

CloudServer ()
virtual | ~CloudServer ()
void | SetMaxUploadBytesPerClient (uint64_t bytes)
Max bytes a client can upload Data in excess of this value is silently ignored defaults to 0 (unlimited)
void | SetMaxBytesPerDownload (uint64_t bytes)
Max bytes returned by a download. If the number of bytes would exceed this amount, the returned list is truncated However, if this would result in no rows downloaded, then one row will be returned.
void | AddServer (RakNetGUID systemIdentifier)
Add a server, which is assumed to be connected in a fully connected mesh to all other servers and also running the CloudServer plugin The other system must also call AddServer before getting the subscription data, or it will be rejected. Sending a message telling the other system to call AddServer(), followed by calling AddServer() locally, would be sufficient for this to work.
void | RemoveServer (RakNetGUID systemIdentifier)
Removes a server added through AddServer()
void | GetRemoteServers (DataStructures::List< RakNetGUID > &remoteServersOut)
void | Clear (void)
Frees all memory. Does not remove query filters.
void | ForceExternalSystemAddress (SystemAddress forcedAddress)
Report the specified SystemAddress to client queries, rather than what RakPeer reads. This is useful if you already know your public IP This only applies to future updates, so call it before updating to apply to all queries.
void | AddQueryFilter (CloudServerQueryFilter *filter)
Adds a callback called on each query. If all filters returns true for an operation, the operation is allowed. If the filter was already added, the function silently fails.
void | RemoveQueryFilter (CloudServerQueryFilter *filter)
Removes a callback added with AddQueryFilter() The instance is not deleted, only unreferenced. It is up to the user to delete the instance, if necessary.
void | RemoveAllQueryFilters (void)
Removes all instances of CloudServerQueryFilter added with AddQueryFilter(). The instances are not deleted, only unreferenced. It is up to the user to delete the instances, if necessary.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnPostRequest (Packet *packet)
virtual void | OnReleaseRequest (Packet *packet)
virtual void | OnGetRequest (Packet *packet)
virtual void | OnUnsubscribeRequest (Packet *packet)
virtual void | OnServerToServerGetRequest (Packet *packet)
virtual void | OnServerToServerGetResponse (Packet *packet)
void | WriteCloudQueryRowFromResultList (unsigned int i, DataStructures::List< CloudData * > &cloudDataResultList, DataStructures::List< CloudKey > &cloudKeyResultList, BitStream *bsOut)
void | WriteCloudQueryRowFromResultList (DataStructures::List< CloudData * > &cloudDataResultList, DataStructures::List< CloudKey > &cloudKeyResultList, BitStream *bsOut)
void | ReleaseSystem (RakNetGUID clientAddress)
void | ReleaseKeys (RakNetGUID clientAddress, DataStructures::List< CloudKey > &keys)
void | NotifyClientSubscribersOfDataChange (CloudData *cloudData, CloudKey &key, DataStructures::OrderedList< RakNetGUID, RakNetGUID > &subscribers, bool wasUpdated)
void | NotifyClientSubscribersOfDataChange (CloudQueryRow *row, DataStructures::OrderedList< RakNetGUID, RakNetGUID > &subscribers, bool wasUpdated)
void | NotifyServerSubscribersOfDataChange (CloudData *cloudData, CloudKey &key, bool wasUpdated)
void | ProcessAndTransmitGetRequest (GetRequest *getRequest)
void | ProcessCloudQueryWithAddresses (CloudServer::CloudQueryWithAddresses &cloudQueryWithAddresses, DataStructures::List< CloudData * > &cloudDataResultList, DataStructures::List< CloudKey > &cloudKeyResultList)
void | SendUploadedAndSubscribedKeysToServer (RakNetGUID systemAddress)
void | SendUploadedKeyToServers (CloudKey &cloudKey)
void | SendSubscribedKeyToServers (CloudKey &cloudKey)
void | RemoveUploadedKeyFromServers (CloudKey &cloudKey)
void | RemoveSubscribedKeyFromServers (CloudKey &cloudKey)
void | OnSendUploadedAndSubscribedKeysToServer (Packet *packet)
void | OnSendUploadedKeyToServers (Packet *packet)
void | OnSendSubscribedKeyToServers (Packet *packet)
void | OnRemoveUploadedKeyFromServers (Packet *packet)
void | OnRemoveSubscribedKeyFromServers (Packet *packet)
void | OnServerDataChanged (Packet *packet)
void | GetServersWithUploadedKeys (DataStructures::List< CloudKey > &keys, DataStructures::List< RemoteServer * > &remoteServersWithData)
CloudServer::CloudDataList * | GetOrAllocateCloudDataList (CloudKey key, bool *dataRepositoryExists, unsigned int &dataRepositoryIndex)
void | UnsubscribeFromKey (RemoteCloudClient *remoteCloudClient, RakNetGUID remoteCloudClientGuid, unsigned int keySubscriberIndex, CloudKey &cloudKey, DataStructures::List< RakNetGUID > &specificSystems)
void | RemoveSpecificSubscriber (RakNetGUID specificSubscriber, CloudDataList *cloudDataList, RakNetGUID remoteCloudClientGuid)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Static Protected Member Functions

static int | KeyDataPtrComp (const RakNetGUID &key, CloudData *const &data)
static int | KeyDataListComp (const CloudKey &key, CloudDataList *const &data)
static int | KeySubscriberIDComp (const CloudKey &key, KeySubscriberID *const &data)
static int | RemoteServerComp (const RakNetGUID &key, RemoteServer *const &data)
static int | BufferedGetResponseFromServerComp (const RakNetGUID &key, BufferedGetResponseFromServer *const &data)
static int | GetRequestComp (const uint32_t &key, GetRequest *const &data)

Protected Attributes

uint64_t maxUploadBytesPerClient
uint64_t maxBytesPerDowload
DataStructures::OrderedList
< CloudKey, CloudDataList
*, CloudServer::KeyDataListComp > 		dataRepository
DataStructures::Hash
< RakNetGUID,
RemoteCloudClient
*, 2048, RakNetGUID::ToUint32 > 		remoteSystems
DataStructures::OrderedList
< RakNetGUID, RemoteServer
*, CloudServer::RemoteServerComp > 		remoteServers
DataStructures::OrderedList
< uint32_t, GetRequest
*, CloudServer::GetRequestComp > 		getRequests
SLNet::Time nextGetRequestsCheck
uint32_t nextGetRequestId
DataStructures::List
< CloudServerQueryFilter * > 		queryFilters
SystemAddress forceAddress
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Additional Inherited Members

- Private Member Functions inherited from SLNet::CloudAllocator
CloudAllocator ()
virtual | ~CloudAllocator ()
virtual CloudQueryRow * | AllocateCloudQueryRow (void)
Allocate a row.
virtual void | DeallocateCloudQueryRow (CloudQueryRow *row)
Free a row.
virtual unsigned char * | AllocateRowData (uint32_t bytesNeededForData)
Allocate CloudQueryRow::data.
virtual void | DeallocateRowData (void *data)
Free CloudQueryRow::data.

Constructor & Destructor Documentation

SLNet::CloudServer::CloudServer ( )
virtual SLNet::CloudServer::~CloudServer ( )
virtual

Member Function Documentation

void SLNet::CloudServer::AddQueryFilter ( CloudServerQueryFilter * filter )

Adds a callback called on each query. If all filters returns true for an operation, the operation is allowed. If the filter was already added, the function silently fails.

Parameters
[in] filter An externally allocated instance of CloudServerQueryFilter. The instance must remain valid until it is removed with RemoveQueryFilter() or RemoveAllQueryFilters()
void SLNet::CloudServer::AddServer ( RakNetGUID systemIdentifier )

Add a server, which is assumed to be connected in a fully connected mesh to all other servers and also running the CloudServer plugin The other system must also call AddServer before getting the subscription data, or it will be rejected. Sending a message telling the other system to call AddServer(), followed by calling AddServer() locally, would be sufficient for this to work.

Note
This sends subscription data to the other system, using RELIABLE_ORDERED on channel 0
Parameters
[in] systemIdentifier Identifier of the remote system
static int SLNet::CloudServer::BufferedGetResponseFromServerComp | ( | const RakNetGUID & | key,
 |  | BufferedGetResponseFromServer *const & | data
 | ) |  |
staticprotected
void SLNet::CloudServer::Clear ( void )

Frees all memory. Does not remove query filters.

void SLNet::CloudServer::ForceExternalSystemAddress ( SystemAddress forcedAddress )

Report the specified SystemAddress to client queries, rather than what RakPeer reads. This is useful if you already know your public IP This only applies to future updates, so call it before updating to apply to all queries.

Parameters
[in] forcedAddress The systmeAddress to return in queries. Use UNASSIGNED_SYSTEM_ADDRESS (default) to use what RakPeer returns
CloudServer::CloudDataList* SLNet::CloudServer::GetOrAllocateCloudDataList | ( | CloudKey | key,
 |  | bool * | dataRepositoryExists,
 |  | unsigned int & | dataRepositoryIndex
 | ) |  |
protected
void SLNet::CloudServer::GetRemoteServers ( DataStructures::List< RakNetGUID > & remoteServersOut )

Return list of servers added with AddServer()

Parameters
[out] remoteServers List of servers added
static int SLNet::CloudServer::GetRequestComp | ( | const uint32_t & | key,
 |  | GetRequest *const & | data
 | ) |  |
staticprotected
void SLNet::CloudServer::GetServersWithUploadedKeys | ( | DataStructures::List< CloudKey > & | keys,
 |  | DataStructures::List< RemoteServer * > & | remoteServersWithData
 | ) |  |
protected
static int SLNet::CloudServer::KeyDataListComp | ( | const CloudKey & | key,
 |  | CloudDataList *const & | data
 | ) |  |
staticprotected
static int SLNet::CloudServer::KeyDataPtrComp | ( | const RakNetGUID & | key,
 |  | CloudData *const & | data
 | ) |  |
staticprotected
static int SLNet::CloudServer::KeySubscriberIDComp | ( | const CloudKey & | key,
 |  | KeySubscriberID *const & | data
 | ) |  |
staticprotected
void SLNet::CloudServer::NotifyClientSubscribersOfDataChange | ( | CloudData * | cloudData,
 |  | CloudKey & | key,
 |  | DataStructures::OrderedList< RakNetGUID, RakNetGUID > & | subscribers,
 |  | bool | wasUpdated
 | ) |  |
protected
void SLNet::CloudServer::NotifyClientSubscribersOfDataChange | ( | CloudQueryRow * | row,
 |  | DataStructures::OrderedList< RakNetGUID, RakNetGUID > & | subscribers,
 |  | bool | wasUpdated
 | ) |  |
protected
void SLNet::CloudServer::NotifyServerSubscribersOfDataChange | ( | CloudData * | cloudData,
 |  | CloudKey & | key,
 |  | bool | wasUpdated
 | ) |  |
protected
virtual void SLNet::CloudServer::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
protectedvirtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::CloudServer::OnGetRequest ( Packet * packet )
protectedvirtual
virtual void SLNet::CloudServer::OnPostRequest ( Packet * packet )
protectedvirtual
virtual void SLNet::CloudServer::OnRakPeerShutdown ( void )
protectedvirtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::CloudServer::OnReceive ( Packet * packet )
protectedvirtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::CloudServer::OnReleaseRequest ( Packet * packet )
protectedvirtual
void SLNet::CloudServer::OnRemoveSubscribedKeyFromServers ( Packet * packet )
protected
void SLNet::CloudServer::OnRemoveUploadedKeyFromServers ( Packet * packet )
protected
void SLNet::CloudServer::OnSendSubscribedKeyToServers ( Packet * packet )
protected
void SLNet::CloudServer::OnSendUploadedAndSubscribedKeysToServer ( Packet * packet )
protected
void SLNet::CloudServer::OnSendUploadedKeyToServers ( Packet * packet )
protected
void SLNet::CloudServer::OnServerDataChanged ( Packet * packet )
protected
virtual void SLNet::CloudServer::OnServerToServerGetRequest ( Packet * packet )
protectedvirtual
virtual void SLNet::CloudServer::OnServerToServerGetResponse ( Packet * packet )
protectedvirtual
virtual void SLNet::CloudServer::OnUnsubscribeRequest ( Packet * packet )
protectedvirtual
void SLNet::CloudServer::ProcessAndTransmitGetRequest ( GetRequest * getRequest )
protected
void SLNet::CloudServer::ProcessCloudQueryWithAddresses | ( | CloudServer::CloudQueryWithAddresses & | cloudQueryWithAddresses,
 |  | DataStructures::List< CloudData * > & | cloudDataResultList,
 |  | DataStructures::List< CloudKey > & | cloudKeyResultList
 | ) |  |
protected
void SLNet::CloudServer::ReleaseKeys | ( | RakNetGUID | clientAddress,
 |  | DataStructures::List< CloudKey > & | keys
 | ) |  |
protected
void SLNet::CloudServer::ReleaseSystem ( RakNetGUID clientAddress )
protected
static int SLNet::CloudServer::RemoteServerComp | ( | const RakNetGUID & | key,
 |  | RemoteServer *const & | data
 | ) |  |
staticprotected
void SLNet::CloudServer::RemoveAllQueryFilters ( void )

Removes all instances of CloudServerQueryFilter added with AddQueryFilter(). The instances are not deleted, only unreferenced. It is up to the user to delete the instances, if necessary.

void SLNet::CloudServer::RemoveQueryFilter ( CloudServerQueryFilter * filter )

Removes a callback added with AddQueryFilter() The instance is not deleted, only unreferenced. It is up to the user to delete the instance, if necessary.

Parameters
[in] filter An externally allocated instance of CloudServerQueryFilter. The instance must remain valid until it is removed with RemoveQueryFilter() or RemoveAllQueryFilters()
void SLNet::CloudServer::RemoveServer ( RakNetGUID systemIdentifier )

Removes a server added through AddServer()

Parameters
[in] systemIdentifier Identifier of the remote system
void SLNet::CloudServer::RemoveSpecificSubscriber | ( | RakNetGUID | specificSubscriber,
 |  | CloudDataList * | cloudDataList,
 |  | RakNetGUID | remoteCloudClientGuid
 | ) |  |
protected
void SLNet::CloudServer::RemoveSubscribedKeyFromServers ( CloudKey & cloudKey )
protected
void SLNet::CloudServer::RemoveUploadedKeyFromServers ( CloudKey & cloudKey )
protected
void SLNet::CloudServer::SendSubscribedKeyToServers ( CloudKey & cloudKey )
protected
void SLNet::CloudServer::SendUploadedAndSubscribedKeysToServer ( RakNetGUID systemAddress )
protected
void SLNet::CloudServer::SendUploadedKeyToServers ( CloudKey & cloudKey )
protected
void SLNet::CloudServer::SetMaxBytesPerDownload ( uint64_t bytes )

Max bytes returned by a download. If the number of bytes would exceed this amount, the returned list is truncated However, if this would result in no rows downloaded, then one row will be returned.

Parameters
[in] bytes Max bytes a client can download from a single Get(). 0 means unlimited.
void SLNet::CloudServer::SetMaxUploadBytesPerClient ( uint64_t bytes )

Max bytes a client can upload Data in excess of this value is silently ignored defaults to 0 (unlimited)

Parameters
[in] bytes Max bytes a client can upload. 0 means unlimited.
void SLNet::CloudServer::UnsubscribeFromKey | ( | RemoteCloudClient * | remoteCloudClient,
 |  | RakNetGUID | remoteCloudClientGuid,
 |  | unsigned int | keySubscriberIndex,
 |  | CloudKey & | cloudKey,
 |  | DataStructures::List< RakNetGUID > & | specificSystems
 | ) |  |
protected
virtual void SLNet::CloudServer::Update ( void )
protectedvirtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

void SLNet::CloudServer::WriteCloudQueryRowFromResultList | ( | unsigned int | i,
 |  | DataStructures::List< CloudData * > & | cloudDataResultList,
 |  | DataStructures::List< CloudKey > & | cloudKeyResultList,
 |  | BitStream * | bsOut
 | ) |  |
protected
void SLNet::CloudServer::WriteCloudQueryRowFromResultList | ( | DataStructures::List< CloudData * > & | cloudDataResultList,
 |  | DataStructures::List< CloudKey > & | cloudKeyResultList,
 |  | BitStream * | bsOut
 | ) |  |
protected

Member Data Documentation

DataStructures::OrderedList<CloudKey, CloudDataList*, CloudServer::KeyDataListComp> SLNet::CloudServer::dataRepository
protected

Definition at line 214 of file CloudServer.h.

SystemAddress SLNet::CloudServer::forceAddress
protected

Definition at line 336 of file CloudServer.h.

DataStructures::OrderedList<uint32_t, GetRequest*, CloudServer::GetRequestComp> SLNet::CloudServer::getRequests
protected

Definition at line 298 of file CloudServer.h.

uint64_t SLNet::CloudServer::maxBytesPerDowload
protected

Definition at line 147 of file CloudServer.h.

uint64_t SLNet::CloudServer::maxUploadBytesPerClient
protected

Definition at line 147 of file CloudServer.h.

uint32_t SLNet::CloudServer::nextGetRequestId
protected

Definition at line 301 of file CloudServer.h.

SLNet::Time SLNet::CloudServer::nextGetRequestsCheck
protected

Definition at line 299 of file CloudServer.h.

DataStructures::List<CloudServerQueryFilter*> SLNet::CloudServer::queryFilters
protected

Definition at line 334 of file CloudServer.h.

DataStructures::OrderedList<RakNetGUID, RemoteServer*, CloudServer::RemoteServerComp> SLNet::CloudServer::remoteServers
protected

Definition at line 260 of file CloudServer.h.

DataStructures::Hash<RakNetGUID, RemoteCloudClient*, 2048, RakNetGUID::ToUint32> SLNet::CloudServer::remoteSystems
protected

Definition at line 232 of file CloudServer.h.

struct SLNet::CloudServer::BufferedGetResponseFromServer

Definition at line 262 of file CloudServer.h.

Public Member Functions

void | Clear (CloudAllocator *allocator)

Public Attributes

RakNetGUID serverAddress
CloudQueryResult queryResult
bool | gotResult

Member Function Documentation

void SLNet::CloudServer::BufferedGetResponseFromServer::Clear ( CloudAllocator * allocator )

Member Data Documentation

bool SLNet::CloudServer::BufferedGetResponseFromServer::gotResult

Definition at line 268 of file CloudServer.h.

CloudQueryResult SLNet::CloudServer::BufferedGetResponseFromServer::queryResult

Definition at line 267 of file CloudServer.h.

RakNetGUID SLNet::CloudServer::BufferedGetResponseFromServer::serverAddress

Definition at line 266 of file CloudServer.h.

struct SLNet::CloudServer::CloudData

Definition at line 152 of file CloudServer.h.

Public Member Functions

CloudData ()
~CloudData ()
bool | IsUnused (void) const
void | Clear (void)

Public Attributes

unsigned char | stackData [CLOUD_SERVER_DATA_STACK_SIZE]
unsigned char * | allocatedData
unsigned char * | dataPtr
uint32_t dataLengthBytes
bool | isUploaded
SystemAddress serverSystemAddress
System address of server that is holding this data, and the client is connected to.
SystemAddress clientSystemAddress
System address of client that uploaded this data.
RakNetGUID serverGUID
RakNetGUID of server that is holding this data, and the client is connected to.
RakNetGUID clientGUID
RakNetGUID of client that uploaded this data.
DataStructures::OrderedList
< RakNetGUID, RakNetGUID > 		specificSubscribers

Constructor & Destructor Documentation

SLNet::CloudServer::CloudData::CloudData ( )
inline

Definition at line 154 of file CloudServer.h.

SLNet::CloudServer::CloudData::~CloudData ( )
inline

Definition at line 155 of file CloudServer.h.

References _FILE_AND_LINE_, and rakFree_Ex.

Member Function Documentation

void SLNet::CloudServer::CloudData::Clear ( void )
inline

Definition at line 157 of file CloudServer.h.

References _FILE_AND_LINE_, and rakFree_Ex.

bool SLNet::CloudServer::CloudData::IsUnused ( void ) const
inline

Definition at line 156 of file CloudServer.h.

Member Data Documentation

unsigned char* SLNet::CloudServer::CloudData::allocatedData

Definition at line 160 of file CloudServer.h.

RakNetGUID SLNet::CloudServer::CloudData::clientGUID

RakNetGUID of client that uploaded this data.

Definition at line 175 of file CloudServer.h.

SystemAddress SLNet::CloudServer::CloudData::clientSystemAddress

System address of client that uploaded this data.

Definition at line 169 of file CloudServer.h.

uint32_t SLNet::CloudServer::CloudData::dataLengthBytes

Definition at line 162 of file CloudServer.h.

unsigned char* SLNet::CloudServer::CloudData::dataPtr

Definition at line 161 of file CloudServer.h.

bool SLNet::CloudServer::CloudData::isUploaded

Definition at line 163 of file CloudServer.h.

RakNetGUID SLNet::CloudServer::CloudData::serverGUID

RakNetGUID of server that is holding this data, and the client is connected to.

Definition at line 172 of file CloudServer.h.

SystemAddress SLNet::CloudServer::CloudData::serverSystemAddress

System address of server that is holding this data, and the client is connected to.

Definition at line 166 of file CloudServer.h.

DataStructures::OrderedList<RakNetGUID, RakNetGUID> SLNet::CloudServer::CloudData::specificSubscribers

When the key data changes from this particular system, notify these subscribers This list mutually exclusive with CloudDataList::nonSpecificSubscribers

Definition at line 179 of file CloudServer.h.

unsigned char SLNet::CloudServer::CloudData::stackData[CLOUD_SERVER_DATA_STACK_SIZE]

Definition at line 159 of file CloudServer.h.

struct SLNet::CloudServer::CloudDataList

Definition at line 185 of file CloudServer.h.

Public Member Functions

bool | IsUnused (void) const
bool | IsNotUploaded (void) const
bool | RemoveSubscriber (RakNetGUID g)

Public Attributes

unsigned int | uploaderCount
unsigned int | subscriberCount
CloudKey key
DataStructures::OrderedList
< RakNetGUID, CloudData
*, CloudServer::KeyDataPtrComp > 		keyData
DataStructures::OrderedList
< RakNetGUID, RakNetGUID > 		nonSpecificSubscribers

Member Function Documentation

bool SLNet::CloudServer::CloudDataList::IsNotUploaded ( void ) const
inline

Definition at line 188 of file CloudServer.h.

bool SLNet::CloudServer::CloudDataList::IsUnused ( void ) const
inline

Definition at line 187 of file CloudServer.h.

bool SLNet::CloudServer::CloudDataList::RemoveSubscriber ( RakNetGUID g )
inline

Definition at line 189 of file CloudServer.h.

Member Data Documentation

CloudKey SLNet::CloudServer::CloudDataList::key

Definition at line 203 of file CloudServer.h.

DataStructures::OrderedList<RakNetGUID, CloudData*, CloudServer::KeyDataPtrComp> SLNet::CloudServer::CloudDataList::keyData

Definition at line 206 of file CloudServer.h.

DataStructures::OrderedList<RakNetGUID, RakNetGUID> SLNet::CloudServer::CloudDataList::nonSpecificSubscribers

When the key data changes from any system, notify these subscribers This list mutually exclusive with CloudData::specificSubscribers

Definition at line 210 of file CloudServer.h.

unsigned int SLNet::CloudServer::CloudDataList::subscriberCount

Definition at line 202 of file CloudServer.h.

unsigned int SLNet::CloudServer::CloudDataList::uploaderCount

Definition at line 202 of file CloudServer.h.

struct SLNet::CloudServer::CloudQueryWithAddresses

Definition at line 271 of file CloudServer.h.

Public Member Functions

void Serialize (bool writeToBitstream, BitStream *bitStream)

Public Attributes

CloudQuery cloudQuery
DataStructures::List< RakNetGUID > specificSystems

Member Function Documentation

void SLNet::CloudServer::CloudQueryWithAddresses::Serialize | ( | bool | writeToBitstream,
 |  | BitStream * | bitStream
 | ) |  |

Member Data Documentation

CloudQuery SLNet::CloudServer::CloudQueryWithAddresses::cloudQuery

Definition at line 274 of file CloudServer.h.

DataStructures::List<RakNetGUID> SLNet::CloudServer::CloudQueryWithAddresses::specificSystems

Definition at line 275 of file CloudServer.h.

struct SLNet::CloudServer::GetRequest

Definition at line 281 of file CloudServer.h.

Public Member Functions

void | Clear (CloudAllocator *allocator)
bool | AllRemoteServersHaveResponded (void) const

Public Attributes

CloudQueryWithAddresses cloudQueryWithAddresses
SLNet::Time requestStartTime
uint32_t requestId
RakNetGUID requestingClient
DataStructures::OrderedList
< RakNetGUID,
BufferedGetResponseFromServer
*, CloudServer::BufferedGetResponseFromServerComp > 		remoteServerResponses

Member Function Documentation

bool SLNet::CloudServer::GetRequest::AllRemoteServersHaveResponded ( void ) const
void SLNet::CloudServer::GetRequest::Clear ( CloudAllocator * allocator )

Member Data Documentation

CloudQueryWithAddresses SLNet::CloudServer::GetRequest::cloudQueryWithAddresses

Definition at line 285 of file CloudServer.h.

DataStructures::OrderedList<RakNetGUID, BufferedGetResponseFromServer*, CloudServer::BufferedGetResponseFromServerComp> SLNet::CloudServer::GetRequest::remoteServerResponses

Definition at line 295 of file CloudServer.h.

uint32_t SLNet::CloudServer::GetRequest::requestId

Definition at line 291 of file CloudServer.h.

RakNetGUID SLNet::CloudServer::GetRequest::requestingClient

Definition at line 293 of file CloudServer.h.

SLNet::Time SLNet::CloudServer::GetRequest::requestStartTime

Definition at line 288 of file CloudServer.h.

struct SLNet::CloudServer::KeySubscriberID

Definition at line 216 of file CloudServer.h.

Class Members
CloudKey | key
OrderedList< RakNetGUID, RakNetGUID > | specificSystemsSubscribedTo
struct SLNet::CloudServer::RemoteCloudClient

Definition at line 224 of file CloudServer.h.

Public Member Functions

bool IsUnused (void) const

Public Attributes

DataStructures::OrderedList
< CloudKey, CloudKey,
CloudKeyComp > 		uploadedKeys
DataStructures::OrderedList
< CloudKey, KeySubscriberID
*, CloudServer::KeySubscriberIDComp > 		subscribedKeys
uint64_t uploadedBytes

Member Function Documentation

bool SLNet::CloudServer::RemoteCloudClient::IsUnused ( void ) const
inline

Definition at line 226 of file CloudServer.h.

Member Data Documentation

DataStructures::OrderedList<CloudKey,KeySubscriberID*,CloudServer::KeySubscriberIDComp> SLNet::CloudServer::RemoteCloudClient::subscribedKeys

Definition at line 229 of file CloudServer.h.

uint64_t SLNet::CloudServer::RemoteCloudClient::uploadedBytes

Definition at line 230 of file CloudServer.h.

DataStructures::OrderedList<CloudKey,CloudKey,CloudKeyComp> SLNet::CloudServer::RemoteCloudClient::uploadedKeys

Definition at line 228 of file CloudServer.h.

struct SLNet::CloudServer::RemoteServer

Definition at line 244 of file CloudServer.h.

Class Members
bool | gotSubscribedAndUploadedKeys
RakNetGUID | serverAddress
OrderedList< CloudKey, CloudKey, CloudKeyComp > | subscribedKeys
OrderedList< CloudKey, CloudKey, CloudKeyComp > | uploadedKeys
bool | workingFlag
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: DirectoryDeltaTransfer

Namespaces
DirectoryDeltaTransfer
Plugins

Simple class to send changes between directories. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Simple class to send changes between directories.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Typedefs | Enumerations | Functions | Variables
SLNet Namespace Reference
DirectoryDeltaTransfer

Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc. More...

Classes

class | AutopatcherRepositoryInterface
An interface used by AutopatcherServer to get the data necessary to run an autopatcher. This is up to you to implement for custom repository solutions. More...
class | BitStream
class | CCRakNetSlidingWindow
class | CloudClient
Performs Post() and Get() operations on CloudMemoryServer. More...
class | CloudClientCallback
class | CloudAllocator
struct | CloudKey
struct | CloudQuery
struct | CloudQueryRow
struct | CloudQueryResult
class | CloudServerQueryFilter
Zero or more instances of CloudServerQueryFilter can be attached to CloudServer to restrict client queries All attached instances of CloudServerQueryFilter on each corresponding operation, from all directly connected clients If any attached instance returns false for a given operation, that operation is silently rejected. More...
class | CloudServer
Stores client data, and allows cross-server communication to retrieve this data. More...
class | RakNetCommandParser
This allows a console client to call most of the functions in RakPeer. More...
struct | RegisteredCommand
class | CommandParserInterface
The interface used by command parsers. More...
class | ConnectionGraph2
A one hop connection graph. More...
class | ConsoleServer
The main entry point for the server portion of your remote console application support. More...
class | DataCompressor
Does compression on a block of data. Not very good compression, but it's small and fast so is something you can compute at runtime. More...
class | DirectoryDeltaTransfer
class | HuffmanEncodingTree
This generates special cases of the huffman encoding tree using 8 bit keys with the additional condition that unused combinations of 8 bits are treated as a frequency of 1. More...
class | HuffmanEncodingTreeFactory
Creates instances of the class HuffmanEncodingTree. More...
class | DynDNS
class | EmailSender
Rudimentary class to send email from code. More...
struct | FileListNode
Represents once instance of a file. More...
class | FileListProgress
Callback interface set with FileList::SetCallback() in case you want progress notifications when FileList::AddFilesFromDirectory() is called. More...
class | FLP_Printf
Implementation of FileListProgress to use RAKNET_DEBUG_PRINTF. More...
class | FileList
class | FileListTransfer
A plugin to provide a simple way to compress and incrementally send the files in the FileList structure. More...
class | FileListTransferCBInterface
Used by FileListTransfer plugin as a callback for when we get a file. More...
class | HTTPConnection
Use HTTPConnection to communicate with a web server. More...
class | HTTPConnection2
Use HTTPConnection2 to communicate with a web server. More...
class | IncrementalReadInterface
struct | InternalPacketFixedSizeTransmissionHeader
struct | InternalPacketRefCountedData
Used in InternalPacket when pointing to sharedDataBlock, rather than allocating itself. More...
struct | InternalPacket
class | LocklessUint32_t
class | LogCommandParser
Adds the ability to send logging output to a remote console. More...
struct | FilterSet
struct | FilteredSystem
class | MessageFilter
Assigns systems to FilterSets. Each FilterSet limits what kinds of messages are allowed. More...
struct | PunchthroughConfiguration
struct | NatPunchthroughDebugInterface
struct | NatPunchthroughDebugInterface_Printf
struct | NatPunchthroughDebugInterface_PacketLogger
class | NatPunchthroughClient
Client code for NATPunchthrough. More...
struct | NatPunchthroughServerDebugInterface
struct | NatPunchthroughServerDebugInterface_Printf
struct | NatPunchthroughServerDebugInterface_PacketLogger
class | NatPunchthroughServer
Server code for NATPunchthrough. More...
class | NatTypeDetectionClient
Client code for NatTypeDetection. More...
class | NatTypeDetectionServer
Server code for NatTypeDetection. More...
class | NetworkIDManager
class | NetworkIDObject
Unique shared ids for each object instance. More...
class | PacketConsoleLogger
Packetlogger that logs to a remote command console. More...
class | PacketFileLogger
Packetlogger that outputs to a file. More...
class | PacketizedTCP
class | PacketLogger
Writes incoming and outgoing messages to the screen. This will write all incoming and outgoing messages to the console window, or to a file if you override it and give it this functionality. More...
class | PacketOutputWindowLogger
Packetlogger that outputs to the output window in the debugger. Windows only. More...
struct | RemoteSystemIndex
class | RakPeer
Main interface for network communications. More...
class | RakPeerInterface
The main interface for network communications. More...
class | PluginInterface2
class | Rackspace2EventCallback
Callback interface to receive the results of operations. More...
class | RackspaceEventCallback_Default
Callback interface to receive the results of operations, with a default result. More...
class | Rackspace
Code that uses the TCPInterface class to communicate with the Rackspace API servers. More...
class | RakNetRandom
class | RakNetRandomSync
class | ReadyEvent
Peer to peer synchronized ready and unready events. More...
class | RelayPlugin
A simple class to relay messages from one system to another, identifying remote systems by a string. More...
struct | SplitPacketChannel
struct | BPSTracker
class | ReliabilityLayer
Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence. More...
struct | PRO
class | ReplicaManager3
System to help automate game object construction, destruction, and serialization. More...
struct | LastSerializationResultBS
struct | LastSerializationResult
struct | SerializeParameters
struct | DeserializeParameters
class | Connection_RM3
Each remote system is represented by Connection_RM3. Used to allocate Replica3 and track which instances have been allocated. More...
class | Replica3
Base class for your replicated objects for the ReplicaManager3 system. More...
class | Replica3Composite
Use Replica3 through composition instead of inheritance by containing an instance of this templated class Calls to parent class for all functions Parent class must still define and functions though! More...
struct | Router2DebugInterface
class | Router2
Class interface for the Router2 system. More...
class | RPC4GlobalRegistration
Instantiate this class globally if you want to register a function with RPC4 at the global space. More...
class | RPC4
The RPC4 plugin is just an association between a C function pointer and a string. More...
class | SignaledEvent
class | SimpleMutex
An easy to use mutex. More...
class | ReferenceCounter
class | RakNetSmartPtr
struct | RNS2_SendParameters
struct | RNS2RecvStruct
class | RakNetSocket2Allocator
class | RNS2EventHandler
class | RakNetSocket2
struct | RNS2_BerkleyBindParameters
class | IRNS2_Berkley
class | RNS2_Berkley
class | RNS2_Linux
class | SocketLayer
struct | RakNetStatistics
Network Statisics Usage. More...
class | StatisticsHistory
Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values. More...
class | StatisticsHistoryPlugin
Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values. More...
class | RakString
String class. More...
class | StringCompressor
Writes and reads strings to and from bitstreams. More...
class | StringTable
Writes a string index, instead of the whole string. More...
class | TableSerializer
class | TCPInterface
struct | RemoteClient
Stores information about a remote client. More...
class | TeamBalancer
Set and network team selection (supports peer to peer or client/server) More...
struct | TeamSelection
Parameter to TM_World::ReferenceTeamMember() More...
class | TM_TeamMember
A member of one or more teams. More...
class | TM_Team
A team, containing a list of TM_TeamMember instances. More...
class | TM_World
Stores a list of teams which may be enforcing a balanced number of members. More...
class | TeamManager
Automates networking and list management for teams. More...
class | TelnetTransport
Use TelnetTransport to easily allow windows telnet to connect to your ConsoleServer. More...
class | RakThread
class | ThreadsafePacketLogger
Same as PacketLogger, but writes output in the user thread. More...
class | RakNetTransport2
Use RakNetTransport if you need a secure connection between the client and the console server. More...
class | TransportInterface
Defines an interface that is used to send and receive null-terminated strings. More...
class | TwoWayAuthentication
Implements two way authentication. More...
struct | PublicKey
Passed to RakPeerInterface::Connect() More...
struct | SocketDescriptor
Describes the local socket to use for RakPeer::Startup. More...
struct | SystemAddress
Network address for a system. More...
struct | RakNetGUID
struct | AddressOrGUID
struct | Packet
This represents a user message from another system. More...
struct | uint24_t
class | UDPForwarder
Forwards UDP datagrams. Independent of RakNet's protocol. More...
struct | UDPProxyClientResultHandler
class | UDPProxyClient
Communicates with UDPProxyCoordinator, in order to find a UDPProxyServer to forward our datagrams. More...
class | UDPProxyCoordinator
Middleman between UDPProxyServer and UDPProxyClient, maintaining a list of UDPProxyServer, and managing state for clients to find an available forwarding server. More...
struct | UDPProxyServerResultHandler
class | UDPProxyServer
UDPProxyServer to control our instance of UDPForwarder. More...
class | VariableDeltaSerializer
Class to compare memory values of variables in a current state to a prior state Results of the comparisons will be written to a bitStream, such that only changed variables get written
Can be used with ReplicaManager3 to Serialize a Replica3 per-variable, rather than comparing the entire object against itself
Usage:
BR> More...
class | VariableListDeltaTracker
class | RakWString
String class for Unicode. More...
union | TeamSelection.teamParameter

Typedefs

typedef uint16_t | SplitPacketIdType
typedef uint32_t | SplitPacketIndexType
typedef uint24_t | MessageNumberType
typedef MessageNumberType | OrderingIndexType
typedef SLNet::TimeUS | RemoteSystemTimeType
typedef uint32_t | NetworkIDType
typedef uint64_t | reliabilityHeapWeightType
typedef uint8_t | WorldId
typedef int | RNS2Socket
typedef int | RNS2SendResult
typedef double | SHValueType
typedef unsigned char | TeamId
typedef unsigned char | NoTeamId
A subcategory of not being on a team. For example, 0 may mean no team for a player, while 1 may mean no team for a spectator. Defined by the user.
typedef uint16_t | TeamMemberLimit
typedef uint8_t | JoinPermissions
typedef uint64_t | Time
typedef uint32_t | TimeMS
typedef uint64_t | TimeUS
typedef unsigned char | UniqueIDType
typedef unsigned short | SystemIndex
typedef unsigned char | RPCIndex
typedef unsigned char | MessageID
First byte of a network message.
typedef uint32_t | BitSize_t
typedef uint64_t | NetworkID

Enumerations

enum DynDnsResultCode {
RC_SUCCESS, RC_DNS_ALREADY_SET, RC_NO_CHANGE, RC_NOT_DONATOR,
RC_NO_HOST, RC_BAD_AUTH, RC_NOT_YOURS, RC_ABUSE,
RC_TCP_FAILED_TO_START, RC_TCP_DID_NOT_CONNECT, RC_UNKNOWN_RESULT, RC_PARSING_FAILURE,
RC_CONNECTION_LOST_WITHOUT_RESPONSE, RC_BAD_AGENT, RC_BAD_SYS, RC_DNS_ERROR,
RC_NOT_FQDN, RC_NUM_HOST, RC_911, RC_DYNDNS_TIMEOUT
}
enum NATTypeDetectionResult {
NAT_TYPE_NONE, NAT_TYPE_FULL_CONE, NAT_TYPE_ADDRESS_RESTRICTED, NAT_TYPE_PORT_RESTRICTED,
NAT_TYPE_SYMMETRIC, NAT_TYPE_UNKNOWN, NAT_TYPE_DETECTION_IN_PROGRESS, NAT_TYPE_SUPPORTS_UPNP,
NAT_TYPE_COUNT
}
All possible types of NATs (except NAT_TYPE_COUNT, which is an internal value) More...
enum | PluginReceiveResult { RR_STOP_PROCESSING_AND_DEALLOCATE =0, RR_CONTINUE_PROCESSING, RR_STOP_PROCESSING }
enum | PI2_LostConnectionReason { LCR_CLOSED_BY_USER, LCR_DISCONNECTION_NOTIFICATION, LCR_CONNECTION_LOST }
enum PI2_FailedConnectionAttemptReason {
FCAR_CONNECTION_ATTEMPT_FAILED, FCAR_ALREADY_CONNECTED, FCAR_NO_FREE_INCOMING_CONNECTIONS, FCAR_SECURITY_PUBLIC_KEY_MISMATCH,
FCAR_CONNECTION_BANNED, FCAR_INVALID_PASSWORD, FCAR_INCOMPATIBLE_PROTOCOL, FCAR_IP_RECENTLY_CONNECTED,
FCAR_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY, FCAR_OUR_SYSTEM_REQUIRES_SECURITY, FCAR_PUBLIC_KEY_MISMATCH
}
enum RackspaceEventType {
RET_Success_200, RET_Success_201, RET_Success_202, RET_Success_203,
RET_Success_204, RET_Cloud_Servers_Fault_500, RET_Service_Unavailable_503, RET_Unauthorized_401,
RET_Bad_Request_400, RET_Over_Limit_413, RET_Bad_Media_Type_415, RET_Item_Not_Found_404,
RET_Build_In_Progress_409, RET_Resize_Not_Allowed_403, RET_Connection_Closed_Without_Reponse, RET_Unknown_Failure
}
Result codes for Rackspace commands /sa Rackspace::EventTypeToString() More...
enum RackspaceOperationType {
RO_CONNECT_AND_AUTHENTICATE, RO_LIST_SERVERS, RO_LIST_SERVERS_WITH_DETAILS, RO_CREATE_SERVER,
RO_GET_SERVER_DETAILS, RO_UPDATE_SERVER_NAME_OR_PASSWORD, RO_DELETE_SERVER, RO_LIST_SERVER_ADDRESSES,
RO_SHARE_SERVER_ADDRESS, RO_DELETE_SERVER_ADDRESS, RO_REBOOT_SERVER, RO_REBUILD_SERVER,
RO_RESIZE_SERVER, RO_CONFIRM_RESIZED_SERVER, RO_REVERT_RESIZED_SERVER, RO_LIST_FLAVORS,
RO_GET_FLAVOR_DETAILS, RO_LIST_IMAGES, RO_CREATE_IMAGE, RO_GET_IMAGE_DETAILS,
RO_DELETE_IMAGE, RO_LIST_SHARED_IP_GROUPS, RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS, RO_CREATE_SHARED_IP_GROUP,
RO_GET_SHARED_IP_GROUP_DETAILS, RO_DELETE_SHARED_IP_GROUP, RO_NONE
}
enum ReadyEventSystemStatus {
RES_NOT_WAITING, RES_WAITING, RES_READY, RES_ALL_READY,
RES_UNKNOWN_EVENT
}
enum RelayPluginEnums {
RPE_MESSAGE_TO_SERVER_FROM_CLIENT, RPE_ADD_CLIENT_REQUEST_FROM_CLIENT, RPE_REMOVE_CLIENT_REQUEST_FROM_CLIENT, RPE_GROUP_MESSAGE_FROM_CLIENT,
RPE_JOIN_GROUP_REQUEST_FROM_CLIENT, RPE_LEAVE_GROUP_REQUEST_FROM_CLIENT, RPE_GET_GROUP_LIST_REQUEST_FROM_CLIENT, RPE_MESSAGE_TO_CLIENT_FROM_SERVER,
RPE_ADD_CLIENT_NOT_ALLOWED, RPE_ADD_CLIENT_TARGET_NOT_CONNECTED, RPE_ADD_CLIENT_NAME_ALREADY_IN_USE, RPE_ADD_CLIENT_SUCCESS,
RPE_USER_ENTERED_ROOM, RPE_USER_LEFT_ROOM, RPE_GROUP_MSG_FROM_SERVER, RPE_GET_GROUP_LIST_REPLY_FROM_SERVER,
RPE_JOIN_GROUP_SUCCESS, RPE_JOIN_GROUP_FAILURE
}
enum | SendSerializeIfChangedResult { SSICR_SENT_DATA, SSICR_DID_NOT_SEND_DATA, SSICR_NEVER_SERIALIZE }
enum RM3ConstructionState {
RM3CS_SEND_CONSTRUCTION, RM3CS_ALREADY_EXISTS_REMOTELY, RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT, RM3CS_NEVER_CONSTRUCT,
RM3CS_NO_ACTION, RM3CS_MAX
}
Return codes for Connection_RM3::GetConstructionState() and Replica3::QueryConstruction() More...
enum | RM3DestructionState { RM3DS_SEND_DESTRUCTION, RM3DS_DO_NOT_QUERY_DESTRUCTION, RM3DS_NO_ACTION, RM3DS_MAX }
enum RM3SerializationResult {
RM3SR_BROADCAST_IDENTICALLY, RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION, RM3SR_SERIALIZED_UNIQUELY, RM3SR_SERIALIZED_ALWAYS,
RM3SR_SERIALIZED_ALWAYS_IDENTICALLY, RM3SR_DO_NOT_SERIALIZE, RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION, RM3SR_MAX
}
enum | RM3QuerySerializationResult { RM3QSR_CALL_SERIALIZE, RM3QSR_DO_NOT_CALL_SERIALIZE, RM3QSR_NEVER_CALL_SERIALIZE, RM3QSR_MAX }
enum | RM3ActionOnPopConnection { RM3AOPC_DO_NOTHING, RM3AOPC_DELETE_REPLICA, RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION, RM3AOPC_MAX }
enum Replica3P2PMode {
R3P2PM_SINGLE_OWNER, R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE, R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE, R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE,
R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE
}
enum | RPCErrorCodes { RPC_ERROR_FUNCTION_NOT_REGISTERED }
Error codes returned by a remote system as to why an RPC function call cannot execute. More...
enum | RNS2BindResult { BR_SUCCESS, BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE, BR_FAILED_TO_BIND_SOCKET, BR_FAILED_SEND_TEST }
enum RNS2Type {
RNS2T_WINDOWS_STORE_8, RNS2T_PS3, RNS2T_PS4, RNS2T_CHROME,
RNS2T_VITA, RNS2T_XBOX_360, RNS2T_XBOX_720, RNS2T_WINDOWS,
RNS2T_LINUX
}
enum RNSPerSecondMetrics {
USER_MESSAGE_BYTES_PUSHED, USER_MESSAGE_BYTES_SENT, USER_MESSAGE_BYTES_RESENT, USER_MESSAGE_BYTES_RECEIVED_PROCESSED,
USER_MESSAGE_BYTES_RECEIVED_IGNORED, ACTUAL_BYTES_SENT, ACTUAL_BYTES_RECEIVED, RNS_PER_SECOND_METRICS_COUNT
}
enum | JoinTeamType { JOIN_ANY_AVAILABLE_TEAM, JOIN_SPECIFIC_TEAM, JOIN_NO_TEAM }
enum | TMTopology { TM_PEER_TO_PEER, TM_CLIENT_SERVER }
enum StartupResult {
RAKNET_STARTED, RAKNET_ALREADY_STARTED, INVALID_SOCKET_DESCRIPTORS, INVALID_MAX_CONNECTIONS,
SOCKET_FAMILY_NOT_SUPPORTED, SOCKET_PORT_ALREADY_IN_USE, SOCKET_FAILED_TO_BIND, SOCKET_FAILED_TEST_SEND,
PORT_CANNOT_BE_ZERO, FAILED_TO_CREATE_NETWORK_THREAD, COULD_NOT_GENERATE_GUID, STARTUP_OTHER_FAILURE
}
enum ConnectionAttemptResult {
CONNECTION_ATTEMPT_STARTED, INVALID_PARAMETER, CANNOT_RESOLVE_DOMAIN_NAME, ALREADY_CONNECTED_TO_ENDPOINT,
CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS, SECURITY_INITIALIZATION_FAILED
}
enum ConnectionState {
IS_PENDING, IS_CONNECTING, IS_CONNECTED, IS_DISCONNECTING,
IS_SILENTLY_DISCONNECTING, IS_DISCONNECTED, IS_NOT_CONNECTED
}
Returned from RakPeerInterface::GetConnectionState() More...
enum | PublicKeyMode { PKM_INSECURE_CONNECTION, PKM_ACCEPT_ANY_PUBLIC_KEY, PKM_USE_KNOWN_PUBLIC_KEY, PKM_USE_TWO_WAY_AUTHENTICATION }
Used with the PublicKey structure. More...
enum UDPForwarderResult {
UDPFORWARDER_FORWARDING_ALREADY_EXISTS, UDPFORWARDER_NO_SOCKETS, UDPFORWARDER_BIND_FAILED, UDPFORWARDER_INVALID_PARAMETERS,
UDPFORWARDER_NOT_RUNNING, UDPFORWARDER_SUCCESS, UDPFORWARDER_RESULT_COUNT
}

Functions

RAK_THREAD_DECLARATION (UpdateNetworkLoop)
RAK_THREAD_DECLARATION (RecvFromLoop)
RAK_THREAD_DECLARATION (UDTConnect)
bool | ProcessOfflineNetworkPacket (SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2 *rakNetSocket, bool *isOfflineMessage, SLNet::TimeUS timeRead)
void | ProcessNetworkPacket (SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, SLNet::TimeUS timeRead, BitStream &updateBitStream)
void | ProcessNetworkPacket (SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2 *rakNetSocket, SLNet::TimeUS timeRead, BitStream &updateBitStream)
void | ProcessNetworkPacket (const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, SLNet::TimeUS timeRead)
template<class templateType >
BitStream & | operator<< (BitStream &out, const templateType &c)
template<class templateType >
BitStream & | operator>> (BitStream &in, templateType &c)
int | CloudKeyComp (const CloudKey &key, const CloudKey &data)
int RAK_DLL_EXPORT | RegisteredCommandComp (const char *const &key, const RegisteredCommand &data)
List of commands registered with RegisterCommand()
SLNet::Time RAK_DLL_EXPORT | GetTime (void)
SLNet::TimeMS RAK_DLL_EXPORT | GetTimeMS (void)
SLNet::TimeUS RAK_DLL_EXPORT | GetTimeUS (void)
RAK_DLL_EXPORT bool | GreaterThan (SLNet::Time a, SLNet::Time b)
a > b?
RAK_DLL_EXPORT bool | LessThan (SLNet::Time a, SLNet::Time b)
a < b?
template<class Type >
RAK_DLL_EXPORT Type * | OP_NEW (const char *file, unsigned int line)
template<class Type , class P1 >
RAK_DLL_EXPORT Type * | OP_NEW_1 (const char *file, unsigned int line, const P1 &p1)
template<class Type , class P1 , class P2 >
RAK_DLL_EXPORT Type * | OP_NEW_2 (const char *file, unsigned int line, const P1 &p1, const P2 &p2)
template<class Type , class P1 , class P2 , class P3 >
RAK_DLL_EXPORT Type * | OP_NEW_3 (const char *file, unsigned int line, const P1 &p1, const P2 &p2, const P3 &p3)
template<class Type , class P1 , class P2 , class P3 , class P4 >
RAK_DLL_EXPORT Type * | OP_NEW_4 (const char *file, unsigned int line, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
template<class Type >
RAK_DLL_EXPORT Type * | OP_NEW_ARRAY (const int count, const char *file, unsigned int line)
template<class Type >
RAK_DLL_EXPORT void | OP_DELETE (Type *buff, const char *file, unsigned int line)
template<class Type >
RAK_DLL_EXPORT void | OP_DELETE_ARRAY (Type *buff, const char *file, unsigned int line)
void RAK_DLL_EXPORT * | _RakMalloc (size_t size)
void RAK_DLL_EXPORT * | _RakRealloc (void *p, size_t size)
void RAK_DLL_EXPORT | _RakFree (void *p)
void RAK_DLL_EXPORT * | _RakMalloc_Ex (size_t size, const char *file, unsigned int line)
void RAK_DLL_EXPORT * | _RakRealloc_Ex (void *p, size_t size, const char *file, unsigned int line)
void RAK_DLL_EXPORT | _RakFree_Ex (void *p, const char *file, unsigned int line)
void RAK_DLL_EXPORT * | _DLMallocMMap (size_t size)
void RAK_DLL_EXPORT * | _DLMallocDirectMMap (size_t size)
int RAK_DLL_EXPORT | _DLMallocMUnmap (void *p, size_t size)
int RAK_DLL_EXPORT | MessageFilterStrComp (char *const &key, char *const &data)
int RAK_DLL_EXPORT | FilterSetComp (const int &key, FilterSet *const &data)
bool RAK_DLL_EXPORT | CanConnect (NATTypeDetectionResult type1, NATTypeDetectionResult type2)
RAK_DLL_EXPORT const char * | NATTypeDetectionResultToString (NATTypeDetectionResult type)
Return a technical string representin the enumeration.
RAK_DLL_EXPORT const char * | NATTypeDetectionResultToStringFriendly (NATTypeDetectionResult type)
RAK_DLL_EXPORT RakNetSocket2 * | CreateNonblockingBoundSocket (const char *bindAddr, RNS2EventHandler *eventHandler)
int RAK_DLL_EXPORT | SplitPacketChannelComp (SplitPacketIdType const &key, SplitPacketChannel *const &data)
void RAK_DLL_EXPORT | StatisticsToString (RakNetStatistics *s, char *buffer, int verbosityLevel)
void RAK_DLL_EXPORT | StatisticsToString (RakNetStatistics *s, char *buffer, size_t bufferLength, int verbosityLevel)
int RAK_DLL_EXPORT | StrAndBoolComp (char *const &key, const StrAndBool &data)
bool | NonNumericHostString (const char *host)
const RakNetGUID | UNASSIGNED_RAKNET_GUID ((uint64_t)-1)

Variables

static const int | RM3_NUM_OUTPUT_BITSTREAM_CHANNELS =16
const int | MAX_RPC_MAP_SIZE =((RPCIndex)-1)-1
const int | UNDEFINED_RPC_INDEX =((RPCIndex)-1)
const SystemAddress | UNASSIGNED_SYSTEM_ADDRESS
Index of an invalid SystemAddress.
const SystemIndex | UNASSIGNED_PLAYER_INDEX = 65535
Index of an unassigned player.
const NetworkID | UNASSIGNED_NETWORK_ID = (uint64_t) -1
Unassigned object ID.
const int | PING_TIMES_ARRAY_SIZE = 5

Detailed Description

Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Forward declaration.

See Also
AutopatcherClient class for database driven patching, including binary deltas and search by date.

To use, first set the path to your application. For example "C:/Games/MyRPG/"
To allow other systems to download files, call AddUploadsFromSubdirectory, where the parameter is a path relative
to the path to your application. This includes subdirectories.
For example:
SetApplicationDirectory("C:/Games/MyRPG/");
AddUploadsFromSubdirectory("Mods/Skins/");
would allow downloads from
"C:/Games/MyRPG/Mods/Skins/*.*" as well as "C:/Games/MyRPG/Mods/Skins/Level1/*.*"
It would NOT allow downloads from C:/Games/MyRPG/Levels, nor would it allow downloads from C:/Windows
While pathToApplication can be anything you want, applicationSubdirectory must match either partially or fully between systems.

Class Documentation

struct SLNet::RegisteredCommand

Definition at line 37 of file CommandParserInterface.h.

Class Members
const char * | command
const char * | commandHelp
unsigned char | parameterCount
struct SLNet::FileListNode

Represents once instance of a file.

Definition at line 46 of file FileList.h.

Class Members
FileListNodeContext | context | User specific data for whatever, describing this file.
char * | data | File data (may be null if not ready)
BitSize_t | dataLengthBytes | Length of data. May be greater than fileLength if prepended with a file hash.
unsigned | fileLengthBytes | Length of the file.
RakString | filename | Name of the file.
RakString | fullPathToFile | Full path to the file, which may be different than filename.
bool | isAReference | If true, data and dataLengthBytes should be empty. This is just storing the filename.
struct SLNet::InternalPacketRefCountedData

Used in InternalPacket when pointing to sharedDataBlock, rather than allocating itself.

Definition at line 76 of file InternalPacket.h.

Class Members
unsigned int | refCount
unsigned char * | sharedDataBlock
struct SLNet::FilteredSystem

Definition at line 65 of file MessageFilter.h.

Class Members
FilterSet * | filter
TimeMS | timeEnteredThisSet
struct SLNet::RemoteSystemIndex

Definition at line 52 of file peer.h.

Class Members
unsigned | index
RemoteSystemIndex * | next
struct SLNet::SplitPacketChannel

Definition at line 69 of file ReliabilityLayer.h.

Class Members
InternalPacket * | firstPacket
CCTimeType | lastUpdateTime
List< InternalPacket * > | splitPacketList
struct SLNet::RNS2RecvStruct

Definition at line 87 of file socket2.h.

Class Members
int | bytesRead
char | data
RakNetSocket2 * | socket
SystemAddress | systemAddress
TimeUS | timeRead
struct SLNet::RNS2_BerkleyBindParameters

Definition at line 265 of file socket2.h.

Class Members
unsigned short | addressFamily
int | doNotFragment
RNS2EventHandler * | eventHandler
char * | hostAddress
bool | nonBlockingSocket
int | pollingThreadPriority
unsigned short | port
int | protocol
unsigned short | remotePortRakNetWasStartedOn_PS3_PS4_PSP2
int | setBroadcast
int | setIPHdrIncl
int | type
struct SLNet::PublicKey

Passed to RakPeerInterface::Connect()

Definition at line 133 of file types.h.

Class Members
char * | myPrivateKey | (Optional) Pointer to a private key of length cat::EasyHandshake::PRIVATE_KEY_BYTES
char * | myPublicKey | (Optional) Pointer to a public key of length cat::EasyHandshake::PUBLIC_KEY_BYTES
PublicKeyMode | publicKeyMode | How to interpret the public key, see above.
char * | remoteServerPublicKey | Pointer to a public key of length cat::EasyHandshake::PUBLIC_KEY_BYTES. See the Encryption sample.
struct SLNet::Packet

This represents a user message from another system.

Definition at line 434 of file types.h.

Class Members
BitSize_t | bitSize | The length of the data in bits.
unsigned char * | data | The data from the sender.
bool | deleteData |
RakNetGUID | guid | A unique identifier for the system that sent this packet, regardless of IP address (internal / external / remote system) Only valid once a connection has been established (ID_CONNECTION_REQUEST_ACCEPTED, or ID_NEW_INCOMING_CONNECTION) Until that time, will be UNASSIGNED_RAKNET_GUID
unsigned int | length | The length of the data in bytes.
SystemAddress | systemAddress | The system that send this packet.
bool | wasGeneratedLocally |

Typedef Documentation

typedef uint32_t SLNet::BitSize_t

Definition at line 106 of file types.h.

typedef uint8_t SLNet::JoinPermissions

Definition at line 71 of file TeamManager.h.

typedef unsigned char SLNet::MessageID

First byte of a network message.

Definition at line 104 of file types.h.

typedef uint24_t SLNet::MessageNumberType

This is the counter used for holding packet numbers, so we can detect duplicate packets. It should be large enough that if the variables Internally assumed to be 4 bytes, but written as 3 bytes in ReliabilityLayer::WriteToBitStreamFromInternalPacket

Definition at line 42 of file InternalPacket.h.

typedef uint64_t SLNet::NetworkID

Definition at line 431 of file types.h.

typedef uint32_t SLNet::NetworkIDType

Definition at line 31 of file NetworkIDObject.h.

typedef MessageNumberType SLNet::OrderingIndexType

This is the counter used for holding ordered packet numbers, so we can detect out-of-order packets. It should be large enough that if the variables were to wrap, the newly wrapped values would no longer be in use. Warning: Too large of a value wastes bandwidth!

Definition at line 46 of file InternalPacket.h.

typedef uint64_t SLNet::reliabilityHeapWeightType

Definition at line 65 of file ReliabilityLayer.h.

typedef SLNet::TimeUS SLNet::RemoteSystemTimeType

Definition at line 48 of file InternalPacket.h.

typedef int SLNet::RNS2SendResult

Definition at line 63 of file socket2.h.

typedef int SLNet::RNS2Socket

Definition at line 47 of file socket2.h.

typedef unsigned char SLNet::RPCIndex

Definition at line 99 of file types.h.

typedef double SLNet::SHValueType

Definition at line 40 of file StatisticsHistory.h.

typedef uint16_t SLNet::SplitPacketIdType

Definition at line 37 of file InternalPacket.h.

typedef uint32_t SLNet::SplitPacketIndexType

Definition at line 38 of file InternalPacket.h.

typedef unsigned short SLNet::SystemIndex

Definition at line 98 of file types.h.

typedef uint64_t SLNet::Time

Definition at line 27 of file time.h.

typedef uint32_t SLNet::TimeMS

Definition at line 29 of file time.h.

typedef uint64_t SLNet::TimeUS

Definition at line 30 of file time.h.

typedef unsigned char SLNet::UniqueIDType
See Also
NetworkIDObject.h

Definition at line 97 of file types.h.

Enumeration Type Documentation

enum SLNet::ConnectionAttemptResult
Enumerator:
CONNECTION_ATTEMPT_STARTED
INVALID_PARAMETER
CANNOT_RESOLVE_DOMAIN_NAME
ALREADY_CONNECTED_TO_ENDPOINT
CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS
SECURITY_INITIALIZATION_FAILED

Definition at line 63 of file types.h.

enum SLNet::ConnectionState

Returned from RakPeerInterface::GetConnectionState()

Enumerator:
IS_PENDING

Connect() was called, but the process hasn't started yet.

IS_CONNECTING

Processing the connection attempt.

IS_CONNECTED

Is connected and able to communicate.

IS_DISCONNECTING

Was connected, but will disconnect as soon as the remaining messages are delivered.

IS_SILENTLY_DISCONNECTING

A connection attempt failed and will be aborted.

IS_DISCONNECTED

No longer connected.

IS_NOT_CONNECTED

Was never connected, or else was disconnected long enough ago that the entry has been discarded.

Definition at line 74 of file types.h.

enum SLNet::DynDnsResultCode
Enumerator:
RC_SUCCESS
RC_DNS_ALREADY_SET
RC_NO_CHANGE
RC_NOT_DONATOR
RC_NO_HOST
RC_BAD_AUTH
RC_NOT_YOURS
RC_ABUSE
RC_TCP_FAILED_TO_START
RC_TCP_DID_NOT_CONNECT
RC_UNKNOWN_RESULT
RC_PARSING_FAILURE
RC_CONNECTION_LOST_WITHOUT_RESPONSE
RC_BAD_AGENT
RC_BAD_SYS
RC_DNS_ERROR
RC_NOT_FQDN
RC_NUM_HOST
RC_911
RC_DYNDNS_TIMEOUT

Definition at line 35 of file DynDNS.h.

enum SLNet::NATTypeDetectionResult

All possible types of NATs (except NAT_TYPE_COUNT, which is an internal value)

Enumerator:
NAT_TYPE_NONE

Works with anyone.

NAT_TYPE_FULL_CONE

Accepts any datagrams to a port that has been previously used. Will accept the first datagram from the remote peer.

NAT_TYPE_ADDRESS_RESTRICTED

Accepts datagrams to a port as long as the datagram source IP address is a system we have already sent to. Will accept the first datagram if both systems send simultaneously. Otherwise, will accept the first datagram after we have sent one datagram.

NAT_TYPE_PORT_RESTRICTED

Same as address-restricted cone NAT, but we had to send to both the correct remote IP address and correct remote port. The same source address and port to a different destination uses the same mapping.

NAT_TYPE_SYMMETRIC

A different port is chosen for every remote destination. The same source address and port to a different destination uses a different mapping. Since the port will be different, the first external punchthrough attempt will fail. For this to work it requires port-prediction (MAX_PREDICTIVE_PORT_RANGE>1) and that the router chooses ports sequentially.

NAT_TYPE_UNKNOWN

Hasn't been determined. NATTypeDetectionClient does not use this, but other plugins might.

NAT_TYPE_DETECTION_IN_PROGRESS

In progress. NATTypeDetectionClient does not use this, but other plugins might.

NAT_TYPE_SUPPORTS_UPNP

Didn't bother figuring it out, as we support UPNP, so it is equivalent to NAT_TYPE_NONE. NATTypeDetectionClient does not use this, but other plugins might.

NAT_TYPE_COUNT

Definition at line 36 of file NatTypeDetectionCommon.h.

enum SLNet::PublicKeyMode

Used with the PublicKey structure.

Enumerator:
PKM_INSECURE_CONNECTION

The connection is insecure. You can also just pass 0 for the pointer to PublicKey in RakPeerInterface::Connect()

PKM_ACCEPT_ANY_PUBLIC_KEY

Accept whatever public key the server gives us. This is vulnerable to man in the middle, but does not require distribution of the public key in advance of connecting.

PKM_USE_KNOWN_PUBLIC_KEY

Use a known remote server public key. PublicKey::remoteServerPublicKey must be non-zero. This is the recommended mode for secure connections.

PKM_USE_TWO_WAY_AUTHENTICATION

Use a known remote server public key AND provide a public key for the connecting client. PublicKey::remoteServerPublicKey, myPublicKey and myPrivateKey must be all be non-zero. The server must cooperate for this mode to work. I recommend not using this mode except for server-to-server communication as it significantly increases the CPU requirements during connections for both sides. Furthermore, when it is used, a connection password should be used as well to avoid DoS attacks.

Definition at line 111 of file types.h.

enum SLNet::RackspaceEventType

Result codes for Rackspace commands /sa Rackspace::EventTypeToString()

Enumerator:
RET_Success_200
RET_Success_201
RET_Success_202
RET_Success_203
RET_Success_204
RET_Cloud_Servers_Fault_500
RET_Service_Unavailable_503
RET_Unauthorized_401
RET_Bad_Request_400
RET_Over_Limit_413
RET_Bad_Media_Type_415
RET_Item_Not_Found_404
RET_Build_In_Progress_409
RET_Resize_Not_Allowed_403
RET_Connection_Closed_Without_Reponse
RET_Unknown_Failure

Definition at line 42 of file Rackspace.h.

enum SLNet::RackspaceOperationType
Enumerator:
RO_CONNECT_AND_AUTHENTICATE
RO_LIST_SERVERS
RO_LIST_SERVERS_WITH_DETAILS
RO_CREATE_SERVER
RO_GET_SERVER_DETAILS
RO_UPDATE_SERVER_NAME_OR_PASSWORD
RO_DELETE_SERVER
RO_LIST_SERVER_ADDRESSES
RO_SHARE_SERVER_ADDRESS
RO_DELETE_SERVER_ADDRESS
RO_REBOOT_SERVER
RO_REBUILD_SERVER
RO_RESIZE_SERVER
RO_CONFIRM_RESIZED_SERVER
RO_REVERT_RESIZED_SERVER
RO_LIST_FLAVORS
RO_GET_FLAVOR_DETAILS
RO_LIST_IMAGES
RO_CREATE_IMAGE
RO_GET_IMAGE_DETAILS
RO_DELETE_IMAGE
RO_LIST_SHARED_IP_GROUPS
RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS
RO_CREATE_SHARED_IP_GROUP
RO_GET_SHARED_IP_GROUP_DETAILS
RO_DELETE_SHARED_IP_GROUP
RO_NONE

Definition at line 63 of file Rackspace.h.

enum SLNet::RelayPluginEnums
Enumerator:
RPE_MESSAGE_TO_SERVER_FROM_CLIENT
RPE_ADD_CLIENT_REQUEST_FROM_CLIENT
RPE_REMOVE_CLIENT_REQUEST_FROM_CLIENT
RPE_GROUP_MESSAGE_FROM_CLIENT
RPE_JOIN_GROUP_REQUEST_FROM_CLIENT
RPE_LEAVE_GROUP_REQUEST_FROM_CLIENT
RPE_GET_GROUP_LIST_REQUEST_FROM_CLIENT
RPE_MESSAGE_TO_CLIENT_FROM_SERVER
RPE_ADD_CLIENT_NOT_ALLOWED
RPE_ADD_CLIENT_TARGET_NOT_CONNECTED
RPE_ADD_CLIENT_NAME_ALREADY_IN_USE
RPE_ADD_CLIENT_SUCCESS
RPE_USER_ENTERED_ROOM
RPE_USER_LEFT_ROOM
RPE_GROUP_MSG_FROM_SERVER
RPE_GET_GROUP_LIST_REPLY_FROM_SERVER
RPE_JOIN_GROUP_SUCCESS
RPE_JOIN_GROUP_FAILURE

Definition at line 41 of file RelayPlugin.h.

enum SLNet::RNS2BindResult
Enumerator:
BR_SUCCESS
BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE
BR_FAILED_TO_BIND_SOCKET
BR_FAILED_SEND_TEST

Definition at line 55 of file socket2.h.

enum SLNet::RNS2Type
Enumerator:
RNS2T_WINDOWS_STORE_8
RNS2T_PS3
RNS2T_PS4
RNS2T_CHROME
RNS2T_VITA
RNS2T_XBOX_360
RNS2T_XBOX_720
RNS2T_WINDOWS
RNS2T_LINUX

Definition at line 65 of file socket2.h.

enum SLNet::RNSPerSecondMetrics
Enumerator:
USER_MESSAGE_BYTES_PUSHED

How many bytes per pushed via a call to RakPeerInterface::Send()

USER_MESSAGE_BYTES_SENT

How many user message bytes were sent via a call to RakPeerInterface::Send(). This is less than or equal to USER_MESSAGE_BYTES_PUSHED. A message would be pushed, but not yet sent, due to congestion control

USER_MESSAGE_BYTES_RESENT

How many user message bytes were resent. A message is resent if it is marked as reliable, and either the message didn't arrive or the message ack didn't arrive.

USER_MESSAGE_BYTES_RECEIVED_PROCESSED

How many user message bytes were received, and returned to the user successfully.

USER_MESSAGE_BYTES_RECEIVED_IGNORED

How many user message bytes were received, but ignored due to data format errors. This will usually be 0.

ACTUAL_BYTES_SENT

How many actual bytes were sent, including per-message and per-datagram overhead, and reliable message acks.

ACTUAL_BYTES_RECEIVED

How many actual bytes were received, including overead and acks.

RNS_PER_SECOND_METRICS_COUNT

Definition at line 32 of file statistics.h.

enum SLNet::StartupResult
Enumerator:
RAKNET_STARTED
RAKNET_ALREADY_STARTED
INVALID_SOCKET_DESCRIPTORS
INVALID_MAX_CONNECTIONS
SOCKET_FAMILY_NOT_SUPPORTED
SOCKET_PORT_ALREADY_IN_USE
SOCKET_FAILED_TO_BIND
SOCKET_FAILED_TEST_SEND
PORT_CANNOT_BE_ZERO
FAILED_TO_CREATE_NETWORK_THREAD
COULD_NOT_GENERATE_GUID
STARTUP_OTHER_FAILURE

Definition at line 46 of file types.h.

enum SLNet::UDPForwarderResult
Enumerator:
UDPFORWARDER_FORWARDING_ALREADY_EXISTS
UDPFORWARDER_NO_SOCKETS
UDPFORWARDER_BIND_FAILED
UDPFORWARDER_INVALID_PARAMETERS
UDPFORWARDER_NOT_RUNNING
UDPFORWARDER_SUCCESS
UDPFORWARDER_RESULT_COUNT

Definition at line 43 of file UDPForwarder.h.

Function Documentation

void * SLNet::_DLMallocDirectMMap ( size_t size )

Definition at line 274 of file RakMemoryOverride.cpp.

void * SLNet::_DLMallocMMap ( size_t size )

Definition at line 273 of file RakMemoryOverride.cpp.

int SLNet::_DLMallocMUnmap | ( | void * | p,
 |  | size_t | size
 | ) |  |

Definition at line 275 of file RakMemoryOverride.cpp.

void SLNet::_RakFree ( void * p )

Definition at line 156 of file RakMemoryOverride.cpp.

void SLNet::_RakFree_Ex | ( | void * | p,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 177 of file RakMemoryOverride.cpp.

void * SLNet::_RakMalloc ( size_t size )

Definition at line 146 of file RakMemoryOverride.cpp.

void * SLNet::_RakMalloc_Ex | ( | size_t | size,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 161 of file RakMemoryOverride.cpp.

void * SLNet::_RakRealloc | ( | void * | p,
 |  | size_t | size
 | ) |  |

Definition at line 151 of file RakMemoryOverride.cpp.

void * SLNet::_RakRealloc_Ex | ( | void * | p,
 |  | size_t | size,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 169 of file RakMemoryOverride.cpp.

bool RAK_DLL_EXPORT SLNet::CanConnect | ( | NATTypeDetectionResult | type1,
 |  | NATTypeDetectionResult | type2
 | ) |  |
Returns
Can one system with NATTypeDetectionResult type1 connect to type2
int SLNet::CloudKeyComp | ( | const CloudKey & | key,
 |  | const CloudKey & | data
 | ) |  |
RAK_DLL_EXPORT RakNetSocket2* SLNet::CreateNonblockingBoundSocket | ( | const char * | bindAddr,
 |  | RNS2EventHandler * | eventHandler
 | ) |  |
int RAK_DLL_EXPORT SLNet::FilterSetComp | ( | const int & | key,
 |  | FilterSet *const & | data
 | ) |  |
SLNet::Time SLNet::GetTime ( void )

Same as GetTimeMS Holds the time in either a 32 or 64 bit variable, depending on __GET_TIME_64BIT

Definition at line 88 of file GetTime.cpp.

References GetTimeUS().

Referenced by SLNet::RakPeer::OnConnectedPong(), SLNet::RakPeer::OnConnectionRequest(), SLNet::RakPeer::Ping(), SLNet::RakPeer::PingInternal(), ProcessOfflineNetworkPacket(), and SLNet::RakPeer::RunUpdateCycle().

SLNet::TimeMS SLNet::GetTimeMS ( void )

Return the time as 32 bit

Note
The maximum delta between returned calls is 1 second - however, RakNet calls this constantly anyway. See NormalizeTime() in the cpp.

Definition at line 92 of file GetTime.cpp.

References GetTimeUS().

Referenced by SLNet::RakPeer::AddToBanList(), SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), SLNet::RakPeer::GetSocket(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::RakPeer::IsBanned(), SLNet::RakPeer::SendConnectionRequest(), and SLNet::RakPeer::Shutdown().

SLNet::TimeUS SLNet::GetTimeUS ( void )

Return the time as 64 bit

Note
The maximum delta between returned calls is 1 second - however, RakNet calls this constantly anyway. See NormalizeTime() in the cpp.

Definition at line 211 of file GetTime.cpp.

Referenced by SLNet::RakPeerInterface::Get64BitUniqueRandomNumber(), SLNet::ReliabilityLayer::GetStatistics(), GetTime(), GetTimeMS(), SLNet::RakPeer::NotifyAndFlagForShutdown(), SLNet::RakPeer::OnConnectionRequest(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::RakPeer::PingInternal(), SLNet::ReliabilityLayer::Reset(), SLNet::RakPeer::RunUpdateCycle(), StatisticsToString(), and SLNet::ReliabilityLayer::Update().

bool SLNet::GreaterThan | ( | SLNet::Time | a,
 |  | SLNet::Time | b
 | ) |  |

a > b?

Definition at line 225 of file GetTime.cpp.

bool SLNet::LessThan | ( | SLNet::Time | a,
 |  | SLNet::Time | b
 | ) |  |

a < b?

Definition at line 231 of file GetTime.cpp.

int RAK_DLL_EXPORT SLNet::MessageFilterStrComp | ( | char *const & | key,
 |  | char *const & | data
 | ) |  |
RAK_DLL_EXPORT const char* SLNet::NATTypeDetectionResultToString ( NATTypeDetectionResult type )

Return a technical string representin the enumeration.

RAK_DLL_EXPORT const char* SLNet::NATTypeDetectionResultToStringFriendly ( NATTypeDetectionResult type )

Return a friendly string representing the enumeration None and relaxed can connect to anything Moderate can connect to moderate or less Strict can connect to relaxed or less

bool SLNet::NonNumericHostString ( const char * host )

Definition at line 85 of file RakNetTypes.cpp.

Referenced by SLNet::SystemAddress::SetBinaryAddress().

template<class Type >
RAK_DLL_EXPORT void SLNet::OP_DELETE | ( | Type * | buff,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 182 of file memoryoverride.h.

References GetFree_Ex.

Referenced by DataStructures::Table::AddRow(), SLNet::RakPeer::CancelConnectionAttempt(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Clear(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::Clear(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::Clear(), DataStructures::BinarySearchTree< BinarySearchTreeType >::Clear(), DataStructures::CircularLinkedList< CircularLinkedListType >::Clear(), SLNet::RakPeer::ClearBanList(), SLNet::RakPeer::ClearBufferedPackets(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::ClearIndex(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ClearPointer(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ClearPointers(), SLNet::RakPeer::ClearRequestedConnectionList(), SLNet::TableSerializer::DeallocateQueryList(), SLNet::PluginInterface2::DeallocPacketUnified(), SLNet::RakNetSocket2Allocator::DeallocRNS2(), DataStructures::BinarySearchTree< BinarySearchTreeType >::Del(), DataStructures::CircularLinkedList< CircularLinkedListType >::Del(), DataStructures::Tree< TreeType >::DeleteDecendants(), DataStructures::DeletePtr_RakNet(), DataStructures::Table::DeleteRow(), RefCountedObj::Deref(), SLNet::RakPeer::DerefAllSockets(), SLNet::RakPeer::DisableSecurity(), SLNet::HuffmanEncodingTree::FreeMemory(), SLNet::RakString::FreeMemoryNoMutex(), FreeRow(), SLNet::StringCompressor::GenerateTreeFromStrings(), SLNet::RakPeer::InitializeSecurity(), SLNet::RakPeer::IsBanned(), SLNet::RakNetSmartPtr< T >::operator=(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Pop(), ProcessOfflineNetworkPacket(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::RemoveAtIndex(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::RemoveChannel(), DataStructures::Table::RemoveColumn(), SLNet::RakPeer::RemoveFromBanList(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::RemoveNode(), SLNet::StringTable::RemoveReference(), SLNet::StringCompressor::RemoveReference(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendConnectionRequest(), SLNet::RakNetSmartPtr< T >::SetNull(), SLNet::ReliabilityLayer::Update(), SLNet::RakNetSmartPtr< T >::~RakNetSmartPtr(), SLNet::RakPeer::~RakPeer(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::~SingleProducerConsumer(), and SLNet::StringCompressor::~StringCompressor().

template<class Type >
RAK_DLL_EXPORT void SLNet::OP_DELETE_ARRAY | ( | Type * | buff,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 197 of file memoryoverride.h.

References GetFree_Ex.

Referenced by DataStructures::Queue< queue_type >::Clear(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Clear(), DataStructures::List< list_type >::Clear(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Clear(), DataStructures::Queue< queue_type >::ClearAndForceAllocation(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::ClearDijkstra(), SLNet::RakPeer::ClearRemoteSystemLookup(), DataStructures::Queue< queue_type >::Compress(), DataStructures::List< list_type >::Compress(), SLNet::TableSerializer::DeallocateQueryList(), VariadicSQLParser::FreeArguments(), GridSectorizer::Init(), DataStructures::List< list_type >::Insert(), DataStructures::List< list_type >::Preallocate(), DataStructures::Queue< queue_type >::Push(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ReallocToSize(), DataStructures::List< list_type >::Replace(), SLNet::SystemAddress::SetBinaryAddress(), SLNet::RakPeer::Shutdown(), GridSectorizer::~GridSectorizer(), DataStructures::List< list_type >::~List(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::~Multilist(), and DataStructures::Queue< queue_type >::~Queue().

template<class Type >
RAK_DLL_EXPORT Type* SLNet::OP_NEW | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 87 of file memoryoverride.h.

References GetMalloc_Ex.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::AddNode().

template<class Type , class P1 >
RAK_DLL_EXPORT Type* SLNet::OP_NEW_1 | ( | const char * | file,
 |  | unsigned int | line,
 |  | const P1 & | p1
 | ) |  |

Definition at line 101 of file memoryoverride.h.

References GetMalloc_Ex.

template<class Type , class P1 , class P2 >
RAK_DLL_EXPORT Type* SLNet::OP_NEW_2 | ( | const char * | file,
 |  | unsigned int | line,
 |  | const P1 & | p1,
 |  | const P2 & | p2
 | ) |  |

Definition at line 115 of file memoryoverride.h.

References GetMalloc_Ex.

template<class Type , class P1 , class P2 , class P3 >
RAK_DLL_EXPORT Type* SLNet::OP_NEW_3 | ( | const char * | file,
 |  | unsigned int | line,
 |  | const P1 & | p1,
 |  | const P2 & | p2,
 |  | const P3 & | p3
 | ) |  |

Definition at line 129 of file memoryoverride.h.

References GetMalloc_Ex.

template<class Type , class P1 , class P2 , class P3 , class P4 >
RAK_DLL_EXPORT Type* SLNet::OP_NEW_4 | ( | const char * | file,
 |  | unsigned int | line,
 |  | const P1 & | p1,
 |  | const P2 & | p2,
 |  | const P3 & | p3,
 |  | const P4 & | p4
 | ) |  |

Definition at line 143 of file memoryoverride.h.

References GetMalloc_Ex.

template<class Type >
RAK_DLL_EXPORT Type* SLNet::OP_NEW_ARRAY | ( | const int | count,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 158 of file memoryoverride.h.

References GetMalloc_Ex.

template<class templateType >
BitStream& SLNet::operator<< | ( | BitStream & | out,
 |  | const templateType & | c
 | ) |  |

Definition at line 1864 of file BitStream.h.

References SLNet::BitStream::Write().

template<class templateType >
BitStream& SLNet::operator>> | ( | BitStream & | in,
 |  | templateType & | c
 | ) |  |

Definition at line 1870 of file BitStream.h.

References RakAssert, and SLNet::BitStream::Read().

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

Definition at line 5398 of file RakPeer.cpp.

References SLNet::RakPeer::socketList.

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

Definition at line 5402 of file RakPeer.cpp.

References SLNet::SystemAddress::GetPort(), SLNet::RakPeer::GetRemoteSystemFromSystemAddress(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::RakPeer::RemoteSystemStruct::MTUSize, SLNet::RakPeer::pluginListNTS, ProcessOfflineNetworkPacket(), RakAssert, SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, and rnr.

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

Definition at line 4524 of file RakPeer.cpp.

References _FILE_AND_LINE_, SLNet::RakPeer::RequestedConnectionStruct::actionToTake, SLNet::RakPeer::AddPacketToProducer(), SLNet::SystemAddress::address, SLNet::RakPeer::AllocPacket(), SLNet::RakPeer::AllowIncomingConnections(), SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::Packet::bitSize, BYTES_TO_BITS, CAT_AUDIT_PRINTF, SLNet::RakPeer::RequestedConnectionStruct::CONNECT, SLNet::RakPeer::RemoteSystemStruct::connectMode, SLNet::RNS2_SendParameters::data, SLNet::Packet::data, SLNet::RakPeer::DereferenceRemoteSystem(), SLNet::BitStream::GetData(), SLNet::RakPeer::GetGuidFromSystemAddress(), SLNet::RakPeer::GetIndexFromSystemAddress(), SLNet::BitStream::GetNumberOfBitsUsed(), SLNet::BitStream::GetNumberOfBytesUsed(), SLNet::RakPeer::GetRemoteSystemFromGUID(), SLNet::RakPeer::GetRemoteSystemFromSystemAddress(), GetTime(), SLNet::Packet::guid, ID_ADVERTISE_SYSTEM, ID_ALREADY_CONNECTED, ID_CONNECTION_ATTEMPT_FAILED, ID_CONNECTION_BANNED, ID_CONNECTION_REQUEST, ID_INCOMPATIBLE_PROTOCOL_VERSION, ID_INVALID_PASSWORD, ID_IP_RECENTLY_CONNECTED, ID_NO_FREE_INCOMING_CONNECTIONS, ID_OPEN_CONNECTION_REPLY_1, ID_OPEN_CONNECTION_REPLY_2, ID_OPEN_CONNECTION_REQUEST_1, ID_OPEN_CONNECTION_REQUEST_2, ID_OUR_SYSTEM_REQUIRES_SECURITY, ID_OUT_OF_BAND_INTERNAL, ID_PUBLIC_KEY_MISMATCH, ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY, ID_UNCONNECTED_PING, ID_UNCONNECTED_PING_OPEN_CONNECTIONS, ID_UNCONNECTED_PONG, SLNet::BitStream::IgnoreBits(), SLNet::BitStream::IgnoreBytes(), IMMEDIATE_PRIORITY, SLNet::RakPeer::RemoteSystemStruct::isActive, SLNet::RakPeer::IsBanned(), SLNet::RakPeer::IsInSecurityExceptionList(), SLNet::RNS2_SendParameters::length, SLNet::Packet::length, SLNet::SimpleMutex::Lock(), MAX_OFFLINE_DATA_LENGTH, MAXIMUM_MTU_SIZE, SLNet::RakPeer::myGuid, OFFLINE_MESSAGE_DATA_ID, SLNet::RakPeer::offlinePingResponse, SLNet::RakPeer::offlinePingResponse_Mutex, OP_DELETE(), SLNet::RakPeer::RequestedConnectionStruct::outgoingPassword, SLNet::RakPeer::RequestedConnectionStruct::outgoingPasswordLength, PKM_ACCEPT_ANY_PUBLIC_KEY, PKM_USE_TWO_WAY_AUTHENTICATION, SLNet::RakPeer::pluginListNTS, SLNet::RakPeer::RequestedConnectionStruct::publicKeyMode, RakAssert, RAKNET_PROTOCOL_VERSION, SLNet::RakPeer::rakPeerMutexes, SLNet::BitStream::Read(), SLNet::BitStream::ReadAlignedBytes(), SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer, RELIABLE, DataStructures::Queue< queue_type >::RemoveAtIndex(), SLNet::RakPeer::RemoteSystemStruct::REQUESTED_CONNECTION, SLNet::RakPeer::requestedConnectionQueue, SLNet::RakPeer::requestedConnectionQueueMutex, SLNet::BitStream::ResetWritePointer(), SLNet::RakNetSocket2::Send(), SLNet::RakPeer::SendImmediate(), SLNet::ReliabilityLayer::SetTimeoutTime(), DataStructures::Queue< queue_type >::Size(), DataStructures::List< list_type >::Size(), SLNet::RakNetGUID::size(), SLNet::RakPeer::RequestedConnectionStruct::socket, SLNet::RNS2_SendParameters::systemAddress, SLNet::Packet::systemAddress, SLNet::RakPeer::RequestedConnectionStruct::systemAddress, SLNet::SystemAddress::systemIndex, SLNet::RakNetGUID::systemIndex, SLNet::RakPeer::RequestedConnectionStruct::timeoutTime, SLNet::SystemAddress::ToString(), UDP_HEADER_SIZE, UNASSIGNED_RAKNET_GUID(), UNASSIGNED_SYSTEM_ADDRESS, SLNet::SimpleMutex::Unlock(), SLNet::RakPeer::RemoteSystemStruct::UNVERIFIED_SENDER, SLNet::RakPeer::RemoteSystemStruct::weInitiatedTheConnection, SLNet::BitStream::Write(), SLNet::BitStream::WriteAlignedBytes(), and SLNet::BitStream::WriteCasted().

Referenced by ProcessNetworkPacket().

SLNet::RAK_THREAD_DECLARATION ( UpdateNetworkLoop )
SLNet::RAK_THREAD_DECLARATION ( RecvFromLoop )
SLNet::RAK_THREAD_DECLARATION ( UDTConnect )
int SLNet::RegisteredCommandComp | ( | const char *const & | key,
 |  | const RegisteredCommand & | data
 | ) |  |

List of commands registered with RegisterCommand()

Definition at line 41 of file CommandParserInterface.cpp.

References SLNet::RegisteredCommand::command.

int SLNet::SplitPacketChannelComp | ( | SplitPacketIdType const & | key,
 |  | SplitPacketChannel *const & | data
 | ) |  |

Definition at line 246 of file ReliabilityLayer.cpp.

References SLNet::SplitPacketChannel::splitPacketList.

void RAK_DLL_EXPORT SLNet::StatisticsToString | ( | RakNetStatistics * | s,
 |  | char * | buffer,
 |  | int | verbosityLevel
 | ) |  |

Verbosity level currently supports 0 (low), 1 (medium), 2 (high)

Parameters
[in] | s | The Statistical information to format out
[in] | buffer | The buffer containing a formated report
[in] | bufferLength | The size (in characters) of the buffer
[in] | verbosityLevel | 0 low 1 medium 2 high 3 debugging congestion control

Definition at line 32 of file RakNetStatistics.cpp.

References ACTUAL_BYTES_RECEIVED, ACTUAL_BYTES_SENT, SLNet::RakNetStatistics::BPSLimitByCongestionControl, SLNet::RakNetStatistics::BPSLimitByOutgoingBandwidthLimit, SLNet::RakNetStatistics::bytesInResendBuffer, SLNet::RakNetStatistics::bytesInSendBuffer, SLNet::RakNetStatistics::connectionStartTime, GetTimeUS(), HIGH_PRIORITY, IMMEDIATE_PRIORITY, LOW_PRIORITY, MEDIUM_PRIORITY, SLNet::RakNetStatistics::messageInSendBuffer, SLNet::RakNetStatistics::messagesInResendBuffer, SLNet::RakNetStatistics::packetlossLastSecond, SLNet::RakNetStatistics::packetlossTotal, PRINTF_64_BIT_MODIFIER, SLNet::RakNetStatistics::runningTotal, USER_MESSAGE_BYTES_PUSHED, USER_MESSAGE_BYTES_RECEIVED_IGNORED, USER_MESSAGE_BYTES_RECEIVED_PROCESSED, USER_MESSAGE_BYTES_RESENT, USER_MESSAGE_BYTES_SENT, and SLNet::RakNetStatistics::valueOverLastSecond.

void RAK_DLL_EXPORT SLNet::StatisticsToString | ( | RakNetStatistics * | s,
 |  | char * | buffer,
 |  | size_t | bufferLength,
 |  | int | verbosityLevel
 | ) |  |

Definition at line 188 of file RakNetStatistics.cpp.

References ACTUAL_BYTES_RECEIVED, ACTUAL_BYTES_SENT, SLNet::RakNetStatistics::BPSLimitByCongestionControl, SLNet::RakNetStatistics::BPSLimitByOutgoingBandwidthLimit, SLNet::RakNetStatistics::bytesInResendBuffer, SLNet::RakNetStatistics::bytesInSendBuffer, SLNet::RakNetStatistics::connectionStartTime, GetTimeUS(), HIGH_PRIORITY, IMMEDIATE_PRIORITY, LOW_PRIORITY, MEDIUM_PRIORITY, SLNet::RakNetStatistics::messageInSendBuffer, SLNet::RakNetStatistics::messagesInResendBuffer, SLNet::RakNetStatistics::packetlossLastSecond, SLNet::RakNetStatistics::packetlossTotal, PRINTF_64_BIT_MODIFIER, return, SLNet::RakNetStatistics::runningTotal, USER_MESSAGE_BYTES_PUSHED, USER_MESSAGE_BYTES_RECEIVED_IGNORED, USER_MESSAGE_BYTES_RECEIVED_PROCESSED, USER_MESSAGE_BYTES_RESENT, USER_MESSAGE_BYTES_SENT, and SLNet::RakNetStatistics::valueOverLastSecond.

int SLNet::StrAndBoolComp | ( | char *const & | key,
 |  | const StrAndBool & | data
 | ) |  |

Definition at line 30 of file StringTable.cpp.

References StrAndBool::str.

const RakNetGUID SLNet::UNASSIGNED_RAKNET_GUID ( (uint64_t)- 1 )

Referenced by SLNet::AddressOrGUID::AddressOrGUID(), SLNet::PluginInterface2::AllocatePacketUnified(), SLNet::RakPeer::AllocPacket(), SLNet::VariableDeltaSerializer::BeginIdenticalSerialize(), SLNet::VariableDeltaSerializer::BeginUniqueSerialize(), SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), SLNet::RakPeer::CloseConnection(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetGUIDFromIndex(), SLNet::RakPeer::GetGuidFromSystemAddress(), SLNet::RakPeer::GetIndexFromGuid(), SLNet::PluginInterface2::GetMyGUIDUnified(), SLNet::RakPeer::GetRemoteSystem(), SLNet::RakPeer::GetRemoteSystemFromGUID(), SLNet::RakPeer::GetSystemAddressFromGuid(), SLNet::AddressOrGUID::GetSystemIndex(), SLNet::RakPeer::GetSystemIndexFromGuid(), SLNet::RakPeer::IsLoopbackAddress(), SLNet::AddressOrGUID::IsUndefined(), SLNet::AddressOrGUID::operator=(), SLNet::AddressOrGUID::operator==(), ProcessOfflineNetworkPacket(), SLNet::RakNetGUID::RakNetGUID(), SLNet::RakPeer::RakPeer(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendUnified(), SLNet::AddressOrGUID::SetUndefined(), SLNet::RakPeer::Startup(), SLNet::AddressOrGUID::ToInteger(), SLNet::RakNetGUID::ToString(), and SLNet::AddressOrGUID::ToString().

Variable Documentation

const int SLNet::MAX_RPC_MAP_SIZE =((RPCIndex)-1)-1

Definition at line 100 of file types.h.

const int SLNet::PING_TIMES_ARRAY_SIZE = 5

Definition at line 468 of file types.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::GetAveragePing(), SLNet::RakPeer::GetClockDifferentialInt(), SLNet::RakPeer::GetLastPing(), and SLNet::RakPeer::OnConnectedPong().

const int SLNet::RM3_NUM_OUTPUT_BITSTREAM_CHANNELS =16
static

Definition at line 356 of file ReplicaManager3.h.

const NetworkID SLNet::UNASSIGNED_NETWORK_ID = (uint64_t) -1

Unassigned object ID.

Definition at line 466 of file types.h.

Referenced by SLNet::NetworkIDManager::GetNewNetworkID(), SLNet::NetworkIDObject::NetworkIDObject(), SLNet::NetworkIDObject::SetNetworkID(), SLNet::NetworkIDObject::SetNetworkIDManager(), SLNet::NetworkIDManager::StopTrackingNetworkIDObject(), and SLNet::NetworkIDManager::TrackNetworkIDObject().

const SystemIndex SLNet::UNASSIGNED_PLAYER_INDEX = 65535

Index of an unassigned player.

Definition at line 463 of file types.h.

const SystemAddress SLNet::UNASSIGNED_SYSTEM_ADDRESS

Index of an invalid SystemAddress.

Definition at line 368 of file types.h.

Referenced by SLNet::AddressOrGUID::AddressOrGUID(), SLNet::PluginInterface2::AllocatePacketUnified(), SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::CloseConnection(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::FillIPList(), SLNet::SystemAddress::FromStringExplicitPort(), SLNet::RakPeer::GetClientPublicKeyFromSystemAddress(), SLNet::RakPeer::GetConnectionState(), SLNet::RakPeer::GetExternalID(), SLNet::SocketLayer::GetFirstBindableIP(), SLNet::RakPeer::GetGuidFromSystemAddress(), SLNet::RakPeer::GetIndexFromSystemAddress(), SLNet::RakPeer::GetInternalID(), SLNet::RakPeer::GetMTUSize(), SLNet::RakPeer::GetMyBoundAddress(), GetMyIP_Win32(), SLNet::RakPeer::GetNumberOfAddresses(), SLNet::RakPeer::GetRemoteSystemFromSystemAddress(), SLNet::RakPeer::GetSockets(), SLNet::RakPeer::GetStatistics(), SLNet::SocketLayer::GetSystemAddress_Old(), SLNet::RakPeer::GetSystemAddressFromGuid(), SLNet::RakPeer::GetSystemAddressFromIndex(), SLNet::RakPeer::GetTimeoutTime(), SLNet::RakPeer::IsLoopbackAddress(), SLNet::AddressOrGUID::IsUndefined(), SLNet::AddressOrGUID::operator=(), SLNet::AddressOrGUID::operator==(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::RakPeer::Ping(), ProcessOfflineNetworkPacket(), SLNet::RakPeer::RakPeer(), SLNet::RakPeer::ReferenceRemoteSystem(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendUnified(), SLNet::SystemAddress::SetBinaryAddress(), SLNet::RakPeer::SetTimeoutTime(), SLNet::AddressOrGUID::SetUndefined(), SLNet::RakPeer::Startup(), and SLNet::SystemAddress::ToString_Old().

const int SLNet::UNDEFINED_RPC_INDEX =((RPCIndex)-1)

Definition at line 101 of file types.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: FileListTransfer

Classes
FileListTransfer
Plugins

A plugin to provide a simple way to compress and incrementally send the files in the FileList structure. More...

Classes

class | SLNet::FileListTransfer
A plugin to provide a simple way to compress and incrementally send the files in the FileList structure. More...
struct | SLNet::FileListTransfer::FileToPush
struct | SLNet::FileListTransfer::FileToPushRecipient
struct | SLNet::FileListTransfer::ThreadData

Detailed Description

A plugin to provide a simple way to compress and incrementally send the files in the FileList structure.

Class Documentation

class SLNet::FileListTransfer

A plugin to provide a simple way to compress and incrementally send the files in the FileList structure.

Similar to the DirectoryDeltaTransfer plugin, except that it doesn't send deltas based on pre-existing files or actually write the files to disk.

Usage: Call SetupReceive to allow one file set to arrive. The value returned by FileListTransfer::SetupReceive()
is the setID that is allowed.
It's up to you to transmit this value to the other system, along with information indicating what kind of files you want to get.
The other system should then prepare a FileList and call FileListTransfer::Send(), passing the return value of FileListTransfer::SetupReceive()
as the setID parameter to FileListTransfer::Send()

Definition at line 62 of file FileListTransfer.h.

+ Inheritance diagram for SLNet::FileListTransfer:

Public Member Functions

FileListTransfer ()
virtual | ~FileListTransfer ()
void | StartIncrementalReadThreads (int numThreads, int threadPriority=-99999)
Optionally start worker threads when using _incrementalReadInterface for the Send() operation.
unsigned short | SetupReceive (FileListTransferCBInterface *handler, bool deleteHandler, SystemAddress allowedSender)
Allows one corresponding Send() call from another system to arrive.
void | Send (FileList *fileList, SLNet::RakPeerInterface *rakPeer, SystemAddress recipient, unsigned short setID, PacketPriority priority, char orderingChannel, IncrementalReadInterface *_incrementalReadInterface=0, unsigned int _chunkSize=262144 *4 *16)
Send the FileList structure to another system, which must have previously called SetupReceive().
unsigned int | GetPendingFilesToAddress (SystemAddress recipient)
Return number of files waiting to go out to a particular address.
void | CancelReceive (unsigned short inSetId)
Stop a download.
void | RemoveReceiver (SystemAddress systemAddress)
Remove all handlers associated with a particular system address.
bool | IsHandlerActive (unsigned short inSetId)
Is a handler passed to SetupReceive still running?
void | AddCallback (FileListProgress *cb)
Adds a callback to get progress reports about what the file list instances do.
void | RemoveCallback (FileListProgress *cb)
Removes a callback.
void | ClearCallbacks (void)
Removes all callbacks.
void | GetCallbacks (DataStructures::List< FileListProgress * > &callbacks)
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | Update (void)
Update is called every time a packet is checked for .
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

bool | DecodeSetHeader (Packet *packet)
bool | DecodeFile (Packet *packet, bool fullFile)
void | Clear (void)
void | OnReferencePush (Packet *packet, bool fullFile)
void | OnReferencePushAck (Packet *packet)
void | SendIRIToAddress (SystemAddress systemAddress, unsigned short inSetId)
void | RemoveFromList (FileToPushRecipient *ftpr)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::Map< unsigned
short, FileListReceiver * > 		fileListReceivers
unsigned short | setId
DataStructures::List
< FileListProgress * > 		fileListProgressCallbacks
DataStructures::List
< FileToPushRecipient * > 		fileToPushRecipientList
SimpleMutex fileToPushRecipientListMutex
ThreadPool< ThreadData, int > | threadPool
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Friends

int | SendIRIToAddressCB (FileListTransfer::ThreadData threadData, bool *returnOutput, void *perThreadData)

Constructor & Destructor Documentation

SLNet::FileListTransfer::FileListTransfer ( )
virtual SLNet::FileListTransfer::~FileListTransfer ( )
virtual

Member Function Documentation

void SLNet::FileListTransfer::AddCallback ( FileListProgress * cb )

Adds a callback to get progress reports about what the file list instances do.

Parameters
[in] cb A pointer to an externally defined instance of FileListProgress. This pointer is held internally, so should remain valid as long as this class is valid.
void SLNet::FileListTransfer::CancelReceive ( unsigned short inSetId )

Stop a download.

void SLNet::FileListTransfer::Clear ( void )
protected
void SLNet::FileListTransfer::ClearCallbacks ( void )

Removes all callbacks.

bool SLNet::FileListTransfer::DecodeFile | ( | Packet * | packet,
 |  | bool | fullFile
 | ) |  |
protected
bool SLNet::FileListTransfer::DecodeSetHeader ( Packet * packet )
protected
void SLNet::FileListTransfer::GetCallbacks ( DataStructures::List< FileListProgress * > & callbacks )

Returns all callbacks added with AddCallback()

Parameters
[out] callbacks The list is set to the list of callbacks
unsigned int SLNet::FileListTransfer::GetPendingFilesToAddress ( SystemAddress recipient )

Return number of files waiting to go out to a particular address.

bool SLNet::FileListTransfer::IsHandlerActive ( unsigned short inSetId )

Is a handler passed to SetupReceive still running?

virtual void SLNet::FileListTransfer::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::FileListTransfer::OnRakPeerShutdown ( void )
virtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::FileListTransfer::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::FileListTransfer::OnReferencePush | ( | Packet * | packet,
 |  | bool | fullFile
 | ) |  |
protected
void SLNet::FileListTransfer::OnReferencePushAck ( Packet * packet )
protected
void SLNet::FileListTransfer::RemoveCallback ( FileListProgress * cb )

Removes a callback.

Parameters
[in] cb A pointer to an externally defined instance of FileListProgress that was previously added with AddCallback()
void SLNet::FileListTransfer::RemoveFromList ( FileToPushRecipient * ftpr )
protected
void SLNet::FileListTransfer::RemoveReceiver ( SystemAddress systemAddress )

Remove all handlers associated with a particular system address.

void SLNet::FileListTransfer::Send | ( | FileList * | fileList,
 |  | SLNet::RakPeerInterface * | rakPeer,
 |  | SystemAddress | recipient,
 |  | unsigned short | setID,
 |  | PacketPriority | priority,
 |  | char | orderingChannel,
 |  | IncrementalReadInterface * | _incrementalReadInterface = 0,
 |  | unsigned int | _chunkSize = 262144 *4 *16
 | ) |  |

Send the FileList structure to another system, which must have previously called SetupReceive().

Parameters
[in] | fileList | A list of files. The data contained in FileList::data will be sent incrementally and compressed among all files in the set
[in] | rakPeer | The instance of RakNet to use to send the message. Pass 0 to use the instance the plugin is attached to
[in] | recipient | The address of the system to send to
[in] | setID | The return value of SetupReceive() which was previously called on recipient
[in] | priority | Passed to RakPeerInterface::Send()
[in] | orderingChannel | Passed to RakPeerInterface::Send()
[in] | _incrementalReadInterface | If a file in fileList has no data, _incrementalReadInterface will be used to read the file in chunks of size chunkSize
[in] | _chunkSize | How large of a block of a file to read/send at once. Large values use more memory but transfer slightly faster.
void SLNet::FileListTransfer::SendIRIToAddress | ( | SystemAddress | systemAddress,
 |  | unsigned short | inSetId
 | ) |  |
protected
unsigned short SLNet::FileListTransfer::SetupReceive | ( | FileListTransferCBInterface * | handler,
 |  | bool | deleteHandler,
 |  | SystemAddress | allowedSender
 | ) |  |

Allows one corresponding Send() call from another system to arrive.

Parameters
[in] | handler | The class to call on each file
[in] | deleteHandler | True to delete the handler when it is no longer needed. False to not do so.
[in] | allowedSender | Which system to allow files from.
Returns
A set ID value, which should be passed as the setID value to the Send() call on the other system. This value will be returned in the callback and is unique per file set. Returns 65535 on failure (not connected to sender)
void SLNet::FileListTransfer::StartIncrementalReadThreads | ( | int | numThreads,
 |  | int | threadPriority = -99999
 | ) |  |

Optionally start worker threads when using _incrementalReadInterface for the Send() operation.

Parameters
[in] | numThreads | how many worker threads to start
[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.
virtual void SLNet::FileListTransfer::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Friends And Related Function Documentation

int SendIRIToAddressCB | ( | FileListTransfer::ThreadData | threadData,
 |  | bool * | returnOutput,
 |  | void * | perThreadData
 | ) |  |
friend

Member Data Documentation

DataStructures::List<FileListProgress*> SLNet::FileListTransfer::fileListProgressCallbacks
protected

Definition at line 143 of file FileListTransfer.h.

DataStructures::Map<unsigned short, FileListReceiver*> SLNet::FileListTransfer::fileListReceivers
protected

Definition at line 141 of file FileListTransfer.h.

DataStructures::List< FileToPushRecipient* > SLNet::FileListTransfer::fileToPushRecipientList
protected

Definition at line 170 of file FileListTransfer.h.

SimpleMutex SLNet::FileListTransfer::fileToPushRecipientListMutex
protected

Definition at line 171 of file FileListTransfer.h.

unsigned short SLNet::FileListTransfer::setId
protected

Definition at line 142 of file FileListTransfer.h.

ThreadPool<ThreadData, int> SLNet::FileListTransfer::threadPool
protected

Definition at line 181 of file FileListTransfer.h.

struct SLNet::FileListTransfer::FileToPush

Definition at line 145 of file FileListTransfer.h.

Class Members
unsigned int | chunkSize
unsigned int | currentOffset
FileListNode | fileListNode
IncrementalReadInterface * | incrementalReadInterface
char | orderingChannel
PacketPriority | packetPriority
unsigned int | setIndex
struct SLNet::FileListTransfer::FileToPushRecipient

Definition at line 156 of file FileListTransfer.h.

Public Member Functions

void | DeleteThis (void)
void | AddRef (void)
void | Deref (void)

Public Attributes

unsigned int | refCount
SimpleMutex refCountMutex
SystemAddress systemAddress
unsigned short | setId
DataStructures::Queue
< FileToPush * > 		filesToPush

Member Function Documentation

void SLNet::FileListTransfer::FileToPushRecipient::AddRef ( void )
void SLNet::FileListTransfer::FileToPushRecipient::DeleteThis ( void )
void SLNet::FileListTransfer::FileToPushRecipient::Deref ( void )

Member Data Documentation

DataStructures::Queue<FileToPush*> SLNet::FileListTransfer::FileToPushRecipient::filesToPush

Definition at line 168 of file FileListTransfer.h.

unsigned int SLNet::FileListTransfer::FileToPushRecipient::refCount

Definition at line 158 of file FileListTransfer.h.

SimpleMutex SLNet::FileListTransfer::FileToPushRecipient::refCountMutex

Definition at line 159 of file FileListTransfer.h.

unsigned short SLNet::FileListTransfer::FileToPushRecipient::setId

Definition at line 165 of file FileListTransfer.h.

SystemAddress SLNet::FileListTransfer::FileToPushRecipient::systemAddress

Definition at line 164 of file FileListTransfer.h.

struct SLNet::FileListTransfer::ThreadData

Definition at line 174 of file FileListTransfer.h.

Class Members
FileListTransfer * | fileListTransfer
unsigned short | setId
SystemAddress | systemAddress
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: MessageFilter

Classes
MessageFilter
Plugins

Remote incoming packets from unauthorized systems. More...

Classes

class SLNet::MessageFilter
Assigns systems to FilterSets. Each FilterSet limits what kinds of messages are allowed. More...

Detailed Description

Remote incoming packets from unauthorized systems.

Class Documentation

class SLNet::MessageFilter

Assigns systems to FilterSets. Each FilterSet limits what kinds of messages are allowed.

The MessageFilter plugin is used for security where you limit what systems can send what kind of messages.
You implicitly define FilterSets, and add allowed message IDs to these FilterSets.
You then add systems to these filters, such that those systems are limited to sending what the filters allows.
You can automatically assign systems to a filter.
You can automatically kick and possibly ban users that stay in a filter too long, or send the wrong message.
Each system is a member of either zero or one filters.
Add this plugin before any plugin you wish to filter (most likely just add this plugin before any other).

Definition at line 85 of file MessageFilter.h.

+ Inheritance diagram for SLNet::MessageFilter:

Public Member Functions

MessageFilter ()
virtual | ~MessageFilter ()
void | SetAutoAddNewConnectionsToFilter (int filterSetID)
void | SetAllowMessageID (bool allow, int messageIDStart, int messageIDEnd, int filterSetID)
void | SetAllowRPC4 (bool allow, const char *uniqueID, int filterSetID)
void | SetActionOnDisallowedMessage (bool kickOnDisallowed, bool banOnDisallowed, SLNet::TimeMS banTimeMS, int filterSetID)
void | SetDisallowedMessageCallback (int filterSetID, void *userData, void(*invalidMessageCallback)(RakPeerInterface *peer, AddressOrGUID addressOrGUID, int filterSetID, void *userData, unsigned char messageID))
void | SetTimeoutCallback (int filterSetID, void *userData, void(*invalidMessageCallback)(RakPeerInterface *peer, AddressOrGUID addressOrGUID, int filterSetID, void *userData))
void | SetFilterMaxTime (int allowedTimeMS, bool banOnExceed, SLNet::TimeMS banTimeMS, int filterSetID)
int | GetSystemFilterSet (AddressOrGUID addressOrGUID)
void | SetSystemFilterSet (AddressOrGUID addressOrGUID, int filterSetID)
unsigned | GetSystemCount (int filterSetID) const
unsigned | GetFilterSetCount (void) const
int | GetFilterSetIDByIndex (unsigned index)
void | DeleteFilterSet (int filterSetID)
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

void | Clear (void)
void | DeallocateFilterSet (FilterSet *filterSet)
FilterSet * | GetFilterSetByID (int filterSetID)
void | OnInvalidMessage (FilterSet *filterSet, AddressOrGUID systemAddress, unsigned char messageID)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::OrderedList
< int, FilterSet
*, FilterSetComp > 		filterList
DataStructures::Hash
< AddressOrGUID,
FilteredSystem,
2048, AddressOrGUID::ToInteger > 		systemList
int | autoAddNewConnectionsToFilter
SLNet::Time whenLastTimeoutCheck
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::MessageFilter::MessageFilter ( )
virtual SLNet::MessageFilter::~MessageFilter ( )
virtual

Member Function Documentation

void SLNet::MessageFilter::Clear ( void )
protected
void SLNet::MessageFilter::DeallocateFilterSet ( FilterSet * filterSet )
protected
void SLNet::MessageFilter::DeleteFilterSet ( int filterSetID )

Delete a FilterSet. All systems formerly subscribed to this filter are now unrestricted.

Parameters
[in] filterSetID The ID of the filter set to delete.
FilterSet* SLNet::MessageFilter::GetFilterSetByID ( int filterSetID )
protected
unsigned SLNet::MessageFilter::GetFilterSetCount ( void ) const

Returns the total number of filter sets.

Returns
The total number of filter sets.
int SLNet::MessageFilter::GetFilterSetIDByIndex ( unsigned index )

Returns the ID of a filter set, by index

Parameters
[in] An index between 0 and GetFilterSetCount()-1 inclusive
unsigned SLNet::MessageFilter::GetSystemCount ( int filterSetID ) const

Returns the number of systems subscribed to a particular filter set Using anything other than -1 for filterSetID is slow, so you should store the returned value.

Parameters
[in] filterSetID The filter set to limit to. Use -1 for none (just returns the total number of filter systems in that case).
int SLNet::MessageFilter::GetSystemFilterSet ( AddressOrGUID addressOrGUID )

Get the filterSetID a system is using. Returns -1 for none.

Parameters
[in] addressOrGUID The system we are referring to
virtual void SLNet::MessageFilter::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

void SLNet::MessageFilter::OnInvalidMessage | ( | FilterSet * | filterSet,
 |  | AddressOrGUID | systemAddress,
 |  | unsigned char | messageID
 | ) |  |
protected
virtual void SLNet::MessageFilter::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
virtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::MessageFilter::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::MessageFilter::SetActionOnDisallowedMessage | ( | bool | kickOnDisallowed,
 |  | bool | banOnDisallowed,
 |  | SLNet::TimeMS | banTimeMS,
 |  | int | filterSetID
 | ) |  |

What action to take on a disallowed message. You can kick or not. You can add them to the ban list for some time By default no action is taken. The message is simply ignored. param[in] 0 for permanent ban, >0 for ban time in milliseconds.

Parameters
[in] | kickOnDisallowed | kick the system that sent a disallowed message.
[in] | banOnDisallowed | ban the system that sent a disallowed message. See banTimeMS for the ban duration
[in] | banTimeMS | Passed to the milliseconds parameter of RakPeer::AddToBanList.
[in] | filterSetID | A user defined ID to represent a filter set. If no filter with this ID exists, one will be created with default settings.
void SLNet::MessageFilter::SetAllowMessageID | ( | bool | allow,
 |  | int | messageIDStart,
 |  | int | messageIDEnd,
 |  | int | filterSetID
 | ) |  |

Allow a range of message IDs Always allowed by default: ID_CONNECTION_REQUEST_ACCEPTED through ID_DOWNLOAD_PROGRESS Usually you specify a range to make it easier to add new enumerations without having to constantly refer back to this function.

Parameters
[in] | allow | True to allow this message ID, false to disallow. By default, all messageIDs except the noted types are disallowed. This includes messages from other plugins!
[in] | messageIDStart | The first ID_* message to allow in the range. Inclusive.
[in] | messageIDEnd | The last ID_* message to allow in the range. Inclusive.
[in] | filterSetID | A user defined ID to represent a filter set. If no filter with this ID exists, one will be created with default settings.
void SLNet::MessageFilter::SetAllowRPC4 | ( | bool | allow,
 |  | const char * | uniqueID,
 |  | int | filterSetID
 | ) |  |

Allow a specific RPC4 call

Precondition
MessageFilter must be attached before RPC4
Parameters
[in] | uniqueID | Identifier passed to RegisterFunction()
[in] | filterSetID | A user defined ID to represent a filter set. If no filter with this ID exists, one will be created with default settings.
void SLNet::MessageFilter::SetAutoAddNewConnectionsToFilter ( int filterSetID )

Automatically add all new systems to a particular filter Defaults to -1

Parameters
[in] filterSetID Which filter to add new systems to. <0 for do not add.
void SLNet::MessageFilter::SetDisallowedMessageCallback | ( | int | filterSetID,
 |  | void * | userData,
 |  | void(*)(RakPeerInterface *peer, AddressOrGUID addressOrGUID, int filterSetID, void *userData, unsigned char messageID) | invalidMessageCallback
 | ) |  |

Set a user callback to be called on an invalid message for a particular filterSet

Parameters
[in] | filterSetID | A user defined ID to represent a filter set. If no filter with this ID exists, one will be created with default settings.
[in] | userData | A pointer passed with the callback
[in] | invalidMessageCallback | A pointer to a C function to be called back with the specified parameters.
void SLNet::MessageFilter::SetFilterMaxTime | ( | int | allowedTimeMS,
 |  | bool | banOnExceed,
 |  | SLNet::TimeMS | banTimeMS,
 |  | int | filterSetID
 | ) |  |

Limit how long a connection can stay in a particular filterSetID. After this time, the connection is kicked and possibly banned. By default there is no limit to how long a connection can stay in a particular filter set.

Parameters
[in] | allowedTimeMS | How many milliseconds to allow a connection to stay in this filter set.
[in] | banOnExceed | True or false to ban the system, or not, when allowedTimeMS is exceeded
[in] | banTimeMS | Passed to the milliseconds parameter of RakPeer::AddToBanList.
[in] | filterSetID | A user defined ID to represent a filter set. If no filter with this ID exists, one will be created with default settings.
void SLNet::MessageFilter::SetSystemFilterSet | ( | AddressOrGUID | addressOrGUID,
 |  | int | filterSetID
 | ) |  |

Assign a system to a filter set. Systems are automatically added to filter sets (or not) based on SetAutoAddNewConnectionsToFilter() This function is used to change the filter set a system is using, to add it to a new filter set, or to remove it from all existin filter sets.

Parameters
[in] | addressOrGUID | The system we are referring to
[in] | filterSetID | A user defined ID to represent a filter set. If no filter with this ID exists, one will be created with default settings. If -1, the system will be removed from all filter sets.
void SLNet::MessageFilter::SetTimeoutCallback | ( | int | filterSetID,
 |  | void * | userData,
 |  | void(*)(RakPeerInterface *peer, AddressOrGUID addressOrGUID, int filterSetID, void *userData) | invalidMessageCallback
 | ) |  |

Set a user callback to be called when a user is disconnected due to SetFilterMaxTime

Parameters
[in] | filterSetID | A user defined ID to represent a filter set. If no filter with this ID exists, one will be created with default settings.
[in] | userData | A pointer passed with the callback
[in] | invalidMessageCallback | A pointer to a C function to be called back with the specified parameters.
virtual void SLNet::MessageFilter::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

int SLNet::MessageFilter::autoAddNewConnectionsToFilter
protected

Definition at line 195 of file MessageFilter.h.

DataStructures::OrderedList<int, FilterSet*, FilterSetComp> SLNet::MessageFilter::filterList
protected

Definition at line 191 of file MessageFilter.h.

DataStructures::Hash<AddressOrGUID, FilteredSystem, 2048, AddressOrGUID::ToInteger> SLNet::MessageFilter::systemList
protected

Definition at line 193 of file MessageFilter.h.

SLNet::Time SLNet::MessageFilter::whenLastTimeoutCheck
protected

Definition at line 196 of file MessageFilter.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: NatPunchthrough

Classes
NatPunchthrough
Plugins

Connect systems despite both systems being behind a router. More...

Classes

struct | SLNet::PunchthroughConfiguration
struct | SLNet::NatPunchthroughDebugInterface
struct | SLNet::NatPunchthroughDebugInterface_Printf
struct | SLNet::NatPunchthroughDebugInterface_PacketLogger
class | SLNet::NatPunchthroughClient
Client code for NATPunchthrough. More...
struct | SLNet::NatPunchthroughServerDebugInterface
struct | SLNet::NatPunchthroughServerDebugInterface_Printf
struct | SLNet::NatPunchthroughServerDebugInterface_PacketLogger
class | SLNet::NatPunchthroughServer
Server code for NATPunchthrough. More...
class | SLNet::UDPForwarder
Forwards UDP datagrams. Independent of RakNet's protocol. More...
class | SLNet::UDPProxyCoordinator
Middleman between UDPProxyServer and UDPProxyClient, maintaining a list of UDPProxyServer, and managing state for clients to find an available forwarding server. More...
struct | SLNet::NatPunchthroughClient::AddrAndGuid
struct | SLNet::NatPunchthroughClient::DSTAndFac
struct | SLNet::NatPunchthroughClient::SendPing
struct | SLNet::NatPunchthroughServer::ConnectionAttempt
struct | SLNet::NatPunchthroughServer::User
struct | SLNet::UDPForwarder::ForwardEntry
struct | SLNet::UDPForwarder::StartForwardingInputStruct
struct | SLNet::UDPForwarder::StartForwardingOutputStruct
struct | SLNet::UDPForwarder::StopForwardingStruct
struct | SLNet::UDPProxyCoordinator::ForwardingRequest
struct | SLNet::UDPProxyCoordinator::SenderAndTargetAddress
struct | SLNet::UDPProxyCoordinator::ServerWithPing

Detailed Description

Connect systems despite both systems being behind a router.

Class Documentation

struct SLNet::PunchthroughConfiguration

Definition at line 53 of file NatPunchthroughClient.h.

Public Member Functions

PunchthroughConfiguration ()

Public Attributes

SLNet::Time TIME_BETWEEN_PUNCH_ATTEMPTS_INTERNAL
How much time between each UDP send.
SLNet::Time TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL
int | UDP_SENDS_PER_PORT_INTERNAL
How many tries for one port before giving up and going to the next port.
int | UDP_SENDS_PER_PORT_EXTERNAL
int | INTERNAL_IP_WAIT_AFTER_ATTEMPTS
After giving up on one internal port, how long to wait before trying the next port.
int | MAX_PREDICTIVE_PORT_RANGE
How many external ports to try past the last known starting port.
int | EXTERNAL_IP_WAIT_AFTER_FIRST_TTL
After sending TTL, how long to wait until first punch attempt.
int | EXTERNAL_IP_WAIT_BETWEEN_PORTS
After giving up on one external port, how long to wait before trying the next port.
int | EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS
After trying all external ports, how long to wait before returning ID_NAT_PUNCHTHROUGH_FAILED.
int | MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK
bool | retryOnFailure

Constructor & Destructor Documentation

SLNet::PunchthroughConfiguration::PunchthroughConfiguration ( )
inline

internal: (15 ms * 2 tries + 30 wait) * 5 ports * 8 players = 2.4 seconds external: (50 ms * 8 sends + 200 wait) * 2 port * 8 players = 9.6 seconds Total: 8 seconds

set to 0 to not do lan connects

Definition at line 58 of file NatPunchthroughClient.h.

Member Data Documentation

int SLNet::PunchthroughConfiguration::EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS

After trying all external ports, how long to wait before returning ID_NAT_PUNCHTHROUGH_FAILED.

Definition at line 93 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::EXTERNAL_IP_WAIT_AFTER_FIRST_TTL

After sending TTL, how long to wait until first punch attempt.

Definition at line 87 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::EXTERNAL_IP_WAIT_BETWEEN_PORTS

After giving up on one external port, how long to wait before trying the next port.

Definition at line 90 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::INTERNAL_IP_WAIT_AFTER_ATTEMPTS

After giving up on one internal port, how long to wait before trying the next port.

Definition at line 81 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::MAX_PREDICTIVE_PORT_RANGE

How many external ports to try past the last known starting port.

Definition at line 84 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK

Maximum number of internal IP address to try to connect to. Cannot be greater than MAXIMUM_NUMBER_OF_INTERNAL_IDS Should be high enough to try all internal IP addresses on the majority of computers

Definition at line 98 of file NatPunchthroughClient.h.

bool SLNet::PunchthroughConfiguration::retryOnFailure

If the first punchthrough attempt fails, try again This sometimes works because the remote router was looking for an incoming message on a higher numbered port before responding to a lower numbered port from the other system

Definition at line 102 of file NatPunchthroughClient.h.

SLNet::Time SLNet::PunchthroughConfiguration::TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL

Definition at line 74 of file NatPunchthroughClient.h.

SLNet::Time SLNet::PunchthroughConfiguration::TIME_BETWEEN_PUNCH_ATTEMPTS_INTERNAL

How much time between each UDP send.

Definition at line 73 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::UDP_SENDS_PER_PORT_EXTERNAL

Definition at line 78 of file NatPunchthroughClient.h.

int SLNet::PunchthroughConfiguration::UDP_SENDS_PER_PORT_INTERNAL

How many tries for one port before giving up and going to the next port.

Definition at line 77 of file NatPunchthroughClient.h.

struct SLNet::NatPunchthroughDebugInterface

Definition at line 106 of file NatPunchthroughClient.h.

+ Inheritance diagram for SLNet::NatPunchthroughDebugInterface:

Public Member Functions

NatPunchthroughDebugInterface ()
virtual | ~NatPunchthroughDebugInterface ()
virtual void | OnClientMessage (const char *msg)=0

Constructor & Destructor Documentation

SLNet::NatPunchthroughDebugInterface::NatPunchthroughDebugInterface ( )
inline

Definition at line 108 of file NatPunchthroughClient.h.

virtual SLNet::NatPunchthroughDebugInterface::~NatPunchthroughDebugInterface ( )
inlinevirtual

Definition at line 109 of file NatPunchthroughClient.h.

Member Function Documentation

virtual void SLNet::NatPunchthroughDebugInterface::OnClientMessage ( const char * msg )
pure virtual

Implemented in SLNet::NatPunchthroughDebugInterface_PacketLogger, and SLNet::NatPunchthroughDebugInterface_Printf.

struct SLNet::NatPunchthroughDebugInterface_Printf

Definition at line 114 of file NatPunchthroughClient.h.

+ Inheritance diagram for SLNet::NatPunchthroughDebugInterface_Printf:

Public Member Functions

virtual void | OnClientMessage (const char *msg)
- Public Member Functions inherited from SLNet::NatPunchthroughDebugInterface
NatPunchthroughDebugInterface ()
virtual | ~NatPunchthroughDebugInterface ()

Member Function Documentation

virtual void SLNet::NatPunchthroughDebugInterface_Printf::OnClientMessage ( const char * msg )
virtual

Implements SLNet::NatPunchthroughDebugInterface.

struct SLNet::NatPunchthroughDebugInterface_PacketLogger

Definition at line 121 of file NatPunchthroughClient.h.

+ Inheritance diagram for SLNet::NatPunchthroughDebugInterface_PacketLogger:

Public Member Functions

NatPunchthroughDebugInterface_PacketLogger ()
~NatPunchthroughDebugInterface_PacketLogger ()
virtual void | OnClientMessage (const char *msg)
- Public Member Functions inherited from SLNet::NatPunchthroughDebugInterface
NatPunchthroughDebugInterface ()
virtual | ~NatPunchthroughDebugInterface ()

Public Attributes

PacketLogger * pl

Constructor & Destructor Documentation

SLNet::NatPunchthroughDebugInterface_PacketLogger::NatPunchthroughDebugInterface_PacketLogger ( )
inline

Definition at line 126 of file NatPunchthroughClient.h.

SLNet::NatPunchthroughDebugInterface_PacketLogger::~NatPunchthroughDebugInterface_PacketLogger ( )
inline

Definition at line 127 of file NatPunchthroughClient.h.

Member Function Documentation

virtual void SLNet::NatPunchthroughDebugInterface_PacketLogger::OnClientMessage ( const char * msg )
virtual

Implements SLNet::NatPunchthroughDebugInterface.

Member Data Documentation

PacketLogger* SLNet::NatPunchthroughDebugInterface_PacketLogger::pl

Definition at line 124 of file NatPunchthroughClient.h.

class SLNet::NatPunchthroughClient

Client code for NATPunchthrough.

Maintain connection to NatPunchthroughServer to process incoming connection attempts through NatPunchthroughClient
Client will send datagrams to port to estimate next port
Will simultaneously connect with another client once ports are estimated.

See Also
NatTypeDetectionClient See also http://www.jenkinssoftware.com/raknet/manual/natpunchthrough.html

Definition at line 139 of file NatPunchthroughClient.h.

+ Inheritance diagram for SLNet::NatPunchthroughClient:

Public Member Functions

NatPunchthroughClient ()
~NatPunchthroughClient ()
void | FindRouterPortStride (const SystemAddress &facilitator)
bool | OpenNAT (RakNetGUID destination, const SystemAddress &facilitator)
PunchthroughConfiguration * | GetPunchthroughConfiguration (void)
void | SetDebugInterface (NatPunchthroughDebugInterface *i)
void | GetUPNPPortMappings (char *externalPort, char *internalPort, const SystemAddress &natPunchthroughServerAddress)
Get the port mappings you should pass to UPNP (for miniupnpc-1.6.20120410, for the function UPNP_AddPortMapping)
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
void | Clear (void)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Public Attributes

struct
SLNet::NatPunchthroughClient::SendPing 		sp

Protected Types

enum | { HAS_PORT_STRIDE, UNKNOWN_PORT_STRIDE, CALCULATING_PORT_STRIDE, INCAPABLE_PORT_STRIDE }

Protected Member Functions

void | OnFailureNotification (Packet *packet)
void | OnGetMostRecentPort (Packet *packet)
void | OnConnectAtTime (Packet *packet)
unsigned int | GetPendingOpenNATIndex (RakNetGUID destination, const SystemAddress &facilitator)
void | SendPunchthrough (RakNetGUID destination, const SystemAddress &facilitator)
void | QueueOpenNAT (RakNetGUID destination, const SystemAddress &facilitator)
void | SendQueuedOpenNAT (void)
void | SendTTL (const SystemAddress &sa)
void | SendOutOfBand (SystemAddress sa, MessageID oobId)
void | OnPunchthroughFailure (void)
void | OnReadyForNextPunchthrough (void)
void | PushFailure (void)
bool | RemoveFromFailureQueue (void)
void | PushSuccess (void)
void | IncrementExternalAttemptCount (SLNet::Time time, SLNet::Time delta)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

unsigned short | mostRecentExternalPort
PunchthroughConfiguration pc
NatPunchthroughDebugInterface * natPunchthroughDebugInterface
DataStructures::List< AddrAndGuid > failedAttemptList
DataStructures::Queue< DSTAndFac > queuedOpenNat
unsigned short | portStride
enum
SLNet::NatPunchthroughClient:: { ... } 		hasPortStride
SLNet::Time portStrideCalTimeout
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Member Enumeration Documentation

anonymous enum
protected
Enumerator:
HAS_PORT_STRIDE
UNKNOWN_PORT_STRIDE
CALCULATING_PORT_STRIDE
INCAPABLE_PORT_STRIDE

Definition at line 276 of file NatPunchthroughClient.h.

Constructor & Destructor Documentation

SLNet::NatPunchthroughClient::NatPunchthroughClient ( )
SLNet::NatPunchthroughClient::~NatPunchthroughClient ( )

Member Function Documentation

void SLNet::NatPunchthroughClient::Clear ( void )
void SLNet::NatPunchthroughClient::FindRouterPortStride ( const SystemAddress & facilitator )

If the instance of RakPeer running NATPunchthroughServer was bound to two IP addresses, then you can call FindRouterPortStride() This will determine the stride that your router uses when assigning ports, if your router is full-cone This function is also called automatically when you call OpenNAT - however, calling it earlier when you are connected to the facilitator will speed up the process

Parameters
[in] destination The system to punch. Must already be connected to facilitator
unsigned int SLNet::NatPunchthroughClient::GetPendingOpenNATIndex | ( | RakNetGUID | destination,
 |  | const SystemAddress & | facilitator
 | ) |  |
protected
PunchthroughConfiguration* SLNet::NatPunchthroughClient::GetPunchthroughConfiguration ( void )

Modify the system configuration if desired Don't modify the variables in the structure while punchthrough is in progress

void SLNet::NatPunchthroughClient::GetUPNPPortMappings | ( | char * | externalPort,
 |  | char * | internalPort,
 |  | const SystemAddress & | natPunchthroughServerAddress
 | ) |  |

Get the port mappings you should pass to UPNP (for miniupnpc-1.6.20120410, for the function UPNP_AddPortMapping)

void SLNet::NatPunchthroughClient::IncrementExternalAttemptCount | ( | SLNet::Time | time,
 |  | SLNet::Time | delta
 | ) |  |
protected
virtual void SLNet::NatPunchthroughClient::OnAttach ( void )
virtual

Called when the interface is attached.

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::NatPunchthroughClient::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatPunchthroughClient::OnConnectAtTime ( Packet * packet )
protected
virtual void SLNet::NatPunchthroughClient::OnDetach ( void )
virtual

Called when the interface is detached.

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatPunchthroughClient::OnFailureNotification ( Packet * packet )
protected
void SLNet::NatPunchthroughClient::OnGetMostRecentPort ( Packet * packet )
protected
virtual void SLNet::NatPunchthroughClient::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
virtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatPunchthroughClient::OnPunchthroughFailure ( void )
protected
virtual void SLNet::NatPunchthroughClient::OnRakPeerShutdown ( void )
virtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatPunchthroughClient::OnReadyForNextPunchthrough ( void )
protected
virtual PluginReceiveResult SLNet::NatPunchthroughClient::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

bool SLNet::NatPunchthroughClient::OpenNAT | ( | RakNetGUID | destination,
 |  | const SystemAddress & | facilitator
 | ) |  |

Punchthrough a NAT. Doesn't connect, just tries to setup the routing table

Parameters
[in] | destination | The system to punch. Must already be connected to facilitator
[in] | facilitator | A system we are already connected to running the NatPunchthroughServer plugin
See Also
OpenNATGroup() You will get ID_NAT_PUNCHTHROUGH_SUCCEEDED on success You will get ID_NAT_TARGET_NOT_CONNECTED, ID_NAT_TARGET_UNRESPONSIVE, ID_NAT_CONNECTION_TO_TARGET_LOST, ID_NAT_ALREADY_IN_PROGRESS, or ID_NAT_PUNCHTHROUGH_FAILED on failures of various types However, if you lose connection to the facilitator, you may not necessarily get above
void SLNet::NatPunchthroughClient::PushFailure ( void )
protected
void SLNet::NatPunchthroughClient::PushSuccess ( void )
protected
void SLNet::NatPunchthroughClient::QueueOpenNAT | ( | RakNetGUID | destination,
 |  | const SystemAddress & | facilitator
 | ) |  |
protected
bool SLNet::NatPunchthroughClient::RemoveFromFailureQueue ( void )
protected
void SLNet::NatPunchthroughClient::SendOutOfBand | ( | SystemAddress | sa,
 |  | MessageID | oobId
 | ) |  |
protected
void SLNet::NatPunchthroughClient::SendPunchthrough | ( | RakNetGUID | destination,
 |  | const SystemAddress & | facilitator
 | ) |  |
protected
void SLNet::NatPunchthroughClient::SendQueuedOpenNAT ( void )
protected
void SLNet::NatPunchthroughClient::SendTTL ( const SystemAddress & sa )
protected
void SLNet::NatPunchthroughClient::SetDebugInterface ( NatPunchthroughDebugInterface * i )

Sets a callback to be called with debug messages

Parameters
[in] i Pointer to an interface. The pointer is stored, so don't delete it while in progress. Pass 0 to clear.
virtual void SLNet::NatPunchthroughClient::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

DataStructures::List<AddrAndGuid> SLNet::NatPunchthroughClient::failedAttemptList
protected

Definition at line 265 of file NatPunchthroughClient.h.

enum { ... } SLNet::NatPunchthroughClient::hasPortStride
unsigned short SLNet::NatPunchthroughClient::mostRecentExternalPort
protected

Definition at line 237 of file NatPunchthroughClient.h.

NatPunchthroughDebugInterface* SLNet::NatPunchthroughClient::natPunchthroughDebugInterface
protected

Definition at line 256 of file NatPunchthroughClient.h.

PunchthroughConfiguration SLNet::NatPunchthroughClient::pc
protected

Definition at line 255 of file NatPunchthroughClient.h.

unsigned short SLNet::NatPunchthroughClient::portStride
protected

Definition at line 275 of file NatPunchthroughClient.h.

SLNet::Time SLNet::NatPunchthroughClient::portStrideCalTimeout
protected

Definition at line 283 of file NatPunchthroughClient.h.

DataStructures::Queue<DSTAndFac> SLNet::NatPunchthroughClient::queuedOpenNat
protected

Definition at line 272 of file NatPunchthroughClient.h.

struct SLNet::NatPunchthroughClient::SendPing SLNet::NatPunchthroughClient::sp
struct SLNet::NatPunchthroughServerDebugInterface

Definition at line 50 of file NatPunchthroughServer.h.

+ Inheritance diagram for SLNet::NatPunchthroughServerDebugInterface:

Public Member Functions

NatPunchthroughServerDebugInterface ()
virtual | ~NatPunchthroughServerDebugInterface ()
virtual void | OnServerMessage (const char *msg)=0

Constructor & Destructor Documentation

SLNet::NatPunchthroughServerDebugInterface::NatPunchthroughServerDebugInterface ( )
inline

Definition at line 52 of file NatPunchthroughServer.h.

virtual SLNet::NatPunchthroughServerDebugInterface::~NatPunchthroughServerDebugInterface ( )
inlinevirtual

Definition at line 53 of file NatPunchthroughServer.h.

Member Function Documentation

virtual void SLNet::NatPunchthroughServerDebugInterface::OnServerMessage ( const char * msg )
pure virtual

Implemented in SLNet::NatPunchthroughServerDebugInterface_PacketLogger, and SLNet::NatPunchthroughServerDebugInterface_Printf.

struct SLNet::NatPunchthroughServerDebugInterface_Printf

Definition at line 58 of file NatPunchthroughServer.h.

+ Inheritance diagram for SLNet::NatPunchthroughServerDebugInterface_Printf:

Public Member Functions

virtual void | OnServerMessage (const char *msg)
- Public Member Functions inherited from SLNet::NatPunchthroughServerDebugInterface
NatPunchthroughServerDebugInterface ()
virtual | ~NatPunchthroughServerDebugInterface ()

Member Function Documentation

virtual void SLNet::NatPunchthroughServerDebugInterface_Printf::OnServerMessage ( const char * msg )
virtual

Implements SLNet::NatPunchthroughServerDebugInterface.

struct SLNet::NatPunchthroughServerDebugInterface_PacketLogger

Definition at line 65 of file NatPunchthroughServer.h.

+ Inheritance diagram for SLNet::NatPunchthroughServerDebugInterface_PacketLogger:

Public Member Functions

NatPunchthroughServerDebugInterface_PacketLogger ()
~NatPunchthroughServerDebugInterface_PacketLogger ()
virtual void | OnServerMessage (const char *msg)
- Public Member Functions inherited from SLNet::NatPunchthroughServerDebugInterface
NatPunchthroughServerDebugInterface ()
virtual | ~NatPunchthroughServerDebugInterface ()

Public Attributes

PacketLogger * pl

Constructor & Destructor Documentation

SLNet::NatPunchthroughServerDebugInterface_PacketLogger::NatPunchthroughServerDebugInterface_PacketLogger ( )
inline

Definition at line 70 of file NatPunchthroughServer.h.

SLNet::NatPunchthroughServerDebugInterface_PacketLogger::~NatPunchthroughServerDebugInterface_PacketLogger ( )
inline

Definition at line 71 of file NatPunchthroughServer.h.

Member Function Documentation

virtual void SLNet::NatPunchthroughServerDebugInterface_PacketLogger::OnServerMessage ( const char * msg )
virtual

Implements SLNet::NatPunchthroughServerDebugInterface.

Member Data Documentation

PacketLogger* SLNet::NatPunchthroughServerDebugInterface_PacketLogger::pl

Definition at line 68 of file NatPunchthroughServer.h.

class SLNet::NatPunchthroughServer

Server code for NATPunchthrough.

Maintain connection to NatPunchthroughServer to process incoming connection attempts through NatPunchthroughClient
Server maintains two sockets clients can connect to so as to estimate the next port choice
Server tells other client about port estimate, current public port to the server, and a time to start connection attempts

See Also
NatTypeDetectionClient See also http://www.jenkinssoftware.com/raknet/manual/natpunchthrough.html

Definition at line 83 of file NatPunchthroughServer.h.

+ Inheritance diagram for SLNet::NatPunchthroughServer:

Public Member Functions

NatPunchthroughServer ()
virtual | ~NatPunchthroughServer ()
void | SetDebugInterface (NatPunchthroughServerDebugInterface *i)
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Static Public Member Functions

static int | NatPunchthroughUserComp (const RakNetGUID &key, User *const &data)

Public Attributes

SLNet::Time lastUpdate

Protected Member Functions

void | OnNATPunchthroughRequest (Packet *packet)
void | OnGetMostRecentPort (Packet *packet)
void | OnClientReady (Packet *packet)
void | SendTimestamps (void)
void | StartPendingPunchthrough (void)
void | StartPunchthroughForUser (User *user)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::OrderedList
< RakNetGUID, User
*, NatPunchthroughServer::NatPunchthroughUserComp > 		users
uint16_t sessionId
NatPunchthroughServerDebugInterface * natPunchthroughServerDebugInterface
SystemAddress boundAddresses [MAXIMUM_NUMBER_OF_INTERNAL_IDS]
unsigned char | boundAddressCount
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::NatPunchthroughServer::NatPunchthroughServer ( )
virtual SLNet::NatPunchthroughServer::~NatPunchthroughServer ( )
virtual

Member Function Documentation

static int SLNet::NatPunchthroughServer::NatPunchthroughUserComp | ( | const RakNetGUID & | key,
 |  | User *const & | data
 | ) |  |
static
void SLNet::NatPunchthroughServer::OnClientReady ( Packet * packet )
protected
virtual void SLNet::NatPunchthroughServer::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatPunchthroughServer::OnGetMostRecentPort ( Packet * packet )
protected
void SLNet::NatPunchthroughServer::OnNATPunchthroughRequest ( Packet * packet )
protected
virtual void SLNet::NatPunchthroughServer::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
virtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::NatPunchthroughServer::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatPunchthroughServer::SendTimestamps ( void )
protected
void SLNet::NatPunchthroughServer::SetDebugInterface ( NatPunchthroughServerDebugInterface * i )

Sets a callback to be called with debug messages

Parameters
[in] i Pointer to an interface. The pointer is stored, so don't delete it while in progress. Pass 0 to clear.
void SLNet::NatPunchthroughServer::StartPendingPunchthrough ( void )
protected
void SLNet::NatPunchthroughServer::StartPunchthroughForUser ( User * user )
protected
virtual void SLNet::NatPunchthroughServer::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

unsigned char SLNet::NatPunchthroughServer::boundAddressCount
protected

Definition at line 153 of file NatPunchthroughServer.h.

SystemAddress SLNet::NatPunchthroughServer::boundAddresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS]
protected

Definition at line 152 of file NatPunchthroughServer.h.

SLNet::Time SLNet::NatPunchthroughServer::lastUpdate

Definition at line 137 of file NatPunchthroughServer.h.

NatPunchthroughServerDebugInterface* SLNet::NatPunchthroughServer::natPunchthroughServerDebugInterface
protected

Definition at line 150 of file NatPunchthroughServer.h.

uint16_t SLNet::NatPunchthroughServer::sessionId
protected

Definition at line 149 of file NatPunchthroughServer.h.

DataStructures::OrderedList<RakNetGUID, User*, NatPunchthroughServer::NatPunchthroughUserComp> SLNet::NatPunchthroughServer::users
protected

Definition at line 141 of file NatPunchthroughServer.h.

class SLNet::UDPForwarder

Forwards UDP datagrams. Independent of RakNet's protocol.

Definition at line 56 of file UDPForwarder.h.

Public Member Functions

UDPForwarder ()
virtual | ~UDPForwarder ()
void | Startup (void)
void | Shutdown (void)
Stops the system, and frees all sockets.
void | SetMaxForwardEntries (unsigned short maxEntries)
int | GetMaxForwardEntries (void) const
int | GetUsedForwardEntries (void) const
UDPForwarderResult | StartForwarding (SystemAddress source, SystemAddress destination, SLNet::TimeMS timeoutOnNoDataMS, const char *forceHostAddress, unsigned short socketFamily, unsigned short *forwardingPort, __UDPSOCKET__ *forwardingSocket)
void | StopForwarding (SystemAddress source, SystemAddress destination)

Protected Member Functions

friend | RAK_THREAD_DECLARATION (UpdateUDPForwarderGlobal)
void | UpdateUDPForwarder (void)
void | RecvFrom (SLNet::TimeMS curTime, ForwardEntry *forwardEntry)

Protected Attributes

DataStructures::ThreadsafeAllocatingQueue
< StartForwardingInputStruct > 		startForwardingInput
DataStructures::Queue
< StartForwardingOutputStruct > 		startForwardingOutput
SimpleMutex startForwardingOutputMutex
DataStructures::ThreadsafeAllocatingQueue
< StopForwardingStruct > 		stopForwardingCommands
unsigned int | nextInputId
DataStructures::List
< ForwardEntry * > 		forwardListNotUpdated
unsigned short | maxForwardEntries
SLNet::LocklessUint32_t isRunning
SLNet::LocklessUint32_t threadRunning

Constructor & Destructor Documentation

SLNet::UDPForwarder::UDPForwarder ( )
virtual SLNet::UDPForwarder::~UDPForwarder ( )
virtual

Member Function Documentation

int SLNet::UDPForwarder::GetMaxForwardEntries ( void ) const
Returns
The maxEntries parameter passed to SetMaxForwardEntries(), or the default if it was never called
int SLNet::UDPForwarder::GetUsedForwardEntries ( void ) const
Returns
How many entries have been used
SLNet::UDPForwarder::RAK_THREAD_DECLARATION ( UpdateUDPForwarderGlobal )
protected
void SLNet::UDPForwarder::RecvFrom | ( | SLNet::TimeMS | curTime,
 |  | ForwardEntry * | forwardEntry
 | ) |  |
protected
void SLNet::UDPForwarder::SetMaxForwardEntries ( unsigned short maxEntries )

Sets the maximum number of forwarding entries allowed Set according to your available bandwidth and the estimated average bandwidth per forwarded address.

Parameters
[in] maxEntries The maximum number of simultaneous forwarding entries. Defaults to 64 (32 connections)
void SLNet::UDPForwarder::Shutdown ( void )

Stops the system, and frees all sockets.

UDPForwarderResult SLNet::UDPForwarder::StartForwarding | ( | SystemAddress | source,
 |  | SystemAddress | destination,
 |  | SLNet::TimeMS | timeoutOnNoDataMS,
 |  | const char * | forceHostAddress,
 |  | unsigned short | socketFamily,
 |  | unsigned short * | forwardingPort,
 |  | __UDPSOCKET__ * | forwardingSocket
 | ) |  |

Forwards datagrams from source to destination, and vice-versa Does nothing if this forward entry already exists via a previous call

Precondition
Call Startup()
Note
RakNet's protocol will ensure a message is sent at least every 15 seconds, so if routing RakNet messages, it is a reasonable value for timeoutOnNoDataMS, plus an some extra seconds for latency
Parameters
[in] | source | The source IP and port
[in] | destination | Where to forward to (and vice-versa)
[in] | timeoutOnNoDataMS | If no messages are forwarded for this many MS, then automatically remove this entry.
[in] | forceHostAddress | Force binding on a particular address. 0 to use any.
[in] | socketFamily | IP version: For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC.
[out] | forwardingPort | New opened port for forwarding
[out] | forwardingSocket | New opened socket for forwarding
Returns
UDPForwarderResult
void SLNet::UDPForwarder::Startup ( void )

Starts the system. Required to call before StartForwarding

void SLNet::UDPForwarder::StopForwarding | ( | SystemAddress | source,
 |  | SystemAddress | destination
 | ) |  |

No longer forward datagrams from source to destination

Parameters
[in] | source | The source IP and port
[in] | destination | Where to forward to
void SLNet::UDPForwarder::UpdateUDPForwarder ( void )
protected

Member Data Documentation

DataStructures::List<ForwardEntry*> SLNet::UDPForwarder::forwardListNotUpdated
protected

Definition at line 152 of file UDPForwarder.h.

SLNet::LocklessUint32_t SLNet::UDPForwarder::isRunning
protected

Definition at line 156 of file UDPForwarder.h.

unsigned short SLNet::UDPForwarder::maxForwardEntries
protected

Definition at line 155 of file UDPForwarder.h.

unsigned int SLNet::UDPForwarder::nextInputId
protected

Definition at line 149 of file UDPForwarder.h.

DataStructures::ThreadsafeAllocatingQueue<StartForwardingInputStruct> SLNet::UDPForwarder::startForwardingInput
protected

Definition at line 131 of file UDPForwarder.h.

DataStructures::Queue<StartForwardingOutputStruct> SLNet::UDPForwarder::startForwardingOutput
protected

Definition at line 140 of file UDPForwarder.h.

SimpleMutex SLNet::UDPForwarder::startForwardingOutputMutex
protected

Definition at line 141 of file UDPForwarder.h.

DataStructures::ThreadsafeAllocatingQueue<StopForwardingStruct> SLNet::UDPForwarder::stopForwardingCommands
protected

Definition at line 148 of file UDPForwarder.h.

SLNet::LocklessUint32_t SLNet::UDPForwarder::threadRunning
protected

Definition at line 156 of file UDPForwarder.h.

class SLNet::UDPProxyCoordinator

Middleman between UDPProxyServer and UDPProxyClient, maintaining a list of UDPProxyServer, and managing state for clients to find an available forwarding server.

When NAT Punchthrough fails, it is possible to use a non-NAT system to forward messages from us to the recipient, and vice-versa The class to forward messages is UDPForwarder, and it is triggered over the network via the UDPProxyServer plugin. The UDPProxyClient connects to UDPProxyCoordinator to get a list of servers running UDPProxyServer, and the coordinator will relay our forwarding request

Definition at line 42 of file UDPProxyCoordinator.h.

+ Inheritance diagram for SLNet::UDPProxyCoordinator:

Public Member Functions

UDPProxyCoordinator ()
virtual | ~UDPProxyCoordinator ()
void | SetRemoteLoginPassword (SLNet::RakString password)
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

void | OnForwardingRequestFromClientToCoordinator (Packet *packet)
void | OnLoginRequestFromServerToCoordinator (Packet *packet)
void | OnForwardingReplyFromServerToCoordinator (Packet *packet)
void | OnPingServersReplyFromClientToCoordinator (Packet *packet)
void | TryNextServer (SenderAndTargetAddress sata, ForwardingRequest *fw)
void | SendAllBusy (SystemAddress senderClientAddress, SystemAddress targetClientAddress, RakNetGUID targetClientGuid, SystemAddress requestingAddress)
void | Clear (void)
void | SendForwardingRequest (SystemAddress sourceAddress, SystemAddress targetAddress, SystemAddress serverAddress, SLNet::TimeMS timeoutOnNoDataMS)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Static Protected Member Functions

static int | ServerWithPingComp (const unsigned short &key, const UDPProxyCoordinator::ServerWithPing &data)
static int | ForwardingRequestComp (const SenderAndTargetAddress &key, ForwardingRequest *const &data)

Protected Attributes

DataStructures::List
< SystemAddress > 		serverList
DataStructures::OrderedList
< SenderAndTargetAddress,
ForwardingRequest
*, ForwardingRequestComp > 		forwardingRequestList
SLNet::RakString remoteLoginPassword
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::UDPProxyCoordinator::UDPProxyCoordinator ( )
virtual SLNet::UDPProxyCoordinator::~UDPProxyCoordinator ( )
virtual

Member Function Documentation

void SLNet::UDPProxyCoordinator::Clear ( void )
protected
static int SLNet::UDPProxyCoordinator::ForwardingRequestComp | ( | const SenderAndTargetAddress & | key,
 |  | ForwardingRequest *const & | data
 | ) |  |
staticprotected
virtual void SLNet::UDPProxyCoordinator::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

void SLNet::UDPProxyCoordinator::OnForwardingReplyFromServerToCoordinator ( Packet * packet )
protected
void SLNet::UDPProxyCoordinator::OnForwardingRequestFromClientToCoordinator ( Packet * packet )
protected
void SLNet::UDPProxyCoordinator::OnLoginRequestFromServerToCoordinator ( Packet * packet )
protected
void SLNet::UDPProxyCoordinator::OnPingServersReplyFromClientToCoordinator ( Packet * packet )
protected
virtual PluginReceiveResult SLNet::UDPProxyCoordinator::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::UDPProxyCoordinator::SendAllBusy | ( | SystemAddress | senderClientAddress,
 |  | SystemAddress | targetClientAddress,
 |  | RakNetGUID | targetClientGuid,
 |  | SystemAddress | requestingAddress
 | ) |  |
protected
void SLNet::UDPProxyCoordinator::SendForwardingRequest | ( | SystemAddress | sourceAddress,
 |  | SystemAddress | targetAddress,
 |  | SystemAddress | serverAddress,
 |  | SLNet::TimeMS | timeoutOnNoDataMS
 | ) |  |
protected
static int SLNet::UDPProxyCoordinator::ServerWithPingComp | ( | const unsigned short & | key,
 |  | const UDPProxyCoordinator::ServerWithPing & | data
 | ) |  |
staticprotected
void SLNet::UDPProxyCoordinator::SetRemoteLoginPassword ( SLNet::RakString password )

For UDPProxyServers logging in remotely, they must pass a password to UDPProxyServer::LoginToCoordinator(). It must match the password set here. If no password is set, they cannot login remotely. By default, no password is set

void SLNet::UDPProxyCoordinator::TryNextServer | ( | SenderAndTargetAddress | sata,
 |  | ForwardingRequest * | fw
 | ) |  |
protected
virtual void SLNet::UDPProxyCoordinator::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

DataStructures::OrderedList<SenderAndTargetAddress, ForwardingRequest*, ForwardingRequestComp> SLNet::UDPProxyCoordinator::forwardingRequestList
protected

Definition at line 112 of file UDPProxyCoordinator.h.

SLNet::RakString SLNet::UDPProxyCoordinator::remoteLoginPassword
protected

Definition at line 114 of file UDPProxyCoordinator.h.

DataStructures::List<SystemAddress> SLNet::UDPProxyCoordinator::serverList
protected

Definition at line 108 of file UDPProxyCoordinator.h.

struct SLNet::NatPunchthroughClient::AddrAndGuid

Definition at line 260 of file NatPunchthroughClient.h.

Class Members
SystemAddress | addr
RakNetGUID | guid
struct SLNet::NatPunchthroughClient::DSTAndFac

Definition at line 267 of file NatPunchthroughClient.h.

Class Members
RakNetGUID | destination
SystemAddress | facilitator
struct SLNet::NatPunchthroughClient::SendPing

Definition at line 203 of file NatPunchthroughClient.h.

Public Types

enum TestMode {
TESTING_INTERNAL_IPS, WAITING_FOR_INTERNAL_IPS_RESPONSE, TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT, TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT,
TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024, TESTING_EXTERNAL_IPS_1024_TO_1024, WAITING_AFTER_ALL_ATTEMPTS, PUNCHING_FIXED_PORT
}

Public Attributes

SLNet::Time nextActionTime
SystemAddress targetAddress
SystemAddress facilitator
SystemAddress internalIds [MAXIMUM_NUMBER_OF_INTERNAL_IDS]
RakNetGUID targetGuid
bool | weAreSender
int | attemptCount
int | retryCount
int | punchingFixedPortAttempts
uint16_t sessionId
bool | sentTTL
enum
SLNet::NatPunchthroughClient::SendPing::TestMode 		testMode

Member Enumeration Documentation

enum SLNet::NatPunchthroughClient::SendPing::TestMode
Enumerator:
TESTING_INTERNAL_IPS
WAITING_FOR_INTERNAL_IPS_RESPONSE
TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT
TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT
TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024
TESTING_EXTERNAL_IPS_1024_TO_1024
WAITING_AFTER_ALL_ATTEMPTS
PUNCHING_FIXED_PORT

Definition at line 217 of file NatPunchthroughClient.h.

Member Data Documentation

int SLNet::NatPunchthroughClient::SendPing::attemptCount

Definition at line 211 of file NatPunchthroughClient.h.

SystemAddress SLNet::NatPunchthroughClient::SendPing::facilitator

Definition at line 207 of file NatPunchthroughClient.h.

SystemAddress SLNet::NatPunchthroughClient::SendPing::internalIds[MAXIMUM_NUMBER_OF_INTERNAL_IDS]

Definition at line 208 of file NatPunchthroughClient.h.

SLNet::Time SLNet::NatPunchthroughClient::SendPing::nextActionTime

Definition at line 205 of file NatPunchthroughClient.h.

int SLNet::NatPunchthroughClient::SendPing::punchingFixedPortAttempts

Definition at line 213 of file NatPunchthroughClient.h.

int SLNet::NatPunchthroughClient::SendPing::retryCount

Definition at line 212 of file NatPunchthroughClient.h.

bool SLNet::NatPunchthroughClient::SendPing::sentTTL

Definition at line 215 of file NatPunchthroughClient.h.

uint16_t SLNet::NatPunchthroughClient::SendPing::sessionId

Definition at line 214 of file NatPunchthroughClient.h.

SystemAddress SLNet::NatPunchthroughClient::SendPing::targetAddress

Definition at line 206 of file NatPunchthroughClient.h.

RakNetGUID SLNet::NatPunchthroughClient::SendPing::targetGuid

Definition at line 209 of file NatPunchthroughClient.h.

enum SLNet::NatPunchthroughClient::SendPing::TestMode SLNet::NatPunchthroughClient::SendPing::testMode
bool SLNet::NatPunchthroughClient::SendPing::weAreSender

Definition at line 210 of file NatPunchthroughClient.h.

struct SLNet::NatPunchthroughServer::ConnectionAttempt

Definition at line 111 of file NatPunchthroughServer.h.

Public Types

enum { NAT_ATTEMPT_PHASE_NOT_STARTED, NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS }

Public Member Functions

ConnectionAttempt ()

Public Attributes

User * sender
User * recipient
uint16_t sessionId
SLNet::Time startTime
enum
SLNet::NatPunchthroughServer::ConnectionAttempt:: { ... } 		attemptPhase

Member Enumeration Documentation

anonymous enum
Enumerator:
NAT_ATTEMPT_PHASE_NOT_STARTED
NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS

Definition at line 117 of file NatPunchthroughServer.h.

Constructor & Destructor Documentation

SLNet::NatPunchthroughServer::ConnectionAttempt::ConnectionAttempt ( )
inline

Definition at line 113 of file NatPunchthroughServer.h.

Member Data Documentation

enum { ... } SLNet::NatPunchthroughServer::ConnectionAttempt::attemptPhase
User * SLNet::NatPunchthroughServer::ConnectionAttempt::recipient

Definition at line 114 of file NatPunchthroughServer.h.

User* SLNet::NatPunchthroughServer::ConnectionAttempt::sender

Definition at line 114 of file NatPunchthroughServer.h.

uint16_t SLNet::NatPunchthroughServer::ConnectionAttempt::sessionId

Definition at line 115 of file NatPunchthroughServer.h.

SLNet::Time SLNet::NatPunchthroughServer::ConnectionAttempt::startTime

Definition at line 116 of file NatPunchthroughServer.h.

struct SLNet::NatPunchthroughServer::User

Definition at line 123 of file NatPunchthroughServer.h.

Public Member Functions

bool | HasConnectionAttemptToUser (User *user)
void | DerefConnectionAttempt (ConnectionAttempt *ca)
void | DeleteConnectionAttempt (ConnectionAttempt *ca)
void | LogConnectionAttempts (SLNet::RakString &rs)

Public Attributes

RakNetGUID guid
SystemAddress systemAddress
unsigned short | mostRecentPort
bool | isReady
DataStructures::OrderedList
< RakNetGUID, RakNetGUID > 		groupPunchthroughRequests
DataStructures::List
< ConnectionAttempt * > 		connectionAttempts

Member Function Documentation

void SLNet::NatPunchthroughServer::User::DeleteConnectionAttempt ( ConnectionAttempt * ca )
void SLNet::NatPunchthroughServer::User::DerefConnectionAttempt ( ConnectionAttempt * ca )
bool SLNet::NatPunchthroughServer::User::HasConnectionAttemptToUser ( User * user )
void SLNet::NatPunchthroughServer::User::LogConnectionAttempts ( SLNet::RakString & rs )

Member Data Documentation

DataStructures::List<ConnectionAttempt *> SLNet::NatPunchthroughServer::User::connectionAttempts

Definition at line 131 of file NatPunchthroughServer.h.

DataStructures::OrderedList<RakNetGUID,RakNetGUID> SLNet::NatPunchthroughServer::User::groupPunchthroughRequests

Definition at line 129 of file NatPunchthroughServer.h.

RakNetGUID SLNet::NatPunchthroughServer::User::guid

Definition at line 125 of file NatPunchthroughServer.h.

bool SLNet::NatPunchthroughServer::User::isReady

Definition at line 128 of file NatPunchthroughServer.h.

unsigned short SLNet::NatPunchthroughServer::User::mostRecentPort

Definition at line 127 of file NatPunchthroughServer.h.

SystemAddress SLNet::NatPunchthroughServer::User::systemAddress

Definition at line 126 of file NatPunchthroughServer.h.

struct SLNet::UDPForwarder::ForwardEntry

Definition at line 103 of file UDPForwarder.h.

Public Member Functions

ForwardEntry ()
~ForwardEntry ()

Public Attributes

SystemAddress addr1Unconfirmed
SystemAddress addr2Unconfirmed
SystemAddress addr1Confirmed
SystemAddress addr2Confirmed
SLNet::TimeMS timeLastDatagramForwarded
__UDPSOCKET__ socket
SLNet::TimeMS timeoutOnNoDataMS
short socketFamily

Constructor & Destructor Documentation

SLNet::UDPForwarder::ForwardEntry::ForwardEntry ( )
SLNet::UDPForwarder::ForwardEntry::~ForwardEntry ( )

Member Data Documentation

SystemAddress SLNet::UDPForwarder::ForwardEntry::addr1Confirmed

Definition at line 107 of file UDPForwarder.h.

SystemAddress SLNet::UDPForwarder::ForwardEntry::addr1Unconfirmed

Definition at line 107 of file UDPForwarder.h.

SystemAddress SLNet::UDPForwarder::ForwardEntry::addr2Confirmed

Definition at line 107 of file UDPForwarder.h.

SystemAddress SLNet::UDPForwarder::ForwardEntry::addr2Unconfirmed

Definition at line 107 of file UDPForwarder.h.

__UDPSOCKET__ SLNet::UDPForwarder::ForwardEntry::socket

Definition at line 109 of file UDPForwarder.h.

short SLNet::UDPForwarder::ForwardEntry::socketFamily

Definition at line 111 of file UDPForwarder.h.

SLNet::TimeMS SLNet::UDPForwarder::ForwardEntry::timeLastDatagramForwarded

Definition at line 108 of file UDPForwarder.h.

SLNet::TimeMS SLNet::UDPForwarder::ForwardEntry::timeoutOnNoDataMS

Definition at line 110 of file UDPForwarder.h.

struct SLNet::UDPForwarder::StartForwardingInputStruct

Definition at line 121 of file UDPForwarder.h.

Class Members
SystemAddress | destination
RakString | forceHostAddress
unsigned int | inputId
unsigned short | socketFamily
SystemAddress | source
TimeMS | timeoutOnNoDataMS
struct SLNet::UDPForwarder::StartForwardingOutputStruct

Definition at line 133 of file UDPForwarder.h.

Class Members
unsigned short | forwardingPort
__UDPSOCKET__ | forwardingSocket
unsigned int | inputId
UDPForwarderResult | result
struct SLNet::UDPForwarder::StopForwardingStruct

Definition at line 143 of file UDPForwarder.h.

Class Members
SystemAddress | destination
SystemAddress | source
struct SLNet::UDPProxyCoordinator::ForwardingRequest

Definition at line 75 of file UDPProxyCoordinator.h.

Public Member Functions

void OrderRemainingServersToTry (void)

Public Attributes

SLNet::TimeMS timeoutOnNoDataMS
SLNet::TimeMS timeoutAfterSuccess
SenderAndTargetAddress sata
SystemAddress requestingAddress
SystemAddress currentlyAttemptedServerAddress
DataStructures::Queue
< SystemAddress > 		remainingServersToTry
SLNet::BitStream serverSelectionBitstream
DataStructures::List
< ServerWithPing > 		sourceServerPings
DataStructures::List
< ServerWithPing > 		targetServerPings
SLNet::TimeMS timeRequestedPings

Member Function Documentation

void SLNet::UDPProxyCoordinator::ForwardingRequest::OrderRemainingServersToTry ( void )

Member Data Documentation

SystemAddress SLNet::UDPProxyCoordinator::ForwardingRequest::currentlyAttemptedServerAddress

Definition at line 81 of file UDPProxyCoordinator.h.

DataStructures::Queue<SystemAddress> SLNet::UDPProxyCoordinator::ForwardingRequest::remainingServersToTry

Definition at line 82 of file UDPProxyCoordinator.h.

SystemAddress SLNet::UDPProxyCoordinator::ForwardingRequest::requestingAddress

Definition at line 80 of file UDPProxyCoordinator.h.

SenderAndTargetAddress SLNet::UDPProxyCoordinator::ForwardingRequest::sata

Definition at line 79 of file UDPProxyCoordinator.h.

SLNet::BitStream SLNet::UDPProxyCoordinator::ForwardingRequest::serverSelectionBitstream

Definition at line 83 of file UDPProxyCoordinator.h.

DataStructures::List<ServerWithPing> SLNet::UDPProxyCoordinator::ForwardingRequest::sourceServerPings

Definition at line 85 of file UDPProxyCoordinator.h.

DataStructures::List<ServerWithPing> SLNet::UDPProxyCoordinator::ForwardingRequest::targetServerPings

Definition at line 85 of file UDPProxyCoordinator.h.

SLNet::TimeMS SLNet::UDPProxyCoordinator::ForwardingRequest::timeoutAfterSuccess

Definition at line 78 of file UDPProxyCoordinator.h.

SLNet::TimeMS SLNet::UDPProxyCoordinator::ForwardingRequest::timeoutOnNoDataMS

Definition at line 77 of file UDPProxyCoordinator.h.

SLNet::TimeMS SLNet::UDPProxyCoordinator::ForwardingRequest::timeRequestedPings

Definition at line 86 of file UDPProxyCoordinator.h.

struct SLNet::UDPProxyCoordinator::SenderAndTargetAddress

Definition at line 61 of file UDPProxyCoordinator.h.

Class Members
SystemAddress | senderClientAddress
RakNetGUID | senderClientGuid
SystemAddress | targetClientAddress
RakNetGUID | targetClientGuid
struct SLNet::UDPProxyCoordinator::ServerWithPing

Definition at line 69 of file UDPProxyCoordinator.h.

Class Members
unsigned short | ping
SystemAddress | serverAddress
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: NatTypeDetection

Classes
NatTypeDetection
Plugins

Use a remote server with multiple IP addresses to determine what type of NAT your router is using. More...

Classes

class | SLNet::NatTypeDetectionClient
Client code for NatTypeDetection. More...
class | SLNet::NatTypeDetectionServer
Server code for NatTypeDetection. More...
struct | SLNet::NatTypeDetectionServer::NATDetectionAttempt

Detailed Description

Use a remote server with multiple IP addresses to determine what type of NAT your router is using.

Class Documentation

class SLNet::NatTypeDetectionClient

Client code for NatTypeDetection.

See NatTypeDetectionServer.h for algorithm To use, just connect to the server, and call DetectNAT You will get back ID_NAT_TYPE_DETECTION_RESULT with one of the enumerated values of NATTypeDetectionResult found in NATTypeDetectionCommon.h See also http://www.jenkinssoftware.com/raknet/manual/natpunchthrough.html

See Also
NatPunchthroughClient
NatTypeDetectionServer

Definition at line 50 of file NatTypeDetectionClient.h.

+ Inheritance diagram for SLNet::NatTypeDetectionClient:

Public Member Functions

NatTypeDetectionClient ()
virtual | ~NatTypeDetectionClient ()
void | DetectNATType (SystemAddress _serverAddress)
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRNS2Recv (RNS2RecvStruct *recvStruct)
virtual void | DeallocRNS2RecvStruct (RNS2RecvStruct *s, const char *file, unsigned int line)
virtual RNS2RecvStruct * | AllocRNS2RecvStruct (const char *file, unsigned int line)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)
- Public Member Functions inherited from SLNet::RNS2EventHandler
RNS2EventHandler ()
virtual | ~RNS2EventHandler ()

Protected Member Functions

void | Shutdown (void)
void | OnCompletion (NATTypeDetectionResult result)
bool | IsInProgress (void) const
void | OnTestPortRestricted (Packet *packet)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::Queue
< RNS2RecvStruct * > 		bufferedPackets
SimpleMutex bufferedPacketsMutex
RakNetSocket2 * c2
SystemAddress serverAddress
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::NatTypeDetectionClient::NatTypeDetectionClient ( )
virtual SLNet::NatTypeDetectionClient::~NatTypeDetectionClient ( )
virtual

Member Function Documentation

virtual RNS2RecvStruct* SLNet::NatTypeDetectionClient::AllocRNS2RecvStruct | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |
virtual

Implements SLNet::RNS2EventHandler.

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

Implements SLNet::RNS2EventHandler.

void SLNet::NatTypeDetectionClient::DetectNATType ( SystemAddress _serverAddress )

Send the message to the server to detect the nat type Server must be running NatTypeDetectionServer We must already be connected to the server

Parameters
[in] serverAddress address of the server
bool SLNet::NatTypeDetectionClient::IsInProgress ( void ) const
protected
virtual void SLNet::NatTypeDetectionClient::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatTypeDetectionClient::OnCompletion ( NATTypeDetectionResult result )
protected
virtual void SLNet::NatTypeDetectionClient::OnDetach ( void )
virtual

Called when the interface is detached.

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::NatTypeDetectionClient::OnRakPeerShutdown ( void )
virtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::NatTypeDetectionClient::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::NatTypeDetectionClient::OnRNS2Recv ( RNS2RecvStruct * recvStruct )
virtual

Implements SLNet::RNS2EventHandler.

void SLNet::NatTypeDetectionClient::OnTestPortRestricted ( Packet * packet )
protected
void SLNet::NatTypeDetectionClient::Shutdown ( void )
protected
virtual void SLNet::NatTypeDetectionClient::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

DataStructures::Queue<RNS2RecvStruct*> SLNet::NatTypeDetectionClient::bufferedPackets
protected

Definition at line 83 of file NatTypeDetectionClient.h.

SimpleMutex SLNet::NatTypeDetectionClient::bufferedPacketsMutex
protected

Definition at line 84 of file NatTypeDetectionClient.h.

RakNetSocket2* SLNet::NatTypeDetectionClient::c2
protected

Definition at line 86 of file NatTypeDetectionClient.h.

SystemAddress SLNet::NatTypeDetectionClient::serverAddress
protected

Definition at line 93 of file NatTypeDetectionClient.h.

class SLNet::NatTypeDetectionServer

Server code for NatTypeDetection.

Sends to a remote system on certain ports and addresses to determine what type of router, if any, that client is behind Requires that the server have 4 external IP addresses

  1. Server has 1 instance of RakNet. Server has four external ip addresses S1 to S4. Five ports are used in total P1 to P5. RakNet is bound to S1P1. Sockets are bound to S1P2, S2P3, S3P4, S4P5
  2. Client with one port using RakNet (C1). Another port not using anything (C2).
  3. C1 connects to S1P1 for normal communication.
  4. S4P5 sends to C2. If arrived, no NAT. Done. (If didn't arrive, S4P5 potentially banned, do not use again).
  5. S2P3 sends to C1 (Different address, different port, to previously used port on client). If received, Full-cone nat. Done. (If didn't arrive, S2P3 potentially banned, do not use again).
  6. S1P2 sends to C1 (Same address, different port, to previously used port on client). If received, address-restricted cone nat. Done.
  7. Server via RakNet connection tells C1 to send to to S3P4. If address of C1 as seen by S3P4 is the same as the address of C1 as seen by S1P1 (RakNet connection), then port-restricted cone nat. Done
  8. Else symmetric nat. Done.

See also http://www.jenkinssoftware.com/raknet/manual/natpunchthrough.html

See Also
NatPunchthroughServer
NatTypeDetectionClient

Definition at line 60 of file NatTypeDetectionServer.h.

+ Inheritance diagram for SLNet::NatTypeDetectionServer:

Public Types

enum NATDetectionState {
STATE_NONE, STATE_TESTING_NONE_1, STATE_TESTING_NONE_2, STATE_TESTING_FULL_CONE_1,
STATE_TESTING_FULL_CONE_2, STATE_TESTING_ADDRESS_RESTRICTED_1, STATE_TESTING_ADDRESS_RESTRICTED_2, STATE_TESTING_PORT_RESTRICTED_1,
STATE_TESTING_PORT_RESTRICTED_2, STATE_DONE
}

Public Member Functions

NatTypeDetectionServer ()
virtual | ~NatTypeDetectionServer ()
void | Startup (const char *nonRakNetIP2, const char *nonRakNetIP3, const char *nonRakNetIP4)
void | Shutdown (void)
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnRNS2Recv (RNS2RecvStruct *recvStruct)
virtual void | DeallocRNS2RecvStruct (RNS2RecvStruct *s, const char *file, unsigned int line)
virtual RNS2RecvStruct * | AllocRNS2RecvStruct (const char *file, unsigned int line)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)
- Public Member Functions inherited from SLNet::RNS2EventHandler
RNS2EventHandler ()
virtual | ~RNS2EventHandler ()

Protected Member Functions

void | OnDetectionRequest (Packet *packet)
unsigned int | GetDetectionAttemptIndex (const SystemAddress &sa)
unsigned int | GetDetectionAttemptIndex (RakNetGUID guid)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::Queue
< RNS2RecvStruct * > 		bufferedPackets
SimpleMutex bufferedPacketsMutex
DataStructures::List
< NATDetectionAttempt > 		natDetectionAttempts
RakNetSocket2 * s1p2
RakNetSocket2 * s2p3
RakNetSocket2 * s3p4
RakNetSocket2 * s4p5
char | s3p4Address [64]
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Member Enumeration Documentation

enum SLNet::NatTypeDetectionServer::NATDetectionState
Enumerator:
STATE_NONE
STATE_TESTING_NONE_1
STATE_TESTING_NONE_2
STATE_TESTING_FULL_CONE_1
STATE_TESTING_FULL_CONE_2
STATE_TESTING_ADDRESS_RESTRICTED_1
STATE_TESTING_ADDRESS_RESTRICTED_2
STATE_TESTING_PORT_RESTRICTED_1
STATE_TESTING_PORT_RESTRICTED_2
STATE_DONE

Definition at line 96 of file NatTypeDetectionServer.h.

Constructor & Destructor Documentation

SLNet::NatTypeDetectionServer::NatTypeDetectionServer ( )
virtual SLNet::NatTypeDetectionServer::~NatTypeDetectionServer ( )
virtual

Member Function Documentation

virtual RNS2RecvStruct* SLNet::NatTypeDetectionServer::AllocRNS2RecvStruct | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |
virtual

Implements SLNet::RNS2EventHandler.

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

Implements SLNet::RNS2EventHandler.

unsigned int SLNet::NatTypeDetectionServer::GetDetectionAttemptIndex ( const SystemAddress & sa )
protected
unsigned int SLNet::NatTypeDetectionServer::GetDetectionAttemptIndex ( RakNetGUID guid )
protected
virtual void SLNet::NatTypeDetectionServer::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

void SLNet::NatTypeDetectionServer::OnDetectionRequest ( Packet * packet )
protected
virtual PluginReceiveResult SLNet::NatTypeDetectionServer::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::NatTypeDetectionServer::OnRNS2Recv ( RNS2RecvStruct * recvStruct )
virtual

Implements SLNet::RNS2EventHandler.

void SLNet::NatTypeDetectionServer::Shutdown ( void )
void SLNet::NatTypeDetectionServer::Startup | ( | const char * | nonRakNetIP2,
 |  | const char * | nonRakNetIP3,
 |  | const char * | nonRakNetIP4
 | ) |  |

Start the system, binding to 3 external IPs not already in useS

Parameters
[in] | nonRakNetIP2 | First unused external IP
[in] | nonRakNetIP3 | Second unused external IP
[in] | nonRakNetIP4 | Third unused external IP
virtual void SLNet::NatTypeDetectionServer::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

DataStructures::Queue<RNS2RecvStruct*> SLNet::NatTypeDetectionServer::bufferedPackets
protected

Definition at line 124 of file NatTypeDetectionServer.h.

SimpleMutex SLNet::NatTypeDetectionServer::bufferedPacketsMutex
protected

Definition at line 125 of file NatTypeDetectionServer.h.

DataStructures::List<NATDetectionAttempt> SLNet::NatTypeDetectionServer::natDetectionAttempts
protected

Definition at line 128 of file NatTypeDetectionServer.h.

RakNetSocket2* SLNet::NatTypeDetectionServer::s1p2
protected

Definition at line 133 of file NatTypeDetectionServer.h.

RakNetSocket2 * SLNet::NatTypeDetectionServer::s2p3
protected

Definition at line 133 of file NatTypeDetectionServer.h.

RakNetSocket2 * SLNet::NatTypeDetectionServer::s3p4
protected

Definition at line 133 of file NatTypeDetectionServer.h.

char SLNet::NatTypeDetectionServer::s3p4Address[64]
protected

Definition at line 135 of file NatTypeDetectionServer.h.

RakNetSocket2 * SLNet::NatTypeDetectionServer::s4p5
protected

Definition at line 133 of file NatTypeDetectionServer.h.

struct SLNet::NatTypeDetectionServer::NATDetectionAttempt

Definition at line 110 of file NatTypeDetectionServer.h.

Class Members
unsigned short | c2Port
NATDetectionState | detectionState
RakNetGUID | guid
TimeMS | nextStateTime
SystemAddress | systemAddress
TimeMS | timeBetweenAttempts
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: PacketLogger

Classes
PacketLogger
Plugins

Print out incoming messages to a target destination. More...

Classes

class | SLNet::PacketConsoleLogger
Packetlogger that logs to a remote command console. More...
class | SLNet::PacketFileLogger
Packetlogger that outputs to a file. More...
class | SLNet::PacketLogger
Writes incoming and outgoing messages to the screen. This will write all incoming and outgoing messages to the console window, or to a file if you override it and give it this functionality. More...
class | SLNet::PacketOutputWindowLogger
Packetlogger that outputs to the output window in the debugger. Windows only. More...
class | SLNet::ThreadsafePacketLogger
Same as PacketLogger, but writes output in the user thread. More...

Detailed Description

Print out incoming messages to a target destination.

Class Documentation

class SLNet::PacketConsoleLogger

Packetlogger that logs to a remote command console.

Definition at line 35 of file PacketConsoleLogger.h.

+ Inheritance diagram for SLNet::PacketConsoleLogger:

Public Member Functions

PacketConsoleLogger ()
virtual void | SetLogCommandParser (LogCommandParser *lcp)
virtual void | WriteLog (const char *str)
Override this to log strings to wherever. Log should be threadsafe.
- Public Member Functions inherited from SLNet::PacketLogger
PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
Events on low level sends and receives. These functions may be called from different threads at the same time.
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | LogHeader (void)
Logs out a header for all the data.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
Log the direct sends and receives or not. Default true.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Attributes

LogCommandParser * logCommandParser
- Protected Attributes inherited from SLNet::PacketLogger
bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Additional Inherited Members

- Static Public Member Functions inherited from SLNet::PacketLogger
static const char * | BaseIDTOString (unsigned char Id)
- Protected Member Functions inherited from SLNet::PacketLogger
virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual void | AddToLog (const char *str)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])

Constructor & Destructor Documentation

SLNet::PacketConsoleLogger::PacketConsoleLogger ( )

Member Function Documentation

virtual void SLNet::PacketConsoleLogger::SetLogCommandParser ( LogCommandParser * lcp )
virtual
virtual void SLNet::PacketConsoleLogger::WriteLog ( const char * str )
virtual

Override this to log strings to wherever. Log should be threadsafe.

Reimplemented from SLNet::PacketLogger.

Member Data Documentation

LogCommandParser* SLNet::PacketConsoleLogger::logCommandParser
protected

Definition at line 43 of file PacketConsoleLogger.h.

class SLNet::PacketFileLogger

Packetlogger that outputs to a file.

Definition at line 35 of file PacketFileLogger.h.

+ Inheritance diagram for SLNet::PacketFileLogger:

Public Member Functions

PacketFileLogger ()
virtual | ~PacketFileLogger ()
void | StartLog (const char *filenamePrefix)
virtual void | WriteLog (const char *str)
Override this to log strings to wherever. Log should be threadsafe.
- Public Member Functions inherited from SLNet::PacketLogger
PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
Events on low level sends and receives. These functions may be called from different threads at the same time.
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | LogHeader (void)
Logs out a header for all the data.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
Log the direct sends and receives or not. Default true.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Attributes

FILE * | packetLogFile
- Protected Attributes inherited from SLNet::PacketLogger
bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Additional Inherited Members

- Static Public Member Functions inherited from SLNet::PacketLogger
static const char * | BaseIDTOString (unsigned char Id)
- Protected Member Functions inherited from SLNet::PacketLogger
virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual void | AddToLog (const char *str)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])

Constructor & Destructor Documentation

SLNet::PacketFileLogger::PacketFileLogger ( )
virtual SLNet::PacketFileLogger::~PacketFileLogger ( )
virtual

Member Function Documentation

void SLNet::PacketFileLogger::StartLog ( const char * filenamePrefix )
virtual void SLNet::PacketFileLogger::WriteLog ( const char * str )
virtual

Override this to log strings to wherever. Log should be threadsafe.

Reimplemented from SLNet::PacketLogger.

Member Data Documentation

FILE* SLNet::PacketFileLogger::packetLogFile
protected

Definition at line 46 of file PacketFileLogger.h.

class SLNet::PacketLogger

Writes incoming and outgoing messages to the screen. This will write all incoming and outgoing messages to the console window, or to a file if you override it and give it this functionality.

Definition at line 44 of file PacketLogger.h.

+ Inheritance diagram for SLNet::PacketLogger:

Public Member Functions

PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
Events on low level sends and receives. These functions may be called from different threads at the same time.
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | LogHeader (void)
Logs out a header for all the data.
virtual void | WriteLog (const char *str)
Override this to log strings to wherever. Log should be threadsafe.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
Log the direct sends and receives or not. Default true.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Static Public Member Functions

static const char * | BaseIDTOString (unsigned char Id)

Protected Member Functions

virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual void | AddToLog (const char *str)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::PacketLogger::PacketLogger ( )
virtual SLNet::PacketLogger::~PacketLogger ( )
virtual

Member Function Documentation

virtual void SLNet::PacketLogger::AddToLog ( const char * str )
protectedvirtual

Reimplemented in SLNet::ThreadsafePacketLogger.

static const char* SLNet::PacketLogger::BaseIDTOString ( unsigned char Id )
static
virtual void SLNet::PacketLogger::FormatLine | ( | char * | into,
 |  | size_t | intoLength,
 |  | const char * | dir,
 |  | const char * | type,
 |  | unsigned int | reliableMessageNumber,
 |  | unsigned int | frame,
 |  | unsigned char | id,
 |  | const BitSize_t | bitLen,
 |  | unsigned long long | time,
 |  | const SystemAddress & | local,
 |  | const SystemAddress & | remote,
 |  | unsigned int | splitPacketId,
 |  | unsigned int | splitPacketIndex,
 |  | unsigned int | splitPacketCount,
 |  | unsigned int | orderingIndex
 | ) |  |
virtual
virtual void SLNet::PacketLogger::FormatLine | ( | char * | into,
 |  | const char * | dir,
 |  | const char * | type,
 |  | unsigned int | reliableMessageNumber,
 |  | unsigned int | frame,
 |  | unsigned char | id,
 |  | const BitSize_t | bitLen,
 |  | unsigned long long | time,
 |  | const SystemAddress & | local,
 |  | const SystemAddress & | remote,
 |  | unsigned int | splitPacketId,
 |  | unsigned int | splitPacketIndex,
 |  | unsigned int | splitPacketCount,
 |  | unsigned int | orderingIndex
 | ) |  |
virtual
virtual void SLNet::PacketLogger::FormatLine | ( | char * | into,
 |  | size_t | intoLength,
 |  | const char * | dir,
 |  | const char * | type,
 |  | unsigned int | reliableMessageNumber,
 |  | unsigned int | frame,
 |  | const char * | idToPrint,
 |  | const BitSize_t | bitLen,
 |  | unsigned long long | time,
 |  | const SystemAddress & | local,
 |  | const SystemAddress & | remote,
 |  | unsigned int | splitPacketId,
 |  | unsigned int | splitPacketIndex,
 |  | unsigned int | splitPacketCount,
 |  | unsigned int | orderingIndex
 | ) |  |
virtual
virtual void SLNet::PacketLogger::FormatLine | ( | char * | into,
 |  | const char * | dir,
 |  | const char * | type,
 |  | unsigned int | reliableMessageNumber,
 |  | unsigned int | frame,
 |  | const char * | idToPrint,
 |  | const BitSize_t | bitLen,
 |  | unsigned long long | time,
 |  | const SystemAddress & | local,
 |  | const SystemAddress & | remote,
 |  | unsigned int | splitPacketId,
 |  | unsigned int | splitPacketIndex,
 |  | unsigned int | splitPacketCount,
 |  | unsigned int | orderingIndex
 | ) |  |
virtual
void SLNet::PacketLogger::GetLocalTime ( char buffer[128] )
protected
const char* SLNet::PacketLogger::IDTOString ( unsigned char Id )
protected
virtual void SLNet::PacketLogger::LogHeader ( void )
virtual

Logs out a header for all the data.

virtual void SLNet::PacketLogger::OnAck | ( | unsigned int | messageNumber,
 |  | SystemAddress | remoteSystemAddress,
 |  | SLNet::TimeMS | time
 | ) |  |
virtual

Called when we get an ack for a message we reliably sent

Precondition
To be called, UsesReliabilityLayer() must return true
Parameters
[in] | messageNumber | The numerical identifier for which message this is
[in] | remoteSystemAddress | The player we sent or got this packet from
[in] | time | The current time as returned by SLNet::GetTimeMS()

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnDirectSocketReceive | ( | const char * | data,
 |  | const BitSize_t | bitsUsed,
 |  | SystemAddress | remoteSystemAddress
 | ) |  |
virtual

Called on a receive from the socket, per datagram, that does not go through the reliability layer

Precondition
To be called, UsesReliabilityLayer() must return true
Parameters
[in] | data | The data being sent
[in] | bitsUsed | How many bits long data is
[in] | remoteSystemAddress | Which system this message is being sent to

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnDirectSocketSend | ( | const char * | data,
 |  | const BitSize_t | bitsUsed,
 |  | SystemAddress | remoteSystemAddress
 | ) |  |
virtual

Events on low level sends and receives. These functions may be called from different threads at the same time.

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnInternalPacket | ( | InternalPacket * | internalPacket,
 |  | unsigned | frameNumber,
 |  | SystemAddress | remoteSystemAddress,
 |  | SLNet::TimeMS | time,
 |  | int | isSend
 | ) |  |
virtual

Called on a send or receive of a message within the reliability layer

Precondition
To be called, UsesReliabilityLayer() must return true
Parameters
[in] | internalPacket | The user message, along with all send data.
[in] | frameNumber | The number of frames sent or received so far for this player depending on isSend . Indicates the frame of this user message.
[in] | remoteSystemAddress | The player we sent or got this packet from
[in] | time | The current time as returned by SLNet::GetTimeMS()
[in] | isSend | Is this callback representing a send event or receive event?

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnPushBackPacket | ( | const char * | data,
 |  | const BitSize_t | bitsUsed,
 |  | SystemAddress | remoteSystemAddress
 | ) |  |
virtual

System called RakPeerInterface::PushBackPacket

Parameters
[in] | data | The data being sent
[in] | bitsUsed | How many bits long data is
[in] | remoteSystemAddress | The player we sent or got this packet from

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::PacketLogger::OnReliabilityLayerNotification | ( | const char * | errorMessage,
 |  | const BitSize_t | bitsUsed,
 |  | SystemAddress | remoteSystemAddress,
 |  | bool | isError
 | ) |  |
virtual

Called when the reliability layer rejects a send or receive

Precondition
To be called, UsesReliabilityLayer() must return true
Parameters
[in] | bitsUsed | How many bits long data is
[in] | remoteSystemAddress | Which system this message is being sent to

Reimplemented from SLNet::PluginInterface2.

void SLNet::PacketLogger::SetLogDirectMessages ( bool send )

Log the direct sends and receives or not. Default true.

virtual void SLNet::PacketLogger::SetPrefix ( const char * _prefix )
virtual

Prepend this string to output logs.

virtual void SLNet::PacketLogger::SetPrintAcks ( bool print )
virtual
virtual void SLNet::PacketLogger::SetPrintID ( bool print )
virtual
virtual void SLNet::PacketLogger::SetSuffix ( const char * _suffix )
virtual

Append this string to output logs. (newline is useful here)

virtual const char* SLNet::PacketLogger::UserIDTOString ( unsigned char Id )
protectedvirtual
virtual bool SLNet::PacketLogger::UsesReliabilityLayer ( void ) const
inlineprotectedvirtual

Queried when attached to RakPeer Return true to call OnDirectSocketSend(), OnDirectSocketReceive(), OnReliabilityLayerNotification(), OnInternalPacket(), and OnAck() If true, then you cannot call RakPeer::AttachPlugin() or RakPeer::DetachPlugin() for this plugin, while RakPeer is active

Reimplemented from SLNet::PluginInterface2.

Definition at line 103 of file PacketLogger.h.

virtual void SLNet::PacketLogger::WriteLog ( const char * str )
virtual

Override this to log strings to wherever. Log should be threadsafe.

Reimplemented in SLNet::PacketFileLogger, SLNet::PacketConsoleLogger, and SLNet::PacketOutputWindowLogger.

virtual void SLNet::PacketLogger::WriteMiscellaneous | ( | const char * | type,
 |  | const char * | msg
 | ) |  |
virtual

Member Data Documentation

bool SLNet::PacketLogger::logDirectMessages
protected

Definition at line 109 of file PacketLogger.h.

char SLNet::PacketLogger::prefix[256]
protected

Definition at line 112 of file PacketLogger.h.

bool SLNet::PacketLogger::printAcks
protected

Definition at line 111 of file PacketLogger.h.

bool SLNet::PacketLogger::printId
protected

Definition at line 111 of file PacketLogger.h.

char SLNet::PacketLogger::suffix[256]
protected

Definition at line 113 of file PacketLogger.h.

class SLNet::PacketOutputWindowLogger

Packetlogger that outputs to the output window in the debugger. Windows only.

Definition at line 34 of file PacketOutputWindowLogger.h.

+ Inheritance diagram for SLNet::PacketOutputWindowLogger:

Public Member Functions

PacketOutputWindowLogger ()
virtual | ~PacketOutputWindowLogger ()
virtual void | WriteLog (const char *str)
Override this to log strings to wherever. Log should be threadsafe.
- Public Member Functions inherited from SLNet::PacketLogger
PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
Events on low level sends and receives. These functions may be called from different threads at the same time.
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | LogHeader (void)
Logs out a header for all the data.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
Log the direct sends and receives or not. Default true.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Additional Inherited Members

- Static Public Member Functions inherited from SLNet::PacketLogger
static const char * | BaseIDTOString (unsigned char Id)
- Protected Member Functions inherited from SLNet::PacketLogger
virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual void | AddToLog (const char *str)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])
- Protected Attributes inherited from SLNet::PacketLogger
bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]

Constructor & Destructor Documentation

SLNet::PacketOutputWindowLogger::PacketOutputWindowLogger ( )
virtual SLNet::PacketOutputWindowLogger::~PacketOutputWindowLogger ( )
virtual

Member Function Documentation

virtual void SLNet::PacketOutputWindowLogger::WriteLog ( const char * str )
virtual

Override this to log strings to wherever. Log should be threadsafe.

Reimplemented from SLNet::PacketLogger.

class SLNet::ThreadsafePacketLogger

Same as PacketLogger, but writes output in the user thread.

Definition at line 35 of file ThreadsafePacketLogger.h.

+ Inheritance diagram for SLNet::ThreadsafePacketLogger:

Public Member Functions

ThreadsafePacketLogger ()
virtual | ~ThreadsafePacketLogger ()
virtual void | Update (void)
Update is called every time a packet is checked for .
- Public Member Functions inherited from SLNet::PacketLogger
PacketLogger ()
virtual | ~PacketLogger ()
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, size_t intoLength, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | FormatLine (char *into, const char *dir, const char *type, unsigned int reliableMessageNumber, unsigned int frame, const char *idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress &local, const SystemAddress &remote, unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
Events on low level sends and receives. These functions may be called from different threads at the same time.
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | LogHeader (void)
Logs out a header for all the data.
virtual void | WriteLog (const char *str)
Override this to log strings to wherever. Log should be threadsafe.
virtual void | WriteMiscellaneous (const char *type, const char *msg)
virtual void | SetPrintID (bool print)
virtual void | SetPrintAcks (bool print)
virtual void | SetPrefix (const char *_prefix)
Prepend this string to output logs.
virtual void | SetSuffix (const char *_suffix)
Append this string to output logs. (newline is useful here)
void | SetLogDirectMessages (bool send)
Log the direct sends and receives or not. Default true.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

virtual void | AddToLog (const char *str)
- Protected Member Functions inherited from SLNet::PacketLogger
virtual bool | UsesReliabilityLayer (void) const
const char * | IDTOString (unsigned char Id)
virtual const char * | UserIDTOString (unsigned char Id)
void | GetLocalTime (char buffer[128])
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::SingleProducerConsumer
< char * > 		logMessages
- Protected Attributes inherited from SLNet::PacketLogger
bool | logDirectMessages
bool | printId
bool | printAcks
char | prefix [256]
char | suffix [256]
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Additional Inherited Members

- Static Public Member Functions inherited from SLNet::PacketLogger
static const char * BaseIDTOString (unsigned char Id)

Constructor & Destructor Documentation

SLNet::ThreadsafePacketLogger::ThreadsafePacketLogger ( )
virtual SLNet::ThreadsafePacketLogger::~ThreadsafePacketLogger ( )
virtual

Member Function Documentation

virtual void SLNet::ThreadsafePacketLogger::AddToLog ( const char * str )
protectedvirtual

Reimplemented from SLNet::PacketLogger.

virtual void SLNet::ThreadsafePacketLogger::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

DataStructures::SingleProducerConsumer<char*> SLNet::ThreadsafePacketLogger::logMessages
protected

Definition at line 46 of file ThreadsafePacketLogger.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: ReadyEvent

Classes | Enumerations
ReadyEvent
Plugins

Peer to peer synchronized ready and unready events. More...

Classes

class | SLNet::ReadyEvent
Peer to peer synchronized ready and unready events. More...
struct | SLNet::ReadyEvent::ReadyEventNode
struct | SLNet::ReadyEvent::RemoteSystem

Enumerations

enum SLNet::ReadyEventSystemStatus {
SLNet::RES_NOT_WAITING, SLNet::RES_WAITING, SLNet::RES_READY, SLNet::RES_ALL_READY,
SLNet::RES_UNKNOWN_EVENT
}

Detailed Description

Peer to peer synchronized ready and unready events.

Class Documentation

class SLNet::ReadyEvent

Peer to peer synchronized ready and unready events.

For peer to peer networks in a fully connected mesh.
Solves the problem of how to tell if all peers, relative to all other peers, are in a certain ready state.
For example, if A is connected to B and C, A may see that B and C are ready, but does not know if B is ready to C, or vice-versa.
This plugin uses two stages to solve that problem, first, everyone I know about is ready. Second, everyone I know about is ready to everyone they know about.
The user will get ID_READY_EVENT_SET and ID_READY_EVENT_UNSET as the signal flag is set or unset
The user will get ID_READY_EVENT_ALL_SET when all systems are done waiting for all other systems, in which case the event is considered complete, and no longer tracked.

See Also
FullyConnectedMesh2

Definition at line 68 of file ReadyEvent.h.

+ Inheritance diagram for SLNet::ReadyEvent:

Public Member Functions

ReadyEvent ()
virtual | ~ReadyEvent ()
bool | SetEvent (int eventId, bool isReady)
void | ForceCompletion (int eventId)
bool | DeleteEvent (int eventId)
bool | IsEventSet (int eventId)
bool | IsEventCompletionProcessing (int eventId) const
bool | IsEventCompleted (int eventId) const
bool | HasEvent (int eventId)
unsigned | GetEventListSize (void) const
int | GetEventAtIndex (unsigned index) const
bool | AddToWaitList (int eventId, RakNetGUID guid)
bool | RemoveFromWaitList (int eventId, RakNetGUID guid)
bool | IsInWaitList (int eventId, RakNetGUID guid)
unsigned | GetRemoteWaitListSize (int eventId) const
RakNetGUID | GetFromWaitListAtIndex (int eventId, unsigned index) const
ReadyEventSystemStatus | GetReadyStatus (int eventId, RakNetGUID guid)
void | SetSendChannel (unsigned char newChannel)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Static Public Member Functions

static int | RemoteSystemCompByGuid (const RakNetGUID &key, const RemoteSystem &data)
static int | ReadyEventNodeComp (const int &key, ReadyEvent::ReadyEventNode *const &data)

Protected Member Functions

virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
void | Clear (void)
void | SendReadyStateQuery (unsigned eventId, RakNetGUID guid)
void | SendReadyUpdate (unsigned eventIndex, unsigned systemIndex, bool forceIfNotDefault)
void | BroadcastReadyUpdate (unsigned eventIndex, bool forceIfNotDefault)
void | RemoveFromAllLists (RakNetGUID guid)
void | OnReadyEventQuery (Packet *packet)
void | PushCompletionPacket (unsigned eventId)
bool | AddToWaitListInternal (unsigned eventIndex, RakNetGUID guid)
void | OnReadyEventForceAllSet (Packet *packet)
void | OnReadyEventPacketUpdate (Packet *packet)
void | UpdateReadyStatus (unsigned eventIndex)
bool | IsEventCompletedByIndex (unsigned eventIndex) const
unsigned | CreateNewEvent (int eventId, bool isReady)
bool | SetEventByIndex (int eventIndex, bool isReady)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::OrderedList
< int, ReadyEventNode
*, ReadyEvent::ReadyEventNodeComp > 		readyEventNodeList
unsigned char | channel
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::ReadyEvent::ReadyEvent ( )
virtual SLNet::ReadyEvent::~ReadyEvent ( )
virtual

Member Function Documentation

bool SLNet::ReadyEvent::AddToWaitList | ( | int | eventId,
 |  | RakNetGUID | guid
 | ) |  |

Adds a system to wait for to signal an event before considering the event complete and returning ID_READY_EVENT_ALL_SET. As we add systems, if this event was previously set to true with SetEvent, these systems will get ID_READY_EVENT_SET. As these systems disconnect (directly or indirectly through the router) they are removed.

Note
If the event completion process has already started, you cannot add more systems, as this would cause the completion process to fail
Parameters
[in] | eventId | A user-defined number previously passed to SetEvent that has not yet completed
[in] | guid | An address to wait for event replies from. Pass UNASSIGNED_SYSTEM_ADDRESS for all currently connected systems. Until all systems in this list have called SetEvent with this ID and true, and have this system in the list, we won't get ID_READY_EVENT_COMPLETE
Returns
True on success, false on unknown eventId (this should be considered an error)
bool SLNet::ReadyEvent::AddToWaitListInternal | ( | unsigned | eventIndex,
 |  | RakNetGUID | guid
 | ) |  |
protected
void SLNet::ReadyEvent::BroadcastReadyUpdate | ( | unsigned | eventIndex,
 |  | bool | forceIfNotDefault
 | ) |  |
protected
void SLNet::ReadyEvent::Clear ( void )
protected
unsigned SLNet::ReadyEvent::CreateNewEvent | ( | int | eventId,
 |  | bool | isReady
 | ) |  |
protected
bool SLNet::ReadyEvent::DeleteEvent ( int eventId )

Deletes an event. We will no longer wait for this event, and any systems that we know have set the event will be forgotten. Call this to clear memory when events are completed and you know you will never need them again.

Parameters
[in] eventId A user-defined identifier
Returns
True on success. False (failure) on unknown eventId
void SLNet::ReadyEvent::ForceCompletion ( int eventId )

When systems can call SetEvent() with isReady==false, it is possible for one system to return true from IsEventCompleted() while the other systems return false This can occur if a system SetEvent() with isReady==false while the completion message is still being transmitted. If your game has the situation where some action should be taken on all systems when IsEventCompleted() is true for any system, then call ForceCompletion() when the action begins. This will force all systems to return true from IsEventCompleted().

Parameters
[in] eventId A user-defined identifier to immediately set as completed
int SLNet::ReadyEvent::GetEventAtIndex ( unsigned index ) const

Returns the event ID stored at a particular index. EventIDs are stored sorted from least to greatest.

Parameters
[in] index Index into the array, from 0 to GetEventListSize()
Returns
The event ID stored at a particular index
unsigned SLNet::ReadyEvent::GetEventListSize ( void ) const

Returns the total number of events stored in the system.

Returns
The total number of events stored in the system.
RakNetGUID SLNet::ReadyEvent::GetFromWaitListAtIndex | ( | int | eventId,
 |  | unsigned | index
 | ) |  | const

Returns the system address of a system at a particular index, for this event.

Parameters
[in] | eventId | A user-defined identifier
[in] | index | Index into the array, from 0 to GetWaitListSize()
Returns
The system address of a system at a particular index, for this event.
ReadyEventSystemStatus SLNet::ReadyEvent::GetReadyStatus | ( | int | eventId,
 |  | RakNetGUID | guid
 | ) |  |

For a remote system, find out what their ready status is (waiting, signaled, complete).

Parameters
[in] | eventId | A user-defined identifier
[in] | guid | Which system we are checking up on
Returns
The status of this system, for this particular event.
See Also
ReadyEventSystemStatus
unsigned SLNet::ReadyEvent::GetRemoteWaitListSize ( int eventId ) const

Returns the total number of systems we are waiting on for this event. Does not include yourself

Parameters
[in] eventId A user-defined identifier
Returns
The total number of systems we are waiting on for this event.
bool SLNet::ReadyEvent::HasEvent ( int eventId )

Returns if this is a known event. Events may be known even if we never ourselves referenced them with SetEvent, because other systems created them via ID_READY_EVENT_SET.

Parameters
[in] eventId A user-defined identifier
Returns
true if we have this event, false otherwise
bool SLNet::ReadyEvent::IsEventCompleted ( int eventId ) const

Returns if the wait list is a subset of the completion list. Call this after all systems you want to wait for have been added with AddToWaitList If you are waiting for a specific number of systems (such as players later connecting), also check GetRemoteWaitListSize(eventId) to be equal to 1 less than the total number of participants.

Parameters
[in] eventId A user-defined identifier
Returns
True on completion. False (failure) on unknown eventId, or the set is not completed.
bool SLNet::ReadyEvent::IsEventCompletedByIndex ( unsigned eventIndex ) const
protected
bool SLNet::ReadyEvent::IsEventCompletionProcessing ( int eventId ) const

Returns if the event is about to be ready and we are negotiating the final packets. This will usually only be true for a very short time, after which IsEventCompleted should return true. While this is true you cannot add to the wait list, or SetEvent() isReady to false anymore.

Parameters
[in] eventId A user-defined identifier
Returns
True if any other system has completed processing. Will always be true if IsEventCompleted() is true
bool SLNet::ReadyEvent::IsEventSet ( int eventId )

Returns what was passed to SetEvent()

Returns
The value of isReady passed to SetEvent(). Also returns false on unknown event.
bool SLNet::ReadyEvent::IsInWaitList | ( | int | eventId,
 |  | RakNetGUID | guid
 | ) |  |

Returns if a particular system is waiting on a particular event.

Parameters
[in] | eventId | A user-defined identifier
[in] | guid | The system we are checking up on
Returns
True if this system is waiting on this event, false otherwise.
virtual void SLNet::ReadyEvent::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
protectedvirtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::ReadyEvent::OnRakPeerShutdown ( void )
protectedvirtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

void SLNet::ReadyEvent::OnReadyEventForceAllSet ( Packet * packet )
protected
void SLNet::ReadyEvent::OnReadyEventPacketUpdate ( Packet * packet )
protected
void SLNet::ReadyEvent::OnReadyEventQuery ( Packet * packet )
protected
virtual PluginReceiveResult SLNet::ReadyEvent::OnReceive ( Packet * packet )
protectedvirtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::ReadyEvent::PushCompletionPacket ( unsigned eventId )
protected
static int SLNet::ReadyEvent::ReadyEventNodeComp | ( | const int & | key,
 |  | ReadyEvent::ReadyEventNode *const & | data
 | ) |  |
static
static int SLNet::ReadyEvent::RemoteSystemCompByGuid | ( | const RakNetGUID & | key,
 |  | const RemoteSystem & | data
 | ) |  |
static
void SLNet::ReadyEvent::RemoveFromAllLists ( RakNetGUID guid )
protected
bool SLNet::ReadyEvent::RemoveFromWaitList | ( | int | eventId,
 |  | RakNetGUID | guid
 | ) |  |

Removes systems from the wait list, which should have been previously added with AddToWaitList

Note
Systems that directly or indirectly disconnect from us are automatically removed from the wait list
Parameters
[in] guid The system to remove from the wait list. Pass UNASSIGNED_RAKNET_GUID for all currently connected systems.
Returns
True on success, false on unknown eventId (this should be considered an error)
void SLNet::ReadyEvent::SendReadyStateQuery | ( | unsigned | eventId,
 |  | RakNetGUID | guid
 | ) |  |
protected
void SLNet::ReadyEvent::SendReadyUpdate | ( | unsigned | eventIndex,
 |  | unsigned | systemIndex,
 |  | bool | forceIfNotDefault
 | ) |  |
protected
bool SLNet::ReadyEvent::SetEvent | ( | int | eventId,
 |  | bool | isReady
 | ) |  |

Sets or updates the initial ready state for our local system. If eventId is an unknown event the event is created. If eventId was previously used and you want to reuse it, call DeleteEvent first, or else you will keep the same event signals from before Systems previously or later added through AddToWaitList() with the same eventId when isReady=true will get ID_READY_EVENT_SET Systems previously added through AddToWaitList with the same eventId will get ID_READY_EVENT_UNSET For both ID_READY_EVENT_SET and ID_READY_EVENT_UNSET, eventId is encoded in bytes 1 through 1+sizeof(int)

Parameters
[in] | eventId | A user-defined identifier to wait on. This can be a sequence counter, an event identifier, or anything else you want.
[in] | isReady | True to signal we are ready to proceed with this event, false to unsignal
Returns
False if event status is ID_READY_EVENT_FORCE_ALL_SET, or if we are setting to a status we are already in (no change). Otherwise true
bool SLNet::ReadyEvent::SetEventByIndex | ( | int | eventIndex,
 |  | bool | isReady
 | ) |  |
protected
void SLNet::ReadyEvent::SetSendChannel ( unsigned char newChannel )

This channel will be used for all RakPeer::Send calls

Parameters
[in] newChannel The channel to use for internal RakPeer::Send calls from this system. Defaults to 0.
void SLNet::ReadyEvent::UpdateReadyStatus ( unsigned eventIndex )
protected

Member Data Documentation

unsigned char SLNet::ReadyEvent::channel
protected

Definition at line 240 of file ReadyEvent.h.

DataStructures::OrderedList<int, ReadyEventNode*, ReadyEvent::ReadyEventNodeComp> SLNet::ReadyEvent::readyEventNodeList
protected

Definition at line 239 of file ReadyEvent.h.

struct SLNet::ReadyEvent::ReadyEventNode

Definition at line 194 of file ReadyEvent.h.

Class Members
int | eventId
MessageID | eventStatus
OrderedList< RakNetGUID, RemoteSystem, RemoteSystemCompByGuid > | systemList
struct SLNet::ReadyEvent::RemoteSystem

Definition at line 186 of file ReadyEvent.h.

Class Members
MessageID | lastReceivedStatus
MessageID | lastSentStatus
RakNetGUID | rakNetGuid

Enumeration Type Documentation

enum SLNet::ReadyEventSystemStatus

Returns the status of a remote system when querying with ReadyEvent::GetReadyStatus

Enumerator:
RES_NOT_WAITING

--------— Normal states ------------— The remote system is not in the wait list, and we have never gotten a ready or complete message from it. This is the default state for valid events

RES_WAITING

We are waiting for this remote system to call SetEvent(thisEvent,true).

RES_READY

The remote system called SetEvent(thisEvent,true), but it still waiting for other systems before completing the ReadyEvent.

RES_ALL_READY

The remote system called SetEvent(thisEvent,true), and is no longer waiting for any other systems. This remote system has completed the ReadyEvent

RES_UNKNOWN_EVENT

Error code, we couldn't look up the system because the event was unknown.

Definition at line 41 of file ReadyEvent.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: RelayPlugin

Classes
RelayPlugin
Plugins

A simple class to relay messages from one system to another through an intermediary. More...

Classes

class | SLNet::RelayPlugin
A simple class to relay messages from one system to another, identifying remote systems by a string. More...
struct | SLNet::RelayPlugin::RP_Group
struct | SLNet::RelayPlugin::StrAndGuid
struct | SLNet::RelayPlugin::StrAndGuidAndRoom

Detailed Description

A simple class to relay messages from one system to another through an intermediary.

Class Documentation

class SLNet::RelayPlugin

A simple class to relay messages from one system to another, identifying remote systems by a string.

Definition at line 67 of file RelayPlugin.h.

+ Inheritance diagram for SLNet::RelayPlugin:

Public Member Functions

RelayPlugin ()
Constructor.
virtual | ~RelayPlugin ()
Destructor.
RelayPluginEnums | AddParticipantOnServer (const RakString &key, const RakNetGUID &guid)
Forward messages from any system, to the system specified by the combination of key and guid. The sending system only needs to know the key.
void | RemoveParticipantOnServer (const RakNetGUID &guid)
Remove a chat participant.
void | SetAcceptAddParticipantRequests (bool accept)
If true, then if the client calls AddParticipantRequestFromClient(), the server will call AddParticipantOnServer() automatically Defaults to false.
void | AddParticipantRequestFromClient (const RakString &key, const RakNetGUID &relayPluginServerGuid)
Request from the client for the server to call AddParticipantOnServer()
void | RemoveParticipantRequestFromClient (const RakNetGUID &relayPluginServerGuid)
Remove yourself as a participant.
void | SendToParticipant (const RakNetGUID &relayPluginServerGuid, const RakString &destinationGuid, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel)
Request that the server relay bitStream to the system designated by key.
void | SendGroupMessage (const RakNetGUID &relayPluginServerGuid, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel)
void | JoinGroupRequest (const RakNetGUID &relayPluginServerGuid, RakString groupName)
void | LeaveGroup (const RakNetGUID &relayPluginServerGuid)
void | GetGroupList (const RakNetGUID &relayPluginServerGuid)
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

RelayPlugin::RP_Group * | JoinGroup (RakNetGUID userGuid, RakString roomName)
RelayPlugin::RP_Group * | JoinGroup (RP_Group *room, StrAndGuidAndRoom **strAndGuidSender)
void | LeaveGroup (StrAndGuidAndRoom **strAndGuidSender)
void | NotifyUsersInRoom (RP_Group *room, int msg, const RakString &message)
void | SendMessageToRoom (StrAndGuidAndRoom **strAndGuidSender, BitStream *message)
void | SendChatRoomsList (RakNetGUID target)
void | OnGroupMessageFromClient (Packet *packet)
void | OnJoinGroupRequestFromClient (Packet *packet)
void | OnLeaveGroupRequestFromClient (Packet *packet)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::Hash
< RakString, StrAndGuidAndRoom
*, 8096, SLNet::RakString::ToInteger > 		strToGuidHash
DataStructures::Hash
< RakNetGUID,
StrAndGuidAndRoom
*, 8096, SLNet::RakNetGUID::ToUint32 > 		guidToStrHash
DataStructures::List< RP_Group * > chatRooms
bool | acceptAddParticipantRequests
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::RelayPlugin::RelayPlugin ( )

Constructor.

virtual SLNet::RelayPlugin::~RelayPlugin ( )
virtual

Destructor.

Member Function Documentation

RelayPluginEnums SLNet::RelayPlugin::AddParticipantOnServer | ( | const RakString & | key,
 |  | const RakNetGUID & | guid
 | ) |  |

Forward messages from any system, to the system specified by the combination of key and guid. The sending system only needs to know the key.

Parameters
[in] | key | A string to identify the target's RakNetGUID. This is so the sending system does not need to know the RakNetGUID of the target system. The key should be unique among all guids added. If the key is not unique, only one system will be sent to (at random).
[in] | guid | The RakNetGuid of the system to send to. If this system disconnects, it is removed from the internal hash
Returns
RPE_ADD_CLIENT_TARGET_NOT_CONNECTED, RPE_ADD_CLIENT_NAME_ALREADY_IN_USE, or RPE_ADD_CLIENT_OK
void SLNet::RelayPlugin::AddParticipantRequestFromClient | ( | const RakString & | key,
 |  | const RakNetGUID & | relayPluginServerGuid
 | ) |  |

Request from the client for the server to call AddParticipantOnServer()

Precondition
The server must have called SetAcceptAddParticipantRequests(true) or the request will be ignored
Parameters
[in] | key | A string to identify out system. Passed to key on AddParticipantOnServer()
[in] | relayPluginServerGuid | the RakNetGUID of the system running RelayPlugin
void SLNet::RelayPlugin::GetGroupList ( const RakNetGUID & relayPluginServerGuid )
RelayPlugin::RP_Group* SLNet::RelayPlugin::JoinGroup | ( | RakNetGUID | userGuid,
 |  | RakString | roomName
 | ) |  |
protected
RelayPlugin::RP_Group* SLNet::RelayPlugin::JoinGroup | ( | RP_Group * | room,
 |  | StrAndGuidAndRoom ** | strAndGuidSender
 | ) |  |
protected
void SLNet::RelayPlugin::JoinGroupRequest | ( | const RakNetGUID & | relayPluginServerGuid,
 |  | RakString | groupName
 | ) |  |
void SLNet::RelayPlugin::LeaveGroup ( const RakNetGUID & relayPluginServerGuid )
void SLNet::RelayPlugin::LeaveGroup ( StrAndGuidAndRoom ** strAndGuidSender )
protected
void SLNet::RelayPlugin::NotifyUsersInRoom | ( | RP_Group * | room,
 |  | int | msg,
 |  | const RakString & | message
 | ) |  |
protected
virtual void SLNet::RelayPlugin::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

void SLNet::RelayPlugin::OnGroupMessageFromClient ( Packet * packet )
protected
void SLNet::RelayPlugin::OnJoinGroupRequestFromClient ( Packet * packet )
protected
void SLNet::RelayPlugin::OnLeaveGroupRequestFromClient ( Packet * packet )
protected
virtual PluginReceiveResult SLNet::RelayPlugin::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::RelayPlugin::RemoveParticipantOnServer ( const RakNetGUID & guid )

Remove a chat participant.

void SLNet::RelayPlugin::RemoveParticipantRequestFromClient ( const RakNetGUID & relayPluginServerGuid )

Remove yourself as a participant.

void SLNet::RelayPlugin::SendChatRoomsList ( RakNetGUID target )
protected
void SLNet::RelayPlugin::SendGroupMessage | ( | const RakNetGUID & | relayPluginServerGuid,
 |  | BitStream * | bitStream,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | char | orderingChannel
 | ) |  |
void SLNet::RelayPlugin::SendMessageToRoom | ( | StrAndGuidAndRoom ** | strAndGuidSender,
 |  | BitStream * | message
 | ) |  |
protected
void SLNet::RelayPlugin::SendToParticipant | ( | const RakNetGUID & | relayPluginServerGuid,
 |  | const RakString & | destinationGuid,
 |  | BitStream * | bitStream,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | char | orderingChannel
 | ) |  |

Request that the server relay bitStream to the system designated by key.

Parameters
[in] | relayPluginServerGuid | the RakNetGUID of the system running RelayPlugin
[in] | destinationGuid | The key value passed to AddParticipant() earlier on the server. If this was not done, the server will not relay the message (it will be silently discarded).
[in] | bitStream | The data to relay
[in] | priority | See the parameter of the same name in RakPeerInterface::Send()
[in] | reliability | See the parameter of the same name in RakPeerInterface::Send()
[in] | orderingChannel | See the parameter of the same name in RakPeerInterface::Send()
void SLNet::RelayPlugin::SetAcceptAddParticipantRequests ( bool accept )

If true, then if the client calls AddParticipantRequestFromClient(), the server will call AddParticipantOnServer() automatically Defaults to false.

Parameters
[in] accept true to accept, false to not.

Member Data Documentation

bool SLNet::RelayPlugin::acceptAddParticipantRequests
protected

Definition at line 155 of file RelayPlugin.h.

DataStructures::List<RP_Group*> SLNet::RelayPlugin::chatRooms
protected

Definition at line 154 of file RelayPlugin.h.

DataStructures::Hash<RakNetGUID, StrAndGuidAndRoom*, 8096, SLNet::RakNetGUID::ToUint32> SLNet::RelayPlugin::guidToStrHash
protected

Definition at line 153 of file RelayPlugin.h.

DataStructures::Hash<RakString, StrAndGuidAndRoom*, 8096, SLNet::RakString::ToInteger> SLNet::RelayPlugin::strToGuidHash
protected

Definition at line 152 of file RelayPlugin.h.

struct SLNet::RelayPlugin::RP_Group

Definition at line 134 of file RelayPlugin.h.

Class Members
RakString | roomName
List< StrAndGuid > | usersInRoom
struct SLNet::RelayPlugin::StrAndGuid

Definition at line 128 of file RelayPlugin.h.

Class Members
RakNetGUID | guid
RakString | str
struct SLNet::RelayPlugin::StrAndGuidAndRoom

Definition at line 121 of file RelayPlugin.h.

Class Members
RakString | currentRoom
RakNetGUID | guid
RakString | str
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: ReplicaManager3

Classes | Typedefs | Enumerations
ReplicaManager3
Plugins

Third implementation of object replication. More...

Classes

class | SLNet::ReplicaManager3
System to help automate game object construction, destruction, and serialization. More...
struct | SLNet::LastSerializationResultBS
struct | SLNet::LastSerializationResult
struct | SLNet::SerializeParameters
struct | SLNet::DeserializeParameters
class | SLNet::Connection_RM3
Each remote system is represented by Connection_RM3. Used to allocate Replica3 and track which instances have been allocated. More...
class | SLNet::Replica3
Base class for your replicated objects for the ReplicaManager3 system. More...
struct | SLNet::ReplicaManager3::RM3World

Typedefs

typedef uint8_t SLNet::WorldId

Enumerations

enum | SLNet::SendSerializeIfChangedResult { SLNet::SSICR_SENT_DATA, SLNet::SSICR_DID_NOT_SEND_DATA, SLNet::SSICR_NEVER_SERIALIZE }
enum SLNet::RM3ConstructionState {
SLNet::RM3CS_SEND_CONSTRUCTION, SLNet::RM3CS_ALREADY_EXISTS_REMOTELY, SLNet::RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT, SLNet::RM3CS_NEVER_CONSTRUCT,
SLNet::RM3CS_NO_ACTION, SLNet::RM3CS_MAX
}
Return codes for Connection_RM3::GetConstructionState() and Replica3::QueryConstruction() More...
enum | SLNet::RM3DestructionState { SLNet::RM3DS_SEND_DESTRUCTION, SLNet::RM3DS_DO_NOT_QUERY_DESTRUCTION, SLNet::RM3DS_NO_ACTION, SLNet::RM3DS_MAX }
enum SLNet::RM3SerializationResult {
SLNet::RM3SR_BROADCAST_IDENTICALLY, SLNet::RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION, SLNet::RM3SR_SERIALIZED_UNIQUELY, SLNet::RM3SR_SERIALIZED_ALWAYS,
SLNet::RM3SR_SERIALIZED_ALWAYS_IDENTICALLY, SLNet::RM3SR_DO_NOT_SERIALIZE, SLNet::RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION, SLNet::RM3SR_MAX
}
enum | SLNet::RM3QuerySerializationResult { SLNet::RM3QSR_CALL_SERIALIZE, SLNet::RM3QSR_DO_NOT_CALL_SERIALIZE, SLNet::RM3QSR_NEVER_CALL_SERIALIZE, SLNet::RM3QSR_MAX }
enum | SLNet::RM3ActionOnPopConnection { SLNet::RM3AOPC_DO_NOTHING, SLNet::RM3AOPC_DELETE_REPLICA, SLNet::RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION, SLNet::RM3AOPC_MAX }
enum SLNet::Replica3P2PMode {
SLNet::R3P2PM_SINGLE_OWNER, SLNet::R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE, SLNet::R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE, SLNet::R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE,
SLNet::R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE
}

Detailed Description

Third implementation of object replication.

Class Documentation

class SLNet::ReplicaManager3

System to help automate game object construction, destruction, and serialization.

ReplicaManager3 tracks your game objects and automates the networking for replicating them across the network
As objects are created, destroyed, or serialized differently, those changes are pushed out to other systems.
To use:

  1. Derive from Connection_RM3 and implement Connection_RM3::AllocReplica(). This is a factory function where given a user-supplied identifier for a class (such as name) return an instance of that class. Should be able to return any networked object in your game.
  2. Derive from ReplicaManager3 and implement AllocConnection() and DeallocConnection() to return the class you created in step 1.
  3. Derive your networked game objects from Replica3. All pure virtuals have to be implemented, however defaults are provided for Replica3::QueryConstruction(), Replica3::QueryRemoteConstruction(), and Replica3::QuerySerialization() depending on your network architecture.
  4. When a new game object is created on the local system, pass it to ReplicaManager3::Reference().
  5. When a game object is destroyed on the local system, and you want other systems to know about it, call Replica3::BroadcastDestruction()

At this point, all new connections will automatically download, get construction messages, get destruction messages, and update serialization automatically.

Definition at line 86 of file ReplicaManager3.h.

+ Inheritance diagram for SLNet::ReplicaManager3:

Public Member Functions

ReplicaManager3 ()
virtual | ~ReplicaManager3 ()
virtual Connection_RM3 * | AllocConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID) const =0
Implement to return a game specific derivation of Connection_RM3.
virtual void | DeallocConnection (Connection_RM3 *connection) const =0
Implement to destroy a class instanced returned by AllocConnection()
void | SetAutoManageConnections (bool autoCreate, bool autoDestroy)
Enable or disable automatically assigning connections to new instances of Connection_RM3.
bool | GetAutoCreateConnections (void) const
bool | GetAutoDestroyConnections (void) const
void | AutoCreateConnectionList (DataStructures::List< RakNetGUID > &participantListIn, DataStructures::List< Connection_RM3 * > &participantListOut, WorldId worldId=0)
Call AllocConnection() and PushConnection() for each connection in participantList.
bool | PushConnection (SLNet::Connection_RM3 *newConnection, WorldId worldId=0)
Track a new Connection_RM3 instance.
SLNet::Connection_RM3 * | PopConnection (RakNetGUID guid, WorldId worldId=0)
Stop tracking a connection.
void | Reference (SLNet::Replica3 *replica3, WorldId worldId=0)
Adds a replicated object to the system.
void | Dereference (SLNet::Replica3 *replica3, WorldId worldId=0)
Removes a replicated object from the system.
void | DereferenceList (DataStructures::List< Replica3 * > &replicaListIn, WorldId worldId=0)
Removes multiple replicated objects from the system.
void | GetReplicasCreatedByGuid (RakNetGUID guid, DataStructures::List< Replica3 * > &replicaListOut, WorldId worldId=0)
Returns all objects originally created by a particular system.
void | GetReplicasCreatedByMe (DataStructures::List< Replica3 * > &replicaListOut, WorldId worldId=0)
Returns all objects originally created by your system.
void | GetReferencedReplicaList (DataStructures::List< Replica3 * > &replicaListOut, WorldId worldId=0)
Returns the entire list of Replicas that we know about.
unsigned | GetReplicaCount (WorldId worldId=0) const
Returns the number of replicas known about.
Replica3 * | GetReplicaAtIndex (unsigned index, WorldId worldId=0)
Returns a replica by index.
unsigned int | GetConnectionCount (WorldId worldId=0) const
Returns the number of connections.
Connection_RM3 * | GetConnectionAtIndex (unsigned index, WorldId worldId=0) const
Returns a connection pointer previously added with PushConnection()
Connection_RM3 * | GetConnectionBySystemAddress (const SystemAddress &sa, WorldId worldId=0) const
Returns a connection pointer previously added with PushConnection()
Connection_RM3 * | GetConnectionByGUID (RakNetGUID guid, WorldId worldId=0) const
Returns a connection pointer previously added with PushConnection.()
void | SetDefaultOrderingChannel (char def)
void | SetDefaultPacketPriority (PacketPriority def)
void | SetDefaultPacketReliability (PacketReliability def)
void | SetAutoSerializeInterval (SLNet::Time intervalMS)
void | GetConnectionsThatHaveReplicaConstructed (Replica3 *replica, DataStructures::List< Connection_RM3 * > &connectionsThatHaveConstructedThisReplica, WorldId worldId=0)
Return the connections that we think have an instance of the specified Replica3 instance.
bool | GetAllConnectionDownloadsCompleted (WorldId worldId=0) const
Returns if GetDownloadWasCompleted() returns true for all connections.
void | AddWorld (WorldId worldId)
ReplicaManager3 can support multiple worlds, where each world has a separate NetworkIDManager, list of connections, replicas, etc A world with id 0 is created automatically. If you want multiple worlds, use this function, and ReplicaManager3::SetNetworkIDManager() to have a different NetworkIDManager instance per world.
void | RemoveWorld (WorldId worldId)
Deallocate a world added with AddWorld, or the default world with id 0 Deallocating a world will also stop tracking and updating all connections and replicas associated with that world.
WorldId | GetWorldIdAtIndex (unsigned int index)
Get one of the WorldId values added with AddWorld()
unsigned int | GetWorldCount (void) const
Returns the number of world id specifiers in memory, added with AddWorld() and removed with RemoveWorld()
void | SetNetworkIDManager (NetworkIDManager *_networkIDManager, WorldId worldId=0)
NetworkIDManager * | GetNetworkIDManager (WorldId worldId=0) const
void | BroadcastDestructionList (DataStructures::List< Replica3 * > &replicaListSource, const SystemAddress &exclusionAddress, WorldId worldId=0)
void | BroadcastDestruction (Replica3 *replica, const SystemAddress &exclusionAddress)
void | Clear (bool deleteWorlds=false)
PRO | GetDefaultSendParameters (void) const
virtual void | Update (void)
Call interfaces, send data.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnDetach (void)
Called when the interface is detached.
PluginReceiveResult | OnConstruction (Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId)
PluginReceiveResult | OnSerialize (Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, SLNet::Time timestamp, unsigned char packetDataOffset, WorldId worldId)
PluginReceiveResult | OnDownloadStarted (Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId)
PluginReceiveResult | OnDownloadComplete (Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId)
void | DeallocReplicaNoBroadcastDestruction (SLNet::Connection_RM3 *connection, SLNet::Replica3 *replica3)
SLNet::Connection_RM3 * | PopConnection (unsigned int index, WorldId worldId)
Replica3 * | GetReplicaByNetworkID (NetworkID networkId, WorldId worldId)
unsigned int | ReferenceInternal (SLNet::Replica3 *replica3, WorldId worldId)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

PRO defaultSendParameters
SLNet::Time autoSerializeInterval
SLNet::Time lastAutoSerializeOccurance
bool | autoCreateConnections
bool | autoDestroyConnections
Replica3 * currentlyDeallocatingReplica
uint32_t nextReferenceIndex
RM3World * | worldsArray [255]
DataStructures::List< RM3World * > worldsList
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::ReplicaManager3::ReplicaManager3 ( )
virtual SLNet::ReplicaManager3::~ReplicaManager3 ( )
virtual

Member Function Documentation

void SLNet::ReplicaManager3::AddWorld ( WorldId worldId )

ReplicaManager3 can support multiple worlds, where each world has a separate NetworkIDManager, list of connections, replicas, etc A world with id 0 is created automatically. If you want multiple worlds, use this function, and ReplicaManager3::SetNetworkIDManager() to have a different NetworkIDManager instance per world.

Parameters
[in] worldId A unique identifier for this world. User-defined
virtual Connection_RM3* SLNet::ReplicaManager3::AllocConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID
 | ) |  | const
 pure virtual

Implement to return a game specific derivation of Connection_RM3.

The connection object represents a remote system connected to you that is using the ReplicaManager3 system.
It has functions to perform operations per-connection.
AllocConnection() and DeallocConnection() are factory functions to create and destroy instances of the connection object.
It is used if autoCreate is true via SetAutoManageConnections() (true by default). Otherwise, the function is not called, and you will have to call PushConnection() manually

Note
If you do not want a new network connection to immediately download game objects, SetAutoManageConnections() and PushConnection() are how you do this.
See Also
SetAutoManageConnections()
Parameters
[in] | systemAddress | Address of the system you are adding
[in] | rakNetGUID | GUID of the system you are adding. See Packet::rakNetGUID or RakPeerInterface::GetGUIDFromSystemAddress()
Returns
The new connection instance.
void SLNet::ReplicaManager3::AutoCreateConnectionList | ( | DataStructures::List< RakNetGUID > & | participantListIn,
 |  | DataStructures::List< Connection_RM3 * > & | participantListOut,
 |  | WorldId | worldId = 0
 | ) |  |

Call AllocConnection() and PushConnection() for each connection in participantList.

Parameters
[in] | participantListIn | The list of connections to allocate
[in] | participantListOut | The connections allocated, if any
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
void SLNet::ReplicaManager3::BroadcastDestruction | ( | Replica3 * | replica,
 |  | const SystemAddress & | exclusionAddress
 | ) |  |
void SLNet::ReplicaManager3::BroadcastDestructionList | ( | DataStructures::List< Replica3 * > & | replicaListSource,
 |  | const SystemAddress & | exclusionAddress,
 |  | WorldId | worldId = 0
 | ) |  |

Send a network command to destroy one or more Replica3 instances Usually you won't need this, but use Replica3::BroadcastDestruction() instead. The objects are unaffected locally

Parameters
[in] | replicaList | List of Replica3 objects to tell other systems to destroy.
[in] | exclusionAddress | Which system to not send to. UNASSIGNED_SYSTEM_ADDRESS to send to all.
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
void SLNet::ReplicaManager3::Clear ( bool deleteWorlds = false )
virtual void SLNet::ReplicaManager3::DeallocConnection ( Connection_RM3 * connection ) const
pure virtual

Implement to destroy a class instanced returned by AllocConnection()

Most likely just implement as {delete connection;}
It is used if autoDestroy is true via SetAutoManageConnections() (true by default). Otherwise, the function is not called and you would then be responsible for deleting your own connection objects.

Parameters
[in] connection The pointer instance to delete
void SLNet::ReplicaManager3::DeallocReplicaNoBroadcastDestruction | ( | SLNet::Connection_RM3 * | connection,
 |  | SLNet::Replica3 * | replica3
 | ) |  |
protected
void SLNet::ReplicaManager3::Dereference | ( | SLNet::Replica3 * | replica3,
 |  | WorldId | worldId = 0
 | ) |  |

Removes a replicated object from the system.

The object is not deallocated, it is up to the caller to do so.
This is called automatically from the destructor of Replica3, so you don't need to call it manually unless you want to stop tracking an object before it is destroyed.

Parameters
[in] | replica3 | The object to stop tracking
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
void SLNet::ReplicaManager3::DereferenceList | ( | DataStructures::List< Replica3 * > & | replicaListIn,
 |  | WorldId | worldId = 0
 | ) |  |

Removes multiple replicated objects from the system.

Same as Dereference(), but for a list of objects.
Useful with the lists returned by GetReplicasCreatedByGuid(), GetReplicasCreatedByMe(), or GetReferencedReplicaList().

Parameters
[in] | replicaListIn | List of objects
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
bool SLNet::ReplicaManager3::GetAllConnectionDownloadsCompleted ( WorldId worldId = 0 ) const

Returns if GetDownloadWasCompleted() returns true for all connections.

Parameters
[in] worldId Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
Returns
True when all downloads have been completed
bool SLNet::ReplicaManager3::GetAutoCreateConnections ( void ) const
Returns
What was passed to the autoCreate parameter of SetAutoManageConnections()
bool SLNet::ReplicaManager3::GetAutoDestroyConnections ( void ) const
Returns
What was passed to the autoDestroy parameter of SetAutoManageConnections()
Connection_RM3* SLNet::ReplicaManager3::GetConnectionAtIndex | ( | unsigned | index,
 |  | WorldId | worldId = 0
 | ) |  | const

Returns a connection pointer previously added with PushConnection()

Parameters
[in] | index | An index, from 0 to GetConnectionCount()-1.
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
Returns
A Connection_RM3 pointer
Connection_RM3* SLNet::ReplicaManager3::GetConnectionByGUID | ( | RakNetGUID | guid,
 |  | WorldId | worldId = 0
 | ) |  | const

Returns a connection pointer previously added with PushConnection.()

Parameters
[in] | guid | The guid of the connection to return
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
Returns
A Connection_RM3 pointer, or 0 if not found
Connection_RM3* SLNet::ReplicaManager3::GetConnectionBySystemAddress | ( | const SystemAddress & | sa,
 |  | WorldId | worldId = 0
 | ) |  | const

Returns a connection pointer previously added with PushConnection()

Parameters
[in] | sa | The system address of the connection to return
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
Returns
A Connection_RM3 pointer, or 0 if not found
unsigned int SLNet::ReplicaManager3::GetConnectionCount ( WorldId worldId = 0 ) const

Returns the number of connections.

Returns the number of connections added with ReplicaManager3::PushConnection(), minus the number removed with ReplicaManager3::PopConnection()

Parameters
[in] worldId Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
Returns
The number of registered connections
void SLNet::ReplicaManager3::GetConnectionsThatHaveReplicaConstructed | ( | Replica3 * | replica,
 |  | DataStructures::List< Connection_RM3 * > & | connectionsThatHaveConstructedThisReplica,
 |  | WorldId | worldId = 0
 | ) |  |

Return the connections that we think have an instance of the specified Replica3 instance.

This can be wrong, for example if that system locally deleted the outside the scope of ReplicaManager3, if QueryRemoteConstruction() returned false, or if DeserializeConstruction() returned false.

Parameters
[in] | replica | The replica to check against.
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
[out] | connectionsThatHaveConstructedThisReplica | Populated with connection instances that we believe have replica allocated
PRO SLNet::ReplicaManager3::GetDefaultSendParameters ( void ) const
NetworkIDManager* SLNet::ReplicaManager3::GetNetworkIDManager ( WorldId worldId = 0 ) const

Returns what was passed to SetNetworkIDManager(), or the instance on RakPeerInterface if unset.

Parameters
[in] worldId Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
void SLNet::ReplicaManager3::GetReferencedReplicaList | ( | DataStructures::List< Replica3 * > & | replicaListOut,
 |  | WorldId | worldId = 0
 | ) |  |

Returns the entire list of Replicas that we know about.

This is all Replica3 instances passed to Reference, as well as instances we downloaded and created via Connection_RM3::AllocReference()

Parameters
[out] | List | of Replica3 instances to be returned
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
Replica3* SLNet::ReplicaManager3::GetReplicaAtIndex | ( | unsigned | index,
 |  | WorldId | worldId = 0
 | ) |  |

Returns a replica by index.

Returns one of the items in the list that would be returned by GetReferencedReplicaList()

Parameters
[in] | index | An index, from 0 to GetReplicaCount()-1.
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
Returns
A Replica3 instance
Replica3* SLNet::ReplicaManager3::GetReplicaByNetworkID | ( | NetworkID | networkId,
 |  | WorldId | worldId
 | ) |  |
protected
unsigned SLNet::ReplicaManager3::GetReplicaCount ( WorldId worldId = 0 ) const

Returns the number of replicas known about.

Returns the size of the list that would be returned by GetReferencedReplicaList()

Parameters
[in] worldId Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
Returns
How many replica objects are in the list of replica objects
void SLNet::ReplicaManager3::GetReplicasCreatedByGuid | ( | RakNetGUID | guid,
 |  | DataStructures::List< Replica3 * > & | replicaListOut,
 |  | WorldId | worldId = 0
 | ) |  |

Returns all objects originally created by a particular system.

Originally created is defined as the value of Replica3::creatingSystemGUID, which is automatically assigned in ReplicaManager3::Reference().
You do not have to be directly connected to that system to get the objects originally created by that system.

Parameters
[in] | guid | GUID of the system we are referring to. Originally passed as the guid parameter to ReplicaManager3::AllocConnection()
[out] | List | of Replica3 instances to be returned
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
void SLNet::ReplicaManager3::GetReplicasCreatedByMe | ( | DataStructures::List< Replica3 * > & | replicaListOut,
 |  | WorldId | worldId = 0
 | ) |  |

Returns all objects originally created by your system.

Calls GetReplicasCreatedByGuid() for your own system guid.

Parameters
[out] | List | of Replica3 instances to be returned
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
unsigned int SLNet::ReplicaManager3::GetWorldCount ( void ) const

Returns the number of world id specifiers in memory, added with AddWorld() and removed with RemoveWorld()

Returns
The number of worlds added
WorldId SLNet::ReplicaManager3::GetWorldIdAtIndex ( unsigned int index )

Get one of the WorldId values added with AddWorld()

WorldId 0 is created by default. Worlds will not necessarily be in the order added with AddWorld(). Edit RemoveWorld() changing RemoveAtIndexFast() to RemoveAtIndex() to preserve order.

Parameters
[in] index A value between 0 and GetWorldCount()-1
Returns
One of the WorldId values added with AddWorld()
virtual void SLNet::ReplicaManager3::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
protectedvirtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

PluginReceiveResult SLNet::ReplicaManager3::OnConstruction | ( | Packet * | packet,
 |  | unsigned char * | packetData,
 |  | int | packetDataLength,
 |  | RakNetGUID | senderGuid,
 |  | unsigned char | packetDataOffset,
 |  | WorldId | worldId
 | ) |  |
protected
virtual void SLNet::ReplicaManager3::OnDetach ( void )
protectedvirtual

Called when the interface is detached.

Reimplemented from SLNet::PluginInterface2.

PluginReceiveResult SLNet::ReplicaManager3::OnDownloadComplete | ( | Packet * | packet,
 |  | unsigned char * | packetData,
 |  | int | packetDataLength,
 |  | RakNetGUID | senderGuid,
 |  | unsigned char | packetDataOffset,
 |  | WorldId | worldId
 | ) |  |
protected
PluginReceiveResult SLNet::ReplicaManager3::OnDownloadStarted | ( | Packet * | packet,
 |  | unsigned char * | packetData,
 |  | int | packetDataLength,
 |  | RakNetGUID | senderGuid,
 |  | unsigned char | packetDataOffset,
 |  | WorldId | worldId
 | ) |  |
protected
virtual void SLNet::ReplicaManager3::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
protectedvirtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::ReplicaManager3::OnRakPeerShutdown ( void )
protectedvirtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::ReplicaManager3::OnReceive ( Packet * packet )
protectedvirtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

PluginReceiveResult SLNet::ReplicaManager3::OnSerialize | ( | Packet * | packet,
 |  | unsigned char * | packetData,
 |  | int | packetDataLength,
 |  | RakNetGUID | senderGuid,
 |  | SLNet::Time | timestamp,
 |  | unsigned char | packetDataOffset,
 |  | WorldId | worldId
 | ) |  |
protected
SLNet::Connection_RM3* SLNet::ReplicaManager3::PopConnection | ( | RakNetGUID | guid,
 |  | WorldId | worldId = 0
 | ) |  |

Stop tracking a connection.

On call, for each replica returned by GetReplicasCreatedByGuid(), QueryActionOnPopConnection() will be called. Depending on the return value, this may delete the corresponding replica.
If autoDestroy is true in the call to SetAutoManageConnections() (true by default) then this is called automatically when the connection is lost. In that case, the returned connection instance is deleted.

Parameters
[in] | guid | of the connection to get. Passed to ReplicaManager3::AllocConnection() originally.
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
SLNet::Connection_RM3* SLNet::ReplicaManager3::PopConnection | ( | unsigned int | index,
 |  | WorldId | worldId
 | ) |  |
protected
bool SLNet::ReplicaManager3::PushConnection | ( | SLNet::Connection_RM3 * | newConnection,
 |  | WorldId | worldId = 0
 | ) |  |

Track a new Connection_RM3 instance.

If autoCreate is false for SetAutoManageConnections(), then you need this function to add new instances of Connection_RM3 yourself.
You don't need to track this pointer yourself, you can get it with GetConnectionAtIndex(), GetConnectionByGUID(), or GetConnectionBySystemAddress().

Parameters
[in] | newConnection | The new connection instance to track.
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
void SLNet::ReplicaManager3::Reference | ( | SLNet::Replica3 * | replica3,
 |  | WorldId | worldId = 0
 | ) |  |

Adds a replicated object to the system.

Anytime you create a new object that derives from Replica3, and you want ReplicaManager3 to use it, pass it to Reference().
Remote systems already connected will potentially download this object the next time ReplicaManager3::Update() is called, which happens every time you call RakPeerInterface::Receive().
You can also call ReplicaManager3::Update() manually to send referenced objects right away

Parameters
[in] | replica3 | The object to start tracking
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
unsigned int SLNet::ReplicaManager3::ReferenceInternal | ( | SLNet::Replica3 * | replica3,
 |  | WorldId | worldId
 | ) |  |
protected
void SLNet::ReplicaManager3::RemoveWorld ( WorldId worldId )

Deallocate a world added with AddWorld, or the default world with id 0 Deallocating a world will also stop tracking and updating all connections and replicas associated with that world.

Parameters
[in] worldId A worldId value previously added with AddWorld()
void SLNet::ReplicaManager3::SetAutoManageConnections | ( | bool | autoCreate,
 |  | bool | autoDestroy
 | ) |  |

Enable or disable automatically assigning connections to new instances of Connection_RM3.

ReplicaManager3 can automatically create and/or destroy Connection_RM3 as systems connect or disconnect from RakPeerInterface.
By default this is on, to make the system easier to learn and setup.
If you don't want all connections to take part in the game, or you want to delay when a connection downloads the game, set autoCreate to false.
If you want to delay deleting a connection that has dropped, set autoDestroy to false. If you do this, then you must call PopConnection() to remove that connection from being internally tracked. You'll also have to delete the connection instance on your own.

Parameters
[in] | autoCreate | Automatically call ReplicaManager3::AllocConnection() for each new connection. Defaults to true. Also see AutoCreateConnectionList()
[in] | autoDestroy | Automatically call ReplicaManager3::DeallocConnection() for each dropped connection. Defaults to true.
void SLNet::ReplicaManager3::SetAutoSerializeInterval ( SLNet::Time intervalMS )

Every intervalMS milliseconds, Connection_RM3::OnAutoserializeInterval() will be called.
Defaults to 30.
Pass with <0 to disable. Pass 0 to Serialize() every time RakPeer::Recieve() is called
If you want to control the update interval with more granularity, use the return values from Replica3::Serialize().

Parameters
[in] intervalMS How frequently to autoserialize all objects. This controls the maximum number of game object updates per second.
void SLNet::ReplicaManager3::SetDefaultOrderingChannel ( char def )
Parameters
[in] Default ordering channel to use for object creation, destruction, and serializations
void SLNet::ReplicaManager3::SetDefaultPacketPriority ( PacketPriority def )
Parameters
[in] Default packet priority to use for object creation, destruction, and serializations
void SLNet::ReplicaManager3::SetDefaultPacketReliability ( PacketReliability def )
Parameters
[in] Default packet reliability to use for object creation, destruction, and serializations
void SLNet::ReplicaManager3::SetNetworkIDManager | ( | NetworkIDManager * | _networkIDManager,
 |  | WorldId | worldId = 0
 | ) |  |

Sets the networkIDManager instance that this plugin relys upon.
Uses whatever instance is attached to RakPeerInterface if unset.
To support multiple worlds, you should set it to a different manager for each instance of the plugin

Parameters
[in] | _networkIDManager | The externally allocated NetworkIDManager instance for this plugin to use.
[in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
virtual void SLNet::ReplicaManager3::Update ( void )
virtual

Call interfaces, send data.

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

bool SLNet::ReplicaManager3::autoCreateConnections
protected

Definition at line 342 of file ReplicaManager3.h.

bool SLNet::ReplicaManager3::autoDestroyConnections
protected

Definition at line 342 of file ReplicaManager3.h.

SLNet::Time SLNet::ReplicaManager3::autoSerializeInterval
protected

Definition at line 340 of file ReplicaManager3.h.

Replica3* SLNet::ReplicaManager3::currentlyDeallocatingReplica
protected

Definition at line 343 of file ReplicaManager3.h.

PRO SLNet::ReplicaManager3::defaultSendParameters
protected

Definition at line 339 of file ReplicaManager3.h.

SLNet::Time SLNet::ReplicaManager3::lastAutoSerializeOccurance
protected

Definition at line 341 of file ReplicaManager3.h.

uint32_t SLNet::ReplicaManager3::nextReferenceIndex
protected

Definition at line 346 of file ReplicaManager3.h.

RM3World* SLNet::ReplicaManager3::worldsArray[255]
protected

Definition at line 349 of file ReplicaManager3.h.

DataStructures::List<RM3World *> SLNet::ReplicaManager3::worldsList
protected

Definition at line 351 of file ReplicaManager3.h.

struct SLNet::LastSerializationResultBS

Definition at line 359 of file ReplicaManager3.h.

Class Members
BitStream | bitStream
bool | indicesToSend
struct SLNet::LastSerializationResult

Represents the serialized data for an object the last time it was sent. Used by Connection_RM3::OnAutoserializeInterval() and Connection_RM3::SendSerializeIfChanged()

Definition at line 367 of file ReplicaManager3.h.

Public Member Functions

LastSerializationResult ()
~LastSerializationResult ()
void AllocBS (void)

Public Attributes

SLNet::Replica3 * replica
SLNet::Time whenLastSerialized
LastSerializationResultBS * lastSerializationResultBS

Constructor & Destructor Documentation

SLNet::LastSerializationResult::LastSerializationResult ( )
SLNet::LastSerializationResult::~LastSerializationResult ( )

Member Function Documentation

void SLNet::LastSerializationResult::AllocBS ( void )

Member Data Documentation

LastSerializationResultBS* SLNet::LastSerializationResult::lastSerializationResultBS

Definition at line 380 of file ReplicaManager3.h.

SLNet::Replica3* SLNet::LastSerializationResult::replica

The replica instance we serialized

Note
replica MUST be the first member of this struct because I cast from replica to LastSerializationResult in Update()

Definition at line 374 of file ReplicaManager3.h.

SLNet::Time SLNet::LastSerializationResult::whenLastSerialized

Definition at line 377 of file ReplicaManager3.h.

struct SLNet::SerializeParameters

Parameters passed to Replica3::Serialize()

Definition at line 385 of file ReplicaManager3.h.

Class Members
BitSize_t | bitsWrittenSoFar | For prior serializations this tick, for the same connection, how many bits have we written so far? Use this to limit how many objects you send to update per-tick if desired
Time | curTime | Current time, in milliseconds. curTime - whenLastSerialized is how long it has been since this object was last sent
Connection_RM3 * | destinationConnection | Passed to RakPeerInterface::Send().
BitStream * | lastSentBitstream | Last bitstream we sent for this replica to this system. Read, but DO NOT MODIFY
Time | messageTimestamp | Set to non-zero to transmit a timestamp with this message. Defaults to 0 Use SLNet::GetTime() for this
BitStream | outputBitstream | Write your output for serialization here If nothing is written, the serialization will not occur Write to any or all of the NUM_OUTPUT_BITSTREAM_CHANNELS channels available. Channels can hold independent data
PRO | pro | Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultPacketPriority(). Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultPacketReliability(). Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultOrderingChannel().
Time | whenLastSerialized | When this object was last serialized to the connection 0 means never
struct SLNet::DeserializeParameters

Definition at line 423 of file ReplicaManager3.h.

Class Members
bool | bitstreamWrittenTo
BitStream | serializationBitstream
Connection_RM3 * | sourceConnection
Time | timeStamp
class SLNet::Connection_RM3

Each remote system is represented by Connection_RM3. Used to allocate Replica3 and track which instances have been allocated.

Important function: AllocReplica() - must be overridden to create an object given an identifier for that object, which you define for all objects in your game

Definition at line 442 of file ReplicaManager3.h.

Public Types

enum | ConstructionMode { QUERY_REPLICA_FOR_CONSTRUCTION, QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION, QUERY_CONNECTION_FOR_REPLICA_LIST }
List of enumerations for how to get the list of valid objects for other systems. More...

Public Member Functions

Connection_RM3 (const SystemAddress &_systemAddress, RakNetGUID _guid)
virtual | ~Connection_RM3 ()
virtual Replica3 * | AllocReplica (SLNet::BitStream *allocationIdBitstream, ReplicaManager3 *replicaManager3)=0
Class factory to create a Replica3 instance, given a user-defined identifier.
virtual void | GetConstructedReplicas (DataStructures::List< Replica3 * > &objectsTheyDoHave)
Get list of all replicas that are constructed for this connection.
bool | HasReplicaConstructed (SLNet::Replica3 *replica)
virtual void | SerializeOnDownloadStarted (SLNet::BitStream *bitStream)
virtual void | DeserializeOnDownloadStarted (SLNet::BitStream *bitStream)
virtual void | SerializeOnDownloadComplete (SLNet::BitStream *bitStream)
virtual void | DeserializeOnDownloadComplete (SLNet::BitStream *bitStream)
SystemAddress | GetSystemAddress (void) const
RakNetGUID | GetRakNetGUID (void) const
bool | GetDownloadWasCompleted (void) const
virtual bool | QueryGroupDownloadMessages (void) const
Return whether or not downloads to our system should all be processed the same tick (call to RakPeer::Receive() )
virtual ConstructionMode | QueryConstructionMode (void) const
Queries how to get the list of objects that exist on remote systems.
virtual void | QueryReplicaList (DataStructures::List< Replica3 * > &newReplicasToCreate, DataStructures::List< Replica3 * > &existingReplicasToDestroy)
Callback used when QueryConstructionMode() returns QUERY_CONNECTION_FOR_REPLICA_LIST.
virtual bool | QuerySerializationList (DataStructures::List< Replica3 * > &replicasToSerialize)
Override which replicas to serialize and in what order for a connection for a ReplicaManager3::Update() cycle.
virtual
SendSerializeIfChangedResult 		SendSerialize (SLNet::Replica3 *replica, bool indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::BitStream serializationData[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time timestamp, PRO sendParameters[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::RakPeerInterface *rakPeer, unsigned char worldId, SLNet::Time curTime)
virtual
SendSerializeIfChangedResult 		SendSerializeIfChanged (LastSerializationResult *lsr, SerializeParameters *sp, SLNet::RakPeerInterface *rakPeer, unsigned char worldId, ReplicaManager3 *replicaManager, SLNet::Time curTime)
virtual void | SendConstruction (DataStructures::List< Replica3 * > &newObjects, DataStructures::List< Replica3 * > &deletedObjects, PRO sendParameters, SLNet::RakPeerInterface *rakPeer, unsigned char worldId, ReplicaManager3 *replicaManager3)
void | SendValidation (SLNet::RakPeerInterface *rakPeer, WorldId worldId)
void | AutoConstructByQuery (ReplicaManager3 *replicaManager3, WorldId worldId)
void | ClearDownloadGroup (RakPeerInterface *rakPeerInterface)

Static Public Member Functions

static int | Replica3LSRComp (Replica3 *const &replica3, LastSerializationResult *const &data)

Public Attributes

bool | isValidated
bool | isFirstConstruction

Protected Member Functions

void | OnLocalReference (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnDereference (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnDownloadFromThisSystem (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnDownloadFromOtherSystem (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnNeverConstruct (unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager)
void | OnConstructToThisConnection (unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager)
void | OnConstructToThisConnection (Replica3 *replica, ReplicaManager3 *replicaManager)
void | OnNeverSerialize (LastSerializationResult *lsr, ReplicaManager3 *replicaManager)
void | OnReplicaAlreadyExists (unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager)
void | OnDownloadExisting (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnSendDestructionFromQuery (unsigned int queryToDestructIdx, ReplicaManager3 *replicaManager)
void | OnDoNotQueryDestruction (unsigned int queryToDestructIdx, ReplicaManager3 *replicaManager)
void | ValidateLists (ReplicaManager3 *replicaManager) const
void | SendSerializeHeader (SLNet::Replica3 *replica, SLNet::Time timestamp, SLNet::BitStream *bs, WorldId worldId)

Protected Attributes

SystemAddress systemAddress
RakNetGUID guid
DataStructures::OrderedList
< Replica3
*, LastSerializationResult
*, Connection_RM3::Replica3LSRComp > 		constructedReplicaList
DataStructures::List
< LastSerializationResult * > 		queryToConstructReplicaList
DataStructures::List
< LastSerializationResult * > 		queryToSerializeReplicaList
DataStructures::List
< LastSerializationResult * > 		queryToDestructReplicaList
DataStructures::List< Replica3 * > constructedReplicasCulled
DataStructures::List< Replica3 * > destroyedReplicasCulled
bool | groupConstructionAndSerialize
DataStructures::Queue< Packet * > downloadGroup
bool | gotDownloadComplete

Member Enumeration Documentation

enum SLNet::Connection_RM3::ConstructionMode

List of enumerations for how to get the list of valid objects for other systems.

Enumerator:
QUERY_REPLICA_FOR_CONSTRUCTION

For every object that does not exist on the remote system, call Replica3::QueryConstruction() every tick. Do not call Replica3::QueryDestruction() Do not call Connection_RM3::QueryReplicaList()

QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION

For every object that does not exist on the remote system, call Replica3::QueryConstruction() every tick. Based on the call, the object may be sent to the other system. For every object that does exist on the remote system, call Replica3::QueryDestruction() every tick. Based on the call, the object may be deleted on the other system. Do not call Connection_RM3::QueryReplicaList()

QUERY_CONNECTION_FOR_REPLICA_LIST

Do not call Replica3::QueryConstruction() or Replica3::QueryDestruction() Call Connection_RM3::QueryReplicaList() to determine which objects exist on remote systems This can be faster than QUERY_REPLICA_FOR_CONSTRUCTION and QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION for large worlds See GridSectorizer.h under /Source for code that can help with this

Definition at line 497 of file ReplicaManager3.h.

Constructor & Destructor Documentation

SLNet::Connection_RM3::Connection_RM3 | ( | const SystemAddress & | _systemAddress,
 |  | RakNetGUID | _guid
 | ) |  |
virtual SLNet::Connection_RM3::~Connection_RM3 ( )
virtual

Member Function Documentation

virtual Replica3* SLNet::Connection_RM3::AllocReplica | ( | SLNet::BitStream * | allocationIdBitstream,
 |  | ReplicaManager3 * | replicaManager3
 | ) |  |
pure virtual

Class factory to create a Replica3 instance, given a user-defined identifier.

Identifier is returned by Replica3::WriteAllocationID() for what type of class to create.
This is called when you download a replica from another system.
See Replica3::Dealloc for the corresponding destruction message.
Return 0 if unable to create the intended object. Note, in that case the other system will still think we have the object and will try to serialize object updates to us. Generally, you should not send objects the other system cannot create.

See Also
Replica3::WriteAllocationID(). Sample implementation:
{SLNet::RakString typeName; allocationIdBitstream->Read(typeName); if (typeName=="Soldier") return new Soldier; return 0;}
Parameters
[in] | allocationIdBitstream | user-defined bitstream uniquely identifying a game object type
[in] | replicaManager3 | Instance of ReplicaManager3 that controls this connection
Returns
The new replica instance
void SLNet::Connection_RM3::AutoConstructByQuery | ( | ReplicaManager3 * | replicaManager3,
 |  | WorldId | worldId
 | ) |  |
void SLNet::Connection_RM3::ClearDownloadGroup ( RakPeerInterface * rakPeerInterface )
virtual void SLNet::Connection_RM3::DeserializeOnDownloadComplete ( SLNet::BitStream * bitStream )
inlinevirtual

Receives whatever was written in DeserializeOnDownloadComplete()

Parameters
[in] bitStream Written in SerializeOnDownloadComplete()

Definition at line 485 of file ReplicaManager3.h.

virtual void SLNet::Connection_RM3::DeserializeOnDownloadStarted ( SLNet::BitStream * bitStream )
inlinevirtual

Receives whatever was written in SerializeOnDownloadStarted()

Parameters
[in] bitStream Written in SerializeOnDownloadStarted()

Definition at line 477 of file ReplicaManager3.h.

virtual void SLNet::Connection_RM3::GetConstructedReplicas ( DataStructures::List< Replica3 * > & objectsTheyDoHave )
virtual

Get list of all replicas that are constructed for this connection.

Parameters
[out] objectsTheyDoHave Destination list. Returned in sorted ascending order, sorted on the value of the Replica3 pointer.
bool SLNet::Connection_RM3::GetDownloadWasCompleted ( void ) const
inline
Returns
True if ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE arrived for this connection

Definition at line 494 of file ReplicaManager3.h.

RakNetGUID SLNet::Connection_RM3::GetRakNetGUID ( void ) const
inline
Returns
Returns the RakNetGUID passed to the constructor of this object

Definition at line 491 of file ReplicaManager3.h.

SystemAddress SLNet::Connection_RM3::GetSystemAddress ( void ) const
inline
Returns
The system address passed to the constructor of this object

Definition at line 488 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::HasReplicaConstructed ( SLNet::Replica3 * replica )

Returns true if we think this remote connection has this replica constructed

Parameters
[in] replica3 Which replica we are querying
Returns
True if constructed, false othewise
void SLNet::Connection_RM3::OnConstructToThisConnection | ( | unsigned int | queryToConstructIdx,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnConstructToThisConnection | ( | Replica3 * | replica,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnDereference | ( | Replica3 * | replica3,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnDoNotQueryDestruction | ( | unsigned int | queryToDestructIdx,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnDownloadExisting | ( | Replica3 * | replica3,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnDownloadFromOtherSystem | ( | Replica3 * | replica3,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnDownloadFromThisSystem | ( | Replica3 * | replica3,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnLocalReference | ( | Replica3 * | replica3,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnNeverConstruct | ( | unsigned int | queryToConstructIdx,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnNeverSerialize | ( | LastSerializationResult * | lsr,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnReplicaAlreadyExists | ( | unsigned int | queryToConstructIdx,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
void SLNet::Connection_RM3::OnSendDestructionFromQuery | ( | unsigned int | queryToDestructIdx,
 |  | ReplicaManager3 * | replicaManager
 | ) |  |
protected
virtual ConstructionMode SLNet::Connection_RM3::QueryConstructionMode ( void ) const
inlinevirtual

Queries how to get the list of objects that exist on remote systems.

The default of calling QueryConstruction for every known object is easy to use, but not efficient, especially for large worlds where many objects are outside of the player's circle of influence.
QueryDestruction is also not necessarily useful or efficient, as object destruction tends to happen in known cases, and can be accomplished by calling Replica3::BroadcastDestruction() QueryConstructionMode() allows you to specify more efficient algorithms than the default when overriden.

Returns
How to get the list of objects that exist on the remote system. You should always return the same value for a given connection

Definition at line 531 of file ReplicaManager3.h.

virtual bool SLNet::Connection_RM3::QueryGroupDownloadMessages ( void ) const
inlinevirtual

Return whether or not downloads to our system should all be processed the same tick (call to RakPeer::Receive() )

Normally the system will send ID_REPLICA_MANAGER_DOWNLOAD_STARTED, ID_REPLICA_MANAGER_CONSTRUCTION for all downloaded objects, ID_REPLICA_MANAGER_SERIALIZE for each downloaded object, and lastly ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE. This enables the application to show a downloading splash screen on ID_REPLICA_MANAGER_DOWNLOAD_STARTED, a progress bar, and to close the splash screen and activate all objects on ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE However, if the application was not set up for this then it would result in incomplete objects spread out over time, and cause problems If you return true from QueryGroupDownloadMessages(), then these messages will be returned all in one tick, returned only when the download is complete

Note
ID_REPLICA_MANAGER_DOWNLOAD_STARTED calls the callback DeserializeOnDownloadStarted()
ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE calls the callback DeserializeOnDownloadComplete()

Definition at line 524 of file ReplicaManager3.h.

virtual void SLNet::Connection_RM3::QueryReplicaList | ( | DataStructures::List< Replica3 * > & | newReplicasToCreate,
 |  | DataStructures::List< Replica3 * > & | existingReplicasToDestroy
 | ) |  |
inlinevirtual

Callback used when QueryConstructionMode() returns QUERY_CONNECTION_FOR_REPLICA_LIST.

This advantage of this callback is if that there are many objects that a particular connection does not have, then we do not have to iterate through those objects calling QueryConstruction() for each of them.
BR> See GridSectorizer in the Source directory as a method to find all objects within a certain radius in a fast way.
BR>

Parameters
[out] | newReplicasToCreate | Anything in this list will be created on the remote system
[out] | existingReplicasToDestroy | Anything in this list will be destroyed on the remote system

Definition at line 541 of file ReplicaManager3.h.

virtual bool SLNet::Connection_RM3::QuerySerializationList ( DataStructures::List< Replica3 * > & replicasToSerialize )
inlinevirtual

Override which replicas to serialize and in what order for a connection for a ReplicaManager3::Update() cycle.

By default, Connection_RM3 will iterate through queryToSerializeReplicaList and call QuerySerialization() on each Replica in that list queryToSerializeReplicaList is populated in the order in which ReplicaManager3::Reference() is called for those objects. If you write to to replicasToSerialize and return true, you can control in what order and for which replicas to call QuerySerialization() Example use case: We have more data to send then the bandwidth supports, so want to prioritize sends. For example enemies shooting are more important than animation effects When QuerySerializationList(), sort objects by priority, and write the list to replicasToSerialize, optionally skipping objects with a lower serialization frequency If you hit your bandwidth limit when checking SerializeParameters::bitsWrittenSoFar, you can return RM3SR_DO_NOT_SERIALIZE for all remaining items

Note
Only replicas written to replicasToSerialize are transmitted. Even if you returned RM3SR_SERIALIZED_ALWAYS a prior ReplicaManager3::Update() cycle, the replica will not be transmitted if it is not in replicasToSerialize
If you do not know what objects are candidates for serialization, you can use queryToSerializeReplicaList as a source for your filtering or sorting operations
Parameters
[in] replicasToSerialize List of replicas to call QuerySerialization() on
Returns
Return true to use replicasToSerialize (replicasToSerialize may be empty if desired). Otherwise return false.

Definition at line 557 of file ReplicaManager3.h.

static int SLNet::Connection_RM3::Replica3LSRComp | ( | Replica3 *const & | replica3,
 |  | LastSerializationResult *const & | data
 | ) |  |
static
virtual void SLNet::Connection_RM3::SendConstruction | ( | DataStructures::List< Replica3 * > & | newObjects,
 |  | DataStructures::List< Replica3 * > & | deletedObjects,
 |  | PRO | sendParameters,
 |  | SLNet::RakPeerInterface * | rakPeer,
 |  | unsigned char | worldId,
 |  | ReplicaManager3 * | replicaManager3
 | ) |  |
virtual
virtual SendSerializeIfChangedResult SLNet::Connection_RM3::SendSerialize | ( | SLNet::Replica3 * | replica,
 |  | bool | indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS],
 |  | SLNet::BitStream | serializationData[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS],
 |  | SLNet::Time | timestamp,
 |  | PRO | sendParameters[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS],
 |  | SLNet::RakPeerInterface * | rakPeer,
 |  | unsigned char | worldId,
 |  | SLNet::Time | curTime
 | ) |  |
virtual
void SLNet::Connection_RM3::SendSerializeHeader | ( | SLNet::Replica3 * | replica,
 |  | SLNet::Time | timestamp,
 |  | SLNet::BitStream * | bs,
 |  | WorldId | worldId
 | ) |  |
protected
virtual SendSerializeIfChangedResult SLNet::Connection_RM3::SendSerializeIfChanged | ( | LastSerializationResult * | lsr,
 |  | SerializeParameters * | sp,
 |  | SLNet::RakPeerInterface * | rakPeer,
 |  | unsigned char | worldId,
 |  | ReplicaManager3 * | replicaManager,
 |  | SLNet::Time | curTime
 | ) |  |
virtual
void SLNet::Connection_RM3::SendValidation | ( | SLNet::RakPeerInterface * | rakPeer,
 |  | WorldId | worldId
 | ) |  |
virtual void SLNet::Connection_RM3::SerializeOnDownloadComplete ( SLNet::BitStream * bitStream )
inlinevirtual

When a new connection connects, after constructing and serialization all objects, SerializeOnDownloadComplete() is called

Parameters
[out] bitStream Passed to DeserializeOnDownloadComplete()

Definition at line 481 of file ReplicaManager3.h.

virtual void SLNet::Connection_RM3::SerializeOnDownloadStarted ( SLNet::BitStream * bitStream )
inlinevirtual

When a new connection connects, before sending any objects, SerializeOnDownloadStarted() is called

Parameters
[out] bitStream Passed to DeserializeOnDownloadStarted()

Definition at line 473 of file ReplicaManager3.h.

void SLNet::Connection_RM3::ValidateLists ( ReplicaManager3 * replicaManager ) const
protected

Member Data Documentation

DataStructures::OrderedList<Replica3*, LastSerializationResult*, Connection_RM3::Replica3LSRComp> SLNet::Connection_RM3::constructedReplicaList
protected

Definition at line 675 of file ReplicaManager3.h.

DataStructures::List<Replica3*> SLNet::Connection_RM3::constructedReplicasCulled
protected

Definition at line 690 of file ReplicaManager3.h.

DataStructures::List<Replica3*> SLNet::Connection_RM3::destroyedReplicasCulled
protected

Definition at line 690 of file ReplicaManager3.h.

DataStructures::Queue<Packet*> SLNet::Connection_RM3::downloadGroup
protected

Definition at line 695 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::gotDownloadComplete
protected

Definition at line 698 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::groupConstructionAndSerialize
protected

Definition at line 694 of file ReplicaManager3.h.

RakNetGUID SLNet::Connection_RM3::guid
protected

Definition at line 610 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::isFirstConstruction

Definition at line 601 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::isValidated

Definition at line 599 of file ReplicaManager3.h.

DataStructures::List<LastSerializationResult*> SLNet::Connection_RM3::queryToConstructReplicaList
protected

Definition at line 680 of file ReplicaManager3.h.

DataStructures::List<LastSerializationResult*> SLNet::Connection_RM3::queryToDestructReplicaList
protected

Definition at line 687 of file ReplicaManager3.h.

DataStructures::List<LastSerializationResult*> SLNet::Connection_RM3::queryToSerializeReplicaList
protected

Definition at line 684 of file ReplicaManager3.h.

SystemAddress SLNet::Connection_RM3::systemAddress
protected

Definition at line 609 of file ReplicaManager3.h.

class SLNet::Replica3

Base class for your replicated objects for the ReplicaManager3 system.

To use, derive your class, or a member of your class, from Replica3.

Definition at line 847 of file ReplicaManager3.h.

+ Inheritance diagram for SLNet::Replica3:

Public Member Functions

Replica3 ()
virtual | ~Replica3 ()
virtual void | WriteAllocationID (SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const =0
Write a unique identifer that can be read on a remote system to create an object of this same class.
virtual RM3ConstructionState | QueryConstruction (SLNet::Connection_RM3 *destinationConnection, ReplicaManager3 *replicaManager3)=0
Ask if this object, which does not exist on destinationConnection should (now) be sent to that system.
virtual RM3DestructionState | QueryDestruction (SLNet::Connection_RM3 *destinationConnection, ReplicaManager3 *replicaManager3)
Ask if this object, which does exist on destinationConnection should be removed from the remote system.
virtual bool | QueryRemoteConstruction (SLNet::Connection_RM3 *sourceConnection)=0
We're about to call DeserializeConstruction() on this Replica3. If QueryRemoteConstruction() returns false, this object is deleted instead.
virtual bool | QueryRelayDestruction (Connection_RM3 *sourceConnection) const
We got a message from a connection to destroy this replica Return true to automatically relay the destruction message to all our other connections For a client in client/server, it does not matter what this funtion returns For a server in client/server, this should normally return true For a peer in peer to peer, you can normally return false since the original destroying peer would have told all other peers about the destruction If a system gets a destruction command for an object that was already destroyed, the destruction message is ignored.
virtual void | SerializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)=0
Write data to be sent only when the object is constructed on a remote system.
virtual bool | DeserializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)=0
Read data written by Replica3::SerializeConstruction()
virtual void | SerializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
virtual void | DeserializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
virtual void | SerializeDestruction (SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *destinationConnection)=0
Write extra data to send with the object deletion event, if desired.
virtual bool | DeserializeDestruction (SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *sourceConnection)=0
Read data written by Replica3::SerializeDestruction()
virtual
SLNet::RM3ActionOnPopConnection 		QueryActionOnPopConnection (SLNet::Connection_RM3 *droppedConnection) const =0
The system is asking what to do with this replica when the connection is dropped.
virtual void | OnPoppedConnection (SLNet::Connection_RM3 *droppedConnection)
Notification called for each of our replicas when a connection is popped.
virtual void | DeallocReplica (SLNet::Connection_RM3 *sourceConnection)=0
Override with {delete this;}.
virtual
SLNet::RM3QuerySerializationResult 		QuerySerialization (SLNet::Connection_RM3 *destinationConnection)=0
Implement with QuerySerialization_ClientSerializable(), QuerySerialization_ServerSerializable(), or QuerySerialization_PeerToPeer()
virtual void | OnUserReplicaPreSerializeTick (void)
Called for each replica owned by the user, once per Serialization tick, before Serialize() is called. If you want to do some kind of operation on the Replica objects that you own, just before Serialization(), then overload this function.
virtual RM3SerializationResult | Serialize (SLNet::SerializeParameters *serializeParameters)=0
Serialize our class to a bitstream.
virtual void | OnSerializeTransmission (SLNet::BitStream *bitStream, SLNet::Connection_RM3 *destinationConnection, BitSize_t bitsPerChannel[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time curTime)
Called when the class is actually transmitted via Serialize()
virtual void | Deserialize (SLNet::DeserializeParameters *deserializeParameters)=0
Read what was written in Serialize()
virtual void | PostSerializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
Called after SerializeConstruction completes for all objects in a given update tick.
Writes to PostDeserializeConstruction(), which is called after all objects are created for a given Construction tick(). Override to send data to PostDeserializeConstruction(), such as the NetworkID of other objects to resolve pointers to.
virtual void | PostDeserializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
virtual void | PostSerializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
Same as PostSerializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.
virtual void | PostDeserializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
Same as PostDeserializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.
virtual void | PreDestruction (SLNet::Connection_RM3 *sourceConnection)
virtual RM3ConstructionState | QueryConstruction_ClientConstruction (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
Default call for QueryConstruction().
virtual bool | QueryRemoteConstruction_ClientConstruction (SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer)
virtual RM3ConstructionState | QueryConstruction_ServerConstruction (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
Default call for QueryConstruction().
virtual bool | QueryRemoteConstruction_ServerConstruction (SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer)
Default call for QueryRemoteConstruction(). Allow the server to create this object, but not the client.
virtual RM3ConstructionState | QueryConstruction_PeerToPeer (SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER)
Default call for QueryConstruction().
virtual bool | QueryRemoteConstruction_PeerToPeer (SLNet::Connection_RM3 *sourceConnection)
Default call for QueryRemoteConstruction().
virtual
SLNet::RM3QuerySerializationResult 		QuerySerialization_ClientSerializable (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
Default call for QuerySerialization().
virtual
SLNet::RM3QuerySerializationResult 		QuerySerialization_ServerSerializable (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
Default call for QuerySerialization().
virtual
SLNet::RM3QuerySerializationResult 		QuerySerialization_PeerToPeer (SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER)
Default call for QuerySerialization().
virtual RM3ActionOnPopConnection | QueryActionOnPopConnection_Client (SLNet::Connection_RM3 *droppedConnection) const
Default: If we are a client, and the connection is lost, delete the server's objects.
virtual RM3ActionOnPopConnection | QueryActionOnPopConnection_Server (SLNet::Connection_RM3 *droppedConnection) const
Default: If we are a server, and the connection is lost, delete the client's objects and broadcast the destruction.
virtual RM3ActionOnPopConnection | QueryActionOnPopConnection_PeerToPeer (SLNet::Connection_RM3 *droppedConnection) const
Default: If we are a peer, and the connection is lost, delete the peer's objects.
virtual void | BroadcastDestruction (void)
RakNetGUID | GetCreatingSystemGUID (void) const
bool | WasReferenced (void) const
- Public Member Functions inherited from SLNet::NetworkIDObject
NetworkIDObject ()
virtual | ~NetworkIDObject ()
virtual void | SetNetworkIDManager (NetworkIDManager *manager)
virtual NetworkIDManager * | GetNetworkIDManager (void) const
Returns what was passed to SetNetworkIDManager.
virtual NetworkID | GetNetworkID (void)
virtual void | SetNetworkID (NetworkID id)
virtual void | SetParent (void *_parent)
virtual void * | GetParent (void) const

Public Attributes

RakNetGUID creatingSystemGUID
RakNetGUID deletingSystemGUID
GUID of the system that caused the item to send a deletion command over the network.
ReplicaManager3 * replicaManager
LastSerializationResultBS lastSentSerialization
bool | forceSendUntilNextUpdate
LastSerializationResult * lsr
uint32_t referenceIndex

Additional Inherited Members

- Protected Attributes inherited from SLNet::NetworkIDObject
NetworkID networkID
The network ID of this object.
NetworkIDManager * networkIDManager
void * parent
The parent set by SetParent()
NetworkIDObject * nextInstanceForNetworkIDManager

Constructor & Destructor Documentation

SLNet::Replica3::Replica3 ( )
virtual SLNet::Replica3::~Replica3 ( )
virtual

Before deleting a local instance of Replica3, call Replica3::BroadcastDestruction() for the deletion notification to go out on the network. It is not necessary to call ReplicaManager3::Dereference(), as this happens automatically in the destructor

Member Function Documentation

virtual void SLNet::Replica3::BroadcastDestruction ( void )
virtual

Call to send a network message to delete this object on other systems.
Call it before deleting the object

virtual void SLNet::Replica3::DeallocReplica ( SLNet::Connection_RM3 * sourceConnection )
pure virtual

Override with {delete this;}.

  1. Got a remote message to delete this object which passed DeserializeDestruction(), OR
  2. ReplicaManager3::SetAutoManageConnections() was called autoDestroy true (which is the default setting), and a remote system that owns this object disconnected) OR <>
    Override with {delete this;} to actually delete the object (and any other processing you wish).
    If you don't want to delete the object, just do nothing, however, the system will not know this. You may wish to call Dereference() if the object should no longer be networked, but remain in memory. You are responsible for deleting it yoruself later.
    destructionBitstream may be 0 if the object was deleted locally

Implemented in SLNet::Replica3Composite< parent_type >.

virtual void SLNet::Replica3::Deserialize ( SLNet::DeserializeParameters * deserializeParameters )
pure virtual

Read what was written in Serialize()

Reads the contents of the class from SerializationParamters::serializationBitstream.
Called whenever Serialize() is called with different data from the last send.

Parameters
[in] | serializationBitstream | Bitstream passed to Serialize()
[in] | timeStamp | 0 if unused, else contains the time the message originated on the remote system
[in] | sourceConnection | Which system sent to us

Implemented in SLNet::Replica3Composite< parent_type >.

virtual bool SLNet::Replica3::DeserializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
pure virtual

Read data written by Replica3::SerializeConstruction()

Reads whatever data was written to constructionBitstream in Replica3::SerializeConstruction()

Parameters
[out] | constructionBitstream | Bitstream written to in Replica3::SerializeConstruction()
[in] | sourceConnection | System that sent us this network message.
Returns
true to accept construction of the object. false to reject, in which case the object will be deleted via Replica3::DeallocReplica()

Implemented in SLNet::Replica3Composite< parent_type >.

virtual void SLNet::Replica3::DeserializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
inlinevirtual

Same as DeserializeConstruction(), but for an object that already exists on the remote system. Used if you return RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 924 of file ReplicaManager3.h.

virtual bool SLNet::Replica3::DeserializeDestruction | ( | SLNet::BitStream * | destructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
pure virtual

Read data written by Replica3::SerializeDestruction()

Return true to delete the object. BroadcastDestruction() will be called automatically, followed by ReplicaManager3::Dereference.
Return false to not delete it. If you delete it at a later point, you are responsible for calling BroadcastDestruction() yourself.

Implemented in SLNet::Replica3Composite< parent_type >.

RakNetGUID SLNet::Replica3::GetCreatingSystemGUID ( void ) const

creatingSystemGUID is set the first time Reference() is called, or if we get the object from another system

Returns
System that originally created this object
virtual void SLNet::Replica3::OnPoppedConnection ( SLNet::Connection_RM3 * droppedConnection )
inlinevirtual

Notification called for each of our replicas when a connection is popped.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 943 of file ReplicaManager3.h.

virtual void SLNet::Replica3::OnSerializeTransmission | ( | SLNet::BitStream * | bitStream,
 |  | SLNet::Connection_RM3 * | destinationConnection,
 |  | BitSize_t | bitsPerChannel[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS],
 |  | SLNet::Time | curTime
 | ) |  |
inlinevirtual

Called when the class is actually transmitted via Serialize()

Use to track how much bandwidth this class it taking

Definition at line 979 of file ReplicaManager3.h.

virtual void SLNet::Replica3::OnUserReplicaPreSerializeTick ( void )
inlinevirtual

Called for each replica owned by the user, once per Serialization tick, before Serialize() is called. If you want to do some kind of operation on the Replica objects that you own, just before Serialization(), then overload this function.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 966 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PostDeserializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
inlinevirtual

Called after DeserializeConstruction completes for all objects in a given update tick.
This is used to resolve dependency chains, where two objects would refer to each other in DeserializeConstruction, yet one had not been constructed yet In PostDeserializeConstruction(), you know that all objects have already been created, so can resolve NetworkIDs to pointers safely. You can also use it to trigger some sort of event when you know the object has completed deserialization.

Parameters
[in] | constructionBitstream | BitStream written in PostSerializeConstruction()
[in] | sourceConnection | System that sent us this network message.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 1000 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PostDeserializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
inlinevirtual

Same as PostDeserializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 1006 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PostSerializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
inlinevirtual

Called after SerializeConstruction completes for all objects in a given update tick.
Writes to PostDeserializeConstruction(), which is called after all objects are created for a given Construction tick(). Override to send data to PostDeserializeConstruction(), such as the NetworkID of other objects to resolve pointers to.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 992 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PostSerializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
inlinevirtual

Same as PostSerializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 1003 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PreDestruction ( SLNet::Connection_RM3 * sourceConnection )
inlinevirtual

Called after DeserializeDestruction completes for the object successfully, but obviously before the object is deleted.
Override to trigger some sort of event when you know the object has completed destruction.

Parameters
[in] sourceConnection System that sent us this network message.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 1011 of file ReplicaManager3.h.

virtual SLNet::RM3ActionOnPopConnection SLNet::Replica3::QueryActionOnPopConnection ( SLNet::Connection_RM3 * droppedConnection ) const
pure virtual

The system is asking what to do with this replica when the connection is dropped.

Return QueryActionOnPopConnection_Client, QueryActionOnPopConnection_Server, or QueryActionOnPopConnection_PeerToPeer

Implemented in SLNet::Replica3Composite< parent_type >.

virtual RM3ActionOnPopConnection SLNet::Replica3::QueryActionOnPopConnection_Client ( SLNet::Connection_RM3 * droppedConnection ) const
virtual

Default: If we are a client, and the connection is lost, delete the server's objects.

virtual RM3ActionOnPopConnection SLNet::Replica3::QueryActionOnPopConnection_PeerToPeer ( SLNet::Connection_RM3 * droppedConnection ) const
virtual

Default: If we are a peer, and the connection is lost, delete the peer's objects.

virtual RM3ActionOnPopConnection SLNet::Replica3::QueryActionOnPopConnection_Server ( SLNet::Connection_RM3 * droppedConnection ) const
virtual

Default: If we are a server, and the connection is lost, delete the client's objects and broadcast the destruction.

virtual RM3ConstructionState SLNet::Replica3::QueryConstruction | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | ReplicaManager3 * | replicaManager3
 | ) |  |
pure virtual

Ask if this object, which does not exist on destinationConnection should (now) be sent to that system.

If ReplicaManager3::QueryConstructionMode() returns QUERY_CONNECTION_FOR_REPLICA_LIST or QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION (default), then QueyrConstruction() is called once per tick from ReplicaManager3::Update() to determine if an object should exist on a given system.
Based on the return value, a network message may be sent to the other system to create the object.
If QueryConstructionMode() is overriden to return QUERY_CONNECTION_FOR_REPLICA_LIST, this function is unused.

Note
Defaults are provided: QueryConstruction_PeerToPeer(), QueryConstruction_ServerConstruction(), QueryConstruction_ClientConstruction(). Return one of these functions for a working default for the relevant topology.
Parameters
[in] | destinationConnection | Which system we will send to
[in] | replicaManager3 | Plugin instance for this Replica3
Returns
What action to take

Implemented in SLNet::Replica3Composite< parent_type >.

virtual RM3ConstructionState SLNet::Replica3::QueryConstruction_ClientConstruction | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | bool | isThisTheServer
 | ) |  |
virtual

Default call for QueryConstruction().

Both the client and the server is allowed to create this object. The network topology is client/server

Parameters
[in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
[in] | isThisTheServer | True if this system is the server, false if not.
virtual RM3ConstructionState SLNet::Replica3::QueryConstruction_PeerToPeer | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | Replica3P2PMode | p2pMode = R3P2PM_SINGLE_OWNER
 | ) |  |
virtual

Default call for QueryConstruction().

All clients are allowed to create all objects. The object is not relayed when remotely created

Parameters
[in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
[in] | p2pMode | If controlled only by this system ever, pass R3P2PM_SINGLE_OWNER. Otherwise pass R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE or R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE
virtual RM3ConstructionState SLNet::Replica3::QueryConstruction_ServerConstruction | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | bool | isThisTheServer
 | ) |  |
virtual

Default call for QueryConstruction().

Only the server is allowed to create this object. The network topology is client/server

Parameters
[in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
[in] | isThisTheServer | True if this system is the server, false if not.
virtual RM3DestructionState SLNet::Replica3::QueryDestruction | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | ReplicaManager3 * | replicaManager3
 | ) |  |
inlinevirtual

Ask if this object, which does exist on destinationConnection should be removed from the remote system.

If ReplicaManager3::QueryConstructionMode() returns QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION (default), then QueryDestruction() is called once per tick from ReplicaManager3::Update() to determine if an object that exists on a remote system should be destroyed for a given system.
Based on the return value, a network message may be sent to the other system to destroy the object.
Note that you can also destroy objects with BroadcastDestruction(), so this function is not useful unless you plan to delete objects for only a particular connection.
If QueryConstructionMode() is overriden to return QUERY_CONNECTION_FOR_REPLICA_LIST, this function is unused.

Parameters
[in] | destinationConnection | Which system we will send to
[in] | replicaManager3 | Plugin instance for this Replica3
Returns
What action to take. Only RM3CS_SEND_DESTRUCTION does anything at this time.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 883 of file ReplicaManager3.h.

References SLNet::RM3DS_DO_NOT_QUERY_DESTRUCTION.

virtual bool SLNet::Replica3::QueryRelayDestruction ( Connection_RM3 * sourceConnection ) const
inlinevirtual

We got a message from a connection to destroy this replica Return true to automatically relay the destruction message to all our other connections For a client in client/server, it does not matter what this funtion returns For a server in client/server, this should normally return true For a peer in peer to peer, you can normally return false since the original destroying peer would have told all other peers about the destruction If a system gets a destruction command for an object that was already destroyed, the destruction message is ignored.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 900 of file ReplicaManager3.h.

virtual bool SLNet::Replica3::QueryRemoteConstruction ( SLNet::Connection_RM3 * sourceConnection )
pure virtual

We're about to call DeserializeConstruction() on this Replica3. If QueryRemoteConstruction() returns false, this object is deleted instead.

By default, QueryRemoteConstruction_ServerConstruction() does not allow clients to create objects. The client will get Replica3::DeserializeConstructionRequestRejected().
If you want the client to be able to potentially create objects for client/server, override accordingly.
Other variants of QueryRemoteConstruction_* just return true.

Note
Defaults are provided: QueryRemoteConstruction_PeerToPeer(), QueryRemoteConstruction_ServerConstruction(), QueryRemoteConstruction_ClientConstruction(). Return one of these functions for a working default for the relevant topology.
Parameters
[in] sourceConnection Which system sent us the object creation request message.
Returns
True to allow the object to pass onto DeserializeConstruction() (where it may also be rejected), false to immediately reject the remote construction request

Implemented in SLNet::Replica3Composite< parent_type >.

virtual bool SLNet::Replica3::QueryRemoteConstruction_ClientConstruction | ( | SLNet::Connection_RM3 * | sourceConnection,
 |  | bool | isThisTheServer
 | ) |  |
virtual

Default call for QueryRemoteConstruction().

Both the client and the server is allowed to create this object. The network topology is client/server The code means on the client or the server, allow creation of Replica3 instances

Parameters
[in] | sourceConnection | destinationConnection parameter passed to QueryConstruction()
[in] | isThisTheServer | True if this system is the server, false if not.
virtual bool SLNet::Replica3::QueryRemoteConstruction_PeerToPeer ( SLNet::Connection_RM3 * sourceConnection )
virtual

Default call for QueryRemoteConstruction().

All clients are allowed to create all objects. The object is not relayed when remotely created

Parameters
[in] sourceConnection destinationConnection parameter passed to QueryConstruction()
virtual bool SLNet::Replica3::QueryRemoteConstruction_ServerConstruction | ( | SLNet::Connection_RM3 * | sourceConnection,
 |  | bool | isThisTheServer
 | ) |  |
virtual

Default call for QueryRemoteConstruction(). Allow the server to create this object, but not the client.

Only the server is allowed to create this object. The network topology is client/server The code means if this is the server, and I got a command to create a Replica3 to ignore it. If this is the client, to allow it.

Parameters
[in] | sourceConnection | destinationConnection parameter passed to QueryConstruction()
[in] | isThisTheServer | True if this system is the server, false if not.
virtual SLNet::RM3QuerySerializationResult SLNet::Replica3::QuerySerialization ( SLNet::Connection_RM3 * destinationConnection )
pure virtual

Implement with QuerySerialization_ClientSerializable(), QuerySerialization_ServerSerializable(), or QuerySerialization_PeerToPeer()

QuerySerialization() is a first pass query to check if a given object should serializable to a given system. The intent is that the user implements with one of the defaults for client, server, or peer to peer.
Without this function, a careless implementation would serialize an object anytime it changed to all systems. This would give you feedback loops as the sender gets the same message back from the recipient it just sent to.
If more than one system can serialize the same object then you will need to override to return true, and control the serialization result from Replica3::Serialize(). Be careful not to send back the same data to the system that just sent to you!

Returns
True to allow calling Replica3::Serialize() for this connection, false to not call.

Implemented in SLNet::Replica3Composite< parent_type >.

virtual SLNet::RM3QuerySerializationResult SLNet::Replica3::QuerySerialization_ClientSerializable | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | bool | isThisTheServer
 | ) |  |
virtual

Default call for QuerySerialization().

Use if the values you are serializing are generated by the client that owns the object. The serialization will be relayed through the server to the other clients.

Parameters
[in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
[in] | isThisTheServer | True if this system is the server, false if not.
virtual SLNet::RM3QuerySerializationResult SLNet::Replica3::QuerySerialization_PeerToPeer | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | Replica3P2PMode | p2pMode = R3P2PM_SINGLE_OWNER
 | ) |  |
virtual

Default call for QuerySerialization().

Use if the values you are serializing are on a peer to peer network. The peer that owns the object will send to all. Remote peers will not send.

Parameters
[in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
[in] | p2pMode | If controlled only by this system ever, pass R3P2PM_SINGLE_OWNER. Otherwise pass R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE or R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE
virtual SLNet::RM3QuerySerializationResult SLNet::Replica3::QuerySerialization_ServerSerializable | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | bool | isThisTheServer
 | ) |  |
virtual

Default call for QuerySerialization().

Use if the values you are serializing are generated only by the server. The serialization will be sent to all clients, but the clients will not send back to the server.

Parameters
[in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
[in] | isThisTheServer | True if this system is the server, false if not.
virtual RM3SerializationResult SLNet::Replica3::Serialize ( SLNet::SerializeParameters * serializeParameters )
pure virtual

Serialize our class to a bitstream.

User should implement this function to write the contents of this class to SerializationParamters::serializationBitstream.
If data only needs to be written once, you can write it to SerializeConstruction() instead for efficiency.
Transmitted over the network if it changed from the last time we called Serialize().
Called every time the time interval to ReplicaManager3::SetAutoSerializeInterval() elapses and ReplicaManager3::Update is subsequently called.

Parameters
in/out] serializeParameters Parameters controlling the serialization, including destination bitstream to write to
Returns
Whether to serialize, and if so, how to optimize the results

Implemented in SLNet::Replica3Composite< parent_type >.

virtual void SLNet::Replica3::SerializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
pure virtual

Write data to be sent only when the object is constructed on a remote system.

SerializeConstruction is used to write out data that you need to create this object in the context of your game, such as health, score, name. Use it for data you only need to send when the object is created.
After SerializeConstruction() is called, Serialize() will be called immediately thereafter. However, they are sent in different messages, so Serialize() may arrive a later frame than SerializeConstruction() For that reason, the object should be valid after a call to DeserializeConstruction() for at least a short time.

Note
The object's NetworkID and allocation id are handled by the system automatically, you do not need to write these values to constructionBitstream
Parameters
[out] | constructionBitstream | Destination bitstream to write your data to
[in] | destinationConnection | System that will receive this network message.

Implemented in SLNet::Replica3Composite< parent_type >.

virtual void SLNet::Replica3::SerializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
inlinevirtual

Same as SerializeConstruction(), but for an object that already exists on the remote system. Used if you return RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 920 of file ReplicaManager3.h.

virtual void SLNet::Replica3::SerializeDestruction | ( | SLNet::BitStream * | destructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
pure virtual

Write extra data to send with the object deletion event, if desired.

Replica3::SerializeDestruction() will be called to write any object destruction specific data you want to send with this event. destructionBitstream can be read in DeserializeDestruction()

Parameters
[out] | destructionBitstream | Bitstream for you to write to
[in] | destinationConnection | System that will receive this network message.

Implemented in SLNet::Replica3Composite< parent_type >.

bool SLNet::Replica3::WasReferenced ( void ) const
inline
Returns
If ReplicaManager3::Reference() was called on this object.

Definition at line 1081 of file ReplicaManager3.h.

virtual void SLNet::Replica3::WriteAllocationID | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | SLNet::BitStream * | allocationIdBitstream
 | ) |  | const
 pure virtual

Write a unique identifer that can be read on a remote system to create an object of this same class.

The value written to allocationIdBitstream will be passed to Connection_RM3::AllocReplica().
Sample implementation:
{allocationIdBitstream->Write(SLNet::RakString("Soldier");}

Parameters
[out] allocationIdBitstream Bitstream for the user to write to, to identify this class

Implemented in SLNet::Replica3Composite< parent_type >.

Member Data Documentation

RakNetGUID SLNet::Replica3::creatingSystemGUID

GUID of the system that first called Reference() on this object. Transmitted automatically when the object is constructed

Definition at line 1085 of file ReplicaManager3.h.

RakNetGUID SLNet::Replica3::deletingSystemGUID

GUID of the system that caused the item to send a deletion command over the network.

Definition at line 1087 of file ReplicaManager3.h.

bool SLNet::Replica3::forceSendUntilNextUpdate

Definition at line 1094 of file ReplicaManager3.h.

LastSerializationResultBS SLNet::Replica3::lastSentSerialization

Definition at line 1093 of file ReplicaManager3.h.

LastSerializationResult* SLNet::Replica3::lsr

Definition at line 1095 of file ReplicaManager3.h.

uint32_t SLNet::Replica3::referenceIndex

Definition at line 1096 of file ReplicaManager3.h.

ReplicaManager3* SLNet::Replica3::replicaManager

Definition at line 1091 of file ReplicaManager3.h.

struct SLNet::ReplicaManager3::RM3World

Definition at line 312 of file ReplicaManager3.h.

Public Member Functions

RM3World ()
void Clear (ReplicaManager3 *replicaManager3)

Public Attributes

DataStructures::List
< Connection_RM3 * > 		connectionList
DataStructures::List< Replica3 * > userReplicaList
WorldId worldId
NetworkIDManager * networkIDManager

Constructor & Destructor Documentation

SLNet::ReplicaManager3::RM3World::RM3World ( )

Member Function Documentation

void SLNet::ReplicaManager3::RM3World::Clear ( ReplicaManager3 * replicaManager3 )

Member Data Documentation

DataStructures::List<Connection_RM3*> SLNet::ReplicaManager3::RM3World::connectionList

Definition at line 317 of file ReplicaManager3.h.

NetworkIDManager* SLNet::ReplicaManager3::RM3World::networkIDManager

Definition at line 320 of file ReplicaManager3.h.

DataStructures::List<Replica3*> SLNet::ReplicaManager3::RM3World::userReplicaList

Definition at line 318 of file ReplicaManager3.h.

WorldId SLNet::ReplicaManager3::RM3World::worldId

Definition at line 319 of file ReplicaManager3.h.

Typedef Documentation

typedef uint8_t SLNet::WorldId

Used for multiple worlds. World 0 is created automatically by default

Used for multiple worlds.

Definition at line 44 of file ReplicaManager3.h.

Enumeration Type Documentation

enum SLNet::Replica3P2PMode

Used for Replica3::QueryConstruction_PeerToPeer() and Replica3::QuerySerialization_PeerToPeer() to describe how the object replicates between hosts

Enumerator:
R3P2PM_SINGLE_OWNER

The Replica3 instance is constructed and serialized by one system only. Example: Your avatar. No other player serializes or can create your avatar.

R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE

The Replica3 instance is constructed and/or serialized by different systems This system is currently in charge of construction and/or serialization Example: A pickup. When an avatar holds it, that avatar controls it. When it is on the ground, the host controls it.

R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE

The Replica3 instance is constructed and/or serialized by different systems Another system is in charge of construction and/or serialization, but this system may be in charge at a later time Example: A pickup held by another player. That player sends creation of that object to new connections, and serializes it until it is dropped.

R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE

The Replica3 instance is a static object (already exists on the remote system). This system is currently in charge of construction and/or serialization

R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE

The Replica3 instance is a static object (already exists on the remote system). Another system is in charge of construction and/or serialization, but this system may be in charge at a later time

Definition at line 822 of file ReplicaManager3.h.

enum SLNet::RM3ActionOnPopConnection
Enumerator:
RM3AOPC_DO_NOTHING
RM3AOPC_DELETE_REPLICA
RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION
RM3AOPC_MAX

Definition at line 812 of file ReplicaManager3.h.

enum SLNet::RM3ConstructionState

Return codes for Connection_RM3::GetConstructionState() and Replica3::QueryConstruction()

Indicates what state the object should be in for the remote system

Enumerator:
RM3CS_SEND_CONSTRUCTION

This object should exist on the remote system. Send a construction message if necessary If the NetworkID is already in use, it will not do anything If it is not in use, it will create the object, and then call DeserializeConstruction

RM3CS_ALREADY_EXISTS_REMOTELY

This object should exist on the remote system. The other system already has the object, and the object will never be deleted. This is true of objects that are loaded with the level, for example. Treat it as if it existed, without sending a construction message. Will call Serialize() and SerializeConstructionExisting() to the object on the remote system

RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT

Same as RM3CS_ALREADY_EXISTS_REMOTELY but does not call SerializeConstructionExisting()

RM3CS_NEVER_CONSTRUCT

This object will never be sent to the target system This object will never be serialized from this system to the target system

RM3CS_NO_ACTION

Don't do anything this tick. Will query again next tick.

RM3CS_MAX

Max enum.

Definition at line 710 of file ReplicaManager3.h.

enum SLNet::RM3DestructionState

If this object already exists for this system, should it be removed?

Enumerator:
RM3DS_SEND_DESTRUCTION

This object should not exist on the remote system. Send a destruction message if necessary.

RM3DS_DO_NOT_QUERY_DESTRUCTION

This object will never be destroyed by a per-tick query. Don't call again.

RM3DS_NO_ACTION

Don't do anything this tick. Will query again next tick.

RM3DS_MAX

Max enum.

Definition at line 740 of file ReplicaManager3.h.

enum SLNet::RM3QuerySerializationResult

First pass at topology to see if an object should be serialized

Enumerator:
RM3QSR_CALL_SERIALIZE

Call Serialize() to see if this object should be serializable for this connection.

RM3QSR_DO_NOT_CALL_SERIALIZE

Do not call Serialize() this tick to see if this object should be serializable for this connection.

RM3QSR_NEVER_CALL_SERIALIZE

Never call Serialize() for this object and connection. This system will not serialize this object for this topology.

RM3QSR_MAX

Max enum.

Definition at line 799 of file ReplicaManager3.h.

enum SLNet::RM3SerializationResult

Return codes when constructing an object

Enumerator:
RM3SR_BROADCAST_IDENTICALLY

This object serializes identically no matter who we send to We also send it to every connection (broadcast). Efficient for memory, speed, and bandwidth but only if the object is always broadcast identically.

RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION

Same as RM3SR_BROADCAST_IDENTICALLY, but assume the object needs to be serialized, do not check with a memcmp Assume the object changed, and serialize it Use this if you know exactly when your object needs to change. Can be faster than RM3SR_BROADCAST_IDENTICALLY. An example of this is if every member variable has an accessor, changing a member sets a flag, and you check that flag in Replica3::QuerySerialization() The opposite of this is RM3SR_DO_NOT_SERIALIZE, in case the object did not change

RM3SR_SERIALIZED_UNIQUELY

Either this object serializes differently depending on who we send to or we send it to some systems and not others. Inefficient for memory and speed, but efficient for bandwidth However, if you don't know what to return, return this

RM3SR_SERIALIZED_ALWAYS

Do not compare against last sent value. Just send even if the data is the same as the last tick If the data is always changing anyway, or you want to send unreliably, this is a good method of serialization Can send unique data per connection if desired. If same data is sent to all connections, use RM3SR_SERIALIZED_ALWAYS_IDENTICALLY for even better performance Efficient for memory and speed, but not necessarily bandwidth

RM3SR_SERIALIZED_ALWAYS_IDENTICALLY
Deprecated:
, use RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION
RM3SR_DO_NOT_SERIALIZE

Do not serialize this object this tick, for this connection. Will query again next autoserialize timer.

RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION

Never serialize this object for this connection Useful for objects that are downloaded, and never change again Efficient

RM3SR_MAX

Max enum.

Definition at line 757 of file ReplicaManager3.h.

enum SLNet::SendSerializeIfChangedResult
Enumerator:
SSICR_SENT_DATA
SSICR_DID_NOT_SEND_DATA
SSICR_NEVER_SERIALIZE

Definition at line 432 of file ReplicaManager3.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Router2

Classes
Router2
Plugins

Part of the NAT punchthrough solution, allowing you to connect to systems by routing through a shared connection. More...

Classes

class | SLNet::Router2
Class interface for the Router2 system. More...
struct | SLNet::Router2::ConnectionRequestSystem
struct | SLNet::Router2::ConnnectRequest
struct | SLNet::Router2::ForwardedConnection
struct | SLNet::Router2::MiniPunchRequest

Detailed Description

Part of the NAT punchthrough solution, allowing you to connect to systems by routing through a shared connection.

Router2 routes datagrams between two systems that are not directly connected by using the bandwidth of a third system, to which the other two systems were connected It is of benefit when a fully connected mesh topology is desired, but could not be completely established due to routers and/or firewalls As the system address of a remote system will be the system address of the intermediary, it is necessary to use the RakNetGUID object to refer to systems, including with other plugins

Class Documentation

class SLNet::Router2

Class interface for the Router2 system.

Definition at line 59 of file Router2.h.

+ Inheritance diagram for SLNet::Router2:

Public Types

enum | Router2RequestStates { R2RS_REQUEST_STATE_QUERY_FORWARDING, REQUEST_STATE_REQUEST_FORWARDING }

Public Member Functions

Router2 ()
virtual | ~Router2 ()
void | SetSocketFamily (unsigned short _socketFamily)
void | EstablishRouting (RakNetGUID endpointGuid)
Query all connected systems to connect through them to a third system. System will return ID_ROUTER_2_FORWARDING_NO_PATH if unable to connect. Else you will get ID_ROUTER_2_FORWARDING_ESTABLISHED.
void | SetMaximumForwardingRequests (int max)
void | SetDebugInterface (Router2DebugInterface *_debugInterface)
For testing and debugging.
Router2DebugInterface * | GetDebugInterface (void) const
Get the pointer passed to SetDebugInterface()
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
unsigned int | GetConnectionRequestIndex (RakNetGUID endpointGuid)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

bool | UpdateForwarding (ConnnectRequest *connectionRequest)
void | RemoveConnectionRequest (unsigned int connectionRequestIndex)
void | RequestForwarding (ConnnectRequest *connectionRequest)
void | OnQueryForwarding (Packet *packet)
void | OnQueryForwardingReply (Packet *packet)
void | OnRequestForwarding (Packet *packet)
void | OnRerouted (Packet *packet)
void | OnMiniPunchReply (Packet *packet)
void | OnMiniPunchReplyBounce (Packet *packet)
bool | OnForwardingSuccess (Packet *packet)
int | GetLargestPingAmongConnectedSystems (void) const
void | ReturnToUser (MessageID messageId, RakNetGUID endpointGuid, const SystemAddress &systemAddress, bool wasGeneratedLocally)
bool | ConnectInternal (RakNetGUID endpointGuid, bool returnConnectionLostOnFailure)
void | ClearConnectionRequests (void)
void | ClearMinipunches (void)
void | ClearForwardedConnections (void)
void | ClearAll (void)
int | ReturnFailureOnCannotForward (RakNetGUID sourceGuid, RakNetGUID endpointGuid)
void | SendFailureOnCannotForward (RakNetGUID sourceGuid, RakNetGUID endpointGuid)
void | SendForwardingSuccess (MessageID messageId, RakNetGUID sourceGuid, RakNetGUID endpointGuid, unsigned short sourceToDstPort)
void | SendOOBFromRakNetPort (OutOfBandIdentifiers oob, BitStream *extraData, SystemAddress sa)
void | SendOOBFromSpecifiedSocket (OutOfBandIdentifiers oob, SystemAddress sa, __UDPSOCKET__ socket)
void | SendOOBMessages (MiniPunchRequest *mpr)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

UDPForwarder * udpForwarder
int | maximumForwardingRequests
SimpleMutex connectionRequestsMutex
SimpleMutex miniPunchesInProgressMutex
SimpleMutex forwardedConnectionListMutex
DataStructures::List
< ConnnectRequest * > 		connectionRequests
DataStructures::List
< MiniPunchRequest > 		miniPunchesInProgress
DataStructures::List
< ForwardedConnection > 		forwardedConnectionList
Router2DebugInterface * debugInterface
unsigned short | socketFamily
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Member Enumeration Documentation

enum SLNet::Router2::Router2RequestStates
Enumerator:
R2RS_REQUEST_STATE_QUERY_FORWARDING
REQUEST_STATE_REQUEST_FORWARDING

Definition at line 112 of file Router2.h.

Constructor & Destructor Documentation

SLNet::Router2::Router2 ( )
virtual SLNet::Router2::~Router2 ( )
virtual

Member Function Documentation

void SLNet::Router2::ClearAll ( void )
protected
void SLNet::Router2::ClearConnectionRequests ( void )
protected
void SLNet::Router2::ClearForwardedConnections ( void )
protected
void SLNet::Router2::ClearMinipunches ( void )
protected
bool SLNet::Router2::ConnectInternal | ( | RakNetGUID | endpointGuid,
 |  | bool | returnConnectionLostOnFailure
 | ) |  |
protected
void SLNet::Router2::EstablishRouting ( RakNetGUID endpointGuid )

Query all connected systems to connect through them to a third system. System will return ID_ROUTER_2_FORWARDING_NO_PATH if unable to connect. Else you will get ID_ROUTER_2_FORWARDING_ESTABLISHED.

On ID_ROUTER_2_FORWARDING_ESTABLISHED, EstablishRouting as follows:

SLNet::BitStream bs(packet->data, packet->length, false); bs.IgnoreBytes(sizeof(MessageID)); RakNetGUID endpointGuid; bs.Read(endpointGuid); unsigned short sourceToDestPort; bs.Read(sourceToDestPort); char ipAddressString[32]; packet->systemAddress.ToString(false, ipAddressString); rakPeerInterface->EstablishRouting(ipAddressString, sourceToDestPort, 0,0);

Note
The SystemAddress for a connection should not be used - always use RakNetGuid as the address can change at any time. When the address changes, you will get ID_ROUTER_2_REROUTED
unsigned int SLNet::Router2::GetConnectionRequestIndex ( RakNetGUID endpointGuid )
Router2DebugInterface* SLNet::Router2::GetDebugInterface ( void ) const

Get the pointer passed to SetDebugInterface()

int SLNet::Router2::GetLargestPingAmongConnectedSystems ( void ) const
protected
virtual void SLNet::Router2::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::Router2::OnFailedConnectionAttempt | ( | Packet * | packet,
 |  | PI2_FailedConnectionAttemptReason | failedConnectionAttemptReason
 | ) |  |
virtual

Called when a connection attempt fails

Parameters
[in] | packet | Packet to be returned to the user
[in] | failedConnectionReason | Why the connection failed

Reimplemented from SLNet::PluginInterface2.

bool SLNet::Router2::OnForwardingSuccess ( Packet * packet )
protected
void SLNet::Router2::OnMiniPunchReply ( Packet * packet )
protected
void SLNet::Router2::OnMiniPunchReplyBounce ( Packet * packet )
protected
void SLNet::Router2::OnQueryForwarding ( Packet * packet )
protected
void SLNet::Router2::OnQueryForwardingReply ( Packet * packet )
protected
virtual void SLNet::Router2::OnRakPeerShutdown ( void )
virtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::Router2::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::Router2::OnRequestForwarding ( Packet * packet )
protected
void SLNet::Router2::OnRerouted ( Packet * packet )
protected
void SLNet::Router2::RemoveConnectionRequest ( unsigned int connectionRequestIndex )
protected
void SLNet::Router2::RequestForwarding ( ConnnectRequest * connectionRequest )
protected
int SLNet::Router2::ReturnFailureOnCannotForward | ( | RakNetGUID | sourceGuid,
 |  | RakNetGUID | endpointGuid
 | ) |  |
protected
void SLNet::Router2::ReturnToUser | ( | MessageID | messageId,
 |  | RakNetGUID | endpointGuid,
 |  | const SystemAddress & | systemAddress,
 |  | bool | wasGeneratedLocally
 | ) |  |
protected
void SLNet::Router2::SendFailureOnCannotForward | ( | RakNetGUID | sourceGuid,
 |  | RakNetGUID | endpointGuid
 | ) |  |
protected
void SLNet::Router2::SendForwardingSuccess | ( | MessageID | messageId,
 |  | RakNetGUID | sourceGuid,
 |  | RakNetGUID | endpointGuid,
 |  | unsigned short | sourceToDstPort
 | ) |  |
protected
void SLNet::Router2::SendOOBFromRakNetPort | ( | OutOfBandIdentifiers | oob,
 |  | BitStream * | extraData,
 |  | SystemAddress | sa
 | ) |  |
protected
void SLNet::Router2::SendOOBFromSpecifiedSocket | ( | OutOfBandIdentifiers | oob,
 |  | SystemAddress | sa,
 |  | __UDPSOCKET__ | socket
 | ) |  |
protected
void SLNet::Router2::SendOOBMessages ( MiniPunchRequest * mpr )
protected
void SLNet::Router2::SetDebugInterface ( Router2DebugInterface * _debugInterface )

For testing and debugging.

void SLNet::Router2::SetMaximumForwardingRequests ( int max )

Set the maximum number of bidirectional connections this system will support Defaults to 0

void SLNet::Router2::SetSocketFamily ( unsigned short _socketFamily )

Sets the socket family to use, either IPV4 or IPV6

Parameters
[in] socketFamily For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC.
virtual void SLNet::Router2::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

bool SLNet::Router2::UpdateForwarding ( ConnnectRequest * connectionRequest )
protected

Member Data Documentation

DataStructures::List<ConnnectRequest*> SLNet::Router2::connectionRequests
protected

Definition at line 184 of file Router2.h.

SimpleMutex SLNet::Router2::connectionRequestsMutex
protected

Definition at line 183 of file Router2.h.

Router2DebugInterface* SLNet::Router2::debugInterface
protected

Definition at line 200 of file Router2.h.

DataStructures::List<ForwardedConnection> SLNet::Router2::forwardedConnectionList
protected

Definition at line 187 of file Router2.h.

SimpleMutex SLNet::Router2::forwardedConnectionListMutex
protected

Definition at line 183 of file Router2.h.

int SLNet::Router2::maximumForwardingRequests
protected

Definition at line 182 of file Router2.h.

DataStructures::List<MiniPunchRequest> SLNet::Router2::miniPunchesInProgress
protected

Definition at line 185 of file Router2.h.

SimpleMutex SLNet::Router2::miniPunchesInProgressMutex
protected

Definition at line 183 of file Router2.h.

unsigned short SLNet::Router2::socketFamily
protected

Definition at line 201 of file Router2.h.

UDPForwarder* SLNet::Router2::udpForwarder
protected

Definition at line 181 of file Router2.h.

struct SLNet::Router2::ConnectionRequestSystem

Definition at line 118 of file Router2.h.

Class Members
RakNetGUID | guid
int | pingToEndpoint
unsigned short | usedForwardingEntries
struct SLNet::Router2::ConnnectRequest

Definition at line 125 of file Router2.h.

Public Member Functions

ConnnectRequest ()
~ConnnectRequest ()
unsigned int | GetGuidIndex (RakNetGUID guid)

Public Attributes

DataStructures::List
< ConnectionRequestSystem > 		connectionRequestSystems
SimpleMutex connectionRequestSystemsMutex
Router2RequestStates requestState
SLNet::TimeMS pingTimeout
RakNetGUID endpointGuid
RakNetGUID lastRequestedForwardingSystem
bool | returnConnectionLostOnFailure

Constructor & Destructor Documentation

SLNet::Router2::ConnnectRequest::ConnnectRequest ( )
SLNet::Router2::ConnnectRequest::~ConnnectRequest ( )

Member Function Documentation

unsigned int SLNet::Router2::ConnnectRequest::GetGuidIndex ( RakNetGUID guid )

Member Data Documentation

DataStructures::List<ConnectionRequestSystem> SLNet::Router2::ConnnectRequest::connectionRequestSystems

Definition at line 130 of file Router2.h.

SimpleMutex SLNet::Router2::ConnnectRequest::connectionRequestSystemsMutex

Definition at line 131 of file Router2.h.

RakNetGUID SLNet::Router2::ConnnectRequest::endpointGuid

Definition at line 134 of file Router2.h.

RakNetGUID SLNet::Router2::ConnnectRequest::lastRequestedForwardingSystem

Definition at line 135 of file Router2.h.

SLNet::TimeMS SLNet::Router2::ConnnectRequest::pingTimeout

Definition at line 133 of file Router2.h.

Router2RequestStates SLNet::Router2::ConnnectRequest::requestState

Definition at line 132 of file Router2.h.

bool SLNet::Router2::ConnnectRequest::returnConnectionLostOnFailure

Definition at line 136 of file Router2.h.

struct SLNet::Router2::ForwardedConnection

Definition at line 156 of file Router2.h.

Class Members
RakNetGUID | endpointGuid
SystemAddress | intermediaryAddress
RakNetGUID | intermediaryGuid
bool | returnConnectionLostOnFailure
bool | weInitiatedForwarding
struct SLNet::Router2::MiniPunchRequest

Definition at line 142 of file Router2.h.

Class Members
SystemAddress | endpointAddress
RakNetGUID | endpointGuid
unsigned short | forwardingPort
__UDPSOCKET__ | forwardingSocket
bool | gotReplyFromEndpoint
bool | gotReplyFromSource
TimeMS | nextAction
SystemAddress | sourceAddress
RakNetGUID | sourceGuid
TimeMS | timeout
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: RPC

Classes | Enumerations
RPC
Plugins

Remote procedure calls, without external dependencies. More...

Classes

class | SLNet::RPC4
The RPC4 plugin is just an association between a C function pointer and a string. More...
struct | SLNet::RPC4::LocalCallback
struct | SLNet::RPC4::LocalSlot
struct | SLNet::RPC4::LocalSlotObject

Enumerations

enum SLNet::RPCErrorCodes { SLNet::RPC_ERROR_FUNCTION_NOT_REGISTERED }
Error codes returned by a remote system as to why an RPC function call cannot execute. More...

Detailed Description

Remote procedure calls, without external dependencies.

This should not be used at the same time as RPC3. This is a less functional version of RPC3, and is here for users that do not want the Boost dependency of RPC3.

Class Documentation

class SLNet::RPC4

The RPC4 plugin is just an association between a C function pointer and a string.

It is for users that want to use RPC, but do not want to use boost. You do not have the automatic serialization or other features of RPC3, and C++ member calls are not supported.

Note
You cannot use RPC4 at the same time as RPC3Plugin

Definition at line 79 of file RPC4Plugin.h.

+ Inheritance diagram for SLNet::RPC4:

Public Member Functions

RPC4 ()
virtual | ~RPC4 ()
bool | RegisterFunction (const char *uniqueID, void(*functionPointer)(SLNet::BitStream *userData, Packet *packet))
Register a function pointer to be callable from a remote system.
void | RegisterSlot (const char *sharedIdentifier, void(*functionPointer)(SLNet::BitStream *userData, Packet *packet), int callPriority)
bool | RegisterBlockingFunction (const char *uniqueID, void(*functionPointer)(SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet))
Same as RegisterFunction, but is called with CallBlocking() instead of Call() and returns a value to the caller.
void | RegisterLocalCallback (const char *uniqueID, MessageID messageId)
bool | UnregisterFunction (const char *uniqueID)
Unregister a function pointer previously registered with RegisterFunction()
bool | UnregisterBlockingFunction (const char *uniqueID)
Same as UnregisterFunction, except for a blocking function.
bool | UnregisterLocalCallback (const char *uniqueID, MessageID messageId)
bool | UnregisterSlot (const char *sharedIdentifier)
void | CallLoopback (const char *uniqueID, SLNet::BitStream *bitStream)
void | Call (const char *uniqueID, SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | CallBlocking (const char *uniqueID, SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, SLNet::BitStream *returnData)
Same as call, but don't return until the remote system replies. Broadcasting parameter does not exist, this can only call one remote system.
void | Signal (const char *sharedIdentifier, SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, bool invokeLocal)
void | InterruptSignal (void)
If called while processing a slot, no further slots for the currently executing signal will be executed.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Static Public Member Functions

static int | LocalCallbackComp (const MessageID &key, LocalCallback *const &data)
static int | LocalSlotObjectComp (const LocalSlotObject &key, const LocalSlotObject &data)

Public Attributes

DataStructures::Hash
< SLNet::RakString, LocalSlot
*, 256, SLNet::RakString::ToInteger > 		localSlots

Protected Member Functions

virtual void | OnAttach (void)
Called when the interface is attached.
virtual PluginReceiveResult | OnReceive (Packet *packet)
DataStructures::HashIndex | GetLocalSlotIndex (const char *sharedIdentifier)
void | InvokeSignal (DataStructures::HashIndex functionIndex, SLNet::BitStream *serializedParameters, Packet *packet)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::Hash
< SLNet::RakString, void(*)(SLNet::BitStream
*, Packet
*), 64, SLNet::RakString::ToInteger > 		registeredNonblockingFunctions
DataStructures::Hash
< SLNet::RakString, void(*)(SLNet::BitStream
*, SLNet::BitStream *, Packet
*), 64, SLNet::RakString::ToInteger > 		registeredBlockingFunctions
DataStructures::OrderedList
< MessageID, LocalCallback
*, RPC4::LocalCallbackComp > 		localCallbacks
SLNet::BitStream blockingReturnValue
bool | gotBlockingReturnValue
unsigned int | nextSlotRegistrationCount
Used so slots are called in the order they are registered.
bool | interruptSignal
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::RPC4::RPC4 ( )
virtual SLNet::RPC4::~RPC4 ( )
virtual

Member Function Documentation

void SLNet::RPC4::Call | ( | const char * | uniqueID,
 |  | SLNet::BitStream * | bitStream,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | char | orderingChannel,
 |  | const AddressOrGUID | systemIdentifier,
 |  | bool | broadcast
 | ) |  |
Deprecated:
, use Signal() Send to the specified remote instance of RakPeer.
Parameters
[in] | uniqueID | Identifier originally passed to RegisterFunction() on the remote system(s)
[in] | bitStream | bitStream encoded data to send to the function callback
[in] | priority | See RakPeerInterface::Send()
[in] | reliability | See RakPeerInterface::Send()
[in] | orderingChannel | See RakPeerInterface::Send()
[in] | systemIdentifier | See RakPeerInterface::Send()
[in] | broadcast | See RakPeerInterface::Send()
bool SLNet::RPC4::CallBlocking | ( | const char * | uniqueID,
 |  | SLNet::BitStream * | bitStream,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | char | orderingChannel,
 |  | const AddressOrGUID | systemIdentifier,
 |  | SLNet::BitStream * | returnData
 | ) |  |

Same as call, but don't return until the remote system replies. Broadcasting parameter does not exist, this can only call one remote system.

Note
This function does not return until the remote system responds, disconnects, or was never connected to begin with
Parameters
[in] | Identifier | originally passed to RegisterBlockingFunction() on the remote system(s)
[in] | bitStream | bitStream encoded data to send to the function callback
[in] | priority | See RakPeerInterface::Send()
[in] | reliability | See RakPeerInterface::Send()
[in] | orderingChannel | See RakPeerInterface::Send()
[in] | systemIdentifier | See RakPeerInterface::Send()
[out] | returnData | Written to by the function registered with RegisterBlockingFunction.
Returns
true if successfully called. False on disconnect, function not registered, or not connected to begin with
void SLNet::RPC4::CallLoopback | ( | const char * | uniqueID,
 |  | SLNet::BitStream * | bitStream
 | ) |  |
Deprecated:
Use RegisterSlot() and Signal() with your own RakNetGUID as the send target Send to the attached instance of RakPeer. See RakPeerInterface::SendLoopback()
Parameters
[in] | Identifier | originally passed to RegisterFunction() on the local system
[in] | bitStream | bitStream encoded data to send to the function callback
DataStructures::HashIndex SLNet::RPC4::GetLocalSlotIndex ( const char * sharedIdentifier )
protected
void SLNet::RPC4::InterruptSignal ( void )

If called while processing a slot, no further slots for the currently executing signal will be executed.

void SLNet::RPC4::InvokeSignal | ( | DataStructures::HashIndex | functionIndex,
 |  | SLNet::BitStream * | serializedParameters,
 |  | Packet * | packet
 | ) |  |
protected
static int SLNet::RPC4::LocalCallbackComp | ( | const MessageID & | key,
 |  | LocalCallback *const & | data
 | ) |  |
static
static int SLNet::RPC4::LocalSlotObjectComp | ( | const LocalSlotObject & | key,
 |  | const LocalSlotObject & | data
 | ) |  |
static
virtual void SLNet::RPC4::OnAttach ( void )
protectedvirtual

Called when the interface is attached.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::RPC4::OnReceive ( Packet * packet )
protectedvirtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

bool SLNet::RPC4::RegisterBlockingFunction | ( | const char * | uniqueID,
 |  | void(*)(SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet) | functionPointer
 | ) |  |

Same as RegisterFunction, but is called with CallBlocking() instead of Call() and returns a value to the caller.

bool SLNet::RPC4::RegisterFunction | ( | const char * | uniqueID,
 |  | void(*)(SLNet::BitStream *userData, Packet *packet) | functionPointer
 | ) |  |

Register a function pointer to be callable from a remote system.

Deprecated:
Use RegisterSlot

The hash of the function name will be stored as an association with the function pointer When a call is made to call this function from the Call() or CallLoopback() function, the function pointer will be invoked with the passed bitStream to Call() and the actual Packet that RakNet got.

See Also
RegisterPacketCallback()
Parameters
[in] | uniqueID | Identifier to be associated with functionPointer. If this identifier is already in use, the call will return false.
[in] | functionPointer | C function pointer to be called
Returns
True if the hash of uniqueID is not in use, false otherwise.
void SLNet::RPC4::RegisterLocalCallback | ( | const char * | uniqueID,
 |  | MessageID | messageId
 | ) |  |
Deprecated:
Use RegisterSlot and invoke on self only when the packet you want arrives When a RakNet Packet with the specified identifier is returned, execute CallLoopback() on a function previously registered with RegisterFunction() For example, you could call "OnClosedConnection" whenever you get ID_DISCONNECTION_NOTIFICATION or ID_CONNECTION_LOST
Parameters
[in] | uniqueID | Identifier passed to RegisterFunction()
[in] | messageId | What RakNet packet ID to call on, for example ID_DISCONNECTION_NOTIFICATION or ID_CONNECTION_LOST
void SLNet::RPC4::RegisterSlot | ( | const char * | sharedIdentifier,
 |  | void(*)(SLNet::BitStream *userData, Packet *packet) | functionPointer,
 |  | int | callPriority
 | ) |  |

Register a slot, which is a function pointer to one or more implementations that supports this function signature When a signal occurs, all slots with the same identifier are called.

Parameters
[in] | sharedIdentifier | A string to identify the slot. Recommended to be the same as the name of the function.
[in] | functionPtr | Pointer to the function. For C, just pass the name of the function. For C++, use ARPC_REGISTER_CPP_FUNCTION
[in] | callPriority | Slots are called by order of the highest callPriority first. For slots with the same priority, they are called in the order they are registered
void SLNet::RPC4::Signal | ( | const char * | sharedIdentifier,
 |  | SLNet::BitStream * | bitStream,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | char | orderingChannel,
 |  | const AddressOrGUID | systemIdentifier,
 |  | bool | broadcast,
 |  | bool | invokeLocal
 | ) |  |

Calls zero or more functions identified by sharedIdentifier registered with RegisterSlot()

Parameters
[in] | sharedIdentifier | parameter of the same name passed to RegisterSlot() on the remote system
[in] | bitStream | bitStream encoded data to send to the function callback
[in] | priority | See RakPeerInterface::Send()
[in] | reliability | See RakPeerInterface::Send()
[in] | orderingChannel | See RakPeerInterface::Send()
[in] | systemIdentifier | See RakPeerInterface::Send()
[in] | broadcast | See RakPeerInterface::Send()
[in] | invokeLocal | If true, also sends to self.
bool SLNet::RPC4::UnregisterBlockingFunction ( const char * uniqueID )

Same as UnregisterFunction, except for a blocking function.

bool SLNet::RPC4::UnregisterFunction ( const char * uniqueID )

Unregister a function pointer previously registered with RegisterFunction()

Parameters
[in] Identifier originally passed to RegisterFunction()
Returns
True if the hash of uniqueID was in use, and hence removed. false otherwise.
bool SLNet::RPC4::UnregisterLocalCallback | ( | const char * | uniqueID,
 |  | MessageID | messageId
 | ) |  |

Remove the association created with RegisterPacketCallback()

Parameters
[in] | uniqueID | Identifier passed as uniqueID to RegisterLocalCallback()
[in] | messageId | Identifier passed as messageId to RegisterLocalCallback()
Returns
True if the combination of uniqueID and messageId was in use, and hence removed
bool SLNet::RPC4::UnregisterSlot ( const char * sharedIdentifier )

Remove the association created with RegisterSlot()

Parameters
[in] sharedIdentifier Identifier passed as sharedIdentifier to RegisterSlot()

Member Data Documentation

SLNet::BitStream SLNet::RPC4::blockingReturnValue
protected

Definition at line 224 of file RPC4Plugin.h.

bool SLNet::RPC4::gotBlockingReturnValue
protected

Definition at line 225 of file RPC4Plugin.h.

bool SLNet::RPC4::interruptSignal
protected

Definition at line 232 of file RPC4Plugin.h.

DataStructures::OrderedList<MessageID,LocalCallback*,RPC4::LocalCallbackComp> SLNet::RPC4::localCallbacks
protected

Definition at line 222 of file RPC4Plugin.h.

DataStructures::Hash<SLNet::RakString, LocalSlot*,256, SLNet::RakString::ToInteger> SLNet::RPC4::localSlots

Definition at line 210 of file RPC4Plugin.h.

unsigned int SLNet::RPC4::nextSlotRegistrationCount
protected

Used so slots are called in the order they are registered.

Definition at line 230 of file RPC4Plugin.h.

DataStructures::Hash<SLNet::RakString, void ( * ) (SLNet::BitStream *, SLNet::BitStream *, Packet * ),64, SLNet::RakString::ToInteger> SLNet::RPC4::registeredBlockingFunctions
protected

Definition at line 221 of file RPC4Plugin.h.

DataStructures::Hash<SLNet::RakString, void ( * ) (SLNet::BitStream *, Packet * ),64, SLNet::RakString::ToInteger> SLNet::RPC4::registeredNonblockingFunctions
protected

Definition at line 220 of file RPC4Plugin.h.

struct SLNet::RPC4::LocalCallback

Definition at line 181 of file RPC4Plugin.h.

Class Members
OrderedList< RakString, RakString > | functions
MessageID | messageId
struct SLNet::RPC4::LocalSlot

Definition at line 206 of file RPC4Plugin.h.

Class Members
OrderedList< LocalSlotObject,
LocalSlotObject,
LocalSlotObjectComp > 		slotObjects
struct SLNet::RPC4::LocalSlotObject

Definition at line 190 of file RPC4Plugin.h.

Public Member Functions

LocalSlotObject ()
LocalSlotObject (unsigned int _registrationCount, int _callPriority, void(*_functionPointer)(SLNet::BitStream *userData, Packet *packet))
~LocalSlotObject ()

Public Attributes

unsigned int | registrationCount
int | callPriority
void(* | functionPointer )(SLNet::BitStream *userData, Packet *packet)

Constructor & Destructor Documentation

SLNet::RPC4::LocalSlotObject::LocalSlotObject ( )
inline

Definition at line 192 of file RPC4Plugin.h.

SLNet::RPC4::LocalSlotObject::LocalSlotObject | ( | unsigned int | _registrationCount,
 |  | int | _callPriority,
 |  | void(*)(SLNet::BitStream *userData, Packet *packet) | _functionPointer
 | ) |  |
inline

Definition at line 193 of file RPC4Plugin.h.

SLNet::RPC4::LocalSlotObject::~LocalSlotObject ( )
inline

Definition at line 195 of file RPC4Plugin.h.

Member Data Documentation

int SLNet::RPC4::LocalSlotObject::callPriority

Definition at line 199 of file RPC4Plugin.h.

void( * SLNet::RPC4::LocalSlotObject::functionPointer)(SLNet::BitStream *userData, Packet *packet)

Definition at line 200 of file RPC4Plugin.h.

unsigned int SLNet::RPC4::LocalSlotObject::registrationCount

Definition at line 198 of file RPC4Plugin.h.

Enumeration Type Documentation

enum SLNet::RPCErrorCodes

Error codes returned by a remote system as to why an RPC function call cannot execute.

Error code follows packet ID ID_RPC_REMOTE_ERROR, that is packet->data[1]
Name of the function will be appended starting at packet->data[2]

Enumerator:
RPC_ERROR_FUNCTION_NOT_REGISTERED

Named function was not registered with RegisterFunction(). Check your spelling.

Definition at line 51 of file RPC4Plugin.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: TeamBalancer

Classes | Typedefs
TeamBalancer
Plugins

Set and network team selection (supports peer to peer or client/server) More...

Classes

class | SLNet::TeamBalancer
Set and network team selection (supports peer to peer or client/server) More...
struct | SLNet::TeamBalancer::MyTeamMembers
struct | SLNet::TeamBalancer::TeamMember

Typedefs

typedef unsigned char SLNet::TeamId

Detailed Description

Set and network team selection (supports peer to peer or client/server)

Automatically handles transmission and resolution of team selection, including team switching and balancing

Deprecated:
Use TeamManager intead

Class Documentation

class SLNet::TeamBalancer

Set and network team selection (supports peer to peer or client/server)

Automatically handles transmission and resolution of team selection, including team switching and balancing.
Usage: TODO

Deprecated:
Use TeamManager intead

Definition at line 58 of file TeamBalancer.h.

+ Inheritance diagram for SLNet::TeamBalancer:

Public Types

enum | DefaultAssigmentAlgorithm { SMALLEST_TEAM, FILL_IN_ORDER }

Public Member Functions

TeamBalancer ()
virtual | ~TeamBalancer ()
void | SetTeamSizeLimit (TeamId team, unsigned short limit)
Set the limit to the number of players on the specified team.
void | SetDefaultAssignmentAlgorithm (DefaultAssigmentAlgorithm daa)
Determine how players' teams will be set when they call RequestAnyTeam()
void | SetForceEvenTeams (bool force)
By default, teams can be unbalanced up to the team size limit defined by SetTeamSizeLimits()
void | SetLockTeams (bool lock)
If set, calls to RequestSpecificTeam() and RequestAnyTeam() will return the team you are currently on.
void | RequestSpecificTeam (NetworkID memberId, TeamId desiredTeam)
void | CancelRequestSpecificTeam (NetworkID memberId)
void | RequestAnyTeam (NetworkID memberId)
TeamId | GetMyTeam (NetworkID memberId) const
void | DeleteMember (NetworkID memberId)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
void | OnAttach (void)
Called when the interface is attached.
void | OnStatusUpdateToNewHost (Packet *packet)
void | OnCancelTeamRequest (Packet *packet)
void | OnRequestAnyTeam (Packet *packet)
void | OnRequestSpecificTeam (Packet *packet)
unsigned int | GetMemberIndex (NetworkID memberId, RakNetGUID guid) const
unsigned int | AddTeamMember (const TeamMember &tm)
void | RemoveTeamMember (unsigned int index)
void | EvenTeams (void)
unsigned int | GetMemberIndexToSwitchTeams (const DataStructures::List< TeamId > &sourceTeamNumbers, TeamId targetTeamNumber)
void | GetOverpopulatedTeams (DataStructures::List< TeamId > &overpopulatedTeams, int maxTeamSize)
void | SwitchMemberTeam (unsigned int teamMemberIndex, TeamId destinationTeam)
void | NotifyTeamAssigment (unsigned int teamMemberIndex)
bool | WeAreHost (void) const
PluginReceiveResult | OnTeamAssigned (Packet *packet)
PluginReceiveResult | OnRequestedTeamChangePending (Packet *packet)
PluginReceiveResult | OnTeamsLocked (Packet *packet)
void | GetMinMaxTeamMembers (int &minMembersOnASingleTeam, int &maxMembersOnASingleTeam)
TeamId | GetNextDefaultTeam (void)
bool | TeamWouldBeOverpopulatedOnAddition (TeamId teamId, unsigned int teamMemberSize)
bool | TeamWouldBeUnderpopulatedOnLeave (TeamId teamId, unsigned int teamMemberSize)
TeamId | GetSmallestNonFullTeam (void) const
TeamId | GetFirstNonFullTeam (void) const
void | MoveMemberThatWantsToJoinTeam (TeamId teamId)
TeamId | MoveMemberThatWantsToJoinTeamInternal (TeamId teamId)
void | NotifyTeamsLocked (RakNetGUID target, TeamId requestedTeam)
void | NotifyTeamSwitchPending (RakNetGUID target, TeamId requestedTeam, NetworkID memberId)
void | NotifyNoTeam (NetworkID memberId, RakNetGUID target)
void | SwapTeamMembersByRequest (unsigned int memberIndex1, unsigned int memberIndex2)
void | RemoveByGuid (RakNetGUID rakNetGUID)
bool | TeamsWouldBeEvenOnSwitch (TeamId t1, TeamId t2)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

RakNetGUID hostGuid
DefaultAssigmentAlgorithm defaultAssigmentAlgorithm
bool | forceTeamsToBeEven
bool | lockTeams
DataStructures::List
< MyTeamMembers > 		myTeamMembers
DataStructures::List< unsigned
short > 		teamLimits
DataStructures::List< unsigned
short > 		teamMemberCounts
DataStructures::List< TeamMember > teamMembers
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Member Enumeration Documentation

enum SLNet::TeamBalancer::DefaultAssigmentAlgorithm
Enumerator:
SMALLEST_TEAM

Among all the teams, join the team with the smallest number of players.

FILL_IN_ORDER

Join the team with the lowest index that has open slots.

Definition at line 74 of file TeamBalancer.h.

Constructor & Destructor Documentation

SLNet::TeamBalancer::TeamBalancer ( )
virtual SLNet::TeamBalancer::~TeamBalancer ( )
virtual

Member Function Documentation

unsigned int SLNet::TeamBalancer::AddTeamMember ( const TeamMember & tm )
protected
void SLNet::TeamBalancer::CancelRequestSpecificTeam ( NetworkID memberId )

If ID_TEAM_BALANCER_REQUESTED_TEAM_CHANGE_PENDING is returned after a call to RequestSpecificTeam(), the request will stay in memory on the host and execute when available, or until the teams become locked. You can cancel the request by calling CancelRequestSpecificTeam(), in which case you will stay on your existing team.

Note
Due to latency, even after calling CancelRequestSpecificTeam() you may still get ID_TEAM_BALANCER_SET_TEAM if the packet was already in transmission.
Parameters
[in] memberId If there is more than one player per computer, this number identifies that player. Use any consistent value, such as UNASSIGNED_NETWORK_ID if there is only one player.
void SLNet::TeamBalancer::DeleteMember ( NetworkID memberId )

If you called RequestSpecificTeam() or RequestAnyTeam() with a value for memberId that Has since been deleted, call DeleteMember(). to notify this plugin of that event. Not necessary with only one team member per system

Parameters
[in] memberId If there is more than one player per computer, this number identifies that player. Use any consistent value, such as UNASSIGNED_NETWORK_ID if there is only one player.
void SLNet::TeamBalancer::EvenTeams ( void )
protected
TeamId SLNet::TeamBalancer::GetFirstNonFullTeam ( void ) const
protected
unsigned int SLNet::TeamBalancer::GetMemberIndex | ( | NetworkID | memberId,
 |  | RakNetGUID | guid
 | ) |  | const
 protected
unsigned int SLNet::TeamBalancer::GetMemberIndexToSwitchTeams | ( | const DataStructures::List< TeamId > & | sourceTeamNumbers,
 |  | TeamId | targetTeamNumber
 | ) |  |
protected
void SLNet::TeamBalancer::GetMinMaxTeamMembers | ( | int & | minMembersOnASingleTeam,
 |  | int & | maxMembersOnASingleTeam
 | ) |  |
protected
TeamId SLNet::TeamBalancer::GetMyTeam ( NetworkID memberId ) const

Returns your team. As your team changes, you are notified through the ID_TEAM_BALANCER_TEAM_ASSIGNED packet in byte 1. Returns UNASSIGNED_TEAM_ID initially

Precondition
For this to return anything other than UNASSIGNED_TEAM_ID, connect to a properly initialized host and RequestSpecificTeam() or RequestAnyTeam() first
Parameters
[in] memberId If there is more than one player per computer, this number identifies that player. Use any consistent value, such as UNASSIGNED_NETWORK_ID if there is only one player.
Returns
UNASSIGNED_TEAM_ID for no team. Otherwise, the index should range from 0 to one less than the size of the list passed to SetTeamSizeLimits() on the host
TeamId SLNet::TeamBalancer::GetNextDefaultTeam ( void )
protected
void SLNet::TeamBalancer::GetOverpopulatedTeams | ( | DataStructures::List< TeamId > & | overpopulatedTeams,
 |  | int | maxTeamSize
 | ) |  |
protected
TeamId SLNet::TeamBalancer::GetSmallestNonFullTeam ( void ) const
protected
void SLNet::TeamBalancer::MoveMemberThatWantsToJoinTeam ( TeamId teamId )
protected
TeamId SLNet::TeamBalancer::MoveMemberThatWantsToJoinTeamInternal ( TeamId teamId )
protected
void SLNet::TeamBalancer::NotifyNoTeam | ( | NetworkID | memberId,
 |  | RakNetGUID | target
 | ) |  |
protected
void SLNet::TeamBalancer::NotifyTeamAssigment ( unsigned int teamMemberIndex )
protected
void SLNet::TeamBalancer::NotifyTeamsLocked | ( | RakNetGUID | target,
 |  | TeamId | requestedTeam
 | ) |  |
protected
void SLNet::TeamBalancer::NotifyTeamSwitchPending | ( | RakNetGUID | target,
 |  | TeamId | requestedTeam,
 |  | NetworkID | memberId
 | ) |  |
protected
void SLNet::TeamBalancer::OnAttach ( void )
protectedvirtual

Called when the interface is attached.

Reimplemented from SLNet::PluginInterface2.

void SLNet::TeamBalancer::OnCancelTeamRequest ( Packet * packet )
protected
virtual void SLNet::TeamBalancer::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
protectedvirtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::TeamBalancer::OnReceive ( Packet * packet )
protectedvirtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::TeamBalancer::OnRequestAnyTeam ( Packet * packet )
protected
PluginReceiveResult SLNet::TeamBalancer::OnRequestedTeamChangePending ( Packet * packet )
protected
void SLNet::TeamBalancer::OnRequestSpecificTeam ( Packet * packet )
protected
void SLNet::TeamBalancer::OnStatusUpdateToNewHost ( Packet * packet )
protected
PluginReceiveResult SLNet::TeamBalancer::OnTeamAssigned ( Packet * packet )
protected
PluginReceiveResult SLNet::TeamBalancer::OnTeamsLocked ( Packet * packet )
protected
void SLNet::TeamBalancer::RemoveByGuid ( RakNetGUID rakNetGUID )
protected
void SLNet::TeamBalancer::RemoveTeamMember ( unsigned int index )
protected
void SLNet::TeamBalancer::RequestAnyTeam ( NetworkID memberId )

Allow host to pick your team, based on whatever algorithm it uses for default team assignments. This only has an effect if you are not currently on a team (GetMyTeam() returns UNASSIGNED_TEAM_ID)

Precondition
Call SetTeamSizeLimits() on the host and call SetHostGuid() on this system
Parameters
[in] memberId If there is more than one player per computer, this number identifies that player. Use any consistent value, such as UNASSIGNED_NETWORK_ID if there is only one player.
void SLNet::TeamBalancer::RequestSpecificTeam | ( | NetworkID | memberId,
 |  | TeamId | desiredTeam
 | ) |  |

Set your requested team. UNASSIGNED_TEAM_ID means no team. After enough time for network communication, ID_TEAM_BALANCER_SET_TEAM will be returned with your current team, or If team switch is not possible, ID_TEAM_BALANCER_REQUESTED_TEAM_CHANGE_PENDING or ID_TEAM_BALANCER_TEAMS_LOCKED will be returned. In the case of ID_TEAM_BALANCER_REQUESTED_TEAM_CHANGE_PENDING the request will stay in memory. ID_TEAM_BALANCER_SET_TEAM will be returned when someone on the desired team leaves or wants to switch to your team. If SetLockTeams(true) is called while you have a request pending, you will get ID_TEAM_BALANCER_TEAMS_LOCKED

Precondition
Call SetTeamSizeLimits() on the host and call SetHostGuid() on this system. If the host is not running the TeamBalancer plugin or did not have SetTeamSizeLimits() called, then you will not get any response.
Parameters
[in] | memberId | If there is more than one player per computer, this number identifies that player. Use any consistent value, such as UNASSIGNED_NETWORK_ID if there is only one player.
[in] | desiredTeam | An index representing your team number. The index should range from 0 to one less than the size of the list passed to SetTeamSizeLimits() on the host. You can also pass UNASSIGNED_TEAM_ID to not be on any team (such as if spectating)
void SLNet::TeamBalancer::SetDefaultAssignmentAlgorithm ( DefaultAssigmentAlgorithm daa )

Determine how players' teams will be set when they call RequestAnyTeam()

Based on the specified enumeration, a player will join a team automatically Defaults to SMALLEST_TEAM This function is only used by the host

Parameters
[in] daa Enumeration describing the algorithm to use
void SLNet::TeamBalancer::SetForceEvenTeams ( bool force )

By default, teams can be unbalanced up to the team size limit defined by SetTeamSizeLimits()

If SetForceEvenTeams(true) is called on the host, then teams cannot be unbalanced by more than 1 player If teams are uneven at the time that SetForceEvenTeams(true) is called, players at randomly will be switched, and will be notified of ID_TEAM_BALANCER_TEAM_ASSIGNED If players disconnect from the host such that teams would not be even, and teams are not locked, then a player from the largest team is randomly moved to even the teams. Defaults to false

Note
SetLockTeams(true) takes priority over SetForceEvenTeams(), so if teams are currently locked, this function will have no effect until teams become unlocked.
Parameters
[in] force True to force even teams. False to allow teams to not be evenly matched
void SLNet::TeamBalancer::SetLockTeams ( bool lock )

If set, calls to RequestSpecificTeam() and RequestAnyTeam() will return the team you are currently on.

However, if those functions are called and you do not have a team, then you will be assigned to a default team according to SetDefaultAssignmentAlgorithm() and possibly SetForceEvenTeams(true) If lock is false, and SetForceEvenTeams() was called with force as true, and teams are currently uneven, they will be made even, and those players randomly moved will get ID_TEAM_BALANCER_TEAM_ASSIGNED Defaults to false

Parameters
[in] lock True to lock teams, false to unlock
void SLNet::TeamBalancer::SetTeamSizeLimit | ( | TeamId | team,
 |  | unsigned short | limit
 | ) |  |

Set the limit to the number of players on the specified team.

SetTeamSizeLimit() must be called on the host, so the host can enforce the maximum number of players on each team. SetTeamSizeLimit() can be called on all systems if desired - for example, in a P2P environment you may wish to call it on all systems in advanced in case you become host.

Parameters
[in] | team | Which team to set the limit for
[in] | limit | The maximum number of people on this team
void SLNet::TeamBalancer::SwapTeamMembersByRequest | ( | unsigned int | memberIndex1,
 |  | unsigned int | memberIndex2
 | ) |  |
protected
void SLNet::TeamBalancer::SwitchMemberTeam | ( | unsigned int | teamMemberIndex,
 |  | TeamId | destinationTeam
 | ) |  |
protected
bool SLNet::TeamBalancer::TeamsWouldBeEvenOnSwitch | ( | TeamId | t1,
 |  | TeamId | t2
 | ) |  |
protected
bool SLNet::TeamBalancer::TeamWouldBeOverpopulatedOnAddition | ( | TeamId | teamId,
 |  | unsigned int | teamMemberSize
 | ) |  |
protected
bool SLNet::TeamBalancer::TeamWouldBeUnderpopulatedOnLeave | ( | TeamId | teamId,
 |  | unsigned int | teamMemberSize
 | ) |  |
protected
bool SLNet::TeamBalancer::WeAreHost ( void ) const
protected

Member Data Documentation

DefaultAssigmentAlgorithm SLNet::TeamBalancer::defaultAssigmentAlgorithm
protected

Definition at line 169 of file TeamBalancer.h.

bool SLNet::TeamBalancer::forceTeamsToBeEven
protected

Definition at line 170 of file TeamBalancer.h.

RakNetGUID SLNet::TeamBalancer::hostGuid
protected

Definition at line 168 of file TeamBalancer.h.

bool SLNet::TeamBalancer::lockTeams
protected

Definition at line 171 of file TeamBalancer.h.

DataStructures::List<MyTeamMembers> SLNet::TeamBalancer::myTeamMembers
protected

Definition at line 173 of file TeamBalancer.h.

DataStructures::List<unsigned short> SLNet::TeamBalancer::teamLimits
protected

Definition at line 175 of file TeamBalancer.h.

DataStructures::List<unsigned short> SLNet::TeamBalancer::teamMemberCounts
protected

Definition at line 176 of file TeamBalancer.h.

DataStructures::List<TeamMember> SLNet::TeamBalancer::teamMembers
protected

Definition at line 177 of file TeamBalancer.h.

struct SLNet::TeamBalancer::MyTeamMembers

Definition at line 147 of file TeamBalancer.h.

Class Members
TeamId | currentTeam
NetworkID | memberId
TeamId | requestedTeam
struct SLNet::TeamBalancer::TeamMember

Definition at line 140 of file TeamBalancer.h.

Class Members
TeamId | currentTeam
RakNetGUID | memberGuid
NetworkID | memberId
TeamId | requestedTeam

Typedef Documentation

typedef unsigned char SLNet::TeamId

0...254 for your team number identifiers. 255 is reserved as undefined.

Deprecated:
Use TeamManager intead

Definition at line 49 of file TeamBalancer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: TeamManager

Classes | Typedefs | Enumerations
TeamManager
Plugins

Automates networking and list management for teams. More...

Classes

struct | SLNet::TeamSelection
Parameter to TM_World::ReferenceTeamMember() More...
class | SLNet::TM_TeamMember
A member of one or more teams. More...
class | SLNet::TM_Team
A team, containing a list of TM_TeamMember instances. More...
class | SLNet::TM_World
Stores a list of teams which may be enforcing a balanced number of members. More...
class | SLNet::TeamManager
Automates networking and list management for teams. More...
struct | SLNet::TM_TeamMember::RequestedTeam
struct | SLNet::TM_World::JoinRequestHelper
union | SLNet::TeamSelection.teamParameter

Typedefs

typedef unsigned char | SLNet::NoTeamId
A subcategory of not being on a team. For example, 0 may mean no team for a player, while 1 may mean no team for a spectator. Defined by the user.
typedef uint16_t | SLNet::TeamMemberLimit

Enumerations

enum | SLNet::JoinTeamType { SLNet::JOIN_ANY_AVAILABLE_TEAM, SLNet::JOIN_SPECIFIC_TEAM, SLNet::JOIN_NO_TEAM }
enum | SLNet::TMTopology { SLNet::TM_PEER_TO_PEER, SLNet::TM_CLIENT_SERVER }

Detailed Description

Automates networking and list management for teams.

When used with ReplicaManager3 and FullyConnectedMesh2, provides a complete solution to managing a distributed list of teams and team member objects with support for host migration.

Class Documentation

struct SLNet::TeamSelection

Parameter to TM_World::ReferenceTeamMember()

Use TeamSelection::AnyAvailable(), TeamSelection::SpecificTeam(), or TeamSelection::NoTeam()

Definition at line 103 of file TeamManager.h.

Public Member Functions

TeamSelection ()
TeamSelection (JoinTeamType itt)
TeamSelection (JoinTeamType itt, TM_Team *param)
TeamSelection (JoinTeamType itt, NoTeamId param)

Static Public Member Functions

static TeamSelection | AnyAvailable (void)
Join any team that has available slots and is tagged with ALLOW_JOIN_ANY_AVAILABLE_TEAM.
static TeamSelection | SpecificTeam (TM_Team *specificTeamToJoin)
Join a specific team if it has available slots, and is tagged with JOIN_SPECIFIC_TEAMS.
static TeamSelection | NoTeam (NoTeamId noTeamSubcategory)
Do not join a team, or leave all current teams.

Public Attributes

JoinTeamType joinTeamType
union {
TM_Team * | specificTeamToJoin
NoTeamId | noTeamSubcategory
} teamParameter

Constructor & Destructor Documentation

SLNet::TeamSelection::TeamSelection ( )
SLNet::TeamSelection::TeamSelection ( JoinTeamType itt )
SLNet::TeamSelection::TeamSelection | ( | JoinTeamType | itt,
 |  | TM_Team * | param
 | ) |  |
SLNet::TeamSelection::TeamSelection | ( | JoinTeamType | itt,
 |  | NoTeamId | param
 | ) |  |

Member Function Documentation

static TeamSelection SLNet::TeamSelection::AnyAvailable ( void )
static

Join any team that has available slots and is tagged with ALLOW_JOIN_ANY_AVAILABLE_TEAM.

ID_TEAM_BALANCER_TEAM_ASSIGNED, ID_TEAM_BALANCER_REQUESTED_TEAM_FULL, or ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED will be returned to all systems.

static TeamSelection SLNet::TeamSelection::NoTeam ( NoTeamId noTeamSubcategory )
static

Do not join a team, or leave all current teams.

This always succeeds. ID_TEAM_BALANCER_TEAM_ASSIGNED will be returned to all systems.

Parameters
[in] noTeamSubcategory Even when not on a team, you can internally identify a subcategory of not being on a team, such as AI or spectator.
static TeamSelection SLNet::TeamSelection::SpecificTeam ( TM_Team * specificTeamToJoin )
static

Join a specific team if it has available slots, and is tagged with JOIN_SPECIFIC_TEAMS.

ID_TEAM_BALANCER_TEAM_ASSIGNED, ID_TEAM_BALANCER_REQUESTED_TEAM_FULL, or ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED will be returned to all systems.

Parameters
[in] specificTeamToJoin Which team to attempt to join.

Member Data Documentation

JoinTeamType SLNet::TeamSelection::joinTeamType

Definition at line 109 of file TeamManager.h.

union { ... } SLNet::TeamSelection::teamParameter
class SLNet::TM_TeamMember

A member of one or more teams.

Contains data and operations on data to manage which team your game's team members are on. Best used as a composite member of your "User" or "Player" class(es). When using with ReplicaManager3, call TM_TeamMember::ReferenceTeamMember() in Replica3::DeserializeConstruction() and TM_TeamMember::DeserializeConstruction() in Replica3::PostDeserializeConstruction() There is otherwise no need to manually serialize the class, as operations are networked internally.

Definition at line 136 of file TeamManager.h.

Public Member Functions

TM_TeamMember ()
virtual | ~TM_TeamMember ()
bool | RequestTeam (TeamSelection teamSelection)
Request to join any team, a specific team, or to leave all teams.
bool | RequestTeamSwitch (TM_Team *teamToJoin, TM_Team *teamToLeave)
Similar to RequestTeam with TeamSelection::SpecificTeam(), but leave a team simultaneously when the desired team is joinable.
TeamSelection | GetRequestedTeam (void) const
Returns the first requested team in the list of requested teams, if you have a requested team at all.
void | GetRequestedSpecificTeams (DataStructures::List< TM_Team * > &requestedTeams) const
Returns pending calls to RequestTeam() when using TeamSelection::JOIN_SPECIFIC_TEAM.
bool | HasRequestedTeam (TM_Team *team) const
Returns if the specified team is in the list of pending requested teams.
unsigned int | GetRequestedTeamIndex (TM_Team *team) const
Returns the index of team in the requested teams list.
unsigned int | GetRequestedTeamCount (void) const
bool | CancelTeamRequest (TM_Team *specificTeamToCancel)
Cancels a request to join a specific team.
bool | LeaveTeam (TM_Team *team, NoTeamId _noTeamSubcategory)
Leave a team.
bool | LeaveAllTeams (NoTeamId inNoTeamSubcategory)
Leave all teams Leaves all teams you are on, and sets noTeamSubcategory.
TM_Team * | GetCurrentTeam (void) const
unsigned int | GetCurrentTeamCount (void) const
TM_Team * | GetCurrentTeamByIndex (unsigned int index)
void | GetCurrentTeams (DataStructures::List< TM_Team * > &_teams) const
void | GetLastTeams (DataStructures::List< TM_Team * > &_teams) const
bool | IsOnTeam (TM_Team *team) const
NetworkID | GetNetworkID (void) const
TM_World * | GetTM_World (void) const
void | SerializeConstruction (BitStream *constructionBitstream)
Serializes the current state of this object.
bool | DeserializeConstruction (TeamManager *teamManager, BitStream *constructionBitstream)
Deserializes the current state of this object.
void | SetOwner (void *o)
void * | GetOwner (void) const
NoTeamId | GetNoTeamId (void) const
unsigned int | GetWorldIndex (void) const
Return world->GetTeamMemberIndex(this)

Static Public Member Functions

static unsigned long | ToUint32 (const NetworkID &g)

Protected Member Functions

void | UpdateListsToNoTeam (NoTeamId nti)
bool | JoinAnyTeamCheck (void) const
bool | JoinSpecificTeamCheck (TM_Team *specificTeamToJoin, bool ignoreRequested) const
bool | SwitchSpecificTeamCheck (TM_Team *teamToJoin, TM_Team *teamToLeave, bool ignoreRequested) const
bool | LeaveTeamCheck (TM_Team *team) const
void | UpdateTeamsRequestedToAny (void)
void | UpdateTeamsRequestedToNone (void)
void | AddToRequestedTeams (TM_Team *teamToJoin)
void | AddToRequestedTeams (TM_Team *teamToJoin, TM_Team *teamToLeave)
bool | RemoveFromRequestedTeams (TM_Team *team)
void | AddToTeamList (TM_Team *team)
void | RemoveFromSpecificTeamInternal (TM_Team *team)
void | RemoveFromAllTeamsInternal (void)
void | StoreLastTeams (void)

Protected Attributes

NetworkID networkId
TM_World * world
DataStructures::List< TM_Team * > teams
NoTeamId noTeamSubcategory
DataStructures::List
< RequestedTeam > 		teamsRequested
JoinTeamType joinTeamType
DataStructures::List< TM_Team * > lastTeams
SLNet::Time whenJoinAnyRequested
unsigned int | joinAnyRequestIndex
void * | owner

Constructor & Destructor Documentation

SLNet::TM_TeamMember::TM_TeamMember ( )
virtual SLNet::TM_TeamMember::~TM_TeamMember ( )
virtual

Member Function Documentation

void SLNet::TM_TeamMember::AddToRequestedTeams ( TM_Team * teamToJoin )
protected
void SLNet::TM_TeamMember::AddToRequestedTeams | ( | TM_Team * | teamToJoin,
 |  | TM_Team * | teamToLeave
 | ) |  |
protected
void SLNet::TM_TeamMember::AddToTeamList ( TM_Team * team )
protected
bool SLNet::TM_TeamMember::CancelTeamRequest ( TM_Team * specificTeamToCancel )

Cancels a request to join a specific team.

Useful if you got ID_TEAM_BALANCER_REQUESTED_TEAM_FULL or ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED and changed your mind about joining the team.

Note
This is not guaranteed to work due to latency. To clarify, If the host switches your team at the same time you call CancelRequestTeam() you may still get ID_TEAM_BALANCER_TEAM_ASSIGNED for the team you tried to cancel.
Parameters
[in] specificTeamToCancel Which team to no longer join. Use 0 for all.
Returns
false On invalid or unnecessary operation. Otherwise returns true
bool SLNet::TM_TeamMember::DeserializeConstruction | ( | TeamManager * | teamManager,
 |  | BitStream * | constructionBitstream
 | ) |  |

Deserializes the current state of this object.

See SerializeConstruction for more details()

Note
DeserializeConstruction also calls ReferenceTeamMember on the passed teamManager instance, there is no need to do so yourself
Parameters
[in] | teamManager | TeamManager instance
[in] | constructionBitstream | This object serialized to a BitStream
TM_Team* SLNet::TM_TeamMember::GetCurrentTeam ( void ) const
Returns
Get the first team we are on, or 0 if we are not on a team.
TM_Team* SLNet::TM_TeamMember::GetCurrentTeamByIndex ( unsigned int index )
Returns
Returns one of the teams in the current team list, up to GetCurrentTeamCount()
unsigned int SLNet::TM_TeamMember::GetCurrentTeamCount ( void ) const
Returns
How many teams we are on
void SLNet::TM_TeamMember::GetCurrentTeams ( DataStructures::List< TM_Team * > & _teams ) const
Parameters
[out] Get all teams we are on, as a list
void SLNet::TM_TeamMember::GetLastTeams ( DataStructures::List< TM_Team * > & _teams ) const

For each team member, when you get ID_TEAM_BALANCER_TEAM_ASSIGNED for that member, the team list is saved. Use this function to get that list, for example to determine which teams we just left or joined

Parameters
[out] _teams The previous list of teams we were on
NetworkID SLNet::TM_TeamMember::GetNetworkID ( void ) const
Returns
The teamMemberID parameter passed to TM_World::ReferenceTeamMember()
NoTeamId SLNet::TM_TeamMember::GetNoTeamId ( void ) const
Returns
If not on a team, returns the current NoTeamId value
void* SLNet::TM_TeamMember::GetOwner ( void ) const
Returns
Whatever was passed to SetOwner()
void SLNet::TM_TeamMember::GetRequestedSpecificTeams ( DataStructures::List< TM_Team * > & requestedTeams ) const

Returns pending calls to RequestTeam() when using TeamSelection::JOIN_SPECIFIC_TEAM.

Parameters
[out] All pending requested teams
TeamSelection SLNet::TM_TeamMember::GetRequestedTeam ( void ) const

Returns the first requested team in the list of requested teams, if you have a requested team at all.

Returns
TeamSelection::SpecificTeam(), TeamSelection::NoTeam(), or TeamSelection::AnyAvailable()
unsigned int SLNet::TM_TeamMember::GetRequestedTeamCount ( void ) const
Returns
The number of teams that would be returned by a call to GetRequestedSpecificTeams()
unsigned int SLNet::TM_TeamMember::GetRequestedTeamIndex ( TM_Team * team ) const

Returns the index of team in the requested teams list.

Parameters
[in] The team we are checking
Returns
-1 if we did not requested to join this team. Otherwise the index.
TM_World* SLNet::TM_TeamMember::GetTM_World ( void ) const
Returns
The TM_World instance that was used when calling TM_World::ReferenceTeamMember()
unsigned int SLNet::TM_TeamMember::GetWorldIndex ( void ) const

Return world->GetTeamMemberIndex(this)

bool SLNet::TM_TeamMember::HasRequestedTeam ( TM_Team * team ) const

Returns if the specified team is in the list of pending requested teams.

Parameters
[in] The team we are checking
Returns
Did we request to join this specific team?
bool SLNet::TM_TeamMember::IsOnTeam ( TM_Team * team ) const
Parameters
[in] The team we are checking
Returns
Are we on this team?
bool SLNet::TM_TeamMember::JoinAnyTeamCheck ( void ) const
protected
bool SLNet::TM_TeamMember::JoinSpecificTeamCheck | ( | TM_Team * | specificTeamToJoin,
 |  | bool | ignoreRequested
 | ) |  | const
 protected
bool SLNet::TM_TeamMember::LeaveAllTeams ( NoTeamId inNoTeamSubcategory )

Leave all teams Leaves all teams you are on, and sets noTeamSubcategory.

Note
This is the same as and just calls RequestTeam(TeamSelection::NoTeam(noTeamSubcategory));
Returns
false On invalid or unnecessary operation. Otherwise returns true
bool SLNet::TM_TeamMember::LeaveTeam | ( | TM_Team * | team,
 |  | NoTeamId | _noTeamSubcategory
 | ) |  |

Leave a team.

Leaves a team that you are on. Always succeeds provided you are on that team Generates ID_TEAM_BALANCER_TEAM_ASSIGNED on all systems on success. If you leave the last team you are on, noTeamSubcategory is set as well.

Parameters
[in] | team | Which team to leave
[in] | _noTeamSubcategory | If the team member has been removed from all teams, which subcategory of NoTeamId to set them to
Returns
false On invalid or unnecessary operation. Otherwise returns true
bool SLNet::TM_TeamMember::LeaveTeamCheck ( TM_Team * team ) const
protected
void SLNet::TM_TeamMember::RemoveFromAllTeamsInternal ( void )
protected
bool SLNet::TM_TeamMember::RemoveFromRequestedTeams ( TM_Team * team )
protected
void SLNet::TM_TeamMember::RemoveFromSpecificTeamInternal ( TM_Team * team )
protected
bool SLNet::TM_TeamMember::RequestTeam ( TeamSelection teamSelection )

Request to join any team, a specific team, or to leave all teams.

Function will return false on invalid operations, such as joining a team you are already on. Will also fail with TeamSelection::JOIN_ANY_AVAILABLE_TEAM if you are currently on a team. On success, every system will get ID_TEAM_BALANCER_TEAM_ASSIGNED. Use TeamManager::DecomposeTeamAssigned() to get details of which team member the message refers to. On failure, all systems will get ID_TEAM_BALANCER_REQUESTED_TEAM_FULL or ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED. Use TeamManager::DecomposeTeamFull() and TeamManager::DecomposeTeamLocked() to get details of which team member the message refers to.

Note
Joining a specific team with this function may result in being on more than one team at once, even if you call the function while locally only on one team. If your game depends on only being on one team at a team, use RequestTeamSwitch() instead with the parameter teamToLeave set to 0
Parameters
[in] TeamSelection::AnyAvailable(),TeamSelection::SpecificTeam(),or TeamSelection::NoTeam()
Returns
false On invalid or unnecessary operation. Otherwise returns true
bool SLNet::TM_TeamMember::RequestTeamSwitch | ( | TM_Team * | teamToJoin,
 |  | TM_Team * | teamToLeave
 | ) |  |

Similar to RequestTeam with TeamSelection::SpecificTeam(), but leave a team simultaneously when the desired team is joinable.

Parameters
[in] | teamToJoin | Which team to join
[in] | teamToLeave | If 0, means leave all current teams. Otherwise, leave the specified team.
Returns
false On invalid or unnecessary operation. Otherwise returns true
void SLNet::TM_TeamMember::SerializeConstruction ( BitStream * constructionBitstream )

Serializes the current state of this object.

To replicate a TM_TeamMember on another system, first instantiate the object using your own code, or a system such as ReplicaManager3. Next, call SerializeConstruction() from whichever system owns the team member Last, call DeserializeConstruction() on the newly created TM_TeamMember

Note
You must instantiate and deserialize all TM_Team instances that the team member refers to before calling DesrializeConstruction(). ReplicaManager3::PostSerializeConstruction() and ReplicaManager3::PostDeserializeConstruction() will ensure this.
Parameters
[out] constructionBitstream This object serialized to a BitStream
void SLNet::TM_TeamMember::SetOwner ( void * o )
Parameters
[in] o Stores a void* for your own use. If using composition, this is useful to store a pointer to the containing object.
void SLNet::TM_TeamMember::StoreLastTeams ( void )
protected
bool SLNet::TM_TeamMember::SwitchSpecificTeamCheck | ( | TM_Team * | teamToJoin,
 |  | TM_Team * | teamToLeave,
 |  | bool | ignoreRequested
 | ) |  | const
 protected
static unsigned long SLNet::TM_TeamMember::ToUint32 ( const NetworkID & g )
static
void SLNet::TM_TeamMember::UpdateListsToNoTeam ( NoTeamId nti )
protected
void SLNet::TM_TeamMember::UpdateTeamsRequestedToAny ( void )
protected
void SLNet::TM_TeamMember::UpdateTeamsRequestedToNone ( void )
protected

Member Data Documentation

unsigned int SLNet::TM_TeamMember::joinAnyRequestIndex
protected

Definition at line 286 of file TeamManager.h.

JoinTeamType SLNet::TM_TeamMember::joinTeamType
protected

Definition at line 282 of file TeamManager.h.

DataStructures::List<TM_Team*> SLNet::TM_TeamMember::lastTeams
protected

Definition at line 284 of file TeamManager.h.

NetworkID SLNet::TM_TeamMember::networkId
protected

Definition at line 272 of file TeamManager.h.

NoTeamId SLNet::TM_TeamMember::noTeamSubcategory
protected

Definition at line 277 of file TeamManager.h.

void* SLNet::TM_TeamMember::owner
protected

Definition at line 287 of file TeamManager.h.

DataStructures::List<TM_Team*> SLNet::TM_TeamMember::teams
protected

Definition at line 275 of file TeamManager.h.

DataStructures::List<RequestedTeam> SLNet::TM_TeamMember::teamsRequested
protected

Definition at line 279 of file TeamManager.h.

SLNet::Time SLNet::TM_TeamMember::whenJoinAnyRequested
protected

Definition at line 285 of file TeamManager.h.

TM_World* SLNet::TM_TeamMember::world
protected

Definition at line 273 of file TeamManager.h.

class SLNet::TM_Team

A team, containing a list of TM_TeamMember instances.

Contains lists of TM_TeamMember instances Best used as a composite member of your "Team" or "PlayerList" class(es). When using with ReplicaManager3, call TM_Team::ReferenceTeam() in Replica3::DeserializeConstruction() and TM_Team::DeserializeConstruction() in Replica3::PostDeserializeConstruction() There is otherwise no need to manually serialize the class, as operations are networked internally.

Definition at line 316 of file TeamManager.h.

Public Member Functions

TM_Team ()
virtual | ~TM_Team ()
bool | SetMemberLimit (TeamMemberLimit _teamMemberLimit, NoTeamId noTeamSubcategory)
Set the maximum number of members that can join this team. Defaults to 65535 Setting the limit lower than the existing number of members kicks members out, and assigns noTeamSubcategory to them if they have no other team to go to Setting the limit higher allows members to join in. If a member has a pending request to join this team, they join automatically and ID_TEAM_BALANCER_TEAM_ASSIGNED will be returned for those members.
TeamMemberLimit | GetMemberLimit (void) const
TeamMemberLimit | GetMemberLimitSetting (void) const
bool | SetJoinPermissions (JoinPermissions _joinPermissions)
Who can join this team under what conditions, while the team is not full To not allow new joins, pass 0 To allow all new joins under any circumstances, bitwise-OR all permission defines. For an invite-only team, use ALLOW_JOIN_SPECIFIC_TEAM only and only allow the requester to call TM_TeamMember::RequestTeam() upon invitiation through your game code. Defaults to allow all.
JoinPermissions | GetJoinPermissions (void) const
void | LeaveTeam (TM_TeamMember *teamMember, NoTeamId noTeamSubcategory)
Removes a member from a team he or she is on.
bool | GetBalancingApplies (void) const
void | GetTeamMembers (DataStructures::List< TM_TeamMember * > &_teamMembers) const
unsigned int | GetTeamMembersCount (void) const
TM_TeamMember * | GetTeamMemberByIndex (unsigned int index) const
NetworkID | GetNetworkID (void) const
TM_World * | GetTM_World (void) const
void | SerializeConstruction (BitStream *constructionBitstream)
Used by the host to serialize the initial state of this object to a new system.
bool | DeserializeConstruction (TeamManager *teamManager, BitStream *constructionBitstream)
Used by non-host systems to read the bitStream written by SerializeConstruction()
void | SetOwner (void *o)
void * | GetOwner (void) const
unsigned int | GetWorldIndex (void) const
Return world->GetTeamIndex(this)

Static Public Member Functions

static unsigned long | ToUint32 (const NetworkID &g)

Protected Member Functions

void | RemoveFromTeamMemberList (TM_TeamMember *teamMember)
unsigned int | GetMemberWithRequestedSingleTeamSwitch (TM_Team *team)

Protected Attributes

NetworkID ID
TM_World * world
DataStructures::List
< TM_TeamMember * > 		teamMembers
JoinPermissions joinPermissions
bool | balancingApplies
TeamMemberLimit teamMemberLimit
void * | owner

Constructor & Destructor Documentation

SLNet::TM_Team::TM_Team ( )
virtual SLNet::TM_Team::~TM_Team ( )
virtual

Member Function Documentation

bool SLNet::TM_Team::DeserializeConstruction | ( | TeamManager * | teamManager,
 |  | BitStream * | constructionBitstream
 | ) |  |

Used by non-host systems to read the bitStream written by SerializeConstruction()

On non-host systems, after creating existing objects, call DeserializeConstruction() to read and setup that object Creating the actual Team and TeamMember objects should be handled by your game code, or a system such as ReplicaManager3

bool SLNet::TM_Team::GetBalancingApplies ( void ) const
Returns
What was passed as the applyBalancing parameter TM_World::ReferenceTeam() when this team was added.
JoinPermissions SLNet::TM_Team::GetJoinPermissions ( void ) const
Returns
Whatever was passed to SetJoinPermissions(), or the default.
TeamMemberLimit SLNet::TM_Team::GetMemberLimit ( void ) const
Returns
If team balancing is on, the most members that can be on this team that would not either unbalance it or exceed the value passed to SetMemberLimit(). If team balancing is off, the same as GetMemberLimitSetting()
TeamMemberLimit SLNet::TM_Team::GetMemberLimitSetting ( void ) const
Returns
What was passed to SetMemberLimit() or the default
unsigned int SLNet::TM_Team::GetMemberWithRequestedSingleTeamSwitch ( TM_Team * team )
protected
NetworkID SLNet::TM_Team::GetNetworkID ( void ) const
Returns
The teamID parameter passed to TM_World::ReferenceTeam()
void* SLNet::TM_Team::GetOwner ( void ) const
Returns
Whatever was passed to SetOwner()
TM_TeamMember* SLNet::TM_Team::GetTeamMemberByIndex ( unsigned int index ) const
Returns
A team member on this team. Members are stored in the order they are added
Parameters
[in] index A value between 0 and GetTeamMembersCount()
void SLNet::TM_Team::GetTeamMembers ( DataStructures::List< TM_TeamMember * > & _teamMembers ) const
Parameters
[out] All team members of this team
unsigned int SLNet::TM_Team::GetTeamMembersCount ( void ) const
Returns
The number of team members on this team
TM_World* SLNet::TM_Team::GetTM_World ( void ) const
Returns
The TM_World instance that was used when calling TM_World::ReferenceTeamMember()
unsigned int SLNet::TM_Team::GetWorldIndex ( void ) const

Return world->GetTeamIndex(this)

void SLNet::TM_Team::LeaveTeam | ( | TM_TeamMember * | teamMember,
 |  | NoTeamId | noTeamSubcategory
 | ) |  |

Removes a member from a team he or she is on.

Identical to teamMember->LeaveTeam(this, noTeamSubcategory); See TeamMember::LeaveTeam() for details.

Parameters
[in] | teamMember | Which team member to remove
[in] | noTeamSubcategory | If the team member has been removed from all teams, which subcategory of NoTeamId to set them to
void SLNet::TM_Team::RemoveFromTeamMemberList ( TM_TeamMember * teamMember )
protected
void SLNet::TM_Team::SerializeConstruction ( BitStream * constructionBitstream )

Used by the host to serialize the initial state of this object to a new system.

On the host, when sending existing objects to a new system, call SerializeConstruction() on each of those objects to serialize creation state. Creating the actual Team and TeamMember objects should be handled by your game code, or a system such as ReplicaManager3

bool SLNet::TM_Team::SetJoinPermissions ( JoinPermissions _joinPermissions )

Who can join this team under what conditions, while the team is not full To not allow new joins, pass 0 To allow all new joins under any circumstances, bitwise-OR all permission defines. For an invite-only team, use ALLOW_JOIN_SPECIFIC_TEAM only and only allow the requester to call TM_TeamMember::RequestTeam() upon invitiation through your game code. Defaults to allow all.

Parameters
[in] _joinPermissions Bitwise combination of ALLOW_JOIN_ANY_AVAILABLE_TEAM, ALLOW_JOIN_SPECIFIC_TEAM, ALLOW_JOIN_REBALANCING
Returns
false On invalid or unnecessary operation. Otherwise returns true
bool SLNet::TM_Team::SetMemberLimit | ( | TeamMemberLimit | _teamMemberLimit,
 |  | NoTeamId | noTeamSubcategory
 | ) |  |

Set the maximum number of members that can join this team. Defaults to 65535 Setting the limit lower than the existing number of members kicks members out, and assigns noTeamSubcategory to them if they have no other team to go to Setting the limit higher allows members to join in. If a member has a pending request to join this team, they join automatically and ID_TEAM_BALANCER_TEAM_ASSIGNED will be returned for those members.

Parameters
[in] | _teamMemberLimit | The new limit
[in] | noTeamSubcategory | Which noTeamSubcategory to assign to members that now have no team.
Returns
false On invalid or unnecessary operation. Otherwise returns true
void SLNet::TM_Team::SetOwner ( void * o )
Parameters
[in] o Stores a void* for your own use. If using composition, this is useful to store a pointer to the containing object.
static unsigned long SLNet::TM_Team::ToUint32 ( const NetworkID & g )
static

Member Data Documentation

bool SLNet::TM_Team::balancingApplies
protected

Definition at line 407 of file TeamManager.h.

NetworkID SLNet::TM_Team::ID
protected

Definition at line 400 of file TeamManager.h.

JoinPermissions SLNet::TM_Team::joinPermissions
protected

Definition at line 405 of file TeamManager.h.

void* SLNet::TM_Team::owner
protected

Definition at line 409 of file TeamManager.h.

TeamMemberLimit SLNet::TM_Team::teamMemberLimit
protected

Definition at line 408 of file TeamManager.h.

DataStructures::List<TM_TeamMember*> SLNet::TM_Team::teamMembers
protected

Definition at line 403 of file TeamManager.h.

TM_World* SLNet::TM_Team::world
protected

Definition at line 401 of file TeamManager.h.

class SLNet::TM_World

Stores a list of teams which may be enforcing a balanced number of members.

Each TM_World instance is independent of other TM_World world instances. This enables you to host multiple games on a single computer. Not currently supported to have the same TM_Team or TM_TeamMember in more than one world at a time, but easily added on request.

Definition at line 427 of file TeamManager.h.

Public Member Functions

TM_World ()
virtual | ~TM_World ()
TeamManager * | GetTeamManager (void) const
void | AddParticipant (RakNetGUID rakNetGUID)
Add a new system to send team and team member updates to.
void | RemoveParticipant (RakNetGUID rakNetGUID)
Remove a system that was previously added with AddParticipant()
void | SetAutoManageConnections (bool autoAdd)
If true, all new connections are added to this world using AddParticipant()
void | GetParticipantList (DataStructures::List< RakNetGUID > &participantList)
void | ReferenceTeam (TM_Team *team, NetworkID networkId, bool applyBalancing)
Register a TM_Team object with this system.
void | DereferenceTeam (TM_Team *team, NoTeamId noTeamSubcategory)
Unregisters the associated TM_Team object with this system. Call when a TM_Team instance is no longer needed.
unsigned int | GetTeamCount (void) const
TM_Team * | GetTeamByIndex (unsigned int index) const
TM_Team * | GetTeamByNetworkID (NetworkID teamId)
unsigned int | GetTeamIndex (const TM_Team *team) const
Inverse of GetTeamByIndex()
void | ReferenceTeamMember (TM_TeamMember *teamMember, NetworkID networkId)
Register a TM_TeamMember object with this system.
void | DereferenceTeamMember (TM_TeamMember *teamMember)
Unregisters the associated TM_TeamMember object with this system. Call when a TM_TeamMember instance is no longer needed.
unsigned int | GetTeamMemberCount (void) const
TM_TeamMember * | GetTeamMemberByIndex (unsigned int index) const
NetworkID | GetTeamMemberIDByIndex (unsigned int index) const
TM_TeamMember * | GetTeamMemberByNetworkID (NetworkID teamMemberId)
unsigned int | GetTeamMemberIndex (const TM_TeamMember *teamMember) const
Inverse of GetTeamMemberByIndex()
bool | SetBalanceTeams (bool balanceTeams, NoTeamId noTeamSubcategory)
Force or stop forcing teams to be balanced.
bool | GetBalanceTeams (void) const
void | SetHost (RakNetGUID _hostGuid)
Set the host that will perform balancing calculations and send notifications.
RakNetGUID | GetHost (void) const
WorldId | GetWorldId (void) const
void | Clear (void)
Clear all memory and reset everything.

Static Public Member Functions

static int | JoinRequestHelperComp (const TM_World::JoinRequestHelper &key, const TM_World::JoinRequestHelper &data)

Protected Member Functions

virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
void | EnforceTeamBalance (NoTeamId noTeamSubcategory)
void | KickExcessMembers (NoTeamId noTeamSubcategory)
void | FillRequestedSlots (void)
unsigned int | GetAvailableTeamIndexWithFewestMembers (TeamMemberLimit secondaryLimit, JoinPermissions joinPermissions)
void | GetSortedJoinRequests (DataStructures::OrderedList< JoinRequestHelper, JoinRequestHelper, JoinRequestHelperComp > &joinRequests)
void | BroadcastToParticipants (SLNet::BitStream *bsOut, RakNetGUID exclusionGuid)
void | BroadcastToParticipants (unsigned char *data, const int length, RakNetGUID exclusionGuid)
TM_Team * | JoinAnyTeam (TM_TeamMember *teamMember, int *resultCode)
int | JoinSpecificTeam (TM_TeamMember *teamMember, TM_Team *team, bool isTeamSwitch, TM_Team *teamToLeave, DataStructures::List< TM_Team * > &teamsWeAreLeaving)
TeamMemberLimit | GetBalancedTeamLimit (void) const

Protected Attributes

DataStructures::Hash
< NetworkID, TM_Team
*, 256, TM_Team::ToUint32 > 		teamsHash
DataStructures::Hash
< NetworkID, TM_TeamMember
*, 256, TM_TeamMember::ToUint32 > 		teamMembersHash
TeamManager * teamManager
DataStructures::List< RakNetGUID > participants
DataStructures::List< TM_Team * > teams
DataStructures::List
< TM_TeamMember * > 		teamMembers
bool | balanceTeamsIsActive
RakNetGUID hostGuid
WorldId worldId
bool | autoAddParticipants
int | teamRequestIndex

Constructor & Destructor Documentation

SLNet::TM_World::TM_World ( )
virtual SLNet::TM_World::~TM_World ( )
virtual

Member Function Documentation

void SLNet::TM_World::AddParticipant ( RakNetGUID rakNetGUID )

Add a new system to send team and team member updates to.

Parameters
[in] rakNetGUID GUID of the system you are adding. See Packet::rakNetGUID or RakPeerInterface::GetGUIDFromSystemAddress()
void SLNet::TM_World::BroadcastToParticipants | ( | SLNet::BitStream * | bsOut,
 |  | RakNetGUID | exclusionGuid
 | ) |  |
protected
void SLNet::TM_World::BroadcastToParticipants | ( | unsigned char * | data,
 |  | const int | length,
 |  | RakNetGUID | exclusionGuid
 | ) |  |
protected
void SLNet::TM_World::Clear ( void )

Clear all memory and reset everything.

It is up to the user to deallocate pointers passed to ReferenceTeamMember() or ReferenceTeam(), if so desired.

void SLNet::TM_World::DereferenceTeam | ( | TM_Team * | team,
 |  | NoTeamId | noTeamSubcategory
 | ) |  |

Unregisters the associated TM_Team object with this system. Call when a TM_Team instance is no longer needed.

Parameters
[in] | team | Which team instance to unregister
[in] | noTeamSubcategory | All players on this team are kicked off. If these players then have no team, they are set to this no team category.
void SLNet::TM_World::DereferenceTeamMember ( TM_TeamMember * teamMember )

Unregisters the associated TM_TeamMember object with this system. Call when a TM_TeamMember instance is no longer needed.

Note
This is called by the destructor of TM_TeamMember automatically, so you do not normally need to call this function
void SLNet::TM_World::EnforceTeamBalance ( NoTeamId noTeamSubcategory )
protected
void SLNet::TM_World::FillRequestedSlots ( void )
protected
unsigned int SLNet::TM_World::GetAvailableTeamIndexWithFewestMembers | ( | TeamMemberLimit | secondaryLimit,
 |  | JoinPermissions | joinPermissions
 | ) |  |
protected
TeamMemberLimit SLNet::TM_World::GetBalancedTeamLimit ( void ) const
protected
bool SLNet::TM_World::GetBalanceTeams ( void ) const
Returns
balanceTeams parameter of SetBalanceTeams(), or the default
RakNetGUID SLNet::TM_World::GetHost ( void ) const
Returns
Returns the current host, or UNASSIGNED_RAKNET_GUID if unknown
void SLNet::TM_World::GetParticipantList ( DataStructures::List< RakNetGUID > & participantList )

Get the participants added with AddParticipant()

Parameters
[out] participantList Participants added with AddParticipant();
void SLNet::TM_World::GetSortedJoinRequests ( DataStructures::OrderedList< JoinRequestHelper, JoinRequestHelper, JoinRequestHelperComp > & joinRequests )
protected
TM_Team* SLNet::TM_World::GetTeamByIndex ( unsigned int index ) const
Parameters
[in] index A value between 0 and GetTeamCount()
Returns
Returns whatever was passed to team in the function ReferenceTeam() in the order it was called.
TM_Team* SLNet::TM_World::GetTeamByNetworkID ( NetworkID teamId )
Parameters
[in] teamId Value passed to ReferenceTeam()
Returns
Returns whatever was passed to team in the function ReferenceTeam() with this NetworkID.
unsigned int SLNet::TM_World::GetTeamCount ( void ) const
Returns
Number of teams uniquely added with ReferenceTeam()
unsigned int SLNet::TM_World::GetTeamIndex ( const TM_Team * team ) const

Inverse of GetTeamByIndex()

Parameters
[in] team Which taem
Returns
The index of the specified team, or -1 if not found
TeamManager* SLNet::TM_World::GetTeamManager ( void ) const
Returns
Returns the plugin that created this TM_World instance
TM_TeamMember* SLNet::TM_World::GetTeamMemberByIndex ( unsigned int index ) const
Parameters
[in] index A value between 0 and GetTeamMemberCount()
Returns
Returns whatever was passed to team in the function ReferenceTeamMember() in the order it was called.
TM_TeamMember* SLNet::TM_World::GetTeamMemberByNetworkID ( NetworkID teamMemberId )
Parameters
[in] teamId Value passed to ReferenceTeamMember()
Returns
Returns Returns whatever was passed to team in the function ReferenceTeamMember() with this NetworkID
unsigned int SLNet::TM_World::GetTeamMemberCount ( void ) const
Returns
Number of team members uniquely added with ReferenceTeamMember()
NetworkID SLNet::TM_World::GetTeamMemberIDByIndex ( unsigned int index ) const
Parameters
[in] index A value between 0 and GetTeamMemberCount()
Returns
Returns whatever was passed to teamMemberID in the function ReferenceTeamMember() in the order it was called.
unsigned int SLNet::TM_World::GetTeamMemberIndex ( const TM_TeamMember * teamMember ) const

Inverse of GetTeamMemberByIndex()

Parameters
[in] team Which team member
Returns
The index of the specified team member, or -1 if not found
WorldId SLNet::TM_World::GetWorldId ( void ) const
Returns
The worldId passed to TeamManagr::AddWorld()
TM_Team* SLNet::TM_World::JoinAnyTeam | ( | TM_TeamMember * | teamMember,
 |  | int * | resultCode
 | ) |  |
protected
static int SLNet::TM_World::JoinRequestHelperComp | ( | const TM_World::JoinRequestHelper & | key,
 |  | const TM_World::JoinRequestHelper & | data
 | ) |  |
static
int SLNet::TM_World::JoinSpecificTeam | ( | TM_TeamMember * | teamMember,
 |  | TM_Team * | team,
 |  | bool | isTeamSwitch,
 |  | TM_Team * | teamToLeave,
 |  | DataStructures::List< TM_Team * > & | teamsWeAreLeaving
 | ) |  |
protected
void SLNet::TM_World::KickExcessMembers ( NoTeamId noTeamSubcategory )
protected
virtual void SLNet::TM_World::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
protectedvirtual
virtual void SLNet::TM_World::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
protectedvirtual
void SLNet::TM_World::ReferenceTeam | ( | TM_Team * | team,
 |  | NetworkID | networkId,
 |  | bool | applyBalancing
 | ) |  |

Register a TM_Team object with this system.

Your game should contain instances of TM_Team, for example by using composition with your game's Team or PlayerList class Tell TeamManager about these instances using ReferenceTeam().

Note
The destrutor of TM_Team calls DereferenceTeam() automatically.
Parameters
[in] | team | The instance you are registering
[in] | networkId | Identifies this instance. This value is independent of values used by NetworkIDManager. You can use the same value as the object that contains this instance.
[in] | applyBalancing | Whether or not to include this team for balancing when calling SetBalanceTeams().
void SLNet::TM_World::ReferenceTeamMember | ( | TM_TeamMember * | teamMember,
 |  | NetworkID | networkId
 | ) |  |

Register a TM_TeamMember object with this system.

Your game should contain instances of TM_TeamMember, for example by using composition with your game's User or Player classes Tell TeamManager about these instances using ReferenceTeamMember().

Note
The destrutor of TM_TeamMember calls DereferenceTeamMember() automatically.
Parameters
[in] | teamMember | The instance you are registering
[in] | networkId | Identifies this instance. This value is independent of values used by NetworkIDManager. You can use the same value as the object that contains this instance
void SLNet::TM_World::RemoveParticipant ( RakNetGUID rakNetGUID )

Remove a system that was previously added with AddParticipant()

Systems that disconnect are removed automatically

Parameters
[in] rakNetGUID GUID of the system you are removing. See Packet::rakNetGUID or RakPeerInterface::GetGUIDFromSystemAddress()
void SLNet::TM_World::SetAutoManageConnections ( bool autoAdd )

If true, all new connections are added to this world using AddParticipant()

Defaults to true

Parameters
[in] autoAdd Setting to set
bool SLNet::TM_World::SetBalanceTeams | ( | bool | balanceTeams,
 |  | NoTeamId | noTeamSubcategory
 | ) |  |

Force or stop forcing teams to be balanced.

For each team added with ReferenceTeam() and applyBalancing set to true, players on unbalanced teams will be redistributed While active, players can only join balanced teams if doing so would not cause that team to become unbalanced. If a player on the desired team also wants to switch, then both players will switch simultaneously. Otherwise, ID_TEAM_BALANCER_REQUESTED_TEAM_FULL will be returned to the requester and switching will occur when possible. If balanceTeams is true and later set to false, players waiting on ID_TEAM_BALANCER_REQUESTED_TEAM_FULL will be able to join the desired team immediately provided it is not full.

Parameters
[in] | balanceTeams | Whether to activate or deactivate team balancing.
[in] | noTeamSubcategory | If a player is kicked off a team and is no longer on any team, his or her noTeamSubcategory is set to this value
void SLNet::TM_World::SetHost ( RakNetGUID _hostGuid )

Set the host that will perform balancing calculations and send notifications.

Operations that can cause conflicts due to latency, such as joining teams, are operated on by the host. The result is sent to all systems added with AddParticipant() For a client/server game, call SetHost() with the server's RakNetGUID value on all systems (including the server itself). If you call TeamManager::SetTopology(TM_CLIENT_SERVER), the server will also relay messages between participants. For a peer to peer game, call SetHost() on the same peer when host migration occurs. Use TeamManager::SetTopology(TM_PEER_TO_PEER) in this case.

Note
If using FullyConnectedMesh2, SetHost() is called automatically when ID_FCM2_NEW_HOST is returned.
Parameters
[in] _hostGuid The host, which is the system that will serialize and resolve team disputes and calculate team balancing.

Member Data Documentation

bool SLNet::TM_World::autoAddParticipants
protected

Definition at line 599 of file TeamManager.h.

bool SLNet::TM_World::balanceTeamsIsActive
protected

Definition at line 596 of file TeamManager.h.

RakNetGUID SLNet::TM_World::hostGuid
protected

Definition at line 597 of file TeamManager.h.

DataStructures::List<RakNetGUID> SLNet::TM_World::participants
protected

Definition at line 593 of file TeamManager.h.

TeamManager* SLNet::TM_World::teamManager
protected

Definition at line 592 of file TeamManager.h.

DataStructures::List<TM_TeamMember*> SLNet::TM_World::teamMembers
protected

Definition at line 595 of file TeamManager.h.

DataStructures::Hash<NetworkID, TM_TeamMember*, 256, TM_TeamMember::ToUint32> SLNet::TM_World::teamMembersHash
protected

Definition at line 590 of file TeamManager.h.

int SLNet::TM_World::teamRequestIndex
protected

Definition at line 600 of file TeamManager.h.

DataStructures::List<TM_Team*> SLNet::TM_World::teams
protected

Definition at line 594 of file TeamManager.h.

DataStructures::Hash<NetworkID, TM_Team*, 256, TM_Team::ToUint32> SLNet::TM_World::teamsHash
protected

Definition at line 588 of file TeamManager.h.

WorldId SLNet::TM_World::worldId
protected

Definition at line 598 of file TeamManager.h.

class SLNet::TeamManager

Automates networking and list management for teams.

TeamManager provides support for teams. A team is a list of team members. Teams contain properties including the number of team members per team, whether or not tagged teams must have equal numbers of members, and if a team is locked or not to certain entry conditions Team members contain properties including which teams they are on and which teams they want to join if a team is not immediately joinable Advanced functionality includes the ability for a team member to be on multiple teams simultaneously, the ability to swap teams with other members, and the ability to resize the number of members supported per team The architecture is designed for easy integration with ReplicaManager3

Usage:

  1. Define your game classes to represent teams and team members. Your game classes should hold game-specific information such as team name and color.
  2. Have those game classes contain a corresponding TM_Team or TM_TeamMember instance. Operations on teams will be performed by those instances. Use SetOwner() to refer to the parent object when using composition.
  3. Call TeamManager::SetTopology() for client/server or peer to peer.
  4. Call AddWorld() to instantiate a TM_World object which will contain references to your TM_TeamMember and TM_Team instances.
  5. When you instantiate a TM_TeamMember or TM_Team object, call ReferenceTeam() and ReferenceTeamMember() for each corresponding object
  6. When sending world state to a new connection, for example in ReplicaManager3::SerializeConstruction(), call TM_SerializeConstruction() on the corresponding TM_TeamMember and TM_Team objects. TM_Team instances on the new connection must be created before TM_TeamMember instances.
  7. Call TM_DeserializeConstruction() on your new corresponding TM_TeamMember and TM_Team instances.
  8. Execute team operations. ID_TEAM_BALANCER_REQUESTED_TEAM_FULL, ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED, ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED, and ID_TEAM_BALANCER_TEAM_ASSIGNED are returned to all systems when the corresponding event occurs for a team member.
  9. As the peer to peer session host changes, call SetHost() (Not necessary if using FullyConnectedMesh2). If using client/server, you must set the host
    Note
    This replaces TeamBalancer. You cannot use TeamBalancer and TeamManager at the same time.

Definition at line 626 of file TeamManager.h.

+ Inheritance diagram for SLNet::TeamManager:

Public Member Functions

TeamManager ()
virtual | ~TeamManager ()
TM_World * | AddWorld (WorldId worldId)
Allocate a world to hold a list of teams and players for that team. Use the returned TM_World object for actual team functionality.
void | RemoveWorld (WorldId worldId)
Deallocate a world created with AddWorld()
unsigned int | GetWorldCount (void) const
TM_World * | GetWorldAtIndex (unsigned int index) const
TM_World * | GetWorldWithId (WorldId worldId) const
void | SetAutoManageConnections (bool autoAdd)
When auto managing connections, call TM_World::AddParticipant() on all worlds for all new connections automatically Defaults to true.
void | SetTopology (TMTopology _topology)
If _topology is set to TM_CLIENT_SERVER, the host will relay messages to participants.
void | DecomposeTeamFull (Packet *packet, TM_World **world, TM_TeamMember **teamMember, TM_Team **team, uint16_t &currentMembers, uint16_t &memberLimitIncludingBalancing, bool &balancingIsActive, JoinPermissions &joinPermissions)
When you get ID_TEAM_BALANCER_REQUESTED_TEAM_FULL, pass the packet to this function to read out parameters.
void | DecomposeTeamLocked (Packet *packet, TM_World **world, TM_TeamMember **teamMember, TM_Team **team, uint16_t &currentMembers, uint16_t &memberLimitIncludingBalancing, bool &balancingIsActive, JoinPermissions &joinPermissions)
When you get ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED, pass the packet to this function to read out parameters.
void | Clear (void)
Clear all memory and reset everything.
void | DecodeTeamAssigned (Packet *packet, TM_World **world, TM_TeamMember **teamMember)
Reads out the world and teamMember from ID_TEAM_BALANCER_TEAM_ASSIGNED.
void | DecodeTeamCancelled (Packet *packet, TM_World **world, TM_TeamMember **teamMember, TM_Team **teamCancelled)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
void | Send (const SLNet::BitStream *bitStream, const AddressOrGUID systemIdentifier, bool broadcast)
void | EncodeTeamFullOrLocked (SLNet::BitStream *bitStream, TM_TeamMember *teamMember, TM_Team *team)
void | DecomposeTeamFullOrLocked (SLNet::BitStream *bsIn, TM_World **world, TM_TeamMember **teamMember, TM_Team **team, uint16_t &currentMembers, uint16_t &memberLimitIncludingBalancing, bool &balancingIsActive, JoinPermissions &joinPermissions)
void | ProcessTeamAssigned (SLNet::BitStream *bsIn)
void | EncodeTeamAssigned (SLNet::BitStream *bitStream, TM_TeamMember *teamMember)
void | RemoveFromTeamsRequestedAndAddTeam (TM_TeamMember *teamMember, TM_Team *team, bool isTeamSwitch, TM_Team *teamToLeave)
void | PushTeamAssigned (TM_TeamMember *teamMember)
void | PushBitStream (SLNet::BitStream *bitStream)
void | OnUpdateListsToNoTeam (Packet *packet, TM_World *world)
void | OnUpdateTeamsRequestedToAny (Packet *packet, TM_World *world)
void | OnJoinAnyTeam (Packet *packet, TM_World *world)
void | OnJoinRequestedTeam (Packet *packet, TM_World *world)
void | OnUpdateTeamsRequestedToNoneAndAddTeam (Packet *packet, TM_World *world)
void | OnRemoveFromTeamsRequestedAndAddTeam (Packet *packet, TM_World *world)
void | OnAddToRequestedTeams (Packet *packet, TM_World *world)
bool | OnRemoveFromRequestedTeams (Packet *packet, TM_World *world)
void | OnLeaveTeam (Packet *packet, TM_World *world)
void | OnSetMemberLimit (Packet *packet, TM_World *world)
void | OnSetJoinPermissions (Packet *packet, TM_World *world)
void | OnSetBalanceTeams (Packet *packet, TM_World *world)
void | OnSetBalanceTeamsInitial (Packet *packet, TM_World *world)
void | EncodeTeamFull (SLNet::BitStream *bitStream, TM_TeamMember *teamMember, TM_Team *team)
void | EncodeTeamLocked (SLNet::BitStream *bitStream, TM_TeamMember *teamMember, TM_Team *team)
void | DecodeTeamAssigned (SLNet::BitStream *bsIn, TM_World **world, TM_TeamMember **teamMember, NoTeamId &noTeamSubcategory, JoinTeamType &joinTeamType, DataStructures::List< TM_Team * > &newTeam, DataStructures::List< TM_Team * > &teamsLeft, DataStructures::List< TM_Team * > &teamsJoined)
When you get ID_TEAM_BALANCER_TEAM_ASSIGNED, pass the packet to this function to read out parameters.
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

TM_World * | worldsArray [255]
DataStructures::List< TM_World * > worldsList
bool | autoAddParticipants
TMTopology topology
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::TeamManager::TeamManager ( )
virtual SLNet::TeamManager::~TeamManager ( )
virtual

Member Function Documentation

TM_World* SLNet::TeamManager::AddWorld ( WorldId worldId )

Allocate a world to hold a list of teams and players for that team. Use the returned TM_World object for actual team functionality.

Note
The world is tracked by TeamManager and deallocated by calling Clear()
Parameters
[in] worldId Arbitrary user-defined id of the world to create. Each world instance must have a unique id.
void SLNet::TeamManager::Clear ( void )

Clear all memory and reset everything.

Deallocates TM_World instances. It is up to the user to deallocate pointers passed to ReferenceTeamMember() or ReferenceTeam(), if so desired.

void SLNet::TeamManager::DecodeTeamAssigned | ( | Packet * | packet,
 |  | TM_World ** | world,
 |  | TM_TeamMember ** | teamMember
 | ) |  |

Reads out the world and teamMember from ID_TEAM_BALANCER_TEAM_ASSIGNED.

Note
You can get the current and prior team list from the teamMember itself
Parameters
[in] | A | packet where packet->data[0]==ID_TEAM_BALANCER_TEAM_ASSIGNED
[out] | world | Set to the world this teamMember is on. 0 on bad lookup.
[out] | teamMember | Set to the teamMember affected. 0 on bad lookup.
void SLNet::TeamManager::DecodeTeamAssigned | ( | SLNet::BitStream * | bsIn,
 |  | TM_World ** | world,
 |  | TM_TeamMember ** | teamMember,
 |  | NoTeamId & | noTeamSubcategory,
 |  | JoinTeamType & | joinTeamType,
 |  | DataStructures::List< TM_Team * > & | newTeam,
 |  | DataStructures::List< TM_Team * > & | teamsLeft,
 |  | DataStructures::List< TM_Team * > & | teamsJoined
 | ) |  |
protected

When you get ID_TEAM_BALANCER_TEAM_ASSIGNED, pass the packet to this function to read out parameters.

Parameters
[in] A packet where packet->data[0]==ID_TEAM_BALANCER_TEAM_ASSIGNED
Returns
true on success, false on read error
void SLNet::TeamManager::DecodeTeamCancelled | ( | Packet * | packet,
 |  | TM_World ** | world,
 |  | TM_TeamMember ** | teamMember,
 |  | TM_Team ** | teamCancelled
 | ) |  |
Note
You can get the requested team list from the teamMember itself
Parameters
[in] | A | packet where packet->data[0]==ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED
[out] | world | Set to the world this teamMember is on. 0 on bad lookup.
[out] | teamMember | Set to the teamMember affected. 0 on bad lookup.
[out] | teamCancelled | Set to the team that was cancelled. 0 for all teams.
void SLNet::TeamManager::DecomposeTeamFull | ( | Packet * | packet,
 |  | TM_World ** | world,
 |  | TM_TeamMember ** | teamMember,
 |  | TM_Team ** | team,
 |  | uint16_t & | currentMembers,
 |  | uint16_t & | memberLimitIncludingBalancing,
 |  | bool & | balancingIsActive,
 |  | JoinPermissions & | joinPermissions
 | ) |  |

When you get ID_TEAM_BALANCER_REQUESTED_TEAM_FULL, pass the packet to this function to read out parameters.

Parameters
[in] A packet where packet->data[0]==ID_TEAM_BALANCER_REQUESTED_TEAM_FULL
Returns
true on success, false on read error
void SLNet::TeamManager::DecomposeTeamFullOrLocked | ( | SLNet::BitStream * | bsIn,
 |  | TM_World ** | world,
 |  | TM_TeamMember ** | teamMember,
 |  | TM_Team ** | team,
 |  | uint16_t & | currentMembers,
 |  | uint16_t & | memberLimitIncludingBalancing,
 |  | bool & | balancingIsActive,
 |  | JoinPermissions & | joinPermissions
 | ) |  |
protected
void SLNet::TeamManager::DecomposeTeamLocked | ( | Packet * | packet,
 |  | TM_World ** | world,
 |  | TM_TeamMember ** | teamMember,
 |  | TM_Team ** | team,
 |  | uint16_t & | currentMembers,
 |  | uint16_t & | memberLimitIncludingBalancing,
 |  | bool & | balancingIsActive,
 |  | JoinPermissions & | joinPermissions
 | ) |  |

When you get ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED, pass the packet to this function to read out parameters.

Parameters
[in] A packet where packet->data[0]==ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED
Returns
true on success, false on read error
void SLNet::TeamManager::EncodeTeamAssigned | ( | SLNet::BitStream * | bitStream,
 |  | TM_TeamMember * | teamMember
 | ) |  |
protected
void SLNet::TeamManager::EncodeTeamFull | ( | SLNet::BitStream * | bitStream,
 |  | TM_TeamMember * | teamMember,
 |  | TM_Team * | team
 | ) |  |
protected
void SLNet::TeamManager::EncodeTeamFullOrLocked | ( | SLNet::BitStream * | bitStream,
 |  | TM_TeamMember * | teamMember,
 |  | TM_Team * | team
 | ) |  |
protected
void SLNet::TeamManager::EncodeTeamLocked | ( | SLNet::BitStream * | bitStream,
 |  | TM_TeamMember * | teamMember,
 |  | TM_Team * | team
 | ) |  |
protected
TM_World* SLNet::TeamManager::GetWorldAtIndex ( unsigned int index ) const
Parameters
[in] index A value beteween 0 and GetWorldCount()-1 inclusive.
Returns
Returns a world created with AddWorld()
unsigned int SLNet::TeamManager::GetWorldCount ( void ) const
Returns
Returns the number of worlds created with AddWorld()
TM_World* SLNet::TeamManager::GetWorldWithId ( WorldId worldId ) const
Parameters
[in] worldId worldId value passed to AddWorld()
Returns
Returns a world created with AddWorld(), or 0 if no such worldId
void SLNet::TeamManager::OnAddToRequestedTeams | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
virtual void SLNet::TeamManager::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
protectedvirtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

void SLNet::TeamManager::OnJoinAnyTeam | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnJoinRequestedTeam | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnLeaveTeam | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
virtual void SLNet::TeamManager::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
protectedvirtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::TeamManager::OnReceive ( Packet * packet )
protectedvirtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

bool SLNet::TeamManager::OnRemoveFromRequestedTeams | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnRemoveFromTeamsRequestedAndAddTeam | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnSetBalanceTeams | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnSetBalanceTeamsInitial | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnSetJoinPermissions | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnSetMemberLimit | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnUpdateListsToNoTeam | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnUpdateTeamsRequestedToAny | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::OnUpdateTeamsRequestedToNoneAndAddTeam | ( | Packet * | packet,
 |  | TM_World * | world
 | ) |  |
protected
void SLNet::TeamManager::ProcessTeamAssigned ( SLNet::BitStream * bsIn )
protected
void SLNet::TeamManager::PushBitStream ( SLNet::BitStream * bitStream )
protected
void SLNet::TeamManager::PushTeamAssigned ( TM_TeamMember * teamMember )
protected
void SLNet::TeamManager::RemoveFromTeamsRequestedAndAddTeam | ( | TM_TeamMember * | teamMember,
 |  | TM_Team * | team,
 |  | bool | isTeamSwitch,
 |  | TM_Team * | teamToLeave
 | ) |  |
protected
void SLNet::TeamManager::RemoveWorld ( WorldId worldId )

Deallocate a world created with AddWorld()

Parameters
[in] worldId The world to deallocate
void SLNet::TeamManager::Send | ( | const SLNet::BitStream * | bitStream,
 |  | const AddressOrGUID | systemIdentifier,
 |  | bool | broadcast
 | ) |  |
protected
void SLNet::TeamManager::SetAutoManageConnections ( bool autoAdd )

When auto managing connections, call TM_World::AddParticipant() on all worlds for all new connections automatically Defaults to true.

Note
You probably want this set to false if using multiple worlds
Parameters
[in] autoAdd Automatically call TM_World::AddParticipant() all worlds each new connection. Defaults to true.
void SLNet::TeamManager::SetTopology ( TMTopology _topology )

If _topology is set to TM_CLIENT_SERVER, the host will relay messages to participants.

If topology is set to TM_PEER_TO_PEER, the host assumes the original message source was connected to all other participants and does not relay messages.

Note
If TM_PEER_TO_PEER, this plugin will listen for ID_FCM2_NEW_HOST and call SetHost() on all worlds automatically
Defaults to TM_PEER_TO_PEER
Parameters
[in] _topology Topology to use
virtual void SLNet::TeamManager::Update ( void )
protectedvirtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

bool SLNet::TeamManager::autoAddParticipants
protected

Definition at line 749 of file TeamManager.h.

TMTopology SLNet::TeamManager::topology
protected

Definition at line 750 of file TeamManager.h.

TM_World* SLNet::TeamManager::worldsArray[255]
protected

Definition at line 746 of file TeamManager.h.

DataStructures::List<TM_World*> SLNet::TeamManager::worldsList
protected

Definition at line 748 of file TeamManager.h.

struct SLNet::TM_TeamMember::RequestedTeam

Definition at line 262 of file TeamManager.h.

Class Members
bool | isTeamSwitch
TM_Team * | requested
unsigned int | requestIndex
TM_Team * | teamToLeave
Time | whenRequested
struct SLNet::TM_World::JoinRequestHelper

Definition at line 549 of file TeamManager.h.

Class Members
unsigned int | indexIntoTeamsRequested
unsigned int | requestIndex
unsigned int | teamMemberIndex
Time | whenRequestMade
union SLNet::TeamSelection.teamParameter

Definition at line 111 of file TeamManager.h.

Class Members
NoTeamId | noTeamSubcategory
TM_Team * | specificTeamToJoin

Typedef Documentation

typedef unsigned char SLNet::NoTeamId

A subcategory of not being on a team. For example, 0 may mean no team for a player, while 1 may mean no team for a spectator. Defined by the user.

Definition at line 53 of file TeamManager.h.

typedef uint16_t SLNet::TeamMemberLimit

Maximum number of members on one team. Use 65535 for unlimited.

Definition at line 61 of file TeamManager.h.

Enumeration Type Documentation

enum SLNet::JoinTeamType
Enumerator:
JOIN_ANY_AVAILABLE_TEAM

Attempt to join the first available team.

JOIN_SPECIFIC_TEAM

Attempt to join a specific team, previously added with TM_World::ReferenceTeam()

JOIN_NO_TEAM

No team. Always succeeds.

Definition at line 80 of file TeamManager.h.

enum SLNet::TMTopology
Enumerator:
TM_PEER_TO_PEER
TM_CLIENT_SERVER

Definition at line 91 of file TeamManager.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: RakNetTransport

Classes
RakNetTransport
Plugins

UDP based transport implementation for the ConsoleServer. More...

Classes

class SLNet::RakNetTransport2
Use RakNetTransport if you need a secure connection between the client and the console server. More...

Detailed Description

UDP based transport implementation for the ConsoleServer.

Class Documentation

class SLNet::RakNetTransport2

Use RakNetTransport if you need a secure connection between the client and the console server.

RakNetTransport automatically initializes security for the system. Use the project CommandConsoleClient to connect To the ConsoleServer if you use RakNetTransport

Definition at line 49 of file transport2.h.

+ Inheritance diagram for SLNet::RakNetTransport2:

Public Member Functions

RakNetTransport2 ()
virtual | ~RakNetTransport2 ()
bool | Start (unsigned short port, bool serverMode)
void | Stop (void)
Stop the transport provider. You can clear memory and shutdown threads here.
void | Send (SystemAddress systemAddress, const char *data,...)
void | CloseConnection (SystemAddress systemAddress)
Packet * | Receive (void)
void | DeallocatePacket (Packet *packet)
SystemAddress | HasNewIncomingConnection (void)
SystemAddress | HasLostConnection (void)
virtual CommandParserInterface * | GetCommandParser (void)
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
- Public Member Functions inherited from SLNet::TransportInterface
TransportInterface ()
virtual | ~TransportInterface ()
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Attributes

DataStructures::Queue
< SystemAddress > 		newConnections
DataStructures::Queue
< SystemAddress > 		lostConnections
DataStructures::Queue< Packet * > packetQueue
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Additional Inherited Members

- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Constructor & Destructor Documentation

SLNet::RakNetTransport2::RakNetTransport2 ( )
virtual SLNet::RakNetTransport2::~RakNetTransport2 ( )
virtual

Member Function Documentation

void SLNet::RakNetTransport2::CloseConnection ( SystemAddress systemAddress )
virtual

Disconnect systemAddress . The binary address and port defines the SystemAddress structure.

Parameters
[in] systemAddress The player/address to disconnect

Implements SLNet::TransportInterface.

void SLNet::RakNetTransport2::DeallocatePacket ( Packet * packet )
virtual

Deallocate the Packet structure returned by Receive

Parameters
[in] The packet to deallocate

Implements SLNet::TransportInterface.

virtual CommandParserInterface* SLNet::RakNetTransport2::GetCommandParser ( void )
inlinevirtual

Your transport provider can itself have command parsers if the transport layer has user-modifiable features For example, your transport layer may have a password which you want remote users to be able to set or you may want to allow remote users to turn on or off command echo

Returns
0 if you do not need a command parser - otherwise the desired derivation of CommandParserInterface

Implements SLNet::TransportInterface.

Definition at line 98 of file transport2.h.

SystemAddress SLNet::RakNetTransport2::HasLostConnection ( void )
virtual

If a system loses the connection, you should queue that event and return the systemAddress/address of that player in this function.

Returns
The SystemAddress/address of the system

Implements SLNet::TransportInterface.

SystemAddress SLNet::RakNetTransport2::HasNewIncomingConnection ( void )
virtual

If a new system connects to you, you should queue that event and return the systemAddress/address of that player in this function.

Returns
The SystemAddress/address of the system

Implements SLNet::TransportInterface.

virtual void SLNet::RakNetTransport2::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::RakNetTransport2::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
virtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::RakNetTransport2::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

Packet* SLNet::RakNetTransport2::Receive ( void )
virtual

Return a string. The string should be allocated and written to Packet::data . The byte length should be written to Packet::length . The player/address should be written to Packet::systemAddress If your transport protocol adds special formatting to the data stream you should parse it out before returning it in the packet and thus only return a string in Packet::data

Returns
The packet structure containing the result of Receive, or 0 if no data is available

Implements SLNet::TransportInterface.

void SLNet::RakNetTransport2::Send | ( | SystemAddress | systemAddress,
 |  | const char * | data,
 |  |  | ...
 | ) |  |
virtual

Send a null-terminated string to systemAddress If your transport method requires particular formatting of the outgoing data (e.g. you don't just send strings) you can do it here and parse it out in Receive().

Parameters
[in] | systemAddress | The player to send the string to
[in] | data | format specifier - same as RAKNET_DEBUG_PRINTF
[in] ... format specification arguments - same as RAKNET_DEBUG_PRINTF

Implements SLNet::TransportInterface.

bool SLNet::RakNetTransport2::Start | ( | unsigned short | port,
 |  | bool | serverMode
 | ) |  |
virtual

Start the transport provider on the indicated port.

Parameters
[in] | port | The port to start the transport provider on
[in] | serverMode | If true, you should allow incoming connections (I don't actually use this anywhere)
Returns
Return true on success, false on failure.

Implements SLNet::TransportInterface.

void SLNet::RakNetTransport2::Stop ( void )
virtual

Stop the transport provider. You can clear memory and shutdown threads here.

Implements SLNet::TransportInterface.

Member Data Documentation

DataStructures::Queue<SystemAddress> SLNet::RakNetTransport2::lostConnections
protected

Definition at line 107 of file transport2.h.

DataStructures::Queue<SystemAddress> SLNet::RakNetTransport2::newConnections
protected

Definition at line 107 of file transport2.h.

DataStructures::Queue<Packet*> SLNet::RakNetTransport2::packetQueue
protected

Definition at line 108 of file transport2.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: UDPProxy

Classes
UDPProxy
Plugins

Forwards UDP datagrams from one system to another. Protocol independent. More...

Classes

struct | SLNet::UDPProxyClientResultHandler
class | SLNet::UDPProxyClient
Communicates with UDPProxyCoordinator, in order to find a UDPProxyServer to forward our datagrams. More...
struct | SLNet::UDPProxyServerResultHandler
class | SLNet::UDPProxyServer
UDPProxyServer to control our instance of UDPForwarder. More...
struct | SLNet::UDPProxyClient::PingServerGroup
struct | SLNet::UDPProxyClient::SenderAndTargetAddress
struct | SLNet::UDPProxyClient::ServerWithPing

Detailed Description

Forwards UDP datagrams from one system to another. Protocol independent.

Used when NatPunchthroughClient fails

Class Documentation

struct SLNet::UDPProxyClientResultHandler

Callback to handle results of calling UDPProxyClient::RequestForwarding()

Definition at line 42 of file UDPProxyClient.h.

Public Member Functions

UDPProxyClientResultHandler ()
virtual | ~UDPProxyClientResultHandler ()
virtual void | OnForwardingSuccess (const char *proxyIPAddress, unsigned short proxyPort, SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0
virtual void | OnForwardingNotification (const char *proxyIPAddress, unsigned short proxyPort, SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0
virtual void | OnNoServersOnline (SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0
virtual void | OnRecipientNotConnected (SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0
virtual void | OnAllServersBusy (SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0
virtual void | OnForwardingInProgress (const char *proxyIPAddress, unsigned short proxyPort, SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0

Constructor & Destructor Documentation

SLNet::UDPProxyClientResultHandler::UDPProxyClientResultHandler ( )
inline

Definition at line 44 of file UDPProxyClient.h.

virtual SLNet::UDPProxyClientResultHandler::~UDPProxyClientResultHandler ( )
inlinevirtual

Definition at line 45 of file UDPProxyClient.h.

Member Function Documentation

virtual void SLNet::UDPProxyClientResultHandler::OnAllServersBusy | ( | SystemAddress | proxyCoordinator,
 |  | SystemAddress | sourceAddress,
 |  | SystemAddress | targetAddress,
 |  | RakNetGUID | targetGuid,
 |  | SLNet::UDPProxyClient * | proxyClientPlugin
 | ) |  |
pure virtual

Called when our forwarding request failed, because all UDPProxyServers that are connected to UDPProxyCoordinator are at their capacity Either add more servers, or increase capacity via UDPForwarder::SetMaxForwardEntries()

Parameters
[out] | proxyCoordinator | proxyCoordinator parameter originally passed to UDPProxyClient::RequestForwarding
[out] | sourceAddress | sourceAddress parameter passed to UDPProxyClient::RequestForwarding. If it was UNASSIGNED_SYSTEM_ADDRESS, it is now our external IP address.
[out] | targetAddress | targetAddress parameter originally passed to UDPProxyClient::RequestForwarding
[out] | targetGuid | targetGuid parameter originally passed to UDPProxyClient::RequestForwarding
[out] | proxyClient | The plugin that is calling this callback
virtual void SLNet::UDPProxyClientResultHandler::OnForwardingInProgress | ( | const char * | proxyIPAddress,
 |  | unsigned short | proxyPort,
 |  | SystemAddress | proxyCoordinator,
 |  | SystemAddress | sourceAddress,
 |  | SystemAddress | targetAddress,
 |  | RakNetGUID | targetGuid,
 |  | SLNet::UDPProxyClient * | proxyClientPlugin
 | ) |  |
pure virtual

Called when our forwarding request is already in progress on the proxyCoordinator. This can be ignored, but indicates an unneeded second request

Parameters
[out] | proxyIPAddress | IP Address of the proxy server, which is forwarding messages to targetAddress
[out] | proxyPort | Remote port to use on the proxy server, which is forwarding messages to targetAddress
[out] | proxyCoordinator | proxyCoordinator parameter originally passed to UDPProxyClient::RequestForwarding
[out] | sourceAddress | sourceAddress parameter passed to UDPProxyClient::RequestForwarding. If it was UNASSIGNED_SYSTEM_ADDRESS, it is now our external IP address.
[out] | targetAddress | targetAddress parameter originally passed to UDPProxyClient::RequestForwarding
[out] | targetGuid | targetGuid parameter originally passed to UDPProxyClient::RequestForwarding
[out] | proxyClient | The plugin that is calling this callback
virtual void SLNet::UDPProxyClientResultHandler::OnForwardingNotification | ( | const char * | proxyIPAddress,
 |  | unsigned short | proxyPort,
 |  | SystemAddress | proxyCoordinator,
 |  | SystemAddress | sourceAddress,
 |  | SystemAddress | targetAddress,
 |  | RakNetGUID | targetGuid,
 |  | SLNet::UDPProxyClient * | proxyClientPlugin
 | ) |  |
pure virtual

Called when another system has setup forwarding, with our system as the target address. Plugin automatically sends a datagram to proxyIPAddress before this callback, to open our router if necessary.

Parameters
[out] | proxyIPAddress | IP Address of the proxy server, which will forward messages to targetAddress
[out] | proxyPort | Remote port to use on the proxy server, which will forward messages to targetAddress
[out] | proxyCoordinator | proxyCoordinator parameter originally passed to UDPProxyClient::RequestForwarding
[out] | sourceAddress | sourceAddress parameter passed to UDPProxyClient::RequestForwarding. This is originating source IP address of the remote system that will be sending to us.
[out] | targetAddress | targetAddress parameter originally passed to UDPProxyClient::RequestForwarding. This is our external IP address.
[out] | targetGuid | targetGuid parameter originally passed to UDPProxyClient::RequestForwarding
[out] | proxyClient | The plugin that is calling this callback
virtual void SLNet::UDPProxyClientResultHandler::OnForwardingSuccess | ( | const char * | proxyIPAddress,
 |  | unsigned short | proxyPort,
 |  | SystemAddress | proxyCoordinator,
 |  | SystemAddress | sourceAddress,
 |  | SystemAddress | targetAddress,
 |  | RakNetGUID | targetGuid,
 |  | SLNet::UDPProxyClient * | proxyClientPlugin
 | ) |  |
pure virtual

Called when our forwarding request was completed. We can now connect to targetAddress by using proxyAddress instead

Parameters
[out] | proxyIPAddress | IP Address of the proxy server, which will forward messages to targetAddress
[out] | proxyPort | Remote port to use on the proxy server, which will forward messages to targetAddress
[out] | proxyCoordinator | proxyCoordinator parameter originally passed to UDPProxyClient::RequestForwarding
[out] | sourceAddress | sourceAddress parameter passed to UDPProxyClient::RequestForwarding. If it was UNASSIGNED_SYSTEM_ADDRESS, it is now our external IP address.
[out] | targetAddress | targetAddress parameter originally passed to UDPProxyClient::RequestForwarding
[out] | targetGuid | targetGuid parameter originally passed to UDPProxyClient::RequestForwarding
[out] | proxyClient | The plugin that is calling this callback
virtual void SLNet::UDPProxyClientResultHandler::OnNoServersOnline | ( | SystemAddress | proxyCoordinator,
 |  | SystemAddress | sourceAddress,
 |  | SystemAddress | targetAddress,
 |  | RakNetGUID | targetGuid,
 |  | SLNet::UDPProxyClient * | proxyClientPlugin
 | ) |  |
pure virtual

Called when our forwarding request failed, because no UDPProxyServers are connected to UDPProxyCoordinator

Parameters
[out] | proxyCoordinator | proxyCoordinator parameter originally passed to UDPProxyClient::RequestForwarding
[out] | sourceAddress | sourceAddress parameter passed to UDPProxyClient::RequestForwarding. If it was UNASSIGNED_SYSTEM_ADDRESS, it is now our external IP address.
[out] | targetAddress | targetAddress parameter originally passed to UDPProxyClient::RequestForwarding
[out] | targetGuid | targetGuid parameter originally passed to UDPProxyClient::RequestForwarding
[out] | proxyClient | The plugin that is calling this callback
virtual void SLNet::UDPProxyClientResultHandler::OnRecipientNotConnected | ( | SystemAddress | proxyCoordinator,
 |  | SystemAddress | sourceAddress,
 |  | SystemAddress | targetAddress,
 |  | RakNetGUID | targetGuid,
 |  | SLNet::UDPProxyClient * | proxyClientPlugin
 | ) |  |
pure virtual

Called when our forwarding request failed, because no UDPProxyServers are connected to UDPProxyCoordinator

Parameters
[out] | proxyCoordinator | proxyCoordinator parameter originally passed to UDPProxyClient::RequestForwarding
[out] | sourceAddress | sourceAddress parameter passed to UDPProxyClient::RequestForwarding. If it was UNASSIGNED_SYSTEM_ADDRESS, it is now our external IP address.
[out] | targetAddress | targetAddress parameter originally passed to UDPProxyClient::RequestForwarding
[out] | targetGuid | targetGuid parameter originally passed to UDPProxyClient::RequestForwarding
[out] | proxyClient | The plugin that is calling this callback
class SLNet::UDPProxyClient

Communicates with UDPProxyCoordinator, in order to find a UDPProxyServer to forward our datagrams.

When NAT Punchthrough fails, it is possible to use a non-NAT system to forward messages from us to the recipient, and vice-versa.
The class to forward messages is UDPForwarder, and it is triggered over the network via the UDPProxyServer plugin.
The UDPProxyClient connects to UDPProxyCoordinator to get a list of servers running UDPProxyServer, and the coordinator will relay our forwarding request

See Also
NatPunchthroughServer
NatPunchthroughClient

Definition at line 115 of file UDPProxyClient.h.

+ Inheritance diagram for SLNet::UDPProxyClient:

Public Member Functions

UDPProxyClient ()
~UDPProxyClient ()
void | SetResultHandler (UDPProxyClientResultHandler *rh)
bool | RequestForwarding (SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddressAsSeenFromCoordinator, SLNet::TimeMS timeoutOnNoDataMS, SLNet::BitStream *serverSelectionBitstream=0)
bool | RequestForwarding (SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, SLNet::TimeMS timeoutOnNoDataMS, SLNet::BitStream *serverSelectionBitstream=0)
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Public Attributes

DataStructures::List
< PingServerGroup * > 		pingServerGroups

Protected Member Functions

void | OnPingServers (Packet *packet)
void | Clear (void)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

UDPProxyClientResultHandler * resultHandler
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::UDPProxyClient::UDPProxyClient ( )
SLNet::UDPProxyClient::~UDPProxyClient ( )

Member Function Documentation

void SLNet::UDPProxyClient::Clear ( void )
protected
void SLNet::UDPProxyClient::OnPingServers ( Packet * packet )
protected
virtual void SLNet::UDPProxyClient::OnRakPeerShutdown ( void )
virtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::UDPProxyClient::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

bool SLNet::UDPProxyClient::RequestForwarding | ( | SystemAddress | proxyCoordinator,
 |  | SystemAddress | sourceAddress,
 |  | SystemAddress | targetAddressAsSeenFromCoordinator,
 |  | SLNet::TimeMS | timeoutOnNoDataMS,
 |  | SLNet::BitStream * | serverSelectionBitstream = 0
 | ) |  |

Sends a request to proxyCoordinator to find a server and have that server setup UDPForwarder::StartForwarding() on our address to targetAddressAsSeenFromCoordinator The forwarded datagrams can be from any UDP source, not just RakNet

Precondition
Must be connected to proxyCoordinator
Systems running UDPProxyServer must be connected to proxyCoordinator and logged in via UDPProxyCoordinator::LoginServer() or UDPProxyServer::LoginToCoordinator()
Note
May still fail, if all proxy servers have no open connections.
RakNet's protocol will ensure a message is sent at least every 5 seconds, so if routing RakNet messages, it is a reasonable value for timeoutOnNoDataMS, plus an extra few seconds for latency.
Parameters
[in] | proxyCoordinator | System we are connected to that is running the UDPProxyCoordinator plugin
[in] | sourceAddress | External IP address of the system we want to forward messages from. This does not have to be our own system. To specify our own system, you can pass UNASSIGNED_SYSTEM_ADDRESS which the coordinator will treat as our external IP address.
[in] | targetAddressAsSeenFromCoordinator | External IP address of the system we want to forward messages to. If this system is connected to UDPProxyCoordinator at this address using RakNet, that system will ping the server and thus open the router for incoming communication. In any other case, you are responsible for doing your own network communication to have that system ping the server. See also targetGuid in the other version of RequestForwarding(), to avoid the need to know the IP address to the coordinator of the destination.
[in] | timeoutOnNoData | If no data is sent by the forwarded systems, how long before removing the forward entry from UDPForwarder? UDP_FORWARDER_MAXIMUM_TIMEOUT is the maximum value. Recommended 10 seconds.
[in] | serverSelectionBitstream | If you want to send data to UDPProxyCoordinator::GetBestServer(), write it here
Returns
true if the request was sent, false if we are not connected to proxyCoordinator
bool SLNet::UDPProxyClient::RequestForwarding | ( | SystemAddress | proxyCoordinator,
 |  | SystemAddress | sourceAddress,
 |  | RakNetGUID | targetGuid,
 |  | SLNet::TimeMS | timeoutOnNoDataMS,
 |  | SLNet::BitStream * | serverSelectionBitstream = 0
 | ) |  |

Same as above, but specify the target with a GUID, in case you don't know what its address is to the coordinator If requesting forwarding to a RakNet enabled system, then it is easier to use targetGuid instead of targetAddressAsSeenFromCoordinator

void SLNet::UDPProxyClient::SetResultHandler ( UDPProxyClientResultHandler * rh )

Receives the results of calling RequestForwarding() Set before calling RequestForwarding or you won't know what happened

Parameters
[in] resultHandler
virtual void SLNet::UDPProxyClient::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

DataStructures::List<PingServerGroup*> SLNet::UDPProxyClient::pingServerGroups

Definition at line 173 of file UDPProxyClient.h.

UDPProxyClientResultHandler* SLNet::UDPProxyClient::resultHandler
protected

Definition at line 178 of file UDPProxyClient.h.

struct SLNet::UDPProxyServerResultHandler

Callback to handle results of calling UDPProxyServer::LoginToCoordinator()

Definition at line 39 of file UDPProxyServer.h.

Public Member Functions

UDPProxyServerResultHandler ()
virtual | ~UDPProxyServerResultHandler ()
virtual void | OnLoginSuccess (SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0
virtual void | OnAlreadyLoggedIn (SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0
virtual void | OnNoPasswordSet (SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0
virtual void | OnWrongPassword (SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0

Constructor & Destructor Documentation

SLNet::UDPProxyServerResultHandler::UDPProxyServerResultHandler ( )
inline

Definition at line 41 of file UDPProxyServer.h.

virtual SLNet::UDPProxyServerResultHandler::~UDPProxyServerResultHandler ( )
inlinevirtual

Definition at line 42 of file UDPProxyServer.h.

Member Function Documentation

virtual void SLNet::UDPProxyServerResultHandler::OnAlreadyLoggedIn | ( | SLNet::RakString | usedPassword,
 |  | SLNet::UDPProxyServer * | proxyServerPlugin
 | ) |  |
pure virtual

We are already logged in. This login failed, but the system is operational as if it succeeded

Parameters
[out] | usedPassword | The password we passed to UDPProxyServer::LoginToCoordinator()
[out] | proxyServer | The plugin calling this callback
virtual void SLNet::UDPProxyServerResultHandler::OnLoginSuccess | ( | SLNet::RakString | usedPassword,
 |  | SLNet::UDPProxyServer * | proxyServerPlugin
 | ) |  |
pure virtual

Called when our login succeeds

Parameters
[out] | usedPassword | The password we passed to UDPProxyServer::LoginToCoordinator()
[out] | proxyServer | The plugin calling this callback
virtual void SLNet::UDPProxyServerResultHandler::OnNoPasswordSet | ( | SLNet::RakString | usedPassword,
 |  | SLNet::UDPProxyServer * | proxyServerPlugin
 | ) |  |
pure virtual

The coordinator operator forgot to call UDPProxyCoordinator::SetRemoteLoginPassword()

Parameters
[out] | usedPassword | The password we passed to UDPProxyServer::LoginToCoordinator()
[out] | proxyServer | The plugin calling this callback
virtual void SLNet::UDPProxyServerResultHandler::OnWrongPassword | ( | SLNet::RakString | usedPassword,
 |  | SLNet::UDPProxyServer * | proxyServerPlugin
 | ) |  |
pure virtual

The coordinator operator set a different password in UDPProxyCoordinator::SetRemoteLoginPassword() than what we passed

Parameters
[out] | usedPassword | The password we passed to UDPProxyServer::LoginToCoordinator()
[out] | proxyServer | The plugin calling this callback
class SLNet::UDPProxyServer

UDPProxyServer to control our instance of UDPForwarder.

When NAT Punchthrough fails, it is possible to use a non-NAT system to forward messages from us to the recipient, and vice-versa.
The class to forward messages is UDPForwarder, and it is triggered over the network via the UDPProxyServer plugin.
The UDPProxyServer connects to UDPProxyServer to get a list of servers running UDPProxyServer, and the coordinator will relay our forwarding request.

Definition at line 71 of file UDPProxyServer.h.

+ Inheritance diagram for SLNet::UDPProxyServer:

Public Member Functions

UDPProxyServer ()
~UDPProxyServer ()
void | SetSocketFamily (unsigned short _socketFamily)
void | SetResultHandler (UDPProxyServerResultHandler *rh)
bool | LoginToCoordinator (SLNet::RakString password, SystemAddress coordinatorAddress)
void | SetServerPublicIP (RakString ip)
The server IP reported to the client is the IP address from the server to the coordinator. If the server and coordinator are on the same LAN, you need to call SetServerPublicIP() to tell the client what address to connect to.
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Public Attributes

UDPForwarder udpForwarder

Protected Member Functions

void | OnForwardingRequestFromCoordinatorToServer (Packet *packet)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::OrderedList
< SystemAddress, SystemAddress > 		loggingInCoordinators
DataStructures::OrderedList
< SystemAddress, SystemAddress > 		loggedInCoordinators
UDPProxyServerResultHandler * resultHandler
unsigned short | socketFamily
RakString serverPublicIp
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Constructor & Destructor Documentation

SLNet::UDPProxyServer::UDPProxyServer ( )
SLNet::UDPProxyServer::~UDPProxyServer ( )

Member Function Documentation

bool SLNet::UDPProxyServer::LoginToCoordinator | ( | SLNet::RakString | password,
 |  | SystemAddress | coordinatorAddress
 | ) |  |

Before the coordinator will register the UDPProxyServer, you must login

Precondition
Must be connected to the coordinator
Coordinator must have set a password with UDPProxyCoordinator::SetRemoteLoginPassword()
Returns
false if already logged in, or logging in. Returns true otherwise
virtual void SLNet::UDPProxyServer::OnAttach ( void )
virtual

Called when the interface is attached.

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::UDPProxyServer::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::UDPProxyServer::OnDetach ( void )
virtual

Called when the interface is detached.

Reimplemented from SLNet::PluginInterface2.

void SLNet::UDPProxyServer::OnForwardingRequestFromCoordinatorToServer ( Packet * packet )
protected
virtual void SLNet::UDPProxyServer::OnRakPeerShutdown ( void )
virtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::UDPProxyServer::OnRakPeerStartup ( void )
virtual

Called when RakPeer is initialized.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::UDPProxyServer::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::UDPProxyServer::SetResultHandler ( UDPProxyServerResultHandler * rh )

Receives the results of calling LoginToCoordinator() Set before calling LoginToCoordinator or you won't know what happened

Parameters
[in] resultHandler
void SLNet::UDPProxyServer::SetServerPublicIP ( RakString ip )

The server IP reported to the client is the IP address from the server to the coordinator. If the server and coordinator are on the same LAN, you need to call SetServerPublicIP() to tell the client what address to connect to.

Parameters
[in] ip IP address to report in UDPProxyClientResultHandler::OnForwardingSuccess() and UDPProxyClientResultHandler::OnForwardingNotification() as proxyIPAddress
void SLNet::UDPProxyServer::SetSocketFamily ( unsigned short _socketFamily )

Sets the socket family to use, either IPV4 or IPV6

Parameters
[in] socketFamily For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC.
virtual void SLNet::UDPProxyServer::Update ( void )
virtual

Update is called every time a packet is checked for .

Reimplemented from SLNet::PluginInterface2.

Member Data Documentation

DataStructures::OrderedList<SystemAddress, SystemAddress> SLNet::UDPProxyServer::loggedInCoordinators
protected

Definition at line 119 of file UDPProxyServer.h.

DataStructures::OrderedList<SystemAddress, SystemAddress> SLNet::UDPProxyServer::loggingInCoordinators
protected

Definition at line 118 of file UDPProxyServer.h.

UDPProxyServerResultHandler* SLNet::UDPProxyServer::resultHandler
protected

Definition at line 121 of file UDPProxyServer.h.

RakString SLNet::UDPProxyServer::serverPublicIp
protected

Definition at line 123 of file UDPProxyServer.h.

unsigned short SLNet::UDPProxyServer::socketFamily
protected

Definition at line 122 of file UDPProxyServer.h.

UDPForwarder SLNet::UDPProxyServer::udpForwarder

Operative class that performs the forwarding Exposed so you can call UDPForwarder::SetMaxForwardEntries() if you want to change away from the default UDPForwarder::Startup(), UDPForwarder::Shutdown(), and UDPForwarder::Update() are called automatically by the plugin

Definition at line 103 of file UDPProxyServer.h.

struct SLNet::UDPProxyClient::PingServerGroup

Definition at line 162 of file UDPProxyClient.h.

Public Member Functions

bool | AreAllServersPinged (void) const
void | SendPingedServersToCoordinator (RakPeerInterface *rakPeer)

Public Attributes

SenderAndTargetAddress sata
SLNet::TimeMS startPingTime
SystemAddress coordinatorAddressForPings
DataStructures::List
< ServerWithPing > 		serversToPing

Member Function Documentation

bool SLNet::UDPProxyClient::PingServerGroup::AreAllServersPinged ( void ) const
void SLNet::UDPProxyClient::PingServerGroup::SendPingedServersToCoordinator ( RakPeerInterface * rakPeer )

Member Data Documentation

SystemAddress SLNet::UDPProxyClient::PingServerGroup::coordinatorAddressForPings

Definition at line 166 of file UDPProxyClient.h.

SenderAndTargetAddress SLNet::UDPProxyClient::PingServerGroup::sata

Definition at line 164 of file UDPProxyClient.h.

DataStructures::List<ServerWithPing> SLNet::UDPProxyClient::PingServerGroup::serversToPing

Definition at line 168 of file UDPProxyClient.h.

SLNet::TimeMS SLNet::UDPProxyClient::PingServerGroup::startPingTime

Definition at line 165 of file UDPProxyClient.h.

struct SLNet::UDPProxyClient::SenderAndTargetAddress

Definition at line 157 of file UDPProxyClient.h.

Class Members
SystemAddress | senderClientAddress
SystemAddress | targetClientAddress
struct SLNet::UDPProxyClient::ServerWithPing

Definition at line 152 of file UDPProxyClient.h.

Class Members
unsigned short | ping
SystemAddress | serverAddress
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace List

  • Namespace List
  • Namespace Members
Namespace List
Here is a list of all namespaces with brief descriptions:
o N DataStructures |
o N SLNet | Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc
\ N VariadicSQLParser |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Typedefs | Functions | Variables
DataStructures Namespace Reference

Classes

class | BinarySearchTree
A binary search tree and an AVL balanced binary search tree. More...
class | AVLBalancedBinarySearchTree
An AVLBalancedBinarySearchTree is a binary tree that is always balanced. More...
struct | Page
class | BPlusTree
class | BytePool
class | ByteQueue
struct | HashIndex
class | Hash
Using a string as a identifier for a node, store an allocated pointer to that node. More...
class | Heap
class | CircularLinkedList
(Circular) Linked List ADT (Doubly Linked Pointer to Node Style) - More...
class | LinkedList
class | List
Array based implementation of a list. More...
class | Map
class | MemoryPool
class | MLKeyRef
class | Multilist
The multilist, representing an abstract data type that generally holds lists. More...
class | OrderedChannelHeap
class | OrderedList
class | Queue
A queue implemented as an array with a read and write index. More...
class | QueueLinkedList
A queue implemented using a linked list. Rarely used. More...
struct | RangeNode
class | RangeList
class | Table
Holds a set of columns, a set of rows, and rows times columns cells. More...
class | ThreadsafeAllocatingQueue
class | Tree
class | WeightedGraph
class | SingleProducerConsumer
A single producer consumer implementation without critical sections. More...

Typedefs

typedef uint32_t DefaultIndexType

Functions

template<class key_type >
int | defaultMapKeyComparison (const key_type &a, const key_type &b)
template<class templateType >
void | DeletePtr_RakNet (templateType &ptr, const char *file, unsigned int line)
template<class templateType >
void | DeletePtr (templateType &ptr)
template<class key_type , class data_type >
int | defaultOrderedListComparison (const key_type &a, const data_type &b)
template<class range_type >
int | RangeNodeComp (const range_type &a, const RangeNode< range_type > &b)

Variables

template<class LinkedListType >
class RAK_DLL_EXPORT LinkedList

Detailed Description

The namespace DataStructures was only added to avoid compiler errors for commonly named data structures As these data structures are stand-alone, you can use them outside of RakNet for your own projects if you wish.

Class Documentation

struct DataStructures::Page

template<class KeyType, class DataType, int order>
struct DataStructures::Page< KeyType, DataType, order >

Used in the BPlusTree. Used for both leaf and index nodes. Don't use a constructor or destructor, due to the memory pool I am using

Definition at line 50 of file DS_BPlusTree.h.

+ Inheritance diagram for DataStructures::Page< KeyType, DataType, order >:
Class Members
Page * | children
DataType | data
bool | isLeaf
KeyType | keys
Page< KeyType, DataType, order > * | next
Page< KeyType, DataType, order > * | previous
int | size

Typedef Documentation

typedef uint32_t DataStructures::DefaultIndexType

Definition at line 91 of file DS_Multilist.h.

Function Documentation

template<class key_type >
int DataStructures::defaultMapKeyComparison | ( | const key_type & | a,
 |  | const key_type & | b
 | ) |  |

The default comparison has to be first so it can be called as a default parameter. It then is followed by MapNode, followed by NodeComparisonFunc

Definition at line 40 of file DS_Map.h.

template<class key_type , class data_type >
int DataStructures::defaultOrderedListComparison | ( | const key_type & | a,
 |  | const data_type & | b
 | ) |  |

Definition at line 33 of file DS_OrderedList.h.

template<class templateType >
void DataStructures::DeletePtr ( templateType & ptr )

Can be used with Multilist::ForEach Assuming the Multilist holds pointers, will delete those pointers

Definition at line 58 of file DS_Multilist.h.

template<class templateType >
void DataStructures::DeletePtr_RakNet | ( | templateType & | ptr,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Can be used with Multilist::ForEach Assuming the Multilist holds pointers, will delete those pointers

Definition at line 53 of file DS_Multilist.h.

References SLNet::OP_DELETE().

template<class range_type >
int DataStructures::RangeNodeComp | ( | const range_type & | a,
 |  | const RangeNode< range_type > & | b
 | ) |  |

Definition at line 44 of file DS_RangeList.h.

References DataStructures::RangeNode< range_type >::maxIndex, and DataStructures::RangeNode< range_type >::minIndex.

Variable Documentation

template<class LinkedListType >
class RAK_DLL_EXPORT DataStructures::LinkedList

Definition at line 34 of file DS_LinkedList.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: VariadicSQLParser Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions
VariadicSQLParser Namespace Reference

Classes

struct IndexAndType

Functions

const char * | GetTypeMappingAtIndex (int i)
void | GetTypeMappingIndices (const char *format, DataStructures::List< IndexAndType > &indices)
void | ExtractArguments (va_list argptr, const DataStructures::List< IndexAndType > &indices, char ***argumentBinary, int **argumentLengths)
void | FreeArguments (const DataStructures::List< IndexAndType > &indices, char **argumentBinary, int *argumentLengths)

Class Documentation

struct VariadicSQLParser::IndexAndType

Definition at line 20 of file VariadicSQLParser.h.

Class Members
unsigned int | strIndex
unsigned int | typeMappingIndex

Function Documentation

void VariadicSQLParser::ExtractArguments | ( | va_list | argptr,
 |  | const DataStructures::List< IndexAndType > & | indices,
 |  | char *** | argumentBinary,
 |  | int ** | argumentLengths
 | ) |  |

Definition at line 75 of file VariadicSQLParser.cpp.

References _FILE_AND_LINE_, SLNet::BitStream::IsNetworkOrder(), rakMalloc_Ex, SLNet::BitStream::ReverseBytesInPlace(), DataStructures::List< list_type >::Size(), and typeMappings.

void VariadicSQLParser::FreeArguments | ( | const DataStructures::List< IndexAndType > & | indices,
 |  | char ** | argumentBinary,
 |  | int * | argumentLengths
 | ) |  |

Definition at line 155 of file VariadicSQLParser.cpp.

References _FILE_AND_LINE_, SLNet::OP_DELETE_ARRAY(), rakFree_Ex, and DataStructures::List< list_type >::Size().

const char * VariadicSQLParser::GetTypeMappingAtIndex ( int i )

Definition at line 46 of file VariadicSQLParser.cpp.

References typeMappings.

void VariadicSQLParser::GetTypeMappingIndices | ( | const char * | format,
 |  | DataStructures::List< IndexAndType > & | indices
 | ) |  |

Definition at line 50 of file VariadicSQLParser.cpp.

References _FILE_AND_LINE_, DataStructures::List< list_type >::Clear(), GetTypeMappingIndex(), DataStructures::List< list_type >::Insert(), VariadicSQLParser::IndexAndType::strIndex, and VariadicSQLParser::IndexAndType::typeMappingIndex.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- _ -

  • _DLMallocDirectMMap() : SLNet
  • _DLMallocMMap() : SLNet
  • _DLMallocMUnmap() : SLNet
  • _RakFree() : SLNet
  • _RakFree_Ex() : SLNet
  • _RakMalloc() : SLNet
  • _RakMalloc_Ex() : SLNet
  • _RakRealloc() : SLNet
  • _RakRealloc_Ex() : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- a -

  • ACTUAL_BYTES_RECEIVED : SLNet
  • ACTUAL_BYTES_SENT : SLNet
  • ALREADY_CONNECTED_TO_ENDPOINT : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- b -

  • BitSize_t : SLNet
  • BR_FAILED_SEND_TEST : SLNet
  • BR_FAILED_TO_BIND_SOCKET : SLNet
  • BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE : SLNet
  • BR_SUCCESS : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- c -

  • CanConnect() : SLNet
  • CANNOT_RESOLVE_DOMAIN_NAME : SLNet
  • CloudKeyComp() : SLNet
  • CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS : SLNet
  • CONNECTION_ATTEMPT_STARTED : SLNet
  • ConnectionAttemptResult : SLNet
  • ConnectionState : SLNet
  • COULD_NOT_GENERATE_GUID : SLNet
  • CreateNonblockingBoundSocket() : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- d -

  • DefaultIndexType : DataStructures
  • defaultMapKeyComparison() : DataStructures
  • defaultOrderedListComparison() : DataStructures
  • DeletePtr() : DataStructures
  • DeletePtr_RakNet() : DataStructures
  • DynDnsResultCode : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- e -

  • ExtractArguments() : VariadicSQLParser
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- f -

  • FAILED_TO_CREATE_NETWORK_THREAD : 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
  • FCAR_SECURITY_PUBLIC_KEY_MISMATCH : SLNet
  • FilterSetComp() : SLNet
  • FreeArguments() : VariadicSQLParser
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- g -

  • GetTime() : SLNet
  • GetTimeMS() : SLNet
  • GetTimeUS() : SLNet
  • GetTypeMappingAtIndex() : VariadicSQLParser
  • GetTypeMappingIndices() : VariadicSQLParser
  • GreaterThan() : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- i -

  • INVALID_MAX_CONNECTIONS : SLNet
  • INVALID_PARAMETER : SLNet
  • INVALID_SOCKET_DESCRIPTORS : SLNet
  • IS_CONNECTED : SLNet
  • IS_CONNECTING : SLNet
  • IS_DISCONNECTED : SLNet
  • IS_DISCONNECTING : SLNet
  • IS_NOT_CONNECTED : SLNet
  • IS_PENDING : SLNet
  • IS_SILENTLY_DISCONNECTING : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- j -

  • JOIN_ANY_AVAILABLE_TEAM : SLNet
  • JOIN_NO_TEAM : SLNet
  • JOIN_SPECIFIC_TEAM : SLNet
  • JoinPermissions : SLNet
  • JoinTeamType : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- l -

  • LCR_CLOSED_BY_USER : SLNet
  • LCR_CONNECTION_LOST : SLNet
  • LCR_DISCONNECTION_NOTIFICATION : SLNet
  • LessThan() : SLNet
  • LinkedList : DataStructures
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- m -

  • MAX_RPC_MAP_SIZE : SLNet
  • MessageFilterStrComp() : SLNet
  • MessageID : SLNet
  • MessageNumberType : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- n -

  • NAT_TYPE_ADDRESS_RESTRICTED : SLNet
  • NAT_TYPE_COUNT : SLNet
  • NAT_TYPE_DETECTION_IN_PROGRESS : SLNet
  • NAT_TYPE_FULL_CONE : SLNet
  • NAT_TYPE_NONE : SLNet
  • NAT_TYPE_PORT_RESTRICTED : SLNet
  • NAT_TYPE_SUPPORTS_UPNP : SLNet
  • NAT_TYPE_SYMMETRIC : SLNet
  • NAT_TYPE_UNKNOWN : SLNet
  • NATTypeDetectionResult : SLNet
  • NATTypeDetectionResultToString() : SLNet
  • NATTypeDetectionResultToStringFriendly() : SLNet
  • NetworkID : SLNet
  • NetworkIDType : SLNet
  • NonNumericHostString() : SLNet
  • NoTeamId : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- o -

  • OP_DELETE() : SLNet
  • OP_DELETE_ARRAY() : SLNet
  • OP_NEW() : SLNet
  • OP_NEW_1() : SLNet
  • OP_NEW_2() : SLNet
  • OP_NEW_3() : SLNet
  • OP_NEW_4() : SLNet
  • OP_NEW_ARRAY() : SLNet
  • operator<<() : SLNet
  • operator>>() : SLNet
  • OrderingIndexType : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- p -

  • PI2_FailedConnectionAttemptReason : SLNet
  • PI2_LostConnectionReason : SLNet
  • PING_TIMES_ARRAY_SIZE : SLNet
  • PKM_ACCEPT_ANY_PUBLIC_KEY : SLNet
  • PKM_INSECURE_CONNECTION : SLNet
  • PKM_USE_KNOWN_PUBLIC_KEY : SLNet
  • PKM_USE_TWO_WAY_AUTHENTICATION : SLNet
  • PluginReceiveResult : SLNet
  • PORT_CANNOT_BE_ZERO : SLNet
  • ProcessNetworkPacket() : SLNet
  • ProcessOfflineNetworkPacket() : SLNet
  • PublicKeyMode : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- r -

  • R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE : SLNet
  • R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE : SLNet
  • R3P2PM_SINGLE_OWNER : SLNet
  • R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE : SLNet
  • R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE : SLNet
  • RackspaceEventType : SLNet
  • RackspaceOperationType : SLNet
  • RAK_THREAD_DECLARATION() : SLNet
  • RAKNET_ALREADY_STARTED : SLNet
  • RAKNET_STARTED : SLNet
  • RangeNodeComp() : DataStructures
  • RC_911 : SLNet
  • RC_ABUSE : SLNet
  • RC_BAD_AGENT : SLNet
  • RC_BAD_AUTH : SLNet
  • RC_BAD_SYS : SLNet
  • RC_CONNECTION_LOST_WITHOUT_RESPONSE : SLNet
  • RC_DNS_ALREADY_SET : SLNet
  • RC_DNS_ERROR : SLNet
  • RC_DYNDNS_TIMEOUT : SLNet
  • RC_NO_CHANGE : SLNet
  • RC_NO_HOST : SLNet
  • RC_NOT_DONATOR : SLNet
  • RC_NOT_FQDN : SLNet
  • RC_NOT_YOURS : SLNet
  • RC_NUM_HOST : SLNet
  • RC_PARSING_FAILURE : SLNet
  • RC_SUCCESS : SLNet
  • RC_TCP_DID_NOT_CONNECT : SLNet
  • RC_TCP_FAILED_TO_START : SLNet
  • RC_UNKNOWN_RESULT : SLNet
  • ReadyEventSystemStatus : SLNet
  • RegisteredCommandComp() : SLNet
  • RelayPluginEnums : SLNet
  • reliabilityHeapWeightType : SLNet
  • RemoteSystemTimeType : SLNet
  • Replica3P2PMode : SLNet
  • RES_ALL_READY : SLNet
  • RES_NOT_WAITING : SLNet
  • RES_READY : SLNet
  • RES_UNKNOWN_EVENT : SLNet
  • RES_WAITING : SLNet
  • RET_Bad_Media_Type_415 : SLNet
  • RET_Bad_Request_400 : SLNet
  • RET_Build_In_Progress_409 : SLNet
  • RET_Cloud_Servers_Fault_500 : SLNet
  • RET_Connection_Closed_Without_Reponse : SLNet
  • RET_Item_Not_Found_404 : SLNet
  • RET_Over_Limit_413 : SLNet
  • RET_Resize_Not_Allowed_403 : SLNet
  • RET_Service_Unavailable_503 : SLNet
  • RET_Success_200 : SLNet
  • RET_Success_201 : SLNet
  • RET_Success_202 : SLNet
  • RET_Success_203 : SLNet
  • RET_Success_204 : SLNet
  • RET_Unauthorized_401 : SLNet
  • RET_Unknown_Failure : SLNet
  • RM3_NUM_OUTPUT_BITSTREAM_CHANNELS : SLNet
  • RM3ActionOnPopConnection : SLNet
  • RM3AOPC_DELETE_REPLICA : SLNet
  • RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION : SLNet
  • RM3AOPC_DO_NOTHING : SLNet
  • RM3AOPC_MAX : SLNet
  • RM3ConstructionState : SLNet
  • RM3CS_ALREADY_EXISTS_REMOTELY : SLNet
  • RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT : SLNet
  • RM3CS_MAX : SLNet
  • RM3CS_NEVER_CONSTRUCT : SLNet
  • RM3CS_NO_ACTION : SLNet
  • RM3CS_SEND_CONSTRUCTION : SLNet
  • RM3DestructionState : SLNet
  • RM3DS_DO_NOT_QUERY_DESTRUCTION : SLNet
  • RM3DS_MAX : SLNet
  • RM3DS_NO_ACTION : SLNet
  • RM3DS_SEND_DESTRUCTION : SLNet
  • RM3QSR_CALL_SERIALIZE : SLNet
  • RM3QSR_DO_NOT_CALL_SERIALIZE : SLNet
  • RM3QSR_MAX : SLNet
  • RM3QSR_NEVER_CALL_SERIALIZE : SLNet
  • RM3QuerySerializationResult : SLNet
  • RM3SerializationResult : SLNet
  • RM3SR_BROADCAST_IDENTICALLY : SLNet
  • RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION : SLNet
  • RM3SR_DO_NOT_SERIALIZE : SLNet
  • RM3SR_MAX : SLNet
  • RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION : SLNet
  • RM3SR_SERIALIZED_ALWAYS : SLNet
  • RM3SR_SERIALIZED_ALWAYS_IDENTICALLY : SLNet
  • RM3SR_SERIALIZED_UNIQUELY : SLNet
  • RNS2BindResult : SLNet
  • RNS2SendResult : SLNet
  • RNS2Socket : SLNet
  • RNS2T_CHROME : SLNet
  • RNS2T_LINUX : SLNet
  • RNS2T_PS3 : SLNet
  • RNS2T_PS4 : SLNet
  • RNS2T_VITA : SLNet
  • RNS2T_WINDOWS : SLNet
  • RNS2T_WINDOWS_STORE_8 : SLNet
  • RNS2T_XBOX_360 : SLNet
  • RNS2T_XBOX_720 : SLNet
  • RNS2Type : SLNet
  • RNS_PER_SECOND_METRICS_COUNT : SLNet
  • RNSPerSecondMetrics : SLNet
  • RO_CONFIRM_RESIZED_SERVER : SLNet
  • RO_CONNECT_AND_AUTHENTICATE : SLNet
  • RO_CREATE_IMAGE : SLNet
  • RO_CREATE_SERVER : SLNet
  • RO_CREATE_SHARED_IP_GROUP : SLNet
  • RO_DELETE_IMAGE : SLNet
  • RO_DELETE_SERVER : SLNet
  • RO_DELETE_SERVER_ADDRESS : SLNet
  • RO_DELETE_SHARED_IP_GROUP : SLNet
  • RO_GET_FLAVOR_DETAILS : SLNet
  • RO_GET_IMAGE_DETAILS : SLNet
  • RO_GET_SERVER_DETAILS : SLNet
  • RO_GET_SHARED_IP_GROUP_DETAILS : SLNet
  • RO_LIST_FLAVORS : SLNet
  • RO_LIST_IMAGES : SLNet
  • RO_LIST_SERVER_ADDRESSES : SLNet
  • RO_LIST_SERVERS : SLNet
  • RO_LIST_SERVERS_WITH_DETAILS : SLNet
  • RO_LIST_SHARED_IP_GROUPS : SLNet
  • RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS : SLNet
  • RO_NONE : SLNet
  • RO_REBOOT_SERVER : SLNet
  • RO_REBUILD_SERVER : SLNet
  • RO_RESIZE_SERVER : SLNet
  • RO_REVERT_RESIZED_SERVER : SLNet
  • RO_SHARE_SERVER_ADDRESS : SLNet
  • RO_UPDATE_SERVER_NAME_OR_PASSWORD : SLNet
  • RPC_ERROR_FUNCTION_NOT_REGISTERED : SLNet
  • RPCErrorCodes : SLNet
  • RPCIndex : SLNet
  • RPE_ADD_CLIENT_NAME_ALREADY_IN_USE : SLNet
  • RPE_ADD_CLIENT_NOT_ALLOWED : SLNet
  • RPE_ADD_CLIENT_REQUEST_FROM_CLIENT : SLNet
  • RPE_ADD_CLIENT_SUCCESS : SLNet
  • RPE_ADD_CLIENT_TARGET_NOT_CONNECTED : SLNet
  • RPE_GET_GROUP_LIST_REPLY_FROM_SERVER : SLNet
  • RPE_GET_GROUP_LIST_REQUEST_FROM_CLIENT : SLNet
  • RPE_GROUP_MESSAGE_FROM_CLIENT : SLNet
  • RPE_GROUP_MSG_FROM_SERVER : SLNet
  • RPE_JOIN_GROUP_FAILURE : SLNet
  • RPE_JOIN_GROUP_REQUEST_FROM_CLIENT : SLNet
  • RPE_JOIN_GROUP_SUCCESS : SLNet
  • RPE_LEAVE_GROUP_REQUEST_FROM_CLIENT : SLNet
  • RPE_MESSAGE_TO_CLIENT_FROM_SERVER : SLNet
  • RPE_MESSAGE_TO_SERVER_FROM_CLIENT : SLNet
  • RPE_REMOVE_CLIENT_REQUEST_FROM_CLIENT : SLNet
  • RPE_USER_ENTERED_ROOM : SLNet
  • RPE_USER_LEFT_ROOM : SLNet
  • RR_CONTINUE_PROCESSING : SLNet
  • RR_STOP_PROCESSING : SLNet
  • RR_STOP_PROCESSING_AND_DEALLOCATE : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- s -

  • SECURITY_INITIALIZATION_FAILED : SLNet
  • SendSerializeIfChangedResult : SLNet
  • SHValueType : SLNet
  • SOCKET_FAILED_TEST_SEND : SLNet
  • SOCKET_FAILED_TO_BIND : SLNet
  • SOCKET_FAMILY_NOT_SUPPORTED : SLNet
  • SOCKET_PORT_ALREADY_IN_USE : SLNet
  • SplitPacketChannelComp() : SLNet
  • SplitPacketIdType : SLNet
  • SplitPacketIndexType : SLNet
  • SSICR_DID_NOT_SEND_DATA : SLNet
  • SSICR_NEVER_SERIALIZE : SLNet
  • SSICR_SENT_DATA : SLNet
  • STARTUP_OTHER_FAILURE : SLNet
  • StartupResult : SLNet
  • StatisticsToString() : SLNet
  • StrAndBoolComp() : SLNet
  • SystemIndex : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- t -

  • TeamId : SLNet
  • TeamMemberLimit : SLNet
  • Time : SLNet
  • TimeMS : SLNet
  • TimeUS : SLNet
  • TM_CLIENT_SERVER : SLNet
  • TM_PEER_TO_PEER : SLNet
  • TMTopology : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- u -

  • UDPFORWARDER_BIND_FAILED : SLNet
  • UDPFORWARDER_FORWARDING_ALREADY_EXISTS : SLNet
  • UDPFORWARDER_INVALID_PARAMETERS : SLNet
  • UDPFORWARDER_NO_SOCKETS : SLNet
  • UDPFORWARDER_NOT_RUNNING : SLNet
  • UDPFORWARDER_RESULT_COUNT : SLNet
  • UDPFORWARDER_SUCCESS : SLNet
  • UDPForwarderResult : SLNet
  • UNASSIGNED_NETWORK_ID : SLNet
  • UNASSIGNED_PLAYER_INDEX : SLNet
  • UNASSIGNED_RAKNET_GUID() : SLNet
  • UNASSIGNED_SYSTEM_ADDRESS : SLNet
  • UNDEFINED_RPC_INDEX : SLNet
  • UniqueIDType : SLNet
  • USER_MESSAGE_BYTES_PUSHED : SLNet
  • USER_MESSAGE_BYTES_RECEIVED_IGNORED : SLNet
  • USER_MESSAGE_BYTES_RECEIVED_PROCESSED : SLNet
  • USER_MESSAGE_BYTES_RESENT : SLNet
  • USER_MESSAGE_BYTES_SENT : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • j
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- w -

  • WorldId : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • _
  • c
  • d
  • e
  • f
  • g
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • u

- _ -

  • _DLMallocDirectMMap() : SLNet
  • _DLMallocMMap() : SLNet
  • _DLMallocMUnmap() : SLNet
  • _RakFree() : SLNet
  • _RakFree_Ex() : SLNet
  • _RakMalloc() : SLNet
  • _RakMalloc_Ex() : SLNet
  • _RakRealloc() : SLNet
  • _RakRealloc_Ex() : SLNet

- c -

  • CanConnect() : SLNet
  • CloudKeyComp() : SLNet
  • CreateNonblockingBoundSocket() : SLNet

- d -

  • defaultMapKeyComparison() : DataStructures
  • defaultOrderedListComparison() : DataStructures
  • DeletePtr() : DataStructures
  • DeletePtr_RakNet() : DataStructures

- e -

  • ExtractArguments() : VariadicSQLParser

- f -

  • FilterSetComp() : SLNet
  • FreeArguments() : VariadicSQLParser

- g -

  • GetTime() : SLNet
  • GetTimeMS() : SLNet
  • GetTimeUS() : SLNet
  • GetTypeMappingAtIndex() : VariadicSQLParser
  • GetTypeMappingIndices() : VariadicSQLParser
  • GreaterThan() : SLNet

- l -

  • LessThan() : SLNet

- m -

  • MessageFilterStrComp() : SLNet

- n -

  • NATTypeDetectionResultToString() : SLNet
  • NATTypeDetectionResultToStringFriendly() : SLNet
  • NonNumericHostString() : SLNet

- o -

  • OP_DELETE() : SLNet
  • OP_DELETE_ARRAY() : SLNet
  • OP_NEW() : SLNet
  • OP_NEW_1() : SLNet
  • OP_NEW_2() : SLNet
  • OP_NEW_3() : SLNet
  • OP_NEW_4() : SLNet
  • OP_NEW_ARRAY() : SLNet
  • operator<<() : SLNet
  • operator>>() : SLNet

- p -

  • ProcessNetworkPacket() : SLNet
  • ProcessOfflineNetworkPacket() : SLNet

- r -

  • RAK_THREAD_DECLARATION() : SLNet
  • RangeNodeComp() : DataStructures
  • RegisteredCommandComp() : SLNet

- s -

  • SplitPacketChannelComp() : SLNet
  • StatisticsToString() : SLNet
  • StrAndBoolComp() : SLNet

- u -

  • UNASSIGNED_RAKNET_GUID() : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • LinkedList : DataStructures
  • MAX_RPC_MAP_SIZE : SLNet
  • PING_TIMES_ARRAY_SIZE : SLNet
  • RM3_NUM_OUTPUT_BITSTREAM_CHANNELS : SLNet
  • UNASSIGNED_NETWORK_ID : SLNet
  • UNASSIGNED_PLAYER_INDEX : SLNet
  • UNASSIGNED_SYSTEM_ADDRESS : SLNet
  • UNDEFINED_RPC_INDEX : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • BitSize_t : SLNet
  • DefaultIndexType : DataStructures
  • JoinPermissions : SLNet
  • MessageID : SLNet
  • MessageNumberType : SLNet
  • NetworkID : SLNet
  • NetworkIDType : SLNet
  • NoTeamId : SLNet
  • OrderingIndexType : SLNet
  • reliabilityHeapWeightType : SLNet
  • RemoteSystemTimeType : SLNet
  • RNS2SendResult : SLNet
  • RNS2Socket : SLNet
  • RPCIndex : SLNet
  • SHValueType : SLNet
  • SplitPacketIdType : SLNet
  • SplitPacketIndexType : SLNet
  • SystemIndex : SLNet
  • TeamId : SLNet
  • TeamMemberLimit : SLNet
  • Time : SLNet
  • TimeMS : SLNet
  • TimeUS : SLNet
  • UniqueIDType : SLNet
  • WorldId : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • ConnectionAttemptResult : SLNet
  • ConnectionState : SLNet
  • DynDnsResultCode : SLNet
  • JoinTeamType : SLNet
  • NATTypeDetectionResult : SLNet
  • PI2_FailedConnectionAttemptReason : SLNet
  • PI2_LostConnectionReason : SLNet
  • PluginReceiveResult : SLNet
  • PublicKeyMode : SLNet
  • RackspaceEventType : SLNet
  • RackspaceOperationType : SLNet
  • ReadyEventSystemStatus : SLNet
  • RelayPluginEnums : SLNet
  • Replica3P2PMode : SLNet
  • RM3ActionOnPopConnection : SLNet
  • RM3ConstructionState : SLNet
  • RM3DestructionState : SLNet
  • RM3QuerySerializationResult : SLNet
  • RM3SerializationResult : SLNet
  • RNS2BindResult : SLNet
  • RNS2Type : SLNet
  • RNSPerSecondMetrics : SLNet
  • RPCErrorCodes : SLNet
  • SendSerializeIfChangedResult : SLNet
  • StartupResult : SLNet
  • TMTopology : SLNet
  • UDPForwarderResult : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- a -

  • ACTUAL_BYTES_RECEIVED : SLNet
  • ACTUAL_BYTES_SENT : SLNet
  • ALREADY_CONNECTED_TO_ENDPOINT : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- b -

  • BR_FAILED_SEND_TEST : SLNet
  • BR_FAILED_TO_BIND_SOCKET : SLNet
  • BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE : SLNet
  • BR_SUCCESS : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- c -

  • CANNOT_RESOLVE_DOMAIN_NAME : SLNet
  • CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS : SLNet
  • CONNECTION_ATTEMPT_STARTED : SLNet
  • COULD_NOT_GENERATE_GUID : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- f -

  • FAILED_TO_CREATE_NETWORK_THREAD : 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
  • FCAR_SECURITY_PUBLIC_KEY_MISMATCH : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- i -

  • INVALID_MAX_CONNECTIONS : SLNet
  • INVALID_PARAMETER : SLNet
  • INVALID_SOCKET_DESCRIPTORS : SLNet
  • IS_CONNECTED : SLNet
  • IS_CONNECTING : SLNet
  • IS_DISCONNECTED : SLNet
  • IS_DISCONNECTING : SLNet
  • IS_NOT_CONNECTED : SLNet
  • IS_PENDING : SLNet
  • IS_SILENTLY_DISCONNECTING : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- j -

  • JOIN_ANY_AVAILABLE_TEAM : SLNet
  • JOIN_NO_TEAM : SLNet
  • JOIN_SPECIFIC_TEAM : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- l -

  • LCR_CLOSED_BY_USER : SLNet
  • LCR_CONNECTION_LOST : SLNet
  • LCR_DISCONNECTION_NOTIFICATION : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- n -

  • NAT_TYPE_ADDRESS_RESTRICTED : SLNet
  • NAT_TYPE_COUNT : SLNet
  • NAT_TYPE_DETECTION_IN_PROGRESS : SLNet
  • NAT_TYPE_FULL_CONE : SLNet
  • NAT_TYPE_NONE : SLNet
  • NAT_TYPE_PORT_RESTRICTED : SLNet
  • NAT_TYPE_SUPPORTS_UPNP : SLNet
  • NAT_TYPE_SYMMETRIC : SLNet
  • NAT_TYPE_UNKNOWN : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- p -

  • PKM_ACCEPT_ANY_PUBLIC_KEY : SLNet
  • PKM_INSECURE_CONNECTION : SLNet
  • PKM_USE_KNOWN_PUBLIC_KEY : SLNet
  • PKM_USE_TWO_WAY_AUTHENTICATION : SLNet
  • PORT_CANNOT_BE_ZERO : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- r -

  • R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE : SLNet
  • R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE : SLNet
  • R3P2PM_SINGLE_OWNER : SLNet
  • R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE : SLNet
  • R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE : SLNet
  • RAKNET_ALREADY_STARTED : SLNet
  • RAKNET_STARTED : SLNet
  • RC_911 : SLNet
  • RC_ABUSE : SLNet
  • RC_BAD_AGENT : SLNet
  • RC_BAD_AUTH : SLNet
  • RC_BAD_SYS : SLNet
  • RC_CONNECTION_LOST_WITHOUT_RESPONSE : SLNet
  • RC_DNS_ALREADY_SET : SLNet
  • RC_DNS_ERROR : SLNet
  • RC_DYNDNS_TIMEOUT : SLNet
  • RC_NO_CHANGE : SLNet
  • RC_NO_HOST : SLNet
  • RC_NOT_DONATOR : SLNet
  • RC_NOT_FQDN : SLNet
  • RC_NOT_YOURS : SLNet
  • RC_NUM_HOST : SLNet
  • RC_PARSING_FAILURE : SLNet
  • RC_SUCCESS : SLNet
  • RC_TCP_DID_NOT_CONNECT : SLNet
  • RC_TCP_FAILED_TO_START : SLNet
  • RC_UNKNOWN_RESULT : SLNet
  • RES_ALL_READY : SLNet
  • RES_NOT_WAITING : SLNet
  • RES_READY : SLNet
  • RES_UNKNOWN_EVENT : SLNet
  • RES_WAITING : SLNet
  • RET_Bad_Media_Type_415 : SLNet
  • RET_Bad_Request_400 : SLNet
  • RET_Build_In_Progress_409 : SLNet
  • RET_Cloud_Servers_Fault_500 : SLNet
  • RET_Connection_Closed_Without_Reponse : SLNet
  • RET_Item_Not_Found_404 : SLNet
  • RET_Over_Limit_413 : SLNet
  • RET_Resize_Not_Allowed_403 : SLNet
  • RET_Service_Unavailable_503 : SLNet
  • RET_Success_200 : SLNet
  • RET_Success_201 : SLNet
  • RET_Success_202 : SLNet
  • RET_Success_203 : SLNet
  • RET_Success_204 : SLNet
  • RET_Unauthorized_401 : SLNet
  • RET_Unknown_Failure : SLNet
  • RM3AOPC_DELETE_REPLICA : SLNet
  • RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION : SLNet
  • RM3AOPC_DO_NOTHING : SLNet
  • RM3AOPC_MAX : SLNet
  • RM3CS_ALREADY_EXISTS_REMOTELY : SLNet
  • RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT : SLNet
  • RM3CS_MAX : SLNet
  • RM3CS_NEVER_CONSTRUCT : SLNet
  • RM3CS_NO_ACTION : SLNet
  • RM3CS_SEND_CONSTRUCTION : SLNet
  • RM3DS_DO_NOT_QUERY_DESTRUCTION : SLNet
  • RM3DS_MAX : SLNet
  • RM3DS_NO_ACTION : SLNet
  • RM3DS_SEND_DESTRUCTION : SLNet
  • RM3QSR_CALL_SERIALIZE : SLNet
  • RM3QSR_DO_NOT_CALL_SERIALIZE : SLNet
  • RM3QSR_MAX : SLNet
  • RM3QSR_NEVER_CALL_SERIALIZE : SLNet
  • RM3SR_BROADCAST_IDENTICALLY : SLNet
  • RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION : SLNet
  • RM3SR_DO_NOT_SERIALIZE : SLNet
  • RM3SR_MAX : SLNet
  • RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION : SLNet
  • RM3SR_SERIALIZED_ALWAYS : SLNet
  • RM3SR_SERIALIZED_ALWAYS_IDENTICALLY : SLNet
  • RM3SR_SERIALIZED_UNIQUELY : SLNet
  • RNS2T_CHROME : SLNet
  • RNS2T_LINUX : SLNet
  • RNS2T_PS3 : SLNet
  • RNS2T_PS4 : SLNet
  • RNS2T_VITA : SLNet
  • RNS2T_WINDOWS : SLNet
  • RNS2T_WINDOWS_STORE_8 : SLNet
  • RNS2T_XBOX_360 : SLNet
  • RNS2T_XBOX_720 : SLNet
  • RNS_PER_SECOND_METRICS_COUNT : SLNet
  • RO_CONFIRM_RESIZED_SERVER : SLNet
  • RO_CONNECT_AND_AUTHENTICATE : SLNet
  • RO_CREATE_IMAGE : SLNet
  • RO_CREATE_SERVER : SLNet
  • RO_CREATE_SHARED_IP_GROUP : SLNet
  • RO_DELETE_IMAGE : SLNet
  • RO_DELETE_SERVER : SLNet
  • RO_DELETE_SERVER_ADDRESS : SLNet
  • RO_DELETE_SHARED_IP_GROUP : SLNet
  • RO_GET_FLAVOR_DETAILS : SLNet
  • RO_GET_IMAGE_DETAILS : SLNet
  • RO_GET_SERVER_DETAILS : SLNet
  • RO_GET_SHARED_IP_GROUP_DETAILS : SLNet
  • RO_LIST_FLAVORS : SLNet
  • RO_LIST_IMAGES : SLNet
  • RO_LIST_SERVER_ADDRESSES : SLNet
  • RO_LIST_SERVERS : SLNet
  • RO_LIST_SERVERS_WITH_DETAILS : SLNet
  • RO_LIST_SHARED_IP_GROUPS : SLNet
  • RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS : SLNet
  • RO_NONE : SLNet
  • RO_REBOOT_SERVER : SLNet
  • RO_REBUILD_SERVER : SLNet
  • RO_RESIZE_SERVER : SLNet
  • RO_REVERT_RESIZED_SERVER : SLNet
  • RO_SHARE_SERVER_ADDRESS : SLNet
  • RO_UPDATE_SERVER_NAME_OR_PASSWORD : SLNet
  • RPC_ERROR_FUNCTION_NOT_REGISTERED : SLNet
  • RPE_ADD_CLIENT_NAME_ALREADY_IN_USE : SLNet
  • RPE_ADD_CLIENT_NOT_ALLOWED : SLNet
  • RPE_ADD_CLIENT_REQUEST_FROM_CLIENT : SLNet
  • RPE_ADD_CLIENT_SUCCESS : SLNet
  • RPE_ADD_CLIENT_TARGET_NOT_CONNECTED : SLNet
  • RPE_GET_GROUP_LIST_REPLY_FROM_SERVER : SLNet
  • RPE_GET_GROUP_LIST_REQUEST_FROM_CLIENT : SLNet
  • RPE_GROUP_MESSAGE_FROM_CLIENT : SLNet
  • RPE_GROUP_MSG_FROM_SERVER : SLNet
  • RPE_JOIN_GROUP_FAILURE : SLNet
  • RPE_JOIN_GROUP_REQUEST_FROM_CLIENT : SLNet
  • RPE_JOIN_GROUP_SUCCESS : SLNet
  • RPE_LEAVE_GROUP_REQUEST_FROM_CLIENT : SLNet
  • RPE_MESSAGE_TO_CLIENT_FROM_SERVER : SLNet
  • RPE_MESSAGE_TO_SERVER_FROM_CLIENT : SLNet
  • RPE_REMOVE_CLIENT_REQUEST_FROM_CLIENT : SLNet
  • RPE_USER_ENTERED_ROOM : SLNet
  • RPE_USER_LEFT_ROOM : SLNet
  • RR_CONTINUE_PROCESSING : SLNet
  • RR_STOP_PROCESSING : SLNet
  • RR_STOP_PROCESSING_AND_DEALLOCATE : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- s -

  • SECURITY_INITIALIZATION_FAILED : SLNet
  • SOCKET_FAILED_TEST_SEND : SLNet
  • SOCKET_FAILED_TO_BIND : SLNet
  • SOCKET_FAMILY_NOT_SUPPORTED : SLNet
  • SOCKET_PORT_ALREADY_IN_USE : SLNet
  • SSICR_DID_NOT_SEND_DATA : SLNet
  • SSICR_NEVER_SERIALIZE : SLNet
  • SSICR_SENT_DATA : SLNet
  • STARTUP_OTHER_FAILURE : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- t -

  • TM_CLIENT_SERVER : SLNet
  • TM_PEER_TO_PEER : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Namespace Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • b
  • c
  • f
  • i
  • j
  • l
  • n
  • p
  • r
  • s
  • t
  • u

- u -

  • UDPFORWARDER_BIND_FAILED : SLNet
  • UDPFORWARDER_FORWARDING_ALREADY_EXISTS : SLNet
  • UDPFORWARDER_INVALID_PARAMETERS : SLNet
  • UDPFORWARDER_NO_SOCKETS : SLNet
  • UDPFORWARDER_NOT_RUNNING : SLNet
  • UDPFORWARDER_RESULT_COUNT : SLNet
  • UDPFORWARDER_SUCCESS : SLNet
  • USER_MESSAGE_BYTES_PUSHED : SLNet
  • USER_MESSAGE_BYTES_RECEIVED_IGNORED : SLNet
  • USER_MESSAGE_BYTES_RECEIVED_PROCESSED : SLNet
  • USER_MESSAGE_BYTES_RESENT : SLNet
  • USER_MESSAGE_BYTES_SENT : SLNet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Class List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
[detail level 123]
o N DataStructures |
| o C BinarySearchTree | A binary search tree and an AVL balanced binary search tree
| | \ C node |
| o C AVLBalancedBinarySearchTree | An AVLBalancedBinarySearchTree is a binary tree that is always balanced
| o C Page |
| o C BPlusTree |
| | \ C ReturnAction |
| o C BytePool |
| o C ByteQueue |
| o C HashIndex |
| o C Hash | Using a string as a identifier for a node, store an allocated pointer to that node
| | \ C Node |
| o C Heap |
| | \ C HeapNode |
| o C CircularLinkedList | (Circular) Linked List ADT (Doubly Linked Pointer to Node Style) -
| | \ C node |
| o C LinkedList |
| o C List | Array based implementation of a list
| o C Map |
| | \ C MapNode |
| o C MemoryPool |
| | o C MemoryWithPage |
| | \ C Page |
| o C MLKeyRef |
| o C Multilist | The multilist, representing an abstract data type that generally holds lists
| o C OrderedChannelHeap |
| | o C HeapChannelAndData |
| | \ C QueueAndWeight |
| o C OrderedList |
| o C Queue | A queue implemented as an array with a read and write index
| o C QueueLinkedList | A queue implemented using a linked list. Rarely used
| o C RangeNode |
| o C RangeList |
| o C Table | Holds a set of columns, a set of rows, and rows times columns cells
| | o C Cell | Holds the actual data in the table
| | o C ColumnDescriptor |
| | o C FilterQuery |
| | o C Row | Stores the list of cells for this row, and a special flag used for internal sorting
| | \ C SortQuery |
| o C ThreadsafeAllocatingQueue |
| o C Tree |
| o C WeightedGraph |
| | \ C NodeAndParent |
| \ C SingleProducerConsumer | A single producer consumer implementation without critical sections
o N SLNet | Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc
| o C AutopatcherRepositoryInterface | An interface used by AutopatcherServer to get the data necessary to run an autopatcher. This is up to you to implement for custom repository solutions
| o C BitStream |
| o C CCRakNetSlidingWindow |
| o C CloudClient | Performs Post() and Get() operations on CloudMemoryServer
| o C CloudClientCallback |
| o C CloudAllocator |
| o C CloudKey |
| o C CloudQuery |
| o C CloudQueryRow |
| o C CloudQueryResult |
| o C CloudServerQueryFilter | Zero or more instances of CloudServerQueryFilter can be attached to CloudServer to restrict client queries All attached instances of CloudServerQueryFilter on each corresponding operation, from all directly connected clients If any attached instance returns false for a given operation, that operation is silently rejected
| o C CloudServer | Stores client data, and allows cross-server communication to retrieve this data
| | o C BufferedGetResponseFromServer |
| | o C CloudData |
| | o C CloudDataList |
| | o C CloudQueryWithAddresses |
| | o C GetRequest |
| | o C KeySubscriberID |
| | o C RemoteCloudClient |
| | \ C RemoteServer |
| o C RakNetCommandParser | This allows a console client to call most of the functions in RakPeer
| o C RegisteredCommand |
| o C CommandParserInterface | The interface used by command parsers
| o C ConnectionGraph2 | A one hop connection graph
| | o C RemoteSystem |
| | \ C SystemAddressAndGuid |
| o C ConsoleServer | The main entry point for the server portion of your remote console application support
| o C DataCompressor | Does compression on a block of data. Not very good compression, but it's small and fast so is something you can compute at runtime
| o C DirectoryDeltaTransfer |
| o C HuffmanEncodingTree | This generates special cases of the huffman encoding tree using 8 bit keys with the additional condition that unused combinations of 8 bits are treated as a frequency of 1
| o C HuffmanEncodingTreeFactory | Creates instances of the class HuffmanEncodingTree
| o C DynDNS |
| o C EmailSender | Rudimentary class to send email from code
| o C FileListNode | Represents once instance of a file
| o C FileListProgress | Callback interface set with FileList::SetCallback() in case you want progress notifications when FileList::AddFilesFromDirectory() is called
| o C FLP_Printf | Implementation of FileListProgress to use RAKNET_DEBUG_PRINTF
| o C FileList |
| o C FileListTransfer | A plugin to provide a simple way to compress and incrementally send the files in the FileList structure
| | o C FileToPush |
| | o C FileToPushRecipient |
| | \ C ThreadData |
| o C FileListTransferCBInterface | Used by FileListTransfer plugin as a callback for when we get a file
| | o C DownloadCompleteStruct |
| | o C FileProgressStruct |
| | \ C OnFileStruct |
| o C HTTPConnection | Use HTTPConnection to communicate with a web server
| | o C BadResponse | Encapsulates a raw HTTP response and response code
| | \ C OutgoingCommand |
| o C HTTPConnection2 | Use HTTPConnection2 to communicate with a web server
| | \ C Request |
| o C IncrementalReadInterface |
| o C InternalPacketFixedSizeTransmissionHeader |
| o C InternalPacketRefCountedData | Used in InternalPacket when pointing to sharedDataBlock, rather than allocating itself
| o C InternalPacket |
| o C LocklessUint32_t |
| o C LogCommandParser | Adds the ability to send logging output to a remote console
| | \ C SystemAddressAndChannel | One of these structures is created per player
| o C FilterSet |
| o C FilteredSystem |
| o C MessageFilter | Assigns systems to FilterSets. Each FilterSet limits what kinds of messages are allowed
| o C PunchthroughConfiguration |
| o C NatPunchthroughDebugInterface |
| o C NatPunchthroughDebugInterface_Printf |
| o C NatPunchthroughDebugInterface_PacketLogger |
| o C NatPunchthroughClient | Client code for NATPunchthrough
| | o C AddrAndGuid |
| | o C DSTAndFac |
| | \ C SendPing |
| o C NatPunchthroughServerDebugInterface |
| o C NatPunchthroughServerDebugInterface_Printf |
| o C NatPunchthroughServerDebugInterface_PacketLogger |
| o C NatPunchthroughServer | Server code for NATPunchthrough
| | o C ConnectionAttempt |
| | \ C User |
| o C NatTypeDetectionClient | Client code for NatTypeDetection
| o C NatTypeDetectionServer | Server code for NatTypeDetection
| | \ C NATDetectionAttempt |
| o C NetworkIDManager |
| o C NetworkIDObject | Unique shared ids for each object instance
| o C PacketConsoleLogger | Packetlogger that logs to a remote command console
| o C PacketFileLogger | Packetlogger that outputs to a file
| o C PacketizedTCP |
| o C PacketLogger | Writes incoming and outgoing messages to the screen. This will write all incoming and outgoing messages to the console window, or to a file if you override it and give it this functionality
| o C PacketOutputWindowLogger | Packetlogger that outputs to the output window in the debugger. Windows only
| o C RemoteSystemIndex |
| o C RakPeer | Main interface for network communications
| | o C BanStruct |
| | o C BufferedCommandStruct |
| | o C PingAndClockDifferential |
| | o C RemoteSystemStruct |
| | o C RequestedConnectionStruct |
| | \ C SocketQueryOutput |
| o C RakPeerInterface | The main interface for network communications
| o C PluginInterface2 |
| o C Rackspace2EventCallback | Callback interface to receive the results of operations
| o C RackspaceEventCallback_Default | Callback interface to receive the results of operations, with a default result
| o C Rackspace | Code that uses the TCPInterface class to communicate with the Rackspace API servers
| | \ C RackspaceOperation |
| o C RakNetRandom |
| o C RakNetRandomSync |
| o C ReadyEvent | Peer to peer synchronized ready and unready events
| | o C ReadyEventNode |
| | \ C RemoteSystem |
| o C RelayPlugin | A simple class to relay messages from one system to another, identifying remote systems by a string
| | o C RP_Group |
| | o C StrAndGuid |
| | \ C StrAndGuidAndRoom |
| o C SplitPacketChannel |
| o C BPSTracker |
| | \ C TimeAndValue2 |
| o C ReliabilityLayer | Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence
| o C PRO |
| o C ReplicaManager3 | System to help automate game object construction, destruction, and serialization
| | \ C RM3World |
| o C LastSerializationResultBS |
| o C LastSerializationResult |
| o C SerializeParameters |
| o C DeserializeParameters |
| o C Connection_RM3 | Each remote system is represented by Connection_RM3. Used to allocate Replica3 and track which instances have been allocated
| o C Replica3 | Base class for your replicated objects for the ReplicaManager3 system
| o C Replica3Composite | Use Replica3 through composition instead of inheritance by containing an instance of this templated class Calls to parent class for all functions Parent class must still define and functions though!
| o C Router2DebugInterface |
| o C Router2 | Class interface for the Router2 system
| | o C ConnectionRequestSystem |
| | o C ConnnectRequest |
| | o C ForwardedConnection |
| | \ C MiniPunchRequest |
| o C RPC4GlobalRegistration | Instantiate this class globally if you want to register a function with RPC4 at the global space
| o C RPC4 | The RPC4 plugin is just an association between a C function pointer and a string
| | o C LocalCallback |
| | o C LocalSlot |
| | \ C LocalSlotObject |
| o C SignaledEvent |
| o C SimpleMutex | An easy to use mutex
| o C ReferenceCounter |
| o C RakNetSmartPtr |
| o C RNS2_SendParameters |
| o C RNS2RecvStruct |
| o C RakNetSocket2Allocator |
| o C RNS2EventHandler |
| o C RakNetSocket2 |
| o C RNS2_BerkleyBindParameters |
| o C IRNS2_Berkley |
| o C RNS2_Berkley |
| o C RNS2_Linux |
| o C SocketLayer |
| o C RakNetStatistics | Network Statisics Usage
| o C StatisticsHistory | Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values
| | o C TimeAndValue |
| | o C TimeAndValueQueue |
| | o C TrackedObject |
| | \ C TrackedObjectData |
| o C StatisticsHistoryPlugin | Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values
| o C RakString | String class
| | \ C SharedString |
| o C StringCompressor | Writes and reads strings to and from bitstreams
| o C StringTable | Writes a string index, instead of the whole string
| o C TableSerializer |
| o C TCPInterface |
| | \ C ThisPtrPlusSysAddr |
| o C RemoteClient | Stores information about a remote client
| o C TeamBalancer | Set and network team selection (supports peer to peer or client/server)
| | o C MyTeamMembers |
| | \ C TeamMember |
| o C TeamSelection | Parameter to TM_World::ReferenceTeamMember()
| o C TM_TeamMember | A member of one or more teams
| | \ C RequestedTeam |
| o C TM_Team | A team, containing a list of TM_TeamMember instances
| o C TM_World | Stores a list of teams which may be enforcing a balanced number of members
| | \ C JoinRequestHelper |
| o C TeamManager | Automates networking and list management for teams
| o C TelnetTransport | Use TelnetTransport to easily allow windows telnet to connect to your ConsoleServer
| | \ C TelnetClient |
| o C RakThread |
| o C ThreadsafePacketLogger | Same as PacketLogger, but writes output in the user thread
| o C RakNetTransport2 | Use RakNetTransport if you need a secure connection between the client and the console server
| o C TransportInterface | Defines an interface that is used to send and receive null-terminated strings
| o C TwoWayAuthentication | Implements two way authentication
| | o C NonceAndRemoteSystemRequest |
| | o C NonceGenerator |
| | \ C PendingChallenge |
| o C PublicKey | Passed to RakPeerInterface::Connect()
| o C SocketDescriptor | Describes the local socket to use for RakPeer::Startup
| o C SystemAddress | Network address for a system
| o C RakNetGUID |
| o C AddressOrGUID |
| o C Packet | This represents a user message from another system
| o C uint24_t |
| o C UDPForwarder | Forwards UDP datagrams. Independent of RakNet's protocol
| | o C ForwardEntry |
| | o C StartForwardingInputStruct |
| | o C StartForwardingOutputStruct |
| | \ C StopForwardingStruct |
| o C UDPProxyClientResultHandler |
| o C UDPProxyClient | Communicates with UDPProxyCoordinator, in order to find a UDPProxyServer to forward our datagrams
| | o C PingServerGroup |
| | o C SenderAndTargetAddress |
| | \ C ServerWithPing |
| o C UDPProxyCoordinator | Middleman between UDPProxyServer and UDPProxyClient, maintaining a list of UDPProxyServer, and managing state for clients to find an available forwarding server
| | o C ForwardingRequest |
| | o C SenderAndTargetAddress |
| | \ C ServerWithPing |
| o C UDPProxyServerResultHandler |
| o C UDPProxyServer | UDPProxyServer to control our instance of UDPForwarder
| o C VariableDeltaSerializer | Class to compare memory values of variables in a current state to a prior state Results of the comparisons will be written to a bitStream, such that only changed variables get written Can be used with ReplicaManager3 to Serialize a Replica3 per-variable, rather than comparing the entire object against itself Usage: BR>
| | o C ChangedVariablesList |
| | o C DeserializationContext |
| | o C RemoteSystemVariableHistory |
| | \ C SerializationContext |
| o C VariableListDeltaTracker |
| | \ C VariableLastValueNode |
| o C RakWString | String class for Unicode
| \ C TeamSelection.teamParameter |
o N VariadicSQLParser |
| \ C IndexAndType |
o C CheckSum | Generates and validates checksums
o C CSHA1 |
o C FileListNodeContext |
o C GridSectorizer |
o C HuffmanEncodingTreeNode |
o C RefCountedObj | World's simplest class :)
o C RNS2_Windows_Linux_360 |
o C SHA1_WORKSPACE_BLOCK |
o C StrAndBool | The string plus a bool telling us if this string was copied or not
o C ThreadDataInterface |
o C ThreadPool |
\ C WSAStartupSingleton |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::BinarySearchTree< BinarySearchTreeType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • BinarySearchTree
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
DataStructures::BinarySearchTree< BinarySearchTreeType > Class Template Reference

A binary search tree and an AVL balanced binary search tree. More...

#include <slikenet/DS_BinarySearchTree.h>

+ Inheritance diagram for DataStructures::BinarySearchTree< BinarySearchTreeType >:

Classes

struct node

Public Member Functions

BinarySearchTree ()
virtual | ~BinarySearchTree ()
BinarySearchTree (const BinarySearchTree &original_type)
BinarySearchTree & | operator= (const BinarySearchTree &original_copy)
unsigned int | Size (void)
void | Clear (const char *file, unsigned int line)
unsigned int | Height (node *starting_node=0)
node * | Add (const BinarySearchTreeType &input, const char *file, unsigned int line)
node * | Del (const BinarySearchTreeType &input, const char *file, unsigned int line)
bool | IsIn (const BinarySearchTreeType &input)
void | DisplayInorder (BinarySearchTreeType *return_array)
void | DisplayPreorder (BinarySearchTreeType *return_array)
void | DisplayPostorder (BinarySearchTreeType *return_array)
void | DisplayBreadthFirstSearch (BinarySearchTreeType *return_array)
BinarySearchTreeType *& | GetPointerToNode (const BinarySearchTreeType &element)

Protected Types

enum Direction_Types { NOT_FOUND, LEFT, RIGHT, ROOT }

Protected Member Functions

unsigned int | HeightRecursive (node *current)
node *& | Find (const BinarySearchTreeType &element, node **parent)
node *& | FindParent (const BinarySearchTreeType &element)
void | DisplayPostorderRecursive (node *current, BinarySearchTreeType *return_array, unsigned int &index)
void | FixTree (node *current)

Protected Attributes

node * root
enum
DataStructures::BinarySearchTree::Direction_Types 		direction
unsigned int BinarySearchTree_size

Detailed Description

template<class BinarySearchTreeType>
class DataStructures::BinarySearchTree< BinarySearchTreeType >

A binary search tree and an AVL balanced binary search tree.

Initilize with the following structure

BinarySearchTree<TYPE>

OR

AVLBalancedBinarySearchTree<TYPE>

Use the AVL balanced tree if you want the tree to be balanced after every deletion and addition. This avoids the potential worst case scenario where ordered input to a binary search tree gives linear search time results. It's not needed if input will be evenly distributed, in which case the search time is O (log n). The search time for the AVL balanced binary tree is O (log n) irregardless of input.

Has the following member functions unsigned int Height(<index>) - Returns the height of the tree at the optional specified starting index. Default is the root add(element) - adds an element to the BinarySearchTree bool del(element) - deletes the node containing element if the element is in the tree as defined by a comparison with the == operator. Returns true on success, false if the element is not found bool IsInelement) - returns true if element is in the tree as defined by a comparison with the == operator. Otherwise returns false DisplayInorder(array) - Fills an array with an inorder search of the elements in the tree. USER IS REPONSIBLE FOR ALLOCATING THE ARRAY!. DisplayPreorder(array) - Fills an array with an preorder search of the elements in the tree. USER IS REPONSIBLE FOR ALLOCATING THE ARRAY!. DisplayPostorder(array) - Fills an array with an postorder search of the elements in the tree. USER IS REPONSIBLE FOR ALLOCATING THE ARRAY!. DisplayBreadthFirstSearch(array) - Fills an array with a breadth first search of the elements in the tree. USER IS REPONSIBLE FOR ALLOCATING THE ARRAY!. clear - Destroys the tree. Same as calling the destructor unsigned int Height() - Returns the height of the tree unsigned int size() - returns the size of the BinarySearchTree GetPointerToNode(element) - returns a pointer to the comparision element in the tree, allowing for direct modification when necessary with complex data types. Be warned, it is possible to corrupt the tree if the element used for comparisons is modified. Returns NULL if the item is not found

EXAMPLE

BinarySearchTree<int> A;
A.Add(10);
A.Add(15);
A.Add(5);
int* array = SLNet::OP_NEW<int >(A.Size(), _FILE_AND_LINE_ );
A.DisplayInorder(array);
array[0]; // returns 5
array[1]; // returns 10
array[2]; // returns 15

compress - reallocates memory to fit the number of elements. Best used when the number of elements decreases

clear - empties the BinarySearchTree and returns storage The assignment and copy constructors are defined

Note
The template type must have the copy constructor and assignment operator defined and must work with >, <, and == All elements in the tree MUST be distinct The assignment operator is defined between BinarySearchTree and AVLBalancedBinarySearchTree as long as they are of the same template type. However, passing a BinarySearchTree to an AVLBalancedBinarySearchTree will lose its structure unless it happened to be AVL balanced to begin with Requires queue_linked_list.cpp for the breadth first search used in the copy constructor, overloaded assignment operator, and display_breadth_first_search.

Definition at line 97 of file DS_BinarySearchTree.h.

Class Documentation

struct DataStructures::BinarySearchTree::node

template<class BinarySearchTreeType>
struct DataStructures::BinarySearchTree< BinarySearchTreeType >::node

Definition at line 102 of file DS_BinarySearchTree.h.

Class Members
BinarySearchTreeType * | item
node * | left
node * | right

Member Enumeration Documentation

template<class BinarySearchTreeType>
enum DataStructures::BinarySearchTree::Direction_Types
protected
Enumerator:
NOT_FOUND
LEFT
RIGHT
ROOT

Definition at line 129 of file DS_BinarySearchTree.h.

Constructor & Destructor Documentation

template<class BinarySearchTreeType >
DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree ( )

Definition at line 420 of file DS_BinarySearchTree.h.

template<class BinarySearchTreeType >
DataStructures::BinarySearchTree< BinarySearchTreeType >::~BinarySearchTree ( )
virtual

Definition at line 427 of file DS_BinarySearchTree.h.

References _FILE_AND_LINE_.

template<class BinarySearchTreeType >
DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree ( const BinarySearchTree< BinarySearchTreeType > & original_type )

Definition at line 980 of file DS_BinarySearchTree.h.

References _FILE_AND_LINE_, DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree_size, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, DataStructures::QueueLinkedList< QueueType >::Pop(), DataStructures::QueueLinkedList< QueueType >::Push(), DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right, DataStructures::BinarySearchTree< BinarySearchTreeType >::root, and DataStructures::QueueLinkedList< QueueType >::Size().

Member Function Documentation

template<class BinarySearchTreeType >
BinarySearchTree< BinarySearchTreeType >::node * DataStructures::BinarySearchTree< BinarySearchTreeType >::Add | ( | const BinarySearchTreeType & | input,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 680 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, and DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right.

Referenced by DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::Add().

template<class BinarySearchTreeType >
void DataStructures::BinarySearchTree< BinarySearchTreeType >::Clear | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |
inline

Definition at line 1079 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, SLNet::OP_DELETE(), and DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right.

template<class BinarySearchTreeType >
BinarySearchTree< BinarySearchTreeType >::node * DataStructures::BinarySearchTree< BinarySearchTreeType >::Del | ( | const BinarySearchTreeType & | input,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 542 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, SLNet::OP_DELETE(), and DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right.

Referenced by DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::Del().

template<class BinarySearchTreeType >
void DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayBreadthFirstSearch ( BinarySearchTreeType * return_array )

Definition at line 933 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, DataStructures::QueueLinkedList< QueueType >::Pop(), DataStructures::QueueLinkedList< QueueType >::Push(), return, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right, and DataStructures::QueueLinkedList< QueueType >::Size().

template<class BinarySearchTreeType >
void DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayInorder ( BinarySearchTreeType * return_array )

Definition at line 772 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, return, and DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right.

template<class BinarySearchTreeType >
void DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayPostorder ( BinarySearchTreeType * return_array )
inline

Definition at line 899 of file DS_BinarySearchTree.h.

References return.

template<class BinarySearchTreeType >
void DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayPostorderRecursive | ( | typename BinarySearchTree< BinarySearchTreeType >::node * | current,
 |  | BinarySearchTreeType * | return_array,
 |  | unsigned int & | index
 | ) |  |
protected

Definition at line 919 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, and DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right.

template<class BinarySearchTreeType >
void DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayPreorder ( BinarySearchTreeType * return_array )

Definition at line 843 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, return, and DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right.

template<class BinarySearchTreeType>
BinarySearchTree< BinarySearchTreeType >::node *& DataStructures::BinarySearchTree< BinarySearchTreeType >::Find | ( | const BinarySearchTreeType & | element,
 |  | node ** | parent
 | ) |  |
protected

Definition at line 446 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, and DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right.

template<class BinarySearchTreeType >
BinarySearchTree< BinarySearchTreeType >::node *& DataStructures::BinarySearchTree< BinarySearchTreeType >::FindParent ( const BinarySearchTreeType & element )
protected

Definition at line 502 of file DS_BinarySearchTree.h.

template<class BinarySearchTreeType >
void DataStructures::BinarySearchTree< BinarySearchTreeType >::FixTree ( typename BinarySearchTree< BinarySearchTreeType >::node * current )
protected

Definition at line 511 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, and DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right.

template<class BinarySearchTreeType >
BinarySearchTreeType *& DataStructures::BinarySearchTree< BinarySearchTreeType >::GetPointerToNode ( const BinarySearchTreeType & element )

Definition at line 433 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item.

template<class BinarySearchTreeType >
unsigned int DataStructures::BinarySearchTree< BinarySearchTreeType >::Height ( typename BinarySearchTree< BinarySearchTreeType >::node * starting_node = 0 )

Definition at line 390 of file DS_BinarySearchTree.h.

template<class BinarySearchTreeType >
unsigned int DataStructures::BinarySearchTree< BinarySearchTreeType >::HeightRecursive ( typename BinarySearchTree< BinarySearchTreeType >::node * current )
protected

Definition at line 400 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, and DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right.

template<class BinarySearchTreeType >
bool DataStructures::BinarySearchTree< BinarySearchTreeType >::IsIn ( const BinarySearchTreeType & input )

Definition at line 759 of file DS_BinarySearchTree.h.

template<class BinarySearchTreeType >
BinarySearchTree< BinarySearchTreeType > & DataStructures::BinarySearchTree< BinarySearchTreeType >::operator= ( const BinarySearchTree< BinarySearchTreeType > & original_copy )

Definition at line 1025 of file DS_BinarySearchTree.h.

References _FILE_AND_LINE_, DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree_size, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::item, DataStructures::BinarySearchTree< BinarySearchTreeType >::node::left, DataStructures::QueueLinkedList< QueueType >::Pop(), DataStructures::QueueLinkedList< QueueType >::Push(), DataStructures::BinarySearchTree< BinarySearchTreeType >::node::right, DataStructures::BinarySearchTree< BinarySearchTreeType >::root, and DataStructures::QueueLinkedList< QueueType >::Size().

Referenced by DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::operator=().

template<class BinarySearchTreeType >
unsigned int DataStructures::BinarySearchTree< BinarySearchTreeType >::Size ( void )

Definition at line 384 of file DS_BinarySearchTree.h.

Member Data Documentation

template<class BinarySearchTreeType>
unsigned int DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree_size
protected

Definition at line 134 of file DS_BinarySearchTree.h.

Referenced by DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree(), and DataStructures::BinarySearchTree< BinarySearchTreeType >::operator=().

template<class BinarySearchTreeType>
enum DataStructures::BinarySearchTree::Direction_Types DataStructures::BinarySearchTree< BinarySearchTreeType >::direction
protected
template<class BinarySearchTreeType>
node* DataStructures::BinarySearchTree< BinarySearchTreeType >::root
protected

Definition at line 127 of file DS_BinarySearchTree.h.

Referenced by DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree(), and DataStructures::BinarySearchTree< BinarySearchTreeType >::operator=().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_BinarySearchTree.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • AVLBalancedBinarySearchTree
Public Member Functions | List of all members
DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType > Class Template Reference

An AVLBalancedBinarySearchTree is a binary tree that is always balanced. More...

#include <slikenet/DS_BinarySearchTree.h>

+ Inheritance diagram for DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >:

Public Member Functions

AVLBalancedBinarySearchTree ()
virtual | ~AVLBalancedBinarySearchTree ()
void | Add (const BinarySearchTreeType &input)
void | Del (const BinarySearchTreeType &input)
BinarySearchTree
< BinarySearchTreeType > & 		operator= (BinarySearchTree< BinarySearchTreeType > &original_copy)
- Public Member Functions inherited from DataStructures::BinarySearchTree< BinarySearchTreeType >
BinarySearchTree ()
virtual | ~BinarySearchTree ()
BinarySearchTree (const BinarySearchTree &original_type)
BinarySearchTree & | operator= (const BinarySearchTree &original_copy)
unsigned int | Size (void)
void | Clear (const char *file, unsigned int line)
unsigned int | Height (node *starting_node=0)
node * | Add (const BinarySearchTreeType &input, const char *file, unsigned int line)
node * | Del (const BinarySearchTreeType &input, const char *file, unsigned int line)
bool | IsIn (const BinarySearchTreeType &input)
void | DisplayInorder (BinarySearchTreeType *return_array)
void | DisplayPreorder (BinarySearchTreeType *return_array)
void | DisplayPostorder (BinarySearchTreeType *return_array)
void | DisplayBreadthFirstSearch (BinarySearchTreeType *return_array)
BinarySearchTreeType *& | GetPointerToNode (const BinarySearchTreeType &element)

Additional Inherited Members

- Protected Types inherited from DataStructures::BinarySearchTree< BinarySearchTreeType >
enum | Direction_Types { NOT_FOUND, LEFT, RIGHT, ROOT }
- Protected Member Functions inherited from DataStructures::BinarySearchTree< BinarySearchTreeType >
unsigned int | HeightRecursive (node *current)
node *& | Find (const BinarySearchTreeType &element, node **parent)
node *& | FindParent (const BinarySearchTreeType &element)
void | DisplayPostorderRecursive (node *current, BinarySearchTreeType *return_array, unsigned int &index)
void | FixTree (node *current)
- Protected Attributes inherited from DataStructures::BinarySearchTree< BinarySearchTreeType >
node * root
enum
DataStructures::BinarySearchTree::Direction_Types 		direction
unsigned int | BinarySearchTree_size

Detailed Description

template<class BinarySearchTreeType>
class DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >

An AVLBalancedBinarySearchTree is a binary tree that is always balanced.

Definition at line 144 of file DS_BinarySearchTree.h.

Constructor & Destructor Documentation

template<class BinarySearchTreeType >
DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::AVLBalancedBinarySearchTree ( )
inline

Definition at line 148 of file DS_BinarySearchTree.h.

template<class BinarySearchTreeType >
DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::~AVLBalancedBinarySearchTree ( )
virtual

Definition at line 378 of file DS_BinarySearchTree.h.

References _FILE_AND_LINE_.

Member Function Documentation

template<class BinarySearchTreeType >
void DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::Add ( const BinarySearchTreeType & input )

Definition at line 216 of file DS_BinarySearchTree.h.

References _FILE_AND_LINE_, and DataStructures::BinarySearchTree< BinarySearchTreeType >::Add().

template<class BinarySearchTreeType >
void DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::Del ( const BinarySearchTreeType & input )

Definition at line 224 of file DS_BinarySearchTree.h.

References _FILE_AND_LINE_, and DataStructures::BinarySearchTree< BinarySearchTreeType >::Del().

template<class BinarySearchTreeType >
BinarySearchTree<BinarySearchTreeType>& DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::operator= ( BinarySearchTree< BinarySearchTreeType > & original_copy )
inline

Definition at line 152 of file DS_BinarySearchTree.h.

References DataStructures::BinarySearchTree< BinarySearchTreeType >::operator=().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_BinarySearchTree.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::BPlusTree< KeyType, DataType, order > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • BPlusTree
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
DataStructures::BPlusTree< KeyType, DataType, order > Class Template Reference

#include <slikenet/DS_BPlusTree.h>

+ Inheritance diagram for DataStructures::BPlusTree< KeyType, DataType, order >:

Classes

struct ReturnAction

Public Member Functions

BPlusTree ()
~BPlusTree ()
void | SetPoolPageSize (int size)
bool | Get (const KeyType key, DataType &out) const
bool | Delete (const KeyType key)
bool | Delete (const KeyType key, DataType &out)
bool | Insert (const KeyType key, const DataType &data)
void | Clear (void)
unsigned | Size (void) const
bool | IsEmpty (void) const
Page< KeyType, DataType, order > * | GetListHead (void) const
DataType | GetDataHead (void) const
void | PrintLeaves (void)
void | ForEachLeaf (void(*func)(Page< KeyType, DataType, order > *leaf, int index))
void | ForEachData (void(*func)(DataType input, int index))
void | PrintGraph (void)

Protected Member Functions

void | ValidateTreeRecursive (Page< KeyType, DataType, order > *cur)
void | DeleteFromPageAtIndex (const int index, Page< KeyType, DataType, order > *cur)
void | FreePages (void)
bool | GetIndexOf (const KeyType key, Page< KeyType, DataType, order > *page, int *out) const
void | ShiftKeysLeft (Page< KeyType, DataType, order > *cur)
bool | CanRotateLeft (Page< KeyType, DataType, order > *cur, int childIndex)
bool | CanRotateRight (Page< KeyType, DataType, order > *cur, int childIndex)
void | RotateRight (Page< KeyType, DataType, order > *cur, int childIndex, ReturnAction *returnAction)
void | RotateLeft (Page< KeyType, DataType, order > *cur, int childIndex, ReturnAction *returnAction)
Page< KeyType, DataType, order > * | InsertIntoNode (const KeyType key, const DataType &childData, int insertionIndex, Page< KeyType, DataType, order > *nodeData, Page< KeyType, DataType, order > *cur, ReturnAction *returnAction)
Page< KeyType, DataType, order > * | InsertBranchDown (const KeyType key, const DataType &data, Page< KeyType, DataType, order > *cur, ReturnAction *returnAction, bool *success)
Page< KeyType, DataType, order > * | GetLeafFromKey (const KeyType key) const
bool | FindDeleteRebalance (const KeyType key, Page< KeyType, DataType, order > *cur, bool *underflow, KeyType rightRootKey, ReturnAction *returnAction, DataType &out)
bool | FixUnderflow (int branchIndex, Page< KeyType, DataType, order > *cur, KeyType rightRootKey, ReturnAction *returnAction)
void | ShiftNodeLeft (Page< KeyType, DataType, order > *cur)
void | ShiftNodeRight (Page< KeyType, DataType, order > *cur)

Static Protected Member Functions

static void PrintLeaf (Page< KeyType, DataType, order > *leaf, int index)

Protected Attributes

MemoryPool< Page< KeyType,
DataType, order > > 		pagePool
Page< KeyType, DataType, order > * | root
Page< KeyType, DataType, order > * | leftmostLeaf

Detailed Description

template<class KeyType, class DataType, int order>
class DataStructures::BPlusTree< KeyType, DataType, order >

A BPlus tree Written with efficiency and speed in mind.

Definition at line 77 of file DS_BPlusTree.h.

Constructor & Destructor Documentation

template<class KeyType , class DataType , int order>
DataStructures::BPlusTree< KeyType, DataType, order >::BPlusTree ( )

Definition at line 133 of file DS_BPlusTree.h.

References RakAssert.

template<class KeyType , class DataType , int order>
DataStructures::BPlusTree< KeyType, DataType, order >::~BPlusTree ( )

Definition at line 140 of file DS_BPlusTree.h.

Member Function Documentation

template<class KeyType, class DataType, int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::CanRotateLeft | ( | Page< KeyType, DataType, order > * | cur,
 |  | int | childIndex
 | ) |  |
protected

Definition at line 662 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::children, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType, int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::CanRotateRight | ( | Page< KeyType, DataType, order > * | cur,
 |  | int | childIndex
 | ) |  |
protected

Definition at line 687 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::children, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType , class DataType , int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::Clear ( void )

Definition at line 890 of file DS_BPlusTree.h.

References _FILE_AND_LINE_.

Referenced by DataStructures::Table::Clear().

template<class KeyType, class DataType , int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::Delete ( const KeyType key )

Definition at line 184 of file DS_BPlusTree.h.

Referenced by DataStructures::Table::RemoveRow(), and DataStructures::Table::RemoveRows().

template<class KeyType, class DataType, int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::Delete | ( | const KeyType | key,
 |  | DataType & | out
 | ) |  |

Definition at line 190 of file DS_BPlusTree.h.

References _FILE_AND_LINE_, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::action, and DataStructures::Page< KeyType, DataType, order >::children.

template<class KeyType, class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::DeleteFromPageAtIndex | ( | const int | index,
 |  | Page< KeyType, DataType, order > * | cur
 | ) |  |
protected

Definition at line 166 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::data, if(), DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::Page< KeyType, DataType, order >::keys, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType, int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::FindDeleteRebalance | ( | const KeyType | key,
 |  | Page< KeyType, DataType, order > * | cur,
 |  | bool * | underflow,
 |  | KeyType | rightRootKey,
 |  | ReturnAction * | returnAction,
 |  | DataType & | out
 | ) |  |
protected

Definition at line 230 of file DS_BPlusTree.h.

References DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::action, DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::data, DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key1, DataStructures::Page< KeyType, DataType, order >::keys, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType, int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::FixUnderflow | ( | int | branchIndex,
 |  | Page< KeyType, DataType, order > * | cur,
 |  | KeyType | rightRootKey,
 |  | ReturnAction * | returnAction
 | ) |  |
protected

Definition at line 305 of file DS_BPlusTree.h.

References _FILE_AND_LINE_, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::action, DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::data, DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key1, DataStructures::Page< KeyType, DataType, order >::keys, DataStructures::Page< KeyType, DataType, order >::next, DataStructures::Page< KeyType, DataType, order >::previous, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType , class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::ForEachData ( void(*)(DataType input, int index) func )

Definition at line 988 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::data, DataStructures::Page< KeyType, DataType, order >::next, and DataStructures::Page< KeyType, DataType, order >::size.

Referenced by DataStructures::Table::AddColumn(), and DataStructures::Table::Clear().

template<class KeyType, class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::ForEachLeaf ( void(*)(Page< KeyType, DataType, order > *leaf, int index) func )

Definition at line 977 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::next.

template<class KeyType , class DataType , int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::FreePages ( void )
protected

Definition at line 948 of file DS_BPlusTree.h.

References _FILE_AND_LINE_, DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Push(), DataStructures::Queue< queue_type >::Size(), and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType, int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::Get | ( | const KeyType | key,
 |  | DataType & | out
 | ) |  | const

Definition at line 150 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::data.

Referenced by DataStructures::Table::GetRowByID(), and DataStructures::Table::QueryTable().

template<class KeyType , class DataType , int order>
DataType DataStructures::BPlusTree< KeyType, DataType, order >::GetDataHead ( void ) const

Definition at line 972 of file DS_BPlusTree.h.

template<class KeyType, class DataType, int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::GetIndexOf | ( | const KeyType | key,
 |  | Page< KeyType, DataType, order > * | page,
 |  | int * | out
 | ) |  | const
 protected

Definition at line 918 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::keys, RakAssert, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType , int order>
Page< KeyType, DataType, order > * DataStructures::BPlusTree< KeyType, DataType, order >::GetLeafFromKey ( const KeyType key ) const
protected

Definition at line 712 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::children, and DataStructures::Page< KeyType, DataType, order >::isLeaf.

template<class KeyType , class DataType , int order>
Page< KeyType, DataType, order > * DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead ( void ) const

Definition at line 967 of file DS_BPlusTree.h.

Referenced by DataStructures::Table::GetAvailableRowId(), DataStructures::Table::GetListHead(), DataStructures::Table::GetRowByIndex(), DataStructures::Table::operator=(), DataStructures::Table::QueryTable(), DataStructures::Table::RemoveColumn(), DataStructures::Table::RemoveRows(), SLNet::TableSerializer::SerializeTable(), and DataStructures::Table::SortTable().

template<class KeyType, class DataType, int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::Insert | ( | const KeyType | key,
 |  | const DataType & | data
 | ) |  |

Definition at line 835 of file DS_BPlusTree.h.

References _FILE_AND_LINE_, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::action, DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key1, DataStructures::Page< KeyType, DataType, order >::keys, RakAssert, and DataStructures::Page< KeyType, DataType, order >::size.

Referenced by DataStructures::Table::AddRow(), and DataStructures::Table::AddRowColumns().

template<class KeyType, class DataType, int order>
Page< KeyType, DataType, order > * DataStructures::BPlusTree< KeyType, DataType, order >::InsertBranchDown | ( | const KeyType | key,
 |  | const DataType & | data,
 |  | Page< KeyType, DataType, order > * | cur,
 |  | ReturnAction * | returnAction,
 |  | bool * | success
 | ) |  |
protected

Definition at line 727 of file DS_BPlusTree.h.

References DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::action, DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::data, DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key1, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key2, DataStructures::Page< KeyType, DataType, order >::keys, RakAssert, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType, int order>
Page< KeyType, DataType, order > * DataStructures::BPlusTree< KeyType, DataType, order >::InsertIntoNode | ( | const KeyType | key,
 |  | const DataType & | childData,
 |  | int | insertionIndex,
 |  | Page< KeyType, DataType, order > * | nodeData,
 |  | Page< KeyType, DataType, order > * | cur,
 |  | ReturnAction * | returnAction
 | ) |  |
protected

Definition at line 522 of file DS_BPlusTree.h.

References _FILE_AND_LINE_, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::action, DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::data, for(), if(), DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key1, DataStructures::Page< KeyType, DataType, order >::keys, DataStructures::Page< KeyType, DataType, order >::next, DataStructures::Page< KeyType, DataType, order >::previous, RakAssert, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType , class DataType , int order>
bool DataStructures::BPlusTree< KeyType, DataType, order >::IsEmpty ( void ) const

Definition at line 913 of file DS_BPlusTree.h.

template<class KeyType , class DataType , int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::PrintGraph ( void )

Definition at line 1035 of file DS_BPlusTree.h.

References _FILE_AND_LINE_, DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::Page< KeyType, DataType, order >::keys, DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Push(), RAKNET_DEBUG_PRINTF, DataStructures::Queue< queue_type >::Size(), and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::PrintLeaf | ( | Page< KeyType, DataType, order > * | leaf,
 |  | int | index
 | ) |  |
staticprotected

Definition at line 1000 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::data, RAKNET_DEBUG_PRINTF, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType , class DataType , int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::PrintLeaves ( void )

Definition at line 1009 of file DS_BPlusTree.h.

template<class KeyType, class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::RotateLeft | ( | Page< KeyType, DataType, order > * | cur,
 |  | int | childIndex,
 |  | ReturnAction * | returnAction
 | ) |  |
protected

Definition at line 668 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::data, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key1, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key2, DataStructures::Page< KeyType, DataType, order >::keys, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::RotateRight | ( | Page< KeyType, DataType, order > * | cur,
 |  | int | childIndex,
 |  | ReturnAction * | returnAction
 | ) |  |
protected

Definition at line 693 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::data, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key1, DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key2, DataStructures::Page< KeyType, DataType, order >::keys, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType , class DataType , int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::SetPoolPageSize ( int size )

Definition at line 145 of file DS_BPlusTree.h.

template<class KeyType, class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::ShiftKeysLeft ( Page< KeyType, DataType, order > * cur )
protected

Definition at line 883 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::keys, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::ShiftNodeLeft ( Page< KeyType, DataType, order > * cur )
protected

Definition at line 504 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::data, if(), DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::Page< KeyType, DataType, order >::keys, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType, class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::ShiftNodeRight ( Page< KeyType, DataType, order > * cur )
protected

Definition at line 485 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::data, DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::Page< KeyType, DataType, order >::keys, and DataStructures::Page< KeyType, DataType, order >::size.

template<class KeyType , class DataType , int order>
unsigned DataStructures::BPlusTree< KeyType, DataType, order >::Size ( void ) const

Definition at line 901 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::next, and DataStructures::Page< KeyType, DataType, order >::size.

Referenced by DataStructures::Table::GetRowCount(), and SLNet::TableSerializer::SerializeTable().

template<class KeyType, class DataType, int order>
void DataStructures::BPlusTree< KeyType, DataType, order >::ValidateTreeRecursive ( Page< KeyType, DataType, order > * cur )
protected

Definition at line 1015 of file DS_BPlusTree.h.

References DataStructures::Page< KeyType, DataType, order >::children, DataStructures::Page< KeyType, DataType, order >::isLeaf, DataStructures::Page< KeyType, DataType, order >::keys, RakAssert, and DataStructures::Page< KeyType, DataType, order >::size.

Member Data Documentation

template<class KeyType, class DataType, int order>
Page<KeyType, DataType, order> * DataStructures::BPlusTree< KeyType, DataType, order >::leftmostLeaf
protected

Definition at line 129 of file DS_BPlusTree.h.

template<class KeyType, class DataType, int order>
MemoryPool<Page<KeyType, DataType, order> > DataStructures::BPlusTree< KeyType, DataType, order >::pagePool
protected

Definition at line 128 of file DS_BPlusTree.h.

template<class KeyType, class DataType, int order>
Page<KeyType, DataType, order>* DataStructures::BPlusTree< KeyType, DataType, order >::root
protected

Definition at line 129 of file DS_BPlusTree.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_BPlusTree.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • BPlusTree
  • ReturnAction
Public Types | Public Attributes | List of all members
DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction Struct Reference

#include <slikenet/DS_BPlusTree.h>

Public Types

enum { NO_ACTION, REPLACE_KEY1_WITH_KEY2, PUSH_KEY_TO_PARENT, SET_BRANCH_KEY }

Public Attributes

KeyType | key1
KeyType | key2
enum
DataStructures::BPlusTree::ReturnAction:: { ... } 		action

Detailed Description

template<class KeyType, class DataType, int order>
struct DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction

Definition at line 80 of file DS_BPlusTree.h.

Member Enumeration Documentation

template<class KeyType, class DataType, int order>
anonymous enum
Enumerator:
NO_ACTION
REPLACE_KEY1_WITH_KEY2
PUSH_KEY_TO_PARENT
SET_BRANCH_KEY

Definition at line 84 of file DS_BPlusTree.h.

Member Data Documentation

enum { ... } DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::action

Referenced by DataStructures::BPlusTree< KeyType, DataType, order >::Delete(), DataStructures::BPlusTree< KeyType, DataType, order >::FindDeleteRebalance(), DataStructures::BPlusTree< KeyType, DataType, order >::FixUnderflow(), DataStructures::BPlusTree< KeyType, DataType, order >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::InsertBranchDown(), and DataStructures::BPlusTree< KeyType, DataType, order >::InsertIntoNode().

template<class KeyType, class DataType, int order>
KeyType DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key1

Definition at line 82 of file DS_BPlusTree.h.

Referenced by DataStructures::BPlusTree< KeyType, DataType, order >::FindDeleteRebalance(), DataStructures::BPlusTree< KeyType, DataType, order >::FixUnderflow(), DataStructures::BPlusTree< KeyType, DataType, order >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::InsertBranchDown(), DataStructures::BPlusTree< KeyType, DataType, order >::InsertIntoNode(), DataStructures::BPlusTree< KeyType, DataType, order >::RotateLeft(), and DataStructures::BPlusTree< KeyType, DataType, order >::RotateRight().

template<class KeyType, class DataType, int order>
KeyType DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction::key2

Definition at line 83 of file DS_BPlusTree.h.

Referenced by DataStructures::BPlusTree< KeyType, DataType, order >::InsertBranchDown(), DataStructures::BPlusTree< KeyType, DataType, order >::RotateLeft(), and DataStructures::BPlusTree< KeyType, DataType, order >::RotateRight().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/DS_BPlusTree.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::BytePool Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • BytePool
Public Member Functions | Protected Attributes | List of all members
DataStructures::BytePool Class Reference

#include <slikenet/DS_BytePool.h>

Public Member Functions

BytePool ()
~BytePool ()
void | SetPageSize (int size)
unsigned char * | Allocate (int bytesWanted, const char *file, unsigned int line)
void | Release (unsigned char *data, const char *file, unsigned int line)
void | Clear (const char *file, unsigned int line)

Protected Attributes

MemoryPool< unsigned char[128]> | pool128
MemoryPool< unsigned char[512]> | pool512
MemoryPool< unsigned char[2048]> | pool2048
MemoryPool< unsigned char[8192]> | pool8192

Detailed Description

Definition at line 35 of file DS_BytePool.h.

Constructor & Destructor Documentation

BytePool::BytePool ( )

Definition at line 25 of file DS_BytePool.cpp.

References pool128, pool2048, pool512, pool8192, and DataStructures::MemoryPool< MemoryBlockType >::SetPageSize().

BytePool::~BytePool ( )

Definition at line 32 of file DS_BytePool.cpp.

Member Function Documentation

unsigned char * BytePool::Allocate | ( | int | bytesWanted,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 42 of file DS_BytePool.cpp.

References _FILE_AND_LINE_, DataStructures::MemoryPool< MemoryBlockType >::Allocate(), pool128, pool2048, pool512, pool8192, and rakMalloc_Ex.

void BytePool::Clear | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 153 of file DS_BytePool.cpp.

References DataStructures::MemoryPool< MemoryBlockType >::Clear(), pool128, pool2048, pool512, and pool8192.

void BytePool::Release | ( | unsigned char * | data,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 101 of file DS_BytePool.cpp.

References _FILE_AND_LINE_, pool128, pool2048, pool512, pool8192, RakAssert, rakFree_Ex, and DataStructures::MemoryPool< MemoryBlockType >::Release().

void BytePool::SetPageSize ( int size )

Definition at line 35 of file DS_BytePool.cpp.

References pool128, pool2048, pool512, pool8192, and DataStructures::MemoryPool< MemoryBlockType >::SetPageSize().

Member Data Documentation

MemoryPool<unsigned char[128]> DataStructures::BytePool::pool128
protected

Definition at line 46 of file DS_BytePool.h.

Referenced by Allocate(), BytePool(), Clear(), Release(), and SetPageSize().

MemoryPool<unsigned char[2048]> DataStructures::BytePool::pool2048
protected

Definition at line 48 of file DS_BytePool.h.

Referenced by Allocate(), BytePool(), Clear(), Release(), and SetPageSize().

MemoryPool<unsigned char[512]> DataStructures::BytePool::pool512
protected

Definition at line 47 of file DS_BytePool.h.

Referenced by Allocate(), BytePool(), Clear(), Release(), and SetPageSize().

MemoryPool<unsigned char[8192]> DataStructures::BytePool::pool8192
protected

Definition at line 49 of file DS_BytePool.h.

Referenced by Allocate(), BytePool(), Clear(), Release(), and SetPageSize().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/DS_BytePool.h
  • Source/src/DS_BytePool.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::ByteQueue Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • ByteQueue
Public Member Functions | Protected Attributes | List of all members
DataStructures::ByteQueue Class Reference

#include <slikenet/DS_ByteQueue.h>

Public Member Functions

ByteQueue ()
~ByteQueue ()
void | WriteBytes (const char *in, unsigned length, const char *file, unsigned int line)
bool | ReadBytes (char *out, unsigned maxLengthToRead, bool peek)
unsigned | GetBytesWritten (void) const
char * | PeekContiguousBytes (unsigned int *outLength) const
void | IncrementReadOffset (unsigned length)
void | DecrementReadOffset (unsigned length)
void | Clear (const char *file, unsigned int line)
void | Print (void)

Protected Attributes

char * | data
unsigned | readOffset
unsigned | writeOffset
unsigned | lengthAllocated

Detailed Description

Definition at line 32 of file DS_ByteQueue.h.

Constructor & Destructor Documentation

ByteQueue::ByteQueue ( )

Definition at line 24 of file DS_ByteQueue.cpp.

References data, lengthAllocated, readOffset, and writeOffset.

ByteQueue::~ByteQueue ( )

Definition at line 29 of file DS_ByteQueue.cpp.

References _FILE_AND_LINE_, and Clear().

Member Function Documentation

void ByteQueue::Clear | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 111 of file DS_ByteQueue.cpp.

References data, lengthAllocated, rakFree_Ex, readOffset, and writeOffset.

Referenced by SLNet::RemoteClient::Reset(), and ~ByteQueue().

void ByteQueue::DecrementReadOffset ( unsigned length )

Definition at line 129 of file DS_ByteQueue.cpp.

References lengthAllocated, and readOffset.

unsigned ByteQueue::GetBytesWritten ( void ) const

Definition at line 118 of file DS_ByteQueue.cpp.

References lengthAllocated, readOffset, and writeOffset.

Referenced by ReadBytes(), and WriteBytes().

void ByteQueue::IncrementReadOffset ( unsigned length )

Definition at line 125 of file DS_ByteQueue.cpp.

References lengthAllocated, and readOffset.

Referenced by ReadBytes().

char * ByteQueue::PeekContiguousBytes ( unsigned int * outLength ) const

Definition at line 103 of file DS_ByteQueue.cpp.

References data, lengthAllocated, readOffset, and writeOffset.

void ByteQueue::Print ( void )

Definition at line 136 of file DS_ByteQueue.cpp.

References data, RAKNET_DEBUG_PRINTF, readOffset, and writeOffset.

bool ByteQueue::ReadBytes | ( | char * | out,
 |  | unsigned | maxLengthToRead,
 |  | bool | peek
 | ) |  |

Definition at line 74 of file DS_ByteQueue.cpp.

References data, GetBytesWritten(), IncrementReadOffset(), lengthAllocated, readOffset, and writeOffset.

void ByteQueue::WriteBytes | ( | const char * | in,
 |  | unsigned | length,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 35 of file DS_ByteQueue.cpp.

References data, GetBytesWritten(), lengthAllocated, rakRealloc_Ex, readOffset, and writeOffset.

Member Data Documentation

char* DataStructures::ByteQueue::data
protected

Definition at line 47 of file DS_ByteQueue.h.

Referenced by ByteQueue(), Clear(), PeekContiguousBytes(), Print(), ReadBytes(), and WriteBytes().

unsigned DataStructures::ByteQueue::lengthAllocated
protected

Definition at line 48 of file DS_ByteQueue.h.

Referenced by ByteQueue(), Clear(), DecrementReadOffset(), GetBytesWritten(), IncrementReadOffset(), PeekContiguousBytes(), ReadBytes(), and WriteBytes().

unsigned DataStructures::ByteQueue::readOffset
protected

Definition at line 48 of file DS_ByteQueue.h.

Referenced by ByteQueue(), Clear(), DecrementReadOffset(), GetBytesWritten(), IncrementReadOffset(), PeekContiguousBytes(), Print(), ReadBytes(), and WriteBytes().

unsigned DataStructures::ByteQueue::writeOffset
protected

Definition at line 48 of file DS_ByteQueue.h.

Referenced by ByteQueue(), Clear(), GetBytesWritten(), PeekContiguousBytes(), Print(), ReadBytes(), and WriteBytes().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/DS_ByteQueue.h
  • Source/src/DS_ByteQueue.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::HashIndex Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • HashIndex
Public Member Functions | Public Attributes | List of all members
DataStructures::HashIndex Struct Reference

#include <slikenet/DS_Hash.h>

Public Member Functions

bool | IsInvalid (void) const
void | SetInvalid (void)

Public Attributes

unsigned int | primaryIndex
unsigned int | secondaryIndex

Detailed Description

Definition at line 34 of file DS_Hash.h.

Member Function Documentation

bool DataStructures::HashIndex::IsInvalid ( void ) const
inline

Definition at line 38 of file DS_Hash.h.

References primaryIndex.

Referenced by DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::RemoveAtIndex().

void DataStructures::HashIndex::SetInvalid ( void )
inline

Definition at line 39 of file DS_Hash.h.

References primaryIndex, and secondaryIndex.

Referenced by DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetIndexOf().

Member Data Documentation

unsigned int DataStructures::HashIndex::primaryIndex

Definition at line 36 of file DS_Hash.h.

Referenced by DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetIndexOf(), IsInvalid(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::ItemAtIndex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::KeyAtIndex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::RemoveAtIndex(), and SetInvalid().

unsigned int DataStructures::HashIndex::secondaryIndex

Definition at line 37 of file DS_Hash.h.

Referenced by DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetIndexOf(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::ItemAtIndex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::KeyAtIndex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::RemoveAtIndex(), and SetInvalid().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/DS_Hash.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Hash
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > Class Template Reference

Using a string as a identifier for a node, store an allocated pointer to that node. More...

#include <slikenet/DS_Hash.h>

+ Inheritance diagram for DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >:

Classes

struct Node

Public Member Functions

Hash ()
Default constructor.
~Hash ()
void | Push (key_type key, const data_type &input, const char *file, unsigned int line)
data_type * | Peek (key_type key)
bool | Pop (data_type &out, key_type key, const char *file, unsigned int line)
bool | RemoveAtIndex (HashIndex index, const char *file, unsigned int line)
bool | Remove (key_type key, const char *file, unsigned int line)
HashIndex | GetIndexOf (key_type key)
bool | HasData (key_type key)
data_type & | ItemAtIndex (const HashIndex &index)
key_type | KeyAtIndex (const HashIndex &index)
void | GetAsList (DataStructures::List< data_type > &itemList, DataStructures::List< key_type > &keyList, const char *file, unsigned int line) const
unsigned int | Size (void) const
void | Clear (const char *file, unsigned int line)
Clear the list.

Protected Member Functions

void ClearIndex (unsigned int index, const char *file, unsigned int line)

Protected Attributes

Node ** nodeList
unsigned int size

Detailed Description

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
class DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >

Using a string as a identifier for a node, store an allocated pointer to that node.

Definition at line 44 of file DS_Hash.h.

Constructor & Destructor Documentation

template<class key_type , class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Hash ( )

Default constructor.

Definition at line 84 of file DS_Hash.h.

template<class key_type , class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::~Hash ( )

Definition at line 91 of file DS_Hash.h.

References _FILE_AND_LINE_.

Member Function Documentation

template<class key_type , class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
void DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Clear | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Clear the list.

Definition at line 304 of file DS_Hash.h.

References SLNet::OP_DELETE_ARRAY().

template<class key_type , class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
void DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::ClearIndex | ( | unsigned int | index,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
protected

Definition at line 318 of file DS_Hash.h.

References DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::next, and SLNet::OP_DELETE().

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
void DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetAsList | ( | DataStructures::List< data_type > & | itemList,
 |  | DataStructures::List< key_type > & | keyList,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  | const

Definition at line 333 of file DS_Hash.h.

References _FILE_AND_LINE_, DataStructures::List< list_type >::Clear(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::data, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::next, DataStructures::List< list_type >::Push(), and DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::string.

template<class key_type, class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
HashIndex DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetIndexOf ( key_type key )

Definition at line 238 of file DS_Hash.h.

References DataStructures::HashIndex::primaryIndex, DataStructures::HashIndex::secondaryIndex, and DataStructures::HashIndex::SetInvalid().

template<class key_type, class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
bool DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::HasData ( key_type key )

Definition at line 270 of file DS_Hash.h.

template<class key_type , class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
data_type & DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::ItemAtIndex ( const HashIndex & index )

Definition at line 276 of file DS_Hash.h.

References DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::data, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::next, DataStructures::HashIndex::primaryIndex, RakAssert, and DataStructures::HashIndex::secondaryIndex.

template<class key_type , class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
key_type DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::KeyAtIndex ( const HashIndex & index )

Definition at line 290 of file DS_Hash.h.

References DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::next, DataStructures::HashIndex::primaryIndex, RakAssert, DataStructures::HashIndex::secondaryIndex, and DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::string.

template<class key_type, class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
data_type * DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Peek ( key_type key )

Definition at line 114 of file DS_Hash.h.

References DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::data.

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
bool DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Pop | ( | data_type & | out,
 |  | key_type | key,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 131 of file DS_Hash.h.

References _FILE_AND_LINE_, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::data, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::next, and SLNet::OP_DELETE().

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
void DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Push | ( | key_type | key,
 |  | const data_type & | input,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 97 of file DS_Hash.h.

References DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::next.

template<class key_type, class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
bool DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Remove | ( | key_type | key,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 232 of file DS_Hash.h.

template<class key_type , class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
bool DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::RemoveAtIndex | ( | HashIndex | index,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 189 of file DS_Hash.h.

References DataStructures::HashIndex::IsInvalid(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::next, SLNet::OP_DELETE(), DataStructures::HashIndex::primaryIndex, and DataStructures::HashIndex::secondaryIndex.

template<class key_type , class data_type , unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
unsigned int DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Size ( void ) const

Definition at line 357 of file DS_Hash.h.

Member Data Documentation

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
Node** DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::nodeList
protected

Definition at line 79 of file DS_Hash.h.

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
unsigned int DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::size
protected

Definition at line 80 of file DS_Hash.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_Hash.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Hash
  • Node
Public Member Functions | Public Attributes | List of all members
DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node Struct Reference

#include <slikenet/DS_Hash.h>

Public Member Functions

Node (key_type strIn, const data_type &_data)

Public Attributes

key_type | string
data_type | data
Node * next

Detailed Description

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
struct DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node

Definition at line 68 of file DS_Hash.h.

Constructor & Destructor Documentation

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::Node | ( | key_type | strIn,
 |  | const data_type & | _data
 | ) |  |
inline

Definition at line 70 of file DS_Hash.h.

Member Data Documentation

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
data_type DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::data

Definition at line 72 of file DS_Hash.h.

Referenced by DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetAsList(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::ItemAtIndex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Peek(), and DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Pop().

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
Node* DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::next

Definition at line 74 of file DS_Hash.h.

Referenced by DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::ClearIndex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetAsList(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::ItemAtIndex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::KeyAtIndex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Pop(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Push(), and DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::RemoveAtIndex().

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>
key_type DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node::string

Definition at line 71 of file DS_Hash.h.

Referenced by DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetAsList(), and DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::KeyAtIndex().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/DS_Hash.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Heap< weight_type, data_type, isMaxHeap > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Heap
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataStructures::Heap< weight_type, data_type, isMaxHeap > Class Template Reference

#include <slikenet/DS_Heap.h>

+ Inheritance diagram for DataStructures::Heap< weight_type, data_type, isMaxHeap >:

Classes

struct HeapNode

Public Member Functions

Heap ()
~Heap ()
void | Push (const weight_type &weight, const data_type &data, const char *file, unsigned int line)
void | StartSeries (void)
Call before calling PushSeries, for a new series of items.
void | PushSeries (const weight_type &weight, const data_type &data, const char *file, unsigned int line)
If you are going to push a list of items, where the weights of the items on the list are in order and follow the heap order, PushSeries is faster than Push()
data_type | Pop (const unsigned startingIndex)
data_type | Peek (const unsigned startingIndex=0) const
weight_type | PeekWeight (const unsigned startingIndex=0) const
void | Clear (bool doNotDeallocateSmallBlocks, const char *file, unsigned int line)
data_type & | operator[] (const unsigned int position) const
unsigned | Size (void) const

Protected Member Functions

unsigned | LeftChild (const unsigned i) const
unsigned | RightChild (const unsigned i) const
unsigned | Parent (const unsigned i) const
void | Swap (const unsigned i, const unsigned j)

Protected Attributes

DataStructures::List< HeapNode > heap
bool optimizeNextSeriesPush

Detailed Description

template<class weight_type, class data_type, bool isMaxHeap>
class DataStructures::Heap< weight_type, data_type, isMaxHeap >

Definition at line 40 of file DS_Heap.h.

Constructor & Destructor Documentation

template<class weight_type , class data_type , bool isMaxHeap>
DataStructures::Heap< weight_type, data_type, isMaxHeap >::Heap ( )

Definition at line 75 of file DS_Heap.h.

template<class weight_type , class data_type , bool isMaxHeap>
DataStructures::Heap< weight_type, data_type, isMaxHeap >::~Heap ( )

Definition at line 81 of file DS_Heap.h.

Member Function Documentation

template<class weight_type , class data_type , bool isMaxHeap>
void DataStructures::Heap< weight_type, data_type, isMaxHeap >::Clear | ( | bool | doNotDeallocateSmallBlocks,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 259 of file DS_Heap.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().

template<class weight_type , class data_type , bool isMaxHeap>
unsigned DataStructures::Heap< weight_type, data_type, isMaxHeap >::LeftChild ( const unsigned i ) const
inlineprotected

Definition at line 276 of file DS_Heap.h.

template<class weight_type , class data_type , bool isMaxHeap>
data_type & DataStructures::Heap< weight_type, data_type, isMaxHeap >::operator[] ( const unsigned int position ) const
inline

Definition at line 265 of file DS_Heap.h.

template<class weight_type , class data_type , bool isMaxHeap>
unsigned DataStructures::Heap< weight_type, data_type, isMaxHeap >::Parent ( const unsigned i ) const
inlineprotected

Definition at line 288 of file DS_Heap.h.

References RakAssert.

template<class weight_type , class data_type , bool isMaxHeap>
data_type DataStructures::Heap< weight_type, data_type, isMaxHeap >::Peek ( const unsigned startingIndex = 0 ) const
inline

Definition at line 247 of file DS_Heap.h.

template<class weight_type , class data_type , bool isMaxHeap>
weight_type DataStructures::Heap< weight_type, data_type, isMaxHeap >::PeekWeight ( const unsigned startingIndex = 0 ) const
inline

Definition at line 253 of file DS_Heap.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().

template<class weight_type , class data_type , bool isMaxHeap>
data_type DataStructures::Heap< weight_type, data_type, isMaxHeap >::Pop ( const unsigned startingIndex )

Definition at line 170 of file DS_Heap.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().

template<class weight_type, class data_type, bool isMaxHeap>
void DataStructures::Heap< weight_type, data_type, isMaxHeap >::Push | ( | const weight_type & | weight,
 |  | const data_type & | data,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 135 of file DS_Heap.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().

template<class weight_type, class data_type, bool isMaxHeap>
void DataStructures::Heap< weight_type, data_type, isMaxHeap >::PushSeries | ( | const weight_type & | weight,
 |  | const data_type & | data,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

If you are going to push a list of items, where the weights of the items on the list are in order and follow the heap order, PushSeries is faster than Push()

Definition at line 87 of file DS_Heap.h.

template<class weight_type , class data_type , bool isMaxHeap>
unsigned DataStructures::Heap< weight_type, data_type, isMaxHeap >::RightChild ( const unsigned i ) const
inlineprotected

Definition at line 282 of file DS_Heap.h.

template<class weight_type , class data_type , bool isMaxHeap>
unsigned DataStructures::Heap< weight_type, data_type, isMaxHeap >::Size ( void ) const

Definition at line 270 of file DS_Heap.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().

template<class weight_type, class data_type, bool isMaxHeap>
void DataStructures::Heap< weight_type, data_type, isMaxHeap >::StartSeries ( void )
inline

Call before calling PushSeries, for a new series of items.

Definition at line 55 of file DS_Heap.h.

template<class weight_type , class data_type , bool isMaxHeap>
void DataStructures::Heap< weight_type, data_type, isMaxHeap >::Swap | ( | const unsigned | i,
 |  | const unsigned | j
 | ) |  |
protected

Definition at line 297 of file DS_Heap.h.

Member Data Documentation

template<class weight_type, class data_type, bool isMaxHeap>
DataStructures::List<HeapNode> DataStructures::Heap< weight_type, data_type, isMaxHeap >::heap
protected

Definition at line 70 of file DS_Heap.h.

template<class weight_type, class data_type, bool isMaxHeap>
bool DataStructures::Heap< weight_type, data_type, isMaxHeap >::optimizeNextSeriesPush
protected

Definition at line 71 of file DS_Heap.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_Heap.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Heap
  • HeapNode
Public Member Functions | Public Attributes | List of all members
DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode Struct Reference

#include <slikenet/DS_Heap.h>

Public Member Functions

HeapNode ()
HeapNode (const weight_type &w, const data_type &d)

Public Attributes

weight_type | weight
data_type | data

Detailed Description

template<class weight_type, class data_type, bool isMaxHeap>
struct DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode

Definition at line 43 of file DS_Heap.h.

Constructor & Destructor Documentation

template<class weight_type, class data_type, bool isMaxHeap>
DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode::HeapNode ( )
inline

Definition at line 45 of file DS_Heap.h.

template<class weight_type, class data_type, bool isMaxHeap>
DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode::HeapNode | ( | const weight_type & | w,
 |  | const data_type & | d
 | ) |  |
inline

Definition at line 46 of file DS_Heap.h.

Member Data Documentation

template<class weight_type, class data_type, bool isMaxHeap>
data_type DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode::data

Definition at line 48 of file DS_Heap.h.

template<class weight_type, class data_type, bool isMaxHeap>
weight_type DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode::weight

Definition at line 47 of file DS_Heap.h.

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/DS_Heap.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::CircularLinkedList< CircularLinkedListType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • CircularLinkedList
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataStructures::CircularLinkedList< CircularLinkedListType > Class Template Reference

(Circular) Linked List ADT (Doubly Linked Pointer to Node Style) - More...

#include <slikenet/DS_LinkedList.h>

+ Inheritance diagram for DataStructures::CircularLinkedList< CircularLinkedListType >:

Classes

struct node

Public Member Functions

CircularLinkedList ()
~CircularLinkedList ()
CircularLinkedList (const CircularLinkedList &original_copy)
bool | operator= (const CircularLinkedList &original_copy)
CircularLinkedList & operator++ ()
CircularLinkedList & | operator++ (int)
CircularLinkedList & operator-- ()
CircularLinkedList & | operator-- (int)
bool | IsIn (const CircularLinkedListType &input)
bool | Find (const CircularLinkedListType &input)
void | Insert (const CircularLinkedListType &input)
CircularLinkedListType & | Add (const CircularLinkedListType &input)
void | Replace (const CircularLinkedListType &input)
void | Del (void)
unsigned int | Size (void)
CircularLinkedListType & | Peek (void)
CircularLinkedListType | Pop (void)
void | Clear (void)
void | Sort (void)
void | Beginning (void)
void | End (void)
void | Concatenate (const CircularLinkedList &L)

Protected Member Functions

node * FindPointer (const CircularLinkedListType &input)

Protected Attributes

unsigned int list_size
node * root
node * position

Detailed Description

template<class CircularLinkedListType>
class DataStructures::CircularLinkedList< CircularLinkedListType >

(Circular) Linked List ADT (Doubly Linked Pointer to Node Style) -

Initilize with the following command LinkedList<TYPE> OR CircularLinkedList<Type>

Has the following member functions

  • size: returns number of elements in the linked list
  • insert(item): inserts item at the current position in the LinkedList.
  • add(item): inserts item after the current position in the LinkedList. Does not increment the position
  • replace(item): replaces the element at the current position item.
  • peek: returns the element at the current position
  • pop: returns the element at the current position and deletes it
  • del: deletes the current element. Does nothing for an empty list.
  • clear: empties the LinkedList and returns storage
  • bool IsInitem): Does a linear search for item. Does not set the position to it, only returns true on item found, false otherwise
  • bool find(item): Does a linear search for item and sets the current position to point to it if and only if the item is found. Returns true on item found, false otherwise
  • sort: Sorts the elements of the list with a mergesort and sets the current pointer to the first element
  • concatenate(list L): This appends L to the current list
  • ++(prefix): moves the pointer one element up in the list and returns the appropriate copy of the element in the list
  • –(prefix): moves the pointer one element back in the list and returns the appropriate copy of the element in the list
  • beginning - moves the pointer to the start of the list. For circular linked lists this is first 'position' created. You should call this after the sort function to read the first value.
  • end - moves the pointer to the end of the list. For circular linked lists this is one less than the first 'position' created The assignment and copy constructor operators are defined
Note
  1. LinkedList and CircularLinkedList are exactly the same except LinkedList won't let you wrap around the root and lets you jump to two positions relative to the root/
  2. Postfix ++ and – can be used but simply call the prefix versions.

EXAMPLE:

LinkedList<int> A; // Creates a Linked List of integers called A
CircularLinkedList<int> B; // Creates a Circular Linked List of
// integers called B
A.Insert(20); // Adds 20 to A. A: 20 - current is 20
A.Insert(5); // Adds 5 to A. A: 5 20 - current is 5
A.Insert(1); // Adds 1 to A. A: 1 5 20 - current is 1
A.IsIn1); // returns true
A.IsIn200); // returns false
A.Find(5); // returns true and sets current to 5
A.Peek(); // returns 5
A.Find(1); // returns true and sets current to 1
(++A).Peek(); // Returns 5
A.Peek(); // Returns 5
A.Replace(10); // Replaces 5 with 10.
A.Peek(); // Returns 10
A.Beginning(); // Current points to the beginning of the list at 1
(++A).Peek(); // Returns 5
A.Peek(); // Returns 10
A.Del(); // Deletes 10. Current points to the next element, which is 20
A.Peek(); // Returns 20
A.Beginning(); // Current points to the beginning of the list at 1
(++A).Peek(); // Returns 5
A.Peek(); // Returns 20
A.Clear(_FILE_AND_LINE_); // Deletes all nodes in A
A.Insert(5); // A: 5 - current is 5
A.Insert(6); // A: 6 5 - current is 6
A.Insert(7); // A: 7 6 5 - current is 7
A.Clear(_FILE_AND_LINE_);
B.Clear(_FILE_AND_LINE_);
B.Add(10);
B.Add(20);
B.Add(30);
B.Add(5);
B.Add(2);
B.Add(25);
// Sorts the numbers in the list and sets the current pointer to the
// first element
B.sort();
// Postfix ++ just calls the prefix version and has no functional
// difference.
B.Peek(); // Returns 2
B++;
B.Peek(); // Returns 5
B++;
B.Peek(); // Returns 10
B++;
B.Peek(); // Returns 20
B++;
B.Peek(); // Returns 25
B++;
B.Peek(); // Returns 30

Definition at line 153 of file DS_LinkedList.h.

Class Documentation

struct DataStructures::CircularLinkedList::node

template<class CircularLinkedListType>
struct DataStructures::CircularLinkedList< CircularLinkedListType >::node

Definition at line 158 of file DS_LinkedList.h.

Class Members
CircularLinkedListType | item
node * | next
node * | previous

Constructor & Destructor Documentation

template<class CircularLinkedListType >
DataStructures::CircularLinkedList< CircularLinkedListType >::CircularLinkedList ( )

Definition at line 347 of file DS_LinkedList.h.

template<class CircularLinkedListType >
DataStructures::CircularLinkedList< CircularLinkedListType >::~CircularLinkedList ( )

Definition at line 355 of file DS_LinkedList.h.

template<class CircularLinkedListType >
DataStructures::CircularLinkedList< CircularLinkedListType >::CircularLinkedList ( const CircularLinkedList< CircularLinkedListType > & original_copy )

Definition at line 446 of file DS_LinkedList.h.

References _FILE_AND_LINE_, DataStructures::CircularLinkedList< CircularLinkedListType >::node::item, DataStructures::CircularLinkedList< CircularLinkedListType >::list_size, DataStructures::CircularLinkedList< CircularLinkedListType >::node::next, DataStructures::CircularLinkedList< CircularLinkedListType >::position, DataStructures::CircularLinkedList< CircularLinkedListType >::node::previous, return, and DataStructures::CircularLinkedList< CircularLinkedListType >::root.

Member Function Documentation

template<class CircularLinkedListType>
CircularLinkedListType & DataStructures::CircularLinkedList< CircularLinkedListType >::Add ( const CircularLinkedListType & input )

Definition at line 695 of file DS_LinkedList.h.

References _FILE_AND_LINE_, DataStructures::CircularLinkedList< CircularLinkedListType >::node::item, DataStructures::CircularLinkedList< CircularLinkedListType >::node::next, and DataStructures::CircularLinkedList< CircularLinkedListType >::node::previous.

template<class CircularLinkedListType >
void DataStructures::CircularLinkedList< CircularLinkedListType >::Beginning ( void )
inline

Definition at line 242 of file DS_LinkedList.h.

template<class CircularLinkedListType >
void DataStructures::CircularLinkedList< CircularLinkedListType >::Clear ( void )

Definition at line 953 of file DS_LinkedList.h.

References _FILE_AND_LINE_, DataStructures::CircularLinkedList< CircularLinkedListType >::node::next, SLNet::OP_DELETE(), and return.

template<class CircularLinkedListType >
void DataStructures::CircularLinkedList< CircularLinkedListType >::Concatenate ( const CircularLinkedList< CircularLinkedListType > & L )
inline

Definition at line 987 of file DS_LinkedList.h.

References DataStructures::CircularLinkedList< CircularLinkedListType >::node::item, DataStructures::CircularLinkedList< CircularLinkedListType >::list_size, DataStructures::CircularLinkedList< CircularLinkedListType >::node::next, return, and DataStructures::CircularLinkedList< CircularLinkedListType >::root.

template<class CircularLinkedListType >
void DataStructures::CircularLinkedList< CircularLinkedListType >::Del ( void )

Definition at line 779 of file DS_LinkedList.h.

References _FILE_AND_LINE_, DataStructures::CircularLinkedList< CircularLinkedListType >::node::next, SLNet::OP_DELETE(), and return.

template<class CircularLinkedListType >
void DataStructures::CircularLinkedList< CircularLinkedListType >::End ( void )
inline

Definition at line 249 of file DS_LinkedList.h.

template<class CircularLinkedListType>
bool DataStructures::CircularLinkedList< CircularLinkedListType >::Find ( const CircularLinkedListType & input )

Definition at line 830 of file DS_LinkedList.h.

template<class CircularLinkedListType>
CircularLinkedList< CircularLinkedListType >::node * DataStructures::CircularLinkedList< CircularLinkedListType >::FindPointer ( const CircularLinkedListType & input )
protected

Definition at line 847 of file DS_LinkedList.h.

References DataStructures::CircularLinkedList< CircularLinkedListType >::node::item, and DataStructures::CircularLinkedList< CircularLinkedListType >::node::next.

template<class CircularLinkedListType>
void DataStructures::CircularLinkedList< CircularLinkedListType >::Insert ( const CircularLinkedListType & input )

Definition at line 618 of file DS_LinkedList.h.

References _FILE_AND_LINE_, DataStructures::CircularLinkedList< CircularLinkedListType >::node::item, DataStructures::CircularLinkedList< CircularLinkedListType >::node::next, and DataStructures::CircularLinkedList< CircularLinkedListType >::node::previous.

template<class CircularLinkedListType>
bool DataStructures::CircularLinkedList< CircularLinkedListType >::IsIn ( const CircularLinkedListType & input )

Definition at line 814 of file DS_LinkedList.h.

template<class CircularLinkedListType >
CircularLinkedList< CircularLinkedListType > & DataStructures::CircularLinkedList< CircularLinkedListType >::operator++ ( )

Definition at line 898 of file DS_LinkedList.h.

template<class CircularLinkedListType >
CircularLinkedList< CircularLinkedListType > & DataStructures::CircularLinkedList< CircularLinkedListType >::operator++ ( int )

Definition at line 919 of file DS_LinkedList.h.

template<class CircularLinkedListType >
CircularLinkedList< CircularLinkedListType > & DataStructures::CircularLinkedList< CircularLinkedListType >::operator-- ( )

Definition at line 926 of file DS_LinkedList.h.

template<class CircularLinkedListType >
CircularLinkedList< CircularLinkedListType > & DataStructures::CircularLinkedList< CircularLinkedListType >::operator-- ( int )

Definition at line 947 of file DS_LinkedList.h.

template<class CircularLinkedListType >
bool DataStructures::CircularLinkedList< CircularLinkedListType >::operator= ( const CircularLinkedList< CircularLinkedListType > & original_copy )

Definition at line 529 of file DS_LinkedList.h.

References _FILE_AND_LINE_, DataStructures::CircularLinkedList< CircularLinkedListType >::node::item, DataStructures::CircularLinkedList< CircularLinkedListType >::list_size, DataStructures::CircularLinkedList< CircularLinkedListType >::node::next, DataStructures::CircularLinkedList< CircularLinkedListType >::position, DataStructures::CircularLinkedList< CircularLinkedListType >::node::previous, and DataStructures::CircularLinkedList< CircularLinkedListType >::root.

template<class CircularLinkedListType >
CircularLinkedListType & DataStructures::CircularLinkedList< CircularLinkedListType >::Peek ( void )
inline

Definition at line 881 of file DS_LinkedList.h.

template<class CircularLinkedListType >
CircularLinkedListType DataStructures::CircularLinkedList< CircularLinkedListType >::Pop ( void )

Definition at line 888 of file DS_LinkedList.h.

template<class CircularLinkedListType>
void DataStructures::CircularLinkedList< CircularLinkedListType >::Replace ( const CircularLinkedListType & input )
inline

Definition at line 771 of file DS_LinkedList.h.

template<class CircularLinkedListType >
unsigned int DataStructures::CircularLinkedList< CircularLinkedListType >::Size ( void )
inline

Definition at line 875 of file DS_LinkedList.h.

template<class CircularLinkedListType >
void DataStructures::CircularLinkedList< CircularLinkedListType >::Sort ( void )
inline

Definition at line 1018 of file DS_LinkedList.h.

References return.

Member Data Documentation

template<class CircularLinkedListType>
unsigned int DataStructures::CircularLinkedList< CircularLinkedListType >::list_size
protected

Definition at line 203 of file DS_LinkedList.h.

Referenced by DataStructures::CircularLinkedList< CircularLinkedListType >::CircularLinkedList(), DataStructures::CircularLinkedList< CircularLinkedListType >::Concatenate(), DataStructures::LinkedList< LinkedListType >::LinkedList(), and DataStructures::CircularLinkedList< CircularLinkedListType >::operator=().

template<class CircularLinkedListType>
node* DataStructures::CircularLinkedList< CircularLinkedListType >::position
protected

Definition at line 207 of file DS_LinkedList.h.

Referenced by DataStructures::CircularLinkedList< CircularLinkedListType >::CircularLinkedList(), DataStructures::LinkedList< LinkedListType >::LinkedList(), and DataStructures::CircularLinkedList< CircularLinkedListType >::operator=().

template<class CircularLinkedListType>
node* DataStructures::CircularLinkedList< CircularLinkedListType >::root
protected

Definition at line 205 of file DS_LinkedList.h.

Referenced by DataStructures::CircularLinkedList< CircularLinkedListType >::CircularLinkedList(), DataStructures::CircularLinkedList< CircularLinkedListType >::Concatenate(), DataStructures::LinkedList< LinkedListType >::LinkedList(), and DataStructures::CircularLinkedList< CircularLinkedListType >::operator=().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_LinkedList.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::LinkedList< LinkedListType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • LinkedList
Public Member Functions | List of all members
DataStructures::LinkedList< LinkedListType > Class Template Reference

#include <slikenet/DS_LinkedList.h>

+ Inheritance diagram for DataStructures::LinkedList< LinkedListType >:

Public Member Functions

LinkedList ()
LinkedList (const LinkedList &original_copy)
~LinkedList ()
bool | operator= (const LinkedList< LinkedListType > &original_copy)
LinkedList & operator++ ()
LinkedList & | operator++ (int)
LinkedList & operator-- ()
LinkedList & | operator-- (int)
- Public Member Functions inherited from DataStructures::CircularLinkedList< LinkedListType >
CircularLinkedList ()
CircularLinkedList (const CircularLinkedList &original_copy)
~CircularLinkedList ()
bool | operator= (const CircularLinkedList &original_copy)
CircularLinkedList & operator++ ()
CircularLinkedList & | operator++ (int)
CircularLinkedList & operator-- ()
CircularLinkedList & | operator-- (int)
bool | IsIn (const LinkedListType &input)
bool | Find (const LinkedListType &input)
void | Insert (const LinkedListType &input)
LinkedListType & | Add (const LinkedListType &input)
void | Replace (const LinkedListType &input)
void | Del (void)
unsigned int | Size (void)
LinkedListType & | Peek (void)
LinkedListType | Pop (void)
void | Clear (void)
void | Sort (void)
void | Beginning (void)
void | End (void)
void | Concatenate (const CircularLinkedList &L)

Additional Inherited Members

- Protected Member Functions inherited from DataStructures::CircularLinkedList< LinkedListType >
node * | FindPointer (const LinkedListType &input)
- Protected Attributes inherited from DataStructures::CircularLinkedList< LinkedListType >
unsigned int | list_size
node * | root
node * | position

Detailed Description

template<class LinkedListType>
class DataStructures::LinkedList< LinkedListType >

Definition at line 219 of file DS_LinkedList.h.

Constructor & Destructor Documentation

template<class LinkedListType>
DataStructures::LinkedList< LinkedListType >::LinkedList ( )
inline

Definition at line 223 of file DS_LinkedList.h.

template<class LinkedListType >
DataStructures::LinkedList< LinkedListType >::LinkedList ( const LinkedList< LinkedListType > & original_copy )

Definition at line 367 of file DS_LinkedList.h.

References _FILE_AND_LINE_, DataStructures::CircularLinkedList< CircularLinkedListType >::list_size, DataStructures::CircularLinkedList< CircularLinkedListType >::position, return, and DataStructures::CircularLinkedList< CircularLinkedListType >::root.

template<class LinkedListType >
DataStructures::LinkedList< LinkedListType >::~LinkedList ( )

Definition at line 361 of file DS_LinkedList.h.

Member Function Documentation

template<class LinkedListType >
LinkedList< LinkedListType > & DataStructures::LinkedList< LinkedListType >::operator++ ( )

Definition at line 1192 of file DS_LinkedList.h.

template<class LinkedListType >
LinkedList< LinkedListType > & DataStructures::LinkedList< LinkedListType >::operator++ ( int )

Definition at line 1213 of file DS_LinkedList.h.

template<class LinkedListType >
LinkedList< LinkedListType > & DataStructures::LinkedList< LinkedListType >::operator-- ( )

Definition at line 1220 of file DS_LinkedList.h.

template<class LinkedListType >
LinkedList< LinkedListType > & DataStructures::LinkedList< LinkedListType >::operator-- ( int )

Definition at line 1242 of file DS_LinkedList.h.

template<class LinkedListType>
bool DataStructures::LinkedList< LinkedListType >::operator= ( const LinkedList< LinkedListType > & original_copy )

Definition at line 256 of file DS_LinkedList.h.

References _FILE_AND_LINE_, DataStructures::CircularLinkedList< LinkedListType >::list_size, DataStructures::CircularLinkedList< LinkedListType >::position, and DataStructures::CircularLinkedList< LinkedListType >::root.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_LinkedList.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::List< list_type > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • List
Public Member Functions | List of all members
DataStructures::List< list_type > Class Template Reference

Array based implementation of a list. More...

#include <slikenet/DS_List.h>

Public Member Functions

List ()
Default constructor.
~List ()
List (const List &original_copy)
Copy constructor.
List & | operator= (const List &original_copy)
Assign one list to another.
list_type & | operator[] (const unsigned int position) const
Access an element by its index in the array.
list_type & | Get (const unsigned int position) const
Access an element by its index in the array.
void | Push (const list_type &input, const char *file, unsigned int line)
Push an element at the end of the stack.
list_type & | Pop (void)
Pop an element from the end of the stack.
void | Insert (const list_type &input, const unsigned int position, const char *file, unsigned int line)
Insert an element at position position in the list.
void | Insert (const list_type &input, const char *file, unsigned int line)
Insert at the end of the list.
void | Replace (const list_type &input, const list_type filler, const unsigned int position, const char *file, unsigned int line)
Replace the value at position by input.
void | Replace (const list_type &input)
Replace the last element of the list by input.
void | RemoveAtIndex (const unsigned int position)
Delete the element at position position.
void | RemoveAtIndexFast (const unsigned int position)
Delete the element at position position.
void | RemoveFromEnd (const unsigned num=1)
Delete the element at the end of the list.
unsigned int | GetIndexOf (const list_type &input) const
Returns the index of the specified item or MAX_UNSIGNED_LONG if not found.
unsigned int | Size (void) const
void | Clear (bool doNotDeallocateSmallBlocks, const char *file, unsigned int line)
Clear the list.
void | Preallocate (unsigned countNeeded, const char *file, unsigned int line)
Preallocate the list, so it needs fewer reallocations at runtime.
void | Compress (const char *file, unsigned int line)
Frees overallocated members, to use the minimum memory necessary.

Detailed Description

template<class list_type>
class DataStructures::List< list_type >

Array based implementation of a list.

Note
ONLY USE THIS FOR SHALLOW COPIES. I don't bother with operator= to improve performance.

Definition at line 41 of file DS_List.h.

Constructor & Destructor Documentation

template<class list_type >
DataStructures::List< list_type >::List ( )

Default constructor.

Definition at line 141 of file DS_List.h.

template<class list_type >
DataStructures::List< list_type >::~List ( )

Definition at line 149 of file DS_List.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE_ARRAY().

template<class list_type >
DataStructures::List< list_type >::List ( const List< list_type > & original_copy )

Copy constructor.

Parameters
[in] original_copy The list to duplicate

Definition at line 157 of file DS_List.h.

References _FILE_AND_LINE_.

Member Function Documentation

template<class list_type >
void DataStructures::List< list_type >::Clear | ( | bool | doNotDeallocateSmallBlocks,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Clear the list.

Definition at line 456 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY().

Referenced by DataStructures::Table::Clear(), SLNet::RakPeer::ClearBanList(), SLNet::RakPeer::DerefAllSockets(), SLNet::RakString::FreeMemoryNoMutex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetAsList(), GridSectorizer::GetEntries(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), SLNet::RakPeer::GetStatisticsList(), SLNet::RakPeer::GetSystemList(), VariadicSQLParser::GetTypeMappingIndices(), SLNet::RakPeer::ReleaseSockets(), SLNet::RakPeer::RemoveFromSecurityExceptionList(), SLNet::VariableDeltaSerializer::RemoveRemoteSystemVariableHistory(), and SLNet::RakPeer::RunUpdateCycle().

template<class list_type >
void DataStructures::List< list_type >::Compress | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Frees overallocated members, to use the minimum memory necessary.

Attention
This is a slow operation

Definition at line 471 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY(), and return.

template<class list_type >
list_type & DataStructures::List< list_type >::Get ( const unsigned int position ) const
inline

Access an element by its index in the array.

Parameters
[in] position The index into the array.
Returns
The element at position position.

Definition at line 226 of file DS_List.h.

Referenced by DataStructures::Table::GetCellValueByIndex().

template<class list_type>
unsigned int DataStructures::List< list_type >::GetIndexOf ( const list_type & input ) const

Returns the index of the specified item or MAX_UNSIGNED_LONG if not found.

Parameters
[in] input The element to check for
Returns
The index or position of input in the list.
Return values
MAX_UNSIGNED_LONG | The object is not in the list
[Integer] | The index of the element in the list

Definition at line 440 of file DS_List.h.

References MAX_UNSIGNED_LONG.

Referenced by SLNet::RakPeer::AttachPlugin(), SLNet::RakPeer::DetachPlugin(), SLNet::TableSerializer::SerializeColumns(), and SLNet::TableSerializer::SerializeRow().

template<class list_type>
void DataStructures::List< list_type >::Insert | ( | const list_type & | input,
 |  | const unsigned int | position,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Insert an element at position position in the list.

Parameters
[in] | input | The new element.
[in] | position | The position of the new element.

Definition at line 248 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY(), and RakAssert.

Referenced by DataStructures::Table::AddColumn(), GridSectorizer::AddEntry(), DataStructures::Table::AddRow(), DataStructures::Table::AddRowColumns(), SLNet::RakPeer::AddToBanList(), SLNet::RakPeer::AddToSecurityExceptionList(), SLNet::RakString::Allocate(), SLNet::RakPeer::AttachPlugin(), ExtendRows(), SLNet::RakString::Free(), GridSectorizer::GetEntries(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), VariadicSQLParser::GetTypeMappingIndices(), DataStructures::Tree< TreeType >::LevelOrderTraversal(), operator+(), DataStructures::Table::QueryTable(), and DataStructures::Table::SortTable().

template<class list_type>
void DataStructures::List< list_type >::Insert | ( | const list_type & | input,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Insert at the end of the list.

Parameters
[in] input The new element.

Definition at line 299 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY().

template<class list_type >
List< list_type > & DataStructures::List< list_type >::operator= ( const List< list_type > & original_copy )

Assign one list to another.

Definition at line 181 of file DS_List.h.

References _FILE_AND_LINE_.

template<class list_type >
list_type & DataStructures::List< list_type >::operator[] ( const unsigned int position ) const
inline

Access an element by its index in the array.

Parameters
[in] position The index into the array.
Returns
The element at position position.

Definition at line 213 of file DS_List.h.

References RakAssert.

template<class list_type >
list_type & DataStructures::List< list_type >::Pop ( void )
inline

Pop an element from the end of the stack.

Precondition
Size()>0
Returns
The element at the end.

Definition at line 238 of file DS_List.h.

References RakAssert.

template<class list_type >
void DataStructures::List< list_type >::Preallocate | ( | unsigned | countNeeded,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Preallocate the list, so it needs fewer reallocations at runtime.

Definition at line 494 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY().

template<class list_type>
void DataStructures::List< list_type >::Push | ( | const list_type & | input,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Push an element at the end of the stack.

Parameters
[in] input The new element.

Definition at line 232 of file DS_List.h.

Referenced by DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetAsList(), SLNet::RakPeer::GetStatisticsList(), SLNet::RakPeer::GetSystemList(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::Startup(), SLNet::VariableDeltaSerializer::StartVariableHistoryWrite(), and SLNet::VariableListDeltaTracker::WriteVar().

template<class list_type >
void DataStructures::List< list_type >::RemoveAtIndex ( const unsigned int position )

Delete the element at position position.

Parameters
[in] position The index of the element to delete

Definition at line 393 of file DS_List.h.

References RakAssert.

Referenced by SLNet::RakString::Allocate(), SLNet::RakPeer::IsBanned(), operator+(), DataStructures::Table::RemoveColumn(), SLNet::RakPeer::RemoveFromBanList(), and SLNet::RakPeer::RemoveFromSecurityExceptionList().

template<class list_type >
void DataStructures::List< list_type >::RemoveAtIndexFast ( const unsigned int position )

Delete the element at position position.

Note
- swaps middle with end of list, only use if list order does not matter
Parameters
[in] position The index of the element to delete

Definition at line 416 of file DS_List.h.

References RakAssert.

Referenced by SLNet::VariableDeltaSerializer::RemoveRemoteSystemVariableHistory().

template<class list_type >
void DataStructures::List< list_type >::RemoveFromEnd ( const unsigned num = 1 )
inline

Delete the element at the end of the list.

Definition at line 430 of file DS_List.h.

References RakAssert.

Referenced by SLNet::RakPeer::DetachPlugin().

template<class list_type>
void DataStructures::List< list_type >::Replace | ( | const list_type & | input,
 |  | const list_type | filler,
 |  | const unsigned int | position,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
inline

Replace the value at position by input.

If the size of the list is less than position, it increase the capacity of the list and fill slot with filler.

Parameters
[in] | input | The element to replace at position position.
[in] | filler | The element use to fill new allocated capacity.
[in] | position | The position of input in the list.

Definition at line 338 of file DS_List.h.

References SLNet::OP_DELETE_ARRAY(), and RakAssert.

template<class list_type>
void DataStructures::List< list_type >::Replace ( const list_type & input )
inline

Replace the last element of the list by input.

Parameters
[in] input The element used to replace the last element.

Definition at line 386 of file DS_List.h.

template<class list_type >
unsigned int DataStructures::List< list_type >::Size ( void ) const
inline
Returns
The number of elements in the list

Definition at line 450 of file DS_List.h.

Referenced by DataStructures::Table::AddColumn(), DataStructures::Table::AddRow(), DataStructures::Table::AddRowColumns(), SLNet::RakPeer::AddToBanList(), SLNet::RakString::Allocate(), SLNet::RakPeer::CallPluginCallbacks(), SLNet::RakPeer::ClearBanList(), DataStructures::Table::ColumnIndex(), DataStructures::Table::ColumnName(), SLNet::RakPeer::Connect(), DataStructures::Table::DeleteRow(), SLNet::RakPeer::DerefAllSockets(), SLNet::RakPeer::DetachPlugin(), VariadicSQLParser::ExtractArguments(), SLNet::VariableListDeltaTracker::FlagDirtyFromBitArray(), VariadicSQLParser::FreeArguments(), SLNet::RakString::FreeMemoryNoMutex(), FreeRow(), DataStructures::Table::GetColumnCount(), DataStructures::Table::GetColumnType(), SLNet::RakPeer::GetConnectionList(), GridSectorizer::GetEntries(), SLNet::RakPeer::GetMyBoundAddress(), SLNet::RakPeer::GetRakNetSocketFromUserConnectionSocketIndex(), SLNet::VariableDeltaSerializer::GetRemoteSystemHistoryListIndex(), SLNet::RakPeer::GetSocket(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), SLNet::VariableDeltaSerializer::GetVarsWrittenPerRemoteSystemListIndex(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::RakPeer::IsBanned(), SLNet::RakPeer::IsInSecurityExceptionList(), SLNet::VariableListDeltaTracker::IsPastEndOfList(), DataStructures::Tree< TreeType >::LevelOrderTraversal(), SLNet::RakPeer::NumberOfConnections(), operator+(), SLNet::RakPeer::Ping(), DataStructures::Table::PrintColumnHeaders(), DataStructures::Table::PrintRow(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::PushBackPacket(), DataStructures::Table::QueryRow(), DataStructures::Table::QueryTable(), SLNet::RakPeer::Receive(), DataStructures::Table::RemoveColumn(), SLNet::RakPeer::RemoveFromBanList(), SLNet::RakPeer::RemoveFromSecurityExceptionList(), SLNet::VariableDeltaSerializer::RemoveRemoteSystemVariableHistory(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendOutOfBand(), SLNet::RakPeer::SendTTL(), SLNet::TableSerializer::SerializeColumns(), SLNet::TableSerializer::SerializeRow(), SLNet::RakPeer::Shutdown(), DataStructures::Table::SortTable(), SLNet::RakPeer::Startup(), SLNet::ReliabilityLayer::Update(), SLNet::VariableListDeltaTracker::WriteVar(), and SLNet::VariableListDeltaTracker::~VariableListDeltaTracker().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_List.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Map< key_type, data_type, key_comparison_func > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Map
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataStructures::Map< key_type, data_type, key_comparison_func > Class Template Reference

#include <slikenet/DS_Map.h>

+ Inheritance diagram for DataStructures::Map< key_type, data_type, key_comparison_func >:

Classes

struct MapNode

Public Member Functions

Map ()
~Map ()
Map (const Map &original_copy)
Map & | operator= (const Map &original_copy)
data_type & | Get (const key_type &key) const
data_type | Pop (const key_type &key)
void | Set (const key_type &key, const data_type &data)
void | SetExisting (const key_type &key, const data_type &data)
void | SetNew (const key_type &key, const data_type &data)
bool | Has (const key_type &key) const
bool | Delete (const key_type &key)
data_type & | operator[] (const unsigned int position) const
key_type | GetKeyAtIndex (const unsigned int position) const
unsigned | GetIndexAtKey (const key_type &key)
void | RemoveAtIndex (const unsigned index)
void | Clear (void)
unsigned | Size (void) const

Static Public Member Functions

static void | IMPLEMENT_DEFAULT_COMPARISON (void)
static int | NodeComparisonFunc (const key_type &a, const MapNode &b)

Protected Member Functions

void | SaveLastSearch (const key_type &key, unsigned index) const
bool | HasSavedSearchResult (const key_type &key) const

Protected Attributes

DataStructures::OrderedList
< key_type, MapNode,&Map::NodeComparisonFunc > 		mapNodeList
unsigned | lastSearchIndex
key_type | lastSearchKey
bool | lastSearchIndexValid

Detailed Description

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
class DataStructures::Map< key_type, data_type, key_comparison_func >

Note
IMPORTANT! If you use defaultMapKeyComparison then call IMPLEMENT_DEFAULT_COMPARISON or you will get an unresolved external linker error.

Definition at line 47 of file DS_Map.h.

Constructor & Destructor Documentation

template<class key_type , class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
DataStructures::Map< key_type, data_type, key_comparison_func >::Map ( )

Definition at line 102 of file DS_Map.h.

template<class key_type , class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
DataStructures::Map< key_type, data_type, key_comparison_func >::~Map ( )

Definition at line 108 of file DS_Map.h.

template<class key_type , class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
DataStructures::Map< key_type, data_type, key_comparison_func >::Map ( const Map< key_type, data_type, key_comparison_func > & original_copy )

Definition at line 114 of file DS_Map.h.

References DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndex, DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndexValid, DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchKey, and DataStructures::Map< key_type, data_type, key_comparison_func >::mapNodeList.

Member Function Documentation

template<class key_type , class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
void DataStructures::Map< key_type, data_type, key_comparison_func >::Clear ( void )

Definition at line 282 of file DS_Map.h.

References _FILE_AND_LINE_.

template<class key_type, class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
bool DataStructures::Map< key_type, data_type, key_comparison_func >::Delete ( const key_type & key )

Definition at line 259 of file DS_Map.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().

template<class key_type, class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
data_type & DataStructures::Map< key_type, data_type, key_comparison_func >::Get ( const key_type & key ) const

Definition at line 133 of file DS_Map.h.

References RakAssert.

Referenced by SLNet::StringCompressor::DecodeString(), SLNet::StringCompressor::EncodeString(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix(), SLNet::StringCompressor::GenerateTreeFromStrings(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().

template<class key_type, class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
unsigned DataStructures::Map< key_type, data_type, key_comparison_func >::GetIndexAtKey ( const key_type & key )

Definition at line 147 of file DS_Map.h.

References RakAssert.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix().

template<class key_type , class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
key_type DataStructures::Map< key_type, data_type, key_comparison_func >::GetKeyAtIndex ( const unsigned int position ) const

Definition at line 295 of file DS_Map.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().

template<class key_type, class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
bool DataStructures::Map< key_type, data_type, key_comparison_func >::Has ( const key_type & key ) const

Definition at line 245 of file DS_Map.h.

Referenced by SLNet::StringCompressor::DecodeString(), SLNet::StringCompressor::EncodeString(), SLNet::StringCompressor::GenerateTreeFromStrings(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().

template<class key_type, class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
bool DataStructures::Map< key_type, data_type, key_comparison_func >::HasSavedSearchResult ( const key_type & key ) const
protected

Definition at line 320 of file DS_Map.h.

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
static void DataStructures::Map< key_type, data_type, key_comparison_func >::IMPLEMENT_DEFAULT_COMPARISON ( void )
inlinestatic

Definition at line 50 of file DS_Map.h.

Referenced by SLNet::StringCompressor::StringCompressor().

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
static int DataStructures::Map< key_type, data_type, key_comparison_func >::NodeComparisonFunc | ( | const key_type & | a,
 |  | const MapNode & | b
 | ) |  |
inlinestatic

Definition at line 63 of file DS_Map.h.

template<class key_type , class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
Map< key_type, data_type, key_comparison_func > & DataStructures::Map< key_type, data_type, key_comparison_func >::operator= ( const Map< key_type, data_type, key_comparison_func > & original_copy )

Definition at line 123 of file DS_Map.h.

References DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndex, DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndexValid, DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchKey, and DataStructures::Map< key_type, data_type, key_comparison_func >::mapNodeList.

template<class key_type , class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
data_type & DataStructures::Map< key_type, data_type, key_comparison_func >::operator[] ( const unsigned int position ) const

Definition at line 289 of file DS_Map.h.

template<class key_type, class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
data_type DataStructures::Map< key_type, data_type, key_comparison_func >::Pop ( const key_type & key )

Definition at line 171 of file DS_Map.h.

References RakAssert.

template<class key_type , class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
void DataStructures::Map< key_type, data_type, key_comparison_func >::RemoveAtIndex ( const unsigned index )

Definition at line 164 of file DS_Map.h.

template<class key_type, class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
void DataStructures::Map< key_type, data_type, key_comparison_func >::SaveLastSearch | ( | const key_type & | key,
 |  | unsigned | index
 | ) |  | const
 protected

Definition at line 307 of file DS_Map.h.

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func>
void DataStructures::Map< key_type, data_type, key_comparison_func >::Set | ( | const key_type & | key,
 |  | const data_type & | data
 | ) |  |

Definition at line 189 of file DS_Map.h.

References _FILE_AND_LINE_.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix(), SLNet::StringCompressor::GenerateTreeFromStrings(), and SLNet::StringCompressor::StringCompressor().

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func>
void DataStructures::Map< key_type, data_type, key_comparison_func >::SetExisting | ( | const key_type & | key,
 |  | const data_type & | data
 | ) |  |

Definition at line 214 of file DS_Map.h.

References RakAssert.

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func>
void DataStructures::Map< key_type, data_type, key_comparison_func >::SetNew | ( | const key_type & | key,
 |  | const data_type & | data
 | ) |  |

Definition at line 234 of file DS_Map.h.

References _FILE_AND_LINE_, and RakAssert.

template<class key_type , class data_type , int(*)(const key_type &, const key_type &) key_comparison_func>
unsigned DataStructures::Map< key_type, data_type, key_comparison_func >::Size ( void ) const

Definition at line 301 of file DS_Map.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), and SLNet::StringCompressor::~StringCompressor().

Member Data Documentation

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
unsigned DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndex
protected

Definition at line 96 of file DS_Map.h.

Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::Map(), and DataStructures::Map< key_type, data_type, key_comparison_func >::operator=().

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
bool DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchIndexValid
protected

Definition at line 98 of file DS_Map.h.

Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::Map(), and DataStructures::Map< key_type, data_type, key_comparison_func >::operator=().

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
key_type DataStructures::Map< key_type, data_type, key_comparison_func >::lastSearchKey
protected

Definition at line 97 of file DS_Map.h.

Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::Map(), and DataStructures::Map< key_type, data_type, key_comparison_func >::operator=().

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
DataStructures::OrderedList< key_type,MapNode,&Map::NodeComparisonFunc > DataStructures::Map< key_type, data_type, key_comparison_func >::mapNodeList
protected

Definition at line 91 of file DS_Map.h.

Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::Map(), and DataStructures::Map< key_type, data_type, key_comparison_func >::operator=().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_Map.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Map
  • MapNode
Public Member Functions | Public Attributes | List of all members
DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode Struct Reference

#include <slikenet/DS_Map.h>

Public Member Functions

MapNode ()
MapNode (key_type _key, data_type _data)
MapNode & operator= (const MapNode &input)
MapNode (const MapNode &input)

Public Attributes

key_type | mapNodeKey
data_type | mapNodeData

Detailed Description

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
struct DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode

Definition at line 52 of file DS_Map.h.

Constructor & Destructor Documentation

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::MapNode ( )
inline

Definition at line 54 of file DS_Map.h.

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::MapNode | ( | key_type | _key,
 |  | data_type | _data
 | ) |  |
inline

Definition at line 55 of file DS_Map.h.

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::MapNode ( const MapNode & input )
inline

Definition at line 57 of file DS_Map.h.

References DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::mapNodeData, and DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::mapNodeKey.

Member Function Documentation

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
MapNode& DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::operator= ( const MapNode & input )
inline

Definition at line 56 of file DS_Map.h.

References DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::mapNodeData, and DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::mapNodeKey.

Member Data Documentation

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
data_type DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::mapNodeData

Definition at line 59 of file DS_Map.h.

Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::MapNode(), and DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::operator=().

template<class key_type, class data_type, int(*)(const key_type &, const key_type &) key_comparison_func = defaultMapKeyComparison<key_type>>
key_type DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::mapNodeKey

Definition at line 58 of file DS_Map.h.

Referenced by DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::MapNode(), and DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode::operator=().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/DS_Map.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::MemoryPool< MemoryBlockType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • MemoryPool
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataStructures::MemoryPool< MemoryBlockType > Class Template Reference

#include <slikenet/DS_MemoryPool.h>

+ Inheritance diagram for DataStructures::MemoryPool< MemoryBlockType >:

Classes

struct | MemoryWithPage
struct | Page

Public Member Functions

MemoryPool ()
~MemoryPool ()
void | SetPageSize (int size)
MemoryBlockType * | Allocate (const char *file, unsigned int line)
void | Release (MemoryBlockType *m, const char *file, unsigned int line)
void | Clear (const char *file, unsigned int line)
int | GetAvailablePagesSize (void) const
int | GetUnavailablePagesSize (void) const
int | GetMemoryPoolPageSize (void) const

Protected Member Functions

int | BlocksPerPage (void) const
void | AllocateFirst (void)
bool | InitPage (Page *page, Page *prev, const char *file, unsigned int line)

Protected Attributes

Page * availablePages
Page * unavailablePages
int | availablePagesSize
int | unavailablePagesSize
int | memoryPoolPageSize

Detailed Description

template<class MemoryBlockType>
class DataStructures::MemoryPool< MemoryBlockType >

Very fast memory pool for allocating and deallocating structures that don't have constructors or destructors. Contains a list of pages, each of which has an array of the user structures

Definition at line 42 of file DS_MemoryPool.h.

Class Documentation

struct DataStructures::MemoryPool::MemoryWithPage

template<class MemoryBlockType>
struct DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage

Definition at line 46 of file DS_MemoryPool.h.

Class Members
Page * | parentPage
MemoryBlockType | userMemory
struct DataStructures::MemoryPool::Page

template<class MemoryBlockType>
struct DataStructures::MemoryPool< MemoryBlockType >::Page

Definition at line 51 of file DS_MemoryPool.h.

Class Members
MemoryWithPage ** | availableStack
int | availableStackSize
MemoryWithPage * | block
Page * | next
Page * | prev

Constructor & Destructor Documentation

template<class MemoryBlockType >
DataStructures::MemoryPool< MemoryBlockType >::MemoryPool ( )

Definition at line 83 of file DS_MemoryPool.h.

template<class MemoryBlockType >
DataStructures::MemoryPool< MemoryBlockType >::~MemoryPool ( )

Definition at line 93 of file DS_MemoryPool.h.

References _FILE_AND_LINE_.

Member Function Documentation

template<class MemoryBlockType >
MemoryBlockType * DataStructures::MemoryPool< MemoryBlockType >::Allocate | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 107 of file DS_MemoryPool.h.

References DataStructures::MemoryPool< MemoryBlockType >::Page::availableStack, DataStructures::MemoryPool< MemoryBlockType >::Page::availableStackSize, DataStructures::MemoryPool< MemoryBlockType >::Page::next, DataStructures::Page< KeyType, DataType, order >::next, DataStructures::MemoryPool< MemoryBlockType >::Page::prev, RakAssert, and rakMalloc_Ex.

Referenced by DataStructures::BytePool::Allocate(), SLNet::VariableDeltaSerializer::AllocChangedVariablesList(), SLNet::RakPeer::AllocPacket(), and SLNet::RakPeer::ReferenceRemoteSystem().

template<class MemoryBlockType>
void DataStructures::MemoryPool< MemoryBlockType >::AllocateFirst ( void )
protected
template<class MemoryBlockType >
int DataStructures::MemoryPool< MemoryBlockType >::BlocksPerPage ( void ) const
protected

Definition at line 271 of file DS_MemoryPool.h.

template<class MemoryBlockType >
void DataStructures::MemoryPool< MemoryBlockType >::Clear | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 221 of file DS_MemoryPool.h.

References DataStructures::MemoryPool< MemoryBlockType >::Page::availableStack, DataStructures::MemoryPool< MemoryBlockType >::Page::block, DataStructures::MemoryPool< MemoryBlockType >::Page::next, and rakFree_Ex.

Referenced by DataStructures::BytePool::Clear(), SLNet::RakPeer::ClearRemoteSystemLookup(), and SLNet::RakPeer::Shutdown().

template<class MemoryBlockType>
int DataStructures::MemoryPool< MemoryBlockType >::GetAvailablePagesSize ( void ) const
inline

Definition at line 66 of file DS_MemoryPool.h.

template<class MemoryBlockType>
int DataStructures::MemoryPool< MemoryBlockType >::GetMemoryPoolPageSize ( void ) const
inline

Definition at line 68 of file DS_MemoryPool.h.

template<class MemoryBlockType>
int DataStructures::MemoryPool< MemoryBlockType >::GetUnavailablePagesSize ( void ) const
inline

Definition at line 67 of file DS_MemoryPool.h.

template<class MemoryBlockType >
bool DataStructures::MemoryPool< MemoryBlockType >::InitPage | ( | Page * | page,
 |  | Page * | prev,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
protected

Definition at line 276 of file DS_MemoryPool.h.

References DataStructures::MemoryPool< MemoryBlockType >::Page::availableStack, DataStructures::MemoryPool< MemoryBlockType >::Page::availableStackSize, DataStructures::MemoryPool< MemoryBlockType >::Page::block, DataStructures::MemoryPool< MemoryBlockType >::Page::next, DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage::parentPage, DataStructures::MemoryPool< MemoryBlockType >::Page::prev, rakFree_Ex, and rakMalloc_Ex.

template<class MemoryBlockType>
void DataStructures::MemoryPool< MemoryBlockType >::Release | ( | MemoryBlockType * | m,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 159 of file DS_MemoryPool.h.

References DataStructures::MemoryPool< MemoryBlockType >::Page::availableStack, DataStructures::MemoryPool< MemoryBlockType >::Page::availableStackSize, DataStructures::MemoryPool< MemoryBlockType >::Page::block, DS_MEMORY_POOL_MAX_FREE_PAGES, DataStructures::MemoryPool< MemoryBlockType >::Page::next, DataStructures::Page< KeyType, DataType, order >::next, DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage::parentPage, DataStructures::MemoryPool< MemoryBlockType >::Page::prev, RakAssert, and rakFree_Ex.

Referenced by SLNet::RakPeer::DeallocatePacket(), SLNet::RakPeer::DereferenceRemoteSystem(), SLNet::VariableDeltaSerializer::FreeChangedVariablesList(), and DataStructures::BytePool::Release().

template<class MemoryBlockType >
void DataStructures::MemoryPool< MemoryBlockType >::SetPageSize ( int size )

Definition at line 101 of file DS_MemoryPool.h.

Referenced by DataStructures::BytePool::BytePool(), and DataStructures::BytePool::SetPageSize().

Member Data Documentation

template<class MemoryBlockType>
Page* DataStructures::MemoryPool< MemoryBlockType >::availablePages
protected

Definition at line 77 of file DS_MemoryPool.h.

template<class MemoryBlockType>
int DataStructures::MemoryPool< MemoryBlockType >::availablePagesSize
protected

Definition at line 78 of file DS_MemoryPool.h.

template<class MemoryBlockType>
int DataStructures::MemoryPool< MemoryBlockType >::memoryPoolPageSize
protected

Definition at line 79 of file DS_MemoryPool.h.

template<class MemoryBlockType>
Page * DataStructures::MemoryPool< MemoryBlockType >::unavailablePages
protected

Definition at line 77 of file DS_MemoryPool.h.

template<class MemoryBlockType>
int DataStructures::MemoryPool< MemoryBlockType >::unavailablePagesSize
protected

Definition at line 78 of file DS_MemoryPool.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_MemoryPool.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::MLKeyRef< templateType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • MLKeyRef
Public Member Functions | Protected Attributes | List of all members
DataStructures::MLKeyRef< templateType > Class Template Reference

#include <slikenet/DS_Multilist.h>

Public Member Functions

MLKeyRef (const templateType &input)
const templateType & | Get (void) const
bool | operator< (const templateType &right)
bool | operator> (const templateType &right)
bool | operator== (const templateType &right)

Protected Attributes

const templateType & val

Detailed Description

template<class templateType>
class DataStructures::MLKeyRef< templateType >

The following is invalid. bool operator<( const MyClass *myClass, const int &inputKey ) {return myClass->value < inputKey;} At least one type has to be a reference to a class MLKeyRef is a helper class to turn a native type into a class, so you can compare that native type against a pointer to a different class Used for he Multilist, when _DataType != _KeyType

Definition at line 66 of file DS_Multilist.h.

Constructor & Destructor Documentation

template<class templateType>
DataStructures::MLKeyRef< templateType >::MLKeyRef ( const templateType & input )
inline

Definition at line 69 of file DS_Multilist.h.

Member Function Documentation

template<class templateType>
const templateType& DataStructures::MLKeyRef< templateType >::Get ( void ) const
inline

Definition at line 70 of file DS_Multilist.h.

References DataStructures::MLKeyRef< templateType >::val.

template<class templateType>
bool DataStructures::MLKeyRef< templateType >::operator< ( const templateType & right )
inline

Definition at line 71 of file DS_Multilist.h.

References DataStructures::MLKeyRef< templateType >::val.

template<class templateType>
bool DataStructures::MLKeyRef< templateType >::operator== ( const templateType & right )
inline

Definition at line 73 of file DS_Multilist.h.

References DataStructures::MLKeyRef< templateType >::val.

template<class templateType>
bool DataStructures::MLKeyRef< templateType >::operator> ( const templateType & right )
inline

Definition at line 72 of file DS_Multilist.h.

References DataStructures::MLKeyRef< templateType >::val.

Member Data Documentation

template<class templateType>
const templateType& DataStructures::MLKeyRef< templateType >::val
protected

Definition at line 75 of file DS_Multilist.h.

Referenced by DataStructures::MLKeyRef< templateType >::Get(), DataStructures::MLKeyRef< templateType >::operator<(), DataStructures::MLKeyRef< templateType >::operator==(), and DataStructures::MLKeyRef< templateType >::operator>().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_Multilist.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Multilist
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > Class Template Reference

The multilist, representing an abstract data type that generally holds lists. More...

#include <slikenet/DS_Multilist.h>

Public Member Functions

Multilist ()
~Multilist ()
Multilist (const Multilist &source)
Multilist & | operator= (const Multilist &source)
_DataType & | operator[] (const _IndexType position) const
void | Push (const _DataType &d, const char *file=__FILE__, unsigned int line=__LINE__)
void | Push (const _DataType &d, const _KeyType &key, const char *file=__FILE__, unsigned int line=__LINE__)
_DataType & | Pop (const char *file=__FILE__, unsigned int line=__LINE__)
Gets or removes and gets an element from the list, according to the same rules as Push(). Ordered list is LIFO for the purposes of Pop and Peek.
_DataType & | Peek (void) const
void | PushOpposite (const _DataType &d, const char *file=__FILE__, unsigned int line=__LINE__)
Same as Push(), except FIFO and LIFO are reversed. Ordered list still inserts in order.
void | PushOpposite (const _DataType &d, const _KeyType &key, const char *file=__FILE__, unsigned int line=__LINE__)
_DataType & | PopOpposite (const char *file=__FILE__, unsigned int line=__LINE__)
Same as Pop() and Peek(), except FIFO and LIFO are reversed.
_DataType & | PeekOpposite (void) const
void | InsertAtIndex (const _DataType &d, _IndexType index, const char *file=__FILE__, unsigned int line=__LINE__)
Stack,Queue: Inserts at index indicated, elements are shifted. Ordered list: Inserts, position is ignored.
void | RemoveAtIndex (_IndexType position, const char *file=__FILE__, unsigned int line=__LINE__)
Unordered list, removes at index indicated, swaps last element with that element. Otherwise, array is shifted left to overwrite removed element.
bool | RemoveAtKey (_KeyType key, bool assertIfDoesNotExist, const char *file=__FILE__, unsigned int line=__LINE__)
Find the index of key, and remove at that index.
_IndexType | GetIndexOf (_KeyType key) const
Finds the index of key. Return -1 if the key is not found.
_IndexType | GetInsertionIndex (_KeyType key) const
Returns where in the list we should insert the item, to preserve list order. Returns -1 if the item is already in the list.
_DataType | GetPtr (_KeyType key) const
Finds the index of key. Return 0 if the key is not found. Useful if _DataType is always non-zero pointers.
void | ForEach (void(*func)(_DataType &item, const char *file, unsigned int line), const char *file, unsigned int line)
Iterate over the list, calling the function pointer on each element.
void | ForEach (void(*func)(_DataType &item))
bool | IsEmpty (void) const
Returns if the list is empty.
_IndexType | GetSize (void) const
Returns the number of elements used in the list.
void | Clear (bool deallocateSmallBlocks=true, const char *file=__FILE__, unsigned int line=__LINE__)
Empties the list. The list is not deallocated if it is small, unless deallocateSmallBlocks is true.
void | ClearPointers (bool deallocateSmallBlocks=true, const char *file=__FILE__, unsigned int line=__LINE__)
Empties the list, first calling SLNet::OP_Delete on all items.
void | ClearPointer (_KeyType key, const char *file=__FILE__, unsigned int line=__LINE__)
Empty one item from the list, first calling SLNet::OP_Delete on that item.
void | ReverseList (void)
Reverses the elements in the list, and flips the sort order returned by GetSortOrder() if IsSorted() returns true at the time the function is called.
void | Reallocate (_IndexType size, const char *file=__FILE__, unsigned int line=__LINE__)
Reallocates the list to a larger size. If size is smaller than the value returned by GetSize(), the call does nothing.
void | Sort (bool force)
Sorts the list unless it is an ordered list, in which it does nothing as the list is assumed to already be sorted.
void | TagSorted (void)
Sets the list to be remembered as sorted.
void | SetSortOrder (bool ascending)
Defaults to ascending.
bool | GetSortOrder (void) const
Returns true if ascending.
bool | IsSorted (void) const
Returns true if the list is currently believed to be in a sorted state.
MultilistType | GetMultilistType (void) const
Returns what type of list this is.
void | SetMultilistType (MultilistType newType)
Changes what type of list this is.

Static Public Member Functions

static void FindIntersection (Multilist &source1, Multilist &source2, Multilist &intersection, Multilist &uniqueToSource1, Multilist &uniqueToSource2)
Returns the intersection of two lists. Intersection is items common to both lists.

Protected Types

enum { ML_UNSORTED, ML_SORTED_ASCENDING, ML_SORTED_DESCENDING }

Protected Member Functions

void | ReallocateIfNeeded (const char *file, unsigned int line)
void | DeallocateIfNeeded (const char *file, unsigned int line)
void | ReallocToSize (_IndexType newAllocationSize, const char *file, unsigned int line)
void | ReverseListInternal (void)
void | InsertInOrderedList (const _DataType &d, const _KeyType &key)
_IndexType | GetIndexFromKeyInSortedList (const _KeyType &key, bool *objectExists) const
void | InsertShiftArrayRight (const _DataType &d, _IndexType index)
void | DeleteShiftArrayLeft (_IndexType index)
void | QSortAscending (_IndexType left, _IndexType right)
void | QSortDescending (_IndexType left, _IndexType right)
void | CopySource (const Multilist &source)

Protected Attributes

_DataType * | data
An array of user values.
_IndexType | dataSize
Number of elements in the list.
_IndexType | allocationSize
Size of array.
_IndexType | queueHead
Array index for the head of the queue.
_IndexType | queueTail
Array index for the tail of the queue.
_IndexType | preallocationSize
enum
DataStructures::Multilist:: { ... } 		sortState
bool | ascendingSort
MultilistType variableMultilistType

Detailed Description

template<const MultilistType _MultilistType, class _DataType, class _KeyType = _DataType, class _IndexType = DefaultIndexType>
class DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >

The multilist, representing an abstract data type that generally holds lists.

Parameters
[in] _MultilistType What type of list this is,
See Also
MultilistType
Parameters
[in] | _DataType | What type of data this list holds.
[in] | _KeyType | If a function takes a key to sort on, what type of key this is. The comparison operator between _DataType and _KeyType must be defined
[in] | _IndexType | What variable type to use for indices

Definition at line 99 of file DS_Multilist.h.

Member Enumeration Documentation

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>
anonymous enum
protected
Enumerator:
ML_UNSORTED
ML_SORTED_ASCENDING
ML_SORTED_DESCENDING

Definition at line 249 of file DS_Multilist.h.

Constructor & Destructor Documentation

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Multilist ( )

Definition at line 263 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_UNORDERED_LIST, and ML_VARIABLE_DURING_RUNTIME.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::~Multilist ( )

Definition at line 287 of file DS_Multilist.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE_ARRAY().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Multilist ( const Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & source )

Definition at line 294 of file DS_Multilist.h.

Member Function Documentation

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Clear | ( | bool | deallocateSmallBlocks = true,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Empties the list. The list is not deallocated if it is small, unless deallocateSmallBlocks is true.

Definition at line 784 of file DS_Multilist.h.

References ML_ORDERED_LIST, and SLNet::OP_DELETE_ARRAY().

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ClearPointer | ( | _KeyType | key,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Empty one item from the list, first calling SLNet::OP_Delete on that item.

Definition at line 815 of file DS_Multilist.h.

References SLNet::OP_DELETE().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ClearPointers | ( | bool | deallocateSmallBlocks = true,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Empties the list, first calling SLNet::OP_Delete on all items.

The list is not deallocated if it is small, unless deallocateSmallBlocks is true

Definition at line 806 of file DS_Multilist.h.

References SLNet::OP_DELETE().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource ( const Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & source )
protected

Definition at line 308 of file DS_Multilist.h.

References _FILE_AND_LINE_, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ascendingSort, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::data, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetSize(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::preallocationSize, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::sortState, and DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::variableMultilistType.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::DeallocateIfNeeded | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |
protected

Definition at line 1172 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::DeleteShiftArrayLeft ( _IndexType index )
protected

Definition at line 1314 of file DS_Multilist.h.

References ML_QUEUE, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection | ( | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | source1,
 |  | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | source2,
 |  | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | intersection,
 |  | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | uniqueToSource1,
 |  | Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & | uniqueToSource2
 | ) |  |
static

Returns the intersection of two lists. Intersection is items common to both lists.

Definition at line 1102 of file DS_Multilist.h.

References _FILE_AND_LINE_, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Clear(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetSize(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Push(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::SetSortOrder(), and DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Sort().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ForEach | ( | void(*)(_DataType &item, const char *file, unsigned int line) | func,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Iterate over the list, calling the function pointer on each element.

Definition at line 756 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ForEach ( void(*)(_DataType &item) func )

Definition at line 764 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetIndexFromKeyInSortedList | ( | const _KeyType & | key,
 |  | bool * | objectExists
 | ) |  | const
 protected

Definition at line 1249 of file DS_Multilist.h.

References RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetIndexOf ( _KeyType key ) const

Finds the index of key. Return -1 if the key is not found.

Definition at line 679 of file DS_Multilist.h.

References ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetInsertionIndex ( _KeyType key ) const

Returns where in the list we should insert the item, to preserve list order. Returns -1 if the item is already in the list.

Definition at line 713 of file DS_Multilist.h.

References ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
MultilistType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetMultilistType ( void ) const

Returns what type of list this is.

Definition at line 995 of file DS_Multilist.h.

References ML_VARIABLE_DURING_RUNTIME.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_DataType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetPtr ( _KeyType key ) const

Finds the index of key. Return 0 if the key is not found. Useful if _DataType is always non-zero pointers.

Definition at line 747 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetSize ( void ) const

Returns the number of elements used in the list.

Definition at line 778 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource(), and DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetSortOrder ( void ) const

Returns true if ascending.

Definition at line 983 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::InsertAtIndex | ( | const _DataType & | d,
 |  | _IndexType | index,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Stack,Queue: Inserts at index indicated, elements are shifted. Ordered list: Inserts, position is ignored.

Definition at line 545 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_STACK, and ML_UNORDERED_LIST.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::InsertInOrderedList | ( | const _DataType & | d,
 |  | const _KeyType & | key
 | ) |  |
protected

Definition at line 1220 of file DS_Multilist.h.

References ML_ORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::InsertShiftArrayRight | ( | const _DataType & | d,
 |  | _IndexType | index
 | ) |  |
protected

Definition at line 1298 of file DS_Multilist.h.

References ML_QUEUE, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::IsEmpty ( void ) const

Returns if the list is empty.

Definition at line 772 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::IsSorted ( void ) const

Returns true if the list is currently believed to be in a sorted state.

Doesn't actually check for sortedness, just if Sort() was recently called, or MultilistType is ML_ORDERED_LIST

Definition at line 989 of file DS_Multilist.h.

References ML_ORDERED_LIST.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::operator= ( const Multilist< _MultilistType, _DataType, _KeyType, _IndexType > & source )

Definition at line 300 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::operator[] ( const _IndexType position ) const

Definition at line 333 of file DS_Multilist.h.

References ML_QUEUE, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Peek ( void ) const

Definition at line 425 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PeekOpposite ( void ) const

Definition at line 524 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Pop | ( | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Gets or removes and gets an element from the list, according to the same rules as Push(). Ordered list is LIFO for the purposes of Pop and Peek.

Definition at line 400 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
_DataType & DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PopOpposite | ( | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Same as Pop() and Peek(), except FIFO and LIFO are reversed.

Definition at line 492 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Push | ( | const _DataType & | d,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Unordered list, stack is LIFO QUEUE is FIFO Ordered list is inserted in order

Definition at line 349 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Push | ( | const _DataType & | d,
 |  | const _KeyType & | key,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Definition at line 355 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PushOpposite | ( | const _DataType & | d,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Same as Push(), except FIFO and LIFO are reversed. Ordered list still inserts in order.

Definition at line 440 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PushOpposite | ( | const _DataType & | d,
 |  | const _KeyType & | key,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Definition at line 446 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::QSortAscending | ( | _IndexType | left,
 |  | _IndexType | right
 | ) |  |
protected

Definition at line 874 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::QSortDescending | ( | _IndexType | left,
 |  | _IndexType | right
 | ) |  |
protected

Definition at line 922 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Reallocate | ( | _IndexType | size,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Reallocates the list to a larger size. If size is smaller than the value returned by GetSize(), the call does nothing.

Definition at line 836 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ReallocateIfNeeded | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |
protected

Definition at line 1150 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ReallocToSize | ( | _IndexType | newAllocationSize,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
protected

Definition at line 1187 of file DS_Multilist.h.

References ML_QUEUE, and SLNet::OP_DELETE_ARRAY().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::RemoveAtIndex | ( | _IndexType | position,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Unordered list, removes at index indicated, swaps last element with that element. Otherwise, array is shifted left to overwrite removed element.

Index[0] returns the same as Pop() for a queue. Same as PopOpposite() for the list and ordered list

Definition at line 612 of file DS_Multilist.h.

References ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::RemoveAtKey | ( | _KeyType | key,
 |  | bool | assertIfDoesNotExist,
 |  | const char * | file = __FILE__,
 |  | unsigned int | line = __LINE__
 | ) |  |

Find the index of key, and remove at that index.

Definition at line 666 of file DS_Multilist.h.

References RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ReverseList ( void )

Reverses the elements in the list, and flips the sort order returned by GetSortOrder() if IsSorted() returns true at the time the function is called.

Definition at line 827 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ReverseListInternal ( void )
protected

Definition at line 1207 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::SetMultilistType ( MultilistType newType )

Changes what type of list this is.

Precondition
Template must be defined with ML_VARIABLE_DURING_RUNTIME for this to do anything
Parameters
[in] mlType Any value of the enum MultilistType, except ML_VARIABLE_DURING_RUNTIME

Definition at line 1006 of file DS_Multilist.h.

References _FILE_AND_LINE_, ML_ORDERED_LIST, ML_QUEUE, ML_STACK, ML_UNORDERED_LIST, ML_VARIABLE_DURING_RUNTIME, and RakAssert.

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::SetSortOrder ( bool ascending )

Defaults to ascending.

Used by Sort(), and by ML_ORDERED_LIST

Definition at line 970 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Sort ( bool force )

Sorts the list unless it is an ordered list, in which it does nothing as the list is assumed to already be sorted.

However, if force is true, it will also resort the ordered list, useful if the comparison operator between _KeyType and _DataType would now return different results Once the list is sorted, further operations to lookup by key will be log2(n) until the list is modified

Definition at line 848 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection().

template<const MultilistType _MultilistType, class _DataType , class _KeyType , class _IndexType >
void DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::TagSorted ( void )

Sets the list to be remembered as sorted.

Optimization if the source is sorted already

Definition at line 865 of file DS_Multilist.h.

Member Data Documentation

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>
_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::allocationSize
protected

Size of array.

Definition at line 237 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>
bool DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::ascendingSort
protected

Definition at line 256 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>
_DataType* DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::data
protected

An array of user values.

Definition at line 231 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>
_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::dataSize
protected

Number of elements in the list.

Definition at line 234 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>
_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::preallocationSize
protected

How many bytes the user chose to preallocate Won't automatically deallocate below this

Definition at line 247 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>
_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::queueHead
protected

Array index for the head of the queue.

Definition at line 240 of file DS_Multilist.h.

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>
_IndexType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::queueTail
protected

Array index for the tail of the queue.

Definition at line 243 of file DS_Multilist.h.

enum { ... } DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::sortState

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

template<const MultilistType _MultilistType, class _DataType , class _KeyType = _DataType, class _IndexType = DefaultIndexType>
MultilistType DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::variableMultilistType
protected

Definition at line 259 of file DS_Multilist.h.

Referenced by DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_Multilist.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • OrderedChannelHeap
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > Class Template Reference

#include <slikenet/DS_OrderedChannelHeap.h>

Classes

struct | HeapChannelAndData
struct | QueueAndWeight

Public Member Functions

OrderedChannelHeap ()
~OrderedChannelHeap ()
void | Push (const channel_key_type &channelID, const heap_data_type &data)
void | PushAtHead (const unsigned index, const channel_key_type &channelID, const heap_data_type &data)
heap_data_type | Pop (const unsigned startingIndex=0)
heap_data_type | Peek (const unsigned startingIndex) const
void | AddChannel (const channel_key_type &channelID, const double weight)
void | RemoveChannel (channel_key_type channelID)
void | Clear (void)
heap_data_type & | operator[] (const unsigned int position) const
unsigned | ChannelSize (const channel_key_type &channelID)
unsigned | Size (void) const

Static Public Member Functions

static void IMPLEMENT_DEFAULT_COMPARISON (void)

Protected Member Functions

void GreatestRandResult (void)

Protected Attributes

DataStructures::Map
< channel_key_type,
QueueAndWeight
*, channel_key_comparison_func > 		map
DataStructures::Heap< double,
HeapChannelAndData, true > 		heap

Detailed Description

template<class channel_key_type, class heap_data_type, int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
class DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >

Definition at line 37 of file DS_OrderedChannelHeap.h.

Class Documentation

struct DataStructures::OrderedChannelHeap::QueueAndWeight

template<class channel_key_type, class heap_data_type, int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
struct DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight

Definition at line 55 of file DS_OrderedChannelHeap.h.

Class Members
Queue< double > | randResultQueue
bool | signalDeletion
double | weight

Constructor & Destructor Documentation

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::OrderedChannelHeap ( )

Definition at line 77 of file DS_OrderedChannelHeap.h.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::~OrderedChannelHeap ( )

Definition at line 82 of file DS_OrderedChannelHeap.h.

Member Function Documentation

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
void DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::AddChannel | ( | const channel_key_type & | channelID,
 |  | const double | weight
 | ) |  |

Definition at line 197 of file DS_OrderedChannelHeap.h.

References _FILE_AND_LINE_, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight::signalDeletion, and DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight::weight.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
unsigned DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::ChannelSize ( const channel_key_type & channelID )

Definition at line 239 of file DS_OrderedChannelHeap.h.

References DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight::randResultQueue, and DataStructures::Queue< queue_type >::Size().

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
void DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Clear ( void )

Definition at line 246 of file DS_OrderedChannelHeap.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE().

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
void DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::GreatestRandResult ( void )
protected

Definition at line 94 of file DS_OrderedChannelHeap.h.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
static void DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::IMPLEMENT_DEFAULT_COMPARISON ( void )
inlinestatic

Definition at line 40 of file DS_OrderedChannelHeap.h.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
heap_data_type & DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::operator[] ( const unsigned int position ) const

Definition at line 232 of file DS_OrderedChannelHeap.h.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
heap_data_type DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Peek ( const unsigned startingIndex ) const

Definition at line 190 of file DS_OrderedChannelHeap.h.

References DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData::data.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
heap_data_type DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Pop ( const unsigned startingIndex = 0 )

Definition at line 161 of file DS_OrderedChannelHeap.h.

References RakAssert, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight::randResultQueue, and DataStructures::Queue< queue_type >::RemoveAtIndex().

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
void DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Push | ( | const channel_key_type & | channelID,
 |  | const heap_data_type & | data
 | ) |  |

Definition at line 88 of file DS_OrderedChannelHeap.h.

References MAX_UNSIGNED_LONG.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
void DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::PushAtHead | ( | const unsigned | index,
 |  | const channel_key_type & | channelID,
 |  | const heap_data_type & | data
 | ) |  |

Definition at line 108 of file DS_OrderedChannelHeap.h.

References frandomMT(), DataStructures::Queue< queue_type >::Push(), DataStructures::Queue< queue_type >::PushAtHead(), RakAssert, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight::randResultQueue, DataStructures::Queue< queue_type >::Size(), and DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight::weight.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
void DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::RemoveChannel ( channel_key_type channelID )

Definition at line 206 of file DS_OrderedChannelHeap.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE().

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func>
unsigned DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Size ( void ) const

Definition at line 226 of file DS_OrderedChannelHeap.h.

Member Data Documentation

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
DataStructures::Heap<double, HeapChannelAndData, true> DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::heap
protected

Definition at line 72 of file DS_OrderedChannelHeap.h.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
DataStructures::Map<channel_key_type, QueueAndWeight*, channel_key_comparison_func> DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::map
protected

Definition at line 71 of file DS_OrderedChannelHeap.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_OrderedChannelHeap.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • OrderedChannelHeap
  • HeapChannelAndData
Public Member Functions | Public Attributes | List of all members
DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData Struct Reference

#include <slikenet/DS_OrderedChannelHeap.h>

Public Member Functions

HeapChannelAndData ()
HeapChannelAndData (const channel_key_type &_channel, const heap_data_type &_data)

Public Attributes

heap_data_type | data
channel_key_type | channel

Detailed Description

template<class channel_key_type, class heap_data_type, int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
struct DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData

Definition at line 62 of file DS_OrderedChannelHeap.h.

Constructor & Destructor Documentation

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData::HeapChannelAndData ( )
inline

Definition at line 64 of file DS_OrderedChannelHeap.h.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData::HeapChannelAndData | ( | const channel_key_type & | _channel,
 |  | const heap_data_type & | _data
 | ) |  |
inline

Definition at line 65 of file DS_OrderedChannelHeap.h.

Member Data Documentation

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
channel_key_type DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData::channel

Definition at line 67 of file DS_OrderedChannelHeap.h.

template<class channel_key_type , class heap_data_type , int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
heap_data_type DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData::data

Definition at line 66 of file DS_OrderedChannelHeap.h.

Referenced by DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Peek().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/DS_OrderedChannelHeap.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::OrderedList< key_type, data_type, default_comparison_function > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • OrderedList
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
DataStructures::OrderedList< key_type, data_type, default_comparison_function > Class Template Reference

#include <slikenet/DS_OrderedList.h>

+ Inheritance diagram for DataStructures::OrderedList< key_type, data_type, default_comparison_function >:

Public Member Functions

OrderedList ()
~OrderedList ()
OrderedList (const OrderedList &original_copy)
OrderedList & | operator= (const OrderedList &original_copy)
bool | HasData (const key_type &key, int(*cf)(const key_type &, const data_type &)=default_comparison_function) const
unsigned | GetIndexFromKey (const key_type &key, bool *objectExists, int(*cf)(const key_type &, const data_type &)=default_comparison_function) const
data_type | GetElementFromKey (const key_type &key, int(*cf)(const key_type &, const data_type &)=default_comparison_function) const
bool | GetElementFromKey (const key_type &key, data_type &element, int(*cf)(const key_type &, const data_type &)=default_comparison_function) const
unsigned | Insert (const key_type &key, const data_type &data, bool assertOnDuplicate, const char *file, unsigned int line, int(*cf)(const key_type &, const data_type &)=default_comparison_function)
unsigned | Remove (const key_type &key, int(*cf)(const key_type &, const data_type &)=default_comparison_function)
unsigned | RemoveIfExists (const key_type &key, int(*cf)(const key_type &, const data_type &)=default_comparison_function)
data_type & | operator[] (const unsigned int position) const
void | RemoveAtIndex (const unsigned index)
void | InsertAtIndex (const data_type &data, const unsigned index, const char *file, unsigned int line)
void | InsertAtEnd (const data_type &data, const char *file, unsigned int line)
void | RemoveFromEnd (const unsigned num=1)
void | Clear (bool doNotDeallocate, const char *file, unsigned int line)
unsigned | Size (void) const

Static Public Member Functions

static void IMPLEMENT_DEFAULT_COMPARISON (void)

Protected Attributes

DataStructures::List< data_type > orderedList

Detailed Description

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function = defaultOrderedListComparison<key_type, data_type>>
class DataStructures::OrderedList< key_type, data_type, default_comparison_function >

Note
IMPORTANT! If you use defaultOrderedListComparison then call IMPLEMENT_DEFAULT_COMPARISON or you will get an unresolved external linker error.

Definition at line 40 of file DS_OrderedList.h.

Constructor & Destructor Documentation

template<class key_type , class data_type , int(*)(const key_type &, const data_type &) default_comparison_function>
DataStructures::OrderedList< key_type, data_type, default_comparison_function >::OrderedList ( )

Definition at line 73 of file DS_OrderedList.h.

template<class key_type , class data_type , int(*)(const key_type &, const data_type &) default_comparison_function>
DataStructures::OrderedList< key_type, data_type, default_comparison_function >::~OrderedList ( )

Definition at line 78 of file DS_OrderedList.h.

References _FILE_AND_LINE_.

template<class key_type , class data_type , int(*)(const key_type &, const data_type &) default_comparison_function>
DataStructures::OrderedList< key_type, data_type, default_comparison_function >::OrderedList ( const OrderedList< key_type, data_type, default_comparison_function > & original_copy )

Definition at line 84 of file DS_OrderedList.h.

References DataStructures::OrderedList< key_type, data_type, default_comparison_function >::orderedList.

Member Function Documentation

template<class key_type , class data_type , int(*)(const key_type &, const data_type &) default_comparison_function>
void DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Clear | ( | bool | doNotDeallocate,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 262 of file DS_OrderedList.h.

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function>
data_type DataStructures::OrderedList< key_type, data_type, default_comparison_function >::GetElementFromKey | ( | const key_type & | key,
 |  | int(*)(const key_type &, const data_type &) | cf = default_comparison_function
 | ) |  | const

Definition at line 105 of file DS_OrderedList.h.

References RakAssert.

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function>
bool DataStructures::OrderedList< key_type, data_type, default_comparison_function >::GetElementFromKey | ( | const key_type & | key,
 |  | data_type & | element,
 |  | int(*)(const key_type &, const data_type &) | cf = default_comparison_function
 | ) |  | const

Definition at line 114 of file DS_OrderedList.h.

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function>
unsigned DataStructures::OrderedList< key_type, data_type, default_comparison_function >::GetIndexFromKey | ( | const key_type & | key,
 |  | bool * | objectExists,
 |  | int(*)(const key_type &, const data_type &) | cf = default_comparison_function
 | ) |  | const

Definition at line 124 of file DS_OrderedList.h.

References RakAssert.

Referenced by SLNet::VariableDeltaSerializer::DirtyAndFreeVarsAssociatedWithReceipt(), SLNet::StringTable::EncodeString(), SLNet::VariableDeltaSerializer::FreeVarsAssociatedWithReceipt(), and SLNet::CommandParserInterface::GetRegisteredCommand().

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function>
bool DataStructures::OrderedList< key_type, data_type, default_comparison_function >::HasData | ( | const key_type & | key,
 |  | int(*)(const key_type &, const data_type &) | cf = default_comparison_function
 | ) |  | const

comparisonFunction must take a key_type and a data_type and return <0, ==0, or >0 If the data type has comparison operators already defined then you can just use defaultComparison

Definition at line 97 of file DS_OrderedList.h.

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function = defaultOrderedListComparison<key_type, data_type>>
static void DataStructures::OrderedList< key_type, data_type, default_comparison_function >::IMPLEMENT_DEFAULT_COMPARISON ( void )
inlinestatic

Definition at line 43 of file DS_OrderedList.h.

Referenced by GridSectorizer::Init().

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function>
unsigned DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Insert | ( | const key_type & | key,
 |  | const data_type & | data,
 |  | bool | assertOnDuplicate,
 |  | const char * | file,
 |  | unsigned int | line,
 |  | int(*)(const key_type &, const data_type &) | cf = default_comparison_function
 | ) |  |

Definition at line 176 of file DS_OrderedList.h.

References RakAssert.

Referenced by SLNet::StringTable::AddString(), SLNet::CommandParserInterface::RegisterCommand(), DataStructures::Table::SortTable(), and SLNet::VariableDeltaSerializer::StoreChangedVariablesList().

template<class key_type , class data_type, int(*)(const key_type &, const data_type &) default_comparison_function>
void DataStructures::OrderedList< key_type, data_type, default_comparison_function >::InsertAtEnd | ( | const data_type & | data,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 250 of file DS_OrderedList.h.

template<class key_type , class data_type, int(*)(const key_type &, const data_type &) default_comparison_function>
void DataStructures::OrderedList< key_type, data_type, default_comparison_function >::InsertAtIndex | ( | const data_type & | data,
 |  | const unsigned | index,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 244 of file DS_OrderedList.h.

template<class key_type , class data_type , int(*)(const key_type &, const data_type &) default_comparison_function>
OrderedList< key_type, data_type, default_comparison_function > & DataStructures::OrderedList< key_type, data_type, default_comparison_function >::operator= ( const OrderedList< key_type, data_type, default_comparison_function > & original_copy )

Definition at line 90 of file DS_OrderedList.h.

References DataStructures::OrderedList< key_type, data_type, default_comparison_function >::orderedList.

template<class key_type , class data_type , int(*)(const key_type &, const data_type &) default_comparison_function>
data_type & DataStructures::OrderedList< key_type, data_type, default_comparison_function >::operator[] ( const unsigned int position ) const

Definition at line 268 of file DS_OrderedList.h.

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function>
unsigned DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Remove | ( | const key_type & | key,
 |  | int(*)(const key_type &, const data_type &) | cf = default_comparison_function
 | ) |  |

Definition at line 204 of file DS_OrderedList.h.

References RakAssert.

template<class key_type , class data_type , int(*)(const key_type &, const data_type &) default_comparison_function>
void DataStructures::OrderedList< key_type, data_type, default_comparison_function >::RemoveAtIndex ( const unsigned index )

Definition at line 238 of file DS_OrderedList.h.

Referenced by SLNet::VariableDeltaSerializer::DirtyAndFreeVarsAssociatedWithReceipt(), and SLNet::VariableDeltaSerializer::FreeVarsAssociatedWithReceipt().

template<class key_type , class data_type , int(*)(const key_type &, const data_type &) default_comparison_function>
void DataStructures::OrderedList< key_type, data_type, default_comparison_function >::RemoveFromEnd ( const unsigned num = 1 )

Definition at line 256 of file DS_OrderedList.h.

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function>
unsigned DataStructures::OrderedList< key_type, data_type, default_comparison_function >::RemoveIfExists | ( | const key_type & | key,
 |  | int(*)(const key_type &, const data_type &) | cf = default_comparison_function
 | ) |  |

Definition at line 223 of file DS_OrderedList.h.

template<class key_type , class data_type , int(*)(const key_type &, const data_type &) default_comparison_function>
unsigned DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Size ( void ) const

Definition at line 274 of file DS_OrderedList.h.

Referenced by SLNet::StringTable::AddString(), SLNet::StringTable::DecodeString(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::CommandParserInterface::SendCommandList(), DataStructures::Table::SortTable(), and SLNet::StringTable::~StringTable().

Member Data Documentation

template<class key_type, class data_type, int(*)(const key_type &, const data_type &) default_comparison_function = defaultOrderedListComparison<key_type, data_type>>
DataStructures::List<data_type> DataStructures::OrderedList< key_type, data_type, default_comparison_function >::orderedList
protected

Definition at line 69 of file DS_OrderedList.h.

Referenced by DataStructures::OrderedList< key_type, data_type, default_comparison_function >::operator=(), and DataStructures::OrderedList< key_type, data_type, default_comparison_function >::OrderedList().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_OrderedList.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Queue< queue_type > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Queue
Public Member Functions | List of all members
DataStructures::Queue< queue_type > Class Template Reference

A queue implemented as an array with a read and write index. More...

#include <slikenet/DS_Queue.h>

+ Inheritance diagram for DataStructures::Queue< queue_type >:

Public Member Functions

Queue ()
~Queue ()
Queue (const Queue &original_copy)
bool | operator= (const Queue &original_copy)
void | Push (const queue_type &input, const char *file, unsigned int line)
void | PushAtHead (const queue_type &input, unsigned index, const char *file, unsigned int line)
queue_type & | operator[] (unsigned int position) const
void | RemoveAtIndex (unsigned int position)
queue_type | Peek (void) const
queue_type | PeekTail (void) const
queue_type | Pop (void)
queue_type | PopTail (void)
queue_type | PopDeref (void)
unsigned int | Size (void) const
bool | IsEmpty (void) const
unsigned int | AllocationSize (void) const
void | Clear (const char *file, unsigned int line)
void | Compress (const char *file, unsigned int line)
bool | Find (const queue_type &q)
void | ClearAndForceAllocation (int size, const char *file, unsigned int line)

Detailed Description

template<class queue_type>
class DataStructures::Queue< queue_type >

A queue implemented as an array with a read and write index.

Definition at line 36 of file DS_Queue.h.

Constructor & Destructor Documentation

template<class queue_type >
DataStructures::Queue< queue_type >::Queue ( )

Definition at line 91 of file DS_Queue.h.

template<class queue_type >
DataStructures::Queue< queue_type >::~Queue ( )

Definition at line 102 of file DS_Queue.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE_ARRAY().

template<class queue_type >
DataStructures::Queue< queue_type >::Queue ( const Queue< queue_type > & original_copy )

Definition at line 276 of file DS_Queue.h.

References _FILE_AND_LINE_, and DataStructures::Queue< queue_type >::Size().

Member Function Documentation

template<class queue_type >
unsigned int DataStructures::Queue< queue_type >::AllocationSize ( void ) const
inline

Definition at line 85 of file DS_Queue.h.

template<class queue_type >
void DataStructures::Queue< queue_type >::Clear | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |
inline

Definition at line 332 of file DS_Queue.h.

References SLNet::OP_DELETE_ARRAY(), and return.

Referenced by SLNet::BPSTracker::Reset(), and SLNet::RakPeer::Shutdown().

template<class queue_type >
void DataStructures::Queue< queue_type >::ClearAndForceAllocation | ( | int | size,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 393 of file DS_Queue.h.

References SLNet::OP_DELETE_ARRAY().

template<class queue_type >
void DataStructures::Queue< queue_type >::Compress | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 348 of file DS_Queue.h.

References SLNet::OP_DELETE_ARRAY().

template<class queue_type>
bool DataStructures::Queue< queue_type >::Find ( const queue_type & q )

Definition at line 374 of file DS_Queue.h.

template<class queue_type >
bool DataStructures::Queue< queue_type >::IsEmpty ( void ) const
inline

Definition at line 79 of file DS_Queue.h.

Referenced by SLNet::BPSTracker::ClearExpired1(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath(), SLNet::RakPeer::Receive(), and SLNet::RakPeer::RunUpdateCycle().

template<class queue_type >
bool DataStructures::Queue< queue_type >::operator= ( const Queue< queue_type > & original_copy )

Definition at line 301 of file DS_Queue.h.

References _FILE_AND_LINE_, and DataStructures::Queue< queue_type >::Size().

template<class queue_type >
queue_type & DataStructures::Queue< queue_type >::operator[] ( unsigned int position ) const
inline

Definition at line 406 of file DS_Queue.h.

References RakAssert.

template<class queue_type >
queue_type DataStructures::Queue< queue_type >::Peek ( void ) const
inline

Definition at line 206 of file DS_Queue.h.

References RakAssert.

Referenced by SLNet::BPSTracker::ClearExpired1().

template<class queue_type >
queue_type DataStructures::Queue< queue_type >::PeekTail ( void ) const
inline

Definition at line 216 of file DS_Queue.h.

References RakAssert.

template<class queue_type >
queue_type DataStructures::Queue< queue_type >::Pop ( void )
inline

Definition at line 109 of file DS_Queue.h.

References RakAssert.

Referenced by SLNet::RakPeer::AllocRNS2RecvStruct(), SLNet::RakPeer::ClearBufferedPackets(), SLNet::BPSTracker::ClearExpired1(), SLNet::RakPeer::ClearRequestedConnectionList(), SLNet::HuffmanEncodingTree::FreeMemory(), DataStructures::BPlusTree< KeyType, DataType, order >::FreePages(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), DataStructures::Tree< TreeType >::LevelOrderTraversal(), SLNet::RakPeer::PopBufferedPacket(), DataStructures::BPlusTree< KeyType, DataType, order >::PrintGraph(), SLNet::RakNetRandomSync::RandomMT(), SLNet::RakPeer::Receive(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::RemoveNode().

template<class queue_type >
queue_type DataStructures::Queue< queue_type >::PopDeref ( void )
inline

Definition at line 144 of file DS_Queue.h.

template<class queue_type >
queue_type DataStructures::Queue< queue_type >::PopTail ( void )
inline

Definition at line 126 of file DS_Queue.h.

References RakAssert.

template<class queue_type>
void DataStructures::Queue< queue_type >::Push | ( | const queue_type & | input,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 228 of file DS_Queue.h.

References SLNet::OP_DELETE_ARRAY(), RakAssert, and return.

Referenced by SLNet::RakPeer::AddPacketToProducer(), SLNet::RakPeer::ClearRequestedConnectionList(), SLNet::RakPeer::DeallocRNS2RecvStruct(), SLNet::HuffmanEncodingTree::FreeMemory(), DataStructures::BPlusTree< KeyType, DataType, order >::FreePages(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), DataStructures::Tree< TreeType >::LevelOrderTraversal(), DataStructures::BPlusTree< KeyType, DataType, order >::PrintGraph(), SLNet::BPSTracker::Push1(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::PushAtHead(), SLNet::RakPeer::PushBackPacket(), SLNet::RakPeer::PushBufferedPacket(), SLNet::RakNetRandomSync::RandomMT(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::RemoveNode(), and SLNet::RakPeer::SendConnectionRequest().

template<class queue_type>
void DataStructures::Queue< queue_type >::PushAtHead | ( | const queue_type & | input,
 |  | unsigned | index,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 163 of file DS_Queue.h.

References RakAssert.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::PushAtHead(), and SLNet::RakPeer::PushBackPacket().

template<class queue_type >
void DataStructures::Queue< queue_type >::RemoveAtIndex ( unsigned int position )

Definition at line 420 of file DS_Queue.h.

References RakAssert, and return.

Referenced by SLNet::RakPeer::CancelConnectionAttempt(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Pop(), SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakPeer::RunUpdateCycle().

template<class queue_type >
unsigned int DataStructures::Queue< queue_type >::Size ( void ) const
inline

Definition at line 70 of file DS_Queue.h.

Referenced by SLNet::RakPeer::AllocRNS2RecvStruct(), SLNet::RakPeer::CancelConnectionAttempt(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::ChannelSize(), SLNet::RakPeer::ClearBufferedPackets(), SLNet::RakPeer::ClearRequestedConnectionList(), SLNet::HuffmanEncodingTree::FreeMemory(), DataStructures::BPlusTree< KeyType, DataType, order >::FreePages(), SLNet::RakPeer::GetConnectionState(), SLNet::RakPeer::GetReceiveBufferSize(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), DataStructures::Tree< TreeType >::LevelOrderTraversal(), DataStructures::Queue< queue_type >::operator=(), SLNet::RakPeer::PopBufferedPacket(), DataStructures::BPlusTree< KeyType, DataType, order >::PrintGraph(), SLNet::ProcessOfflineNetworkPacket(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::PushAtHead(), DataStructures::Queue< queue_type >::Queue(), SLNet::RakNetRandomSync::RandomMT(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::RemoveNode(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendConnectionRequest(), and SLNet::RakPeer::Shutdown().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_Queue.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::QueueLinkedList< QueueType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • QueueLinkedList
Public Member Functions | List of all members
DataStructures::QueueLinkedList< QueueType > Class Template Reference

A queue implemented using a linked list. Rarely used. More...

#include <slikenet/DS_QueueLinkedList.h>

Public Member Functions

QueueLinkedList ()
QueueLinkedList (const QueueLinkedList &original_copy)
bool | operator= (const QueueLinkedList &original_copy)
QueueType | Pop (void)
QueueType & | Peek (void)
QueueType & | EndPeek (void)
void | Push (const QueueType &input)
unsigned int | Size (void)
void | Clear (void)
void | Compress (void)

Detailed Description

template<class QueueType>
class DataStructures::QueueLinkedList< QueueType >

A queue implemented using a linked list. Rarely used.

Definition at line 35 of file DS_QueueLinkedList.h.

Constructor & Destructor Documentation

template<class QueueType >
DataStructures::QueueLinkedList< QueueType >::QueueLinkedList ( )

Definition at line 55 of file DS_QueueLinkedList.h.

template<class QueueType >
DataStructures::QueueLinkedList< QueueType >::QueueLinkedList ( const QueueLinkedList< QueueType > & original_copy )

Definition at line 94 of file DS_QueueLinkedList.h.

Member Function Documentation

template<class QueueType >
void DataStructures::QueueLinkedList< QueueType >::Clear ( void )

Definition at line 109 of file DS_QueueLinkedList.h.

template<class QueueType>
void DataStructures::QueueLinkedList< QueueType >::Compress ( void )
template<class QueueType >
QueueType & DataStructures::QueueLinkedList< QueueType >::EndPeek ( void )
inline

Definition at line 80 of file DS_QueueLinkedList.h.

template<class QueueType >
bool DataStructures::QueueLinkedList< QueueType >::operator= ( const QueueLinkedList< QueueType > & original_copy )

Definition at line 100 of file DS_QueueLinkedList.h.

template<class QueueType >
QueueType & DataStructures::QueueLinkedList< QueueType >::Peek ( void )
inline

Definition at line 73 of file DS_QueueLinkedList.h.

template<class QueueType >
QueueType DataStructures::QueueLinkedList< QueueType >::Pop ( void )
inline

Definition at line 66 of file DS_QueueLinkedList.h.

Referenced by DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree(), DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayBreadthFirstSearch(), and DataStructures::BinarySearchTree< BinarySearchTreeType >::operator=().

template<class QueueType >
void DataStructures::QueueLinkedList< QueueType >::Push ( const QueueType & input )

Definition at line 87 of file DS_QueueLinkedList.h.

Referenced by DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree(), DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayBreadthFirstSearch(), and DataStructures::BinarySearchTree< BinarySearchTreeType >::operator=().

template<class QueueType >
unsigned int DataStructures::QueueLinkedList< QueueType >::Size ( void )
inline

Definition at line 60 of file DS_QueueLinkedList.h.

Referenced by DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree(), DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayBreadthFirstSearch(), and DataStructures::BinarySearchTree< BinarySearchTreeType >::operator=().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_QueueLinkedList.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::RangeNode< range_type > Struct Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • RangeNode
Public Member Functions | Public Attributes | List of all members
DataStructures::RangeNode< range_type > Struct Template Reference

#include <slikenet/DS_RangeList.h>

+ Inheritance diagram for DataStructures::RangeNode< range_type >:

Public Member Functions

RangeNode ()
~RangeNode ()
RangeNode (range_type min, range_type max)

Public Attributes

range_type | minIndex
range_type | maxIndex

Detailed Description

template<class range_type>
struct DataStructures::RangeNode< range_type >

Definition at line 33 of file DS_RangeList.h.

Constructor & Destructor Documentation

template<class range_type>
DataStructures::RangeNode< range_type >::RangeNode ( )
inline

Definition at line 35 of file DS_RangeList.h.

template<class range_type>
DataStructures::RangeNode< range_type >::~RangeNode ( )
inline

Definition at line 36 of file DS_RangeList.h.

template<class range_type>
DataStructures::RangeNode< range_type >::RangeNode | ( | range_type | min,
 |  | range_type | max
 | ) |  |
inline

Definition at line 37 of file DS_RangeList.h.

Member Data Documentation

template<class range_type>
range_type DataStructures::RangeNode< range_type >::maxIndex

Definition at line 39 of file DS_RangeList.h.

Referenced by DataStructures::RangeNode< DatagramSequenceNumberType >::RangeNode(), and DataStructures::RangeNodeComp().

template<class range_type>
range_type DataStructures::RangeNode< range_type >::minIndex

Definition at line 38 of file DS_RangeList.h.

Referenced by DataStructures::RangeNode< DatagramSequenceNumberType >::RangeNode(), and DataStructures::RangeNodeComp().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/DS_RangeList.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::RangeList< range_type > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • RangeList
Public Member Functions | Public Attributes | List of all members
DataStructures::RangeList< range_type > Class Template Reference

#include <slikenet/DS_RangeList.h>

+ Inheritance diagram for DataStructures::RangeList< range_type >:

Public Member Functions

RangeList ()
~RangeList ()
void | Insert (range_type index)
void | Clear (void)
bool | IsWithinRange (range_type value) const
unsigned | Size (void) const
unsigned | RangeSum (void) const
SLNet::BitSize_t | Serialize (SLNet::BitStream *in, SLNet::BitSize_t maxBits, bool clearSerialized)
bool | Deserialize (SLNet::BitStream *out)

Public Attributes

DataStructures::OrderedList
< range_type, RangeNode
< range_type >, RangeNodeComp
< range_type > > 		ranges

Detailed Description

template<class range_type>
class DataStructures::RangeList< range_type >

Definition at line 56 of file DS_RangeList.h.

Constructor & Destructor Documentation

template<class range_type >
DataStructures::RangeList< range_type >::RangeList ( )

Definition at line 188 of file DS_RangeList.h.

template<class range_type >
DataStructures::RangeList< range_type >::~RangeList ( )

Definition at line 194 of file DS_RangeList.h.

Member Function Documentation

template<class range_type >
void DataStructures::RangeList< range_type >::Clear ( void )

Definition at line 265 of file DS_RangeList.h.

References _FILE_AND_LINE_.

template<class range_type >
bool DataStructures::RangeList< range_type >::Deserialize ( SLNet::BitStream * out )

Definition at line 127 of file DS_RangeList.h.

References _FILE_AND_LINE_, SLNet::BitStream::AlignReadToByteBoundary(), and SLNet::BitStream::Read().

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer().

template<class range_type>
void DataStructures::RangeList< range_type >::Insert ( range_type index )

Definition at line 200 of file DS_RangeList.h.

References _FILE_AND_LINE_, and RakAssert.

template<class range_type>
bool DataStructures::RangeList< range_type >::IsWithinRange ( range_type value ) const

Definition at line 271 of file DS_RangeList.h.

template<class range_type >
unsigned DataStructures::RangeList< range_type >::RangeSum ( void ) const

Definition at line 286 of file DS_RangeList.h.

template<class range_type >
SLNet::BitSize_t DataStructures::RangeList< range_type >::Serialize | ( | SLNet::BitStream * | in,
 |  | SLNet::BitSize_t | maxBits,
 |  | bool | clearSerialized
 | ) |  |

Definition at line 77 of file DS_RangeList.h.

References SLNet::BitStream::AlignWriteToByteBoundary(), SLNet::BitStream::GetNumberOfBitsUsed(), SLNet::BitStream::GetWriteOffset(), RakAssert, and SLNet::BitStream::Write().

template<class range_type >
unsigned DataStructures::RangeList< range_type >::Size ( void ) const

Definition at line 280 of file DS_RangeList.h.

Member Data Documentation

template<class range_type>
DataStructures::OrderedList<range_type, RangeNode<range_type> , RangeNodeComp<range_type> > DataStructures::RangeList< range_type >::ranges

Definition at line 69 of file DS_RangeList.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_RangeList.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Table Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataStructures::Table Class Reference

Holds a set of columns, a set of rows, and rows times columns cells. More...

#include <slikenet/DS_Table.h>

Classes

struct | Cell
Holds the actual data in the table. More...
struct | ColumnDescriptor
struct | FilterQuery
struct | Row
Stores the list of cells for this row, and a special flag used for internal sorting. More...
struct | SortQuery

Public Types

enum | ColumnType { NUMERIC, STRING, BINARY, POINTER }
enum FilterQueryType {
QF_EQUAL, QF_NOT_EQUAL, QF_GREATER_THAN, QF_GREATER_THAN_EQ,
QF_LESS_THAN, QF_LESS_THAN_EQ, QF_IS_EMPTY, QF_NOT_EMPTY
}
enum | SortQueryType { QS_INCREASING_ORDER, QS_DECREASING_ORDER }
Increasing or decreasing sort order. More...

Public Member Functions

Table ()
~Table ()
unsigned | AddColumn (const char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH], ColumnType columnType)
Adds a column to the table.
void | RemoveColumn (unsigned columnIndex)
Removes a column by index.
unsigned | ColumnIndex (char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH]) const
Gets the index of a column by name.
unsigned | ColumnIndex (const char *columnName) const
char * | ColumnName (unsigned index) const
Gives the string name of the column at a certain index.
ColumnType | GetColumnType (unsigned index) const
Returns the type of a column, referenced by index.
unsigned | GetColumnCount (void) const
unsigned | GetRowCount (void) const
Table::Row * | AddRow (unsigned rowId)
Adds a row to the table.
Table::Row * | AddRow (unsigned rowId, DataStructures::List< Cell > &initialCellValues)
Table::Row * | AddRow (unsigned rowId, DataStructures::List< Cell * > &initialCellValues, bool copyCells=false)
bool | RemoveRow (unsigned rowId)
Removes a row specified by rowId.
void | RemoveRows (Table *tableContainingRowIDs)
Removes all the rows with IDs that the specified table also has.
bool | UpdateCell (unsigned rowId, unsigned columnIndex, int value)
Updates a particular cell in the table.
bool | UpdateCell (unsigned rowId, unsigned columnIndex, char *str)
bool | UpdateCell (unsigned rowId, unsigned columnIndex, int byteLength, char *data)
bool | UpdateCellByIndex (unsigned rowIndex, unsigned columnIndex, int value)
bool | UpdateCellByIndex (unsigned rowIndex, unsigned columnIndex, char *str)
bool | UpdateCellByIndex (unsigned rowIndex, unsigned columnIndex, int byteLength, char *data)
void | GetCellValueByIndex (unsigned rowIndex, unsigned columnIndex, int *output)
Note this is much less efficient to call than GetRow, then working with the cells directly. Numeric, string, binary.
void | GetCellValueByIndex (unsigned rowIndex, unsigned columnIndex, char *output)
void | GetCellValueByIndex (unsigned rowIndex, unsigned columnIndex, char *output, size_t outputLength)
void | GetCellValueByIndex (unsigned rowIndex, unsigned columnIndex, char *output, int *outputLength)
Row * | GetRowByID (unsigned rowId) const
Gets a row. More efficient to do this and access Row::cells than to repeatedly call GetCell. You can also update cells in rows from this function.
Row * | GetRowByIndex (unsigned rowIndex, unsigned *key) const
Gets a row at a specific index. rowIndex should be less than GetRowCount()
void | QueryTable (unsigned *columnIndicesSubset, unsigned numColumnSubset, FilterQuery *inclusionFilters, unsigned numInclusionFilters, unsigned *rowIds, unsigned numRowIDs, Table *result)
Queries the table, optionally returning only a subset of columns and rows.
void | SortTable (Table::SortQuery *sortQueries, unsigned numSortQueries, Table::Row **out)
Sorts the table by rows.
void | Clear (void)
Frees all memory in the table.
void | PrintColumnHeaders (char *out, int outLength, char columnDelineator) const
Prints out the names of all the columns.
void | PrintRow (char *out, int outLength, char columnDelineator, bool printDelineatorForBinary, Table::Row *inputRow) const
Writes a text representation of the row to out.
const DataStructures::List
< ColumnDescriptor > & 		GetColumns (void) const
Direct access to make things easier.
const
DataStructures::BPlusTree
< unsigned, Row
*, _TABLE_BPLUS_TREE_ORDER > & 		GetRows (void) const
Direct access to make things easier.
DataStructures::Page< unsigned,
Row *, _TABLE_BPLUS_TREE_ORDER > * 		GetListHead (void)
Get the head of a linked list containing all the row data.
unsigned | GetAvailableRowId (void) const
Get the first free row id. This could be made more efficient.
Table & | operator= (const Table &input)

Protected Member Functions

Table::Row * | AddRowColumns (unsigned rowId, Row *row, DataStructures::List< unsigned > columnIndices)
void | DeleteRow (Row *row)
void | QueryRow (DataStructures::List< unsigned > &inclusionFilterColumnIndices, DataStructures::List< unsigned > &columnIndicesToReturn, unsigned key, Table::Row *row, FilterQuery *inclusionFilters, Table *result)

Protected Attributes

DataStructures::BPlusTree
< unsigned, Row
*, _TABLE_BPLUS_TREE_ORDER > 		rows
DataStructures::List
< ColumnDescriptor > 		columns

Detailed Description

Holds a set of columns, a set of rows, and rows times columns cells.

The table data structure is useful if you want to store a set of structures and perform queries on those structures.
This is a relatively simple and fast implementation of the types of tables commonly used in databases.
See TableSerializer to serialize data members of the table.
See LightweightDatabaseClient and LightweightDatabaseServer to transmit the table over the network.

Definition at line 42 of file DS_Table.h.

Class Documentation

struct DataStructures::Table::SortQuery

Definition at line 178 of file DS_Table.h.

Class Members
unsigned | columnIndex | The index of the table column we are sorting on.
SortQueryType | operation | See SortQueryType.

Member Enumeration Documentation

enum DataStructures::Table::ColumnType
Enumerator:
NUMERIC
STRING
BINARY
POINTER

Definition at line 46 of file DS_Table.h.

enum DataStructures::Table::FilterQueryType
Enumerator:
QF_EQUAL
QF_NOT_EQUAL
QF_GREATER_THAN
QF_GREATER_THAN_EQ
QF_LESS_THAN
QF_LESS_THAN_EQ
QF_IS_EMPTY
QF_NOT_EMPTY

Definition at line 142 of file DS_Table.h.

enum DataStructures::Table::SortQueryType

Increasing or decreasing sort order.

Enumerator:
QS_INCREASING_ORDER
QS_DECREASING_ORDER

Definition at line 170 of file DS_Table.h.

Constructor & Destructor Documentation

Table::Table ( )

Definition at line 284 of file DS_Table.cpp.

Table::~Table ( )

Definition at line 287 of file DS_Table.cpp.

References Clear().

Member Function Documentation

unsigned Table::AddColumn | ( | const char | columnName[_TABLE_MAX_COLUMN_NAME_LENGTH],
 |  | ColumnType | columnType
 | ) |  |

Adds a column to the table.

Parameters
[in] | columnName | The name of the column
[in] | columnType | What type of data this column will hold
Returns
The index of the new column

Definition at line 291 of file DS_Table.cpp.

References _FILE_AND_LINE_, columns, ExtendRows(), DataStructures::BPlusTree< KeyType, DataType, order >::ForEachData(), DataStructures::List< list_type >::Insert(), rows, and DataStructures::List< list_type >::Size().

Referenced by SLNet::TableSerializer::DeserializeColumns(), operator=(), and QueryTable().

Table::Row * Table::AddRow ( unsigned rowId )

Adds a row to the table.

New rows are added with empty values for all cells. However, if you specify initialCelLValues you can specify initial values It's up to you to ensure that the values in the specific cells match the type of data used by that row rowId can be considered the primary key for the row. It is much faster to lookup a row by its rowId than by searching keys. rowId must be unique Rows are stored in sorted order in the table, using rowId as the sort key

Parameters
[in] | rowId | The UNIQUE primary key for the row. This can never be changed.
[in] | initialCellValues | Initial values to give the row (optional)
Returns
The newly added row

Definition at line 359 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Row::cells, columns, DataStructures::List< list_type >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::Insert(), SLNet::OP_DELETE(), rows, and DataStructures::List< list_type >::Size().

Referenced by SLNet::TableSerializer::DeserializeRow(), and operator=().

Table::Row * Table::AddRow | ( | unsigned | rowId,
 |  | DataStructures::List< Cell > & | initialCellValues
 | ) |  |

Definition at line 373 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Row::cells, columns, DataStructures::List< list_type >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::Insert(), rows, DataStructures::Table::Cell::SetByType(), and DataStructures::List< list_type >::Size().

Table::Row * Table::AddRow | ( | unsigned | rowId,
 |  | DataStructures::List< Cell * > & | initialCellValues,
 |  | bool | copyCells = false
 | ) |  |

Definition at line 392 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Row::cells, columns, DataStructures::List< list_type >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::Insert(), rows, and DataStructures::List< list_type >::Size().

Table::Row * Table::AddRowColumns | ( | unsigned | rowId,
 |  | Row * | row,
 |  | DataStructures::List< unsigned > | columnIndices
 | ) |  |
protected

Definition at line 415 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Row::cells, columns, DataStructures::List< list_type >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::Insert(), rows, and DataStructures::List< list_type >::Size().

Referenced by QueryRow().

void Table::Clear ( void )

Frees all memory in the table.

Definition at line 1073 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::BPlusTree< KeyType, DataType, order >::Clear(), DataStructures::List< list_type >::Clear(), columns, DataStructures::BPlusTree< KeyType, DataType, order >::ForEachData(), FreeRow(), and rows.

Referenced by SLNet::TableSerializer::DeserializeColumns(), operator=(), QueryTable(), DataStructures::Table::Cell::Set(), DataStructures::Table::Cell::SetPtr(), DataStructures::Table::Cell::~Cell(), and ~Table().

unsigned Table::ColumnIndex ( char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH] ) const

Gets the index of a column by name.

Column indices are stored in the order they are added.

Parameters
[in] columnName The name of the column
Returns
The index of the column, or (unsigned)-1 if no such column

Definition at line 333 of file DS_Table.cpp.

Referenced by QueryTable().

unsigned Table::ColumnIndex ( const char * columnName ) const

Definition at line 325 of file DS_Table.cpp.

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

char * Table::ColumnName ( unsigned index ) const

Gives the string name of the column at a certain index.

Parameters
[in] index The index of the column
Returns
The name of the column, or 0 if an invalid index

Definition at line 337 of file DS_Table.cpp.

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

Referenced by operator=().

void Table::DeleteRow ( Table::Row * row )
protected

Definition at line 1119 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Row::cells, SLNet::OP_DELETE(), and DataStructures::List< list_type >::Size().

Referenced by RemoveRow().

unsigned Table::GetAvailableRowId ( void ) const

Get the first free row id. This could be made more efficient.

Definition at line 1091 of file DS_Table.cpp.

References DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead(), DataStructures::Page< KeyType, DataType, order >::keys, DataStructures::Page< KeyType, DataType, order >::next, rows, and DataStructures::Page< KeyType, DataType, order >::size.

void Table::GetCellValueByIndex | ( | unsigned | rowIndex,
 |  | unsigned | columnIndex,
 |  | int * | output
 | ) |  |

Note this is much less efficient to call than GetRow, then working with the cells directly. Numeric, string, binary.

Definition at line 534 of file DS_Table.cpp.

References DataStructures::Table::Row::cells, columns, DataStructures::List< list_type >::Get(), GetRowByIndex(), NUMERIC, and RakAssert.

void Table::GetCellValueByIndex | ( | unsigned | rowIndex,
 |  | unsigned | columnIndex,
 |  | char * | output
 | ) |  |

Definition at line 544 of file DS_Table.cpp.

References DataStructures::Table::Row::cells, columns, DataStructures::List< list_type >::Get(), GetRowByIndex(), RakAssert, and STRING.

void Table::GetCellValueByIndex | ( | unsigned | rowIndex,
 |  | unsigned | columnIndex,
 |  | char * | output,
 |  | size_t | outputLength
 | ) |  |

Definition at line 554 of file DS_Table.cpp.

References DataStructures::Table::Row::cells, columns, DataStructures::List< list_type >::Get(), GetRowByIndex(), RakAssert, and STRING.

void Table::GetCellValueByIndex | ( | unsigned | rowIndex,
 |  | unsigned | columnIndex,
 |  | char * | output,
 |  | int * | outputLength
 | ) |  |

Definition at line 564 of file DS_Table.cpp.

References BINARY, DataStructures::Table::Row::cells, columns, DataStructures::List< list_type >::Get(), GetRowByIndex(), and RakAssert.

unsigned Table::GetColumnCount ( void ) const

Returns the number of columns

Returns
The number of columns in the table

Definition at line 351 of file DS_Table.cpp.

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

Referenced by operator=().

const List< Table::ColumnDescriptor > & Table::GetColumns ( void ) const

Direct access to make things easier.

Definition at line 1079 of file DS_Table.cpp.

References columns.

Referenced by SLNet::TableSerializer::DeserializeRow(), SLNet::TableSerializer::SerializeColumns(), and SLNet::TableSerializer::SerializeTable().

Table::ColumnType Table::GetColumnType ( unsigned index ) const

Returns the type of a column, referenced by index.

Parameters
[in] index The index of the column
Returns
The type of the column

Definition at line 344 of file DS_Table.cpp.

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

Referenced by operator=().

DataStructures::Page< unsigned, DataStructures::Table::Row *, _TABLE_BPLUS_TREE_ORDER > * Table::GetListHead ( void )

Get the head of a linked list containing all the row data.

Definition at line 1087 of file DS_Table.cpp.

References DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead(), and rows.

Table::Row * Table::GetRowByID ( unsigned rowId ) const

Gets a row. More efficient to do this and access Row::cells than to repeatedly call GetCell. You can also update cells in rows from this function.

Parameters
[in] rowId The ID of the row
Returns
The desired row, or 0 if no such row.

Definition at line 588 of file DS_Table.cpp.

References DataStructures::BPlusTree< KeyType, DataType, order >::Get(), and rows.

Referenced by UpdateCell().

Table::Row * Table::GetRowByIndex | ( | unsigned | rowIndex,
 |  | unsigned * | key
 | ) |  | const

Gets a row at a specific index. rowIndex should be less than GetRowCount()

Parameters
[in] | rowIndex | The index of the row
[out] | key | The ID of the row returned
Returns
The desired row, or 0 if no such row.

Definition at line 596 of file DS_Table.cpp.

References DataStructures::Page< KeyType, DataType, order >::data, DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead(), DataStructures::Page< KeyType, DataType, order >::keys, DataStructures::Page< KeyType, DataType, order >::next, rows, and DataStructures::Page< KeyType, DataType, order >::size.

Referenced by GetCellValueByIndex(), and UpdateCellByIndex().

unsigned Table::GetRowCount ( void ) const

Returns the number of rows

Returns
The number of rows in the table

Definition at line 355 of file DS_Table.cpp.

References rows, and DataStructures::BPlusTree< KeyType, DataType, order >::Size().

const DataStructures::BPlusTree< unsigned, Table::Row *, _TABLE_BPLUS_TREE_ORDER > & Table::GetRows ( void ) const

Direct access to make things easier.

Definition at line 1083 of file DS_Table.cpp.

References rows.

Referenced by operator=(), RemoveRows(), and SLNet::TableSerializer::SerializeTable().

Table & Table::operator= ( const Table & input )

Definition at line 1128 of file DS_Table.cpp.

References AddColumn(), AddRow(), DataStructures::Table::Row::cells, Clear(), ColumnName(), DataStructures::Page< KeyType, DataType, order >::data, GetColumnCount(), GetColumnType(), DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead(), GetRows(), DataStructures::Page< KeyType, DataType, order >::keys, DataStructures::Page< KeyType, DataType, order >::next, and DataStructures::Page< KeyType, DataType, order >::size.

void Table::PrintColumnHeaders | ( | char * | out,
 |  | int | outLength,
 |  | char | columnDelineator
 | ) |  | const

Prints out the names of all the columns.

Parameters
[out] | out | A pointer to an array of bytes which will hold the output.
[in] | outLength | The size of the out array
[in] | columnDelineator | What character to print to delineate columns

Definition at line 958 of file DS_Table.cpp.

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

void Table::PrintRow | ( | char * | out,
 |  | int | outLength,
 |  | char | columnDelineator,
 |  | bool | printDelineatorForBinary,
 |  | Table::Row * | inputRow
 | ) |  | const

Writes a text representation of the row to out.

Parameters
[out] | out | A pointer to an array of bytes which will hold the output.
[in] | outLength | The size of the out array
[in] | columnDelineator | What character to print to delineate columns
[in] | printDelineatorForBinary | Binary output is not printed. True to still print the delineator.
[in] | inputRow | The row to print

Definition at line 989 of file DS_Table.cpp.

References DataStructures::Table::Row::cells, columns, NUMERIC, POINTER, DataStructures::List< list_type >::Size(), and STRING.

void Table::QueryRow | ( | DataStructures::List< unsigned > & | inclusionFilterColumnIndices,
 |  | DataStructures::List< unsigned > & | columnIndicesToReturn,
 |  | unsigned | key,
 |  | Table::Row * | row,
 |  | FilterQuery * | inclusionFilters,
 |  | Table * | result
 | ) |  |
protected

Definition at line 688 of file DS_Table.cpp.

References AddRowColumns(), BINARY, DataStructures::Table::Cell::c, DataStructures::Table::Row::cells, DataStructures::Table::FilterQuery::cellValue, columns, DataStructures::Table::Cell::i, NUMERIC, POINTER, DataStructures::Table::Cell::ptr, QF_EQUAL, QF_GREATER_THAN, QF_GREATER_THAN_EQ, QF_IS_EMPTY, QF_LESS_THAN, QF_LESS_THAN_EQ, QF_NOT_EMPTY, QF_NOT_EQUAL, RakAssert, DataStructures::List< list_type >::Size(), and STRING.

Referenced by QueryTable().

void Table::QueryTable | ( | unsigned * | columnIndicesSubset,
 |  | unsigned | numColumnSubset,
 |  | FilterQuery * | inclusionFilters,
 |  | unsigned | numInclusionFilters,
 |  | unsigned * | rowIds,
 |  | unsigned | numRowIDs,
 |  | Table * | result
 | ) |  |

Queries the table, optionally returning only a subset of columns and rows.

Parameters
[in] | columnSubset | An array of column indices. Only columns in this array are returned. Pass 0 for all columns
[in] | numColumnSubset | The number of elements in columnSubset
[in] | inclusionFilters | An array of FilterQuery. All filters must pass for the row to be returned.
[in] | numInclusionFilters | The number of elements in inclusionFilters
[in] | rowIds | An arrow of row IDs. Only these rows with these IDs are returned. Pass 0 for all rows.
[in] | numRowIDs | The number of elements in rowIds
[out] | result | The result of the query. If no rows are returned, the table will only have columns.

Definition at line 616 of file DS_Table.cpp.

References _FILE_AND_LINE_, AddColumn(), Clear(), DataStructures::Table::FilterQuery::columnIndex, ColumnIndex(), columns, DataStructures::Page< KeyType, DataType, order >::data, DataStructures::BPlusTree< KeyType, DataType, order >::Get(), DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead(), DataStructures::List< list_type >::Insert(), DataStructures::Page< KeyType, DataType, order >::keys, DataStructures::Page< KeyType, DataType, order >::next, QueryRow(), rows, DataStructures::Page< KeyType, DataType, order >::size, and DataStructures::List< list_type >::Size().

void Table::RemoveColumn ( unsigned columnIndex )

Removes a column by index.

Parameters
[in] columnIndex The index of the column to remove

Definition at line 304 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Row::cells, columns, DataStructures::Page< KeyType, DataType, order >::data, DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead(), DataStructures::Page< KeyType, DataType, order >::next, SLNet::OP_DELETE(), DataStructures::List< list_type >::RemoveAtIndex(), rows, DataStructures::Page< KeyType, DataType, order >::size, and DataStructures::List< list_type >::Size().

bool Table::RemoveRow ( unsigned rowId )

Removes a row specified by rowId.

Parameters
[in] rowId The ID of the row
Returns
true if the row was deleted. False if not.

Definition at line 438 of file DS_Table.cpp.

References DataStructures::BPlusTree< KeyType, DataType, order >::Delete(), DeleteRow(), and rows.

Referenced by SLNet::TableSerializer::DeserializeRow().

void Table::RemoveRows ( Table * tableContainingRowIDs )

Removes all the rows with IDs that the specified table also has.

Parameters
[in] tableContainingRowIDs The IDs of the rows

Definition at line 448 of file DS_Table.cpp.

References DataStructures::BPlusTree< KeyType, DataType, order >::Delete(), DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead(), GetRows(), DataStructures::Page< KeyType, DataType, order >::keys, DataStructures::Page< KeyType, DataType, order >::next, rows, and DataStructures::Page< KeyType, DataType, order >::size.

void Table::SortTable | ( | Table::SortQuery * | sortQueries,
 |  | unsigned | numSortQueries,
 |  | Table::Row ** | out
 | ) |  |

Sorts the table by rows.

You can sort the table in ascending or descending order on one or more columns Columns have precedence in the order they appear in the sortQueries array If a row cell on column n has the same value as a a different row on column n, then the row will be compared on column n+1

Parameters
[in] | sortQueries | A list of SortQuery structures, defining the sorts to perform on the table
[in] | numColumnSubset | The number of elements in numSortQueries
[out] | out | The address of an array of Rows, which will receive the sorted output. The array must be long enough to contain all returned rows, up to GetRowCount()

Definition at line 904 of file DS_Table.cpp.

References _columnIndices, _columns, _FILE_AND_LINE_, _numSortQueries, _sortQueries, BINARY, DataStructures::Table::SortQuery::columnIndex, columns, DataStructures::Page< KeyType, DataType, order >::data, DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead(), DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Insert(), DataStructures::List< list_type >::Insert(), DataStructures::Page< KeyType, DataType, order >::next, RakAssert, rows, DataStructures::Page< KeyType, DataType, order >::size, DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Size(), and DataStructures::List< list_type >::Size().

bool Table::UpdateCell | ( | unsigned | rowId,
 |  | unsigned | columnIndex,
 |  | int | value
 | ) |  |

Updates a particular cell in the table.

Note
If you are going to update many cells of a particular row, it is more efficient to call GetRow and perform the operations on the row directly.
Row pointers do not change, so you can also write directly to the rows for more efficiency.
Parameters
[in] | rowId | The ID of the row
[in] | columnIndex | The column of the cell
[in] | value | The data to set

Definition at line 462 of file DS_Table.cpp.

References columns, GetRowByID(), NUMERIC, RakAssert, and DataStructures::Table::Row::UpdateCell().

bool Table::UpdateCell | ( | unsigned | rowId,
 |  | unsigned | columnIndex,
 |  | char * | str
 | ) |  |

Definition at line 474 of file DS_Table.cpp.

References columns, GetRowByID(), RakAssert, STRING, and DataStructures::Table::Row::UpdateCell().

bool Table::UpdateCell | ( | unsigned | rowId,
 |  | unsigned | columnIndex,
 |  | int | byteLength,
 |  | char * | data
 | ) |  |

Definition at line 486 of file DS_Table.cpp.

References BINARY, columns, GetRowByID(), RakAssert, and DataStructures::Table::Row::UpdateCell().

bool Table::UpdateCellByIndex | ( | unsigned | rowIndex,
 |  | unsigned | columnIndex,
 |  | int | value
 | ) |  |

Definition at line 498 of file DS_Table.cpp.

References columns, GetRowByIndex(), NUMERIC, RakAssert, and DataStructures::Table::Row::UpdateCell().

bool Table::UpdateCellByIndex | ( | unsigned | rowIndex,
 |  | unsigned | columnIndex,
 |  | char * | str
 | ) |  |

Definition at line 510 of file DS_Table.cpp.

References columns, GetRowByIndex(), RakAssert, STRING, and DataStructures::Table::Row::UpdateCell().

bool Table::UpdateCellByIndex | ( | unsigned | rowIndex,
 |  | unsigned | columnIndex,
 |  | int | byteLength,
 |  | char * | data
 | ) |  |

Definition at line 522 of file DS_Table.cpp.

References BINARY, columns, GetRowByIndex(), RakAssert, and DataStructures::Table::Row::UpdateCell().

Member Data Documentation

DataStructures::List<ColumnDescriptor> DataStructures::Table::columns
protected

Definition at line 346 of file DS_Table.h.

Referenced by AddColumn(), AddRow(), AddRowColumns(), Clear(), ColumnIndex(), ColumnName(), GetCellValueByIndex(), GetColumnCount(), GetColumns(), GetColumnType(), PrintColumnHeaders(), PrintRow(), QueryRow(), QueryTable(), RemoveColumn(), SortTable(), UpdateCell(), and UpdateCellByIndex().

DataStructures::BPlusTree<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> DataStructures::Table::rows
protected

Definition at line 343 of file DS_Table.h.

Referenced by AddColumn(), AddRow(), AddRowColumns(), Clear(), GetAvailableRowId(), GetListHead(), GetRowByID(), GetRowByIndex(), GetRowCount(), GetRows(), QueryTable(), RemoveColumn(), RemoveRow(), RemoveRows(), and SortTable().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/DS_Table.h
  • Source/src/DS_Table.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Table::Cell Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
  • Cell
Public Member Functions | Public Attributes | List of all members
DataStructures::Table::Cell Struct Reference

Holds the actual data in the table. More...

#include <slikenet/DS_Table.h>

Public Member Functions

Cell ()
~Cell ()
Cell (double numericValue, char *charValue, void *ptr, ColumnType type)
void | SetByType (double numericValue, char *charValue, void *inPtr, ColumnType type)
void | Clear (void)
void | Set (int input)
Numeric.
void | Set (unsigned int input)
void | Set (double input)
void | Set (const char *input)
String.
void | Set (const char *input, int inputLength)
Binary.
void | SetPtr (void *p)
Pointer.
void | Get (int *output)
Numeric.
void | Get (double *output)
void | Get (char *output)
String.
void | Get (char *output, size_t outputLength)
void | Get (char *output, int *outputLength)
Binary.
SLNet::RakString | ToString (ColumnType columnType)
Cell & | operator= (const Cell &input)
Cell (const Cell &input)
ColumnType | EstimateColumnType (void) const

Public Attributes

bool | isEmpty
double | i
char * | c
void * | ptr

Detailed Description

Holds the actual data in the table.

Definition at line 64 of file DS_Table.h.

Constructor & Destructor Documentation

Table::Cell::Cell ( )

Definition at line 43 of file DS_Table.cpp.

References c, i, isEmpty, and ptr.

Table::Cell::~Cell ( )

Definition at line 50 of file DS_Table.cpp.

References DataStructures::Table::Clear().

Table::Cell::Cell | ( | double | numericValue,
 |  | char * | charValue,
 |  | void * | ptr,
 |  | ColumnType | type
 | ) |  |

Definition at line 201 of file DS_Table.cpp.

Table::Cell::Cell ( const Cell & input )

Definition at line 70 of file DS_Table.cpp.

References _FILE_AND_LINE_, c, i, isEmpty, ptr, rakFree_Ex, and rakMalloc_Ex.

Member Function Documentation

void Table::Cell::Clear ( void )

Definition at line 243 of file DS_Table.cpp.

References _FILE_AND_LINE_, and rakFree_Ex.

Referenced by SLNet::TableSerializer::DeserializeCell(), and SLNet::TableSerializer::DeserializeFilterQuery().

Table::ColumnType Table::Cell::EstimateColumnType ( void ) const

Definition at line 229 of file DS_Table.cpp.

References DataStructures::Table::BINARY, DataStructures::Table::NUMERIC, DataStructures::Table::POINTER, and DataStructures::Table::STRING.

void Table::Cell::Get ( int * output )

Numeric.

Definition at line 146 of file DS_Table.cpp.

References RakAssert.

void Table::Cell::Get ( double * output )

Definition at line 152 of file DS_Table.cpp.

References RakAssert.

void Table::Cell::Get ( char * output )

String.

Definition at line 157 of file DS_Table.cpp.

References RakAssert.

void Table::Cell::Get | ( | char * | output,
 |  | size_t | outputLength
 | ) |  |

Definition at line 165 of file DS_Table.cpp.

References RakAssert.

void Table::Cell::Get | ( | char * | output,
 |  | int * | outputLength
 | ) |  |

Binary.

Definition at line 170 of file DS_Table.cpp.

References RakAssert.

Table::Cell & Table::Cell::operator= ( const Cell & input )

Definition at line 54 of file DS_Table.cpp.

References _FILE_AND_LINE_, c, i, isEmpty, ptr, rakFree_Ex, and rakMalloc_Ex.

void Table::Cell::Set ( int input )

Numeric.

Definition at line 95 of file DS_Table.cpp.

References DataStructures::Table::Clear().

Referenced by SLNet::TableSerializer::DeserializeCell().

void Table::Cell::Set ( unsigned int input )

Definition at line 91 of file DS_Table.cpp.

void Table::Cell::Set ( double input )

Definition at line 83 of file DS_Table.cpp.

References DataStructures::Table::Clear().

void Table::Cell::Set ( const char * input )

String.

Definition at line 104 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Clear(), and rakMalloc_Ex.

void Table::Cell::Set | ( | const char * | input,
 |  | int | inputLength
 | ) |  |

Binary.

Definition at line 122 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Clear(), and rakMalloc_Ex.

void Table::Cell::SetByType | ( | double | numericValue,
 |  | char * | charValue,
 |  | void * | inPtr,
 |  | ColumnType | type
 | ) |  |

Definition at line 205 of file DS_Table.cpp.

References DataStructures::Table::BINARY, DataStructures::Table::NUMERIC, DataStructures::Table::POINTER, and DataStructures::Table::STRING.

Referenced by DataStructures::Table::AddRow().

void Table::Cell::SetPtr ( void * p )

Pointer.

Definition at line 139 of file DS_Table.cpp.

References DataStructures::Table::Clear().

Referenced by SLNet::TableSerializer::DeserializeCell().

SLNet::RakString Table::Cell::ToString ( ColumnType columnType )

Definition at line 177 of file DS_Table.cpp.

References DataStructures::Table::BINARY, DataStructures::Table::NUMERIC, DataStructures::Table::POINTER, and DataStructures::Table::STRING.

Member Data Documentation

char* DataStructures::Table::Cell::c

Definition at line 107 of file DS_Table.h.

Referenced by Cell(), SLNet::TableSerializer::DeserializeFilterQuery(), operator=(), DataStructures::Table::QueryRow(), SLNet::TableSerializer::SerializeCell(), and SLNet::TableSerializer::SerializeFilterQuery().

double DataStructures::Table::Cell::i

Definition at line 106 of file DS_Table.h.

Referenced by Cell(), SLNet::TableSerializer::DeserializeFilterQuery(), operator=(), DataStructures::Table::QueryRow(), SLNet::TableSerializer::SerializeCell(), and SLNet::TableSerializer::SerializeFilterQuery().

bool DataStructures::Table::Cell::isEmpty

Definition at line 105 of file DS_Table.h.

Referenced by Cell(), SLNet::TableSerializer::DeserializeFilterQuery(), operator=(), SLNet::TableSerializer::SerializeCell(), and SLNet::TableSerializer::SerializeFilterQuery().

void* DataStructures::Table::Cell::ptr

Definition at line 108 of file DS_Table.h.

Referenced by Cell(), SLNet::TableSerializer::DeserializeFilterQuery(), operator=(), DataStructures::Table::QueryRow(), SLNet::TableSerializer::SerializeCell(), and SLNet::TableSerializer::SerializeFilterQuery().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/DS_Table.h
  • Source/src/DS_Table.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Table::ColumnDescriptor Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
  • ColumnDescriptor
Public Member Functions | Public Attributes | List of all members
DataStructures::Table::ColumnDescriptor Struct Reference

#include <slikenet/DS_Table.h>

Public Member Functions

ColumnDescriptor ()
~ColumnDescriptor ()
ColumnDescriptor (const char cn[_TABLE_MAX_COLUMN_NAME_LENGTH], ColumnType ct)

Public Attributes

char columnName [_TABLE_MAX_COLUMN_NAME_LENGTH]
ColumnType columnType

Detailed Description

Stores the name and type of the column

Definition at line 114 of file DS_Table.h.

Constructor & Destructor Documentation

Table::ColumnDescriptor::ColumnDescriptor ( )

Definition at line 252 of file DS_Table.cpp.

Table::ColumnDescriptor::~ColumnDescriptor ( )

Definition at line 256 of file DS_Table.cpp.

Table::ColumnDescriptor::ColumnDescriptor | ( | const char | cn[_TABLE_MAX_COLUMN_NAME_LENGTH],
 |  | ColumnType | ct
 | ) |  |

Definition at line 260 of file DS_Table.cpp.

Member Data Documentation

char DataStructures::Table::ColumnDescriptor::columnName[_TABLE_MAX_COLUMN_NAME_LENGTH]

Definition at line 120 of file DS_Table.h.

ColumnType DataStructures::Table::ColumnDescriptor::columnType

Definition at line 121 of file DS_Table.h.

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/DS_Table.h
  • Source/src/DS_Table.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Table::FilterQuery Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
  • FilterQuery
Public Member Functions | Public Attributes | List of all members
DataStructures::Table::FilterQuery Struct Reference

#include <slikenet/DS_Table.h>

Public Member Functions

FilterQuery ()
~FilterQuery ()
FilterQuery (unsigned column, Cell *cell, FilterQueryType op)

Public Attributes

char | columnName [_TABLE_MAX_COLUMN_NAME_LENGTH]
unsigned | columnIndex
Cell * cellValue
FilterQueryType operation

Detailed Description

Definition at line 156 of file DS_Table.h.

Constructor & Destructor Documentation

Table::FilterQuery::FilterQuery ( )

Definition at line 574 of file DS_Table.cpp.

Table::FilterQuery::~FilterQuery ( )

Definition at line 578 of file DS_Table.cpp.

Table::FilterQuery::FilterQuery | ( | unsigned | column,
 |  | Cell * | cell,
 |  | FilterQueryType | op
 | ) |  |

Definition at line 582 of file DS_Table.cpp.

Member Data Documentation

Cell* DataStructures::Table::FilterQuery::cellValue

Definition at line 165 of file DS_Table.h.

Referenced by SLNet::TableSerializer::DeserializeFilterQuery(), SLNet::TableSerializer::DeserializeFilterQueryList(), DataStructures::Table::QueryRow(), and SLNet::TableSerializer::SerializeFilterQuery().

unsigned DataStructures::Table::FilterQuery::columnIndex

Definition at line 164 of file DS_Table.h.

Referenced by SLNet::TableSerializer::DeserializeFilterQuery(), DataStructures::Table::QueryTable(), and SLNet::TableSerializer::SerializeFilterQuery().

char DataStructures::Table::FilterQuery::columnName[_TABLE_MAX_COLUMN_NAME_LENGTH]

Definition at line 163 of file DS_Table.h.

Referenced by SLNet::TableSerializer::DeserializeFilterQuery(), and SLNet::TableSerializer::SerializeFilterQuery().

FilterQueryType DataStructures::Table::FilterQuery::operation

Definition at line 166 of file DS_Table.h.

Referenced by SLNet::TableSerializer::DeserializeFilterQuery(), and SLNet::TableSerializer::SerializeFilterQuery().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/DS_Table.h
  • Source/src/DS_Table.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Table::Row Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
  • Row
Public Member Functions | Public Attributes | List of all members
DataStructures::Table::Row Struct Reference

Stores the list of cells for this row, and a special flag used for internal sorting. More...

#include <slikenet/DS_Table.h>

Public Member Functions

void | UpdateCell (unsigned columnIndex, double value)
Numeric.
void | UpdateCell (unsigned columnIndex, const char *str)
String.
void | UpdateCell (unsigned columnIndex, int byteLength, const char *data)
Binary.

Public Attributes

DataStructures::List< Cell * > cells

Detailed Description

Stores the list of cells for this row, and a special flag used for internal sorting.

Definition at line 126 of file DS_Table.h.

Member Function Documentation

void Table::Row::UpdateCell | ( | unsigned | columnIndex,
 |  | double | value
 | ) |  |

Numeric.

Definition at line 265 of file DS_Table.cpp.

Referenced by DataStructures::Table::UpdateCell(), and DataStructures::Table::UpdateCellByIndex().

void Table::Row::UpdateCell | ( | unsigned | columnIndex,
 |  | const char * | str
 | ) |  |

String.

Definition at line 274 of file DS_Table.cpp.

void Table::Row::UpdateCell | ( | unsigned | columnIndex,
 |  | int | byteLength,
 |  | const char * | data
 | ) |  |

Binary.

Definition at line 279 of file DS_Table.cpp.

Member Data Documentation

DataStructures::List<Cell*> DataStructures::Table::Row::cells

Definition at line 129 of file DS_Table.h.

Referenced by DataStructures::Table::AddRow(), DataStructures::Table::AddRowColumns(), DataStructures::Table::DeleteRow(), SLNet::TableSerializer::DeserializeRow(), ExtendRows(), FreeRow(), DataStructures::Table::GetCellValueByIndex(), DataStructures::Table::operator=(), DataStructures::Table::PrintRow(), DataStructures::Table::QueryRow(), DataStructures::Table::RemoveColumn(), RowSort(), and SLNet::TableSerializer::SerializeRow().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/DS_Table.h
  • Source/src/DS_Table.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::ThreadsafeAllocatingQueue< structureType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • ThreadsafeAllocatingQueue
Public Member Functions | Protected Attributes | List of all members
DataStructures::ThreadsafeAllocatingQueue< structureType > Class Template Reference

#include <slikenet/DS_ThreadsafeAllocatingQueue.h>

+ Inheritance diagram for DataStructures::ThreadsafeAllocatingQueue< structureType >:

Public Member Functions

void | Push (structureType *s)
structureType * | PopInaccurate (void)
structureType * | Pop (void)
void | SetPageSize (int size)
bool | IsEmpty (void)
structureType * | operator[] (unsigned int position)
void | RemoveAtIndex (unsigned int position)
unsigned int | Size (void)
structureType * | Allocate (const char *file, unsigned int line)
void | Deallocate (structureType *s, const char *file, unsigned int line)
void | Clear (const char *file, unsigned int line)

Protected Attributes

MemoryPool< structureType > | memoryPool
SLNet::SimpleMutex memoryPoolMutex
Queue< structureType * > | queue
SLNet::SimpleMutex queueMutex

Detailed Description

template<class structureType>
class DataStructures::ThreadsafeAllocatingQueue< structureType >

Definition at line 37 of file DS_ThreadsafeAllocatingQueue.h.

Member Function Documentation

template<class structureType >
structureType * DataStructures::ThreadsafeAllocatingQueue< structureType >::Allocate | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 101 of file DS_ThreadsafeAllocatingQueue.h.

Referenced by SLNet::RakPeer::ChangeSystemAddress(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

template<class structureType >
void DataStructures::ThreadsafeAllocatingQueue< structureType >::Clear | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 122 of file DS_ThreadsafeAllocatingQueue.h.

Referenced by SLNet::RakPeer::ClearBufferedCommands(), and SLNet::RakPeer::ClearSocketQueryOutput().

template<class structureType>
void DataStructures::ThreadsafeAllocatingQueue< structureType >::Deallocate | ( | structureType * | s,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 112 of file DS_ThreadsafeAllocatingQueue.h.

Referenced by SLNet::RakPeer::ClearBufferedCommands(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendBuffered().

template<class structureType >
bool DataStructures::ThreadsafeAllocatingQueue< structureType >::IsEmpty ( void )

Definition at line 144 of file DS_ThreadsafeAllocatingQueue.h.

template<class structureType >
structureType * DataStructures::ThreadsafeAllocatingQueue< structureType >::operator[] ( unsigned int position )

Definition at line 154 of file DS_ThreadsafeAllocatingQueue.h.

template<class structureType >
structureType * DataStructures::ThreadsafeAllocatingQueue< structureType >::Pop ( void )

Definition at line 86 of file DS_ThreadsafeAllocatingQueue.h.

Referenced by SLNet::RakPeer::ClearBufferedCommands(), SLNet::RakPeer::GetSocket(), and SLNet::RakPeer::GetSockets().

template<class structureType >
structureType * DataStructures::ThreadsafeAllocatingQueue< structureType >::PopInaccurate ( void )

Definition at line 71 of file DS_ThreadsafeAllocatingQueue.h.

Referenced by SLNet::RakPeer::RunUpdateCycle().

template<class structureType>
void DataStructures::ThreadsafeAllocatingQueue< structureType >::Push ( structureType * s )

Definition at line 63 of file DS_ThreadsafeAllocatingQueue.h.

References _FILE_AND_LINE_.

Referenced by SLNet::RakPeer::ChangeSystemAddress(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

template<class structureType >
void DataStructures::ThreadsafeAllocatingQueue< structureType >::RemoveAtIndex ( unsigned int position )

Definition at line 164 of file DS_ThreadsafeAllocatingQueue.h.

template<class structureType >
void DataStructures::ThreadsafeAllocatingQueue< structureType >::SetPageSize ( int size )

Definition at line 138 of file DS_ThreadsafeAllocatingQueue.h.

template<class structureType >
unsigned int DataStructures::ThreadsafeAllocatingQueue< structureType >::Size ( void )

Definition at line 172 of file DS_ThreadsafeAllocatingQueue.h.

Member Data Documentation

template<class structureType>
MemoryPool<structureType> DataStructures::ThreadsafeAllocatingQueue< structureType >::memoryPool
mutableprotected

Definition at line 56 of file DS_ThreadsafeAllocatingQueue.h.

template<class structureType>
SLNet::SimpleMutex DataStructures::ThreadsafeAllocatingQueue< structureType >::memoryPoolMutex
protected

Definition at line 57 of file DS_ThreadsafeAllocatingQueue.h.

template<class structureType>
Queue<structureType*> DataStructures::ThreadsafeAllocatingQueue< structureType >::queue
protected

Definition at line 58 of file DS_ThreadsafeAllocatingQueue.h.

template<class structureType>
SLNet::SimpleMutex DataStructures::ThreadsafeAllocatingQueue< structureType >::queueMutex
protected

Definition at line 59 of file DS_ThreadsafeAllocatingQueue.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_ThreadsafeAllocatingQueue.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::Tree< TreeType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Tree
Public Member Functions | Public Attributes | List of all members
DataStructures::Tree< TreeType > Class Template Reference

#include <slikenet/DS_Tree.h>

+ Inheritance diagram for DataStructures::Tree< TreeType >:

Public Member Functions

Tree ()
Tree (TreeType &inputData)
~Tree ()
void | LevelOrderTraversal (DataStructures::List< Tree * > &output)
void | AddChild (TreeType &newData)
void | DeleteDecendants (void)

Public Attributes

TreeType data
DataStructures::List< Tree * > children

Detailed Description

template<class TreeType>
class DataStructures::Tree< TreeType >

Definition at line 36 of file DS_Tree.h.

Constructor & Destructor Documentation

template<class TreeType >
DataStructures::Tree< TreeType >::Tree ( )

Definition at line 51 of file DS_Tree.h.

template<class TreeType>
DataStructures::Tree< TreeType >::Tree ( TreeType & inputData )

Definition at line 57 of file DS_Tree.h.

References inputData.

template<class TreeType >
DataStructures::Tree< TreeType >::~Tree ( )

Definition at line 63 of file DS_Tree.h.

Member Function Documentation

template<class TreeType>
void DataStructures::Tree< TreeType >::AddChild ( TreeType & newData )

Definition at line 88 of file DS_Tree.h.

References _FILE_AND_LINE_.

template<class TreeType >
void DataStructures::Tree< TreeType >::DeleteDecendants ( void )

Definition at line 94 of file DS_Tree.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE().

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().

template<class TreeType >
void DataStructures::Tree< TreeType >::LevelOrderTraversal ( DataStructures::List< Tree< TreeType > * > & output )

Definition at line 69 of file DS_Tree.h.

References _FILE_AND_LINE_, DataStructures::Tree< TreeType >::children, DataStructures::List< list_type >::Insert(), DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Push(), DataStructures::Queue< queue_type >::Size(), and DataStructures::List< list_type >::Size().

Member Data Documentation

template<class TreeType>
DataStructures::List<Tree *> DataStructures::Tree< TreeType >::children

Definition at line 47 of file DS_Tree.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), and DataStructures::Tree< TreeType >::LevelOrderTraversal().

template<class TreeType>
TreeType DataStructures::Tree< TreeType >::data

Definition at line 46 of file DS_Tree.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_Tree.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • WeightedGraph
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > Class Template Reference

#include <slikenet/DS_WeightedGraph.h>

Classes

struct NodeAndParent

Public Member Functions

WeightedGraph ()
~WeightedGraph ()
WeightedGraph (const WeightedGraph &original_copy)
WeightedGraph & | operator= (const WeightedGraph &original_copy)
void | AddNode (const node_type &node)
void | RemoveNode (const node_type &node)
void | AddConnection (const node_type &node1, const node_type &node2, weight_type weight)
void | RemoveConnection (const node_type &node1, const node_type &node2)
bool | HasConnection (const node_type &node1, const node_type &node2)
void | Print (void)
void | Clear (void)
bool | GetShortestPath (DataStructures::List< node_type > &path, node_type startNode, node_type endNode, weight_type INFINITE_WEIGHT)
bool | GetSpanningTree (DataStructures::Tree< node_type > &outTree, DataStructures::List< node_type > *inputNodes, node_type startNode, weight_type INFINITE_WEIGHT)
unsigned | GetNodeCount (void) const
unsigned | GetConnectionCount (unsigned nodeIndex) const
void | GetConnectionAtIndex (unsigned nodeIndex, unsigned connectionIndex, node_type &outNode, weight_type &outWeight) const
node_type | GetNodeAtIndex (unsigned nodeIndex) const

Static Public Member Functions

static void IMPLEMENT_DEFAULT_COMPARISON (void)

Protected Member Functions

void | ClearDijkstra (void)
void | GenerateDisjktraMatrix (node_type startNode, weight_type INFINITE_WEIGHT)

Protected Attributes

DataStructures::Map< node_type,
DataStructures::Map< node_type,
weight_type > * > 		adjacencyLists
bool | isValidPath
node_type | rootNode
DataStructures::OrderedList
< node_type, node_type > 		costMatrixIndices
weight_type * | costMatrix
node_type * | leastNodeArray

Detailed Description

template<class node_type, class weight_type, bool allow_unlinkedNodes>
class DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >

Definition at line 46 of file DS_WeightedGraph.h.

Class Documentation

struct DataStructures::WeightedGraph::NodeAndParent

template<class node_type, class weight_type, bool allow_unlinkedNodes>
struct DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent

Definition at line 86 of file DS_WeightedGraph.h.

Class Members
Tree< node_type > * | node
Tree< node_type > * | parent

Constructor & Destructor Documentation

template<class node_type , class weight_type , bool allow_unlinkedNodes>
DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::WeightedGraph ( )

Definition at line 94 of file DS_WeightedGraph.h.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::~WeightedGraph ( )

Definition at line 101 of file DS_WeightedGraph.h.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::WeightedGraph ( const WeightedGraph< node_type, weight_type, allow_unlinkedNodes > & original_copy )

Definition at line 107 of file DS_WeightedGraph.h.

References _FILE_AND_LINE_, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::adjacencyLists, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::costMatrix, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::costMatrixIndices, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::isValidPath, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::leastNodeArray, and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::rootNode.

Member Function Documentation

template<class node_type , class weight_type , bool allow_unlinkedNodes>
void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::AddConnection | ( | const node_type & | node1,
 |  | const node_type & | node2,
 |  | weight_type | weight
 | ) |  |

Definition at line 186 of file DS_WeightedGraph.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().

template<class node_type , class weight_type , bool allow_unlinkedNodes>
void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::AddNode ( const node_type & node )

Definition at line 143 of file DS_WeightedGraph.h.

References _FILE_AND_LINE_, and SLNet::OP_NEW().

template<class node_type , class weight_type , bool allow_unlinkedNodes>
void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::Clear ( void )

Definition at line 220 of file DS_WeightedGraph.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE().

template<class node_type , class weight_type , bool allow_unlinkedNodes>
void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::ClearDijkstra ( void )
protected

Definition at line 506 of file DS_WeightedGraph.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE_ARRAY().

template<class node_type , class weight_type , bool allow_unlinkedNodes>
void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix | ( | node_type | startNode,
 |  | weight_type | INFINITE_WEIGHT
 | ) |  |
protected

Definition at line 398 of file DS_WeightedGraph.h.

References _FILE_AND_LINE_, DataStructures::Heap< weight_type, data_type, isMaxHeap >::Clear(), DataStructures::Map< key_type, data_type, key_comparison_func >::Delete(), DataStructures::Map< key_type, data_type, key_comparison_func >::Get(), DataStructures::Map< key_type, data_type, key_comparison_func >::GetIndexAtKey(), DataStructures::Map< key_type, data_type, key_comparison_func >::GetKeyAtIndex(), DataStructures::Heap< weight_type, data_type, isMaxHeap >::PeekWeight(), DataStructures::Heap< weight_type, data_type, isMaxHeap >::Pop(), DataStructures::Heap< weight_type, data_type, isMaxHeap >::Push(), DataStructures::Map< key_type, data_type, key_comparison_func >::Set(), DataStructures::Heap< weight_type, data_type, isMaxHeap >::Size(), and DataStructures::Map< key_type, data_type, key_comparison_func >::Size().

template<class node_type , class weight_type , bool allow_unlinkedNodes>
void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetConnectionAtIndex | ( | unsigned | nodeIndex,
 |  | unsigned | connectionIndex,
 |  | node_type & | outNode,
 |  | weight_type & | outWeight
 | ) |  | const

Definition at line 325 of file DS_WeightedGraph.h.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
unsigned DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetConnectionCount ( unsigned nodeIndex ) const

Definition at line 319 of file DS_WeightedGraph.h.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
node_type DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetNodeAtIndex ( unsigned nodeIndex ) const

Definition at line 307 of file DS_WeightedGraph.h.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
unsigned DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetNodeCount ( void ) const

Definition at line 313 of file DS_WeightedGraph.h.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
bool DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath | ( | DataStructures::List< node_type > & | path,
 |  | node_type | startNode,
 |  | node_type | endNode,
 |  | weight_type | INFINITE_WEIGHT
 | ) |  |

Definition at line 231 of file DS_WeightedGraph.h.

References _FILE_AND_LINE_, DataStructures::List< list_type >::Clear(), DataStructures::List< list_type >::Insert(), DataStructures::Queue< queue_type >::IsEmpty(), DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::PushAtHead(), and DataStructures::Queue< queue_type >::Size().

template<class node_type , class weight_type , bool allow_unlinkedNodes>
bool DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree | ( | DataStructures::Tree< node_type > & | outTree,
 |  | DataStructures::List< node_type > * | inputNodes,
 |  | node_type | startNode,
 |  | weight_type | INFINITE_WEIGHT
 | ) |  |

Definition at line 332 of file DS_WeightedGraph.h.

References _FILE_AND_LINE_, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::AddConnection(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::adjacencyLists, DataStructures::Tree< TreeType >::children, DataStructures::Tree< TreeType >::data, DataStructures::Tree< TreeType >::DeleteDecendants(), DataStructures::Map< key_type, data_type, key_comparison_func >::Get(), DataStructures::Map< key_type, data_type, key_comparison_func >::GetKeyAtIndex(), DataStructures::Map< key_type, data_type, key_comparison_func >::Has(), DataStructures::List< list_type >::Insert(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent::node, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent::parent, DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Push(), DataStructures::Queue< queue_type >::Size(), DataStructures::Map< key_type, data_type, key_comparison_func >::Size(), and DataStructures::List< list_type >::Size().

template<class node_type , class weight_type , bool allow_unlinkedNodes>
bool DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::HasConnection | ( | const node_type & | node1,
 |  | const node_type & | node2
 | ) |  |

Definition at line 176 of file DS_WeightedGraph.h.

template<class node_type, class weight_type, bool allow_unlinkedNodes>
static void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::IMPLEMENT_DEFAULT_COMPARISON ( void )
inlinestatic

Definition at line 49 of file DS_WeightedGraph.h.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
WeightedGraph< node_type, weight_type, allow_unlinkedNodes > & DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::operator= ( const WeightedGraph< node_type, weight_type, allow_unlinkedNodes > & original_copy )

Definition at line 124 of file DS_WeightedGraph.h.

References _FILE_AND_LINE_, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::adjacencyLists, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::costMatrix, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::costMatrixIndices, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::isValidPath, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::leastNodeArray, and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::rootNode.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::Print ( void )

Definition at line 518 of file DS_WeightedGraph.h.

References RAKNET_DEBUG_PRINTF.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::RemoveConnection | ( | const node_type & | node1,
 |  | const node_type & | node2
 | ) |  |

Definition at line 200 of file DS_WeightedGraph.h.

template<class node_type , class weight_type , bool allow_unlinkedNodes>
void DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::RemoveNode ( const node_type & node )

Definition at line 149 of file DS_WeightedGraph.h.

References _FILE_AND_LINE_, SLNet::OP_DELETE(), DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Push(), and DataStructures::Queue< queue_type >::Size().

Member Data Documentation

template<class node_type, class weight_type, bool allow_unlinkedNodes>
DataStructures::Map<node_type, DataStructures::Map<node_type, weight_type> *> DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::adjacencyLists
protected

Definition at line 73 of file DS_WeightedGraph.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::operator=(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::WeightedGraph().

template<class node_type, class weight_type, bool allow_unlinkedNodes>
weight_type* DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::costMatrix
protected

Definition at line 82 of file DS_WeightedGraph.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::operator=(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::WeightedGraph().

template<class node_type, class weight_type, bool allow_unlinkedNodes>
DataStructures::OrderedList<node_type, node_type> DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::costMatrixIndices
protected

Definition at line 81 of file DS_WeightedGraph.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::operator=(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::WeightedGraph().

template<class node_type, class weight_type, bool allow_unlinkedNodes>
bool DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::isValidPath
protected

Definition at line 79 of file DS_WeightedGraph.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::operator=(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::WeightedGraph().

template<class node_type, class weight_type, bool allow_unlinkedNodes>
node_type* DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::leastNodeArray
protected

Definition at line 83 of file DS_WeightedGraph.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::operator=(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::WeightedGraph().

template<class node_type, class weight_type, bool allow_unlinkedNodes>
node_type DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::rootNode
protected

Definition at line 80 of file DS_WeightedGraph.h.

Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::operator=(), and DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::WeightedGraph().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_WeightedGraph.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: DataStructures::SingleProducerConsumer< SingleProducerConsumerType > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • SingleProducerConsumer
Classes | Public Member Functions | List of all members
DataStructures::SingleProducerConsumer< SingleProducerConsumerType > Class Template Reference

A single producer consumer implementation without critical sections. More...

#include <slikenet/SingleProducerConsumer.h>

+ Inheritance diagram for DataStructures::SingleProducerConsumer< SingleProducerConsumerType >:

Public Member Functions

SingleProducerConsumer ()
~SingleProducerConsumer ()
SingleProducerConsumerType * | WriteLock (void)
void | CancelWriteLock (SingleProducerConsumerType *cancelToLocation)
void | WriteUnlock (void)
Call when you are done writing to a block of memory returned by WriteLock()
SingleProducerConsumerType * | ReadLock (void)
void | CancelReadLock (SingleProducerConsumerType *cancelToLocation)
param[in] Which ReadLock() to cancel.
void | ReadUnlock (void)
void | Clear (void)
Clear is not thread-safe and none of the lock or unlock functions should be called while it is running.
int | Size (void) const
bool | CheckReadUnlockOrder (const SingleProducerConsumerType *data) const
bool | ReadIsLocked (void) const

Detailed Description

template<class SingleProducerConsumerType>
class DataStructures::SingleProducerConsumer< SingleProducerConsumerType >

A single producer consumer implementation without critical sections.

Definition at line 38 of file SingleProducerConsumer.h.

Constructor & Destructor Documentation

template<class SingleProducerConsumerType >
DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::SingleProducerConsumer ( )

Definition at line 105 of file SingleProducerConsumer.h.

References _FILE_AND_LINE_, MINIMUM_LIST_SIZE, and RakAssert.

template<class SingleProducerConsumerType >
DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::~SingleProducerConsumer ( )

Definition at line 128 of file SingleProducerConsumer.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE().

Member Function Documentation

template<class SingleProducerConsumerType>
void DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::CancelReadLock ( SingleProducerConsumerType * cancelToLocation )

param[in] Which ReadLock() to cancel.

Definition at line 198 of file SingleProducerConsumer.h.

References RakAssert.

template<class SingleProducerConsumerType>
void DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::CancelWriteLock ( SingleProducerConsumerType * cancelToLocation )

Call if you don't want to write to a block of data from WriteLock() after all. Cancelling locks cancels all locks back up to the data passed. So if you lock twice and cancel using the first lock, the second lock is ignored

Parameters
[in] cancelToLocation Which WriteLock() to cancel.

Definition at line 161 of file SingleProducerConsumer.h.

template<class SingleProducerConsumerType>
bool DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::CheckReadUnlockOrder ( const SingleProducerConsumerType * data ) const

Make sure that the pointer we done reading for the call to ReadUnlock is the right pointer. param[in] A previous pointer returned by ReadLock()

Definition at line 259 of file SingleProducerConsumer.h.

template<class SingleProducerConsumerType >
void DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::Clear ( void )

Clear is not thread-safe and none of the lock or unlock functions should be called while it is running.

Definition at line 221 of file SingleProducerConsumer.h.

References _FILE_AND_LINE_, MINIMUM_LIST_SIZE, SLNet::OP_DELETE(), and RakAssert.

template<class SingleProducerConsumerType >
bool DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::ReadIsLocked ( void ) const

Returns if ReadUnlock was called before ReadLock

Returns
If the read is locked

Definition at line 266 of file SingleProducerConsumer.h.

template<class SingleProducerConsumerType >
SingleProducerConsumerType * DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::ReadLock ( void )

ReadLock must be immediately followed by ReadUnlock. These two functions must be called in the same thread.

Return values
0 | No data is availble to read
Non-zero | The data previously written to, in another thread, by WriteLock followed by WriteUnlock.

Definition at line 183 of file SingleProducerConsumer.h.

template<class SingleProducerConsumerType >
void DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::ReadUnlock ( void )

Signals that we are done reading the the data from the least recent call of ReadLock. At this point that pointer is no longer valid, and should no longer be read.

Definition at line 207 of file SingleProducerConsumer.h.

References RakAssert.

template<class SingleProducerConsumerType >
int DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::Size ( void ) const

This function will estimate how many elements are waiting to be read. It's threadsafe enough that the value returned is stable, but not threadsafe enough to give accurate results.

Returns
An ESTIMATE of how many data elements are waiting to be read

Definition at line 253 of file SingleProducerConsumer.h.

template<class SingleProducerConsumerType >
SingleProducerConsumerType * DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::WriteLock ( void )

WriteLock must be immediately followed by WriteUnlock. These two functions must be called in the same thread.

Returns
A pointer to a block of data you can write to.

Definition at line 142 of file SingleProducerConsumer.h.

References _FILE_AND_LINE_, and RakAssert.

template<class SingleProducerConsumerType >
void DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::WriteUnlock ( void )

Call when you are done writing to a block of memory returned by WriteLock()

Definition at line 167 of file SingleProducerConsumer.h.

References RakAssert.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/SingleProducerConsumer.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::AutopatcherRepositoryInterface Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • AutopatcherRepositoryInterface
Public Member Functions | List of all members
SLNet::AutopatcherRepositoryInterface Class Referenceabstract

An interface used by AutopatcherServer to get the data necessary to run an autopatcher. This is up to you to implement for custom repository solutions. More...

#include <slikenet/AutopatcherRepositoryInterface.h>

+ Inheritance diagram for SLNet::AutopatcherRepositoryInterface:

Public Member Functions

virtual bool | GetChangelistSinceDate (const char *applicationName, FileList *addedOrModifiedFilesWithHashData, FileList *deletedFiles, double sinceDate)=0
virtual int | GetPatches (const char *applicationName, FileList *input, bool allowDownloadOfOriginalUnmodifiedFiles, FileList *patchList)=0
virtual bool | GetMostRecentChangelistWithPatches (SLNet::RakString &applicationName, FileList *patchedFiles, FileList *updatedFiles, FileList *addedOrModifiedFileHashes, FileList *deletedFiles, double *priorRowPatchTime, double *mostRecentRowPatchTime)=0
virtual const char * | GetLastError (void) const =0
virtual const int | GetIncrementalReadChunkSize (void) const =0
- Public Member Functions inherited from SLNet::IncrementalReadInterface
IncrementalReadInterface ()
virtual | ~IncrementalReadInterface ()
virtual unsigned int | GetFilePart (const char *filename, unsigned int startReadBytes, unsigned int numBytesToRead, void *preallocatedDestination, FileListNodeContext context)

Detailed Description

An interface used by AutopatcherServer to get the data necessary to run an autopatcher. This is up to you to implement for custom repository solutions.

Definition at line 35 of file AutopatcherRepositoryInterface.h.

Member Function Documentation

virtual bool SLNet::AutopatcherRepositoryInterface::GetChangelistSinceDate | ( | const char * | applicationName,
 |  | FileList * | addedOrModifiedFilesWithHashData,
 |  | FileList * | deletedFiles,
 |  | double | sinceDate
 | ) |  |
pure virtual

Get list of files added and deleted since a certain date. This is used by AutopatcherServer and not usually explicitly called.

Parameters
[in] | applicationName | A null terminated string identifying the application
[out] | addedFiles | A list of the current versions of filenames with hashes as their data that were created after sinceData
[out] | deletedFiles | A list of the current versions of filenames that were deleted after sinceData
[in] | An | input date, in whatever format your repository uses
[out] | currentDate | The current server date, in whatever format your repository uses
Returns
True on success, false on failure.
virtual const int SLNet::AutopatcherRepositoryInterface::GetIncrementalReadChunkSize ( void ) const
pure virtual
Returns
Passed to FileListTransfer::Send() as the _chunkSize parameter.
virtual const char* SLNet::AutopatcherRepositoryInterface::GetLastError ( void ) const
pure virtual
Returns
Whatever this function returns is sent from the AutopatcherServer to the AutopatcherClient when one of the above functions returns false.
virtual bool SLNet::AutopatcherRepositoryInterface::GetMostRecentChangelistWithPatches | ( | SLNet::RakString & | applicationName,
 |  | FileList * | patchedFiles,
 |  | FileList * | updatedFiles,
 |  | FileList * | addedOrModifiedFileHashes,
 |  | FileList * | deletedFiles,
 |  | double * | priorRowPatchTime,
 |  | double * | mostRecentRowPatchTime
 | ) |  |
pure virtual

For the most recent update, return files that were patched, added, or deleted. For files that were patched, return both the patch in patchedFiles and the current version in updatedFiles

Parameters
[in,out] | applicationName | Name of the application to get patches for. If empty, uses the most recently updated application, and the string will be updated to reflect this name.
[out] | patchedFiles | A list of patched files with op PC_HASH_2_WITH_PATCH. It has 2 hashes, the priorHash and the currentHash. The currentHash is checked on the client after patching for patch success. The priorHash is checked in AutopatcherServer::OnGetPatch() to see if the client is able to hash with the version they currently have
[out] | patchedFiles | A list of new files. It contains the actual data in addition to the filename
[out] | addedOrModifiedFileHashes | A list of file hashes that were either modified or new. This is returned to the client when replying to ID_AUTOPATCHER_CREATION_LIST, which tells the client what files have changed on the server since a certain date
[out] | deletedFiles | A list of the current versions of filenames that were deleted in the most recent patch
[out] | whenPatched | time in seconds since epoch when patched. Use time() function to get this in C
Returns
true on success, false on failure
virtual int SLNet::AutopatcherRepositoryInterface::GetPatches | ( | const char * | applicationName,
 |  | FileList * | input,
 |  | bool | allowDownloadOfOriginalUnmodifiedFiles,
 |  | FileList * | patchList
 | ) |  |
pure virtual

Get patches (or files) for every file in input, assuming that input has a hash for each of those files.

Parameters
[in] | applicationName | A null terminated string identifying the application
[in] | input | A list of files with SHA1_LENGTH byte hashes to get from the database.
[out] | patchList | You should return list of files with either the filedata or the patch. This is a subset of input. The context data for each file will be either PC_WRITE_FILE (to just write the file) or PC_HASH_WITH_PATCH (to patch). If PC_HASH_WITH_PATCH, then the file contains a SHA1_LENGTH byte patch followed by the hash. The datalength is patchlength + SHA1_LENGTH
[out] | currentDate | The current server date, in whatever format your repository uses
Returns
1 on success, 0 on database failure, -1 on tried to download original unmodified file
The documentation for this class was generated from the following file:
  • Source/include/slikenet/AutopatcherRepositoryInterface.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::BitStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • BitStream
Public Member Functions | Static Public Member Functions | List of all members
SLNet::BitStream Class Reference

#include <slikenet/BitStream.h>

Public Member Functions

BitStream ()
Default Constructor.
BitStream (const unsigned int initialBytesToAllocate)
Create the bitstream, with some number of bytes to immediately allocate.
BitStream (unsigned char *_data, const unsigned int lengthInBytes, bool _copyData)
Initialize the BitStream, immediately setting the data it contains to a predefined pointer.
~BitStream ()
void | Reset (void)
Resets the bitstream for reuse.
template<class templateType >
bool | Serialize (bool writeToBitstream, templateType &inOutTemplateVar)
Bidirectional serialize/deserialize any integral type to/from a bitstream.
template<class templateType >
bool | SerializeDelta (bool writeToBitstream, templateType &inOutCurrentValue, const templateType &lastValue)
Bidirectional serialize/deserialize any integral type to/from a bitstream.
template<class templateType >
bool | SerializeDelta (bool writeToBitstream, templateType &inOutCurrentValue)
Bidirectional version of SerializeDelta when you don't know what the last value is, or there is no last value.
template<class templateType >
bool | SerializeCompressed (bool writeToBitstream, templateType &inOutTemplateVar)
Bidirectional serialize/deserialize any integral type to/from a bitstream.
template<class templateType >
bool | SerializeCompressedDelta (bool writeToBitstream, templateType &inOutCurrentValue, const templateType &lastValue)
Bidirectional serialize/deserialize any integral type to/from a bitstream.
template<class templateType >
bool | SerializeCompressedDelta (bool writeToBitstream, templateType &inOutTemplateVar)
Save as SerializeCompressedDelta(templateType &currentValue, const templateType &lastValue) when we have an unknown second parameter.
bool | Serialize (bool writeToBitstream, char *inOutByteArray, const unsigned int numberOfBytes)
Bidirectional serialize/deserialize an array or casted stream or raw data. This does NOT do endian swapping.
bool | SerializeFloat16 (bool writeToBitstream, float &inOutFloat, float floatMin, float floatMax)
Serialize a float into 2 bytes, spanning the range between floatMin and floatMax.
template<class serializationType , class sourceType >
bool | SerializeCasted (bool writeToBitstream, sourceType &value)
template<class templateType >
bool | SerializeBitsFromIntegerRange (bool writeToBitstream, templateType &value, const templateType minimum, const templateType maximum, bool allowOutsideRange=false)
template<class templateType >
bool | SerializeBitsFromIntegerRange (bool writeToBitstream, templateType &value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange=false)
template<class templateType >
bool | SerializeNormVector (bool writeToBitstream, templateType &x, templateType &y, templateType &z)
Bidirectional serialize/deserialize a normalized 3D vector, using (at most) 4 bytes + 3 bits instead of 12-24 bytes.
template<class templateType >
bool | SerializeVector (bool writeToBitstream, templateType &x, templateType &y, templateType &z)
Bidirectional serialize/deserialize a vector, using 10 bytes instead of 12.
template<class templateType >
bool | SerializeNormQuat (bool writeToBitstream, templateType &w, templateType &x, templateType &y, templateType &z)
Bidirectional serialize/deserialize a normalized quaternion in 6 bytes + 4 bits instead of 16 bytes. Slightly lossy.
template<class templateType >
bool | SerializeOrthMatrix (bool writeToBitstream, templateType &m00, templateType &m01, templateType &m02, templateType &m10, templateType &m11, templateType &m12, templateType &m20, templateType &m21, templateType &m22)
Bidirectional serialize/deserialize an orthogonal matrix by creating a quaternion, and writing 3 components of the quaternion in 2 bytes each.
bool | SerializeBits (bool writeToBitstream, unsigned char *inOutByteArray, const BitSize_t numberOfBitsToSerialize, const bool rightAlignedBits=true)
Bidirectional serialize/deserialize numberToSerialize bits to/from the input.
template<class templateType >
void | Write (const templateType &inTemplateVar)
Write any integral type to a bitstream.
template<class templateType >
void | WritePtr (templateType *inTemplateVar)
Write the dereferenced pointer to any integral type to a bitstream.
template<class templateType >
void | WriteDelta (const templateType &currentValue, const templateType &lastValue)
Write any integral type to a bitstream.
template<class templateType >
void | WriteDelta (const templateType &currentValue)
WriteDelta when you don't know what the last value is, or there is no last value.
template<class templateType >
void | WriteCompressed (const templateType &inTemplateVar)
Write any integral type to a bitstream.
template<class templateType >
void | WriteCompressedDelta (const templateType &currentValue, const templateType &lastValue)
Write any integral type to a bitstream.
template<class templateType >
void | WriteCompressedDelta (const templateType &currentValue)
Save as WriteCompressedDelta(const templateType &currentValue, const templateType &lastValue) when we have an unknown second parameter.
template<class templateType >
bool | Read (templateType &outTemplateVar)
Read any integral type from a bitstream.
bool | Read (wchar_t *&varString)
Read a wchar from a bitstream.
bool | Read (wchar_t *&varString, size_t varStringLength)
template<class templateType >
bool | ReadDelta (templateType &outTemplateVar)
Read any integral type from a bitstream.
template<class templateType >
bool | ReadCompressed (templateType &outTemplateVar)
Read any integral type from a bitstream.
bool | ReadCompressed (wchar_t *&varString)
Read a wchar from a bitstream.
bool | ReadCompressed (wchar_t *&varString, size_t varStringLength)
template<class templateType >
bool | ReadCompressedDelta (templateType &outTemplateVar)
Read any integral type from a bitstream.
bool | Read (BitStream *bitStream, BitSize_t numberOfBits)
Read one bitstream to another.
bool | Read (BitStream *bitStream)
bool | Read (BitStream &bitStream, BitSize_t numberOfBits)
bool | Read (BitStream &bitStream)
void | Write (const char *inputByteArray, const unsigned int numberOfBytes)
Write an array or casted stream or raw data. This does NOT do endian swapping.
void | Write (BitStream *bitStream, BitSize_t numberOfBits)
Write one bitstream to another.
void | Write (BitStream *bitStream)
void | Write (BitStream &bitStream, BitSize_t numberOfBits)
void | Write (BitStream &bitStream)
void | WriteFloat16 (float x, float floatMin, float floatMax)
Write a float into 2 bytes, spanning the range between floatMin and floatMax.
template<class serializationType , class sourceType >
void | WriteCasted (const sourceType &value)
template<class templateType >
void | WriteBitsFromIntegerRange (const templateType value, const templateType minimum, const templateType maximum, bool allowOutsideRange=false)
template<class templateType >
void | WriteBitsFromIntegerRange (const templateType value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange=false)
template<class templateType >
void | WriteNormVector (templateType x, templateType y, templateType z)
Write a normalized 3D vector, using (at most) 4 bytes + 3 bits instead of 12-24 bytes.
template<class templateType >
void | WriteVector (templateType x, templateType y, templateType z)
Write a vector, using 10 bytes instead of 12.
template<class templateType >
void | WriteNormQuat (templateType w, templateType x, templateType y, templateType z)
Write a normalized quaternion in 6 bytes + 4 bits instead of 16 bytes. Slightly lossy.
template<class templateType >
void | WriteOrthMatrix (templateType m00, templateType m01, templateType m02, templateType m10, templateType m11, templateType m12, templateType m20, templateType m21, templateType m22)
Write an orthogonal matrix by creating a quaternion, and writing 3 components of the quaternion in 2 bytes each.
bool | Read (char *output, const unsigned int numberOfBytes)
Read an array or casted stream of byte.
bool | ReadFloat16 (float &outFloat, float floatMin, float floatMax)
Read a float into 2 bytes, spanning the range between floatMin and floatMax.
template<class serializationType , class sourceType >
bool | ReadCasted (sourceType &value)
template<class templateType >
bool | ReadBitsFromIntegerRange (templateType &value, const templateType minimum, const templateType maximum, bool allowOutsideRange=false)
template<class templateType >
bool | ReadBitsFromIntegerRange (templateType &value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange=false)
template<class templateType >
bool | ReadNormVector (templateType &x, templateType &y, templateType &z)
Read a normalized 3D vector, using (at most) 4 bytes + 3 bits instead of 12-24 bytes.
template<class templateType >
bool | ReadVector (templateType &x, templateType &y, templateType &z)
Read 3 floats or doubles, using 10 bytes, where those float or doubles comprise a vector.
template<class templateType >
bool | ReadNormQuat (templateType &w, templateType &x, templateType &y, templateType &z)
Read a normalized quaternion in 6 bytes + 4 bits instead of 16 bytes.
template<class templateType >
bool | ReadOrthMatrix (templateType &m00, templateType &m01, templateType &m02, templateType &m10, templateType &m11, templateType &m12, templateType &m20, templateType &m21, templateType &m22)
Read an orthogonal matrix from a quaternion, reading 3 components of the quaternion in 2 bytes each and extrapolatig the 4th.
void | ResetReadPointer (void)
Sets the read pointer back to the beginning of your data.
void | ResetWritePointer (void)
Sets the write pointer back to the beginning of your data.
void | AssertStreamEmpty (void)
This is good to call when you are done with the stream to make sure you didn't leave any data left over void.
void | PrintBits (char *out) const
RAKNET_DEBUG_PRINTF the bits in the stream. Great for debugging.
void | PrintBits (char *out, size_t outLength) const
void | PrintBits (void) const
void | PrintHex (char *out) const
void | PrintHex (char *out, size_t outLength) const
void | PrintHex (void) const
void | IgnoreBits (const BitSize_t numberOfBits)
Ignore data we don't intend to read.
void | IgnoreBytes (const unsigned int numberOfBytes)
Ignore data we don't intend to read.
void | SetWriteOffset (const BitSize_t offset)
Move the write pointer to a position on the array.
BitSize_t | GetNumberOfBitsUsed (void) const
Returns the length in bits of the stream.
BitSize_t | GetWriteOffset (void) const
BitSize_t | GetNumberOfBytesUsed (void) const
Returns the length in bytes of the stream.
BitSize_t | GetReadOffset (void) const
Returns the number of bits into the stream that we have read.
void | SetReadOffset (const BitSize_t newReadOffset)
Sets the read bit index.
BitSize_t | GetNumberOfUnreadBits (void) const
Returns the number of bits left in the stream that haven't been read.
BitSize_t | CopyData (unsigned char **_data) const
Makes a copy of the internal data for you _data will point to the stream. Partial bytes are left aligned.
void | SetData (unsigned char *inByteArray)
unsigned char * | GetData (void) const
void | WriteBits (const unsigned char *inByteArray, BitSize_t numberOfBitsToWrite, const bool rightAlignedBits=true)
Write numberToWrite bits from the input source.
void | WriteAlignedBytes (const unsigned char *inByteArray, const unsigned int numberOfBytesToWrite)
Align the bitstream to the byte boundary and then write the specified number of bits.
void | EndianSwapBytes (int byteOffset, int length)
void | WriteAlignedBytesSafe (const char *inByteArray, const unsigned int inputLength, const unsigned int maxBytesToWrite)
Aligns the bitstream, writes inputLength, and writes input. Won't write beyond maxBytesToWrite.
bool | ReadAlignedBytes (unsigned char *inOutByteArray, const unsigned int numberOfBytesToRead)
Read bits, starting at the next aligned bits.
bool | ReadAlignedBytesSafe (char *inOutByteArray, int &inputLength, const int maxBytesToRead)
Reads what was written by WriteAlignedBytesSafe.
bool | ReadAlignedBytesSafe (char *inOutByteArray, unsigned int &inputLength, const unsigned int maxBytesToRead)
bool | ReadAlignedBytesSafeAlloc (char **outByteArray, int &inputLength, const unsigned int maxBytesToRead)
Same as ReadAlignedBytesSafe() but allocates the memory for you using new, rather than assuming it is safe to write to.
bool | ReadAlignedBytesSafeAlloc (char **outByteArray, unsigned int &inputLength, const unsigned int maxBytesToRead)
void | AlignWriteToByteBoundary (void)
Align the next write and/or read to a byte boundary.
void | AlignReadToByteBoundary (void)
Align the next write and/or read to a byte boundary.
bool | ReadBits (unsigned char *inOutByteArray, BitSize_t numberOfBitsToRead, const bool alignBitsToRight=true)
Read numberOfBitsToRead bits to the output source.
void | Write0 (void)
Write a 0.
void | Write1 (void)
Write a 1.
bool | ReadBit (void)
Reads 1 bit and returns true if that bit is 1 and false if it is 0.
void | AssertCopyData (void)
If we used the constructor version with copy data off, this *makes sure it is set to on and the data pointed to is copied.
void | SetNumberOfBitsAllocated (const BitSize_t lengthInBits)
Use this if you pass a pointer copy to the constructor *(_copyData==false) and want to overallocate to prevent reallocation.
void | AddBitsAndReallocate (const BitSize_t numberOfBitsToWrite)
Reallocates (if necessary) in preparation of writing numberOfBitsToWrite.
BitSize_t | GetNumberOfBitsAllocated (void) const
bool | Read (char *varString)
Read strings, non reference.
bool | Read (unsigned char *varString)
void | PadWithZeroToByteLength (unsigned int bytes)
Write zeros until the bitstream is filled up to bytes.
void | WriteAlignedVar8 (const char *inByteArray)
bool | ReadAlignedVar8 (char *inOutByteArray)
void | WriteAlignedVar16 (const char *inByteArray)
bool | ReadAlignedVar16 (char *inOutByteArray)
void | WriteAlignedVar32 (const char *inByteArray)
bool | ReadAlignedVar32 (char *inOutByteArray)
void | Write (const char *const inStringVar)
void | Write (const wchar_t *const inStringVar)
void | Write (const unsigned char *const inTemplateVar)
void | Write (char *const inTemplateVar)
void | Write (unsigned char *const inTemplateVar)
void | WriteCompressed (const char *const inStringVar)
void | WriteCompressed (const wchar_t *const inStringVar)
void | WriteCompressed (const unsigned char *const inTemplateVar)
void | WriteCompressed (char *const inTemplateVar)
void | WriteCompressed (unsigned char *const inTemplateVar)
template<>
void | Write (const bool &inTemplateVar)
Write a bool to a bitstream.
template<>
void | Write (const SystemAddress &inTemplateVar)
Write a systemAddress to a bitstream.
template<>
void | Write (const uint24_t &inTemplateVar)
template<>
void | Write (const RakNetGUID &inTemplateVar)
template<>
void | Write (const RakString &inTemplateVar)
Write a string to a bitstream.
template<>
void | Write (const RakWString &inTemplateVar)
template<>
void | Write (const char *const &inStringVar)
template<>
void | Write (const wchar_t *const &inStringVar)
template<>
void | Write (const unsigned char *const &inTemplateVar)
template<>
void | Write (char *const &inTemplateVar)
template<>
void | Write (unsigned char *const &inTemplateVar)
template<>
void | WriteDelta (const bool &currentValue, const bool &lastValue)
Write a bool delta. Same thing as just calling Write.
template<>
void | WriteCompressed (const SystemAddress &inTemplateVar)
template<>
void | WriteCompressed (const RakNetGUID &inTemplateVar)
template<>
void | WriteCompressed (const uint24_t &var)
template<>
void | WriteCompressed (const bool &inTemplateVar)
template<>
void | WriteCompressed (const float &inTemplateVar)
For values between -1 and 1.
template<>
void | WriteCompressed (const double &inTemplateVar)
For values between -1 and 1.
template<>
void | WriteCompressed (const RakString &inTemplateVar)
Compress the string.
template<>
void | WriteCompressed (const RakWString &inTemplateVar)
template<>
void | WriteCompressed (const char *const &inStringVar)
template<>
void | WriteCompressed (const wchar_t *const &inStringVar)
template<>
void | WriteCompressed (const unsigned char *const &inTemplateVar)
template<>
void | WriteCompressed (char *const &inTemplateVar)
template<>
void | WriteCompressed (unsigned char *const &inTemplateVar)
template<>
void | WriteCompressedDelta (const bool &currentValue, const bool &lastValue)
Write a bool delta. Same thing as just calling Write.
template<>
void | WriteCompressedDelta (const bool &currentValue)
Save as WriteCompressedDelta(bool currentValue, const templateType &lastValue) when we have an unknown second bool.
template<>
bool | Read (bool &outTemplateVar)
Read a bool from a bitstream.
template<>
bool | Read (SystemAddress &outTemplateVar)
Read a systemAddress from a bitstream.
template<>
bool | Read (uint24_t &outTemplateVar)
template<>
bool | Read (RakNetGUID &outTemplateVar)
template<>
bool | Read (RakString &outTemplateVar)
template<>
bool | Read (RakWString &outTemplateVar)
template<>
bool | Read (char *&varString)
template<>
bool | Read (unsigned char *&varString)
template<>
bool | ReadDelta (bool &outTemplateVar)
Read a bool from a bitstream.
template<>
bool | ReadCompressed (SystemAddress &outTemplateVar)
template<>
bool | ReadCompressed (uint24_t &outTemplateVar)
template<>
bool | ReadCompressed (RakNetGUID &outTemplateVar)
template<>
bool | ReadCompressed (bool &outTemplateVar)
template<>
bool | ReadCompressed (float &outTemplateVar)
For values between -1 and 1.
template<>
bool | ReadCompressed (double &outTemplateVar)
For values between -1 and 1.
template<>
bool | ReadCompressed (RakString &outTemplateVar)
For strings.
template<>
bool | ReadCompressed (RakWString &outTemplateVar)
template<>
bool | ReadCompressed (char *&outTemplateVar)
template<>
bool | ReadCompressed (unsigned char *&outTemplateVar)
template<>
bool | ReadCompressedDelta (bool &outTemplateVar)
Read a bool from a bitstream.

Static Public Member Functions

static int | NumberOfLeadingZeroes (uint8_t x)
static int | NumberOfLeadingZeroes (uint16_t x)
static int | NumberOfLeadingZeroes (uint32_t x)
static int | NumberOfLeadingZeroes (uint64_t x)
static int | NumberOfLeadingZeroes (int8_t x)
static int | NumberOfLeadingZeroes (int16_t x)
static int | NumberOfLeadingZeroes (int32_t x)
static int | NumberOfLeadingZeroes (int64_t x)
static bool | DoEndianSwap (void)
-— Member function template specialization declarations -—
static bool | IsBigEndian (void)
static bool | IsNetworkOrder (void)
static bool | IsNetworkOrderInternal (void)
static void | ReverseBytes (unsigned char *inByteArray, unsigned char *inOutByteArray, const unsigned int length)
static void | ReverseBytesInPlace (unsigned char *inOutData, const unsigned int length)

Detailed Description

This class allows you to write and read native types as a string of bits. BitStream is used extensively throughout RakNet and is designed to be used by users as well.

See Also
BitStreamSample.txt

Definition at line 47 of file BitStream.h.

Constructor & Destructor Documentation

BitStream::BitStream ( )

Default Constructor.

Definition at line 60 of file BitStream.cpp.

References BITSTREAM_STACK_ALLOCATION_SIZE.

BitStream::BitStream ( const unsigned int initialBytesToAllocate )

Create the bitstream, with some number of bytes to immediately allocate.

There is no benefit to calling this, unless you know exactly how many bytes you need and it is greater than BITSTREAM_STACK_ALLOCATION_SIZE. In that case all it does is save you one or more realloc calls.

Parameters
[in] initialBytesToAllocate the number of bytes to pre-allocate.

Definition at line 76 of file BitStream.cpp.

References _FILE_AND_LINE_, BITSTREAM_STACK_ALLOCATION_SIZE, RakAssert, and rakMalloc_Ex.

BitStream::BitStream | ( | unsigned char * | _data,
 |  | const unsigned int | lengthInBytes,
 |  | bool | _copyData
 | ) |  |

Initialize the BitStream, immediately setting the data it contains to a predefined pointer.

Set _copyData to true if you want to make an internal copy of the data you are passing. Set it to false to just save a pointer to the data. You shouldn't call Write functions with _copyData as false, as this will write to unallocated memory 99% of the time you will use this function to cast Packet::data to a bitstream for reading, in which case you should write something as follows:

SLNet::BitStream bs(packet->data, packet->length, false);
Parameters
[in] | _data | An array of bytes.
[in] | lengthInBytes | Size of the _data.
[in] | _copyData | true or false to make a copy of _data or not.

Definition at line 97 of file BitStream.cpp.

References _FILE_AND_LINE_, BITSTREAM_STACK_ALLOCATION_SIZE, RakAssert, and rakMalloc_Ex.

BitStream::~BitStream ( )

Definition at line 138 of file BitStream.cpp.

References _FILE_AND_LINE_, BITSTREAM_STACK_ALLOCATION_SIZE, and rakFree_Ex.

Member Function Documentation

void BitStream::AddBitsAndReallocate ( const BitSize_t numberOfBitsToWrite )

Reallocates (if necessary) in preparation of writing numberOfBitsToWrite.

Cap to 1 meg buffer to save on huge allocations

Definition at line 697 of file BitStream.cpp.

References _FILE_AND_LINE_, BITS_TO_BYTES, BITSTREAM_STACK_ALLOCATION_SIZE, RakAssert, rakMalloc_Ex, and rakRealloc_Ex.

Referenced by PadWithZeroToByteLength(), Write(), Write0(), Write1(), WriteAlignedVar16(), WriteAlignedVar32(), WriteAlignedVar8(), and WriteBits().

void SLNet::BitStream::AlignReadToByteBoundary ( void )
inline

Align the next write and/or read to a byte boundary.

This can be used to 'waste' bits to byte align for efficiency reasons It can also be used to force coalesced bitstreams to start on byte boundaries so so WriteAlignedBits and ReadAlignedBits both calculate the same offset when aligning.

Definition at line 614 of file BitStream.h.

Referenced by SLNet::DataCompressor::DecompressAndAllocate(), DataStructures::RangeList< range_type >::Deserialize(), SLNet::RakString::Deserialize(), SLNet::TableSerializer::DeserializeCell(), Read(), and ReadAlignedBytes().

void SLNet::BitStream::AlignWriteToByteBoundary ( void )
inline

Align the next write and/or read to a byte boundary.

This can be used to 'waste' bits to byte align for efficiency reasons It can also be used to force coalesced bitstreams to start on byte boundaries so so WriteAlignedBits and ReadAlignedBits both calculate the same offset when aligning.

Definition at line 607 of file BitStream.h.

Referenced by PadWithZeroToByteLength(), DataStructures::RangeList< range_type >::Serialize(), Write(), and WriteAlignedBytes().

void BitStream::AssertCopyData ( void )

If we used the constructor version with copy data off, this *makes sure it is set to on and the data pointed to is copied.

Definition at line 1032 of file BitStream.cpp.

References _FILE_AND_LINE_, BITS_TO_BYTES, RakAssert, and rakMalloc_Ex.

void BitStream::AssertStreamEmpty ( void )

This is good to call when you are done with the stream to make sure you didn't leave any data left over void.

Definition at line 841 of file BitStream.cpp.

References RakAssert.

BitSize_t BitStream::CopyData ( unsigned char ** _data ) const

Makes a copy of the internal data for you _data will point to the stream. Partial bytes are left aligned.

Parameters
[out] _data The allocated copy of GetData()
Returns
The length in bits of the stream.

Definition at line 959 of file BitStream.cpp.

References _FILE_AND_LINE_, BITS_TO_BYTES, RakAssert, and rakMalloc_Ex.

Referenced by SLNet::HuffmanEncodingTree::GenerateFromFrequencyTable().

static bool SLNet::BitStream::DoEndianSwap ( void )
inlinestatic

-— Member function template specialization declarations -—

Definition at line 724 of file BitStream.h.

Referenced by EndianSwapBytes(), Read(), ReadAlignedVar16(), ReadAlignedVar32(), ReadCompressed(), Write(), WriteAlignedVar16(), WriteAlignedVar32(), WriteCompressed(), and WritePtr().

void BitStream::EndianSwapBytes | ( | int | byteOffset,
 |  | int | length
 | ) |  |

Definition at line 351 of file BitStream.cpp.

References DoEndianSwap(), and ReverseBytesInPlace().

unsigned char* SLNet::BitStream::GetData ( void ) const
inline

Gets the data that BitStream is writing to / reading from. Partial bytes are left aligned.

Returns
A pointer to the internal state

Definition at line 549 of file BitStream.h.

Referenced by SLNet::RakPeer::AdvertiseSystem(), SLNet::TableSerializer::DeserializeCell(), SLNet::StringCompressor::EncodeString(), SLNet::RakPeer::GetOfflinePingResponse(), SLNet::RakPeer::NotifyAndFlagForShutdown(), SLNet::RakPeer::OnConnectionRequest(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::RakPeer::PingInternal(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::Send(), SLNet::RakPeer::SendOutOfBand(), SLNet::PluginInterface2::SendUnified(), Write(), and SLNet::VariableListDeltaTracker::WriteVar().

BitSize_t BitStream::GetNumberOfBitsAllocated ( void ) const

Definition at line 744 of file BitStream.cpp.

BitSize_t SLNet::BitStream::GetNumberOfBitsUsed ( void ) const
inline

Returns the length in bits of the stream.

Definition at line 521 of file BitStream.h.

Referenced by SLNet::HuffmanEncodingTree::EncodeArray(), SLNet::StringCompressor::EncodeString(), SLNet::RakPeer::NotifyAndFlagForShutdown(), SLNet::RakPeer::OnConnectionRequest(), SLNet::RakPeer::PingInternal(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::Send(), SLNet::PluginInterface2::SendUnified(), DataStructures::RangeList< range_type >::Serialize(), and Write().

BitSize_t SLNet::BitStream::GetNumberOfBytesUsed ( void ) const
inline

Returns the length in bytes of the stream.

Definition at line 525 of file BitStream.h.

References BITS_TO_BYTES.

Referenced by SLNet::RakPeer::AdvertiseSystem(), SLNet::RakPeer::GetOfflinePingResponse(), PadWithZeroToByteLength(), SLNet::RakPeer::ParseConnectionRequestPacket(), PrintHex(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::Send(), SLNet::RakPeer::SendOutOfBand(), SLNet::PluginInterface2::SendUnified(), SLNet::ReliabilityLayer::Update(), and SLNet::VariableListDeltaTracker::WriteVar().

BitSize_t SLNet::BitStream::GetNumberOfUnreadBits ( void ) const
inline

Returns the number of bits left in the stream that haven't been read.

Definition at line 534 of file BitStream.h.

Referenced by SLNet::StringCompressor::DecodeString(), SLNet::TableSerializer::DeserializeCell(), Read(), ReadAlignedBytes(), ReadAlignedVar16(), ReadAlignedVar32(), ReadAlignedVar8(), ReadBit(), ReadBits(), and Write().

BitSize_t SLNet::BitStream::GetReadOffset ( void ) const
inline

Returns the number of bits into the stream that we have read.

Definition at line 528 of file BitStream.h.

Referenced by SLNet::TableSerializer::DeserializeCell(), SLNet::RakPeer::ParseConnectionRequestPacket(), and Write().

BitSize_t SLNet::BitStream::GetWriteOffset ( void ) const
inline

Definition at line 522 of file BitStream.h.

Referenced by DataStructures::RangeList< range_type >::Serialize().

void BitStream::IgnoreBits ( const BitSize_t numberOfBits )

Ignore data we don't intend to read.

Parameters
[in] numberOfBits The number of bits to ignore

Definition at line 971 of file BitStream.cpp.

Referenced by SLNet::TableSerializer::DeserializeCell(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), IgnoreBytes(), SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakPeer::RunUpdateCycle().

void BitStream::IgnoreBytes ( const unsigned int numberOfBytes )

Ignore data we don't intend to read.

Parameters
[in] numberOfBits The number of bytes to ignore

Definition at line 976 of file BitStream.cpp.

References BYTES_TO_BITS, and IgnoreBits().

Referenced by SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakPeer::RunUpdateCycle().

static bool SLNet::BitStream::IsBigEndian ( void )
inlinestatic

Definition at line 731 of file BitStream.h.

Referenced by Read(), ReadBitsFromIntegerRange(), Write(), and WriteBitsFromIntegerRange().

static bool SLNet::BitStream::IsNetworkOrder ( void )
inlinestatic

Definition at line 735 of file BitStream.h.

Referenced by VariadicSQLParser::ExtractArguments().

bool BitStream::IsNetworkOrderInternal ( void )
static

Definition at line 1054 of file BitStream.cpp.

int BitStream::NumberOfLeadingZeroes ( uint8_t x )
static

Get the number of leading zeros for a number

Parameters
[in] x Number to test

Definition at line 786 of file BitStream.cpp.

Referenced by NumberOfLeadingZeroes(), ReadBitsFromIntegerRange(), SerializeBitsFromIntegerRange(), and WriteBitsFromIntegerRange().

int BitStream::NumberOfLeadingZeroes ( uint16_t x )
static

Definition at line 798 of file BitStream.cpp.

int BitStream::NumberOfLeadingZeroes ( uint32_t x )
static

Definition at line 811 of file BitStream.cpp.

int BitStream::NumberOfLeadingZeroes ( uint64_t x )
static

Definition at line 825 of file BitStream.cpp.

int BitStream::NumberOfLeadingZeroes ( int8_t x )
static

Definition at line 785 of file BitStream.cpp.

References NumberOfLeadingZeroes().

int BitStream::NumberOfLeadingZeroes ( int16_t x )
static

Definition at line 797 of file BitStream.cpp.

References NumberOfLeadingZeroes().

int BitStream::NumberOfLeadingZeroes ( int32_t x )
static

Definition at line 810 of file BitStream.cpp.

References NumberOfLeadingZeroes().

int BitStream::NumberOfLeadingZeroes ( int64_t x )
static

Definition at line 824 of file BitStream.cpp.

References NumberOfLeadingZeroes().

void BitStream::PadWithZeroToByteLength ( unsigned int bytes )

Write zeros until the bitstream is filled up to bytes.

Definition at line 748 of file BitStream.cpp.

References AddBitsAndReallocate(), AlignWriteToByteBoundary(), BITS_TO_BYTES, BYTES_TO_BITS, and GetNumberOfBytesUsed().

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::ReliabilityLayer::Update().

void BitStream::PrintBits ( char * out ) const

RAKNET_DEBUG_PRINTF the bits in the stream. Great for debugging.

Definition at line 846 of file BitStream.cpp.

References BITS_TO_BYTES.

void BitStream::PrintBits | ( | char * | out,
 |  | size_t | outLength
 | ) |  | const

Definition at line 886 of file BitStream.cpp.

References BITS_TO_BYTES.

void BitStream::PrintBits ( void ) const

Definition at line 922 of file BitStream.cpp.

References RAKNET_DEBUG_PRINTF.

void BitStream::PrintHex ( char * out ) const

Definition at line 938 of file BitStream.cpp.

References GetNumberOfBytesUsed().

void BitStream::PrintHex | ( | char * | out,
 |  | size_t | outLength
 | ) |  | const

Definition at line 929 of file BitStream.cpp.

References GetNumberOfBytesUsed().

void BitStream::PrintHex ( void ) const

Definition at line 950 of file BitStream.cpp.

References RAKNET_DEBUG_PRINTF.

template<class templateType >
bool SLNet::BitStream::Read ( templateType & outTemplateVar )
inline

Read any integral type from a bitstream.

Read any integral type from a bitstream. Define __BITSTREAM_NATIVE_END if you need endian swapping.

Define __BITSTREAM_NATIVE_END if you need endian swapping.

Parameters
[in] outTemplateVar The value to read
Returns
true on success, false on failure.
Parameters
[in] outTemplateVar The value to read

Definition at line 1279 of file BitStream.h.

References DoEndianSwap(), ReadBits(), and ReverseBytes().

Referenced by SLNet::StringTable::DecodeString(), SLNet::DataCompressor::DecompressAndAllocate(), SLNet::RakNetRandomSync::Deserialize(), DataStructures::RangeList< range_type >::Deserialize(), SLNet::RakWString::Deserialize(), SLNet::RakString::Deserialize(), SLNet::TableSerializer::DeserializeCell(), SLNet::TableSerializer::DeserializeColumns(), SLNet::RakNetRandomSync::DeserializeConstruction(), SLNet::TableSerializer::DeserializeFilterQuery(), SLNet::TableSerializer::DeserializeFilterQueryList(), SLNet::TableSerializer::DeserializeRow(), SLNet::TableSerializer::DeserializeTable(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), operator>>(), SLNet::operator>>(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::ProcessOfflineNetworkPacket(), Read(), ReadBitsFromIntegerRange(), ReadCasted(), ReadCompressed(), ReadCompressedDelta(), ReadDelta(), ReadFloat16(), ReadNormQuat(), SLNet::VariableListDeltaTracker::ReadVarFromBitstream(), ReadVector(), SLNet::RakPeer::RunUpdateCycle(), Serialize(), and SLNet::RakPeer::ShiftIncomingTimestamp().

bool SLNet::BitStream::Read ( wchar_t *& varString )
inline

Read a wchar from a bitstream.

Define __BITSTREAM_NATIVE_END if you need endian swapping.

Parameters
[in] | varString | The value to read
[in] | varStringLength | The length of the given varString array (in wchar_t)
Returns
true on success, false on failure.

Definition at line 1405 of file BitStream.h.

References SLNet::RakWString::Deserialize().

bool SLNet::BitStream::Read | ( | wchar_t *& | varString,
 |  | size_t | varStringLength
 | ) |  |
inline

Definition at line 1409 of file BitStream.h.

References SLNet::RakWString::Deserialize().

bool BitStream::Read | ( | BitStream * | bitStream,
 |  | BitSize_t | numberOfBits
 | ) |  |

Read one bitstream to another.

Parameters
[in] | numberOfBits | bits to read
bitStream | the bitstream to read into from
Returns
true on success, false on failure.

Definition at line 246 of file BitStream.cpp.

References GetNumberOfUnreadBits(), and Write().

bool BitStream::Read ( BitStream * bitStream )

Definition at line 253 of file BitStream.cpp.

References Write().

bool BitStream::Read | ( | BitStream & | bitStream,
 |  | BitSize_t | numberOfBits
 | ) |  |

Definition at line 258 of file BitStream.cpp.

References GetNumberOfUnreadBits(), and Write().

bool BitStream::Read ( BitStream & bitStream )

Definition at line 265 of file BitStream.cpp.

References Write().

bool BitStream::Read | ( | char * | output,
 |  | const unsigned int | numberOfBytes
 | ) |  |

Read an array or casted stream of byte.

The array is raw data. There is no automatic endian conversion with this function

Parameters
[in] | output | The result byte array. It should be larger than numberOfBytes.
[in] | numberOfBytes | The number of byte to read
Returns
true on success false if there is some missing bytes.

Definition at line 272 of file BitStream.cpp.

References GetNumberOfUnreadBits(), and ReadBits().

bool BitStream::Read ( char * varString )

Read strings, non reference.

Definition at line 1082 of file BitStream.cpp.

References SLNet::RakString::Deserialize().

bool BitStream::Read ( unsigned char * varString )

Definition at line 1086 of file BitStream.cpp.

References SLNet::RakString::Deserialize().

template<>
bool SLNet::BitStream::Read ( bool & outTemplateVar )
inline

Read a bool from a bitstream.

Parameters
[in] outTemplateVar The value to read

Definition at line 1308 of file BitStream.h.

References GetNumberOfUnreadBits().

template<>
bool SLNet::BitStream::Read ( SystemAddress & outTemplateVar )
inline

Read a systemAddress from a bitstream.

Parameters
[in] outTemplateVar The value to read

Definition at line 1327 of file BitStream.h.

References SLNet::SystemAddress::address, SLNet::SystemAddress::debugPort, Read(), and ReadBits().

template<>
bool SLNet::BitStream::Read ( uint24_t & outTemplateVar )
inline

Definition at line 1357 of file BitStream.h.

References AlignReadToByteBoundary(), GetNumberOfUnreadBits(), IsBigEndian(), and SLNet::uint24_t::val.

template<>
bool SLNet::BitStream::Read ( RakNetGUID & outTemplateVar )
inline

Definition at line 1384 of file BitStream.h.

References SLNet::RakNetGUID::g, and Read().

template<>
bool SLNet::BitStream::Read ( RakString & outTemplateVar )
inline

Definition at line 1391 of file BitStream.h.

References SLNet::RakString::Deserialize().

template<>
bool SLNet::BitStream::Read ( RakWString & outTemplateVar )
inline

Definition at line 1396 of file BitStream.h.

References SLNet::RakWString::Deserialize().

template<>
bool SLNet::BitStream::Read ( char *& varString )
inline

Definition at line 1401 of file BitStream.h.

References SLNet::RakString::Deserialize().

template<>
bool SLNet::BitStream::Read ( unsigned char *& varString )
inline

Definition at line 1414 of file BitStream.h.

References SLNet::RakString::Deserialize().

bool BitStream::ReadAlignedBytes | ( | unsigned char * | inOutByteArray,
 |  | const unsigned int | numberOfBytesToRead
 | ) |  |

Read bits, starting at the next aligned bits.

Note that the modulus 8 starting offset of the sequence must be the same as was used with WriteBits. This will be a problem with packet coalescence unless you byte align the coalesced packets.

Parameters
[in] | inOutByteArray | The byte array larger than numberOfBytesToRead
[in] | numberOfBytesToRead | The number of byte to read from the internal state
Returns
true if there is enough byte.

Definition at line 373 of file BitStream.cpp.

References AlignReadToByteBoundary(), GetNumberOfUnreadBits(), and RakAssert.

Referenced by SLNet::RakWString::Deserialize(), SLNet::RakString::Deserialize(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::ProcessOfflineNetworkPacket(), ReadAlignedBytesSafe(), and ReadAlignedBytesSafeAlloc().

bool BitStream::ReadAlignedBytesSafe | ( | char * | inOutByteArray,
 |  | int & | inputLength,
 |  | const int | maxBytesToRead
 | ) |  |

Reads what was written by WriteAlignedBytesSafe.

Parameters
[in] | inOutByteArray | The data
[in] | maxBytesToRead | Maximum number of bytes to read
Returns
true on success, false on failure.

Definition at line 395 of file BitStream.cpp.

bool BitStream::ReadAlignedBytesSafe | ( | char * | inOutByteArray,
 |  | unsigned int & | inputLength,
 |  | const unsigned int | maxBytesToRead
 | ) |  |

Definition at line 399 of file BitStream.cpp.

References ReadAlignedBytes(), and ReadCompressed().

bool BitStream::ReadAlignedBytesSafeAlloc | ( | char ** | outByteArray,
 |  | int & | inputLength,
 |  | const unsigned int | maxBytesToRead
 | ) |  |

Same as ReadAlignedBytesSafe() but allocates the memory for you using new, rather than assuming it is safe to write to.

Parameters
[in] outByteArray outByteArray will be deleted if it is not a pointer to 0
Returns
true on success, false on failure.

Definition at line 409 of file BitStream.cpp.

Referenced by SLNet::TableSerializer::DeserializeFilterQuery().

bool BitStream::ReadAlignedBytesSafeAlloc | ( | char ** | outByteArray,
 |  | unsigned int & | inputLength,
 |  | const unsigned int | maxBytesToRead
 | ) |  |

Definition at line 413 of file BitStream.cpp.

References _FILE_AND_LINE_, rakFree_Ex, rakMalloc_Ex, ReadAlignedBytes(), and ReadCompressed().

bool BitStream::ReadAlignedVar16 ( char * inOutByteArray )

Definition at line 1126 of file BitStream.cpp.

References DoEndianSwap(), GetNumberOfUnreadBits(), and RakAssert.

bool BitStream::ReadAlignedVar32 ( char * inOutByteArray )

Definition at line 1170 of file BitStream.cpp.

References DoEndianSwap(), GetNumberOfUnreadBits(), and RakAssert.

bool BitStream::ReadAlignedVar8 ( char * inOutByteArray )

Definition at line 1097 of file BitStream.cpp.

References GetNumberOfUnreadBits(), and RakAssert.

bool BitStream::ReadBit ( void )

Reads 1 bit and returns true if that bit is 1 and false if it is 0.

Definition at line 332 of file BitStream.cpp.

References GetNumberOfUnreadBits().

Referenced by SLNet::HuffmanEncodingTree::DecodeArray().

bool BitStream::ReadBits | ( | unsigned char * | inOutByteArray,
 |  | BitSize_t | numberOfBitsToRead,
 |  | const bool | alignBitsToRight = true
 | ) |  |

Read numberOfBitsToRead bits to the output source.

alignBitsToRight should be set to true to convert internal bitstream data to userdata. It should be false if you used WriteBits with rightAlignedBits false

Parameters
[in] | inOutByteArray | The resulting bits array
[in] | numberOfBitsToRead | The number of bits to read
[in] | alignBitsToRight | if true bits will be right aligned.
Returns
true if there is enough bits to read

Definition at line 555 of file BitStream.cpp.

References BITS_TO_BYTES, and GetNumberOfUnreadBits().

Referenced by Read(), ReadBitsFromIntegerRange(), and SerializeBits().

template<class templateType >
bool SLNet::BitStream::ReadBitsFromIntegerRange | ( | templateType & | value,
 |  | const templateType | minimum,
 |  | const templateType | maximum,
 |  | bool | allowOutsideRange = false
 | ) |  |

Given the minimum and maximum values for an integer type, figure out the minimum number of bits to represent the range Then read only those bits

Note
A static is used so that the required number of bits for (maximum-minimum) is only calculated once. This does require that minimum and are fixed values for a given line of code for the life of the program
Parameters
[in] | value | Integer value to read, which should be between minimum and maximum
[in] | minimum | Minimum value of value
[in] | maximum | Maximum value of value
[in] | allowOutsideRange | If true, all sends will take an extra bit, however value can deviate from outside minimum and maximum. If false, will assert if the value deviates. This should match the corresponding value passed to Write().

Definition at line 1714 of file BitStream.h.

References BYTES_TO_BITS, and NumberOfLeadingZeroes().

Referenced by SerializeBitsFromIntegerRange().

template<class templateType >
bool SLNet::BitStream::ReadBitsFromIntegerRange | ( | templateType & | value,
 |  | const templateType | minimum,
 |  | const templateType | maximum,
 |  | const int | requiredBits,
 |  | bool | allowOutsideRange = false
 | ) |  |
Parameters
[in] requiredBits Primarily for internal use, called from above function() after calculating number of bits needed to represent maximum-minimum

Definition at line 1720 of file BitStream.h.

References IsBigEndian(), RakAssert, Read(), ReadBits(), and ReverseBytesInPlace().

template<class serializationType , class sourceType >
bool SLNet::BitStream::ReadCasted ( sourceType & value )

Read one type serialized to another (smaller) type, to save bandwidth serializationType should be uint8_t, uint16_t, uint24_t, or uint32_t Example: int num; ReadCasted<uint8_t>(num); would read 1 bytefrom the stream, and put the value in an integer

Parameters
[in] value The value to write

Definition at line 1705 of file BitStream.h.

References Read().

Referenced by SLNet::RakWString::Deserialize().

template<class templateType >
bool SLNet::BitStream::ReadCompressed ( templateType & outTemplateVar )
inline

Read any integral type from a bitstream.

Undefine __BITSTREAM_NATIVE_END if you need endian swapping. For floating point, this is lossy, using 2 bytes for a float and 4 for a double. The range must be between -1 and +1. For non-floating point, this is lossless, but only has benefit if you use less than half the bits of the type If you are not using __BITSTREAM_NATIVE_END the opposite is true for types larger than 1 byte

Parameters
[in] outTemplateVar The value to read
Returns
true on success, false on failure.

Undefine __BITSTREAM_NATIVE_END if you need endian swapping. For floating point, this is lossy, using 2 bytes for a float and 4 for a double. The range must be between -1 and +1. For non-floating point, this is lossless, but only has benefit if you use less than half the bits of the type If you are not using __BITSTREAM_NATIVE_END the opposite is true for types larger than 1 byte

Parameters
[in] outTemplateVar The value to read

Definition at line 1450 of file BitStream.h.

References DoEndianSwap(), and ReverseBytes().

Referenced by SLNet::StringCompressor::DecodeString(), SLNet::DataCompressor::DecompressAndAllocate(), SLNet::RakString::DeserializeCompressed(), SLNet::TableSerializer::DeserializeFilterQuery(), SLNet::TableSerializer::DeserializeFilterQueryList(), ReadAlignedBytesSafe(), ReadAlignedBytesSafeAlloc(), ReadCompressedDelta(), ReadVector(), and SerializeCompressed().

bool SLNet::BitStream::ReadCompressed ( wchar_t *& varString )
inline

Read a wchar from a bitstream.

Define __BITSTREAM_NATIVE_END if you need endian swapping. This is lossless, but only has benefit if you use less than half the bits of the type If you are not using __BITSTREAM_NATIVE_END the opposite is true

Parameters
[in] | varString | The value to read
[in] | varStringLength | The length of the given varString array (in wchar_t)
Returns
true on success, false on failure.

Definition at line 1542 of file BitStream.h.

References SLNet::RakWString::Deserialize().

bool SLNet::BitStream::ReadCompressed | ( | wchar_t *& | varString,
 |  | size_t | varStringLength
 | ) |  |
inline

Definition at line 1546 of file BitStream.h.

References SLNet::RakWString::Deserialize().

template<>
bool SLNet::BitStream::ReadCompressed ( SystemAddress & outTemplateVar )
inline

Definition at line 1477 of file BitStream.h.

References Read().

template<>
bool SLNet::BitStream::ReadCompressed ( uint24_t & outTemplateVar )
inline

Definition at line 1483 of file BitStream.h.

References Read().

template<>
bool SLNet::BitStream::ReadCompressed ( RakNetGUID & outTemplateVar )
inline

Definition at line 1489 of file BitStream.h.

References Read().

template<>
bool SLNet::BitStream::ReadCompressed ( bool & outTemplateVar )
inline

Definition at line 1495 of file BitStream.h.

References Read().

template<>
bool SLNet::BitStream::ReadCompressed ( float & outTemplateVar )
inline

For values between -1 and 1.

Definition at line 1502 of file BitStream.h.

References Read().

template<>
bool SLNet::BitStream::ReadCompressed ( double & outTemplateVar )
inline

For values between -1 and 1.

Definition at line 1515 of file BitStream.h.

References Read().

template<>
bool SLNet::BitStream::ReadCompressed ( RakString & outTemplateVar )
inline

For strings.

Definition at line 1528 of file BitStream.h.

References SLNet::RakString::DeserializeCompressed().

template<>
bool SLNet::BitStream::ReadCompressed ( RakWString & outTemplateVar )
inline

Definition at line 1533 of file BitStream.h.

References SLNet::RakWString::Deserialize().

template<>
bool SLNet::BitStream::ReadCompressed ( char *& outTemplateVar )
inline

Definition at line 1538 of file BitStream.h.

References SLNet::RakString::DeserializeCompressed().

template<>
bool SLNet::BitStream::ReadCompressed ( unsigned char *& outTemplateVar )
inline

Definition at line 1551 of file BitStream.h.

References SLNet::RakString::DeserializeCompressed().

template<class templateType >
bool SLNet::BitStream::ReadCompressedDelta ( templateType & outTemplateVar )
inline

Read any integral type from a bitstream.

If the written value differed from the value compared against in the write function, var will be updated. Otherwise it will retain the current value. the current value will be updated. For floating point, this is lossy, using 2 bytes for a float and 4 for a double. The range must be between -1 and +1. For non-floating point, this is lossless, but only has benefit if you use less than half the bits of the type If you are not using __BITSTREAM_NATIVE_END the opposite is true for types larger than 1 byte ReadCompressedDelta is only valid from a previous call to WriteDelta

Parameters
[in] outTemplateVar The value to read
Returns
true on success, false on failure.

If the written value differed from the value compared against in the write function, var will be updated. Otherwise it will retain the current value. the current value will be updated. For floating point, this is lossy, using 2 bytes for a float and 4 for a double. The range must be between -1 and +1. For non-floating point, this is lossless, but only has benefit if you use less than half the bits of the type If you are not using __BITSTREAM_NATIVE_END the opposite is true for types larger than 1 byte ReadCompressedDelta is only valid from a previous call to WriteDelta

Parameters
[in] outTemplateVar The value to read

Definition at line 1566 of file BitStream.h.

References Read(), and ReadCompressed().

Referenced by SerializeCompressedDelta().

template<>
bool SLNet::BitStream::ReadCompressedDelta ( bool & outTemplateVar )
inline

Read a bool from a bitstream.

Parameters
[in] outTemplateVar The value to read

Definition at line 1579 of file BitStream.h.

References Read().

template<class templateType >
bool SLNet::BitStream::ReadDelta ( templateType & outTemplateVar )
inline

Read any integral type from a bitstream.

If the written value differed from the value compared against in the write function, var will be updated. Otherwise it will retain the current value. ReadDelta is only valid from a previous call to WriteDelta

Parameters
[in] outTemplateVar The value to read
Returns
true on success, false on failure.

If the written value differed from the value compared against in the write function, var will be updated. Otherwise it will retain the current value. ReadDelta is only valid from a previous call to WriteDelta

Parameters
[in] outTemplateVar The value to read

Definition at line 1425 of file BitStream.h.

References Read().

Referenced by SerializeDelta().

template<>
bool SLNet::BitStream::ReadDelta ( bool & outTemplateVar )
inline

Read a bool from a bitstream.

Parameters
[in] outTemplateVar The value to read

Definition at line 1438 of file BitStream.h.

References Read().

bool BitStream::ReadFloat16 | ( | float & | outFloat,
 |  | float | floatMin,
 |  | float | floatMax
 | ) |  |

Read a float into 2 bytes, spanning the range between floatMin and floatMax.

Parameters
[in] | outFloat | The float to read
[in] | floatMin | Predetermined minimum value of f
[in] | floatMax | Predetermined maximum value of f

Definition at line 1195 of file BitStream.cpp.

References RakAssert, and Read().

Referenced by ReadNormVector(), and SerializeFloat16().

template<class templateType >
bool SLNet::BitStream::ReadNormQuat | ( | templateType & | w,
 |  | templateType & | x,
 |  | templateType & | y,
 |  | templateType & | z
 | ) |  |

Read a normalized quaternion in 6 bytes + 4 bits instead of 16 bytes.

Parameters
[in] | w | w
[in] | x | x
[in] | y | y
[in] | z | z
Returns
true on success, false on failure.

Definition at line 1796 of file BitStream.h.

References Read().

Referenced by ReadOrthMatrix(), and SerializeNormQuat().

template<class templateType >
bool SLNet::BitStream::ReadNormVector | ( | templateType & | x,
 |  | templateType & | y,
 |  | templateType & | z
 | ) |  |

Read a normalized 3D vector, using (at most) 4 bytes + 3 bits instead of 12-24 bytes.

Will further compress y or z axis aligned vectors. Accurate to 1/32767.5.

Parameters
[in] | x | x
[in] | y | y
[in] | z | z
Returns
true on success, false on failure.

Definition at line 1746 of file BitStream.h.

References ReadFloat16().

Referenced by SerializeNormVector().

template<class templateType >
bool SLNet::BitStream::ReadOrthMatrix | ( | templateType & | m00,
 |  | templateType & | m01,
 |  | templateType & | m02,
 |  | templateType & | m10,
 |  | templateType & | m11,
 |  | templateType & | m12,
 |  | templateType & | m20,
 |  | templateType & | m21,
 |  | templateType & | m22
 | ) |  |

Read an orthogonal matrix from a quaternion, reading 3 components of the quaternion in 2 bytes each and extrapolatig the 4th.

Use 6 bytes instead of 36 Lossy, although the result is renormalized

Returns
true on success, false on failure.

Definition at line 1827 of file BitStream.h.

References ReadNormQuat().

Referenced by SerializeOrthMatrix().

template<class templateType >
bool SLNet::BitStream::ReadVector | ( | templateType & | x,
 |  | templateType & | y,
 |  | templateType & | z
 | ) |  |

Read 3 floats or doubles, using 10 bytes, where those float or doubles comprise a vector.

Loses accuracy to about 3/10ths and only saves 2 bytes, so only use if accuracy is not important.

Parameters
[in] | x | x
[in] | y | y
[in] | z | z
Returns
true on success, false on failure.

Definition at line 1759 of file BitStream.h.

References Read(), and ReadCompressed().

Referenced by SerializeVector().

void BitStream::Reset ( void )

Resets the bitstream for reuse.

Definition at line 144 of file BitStream.cpp.

Referenced by SLNet::VariableDeltaSerializer::EndSerialize(), SLNet::HuffmanEncodingTree::GenerateFromFrequencyTable(), SLNet::RakPeer::SetOfflinePingResponse(), and SLNet::ReliabilityLayer::Update().

void BitStream::ResetReadPointer ( void )

Sets the read pointer back to the beginning of your data.

Definition at line 293 of file BitStream.cpp.

Referenced by SLNet::VariableDeltaSerializer::EndSerialize().

void BitStream::ResetWritePointer ( void )

Sets the write pointer back to the beginning of your data.

Definition at line 299 of file BitStream.cpp.

Referenced by SLNet::ProcessOfflineNetworkPacket().

void BitStream::ReverseBytes | ( | unsigned char * | inByteArray,
 |  | unsigned char * | inOutByteArray,
 |  | const unsigned int | length
 | ) |  |
static

Definition at line 1065 of file BitStream.cpp.

Referenced by Read(), ReadCompressed(), Write(), WriteBitsFromIntegerRange(), WriteCompressed(), and WritePtr().

void BitStream::ReverseBytesInPlace | ( | unsigned char * | inOutData,
 |  | const unsigned int | length
 | ) |  |
static

Definition at line 1070 of file BitStream.cpp.

Referenced by EndianSwapBytes(), VariadicSQLParser::ExtractArguments(), and ReadBitsFromIntegerRange().

template<class templateType >
bool SLNet::BitStream::Serialize | ( | bool | writeToBitstream,
 |  | templateType & | inOutTemplateVar
 | ) |  |
inline

Bidirectional serialize/deserialize any integral type to/from a bitstream.

Undefine __BITSTREAM_NATIVE_END if you need endian swapping.

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | inOutTemplateVar | The value to write
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 778 of file BitStream.h.

References Read(), and Write().

bool SLNet::BitStream::Serialize | ( | bool | writeToBitstream,
 |  | char * | inOutByteArray,
 |  | const unsigned int | numberOfBytes
 | ) |  |
inline

Bidirectional serialize/deserialize an array or casted stream or raw data. This does NOT do endian swapping.

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | inOutByteArray | a byte buffer
[in] | numberOfBytes | the size of input in bytes
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 837 of file BitStream.h.

References Read(), and Write().

bool SLNet::BitStream::SerializeBits | ( | bool | writeToBitstream,
 |  | unsigned char * | inOutByteArray,
 |  | const BitSize_t | numberOfBitsToSerialize,
 |  | const bool | rightAlignedBits = true
 | ) |  |
inline

Bidirectional serialize/deserialize numberToSerialize bits to/from the input.

Right aligned data means in the case of a partial byte, the bits are aligned from the right (bit 0) rather than the left (as in the normal internal representation) You would set this to true when writing user data, and false when copying bitstream data, such as writing one bitstream to another

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | inOutByteArray | The data
[in] | numberOfBitsToSerialize | The number of bits to write
[in] | rightAlignedBits | if true data will be right aligned
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 912 of file BitStream.h.

References ReadBits(), and WriteBits().

template<class templateType >
bool SLNet::BitStream::SerializeBitsFromIntegerRange | ( | bool | writeToBitstream,
 |  | templateType & | value,
 |  | const templateType | minimum,
 |  | const templateType | maximum,
 |  | bool | allowOutsideRange = false
 | ) |  |

Given the minimum and maximum values for an integer type, figure out the minimum number of bits to represent the range Then serialize only those bits

Note
A static is used so that the required number of bits for (maximum-minimum) is only calculated once. This does require that minimum and are fixed values for a given line of code for the life of the program
Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | value | Integer value to write, which should be between minimum and maximum
[in] | minimum | Minimum value of value
[in] | maximum | Maximum value of value
[in] | allowOutsideRange | If true, all sends will take an extra bit, however value can deviate from outside minimum and maximum. If false, will assert if the value deviates

Definition at line 855 of file BitStream.h.

References BYTES_TO_BITS, and NumberOfLeadingZeroes().

template<class templateType >
bool SLNet::BitStream::SerializeBitsFromIntegerRange | ( | bool | writeToBitstream,
 |  | templateType & | value,
 |  | const templateType | minimum,
 |  | const templateType | maximum,
 |  | const int | requiredBits,
 |  | bool | allowOutsideRange = false
 | ) |  |
Parameters
[in] requiredBits Primarily for internal use, called from above function() after calculating number of bits needed to represent maximum-minimum

Definition at line 861 of file BitStream.h.

References ReadBitsFromIntegerRange(), and WriteBitsFromIntegerRange().

template<class serializationType , class sourceType >
bool SLNet::BitStream::SerializeCasted | ( | bool | writeToBitstream,
 |  | sourceType & | value
 | ) |  |

Serialize one type casted to another (smaller) type, to save bandwidth serializationType should be uint8_t, uint16_t, uint24_t, or uint32_t Example: int num=53; SerializeCasted<uint8_t>(true, num); would use 1 byte to write what would otherwise be an integer (4 or 8 bytes)

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | value | The value to serialize

Definition at line 847 of file BitStream.h.

template<class templateType >
bool SLNet::BitStream::SerializeCompressed | ( | bool | writeToBitstream,
 |  | templateType & | inOutTemplateVar
 | ) |  |
inline

Bidirectional serialize/deserialize any integral type to/from a bitstream.

Undefine __BITSTREAM_NATIVE_END if you need endian swapping. If you are not using __BITSTREAM_NATIVE_END the opposite is true for types larger than 1 byte For floating point, this is lossy, using 2 bytes for a float and 4 for a double. The range must be between -1 and +1. For non-floating point, this is lossless, but only has benefit if you use less than half the bits of the type

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | inOutTemplateVar | The value to write
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 808 of file BitStream.h.

References ReadCompressed(), and WriteCompressed().

template<class templateType >
bool SLNet::BitStream::SerializeCompressedDelta | ( | bool | writeToBitstream,
 |  | templateType & | inOutCurrentValue,
 |  | const templateType & | lastValue
 | ) |  |
inline

Bidirectional serialize/deserialize any integral type to/from a bitstream.

If the current value is different from the last value the current value will be written. Otherwise, a single bit will be written For floating point, this is lossy, using 2 bytes for a float and 4 for a double. The range must be between -1 and +1. For non-floating point, this is lossless, but only has benefit if you use less than half the bits of the type If you are not using __BITSTREAM_NATIVE_END the opposite is true for types larger than 1 byte

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | inOutCurrentValue | The current value to write
[in] | lastValue | The last value to compare against. Only used if writeToBitstream is true.
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 818 of file BitStream.h.

References ReadCompressedDelta(), and WriteCompressedDelta().

template<class templateType >
bool SLNet::BitStream::SerializeCompressedDelta | ( | bool | writeToBitstream,
 |  | templateType & | inOutTemplateVar
 | ) |  |
inline

Save as SerializeCompressedDelta(templateType &currentValue, const templateType &lastValue) when we have an unknown second parameter.

Returns
true on data read. False on insufficient data in bitstream

Definition at line 828 of file BitStream.h.

References ReadCompressedDelta(), and WriteCompressedDelta().

template<class templateType >
bool SLNet::BitStream::SerializeDelta | ( | bool | writeToBitstream,
 |  | templateType & | inOutCurrentValue,
 |  | const templateType & | lastValue
 | ) |  |
inline

Bidirectional serialize/deserialize any integral type to/from a bitstream.

If the current value is different from the last value the current value will be written. Otherwise, a single bit will be written

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | inOutCurrentValue | The current value to write
[in] | lastValue | The last value to compare against. Only used if writeToBitstream is true.
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 788 of file BitStream.h.

References ReadDelta(), and WriteDelta().

template<class templateType >
bool SLNet::BitStream::SerializeDelta | ( | bool | writeToBitstream,
 |  | templateType & | inOutCurrentValue
 | ) |  |
inline

Bidirectional version of SerializeDelta when you don't know what the last value is, or there is no last value.

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | inOutCurrentValue | The current value to write
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 798 of file BitStream.h.

References ReadDelta(), and WriteDelta().

bool BitStream::SerializeFloat16 | ( | bool | writeToBitstream,
 |  | float & | inOutFloat,
 |  | float | floatMin,
 |  | float | floatMax
 | ) |  |

Serialize a float into 2 bytes, spanning the range between floatMin and floatMax.

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | inOutFloat | The float to write
[in] | floatMin | Predetermined minimum value of f
[in] | floatMax | Predetermined maximum value of f

Definition at line 1210 of file BitStream.cpp.

References ReadFloat16(), and WriteFloat16().

template<class templateType >
bool SLNet::BitStream::SerializeNormQuat | ( | bool | writeToBitstream,
 |  | templateType & | w,
 |  | templateType & | x,
 |  | templateType & | y,
 |  | templateType & | z
 | ) |  |
inline

Bidirectional serialize/deserialize a normalized quaternion in 6 bytes + 4 bits instead of 16 bytes. Slightly lossy.

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | w | w
[in] | x | x
[in] | y | y
[in] | z | z
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 889 of file BitStream.h.

References ReadNormQuat(), and WriteNormQuat().

template<class templateType >
bool SLNet::BitStream::SerializeNormVector | ( | bool | writeToBitstream,
 |  | templateType & | x,
 |  | templateType & | y,
 |  | templateType & | z
 | ) |  |
inline

Bidirectional serialize/deserialize a normalized 3D vector, using (at most) 4 bytes + 3 bits instead of 12-24 bytes.

Will further compress y or z axis aligned vectors. Accurate to 1/32767.5.

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | x | x
[in] | y | y
[in] | z | z
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 869 of file BitStream.h.

References ReadNormVector(), and WriteNormVector().

template<class templateType >
bool SLNet::BitStream::SerializeOrthMatrix | ( | bool | writeToBitstream,
 |  | templateType & | m00,
 |  | templateType & | m01,
 |  | templateType & | m02,
 |  | templateType & | m10,
 |  | templateType & | m11,
 |  | templateType & | m12,
 |  | templateType & | m20,
 |  | templateType & | m21,
 |  | templateType & | m22
 | ) |  |
inline

Bidirectional serialize/deserialize an orthogonal matrix by creating a quaternion, and writing 3 components of the quaternion in 2 bytes each.

Use 6 bytes instead of 36 Lossy, although the result is renormalized

Returns
true on success, false on failure.

Definition at line 899 of file BitStream.h.

References ReadOrthMatrix(), and WriteOrthMatrix().

template<class templateType >
bool SLNet::BitStream::SerializeVector | ( | bool | writeToBitstream,
 |  | templateType & | x,
 |  | templateType & | y,
 |  | templateType & | z
 | ) |  |
inline

Bidirectional serialize/deserialize a vector, using 10 bytes instead of 12.

Loses accuracy to about 3/10ths and only saves 2 bytes, so only use if accuracy is not important.

Parameters
[in] | writeToBitstream | true to write from your data to this bitstream. False to read from this bitstream and write to your data
[in] | x | x
[in] | y | y
[in] | z | z
Returns
true if writeToBitstream is true. true if writeToBitstream is false and the read was successful. false if writeToBitstream is false and the read was not successful.

Definition at line 879 of file BitStream.h.

References ReadVector(), and WriteVector().

void BitStream::SetData ( unsigned char * inByteArray )

Definition at line 486 of file BitStream.cpp.

void BitStream::SetNumberOfBitsAllocated ( const BitSize_t lengthInBits )

Use this if you pass a pointer copy to the constructor *(_copyData==false) and want to overallocate to prevent reallocation.

Definition at line 130 of file BitStream.cpp.

References RakAssert.

void SLNet::BitStream::SetReadOffset ( const BitSize_t newReadOffset )
inline

Sets the read bit index.

Definition at line 531 of file BitStream.h.

Referenced by Write().

void BitStream::SetWriteOffset ( const BitSize_t offset )

Move the write pointer to a position on the array.

Parameters
[in] offset the offset from the start of the array.
Attention

Dangerous if you don't know what you are doing! For efficiency reasons you can only write mid-stream if your data is byte aligned.

Definition at line 983 of file BitStream.cpp.

Referenced by SLNet::RakPeer::ShiftIncomingTimestamp().

template<class templateType >
void SLNet::BitStream::Write ( const templateType & inTemplateVar )
inline

Write any integral type to a bitstream.

Undefine __BITSTREAM_NATIVE_END if you need endian swapping.

Parameters
[in] inTemplateVar The value to write

Definition at line 922 of file BitStream.h.

References DoEndianSwap(), ReverseBytes(), and WriteBits().

Referenced by SLNet::RakPeer::AdvertiseSystem(), SLNet::StringTable::EncodeString(), SLNet::VariableDeltaSerializer::EndSerialize(), SLNet::RakPeer::NotifyAndFlagForShutdown(), SLNet::RakPeer::OnConnectionRequest(), operator<<(), SLNet::operator<<(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::RakPeer::PingInternal(), SLNet::ProcessOfflineNetworkPacket(), Read(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendOutOfBand(), SLNet::RakNetRandomSync::Serialize(), DataStructures::RangeList< range_type >::Serialize(), Serialize(), SLNet::RakWString::Serialize(), SLNet::RakString::Serialize(), SLNet::TableSerializer::SerializeCell(), SLNet::TableSerializer::SerializeColumns(), SLNet::RakNetRandomSync::SerializeConstruction(), SLNet::TableSerializer::SerializeFilterQuery(), SLNet::TableSerializer::SerializeFilterQueryList(), SLNet::TableSerializer::SerializeRow(), SLNet::TableSerializer::SerializeTable(), SLNet::VariableDeltaSerializer::SerializeVariable(), SLNet::RakPeer::SetOfflinePingResponse(), SLNet::RakPeer::ShiftIncomingTimestamp(), Write(), WriteAlignedBytes(), WriteBitsFromIntegerRange(), WriteCasted(), WriteCompressed(), WriteCompressedDelta(), WriteDelta(), WriteFloat16(), WriteNormQuat(), SLNet::RakPeer::WriteOutOfBandHeader(), SLNet::VariableListDeltaTracker::WriteVar(), SLNet::VariableListDeltaTracker::WriteVarToBitstream(), and WriteVector().

void BitStream::Write | ( | const char * | inputByteArray,
 |  | const unsigned int | numberOfBytes
 | ) |  |

Write an array or casted stream or raw data. This does NOT do endian swapping.

Parameters
[in] | inputByteArray | a byte buffer
[in] | numberOfBytes | the size of input in bytes

Definition at line 168 of file BitStream.cpp.

References AddBitsAndReallocate(), BITS_TO_BYTES, BYTES_TO_BITS, and WriteBits().

void BitStream::Write | ( | BitStream * | bitStream,
 |  | BitSize_t | numberOfBits
 | ) |  |

Write one bitstream to another.

Parameters
[in] | numberOfBits | bits to write
bitStream | the bitstream to copy from

Definition at line 190 of file BitStream.cpp.

References AddBitsAndReallocate(), BYTES_TO_BITS, GetData(), GetNumberOfUnreadBits(), GetReadOffset(), and SetReadOffset().

void BitStream::Write ( BitStream * bitStream )

Definition at line 186 of file BitStream.cpp.

References GetNumberOfBitsUsed(), GetReadOffset(), and Write().

void BitStream::Write | ( | BitStream & | bitStream,
 |  | BitSize_t | numberOfBits
 | ) |  |

Definition at line 238 of file BitStream.cpp.

References Write().

void BitStream::Write ( BitStream & bitStream )

Definition at line 242 of file BitStream.cpp.

References Write().

void SLNet::BitStream::Write ( const char *const inStringVar )
inline

Definition at line 682 of file BitStream.h.

References SLNet::RakString::Serialize().

void SLNet::BitStream::Write ( const wchar_t *const inStringVar )
inline

Definition at line 686 of file BitStream.h.

References SLNet::RakWString::Serialize().

void SLNet::BitStream::Write ( const unsigned char *const inTemplateVar )
inline

Definition at line 690 of file BitStream.h.

void SLNet::BitStream::Write ( char *const inTemplateVar )
inline

Definition at line 694 of file BitStream.h.

void SLNet::BitStream::Write ( unsigned char *const inTemplateVar )
inline

Definition at line 698 of file BitStream.h.

template<>
void SLNet::BitStream::Write ( const bool & inTemplateVar )
inline

Write a bool to a bitstream.

Parameters
[in] inTemplateVar The value to write

Definition at line 970 of file BitStream.h.

References Write0(), and Write1().

template<>
void SLNet::BitStream::Write ( const SystemAddress & inTemplateVar )
inline

Write a systemAddress to a bitstream.

Parameters
[in] inTemplateVar The value to write

Definition at line 982 of file BitStream.h.

References SLNet::SystemAddress::address, SLNet::SystemAddress::GetIPVersion(), SLNet::SystemAddress::GetPortNetworkOrder(), Write(), and WriteBits().

template<>
void SLNet::BitStream::Write ( const uint24_t & inTemplateVar )
inline

Definition at line 1005 of file BitStream.h.

References AddBitsAndReallocate(), AlignWriteToByteBoundary(), IsBigEndian(), and SLNet::uint24_t::val.

template<>
void SLNet::BitStream::Write ( const RakNetGUID & inTemplateVar )
inline

Definition at line 1027 of file BitStream.h.

References SLNet::RakNetGUID::g, and Write().

template<>
void SLNet::BitStream::Write ( const RakString & inTemplateVar )
inline

Write a string to a bitstream.

Parameters
[in] var The value to write

Definition at line 1035 of file BitStream.h.

References SLNet::RakString::Serialize().

template<>
void SLNet::BitStream::Write ( const RakWString & inTemplateVar )
inline

Definition at line 1040 of file BitStream.h.

References SLNet::RakWString::Serialize().

template<>
void SLNet::BitStream::Write ( const char *const & inStringVar )
inline

Definition at line 1045 of file BitStream.h.

References SLNet::RakString::Serialize().

template<>
void SLNet::BitStream::Write ( const wchar_t *const & inStringVar )
inline

Definition at line 1050 of file BitStream.h.

References SLNet::RakWString::Serialize().

template<>
void SLNet::BitStream::Write ( const unsigned char *const & inTemplateVar )
inline

Definition at line 1055 of file BitStream.h.

References Write().

template<>
void SLNet::BitStream::Write ( char *const & inTemplateVar )
inline

Definition at line 1060 of file BitStream.h.

References Write().

template<>
void SLNet::BitStream::Write ( unsigned char *const & inTemplateVar )
inline

Definition at line 1065 of file BitStream.h.

References Write().

void BitStream::Write0 ( void )

Write a 0.

Definition at line 305 of file BitStream.cpp.

References AddBitsAndReallocate().

Referenced by SLNet::HuffmanEncodingTree::GenerateFromFrequencyTable(), and Write().

void BitStream::Write1 ( void )

Write a 1.

Definition at line 317 of file BitStream.cpp.

References AddBitsAndReallocate().

Referenced by SLNet::HuffmanEncodingTree::GenerateFromFrequencyTable(), and Write().

void BitStream::WriteAlignedBytes | ( | const unsigned char * | inByteArray,
 |  | const unsigned int | numberOfBytesToWrite
 | ) |  |

Align the bitstream to the byte boundary and then write the specified number of bits.

This is faster than WriteBits but wastes the bits to do the alignment and requires you to call ReadAlignedBits at the corresponding read position.

Parameters
[in] | inByteArray | The data
[in] | numberOfBytesToWrite | The size of input.

Definition at line 346 of file BitStream.cpp.

References AlignWriteToByteBoundary(), and Write().

Referenced by SLNet::RakPeer::AdvertiseSystem(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakWString::Serialize(), SLNet::RakString::Serialize(), SLNet::TableSerializer::SerializeCell(), WriteAlignedBytesSafe(), and SLNet::RakPeer::WriteOutOfBandHeader().

void BitStream::WriteAlignedBytesSafe | ( | const char * | inByteArray,
 |  | const unsigned int | inputLength,
 |  | const unsigned int | maxBytesToWrite
 | ) |  |

Aligns the bitstream, writes inputLength, and writes input. Won't write beyond maxBytesToWrite.

Parameters
[in] | inByteArray | The data
[in] | inputLength | The size of input.
[in] | maxBytesToWrite | Max bytes to write

Definition at line 359 of file BitStream.cpp.

References WriteAlignedBytes(), and WriteCompressed().

Referenced by SLNet::TableSerializer::SerializeFilterQuery().

void BitStream::WriteAlignedVar16 ( const char * inByteArray )

Definition at line 1107 of file BitStream.cpp.

References AddBitsAndReallocate(), DoEndianSwap(), and RakAssert.

void BitStream::WriteAlignedVar32 ( const char * inByteArray )

Definition at line 1147 of file BitStream.cpp.

References AddBitsAndReallocate(), DoEndianSwap(), and RakAssert.

void BitStream::WriteAlignedVar8 ( const char * inByteArray )

Definition at line 1090 of file BitStream.cpp.

References AddBitsAndReallocate(), and RakAssert.

void BitStream::WriteBits | ( | const unsigned char * | inByteArray,
 |  | BitSize_t | numberOfBitsToWrite,
 |  | const bool | rightAlignedBits = true
 | ) |  |

Write numberToWrite bits from the input source.

Right aligned data means in the case of a partial byte, the bits are aligned from the right (bit 0) rather than the left (as in the normal internal representation) You would set this to true when writing user data, and false when copying bitstream data, such as writing one bitstream to another.

Parameters
[in] | inByteArray | The data
[in] | numberOfBitsToWrite | The number of bits to write
[in] | rightAlignedBits | if true data will be right aligned

Definition at line 428 of file BitStream.cpp.

References AddBitsAndReallocate().

Referenced by SLNet::HuffmanEncodingTree::DecodeArray(), SLNet::HuffmanEncodingTree::EncodeArray(), SLNet::StringCompressor::EncodeString(), SerializeBits(), Write(), WriteBitsFromIntegerRange(), and WritePtr().

template<class templateType >
void SLNet::BitStream::WriteBitsFromIntegerRange | ( | const templateType | value,
 |  | const templateType | minimum,
 |  | const templateType | maximum,
 |  | bool | allowOutsideRange = false
 | ) |  |

Given the minimum and maximum values for an integer type, figure out the minimum number of bits to represent the range Then write only those bits

Note
A static is used so that the required number of bits for (maximum-minimum) is only calculated once. This does require that minimum and are fixed values for a given line of code for the life of the program
Parameters
[in] | value | Integer value to write, which should be between minimum and maximum
[in] | minimum | Minimum value of value
[in] | maximum | Maximum value of value
[in] | allowOutsideRange | If true, all sends will take an extra bit, however value can deviate from outside minimum and maximum. If false, will assert if the value deviates. This should match the corresponding value passed to Read().

Definition at line 1592 of file BitStream.h.

References BYTES_TO_BITS, and NumberOfLeadingZeroes().

Referenced by SerializeBitsFromIntegerRange().

template<class templateType >
void SLNet::BitStream::WriteBitsFromIntegerRange | ( | const templateType | value,
 |  | const templateType | minimum,
 |  | const templateType | maximum,
 |  | const int | requiredBits,
 |  | bool | allowOutsideRange = false
 | ) |  |
Parameters
[in] requiredBits Primarily for internal use, called from above function() after calculating number of bits needed to represent maximum-minimum

Definition at line 1598 of file BitStream.h.

References IsBigEndian(), RakAssert, ReverseBytes(), Write(), and WriteBits().

template<class destinationType , class sourceType >
void SLNet::BitStream::WriteCasted ( const sourceType & value )

Write one type serialized as another (smaller) type, to save bandwidth serializationType should be uint8_t, uint16_t, uint24_t, or uint32_t Example: int num=53; WriteCasted<uint8_t>(num); would use 1 byte to write what would otherwise be an integer (4 or 8 bytes)

Parameters
[in] value The value to write

Definition at line 1585 of file BitStream.h.

References Write().

Referenced by SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakWString::Serialize().

template<class templateType >
void SLNet::BitStream::WriteCompressed ( const templateType & inTemplateVar )
inline

Write any integral type to a bitstream.

Undefine __BITSTREAM_NATIVE_END if you need endian swapping. If you are not using __BITSTREAM_NATIVE_END the opposite is true for types larger than 1 byte For floating point, this is lossy, using 2 bytes for a float and 4 for a double. The range must be between -1 and +1. For non-floating point, this is lossless, but only has benefit if you use less than half the bits of the type

Parameters
[in] inTemplateVar The value to write

Undefine __BITSTREAM_NATIVE_END if you need endian swapping. For floating point, this is lossy, using 2 bytes for a float and 4 for a double. The range must be between -1 and +1. For non-floating point, this is lossless, but only has benefit if you use less than half the bits of the type If you are not using __BITSTREAM_NATIVE_END the opposite is true for types larger than 1 byte

Parameters
[in] inTemplateVar The value to write

Definition at line 1116 of file BitStream.h.

References DoEndianSwap(), and ReverseBytes().

Referenced by SLNet::StringCompressor::EncodeString(), SerializeCompressed(), SLNet::RakString::SerializeCompressed(), SLNet::TableSerializer::SerializeFilterQuery(), SLNet::TableSerializer::SerializeFilterQueryList(), WriteAlignedBytesSafe(), WriteCompressed(), WriteCompressedDelta(), and WriteVector().

void SLNet::BitStream::WriteCompressed ( const char *const inStringVar )
inline

Definition at line 702 of file BitStream.h.

References SLNet::RakString::SerializeCompressed().

void SLNet::BitStream::WriteCompressed ( const wchar_t *const inStringVar )
inline

Definition at line 706 of file BitStream.h.

References SLNet::RakWString::Serialize().

void SLNet::BitStream::WriteCompressed ( const unsigned char *const inTemplateVar )
inline

Definition at line 710 of file BitStream.h.

void SLNet::BitStream::WriteCompressed ( char *const inTemplateVar )
inline

Definition at line 714 of file BitStream.h.

void SLNet::BitStream::WriteCompressed ( unsigned char *const inTemplateVar )
inline

Definition at line 718 of file BitStream.h.

template<>
void SLNet::BitStream::WriteCompressed ( const SystemAddress & inTemplateVar )
inline

Definition at line 1139 of file BitStream.h.

References Write().

template<>
void SLNet::BitStream::WriteCompressed ( const RakNetGUID & inTemplateVar )
inline

Definition at line 1145 of file BitStream.h.

References Write().

template<>
void SLNet::BitStream::WriteCompressed ( const uint24_t & var )
inline

Definition at line 1151 of file BitStream.h.

References Write().

template<>
void SLNet::BitStream::WriteCompressed ( const bool & inTemplateVar )
inline

Definition at line 1157 of file BitStream.h.

References Write().

template<>
void SLNet::BitStream::WriteCompressed ( const float & inTemplateVar )
inline

For values between -1 and 1.

Definition at line 1164 of file BitStream.h.

References RakAssert, and Write().

template<>
void SLNet::BitStream::WriteCompressed ( const double & inTemplateVar )
inline

For values between -1 and 1.

Definition at line 1177 of file BitStream.h.

References RakAssert, and Write().

template<>
void SLNet::BitStream::WriteCompressed ( const RakString & inTemplateVar )
inline

Compress the string.

Definition at line 1190 of file BitStream.h.

References SLNet::RakString::SerializeCompressed().

template<>
void SLNet::BitStream::WriteCompressed ( const RakWString & inTemplateVar )
inline

Definition at line 1195 of file BitStream.h.

References SLNet::RakWString::Serialize().

template<>
void SLNet::BitStream::WriteCompressed ( const char *const & inStringVar )
inline

Definition at line 1200 of file BitStream.h.

References SLNet::RakString::SerializeCompressed().

template<>
void SLNet::BitStream::WriteCompressed ( const wchar_t *const & inStringVar )
inline

Definition at line 1205 of file BitStream.h.

References SLNet::RakWString::Serialize().

template<>
void SLNet::BitStream::WriteCompressed ( const unsigned char *const & inTemplateVar )
inline

Definition at line 1210 of file BitStream.h.

References WriteCompressed().

template<>
void SLNet::BitStream::WriteCompressed ( char *const & inTemplateVar )
inline

Definition at line 1215 of file BitStream.h.

References WriteCompressed().

template<>
void SLNet::BitStream::WriteCompressed ( unsigned char *const & inTemplateVar )
inline

Definition at line 1220 of file BitStream.h.

References WriteCompressed().

template<class templateType >
void SLNet::BitStream::WriteCompressedDelta | ( | const templateType & | currentValue,
 |  | const templateType & | lastValue
 | ) |  |
inline

Write any integral type to a bitstream.

If the current value is different from the last value the current value will be written. Otherwise, a single bit will be written For floating point, this is lossy, using 2 bytes for a float and 4 for a double. The range must be between -1 and +1. For non-floating point, this is lossless, but only has benefit if you use less than half the bits of the type If you are not using __BITSTREAM_NATIVE_END the opposite is true for types larger than 1 byte

Parameters
[in] | currentValue | The current value to write
[in] | lastValue | The last value to compare against

Definition at line 1235 of file BitStream.h.

References Write(), and WriteCompressed().

Referenced by SerializeCompressedDelta().

template<class templateType >
void SLNet::BitStream::WriteCompressedDelta ( const templateType & currentValue )
inline

Save as WriteCompressedDelta(const templateType &currentValue, const templateType &lastValue) when we have an unknown second parameter.

Definition at line 1262 of file BitStream.h.

References Write(), and WriteCompressed().

template<>
void SLNet::BitStream::WriteCompressedDelta | ( | const bool & | currentValue,
 |  | const bool & | lastValue
 | ) |  |
inline

Write a bool delta. Same thing as just calling Write.

Parameters
[in] | currentValue | The current value to write
[in] | lastValue | The last value to compare against

Definition at line 1252 of file BitStream.h.

References Write().

template<>
void SLNet::BitStream::WriteCompressedDelta ( const bool & currentValue )
inline

Save as WriteCompressedDelta(bool currentValue, const templateType &lastValue) when we have an unknown second bool.

Definition at line 1271 of file BitStream.h.

References Write().

template<class templateType >
void SLNet::BitStream::WriteDelta | ( | const templateType & | currentValue,
 |  | const templateType & | lastValue
 | ) |  |
inline

Write any integral type to a bitstream.

If the current value is different from the last value the current value will be written. Otherwise, a single bit will be written

Parameters
[in] | currentValue | The current value to write
[in] | lastValue | The last value to compare against

Definition at line 1076 of file BitStream.h.

References Write().

Referenced by SerializeDelta().

template<class templateType >
void SLNet::BitStream::WriteDelta ( const templateType & currentValue )
inline

WriteDelta when you don't know what the last value is, or there is no last value.

Parameters
[in] currentValue The current value to write

Definition at line 1103 of file BitStream.h.

References Write().

template<>
void SLNet::BitStream::WriteDelta | ( | const bool & | currentValue,
 |  | const bool & | lastValue
 | ) |  |
inline

Write a bool delta. Same thing as just calling Write.

Parameters
[in] | currentValue | The current value to write
[in] | lastValue | The last value to compare against

Definition at line 1093 of file BitStream.h.

References Write().

void BitStream::WriteFloat16 | ( | float | x,
 |  | float | floatMin,
 |  | float | floatMax
 | ) |  |

Write a float into 2 bytes, spanning the range between floatMin and floatMax.

Parameters
[in] | x | The float to write
[in] | floatMin | Predetermined minimum value of f
[in] | floatMax | Predetermined maximum value of f

Definition at line 1218 of file BitStream.cpp.

References RakAssert, and Write().

Referenced by SerializeFloat16(), and WriteNormVector().

template<class templateType >
void SLNet::BitStream::WriteNormQuat | ( | templateType | w,
 |  | templateType | x,
 |  | templateType | y,
 |  | templateType | z
 | ) |  |

Write a normalized quaternion in 6 bytes + 4 bits instead of 16 bytes. Slightly lossy.

Parameters
[in] | w | w
[in] | x | x
[in] | y | y
[in] | z | z

Definition at line 1654 of file BitStream.h.

References Write().

Referenced by SerializeNormQuat(), and WriteOrthMatrix().

template<class templateType >
void SLNet::BitStream::WriteNormVector | ( | templateType | x,
 |  | templateType | y,
 |  | templateType | z
 | ) |  |

Write a normalized 3D vector, using (at most) 4 bytes + 3 bits instead of 12-24 bytes.

Will further compress y or z axis aligned vectors. Accurate to 1/32767.5.

Parameters
[in] | x | x
[in] | y | y
[in] | z | z

Definition at line 1626 of file BitStream.h.

References RakAssert, and WriteFloat16().

Referenced by SerializeNormVector().

template<class templateType >
void SLNet::BitStream::WriteOrthMatrix | ( | templateType | m00,
 |  | templateType | m01,
 |  | templateType | m02,
 |  | templateType | m10,
 |  | templateType | m11,
 |  | templateType | m12,
 |  | templateType | m20,
 |  | templateType | m21,
 |  | templateType | m22
 | ) |  |

Write an orthogonal matrix by creating a quaternion, and writing 3 components of the quaternion in 2 bytes each.

Use 6 bytes instead of 36 Lossy, although the result is renormalized

Definition at line 1667 of file BitStream.h.

References _copysign, and WriteNormQuat().

Referenced by SerializeOrthMatrix().

template<class templateType >
void SLNet::BitStream::WritePtr ( templateType * inTemplateVar )
inline

Write the dereferenced pointer to any integral type to a bitstream.

Undefine __BITSTREAM_NATIVE_END if you need endian swapping.

Parameters
[in] inTemplateVar The value to write

Definition at line 945 of file BitStream.h.

References DoEndianSwap(), ReverseBytes(), and WriteBits().

template<class templateType >
void SLNet::BitStream::WriteVector | ( | templateType | x,
 |  | templateType | y,
 |  | templateType | z
 | ) |  |

Write a vector, using 10 bytes instead of 12.

Loses accuracy to about 3/10ths and only saves 2 bytes, so only use if accuracy is not important.

Parameters
[in] | x | x
[in] | y | y
[in] | z | z

Definition at line 1638 of file BitStream.h.

References Write(), and WriteCompressed().

Referenced by SerializeVector().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/BitStream.h
  • Source/src/BitStream.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::CCRakNetSlidingWindow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • CCRakNetSlidingWindow
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::CCRakNetSlidingWindow Class Reference

#include <slikenet/CCRakNetSlidingWindow.h>

Public Member Functions

CCRakNetSlidingWindow ()
~CCRakNetSlidingWindow ()
void | Init (CCTimeType curTime, uint32_t maxDatagramPayload)
Reset all variables to their initial states, for a new connection.
void | Update (CCTimeType curTime, bool hasDataToSendOrResend)
Update over time.
int | GetRetransmissionBandwidth (CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend)
int | GetTransmissionBandwidth (CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend)
bool | ShouldSendACKs (CCTimeType curTime, CCTimeType estimatedTimeToNextTick)
DatagramSequenceNumberType | GetAndIncrementNextDatagramSequenceNumber (void)
DatagramSequenceNumberType | GetNextDatagramSequenceNumber (void)
void | OnSendBytes (CCTimeType curTime, uint32_t numBytes)
void | OnGotPacketPair (DatagramSequenceNumberType datagramSequenceNumber, uint32_t sizeInBytes, CCTimeType curTime)
Call this when you get a packet pair.
bool | OnGotPacket (DatagramSequenceNumberType datagramSequenceNumber, bool isContinuousSend, CCTimeType curTime, uint32_t sizeInBytes, uint32_t *skippedMessageCount)
void | OnResend (CCTimeType curTime, SLNet::TimeUS nextActionTime)
void | OnNAK (CCTimeType curTime, DatagramSequenceNumberType nakSequenceNumber)
void | OnAck (CCTimeType curTime, CCTimeType rtt, bool hasBAndAS, BytesPerMicrosecond _B, BytesPerMicrosecond _AS, double totalUserDataBytesAcked, bool isContinuousSend, DatagramSequenceNumberType sequenceNumber)
void | OnDuplicateAck (CCTimeType curTime, DatagramSequenceNumberType sequenceNumber)
void | OnSendAckGetBAndAS (CCTimeType curTime, bool *hasBAndAS, BytesPerMicrosecond *_B, BytesPerMicrosecond *_AS)
void | OnSendAck (CCTimeType curTime, uint32_t numBytes)
void | OnSendNACK (CCTimeType curTime, uint32_t numBytes)
CCTimeType | GetRTOForRetransmission (unsigned char timesSent) const
void | SetMTU (uint32_t bytes)
uint32_t | GetMTU (void) const
Return what was set by SetMTU()
BytesPerMicrosecond | GetLocalSendRate (void) const
Query for statistics.
BytesPerMicrosecond | GetLocalReceiveRate (CCTimeType currentTime) const
BytesPerMicrosecond | GetRemoveReceiveRate (void) const
BytesPerMicrosecond | GetEstimatedBandwidth (void) const
double | GetLinkCapacityBytesPerSecond (void) const
double | GetRTT (void) const
Query for statistics.
bool | GetIsInSlowStart (void) const
uint32_t | GetCWNDLimit (void) const
uint64_t | GetBytesPerSecondLimitByCongestionControl (void) const

Static Public Member Functions

static bool | GreaterThan (DatagramSequenceNumberType a, DatagramSequenceNumberType b)
Is a > b, accounting for variable overflow?
static bool | LessThan (DatagramSequenceNumberType a, DatagramSequenceNumberType b)
Is a < b, accounting for variable overflow?

Protected Member Functions

CCTimeType | GetSenderRTOForACK (void) const
bool | IsInSlowStart (void) const

Protected Attributes

uint32_t MAXIMUM_MTU_INCLUDING_UDP_HEADER
double | cwnd
double | ssThresh
CCTimeType oldestUnsentAck
DatagramSequenceNumberType nextDatagramSequenceNumber
Every outgoing datagram is assigned a sequence number, which increments by 1 every assignment.
DatagramSequenceNumberType nextCongestionControlBlock
bool | backoffThisBlock
bool | speedUpThisBlock
DatagramSequenceNumberType expectedNextSequenceNumber
bool | _isContinuousSend
double | lastRtt
double | estimatedRTT
double | deviationRtt

Detailed Description

Definition at line 86 of file CCRakNetSlidingWindow.h.

Constructor & Destructor Documentation

SLNet::CCRakNetSlidingWindow::CCRakNetSlidingWindow ( )
SLNet::CCRakNetSlidingWindow::~CCRakNetSlidingWindow ( )

Member Function Documentation

DatagramSequenceNumberType SLNet::CCRakNetSlidingWindow::GetAndIncrementNextDatagramSequenceNumber ( void )

Every data packet sent must contain a sequence number Call this function to get it. The sequence number is passed into OnGotPacketPair()

uint64_t SLNet::CCRakNetSlidingWindow::GetBytesPerSecondLimitByCongestionControl ( void ) const
uint32_t SLNet::CCRakNetSlidingWindow::GetCWNDLimit ( void ) const
inline

Definition at line 181 of file CCRakNetSlidingWindow.h.

BytesPerMicrosecond SLNet::CCRakNetSlidingWindow::GetEstimatedBandwidth ( void ) const
inline

Definition at line 174 of file CCRakNetSlidingWindow.h.

References GetLinkCapacityBytesPerSecond().

bool SLNet::CCRakNetSlidingWindow::GetIsInSlowStart ( void ) const
inline

Definition at line 180 of file CCRakNetSlidingWindow.h.

References IsInSlowStart().

double SLNet::CCRakNetSlidingWindow::GetLinkCapacityBytesPerSecond ( void ) const
inline

Definition at line 175 of file CCRakNetSlidingWindow.h.

Referenced by GetEstimatedBandwidth().

BytesPerMicrosecond SLNet::CCRakNetSlidingWindow::GetLocalReceiveRate ( CCTimeType currentTime ) const
BytesPerMicrosecond SLNet::CCRakNetSlidingWindow::GetLocalSendRate ( void ) const
inline

Query for statistics.

Definition at line 170 of file CCRakNetSlidingWindow.h.

uint32_t SLNet::CCRakNetSlidingWindow::GetMTU ( void ) const

Return what was set by SetMTU()

DatagramSequenceNumberType SLNet::CCRakNetSlidingWindow::GetNextDatagramSequenceNumber ( void )
BytesPerMicrosecond SLNet::CCRakNetSlidingWindow::GetRemoveReceiveRate ( void ) const
inline

Definition at line 172 of file CCRakNetSlidingWindow.h.

int SLNet::CCRakNetSlidingWindow::GetRetransmissionBandwidth | ( | CCTimeType | curTime,
 |  | CCTimeType | timeSinceLastTick,
 |  | uint32_t | unacknowledgedBytes,
 |  | bool | isContinuousSend
 | ) |  |
CCTimeType SLNet::CCRakNetSlidingWindow::GetRTOForRetransmission ( unsigned char timesSent ) const

Retransmission time out for the sender If the time difference between when a message was last transmitted, and the current time is greater than RTO then packet is eligible for retransmission, pending congestion control RTO = (RTT + 4 * RTTVar) + SYN If we have been continuously sending for the last RTO, and no ACK or NAK at all, SND*=2; This is per message, which is different from UDT, but RakNet supports packetloss with continuing data where UDT is only RELIABLE_ORDERED Minimum value is 100 milliseconds

double SLNet::CCRakNetSlidingWindow::GetRTT ( void ) const

Query for statistics.

CCTimeType SLNet::CCRakNetSlidingWindow::GetSenderRTOForACK ( void ) const
protected
int SLNet::CCRakNetSlidingWindow::GetTransmissionBandwidth | ( | CCTimeType | curTime,
 |  | CCTimeType | timeSinceLastTick,
 |  | uint32_t | unacknowledgedBytes,
 |  | bool | isContinuousSend
 | ) |  |
static bool SLNet::CCRakNetSlidingWindow::GreaterThan | ( | DatagramSequenceNumberType | a,
 |  | DatagramSequenceNumberType | b
 | ) |  |
static

Is a > b, accounting for variable overflow?

void SLNet::CCRakNetSlidingWindow::Init | ( | CCTimeType | curTime,
 |  | uint32_t | maxDatagramPayload
 | ) |  |

Reset all variables to their initial states, for a new connection.

bool SLNet::CCRakNetSlidingWindow::IsInSlowStart ( void ) const
protected

Referenced by GetIsInSlowStart().

static bool SLNet::CCRakNetSlidingWindow::LessThan | ( | DatagramSequenceNumberType | a,
 |  | DatagramSequenceNumberType | b
 | ) |  |
static

Is a < b, accounting for variable overflow?

void SLNet::CCRakNetSlidingWindow::OnAck | ( | CCTimeType | curTime,
 |  | CCTimeType | rtt,
 |  | bool | hasBAndAS,
 |  | BytesPerMicrosecond | _B,
 |  | BytesPerMicrosecond | _AS,
 |  | double | totalUserDataBytesAcked,
 |  | bool | isContinuousSend,
 |  | DatagramSequenceNumberType | sequenceNumber
 | ) |  |

Call this when an ACK arrives. hasBAndAS are possibly written with the ack, see OnSendAck() B and AS are used in the calculations in UpdateWindowSizeAndAckOnAckPerSyn B and AS are updated at most once per SYN

void SLNet::CCRakNetSlidingWindow::OnDuplicateAck | ( | CCTimeType | curTime,
 |  | DatagramSequenceNumberType | sequenceNumber
 | ) |  |
bool SLNet::CCRakNetSlidingWindow::OnGotPacket | ( | DatagramSequenceNumberType | datagramSequenceNumber,
 |  | bool | isContinuousSend,
 |  | CCTimeType | curTime,
 |  | uint32_t | sizeInBytes,
 |  | uint32_t * | skippedMessageCount
 | ) |  |

Call this when you get a packet (including packet pairs) If the DatagramSequenceNumberType is out of order, skippedMessageCount will be non-zero In that case, send a NAK for every sequence number up to that count

void SLNet::CCRakNetSlidingWindow::OnGotPacketPair | ( | DatagramSequenceNumberType | datagramSequenceNumber,
 |  | uint32_t | sizeInBytes,
 |  | CCTimeType | curTime
 | ) |  |

Call this when you get a packet pair.

void SLNet::CCRakNetSlidingWindow::OnNAK | ( | CCTimeType | curTime,
 |  | DatagramSequenceNumberType | nakSequenceNumber
 | ) |  |
void SLNet::CCRakNetSlidingWindow::OnResend | ( | CCTimeType | curTime,
 |  | SLNet::TimeUS | nextActionTime
 | ) |  |

Call when you get a NAK, with the sequence number of the lost message Affects the congestion control

void SLNet::CCRakNetSlidingWindow::OnSendAck | ( | CCTimeType | curTime,
 |  | uint32_t | numBytes
 | ) |  |

Call when we send an ack, to write B and AS if needed B and AS are only written once per SYN, to prevent slow calculations Also updates SND, the period between sends, since data is written out Be sure to call OnSendAckGetBAndAS() before calling OnSendAck(), since whether you write it or not affects numBytes

void SLNet::CCRakNetSlidingWindow::OnSendAckGetBAndAS | ( | CCTimeType | curTime,
 |  | bool * | hasBAndAS,
 |  | BytesPerMicrosecond * | _B,
 |  | BytesPerMicrosecond * | _AS
 | ) |  |

Call when you send an ack, to see if the ack should have the B and AS parameters transmitted Call before calling OnSendAck()

void SLNet::CCRakNetSlidingWindow::OnSendBytes | ( | CCTimeType | curTime,
 |  | uint32_t | numBytes
 | ) |  |

Call this when you send packets Every 15th and 16th packets should be sent as a packet pair if possible When packets marked as a packet pair arrive, pass to OnGotPacketPair() When any packets arrive, (additionally) pass to OnGotPacket Packets should contain our system time, so we can pass rtt to OnNonDuplicateAck()

void SLNet::CCRakNetSlidingWindow::OnSendNACK | ( | CCTimeType | curTime,
 |  | uint32_t | numBytes
 | ) |  |

Call when we send a NACK Also updates SND, the period between sends, since data is written out

void SLNet::CCRakNetSlidingWindow::SetMTU ( uint32_t bytes )

Set the maximum amount of data that can be sent in one datagram Default to MAXIMUM_MTU_SIZE-UDP_HEADER_SIZE

bool SLNet::CCRakNetSlidingWindow::ShouldSendACKs | ( | CCTimeType | curTime,
 |  | CCTimeType | estimatedTimeToNextTick
 | ) |  |

Acks do not have to be sent immediately. Instead, they can be buffered up such that groups of acks are sent at a time This reduces overall bandwidth usage How long they can be buffered depends on the retransmit time of the sender Should call once per update tick, and send if needed

void SLNet::CCRakNetSlidingWindow::Update | ( | CCTimeType | curTime,
 |  | bool | hasDataToSendOrResend
 | ) |  |

Update over time.

Member Data Documentation

bool SLNet::CCRakNetSlidingWindow::_isContinuousSend
protected

Definition at line 213 of file CCRakNetSlidingWindow.h.

bool SLNet::CCRakNetSlidingWindow::backoffThisBlock
protected

Definition at line 208 of file CCRakNetSlidingWindow.h.

double SLNet::CCRakNetSlidingWindow::cwnd
protected

Definition at line 196 of file CCRakNetSlidingWindow.h.

double SLNet::CCRakNetSlidingWindow::deviationRtt
protected

Definition at line 217 of file CCRakNetSlidingWindow.h.

double SLNet::CCRakNetSlidingWindow::estimatedRTT
protected

Definition at line 217 of file CCRakNetSlidingWindow.h.

DatagramSequenceNumberType SLNet::CCRakNetSlidingWindow::expectedNextSequenceNumber
protected

Track which datagram sequence numbers have arrived. If a sequence number is skipped, send a NAK for all skipped messages

Definition at line 211 of file CCRakNetSlidingWindow.h.

double SLNet::CCRakNetSlidingWindow::lastRtt
protected

Definition at line 217 of file CCRakNetSlidingWindow.h.

uint32_t SLNet::CCRakNetSlidingWindow::MAXIMUM_MTU_INCLUDING_UDP_HEADER
protected

Definition at line 194 of file CCRakNetSlidingWindow.h.

DatagramSequenceNumberType SLNet::CCRakNetSlidingWindow::nextCongestionControlBlock
protected

Definition at line 207 of file CCRakNetSlidingWindow.h.

DatagramSequenceNumberType SLNet::CCRakNetSlidingWindow::nextDatagramSequenceNumber
protected

Every outgoing datagram is assigned a sequence number, which increments by 1 every assignment.

Definition at line 206 of file CCRakNetSlidingWindow.h.

CCTimeType SLNet::CCRakNetSlidingWindow::oldestUnsentAck
protected

When we get an ack, if oldestUnsentAck==0, set it to the current time When we send out acks, set oldestUnsentAck to 0

Definition at line 201 of file CCRakNetSlidingWindow.h.

bool SLNet::CCRakNetSlidingWindow::speedUpThisBlock
protected

Definition at line 208 of file CCRakNetSlidingWindow.h.

double SLNet::CCRakNetSlidingWindow::ssThresh
protected

Definition at line 197 of file CCRakNetSlidingWindow.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/CCRakNetSlidingWindow.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakNetCommandParser Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetCommandParser
Public Member Functions | Protected Attributes | List of all members
SLNet::RakNetCommandParser Class Reference

This allows a console client to call most of the functions in RakPeer. More...

#include <slikenet/commandparser.h>

+ Inheritance diagram for SLNet::RakNetCommandParser:

Public Member Functions

RakNetCommandParser ()
~RakNetCommandParser ()
bool | OnCommand (const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)
const char * | GetName (void) const
void | SendHelp (TransportInterface *transport, const SystemAddress &systemAddress)
void | SetRakPeerInterface (SLNet::RakPeerInterface *rakPeer)
- Public Member Functions inherited from SLNet::CommandParserInterface
CommandParserInterface ()
virtual | ~CommandParserInterface ()
virtual void | OnNewIncomingConnection (const SystemAddress &systemAddress, TransportInterface *transport)
A callback for when systemAddress has connected to us.
virtual void | OnConnectionLost (const SystemAddress &systemAddress, TransportInterface *transport)
A callback for when systemAddress has disconnected, either gracefully or forcefully.
virtual void | OnTransportChange (TransportInterface *transport)
This is called every time transport interface is registered.
virtual bool | GetRegisteredCommand (const char *command, RegisteredCommand *rc)
virtual void | SendCommandList (TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | RegisterCommand (unsigned char parameterCount, const char *command, const char *commandHelp)
virtual void | ReturnResult (bool res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
Just writes a string to the remote system based on the result ( res ) of your operation.
virtual void | ReturnResult (char *res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | ReturnResult (SystemAddress res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | ReturnResult (int res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | ReturnResult (const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
Just writes a string to the remote system when you are calling a function that has no return value.

Protected Attributes

RakPeerInterface * peer
Which instance of RakPeer we are working on. Set from SetRakPeerInterface()
- Protected Attributes inherited from SLNet::CommandParserInterface
DataStructures::OrderedList
< const char
*, RegisteredCommand,
RegisteredCommandComp > 		commandList

Additional Inherited Members

- Static Public Member Functions inherited from SLNet::CommandParserInterface
static void | ParseConsoleString (char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength)
- Static Public Attributes inherited from SLNet::CommandParserInterface
static const unsigned char | VARIABLE_NUMBER_OF_PARAMETERS =255

Detailed Description

This allows a console client to call most of the functions in RakPeer.

Definition at line 34 of file commandparser.h.

Constructor & Destructor Documentation

SLNet::RakNetCommandParser::RakNetCommandParser ( )
SLNet::RakNetCommandParser::~RakNetCommandParser ( )

Member Function Documentation

const char* SLNet::RakNetCommandParser::GetName ( void ) const
virtual

You are responsible for overriding this function and returning a static string, which will identifier your parser. This should return a static string

Returns
The name that you return.

Implements SLNet::CommandParserInterface.

bool SLNet::RakNetCommandParser::OnCommand | ( | const char * | command,
 |  | unsigned | numParameters,
 |  | char ** | parameterList,
 |  | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress,
 |  | const char * | originalString
 | ) |  |
virtual

Given command with parameters parameterList , do whatever processing you wish.

Parameters
[in] | command | The command to process
[in] | numParameters | How many parameters were passed along with the command
[in] | parameterList | The list of parameters. parameterList[0] is the first parameter and so on.
[in] | transport | The transport interface we can use to write to
[in] | systemAddress | The player that sent this command.
[in] | originalString | The string that was actually sent over the network, in case you want to do your own parsing

Implements SLNet::CommandParserInterface.

void SLNet::RakNetCommandParser::SendHelp | ( | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress
 | ) |  |
virtual

A callback for when you are expected to send a brief description of your parser to systemAddress

Parameters
[in] | transport | The transport interface we can use to write to
[in] | systemAddress | The player that requested help.

Implements SLNet::CommandParserInterface.

void SLNet::RakNetCommandParser::SetRakPeerInterface ( SLNet::RakPeerInterface * rakPeer )

Records the instance of RakPeer to perform the desired commands on

Parameters
[in] rakPeer The RakPeer instance, or a derived class (e.g. RakPeer or RakPeer)

Member Data Documentation

RakPeerInterface* SLNet::RakNetCommandParser::peer
protected

Which instance of RakPeer we are working on. Set from SetRakPeerInterface()

Definition at line 68 of file commandparser.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/commandparser.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::CommandParserInterface Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • CommandParserInterface
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
SLNet::CommandParserInterface Class Referenceabstract

The interface used by command parsers. More...

#include <slikenet/CommandParserInterface.h>

+ Inheritance diagram for SLNet::CommandParserInterface:

Public Member Functions

CommandParserInterface ()
virtual | ~CommandParserInterface ()
virtual const char * | GetName (void) const =0
virtual void | OnNewIncomingConnection (const SystemAddress &systemAddress, TransportInterface *transport)
A callback for when systemAddress has connected to us.
virtual void | OnConnectionLost (const SystemAddress &systemAddress, TransportInterface *transport)
A callback for when systemAddress has disconnected, either gracefully or forcefully.
virtual void | SendHelp (TransportInterface *transport, const SystemAddress &systemAddress)=0
A callback for when you are expected to send a brief description of your parser to systemAddress.
virtual bool | OnCommand (const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)=0
Given command with parameters parameterList , do whatever processing you wish.
virtual void | OnTransportChange (TransportInterface *transport)
This is called every time transport interface is registered.
virtual bool | GetRegisteredCommand (const char *command, RegisteredCommand *rc)
virtual void | SendCommandList (TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | RegisterCommand (unsigned char parameterCount, const char *command, const char *commandHelp)
virtual void | ReturnResult (bool res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
Just writes a string to the remote system based on the result ( res ) of your operation.
virtual void | ReturnResult (char *res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | ReturnResult (SystemAddress res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | ReturnResult (int res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | ReturnResult (const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
Just writes a string to the remote system when you are calling a function that has no return value.

Static Public Member Functions

static void ParseConsoleString (char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength)

Static Public Attributes

static const unsigned char VARIABLE_NUMBER_OF_PARAMETERS =255

Protected Attributes

DataStructures::OrderedList
< const char
*, RegisteredCommand,
RegisteredCommandComp > 		commandList

Detailed Description

The interface used by command parsers.

CommandParserInterface provides a set of functions and interfaces that plug into the ConsoleServer class. Each CommandParserInterface works at the same time as other interfaces in the system.

Definition at line 50 of file CommandParserInterface.h.

Constructor & Destructor Documentation

CommandParserInterface::CommandParserInterface ( )

Definition at line 46 of file CommandParserInterface.cpp.

CommandParserInterface::~CommandParserInterface ( )
virtual

Definition at line 47 of file CommandParserInterface.cpp.

Member Function Documentation

virtual const char* SLNet::CommandParserInterface::GetName ( void ) const
pure virtual

You are responsible for overriding this function and returning a static string, which will identifier your parser. This should return a static string

Returns
The name that you return.

Implemented in SLNet::LogCommandParser, and SLNet::RakNetCommandParser.

bool CommandParserInterface::GetRegisteredCommand | ( | const char * | command,
 |  | RegisteredCommand * | rc
 | ) |  |
virtual

Definition at line 119 of file CommandParserInterface.cpp.

References commandList, and DataStructures::OrderedList< key_type, data_type, default_comparison_function >::GetIndexFromKey().

virtual bool SLNet::CommandParserInterface::OnCommand | ( | const char * | command,
 |  | unsigned | numParameters,
 |  | char ** | parameterList,
 |  | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress,
 |  | const char * | originalString
 | ) |  |
pure virtual

Given command with parameters parameterList , do whatever processing you wish.

Parameters
[in] | command | The command to process
[in] | numParameters | How many parameters were passed along with the command
[in] | parameterList | The list of parameters. parameterList[0] is the first parameter and so on.
[in] | transport | The transport interface we can use to write to
[in] | systemAddress | The player that sent this command.
[in] | originalString | The string that was actually sent over the network, in case you want to do your own parsing

Implemented in SLNet::LogCommandParser, and SLNet::RakNetCommandParser.

void CommandParserInterface::OnConnectionLost | ( | const SystemAddress & | systemAddress,
 |  | TransportInterface * | transport
 | ) |  |
virtual

A callback for when systemAddress has disconnected, either gracefully or forcefully.

Parameters
[in] | systemAddress | The player that has disconnected.
[in] | transport | The transport interface that sent us this information.

Reimplemented in SLNet::LogCommandParser.

Definition at line 137 of file CommandParserInterface.cpp.

void CommandParserInterface::OnNewIncomingConnection | ( | const SystemAddress & | systemAddress,
 |  | TransportInterface * | transport
 | ) |  |
virtual

A callback for when systemAddress has connected to us.

Parameters
[in] | systemAddress | The player that has connected.
[in] | transport | The transport interface that sent us this information. Can be used to send messages to this or other players.

Reimplemented in SLNet::LogCommandParser.

Definition at line 132 of file CommandParserInterface.cpp.

void CommandParserInterface::OnTransportChange ( TransportInterface * transport )
virtual

This is called every time transport interface is registered.

If you want to save a copy of the TransportInterface pointer This is the place to do it

Parameters
[in] transport The new TransportInterface

Reimplemented in SLNet::LogCommandParser.

Definition at line 128 of file CommandParserInterface.cpp.

void CommandParserInterface::ParseConsoleString | ( | char * | str,
 |  | const char | delineator,
 |  | unsigned char | delineatorToggle,
 |  | unsigned * | numParameters,
 |  | char ** | parameterList,
 |  | unsigned | parameterListLength
 | ) |  |
static

Definition at line 49 of file CommandParserInterface.cpp.

References RakAssert.

void CommandParserInterface::RegisterCommand | ( | unsigned char | parameterCount,
 |  | const char * | command,
 |  | const char * | commandHelp
 | ) |  |
virtual

Registers a command.

Parameters
[in] | parameterCount | How many parameters your command requires. If you want to accept a variable number of commands, pass CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS
[in] | command | A pointer to a STATIC string that has your command. I keep a copy of the pointer here so don't deallocate the string.
[in] | commandHelp | A pointer to a STATIC string that has the help information for your command. I keep a copy of the pointer here so don't deallocate the string.

Definition at line 111 of file CommandParserInterface.cpp.

References _FILE_AND_LINE_, SLNet::RegisteredCommand::command, SLNet::RegisteredCommand::commandHelp, commandList, DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Insert(), and SLNet::RegisteredCommand::parameterCount.

void CommandParserInterface::ReturnResult | ( | bool | res,
 |  | const char * | command,
 |  | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress
 | ) |  |
virtual

Just writes a string to the remote system based on the result ( res ) of your operation.

This is not necessary to call, but makes it easier to return results of function calls.

Parameters
[in] | res | The result to write
[in] | command | The command that this result came from
[in] | transport | The transport interface that will be written to
[in] | systemAddress | The player this result will be sent to

Definition at line 142 of file CommandParserInterface.cpp.

References SLNet::TransportInterface::Send().

void CommandParserInterface::ReturnResult | ( | char * | res,
 |  | const char * | command,
 |  | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress
 | ) |  |
virtual

Definition at line 157 of file CommandParserInterface.cpp.

References SLNet::TransportInterface::Send().

void CommandParserInterface::ReturnResult | ( | SystemAddress | res,
 |  | const char * | command,
 |  | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress
 | ) |  |
virtual

Definition at line 161 of file CommandParserInterface.cpp.

References SLNet::SystemAddress::GetPort(), SLNet::TransportInterface::Send(), and SLNet::SystemAddress::ToString().

void CommandParserInterface::ReturnResult | ( | int | res,
 |  | const char * | command,
 |  | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress
 | ) |  |
virtual

Definition at line 149 of file CommandParserInterface.cpp.

References SLNet::TransportInterface::Send().

void CommandParserInterface::ReturnResult | ( | const char * | command,
 |  | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress
 | ) |  |
virtual

Just writes a string to the remote system when you are calling a function that has no return value.

This is not necessary to call, but makes it easier to return results of function calls.

Parameters
[in] | res | The result to write
[in] | command | The command that this result came from
[in] | transport | The transport interface that will be written to
[in] | systemAddress | The player this result will be sent to

Definition at line 153 of file CommandParserInterface.cpp.

References SLNet::TransportInterface::Send().

void CommandParserInterface::SendCommandList | ( | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress
 | ) |  |
virtual

Definition at line 95 of file CommandParserInterface.cpp.

References commandList, SLNet::TransportInterface::Send(), and DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Size().

virtual void SLNet::CommandParserInterface::SendHelp | ( | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress
 | ) |  |
pure virtual

A callback for when you are expected to send a brief description of your parser to systemAddress.

Parameters
[in] | transport | The transport interface we can use to write to
[in] | systemAddress | The player that requested help.

Implemented in SLNet::LogCommandParser, and SLNet::RakNetCommandParser.

Member Data Documentation

DataStructures::OrderedList<const char*, RegisteredCommand, RegisteredCommandComp> SLNet::CommandParserInterface::commandList
protected

Definition at line 146 of file CommandParserInterface.h.

Referenced by GetRegisteredCommand(), RegisterCommand(), and SendCommandList().

const unsigned char CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS =255
static

Definition at line 114 of file CommandParserInterface.h.

The documentation for this class was generated from the following files:
  • Source/include/slikenet/CommandParserInterface.h
  • Source/src/CommandParserInterface.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::ConnectionGraph2 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • ConnectionGraph2
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::ConnectionGraph2 Class Reference

A one hop connection graph. More...

#include <slikenet/ConnectionGraph2.h>

+ Inheritance diagram for SLNet::ConnectionGraph2:

Classes

struct | RemoteSystem
struct | SystemAddressAndGuid

Public Member Functions

ConnectionGraph2 ()
~ConnectionGraph2 ()
bool | GetConnectionListForRemoteSystem (RakNetGUID remoteSystemGuid, SystemAddress *saOut, RakNetGUID *guidOut, unsigned int *outLength)
Given a remote system identified by RakNetGUID, return the list of SystemAddresses and RakNetGUIDs they are connected to.
bool | ConnectionExists (RakNetGUID g1, RakNetGUID g2)
Returns if g1 is connected to g2.
uint16_t | GetPingBetweenSystems (RakNetGUID g1, RakNetGUID g2) const
Returns the average ping between two systems in the connection graph. Returns -1 if no connection exists between those systems.
RakNetGUID | GetLowestAveragePingSystem (void) const
void | SetAutoProcessNewConnections (bool b)
If called with false, then new connections are only added to the connection graph when you call ProcessNewConnection();.
bool | GetAutoProcessNewConnections (void) const
Returns value passed to SetAutoProcessNewConnections()
void | AddParticipant (const SystemAddress &systemAddress, RakNetGUID rakNetGUID)
If you call SetAutoProcessNewConnections(false);, then you will need to manually call ProcessNewConnection() on new connections.
void | GetParticipantList (DataStructures::OrderedList< RakNetGUID, RakNetGUID > &participantList)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Static Public Member Functions

static int | SystemAddressAndGuidComp (const SystemAddressAndGuid &key, const SystemAddressAndGuid &data)
static int | RemoteSystemComp (const RakNetGUID &key, RemoteSystem *const &data)

Protected Member Functions

virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual PluginReceiveResult | OnReceive (Packet *packet)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::OrderedList
< RakNetGUID, RemoteSystem
*, ConnectionGraph2::RemoteSystemComp > 		remoteSystems
bool autoProcessNewConnections
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Detailed Description

A one hop connection graph.

Sends ID_REMOTE_CONNECTION_LOST, ID_REMOTE_DISCONNECTION_NOTIFICATION, ID_REMOTE_NEW_INCOMING_CONNECTION
All identifiers are followed by SystemAddress, then RakNetGUID Also stores the list for you, which you can access with GetConnectionListForRemoteSystem

Definition at line 45 of file ConnectionGraph2.h.

Class Documentation

struct SLNet::ConnectionGraph2::RemoteSystem

Definition at line 104 of file ConnectionGraph2.h.

Class Members
RakNetGUID | guid
OrderedList < SystemAddressAndGuid, SystemAddressAndGuid, SystemAddressAndGuidComp > | remoteConnections
struct SLNet::ConnectionGraph2::SystemAddressAndGuid

Definition at line 94 of file ConnectionGraph2.h.

Class Members
RakNetGUID | guid
uint16_t | sendersPingToThatSystem
SystemAddress | systemAddress

Constructor & Destructor Documentation

SLNet::ConnectionGraph2::ConnectionGraph2 ( )
SLNet::ConnectionGraph2::~ConnectionGraph2 ( )

Member Function Documentation

void SLNet::ConnectionGraph2::AddParticipant | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID
 | ) |  |

If you call SetAutoProcessNewConnections(false);, then you will need to manually call ProcessNewConnection() on new connections.

On ID_NEW_INCOMING_CONNECTION or ID_CONNECTION_REQUEST_ACCEPTED, adds that system to the graph Do not call ProcessNewConnection() manually otherwise

Parameters
[in] | The | packet->SystemAddress member
[in] | The | packet->guid member
bool SLNet::ConnectionGraph2::ConnectionExists | ( | RakNetGUID | g1,
 |  | RakNetGUID | g2
 | ) |  |

Returns if g1 is connected to g2.

bool SLNet::ConnectionGraph2::GetAutoProcessNewConnections ( void ) const

Returns value passed to SetAutoProcessNewConnections()

Returns
Value passed to SetAutoProcessNewConnections(), or the default of true if it was never called
bool SLNet::ConnectionGraph2::GetConnectionListForRemoteSystem | ( | RakNetGUID | remoteSystemGuid,
 |  | SystemAddress * | saOut,
 |  | RakNetGUID * | guidOut,
 |  | unsigned int * | outLength
 | ) |  |

Given a remote system identified by RakNetGUID, return the list of SystemAddresses and RakNetGUIDs they are connected to.

Parameters
[in] | remoteSystemGuid | Which system we are referring to. This only works for remote systems, not ourselves.
[out] | saOut | A preallocated array to hold the output list of SystemAddress. Can be 0 if you don't care.
[out] | guidOut | A preallocated array to hold the output list of RakNetGUID. Can be 0 if you don't care.
[in,out] | outLength | On input, the size of saOut and guidOut. On output, modified to reflect the number of elements actually written
Returns
True if remoteSystemGuid was found. Otherwise false, and saOut, guidOut remain unchanged. outLength will be set to 0.
RakNetGUID SLNet::ConnectionGraph2::GetLowestAveragePingSystem ( void ) const

Returns the system with the lowest average ping among all its connections. If you need one system in the peer to peer group to relay data, have the FullyConnectedMesh2 host call this function after host migration, and use that system

void SLNet::ConnectionGraph2::GetParticipantList ( DataStructures::OrderedList< RakNetGUID, RakNetGUID > & participantList )

Get the participants added with AddParticipant()

Parameters
[out] participantList Participants added with AddParticipant();
uint16_t SLNet::ConnectionGraph2::GetPingBetweenSystems | ( | RakNetGUID | g1,
 |  | RakNetGUID | g2
 | ) |  | const

Returns the average ping between two systems in the connection graph. Returns -1 if no connection exists between those systems.

virtual void SLNet::ConnectionGraph2::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
protectedvirtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::ConnectionGraph2::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
protectedvirtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::ConnectionGraph2::OnReceive ( Packet * packet )
protectedvirtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

static int SLNet::ConnectionGraph2::RemoteSystemComp | ( | const RakNetGUID & | key,
 |  | RemoteSystem *const & | data
 | ) |  |
static
void SLNet::ConnectionGraph2::SetAutoProcessNewConnections ( bool b )

If called with false, then new connections are only added to the connection graph when you call ProcessNewConnection();.

This is useful if you want to perform validation before connecting a system to a mesh, or if you want a submesh (for example a server cloud)

Parameters
[in] b True to automatically call ProcessNewConnection() on any new connection, false to not do so. Defaults to true.
static int SLNet::ConnectionGraph2::SystemAddressAndGuidComp | ( | const SystemAddressAndGuid & | key,
 |  | const SystemAddressAndGuid & | data
 | ) |  |
static

Member Data Documentation

bool SLNet::ConnectionGraph2::autoProcessNewConnections
protected

Definition at line 123 of file ConnectionGraph2.h.

DataStructures::OrderedList<RakNetGUID, RemoteSystem*, ConnectionGraph2::RemoteSystemComp> SLNet::ConnectionGraph2::remoteSystems
protected

Definition at line 121 of file ConnectionGraph2.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/ConnectionGraph2.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::ConsoleServer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • ConsoleServer
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::ConsoleServer Class Reference

The main entry point for the server portion of your remote console application support. More...

#include <slikenet/ConsoleServer.h>

Public Member Functions

ConsoleServer ()
~ConsoleServer ()
void | SetTransportProvider (TransportInterface *transportInterface, unsigned short port)
Call this with a derivation of TransportInterface so that the console server can send and receive commands.
void | AddCommandParser (CommandParserInterface *commandParserInterface)
Add an implementation of CommandParserInterface to the list of command parsers.
void | RemoveCommandParser (CommandParserInterface *commandParserInterface)
Remove an implementation of CommandParserInterface previously added with AddCommandParser().
void | Update (void)
Call update to read packet sent from your TransportInterface. You should do this fairly frequently.
void | SetPrompt (const char *_prompt)
Sets a prompt to show when waiting for user input.

Protected Member Functions

void | ListParsers (SystemAddress systemAddress)
void | ShowPrompt (SystemAddress systemAddress)

Protected Attributes

TransportInterface * transport
DataStructures::List
< CommandParserInterface * > 		commandParserList
char * | password [256]
char * | prompt

Detailed Description

The main entry point for the server portion of your remote console application support.

ConsoleServer takes one TransportInterface and one or more CommandParserInterface (s) The TransportInterface will be used to send data between the server and the client. The connecting client must support the protocol used by your derivation of TransportInterface . TelnetTransport and RakNetTransport are two such derivations . When a command is sent by a remote console, it will be processed by your implementations of CommandParserInterface

Definition at line 44 of file ConsoleServer.h.

Constructor & Destructor Documentation

SLNet::ConsoleServer::ConsoleServer ( )
SLNet::ConsoleServer::~ConsoleServer ( )

Member Function Documentation

void SLNet::ConsoleServer::AddCommandParser ( CommandParserInterface * commandParserInterface )

Add an implementation of CommandParserInterface to the list of command parsers.

Parameters
[in] commandParserInterface The command parser referred to
void SLNet::ConsoleServer::ListParsers ( SystemAddress systemAddress )
protected
void SLNet::ConsoleServer::RemoveCommandParser ( CommandParserInterface * commandParserInterface )

Remove an implementation of CommandParserInterface previously added with AddCommandParser().

Parameters
[in] commandParserInterface The command parser referred to
void SLNet::ConsoleServer::SetPrompt ( const char * _prompt )

Sets a prompt to show when waiting for user input.

Pass an empty string to clear the prompt Defaults to no prompt

Parameters
[in] _prompt Null-terminated string of the prompt to use. If you want a newline, be sure to use /r/n
void SLNet::ConsoleServer::SetTransportProvider | ( | TransportInterface * | transportInterface,
 |  | unsigned short | port
 | ) |  |

Call this with a derivation of TransportInterface so that the console server can send and receive commands.

Parameters
[in] | transportInterface | Your interface to use.
[in] | port | The port to host on. Telnet uses port 23 by default. RakNet can use whatever you want.
void SLNet::ConsoleServer::ShowPrompt ( SystemAddress systemAddress )
protected
void SLNet::ConsoleServer::Update ( void )

Call update to read packet sent from your TransportInterface. You should do this fairly frequently.

Member Data Documentation

DataStructures::List<CommandParserInterface *> SLNet::ConsoleServer::commandParserList
protected

Definition at line 80 of file ConsoleServer.h.

char* SLNet::ConsoleServer::password[256]
protected

Definition at line 81 of file ConsoleServer.h.

char* SLNet::ConsoleServer::prompt
protected

Definition at line 82 of file ConsoleServer.h.

TransportInterface* SLNet::ConsoleServer::transport
protected

Definition at line 79 of file ConsoleServer.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/ConsoleServer.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::DataCompressor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • DataCompressor
Static Public Member Functions | List of all members
SLNet::DataCompressor Class Reference

Does compression on a block of data. Not very good compression, but it's small and fast so is something you can compute at runtime. More...

#include <slikenet/DataCompressor.h>

Static Public Member Functions

static void | Compress (unsigned char *userData, unsigned sizeInBytes, SLNet::BitStream *output)
static unsigned | DecompressAndAllocate (SLNet::BitStream *input, unsigned char **output)

Detailed Description

Does compression on a block of data. Not very good compression, but it's small and fast so is something you can compute at runtime.

Definition at line 33 of file DataCompressor.h.

Member Function Documentation

void DataCompressor::Compress | ( | unsigned char * | userData,
 |  | unsigned | sizeInBytes,
 |  | SLNet::BitStream * | output
 | ) |  |
static

Definition at line 25 of file DataCompressor.cpp.

References SLNet::HuffmanEncodingTree::EncodeArray(), SLNet::HuffmanEncodingTree::GenerateFromFrequencyTable(), and RakAssert.

unsigned DataCompressor::DecompressAndAllocate | ( | SLNet::BitStream * | input,
 |  | unsigned char ** | output
 | ) |  |
static

Definition at line 53 of file DataCompressor.cpp.

References _FILE_AND_LINE_, SLNet::BitStream::AlignReadToByteBoundary(), SLNet::HuffmanEncodingTree::DecodeArray(), SLNet::HuffmanEncodingTree::GenerateFromFrequencyTable(), RakAssert, rakMalloc_Ex, SLNet::BitStream::Read(), and SLNet::BitStream::ReadCompressed().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/DataCompressor.h
  • Source/src/DataCompressor.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::DirectoryDeltaTransfer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • DirectoryDeltaTransfer
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::DirectoryDeltaTransfer Class Reference

#include <slikenet/DirectoryDeltaTransfer.h>

+ Inheritance diagram for SLNet::DirectoryDeltaTransfer:

Public Member Functions

DirectoryDeltaTransfer ()
virtual | ~DirectoryDeltaTransfer ()
void | SetFileListTransferPlugin (FileListTransfer *flt)
This plugin has a dependency on the FileListTransfer plugin, which it uses to actually send the files.
void | SetApplicationDirectory (const char *pathToApplication)
Set the local root directory to base all file uploads and downloads off of.
void | SetUploadSendParameters (PacketPriority _priority, char _orderingChannel)
What parameters to use for the RakPeerInterface::Send() call when uploading files.
void | AddUploadsFromSubdirectory (const char *subdir)
Add all files in the specified subdirectory recursively.
unsigned short | DownloadFromSubdirectory (const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, SystemAddress host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel, FileListProgress *cb)
Downloads files from the matching parameter subdir in AddUploadsFromSubdirectory.
unsigned short | DownloadFromSubdirectory (FileList &localFiles, const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, SystemAddress host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel, FileListProgress *cb)
Downloads files from the matching parameter subdir in AddUploadsFromSubdirectory.
void | GenerateHashes (FileList &localFiles, const char *outputSubdir, bool prependAppDirToOutputSubdir)
void | ClearUploads (void)
Clear all allowed uploads previously set with AddUploadsFromSubdirectory.
unsigned | GetNumberOfFilesForUpload (void) const
Returns how many files are available for upload.
void | SetDownloadRequestIncrementalReadInterface (IncrementalReadInterface *_incrementalReadInterface, unsigned int _chunkSize)
Normally, if a remote system requests files, those files are all loaded into memory and sent immediately.
virtual PluginReceiveResult | OnReceive (Packet *packet)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

void | OnDownloadRequest (Packet *packet)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

char | applicationDirectory [512]
FileListTransfer * fileListTransfer
FileList * availableUploads
PacketPriority priority
char | orderingChannel
IncrementalReadInterface * incrementalReadInterface
unsigned int | chunkSize
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Detailed Description

Definition at line 69 of file DirectoryDeltaTransfer.h.

Constructor & Destructor Documentation

SLNet::DirectoryDeltaTransfer::DirectoryDeltaTransfer ( )
virtual SLNet::DirectoryDeltaTransfer::~DirectoryDeltaTransfer ( )
virtual

Member Function Documentation

void SLNet::DirectoryDeltaTransfer::AddUploadsFromSubdirectory ( const char * subdir )

Add all files in the specified subdirectory recursively.

subdir is appended to pathToApplication in SetApplicationDirectory(). All files in the resultant directory and subdirectories are then hashed so that users can download them.

Precondition
You must call SetFileListTransferPlugin with a valid FileListTransfer plugin
Parameters
[in] subdir Concatenated with pathToApplication to form the final path from which to allow uploads.
void SLNet::DirectoryDeltaTransfer::ClearUploads ( void )

Clear all allowed uploads previously set with AddUploadsFromSubdirectory.

unsigned short SLNet::DirectoryDeltaTransfer::DownloadFromSubdirectory | ( | const char * | subdir,
 |  | const char * | outputSubdir,
 |  | bool | prependAppDirToOutputSubdir,
 |  | SystemAddress | host,
 |  | FileListTransferCBInterface * | onFileCallback,
 |  | PacketPriority | _priority,
 |  | char | _orderingChannel,
 |  | FileListProgress * | cb
 | ) |  |

Downloads files from the matching parameter subdir in AddUploadsFromSubdirectory.

subdir must contain all starting characters in subdir in AddUploadsFromSubdirectory Therefore, AddUploadsFromSubdirectory("Levels/Level1/"); would allow you to download using DownloadFromSubdirectory("Levels/Level1/Textures/"... but it would NOT allow you to download from DownloadFromSubdirectory("Levels/"... or DownloadFromSubdirectory("Levels/Level2/"...

Precondition
You must call SetFileListTransferPlugin with a valid FileListTransfer plugin
Note
Blocking. Will block while hashes of the local files are generated
Parameters
[in] | subdir | A directory passed to AddUploadsFromSubdirectory on the remote system. The passed dir can be more specific than the remote dir.
[in] | outputSubdir | The directory to write the output to. Usually this will match subdir but it can be different if you want.
[in] | prependAppDirToOutputSubdir | True to prepend outputSubdir with pathToApplication when determining the final output path. Usually you want this to be true.
[in] | host | The address of the remote system to send the message to.
[in] | onFileCallback | Callback to call per-file (optional). When fileIndex+1==setCount in the callback then the download is done
[in] | _priority | See RakPeerInterface::Send()
[in] | _orderingChannel | See RakPeerInterface::Send()
[in] | cb | Callback to get progress updates. Pass 0 to not use.
Returns
A set ID, identifying this download set. Returns 65535 on host unreachable.
unsigned short SLNet::DirectoryDeltaTransfer::DownloadFromSubdirectory | ( | FileList & | localFiles,
 |  | const char * | subdir,
 |  | const char * | outputSubdir,
 |  | bool | prependAppDirToOutputSubdir,
 |  | SystemAddress | host,
 |  | FileListTransferCBInterface * | onFileCallback,
 |  | PacketPriority | _priority,
 |  | char | _orderingChannel,
 |  | FileListProgress * | cb
 | ) |  |

Downloads files from the matching parameter subdir in AddUploadsFromSubdirectory.

subdir must contain all starting characters in subdir in AddUploadsFromSubdirectory Therefore, AddUploadsFromSubdirectory("Levels/Level1/"); would allow you to download using DownloadFromSubdirectory("Levels/Level1/Textures/"... but it would NOT allow you to download from DownloadFromSubdirectory("Levels/"... or DownloadFromSubdirectory("Levels/Level2/"...

Precondition
You must call SetFileListTransferPlugin with a valid FileListTransfer plugin
Note
Nonblocking, but requires call to GenerateHashes()
Parameters
[in] | localFiles | Hashes of local files already on the harddrive. Populate with GenerateHashes(), which you may wish to call from a thread
[in] | subdir | A directory passed to AddUploadsFromSubdirectory on the remote system. The passed dir can be more specific than the remote dir.
[in] | outputSubdir | The directory to write the output to. Usually this will match subdir but it can be different if you want.
[in] | prependAppDirToOutputSubdir | True to prepend outputSubdir with pathToApplication when determining the final output path. Usually you want this to be true.
[in] | host | The address of the remote system to send the message to.
[in] | onFileCallback | Callback to call per-file (optional). When fileIndex+1==setCount in the callback then the download is done
[in] | _priority | See RakPeerInterface::Send()
[in] | _orderingChannel | See RakPeerInterface::Send()
[in] | cb | Callback to get progress updates. Pass 0 to not use.
Returns
A set ID, identifying this download set. Returns 65535 on host unreachable.
void SLNet::DirectoryDeltaTransfer::GenerateHashes | ( | FileList & | localFiles,
 |  | const char * | outputSubdir,
 |  | bool | prependAppDirToOutputSubdir
 | ) |  |

Hash files already on the harddrive, in preparation for a call to DownloadFromSubdirectory(). Passed to second version of DownloadFromSubdirectory() This is slow, and it is exposed so you can call it from a thread before calling DownloadFromSubdirectory()

Parameters
[out] | localFiles | List of hashed files populated from outputSubdir and prependAppDirToOutputSubdir
[in] | outputSubdir | The directory to write the output to. Usually this will match subdir but it can be different if you want.
[in] | prependAppDirToOutputSubdir | True to prepend outputSubdir with pathToApplication when determining the final output path. Usually you want this to be true.
unsigned SLNet::DirectoryDeltaTransfer::GetNumberOfFilesForUpload ( void ) const

Returns how many files are available for upload.

Returns
How many files are available for upload
void SLNet::DirectoryDeltaTransfer::OnDownloadRequest ( Packet * packet )
protected
virtual PluginReceiveResult SLNet::DirectoryDeltaTransfer::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::DirectoryDeltaTransfer::SetApplicationDirectory ( const char * pathToApplication )

Set the local root directory to base all file uploads and downloads off of.

Parameters
[in] pathToApplication This path will be prepended to applicationSubdirectory in AddUploadsFromSubdirectory to find the actual path on disk.
void SLNet::DirectoryDeltaTransfer::SetDownloadRequestIncrementalReadInterface | ( | IncrementalReadInterface * | _incrementalReadInterface,
 |  | unsigned int | _chunkSize
 | ) |  |

Normally, if a remote system requests files, those files are all loaded into memory and sent immediately.

This function allows the files to be read in incremental chunks, saving memory

Parameters
[in] | _incrementalReadInterface | If a file in fileList has no data, filePullInterface will be used to read the file in chunks of size chunkSize
[in] | _chunkSize | How large of a block of a file to send at once
void SLNet::DirectoryDeltaTransfer::SetFileListTransferPlugin ( FileListTransfer * flt )

This plugin has a dependency on the FileListTransfer plugin, which it uses to actually send the files.

So you need an instance of that plugin registered with RakPeerInterface, and a pointer to that interface should be passed here.

Parameters
[in] flt A pointer to a registered instance of FileListTransfer
void SLNet::DirectoryDeltaTransfer::SetUploadSendParameters | ( | PacketPriority | _priority,
 |  | char | _orderingChannel
 | ) |  |

What parameters to use for the RakPeerInterface::Send() call when uploading files.

Parameters
[in] | _priority | See RakPeerInterface::Send()
[in] | _orderingChannel | See RakPeerInterface::Send()

Member Data Documentation

char SLNet::DirectoryDeltaTransfer::applicationDirectory[512]
protected

Definition at line 164 of file DirectoryDeltaTransfer.h.

FileList* SLNet::DirectoryDeltaTransfer::availableUploads
protected

Definition at line 166 of file DirectoryDeltaTransfer.h.

unsigned int SLNet::DirectoryDeltaTransfer::chunkSize
protected

Definition at line 170 of file DirectoryDeltaTransfer.h.

FileListTransfer* SLNet::DirectoryDeltaTransfer::fileListTransfer
protected

Definition at line 165 of file DirectoryDeltaTransfer.h.

IncrementalReadInterface* SLNet::DirectoryDeltaTransfer::incrementalReadInterface
protected

Definition at line 169 of file DirectoryDeltaTransfer.h.

char SLNet::DirectoryDeltaTransfer::orderingChannel
protected

Definition at line 168 of file DirectoryDeltaTransfer.h.

PacketPriority SLNet::DirectoryDeltaTransfer::priority
protected

Definition at line 167 of file DirectoryDeltaTransfer.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DirectoryDeltaTransfer.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::HuffmanEncodingTree Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HuffmanEncodingTree
Classes | Public Member Functions | List of all members
SLNet::HuffmanEncodingTree Class Reference

This generates special cases of the huffman encoding tree using 8 bit keys with the additional condition that unused combinations of 8 bits are treated as a frequency of 1. More...

#include <slikenet/DS_HuffmanEncodingTree.h>

Public Member Functions

HuffmanEncodingTree ()
~HuffmanEncodingTree ()
void | EncodeArray (unsigned char *input, size_t sizeInBytes, SLNet::BitStream *output)
Pass an array of bytes to array and a preallocated BitStream to receive the output.
unsigned | DecodeArray (SLNet::BitStream *input, BitSize_t sizeInBits, size_t maxCharsToWrite, unsigned char *output)
void | DecodeArray (unsigned char *input, BitSize_t sizeInBits, SLNet::BitStream *output)
void | GenerateFromFrequencyTable (unsigned int frequencyTable[256])
Given a frequency table of 256 elements, all with a frequency of 1 or more, generate the tree.
void | FreeMemory (void)
Free the memory used by the tree.

Detailed Description

This generates special cases of the huffman encoding tree using 8 bit keys with the additional condition that unused combinations of 8 bits are treated as a frequency of 1.

Definition at line 34 of file DS_HuffmanEncodingTree.h.

Constructor & Destructor Documentation

HuffmanEncodingTree::HuffmanEncodingTree ( )

Definition at line 23 of file DS_HuffmanEncodingTree.cpp.

HuffmanEncodingTree::~HuffmanEncodingTree ( )

Definition at line 28 of file DS_HuffmanEncodingTree.cpp.

References FreeMemory().

Member Function Documentation

unsigned HuffmanEncodingTree::DecodeArray | ( | SLNet::BitStream * | input,
 |  | BitSize_t | sizeInBits,
 |  | size_t | maxCharsToWrite,
 |  | unsigned char * | output
 | ) |  |

Definition at line 200 of file DS_HuffmanEncodingTree.cpp.

References if(), HuffmanEncodingTreeNode::left, SLNet::BitStream::ReadBit(), HuffmanEncodingTreeNode::right, and HuffmanEncodingTreeNode::value.

Referenced by SLNet::StringCompressor::DecodeString(), and SLNet::DataCompressor::DecompressAndAllocate().

void HuffmanEncodingTree::DecodeArray | ( | unsigned char * | input,
 |  | BitSize_t | sizeInBits,
 |  | SLNet::BitStream * | output
 | ) |  |

Definition at line 233 of file DS_HuffmanEncodingTree.cpp.

References BITS_TO_BYTES, if(), HuffmanEncodingTreeNode::left, SLNet::BitStream::ReadBit(), return, HuffmanEncodingTreeNode::right, HuffmanEncodingTreeNode::value, and SLNet::BitStream::WriteBits().

void HuffmanEncodingTree::EncodeArray | ( | unsigned char * | input,
 |  | size_t | sizeInBytes,
 |  | SLNet::BitStream * | output
 | ) |  |

Pass an array of bytes to array and a preallocated BitStream to receive the output.

Parameters
[in] | input | Array of bytes to encode
[in] | sizeInBytes | size of input
[out] | output | The bitstream to write to

Definition at line 169 of file DS_HuffmanEncodingTree.cpp.

References SLNet::BitStream::GetNumberOfBitsUsed(), RakAssert, and SLNet::BitStream::WriteBits().

Referenced by SLNet::DataCompressor::Compress(), and SLNet::StringCompressor::EncodeString().

void HuffmanEncodingTree::FreeMemory ( void )

Free the memory used by the tree.

Definition at line 33 of file DS_HuffmanEncodingTree.cpp.

References _FILE_AND_LINE_, HuffmanEncodingTreeNode::left, SLNet::OP_DELETE(), DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Push(), rakFree_Ex, return, HuffmanEncodingTreeNode::right, and DataStructures::Queue< queue_type >::Size().

Referenced by GenerateFromFrequencyTable(), and ~HuffmanEncodingTree().

void HuffmanEncodingTree::GenerateFromFrequencyTable ( unsigned int frequencyTable[256] )

Given a frequency table of 256 elements, all with a frequency of 1 or more, generate the tree.

Definition at line 69 of file DS_HuffmanEncodingTree.cpp.

References _FILE_AND_LINE_, DataStructures::CircularLinkedList< LinkedListType >::Beginning(), SLNet::BitStream::CopyData(), FreeMemory(), HuffmanEncodingTreeNode::left, HuffmanEncodingTreeNode::parent, DataStructures::CircularLinkedList< LinkedListType >::Pop(), SLNet::BitStream::Reset(), HuffmanEncodingTreeNode::right, DataStructures::CircularLinkedList< LinkedListType >::Size(), HuffmanEncodingTreeNode::value, HuffmanEncodingTreeNode::weight, SLNet::BitStream::Write0(), and SLNet::BitStream::Write1().

Referenced by SLNet::DataCompressor::Compress(), SLNet::DataCompressor::DecompressAndAllocate(), SLNet::StringCompressor::GenerateTreeFromStrings(), and SLNet::StringCompressor::StringCompressor().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/DS_HuffmanEncodingTree.h
  • Source/src/DS_HuffmanEncodingTree.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::HuffmanEncodingTreeFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HuffmanEncodingTreeFactory
Public Member Functions | List of all members
SLNet::HuffmanEncodingTreeFactory Class Reference

Creates instances of the class HuffmanEncodingTree. More...

#include <slikenet/DS_HuffmanEncodingTreeFactory.h>

Public Member Functions

HuffmanEncodingTreeFactory ()
Default constructor.
void | Reset (void)
Reset the frequency table.
void | AddToFrequencyTable (unsigned char *array, int size)
Pass an array of bytes to this to add those elements to the frequency table.
void | GetFrequencyTable (unsigned int _frequency[256])
Copies the frequency table to the array passed. Retrieve the frequency table.
unsigned int * | GetFrequencyTable (void)
Returns the frequency table as a pointer.
HuffmanEncodingTree * | GenerateTree (void)
Generate a HuffmanEncodingTree.

Detailed Description

Creates instances of the class HuffmanEncodingTree.

This class takes a frequency table and given that frequence table, will generate an instance of HuffmanEncodingTree

Definition at line 33 of file DS_HuffmanEncodingTreeFactory.h.

Constructor & Destructor Documentation

SLNet::HuffmanEncodingTreeFactory::HuffmanEncodingTreeFactory ( )

Default constructor.

Member Function Documentation

void SLNet::HuffmanEncodingTreeFactory::AddToFrequencyTable | ( | unsigned char * | array,
 |  | int | size
 | ) |  |

Pass an array of bytes to this to add those elements to the frequency table.

Parameters
[in] | array | the data to insert into the frequency table
[in] | size | the size of the data to insert
HuffmanEncodingTree* SLNet::HuffmanEncodingTreeFactory::GenerateTree ( void )

Generate a HuffmanEncodingTree.

You can also use GetFrequencyTable and GenerateFromFrequencyTable in the tree itself

Returns
The generated instance of HuffmanEncodingTree
void SLNet::HuffmanEncodingTreeFactory::GetFrequencyTable ( unsigned int _frequency[256] )

Copies the frequency table to the array passed. Retrieve the frequency table.

Parameters
[in] _frequency The frequency table used currently
unsigned int* SLNet::HuffmanEncodingTreeFactory::GetFrequencyTable ( void )

Returns the frequency table as a pointer.

Returns
the address of the frenquency table
void SLNet::HuffmanEncodingTreeFactory::Reset ( void )

Reset the frequency table.

You don't need to call this unless you want to reuse the class for a new tree

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DS_HuffmanEncodingTreeFactory.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::DynDNS Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • DynDNS
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
SLNet::DynDNS Class Reference

#include <slikenet/DynDNS.h>

Public Member Functions

DynDNS ()
~DynDNS ()
void | UpdateHostIPAsynch (const char *dnsHost, const char *newIPAddress, const char *usernameAndPassword)
void | Update (void)
bool | IsRunning (void) const
bool | IsCompleted (void) const
SLNet::DynDnsResultCode | GetCompletedResultCode (void)
const char * | GetCompletedDescription (void) const
bool | WasResultSuccessful (void) const
char * | GetMyPublicIP (void) const

Protected Types

enum ConnectPhase {
CP_CONNECTING_TO_CHECKIP, CP_WAITING_FOR_CHECKIP_RESPONSE, CP_CONNECTING_TO_DYNDNS, CP_WAITING_FOR_DYNDNS_RESPONSE,
CP_IDLE
}

Protected Member Functions

void | Stop (void)
void | SetCompleted (SLNet::DynDnsResultCode _result, const char *_resultDescription)

Protected Attributes

TCPInterface * tcp
SLNet::RakString getString
SystemAddress serverAddress
ConnectPhase connectPhase
SLNet::RakString host
SLNet::Time phaseTimeout
SystemAddress checkIpAddress
const char * | resultDescription
SLNet::DynDnsResultCode result
char | myIPStr [32]

Detailed Description

Definition at line 67 of file DynDNS.h.

Member Enumeration Documentation

enum SLNet::DynDNS::ConnectPhase
protected
Enumerator:
CP_CONNECTING_TO_CHECKIP
CP_WAITING_FOR_CHECKIP_RESPONSE
CP_CONNECTING_TO_DYNDNS
CP_WAITING_FOR_DYNDNS_RESPONSE
CP_IDLE

Definition at line 90 of file DynDNS.h.

Constructor & Destructor Documentation

SLNet::DynDNS::DynDNS ( )
SLNet::DynDNS::~DynDNS ( )

Member Function Documentation

const char* SLNet::DynDNS::GetCompletedDescription ( void ) const
inline

Definition at line 82 of file DynDNS.h.

SLNet::DynDnsResultCode SLNet::DynDNS::GetCompletedResultCode ( void )
inline

Definition at line 81 of file DynDNS.h.

char* SLNet::DynDNS::GetMyPublicIP ( void ) const
inline

Definition at line 84 of file DynDNS.h.

bool SLNet::DynDNS::IsCompleted ( void ) const
inline

Definition at line 80 of file DynDNS.h.

bool SLNet::DynDNS::IsRunning ( void ) const
inline

Definition at line 79 of file DynDNS.h.

void SLNet::DynDNS::SetCompleted | ( | SLNet::DynDnsResultCode | _result,
 |  | const char * | _resultDescription
 | ) |  |
inlineprotected

Definition at line 88 of file DynDNS.h.

void SLNet::DynDNS::Stop ( void )
protected
void SLNet::DynDNS::Update ( void )
void SLNet::DynDNS::UpdateHostIPAsynch | ( | const char * | dnsHost,
 |  | const char * | newIPAddress,
 |  | const char * | usernameAndPassword
 | ) |  |
bool SLNet::DynDNS::WasResultSuccessful ( void ) const
inline

Definition at line 83 of file DynDNS.h.

References SLNet::RC_DNS_ALREADY_SET, SLNet::RC_NO_CHANGE, and SLNet::RC_SUCCESS.

Member Data Documentation

SystemAddress SLNet::DynDNS::checkIpAddress
protected

Definition at line 105 of file DynDNS.h.

ConnectPhase SLNet::DynDNS::connectPhase
protected

Definition at line 102 of file DynDNS.h.

SLNet::RakString SLNet::DynDNS::getString
protected

Definition at line 100 of file DynDNS.h.

SLNet::RakString SLNet::DynDNS::host
protected

Definition at line 103 of file DynDNS.h.

char SLNet::DynDNS::myIPStr[32]
protected

Definition at line 108 of file DynDNS.h.

SLNet::Time SLNet::DynDNS::phaseTimeout
protected

Definition at line 104 of file DynDNS.h.

SLNet::DynDnsResultCode SLNet::DynDNS::result
protected

Definition at line 107 of file DynDNS.h.

const char* SLNet::DynDNS::resultDescription
protected

Definition at line 106 of file DynDNS.h.

SystemAddress SLNet::DynDNS::serverAddress
protected

Definition at line 101 of file DynDNS.h.

TCPInterface* SLNet::DynDNS::tcp
protected

Definition at line 99 of file DynDNS.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/DynDNS.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::EmailSender Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • EmailSender
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::EmailSender Class Reference

Rudimentary class to send email from code. More...

#include <slikenet/EmailSender.h>

Public Member Functions

const char * Send (const char *hostAddress, unsigned short hostPort, const char *sender, const char *recipient, const char *senderName, const char *recipientName, const char *subject, const char *body, FileList *attachedFiles, bool doPrintf, const char *password)
Sends an email.

Protected Member Functions

const char * GetResponse (TCPInterface *tcpInterface, const SystemAddress &emailServer, bool doPrintf)

Protected Attributes

RakNetRandom rakNetRandom

Detailed Description

Rudimentary class to send email from code.

Definition at line 39 of file EmailSender.h.

Member Function Documentation

const char* SLNet::EmailSender::GetResponse | ( | TCPInterface * | tcpInterface,
 |  | const SystemAddress & | emailServer,
 |  | bool | doPrintf
 | ) |  |
protected
const char* SLNet::EmailSender::Send | ( | const char * | hostAddress,
 |  | unsigned short | hostPort,
 |  | const char * | sender,
 |  | const char * | recipient,
 |  | const char * | senderName,
 |  | const char * | recipientName,
 |  | const char * | subject,
 |  | const char * | body,
 |  | FileList * | attachedFiles,
 |  | bool | doPrintf,
 |  | const char * | password
 | ) |  |

Sends an email.

Parameters
[in] | hostAddress | The address of the email server.
[in] | hostPort | The port of the email server (usually 25)
[in] | sender | The email address you are sending from.
[in] | recipient | The email address you are sending to.
[in] | senderName | The email address you claim to be sending from
[in] | recipientName | The email address you claim to be sending to
[in] | subject | Email subject
[in] | body | Email body
[in] | attachedFiles | List of files to attach to the email. (Can be 0 to send none).
[in] | doPrintf | true to output SMTP info to console(for debugging?)
[in] | password | Used if the server uses AUTHENTICATE PLAIN over TLS (such as gmail)
Returns
0 on success, otherwise a string indicating the error message

Member Data Documentation

RakNetRandom SLNet::EmailSender::rakNetRandom
protected

Definition at line 62 of file EmailSender.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/EmailSender.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::FileListProgress Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FileListProgress
Public Member Functions | List of all members
SLNet::FileListProgress Class Reference

Callback interface set with FileList::SetCallback() in case you want progress notifications when FileList::AddFilesFromDirectory() is called. More...

#include <slikenet/FileList.h>

+ Inheritance diagram for SLNet::FileListProgress:

Public Member Functions

FileListProgress ()
virtual | ~FileListProgress ()
virtual void | OnAddFilesFromDirectoryStarted (FileList *fileList, char *dir)
First callback called when FileList::AddFilesFromDirectory() starts.
virtual void | OnDirectory (FileList *fileList, char *dir, unsigned int directoriesRemaining)
Called for each directory, when that directory begins processing.
virtual void | OnFile (FileList *fileList, char *dir, char *fileName, unsigned int fileSize)
Called for each file, when that file begins processing.
virtual void | OnFilePush (const char *fileName, unsigned int fileLengthBytes, unsigned int offset, unsigned int bytesBeingSent, bool done, SystemAddress targetSystem, unsigned short setId)
This function is called when we are sending a file to a remote system.
virtual void | OnFilePushesComplete (SystemAddress systemAddress, unsigned short setId)
This function is called when all files have been read and are being transferred to a remote system.
virtual void | OnSendAborted (SystemAddress systemAddress)
This function is called when a send to a system was aborted (probably due to disconnection)

Detailed Description

Callback interface set with FileList::SetCallback() in case you want progress notifications when FileList::AddFilesFromDirectory() is called.

Definition at line 71 of file FileList.h.

Constructor & Destructor Documentation

SLNet::FileListProgress::FileListProgress ( )
inline

Definition at line 77 of file FileList.h.

virtual SLNet::FileListProgress::~FileListProgress ( )
inlinevirtual

Definition at line 78 of file FileList.h.

Member Function Documentation

virtual void SLNet::FileListProgress::OnAddFilesFromDirectoryStarted | ( | FileList * | fileList,
 |  | char * | dir
 | ) |  |
inlinevirtual

First callback called when FileList::AddFilesFromDirectory() starts.

Reimplemented in SLNet::FLP_Printf.

Definition at line 81 of file FileList.h.

virtual void SLNet::FileListProgress::OnDirectory | ( | FileList * | fileList,
 |  | char * | dir,
 |  | unsigned int | directoriesRemaining
 | ) |  |
inlinevirtual

Called for each directory, when that directory begins processing.

Reimplemented in SLNet::FLP_Printf.

Definition at line 87 of file FileList.h.

virtual void SLNet::FileListProgress::OnFile | ( | FileList * | fileList,
 |  | char * | dir,
 |  | char * | fileName,
 |  | unsigned int | fileSize
 | ) |  |
inlinevirtual

Called for each file, when that file begins processing.

Definition at line 94 of file FileList.h.

virtual void SLNet::FileListProgress::OnFilePush | ( | const char * | fileName,
 |  | unsigned int | fileLengthBytes,
 |  | unsigned int | offset,
 |  | unsigned int | bytesBeingSent,
 |  | bool | done,
 |  | SystemAddress | targetSystem,
 |  | unsigned short | setId
 | ) |  |
inlinevirtual

This function is called when we are sending a file to a remote system.

Parameters
[in] | fileName | The name of the file being sent
[in] | fileLengthBytes | How long the file is
[in] | offset | The offset in bytes into the file that we are sending
[in] | bytesBeingSent | How many bytes we are sending this push
[in] | done | If this file is now done with this push
[in] | targetSystem | Who we are sending to

Definition at line 108 of file FileList.h.

virtual void SLNet::FileListProgress::OnFilePushesComplete | ( | SystemAddress | systemAddress,
 |  | unsigned short | setId
 | ) |  |
inlinevirtual

This function is called when all files have been read and are being transferred to a remote system.

Reimplemented in SLNet::FLP_Printf.

Definition at line 120 of file FileList.h.

virtual void SLNet::FileListProgress::OnSendAborted ( SystemAddress systemAddress )
inlinevirtual

This function is called when a send to a system was aborted (probably due to disconnection)

Reimplemented in SLNet::FLP_Printf.

Definition at line 127 of file FileList.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/FileList.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::FLP_Printf Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FLP_Printf
Public Member Functions | List of all members
SLNet::FLP_Printf Class Reference

Implementation of FileListProgress to use RAKNET_DEBUG_PRINTF. More...

#include <slikenet/FileList.h>

+ Inheritance diagram for SLNet::FLP_Printf:

Public Member Functions

FLP_Printf ()
virtual | ~FLP_Printf ()
virtual void | OnAddFilesFromDirectoryStarted (FileList *fileList, char *dir)
First callback called when FileList::AddFilesFromDirectory() starts.
virtual void | OnDirectory (FileList *fileList, char *dir, unsigned int directoriesRemaining)
Called for each directory, when that directory begins processing.
virtual void | OnFilePushesComplete (SystemAddress systemAddress, unsigned short setID)
This function is called when all files have been transferred to a particular remote system.
virtual void | OnSendAborted (SystemAddress systemAddress)
This function is called when a send to a system was aborted (probably due to disconnection)
- Public Member Functions inherited from SLNet::FileListProgress
FileListProgress ()
virtual | ~FileListProgress ()
virtual void | OnFile (FileList *fileList, char *dir, char *fileName, unsigned int fileSize)
Called for each file, when that file begins processing.
virtual void | OnFilePush (const char *fileName, unsigned int fileLengthBytes, unsigned int offset, unsigned int bytesBeingSent, bool done, SystemAddress targetSystem, unsigned short setId)
This function is called when we are sending a file to a remote system.

Detailed Description

Implementation of FileListProgress to use RAKNET_DEBUG_PRINTF.

Definition at line 134 of file FileList.h.

Constructor & Destructor Documentation

SLNet::FLP_Printf::FLP_Printf ( )
inline

Definition at line 140 of file FileList.h.

virtual SLNet::FLP_Printf::~FLP_Printf ( )
inlinevirtual

Definition at line 141 of file FileList.h.

Member Function Documentation

virtual void SLNet::FLP_Printf::OnAddFilesFromDirectoryStarted | ( | FileList * | fileList,
 |  | char * | dir
 | ) |  |
virtual

First callback called when FileList::AddFilesFromDirectory() starts.

Reimplemented from SLNet::FileListProgress.

virtual void SLNet::FLP_Printf::OnDirectory | ( | FileList * | fileList,
 |  | char * | dir,
 |  | unsigned int | directoriesRemaining
 | ) |  |
virtual

Called for each directory, when that directory begins processing.

Reimplemented from SLNet::FileListProgress.

virtual void SLNet::FLP_Printf::OnFilePushesComplete | ( | SystemAddress | systemAddress,
 |  | unsigned short | setID
 | ) |  |
virtual

This function is called when all files have been transferred to a particular remote system.

Reimplemented from SLNet::FileListProgress.

virtual void SLNet::FLP_Printf::OnSendAborted ( SystemAddress systemAddress )
virtual

This function is called when a send to a system was aborted (probably due to disconnection)

Reimplemented from SLNet::FileListProgress.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/FileList.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::FileList Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FileList
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
SLNet::FileList Class Reference

#include <slikenet/FileList.h>

Public Member Functions

FileList ()
~FileList ()
void | AddFilesFromDirectory (const char *applicationDirectory, const char *subDirectory, bool writeHash, bool writeData, bool recursive, FileListNodeContext context)
Add all the files at a given directory.
void | Clear (void)
Deallocate all memory.
void | Serialize (SLNet::BitStream *outBitStream)
Write all encoded data into a bitstream.
bool | Deserialize (SLNet::BitStream *inBitStream)
Read all encoded data from a bitstream. Clear() is called before deserializing.
void | ListMissingOrChangedFiles (const char *applicationDirectory, FileList *missingOrChangedFiles, bool alwaysWriteHash, bool neverWriteHash)
Given the existing set of files, search applicationDirectory for the same files.
void | GetDeltaToCurrent (FileList *input, FileList *output, const char *dirSubset, const char *remoteSubdir)
Return the files that need to be written to make input match this current FileList.
void | PopulateDataFromDisk (const char *applicationDirectory, bool writeFileData, bool writeFileHash, bool removeUnknownFiles)
Assuming FileList contains a list of filenames presumably without data, read the data for these filenames.
void | FlagFilesAsReferences (void)
void | WriteDataToDisk (const char *applicationDirectory)
Write all files to disk, prefixing the paths with applicationDirectory.
void | AddFile (const char *filename, const char *fullPathToFile, const char *data, const unsigned dataLength, const unsigned fileLength, FileListNodeContext context, bool isAReference=false, bool takeDataPointer=false)
Add a file, given data already in memory.
void | AddFile (const char *filepath, const char *filename, FileListNodeContext context)
Add a file, reading it from disk.
void | DeleteFiles (const char *applicationDirectory)
Delete all files stored in the file list.
void | AddCallback (FileListProgress *cb)
Adds a callback to get progress reports about what the file list instances do.
void | RemoveCallback (FileListProgress *cb)
Removes a callback.
void | ClearCallbacks (void)
Removes all callbacks.
void | GetCallbacks (DataStructures::List< FileListProgress * > &callbacks)

Static Public Member Functions

static bool | FixEndingSlash (char *str)
static bool | FixEndingSlash (char *str, size_t strLength)

Public Attributes

DataStructures::List
< FileListNode > 		fileList

Protected Attributes

DataStructures::List
< FileListProgress * > 		fileListProgressCallbacks

Detailed Description

Definition at line 156 of file FileList.h.

Constructor & Destructor Documentation

SLNet::FileList::FileList ( )
SLNet::FileList::~FileList ( )

Member Function Documentation

void SLNet::FileList::AddCallback ( FileListProgress * cb )

Adds a callback to get progress reports about what the file list instances do.

Parameters
[in] cb A pointer to an externally defined instance of FileListProgress. This pointer is held internally, so should remain valid as long as this class is valid.
void SLNet::FileList::AddFile | ( | const char * | filename,
 |  | const char * | fullPathToFile,
 |  | const char * | data,
 |  | const unsigned | dataLength,
 |  | const unsigned | fileLength,
 |  | FileListNodeContext | context,
 |  | bool | isAReference = false,
 |  | bool | takeDataPointer = false
 | ) |  |

Add a file, given data already in memory.

Parameters
[in] | filename | Name of a file, optionally prefixed with a partial or complete path. Use \ as the path delineator.
[in] | fullPathToFile | Full path to the file on disk
[in] | data | Contents to write
[in] | dataLength | length of the data, which may be greater than fileLength should you prefix extra data, such as the hash
[in] | fileLength | Length of the file
[in] | context | User defined byte to store with each file. Use for whatever you want.
[in] | isAReference | Means that this is just a reference to a file elsewhere - does not actually have any data
[in] | takeDataPointer | If true, do not allocate dataLength. Just take the pointer passed to the data parameter
void SLNet::FileList::AddFile | ( | const char * | filepath,
 |  | const char * | filename,
 |  | FileListNodeContext | context
 | ) |  |

Add a file, reading it from disk.

Parameters
[in] | filepath | Complete path to the file, including the filename itself
[in] | filename | filename to store internally, anything you want, but usually either the complete path or a subset of the complete path.
[in] | context | User defined byte to store with each file. Use for whatever you want.
void SLNet::FileList::AddFilesFromDirectory | ( | const char * | applicationDirectory,
 |  | const char * | subDirectory,
 |  | bool | writeHash,
 |  | bool | writeData,
 |  | bool | recursive,
 |  | FileListNodeContext | context
 | ) |  |

Add all the files at a given directory.

Parameters
[in] | applicationDirectory | The first part of the path. This is not stored as part of the filename. Use \ as the path delineator.
[in] | subDirectory | The rest of the path to the file. This is stored as a prefix to the filename
[in] | writeHash | The first 4 bytes is a hash of the file, with the remainder the actual file data (should writeData be true)
[in] | writeData | Write the contents of each file
[in] | recursive | Whether or not to visit subdirectories
[in] | context | User defined byte to store with each file. Use for whatever you want.
void SLNet::FileList::Clear ( void )

Deallocate all memory.

void SLNet::FileList::ClearCallbacks ( void )

Removes all callbacks.

void SLNet::FileList::DeleteFiles ( const char * applicationDirectory )

Delete all files stored in the file list.

Parameters
[in] applicationDirectory Prefixed to the path to each filename. Use \ as the path delineator.
bool SLNet::FileList::Deserialize ( SLNet::BitStream * inBitStream )

Read all encoded data from a bitstream. Clear() is called before deserializing.

static bool SLNet::FileList::FixEndingSlash ( char * str )
static
static bool SLNet::FileList::FixEndingSlash | ( | char * | str,
 |  | size_t | strLength
 | ) |  |
static
void SLNet::FileList::FlagFilesAsReferences ( void )

By default, GetDeltaToCurrent tags files as non-references, meaning they are assumed to be populated later This tags all files as references, required for IncrementalReadInterface to process them incrementally

void SLNet::FileList::GetCallbacks ( DataStructures::List< FileListProgress * > & callbacks )

Returns all callbacks added with AddCallback()

Parameters
[out] callbacks The list is set to the list of callbacks
void SLNet::FileList::GetDeltaToCurrent | ( | FileList * | input,
 |  | FileList * | output,
 |  | const char * | dirSubset,
 |  | const char * | remoteSubdir
 | ) |  |

Return the files that need to be written to make input match this current FileList.

Specify dirSubset to only consider files that start with this path specify remoteSubdir to assume that all filenames in input start with this path, so strip it off when comparing filenames.

Parameters
[in] | input | Full list of files
[out] | output | Files that we need to match input
[in] | dirSubset | If the filename does not start with this path, just skip this file.
[in] | remoteSubdir | Remove this from the filenames of input when comparing to existing filenames.
void SLNet::FileList::ListMissingOrChangedFiles | ( | const char * | applicationDirectory,
 |  | FileList * | missingOrChangedFiles,
 |  | bool | alwaysWriteHash,
 |  | bool | neverWriteHash
 | ) |  |

Given the existing set of files, search applicationDirectory for the same files.

For each file that is missing or different, add that file to missingOrChangedFiles. Note: the file contents are not written, and only the hash if written if alwaysWriteHash is true alwaysWriteHash and neverWriteHash are optimizations to avoid reading the file contents to generate the hash if not necessary because the file is missing or has different lengths anyway.

Parameters
[in] | applicationDirectory | The first part of the path. This is not stored as part of the filename. Use \ as the path delineator.
[out] | missingOrChangedFiles | Output list written to
[in] | alwaysWriteHash | If true, and neverWriteHash is false, will hash the file content of the file on disk, and write that as the file data with a length of SHA1_LENGTH bytes. If false, if the file length is different, will only write the filename.
[in] | neverWriteHash | If true, will never write the hash, even if available. If false, will write the hash if the file lengths are the same and it was forced to do a comparison.
void SLNet::FileList::PopulateDataFromDisk | ( | const char * | applicationDirectory,
 |  | bool | writeFileData,
 |  | bool | writeFileHash,
 |  | bool | removeUnknownFiles
 | ) |  |

Assuming FileList contains a list of filenames presumably without data, read the data for these filenames.

Parameters
[in] | applicationDirectory | Prepend this path to each filename. Trailing slash will be added if necessary. Use \ as the path delineator.
[in] | writeFileData | True to read and store the file data. The first SHA1_LENGTH bytes will contain the hash if writeFileHash is true
[in] | writeFileHash | True to read and store the hash of the file data. The first SHA1_LENGTH bytes will contain the hash if writeFileHash is true
[in] | removeUnknownFiles | If a file does not exist on disk but is in the file list, remove it from the file list?
void SLNet::FileList::RemoveCallback ( FileListProgress * cb )

Removes a callback.

Parameters
[in] cb A pointer to an externally defined instance of FileListProgress that was previously added with AddCallback()
void SLNet::FileList::Serialize ( SLNet::BitStream * outBitStream )

Write all encoded data into a bitstream.

void SLNet::FileList::WriteDataToDisk ( const char * applicationDirectory )

Write all files to disk, prefixing the paths with applicationDirectory.

Parameters
[in] applicationDirectory path prefix

Member Data Documentation

DataStructures::List<FileListNode> SLNet::FileList::fileList

Definition at line 252 of file FileList.h.

DataStructures::List<FileListProgress*> SLNet::FileList::fileListProgressCallbacks
protected

Definition at line 257 of file FileList.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/FileList.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::FileListTransferCBInterface Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FileListTransferCBInterface
Classes | Public Member Functions | List of all members
SLNet::FileListTransferCBInterface Class Referenceabstract

Used by FileListTransfer plugin as a callback for when we get a file. More...

#include <slikenet/FileListTransferCBInterface.h>

Classes

struct | DownloadCompleteStruct
struct | FileProgressStruct
struct | OnFileStruct

Public Member Functions

FileListTransferCBInterface ()
virtual | ~FileListTransferCBInterface ()
virtual bool | OnFile (OnFileStruct *onFileStruct)=0
Got a file.
virtual void | OnFileProgress (FileProgressStruct *fps)=0
Got part of a big file internally in RakNet.
virtual bool | Update (void)
Called while the handler is active by FileListTransfer.
virtual bool | OnDownloadComplete (DownloadCompleteStruct *dcs)
Called when the download is completed.
virtual void | OnDereference (void)
This function is called when this instance is about to be dereferenced by the FileListTransfer plugin.

Detailed Description

Used by FileListTransfer plugin as a callback for when we get a file.

You get the last file when fileIndex==numberOfFilesInThisSet

See Also
FileListTransfer

Definition at line 32 of file FileListTransferCBInterface.h.

Class Documentation

struct SLNet::FileListTransferCBInterface::DownloadCompleteStruct

Definition at line 102 of file FileListTransferCBInterface.h.

Class Members
unsigned | byteLengthOfThisSet | The total length of the transmitted files for this set, after being uncompressed.
unsigned | numberOfFilesInThisSet | The number of files that are in this set.
RakNetGUID | senderGuid | Who sent this file. Not valid when using TCP, only RakPeer (UDP)
SystemAddress | senderSystemAddress | Who sent this file.
unsigned short | setID | Files are transmitted in sets, where more than one set of files can be transmitted at the same time. This is the identifier for the set, which is returned by FileListTransfer::SetupReceive
struct SLNet::FileListTransferCBInterface::FileProgressStruct

Definition at line 78 of file FileListTransferCBInterface.h.

Class Members
bool allocateIrIDataChunkAutomatically
Parameters
[in] allocateIrIDataChunkAutomatically If true, then RakNet will hold iriDataChunk for you and return it in OnFile. Defaults to true
unsigned int dataChunkLength
Parameters
[out] dataChunkLength How many bytes long firstDataChunk and iriDataChunk are
char * firstDataChunk
Parameters
[out] firstDataChunk The first partLength of the final file. If you store identifying information about the file in the first partLength bytes, you can read them while the download is taking place. If this hasn't arrived yet, firstDataChunk will be 0
char * iriDataChunk
Parameters
[out] iriDataChunk If the remote system is sending this file using IncrementalReadInterface, then this is the chunk we just downloaded. It will not exist in memory after this callback. You should either store this to disk, or in memory. If it is 0, then the file is smaller than one chunk, and will be held in memory automatically
unsigned int iriWriteOffset
Parameters
[out] iriWriteOffset Offset in bytes from the start of the file for the data pointed to by iriDataChunk
OnFileStruct * onFileStruct
Parameters
[out] onFileStruct General information about this file, such as the filename and the first partLength bytes. You do NOT need to save this data yourself. The complete file will arrive normally.
unsigned int partCount
Parameters
[out] partCount The zero based index into partTotal. The percentage complete done of this file is 100 * (partCount+1)/partTotal
unsigned int partTotal
Parameters
[out] partTotal The total number of parts this file was split into. Each part will be roughly the MTU size, minus the UDP header and RakNet headers
RakNetGUID senderGuid
Parameters
[out] Who sent this file. Not valid when using TCP, only RakPeer (UDP)
SystemAddress senderSystemAddress
Parameters
[out] Who sent this file
struct SLNet::FileListTransferCBInterface::OnFileStruct

Definition at line 36 of file FileListTransferCBInterface.h.

Class Members
BitSize_t | byteLengthOfThisFile | The amount of data to be downloaded for this file.
unsigned | byteLengthOfThisSet | The total length of the transmitted files for this set, after being uncompressed.
BitSize_t | bytesDownloadedForThisFile | How many bytes of this file has been downloaded.
unsigned | bytesDownloadedForThisSet | The total length, in bytes, downloaded for this set.
FileListNodeContext | context | User data passed to one of the functions in the FileList class. However, on error, this is instead changed to one of the enumerations in the PatchContext structure.
char * | fileData | The data pointed to by the file.
unsigned | fileIndex | The index into the set of files, from 0 to numberOfFilesInThisSet.
char | fileName | The name of the file.
unsigned | numberOfFilesInThisSet | The number of files that are in this set.
RakNetGUID | senderGuid | Who sent this file. Not valid when using TCP, only RakPeer (UDP)
SystemAddress | senderSystemAddress | Who sent this file.
unsigned short | setID | Files are transmitted in sets, where more than one set of files can be transmitted at the same time. This is the identifier for the set, which is returned by FileListTransfer::SetupReceive

Constructor & Destructor Documentation

SLNet::FileListTransferCBInterface::FileListTransferCBInterface ( )
inline

Definition at line 121 of file FileListTransferCBInterface.h.

virtual SLNet::FileListTransferCBInterface::~FileListTransferCBInterface ( )
inlinevirtual

Definition at line 122 of file FileListTransferCBInterface.h.

Member Function Documentation

virtual void SLNet::FileListTransferCBInterface::OnDereference ( void )
inlinevirtual

This function is called when this instance is about to be dereferenced by the FileListTransfer plugin.

Update will no longer be called. It will will be deleted automatically if true was passed to FileListTransfer::SetupReceive::deleteHandler Otherwise it is up to you to delete it yourself.

Definition at line 153 of file FileListTransferCBInterface.h.

virtual bool SLNet::FileListTransferCBInterface::OnDownloadComplete ( DownloadCompleteStruct * dcs )
inlinevirtual

Called when the download is completed.

If you are finished with this class, return false. At that point OnDereference will be called and the class will no longer be maintained by the FileListTransfer plugin. Otherwise return true, and Update will continue to be called.

Definition at line 147 of file FileListTransferCBInterface.h.

virtual bool SLNet::FileListTransferCBInterface::OnFile ( OnFileStruct * onFileStruct )
pure virtual

Got a file.

This structure is only valid for the duration of this function call.

Returns
Return true to have RakNet delete the memory allocated to hold this file for this function call.
virtual void SLNet::FileListTransferCBInterface::OnFileProgress ( FileProgressStruct * fps )
pure virtual

Got part of a big file internally in RakNet.

This is called in one of two circumstances: Either the transport layer is returning ID_PROGRESS_NOTIFICATION, or you got a block via IncrementalReadInterface If the transport layer is returning ID_PROGRESS_NOTIFICATION (see RakPeer::SetSplitMessageProgressInterval()) then FileProgressStruct::iriDataChunk will be 0. If this is a block via IncrementalReadInterface, then iriDataChunk will point to the block just downloaded. If not using IncrementalReadInterface, then you only care about partCount and partTotal to tell how far the download has progressed. YOu can use firstDataChunk to read the first part of the file if desired. The file is usable when you get the OnFile callback. If using IncrementalReadInterface and you let RakNet buffer the files in memory (default), then it is the same as above. The file is usable when you get the OnFile callback. If using IncrementalReadInterface and you do not let RakNet buffer the files in memory, then set allocateIrIDataChunkAutomatically to false. Write the file to disk whenever you get OnFileProgress and iriDataChunk is not 0, and ignore OnFile.

virtual bool SLNet::FileListTransferCBInterface::Update ( void )
inlinevirtual

Called while the handler is active by FileListTransfer.

Return false when you are done with the class. At that point OnDereference will be called and the class will no longer be maintained by the FileListTransfer plugin.

Definition at line 141 of file FileListTransferCBInterface.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/FileListTransferCBInterface.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::HTTPConnection Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HTTPConnection
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
SLNet::HTTPConnection Class Reference

Use HTTPConnection to communicate with a web server. More...

#include <slikenet/HTTPConnection.h>

Classes

struct | BadResponse
Encapsulates a raw HTTP response and response code. More...
struct | OutgoingCommand

Public Types

enum ResponseCodes { NoBody =1001, OK =200, Deleted =1002 }

Public Member Functions

HTTPConnection ()
Returns a HTTP object associated with this tcp connection.
virtual | ~HTTPConnection ()
void | Init (TCPInterface *_tcp, const char *host, unsigned short port=80)
void | Post (const char *path, const char *data, const char *_contentType="application/x-www-form-urlencoded")
void | Get (const char *path)
bool | HasRead (void) const
Is there a Read result ready?
SLNet::RakString | Read (void)
void | Update (void)
Call periodically to do time-based updates.
SystemAddress | GetServerAddress (void) const
Returns the address of the server we are connected to.
void | ProcessTCPPacket (Packet *packet)
HTTPConnection & | operator= (const HTTPConnection &rhs)
bool | HasBadResponse (int *code, SLNet::RakString *data)
Queued events of failed exchanges with the HTTP server.
bool | IsBusy (void) const
Returns false if the connection is not doing anything else.
int | GetState (void) const

Public Attributes

DataStructures::Queue
< OutgoingCommand > 		outgoingCommand
OutgoingCommand currentProcessingCommand

Detailed Description

Use HTTPConnection to communicate with a web server.

Start an instance of TCPInterface via the Start() command. Instantiate a new instance of HTTPConnection, and associate TCPInterface with the class in the constructor. Use Post() to send commands to the web server, and ProcessDataPacket() to update the connection with packets returned from TCPInterface that have the system address of the web server This class will handle connecting and reconnecting as necessary.

Note that only one Post() can be handled at a time.

Deprecated:
, use HTTPConnection2

Definition at line 47 of file HTTPConnection.h.

Class Documentation

struct SLNet::HTTPConnection::OutgoingCommand

Definition at line 126 of file HTTPConnection.h.

Class Members
RakString | contentType
RakString | data
bool | isPost
RakString | remotePath

Member Enumeration Documentation

enum SLNet::HTTPConnection::ResponseCodes

Results of HTTP requests. Standard response codes are < 999 ( define HTTP codes and our internal codes as needed )

Enumerator:
NoBody
OK
Deleted

Definition at line 95 of file HTTPConnection.h.

Constructor & Destructor Documentation

SLNet::HTTPConnection::HTTPConnection ( )

Returns a HTTP object associated with this tcp connection.

virtual SLNet::HTTPConnection::~HTTPConnection ( )
virtual

Member Function Documentation

void SLNet::HTTPConnection::Get ( const char * path )

Get a file from a webserver

Parameters
path the path on the remote server you want to GET from. For example "index.html"
SystemAddress SLNet::HTTPConnection::GetServerAddress ( void ) const

Returns the address of the server we are connected to.

int SLNet::HTTPConnection::GetState ( void ) const
bool SLNet::HTTPConnection::HasBadResponse | ( | int * | code,
 |  | SLNet::RakString * | data
 | ) |  |

Queued events of failed exchanges with the HTTP server.

bool SLNet::HTTPConnection::HasRead ( void ) const

Is there a Read result ready?

void SLNet::HTTPConnection::Init | ( | TCPInterface * | _tcp,
 |  | const char * | host,
 |  | unsigned short | port = 80
 | ) |  |
Precondition
tcp should already be started
bool SLNet::HTTPConnection::IsBusy ( void ) const

Returns false if the connection is not doing anything else.

HTTPConnection& SLNet::HTTPConnection::operator= ( const HTTPConnection & rhs )
inline

Definition at line 97 of file HTTPConnection.h.

void SLNet::HTTPConnection::Post | ( | const char * | path,
 |  | const char * | data,
 |  | const char * | _contentType = "application/x-www-form-urlencoded"
 | ) |  |

Submit data to the HTTP server HTTP only allows one request at a time per connection

Precondition
IsBusy()==false
Parameters
path | the path on the remote server you want to POST to. For example "index.html"
data | A NULL terminated string to submit to the server
contentType | "Content-Type:" passed to post.
void SLNet::HTTPConnection::ProcessTCPPacket ( Packet * packet )

Process an HTTP data packet returned from TCPInterface Returns true when we have gotten all the data from the HTTP server. If this returns true then it's safe to Post() another request Deallocate the packet as usual via TCPInterface

Parameters
packet NULL or a packet associated with our host and port
SLNet::RakString SLNet::HTTPConnection::Read ( void )

Get one result from the server

Precondition
HasResult must return true
void SLNet::HTTPConnection::Update ( void )

Call periodically to do time-based updates.

Member Data Documentation

OutgoingCommand SLNet::HTTPConnection::currentProcessingCommand

Definition at line 135 of file HTTPConnection.h.

DataStructures::Queue<OutgoingCommand> SLNet::HTTPConnection::outgoingCommand

Definition at line 134 of file HTTPConnection.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/HTTPConnection.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::HTTPConnection::BadResponse Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HTTPConnection
  • BadResponse
Public Member Functions | Public Attributes | List of all members
SLNet::HTTPConnection::BadResponse Struct Reference

Encapsulates a raw HTTP response and response code. More...

#include <slikenet/HTTPConnection.h>

Public Member Functions

BadResponse ()
BadResponse (const unsigned char *_data, int _code)
BadResponse (const char *_data, int _code)
operator int () const

Public Attributes

SLNet::RakString data
int code

Detailed Description

Encapsulates a raw HTTP response and response code.

Definition at line 100 of file HTTPConnection.h.

Constructor & Destructor Documentation

SLNet::HTTPConnection::BadResponse::BadResponse ( )
inline

Definition at line 103 of file HTTPConnection.h.

SLNet::HTTPConnection::BadResponse::BadResponse | ( | const unsigned char * | _data,
 |  | int | _code
 | ) |  |
inline

Definition at line 105 of file HTTPConnection.h.

SLNet::HTTPConnection::BadResponse::BadResponse | ( | const char * | _data,
 |  | int | _code
 | ) |  |
inline

Definition at line 108 of file HTTPConnection.h.

Member Function Documentation

SLNet::HTTPConnection::BadResponse::operator int ( ) const
inline

Definition at line 111 of file HTTPConnection.h.

Member Data Documentation

int SLNet::HTTPConnection::BadResponse::code

Definition at line 114 of file HTTPConnection.h.

SLNet::RakString SLNet::HTTPConnection::BadResponse::data

Definition at line 113 of file HTTPConnection.h.

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/HTTPConnection.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::HTTPConnection2 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HTTPConnection2
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::HTTPConnection2 Class Reference

Use HTTPConnection2 to communicate with a web server. More...

#include <slikenet/HTTPConnection2.h>

+ Inheritance diagram for SLNet::HTTPConnection2:

Classes

struct Request

Public Member Functions

HTTPConnection2 ()
virtual | ~HTTPConnection2 ()
bool | TransmitRequest (const char *stringToTransmit, const char *host, unsigned short port=80, bool useSSL=false, int ipVersion=4, SystemAddress useAddress=UNASSIGNED_SYSTEM_ADDRESS, void *userData=0)
Connect to, then transmit a request to a TCP based server.
bool | GetResponse (RakString &stringTransmitted, RakString &hostTransmitted, RakString &responseReceived, SystemAddress &hostReceived, ptrdiff_t &contentOffset, void **userData)
Check for and return a response from a prior call to TransmitRequest() As TCP is stream based, you may get a webserver reply over several calls to TCPInterface::Receive() HTTPConnection2 will store Packet::data and return the response to you either when the connection to the webserver is lost, or enough data has been received() This will only potentially return true after a call to ProcessTCPPacket() or OnLostConnection()
bool | GetResponse (RakString &stringTransmitted, RakString &hostTransmitted, RakString &responseReceived, SystemAddress &hostReceived, ptrdiff_t &contentOffset)
bool | IsBusy (void) const
Return if any requests are pending.
bool | HasResponse (void) const
Return if any requests are waiting to be read by the user.
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
- Public Member Functions inherited from SLNet::PluginInterface2
PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
Called when the interface is attached.
virtual void | OnDetach (void)
Called when the interface is detached.
virtual void | Update (void)
Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
Called when RakPeer is shutdown.
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

Protected Member Functions

bool | IsConnected (SystemAddress sa)
void | SendRequest (Request *request)
void | RemovePendingRequest (SystemAddress sa)
void | SendNextPendingRequest (void)
void | SendPendingRequestToConnectedSystem (SystemAddress sa)
- Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

Protected Attributes

DataStructures::Queue< Request * > pendingRequests
DataStructures::List< Request * > sentRequests
DataStructures::List< Request * > completedRequests
SimpleMutex pendingRequestsMutex
SimpleMutex sentRequestsMutex
SimpleMutex completedRequestsMutex
- Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * rakPeerInterface
TCPInterface * tcpInterface

Detailed Description

Use HTTPConnection2 to communicate with a web server.

Start an instance of TCPInterface via the Start() command. This class will handle connecting to transmit a request

Definition at line 44 of file HTTPConnection2.h.

Class Documentation

struct SLNet::HTTPConnection2::Request

Definition at line 85 of file HTTPConnection2.h.

Class Members
size_t | bytesReadForThisChunk
bool | chunked
int | contentLength
ptrdiff_t | contentOffset
RakString | host
SystemAddress | hostCompletedAddress
SystemAddress | hostEstimatedAddress
int | ipVersion
unsigned short | port
RakString | stringReceived
RakString | stringToTransmit
size_t | thisChunkSize
void * | userData
bool | useSSL

Constructor & Destructor Documentation

SLNet::HTTPConnection2::HTTPConnection2 ( )
virtual SLNet::HTTPConnection2::~HTTPConnection2 ( )
virtual

Member Function Documentation

bool SLNet::HTTPConnection2::GetResponse | ( | RakString & | stringTransmitted,
 |  | RakString & | hostTransmitted,
 |  | RakString & | responseReceived,
 |  | SystemAddress & | hostReceived,
 |  | ptrdiff_t & | contentOffset,
 |  | void ** | userData
 | ) |  |

Check for and return a response from a prior call to TransmitRequest() As TCP is stream based, you may get a webserver reply over several calls to TCPInterface::Receive() HTTPConnection2 will store Packet::data and return the response to you either when the connection to the webserver is lost, or enough data has been received() This will only potentially return true after a call to ProcessTCPPacket() or OnLostConnection()

Parameters
[out] | stringTransmitted | The original string transmitted
[out] | hostTransmitted | The parameter of the same name passed to TransmitRequest()
[out] | responseReceived | The response, if any
[out] | hostReceived | The SystemAddress from ProcessTCPPacket() or OnLostConnection()
[out] contentOffset The offset from the start of responseReceived to the data body. Equivalent to searching for

in responseReceived.
[out] | userData | Whatever you passed to TransmitRequest
Returns
true if there was a response. false if not.
bool SLNet::HTTPConnection2::GetResponse | ( | RakString & | stringTransmitted,
 |  | RakString & | hostTransmitted,
 |  | RakString & | responseReceived,
 |  | SystemAddress & | hostReceived,
 |  | ptrdiff_t & | contentOffset
 | ) |  |
bool SLNet::HTTPConnection2::HasResponse ( void ) const

Return if any requests are waiting to be read by the user.

bool SLNet::HTTPConnection2::IsBusy ( void ) const

Return if any requests are pending.

bool SLNet::HTTPConnection2::IsConnected ( SystemAddress sa )
protected
virtual void SLNet::HTTPConnection2::OnClosedConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | PI2_LostConnectionReason | lostConnectionReason
 | ) |  |
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in] | systemAddress | The system whose connection was closed
[in] | rakNetGuid | The guid of the specified system
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::HTTPConnection2::OnFailedConnectionAttempt | ( | Packet * | packet,
 |  | PI2_FailedConnectionAttemptReason | failedConnectionAttemptReason
 | ) |  |
virtual

Called when a connection attempt fails

Parameters
[in] | packet | Packet to be returned to the user
[in] | failedConnectionReason | Why the connection failed

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::HTTPConnection2::OnNewConnection | ( | const SystemAddress & | systemAddress,
 |  | RakNetGUID | rakNetGUID,
 |  | bool | isIncoming
 | ) |  |
virtual

Called when we got a new connection

Parameters
[in] | systemAddress | Address of the new connection
[in] | rakNetGuid | The guid of the specified system
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::HTTPConnection2::OnReceive ( Packet * packet )
virtual

OnReceive is called for every packet.

Parameters
[in] packet the packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

void SLNet::HTTPConnection2::RemovePendingRequest ( SystemAddress sa )
protected
void SLNet::HTTPConnection2::SendNextPendingRequest ( void )
protected
void SLNet::HTTPConnection2::SendPendingRequestToConnectedSystem ( SystemAddress sa )
protected
void SLNet::HTTPConnection2::SendRequest ( Request * request )
protected
bool SLNet::HTTPConnection2::TransmitRequest | ( | const char * | stringToTransmit,
 |  | const char * | host,
 |  | unsigned short | port = 80,
 |  | bool | useSSL = false,
 |  | int | ipVersion = 4,
 |  | SystemAddress | useAddress = UNASSIGNED_SYSTEM_ADDRESS,
 |  | void * | userData = 0
 | ) |  |

Connect to, then transmit a request to a TCP based server.

Parameters
[in] | tcp | An instance of TCPInterface that previously had TCPInterface::Start() called
[in] | stringToTransmit | What string to transmit. See RakString::FormatForPOST(), RakString::FormatForGET(), RakString::FormatForDELETE()
[in] | host | The IP address to connect to
[in] | port | The port to connect to
[in] | useSSL | If to use SSL to connect. OPEN_SSL_CLIENT_SUPPORT must be defined to 1 in defines.h or defineoverrides.h
[in] | ipVersion | 4 for IPV4, 6 for IPV6
[in] | useAddress | Assume we are connected to this address and send to it, rather than do a lookup
[in] | userData
Returns
false if host is not a valid IP address or domain name

Member Data Documentation

DataStructures::List<Request*> SLNet::HTTPConnection2::completedRequests
protected

Definition at line 119 of file HTTPConnection2.h.

SimpleMutex SLNet::HTTPConnection2::completedRequestsMutex
protected

Definition at line 121 of file HTTPConnection2.h.

DataStructures::Queue<Request*> SLNet::HTTPConnection2::pendingRequests
protected

Definition at line 117 of file HTTPConnection2.h.

SimpleMutex SLNet::HTTPConnection2::pendingRequestsMutex
protected

Definition at line 121 of file HTTPConnection2.h.

DataStructures::List<Request*> SLNet::HTTPConnection2::sentRequests
protected

Definition at line 118 of file HTTPConnection2.h.

SimpleMutex SLNet::HTTPConnection2::sentRequestsMutex
protected

Definition at line 121 of file HTTPConnection2.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/HTTPConnection2.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::IncrementalReadInterface Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • IncrementalReadInterface
Public Member Functions | List of all members
SLNet::IncrementalReadInterface Class Reference

#include <slikenet/IncrementalReadInterface.h>

+ Inheritance diagram for SLNet::IncrementalReadInterface:

Public Member Functions

IncrementalReadInterface ()
virtual | ~IncrementalReadInterface ()
virtual unsigned int | GetFilePart (const char *filename, unsigned int startReadBytes, unsigned int numBytesToRead, void *preallocatedDestination, FileListNodeContext context)

Detailed Description

Definition at line 25 of file IncrementalReadInterface.h.

Constructor & Destructor Documentation

SLNet::IncrementalReadInterface::IncrementalReadInterface ( )
inline

Definition at line 28 of file IncrementalReadInterface.h.

virtual SLNet::IncrementalReadInterface::~IncrementalReadInterface ( )
inlinevirtual

Definition at line 29 of file IncrementalReadInterface.h.

Member Function Documentation

unsigned int IncrementalReadInterface::GetFilePart | ( | const char * | filename,
 |  | unsigned int | startReadBytes,
 |  | unsigned int | numBytesToRead,
 |  | void * | preallocatedDestination,
 |  | FileListNodeContext | context
 | ) |  |
virtual

Read part of a file into destination Return the number of bytes written. Return 0 when file is done.

Parameters
[in] | filename | Filename to read
[in] | startReadBytes | What offset from the start of the file to read from
[in] | numBytesToRead | How many bytes to read. This is also how many bytes have been allocated to preallocatedDestination
[out] | preallocatedDestination | Write your data here
Returns
The number of bytes read, or 0 if none

Definition at line 23 of file IncrementalReadInterface.cpp.

The documentation for this class was generated from the following files:
  • Source/include/slikenet/IncrementalReadInterface.h
  • Source/src/IncrementalReadInterface.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::InternalPacketFixedSizeTransmissionHeader Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • InternalPacketFixedSizeTransmissionHeader
Public Attributes | List of all members
SLNet::InternalPacketFixedSizeTransmissionHeader Struct Reference

#include <slikenet/InternalPacket.h>

+ Inheritance diagram for SLNet::InternalPacketFixedSizeTransmissionHeader:

Public Attributes

MessageNumberType reliableMessageNumber
A unique numerical identifier given to this user message. Used to identify reliable messages on the network.
OrderingIndexType orderingIndex
The ID used as identification for ordering messages. Also included in sequenced messages.
OrderingIndexType sequencingIndex
unsigned char orderingChannel
What ordering channel this packet is on, if the reliability type uses ordering channels.
SplitPacketIdType splitPacketId
The ID of the split packet, if we have split packets. This is the maximum number of split messages we can send simultaneously per connection.
SplitPacketIndexType splitPacketIndex
If this is a split packet, the index into the array of subsplit packets.
SplitPacketIndexType splitPacketCount
The size of the array of subsplit packets.
BitSize_t dataBitLength
How many bits long the data is.
PacketReliability reliability
What type of reliability algorithm to use with this packet.

Detailed Description

Definition at line 50 of file InternalPacket.h.

Member Data Documentation

BitSize_t SLNet::InternalPacketFixedSizeTransmissionHeader::dataBitLength

How many bits long the data is.

Definition at line 65 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::ReliabilityLayer::Receive(), SLNet::ReliabilityLayer::Send(), and SLNet::ReliabilityLayer::Update().

unsigned char SLNet::InternalPacketFixedSizeTransmissionHeader::orderingChannel

What ordering channel this packet is on, if the reliability type uses ordering channels.

Definition at line 59 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), and SLNet::ReliabilityLayer::Send().

OrderingIndexType SLNet::InternalPacketFixedSizeTransmissionHeader::orderingIndex

The ID used as identification for ordering messages. Also included in sequenced messages.

Definition at line 55 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), and SLNet::ReliabilityLayer::Send().

PacketReliability SLNet::InternalPacketFixedSizeTransmissionHeader::reliability

What type of reliability algorithm to use with this packet.

Definition at line 69 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::ReliabilityLayer::Send(), and SLNet::ReliabilityLayer::Update().

MessageNumberType SLNet::InternalPacketFixedSizeTransmissionHeader::reliableMessageNumber

A unique numerical identifier given to this user message. Used to identify reliable messages on the network.

Definition at line 53 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), and SLNet::ReliabilityLayer::Update().

OrderingIndexType SLNet::InternalPacketFixedSizeTransmissionHeader::sequencingIndex

Definition at line 57 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), and SLNet::ReliabilityLayer::Send().

SplitPacketIndexType SLNet::InternalPacketFixedSizeTransmissionHeader::splitPacketCount

The size of the array of subsplit packets.

Definition at line 65 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer().

SplitPacketIdType SLNet::InternalPacketFixedSizeTransmissionHeader::splitPacketId

The ID of the split packet, if we have split packets. This is the maximum number of split messages we can send simultaneously per connection.

Definition at line 61 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer().

SplitPacketIndexType SLNet::InternalPacketFixedSizeTransmissionHeader::splitPacketIndex

If this is a split packet, the index into the array of subsplit packets.

Definition at line 63 of file InternalPacket.h.

Referenced by SplitPacketIndexComp().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/InternalPacket.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::InternalPacket Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • InternalPacket
Public Types | Public Attributes | List of all members
SLNet::InternalPacket Struct Reference

#include <slikenet/InternalPacket.h>

+ Inheritance diagram for SLNet::InternalPacket:

Public Types

enum AllocationScheme { NORMAL, REF_COUNTED, STACK }
How to alloc and delete the data member. More...

Public Attributes

MessageNumberType messageInternalOrder
Identifies the order in which this number was sent. Used locally.
bool | messageNumberAssigned
SLNet::TimeUS creationTime
Was this packet number used this update to track windowing drops or increases? Each packet number is only used once per update.
SLNet::TimeUS nextActionTime
The resendNext time to take action on this packet.
SLNet::TimeUS retransmissionTime
BitSize_t headerLength
unsigned char * | data
Buffer is a pointer to the actual data, assuming this packet has data at all.
enum
SLNet::InternalPacket::AllocationScheme 		allocationScheme
InternalPacketRefCountedData * refCountedData
unsigned char | timesSent
How many attempts we made at sending this message.
PacketPriority priority
The priority level of this packet.
uint32_t sendReceiptSerial
If the reliability type requires a receipt, then return this number with it.
InternalPacket * resendPrev
InternalPacket * resendNext
InternalPacket * unreliablePrev
InternalPacket * unreliableNext
unsigned char | stackData [128]
- Public Attributes inherited from SLNet::InternalPacketFixedSizeTransmissionHeader
MessageNumberType reliableMessageNumber
A unique numerical identifier given to this user message. Used to identify reliable messages on the network.
OrderingIndexType orderingIndex
The ID used as identification for ordering messages. Also included in sequenced messages.
OrderingIndexType sequencingIndex
unsigned char | orderingChannel
What ordering channel this packet is on, if the reliability type uses ordering channels.
SplitPacketIdType splitPacketId
The ID of the split packet, if we have split packets. This is the maximum number of split messages we can send simultaneously per connection.
SplitPacketIndexType splitPacketIndex
If this is a split packet, the index into the array of subsplit packets.
SplitPacketIndexType splitPacketCount
The size of the array of subsplit packets.
BitSize_t dataBitLength
How many bits long the data is.
PacketReliability reliability
What type of reliability algorithm to use with this packet.

Detailed Description

Holds a user message, and related information Don't use a constructor or destructor, due to the memory pool I am using

Definition at line 84 of file InternalPacket.h.

Member Enumeration Documentation

enum SLNet::InternalPacket::AllocationScheme

How to alloc and delete the data member.

Enumerator:
NORMAL

Data is allocated using rakMalloc. Just free it.

REF_COUNTED

data points to a larger block of data, where the larger block is reference counted. internalPacketRefCountedData is used in this case

STACK

If allocation scheme is STACK, data points to stackData and should not be deallocated This is only used when sending. Received packets are deallocated in RakPeer

Definition at line 105 of file InternalPacket.h.

Member Data Documentation

enum SLNet::InternalPacket::AllocationScheme SLNet::InternalPacket::allocationScheme
SLNet::TimeUS SLNet::InternalPacket::creationTime

Was this packet number used this update to track windowing drops or increases? Each packet number is only used once per update.

When this packet was created

Definition at line 95 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Send(), and SLNet::ReliabilityLayer::Update().

unsigned char* SLNet::InternalPacket::data

Buffer is a pointer to the actual data, assuming this packet has data at all.

Definition at line 103 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::ReliabilityLayer::Receive(), SLNet::ReliabilityLayer::Send(), and SLNet::ReliabilityLayer::Update().

BitSize_t SLNet::InternalPacket::headerLength

Definition at line 101 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Update().

MessageNumberType SLNet::InternalPacket::messageInternalOrder

Identifies the order in which this number was sent. Used locally.

Definition at line 87 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Send().

bool SLNet::InternalPacket::messageNumberAssigned

Has this message number been assigned yet? We don't assign until the message is actually sent. This fixes a bug where pre-determining message numbers and then sending a message on a different channel creates a huge gap. This causes performance problems and causes those messages to timeout.

Definition at line 91 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Send(), and SLNet::ReliabilityLayer::Update().

SLNet::TimeUS SLNet::InternalPacket::nextActionTime

The resendNext time to take action on this packet.

Definition at line 97 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), and SLNet::ReliabilityLayer::Update().

PacketPriority SLNet::InternalPacket::priority

The priority level of this packet.

Definition at line 121 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Send(), and SLNet::ReliabilityLayer::Update().

InternalPacketRefCountedData* SLNet::InternalPacket::refCountedData

Definition at line 117 of file InternalPacket.h.

InternalPacket * SLNet::InternalPacket::resendNext

Definition at line 127 of file InternalPacket.h.

InternalPacket* SLNet::InternalPacket::resendPrev

Definition at line 127 of file InternalPacket.h.

SLNet::TimeUS SLNet::InternalPacket::retransmissionTime

Definition at line 99 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Update().

uint32_t SLNet::InternalPacket::sendReceiptSerial

If the reliability type requires a receipt, then return this number with it.

Definition at line 123 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Send(), and SLNet::ReliabilityLayer::Update().

unsigned char SLNet::InternalPacket::stackData[128]

Definition at line 129 of file InternalPacket.h.

unsigned char SLNet::InternalPacket::timesSent

How many attempts we made at sending this message.

Definition at line 119 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Update().

InternalPacket * SLNet::InternalPacket::unreliableNext

Definition at line 127 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Update().

InternalPacket * SLNet::InternalPacket::unreliablePrev

Definition at line 127 of file InternalPacket.h.

Referenced by SLNet::ReliabilityLayer::Update().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/InternalPacket.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::LocklessUint32_t Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • LocklessUint32_t
Public Member Functions | Protected Attributes | List of all members
SLNet::LocklessUint32_t Class Reference

#include <slikenet/LocklessTypes.h>

Public Member Functions

LocklessUint32_t ()
LocklessUint32_t (uint32_t initial)
uint32_t | Increment (void)
uint32_t | Decrement (void)
uint32_t | GetValue (void) const

Protected Attributes

volatile uint32_t value

Detailed Description

Definition at line 30 of file LocklessTypes.h.

Constructor & Destructor Documentation

LocklessUint32_t::LocklessUint32_t ( )

Definition at line 20 of file LocklessTypes.cpp.

References value.

LocklessUint32_t::LocklessUint32_t ( uint32_t initial )
explicit

Definition at line 24 of file LocklessTypes.cpp.

References value.

Member Function Documentation

uint32_t LocklessUint32_t::Decrement ( void )

Definition at line 43 of file LocklessTypes.cpp.

References value.

Referenced by SLNet::RNS2_Berkley::RecvFromLoopInt().

uint32_t SLNet::LocklessUint32_t::GetValue ( void ) const
inline

Definition at line 39 of file LocklessTypes.h.

Referenced by SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread().

uint32_t LocklessUint32_t::Increment ( void )

Definition at line 28 of file LocklessTypes.cpp.

References value.

Referenced by SLNet::RNS2_Berkley::RecvFromLoopInt().

Member Data Documentation

volatile uint32_t SLNet::LocklessUint32_t::value
protected

Definition at line 49 of file LocklessTypes.h.

Referenced by Decrement(), Increment(), and LocklessUint32_t().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/LocklessTypes.h
  • Source/src/LocklessTypes.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::LogCommandParser Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • LogCommandParser
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::LogCommandParser Class Reference

Adds the ability to send logging output to a remote console. More...

#include <slikenet/LogCommandParser.h>

+ Inheritance diagram for SLNet::LogCommandParser:

Classes

struct SystemAddressAndChannel
One of these structures is created per player. More...

Public Member Functions

LogCommandParser ()
~LogCommandParser ()
bool | OnCommand (const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)
const char * | GetName (void) const
void | SendHelp (TransportInterface *transport, const SystemAddress &systemAddress)
void | AddChannel (const char *channelName)
All logs must be associated with a channel. This is a filter so that remote clients only get logs for a system they care about.
void | WriteLog (const char *channelName, const char *format,...)
void | OnNewIncomingConnection (const SystemAddress &systemAddress, TransportInterface *transport)
void | OnConnectionLost (const SystemAddress &systemAddress, TransportInterface *transport)
void | OnTransportChange (TransportInterface *transport)
- Public Member Functions inherited from SLNet::CommandParserInterface
CommandParserInterface ()
virtual | ~CommandParserInterface ()
virtual bool | GetRegisteredCommand (const char *command, RegisteredCommand *rc)
virtual void | SendCommandList (TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | RegisterCommand (unsigned char parameterCount, const char *command, const char *commandHelp)
virtual void | ReturnResult (bool res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
Just writes a string to the remote system based on the result ( res ) of your operation.
virtual void | ReturnResult (char *res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | ReturnResult (SystemAddress res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | ReturnResult (int res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | ReturnResult (const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
Just writes a string to the remote system when you are calling a function that has no return value.

Protected Member Functions

void | PrintChannels (const SystemAddress &systemAddress, TransportInterface *transport) const
unsigned | Unsubscribe (const SystemAddress &systemAddress, const char *channelName)
unsigned | Subscribe (const SystemAddress &systemAddress, const char *channelName)
unsigned | GetChannelIndexFromName (const char *channelName)

Protected Attributes

DataStructures::List
< SystemAddressAndChannel > 		remoteUsers
The list of remote users. Added to when users subscribe, removed when they disconnect or unsubscribe.
const char * channelNames [32]
Names of the channels at each bit, or 0 for an unused channel.
TransportInterface * trans
This is so I can save the current transport provider, solely so I can use it without having the user pass it to Log.
- Protected Attributes inherited from SLNet::CommandParserInterface
DataStructures::OrderedList
< const char
*, RegisteredCommand,
RegisteredCommandComp > 		commandList

Additional Inherited Members

- Static Public Member Functions inherited from SLNet::CommandParserInterface
static void | ParseConsoleString (char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength)
- Static Public Attributes inherited from SLNet::CommandParserInterface
static const unsigned char | VARIABLE_NUMBER_OF_PARAMETERS =255

Detailed Description

Adds the ability to send logging output to a remote console.

Definition at line 35 of file LogCommandParser.h.

Class Documentation

struct SLNet::LogCommandParser::SystemAddressAndChannel

One of these structures is created per player.

Definition at line 109 of file LogCommandParser.h.

Class Members
unsigned | channels | Bitwise representations of the channels subscribed to. If bit 0 is set, then we subscribe to channelNames[0] and so on.
SystemAddress | systemAddress | The ID of the player.

Constructor & Destructor Documentation

SLNet::LogCommandParser::LogCommandParser ( )
SLNet::LogCommandParser::~LogCommandParser ( )

Member Function Documentation

void SLNet::LogCommandParser::AddChannel ( const char * channelName )

All logs must be associated with a channel. This is a filter so that remote clients only get logs for a system they care about.

Parameters
[in] channelName A persistent string naming the channel. Don't deallocate this string.
unsigned SLNet::LogCommandParser::GetChannelIndexFromName ( const char * channelName )
protected

Given the name of a channel, return the index into channelNames where it is located

Parameters
[in] channelName The name of the channel
const char* SLNet::LogCommandParser::GetName ( void ) const
virtual

You are responsible for overriding this function and returning a static string, which will identifier your parser. This should return a static string

Returns
The name that you return.

Implements SLNet::CommandParserInterface.

bool SLNet::LogCommandParser::OnCommand | ( | const char * | command,
 |  | unsigned | numParameters,
 |  | char ** | parameterList,
 |  | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress,
 |  | const char * | originalString
 | ) |  |
virtual

Given command with parameters parameterList , do whatever processing you wish.

Parameters
[in] | command | The command to process
[in] | numParameters | How many parameters were passed along with the command
[in] | parameterList | The list of parameters. parameterList[0] is the first parameter and so on.
[in] | transport | The transport interface we can use to write to
[in] | systemAddress | The player that sent this command.
[in] | originalString | The string that was actually sent over the network, in case you want to do your own parsing

Implements SLNet::CommandParserInterface.

void SLNet::LogCommandParser::OnConnectionLost | ( | const SystemAddress & | systemAddress,
 |  | TransportInterface * | transport
 | ) |  |
virtual

A callback for when systemAddress has disconnected, either gracefully or forcefully

Parameters
[in] | systemAddress | The player that has disconnected.
[in] | transport | The transport interface that sent us this information.

Reimplemented from SLNet::CommandParserInterface.

void SLNet::LogCommandParser::OnNewIncomingConnection | ( | const SystemAddress & | systemAddress,
 |  | TransportInterface * | transport
 | ) |  |
virtual

A callback for when systemAddress has connected to us.

Parameters
[in] | systemAddress | The player that has connected.
[in] | transport | The transport interface that sent us this information. Can be used to send messages to this or other players.

Reimplemented from SLNet::CommandParserInterface.

void SLNet::LogCommandParser::OnTransportChange ( TransportInterface * transport )
virtual

This is called every time transport interface is registered. If you want to save a copy of the TransportInterface pointer This is the place to do it

Parameters
[in] transport The new TransportInterface

Reimplemented from SLNet::CommandParserInterface.

void SLNet::LogCommandParser::PrintChannels | ( | const SystemAddress & | systemAddress,
 |  | TransportInterface * | transport
 | ) |  | const
 protected

Sends the currently active channels to the user

Parameters
[in] | systemAddress | The player to send to
[in] | transport | The transport interface to use to send the channels
void SLNet::LogCommandParser::SendHelp | ( | TransportInterface * | transport,
 |  | const SystemAddress & | systemAddress
 | ) |  |
virtual

A callback for when you are expected to send a brief description of your parser to systemAddress

Parameters
[in] | transport | The transport interface we can use to write to
[in] | systemAddress | The player that requested help.

Implements SLNet::CommandParserInterface.

unsigned SLNet::LogCommandParser::Subscribe | ( | const SystemAddress & | systemAddress,
 |  | const char * | channelName
 | ) |  |
protected

Subscribe a user to a channel (or to all channels)

Parameters
[in] | systemAddress | The player to subscribe to
[in] | channelName | If 0, then subscribe from all channels. Otherwise subscribe to the named channel
unsigned SLNet::LogCommandParser::Unsubscribe | ( | const SystemAddress & | systemAddress,
 |  | const char * | channelName
 | ) |  |
protected

Unsubscribe a user from a channel (or from all channels)

Parameters
[in] | systemAddress | The player to unsubscribe to
[in] | channelName | If 0, then unsubscribe from all channels. Otherwise unsubscribe from the named channel
void SLNet::LogCommandParser::WriteLog | ( | const char * | channelName,
 |  | const char * | format,
 |  |  | ...
 | ) |  |

Write a log to a channel. Logs are not buffered, so only remote consoles connected and subscribing at the time you write will get the output.

Parameters
[in] format Same as RAKNET_DEBUG_PRINTF()
[in] ... Same as RAKNET_DEBUG_PRINTF()

Member Data Documentation

const char* SLNet::LogCommandParser::channelNames[32]
protected

Names of the channels at each bit, or 0 for an unused channel.

Definition at line 122 of file LogCommandParser.h.

DataStructures::List<SystemAddressAndChannel> SLNet::LogCommandParser::remoteUsers
protected

The list of remote users. Added to when users subscribe, removed when they disconnect or unsubscribe.

Definition at line 119 of file LogCommandParser.h.

TransportInterface* SLNet::LogCommandParser::trans
protected

This is so I can save the current transport provider, solely so I can use it without having the user pass it to Log.

Definition at line 125 of file LogCommandParser.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/LogCommandParser.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::FilterSet Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FilterSet
Public Attributes | List of all members
SLNet::FilterSet Struct Reference

#include <slikenet/MessageFilter.h>

Public Attributes

bool | banOnFilterTimeExceed
bool | kickOnDisallowedMessage
bool | banOnDisallowedMessage
SLNet::TimeMS disallowedMessageBanTimeMS
SLNet::TimeMS timeExceedBanTimeMS
SLNet::TimeMS maxMemberTimeMS
void(* | invalidMessageCallback )(RakPeerInterface *peer, AddressOrGUID systemAddress, int filterSetID, void *userData, unsigned char messageID)
void * | disallowedCallbackUserData
void(* | timeoutCallback )(RakPeerInterface *peer, AddressOrGUID systemAddress, int filterSetID, void *userData)
void * | timeoutUserData
int | filterSetID
bool | allowedIDs [MESSAGE_FILTER_MAX_MESSAGE_ID]
DataStructures::OrderedList
< SLNet::RakString,
SLNet::RakString > 		allowedRPC4

Detailed Description

Definition at line 44 of file MessageFilter.h.

Member Data Documentation

bool SLNet::FilterSet::allowedIDs[MESSAGE_FILTER_MAX_MESSAGE_ID]

Definition at line 57 of file MessageFilter.h.

DataStructures::OrderedList<SLNet::RakString, SLNet::RakString> SLNet::FilterSet::allowedRPC4

Definition at line 58 of file MessageFilter.h.

bool SLNet::FilterSet::banOnDisallowedMessage

Definition at line 48 of file MessageFilter.h.

bool SLNet::FilterSet::banOnFilterTimeExceed

Definition at line 46 of file MessageFilter.h.

void* SLNet::FilterSet::disallowedCallbackUserData

Definition at line 53 of file MessageFilter.h.

SLNet::TimeMS SLNet::FilterSet::disallowedMessageBanTimeMS

Definition at line 49 of file MessageFilter.h.

int SLNet::FilterSet::filterSetID

Definition at line 56 of file MessageFilter.h.

void(* SLNet::FilterSet::invalidMessageCallback)(RakPeerInterface *peer, AddressOrGUID systemAddress, int filterSetID, void *userData, unsigned char messageID)

Definition at line 52 of file MessageFilter.h.

bool SLNet::FilterSet::kickOnDisallowedMessage

Definition at line 47 of file MessageFilter.h.

SLNet::TimeMS SLNet::FilterSet::maxMemberTimeMS

Definition at line 51 of file MessageFilter.h.

SLNet::TimeMS SLNet::FilterSet::timeExceedBanTimeMS

Definition at line 50 of file MessageFilter.h.

void(* SLNet::FilterSet::timeoutCallback)(RakPeerInterface *peer, AddressOrGUID systemAddress, int filterSetID, void *userData)

Definition at line 54 of file MessageFilter.h.

void* SLNet::FilterSet::timeoutUserData

Definition at line 55 of file MessageFilter.h.

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/MessageFilter.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::NetworkIDManager Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • NetworkIDManager
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::NetworkIDManager Class Reference

#include <slikenet/NetworkIDManager.h>

Public Member Functions

NetworkIDManager ()
virtual | ~NetworkIDManager (void)
template<class returnType >
returnType | GET_OBJECT_FROM_ID (NetworkID x)
void | Clear (void)
NetworkIDObject * | GET_BASE_OBJECT_FROM_ID (NetworkID x)

Protected Member Functions

void | TrackNetworkIDObject (NetworkIDObject *networkIdObject)
void | StopTrackingNetworkIDObject (NetworkIDObject *networkIdObject)
unsigned int | NetworkIDToHashIndex (NetworkID networkId)
NetworkID | GetNewNetworkID (void)

Protected Attributes

NetworkIDObject * networkIdHash [NETWORK_ID_MANAGER_HASH_LENGTH]
uint64_t startingOffset

Detailed Description

This class is simply used to generate a unique number for a group of instances of NetworkIDObject An instance of this class is required to use the ObjectID to pointer lookup system You should have one instance of this class per game instance. Call SetIsNetworkIDAuthority before using any functions of this class, or of NetworkIDObject

Definition at line 40 of file NetworkIDManager.h.

Constructor & Destructor Documentation

NetworkIDManager::NetworkIDManager ( )

Definition at line 32 of file NetworkIDManager.cpp.

References SLNet::RakPeerInterface::Get64BitUniqueRandomNumber().

NetworkIDManager::~NetworkIDManager ( void )
virtual

Definition at line 37 of file NetworkIDManager.cpp.

Member Function Documentation

void NetworkIDManager::Clear ( void )

Definition at line 41 of file NetworkIDManager.cpp.

References networkIdHash.

NetworkIDObject * NetworkIDManager::GET_BASE_OBJECT_FROM_ID ( NetworkID x )

Definition at line 45 of file NetworkIDManager.cpp.

References SLNet::NetworkIDObject::GetNetworkID(), networkIdHash, NetworkIDToHashIndex(), and SLNet::NetworkIDObject::nextInstanceForNetworkIDManager.

Referenced by GetNewNetworkID().

template<class returnType >
returnType SLNet::NetworkIDManager::GET_OBJECT_FROM_ID ( NetworkID x )
inline

Returns the parent object, or this instance if you don't use a parent. Supports NetworkIDObject anywhere in the inheritance hierarchy

Precondition
You must first call SetNetworkIDManager before using this function

Definition at line 53 of file NetworkIDManager.h.

References SLNet::NetworkIDObject::GetParent().

NetworkID NetworkIDManager::GetNewNetworkID ( void )
protected

Definition at line 57 of file NetworkIDManager.cpp.

References GET_BASE_OBJECT_FROM_ID(), startingOffset, and SLNet::UNASSIGNED_NETWORK_ID.

Referenced by SLNet::NetworkIDObject::SetNetworkIDManager().

unsigned int NetworkIDManager::NetworkIDToHashIndex ( NetworkID networkId )
protected

Definition at line 68 of file NetworkIDManager.cpp.

References NETWORK_ID_MANAGER_HASH_LENGTH.

Referenced by GET_BASE_OBJECT_FROM_ID(), StopTrackingNetworkIDObject(), and TrackNetworkIDObject().

void NetworkIDManager::StopTrackingNetworkIDObject ( NetworkIDObject * networkIdObject )
protected

Definition at line 106 of file NetworkIDManager.cpp.

References SLNet::NetworkIDObject::GetNetworkID(), SLNet::NetworkIDObject::GetNetworkIDManager(), networkIdHash, NetworkIDToHashIndex(), SLNet::NetworkIDObject::nextInstanceForNetworkIDManager, RakAssert, and SLNet::UNASSIGNED_NETWORK_ID.

Referenced by SLNet::NetworkIDObject::SetNetworkID(), SLNet::NetworkIDObject::SetNetworkIDManager(), and SLNet::NetworkIDObject::~NetworkIDObject().

void NetworkIDManager::TrackNetworkIDObject ( NetworkIDObject * networkIdObject )
protected

Definition at line 73 of file NetworkIDManager.cpp.

References SLNet::NetworkIDObject::GetNetworkID(), SLNet::NetworkIDObject::GetNetworkIDManager(), networkIdHash, NetworkIDToHashIndex(), SLNet::NetworkIDObject::nextInstanceForNetworkIDManager, RakAssert, and SLNet::UNASSIGNED_NETWORK_ID.

Referenced by SLNet::NetworkIDObject::SetNetworkID(), and SLNet::NetworkIDObject::SetNetworkIDManager().

Member Data Documentation

NetworkIDObject* SLNet::NetworkIDManager::networkIdHash[NETWORK_ID_MANAGER_HASH_LENGTH]
protected

Definition at line 75 of file NetworkIDManager.h.

Referenced by Clear(), GET_BASE_OBJECT_FROM_ID(), StopTrackingNetworkIDObject(), and TrackNetworkIDObject().

uint64_t SLNet::NetworkIDManager::startingOffset
protected

Definition at line 77 of file NetworkIDManager.h.

Referenced by GetNewNetworkID().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/NetworkIDManager.h
  • Source/src/NetworkIDManager.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::NetworkIDObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • NetworkIDObject
Public Member Functions | Protected Attributes | List of all members
SLNet::NetworkIDObject Class Reference

Unique shared ids for each object instance. More...

#include <slikenet/NetworkIDObject.h>

+ Inheritance diagram for SLNet::NetworkIDObject:

Public Member Functions

NetworkIDObject ()
virtual | ~NetworkIDObject ()
virtual void | SetNetworkIDManager (NetworkIDManager *manager)
virtual NetworkIDManager * | GetNetworkIDManager (void) const
Returns what was passed to SetNetworkIDManager.
virtual NetworkID | GetNetworkID (void)
virtual void | SetNetworkID (NetworkID id)
virtual void | SetParent (void *_parent)
virtual void * | GetParent (void) const

Protected Attributes

NetworkID networkID
The network ID of this object.
NetworkIDManager * networkIDManager
void * parent
The parent set by SetParent()
NetworkIDObject * nextInstanceForNetworkIDManager

Detailed Description

Unique shared ids for each object instance.

A class you can derive from to make it easier to represent every networked object with an integer. This way you can refer to objects over the network. One system should return true for IsNetworkIDAuthority() and the rest should return false. When an object needs to be created, have the the one system create the object. Then have that system send a message to all other systems, and include the value returned from GetNetworkID() in that packet. All other systems should then create the same class of object, and call SetNetworkID() on that class with the NetworkID in the packet.

See Also
the manual for more information on this.

Definition at line 41 of file NetworkIDObject.h.

Constructor & Destructor Documentation

NetworkIDObject::NetworkIDObject ( )

Definition at line 27 of file NetworkIDObject.cpp.

References networkID, networkIDManager, nextInstanceForNetworkIDManager, parent, and SLNet::UNASSIGNED_NETWORK_ID.

NetworkIDObject::~NetworkIDObject ( )
virtual

Definition at line 34 of file NetworkIDObject.cpp.

References networkIDManager, and SLNet::NetworkIDManager::StopTrackingNetworkIDObject().

Member Function Documentation

NetworkID NetworkIDObject::GetNetworkID ( void )
virtual

Returns the NetworkID that you can use to refer to this object over the network.

Precondition
You must first call SetNetworkIDManager before using this function
Return values
UNASSIGNED_NETWORK_ID | UNASSIGNED_NETWORK_ID is returned IsNetworkIDAuthority() is false and SetNetworkID() was not previously called. This is also returned if you call this function in the constructor.
0-65534 | Any other value is a valid NetworkID. NetworkIDs start at 0 and go to 65534, wrapping at that point.

Definition at line 66 of file NetworkIDObject.cpp.

References networkID.

Referenced by SLNet::NetworkIDManager::GET_BASE_OBJECT_FROM_ID(), SLNet::NetworkIDManager::StopTrackingNetworkIDObject(), and SLNet::NetworkIDManager::TrackNetworkIDObject().

NetworkIDManager * NetworkIDObject::GetNetworkIDManager ( void ) const
virtual

Returns what was passed to SetNetworkIDManager.

Definition at line 62 of file NetworkIDObject.cpp.

References networkIDManager.

Referenced by SLNet::NetworkIDManager::StopTrackingNetworkIDObject(), and SLNet::NetworkIDManager::TrackNetworkIDObject().

void * NetworkIDObject::GetParent ( void ) const
virtual

Return what was passed to SetParent

Returns
The value passed to SetParent, or 0 if it was never called.

Definition at line 93 of file NetworkIDObject.cpp.

References parent.

Referenced by SLNet::NetworkIDManager::GET_OBJECT_FROM_ID().

void NetworkIDObject::SetNetworkID ( NetworkID id )
virtual

Sets the NetworkID for this instance. Usually this is called by the clients and determined from the servers. However, if you save multiplayer games you would likely use This on load as well.

Definition at line 70 of file NetworkIDObject.cpp.

References networkID, networkIDManager, SetNetworkIDManager(), SLNet::NetworkIDManager::StopTrackingNetworkIDObject(), SLNet::NetworkIDManager::TrackNetworkIDObject(), and SLNet::UNASSIGNED_NETWORK_ID.

void NetworkIDObject::SetNetworkIDManager ( NetworkIDManager * manager )
virtual

Sets the manager class from which to request unique network IDs Unlike previous versions, the NetworkIDObject relies on a manager class to provide IDs, rather than using statics, So you can have more than one set of IDs on the same system.

Definition at line 39 of file NetworkIDObject.cpp.

References SLNet::NetworkIDManager::GetNewNetworkID(), networkID, networkIDManager, SLNet::NetworkIDManager::StopTrackingNetworkIDObject(), SLNet::NetworkIDManager::TrackNetworkIDObject(), and SLNet::UNASSIGNED_NETWORK_ID.

Referenced by SetNetworkID().

void NetworkIDObject::SetParent ( void * _parent )
virtual

Your class does not have to derive from NetworkIDObject, although that is the easiest way to implement this. If you want this to be a member object of another class, rather than inherit, then call SetParent() with a pointer to the parent class instance. GET_OBJECT_FROM_ID will then return the parent rather than this instance.

Definition at line 89 of file NetworkIDObject.cpp.

References parent.

Member Data Documentation

NetworkID SLNet::NetworkIDObject::networkID
protected

The network ID of this object.

Definition at line 81 of file NetworkIDObject.h.

Referenced by GetNetworkID(), NetworkIDObject(), SetNetworkID(), and SetNetworkIDManager().

NetworkIDManager* SLNet::NetworkIDObject::networkIDManager
protected

Definition at line 82 of file NetworkIDObject.h.

Referenced by GetNetworkIDManager(), NetworkIDObject(), SetNetworkID(), SetNetworkIDManager(), and ~NetworkIDObject().

NetworkIDObject* SLNet::NetworkIDObject::nextInstanceForNetworkIDManager
protected

Definition at line 89 of file NetworkIDObject.h.

Referenced by SLNet::NetworkIDManager::GET_BASE_OBJECT_FROM_ID(), NetworkIDObject(), SLNet::NetworkIDManager::StopTrackingNetworkIDObject(), and SLNet::NetworkIDManager::TrackNetworkIDObject().

void* SLNet::NetworkIDObject::parent
protected

The parent set by SetParent()

Definition at line 85 of file NetworkIDObject.h.

Referenced by GetParent(), NetworkIDObject(), and SetParent().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/NetworkIDObject.h
  • Source/src/NetworkIDObject.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::PacketizedTCP Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • PacketizedTCP
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::PacketizedTCP Class Reference

#include <slikenet/PacketizedTCP.h>

+ Inheritance diagram for SLNet::PacketizedTCP:

Public Member Functions

PacketizedTCP ()
virtual | ~PacketizedTCP ()
void | Stop (void)
Stops the TCP server.
void | Send (const char *data, unsigned length, const SystemAddress &systemAddress, bool broadcast)
Sends a byte stream.
bool | SendList (const char **data, const unsigned int *lengths, const int numParameters, const SystemAddress &systemAddress, bool broadcast)
Packet * | Receive (void)
Returns data received.
void | CloseConnection (SystemAddress systemAddress)
Disconnects a player/address.
SystemAddress | HasCompletedConnectionAttempt (void)
SystemAddress | HasFailedConnectionAttempt (void)
SystemAddress | HasNewIncomingConnection (void)
Queued events of new incoming connections.
SystemAddress | HasLostConnection (void)
Queued events of lost connections.
- Public Member Functions inherited from SLNet::TCPInterface
TCPInterface ()
virtual | ~TCPInterface ()
bool | Start (unsigned short port, unsigned short maxIncomingConnections, unsigned short maxConnections=0, int _threadPriority=-99999, unsigned short socketFamily=AF_INET, const char *bindAddress=0)
void | Stop (void)
Stops the TCP server.
SystemAddress | Connect (const char *host, unsigned short remotePort, bool block=true, unsigned short socketFamily=AF_INET, const char *bindAddress=0)
Connect to the specified host on the specified port.
virtual void | Send (const char *data, unsigned int length, const SystemAddress &systemAddress, bool broadcast)
Sends a byte stream.
unsigned int | GetOutgoingDataBufferSize (SystemAddress systemAddress) const
virtual bool | ReceiveHasPackets (void)
void | CloseConnection (SystemAddress systemAddress)
Disconnects a player/address.
void | DeallocatePacket (Packet *packet)
Deallocates a packet returned by Receive.
void | GetConnectionList (SystemAddress *remoteSystems, unsigned short *numberOfSystems) const
unsigned short | GetConnectionCount (void) const
Returns just the number of connections we have.
SystemAddress | HasCompletedConnectionAttempt (void)
SystemAddress | HasFailedConnectionAttempt (void)
SystemAddress | HasNewIncomingConnection (void)
Queued events of new incoming connections.
SystemAddress | HasLostConnection (void)
Queued events of lost connections.
Packet * | AllocatePacket (unsigned dataSize)
Return an allocated but empty packet, for custom use.
virtual void | PushBackPacket (Packet *packet, bool pushAtHead)
bool | WasStarted (void) const
Returns if Start() was called successfully.
void | AttachPlugin (PluginInterface2 *plugin)
void | DetachPlugin (PluginInterface2 *plugin)

Protected Member Functions

void | ClearAllConnections (void)
void | RemoveFromConnectionList (const SystemAddress &sa)
void | AddToConnectionList (const SystemAddress &sa)
void | PushNotificationsToQueues (void)
Packet * | ReturnOutgoingPacket (void)
- Protected Member Functions inherited from SLNet::TCPInterface
Packet * | ReceiveInt (void)
bool | CreateListenSocket (unsigned short port, unsigned short maxIncomingConnections, unsigned short socketFamily, const char *hostAddress)
friend | RAK_THREAD_DECLARATION (UpdateTCPInterfaceLoop)
friend | RAK_THREAD_DECLARATION (ConnectionAttemptLoop)
__TCPSOCKET__ | SocketConnect (const char *host, unsigned short remotePort, unsigned short socketFamily, const char *bindAddress)

Protected Attributes

DataStructures::Queue< Packet * > waitingPackets
DataStructures::Map
< SystemAddress,
DataStructures::ByteQueue * > 		connections
DataStructures::Queue
< SystemAddress > 		_newIncomingConnections
DataStructures::Queue
< SystemAddress > 		_lostConnections
DataStructures::Queue
< SystemAddress > 		_failedConnectionAttempts
DataStructures::Queue
< SystemAddress > 		_completedConnectionAttempts
- Protected Attributes inherited from SLNet::TCPInterface
DataStructures::List
< PluginInterface2 * > 		messageHandlerList
SLNet::LocklessUint32_t isStarted
SLNet::LocklessUint32_t threadRunning
__TCPSOCKET__ listenSocket
DataStructures::Queue< Packet * > headPush
DataStructures::Queue< Packet * > tailPush
RemoteClient * remoteClients
unsigned short | remoteClientsLength
DataStructures::ThreadsafeAllocatingQueue
< Packet > 		incomingMessages
DataStructures::ThreadsafeAllocatingQueue
< SystemAddress > 		newIncomingConnections
DataStructures::ThreadsafeAllocatingQueue
< SystemAddress > 		lostConnections
DataStructures::ThreadsafeAllocatingQueue
< SystemAddress > 		requestedCloseConnections
DataStructures::ThreadsafeAllocatingQueue
< RemoteClient * > 		newRemoteClients
SimpleMutex completedConnectionAttemptMutex
SimpleMutex failedConnectionAttemptMutex
DataStructures::Queue
< SystemAddress > 		completedConnectionAttempts
DataStructures::Queue
< SystemAddress > 		failedConnectionAttempts
int | threadPriority
DataStructures::List
< __TCPSOCKET__ > 		blockingSocketList
SimpleMutex blockingSocketListMutex

Detailed Description

Definition at line 34 of file PacketizedTCP.h.

Constructor & Destructor Documentation

SLNet::PacketizedTCP::PacketizedTCP ( )
virtual SLNet::PacketizedTCP::~PacketizedTCP ( )
virtual

Member Function Documentation

void SLNet::PacketizedTCP::AddToConnectionList ( const SystemAddress & sa )
protected
void SLNet::PacketizedTCP::ClearAllConnections ( void )
protected
void SLNet::PacketizedTCP::CloseConnection ( SystemAddress systemAddress )

Disconnects a player/address.

SystemAddress SLNet::PacketizedTCP::HasCompletedConnectionAttempt ( void )

Has a previous call to connect succeeded?

Returns
UNASSIGNED_SYSTEM_ADDRESS = no. Anything else means yes.
SystemAddress SLNet::PacketizedTCP::HasFailedConnectionAttempt ( void )

Has a previous call to connect failed?

Returns
UNASSIGNED_SYSTEM_ADDRESS = no. Anything else means yes.
SystemAddress SLNet::PacketizedTCP::HasLostConnection ( void )

Queued events of lost connections.

SystemAddress SLNet::PacketizedTCP::HasNewIncomingConnection ( void )

Queued events of new incoming connections.

void SLNet::PacketizedTCP::PushNotificationsToQueues ( void )
protected
Packet* SLNet::PacketizedTCP::Receive ( void )
virtual

Returns data received.

Reimplemented from SLNet::TCPInterface.

void SLNet::PacketizedTCP::RemoveFromConnectionList ( const SystemAddress & sa )
protected
Packet* SLNet::PacketizedTCP::ReturnOutgoingPacket ( void )
protected
void SLNet::PacketizedTCP::Send | ( | const char * | data,
 |  | unsigned | length,
 |  | const SystemAddress & | systemAddress,
 |  | bool | broadcast
 | ) |  |

Sends a byte stream.

bool SLNet::PacketizedTCP::SendList | ( | const char ** | data,
 |  | const unsigned int * | lengths,
 |  | const int | numParameters,
 |  | const SystemAddress & | systemAddress,
 |  | bool | broadcast
 | ) |  |
virtual

Reimplemented from SLNet::TCPInterface.

void SLNet::PacketizedTCP::Stop ( void )

Stops the TCP server.

Member Data Documentation

DataStructures::Queue<SystemAddress> SLNet::PacketizedTCP::_completedConnectionAttempts
protected

Definition at line 84 of file PacketizedTCP.h.

DataStructures::Queue<SystemAddress> SLNet::PacketizedTCP::_failedConnectionAttempts
protected

Definition at line 84 of file PacketizedTCP.h.

DataStructures::Queue<SystemAddress> SLNet::PacketizedTCP::_lostConnections
protected

Definition at line 84 of file PacketizedTCP.h.

DataStructures::Queue<SystemAddress> SLNet::PacketizedTCP::_newIncomingConnections
protected

Definition at line 84 of file PacketizedTCP.h.

DataStructures::Map<SystemAddress, DataStructures::ByteQueue *> SLNet::PacketizedTCP::connections
protected

Definition at line 81 of file PacketizedTCP.h.

DataStructures::Queue<Packet*> SLNet::PacketizedTCP::waitingPackets
protected

Definition at line 80 of file PacketizedTCP.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/PacketizedTCP.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakPeer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
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
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakPeer::BufferedCommandStruct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
  • BufferedCommandStruct
Public Types | Public Attributes | List of all members
SLNet::RakPeer::BufferedCommandStruct Struct Reference

#include <slikenet/peer.h>

Public Types

enum {
BCS_SEND, BCS_CLOSE_CONNECTION, BCS_GET_SOCKET, BCS_CHANGE_SYSTEM_ADDRESS,
BCS_DO_NOTHING
}

Public Attributes

BitSize_t numberOfBitsToSend
PacketPriority priority
PacketReliability reliability
char | orderingChannel
AddressOrGUID systemIdentifier
bool | broadcast
RemoteSystemStruct::ConnectMode connectionMode
NetworkID networkID
bool | blockingCommand
char * | data
bool | haveRakNetCloseSocket
unsigned | connectionSocketIndex
unsigned short | remotePortRakNetWasStartedOn_PS3
unsigned int | extraSocketOptions
RakNetSocket2 * socket
unsigned short | port
uint32_t receipt
enum
SLNet::RakPeer::BufferedCommandStruct:: { ... } 		command

Detailed Description

Definition at line 876 of file peer.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
BCS_SEND
BCS_CLOSE_CONNECTION
BCS_GET_SOCKET
BCS_CHANGE_SYSTEM_ADDRESS
BCS_DO_NOTHING

Definition at line 895 of file peer.h.

Member Data Documentation

bool SLNet::RakPeer::BufferedCommandStruct::blockingCommand

Definition at line 886 of file peer.h.

bool SLNet::RakPeer::BufferedCommandStruct::broadcast

Definition at line 883 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

enum { ... } SLNet::RakPeer::BufferedCommandStruct::command

Referenced by SLNet::RakPeer::ChangeSystemAddress(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

RemoteSystemStruct::ConnectMode SLNet::RakPeer::BufferedCommandStruct::connectionMode

Definition at line 884 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

unsigned SLNet::RakPeer::BufferedCommandStruct::connectionSocketIndex

Definition at line 889 of file peer.h.

char* SLNet::RakPeer::BufferedCommandStruct::data

Definition at line 887 of file peer.h.

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

unsigned int SLNet::RakPeer::BufferedCommandStruct::extraSocketOptions

Definition at line 891 of file peer.h.

bool SLNet::RakPeer::BufferedCommandStruct::haveRakNetCloseSocket

Definition at line 888 of file peer.h.

NetworkID SLNet::RakPeer::BufferedCommandStruct::networkID

Definition at line 885 of file peer.h.

BitSize_t SLNet::RakPeer::BufferedCommandStruct::numberOfBitsToSend

Definition at line 878 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

char SLNet::RakPeer::BufferedCommandStruct::orderingChannel

Definition at line 881 of file peer.h.

Referenced by SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

unsigned short SLNet::RakPeer::BufferedCommandStruct::port

Definition at line 893 of file peer.h.

PacketPriority SLNet::RakPeer::BufferedCommandStruct::priority

Definition at line 879 of file peer.h.

Referenced by SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

uint32_t SLNet::RakPeer::BufferedCommandStruct::receipt

Definition at line 894 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

PacketReliability SLNet::RakPeer::BufferedCommandStruct::reliability

Definition at line 880 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

unsigned short SLNet::RakPeer::BufferedCommandStruct::remotePortRakNetWasStartedOn_PS3

Definition at line 890 of file peer.h.

RakNetSocket2* SLNet::RakPeer::BufferedCommandStruct::socket

Definition at line 892 of file peer.h.

AddressOrGUID SLNet::RakPeer::BufferedCommandStruct::systemIdentifier

Definition at line 882 of file peer.h.

Referenced by SLNet::RakPeer::ChangeSystemAddress(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/peer.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakPeer::RemoteSystemStruct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
  • RemoteSystemStruct
Public Types | Public Attributes | List of all members
SLNet::RakPeer::RemoteSystemStruct Struct Reference

#include <slikenet/peer.h>

Public Types

enum ConnectMode {
NO_ACTION, DISCONNECT_ASAP, DISCONNECT_ASAP_SILENTLY, DISCONNECT_ON_NO_ACK,
REQUESTED_CONNECTION, HANDLING_CONNECTION_REQUEST, UNVERIFIED_SENDER, CONNECTED
}

Public Attributes

bool | isActive
SystemAddress systemAddress
SystemAddress myExternalSystemAddress
Their external IP on the internet.
SystemAddress theirInternalSystemAddress [MAXIMUM_NUMBER_OF_INTERNAL_IDS]
Your external IP on the internet, from their perspective.
ReliabilityLayer reliabilityLayer
Their internal IP, behind the LAN.
bool | weInitiatedTheConnection
The reliability layer associated with this player.
PingAndClockDifferential pingAndClockDifferential [PING_TIMES_ARRAY_SIZE]
True if we started this connection via Connect. False if someone else connected to us.
SLNet::Time pingAndClockDifferentialWriteIndex
last x ping times and calculated clock differentials with it
unsigned short | lowestPing
The index we are writing into the pingAndClockDifferential circular buffer.
SLNet::Time nextPingTime
The lowest ping value encountered.
SLNet::Time lastReliableSend
When to next ping this player.
SLNet::Time connectionTime
When did the last reliable send occur. Reliable sends must occur at least once every timeoutTime/2 units to notice disconnects.
RakNetGUID guid
connection time, if active.
int | MTUSize
RakNetSocket2 * rakNetSocket
SystemIndex remoteSystemIndex
enum
SLNet::RakPeer::RemoteSystemStruct::ConnectMode 		connectMode

Detailed Description

Definition at line 668 of file peer.h.

Member Enumeration Documentation

enum SLNet::RakPeer::RemoteSystemStruct::ConnectMode
Enumerator:
NO_ACTION
DISCONNECT_ASAP
DISCONNECT_ASAP_SILENTLY
DISCONNECT_ON_NO_ACK
REQUESTED_CONNECTION
HANDLING_CONNECTION_REQUEST
UNVERIFIED_SENDER
CONNECTED

Definition at line 698 of file peer.h.

Member Data Documentation

SLNet::Time SLNet::RakPeer::RemoteSystemStruct::connectionTime

When did the last reliable send occur. Reliable sends must occur at least once every timeoutTime/2 units to notice disconnects.

Definition at line 681 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), and SLNet::RakPeer::RunUpdateCycle().

enum SLNet::RakPeer::RemoteSystemStruct::ConnectMode SLNet::RakPeer::RemoteSystemStruct::connectMode

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::Startup().

RakNetGUID SLNet::RakPeer::RemoteSystemStruct::guid

connection time, if active.

Definition at line 683 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetGUIDFromIndex(), SLNet::RakPeer::GetGuidFromSystemAddress(), SLNet::RakPeer::GetIndexFromGuid(), SLNet::RakPeer::GetSystemAddressFromGuid(), SLNet::RakPeer::GetSystemIndexFromGuid(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::Startup().

bool SLNet::RakPeer::RemoteSystemStruct::isActive

Definition at line 670 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetIndexFromGuid(), SLNet::RakPeer::GetIndexFromSystemAddress(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::Shutdown(), and SLNet::RakPeer::Startup().

SLNet::Time SLNet::RakPeer::RemoteSystemStruct::lastReliableSend

When to next ping this player.

Definition at line 680 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendImmediate().

unsigned short SLNet::RakPeer::RemoteSystemStruct::lowestPing

The index we are writing into the pingAndClockDifferential circular buffer.

Definition at line 678 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::GetLowestPing(), SLNet::RakPeer::OnConnectedPong(), and SLNet::RakPeer::RunUpdateCycle().

int SLNet::RakPeer::RemoteSystemStruct::MTUSize

Definition at line 684 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::GetMTUSize(), SLNet::ProcessNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::Startup().

SystemAddress SLNet::RakPeer::RemoteSystemStruct::myExternalSystemAddress

Their external IP on the internet.

Definition at line 672 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::GetExternalID(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::Startup().

SLNet::Time SLNet::RakPeer::RemoteSystemStruct::nextPingTime

The lowest ping value encountered.

Definition at line 679 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), and SLNet::RakPeer::RunUpdateCycle().

PingAndClockDifferential SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferential[PING_TIMES_ARRAY_SIZE]

True if we started this connection via Connect. False if someone else connected to us.

Definition at line 676 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::GetAveragePing(), SLNet::RakPeer::GetClockDifferentialInt(), SLNet::RakPeer::GetLastPing(), and SLNet::RakPeer::OnConnectedPong().

SLNet::Time SLNet::RakPeer::RemoteSystemStruct::pingAndClockDifferentialWriteIndex

last x ping times and calculated clock differentials with it

Definition at line 677 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::GetLastPing(), and SLNet::RakPeer::OnConnectedPong().

RakNetSocket2* SLNet::RakPeer::RemoteSystemStruct::rakNetSocket

Definition at line 686 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::Shutdown().

ReliabilityLayer SLNet::RakPeer::RemoteSystemStruct::reliabilityLayer

Their internal IP, behind the LAN.

Definition at line 674 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetStatistics(), SLNet::RakPeer::GetTimeoutTime(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::ProcessNetworkPacket(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendImmediate(), SLNet::RakPeer::SetTimeoutTime(), SLNet::RakPeer::Shutdown(), and SLNet::RakPeer::Startup().

SystemIndex SLNet::RakPeer::RemoteSystemStruct::remoteSystemIndex

Definition at line 687 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::Startup().

SystemAddress SLNet::RakPeer::RemoteSystemStruct::systemAddress

Definition at line 671 of file peer.h.

Referenced by SLNet::RakPeer::DereferenceRemoteSystem(), SLNet::RakPeer::GetClientPublicKeyFromSystemAddress(), SLNet::RakPeer::GetGuidFromSystemAddress(), SLNet::RakPeer::GetIndexFromSystemAddress(), SLNet::RakPeer::GetRemoteSystemIndex(), SLNet::RakPeer::GetSystemAddressFromGuid(), SLNet::RakPeer::GetSystemAddressFromIndex(), SLNet::RakPeer::OnConnectionRequest(), SLNet::RakPeer::ReferenceRemoteSystem(), SLNet::RakPeer::RemoveFromActiveSystemList(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::Startup().

SystemAddress SLNet::RakPeer::RemoteSystemStruct::theirInternalSystemAddress[MAXIMUM_NUMBER_OF_INTERNAL_IDS]

Your external IP on the internet, from their perspective.

Definition at line 673 of file peer.h.

Referenced by SLNet::RakPeer::GetInternalID(), and SLNet::RakPeer::RunUpdateCycle().

bool SLNet::RakPeer::RemoteSystemStruct::weInitiatedTheConnection

The reliability layer associated with this player.

Definition at line 675 of file peer.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), and SLNet::ProcessOfflineNetworkPacket().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/peer.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakPeer::RequestedConnectionStruct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
  • RequestedConnectionStruct
Public Types | Public Attributes | List of all members
SLNet::RakPeer::RequestedConnectionStruct Struct Reference

#include <slikenet/peer.h>

Public Types

enum { CONNECT =1 }

Public Attributes

SystemAddress systemAddress
SLNet::Time nextRequestTime
unsigned char | requestsMade
char * | data
unsigned short | dataLength
char | outgoingPassword [256]
unsigned char | outgoingPasswordLength
unsigned | socketIndex
unsigned int | extraData
unsigned | sendConnectionAttemptCount
unsigned | timeBetweenSendConnectionAttemptsMS
SLNet::TimeMS timeoutTime
PublicKeyMode publicKeyMode
RakNetSocket2 * socket
enum
SLNet::RakPeer::RequestedConnectionStruct:: { ... } 		actionToTake

Detailed Description

Definition at line 836 of file peer.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
CONNECT

Definition at line 852 of file peer.h.

Member Data Documentation

enum { ... } SLNet::RakPeer::RequestedConnectionStruct::actionToTake

Referenced by SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendConnectionRequest().

char* SLNet::RakPeer::RequestedConnectionStruct::data

Definition at line 841 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendConnectionRequest().

unsigned short SLNet::RakPeer::RequestedConnectionStruct::dataLength

Definition at line 842 of file peer.h.

unsigned int SLNet::RakPeer::RequestedConnectionStruct::extraData

Definition at line 846 of file peer.h.

Referenced by SLNet::RakPeer::SendConnectionRequest().

SLNet::Time SLNet::RakPeer::RequestedConnectionStruct::nextRequestTime

Definition at line 839 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendConnectionRequest().

char SLNet::RakPeer::RequestedConnectionStruct::outgoingPassword[256]

Definition at line 843 of file peer.h.

Referenced by SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakPeer::SendConnectionRequest().

unsigned char SLNet::RakPeer::RequestedConnectionStruct::outgoingPasswordLength

Definition at line 844 of file peer.h.

Referenced by SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakPeer::SendConnectionRequest().

PublicKeyMode SLNet::RakPeer::RequestedConnectionStruct::publicKeyMode

Definition at line 850 of file peer.h.

Referenced by SLNet::ProcessOfflineNetworkPacket().

unsigned char SLNet::RakPeer::RequestedConnectionStruct::requestsMade

Definition at line 840 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendConnectionRequest().

unsigned SLNet::RakPeer::RequestedConnectionStruct::sendConnectionAttemptCount

Definition at line 847 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendConnectionRequest().

RakNetSocket2* SLNet::RakPeer::RequestedConnectionStruct::socket

Definition at line 851 of file peer.h.

Referenced by SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendConnectionRequest().

unsigned SLNet::RakPeer::RequestedConnectionStruct::socketIndex

Definition at line 845 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendConnectionRequest().

SystemAddress SLNet::RakPeer::RequestedConnectionStruct::systemAddress

Definition at line 838 of file peer.h.

Referenced by SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendConnectionRequest().

unsigned SLNet::RakPeer::RequestedConnectionStruct::timeBetweenSendConnectionAttemptsMS

Definition at line 848 of file peer.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendConnectionRequest().

SLNet::TimeMS SLNet::RakPeer::RequestedConnectionStruct::timeoutTime

Definition at line 849 of file peer.h.

Referenced by SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakPeer::SendConnectionRequest().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/peer.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakPeer::SocketQueryOutput Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
  • SocketQueryOutput
Public Member Functions | Public Attributes | List of all members
SLNet::RakPeer::SocketQueryOutput Struct Reference

#include <slikenet/peer.h>

Public Member Functions

SocketQueryOutput ()
~SocketQueryOutput ()

Public Attributes

DataStructures::List
< RakNetSocket2 * > 		sockets

Detailed Description

Definition at line 917 of file peer.h.

Constructor & Destructor Documentation

SLNet::RakPeer::SocketQueryOutput::SocketQueryOutput ( )
inline

Definition at line 919 of file peer.h.

SLNet::RakPeer::SocketQueryOutput::~SocketQueryOutput ( )
inline

Definition at line 920 of file peer.h.

Member Data Documentation

DataStructures::List<RakNetSocket2* > SLNet::RakPeer::SocketQueryOutput::sockets

Definition at line 921 of file peer.h.

Referenced by SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), and SLNet::RakPeer::RunUpdateCycle().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/peer.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakPeerInterface Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeerInterface
Public Member Functions | Static Public Member Functions | List of all members
SLNet::RakPeerInterface Class Referenceabstract

The main interface for network communications. More...

#include <slikenet/peerinterface.h>

+ Inheritance diagram for SLNet::RakPeerInterface:

Public Member Functions

virtual | ~RakPeerInterface ()
Destructor.
virtual StartupResult | Startup (unsigned int maxConnections, SocketDescriptor *socketDescriptors, unsigned socketDescriptorCount, int threadPriority=-99999)=0
Starts the network threads, opens the listen port.
virtual bool | InitializeSecurity (const char *publicKey, const char *privateKey, bool bRequireClientKey=false)=0
virtual void | DisableSecurity (void)=0
virtual void | AddToSecurityExceptionList (const char *ip)=0
virtual void | RemoveFromSecurityExceptionList (const char *ip)=0
virtual bool | IsInSecurityExceptionList (const char *ip)=0
virtual void | SetMaximumIncomingConnections (unsigned short numberAllowed)=0
virtual unsigned int | GetMaximumIncomingConnections (void) const =0
virtual unsigned short | NumberOfConnections (void) const =0
virtual void | SetIncomingPassword (const char *passwordData, int passwordDataLength)=0
virtual void | GetIncomingPassword (char *passwordData, int *passwordDataLength)=0
virtual ConnectionAttemptResult | Connect (const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, PublicKey *publicKey=0, unsigned connectionSocketIndex=0, unsigned sendConnectionAttemptCount=12, unsigned timeBetweenSendConnectionAttemptsMS=500, SLNet::TimeMS timeoutTime=0)=0
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. You know 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.
virtual ConnectionAttemptResult | ConnectWithSocket (const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, RakNetSocket2 *socket, PublicKey *publicKey=0, unsigned sendConnectionAttemptCount=12, unsigned timeBetweenSendConnectionAttemptsMS=500, SLNet::TimeMS timeoutTime=0)=0
Connect to the specified host (ip or domain name) and server port, using a shared socket from another instance of RakNet.
virtual void | Shutdown (unsigned int blockDuration, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY)=0
Connect to the specified network ID (Platform specific console function)
virtual bool | IsActive (void) const =0
virtual bool | GetConnectionList (SystemAddress *remoteSystems, unsigned short *numberOfSystems) const =0
virtual uint32_t | GetNextSendReceipt (void)=0
virtual uint32_t | IncrementNextSendReceipt (void)=0
virtual uint32_t | Send (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)=0
virtual void | SendLoopback (const char *data, const int length)=0
virtual uint32_t | Send (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)=0
virtual 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)=0
virtual Packet * | Receive (void)=0
virtual void | DeallocatePacket (Packet *packet)=0
virtual unsigned int | GetMaximumNumberOfPeers (void) const =0
Return the total number of connections we are allowed.
virtual void | CloseConnection (const AddressOrGUID target, bool sendDisconnectionNotification, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY)=0
virtual ConnectionState | GetConnectionState (const AddressOrGUID systemIdentifier)=0
virtual void | CancelConnectionAttempt (const SystemAddress target)=0
virtual int | GetIndexFromSystemAddress (const SystemAddress systemAddress) const =0
virtual SystemAddress | GetSystemAddressFromIndex (unsigned int index)=0
virtual RakNetGUID | GetGUIDFromIndex (unsigned int index)=0
virtual void | GetSystemList (DataStructures::List< SystemAddress > &addresses, DataStructures::List< RakNetGUID > &guids) const =0
virtual void | AddToBanList (const char *IP, SLNet::TimeMS milliseconds=0)=0
virtual void | RemoveFromBanList (const char *IP)=0
virtual void | ClearBanList (void)=0
Allows all previously banned IPs to connect.
virtual bool | IsBanned (const char *IP)=0
virtual void | SetLimitIPConnectionFrequency (bool b)=0
virtual void | Ping (const SystemAddress target)=0
virtual bool | Ping (const char *host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections, unsigned connectionSocketIndex=0)=0
virtual int | GetAveragePing (const AddressOrGUID systemIdentifier)=0
virtual int | GetLastPing (const AddressOrGUID systemIdentifier) const =0
virtual int | GetLowestPing (const AddressOrGUID systemIdentifier) const =0
virtual void | SetOccasionalPing (bool doPing)=0
virtual SLNet::Time | GetClockDifferential (const AddressOrGUID systemIdentifier)=0
virtual void | SetOfflinePingResponse (const char *data, const unsigned int length)=0
virtual void | GetOfflinePingResponse (char **data, unsigned int *length)=0
virtual SystemAddress | GetInternalID (const SystemAddress systemAddress=UNASSIGNED_SYSTEM_ADDRESS, const int index=0) const =0
virtual void | SetInternalID (SystemAddress systemAddress, int index=0)=0
Sets your internal IP address, for platforms that do not support reading it, or to override a value.
virtual SystemAddress | GetExternalID (const SystemAddress target) const =0
virtual const RakNetGUID | GetMyGUID (void) const =0
Return my own GUID.
virtual SystemAddress | GetMyBoundAddress (const int socketIndex=0)=0
Return the address bound to a socket at the specified index.
virtual const RakNetGUID & | GetGuidFromSystemAddress (const SystemAddress input) const =0
virtual SystemAddress | GetSystemAddressFromGuid (const RakNetGUID input) const =0
virtual bool | GetClientPublicKeyFromSystemAddress (const SystemAddress input, char *client_public_key) const =0
virtual void | SetTimeoutTime (SLNet::TimeMS timeMS, const SystemAddress target)=0
virtual SLNet::TimeMS | GetTimeoutTime (const SystemAddress target)=0
virtual int | GetMTUSize (const SystemAddress target) const =0
virtual unsigned | GetNumberOfAddresses (void)=0
Returns the number of IP addresses this system has internally. Get the actual addresses from GetLocalIP()
virtual const char * | GetLocalIP (unsigned int index)=0
virtual bool | IsLocalIP (const char *ip)=0
virtual void | AllowConnectionResponseIPMigration (bool allow)=0
virtual bool | AdvertiseSystem (const char *host, unsigned short remotePort, const char *data, int dataLength, unsigned connectionSocketIndex=0)=0
virtual void | SetSplitMessageProgressInterval (int interval)=0
virtual int | GetSplitMessageProgressInterval (void) const =0
virtual void | SetUnreliableTimeout (SLNet::TimeMS timeoutMS)=0
virtual void | SendTTL (const char *host, unsigned short remotePort, int ttl, unsigned connectionSocketIndex=0)=0
virtual void | AttachPlugin (PluginInterface2 *plugin)=0
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.
virtual void | DetachPlugin (PluginInterface2 *messageHandler)=0
Detaches a Plugin interface from the instance of the base class (RakPeer or PacketizedTCP) it is attached to.
virtual void | PushBackPacket (Packet *packet, bool pushAtHead)=0
virtual void | ChangeSystemAddress (RakNetGUID guid, const SystemAddress &systemAddress)=0
virtual Packet * | AllocatePacket (unsigned dataSize)=0
virtual RakNetSocket2 * | GetSocket (const SystemAddress target)=0
virtual void | GetSockets (DataStructures::List< RakNetSocket2 * > &sockets)=0
virtual void | ReleaseSockets (DataStructures::List< RakNetSocket2 * > &sockets)=0
virtual void | WriteOutOfBandHeader (SLNet::BitStream *bitStream)=0
virtual void | SetUserUpdateThread (void(*_userUpdateThreadPtr)(RakPeerInterface *, void *), void *_userUpdateThreadData)=0
virtual void | SetIncomingDatagramEventHandler (bool(*_incomingDatagramEventHandler)(RNS2RecvStruct *))=0
virtual void | ApplyNetworkSimulator (float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance)=0
virtual void | SetPerConnectionOutgoingBandwidthLimit (unsigned maxBitsPerSecond)=0
virtual bool | IsNetworkSimulatorActive (void)=0
virtual RakNetStatistics * | GetStatistics (const SystemAddress systemAddress, RakNetStatistics *rns=0)=0
virtual bool | GetStatistics (const unsigned int index, RakNetStatistics *rns)=0
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)=0
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)=0
how many messages are waiting when you call Receive()
virtual bool | RunUpdateCycle (BitStream &updateBitStream)=0
virtual bool | SendOutOfBand (const char *host, unsigned short remotePort, const char *data, BitSize_t dataLength, unsigned connectionSocketIndex=0)=0

Static Public Member Functions

static uint64_t Get64BitUniqueRandomNumber (void)
Get a random number (to generate a GUID)

Detailed Description

The main interface for network communications.

The primary interface for RakNet, RakPeer contains all major functions for the library. See the individual functions for what the class can do.

Definition at line 47 of file peerinterface.h.

Constructor & Destructor Documentation

virtual SLNet::RakPeerInterface::~RakPeerInterface ( )
inlinevirtual

Destructor.

Definition at line 54 of file peerinterface.h.

Member Function Documentation

virtual void SLNet::RakPeerInterface::AddToBanList | ( | const char * | IP,
 |  | SLNet::TimeMS | milliseconds = 0
 | ) |  |
pure virtual

Bans an IP from connecting. Banned IPs persist between connections but are not saved on shutdown nor loaded on startup. param[in] IP Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will ban all IP addresses starting with 128.0.0

Parameters
[in] milliseconds how many ms for a temporary ban. Use 0 for a permanent ban

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::AddToSecurityExceptionList ( const char * ip )
pure virtual

If secure connections are on, do not use secure connections for a specific IP address. This is useful if you have a fixed-address internal server behind a LAN.

Note
Secure connections are determined by the recipient of an incoming connection. This has no effect if called on the system attempting to connect.
Parameters
[in] ip IP address to add. * wildcards are supported.

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::AdvertiseSystem | ( | const char * | host,
 |  | unsigned short | remotePort,
 |  | const char * | data,
 |  | int | dataLength,
 |  | unsigned | connectionSocketIndex = 0
 | ) |  |
pure virtual

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

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

Implemented in SLNet::RakPeer.

virtual Packet* SLNet::RakPeerInterface::AllocatePacket ( unsigned dataSize )
pure 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 you can write to

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::AllocatePacketUnified().

virtual void SLNet::RakPeerInterface::AllowConnectionResponseIPMigration ( bool allow )
pure 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

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::ApplyNetworkSimulator | ( | float | packetloss,
 |  | unsigned short | minExtraPing,
 |  | unsigned short | extraPingVariance
 | ) |  |
pure 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::AttachPlugin ( PluginInterface2 * plugin )
pure 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::CancelConnectionAttempt ( const SystemAddress target )
pure virtual

Cancel a pending connection attempt If we are already connected, the connection stays open

Parameters
[in] target Which system to cancel

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::ChangeSystemAddress | ( | RakNetGUID | guid,
 |  | const SystemAddress & | systemAddress
 | ) |  |
pure virtual

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::ClearBanList ( void )
pure virtual

Allows all previously banned IPs to connect.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::CloseConnection | ( | const AddressOrGUID | target,
 |  | bool | sendDisconnectionNotification,
 |  | unsigned char | orderingChannel = 0,
 |  | PacketPriority | disconnectionNotificationPriority = LOW_PRIORITY
 | ) |  |
pure virtual

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

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.

Implemented in SLNet::RakPeer.

virtual ConnectionAttemptResult SLNet::RakPeerInterface::Connect | ( | const char * | host,
 |  | unsigned short | remotePort,
 |  | const char * | passwordData,
 |  | int | passwordDataLength,
 |  | PublicKey * | publicKey = 0,
 |  | unsigned | connectionSocketIndex = 0,
 |  | unsigned | sendConnectionAttemptCount = 12,
 |  | unsigned | timeBetweenSendConnectionAttemptsMS = 500,
 |  | SLNet::TimeMS | timeoutTime = 0
 | ) |  |
pure 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. You know 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 | 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] | 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 send on.
[in] | sendConnectionAttemptCount | How many 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 | How long to keep the connection alive before dropping it on unable to send a reliable message. 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!
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.

Implemented in SLNet::RakPeer.

virtual ConnectionAttemptResult SLNet::RakPeerInterface::ConnectWithSocket | ( | const char * | host,
 |  | unsigned short | remotePort,
 |  | const char * | passwordData,
 |  | int | passwordDataLength,
 |  | RakNetSocket2 * | socket,
 |  | PublicKey * | publicKey = 0,
 |  | unsigned | sendConnectionAttemptCount = 12,
 |  | unsigned | timeBetweenSendConnectionAttemptsMS = 500,
 |  | SLNet::TimeMS | timeoutTime = 0
 | ) |  |
pure virtual

Connect to the specified host (ip or domain name) and server port, using a shared socket from another instance of RakNet.

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 | How many 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 | How long to keep the connection alive before dropping it on unable to send a reliable message. 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!

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::DeallocatePacket ( Packet * packet )
pure virtual

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

Parameters
[in] packet The message to deallocate.

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::DeallocPacketUnified().

virtual void SLNet::RakPeerInterface::DetachPlugin ( PluginInterface2 * messageHandler )
pure 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::DisableSecurity ( void )
pure virtual

Disables security for incoming connections.

Note
Must be called while offline

Implemented in SLNet::RakPeer.

uint64_t RakPeerInterface::Get64BitUniqueRandomNumber ( void )
static

Get a random number (to generate a GUID)

Definition at line 4449 of file RakPeer.cpp.

References SLNet::GetTimeUS(), and RakSleep().

Referenced by SLNet::RakPeer::GenerateGUID(), and SLNet::NetworkIDManager::NetworkIDManager().

virtual int SLNet::RakPeerInterface::GetAveragePing ( const AddressOrGUID systemIdentifier )
pure 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

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::GetClientPublicKeyFromSystemAddress | ( | const SystemAddress | input,
 |  | char * | client_public_key
 | ) |  | const
 pure 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.

Implemented in SLNet::RakPeer.

virtual SLNet::Time SLNet::RakPeerInterface::GetClockDifferential ( const AddressOrGUID systemIdentifier )
pure 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

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::GetConnectionList | ( | SystemAddress * | remoteSystems,
 |  | unsigned short * | numberOfSystems
 | ) |  | const
 pure 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 only 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

Implemented in SLNet::RakPeer.

virtual ConnectionState SLNet::RakPeerInterface::GetConnectionState ( const AddressOrGUID systemIdentifier )
pure 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

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetExternalID ( const SystemAddress target ) const
pure virtual

Return the unique address identifier that represents you on the the network and is based on your externalIP / port (the IP / port the specified player uses to communicate with you)

Parameters
[in] target Which remote system you are referring to for your external ID. Usually the same for all systems, unless you have two or more network cards.

Implemented in SLNet::RakPeer.

virtual RakNetGUID SLNet::RakPeerInterface::GetGUIDFromIndex ( unsigned int index )
pure 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

Implemented in SLNet::RakPeer.

virtual const RakNetGUID& SLNet::RakPeerInterface::GetGuidFromSystemAddress ( const SystemAddress input ) const
pure virtual

Given a connected system, give us 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 Currently O(log(n)), but this may be improved in the future. If you use this frequently, you may want to cache the value as it won't change. Returns UNASSIGNED_RAKNET_GUID if system address can't be found. 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 system we are connected to

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetIncomingPassword | ( | char * | passwordData,
 |  | int * | passwordDataLength
 | ) |  |
pure 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 array passwordData. Modified to hold the number of bytes actually written

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetIndexFromSystemAddress ( const SystemAddress systemAddress ) const
pure virtual

Given a systemAddress, returns an index from 0 to the maximum number of players allowed - 1.

Parameters
[in] systemAddress The SystemAddress we are referring to
Returns
The index of this SystemAddress or -1 on system not found.

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetInternalID | ( | const SystemAddress | systemAddress = UNASSIGNED_SYSTEM_ADDRESS,
 |  | const int | index = 0
 | ) |  | const
 pure virtual

Return the unique address identifier that represents you or another system on the the network and is based on your local IP / port.

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
[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
the identifier of your system internally, which may not be how other systems see if you if you are behind a NAT or proxy

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetLastPing ( const AddressOrGUID systemIdentifier ) const
pure 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

Implemented in SLNet::RakPeer.

virtual const char* SLNet::RakPeerInterface::GetLocalIP ( unsigned int index )
pure virtual

Returns an IP address at index 0 to GetNumberOfAddresses-1

Parameters
[in] index index into the list of IP addresses
Returns
The local IP address at this index

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetLowestPing ( const AddressOrGUID systemIdentifier ) const
pure virtual

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

Parameters
[in] systemAddress Which system we are referring to
Returns
The lowest ping time for this system, or -1

Implemented in SLNet::RakPeer.

virtual unsigned int SLNet::RakPeerInterface::GetMaximumIncomingConnections ( void ) const
pure virtual

Returns the value passed to SetMaximumIncomingConnections()

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

Implemented in SLNet::RakPeer.

virtual unsigned int SLNet::RakPeerInterface::GetMaximumNumberOfPeers ( void ) const
pure virtual

Return the total number of connections we are allowed.

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetMTUSize ( const SystemAddress target ) const
pure virtual

Returns the current MTU size

Parameters
[in] target Which system to get this for. UNASSIGNED_SYSTEM_ADDRESS to get the default
Returns
The current MTU size

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetMyBoundAddress ( const int socketIndex = 0 )
pure virtual

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

Implemented in SLNet::RakPeer.

virtual const RakNetGUID SLNet::RakPeerInterface::GetMyGUID ( void ) const
pure virtual

Return my own GUID.

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::GetMyGUIDUnified().

virtual uint32_t SLNet::RakPeerInterface::GetNextSendReceipt ( void )
pure 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

Implemented in SLNet::RakPeer.

virtual unsigned SLNet::RakPeerInterface::GetNumberOfAddresses ( void )
pure virtual

Returns the number of IP addresses this system has internally. Get the actual addresses from GetLocalIP()

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetOfflinePingResponse | ( | char ** | data,
 |  | unsigned int * | length
 | ) |  |
pure 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

Implemented in SLNet::RakPeer.

virtual unsigned int SLNet::RakPeerInterface::GetReceiveBufferSize ( void )
pure virtual

how many messages are waiting when you call Receive()

Implemented in SLNet::RakPeer.

virtual RakNetSocket2* SLNet::RakPeerInterface::GetSocket ( const SystemAddress target )
pure virtual

Get the socket used with a particular active connection The smart pointer reference counts the RakNetSocket2 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 socket. Be sure to check IsNull() which is returned if the update thread is unresponsive, shutting down, or if this system is not connected

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetSockets ( DataStructures::List< RakNetSocket2 * > & sockets )
pure virtual

Get 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 RakNetSocket2 structures in use. Sockets will not be closed until sockets goes out of scope

Implemented in SLNet::RakPeer.

virtual int SLNet::RakPeerInterface::GetSplitMessageProgressInterval ( void ) const
pure virtual

Returns what was passed to SetSplitMessageProgressInterval()

Returns
What was passed to SetSplitMessageProgressInterval(). Default to 0.

Implemented in SLNet::RakPeer.

virtual RakNetStatistics* SLNet::RakPeerInterface::GetStatistics | ( | const SystemAddress | systemAddress,
 |  | RakNetStatistics * | rns = 0
 | ) |  |
pure 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, it will be written to it. Otherwise it will use a static struct, which is not threadsafe
Returns
0 on can't find the specified system. A pointer to a set of data otherwise.
See Also
statistics.h

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::GetStatistics | ( | const unsigned int | index,
 |  | RakNetStatistics * | rns
 | ) |  |
pure 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetStatisticsList | ( | DataStructures::List< SystemAddress > & | addresses,
 |  | DataStructures::List< RakNetGUID > & | guids,
 |  | DataStructures::List< RakNetStatistics > & | statistics
 | ) |  |
pure 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

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetSystemAddressFromGuid ( const RakNetGUID input ) const
pure virtual

Given the GUID of a connected system, give us the system address of that system. 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 you use this frequently, you may want to cache the value as it won't change. If input is UNASSIGNED_RAKNET_GUID, will return UNASSIGNED_SYSTEM_ADDRESS

Parameters
[in] input The RakNetGUID of the system we are checking to see if we are connected to

Implemented in SLNet::RakPeer.

virtual SystemAddress SLNet::RakPeerInterface::GetSystemAddressFromIndex ( unsigned int index )
pure virtual

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

Parameters
[in] index Index should range between 0 and the maximum number of players allowed - 1.
Returns
The SystemAddress

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::GetSystemList | ( | DataStructures::List< SystemAddress > & | addresses,
 |  | DataStructures::List< RakNetGUID > & | guids
 | ) |  | const
 pure 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 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.

Implemented in SLNet::RakPeer.

virtual SLNet::TimeMS SLNet::RakPeerInterface::GetTimeoutTime ( const SystemAddress target )
pure virtual
Parameters
[in] target Which system to do this for. Pass UNASSIGNED_SYSTEM_ADDRESS to get the default value
Returns
timeoutTime for a given system.

Implemented in SLNet::RakPeer.

virtual uint32_t SLNet::RakPeerInterface::IncrementNextSendReceipt ( void )
pure 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

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::InitializeSecurity | ( | const char * | publicKey,
 |  | const char * | privateKey,
 |  | bool | bRequireClientKey = false
 | ) |  |
pure 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

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::IsActive ( void ) const
pure virtual

Returns if the network thread is running

Returns
true if the network thread is running, false otherwise

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::IsBanned ( const char * IP )
pure 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.

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::IsInSecurityExceptionList ( const char * ip )
pure virtual

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

Parameters
[in] IP address to check.

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::IsLocalIP ( const char * ip )
pure virtual

Is this a local IP?

Parameters
[in] An IP address to check, excluding the port
Returns
True if this is one of the IP addresses returned by GetLocalIP

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::IsNetworkSimulatorActive ( void )
pure virtual

Returns if you previously called ApplyNetworkSimulator

Returns
If you previously called ApplyNetworkSimulator

Implemented in SLNet::RakPeer.

virtual unsigned short SLNet::RakPeerInterface::NumberOfConnections ( void ) const
pure virtual

Returns how many open connections there are at this time

Returns
the number of open connections

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::Ping ( const SystemAddress target )
pure 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

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::Ping | ( | const char * | host,
 |  | unsigned short | remotePort,
 |  | bool | onlyReplyOnAcceptingConnections,
 |  | unsigned | connectionSocketIndex = 0
 | ) |  |
pure 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)

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::PushBackPacket | ( | Packet * | packet,
 |  | bool | pushAtHead
 | ) |  |
pure virtual

Put a message back at the end of the receive queue in case you don't want to deal with it immediately

Parameters
[in] | packet | The packet you want to push back.
[in] | pushAtHead | True to push the packet so that the next receive call returns it. False to push it at the end of the queue (obviously pushing it at the end makes the packets out of order)

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::PushBackPacketUnified().

virtual Packet* SLNet::RakPeerInterface::Receive ( void )
pure 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. sa types.h contains struct Packet

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::ReleaseSockets ( DataStructures::List< RakNetSocket2 * > & sockets )
pure virtual

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::RemoveFromBanList ( const char * IP )
pure virtual

Allows a previously banned IP to connect. param[in] Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will banAll IP addresses starting with 128.0.0

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::RemoveFromSecurityExceptionList ( const char * ip )
pure 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.

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::RunUpdateCycle ( BitStream & updateBitStream )
pure virtual

Implemented in SLNet::RakPeer.

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

Sends a block of data to the specified system that you are connected to. This function only works while connected The first byte should be a message identifier starting at ID_USER_PACKET_ENUM

Parameters
[in] | data | The block of data to send
[in] | length | The size in bytes of the data to send
[in] | priority | What priority level to send on. See PacketPriority.h
[in] | reliability | How reliability to send this data. See PacketPriority.h
[in] | orderingChannel | When using ordered or sequenced messages, what 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

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::SendUnified().

virtual uint32_t SLNet::RakPeerInterface::Send | ( | const SLNet::BitStream * | bitStream,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | char | orderingChannel,
 |  | const AddressOrGUID | systemIdentifier,
 |  | bool | broadcast,
 |  | uint32_t | forceReceiptNumber = 0
 | ) |  |
pure 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 | The bitstream to send
[in] | priority | What priority level to send on. See PacketPriority.h
[in] | reliability | How reliability to send this data. See PacketPriority.h
[in] | orderingChannel | When using ordered or sequenced messages, what 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
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.

Implemented in SLNet::RakPeer.

virtual uint32_t SLNet::RakPeerInterface::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
 | ) |  |
pure 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 while 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 | What priority level to send on. See PacketPriority.h
[in] | reliability | How reliability to send this data. See PacketPriority.h
[in] | orderingChannel | When using ordered or sequenced messages, what 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

Implemented in SLNet::RakPeer.

Referenced by SLNet::PluginInterface2::SendListUnified().

virtual void SLNet::RakPeerInterface::SendLoopback | ( | const char * | data,
 |  | const int | length
 | ) |  |
pure 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 The first byte should be a message identifier starting at ID_USER_PACKET_ENUM

Parameters
[in] | data | The block of data to send
[in] | length | The size in bytes of the data to send

Implemented in SLNet::RakPeer.

virtual bool SLNet::RakPeerInterface::SendOutOfBand | ( | const char * | host,
 |  | unsigned short | remotePort,
 |  | const char * | data,
 |  | BitSize_t | dataLength,
 |  | unsigned | connectionSocketIndex = 0
 | ) |  |
pure virtual

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SendTTL | ( | const char * | host,
 |  | unsigned short | remotePort,
 |  | int | ttl,
 |  | unsigned | connectionSocketIndex = 0
 | ) |  |
pure virtual

Send a message to host, with the IP socket option TTL set to 3 This message will not reach the host, but will open the router. Used for NAT-Punchthrough

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetIncomingDatagramEventHandler ( bool(*)(RNS2RecvStruct *) _incomingDatagramEventHandler )
pure 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 If the incoming datagram is not from your game at all, it is a RakNet packet. If the incoming datagram has an IP address that matches a known address from your game, then check the first byte of data. For RakNet connected systems, the first bit is always 1. So for your own game packets, make sure the first bit is always 0.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetIncomingPassword | ( | const char * | passwordData,
 |  | int | passwordDataLength
 | ) |  |
pure virtual

Sets the password incoming connections 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

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetInternalID | ( | SystemAddress | systemAddress,
 |  | int | index = 0
 | ) |  |
pure 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?

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetLimitIPConnectionFrequency ( bool b )
pure 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetMaximumIncomingConnections ( unsigned short numberAllowed )
pure virtual

Sets how many incoming connections are allowed. If this 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetOccasionalPing ( bool doPing )
pure 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetOfflinePingResponse | ( | const char * | data,
 |  | const unsigned int | length
 | ) |  |
pure virtual

Sets the data to send along with a LAN server discovery or offline ping reply. length should be under 400 bytes, as a security measure against flood attacks

Parameters
[in] | data | a block of data to store, or 0 for none
[in] | length | The length of data in bytes, or 0 for none
See Also
Ping.cpp

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetPerConnectionOutgoingBandwidthLimit ( unsigned maxBitsPerSecond )
pure 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetSplitMessageProgressInterval ( int interval )
pure 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

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetTimeoutTime | ( | SLNet::TimeMS | timeMS,
 |  | const SystemAddress | target
 | ) |  |
pure virtual

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 | Which system to do this for. Pass UNASSIGNED_SYSTEM_ADDRESS for all systems.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetUnreliableTimeout ( SLNet::TimeMS timeoutMS )
pure 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::SetUserUpdateThread | ( | void(*)(RakPeerInterface *, void *) | _userUpdateThreadPtr,
 |  | void * | _userUpdateThreadData
 | ) |  |
pure 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

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::Shutdown | ( | unsigned int | blockDuration,
 |  | unsigned char | orderingChannel = 0,
 |  | PacketPriority | disconnectionNotificationPriority = LOW_PRIORITY
 | ) |  |
pure virtual

Connect to the specified network ID (Platform specific console function)

Does built-in NAt traversal

Parameters
[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 Stops the network threads and closes all connections.
[in] | blockDuration | How long, in milliseconds, you should wait for all remaining messages to go out, including ID_DISCONNECTION_NOTIFICATION. If 0, it doesn't wait at all.
[in] | orderingChannel | If blockDuration > 0, ID_DISCONNECTION_NOTIFICATION will be sent on this channel
[in] | disconnectionNotificationPriority | Priority to send ID_DISCONNECTION_NOTIFICATION on. If you set it to 0 then the disconnection notification won't be sent

Implemented in SLNet::RakPeer.

virtual StartupResult SLNet::RakPeerInterface::Startup | ( | unsigned int | maxConnections,
 |  | SocketDescriptor * | socketDescriptors,
 |  | unsigned | socketDescriptorCount,
 |  | int | threadPriority = -99999
 | ) |  |
pure virtual

Starts the network threads, opens the listen port.

You must call this before calling Connect().

Precondition
On the PS3, call Startup() after Client_Login()
On Android, add the necessary permission to your application's androidmanifest.xml: <uses-permission android:name="android.permission.INTERNET" /> Multiple calls while already active are ignored. To call this function again with different settings, you must first call Shutdown().
Note
Call SetMaximumIncomingConnections if you want to accept incoming connections
Parameters
[in] | maxConnections | The maximum number of connections between this instance of RakPeer and another instance of RakPeer. Required so 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.

Implemented in SLNet::RakPeer.

virtual void SLNet::RakPeerInterface::WriteOutOfBandHeader ( SLNet::BitStream * bitStream )
pure virtual

Implemented in SLNet::RakPeer.

The documentation for this class was generated from the following files:
  • Source/include/slikenet/peerinterface.h
  • Source/src/RakPeer.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::Rackspace2EventCallback Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • Rackspace2EventCallback
Public Member Functions | List of all members
SLNet::Rackspace2EventCallback Class Referenceabstract

Callback interface to receive the results of operations. More...

#include <slikenet/Rackspace.h>

+ Inheritance diagram for SLNet::Rackspace2EventCallback:

Public Member Functions

Rackspace2EventCallback ()
virtual | ~Rackspace2EventCallback ()
virtual void | OnAuthenticationResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnListServersResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnListServersWithDetailsResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnCreateServerResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnGetServerDetails (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnUpdateServerNameOrPassword (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnDeleteServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnListServerAddresses (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnShareServerAddress (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnDeleteServerAddress (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnRebootServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnRebuildServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnResizeServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnConfirmResizedServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnRevertResizedServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnListFlavorsResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnGetFlavorDetailsResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnListImagesResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnCreateImageResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnGetImageDetailsResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnDeleteImageResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnListSharedIPGroups (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnListSharedIPGroupsWithDetails (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnCreateSharedIPGroup (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnGetSharedIPGroupDetails (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnDeleteSharedIPGroup (RackspaceEventType eventType, const char *htmlAdditionalInfo)=0
virtual void | OnConnectionAttemptFailure (RackspaceOperationType operationType, const char *url)=0

Detailed Description

Callback interface to receive the results of operations.

Definition at line 96 of file Rackspace.h.

Constructor & Destructor Documentation

SLNet::Rackspace2EventCallback::Rackspace2EventCallback ( )
inline

Definition at line 99 of file Rackspace.h.

virtual SLNet::Rackspace2EventCallback::~Rackspace2EventCallback ( )
inlinevirtual

Definition at line 100 of file Rackspace.h.

Member Function Documentation

virtual void SLNet::Rackspace2EventCallback::OnAuthenticationResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnConfirmResizedServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnConnectionAttemptFailure | ( | RackspaceOperationType | operationType,
 |  | const char * | url
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnCreateImageResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnCreateServerResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnCreateSharedIPGroup | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnDeleteImageResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnDeleteServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnDeleteServerAddress | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnDeleteSharedIPGroup | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnGetFlavorDetailsResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnGetImageDetailsResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnGetServerDetails | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnGetSharedIPGroupDetails | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnListFlavorsResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnListImagesResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnListServerAddresses | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnListServersResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnListServersWithDetailsResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnListSharedIPGroups | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnListSharedIPGroupsWithDetails | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnRebootServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnRebuildServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnResizeServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnRevertResizedServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnShareServerAddress | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

virtual void SLNet::Rackspace2EventCallback::OnUpdateServerNameOrPassword | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
pure virtual

Implemented in SLNet::RackspaceEventCallback_Default.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/Rackspace.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RackspaceEventCallback_Default Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RackspaceEventCallback_Default
Public Member Functions | List of all members
SLNet::RackspaceEventCallback_Default Class Reference

Callback interface to receive the results of operations, with a default result. More...

#include <slikenet/Rackspace.h>

+ Inheritance diagram for SLNet::RackspaceEventCallback_Default:

Public Member Functions

virtual void | ExecuteDefault (const char *callbackName, RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnAuthenticationResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnListServersResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnListServersWithDetailsResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnCreateServerResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnGetServerDetails (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnUpdateServerNameOrPassword (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnDeleteServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnListServerAddresses (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnShareServerAddress (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnDeleteServerAddress (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnRebootServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnRebuildServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnResizeServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnConfirmResizedServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnRevertResizedServer (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnListFlavorsResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnGetFlavorDetailsResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnListImagesResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnCreateImageResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnGetImageDetailsResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnDeleteImageResult (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnListSharedIPGroups (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnListSharedIPGroupsWithDetails (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnCreateSharedIPGroup (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnGetSharedIPGroupDetails (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnDeleteSharedIPGroup (RackspaceEventType eventType, const char *htmlAdditionalInfo)
virtual void | OnConnectionAttemptFailure (RackspaceOperationType operationType, const char *url)
- Public Member Functions inherited from SLNet::Rackspace2EventCallback
Rackspace2EventCallback ()
virtual | ~Rackspace2EventCallback ()

Detailed Description

Callback interface to receive the results of operations, with a default result.

Definition at line 132 of file Rackspace.h.

Member Function Documentation

virtual void SLNet::RackspaceEventCallback_Default::ExecuteDefault | ( | const char * | callbackName,
 |  | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Definition at line 135 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnAuthenticationResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 137 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnConfirmResizedServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 150 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnConnectionAttemptFailure | ( | RackspaceOperationType | operationType,
 |  | const char * | url
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 164 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnCreateImageResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 155 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnCreateServerResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 140 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnCreateSharedIPGroup | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 160 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnDeleteImageResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 157 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnDeleteServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 143 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnDeleteServerAddress | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 146 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnDeleteSharedIPGroup | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 162 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnGetFlavorDetailsResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 153 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnGetImageDetailsResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 156 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnGetServerDetails | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 141 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnGetSharedIPGroupDetails | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 161 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnListFlavorsResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 152 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnListImagesResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 154 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnListServerAddresses | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 144 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnListServersResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 138 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnListServersWithDetailsResult | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 139 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnListSharedIPGroups | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 158 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnListSharedIPGroupsWithDetails | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 159 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnRebootServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 147 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnRebuildServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 148 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnResizeServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 149 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnRevertResizedServer | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 151 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnShareServerAddress | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 145 of file Rackspace.h.

virtual void SLNet::RackspaceEventCallback_Default::OnUpdateServerNameOrPassword | ( | RackspaceEventType | eventType,
 |  | const char * | htmlAdditionalInfo
 | ) |  |
inlinevirtual

Implements SLNet::Rackspace2EventCallback.

Definition at line 142 of file Rackspace.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/Rackspace.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::Rackspace Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • Rackspace
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::Rackspace Class Reference

Code that uses the TCPInterface class to communicate with the Rackspace API servers. More...

#include <slikenet/Rackspace.h>

Classes

struct RackspaceOperation

Public Member Functions

Rackspace ()
~Rackspace ()
SystemAddress | Authenticate (TCPInterface *_tcpInterface, const char *_authenticationURL, const char *_rackspaceCloudUsername, const char *_apiAccessKey)
Authenticate with Rackspace servers, required before executing any commands.
void | ListServers (void)
Get a list of running servers.
void | ListServersWithDetails (void)
Get a list of running servers, with extended details on each server.
void | CreateServer (SLNet::RakString name, SLNet::RakString imageId, SLNet::RakString flavorId)
Create a server.
void | GetServerDetails (SLNet::RakString serverId)
Get details on a particular server.
void | UpdateServerNameOrPassword (SLNet::RakString serverId, SLNet::RakString newName, SLNet::RakString newPassword)
Changes the name or password for a server.
void | DeleteServer (SLNet::RakString serverId)
Deletes a server.
void | ListServerAddresses (SLNet::RakString serverId)
Lists the IP addresses available to a server.
void | ShareServerAddress (SLNet::RakString serverId, SLNet::RakString ipAddress)
Shares an IP address with a server.
void | DeleteServerAddress (SLNet::RakString serverId, SLNet::RakString ipAddress)
Stops sharing an IP address with a server.
void | RebootServer (SLNet::RakString serverId, SLNet::RakString rebootType)
Reboots a server.
void | RebuildServer (SLNet::RakString serverId, SLNet::RakString imageId)
Rebuilds a server with a different image (harddrive contents)
void | ResizeServer (SLNet::RakString serverId, SLNet::RakString flavorId)
Changes the hardware configuration of a server. This does not take effect until you call ConfirmResizedServer()
void | ConfirmResizedServer (SLNet::RakString serverId)
Confirm a resize for the specified server.
void | RevertResizedServer (SLNet::RakString serverId)
Reverts a resize for the specified server.
void | ListFlavors (void)
List all flavors (hardware configs, primarily memory)
void | GetFlavorDetails (SLNet::RakString flavorId)
Get extended details about a specific flavor.
void | ListImages (void)
List all images (software configs, including operating systems), which includes images you create yourself.
void | CreateImage (SLNet::RakString serverId, SLNet::RakString imageName)
Images a running server. This essentially copies the harddrive, and lets you start a server with the same harddrive contents later.
void | GetImageDetails (SLNet::RakString imageId)
Get extended details about a particular image.
void | DeleteImage (SLNet::RakString imageId)
Delete a custom image created with CreateImage()
void | ListSharedIPGroups (void)
List IP groups.
void | ListSharedIPGroupsWithDetails (void)
List IP groups with extended details.
void | CreateSharedIPGroup (SLNet::RakString name, SLNet::RakString optionalServerId)
void | GetSharedIPGroupDetails (SLNet::RakString groupId)
void | DeleteSharedIPGroup (SLNet::RakString groupId)
void | AddEventCallback (Rackspace2EventCallback *callback)
Adds a callback to the list of callbacks to be called when any of the above functions finish executing The callbacks are called in the order they are added.
void | RemoveEventCallback (Rackspace2EventCallback *callback)
Removes a callback from the list of callbacks to be called when any of the above functions finish executing The callbacks are called in the order they are added.
void | ClearEventCallbacks (void)
Removes all callbacks.
void | OnReceive (Packet *packet)
Call this anytime TCPInterface returns a packet.
void | OnClosedConnection (SystemAddress systemAddress)
Call this when TCPInterface returns something other than UNASSIGNED_SYSTEM_ADDRESS from HasLostConnection()
void | AddOperation (RackspaceOperationType type, SLNet::RakString httpCommand, SLNet::RakString operation, SLNet::RakString xml)
Mostly for internal use, but you can use it to execute an operation with more complex xml if desired See the Rackspace.cpp on how to use it.

Static Public Member Functions

static const char * EventTypeToString (RackspaceEventType eventType)
String representation of each RackspaceEventType.

Protected Member Functions

bool | HasOperationOfType (RackspaceOperationType t)
unsigned int | GetOperationOfTypeIndex (RackspaceOperationType t)
bool | ExecuteOperation (RackspaceOperation &ro)
void | ReadLine (const char *data, const char *stringStart, SLNet::RakString &output)
bool | ConnectToServerManagementDomain (RackspaceOperation &ro)

Protected Attributes

DataStructures::List
< Rackspace2EventCallback * > 		eventCallbacks
TCPInterface * tcpInterface
DataStructures::List
< RackspaceOperation > 		operations
SLNet::RakString serverManagementURL
SLNet::RakString serverManagementDomain
SLNet::RakString serverManagementPath
SLNet::RakString storageURL
SLNet::RakString storageDomain
SLNet::RakString storagePath
SLNet::RakString cdnManagementURL
SLNet::RakString cdnManagementDomain
SLNet::RakString cdnManagementPath
SLNet::RakString storageToken
SLNet::RakString authToken
SLNet::RakString rackspaceCloudUsername
SLNet::RakString apiAccessKey

Detailed Description

Code that uses the TCPInterface class to communicate with the Rackspace API servers.

Precondition
Compile RakNet with OPEN_SSL_CLIENT_SUPPORT set to 1
Packets returned from TCPInterface::OnReceive() must be passed to Rackspace::OnReceive()
Packets returned from TCPInterface::HasLostConnection() must be passed to Rackspace::OnClosedConnection()

Definition at line 171 of file Rackspace.h.

Class Documentation

struct SLNet::Rackspace::RackspaceOperation

Definition at line 371 of file Rackspace.h.

Class Members
SystemAddress | connectionAddress
RakString | httpCommand
RakString | incomingStream
bool | isPendingAuthentication
RakString | operation
RackspaceOperationType | type
RakString | xml

Constructor & Destructor Documentation

SLNet::Rackspace::Rackspace ( )
SLNet::Rackspace::~Rackspace ( )

Member Function Documentation

void SLNet::Rackspace::AddEventCallback ( Rackspace2EventCallback * callback )

Adds a callback to the list of callbacks to be called when any of the above functions finish executing The callbacks are called in the order they are added.

void SLNet::Rackspace::AddOperation | ( | RackspaceOperationType | type,
 |  | SLNet::RakString | httpCommand,
 |  | SLNet::RakString | operation,
 |  | SLNet::RakString | xml
 | ) |  |

Mostly for internal use, but you can use it to execute an operation with more complex xml if desired See the Rackspace.cpp on how to use it.

SystemAddress SLNet::Rackspace::Authenticate | ( | TCPInterface * | _tcpInterface,
 |  | const char * | _authenticationURL,
 |  | const char * | _rackspaceCloudUsername,
 |  | const char * | _apiAccessKey
 | ) |  |

Authenticate with Rackspace servers, required before executing any commands.

All requests to authenticate and operate against Cloud Servers are performed using SSL over HTTP (HTTPS) on TCP port 443. Times out after 24 hours - if you get RET_Authenticate_Unauthorized in the RackspaceEventCallback callback, call again

See Also
RackspaceEventCallback::OnAuthenticationResult()
Parameters
[in] | _tcpInterface | An instance of TCPInterface, build with OPEN_SSL_CLIENT_SUPPORT 1 and already started
[in] | _authenticationURL | See http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf . US-based accounts authenticate through auth.api.rackspacecloud.com. UK-based accounts authenticate through lon.auth.api.rackspacecloud.com
[in] | _rackspaceCloudUsername | Username you registered with Rackspace on their website
[in] | _apiAccessKey | Obtain your API access key from the Rackspace Cloud Control Panel in the Your Account API Access section.
Returns
The address of the authentication server, or UNASSIGNED_SYSTEM_ADDRESS if the connection attempt failed
void SLNet::Rackspace::ClearEventCallbacks ( void )

Removes all callbacks.

void SLNet::Rackspace::ConfirmResizedServer ( SLNet::RakString serverId )

Confirm a resize for the specified server.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnConfirmResizedServerResult()
ResizeServer()
Parameters
[in] serverId Which server to operate on. You can call ListServers() to get the list of active servers.
bool SLNet::Rackspace::ConnectToServerManagementDomain ( RackspaceOperation & ro )
protected
void SLNet::Rackspace::CreateImage | ( | SLNet::RakString | serverId,
 |  | SLNet::RakString | imageName
 | ) |  |

Images a running server. This essentially copies the harddrive, and lets you start a server with the same harddrive contents later.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnCreateImageResult()
ListImages()
Parameters
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers.
[in] | imageName | What to call this image
void SLNet::Rackspace::CreateServer | ( | SLNet::RakString | name,
 |  | SLNet::RakString | imageId,
 |  | SLNet::RakString | flavorId
 | ) |  |

Create a server.

Create a server with a given image (harddrive contents) and flavor (hardware configuration) Get the available images with ListImages() Get the available flavors with ListFlavors() It is possible to configure the server in more detail. See the XML schema at http://docs.rackspacecloud.com/servers/api/v1.0 You can execute such a custom command by calling AddOperation() manually. See the implementation of CreateServer for how to do so. The server takes a while to build. Call GetServerDetails() to get the current build status. Server id to pass to GetServerDetails() is returned in the field <server ... id="1234">

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnCreateServerResult()
Parameters
[in] | name | Name of the server. Only alphanumeric characters, periods, and hyphens are valid. Server Name cannot start or end with a period or hyphen.
[in] | imageId | Which image (harddrive contents, including OS) to use
[in] | flavorId | Which flavor (hardware config) to use, primarily how much memory is available.
void SLNet::Rackspace::CreateSharedIPGroup | ( | SLNet::RakString | name,
 |  | SLNet::RakString | optionalServerId
 | ) |  |
void SLNet::Rackspace::DeleteImage ( SLNet::RakString imageId )

Delete a custom image created with CreateImage()

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnDeleteImageResult()
ListImages()
Parameters
[in] imageId Which image
void SLNet::Rackspace::DeleteServer ( SLNet::RakString serverId )

Deletes a server.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnDeleteServerResult()
Parameters
[in] serverId Which server to get details on. You can call ListServers() to get the list of active servers.
void SLNet::Rackspace::DeleteServerAddress | ( | SLNet::RakString | serverId,
 |  | SLNet::RakString | ipAddress
 | ) |  |

Stops sharing an IP address with a server.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnDeleteServerAddressResult()
Parameters
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers.
[in] | ipAddress | Which IP address. You can call ListServerAddresses() to get the list of addresses for the specified server
void SLNet::Rackspace::DeleteSharedIPGroup ( SLNet::RakString groupId )
static const char* SLNet::Rackspace::EventTypeToString ( RackspaceEventType eventType )
static

String representation of each RackspaceEventType.

bool SLNet::Rackspace::ExecuteOperation ( RackspaceOperation & ro )
protected
void SLNet::Rackspace::GetFlavorDetails ( SLNet::RakString flavorId )

Get extended details about a specific flavor.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnGetFlavorDetailsResult()
ListFlavors()
Parameters
[in] flavorId Which flavor (hardware config)
void SLNet::Rackspace::GetImageDetails ( SLNet::RakString imageId )

Get extended details about a particular image.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnGetImageDetailsResult()
ListImages()
Parameters
[in] imageId Which image
unsigned int SLNet::Rackspace::GetOperationOfTypeIndex ( RackspaceOperationType t )
protected
void SLNet::Rackspace::GetServerDetails ( SLNet::RakString serverId )

Get details on a particular server.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnGetServerDetailsResult()
Parameters
[in] serverId Which server to get details on. You can call ListServers() to get the list of active servers.
void SLNet::Rackspace::GetSharedIPGroupDetails ( SLNet::RakString groupId )
bool SLNet::Rackspace::HasOperationOfType ( RackspaceOperationType t )
protected
void SLNet::Rackspace::ListFlavors ( void )

List all flavors (hardware configs, primarily memory)

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnListFlavorsResult()
void SLNet::Rackspace::ListImages ( void )

List all images (software configs, including operating systems), which includes images you create yourself.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnListImagesResult()
CreateImage()
void SLNet::Rackspace::ListServerAddresses ( SLNet::RakString serverId )

Lists the IP addresses available to a server.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnListServerAddressesResult()
Parameters
[in] serverId Which server to operate on. You can call ListServers() to get the list of active servers.
void SLNet::Rackspace::ListServers ( void )

Get a list of running servers.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnListServersResult()
void SLNet::Rackspace::ListServersWithDetails ( void )

Get a list of running servers, with extended details on each server.

See Also
GetServerDetails()
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnListServersWithDetailsResult()
void SLNet::Rackspace::ListSharedIPGroups ( void )

List IP groups.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnListSharedIPGroupsResult()
void SLNet::Rackspace::ListSharedIPGroupsWithDetails ( void )

List IP groups with extended details.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnListSharedIPGroupsWithDetailsResult()
void SLNet::Rackspace::OnClosedConnection ( SystemAddress systemAddress )

Call this when TCPInterface returns something other than UNASSIGNED_SYSTEM_ADDRESS from HasLostConnection()

void SLNet::Rackspace::OnReceive ( Packet * packet )

Call this anytime TCPInterface returns a packet.

void SLNet::Rackspace::ReadLine | ( | const char * | data,
 |  | const char * | stringStart,
 |  | SLNet::RakString & | output
 | ) |  |
protected
void SLNet::Rackspace::RebootServer | ( | SLNet::RakString | serverId,
 |  | SLNet::RakString | rebootType
 | ) |  |

Reboots a server.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnRebootServerResult()
Parameters
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers.
[in] | rebootType | Should be either "HARD" or "SOFT"
void SLNet::Rackspace::RebuildServer | ( | SLNet::RakString | serverId,
 |  | SLNet::RakString | imageId
 | ) |  |

Rebuilds a server with a different image (harddrive contents)

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnRebuildServerResult()
Parameters
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers.
[in] | imageId | Which image (harddrive contents, including OS) to use
void SLNet::Rackspace::RemoveEventCallback ( Rackspace2EventCallback * callback )

Removes a callback from the list of callbacks to be called when any of the above functions finish executing The callbacks are called in the order they are added.

void SLNet::Rackspace::ResizeServer | ( | SLNet::RakString | serverId,
 |  | SLNet::RakString | flavorId
 | ) |  |

Changes the hardware configuration of a server. This does not take effect until you call ConfirmResizedServer()

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnResizeServerResult()
RevertResizedServer()
Parameters
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers.
[in] | flavorId | Which flavor (hardware config) to use, primarily how much memory is available.
void SLNet::Rackspace::RevertResizedServer ( SLNet::RakString serverId )

Reverts a resize for the specified server.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnRevertResizedServerResult()
ResizeServer()
Parameters
[in] serverId Which server to operate on. You can call ListServers() to get the list of active servers.
void SLNet::Rackspace::ShareServerAddress | ( | SLNet::RakString | serverId,
 |  | SLNet::RakString | ipAddress
 | ) |  |

Shares an IP address with a server.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnShareServerAddressResult()
Parameters
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers.
[in] | ipAddress | Which IP address. You can call ListServerAddresses() to get the list of addresses for the specified server
void SLNet::Rackspace::UpdateServerNameOrPassword | ( | SLNet::RakString | serverId,
 |  | SLNet::RakString | newName,
 |  | SLNet::RakString | newPassword
 | ) |  |

Changes the name or password for a server.

See Also
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnUpdateServerNameOrPasswordResult()
Parameters
[in] | serverId | Which server to get details on. You can call ListServers() to get the list of active servers.
[in] | newName | The new server name. Leave blank to leave unchanged. Only alphanumeric characters, periods, and hyphens are valid. Server Name cannot start or end with a period or hyphen.
[in] | newPassword | The new server password. Leave blank to leave unchanged.

Member Data Documentation

SLNet::RakString SLNet::Rackspace::apiAccessKey
protected

Definition at line 405 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::authToken
protected

Definition at line 403 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::cdnManagementDomain
protected

Definition at line 399 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::cdnManagementPath
protected

Definition at line 400 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::cdnManagementURL
protected

Definition at line 398 of file Rackspace.h.

DataStructures::List<Rackspace2EventCallback*> SLNet::Rackspace::eventCallbacks
protected

Definition at line 369 of file Rackspace.h.

DataStructures::List<RackspaceOperation> SLNet::Rackspace::operations
protected

Definition at line 388 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::rackspaceCloudUsername
protected

Definition at line 404 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::serverManagementDomain
protected

Definition at line 393 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::serverManagementPath
protected

Definition at line 394 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::serverManagementURL
protected

Definition at line 392 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::storageDomain
protected

Definition at line 396 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::storagePath
protected

Definition at line 397 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::storageToken
protected

Definition at line 402 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::storageURL
protected

Definition at line 395 of file Rackspace.h.

TCPInterface* SLNet::Rackspace::tcpInterface
protected

Definition at line 383 of file Rackspace.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/Rackspace.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakNetRandom Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetRandom
Public Member Functions | Protected Attributes | List of all members
SLNet::RakNetRandom Class Reference

#include <slikenet/Rand.h>

Public Member Functions

RakNetRandom ()
~RakNetRandom ()
void | SeedMT (unsigned int seed)
unsigned int | ReloadMT (void)
unsigned int | RandomMT (void)
float | FrandomMT (void)
void | FillBufferMT (void *buffer, unsigned int bytes)

Protected Attributes

unsigned int | state [624+1]
unsigned int * | next
int | left

Detailed Description

Definition at line 53 of file Rand.h.

Constructor & Destructor Documentation

RakNetRandom::RakNetRandom ( )

Definition at line 232 of file Rand.cpp.

References left.

RakNetRandom::~RakNetRandom ( )

Definition at line 236 of file Rand.cpp.

Member Function Documentation

void RakNetRandom::FillBufferMT | ( | void * | buffer,
 |  | unsigned int | bytes
 | ) |  |

Definition at line 260 of file Rand.cpp.

References fillBufferMT(), left, next, and state.

float RakNetRandom::FrandomMT ( void )

Definition at line 255 of file Rand.cpp.

References frandomMT(), left, next, and state.

unsigned int RakNetRandom::RandomMT ( void )

Definition at line 250 of file Rand.cpp.

References left, next, randomMT(), and state.

Referenced by SLNet::RakNetRandomSync::RandomMT(), and SLNet::RakNetRandomSync::Skip().

unsigned int RakNetRandom::ReloadMT ( void )

Definition at line 245 of file Rand.cpp.

References left, next, reloadMT(), and state.

void RakNetRandom::SeedMT ( unsigned int seed )

Definition at line 239 of file Rand.cpp.

References left, next, seedMT(), and state.

Referenced by SLNet::RakNetRandomSync::SeedMT(), and SLNet::RakPeer::Startup().

Member Data Documentation

int SLNet::RakNetRandom::left
protected

Definition at line 67 of file Rand.h.

Referenced by FillBufferMT(), FrandomMT(), RakNetRandom(), RandomMT(), ReloadMT(), and SeedMT().

unsigned int* SLNet::RakNetRandom::next
protected

Definition at line 66 of file Rand.h.

Referenced by FillBufferMT(), FrandomMT(), RandomMT(), ReloadMT(), and SeedMT().

unsigned int SLNet::RakNetRandom::state[624+1]
protected

Definition at line 65 of file Rand.h.

Referenced by FillBufferMT(), FrandomMT(), RandomMT(), ReloadMT(), and SeedMT().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/Rand.h
  • Source/src/Rand.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakNetRandomSync Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetRandomSync
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::RakNetRandomSync Class Reference

#include <slikenet/RandSync.h>

Public Member Functions

RakNetRandomSync ()
virtual | ~RakNetRandomSync ()
void | SeedMT (uint32_t _seed)
void | SeedMT (uint32_t _seed, uint32_t skipValues)
float | FrandomMT (void)
unsigned int | RandomMT (void)
uint32_t | GetSeed (void) const
uint32_t | GetCallCount (void) const
void | SetCallCount (uint32_t i)
virtual void | SerializeConstruction (SLNet::BitStream *constructionBitstream)
virtual bool | DeserializeConstruction (SLNet::BitStream *constructionBitstream)
virtual void | Serialize (SLNet::BitStream *outputBitstream)
virtual void | Deserialize (SLNet::BitStream *outputBitstream)

Protected Member Functions

void Skip (uint32_t count)

Protected Attributes

DataStructures::Queue
< unsigned int > 		usedValues
uint32_t seed
uint32_t callCount
uint32_t usedValueBufferCount
RakNetRandom rnr

Detailed Description

Definition at line 34 of file RandSync.h.

Constructor & Destructor Documentation

SLNet::RakNetRandomSync::RakNetRandomSync ( )

Definition at line 24 of file RandSync.cpp.

References callCount, seed, and usedValueBufferCount.

SLNet::RakNetRandomSync::~RakNetRandomSync ( )
virtual

Definition at line 30 of file RandSync.cpp.

Member Function Documentation

void SLNet::RakNetRandomSync::Deserialize ( SLNet::BitStream * outputBitstream )
virtual

Definition at line 107 of file RandSync.cpp.

References callCount, SLNet::BitStream::Read(), Skip(), and usedValueBufferCount.

bool SLNet::RakNetRandomSync::DeserializeConstruction ( SLNet::BitStream * constructionBitstream )
virtual

Definition at line 93 of file RandSync.cpp.

References SLNet::BitStream::Read(), and SeedMT().

float SLNet::RakNetRandomSync::FrandomMT ( void )

Definition at line 45 of file RandSync.cpp.

References RandomMT().

uint32_t SLNet::RakNetRandomSync::GetCallCount ( void ) const

Definition at line 80 of file RandSync.cpp.

References callCount.

uint32_t SLNet::RakNetRandomSync::GetSeed ( void ) const

Definition at line 76 of file RandSync.cpp.

References seed.

unsigned int SLNet::RakNetRandomSync::RandomMT ( void )

Definition at line 49 of file RandSync.cpp.

References _FILE_AND_LINE_, callCount, DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Push(), SLNet::RakNetRandom::RandomMT(), rnr, DataStructures::Queue< queue_type >::Size(), usedValueBufferCount, and usedValues.

Referenced by FrandomMT().

void SLNet::RakNetRandomSync::SeedMT ( uint32_t _seed )

Definition at line 33 of file RandSync.cpp.

References callCount, rnr, seed, SLNet::RakNetRandom::SeedMT(), and usedValueBufferCount.

Referenced by DeserializeConstruction(), and SeedMT().

void SLNet::RakNetRandomSync::SeedMT | ( | uint32_t | _seed,
 |  | uint32_t | skipValues
 | ) |  |

Definition at line 40 of file RandSync.cpp.

References SeedMT(), and Skip().

void SLNet::RakNetRandomSync::Serialize ( SLNet::BitStream * outputBitstream )
virtual

Definition at line 103 of file RandSync.cpp.

References callCount, and SLNet::BitStream::Write().

void SLNet::RakNetRandomSync::SerializeConstruction ( SLNet::BitStream * constructionBitstream )
virtual

Definition at line 88 of file RandSync.cpp.

References callCount, seed, and SLNet::BitStream::Write().

void SLNet::RakNetRandomSync::SetCallCount ( uint32_t i )

Definition at line 84 of file RandSync.cpp.

References callCount.

void SLNet::RakNetRandomSync::Skip ( uint32_t count )
protected

Definition at line 127 of file RandSync.cpp.

References callCount, SLNet::RakNetRandom::RandomMT(), and rnr.

Referenced by Deserialize(), and SeedMT().

Member Data Documentation

uint32_t SLNet::RakNetRandomSync::callCount
protected

Definition at line 56 of file RandSync.h.

Referenced by Deserialize(), GetCallCount(), RakNetRandomSync(), RandomMT(), SeedMT(), Serialize(), SerializeConstruction(), SetCallCount(), and Skip().

RakNetRandom SLNet::RakNetRandomSync::rnr
protected

Definition at line 58 of file RandSync.h.

Referenced by RandomMT(), SeedMT(), and Skip().

uint32_t SLNet::RakNetRandomSync::seed
protected

Definition at line 55 of file RandSync.h.

Referenced by GetSeed(), RakNetRandomSync(), SeedMT(), and SerializeConstruction().

uint32_t SLNet::RakNetRandomSync::usedValueBufferCount
protected

Definition at line 57 of file RandSync.h.

Referenced by Deserialize(), RakNetRandomSync(), RandomMT(), and SeedMT().

DataStructures::Queue<unsigned int> SLNet::RakNetRandomSync::usedValues
protected

Definition at line 54 of file RandSync.h.

Referenced by RandomMT().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/RandSync.h
  • Source/src/RandSync.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::BPSTracker Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • BPSTracker
Classes | Public Member Functions | Public Attributes | List of all members
SLNet::BPSTracker Struct Reference

#include <slikenet/ReliabilityLayer.h>

Classes

struct TimeAndValue2

Public Member Functions

BPSTracker ()
~BPSTracker ()
void | Reset (const char *file, unsigned int line)
void | Push1 (CCTimeType time, uint64_t value1)
uint64_t | GetBPS1 (CCTimeType time)
uint64_t | GetBPS1Threadsafe (CCTimeType time)
uint64_t | GetTotal1 (void) const
void | ClearExpired1 (CCTimeType time)

Public Attributes

uint64_t total1
uint64_t lastSec1
DataStructures::Queue
< TimeAndValue2 > 		dataQueue

Detailed Description

Definition at line 89 of file ReliabilityLayer.h.

Constructor & Destructor Documentation

BPSTracker::BPSTracker ( )

Definition at line 76 of file ReliabilityLayer.cpp.

References _FILE_AND_LINE_, and Reset().

BPSTracker::~BPSTracker ( )

Definition at line 77 of file ReliabilityLayer.cpp.

Member Function Documentation

void BPSTracker::ClearExpired1 ( CCTimeType time )

Definition at line 98 of file ReliabilityLayer.cpp.

References dataQueue, DataStructures::Queue< queue_type >::IsEmpty(), lastSec1, DataStructures::Queue< queue_type >::Peek(), DataStructures::Queue< queue_type >::Pop(), SLNet::BPSTracker::TimeAndValue2::time, and SLNet::BPSTracker::TimeAndValue2::value1.

uint64_t SLNet::BPSTracker::GetBPS1 ( CCTimeType time )
inline

Definition at line 96 of file ReliabilityLayer.h.

References lastSec1.

uint64_t SLNet::BPSTracker::GetBPS1Threadsafe ( CCTimeType time )
inline

Definition at line 97 of file ReliabilityLayer.h.

References lastSec1.

uint64_t BPSTracker::GetTotal1 ( void ) const

Definition at line 83 of file ReliabilityLayer.cpp.

References total1.

void SLNet::BPSTracker::Push1 | ( | CCTimeType | time,
 |  | uint64_t | value1
 | ) |  |
inline

Definition at line 94 of file ReliabilityLayer.h.

References _FILE_AND_LINE_, dataQueue, lastSec1, DataStructures::Queue< queue_type >::Push(), and total1.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::ReliabilityLayer::Send(), and SLNet::ReliabilityLayer::Update().

void BPSTracker::Reset | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 79 of file ReliabilityLayer.cpp.

References DataStructures::Queue< queue_type >::Clear(), dataQueue, lastSec1, and total1.

Referenced by BPSTracker().

Member Data Documentation

DataStructures::Queue<TimeAndValue2> SLNet::BPSTracker::dataQueue

Definition at line 116 of file ReliabilityLayer.h.

Referenced by ClearExpired1(), Push1(), and Reset().

uint64_t SLNet::BPSTracker::lastSec1

Definition at line 114 of file ReliabilityLayer.h.

Referenced by ClearExpired1(), GetBPS1(), GetBPS1Threadsafe(), Push1(), and Reset().

uint64_t SLNet::BPSTracker::total1

Definition at line 114 of file ReliabilityLayer.h.

Referenced by GetTotal1(), Push1(), and Reset().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/ReliabilityLayer.h
  • Source/src/ReliabilityLayer.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::BPSTracker::TimeAndValue2 Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • BPSTracker
  • TimeAndValue2
Public Member Functions | Public Attributes | List of all members
SLNet::BPSTracker::TimeAndValue2 Struct Reference

#include <slikenet/ReliabilityLayer.h>

Public Member Functions

TimeAndValue2 ()
~TimeAndValue2 ()
TimeAndValue2 (CCTimeType t, uint64_t v1)

Public Attributes

uint64_t value1
CCTimeType time

Detailed Description

Definition at line 103 of file ReliabilityLayer.h.

Constructor & Destructor Documentation

BPSTracker::TimeAndValue2::TimeAndValue2 ( )

Definition at line 72 of file ReliabilityLayer.cpp.

BPSTracker::TimeAndValue2::~TimeAndValue2 ( )

Definition at line 73 of file ReliabilityLayer.cpp.

BPSTracker::TimeAndValue2::TimeAndValue2 | ( | CCTimeType | t,
 |  | uint64_t | v1
 | ) |  |

Definition at line 74 of file ReliabilityLayer.cpp.

Member Data Documentation

CCTimeType SLNet::BPSTracker::TimeAndValue2::time

Definition at line 111 of file ReliabilityLayer.h.

Referenced by SLNet::BPSTracker::ClearExpired1().

uint64_t SLNet::BPSTracker::TimeAndValue2::value1

Definition at line 110 of file ReliabilityLayer.h.

Referenced by SLNet::BPSTracker::ClearExpired1().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/ReliabilityLayer.h
  • Source/src/ReliabilityLayer.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::ReliabilityLayer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • ReliabilityLayer
Classes | Public Member Functions | List of all members
SLNet::ReliabilityLayer Class Reference

Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence. More...

#include <slikenet/ReliabilityLayer.h>

Public Member Functions

ReliabilityLayer ()
~ReliabilityLayer ()
void | Reset (bool resetVariables, int MTUSize, bool _useSecurity)
Resets the layer for reuse.
void | SetTimeoutTime (SLNet::TimeMS time)
SLNet::TimeMS | GetTimeoutTime (void)
bool | HandleSocketReceiveFromConnectedPlayer (const char *buffer, unsigned int length, SystemAddress &systemAddress, DataStructures::List< PluginInterface2 * > &messageHandlerList, int MTUSize, RakNetSocket2 *s, RakNetRandom *rnr, CCTimeType timeRead, BitStream &updateBitStream)
BitSize_t | Receive (unsigned char **data)
bool | Send (char *data, BitSize_t numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, unsigned char orderingChannel, bool makeDataCopy, int MTUSize, CCTimeType currentTime, uint32_t receipt)
void | Update (RakNetSocket2 *s, SystemAddress &systemAddress, int MTUSize, CCTimeType time, unsigned bitsPerSecondLimit, DataStructures::List< PluginInterface2 * > &messageHandlerList, RakNetRandom *rnr, BitStream &updateBitStream)
bool | IsDeadConnection (void) const
void | KillConnection (void)
Causes IsDeadConnection to return true.
RakNetStatistics * | GetStatistics (RakNetStatistics *rns)
bool | IsOutgoingDataWaiting (void)
Are we waiting for any data to be sent out or be processed by the player?
bool | AreAcksWaiting (void)
void | ApplyNetworkSimulator (double _maxSendBPS, SLNet::TimeMS _minExtraPing, SLNet::TimeMS _extraPingVariance)
bool | IsNetworkSimulatorActive (void)
void | SetSplitMessageProgressInterval (int interval)
void | SetUnreliableTimeout (SLNet::TimeMS timeoutMS)
bool | AckTimeout (SLNet::Time curTime)
Has a lot of time passed since the last ack.
CCTimeType | GetNextSendTime (void) const
CCTimeType | GetTimeBetweenPackets (void) const
SLNet::TimeMS | GetTimeLastDatagramArrived (void) const

Detailed Description

Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence.

Definition at line 122 of file ReliabilityLayer.h.

Constructor & Destructor Documentation

ReliabilityLayer::ReliabilityLayer ( )

Definition at line 304 of file ReliabilityLayer.cpp.

References INTERNAL_PACKET_PAGE_SIZE.

ReliabilityLayer::~ReliabilityLayer ( )

Definition at line 337 of file ReliabilityLayer.cpp.

Member Function Documentation

bool ReliabilityLayer::AckTimeout ( SLNet::Time curTime )

Has a lot of time passed since the last ack.

Definition at line 3441 of file ReliabilityLayer.cpp.

Referenced by SLNet::RakPeer::RunUpdateCycle().

void ReliabilityLayer::ApplyNetworkSimulator | ( | double | _maxSendBPS,
 |  | SLNet::TimeMS | _minExtraPing,
 |  | SLNet::TimeMS | _extraPingVariance
 | ) |  |

Definition at line 2380 of file ReliabilityLayer.cpp.

Referenced by SLNet::RakPeer::Startup().

bool ReliabilityLayer::AreAcksWaiting ( void )

Definition at line 2375 of file ReliabilityLayer.cpp.

Referenced by SLNet::RakPeer::RunUpdateCycle().

CCTimeType ReliabilityLayer::GetNextSendTime ( void ) const

Definition at line 3448 of file ReliabilityLayer.cpp.

RakNetStatistics * ReliabilityLayer::GetStatistics ( RakNetStatistics * rns )

Get Statistics

Returns
A pointer to a static struct, filled out with current statistical information.

Definition at line 3391 of file ReliabilityLayer.cpp.

References SLNet::RakNetStatistics::BPSLimitByCongestionControl, SLNet::RakNetStatistics::BPSLimitByOutgoingBandwidthLimit, SLNet::GetTimeUS(), SLNet::RakNetStatistics::isLimitedByCongestionControl, SLNet::RakNetStatistics::isLimitedByOutgoingBandwidthLimit, SLNet::RakNetStatistics::packetlossLastSecond, SLNet::RakNetStatistics::packetlossTotal, SLNet::RNS_PER_SECOND_METRICS_COUNT, SLNet::RakNetStatistics::runningTotal, SLNet::USER_MESSAGE_BYTES_RESENT, SLNet::USER_MESSAGE_BYTES_SENT, and SLNet::RakNetStatistics::valueOverLastSecond.

Referenced by SLNet::RakPeer::GetStatistics(), and SLNet::RakPeer::RunUpdateCycle().

CCTimeType ReliabilityLayer::GetTimeBetweenPackets ( void ) const

Definition at line 3453 of file ReliabilityLayer.cpp.

SLNet::TimeMS SLNet::ReliabilityLayer::GetTimeLastDatagramArrived ( void ) const
inline

Definition at line 218 of file ReliabilityLayer.h.

SLNet::TimeMS ReliabilityLayer::GetTimeoutTime ( void )

Returns the value passed to SetTimeoutTime. or the default if it was never called

Parameters
[out] the value passed to SetTimeoutTime

Definition at line 375 of file ReliabilityLayer.cpp.

Referenced by SLNet::RakPeer::GetTimeoutTime(), and SLNet::RakPeer::RunUpdateCycle().

bool ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer | ( | const char * | buffer,
 |  | unsigned int | length,
 |  | SystemAddress & | systemAddress,
 |  | DataStructures::List< PluginInterface2 * > & | messageHandlerList,
 |  | int | MTUSize,
 |  | RakNetSocket2 * | s,
 |  | RakNetRandom * | rnr,
 |  | CCTimeType | timeRead,
 |  | BitStream & | updateBitStream
 | ) |  |

Packets are read directly from the socket layer and skip the reliability layer because unconnected players do not use the reliability layer This function takes packet data after a player has been confirmed as connected.

Parameters
[in] | buffer | The socket data
[in] | length | The length of the socket data
[in] | systemAddress | The player that this data is from
[in] | messageHandlerList | A list of registered plugins
[in] | MTUSize | maximum datagram size
Return values
true | Success
false | Modified packet

Definition at line 631 of file ReliabilityLayer.cpp.

References _FILE_AND_LINE_, SLNet::ACTUAL_BYTES_RECEIVED, BITS_TO_BYTES, BYTES_TO_BITS, SLNet::InternalPacket::data, SLNet::InternalPacketFixedSizeTransmissionHeader::dataBitLength, DEFAULT_HAS_RECEIVED_PACKET_QUEUE_SIZE, DataStructures::RangeList< range_type >::Deserialize(), SLNet::GetTimeMS(), ID_SND_RECEIPT_ACKED, ID_USER_PACKET_ENUM, if(), SLNet::BitStream::IgnoreBits(), SLNet::InternalPacket::nextActionTime, SLNet::InternalPacketFixedSizeTransmissionHeader::orderingChannel, SLNet::InternalPacketFixedSizeTransmissionHeader::orderingIndex, PRINTF_64_BIT_MODIFIER, DataStructures::List< list_type >::Push(), SLNet::BPSTracker::Push1(), RakAssert, DataStructures::RangeList< range_type >::ranges, SLNet::BitStream::Read(), SLNet::InternalPacketFixedSizeTransmissionHeader::reliability, RELIABLE, RELIABLE_ORDERED, RELIABLE_SEQUENCED, SLNet::InternalPacketFixedSizeTransmissionHeader::reliableMessageNumber, RESEND_BUFFER_ARRAY_MASK, SLNet::InternalPacketFixedSizeTransmissionHeader::sequencingIndex, DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Size(), DataStructures::List< list_type >::Size(), SLNet::InternalPacketFixedSizeTransmissionHeader::splitPacketCount, SLNet::InternalPacketFixedSizeTransmissionHeader::splitPacketId, UNRELIABLE_SEQUENCED, SLNet::USER_MESSAGE_BYTES_RECEIVED_IGNORED, SLNet::USER_MESSAGE_BYTES_RECEIVED_PROCESSED, and SLNet::uint24_t::val.

Referenced by SLNet::ProcessNetworkPacket().

bool ReliabilityLayer::IsDeadConnection ( void ) const

Were you ever unable to deliver a packet despite retries?

Returns
true means the connection has been lost. Otherwise not.

Definition at line 3374 of file ReliabilityLayer.cpp.

Referenced by SLNet::RakPeer::RunUpdateCycle().

bool SLNet::ReliabilityLayer::IsNetworkSimulatorActive ( void )

Returns if you previously called ApplyNetworkSimulator

Returns
If you previously called ApplyNetworkSimulator
bool ReliabilityLayer::IsOutgoingDataWaiting ( void )

Are we waiting for any data to be sent out or be processed by the player?

Definition at line 2358 of file ReliabilityLayer.cpp.

Referenced by SLNet::RakPeer::RunUpdateCycle().

void ReliabilityLayer::KillConnection ( void )

Causes IsDeadConnection to return true.

Definition at line 3382 of file ReliabilityLayer.cpp.

BitSize_t ReliabilityLayer::Receive ( unsigned char ** data )

This allocates bytes and writes a user-level message to those bytes.

Parameters
[out] data The message
Returns
Returns number of BITS put into the buffer

Definition at line 1523 of file ReliabilityLayer.cpp.

References SLNet::InternalPacket::data, and SLNet::InternalPacketFixedSizeTransmissionHeader::dataBitLength.

Referenced by SLNet::RakPeer::RunUpdateCycle().

void ReliabilityLayer::Reset | ( | bool | resetVariables,
 |  | int | MTUSize,
 |  | bool | _useSecurity
 | ) |  |

Resets the layer for reuse.

Definition at line 344 of file ReliabilityLayer.cpp.

References SLNet::GetTimeUS(), and UDP_HEADER_SIZE.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::CloseConnectionInternal(), and SLNet::RakPeer::Shutdown().

bool ReliabilityLayer::Send | ( | char * | data,
 |  | BitSize_t | numberOfBitsToSend,
 |  | PacketPriority | priority,
 |  | PacketReliability | reliability,
 |  | unsigned char | orderingChannel,
 |  | bool | makeDataCopy,
 |  | int | MTUSize,
 |  | CCTimeType | currentTime,
 |  | uint32_t | receipt
 | ) |  |

Puts data on the send queue

Parameters
[in] | data | The data to send
[in] | numberOfBitsToSend | The length of data in bits
[in] | priority | The priority level for the send
[in] | reliability | The reliability type for the send
[in] | orderingChannel | 0 to 31. Specifies what channel to use, for relational ordering and sequencing of packets.
[in] | makeDataCopy | If true data will be copied. Otherwise, only a pointer will be stored.
[in] | MTUSize | maximum datagram size
[in] | currentTime | Current time, as per SLNet::GetTimeMS()
[in] | receipt | 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
Returns
True or false for success or failure.

Definition at line 1555 of file ReliabilityLayer.cpp.

References _FILE_AND_LINE_, BITS_TO_BYTES, BYTES_TO_BITS, SLNet::InternalPacket::creationTime, SLNet::InternalPacket::data, SLNet::InternalPacketFixedSizeTransmissionHeader::dataBitLength, HIGH_PRIORITY, MAXIMUM_MTU_SIZE, SLNet::InternalPacket::messageInternalOrder, SLNet::InternalPacket::messageNumberAssigned, notifyOutOfMemory, NUMBER_OF_RELIABILITIES, SLNet::InternalPacketFixedSizeTransmissionHeader::orderingChannel, SLNet::InternalPacketFixedSizeTransmissionHeader::orderingIndex, SLNet::InternalPacket::priority, SLNet::BPSTracker::Push1(), RakAssert, SLNet::InternalPacketFixedSizeTransmissionHeader::reliability, RELIABLE, RELIABLE_ORDERED, RELIABLE_ORDERED_WITH_ACK_RECEIPT, RELIABLE_SEQUENCED, RELIABLE_WITH_ACK_RECEIPT, SLNet::InternalPacket::sendReceiptSerial, SLNet::InternalPacketFixedSizeTransmissionHeader::sequencingIndex, UNRELIABLE, UNRELIABLE_SEQUENCED, UNRELIABLE_WITH_ACK_RECEIPT, and SLNet::USER_MESSAGE_BYTES_PUSHED.

Referenced by SLNet::RakPeer::SendImmediate().

void ReliabilityLayer::SetSplitMessageProgressInterval ( int interval )

Definition at line 2391 of file ReliabilityLayer.cpp.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList().

void ReliabilityLayer::SetTimeoutTime ( SLNet::TimeMS time )

Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable packet Default time is 10,000 or 10 seconds in release and 30,000 or 30 seconds in debug.

Parameters
[in] time Time, in MS

Definition at line 367 of file ReliabilityLayer.cpp.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakPeer::SetTimeoutTime().

void ReliabilityLayer::SetUnreliableTimeout ( SLNet::TimeMS timeoutMS )

Definition at line 2396 of file ReliabilityLayer.cpp.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList().

void ReliabilityLayer::Update | ( | RakNetSocket2 * | s,
 |  | SystemAddress & | systemAddress,
 |  | int | MTUSize,
 |  | CCTimeType | time,
 |  | unsigned | bitsPerSecondLimit,
 |  | DataStructures::List< PluginInterface2 * > & | messageHandlerList,
 |  | RakNetRandom * | rnr,
 |  | BitStream & | updateBitStream
 | ) |  |

Call once per game cycle. Handles internal lists and actually does the send.

Parameters
[in] | s | the communication end point
[in] | systemAddress | The Unique Player Identifier who shouldhave sent some packets
[in] | MTUSize | maximum datagram size
[in] | time | current system time
[in] | maxBitsPerSecond | if non-zero, enforces that outgoing bandwidth does not exceed this amount
[in] | messageHandlerList | A list of registered plugins

Definition at line 1703 of file ReliabilityLayer.cpp.

References _FILE_AND_LINE_, BITS_TO_BYTES, BYTES_TO_BITS, CC_DEBUG_PRINTF_2, CC_TIME_TYPE_BYTES, SLNet::InternalPacket::creationTime, SLNet::RNS2_SendParameters::data, SLNet::InternalPacket::data, SLNet::InternalPacketFixedSizeTransmissionHeader::dataBitLength, SLNet::BitStream::GetNumberOfBytesUsed(), SLNet::GetTimeUS(), SLNet::InternalPacket::headerLength, ID_SND_RECEIPT_LOSS, SLNet::RNS2_SendParameters::length, MAXIMUM_MTU_SIZE, SLNet::InternalPacket::messageNumberAssigned, SLNet::InternalPacket::nextActionTime, SLNet::OP_DELETE(), SLNet::BitStream::PadWithZeroToByteLength(), SLNet::InternalPacket::priority, SLNet::BPSTracker::Push1(), RakAssert, SLNet::InternalPacketFixedSizeTransmissionHeader::reliability, RELIABLE, RELIABLE_ORDERED, RELIABLE_ORDERED_WITH_ACK_RECEIPT, RELIABLE_SEQUENCED, RELIABLE_WITH_ACK_RECEIPT, SLNet::InternalPacketFixedSizeTransmissionHeader::reliableMessageNumber, RESEND_BUFFER_ARRAY_MASK, SLNet::BitStream::Reset(), SLNet::InternalPacket::retransmissionTime, SLNet::RNS_PER_SECOND_METRICS_COUNT, SLNet::InternalPacket::sendReceiptSerial, DataStructures::List< list_type >::Size(), SLNet::RNS2_SendParameters::systemAddress, SLNet::InternalPacket::timesSent, UDP_HEADER_SIZE, UNRELIABLE, UNRELIABLE_SEQUENCED, UNRELIABLE_WITH_ACK_RECEIPT, SLNet::InternalPacket::unreliableNext, SLNet::InternalPacket::unreliablePrev, SLNet::USER_MESSAGE_BYTES_RESENT, SLNet::USER_MESSAGE_BYTES_SENT, and SLNet::uint24_t::val.

Referenced by SLNet::RakPeer::RunUpdateCycle().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/ReliabilityLayer.h
  • Source/src/ReliabilityLayer.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::PRO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • PRO
Public Member Functions | Public Attributes | List of all members
SLNet::PRO Struct Reference

#include <slikenet/ReplicaManager3.h>

Public Member Functions

bool | operator== (const PRO &right) const
bool | operator!= (const PRO &right) const

Public Attributes

PacketPriority priority
Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultPacketPriority().
PacketReliability reliability
Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultPacketReliability().
char orderingChannel
Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultOrderingChannel().
uint32_t sendReceipt
Passed to RakPeerInterface::Send(). Defaults to 0.

Detailed Description

Definition at line 53 of file ReplicaManager3.h.

Member Function Documentation

bool SLNet::PRO::operator!= ( const PRO & right ) const
bool SLNet::PRO::operator== ( const PRO & right ) const

Member Data Documentation

char SLNet::PRO::orderingChannel

Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultOrderingChannel().

Definition at line 62 of file ReplicaManager3.h.

PacketPriority SLNet::PRO::priority

Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultPacketPriority().

Definition at line 56 of file ReplicaManager3.h.

PacketReliability SLNet::PRO::reliability

Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultPacketReliability().

Definition at line 59 of file ReplicaManager3.h.

uint32_t SLNet::PRO::sendReceipt

Passed to RakPeerInterface::Send(). Defaults to 0.

Definition at line 65 of file ReplicaManager3.h.

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/ReplicaManager3.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::Replica3Composite< parent_type > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • Replica3Composite
Public Member Functions | Protected Attributes | List of all members
SLNet::Replica3Composite< parent_type > Class Template Reference

Use Replica3 through composition instead of inheritance by containing an instance of this templated class Calls to parent class for all functions Parent class must still define and functions though! More...

#include <slikenet/ReplicaManager3.h>

+ Inheritance diagram for SLNet::Replica3Composite< parent_type >:

Public Member Functions

void | SetCompositeOwner (parent_type *p)
parent_type * | GetCompositeOwner (void) const
virtual void | WriteAllocationID (SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const
Write a unique identifer that can be read on a remote system to create an object of this same class.
virtual SLNet::RM3ConstructionState | QueryConstruction (SLNet::Connection_RM3 *destinationConnection, SLNet::ReplicaManager3 *replicaManager3)
Ask if this object, which does not exist on destinationConnection should (now) be sent to that system.
virtual SLNet::RM3DestructionState | QueryDestruction (SLNet::Connection_RM3 *destinationConnection, SLNet::ReplicaManager3 *replicaManager3)
Ask if this object, which does exist on destinationConnection should be removed from the remote system.
virtual bool | QueryRemoteConstruction (SLNet::Connection_RM3 *sourceConnection)
We're about to call DeserializeConstruction() on this Replica3. If QueryRemoteConstruction() returns false, this object is deleted instead.
virtual bool | QueryRelayDestruction (SLNet::Connection_RM3 *sourceConnection) const
We got a message from a connection to destroy this replica Return true to automatically relay the destruction message to all our other connections For a client in client/server, it does not matter what this funtion returns For a server in client/server, this should normally return true For a peer in peer to peer, you can normally return false since the original destroying peer would have told all other peers about the destruction If a system gets a destruction command for an object that was already destroyed, the destruction message is ignored.
virtual void | SerializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
Write data to be sent only when the object is constructed on a remote system.
virtual bool | DeserializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
Read data written by Replica3::SerializeConstruction()
virtual void | SerializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
virtual void | DeserializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
virtual void | SerializeDestruction (SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *destinationConnection)
Write extra data to send with the object deletion event, if desired.
virtual bool | DeserializeDestruction (SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *sourceConnection)
Read data written by Replica3::SerializeDestruction()
virtual
SLNet::RM3ActionOnPopConnection 		QueryActionOnPopConnection (SLNet::Connection_RM3 *droppedConnection) const
The system is asking what to do with this replica when the connection is dropped.
virtual void | OnPoppedConnection (SLNet::Connection_RM3 *droppedConnection)
Notification called for each of our replicas when a connection is popped.
virtual void | DeallocReplica (SLNet::Connection_RM3 *sourceConnection)
Override with {delete this;}.
virtual
SLNet::RM3QuerySerializationResult 		QuerySerialization (SLNet::Connection_RM3 *destinationConnection)
Implement with QuerySerialization_ClientSerializable(), QuerySerialization_ServerSerializable(), or QuerySerialization_PeerToPeer()
virtual void | OnUserReplicaPreSerializeTick (void)
Called for each replica owned by the user, once per Serialization tick, before Serialize() is called. If you want to do some kind of operation on the Replica objects that you own, just before Serialization(), then overload this function.
virtual
SLNet::RM3SerializationResult 		Serialize (SLNet::SerializeParameters *serializeParameters)
Serialize our class to a bitstream.
virtual void | OnSerializeTransmission (SLNet::BitStream *bitStream, SLNet::Connection_RM3 *destinationConnection, SLNet::BitSize_t bitsPerChannel[SLNet::RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time curTime)
virtual void | Deserialize (SLNet::DeserializeParameters *deserializeParameters)
Read what was written in Serialize()
virtual void | PostSerializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
Called after SerializeConstruction completes for all objects in a given update tick.
Writes to PostDeserializeConstruction(), which is called after all objects are created for a given Construction tick(). Override to send data to PostDeserializeConstruction(), such as the NetworkID of other objects to resolve pointers to.
virtual void | PostDeserializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
virtual void | PostSerializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
Same as PostSerializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.
virtual void | PostDeserializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
Same as PostDeserializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.
virtual void | PreDestruction (SLNet::Connection_RM3 *sourceConnection)
- Public Member Functions inherited from SLNet::Replica3
Replica3 ()
virtual | ~Replica3 ()
virtual void | OnSerializeTransmission (SLNet::BitStream *bitStream, SLNet::Connection_RM3 *destinationConnection, BitSize_t bitsPerChannel[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time curTime)
Called when the class is actually transmitted via Serialize()
virtual RM3ConstructionState | QueryConstruction_ClientConstruction (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
Default call for QueryConstruction().
virtual bool | QueryRemoteConstruction_ClientConstruction (SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer)
virtual RM3ConstructionState | QueryConstruction_ServerConstruction (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
Default call for QueryConstruction().
virtual bool | QueryRemoteConstruction_ServerConstruction (SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer)
Default call for QueryRemoteConstruction(). Allow the server to create this object, but not the client.
virtual RM3ConstructionState | QueryConstruction_PeerToPeer (SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER)
Default call for QueryConstruction().
virtual bool | QueryRemoteConstruction_PeerToPeer (SLNet::Connection_RM3 *sourceConnection)
Default call for QueryRemoteConstruction().
virtual
SLNet::RM3QuerySerializationResult 		QuerySerialization_ClientSerializable (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
Default call for QuerySerialization().
virtual
SLNet::RM3QuerySerializationResult 		QuerySerialization_ServerSerializable (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
Default call for QuerySerialization().
virtual
SLNet::RM3QuerySerializationResult 		QuerySerialization_PeerToPeer (SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER)
Default call for QuerySerialization().
virtual RM3ActionOnPopConnection | QueryActionOnPopConnection_Client (SLNet::Connection_RM3 *droppedConnection) const
Default: If we are a client, and the connection is lost, delete the server's objects.
virtual RM3ActionOnPopConnection | QueryActionOnPopConnection_Server (SLNet::Connection_RM3 *droppedConnection) const
Default: If we are a server, and the connection is lost, delete the client's objects and broadcast the destruction.
virtual RM3ActionOnPopConnection | QueryActionOnPopConnection_PeerToPeer (SLNet::Connection_RM3 *droppedConnection) const
Default: If we are a peer, and the connection is lost, delete the peer's objects.
virtual void | BroadcastDestruction (void)
RakNetGUID | GetCreatingSystemGUID (void) const
bool | WasReferenced (void) const
- Public Member Functions inherited from SLNet::NetworkIDObject
NetworkIDObject ()
virtual | ~NetworkIDObject ()
virtual void | SetNetworkIDManager (NetworkIDManager *manager)
virtual NetworkIDManager * | GetNetworkIDManager (void) const
Returns what was passed to SetNetworkIDManager.
virtual NetworkID | GetNetworkID (void)
virtual void | SetNetworkID (NetworkID id)
virtual void | SetParent (void *_parent)
virtual void * | GetParent (void) const

Protected Attributes

parent_type * r3CompositeOwner

Additional Inherited Members

- Public Attributes inherited from SLNet::Replica3
RakNetGUID creatingSystemGUID
RakNetGUID deletingSystemGUID
GUID of the system that caused the item to send a deletion command over the network.
ReplicaManager3 * replicaManager
LastSerializationResultBS lastSentSerialization
bool forceSendUntilNextUpdate
LastSerializationResult * lsr
uint32_t referenceIndex

Detailed Description

template<class parent_type>
class SLNet::Replica3Composite< parent_type >

Use Replica3 through composition instead of inheritance by containing an instance of this templated class Calls to parent class for all functions Parent class must still define and functions though!

Precondition
Parent class must call SetCompositeOwner() on this object

Definition at line 1104 of file ReplicaManager3.h.

Member Function Documentation

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::DeallocReplica ( SLNet::Connection_RM3 * sourceConnection )
inlinevirtual

Override with {delete this;}.

  1. Got a remote message to delete this object which passed DeserializeDestruction(), OR
  2. ReplicaManager3::SetAutoManageConnections() was called autoDestroy true (which is the default setting), and a remote system that owns this object disconnected) OR <>
    Override with {delete this;} to actually delete the object (and any other processing you wish).
    If you don't want to delete the object, just do nothing, however, the system will not know this. You may wish to call Dereference() if the object should no longer be networked, but remain in memory. You are responsible for deleting it yoruself later.
    destructionBitstream may be 0 if the object was deleted locally

Implements SLNet::Replica3.

Definition at line 1124 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::Deserialize ( SLNet::DeserializeParameters * deserializeParameters )
inlinevirtual

Read what was written in Serialize()

Reads the contents of the class from SerializationParamters::serializationBitstream.
Called whenever Serialize() is called with different data from the last send.

Parameters
[in] | serializationBitstream | Bitstream passed to Serialize()
[in] | timeStamp | 0 if unused, else contains the time the message originated on the remote system
[in] | sourceConnection | Which system sent to us

Implements SLNet::Replica3.

Definition at line 1129 of file ReplicaManager3.h.

template<class parent_type >
virtual bool SLNet::Replica3Composite< parent_type >::DeserializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
inlinevirtual

Read data written by Replica3::SerializeConstruction()

Reads whatever data was written to constructionBitstream in Replica3::SerializeConstruction()

Parameters
[out] | constructionBitstream | Bitstream written to in Replica3::SerializeConstruction()
[in] | sourceConnection | System that sent us this network message.
Returns
true to accept construction of the object. false to reject, in which case the object will be deleted via Replica3::DeallocReplica()

Implements SLNet::Replica3.

Definition at line 1117 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::DeserializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
inlinevirtual

Same as DeserializeConstruction(), but for an object that already exists on the remote system. Used if you return RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction

Reimplemented from SLNet::Replica3.

Definition at line 1119 of file ReplicaManager3.h.

template<class parent_type >
virtual bool SLNet::Replica3Composite< parent_type >::DeserializeDestruction | ( | SLNet::BitStream * | destructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
inlinevirtual

Read data written by Replica3::SerializeDestruction()

Return true to delete the object. BroadcastDestruction() will be called automatically, followed by ReplicaManager3::Dereference.
Return false to not delete it. If you delete it at a later point, you are responsible for calling BroadcastDestruction() yourself.

Implements SLNet::Replica3.

Definition at line 1121 of file ReplicaManager3.h.

template<class parent_type >
parent_type* SLNet::Replica3Composite< parent_type >::GetCompositeOwner ( void ) const
inline

Definition at line 1110 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::OnPoppedConnection ( SLNet::Connection_RM3 * droppedConnection )
inlinevirtual

Notification called for each of our replicas when a connection is popped.

Reimplemented from SLNet::Replica3.

Definition at line 1123 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::OnSerializeTransmission | ( | SLNet::BitStream * | bitStream,
 |  | SLNet::Connection_RM3 * | destinationConnection,
 |  | SLNet::BitSize_t | bitsPerChannel[SLNet::RM3_NUM_OUTPUT_BITSTREAM_CHANNELS],
 |  | SLNet::Time | curTime
 | ) |  |
inlinevirtual

Definition at line 1128 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::OnUserReplicaPreSerializeTick ( void )
inlinevirtual

Called for each replica owned by the user, once per Serialization tick, before Serialize() is called. If you want to do some kind of operation on the Replica objects that you own, just before Serialization(), then overload this function.

Reimplemented from SLNet::Replica3.

Definition at line 1126 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::PostDeserializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
inlinevirtual

Called after DeserializeConstruction completes for all objects in a given update tick.
This is used to resolve dependency chains, where two objects would refer to each other in DeserializeConstruction, yet one had not been constructed yet In PostDeserializeConstruction(), you know that all objects have already been created, so can resolve NetworkIDs to pointers safely. You can also use it to trigger some sort of event when you know the object has completed deserialization.

Parameters
[in] | constructionBitstream | BitStream written in PostSerializeConstruction()
[in] | sourceConnection | System that sent us this network message.

Reimplemented from SLNet::Replica3.

Definition at line 1131 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::PostDeserializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | sourceConnection
 | ) |  |
inlinevirtual

Same as PostDeserializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.

Reimplemented from SLNet::Replica3.

Definition at line 1133 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::PostSerializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
inlinevirtual

Called after SerializeConstruction completes for all objects in a given update tick.
Writes to PostDeserializeConstruction(), which is called after all objects are created for a given Construction tick(). Override to send data to PostDeserializeConstruction(), such as the NetworkID of other objects to resolve pointers to.

Reimplemented from SLNet::Replica3.

Definition at line 1130 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::PostSerializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
inlinevirtual

Same as PostSerializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.

Reimplemented from SLNet::Replica3.

Definition at line 1132 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::PreDestruction ( SLNet::Connection_RM3 * sourceConnection )
inlinevirtual

Called after DeserializeDestruction completes for the object successfully, but obviously before the object is deleted.
Override to trigger some sort of event when you know the object has completed destruction.

Parameters
[in] sourceConnection System that sent us this network message.

Reimplemented from SLNet::Replica3.

Definition at line 1134 of file ReplicaManager3.h.

template<class parent_type >
virtual SLNet::RM3ActionOnPopConnection SLNet::Replica3Composite< parent_type >::QueryActionOnPopConnection ( SLNet::Connection_RM3 * droppedConnection ) const
inlinevirtual

The system is asking what to do with this replica when the connection is dropped.

Return QueryActionOnPopConnection_Client, QueryActionOnPopConnection_Server, or QueryActionOnPopConnection_PeerToPeer

Implements SLNet::Replica3.

Definition at line 1122 of file ReplicaManager3.h.

template<class parent_type >
virtual SLNet::RM3ConstructionState SLNet::Replica3Composite< parent_type >::QueryConstruction | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | SLNet::ReplicaManager3 * | replicaManager3
 | ) |  |
inlinevirtual

Ask if this object, which does not exist on destinationConnection should (now) be sent to that system.

If ReplicaManager3::QueryConstructionMode() returns QUERY_CONNECTION_FOR_REPLICA_LIST or QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION (default), then QueyrConstruction() is called once per tick from ReplicaManager3::Update() to determine if an object should exist on a given system.
Based on the return value, a network message may be sent to the other system to create the object.
If QueryConstructionMode() is overriden to return QUERY_CONNECTION_FOR_REPLICA_LIST, this function is unused.

Note
Defaults are provided: QueryConstruction_PeerToPeer(), QueryConstruction_ServerConstruction(), QueryConstruction_ClientConstruction(). Return one of these functions for a working default for the relevant topology.
Parameters
[in] | destinationConnection | Which system we will send to
[in] | replicaManager3 | Plugin instance for this Replica3
Returns
What action to take

Implements SLNet::Replica3.

Definition at line 1112 of file ReplicaManager3.h.

template<class parent_type >
virtual SLNet::RM3DestructionState SLNet::Replica3Composite< parent_type >::QueryDestruction | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | SLNet::ReplicaManager3 * | replicaManager3
 | ) |  |
inlinevirtual

Ask if this object, which does exist on destinationConnection should be removed from the remote system.

If ReplicaManager3::QueryConstructionMode() returns QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION (default), then QueryDestruction() is called once per tick from ReplicaManager3::Update() to determine if an object that exists on a remote system should be destroyed for a given system.
Based on the return value, a network message may be sent to the other system to destroy the object.
Note that you can also destroy objects with BroadcastDestruction(), so this function is not useful unless you plan to delete objects for only a particular connection.
If QueryConstructionMode() is overriden to return QUERY_CONNECTION_FOR_REPLICA_LIST, this function is unused.

Parameters
[in] | destinationConnection | Which system we will send to
[in] | replicaManager3 | Plugin instance for this Replica3
Returns
What action to take. Only RM3CS_SEND_DESTRUCTION does anything at this time.

Reimplemented from SLNet::Replica3.

Definition at line 1113 of file ReplicaManager3.h.

template<class parent_type >
virtual bool SLNet::Replica3Composite< parent_type >::QueryRelayDestruction ( SLNet::Connection_RM3 * sourceConnection ) const
inlinevirtual

We got a message from a connection to destroy this replica Return true to automatically relay the destruction message to all our other connections For a client in client/server, it does not matter what this funtion returns For a server in client/server, this should normally return true For a peer in peer to peer, you can normally return false since the original destroying peer would have told all other peers about the destruction If a system gets a destruction command for an object that was already destroyed, the destruction message is ignored.

Reimplemented from SLNet::Replica3.

Definition at line 1115 of file ReplicaManager3.h.

template<class parent_type >
virtual bool SLNet::Replica3Composite< parent_type >::QueryRemoteConstruction ( SLNet::Connection_RM3 * sourceConnection )
inlinevirtual

We're about to call DeserializeConstruction() on this Replica3. If QueryRemoteConstruction() returns false, this object is deleted instead.

By default, QueryRemoteConstruction_ServerConstruction() does not allow clients to create objects. The client will get Replica3::DeserializeConstructionRequestRejected().
If you want the client to be able to potentially create objects for client/server, override accordingly.
Other variants of QueryRemoteConstruction_* just return true.

Note
Defaults are provided: QueryRemoteConstruction_PeerToPeer(), QueryRemoteConstruction_ServerConstruction(), QueryRemoteConstruction_ClientConstruction(). Return one of these functions for a working default for the relevant topology.
Parameters
[in] sourceConnection Which system sent us the object creation request message.
Returns
True to allow the object to pass onto DeserializeConstruction() (where it may also be rejected), false to immediately reject the remote construction request

Implements SLNet::Replica3.

Definition at line 1114 of file ReplicaManager3.h.

template<class parent_type >
virtual SLNet::RM3QuerySerializationResult SLNet::Replica3Composite< parent_type >::QuerySerialization ( SLNet::Connection_RM3 * destinationConnection )
inlinevirtual

Implement with QuerySerialization_ClientSerializable(), QuerySerialization_ServerSerializable(), or QuerySerialization_PeerToPeer()

QuerySerialization() is a first pass query to check if a given object should serializable to a given system. The intent is that the user implements with one of the defaults for client, server, or peer to peer.
Without this function, a careless implementation would serialize an object anytime it changed to all systems. This would give you feedback loops as the sender gets the same message back from the recipient it just sent to.
If more than one system can serialize the same object then you will need to override to return true, and control the serialization result from Replica3::Serialize(). Be careful not to send back the same data to the system that just sent to you!

Returns
True to allow calling Replica3::Serialize() for this connection, false to not call.

Implements SLNet::Replica3.

Definition at line 1125 of file ReplicaManager3.h.

template<class parent_type >
virtual SLNet::RM3SerializationResult SLNet::Replica3Composite< parent_type >::Serialize ( SLNet::SerializeParameters * serializeParameters )
inlinevirtual

Serialize our class to a bitstream.

User should implement this function to write the contents of this class to SerializationParamters::serializationBitstream.
If data only needs to be written once, you can write it to SerializeConstruction() instead for efficiency.
Transmitted over the network if it changed from the last time we called Serialize().
Called every time the time interval to ReplicaManager3::SetAutoSerializeInterval() elapses and ReplicaManager3::Update is subsequently called.

Parameters
in/out] serializeParameters Parameters controlling the serialization, including destination bitstream to write to
Returns
Whether to serialize, and if so, how to optimize the results

Implements SLNet::Replica3.

Definition at line 1127 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::SerializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
inlinevirtual

Write data to be sent only when the object is constructed on a remote system.

SerializeConstruction is used to write out data that you need to create this object in the context of your game, such as health, score, name. Use it for data you only need to send when the object is created.
After SerializeConstruction() is called, Serialize() will be called immediately thereafter. However, they are sent in different messages, so Serialize() may arrive a later frame than SerializeConstruction() For that reason, the object should be valid after a call to DeserializeConstruction() for at least a short time.

Note
The object's NetworkID and allocation id are handled by the system automatically, you do not need to write these values to constructionBitstream
Parameters
[out] | constructionBitstream | Destination bitstream to write your data to
[in] | destinationConnection | System that will receive this network message.

Implements SLNet::Replica3.

Definition at line 1116 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::SerializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
inlinevirtual

Same as SerializeConstruction(), but for an object that already exists on the remote system. Used if you return RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction

Reimplemented from SLNet::Replica3.

Definition at line 1118 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::SerializeDestruction | ( | SLNet::BitStream * | destructionBitstream,
 |  | SLNet::Connection_RM3 * | destinationConnection
 | ) |  |
inlinevirtual

Write extra data to send with the object deletion event, if desired.

Replica3::SerializeDestruction() will be called to write any object destruction specific data you want to send with this event. destructionBitstream can be read in DeserializeDestruction()

Parameters
[out] | destructionBitstream | Bitstream for you to write to
[in] | destinationConnection | System that will receive this network message.

Implements SLNet::Replica3.

Definition at line 1120 of file ReplicaManager3.h.

template<class parent_type >
void SLNet::Replica3Composite< parent_type >::SetCompositeOwner ( parent_type * p )
inline

Definition at line 1109 of file ReplicaManager3.h.

template<class parent_type >
virtual void SLNet::Replica3Composite< parent_type >::WriteAllocationID | ( | SLNet::Connection_RM3 * | destinationConnection,
 |  | SLNet::BitStream * | allocationIdBitstream
 | ) |  | const
 inlinevirtual

Write a unique identifer that can be read on a remote system to create an object of this same class.

The value written to allocationIdBitstream will be passed to Connection_RM3::AllocReplica().
Sample implementation:
{allocationIdBitstream->Write(SLNet::RakString("Soldier");}

Parameters
[out] allocationIdBitstream Bitstream for the user to write to, to identify this class

Implements SLNet::Replica3.

Definition at line 1111 of file ReplicaManager3.h.

Member Data Documentation

template<class parent_type >
parent_type* SLNet::Replica3Composite< parent_type >::r3CompositeOwner
protected

Definition at line 1107 of file ReplicaManager3.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/ReplicaManager3.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::Router2DebugInterface Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • Router2DebugInterface
Public Member Functions | List of all members
SLNet::Router2DebugInterface Struct Reference

#include <slikenet/Router2.h>

Public Member Functions

Router2DebugInterface ()
virtual | ~Router2DebugInterface ()
virtual void | ShowFailure (const char *message)
virtual void | ShowDiagnostic (const char *message)

Detailed Description

Definition at line 41 of file Router2.h.

Constructor & Destructor Documentation

SLNet::Router2DebugInterface::Router2DebugInterface ( )
inline

Definition at line 43 of file Router2.h.

virtual SLNet::Router2DebugInterface::~Router2DebugInterface ( )
inlinevirtual

Definition at line 44 of file Router2.h.

Member Function Documentation

virtual void SLNet::Router2DebugInterface::ShowDiagnostic ( const char * message )
virtual
virtual void SLNet::Router2DebugInterface::ShowFailure ( const char * message )
virtual
The documentation for this struct was generated from the following file:
  • Source/include/slikenet/Router2.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RPC4GlobalRegistration Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RPC4GlobalRegistration
Public Member Functions | List of all members
SLNet::RPC4GlobalRegistration Class Reference

Instantiate this class globally if you want to register a function with RPC4 at the global space. More...

#include <slikenet/RPC4Plugin.h>

Public Member Functions

RPC4GlobalRegistration (const char *uniqueID, void(*functionPointer)(SLNet::BitStream *userData, Packet *packet))
Queue a call to RPC4::RegisterFunction() globally. Actual call occurs once RPC4 is attached to an instance of RakPeer or TCPInterface.
RPC4GlobalRegistration (const char *uniqueID, void(*functionPointer)(SLNet::BitStream *userData, Packet *packet), int callPriority)
Queue a call to RPC4::RegisterSlot() globally. Actual call occurs once RPC4 is attached to an instance of RakPeer or TCPInterface.
RPC4GlobalRegistration (const char *uniqueID, void(*functionPointer)(SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet))
Queue a call to RPC4::RegisterBlockingFunction() globally. Actual call occurs once RPC4 is attached to an instance of RakPeer or TCPInterface.
RPC4GlobalRegistration (const char *uniqueID, MessageID messageId)
Queue a call to RPC4::RegisterLocalCallback() globally. Actual call occurs once RPC4 is attached to an instance of RakPeer or TCPInterface.

Detailed Description

Instantiate this class globally if you want to register a function with RPC4 at the global space.

Definition at line 58 of file RPC4Plugin.h.

Constructor & Destructor Documentation

SLNet::RPC4GlobalRegistration::RPC4GlobalRegistration | ( | const char * | uniqueID,
 |  | void(*)(SLNet::BitStream *userData, Packet *packet) | functionPointer
 | ) |  |

Queue a call to RPC4::RegisterFunction() globally. Actual call occurs once RPC4 is attached to an instance of RakPeer or TCPInterface.

SLNet::RPC4GlobalRegistration::RPC4GlobalRegistration | ( | const char * | uniqueID,
 |  | void(*)(SLNet::BitStream *userData, Packet *packet) | functionPointer,
 |  | int | callPriority
 | ) |  |

Queue a call to RPC4::RegisterSlot() globally. Actual call occurs once RPC4 is attached to an instance of RakPeer or TCPInterface.

SLNet::RPC4GlobalRegistration::RPC4GlobalRegistration | ( | const char * | uniqueID,
 |  | void(*)(SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet) | functionPointer
 | ) |  |

Queue a call to RPC4::RegisterBlockingFunction() globally. Actual call occurs once RPC4 is attached to an instance of RakPeer or TCPInterface.

SLNet::RPC4GlobalRegistration::RPC4GlobalRegistration | ( | const char * | uniqueID,
 |  | MessageID | messageId
 | ) |  |

Queue a call to RPC4::RegisterLocalCallback() globally. Actual call occurs once RPC4 is attached to an instance of RakPeer or TCPInterface.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/RPC4Plugin.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::SignaledEvent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SignaledEvent
Public Member Functions | Protected Attributes | List of all members
SLNet::SignaledEvent Class Reference

#include <slikenet/SignaledEvent.h>

Public Member Functions

SignaledEvent ()
~SignaledEvent ()
void | InitEvent (void)
void | CloseEvent (void)
void | SetEvent (void)
void | WaitOnEvent (int timeoutMs)

Protected Attributes

SimpleMutex isSignaledMutex
bool | isSignaled
pthread_condattr_t | condAttr
pthread_cond_t | eventList
pthread_mutex_t | hMutex
pthread_mutexattr_t | mutexAttr

Detailed Description

Definition at line 41 of file SignaledEvent.h.

Constructor & Destructor Documentation

SignaledEvent::SignaledEvent ( )

Definition at line 31 of file SignaledEvent.cpp.

References eventList, and isSignaled.

SignaledEvent::~SignaledEvent ( )

Definition at line 41 of file SignaledEvent.cpp.

Member Function Documentation

void SignaledEvent::CloseEvent ( void )

Definition at line 74 of file SignaledEvent.cpp.

References condAttr, eventList, hMutex, and mutexAttr.

Referenced by SLNet::RakPeer::~RakPeer().

void SignaledEvent::InitEvent ( void )

Definition at line 46 of file SignaledEvent.cpp.

References condAttr, eventList, hMutex, and mutexAttr.

void SignaledEvent::SetEvent ( void )

Definition at line 101 of file SignaledEvent.cpp.

References eventList, isSignaled, isSignaledMutex, SLNet::SimpleMutex::Lock(), and SLNet::SimpleMutex::Unlock().

Referenced by SLNet::RakPeer::OnRNS2Recv(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBuffered(), SLNet::RakPeer::SendBufferedList(), and SLNet::RakPeer::Shutdown().

void SignaledEvent::WaitOnEvent ( int timeoutMs )

Definition at line 127 of file SignaledEvent.cpp.

References eventList, hMutex, isSignaled, isSignaledMutex, SLNet::SimpleMutex::Lock(), and SLNet::SimpleMutex::Unlock().

Referenced by for(), and RAK_THREAD_DECLARATION().

Member Data Documentation

pthread_condattr_t SLNet::SignaledEvent::condAttr
protected

Definition at line 64 of file SignaledEvent.h.

Referenced by CloseEvent(), and InitEvent().

pthread_cond_t SLNet::SignaledEvent::eventList
protected

Definition at line 66 of file SignaledEvent.h.

Referenced by CloseEvent(), InitEvent(), SetEvent(), SignaledEvent(), and WaitOnEvent().

pthread_mutex_t SLNet::SignaledEvent::hMutex
protected

Definition at line 67 of file SignaledEvent.h.

Referenced by CloseEvent(), InitEvent(), and WaitOnEvent().

bool SLNet::SignaledEvent::isSignaled
protected

Definition at line 62 of file SignaledEvent.h.

Referenced by SetEvent(), SignaledEvent(), and WaitOnEvent().

SimpleMutex SLNet::SignaledEvent::isSignaledMutex
protected

Definition at line 61 of file SignaledEvent.h.

Referenced by SetEvent(), and WaitOnEvent().

pthread_mutexattr_t SLNet::SignaledEvent::mutexAttr
protected

Definition at line 68 of file SignaledEvent.h.

Referenced by CloseEvent(), and InitEvent().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/SignaledEvent.h
  • Source/src/SignaledEvent.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::SimpleMutex Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SimpleMutex
Public Member Functions | List of all members
SLNet::SimpleMutex Class Reference

An easy to use mutex. More...

#include <slikenet/SimpleMutex.h>

Public Member Functions

SimpleMutex ()
~SimpleMutex ()
void | Lock (void)
void | Unlock (void)

Detailed Description

An easy to use mutex.

I wrote this because the version that comes with Windows is too complicated and requires too much code to use.

Remarks
Previously I used this everywhere, and in fact for a year or two RakNet was totally threadsafe. While doing profiling, I saw that this function was incredibly slow compared to the blazing performance of everything else, so switched to single producer / consumer everywhere. Now the user thread of RakNet is not threadsafe, but it's 100X faster than before.

Definition at line 45 of file SimpleMutex.h.

Constructor & Destructor Documentation

SimpleMutex::SimpleMutex ( )

Definition at line 61 of file SimpleMutex.cpp.

SimpleMutex::~SimpleMutex ( )

Definition at line 74 of file SimpleMutex.cpp.

Member Function Documentation

void SimpleMutex::Lock ( void )

Definition at line 105 of file SimpleMutex.cpp.

References RakAssert.

Referenced by SLNet::RakPeer::AddPacketToProducer(), SLNet::RakPeer::AddToBanList(), SLNet::RakPeer::AddToSecurityExceptionList(), SLNet::RakPeer::AllocPacket(), SLNet::RakPeer::AllocRNS2RecvStruct(), SLNet::RakPeer::CancelConnectionAttempt(), SLNet::RakPeer::ClearBanList(), SLNet::RakPeer::ClearBufferedPackets(), SLNet::RakPeer::ClearRequestedConnectionList(), SLNet::RakString::Clone(), SLNet::RakPeer::DeallocatePacket(), SLNet::RakPeer::DeallocRNS2RecvStruct(), for(), SLNet::RakString::Free(), SLNet::RakPeer::GetConnectionState(), SLNet::RakPeer::GetNextSendReceipt(), SLNet::RakPeer::GetOfflinePingResponse(), SLNet::RakPeer::GetReceiveBufferSize(), SLNet::RakPeer::IncrementNextSendReceipt(), SLNet::RakPeer::IsBanned(), SLNet::RakPeer::IsInSecurityExceptionList(), SLNet::RakString::LockMutex(), operator+(), SLNet::RakString::operator=(), SLNet::RakPeer::PopBufferedPacket(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::PushBackPacket(), SLNet::RakPeer::PushBufferedPacket(), SLNet::RakString::RakString(), SLNet::RakPeer::Receive(), SLNet::RakPeer::RemoveFromBanList(), SLNet::RakPeer::RemoveFromSecurityExceptionList(), SLNet::RemoteClient::Reset(), SLNet::RakPeer::ResetSendReceipt(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::Send(), SLNet::RakPeer::SendConnectionRequest(), SLNet::SignaledEvent::SetEvent(), SLNet::RakPeer::SetOfflinePingResponse(), SLNet::RakPeer::Shutdown(), and SLNet::SignaledEvent::WaitOnEvent().

void SimpleMutex::Unlock ( void )

Definition at line 154 of file SimpleMutex.cpp.

References RakAssert.

Referenced by SLNet::RakPeer::AddPacketToProducer(), SLNet::RakPeer::AddToBanList(), SLNet::RakPeer::AddToSecurityExceptionList(), SLNet::RakPeer::AllocPacket(), SLNet::RakPeer::AllocRNS2RecvStruct(), SLNet::RakPeer::CancelConnectionAttempt(), SLNet::RakPeer::ClearBanList(), SLNet::RakPeer::ClearBufferedPackets(), SLNet::RakPeer::ClearRequestedConnectionList(), SLNet::RakString::Clone(), SLNet::RakPeer::DeallocatePacket(), SLNet::RakPeer::DeallocRNS2RecvStruct(), for(), SLNet::RakString::Free(), SLNet::RakPeer::GetConnectionState(), SLNet::RakPeer::GetNextSendReceipt(), SLNet::RakPeer::GetOfflinePingResponse(), SLNet::RakPeer::GetReceiveBufferSize(), SLNet::RakPeer::IncrementNextSendReceipt(), SLNet::RakPeer::IsBanned(), SLNet::RakPeer::IsInSecurityExceptionList(), operator+(), SLNet::RakString::operator=(), SLNet::RakPeer::PopBufferedPacket(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::PushBackPacket(), SLNet::RakPeer::PushBufferedPacket(), SLNet::RakString::RakString(), SLNet::RakPeer::Receive(), SLNet::RakPeer::RemoveFromBanList(), SLNet::RakPeer::RemoveFromSecurityExceptionList(), SLNet::RemoteClient::Reset(), SLNet::RakPeer::ResetSendReceipt(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::Send(), SLNet::RakPeer::SendConnectionRequest(), SLNet::SignaledEvent::SetEvent(), SLNet::RakPeer::SetOfflinePingResponse(), SLNet::RakPeer::Shutdown(), SLNet::RakString::UnlockMutex(), and SLNet::SignaledEvent::WaitOnEvent().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/SimpleMutex.h
  • Source/src/SimpleMutex.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::ReferenceCounter Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • ReferenceCounter
Public Member Functions | List of all members
SLNet::ReferenceCounter Class Reference

#include <slikenet/smartptr.h>

Public Member Functions

ReferenceCounter ()
~ReferenceCounter ()
void | AddRef ()
int | Release ()
int | GetRefCount (void) const

Detailed Description

Definition at line 31 of file smartptr.h.

Constructor & Destructor Documentation

SLNet::ReferenceCounter::ReferenceCounter ( )
inline

Definition at line 37 of file smartptr.h.

SLNet::ReferenceCounter::~ReferenceCounter ( )
inline

Definition at line 38 of file smartptr.h.

Member Function Documentation

void SLNet::ReferenceCounter::AddRef ( void )
inline

Definition at line 39 of file smartptr.h.

int SLNet::ReferenceCounter::GetRefCount ( void ) const
inline

Definition at line 41 of file smartptr.h.

int SLNet::ReferenceCounter::Release ( )
inline

Definition at line 40 of file smartptr.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/smartptr.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakNetSmartPtr< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetSmartPtr
Public Member Functions | List of all members
SLNet::RakNetSmartPtr< T > Class Template Reference

#include <slikenet/smartptr.h>

Public Member Functions

RakNetSmartPtr ()
RakNetSmartPtr (T *pValue)
RakNetSmartPtr (const RakNetSmartPtr< T > &sp)
~RakNetSmartPtr ()
bool | IsNull (void) const
void | SetNull (void)
bool | IsUnique (void) const
void | Clone (bool copyContents)
int | GetRefCount (void) const
T & | operator* ()
const T & | operator* () const
T * | operator-> ()
const T * | operator-> () const
bool | operator== (const RakNetSmartPtr< T > &sp)
bool | operator< (const RakNetSmartPtr< T > &right)
bool | operator> (const RakNetSmartPtr< T > &right)
bool | operator!= (const RakNetSmartPtr< T > &sp)
RakNetSmartPtr< T > & | operator= (const RakNetSmartPtr< T > &sp)

Detailed Description

template<typename T>
class SLNet::RakNetSmartPtr< T >

Definition at line 44 of file smartptr.h.

Constructor & Destructor Documentation

template<typename T>
SLNet::RakNetSmartPtr< T >::RakNetSmartPtr ( )
inline

Definition at line 51 of file smartptr.h.

template<typename T>
SLNet::RakNetSmartPtr< T >::RakNetSmartPtr ( T * pValue )
inline

Definition at line 56 of file smartptr.h.

References _FILE_AND_LINE_.

template<typename T>
SLNet::RakNetSmartPtr< T >::RakNetSmartPtr ( const RakNetSmartPtr< T > & sp )
inline

Definition at line 65 of file smartptr.h.

template<typename T>
SLNet::RakNetSmartPtr< T >::~RakNetSmartPtr ( )
inline

Definition at line 71 of file smartptr.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE().

Member Function Documentation

template<typename T>
void SLNet::RakNetSmartPtr< T >::Clone ( bool copyContents )
inline

Definition at line 108 of file smartptr.h.

References _FILE_AND_LINE_.

template<typename T>
int SLNet::RakNetSmartPtr< T >::GetRefCount ( void ) const
inline

Definition at line 123 of file smartptr.h.

template<typename T>
bool SLNet::RakNetSmartPtr< T >::IsNull ( void ) const
inline

Definition at line 83 of file smartptr.h.

template<typename T>
bool SLNet::RakNetSmartPtr< T >::IsUnique ( void ) const
inline

Definition at line 102 of file smartptr.h.

template<typename T>
bool SLNet::RakNetSmartPtr< T >::operator!= ( const RakNetSmartPtr< T > & sp )
inline

Definition at line 155 of file smartptr.h.

template<typename T>
T& SLNet::RakNetSmartPtr< T >::operator* ( )
inline

Definition at line 128 of file smartptr.h.

template<typename T>
const T& SLNet::RakNetSmartPtr< T >::operator* ( ) const
inline

Definition at line 133 of file smartptr.h.

template<typename T>
T* SLNet::RakNetSmartPtr< T >::operator-> ( )
inline

Definition at line 138 of file smartptr.h.

template<typename T>
const T* SLNet::RakNetSmartPtr< T >::operator-> ( ) const
inline

Definition at line 143 of file smartptr.h.

template<typename T>
bool SLNet::RakNetSmartPtr< T >::operator< ( const RakNetSmartPtr< T > & right )
inline

Definition at line 152 of file smartptr.h.

template<typename T>
RakNetSmartPtr<T>& SLNet::RakNetSmartPtr< T >::operator= ( const RakNetSmartPtr< T > & sp )
inline

Definition at line 160 of file smartptr.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE().

template<typename T>
bool SLNet::RakNetSmartPtr< T >::operator== ( const RakNetSmartPtr< T > & sp )
inline

Definition at line 148 of file smartptr.h.

template<typename T>
bool SLNet::RakNetSmartPtr< T >::operator> ( const RakNetSmartPtr< T > & right )
inline

Definition at line 153 of file smartptr.h.

template<typename T>
void SLNet::RakNetSmartPtr< T >::SetNull ( void )
inline

Definition at line 88 of file smartptr.h.

References _FILE_AND_LINE_, and SLNet::OP_DELETE().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/smartptr.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RNS2_SendParameters Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RNS2_SendParameters
Public Member Functions | Public Attributes | List of all members
SLNet::RNS2_SendParameters Struct Reference

#include <slikenet/socket2.h>

Public Member Functions

RNS2_SendParameters ()

Public Attributes

char * | data
int | length
SystemAddress systemAddress
int | ttl

Detailed Description

Definition at line 78 of file socket2.h.

Constructor & Destructor Documentation

SLNet::RNS2_SendParameters::RNS2_SendParameters ( )
inline

Definition at line 80 of file socket2.h.

References ttl.

Member Data Documentation

char* SLNet::RNS2_SendParameters::data

Definition at line 81 of file socket2.h.

Referenced by SLNet::RNS2_Berkley::BindShared(), SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), SLNet::RakPeer::Ping(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendOutOfBand(), SLNet::RakPeer::SendTTL(), and SLNet::ReliabilityLayer::Update().

int SLNet::RNS2_SendParameters::length

Definition at line 82 of file socket2.h.

Referenced by SLNet::RNS2_Berkley::BindShared(), SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), SLNet::RakPeer::Ping(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendOutOfBand(), SLNet::RakPeer::SendTTL(), and SLNet::ReliabilityLayer::Update().

SystemAddress SLNet::RNS2_SendParameters::systemAddress

Definition at line 83 of file socket2.h.

Referenced by SLNet::RNS2_Berkley::BindShared(), SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), SLNet::RakPeer::Ping(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendOutOfBand(), SLNet::RakPeer::SendTTL(), and SLNet::ReliabilityLayer::Update().

int SLNet::RNS2_SendParameters::ttl

Definition at line 84 of file socket2.h.

Referenced by SLNet::RNS2_Berkley::BindShared(), SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), RNS2_SendParameters(), and SLNet::RakPeer::SendTTL().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/socket2.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakNetSocket2Allocator Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetSocket2Allocator
Static Public Member Functions | List of all members
SLNet::RakNetSocket2Allocator Class Reference

#include <slikenet/socket2.h>

Static Public Member Functions

static RakNetSocket2 * | AllocRNS2 (void)
static void | DeallocRNS2 (RakNetSocket2 *s)

Detailed Description

Definition at line 100 of file socket2.h.

Member Function Documentation

RakNetSocket2 * RakNetSocket2Allocator::AllocRNS2 ( void )
static

Definition at line 75 of file RakNetSocket2.cpp.

References _FILE_AND_LINE_, SLNet::RNS2T_CHROME, SLNet::RNS2T_LINUX, SLNet::RNS2T_WINDOWS, SLNet::RNS2T_WINDOWS_STORE_8, and SLNet::RakNetSocket2::SetSocketType().

Referenced by SLNet::IRNS2_Berkley::IsPortInUse(), and SLNet::RakPeer::Startup().

void RakNetSocket2Allocator::DeallocRNS2 ( RakNetSocket2 * s )
static

Definition at line 64 of file RakNetSocket2.cpp.

References _FILE_AND_LINE_, and SLNet::OP_DELETE().

Referenced by SLNet::IRNS2_Berkley::IsPortInUse(), and SLNet::RakPeer::Startup().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/socket2.h
  • Source/src/RakNetSocket2.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RNS2EventHandler Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RNS2EventHandler
Public Member Functions | List of all members
SLNet::RNS2EventHandler Class Referenceabstract

#include <slikenet/socket2.h>

+ Inheritance diagram for SLNet::RNS2EventHandler:

Public Member Functions

RNS2EventHandler ()
virtual | ~RNS2EventHandler ()
virtual void | OnRNS2Recv (RNS2RecvStruct *recvStruct)=0
virtual void | DeallocRNS2RecvStruct (RNS2RecvStruct *s, const char *file, unsigned int line)=0
virtual RNS2RecvStruct * | AllocRNS2RecvStruct (const char *file, unsigned int line)=0

Detailed Description

Definition at line 107 of file socket2.h.

Constructor & Destructor Documentation

SLNet::RNS2EventHandler::RNS2EventHandler ( )
inline

Definition at line 110 of file socket2.h.

virtual SLNet::RNS2EventHandler::~RNS2EventHandler ( )
inlinevirtual

Definition at line 111 of file socket2.h.

Member Function Documentation

virtual RNS2RecvStruct* SLNet::RNS2EventHandler::AllocRNS2RecvStruct | ( | const char * | file,
 |  | unsigned int | line
 | ) |  |
pure virtual

Implemented in SLNet::RakPeer, SLNet::NatTypeDetectionServer, and SLNet::NatTypeDetectionClient.

Referenced by SLNet::RNS2_Berkley::RecvFromLoopInt().

virtual void SLNet::RNS2EventHandler::DeallocRNS2RecvStruct | ( | RNS2RecvStruct * | s,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
pure virtual

Implemented in SLNet::RakPeer, SLNet::NatTypeDetectionServer, and SLNet::NatTypeDetectionClient.

Referenced by SLNet::RNS2_Berkley::RecvFromLoopInt().

virtual void SLNet::RNS2EventHandler::OnRNS2Recv ( RNS2RecvStruct * recvStruct )
pure virtual

Implemented in SLNet::RakPeer, SLNet::NatTypeDetectionServer, and SLNet::NatTypeDetectionClient.

Referenced by SLNet::RNS2_Berkley::RecvFromLoopInt().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/socket2.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakNetSocket2 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetSocket2
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SLNet::RakNetSocket2 Class Referenceabstract

#include <slikenet/socket2.h>

+ Inheritance diagram for SLNet::RakNetSocket2:

Public Member Functions

RakNetSocket2 ()
virtual | ~RakNetSocket2 ()
void | SetRecvEventHandler (RNS2EventHandler *_eventHandler)
virtual RNS2SendResult | Send (RNS2_SendParameters *sendParameters, const char *file, unsigned int line)=0
RNS2Type | GetSocketType (void) const
void | SetSocketType (RNS2Type t)
bool | IsBerkleySocket (void) const
SystemAddress | GetBoundAddress (void) const
unsigned int | GetUserConnectionSocketIndex (void) const
void | SetUserConnectionSocketIndex (unsigned int i)
RNS2EventHandler * | GetEventHandler (void) const

Static Public Member Functions

static void | GetMyIP (SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS])
static void | DomainNameToIP (const char *domainName, char ip[65])

Protected Attributes

RNS2EventHandler * eventHandler
RNS2Type socketType
SystemAddress boundAddress
unsigned int userConnectionSocketIndex

Detailed Description

Definition at line 123 of file socket2.h.

Constructor & Destructor Documentation

RakNetSocket2::RakNetSocket2 ( )

Definition at line 65 of file RakNetSocket2.cpp.

References eventHandler.

RakNetSocket2::~RakNetSocket2 ( )
virtual

Definition at line 66 of file RakNetSocket2.cpp.

Member Function Documentation

void RakNetSocket2::DomainNameToIP | ( | const char * | domainName,
 |  | char | ip[65]
 | ) |  |
static

Definition at line 135 of file RakNetSocket2.cpp.

Referenced by SLNet::SystemAddress::SetBinaryAddress().

SystemAddress RakNetSocket2::GetBoundAddress ( void ) const

Definition at line 73 of file RakNetSocket2.cpp.

References boundAddress.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), and SLNet::RakPeer::RunUpdateCycle().

RNS2EventHandler * RakNetSocket2::GetEventHandler ( void ) const

Definition at line 133 of file RakNetSocket2.cpp.

References eventHandler.

void RakNetSocket2::GetMyIP ( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
static

Definition at line 108 of file RakNetSocket2.cpp.

References SLNet::RNS2_Linux::GetMyIP().

Referenced by SLNet::RakPeer::FillIPList().

RNS2Type RakNetSocket2::GetSocketType ( void ) const

Definition at line 68 of file RakNetSocket2.cpp.

References socketType.

unsigned int RakNetSocket2::GetUserConnectionSocketIndex ( void ) const

Definition at line 131 of file RakNetSocket2.cpp.

References userConnectionSocketIndex.

bool RakNetSocket2::IsBerkleySocket ( void ) const

Definition at line 70 of file RakNetSocket2.cpp.

References SLNet::RNS2T_CHROME, SLNet::RNS2T_WINDOWS_STORE_8, and socketType.

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::Startup().

virtual RNS2SendResult SLNet::RakNetSocket2::Send | ( | RNS2_SendParameters * | sendParameters,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
pure virtual

Implemented in SLNet::RNS2_Linux.

Referenced by SLNet::RNS2_Berkley::BindShared(), SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakPeer::RunUpdateCycle().

void RakNetSocket2::SetRecvEventHandler ( RNS2EventHandler * _eventHandler )

Definition at line 67 of file RakNetSocket2.cpp.

References eventHandler.

void RakNetSocket2::SetSocketType ( RNS2Type t )

Definition at line 69 of file RakNetSocket2.cpp.

References socketType.

Referenced by SLNet::RakNetSocket2Allocator::AllocRNS2().

void RakNetSocket2::SetUserConnectionSocketIndex ( unsigned int i )

Definition at line 132 of file RakNetSocket2.cpp.

References userConnectionSocketIndex.

Referenced by SLNet::RakPeer::Startup().

Member Data Documentation

SystemAddress SLNet::RakNetSocket2::boundAddress
protected

Definition at line 147 of file socket2.h.

Referenced by SLNet::RNS2_Berkley::BindShared(), SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), GetBoundAddress(), and SLNet::IRNS2_Berkley::IsPortInUse().

RNS2EventHandler* SLNet::RakNetSocket2::eventHandler
protected

Definition at line 145 of file socket2.h.

Referenced by GetEventHandler(), RakNetSocket2(), SetRecvEventHandler(), and SLNet::RakPeer::Startup().

RNS2Type SLNet::RakNetSocket2::socketType
protected

Definition at line 146 of file socket2.h.

Referenced by GetSocketType(), IsBerkleySocket(), and SetSocketType().

unsigned int SLNet::RakNetSocket2::userConnectionSocketIndex
protected

Definition at line 148 of file socket2.h.

Referenced by GetUserConnectionSocketIndex(), and SetUserConnectionSocketIndex().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/socket2.h
  • Source/src/RakNetSocket2.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::IRNS2_Berkley Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • IRNS2_Berkley
Public Member Functions | Static Public Member Functions | List of all members
SLNet::IRNS2_Berkley Class Referenceabstract

#include <slikenet/socket2.h>

+ Inheritance diagram for SLNet::IRNS2_Berkley:

Public Member Functions

virtual RNS2BindResult | Bind (RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)=0
- Public Member Functions inherited from SLNet::RakNetSocket2
RakNetSocket2 ()
virtual | ~RakNetSocket2 ()
void | SetRecvEventHandler (RNS2EventHandler *_eventHandler)
virtual RNS2SendResult | Send (RNS2_SendParameters *sendParameters, const char *file, unsigned int line)=0
RNS2Type | GetSocketType (void) const
void | SetSocketType (RNS2Type t)
bool | IsBerkleySocket (void) const
SystemAddress | GetBoundAddress (void) const
unsigned int | GetUserConnectionSocketIndex (void) const
void | SetUserConnectionSocketIndex (unsigned int i)
RNS2EventHandler * | GetEventHandler (void) const

Static Public Member Functions

static bool | IsPortInUse (unsigned short port, const char *hostAddress, unsigned short addressFamily, int type)
- Static Public Member Functions inherited from SLNet::RakNetSocket2
static void | GetMyIP (SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS])
static void | DomainNameToIP (const char *domainName, char ip[65])

Additional Inherited Members

- Protected Attributes inherited from SLNet::RakNetSocket2
RNS2EventHandler * eventHandler
RNS2Type socketType
SystemAddress boundAddress
unsigned int userConnectionSocketIndex

Detailed Description

Definition at line 283 of file socket2.h.

Member Function Documentation

virtual RNS2BindResult SLNet::IRNS2_Berkley::Bind | ( | RNS2_BerkleyBindParameters * | bindParameters,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
pure virtual

Implemented in SLNet::RNS2_Linux.

Referenced by IsPortInUse().

bool IRNS2_Berkley::IsPortInUse | ( | unsigned short | port,
 |  | const char * | hostAddress,
 |  | unsigned short | addressFamily,
 |  | int | type
 | ) |  |
static

Definition at line 287 of file RakNetSocket2.cpp.

References _FILE_AND_LINE_, SLNet::RNS2_BerkleyBindParameters::addressFamily, SLNet::RakNetSocket2Allocator::AllocRNS2(), Bind(), SLNet::RakNetSocket2::boundAddress, SLNet::BR_FAILED_TO_BIND_SOCKET, SLNet::RakNetSocket2Allocator::DeallocRNS2(), SLNet::RNS2_BerkleyBindParameters::doNotFragment, SLNet::RNS2_BerkleyBindParameters::hostAddress, SLNet::RNS2_BerkleyBindParameters::nonBlockingSocket, SLNet::RNS2_BerkleyBindParameters::port, SLNet::RNS2_BerkleyBindParameters::protocol, SLNet::RNS2_BerkleyBindParameters::remotePortRakNetWasStartedOn_PS3_PS4_PSP2, SLNet::RNS2_BerkleyBindParameters::setBroadcast, SLNet::RNS2_BerkleyBindParameters::setIPHdrIncl, and SLNet::RNS2_BerkleyBindParameters::type.

The documentation for this class was generated from the following files:
  • Source/include/slikenet/socket2.h
  • Source/src/RakNetSocket2.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RNS2_Berkley Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RNS2_Berkley
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
SLNet::RNS2_Berkley Class Reference

#include <slikenet/socket2.h>

+ Inheritance diagram for SLNet::RNS2_Berkley:

Public Member Functions

RNS2_Berkley ()
virtual | ~RNS2_Berkley ()
int | CreateRecvPollingThread (int threadPriority)
void | SignalStopRecvPollingThread (void)
void | BlockOnStopRecvPollingThread (void)
const RNS2_BerkleyBindParameters * | GetBindings (void) const
RNS2Socket | GetSocket (void) const
void | SetDoNotFragment (int opt)
- Public Member Functions inherited from SLNet::IRNS2_Berkley
virtual RNS2BindResult | Bind (RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)=0
- Public Member Functions inherited from SLNet::RakNetSocket2
RakNetSocket2 ()
virtual | ~RakNetSocket2 ()
void | SetRecvEventHandler (RNS2EventHandler *_eventHandler)
virtual RNS2SendResult | Send (RNS2_SendParameters *sendParameters, const char *file, unsigned int line)=0
RNS2Type | GetSocketType (void) const
void | SetSocketType (RNS2Type t)
bool | IsBerkleySocket (void) const
SystemAddress | GetBoundAddress (void) const
unsigned int | GetUserConnectionSocketIndex (void) const
void | SetUserConnectionSocketIndex (unsigned int i)
RNS2EventHandler * | GetEventHandler (void) const

Protected Member Functions

RNS2BindResult | BindShared (RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)
RNS2BindResult | BindSharedIPV4 (RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)
RNS2BindResult | BindSharedIPV4And6 (RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)
void | SetNonBlockingSocket (unsigned long nonblocking)
void | SetSocketOptions (void)
void | SetBroadcastSocket (int broadcast)
void | SetIPHdrIncl (int ipHdrIncl)
void | RecvFromBlocking (RNS2RecvStruct *recvFromStruct)
void | RecvFromBlockingIPV4 (RNS2RecvStruct *recvFromStruct)
void | RecvFromBlockingIPV4And6 (RNS2RecvStruct *recvFromStruct)
unsigned | RecvFromLoopInt (void)

Static Protected Member Functions

static void | GetSystemAddressIPV4 (RNS2Socket rns2Socket, SystemAddress *systemAddressOut)
static void | GetSystemAddressIPV4And6 (RNS2Socket rns2Socket, SystemAddress *systemAddressOut)
static | RAK_THREAD_DECLARATION (RecvFromLoop)

Protected Attributes

RNS2Socket rns2Socket
RNS2_BerkleyBindParameters binding
SLNet::LocklessUint32_t isRecvFromLoopThreadActive
volatile bool endThreads

Additional Inherited Members

- Static Public Member Functions inherited from SLNet::IRNS2_Berkley
static bool IsPortInUse (unsigned short port, const char *hostAddress, unsigned short addressFamily, int type)

Detailed Description

Definition at line 295 of file socket2.h.

Constructor & Destructor Documentation

RNS2_Berkley::RNS2_Berkley ( )

Definition at line 384 of file RakNetSocket2.cpp.

References INVALID_SOCKET, and rns2Socket.

RNS2_Berkley::~RNS2_Berkley ( )
virtual

Definition at line 388 of file RakNetSocket2.cpp.

References closesocket__, INVALID_SOCKET, and rns2Socket.

Member Function Documentation

RNS2BindResult RNS2_Berkley::BindShared | ( | RNS2_BerkleyBindParameters * | bindParameters,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
protected

Definition at line 308 of file RakNetSocket2.cpp.

References _FILE_AND_LINE_, binding, BindSharedIPV4(), BindSharedIPV4And6(), SLNet::RakNetSocket2::boundAddress, SLNet::BR_FAILED_SEND_TEST, SLNet::BR_SUCCESS, SLNet::RNS2_SendParameters::data, SLNet::RNS2_SendParameters::length, SLNet::RakNetSocket2::Send(), SLNet::RNS2_SendParameters::systemAddress, and SLNet::RNS2_SendParameters::ttl.

Referenced by SLNet::RNS2_Linux::Bind().

RNS2BindResult SLNet::RNS2_Berkley::BindSharedIPV4 | ( | RNS2_BerkleyBindParameters * | bindParameters,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
protected

Referenced by BindShared().

RNS2BindResult SLNet::RNS2_Berkley::BindSharedIPV4And6 | ( | RNS2_BerkleyBindParameters * | bindParameters,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
protected

Referenced by BindShared().

void RNS2_Berkley::BlockOnStopRecvPollingThread ( void )

Definition at line 419 of file RakNetSocket2.cpp.

References _FILE_AND_LINE_, SLNet::RakNetSocket2::boundAddress, SLNet::RNS2_SendParameters::data, endThreads, SLNet::GetTimeMS(), SLNet::LocklessUint32_t::GetValue(), isRecvFromLoopThreadActive, SLNet::RNS2_SendParameters::length, RakSleep(), SLNet::RakNetSocket2::Send(), SLNet::RNS2_SendParameters::systemAddress, and SLNet::RNS2_SendParameters::ttl.

int RNS2_Berkley::CreateRecvPollingThread ( int threadPriority )

Definition at line 402 of file RakNetSocket2.cpp.

References SLNet::RakThread::Create(), and endThreads.

const RNS2_BerkleyBindParameters * RNS2_Berkley::GetBindings ( void ) const

Definition at line 440 of file RakNetSocket2.cpp.

References binding.

RNS2Socket RNS2_Berkley::GetSocket ( void ) const

Definition at line 441 of file RakNetSocket2.cpp.

References rns2Socket.

static void SLNet::RNS2_Berkley::GetSystemAddressIPV4 | ( | RNS2Socket | rns2Socket,
 |  | SystemAddress * | systemAddressOut
 | ) |  |
staticprotected
static void SLNet::RNS2_Berkley::GetSystemAddressIPV4And6 | ( | RNS2Socket | rns2Socket,
 |  | SystemAddress * | systemAddressOut
 | ) |  |
staticprotected
static SLNet::RNS2_Berkley::RAK_THREAD_DECLARATION ( RecvFromLoop )
staticprotected
void SLNet::RNS2_Berkley::RecvFromBlocking ( RNS2RecvStruct * recvFromStruct )
protected

Referenced by RecvFromLoopInt().

void SLNet::RNS2_Berkley::RecvFromBlockingIPV4 ( RNS2RecvStruct * recvFromStruct )
protected
void SLNet::RNS2_Berkley::RecvFromBlockingIPV4And6 ( RNS2RecvStruct * recvFromStruct )
protected
unsigned RNS2_Berkley::RecvFromLoopInt ( void )
protected

Definition at line 351 of file RakNetSocket2.cpp.

References _FILE_AND_LINE_, SLNet::RNS2EventHandler::AllocRNS2RecvStruct(), binding, SLNet::RNS2RecvStruct::bytesRead, SLNet::RNS2EventHandler::DeallocRNS2RecvStruct(), SLNet::LocklessUint32_t::Decrement(), endThreads, SLNet::RNS2_BerkleyBindParameters::eventHandler, SLNet::SystemAddress::GetPort(), SLNet::LocklessUint32_t::Increment(), isRecvFromLoopThreadActive, SLNet::RNS2EventHandler::OnRNS2Recv(), RakAssert, RakSleep(), RecvFromBlocking(), SLNet::RNS2RecvStruct::socket, and SLNet::RNS2RecvStruct::systemAddress.

Referenced by RAK_THREAD_DECLARATION().

void SLNet::RNS2_Berkley::SetBroadcastSocket ( int broadcast )
protected
void SLNet::RNS2_Berkley::SetDoNotFragment ( int opt )
void SLNet::RNS2_Berkley::SetIPHdrIncl ( int ipHdrIncl )
protected
void SLNet::RNS2_Berkley::SetNonBlockingSocket ( unsigned long nonblocking )
protected
void SLNet::RNS2_Berkley::SetSocketOptions ( void )
protected
void RNS2_Berkley::SignalStopRecvPollingThread ( void )

Definition at line 415 of file RakNetSocket2.cpp.

References endThreads.

Member Data Documentation

RNS2_BerkleyBindParameters SLNet::RNS2_Berkley::binding
protected

Definition at line 326 of file socket2.h.

Referenced by BindShared(), GetBindings(), and RecvFromLoopInt().

volatile bool SLNet::RNS2_Berkley::endThreads
protected

Definition at line 330 of file socket2.h.

Referenced by BlockOnStopRecvPollingThread(), CreateRecvPollingThread(), RecvFromLoopInt(), and SignalStopRecvPollingThread().

SLNet::LocklessUint32_t SLNet::RNS2_Berkley::isRecvFromLoopThreadActive
protected

Definition at line 329 of file socket2.h.

Referenced by BlockOnStopRecvPollingThread(), and RecvFromLoopInt().

RNS2Socket SLNet::RNS2_Berkley::rns2Socket
protected

Definition at line 325 of file socket2.h.

Referenced by GetSocket(), RNS2_Berkley(), SLNet::RNS2_Linux::Send(), and ~RNS2_Berkley().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/socket2.h
  • Source/src/RakNetSocket2.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RNS2_Linux Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RNS2_Linux
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
SLNet::RNS2_Linux Class Reference

#include <slikenet/socket2.h>

+ Inheritance diagram for SLNet::RNS2_Linux:

Public Member Functions

RNS2BindResult | Bind (RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)
RNS2SendResult | Send (RNS2_SendParameters *sendParameters, const char *file, unsigned int line)
- Public Member Functions inherited from SLNet::RNS2_Berkley
RNS2_Berkley ()
virtual | ~RNS2_Berkley ()
int | CreateRecvPollingThread (int threadPriority)
void | SignalStopRecvPollingThread (void)
void | BlockOnStopRecvPollingThread (void)
const RNS2_BerkleyBindParameters * | GetBindings (void) const
RNS2Socket | GetSocket (void) const
void | SetDoNotFragment (int opt)

Static Public Member Functions

static void GetMyIP (SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS])

Static Protected Member Functions

static void | GetMyIPIPV4 (SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS])
static void | GetMyIPIPV4And6 (SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS])
- Static Protected Member Functions inherited from SLNet::RNS2_Berkley
static void | GetSystemAddressIPV4 (RNS2Socket rns2Socket, SystemAddress *systemAddressOut)
static void | GetSystemAddressIPV4And6 (RNS2Socket rns2Socket, SystemAddress *systemAddressOut)
static | RAK_THREAD_DECLARATION (RecvFromLoop)

Additional Inherited Members

- Protected Member Functions inherited from SLNet::RNS2_Berkley
RNS2BindResult | BindShared (RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)
RNS2BindResult | BindSharedIPV4 (RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)
RNS2BindResult | BindSharedIPV4And6 (RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)
void | SetNonBlockingSocket (unsigned long nonblocking)
void | SetSocketOptions (void)
void | SetBroadcastSocket (int broadcast)
void | SetIPHdrIncl (int ipHdrIncl)
void | RecvFromBlocking (RNS2RecvStruct *recvFromStruct)
void | RecvFromBlockingIPV4 (RNS2RecvStruct *recvFromStruct)
void | RecvFromBlockingIPV4And6 (RNS2RecvStruct *recvFromStruct)
unsigned | RecvFromLoopInt (void)
- Protected Attributes inherited from SLNet::RNS2_Berkley
RNS2Socket rns2Socket
RNS2_BerkleyBindParameters binding
SLNet::LocklessUint32_t isRecvFromLoopThreadActive
volatile bool | endThreads

Detailed Description

Definition at line 444 of file socket2.h.

Member Function Documentation

RNS2BindResult RNS2_Linux::Bind | ( | RNS2_BerkleyBindParameters * | bindParameters,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
virtual

Implements SLNet::IRNS2_Berkley.

Definition at line 513 of file RakNetSocket2.cpp.

References SLNet::RNS2_Berkley::BindShared().

void RNS2_Linux::GetMyIP ( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
static

Definition at line 515 of file RakNetSocket2.cpp.

Referenced by SLNet::RakNetSocket2::GetMyIP().

static void SLNet::RNS2_Linux::GetMyIPIPV4 ( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
staticprotected
static void SLNet::RNS2_Linux::GetMyIPIPV4And6 ( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
staticprotected
RNS2SendResult RNS2_Linux::Send | ( | RNS2_SendParameters * | sendParameters,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |
virtual

Implements SLNet::RakNetSocket2.

Definition at line 514 of file RakNetSocket2.cpp.

References SLNet::RNS2_Berkley::rns2Socket.

The documentation for this class was generated from the following files:
  • Source/include/slikenet/socket2.h
  • Source/src/RakNetSocket2.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::SocketLayer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SocketLayer
Public Member Functions | Static Public Member Functions | List of all members
SLNet::SocketLayer Class Reference

#include <slikenet/SocketLayer.h>

Public Member Functions

SocketLayer ()
Default Constructor.
~SocketLayer ()

Static Public Member Functions

static SLNet::RakString | GetSubNetForSocketAndIp (__UDPSOCKET__ inSock, SLNet::RakString inIpString)
static void | GetMyIP (SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS])
static unsigned short | GetLocalPort (__UDPSOCKET__ s)
static void | GetSystemAddress_Old (__UDPSOCKET__ s, SystemAddress *systemAddressOut)
static void | GetSystemAddress (__UDPSOCKET__ s, SystemAddress *systemAddressOut)
static void | SetSocketOptions (__UDPSOCKET__ listenSocket, bool blockingSocket, bool setBroadcast)
static bool | GetFirstBindableIP (char firstBindable[128], int ipProto)

Detailed Description

Definition at line 58 of file SocketLayer.h.

Constructor & Destructor Documentation

SLNet::SocketLayer::SocketLayer ( )

Default Constructor.

SLNet::SocketLayer::~SocketLayer ( )

Member Function Documentation

bool SocketLayer::GetFirstBindableIP | ( | char | firstBindable[128],
 |  | int | ipProto
 | ) |  |
static

Definition at line 592 of file SocketLayer.cpp.

References GetMyIP(), MAXIMUM_NUMBER_OF_INTERNAL_IDS, SLNet::SystemAddress::ToString(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

unsigned short SocketLayer::GetLocalPort ( __UDPSOCKET__ s )
static

Call sendto (UDP obviously)

Parameters
[in] | s | the socket
[in] | data | The byte buffer to send
[in] | length | The length of the data in bytes
[in] | ip | The address of the remote host in dotted notation.
[in] | port | The port number to send to.
Returns
0 on success, nonzero on failure. Call sendto' (UDP obviously) It won't reach the recipient, except on a LAN However, this is good for opening routers / firewalls
Parameters
[in] | s | the socket
[in] | data | The byte buffer to send
[in] | length | The length of the data in bytes
[in] | ip | The address of the remote host in dotted notation.
[in] | port | The port number to send to.
[in] | ttl | Max hops of datagram
Returns
0 on success, nonzero on failure. Call sendto (UDP obviously)
Parameters
[in] | s | the socket
[in] | data | The byte buffer to send
[in] | length | The length of the data in bytes
[in] | binaryAddress | The address of the remote host in binary format.
[in] | port | The port number to send to.
Returns
0 on success, nonzero on failure.

Definition at line 487 of file SocketLayer.cpp.

References SLNet::SystemAddress::GetPort(), and GetSystemAddress().

void SocketLayer::GetMyIP ( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
static

Sets the socket flags to nonblocking

Parameters
[in] | listenSocket | the socket to set Retrieve all local IP address in a string format.
[in] | s | The socket whose port we are referring to
[in] | ipList | An array of ip address in dotted notation.

Definition at line 460 of file SocketLayer.cpp.

References GetMyIP_Win32().

Referenced by GetFirstBindableIP().

SLNet::RakString SocketLayer::GetSubNetForSocketAndIp | ( | __UDPSOCKET__ | inSock,
 |  | SLNet::RakString | inIpString
 | ) |  |
static

Write data of length length to writeSocket

Parameters
[in] | writeSocket | The socket to write to
[in] | data | The data to write
[in] | length | The length of data Read data from a socket
[in] | s | the socket
[in] | rakPeer | The instance of rakPeer containing the recvFrom C callback
[in] | errorCode | An error code if an error occured .
[in] | connectionSocketIndex | Which of the sockets in RakPeer we are using
Returns
Returns true if you successfully read data, false on error. Given a socket and IP, retrieves the subnet mask, on linux the socket is unused
Parameters
[in] | inSock | the socket
[in] | inIpString | The ip of the interface you wish to retrieve the subnet mask from
Returns
Returns the ip dotted subnet mask if successful, otherwise returns empty string ("")

Definition at line 195 of file SocketLayer.cpp.

References RakAssert, and socket__.

void SocketLayer::GetSystemAddress | ( | __UDPSOCKET__ | s,
 |  | SystemAddress * | systemAddressOut
 | ) |  |
static

Definition at line 529 of file SocketLayer.cpp.

References _T, SLNet::SystemAddress::address, SLNet::SystemAddress::debugPort, SLNet::SystemAddress::FromString(), getsockname__, GetSystemAddress_Old(), RAKNET_DEBUG_TPRINTF, and SLNet::SystemAddress::SetToLoopback().

Referenced by GetLocalPort().

void SocketLayer::GetSystemAddress_Old | ( | __UDPSOCKET__ | s,
 |  | SystemAddress * | systemAddressOut
 | ) |  |
static

Definition at line 493 of file SocketLayer.cpp.

References _T, SLNet::SystemAddress::address, getsockname__, RAKNET_DEBUG_TPRINTF, SLNet::SystemAddress::SetPortNetworkOrder(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by GetSystemAddress().

void SocketLayer::SetSocketOptions | ( | __UDPSOCKET__ | listenSocket,
 |  | bool | blockingSocket,
 |  | bool | setBroadcast
 | ) |  |
static

Definition at line 125 of file SocketLayer.cpp.

References _T, ioctlsocket__, RAKNET_DEBUG_TPRINTF, and setsockopt__.

The documentation for this class was generated from the following files:
  • Source/include/slikenet/SocketLayer.h
  • Source/src/SocketLayer.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakNetStatistics Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetStatistics
Public Member Functions | Public Attributes | List of all members
SLNet::RakNetStatistics Struct Reference

Network Statisics Usage. More...

#include <slikenet/statistics.h>

Public Member Functions

RakNetStatistics & operator+= (const RakNetStatistics &other)

Public Attributes

uint64_t valueOverLastSecond [RNS_PER_SECOND_METRICS_COUNT]
For each type in RNSPerSecondMetrics, what is the value over the last 1 second?
uint64_t runningTotal [RNS_PER_SECOND_METRICS_COUNT]
For each type in RNSPerSecondMetrics, what is the total value over the lifetime of the connection?
SLNet::TimeUS connectionStartTime
bool | isLimitedByCongestionControl
uint64_t BPSLimitByCongestionControl
If isLimitedByCongestionControl is true, what is the limit, in bytes per second?
bool | isLimitedByOutgoingBandwidthLimit
Is our current send rate throttled by a call to RakPeer::SetPerConnectionOutgoingBandwidthLimit()?
uint64_t BPSLimitByOutgoingBandwidthLimit
If isLimitedByOutgoingBandwidthLimit is true, what is the limit, in bytes per second?
unsigned int | messageInSendBuffer [NUMBER_OF_PRIORITIES]
For each priority level, how many messages are waiting to be sent out?
double | bytesInSendBuffer [NUMBER_OF_PRIORITIES]
For each priority level, how many bytes are waiting to be sent out?
unsigned int | messagesInResendBuffer
uint64_t bytesInResendBuffer
How many bytes are waiting in the resend buffer. See also messagesInResendBuffer.
float | packetlossLastSecond
Over the last second, what was our packetloss? This number will range from 0.0 (for none) to 1.0 (for 100%)
float | packetlossTotal
What is the average total packetloss over the lifetime of the connection?

Detailed Description

Network Statisics Usage.

Store Statistics information related to network usage

Definition at line 63 of file statistics.h.

Member Function Documentation

RakNetStatistics& SLNet::RakNetStatistics::operator+= ( const RakNetStatistics & other )
inline

Definition at line 107 of file statistics.h.

References bytesInSendBuffer, messageInSendBuffer, NUMBER_OF_PRIORITIES, SLNet::RNS_PER_SECOND_METRICS_COUNT, runningTotal, and valueOverLastSecond.

Member Data Documentation

uint64_t SLNet::RakNetStatistics::BPSLimitByCongestionControl

If isLimitedByCongestionControl is true, what is the limit, in bytes per second?

Definition at line 80 of file statistics.h.

Referenced by SLNet::ReliabilityLayer::GetStatistics(), and SLNet::StatisticsToString().

uint64_t SLNet::RakNetStatistics::BPSLimitByOutgoingBandwidthLimit

If isLimitedByOutgoingBandwidthLimit is true, what is the limit, in bytes per second?

Definition at line 86 of file statistics.h.

Referenced by SLNet::ReliabilityLayer::GetStatistics(), and SLNet::StatisticsToString().

uint64_t SLNet::RakNetStatistics::bytesInResendBuffer

How many bytes are waiting in the resend buffer. See also messagesInResendBuffer.

Definition at line 99 of file statistics.h.

Referenced by SLNet::StatisticsToString().

double SLNet::RakNetStatistics::bytesInSendBuffer[NUMBER_OF_PRIORITIES]

For each priority level, how many bytes are waiting to be sent out?

Definition at line 92 of file statistics.h.

Referenced by operator+=(), and SLNet::StatisticsToString().

SLNet::TimeUS SLNet::RakNetStatistics::connectionStartTime

When did the connection start?

See Also
SLNet::GetTimeUS()

Definition at line 73 of file statistics.h.

Referenced by SLNet::StatisticsToString().

bool SLNet::RakNetStatistics::isLimitedByCongestionControl

Is our current send rate throttled by congestion control? This value should be true if you send more data per second than your bandwidth capacity

Definition at line 77 of file statistics.h.

Referenced by SLNet::ReliabilityLayer::GetStatistics().

bool SLNet::RakNetStatistics::isLimitedByOutgoingBandwidthLimit

Is our current send rate throttled by a call to RakPeer::SetPerConnectionOutgoingBandwidthLimit()?

Definition at line 83 of file statistics.h.

Referenced by SLNet::ReliabilityLayer::GetStatistics().

unsigned int SLNet::RakNetStatistics::messageInSendBuffer[NUMBER_OF_PRIORITIES]

For each priority level, how many messages are waiting to be sent out?

Definition at line 89 of file statistics.h.

Referenced by operator+=(), and SLNet::StatisticsToString().

unsigned int SLNet::RakNetStatistics::messagesInResendBuffer

How many messages are waiting in the resend buffer? This includes messages waiting for an ack, so should normally be a small value If the value is rising over time, you are exceeding the bandwidth capacity. See BPSLimitByCongestionControl

Definition at line 96 of file statistics.h.

Referenced by SLNet::RakPeer::RunUpdateCycle(), and SLNet::StatisticsToString().

float SLNet::RakNetStatistics::packetlossLastSecond

Over the last second, what was our packetloss? This number will range from 0.0 (for none) to 1.0 (for 100%)

Definition at line 102 of file statistics.h.

Referenced by SLNet::ReliabilityLayer::GetStatistics(), and SLNet::StatisticsToString().

float SLNet::RakNetStatistics::packetlossTotal

What is the average total packetloss over the lifetime of the connection?

Definition at line 105 of file statistics.h.

Referenced by SLNet::ReliabilityLayer::GetStatistics(), and SLNet::StatisticsToString().

uint64_t SLNet::RakNetStatistics::runningTotal[RNS_PER_SECOND_METRICS_COUNT]

For each type in RNSPerSecondMetrics, what is the total value over the lifetime of the connection?

Definition at line 69 of file statistics.h.

Referenced by SLNet::ReliabilityLayer::GetStatistics(), operator+=(), and SLNet::StatisticsToString().

uint64_t SLNet::RakNetStatistics::valueOverLastSecond[RNS_PER_SECOND_METRICS_COUNT]

For each type in RNSPerSecondMetrics, what is the value over the last 1 second?

Definition at line 66 of file statistics.h.

Referenced by SLNet::ReliabilityLayer::GetStatistics(), operator+=(), and SLNet::StatisticsToString().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/statistics.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::StatisticsHistory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StatisticsHistory
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SLNet::StatisticsHistory Class Reference

Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values. More...

#include <slikenet/StatisticsHistory.h>

Classes

struct | TimeAndValue
struct | TimeAndValueQueue
struct | TrackedObject
struct | TrackedObjectData

Public Types

enum | SHErrorCode { SH_OK, SH_UKNOWN_OBJECT, SH_UKNOWN_KEY, SH_INVALID_PARAMETER }
enum SHSortOperation {
SH_DO_NOT_SORT, SH_SORT_BY_RECENT_SUM_ASCENDING, SH_SORT_BY_RECENT_SUM_DESCENDING, SH_SORT_BY_LONG_TERM_SUM_ASCENDING,
SH_SORT_BY_LONG_TERM_SUM_DESCENDING, SH_SORT_BY_RECENT_SUM_OF_SQUARES_ASCENDING, SH_SORT_BY_RECENT_SUM_OF_SQUARES_DESCENDING, SH_SORT_BY_RECENT_AVERAGE_ASCENDING,
SH_SORT_BY_RECENT_AVERAGE_DESCENDING, SH_SORT_BY_LONG_TERM_AVERAGE_ASCENDING, SH_SORT_BY_LONG_TERM_AVERAGE_DESCENDING, SH_SORT_BY_RECENT_HIGHEST_ASCENDING,
SH_SORT_BY_RECENT_HIGHEST_DESCENDING, SH_SORT_BY_RECENT_LOWEST_ASCENDING, SH_SORT_BY_RECENT_LOWEST_DESCENDING, SH_SORT_BY_LONG_TERM_HIGHEST_ASCENDING,
SH_SORT_BY_LONG_TERM_HIGHEST_DESCENDING, SH_SORT_BY_LONG_TERM_LOWEST_ASCENDING, SH_SORT_BY_LONG_TERM_LOWEST_DESCENDING
}
enum | SHDataCategory { DC_DISCRETE, DC_CONTINUOUS }

Public Member Functions

StatisticsHistory ()
virtual | ~StatisticsHistory ()
void | SetDefaultTimeToTrack (Time defaultTimeToTrack)
Time | GetDefaultTimeToTrack (void) const
bool | AddObject (TrackedObjectData tod)
bool | RemoveObject (uint64_t objectId, void **userData)
void | RemoveObjectAtIndex (unsigned int index)
void | Clear (void)
unsigned int | GetObjectCount (void) const
StatisticsHistory::TrackedObjectData * | GetObjectAtIndex (unsigned int index) const
unsigned int | GetObjectIndex (uint64_t objectId) const
bool | AddValueByObjectID (uint64_t objectId, RakString key, SHValueType val, Time curTime, bool combineEqualTimes)
void | AddValueByIndex (unsigned int index, RakString key, SHValueType val, Time curTime, bool combineEqualTimes)
SHErrorCode | GetHistoryForKey (uint64_t objectId, RakString key, TimeAndValueQueue **values, Time curTime) const
bool | GetHistorySorted (uint64_t objectId, SHSortOperation sortType, DataStructures::List< TimeAndValueQueue * > &values) const
void | MergeAllObjectsOnKey (RakString key, TimeAndValueQueue *tavqOutput, SHDataCategory dataCategory) const
void | GetUniqueKeyList (DataStructures::List< RakString > &keys)

Static Public Member Functions

static int TrackedObjectComp (const uint64_t &key, TrackedObject *const &data)

Protected Attributes

DataStructures::OrderedList
< uint64_t, TrackedObject
*, TrackedObjectComp > 		objects
Time timeToTrack

Detailed Description

Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values.

Definition at line 47 of file StatisticsHistory.h.

Class Documentation

struct SLNet::StatisticsHistory::TimeAndValue

Definition at line 129 of file StatisticsHistory.h.

Class Members
Time | time
SHValueType | val

Member Enumeration Documentation

enum SLNet::StatisticsHistory::SHDataCategory
Enumerator:
DC_DISCRETE

Insert values from one set into the other set, in time order Values at the same time end up in the final set twice Use when you have additional data points to add to a graph

DC_CONTINUOUS

Add values from one set to values from the other set, at corresponding times If value at time t does not exist in the other set, linearly extrapolate value for other set based on nearest two data points longTerm* values are unknown using this method Use to add two graphs together

Definition at line 85 of file StatisticsHistory.h.

enum SLNet::StatisticsHistory::SHErrorCode
Enumerator:
SH_OK
SH_UKNOWN_OBJECT
SH_UKNOWN_KEY
SH_INVALID_PARAMETER

Definition at line 53 of file StatisticsHistory.h.

enum SLNet::StatisticsHistory::SHSortOperation
Enumerator:
SH_DO_NOT_SORT
SH_SORT_BY_RECENT_SUM_ASCENDING
SH_SORT_BY_RECENT_SUM_DESCENDING
SH_SORT_BY_LONG_TERM_SUM_ASCENDING
SH_SORT_BY_LONG_TERM_SUM_DESCENDING
SH_SORT_BY_RECENT_SUM_OF_SQUARES_ASCENDING
SH_SORT_BY_RECENT_SUM_OF_SQUARES_DESCENDING
SH_SORT_BY_RECENT_AVERAGE_ASCENDING
SH_SORT_BY_RECENT_AVERAGE_DESCENDING
SH_SORT_BY_LONG_TERM_AVERAGE_ASCENDING
SH_SORT_BY_LONG_TERM_AVERAGE_DESCENDING
SH_SORT_BY_RECENT_HIGHEST_ASCENDING
SH_SORT_BY_RECENT_HIGHEST_DESCENDING
SH_SORT_BY_RECENT_LOWEST_ASCENDING
SH_SORT_BY_RECENT_LOWEST_DESCENDING
SH_SORT_BY_LONG_TERM_HIGHEST_ASCENDING
SH_SORT_BY_LONG_TERM_HIGHEST_DESCENDING
SH_SORT_BY_LONG_TERM_LOWEST_ASCENDING
SH_SORT_BY_LONG_TERM_LOWEST_DESCENDING

Definition at line 61 of file StatisticsHistory.h.

Constructor & Destructor Documentation

SLNet::StatisticsHistory::StatisticsHistory ( )
virtual SLNet::StatisticsHistory::~StatisticsHistory ( )
virtual

Member Function Documentation

bool SLNet::StatisticsHistory::AddObject ( TrackedObjectData tod )
void SLNet::StatisticsHistory::AddValueByIndex | ( | unsigned int | index,
 |  | RakString | key,
 |  | SHValueType | val,
 |  | Time | curTime,
 |  | bool | combineEqualTimes
 | ) |  |
bool SLNet::StatisticsHistory::AddValueByObjectID | ( | uint64_t | objectId,
 |  | RakString | key,
 |  | SHValueType | val,
 |  | Time | curTime,
 |  | bool | combineEqualTimes
 | ) |  |
void SLNet::StatisticsHistory::Clear ( void )
Time SLNet::StatisticsHistory::GetDefaultTimeToTrack ( void ) const
SHErrorCode SLNet::StatisticsHistory::GetHistoryForKey | ( | uint64_t | objectId,
 |  | RakString | key,
 |  | TimeAndValueQueue ** | values,
 |  | Time | curTime
 | ) |  | const
bool SLNet::StatisticsHistory::GetHistorySorted | ( | uint64_t | objectId,
 |  | SHSortOperation | sortType,
 |  | DataStructures::List< TimeAndValueQueue * > & | values
 | ) |  | const
StatisticsHistory::TrackedObjectData* SLNet::StatisticsHistory::GetObjectAtIndex ( unsigned int index ) const
unsigned int SLNet::StatisticsHistory::GetObjectCount ( void ) const
unsigned int SLNet::StatisticsHistory::GetObjectIndex ( uint64_t objectId ) const
void SLNet::StatisticsHistory::GetUniqueKeyList ( DataStructures::List< RakString > & keys )
void SLNet::StatisticsHistory::MergeAllObjectsOnKey | ( | RakString | key,
 |  | TimeAndValueQueue * | tavqOutput,
 |  | SHDataCategory | dataCategory
 | ) |  | const
bool SLNet::StatisticsHistory::RemoveObject | ( | uint64_t | objectId,
 |  | void ** | userData
 | ) |  |
void SLNet::StatisticsHistory::RemoveObjectAtIndex ( unsigned int index )
void SLNet::StatisticsHistory::SetDefaultTimeToTrack ( Time defaultTimeToTrack )
static int SLNet::StatisticsHistory::TrackedObjectComp | ( | const uint64_t & | key,
 |  | TrackedObject *const & | data
 | ) |  |
static

Member Data Documentation

DataStructures::OrderedList<uint64_t, TrackedObject*,TrackedObjectComp> SLNet::StatisticsHistory::objects
protected

Definition at line 201 of file StatisticsHistory.h.

Time SLNet::StatisticsHistory::timeToTrack
protected

Definition at line 203 of file StatisticsHistory.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/StatisticsHistory.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::StatisticsHistory::TimeAndValueQueue Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StatisticsHistory
  • TimeAndValueQueue
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SLNet::StatisticsHistory::TimeAndValueQueue Struct Reference

#include <slikenet/StatisticsHistory.h>

Public Member Functions

TimeAndValueQueue ()
~TimeAndValueQueue ()
void | SetTimeToTrackValues (Time t)
Time | GetTimeToTrackValues (void) const
SHValueType | GetRecentSum (void) const
SHValueType | GetRecentSumOfSquares (void) const
SHValueType | GetLongTermSum (void) const
SHValueType | GetRecentAverage (void) const
SHValueType | GetRecentLowest (void) const
SHValueType | GetRecentHighest (void) const
SHValueType | GetRecentStandardDeviation (void) const
SHValueType | GetLongTermAverage (void) const
SHValueType | GetLongTermLowest (void) const
SHValueType | GetLongTermHighest (void) const
SHValueType | GetSumSinceTime (Time t) const
Time | GetTimeRange (void) const
void | ResizeSampleSet (int approximateSamples, DataStructures::Queue< StatisticsHistory::TimeAndValue > &blendedSamples, SHDataCategory dataCategory, Time timeClipStart=0, Time timeClipEnd=0)
void | Clear (void)
TimeAndValueQueue & | operator= (const TimeAndValueQueue &input)
void | CullExpiredValues (Time curTime)

Static Public Member Functions

static void | MergeSets (const TimeAndValueQueue *lhs, SHDataCategory lhsDataCategory, const TimeAndValueQueue *rhs, SHDataCategory rhsDataCategory, TimeAndValueQueue *output)
static SHValueType | Interpolate (TimeAndValue t1, TimeAndValue t2, Time time)

Public Attributes

DataStructures::Queue
< TimeAndValue > 		values
Time timeToTrackValues
RakString key
SHValueType recentSum
SHValueType recentSumOfSquares
SHValueType longTermSum
SHValueType longTermCount
SHValueType longTermLowest
SHValueType longTermHighest
SHValueType sortValue

Detailed Description

Definition at line 135 of file StatisticsHistory.h.

Constructor & Destructor Documentation

SLNet::StatisticsHistory::TimeAndValueQueue::TimeAndValueQueue ( )
SLNet::StatisticsHistory::TimeAndValueQueue::~TimeAndValueQueue ( )

Member Function Documentation

void SLNet::StatisticsHistory::TimeAndValueQueue::Clear ( void )
void SLNet::StatisticsHistory::TimeAndValueQueue::CullExpiredValues ( Time curTime )
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetLongTermAverage ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetLongTermHighest ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetLongTermLowest ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetLongTermSum ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetRecentAverage ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetRecentHighest ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetRecentLowest ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetRecentStandardDeviation ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetRecentSum ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetRecentSumOfSquares ( void ) const
SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::GetSumSinceTime ( Time t ) const
Time SLNet::StatisticsHistory::TimeAndValueQueue::GetTimeRange ( void ) const
Time SLNet::StatisticsHistory::TimeAndValueQueue::GetTimeToTrackValues ( void ) const
static SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::Interpolate | ( | TimeAndValue | t1,
 |  | TimeAndValue | t2,
 |  | Time | time
 | ) |  |
static
static void SLNet::StatisticsHistory::TimeAndValueQueue::MergeSets | ( | const TimeAndValueQueue * | lhs,
 |  | SHDataCategory | lhsDataCategory,
 |  | const TimeAndValueQueue * | rhs,
 |  | SHDataCategory | rhsDataCategory,
 |  | TimeAndValueQueue * | output
 | ) |  |
static
TimeAndValueQueue& SLNet::StatisticsHistory::TimeAndValueQueue::operator= ( const TimeAndValueQueue & input )
void SLNet::StatisticsHistory::TimeAndValueQueue::ResizeSampleSet | ( | int | approximateSamples,
 |  | DataStructures::Queue< StatisticsHistory::TimeAndValue > & | blendedSamples,
 |  | SHDataCategory | dataCategory,
 |  | Time | timeClipStart = 0,
 |  | Time | timeClipEnd = 0
 | ) |  |
void SLNet::StatisticsHistory::TimeAndValueQueue::SetTimeToTrackValues ( Time t )

Member Data Documentation

RakString SLNet::StatisticsHistory::TimeAndValueQueue::key

Definition at line 143 of file StatisticsHistory.h.

SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::longTermCount

Definition at line 148 of file StatisticsHistory.h.

SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::longTermHighest

Definition at line 150 of file StatisticsHistory.h.

SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::longTermLowest

Definition at line 149 of file StatisticsHistory.h.

SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::longTermSum

Definition at line 147 of file StatisticsHistory.h.

SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::recentSum

Definition at line 145 of file StatisticsHistory.h.

SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::recentSumOfSquares

Definition at line 146 of file StatisticsHistory.h.

SHValueType SLNet::StatisticsHistory::TimeAndValueQueue::sortValue

Definition at line 184 of file StatisticsHistory.h.

Time SLNet::StatisticsHistory::TimeAndValueQueue::timeToTrackValues

Definition at line 142 of file StatisticsHistory.h.

DataStructures::Queue<TimeAndValue> SLNet::StatisticsHistory::TimeAndValueQueue::values

Definition at line 140 of file StatisticsHistory.h.

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/StatisticsHistory.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::StatisticsHistory::TrackedObject Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StatisticsHistory
  • TrackedObject
Public Member Functions | Public Attributes | List of all members
SLNet::StatisticsHistory::TrackedObject Struct Reference

#include <slikenet/StatisticsHistory.h>

Public Member Functions

TrackedObject ()
~TrackedObject ()

Public Attributes

TrackedObjectData trackedObjectData
DataStructures::Hash
< SLNet::RakString,
TimeAndValueQueue
*, 32, SLNet::RakString::ToInteger > 		dataQueues

Detailed Description

Definition at line 193 of file StatisticsHistory.h.

Constructor & Destructor Documentation

SLNet::StatisticsHistory::TrackedObject::TrackedObject ( )
SLNet::StatisticsHistory::TrackedObject::~TrackedObject ( )

Member Data Documentation

DataStructures::Hash<SLNet::RakString, TimeAndValueQueue*, 32, SLNet::RakString::ToInteger> SLNet::StatisticsHistory::TrackedObject::dataQueues

Definition at line 198 of file StatisticsHistory.h.

TrackedObjectData SLNet::StatisticsHistory::TrackedObject::trackedObjectData

Definition at line 197 of file StatisticsHistory.h.

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/StatisticsHistory.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::StatisticsHistory::TrackedObjectData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StatisticsHistory
  • TrackedObjectData
Public Member Functions | Public Attributes | List of all members
SLNet::StatisticsHistory::TrackedObjectData Struct Reference

#include <slikenet/StatisticsHistory.h>

Public Member Functions

TrackedObjectData ()
TrackedObjectData (uint64_t _objectId, int _objectType, void *_userData)

Public Attributes

uint64_t objectId
int | objectType
void * | userData

Detailed Description

Definition at line 102 of file StatisticsHistory.h.

Constructor & Destructor Documentation

SLNet::StatisticsHistory::TrackedObjectData::TrackedObjectData ( )
SLNet::StatisticsHistory::TrackedObjectData::TrackedObjectData | ( | uint64_t | _objectId,
 |  | int | _objectType,
 |  | void * | _userData
 | ) |  |

Member Data Documentation

uint64_t SLNet::StatisticsHistory::TrackedObjectData::objectId

Definition at line 106 of file StatisticsHistory.h.

int SLNet::StatisticsHistory::TrackedObjectData::objectType

Definition at line 107 of file StatisticsHistory.h.

void* SLNet::StatisticsHistory::TrackedObjectData::userData

Definition at line 108 of file StatisticsHistory.h.

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/StatisticsHistory.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakString Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakString
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
SLNet::RakString Class Reference

String class. More...

#include <slikenet/string.h>

Classes

struct SharedString

Public Member Functions

RakString ()
RakString (char input)
RakString (unsigned char input)
RakString (const unsigned char *format,...)
RakString (const char *format,...)
~RakString ()
RakString (const RakString &rhs)
operator const char * () const
Implicit return of const char*.
const char * | C_String (void) const
Same as std::string::c_str.
char * | C_StringUnsafe (void)
RakString & | operator= (const RakString &rhs)
Assigment operators.
RakString & | operator= (const char *str)
RakString & | operator= (char *str)
RakString & | operator= (const unsigned char *str)
RakString & | operator= (char unsigned *str)
RakString & | operator= (const char c)
RakString & | operator+= (const RakString &rhs)
Concatenation.
RakString & | operator+= (const char *str)
RakString & | operator+= (char *str)
RakString & | operator+= (const unsigned char *str)
RakString & | operator+= (char unsigned *str)
RakString & | operator+= (const char c)
unsigned char | operator[] (const unsigned int position) const
Character index. Do not use to change the string however.
size_t | Find (const char *stringToFind, size_t pos=0)
bool | operator== (const RakString &rhs) const
Equality.
bool | operator== (const char *str) const
bool | operator== (char *str) const
bool | operator< (const RakString &right) const
bool | operator<= (const RakString &right) const
bool | operator> (const RakString &right) const
bool | operator>= (const RakString &right) const
bool | operator!= (const RakString &rhs) const
Inequality.
bool | operator!= (const char *str) const
bool | operator!= (char *str) const
const char * | ToLower (void)
Change all characters to lowercase.
const char * | ToUpper (void)
Change all characters to uppercase.
void | Set (const char *format,...)
Set the value of the string.
RakString | Assign (const char *str, size_t pos, size_t n)
bool | IsEmpty (void) const
Returns if the string is empty. Also, C_String() would return "".
size_t | GetLength (void) const
Returns the length of the string.
size_t | GetLengthUTF8 (void) const
void | Replace (unsigned index, unsigned count, unsigned char c)
Replace character(s) in starting at index, for count, with c.
void | SetChar (unsigned index, unsigned char c)
Replace character at index with c.
void | SetChar (unsigned index, SLNet::RakString s)
Replace character at index with string s.
void | Truncate (unsigned int length)
Make sure string is no longer than length.
void | TruncateUTF8 (unsigned int length)
RakString | SubStr (unsigned int index, size_t count) const
void | Erase (unsigned int index, unsigned int count)
Erase characters out of the string at index for count.
void | TerminateAtFirstCharacter (char c)
Set the first instance of c with a NULL terminator.
void | TerminateAtLastCharacter (char c)
Set the last instance of c with a NULL terminator.
void | StartAfterFirstCharacter (char c)
void | StartAfterLastCharacter (char c)
int | GetCharacterCount (char c)
Returns how many occurances there are of c in the string.
void | RemoveCharacter (char c)
Remove all instances of c.
void | AppendBytes (const char *bytes, size_t count)
int | StrCmp (const RakString &rhs) const
Compare strings (case sensitive)
int | StrNCmp (const RakString &rhs, size_t num) const
Compare strings (case sensitive), up to num characters.
int | StrICmp (const RakString &rhs) const
Compare strings (not case sensitive)
void | Clear (void)
Clear the string.
void | Printf (void)
Print the string to the screen.
void | FPrintf (FILE *fp)
Print the string to a file.
bool | IPAddressMatch (const char *IP)
Does the given IP address match the IP address encoded into this string, accounting for wildcards?
bool | ContainsNonprintableExceptSpaces (void) const
Does the string contain non-printable characters other than spaces?
bool | IsEmailAddress (void) const
Is this a valid email address?
SLNet::RakString & | URLEncode (void)
URL Encode the string. See http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4029/.
SLNet::RakString & | URLDecode (void)
URL decode the string.
void | SplitURI (SLNet::RakString &header, SLNet::RakString &domain, SLNet::RakString &path)
https://servers.api.rackspacecloud.com/v1.0 to https://, servers.api.rackspacecloud.com, /v1.0
SLNet::RakString & | SQLEscape (void)
Scan for quote, double quote, and backslash and prepend with backslash.
SLNet::RakString & | MakeFilePath (void)
Fix to be a file path, ending with /.
void | Serialize (BitStream *bs) const
void | SerializeCompressed (BitStream *bs, uint8_t languageId=0, bool writeLanguageId=false) const
bool | Deserialize (BitStream *bs)
bool | DeserializeCompressed (BitStream *bs, bool readLanguageId=false)
RakString (SharedString *_sharedString)

Static Public Member Functions

static SLNet::RakString | NonVariadic (const char *str)
static unsigned long | ToInteger (const char *str)
Hash the string into an unsigned int.
static unsigned long | ToInteger (const RakString &rs)
static int | ReadIntFromSubstring (const char *str, size_t pos, size_t n)
Read an integer out of a substring.
static SLNet::RakString | FormatForPOST (const char *uri, const char *contentType, const char *body, const char *extraHeaders="")
static SLNet::RakString | FormatForPUT (const char *uri, const char *contentType, const char *body, const char *extraHeaders="")
static SLNet::RakString | FormatForGET (const char *uri, const char *extraHeaders="")
static SLNet::RakString | FormatForDELETE (const char *uri, const char *extraHeaders="")
static void | FreeMemory (void)
static void | FreeMemoryNoMutex (void)
static void | Serialize (const char *str, BitStream *bs)
Static version of the Serialize function.
static void | SerializeCompressed (const char *str, BitStream *bs, uint8_t languageId=0, bool writeLanguageId=false)
Static version of the SerializeCompressed function.
static bool | Deserialize (char *str, BitStream *bs)
Static version of the Deserialize() function.
static bool | DeserializeCompressed (char *str, BitStream *bs, bool readLanguageId=false)
Static version of the DeserializeCompressed() function.
static const char * | ToString (int64_t i)
static const char * | ToString (uint64_t i)
static size_t | GetSizeToAllocate (size_t bytes)
static int | RakStringComp (RakString const &key, RakString const &data)
static void | LockMutex (void)
static void | UnlockMutex (void)

Public Attributes

SharedString * sharedString

Static Public Attributes

static SharedString emptyString ={0,0,0,(char*) "",(char*) ""}
static DataStructures::List
< SharedString * > 		freeList

Protected Member Functions

void | Allocate (size_t len)
void | Assign (const char *str)
void | Assign (const char *str, va_list ap)
void | Clone (void)
void | Free (void)
unsigned char | ToLower (unsigned char c)
unsigned char | ToUpper (unsigned char c)
void | Realloc (SharedString *inSharedString, size_t bytes)

Static Protected Member Functions

static SLNet::RakString FormatForPUTOrPost (const char *type, const char *uri, const char *contentType, const char *body, const char *extraHeaders)

Detailed Description

String class.

Has the following improvements over std::string -Reference counting: Suitable to store in lists -Variadic assignment operator -Doesn't cause linker errors

Definition at line 44 of file string.h.

Class Documentation

struct SLNet::RakString::SharedString

Definition at line 309 of file string.h.

Class Members
char * | bigString
size_t | bytesUsed
char * | c_str
unsigned int | refCount
SimpleMutex * | refCountMutex
char | smallString

Constructor & Destructor Documentation

RakString::RakString ( )

Definition at line 61 of file RakString.cpp.

References emptyString, and sharedString.

Referenced by SubStr().

RakString::RakString ( char input )

Definition at line 69 of file RakString.cpp.

References Assign().

RakString::RakString ( unsigned char input )

Definition at line 76 of file RakString.cpp.

References Assign().

RakString::RakString | ( | const unsigned char * | format,
 |  |  | ...
 | ) |  |

Definition at line 83 of file RakString.cpp.

References Assign().

RakString::RakString | ( | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 89 of file RakString.cpp.

References Assign().

RakString::~RakString ( )

Definition at line 115 of file RakString.cpp.

References Free().

RakString::RakString ( const RakString & rhs )

Definition at line 95 of file RakString.cpp.

References emptyString, SLNet::SimpleMutex::Lock(), SLNet::RakString::SharedString::refCount, SLNet::RakString::SharedString::refCountMutex, sharedString, and SLNet::SimpleMutex::Unlock().

RakString::RakString ( RakString::SharedString * _sharedString )

Definition at line 65 of file RakString.cpp.

References sharedString.

Member Function Documentation

void RakString::Allocate ( size_t len )
protected

Definition at line 1333 of file RakString.cpp.

References _FILE_AND_LINE_, SLNet::RakString::SharedString::bigString, SLNet::RakString::SharedString::bytesUsed, SLNet::RakString::SharedString::c_str, freeList, DataStructures::List< list_type >::Insert(), LockMutex(), rakMalloc_Ex, SLNet::RakString::SharedString::refCount, SLNet::RakString::SharedString::refCountMutex, DataStructures::List< list_type >::RemoveAtIndex(), sharedString, DataStructures::List< list_type >::Size(), SLNet::RakString::SharedString::smallString, and UnlockMutex().

Referenced by AppendBytes(), Assign(), Deserialize(), SplitURI(), SubStr(), URLDecode(), and URLEncode().

void RakString::AppendBytes | ( | const char * | bytes,
 |  | size_t | count
 | ) |  |

Definition at line 1483 of file RakString.cpp.

References Allocate(), SLNet::RakString::SharedString::c_str, Clone(), GetLength(), IsEmpty(), Realloc(), and sharedString.

SLNet::RakString RakString::Assign | ( | const char * | str,
 |  | size_t | pos,
 |  | size_t | n
 | ) |  |

Sets a copy of a substring of str as the new content. The substring is the portion of str that begins at the character position pos and takes up to n characters (it takes less than n if the end of str is reached before).

Parameters
[in] | str | The string to copy in
[in] | pos | The position on str to start the copy
[in] | n | How many chars to copy
Returns
Returns the string, note that the current string is set to that value as well

Definition at line 1427 of file RakString.cpp.

References Allocate(), SLNet::RakString::SharedString::c_str, Clone(), emptyString, and sharedString.

Referenced by Assign(), Clone(), operator+=(), operator=(), RakString(), and Set().

void RakString::Assign ( const char * str )
protected

Definition at line 1371 of file RakString.cpp.

References Allocate(), SLNet::RakString::SharedString::c_str, emptyString, and sharedString.

void RakString::Assign | ( | const char * | str,
 |  | va_list | ap
 | ) |  |
protected

Definition at line 1383 of file RakString.cpp.

References _FILE_AND_LINE_, Assign(), emptyString, notifyOutOfMemory, rakFree_Ex, rakRealloc_Ex, and sharedString.

const char* SLNet::RakString::C_String ( void ) const
inline

Same as std::string::c_str.

Definition at line 60 of file string.h.

Referenced by SLNet::StringCompressor::EncodeString(), FormatForDELETE(), FormatForGET(), FormatForPUTOrPost(), operator+=(), operator<(), operator<=(), SLNet::RakWString::operator=(), operator>(), operator>=(), SerializeCompressed(), StrCmp(), StrICmp(), StrNCmp(), and ToInteger().

char* SLNet::RakString::C_StringUnsafe ( void )
inline

Definition at line 64 of file string.h.

void RakString::Clear ( void )

Clear the string.

Definition at line 1329 of file RakString.cpp.

References Free().

Referenced by SLNet::StringCompressor::DecodeString(), Deserialize(), RemoveCharacter(), Set(), and SplitURI().

void RakString::Clone ( void )
protected

Definition at line 1502 of file RakString.cpp.

References Assign(), SLNet::RakString::SharedString::c_str, emptyString, SLNet::SimpleMutex::Lock(), RakAssert, SLNet::RakString::SharedString::refCount, SLNet::RakString::SharedString::refCountMutex, sharedString, and SLNet::SimpleMutex::Unlock().

Referenced by AppendBytes(), Assign(), Erase(), MakeFilePath(), operator+=(), RemoveCharacter(), Replace(), SetChar(), SQLEscape(), TerminateAtFirstCharacter(), TerminateAtLastCharacter(), ToLower(), and ToUpper().

bool RakString::ContainsNonprintableExceptSpaces ( void ) const

Does the string contain non-printable characters other than spaces?

Definition at line 818 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

bool RakString::Deserialize ( BitStream * bs )

Deserialize what was written by Serialize

Parameters
[in] bs Bitstream to serialize from
Returns
true if the deserialization was successful

Definition at line 1249 of file RakString.cpp.

References SLNet::BitStream::AlignReadToByteBoundary(), Allocate(), SLNet::RakString::SharedString::c_str, Clear(), SLNet::BitStream::Read(), SLNet::BitStream::ReadAlignedBytes(), and sharedString.

Referenced by SLNet::BitStream::Read().

bool RakString::Deserialize | ( | char * | str,
 |  | BitStream * | bs
 | ) |  |
static

Static version of the Deserialize() function.

Definition at line 1269 of file RakString.cpp.

References SLNet::BitStream::Read(), and SLNet::BitStream::ReadAlignedBytes().

bool RakString::DeserializeCompressed | ( | BitStream * | bs,
 |  | bool | readLanguageId = false
 | ) |  |

Deserialize compressed string, written by SerializeCompressed

Parameters
[in] | bs | Bitstream to serialize from
[in] | readLanguageId | If true, looks for the variable langaugeId in the data stream. Must match what was passed to SerializeCompressed
Returns
true if the deserialization was successful
Precondition
StringCompressor::AddReference must have been called to instantiate the class (Happens automatically from RakPeer::Startup())

Definition at line 1283 of file RakString.cpp.

References SLNet::StringCompressor::DecodeString(), SLNet::StringCompressor::Instance(), and SLNet::BitStream::ReadCompressed().

Referenced by SLNet::BitStream::ReadCompressed().

bool RakString::DeserializeCompressed | ( | char * | str,
 |  | BitStream * | bs,
 |  | bool | readLanguageId = false
 | ) |  |
static

Static version of the DeserializeCompressed() function.

Definition at line 1292 of file RakString.cpp.

References SLNet::StringCompressor::DecodeString(), SLNet::StringCompressor::Instance(), and SLNet::BitStream::ReadCompressed().

void RakString::Erase | ( | unsigned int | index,
 |  | unsigned int | count
 | ) |  |

Erase characters out of the string at index for count.

Definition at line 647 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clone(), GetLength(), RakAssert, and sharedString.

size_t RakString::Find | ( | const char * | stringToFind,
 |  | size_t | pos = 0
 | ) |  |

String class find replacement Searches the string for the content specified in stringToFind and returns the position of the first occurrence in the string. Search only includes characters on or after position pos, ignoring any possible occurrences in previous locations.

Parameters
[in] | stringToFind | The string to find inside of this object's string
[in] | pos | The position in the string to start the search
Returns
Returns the position of the first occurrence in the string.

Definition at line 558 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, GetLength(), and sharedString.

RakString RakString::FormatForDELETE | ( | const char * | uri,
 |  | const char * | extraHeaders = ""
 | ) |  |
static

Format as a DELETE command that can be sent to a webserver

Parameters
[in] uri For example, masterserver2.raknet.com/testServer?__gameId=comprehensivePCGame&__rowId=1
Returns
Formatted string

Definition at line 1142 of file RakString.cpp.

References C_String(), IsEmpty(), Set(), and SplitURI().

RakString RakString::FormatForGET | ( | const char * | uri,
 |  | const char * | extraHeaders = ""
 | ) |  |
static

Format as a GET command that can be sent to a webserver

Parameters
[in] uri For example, masterserver2.raknet.com/testServer?__gameId=comprehensivePCGame
Returns
Formatted string

Definition at line 1106 of file RakString.cpp.

References C_String(), IsEmpty(), Set(), and SplitURI().

RakString RakString::FormatForPOST | ( | const char * | uri,
 |  | const char * | contentType,
 |  | const char * | body,
 |  | const char * | extraHeaders = ""
 | ) |  |
static

Format as a POST command that can be sent to a webserver

Parameters
[in] | uri | For example, masterserver2.raknet.com/testServer
[in] | contentType | For example, text/plain; charset=UTF-8
[in] | body | Body of the post
Returns
Formatted string

Definition at line 1098 of file RakString.cpp.

References FormatForPUTOrPost().

RakString RakString::FormatForPUT | ( | const char * | uri,
 |  | const char * | contentType,
 |  | const char * | body,
 |  | const char * | extraHeaders = ""
 | ) |  |
static

Definition at line 1102 of file RakString.cpp.

References FormatForPUTOrPost().

SLNet::RakString RakString::FormatForPUTOrPost | ( | const char * | type,
 |  | const char * | uri,
 |  | const char * | contentType,
 |  | const char * | body,
 |  | const char * | extraHeaders
 | ) |  |
staticprotected

Definition at line 1043 of file RakString.cpp.

References C_String(), IsEmpty(), Set(), and SplitURI().

Referenced by FormatForPOST(), and FormatForPUT().

void RakString::FPrintf ( FILE * fp )

Print the string to a file.

Definition at line 766 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

void RakString::Free ( void )
protected

Definition at line 1522 of file RakString.cpp.

References _FILE_AND_LINE_, SLNet::RakString::SharedString::bigString, SLNet::RakString::SharedString::bytesUsed, emptyString, freeList, DataStructures::List< list_type >::Insert(), SLNet::SimpleMutex::Lock(), LockMutex(), rakFree_Ex, SLNet::RakString::SharedString::refCount, SLNet::RakString::SharedString::refCountMutex, sharedString, SLNet::SimpleMutex::Unlock(), and UnlockMutex().

Referenced by Clear(), operator=(), and ~RakString().

void RakString::FreeMemory ( void )
static

RakString uses a freeList of old no-longer used strings Call this function to clear this memory on shutdown

Definition at line 1214 of file RakString.cpp.

References FreeMemoryNoMutex(), LockMutex(), and UnlockMutex().

void RakString::FreeMemoryNoMutex ( void )
static

Definition at line 1220 of file RakString.cpp.

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

Referenced by FreeMemory().

int RakString::GetCharacterCount ( char c )

Returns how many occurances there are of c in the string.

Definition at line 720 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, GetLength(), and sharedString.

size_t RakString::GetLength ( void ) const

Returns the length of the string.

Definition at line 396 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

Referenced by AppendBytes(), Erase(), Find(), GetCharacterCount(), operator+(), operator+=(), operator[](), Replace(), SetChar(), SplitURI(), SQLEscape(), StartAfterFirstCharacter(), StartAfterLastCharacter(), SubStr(), TerminateAtFirstCharacter(), TerminateAtLastCharacter(), and Truncate().

size_t RakString::GetLengthUTF8 ( void ) const

Definition at line 429 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, porges_strlen2(), and sharedString.

static size_t SLNet::RakString::GetSizeToAllocate ( size_t bytes )
inlinestatic

Definition at line 299 of file string.h.

Referenced by operator+(), and Realloc().

bool RakString::IPAddressMatch ( const char * IP )

Does the given IP address match the IP address encoded into this string, accounting for wildcards?

Definition at line 770 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

bool RakString::IsEmailAddress ( void ) const

Is this a valid email address?

Definition at line 829 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, IsEmpty(), and sharedString.

bool RakString::IsEmpty ( void ) const

Returns if the string is empty. Also, C_String() would return "".

Definition at line 392 of file RakString.cpp.

References emptyString, and sharedString.

Referenced by AppendBytes(), FormatForDELETE(), FormatForGET(), FormatForPUTOrPost(), IsEmailAddress(), MakeFilePath(), operator+(), and operator+=().

void RakString::LockMutex ( void )
static

Definition at line 1564 of file RakString.cpp.

References GetPoolMutex(), and SLNet::SimpleMutex::Lock().

Referenced by Allocate(), Free(), FreeMemory(), and operator+().

SLNet::RakString & RakString::MakeFilePath ( void )

Fix to be a file path, ending with /.

Definition at line 1180 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clone(), IsEmpty(), and sharedString.

SLNet::RakString RakString::NonVariadic ( const char * str )
static

Create a RakString with a value, without doing printf style parsing Equivalent to assignment operator

Definition at line 1454 of file RakString.cpp.

SLNet::RakString::operator const char * ( ) const
inline

Implicit return of const char*.

Definition at line 57 of file string.h.

bool RakString::operator!= ( const RakString & rhs ) const

Inequality.

Definition at line 274 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

bool RakString::operator!= ( const char * str ) const

Definition at line 278 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

bool RakString::operator!= ( char * str ) const

Definition at line 282 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

RakString & RakString::operator+= ( const RakString & rhs )

Concatenation.

Definition at line 186 of file RakString.cpp.

References SLNet::RakString::SharedString::bytesUsed, SLNet::RakString::SharedString::c_str, C_String(), Clone(), GetLength(), IsEmpty(), operator=(), Realloc(), and sharedString.

Referenced by operator+=().

RakString & RakString::operator+= ( const char * str )

Definition at line 204 of file RakString.cpp.

References Assign(), SLNet::RakString::SharedString::bytesUsed, SLNet::RakString::SharedString::c_str, Clone(), GetLength(), IsEmpty(), Realloc(), and sharedString.

RakString & RakString::operator+= ( char * str )

Definition at line 222 of file RakString.cpp.

References operator+=().

RakString & RakString::operator+= ( const unsigned char * str )

Definition at line 226 of file RakString.cpp.

References operator+=().

RakString& SLNet::RakString::operator+= ( char unsigned * str )
RakString & RakString::operator+= ( const char c )

Definition at line 234 of file RakString.cpp.

References operator+=().

bool RakString::operator< ( const RakString & right ) const

Definition at line 258 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, C_String(), and sharedString.

bool RakString::operator<= ( const RakString & right ) const

Definition at line 262 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, C_String(), and sharedString.

RakString & RakString::operator= ( const RakString & rhs )

Assigment operators.

Definition at line 119 of file RakString.cpp.

References emptyString, Free(), SLNet::SimpleMutex::Lock(), SLNet::RakString::SharedString::refCount, SLNet::RakString::SharedString::refCountMutex, sharedString, and SLNet::SimpleMutex::Unlock().

Referenced by operator+=(), and operator=().

RakString & RakString::operator= ( const char * str )

Definition at line 138 of file RakString.cpp.

References Assign(), and Free().

RakString & RakString::operator= ( char * str )

Definition at line 144 of file RakString.cpp.

References operator=().

RakString & RakString::operator= ( const unsigned char * str )

Definition at line 148 of file RakString.cpp.

References operator=().

RakString & RakString::operator= ( char unsigned * str )

Definition at line 152 of file RakString.cpp.

References operator=().

RakString & RakString::operator= ( const char c )

Definition at line 156 of file RakString.cpp.

References operator=().

bool RakString::operator== ( const RakString & rhs ) const

Equality.

Definition at line 246 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

bool RakString::operator== ( const char * str ) const

Definition at line 250 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

bool RakString::operator== ( char * str ) const

Definition at line 254 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

bool RakString::operator> ( const RakString & right ) const

Definition at line 266 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, C_String(), and sharedString.

bool RakString::operator>= ( const RakString & right ) const

Definition at line 270 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, C_String(), and sharedString.

unsigned char RakString::operator[] ( const unsigned int position ) const

Character index. Do not use to change the string however.

Definition at line 241 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, GetLength(), RakAssert, and sharedString.

void RakString::Printf ( void )

Print the string to the screen.

Definition at line 762 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, RAKNET_DEBUG_PRINTF, and sharedString.

int SLNet::RakString::RakStringComp | ( | RakString const & | key,
 |  | RakString const & | data
 | ) |  |
static

Definition at line 56 of file RakString.cpp.

References StrCmp().

int RakString::ReadIntFromSubstring | ( | const char * | str,
 |  | size_t | pos,
 |  | size_t | n
 | ) |  |
static

Read an integer out of a substring.

Parameters
[in] | str | The string
[in] | pos | The position on str where the integer starts
[in] | n | How many chars to copy

Definition at line 1474 of file RakString.cpp.

void RakString::Realloc | ( | SharedString * | inSharedString,
 |  | size_t | bytes
 | ) |  |
protected

Definition at line 163 of file RakString.cpp.

References _FILE_AND_LINE_, SLNet::RakString::SharedString::bigString, SLNet::RakString::SharedString::bytesUsed, SLNet::RakString::SharedString::c_str, GetSizeToAllocate(), RakAssert, rakMalloc_Ex, rakRealloc_Ex, and SLNet::RakString::SharedString::smallString.

Referenced by AppendBytes(), operator+=(), and SQLEscape().

void RakString::RemoveCharacter ( char c )

Remove all instances of c.

Definition at line 733 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clear(), Clone(), and sharedString.

void RakString::Replace | ( | unsigned | index,
 |  | unsigned | count,
 |  | unsigned char | c
 | ) |  |

Replace character(s) in starting at index, for count, with c.

Definition at line 433 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clone(), GetLength(), RakAssert, and sharedString.

void RakString::Serialize ( BitStream * bs ) const

Serialize to a bitstream, uncompressed (slightly faster)

Parameters
[out] bs Bitstream to serialize to

Definition at line 1229 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

Referenced by SLNet::BitStream::Write().

void RakString::Serialize | ( | const char * | str,
 |  | BitStream * | bs
 | ) |  |
static

Static version of the Serialize function.

Definition at line 1233 of file RakString.cpp.

References SLNet::BitStream::Write(), and SLNet::BitStream::WriteAlignedBytes().

void RakString::SerializeCompressed | ( | BitStream * | bs,
 |  | uint8_t | languageId = 0,
 |  | bool | writeLanguageId = false
 | ) |  | const

Serialize to a bitstream, compressed (better bandwidth usage)

Parameters
[out] | bs | Bitstream to serialize to
[in] | languageId | languageId to pass to the StringCompressor class
[in] | writeLanguageId | encode the languageId variable in the stream. If false, 0 is assumed, and DeserializeCompressed will not look for this variable in the stream (saves bandwidth)
Precondition
StringCompressor::AddReference must have been called to instantiate the class (Happens automatically from RakPeer::Startup())

Definition at line 1239 of file RakString.cpp.

References C_String().

Referenced by SLNet::BitStream::WriteCompressed().

void RakString::SerializeCompressed | ( | const char * | str,
 |  | BitStream * | bs,
 |  | uint8_t | languageId = 0,
 |  | bool | writeLanguageId = false
 | ) |  |
static

Static version of the SerializeCompressed function.

Definition at line 1243 of file RakString.cpp.

References SLNet::StringCompressor::EncodeString(), SLNet::StringCompressor::Instance(), and SLNet::BitStream::WriteCompressed().

void RakString::Set | ( | const char * | format,
 |  |  | ...
 | ) |  |

Set the value of the string.

Definition at line 384 of file RakString.cpp.

References Assign(), and Clear().

Referenced by FormatForDELETE(), FormatForGET(), and FormatForPUTOrPost().

void RakString::SetChar | ( | unsigned | index,
 |  | unsigned char | c
 | ) |  |

Replace character at index with c.

Definition at line 446 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clone(), GetLength(), RakAssert, and sharedString.

Referenced by Truncate().

void RakString::SetChar | ( | unsigned | index,
 |  | SLNet::RakString | s
 | ) |  |

Replace character at index with string s.

Definition at line 452 of file RakString.cpp.

References Clone(), GetLength(), RakAssert, and SubStr().

void RakString::SplitURI | ( | SLNet::RakString & | header,
 |  | SLNet::RakString & | domain,
 |  | SLNet::RakString & | path
 | ) |  |

https://servers.api.rackspacecloud.com/v1.0 to https://, servers.api.rackspacecloud.com, /v1.0

Definition at line 954 of file RakString.cpp.

References Allocate(), SLNet::RakString::SharedString::bytesUsed, SLNet::RakString::SharedString::c_str, Clear(), GetLength(), and sharedString.

Referenced by FormatForDELETE(), FormatForGET(), and FormatForPUTOrPost().

SLNet::RakString & RakString::SQLEscape ( void )

Scan for quote, double quote, and backslash and prepend with backslash.

Definition at line 1007 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clone(), GetLength(), Realloc(), and sharedString.

void RakString::StartAfterFirstCharacter ( char c )

Definition at line 704 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, GetLength(), sharedString, and SubStr().

void RakString::StartAfterLastCharacter ( char c )

Definition at line 673 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, GetLength(), sharedString, and SubStr().

int RakString::StrCmp ( const RakString & rhs ) const

Compare strings (case sensitive)

Definition at line 750 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, C_String(), and sharedString.

Referenced by RakStringComp().

int RakString::StrICmp ( const RakString & rhs ) const

Compare strings (not case sensitive)

Definition at line 758 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, C_String(), and sharedString.

int RakString::StrNCmp | ( | const RakString & | rhs,
 |  | size_t | num
 | ) |  | const

Compare strings (case sensitive), up to num characters.

Definition at line 754 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, C_String(), and sharedString.

RakString RakString::SubStr | ( | unsigned int | index,
 |  | size_t | count
 | ) |  | const

Definition at line 631 of file RakString.cpp.

References Allocate(), SLNet::RakString::SharedString::c_str, GetLength(), RakString(), and sharedString.

Referenced by SetChar(), StartAfterFirstCharacter(), and StartAfterLastCharacter().

void RakString::TerminateAtFirstCharacter ( char c )

Set the first instance of c with a NULL terminator.

Definition at line 689 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clone(), GetLength(), and sharedString.

void RakString::TerminateAtLastCharacter ( char c )

Set the last instance of c with a NULL terminator.

Definition at line 660 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clone(), GetLength(), and sharedString.

unsigned long RakString::ToInteger ( const char * str )
static

Hash the string into an unsigned int.

Definition at line 1460 of file RakString.cpp.

Referenced by ToInteger().

unsigned long RakString::ToInteger ( const RakString & rs )
static

Definition at line 1470 of file RakString.cpp.

References C_String(), and ToInteger().

const char * RakString::ToLower ( void )

Change all characters to lowercase.

Definition at line 364 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clone(), and sharedString.

unsigned char RakString::ToLower ( unsigned char c )
protected

Definition at line 1552 of file RakString.cpp.

const char * RakString::ToString ( int64_t i )
static

Definition at line 1301 of file RakString.cpp.

const char * RakString::ToString ( uint64_t i )
static

Definition at line 1315 of file RakString.cpp.

const char * RakString::ToUpper ( void )

Change all characters to uppercase.

Definition at line 374 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, Clone(), and sharedString.

unsigned char RakString::ToUpper ( unsigned char c )
protected

Definition at line 1558 of file RakString.cpp.

void RakString::Truncate ( unsigned int length )

Make sure string is no longer than length.

Definition at line 623 of file RakString.cpp.

References GetLength(), and SetChar().

void RakString::TruncateUTF8 ( unsigned int length )

Definition at line 593 of file RakString.cpp.

References SLNet::RakString::SharedString::c_str, and sharedString.

void RakString::UnlockMutex ( void )
static

Definition at line 1568 of file RakString.cpp.

References GetPoolMutex(), and SLNet::SimpleMutex::Unlock().

Referenced by Allocate(), Free(), FreeMemory(), and operator+().

SLNet::RakString & RakString::URLDecode ( void )

URL decode the string.

Definition at line 905 of file RakString.cpp.

References Allocate(), SLNet::RakString::SharedString::c_str, and sharedString.

SLNet::RakString & RakString::URLEncode ( void )

URL Encode the string. See http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4029/.

Definition at line 869 of file RakString.cpp.

References Allocate(), SLNet::RakString::SharedString::c_str, Itoa(), and sharedString.

Member Data Documentation

RakString::SharedString RakString::emptyString ={0,0,0,(char*) "",(char*) ""}
static

Definition at line 328 of file string.h.

Referenced by Assign(), Clone(), Free(), IsEmpty(), operator+(), operator=(), and RakString().

DataStructures::List< RakString::SharedString * > RakString::freeList
static

Definition at line 334 of file string.h.

Referenced by Allocate(), Free(), FreeMemoryNoMutex(), and operator+().

SharedString* SLNet::RakString::sharedString

Definition at line 323 of file string.h.

Referenced by Allocate(), AppendBytes(), Assign(), Clone(), ContainsNonprintableExceptSpaces(), Deserialize(), Erase(), Find(), FPrintf(), Free(), GetCharacterCount(), GetLength(), GetLengthUTF8(), IPAddressMatch(), IsEmailAddress(), IsEmpty(), MakeFilePath(), operator!=(), operator+(), operator+=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), operator[](), Printf(), RakString(), RemoveCharacter(), Replace(), Serialize(), SetChar(), SplitURI(), SQLEscape(), StartAfterFirstCharacter(), StartAfterLastCharacter(), StrCmp(), StrICmp(), StrNCmp(), SubStr(), TerminateAtFirstCharacter(), TerminateAtLastCharacter(), ToLower(), ToUpper(), TruncateUTF8(), URLDecode(), and URLEncode().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/string.h
  • Source/src/RakString.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::StringCompressor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StringCompressor
Public Member Functions | Static Public Member Functions | List of all members
SLNet::StringCompressor Class Reference

Writes and reads strings to and from bitstreams. More...

#include <slikenet/StringCompressor.h>

Public Member Functions

~StringCompressor ()
void | GenerateTreeFromStrings (unsigned char *input, unsigned inputLength, uint8_t languageId)
void | EncodeString (const char *input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId=0)
bool | DecodeString (char *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId=0)
void | EncodeString (const SLNet::RakString *input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId=0)
bool | DecodeString (SLNet::RakString *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId=0)
StringCompressor ()

Static Public Member Functions

static StringCompressor * | Instance (void)
static void | AddReference (void)
Used so I can allocate and deallocate this singleton at runtime.
static void | RemoveReference (void)
Used so I can allocate and deallocate this singleton at runtime.

Detailed Description

Writes and reads strings to and from bitstreams.

Only works with ASCII strings. The default compression is for English. You can call GenerateTreeFromStrings to compress and decompress other languages efficiently as well.

Definition at line 51 of file StringCompressor.h.

Constructor & Destructor Documentation

StringCompressor::~StringCompressor ( )

Definition at line 365 of file StringCompressor.cpp.

References _FILE_AND_LINE_, SLNet::OP_DELETE(), and DataStructures::Map< key_type, data_type, key_comparison_func >::Size().

StringCompressor::StringCompressor ( )

Definition at line 327 of file StringCompressor.cpp.

References _FILE_AND_LINE_, englishCharacterFrequencies, SLNet::HuffmanEncodingTree::GenerateFromFrequencyTable(), DataStructures::Map< key_type, data_type, key_comparison_func >::IMPLEMENT_DEFAULT_COMPARISON(), and DataStructures::Map< key_type, data_type, key_comparison_func >::Set().

Member Function Documentation

void StringCompressor::AddReference ( void )
static

Used so I can allocate and deallocate this singleton at runtime.

Definition at line 41 of file StringCompressor.cpp.

References _FILE_AND_LINE_.

Referenced by SLNet::RakPeer::RakPeer().

bool StringCompressor::DecodeString | ( | char * | output,
 |  | int | maxCharsToWrite,
 |  | SLNet::BitStream * | input,
 |  | uint8_t | languageId = 0
 | ) |  |

Writes input to output, uncompressed. Takes care of the null terminator for you.

Parameters
[out] | output | A block of bytes to receive the output
[in] | maxCharsToWrite | Size, in bytes, of output . A NULL terminator will always be appended to the output string. If the maxCharsToWrite is not large enough, the string will be truncated.
[in] | input | The bitstream containing the compressed string
[in] | languageID | Which language to use

Definition at line 404 of file StringCompressor.cpp.

References SLNet::HuffmanEncodingTree::DecodeArray(), DataStructures::Map< key_type, data_type, key_comparison_func >::Get(), SLNet::BitStream::GetNumberOfUnreadBits(), DataStructures::Map< key_type, data_type, key_comparison_func >::Has(), and SLNet::BitStream::ReadCompressed().

Referenced by SLNet::StringTable::DecodeString(), DecodeString(), SLNet::TableSerializer::DeserializeColumns(), SLNet::RakString::DeserializeCompressed(), and SLNet::TableSerializer::DeserializeFilterQuery().

bool StringCompressor::DecodeString | ( | SLNet::RakString * | output,
 |  | int | maxCharsToWrite,
 |  | SLNet::BitStream * | input,
 |  | uint8_t | languageId = 0
 | ) |  |

Definition at line 486 of file StringCompressor.cpp.

References _FILE_AND_LINE_, SLNet::RakString::Clear(), DecodeString(), MAX_ALLOCA_STACK_ALLOCATION, rakFree_Ex, and rakMalloc_Ex.

void StringCompressor::EncodeString | ( | const char * | input,
 |  | int | maxCharsToWrite,
 |  | SLNet::BitStream * | output,
 |  | uint8_t | languageId = 0
 | ) |  |

Writes input to output, compressed. Takes care of the null terminator for you.

Parameters
[in] | input | Pointer to an ASCII string
[in] | maxCharsToWrite | The max number of bytes to write of input. Use 0 to mean no limit.
[out] | output | The bitstream to write the compressed string to
[in] | languageID | Which language to use

Definition at line 371 of file StringCompressor.cpp.

References SLNet::HuffmanEncodingTree::EncodeArray(), DataStructures::Map< key_type, data_type, key_comparison_func >::Get(), SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfBitsUsed(), DataStructures::Map< key_type, data_type, key_comparison_func >::Has(), return, SLNet::BitStream::WriteBits(), and SLNet::BitStream::WriteCompressed().

Referenced by SLNet::StringTable::EncodeString(), EncodeString(), SLNet::TableSerializer::SerializeCell(), SLNet::TableSerializer::SerializeColumns(), SLNet::RakString::SerializeCompressed(), and SLNet::TableSerializer::SerializeFilterQuery().

void StringCompressor::EncodeString | ( | const SLNet::RakString * | input,
 |  | int | maxCharsToWrite,
 |  | SLNet::BitStream * | output,
 |  | uint8_t | languageId = 0
 | ) |  |

Definition at line 482 of file StringCompressor.cpp.

References SLNet::RakString::C_String(), and EncodeString().

void StringCompressor::GenerateTreeFromStrings | ( | unsigned char * | input,
 |  | unsigned | inputLength,
 |  | uint8_t | languageId
 | ) |  |

Given an array of strings, such as a chat log, generate the optimal encoding tree for it. This function is optional and if it is not called a default tree will be used instead.

Parameters
[in] | input | An array of bytes which should point to text.
[in] | inputLength | Length of input
[in] | languageID | An identifier for the language / string table to generate the tree for. English is automatically created with ID 0 in the constructor.

Definition at line 337 of file StringCompressor.cpp.

References _FILE_AND_LINE_, SLNet::HuffmanEncodingTree::GenerateFromFrequencyTable(), DataStructures::Map< key_type, data_type, key_comparison_func >::Get(), DataStructures::Map< key_type, data_type, key_comparison_func >::Has(), SLNet::OP_DELETE(), return, and DataStructures::Map< key_type, data_type, key_comparison_func >::Set().

StringCompressor * StringCompressor::Instance ( void )
static

static function because only static functions can access static members The RakPeer constructor adds a reference to this class, so don't call this until an instance of RakPeer exists, or unless you call AddReference yourself.

Returns
the unique instance of the StringCompressor

Definition at line 62 of file StringCompressor.cpp.

Referenced by SLNet::StringTable::DecodeString(), SLNet::TableSerializer::DeserializeCell(), SLNet::TableSerializer::DeserializeColumns(), SLNet::RakString::DeserializeCompressed(), SLNet::TableSerializer::DeserializeFilterQuery(), SLNet::StringTable::EncodeString(), SLNet::TableSerializer::SerializeCell(), SLNet::TableSerializer::SerializeColumns(), SLNet::RakString::SerializeCompressed(), and SLNet::TableSerializer::SerializeFilterQuery().

void StringCompressor::RemoveReference ( void )
static

Used so I can allocate and deallocate this singleton at runtime.

Definition at line 48 of file StringCompressor.cpp.

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

Referenced by SLNet::RakPeer::~RakPeer().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/StringCompressor.h
  • Source/src/StringCompressor.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::StringTable Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StringTable
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
SLNet::StringTable Class Reference

Writes a string index, instead of the whole string. More...

#include <slikenet/StringTable.h>

Public Member Functions

~StringTable ()
void | AddString (const char *str, bool copyString)
void | EncodeString (const char *input, int maxCharsToWrite, SLNet::BitStream *output)
bool | DecodeString (char *output, int maxCharsToWrite, SLNet::BitStream *input)
StringTable ()
Private Constructor.

Static Public Member Functions

static StringTable * | Instance (void)
static void | AddReference (void)
Used so I can allocate and deallocate this singleton at runtime.
static void | RemoveReference (void)
Used so I can allocate and deallocate this singleton at runtime.

Protected Member Functions

void LogStringNotFound (const char *strName)

Protected Attributes

DataStructures::OrderedList
< char *, StrAndBool,
StrAndBoolComp > 		orderedStringList

Static Protected Attributes

static StringTable * | instance =0
Singleton instance.
static int | referenceCount =0

Detailed Description

Writes a string index, instead of the whole string.

This is an even more efficient alternative to StringCompressor in that it writes a single byte from a lookup table and only does compression.
if the string does not already exist in the table.
All string tables must match on all systems - hence you must add all the strings in the same order on all systems.
Furthermore, this must be done before sending packets that use this class, since the strings are ordered for fast lookup. Adding after that time would mess up all the indices so don't do it.
Don't use this class to write strings which were not previously registered with AddString, since you just waste bandwidth then. Use StringCompressor instead.

Definition at line 55 of file StringTable.h.

Constructor & Destructor Documentation

StringTable::~StringTable ( )

Definition at line 40 of file StringTable.cpp.

References _FILE_AND_LINE_, orderedStringList, rakFree_Ex, and DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Size().

StringTable::StringTable ( )

Private Constructor.

Definition at line 35 of file StringTable.cpp.

Member Function Documentation

void StringTable::AddReference ( void )
static

Used so I can allocate and deallocate this singleton at runtime.

Definition at line 50 of file StringTable.cpp.

References _FILE_AND_LINE_, instance, and referenceCount.

Referenced by SLNet::RakPeer::RakPeer().

void StringTable::AddString | ( | const char * | str,
 |  | bool | copyString
 | ) |  |

Add a string to the string table.

Parameters
[in] | str | The string to add to the string table
[in] | copyString | true to make a copy of the passed string (takes more memory), false to not do so (if your string is in static memory).

Definition at line 76 of file StringTable.cpp.

References _FILE_AND_LINE_, StrAndBool::b, DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Insert(), orderedStringList, RakAssert, rakMalloc_Ex, DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Size(), and StrAndBool::str.

bool StringTable::DecodeString | ( | char * | output,
 |  | int | maxCharsToWrite,
 |  | SLNet::BitStream * | input
 | ) |  |

Writes input to output, uncompressed. Takes care of the null terminator for you. Relies on the StringCompressor class, which is automatically reference counted in the constructor and destructor in RakPeer. You can call the reference counting functions yourself if you wish too.

Parameters
[out] | output | A block of bytes to receive the output
[in] | maxCharsToWrite | Size, in bytes, of output . A NULL terminator will always be appended to the output string. If the maxCharsToWrite is not large enough, the string will be truncated.
[in] | input | The bitstream containing the compressed string

Definition at line 116 of file StringTable.cpp.

References SLNet::StringCompressor::DecodeString(), SLNet::StringCompressor::Instance(), orderedStringList, RakAssert, SLNet::BitStream::Read(), and DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Size().

void StringTable::EncodeString | ( | const char * | input,
 |  | int | maxCharsToWrite,
 |  | SLNet::BitStream * | output
 | ) |  |

Writes input to output, compressed. Takes care of the null terminator for you. Relies on the StringCompressor class, which is automatically reference counted in the constructor and destructor in RakPeer. You can call the reference counting functions yourself if you wish too.

Parameters
[in] | input | Pointer to an ASCII string
[in] | maxCharsToWrite | The size of input
[out] | output | The bitstream to write the compressed string to

Definition at line 97 of file StringTable.cpp.

References SLNet::StringCompressor::EncodeString(), DataStructures::OrderedList< key_type, data_type, default_comparison_function >::GetIndexFromKey(), SLNet::StringCompressor::Instance(), LogStringNotFound(), orderedStringList, and SLNet::BitStream::Write().

StringTable * StringTable::Instance ( void )
static

static function because only static functions can access static members The RakPeer constructor adds a reference to this class, so don't call this until an instance of RakPeer exists, or unless you call AddReference yourself.

Returns
the unique instance of the StringTable

Definition at line 71 of file StringTable.cpp.

References instance.

void StringTable::LogStringNotFound ( const char * strName )
protected

Called when you mess up and send a string using this class that was not registered with AddString

Parameters
[in] maxCharsToWrite Size, in bytes, of output . A NULL terminator will always be appended to the output string. If the maxCharsToWrite is not large enough, the string will be truncated.

Definition at line 150 of file StringTable.cpp.

References RAKNET_DEBUG_PRINTF.

Referenced by EncodeString().

void StringTable::RemoveReference ( void )
static

Used so I can allocate and deallocate this singleton at runtime.

Definition at line 57 of file StringTable.cpp.

References _FILE_AND_LINE_, instance, SLNet::OP_DELETE(), RakAssert, and referenceCount.

Referenced by SLNet::RakPeer::~RakPeer().

Member Data Documentation

StringTable * StringTable::instance =0
staticprotected

Singleton instance.

Definition at line 101 of file StringTable.h.

Referenced by AddReference(), Instance(), and RemoveReference().

DataStructures::OrderedList<char *, StrAndBool, StrAndBoolComp> SLNet::StringTable::orderedStringList
protected

Definition at line 104 of file StringTable.h.

Referenced by AddString(), DecodeString(), EncodeString(), and ~StringTable().

int StringTable::referenceCount =0
staticprotected

Definition at line 102 of file StringTable.h.

Referenced by AddReference(), and RemoveReference().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/StringTable.h
  • Source/src/StringTable.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::TableSerializer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • TableSerializer
Static Public Member Functions | List of all members
SLNet::TableSerializer Class Reference

#include <slikenet/TableSerializer.h>

Static Public Member Functions

static void | SerializeTable (DataStructures::Table *in, SLNet::BitStream *out)
static bool | DeserializeTable (unsigned char *serializedTable, unsigned int dataLength, DataStructures::Table *out)
static bool | DeserializeTable (SLNet::BitStream *in, DataStructures::Table *out)
static void | SerializeColumns (DataStructures::Table *in, SLNet::BitStream *out)
static void | SerializeColumns (DataStructures::Table *in, SLNet::BitStream *out, DataStructures::List< int > &skipColumnIndices)
static bool | DeserializeColumns (SLNet::BitStream *in, DataStructures::Table *out)
static void | SerializeRow (DataStructures::Table::Row *in, unsigned keyIn, const DataStructures::List< DataStructures::Table::ColumnDescriptor > &columns, SLNet::BitStream *out)
static void | SerializeRow (DataStructures::Table::Row *in, unsigned keyIn, const DataStructures::List< DataStructures::Table::ColumnDescriptor > &columns, SLNet::BitStream *out, DataStructures::List< int > &skipColumnIndices)
static bool | DeserializeRow (SLNet::BitStream *in, DataStructures::Table *out)
static void | SerializeCell (SLNet::BitStream *out, DataStructures::Table::Cell *cell, DataStructures::Table::ColumnType columnType)
static bool | DeserializeCell (SLNet::BitStream *in, DataStructures::Table::Cell *cell, DataStructures::Table::ColumnType columnType)
static void | SerializeFilterQuery (SLNet::BitStream *in, DataStructures::Table::FilterQuery *query)
static bool | DeserializeFilterQuery (SLNet::BitStream *out, DataStructures::Table::FilterQuery *query)
static void | SerializeFilterQueryList (SLNet::BitStream *in, DataStructures::Table::FilterQuery *query, unsigned int numQueries, unsigned int maxQueries)
static bool | DeserializeFilterQueryList (SLNet::BitStream *out, DataStructures::Table::FilterQuery **query, unsigned int *numQueries, unsigned int maxQueries, int allocateExtraQueries=0)
static void | DeallocateQueryList (DataStructures::Table::FilterQuery *query, unsigned int numQueries)

Detailed Description

Definition at line 31 of file TableSerializer.h.

Member Function Documentation

void TableSerializer::DeallocateQueryList | ( | DataStructures::Table::FilterQuery * | query,
 |  | unsigned int | numQueries
 | ) |  |
static

Definition at line 326 of file TableSerializer.cpp.

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

bool TableSerializer::DeserializeCell | ( | SLNet::BitStream * | in,
 |  | DataStructures::Table::Cell * | cell,
 |  | DataStructures::Table::ColumnType | columnType
 | ) |  |
static

Definition at line 193 of file TableSerializer.cpp.

References SLNet::BitStream::AlignReadToByteBoundary(), DataStructures::Table::BINARY, BITS_TO_BYTES, BYTES_TO_BITS, DataStructures::Table::Cell::Clear(), SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfUnreadBits(), SLNet::BitStream::GetReadOffset(), SLNet::BitStream::IgnoreBits(), SLNet::StringCompressor::Instance(), DataStructures::Table::NUMERIC, DataStructures::Table::POINTER, RakAssert, SLNet::BitStream::Read(), DataStructures::Table::Cell::Set(), DataStructures::Table::Cell::SetPtr(), and DataStructures::Table::STRING.

Referenced by DeserializeRow().

bool TableSerializer::DeserializeColumns | ( | SLNet::BitStream * | in,
 |  | DataStructures::Table * | out
 | ) |  |
static

Definition at line 88 of file TableSerializer.cpp.

References _TABLE_MAX_COLUMN_NAME_LENGTH, DataStructures::Table::AddColumn(), DataStructures::Table::Clear(), SLNet::StringCompressor::DecodeString(), SLNet::StringCompressor::Instance(), and SLNet::BitStream::Read().

Referenced by DeserializeTable().

bool TableSerializer::DeserializeFilterQuery | ( | SLNet::BitStream * | out,
 |  | DataStructures::Table::FilterQuery * | query
 | ) |  |
static

Definition at line 253 of file TableSerializer.cpp.

References _TABLE_MAX_COLUMN_NAME_LENGTH, DataStructures::Table::Cell::c, DataStructures::Table::FilterQuery::cellValue, DataStructures::Table::Cell::Clear(), DataStructures::Table::FilterQuery::columnIndex, DataStructures::Table::FilterQuery::columnName, SLNet::StringCompressor::DecodeString(), DataStructures::Table::Cell::i, SLNet::StringCompressor::Instance(), DataStructures::Table::Cell::isEmpty, DataStructures::Table::FilterQuery::operation, DataStructures::Table::Cell::ptr, RakAssert, SLNet::BitStream::Read(), SLNet::BitStream::ReadAlignedBytesSafeAlloc(), and SLNet::BitStream::ReadCompressed().

Referenced by DeserializeFilterQueryList().

bool TableSerializer::DeserializeFilterQueryList | ( | SLNet::BitStream * | out,
 |  | DataStructures::Table::FilterQuery ** | query,
 |  | unsigned int * | numQueries,
 |  | unsigned int | maxQueries,
 |  | int | allocateExtraQueries = 0
 | ) |  |
static

Definition at line 291 of file TableSerializer.cpp.

References DataStructures::Table::FilterQuery::cellValue, DeserializeFilterQuery(), RakAssert, SLNet::BitStream::Read(), and SLNet::BitStream::ReadCompressed().

bool TableSerializer::DeserializeRow | ( | SLNet::BitStream * | in,
 |  | DataStructures::Table * | out
 | ) |  |
static

Definition at line 141 of file TableSerializer.cpp.

References DataStructures::Table::AddRow(), DataStructures::Table::Row::cells, DeserializeCell(), DataStructures::Table::GetColumns(), SLNet::BitStream::Read(), and DataStructures::Table::RemoveRow().

Referenced by DeserializeTable().

bool TableSerializer::DeserializeTable | ( | unsigned char * | serializedTable,
 |  | unsigned int | dataLength,
 |  | DataStructures::Table * | out
 | ) |  |
static

Definition at line 65 of file TableSerializer.cpp.

bool TableSerializer::DeserializeTable | ( | SLNet::BitStream * | in,
 |  | DataStructures::Table * | out
 | ) |  |
static

Definition at line 70 of file TableSerializer.cpp.

References DeserializeColumns(), DeserializeRow(), RakAssert, and SLNet::BitStream::Read().

void TableSerializer::SerializeCell | ( | SLNet::BitStream * | out,
 |  | DataStructures::Table::Cell * | cell,
 |  | DataStructures::Table::ColumnType | columnType
 | ) |  |
static

Definition at line 164 of file TableSerializer.cpp.

References DataStructures::Table::BINARY, DataStructures::Table::Cell::c, SLNet::StringCompressor::EncodeString(), DataStructures::Table::Cell::i, SLNet::StringCompressor::Instance(), DataStructures::Table::Cell::isEmpty, DataStructures::Table::NUMERIC, DataStructures::Table::POINTER, DataStructures::Table::Cell::ptr, RakAssert, DataStructures::Table::STRING, SLNet::BitStream::Write(), and SLNet::BitStream::WriteAlignedBytes().

Referenced by SerializeRow().

void TableSerializer::SerializeColumns | ( | DataStructures::Table * | in,
 |  | SLNet::BitStream * | out
 | ) |  |
static

Definition at line 40 of file TableSerializer.cpp.

References _TABLE_MAX_COLUMN_NAME_LENGTH, SLNet::StringCompressor::EncodeString(), DataStructures::Table::GetColumns(), SLNet::StringCompressor::Instance(), DataStructures::List< list_type >::Size(), and SLNet::BitStream::Write().

Referenced by SerializeTable().

void TableSerializer::SerializeColumns | ( | DataStructures::Table * | in,
 |  | SLNet::BitStream * | out,
 |  | DataStructures::List< int > & | skipColumnIndices
 | ) |  |
static

Definition at line 51 of file TableSerializer.cpp.

References _TABLE_MAX_COLUMN_NAME_LENGTH, SLNet::StringCompressor::EncodeString(), DataStructures::Table::GetColumns(), DataStructures::List< list_type >::GetIndexOf(), SLNet::StringCompressor::Instance(), DataStructures::List< list_type >::Size(), and SLNet::BitStream::Write().

void TableSerializer::SerializeFilterQuery | ( | SLNet::BitStream * | in,
 |  | DataStructures::Table::FilterQuery * | query
 | ) |  |
static

Definition at line 239 of file TableSerializer.cpp.

References _TABLE_MAX_COLUMN_NAME_LENGTH, DataStructures::Table::Cell::c, DataStructures::Table::FilterQuery::cellValue, DataStructures::Table::FilterQuery::columnIndex, DataStructures::Table::FilterQuery::columnName, SLNet::StringCompressor::EncodeString(), DataStructures::Table::Cell::i, SLNet::StringCompressor::Instance(), DataStructures::Table::Cell::isEmpty, DataStructures::Table::FilterQuery::operation, DataStructures::Table::Cell::ptr, SLNet::BitStream::Write(), SLNet::BitStream::WriteAlignedBytesSafe(), and SLNet::BitStream::WriteCompressed().

Referenced by SerializeFilterQueryList().

void TableSerializer::SerializeFilterQueryList | ( | SLNet::BitStream * | in,
 |  | DataStructures::Table::FilterQuery * | query,
 |  | unsigned int | numQueries,
 |  | unsigned int | maxQueries
 | ) |  |
static

Definition at line 276 of file TableSerializer.cpp.

References RakAssert, SerializeFilterQuery(), SLNet::BitStream::Write(), and SLNet::BitStream::WriteCompressed().

void TableSerializer::SerializeRow | ( | DataStructures::Table::Row * | in,
 |  | unsigned | keyIn,
 |  | const DataStructures::List< DataStructures::Table::ColumnDescriptor > & | columns,
 |  | SLNet::BitStream * | out
 | ) |  |
static

Definition at line 106 of file TableSerializer.cpp.

References DataStructures::Table::Row::cells, SerializeCell(), DataStructures::List< list_type >::Size(), and SLNet::BitStream::Write().

Referenced by SerializeTable().

void TableSerializer::SerializeRow | ( | DataStructures::Table::Row * | in,
 |  | unsigned | keyIn,
 |  | const DataStructures::List< DataStructures::Table::ColumnDescriptor > & | columns,
 |  | SLNet::BitStream * | out,
 |  | DataStructures::List< int > & | skipColumnIndices
 | ) |  |
static

Definition at line 118 of file TableSerializer.cpp.

References DataStructures::Table::Row::cells, DataStructures::List< list_type >::GetIndexOf(), SerializeCell(), DataStructures::List< list_type >::Size(), and SLNet::BitStream::Write().

void TableSerializer::SerializeTable | ( | DataStructures::Table * | in,
 |  | SLNet::BitStream * | out
 | ) |  |
static

Definition at line 24 of file TableSerializer.cpp.

References DataStructures::Page< KeyType, DataType, order >::data, DataStructures::Table::GetColumns(), DataStructures::BPlusTree< KeyType, DataType, order >::GetListHead(), DataStructures::Table::GetRows(), DataStructures::Page< KeyType, DataType, order >::keys, DataStructures::Page< KeyType, DataType, order >::next, SerializeColumns(), SerializeRow(), DataStructures::Page< KeyType, DataType, order >::size, DataStructures::BPlusTree< KeyType, DataType, order >::Size(), and SLNet::BitStream::Write().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/TableSerializer.h
  • Source/src/TableSerializer.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::TCPInterface Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • TCPInterface
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::TCPInterface Class Reference

#include <slikenet/TCPInterface.h>

+ Inheritance diagram for SLNet::TCPInterface:

Classes

struct ThisPtrPlusSysAddr

Public Member Functions

TCPInterface ()
virtual | ~TCPInterface ()
bool | Start (unsigned short port, unsigned short maxIncomingConnections, unsigned short maxConnections=0, int _threadPriority=-99999, unsigned short socketFamily=AF_INET, const char *bindAddress=0)
void | Stop (void)
Stops the TCP server.
SystemAddress | Connect (const char *host, unsigned short remotePort, bool block=true, unsigned short socketFamily=AF_INET, const char *bindAddress=0)
Connect to the specified host on the specified port.
virtual void | Send (const char *data, unsigned int length, const SystemAddress &systemAddress, bool broadcast)
Sends a byte stream.
virtual bool | SendList (const char **data, const unsigned int *lengths, const int numParameters, const SystemAddress &systemAddress, bool broadcast)
unsigned int | GetOutgoingDataBufferSize (SystemAddress systemAddress) const
virtual bool | ReceiveHasPackets (void)
virtual Packet * | Receive (void)
Returns data received.
void | CloseConnection (SystemAddress systemAddress)
Disconnects a player/address.
void | DeallocatePacket (Packet *packet)
Deallocates a packet returned by Receive.
void | GetConnectionList (SystemAddress *remoteSystems, unsigned short *numberOfSystems) const
unsigned short | GetConnectionCount (void) const
Returns just the number of connections we have.
SystemAddress | HasCompletedConnectionAttempt (void)
SystemAddress | HasFailedConnectionAttempt (void)
SystemAddress | HasNewIncomingConnection (void)
Queued events of new incoming connections.
SystemAddress | HasLostConnection (void)
Queued events of lost connections.
Packet * | AllocatePacket (unsigned dataSize)
Return an allocated but empty packet, for custom use.
virtual void | PushBackPacket (Packet *packet, bool pushAtHead)
bool | WasStarted (void) const
Returns if Start() was called successfully.
void | AttachPlugin (PluginInterface2 *plugin)
void | DetachPlugin (PluginInterface2 *plugin)

Protected Member Functions

Packet * | ReceiveInt (void)
bool | CreateListenSocket (unsigned short port, unsigned short maxIncomingConnections, unsigned short socketFamily, const char *hostAddress)
friend | RAK_THREAD_DECLARATION (UpdateTCPInterfaceLoop)
friend | RAK_THREAD_DECLARATION (ConnectionAttemptLoop)
__TCPSOCKET__ | SocketConnect (const char *host, unsigned short remotePort, unsigned short socketFamily, const char *bindAddress)

Protected Attributes

DataStructures::List
< PluginInterface2 * > 		messageHandlerList
SLNet::LocklessUint32_t isStarted
SLNet::LocklessUint32_t threadRunning
__TCPSOCKET__ listenSocket
DataStructures::Queue< Packet * > headPush
DataStructures::Queue< Packet * > tailPush
RemoteClient * remoteClients
unsigned short | remoteClientsLength
DataStructures::ThreadsafeAllocatingQueue
< Packet > 		incomingMessages
DataStructures::ThreadsafeAllocatingQueue
< SystemAddress > 		newIncomingConnections
DataStructures::ThreadsafeAllocatingQueue
< SystemAddress > 		lostConnections
DataStructures::ThreadsafeAllocatingQueue
< SystemAddress > 		requestedCloseConnections
DataStructures::ThreadsafeAllocatingQueue
< RemoteClient * > 		newRemoteClients
SimpleMutex completedConnectionAttemptMutex
SimpleMutex failedConnectionAttemptMutex
DataStructures::Queue
< SystemAddress > 		completedConnectionAttempts
DataStructures::Queue
< SystemAddress > 		failedConnectionAttempts
int | threadPriority
DataStructures::List
< __TCPSOCKET__ > 		blockingSocketList
SimpleMutex blockingSocketListMutex

Detailed Description

Definition at line 56 of file TCPInterface.h.

Class Documentation

struct SLNet::TCPInterface::ThisPtrPlusSysAddr

Definition at line 205 of file TCPInterface.h.

Class Members
char | bindAddress
unsigned short | socketFamily
SystemAddress | systemAddress
TCPInterface * | tcpInterface
bool | useSSL

Constructor & Destructor Documentation

SLNet::TCPInterface::TCPInterface ( )
virtual SLNet::TCPInterface::~TCPInterface ( )
virtual

Member Function Documentation

Packet* SLNet::TCPInterface::AllocatePacket ( unsigned dataSize )

Return an allocated but empty packet, for custom use.

Referenced by SLNet::PluginInterface2::AllocatePacketUnified().

void SLNet::TCPInterface::AttachPlugin ( PluginInterface2 * plugin )
void SLNet::TCPInterface::CloseConnection ( SystemAddress systemAddress )

Disconnects a player/address.

SystemAddress SLNet::TCPInterface::Connect | ( | const char * | host,
 |  | unsigned short | remotePort,
 |  | bool | block = true,
 |  | unsigned short | socketFamily = AF_INET,
 |  | const char * | bindAddress = 0
 | ) |  |

Connect to the specified host on the specified port.

bool SLNet::TCPInterface::CreateListenSocket | ( | unsigned short | port,
 |  | unsigned short | maxIncomingConnections,
 |  | unsigned short | socketFamily,
 |  | const char * | hostAddress
 | ) |  |
protected
void SLNet::TCPInterface::DeallocatePacket ( Packet * packet )

Deallocates a packet returned by Receive.

Referenced by SLNet::PluginInterface2::DeallocPacketUnified().

void SLNet::TCPInterface::DetachPlugin ( PluginInterface2 * plugin )
unsigned short SLNet::TCPInterface::GetConnectionCount ( void ) const

Returns just the number of connections we have.

void SLNet::TCPInterface::GetConnectionList | ( | SystemAddress * | remoteSystems,
 |  | unsigned short * | numberOfSystems
 | ) |  | const

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 only 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
unsigned int SLNet::TCPInterface::GetOutgoingDataBufferSize ( SystemAddress systemAddress ) const
SystemAddress SLNet::TCPInterface::HasCompletedConnectionAttempt ( void )

Has a previous call to connect succeeded?

Returns
UNASSIGNED_SYSTEM_ADDRESS = no. Anything else means yes.
SystemAddress SLNet::TCPInterface::HasFailedConnectionAttempt ( void )

Has a previous call to connect failed?

Returns
UNASSIGNED_SYSTEM_ADDRESS = no. Anything else means yes.
SystemAddress SLNet::TCPInterface::HasLostConnection ( void )

Queued events of lost connections.

SystemAddress SLNet::TCPInterface::HasNewIncomingConnection ( void )

Queued events of new incoming connections.

virtual void SLNet::TCPInterface::PushBackPacket | ( | Packet * | packet,
 |  | bool | pushAtHead
 | ) |  |
virtual

Referenced by SLNet::PluginInterface2::PushBackPacketUnified().

SLNet::TCPInterface::RAK_THREAD_DECLARATION ( UpdateTCPInterfaceLoop )
protected
SLNet::TCPInterface::RAK_THREAD_DECLARATION ( ConnectionAttemptLoop )
protected
virtual Packet* SLNet::TCPInterface::Receive ( void )
virtual

Returns data received.

Reimplemented in SLNet::PacketizedTCP.

virtual bool SLNet::TCPInterface::ReceiveHasPackets ( void )
virtual

Returns if Receive() will return data Do not use on PacketizedTCP

Packet* SLNet::TCPInterface::ReceiveInt ( void )
protected
virtual void SLNet::TCPInterface::Send | ( | const char * | data,
 |  | unsigned int | length,
 |  | const SystemAddress & | systemAddress,
 |  | bool | broadcast
 | ) |  |
virtual

Sends a byte stream.

Referenced by SLNet::PluginInterface2::SendUnified().

virtual bool SLNet::TCPInterface::SendList | ( | const char ** | data,
 |  | const unsigned int * | lengths,
 |  | const int | numParameters,
 |  | const SystemAddress & | systemAddress,
 |  | bool | broadcast
 | ) |  |
virtual

Reimplemented in SLNet::PacketizedTCP.

Referenced by SLNet::PluginInterface2::SendListUnified().

__TCPSOCKET__ SLNet::TCPInterface::SocketConnect | ( | const char * | host,
 |  | unsigned short | remotePort,
 |  | unsigned short | socketFamily,
 |  | const char * | bindAddress
 | ) |  |
protected
bool SLNet::TCPInterface::Start | ( | unsigned short | port,
 |  | unsigned short | maxIncomingConnections,
 |  | unsigned short | maxConnections = 0,
 |  | int | _threadPriority = -99999,
 |  | unsigned short | socketFamily = AF_INET,
 |  | const char * | bindAddress = 0
 | ) |  |

Starts the TCP server on the indicated port

Parameters
[in] | port | Which port to listen on.
[in] | maxIncomingConnections | Max incoming connections we will accept
[in] | maxConnections | Max total connections, which should be >= maxIncomingConnections
[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.
[in] | socketFamily | IP version: For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC.
void SLNet::TCPInterface::Stop ( void )

Stops the TCP server.

bool SLNet::TCPInterface::WasStarted ( void ) const

Returns if Start() was called successfully.

Member Data Documentation

DataStructures::List<__TCPSOCKET__> SLNet::TCPInterface::blockingSocketList
protected

Definition at line 191 of file TCPInterface.h.

SimpleMutex SLNet::TCPInterface::blockingSocketListMutex
protected

Definition at line 192 of file TCPInterface.h.

SimpleMutex SLNet::TCPInterface::completedConnectionAttemptMutex
protected

Definition at line 186 of file TCPInterface.h.

DataStructures::Queue<SystemAddress> SLNet::TCPInterface::completedConnectionAttempts
protected

Definition at line 187 of file TCPInterface.h.

SimpleMutex SLNet::TCPInterface::failedConnectionAttemptMutex
protected

Definition at line 186 of file TCPInterface.h.

DataStructures::Queue<SystemAddress> SLNet::TCPInterface::failedConnectionAttempts
protected

Definition at line 187 of file TCPInterface.h.

DataStructures::Queue<Packet*> SLNet::TCPInterface::headPush
protected

Definition at line 159 of file TCPInterface.h.

DataStructures::ThreadsafeAllocatingQueue<Packet> SLNet::TCPInterface::incomingMessages
protected

Definition at line 183 of file TCPInterface.h.

SLNet::LocklessUint32_t SLNet::TCPInterface::isStarted
protected

Definition at line 156 of file TCPInterface.h.

__TCPSOCKET__ SLNet::TCPInterface::listenSocket
protected

Definition at line 157 of file TCPInterface.h.

DataStructures::ThreadsafeAllocatingQueue<SystemAddress> SLNet::TCPInterface::lostConnections
protected

Definition at line 184 of file TCPInterface.h.

DataStructures::List<PluginInterface2*> SLNet::TCPInterface::messageHandlerList
protected

Definition at line 154 of file TCPInterface.h.

DataStructures::ThreadsafeAllocatingQueue<SystemAddress> SLNet::TCPInterface::newIncomingConnections
protected

Definition at line 184 of file TCPInterface.h.

DataStructures::ThreadsafeAllocatingQueue<RemoteClient*> SLNet::TCPInterface::newRemoteClients
protected

Definition at line 185 of file TCPInterface.h.

RemoteClient* SLNet::TCPInterface::remoteClients
protected

Definition at line 160 of file TCPInterface.h.

unsigned short SLNet::TCPInterface::remoteClientsLength
protected

Definition at line 161 of file TCPInterface.h.

DataStructures::ThreadsafeAllocatingQueue<SystemAddress> SLNet::TCPInterface::requestedCloseConnections
protected

Definition at line 184 of file TCPInterface.h.

DataStructures::Queue<Packet*> SLNet::TCPInterface::tailPush
protected

Definition at line 159 of file TCPInterface.h.

int SLNet::TCPInterface::threadPriority
protected

Definition at line 189 of file TCPInterface.h.

SLNet::LocklessUint32_t SLNet::TCPInterface::threadRunning
protected

Definition at line 156 of file TCPInterface.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/TCPInterface.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RemoteClient Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RemoteClient
Public Member Functions | Public Attributes | List of all members
SLNet::RemoteClient Struct Reference

Stores information about a remote client. More...

#include <slikenet/TCPInterface.h>

Public Member Functions

RemoteClient ()
int | Send (const char *data, unsigned int length)
int | Recv (char *data, const int dataSize)
void | Reset (void)
void | SetActive (bool a)
void | SendOrBuffer (const char **data, const unsigned int *lengths, const int numParameters)

Public Attributes

__TCPSOCKET__ socket
SystemAddress systemAddress
DataStructures::ByteQueue outgoingData
bool isActive
SimpleMutex outgoingDataMutex
SimpleMutex isActiveMutex

Detailed Description

Stores information about a remote client.

Definition at line 224 of file TCPInterface.h.

Constructor & Destructor Documentation

SLNet::RemoteClient::RemoteClient ( )
inline

Definition at line 226 of file TCPInterface.h.

References isActive, and socket.

Member Function Documentation

int SLNet::RemoteClient::Recv | ( | char * | data,
 |  | const int | dataSize
 | ) |  |
void SLNet::RemoteClient::Reset ( void )
inline

Definition at line 253 of file TCPInterface.h.

References _FILE_AND_LINE_, DataStructures::ByteQueue::Clear(), SLNet::SimpleMutex::Lock(), outgoingData, outgoingDataMutex, and SLNet::SimpleMutex::Unlock().

int SLNet::RemoteClient::Send | ( | const char * | data,
 |  | unsigned int | length
 | ) |  |
void SLNet::RemoteClient::SendOrBuffer | ( | const char ** | data,
 |  | const unsigned int * | lengths,
 |  | const int | numParameters
 | ) |  |
void SLNet::RemoteClient::SetActive ( bool a )

Member Data Documentation

bool SLNet::RemoteClient::isActive

Definition at line 238 of file TCPInterface.h.

Referenced by RemoteClient().

SimpleMutex SLNet::RemoteClient::isActiveMutex

Definition at line 240 of file TCPInterface.h.

DataStructures::ByteQueue SLNet::RemoteClient::outgoingData

Definition at line 237 of file TCPInterface.h.

Referenced by Reset().

SimpleMutex SLNet::RemoteClient::outgoingDataMutex

Definition at line 239 of file TCPInterface.h.

Referenced by Reset().

__TCPSOCKET__ SLNet::RemoteClient::socket

Definition at line 235 of file TCPInterface.h.

Referenced by RemoteClient().

SystemAddress SLNet::RemoteClient::systemAddress

Definition at line 236 of file TCPInterface.h.

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/TCPInterface.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::TelnetTransport Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • TelnetTransport
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::TelnetTransport Class Reference

Use TelnetTransport to easily allow windows telnet to connect to your ConsoleServer. More...

#include <slikenet/TelnetTransport.h>

+ Inheritance diagram for SLNet::TelnetTransport:

Classes

struct TelnetClient

Public Member Functions

TelnetTransport ()
virtual | ~TelnetTransport ()
bool | Start (unsigned short port, bool serverMode)
void | Stop (void)
Stop the transport provider. You can clear memory and shutdown threads here.
void | Send (SystemAddress systemAddress, const char *data,...)
void | CloseConnection (SystemAddress systemAddress)
Packet * | Receive (void)
void | DeallocatePacket (Packet *packet)
SystemAddress | HasNewIncomingConnection (void)
SystemAddress | HasLostConnection (void)
CommandParserInterface * | GetCommandParser (void)
void | SetSendSuffix (const char *suffix)
void | SetSendPrefix (const char *prefix)
- Public Member Functions inherited from SLNet::TransportInterface
TransportInterface ()
virtual | ~TransportInterface ()

Protected Member Functions

void | AutoAllocate (void)
bool | ReassembleLine (TelnetTransport::TelnetClient *telnetClient, unsigned char c)

Protected Attributes

TCPInterface * tcpInterface
DataStructures::List
< TelnetClient * > 		remoteClients
char * | sendSuffix
char * | sendPrefix

Detailed Description

Use TelnetTransport to easily allow windows telnet to connect to your ConsoleServer.

To run Windows telnet, go to your start menu, click run, and in the edit box type "telnet <IP>" where <IP> is the ip address.
of your ConsoleServer (most likely the same IP as your game).
This implementation always echos commands.

Definition at line 41 of file TelnetTransport.h.

Class Documentation

struct SLNet::TelnetTransport::TelnetClient

Definition at line 62 of file TelnetTransport.h.

Class Members
unsigned | cursorPosition
char | lastSentTextInput
SystemAddress | systemAddress
char | textInput

Constructor & Destructor Documentation

SLNet::TelnetTransport::TelnetTransport ( )
virtual SLNet::TelnetTransport::~TelnetTransport ( )
virtual

Member Function Documentation

void SLNet::TelnetTransport::AutoAllocate ( void )
protected
void SLNet::TelnetTransport::CloseConnection ( SystemAddress systemAddress )
virtual

Disconnect systemAddress . The binary address and port defines the SystemAddress structure.

Parameters
[in] systemAddress The player/address to disconnect

Implements SLNet::TransportInterface.

void SLNet::TelnetTransport::DeallocatePacket ( Packet * packet )
virtual

Deallocate the Packet structure returned by Receive

Parameters
[in] The packet to deallocate

Implements SLNet::TransportInterface.

CommandParserInterface* SLNet::TelnetTransport::GetCommandParser ( void )
virtual

Your transport provider can itself have command parsers if the transport layer has user-modifiable features For example, your transport layer may have a password which you want remote users to be able to set or you may want to allow remote users to turn on or off command echo

Returns
0 if you do not need a command parser - otherwise the desired derivation of CommandParserInterface

Implements SLNet::TransportInterface.

SystemAddress SLNet::TelnetTransport::HasLostConnection ( void )
virtual

If a system loses the connection, you should queue that event and return the systemAddress/address of that player in this function.

Returns
The SystemAddress/address of the system

Implements SLNet::TransportInterface.

SystemAddress SLNet::TelnetTransport::HasNewIncomingConnection ( void )
virtual

If a new system connects to you, you should queue that event and return the systemAddress/address of that player in this function.

Returns
The SystemAddress/address of the system

Implements SLNet::TransportInterface.

bool SLNet::TelnetTransport::ReassembleLine | ( | TelnetTransport::TelnetClient * | telnetClient,
 |  | unsigned char | c
 | ) |  |
protected
Packet* SLNet::TelnetTransport::Receive ( void )
virtual

Return a string. The string should be allocated and written to Packet::data . The byte length should be written to Packet::length . The player/address should be written to Packet::systemAddress If your transport protocol adds special formatting to the data stream you should parse it out before returning it in the packet and thus only return a string in Packet::data

Returns
The packet structure containing the result of Receive, or 0 if no data is available

Implements SLNet::TransportInterface.

void SLNet::TelnetTransport::Send | ( | SystemAddress | systemAddress,
 |  | const char * | data,
 |  |  | ...
 | ) |  |
virtual

Send a null-terminated string to systemAddress If your transport method requires particular formatting of the outgoing data (e.g. you don't just send strings) you can do it here and parse it out in Receive().

Parameters
[in] | systemAddress | The player to send the string to
[in] | data | format specifier - same as RAKNET_DEBUG_PRINTF
[in] ... format specification arguments - same as RAKNET_DEBUG_PRINTF

Implements SLNet::TransportInterface.

void SLNet::TelnetTransport::SetSendPrefix ( const char * prefix )
void SLNet::TelnetTransport::SetSendSuffix ( const char * suffix )
bool SLNet::TelnetTransport::Start | ( | unsigned short | port,
 |  | bool | serverMode
 | ) |  |
virtual

Start the transport provider on the indicated port.

Parameters
[in] | port | The port to start the transport provider on
[in] | serverMode | If true, you should allow incoming connections (I don't actually use this anywhere)
Returns
Return true on success, false on failure.

Implements SLNet::TransportInterface.

void SLNet::TelnetTransport::Stop ( void )
virtual

Stop the transport provider. You can clear memory and shutdown threads here.

Implements SLNet::TransportInterface.

Member Data Documentation

DataStructures::List<TelnetClient*> SLNet::TelnetTransport::remoteClients
protected

Definition at line 75 of file TelnetTransport.h.

char * SLNet::TelnetTransport::sendPrefix
protected

Definition at line 77 of file TelnetTransport.h.

char* SLNet::TelnetTransport::sendSuffix
protected

Definition at line 77 of file TelnetTransport.h.

TCPInterface* SLNet::TelnetTransport::tcpInterface
protected

Definition at line 70 of file TelnetTransport.h.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/TelnetTransport.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakThread Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakThread
Static Public Member Functions | List of all members
SLNet::RakThread Class Reference

#include <slikenet/thread.h>

Static Public Member Functions

static int Create (void *start_address(void *), void *arglist, int priority=0)

Detailed Description

Definition at line 54 of file thread.h.

Member Function Documentation

int RakThread::Create | ( | void * | start_addressvoid *,
 |  | void * | arglist,
 |  | int | priority = 0
 | ) |  |
static

Create a thread, simplified to be cross platform without all the extra junk To then start that thread, call RakCreateThread(functionName, arguments);

Parameters
[in] | start_address | Function you want to call
[in] | arglist | Arguments to pass to the function
Returns
0=success. >0 = error code

Definition at line 49 of file RakThread.cpp.

References MAX_ALLOCA_STACK_ALLOCATION, and RakAssert.

Referenced by SLNet::RNS2_Berkley::CreateRecvPollingThread(), ThreadPool< InputType, OutputType >::StartThreads(), and SLNet::RakPeer::Startup().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/thread.h
  • Source/src/RakThread.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::TransportInterface Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • TransportInterface
Public Member Functions | List of all members
SLNet::TransportInterface Class Referenceabstract

Defines an interface that is used to send and receive null-terminated strings. More...

#include <slikenet/TransportInterface.h>

+ Inheritance diagram for SLNet::TransportInterface:

Public Member Functions

TransportInterface ()
virtual | ~TransportInterface ()
virtual bool | Start (unsigned short port, bool serverMode)=0
virtual void | Stop (void)=0
Stop the transport provider. You can clear memory and shutdown threads here.
virtual void | Send (SystemAddress systemAddress, const char *data,...)=0
virtual void | CloseConnection (SystemAddress systemAddress)=0
virtual Packet * | Receive (void)=0
virtual void | DeallocatePacket (Packet *packet)=0
virtual SystemAddress | HasNewIncomingConnection (void)=0
virtual SystemAddress | HasLostConnection (void)=0
virtual CommandParserInterface * | GetCommandParser (void)=0

Detailed Description

Defines an interface that is used to send and receive null-terminated strings.

In practice this is only used by the CommandParser system for for servers.

Definition at line 39 of file TransportInterface.h.

Constructor & Destructor Documentation

SLNet::TransportInterface::TransportInterface ( )
inline

Definition at line 42 of file TransportInterface.h.

virtual SLNet::TransportInterface::~TransportInterface ( )
inlinevirtual

Definition at line 43 of file TransportInterface.h.

Member Function Documentation

virtual void SLNet::TransportInterface::CloseConnection ( SystemAddress systemAddress )
pure virtual

Disconnect systemAddress . The binary address and port defines the SystemAddress structure.

Parameters
[in] systemAddress The player/address to disconnect

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual void SLNet::TransportInterface::DeallocatePacket ( Packet * packet )
pure virtual

Deallocate the Packet structure returned by Receive

Parameters
[in] The packet to deallocate

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual CommandParserInterface* SLNet::TransportInterface::GetCommandParser ( void )
pure virtual

Your transport provider can itself have command parsers if the transport layer has user-modifiable features For example, your transport layer may have a password which you want remote users to be able to set or you may want to allow remote users to turn on or off command echo

Returns
0 if you do not need a command parser - otherwise the desired derivation of CommandParserInterface

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual SystemAddress SLNet::TransportInterface::HasLostConnection ( void )
pure virtual

If a system loses the connection, you should queue that event and return the systemAddress/address of that player in this function.

Returns
The SystemAddress/address of the system

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual SystemAddress SLNet::TransportInterface::HasNewIncomingConnection ( void )
pure virtual

If a new system connects to you, you should queue that event and return the systemAddress/address of that player in this function.

Returns
The SystemAddress/address of the system

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual Packet* SLNet::TransportInterface::Receive ( void )
pure virtual

Return a string. The string should be allocated and written to Packet::data . The byte length should be written to Packet::length . The player/address should be written to Packet::systemAddress If your transport protocol adds special formatting to the data stream you should parse it out before returning it in the packet and thus only return a string in Packet::data

Returns
The packet structure containing the result of Receive, or 0 if no data is available

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual void SLNet::TransportInterface::Send | ( | SystemAddress | systemAddress,
 |  | const char * | data,
 |  |  | ...
 | ) |  |
pure virtual

Send a null-terminated string to systemAddress If your transport method requires particular formatting of the outgoing data (e.g. you don't just send strings) you can do it here and parse it out in Receive().

Parameters
[in] | systemAddress | The player to send the string to
[in] | data | format specifier - same as RAKNET_DEBUG_PRINTF
[in] ... format specification arguments - same as RAKNET_DEBUG_PRINTF

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

Referenced by SLNet::CommandParserInterface::ReturnResult(), and SLNet::CommandParserInterface::SendCommandList().

virtual bool SLNet::TransportInterface::Start | ( | unsigned short | port,
 |  | bool | serverMode
 | ) |  |
pure virtual

Start the transport provider on the indicated port.

Parameters
[in] | port | The port to start the transport provider on
[in] | serverMode | If true, you should allow incoming connections (I don't actually use this anywhere)
Returns
Return true on success, false on failure.

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual void SLNet::TransportInterface::Stop ( void )
pure virtual

Stop the transport provider. You can clear memory and shutdown threads here.

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

The documentation for this class was generated from the following file:
  • Source/include/slikenet/TransportInterface.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::SocketDescriptor Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SocketDescriptor
Public Member Functions | Public Attributes | List of all members
SLNet::SocketDescriptor Struct Reference

Describes the local socket to use for RakPeer::Startup. More...

#include <slikenet/types.h>

Public Member Functions

SocketDescriptor ()
SocketDescriptor (unsigned short _port, const char *_hostAddress)

Public Attributes

unsigned short | port
The local port to bind to. Pass 0 to have the OS autoassign a port.
char | hostAddress [32]
The local network card address to bind to, such as "127.0.0.1". Pass an empty string to use INADDR_ANY.
short | socketFamily
unsigned short | remotePortRakNetWasStartedOn_PS3_PSP2
_PP_Instance_ chromeInstance
bool | blockingSocket
unsigned int | extraSocketOptions
XBOX only: set IPPROTO_VDP if you want to use VDP. If enabled, this socket does not support broadcast to 255.255.255.255.

Detailed Description

Describes the local socket to use for RakPeer::Startup.

Definition at line 149 of file types.h.

Constructor & Destructor Documentation

SocketDescriptor::SocketDescriptor ( )

Definition at line 101 of file RakNetTypes.cpp.

References blockingSocket, extraSocketOptions, hostAddress, port, remotePortRakNetWasStartedOn_PS3_PSP2, and socketFamily.

SocketDescriptor::SocketDescriptor | ( | unsigned short | _port,
 |  | const char * | _hostAddress
 | ) |  |

Definition at line 108 of file RakNetTypes.cpp.

References blockingSocket, extraSocketOptions, hostAddress, port, remotePortRakNetWasStartedOn_PS3_PSP2, and socketFamily.

Member Data Documentation

bool SLNet::SocketDescriptor::blockingSocket

Definition at line 182 of file types.h.

Referenced by SocketDescriptor().

_PP_Instance_ SLNet::SocketDescriptor::chromeInstance

Definition at line 179 of file types.h.

Referenced by SLNet::RakPeer::Startup().

unsigned int SLNet::SocketDescriptor::extraSocketOptions

XBOX only: set IPPROTO_VDP if you want to use VDP. If enabled, this socket does not support broadcast to 255.255.255.255.

Definition at line 185 of file types.h.

Referenced by SocketDescriptor(), and SLNet::RakPeer::Startup().

char SLNet::SocketDescriptor::hostAddress[32]

The local network card address to bind to, such as "127.0.0.1". Pass an empty string to use INADDR_ANY.

Definition at line 158 of file types.h.

Referenced by SocketDescriptor().

unsigned short SLNet::SocketDescriptor::port

The local port to bind to. Pass 0 to have the OS autoassign a port.

Definition at line 155 of file types.h.

Referenced by SocketDescriptor(), and SLNet::RakPeer::Startup().

unsigned short SLNet::SocketDescriptor::remotePortRakNetWasStartedOn_PS3_PSP2

Definition at line 176 of file types.h.

Referenced by SocketDescriptor(), and SLNet::RakPeer::Startup().

short SLNet::SocketDescriptor::socketFamily

IP version: For IPV4, use AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC. IPV6 is the newer internet protocol. Instead of addresses such as natpunch.jenkinssoftware.com, you may have an address such as fe80::7c:31f7:fec4:27de%14. Encoding takes 16 bytes instead of 4, so IPV6 is less efficient for bandwidth. On the positive side, NAT Punchthrough is not needed and should not be used with IPV6 because there are enough addresses that routers do not need to create address mappings. RakPeer::Startup() will fail if this IP version is not supported.

Precondition
RAKNET_SUPPORT_IPV6 must be set to 1 in RakNetDefines.h for AF_INET6

Definition at line 166 of file types.h.

Referenced by SocketDescriptor(), and SLNet::RakPeer::Startup().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/types.h
  • Source/src/RakNetTypes.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::SystemAddress Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SystemAddress
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SLNet::SystemAddress Struct Reference

Network address for a system. More...

#include <slikenet/types.h>

Public Member Functions

SystemAddress ()
Constructors.
SystemAddress (const char *str)
SystemAddress (const char *str, unsigned short port)
unsigned char | GetIPVersion (void) const
unsigned int | GetIPPROTO (void) const
void | SetToLoopback (void)
Call SetToLoopback(), with whatever IP version is currently held. Defaults to IPV4.
void | SetToLoopback (unsigned char ipVersion)
bool | IsLoopback (void) const
const char * | ToString (bool writePort=true, char portDelineator='|') const
void | ToString (bool writePort, char *dest, char portDelineator= '|') const
void | ToString (bool writePort, char *dest, size_t destLength, char portDelineator='|') const
bool | FromString (const char *str, char portDelineator='|', int ipVersion=0)
bool | FromStringExplicitPort (const char *str, unsigned short port, int ipVersion=0)
Same as FromString(), but you explicitly set a port at the same time.
void | CopyPort (const SystemAddress &right)
Copy the port from another SystemAddress structure.
bool | EqualsExcludingPort (const SystemAddress &right) const
Returns if two system addresses have the same IP (port is not checked)
unsigned short | GetPort (void) const
Returns the port in host order (this is what you normally use)
unsigned short | GetPortNetworkOrder (void) const
void | SetPortHostOrder (unsigned short s)
void | SetPortNetworkOrder (unsigned short s)
bool | SetBinaryAddress (const char *str, char portDelineator=':')
Old version, for crap platforms that don't support newer socket functions.
void | ToString_Old (bool writePort, char *dest, char portDelineator= ':') const
Old version, for crap platforms that don't support newer socket functions.
void | ToString_Old (bool writePort, char *dest, size_t destLength, char portDelineator= ':') const
void | FixForIPVersion (const SystemAddress &boundAddressToSocket)
bool | IsLANAddress (void)
SystemAddress & | operator= (const SystemAddress &input)
bool | operator== (const SystemAddress &right) const
bool | operator!= (const SystemAddress &right) const
bool | operator> (const SystemAddress &right) const
bool | operator< (const SystemAddress &right) const

Static Public Member Functions

static int | size (void)
static unsigned long | ToInteger (const SystemAddress &sa)
Hash the system address.

Public Attributes

union
SystemAddress, with RAKNET_SUPPORT_IPV6 defined, holds both an sockaddr_in6 and a sockaddr_in.
address
unsigned short debugPort
This is not used internally, but holds a copy of the port held in the address union, so for debugging it's easier to check what port is being held.
SystemIndex systemIndex

Detailed Description

Network address for a system.

Corresponds to a network address
This is not necessarily a unique identifier. For example, if a system has both LAN and internet connections, the system may be identified by either one, depending on who is communicating
Therefore, you should not transmit the SystemAddress over the network and expect it to identify a system, or use it to connect to that system, except in the case where that system is not behind a NAT (such as with a dedciated server) Use RakNetGUID for a unique per-instance of RakPeer to identify systems

Definition at line 195 of file types.h.

Constructor & Destructor Documentation

SystemAddress::SystemAddress ( )

Constructors.

Definition at line 436 of file RakNetTypes.cpp.

References address, debugPort, and systemIndex.

SystemAddress::SystemAddress ( const char * str )

Definition at line 444 of file RakNetTypes.cpp.

References address, FromString(), SetPortHostOrder(), and systemIndex.

SystemAddress::SystemAddress | ( | const char * | str,
 |  | unsigned short | port
 | ) |  |

Definition at line 451 of file RakNetTypes.cpp.

References address, FromStringExplicitPort(), and systemIndex.

Member Function Documentation

void SystemAddress::CopyPort ( const SystemAddress & right )

Copy the port from another SystemAddress structure.

Definition at line 739 of file RakNetTypes.cpp.

References address, and debugPort.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList().

bool SystemAddress::EqualsExcludingPort ( const SystemAddress & right ) const

Returns if two system addresses have the same IP (port is not checked)

Definition at line 139 of file RakNetTypes.cpp.

References address.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::IsLoopbackAddress(), and operator==().

void SystemAddress::FixForIPVersion ( const SystemAddress & boundAddressToSocket )

Definition at line 495 of file RakNetTypes.cpp.

References FromString(), GetIPVersion(), IPV4_LOOPBACK, IPV6_LOOPBACK, and ToString().

Referenced by SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::Ping(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendOutOfBand(), and SLNet::RakPeer::SendTTL().

bool SystemAddress::FromString | ( | const char * | str,
 |  | char | portDelineator = '|',
 |  | int | ipVersion = 0
 | ) |  |

Set the system address from a printable IP string, for example "192.0.2.1" or "2001:db8:63b3:1::3490" You can write the port as well, using the portDelineator, for example "192.0.2.1|1234"

Parameters
[in] | str | A printable IP string, for example "192.0.2.1" or "2001:db8:63b3:1::3490". Pass 0 for str to set to UNASSIGNED_SYSTEM_ADDRESS
[in] | portDelineator | if str contains a port, delineate the port with this character. portDelineator should not be '.', ':', '', '-', '/', a number, or a-f
[in] | ipVersion | Only used if str is a pre-defined address in the wrong format, such as 127.0.0.1 but you want ip version 6, so you can pass 6 here to do the conversion
Note
The current port is unchanged if a port is not specified in str
Returns
True on success, false on ipVersion does not match type of passed string

Definition at line 605 of file RakNetTypes.cpp.

References WSAStartupSingleton::AddRef(), address, debugPort, WSAStartupSingleton::Deref(), IPV4_LOOPBACK, IPV6_LOOPBACK, RakAssert, and SetBinaryAddress().

Referenced by FixForIPVersion(), FromStringExplicitPort(), SLNet::SocketLayer::GetSystemAddress(), SetToLoopback(), and SystemAddress().

bool SystemAddress::FromStringExplicitPort | ( | const char * | str,
 |  | unsigned short | port,
 |  | int | ipVersion = 0
 | ) |  |

Same as FromString(), but you explicitly set a port at the same time.

Definition at line 727 of file RakNetTypes.cpp.

References address, debugPort, FromString(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by SLNet::RakPeer::Ping(), SLNet::RakPeer::SendConnectionRequest(), SLNet::RakPeer::SendOutOfBand(), SLNet::RakPeer::SendTTL(), and SystemAddress().

unsigned int SystemAddress::GetIPPROTO ( void ) const

Definition at line 230 of file RakNetTypes.cpp.

References address.

unsigned char SystemAddress::GetIPVersion ( void ) const

Return the IP version, either IPV4 or IPV6

Returns
Either 4 or 6

Definition at line 224 of file RakNetTypes.cpp.

References address.

Referenced by FixForIPVersion(), IsLoopback(), SetToLoopback(), and SLNet::BitStream::Write().

unsigned short SystemAddress::GetPort ( void ) const

Returns the port in host order (this is what you normally use)

Definition at line 147 of file RakNetTypes.cpp.

References address.

Referenced by SLNet::SocketLayer::GetLocalPort(), SLNet::ProcessNetworkPacket(), SLNet::RNS2_Berkley::RecvFromLoopInt(), SLNet::CommandParserInterface::ReturnResult(), and ToString_Old().

unsigned short SystemAddress::GetPortNetworkOrder ( void ) const

Definition at line 151 of file RakNetTypes.cpp.

References address.

Referenced by SLNet::BitStream::Write().

bool SystemAddress::IsLANAddress ( void )

Definition at line 523 of file RakNetTypes.cpp.

References address.

bool SystemAddress::IsLoopback ( void ) const
Returns
If was set to 127.0.0.1 or ::1

Definition at line 255 of file RakNetTypes.cpp.

References address, and GetIPVersion().

bool SystemAddress::operator!= ( const SystemAddress & right ) const

Definition at line 170 of file RakNetTypes.cpp.

bool SystemAddress::operator< ( const SystemAddress & right ) const

Definition at line 190 of file RakNetTypes.cpp.

References address.

SystemAddress & SystemAddress::operator= ( const SystemAddress & input )

Definition at line 132 of file RakNetTypes.cpp.

References address, debugPort, and systemIndex.

bool SystemAddress::operator== ( const SystemAddress & right ) const

Definition at line 165 of file RakNetTypes.cpp.

References address, and EqualsExcludingPort().

bool SystemAddress::operator> ( const SystemAddress & right ) const

Definition at line 175 of file RakNetTypes.cpp.

References address.

bool SystemAddress::SetBinaryAddress | ( | const char * | str,
 |  | char | portDelineator = ':'
 | ) |  |

Old version, for crap platforms that don't support newer socket functions.

Definition at line 532 of file RakNetTypes.cpp.

References _FILE_AND_LINE_, address, debugPort, SLNet::RakNetSocket2::DomainNameToIP(), SLNet::NonNumericHostString(), SLNet::OP_DELETE_ARRAY(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by FromString().

void SystemAddress::SetPortHostOrder ( unsigned short s )

Sets the port. The port value should be in host order (this is what you normally use) Renamed from SetPort because of winspool.h http://edn.embarcadero.com/article/21494

Definition at line 155 of file RakNetTypes.cpp.

References address, and debugPort.

Referenced by SLNet::RakPeer::Startup(), and SystemAddress().

void SystemAddress::SetPortNetworkOrder ( unsigned short s )

Definition at line 160 of file RakNetTypes.cpp.

References address, and debugPort.

Referenced by SLNet::SocketLayer::GetSystemAddress_Old().

void SystemAddress::SetToLoopback ( void )

Call SetToLoopback(), with whatever IP version is currently held. Defaults to IPV4.

Definition at line 240 of file RakNetTypes.cpp.

References GetIPVersion().

Referenced by SLNet::SocketLayer::GetSystemAddress().

void SystemAddress::SetToLoopback ( unsigned char ipVersion )

Call SetToLoopback() with a specific IP version

Parameters
[in] ipVersion Either 4 for IPV4 or 6 for IPV6

Definition at line 244 of file RakNetTypes.cpp.

References FromString(), IPV4_LOOPBACK, and IPV6_LOOPBACK.

int SystemAddress::size ( void )
static

Definition at line 204 of file RakNetTypes.cpp.

unsigned long SystemAddress::ToInteger ( const SystemAddress & sa )
static

Hash the system address.

Definition at line 212 of file RakNetTypes.cpp.

References address, and SuperFastHashIncremental().

Referenced by SLNet::RakPeer::RemoteSystemLookupHashIndex(), and SLNet::AddressOrGUID::ToInteger().

const char * SystemAddress::ToString | ( | bool | writePort = true,
 |  | char | portDelineator = '|'
 | ) |  | const

Definition at line 330 of file RakNetTypes.cpp.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), FixForIPVersion(), SLNet::SocketLayer::GetFirstBindableIP(), SLNet::RakPeer::GetLocalIP(), SLNet::ProcessOfflineNetworkPacket(), SLNet::CommandParserInterface::ReturnResult(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::AddressOrGUID::ToString().

void SystemAddress::ToString | ( | bool | writePort,
 |  | char * | dest,
 |  | char | portDelineator = '|'
 | ) |  | const

Definition at line 419 of file RakNetTypes.cpp.

References ToString_Old().

void SystemAddress::ToString | ( | bool | writePort,
 |  | char * | dest,
 |  | size_t | destLength,
 |  | char | portDelineator = '|'
 | ) |  | const

Definition at line 427 of file RakNetTypes.cpp.

References ToString_Old().

void SystemAddress::ToString_Old | ( | bool | writePort,
 |  | char * | dest,
 |  | char | portDelineator = ':'
 | ) |  | const

Old version, for crap platforms that don't support newer socket functions.

Definition at line 275 of file RakNetTypes.cpp.

References address, GetPort(), Itoa(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by ToString().

void SystemAddress::ToString_Old | ( | bool | writePort,
 |  | char * | dest,
 |  | size_t | destLength,
 |  | char | portDelineator = ':'
 | ) |  | const

Definition at line 308 of file RakNetTypes.cpp.

References address, GetPort(), Itoa(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Member Data Documentation

SLNet::SystemAddress::address

Definition at line 220 of file types.h.

Referenced by CopyPort(), EqualsExcludingPort(), FromString(), FromStringExplicitPort(), GetIPPROTO(), GetIPVersion(), GetPort(), GetPortNetworkOrder(), SLNet::SocketLayer::GetSystemAddress(), SLNet::SocketLayer::GetSystemAddress_Old(), IsLANAddress(), IsLoopback(), operator<(), operator=(), operator==(), operator>(), SLNet::ProcessOfflineNetworkPacket(), SLNet::BitStream::Read(), SLNet::RakPeer::RunUpdateCycle(), SetBinaryAddress(), SetPortHostOrder(), SetPortNetworkOrder(), SystemAddress(), ToInteger(), ToString_Old(), and SLNet::BitStream::Write().

unsigned short SLNet::SystemAddress::debugPort

This is not used internally, but holds a copy of the port held in the address union, so for debugging it's easier to check what port is being held.

Definition at line 223 of file types.h.

Referenced by CopyPort(), FromString(), FromStringExplicitPort(), SLNet::SocketLayer::GetSystemAddress(), operator=(), SLNet::BitStream::Read(), SLNet::RakPeer::RunUpdateCycle(), SetBinaryAddress(), SetPortHostOrder(), SetPortNetworkOrder(), and SystemAddress().

SystemIndex SLNet::SystemAddress::systemIndex

Definition at line 311 of file types.h.

Referenced by SLNet::RakPeer::CloseConnection(), SLNet::RakPeer::GetClientPublicKeyFromSystemAddress(), SLNet::RakPeer::GetGuidFromSystemAddress(), SLNet::RakPeer::GetIndexFromSystemAddress(), operator=(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), and SystemAddress().

SLNet::SystemAddress::union
Initial value:
{
sockaddr_in addr4

SystemAddress, with RAKNET_SUPPORT_IPV6 defined, holds both an sockaddr_in6 and a sockaddr_in.

Definition at line 213 of file types.h.

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/types.h
  • Source/src/RakNetTypes.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakNetGUID Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetGUID
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SLNet::RakNetGUID Struct Reference

#include <slikenet/types.h>

Public Member Functions

RakNetGUID ()
RakNetGUID (uint64_t _g)
const char * | ToString (void) const
void | ToString (char *dest) const
void | ToString (char *dest, size_t destSize) const
bool | FromString (const char *source)
RakNetGUID & | operator= (const RakNetGUID &input)
bool | operator== (const RakNetGUID &right) const
bool | operator!= (const RakNetGUID &right) const
bool | operator> (const RakNetGUID &right) const
bool | operator< (const RakNetGUID &right) const

Static Public Member Functions

static unsigned long | ToUint32 (const RakNetGUID &g)
static int | size ()

Public Attributes

uint64_t g
SystemIndex systemIndex

Detailed Description

Uniquely identifies an instance of RakPeer. Use RakPeer::GetGuidFromSystemAddress() and RakPeer::GetSystemAddressFromGuid() to go between SystemAddress and RakNetGUID Use RakPeer::GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS) to get your own GUID

Definition at line 323 of file types.h.

Constructor & Destructor Documentation

RakNetGUID::RakNetGUID ( )

Definition at line 744 of file RakNetTypes.cpp.

References systemIndex, and SLNet::UNASSIGNED_RAKNET_GUID().

SLNet::RakNetGUID::RakNetGUID ( uint64_t _g )
inlineexplicit

Definition at line 326 of file types.h.

Member Function Documentation

bool RakNetGUID::FromString ( const char * source )

Definition at line 799 of file RakNetTypes.cpp.

References g.

bool RakNetGUID::operator!= ( const RakNetGUID & right ) const

Definition at line 753 of file RakNetTypes.cpp.

References g.

bool RakNetGUID::operator< ( const RakNetGUID & right ) const

Definition at line 761 of file RakNetTypes.cpp.

References g.

RakNetGUID& SLNet::RakNetGUID::operator= ( const RakNetGUID & input )
inline

Definition at line 345 of file types.h.

References g, and systemIndex.

bool RakNetGUID::operator== ( const RakNetGUID & right ) const

Definition at line 749 of file RakNetTypes.cpp.

References g.

bool RakNetGUID::operator> ( const RakNetGUID & right ) const

Definition at line 757 of file RakNetTypes.cpp.

References g.

static int SLNet::RakNetGUID::size ( void )
inlinestatic

Definition at line 354 of file types.h.

Referenced by SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::SendOutOfBand().

const char * RakNetGUID::ToString ( void ) const

Definition at line 765 of file RakNetTypes.cpp.

Referenced by SLNet::AddressOrGUID::ToString().

void RakNetGUID::ToString ( char * dest ) const

Definition at line 775 of file RakNetTypes.cpp.

References g, PRINTF_64_BIT_MODIFIER, and SLNet::UNASSIGNED_RAKNET_GUID().

void RakNetGUID::ToString | ( | char * | dest,
 |  | size_t | destSize
 | ) |  | const

Definition at line 790 of file RakNetTypes.cpp.

References g, PRINTF_64_BIT_MODIFIER, and SLNet::UNASSIGNED_RAKNET_GUID().

unsigned long RakNetGUID::ToUint32 ( const RakNetGUID & g )
static

Definition at line 817 of file RakNetTypes.cpp.

References g.

Referenced by SLNet::AddressOrGUID::ToInteger().

Member Data Documentation

uint64_t SLNet::RakNetGUID::g

Definition at line 328 of file types.h.

Referenced by FromString(), SLNet::RakPeer::GenerateGUID(), SLNet::RakPeer::GenerateSeedFromGuid(), operator!=(), operator<(), operator=(), operator==(), operator>(), SLNet::BitStream::Read(), SLNet::RakPeer::Startup(), ToString(), ToUint32(), and SLNet::BitStream::Write().

SystemIndex SLNet::RakNetGUID::systemIndex

Definition at line 353 of file types.h.

Referenced by SLNet::RakPeer::CloseConnection(), SLNet::RakPeer::GetGuidFromSystemAddress(), SLNet::RakPeer::GetIndexFromGuid(), SLNet::RakPeer::GetSystemAddressFromGuid(), SLNet::RakPeer::GetSystemIndexFromGuid(), operator=(), SLNet::ProcessOfflineNetworkPacket(), RakNetGUID(), and SLNet::RakPeer::RunUpdateCycle().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/types.h
  • Source/src/RakNetTypes.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::AddressOrGUID Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • AddressOrGUID
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SLNet::AddressOrGUID Struct Reference

#include <slikenet/types.h>

Public Member Functions

SystemIndex | GetSystemIndex (void) const
bool | IsUndefined (void) const
void | SetUndefined (void)
const char * | ToString (bool writePort=true) const
void | ToString (bool writePort, char *dest) const
void | ToString (bool writePort, char *dest, size_t destLength) const
AddressOrGUID ()
AddressOrGUID (const AddressOrGUID &input)
AddressOrGUID (const SystemAddress &input)
AddressOrGUID (Packet *packet)
AddressOrGUID (const RakNetGUID &input)
AddressOrGUID & | operator= (const AddressOrGUID &input)
AddressOrGUID & | operator= (const SystemAddress &input)
AddressOrGUID & | operator= (const RakNetGUID &input)
bool | operator== (const AddressOrGUID &right) const

Static Public Member Functions

static unsigned long ToInteger (const AddressOrGUID &aog)

Public Attributes

RakNetGUID rakNetGuid
SystemAddress systemAddress

Detailed Description

Definition at line 377 of file types.h.

Constructor & Destructor Documentation

SLNet::AddressOrGUID::AddressOrGUID ( )
inline

Definition at line 390 of file types.h.

SLNet::AddressOrGUID::AddressOrGUID ( const AddressOrGUID & input )
inline

Definition at line 391 of file types.h.

References rakNetGuid, and systemAddress.

SLNet::AddressOrGUID::AddressOrGUID ( const SystemAddress & input )
inline

Definition at line 396 of file types.h.

References SLNet::UNASSIGNED_RAKNET_GUID().

AddressOrGUID::AddressOrGUID ( Packet * packet )

Definition at line 55 of file RakNetTypes.cpp.

References SLNet::Packet::guid, rakNetGuid, systemAddress, and SLNet::Packet::systemAddress.

SLNet::AddressOrGUID::AddressOrGUID ( const RakNetGUID & input )
inline

Definition at line 402 of file types.h.

References SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Member Function Documentation

SystemIndex SLNet::AddressOrGUID::GetSystemIndex ( void ) const
inline

Definition at line 382 of file types.h.

References SLNet::UNASSIGNED_RAKNET_GUID().

bool SLNet::AddressOrGUID::IsUndefined ( void ) const
inline

Definition at line 383 of file types.h.

References SLNet::UNASSIGNED_RAKNET_GUID(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::Send(), and SLNet::RakPeer::SendList().

AddressOrGUID& SLNet::AddressOrGUID::operator= ( const AddressOrGUID & input )
inline

Definition at line 407 of file types.h.

References rakNetGuid, and systemAddress.

AddressOrGUID& SLNet::AddressOrGUID::operator= ( const SystemAddress & input )
inline

Definition at line 414 of file types.h.

References SLNet::UNASSIGNED_RAKNET_GUID().

AddressOrGUID& SLNet::AddressOrGUID::operator= ( const RakNetGUID & input )
inline

Definition at line 421 of file types.h.

References SLNet::UNASSIGNED_SYSTEM_ADDRESS.

bool SLNet::AddressOrGUID::operator== ( const AddressOrGUID & right ) const
inline

Definition at line 428 of file types.h.

References rakNetGuid, systemAddress, SLNet::UNASSIGNED_RAKNET_GUID(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

void SLNet::AddressOrGUID::SetUndefined ( void )
inline

Definition at line 384 of file types.h.

References SLNet::UNASSIGNED_RAKNET_GUID(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

unsigned long AddressOrGUID::ToInteger ( const AddressOrGUID & aog )
static

Definition at line 61 of file RakNetTypes.cpp.

References rakNetGuid, systemAddress, SLNet::SystemAddress::ToInteger(), SLNet::RakNetGUID::ToUint32(), and SLNet::UNASSIGNED_RAKNET_GUID().

const char * AddressOrGUID::ToString ( bool writePort = true ) const

Definition at line 67 of file RakNetTypes.cpp.

References rakNetGuid, systemAddress, SLNet::SystemAddress::ToString(), SLNet::RakNetGUID::ToString(), and SLNet::UNASSIGNED_RAKNET_GUID().

void AddressOrGUID::ToString | ( | bool | writePort,
 |  | char * | dest
 | ) |  | const

Definition at line 73 of file RakNetTypes.cpp.

References rakNetGuid, systemAddress, SLNet::SystemAddress::ToString(), SLNet::RakNetGUID::ToString(), and SLNet::UNASSIGNED_RAKNET_GUID().

void AddressOrGUID::ToString | ( | bool | writePort,
 |  | char * | dest,
 |  | size_t | destLength
 | ) |  | const

Definition at line 79 of file RakNetTypes.cpp.

References rakNetGuid, systemAddress, SLNet::SystemAddress::ToString(), SLNet::RakNetGUID::ToString(), and SLNet::UNASSIGNED_RAKNET_GUID().

Member Data Documentation

RakNetGUID SLNet::AddressOrGUID::rakNetGuid

Definition at line 379 of file types.h.

Referenced by AddressOrGUID(), SLNet::RakPeer::ChangeSystemAddress(), SLNet::RakPeer::CloseConnection(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetConnectionState(), SLNet::RakPeer::GetRemoteSystem(), SLNet::RakPeer::IsLoopbackAddress(), operator=(), operator==(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendListUnified(), SLNet::PluginInterface2::SendUnified(), ToInteger(), and ToString().

SystemAddress SLNet::AddressOrGUID::systemAddress

Definition at line 380 of file types.h.

Referenced by AddressOrGUID(), SLNet::RakPeer::ChangeSystemAddress(), SLNet::RakPeer::CloseConnection(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::RakPeer::GetConnectionState(), SLNet::RakPeer::GetRemoteSystem(), SLNet::RakPeer::IsLoopbackAddress(), operator=(), operator==(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendListUnified(), SLNet::PluginInterface2::SendUnified(), ToInteger(), and ToString().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/types.h
  • Source/src/RakNetTypes.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::uint24_t Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • uint24_t
Public Member Functions | Public Attributes | List of all members
SLNet::uint24_t Struct Reference

#include <slikenet/types.h>

Public Member Functions

uint24_t ()
operator uint32_t ()
operator uint32_t () const
uint24_t (const uint24_t &a)
uint24_t operator++ ()
uint24_t operator-- ()
uint24_t | operator++ (int)
uint24_t | operator-- (int)
uint24_t | operator& (const uint24_t &a)
uint24_t & | operator= (const uint24_t &a)
uint24_t & | operator+= (const uint24_t &a)
uint24_t & | operator-= (const uint24_t &a)
bool | operator== (const uint24_t &right) const
bool | operator!= (const uint24_t &right) const
bool | operator> (const uint24_t &right) const
bool | operator< (const uint24_t &right) const
const uint24_t | operator+ (const uint24_t &other) const
const uint24_t | operator- (const uint24_t &other) const
const uint24_t | operator/ (const uint24_t &other) const
const uint24_t | operator* (const uint24_t &other) const
uint24_t (const uint32_t &a)
uint24_t | operator& (const uint32_t &a)
uint24_t & | operator= (const uint32_t &a)
uint24_t & | operator+= (const uint32_t &a)
uint24_t & | operator-= (const uint32_t &a)
bool | operator== (const uint32_t &right) const
bool | operator!= (const uint32_t &right) const
bool | operator> (const uint32_t &right) const
bool | operator< (const uint32_t &right) const
const uint24_t | operator+ (const uint32_t &other) const
const uint24_t | operator- (const uint32_t &other) const
const uint24_t | operator/ (const uint32_t &other) const
const uint24_t | operator* (const uint32_t &other) const

Public Attributes

uint32_t val

Detailed Description

Definition at line 470 of file types.h.

Constructor & Destructor Documentation

SLNet::uint24_t::uint24_t ( )
inline

Definition at line 474 of file types.h.

SLNet::uint24_t::uint24_t ( const uint24_t & a )
inline

Definition at line 478 of file types.h.

References val.

SLNet::uint24_t::uint24_t ( const uint32_t & a )
inline

Definition at line 496 of file types.h.

Member Function Documentation

SLNet::uint24_t::operator uint32_t ( )
inline

Definition at line 475 of file types.h.

SLNet::uint24_t::operator uint32_t ( ) const
inline

Definition at line 476 of file types.h.

bool SLNet::uint24_t::operator!= ( const uint24_t & right ) const
inline

Definition at line 488 of file types.h.

References val.

bool SLNet::uint24_t::operator!= ( const uint32_t & right ) const
inline

Definition at line 502 of file types.h.

uint24_t SLNet::uint24_t::operator& ( const uint24_t & a )
inline

Definition at line 483 of file types.h.

References val.

uint24_t SLNet::uint24_t::operator& ( const uint32_t & a )
inline

Definition at line 497 of file types.h.

const uint24_t SLNet::uint24_t::operator* ( const uint24_t & other ) const
inline

Definition at line 494 of file types.h.

References val.

const uint24_t SLNet::uint24_t::operator* ( const uint32_t & other ) const
inline

Definition at line 508 of file types.h.

const uint24_t SLNet::uint24_t::operator+ ( const uint24_t & other ) const
inline

Definition at line 491 of file types.h.

References val.

const uint24_t SLNet::uint24_t::operator+ ( const uint32_t & other ) const
inline

Definition at line 505 of file types.h.

uint24_t SLNet::uint24_t::operator++ ( )
inline

Definition at line 479 of file types.h.

uint24_t SLNet::uint24_t::operator++ ( int )
inline

Definition at line 481 of file types.h.

uint24_t& SLNet::uint24_t::operator+= ( const uint24_t & a )
inline

Definition at line 485 of file types.h.

References val.

uint24_t& SLNet::uint24_t::operator+= ( const uint32_t & a )
inline

Definition at line 499 of file types.h.

const uint24_t SLNet::uint24_t::operator- ( const uint24_t & other ) const
inline

Definition at line 492 of file types.h.

References val.

const uint24_t SLNet::uint24_t::operator- ( const uint32_t & other ) const
inline

Definition at line 506 of file types.h.

uint24_t SLNet::uint24_t::operator-- ( )
inline

Definition at line 480 of file types.h.

uint24_t SLNet::uint24_t::operator-- ( int )
inline

Definition at line 482 of file types.h.

uint24_t& SLNet::uint24_t::operator-= ( const uint24_t & a )
inline

Definition at line 486 of file types.h.

References val.

uint24_t& SLNet::uint24_t::operator-= ( const uint32_t & a )
inline

Definition at line 500 of file types.h.

const uint24_t SLNet::uint24_t::operator/ ( const uint24_t & other ) const
inline

Definition at line 493 of file types.h.

References val.

const uint24_t SLNet::uint24_t::operator/ ( const uint32_t & other ) const
inline

Definition at line 507 of file types.h.

bool SLNet::uint24_t::operator< ( const uint24_t & right ) const
inline

Definition at line 490 of file types.h.

References val.

bool SLNet::uint24_t::operator< ( const uint32_t & right ) const
inline

Definition at line 504 of file types.h.

uint24_t& SLNet::uint24_t::operator= ( const uint24_t & a )
inline

Definition at line 484 of file types.h.

References val.

uint24_t& SLNet::uint24_t::operator= ( const uint32_t & a )
inline

Definition at line 498 of file types.h.

bool SLNet::uint24_t::operator== ( const uint24_t & right ) const
inline

Definition at line 487 of file types.h.

References val.

bool SLNet::uint24_t::operator== ( const uint32_t & right ) const
inline

Definition at line 501 of file types.h.

bool SLNet::uint24_t::operator> ( const uint24_t & right ) const
inline

Definition at line 489 of file types.h.

References val.

bool SLNet::uint24_t::operator> ( const uint32_t & right ) const
inline

Definition at line 503 of file types.h.

Member Data Documentation

uint32_t SLNet::uint24_t::val

Definition at line 472 of file types.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), operator!=(), operator&(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator<(), operator=(), operator==(), operator>(), SLNet::BitStream::Read(), uint24_t(), SLNet::ReliabilityLayer::Update(), and SLNet::BitStream::Write().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/types.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::VariableDeltaSerializer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • VariableDeltaSerializer
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
SLNet::VariableDeltaSerializer Class Reference

Class to compare memory values of variables in a current state to a prior state Results of the comparisons will be written to a bitStream, such that only changed variables get written
Can be used with ReplicaManager3 to Serialize a Replica3 per-variable, rather than comparing the entire object against itself
Usage:
BR> More...

#include <slikenet/VariableDeltaSerializer.h>

Classes

struct | ChangedVariablesList
struct | DeserializationContext
struct | RemoteSystemVariableHistory
struct | SerializationContext

Public Member Functions

VariableDeltaSerializer ()
~VariableDeltaSerializer ()
void | BeginUnreliableAckedSerialize (SerializationContext *context, RakNetGUID _guid, BitStream *_bitStream, uint32_t _sendReceipt)
Call before doing one or more SerializeVariable calls when the data will be sent UNRELIABLE_WITH_ACK_RECEIPT The last value of each variable will be saved per remote system. Additionally, a history of _sendReceipts is stored to determine what to resend on packetloss. When variables are lost, they will be flagged dirty and always resent to the system that lost it Disadvantages: Every variable for every remote system is copied internally, in addition to a history list of what variables changed for which _sendReceipt. Very memory and CPU intensive for multiple connections. Advantages: When data needs to be resent by RakNet, RakNet can only resend the value it currently has. This allows the application to control the resend, sending the most recent value of the variable. The end result is that bandwidth is used more efficiently because old data is never sent.
void | BeginUniqueSerialize (SerializationContext *context, RakNetGUID _guid, BitStream *_bitStream)
Call before doing one or more SerializeVariable calls for data that may be sent differently to every remote system (such as an invisibility flag that only teammates can see) The last value of each variable will be saved per remote system. Unlike BeginUnreliableAckedSerialize(), send receipts are not necessary Disadvantages: Every variable for every remote system is copied internally. Very memory and CPU intensive for multiple connections. Advantages: When data is sent differently depending on the recipient, this system can make things easier to use and is as efficient as it can be.
void | BeginIdenticalSerialize (SerializationContext *context, bool _isFirstSerializeToThisSystem, BitStream *_bitStream)
Call before doing one or more SerializeVariable calls for data that is sent with the same value to every remote system (such as health, position, etc.) This is the most common type of serialization, and also the most efficient Disadvantages: A copy of every variable still needs to be held, although only once Advantages: After the first serialization, the last serialized bitStream will be used for subsequent sends.
void | EndSerialize (SerializationContext *context)
Call after BeginUnreliableAckedSerialize(), BeginUniqueSerialize(), or BeginIdenticalSerialize(), then after calling SerializeVariable() one or more times.
void | BeginDeserialize (DeserializationContext *context, BitStream *_bitStream)
Call when you receive the BitStream written by SerializeVariable(), before calling DeserializeVariable()
void | EndDeserialize (DeserializationContext *context)
void | AddRemoteSystemVariableHistory (RakNetGUID guid)
void | RemoveRemoteSystemVariableHistory (RakNetGUID guid)
void | OnPreSerializeTick (void)
void | OnMessageReceipt (RakNetGUID guid, uint32_t receiptId, bool messageArrived)
template<class VarType >
void | SerializeVariable (SerializationContext *context, const VarType &variable)
template<class VarType >
bool | DeserializeVariable (DeserializationContext *context, VarType &variable)

Protected Member Functions

void | FreeVarsAssociatedWithReceipt (RakNetGUID guid, uint32_t receiptId)
void | DirtyAndFreeVarsAssociatedWithReceipt (RakNetGUID guid, uint32_t receiptId)
unsigned int | GetVarsWrittenPerRemoteSystemListIndex (RakNetGUID guid)
void | RemoveRemoteSystemVariableHistory (void)
RemoteSystemVariableHistory * | GetRemoteSystemVariableHistory (RakNetGUID guid)
ChangedVariablesList * | AllocChangedVariablesList (void)
void | FreeChangedVariablesList (ChangedVariablesList *changedVariables)
void | StoreChangedVariablesList (RemoteSystemVariableHistory *variableHistory, ChangedVariablesList *changedVariables, uint32_t sendReceipt)
RemoteSystemVariableHistory * | StartVariableHistoryWrite (RakNetGUID guid)
unsigned int | GetRemoteSystemHistoryListIndex (RakNetGUID guid)

Static Protected Member Functions

static int UpdatedVariablesListPtrComp (const uint32_t &key, ChangedVariablesList *const &data)

Protected Attributes

DataStructures::List
< RemoteSystemVariableHistory * > 		remoteSystemVariableHistoryList
DataStructures::MemoryPool
< ChangedVariablesList > 		updatedVariablesMemoryPool
bool didComparisonThisTick
SLNet::BitStream identicalSerializationBs

Detailed Description

Class to compare memory values of variables in a current state to a prior state Results of the comparisons will be written to a bitStream, such that only changed variables get written
Can be used with ReplicaManager3 to Serialize a Replica3 per-variable, rather than comparing the entire object against itself
Usage:
BR>

  1. Call BeginUnreliableAckedSerialize(), BeginUniqueSerialize(), or BeginIdenticalSerialize(). In the case of Replica3, this would be in the Serialize() call
  2. For each variable of the type in step 1, call Serialize(). The same variables must be serialized every tick()
  3. Call EndSerialize()
  4. Repeat step 1 for each of the other categories of how to send varaibles
    BR> On the receiver:
    BR>
  1. Call BeginDeserialize(). In the case of Replica3, this would be in the Deserialize() call
  2. Call DeserializeVariable() for each variable, in the same order as was Serialized()
  3. Call EndSerialize()
    See Also
    The ReplicaManager3 sample

Definition at line 45 of file VariableDeltaSerializer.h.

Class Documentation

struct SLNet::VariableDeltaSerializer::ChangedVariablesList

Definition at line 224 of file VariableDeltaSerializer.h.

Class Members
unsigned char | bitField
unsigned short | bitWriteIndex
uint32_t | sendReceipt
struct SLNet::VariableDeltaSerializer::DeserializationContext

Definition at line 73 of file VariableDeltaSerializer.h.

Class Members
BitStream * bitStream
struct SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory

Definition at line 238 of file VariableDeltaSerializer.h.

Class Members
RakNetGUID | guid
OrderedList< uint32_t, ChangedVariablesList *, UpdatedVariablesListPtrComp > | updatedVariablesHistory
VariableListDeltaTracker | variableListDeltaTracker

Constructor & Destructor Documentation

VariableDeltaSerializer::VariableDeltaSerializer ( )

Definition at line 20 of file VariableDeltaSerializer.cpp.

References didComparisonThisTick.

VariableDeltaSerializer::~VariableDeltaSerializer ( )

Definition at line 21 of file VariableDeltaSerializer.cpp.

References RemoveRemoteSystemVariableHistory().

Member Function Documentation

void VariableDeltaSerializer::AddRemoteSystemVariableHistory ( RakNetGUID guid )

BeginUnreliableAckedSerialize() and BeginUniqueSerialize() require knowledge of when connections are added and dropped Call AddRemoteSystemVariableHistory() and RemoveRemoteSystemVariableHistory() to notify the system of these events

Parameters
[in] _guid Which system we are sending to

Definition at line 133 of file VariableDeltaSerializer.cpp.

VariableDeltaSerializer::ChangedVariablesList * VariableDeltaSerializer::AllocChangedVariablesList ( void )
protected

Definition at line 237 of file VariableDeltaSerializer.cpp.

References _FILE_AND_LINE_, DataStructures::MemoryPool< MemoryBlockType >::Allocate(), SLNet::VariableDeltaSerializer::ChangedVariablesList::bitField, SLNet::VariableDeltaSerializer::ChangedVariablesList::bitWriteIndex, and updatedVariablesMemoryPool.

Referenced by BeginUnreliableAckedSerialize().

void VariableDeltaSerializer::BeginDeserialize | ( | DeserializationContext * | context,
 |  | BitStream * | _bitStream
 | ) |  |

Call when you receive the BitStream written by SerializeVariable(), before calling DeserializeVariable()

Parameters
[in] | context | Holds the context of this group of deserialize calls. This can be a stack object just passed to the function.
[in] | _bitStream | Pass the bitStream originally passed to and written to by serialize calls

Definition at line 123 of file VariableDeltaSerializer.cpp.

References SLNet::VariableDeltaSerializer::DeserializationContext::bitStream.

void VariableDeltaSerializer::BeginIdenticalSerialize | ( | SerializationContext * | context,
 |  | bool | _isFirstSerializeToThisSystem,
 |  | BitStream * | _bitStream
 | ) |  |

Call before doing one or more SerializeVariable calls for data that is sent with the same value to every remote system (such as health, position, etc.) This is the most common type of serialization, and also the most efficient Disadvantages: A copy of every variable still needs to be held, although only once Advantages: After the first serialization, the last serialized bitStream will be used for subsequent sends.

Precondition
Call OnPreSerializeTick() before doing any calls to BeginIdenticalSerialize() for each of your objects, once per game tick
Parameters
[in] | context | Holds the context of this group of serialize calls. This can be a stack object just passed to the function.
[in] | _isFirstSerializeToThisSystem | Pass true if this is the first time ever serializing to this system (the initial download). This way all variables will be written, rather than checking against prior sent values.
[in] | _bitSteam | Which bitStream to write to

Definition at line 66 of file VariableDeltaSerializer.cpp.

References SLNet::VariableDeltaSerializer::SerializationContext::anyVariablesWritten, SLNet::VariableDeltaSerializer::SerializationContext::bitStream, SLNet::VariableDeltaSerializer::SerializationContext::guid, SLNet::VariableDeltaSerializer::SerializationContext::newSystemSend, RELIABLE, SLNet::VariableDeltaSerializer::SerializationContext::serializationMode, StartVariableHistoryWrite(), SLNet::UNASSIGNED_RAKNET_GUID(), SLNet::VariableDeltaSerializer::SerializationContext::variableHistory, and SLNet::VariableDeltaSerializer::SerializationContext::variableHistoryIdentical.

void VariableDeltaSerializer::BeginUniqueSerialize | ( | SerializationContext * | context,
 |  | RakNetGUID | _guid,
 |  | BitStream * | _bitStream
 | ) |  |

Call before doing one or more SerializeVariable calls for data that may be sent differently to every remote system (such as an invisibility flag that only teammates can see) The last value of each variable will be saved per remote system. Unlike BeginUnreliableAckedSerialize(), send receipts are not necessary Disadvantages: Every variable for every remote system is copied internally. Very memory and CPU intensive for multiple connections. Advantages: When data is sent differently depending on the recipient, this system can make things easier to use and is as efficient as it can be.

Precondition
AddRemoteSystemVariableHistory() and RemoveRemoteSystemVariableHistory() must be called for new and lost connections
Parameters
[in] | context | Holds the context of this group of serialize calls. This can be a stack object just passed to the function.
[in] | _guid | Which system we are sending to
[in] | _bitSteam | Which bitStream to write to

Definition at line 51 of file VariableDeltaSerializer.cpp.

References SLNet::VariableDeltaSerializer::SerializationContext::anyVariablesWritten, SLNet::VariableDeltaSerializer::SerializationContext::bitStream, SLNet::VariableDeltaSerializer::SerializationContext::guid, SLNet::VariableDeltaSerializer::SerializationContext::newSystemSend, RakAssert, RELIABLE, SLNet::VariableDeltaSerializer::SerializationContext::serializationMode, StartVariableHistoryWrite(), SLNet::UNASSIGNED_RAKNET_GUID(), SLNet::VariableDeltaSerializer::SerializationContext::variableHistory, and SLNet::VariableDeltaSerializer::SerializationContext::variableHistoryUnique.

void VariableDeltaSerializer::BeginUnreliableAckedSerialize | ( | SerializationContext * | context,
 |  | RakNetGUID | _guid,
 |  | BitStream * | _bitStream,
 |  | uint32_t | _sendReceipt
 | ) |  |

Call before doing one or more SerializeVariable calls when the data will be sent UNRELIABLE_WITH_ACK_RECEIPT The last value of each variable will be saved per remote system. Additionally, a history of _sendReceipts is stored to determine what to resend on packetloss. When variables are lost, they will be flagged dirty and always resent to the system that lost it Disadvantages: Every variable for every remote system is copied internally, in addition to a history list of what variables changed for which _sendReceipt. Very memory and CPU intensive for multiple connections. Advantages: When data needs to be resent by RakNet, RakNet can only resend the value it currently has. This allows the application to control the resend, sending the most recent value of the variable. The end result is that bandwidth is used more efficiently because old data is never sent.

Precondition
Upon getting ID_SND_RECEIPT_LOSS or ID_SND_RECEIPT_ACKED call OnMessageReceipt()
AddRemoteSystemVariableHistory() and RemoveRemoteSystemVariableHistory() must be called for new and lost connections
Parameters
[in] | context | Holds the context of this group of serialize calls. This can be a stack object just passed to the function.
[in] | _guid | Which system we are sending to
[in] | _bitSteam | Which bitStream to write to
[in] | _sendReceipt | Returned from RakPeer::IncrementNextSendReceipt() and passed to the Send() or SendLists() function. Identifies this update for ID_SND_RECEIPT_LOSS and ID_SND_RECEIPT_ACKED

Definition at line 36 of file VariableDeltaSerializer.cpp.

References AllocChangedVariablesList(), SLNet::VariableDeltaSerializer::SerializationContext::anyVariablesWritten, SLNet::VariableDeltaSerializer::SerializationContext::bitStream, SLNet::VariableDeltaSerializer::SerializationContext::changedVariables, SLNet::VariableDeltaSerializer::SerializationContext::guid, SLNet::VariableDeltaSerializer::SerializationContext::newSystemSend, RakAssert, SLNet::VariableDeltaSerializer::SerializationContext::sendReceipt, SLNet::VariableDeltaSerializer::SerializationContext::serializationMode, StartVariableHistoryWrite(), SLNet::UNASSIGNED_RAKNET_GUID(), UNRELIABLE_WITH_ACK_RECEIPT, SLNet::VariableDeltaSerializer::SerializationContext::variableHistory, and SLNet::VariableDeltaSerializer::SerializationContext::variableHistoryUnique.

template<class VarType >
bool SLNet::VariableDeltaSerializer::DeserializeVariable | ( | DeserializationContext * | context,
 |  | VarType & | variable
 | ) |  |
inline

Call to deserialize into a variable

Precondition
You have called BeginDeserialize()
Note
Be sure to call EndDeserialize() after finishing all deserializations
Parameters
[in] | context | Same context pointer passed to BeginDeserialize()
[in] | variable | A variable to write to the bitStream passed to context

Definition at line 213 of file VariableDeltaSerializer.h.

References SLNet::VariableDeltaSerializer::DeserializationContext::bitStream, and SLNet::VariableListDeltaTracker::ReadVarFromBitstream().

void VariableDeltaSerializer::DirtyAndFreeVarsAssociatedWithReceipt | ( | RakNetGUID | guid,
 |  | uint32_t | receiptId
 | ) |  |
protected

Definition at line 186 of file VariableDeltaSerializer.cpp.

References SLNet::VariableListDeltaTracker::FlagDirtyFromBitArray(), FreeChangedVariablesList(), DataStructures::OrderedList< key_type, data_type, default_comparison_function >::GetIndexFromKey(), GetVarsWrittenPerRemoteSystemListIndex(), remoteSystemVariableHistoryList, DataStructures::OrderedList< key_type, data_type, default_comparison_function >::RemoveAtIndex(), SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory::updatedVariablesHistory, and SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory::variableListDeltaTracker.

Referenced by OnMessageReceipt().

void VariableDeltaSerializer::EndDeserialize ( DeserializationContext * context )
Parameters
[in] context Same context pointer passed to BeginDeserialize()

Definition at line 128 of file VariableDeltaSerializer.cpp.

void VariableDeltaSerializer::EndSerialize ( SerializationContext * context )

Call after BeginUnreliableAckedSerialize(), BeginUniqueSerialize(), or BeginIdenticalSerialize(), then after calling SerializeVariable() one or more times.

Parameters
[in] context Same context pointer passed to BeginUnreliableAckedSerialize(), BeginUniqueSerialize(), or BeginIdenticalSerialize()

Definition at line 78 of file VariableDeltaSerializer.cpp.

References SLNet::VariableDeltaSerializer::SerializationContext::anyVariablesWritten, SLNet::VariableDeltaSerializer::SerializationContext::bitStream, SLNet::VariableDeltaSerializer::SerializationContext::changedVariables, didComparisonThisTick, FreeChangedVariablesList(), identicalSerializationBs, SLNet::BitStream::Reset(), SLNet::BitStream::ResetReadPointer(), SLNet::VariableDeltaSerializer::SerializationContext::sendReceipt, SLNet::VariableDeltaSerializer::SerializationContext::serializationMode, StoreChangedVariablesList(), UNRELIABLE_WITH_ACK_RECEIPT, SLNet::VariableDeltaSerializer::SerializationContext::variableHistory, SLNet::VariableDeltaSerializer::SerializationContext::variableHistoryIdentical, and SLNet::BitStream::Write().

void VariableDeltaSerializer::FreeChangedVariablesList ( ChangedVariablesList * changedVariables )
protected

Definition at line 244 of file VariableDeltaSerializer.cpp.

References _FILE_AND_LINE_, DataStructures::MemoryPool< MemoryBlockType >::Release(), and updatedVariablesMemoryPool.

Referenced by DirtyAndFreeVarsAssociatedWithReceipt(), EndSerialize(), FreeVarsAssociatedWithReceipt(), and RemoveRemoteSystemVariableHistory().

void VariableDeltaSerializer::FreeVarsAssociatedWithReceipt | ( | RakNetGUID | guid,
 |  | uint32_t | receiptId
 | ) |  |
protected

Definition at line 168 of file VariableDeltaSerializer.cpp.

References FreeChangedVariablesList(), DataStructures::OrderedList< key_type, data_type, default_comparison_function >::GetIndexFromKey(), GetVarsWrittenPerRemoteSystemListIndex(), remoteSystemVariableHistoryList, DataStructures::OrderedList< key_type, data_type, default_comparison_function >::RemoveAtIndex(), and SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory::updatedVariablesHistory.

Referenced by OnMessageReceipt().

unsigned int VariableDeltaSerializer::GetRemoteSystemHistoryListIndex ( RakNetGUID guid )
protected

Definition at line 273 of file VariableDeltaSerializer.cpp.

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

Referenced by GetRemoteSystemVariableHistory(), and StartVariableHistoryWrite().

VariableDeltaSerializer::RemoteSystemVariableHistory * VariableDeltaSerializer::GetRemoteSystemVariableHistory ( RakNetGUID guid )
protected

Definition at line 231 of file VariableDeltaSerializer.cpp.

References GetRemoteSystemHistoryListIndex(), and remoteSystemVariableHistoryList.

unsigned int VariableDeltaSerializer::GetVarsWrittenPerRemoteSystemListIndex ( RakNetGUID guid )
protected

Definition at line 206 of file VariableDeltaSerializer.cpp.

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

Referenced by DirtyAndFreeVarsAssociatedWithReceipt(), FreeVarsAssociatedWithReceipt(), and RemoveRemoteSystemVariableHistory().

void VariableDeltaSerializer::OnMessageReceipt | ( | RakNetGUID | guid,
 |  | uint32_t | receiptId,
 |  | bool | messageArrived
 | ) |  |

Call when getting ID_SND_RECEIPT_LOSS or ID_SND_RECEIPT_ACKED for a particular system Example:

uint32_t msgNumber; memcpy(&msgNumber, packet->data+1, 4); DataStructures::List<Replica3*> replicaListOut; replicaManager.GetReplicasCreatedByMe(replicaListOut); unsigned int idx; for (idx=0; idx < replicaListOut.GetSize(); idx++) { ((SampleReplica*)replicaListOut[idx])->NotifyReplicaOfMessageDeliveryStatus(packet->guid,msgNumber, packet->data[0]==ID_SND_RECEIPT_ACKED); }

Parameters
[in] | guid | Which system we are sending to
[in] | receiptId | Encoded in bytes 1-4 inclusive of ID_SND_RECEIPT_LOSS and ID_SND_RECEIPT_ACKED
[in] | messageArrived | True for ID_SND_RECEIPT_ACKED, false otherwise

Definition at line 26 of file VariableDeltaSerializer.cpp.

References DirtyAndFreeVarsAssociatedWithReceipt(), and FreeVarsAssociatedWithReceipt().

void VariableDeltaSerializer::OnPreSerializeTick ( void )

BeginIdenticalSerialize() requires knowledge of when serialization has started for an object across multiple systems This way it can setup the flag to do new comparisons against the last sent values, rather than just resending the last sent bitStream For Replica3, overload and call this from Replica3::OnUserReplicaPreSerializeTick()

Definition at line 287 of file VariableDeltaSerializer.cpp.

References didComparisonThisTick.

void VariableDeltaSerializer::RemoveRemoteSystemVariableHistory ( RakNetGUID guid )

BeginUnreliableAckedSerialize() and BeginUniqueSerialize() require knowledge of when connections are added and dropped Call AddRemoteSystemVariableHistory() and RemoveRemoteSystemVariableHistory() to notify the system of these events

Parameters
[in] _guid Which system we are sending to

Definition at line 138 of file VariableDeltaSerializer.cpp.

References FreeChangedVariablesList(), GetVarsWrittenPerRemoteSystemListIndex(), remoteSystemVariableHistoryList, DataStructures::List< list_type >::RemoveAtIndexFast(), and DataStructures::List< list_type >::Size().

void VariableDeltaSerializer::RemoveRemoteSystemVariableHistory ( void )
protected

Definition at line 216 of file VariableDeltaSerializer.cpp.

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

Referenced by ~VariableDeltaSerializer().

template<class VarType >
void SLNet::VariableDeltaSerializer::SerializeVariable | ( | SerializationContext * | context,
 |  | const VarType & | variable
 | ) |  |
inline

Call to Serialize a variable Will write to the bitSteam passed to context true, variableValue if the variable has changed or has never been written. Otherwise will write false.

Precondition
You have called BeginUnreliableAckedSerialize(), BeginUniqueSerialize(), or BeginIdenticalSerialize()
Will also require calling OnPreSerializeTick() if using BeginIdenticalSerialize()
Note
Be sure to call EndSerialize() after finishing all serializations
Parameters
[in] | context | Same context pointer passed to BeginUnreliableAckedSerialize(), BeginUniqueSerialize(), or BeginIdenticalSerialize()
[in] | variable | A variable to write to the bitStream passed to context

Definition at line 165 of file VariableDeltaSerializer.h.

References SLNet::VariableDeltaSerializer::SerializationContext::anyVariablesWritten, SLNet::VariableDeltaSerializer::ChangedVariablesList::bitField, SLNet::VariableDeltaSerializer::SerializationContext::bitStream, SLNet::VariableDeltaSerializer::ChangedVariablesList::bitWriteIndex, SLNet::VariableDeltaSerializer::SerializationContext::changedVariables, SLNet::VariableListDeltaTracker::IsPastEndOfList(), SLNet::VariableDeltaSerializer::SerializationContext::newSystemSend, SLNet::VariableDeltaSerializer::SerializationContext::serializationMode, UNRELIABLE_WITH_ACK_RECEIPT, SLNet::VariableDeltaSerializer::SerializationContext::variableHistory, SLNet::VariableDeltaSerializer::SerializationContext::variableHistoryIdentical, SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory::variableListDeltaTracker, SLNet::BitStream::Write(), and SLNet::VariableListDeltaTracker::WriteVarToBitstream().

VariableDeltaSerializer::RemoteSystemVariableHistory * VariableDeltaSerializer::StartVariableHistoryWrite ( RakNetGUID guid )
protected

Definition at line 254 of file VariableDeltaSerializer.cpp.

References _FILE_AND_LINE_, GetRemoteSystemHistoryListIndex(), SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory::guid, DataStructures::List< list_type >::Push(), remoteSystemVariableHistoryList, SLNet::VariableListDeltaTracker::StartWrite(), and SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory::variableListDeltaTracker.

Referenced by BeginIdenticalSerialize(), BeginUniqueSerialize(), and BeginUnreliableAckedSerialize().

void VariableDeltaSerializer::StoreChangedVariablesList | ( | RemoteSystemVariableHistory * | variableHistory,
 |  | ChangedVariablesList * | changedVariables,
 |  | uint32_t | sendReceipt
 | ) |  |
protected

Definition at line 248 of file VariableDeltaSerializer.cpp.

References _FILE_AND_LINE_, DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Insert(), SLNet::VariableDeltaSerializer::ChangedVariablesList::sendReceipt, and SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory::updatedVariablesHistory.

Referenced by EndSerialize().

int SLNet::VariableDeltaSerializer::UpdatedVariablesListPtrComp | ( | const uint32_t & | key,
 |  | ChangedVariablesList *const & | data
 | ) |  |
staticprotected

Definition at line 159 of file VariableDeltaSerializer.cpp.

References SLNet::VariableDeltaSerializer::ChangedVariablesList::sendReceipt.

Member Data Documentation

bool SLNet::VariableDeltaSerializer::didComparisonThisTick
protected

Definition at line 251 of file VariableDeltaSerializer.h.

Referenced by EndSerialize(), OnPreSerializeTick(), and VariableDeltaSerializer().

SLNet::BitStream SLNet::VariableDeltaSerializer::identicalSerializationBs
protected

Definition at line 252 of file VariableDeltaSerializer.h.

Referenced by EndSerialize().

DataStructures::List<RemoteSystemVariableHistory*> SLNet::VariableDeltaSerializer::remoteSystemVariableHistoryList
protected

A list of RemoteSystemVariableHistory indexed by guid, one per connection that we serialize to List is added to when SerializeConstruction is called, and removed from when SerializeDestruction is called, or when a given connection is dropped

Definition at line 246 of file VariableDeltaSerializer.h.

Referenced by DirtyAndFreeVarsAssociatedWithReceipt(), FreeVarsAssociatedWithReceipt(), GetRemoteSystemHistoryListIndex(), GetRemoteSystemVariableHistory(), GetVarsWrittenPerRemoteSystemListIndex(), RemoveRemoteSystemVariableHistory(), and StartVariableHistoryWrite().

DataStructures::MemoryPool<ChangedVariablesList> SLNet::VariableDeltaSerializer::updatedVariablesMemoryPool
protected

Definition at line 249 of file VariableDeltaSerializer.h.

Referenced by AllocChangedVariablesList(), and FreeChangedVariablesList().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/VariableDeltaSerializer.h
  • Source/src/VariableDeltaSerializer.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::VariableDeltaSerializer::SerializationContext Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • VariableDeltaSerializer
  • SerializationContext
Public Member Functions | Public Attributes | List of all members
SLNet::VariableDeltaSerializer::SerializationContext Struct Reference

#include <slikenet/VariableDeltaSerializer.h>

Public Member Functions

SerializationContext ()
~SerializationContext ()

Public Attributes

RakNetGUID guid
BitStream * bitStream
uint32_t rakPeerSendReceipt
RemoteSystemVariableHistory * variableHistory
RemoteSystemVariableHistory * variableHistoryIdentical
RemoteSystemVariableHistory * variableHistoryUnique
ChangedVariablesList * changedVariables
uint32_t sendReceipt
PacketReliability serializationMode
bool | anyVariablesWritten
bool | newSystemSend

Detailed Description

Definition at line 55 of file VariableDeltaSerializer.h.

Constructor & Destructor Documentation

VariableDeltaSerializer::SerializationContext::SerializationContext ( )

Definition at line 23 of file VariableDeltaSerializer.cpp.

References variableHistoryIdentical, and variableHistoryUnique.

VariableDeltaSerializer::SerializationContext::~SerializationContext ( )

Definition at line 24 of file VariableDeltaSerializer.cpp.

Member Data Documentation

bool SLNet::VariableDeltaSerializer::SerializationContext::anyVariablesWritten

Definition at line 69 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginIdenticalSerialize(), SLNet::VariableDeltaSerializer::BeginUniqueSerialize(), SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), SLNet::VariableDeltaSerializer::EndSerialize(), and SLNet::VariableDeltaSerializer::SerializeVariable().

BitStream* SLNet::VariableDeltaSerializer::SerializationContext::bitStream

Definition at line 61 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginIdenticalSerialize(), SLNet::VariableDeltaSerializer::BeginUniqueSerialize(), SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), SLNet::VariableDeltaSerializer::EndSerialize(), and SLNet::VariableDeltaSerializer::SerializeVariable().

ChangedVariablesList* SLNet::VariableDeltaSerializer::SerializationContext::changedVariables

Definition at line 66 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), SLNet::VariableDeltaSerializer::EndSerialize(), and SLNet::VariableDeltaSerializer::SerializeVariable().

RakNetGUID SLNet::VariableDeltaSerializer::SerializationContext::guid

Definition at line 60 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginIdenticalSerialize(), SLNet::VariableDeltaSerializer::BeginUniqueSerialize(), and SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize().

bool SLNet::VariableDeltaSerializer::SerializationContext::newSystemSend

Definition at line 70 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginIdenticalSerialize(), SLNet::VariableDeltaSerializer::BeginUniqueSerialize(), SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), and SLNet::VariableDeltaSerializer::SerializeVariable().

uint32_t SLNet::VariableDeltaSerializer::SerializationContext::rakPeerSendReceipt

Definition at line 62 of file VariableDeltaSerializer.h.

uint32_t SLNet::VariableDeltaSerializer::SerializationContext::sendReceipt

Definition at line 67 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), and SLNet::VariableDeltaSerializer::EndSerialize().

PacketReliability SLNet::VariableDeltaSerializer::SerializationContext::serializationMode

Definition at line 68 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginIdenticalSerialize(), SLNet::VariableDeltaSerializer::BeginUniqueSerialize(), SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), SLNet::VariableDeltaSerializer::EndSerialize(), and SLNet::VariableDeltaSerializer::SerializeVariable().

RemoteSystemVariableHistory* SLNet::VariableDeltaSerializer::SerializationContext::variableHistory

Definition at line 63 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginIdenticalSerialize(), SLNet::VariableDeltaSerializer::BeginUniqueSerialize(), SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), SLNet::VariableDeltaSerializer::EndSerialize(), and SLNet::VariableDeltaSerializer::SerializeVariable().

RemoteSystemVariableHistory* SLNet::VariableDeltaSerializer::SerializationContext::variableHistoryIdentical

Definition at line 64 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginIdenticalSerialize(), SLNet::VariableDeltaSerializer::EndSerialize(), SerializationContext(), and SLNet::VariableDeltaSerializer::SerializeVariable().

RemoteSystemVariableHistory* SLNet::VariableDeltaSerializer::SerializationContext::variableHistoryUnique

Definition at line 65 of file VariableDeltaSerializer.h.

Referenced by SLNet::VariableDeltaSerializer::BeginUniqueSerialize(), SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), and SerializationContext().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/VariableDeltaSerializer.h
  • Source/src/VariableDeltaSerializer.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::VariableListDeltaTracker Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • VariableListDeltaTracker
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SLNet::VariableListDeltaTracker Class Reference

#include <slikenet/VariableListDeltaTracker.h>

Classes

struct VariableLastValueNode

Public Member Functions

VariableListDeltaTracker ()
~VariableListDeltaTracker ()
void | StartWrite (void)
bool | IsPastEndOfList (void) const
template<class VarType >
bool | WriteVar (const VarType &varData)
template<class VarType >
bool | WriteVarToBitstream (const VarType &varData, SLNet::BitStream *bitStream)
Calls WriteVar. If the variable has changed, writes true, and writes the variable. Otherwise writes false.
template<class VarType >
bool | WriteVarToBitstream (const VarType &varData, SLNet::BitStream *bitStream, unsigned char *bArray, unsigned short writeOffset)
Calls WriteVarToBitstream(). Additionally, adds the boolean result of WriteVar() to boolean bit array.
void | FlagDirtyFromBitArray (unsigned char *bArray)

Static Public Member Functions

template<class VarType >
static bool ReadVarFromBitstream (VarType &varData, SLNet::BitStream *bitStream)
Paired with a call to WriteVarToBitstream(), will read a variable if it had changed. Otherwise the values remains the same.

Protected Attributes

DataStructures::List
< VariableLastValueNode > 		variableList
unsigned int nextWriteIndex

Detailed Description

Class to write a series of variables, copy the contents to memory, and return if the newly written value is different than what was last written Can also encode the reads, writes, and results directly to/from a bitstream

Definition at line 28 of file VariableListDeltaTracker.h.

Constructor & Destructor Documentation

VariableListDeltaTracker::VariableListDeltaTracker ( )

Definition at line 20 of file VariableListDeltaTracker.cpp.

References nextWriteIndex.

VariableListDeltaTracker::~VariableListDeltaTracker ( )

Definition at line 21 of file VariableListDeltaTracker.cpp.

References _FILE_AND_LINE_, rakFree_Ex, DataStructures::List< list_type >::Size(), and variableList.

Member Function Documentation

void VariableListDeltaTracker::FlagDirtyFromBitArray ( unsigned char * bArray )

Variables flagged dirty will cause WriteVar() to return true, even if the variable had not otherwise changed This updates all the variables in the list, where in each index varsWritten is true, so will the variable at the corresponding index be flagged dirty

Definition at line 31 of file VariableListDeltaTracker.cpp.

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

Referenced by SLNet::VariableDeltaSerializer::DirtyAndFreeVarsAssociatedWithReceipt().

bool SLNet::VariableListDeltaTracker::IsPastEndOfList ( void ) const
inline

Definition at line 37 of file VariableListDeltaTracker.h.

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

Referenced by SLNet::VariableDeltaSerializer::SerializeVariable().

template<class VarType >
static bool SLNet::VariableListDeltaTracker::ReadVarFromBitstream | ( | VarType & | varData,
 |  | SLNet::BitStream * | bitStream
 | ) |  |
inlinestatic

Paired with a call to WriteVarToBitstream(), will read a variable if it had changed. Otherwise the values remains the same.

Definition at line 113 of file VariableListDeltaTracker.h.

References SLNet::BitStream::Read().

Referenced by SLNet::VariableDeltaSerializer::DeserializeVariable().

void VariableListDeltaTracker::StartWrite ( void )

Definition at line 29 of file VariableListDeltaTracker.cpp.

References nextWriteIndex.

Referenced by SLNet::VariableDeltaSerializer::StartVariableHistoryWrite().

template<class VarType >
bool SLNet::VariableListDeltaTracker::WriteVar ( const VarType & varData )
inline

Records the passed value of the variable to memory, and returns true if the value is different from the write before that (or if it is the first write)

Precondition
Call StartWrite() before doing the first of a series of calls to WriteVar or other functions that call WriteVar
Note
Variables must be of the same type, written in the same order, each time

Definition at line 43 of file VariableListDeltaTracker.h.

References _FILE_AND_LINE_, SLNet::BitStream::GetData(), SLNet::BitStream::GetNumberOfBytesUsed(), nextWriteIndex, DataStructures::List< list_type >::Push(), rakRealloc_Ex, DataStructures::List< list_type >::Size(), variableList, and SLNet::BitStream::Write().

Referenced by WriteVarToBitstream().

template<class VarType >
bool SLNet::VariableListDeltaTracker::WriteVarToBitstream | ( | const VarType & | varData,
 |  | SLNet::BitStream * | bitStream
 | ) |  |
inline

Calls WriteVar. If the variable has changed, writes true, and writes the variable. Otherwise writes false.

Definition at line 76 of file VariableListDeltaTracker.h.

References SLNet::BitStream::Write(), and WriteVar().

Referenced by SLNet::VariableDeltaSerializer::SerializeVariable(), and WriteVarToBitstream().

template<class VarType >
bool SLNet::VariableListDeltaTracker::WriteVarToBitstream | ( | const VarType & | varData,
 |  | SLNet::BitStream * | bitStream,
 |  | unsigned char * | bArray,
 |  | unsigned short | writeOffset
 | ) |  |
inline

Calls WriteVarToBitstream(). Additionally, adds the boolean result of WriteVar() to boolean bit array.

Definition at line 89 of file VariableListDeltaTracker.h.

References WriteVarToBitstream().

Member Data Documentation

unsigned int SLNet::VariableListDeltaTracker::nextWriteIndex
protected

Definition at line 145 of file VariableListDeltaTracker.h.

Referenced by IsPastEndOfList(), StartWrite(), VariableListDeltaTracker(), and WriteVar().

DataStructures::List<VariableLastValueNode> SLNet::VariableListDeltaTracker::variableList
protected

Definition at line 143 of file VariableListDeltaTracker.h.

Referenced by FlagDirtyFromBitArray(), IsPastEndOfList(), WriteVar(), and ~VariableListDeltaTracker().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/VariableListDeltaTracker.h
  • Source/src/VariableListDeltaTracker.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::VariableListDeltaTracker::VariableLastValueNode Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • VariableListDeltaTracker
  • VariableLastValueNode
Public Member Functions | Public Attributes | List of all members
SLNet::VariableListDeltaTracker::VariableLastValueNode Struct Reference

#include <slikenet/VariableListDeltaTracker.h>

Public Member Functions

VariableLastValueNode ()
VariableLastValueNode (const unsigned char *data, int _byteLength)
~VariableLastValueNode ()

Public Attributes

char * | lastData
unsigned int | byteLength
bool | isDirty

Detailed Description

Definition at line 131 of file VariableListDeltaTracker.h.

Constructor & Destructor Documentation

VariableListDeltaTracker::VariableLastValueNode::VariableLastValueNode ( )

Definition at line 42 of file VariableListDeltaTracker.cpp.

References lastData.

VariableListDeltaTracker::VariableLastValueNode::VariableLastValueNode | ( | const unsigned char * | data,
 |  | int | _byteLength
 | ) |  |

Definition at line 46 of file VariableListDeltaTracker.cpp.

References _FILE_AND_LINE_, and rakMalloc_Ex.

VariableListDeltaTracker::VariableLastValueNode::~VariableLastValueNode ( )

Definition at line 53 of file VariableListDeltaTracker.cpp.

Member Data Documentation

unsigned int SLNet::VariableListDeltaTracker::VariableLastValueNode::byteLength

Definition at line 137 of file VariableListDeltaTracker.h.

bool SLNet::VariableListDeltaTracker::VariableLastValueNode::isDirty

Definition at line 138 of file VariableListDeltaTracker.h.

char* SLNet::VariableListDeltaTracker::VariableLastValueNode::lastData

Definition at line 136 of file VariableListDeltaTracker.h.

Referenced by VariableLastValueNode().

The documentation for this struct was generated from the following files:
  • Source/include/slikenet/VariableListDeltaTracker.h
  • Source/src/VariableListDeltaTracker.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: SLNet::RakWString Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakWString
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SLNet::RakWString Class Reference

String class for Unicode. More...

#include <slikenet/wstring.h>

Public Member Functions

RakWString ()
RakWString (const RakString &right)
RakWString (const wchar_t *input)
RakWString (const RakWString &right)
RakWString (const char *input)
~RakWString ()
operator wchar_t * () const
Implicit return of wchar_t*.
const wchar_t * | C_String (void) const
Same as std::string::c_str.
RakWString & | operator= (const RakWString &right)
Assignment operators.
RakWString & | operator= (const RakString &right)
RakWString & | operator= (const wchar_t *const str)
RakWString & | operator= (wchar_t *str)
RakWString & | operator= (const char *const str)
RakWString & | operator= (char *str)
RakWString & | operator+= (const RakWString &right)
Concatenation.
RakWString & | operator+= (const wchar_t *const right)
RakWString & | operator+= (wchar_t *right)
bool | operator== (const RakWString &right) const
Equality.
bool | operator< (const RakWString &right) const
bool | operator<= (const RakWString &right) const
bool | operator> (const RakWString &right) const
bool | operator>= (const RakWString &right) const
bool | operator!= (const RakWString &right) const
Inequality.
void | Set (wchar_t *str)
Set the value of the string.
bool | IsEmpty (void) const
Returns if the string is empty. Also, C_String() would return "".
size_t | GetLength (void) const
Returns the length of the string.
int | StrCmp (const RakWString &right) const
Compare strings (case sensitive)
int | StrICmp (const RakWString &right) const
Compare strings (not case sensitive)
void | Clear (void)
Clear the string.
void | Printf (void)
Print the string to the screen.
void | FPrintf (FILE *fp)
Print the string to a file.
void | Serialize (BitStream *bs) const
bool | Deserialize (BitStream *bs)

Static Public Member Functions

static unsigned long | ToInteger (const RakWString &rs)
Has the string into an unsigned int.
static void | Serialize (const wchar_t *const str, BitStream *bs)
Static version of the Serialize function.
static bool | Deserialize (wchar_t *str, BitStream *bs)
Static version of the Deserialize() function.
static bool | Deserialize (wchar_t *str, size_t strLength, BitStream *bs)

Protected Attributes

wchar_t * | c_str
size_t | c_strCharLength

Detailed Description

String class for Unicode.

Definition at line 33 of file wstring.h.

Constructor & Destructor Documentation

RakWString::RakWString ( )

Definition at line 30 of file RakWString.cpp.

References c_str, and c_strCharLength.

RakWString::RakWString ( const RakString & right )

Definition at line 35 of file RakWString.cpp.

References c_str, and c_strCharLength.

RakWString::RakWString ( const wchar_t * input )

Definition at line 47 of file RakWString.cpp.

References c_str, and c_strCharLength.

RakWString::RakWString ( const RakWString & right )

Definition at line 53 of file RakWString.cpp.

References c_str, and c_strCharLength.

RakWString::RakWString ( const char * input )

Definition at line 41 of file RakWString.cpp.

References c_str, and c_strCharLength.

RakWString::~RakWString ( )

Definition at line 59 of file RakWString.cpp.

References _FILE_AND_LINE_, c_str, and rakFree_Ex.

Member Function Documentation

const wchar_t* SLNet::RakWString::C_String ( void ) const
inline

Same as std::string::c_str.

Definition at line 48 of file wstring.h.

Referenced by FPrintf(), operator!=(), operator+=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), Printf(), Serialize(), StrCmp(), StrICmp(), and ToInteger().

void RakWString::Clear ( void )

Clear the string.

Definition at line 278 of file RakWString.cpp.

References _FILE_AND_LINE_, c_str, c_strCharLength, and rakFree_Ex.

Referenced by Deserialize(), and operator=().

bool RakWString::Deserialize ( BitStream * bs )

Deserialize what was written by Serialize

Parameters
[in] bs Bitstream to serialize from
Returns
true if the deserialization was successful

Definition at line 318 of file RakWString.cpp.

References _FILE_AND_LINE_, c_str, c_strCharLength, Clear(), MAX_BYTES_PER_UNICODE_CHAR, rakFree_Ex, rakMalloc_Ex, SLNet::BitStream::Read(), SLNet::BitStream::ReadAlignedBytes(), and SLNet::BitStream::ReadCasted().

Referenced by SLNet::BitStream::Read(), and SLNet::BitStream::ReadCompressed().

bool RakWString::Deserialize | ( | wchar_t * | str,
 |  | BitStream * | bs
 | ) |  |
static

Static version of the Deserialize() function.

Definition at line 359 of file RakWString.cpp.

References _FILE_AND_LINE_, c_strCharLength, rakFree_Ex, rakMalloc_Ex, SLNet::BitStream::Read(), SLNet::BitStream::ReadAlignedBytes(), and SLNet::BitStream::ReadCasted().

bool RakWString::Deserialize | ( | wchar_t * | str,
 |  | size_t | strLength,
 |  | BitStream * | bs
 | ) |  |
static

Definition at line 400 of file RakWString.cpp.

References _FILE_AND_LINE_, c_strCharLength, rakFree_Ex, rakMalloc_Ex, SLNet::BitStream::Read(), SLNet::BitStream::ReadAlignedBytes(), and SLNet::BitStream::ReadCasted().

void RakWString::FPrintf ( FILE * fp )

Print the string to a file.

Definition at line 288 of file RakWString.cpp.

References C_String().

size_t RakWString::GetLength ( void ) const

Returns the length of the string.

Definition at line 246 of file RakWString.cpp.

References c_strCharLength.

Referenced by IsEmpty(), operator!=(), operator+=(), operator=(), operator==(), and ToInteger().

bool RakWString::IsEmpty ( void ) const

Returns if the string is empty. Also, C_String() would return "".

Definition at line 242 of file RakWString.cpp.

References GetLength().

Referenced by operator+=(), and operator=().

SLNet::RakWString::operator wchar_t * ( ) const
inline

Implicit return of wchar_t*.

Definition at line 45 of file wstring.h.

bool RakWString::operator!= ( const RakWString & right ) const

Inequality.

Definition at line 232 of file RakWString.cpp.

References C_String(), and GetLength().

RakWString & RakWString::operator+= ( const RakWString & right )

Concatenation.

Definition at line 147 of file RakWString.cpp.

References _FILE_AND_LINE_, c_str, c_strCharLength, C_String(), GetLength(), IsEmpty(), MAX_BYTES_PER_UNICODE_CHAR, notifyOutOfMemory, rakMalloc_Ex, and rakRealloc_Ex.

RakWString & RakWString::operator+= ( const wchar_t *const right )

Definition at line 176 of file RakWString.cpp.

References _FILE_AND_LINE_, c_str, c_strCharLength, IsEmpty(), MAX_BYTES_PER_UNICODE_CHAR, notifyOutOfMemory, rakMalloc_Ex, and rakRealloc_Ex.

RakWString & RakWString::operator+= ( wchar_t * right )

Definition at line 206 of file RakWString.cpp.

bool RakWString::operator< ( const RakWString & right ) const

Definition at line 216 of file RakWString.cpp.

References C_String().

bool RakWString::operator<= ( const RakWString & right ) const

Definition at line 220 of file RakWString.cpp.

References C_String().

RakWString & RakWString::operator= ( const RakWString & right )

Assignment operators.

Definition at line 63 of file RakWString.cpp.

References _FILE_AND_LINE_, c_str, c_strCharLength, C_String(), Clear(), GetLength(), IsEmpty(), MAX_BYTES_PER_UNICODE_CHAR, notifyOutOfMemory, and rakMalloc_Ex.

RakWString & RakWString::operator= ( const RakString & right )

Definition at line 80 of file RakWString.cpp.

References SLNet::RakString::C_String().

RakWString & RakWString::operator= ( const wchar_t *const str )

Definition at line 84 of file RakWString.cpp.

References _FILE_AND_LINE_, c_str, c_strCharLength, Clear(), MAX_BYTES_PER_UNICODE_CHAR, notifyOutOfMemory, and rakMalloc_Ex.

RakWString & RakWString::operator= ( wchar_t * str )

Definition at line 103 of file RakWString.cpp.

RakWString & RakWString::operator= ( const char *const str )

Definition at line 108 of file RakWString.cpp.

References _FILE_AND_LINE_, c_str, c_strCharLength, Clear(), MAX_BYTES_PER_UNICODE_CHAR, notifyOutOfMemory, RakAssert, rakMalloc_Ex, and RAKNET_DEBUG_PRINTF.

RakWString & RakWString::operator= ( char * str )

Definition at line 142 of file RakWString.cpp.

bool RakWString::operator== ( const RakWString & right ) const

Equality.

Definition at line 210 of file RakWString.cpp.

References C_String(), and GetLength().

bool RakWString::operator> ( const RakWString & right ) const

Definition at line 224 of file RakWString.cpp.

References C_String().

bool RakWString::operator>= ( const RakWString & right ) const

Definition at line 228 of file RakWString.cpp.

References C_String().

void RakWString::Printf ( void )

Print the string to the screen.

Definition at line 284 of file RakWString.cpp.

References C_String().

void RakWString::Serialize ( BitStream * bs ) const

Serialize to a bitstream, uncompressed (slightly faster)

Parameters
[out] bs Bitstream to serialize to

Definition at line 292 of file RakWString.cpp.

References C_String().

Referenced by SLNet::BitStream::Write(), and SLNet::BitStream::WriteCompressed().

void RakWString::Serialize | ( | const wchar_t *const | str,
 |  | BitStream * | bs
 | ) |  |
static

Static version of the Serialize function.

Definition at line 296 of file RakWString.cpp.

References _FILE_AND_LINE_, MAX_BYTES_PER_UNICODE_CHAR, rakFree_Ex, rakMalloc_Ex, SLNet::BitStream::Write(), SLNet::BitStream::WriteAlignedBytes(), and SLNet::BitStream::WriteCasted().

void RakWString::Set ( wchar_t * str )

Set the value of the string.

Definition at line 238 of file RakWString.cpp.

int RakWString::StrCmp ( const RakWString & right ) const

Compare strings (case sensitive)

Definition at line 265 of file RakWString.cpp.

References C_String().

int RakWString::StrICmp ( const RakWString & right ) const

Compare strings (not case sensitive)

Definition at line 269 of file RakWString.cpp.

References C_String().

unsigned long RakWString::ToInteger ( const RakWString & rs )
static

Has the string into an unsigned int.

Definition at line 250 of file RakWString.cpp.

References C_String(), GetLength(), and MAX_BYTES_PER_UNICODE_CHAR.

Member Data Documentation

wchar_t* SLNet::RakWString::c_str
protected

Definition at line 120 of file wstring.h.

Referenced by Clear(), Deserialize(), operator+=(), operator=(), RakWString(), and ~RakWString().

size_t SLNet::RakWString::c_strCharLength
protected

Definition at line 121 of file wstring.h.

Referenced by Clear(), Deserialize(), GetLength(), operator+=(), operator=(), and RakWString().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/wstring.h
  • Source/src/RakWString.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: CheckSum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | List of all members
CheckSum Class Reference

Generates and validates checksums. More...

#include <slikenet/CheckSum.h>

Public Member Functions

CheckSum ()
Default constructor.
void | Clear ()
void | Add (unsigned int w)
void | Add (unsigned short w)
void | Add (unsigned char *b, unsigned int length)
void | Add (unsigned char b)
unsigned int | Get ()

Protected Attributes

unsigned short | r
unsigned short | c1
unsigned short | c2
unsigned int | sum

Detailed Description

Generates and validates checksums.

Definition at line 27 of file CheckSum.h.

Constructor & Destructor Documentation

CheckSum::CheckSum ( )
inline

Default constructor.

Definition at line 34 of file CheckSum.h.

References Clear().

Member Function Documentation

void CheckSum::Add ( unsigned int w )

Definition at line 33 of file CheckSum.cpp.

Referenced by Add().

void CheckSum::Add ( unsigned short w )

Definition at line 60 of file CheckSum.cpp.

References Add().

void CheckSum::Add | ( | unsigned char * | b,
 |  | unsigned int | length
 | ) |  |

Definition at line 106 of file CheckSum.cpp.

References Add().

void CheckSum::Add ( unsigned char b )

Definition at line 87 of file CheckSum.cpp.

References c1, c2, r, and sum.

void CheckSum::Clear ( )
inline

Definition at line 39 of file CheckSum.h.

References c1, c2, r, and sum.

Referenced by CheckSum().

unsigned int CheckSum::Get ( )
inline

Definition at line 56 of file CheckSum.h.

References sum.

Member Data Documentation

unsigned short CheckSum::c1
protected

Definition at line 63 of file CheckSum.h.

Referenced by Add(), and Clear().

unsigned short CheckSum::c2
protected

Definition at line 64 of file CheckSum.h.

Referenced by Add(), and Clear().

unsigned short CheckSum::r
protected

Definition at line 62 of file CheckSum.h.

Referenced by Add(), and Clear().

unsigned int CheckSum::sum
protected

Definition at line 65 of file CheckSum.h.

Referenced by Add(), Clear(), and Get().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/CheckSum.h
  • Source/src/CheckSum.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: CSHA1 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Static Public Member Functions | List of all members
CSHA1 Class Reference

#include <slikenet/DR_SHA1.h>

Public Types

enum REPORT_TYPE { REPORT_HEX = 0, REPORT_DIGIT = 1, REPORT_HEX_SHORT = 2 }

Public Member Functions

CSHA1 ()
~CSHA1 ()
void | Reset ()
void | Update (const UINT_8 *pbData, UINT_32 uLen)
bool | HashFile (const TCHAR *tszFileName)
void | Final ()
bool | ReportHash (TCHAR *tszReport, REPORT_TYPE rtReportType=REPORT_HEX) const
bool | ReportHashStl (std::basic_string< TCHAR > &strOut, REPORT_TYPE rtReportType=REPORT_HEX) const
bool | GetHash (UINT_8 *pbDest20) const
unsigned char * | GetHash (void) const

Static Public Member Functions

static void HMAC (unsigned char *sharedKey, int sharedKeyLength, unsigned char *data, int dataLength, unsigned char output[SHA1_LENGTH])

Detailed Description

Definition at line 246 of file DR_SHA1.h.

Member Enumeration Documentation

enum CSHA1::REPORT_TYPE
Enumerator:
REPORT_HEX
REPORT_DIGIT
REPORT_HEX_SHORT

Definition at line 251 of file DR_SHA1.h.

Constructor & Destructor Documentation

CSHA1::CSHA1 ( )

Definition at line 51 of file DR_SHA1.cpp.

References Reset().

CSHA1::~CSHA1 ( )

Member Function Documentation

void CSHA1::Final ( )

Definition at line 178 of file DR_SHA1.cpp.

References UINT_32, UINT_8, and Update().

Referenced by HMAC().

bool CSHA1::GetHash ( UINT_8 * pbDest20 ) const

Definition at line 254 of file DR_SHA1.cpp.

Referenced by HMAC().

unsigned char * CSHA1::GetHash ( void ) const

Definition at line 263 of file DR_SHA1.cpp.

bool CSHA1::HashFile ( const TCHAR * tszFileName )
void CSHA1::HMAC | ( | unsigned char * | sharedKey,
 |  | int | sharedKeyLength,
 |  | unsigned char * | data,
 |  | int | dataLength,
 |  | unsigned char | output[SHA1_LENGTH]
 | ) |  |
static

Definition at line 270 of file DR_SHA1.cpp.

References Final(), GetHash(), Reset(), SHA1_LENGTH, and Update().

bool CSHA1::ReportHash | ( | TCHAR * | tszReport,
 |  | REPORT_TYPE | rtReportType = REPORT_HEX
 | ) |  | const
bool CSHA1::ReportHashStl | ( | std::basic_string< TCHAR > & | strOut,
 |  | REPORT_TYPE | rtReportType = REPORT_HEX
 | ) |  | const
void CSHA1::Reset ( void )

Definition at line 65 of file DR_SHA1.cpp.

Referenced by CSHA1(), and HMAC().

void CSHA1::Update | ( | const UINT_8 * | pbData,
 |  | UINT_32 | uLen
 | ) |  |

Definition at line 119 of file DR_SHA1.cpp.

References UINT_32.

Referenced by Final(), and HMAC().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/DR_SHA1.h
  • Source/src/DR_SHA1.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: FileListNodeContext Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | List of all members
FileListNodeContext Struct Reference

#include <slikenet/FileListNodeContext.h>

Public Member Functions

FileListNodeContext ()
FileListNodeContext (unsigned char o, uint32_t f1, uint32_t f2, uint32_t f3)
~FileListNodeContext ()

Public Attributes

unsigned char | op
uint32_t flnc_extraData1
uint32_t flnc_extraData2
uint32_t flnc_extraData3
void * | dataPtr
unsigned int | dataLength

Detailed Description

Definition at line 25 of file FileListNodeContext.h.

Constructor & Destructor Documentation

FileListNodeContext::FileListNodeContext ( )
inline

Definition at line 27 of file FileListNodeContext.h.

References dataLength, and dataPtr.

FileListNodeContext::FileListNodeContext | ( | unsigned char | o,
 |  | uint32_t | f1,
 |  | uint32_t | f2,
 |  | uint32_t | f3
 | ) |  |
inline

Definition at line 28 of file FileListNodeContext.h.

References dataLength, and dataPtr.

FileListNodeContext::~FileListNodeContext ( )
inline

Definition at line 29 of file FileListNodeContext.h.

Member Data Documentation

unsigned int FileListNodeContext::dataLength

Definition at line 36 of file FileListNodeContext.h.

Referenced by FileListNodeContext().

void* FileListNodeContext::dataPtr

Definition at line 35 of file FileListNodeContext.h.

Referenced by FileListNodeContext().

uint32_t FileListNodeContext::flnc_extraData1

Definition at line 32 of file FileListNodeContext.h.

Referenced by operator<<(), and operator>>().

uint32_t FileListNodeContext::flnc_extraData2

Definition at line 33 of file FileListNodeContext.h.

Referenced by operator<<(), and operator>>().

uint32_t FileListNodeContext::flnc_extraData3

Definition at line 34 of file FileListNodeContext.h.

Referenced by operator<<(), and operator>>().

unsigned char FileListNodeContext::op

Definition at line 31 of file FileListNodeContext.h.

Referenced by operator<<(), and operator>>().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/FileListNodeContext.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: GridSectorizer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GridSectorizer Class Reference

#include <slikenet/GridSectorizer.h>

Public Member Functions

GridSectorizer ()
~GridSectorizer ()
void | Init (const float _maxCellWidth, const float _maxCellHeight, const float minX, const float minY, const float maxX, const float maxY)
void | AddEntry (void *entry, const float minX, const float minY, const float maxX, const float maxY)
void | GetEntries (DataStructures::List< void * > &intersectionList, const float minX, const float minY, const float maxX, const float maxY)
void | Clear (void)

Protected Member Functions

int | WorldToCellX (const float input) const
int | WorldToCellY (const float input) const
int | WorldToCellXOffsetAndClamped (const float input) const
int | WorldToCellYOffsetAndClamped (const float input) const
bool | PositionCrossesCells (const float originX, const float originY, const float destinationX, const float destinationY) const

Protected Attributes

float | cellOriginX
float | cellOriginY
float | cellWidth
float | cellHeight
float | invCellWidth
float | invCellHeight
float | gridWidth
float | gridHeight
int | gridCellWidthCount
int | gridCellHeightCount
DataStructures::List< void * > * | grid

Detailed Description

Definition at line 29 of file GridSectorizer.h.

Constructor & Destructor Documentation

GridSectorizer::GridSectorizer ( )

Definition at line 21 of file GridSectorizer.cpp.

References grid.

GridSectorizer::~GridSectorizer ( )

Definition at line 25 of file GridSectorizer.cpp.

References _FILE_AND_LINE_, grid, and SLNet::OP_DELETE_ARRAY().

Member Function Documentation

void GridSectorizer::AddEntry | ( | void * | entry,
 |  | const float | minX,
 |  | const float | minY,
 |  | const float | maxX,
 |  | const float | maxY
 | ) |  |

Definition at line 55 of file GridSectorizer.cpp.

References _FILE_AND_LINE_, cellWidth, grid, gridCellWidthCount, DataStructures::List< list_type >::Insert(), RakAssert, WorldToCellXOffsetAndClamped(), and WorldToCellYOffsetAndClamped().

void GridSectorizer::Clear ( void )

Definition at line 200 of file GridSectorizer.cpp.

References _FILE_AND_LINE_, grid, gridCellHeightCount, and gridCellWidthCount.

void GridSectorizer::GetEntries | ( | DataStructures::List< void * > & | intersectionList,
 |  | const float | minX,
 |  | const float | minY,
 |  | const float | maxX,
 |  | const float | maxY
 | ) |  |

Definition at line 149 of file GridSectorizer.cpp.

References _FILE_AND_LINE_, DataStructures::List< list_type >::Clear(), grid, gridCellWidthCount, DataStructures::List< list_type >::Insert(), DataStructures::List< list_type >::Size(), WorldToCellXOffsetAndClamped(), and WorldToCellYOffsetAndClamped().

void GridSectorizer::Init | ( | const float | _maxCellWidth,
 |  | const float | _maxCellHeight,
 |  | const float | minX,
 |  | const float | minY,
 |  | const float | maxX,
 |  | const float | maxY
 | ) |  |

Definition at line 30 of file GridSectorizer.cpp.

References _FILE_AND_LINE_, cellHeight, cellOriginX, cellOriginY, cellWidth, grid, gridCellHeightCount, gridCellWidthCount, gridHeight, gridWidth, DataStructures::OrderedList< key_type, data_type, default_comparison_function >::IMPLEMENT_DEFAULT_COMPARISON(), invCellHeight, invCellWidth, SLNet::OP_DELETE_ARRAY(), and RakAssert.

bool GridSectorizer::PositionCrossesCells | ( | const float | originX,
 |  | const float | originY,
 |  | const float | destinationX,
 |  | const float | destinationY
 | ) |  | const
 protected

Definition at line 174 of file GridSectorizer.cpp.

References cellHeight, and cellWidth.

int GridSectorizer::WorldToCellX ( const float input ) const
protected

Definition at line 178 of file GridSectorizer.cpp.

References cellOriginX, and invCellWidth.

Referenced by WorldToCellXOffsetAndClamped().

int GridSectorizer::WorldToCellXOffsetAndClamped ( const float input ) const
protected

Definition at line 186 of file GridSectorizer.cpp.

References gridCellWidthCount, and WorldToCellX().

Referenced by AddEntry(), and GetEntries().

int GridSectorizer::WorldToCellY ( const float input ) const
protected

Definition at line 182 of file GridSectorizer.cpp.

References cellOriginY, and invCellHeight.

Referenced by WorldToCellYOffsetAndClamped().

int GridSectorizer::WorldToCellYOffsetAndClamped ( const float input ) const
protected

Definition at line 193 of file GridSectorizer.cpp.

References gridCellHeightCount, and WorldToCellY().

Referenced by AddEntry(), and GetEntries().

Member Data Documentation

float GridSectorizer::cellHeight
protected

Definition at line 68 of file GridSectorizer.h.

Referenced by Init(), and PositionCrossesCells().

float GridSectorizer::cellOriginX
protected

Definition at line 67 of file GridSectorizer.h.

Referenced by Init(), and WorldToCellX().

float GridSectorizer::cellOriginY
protected

Definition at line 67 of file GridSectorizer.h.

Referenced by Init(), and WorldToCellY().

float GridSectorizer::cellWidth
protected

Definition at line 68 of file GridSectorizer.h.

Referenced by AddEntry(), Init(), and PositionCrossesCells().

DataStructures::List<void*>* GridSectorizer::grid
protected

Definition at line 79 of file GridSectorizer.h.

Referenced by AddEntry(), Clear(), GetEntries(), GridSectorizer(), Init(), and ~GridSectorizer().

int GridSectorizer::gridCellHeightCount
protected

Definition at line 71 of file GridSectorizer.h.

Referenced by Clear(), Init(), and WorldToCellYOffsetAndClamped().

int GridSectorizer::gridCellWidthCount
protected

Definition at line 71 of file GridSectorizer.h.

Referenced by AddEntry(), Clear(), GetEntries(), Init(), and WorldToCellXOffsetAndClamped().

float GridSectorizer::gridHeight
protected

Definition at line 70 of file GridSectorizer.h.

Referenced by Init().

float GridSectorizer::gridWidth
protected

Definition at line 70 of file GridSectorizer.h.

Referenced by Init().

float GridSectorizer::invCellHeight
protected

Definition at line 69 of file GridSectorizer.h.

Referenced by Init(), and WorldToCellY().

float GridSectorizer::invCellWidth
protected

Definition at line 69 of file GridSectorizer.h.

Referenced by Init(), and WorldToCellX().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/GridSectorizer.h
  • Source/src/GridSectorizer.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_HuffmanEncodingTreeNode.h File Reference

  • File List
  • File Members
  • Source
  • include
  • slikenet
Classes
DS_HuffmanEncodingTreeNode.h File Reference

[Internal] A single node in the Huffman Encoding Tree. More...

Go to the source code of this file.

Classes

struct HuffmanEncodingTreeNode

Detailed Description

[Internal] A single node in the Huffman Encoding Tree.

Definition in file DS_HuffmanEncodingTreeNode.h.

Class Documentation

struct HuffmanEncodingTreeNode

Definition at line 18 of file DS_HuffmanEncodingTreeNode.h.

Class Members
HuffmanEncodingTreeNode * | left
HuffmanEncodingTreeNode * | parent
HuffmanEncodingTreeNode * | right
unsigned char | value
unsigned | weight
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: RefCountedObj Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | List of all members
RefCountedObj Class Reference

World's simplest class :) More...

#include <slikenet/RefCountedObj.h>

Public Member Functions

RefCountedObj ()
virtual | ~RefCountedObj ()
void | AddRef (void)
void | Deref (void)

Public Attributes

int refCount

Detailed Description

World's simplest class :)

Definition at line 28 of file RefCountedObj.h.

Constructor & Destructor Documentation

RefCountedObj::RefCountedObj ( )
inline

Definition at line 31 of file RefCountedObj.h.

References refCount.

virtual RefCountedObj::~RefCountedObj ( )
inlinevirtual

Definition at line 32 of file RefCountedObj.h.

Member Function Documentation

void RefCountedObj::AddRef ( void )
inline

Definition at line 33 of file RefCountedObj.h.

References refCount.

void RefCountedObj::Deref ( void )
inline

Definition at line 34 of file RefCountedObj.h.

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

Member Data Documentation

int RefCountedObj::refCount

Definition at line 35 of file RefCountedObj.h.

Referenced by AddRef(), Deref(), and RefCountedObj().

The documentation for this class was generated from the following file:
  • Source/include/slikenet/RefCountedObj.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: RNS2_Windows_Linux_360 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
RNS2_Windows_Linux_360 Class Reference
+ Inheritance diagram for RNS2_Windows_Linux_360:
The documentation for this class was generated from the following file:
  • Source/include/slikenet/socket2.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DR_SHA1.h File Reference

  • Source
  • include
  • slikenet
Classes | Macros
DR_SHA1.h File Reference
#include "memoryoverride.h"
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include "Export.h"
#include <limits.h>
#include <string>

Go to the source code of this file.

Classes

union | SHA1_WORKSPACE_BLOCK
class | CSHA1

Macros

#define | SHA1_LENGTH 20
#define | SHA1_UTILITY_FUNCTIONS
#define | SHA1_STL_FUNCTIONS
#define | SHA1_LITTLE_ENDIAN
#define | SHA1_WIPE_VARIABLES
#define | TCHAR char
#define | _T(__x) (__x)
#define | _tmain main
#define | _tprintf printf
#define | _getts gets
#define | _tcslen strlen
#define | _tfopen fopen
#define | _tcscpy strcpy
#define | _tcscat strcat
#define | _sntprintf snprintf
#define | UINT_8 unsigned char
#define | UINT_32 unsigned int
#define | INT_64 long long
#define | UINT_64 unsigned long long

Class Documentation

union SHA1_WORKSPACE_BLOCK

Definition at line 240 of file DR_SHA1.h.

Class Members
UINT_8 | c
UINT_32 | l

Macro Definition Documentation

#define _getts gets

Definition at line 188 of file DR_SHA1.h.

#define _sntprintf snprintf

Definition at line 193 of file DR_SHA1.h.

#define _T ( __x ) (__x)

Definition at line 185 of file DR_SHA1.h.

#define _tcscat strcat

Definition at line 192 of file DR_SHA1.h.

#define _tcscpy strcpy

Definition at line 191 of file DR_SHA1.h.

#define _tcslen strlen

Definition at line 189 of file DR_SHA1.h.

#define _tfopen fopen

Definition at line 190 of file DR_SHA1.h.

#define _tmain main

Definition at line 186 of file DR_SHA1.h.

#define _tprintf printf

Definition at line 187 of file DR_SHA1.h.

#define INT_64 long long

Definition at line 225 of file DR_SHA1.h.

#define SHA1_LENGTH 20

Definition at line 127 of file DR_SHA1.h.

Referenced by CSHA1::HMAC().

#define SHA1_LITTLE_ENDIAN

Definition at line 165 of file DR_SHA1.h.

#define SHA1_STL_FUNCTIONS

Definition at line 136 of file DR_SHA1.h.

#define SHA1_UTILITY_FUNCTIONS

Definition at line 132 of file DR_SHA1.h.

#define SHA1_WIPE_VARIABLES

Definition at line 172 of file DR_SHA1.h.

#define TCHAR char

Definition at line 182 of file DR_SHA1.h.

#define UINT_32 unsigned int

Definition at line 216 of file DR_SHA1.h.

Referenced by CSHA1::Final(), and CSHA1::Update().

#define UINT_64 unsigned long long

Definition at line 233 of file DR_SHA1.h.

#define UINT_8 unsigned char

Definition at line 205 of file DR_SHA1.h.

Referenced by CSHA1::Final().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/StringTable.h File Reference

  • include
  • slikenet
Classes | Namespaces | Typedefs | Functions
StringTable.h File Reference

A simple class to encode and decode known strings based on a lookup table. Similar to the StringCompressor class. More...

#include "DS_OrderedList.h"
#include "Export.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

struct | StrAndBool
The string plus a bool telling us if this string was copied or not. More...
class | SLNet::StringTable
Writes a string index, instead of the whole string. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Typedefs

typedef unsigned char StringTableType
StringTableType should be the smallest type possible, or else it defeats the purpose of the StringTable class, which is to save bandwidth.

Functions

int RAK_DLL_EXPORT SLNet::StrAndBoolComp (char *const &key, const StrAndBool &data)

Detailed Description

A simple class to encode and decode known strings based on a lookup table. Similar to the StringCompressor class.

Definition in file StringTable.h.

Class Documentation

struct StrAndBool

The string plus a bool telling us if this string was copied or not.

Definition at line 39 of file StringTable.h.

Class Members
bool | b
char * | str

Typedef Documentation

typedef unsigned char StringTableType

StringTableType should be the smallest type possible, or else it defeats the purpose of the StringTable class, which is to save bandwidth.

Definition at line 33 of file StringTable.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: ThreadDataInterface Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | List of all members
ThreadDataInterface Class Referenceabstract

#include <slikenet/ThreadPool.h>

Public Member Functions

ThreadDataInterface ()
virtual | ~ThreadDataInterface ()
virtual void * | PerThreadFactory (void *context)=0
virtual void | PerThreadDestructor (void *factoryResult, void *context)=0

Detailed Description

Definition at line 26 of file ThreadPool.h.

Constructor & Destructor Documentation

ThreadDataInterface::ThreadDataInterface ( )
inline

Definition at line 29 of file ThreadPool.h.

virtual ThreadDataInterface::~ThreadDataInterface ( )
inlinevirtual

Definition at line 30 of file ThreadPool.h.

Member Function Documentation

virtual void ThreadDataInterface::PerThreadDestructor | ( | void * | factoryResult,
 |  | void * | context
 | ) |  |
pure virtual
virtual void* ThreadDataInterface::PerThreadFactory ( void * context )
pure virtual
The documentation for this class was generated from the following file:
  • Source/include/slikenet/ThreadPool.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: ThreadPool< InputType, OutputType > Struct Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ThreadPool< InputType, OutputType > Struct Template Reference

#include <slikenet/ThreadPool.h>

+ Inheritance diagram for ThreadPool< InputType, OutputType >:

Public Member Functions

ThreadPool ()
~ThreadPool ()
bool | StartThreads (int numThreads, int stackSize, void *(*_perThreadInit)()=0, void(*_perThreadDeinit)(void *)=0)
void | SetThreadDataInterface (ThreadDataInterface *tdi, void *context)
void | StopThreads (void)
Stops all threads.
void | AddInput (OutputType(*workerThreadCallback)(InputType, bool *returnOutput, void *perThreadData), InputType inputData)
void | AddOutput (OutputType outputData)
bool | HasOutput (void)
bool | HasOutputFast (void)
bool | HasInput (void)
bool | HasInputFast (void)
OutputType | GetOutput (void)
void | Clear (void)
Clears internal buffers.
void | LockInput (void)
void | UnlockInput (void)
Unlock the input buffer after you are done with the functions InputSize, GetInputAtIndex, and RemoveInputAtIndex.
unsigned | InputSize (void)
Length of the input queue.
InputType | GetInputAtIndex (unsigned index)
Get the input at a specified index.
void | RemoveInputAtIndex (unsigned index)
Remove input from a specific index. This does NOT do memory deallocation - it only removes the item from the queue.
void | LockOutput (void)
void | UnlockOutput (void)
Unlock the output buffer after you are done with the functions OutputSize, GetOutputAtIndex, and RemoveOutputAtIndex.
unsigned | OutputSize (void)
Length of the output queue.
OutputType | GetOutputAtIndex (unsigned index)
Get the output at a specified index.
void | RemoveOutputAtIndex (unsigned index)
Remove output from a specific index. This does NOT do memory deallocation - it only removes the item from the queue.
void | ClearInput (void)
Removes all items from the input queue.
void | ClearOutput (void)
Removes all items from the output queue.
bool | IsWorking (void)
Are any of the threads working, or is input or output available?
int | NumThreadsWorking (void)
The number of currently active threads.
bool | WasStarted (void)
Did we call Start?
bool | Pause (void)
void | Resume (void)

Protected Member Functions

template<class ThreadInputType , class ThreadOutputType >
friend RAK_THREAD_DECLARATION (WorkerThread)

Protected Attributes

SLNet::SimpleMutex inputQueueMutex
SLNet::SimpleMutex outputQueueMutex
SLNet::SimpleMutex workingThreadCountMutex
SLNet::SimpleMutex runThreadsMutex
void *(* | perThreadDataFactory )()
void(* | perThreadDataDestructor )(void *)
DataStructures::Queue
< OutputType(*)(InputType,
bool *, void *)> 		inputFunctionQueue
DataStructures::Queue< InputType > | inputQueue
DataStructures::Queue< OutputType > | outputQueue
ThreadDataInterface * threadDataInterface
void * | tdiContext
bool | runThreads
int | numThreadsRunning
int | numThreadsWorking
SLNet::SimpleMutex numThreadsRunningMutex
SLNet::SignaledEvent quitAndIncomingDataEvents

Detailed Description

template<class InputType, class OutputType>
struct ThreadPool< InputType, OutputType >

A simple class to create worker threads that processes a queue of functions with data. This class does not allocate or deallocate memory. It is up to the user to handle memory management. InputType and OutputType are stored directly in a queue. For large structures, if you plan to delete from the middle of the queue, you might wish to store pointers rather than the structures themselves so the array can shift efficiently.

Definition at line 40 of file ThreadPool.h.

Constructor & Destructor Documentation

template<class InputType , class OutputType >
ThreadPool< InputType, OutputType >::ThreadPool ( )

Definition at line 307 of file ThreadPool.h.

References numThreadsRunning.

template<class InputType , class OutputType >
ThreadPool< InputType, OutputType >::~ThreadPool ( )

Definition at line 317 of file ThreadPool.h.

Member Function Documentation

template<class InputType, class OutputType>
void ThreadPool< InputType, OutputType >::AddInput | ( | OutputType(*)(InputType, bool *returnOutput, void *perThreadData) | workerThreadCallback,
 |  | InputType | inputData
 | ) |  |

Adds a function to a queue with data to pass to that function. This function will be called from the thread Memory management is your responsibility! This class does not allocate or deallocate memory. The best way to deallocate inputData is in userCallback. If you call EndThreads such that callbacks were not called, you can iterate through the inputQueue and deallocate all pending input data there The best way to deallocate output is as it is returned to you from GetOutput. Similarly, if you end the threads such that not all output was returned, you can iterate through outputQueue and deallocate it there.

Parameters
[in] | workerThreadCallback | The function to call from the thread
[in] | inputData | The parameter to pass to userCallback

Definition at line 422 of file ThreadPool.h.

References _FILE_AND_LINE_.

template<class InputType , class OutputType>
void ThreadPool< InputType, OutputType >::AddOutput ( OutputType outputData )

Adds to the output queue Use it if you want to inject output into the same queue that the system uses. Normally you would not use this. Consider it a convenience function.

Parameters
[in] outputData The output to inject

Definition at line 432 of file ThreadPool.h.

References _FILE_AND_LINE_.

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::Clear ( void )

Clears internal buffers.

Definition at line 477 of file ThreadPool.h.

References _FILE_AND_LINE_.

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::ClearInput ( void )

Removes all items from the input queue.

Definition at line 551 of file ThreadPool.h.

References _FILE_AND_LINE_.

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::ClearOutput ( void )

Removes all items from the output queue.

Definition at line 558 of file ThreadPool.h.

References _FILE_AND_LINE_.

template<class InputType , class OutputType >
InputType ThreadPool< InputType, OutputType >::GetInputAtIndex ( unsigned index )

Get the input at a specified index.

Definition at line 515 of file ThreadPool.h.

template<class InputType , class OutputType >
OutputType ThreadPool< InputType, OutputType >::GetOutput ( void )

Gets the output of a call to userCallback HasOutput must return true before you call this function. Otherwise it will assert.

Returns
The output of userCallback. If you have different output signatures, it is up to you to encode the data to indicate this

Definition at line 467 of file ThreadPool.h.

template<class InputType , class OutputType >
OutputType ThreadPool< InputType, OutputType >::GetOutputAtIndex ( unsigned index )

Get the output at a specified index.

Definition at line 541 of file ThreadPool.h.

template<class InputType , class OutputType >
bool ThreadPool< InputType, OutputType >::HasInput ( void )

Returns true if input from GetInput is waiting.

Returns
true if input is waiting, false otherwise

Definition at line 458 of file ThreadPool.h.

template<class InputType , class OutputType >
bool ThreadPool< InputType, OutputType >::HasInputFast ( void )

Inaccurate but fast version of HasInput. If this returns true, you should still check HasInput for the real value.

Returns
true if input is probably waiting, false otherwise

Definition at line 453 of file ThreadPool.h.

template<class InputType , class OutputType >
bool ThreadPool< InputType, OutputType >::HasOutput ( void )

Returns true if output from GetOutput is waiting.

Returns
true if output is waiting, false otherwise

Definition at line 444 of file ThreadPool.h.

template<class InputType , class OutputType >
bool ThreadPool< InputType, OutputType >::HasOutputFast ( void )

Inaccurate but fast version of HasOutput. If this returns true, you should still check HasOutput for the real value.

Returns
true if output is probably waiting, false otherwise

Definition at line 439 of file ThreadPool.h.

template<class InputType , class OutputType >
unsigned ThreadPool< InputType, OutputType >::InputSize ( void )

Length of the input queue.

Definition at line 510 of file ThreadPool.h.

template<class InputType , class OutputType >
bool ThreadPool< InputType, OutputType >::IsWorking ( void )

Are any of the threads working, or is input or output available?

Definition at line 563 of file ThreadPool.h.

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::LockInput ( void )

Lock the input buffer before calling the functions InputSize, InputAtIndex, and RemoveInputAtIndex It is only necessary to lock the input or output while the threads are running

Definition at line 500 of file ThreadPool.h.

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::LockOutput ( void )

Lock the output buffer before calling the functions OutputSize, OutputAtIndex, and RemoveOutputAtIndex It is only necessary to lock the input or output while the threads are running

Definition at line 526 of file ThreadPool.h.

template<class InputType , class OutputType >
int ThreadPool< InputType, OutputType >::NumThreadsWorking ( void )

The number of currently active threads.

Definition at line 591 of file ThreadPool.h.

template<class InputType , class OutputType >
unsigned ThreadPool< InputType, OutputType >::OutputSize ( void )

Length of the output queue.

Definition at line 536 of file ThreadPool.h.

template<class InputType , class OutputType >
bool ThreadPool< InputType, OutputType >::Pause ( void )

Definition at line 606 of file ThreadPool.h.

References RakSleep().

template<class InputType, class OutputType>
template<class ThreadInputType , class ThreadOutputType >
ThreadPool< InputType, OutputType >::RAK_THREAD_DECLARATION ( WorkerThread )
protected
template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::RemoveInputAtIndex ( unsigned index )

Remove input from a specific index. This does NOT do memory deallocation - it only removes the item from the queue.

Definition at line 520 of file ThreadPool.h.

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::RemoveOutputAtIndex ( unsigned index )

Remove output from a specific index. This does NOT do memory deallocation - it only removes the item from the queue.

Definition at line 546 of file ThreadPool.h.

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::Resume ( void )

Definition at line 619 of file ThreadPool.h.

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::SetThreadDataInterface | ( | ThreadDataInterface * | tdi,
 |  | void * | context
 | ) |  |

Definition at line 382 of file ThreadPool.h.

template<class InputType , class OutputType >
bool ThreadPool< InputType, OutputType >::StartThreads | ( | int | numThreads,
 |  | int | stackSize,
 |  | void *(*)() | _perThreadInit = 0,
 |  | void(*)(void *) | _perThreadDeinit = 0
 | ) |  |

Start the specified number of threads.

Parameters
[in] | numThreads | The number of threads to start
[in] | stackSize | 0 for default (except on consoles).
[in] | _perThreadInit | User callback to return data stored per thread. Pass 0 if not needed.
[in] | _perThreadDeinit | User callback to destroy data stored per thread, created by _perThreadInit. Pass 0 if not needed.
Returns
True on success, false on failure.

Definition at line 323 of file ThreadPool.h.

References SLNet::RakThread::Create(), numThreadsRunning, and RakSleep().

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::StopThreads ( void )

Stops all threads.

Definition at line 388 of file ThreadPool.h.

References numThreadsRunning, and RakSleep().

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::UnlockInput ( void )

Unlock the input buffer after you are done with the functions InputSize, GetInputAtIndex, and RemoveInputAtIndex.

Definition at line 505 of file ThreadPool.h.

template<class InputType , class OutputType >
void ThreadPool< InputType, OutputType >::UnlockOutput ( void )

Unlock the output buffer after you are done with the functions OutputSize, GetOutputAtIndex, and RemoveOutputAtIndex.

Definition at line 531 of file ThreadPool.h.

template<class InputType , class OutputType >
bool ThreadPool< InputType, OutputType >::WasStarted ( void )

Did we call Start?

Definition at line 597 of file ThreadPool.h.

Member Data Documentation

template<class InputType, class OutputType>
DataStructures::Queue<OutputType (*)(InputType, bool *, void*)> ThreadPool< InputType, OutputType >::inputFunctionQueue
protected

Definition at line 161 of file ThreadPool.h.

Referenced by for().

template<class InputType, class OutputType>
DataStructures::Queue<InputType> ThreadPool< InputType, OutputType >::inputQueue
protected

Definition at line 162 of file ThreadPool.h.

Referenced by for().

template<class InputType, class OutputType>
SLNet::SimpleMutex ThreadPool< InputType, OutputType >::inputQueueMutex
protected

Definition at line 154 of file ThreadPool.h.

Referenced by for().

template<class InputType, class OutputType>
int ThreadPool< InputType, OutputType >::numThreadsRunning
protected

Definition at line 183 of file ThreadPool.h.

template<class InputType, class OutputType>
SLNet::SimpleMutex ThreadPool< InputType, OutputType >::numThreadsRunningMutex
protected

Definition at line 187 of file ThreadPool.h.

template<class InputType, class OutputType>
int ThreadPool< InputType, OutputType >::numThreadsWorking
protected

Definition at line 185 of file ThreadPool.h.

Referenced by for().

template<class InputType, class OutputType>
DataStructures::Queue<OutputType> ThreadPool< InputType, OutputType >::outputQueue
protected

Definition at line 163 of file ThreadPool.h.

Referenced by for().

template<class InputType, class OutputType>
SLNet::SimpleMutex ThreadPool< InputType, OutputType >::outputQueueMutex
protected

Definition at line 154 of file ThreadPool.h.

Referenced by for().

template<class InputType, class OutputType>
void(* ThreadPool< InputType, OutputType >::perThreadDataDestructor)(void *)
protected

Definition at line 157 of file ThreadPool.h.

template<class InputType, class OutputType>
void*(* ThreadPool< InputType, OutputType >::perThreadDataFactory)()
protected

Definition at line 156 of file ThreadPool.h.

template<class InputType, class OutputType>
SLNet::SignaledEvent ThreadPool< InputType, OutputType >::quitAndIncomingDataEvents
protected

Definition at line 189 of file ThreadPool.h.

Referenced by for().

template<class InputType, class OutputType>
bool ThreadPool< InputType, OutputType >::runThreads
protected

Definition at line 181 of file ThreadPool.h.

Referenced by for().

template<class InputType, class OutputType>
SLNet::SimpleMutex ThreadPool< InputType, OutputType >::runThreadsMutex
protected

Definition at line 154 of file ThreadPool.h.

Referenced by for().

template<class InputType, class OutputType>
void* ThreadPool< InputType, OutputType >::tdiContext
protected

Definition at line 166 of file ThreadPool.h.

template<class InputType, class OutputType>
ThreadDataInterface* ThreadPool< InputType, OutputType >::threadDataInterface
protected

Definition at line 165 of file ThreadPool.h.

template<class InputType, class OutputType>
SLNet::SimpleMutex ThreadPool< InputType, OutputType >::workingThreadCountMutex
protected

Definition at line 154 of file ThreadPool.h.

Referenced by for().

The documentation for this struct was generated from the following file:
  • Source/include/slikenet/ThreadPool.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: WSAStartupSingleton Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
WSAStartupSingleton Class Reference

#include <slikenet/WSAStartupSingleton.h>

Public Member Functions

WSAStartupSingleton ()
~WSAStartupSingleton ()

Static Public Member Functions

static void | AddRef (void)
static void | Deref (void)

Static Protected Attributes

static int refCount =0

Detailed Description

Definition at line 14 of file WSAStartupSingleton.h.

Constructor & Destructor Documentation

WSAStartupSingleton::WSAStartupSingleton ( )

Definition at line 44 of file WSAStartupSingleton.cpp.

WSAStartupSingleton::~WSAStartupSingleton ( )

Definition at line 45 of file WSAStartupSingleton.cpp.

Member Function Documentation

void WSAStartupSingleton::AddRef ( void )
static

Definition at line 46 of file WSAStartupSingleton.cpp.

References _T, RAKNET_DEBUG_TPRINTF, and refCount.

Referenced by SLNet::SystemAddress::FromString(), and SLNet::RakPeer::RakPeer().

void WSAStartupSingleton::Deref ( void )
static

Definition at line 77 of file WSAStartupSingleton.cpp.

References refCount.

Referenced by SLNet::SystemAddress::FromString(), and SLNet::RakPeer::~RakPeer().

Member Data Documentation

int WSAStartupSingleton::refCount =0
staticprotected

Definition at line 23 of file WSAStartupSingleton.h.

Referenced by AddRef(), and Deref().

The documentation for this class was generated from the following files:
  • Source/include/slikenet/WSAStartupSingleton.h
  • Source/src/WSAStartupSingleton.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Index

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Class Index
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W
A
FileListProgress (SLNet) Multilist (DataStructures) RakNetSocket2Allocator (SLNet) Table::SortQuery (DataStructures)
FileListTransfer (SLNet) TeamBalancer::MyTeamMembers (SLNet) RakNetStatistics (SLNet) SplitPacketChannel (SLNet)
NatPunchthroughClient::AddrAndGuid (SLNet) FileListTransferCBInterface (SLNet)
N
RakNetTransport2 (SLNet) UDPForwarder::StartForwardingInputStruct (SLNet)
AddressOrGUID (SLNet) FileListTransferCBInterface::FileProgressStruct (SLNet) RakPeer (SLNet) UDPForwarder::StartForwardingOutputStruct (SLNet)
AutopatcherRepositoryInterface (SLNet) FileListTransfer::FileToPush (SLNet) NatTypeDetectionServer::NATDetectionAttempt (SLNet) RakPeerInterface (SLNet) StatisticsHistory (SLNet)
AVLBalancedBinarySearchTree (DataStructures) FileListTransfer::FileToPushRecipient (SLNet) NatPunchthroughClient (SLNet) RakString (SLNet) StatisticsHistoryPlugin (SLNet)
B
FilteredSystem (SLNet) NatPunchthroughDebugInterface (SLNet) RakThread (SLNet) UDPForwarder::StopForwardingStruct (SLNet)
Table::FilterQuery (DataStructures) NatPunchthroughDebugInterface_PacketLogger (SLNet) RakWString (SLNet) StrAndBool
HTTPConnection::BadResponse (SLNet) FilterSet (SLNet) NatPunchthroughDebugInterface_Printf (SLNet) RangeList (DataStructures) RelayPlugin::StrAndGuid (SLNet)
RakPeer::BanStruct (SLNet) FLP_Printf (SLNet) NatPunchthroughServer (SLNet) RangeNode (DataStructures) RelayPlugin::StrAndGuidAndRoom (SLNet)
BinarySearchTree (DataStructures) Router2::ForwardedConnection (SLNet) NatPunchthroughServerDebugInterface (SLNet) ReadyEvent (SLNet) StringCompressor (SLNet)
BitStream (SLNet) UDPForwarder::ForwardEntry (SLNet) NatPunchthroughServerDebugInterface_PacketLogger (SLNet) ReadyEvent::ReadyEventNode (SLNet) StringTable (SLNet)
BPlusTree (DataStructures) UDPProxyCoordinator::ForwardingRequest (SLNet) NatPunchthroughServerDebugInterface_Printf (SLNet) RefCountedObj SystemAddress (SLNet)
BPSTracker (SLNet)
G
NatTypeDetectionClient (SLNet) ReferenceCounter (SLNet) LogCommandParser::SystemAddressAndChannel (SLNet)
RakPeer::BufferedCommandStruct (SLNet) NatTypeDetectionServer (SLNet) RegisteredCommand (SLNet) ConnectionGraph2::SystemAddressAndGuid (SLNet)
CloudServer::BufferedGetResponseFromServer (SLNet) CloudServer::GetRequest (SLNet) NetworkIDManager (SLNet) RelayPlugin (SLNet)
T
BytePool (DataStructures) GridSectorizer NetworkIDObject (SLNet) ReliabilityLayer (SLNet)
ByteQueue (DataStructures)
H
CircularLinkedList::node (DataStructures) RemoteClient (SLNet) Table (DataStructures)
C
Hash::Node (DataStructures) CloudServer::RemoteCloudClient (SLNet) TableSerializer (SLNet)
Hash (DataStructures) BinarySearchTree::node (DataStructures) CloudServer::RemoteServer (SLNet) TCPInterface (SLNet)
CCRakNetSlidingWindow (SLNet) HashIndex (DataStructures) WeightedGraph::NodeAndParent (DataStructures) ConnectionGraph2::RemoteSystem (SLNet) TeamBalancer (SLNet)
Table::Cell (DataStructures) Heap (DataStructures) TwoWayAuthentication::NonceAndRemoteSystemRequest (SLNet) ReadyEvent::RemoteSystem (SLNet) TeamManager (SLNet)
VariableDeltaSerializer::ChangedVariablesList (SLNet) OrderedChannelHeap::HeapChannelAndData (DataStructures) TwoWayAuthentication::NonceGenerator (SLNet) RemoteSystemIndex (SLNet) TeamBalancer::TeamMember (SLNet)
CheckSum Heap::HeapNode (DataStructures)
O
RakPeer::RemoteSystemStruct (SLNet) TeamSelection (SLNet)
CircularLinkedList (DataStructures) HTTPConnection (SLNet) VariableDeltaSerializer::RemoteSystemVariableHistory (SLNet) TeamSelection.teamParameter (SLNet)
CloudAllocator (SLNet) HTTPConnection2 (SLNet) FileListTransferCBInterface::OnFileStruct (SLNet) Replica3 (SLNet) TelnetTransport::TelnetClient (SLNet)
CloudClient (SLNet) HuffmanEncodingTree (SLNet) OrderedChannelHeap (DataStructures) Replica3Composite (SLNet) TelnetTransport (SLNet)
CloudClientCallback (SLNet) HuffmanEncodingTreeFactory (SLNet) OrderedList (DataStructures) ReplicaManager3 (SLNet) TCPInterface::ThisPtrPlusSysAddr (SLNet)
CloudServer::CloudData (SLNet) HuffmanEncodingTreeNode HTTPConnection::OutgoingCommand (SLNet) HTTPConnection2::Request (SLNet) FileListTransfer::ThreadData (SLNet)
CloudServer::CloudDataList (SLNet)
I
P
RakPeer::RequestedConnectionStruct (SLNet) ThreadDataInterface
CloudKey (SLNet) TM_TeamMember::RequestedTeam (SLNet) ThreadPool
CloudQuery (SLNet) IncrementalReadInterface (SLNet) Packet (SLNet) BPlusTree::ReturnAction (DataStructures) ThreadsafeAllocatingQueue (DataStructures)
CloudQueryResult (SLNet) IndexAndType (VariadicSQLParser) PacketConsoleLogger (SLNet) ReplicaManager3::RM3World (SLNet) ThreadsafePacketLogger (SLNet)
CloudQueryRow (SLNet) InternalPacket (SLNet) PacketFileLogger (SLNet) RNS2_Berkley (SLNet) StatisticsHistory::TimeAndValue (SLNet)
CloudServer::CloudQueryWithAddresses (SLNet) InternalPacketFixedSizeTransmissionHeader (SLNet) PacketizedTCP (SLNet) RNS2_BerkleyBindParameters (SLNet) BPSTracker::TimeAndValue2 (SLNet)
CloudServer (SLNet) InternalPacketRefCountedData (SLNet) PacketLogger (SLNet) RNS2_Linux (SLNet) StatisticsHistory::TimeAndValueQueue (SLNet)
CloudServerQueryFilter (SLNet) IRNS2_Berkley (SLNet) PacketOutputWindowLogger (SLNet) RNS2_SendParameters (SLNet) TM_Team (SLNet)
Table::ColumnDescriptor (DataStructures)
J
MemoryPool::Page (DataStructures) RNS2_Windows_Linux_360 TM_TeamMember (SLNet)
CommandParserInterface (SLNet) Page (DataStructures) RNS2EventHandler (SLNet) TM_World (SLNet)
Connection_RM3 (SLNet) TM_World::JoinRequestHelper (SLNet) TwoWayAuthentication::PendingChallenge (SLNet) RNS2RecvStruct (SLNet) StatisticsHistory::TrackedObject (SLNet)
NatPunchthroughServer::ConnectionAttempt (SLNet)
K
RakPeer::PingAndClockDifferential (SLNet) Router2 (SLNet) StatisticsHistory::TrackedObjectData (SLNet)
ConnectionGraph2 (SLNet) UDPProxyClient::PingServerGroup (SLNet) Router2DebugInterface (SLNet) TransportInterface (SLNet)
Router2::ConnectionRequestSystem (SLNet) CloudServer::KeySubscriberID (SLNet) PluginInterface2 (SLNet) Table::Row (DataStructures) Tree (DataStructures)
Router2::ConnnectRequest (SLNet)
L
PRO (SLNet) RelayPlugin::RP_Group (SLNet) TwoWayAuthentication (SLNet)
ConsoleServer (SLNet) PublicKey (SLNet) RPC4 (SLNet)
U
CSHA1 LastSerializationResult (SLNet) PunchthroughConfiguration (SLNet) RPC4GlobalRegistration (SLNet)
D
LastSerializationResultBS (SLNet)
Q
S
UDPForwarder (SLNet)
LinkedList (DataStructures) UDPProxyClient (SLNet)
DataCompressor (SLNet) List (DataStructures) Queue (DataStructures) UDPProxyCoordinator::SenderAndTargetAddress (SLNet) UDPProxyClientResultHandler (SLNet)
VariableDeltaSerializer::DeserializationContext (SLNet) RPC4::LocalCallback (SLNet) OrderedChannelHeap::QueueAndWeight (DataStructures) UDPProxyClient::SenderAndTargetAddress (SLNet) UDPProxyCoordinator (SLNet)
DeserializeParameters (SLNet) RPC4::LocalSlot (SLNet) QueueLinkedList (DataStructures) NatPunchthroughClient::SendPing (SLNet) UDPProxyServer (SLNet)
DirectoryDeltaTransfer (SLNet) RPC4::LocalSlotObject (SLNet)
R
VariableDeltaSerializer::SerializationContext (SLNet) UDPProxyServerResultHandler (SLNet)
FileListTransferCBInterface::DownloadCompleteStruct (SLNet) LocklessUint32_t (SLNet) SerializeParameters (SLNet) uint24_t (SLNet)
NatPunchthroughClient::DSTAndFac (SLNet) LogCommandParser (SLNet) Rackspace (SLNet) UDPProxyClient::ServerWithPing (SLNet) NatPunchthroughServer::User (SLNet)
DynDNS (SLNet)
M
Rackspace2EventCallback (SLNet) UDPProxyCoordinator::ServerWithPing (SLNet)
V
E
RackspaceEventCallback_Default (SLNet) SHA1_WORKSPACE_BLOCK
Map (DataStructures) Rackspace::RackspaceOperation (SLNet) RakString::SharedString (SLNet) VariableDeltaSerializer (SLNet)
EmailSender (SLNet) Map::MapNode (DataStructures) RakNetCommandParser (SLNet) SignaledEvent (SLNet) VariableListDeltaTracker::VariableLastValueNode (SLNet)
F
MemoryPool (DataStructures) RakNetGUID (SLNet) SimpleMutex (SLNet) VariableListDeltaTracker (SLNet)
MemoryPool::MemoryWithPage (DataStructures) RakNetRandom (SLNet) SingleProducerConsumer (DataStructures)
W
FileList (SLNet) MessageFilter (SLNet) RakNetRandomSync (SLNet) SocketDescriptor (SLNet)
FileListNode (SLNet) Router2::MiniPunchRequest (SLNet) RakNetSmartPtr (SLNet) SocketLayer (SLNet) WeightedGraph (DataStructures)
FileListNodeContext MLKeyRef (DataStructures) RakNetSocket2 (SLNet) RakPeer::SocketQueryOutput (SLNet) WSAStartupSingleton
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Hierarchy

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Class Hierarchy

Go to the graphical class hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:
[detail level 1234]
o C SLNet::NatPunchthroughClient::AddrAndGuid |
o C SLNet::AddressOrGUID |
o C SLNet::HTTPConnection::BadResponse | Encapsulates a raw HTTP response and response code
o C SLNet::RakPeer::BanStruct |
o C DataStructures::BinarySearchTree< BinarySearchTreeType > | A binary search tree and an AVL balanced binary search tree
| \ C DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType > | An AVLBalancedBinarySearchTree is a binary tree that is always balanced
o C SLNet::BitStream |
o C DataStructures::BPlusTree< KeyType, DataType, order > |
o C DataStructures::BPlusTree< unsigned, Row *, _TABLE_BPLUS_TREE_ORDER > |
o C SLNet::BPSTracker |
o C SLNet::RakPeer::BufferedCommandStruct |
o C SLNet::CloudServer::BufferedGetResponseFromServer |
o C DataStructures::BytePool |
o C DataStructures::ByteQueue |
o C SLNet::CCRakNetSlidingWindow |
o C DataStructures::Table::Cell | Holds the actual data in the table
o C SLNet::VariableDeltaSerializer::ChangedVariablesList |
o C CheckSum | Generates and validates checksums
o C DataStructures::CircularLinkedList< CircularLinkedListType > | (Circular) Linked List ADT (Doubly Linked Pointer to Node Style) -
o C DataStructures::CircularLinkedList< LinkedListType > |
| \ C DataStructures::LinkedList< LinkedListType > |
o C DataStructures::CircularLinkedList< QueueType > |
| \ C DataStructures::LinkedList< QueueType > |
o C SLNet::CloudAllocator |
| \ C SLNet::CloudServer | Stores client data, and allows cross-server communication to retrieve this data
o C SLNet::CloudClientCallback |
o C SLNet::CloudServer::CloudData |
o C SLNet::CloudServer::CloudDataList |
o C SLNet::CloudKey |
o C SLNet::CloudQuery |
o C SLNet::CloudQueryResult |
o C SLNet::CloudQueryRow |
o C SLNet::CloudServer::CloudQueryWithAddresses |
o C SLNet::CloudServerQueryFilter | Zero or more instances of CloudServerQueryFilter can be attached to CloudServer to restrict client queries All attached instances of CloudServerQueryFilter on each corresponding operation, from all directly connected clients If any attached instance returns false for a given operation, that operation is silently rejected
o C DataStructures::Table::ColumnDescriptor |
o C SLNet::CommandParserInterface | The interface used by command parsers
| o C SLNet::LogCommandParser | Adds the ability to send logging output to a remote console
| \ C SLNet::RakNetCommandParser | This allows a console client to call most of the functions in RakPeer
o C SLNet::Connection_RM3 | Each remote system is represented by Connection_RM3. Used to allocate Replica3 and track which instances have been allocated
o C SLNet::NatPunchthroughServer::ConnectionAttempt |
o C SLNet::Router2::ConnectionRequestSystem |
o C SLNet::Router2::ConnnectRequest |
o C SLNet::ConsoleServer | The main entry point for the server portion of your remote console application support
o C CSHA1 |
o C SLNet::DataCompressor | Does compression on a block of data. Not very good compression, but it's small and fast so is something you can compute at runtime
o C SLNet::VariableDeltaSerializer::DeserializationContext |
o C SLNet::DeserializeParameters |
o C SLNet::FileListTransferCBInterface::DownloadCompleteStruct |
o C SLNet::NatPunchthroughClient::DSTAndFac |
o C SLNet::DynDNS |
o C SLNet::EmailSender | Rudimentary class to send email from code
o C SLNet::FileList |
o C SLNet::FileListNode | Represents once instance of a file
o C FileListNodeContext |
o C SLNet::FileListProgress | Callback interface set with FileList::SetCallback() in case you want progress notifications when FileList::AddFilesFromDirectory() is called
| \ C SLNet::FLP_Printf | Implementation of FileListProgress to use RAKNET_DEBUG_PRINTF
o C SLNet::FileListTransferCBInterface | Used by FileListTransfer plugin as a callback for when we get a file
o C SLNet::FileListTransferCBInterface::FileProgressStruct |
o C SLNet::FileListTransfer::FileToPush |
o C SLNet::FileListTransfer::FileToPushRecipient |
o C SLNet::FilteredSystem |
o C DataStructures::Table::FilterQuery |
o C SLNet::FilterSet |
o C SLNet::Router2::ForwardedConnection |
o C SLNet::UDPForwarder::ForwardEntry |
o C SLNet::UDPProxyCoordinator::ForwardingRequest |
o C SLNet::CloudServer::GetRequest |
o C GridSectorizer |
o C DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > | Using a string as a identifier for a node, store an allocated pointer to that node
o C DataStructures::Hash< AddressOrGUID, FilteredSystem, 2048, AddressOrGUID::ToInteger > |
o C DataStructures::Hash< NetworkID, TM_Team *, 256, TM_Team::ToUint32 > |
o C DataStructures::Hash< NetworkID, TM_TeamMember *, 256, TM_TeamMember::ToUint32 > |
o C DataStructures::Hash< RakNetGUID, RemoteCloudClient *, 2048, RakNetGUID::ToUint32 > |
o C DataStructures::Hash< RakNetGUID, StrAndGuidAndRoom *, 8096, SLNet::RakNetGUID::ToUint32 > |
o C DataStructures::Hash< RakString, StrAndGuidAndRoom *, 8096, SLNet::RakString::ToInteger > |
o C DataStructures::Hash< SLNet::RakString, LocalSlot *, 256, SLNet::RakString::ToInteger > |
o C DataStructures::Hash< SLNet::RakString, SLNet::RakString, 16, SLNet::RakString::ToInteger > |
o C DataStructures::Hash< SLNet::RakString, TimeAndValueQueue *, 32, SLNet::RakString::ToInteger > |
o C DataStructures::Hash< SLNet::RakString, void(*)(SLNet::BitStream *, Packet *), 64, SLNet::RakString::ToInteger > |
o C DataStructures::Hash< SLNet::RakString, void(*)(SLNet::BitStream *, SLNet::BitStream *, Packet *), 64, SLNet::RakString::ToInteger > |
o C DataStructures::HashIndex |
o C DataStructures::Heap< weight_type, data_type, isMaxHeap > |
o C DataStructures::Heap< double, HeapChannelAndData, true > |
o C DataStructures::Heap< reliabilityHeapWeightType, InternalPacket *, false > |
o C DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData |
o C DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode |
o C SLNet::HTTPConnection | Use HTTPConnection to communicate with a web server
o C SLNet::HuffmanEncodingTree | This generates special cases of the huffman encoding tree using 8 bit keys with the additional condition that unused combinations of 8 bits are treated as a frequency of 1
o C SLNet::HuffmanEncodingTreeFactory | Creates instances of the class HuffmanEncodingTree
o C HuffmanEncodingTreeNode |
o C SLNet::IncrementalReadInterface |
| \ C SLNet::AutopatcherRepositoryInterface | An interface used by AutopatcherServer to get the data necessary to run an autopatcher. This is up to you to implement for custom repository solutions
o C VariadicSQLParser::IndexAndType |
o C SLNet::InternalPacketFixedSizeTransmissionHeader |
| \ C SLNet::InternalPacket |
o C SLNet::InternalPacketRefCountedData | Used in InternalPacket when pointing to sharedDataBlock, rather than allocating itself
o C SLNet::TM_World::JoinRequestHelper |
o C SLNet::CloudServer::KeySubscriberID |
o C SLNet::LastSerializationResult |
o C SLNet::LastSerializationResultBS |
o C DataStructures::List< list_type > | Array based implementation of a list
o C DataStructures::List< __TCPSOCKET__ > |
o C DataStructures::List< AddrAndGuid > |
o C DataStructures::List< BanStruct * > |
o C DataStructures::List< bool > |
o C DataStructures::List< BufferedGetResponseFromServer * > |
o C DataStructures::List< Cell * > |
o C DataStructures::List< ChangedVariablesList * > |
o C DataStructures::List< CloudData * > |
o C DataStructures::List< CloudDataList * > |
o C DataStructures::List< CloudKey > |
o C DataStructures::List< CloudQueryRow * > |
o C DataStructures::List< CloudServerQueryFilter * > |
o C DataStructures::List< ColumnDescriptor > |
o C DataStructures::List< CommandParserInterface * > |
o C DataStructures::List< Connection_RM3 * > |
o C DataStructures::List< ConnectionAttempt * > |
o C DataStructures::List< ConnectionRequestSystem > |
o C DataStructures::List< ConnnectRequest * > |
o C DataStructures::List< data_type > |
o C DataStructures::List< FileListNode > |
o C DataStructures::List< FileListProgress * > |
o C DataStructures::List< FileToPushRecipient * > |
o C DataStructures::List< FilterSet * > |
o C DataStructures::List< ForwardedConnection > |
o C DataStructures::List< ForwardEntry * > |
o C DataStructures::List< ForwardingRequest * > |
o C DataStructures::List< GetRequest * > |
o C DataStructures::List< HeapNode > |
o C DataStructures::List< InternalPacket * > |
o C DataStructures::List< KeySubscriberID * > |
o C DataStructures::List< LastSerializationResult * > |
o C DataStructures::List< LocalCallback * > |
o C DataStructures::List< LocalSlotObject > |
o C DataStructures::List< MapNode > |
o C DataStructures::List< MiniPunchRequest > |
o C DataStructures::List< MyTeamMembers > |
o C DataStructures::List< NATDetectionAttempt > |
o C DataStructures::List< node_type > |
o C DataStructures::List< PingServerGroup * > |
o C DataStructures::List< PluginInterface2 * > |
o C DataStructures::List< Rackspace2EventCallback * > |
o C DataStructures::List< RackspaceOperation > |
o C DataStructures::List< RakNetGUID > |
o C DataStructures::List< RakNetSocket2 * > |
o C DataStructures::List< RangeNode< DatagramSequenceNumberType > > |
o C DataStructures::List< RangeNode< range_type > > |
o C DataStructures::List< ReadyEventNode * > |
o C DataStructures::List< RegisteredCommand > |
o C DataStructures::List< RemoteServer * > |
o C DataStructures::List< RemoteSystem * > |
o C DataStructures::List< RemoteSystem > |
o C DataStructures::List< RemoteSystemVariableHistory * > |
o C DataStructures::List< Replica3 * > |
o C DataStructures::List< Request * > |
o C DataStructures::List< RequestedTeam > |
o C DataStructures::List< RM3World * > |
o C DataStructures::List< RP_Group * > |
o C DataStructures::List< ServerWithPing > |
o C DataStructures::List< SharedString * > |
o C DataStructures::List< SLNet::RakString > |
o C DataStructures::List< SplitPacketChannel * > |
o C DataStructures::List< StrAndBool > |
o C DataStructures::List< StrAndGuid > |
o C DataStructures::List< SystemAddress > |
o C DataStructures::List< SystemAddressAndChannel > |
o C DataStructures::List< SystemAddressAndGuid > |
o C DataStructures::List< TeamMember > |
o C DataStructures::List< TelnetClient * > |
o C DataStructures::List< TM_Team * > |
o C DataStructures::List< TM_TeamMember * > |
o C DataStructures::List< TM_World * > |
o C DataStructures::List< TrackedObject * > |
o C DataStructures::List< Tree * > |
o C DataStructures::List< TwoWayAuthentication::NonceAndRemoteSystemRequest * > |
o C DataStructures::List< uint32_t > |
o C DataStructures::List< UnreliableWithAckReceiptNode > |
o C DataStructures::List< unsigned int > |
o C DataStructures::List< unsigned short > |
o C DataStructures::List< User * > |
o C DataStructures::List< VariableLastValueNode > |
o C DataStructures::List< void * > |
o C SLNet::RPC4::LocalCallback |
o C SLNet::RPC4::LocalSlot |
o C SLNet::RPC4::LocalSlotObject |
o C SLNet::LocklessUint32_t |
o C DataStructures::Map< key_type, data_type, key_comparison_func > |
o C DataStructures::Map< channel_key_type, QueueAndWeight *, channel_key_comparison_func > |
o C DataStructures::Map< int, HuffmanEncodingTree * > |
o C DataStructures::Map< node_type, DataStructures::Map< node_type, weight_type > * > |
o C DataStructures::Map< SystemAddress, DataStructures::ByteQueue * > |
o C DataStructures::Map< unsigned short, FileListReceiver * > |
o C DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode |
o C DataStructures::MemoryPool< MemoryBlockType > |
o C DataStructures::MemoryPool< BufferedCommandStruct > |
o C DataStructures::MemoryPool< ChangedVariablesList > |
o C DataStructures::MemoryPool< InternalPacket > |
o C DataStructures::MemoryPool< InternalPacketRefCountedData > |
o C DataStructures::MemoryPool< MessageNumberNode > |
o C DataStructures::MemoryPool< Packet > |
o C DataStructures::MemoryPool< Page< KeyType, DataType, order > > |
o C DataStructures::MemoryPool< Page< unsigned, Row *, order > > |
o C DataStructures::MemoryPool< RemoteClient * > |
o C DataStructures::MemoryPool< RemoteSystemIndex > |
o C DataStructures::MemoryPool< SocketQueryOutput > |
o C DataStructures::MemoryPool< StartForwardingInputStruct > |
o C DataStructures::MemoryPool< StopForwardingStruct > |
o C DataStructures::MemoryPool< structureType > |
o C DataStructures::MemoryPool< SystemAddress > |
o C DataStructures::MemoryPool< unsigned char[128]> |
o C DataStructures::MemoryPool< unsigned char[2048]> |
o C DataStructures::MemoryPool< unsigned char[512]> |
o C DataStructures::MemoryPool< unsigned char[8192]> |
o C DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage |
o C SLNet::Router2::MiniPunchRequest |
o C DataStructures::MLKeyRef< templateType > |
o C DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | The multilist, representing an abstract data type that generally holds lists
o C SLNet::TeamBalancer::MyTeamMembers |
o C SLNet::NatTypeDetectionServer::NATDetectionAttempt |
o C SLNet::NatPunchthroughDebugInterface |
| o C SLNet::NatPunchthroughDebugInterface_PacketLogger |
| \ C SLNet::NatPunchthroughDebugInterface_Printf |
o C SLNet::NatPunchthroughServerDebugInterface |
| o C SLNet::NatPunchthroughServerDebugInterface_PacketLogger |
| \ C SLNet::NatPunchthroughServerDebugInterface_Printf |
o C SLNet::NetworkIDManager |
o C SLNet::NetworkIDObject | Unique shared ids for each object instance
| \ C SLNet::Replica3 | Base class for your replicated objects for the ReplicaManager3 system
| \ C SLNet::Replica3Composite< parent_type > | Use Replica3 through composition instead of inheritance by containing an instance of this templated class Calls to parent class for all functions Parent class must still define and functions though!
o C DataStructures::BinarySearchTree< BinarySearchTreeType >::node |
o C DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node |
o C DataStructures::CircularLinkedList< CircularLinkedListType >::node |
o C DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent |
o C SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest |
o C SLNet::TwoWayAuthentication::NonceGenerator |
o C SLNet::FileListTransferCBInterface::OnFileStruct |
o C DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
o C DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
o C DataStructures::OrderedList< channel_key_type, MapNode,&Map::NodeComparisonFunc > |
o C DataStructures::OrderedList< char *, StrAndBool, StrAndBoolComp > |
o C DataStructures::OrderedList< CloudKey, CloudDataList *, CloudServer::KeyDataListComp > |
o C DataStructures::OrderedList< CloudKey, CloudKey, CloudKeyComp > |
o C DataStructures::OrderedList< CloudKey, KeySubscriberID *, CloudServer::KeySubscriberIDComp > |
o C DataStructures::OrderedList< const char *, RegisteredCommand, RegisteredCommandComp > |
o C DataStructures::OrderedList< DatagramSequenceNumberType, RangeNode< DatagramSequenceNumberType >, RangeNodeComp< DatagramSequenceNumberType > > |
o C DataStructures::OrderedList< int, FilterSet *, FilterSetComp > |
o C DataStructures::OrderedList< int, MapNode,&Map::NodeComparisonFunc > |
o C DataStructures::OrderedList< int, ReadyEventNode *, ReadyEvent::ReadyEventNodeComp > |
o C DataStructures::OrderedList< key_type, MapNode,&Map::NodeComparisonFunc > |
o C DataStructures::OrderedList< LocalSlotObject, LocalSlotObject, LocalSlotObjectComp > |
o C DataStructures::OrderedList< MessageID, LocalCallback *, RPC4::LocalCallbackComp > |
o C DataStructures::OrderedList< node_type, MapNode,&Map::NodeComparisonFunc > |
o C DataStructures::OrderedList< node_type, node_type > |
o C DataStructures::OrderedList< RakNetGUID, BufferedGetResponseFromServer *, CloudServer::BufferedGetResponseFromServerComp > |
o C DataStructures::OrderedList< RakNetGUID, CloudData *, CloudServer::KeyDataPtrComp > |
o C DataStructures::OrderedList< RakNetGUID, RakNetGUID > |
o C DataStructures::OrderedList< RakNetGUID, RemoteServer *, CloudServer::RemoteServerComp > |
o C DataStructures::OrderedList< RakNetGUID, RemoteSystem *, ConnectionGraph2::RemoteSystemComp > |
o C DataStructures::OrderedList< RakNetGUID, RemoteSystem, ReadyEvent::RemoteSystemCompByGuid > |
o C DataStructures::OrderedList< RakNetGUID, User *, NatPunchthroughServer::NatPunchthroughUserComp > |
o C DataStructures::OrderedList< range_type, RangeNode< range_type >, RangeNodeComp< range_type > > |
o C DataStructures::OrderedList< Replica3 *, LastSerializationResult *, Connection_RM3::Replica3LSRComp > |
o C DataStructures::OrderedList< SenderAndTargetAddress, ForwardingRequest *, ForwardingRequestComp > |
o C DataStructures::OrderedList< SLNet::RakString, SLNet::RakString > |
o C DataStructures::OrderedList< SplitPacketIdType, SplitPacketChannel *, SplitPacketChannelComp > |
o C DataStructures::OrderedList< SystemAddress, MapNode,&Map::NodeComparisonFunc > |
o C DataStructures::OrderedList< SystemAddress, SystemAddress > |
o C DataStructures::OrderedList< SystemAddressAndGuid, SystemAddressAndGuid, ConnectionGraph2::SystemAddressAndGuidComp > |
o C DataStructures::OrderedList< uint32_t, ChangedVariablesList *, VariableDeltaSerializer::UpdatedVariablesListPtrComp > |
o C DataStructures::OrderedList< uint32_t, GetRequest *, CloudServer::GetRequestComp > |
o C DataStructures::OrderedList< uint64_t, TrackedObject *, TrackedObjectComp > |
o C DataStructures::OrderedList< unsigned short, MapNode,&Map::NodeComparisonFunc > |
o C SLNet::HTTPConnection::OutgoingCommand |
o C SLNet::Packet | This represents a user message from another system
o C DataStructures::Page< KeyType, DataType, order > |
o C DataStructures::MemoryPool< MemoryBlockType >::Page |
o C DataStructures::Page< unsigned, Row *, order > |
o C SLNet::TwoWayAuthentication::PendingChallenge |
o C SLNet::RakPeer::PingAndClockDifferential |
o C SLNet::UDPProxyClient::PingServerGroup |
o C SLNet::PluginInterface2 |
| o C SLNet::CloudClient | Performs Post() and Get() operations on CloudMemoryServer
| o C SLNet::CloudServer | Stores client data, and allows cross-server communication to retrieve this data
| o C SLNet::ConnectionGraph2 | A one hop connection graph
| o C SLNet::DirectoryDeltaTransfer |
| o C SLNet::FileListTransfer | A plugin to provide a simple way to compress and incrementally send the files in the FileList structure
| o C SLNet::HTTPConnection2 | Use HTTPConnection2 to communicate with a web server
| o C SLNet::MessageFilter | Assigns systems to FilterSets. Each FilterSet limits what kinds of messages are allowed
| o C SLNet::NatPunchthroughClient | Client code for NATPunchthrough
| o C SLNet::NatPunchthroughServer | Server code for NATPunchthrough
| o C SLNet::NatTypeDetectionClient | Client code for NatTypeDetection
| o C SLNet::NatTypeDetectionServer | Server code for NatTypeDetection
| o C SLNet::PacketLogger | Writes incoming and outgoing messages to the screen. This will write all incoming and outgoing messages to the console window, or to a file if you override it and give it this functionality
| | o C SLNet::PacketConsoleLogger | Packetlogger that logs to a remote command console
| | o C SLNet::PacketFileLogger | Packetlogger that outputs to a file
| | o C SLNet::PacketOutputWindowLogger | Packetlogger that outputs to the output window in the debugger. Windows only
| | \ C SLNet::ThreadsafePacketLogger | Same as PacketLogger, but writes output in the user thread
| o C SLNet::RakNetTransport2 | Use RakNetTransport if you need a secure connection between the client and the console server
| o C SLNet::ReadyEvent | Peer to peer synchronized ready and unready events
| o C SLNet::RelayPlugin | A simple class to relay messages from one system to another, identifying remote systems by a string
| o C SLNet::ReplicaManager3 | System to help automate game object construction, destruction, and serialization
| o C SLNet::Router2 | Class interface for the Router2 system
| o C SLNet::RPC4 | The RPC4 plugin is just an association between a C function pointer and a string
| o C SLNet::StatisticsHistoryPlugin | Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values
| o C SLNet::TeamBalancer | Set and network team selection (supports peer to peer or client/server)
| o C SLNet::TeamManager | Automates networking and list management for teams
| o C SLNet::TwoWayAuthentication | Implements two way authentication
| o C SLNet::UDPProxyClient | Communicates with UDPProxyCoordinator, in order to find a UDPProxyServer to forward our datagrams
| o C SLNet::UDPProxyCoordinator | Middleman between UDPProxyServer and UDPProxyClient, maintaining a list of UDPProxyServer, and managing state for clients to find an available forwarding server
| \ C SLNet::UDPProxyServer | UDPProxyServer to control our instance of UDPForwarder
o C SLNet::PRO |
o C SLNet::PublicKey | Passed to RakPeerInterface::Connect()
o C SLNet::PunchthroughConfiguration |
o C DataStructures::Queue< queue_type > | A queue implemented as an array with a read and write index
o C DataStructures::Queue< BadResponse > |
o C DataStructures::Queue< bool > |
o C DataStructures::Queue< BufferedCommandStruct * > |
o C DataStructures::Queue< DatagramHistoryNode > |
o C DataStructures::Queue< double > |
o C DataStructures::Queue< DSTAndFac > |
o C DataStructures::Queue< FileToPush * > |
o C DataStructures::Queue< InputType > |
o C DataStructures::Queue< int > |
o C DataStructures::Queue< int(*)(ThreadData, bool *, void *)> |
o C DataStructures::Queue< InternalPacket * > |
o C DataStructures::Queue< OutgoingCommand > |
o C DataStructures::Queue< OutputType > |
o C DataStructures::Queue< OutputType(*)(InputType, bool *, void *)> |
o C DataStructures::Queue< Packet * > |
o C DataStructures::Queue< PendingChallenge > |
o C DataStructures::Queue< RemoteClient ** > |
o C DataStructures::Queue< Request * > |
o C DataStructures::Queue< RequestedConnectionStruct * > |
o C DataStructures::Queue< RNS2RecvStruct * > |
o C DataStructures::Queue< SLNet::RakString > |
o C DataStructures::Queue< SocketQueryOutput * > |
o C DataStructures::Queue< StartForwardingInputStruct * > |
o C DataStructures::Queue< StartForwardingOutputStruct > |
o C DataStructures::Queue< StopForwardingStruct * > |
o C DataStructures::Queue< structureType * > |
o C DataStructures::Queue< SystemAddress * > |
o C DataStructures::Queue< SystemAddress > |
o C DataStructures::Queue< ThreadData > |
o C DataStructures::Queue< TimeAndValue > |
o C DataStructures::Queue< TimeAndValue2 > |
o C DataStructures::Queue< unsigned int > |
o C DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight |
o C DataStructures::QueueLinkedList< QueueType > | A queue implemented using a linked list. Rarely used
o C SLNet::Rackspace | Code that uses the TCPInterface class to communicate with the Rackspace API servers
o C SLNet::Rackspace2EventCallback | Callback interface to receive the results of operations
| \ C SLNet::RackspaceEventCallback_Default | Callback interface to receive the results of operations, with a default result
o C SLNet::Rackspace::RackspaceOperation |
o C SLNet::RakNetGUID |
o C SLNet::RakNetRandom |
o C SLNet::RakNetRandomSync |
o C SLNet::RakNetSmartPtr< T > |
o C SLNet::RakNetSocket2 |
| \ C SLNet::IRNS2_Berkley |
| \ C SLNet::RNS2_Berkley |
| \ C SLNet::RNS2_Linux |
o C SLNet::RakNetSocket2Allocator |
o C SLNet::RakNetStatistics | Network Statisics Usage
o C SLNet::RakPeerInterface | The main interface for network communications
| \ C SLNet::RakPeer | Main interface for network communications
o C SLNet::RakString | String class
o C SLNet::RakThread |
o C SLNet::RakWString | String class for Unicode
o C DataStructures::RangeList< range_type > |
o C DataStructures::RangeList< DatagramSequenceNumberType > |
o C DataStructures::RangeNode< range_type > |
o C DataStructures::RangeNode< DatagramSequenceNumberType > |
o C SLNet::ReadyEvent::ReadyEventNode |
o C RefCountedObj | World's simplest class :)
o C SLNet::ReferenceCounter |
o C SLNet::RegisteredCommand |
o C SLNet::ReliabilityLayer | Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence
o C SLNet::RemoteClient | Stores information about a remote client
o C SLNet::CloudServer::RemoteCloudClient |
o C SLNet::CloudServer::RemoteServer |
o C SLNet::ReadyEvent::RemoteSystem |
o C SLNet::ConnectionGraph2::RemoteSystem |
o C SLNet::RemoteSystemIndex |
o C SLNet::RakPeer::RemoteSystemStruct |
o C SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory |
o C SLNet::HTTPConnection2::Request |
o C SLNet::RakPeer::RequestedConnectionStruct |
o C SLNet::TM_TeamMember::RequestedTeam |
o C DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction |
o C SLNet::ReplicaManager3::RM3World |
o C SLNet::RNS2_BerkleyBindParameters |
o C SLNet::RNS2_SendParameters |
o C RNS2_Windows_Linux_360 |
| \ C SLNet::RNS2_Linux |
o C SLNet::RNS2EventHandler |
| o C SLNet::NatTypeDetectionClient | Client code for NatTypeDetection
| o C SLNet::NatTypeDetectionServer | Server code for NatTypeDetection
| \ C SLNet::RakPeer | Main interface for network communications
o C SLNet::RNS2RecvStruct |
o C SLNet::Router2DebugInterface |
o C DataStructures::Table::Row | Stores the list of cells for this row, and a special flag used for internal sorting
o C SLNet::RelayPlugin::RP_Group |
o C SLNet::RPC4GlobalRegistration | Instantiate this class globally if you want to register a function with RPC4 at the global space
o C SLNet::UDPProxyClient::SenderAndTargetAddress |
o C SLNet::UDPProxyCoordinator::SenderAndTargetAddress |
o C SLNet::NatPunchthroughClient::SendPing |
o C SLNet::VariableDeltaSerializer::SerializationContext |
o C SLNet::SerializeParameters |
o C SLNet::UDPProxyCoordinator::ServerWithPing |
o C SLNet::UDPProxyClient::ServerWithPing |
o C SHA1_WORKSPACE_BLOCK |
o C SLNet::RakString::SharedString |
o C SLNet::SignaledEvent |
o C SLNet::SimpleMutex | An easy to use mutex
o C DataStructures::SingleProducerConsumer< SingleProducerConsumerType > | A single producer consumer implementation without critical sections
o C DataStructures::SingleProducerConsumer< char * > |
o C SLNet::SocketDescriptor | Describes the local socket to use for RakPeer::Startup
o C SLNet::SocketLayer |
o C SLNet::RakPeer::SocketQueryOutput |
o C DataStructures::Table::SortQuery |
o C SLNet::SplitPacketChannel |
o C SLNet::UDPForwarder::StartForwardingInputStruct |
o C SLNet::UDPForwarder::StartForwardingOutputStruct |
o C SLNet::StatisticsHistory | Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values
o C SLNet::UDPForwarder::StopForwardingStruct |
o C StrAndBool | The string plus a bool telling us if this string was copied or not
o C SLNet::RelayPlugin::StrAndGuid |
o C SLNet::RelayPlugin::StrAndGuidAndRoom |
o C SLNet::StringCompressor | Writes and reads strings to and from bitstreams
o C SLNet::StringTable | Writes a string index, instead of the whole string
o C SLNet::SystemAddress | Network address for a system
o C SLNet::LogCommandParser::SystemAddressAndChannel | One of these structures is created per player
o C SLNet::ConnectionGraph2::SystemAddressAndGuid |
o C DataStructures::Table | Holds a set of columns, a set of rows, and rows times columns cells
o C SLNet::TableSerializer |
o C SLNet::TCPInterface |
| \ C SLNet::PacketizedTCP |
o C SLNet::TeamBalancer::TeamMember |
o C SLNet::TeamSelection | Parameter to TM_World::ReferenceTeamMember()
o C SLNet::TeamSelection.teamParameter |
o C SLNet::TelnetTransport::TelnetClient |
o C SLNet::TCPInterface::ThisPtrPlusSysAddr |
o C SLNet::FileListTransfer::ThreadData |
o C ThreadDataInterface |
o C ThreadPool< InputType, OutputType > |
o C ThreadPool< ThreadData, int > |
o C DataStructures::ThreadsafeAllocatingQueue< structureType > |
o C DataStructures::ThreadsafeAllocatingQueue< BufferedCommandStruct > |
o C DataStructures::ThreadsafeAllocatingQueue< Packet > |
o C DataStructures::ThreadsafeAllocatingQueue< RemoteClient * > |
o C DataStructures::ThreadsafeAllocatingQueue< SocketQueryOutput > |
o C DataStructures::ThreadsafeAllocatingQueue< StartForwardingInputStruct > |
o C DataStructures::ThreadsafeAllocatingQueue< StopForwardingStruct > |
o C DataStructures::ThreadsafeAllocatingQueue< SystemAddress > |
o C SLNet::StatisticsHistory::TimeAndValue |
o C SLNet::BPSTracker::TimeAndValue2 |
o C SLNet::StatisticsHistory::TimeAndValueQueue |
o C SLNet::TM_Team | A team, containing a list of TM_TeamMember instances
o C SLNet::TM_TeamMember | A member of one or more teams
o C SLNet::TM_World | Stores a list of teams which may be enforcing a balanced number of members
o C SLNet::StatisticsHistory::TrackedObject |
o C SLNet::StatisticsHistory::TrackedObjectData |
o C SLNet::TransportInterface | Defines an interface that is used to send and receive null-terminated strings
| o C SLNet::RakNetTransport2 | Use RakNetTransport if you need a secure connection between the client and the console server
| \ C SLNet::TelnetTransport | Use TelnetTransport to easily allow windows telnet to connect to your ConsoleServer
o C DataStructures::Tree< TreeType > |
o C DataStructures::Tree< node_type > |
o C SLNet::UDPForwarder | Forwards UDP datagrams. Independent of RakNet's protocol
o C SLNet::UDPProxyClientResultHandler |
o C SLNet::UDPProxyServerResultHandler |
o C SLNet::uint24_t |
o C SLNet::NatPunchthroughServer::User |
o C SLNet::VariableDeltaSerializer | Class to compare memory values of variables in a current state to a prior state Results of the comparisons will be written to a bitStream, such that only changed variables get written Can be used with ReplicaManager3 to Serialize a Replica3 per-variable, rather than comparing the entire object against itself Usage: BR>
o C SLNet::VariableListDeltaTracker::VariableLastValueNode |
o C SLNet::VariableListDeltaTracker |
o C DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
\ C WSAStartupSingleton |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- _ -

  • _completedConnectionAttempts : SLNet::PacketizedTCP
  • _failedConnectionAttempts : SLNet::PacketizedTCP
  • _isContinuousSend : SLNet::CCRakNetSlidingWindow
  • _lostConnections : SLNet::PacketizedTCP
  • _newIncomingConnections : SLNet::PacketizedTCP
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- a -

  • acceptAddParticipantRequests : SLNet::RelayPlugin
  • AckTimeout() : SLNet::ReliabilityLayer
  • action : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • actionToTake : SLNet::RakPeer::RequestedConnectionStruct
  • activeSystemList : SLNet::RakPeer
  • activeSystemListSize : SLNet::RakPeer
  • Add()
: CheckSum
, DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, CheckSum
  • AddBitsAndReallocate() : SLNet::BitStream
  • AddCallback()
: SLNet::FileListTransfer
, SLNet::FileList
  • AddChannel()
: DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, SLNet::LogCommandParser
  • AddChild() : DataStructures::Tree< TreeType >
  • AddColumn() : DataStructures::Table
  • AddCommandParser() : SLNet::ConsoleServer
  • AddConnection() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • AddEntry() : GridSectorizer
  • AddEventCallback() : SLNet::Rackspace
  • AddFile() : SLNet::FileList
  • AddFilesFromDirectory() : SLNet::FileList
  • AddInput() : ThreadPool< InputType, OutputType >
  • addNewConnections : SLNet::StatisticsHistoryPlugin
  • AddNode() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • AddObject() : SLNet::StatisticsHistory
  • AddOperation() : SLNet::Rackspace
  • AddOutput() : ThreadPool< InputType, OutputType >
  • AddPacketToProducer() : SLNet::RakPeer
  • AddParticipant()
: SLNet::ConnectionGraph2
, SLNet::TM_World
  • AddParticipantOnServer() : SLNet::RelayPlugin
  • AddParticipantRequestFromClient() : SLNet::RelayPlugin
  • AddPassword() : SLNet::TwoWayAuthentication
  • AddQueryFilter() : SLNet::CloudServer
  • addr : SLNet::NatPunchthroughClient::AddrAndGuid
  • addr1Confirmed : SLNet::UDPForwarder::ForwardEntry
  • addr1Unconfirmed : SLNet::UDPForwarder::ForwardEntry
  • addr2Confirmed : SLNet::UDPForwarder::ForwardEntry
  • addr2Unconfirmed : SLNet::UDPForwarder::ForwardEntry
  • AddRef() : SLNet::FileListTransfer::FileToPushRecipient , RefCountedObj , SLNet::ReferenceCounter , WSAStartupSingleton
  • AddReference()
: SLNet::StringCompressor
, SLNet::StringTable
  • AddRemoteSystemVariableHistory() : SLNet::VariableDeltaSerializer
  • address : SLNet::SystemAddress
  • addressFamily : SLNet::RNS2_BerkleyBindParameters
  • AddressOrGUID() : SLNet::AddressOrGUID
  • AddRow() : DataStructures::Table
  • AddRowColumns() : DataStructures::Table
  • AddServer() : SLNet::CloudServer
  • AddString() : SLNet::StringTable
  • AddTeamMember() : SLNet::TeamBalancer
  • AddToActiveSystemList() : SLNet::RakPeer
  • AddToBanList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • AddToConnectionList() : SLNet::PacketizedTCP
  • AddToFrequencyTable() : SLNet::HuffmanEncodingTreeFactory
  • AddToLog()
: SLNet::PacketLogger
, SLNet::ThreadsafePacketLogger
  • AddToRequestedTeams() : SLNet::TM_TeamMember
  • AddToSecurityExceptionList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • AddToTeamList() : SLNet::TM_TeamMember
  • AddToWaitList() : SLNet::ReadyEvent
  • AddToWaitListInternal() : SLNet::ReadyEvent
  • AddUploadsFromSubdirectory() : SLNet::DirectoryDeltaTransfer
  • AddValueByIndex() : SLNet::StatisticsHistory
  • AddValueByObjectID() : SLNet::StatisticsHistory
  • AddWorld()
: SLNet::ReplicaManager3
, SLNet::TeamManager
  • adjacencyLists : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • AdvertiseSystem()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • AlignReadToByteBoundary() : SLNet::BitStream
  • AlignWriteToByteBoundary() : SLNet::BitStream
  • Allocate()
: DataStructures::BytePool
, DataStructures::MemoryPool< MemoryBlockType >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, SLNet::RakString
  • AllocateCloudQueryRow() : SLNet::CloudAllocator
  • allocatedData : SLNet::CloudServer::CloudData
  • AllocateFirst() : DataStructures::MemoryPool< MemoryBlockType >
  • allocateIrIDataChunkAutomatically : SLNet::FileListTransferCBInterface::FileProgressStruct
  • AllocatePacket()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::TCPInterface
  • AllocatePacketUnified() : SLNet::PluginInterface2
  • AllocateRowData() : SLNet::CloudAllocator
  • AllocationScheme : SLNet::InternalPacket
  • allocationScheme : SLNet::InternalPacket
  • AllocationSize() : DataStructures::Queue< queue_type >
  • allocationSize : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • allocator : SLNet::CloudClient
  • AllocBS() : SLNet::LastSerializationResult
  • AllocChangedVariablesList() : SLNet::VariableDeltaSerializer
  • AllocConnection() : SLNet::ReplicaManager3
  • AllocPacket() : SLNet::RakPeer
  • AllocReplica() : SLNet::Connection_RM3
  • AllocRNS2() : SLNet::RakNetSocket2Allocator
  • AllocRNS2RecvStruct()
: SLNet::RNS2EventHandler
, SLNet::NatTypeDetectionClient
, SLNet::RakPeer
, SLNet::NatTypeDetectionServer
  • AllowConnectionResponseIPMigration()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • allowConnectionResponseIPMigration : SLNet::RakPeer
  • allowedIDs : SLNet::FilterSet
  • allowedRPC4 : SLNet::FilterSet
  • AllowIncomingConnections() : SLNet::RakPeer
  • allowInternalRouting : SLNet::RakPeer
  • AllRemoteServersHaveResponded() : SLNet::CloudServer::GetRequest
  • AnyAvailable() : SLNet::TeamSelection
  • anyVariablesWritten : SLNet::VariableDeltaSerializer::SerializationContext
  • apiAccessKey : SLNet::Rackspace
  • AppendBytes() : SLNet::RakString
  • applicationDirectory : SLNet::DirectoryDeltaTransfer
  • ApplyNetworkSimulator()
: SLNet::RakPeerInterface
, SLNet::ReliabilityLayer
, SLNet::RakPeer
  • AreAcksWaiting() : SLNet::ReliabilityLayer
  • AreAllServersPinged() : SLNet::UDPProxyClient::PingServerGroup
  • ascendingSort : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • AssertCopyData() : SLNet::BitStream
  • AssertStreamEmpty() : SLNet::BitStream
  • Assign() : SLNet::RakString
  • AssignSystemAddressToRemoteSystemList() : SLNet::RakPeer
  • AttachPlugin()
: SLNet::TCPInterface
, SLNet::RakPeer
, SLNet::RakPeerInterface
  • attemptCount : SLNet::NatPunchthroughClient::SendPing
  • attemptPhase : SLNet::NatPunchthroughServer::ConnectionAttempt
  • Authenticate() : SLNet::Rackspace
  • authToken : SLNet::Rackspace
  • autoAddNewConnectionsToFilter : SLNet::MessageFilter
  • autoAddParticipants : SLNet::TeamManager , SLNet::TM_World
  • AutoAllocate() : SLNet::TelnetTransport
  • AutoConstructByQuery() : SLNet::Connection_RM3
  • AutoCreateConnectionList() : SLNet::ReplicaManager3
  • autoCreateConnections : SLNet::ReplicaManager3
  • autoDestroyConnections : SLNet::ReplicaManager3
  • autoProcessNewConnections : SLNet::ConnectionGraph2
  • autoSerializeInterval : SLNet::ReplicaManager3
  • availablePages : DataStructures::MemoryPool< MemoryBlockType >
  • availablePagesSize : DataStructures::MemoryPool< MemoryBlockType >
  • availableStack : DataStructures::MemoryPool< MemoryBlockType >::Page
  • availableStackSize : DataStructures::MemoryPool< MemoryBlockType >::Page
  • availableUploads : SLNet::DirectoryDeltaTransfer
  • AVLBalancedBinarySearchTree() : DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- b -

  • b : StrAndBool
  • backoffThisBlock : SLNet::CCRakNetSlidingWindow
  • BadResponse() : SLNet::HTTPConnection::BadResponse
  • balanceTeamsIsActive : SLNet::TM_World
  • balancingApplies : SLNet::TM_Team
  • banList : SLNet::RakPeer
  • banListMutex : SLNet::RakPeer
  • banOnDisallowedMessage : SLNet::FilterSet
  • banOnFilterTimeExceed : SLNet::FilterSet
  • BaseIDTOString() : SLNet::PacketLogger
  • BCS_CHANGE_SYSTEM_ADDRESS : SLNet::RakPeer::BufferedCommandStruct
  • BCS_CLOSE_CONNECTION : SLNet::RakPeer::BufferedCommandStruct
  • BCS_DO_NOTHING : SLNet::RakPeer::BufferedCommandStruct
  • BCS_GET_SOCKET : SLNet::RakPeer::BufferedCommandStruct
  • BCS_SEND : SLNet::RakPeer::BufferedCommandStruct
  • BeginDeserialize() : SLNet::VariableDeltaSerializer
  • BeginIdenticalSerialize() : SLNet::VariableDeltaSerializer
  • Beginning() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • BeginUniqueSerialize() : SLNet::VariableDeltaSerializer
  • BeginUnreliableAckedSerialize() : SLNet::VariableDeltaSerializer
  • bigString : SLNet::RakString::SharedString
  • BINARY : DataStructures::Table
  • BinarySearchTree() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • BinarySearchTree_size : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • Bind()
: SLNet::IRNS2_Berkley
, SLNet::RNS2_Linux
  • bindAddress : SLNet::TCPInterface::ThisPtrPlusSysAddr
  • binding : SLNet::RNS2_Berkley
  • BindShared() : SLNet::RNS2_Berkley
  • BindSharedIPV4() : SLNet::RNS2_Berkley
  • BindSharedIPV4And6() : SLNet::RNS2_Berkley
  • bitField : SLNet::VariableDeltaSerializer::ChangedVariablesList
  • bitSize : SLNet::Packet
  • BitStream() : SLNet::BitStream
  • bitStream
: SLNet::LastSerializationResultBS
, SLNet::VariableDeltaSerializer::SerializationContext
, SLNet::VariableDeltaSerializer::DeserializationContext
  • bitstreamWrittenTo : SLNet::DeserializeParameters
  • bitsWrittenSoFar : SLNet::SerializeParameters
  • bitWriteIndex : SLNet::VariableDeltaSerializer::ChangedVariablesList
  • block : DataStructures::MemoryPool< MemoryBlockType >::Page
  • blockingCommand : SLNet::RakPeer::BufferedCommandStruct
  • blockingReturnValue : SLNet::RPC4
  • blockingSocket : SLNet::SocketDescriptor
  • blockingSocketList : SLNet::TCPInterface
  • blockingSocketListMutex : SLNet::TCPInterface
  • BlockOnStopRecvPollingThread() : SLNet::RNS2_Berkley
  • BlocksPerPage() : DataStructures::MemoryPool< MemoryBlockType >
  • boundAddress : SLNet::RakNetSocket2
  • boundAddressCount : SLNet::NatPunchthroughServer
  • boundAddresses : SLNet::NatPunchthroughServer
  • BPlusTree() : DataStructures::BPlusTree< KeyType, DataType, order >
  • BPSLimitByCongestionControl : SLNet::RakNetStatistics
  • BPSLimitByOutgoingBandwidthLimit : SLNet::RakNetStatistics
  • BPSTracker() : SLNet::BPSTracker
  • broadcast : SLNet::RakPeer::BufferedCommandStruct
  • BroadcastDestruction()
: SLNet::Replica3
, SLNet::ReplicaManager3
  • BroadcastDestructionList() : SLNet::ReplicaManager3
  • BroadcastReadyUpdate() : SLNet::ReadyEvent
  • BroadcastToParticipants() : SLNet::TM_World
  • bufferedCommands : SLNet::RakPeer
  • BufferedGetResponseFromServerComp() : SLNet::CloudServer
  • bufferedPackets : SLNet::NatTypeDetectionServer , SLNet::NatTypeDetectionClient
  • bufferedPacketsFreePool : SLNet::RakPeer
  • bufferedPacketsFreePoolMutex : SLNet::RakPeer
  • bufferedPacketsMutex : SLNet::NatTypeDetectionClient , SLNet::NatTypeDetectionServer
  • bufferedPacketsQueue : SLNet::RakPeer
  • bufferedPacketsQueueMutex : SLNet::RakPeer
  • byteLength : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • byteLengthOfThisFile : SLNet::FileListTransferCBInterface::OnFileStruct
  • byteLengthOfThisSet : SLNet::FileListTransferCBInterface::DownloadCompleteStruct , SLNet::FileListTransferCBInterface::OnFileStruct
  • BytePool() : DataStructures::BytePool
  • ByteQueue() : DataStructures::ByteQueue
  • bytesDownloadedForThisFile : SLNet::FileListTransferCBInterface::OnFileStruct
  • bytesDownloadedForThisSet : SLNet::FileListTransferCBInterface::OnFileStruct
  • bytesInResendBuffer : SLNet::RakNetStatistics
  • bytesInSendBuffer : SLNet::RakNetStatistics
  • bytesRead : SLNet::RNS2RecvStruct
  • bytesReadForThisChunk : SLNet::HTTPConnection2::Request
  • bytesReceivedPerSecond : SLNet::RakPeer
  • bytesSentPerSecond : SLNet::RakPeer
  • bytesUsed : SLNet::RakString::SharedString
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- c -

  • c : SHA1_WORKSPACE_BLOCK , DataStructures::Table::Cell
  • c1 : CheckSum
  • c2 : CheckSum , SLNet::NatTypeDetectionClient
  • c2Port : SLNet::NatTypeDetectionServer::NATDetectionAttempt
  • c_str : SLNet::RakWString , SLNet::RakString::SharedString
  • c_strCharLength : SLNet::RakWString
  • C_String()
: SLNet::RakString
, SLNet::RakWString
  • C_StringUnsafe() : SLNet::RakString
  • CALCULATING_PORT_STRIDE : SLNet::NatPunchthroughClient
  • Call() : SLNet::RPC4
  • callback : SLNet::CloudClient
  • CallBlocking() : SLNet::RPC4
  • callCount : SLNet::RakNetRandomSync
  • CallLoopback() : SLNet::RPC4
  • CallPluginCallbacks() : SLNet::RakPeer
  • callPriority : SLNet::RPC4::LocalSlotObject
  • CancelConnectionAttempt()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • CancelReadLock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • CancelReceive() : SLNet::FileListTransfer
  • CancelRequestSpecificTeam() : SLNet::TeamBalancer
  • CancelTeamRequest() : SLNet::TM_TeamMember
  • CancelWriteLock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • CanRotateLeft() : DataStructures::BPlusTree< KeyType, DataType, order >
  • CanRotateRight() : DataStructures::BPlusTree< KeyType, DataType, order >
  • CCRakNetSlidingWindow() : SLNet::CCRakNetSlidingWindow
  • cdnManagementDomain : SLNet::Rackspace
  • cdnManagementPath : SLNet::Rackspace
  • cdnManagementURL : SLNet::Rackspace
  • Cell() : DataStructures::Table::Cell
  • cellHeight : GridSectorizer
  • cellOriginX : GridSectorizer
  • cellOriginY : GridSectorizer
  • cells : DataStructures::Table::Row
  • cellValue : DataStructures::Table::FilterQuery
  • cellWidth : GridSectorizer
  • Challenge() : SLNet::TwoWayAuthentication
  • changedVariables : SLNet::VariableDeltaSerializer::SerializationContext
  • ChangeSystemAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • channel : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData , SLNet::ReadyEvent
  • channelNames : SLNet::LogCommandParser
  • channels : SLNet::LogCommandParser::SystemAddressAndChannel
  • ChannelSize() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • chatRooms : SLNet::RelayPlugin
  • checkIpAddress : SLNet::DynDNS
  • CheckReadUnlockOrder() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • CheckSum() : CheckSum
  • children : DataStructures::Page< KeyType, DataType, order > , DataStructures::Tree< TreeType >
  • chromeInstance : SLNet::SocketDescriptor
  • chunked : SLNet::HTTPConnection2::Request
  • chunkSize : SLNet::DirectoryDeltaTransfer , SLNet::FileListTransfer::FileToPush
  • CircularLinkedList() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • Clear()
: CheckSum
, SLNet::CloudServer
, SLNet::CloudServer::CloudData
, SLNet::CloudServer::BufferedGetResponseFromServer
, SLNet::CloudServer::GetRequest
, DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::BytePool
, DataStructures::ByteQueue
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::List< list_type >
, DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::MemoryPool< MemoryBlockType >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::Queue< queue_type >
, DataStructures::QueueLinkedList< QueueType >
, DataStructures::RangeList< range_type >
, DataStructures::Table::Cell
, DataStructures::Table
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
, SLNet::FileList
, SLNet::FileListTransfer
, GridSectorizer
, SLNet::MessageFilter
, SLNet::NatPunchthroughClient
, SLNet::NetworkIDManager
, SLNet::ReadyEvent
, SLNet::ReplicaManager3
, SLNet::ReplicaManager3::RM3World
, DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
, SLNet::StatisticsHistory
, SLNet::StatisticsHistory::TimeAndValueQueue
, SLNet::RakString
, SLNet::TM_World
, SLNet::TeamManager
, ThreadPool< InputType, OutputType >
, SLNet::TwoWayAuthentication
, SLNet::TwoWayAuthentication::NonceGenerator
, SLNet::UDPProxyClient
, SLNet::UDPProxyCoordinator
, SLNet::RakWString
  • ClearAll() : SLNet::Router2
  • ClearAllConnections() : SLNet::PacketizedTCP
  • ClearAndForceAllocation() : DataStructures::Queue< queue_type >
  • ClearBanList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • ClearBufferedCommands() : SLNet::RakPeer
  • ClearBufferedPackets() : SLNet::RakPeer
  • ClearByAddress() : SLNet::TwoWayAuthentication::NonceGenerator
  • ClearCallbacks()
: SLNet::FileList
, SLNet::FileListTransfer
  • ClearConnectionRequests() : SLNet::Router2
  • ClearDijkstra() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • ClearDownloadGroup() : SLNet::Connection_RM3
  • ClearEventCallbacks() : SLNet::Rackspace
  • ClearExpired1() : SLNet::BPSTracker
  • ClearForwardedConnections() : SLNet::Router2
  • ClearIndex() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • ClearInput() : ThreadPool< InputType, OutputType >
  • ClearMinipunches() : SLNet::Router2
  • ClearOutput() : ThreadPool< InputType, OutputType >
  • ClearPointer() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ClearPointers() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ClearRemoteSystemLookup() : SLNet::RakPeer
  • ClearRequestedConnectionList() : SLNet::RakPeer
  • ClearSocketQueryOutput() : SLNet::RakPeer
  • ClearUploads() : SLNet::DirectoryDeltaTransfer
  • clientGUID : SLNet::CloudQueryRow , SLNet::CloudServer::CloudData
  • clientSystemAddress : SLNet::CloudServer::CloudData , SLNet::CloudQueryRow
  • clockDifferential : SLNet::RakPeer::PingAndClockDifferential
  • Clone()
: SLNet::RakNetSmartPtr< T >
, SLNet::RakString
  • CloseConnection()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::TCPInterface
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::TransportInterface
, SLNet::PacketizedTCP
  • CloseConnectionInternal() : SLNet::RakPeer
  • CloseEvent() : SLNet::SignaledEvent
  • CloudAllocator() : SLNet::CloudAllocator
  • CloudClient() : SLNet::CloudClient
  • CloudClientCallback() : SLNet::CloudClientCallback
  • CloudData() : SLNet::CloudServer::CloudData
  • CloudKey() : SLNet::CloudKey
  • CloudQuery() : SLNet::CloudQuery
  • cloudQuery : SLNet::CloudServer::CloudQueryWithAddresses , SLNet::CloudQueryResult
  • cloudQueryWithAddresses : SLNet::CloudServer::GetRequest
  • CloudServer() : SLNet::CloudServer
  • CloudServerQueryFilter() : SLNet::CloudServerQueryFilter
  • code : SLNet::HTTPConnection::BadResponse
  • ColumnDescriptor() : DataStructures::Table::ColumnDescriptor
  • ColumnIndex() : DataStructures::Table
  • columnIndex : DataStructures::Table::FilterQuery , DataStructures::Table::SortQuery
  • ColumnIndex() : DataStructures::Table
  • columnName : DataStructures::Table::ColumnDescriptor , DataStructures::Table::FilterQuery
  • ColumnName() : DataStructures::Table
  • columns : DataStructures::Table
  • columnType : DataStructures::Table::ColumnDescriptor
  • ColumnType : DataStructures::Table
  • command : SLNet::RegisteredCommand , SLNet::RakPeer::BufferedCommandStruct
  • commandHelp : SLNet::RegisteredCommand
  • commandList : SLNet::CommandParserInterface
  • CommandParserInterface() : SLNet::CommandParserInterface
  • commandParserList : SLNet::ConsoleServer
  • completedConnectionAttemptMutex : SLNet::TCPInterface
  • completedConnectionAttempts : SLNet::TCPInterface
  • completedRequests : SLNet::HTTPConnection2
  • completedRequestsMutex : SLNet::HTTPConnection2
  • Compress()
: DataStructures::Queue< queue_type >
, SLNet::DataCompressor
, DataStructures::List< list_type >
, DataStructures::QueueLinkedList< QueueType >
  • Concatenate() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • condAttr : SLNet::SignaledEvent
  • ConfirmResizedServer() : SLNet::Rackspace
  • Connect()
: SLNet::RakPeer
, SLNet::TCPInterface
  • CONNECT : SLNet::RakPeer::RequestedConnectionStruct
  • Connect() : SLNet::RakPeerInterface
  • CONNECTED : SLNet::RakPeer::RemoteSystemStruct
  • ConnectInternal() : SLNet::Router2
  • Connection_RM3() : SLNet::Connection_RM3
  • connectionAddress : SLNet::Rackspace::RackspaceOperation
  • ConnectionAttempt() : SLNet::NatPunchthroughServer::ConnectionAttempt
  • connectionAttempts : SLNet::NatPunchthroughServer::User
  • ConnectionExists() : SLNet::ConnectionGraph2
  • ConnectionGraph2() : SLNet::ConnectionGraph2
  • connectionList : SLNet::ReplicaManager3::RM3World
  • connectionMode : SLNet::RakPeer::BufferedCommandStruct
  • connectionRequests : SLNet::Router2
  • connectionRequestsMutex : SLNet::Router2
  • connectionRequestSystems : SLNet::Router2::ConnnectRequest
  • connectionRequestSystemsMutex : SLNet::Router2::ConnnectRequest
  • connections : SLNet::PacketizedTCP
  • connectionSocketIndex : SLNet::RakPeer::BufferedCommandStruct
  • connectionStartTime : SLNet::RakNetStatistics
  • connectionTime : SLNet::RakPeer::RemoteSystemStruct
  • ConnectMode : SLNet::RakPeer::RemoteSystemStruct
  • connectMode : SLNet::RakPeer::RemoteSystemStruct
  • ConnectPhase : SLNet::DynDNS
  • connectPhase : SLNet::DynDNS
  • ConnectToServerManagementDomain() : SLNet::Rackspace
  • ConnectWithSocket()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • ConnnectRequest() : SLNet::Router2::ConnnectRequest
  • ConsoleServer() : SLNet::ConsoleServer
  • constructedReplicaList : SLNet::Connection_RM3
  • constructedReplicasCulled : SLNet::Connection_RM3
  • ConstructionMode : SLNet::Connection_RM3
  • ContainsNonprintableExceptSpaces() : SLNet::RakString
  • contentLength : SLNet::HTTPConnection2::Request
  • contentOffset : SLNet::HTTPConnection2::Request
  • contentType : SLNet::HTTPConnection::OutgoingCommand
  • context : SLNet::FileListTransferCBInterface::OnFileStruct , SLNet::FileListNode
  • coordinatorAddressForPings : SLNet::UDPProxyClient::PingServerGroup
  • CopyData() : SLNet::BitStream
  • CopyPort() : SLNet::SystemAddress
  • CopySource() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • costMatrix : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • costMatrixIndices : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • CP_CONNECTING_TO_CHECKIP : SLNet::DynDNS
  • CP_CONNECTING_TO_DYNDNS : SLNet::DynDNS
  • CP_IDLE : SLNet::DynDNS
  • CP_WAITING_FOR_CHECKIP_RESPONSE : SLNet::DynDNS
  • CP_WAITING_FOR_DYNDNS_RESPONSE : SLNet::DynDNS
  • Create() : SLNet::RakThread
  • CreateImage() : SLNet::Rackspace
  • CreateListenSocket() : SLNet::TCPInterface
  • CreateNewEvent() : SLNet::ReadyEvent
  • CreateRecvPollingThread() : SLNet::RNS2_Berkley
  • CreateServer() : SLNet::Rackspace
  • CreateSharedIPGroup() : SLNet::Rackspace
  • creatingSystemGUID : SLNet::Replica3
  • creationTime : SLNet::InternalPacket
  • CSHA1() : CSHA1
  • CullExpiredValues() : SLNet::StatisticsHistory::TimeAndValueQueue
  • currentlyAttemptedServerAddress : SLNet::UDPProxyCoordinator::ForwardingRequest
  • currentlyDeallocatingReplica : SLNet::ReplicaManager3
  • currentOffset : SLNet::FileListTransfer::FileToPush
  • currentProcessingCommand : SLNet::HTTPConnection
  • currentRoom : SLNet::RelayPlugin::StrAndGuidAndRoom
  • currentTeam : SLNet::TeamBalancer::TeamMember , SLNet::TeamBalancer::MyTeamMembers
  • cursorPosition : SLNet::TelnetTransport::TelnetClient
  • curTime : SLNet::SerializeParameters
  • cwnd : SLNet::CCRakNetSlidingWindow
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- d -

  • data
: SLNet::CloudQueryRow
, DataStructures::Page< KeyType, DataType, order >
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node
, DataStructures::Tree< TreeType >
, SLNet::RNS2RecvStruct
, SLNet::Packet
, SLNet::FileListNode
, DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode
, SLNet::HTTPConnection::BadResponse
, SLNet::HTTPConnection::OutgoingCommand
, DataStructures::ByteQueue
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, SLNet::InternalPacket
, SLNet::RakPeer::RequestedConnectionStruct
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::RNS2_SendParameters
  • dataBitLength : SLNet::InternalPacketFixedSizeTransmissionHeader
  • dataChunkLength : SLNet::FileListTransferCBInterface::FileProgressStruct
  • dataLength : FileListNodeContext , SLNet::RakPeer::RequestedConnectionStruct
  • dataLengthBytes : SLNet::CloudServer::CloudData , SLNet::FileListNode
  • dataPtr : SLNet::CloudServer::CloudData , FileListNodeContext
  • dataQueue : SLNet::BPSTracker
  • dataQueues : SLNet::StatisticsHistory::TrackedObject
  • dataRepository : SLNet::CloudServer
  • dataSize : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • DC_CONTINUOUS : SLNet::StatisticsHistory
  • DC_DISCRETE : SLNet::StatisticsHistory
  • Deallocate() : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • DeallocateCloudQueryRow() : SLNet::CloudAllocator
  • DeallocateFilterSet() : SLNet::MessageFilter
  • DeallocateIfNeeded() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • DeallocatePacket()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::TCPInterface
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::TransportInterface
  • DeallocateQueryList() : SLNet::TableSerializer
  • DeallocateRowData() : SLNet::CloudAllocator
  • DeallocateWithDefaultAllocator() : SLNet::CloudClient
  • DeallocConnection() : SLNet::ReplicaManager3
  • DeallocPacketUnified() : SLNet::PluginInterface2
  • DeallocReplica()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • DeallocReplicaNoBroadcastDestruction() : SLNet::ReplicaManager3
  • DeallocRNS2() : SLNet::RakNetSocket2Allocator
  • DeallocRNS2RecvStruct()
: SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::RakPeer
, SLNet::RNS2EventHandler
  • debugInterface : SLNet::Router2
  • debugPort : SLNet::SystemAddress
  • DecodeArray() : SLNet::HuffmanEncodingTree
  • DecodeFile() : SLNet::FileListTransfer
  • DecodeSetHeader() : SLNet::FileListTransfer
  • DecodeString()
: SLNet::StringTable
, SLNet::StringCompressor
  • DecodeTeamAssigned() : SLNet::TeamManager
  • DecodeTeamCancelled() : SLNet::TeamManager
  • DecomposeTeamFull() : SLNet::TeamManager
  • DecomposeTeamFullOrLocked() : SLNet::TeamManager
  • DecomposeTeamLocked() : SLNet::TeamManager
  • DecompressAndAllocate() : SLNet::DataCompressor
  • Decrement() : SLNet::LocklessUint32_t
  • DecrementReadOffset() : DataStructures::ByteQueue
  • DefaultAssigmentAlgorithm : SLNet::TeamBalancer
  • defaultAssigmentAlgorithm : SLNet::TeamBalancer
  • defaultMTUSize : SLNet::RakPeer
  • defaultSendParameters : SLNet::ReplicaManager3
  • defaultTimeoutTime : SLNet::RakPeer
  • Del()
: DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
  • Delete()
: DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::Map< key_type, data_type, key_comparison_func >
  • DeleteConnectionAttempt() : SLNet::NatPunchthroughServer::User
  • Deleted : SLNet::HTTPConnection
  • deleteData : SLNet::Packet
  • DeleteDecendants() : DataStructures::Tree< TreeType >
  • DeleteEvent() : SLNet::ReadyEvent
  • DeleteFiles() : SLNet::FileList
  • DeleteFilterSet() : SLNet::MessageFilter
  • DeleteFromPageAtIndex() : DataStructures::BPlusTree< KeyType, DataType, order >
  • DeleteImage() : SLNet::Rackspace
  • DeleteMember() : SLNet::TeamBalancer
  • DeleteRow() : DataStructures::Table
  • DeleteServer() : SLNet::Rackspace
  • DeleteServerAddress() : SLNet::Rackspace
  • DeleteSharedIPGroup() : SLNet::Rackspace
  • DeleteShiftArrayLeft() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • DeleteThis() : SLNet::FileListTransfer::FileToPushRecipient
  • deletingSystemGUID : SLNet::Replica3
  • Deref() : RefCountedObj , SLNet::FileListTransfer::FileToPushRecipient , WSAStartupSingleton
  • DerefAllSockets() : SLNet::RakPeer
  • DerefConnectionAttempt() : SLNet::NatPunchthroughServer::User
  • Dereference() : SLNet::ReplicaManager3
  • DereferenceList() : SLNet::ReplicaManager3
  • DereferenceRemoteSystem() : SLNet::RakPeer
  • DereferenceTeam() : SLNet::TM_World
  • DereferenceTeamMember() : SLNet::TM_World
  • Deserialize()
: DataStructures::RangeList< range_type >
, SLNet::FileList
, SLNet::RakNetRandomSync
, SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
, SLNet::RakString
, SLNet::RakWString
  • DeserializeCell() : SLNet::TableSerializer
  • DeserializeColumns() : SLNet::TableSerializer
  • DeserializeCompressed() : SLNet::RakString
  • DeserializeConstruction()
: SLNet::Replica3Composite< parent_type >
, SLNet::TM_TeamMember
, SLNet::TM_Team
, SLNet::Replica3
, SLNet::RakNetRandomSync
  • DeserializeConstructionExisting()
: SLNet::Replica3Composite< parent_type >
, SLNet::Replica3
  • DeserializeDestruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • DeserializeFilterQuery() : SLNet::TableSerializer
  • DeserializeFilterQueryList() : SLNet::TableSerializer
  • DeserializeOnDownloadComplete() : SLNet::Connection_RM3
  • DeserializeOnDownloadStarted() : SLNet::Connection_RM3
  • DeserializeRow() : SLNet::TableSerializer
  • DeserializeTable() : SLNet::TableSerializer
  • DeserializeVariable() : SLNet::VariableDeltaSerializer
  • destination
: SLNet::UDPForwarder::StartForwardingInputStruct
, SLNet::NatPunchthroughClient::DSTAndFac
, SLNet::UDPForwarder::StopForwardingStruct
  • destinationConnection : SLNet::SerializeParameters
  • destroyedReplicasCulled : SLNet::Connection_RM3
  • DetachPlugin()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::TCPInterface
  • detectionState : SLNet::NatTypeDetectionServer::NATDetectionAttempt
  • DetectNATType() : SLNet::NatTypeDetectionClient
  • deviationRtt : SLNet::CCRakNetSlidingWindow
  • didComparisonThisTick : SLNet::VariableDeltaSerializer
  • direction : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • Direction_Types : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DirectoryDeltaTransfer() : SLNet::DirectoryDeltaTransfer
  • DirtyAndFreeVarsAssociatedWithReceipt() : SLNet::VariableDeltaSerializer
  • DisableSecurity()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • disallowedCallbackUserData : SLNet::FilterSet
  • disallowedMessageBanTimeMS : SLNet::FilterSet
  • DISCONNECT_ASAP : SLNet::RakPeer::RemoteSystemStruct
  • DISCONNECT_ASAP_SILENTLY : SLNet::RakPeer::RemoteSystemStruct
  • DISCONNECT_ON_NO_ACK : SLNet::RakPeer::RemoteSystemStruct
  • DisplayBreadthFirstSearch() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DisplayInorder() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DisplayPostorder() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DisplayPostorderRecursive() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DisplayPreorder() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DoEndianSwap() : SLNet::BitStream
  • DomainNameToIP() : SLNet::RakNetSocket2
  • doNotFragment : SLNet::RNS2_BerkleyBindParameters
  • DownloadFromSubdirectory() : SLNet::DirectoryDeltaTransfer
  • downloadGroup : SLNet::Connection_RM3
  • DynDNS() : SLNet::DynDNS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- e -

  • emptyString : SLNet::RakString
  • EncodeArray() : SLNet::HuffmanEncodingTree
  • EncodeString()
: SLNet::StringCompressor
, SLNet::StringTable
, SLNet::StringCompressor
  • EncodeTeamAssigned() : SLNet::TeamManager
  • EncodeTeamFull() : SLNet::TeamManager
  • EncodeTeamFullOrLocked() : SLNet::TeamManager
  • EncodeTeamLocked() : SLNet::TeamManager
  • End() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • EndDeserialize() : SLNet::VariableDeltaSerializer
  • EndianSwapBytes() : SLNet::BitStream
  • EndPeek() : DataStructures::QueueLinkedList< QueueType >
  • endpointAddress : SLNet::Router2::MiniPunchRequest
  • endpointGuid
: SLNet::Router2::MiniPunchRequest
, SLNet::Router2::ForwardedConnection
, SLNet::Router2::ConnnectRequest
  • EndSerialize() : SLNet::VariableDeltaSerializer
  • endThreads : SLNet::RakPeer , SLNet::RNS2_Berkley
  • EnforceTeamBalance() : SLNet::TM_World
  • EqualsExcludingPort() : SLNet::SystemAddress
  • Erase() : SLNet::RakString
  • EstablishRouting() : SLNet::Router2
  • EstimateColumnType() : DataStructures::Table::Cell
  • estimatedRTT : SLNet::CCRakNetSlidingWindow
  • eventCallbacks : SLNet::Rackspace
  • EvenTeams() : SLNet::TeamBalancer
  • eventHandler : SLNet::RakNetSocket2 , SLNet::RNS2_BerkleyBindParameters
  • eventId : SLNet::ReadyEvent::ReadyEventNode
  • eventList : SLNet::SignaledEvent
  • eventStatus : SLNet::ReadyEvent::ReadyEventNode
  • EventTypeToString() : SLNet::Rackspace
  • ExecuteDefault() : SLNet::RackspaceEventCallback_Default
  • ExecuteOperation() : SLNet::Rackspace
  • expectedNextSequenceNumber : SLNet::CCRakNetSlidingWindow
  • EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS : SLNet::PunchthroughConfiguration
  • EXTERNAL_IP_WAIT_AFTER_FIRST_TTL : SLNet::PunchthroughConfiguration
  • EXTERNAL_IP_WAIT_BETWEEN_PORTS : SLNet::PunchthroughConfiguration
  • extraData : SLNet::RakPeer::RequestedConnectionStruct
  • extraSocketOptions : SLNet::SocketDescriptor , SLNet::RakPeer::BufferedCommandStruct
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- f -

  • facilitator : SLNet::NatPunchthroughClient::SendPing , SLNet::NatPunchthroughClient::DSTAndFac
  • failedAttemptList : SLNet::NatPunchthroughClient
  • failedConnectionAttemptMutex : SLNet::TCPInterface
  • failedConnectionAttempts : SLNet::TCPInterface
  • fileData : SLNet::FileListTransferCBInterface::OnFileStruct
  • fileIndex : SLNet::FileListTransferCBInterface::OnFileStruct
  • fileLengthBytes : SLNet::FileListNode
  • fileList : SLNet::FileList
  • FileList() : SLNet::FileList
  • fileListNode : SLNet::FileListTransfer::FileToPush
  • FileListNodeContext() : FileListNodeContext
  • FileListProgress() : SLNet::FileListProgress
  • fileListProgressCallbacks : SLNet::FileListTransfer , SLNet::FileList
  • fileListReceivers : SLNet::FileListTransfer
  • fileListTransfer : SLNet::DirectoryDeltaTransfer , SLNet::FileListTransfer::ThreadData
  • FileListTransfer() : SLNet::FileListTransfer
  • FileListTransferCBInterface() : SLNet::FileListTransferCBInterface
  • filename : SLNet::FileListNode
  • fileName : SLNet::FileListTransferCBInterface::OnFileStruct
  • filesToPush : SLNet::FileListTransfer::FileToPushRecipient
  • fileToPushRecipientList : SLNet::FileListTransfer
  • fileToPushRecipientListMutex : SLNet::FileListTransfer
  • FILL_IN_ORDER : SLNet::TeamBalancer
  • FillBufferMT() : SLNet::RakNetRandom
  • FillIPList() : SLNet::RakPeer
  • FillRequestedSlots() : SLNet::TM_World
  • filter : SLNet::FilteredSystem
  • filterList : SLNet::MessageFilter
  • FilterQuery() : DataStructures::Table::FilterQuery
  • FilterQueryType : DataStructures::Table
  • filterSetID : SLNet::FilterSet
  • Final() : CSHA1
  • Find()
: DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::Queue< queue_type >
, SLNet::RakString
  • FindDeleteRebalance() : DataStructures::BPlusTree< KeyType, DataType, order >
  • FindIntersection() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • FindParent() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • FindPointer() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • FindRouterPortStride() : SLNet::NatPunchthroughClient
  • firstDataChunk : SLNet::FileListTransferCBInterface::FileProgressStruct
  • firstExternalID : SLNet::RakPeer
  • firstPacket : SLNet::SplitPacketChannel
  • FixEndingSlash() : SLNet::FileList
  • FixForIPVersion() : SLNet::SystemAddress
  • FixTree() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • FixUnderflow() : DataStructures::BPlusTree< KeyType, DataType, order >
  • FlagDirtyFromBitArray() : SLNet::VariableListDeltaTracker
  • FlagFilesAsReferences() : SLNet::FileList
  • flnc_extraData1 : FileListNodeContext
  • flnc_extraData2 : FileListNodeContext
  • flnc_extraData3 : FileListNodeContext
  • FLP_Printf() : SLNet::FLP_Printf
  • forceAddress : SLNet::CloudServer
  • ForceCompletion() : SLNet::ReadyEvent
  • ForceExternalSystemAddress() : SLNet::CloudServer
  • forceHostAddress : SLNet::UDPForwarder::StartForwardingInputStruct
  • forceSendUntilNextUpdate : SLNet::Replica3
  • forceTeamsToBeEven : SLNet::TeamBalancer
  • ForEach() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ForEachData() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ForEachLeaf() : DataStructures::BPlusTree< KeyType, DataType, order >
  • FormatForDELETE() : SLNet::RakString
  • FormatForGET() : SLNet::RakString
  • FormatForPOST() : SLNet::RakString
  • FormatForPUT() : SLNet::RakString
  • FormatForPUTOrPost() : SLNet::RakString
  • FormatLine() : SLNet::PacketLogger
  • forwardedConnectionList : SLNet::Router2
  • forwardedConnectionListMutex : SLNet::Router2
  • ForwardEntry() : SLNet::UDPForwarder::ForwardEntry
  • forwardingPort : SLNet::UDPForwarder::StartForwardingOutputStruct , SLNet::Router2::MiniPunchRequest
  • ForwardingRequestComp() : SLNet::UDPProxyCoordinator
  • forwardingRequestList : SLNet::UDPProxyCoordinator
  • forwardingSocket : SLNet::Router2::MiniPunchRequest , SLNet::UDPForwarder::StartForwardingOutputStruct
  • forwardListNotUpdated : SLNet::UDPForwarder
  • FPrintf()
: SLNet::RakWString
, SLNet::RakString
  • FrandomMT()
: SLNet::RakNetRandom
, SLNet::RakNetRandomSync
  • Free() : SLNet::RakString
  • FreeChangedVariablesList() : SLNet::VariableDeltaSerializer
  • freeList : SLNet::RakString
  • FreeMemory()
: SLNet::HuffmanEncodingTree
, SLNet::RakString
  • FreeMemoryNoMutex() : SLNet::RakString
  • FreePages() : DataStructures::BPlusTree< KeyType, DataType, order >
  • FreeVarsAssociatedWithReceipt() : SLNet::VariableDeltaSerializer
  • FromString()
: SLNet::SystemAddress
, SLNet::RakNetGUID
  • FromStringExplicitPort() : SLNet::SystemAddress
  • fullPathToFile : SLNet::FileListNode
  • functionPointer : SLNet::RPC4::LocalSlotObject
  • functions : SLNet::RPC4::LocalCallback
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- g -

  • g : SLNet::RakNetGUID
  • GenerateDisjktraMatrix() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • generatedNonces : SLNet::TwoWayAuthentication::NonceGenerator
  • GenerateFromFrequencyTable() : SLNet::HuffmanEncodingTree
  • GenerateGUID() : SLNet::RakPeer
  • GenerateHashes() : SLNet::DirectoryDeltaTransfer
  • GenerateNonce() : SLNet::TwoWayAuthentication::NonceGenerator
  • GenerateSeedFromGuid() : SLNet::RakPeer
  • GenerateTree() : SLNet::HuffmanEncodingTreeFactory
  • GenerateTreeFromStrings() : SLNet::StringCompressor
  • Get()
: DataStructures::List< list_type >
, DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::MLKeyRef< templateType >
, DataStructures::Table::Cell
, CheckSum
, DataStructures::Table::Cell
, SLNet::CloudClient
, SLNet::HTTPConnection
, SLNet::CloudClient
, DataStructures::BPlusTree< KeyType, DataType, order >
  • Get64BitUniqueRandomNumber() : SLNet::RakPeerInterface
  • GET_BASE_OBJECT_FROM_ID() : SLNet::NetworkIDManager
  • GET_OBJECT_FROM_ID() : SLNet::NetworkIDManager
  • GetAllConnectionDownloadsCompleted() : SLNet::ReplicaManager3
  • GetAndIncrementNextDatagramSequenceNumber() : SLNet::CCRakNetSlidingWindow
  • GetAsList() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • GetAutoCreateConnections() : SLNet::ReplicaManager3
  • GetAutoDestroyConnections() : SLNet::ReplicaManager3
  • GetAutoProcessNewConnections() : SLNet::ConnectionGraph2
  • GetAvailablePagesSize() : DataStructures::MemoryPool< MemoryBlockType >
  • GetAvailableRowId() : DataStructures::Table
  • GetAvailableTeamIndexWithFewestMembers() : SLNet::TM_World
  • GetAveragePing()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetBalancedTeamLimit() : SLNet::TM_World
  • GetBalanceTeams() : SLNet::TM_World
  • GetBalancingApplies() : SLNet::TM_Team
  • GetBestClockDifferential() : SLNet::RakPeer
  • GetBindings() : SLNet::RNS2_Berkley
  • GetBoundAddress() : SLNet::RakNetSocket2
  • GetBPS1() : SLNet::BPSTracker
  • GetBPS1Threadsafe() : SLNet::BPSTracker
  • GetBytesPerSecondLimitByCongestionControl() : SLNet::CCRakNetSlidingWindow
  • GetBytesWritten() : DataStructures::ByteQueue
  • GetCallbacks()
: SLNet::FileList
, SLNet::FileListTransfer
  • GetCallCount() : SLNet::RakNetRandomSync
  • GetCellValueByIndex() : DataStructures::Table
  • GetChangelistSinceDate() : SLNet::AutopatcherRepositoryInterface
  • GetChannelIndexFromName() : SLNet::LogCommandParser
  • GetCharacterCount() : SLNet::RakString
  • GetClientPublicKeyFromSystemAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetClockDifferential()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetClockDifferentialInt() : SLNet::RakPeer
  • GetColumnCount() : DataStructures::Table
  • GetColumns() : DataStructures::Table
  • GetColumnType() : DataStructures::Table
  • GetCommandParser()
: SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::TransportInterface
  • GetCompletedDescription() : SLNet::DynDNS
  • GetCompletedResultCode() : SLNet::DynDNS
  • GetCompositeOwner() : SLNet::Replica3Composite< parent_type >
  • GetConnectionAtIndex()
: DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
, SLNet::ReplicaManager3
  • GetConnectionByGUID() : SLNet::ReplicaManager3
  • GetConnectionBySystemAddress() : SLNet::ReplicaManager3
  • GetConnectionCount()
: DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
, SLNet::ReplicaManager3
, SLNet::TCPInterface
  • GetConnectionList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::TCPInterface
  • GetConnectionListForRemoteSystem() : SLNet::ConnectionGraph2
  • GetConnectionRequestIndex() : SLNet::Router2
  • GetConnectionState()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetConnectionsThatHaveReplicaConstructed() : SLNet::ReplicaManager3
  • GetConstructedReplicas() : SLNet::Connection_RM3
  • GetCreatingSystemGUID() : SLNet::Replica3
  • GetCurrentTeam() : SLNet::TM_TeamMember
  • GetCurrentTeamByIndex() : SLNet::TM_TeamMember
  • GetCurrentTeamCount() : SLNet::TM_TeamMember
  • GetCurrentTeams() : SLNet::TM_TeamMember
  • GetCWNDLimit() : SLNet::CCRakNetSlidingWindow
  • GetData() : SLNet::BitStream
  • GetDataHead() : DataStructures::BPlusTree< KeyType, DataType, order >
  • GetDebugInterface() : SLNet::Router2
  • GetDefaultSendParameters() : SLNet::ReplicaManager3
  • GetDefaultTimeToTrack() : SLNet::StatisticsHistory
  • GetDeltaToCurrent() : SLNet::FileList
  • GetDetectionAttemptIndex() : SLNet::NatTypeDetectionServer
  • GetDownloadWasCompleted() : SLNet::Connection_RM3
  • GetElementFromKey() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • GetEntries() : GridSectorizer
  • GetEstimatedBandwidth() : SLNet::CCRakNetSlidingWindow
  • GetEventAtIndex() : SLNet::ReadyEvent
  • GetEventHandler() : SLNet::RakNetSocket2
  • GetEventListSize() : SLNet::ReadyEvent
  • GetExternalID()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetFilePart() : SLNet::IncrementalReadInterface
  • GetFilterSetByID() : SLNet::MessageFilter
  • GetFilterSetCount() : SLNet::MessageFilter
  • GetFilterSetIDByIndex() : SLNet::MessageFilter
  • GetFirstBindableIP() : SLNet::SocketLayer
  • GetFirstNonFullTeam() : SLNet::TeamBalancer
  • GetFlavorDetails() : SLNet::Rackspace
  • GetFrequencyTable() : SLNet::HuffmanEncodingTreeFactory
  • GetFromWaitListAtIndex() : SLNet::ReadyEvent
  • GetGroupList() : SLNet::RelayPlugin
  • GetGUIDFromIndex()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetGuidFromSystemAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetGuidIndex() : SLNet::Router2::ConnnectRequest
  • GetHash() : CSHA1
  • GetHistoryForKey() : SLNet::StatisticsHistory
  • GetHistorySorted() : SLNet::StatisticsHistory
  • GetHost() : SLNet::TM_World
  • GetImageDetails() : SLNet::Rackspace
  • GetIncomingPassword()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetIncrementalReadChunkSize() : SLNet::AutopatcherRepositoryInterface
  • GetIndexAtKey() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • GetIndexFromGuid() : SLNet::RakPeer
  • GetIndexFromKey() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • GetIndexFromKeyInSortedList() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetIndexFromSystemAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetIndexOf() : DataStructures::BPlusTree< KeyType, DataType, order > , DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > , DataStructures::List< list_type > , DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetInputAtIndex() : ThreadPool< InputType, OutputType >
  • GetInsertionIndex() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetInternalID()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetIPPROTO() : SLNet::SystemAddress
  • GetIPVersion() : SLNet::SystemAddress
  • GetIsInSlowStart() : SLNet::CCRakNetSlidingWindow
  • GetJoinPermissions() : SLNet::TM_Team
  • GetKeyAtIndex() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • GetLargestPingAmongConnectedSystems() : SLNet::Router2
  • GetLastError() : SLNet::AutopatcherRepositoryInterface
  • GetLastPing()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetLastTeams() : SLNet::TM_TeamMember
  • GetLeafFromKey() : DataStructures::BPlusTree< KeyType, DataType, order >
  • GetLength()
: SLNet::RakString
, SLNet::RakWString
  • GetLengthUTF8() : SLNet::RakString
  • GetLinkCapacityBytesPerSecond() : SLNet::CCRakNetSlidingWindow
  • GetListHead()
: DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::Table
  • GetLocalIP()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetLocalPort() : SLNet::SocketLayer
  • GetLocalReceiveRate() : SLNet::CCRakNetSlidingWindow
  • GetLocalSendRate() : SLNet::CCRakNetSlidingWindow
  • GetLocalSlotIndex() : SLNet::RPC4
  • GetLocalTime() : SLNet::PacketLogger
  • GetLongTermAverage() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetLongTermHighest() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetLongTermLowest() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetLongTermSum() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetLoopbackAddress() : SLNet::RakPeer
  • GetLowestAveragePingSystem() : SLNet::ConnectionGraph2
  • GetLowestPing()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMaxForwardEntries() : SLNet::UDPForwarder
  • GetMaximumIncomingConnections()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMaximumNumberOfPeers()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMemberIndex() : SLNet::TeamBalancer
  • GetMemberIndexToSwitchTeams() : SLNet::TeamBalancer
  • GetMemberLimit() : SLNet::TM_Team
  • GetMemberLimitSetting() : SLNet::TM_Team
  • GetMemberWithRequestedSingleTeamSwitch() : SLNet::TM_Team
  • GetMemoryPoolPageSize() : DataStructures::MemoryPool< MemoryBlockType >
  • GetMinMaxTeamMembers() : SLNet::TeamBalancer
  • GetMostRecentChangelistWithPatches() : SLNet::AutopatcherRepositoryInterface
  • GetMTU() : SLNet::CCRakNetSlidingWindow
  • GetMTUSize()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMultilistType() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetMyBoundAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMyGUID()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMyGUIDUnified() : SLNet::PluginInterface2
  • GetMyIP()
: SLNet::RakNetSocket2
, SLNet::RNS2_Linux
, SLNet::SocketLayer
  • GetMyIPIPV4() : SLNet::RNS2_Linux
  • GetMyIPIPV4And6() : SLNet::RNS2_Linux
  • GetMyPublicIP() : SLNet::DynDNS
  • GetMyTeam() : SLNet::TeamBalancer
  • GetName()
: SLNet::RakNetCommandParser
, SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • GetNetworkID()
: SLNet::TM_Team
, SLNet::NetworkIDObject
, SLNet::TM_TeamMember
  • GetNetworkIDManager()
: SLNet::NetworkIDObject
, SLNet::ReplicaManager3
  • GetNewNetworkID() : SLNet::NetworkIDManager
  • GetNextDatagramSequenceNumber() : SLNet::CCRakNetSlidingWindow
  • GetNextDefaultTeam() : SLNet::TeamBalancer
  • GetNextSendReceipt()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetNextSendTime() : SLNet::ReliabilityLayer
  • GetNodeAtIndex() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • GetNodeCount() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • GetNonce() : SLNet::TwoWayAuthentication::NonceGenerator
  • GetNonceById() : SLNet::TwoWayAuthentication::NonceGenerator
  • GetNoTeamId() : SLNet::TM_TeamMember
  • GetNumberOfAddresses()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetNumberOfBitsAllocated() : SLNet::BitStream
  • GetNumberOfBitsUsed() : SLNet::BitStream
  • GetNumberOfBytesUsed() : SLNet::BitStream
  • GetNumberOfFilesForUpload() : SLNet::DirectoryDeltaTransfer
  • GetNumberOfRemoteInitiatedConnections() : SLNet::RakPeer
  • GetNumberOfUnreadBits() : SLNet::BitStream
  • GetObjectAtIndex() : SLNet::StatisticsHistory
  • GetObjectCount() : SLNet::StatisticsHistory
  • GetObjectIndex() : SLNet::StatisticsHistory
  • GetOfflinePingResponse()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetOperationOfTypeIndex() : SLNet::Rackspace
  • GetOrAllocateCloudDataList() : SLNet::CloudServer
  • GetOutgoingDataBufferSize() : SLNet::TCPInterface
  • GetOutput() : ThreadPool< InputType, OutputType >
  • GetOutputAtIndex() : ThreadPool< InputType, OutputType >
  • GetOverpopulatedTeams() : SLNet::TeamBalancer
  • GetOwner()
: SLNet::TM_TeamMember
, SLNet::TM_Team
  • GetParent() : SLNet::NetworkIDObject
  • GetParticipantList()
: SLNet::TM_World
, SLNet::ConnectionGraph2
  • GetPatches() : SLNet::AutopatcherRepositoryInterface
  • GetPendingFilesToAddress() : SLNet::FileListTransfer
  • GetPendingOpenNATIndex() : SLNet::NatPunchthroughClient
  • GetPingBetweenSystems() : SLNet::ConnectionGraph2
  • GetPointerToNode() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • GetPort() : SLNet::SystemAddress
  • GetPortNetworkOrder() : SLNet::SystemAddress
  • GetPtr() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetPunchthroughConfiguration() : SLNet::NatPunchthroughClient
  • GetRakNetGUID() : SLNet::Connection_RM3
  • GetRakNetSocketFromUserConnectionSocketIndex() : SLNet::RakPeer
  • GetRakPeerInterface() : SLNet::PluginInterface2
  • GetReadOffset() : SLNet::BitStream
  • GetReadyStatus() : SLNet::ReadyEvent
  • GetReceiveBufferSize()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetRecentAverage() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentHighest() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentLowest() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentStandardDeviation() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentSum() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentSumOfSquares() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRefCount()
: SLNet::RakNetSmartPtr< T >
, SLNet::ReferenceCounter
  • GetReferencedReplicaList() : SLNet::ReplicaManager3
  • GetRegisteredCommand() : SLNet::CommandParserInterface
  • GetRemoteServers() : SLNet::CloudServer
  • GetRemoteSystem() : SLNet::RakPeer
  • GetRemoteSystemFromGUID() : SLNet::RakPeer
  • GetRemoteSystemFromSystemAddress() : SLNet::RakPeer
  • GetRemoteSystemHistoryListIndex() : SLNet::VariableDeltaSerializer
  • GetRemoteSystemIndex() : SLNet::RakPeer
  • GetRemoteSystemVariableHistory() : SLNet::VariableDeltaSerializer
  • GetRemoteWaitListSize() : SLNet::ReadyEvent
  • GetRemoveReceiveRate() : SLNet::CCRakNetSlidingWindow
  • GetReplicaAtIndex() : SLNet::ReplicaManager3
  • GetReplicaByNetworkID() : SLNet::ReplicaManager3
  • GetReplicaCount() : SLNet::ReplicaManager3
  • GetReplicasCreatedByGuid() : SLNet::ReplicaManager3
  • GetReplicasCreatedByMe() : SLNet::ReplicaManager3
  • GetRequestComp() : SLNet::CloudServer
  • GetRequestedSpecificTeams() : SLNet::TM_TeamMember
  • GetRequestedTeam() : SLNet::TM_TeamMember
  • GetRequestedTeamCount() : SLNet::TM_TeamMember
  • GetRequestedTeamIndex() : SLNet::TM_TeamMember
  • getRequests : SLNet::CloudServer
  • GetResponse()
: SLNet::HTTPConnection2
, SLNet::EmailSender
, SLNet::HTTPConnection2
  • GetRetransmissionBandwidth() : SLNet::CCRakNetSlidingWindow
  • GetRowByID() : DataStructures::Table
  • GetRowByIndex() : DataStructures::Table
  • GetRowCount() : DataStructures::Table
  • GetRows() : DataStructures::Table
  • GetRTOForRetransmission() : SLNet::CCRakNetSlidingWindow
  • GetRTT() : SLNet::CCRakNetSlidingWindow
  • GetSeed() : SLNet::RakNetRandomSync
  • GetSenderRTOForACK() : SLNet::CCRakNetSlidingWindow
  • GetServerAddress() : SLNet::HTTPConnection
  • GetServerDetails() : SLNet::Rackspace
  • GetServersWithUploadedKeys() : SLNet::CloudServer
  • GetSharedIPGroupDetails() : SLNet::Rackspace
  • GetShortestPath() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • GetSize() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetSizeToAllocate() : SLNet::RakString
  • GetSmallestNonFullTeam() : SLNet::TeamBalancer
  • GetSocket()
: SLNet::RNS2_Berkley
, SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetSockets()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetSocketType() : SLNet::RakNetSocket2
  • GetSortedJoinRequests() : SLNet::TM_World
  • GetSortOrder() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetSpanningTree() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • GetSplitMessageProgressInterval()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetState() : SLNet::HTTPConnection
  • GetStatistics()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::ReliabilityLayer
, SLNet::RakPeerInterface
  • GetStatisticsList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • getString : SLNet::DynDNS
  • GetSubNetForSocketAndIp() : SLNet::SocketLayer
  • GetSumSinceTime() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetSystemAddress()
: SLNet::Connection_RM3
, SLNet::SocketLayer
  • GetSystemAddress_Old() : SLNet::SocketLayer
  • GetSystemAddressFromGuid()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetSystemAddressFromIndex()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetSystemAddressIPV4() : SLNet::RNS2_Berkley
  • GetSystemAddressIPV4And6() : SLNet::RNS2_Berkley
  • GetSystemCount() : SLNet::MessageFilter
  • GetSystemFilterSet() : SLNet::MessageFilter
  • GetSystemIndex() : SLNet::AddressOrGUID
  • GetSystemIndexFromGuid() : SLNet::RakPeer
  • GetSystemList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetTeamByIndex() : SLNet::TM_World
  • GetTeamByNetworkID() : SLNet::TM_World
  • GetTeamCount() : SLNet::TM_World
  • GetTeamIndex() : SLNet::TM_World
  • GetTeamManager() : SLNet::TM_World
  • GetTeamMemberByIndex()
: SLNet::TM_World
, SLNet::TM_Team
  • GetTeamMemberByNetworkID() : SLNet::TM_World
  • GetTeamMemberCount() : SLNet::TM_World
  • GetTeamMemberIDByIndex() : SLNet::TM_World
  • GetTeamMemberIndex() : SLNet::TM_World
  • GetTeamMembers() : SLNet::TM_Team
  • GetTeamMembersCount() : SLNet::TM_Team
  • GetTimeBetweenPackets() : SLNet::ReliabilityLayer
  • GetTimeLastDatagramArrived() : SLNet::ReliabilityLayer
  • GetTimeoutTime()
: SLNet::ReliabilityLayer
, SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetTimeRange() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetTimeToTrackValues() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetTM_World()
: SLNet::TM_Team
, SLNet::TM_TeamMember
  • GetTotal1() : SLNet::BPSTracker
  • GetTransmissionBandwidth() : SLNet::CCRakNetSlidingWindow
  • GetUnavailablePagesSize() : DataStructures::MemoryPool< MemoryBlockType >
  • GetUniqueKeyList() : SLNet::StatisticsHistory
  • GetUPNPPortMappings() : SLNet::NatPunchthroughClient
  • GetUsedForwardEntries() : SLNet::UDPForwarder
  • GetUserConnectionSocketIndex() : SLNet::RakNetSocket2
  • GetValue() : SLNet::LocklessUint32_t
  • GetVarsWrittenPerRemoteSystemListIndex() : SLNet::VariableDeltaSerializer
  • GetWorldAtIndex() : SLNet::TeamManager
  • GetWorldCount()
: SLNet::TeamManager
, SLNet::ReplicaManager3
  • GetWorldId() : SLNet::TM_World
  • GetWorldIdAtIndex() : SLNet::ReplicaManager3
  • GetWorldIndex()
: SLNet::TM_Team
, SLNet::TM_TeamMember
  • GetWorldWithId() : SLNet::TeamManager
  • GetWriteOffset() : SLNet::BitStream
  • gotBlockingReturnValue : SLNet::RPC4
  • gotDownloadComplete : SLNet::Connection_RM3
  • gotReplyFromEndpoint : SLNet::Router2::MiniPunchRequest
  • gotReplyFromSource : SLNet::Router2::MiniPunchRequest
  • gotResult : SLNet::CloudServer::BufferedGetResponseFromServer
  • gotSubscribedAndUploadedKeys : SLNet::CloudServer::RemoteServer
  • GreaterThan() : SLNet::CCRakNetSlidingWindow
  • GreatestRandResult() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • grid : GridSectorizer
  • gridCellHeightCount : GridSectorizer
  • gridCellWidthCount : GridSectorizer
  • gridHeight : GridSectorizer
  • GridSectorizer() : GridSectorizer
  • gridWidth : GridSectorizer
  • groupConstructionAndSerialize : SLNet::Connection_RM3
  • groupPunchthroughRequests : SLNet::NatPunchthroughServer::User
  • guid
: SLNet::VariableDeltaSerializer::SerializationContext
, SLNet::ConnectionGraph2::RemoteSystem
, SLNet::NatPunchthroughServer::User
, SLNet::ConnectionGraph2::SystemAddressAndGuid
, SLNet::NatPunchthroughClient::AddrAndGuid
, SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory
, SLNet::RelayPlugin::StrAndGuid
, SLNet::Connection_RM3
, SLNet::Packet
, SLNet::RakPeer::RemoteSystemStruct
, SLNet::Router2::ConnectionRequestSystem
, SLNet::RelayPlugin::StrAndGuidAndRoom
, SLNet::NatTypeDetectionServer::NATDetectionAttempt
  • guidToStrHash : SLNet::RelayPlugin
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- h -

  • HandleSocketReceiveFromConnectedPlayer() : SLNet::ReliabilityLayer
  • HANDLING_CONNECTION_REQUEST : SLNet::RakPeer::RemoteSystemStruct
  • Has() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • HAS_PORT_STRIDE : SLNet::NatPunchthroughClient
  • HasBadResponse() : SLNet::HTTPConnection
  • HasCompletedConnectionAttempt()
: SLNet::PacketizedTCP
, SLNet::TCPInterface
  • HasConnection() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • HasConnectionAttemptToUser() : SLNet::NatPunchthroughServer::User
  • HasData() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > , DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • HasEvent() : SLNet::ReadyEvent
  • HasFailedConnectionAttempt()
: SLNet::PacketizedTCP
, SLNet::TCPInterface
  • Hash() : SLNet::TwoWayAuthentication , DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • HashFile() : CSHA1
  • HasInput() : ThreadPool< InputType, OutputType >
  • HasInputFast() : ThreadPool< InputType, OutputType >
  • HasLostConnection()
: SLNet::PacketizedTCP
, SLNet::TCPInterface
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::TransportInterface
  • HasNewIncomingConnection()
: SLNet::PacketizedTCP
, SLNet::TCPInterface
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::TransportInterface
  • HasOperationOfType() : SLNet::Rackspace
  • HasOutput() : ThreadPool< InputType, OutputType >
  • HasOutputFast() : ThreadPool< InputType, OutputType >
  • hasPortStride : SLNet::NatPunchthroughClient
  • HasRead() : SLNet::HTTPConnection
  • HasReplicaConstructed() : SLNet::Connection_RM3
  • HasRequestedTeam() : SLNet::TM_TeamMember
  • HasResponse() : SLNet::HTTPConnection2
  • HasSavedSearchResult() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • haveRakNetCloseSocket : SLNet::RakPeer::BufferedCommandStruct
  • headerLength : SLNet::InternalPacket
  • headPush : SLNet::TCPInterface
  • heap : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • Heap() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • heap : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • HeapChannelAndData() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData
  • HeapNode() : DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode
  • Height() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • HeightRecursive() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • HMAC() : CSHA1
  • hMutex : SLNet::SignaledEvent
  • host : SLNet::HTTPConnection2::Request , SLNet::DynDNS
  • hostAddress : SLNet::RNS2_BerkleyBindParameters , SLNet::SocketDescriptor
  • hostCompletedAddress : SLNet::HTTPConnection2::Request
  • hostEstimatedAddress : SLNet::HTTPConnection2::Request
  • hostGuid : SLNet::TM_World , SLNet::TeamBalancer
  • httpCommand : SLNet::Rackspace::RackspaceOperation
  • HTTPConnection() : SLNet::HTTPConnection
  • HTTPConnection2() : SLNet::HTTPConnection2
  • HuffmanEncodingTree() : SLNet::HuffmanEncodingTree
  • HuffmanEncodingTreeFactory() : SLNet::HuffmanEncodingTreeFactory
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- i -

  • i : DataStructures::Table::Cell
  • ID : SLNet::TM_Team
  • identicalSerializationBs : SLNet::VariableDeltaSerializer
  • identifier : SLNet::TwoWayAuthentication::PendingChallenge
  • IDTOString() : SLNet::PacketLogger
  • IgnoreBits() : SLNet::BitStream
  • IgnoreBytes() : SLNet::BitStream
  • IMPLEMENT_DEFAULT_COMPARISON()
: DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • INCAPABLE_PORT_STRIDE : SLNet::NatPunchthroughClient
  • incomingDatagramEventHandler : SLNet::RakPeer
  • incomingMessages : SLNet::TCPInterface
  • incomingPassword : SLNet::RakPeer
  • incomingPasswordLength : SLNet::RakPeer
  • incomingQueueMutex : SLNet::RakPeer
  • incomingStream : SLNet::Rackspace::RackspaceOperation
  • Increment() : SLNet::LocklessUint32_t
  • incrementalReadInterface : SLNet::DirectoryDeltaTransfer , SLNet::FileListTransfer::FileToPush
  • IncrementalReadInterface() : SLNet::IncrementalReadInterface
  • IncrementExternalAttemptCount() : SLNet::NatPunchthroughClient
  • IncrementNextSendReceipt()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • IncrementReadOffset() : DataStructures::ByteQueue
  • index : SLNet::RemoteSystemIndex
  • indexIntoTeamsRequested : SLNet::TM_World::JoinRequestHelper
  • indicesToSend : SLNet::LastSerializationResultBS
  • Init()
: SLNet::HTTPConnection
, SLNet::CCRakNetSlidingWindow
, GridSectorizer
  • InitEvent() : SLNet::SignaledEvent
  • InitializeSecurity()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • InitPage() : DataStructures::MemoryPool< MemoryBlockType >
  • inputFunctionQueue : ThreadPool< InputType, OutputType >
  • inputId : SLNet::UDPForwarder::StartForwardingInputStruct , SLNet::UDPForwarder::StartForwardingOutputStruct
  • inputQueue : ThreadPool< InputType, OutputType >
  • inputQueueMutex : ThreadPool< InputType, OutputType >
  • InputSize() : ThreadPool< InputType, OutputType >
  • Insert()
: DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::List< list_type >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::RangeList< range_type >
  • InsertAtEnd() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • InsertAtIndex() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > , DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • InsertBranchDown() : DataStructures::BPlusTree< KeyType, DataType, order >
  • InsertInOrderedList() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • InsertIntoNode() : DataStructures::BPlusTree< KeyType, DataType, order >
  • InsertShiftArrayRight() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • Instance()
: SLNet::StringCompressor
, SLNet::StringTable
  • instance : SLNet::StringTable
  • intermediaryAddress : SLNet::Router2::ForwardedConnection
  • intermediaryGuid : SLNet::Router2::ForwardedConnection
  • INTERNAL_IP_WAIT_AFTER_ATTEMPTS : SLNet::PunchthroughConfiguration
  • internalIds : SLNet::NatPunchthroughClient::SendPing
  • Interpolate() : SLNet::StatisticsHistory::TimeAndValueQueue
  • InterruptSignal() : SLNet::RPC4
  • interruptSignal : SLNet::RPC4
  • invalidMessageCallback : SLNet::FilterSet
  • invCellHeight : GridSectorizer
  • invCellWidth : GridSectorizer
  • InvokeSignal() : SLNet::RPC4
  • IP : SLNet::RakPeer::BanStruct
  • IPAddressMatch() : SLNet::RakString
  • ipList : SLNet::RakPeer
  • ipVersion : SLNet::HTTPConnection2::Request
  • iriDataChunk : SLNet::FileListTransferCBInterface::FileProgressStruct
  • iriWriteOffset : SLNet::FileListTransferCBInterface::FileProgressStruct
  • isActive : SLNet::RakPeer::RemoteSystemStruct , SLNet::RemoteClient
  • IsActive()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • isActiveMutex : SLNet::RemoteClient
  • isAReference : SLNet::FileListNode
  • IsBanned()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • IsBerkleySocket() : SLNet::RakNetSocket2
  • IsBigEndian() : SLNet::BitStream
  • IsBusy()
: SLNet::HTTPConnection2
, SLNet::HTTPConnection
  • IsCompleted() : SLNet::DynDNS
  • IsConnected() : SLNet::HTTPConnection2
  • IsDeadConnection() : SLNet::ReliabilityLayer
  • isDirty : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • IsEmailAddress() : SLNet::RakString
  • IsEmpty()
: DataStructures::Queue< queue_type >
, DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, SLNet::RakString
, SLNet::RakWString
  • isEmpty : DataStructures::Table::Cell
  • IsEventCompleted() : SLNet::ReadyEvent
  • IsEventCompletedByIndex() : SLNet::ReadyEvent
  • IsEventCompletionProcessing() : SLNet::ReadyEvent
  • IsEventSet() : SLNet::ReadyEvent
  • isFirstConstruction : SLNet::Connection_RM3
  • IsHandlerActive() : SLNet::FileListTransfer
  • IsIn()
: DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
  • IsInProgress() : SLNet::NatTypeDetectionClient
  • IsInSecurityExceptionList()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • IsInSlowStart() : SLNet::CCRakNetSlidingWindow
  • IsInvalid() : DataStructures::HashIndex
  • IsInWaitList() : SLNet::ReadyEvent
  • IsLANAddress() : SLNet::SystemAddress
  • isLeaf : DataStructures::Page< KeyType, DataType, order >
  • isLimitedByCongestionControl : SLNet::RakNetStatistics
  • isLimitedByOutgoingBandwidthLimit : SLNet::RakNetStatistics
  • IsLocalIP()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • IsLoopback() : SLNet::SystemAddress
  • IsLoopbackAddress() : SLNet::RakPeer
  • isMainLoopThreadActive : SLNet::RakPeer
  • IsNetworkOrder() : SLNet::BitStream
  • IsNetworkOrderInternal() : SLNet::BitStream
  • IsNetworkSimulatorActive()
: SLNet::RakPeerInterface
, SLNet::RakPeer
, SLNet::ReliabilityLayer
  • IsNotUploaded() : SLNet::CloudServer::CloudDataList
  • IsNull() : SLNet::RakNetSmartPtr< T >
  • IsOnTeam() : SLNet::TM_TeamMember
  • IsOutgoingDataWaiting() : SLNet::ReliabilityLayer
  • IsPastEndOfList() : SLNet::VariableListDeltaTracker
  • isPendingAuthentication : SLNet::Rackspace::RackspaceOperation
  • IsPortInUse() : SLNet::IRNS2_Berkley
  • isPost : SLNet::HTTPConnection::OutgoingCommand
  • isReady : SLNet::NatPunchthroughServer::User
  • isRecvFromLoopThreadActive : SLNet::RNS2_Berkley
  • IsRunning() : SLNet::DynDNS
  • isRunning : SLNet::UDPForwarder
  • isSignaled : SLNet::SignaledEvent
  • isSignaledMutex : SLNet::SignaledEvent
  • IsSorted() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • isStarted : SLNet::TCPInterface
  • isTeamSwitch : SLNet::TM_TeamMember::RequestedTeam
  • IsUndefined() : SLNet::AddressOrGUID
  • IsUnique() : SLNet::RakNetSmartPtr< T >
  • IsUnused()
: SLNet::CloudServer::RemoteCloudClient
, SLNet::CloudServer::CloudData
, SLNet::CloudServer::CloudDataList
  • isUploaded : SLNet::CloudServer::CloudData
  • isValidated : SLNet::Connection_RM3
  • isValidPath : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • IsWithinRange() : DataStructures::RangeList< range_type >
  • IsWorking() : ThreadPool< InputType, OutputType >
  • item : DataStructures::BinarySearchTree< BinarySearchTreeType >::node , DataStructures::CircularLinkedList< CircularLinkedListType >::node
  • ItemAtIndex() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- j -

  • joinAnyRequestIndex : SLNet::TM_TeamMember
  • JoinAnyTeam() : SLNet::TM_World
  • JoinAnyTeamCheck() : SLNet::TM_TeamMember
  • JoinGroup() : SLNet::RelayPlugin
  • JoinGroupRequest() : SLNet::RelayPlugin
  • joinPermissions : SLNet::TM_Team
  • JoinRequestHelperComp() : SLNet::TM_World
  • JoinSpecificTeam() : SLNet::TM_World
  • JoinSpecificTeamCheck() : SLNet::TM_TeamMember
  • joinTeamType : SLNet::TM_TeamMember , SLNet::TeamSelection
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- k -

  • key
: SLNet::CloudQueryRow
, SLNet::CloudServer::CloudDataList
, SLNet::StatisticsHistory::TimeAndValueQueue
, SLNet::CloudServer::KeySubscriberID
  • key1 : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • key2 : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • KeyAtIndex() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • keyData : SLNet::CloudServer::CloudDataList
  • KeyDataListComp() : SLNet::CloudServer
  • KeyDataPtrComp() : SLNet::CloudServer
  • keys : SLNet::CloudQuery , DataStructures::Page< KeyType, DataType, order >
  • KeySubscriberIDComp() : SLNet::CloudServer
  • KickExcessMembers() : SLNet::TM_World
  • kickOnDisallowedMessage : SLNet::FilterSet
  • KillConnection() : SLNet::ReliabilityLayer
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- l -

  • l : SHA1_WORKSPACE_BLOCK
  • lastAutoSerializeOccurance : SLNet::ReplicaManager3
  • lastData : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • lastReceivedStatus : SLNet::ReadyEvent::RemoteSystem
  • lastReliableSend : SLNet::RakPeer::RemoteSystemStruct
  • lastRequestedForwardingSystem : SLNet::Router2::ConnnectRequest
  • lastRtt : SLNet::CCRakNetSlidingWindow
  • lastSearchIndex : DataStructures::Map< key_type, data_type, key_comparison_func >
  • lastSearchIndexValid : DataStructures::Map< key_type, data_type, key_comparison_func >
  • lastSearchKey : DataStructures::Map< key_type, data_type, key_comparison_func >
  • lastSec1 : SLNet::BPSTracker
  • lastSentBitstream : SLNet::SerializeParameters
  • lastSentSerialization : SLNet::Replica3
  • lastSentStatus : SLNet::ReadyEvent::RemoteSystem
  • lastSentTextInput : SLNet::TelnetTransport::TelnetClient
  • LastSerializationResult() : SLNet::LastSerializationResult
  • lastSerializationResultBS : SLNet::LastSerializationResult
  • lastTeams : SLNet::TM_TeamMember
  • lastUpdate : SLNet::NatPunchthroughServer
  • lastUpdateTime : SLNet::SplitPacketChannel
  • leastNodeArray : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • LeaveAllTeams() : SLNet::TM_TeamMember
  • LeaveGroup() : SLNet::RelayPlugin
  • LeaveTeam()
: SLNet::TM_TeamMember
, SLNet::TM_Team
  • LeaveTeamCheck() : SLNet::TM_TeamMember
  • left : DataStructures::BinarySearchTree< BinarySearchTreeType >::node , HuffmanEncodingTreeNode , SLNet::RakNetRandom
  • LEFT : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • LeftChild() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • leftmostLeaf : DataStructures::BPlusTree< KeyType, DataType, order >
  • length
: SLNet::CloudQueryRow
, SLNet::RNS2_SendParameters
, SLNet::Packet
  • lengthAllocated : DataStructures::ByteQueue
  • LessThan() : SLNet::CCRakNetSlidingWindow
  • LevelOrderTraversal() : DataStructures::Tree< TreeType >
  • limitConnectionFrequencyFromTheSameIP : SLNet::RakPeer
  • LinkedList() : DataStructures::LinkedList< LinkedListType >
  • List() : DataStructures::List< list_type >
  • list_size : DataStructures::CircularLinkedList< CircularLinkedListType >
  • listenSocket : SLNet::TCPInterface
  • ListFlavors() : SLNet::Rackspace
  • ListImages() : SLNet::Rackspace
  • ListMissingOrChangedFiles() : SLNet::FileList
  • ListParsers() : SLNet::ConsoleServer
  • ListServerAddresses() : SLNet::Rackspace
  • ListServers() : SLNet::Rackspace
  • ListServersWithDetails() : SLNet::Rackspace
  • ListSharedIPGroups() : SLNet::Rackspace
  • ListSharedIPGroupsWithDetails() : SLNet::Rackspace
  • LocalCallbackComp() : SLNet::RPC4
  • localCallbacks : SLNet::RPC4
  • LocalSlotObject() : SLNet::RPC4::LocalSlotObject
  • LocalSlotObjectComp() : SLNet::RPC4
  • localSlots : SLNet::RPC4
  • Lock() : SLNet::SimpleMutex
  • LockInput() : ThreadPool< InputType, OutputType >
  • LocklessUint32_t() : SLNet::LocklessUint32_t
  • LockMutex() : SLNet::RakString
  • LockOutput() : ThreadPool< InputType, OutputType >
  • lockTeams : SLNet::TeamBalancer
  • logCommandParser : SLNet::PacketConsoleLogger
  • LogCommandParser() : SLNet::LogCommandParser
  • LogConnectionAttempts() : SLNet::NatPunchthroughServer::User
  • logDirectMessages : SLNet::PacketLogger
  • loggedInCoordinators : SLNet::UDPProxyServer
  • loggingInCoordinators : SLNet::UDPProxyServer
  • LogHeader() : SLNet::PacketLogger
  • LoginToCoordinator() : SLNet::UDPProxyServer
  • logMessages : SLNet::ThreadsafePacketLogger
  • LogStringNotFound() : SLNet::StringTable
  • longTermCount : SLNet::StatisticsHistory::TimeAndValueQueue
  • longTermHighest : SLNet::StatisticsHistory::TimeAndValueQueue
  • longTermLowest : SLNet::StatisticsHistory::TimeAndValueQueue
  • longTermSum : SLNet::StatisticsHistory::TimeAndValueQueue
  • lostConnections : SLNet::RakNetTransport2 , SLNet::TCPInterface
  • lowestPing : SLNet::RakPeer::RemoteSystemStruct
  • lsr : SLNet::Replica3
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- m -

  • MakeFilePath() : SLNet::RakString
  • Map() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • map : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • Map() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • MapNode() : DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode
  • mapNodeData : DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode
  • mapNodeKey : DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode
  • mapNodeList : DataStructures::Map< key_type, data_type, key_comparison_func >
  • MAX_PREDICTIVE_PORT_RANGE : SLNet::PunchthroughConfiguration
  • maxBytesPerDowload : SLNet::CloudServer
  • maxForwardEntries : SLNet::UDPForwarder
  • MAXIMUM_MTU_INCLUDING_UDP_HEADER : SLNet::CCRakNetSlidingWindow
  • MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK : SLNet::PunchthroughConfiguration
  • maximumForwardingRequests : SLNet::Router2
  • maximumIncomingConnections : SLNet::RakPeer
  • maximumNumberOfPeers : SLNet::RakPeer
  • maxIndex : DataStructures::RangeNode< range_type >
  • maxMemberTimeMS : SLNet::FilterSet
  • maxOutgoingBPS : SLNet::RakPeer
  • maxRowsToReturn : SLNet::CloudQuery
  • maxUploadBytesPerClient : SLNet::CloudServer
  • memberGuid : SLNet::TeamBalancer::TeamMember
  • memberId : SLNet::TeamBalancer::TeamMember , SLNet::TeamBalancer::MyTeamMembers
  • memoryPool : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • MemoryPool() : DataStructures::MemoryPool< MemoryBlockType >
  • memoryPoolMutex : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • memoryPoolPageSize : DataStructures::MemoryPool< MemoryBlockType >
  • MergeAllObjectsOnKey() : SLNet::StatisticsHistory
  • MergeSets() : SLNet::StatisticsHistory::TimeAndValueQueue
  • MessageFilter() : SLNet::MessageFilter
  • messageHandlerList : SLNet::TCPInterface
  • messageId : SLNet::RPC4::LocalCallback
  • messageInSendBuffer : SLNet::RakNetStatistics
  • messageInternalOrder : SLNet::InternalPacket
  • messageNumberAssigned : SLNet::InternalPacket
  • messagesInResendBuffer : SLNet::RakNetStatistics
  • messageTimestamp : SLNet::SerializeParameters
  • minIndex : DataStructures::RangeNode< range_type >
  • miniPunchesInProgress : SLNet::Router2
  • miniPunchesInProgressMutex : SLNet::Router2
  • ML_SORTED_ASCENDING : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ML_SORTED_DESCENDING : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ML_UNSORTED : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • MLKeyRef() : DataStructures::MLKeyRef< templateType >
  • mostRecentExternalPort : SLNet::NatPunchthroughClient
  • mostRecentPort : SLNet::NatPunchthroughServer::User
  • MoveMemberThatWantsToJoinTeam() : SLNet::TeamBalancer
  • MoveMemberThatWantsToJoinTeamInternal() : SLNet::TeamBalancer
  • MTUSize : SLNet::RakPeer::RemoteSystemStruct
  • Multilist() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • mutexAttr : SLNet::SignaledEvent
  • myExternalSystemAddress : SLNet::RakPeer::RemoteSystemStruct
  • myGuid : SLNet::RakPeer
  • myIPStr : SLNet::DynDNS
  • myPrivateKey : SLNet::PublicKey
  • myPublicKey : SLNet::PublicKey
  • myTeamMembers : SLNet::TeamBalancer
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- n -

  • NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS : SLNet::NatPunchthroughServer::ConnectionAttempt
  • NAT_ATTEMPT_PHASE_NOT_STARTED : SLNet::NatPunchthroughServer::ConnectionAttempt
  • natDetectionAttempts : SLNet::NatTypeDetectionServer
  • NATDetectionState : SLNet::NatTypeDetectionServer
  • NatPunchthroughClient() : SLNet::NatPunchthroughClient
  • NatPunchthroughDebugInterface() : SLNet::NatPunchthroughDebugInterface
  • natPunchthroughDebugInterface : SLNet::NatPunchthroughClient
  • NatPunchthroughDebugInterface_PacketLogger() : SLNet::NatPunchthroughDebugInterface_PacketLogger
  • NatPunchthroughServer() : SLNet::NatPunchthroughServer
  • NatPunchthroughServerDebugInterface() : SLNet::NatPunchthroughServerDebugInterface
  • natPunchthroughServerDebugInterface : SLNet::NatPunchthroughServer
  • NatPunchthroughServerDebugInterface_PacketLogger() : SLNet::NatPunchthroughServerDebugInterface_PacketLogger
  • NatPunchthroughUserComp() : SLNet::NatPunchthroughServer
  • NatTypeDetectionClient() : SLNet::NatTypeDetectionClient
  • NatTypeDetectionServer() : SLNet::NatTypeDetectionServer
  • networkID : SLNet::NetworkIDObject , SLNet::RakPeer::BufferedCommandStruct
  • networkId : SLNet::TM_TeamMember
  • networkIdHash : SLNet::NetworkIDManager
  • networkIDManager : SLNet::NetworkIDObject , SLNet::ReplicaManager3::RM3World
  • NetworkIDManager() : SLNet::NetworkIDManager
  • NetworkIDObject() : SLNet::NetworkIDObject
  • NetworkIDToHashIndex() : SLNet::NetworkIDManager
  • newConnections : SLNet::RakNetTransport2
  • newConnectionsObjectType : SLNet::StatisticsHistoryPlugin
  • newIncomingConnections : SLNet::TCPInterface
  • newRemoteClients : SLNet::TCPInterface
  • newSystemSend : SLNet::VariableDeltaSerializer::SerializationContext
  • next
: DataStructures::CircularLinkedList< CircularLinkedListType >::node
, DataStructures::MemoryPool< MemoryBlockType >::Page
, SLNet::RemoteSystemIndex
, SLNet::RakNetRandom
, DataStructures::Page< KeyType, DataType, order >
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node
  • nextAction : SLNet::Router2::MiniPunchRequest
  • nextActionTime : SLNet::InternalPacket , SLNet::NatPunchthroughClient::SendPing
  • nextCongestionControlBlock : SLNet::CCRakNetSlidingWindow
  • nextDatagramSequenceNumber : SLNet::CCRakNetSlidingWindow
  • nextGetRequestId : SLNet::CloudServer
  • nextGetRequestsCheck : SLNet::CloudServer
  • nextInputId : SLNet::UDPForwarder
  • nextInstanceForNetworkIDManager : SLNet::NetworkIDObject
  • nextPingTime : SLNet::RakPeer::RemoteSystemStruct
  • nextReferenceIndex : SLNet::ReplicaManager3
  • nextRequestId : SLNet::TwoWayAuthentication::NonceGenerator
  • nextRequestTime : SLNet::RakPeer::RequestedConnectionStruct
  • nextSlotRegistrationCount : SLNet::RPC4
  • nextStateTime : SLNet::NatTypeDetectionServer::NATDetectionAttempt
  • nextWriteIndex : SLNet::VariableListDeltaTracker
  • NO_ACTION : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction , SLNet::RakPeer::RemoteSystemStruct
  • NoBody : SLNet::HTTPConnection
  • node : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent
  • Node() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node
  • NodeComparisonFunc() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • nodeList : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • nonBlockingSocket : SLNet::RNS2_BerkleyBindParameters
  • nonce : SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest
  • nonceGenerator : SLNet::TwoWayAuthentication
  • NonceGenerator() : SLNet::TwoWayAuthentication::NonceGenerator
  • nonSpecificSubscribers : SLNet::CloudServer::CloudDataList
  • NonVariadic() : SLNet::RakString
  • NORMAL : SLNet::InternalPacket
  • NOT_FOUND : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • NoTeam() : SLNet::TeamSelection
  • noTeamSubcategory : SLNet::TM_TeamMember
  • NotifyAndFlagForShutdown() : SLNet::RakPeer
  • NotifyClientSubscribersOfDataChange() : SLNet::CloudServer
  • NotifyNoTeam() : SLNet::TeamBalancer
  • NotifyServerSubscribersOfDataChange() : SLNet::CloudServer
  • NotifyTeamAssigment() : SLNet::TeamBalancer
  • NotifyTeamsLocked() : SLNet::TeamBalancer
  • NotifyTeamSwitchPending() : SLNet::TeamBalancer
  • NotifyUsersInRoom() : SLNet::RelayPlugin
  • NUMBER_OF_RAKPEER_MUTEXES : SLNet::RakPeer
  • numberOfBitsToSend : SLNet::RakPeer::BufferedCommandStruct
  • NumberOfConnections()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • numberOfFilesInThisSet : SLNet::FileListTransferCBInterface::OnFileStruct , SLNet::FileListTransferCBInterface::DownloadCompleteStruct
  • NumberOfLeadingZeroes() : SLNet::BitStream
  • NUMERIC : DataStructures::Table
  • numThreadsRunning : ThreadPool< InputType, OutputType >
  • numThreadsRunningMutex : ThreadPool< InputType, OutputType >
  • NumThreadsWorking() : ThreadPool< InputType, OutputType >
  • numThreadsWorking : ThreadPool< InputType, OutputType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- o -

  • objectId : SLNet::StatisticsHistory::TrackedObjectData
  • objects : SLNet::StatisticsHistory
  • objectType : SLNet::StatisticsHistory::TrackedObjectData
  • occasionalPing : SLNet::RakPeer
  • offlinePingResponse : SLNet::RakPeer
  • offlinePingResponse_Mutex : SLNet::RakPeer
  • OK : SLNet::HTTPConnection
  • oldestUnsentAck : SLNet::CCRakNetSlidingWindow
  • OnAck()
: SLNet::CCRakNetSlidingWindow
, SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnAddFilesFromDirectoryStarted()
: SLNet::FileListProgress
, SLNet::FLP_Printf
  • OnAddToRequestedTeams() : SLNet::TeamManager
  • OnAllServersBusy() : SLNet::UDPProxyClientResultHandler
  • OnAlreadyLoggedIn() : SLNet::UDPProxyServerResultHandler
  • OnAttach()
: SLNet::NatPunchthroughClient
, SLNet::PluginInterface2
, SLNet::RPC4
, SLNet::TeamBalancer
, SLNet::UDPProxyServer
  • OnAuthenticationResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnCancelTeamRequest() : SLNet::TeamBalancer
  • OnClientMessage()
: SLNet::NatPunchthroughDebugInterface
, SLNet::NatPunchthroughDebugInterface_Printf
, SLNet::NatPunchthroughDebugInterface_PacketLogger
  • OnClientReady() : SLNet::NatPunchthroughServer
  • OnClosedConnection()
: SLNet::HTTPConnection2
, SLNet::MessageFilter
, SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::PluginInterface2
, SLNet::Rackspace
, SLNet::ReadyEvent
, SLNet::RelayPlugin
, SLNet::ReplicaManager3
, SLNet::Router2
, SLNet::StatisticsHistoryPlugin
, SLNet::TeamBalancer
, SLNet::TM_World
, SLNet::TeamManager
, SLNet::RakNetTransport2
, SLNet::TwoWayAuthentication
, SLNet::UDPProxyCoordinator
, SLNet::UDPProxyServer
, SLNet::CloudServer
, SLNet::ConnectionGraph2
, SLNet::FileListTransfer
  • OnCommand()
: SLNet::RakNetCommandParser
, SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • OnCompletion() : SLNet::NatTypeDetectionClient
  • OnConfirmResizedServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnConnectAtTime() : SLNet::NatPunchthroughClient
  • OnConnectedPong() : SLNet::RakPeer
  • OnConnectionAttemptFailure()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnConnectionLost()
: SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • OnConnectionRequest() : SLNet::RakPeer
  • OnConstruction() : SLNet::ReplicaManager3
  • OnConstructToThisConnection() : SLNet::Connection_RM3
  • OnCreateImageResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnCreateServerResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnCreateSharedIPGroup()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDeleteImageResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDeleteServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDeleteServerAddress()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDeleteSharedIPGroup()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDereference()
: SLNet::FileListTransferCBInterface
, SLNet::Connection_RM3
  • OnDetach()
: SLNet::NatPunchthroughClient
, SLNet::NatTypeDetectionClient
, SLNet::PluginInterface2
, SLNet::ReplicaManager3
, SLNet::UDPProxyServer
  • OnDetectionRequest() : SLNet::NatTypeDetectionServer
  • OnDirectory()
: SLNet::FileListProgress
, SLNet::FLP_Printf
  • OnDirectSocketReceive()
: SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnDirectSocketSend()
: SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnDoNotQueryDestruction() : SLNet::Connection_RM3
  • OnDownloadComplete()
: SLNet::FileListTransferCBInterface
, SLNet::ReplicaManager3
  • OnDownloadExisting() : SLNet::Connection_RM3
  • OnDownloadFromOtherSystem() : SLNet::Connection_RM3
  • OnDownloadFromThisSystem() : SLNet::Connection_RM3
  • OnDownloadRequest() : SLNet::DirectoryDeltaTransfer
  • OnDownloadStarted() : SLNet::ReplicaManager3
  • OnDuplicateAck() : SLNet::CCRakNetSlidingWindow
  • OnFailedConnectionAttempt()
: SLNet::HTTPConnection2
, SLNet::PluginInterface2
, SLNet::Router2
  • OnFailureNotification() : SLNet::NatPunchthroughClient
  • OnFile()
: SLNet::FileListProgress
, SLNet::FileListTransferCBInterface
  • OnFileProgress() : SLNet::FileListTransferCBInterface
  • OnFilePush() : SLNet::FileListProgress
  • OnFilePushesComplete()
: SLNet::FileListProgress
, SLNet::FLP_Printf
  • onFileStruct : SLNet::FileListTransferCBInterface::FileProgressStruct
  • OnForwardingInProgress() : SLNet::UDPProxyClientResultHandler
  • OnForwardingNotification() : SLNet::UDPProxyClientResultHandler
  • OnForwardingReplyFromServerToCoordinator() : SLNet::UDPProxyCoordinator
  • OnForwardingRequestFromClientToCoordinator() : SLNet::UDPProxyCoordinator
  • OnForwardingRequestFromCoordinatorToServer() : SLNet::UDPProxyServer
  • OnForwardingSuccess()
: SLNet::Router2
, SLNet::UDPProxyClientResultHandler
  • OnGet() : SLNet::CloudClientCallback
  • OnGetFlavorDetailsResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnGetImageDetailsResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnGetMostRecentPort()
: SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
  • OnGetReponse() : SLNet::CloudClient
  • OnGetRequest()
: SLNet::CloudServerQueryFilter
, SLNet::CloudServer
  • OnGetServerDetails()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnGetSharedIPGroupDetails()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnGotPacket() : SLNet::CCRakNetSlidingWindow
  • OnGotPacketPair() : SLNet::CCRakNetSlidingWindow
  • OnGroupMessageFromClient() : SLNet::RelayPlugin
  • OnHashedNonceAndPassword() : SLNet::TwoWayAuthentication
  • OnInternalPacket()
: SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnInvalidMessage() : SLNet::MessageFilter
  • OnJoinAnyTeam() : SLNet::TeamManager
  • OnJoinGroupRequestFromClient() : SLNet::RelayPlugin
  • OnJoinRequestedTeam() : SLNet::TeamManager
  • OnLeaveGroupRequestFromClient() : SLNet::RelayPlugin
  • OnLeaveTeam() : SLNet::TeamManager
  • OnListFlavorsResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListImagesResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListServerAddresses()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListServersResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListServersWithDetailsResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListSharedIPGroups()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListSharedIPGroupsWithDetails()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnLocalReference() : SLNet::Connection_RM3
  • OnLoginRequestFromServerToCoordinator() : SLNet::UDPProxyCoordinator
  • OnLoginSuccess() : SLNet::UDPProxyServerResultHandler
  • OnMessageReceipt() : SLNet::VariableDeltaSerializer
  • OnMiniPunchReply() : SLNet::Router2
  • OnMiniPunchReplyBounce() : SLNet::Router2
  • OnNAK() : SLNet::CCRakNetSlidingWindow
  • OnNATPunchthroughRequest() : SLNet::NatPunchthroughServer
  • OnNeverConstruct() : SLNet::Connection_RM3
  • OnNeverSerialize() : SLNet::Connection_RM3
  • OnNewConnection()
: SLNet::ConnectionGraph2
, SLNet::HTTPConnection2
, SLNet::MessageFilter
, SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::PluginInterface2
, SLNet::ReplicaManager3
, SLNet::StatisticsHistoryPlugin
, SLNet::TM_World
, SLNet::TeamManager
, SLNet::RakNetTransport2
  • OnNewIncomingConnection()
: SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • OnNonceReply() : SLNet::TwoWayAuthentication
  • OnNonceRequest() : SLNet::TwoWayAuthentication
  • OnNoPasswordSet() : SLNet::UDPProxyServerResultHandler
  • OnNoServersOnline() : SLNet::UDPProxyClientResultHandler
  • OnPasswordResult() : SLNet::TwoWayAuthentication
  • OnPingServers() : SLNet::UDPProxyClient
  • OnPingServersReplyFromClientToCoordinator() : SLNet::UDPProxyCoordinator
  • OnPoppedConnection()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • OnPostRequest()
: SLNet::CloudServerQueryFilter
, SLNet::CloudServer
  • OnPreSerializeTick() : SLNet::VariableDeltaSerializer
  • OnPunchthroughFailure() : SLNet::NatPunchthroughClient
  • OnPushBackPacket()
: SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnQueryForwarding() : SLNet::Router2
  • OnQueryForwardingReply() : SLNet::Router2
  • OnRakPeerShutdown()
: SLNet::CloudServer
, SLNet::FileListTransfer
, SLNet::NatPunchthroughClient
, SLNet::NatTypeDetectionClient
, SLNet::PluginInterface2
, SLNet::ReadyEvent
, SLNet::ReplicaManager3
, SLNet::Router2
, SLNet::TwoWayAuthentication
, SLNet::UDPProxyClient
, SLNet::UDPProxyServer
  • OnRakPeerStartup()
: SLNet::PluginInterface2
, SLNet::UDPProxyServer
  • OnReadyEventForceAllSet() : SLNet::ReadyEvent
  • OnReadyEventPacketUpdate() : SLNet::ReadyEvent
  • OnReadyEventQuery() : SLNet::ReadyEvent
  • OnReadyForNextPunchthrough() : SLNet::NatPunchthroughClient
  • OnRebootServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnRebuildServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnReceive()
: SLNet::CloudClient
, SLNet::CloudServer
, SLNet::ConnectionGraph2
, SLNet::DirectoryDeltaTransfer
, SLNet::FileListTransfer
, SLNet::HTTPConnection2
, SLNet::MessageFilter
, SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::PluginInterface2
, SLNet::UDPProxyClient
, SLNet::Rackspace
, SLNet::ReadyEvent
, SLNet::RelayPlugin
, SLNet::ReplicaManager3
, SLNet::Router2
, SLNet::RPC4
, SLNet::TeamBalancer
, SLNet::TeamManager
, SLNet::RakNetTransport2
, SLNet::TwoWayAuthentication
, SLNet::UDPProxyCoordinator
, SLNet::UDPProxyServer
  • OnRecipientNotConnected() : SLNet::UDPProxyClientResultHandler
  • OnReferencePush() : SLNet::FileListTransfer
  • OnReferencePushAck() : SLNet::FileListTransfer
  • OnReleaseRequest()
: SLNet::CloudServerQueryFilter
, SLNet::CloudServer
  • OnReliabilityLayerNotification()
: SLNet::PluginInterface2
, SLNet::PacketLogger
  • OnRemoveFromRequestedTeams() : SLNet::TeamManager
  • OnRemoveFromTeamsRequestedAndAddTeam() : SLNet::TeamManager
  • OnRemoveSubscribedKeyFromServers() : SLNet::CloudServer
  • OnRemoveUploadedKeyFromServers() : SLNet::CloudServer
  • OnReplicaAlreadyExists() : SLNet::Connection_RM3
  • OnRequestAnyTeam() : SLNet::TeamBalancer
  • OnRequestedTeamChangePending() : SLNet::TeamBalancer
  • OnRequestForwarding() : SLNet::Router2
  • OnRequestSpecificTeam() : SLNet::TeamBalancer
  • OnRerouted() : SLNet::Router2
  • OnResend() : SLNet::CCRakNetSlidingWindow
  • OnResizeServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnRevertResizedServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnRNS2Recv()
: SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::RakPeer
, SLNet::RNS2EventHandler
  • OnSendAborted()
: SLNet::FileListProgress
, SLNet::FLP_Printf
  • OnSendAck() : SLNet::CCRakNetSlidingWindow
  • OnSendAckGetBAndAS() : SLNet::CCRakNetSlidingWindow
  • OnSendBytes() : SLNet::CCRakNetSlidingWindow
  • OnSendDestructionFromQuery() : SLNet::Connection_RM3
  • OnSendNACK() : SLNet::CCRakNetSlidingWindow
  • OnSendSubscribedKeyToServers() : SLNet::CloudServer
  • OnSendUploadedAndSubscribedKeysToServer() : SLNet::CloudServer
  • OnSendUploadedKeyToServers() : SLNet::CloudServer
  • OnSerialize() : SLNet::ReplicaManager3
  • OnSerializeTransmission()
: SLNet::Replica3Composite< parent_type >
, SLNet::Replica3
  • OnServerDataChanged() : SLNet::CloudServer
  • OnServerMessage()
: SLNet::NatPunchthroughServerDebugInterface
, SLNet::NatPunchthroughServerDebugInterface_Printf
, SLNet::NatPunchthroughServerDebugInterface_PacketLogger
  • OnServerToServerGetRequest() : SLNet::CloudServer
  • OnServerToServerGetResponse() : SLNet::CloudServer
  • OnSetBalanceTeams() : SLNet::TeamManager
  • OnSetBalanceTeamsInitial() : SLNet::TeamManager
  • OnSetJoinPermissions() : SLNet::TeamManager
  • OnSetMemberLimit() : SLNet::TeamManager
  • OnShareServerAddress()
: SLNet::RackspaceEventCallback_Default
, SLNet::Rackspace2EventCallback
  • OnStatusUpdateToNewHost() : SLNet::TeamBalancer
  • OnSubscriptionNotification()
: SLNet::CloudClient
, SLNet::CloudClientCallback
, SLNet::CloudClient
  • OnTeamAssigned() : SLNet::TeamBalancer
  • OnTeamsLocked() : SLNet::TeamBalancer
  • OnTestPortRestricted() : SLNet::NatTypeDetectionClient
  • OnTransportChange()
: SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • OnUnsubscribeRequest()
: SLNet::CloudServerQueryFilter
, SLNet::CloudServer
  • OnUpdateListsToNoTeam() : SLNet::TeamManager
  • OnUpdateServerNameOrPassword()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnUpdateTeamsRequestedToAny() : SLNet::TeamManager
  • OnUpdateTeamsRequestedToNoneAndAddTeam() : SLNet::TeamManager
  • OnUserReplicaPreSerializeTick()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • OnWrongPassword() : SLNet::UDPProxyServerResultHandler
  • op : FileListNodeContext
  • OpenNAT() : SLNet::NatPunchthroughClient
  • operation
: DataStructures::Table::FilterQuery
, SLNet::Rackspace::RackspaceOperation
, DataStructures::Table::SortQuery
  • operations : SLNet::Rackspace
  • operator const char *() : SLNet::RakString
  • operator int() : SLNet::HTTPConnection::BadResponse
  • operator uint32_t() : SLNet::uint24_t
  • operator wchar_t *() : SLNet::RakWString
  • operator!=()
: SLNet::RakString
, SLNet::PRO
, SLNet::RakNetSmartPtr< T >
, SLNet::SystemAddress
, SLNet::RakNetGUID
, SLNet::uint24_t
, SLNet::RakWString
, SLNet::RakString
, SLNet::uint24_t
  • operator&() : SLNet::uint24_t
  • operator*()
: SLNet::RakNetSmartPtr< T >
, SLNet::uint24_t
, SLNet::RakNetSmartPtr< T >
, SLNet::uint24_t
  • operator+() : SLNet::uint24_t
  • operator++()
: DataStructures::CircularLinkedList< CircularLinkedListType >
, SLNet::uint24_t
, DataStructures::LinkedList< LinkedListType >
, SLNet::uint24_t
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::LinkedList< LinkedListType >
  • operator+=()
: SLNet::RakString
, SLNet::uint24_t
, SLNet::RakWString
, SLNet::RakString
, SLNet::RakNetStatistics
, SLNet::RakWString
, SLNet::RakString
, SLNet::RakWString
, SLNet::RakString
, SLNet::uint24_t
  • operator-() : SLNet::uint24_t
  • operator--()
: DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::LinkedList< LinkedListType >
, SLNet::uint24_t
, DataStructures::LinkedList< LinkedListType >
  • operator-=() : SLNet::uint24_t
  • operator->() : SLNet::RakNetSmartPtr< T >
  • operator/() : SLNet::uint24_t
  • operator<()
: SLNet::RakString
, SLNet::uint24_t
, SLNet::SystemAddress
, SLNet::RakNetGUID
, SLNet::RakWString
, SLNet::uint24_t
, DataStructures::MLKeyRef< templateType >
, SLNet::RakNetSmartPtr< T >
  • operator<=() : SLNet::RakString , SLNet::RakWString
  • operator=()
: DataStructures::Table::Cell
, SLNet::AddressOrGUID
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, SLNet::uint24_t
, DataStructures::QueueLinkedList< QueueType >
, SLNet::AddressOrGUID
, SLNet::uint24_t
, SLNet::StatisticsHistory::TimeAndValueQueue
, SLNet::RakWString
, DataStructures::Table
, SLNet::SystemAddress
, SLNet::RakString
, SLNet::HTTPConnection
, SLNet::RakString
, DataStructures::BinarySearchTree< BinarySearchTreeType >
, SLNet::RakWString
, SLNet::RakString
, DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
, DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode
, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
, DataStructures::Queue< queue_type >
, SLNet::RakString
, DataStructures::LinkedList< LinkedListType >
, SLNet::RakWString
, SLNet::RakNetGUID
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::List< list_type >
, SLNet::RakNetSmartPtr< T >
, SLNet::RakWString
, DataStructures::Map< key_type, data_type, key_comparison_func >
, SLNet::RakWString
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, SLNet::RakWString
  • operator==()
: SLNet::RakString
, SLNet::RakNetGUID
, SLNet::RakString
, SLNet::RakWString
, SLNet::RakNetSmartPtr< T >
, SLNet::uint24_t
, SLNet::RakString
, SLNet::SystemAddress
, DataStructures::MLKeyRef< templateType >
, SLNet::uint24_t
, SLNet::AddressOrGUID
, SLNet::PRO
  • operator>()
: SLNet::SystemAddress
, SLNet::RakNetSmartPtr< T >
, SLNet::RakWString
, SLNet::uint24_t
, SLNet::RakString
, DataStructures::MLKeyRef< templateType >
, SLNet::uint24_t
, SLNet::RakNetGUID
  • operator>=() : SLNet::RakWString , SLNet::RakString
  • operator[]()
: DataStructures::List< list_type >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, SLNet::RakString
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::Queue< queue_type >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • optimizeNextSeriesPush : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • OrderedChannelHeap() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • orderedList : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • OrderedList() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • orderedStringList : SLNet::StringTable
  • orderingChannel
: SLNet::InternalPacketFixedSizeTransmissionHeader
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::PRO
, SLNet::FileListTransfer::FileToPush
, SLNet::DirectoryDeltaTransfer
  • orderingIndex : SLNet::InternalPacketFixedSizeTransmissionHeader
  • OrderRemainingServersToTry() : SLNet::UDPProxyCoordinator::ForwardingRequest
  • outgoingChallenges : SLNet::TwoWayAuthentication
  • outgoingCommand : SLNet::HTTPConnection
  • outgoingData : SLNet::RemoteClient
  • outgoingDataMutex : SLNet::RemoteClient
  • outgoingPassword : SLNet::RakPeer::RequestedConnectionStruct
  • outgoingPasswordLength : SLNet::RakPeer::RequestedConnectionStruct
  • outputBitstream : SLNet::SerializeParameters
  • outputQueue : ThreadPool< InputType, OutputType >
  • outputQueueMutex : ThreadPool< InputType, OutputType >
  • OutputSize() : ThreadPool< InputType, OutputType >
  • owner : SLNet::TM_TeamMember , SLNet::TM_Team
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- p -

  • packetAllocationPool : SLNet::RakPeer
  • packetAllocationPoolMutex : SLNet::RakPeer
  • PacketConsoleLogger() : SLNet::PacketConsoleLogger
  • PacketFileLogger() : SLNet::PacketFileLogger
  • PacketizedTCP() : SLNet::PacketizedTCP
  • packetLogFile : SLNet::PacketFileLogger
  • PacketLogger() : SLNet::PacketLogger
  • packetlossLastSecond : SLNet::RakNetStatistics
  • packetlossTotal : SLNet::RakNetStatistics
  • PacketOutputWindowLogger() : SLNet::PacketOutputWindowLogger
  • packetPriority : SLNet::FileListTransfer::FileToPush
  • packetQueue : SLNet::RakNetTransport2
  • packetReturnMutex : SLNet::RakPeer
  • packetReturnQueue : SLNet::RakPeer
  • PadWithZeroToByteLength() : SLNet::BitStream
  • pagePool : DataStructures::BPlusTree< KeyType, DataType, order >
  • parameterCount : SLNet::RegisteredCommand
  • Parent() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • parent : HuffmanEncodingTreeNode , DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent , SLNet::NetworkIDObject
  • parentPage : DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage
  • ParseConnectionRequestPacket() : SLNet::RakPeer
  • ParseConsoleString() : SLNet::CommandParserInterface
  • partCount : SLNet::FileListTransferCBInterface::FileProgressStruct
  • participants : SLNet::TM_World
  • partTotal : SLNet::FileListTransferCBInterface::FileProgressStruct
  • password : SLNet::ConsoleServer
  • passwords : SLNet::TwoWayAuthentication
  • Pause() : ThreadPool< InputType, OutputType >
  • pc : SLNet::NatPunchthroughClient
  • Peek()
: DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::Queue< queue_type >
, DataStructures::QueueLinkedList< QueueType >
  • PeekContiguousBytes() : DataStructures::ByteQueue
  • PeekOpposite() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • PeekTail() : DataStructures::Queue< queue_type >
  • PeekWeight() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • peer : SLNet::RakNetCommandParser
  • pendingRequests : SLNet::HTTPConnection2
  • pendingRequestsMutex : SLNet::HTTPConnection2
  • perThreadDataDestructor : ThreadPool< InputType, OutputType >
  • perThreadDataFactory : ThreadPool< InputType, OutputType >
  • PerThreadDestructor() : ThreadDataInterface
  • PerThreadFactory() : ThreadDataInterface
  • phaseTimeout : SLNet::DynDNS
  • ping : SLNet::UDPProxyClient::ServerWithPing , SLNet::UDPProxyCoordinator::ServerWithPing
  • Ping()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • pingAndClockDifferential : SLNet::RakPeer::RemoteSystemStruct
  • pingAndClockDifferentialWriteIndex : SLNet::RakPeer::RemoteSystemStruct
  • PingInternal() : SLNet::RakPeer
  • pingServerGroups : SLNet::UDPProxyClient
  • pingTime : SLNet::RakPeer::PingAndClockDifferential
  • pingTimeout : SLNet::Router2::ConnnectRequest
  • pingToEndpoint : SLNet::Router2::ConnectionRequestSystem
  • pl : SLNet::NatPunchthroughDebugInterface_PacketLogger , SLNet::NatPunchthroughServerDebugInterface_PacketLogger
  • PluginInterface2() : SLNet::PluginInterface2
  • pluginListNTS : SLNet::RakPeer
  • pluginListTS : SLNet::RakPeer
  • POINTER : DataStructures::Table
  • pollingThreadPriority : SLNet::RNS2_BerkleyBindParameters
  • pool128 : DataStructures::BytePool
  • pool2048 : DataStructures::BytePool
  • pool512 : DataStructures::BytePool
  • pool8192 : DataStructures::BytePool
  • Pop()
: DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::List< list_type >
, DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::Queue< queue_type >
, DataStructures::QueueLinkedList< QueueType >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
  • PopBufferedPacket() : SLNet::RakPeer
  • PopConnection() : SLNet::ReplicaManager3
  • PopDeref() : DataStructures::Queue< queue_type >
  • PopInaccurate() : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • PopOpposite() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • PopTail() : DataStructures::Queue< queue_type >
  • PopulateDataFromDisk() : SLNet::FileList
  • port
: SLNet::HTTPConnection2::Request
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::RNS2_BerkleyBindParameters
, SLNet::SocketDescriptor
  • portStride : SLNet::NatPunchthroughClient
  • portStrideCalTimeout : SLNet::NatPunchthroughClient
  • position : DataStructures::CircularLinkedList< CircularLinkedListType >
  • PositionCrossesCells() : GridSectorizer
  • Post()
: SLNet::CloudClient
, SLNet::HTTPConnection
  • PostDeserializeConstruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • PostDeserializeConstructionExisting()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • PostSerializeConstruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • PostSerializeConstructionExisting()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • Preallocate() : DataStructures::List< list_type >
  • preallocationSize : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • PreDestruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • prefix : SLNet::PacketLogger
  • prev : DataStructures::MemoryPool< MemoryBlockType >::Page
  • previous : DataStructures::Page< KeyType, DataType, order > , DataStructures::CircularLinkedList< CircularLinkedListType >::node
  • primaryIndex : DataStructures::HashIndex
  • primaryKey : SLNet::CloudKey
  • Print()
: DataStructures::ByteQueue
, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • printAcks : SLNet::PacketLogger
  • PrintBits() : SLNet::BitStream
  • PrintChannels() : SLNet::LogCommandParser
  • PrintColumnHeaders() : DataStructures::Table
  • Printf()
: SLNet::RakString
, SLNet::RakWString
  • PrintGraph() : DataStructures::BPlusTree< KeyType, DataType, order >
  • PrintHex() : SLNet::BitStream
  • printId : SLNet::PacketLogger
  • PrintLeaf() : DataStructures::BPlusTree< KeyType, DataType, order >
  • PrintLeaves() : DataStructures::BPlusTree< KeyType, DataType, order >
  • PrintRow() : DataStructures::Table
  • priority
: SLNet::InternalPacket
, SLNet::PRO
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::DirectoryDeltaTransfer
  • pro : SLNet::SerializeParameters
  • ProcessAndTransmitGetRequest() : SLNet::CloudServer
  • ProcessCloudQueryWithAddresses() : SLNet::CloudServer
  • ProcessNetworkPacket : SLNet::RakPeer
  • ProcessOfflineNetworkPacket : SLNet::RakPeer
  • ProcessTCPPacket() : SLNet::HTTPConnection
  • ProcessTeamAssigned() : SLNet::TeamManager
  • prompt : SLNet::ConsoleServer
  • protocol : SLNet::RNS2_BerkleyBindParameters
  • ptr : DataStructures::Table::Cell
  • publicKeyMode : SLNet::RakPeer::RequestedConnectionStruct , SLNet::PublicKey
  • PUNCHING_FIXED_PORT : SLNet::NatPunchthroughClient::SendPing
  • punchingFixedPortAttempts : SLNet::NatPunchthroughClient::SendPing
  • PunchthroughConfiguration() : SLNet::PunchthroughConfiguration
  • Push()
: DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::Queue< queue_type >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::QueueLinkedList< QueueType >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::List< list_type >
  • Push1() : SLNet::BPSTracker
  • PUSH_KEY_TO_PARENT : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • PushAtHead()
: DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::Queue< queue_type >
  • PushBackPacket()
: SLNet::TCPInterface
, SLNet::RakPeer
, SLNet::RakPeerInterface
  • PushBackPacketUnified() : SLNet::PluginInterface2
  • PushBitStream() : SLNet::TeamManager
  • PushBufferedPacket() : SLNet::RakPeer
  • PushCompletionPacket() : SLNet::ReadyEvent
  • PushConnection() : SLNet::ReplicaManager3
  • PushFailure() : SLNet::NatPunchthroughClient
  • PushNotificationsToQueues() : SLNet::PacketizedTCP
  • PushOpposite() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • PushSeries() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • PushSuccess() : SLNet::NatPunchthroughClient
  • PushTeamAssigned() : SLNet::TeamManager
  • PushToUser() : SLNet::TwoWayAuthentication
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- q -

  • QF_EQUAL : DataStructures::Table
  • QF_GREATER_THAN : DataStructures::Table
  • QF_GREATER_THAN_EQ : DataStructures::Table
  • QF_IS_EMPTY : DataStructures::Table
  • QF_LESS_THAN : DataStructures::Table
  • QF_LESS_THAN_EQ : DataStructures::Table
  • QF_NOT_EMPTY : DataStructures::Table
  • QF_NOT_EQUAL : DataStructures::Table
  • QS_DECREASING_ORDER : DataStructures::Table
  • QS_INCREASING_ORDER : DataStructures::Table
  • QSortAscending() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • QSortDescending() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • QUERY_CONNECTION_FOR_REPLICA_LIST : SLNet::Connection_RM3
  • QUERY_REPLICA_FOR_CONSTRUCTION : SLNet::Connection_RM3
  • QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION : SLNet::Connection_RM3
  • QueryActionOnPopConnection()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • QueryActionOnPopConnection_Client() : SLNet::Replica3
  • QueryActionOnPopConnection_PeerToPeer() : SLNet::Replica3
  • QueryActionOnPopConnection_Server() : SLNet::Replica3
  • QueryConstruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • QueryConstruction_ClientConstruction() : SLNet::Replica3
  • QueryConstruction_PeerToPeer() : SLNet::Replica3
  • QueryConstruction_ServerConstruction() : SLNet::Replica3
  • QueryConstructionMode() : SLNet::Connection_RM3
  • QueryDestruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • queryFilters : SLNet::CloudServer
  • QueryGroupDownloadMessages() : SLNet::Connection_RM3
  • QueryRelayDestruction()
: SLNet::Replica3Composite< parent_type >
, SLNet::Replica3
  • QueryRemoteConstruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • QueryRemoteConstruction_ClientConstruction() : SLNet::Replica3
  • QueryRemoteConstruction_PeerToPeer() : SLNet::Replica3
  • QueryRemoteConstruction_ServerConstruction() : SLNet::Replica3
  • QueryReplicaList() : SLNet::Connection_RM3
  • queryResult : SLNet::CloudServer::BufferedGetResponseFromServer
  • QueryRow() : DataStructures::Table
  • QuerySerialization()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • QuerySerialization_ClientSerializable() : SLNet::Replica3
  • QuerySerialization_PeerToPeer() : SLNet::Replica3
  • QuerySerialization_ServerSerializable() : SLNet::Replica3
  • QuerySerializationList() : SLNet::Connection_RM3
  • QueryTable() : DataStructures::Table
  • queryToConstructReplicaList : SLNet::Connection_RM3
  • queryToDestructReplicaList : SLNet::Connection_RM3
  • queryToSerializeReplicaList : SLNet::Connection_RM3
  • Queue() : DataStructures::Queue< queue_type >
  • queue : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • queuedOpenNat : SLNet::NatPunchthroughClient
  • queueHead : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • QueueLinkedList() : DataStructures::QueueLinkedList< QueueType >
  • queueMutex : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • QueueOpenNAT() : SLNet::NatPunchthroughClient
  • queueTail : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • quitAndDataEvents : SLNet::RakPeer
  • quitAndIncomingDataEvents : ThreadPool< InputType, OutputType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- r -

  • r : CheckSum
  • R2RS_REQUEST_STATE_QUERY_FORWARDING : SLNet::Router2
  • r3CompositeOwner : SLNet::Replica3Composite< parent_type >
  • Rackspace() : SLNet::Rackspace
  • Rackspace2EventCallback() : SLNet::Rackspace2EventCallback
  • rackspaceCloudUsername : SLNet::Rackspace
  • RAK_THREAD_DECLARATION()
: SLNet::RakPeer
, SLNet::RNS2_Berkley
, SLNet::TCPInterface
, ThreadPool< InputType, OutputType >
, SLNet::UDPForwarder
, SLNet::RakPeer
  • RakNetCommandParser() : SLNet::RakNetCommandParser
  • RakNetGUID() : SLNet::RakNetGUID
  • rakNetGuid : SLNet::ReadyEvent::RemoteSystem , SLNet::AddressOrGUID
  • RakNetGUID() : SLNet::RakNetGUID
  • RakNetRandom() : SLNet::RakNetRandom
  • rakNetRandom : SLNet::EmailSender
  • RakNetRandomSync() : SLNet::RakNetRandomSync
  • RakNetSmartPtr() : SLNet::RakNetSmartPtr< T >
  • rakNetSocket : SLNet::RakPeer::RemoteSystemStruct
  • RakNetSocket2() : SLNet::RakNetSocket2
  • RakNetTransport2() : SLNet::RakNetTransport2
  • RakPeer() : SLNet::RakPeer
  • rakPeerInterface : SLNet::PluginInterface2
  • rakPeerMutexes : SLNet::RakPeer
  • rakPeerSendReceipt : SLNet::VariableDeltaSerializer::SerializationContext
  • RakString() : SLNet::RakString
  • RakStringComp() : SLNet::RakString
  • RakWString() : SLNet::RakWString
  • RandomMT()
: SLNet::RakNetRandom
, SLNet::RakNetRandomSync
  • randResultQueue : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight
  • RangeList() : DataStructures::RangeList< range_type >
  • RangeNode() : DataStructures::RangeNode< range_type >
  • ranges : DataStructures::RangeList< range_type >
  • RangeSum() : DataStructures::RangeList< range_type >
  • Read()
: SLNet::BitStream
, SLNet::HTTPConnection
  • ReadAlignedBytes() : SLNet::BitStream
  • ReadAlignedBytesSafe() : SLNet::BitStream
  • ReadAlignedBytesSafeAlloc() : SLNet::BitStream
  • ReadAlignedVar16() : SLNet::BitStream
  • ReadAlignedVar32() : SLNet::BitStream
  • ReadAlignedVar8() : SLNet::BitStream
  • ReadBit() : SLNet::BitStream
  • ReadBits() : SLNet::BitStream
  • ReadBitsFromIntegerRange() : SLNet::BitStream
  • ReadBytes() : DataStructures::ByteQueue
  • ReadCasted() : SLNet::BitStream
  • ReadCompressed() : SLNet::BitStream
  • ReadCompressedDelta() : SLNet::BitStream
  • ReadDelta() : SLNet::BitStream
  • ReadFloat16() : SLNet::BitStream
  • ReadIntFromSubstring() : SLNet::RakString
  • ReadIsLocked() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • ReadLine() : SLNet::Rackspace
  • ReadLock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • ReadNormQuat() : SLNet::BitStream
  • ReadNormVector() : SLNet::BitStream
  • readOffset : DataStructures::ByteQueue
  • ReadOrthMatrix() : SLNet::BitStream
  • ReadUnlock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • ReadVarFromBitstream() : SLNet::VariableListDeltaTracker
  • ReadVector() : SLNet::BitStream
  • ReadyEvent() : SLNet::ReadyEvent
  • ReadyEventNodeComp() : SLNet::ReadyEvent
  • readyEventNodeList : SLNet::ReadyEvent
  • Realloc() : SLNet::RakString
  • Reallocate() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ReallocateIfNeeded() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ReallocToSize() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ReassembleLine() : SLNet::TelnetTransport
  • RebootServer() : SLNet::Rackspace
  • RebuildServer() : SLNet::Rackspace
  • receipt : SLNet::RakPeer::BufferedCommandStruct
  • Receive()
: SLNet::RakPeerInterface
, SLNet::ReliabilityLayer
, SLNet::TCPInterface
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::TransportInterface
, SLNet::PacketizedTCP
, SLNet::RakPeer
  • ReceiveHasPackets() : SLNet::TCPInterface
  • ReceiveInt() : SLNet::TCPInterface
  • recentSum : SLNet::StatisticsHistory::TimeAndValueQueue
  • recentSumOfSquares : SLNet::StatisticsHistory::TimeAndValueQueue
  • recipient : SLNet::NatPunchthroughServer::ConnectionAttempt
  • Recv() : SLNet::RemoteClient
  • RecvFrom() : SLNet::UDPForwarder
  • RecvFromBlocking() : SLNet::RNS2_Berkley
  • RecvFromBlockingIPV4() : SLNet::RNS2_Berkley
  • RecvFromBlockingIPV4And6() : SLNet::RNS2_Berkley
  • RecvFromLoopInt() : SLNet::RNS2_Berkley
  • REF_COUNTED : SLNet::InternalPacket
  • refCount : SLNet::FileListTransfer::FileToPushRecipient , SLNet::InternalPacketRefCountedData , RefCountedObj , SLNet::RakString::SharedString , WSAStartupSingleton
  • refCountedData : SLNet::InternalPacket
  • RefCountedObj() : RefCountedObj
  • refCountMutex : SLNet::FileListTransfer::FileToPushRecipient , SLNet::RakString::SharedString
  • Reference() : SLNet::ReplicaManager3
  • referenceCount : SLNet::StringTable
  • ReferenceCounter() : SLNet::ReferenceCounter
  • referenceIndex : SLNet::Replica3
  • ReferenceInternal() : SLNet::ReplicaManager3
  • ReferenceRemoteSystem() : SLNet::RakPeer
  • ReferenceTeam() : SLNet::TM_World
  • ReferenceTeamMember() : SLNet::TM_World
  • RegisterBlockingFunction() : SLNet::RPC4
  • RegisterCommand() : SLNet::CommandParserInterface
  • registeredBlockingFunctions : SLNet::RPC4
  • registeredNonblockingFunctions : SLNet::RPC4
  • RegisterFunction() : SLNet::RPC4
  • RegisterLocalCallback() : SLNet::RPC4
  • RegisterSlot() : SLNet::RPC4
  • registrationCount : SLNet::RPC4::LocalSlotObject
  • RelayPlugin() : SLNet::RelayPlugin
  • Release()
: SLNet::CloudClient
, DataStructures::BytePool
, DataStructures::MemoryPool< MemoryBlockType >
, SLNet::ReferenceCounter
  • ReleaseKeys() : SLNet::CloudServer
  • ReleaseSockets()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • ReleaseSystem() : SLNet::CloudServer
  • reliability
: SLNet::InternalPacketFixedSizeTransmissionHeader
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::PRO
  • reliabilityLayer : SLNet::RakPeer::RemoteSystemStruct
  • ReliabilityLayer() : SLNet::ReliabilityLayer
  • reliableMessageNumber : SLNet::InternalPacketFixedSizeTransmissionHeader
  • ReloadMT() : SLNet::RakNetRandom
  • remainingServersToTry : SLNet::UDPProxyCoordinator::ForwardingRequest
  • RemoteClient() : SLNet::RemoteClient
  • remoteClients : SLNet::TCPInterface , SLNet::TelnetTransport
  • remoteClientsLength : SLNet::TCPInterface
  • remoteConnections : SLNet::ConnectionGraph2::RemoteSystem
  • remoteLoginPassword : SLNet::UDPProxyCoordinator
  • remotePath : SLNet::HTTPConnection::OutgoingCommand
  • remotePortRakNetWasStartedOn_PS3 : SLNet::RakPeer::BufferedCommandStruct
  • remotePortRakNetWasStartedOn_PS3_PS4_PSP2 : SLNet::RNS2_BerkleyBindParameters
  • remotePortRakNetWasStartedOn_PS3_PSP2 : SLNet::SocketDescriptor
  • RemoteServerComp() : SLNet::CloudServer
  • remoteServerPublicKey : SLNet::PublicKey
  • remoteServerResponses : SLNet::CloudServer::GetRequest
  • remoteServers : SLNet::CloudServer
  • remoteSystem : SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest , SLNet::TwoWayAuthentication::PendingChallenge
  • RemoteSystemComp() : SLNet::ConnectionGraph2
  • RemoteSystemCompByGuid() : SLNet::ReadyEvent
  • remoteSystemIndex : SLNet::RakPeer::RemoteSystemStruct
  • remoteSystemIndexPool : SLNet::RakPeer
  • remoteSystemList : SLNet::RakPeer
  • remoteSystemLookup : SLNet::RakPeer
  • RemoteSystemLookupHashIndex() : SLNet::RakPeer
  • remoteSystems : SLNet::CloudServer , SLNet::ConnectionGraph2
  • remoteSystemVariableHistoryList : SLNet::VariableDeltaSerializer
  • remoteUsers : SLNet::LogCommandParser
  • Remove() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > , DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • RemoveAllQueryFilters() : SLNet::CloudServer
  • RemoveAtIndex()
: DataStructures::Queue< queue_type >
, DataStructures::List< list_type >
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
  • RemoveAtIndexFast() : DataStructures::List< list_type >
  • RemoveAtKey() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • RemoveByGuid() : SLNet::TeamBalancer
  • RemoveCallback()
: SLNet::FileList
, SLNet::FileListTransfer
  • RemoveChannel() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • RemoveCharacter() : SLNet::RakString
  • RemoveColumn() : DataStructures::Table
  • RemoveCommandParser() : SLNet::ConsoleServer
  • RemoveConnection() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • RemoveConnectionRequest() : SLNet::Router2
  • RemoveEventCallback() : SLNet::Rackspace
  • RemoveFromActiveSystemList() : SLNet::RakPeer
  • RemoveFromAllLists() : SLNet::ReadyEvent
  • RemoveFromAllTeamsInternal() : SLNet::TM_TeamMember
  • RemoveFromBanList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • RemoveFromConnectionList() : SLNet::PacketizedTCP
  • RemoveFromEnd()
: DataStructures::List< list_type >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • RemoveFromFailureQueue() : SLNet::NatPunchthroughClient
  • RemoveFromList() : SLNet::FileListTransfer
  • RemoveFromRequestedTeams() : SLNet::TM_TeamMember
  • RemoveFromSecurityExceptionList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • RemoveFromSpecificTeamInternal() : SLNet::TM_TeamMember
  • RemoveFromTeamMemberList() : SLNet::TM_Team
  • RemoveFromTeamsRequestedAndAddTeam() : SLNet::TeamManager
  • RemoveFromWaitList() : SLNet::ReadyEvent
  • RemoveIfExists() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • RemoveInputAtIndex() : ThreadPool< InputType, OutputType >
  • removeLostConnections : SLNet::StatisticsHistoryPlugin
  • RemoveNode() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • RemoveObject() : SLNet::StatisticsHistory
  • RemoveObjectAtIndex() : SLNet::StatisticsHistory
  • RemoveOutputAtIndex() : ThreadPool< InputType, OutputType >
  • RemoveParticipant() : SLNet::TM_World
  • RemoveParticipantOnServer() : SLNet::RelayPlugin
  • RemoveParticipantRequestFromClient() : SLNet::RelayPlugin
  • RemovePendingRequest() : SLNet::HTTPConnection2
  • RemoveQueryFilter() : SLNet::CloudServer
  • RemoveReceiver() : SLNet::FileListTransfer
  • RemoveReference()
: SLNet::StringTable
, SLNet::StringCompressor
  • RemoveRemoteSystemVariableHistory() : SLNet::VariableDeltaSerializer
  • RemoveRow() : DataStructures::Table
  • RemoveRows() : DataStructures::Table
  • RemoveServer() : SLNet::CloudServer
  • RemoveSpecificSubscriber() : SLNet::CloudServer
  • RemoveSubscribedKeyFromServers() : SLNet::CloudServer
  • RemoveSubscriber() : SLNet::CloudServer::CloudDataList
  • RemoveTeamMember() : SLNet::TeamBalancer
  • RemoveUploadedKeyFromServers() : SLNet::CloudServer
  • RemoveWorld()
: SLNet::TeamManager
, SLNet::ReplicaManager3
  • Replace()
: DataStructures::List< list_type >
, SLNet::RakString
, DataStructures::List< list_type >
, DataStructures::CircularLinkedList< CircularLinkedListType >
  • REPLACE_KEY1_WITH_KEY2 : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • replica : SLNet::LastSerializationResult
  • Replica3() : SLNet::Replica3
  • Replica3LSRComp() : SLNet::Connection_RM3
  • replicaManager : SLNet::Replica3
  • ReplicaManager3() : SLNet::ReplicaManager3
  • replyFromTargetBroadcast : SLNet::RakPeer
  • replyFromTargetBS : SLNet::RakPeer
  • replyFromTargetPlayer : SLNet::RakPeer
  • REPORT_DIGIT : CSHA1
  • REPORT_HEX : CSHA1
  • REPORT_HEX_SHORT : CSHA1
  • REPORT_TYPE : CSHA1
  • ReportHash() : CSHA1
  • ReportHashStl() : CSHA1
  • REQUEST_STATE_REQUEST_FORWARDING : SLNet::Router2
  • RequestAnyTeam() : SLNet::TeamBalancer
  • requested : SLNet::TM_TeamMember::RequestedTeam
  • REQUESTED_CONNECTION : SLNet::RakPeer::RemoteSystemStruct
  • requestedCloseConnections : SLNet::TCPInterface
  • requestedConnectionList_Mutex : SLNet::RakPeer
  • requestedConnectionQueue : SLNet::RakPeer
  • requestedConnectionQueueMutex : SLNet::RakPeer
  • requestedTeam : SLNet::TeamBalancer::TeamMember , SLNet::TeamBalancer::MyTeamMembers
  • RequestForwarding()
: SLNet::UDPProxyClient
, SLNet::Router2
, SLNet::UDPProxyClient
  • requestId : SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest , SLNet::CloudServer::GetRequest
  • requestIndex : SLNet::TM_World::JoinRequestHelper , SLNet::TM_TeamMember::RequestedTeam
  • requestingAddress : SLNet::UDPProxyCoordinator::ForwardingRequest
  • requestingClient : SLNet::CloudServer::GetRequest
  • requestsMade : SLNet::RakPeer::RequestedConnectionStruct
  • RequestSpecificTeam() : SLNet::TeamBalancer
  • requestStartTime : SLNet::CloudServer::GetRequest
  • requestState : SLNet::Router2::ConnnectRequest
  • RequestTeam() : SLNet::TM_TeamMember
  • RequestTeamSwitch() : SLNet::TM_TeamMember
  • resendNext : SLNet::InternalPacket
  • resendPrev : SLNet::InternalPacket
  • Reset()
: CSHA1
, SLNet::RemoteClient
, SLNet::BitStream
, SLNet::ReliabilityLayer
, SLNet::HuffmanEncodingTreeFactory
, SLNet::BPSTracker
  • ResetReadPointer() : SLNet::BitStream
  • ResetSendReceipt() : SLNet::RakPeer
  • ResetWritePointer() : SLNet::BitStream
  • ResizeSampleSet() : SLNet::StatisticsHistory::TimeAndValueQueue
  • ResizeServer() : SLNet::Rackspace
  • ResponseCodes : SLNet::HTTPConnection
  • result : SLNet::UDPForwarder::StartForwardingOutputStruct , SLNet::DynDNS
  • resultDescription : SLNet::DynDNS
  • resultHandler : SLNet::UDPProxyServer , SLNet::UDPProxyClient
  • resultKeyIndices : SLNet::CloudQueryResult
  • Resume() : ThreadPool< InputType, OutputType >
  • retransmissionTime : SLNet::InternalPacket
  • retryCount : SLNet::NatPunchthroughClient::SendPing
  • retryOnFailure : SLNet::PunchthroughConfiguration
  • returnConnectionLostOnFailure : SLNet::Router2::ConnnectRequest , SLNet::Router2::ForwardedConnection
  • ReturnFailureOnCannotForward() : SLNet::Router2
  • ReturnOutgoingPacket() : SLNet::PacketizedTCP
  • ReturnResult() : SLNet::CommandParserInterface
  • ReturnToUser() : SLNet::Router2
  • ReverseBytes() : SLNet::BitStream
  • ReverseBytesInPlace() : SLNet::BitStream
  • ReverseList() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ReverseListInternal() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • RevertResizedServer() : SLNet::Rackspace
  • right : HuffmanEncodingTreeNode , DataStructures::BinarySearchTree< BinarySearchTreeType >::node
  • RIGHT : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • RightChild() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • RM3World() : SLNet::ReplicaManager3::RM3World
  • rnr : SLNet::RakNetRandomSync
  • RNS2_Berkley() : SLNet::RNS2_Berkley
  • RNS2_SendParameters() : SLNet::RNS2_SendParameters
  • RNS2EventHandler() : SLNet::RNS2EventHandler
  • rns2Socket : SLNet::RNS2_Berkley
  • roomName : SLNet::RelayPlugin::RP_Group
  • root : DataStructures::CircularLinkedList< CircularLinkedListType > , DataStructures::BPlusTree< KeyType, DataType, order >
  • ROOT : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • root : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • rootNode : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • RotateLeft() : DataStructures::BPlusTree< KeyType, DataType, order >
  • RotateRight() : DataStructures::BPlusTree< KeyType, DataType, order >
  • Router2() : SLNet::Router2
  • Router2DebugInterface() : SLNet::Router2DebugInterface
  • Router2RequestStates : SLNet::Router2
  • rows : DataStructures::Table
  • rowsReturned : SLNet::CloudQueryResult
  • RPC4() : SLNet::RPC4
  • RPC4GlobalRegistration() : SLNet::RPC4GlobalRegistration
  • runningTotal : SLNet::RakNetStatistics
  • runThreads : ThreadPool< InputType, OutputType >
  • runThreadsMutex : ThreadPool< InputType, OutputType >
  • RunUpdateCycle()
: SLNet::RakPeer
, SLNet::RakPeerInterface
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- s -

  • s1p2 : SLNet::NatTypeDetectionServer
  • s2p3 : SLNet::NatTypeDetectionServer
  • s3p4 : SLNet::NatTypeDetectionServer
  • s3p4Address : SLNet::NatTypeDetectionServer
  • s4p5 : SLNet::NatTypeDetectionServer
  • sata : SLNet::UDPProxyClient::PingServerGroup , SLNet::UDPProxyCoordinator::ForwardingRequest
  • SaveLastSearch() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • secondaryIndex : DataStructures::HashIndex
  • secondaryKey : SLNet::CloudKey
  • securityExceptionList : SLNet::RakPeer
  • securityExceptionMutex : SLNet::RakPeer
  • seed : SLNet::RakNetRandomSync
  • SeedMT()
: SLNet::RakNetRandomSync
, SLNet::RakNetRandom
, SLNet::RakNetRandomSync
  • Send()
: SLNet::TransportInterface
, SLNet::EmailSender
, SLNet::FileListTransfer
, SLNet::PacketizedTCP
, SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::ReliabilityLayer
, SLNet::RakNetSocket2
, SLNet::RNS2_Linux
, SLNet::TCPInterface
, SLNet::RemoteClient
, SLNet::TeamManager
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
  • SendAllBusy() : SLNet::UDPProxyCoordinator
  • SendBuffered() : SLNet::RakPeer
  • SendBufferedList() : SLNet::RakPeer
  • SendChatRoomsList() : SLNet::RelayPlugin
  • SendCommandList() : SLNet::CommandParserInterface
  • sendConnectionAttemptCount : SLNet::RakPeer::RequestedConnectionStruct
  • SendConnectionRequest() : SLNet::RakPeer
  • SendConstruction() : SLNet::Connection_RM3
  • sender : SLNet::NatPunchthroughServer::ConnectionAttempt
  • senderClientAddress : SLNet::UDPProxyClient::SenderAndTargetAddress , SLNet::UDPProxyCoordinator::SenderAndTargetAddress
  • senderClientGuid : SLNet::UDPProxyCoordinator::SenderAndTargetAddress
  • senderGuid
: SLNet::FileListTransferCBInterface::OnFileStruct
, SLNet::FileListTransferCBInterface::FileProgressStruct
, SLNet::FileListTransferCBInterface::DownloadCompleteStruct
  • sendersPingToThatSystem : SLNet::ConnectionGraph2::SystemAddressAndGuid
  • senderSystemAddress
: SLNet::FileListTransferCBInterface::OnFileStruct
, SLNet::FileListTransferCBInterface::FileProgressStruct
, SLNet::FileListTransferCBInterface::DownloadCompleteStruct
  • SendFailureOnCannotForward() : SLNet::Router2
  • SendForwardingRequest() : SLNet::UDPProxyCoordinator
  • SendForwardingSuccess() : SLNet::Router2
  • SendGroupMessage() : SLNet::RelayPlugin
  • SendHelp()
: SLNet::RakNetCommandParser
, SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • SendImmediate() : SLNet::RakPeer
  • SendIRIToAddress() : SLNet::FileListTransfer
  • SendIRIToAddressCB : SLNet::FileListTransfer
  • SendList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::TCPInterface
, SLNet::PacketizedTCP
  • SendListUnified() : SLNet::PluginInterface2
  • SendLoopback()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SendMessageToRoom() : SLNet::RelayPlugin
  • SendNextPendingRequest() : SLNet::HTTPConnection2
  • SendOOBFromRakNetPort() : SLNet::Router2
  • SendOOBFromSpecifiedSocket() : SLNet::Router2
  • SendOOBMessages() : SLNet::Router2
  • SendOrBuffer() : SLNet::RemoteClient
  • SendOutOfBand()
: SLNet::NatPunchthroughClient
, SLNet::RakPeer
, SLNet::RakPeerInterface
  • SendPendingRequestToConnectedSystem() : SLNet::HTTPConnection2
  • SendPingedServersToCoordinator() : SLNet::UDPProxyClient::PingServerGroup
  • sendPrefix : SLNet::TelnetTransport
  • SendPunchthrough() : SLNet::NatPunchthroughClient
  • SendQueuedOpenNAT() : SLNet::NatPunchthroughClient
  • SendReadyStateQuery() : SLNet::ReadyEvent
  • SendReadyUpdate() : SLNet::ReadyEvent
  • sendReceipt
: SLNet::PRO
, SLNet::VariableDeltaSerializer::SerializationContext
, SLNet::VariableDeltaSerializer::ChangedVariablesList
  • sendReceiptSerial : SLNet::InternalPacket , SLNet::RakPeer
  • sendReceiptSerialMutex : SLNet::RakPeer
  • SendRequest() : SLNet::HTTPConnection2
  • SendSerialize() : SLNet::Connection_RM3
  • SendSerializeHeader() : SLNet::Connection_RM3
  • SendSerializeIfChanged() : SLNet::Connection_RM3
  • SendSubscribedKeyToServers() : SLNet::CloudServer
  • sendSuffix : SLNet::TelnetTransport
  • SendTimestamps() : SLNet::NatPunchthroughServer
  • SendToParticipant() : SLNet::RelayPlugin
  • SendTTL()
: SLNet::NatPunchthroughClient
, SLNet::RakPeer
, SLNet::RakPeerInterface
  • SendUnified() : SLNet::PluginInterface2
  • SendUploadedAndSubscribedKeysToServer() : SLNet::CloudServer
  • SendUploadedKeyToServers() : SLNet::CloudServer
  • SendValidation() : SLNet::Connection_RM3
  • sentHash : SLNet::TwoWayAuthentication::PendingChallenge
  • sentRequests : SLNet::HTTPConnection2
  • sentRequestsMutex : SLNet::HTTPConnection2
  • sentTTL : SLNet::NatPunchthroughClient::SendPing
  • sequencingIndex : SLNet::InternalPacketFixedSizeTransmissionHeader
  • serializationBitstream : SLNet::DeserializeParameters
  • SerializationContext() : SLNet::VariableDeltaSerializer::SerializationContext
  • serializationMode : SLNet::VariableDeltaSerializer::SerializationContext
  • Serialize()
: SLNet::RakString
, SLNet::RakWString
, SLNet::BitStream
, SLNet::CloudKey
, SLNet::CloudQuery
, SLNet::CloudQueryRow
, SLNet::CloudQueryResult
, SLNet::CloudServer::CloudQueryWithAddresses
, DataStructures::RangeList< range_type >
, SLNet::FileList
, SLNet::RakNetRandomSync
, SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • SerializeBits() : SLNet::BitStream
  • SerializeBitsFromIntegerRange() : SLNet::BitStream
  • SerializeCasted() : SLNet::BitStream
  • SerializeCell() : SLNet::TableSerializer
  • SerializeCloudQueryRows() : SLNet::CloudQueryResult
  • SerializeColumns() : SLNet::TableSerializer
  • SerializeCompressed()
: SLNet::BitStream
, SLNet::RakString
  • SerializeCompressedDelta() : SLNet::BitStream
  • SerializeConstruction()
: SLNet::RakNetRandomSync
, SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
, SLNet::TM_TeamMember
, SLNet::TM_Team
  • SerializeConstructionExisting()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • SerializeDelta() : SLNet::BitStream
  • SerializeDestruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • SerializeFilterQuery() : SLNet::TableSerializer
  • SerializeFilterQueryList() : SLNet::TableSerializer
  • SerializeFloat16() : SLNet::BitStream
  • SerializeHeader() : SLNet::CloudQueryResult
  • SerializeNormQuat() : SLNet::BitStream
  • SerializeNormVector() : SLNet::BitStream
  • SerializeNumRows() : SLNet::CloudQueryResult
  • SerializeOnDownloadComplete() : SLNet::Connection_RM3
  • SerializeOnDownloadStarted() : SLNet::Connection_RM3
  • SerializeOrthMatrix() : SLNet::BitStream
  • SerializeRow() : SLNet::TableSerializer
  • SerializeTable() : SLNet::TableSerializer
  • SerializeVariable() : SLNet::VariableDeltaSerializer
  • SerializeVector() : SLNet::BitStream
  • serverAddress
: SLNet::CloudServer::RemoteServer
, SLNet::CloudServer::BufferedGetResponseFromServer
, SLNet::DynDNS
, SLNet::NatTypeDetectionClient
, SLNet::UDPProxyClient::ServerWithPing
, SLNet::UDPProxyCoordinator::ServerWithPing
  • serverGUID : SLNet::CloudQueryRow , SLNet::CloudServer::CloudData
  • serverList : SLNet::UDPProxyCoordinator
  • serverManagementDomain : SLNet::Rackspace
  • serverManagementPath : SLNet::Rackspace
  • serverManagementURL : SLNet::Rackspace
  • serverPublicIp : SLNet::UDPProxyServer
  • serverSelectionBitstream : SLNet::UDPProxyCoordinator::ForwardingRequest
  • serversToPing : SLNet::UDPProxyClient::PingServerGroup
  • serverSystemAddress : SLNet::CloudQueryRow , SLNet::CloudServer::CloudData
  • ServerWithPingComp() : SLNet::UDPProxyCoordinator
  • sessionId
: SLNet::NatPunchthroughClient::SendPing
, SLNet::NatPunchthroughServer::ConnectionAttempt
, SLNet::NatPunchthroughServer
  • Set()
: DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::Table::Cell
, SLNet::RakString
, SLNet::RakWString
  • SET_BRANCH_KEY : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • SetAcceptAddParticipantRequests() : SLNet::RelayPlugin
  • SetActionOnDisallowedMessage() : SLNet::MessageFilter
  • SetActive() : SLNet::RemoteClient
  • SetAllowMessageID() : SLNet::MessageFilter
  • SetAllowRPC4() : SLNet::MessageFilter
  • SetApplicationDirectory() : SLNet::DirectoryDeltaTransfer
  • SetAutoAddNewConnectionsToFilter() : SLNet::MessageFilter
  • SetAutoManageConnections()
: SLNet::ReplicaManager3
, SLNet::TM_World
, SLNet::TeamManager
  • SetAutoProcessNewConnections() : SLNet::ConnectionGraph2
  • SetAutoSerializeInterval() : SLNet::ReplicaManager3
  • SetBalanceTeams() : SLNet::TM_World
  • SetBinaryAddress() : SLNet::SystemAddress
  • setBroadcast : SLNet::RNS2_BerkleyBindParameters
  • SetBroadcastSocket() : SLNet::RNS2_Berkley
  • SetByType() : DataStructures::Table::Cell
  • SetCallCount() : SLNet::RakNetRandomSync
  • SetChar() : SLNet::RakString
  • SetCompleted() : SLNet::DynDNS
  • SetCompositeOwner() : SLNet::Replica3Composite< parent_type >
  • SetData() : SLNet::BitStream
  • SetDebugInterface()
: SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::Router2
  • SetDefaultAssignmentAlgorithm() : SLNet::TeamBalancer
  • SetDefaultCallbacks() : SLNet::CloudClient
  • SetDefaultOrderingChannel() : SLNet::ReplicaManager3
  • SetDefaultPacketPriority() : SLNet::ReplicaManager3
  • SetDefaultPacketReliability() : SLNet::ReplicaManager3
  • SetDefaultTimeToTrack() : SLNet::StatisticsHistory
  • SetDisallowedMessageCallback() : SLNet::MessageFilter
  • SetDoNotFragment() : SLNet::RNS2_Berkley
  • SetDownloadRequestIncrementalReadInterface() : SLNet::DirectoryDeltaTransfer
  • SetEvent()
: SLNet::ReadyEvent
, SLNet::SignaledEvent
  • SetEventByIndex() : SLNet::ReadyEvent
  • SetExisting() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • SetFileListTransferPlugin() : SLNet::DirectoryDeltaTransfer
  • SetFilterMaxTime() : SLNet::MessageFilter
  • SetForceEvenTeams() : SLNet::TeamBalancer
  • SetHost() : SLNet::TM_World
  • setID : SLNet::FileListTransferCBInterface::OnFileStruct , SLNet::FileListTransferCBInterface::DownloadCompleteStruct
  • setId
: SLNet::FileListTransfer
, SLNet::FileListTransfer::FileToPushRecipient
, SLNet::FileListTransfer::ThreadData
  • SetIncomingDatagramEventHandler()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetIncomingPassword()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • setIndex : SLNet::FileListTransfer::FileToPush
  • SetInternalID()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetInvalid() : DataStructures::HashIndex
  • SetIPHdrIncl() : SLNet::RNS2_Berkley
  • setIPHdrIncl : SLNet::RNS2_BerkleyBindParameters
  • SetJoinPermissions() : SLNet::TM_Team
  • SetLimitIPConnectionFrequency()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetLockTeams() : SLNet::TeamBalancer
  • SetLogCommandParser() : SLNet::PacketConsoleLogger
  • SetLogDirectMessages() : SLNet::PacketLogger
  • SetMaxBytesPerDownload() : SLNet::CloudServer
  • SetMaxForwardEntries() : SLNet::UDPForwarder
  • SetMaximumForwardingRequests() : SLNet::Router2
  • SetMaximumIncomingConnections()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetMaxUploadBytesPerClient() : SLNet::CloudServer
  • SetMemberLimit() : SLNet::TM_Team
  • SetMTU() : SLNet::CCRakNetSlidingWindow
  • SetMultilistType() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • SetNetworkID() : SLNet::NetworkIDObject
  • SetNetworkIDManager()
: SLNet::NetworkIDObject
, SLNet::ReplicaManager3
  • SetNew() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • SetNonBlockingSocket() : SLNet::RNS2_Berkley
  • SetNull() : SLNet::RakNetSmartPtr< T >
  • SetNumberOfBitsAllocated() : SLNet::BitStream
  • SetOccasionalPing()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetOfflinePingResponse()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetOwner()
: SLNet::TM_TeamMember
, SLNet::TM_Team
  • SetPageSize()
: DataStructures::BytePool
, DataStructures::MemoryPool< MemoryBlockType >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
  • SetParent() : SLNet::NetworkIDObject
  • SetPerConnectionOutgoingBandwidthLimit()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetPoolPageSize() : DataStructures::BPlusTree< KeyType, DataType, order >
  • SetPortHostOrder() : SLNet::SystemAddress
  • SetPortNetworkOrder() : SLNet::SystemAddress
  • SetPrefix() : SLNet::PacketLogger
  • SetPrintAcks() : SLNet::PacketLogger
  • SetPrintID() : SLNet::PacketLogger
  • SetPrompt() : SLNet::ConsoleServer
  • SetPtr() : DataStructures::Table::Cell
  • SetRakPeerInterface()
: SLNet::RakNetCommandParser
, SLNet::PluginInterface2
  • SetReadOffset() : SLNet::BitStream
  • SetRecvEventHandler() : SLNet::RakNetSocket2
  • SetRemoteLoginPassword() : SLNet::UDPProxyCoordinator
  • SetResultHandler()
: SLNet::UDPProxyClient
, SLNet::UDPProxyServer
  • SetSendChannel() : SLNet::ReadyEvent
  • SetSendPrefix() : SLNet::TelnetTransport
  • SetSendSuffix() : SLNet::TelnetTransport
  • SetServerPublicIP() : SLNet::UDPProxyServer
  • SetSocketFamily()
: SLNet::Router2
, SLNet::UDPProxyServer
  • SetSocketOptions()
: SLNet::SocketLayer
, SLNet::RNS2_Berkley
  • SetSocketType() : SLNet::RakNetSocket2
  • SetSortOrder() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • SetSplitMessageProgressInterval()
: SLNet::RakPeerInterface
, SLNet::RakPeer
, SLNet::ReliabilityLayer
  • SetSuffix() : SLNet::PacketLogger
  • SetSystemFilterSet() : SLNet::MessageFilter
  • SetTCPInterface() : SLNet::PluginInterface2
  • SetTeamSizeLimit() : SLNet::TeamBalancer
  • SetThreadDataInterface() : ThreadPool< InputType, OutputType >
  • SetTimeoutCallback() : SLNet::MessageFilter
  • SetTimeoutTime()
: SLNet::RakPeerInterface
, SLNet::ReliabilityLayer
, SLNet::RakPeer
  • SetTimeToTrackValues() : SLNet::StatisticsHistory::TimeAndValueQueue
  • SetToLoopback() : SLNet::SystemAddress
  • SetTopology() : SLNet::TeamManager
  • SetTrackConnections() : SLNet::StatisticsHistoryPlugin
  • SetTransportProvider() : SLNet::ConsoleServer
  • SetUndefined() : SLNet::AddressOrGUID
  • SetUnreliableTimeout()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::ReliabilityLayer
  • SetupBufferedPackets() : SLNet::RakPeer
  • SetUploadSendParameters() : SLNet::DirectoryDeltaTransfer
  • SetupReceive() : SLNet::FileListTransfer
  • SetUserConnectionSocketIndex() : SLNet::RakNetSocket2
  • SetUserUpdateThread()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetWriteOffset() : SLNet::BitStream
  • SH_DO_NOT_SORT : SLNet::StatisticsHistory
  • SH_INVALID_PARAMETER : SLNet::StatisticsHistory
  • SH_OK : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_AVERAGE_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_AVERAGE_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_HIGHEST_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_HIGHEST_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_LOWEST_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_LOWEST_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_SUM_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_SUM_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_AVERAGE_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_AVERAGE_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_HIGHEST_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_HIGHEST_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_LOWEST_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_LOWEST_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_SUM_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_SUM_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_SUM_OF_SQUARES_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_SUM_OF_SQUARES_DESCENDING : SLNet::StatisticsHistory
  • SH_UKNOWN_KEY : SLNet::StatisticsHistory
  • SH_UKNOWN_OBJECT : SLNet::StatisticsHistory
  • sharedDataBlock : SLNet::InternalPacketRefCountedData
  • sharedString : SLNet::RakString
  • ShareServerAddress() : SLNet::Rackspace
  • SHDataCategory : SLNet::StatisticsHistory
  • SHErrorCode : SLNet::StatisticsHistory
  • ShiftIncomingTimestamp() : SLNet::RakPeer
  • ShiftKeysLeft() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ShiftNodeLeft() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ShiftNodeRight() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ShouldSendACKs() : SLNet::CCRakNetSlidingWindow
  • ShowDiagnostic() : SLNet::Router2DebugInterface
  • ShowFailure() : SLNet::Router2DebugInterface
  • ShowPrompt() : SLNet::ConsoleServer
  • SHSortOperation : SLNet::StatisticsHistory
  • Shutdown()
: SLNet::RakPeerInterface
, SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::RakPeer
, SLNet::UDPForwarder
  • Signal() : SLNet::RPC4
  • signalDeletion : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight
  • SignaledEvent() : SLNet::SignaledEvent
  • SignalStopRecvPollingThread() : SLNet::RNS2_Berkley
  • SimpleMutex() : SLNet::SimpleMutex
  • SingleProducerConsumer() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • Size()
: DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::CircularLinkedList< CircularLinkedListType >
  • size() : SLNet::RakNetGUID
  • Size() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • size : DataStructures::Page< KeyType, DataType, order >
  • Size() : DataStructures::RangeList< range_type >
  • size : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • Size() : DataStructures::BPlusTree< KeyType, DataType, order > , DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > , DataStructures::Heap< weight_type, data_type, isMaxHeap > , DataStructures::List< list_type >
  • size() : SLNet::SystemAddress
  • Size()
: DataStructures::Queue< queue_type >
, DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
, DataStructures::QueueLinkedList< QueueType >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • Skip() : SLNet::RakNetRandomSync
  • slotObjects : SLNet::RPC4::LocalSlot
  • SMALLEST_TEAM : SLNet::TeamBalancer
  • smallString : SLNet::RakString::SharedString
  • socket
: SLNet::UDPForwarder::ForwardEntry
, SLNet::RNS2RecvStruct
, SLNet::RakPeer::RequestedConnectionStruct
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::RemoteClient
  • SocketConnect() : SLNet::TCPInterface
  • SocketDescriptor() : SLNet::SocketDescriptor
  • socketFamily
: SLNet::Router2
, SLNet::UDPForwarder::StartForwardingInputStruct
, SLNet::UDPProxyServer
, SLNet::SocketDescriptor
, SLNet::TCPInterface::ThisPtrPlusSysAddr
, SLNet::UDPForwarder::ForwardEntry
  • socketIndex : SLNet::RakPeer::RequestedConnectionStruct
  • SocketLayer() : SLNet::SocketLayer
  • socketList : SLNet::RakPeer
  • SocketQueryOutput() : SLNet::RakPeer::SocketQueryOutput
  • socketQueryOutput : SLNet::RakPeer
  • sockets : SLNet::RakPeer::SocketQueryOutput
  • socketType : SLNet::RakNetSocket2
  • Sort() : DataStructures::CircularLinkedList< CircularLinkedListType > , DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • SortQueryType : DataStructures::Table
  • sortState : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • SortTable() : DataStructures::Table
  • sortValue : SLNet::StatisticsHistory::TimeAndValueQueue
  • source : SLNet::UDPForwarder::StopForwardingStruct , SLNet::UDPForwarder::StartForwardingInputStruct
  • sourceAddress : SLNet::Router2::MiniPunchRequest
  • sourceConnection : SLNet::DeserializeParameters
  • sourceGuid : SLNet::Router2::MiniPunchRequest
  • sourceServerPings : SLNet::UDPProxyCoordinator::ForwardingRequest
  • sp : SLNet::NatPunchthroughClient
  • specificSubscribers : SLNet::CloudServer::CloudData
  • specificSystems : SLNet::CloudServer::CloudQueryWithAddresses
  • specificSystemsSubscribedTo : SLNet::CloudServer::KeySubscriberID
  • SpecificTeam() : SLNet::TeamSelection
  • speedUpThisBlock : SLNet::CCRakNetSlidingWindow
  • splitMessageProgressInterval : SLNet::RakPeer
  • splitPacketCount : SLNet::InternalPacketFixedSizeTransmissionHeader
  • splitPacketId : SLNet::InternalPacketFixedSizeTransmissionHeader
  • splitPacketIndex : SLNet::InternalPacketFixedSizeTransmissionHeader
  • splitPacketList : SLNet::SplitPacketChannel
  • SplitURI() : SLNet::RakString
  • SQLEscape() : SLNet::RakString
  • ssThresh : SLNet::CCRakNetSlidingWindow
  • STACK : SLNet::InternalPacket
  • stackData : SLNet::CloudServer::CloudData , SLNet::InternalPacket
  • Start()
: SLNet::RakNetTransport2
, SLNet::TransportInterface
, SLNet::TCPInterface
, SLNet::TelnetTransport
  • StartAfterFirstCharacter() : SLNet::RakString
  • StartAfterLastCharacter() : SLNet::RakString
  • StartForwarding() : SLNet::UDPForwarder
  • startForwardingInput : SLNet::UDPForwarder
  • startForwardingOutput : SLNet::UDPForwarder
  • startForwardingOutputMutex : SLNet::UDPForwarder
  • StartIncrementalReadThreads() : SLNet::FileListTransfer
  • startingOffset : SLNet::NetworkIDManager
  • startingRowIndex : SLNet::CloudQuery
  • StartLog() : SLNet::PacketFileLogger
  • StartPendingPunchthrough() : SLNet::NatPunchthroughServer
  • startPingTime : SLNet::UDPProxyClient::PingServerGroup
  • StartPunchthroughForUser() : SLNet::NatPunchthroughServer
  • StartSeries() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • StartThreads() : ThreadPool< InputType, OutputType >
  • startTime : SLNet::NatPunchthroughServer::ConnectionAttempt
  • Startup()
: SLNet::RakPeerInterface
, SLNet::NatTypeDetectionServer
, SLNet::UDPForwarder
, SLNet::RakPeer
  • StartVariableHistoryWrite() : SLNet::VariableDeltaSerializer
  • StartWrite() : SLNet::VariableListDeltaTracker
  • state : SLNet::RakNetRandom
  • STATE_DONE : SLNet::NatTypeDetectionServer
  • STATE_NONE : SLNet::NatTypeDetectionServer
  • STATE_TESTING_ADDRESS_RESTRICTED_1 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_ADDRESS_RESTRICTED_2 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_FULL_CONE_1 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_FULL_CONE_2 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_NONE_1 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_NONE_2 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_PORT_RESTRICTED_1 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_PORT_RESTRICTED_2 : SLNet::NatTypeDetectionServer
  • statistics : SLNet::StatisticsHistoryPlugin
  • StatisticsHistory() : SLNet::StatisticsHistory
  • StatisticsHistoryPlugin() : SLNet::StatisticsHistoryPlugin
  • Stop()
: SLNet::TCPInterface
, SLNet::PacketizedTCP
, SLNet::TelnetTransport
, SLNet::DynDNS
, SLNet::TransportInterface
, SLNet::RakNetTransport2
  • StopForwarding() : SLNet::UDPForwarder
  • stopForwardingCommands : SLNet::UDPForwarder
  • StopThreads() : ThreadPool< InputType, OutputType >
  • StopTrackingNetworkIDObject() : SLNet::NetworkIDManager
  • storageDomain : SLNet::Rackspace
  • storagePath : SLNet::Rackspace
  • storageToken : SLNet::Rackspace
  • storageURL : SLNet::Rackspace
  • StoreChangedVariablesList() : SLNet::VariableDeltaSerializer
  • StoreLastTeams() : SLNet::TM_TeamMember
  • str : StrAndBool , SLNet::RelayPlugin::StrAndGuidAndRoom , SLNet::RelayPlugin::StrAndGuid
  • StrCmp()
: SLNet::RakString
, SLNet::RakWString
  • StrICmp()
: SLNet::RakWString
, SLNet::RakString
  • strIndex : VariadicSQLParser::IndexAndType
  • STRING : DataStructures::Table
  • string : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node
  • StringCompressor() : SLNet::StringCompressor
  • stringReceived : SLNet::HTTPConnection2::Request
  • StringTable() : SLNet::StringTable
  • stringToTransmit : SLNet::HTTPConnection2::Request
  • StrNCmp() : SLNet::RakString
  • strToGuidHash : SLNet::RelayPlugin
  • Subscribe() : SLNet::LogCommandParser
  • subscribedKeys : SLNet::CloudServer::RemoteCloudClient , SLNet::CloudServer::RemoteServer
  • subscriberCount : SLNet::CloudServer::CloudDataList
  • subscribeToResults : SLNet::CloudQuery , SLNet::CloudQueryResult
  • SubStr() : SLNet::RakString
  • suffix : SLNet::PacketLogger
  • sum : CheckSum
  • Swap() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • SwapTeamMembersByRequest() : SLNet::TeamBalancer
  • SwitchMemberTeam() : SLNet::TeamBalancer
  • SwitchSpecificTeamCheck() : SLNet::TM_TeamMember
  • systemAddress : SLNet::FileListTransfer::ThreadData , SLNet::LogCommandParser::SystemAddressAndChannel
  • SystemAddress() : SLNet::SystemAddress
  • systemAddress
: SLNet::RemoteClient
, SLNet::TCPInterface::ThisPtrPlusSysAddr
, SLNet::NatPunchthroughServer::User
, SLNet::Connection_RM3
  • SystemAddress() : SLNet::SystemAddress
  • systemAddress : SLNet::NatTypeDetectionServer::NATDetectionAttempt , SLNet::RNS2_SendParameters
  • SystemAddress() : SLNet::SystemAddress
  • systemAddress
: SLNet::Packet
, SLNet::RNS2RecvStruct
, SLNet::TelnetTransport::TelnetClient
, SLNet::AddressOrGUID
, SLNet::FileListTransfer::FileToPushRecipient
, SLNet::RakPeer::RemoteSystemStruct
, SLNet::ConnectionGraph2::SystemAddressAndGuid
, SLNet::RakPeer::RequestedConnectionStruct
  • SystemAddressAndGuidComp() : SLNet::ConnectionGraph2
  • systemIdentifier : SLNet::RakPeer::BufferedCommandStruct
  • systemIndex : SLNet::RakNetGUID , SLNet::SystemAddress
  • systemList : SLNet::ReadyEvent::ReadyEventNode , SLNet::MessageFilter
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- t -

  • Table() : DataStructures::Table
  • TagSorted() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • tailPush : SLNet::TCPInterface
  • targetAddress : SLNet::NatPunchthroughClient::SendPing
  • targetClientAddress : SLNet::UDPProxyClient::SenderAndTargetAddress , SLNet::UDPProxyCoordinator::SenderAndTargetAddress
  • targetClientGuid : SLNet::UDPProxyCoordinator::SenderAndTargetAddress
  • targetGuid : SLNet::NatPunchthroughClient::SendPing
  • targetServerPings : SLNet::UDPProxyCoordinator::ForwardingRequest
  • tcp : SLNet::DynDNS
  • TCPInterface() : SLNet::TCPInterface
  • tcpInterface
: SLNet::PluginInterface2
, SLNet::Rackspace
, SLNet::TCPInterface::ThisPtrPlusSysAddr
, SLNet::TelnetTransport
  • tdiContext : ThreadPool< InputType, OutputType >
  • TeamBalancer() : SLNet::TeamBalancer
  • teamLimits : SLNet::TeamBalancer
  • teamManager : SLNet::TM_World
  • TeamManager() : SLNet::TeamManager
  • teamMemberCounts : SLNet::TeamBalancer
  • teamMemberIndex : SLNet::TM_World::JoinRequestHelper
  • teamMemberLimit : SLNet::TM_Team
  • teamMembers
: SLNet::TeamBalancer
, SLNet::TM_Team
, SLNet::TM_World
  • teamMembersHash : SLNet::TM_World
  • teamParameter : SLNet::TeamSelection
  • teamRequestIndex : SLNet::TM_World
  • teams : SLNet::TM_TeamMember , SLNet::TM_World
  • TeamSelection() : SLNet::TeamSelection
  • teamsHash : SLNet::TM_World
  • teamsRequested : SLNet::TM_TeamMember
  • TeamsWouldBeEvenOnSwitch() : SLNet::TeamBalancer
  • teamToLeave : SLNet::TM_TeamMember::RequestedTeam
  • TeamWouldBeOverpopulatedOnAddition() : SLNet::TeamBalancer
  • TeamWouldBeUnderpopulatedOnLeave() : SLNet::TeamBalancer
  • TelnetTransport() : SLNet::TelnetTransport
  • TerminateAtFirstCharacter() : SLNet::RakString
  • TerminateAtLastCharacter() : SLNet::RakString
  • TESTING_EXTERNAL_IPS_1024_TO_1024 : SLNet::NatPunchthroughClient::SendPing
  • TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT : SLNet::NatPunchthroughClient::SendPing
  • TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024 : SLNet::NatPunchthroughClient::SendPing
  • TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT : SLNet::NatPunchthroughClient::SendPing
  • TESTING_INTERNAL_IPS : SLNet::NatPunchthroughClient::SendPing
  • testMode : SLNet::NatPunchthroughClient::SendPing
  • TestMode : SLNet::NatPunchthroughClient::SendPing
  • textInput : SLNet::TelnetTransport::TelnetClient
  • theirInternalSystemAddress : SLNet::RakPeer::RemoteSystemStruct
  • thisChunkSize : SLNet::HTTPConnection2::Request
  • ThreadDataInterface() : ThreadDataInterface
  • threadDataInterface : ThreadPool< InputType, OutputType >
  • threadPool : SLNet::FileListTransfer
  • ThreadPool() : ThreadPool< InputType, OutputType >
  • threadPriority : SLNet::TCPInterface
  • threadRunning : SLNet::TCPInterface , SLNet::UDPForwarder
  • ThreadsafePacketLogger() : SLNet::ThreadsafePacketLogger
  • time
: SLNet::StatisticsHistory::TimeAndValue
, SLNet::TwoWayAuthentication::PendingChallenge
, SLNet::BPSTracker::TimeAndValue2
  • TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL : SLNet::PunchthroughConfiguration
  • TIME_BETWEEN_PUNCH_ATTEMPTS_INTERNAL : SLNet::PunchthroughConfiguration
  • TimeAndValue2() : SLNet::BPSTracker::TimeAndValue2
  • TimeAndValueQueue() : SLNet::StatisticsHistory::TimeAndValueQueue
  • timeBetweenAttempts : SLNet::NatTypeDetectionServer::NATDetectionAttempt
  • timeBetweenSendConnectionAttemptsMS : SLNet::RakPeer::RequestedConnectionStruct
  • timeEnteredThisSet : SLNet::FilteredSystem
  • timeExceedBanTimeMS : SLNet::FilterSet
  • timeLastDatagramForwarded : SLNet::UDPForwarder::ForwardEntry
  • timeout : SLNet::RakPeer::BanStruct , SLNet::Router2::MiniPunchRequest
  • timeoutAfterSuccess : SLNet::UDPProxyCoordinator::ForwardingRequest
  • timeoutCallback : SLNet::FilterSet
  • timeoutOnNoDataMS
: SLNet::UDPForwarder::ForwardEntry
, SLNet::UDPForwarder::StartForwardingInputStruct
, SLNet::UDPProxyCoordinator::ForwardingRequest
  • timeoutTime : SLNet::RakPeer::RequestedConnectionStruct
  • timeoutUserData : SLNet::FilterSet
  • timeRead : SLNet::RNS2RecvStruct
  • timeRequestedPings : SLNet::UDPProxyCoordinator::ForwardingRequest
  • timesSent : SLNet::InternalPacket
  • timeStamp : SLNet::DeserializeParameters
  • timeToTrack : SLNet::StatisticsHistory
  • timeToTrackValues : SLNet::StatisticsHistory::TimeAndValueQueue
  • TM_Team() : SLNet::TM_Team
  • TM_TeamMember() : SLNet::TM_TeamMember
  • TM_World() : SLNet::TM_World
  • ToInteger()
: SLNet::RakString
, SLNet::SystemAddress
, SLNet::AddressOrGUID
, SLNet::RakWString
  • ToLower() : SLNet::RakString
  • topology : SLNet::TeamManager
  • ToString()
: SLNet::AddressOrGUID
, SLNet::RakNetGUID
, SLNet::SystemAddress
, SLNet::RakString
, DataStructures::Table::Cell
, SLNet::SystemAddress
, SLNet::RakString
, SLNet::RakNetGUID
, SLNet::AddressOrGUID
, SLNet::SystemAddress
  • ToString_Old() : SLNet::SystemAddress
  • total1 : SLNet::BPSTracker
  • ToUint32()
: SLNet::TM_Team
, SLNet::RakNetGUID
, SLNet::TM_TeamMember
  • ToUpper() : SLNet::RakString
  • TrackedObject() : SLNet::StatisticsHistory::TrackedObject
  • TrackedObjectComp() : SLNet::StatisticsHistory
  • trackedObjectData : SLNet::StatisticsHistory::TrackedObject
  • TrackedObjectData() : SLNet::StatisticsHistory::TrackedObjectData
  • trackFrequencyTable : SLNet::RakPeer
  • TrackNetworkIDObject() : SLNet::NetworkIDManager
  • trans : SLNet::LogCommandParser
  • TransmitRequest() : SLNet::HTTPConnection2
  • transport : SLNet::ConsoleServer
  • TransportInterface() : SLNet::TransportInterface
  • Tree() : DataStructures::Tree< TreeType >
  • Truncate() : SLNet::RakString
  • TruncateUTF8() : SLNet::RakString
  • TryNextServer() : SLNet::UDPProxyCoordinator
  • ttl : SLNet::RNS2_SendParameters
  • TwoWayAuthentication() : SLNet::TwoWayAuthentication
  • type : SLNet::Rackspace::RackspaceOperation , SLNet::RNS2_BerkleyBindParameters
  • typeMappingIndex : VariadicSQLParser::IndexAndType
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- u -

  • UDP_SENDS_PER_PORT_EXTERNAL : SLNet::PunchthroughConfiguration
  • UDP_SENDS_PER_PORT_INTERNAL : SLNet::PunchthroughConfiguration
  • udpForwarder : SLNet::UDPProxyServer
  • UDPForwarder() : SLNet::UDPForwarder
  • udpForwarder : SLNet::Router2
  • UDPProxyClient() : SLNet::UDPProxyClient
  • UDPProxyClientResultHandler() : SLNet::UDPProxyClientResultHandler
  • UDPProxyCoordinator() : SLNet::UDPProxyCoordinator
  • UDPProxyServer() : SLNet::UDPProxyServer
  • UDPProxyServerResultHandler() : SLNet::UDPProxyServerResultHandler
  • uint24_t() : SLNet::uint24_t
  • unavailablePages : DataStructures::MemoryPool< MemoryBlockType >
  • unavailablePagesSize : DataStructures::MemoryPool< MemoryBlockType >
  • union : SLNet::SystemAddress
  • UNKNOWN_PORT_STRIDE : SLNet::NatPunchthroughClient
  • Unlock() : SLNet::SimpleMutex
  • UnlockInput() : ThreadPool< InputType, OutputType >
  • UnlockMutex() : SLNet::RakString
  • UnlockOutput() : ThreadPool< InputType, OutputType >
  • UnregisterBlockingFunction() : SLNet::RPC4
  • UnregisterFunction() : SLNet::RPC4
  • UnregisterLocalCallback() : SLNet::RPC4
  • UnregisterSlot() : SLNet::RPC4
  • unreliableNext : SLNet::InternalPacket
  • unreliablePrev : SLNet::InternalPacket
  • unreliableTimeout : SLNet::RakPeer
  • unsetDefaultAllocator : SLNet::CloudClient
  • Unsubscribe()
: SLNet::CloudClient
, SLNet::LogCommandParser
, SLNet::CloudClient
  • UnsubscribeFromKey() : SLNet::CloudServer
  • UNVERIFIED_SENDER : SLNet::RakPeer::RemoteSystemStruct
  • Update()
: SLNet::CCRakNetSlidingWindow
, SLNet::CloudServer
, SLNet::ConsoleServer
, CSHA1
, SLNet::DynDNS
, SLNet::FileListTransfer
, SLNet::FileListTransferCBInterface
, SLNet::HTTPConnection
, SLNet::MessageFilter
, SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::UDPProxyCoordinator
, SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::PluginInterface2
, SLNet::ThreadsafePacketLogger
, SLNet::ReliabilityLayer
, SLNet::ReplicaManager3
, SLNet::Router2
, SLNet::StatisticsHistoryPlugin
, SLNet::TeamManager
, SLNet::TwoWayAuthentication
, SLNet::TwoWayAuthentication::NonceGenerator
, SLNet::UDPProxyClient
, SLNet::UDPProxyServer
  • UpdateCell()
: DataStructures::Table
, DataStructures::Table::Row
  • UpdateCellByIndex() : DataStructures::Table
  • updateCycleIsRunning : SLNet::RakPeer
  • updatedVariablesHistory : SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory
  • UpdatedVariablesListPtrComp() : SLNet::VariableDeltaSerializer
  • updatedVariablesMemoryPool : SLNet::VariableDeltaSerializer
  • UpdateForwarding() : SLNet::Router2
  • UpdateHostIPAsynch() : SLNet::DynDNS
  • UpdateListsToNoTeam() : SLNet::TM_TeamMember
  • UpdateReadyStatus() : SLNet::ReadyEvent
  • UpdateServerNameOrPassword() : SLNet::Rackspace
  • UpdateTeamsRequestedToAny() : SLNet::TM_TeamMember
  • UpdateTeamsRequestedToNone() : SLNet::TM_TeamMember
  • UpdateUDPForwarder() : SLNet::UDPForwarder
  • uploadedBytes : SLNet::CloudServer::RemoteCloudClient
  • uploadedKeys : SLNet::CloudServer::RemoteCloudClient , SLNet::CloudServer::RemoteServer
  • uploaderCount : SLNet::CloudServer::CloudDataList
  • URLDecode() : SLNet::RakString
  • URLEncode() : SLNet::RakString
  • usedForwardingEntries : SLNet::Router2::ConnectionRequestSystem
  • usedValueBufferCount : SLNet::RakNetRandomSync
  • usedValues : SLNet::RakNetRandomSync
  • userConnectionSocketIndex : SLNet::RakNetSocket2
  • userData : SLNet::StatisticsHistory::TrackedObjectData , SLNet::HTTPConnection2::Request
  • UserIDTOString() : SLNet::PacketLogger
  • userMemory : DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage
  • userReplicaList : SLNet::ReplicaManager3::RM3World
  • users : SLNet::NatPunchthroughServer
  • usersInRoom : SLNet::RelayPlugin::RP_Group
  • userUpdateThreadData : SLNet::RakPeer
  • userUpdateThreadPtr : SLNet::RakPeer
  • UsesReliabilityLayer()
: SLNet::PacketLogger
, SLNet::PluginInterface2
  • useSSL : SLNet::HTTPConnection2::Request , SLNet::TCPInterface::ThisPtrPlusSysAddr
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- v -

  • val
: DataStructures::MLKeyRef< templateType >
, SLNet::StatisticsHistory::TimeAndValue
, SLNet::uint24_t
  • ValidateLists() : SLNet::Connection_RM3
  • ValidateRemoteSystemLookup() : SLNet::RakPeer
  • ValidateTreeRecursive() : DataStructures::BPlusTree< KeyType, DataType, order >
  • validationInteger : SLNet::RakPeer
  • value : HuffmanEncodingTreeNode , SLNet::LocklessUint32_t
  • value1 : SLNet::BPSTracker::TimeAndValue2
  • valueOverLastSecond : SLNet::RakNetStatistics
  • values : SLNet::StatisticsHistory::TimeAndValueQueue
  • VARIABLE_NUMBER_OF_PARAMETERS : SLNet::CommandParserInterface
  • VariableDeltaSerializer() : SLNet::VariableDeltaSerializer
  • variableHistory : SLNet::VariableDeltaSerializer::SerializationContext
  • variableHistoryIdentical : SLNet::VariableDeltaSerializer::SerializationContext
  • variableHistoryUnique : SLNet::VariableDeltaSerializer::SerializationContext
  • VariableLastValueNode() : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • variableList : SLNet::VariableListDeltaTracker
  • variableListDeltaTracker : SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory
  • VariableListDeltaTracker() : SLNet::VariableListDeltaTracker
  • variableMultilistType : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- w -

  • WAITING_AFTER_ALL_ATTEMPTS : SLNet::NatPunchthroughClient::SendPing
  • WAITING_FOR_INTERNAL_IPS_RESPONSE : SLNet::NatPunchthroughClient::SendPing
  • waitingPackets : SLNet::PacketizedTCP
  • WaitOnEvent() : SLNet::SignaledEvent
  • wasGeneratedLocally : SLNet::Packet
  • WasReferenced() : SLNet::Replica3
  • WasResultSuccessful() : SLNet::DynDNS
  • WasStarted() : SLNet::TCPInterface , ThreadPool< InputType, OutputType >
  • WeAreHost() : SLNet::TeamBalancer
  • weAreSender : SLNet::NatPunchthroughClient::SendPing
  • weight : DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode , HuffmanEncodingTreeNode , DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight
  • WeightedGraph() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • weInitiatedForwarding : SLNet::Router2::ForwardedConnection
  • weInitiatedTheConnection : SLNet::RakPeer::RemoteSystemStruct
  • whenGenerated : SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest
  • whenJoinAnyRequested : SLNet::TM_TeamMember
  • whenLastSerialized : SLNet::LastSerializationResult , SLNet::SerializeParameters
  • whenLastTimeoutCheck : SLNet::MessageFilter , SLNet::TwoWayAuthentication
  • whenRequested : SLNet::TM_TeamMember::RequestedTeam
  • whenRequestMade : SLNet::TM_World::JoinRequestHelper
  • workingFlag : SLNet::CloudServer::RemoteServer
  • workingThreadCountMutex : ThreadPool< InputType, OutputType >
  • world : SLNet::TM_TeamMember , SLNet::TM_Team
  • worldId : SLNet::TM_World , SLNet::ReplicaManager3::RM3World
  • worldsArray : SLNet::ReplicaManager3 , SLNet::TeamManager
  • worldsList : SLNet::ReplicaManager3 , SLNet::TeamManager
  • WorldToCellX() : GridSectorizer
  • WorldToCellXOffsetAndClamped() : GridSectorizer
  • WorldToCellY() : GridSectorizer
  • WorldToCellYOffsetAndClamped() : GridSectorizer
  • Write() : SLNet::BitStream
  • Write0() : SLNet::BitStream
  • Write1() : SLNet::BitStream
  • WriteAlignedBytes() : SLNet::BitStream
  • WriteAlignedBytesSafe() : SLNet::BitStream
  • WriteAlignedVar16() : SLNet::BitStream
  • WriteAlignedVar32() : SLNet::BitStream
  • WriteAlignedVar8() : SLNet::BitStream
  • WriteAllocationID()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • WriteBits() : SLNet::BitStream
  • WriteBitsFromIntegerRange() : SLNet::BitStream
  • WriteBytes() : DataStructures::ByteQueue
  • WriteCasted() : SLNet::BitStream
  • WriteCloudQueryRowFromResultList() : SLNet::CloudServer
  • WriteCompressed() : SLNet::BitStream
  • WriteCompressedDelta() : SLNet::BitStream
  • WriteDataToDisk() : SLNet::FileList
  • WriteDelta() : SLNet::BitStream
  • WriteFloat16() : SLNet::BitStream
  • WriteLock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • WriteLog()
: SLNet::PacketConsoleLogger
, SLNet::PacketLogger
, SLNet::PacketOutputWindowLogger
, SLNet::LogCommandParser
, SLNet::PacketFileLogger
  • WriteMiscellaneous() : SLNet::PacketLogger
  • WriteNormQuat() : SLNet::BitStream
  • WriteNormVector() : SLNet::BitStream
  • writeOffset : DataStructures::ByteQueue
  • WriteOrthMatrix() : SLNet::BitStream
  • WriteOutOfBandHeader()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • WritePtr() : SLNet::BitStream
  • WriteUnlock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • WriteVar() : SLNet::VariableListDeltaTracker
  • WriteVarToBitstream() : SLNet::VariableListDeltaTracker
  • WriteVector() : SLNet::BitStream
  • WSAStartupSingleton() : WSAStartupSingleton
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- x -

  • xml : SLNet::Rackspace::RackspaceOperation
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • ~
Here is a list of all class members with links to the classes they belong to:

- ~ -

  • ~AVLBalancedBinarySearchTree() : DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
  • ~BinarySearchTree() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • ~BitStream() : SLNet::BitStream
  • ~BPlusTree() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ~BPSTracker() : SLNet::BPSTracker
  • ~BytePool() : DataStructures::BytePool
  • ~ByteQueue() : DataStructures::ByteQueue
  • ~CCRakNetSlidingWindow() : SLNet::CCRakNetSlidingWindow
  • ~Cell() : DataStructures::Table::Cell
  • ~CircularLinkedList() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • ~CloudAllocator() : SLNet::CloudAllocator
  • ~CloudClient() : SLNet::CloudClient
  • ~CloudClientCallback() : SLNet::CloudClientCallback
  • ~CloudData() : SLNet::CloudServer::CloudData
  • ~CloudKey() : SLNet::CloudKey
  • ~CloudServer() : SLNet::CloudServer
  • ~CloudServerQueryFilter() : SLNet::CloudServerQueryFilter
  • ~ColumnDescriptor() : DataStructures::Table::ColumnDescriptor
  • ~CommandParserInterface() : SLNet::CommandParserInterface
  • ~Connection_RM3() : SLNet::Connection_RM3
  • ~ConnectionGraph2() : SLNet::ConnectionGraph2
  • ~ConnnectRequest() : SLNet::Router2::ConnnectRequest
  • ~ConsoleServer() : SLNet::ConsoleServer
  • ~CSHA1() : CSHA1
  • ~DirectoryDeltaTransfer() : SLNet::DirectoryDeltaTransfer
  • ~DynDNS() : SLNet::DynDNS
  • ~FileList() : SLNet::FileList
  • ~FileListNodeContext() : FileListNodeContext
  • ~FileListProgress() : SLNet::FileListProgress
  • ~FileListTransfer() : SLNet::FileListTransfer
  • ~FileListTransferCBInterface() : SLNet::FileListTransferCBInterface
  • ~FilterQuery() : DataStructures::Table::FilterQuery
  • ~FLP_Printf() : SLNet::FLP_Printf
  • ~ForwardEntry() : SLNet::UDPForwarder::ForwardEntry
  • ~GridSectorizer() : GridSectorizer
  • ~Hash() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • ~Heap() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • ~HTTPConnection() : SLNet::HTTPConnection
  • ~HTTPConnection2() : SLNet::HTTPConnection2
  • ~HuffmanEncodingTree() : SLNet::HuffmanEncodingTree
  • ~IncrementalReadInterface() : SLNet::IncrementalReadInterface
  • ~LastSerializationResult() : SLNet::LastSerializationResult
  • ~LinkedList() : DataStructures::LinkedList< LinkedListType >
  • ~List() : DataStructures::List< list_type >
  • ~LocalSlotObject() : SLNet::RPC4::LocalSlotObject
  • ~LogCommandParser() : SLNet::LogCommandParser
  • ~Map() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • ~MemoryPool() : DataStructures::MemoryPool< MemoryBlockType >
  • ~MessageFilter() : SLNet::MessageFilter
  • ~Multilist() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ~NatPunchthroughClient() : SLNet::NatPunchthroughClient
  • ~NatPunchthroughDebugInterface() : SLNet::NatPunchthroughDebugInterface
  • ~NatPunchthroughDebugInterface_PacketLogger() : SLNet::NatPunchthroughDebugInterface_PacketLogger
  • ~NatPunchthroughServer() : SLNet::NatPunchthroughServer
  • ~NatPunchthroughServerDebugInterface() : SLNet::NatPunchthroughServerDebugInterface
  • ~NatPunchthroughServerDebugInterface_PacketLogger() : SLNet::NatPunchthroughServerDebugInterface_PacketLogger
  • ~NatTypeDetectionClient() : SLNet::NatTypeDetectionClient
  • ~NatTypeDetectionServer() : SLNet::NatTypeDetectionServer
  • ~NetworkIDManager() : SLNet::NetworkIDManager
  • ~NetworkIDObject() : SLNet::NetworkIDObject
  • ~NonceGenerator() : SLNet::TwoWayAuthentication::NonceGenerator
  • ~OrderedChannelHeap() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • ~OrderedList() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • ~PacketFileLogger() : SLNet::PacketFileLogger
  • ~PacketizedTCP() : SLNet::PacketizedTCP
  • ~PacketLogger() : SLNet::PacketLogger
  • ~PacketOutputWindowLogger() : SLNet::PacketOutputWindowLogger
  • ~PluginInterface2() : SLNet::PluginInterface2
  • ~Queue() : DataStructures::Queue< queue_type >
  • ~Rackspace() : SLNet::Rackspace
  • ~Rackspace2EventCallback() : SLNet::Rackspace2EventCallback
  • ~RakNetCommandParser() : SLNet::RakNetCommandParser
  • ~RakNetRandom() : SLNet::RakNetRandom
  • ~RakNetRandomSync() : SLNet::RakNetRandomSync
  • ~RakNetSmartPtr() : SLNet::RakNetSmartPtr< T >
  • ~RakNetSocket2() : SLNet::RakNetSocket2
  • ~RakNetTransport2() : SLNet::RakNetTransport2
  • ~RakPeer() : SLNet::RakPeer
  • ~RakPeerInterface() : SLNet::RakPeerInterface
  • ~RakString() : SLNet::RakString
  • ~RakWString() : SLNet::RakWString
  • ~RangeList() : DataStructures::RangeList< range_type >
  • ~RangeNode() : DataStructures::RangeNode< range_type >
  • ~ReadyEvent() : SLNet::ReadyEvent
  • ~RefCountedObj() : RefCountedObj
  • ~ReferenceCounter() : SLNet::ReferenceCounter
  • ~RelayPlugin() : SLNet::RelayPlugin
  • ~ReliabilityLayer() : SLNet::ReliabilityLayer
  • ~Replica3() : SLNet::Replica3
  • ~ReplicaManager3() : SLNet::ReplicaManager3
  • ~RNS2_Berkley() : SLNet::RNS2_Berkley
  • ~RNS2EventHandler() : SLNet::RNS2EventHandler
  • ~Router2() : SLNet::Router2
  • ~Router2DebugInterface() : SLNet::Router2DebugInterface
  • ~RPC4() : SLNet::RPC4
  • ~SerializationContext() : SLNet::VariableDeltaSerializer::SerializationContext
  • ~SignaledEvent() : SLNet::SignaledEvent
  • ~SimpleMutex() : SLNet::SimpleMutex
  • ~SingleProducerConsumer() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • ~SocketLayer() : SLNet::SocketLayer
  • ~SocketQueryOutput() : SLNet::RakPeer::SocketQueryOutput
  • ~StatisticsHistory() : SLNet::StatisticsHistory
  • ~StatisticsHistoryPlugin() : SLNet::StatisticsHistoryPlugin
  • ~StringCompressor() : SLNet::StringCompressor
  • ~StringTable() : SLNet::StringTable
  • ~Table() : DataStructures::Table
  • ~TCPInterface() : SLNet::TCPInterface
  • ~TeamBalancer() : SLNet::TeamBalancer
  • ~TeamManager() : SLNet::TeamManager
  • ~TelnetTransport() : SLNet::TelnetTransport
  • ~ThreadDataInterface() : ThreadDataInterface
  • ~ThreadPool() : ThreadPool< InputType, OutputType >
  • ~ThreadsafePacketLogger() : SLNet::ThreadsafePacketLogger
  • ~TimeAndValue2() : SLNet::BPSTracker::TimeAndValue2
  • ~TimeAndValueQueue() : SLNet::StatisticsHistory::TimeAndValueQueue
  • ~TM_Team() : SLNet::TM_Team
  • ~TM_TeamMember() : SLNet::TM_TeamMember
  • ~TM_World() : SLNet::TM_World
  • ~TrackedObject() : SLNet::StatisticsHistory::TrackedObject
  • ~TransportInterface() : SLNet::TransportInterface
  • ~Tree() : DataStructures::Tree< TreeType >
  • ~TwoWayAuthentication() : SLNet::TwoWayAuthentication
  • ~UDPForwarder() : SLNet::UDPForwarder
  • ~UDPProxyClient() : SLNet::UDPProxyClient
  • ~UDPProxyClientResultHandler() : SLNet::UDPProxyClientResultHandler
  • ~UDPProxyCoordinator() : SLNet::UDPProxyCoordinator
  • ~UDPProxyServer() : SLNet::UDPProxyServer
  • ~UDPProxyServerResultHandler() : SLNet::UDPProxyServerResultHandler
  • ~VariableDeltaSerializer() : SLNet::VariableDeltaSerializer
  • ~VariableLastValueNode() : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • ~VariableListDeltaTracker() : SLNet::VariableListDeltaTracker
  • ~WeightedGraph() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • ~WSAStartupSingleton() : WSAStartupSingleton
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- a -

  • AckTimeout() : SLNet::ReliabilityLayer
  • Add() : CheckSum , DataStructures::CircularLinkedList< CircularLinkedListType > , CheckSum , DataStructures::BinarySearchTree< BinarySearchTreeType > , DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
  • AddBitsAndReallocate() : SLNet::BitStream
  • AddCallback()
: SLNet::FileList
, SLNet::FileListTransfer
  • AddChannel()
: DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, SLNet::LogCommandParser
  • AddChild() : DataStructures::Tree< TreeType >
  • AddColumn() : DataStructures::Table
  • AddCommandParser() : SLNet::ConsoleServer
  • AddConnection() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • AddEntry() : GridSectorizer
  • AddEventCallback() : SLNet::Rackspace
  • AddFile() : SLNet::FileList
  • AddFilesFromDirectory() : SLNet::FileList
  • AddInput() : ThreadPool< InputType, OutputType >
  • AddNode() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • AddObject() : SLNet::StatisticsHistory
  • AddOperation() : SLNet::Rackspace
  • AddOutput() : ThreadPool< InputType, OutputType >
  • AddPacketToProducer() : SLNet::RakPeer
  • AddParticipant()
: SLNet::ConnectionGraph2
, SLNet::TM_World
  • AddParticipantOnServer() : SLNet::RelayPlugin
  • AddParticipantRequestFromClient() : SLNet::RelayPlugin
  • AddPassword() : SLNet::TwoWayAuthentication
  • AddQueryFilter() : SLNet::CloudServer
  • AddRef() : SLNet::FileListTransfer::FileToPushRecipient , RefCountedObj , SLNet::ReferenceCounter , WSAStartupSingleton
  • AddReference()
: SLNet::StringCompressor
, SLNet::StringTable
  • AddRemoteSystemVariableHistory() : SLNet::VariableDeltaSerializer
  • AddressOrGUID() : SLNet::AddressOrGUID
  • AddRow() : DataStructures::Table
  • AddRowColumns() : DataStructures::Table
  • AddServer() : SLNet::CloudServer
  • AddString() : SLNet::StringTable
  • AddTeamMember() : SLNet::TeamBalancer
  • AddToActiveSystemList() : SLNet::RakPeer
  • AddToBanList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • AddToConnectionList() : SLNet::PacketizedTCP
  • AddToFrequencyTable() : SLNet::HuffmanEncodingTreeFactory
  • AddToLog()
: SLNet::PacketLogger
, SLNet::ThreadsafePacketLogger
  • AddToRequestedTeams() : SLNet::TM_TeamMember
  • AddToSecurityExceptionList()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • AddToTeamList() : SLNet::TM_TeamMember
  • AddToWaitList() : SLNet::ReadyEvent
  • AddToWaitListInternal() : SLNet::ReadyEvent
  • AddUploadsFromSubdirectory() : SLNet::DirectoryDeltaTransfer
  • AddValueByIndex() : SLNet::StatisticsHistory
  • AddValueByObjectID() : SLNet::StatisticsHistory
  • AddWorld()
: SLNet::TeamManager
, SLNet::ReplicaManager3
  • AdvertiseSystem()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • AlignReadToByteBoundary() : SLNet::BitStream
  • AlignWriteToByteBoundary() : SLNet::BitStream
  • Allocate()
: DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::BytePool
, DataStructures::MemoryPool< MemoryBlockType >
, SLNet::RakString
  • AllocateCloudQueryRow() : SLNet::CloudAllocator
  • AllocateFirst() : DataStructures::MemoryPool< MemoryBlockType >
  • AllocatePacket()
: SLNet::RakPeerInterface
, SLNet::TCPInterface
, SLNet::RakPeer
  • AllocatePacketUnified() : SLNet::PluginInterface2
  • AllocateRowData() : SLNet::CloudAllocator
  • AllocationSize() : DataStructures::Queue< queue_type >
  • AllocBS() : SLNet::LastSerializationResult
  • AllocChangedVariablesList() : SLNet::VariableDeltaSerializer
  • AllocConnection() : SLNet::ReplicaManager3
  • AllocPacket() : SLNet::RakPeer
  • AllocReplica() : SLNet::Connection_RM3
  • AllocRNS2() : SLNet::RakNetSocket2Allocator
  • AllocRNS2RecvStruct()
: SLNet::RakPeer
, SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::RNS2EventHandler
  • AllowConnectionResponseIPMigration()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • AllowIncomingConnections() : SLNet::RakPeer
  • AllRemoteServersHaveResponded() : SLNet::CloudServer::GetRequest
  • AnyAvailable() : SLNet::TeamSelection
  • AppendBytes() : SLNet::RakString
  • ApplyNetworkSimulator()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::ReliabilityLayer
  • AreAcksWaiting() : SLNet::ReliabilityLayer
  • AreAllServersPinged() : SLNet::UDPProxyClient::PingServerGroup
  • AssertCopyData() : SLNet::BitStream
  • AssertStreamEmpty() : SLNet::BitStream
  • Assign() : SLNet::RakString
  • AssignSystemAddressToRemoteSystemList() : SLNet::RakPeer
  • AttachPlugin()
: SLNet::RakPeer
, SLNet::TCPInterface
, SLNet::RakPeerInterface
  • Authenticate() : SLNet::Rackspace
  • AutoAllocate() : SLNet::TelnetTransport
  • AutoConstructByQuery() : SLNet::Connection_RM3
  • AutoCreateConnectionList() : SLNet::ReplicaManager3
  • AVLBalancedBinarySearchTree() : DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- b -

  • BadResponse() : SLNet::HTTPConnection::BadResponse
  • BaseIDTOString() : SLNet::PacketLogger
  • BeginDeserialize() : SLNet::VariableDeltaSerializer
  • BeginIdenticalSerialize() : SLNet::VariableDeltaSerializer
  • Beginning() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • BeginUniqueSerialize() : SLNet::VariableDeltaSerializer
  • BeginUnreliableAckedSerialize() : SLNet::VariableDeltaSerializer
  • BinarySearchTree() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • Bind()
: SLNet::IRNS2_Berkley
, SLNet::RNS2_Linux
  • BindShared() : SLNet::RNS2_Berkley
  • BindSharedIPV4() : SLNet::RNS2_Berkley
  • BindSharedIPV4And6() : SLNet::RNS2_Berkley
  • BitStream() : SLNet::BitStream
  • BlockOnStopRecvPollingThread() : SLNet::RNS2_Berkley
  • BlocksPerPage() : DataStructures::MemoryPool< MemoryBlockType >
  • BPlusTree() : DataStructures::BPlusTree< KeyType, DataType, order >
  • BPSTracker() : SLNet::BPSTracker
  • BroadcastDestruction()
: SLNet::Replica3
, SLNet::ReplicaManager3
  • BroadcastDestructionList() : SLNet::ReplicaManager3
  • BroadcastReadyUpdate() : SLNet::ReadyEvent
  • BroadcastToParticipants() : SLNet::TM_World
  • BufferedGetResponseFromServerComp() : SLNet::CloudServer
  • BytePool() : DataStructures::BytePool
  • ByteQueue() : DataStructures::ByteQueue
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- c -

  • C_String()
: SLNet::RakString
, SLNet::RakWString
  • C_StringUnsafe() : SLNet::RakString
  • Call() : SLNet::RPC4
  • CallBlocking() : SLNet::RPC4
  • CallLoopback() : SLNet::RPC4
  • CallPluginCallbacks() : SLNet::RakPeer
  • CancelConnectionAttempt()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • CancelReadLock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • CancelReceive() : SLNet::FileListTransfer
  • CancelRequestSpecificTeam() : SLNet::TeamBalancer
  • CancelTeamRequest() : SLNet::TM_TeamMember
  • CancelWriteLock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • CanRotateLeft() : DataStructures::BPlusTree< KeyType, DataType, order >
  • CanRotateRight() : DataStructures::BPlusTree< KeyType, DataType, order >
  • CCRakNetSlidingWindow() : SLNet::CCRakNetSlidingWindow
  • Cell() : DataStructures::Table::Cell
  • Challenge() : SLNet::TwoWayAuthentication
  • ChangeSystemAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • ChannelSize() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • CheckReadUnlockOrder() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • CheckSum() : CheckSum
  • CircularLinkedList() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • Clear()
: SLNet::CloudServer::BufferedGetResponseFromServer
, SLNet::StatisticsHistory
, SLNet::StatisticsHistory::TimeAndValueQueue
, SLNet::CloudServer::GetRequest
, SLNet::RakString
, SLNet::TM_World
, DataStructures::BinarySearchTree< BinarySearchTreeType >
, SLNet::TeamManager
, ThreadPool< InputType, OutputType >
, DataStructures::BPlusTree< KeyType, DataType, order >
, SLNet::TwoWayAuthentication
, SLNet::TwoWayAuthentication::NonceGenerator
, DataStructures::BytePool
, SLNet::UDPProxyClient
, SLNet::UDPProxyCoordinator
, DataStructures::ByteQueue
, SLNet::RakWString
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::List< list_type >
, DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::MemoryPool< MemoryBlockType >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::Queue< queue_type >
, DataStructures::QueueLinkedList< QueueType >
, DataStructures::RangeList< range_type >
, DataStructures::Table::Cell
, DataStructures::Table
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
, SLNet::FileList
, SLNet::FileListTransfer
, GridSectorizer
, SLNet::MessageFilter
, CheckSum
, SLNet::NatPunchthroughClient
, SLNet::NetworkIDManager
, SLNet::CloudServer
, SLNet::ReadyEvent
, SLNet::ReplicaManager3
, SLNet::CloudServer::CloudData
, SLNet::ReplicaManager3::RM3World
, DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • ClearAll() : SLNet::Router2
  • ClearAllConnections() : SLNet::PacketizedTCP
  • ClearAndForceAllocation() : DataStructures::Queue< queue_type >
  • ClearBanList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • ClearBufferedCommands() : SLNet::RakPeer
  • ClearBufferedPackets() : SLNet::RakPeer
  • ClearByAddress() : SLNet::TwoWayAuthentication::NonceGenerator
  • ClearCallbacks()
: SLNet::FileList
, SLNet::FileListTransfer
  • ClearConnectionRequests() : SLNet::Router2
  • ClearDijkstra() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • ClearDownloadGroup() : SLNet::Connection_RM3
  • ClearEventCallbacks() : SLNet::Rackspace
  • ClearExpired1() : SLNet::BPSTracker
  • ClearForwardedConnections() : SLNet::Router2
  • ClearIndex() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • ClearInput() : ThreadPool< InputType, OutputType >
  • ClearMinipunches() : SLNet::Router2
  • ClearOutput() : ThreadPool< InputType, OutputType >
  • ClearPointer() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ClearPointers() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ClearRemoteSystemLookup() : SLNet::RakPeer
  • ClearRequestedConnectionList() : SLNet::RakPeer
  • ClearSocketQueryOutput() : SLNet::RakPeer
  • ClearUploads() : SLNet::DirectoryDeltaTransfer
  • Clone()
: SLNet::RakNetSmartPtr< T >
, SLNet::RakString
  • CloseConnection()
: SLNet::RakPeerInterface
, SLNet::TelnetTransport
, SLNet::PacketizedTCP
, SLNet::RakPeer
, SLNet::TCPInterface
, SLNet::RakNetTransport2
, SLNet::TransportInterface
  • CloseConnectionInternal() : SLNet::RakPeer
  • CloseEvent() : SLNet::SignaledEvent
  • CloudAllocator() : SLNet::CloudAllocator
  • CloudClient() : SLNet::CloudClient
  • CloudClientCallback() : SLNet::CloudClientCallback
  • CloudData() : SLNet::CloudServer::CloudData
  • CloudKey() : SLNet::CloudKey
  • CloudQuery() : SLNet::CloudQuery
  • CloudServer() : SLNet::CloudServer
  • CloudServerQueryFilter() : SLNet::CloudServerQueryFilter
  • ColumnDescriptor() : DataStructures::Table::ColumnDescriptor
  • ColumnIndex() : DataStructures::Table
  • ColumnName() : DataStructures::Table
  • CommandParserInterface() : SLNet::CommandParserInterface
  • Compress()
: DataStructures::List< list_type >
, DataStructures::Queue< queue_type >
, SLNet::DataCompressor
, DataStructures::QueueLinkedList< QueueType >
  • Concatenate() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • ConfirmResizedServer() : SLNet::Rackspace
  • Connect()
: SLNet::TCPInterface
, SLNet::RakPeerInterface
, SLNet::RakPeer
  • ConnectInternal() : SLNet::Router2
  • Connection_RM3() : SLNet::Connection_RM3
  • ConnectionAttempt() : SLNet::NatPunchthroughServer::ConnectionAttempt
  • ConnectionExists() : SLNet::ConnectionGraph2
  • ConnectionGraph2() : SLNet::ConnectionGraph2
  • ConnectToServerManagementDomain() : SLNet::Rackspace
  • ConnectWithSocket()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • ConnnectRequest() : SLNet::Router2::ConnnectRequest
  • ConsoleServer() : SLNet::ConsoleServer
  • ContainsNonprintableExceptSpaces() : SLNet::RakString
  • CopyData() : SLNet::BitStream
  • CopyPort() : SLNet::SystemAddress
  • CopySource() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • Create() : SLNet::RakThread
  • CreateImage() : SLNet::Rackspace
  • CreateListenSocket() : SLNet::TCPInterface
  • CreateNewEvent() : SLNet::ReadyEvent
  • CreateRecvPollingThread() : SLNet::RNS2_Berkley
  • CreateServer() : SLNet::Rackspace
  • CreateSharedIPGroup() : SLNet::Rackspace
  • CSHA1() : CSHA1
  • CullExpiredValues() : SLNet::StatisticsHistory::TimeAndValueQueue
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- d -

  • Deallocate() : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • DeallocateCloudQueryRow() : SLNet::CloudAllocator
  • DeallocateFilterSet() : SLNet::MessageFilter
  • DeallocateIfNeeded() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • DeallocatePacket()
: SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::RakPeer
, SLNet::TransportInterface
, SLNet::RakPeerInterface
, SLNet::TCPInterface
  • DeallocateQueryList() : SLNet::TableSerializer
  • DeallocateRowData() : SLNet::CloudAllocator
  • DeallocateWithDefaultAllocator() : SLNet::CloudClient
  • DeallocConnection() : SLNet::ReplicaManager3
  • DeallocPacketUnified() : SLNet::PluginInterface2
  • DeallocReplica()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • DeallocReplicaNoBroadcastDestruction() : SLNet::ReplicaManager3
  • DeallocRNS2() : SLNet::RakNetSocket2Allocator
  • DeallocRNS2RecvStruct()
: SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::RakPeer
, SLNet::RNS2EventHandler
  • DecodeArray() : SLNet::HuffmanEncodingTree
  • DecodeFile() : SLNet::FileListTransfer
  • DecodeSetHeader() : SLNet::FileListTransfer
  • DecodeString()
: SLNet::StringCompressor
, SLNet::StringTable
  • DecodeTeamAssigned() : SLNet::TeamManager
  • DecodeTeamCancelled() : SLNet::TeamManager
  • DecomposeTeamFull() : SLNet::TeamManager
  • DecomposeTeamFullOrLocked() : SLNet::TeamManager
  • DecomposeTeamLocked() : SLNet::TeamManager
  • DecompressAndAllocate() : SLNet::DataCompressor
  • Decrement() : SLNet::LocklessUint32_t
  • DecrementReadOffset() : DataStructures::ByteQueue
  • Del()
: DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
  • Delete()
: DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::Map< key_type, data_type, key_comparison_func >
  • DeleteConnectionAttempt() : SLNet::NatPunchthroughServer::User
  • DeleteDecendants() : DataStructures::Tree< TreeType >
  • DeleteEvent() : SLNet::ReadyEvent
  • DeleteFiles() : SLNet::FileList
  • DeleteFilterSet() : SLNet::MessageFilter
  • DeleteFromPageAtIndex() : DataStructures::BPlusTree< KeyType, DataType, order >
  • DeleteImage() : SLNet::Rackspace
  • DeleteMember() : SLNet::TeamBalancer
  • DeleteRow() : DataStructures::Table
  • DeleteServer() : SLNet::Rackspace
  • DeleteServerAddress() : SLNet::Rackspace
  • DeleteSharedIPGroup() : SLNet::Rackspace
  • DeleteShiftArrayLeft() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • DeleteThis() : SLNet::FileListTransfer::FileToPushRecipient
  • Deref() : WSAStartupSingleton , SLNet::FileListTransfer::FileToPushRecipient , RefCountedObj
  • DerefAllSockets() : SLNet::RakPeer
  • DerefConnectionAttempt() : SLNet::NatPunchthroughServer::User
  • Dereference() : SLNet::ReplicaManager3
  • DereferenceList() : SLNet::ReplicaManager3
  • DereferenceRemoteSystem() : SLNet::RakPeer
  • DereferenceTeam() : SLNet::TM_World
  • DereferenceTeamMember() : SLNet::TM_World
  • Deserialize()
: SLNet::FileList
, SLNet::RakNetRandomSync
, SLNet::Replica3
, SLNet::RakString
, SLNet::RakWString
, SLNet::Replica3Composite< parent_type >
, SLNet::RakWString
, DataStructures::RangeList< range_type >
  • DeserializeCell() : SLNet::TableSerializer
  • DeserializeColumns() : SLNet::TableSerializer
  • DeserializeCompressed() : SLNet::RakString
  • DeserializeConstruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
, SLNet::TM_TeamMember
, SLNet::RakNetRandomSync
, SLNet::TM_Team
  • DeserializeConstructionExisting()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • DeserializeDestruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • DeserializeFilterQuery() : SLNet::TableSerializer
  • DeserializeFilterQueryList() : SLNet::TableSerializer
  • DeserializeOnDownloadComplete() : SLNet::Connection_RM3
  • DeserializeOnDownloadStarted() : SLNet::Connection_RM3
  • DeserializeRow() : SLNet::TableSerializer
  • DeserializeTable() : SLNet::TableSerializer
  • DeserializeVariable() : SLNet::VariableDeltaSerializer
  • DetachPlugin()
: SLNet::RakPeerInterface
, SLNet::RakPeer
, SLNet::TCPInterface
  • DetectNATType() : SLNet::NatTypeDetectionClient
  • DirectoryDeltaTransfer() : SLNet::DirectoryDeltaTransfer
  • DirtyAndFreeVarsAssociatedWithReceipt() : SLNet::VariableDeltaSerializer
  • DisableSecurity()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • DisplayBreadthFirstSearch() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DisplayInorder() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DisplayPostorder() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DisplayPostorderRecursive() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DisplayPreorder() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • DoEndianSwap() : SLNet::BitStream
  • DomainNameToIP() : SLNet::RakNetSocket2
  • DownloadFromSubdirectory() : SLNet::DirectoryDeltaTransfer
  • DynDNS() : SLNet::DynDNS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- e -

  • EncodeArray() : SLNet::HuffmanEncodingTree
  • EncodeString()
: SLNet::StringCompressor
, SLNet::StringTable
, SLNet::StringCompressor
  • EncodeTeamAssigned() : SLNet::TeamManager
  • EncodeTeamFull() : SLNet::TeamManager
  • EncodeTeamFullOrLocked() : SLNet::TeamManager
  • EncodeTeamLocked() : SLNet::TeamManager
  • End() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • EndDeserialize() : SLNet::VariableDeltaSerializer
  • EndianSwapBytes() : SLNet::BitStream
  • EndPeek() : DataStructures::QueueLinkedList< QueueType >
  • EndSerialize() : SLNet::VariableDeltaSerializer
  • EnforceTeamBalance() : SLNet::TM_World
  • EqualsExcludingPort() : SLNet::SystemAddress
  • Erase() : SLNet::RakString
  • EstablishRouting() : SLNet::Router2
  • EstimateColumnType() : DataStructures::Table::Cell
  • EvenTeams() : SLNet::TeamBalancer
  • EventTypeToString() : SLNet::Rackspace
  • ExecuteDefault() : SLNet::RackspaceEventCallback_Default
  • ExecuteOperation() : SLNet::Rackspace
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- f -

  • FileList() : SLNet::FileList
  • FileListNodeContext() : FileListNodeContext
  • FileListProgress() : SLNet::FileListProgress
  • FileListTransfer() : SLNet::FileListTransfer
  • FileListTransferCBInterface() : SLNet::FileListTransferCBInterface
  • FillBufferMT() : SLNet::RakNetRandom
  • FillIPList() : SLNet::RakPeer
  • FillRequestedSlots() : SLNet::TM_World
  • FilterQuery() : DataStructures::Table::FilterQuery
  • Final() : CSHA1
  • Find()
: SLNet::RakString
, DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::Queue< queue_type >
  • FindDeleteRebalance() : DataStructures::BPlusTree< KeyType, DataType, order >
  • FindIntersection() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • FindParent() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • FindPointer() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • FindRouterPortStride() : SLNet::NatPunchthroughClient
  • FixEndingSlash() : SLNet::FileList
  • FixForIPVersion() : SLNet::SystemAddress
  • FixTree() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • FixUnderflow() : DataStructures::BPlusTree< KeyType, DataType, order >
  • FlagDirtyFromBitArray() : SLNet::VariableListDeltaTracker
  • FlagFilesAsReferences() : SLNet::FileList
  • FLP_Printf() : SLNet::FLP_Printf
  • ForceCompletion() : SLNet::ReadyEvent
  • ForceExternalSystemAddress() : SLNet::CloudServer
  • ForEach() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ForEachData() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ForEachLeaf() : DataStructures::BPlusTree< KeyType, DataType, order >
  • FormatForDELETE() : SLNet::RakString
  • FormatForGET() : SLNet::RakString
  • FormatForPOST() : SLNet::RakString
  • FormatForPUT() : SLNet::RakString
  • FormatForPUTOrPost() : SLNet::RakString
  • FormatLine() : SLNet::PacketLogger
  • ForwardEntry() : SLNet::UDPForwarder::ForwardEntry
  • ForwardingRequestComp() : SLNet::UDPProxyCoordinator
  • FPrintf()
: SLNet::RakWString
, SLNet::RakString
  • FrandomMT()
: SLNet::RakNetRandomSync
, SLNet::RakNetRandom
  • Free() : SLNet::RakString
  • FreeChangedVariablesList() : SLNet::VariableDeltaSerializer
  • FreeMemory()
: SLNet::HuffmanEncodingTree
, SLNet::RakString
  • FreeMemoryNoMutex() : SLNet::RakString
  • FreePages() : DataStructures::BPlusTree< KeyType, DataType, order >
  • FreeVarsAssociatedWithReceipt() : SLNet::VariableDeltaSerializer
  • FromString()
: SLNet::RakNetGUID
, SLNet::SystemAddress
  • FromStringExplicitPort() : SLNet::SystemAddress
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- g -

  • GenerateDisjktraMatrix() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • GenerateFromFrequencyTable() : SLNet::HuffmanEncodingTree
  • GenerateGUID() : SLNet::RakPeer
  • GenerateHashes() : SLNet::DirectoryDeltaTransfer
  • GenerateNonce() : SLNet::TwoWayAuthentication::NonceGenerator
  • GenerateSeedFromGuid() : SLNet::RakPeer
  • GenerateTree() : SLNet::HuffmanEncodingTreeFactory
  • GenerateTreeFromStrings() : SLNet::StringCompressor
  • Get()
: DataStructures::MLKeyRef< templateType >
, DataStructures::Table::Cell
, CheckSum
, DataStructures::Table::Cell
, SLNet::CloudClient
, DataStructures::Table::Cell
, SLNet::CloudClient
, SLNet::HTTPConnection
, SLNet::CloudClient
, DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::List< list_type >
, DataStructures::Map< key_type, data_type, key_comparison_func >
  • Get64BitUniqueRandomNumber() : SLNet::RakPeerInterface
  • GET_BASE_OBJECT_FROM_ID() : SLNet::NetworkIDManager
  • GET_OBJECT_FROM_ID() : SLNet::NetworkIDManager
  • GetAllConnectionDownloadsCompleted() : SLNet::ReplicaManager3
  • GetAndIncrementNextDatagramSequenceNumber() : SLNet::CCRakNetSlidingWindow
  • GetAsList() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • GetAutoCreateConnections() : SLNet::ReplicaManager3
  • GetAutoDestroyConnections() : SLNet::ReplicaManager3
  • GetAutoProcessNewConnections() : SLNet::ConnectionGraph2
  • GetAvailablePagesSize() : DataStructures::MemoryPool< MemoryBlockType >
  • GetAvailableRowId() : DataStructures::Table
  • GetAvailableTeamIndexWithFewestMembers() : SLNet::TM_World
  • GetAveragePing()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetBalancedTeamLimit() : SLNet::TM_World
  • GetBalanceTeams() : SLNet::TM_World
  • GetBalancingApplies() : SLNet::TM_Team
  • GetBestClockDifferential() : SLNet::RakPeer
  • GetBindings() : SLNet::RNS2_Berkley
  • GetBoundAddress() : SLNet::RakNetSocket2
  • GetBPS1() : SLNet::BPSTracker
  • GetBPS1Threadsafe() : SLNet::BPSTracker
  • GetBytesPerSecondLimitByCongestionControl() : SLNet::CCRakNetSlidingWindow
  • GetBytesWritten() : DataStructures::ByteQueue
  • GetCallbacks()
: SLNet::FileList
, SLNet::FileListTransfer
  • GetCallCount() : SLNet::RakNetRandomSync
  • GetCellValueByIndex() : DataStructures::Table
  • GetChangelistSinceDate() : SLNet::AutopatcherRepositoryInterface
  • GetChannelIndexFromName() : SLNet::LogCommandParser
  • GetCharacterCount() : SLNet::RakString
  • GetClientPublicKeyFromSystemAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetClockDifferential()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetClockDifferentialInt() : SLNet::RakPeer
  • GetColumnCount() : DataStructures::Table
  • GetColumns() : DataStructures::Table
  • GetColumnType() : DataStructures::Table
  • GetCommandParser()
: SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::TransportInterface
  • GetCompletedDescription() : SLNet::DynDNS
  • GetCompletedResultCode() : SLNet::DynDNS
  • GetCompositeOwner() : SLNet::Replica3Composite< parent_type >
  • GetConnectionAtIndex()
: DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
, SLNet::ReplicaManager3
  • GetConnectionByGUID() : SLNet::ReplicaManager3
  • GetConnectionBySystemAddress() : SLNet::ReplicaManager3
  • GetConnectionCount()
: DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
, SLNet::ReplicaManager3
, SLNet::TCPInterface
  • GetConnectionList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::TCPInterface
  • GetConnectionListForRemoteSystem() : SLNet::ConnectionGraph2
  • GetConnectionRequestIndex() : SLNet::Router2
  • GetConnectionState()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetConnectionsThatHaveReplicaConstructed() : SLNet::ReplicaManager3
  • GetConstructedReplicas() : SLNet::Connection_RM3
  • GetCreatingSystemGUID() : SLNet::Replica3
  • GetCurrentTeam() : SLNet::TM_TeamMember
  • GetCurrentTeamByIndex() : SLNet::TM_TeamMember
  • GetCurrentTeamCount() : SLNet::TM_TeamMember
  • GetCurrentTeams() : SLNet::TM_TeamMember
  • GetCWNDLimit() : SLNet::CCRakNetSlidingWindow
  • GetData() : SLNet::BitStream
  • GetDataHead() : DataStructures::BPlusTree< KeyType, DataType, order >
  • GetDebugInterface() : SLNet::Router2
  • GetDefaultSendParameters() : SLNet::ReplicaManager3
  • GetDefaultTimeToTrack() : SLNet::StatisticsHistory
  • GetDeltaToCurrent() : SLNet::FileList
  • GetDetectionAttemptIndex() : SLNet::NatTypeDetectionServer
  • GetDownloadWasCompleted() : SLNet::Connection_RM3
  • GetElementFromKey() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • GetEntries() : GridSectorizer
  • GetEstimatedBandwidth() : SLNet::CCRakNetSlidingWindow
  • GetEventAtIndex() : SLNet::ReadyEvent
  • GetEventHandler() : SLNet::RakNetSocket2
  • GetEventListSize() : SLNet::ReadyEvent
  • GetExternalID()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetFilePart() : SLNet::IncrementalReadInterface
  • GetFilterSetByID() : SLNet::MessageFilter
  • GetFilterSetCount() : SLNet::MessageFilter
  • GetFilterSetIDByIndex() : SLNet::MessageFilter
  • GetFirstBindableIP() : SLNet::SocketLayer
  • GetFirstNonFullTeam() : SLNet::TeamBalancer
  • GetFlavorDetails() : SLNet::Rackspace
  • GetFrequencyTable() : SLNet::HuffmanEncodingTreeFactory
  • GetFromWaitListAtIndex() : SLNet::ReadyEvent
  • GetGroupList() : SLNet::RelayPlugin
  • GetGUIDFromIndex()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetGuidFromSystemAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetGuidIndex() : SLNet::Router2::ConnnectRequest
  • GetHash() : CSHA1
  • GetHistoryForKey() : SLNet::StatisticsHistory
  • GetHistorySorted() : SLNet::StatisticsHistory
  • GetHost() : SLNet::TM_World
  • GetImageDetails() : SLNet::Rackspace
  • GetIncomingPassword()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetIncrementalReadChunkSize() : SLNet::AutopatcherRepositoryInterface
  • GetIndexAtKey() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • GetIndexFromGuid() : SLNet::RakPeer
  • GetIndexFromKey() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • GetIndexFromKeyInSortedList() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetIndexFromSystemAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetIndexOf() : DataStructures::BPlusTree< KeyType, DataType, order > , DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > , DataStructures::List< list_type > , DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetInputAtIndex() : ThreadPool< InputType, OutputType >
  • GetInsertionIndex() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetInternalID()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetIPPROTO() : SLNet::SystemAddress
  • GetIPVersion() : SLNet::SystemAddress
  • GetIsInSlowStart() : SLNet::CCRakNetSlidingWindow
  • GetJoinPermissions() : SLNet::TM_Team
  • GetKeyAtIndex() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • GetLargestPingAmongConnectedSystems() : SLNet::Router2
  • GetLastError() : SLNet::AutopatcherRepositoryInterface
  • GetLastPing()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetLastTeams() : SLNet::TM_TeamMember
  • GetLeafFromKey() : DataStructures::BPlusTree< KeyType, DataType, order >
  • GetLength()
: SLNet::RakString
, SLNet::RakWString
  • GetLengthUTF8() : SLNet::RakString
  • GetLinkCapacityBytesPerSecond() : SLNet::CCRakNetSlidingWindow
  • GetListHead()
: DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::Table
  • GetLocalIP()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetLocalPort() : SLNet::SocketLayer
  • GetLocalReceiveRate() : SLNet::CCRakNetSlidingWindow
  • GetLocalSendRate() : SLNet::CCRakNetSlidingWindow
  • GetLocalSlotIndex() : SLNet::RPC4
  • GetLocalTime() : SLNet::PacketLogger
  • GetLongTermAverage() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetLongTermHighest() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetLongTermLowest() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetLongTermSum() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetLoopbackAddress() : SLNet::RakPeer
  • GetLowestAveragePingSystem() : SLNet::ConnectionGraph2
  • GetLowestPing()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMaxForwardEntries() : SLNet::UDPForwarder
  • GetMaximumIncomingConnections()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMaximumNumberOfPeers()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMemberIndex() : SLNet::TeamBalancer
  • GetMemberIndexToSwitchTeams() : SLNet::TeamBalancer
  • GetMemberLimit() : SLNet::TM_Team
  • GetMemberLimitSetting() : SLNet::TM_Team
  • GetMemberWithRequestedSingleTeamSwitch() : SLNet::TM_Team
  • GetMemoryPoolPageSize() : DataStructures::MemoryPool< MemoryBlockType >
  • GetMinMaxTeamMembers() : SLNet::TeamBalancer
  • GetMostRecentChangelistWithPatches() : SLNet::AutopatcherRepositoryInterface
  • GetMTU() : SLNet::CCRakNetSlidingWindow
  • GetMTUSize()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMultilistType() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetMyBoundAddress()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMyGUID()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetMyGUIDUnified() : SLNet::PluginInterface2
  • GetMyIP()
: SLNet::SocketLayer
, SLNet::RakNetSocket2
, SLNet::RNS2_Linux
  • GetMyIPIPV4() : SLNet::RNS2_Linux
  • GetMyIPIPV4And6() : SLNet::RNS2_Linux
  • GetMyPublicIP() : SLNet::DynDNS
  • GetMyTeam() : SLNet::TeamBalancer
  • GetName()
: SLNet::RakNetCommandParser
, SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • GetNetworkID()
: SLNet::NetworkIDObject
, SLNet::TM_TeamMember
, SLNet::TM_Team
  • GetNetworkIDManager()
: SLNet::ReplicaManager3
, SLNet::NetworkIDObject
  • GetNewNetworkID() : SLNet::NetworkIDManager
  • GetNextDatagramSequenceNumber() : SLNet::CCRakNetSlidingWindow
  • GetNextDefaultTeam() : SLNet::TeamBalancer
  • GetNextSendReceipt()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetNextSendTime() : SLNet::ReliabilityLayer
  • GetNodeAtIndex() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • GetNodeCount() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • GetNonce() : SLNet::TwoWayAuthentication::NonceGenerator
  • GetNonceById() : SLNet::TwoWayAuthentication::NonceGenerator
  • GetNoTeamId() : SLNet::TM_TeamMember
  • GetNumberOfAddresses()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetNumberOfBitsAllocated() : SLNet::BitStream
  • GetNumberOfBitsUsed() : SLNet::BitStream
  • GetNumberOfBytesUsed() : SLNet::BitStream
  • GetNumberOfFilesForUpload() : SLNet::DirectoryDeltaTransfer
  • GetNumberOfRemoteInitiatedConnections() : SLNet::RakPeer
  • GetNumberOfUnreadBits() : SLNet::BitStream
  • GetObjectAtIndex() : SLNet::StatisticsHistory
  • GetObjectCount() : SLNet::StatisticsHistory
  • GetObjectIndex() : SLNet::StatisticsHistory
  • GetOfflinePingResponse()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetOperationOfTypeIndex() : SLNet::Rackspace
  • GetOrAllocateCloudDataList() : SLNet::CloudServer
  • GetOutgoingDataBufferSize() : SLNet::TCPInterface
  • GetOutput() : ThreadPool< InputType, OutputType >
  • GetOutputAtIndex() : ThreadPool< InputType, OutputType >
  • GetOverpopulatedTeams() : SLNet::TeamBalancer
  • GetOwner()
: SLNet::TM_Team
, SLNet::TM_TeamMember
  • GetParent() : SLNet::NetworkIDObject
  • GetParticipantList()
: SLNet::ConnectionGraph2
, SLNet::TM_World
  • GetPatches() : SLNet::AutopatcherRepositoryInterface
  • GetPendingFilesToAddress() : SLNet::FileListTransfer
  • GetPendingOpenNATIndex() : SLNet::NatPunchthroughClient
  • GetPingBetweenSystems() : SLNet::ConnectionGraph2
  • GetPointerToNode() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • GetPort() : SLNet::SystemAddress
  • GetPortNetworkOrder() : SLNet::SystemAddress
  • GetPtr() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetPunchthroughConfiguration() : SLNet::NatPunchthroughClient
  • GetRakNetGUID() : SLNet::Connection_RM3
  • GetRakNetSocketFromUserConnectionSocketIndex() : SLNet::RakPeer
  • GetRakPeerInterface() : SLNet::PluginInterface2
  • GetReadOffset() : SLNet::BitStream
  • GetReadyStatus() : SLNet::ReadyEvent
  • GetReceiveBufferSize()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetRecentAverage() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentHighest() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentLowest() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentStandardDeviation() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentSum() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRecentSumOfSquares() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetRefCount()
: SLNet::RakNetSmartPtr< T >
, SLNet::ReferenceCounter
  • GetReferencedReplicaList() : SLNet::ReplicaManager3
  • GetRegisteredCommand() : SLNet::CommandParserInterface
  • GetRemoteServers() : SLNet::CloudServer
  • GetRemoteSystem() : SLNet::RakPeer
  • GetRemoteSystemFromGUID() : SLNet::RakPeer
  • GetRemoteSystemFromSystemAddress() : SLNet::RakPeer
  • GetRemoteSystemHistoryListIndex() : SLNet::VariableDeltaSerializer
  • GetRemoteSystemIndex() : SLNet::RakPeer
  • GetRemoteSystemVariableHistory() : SLNet::VariableDeltaSerializer
  • GetRemoteWaitListSize() : SLNet::ReadyEvent
  • GetRemoveReceiveRate() : SLNet::CCRakNetSlidingWindow
  • GetReplicaAtIndex() : SLNet::ReplicaManager3
  • GetReplicaByNetworkID() : SLNet::ReplicaManager3
  • GetReplicaCount() : SLNet::ReplicaManager3
  • GetReplicasCreatedByGuid() : SLNet::ReplicaManager3
  • GetReplicasCreatedByMe() : SLNet::ReplicaManager3
  • GetRequestComp() : SLNet::CloudServer
  • GetRequestedSpecificTeams() : SLNet::TM_TeamMember
  • GetRequestedTeam() : SLNet::TM_TeamMember
  • GetRequestedTeamCount() : SLNet::TM_TeamMember
  • GetRequestedTeamIndex() : SLNet::TM_TeamMember
  • GetResponse()
: SLNet::HTTPConnection2
, SLNet::EmailSender
  • GetRetransmissionBandwidth() : SLNet::CCRakNetSlidingWindow
  • GetRowByID() : DataStructures::Table
  • GetRowByIndex() : DataStructures::Table
  • GetRowCount() : DataStructures::Table
  • GetRows() : DataStructures::Table
  • GetRTOForRetransmission() : SLNet::CCRakNetSlidingWindow
  • GetRTT() : SLNet::CCRakNetSlidingWindow
  • GetSeed() : SLNet::RakNetRandomSync
  • GetSenderRTOForACK() : SLNet::CCRakNetSlidingWindow
  • GetServerAddress() : SLNet::HTTPConnection
  • GetServerDetails() : SLNet::Rackspace
  • GetServersWithUploadedKeys() : SLNet::CloudServer
  • GetSharedIPGroupDetails() : SLNet::Rackspace
  • GetShortestPath() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • GetSize() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetSizeToAllocate() : SLNet::RakString
  • GetSmallestNonFullTeam() : SLNet::TeamBalancer
  • GetSocket()
: SLNet::RNS2_Berkley
, SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetSockets()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetSocketType() : SLNet::RakNetSocket2
  • GetSortedJoinRequests() : SLNet::TM_World
  • GetSortOrder() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • GetSpanningTree() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • GetSplitMessageProgressInterval()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetState() : SLNet::HTTPConnection
  • GetStatistics()
: SLNet::ReliabilityLayer
, SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetStatisticsList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetSubNetForSocketAndIp() : SLNet::SocketLayer
  • GetSumSinceTime() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetSystemAddress()
: SLNet::Connection_RM3
, SLNet::SocketLayer
  • GetSystemAddress_Old() : SLNet::SocketLayer
  • GetSystemAddressFromGuid()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetSystemAddressFromIndex()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetSystemAddressIPV4() : SLNet::RNS2_Berkley
  • GetSystemAddressIPV4And6() : SLNet::RNS2_Berkley
  • GetSystemCount() : SLNet::MessageFilter
  • GetSystemFilterSet() : SLNet::MessageFilter
  • GetSystemIndex() : SLNet::AddressOrGUID
  • GetSystemIndexFromGuid() : SLNet::RakPeer
  • GetSystemList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • GetTeamByIndex() : SLNet::TM_World
  • GetTeamByNetworkID() : SLNet::TM_World
  • GetTeamCount() : SLNet::TM_World
  • GetTeamIndex() : SLNet::TM_World
  • GetTeamManager() : SLNet::TM_World
  • GetTeamMemberByIndex()
: SLNet::TM_World
, SLNet::TM_Team
  • GetTeamMemberByNetworkID() : SLNet::TM_World
  • GetTeamMemberCount() : SLNet::TM_World
  • GetTeamMemberIDByIndex() : SLNet::TM_World
  • GetTeamMemberIndex() : SLNet::TM_World
  • GetTeamMembers() : SLNet::TM_Team
  • GetTeamMembersCount() : SLNet::TM_Team
  • GetTimeBetweenPackets() : SLNet::ReliabilityLayer
  • GetTimeLastDatagramArrived() : SLNet::ReliabilityLayer
  • GetTimeoutTime()
: SLNet::ReliabilityLayer
, SLNet::RakPeerInterface
, SLNet::RakPeer
  • GetTimeRange() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetTimeToTrackValues() : SLNet::StatisticsHistory::TimeAndValueQueue
  • GetTM_World()
: SLNet::TM_Team
, SLNet::TM_TeamMember
  • GetTotal1() : SLNet::BPSTracker
  • GetTransmissionBandwidth() : SLNet::CCRakNetSlidingWindow
  • GetUnavailablePagesSize() : DataStructures::MemoryPool< MemoryBlockType >
  • GetUniqueKeyList() : SLNet::StatisticsHistory
  • GetUPNPPortMappings() : SLNet::NatPunchthroughClient
  • GetUsedForwardEntries() : SLNet::UDPForwarder
  • GetUserConnectionSocketIndex() : SLNet::RakNetSocket2
  • GetValue() : SLNet::LocklessUint32_t
  • GetVarsWrittenPerRemoteSystemListIndex() : SLNet::VariableDeltaSerializer
  • GetWorldAtIndex() : SLNet::TeamManager
  • GetWorldCount()
: SLNet::TeamManager
, SLNet::ReplicaManager3
  • GetWorldId() : SLNet::TM_World
  • GetWorldIdAtIndex() : SLNet::ReplicaManager3
  • GetWorldIndex()
: SLNet::TM_TeamMember
, SLNet::TM_Team
  • GetWorldWithId() : SLNet::TeamManager
  • GetWriteOffset() : SLNet::BitStream
  • GreaterThan() : SLNet::CCRakNetSlidingWindow
  • GreatestRandResult() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • GridSectorizer() : GridSectorizer
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- h -

  • HandleSocketReceiveFromConnectedPlayer() : SLNet::ReliabilityLayer
  • Has() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • HasBadResponse() : SLNet::HTTPConnection
  • HasCompletedConnectionAttempt()
: SLNet::PacketizedTCP
, SLNet::TCPInterface
  • HasConnection() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • HasConnectionAttemptToUser() : SLNet::NatPunchthroughServer::User
  • HasData() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > , DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • HasEvent() : SLNet::ReadyEvent
  • HasFailedConnectionAttempt()
: SLNet::PacketizedTCP
, SLNet::TCPInterface
  • Hash() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > , SLNet::TwoWayAuthentication
  • HashFile() : CSHA1
  • HasInput() : ThreadPool< InputType, OutputType >
  • HasInputFast() : ThreadPool< InputType, OutputType >
  • HasLostConnection()
: SLNet::PacketizedTCP
, SLNet::TCPInterface
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::TransportInterface
  • HasNewIncomingConnection()
: SLNet::TransportInterface
, SLNet::PacketizedTCP
, SLNet::TCPInterface
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
  • HasOperationOfType() : SLNet::Rackspace
  • HasOutput() : ThreadPool< InputType, OutputType >
  • HasOutputFast() : ThreadPool< InputType, OutputType >
  • HasRead() : SLNet::HTTPConnection
  • HasReplicaConstructed() : SLNet::Connection_RM3
  • HasRequestedTeam() : SLNet::TM_TeamMember
  • HasResponse() : SLNet::HTTPConnection2
  • HasSavedSearchResult() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • Heap() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • HeapChannelAndData() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData
  • HeapNode() : DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode
  • Height() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • HeightRecursive() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • HMAC() : CSHA1
  • HTTPConnection() : SLNet::HTTPConnection
  • HTTPConnection2() : SLNet::HTTPConnection2
  • HuffmanEncodingTree() : SLNet::HuffmanEncodingTree
  • HuffmanEncodingTreeFactory() : SLNet::HuffmanEncodingTreeFactory
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- i -

  • IDTOString() : SLNet::PacketLogger
  • IgnoreBits() : SLNet::BitStream
  • IgnoreBytes() : SLNet::BitStream
  • IMPLEMENT_DEFAULT_COMPARISON()
: DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • Increment() : SLNet::LocklessUint32_t
  • IncrementalReadInterface() : SLNet::IncrementalReadInterface
  • IncrementExternalAttemptCount() : SLNet::NatPunchthroughClient
  • IncrementNextSendReceipt()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • IncrementReadOffset() : DataStructures::ByteQueue
  • Init()
: SLNet::HTTPConnection
, SLNet::CCRakNetSlidingWindow
, GridSectorizer
  • InitEvent() : SLNet::SignaledEvent
  • InitializeSecurity()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • InitPage() : DataStructures::MemoryPool< MemoryBlockType >
  • InputSize() : ThreadPool< InputType, OutputType >
  • Insert()
: DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::List< list_type >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::RangeList< range_type >
  • InsertAtEnd() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • InsertAtIndex() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > , DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • InsertBranchDown() : DataStructures::BPlusTree< KeyType, DataType, order >
  • InsertInOrderedList() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • InsertIntoNode() : DataStructures::BPlusTree< KeyType, DataType, order >
  • InsertShiftArrayRight() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • Instance()
: SLNet::StringCompressor
, SLNet::StringTable
  • Interpolate() : SLNet::StatisticsHistory::TimeAndValueQueue
  • InterruptSignal() : SLNet::RPC4
  • InvokeSignal() : SLNet::RPC4
  • IPAddressMatch() : SLNet::RakString
  • IsActive()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • IsBanned()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • IsBerkleySocket() : SLNet::RakNetSocket2
  • IsBigEndian() : SLNet::BitStream
  • IsBusy()
: SLNet::HTTPConnection
, SLNet::HTTPConnection2
  • IsCompleted() : SLNet::DynDNS
  • IsConnected() : SLNet::HTTPConnection2
  • IsDeadConnection() : SLNet::ReliabilityLayer
  • IsEmailAddress() : SLNet::RakString
  • IsEmpty()
: DataStructures::Queue< queue_type >
, DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, SLNet::RakString
, SLNet::RakWString
  • IsEventCompleted() : SLNet::ReadyEvent
  • IsEventCompletedByIndex() : SLNet::ReadyEvent
  • IsEventCompletionProcessing() : SLNet::ReadyEvent
  • IsEventSet() : SLNet::ReadyEvent
  • IsHandlerActive() : SLNet::FileListTransfer
  • IsIn()
: DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
  • IsInProgress() : SLNet::NatTypeDetectionClient
  • IsInSecurityExceptionList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • IsInSlowStart() : SLNet::CCRakNetSlidingWindow
  • IsInvalid() : DataStructures::HashIndex
  • IsInWaitList() : SLNet::ReadyEvent
  • IsLANAddress() : SLNet::SystemAddress
  • IsLocalIP()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • IsLoopback() : SLNet::SystemAddress
  • IsLoopbackAddress() : SLNet::RakPeer
  • IsNetworkOrder() : SLNet::BitStream
  • IsNetworkOrderInternal() : SLNet::BitStream
  • IsNetworkSimulatorActive()
: SLNet::ReliabilityLayer
, SLNet::RakPeerInterface
, SLNet::RakPeer
  • IsNotUploaded() : SLNet::CloudServer::CloudDataList
  • IsNull() : SLNet::RakNetSmartPtr< T >
  • IsOnTeam() : SLNet::TM_TeamMember
  • IsOutgoingDataWaiting() : SLNet::ReliabilityLayer
  • IsPastEndOfList() : SLNet::VariableListDeltaTracker
  • IsPortInUse() : SLNet::IRNS2_Berkley
  • IsRunning() : SLNet::DynDNS
  • IsSorted() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • IsUndefined() : SLNet::AddressOrGUID
  • IsUnique() : SLNet::RakNetSmartPtr< T >
  • IsUnused()
: SLNet::CloudServer::CloudData
, SLNet::CloudServer::CloudDataList
, SLNet::CloudServer::RemoteCloudClient
  • IsWithinRange() : DataStructures::RangeList< range_type >
  • IsWorking() : ThreadPool< InputType, OutputType >
  • ItemAtIndex() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- j -

  • JoinAnyTeam() : SLNet::TM_World
  • JoinAnyTeamCheck() : SLNet::TM_TeamMember
  • JoinGroup() : SLNet::RelayPlugin
  • JoinGroupRequest() : SLNet::RelayPlugin
  • JoinRequestHelperComp() : SLNet::TM_World
  • JoinSpecificTeam() : SLNet::TM_World
  • JoinSpecificTeamCheck() : SLNet::TM_TeamMember
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- k -

  • KeyAtIndex() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • KeyDataListComp() : SLNet::CloudServer
  • KeyDataPtrComp() : SLNet::CloudServer
  • KeySubscriberIDComp() : SLNet::CloudServer
  • KickExcessMembers() : SLNet::TM_World
  • KillConnection() : SLNet::ReliabilityLayer
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- l -

  • LastSerializationResult() : SLNet::LastSerializationResult
  • LeaveAllTeams() : SLNet::TM_TeamMember
  • LeaveGroup() : SLNet::RelayPlugin
  • LeaveTeam()
: SLNet::TM_TeamMember
, SLNet::TM_Team
  • LeaveTeamCheck() : SLNet::TM_TeamMember
  • LeftChild() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • LessThan() : SLNet::CCRakNetSlidingWindow
  • LevelOrderTraversal() : DataStructures::Tree< TreeType >
  • LinkedList() : DataStructures::LinkedList< LinkedListType >
  • List() : DataStructures::List< list_type >
  • ListFlavors() : SLNet::Rackspace
  • ListImages() : SLNet::Rackspace
  • ListMissingOrChangedFiles() : SLNet::FileList
  • ListParsers() : SLNet::ConsoleServer
  • ListServerAddresses() : SLNet::Rackspace
  • ListServers() : SLNet::Rackspace
  • ListServersWithDetails() : SLNet::Rackspace
  • ListSharedIPGroups() : SLNet::Rackspace
  • ListSharedIPGroupsWithDetails() : SLNet::Rackspace
  • LocalCallbackComp() : SLNet::RPC4
  • LocalSlotObject() : SLNet::RPC4::LocalSlotObject
  • LocalSlotObjectComp() : SLNet::RPC4
  • Lock() : SLNet::SimpleMutex
  • LockInput() : ThreadPool< InputType, OutputType >
  • LocklessUint32_t() : SLNet::LocklessUint32_t
  • LockMutex() : SLNet::RakString
  • LockOutput() : ThreadPool< InputType, OutputType >
  • LogCommandParser() : SLNet::LogCommandParser
  • LogConnectionAttempts() : SLNet::NatPunchthroughServer::User
  • LogHeader() : SLNet::PacketLogger
  • LoginToCoordinator() : SLNet::UDPProxyServer
  • LogStringNotFound() : SLNet::StringTable
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- m -

  • MakeFilePath() : SLNet::RakString
  • Map() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • MapNode() : DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode
  • MemoryPool() : DataStructures::MemoryPool< MemoryBlockType >
  • MergeAllObjectsOnKey() : SLNet::StatisticsHistory
  • MergeSets() : SLNet::StatisticsHistory::TimeAndValueQueue
  • MessageFilter() : SLNet::MessageFilter
  • MLKeyRef() : DataStructures::MLKeyRef< templateType >
  • MoveMemberThatWantsToJoinTeam() : SLNet::TeamBalancer
  • MoveMemberThatWantsToJoinTeamInternal() : SLNet::TeamBalancer
  • Multilist() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- n -

  • NatPunchthroughClient() : SLNet::NatPunchthroughClient
  • NatPunchthroughDebugInterface() : SLNet::NatPunchthroughDebugInterface
  • NatPunchthroughDebugInterface_PacketLogger() : SLNet::NatPunchthroughDebugInterface_PacketLogger
  • NatPunchthroughServer() : SLNet::NatPunchthroughServer
  • NatPunchthroughServerDebugInterface() : SLNet::NatPunchthroughServerDebugInterface
  • NatPunchthroughServerDebugInterface_PacketLogger() : SLNet::NatPunchthroughServerDebugInterface_PacketLogger
  • NatPunchthroughUserComp() : SLNet::NatPunchthroughServer
  • NatTypeDetectionClient() : SLNet::NatTypeDetectionClient
  • NatTypeDetectionServer() : SLNet::NatTypeDetectionServer
  • NetworkIDManager() : SLNet::NetworkIDManager
  • NetworkIDObject() : SLNet::NetworkIDObject
  • NetworkIDToHashIndex() : SLNet::NetworkIDManager
  • Node() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node
  • NodeComparisonFunc() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • NonceGenerator() : SLNet::TwoWayAuthentication::NonceGenerator
  • NonVariadic() : SLNet::RakString
  • NoTeam() : SLNet::TeamSelection
  • NotifyAndFlagForShutdown() : SLNet::RakPeer
  • NotifyClientSubscribersOfDataChange() : SLNet::CloudServer
  • NotifyNoTeam() : SLNet::TeamBalancer
  • NotifyServerSubscribersOfDataChange() : SLNet::CloudServer
  • NotifyTeamAssigment() : SLNet::TeamBalancer
  • NotifyTeamsLocked() : SLNet::TeamBalancer
  • NotifyTeamSwitchPending() : SLNet::TeamBalancer
  • NotifyUsersInRoom() : SLNet::RelayPlugin
  • NumberOfConnections()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • NumberOfLeadingZeroes() : SLNet::BitStream
  • NumThreadsWorking() : ThreadPool< InputType, OutputType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- o -

  • OnAck()
: SLNet::CCRakNetSlidingWindow
, SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnAddFilesFromDirectoryStarted()
: SLNet::FileListProgress
, SLNet::FLP_Printf
  • OnAddToRequestedTeams() : SLNet::TeamManager
  • OnAllServersBusy() : SLNet::UDPProxyClientResultHandler
  • OnAlreadyLoggedIn() : SLNet::UDPProxyServerResultHandler
  • OnAttach()
: SLNet::NatPunchthroughClient
, SLNet::PluginInterface2
, SLNet::RPC4
, SLNet::TeamBalancer
, SLNet::UDPProxyServer
  • OnAuthenticationResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnCancelTeamRequest() : SLNet::TeamBalancer
  • OnClientMessage()
: SLNet::NatPunchthroughDebugInterface
, SLNet::NatPunchthroughDebugInterface_Printf
, SLNet::NatPunchthroughDebugInterface_PacketLogger
  • OnClientReady() : SLNet::NatPunchthroughServer
  • OnClosedConnection()
: SLNet::ReadyEvent
, SLNet::RelayPlugin
, SLNet::ReplicaManager3
, SLNet::Router2
, SLNet::StatisticsHistoryPlugin
, SLNet::TeamBalancer
, SLNet::TM_World
, SLNet::TeamManager
, SLNet::RakNetTransport2
, SLNet::TwoWayAuthentication
, SLNet::CloudServer
, SLNet::UDPProxyCoordinator
, SLNet::UDPProxyServer
, SLNet::ConnectionGraph2
, SLNet::FileListTransfer
, SLNet::HTTPConnection2
, SLNet::MessageFilter
, SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::PluginInterface2
, SLNet::Rackspace
  • OnCommand()
: SLNet::RakNetCommandParser
, SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • OnCompletion() : SLNet::NatTypeDetectionClient
  • OnConfirmResizedServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnConnectAtTime() : SLNet::NatPunchthroughClient
  • OnConnectedPong() : SLNet::RakPeer
  • OnConnectionAttemptFailure()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnConnectionLost()
: SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • OnConnectionRequest() : SLNet::RakPeer
  • OnConstruction() : SLNet::ReplicaManager3
  • OnConstructToThisConnection() : SLNet::Connection_RM3
  • OnCreateImageResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnCreateServerResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnCreateSharedIPGroup()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDeleteImageResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDeleteServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDeleteServerAddress()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDeleteSharedIPGroup()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnDereference()
: SLNet::FileListTransferCBInterface
, SLNet::Connection_RM3
  • OnDetach()
: SLNet::NatPunchthroughClient
, SLNet::NatTypeDetectionClient
, SLNet::PluginInterface2
, SLNet::ReplicaManager3
, SLNet::UDPProxyServer
  • OnDetectionRequest() : SLNet::NatTypeDetectionServer
  • OnDirectory()
: SLNet::FileListProgress
, SLNet::FLP_Printf
  • OnDirectSocketReceive()
: SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnDirectSocketSend()
: SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnDoNotQueryDestruction() : SLNet::Connection_RM3
  • OnDownloadComplete()
: SLNet::FileListTransferCBInterface
, SLNet::ReplicaManager3
  • OnDownloadExisting() : SLNet::Connection_RM3
  • OnDownloadFromOtherSystem() : SLNet::Connection_RM3
  • OnDownloadFromThisSystem() : SLNet::Connection_RM3
  • OnDownloadRequest() : SLNet::DirectoryDeltaTransfer
  • OnDownloadStarted() : SLNet::ReplicaManager3
  • OnDuplicateAck() : SLNet::CCRakNetSlidingWindow
  • OnFailedConnectionAttempt()
: SLNet::HTTPConnection2
, SLNet::PluginInterface2
, SLNet::Router2
  • OnFailureNotification() : SLNet::NatPunchthroughClient
  • OnFile()
: SLNet::FileListProgress
, SLNet::FileListTransferCBInterface
  • OnFileProgress() : SLNet::FileListTransferCBInterface
  • OnFilePush() : SLNet::FileListProgress
  • OnFilePushesComplete()
: SLNet::FileListProgress
, SLNet::FLP_Printf
  • OnForwardingInProgress() : SLNet::UDPProxyClientResultHandler
  • OnForwardingNotification() : SLNet::UDPProxyClientResultHandler
  • OnForwardingReplyFromServerToCoordinator() : SLNet::UDPProxyCoordinator
  • OnForwardingRequestFromClientToCoordinator() : SLNet::UDPProxyCoordinator
  • OnForwardingRequestFromCoordinatorToServer() : SLNet::UDPProxyServer
  • OnForwardingSuccess()
: SLNet::Router2
, SLNet::UDPProxyClientResultHandler
  • OnGet() : SLNet::CloudClientCallback
  • OnGetFlavorDetailsResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnGetImageDetailsResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnGetMostRecentPort()
: SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
  • OnGetReponse() : SLNet::CloudClient
  • OnGetRequest()
: SLNet::CloudServerQueryFilter
, SLNet::CloudServer
  • OnGetServerDetails()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnGetSharedIPGroupDetails()
: SLNet::RackspaceEventCallback_Default
, SLNet::Rackspace2EventCallback
  • OnGotPacket() : SLNet::CCRakNetSlidingWindow
  • OnGotPacketPair() : SLNet::CCRakNetSlidingWindow
  • OnGroupMessageFromClient() : SLNet::RelayPlugin
  • OnHashedNonceAndPassword() : SLNet::TwoWayAuthentication
  • OnInternalPacket()
: SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnInvalidMessage() : SLNet::MessageFilter
  • OnJoinAnyTeam() : SLNet::TeamManager
  • OnJoinGroupRequestFromClient() : SLNet::RelayPlugin
  • OnJoinRequestedTeam() : SLNet::TeamManager
  • OnLeaveGroupRequestFromClient() : SLNet::RelayPlugin
  • OnLeaveTeam() : SLNet::TeamManager
  • OnListFlavorsResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListImagesResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListServerAddresses()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListServersResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListServersWithDetailsResult()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListSharedIPGroups()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnListSharedIPGroupsWithDetails()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnLocalReference() : SLNet::Connection_RM3
  • OnLoginRequestFromServerToCoordinator() : SLNet::UDPProxyCoordinator
  • OnLoginSuccess() : SLNet::UDPProxyServerResultHandler
  • OnMessageReceipt() : SLNet::VariableDeltaSerializer
  • OnMiniPunchReply() : SLNet::Router2
  • OnMiniPunchReplyBounce() : SLNet::Router2
  • OnNAK() : SLNet::CCRakNetSlidingWindow
  • OnNATPunchthroughRequest() : SLNet::NatPunchthroughServer
  • OnNeverConstruct() : SLNet::Connection_RM3
  • OnNeverSerialize() : SLNet::Connection_RM3
  • OnNewConnection()
: SLNet::ConnectionGraph2
, SLNet::HTTPConnection2
, SLNet::MessageFilter
, SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::PluginInterface2
, SLNet::ReplicaManager3
, SLNet::StatisticsHistoryPlugin
, SLNet::TM_World
, SLNet::TeamManager
, SLNet::RakNetTransport2
  • OnNewIncomingConnection()
: SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • OnNonceReply() : SLNet::TwoWayAuthentication
  • OnNonceRequest() : SLNet::TwoWayAuthentication
  • OnNoPasswordSet() : SLNet::UDPProxyServerResultHandler
  • OnNoServersOnline() : SLNet::UDPProxyClientResultHandler
  • OnPasswordResult() : SLNet::TwoWayAuthentication
  • OnPingServers() : SLNet::UDPProxyClient
  • OnPingServersReplyFromClientToCoordinator() : SLNet::UDPProxyCoordinator
  • OnPoppedConnection()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • OnPostRequest()
: SLNet::CloudServerQueryFilter
, SLNet::CloudServer
  • OnPreSerializeTick() : SLNet::VariableDeltaSerializer
  • OnPunchthroughFailure() : SLNet::NatPunchthroughClient
  • OnPushBackPacket()
: SLNet::PacketLogger
, SLNet::PluginInterface2
  • OnQueryForwarding() : SLNet::Router2
  • OnQueryForwardingReply() : SLNet::Router2
  • OnRakPeerShutdown()
: SLNet::CloudServer
, SLNet::FileListTransfer
, SLNet::NatPunchthroughClient
, SLNet::NatTypeDetectionClient
, SLNet::PluginInterface2
, SLNet::ReadyEvent
, SLNet::ReplicaManager3
, SLNet::Router2
, SLNet::TwoWayAuthentication
, SLNet::UDPProxyClient
, SLNet::UDPProxyServer
  • OnRakPeerStartup()
: SLNet::PluginInterface2
, SLNet::UDPProxyServer
  • OnReadyEventForceAllSet() : SLNet::ReadyEvent
  • OnReadyEventPacketUpdate() : SLNet::ReadyEvent
  • OnReadyEventQuery() : SLNet::ReadyEvent
  • OnReadyForNextPunchthrough() : SLNet::NatPunchthroughClient
  • OnRebootServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnRebuildServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnReceive()
: SLNet::TeamManager
, SLNet::UDPProxyCoordinator
, SLNet::CloudClient
, SLNet::ReplicaManager3
, SLNet::CloudServer
, SLNet::ConnectionGraph2
, SLNet::DirectoryDeltaTransfer
, SLNet::FileListTransfer
, SLNet::HTTPConnection2
, SLNet::MessageFilter
, SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::PluginInterface2
, SLNet::Rackspace
, SLNet::ReadyEvent
, SLNet::RelayPlugin
, SLNet::Router2
, SLNet::RPC4
, SLNet::TeamBalancer
, SLNet::RakNetTransport2
, SLNet::TwoWayAuthentication
, SLNet::UDPProxyClient
, SLNet::UDPProxyServer
  • OnRecipientNotConnected() : SLNet::UDPProxyClientResultHandler
  • OnReferencePush() : SLNet::FileListTransfer
  • OnReferencePushAck() : SLNet::FileListTransfer
  • OnReleaseRequest()
: SLNet::CloudServerQueryFilter
, SLNet::CloudServer
  • OnReliabilityLayerNotification()
: SLNet::PluginInterface2
, SLNet::PacketLogger
  • OnRemoveFromRequestedTeams() : SLNet::TeamManager
  • OnRemoveFromTeamsRequestedAndAddTeam() : SLNet::TeamManager
  • OnRemoveSubscribedKeyFromServers() : SLNet::CloudServer
  • OnRemoveUploadedKeyFromServers() : SLNet::CloudServer
  • OnReplicaAlreadyExists() : SLNet::Connection_RM3
  • OnRequestAnyTeam() : SLNet::TeamBalancer
  • OnRequestedTeamChangePending() : SLNet::TeamBalancer
  • OnRequestForwarding() : SLNet::Router2
  • OnRequestSpecificTeam() : SLNet::TeamBalancer
  • OnRerouted() : SLNet::Router2
  • OnResend() : SLNet::CCRakNetSlidingWindow
  • OnResizeServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnRevertResizedServer()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnRNS2Recv()
: SLNet::NatTypeDetectionServer
, SLNet::RakPeer
, SLNet::RNS2EventHandler
, SLNet::NatTypeDetectionClient
  • OnSendAborted()
: SLNet::FLP_Printf
, SLNet::FileListProgress
  • OnSendAck() : SLNet::CCRakNetSlidingWindow
  • OnSendAckGetBAndAS() : SLNet::CCRakNetSlidingWindow
  • OnSendBytes() : SLNet::CCRakNetSlidingWindow
  • OnSendDestructionFromQuery() : SLNet::Connection_RM3
  • OnSendNACK() : SLNet::CCRakNetSlidingWindow
  • OnSendSubscribedKeyToServers() : SLNet::CloudServer
  • OnSendUploadedAndSubscribedKeysToServer() : SLNet::CloudServer
  • OnSendUploadedKeyToServers() : SLNet::CloudServer
  • OnSerialize() : SLNet::ReplicaManager3
  • OnSerializeTransmission()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • OnServerDataChanged() : SLNet::CloudServer
  • OnServerMessage()
: SLNet::NatPunchthroughServerDebugInterface
, SLNet::NatPunchthroughServerDebugInterface_Printf
, SLNet::NatPunchthroughServerDebugInterface_PacketLogger
  • OnServerToServerGetRequest() : SLNet::CloudServer
  • OnServerToServerGetResponse() : SLNet::CloudServer
  • OnSetBalanceTeams() : SLNet::TeamManager
  • OnSetBalanceTeamsInitial() : SLNet::TeamManager
  • OnSetJoinPermissions() : SLNet::TeamManager
  • OnSetMemberLimit() : SLNet::TeamManager
  • OnShareServerAddress()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnStatusUpdateToNewHost() : SLNet::TeamBalancer
  • OnSubscriptionNotification()
: SLNet::CloudClient
, SLNet::CloudClientCallback
  • OnTeamAssigned() : SLNet::TeamBalancer
  • OnTeamsLocked() : SLNet::TeamBalancer
  • OnTestPortRestricted() : SLNet::NatTypeDetectionClient
  • OnTransportChange()
: SLNet::LogCommandParser
, SLNet::CommandParserInterface
  • OnUnsubscribeRequest()
: SLNet::CloudServerQueryFilter
, SLNet::CloudServer
  • OnUpdateListsToNoTeam() : SLNet::TeamManager
  • OnUpdateServerNameOrPassword()
: SLNet::Rackspace2EventCallback
, SLNet::RackspaceEventCallback_Default
  • OnUpdateTeamsRequestedToAny() : SLNet::TeamManager
  • OnUpdateTeamsRequestedToNoneAndAddTeam() : SLNet::TeamManager
  • OnUserReplicaPreSerializeTick()
: SLNet::Replica3Composite< parent_type >
, SLNet::Replica3
  • OnWrongPassword() : SLNet::UDPProxyServerResultHandler
  • OpenNAT() : SLNet::NatPunchthroughClient
  • operator const char *() : SLNet::RakString
  • operator int() : SLNet::HTTPConnection::BadResponse
  • operator uint32_t() : SLNet::uint24_t
  • operator wchar_t *() : SLNet::RakWString
  • operator!=()
: SLNet::RakNetSmartPtr< T >
, SLNet::RakString
, SLNet::RakWString
, SLNet::uint24_t
, SLNet::RakString
, SLNet::SystemAddress
, SLNet::uint24_t
, SLNet::PRO
, SLNet::RakNetGUID
  • operator&() : SLNet::uint24_t
  • operator*()
: SLNet::RakNetSmartPtr< T >
, SLNet::uint24_t
, SLNet::RakNetSmartPtr< T >
  • operator+() : SLNet::uint24_t
  • operator++()
: DataStructures::LinkedList< LinkedListType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::LinkedList< LinkedListType >
, SLNet::uint24_t
, DataStructures::CircularLinkedList< CircularLinkedListType >
, SLNet::uint24_t
  • operator+=()
: SLNet::RakString
, SLNet::uint24_t
, SLNet::RakWString
, SLNet::uint24_t
, SLNet::RakWString
, SLNet::RakNetStatistics
, SLNet::RakString
  • operator-() : SLNet::uint24_t
  • operator--()
: DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::LinkedList< LinkedListType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, SLNet::uint24_t
, DataStructures::LinkedList< LinkedListType >
, SLNet::uint24_t
  • operator-=() : SLNet::uint24_t
  • operator->() : SLNet::RakNetSmartPtr< T >
  • operator/() : SLNet::uint24_t
  • operator<()
: SLNet::RakNetSmartPtr< T >
, SLNet::SystemAddress
, SLNet::RakWString
, SLNet::uint24_t
, DataStructures::MLKeyRef< templateType >
, SLNet::RakString
, SLNet::RakNetGUID
  • operator<=() : SLNet::RakString , SLNet::RakWString
  • operator=()
: DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, SLNet::RakNetGUID
, SLNet::AddressOrGUID
, DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::List< list_type >
, DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, SLNet::uint24_t
, DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::LinkedList< LinkedListType >
, SLNet::HTTPConnection
, SLNet::RakWString
, DataStructures::CircularLinkedList< CircularLinkedListType >
, SLNet::RakString
, DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode
, SLNet::RakString
, SLNet::AddressOrGUID
, SLNet::RakWString
, SLNet::AddressOrGUID
, SLNet::RakWString
, SLNet::RakString
, DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
, SLNet::RakString
, SLNet::uint24_t
, SLNet::RakNetSmartPtr< T >
, SLNet::RakWString
, SLNet::SystemAddress
, SLNet::RakWString
, DataStructures::Table
, SLNet::StatisticsHistory::TimeAndValueQueue
, DataStructures::QueueLinkedList< QueueType >
, DataStructures::Table::Cell
, SLNet::RakString
, SLNet::RakWString
, SLNet::RakString
, DataStructures::Queue< queue_type >
  • operator==()
: SLNet::RakString
, SLNet::RakNetGUID
, SLNet::SystemAddress
, SLNet::uint24_t
, SLNet::RakNetSmartPtr< T >
, DataStructures::MLKeyRef< templateType >
, SLNet::RakString
, SLNet::AddressOrGUID
, SLNet::PRO
, SLNet::RakString
, SLNet::RakWString
, SLNet::uint24_t
  • operator>()
: SLNet::RakNetGUID
, SLNet::RakNetSmartPtr< T >
, DataStructures::MLKeyRef< templateType >
, SLNet::RakWString
, SLNet::SystemAddress
, SLNet::uint24_t
, SLNet::RakString
  • operator>=() : SLNet::RakString , SLNet::RakWString
  • operator[]()
: SLNet::RakString
, DataStructures::Queue< queue_type >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::List< list_type >
  • OrderedChannelHeap() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • OrderedList() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • OrderRemainingServersToTry() : SLNet::UDPProxyCoordinator::ForwardingRequest
  • OutputSize() : ThreadPool< InputType, OutputType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- p -

  • PacketConsoleLogger() : SLNet::PacketConsoleLogger
  • PacketFileLogger() : SLNet::PacketFileLogger
  • PacketizedTCP() : SLNet::PacketizedTCP
  • PacketLogger() : SLNet::PacketLogger
  • PacketOutputWindowLogger() : SLNet::PacketOutputWindowLogger
  • PadWithZeroToByteLength() : SLNet::BitStream
  • Parent() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • ParseConnectionRequestPacket() : SLNet::RakPeer
  • ParseConsoleString() : SLNet::CommandParserInterface
  • Pause() : ThreadPool< InputType, OutputType >
  • Peek()
: DataStructures::Queue< queue_type >
, DataStructures::QueueLinkedList< QueueType >
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • PeekContiguousBytes() : DataStructures::ByteQueue
  • PeekOpposite() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • PeekTail() : DataStructures::Queue< queue_type >
  • PeekWeight() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • PerThreadDestructor() : ThreadDataInterface
  • PerThreadFactory() : ThreadDataInterface
  • Ping()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • PingInternal() : SLNet::RakPeer
  • PluginInterface2() : SLNet::PluginInterface2
  • Pop()
: DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::List< list_type >
, DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::Queue< queue_type >
, DataStructures::QueueLinkedList< QueueType >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • PopBufferedPacket() : SLNet::RakPeer
  • PopConnection() : SLNet::ReplicaManager3
  • PopDeref() : DataStructures::Queue< queue_type >
  • PopInaccurate() : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • PopOpposite() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • PopTail() : DataStructures::Queue< queue_type >
  • PopulateDataFromDisk() : SLNet::FileList
  • PositionCrossesCells() : GridSectorizer
  • Post()
: SLNet::CloudClient
, SLNet::HTTPConnection
  • PostDeserializeConstruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • PostDeserializeConstructionExisting()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • PostSerializeConstruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • PostSerializeConstructionExisting()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • Preallocate() : DataStructures::List< list_type >
  • PreDestruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • Print()
: DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
, DataStructures::ByteQueue
  • PrintBits() : SLNet::BitStream
  • PrintChannels() : SLNet::LogCommandParser
  • PrintColumnHeaders() : DataStructures::Table
  • Printf()
: SLNet::RakString
, SLNet::RakWString
  • PrintGraph() : DataStructures::BPlusTree< KeyType, DataType, order >
  • PrintHex() : SLNet::BitStream
  • PrintLeaf() : DataStructures::BPlusTree< KeyType, DataType, order >
  • PrintLeaves() : DataStructures::BPlusTree< KeyType, DataType, order >
  • PrintRow() : DataStructures::Table
  • ProcessAndTransmitGetRequest() : SLNet::CloudServer
  • ProcessCloudQueryWithAddresses() : SLNet::CloudServer
  • ProcessTCPPacket() : SLNet::HTTPConnection
  • ProcessTeamAssigned() : SLNet::TeamManager
  • PunchthroughConfiguration() : SLNet::PunchthroughConfiguration
  • Push()
: DataStructures::QueueLinkedList< QueueType >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::Heap< weight_type, data_type, isMaxHeap >
, DataStructures::Queue< queue_type >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::List< list_type >
  • Push1() : SLNet::BPSTracker
  • PushAtHead()
: DataStructures::Queue< queue_type >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • PushBackPacket()
: SLNet::RakPeerInterface
, SLNet::RakPeer
, SLNet::TCPInterface
  • PushBackPacketUnified() : SLNet::PluginInterface2
  • PushBitStream() : SLNet::TeamManager
  • PushBufferedPacket() : SLNet::RakPeer
  • PushCompletionPacket() : SLNet::ReadyEvent
  • PushConnection() : SLNet::ReplicaManager3
  • PushFailure() : SLNet::NatPunchthroughClient
  • PushNotificationsToQueues() : SLNet::PacketizedTCP
  • PushOpposite() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • PushSeries() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • PushSuccess() : SLNet::NatPunchthroughClient
  • PushTeamAssigned() : SLNet::TeamManager
  • PushToUser() : SLNet::TwoWayAuthentication
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- q -

  • QSortAscending() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • QSortDescending() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • QueryActionOnPopConnection()
: SLNet::Replica3Composite< parent_type >
, SLNet::Replica3
  • QueryActionOnPopConnection_Client() : SLNet::Replica3
  • QueryActionOnPopConnection_PeerToPeer() : SLNet::Replica3
  • QueryActionOnPopConnection_Server() : SLNet::Replica3
  • QueryConstruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • QueryConstruction_ClientConstruction() : SLNet::Replica3
  • QueryConstruction_PeerToPeer() : SLNet::Replica3
  • QueryConstruction_ServerConstruction() : SLNet::Replica3
  • QueryConstructionMode() : SLNet::Connection_RM3
  • QueryDestruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • QueryGroupDownloadMessages() : SLNet::Connection_RM3
  • QueryRelayDestruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • QueryRemoteConstruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • QueryRemoteConstruction_ClientConstruction() : SLNet::Replica3
  • QueryRemoteConstruction_PeerToPeer() : SLNet::Replica3
  • QueryRemoteConstruction_ServerConstruction() : SLNet::Replica3
  • QueryReplicaList() : SLNet::Connection_RM3
  • QueryRow() : DataStructures::Table
  • QuerySerialization()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • QuerySerialization_ClientSerializable() : SLNet::Replica3
  • QuerySerialization_PeerToPeer() : SLNet::Replica3
  • QuerySerialization_ServerSerializable() : SLNet::Replica3
  • QuerySerializationList() : SLNet::Connection_RM3
  • QueryTable() : DataStructures::Table
  • Queue() : DataStructures::Queue< queue_type >
  • QueueLinkedList() : DataStructures::QueueLinkedList< QueueType >
  • QueueOpenNAT() : SLNet::NatPunchthroughClient
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- r -

  • Rackspace() : SLNet::Rackspace
  • Rackspace2EventCallback() : SLNet::Rackspace2EventCallback
  • RAK_THREAD_DECLARATION()
: SLNet::RakPeer
, ThreadPool< InputType, OutputType >
, SLNet::UDPForwarder
, SLNet::RNS2_Berkley
, SLNet::RakPeer
, SLNet::TCPInterface
  • RakNetCommandParser() : SLNet::RakNetCommandParser
  • RakNetGUID() : SLNet::RakNetGUID
  • RakNetRandom() : SLNet::RakNetRandom
  • RakNetRandomSync() : SLNet::RakNetRandomSync
  • RakNetSmartPtr() : SLNet::RakNetSmartPtr< T >
  • RakNetSocket2() : SLNet::RakNetSocket2
  • RakNetTransport2() : SLNet::RakNetTransport2
  • RakPeer() : SLNet::RakPeer
  • RakString() : SLNet::RakString
  • RakStringComp() : SLNet::RakString
  • RakWString() : SLNet::RakWString
  • RandomMT()
: SLNet::RakNetRandom
, SLNet::RakNetRandomSync
  • RangeList() : DataStructures::RangeList< range_type >
  • RangeNode() : DataStructures::RangeNode< range_type >
  • RangeSum() : DataStructures::RangeList< range_type >
  • Read()
: SLNet::BitStream
, SLNet::HTTPConnection
, SLNet::BitStream
  • ReadAlignedBytes() : SLNet::BitStream
  • ReadAlignedBytesSafe() : SLNet::BitStream
  • ReadAlignedBytesSafeAlloc() : SLNet::BitStream
  • ReadAlignedVar16() : SLNet::BitStream
  • ReadAlignedVar32() : SLNet::BitStream
  • ReadAlignedVar8() : SLNet::BitStream
  • ReadBit() : SLNet::BitStream
  • ReadBits() : SLNet::BitStream
  • ReadBitsFromIntegerRange() : SLNet::BitStream
  • ReadBytes() : DataStructures::ByteQueue
  • ReadCasted() : SLNet::BitStream
  • ReadCompressed() : SLNet::BitStream
  • ReadCompressedDelta() : SLNet::BitStream
  • ReadDelta() : SLNet::BitStream
  • ReadFloat16() : SLNet::BitStream
  • ReadIntFromSubstring() : SLNet::RakString
  • ReadIsLocked() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • ReadLine() : SLNet::Rackspace
  • ReadLock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • ReadNormQuat() : SLNet::BitStream
  • ReadNormVector() : SLNet::BitStream
  • ReadOrthMatrix() : SLNet::BitStream
  • ReadUnlock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • ReadVarFromBitstream() : SLNet::VariableListDeltaTracker
  • ReadVector() : SLNet::BitStream
  • ReadyEvent() : SLNet::ReadyEvent
  • ReadyEventNodeComp() : SLNet::ReadyEvent
  • Realloc() : SLNet::RakString
  • Reallocate() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ReallocateIfNeeded() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ReallocToSize() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ReassembleLine() : SLNet::TelnetTransport
  • RebootServer() : SLNet::Rackspace
  • RebuildServer() : SLNet::Rackspace
  • Receive()
: SLNet::PacketizedTCP
, SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::ReliabilityLayer
, SLNet::TCPInterface
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::TransportInterface
  • ReceiveHasPackets() : SLNet::TCPInterface
  • ReceiveInt() : SLNet::TCPInterface
  • Recv() : SLNet::RemoteClient
  • RecvFrom() : SLNet::UDPForwarder
  • RecvFromBlocking() : SLNet::RNS2_Berkley
  • RecvFromBlockingIPV4() : SLNet::RNS2_Berkley
  • RecvFromBlockingIPV4And6() : SLNet::RNS2_Berkley
  • RecvFromLoopInt() : SLNet::RNS2_Berkley
  • RefCountedObj() : RefCountedObj
  • Reference() : SLNet::ReplicaManager3
  • ReferenceCounter() : SLNet::ReferenceCounter
  • ReferenceInternal() : SLNet::ReplicaManager3
  • ReferenceRemoteSystem() : SLNet::RakPeer
  • ReferenceTeam() : SLNet::TM_World
  • ReferenceTeamMember() : SLNet::TM_World
  • RegisterBlockingFunction() : SLNet::RPC4
  • RegisterCommand() : SLNet::CommandParserInterface
  • RegisterFunction() : SLNet::RPC4
  • RegisterLocalCallback() : SLNet::RPC4
  • RegisterSlot() : SLNet::RPC4
  • RelayPlugin() : SLNet::RelayPlugin
  • Release()
: SLNet::CloudClient
, DataStructures::BytePool
, DataStructures::MemoryPool< MemoryBlockType >
, SLNet::ReferenceCounter
  • ReleaseKeys() : SLNet::CloudServer
  • ReleaseSockets()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • ReleaseSystem() : SLNet::CloudServer
  • ReliabilityLayer() : SLNet::ReliabilityLayer
  • ReloadMT() : SLNet::RakNetRandom
  • RemoteClient() : SLNet::RemoteClient
  • RemoteServerComp() : SLNet::CloudServer
  • RemoteSystemComp() : SLNet::ConnectionGraph2
  • RemoteSystemCompByGuid() : SLNet::ReadyEvent
  • RemoteSystemLookupHashIndex() : SLNet::RakPeer
  • Remove() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > , DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • RemoveAllQueryFilters() : SLNet::CloudServer
  • RemoveAtIndex()
: DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::List< list_type >
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::Queue< queue_type >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
, DataStructures::Map< key_type, data_type, key_comparison_func >
  • RemoveAtIndexFast() : DataStructures::List< list_type >
  • RemoveAtKey() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • RemoveByGuid() : SLNet::TeamBalancer
  • RemoveCallback()
: SLNet::FileListTransfer
, SLNet::FileList
  • RemoveChannel() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • RemoveCharacter() : SLNet::RakString
  • RemoveColumn() : DataStructures::Table
  • RemoveCommandParser() : SLNet::ConsoleServer
  • RemoveConnection() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • RemoveConnectionRequest() : SLNet::Router2
  • RemoveEventCallback() : SLNet::Rackspace
  • RemoveFromActiveSystemList() : SLNet::RakPeer
  • RemoveFromAllLists() : SLNet::ReadyEvent
  • RemoveFromAllTeamsInternal() : SLNet::TM_TeamMember
  • RemoveFromBanList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • RemoveFromConnectionList() : SLNet::PacketizedTCP
  • RemoveFromEnd()
: DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::List< list_type >
  • RemoveFromFailureQueue() : SLNet::NatPunchthroughClient
  • RemoveFromList() : SLNet::FileListTransfer
  • RemoveFromRequestedTeams() : SLNet::TM_TeamMember
  • RemoveFromSecurityExceptionList()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • RemoveFromSpecificTeamInternal() : SLNet::TM_TeamMember
  • RemoveFromTeamMemberList() : SLNet::TM_Team
  • RemoveFromTeamsRequestedAndAddTeam() : SLNet::TeamManager
  • RemoveFromWaitList() : SLNet::ReadyEvent
  • RemoveIfExists() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • RemoveInputAtIndex() : ThreadPool< InputType, OutputType >
  • RemoveNode() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • RemoveObject() : SLNet::StatisticsHistory
  • RemoveObjectAtIndex() : SLNet::StatisticsHistory
  • RemoveOutputAtIndex() : ThreadPool< InputType, OutputType >
  • RemoveParticipant() : SLNet::TM_World
  • RemoveParticipantOnServer() : SLNet::RelayPlugin
  • RemoveParticipantRequestFromClient() : SLNet::RelayPlugin
  • RemovePendingRequest() : SLNet::HTTPConnection2
  • RemoveQueryFilter() : SLNet::CloudServer
  • RemoveReceiver() : SLNet::FileListTransfer
  • RemoveReference()
: SLNet::StringTable
, SLNet::StringCompressor
  • RemoveRemoteSystemVariableHistory() : SLNet::VariableDeltaSerializer
  • RemoveRow() : DataStructures::Table
  • RemoveRows() : DataStructures::Table
  • RemoveServer() : SLNet::CloudServer
  • RemoveSpecificSubscriber() : SLNet::CloudServer
  • RemoveSubscribedKeyFromServers() : SLNet::CloudServer
  • RemoveSubscriber() : SLNet::CloudServer::CloudDataList
  • RemoveTeamMember() : SLNet::TeamBalancer
  • RemoveUploadedKeyFromServers() : SLNet::CloudServer
  • RemoveWorld()
: SLNet::TeamManager
, SLNet::ReplicaManager3
  • Replace()
: DataStructures::List< list_type >
, SLNet::RakString
, DataStructures::CircularLinkedList< CircularLinkedListType >
  • Replica3() : SLNet::Replica3
  • Replica3LSRComp() : SLNet::Connection_RM3
  • ReplicaManager3() : SLNet::ReplicaManager3
  • ReportHash() : CSHA1
  • ReportHashStl() : CSHA1
  • RequestAnyTeam() : SLNet::TeamBalancer
  • RequestForwarding()
: SLNet::UDPProxyClient
, SLNet::Router2
  • RequestSpecificTeam() : SLNet::TeamBalancer
  • RequestTeam() : SLNet::TM_TeamMember
  • RequestTeamSwitch() : SLNet::TM_TeamMember
  • Reset()
: SLNet::ReliabilityLayer
, CSHA1
, SLNet::BPSTracker
, SLNet::HuffmanEncodingTreeFactory
, SLNet::BitStream
, SLNet::RemoteClient
  • ResetReadPointer() : SLNet::BitStream
  • ResetSendReceipt() : SLNet::RakPeer
  • ResetWritePointer() : SLNet::BitStream
  • ResizeSampleSet() : SLNet::StatisticsHistory::TimeAndValueQueue
  • ResizeServer() : SLNet::Rackspace
  • Resume() : ThreadPool< InputType, OutputType >
  • ReturnFailureOnCannotForward() : SLNet::Router2
  • ReturnOutgoingPacket() : SLNet::PacketizedTCP
  • ReturnResult() : SLNet::CommandParserInterface
  • ReturnToUser() : SLNet::Router2
  • ReverseBytes() : SLNet::BitStream
  • ReverseBytesInPlace() : SLNet::BitStream
  • ReverseList() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ReverseListInternal() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • RevertResizedServer() : SLNet::Rackspace
  • RightChild() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • RM3World() : SLNet::ReplicaManager3::RM3World
  • RNS2_Berkley() : SLNet::RNS2_Berkley
  • RNS2_SendParameters() : SLNet::RNS2_SendParameters
  • RNS2EventHandler() : SLNet::RNS2EventHandler
  • RotateLeft() : DataStructures::BPlusTree< KeyType, DataType, order >
  • RotateRight() : DataStructures::BPlusTree< KeyType, DataType, order >
  • Router2() : SLNet::Router2
  • Router2DebugInterface() : SLNet::Router2DebugInterface
  • RPC4() : SLNet::RPC4
  • RPC4GlobalRegistration() : SLNet::RPC4GlobalRegistration
  • RunUpdateCycle()
: SLNet::RakPeer
, SLNet::RakPeerInterface
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- s -

  • SaveLastSearch() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • SeedMT()
: SLNet::RakNetRandom
, SLNet::RakNetRandomSync
  • Send()
: SLNet::RakPeer
, SLNet::RemoteClient
, SLNet::TeamManager
, SLNet::RakPeer
, SLNet::TelnetTransport
, SLNet::RakNetTransport2
, SLNet::EmailSender
, SLNet::RakPeerInterface
, SLNet::TransportInterface
, SLNet::RakPeerInterface
, SLNet::FileListTransfer
, SLNet::ReliabilityLayer
, SLNet::RakNetSocket2
, SLNet::PacketizedTCP
, SLNet::RNS2_Linux
, SLNet::TCPInterface
  • SendAllBusy() : SLNet::UDPProxyCoordinator
  • SendBuffered() : SLNet::RakPeer
  • SendBufferedList() : SLNet::RakPeer
  • SendChatRoomsList() : SLNet::RelayPlugin
  • SendCommandList() : SLNet::CommandParserInterface
  • SendConnectionRequest() : SLNet::RakPeer
  • SendConstruction() : SLNet::Connection_RM3
  • SendFailureOnCannotForward() : SLNet::Router2
  • SendForwardingRequest() : SLNet::UDPProxyCoordinator
  • SendForwardingSuccess() : SLNet::Router2
  • SendGroupMessage() : SLNet::RelayPlugin
  • SendHelp()
: SLNet::RakNetCommandParser
, SLNet::CommandParserInterface
, SLNet::LogCommandParser
  • SendImmediate() : SLNet::RakPeer
  • SendIRIToAddress() : SLNet::FileListTransfer
  • SendList()
: SLNet::PacketizedTCP
, SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::TCPInterface
  • SendListUnified() : SLNet::PluginInterface2
  • SendLoopback()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SendMessageToRoom() : SLNet::RelayPlugin
  • SendNextPendingRequest() : SLNet::HTTPConnection2
  • SendOOBFromRakNetPort() : SLNet::Router2
  • SendOOBFromSpecifiedSocket() : SLNet::Router2
  • SendOOBMessages() : SLNet::Router2
  • SendOrBuffer() : SLNet::RemoteClient
  • SendOutOfBand()
: SLNet::NatPunchthroughClient
, SLNet::RakPeer
, SLNet::RakPeerInterface
  • SendPendingRequestToConnectedSystem() : SLNet::HTTPConnection2
  • SendPingedServersToCoordinator() : SLNet::UDPProxyClient::PingServerGroup
  • SendPunchthrough() : SLNet::NatPunchthroughClient
  • SendQueuedOpenNAT() : SLNet::NatPunchthroughClient
  • SendReadyStateQuery() : SLNet::ReadyEvent
  • SendReadyUpdate() : SLNet::ReadyEvent
  • SendRequest() : SLNet::HTTPConnection2
  • SendSerialize() : SLNet::Connection_RM3
  • SendSerializeHeader() : SLNet::Connection_RM3
  • SendSerializeIfChanged() : SLNet::Connection_RM3
  • SendSubscribedKeyToServers() : SLNet::CloudServer
  • SendTimestamps() : SLNet::NatPunchthroughServer
  • SendToParticipant() : SLNet::RelayPlugin
  • SendTTL()
: SLNet::NatPunchthroughClient
, SLNet::RakPeer
, SLNet::RakPeerInterface
  • SendUnified() : SLNet::PluginInterface2
  • SendUploadedAndSubscribedKeysToServer() : SLNet::CloudServer
  • SendUploadedKeyToServers() : SLNet::CloudServer
  • SendValidation() : SLNet::Connection_RM3
  • SerializationContext() : SLNet::VariableDeltaSerializer::SerializationContext
  • Serialize()
: SLNet::BitStream
, SLNet::CloudKey
, SLNet::CloudQuery
, SLNet::CloudQueryRow
, SLNet::CloudQueryResult
, SLNet::CloudServer::CloudQueryWithAddresses
, DataStructures::RangeList< range_type >
, SLNet::FileList
, SLNet::RakNetRandomSync
, SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
, SLNet::RakString
, SLNet::RakWString
  • SerializeBits() : SLNet::BitStream
  • SerializeBitsFromIntegerRange() : SLNet::BitStream
  • SerializeCasted() : SLNet::BitStream
  • SerializeCell() : SLNet::TableSerializer
  • SerializeCloudQueryRows() : SLNet::CloudQueryResult
  • SerializeColumns() : SLNet::TableSerializer
  • SerializeCompressed()
: SLNet::BitStream
, SLNet::RakString
  • SerializeCompressedDelta() : SLNet::BitStream
  • SerializeConstruction()
: SLNet::RakNetRandomSync
, SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
, SLNet::TM_TeamMember
, SLNet::TM_Team
  • SerializeConstructionExisting()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • SerializeDelta() : SLNet::BitStream
  • SerializeDestruction()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • SerializeFilterQuery() : SLNet::TableSerializer
  • SerializeFilterQueryList() : SLNet::TableSerializer
  • SerializeFloat16() : SLNet::BitStream
  • SerializeHeader() : SLNet::CloudQueryResult
  • SerializeNormQuat() : SLNet::BitStream
  • SerializeNormVector() : SLNet::BitStream
  • SerializeNumRows() : SLNet::CloudQueryResult
  • SerializeOnDownloadComplete() : SLNet::Connection_RM3
  • SerializeOnDownloadStarted() : SLNet::Connection_RM3
  • SerializeOrthMatrix() : SLNet::BitStream
  • SerializeRow() : SLNet::TableSerializer
  • SerializeTable() : SLNet::TableSerializer
  • SerializeVariable() : SLNet::VariableDeltaSerializer
  • SerializeVector() : SLNet::BitStream
  • ServerWithPingComp() : SLNet::UDPProxyCoordinator
  • Set()
: DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::Table::Cell
, SLNet::RakString
, SLNet::RakWString
  • SetAcceptAddParticipantRequests() : SLNet::RelayPlugin
  • SetActionOnDisallowedMessage() : SLNet::MessageFilter
  • SetActive() : SLNet::RemoteClient
  • SetAllowMessageID() : SLNet::MessageFilter
  • SetAllowRPC4() : SLNet::MessageFilter
  • SetApplicationDirectory() : SLNet::DirectoryDeltaTransfer
  • SetAutoAddNewConnectionsToFilter() : SLNet::MessageFilter
  • SetAutoManageConnections()
: SLNet::ReplicaManager3
, SLNet::TM_World
, SLNet::TeamManager
  • SetAutoProcessNewConnections() : SLNet::ConnectionGraph2
  • SetAutoSerializeInterval() : SLNet::ReplicaManager3
  • SetBalanceTeams() : SLNet::TM_World
  • SetBinaryAddress() : SLNet::SystemAddress
  • SetBroadcastSocket() : SLNet::RNS2_Berkley
  • SetByType() : DataStructures::Table::Cell
  • SetCallCount() : SLNet::RakNetRandomSync
  • SetChar() : SLNet::RakString
  • SetCompleted() : SLNet::DynDNS
  • SetCompositeOwner() : SLNet::Replica3Composite< parent_type >
  • SetData() : SLNet::BitStream
  • SetDebugInterface()
: SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::Router2
  • SetDefaultAssignmentAlgorithm() : SLNet::TeamBalancer
  • SetDefaultCallbacks() : SLNet::CloudClient
  • SetDefaultOrderingChannel() : SLNet::ReplicaManager3
  • SetDefaultPacketPriority() : SLNet::ReplicaManager3
  • SetDefaultPacketReliability() : SLNet::ReplicaManager3
  • SetDefaultTimeToTrack() : SLNet::StatisticsHistory
  • SetDisallowedMessageCallback() : SLNet::MessageFilter
  • SetDoNotFragment() : SLNet::RNS2_Berkley
  • SetDownloadRequestIncrementalReadInterface() : SLNet::DirectoryDeltaTransfer
  • SetEvent()
: SLNet::ReadyEvent
, SLNet::SignaledEvent
  • SetEventByIndex() : SLNet::ReadyEvent
  • SetExisting() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • SetFileListTransferPlugin() : SLNet::DirectoryDeltaTransfer
  • SetFilterMaxTime() : SLNet::MessageFilter
  • SetForceEvenTeams() : SLNet::TeamBalancer
  • SetHost() : SLNet::TM_World
  • SetIncomingDatagramEventHandler()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetIncomingPassword()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetInternalID()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetInvalid() : DataStructures::HashIndex
  • SetIPHdrIncl() : SLNet::RNS2_Berkley
  • SetJoinPermissions() : SLNet::TM_Team
  • SetLimitIPConnectionFrequency()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetLockTeams() : SLNet::TeamBalancer
  • SetLogCommandParser() : SLNet::PacketConsoleLogger
  • SetLogDirectMessages() : SLNet::PacketLogger
  • SetMaxBytesPerDownload() : SLNet::CloudServer
  • SetMaxForwardEntries() : SLNet::UDPForwarder
  • SetMaximumForwardingRequests() : SLNet::Router2
  • SetMaximumIncomingConnections()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetMaxUploadBytesPerClient() : SLNet::CloudServer
  • SetMemberLimit() : SLNet::TM_Team
  • SetMTU() : SLNet::CCRakNetSlidingWindow
  • SetMultilistType() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • SetNetworkID() : SLNet::NetworkIDObject
  • SetNetworkIDManager()
: SLNet::ReplicaManager3
, SLNet::NetworkIDObject
  • SetNew() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • SetNonBlockingSocket() : SLNet::RNS2_Berkley
  • SetNull() : SLNet::RakNetSmartPtr< T >
  • SetNumberOfBitsAllocated() : SLNet::BitStream
  • SetOccasionalPing()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetOfflinePingResponse()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • SetOwner()
: SLNet::TM_TeamMember
, SLNet::TM_Team
  • SetPageSize()
: DataStructures::MemoryPool< MemoryBlockType >
, DataStructures::BytePool
, DataStructures::ThreadsafeAllocatingQueue< structureType >
  • SetParent() : SLNet::NetworkIDObject
  • SetPerConnectionOutgoingBandwidthLimit()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • SetPoolPageSize() : DataStructures::BPlusTree< KeyType, DataType, order >
  • SetPortHostOrder() : SLNet::SystemAddress
  • SetPortNetworkOrder() : SLNet::SystemAddress
  • SetPrefix() : SLNet::PacketLogger
  • SetPrintAcks() : SLNet::PacketLogger
  • SetPrintID() : SLNet::PacketLogger
  • SetPrompt() : SLNet::ConsoleServer
  • SetPtr() : DataStructures::Table::Cell
  • SetRakPeerInterface()
: SLNet::RakNetCommandParser
, SLNet::PluginInterface2
  • SetReadOffset() : SLNet::BitStream
  • SetRecvEventHandler() : SLNet::RakNetSocket2
  • SetRemoteLoginPassword() : SLNet::UDPProxyCoordinator
  • SetResultHandler()
: SLNet::UDPProxyClient
, SLNet::UDPProxyServer
  • SetSendChannel() : SLNet::ReadyEvent
  • SetSendPrefix() : SLNet::TelnetTransport
  • SetSendSuffix() : SLNet::TelnetTransport
  • SetServerPublicIP() : SLNet::UDPProxyServer
  • SetSocketFamily()
: SLNet::Router2
, SLNet::UDPProxyServer
  • SetSocketOptions()
: SLNet::RNS2_Berkley
, SLNet::SocketLayer
  • SetSocketType() : SLNet::RakNetSocket2
  • SetSortOrder() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • SetSplitMessageProgressInterval()
: SLNet::ReliabilityLayer
, SLNet::RakPeer
, SLNet::RakPeerInterface
  • SetSuffix() : SLNet::PacketLogger
  • SetSystemFilterSet() : SLNet::MessageFilter
  • SetTCPInterface() : SLNet::PluginInterface2
  • SetTeamSizeLimit() : SLNet::TeamBalancer
  • SetThreadDataInterface() : ThreadPool< InputType, OutputType >
  • SetTimeoutCallback() : SLNet::MessageFilter
  • SetTimeoutTime()
: SLNet::RakPeer
, SLNet::ReliabilityLayer
, SLNet::RakPeerInterface
  • SetTimeToTrackValues() : SLNet::StatisticsHistory::TimeAndValueQueue
  • SetToLoopback() : SLNet::SystemAddress
  • SetTopology() : SLNet::TeamManager
  • SetTrackConnections() : SLNet::StatisticsHistoryPlugin
  • SetTransportProvider() : SLNet::ConsoleServer
  • SetUndefined() : SLNet::AddressOrGUID
  • SetUnreliableTimeout()
: SLNet::RakPeer
, SLNet::ReliabilityLayer
, SLNet::RakPeerInterface
  • SetupBufferedPackets() : SLNet::RakPeer
  • SetUploadSendParameters() : SLNet::DirectoryDeltaTransfer
  • SetupReceive() : SLNet::FileListTransfer
  • SetUserConnectionSocketIndex() : SLNet::RakNetSocket2
  • SetUserUpdateThread()
: SLNet::RakPeerInterface
, SLNet::RakPeer
  • SetWriteOffset() : SLNet::BitStream
  • ShareServerAddress() : SLNet::Rackspace
  • ShiftIncomingTimestamp() : SLNet::RakPeer
  • ShiftKeysLeft() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ShiftNodeLeft() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ShiftNodeRight() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ShouldSendACKs() : SLNet::CCRakNetSlidingWindow
  • ShowDiagnostic() : SLNet::Router2DebugInterface
  • ShowFailure() : SLNet::Router2DebugInterface
  • ShowPrompt() : SLNet::ConsoleServer
  • Shutdown()
: SLNet::NatTypeDetectionServer
, SLNet::RakPeer
, SLNet::RakPeerInterface
, SLNet::UDPForwarder
, SLNet::NatTypeDetectionClient
  • Signal() : SLNet::RPC4
  • SignaledEvent() : SLNet::SignaledEvent
  • SignalStopRecvPollingThread() : SLNet::RNS2_Berkley
  • SimpleMutex() : SLNet::SimpleMutex
  • SingleProducerConsumer() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • Size()
: DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
, DataStructures::Queue< queue_type >
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
, DataStructures::ThreadsafeAllocatingQueue< structureType >
  • size() : SLNet::RakNetGUID
  • Size()
: DataStructures::Map< key_type, data_type, key_comparison_func >
, DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::List< list_type >
, DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::OrderedList< key_type, data_type, default_comparison_function >
, DataStructures::CircularLinkedList< CircularLinkedListType >
, DataStructures::QueueLinkedList< QueueType >
, DataStructures::RangeList< range_type >
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • size() : SLNet::SystemAddress
  • Size() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • Skip() : SLNet::RakNetRandomSync
  • SocketConnect() : SLNet::TCPInterface
  • SocketDescriptor() : SLNet::SocketDescriptor
  • SocketLayer() : SLNet::SocketLayer
  • SocketQueryOutput() : SLNet::RakPeer::SocketQueryOutput
  • Sort() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > , DataStructures::CircularLinkedList< CircularLinkedListType >
  • SortTable() : DataStructures::Table
  • SpecificTeam() : SLNet::TeamSelection
  • SplitURI() : SLNet::RakString
  • SQLEscape() : SLNet::RakString
  • Start()
: SLNet::TransportInterface
, SLNet::TCPInterface
, SLNet::RakNetTransport2
, SLNet::TelnetTransport
  • StartAfterFirstCharacter() : SLNet::RakString
  • StartAfterLastCharacter() : SLNet::RakString
  • StartForwarding() : SLNet::UDPForwarder
  • StartIncrementalReadThreads() : SLNet::FileListTransfer
  • StartLog() : SLNet::PacketFileLogger
  • StartPendingPunchthrough() : SLNet::NatPunchthroughServer
  • StartPunchthroughForUser() : SLNet::NatPunchthroughServer
  • StartSeries() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • StartThreads() : ThreadPool< InputType, OutputType >
  • Startup()
: SLNet::UDPForwarder
, SLNet::RakPeerInterface
, SLNet::RakPeer
, SLNet::NatTypeDetectionServer
  • StartVariableHistoryWrite() : SLNet::VariableDeltaSerializer
  • StartWrite() : SLNet::VariableListDeltaTracker
  • StatisticsHistory() : SLNet::StatisticsHistory
  • StatisticsHistoryPlugin() : SLNet::StatisticsHistoryPlugin
  • Stop()
: SLNet::DynDNS
, SLNet::RakNetTransport2
, SLNet::TelnetTransport
, SLNet::PacketizedTCP
, SLNet::TransportInterface
, SLNet::TCPInterface
  • StopForwarding() : SLNet::UDPForwarder
  • StopThreads() : ThreadPool< InputType, OutputType >
  • StopTrackingNetworkIDObject() : SLNet::NetworkIDManager
  • StoreChangedVariablesList() : SLNet::VariableDeltaSerializer
  • StoreLastTeams() : SLNet::TM_TeamMember
  • StrCmp()
: SLNet::RakString
, SLNet::RakWString
  • StrICmp()
: SLNet::RakWString
, SLNet::RakString
  • StringCompressor() : SLNet::StringCompressor
  • StringTable() : SLNet::StringTable
  • StrNCmp() : SLNet::RakString
  • Subscribe() : SLNet::LogCommandParser
  • SubStr() : SLNet::RakString
  • Swap() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • SwapTeamMembersByRequest() : SLNet::TeamBalancer
  • SwitchMemberTeam() : SLNet::TeamBalancer
  • SwitchSpecificTeamCheck() : SLNet::TM_TeamMember
  • SystemAddress() : SLNet::SystemAddress
  • SystemAddressAndGuidComp() : SLNet::ConnectionGraph2
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- t -

  • Table() : DataStructures::Table
  • TagSorted() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • TCPInterface() : SLNet::TCPInterface
  • TeamBalancer() : SLNet::TeamBalancer
  • TeamManager() : SLNet::TeamManager
  • TeamSelection() : SLNet::TeamSelection
  • TeamsWouldBeEvenOnSwitch() : SLNet::TeamBalancer
  • TeamWouldBeOverpopulatedOnAddition() : SLNet::TeamBalancer
  • TeamWouldBeUnderpopulatedOnLeave() : SLNet::TeamBalancer
  • TelnetTransport() : SLNet::TelnetTransport
  • TerminateAtFirstCharacter() : SLNet::RakString
  • TerminateAtLastCharacter() : SLNet::RakString
  • ThreadDataInterface() : ThreadDataInterface
  • ThreadPool() : ThreadPool< InputType, OutputType >
  • ThreadsafePacketLogger() : SLNet::ThreadsafePacketLogger
  • TimeAndValue2() : SLNet::BPSTracker::TimeAndValue2
  • TimeAndValueQueue() : SLNet::StatisticsHistory::TimeAndValueQueue
  • TM_Team() : SLNet::TM_Team
  • TM_TeamMember() : SLNet::TM_TeamMember
  • TM_World() : SLNet::TM_World
  • ToInteger()
: SLNet::RakString
, SLNet::SystemAddress
, SLNet::AddressOrGUID
, SLNet::RakWString
  • ToLower() : SLNet::RakString
  • ToString()
: DataStructures::Table::Cell
, SLNet::RakString
, SLNet::SystemAddress
, SLNet::RakNetGUID
, SLNet::AddressOrGUID
, SLNet::RakNetGUID
, SLNet::AddressOrGUID
, SLNet::RakNetGUID
  • ToString_Old() : SLNet::SystemAddress
  • ToUint32()
: SLNet::TM_Team
, SLNet::RakNetGUID
, SLNet::TM_TeamMember
  • ToUpper() : SLNet::RakString
  • TrackedObject() : SLNet::StatisticsHistory::TrackedObject
  • TrackedObjectComp() : SLNet::StatisticsHistory
  • TrackedObjectData() : SLNet::StatisticsHistory::TrackedObjectData
  • TrackNetworkIDObject() : SLNet::NetworkIDManager
  • TransmitRequest() : SLNet::HTTPConnection2
  • TransportInterface() : SLNet::TransportInterface
  • Tree() : DataStructures::Tree< TreeType >
  • Truncate() : SLNet::RakString
  • TruncateUTF8() : SLNet::RakString
  • TryNextServer() : SLNet::UDPProxyCoordinator
  • TwoWayAuthentication() : SLNet::TwoWayAuthentication
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- u -

  • UDPForwarder() : SLNet::UDPForwarder
  • UDPProxyClient() : SLNet::UDPProxyClient
  • UDPProxyClientResultHandler() : SLNet::UDPProxyClientResultHandler
  • UDPProxyCoordinator() : SLNet::UDPProxyCoordinator
  • UDPProxyServer() : SLNet::UDPProxyServer
  • UDPProxyServerResultHandler() : SLNet::UDPProxyServerResultHandler
  • uint24_t() : SLNet::uint24_t
  • Unlock() : SLNet::SimpleMutex
  • UnlockInput() : ThreadPool< InputType, OutputType >
  • UnlockMutex() : SLNet::RakString
  • UnlockOutput() : ThreadPool< InputType, OutputType >
  • UnregisterBlockingFunction() : SLNet::RPC4
  • UnregisterFunction() : SLNet::RPC4
  • UnregisterLocalCallback() : SLNet::RPC4
  • UnregisterSlot() : SLNet::RPC4
  • Unsubscribe()
: SLNet::CloudClient
, SLNet::LogCommandParser
  • UnsubscribeFromKey() : SLNet::CloudServer
  • Update()
: SLNet::NatPunchthroughClient
, SLNet::NatPunchthroughServer
, SLNet::UDPProxyServer
, SLNet::UDPProxyCoordinator
, SLNet::NatTypeDetectionClient
, SLNet::NatTypeDetectionServer
, SLNet::TwoWayAuthentication
, SLNet::PluginInterface2
, SLNet::ReliabilityLayer
, SLNet::ReplicaManager3
, SLNet::Router2
, SLNet::StatisticsHistoryPlugin
, SLNet::TeamManager
, SLNet::ThreadsafePacketLogger
, SLNet::TwoWayAuthentication::NonceGenerator
, SLNet::UDPProxyClient
, SLNet::CCRakNetSlidingWindow
, SLNet::CloudServer
, SLNet::MessageFilter
, SLNet::ConsoleServer
, CSHA1
, SLNet::DynDNS
, SLNet::FileListTransfer
, SLNet::FileListTransferCBInterface
, SLNet::HTTPConnection
  • UpdateCell()
: DataStructures::Table
, DataStructures::Table::Row
, DataStructures::Table
  • UpdateCellByIndex() : DataStructures::Table
  • UpdatedVariablesListPtrComp() : SLNet::VariableDeltaSerializer
  • UpdateForwarding() : SLNet::Router2
  • UpdateHostIPAsynch() : SLNet::DynDNS
  • UpdateListsToNoTeam() : SLNet::TM_TeamMember
  • UpdateReadyStatus() : SLNet::ReadyEvent
  • UpdateServerNameOrPassword() : SLNet::Rackspace
  • UpdateTeamsRequestedToAny() : SLNet::TM_TeamMember
  • UpdateTeamsRequestedToNone() : SLNet::TM_TeamMember
  • UpdateUDPForwarder() : SLNet::UDPForwarder
  • URLDecode() : SLNet::RakString
  • URLEncode() : SLNet::RakString
  • UserIDTOString() : SLNet::PacketLogger
  • UsesReliabilityLayer()
: SLNet::PacketLogger
, SLNet::PluginInterface2
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- v -

  • ValidateLists() : SLNet::Connection_RM3
  • ValidateRemoteSystemLookup() : SLNet::RakPeer
  • ValidateTreeRecursive() : DataStructures::BPlusTree< KeyType, DataType, order >
  • VariableDeltaSerializer() : SLNet::VariableDeltaSerializer
  • VariableLastValueNode() : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • VariableListDeltaTracker() : SLNet::VariableListDeltaTracker
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- w -

  • WaitOnEvent() : SLNet::SignaledEvent
  • WasReferenced() : SLNet::Replica3
  • WasResultSuccessful() : SLNet::DynDNS
  • WasStarted() : SLNet::TCPInterface , ThreadPool< InputType, OutputType >
  • WeAreHost() : SLNet::TeamBalancer
  • WeightedGraph() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • WorldToCellX() : GridSectorizer
  • WorldToCellXOffsetAndClamped() : GridSectorizer
  • WorldToCellY() : GridSectorizer
  • WorldToCellYOffsetAndClamped() : GridSectorizer
  • Write() : SLNet::BitStream
  • Write0() : SLNet::BitStream
  • Write1() : SLNet::BitStream
  • WriteAlignedBytes() : SLNet::BitStream
  • WriteAlignedBytesSafe() : SLNet::BitStream
  • WriteAlignedVar16() : SLNet::BitStream
  • WriteAlignedVar32() : SLNet::BitStream
  • WriteAlignedVar8() : SLNet::BitStream
  • WriteAllocationID()
: SLNet::Replica3
, SLNet::Replica3Composite< parent_type >
  • WriteBits() : SLNet::BitStream
  • WriteBitsFromIntegerRange() : SLNet::BitStream
  • WriteBytes() : DataStructures::ByteQueue
  • WriteCasted() : SLNet::BitStream
  • WriteCloudQueryRowFromResultList() : SLNet::CloudServer
  • WriteCompressed() : SLNet::BitStream
  • WriteCompressedDelta() : SLNet::BitStream
  • WriteDataToDisk() : SLNet::FileList
  • WriteDelta() : SLNet::BitStream
  • WriteFloat16() : SLNet::BitStream
  • WriteLock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • WriteLog()
: SLNet::PacketConsoleLogger
, SLNet::PacketFileLogger
, SLNet::PacketLogger
, SLNet::LogCommandParser
, SLNet::PacketOutputWindowLogger
  • WriteMiscellaneous() : SLNet::PacketLogger
  • WriteNormQuat() : SLNet::BitStream
  • WriteNormVector() : SLNet::BitStream
  • WriteOrthMatrix() : SLNet::BitStream
  • WriteOutOfBandHeader()
: SLNet::RakPeer
, SLNet::RakPeerInterface
  • WritePtr() : SLNet::BitStream
  • WriteUnlock() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • WriteVar() : SLNet::VariableListDeltaTracker
  • WriteVarToBitstream() : SLNet::VariableListDeltaTracker
  • WriteVector() : SLNet::BitStream
  • WSAStartupSingleton() : WSAStartupSingleton
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- ~ -

  • ~AVLBalancedBinarySearchTree() : DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
  • ~BinarySearchTree() : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • ~BitStream() : SLNet::BitStream
  • ~BPlusTree() : DataStructures::BPlusTree< KeyType, DataType, order >
  • ~BPSTracker() : SLNet::BPSTracker
  • ~BytePool() : DataStructures::BytePool
  • ~ByteQueue() : DataStructures::ByteQueue
  • ~CCRakNetSlidingWindow() : SLNet::CCRakNetSlidingWindow
  • ~Cell() : DataStructures::Table::Cell
  • ~CircularLinkedList() : DataStructures::CircularLinkedList< CircularLinkedListType >
  • ~CloudAllocator() : SLNet::CloudAllocator
  • ~CloudClient() : SLNet::CloudClient
  • ~CloudClientCallback() : SLNet::CloudClientCallback
  • ~CloudData() : SLNet::CloudServer::CloudData
  • ~CloudKey() : SLNet::CloudKey
  • ~CloudServer() : SLNet::CloudServer
  • ~CloudServerQueryFilter() : SLNet::CloudServerQueryFilter
  • ~ColumnDescriptor() : DataStructures::Table::ColumnDescriptor
  • ~CommandParserInterface() : SLNet::CommandParserInterface
  • ~Connection_RM3() : SLNet::Connection_RM3
  • ~ConnectionGraph2() : SLNet::ConnectionGraph2
  • ~ConnnectRequest() : SLNet::Router2::ConnnectRequest
  • ~ConsoleServer() : SLNet::ConsoleServer
  • ~CSHA1() : CSHA1
  • ~DirectoryDeltaTransfer() : SLNet::DirectoryDeltaTransfer
  • ~DynDNS() : SLNet::DynDNS
  • ~FileList() : SLNet::FileList
  • ~FileListNodeContext() : FileListNodeContext
  • ~FileListProgress() : SLNet::FileListProgress
  • ~FileListTransfer() : SLNet::FileListTransfer
  • ~FileListTransferCBInterface() : SLNet::FileListTransferCBInterface
  • ~FilterQuery() : DataStructures::Table::FilterQuery
  • ~FLP_Printf() : SLNet::FLP_Printf
  • ~ForwardEntry() : SLNet::UDPForwarder::ForwardEntry
  • ~GridSectorizer() : GridSectorizer
  • ~Hash() : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • ~Heap() : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • ~HTTPConnection() : SLNet::HTTPConnection
  • ~HTTPConnection2() : SLNet::HTTPConnection2
  • ~HuffmanEncodingTree() : SLNet::HuffmanEncodingTree
  • ~IncrementalReadInterface() : SLNet::IncrementalReadInterface
  • ~LastSerializationResult() : SLNet::LastSerializationResult
  • ~LinkedList() : DataStructures::LinkedList< LinkedListType >
  • ~List() : DataStructures::List< list_type >
  • ~LocalSlotObject() : SLNet::RPC4::LocalSlotObject
  • ~LogCommandParser() : SLNet::LogCommandParser
  • ~Map() : DataStructures::Map< key_type, data_type, key_comparison_func >
  • ~MemoryPool() : DataStructures::MemoryPool< MemoryBlockType >
  • ~MessageFilter() : SLNet::MessageFilter
  • ~Multilist() : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ~NatPunchthroughClient() : SLNet::NatPunchthroughClient
  • ~NatPunchthroughDebugInterface() : SLNet::NatPunchthroughDebugInterface
  • ~NatPunchthroughDebugInterface_PacketLogger() : SLNet::NatPunchthroughDebugInterface_PacketLogger
  • ~NatPunchthroughServer() : SLNet::NatPunchthroughServer
  • ~NatPunchthroughServerDebugInterface() : SLNet::NatPunchthroughServerDebugInterface
  • ~NatPunchthroughServerDebugInterface_PacketLogger() : SLNet::NatPunchthroughServerDebugInterface_PacketLogger
  • ~NatTypeDetectionClient() : SLNet::NatTypeDetectionClient
  • ~NatTypeDetectionServer() : SLNet::NatTypeDetectionServer
  • ~NetworkIDManager() : SLNet::NetworkIDManager
  • ~NetworkIDObject() : SLNet::NetworkIDObject
  • ~NonceGenerator() : SLNet::TwoWayAuthentication::NonceGenerator
  • ~OrderedChannelHeap() : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • ~OrderedList() : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • ~PacketFileLogger() : SLNet::PacketFileLogger
  • ~PacketizedTCP() : SLNet::PacketizedTCP
  • ~PacketLogger() : SLNet::PacketLogger
  • ~PacketOutputWindowLogger() : SLNet::PacketOutputWindowLogger
  • ~PluginInterface2() : SLNet::PluginInterface2
  • ~Queue() : DataStructures::Queue< queue_type >
  • ~Rackspace() : SLNet::Rackspace
  • ~Rackspace2EventCallback() : SLNet::Rackspace2EventCallback
  • ~RakNetCommandParser() : SLNet::RakNetCommandParser
  • ~RakNetRandom() : SLNet::RakNetRandom
  • ~RakNetRandomSync() : SLNet::RakNetRandomSync
  • ~RakNetSmartPtr() : SLNet::RakNetSmartPtr< T >
  • ~RakNetSocket2() : SLNet::RakNetSocket2
  • ~RakNetTransport2() : SLNet::RakNetTransport2
  • ~RakPeer() : SLNet::RakPeer
  • ~RakPeerInterface() : SLNet::RakPeerInterface
  • ~RakString() : SLNet::RakString
  • ~RakWString() : SLNet::RakWString
  • ~RangeList() : DataStructures::RangeList< range_type >
  • ~RangeNode() : DataStructures::RangeNode< range_type >
  • ~ReadyEvent() : SLNet::ReadyEvent
  • ~RefCountedObj() : RefCountedObj
  • ~ReferenceCounter() : SLNet::ReferenceCounter
  • ~RelayPlugin() : SLNet::RelayPlugin
  • ~ReliabilityLayer() : SLNet::ReliabilityLayer
  • ~Replica3() : SLNet::Replica3
  • ~ReplicaManager3() : SLNet::ReplicaManager3
  • ~RNS2_Berkley() : SLNet::RNS2_Berkley
  • ~RNS2EventHandler() : SLNet::RNS2EventHandler
  • ~Router2() : SLNet::Router2
  • ~Router2DebugInterface() : SLNet::Router2DebugInterface
  • ~RPC4() : SLNet::RPC4
  • ~SerializationContext() : SLNet::VariableDeltaSerializer::SerializationContext
  • ~SignaledEvent() : SLNet::SignaledEvent
  • ~SimpleMutex() : SLNet::SimpleMutex
  • ~SingleProducerConsumer() : DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
  • ~SocketLayer() : SLNet::SocketLayer
  • ~SocketQueryOutput() : SLNet::RakPeer::SocketQueryOutput
  • ~StatisticsHistory() : SLNet::StatisticsHistory
  • ~StatisticsHistoryPlugin() : SLNet::StatisticsHistoryPlugin
  • ~StringCompressor() : SLNet::StringCompressor
  • ~StringTable() : SLNet::StringTable
  • ~Table() : DataStructures::Table
  • ~TCPInterface() : SLNet::TCPInterface
  • ~TeamBalancer() : SLNet::TeamBalancer
  • ~TeamManager() : SLNet::TeamManager
  • ~TelnetTransport() : SLNet::TelnetTransport
  • ~ThreadDataInterface() : ThreadDataInterface
  • ~ThreadPool() : ThreadPool< InputType, OutputType >
  • ~ThreadsafePacketLogger() : SLNet::ThreadsafePacketLogger
  • ~TimeAndValue2() : SLNet::BPSTracker::TimeAndValue2
  • ~TimeAndValueQueue() : SLNet::StatisticsHistory::TimeAndValueQueue
  • ~TM_Team() : SLNet::TM_Team
  • ~TM_TeamMember() : SLNet::TM_TeamMember
  • ~TM_World() : SLNet::TM_World
  • ~TrackedObject() : SLNet::StatisticsHistory::TrackedObject
  • ~TransportInterface() : SLNet::TransportInterface
  • ~Tree() : DataStructures::Tree< TreeType >
  • ~TwoWayAuthentication() : SLNet::TwoWayAuthentication
  • ~UDPForwarder() : SLNet::UDPForwarder
  • ~UDPProxyClient() : SLNet::UDPProxyClient
  • ~UDPProxyClientResultHandler() : SLNet::UDPProxyClientResultHandler
  • ~UDPProxyCoordinator() : SLNet::UDPProxyCoordinator
  • ~UDPProxyServer() : SLNet::UDPProxyServer
  • ~UDPProxyServerResultHandler() : SLNet::UDPProxyServerResultHandler
  • ~VariableDeltaSerializer() : SLNet::VariableDeltaSerializer
  • ~VariableLastValueNode() : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • ~VariableListDeltaTracker() : SLNet::VariableListDeltaTracker
  • ~WeightedGraph() : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • ~WSAStartupSingleton() : WSAStartupSingleton
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- _ -

  • _completedConnectionAttempts : SLNet::PacketizedTCP
  • _failedConnectionAttempts : SLNet::PacketizedTCP
  • _isContinuousSend : SLNet::CCRakNetSlidingWindow
  • _lostConnections : SLNet::PacketizedTCP
  • _newIncomingConnections : SLNet::PacketizedTCP
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- a -

  • acceptAddParticipantRequests : SLNet::RelayPlugin
  • action : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • actionToTake : SLNet::RakPeer::RequestedConnectionStruct
  • activeSystemList : SLNet::RakPeer
  • activeSystemListSize : SLNet::RakPeer
  • addNewConnections : SLNet::StatisticsHistoryPlugin
  • addr : SLNet::NatPunchthroughClient::AddrAndGuid
  • addr1Confirmed : SLNet::UDPForwarder::ForwardEntry
  • addr1Unconfirmed : SLNet::UDPForwarder::ForwardEntry
  • addr2Confirmed : SLNet::UDPForwarder::ForwardEntry
  • addr2Unconfirmed : SLNet::UDPForwarder::ForwardEntry
  • address : SLNet::SystemAddress
  • addressFamily : SLNet::RNS2_BerkleyBindParameters
  • adjacencyLists : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • allocatedData : SLNet::CloudServer::CloudData
  • allocateIrIDataChunkAutomatically : SLNet::FileListTransferCBInterface::FileProgressStruct
  • allocationScheme : SLNet::InternalPacket
  • allocationSize : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • allocator : SLNet::CloudClient
  • allowConnectionResponseIPMigration : SLNet::RakPeer
  • allowedIDs : SLNet::FilterSet
  • allowedRPC4 : SLNet::FilterSet
  • allowInternalRouting : SLNet::RakPeer
  • anyVariablesWritten : SLNet::VariableDeltaSerializer::SerializationContext
  • apiAccessKey : SLNet::Rackspace
  • applicationDirectory : SLNet::DirectoryDeltaTransfer
  • ascendingSort : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • attemptCount : SLNet::NatPunchthroughClient::SendPing
  • attemptPhase : SLNet::NatPunchthroughServer::ConnectionAttempt
  • authToken : SLNet::Rackspace
  • autoAddNewConnectionsToFilter : SLNet::MessageFilter
  • autoAddParticipants : SLNet::TeamManager , SLNet::TM_World
  • autoCreateConnections : SLNet::ReplicaManager3
  • autoDestroyConnections : SLNet::ReplicaManager3
  • autoProcessNewConnections : SLNet::ConnectionGraph2
  • autoSerializeInterval : SLNet::ReplicaManager3
  • availablePages : DataStructures::MemoryPool< MemoryBlockType >
  • availablePagesSize : DataStructures::MemoryPool< MemoryBlockType >
  • availableStack : DataStructures::MemoryPool< MemoryBlockType >::Page
  • availableStackSize : DataStructures::MemoryPool< MemoryBlockType >::Page
  • availableUploads : SLNet::DirectoryDeltaTransfer
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- b -

  • b : StrAndBool
  • backoffThisBlock : SLNet::CCRakNetSlidingWindow
  • balanceTeamsIsActive : SLNet::TM_World
  • balancingApplies : SLNet::TM_Team
  • banList : SLNet::RakPeer
  • banListMutex : SLNet::RakPeer
  • banOnDisallowedMessage : SLNet::FilterSet
  • banOnFilterTimeExceed : SLNet::FilterSet
  • bigString : SLNet::RakString::SharedString
  • BinarySearchTree_size : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • bindAddress : SLNet::TCPInterface::ThisPtrPlusSysAddr
  • binding : SLNet::RNS2_Berkley
  • bitField : SLNet::VariableDeltaSerializer::ChangedVariablesList
  • bitSize : SLNet::Packet
  • bitStream
: SLNet::VariableDeltaSerializer::SerializationContext
, SLNet::VariableDeltaSerializer::DeserializationContext
, SLNet::LastSerializationResultBS
  • bitstreamWrittenTo : SLNet::DeserializeParameters
  • bitsWrittenSoFar : SLNet::SerializeParameters
  • bitWriteIndex : SLNet::VariableDeltaSerializer::ChangedVariablesList
  • block : DataStructures::MemoryPool< MemoryBlockType >::Page
  • blockingCommand : SLNet::RakPeer::BufferedCommandStruct
  • blockingReturnValue : SLNet::RPC4
  • blockingSocket : SLNet::SocketDescriptor
  • blockingSocketList : SLNet::TCPInterface
  • blockingSocketListMutex : SLNet::TCPInterface
  • boundAddress : SLNet::RakNetSocket2
  • boundAddressCount : SLNet::NatPunchthroughServer
  • boundAddresses : SLNet::NatPunchthroughServer
  • BPSLimitByCongestionControl : SLNet::RakNetStatistics
  • BPSLimitByOutgoingBandwidthLimit : SLNet::RakNetStatistics
  • broadcast : SLNet::RakPeer::BufferedCommandStruct
  • bufferedCommands : SLNet::RakPeer
  • bufferedPackets : SLNet::NatTypeDetectionClient , SLNet::NatTypeDetectionServer
  • bufferedPacketsFreePool : SLNet::RakPeer
  • bufferedPacketsFreePoolMutex : SLNet::RakPeer
  • bufferedPacketsMutex : SLNet::NatTypeDetectionClient , SLNet::NatTypeDetectionServer
  • bufferedPacketsQueue : SLNet::RakPeer
  • bufferedPacketsQueueMutex : SLNet::RakPeer
  • byteLength : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • byteLengthOfThisFile : SLNet::FileListTransferCBInterface::OnFileStruct
  • byteLengthOfThisSet : SLNet::FileListTransferCBInterface::DownloadCompleteStruct , SLNet::FileListTransferCBInterface::OnFileStruct
  • bytesDownloadedForThisFile : SLNet::FileListTransferCBInterface::OnFileStruct
  • bytesDownloadedForThisSet : SLNet::FileListTransferCBInterface::OnFileStruct
  • bytesInResendBuffer : SLNet::RakNetStatistics
  • bytesInSendBuffer : SLNet::RakNetStatistics
  • bytesRead : SLNet::RNS2RecvStruct
  • bytesReadForThisChunk : SLNet::HTTPConnection2::Request
  • bytesReceivedPerSecond : SLNet::RakPeer
  • bytesSentPerSecond : SLNet::RakPeer
  • bytesUsed : SLNet::RakString::SharedString
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- c -

  • c : SHA1_WORKSPACE_BLOCK , DataStructures::Table::Cell
  • c1 : CheckSum
  • c2 : CheckSum , SLNet::NatTypeDetectionClient
  • c2Port : SLNet::NatTypeDetectionServer::NATDetectionAttempt
  • c_str : SLNet::RakWString , SLNet::RakString::SharedString
  • c_strCharLength : SLNet::RakWString
  • callback : SLNet::CloudClient
  • callCount : SLNet::RakNetRandomSync
  • callPriority : SLNet::RPC4::LocalSlotObject
  • cdnManagementDomain : SLNet::Rackspace
  • cdnManagementPath : SLNet::Rackspace
  • cdnManagementURL : SLNet::Rackspace
  • cellHeight : GridSectorizer
  • cellOriginX : GridSectorizer
  • cellOriginY : GridSectorizer
  • cells : DataStructures::Table::Row
  • cellValue : DataStructures::Table::FilterQuery
  • cellWidth : GridSectorizer
  • changedVariables : SLNet::VariableDeltaSerializer::SerializationContext
  • channel : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData , SLNet::ReadyEvent
  • channelNames : SLNet::LogCommandParser
  • channels : SLNet::LogCommandParser::SystemAddressAndChannel
  • chatRooms : SLNet::RelayPlugin
  • checkIpAddress : SLNet::DynDNS
  • children : DataStructures::Page< KeyType, DataType, order > , DataStructures::Tree< TreeType >
  • chromeInstance : SLNet::SocketDescriptor
  • chunked : SLNet::HTTPConnection2::Request
  • chunkSize : SLNet::DirectoryDeltaTransfer , SLNet::FileListTransfer::FileToPush
  • clientGUID : SLNet::CloudQueryRow , SLNet::CloudServer::CloudData
  • clientSystemAddress : SLNet::CloudQueryRow , SLNet::CloudServer::CloudData
  • clockDifferential : SLNet::RakPeer::PingAndClockDifferential
  • cloudQuery : SLNet::CloudQueryResult , SLNet::CloudServer::CloudQueryWithAddresses
  • cloudQueryWithAddresses : SLNet::CloudServer::GetRequest
  • code : SLNet::HTTPConnection::BadResponse
  • columnIndex : DataStructures::Table::FilterQuery , DataStructures::Table::SortQuery
  • columnName : DataStructures::Table::ColumnDescriptor , DataStructures::Table::FilterQuery
  • columns : DataStructures::Table
  • columnType : DataStructures::Table::ColumnDescriptor
  • command : SLNet::RegisteredCommand , SLNet::RakPeer::BufferedCommandStruct
  • commandHelp : SLNet::RegisteredCommand
  • commandList : SLNet::CommandParserInterface
  • commandParserList : SLNet::ConsoleServer
  • completedConnectionAttemptMutex : SLNet::TCPInterface
  • completedConnectionAttempts : SLNet::TCPInterface
  • completedRequests : SLNet::HTTPConnection2
  • completedRequestsMutex : SLNet::HTTPConnection2
  • condAttr : SLNet::SignaledEvent
  • connectionAddress : SLNet::Rackspace::RackspaceOperation
  • connectionAttempts : SLNet::NatPunchthroughServer::User
  • connectionList : SLNet::ReplicaManager3::RM3World
  • connectionMode : SLNet::RakPeer::BufferedCommandStruct
  • connectionRequests : SLNet::Router2
  • connectionRequestsMutex : SLNet::Router2
  • connectionRequestSystems : SLNet::Router2::ConnnectRequest
  • connectionRequestSystemsMutex : SLNet::Router2::ConnnectRequest
  • connections : SLNet::PacketizedTCP
  • connectionSocketIndex : SLNet::RakPeer::BufferedCommandStruct
  • connectionStartTime : SLNet::RakNetStatistics
  • connectionTime : SLNet::RakPeer::RemoteSystemStruct
  • connectMode : SLNet::RakPeer::RemoteSystemStruct
  • connectPhase : SLNet::DynDNS
  • constructedReplicaList : SLNet::Connection_RM3
  • constructedReplicasCulled : SLNet::Connection_RM3
  • contentLength : SLNet::HTTPConnection2::Request
  • contentOffset : SLNet::HTTPConnection2::Request
  • contentType : SLNet::HTTPConnection::OutgoingCommand
  • context : SLNet::FileListNode , SLNet::FileListTransferCBInterface::OnFileStruct
  • coordinatorAddressForPings : SLNet::UDPProxyClient::PingServerGroup
  • costMatrix : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • costMatrixIndices : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • creatingSystemGUID : SLNet::Replica3
  • creationTime : SLNet::InternalPacket
  • currentlyAttemptedServerAddress : SLNet::UDPProxyCoordinator::ForwardingRequest
  • currentlyDeallocatingReplica : SLNet::ReplicaManager3
  • currentOffset : SLNet::FileListTransfer::FileToPush
  • currentProcessingCommand : SLNet::HTTPConnection
  • currentRoom : SLNet::RelayPlugin::StrAndGuidAndRoom
  • currentTeam : SLNet::TeamBalancer::TeamMember , SLNet::TeamBalancer::MyTeamMembers
  • cursorPosition : SLNet::TelnetTransport::TelnetClient
  • curTime : SLNet::SerializeParameters
  • cwnd : SLNet::CCRakNetSlidingWindow
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- d -

  • data
: SLNet::CloudQueryRow
, DataStructures::Page< KeyType, DataType, order >
, DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node
, DataStructures::Tree< TreeType >
, SLNet::RNS2RecvStruct
, SLNet::Packet
, SLNet::FileListNode
, DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode
, SLNet::HTTPConnection::BadResponse
, SLNet::HTTPConnection::OutgoingCommand
, DataStructures::ByteQueue
, DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
, SLNet::InternalPacket
, SLNet::RakPeer::RequestedConnectionStruct
, DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::RNS2_SendParameters
  • dataBitLength : SLNet::InternalPacketFixedSizeTransmissionHeader
  • dataChunkLength : SLNet::FileListTransferCBInterface::FileProgressStruct
  • dataLength : FileListNodeContext , SLNet::RakPeer::RequestedConnectionStruct
  • dataLengthBytes : SLNet::CloudServer::CloudData , SLNet::FileListNode
  • dataPtr : SLNet::CloudServer::CloudData , FileListNodeContext
  • dataQueue : SLNet::BPSTracker
  • dataQueues : SLNet::StatisticsHistory::TrackedObject
  • dataRepository : SLNet::CloudServer
  • dataSize : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • debugInterface : SLNet::Router2
  • debugPort : SLNet::SystemAddress
  • defaultAssigmentAlgorithm : SLNet::TeamBalancer
  • defaultMTUSize : SLNet::RakPeer
  • defaultSendParameters : SLNet::ReplicaManager3
  • defaultTimeoutTime : SLNet::RakPeer
  • deleteData : SLNet::Packet
  • deletingSystemGUID : SLNet::Replica3
  • destination
: SLNet::NatPunchthroughClient::DSTAndFac
, SLNet::UDPForwarder::StopForwardingStruct
, SLNet::UDPForwarder::StartForwardingInputStruct
  • destinationConnection : SLNet::SerializeParameters
  • destroyedReplicasCulled : SLNet::Connection_RM3
  • detectionState : SLNet::NatTypeDetectionServer::NATDetectionAttempt
  • deviationRtt : SLNet::CCRakNetSlidingWindow
  • didComparisonThisTick : SLNet::VariableDeltaSerializer
  • direction : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • disallowedCallbackUserData : SLNet::FilterSet
  • disallowedMessageBanTimeMS : SLNet::FilterSet
  • doNotFragment : SLNet::RNS2_BerkleyBindParameters
  • downloadGroup : SLNet::Connection_RM3
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- e -

  • emptyString : SLNet::RakString
  • endpointAddress : SLNet::Router2::MiniPunchRequest
  • endpointGuid
: SLNet::Router2::MiniPunchRequest
, SLNet::Router2::ForwardedConnection
, SLNet::Router2::ConnnectRequest
  • endThreads : SLNet::RakPeer , SLNet::RNS2_Berkley
  • estimatedRTT : SLNet::CCRakNetSlidingWindow
  • eventCallbacks : SLNet::Rackspace
  • eventHandler : SLNet::RakNetSocket2 , SLNet::RNS2_BerkleyBindParameters
  • eventId : SLNet::ReadyEvent::ReadyEventNode
  • eventList : SLNet::SignaledEvent
  • eventStatus : SLNet::ReadyEvent::ReadyEventNode
  • expectedNextSequenceNumber : SLNet::CCRakNetSlidingWindow
  • EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS : SLNet::PunchthroughConfiguration
  • EXTERNAL_IP_WAIT_AFTER_FIRST_TTL : SLNet::PunchthroughConfiguration
  • EXTERNAL_IP_WAIT_BETWEEN_PORTS : SLNet::PunchthroughConfiguration
  • extraData : SLNet::RakPeer::RequestedConnectionStruct
  • extraSocketOptions : SLNet::RakPeer::BufferedCommandStruct , SLNet::SocketDescriptor
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- f -

  • facilitator : SLNet::NatPunchthroughClient::SendPing , SLNet::NatPunchthroughClient::DSTAndFac
  • failedAttemptList : SLNet::NatPunchthroughClient
  • failedConnectionAttemptMutex : SLNet::TCPInterface
  • failedConnectionAttempts : SLNet::TCPInterface
  • fileData : SLNet::FileListTransferCBInterface::OnFileStruct
  • fileIndex : SLNet::FileListTransferCBInterface::OnFileStruct
  • fileLengthBytes : SLNet::FileListNode
  • fileList : SLNet::FileList
  • fileListNode : SLNet::FileListTransfer::FileToPush
  • fileListProgressCallbacks : SLNet::FileList , SLNet::FileListTransfer
  • fileListReceivers : SLNet::FileListTransfer
  • fileListTransfer : SLNet::DirectoryDeltaTransfer , SLNet::FileListTransfer::ThreadData
  • filename : SLNet::FileListNode
  • fileName : SLNet::FileListTransferCBInterface::OnFileStruct
  • filesToPush : SLNet::FileListTransfer::FileToPushRecipient
  • fileToPushRecipientList : SLNet::FileListTransfer
  • fileToPushRecipientListMutex : SLNet::FileListTransfer
  • filter : SLNet::FilteredSystem
  • filterList : SLNet::MessageFilter
  • filterSetID : SLNet::FilterSet
  • firstDataChunk : SLNet::FileListTransferCBInterface::FileProgressStruct
  • firstExternalID : SLNet::RakPeer
  • firstPacket : SLNet::SplitPacketChannel
  • flnc_extraData1 : FileListNodeContext
  • flnc_extraData2 : FileListNodeContext
  • flnc_extraData3 : FileListNodeContext
  • forceAddress : SLNet::CloudServer
  • forceHostAddress : SLNet::UDPForwarder::StartForwardingInputStruct
  • forceSendUntilNextUpdate : SLNet::Replica3
  • forceTeamsToBeEven : SLNet::TeamBalancer
  • forwardedConnectionList : SLNet::Router2
  • forwardedConnectionListMutex : SLNet::Router2
  • forwardingPort : SLNet::Router2::MiniPunchRequest , SLNet::UDPForwarder::StartForwardingOutputStruct
  • forwardingRequestList : SLNet::UDPProxyCoordinator
  • forwardingSocket : SLNet::UDPForwarder::StartForwardingOutputStruct , SLNet::Router2::MiniPunchRequest
  • forwardListNotUpdated : SLNet::UDPForwarder
  • freeList : SLNet::RakString
  • fullPathToFile : SLNet::FileListNode
  • functionPointer : SLNet::RPC4::LocalSlotObject
  • functions : SLNet::RPC4::LocalCallback
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- g -

  • g : SLNet::RakNetGUID
  • generatedNonces : SLNet::TwoWayAuthentication::NonceGenerator
  • getRequests : SLNet::CloudServer
  • getString : SLNet::DynDNS
  • gotBlockingReturnValue : SLNet::RPC4
  • gotDownloadComplete : SLNet::Connection_RM3
  • gotReplyFromEndpoint : SLNet::Router2::MiniPunchRequest
  • gotReplyFromSource : SLNet::Router2::MiniPunchRequest
  • gotResult : SLNet::CloudServer::BufferedGetResponseFromServer
  • gotSubscribedAndUploadedKeys : SLNet::CloudServer::RemoteServer
  • grid : GridSectorizer
  • gridCellHeightCount : GridSectorizer
  • gridCellWidthCount : GridSectorizer
  • gridHeight : GridSectorizer
  • gridWidth : GridSectorizer
  • groupConstructionAndSerialize : SLNet::Connection_RM3
  • groupPunchthroughRequests : SLNet::NatPunchthroughServer::User
  • guid
: SLNet::NatPunchthroughClient::AddrAndGuid
, SLNet::Router2::ConnectionRequestSystem
, SLNet::Connection_RM3
, SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory
, SLNet::RelayPlugin::StrAndGuidAndRoom
, SLNet::VariableDeltaSerializer::SerializationContext
, SLNet::Packet
, SLNet::RelayPlugin::StrAndGuid
, SLNet::ConnectionGraph2::RemoteSystem
, SLNet::NatPunchthroughServer::User
, SLNet::RakPeer::RemoteSystemStruct
, SLNet::NatTypeDetectionServer::NATDetectionAttempt
, SLNet::ConnectionGraph2::SystemAddressAndGuid
  • guidToStrHash : SLNet::RelayPlugin
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- h -

  • hasPortStride : SLNet::NatPunchthroughClient
  • haveRakNetCloseSocket : SLNet::RakPeer::BufferedCommandStruct
  • headerLength : SLNet::InternalPacket
  • headPush : SLNet::TCPInterface
  • heap : DataStructures::Heap< weight_type, data_type, isMaxHeap > , DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • hMutex : SLNet::SignaledEvent
  • host : SLNet::DynDNS , SLNet::HTTPConnection2::Request
  • hostAddress : SLNet::RNS2_BerkleyBindParameters , SLNet::SocketDescriptor
  • hostCompletedAddress : SLNet::HTTPConnection2::Request
  • hostEstimatedAddress : SLNet::HTTPConnection2::Request
  • hostGuid : SLNet::TeamBalancer , SLNet::TM_World
  • httpCommand : SLNet::Rackspace::RackspaceOperation
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- i -

  • i : DataStructures::Table::Cell
  • ID : SLNet::TM_Team
  • identicalSerializationBs : SLNet::VariableDeltaSerializer
  • identifier : SLNet::TwoWayAuthentication::PendingChallenge
  • incomingDatagramEventHandler : SLNet::RakPeer
  • incomingMessages : SLNet::TCPInterface
  • incomingPassword : SLNet::RakPeer
  • incomingPasswordLength : SLNet::RakPeer
  • incomingQueueMutex : SLNet::RakPeer
  • incomingStream : SLNet::Rackspace::RackspaceOperation
  • incrementalReadInterface : SLNet::DirectoryDeltaTransfer , SLNet::FileListTransfer::FileToPush
  • index : SLNet::RemoteSystemIndex
  • indexIntoTeamsRequested : SLNet::TM_World::JoinRequestHelper
  • indicesToSend : SLNet::LastSerializationResultBS
  • inputFunctionQueue : ThreadPool< InputType, OutputType >
  • inputId : SLNet::UDPForwarder::StartForwardingInputStruct , SLNet::UDPForwarder::StartForwardingOutputStruct
  • inputQueue : ThreadPool< InputType, OutputType >
  • inputQueueMutex : ThreadPool< InputType, OutputType >
  • instance : SLNet::StringTable
  • intermediaryAddress : SLNet::Router2::ForwardedConnection
  • intermediaryGuid : SLNet::Router2::ForwardedConnection
  • INTERNAL_IP_WAIT_AFTER_ATTEMPTS : SLNet::PunchthroughConfiguration
  • internalIds : SLNet::NatPunchthroughClient::SendPing
  • interruptSignal : SLNet::RPC4
  • invalidMessageCallback : SLNet::FilterSet
  • invCellHeight : GridSectorizer
  • invCellWidth : GridSectorizer
  • IP : SLNet::RakPeer::BanStruct
  • ipList : SLNet::RakPeer
  • ipVersion : SLNet::HTTPConnection2::Request
  • iriDataChunk : SLNet::FileListTransferCBInterface::FileProgressStruct
  • iriWriteOffset : SLNet::FileListTransferCBInterface::FileProgressStruct
  • isActive : SLNet::RakPeer::RemoteSystemStruct , SLNet::RemoteClient
  • isActiveMutex : SLNet::RemoteClient
  • isAReference : SLNet::FileListNode
  • isDirty : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • isEmpty : DataStructures::Table::Cell
  • isFirstConstruction : SLNet::Connection_RM3
  • isLeaf : DataStructures::Page< KeyType, DataType, order >
  • isLimitedByCongestionControl : SLNet::RakNetStatistics
  • isLimitedByOutgoingBandwidthLimit : SLNet::RakNetStatistics
  • isMainLoopThreadActive : SLNet::RakPeer
  • isPendingAuthentication : SLNet::Rackspace::RackspaceOperation
  • isPost : SLNet::HTTPConnection::OutgoingCommand
  • isReady : SLNet::NatPunchthroughServer::User
  • isRecvFromLoopThreadActive : SLNet::RNS2_Berkley
  • isRunning : SLNet::UDPForwarder
  • isSignaled : SLNet::SignaledEvent
  • isSignaledMutex : SLNet::SignaledEvent
  • isStarted : SLNet::TCPInterface
  • isTeamSwitch : SLNet::TM_TeamMember::RequestedTeam
  • isUploaded : SLNet::CloudServer::CloudData
  • isValidated : SLNet::Connection_RM3
  • isValidPath : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • item : DataStructures::CircularLinkedList< CircularLinkedListType >::node , DataStructures::BinarySearchTree< BinarySearchTreeType >::node
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- j -

  • joinAnyRequestIndex : SLNet::TM_TeamMember
  • joinPermissions : SLNet::TM_Team
  • joinTeamType : SLNet::TeamSelection , SLNet::TM_TeamMember
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- k -

  • key
: SLNet::CloudQueryRow
, SLNet::CloudServer::CloudDataList
, SLNet::StatisticsHistory::TimeAndValueQueue
, SLNet::CloudServer::KeySubscriberID
  • key1 : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • key2 : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • keyData : SLNet::CloudServer::CloudDataList
  • keys : SLNet::CloudQuery , DataStructures::Page< KeyType, DataType, order >
  • kickOnDisallowedMessage : SLNet::FilterSet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- l -

  • l : SHA1_WORKSPACE_BLOCK
  • lastAutoSerializeOccurance : SLNet::ReplicaManager3
  • lastData : SLNet::VariableListDeltaTracker::VariableLastValueNode
  • lastReceivedStatus : SLNet::ReadyEvent::RemoteSystem
  • lastReliableSend : SLNet::RakPeer::RemoteSystemStruct
  • lastRequestedForwardingSystem : SLNet::Router2::ConnnectRequest
  • lastRtt : SLNet::CCRakNetSlidingWindow
  • lastSearchIndex : DataStructures::Map< key_type, data_type, key_comparison_func >
  • lastSearchIndexValid : DataStructures::Map< key_type, data_type, key_comparison_func >
  • lastSearchKey : DataStructures::Map< key_type, data_type, key_comparison_func >
  • lastSec1 : SLNet::BPSTracker
  • lastSentBitstream : SLNet::SerializeParameters
  • lastSentSerialization : SLNet::Replica3
  • lastSentStatus : SLNet::ReadyEvent::RemoteSystem
  • lastSentTextInput : SLNet::TelnetTransport::TelnetClient
  • lastSerializationResultBS : SLNet::LastSerializationResult
  • lastTeams : SLNet::TM_TeamMember
  • lastUpdate : SLNet::NatPunchthroughServer
  • lastUpdateTime : SLNet::SplitPacketChannel
  • leastNodeArray : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • left : DataStructures::BinarySearchTree< BinarySearchTreeType >::node , HuffmanEncodingTreeNode , SLNet::RakNetRandom
  • leftmostLeaf : DataStructures::BPlusTree< KeyType, DataType, order >
  • length
: SLNet::Packet
, SLNet::CloudQueryRow
, SLNet::RNS2_SendParameters
  • lengthAllocated : DataStructures::ByteQueue
  • limitConnectionFrequencyFromTheSameIP : SLNet::RakPeer
  • list_size : DataStructures::CircularLinkedList< CircularLinkedListType >
  • listenSocket : SLNet::TCPInterface
  • localCallbacks : SLNet::RPC4
  • localSlots : SLNet::RPC4
  • lockTeams : SLNet::TeamBalancer
  • logCommandParser : SLNet::PacketConsoleLogger
  • logDirectMessages : SLNet::PacketLogger
  • loggedInCoordinators : SLNet::UDPProxyServer
  • loggingInCoordinators : SLNet::UDPProxyServer
  • logMessages : SLNet::ThreadsafePacketLogger
  • longTermCount : SLNet::StatisticsHistory::TimeAndValueQueue
  • longTermHighest : SLNet::StatisticsHistory::TimeAndValueQueue
  • longTermLowest : SLNet::StatisticsHistory::TimeAndValueQueue
  • longTermSum : SLNet::StatisticsHistory::TimeAndValueQueue
  • lostConnections : SLNet::TCPInterface , SLNet::RakNetTransport2
  • lowestPing : SLNet::RakPeer::RemoteSystemStruct
  • lsr : SLNet::Replica3
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- m -

  • map : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
  • mapNodeData : DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode
  • mapNodeKey : DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode
  • mapNodeList : DataStructures::Map< key_type, data_type, key_comparison_func >
  • MAX_PREDICTIVE_PORT_RANGE : SLNet::PunchthroughConfiguration
  • maxBytesPerDowload : SLNet::CloudServer
  • maxForwardEntries : SLNet::UDPForwarder
  • MAXIMUM_MTU_INCLUDING_UDP_HEADER : SLNet::CCRakNetSlidingWindow
  • MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK : SLNet::PunchthroughConfiguration
  • maximumForwardingRequests : SLNet::Router2
  • maximumIncomingConnections : SLNet::RakPeer
  • maximumNumberOfPeers : SLNet::RakPeer
  • maxIndex : DataStructures::RangeNode< range_type >
  • maxMemberTimeMS : SLNet::FilterSet
  • maxOutgoingBPS : SLNet::RakPeer
  • maxRowsToReturn : SLNet::CloudQuery
  • maxUploadBytesPerClient : SLNet::CloudServer
  • memberGuid : SLNet::TeamBalancer::TeamMember
  • memberId : SLNet::TeamBalancer::TeamMember , SLNet::TeamBalancer::MyTeamMembers
  • memoryPool : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • memoryPoolMutex : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • memoryPoolPageSize : DataStructures::MemoryPool< MemoryBlockType >
  • messageHandlerList : SLNet::TCPInterface
  • messageId : SLNet::RPC4::LocalCallback
  • messageInSendBuffer : SLNet::RakNetStatistics
  • messageInternalOrder : SLNet::InternalPacket
  • messageNumberAssigned : SLNet::InternalPacket
  • messagesInResendBuffer : SLNet::RakNetStatistics
  • messageTimestamp : SLNet::SerializeParameters
  • minIndex : DataStructures::RangeNode< range_type >
  • miniPunchesInProgress : SLNet::Router2
  • miniPunchesInProgressMutex : SLNet::Router2
  • mostRecentExternalPort : SLNet::NatPunchthroughClient
  • mostRecentPort : SLNet::NatPunchthroughServer::User
  • MTUSize : SLNet::RakPeer::RemoteSystemStruct
  • mutexAttr : SLNet::SignaledEvent
  • myExternalSystemAddress : SLNet::RakPeer::RemoteSystemStruct
  • myGuid : SLNet::RakPeer
  • myIPStr : SLNet::DynDNS
  • myPrivateKey : SLNet::PublicKey
  • myPublicKey : SLNet::PublicKey
  • myTeamMembers : SLNet::TeamBalancer
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- n -

  • natDetectionAttempts : SLNet::NatTypeDetectionServer
  • natPunchthroughDebugInterface : SLNet::NatPunchthroughClient
  • natPunchthroughServerDebugInterface : SLNet::NatPunchthroughServer
  • networkID : SLNet::NetworkIDObject , SLNet::RakPeer::BufferedCommandStruct
  • networkId : SLNet::TM_TeamMember
  • networkIdHash : SLNet::NetworkIDManager
  • networkIDManager : SLNet::NetworkIDObject , SLNet::ReplicaManager3::RM3World
  • newConnections : SLNet::RakNetTransport2
  • newConnectionsObjectType : SLNet::StatisticsHistoryPlugin
  • newIncomingConnections : SLNet::TCPInterface
  • newRemoteClients : SLNet::TCPInterface
  • newSystemSend : SLNet::VariableDeltaSerializer::SerializationContext
  • next
: DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node
, DataStructures::CircularLinkedList< CircularLinkedListType >::node
, DataStructures::MemoryPool< MemoryBlockType >::Page
, SLNet::RemoteSystemIndex
, SLNet::RakNetRandom
, DataStructures::Page< KeyType, DataType, order >
  • nextAction : SLNet::Router2::MiniPunchRequest
  • nextActionTime : SLNet::InternalPacket , SLNet::NatPunchthroughClient::SendPing
  • nextCongestionControlBlock : SLNet::CCRakNetSlidingWindow
  • nextDatagramSequenceNumber : SLNet::CCRakNetSlidingWindow
  • nextGetRequestId : SLNet::CloudServer
  • nextGetRequestsCheck : SLNet::CloudServer
  • nextInputId : SLNet::UDPForwarder
  • nextInstanceForNetworkIDManager : SLNet::NetworkIDObject
  • nextPingTime : SLNet::RakPeer::RemoteSystemStruct
  • nextReferenceIndex : SLNet::ReplicaManager3
  • nextRequestId : SLNet::TwoWayAuthentication::NonceGenerator
  • nextRequestTime : SLNet::RakPeer::RequestedConnectionStruct
  • nextSlotRegistrationCount : SLNet::RPC4
  • nextStateTime : SLNet::NatTypeDetectionServer::NATDetectionAttempt
  • nextWriteIndex : SLNet::VariableListDeltaTracker
  • node : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent
  • nodeList : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • nonBlockingSocket : SLNet::RNS2_BerkleyBindParameters
  • nonce : SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest
  • nonceGenerator : SLNet::TwoWayAuthentication
  • nonSpecificSubscribers : SLNet::CloudServer::CloudDataList
  • noTeamSubcategory : SLNet::TM_TeamMember
  • numberOfBitsToSend : SLNet::RakPeer::BufferedCommandStruct
  • numberOfFilesInThisSet : SLNet::FileListTransferCBInterface::DownloadCompleteStruct , SLNet::FileListTransferCBInterface::OnFileStruct
  • numThreadsRunning : ThreadPool< InputType, OutputType >
  • numThreadsRunningMutex : ThreadPool< InputType, OutputType >
  • numThreadsWorking : ThreadPool< InputType, OutputType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- o -

  • objectId : SLNet::StatisticsHistory::TrackedObjectData
  • objects : SLNet::StatisticsHistory
  • objectType : SLNet::StatisticsHistory::TrackedObjectData
  • occasionalPing : SLNet::RakPeer
  • offlinePingResponse : SLNet::RakPeer
  • oldestUnsentAck : SLNet::CCRakNetSlidingWindow
  • onFileStruct : SLNet::FileListTransferCBInterface::FileProgressStruct
  • op : FileListNodeContext
  • operation
: DataStructures::Table::FilterQuery
, DataStructures::Table::SortQuery
, SLNet::Rackspace::RackspaceOperation
  • operations : SLNet::Rackspace
  • optimizeNextSeriesPush : DataStructures::Heap< weight_type, data_type, isMaxHeap >
  • orderedList : DataStructures::OrderedList< key_type, data_type, default_comparison_function >
  • orderedStringList : SLNet::StringTable
  • orderingChannel
: SLNet::DirectoryDeltaTransfer
, SLNet::FileListTransfer::FileToPush
, SLNet::InternalPacketFixedSizeTransmissionHeader
, SLNet::PRO
, SLNet::RakPeer::BufferedCommandStruct
  • orderingIndex : SLNet::InternalPacketFixedSizeTransmissionHeader
  • outgoingChallenges : SLNet::TwoWayAuthentication
  • outgoingCommand : SLNet::HTTPConnection
  • outgoingData : SLNet::RemoteClient
  • outgoingDataMutex : SLNet::RemoteClient
  • outgoingPassword : SLNet::RakPeer::RequestedConnectionStruct
  • outgoingPasswordLength : SLNet::RakPeer::RequestedConnectionStruct
  • outputBitstream : SLNet::SerializeParameters
  • outputQueue : ThreadPool< InputType, OutputType >
  • outputQueueMutex : ThreadPool< InputType, OutputType >
  • owner : SLNet::TM_Team , SLNet::TM_TeamMember
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- p -

  • packetAllocationPool : SLNet::RakPeer
  • packetAllocationPoolMutex : SLNet::RakPeer
  • packetLogFile : SLNet::PacketFileLogger
  • packetlossLastSecond : SLNet::RakNetStatistics
  • packetlossTotal : SLNet::RakNetStatistics
  • packetPriority : SLNet::FileListTransfer::FileToPush
  • packetQueue : SLNet::RakNetTransport2
  • packetReturnMutex : SLNet::RakPeer
  • packetReturnQueue : SLNet::RakPeer
  • pagePool : DataStructures::BPlusTree< KeyType, DataType, order >
  • parameterCount : SLNet::RegisteredCommand
  • parent : HuffmanEncodingTreeNode , DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent , SLNet::NetworkIDObject
  • parentPage : DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage
  • partCount : SLNet::FileListTransferCBInterface::FileProgressStruct
  • participants : SLNet::TM_World
  • partTotal : SLNet::FileListTransferCBInterface::FileProgressStruct
  • password : SLNet::ConsoleServer
  • passwords : SLNet::TwoWayAuthentication
  • pc : SLNet::NatPunchthroughClient
  • peer : SLNet::RakNetCommandParser
  • pendingRequests : SLNet::HTTPConnection2
  • pendingRequestsMutex : SLNet::HTTPConnection2
  • perThreadDataDestructor : ThreadPool< InputType, OutputType >
  • perThreadDataFactory : ThreadPool< InputType, OutputType >
  • phaseTimeout : SLNet::DynDNS
  • ping : SLNet::UDPProxyClient::ServerWithPing , SLNet::UDPProxyCoordinator::ServerWithPing
  • pingAndClockDifferential : SLNet::RakPeer::RemoteSystemStruct
  • pingAndClockDifferentialWriteIndex : SLNet::RakPeer::RemoteSystemStruct
  • pingServerGroups : SLNet::UDPProxyClient
  • pingTime : SLNet::RakPeer::PingAndClockDifferential
  • pingTimeout : SLNet::Router2::ConnnectRequest
  • pingToEndpoint : SLNet::Router2::ConnectionRequestSystem
  • pl : SLNet::NatPunchthroughDebugInterface_PacketLogger , SLNet::NatPunchthroughServerDebugInterface_PacketLogger
  • pluginListNTS : SLNet::RakPeer
  • pluginListTS : SLNet::RakPeer
  • pollingThreadPriority : SLNet::RNS2_BerkleyBindParameters
  • pool128 : DataStructures::BytePool
  • pool2048 : DataStructures::BytePool
  • pool512 : DataStructures::BytePool
  • pool8192 : DataStructures::BytePool
  • port
: SLNet::HTTPConnection2::Request
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::RNS2_BerkleyBindParameters
, SLNet::SocketDescriptor
  • portStride : SLNet::NatPunchthroughClient
  • portStrideCalTimeout : SLNet::NatPunchthroughClient
  • position : DataStructures::CircularLinkedList< CircularLinkedListType >
  • preallocationSize : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • prefix : SLNet::PacketLogger
  • prev : DataStructures::MemoryPool< MemoryBlockType >::Page
  • previous : DataStructures::Page< KeyType, DataType, order > , DataStructures::CircularLinkedList< CircularLinkedListType >::node
  • primaryIndex : DataStructures::HashIndex
  • primaryKey : SLNet::CloudKey
  • printAcks : SLNet::PacketLogger
  • printId : SLNet::PacketLogger
  • priority
: SLNet::PRO
, SLNet::DirectoryDeltaTransfer
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::InternalPacket
  • pro : SLNet::SerializeParameters
  • prompt : SLNet::ConsoleServer
  • protocol : SLNet::RNS2_BerkleyBindParameters
  • ptr : DataStructures::Table::Cell
  • publicKeyMode : SLNet::PublicKey , SLNet::RakPeer::RequestedConnectionStruct
  • punchingFixedPortAttempts : SLNet::NatPunchthroughClient::SendPing
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- q -

  • queryFilters : SLNet::CloudServer
  • queryResult : SLNet::CloudServer::BufferedGetResponseFromServer
  • queryToConstructReplicaList : SLNet::Connection_RM3
  • queryToDestructReplicaList : SLNet::Connection_RM3
  • queryToSerializeReplicaList : SLNet::Connection_RM3
  • queue : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • queuedOpenNat : SLNet::NatPunchthroughClient
  • queueHead : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • queueMutex : DataStructures::ThreadsafeAllocatingQueue< structureType >
  • queueTail : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • quitAndDataEvents : SLNet::RakPeer
  • quitAndIncomingDataEvents : ThreadPool< InputType, OutputType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- r -

  • r : CheckSum
  • r3CompositeOwner : SLNet::Replica3Composite< parent_type >
  • rackspaceCloudUsername : SLNet::Rackspace
  • rakNetGuid : SLNet::ReadyEvent::RemoteSystem , SLNet::AddressOrGUID
  • rakNetRandom : SLNet::EmailSender
  • rakNetSocket : SLNet::RakPeer::RemoteSystemStruct
  • rakPeerInterface : SLNet::PluginInterface2
  • rakPeerMutexes : SLNet::RakPeer
  • rakPeerSendReceipt : SLNet::VariableDeltaSerializer::SerializationContext
  • randResultQueue : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight
  • ranges : DataStructures::RangeList< range_type >
  • readOffset : DataStructures::ByteQueue
  • readyEventNodeList : SLNet::ReadyEvent
  • receipt : SLNet::RakPeer::BufferedCommandStruct
  • recentSum : SLNet::StatisticsHistory::TimeAndValueQueue
  • recentSumOfSquares : SLNet::StatisticsHistory::TimeAndValueQueue
  • recipient : SLNet::NatPunchthroughServer::ConnectionAttempt
  • refCount : SLNet::FileListTransfer::FileToPushRecipient , SLNet::InternalPacketRefCountedData , RefCountedObj , SLNet::RakString::SharedString , WSAStartupSingleton
  • refCountedData : SLNet::InternalPacket
  • refCountMutex : SLNet::FileListTransfer::FileToPushRecipient , SLNet::RakString::SharedString
  • referenceCount : SLNet::StringTable
  • referenceIndex : SLNet::Replica3
  • registeredBlockingFunctions : SLNet::RPC4
  • registeredNonblockingFunctions : SLNet::RPC4
  • registrationCount : SLNet::RPC4::LocalSlotObject
  • reliability
: SLNet::InternalPacketFixedSizeTransmissionHeader
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::PRO
  • reliabilityLayer : SLNet::RakPeer::RemoteSystemStruct
  • reliableMessageNumber : SLNet::InternalPacketFixedSizeTransmissionHeader
  • remainingServersToTry : SLNet::UDPProxyCoordinator::ForwardingRequest
  • remoteClients : SLNet::TCPInterface , SLNet::TelnetTransport
  • remoteClientsLength : SLNet::TCPInterface
  • remoteConnections : SLNet::ConnectionGraph2::RemoteSystem
  • remoteLoginPassword : SLNet::UDPProxyCoordinator
  • remotePath : SLNet::HTTPConnection::OutgoingCommand
  • remotePortRakNetWasStartedOn_PS3 : SLNet::RakPeer::BufferedCommandStruct
  • remotePortRakNetWasStartedOn_PS3_PS4_PSP2 : SLNet::RNS2_BerkleyBindParameters
  • remotePortRakNetWasStartedOn_PS3_PSP2 : SLNet::SocketDescriptor
  • remoteServerPublicKey : SLNet::PublicKey
  • remoteServerResponses : SLNet::CloudServer::GetRequest
  • remoteServers : SLNet::CloudServer
  • remoteSystem : SLNet::TwoWayAuthentication::PendingChallenge , SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest
  • remoteSystemIndex : SLNet::RakPeer::RemoteSystemStruct
  • remoteSystemIndexPool : SLNet::RakPeer
  • remoteSystemList : SLNet::RakPeer
  • remoteSystemLookup : SLNet::RakPeer
  • remoteSystems : SLNet::CloudServer , SLNet::ConnectionGraph2
  • remoteSystemVariableHistoryList : SLNet::VariableDeltaSerializer
  • remoteUsers : SLNet::LogCommandParser
  • removeLostConnections : SLNet::StatisticsHistoryPlugin
  • replica : SLNet::LastSerializationResult
  • replicaManager : SLNet::Replica3
  • replyFromTargetBroadcast : SLNet::RakPeer
  • replyFromTargetBS : SLNet::RakPeer
  • replyFromTargetPlayer : SLNet::RakPeer
  • requested : SLNet::TM_TeamMember::RequestedTeam
  • requestedCloseConnections : SLNet::TCPInterface
  • requestedConnectionQueue : SLNet::RakPeer
  • requestedConnectionQueueMutex : SLNet::RakPeer
  • requestedTeam : SLNet::TeamBalancer::TeamMember , SLNet::TeamBalancer::MyTeamMembers
  • requestId : SLNet::CloudServer::GetRequest , SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest
  • requestIndex : SLNet::TM_TeamMember::RequestedTeam , SLNet::TM_World::JoinRequestHelper
  • requestingAddress : SLNet::UDPProxyCoordinator::ForwardingRequest
  • requestingClient : SLNet::CloudServer::GetRequest
  • requestsMade : SLNet::RakPeer::RequestedConnectionStruct
  • requestStartTime : SLNet::CloudServer::GetRequest
  • requestState : SLNet::Router2::ConnnectRequest
  • resendNext : SLNet::InternalPacket
  • resendPrev : SLNet::InternalPacket
  • result : SLNet::UDPForwarder::StartForwardingOutputStruct , SLNet::DynDNS
  • resultDescription : SLNet::DynDNS
  • resultHandler : SLNet::UDPProxyClient , SLNet::UDPProxyServer
  • resultKeyIndices : SLNet::CloudQueryResult
  • retransmissionTime : SLNet::InternalPacket
  • retryCount : SLNet::NatPunchthroughClient::SendPing
  • retryOnFailure : SLNet::PunchthroughConfiguration
  • returnConnectionLostOnFailure : SLNet::Router2::ForwardedConnection , SLNet::Router2::ConnnectRequest
  • right : DataStructures::BinarySearchTree< BinarySearchTreeType >::node , HuffmanEncodingTreeNode
  • rnr : SLNet::RakNetRandomSync
  • rns2Socket : SLNet::RNS2_Berkley
  • roomName : SLNet::RelayPlugin::RP_Group
  • root
: DataStructures::BPlusTree< KeyType, DataType, order >
, DataStructures::BinarySearchTree< BinarySearchTreeType >
, DataStructures::CircularLinkedList< CircularLinkedListType >
  • rootNode : DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
  • rows : DataStructures::Table
  • rowsReturned : SLNet::CloudQueryResult
  • runningTotal : SLNet::RakNetStatistics
  • runThreads : ThreadPool< InputType, OutputType >
  • runThreadsMutex : ThreadPool< InputType, OutputType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- s -

  • s1p2 : SLNet::NatTypeDetectionServer
  • s2p3 : SLNet::NatTypeDetectionServer
  • s3p4 : SLNet::NatTypeDetectionServer
  • s3p4Address : SLNet::NatTypeDetectionServer
  • s4p5 : SLNet::NatTypeDetectionServer
  • sata : SLNet::UDPProxyClient::PingServerGroup , SLNet::UDPProxyCoordinator::ForwardingRequest
  • secondaryIndex : DataStructures::HashIndex
  • secondaryKey : SLNet::CloudKey
  • securityExceptionList : SLNet::RakPeer
  • securityExceptionMutex : SLNet::RakPeer
  • seed : SLNet::RakNetRandomSync
  • sendConnectionAttemptCount : SLNet::RakPeer::RequestedConnectionStruct
  • sender : SLNet::NatPunchthroughServer::ConnectionAttempt
  • senderClientAddress : SLNet::UDPProxyCoordinator::SenderAndTargetAddress , SLNet::UDPProxyClient::SenderAndTargetAddress
  • senderClientGuid : SLNet::UDPProxyCoordinator::SenderAndTargetAddress
  • senderGuid
: SLNet::FileListTransferCBInterface::OnFileStruct
, SLNet::FileListTransferCBInterface::FileProgressStruct
, SLNet::FileListTransferCBInterface::DownloadCompleteStruct
  • sendersPingToThatSystem : SLNet::ConnectionGraph2::SystemAddressAndGuid
  • senderSystemAddress
: SLNet::FileListTransferCBInterface::OnFileStruct
, SLNet::FileListTransferCBInterface::FileProgressStruct
, SLNet::FileListTransferCBInterface::DownloadCompleteStruct
  • sendPrefix : SLNet::TelnetTransport
  • sendReceipt
: SLNet::PRO
, SLNet::VariableDeltaSerializer::SerializationContext
, SLNet::VariableDeltaSerializer::ChangedVariablesList
  • sendReceiptSerial : SLNet::InternalPacket , SLNet::RakPeer
  • sendReceiptSerialMutex : SLNet::RakPeer
  • sendSuffix : SLNet::TelnetTransport
  • sentHash : SLNet::TwoWayAuthentication::PendingChallenge
  • sentRequests : SLNet::HTTPConnection2
  • sentRequestsMutex : SLNet::HTTPConnection2
  • sentTTL : SLNet::NatPunchthroughClient::SendPing
  • sequencingIndex : SLNet::InternalPacketFixedSizeTransmissionHeader
  • serializationBitstream : SLNet::DeserializeParameters
  • serializationMode : SLNet::VariableDeltaSerializer::SerializationContext
  • serverAddress
: SLNet::CloudServer::RemoteServer
, SLNet::CloudServer::BufferedGetResponseFromServer
, SLNet::DynDNS
, SLNet::NatTypeDetectionClient
, SLNet::UDPProxyClient::ServerWithPing
, SLNet::UDPProxyCoordinator::ServerWithPing
  • serverGUID : SLNet::CloudQueryRow , SLNet::CloudServer::CloudData
  • serverList : SLNet::UDPProxyCoordinator
  • serverManagementDomain : SLNet::Rackspace
  • serverManagementPath : SLNet::Rackspace
  • serverManagementURL : SLNet::Rackspace
  • serverPublicIp : SLNet::UDPProxyServer
  • serverSelectionBitstream : SLNet::UDPProxyCoordinator::ForwardingRequest
  • serversToPing : SLNet::UDPProxyClient::PingServerGroup
  • serverSystemAddress : SLNet::CloudQueryRow , SLNet::CloudServer::CloudData
  • sessionId
: SLNet::NatPunchthroughClient::SendPing
, SLNet::NatPunchthroughServer::ConnectionAttempt
, SLNet::NatPunchthroughServer
  • setBroadcast : SLNet::RNS2_BerkleyBindParameters
  • setId : SLNet::FileListTransfer::FileToPushRecipient , SLNet::FileListTransfer::ThreadData
  • setID : SLNet::FileListTransferCBInterface::OnFileStruct , SLNet::FileListTransferCBInterface::DownloadCompleteStruct
  • setId : SLNet::FileListTransfer
  • setIndex : SLNet::FileListTransfer::FileToPush
  • setIPHdrIncl : SLNet::RNS2_BerkleyBindParameters
  • sharedDataBlock : SLNet::InternalPacketRefCountedData
  • sharedString : SLNet::RakString
  • signalDeletion : DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight
  • size : DataStructures::Page< KeyType, DataType, order > , DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
  • slotObjects : SLNet::RPC4::LocalSlot
  • smallString : SLNet::RakString::SharedString
  • socket
: SLNet::RakPeer::RequestedConnectionStruct
, SLNet::RakPeer::BufferedCommandStruct
, SLNet::RNS2RecvStruct
, SLNet::RemoteClient
, SLNet::UDPForwarder::ForwardEntry
  • socketFamily
: SLNet::Router2
, SLNet::TCPInterface::ThisPtrPlusSysAddr
, SLNet::SocketDescriptor
, SLNet::UDPForwarder::ForwardEntry
, SLNet::UDPForwarder::StartForwardingInputStruct
, SLNet::UDPProxyServer
  • socketIndex : SLNet::RakPeer::RequestedConnectionStruct
  • socketList : SLNet::RakPeer
  • socketQueryOutput : SLNet::RakPeer
  • sockets : SLNet::RakPeer::SocketQueryOutput
  • socketType : SLNet::RakNetSocket2
  • sortState : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • sortValue : SLNet::StatisticsHistory::TimeAndValueQueue
  • source : SLNet::UDPForwarder::StartForwardingInputStruct , SLNet::UDPForwarder::StopForwardingStruct
  • sourceAddress : SLNet::Router2::MiniPunchRequest
  • sourceConnection : SLNet::DeserializeParameters
  • sourceGuid : SLNet::Router2::MiniPunchRequest
  • sourceServerPings : SLNet::UDPProxyCoordinator::ForwardingRequest
  • sp : SLNet::NatPunchthroughClient
  • specificSubscribers : SLNet::CloudServer::CloudData
  • specificSystems : SLNet::CloudServer::CloudQueryWithAddresses
  • specificSystemsSubscribedTo : SLNet::CloudServer::KeySubscriberID
  • speedUpThisBlock : SLNet::CCRakNetSlidingWindow
  • splitMessageProgressInterval : SLNet::RakPeer
  • splitPacketCount : SLNet::InternalPacketFixedSizeTransmissionHeader
  • splitPacketId : SLNet::InternalPacketFixedSizeTransmissionHeader
  • splitPacketIndex : SLNet::InternalPacketFixedSizeTransmissionHeader
  • splitPacketList : SLNet::SplitPacketChannel
  • ssThresh : SLNet::CCRakNetSlidingWindow
  • stackData : SLNet::CloudServer::CloudData , SLNet::InternalPacket
  • startForwardingInput : SLNet::UDPForwarder
  • startForwardingOutput : SLNet::UDPForwarder
  • startForwardingOutputMutex : SLNet::UDPForwarder
  • startingOffset : SLNet::NetworkIDManager
  • startingRowIndex : SLNet::CloudQuery
  • startPingTime : SLNet::UDPProxyClient::PingServerGroup
  • startTime : SLNet::NatPunchthroughServer::ConnectionAttempt
  • state : SLNet::RakNetRandom
  • statistics : SLNet::StatisticsHistoryPlugin
  • stopForwardingCommands : SLNet::UDPForwarder
  • storageDomain : SLNet::Rackspace
  • storagePath : SLNet::Rackspace
  • storageToken : SLNet::Rackspace
  • storageURL : SLNet::Rackspace
  • str : StrAndBool , SLNet::RelayPlugin::StrAndGuidAndRoom , SLNet::RelayPlugin::StrAndGuid
  • strIndex : VariadicSQLParser::IndexAndType
  • string : DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node
  • stringReceived : SLNet::HTTPConnection2::Request
  • stringToTransmit : SLNet::HTTPConnection2::Request
  • strToGuidHash : SLNet::RelayPlugin
  • subscribedKeys : SLNet::CloudServer::RemoteCloudClient , SLNet::CloudServer::RemoteServer
  • subscriberCount : SLNet::CloudServer::CloudDataList
  • subscribeToResults : SLNet::CloudQuery , SLNet::CloudQueryResult
  • suffix : SLNet::PacketLogger
  • sum : CheckSum
  • systemAddress
: SLNet::AddressOrGUID
, SLNet::ConnectionGraph2::SystemAddressAndGuid
, SLNet::TelnetTransport::TelnetClient
, SLNet::NatPunchthroughServer::User
, SLNet::LogCommandParser::SystemAddressAndChannel
, SLNet::FileListTransfer::FileToPushRecipient
, SLNet::RakPeer::RequestedConnectionStruct
, SLNet::NatTypeDetectionServer::NATDetectionAttempt
, SLNet::TCPInterface::ThisPtrPlusSysAddr
, SLNet::RNS2RecvStruct
, SLNet::RakPeer::RemoteSystemStruct
, SLNet::FileListTransfer::ThreadData
, SLNet::Connection_RM3
, SLNet::Packet
, SLNet::RNS2_SendParameters
, SLNet::RemoteClient
  • systemIdentifier : SLNet::RakPeer::BufferedCommandStruct
  • systemIndex : SLNet::RakNetGUID , SLNet::SystemAddress
  • systemList : SLNet::ReadyEvent::ReadyEventNode , SLNet::MessageFilter
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- t -

  • tailPush : SLNet::TCPInterface
  • targetAddress : SLNet::NatPunchthroughClient::SendPing
  • targetClientAddress : SLNet::UDPProxyCoordinator::SenderAndTargetAddress , SLNet::UDPProxyClient::SenderAndTargetAddress
  • targetClientGuid : SLNet::UDPProxyCoordinator::SenderAndTargetAddress
  • targetGuid : SLNet::NatPunchthroughClient::SendPing
  • targetServerPings : SLNet::UDPProxyCoordinator::ForwardingRequest
  • tcp : SLNet::DynDNS
  • tcpInterface
: SLNet::PluginInterface2
, SLNet::Rackspace
, SLNet::TCPInterface::ThisPtrPlusSysAddr
, SLNet::TelnetTransport
  • tdiContext : ThreadPool< InputType, OutputType >
  • teamLimits : SLNet::TeamBalancer
  • teamManager : SLNet::TM_World
  • teamMemberCounts : SLNet::TeamBalancer
  • teamMemberIndex : SLNet::TM_World::JoinRequestHelper
  • teamMemberLimit : SLNet::TM_Team
  • teamMembers
: SLNet::TeamBalancer
, SLNet::TM_Team
, SLNet::TM_World
  • teamMembersHash : SLNet::TM_World
  • teamParameter : SLNet::TeamSelection
  • teamRequestIndex : SLNet::TM_World
  • teams : SLNet::TM_TeamMember , SLNet::TM_World
  • teamsHash : SLNet::TM_World
  • teamsRequested : SLNet::TM_TeamMember
  • teamToLeave : SLNet::TM_TeamMember::RequestedTeam
  • testMode : SLNet::NatPunchthroughClient::SendPing
  • textInput : SLNet::TelnetTransport::TelnetClient
  • theirInternalSystemAddress : SLNet::RakPeer::RemoteSystemStruct
  • thisChunkSize : SLNet::HTTPConnection2::Request
  • threadDataInterface : ThreadPool< InputType, OutputType >
  • threadPool : SLNet::FileListTransfer
  • threadPriority : SLNet::TCPInterface
  • threadRunning : SLNet::TCPInterface , SLNet::UDPForwarder
  • time
: SLNet::BPSTracker::TimeAndValue2
, SLNet::StatisticsHistory::TimeAndValue
, SLNet::TwoWayAuthentication::PendingChallenge
  • TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL : SLNet::PunchthroughConfiguration
  • TIME_BETWEEN_PUNCH_ATTEMPTS_INTERNAL : SLNet::PunchthroughConfiguration
  • timeBetweenAttempts : SLNet::NatTypeDetectionServer::NATDetectionAttempt
  • timeBetweenSendConnectionAttemptsMS : SLNet::RakPeer::RequestedConnectionStruct
  • timeEnteredThisSet : SLNet::FilteredSystem
  • timeExceedBanTimeMS : SLNet::FilterSet
  • timeLastDatagramForwarded : SLNet::UDPForwarder::ForwardEntry
  • timeout : SLNet::RakPeer::BanStruct , SLNet::Router2::MiniPunchRequest
  • timeoutAfterSuccess : SLNet::UDPProxyCoordinator::ForwardingRequest
  • timeoutCallback : SLNet::FilterSet
  • timeoutOnNoDataMS
: SLNet::UDPForwarder::ForwardEntry
, SLNet::UDPForwarder::StartForwardingInputStruct
, SLNet::UDPProxyCoordinator::ForwardingRequest
  • timeoutTime : SLNet::RakPeer::RequestedConnectionStruct
  • timeoutUserData : SLNet::FilterSet
  • timeRead : SLNet::RNS2RecvStruct
  • timeRequestedPings : SLNet::UDPProxyCoordinator::ForwardingRequest
  • timesSent : SLNet::InternalPacket
  • timeStamp : SLNet::DeserializeParameters
  • timeToTrack : SLNet::StatisticsHistory
  • timeToTrackValues : SLNet::StatisticsHistory::TimeAndValueQueue
  • topology : SLNet::TeamManager
  • total1 : SLNet::BPSTracker
  • trackedObjectData : SLNet::StatisticsHistory::TrackedObject
  • trackFrequencyTable : SLNet::RakPeer
  • trans : SLNet::LogCommandParser
  • transport : SLNet::ConsoleServer
  • ttl : SLNet::RNS2_SendParameters
  • type : SLNet::Rackspace::RackspaceOperation , SLNet::RNS2_BerkleyBindParameters
  • typeMappingIndex : VariadicSQLParser::IndexAndType
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- u -

  • UDP_SENDS_PER_PORT_EXTERNAL : SLNet::PunchthroughConfiguration
  • UDP_SENDS_PER_PORT_INTERNAL : SLNet::PunchthroughConfiguration
  • udpForwarder : SLNet::UDPProxyServer , SLNet::Router2
  • unavailablePages : DataStructures::MemoryPool< MemoryBlockType >
  • unavailablePagesSize : DataStructures::MemoryPool< MemoryBlockType >
  • union : SLNet::SystemAddress
  • unreliableNext : SLNet::InternalPacket
  • unreliablePrev : SLNet::InternalPacket
  • unreliableTimeout : SLNet::RakPeer
  • unsetDefaultAllocator : SLNet::CloudClient
  • updateCycleIsRunning : SLNet::RakPeer
  • updatedVariablesHistory : SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory
  • updatedVariablesMemoryPool : SLNet::VariableDeltaSerializer
  • uploadedBytes : SLNet::CloudServer::RemoteCloudClient
  • uploadedKeys : SLNet::CloudServer::RemoteCloudClient , SLNet::CloudServer::RemoteServer
  • uploaderCount : SLNet::CloudServer::CloudDataList
  • usedForwardingEntries : SLNet::Router2::ConnectionRequestSystem
  • usedValueBufferCount : SLNet::RakNetRandomSync
  • usedValues : SLNet::RakNetRandomSync
  • userConnectionSocketIndex : SLNet::RakNetSocket2
  • userData : SLNet::HTTPConnection2::Request , SLNet::StatisticsHistory::TrackedObjectData
  • userMemory : DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage
  • userReplicaList : SLNet::ReplicaManager3::RM3World
  • users : SLNet::NatPunchthroughServer
  • usersInRoom : SLNet::RelayPlugin::RP_Group
  • userUpdateThreadData : SLNet::RakPeer
  • userUpdateThreadPtr : SLNet::RakPeer
  • useSSL : SLNet::TCPInterface::ThisPtrPlusSysAddr , SLNet::HTTPConnection2::Request
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- v -

  • val
: DataStructures::MLKeyRef< templateType >
, SLNet::StatisticsHistory::TimeAndValue
, SLNet::uint24_t
  • validationInteger : SLNet::RakPeer
  • value : HuffmanEncodingTreeNode , SLNet::LocklessUint32_t
  • value1 : SLNet::BPSTracker::TimeAndValue2
  • valueOverLastSecond : SLNet::RakNetStatistics
  • values : SLNet::StatisticsHistory::TimeAndValueQueue
  • VARIABLE_NUMBER_OF_PARAMETERS : SLNet::CommandParserInterface
  • variableHistory : SLNet::VariableDeltaSerializer::SerializationContext
  • variableHistoryIdentical : SLNet::VariableDeltaSerializer::SerializationContext
  • variableHistoryUnique : SLNet::VariableDeltaSerializer::SerializationContext
  • variableList : SLNet::VariableListDeltaTracker
  • variableListDeltaTracker : SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory
  • variableMultilistType : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- w -

  • waitingPackets : SLNet::PacketizedTCP
  • wasGeneratedLocally : SLNet::Packet
  • weAreSender : SLNet::NatPunchthroughClient::SendPing
  • weight : DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode , HuffmanEncodingTreeNode , DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight
  • weInitiatedForwarding : SLNet::Router2::ForwardedConnection
  • weInitiatedTheConnection : SLNet::RakPeer::RemoteSystemStruct
  • whenGenerated : SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest
  • whenJoinAnyRequested : SLNet::TM_TeamMember
  • whenLastSerialized : SLNet::LastSerializationResult , SLNet::SerializeParameters
  • whenLastTimeoutCheck : SLNet::MessageFilter , SLNet::TwoWayAuthentication
  • whenRequested : SLNet::TM_TeamMember::RequestedTeam
  • whenRequestMade : SLNet::TM_World::JoinRequestHelper
  • workingFlag : SLNet::CloudServer::RemoteServer
  • workingThreadCountMutex : ThreadPool< InputType, OutputType >
  • world : SLNet::TM_TeamMember , SLNet::TM_Team
  • worldId : SLNet::ReplicaManager3::RM3World , SLNet::TM_World
  • worldsArray : SLNet::TeamManager , SLNet::ReplicaManager3
  • worldsList : SLNet::TeamManager , SLNet::ReplicaManager3
  • writeOffset : DataStructures::ByteQueue
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Variables

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

- x -

  • xml : SLNet::Rackspace::RackspaceOperation
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Enumerations

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • AllocationScheme : SLNet::InternalPacket
  • ColumnType : DataStructures::Table
  • ConnectMode : SLNet::RakPeer::RemoteSystemStruct
  • ConnectPhase : SLNet::DynDNS
  • ConstructionMode : SLNet::Connection_RM3
  • DefaultAssigmentAlgorithm : SLNet::TeamBalancer
  • Direction_Types : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • FilterQueryType : DataStructures::Table
  • NATDetectionState : SLNet::NatTypeDetectionServer
  • REPORT_TYPE : CSHA1
  • ResponseCodes : SLNet::HTTPConnection
  • Router2RequestStates : SLNet::Router2
  • SHDataCategory : SLNet::StatisticsHistory
  • SHErrorCode : SLNet::StatisticsHistory
  • SHSortOperation : SLNet::StatisticsHistory
  • SortQueryType : DataStructures::Table
  • TestMode : SLNet::NatPunchthroughClient::SendPing
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Enumerator

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • b
  • c
  • d
  • f
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w

- b -

  • BCS_CHANGE_SYSTEM_ADDRESS : SLNet::RakPeer::BufferedCommandStruct
  • BCS_CLOSE_CONNECTION : SLNet::RakPeer::BufferedCommandStruct
  • BCS_DO_NOTHING : SLNet::RakPeer::BufferedCommandStruct
  • BCS_GET_SOCKET : SLNet::RakPeer::BufferedCommandStruct
  • BCS_SEND : SLNet::RakPeer::BufferedCommandStruct
  • BINARY : DataStructures::Table

- c -

  • CALCULATING_PORT_STRIDE : SLNet::NatPunchthroughClient
  • CONNECT : SLNet::RakPeer::RequestedConnectionStruct
  • CONNECTED : SLNet::RakPeer::RemoteSystemStruct
  • CP_CONNECTING_TO_CHECKIP : SLNet::DynDNS
  • CP_CONNECTING_TO_DYNDNS : SLNet::DynDNS
  • CP_IDLE : SLNet::DynDNS
  • CP_WAITING_FOR_CHECKIP_RESPONSE : SLNet::DynDNS
  • CP_WAITING_FOR_DYNDNS_RESPONSE : SLNet::DynDNS

- d -

  • DC_CONTINUOUS : SLNet::StatisticsHistory
  • DC_DISCRETE : SLNet::StatisticsHistory
  • Deleted : SLNet::HTTPConnection
  • DISCONNECT_ASAP : SLNet::RakPeer::RemoteSystemStruct
  • DISCONNECT_ASAP_SILENTLY : SLNet::RakPeer::RemoteSystemStruct
  • DISCONNECT_ON_NO_ACK : SLNet::RakPeer::RemoteSystemStruct

- f -

  • FILL_IN_ORDER : SLNet::TeamBalancer

- h -

  • HANDLING_CONNECTION_REQUEST : SLNet::RakPeer::RemoteSystemStruct
  • HAS_PORT_STRIDE : SLNet::NatPunchthroughClient

- i -

  • INCAPABLE_PORT_STRIDE : SLNet::NatPunchthroughClient

- l -

  • LEFT : DataStructures::BinarySearchTree< BinarySearchTreeType >

- m -

  • ML_SORTED_ASCENDING : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ML_SORTED_DESCENDING : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
  • ML_UNSORTED : DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >

- n -

  • NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS : SLNet::NatPunchthroughServer::ConnectionAttempt
  • NAT_ATTEMPT_PHASE_NOT_STARTED : SLNet::NatPunchthroughServer::ConnectionAttempt
  • NO_ACTION : SLNet::RakPeer::RemoteSystemStruct , DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • NoBody : SLNet::HTTPConnection
  • NORMAL : SLNet::InternalPacket
  • NOT_FOUND : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • NUMBER_OF_RAKPEER_MUTEXES : SLNet::RakPeer
  • NUMERIC : DataStructures::Table

- o -

  • offlinePingResponse_Mutex : SLNet::RakPeer
  • OK : SLNet::HTTPConnection

- p -

  • POINTER : DataStructures::Table
  • PUNCHING_FIXED_PORT : SLNet::NatPunchthroughClient::SendPing
  • PUSH_KEY_TO_PARENT : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction

- q -

  • QF_EQUAL : DataStructures::Table
  • QF_GREATER_THAN : DataStructures::Table
  • QF_GREATER_THAN_EQ : DataStructures::Table
  • QF_IS_EMPTY : DataStructures::Table
  • QF_LESS_THAN : DataStructures::Table
  • QF_LESS_THAN_EQ : DataStructures::Table
  • QF_NOT_EMPTY : DataStructures::Table
  • QF_NOT_EQUAL : DataStructures::Table
  • QS_DECREASING_ORDER : DataStructures::Table
  • QS_INCREASING_ORDER : DataStructures::Table
  • QUERY_CONNECTION_FOR_REPLICA_LIST : SLNet::Connection_RM3
  • QUERY_REPLICA_FOR_CONSTRUCTION : SLNet::Connection_RM3
  • QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION : SLNet::Connection_RM3

- r -

  • R2RS_REQUEST_STATE_QUERY_FORWARDING : SLNet::Router2
  • REF_COUNTED : SLNet::InternalPacket
  • REPLACE_KEY1_WITH_KEY2 : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • REPORT_DIGIT : CSHA1
  • REPORT_HEX : CSHA1
  • REPORT_HEX_SHORT : CSHA1
  • REQUEST_STATE_REQUEST_FORWARDING : SLNet::Router2
  • REQUESTED_CONNECTION : SLNet::RakPeer::RemoteSystemStruct
  • requestedConnectionList_Mutex : SLNet::RakPeer
  • RIGHT : DataStructures::BinarySearchTree< BinarySearchTreeType >
  • ROOT : DataStructures::BinarySearchTree< BinarySearchTreeType >

- s -

  • SET_BRANCH_KEY : DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
  • SH_DO_NOT_SORT : SLNet::StatisticsHistory
  • SH_INVALID_PARAMETER : SLNet::StatisticsHistory
  • SH_OK : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_AVERAGE_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_AVERAGE_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_HIGHEST_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_HIGHEST_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_LOWEST_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_LOWEST_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_SUM_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_LONG_TERM_SUM_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_AVERAGE_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_AVERAGE_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_HIGHEST_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_HIGHEST_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_LOWEST_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_LOWEST_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_SUM_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_SUM_DESCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_SUM_OF_SQUARES_ASCENDING : SLNet::StatisticsHistory
  • SH_SORT_BY_RECENT_SUM_OF_SQUARES_DESCENDING : SLNet::StatisticsHistory
  • SH_UKNOWN_KEY : SLNet::StatisticsHistory
  • SH_UKNOWN_OBJECT : SLNet::StatisticsHistory
  • SMALLEST_TEAM : SLNet::TeamBalancer
  • STACK : SLNet::InternalPacket
  • STATE_DONE : SLNet::NatTypeDetectionServer
  • STATE_NONE : SLNet::NatTypeDetectionServer
  • STATE_TESTING_ADDRESS_RESTRICTED_1 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_ADDRESS_RESTRICTED_2 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_FULL_CONE_1 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_FULL_CONE_2 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_NONE_1 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_NONE_2 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_PORT_RESTRICTED_1 : SLNet::NatTypeDetectionServer
  • STATE_TESTING_PORT_RESTRICTED_2 : SLNet::NatTypeDetectionServer
  • STRING : DataStructures::Table

- t -

  • TESTING_EXTERNAL_IPS_1024_TO_1024 : SLNet::NatPunchthroughClient::SendPing
  • TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT : SLNet::NatPunchthroughClient::SendPing
  • TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024 : SLNet::NatPunchthroughClient::SendPing
  • TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT : SLNet::NatPunchthroughClient::SendPing
  • TESTING_INTERNAL_IPS : SLNet::NatPunchthroughClient::SendPing

- u -

  • UNKNOWN_PORT_STRIDE : SLNet::NatPunchthroughClient
  • UNVERIFIED_SENDER : SLNet::RakPeer::RemoteSystemStruct

- w -

  • WAITING_AFTER_ALL_ATTEMPTS : SLNet::NatPunchthroughClient::SendPing
  • WAITING_FOR_INTERNAL_IPS_RESPONSE : SLNet::NatPunchthroughClient::SendPing
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Members - Related Functions

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Enumerations
  • Enumerator
  • Related Functions
  • ProcessNetworkPacket : SLNet::RakPeer
  • ProcessOfflineNetworkPacket : SLNet::RakPeer
  • SendIRIToAddressCB : SLNet::FileListTransfer
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File List

File List
Here is a list of all files with brief descriptions:
[detail level 1234]
\ - Source |
o + include |
| \ + slikenet |
| o * _FindFirst.h |
| o * alloca.h |
| o * assert.h |
| o * AutopatcherPatchContext.h |
| o * AutopatcherRepositoryInterface.h | An interface used by AutopatcherServer to get the data necessary to run an autopatcher
| o * Base64Encoder.h |
| o * BitStream.h | This class allows you to write and read native types as a string of bits
| o * CCRakNetSlidingWindow.h |
| o * CCRakNetUDT.h |
| o * CheckSum.h |
| o * CloudClient.h | Queries CloudMemoryServer to download data that other clients have uploaded
| o * CloudCommon.h |
| o * CloudServer.h | Stores client data, and allows cross-server communication to retrieve this data
| o * commandparser.h | Contains RakNetCommandParser , used to send commands to an instance of RakPeer
| o * CommandParserInterface.h | Contains CommandParserInterface , from which you derive custom command parsers
| o * ConnectionGraph2.h | Connection graph plugin, version 2. Tells new systems about existing and new connections
| o * ConsoleServer.h | Contains ConsoleServer , used to plugin to your game to accept remote console-based connections
| o * DataCompressor.h | DataCompressor does compression on a block of data
| o * defineoverrides.h |
| o * defines.h |
| o * DirectoryDeltaTransfer.h | Simple class to send changes between directories
| o * DR_SHA1.h |
| o * DS_BinarySearchTree.h |
| o * DS_BPlusTree.h |
| o * DS_BytePool.h |
| o * DS_ByteQueue.h |
| o * DS_Hash.h |
| o * DS_Heap.h |
| o * DS_HuffmanEncodingTree.h | [Internal] Generates a huffman encoding tree, used for string and global compression
| o * DS_HuffmanEncodingTreeFactory.h |
| o * DS_HuffmanEncodingTreeNode.h | [Internal] A single node in the Huffman Encoding Tree
| o * DS_LinkedList.h |
| o * DS_List.h |
| o * DS_Map.h |
| o * DS_MemoryPool.h |
| o * DS_Multilist.h |
| o * DS_OrderedChannelHeap.h |
| o * DS_OrderedList.h |
| o * DS_Queue.h |
| o * DS_QueueLinkedList.h |
| o * DS_RangeList.h |
| o * DS_Table.h |
| o * DS_ThreadsafeAllocatingQueue.h |
| o * DS_Tree.h |
| o * DS_WeightedGraph.h |
| o * DynDNS.h | Helper to class to update DynDNS This can be used to determine what permissions are should be allowed to the other system
| o * EmailSender.h | Rudimentary class to send email from code. Don't expect anything fancy
| o * EmptyHeader.h |
| o * EpochTimeToString.h |
| o * Export.h |
| o * FileList.h |
| o * FileListNodeContext.h |
| o * FileListTransfer.h | A plugin to provide a simple way to compress and incrementally send the files in the FileList structure
| o * FileListTransferCBInterface.h |
| o * FileOperations.h |
| o * FormatString.h |
| o * FullyConnectedMesh2.h | Fully connected mesh plugin, revision 2
| o * Getche.h |
| o * Gets.h |
| o * GetTime.h | Returns the value from QueryPerformanceCounter. This is the function RakNet uses to represent time. This time won't match the time returned by GetTimeCount(). See http://www.jenkinssoftware.com/forum/index.php?topic=2798.0
| o * gettimeofday.h |
| o * GridSectorizer.h |
| o * HTTPConnection.h | Contains HTTPConnection, used to communicate with web servers
| o * HTTPConnection2.h | Contains HTTPConnection2, used to communicate with web servers
| o * IncrementalReadInterface.h |
| o * InternalPacket.h | [Internal] A class which stores a user message, and all information associated with sending and receiving that message
| o * Itoa.h |
| o * Kbhit.h |
| o * linux_adapter.h |
| o * LinuxStrings.h |
| o * LocklessTypes.h |
| o * LogCommandParser.h | Contains LogCommandParser , Used to send logs to connected consoles
| o * memoryoverride.h | If _USE_RAK_MEMORY_OVERRIDE is defined, memory allocations go through rakMalloc, rakRealloc, and rakFree
| o * MessageFilter.h | Message filter plugin. Assigns systems to FilterSets. Each FilterSet limits what messages are allowed. This is a security related plugin
| o * MessageIdentifiers.h | All the message identifiers used by RakNet. Message identifiers comprise the first byte of any message
| o * MTUSize.h | [Internal] Defines the default maximum transfer unit
| o * NativeFeatureIncludes.h |
| o * NativeFeatureIncludesOverrides.h |
| o * NativeTypes.h |
| o * NatPunchthroughClient.h | Contains the NAT-punchthrough plugin for the client
| o * NatPunchthroughServer.h | Contains the NAT-punchthrough plugin for the server
| o * NatTypeDetectionClient.h | Contains the NAT-type detection code for the client
| o * NatTypeDetectionCommon.h |
| o * NatTypeDetectionServer.h | Contains the NAT-type detection code for the server
| o * NetworkIDManager.h |
| o * NetworkIDObject.h | A class you can derive from to make it easier to represent every networked object with an integer. This way you can refer to objects over the network
| o * osx_adapter.h |
| o * PacketConsoleLogger.h | This will write all incoming and outgoing network messages to the log command parser, which can be accessed through Telnet
| o * PacketFileLogger.h | This will write all incoming and outgoing network messages to a file
| o * PacketizedTCP.h | A simple TCP based server allowing sends and receives. Can be connected by any TCP client, including telnet
| o * PacketLogger.h | This will write all incoming and outgoing network messages to the local console screen. See derived functions for other outputs
| o * PacketOutputWindowLogger.h | This will write all incoming and outgoing network messages to a file
| o * PacketPool.h |
| o * PacketPriority.h | This file contains enumerations for packet priority and reliability enumerations
| o * peer.h | Declares RakPeer class
| o * peerinterface.h | An interface for RakPeer. Simply contains all user functions as pure virtuals
| o * PluginInterface2.h | RakNet's plugin functionality system, version 2. You can derive from this to create your own plugins
| o * PS3Includes.h |
| o * PS4Includes.h |
| o * Rackspace.h | Helper to class to manage Rackspace servers
| o * Rand.h | [Internal] Random number generator
| o * RandSync.h | [Internal] Random number generator
| o * ReadyEvent.h | Ready event plugin. This enables a set of systems to create a signal event, set this signal as ready or unready, and to trigger the event when all systems are ready
| o * RefCountedObj.h | Reference counted object. Very simple class for quick and dirty uses
| o * RelayPlugin.h | Contains the class RelayPlugin
| o * ReliabilityLayer.h | [Internal] Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence
| o * ReplicaEnums.h | Contains enumerations used by the ReplicaManager system. This file is a lightweight header, so you can include it without worrying about linking in lots of other crap
| o * ReplicaManager3.h | Contains the third iteration of the ReplicaManager class
| o * Router2.h | Router2 plugin. Allows you to connect to a system by routing packets through another system that is connected to both you and the destination. Useful for getting around NATs
| o * RPC4Plugin.h | Remote procedure call, supporting C functions only. No external dependencies required
| o * SecureHandshake.h |
| o * SendToThread.h |
| o * SignaledEvent.h |
| o * SimpleMutex.h | [Internal] Encapsulates a mutex
| o * SimpleTCPServer.h |
| o * SingleProducerConsumer.h | [Internal] Passes queued data between threads using a circular buffer with read and write pointers
| o * sleep.h |
| o * smartptr.h |
| o * socket.h |
| o * socket2.h |
| o * SocketDefines.h |
| o * SocketIncludes.h |
| o * SocketLayer.h | SocketLayer class implementation
| o * statistics.h | A structure that holds all statistical data returned by RakNet
| o * StatisticsHistory.h | Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values
| o * string.h |
| o * StringCompressor.h | Compresses/Decompresses ASCII strings and writes/reads them to BitStream class instances. You can use this to easily serialize and deserialize your own strings
| o * StringTable.h | A simple class to encode and decode known strings based on a lookup table. Similar to the StringCompressor class
| o * SuperFastHash.h |
| o * TableSerializer.h |
| o * TCPInterface.h | A simple TCP based server allowing sends and receives. Can be connected by any TCP client, including telnet
| o * TeamBalancer.h | Set and network team selection (supports peer to peer or client/server)
| o * TeamManager.h | Automates networking and list management for teams
| o * TelnetTransport.h | Contains TelnetTransport , used to supports the telnet transport protocol. Insecure
| o * thread.h |
| o * ThreadPool.h |
| o * ThreadsafePacketLogger.h | Derivation of the packet logger to defer the call to WriteLog until the user thread
| o * time.h |
| o * transport2.h | Contains RakNetTransportCommandParser and RakNetTransport used to provide a secure console connection
| o * TransportInterface.h | Contains TransportInterface from which you can derive custom transport providers for ConsoleServer
| o * TwoWayAuthentication.h | Implements two way authentication
| o * types.h | Types used by RakNet, most of which involve user code
| o * UDPForwarder.h | Forwards UDP datagrams. Independent of RakNet's protocol
| o * UDPProxyClient.h | A RakNet plugin performing networking to communicate with UDPProxyCoordinator. Ultimately used to tell UDPProxyServer to forward UDP packets
| o * UDPProxyCommon.h |
| o * UDPProxyCoordinator.h | Essentially maintains a list of servers running UDPProxyServer, and some state management for UDPProxyClient to find a free server to forward datagrams
| o * UDPProxyServer.h | A RakNet plugin performing networking to communicate with UDPProxyServer. It allows UDPProxyServer to control our instance of UDPForwarder
| o * VariableDeltaSerializer.h |
| o * VariableListDeltaTracker.h |
| o * VariadicSQLParser.h |
| o * version.h |
| o * VitaIncludes.h |
| o * WindowsIncludes.h |
| o * WSAStartupSingleton.h |
| o * wstring.h |
| \ * XBox360Includes.h |
\ + src |
o * _FindFirst.cpp |
o * Base64Encoder.cpp |
o * BitStream.cpp |
o * CCRakNetSlidingWindow.cpp |
o * CCRakNetUDT.cpp |
o * CheckSum.cpp | CheckSum implementation from http://www.flounder.com/checksum.htm
o * CloudClient.cpp |
o * CloudCommon.cpp |
o * CloudServer.cpp |
o * CommandParserInterface.cpp |
o * ConnectionGraph2.cpp |
o * ConsoleServer.cpp |
o * DataCompressor.cpp |
o * DirectoryDeltaTransfer.cpp |
o * DR_SHA1.cpp |
o * DS_BytePool.cpp |
o * DS_ByteQueue.cpp |
o * DS_HuffmanEncodingTree.cpp |
o * DS_Table.cpp |
o * DynDNS.cpp |
o * EmailSender.cpp |
o * EpochTimeToString.cpp |
o * FileList.cpp |
o * FileListTransfer.cpp |
o * FileOperations.cpp |
o * FormatString.cpp |
o * FullyConnectedMesh2.cpp |
o * Getche.cpp |
o * Gets.cpp |
o * GetTime.cpp |
o * gettimeofday.cpp |
o * GridSectorizer.cpp |
o * HTTPConnection.cpp | Contains HTTPConnection, used to communicate with web servers
o * HTTPConnection2.cpp |
o * IncrementalReadInterface.cpp |
o * Itoa.cpp |
o * linux_adapter.cpp |
o * LinuxStrings.cpp |
o * LocklessTypes.cpp |
o * LogCommandParser.cpp |
o * MessageFilter.cpp |
o * NatPunchthroughClient.cpp |
o * NatPunchthroughServer.cpp |
o * NatTypeDetectionClient.cpp |
o * NatTypeDetectionCommon.cpp |
o * NatTypeDetectionServer.cpp |
o * NetworkIDManager.cpp |
o * NetworkIDObject.cpp |
o * osx_adapter.cpp |
o * PacketConsoleLogger.cpp |
o * PacketFileLogger.cpp |
o * PacketizedTCP.cpp |
o * PacketLogger.cpp |
o * PacketOutputWindowLogger.cpp |
o * PluginInterface2.cpp |
o * PS4Includes.cpp |
o * Rackspace.cpp |
o * RakMemoryOverride.cpp |
o * RakNetCommandParser.cpp |
o * RakNetSocket.cpp |
o * RakNetSocket2.cpp |
o * RakNetSocket2_360_720.cpp |
o * RakNetSocket2_Berkley.cpp |
o * RakNetSocket2_Berkley_NativeClient.cpp |
o * RakNetSocket2_NativeClient.cpp |
o * RakNetSocket2_PS3_PS4.cpp |
o * RakNetSocket2_PS4.cpp |
o * RakNetSocket2_Vita.cpp |
o * RakNetSocket2_Windows_Linux.cpp |
o * RakNetSocket2_Windows_Linux_360.cpp |
o * RakNetSocket2_WindowsStore8.cpp |
o * RakNetStatistics.cpp |
o * RakNetTransport2.cpp |
o * RakNetTypes.cpp |
o * RakPeer.cpp |
o * RakSleep.cpp |
o * RakString.cpp |
o * RakThread.cpp |
o * RakWString.cpp |
o * Rand.cpp |
o * RandSync.cpp |
o * ReadyEvent.cpp |
o * RelayPlugin.cpp |
o * ReliabilityLayer.cpp |
o * ReplicaManager3.cpp |
o * Router2.cpp |
o * RPC4Plugin.cpp |
o * SecureHandshake.cpp |
o * SendToThread.cpp |
o * SignaledEvent.cpp |
o * SimpleMutex.cpp |
o * SocketLayer.cpp | SocketLayer class implementation
o * StatisticsHistory.cpp |
o * StringCompressor.cpp |
o * StringTable.cpp |
o * SuperFastHash.cpp |
o * TableSerializer.cpp |
o * TCPInterface.cpp |
o * TeamBalancer.cpp |
o * TeamManager.cpp |
o * TelnetTransport.cpp |
o * ThreadsafePacketLogger.cpp |
o * TwoWayAuthentication.cpp |
o * UDPForwarder.cpp |
o * UDPProxyClient.cpp |
o * UDPProxyCoordinator.cpp |
o * UDPProxyServer.cpp |
o * VariableDeltaSerializer.cpp |
o * VariableListDeltaTracker.cpp |
o * VariadicSQLParser.cpp |
o * VitaIncludes.cpp |
\ * WSAStartupSingleton.cpp |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Source Directory Reference

  • Source
Source Directory Reference

Directories

directory | include
directory | src
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include Directory Reference

  • include
include Directory Reference

Directories

directory slikenet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet Directory Reference

  • include
  • slikenet
slikenet Directory Reference

Files

file | _FindFirst.h [code]
file | alloca.h [code]
file | assert.h [code]
file | AutopatcherPatchContext.h [code]
file | AutopatcherRepositoryInterface.h [code]
An interface used by AutopatcherServer to get the data necessary to run an autopatcher.
file | Base64Encoder.h [code]
file | BitStream.h [code]
This class allows you to write and read native types as a string of bits.
file | CCRakNetSlidingWindow.h [code]
file | CCRakNetUDT.h [code]
file | CheckSum.h [code]
file | CloudClient.h [code]
Queries CloudMemoryServer to download data that other clients have uploaded.
file | CloudCommon.h [code]
file | CloudServer.h [code]
Stores client data, and allows cross-server communication to retrieve this data.
file | commandparser.h [code]
Contains RakNetCommandParser , used to send commands to an instance of RakPeer.
file | CommandParserInterface.h [code]
Contains CommandParserInterface , from which you derive custom command parsers.
file | ConnectionGraph2.h [code]
Connection graph plugin, version 2. Tells new systems about existing and new connections.
file | ConsoleServer.h [code]
Contains ConsoleServer , used to plugin to your game to accept remote console-based connections.
file | DataCompressor.h [code]
DataCompressor does compression on a block of data.
file | defineoverrides.h [code]
file | defines.h [code]
file | DirectoryDeltaTransfer.h [code]
Simple class to send changes between directories.
file | DR_SHA1.h [code]
file | DS_BinarySearchTree.h [code]
file | DS_BPlusTree.h [code]
file | DS_BytePool.h [code]
file | DS_ByteQueue.h [code]
file | DS_Hash.h [code]
file | DS_Heap.h [code]
file | DS_HuffmanEncodingTree.h [code]
[Internal] Generates a huffman encoding tree, used for string and global compression.
file | DS_HuffmanEncodingTreeFactory.h [code]
file | DS_HuffmanEncodingTreeNode.h [code]
[Internal] A single node in the Huffman Encoding Tree.
file | DS_LinkedList.h [code]
file | DS_List.h [code]
file | DS_Map.h [code]
file | DS_MemoryPool.h [code]
file | DS_Multilist.h [code]
file | DS_OrderedChannelHeap.h [code]
file | DS_OrderedList.h [code]
file | DS_Queue.h [code]
file | DS_QueueLinkedList.h [code]
file | DS_RangeList.h [code]
file | DS_Table.h [code]
file | DS_ThreadsafeAllocatingQueue.h [code]
file | DS_Tree.h [code]
file | DS_WeightedGraph.h [code]
file | DynDNS.h [code]
Helper to class to update DynDNS This can be used to determine what permissions are should be allowed to the other system.
file | EmailSender.h [code]
Rudimentary class to send email from code. Don't expect anything fancy.
file | EmptyHeader.h [code]
file | EpochTimeToString.h [code]
file | Export.h [code]
file | FileList.h [code]
file | FileListNodeContext.h [code]
file | FileListTransfer.h [code]
A plugin to provide a simple way to compress and incrementally send the files in the FileList structure.
file | FileListTransferCBInterface.h [code]
file | FileOperations.h [code]
file | FormatString.h [code]
file | FullyConnectedMesh2.h [code]
Fully connected mesh plugin, revision 2.
file | Getche.h [code]
file | Gets.h [code]
file | GetTime.h [code]
Returns the value from QueryPerformanceCounter. This is the function RakNet uses to represent time. This time won't match the time returned by GetTimeCount(). See http://www.jenkinssoftware.com/forum/index.php?topic=2798.0.
file | gettimeofday.h [code]
file | GridSectorizer.h [code]
file | HTTPConnection.h [code]
Contains HTTPConnection, used to communicate with web servers.
file | HTTPConnection2.h [code]
Contains HTTPConnection2, used to communicate with web servers.
file | IncrementalReadInterface.h [code]
file | InternalPacket.h [code]
[Internal] A class which stores a user message, and all information associated with sending and receiving that message.
file | Itoa.h [code]
file | Kbhit.h [code]
file | linux_adapter.h [code]
file | LinuxStrings.h [code]
file | LocklessTypes.h [code]
file | LogCommandParser.h [code]
Contains LogCommandParser , Used to send logs to connected consoles.
file | memoryoverride.h [code]
If _USE_RAK_MEMORY_OVERRIDE is defined, memory allocations go through rakMalloc, rakRealloc, and rakFree.
file | MessageFilter.h [code]
Message filter plugin. Assigns systems to FilterSets. Each FilterSet limits what messages are allowed. This is a security related plugin.
file | MessageIdentifiers.h [code]
All the message identifiers used by RakNet. Message identifiers comprise the first byte of any message.
file | MTUSize.h [code]
[Internal] Defines the default maximum transfer unit.
file | NativeFeatureIncludes.h [code]
file | NativeFeatureIncludesOverrides.h [code]
file | NativeTypes.h [code]
file | NatPunchthroughClient.h [code]
Contains the NAT-punchthrough plugin for the client.
file | NatPunchthroughServer.h [code]
Contains the NAT-punchthrough plugin for the server.
file | NatTypeDetectionClient.h [code]
Contains the NAT-type detection code for the client.
file | NatTypeDetectionCommon.h [code]
file | NatTypeDetectionServer.h [code]
Contains the NAT-type detection code for the server.
file | NetworkIDManager.h [code]
file | NetworkIDObject.h [code]
A class you can derive from to make it easier to represent every networked object with an integer. This way you can refer to objects over the network.
file | osx_adapter.h [code]
file | PacketConsoleLogger.h [code]
This will write all incoming and outgoing network messages to the log command parser, which can be accessed through Telnet.
file | PacketFileLogger.h [code]
This will write all incoming and outgoing network messages to a file.
file | PacketizedTCP.h [code]
A simple TCP based server allowing sends and receives. Can be connected by any TCP client, including telnet.
file | PacketLogger.h [code]
This will write all incoming and outgoing network messages to the local console screen. See derived functions for other outputs.
file | PacketOutputWindowLogger.h [code]
This will write all incoming and outgoing network messages to a file.
file | PacketPool.h [code]
file | PacketPriority.h [code]
This file contains enumerations for packet priority and reliability enumerations.
file | peer.h [code]
Declares RakPeer class.
file | peerinterface.h [code]
An interface for RakPeer. Simply contains all user functions as pure virtuals.
file | PluginInterface2.h [code]
RakNet's plugin functionality system, version 2. You can derive from this to create your own plugins.
file | PS3Includes.h [code]
file | PS4Includes.h [code]
file | Rackspace.h [code]
Helper to class to manage Rackspace servers.
file | Rand.h [code]
[Internal] Random number generator
file | RandSync.h [code]
[Internal] Random number generator
file | ReadyEvent.h [code]
Ready event plugin. This enables a set of systems to create a signal event, set this signal as ready or unready, and to trigger the event when all systems are ready.
file | RefCountedObj.h [code]
Reference counted object. Very simple class for quick and dirty uses.
file | RelayPlugin.h [code]
Contains the class RelayPlugin.
file | ReliabilityLayer.h [code]
[Internal] Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence.
file | ReplicaEnums.h [code]
Contains enumerations used by the ReplicaManager system. This file is a lightweight header, so you can include it without worrying about linking in lots of other crap.
file | ReplicaManager3.h [code]
Contains the third iteration of the ReplicaManager class.
file | Router2.h [code]
Router2 plugin. Allows you to connect to a system by routing packets through another system that is connected to both you and the destination. Useful for getting around NATs.
file | RPC4Plugin.h [code]
Remote procedure call, supporting C functions only. No external dependencies required.
file | SecureHandshake.h [code]
file | SendToThread.h [code]
file | SignaledEvent.h [code]
file | SimpleMutex.h [code]
[Internal] Encapsulates a mutex
file | SimpleTCPServer.h [code]
file | SingleProducerConsumer.h [code]
[Internal] Passes queued data between threads using a circular buffer with read and write pointers
file | sleep.h [code]
file | smartptr.h [code]
file | socket.h [code]
file | socket2.h [code]
file | SocketDefines.h [code]
file | SocketIncludes.h [code]
file | SocketLayer.h [code]
SocketLayer class implementation.
file | statistics.h [code]
A structure that holds all statistical data returned by RakNet.
file | StatisticsHistory.h [code]
Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values.
file | string.h [code]
file | StringCompressor.h [code]
Compresses/Decompresses ASCII strings and writes/reads them to BitStream class instances. You can use this to easily serialize and deserialize your own strings.
file | StringTable.h [code]
A simple class to encode and decode known strings based on a lookup table. Similar to the StringCompressor class.
file | SuperFastHash.h [code]
file | TableSerializer.h [code]
file | TCPInterface.h [code]
A simple TCP based server allowing sends and receives. Can be connected by any TCP client, including telnet.
file | TeamBalancer.h [code]
Set and network team selection (supports peer to peer or client/server)
file | TeamManager.h [code]
Automates networking and list management for teams.
file | TelnetTransport.h [code]
Contains TelnetTransport , used to supports the telnet transport protocol. Insecure.
file | thread.h [code]
file | ThreadPool.h [code]
file | ThreadsafePacketLogger.h [code]
Derivation of the packet logger to defer the call to WriteLog until the user thread.
file | time.h [code]
file | transport2.h [code]
Contains RakNetTransportCommandParser and RakNetTransport used to provide a secure console connection.
file | TransportInterface.h [code]
Contains TransportInterface from which you can derive custom transport providers for ConsoleServer.
file | TwoWayAuthentication.h [code]
Implements two way authentication.
file | types.h [code]
Types used by RakNet, most of which involve user code.
file | UDPForwarder.h [code]
Forwards UDP datagrams. Independent of RakNet's protocol.
file | UDPProxyClient.h [code]
A RakNet plugin performing networking to communicate with UDPProxyCoordinator. Ultimately used to tell UDPProxyServer to forward UDP packets.
file | UDPProxyCommon.h [code]
file | UDPProxyCoordinator.h [code]
Essentially maintains a list of servers running UDPProxyServer, and some state management for UDPProxyClient to find a free server to forward datagrams.
file | UDPProxyServer.h [code]
A RakNet plugin performing networking to communicate with UDPProxyServer. It allows UDPProxyServer to control our instance of UDPForwarder.
file | VariableDeltaSerializer.h [code]
file | VariableListDeltaTracker.h [code]
file | VariadicSQLParser.h [code]
file | version.h [code]
file | VitaIncludes.h [code]
file | WindowsIncludes.h [code]
file | WSAStartupSingleton.h [code]
file | wstring.h [code]
file | XBox360Includes.h [code]
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/_FindFirst.h File Reference

  • include
  • slikenet
_FindFirst.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/alloca.h File Reference

  • include
  • slikenet
alloca.h File Reference
#include <malloc.h>
#include <alloca.h>

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/assert.h File Reference

  • include
  • slikenet
assert.h File Reference
#include <assert.h>
#include "defines.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/AutopatcherPatchContext.h File Reference

  • include
  • slikenet
Enumerations
AutopatcherPatchContext.h File Reference

Go to the source code of this file.

Enumerations

enum PatchContext {
PC_HASH_1_WITH_PATCH, PC_HASH_2_WITH_PATCH, PC_WRITE_FILE, PC_ERROR_FILE_WRITE_FAILURE,
PC_ERROR_PATCH_TARGET_MISSING, PC_ERROR_PATCH_APPLICATION_FAILURE, PC_ERROR_PATCH_RESULT_CHECKSUM_FAILURE, PC_NOTICE_WILL_COPY_ON_RESTART,
PC_NOTICE_FILE_DOWNLOADED, PC_NOTICE_FILE_DOWNLOADED_PATCH
}

Enumeration Type Documentation

enum PatchContext
Enumerator:
PC_HASH_1_WITH_PATCH
PC_HASH_2_WITH_PATCH
PC_WRITE_FILE
PC_ERROR_FILE_WRITE_FAILURE
PC_ERROR_PATCH_TARGET_MISSING
PC_ERROR_PATCH_APPLICATION_FAILURE
PC_ERROR_PATCH_RESULT_CHECKSUM_FAILURE
PC_NOTICE_WILL_COPY_ON_RESTART
PC_NOTICE_FILE_DOWNLOADED
PC_NOTICE_FILE_DOWNLOADED_PATCH

Definition at line 14 of file AutopatcherPatchContext.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/AutopatcherRepositoryInterface.h File Reference

  • include
  • slikenet
Classes | Namespaces
AutopatcherRepositoryInterface.h File Reference

An interface used by AutopatcherServer to get the data necessary to run an autopatcher. More...

#include "IncrementalReadInterface.h"
#include "SimpleMutex.h"

Go to the source code of this file.

Classes

class SLNet::AutopatcherRepositoryInterface
An interface used by AutopatcherServer to get the data necessary to run an autopatcher. This is up to you to implement for custom repository solutions. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

An interface used by AutopatcherServer to get the data necessary to run an autopatcher.

Definition in file AutopatcherRepositoryInterface.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Base64Encoder.h File Reference

  • include
  • slikenet
Functions
Base64Encoder.h File Reference
#include "Export.h"

Go to the source code of this file.

Functions

int | Base64Encoding (const unsigned char *inputData, int dataLength, char *outputData)
Returns how many bytes were written.
const char * | Base64Map (void)

Function Documentation

int Base64Encoding | ( | const unsigned char * | inputData,
 |  | int | dataLength,
 |  | char * | outputData
 | ) |  |

Returns how many bytes were written.

Definition at line 23 of file Base64Encoder.cpp.

References base64Map.

Referenced by Base64Encoding().

const char* Base64Map ( void )

Definition at line 19 of file Base64Encoder.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/BitStream.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Functions
BitStream.h File Reference

This class allows you to write and read native types as a string of bits. More...

#include "memoryoverride.h"
#include "defines.h"
#include "Export.h"
#include "types.h"
#include "string.h"
#include "wstring.h"
#include "assert.h"
#include <cmath>
#include <float.h>

Go to the source code of this file.

Classes

class SLNet::BitStream

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define _copysign copysign

Functions

template<class templateType >
BitStream & | SLNet::operator<< (BitStream &out, const templateType &c)
template<class templateType >
BitStream & | SLNet::operator>> (BitStream &in, templateType &c)

Detailed Description

This class allows you to write and read native types as a string of bits.

BitStream is used extensively throughout RakNet and is designed to be used by users as well.

Definition in file BitStream.h.

Macro Definition Documentation

#define _copysign copysign

Definition at line 40 of file BitStream.h.

Referenced by SLNet::BitStream::WriteOrthMatrix().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CCRakNetSlidingWindow.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Typedefs
CCRakNetSlidingWindow.h File Reference
#include "defines.h"
#include "NativeTypes.h"
#include "time.h"
#include "types.h"
#include "DS_Queue.h"

Go to the source code of this file.

Classes

class SLNet::CCRakNetSlidingWindow

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define | UDP_HEADER_SIZE 28
Sizeof an UDP header in byte.
#define | CC_DEBUG_PRINTF_1(x)
#define | CC_DEBUG_PRINTF_2(x, y)
#define | CC_DEBUG_PRINTF_3(x, y, z)
#define | CC_DEBUG_PRINTF_4(x, y, z, a)
#define | CC_DEBUG_PRINTF_5(x, y, z, a, b)
#define | CC_TIME_TYPE_BYTES 8
Set to 4 if you are using the iPod Touch TG. See http://www.jenkinssoftware.com/forum/index.php?topic=2717.0.

Typedefs

typedef SLNet::TimeUS | CCTimeType
typedef SLNet::uint24_t | DatagramSequenceNumberType
typedef double | BytesPerMicrosecond
typedef double | BytesPerSecond
typedef double | MicrosecondsPerByte

Macro Definition Documentation

#define CC_DEBUG_PRINTF_1 ( x )

Definition at line 58 of file CCRakNetSlidingWindow.h.

#define CC_DEBUG_PRINTF_2 | ( | x,
 |  | y
 | ) |

Definition at line 59 of file CCRakNetSlidingWindow.h.

Referenced by SLNet::ReliabilityLayer::Update().

#define CC_DEBUG_PRINTF_3 | ( | x,
 |  | y,
 |  | z
 | ) |

Definition at line 60 of file CCRakNetSlidingWindow.h.

#define CC_DEBUG_PRINTF_4 | ( | x,
 |  | y,
 |  | z,
 |  | a
 | ) |

Definition at line 61 of file CCRakNetSlidingWindow.h.

#define CC_DEBUG_PRINTF_5 | ( | x,
 |  | y,
 |  | z,
 |  | a,
 |  | b
 | ) |

Definition at line 62 of file CCRakNetSlidingWindow.h.

#define CC_TIME_TYPE_BYTES 8

Set to 4 if you are using the iPod Touch TG. See http://www.jenkinssoftware.com/forum/index.php?topic=2717.0.

Definition at line 70 of file CCRakNetSlidingWindow.h.

Referenced by SLNet::ReliabilityLayer::Update().

#define UDP_HEADER_SIZE 28

Sizeof an UDP header in byte.

Definition at line 56 of file CCRakNetSlidingWindow.h.

Referenced by SLNet::ProcessOfflineNetworkPacket(), SLNet::ReliabilityLayer::Reset(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::ReliabilityLayer::Update().

Typedef Documentation

typedef double BytesPerMicrosecond

Definition at line 79 of file CCRakNetSlidingWindow.h.

typedef double BytesPerSecond

Definition at line 80 of file CCRakNetSlidingWindow.h.

typedef SLNet::TimeUS CCTimeType

Definition at line 73 of file CCRakNetSlidingWindow.h.

typedef SLNet::uint24_t DatagramSequenceNumberType

Definition at line 78 of file CCRakNetSlidingWindow.h.

typedef double MicrosecondsPerByte

Definition at line 81 of file CCRakNetSlidingWindow.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CCRakNetUDT.h File Reference

  • include
  • slikenet
CCRakNetUDT.h File Reference
#include "defines.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CheckSum.h File Reference

  • include
  • slikenet
Classes
CheckSum.h File Reference
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class CheckSum
Generates and validates checksums. More...
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CloudClient.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros
CloudClient.h File Reference

Queries CloudMemoryServer to download data that other clients have uploaded. More...

#include "NativeFeatureIncludes.h"
#include "PluginInterface2.h"
#include "CloudCommon.h"
#include "memoryoverride.h"
#include "DS_Hash.h"

Go to the source code of this file.

Classes

class | SLNet::CloudClient
Performs Post() and Get() operations on CloudMemoryServer. More...
class | SLNet::CloudClientCallback

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define __CLOUD_CLIENT_H

Detailed Description

Queries CloudMemoryServer to download data that other clients have uploaded.

Definition in file CloudClient.h.

Macro Definition Documentation

#define __CLOUD_CLIENT_H

Definition at line 25 of file CloudClient.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CloudCommon.h File Reference

  • include
  • slikenet
Classes | Namespaces | Functions
CloudCommon.h File Reference
#include "NativeFeatureIncludes.h"
#include "types.h"
#include "string.h"

Go to the source code of this file.

Classes

class | SLNet::CloudAllocator
struct | SLNet::CloudKey
struct | SLNet::CloudQuery
struct | SLNet::CloudQueryRow
struct | SLNet::CloudQueryResult

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Functions

int SLNet::CloudKeyComp (const CloudKey &key, const CloudKey &data)
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CloudServer.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros
CloudServer.h File Reference

Stores client data, and allows cross-server communication to retrieve this data. More...

#include "NativeFeatureIncludes.h"
#include "PluginInterface2.h"
#include "memoryoverride.h"
#include "NativeTypes.h"
#include "string.h"
#include "DS_Hash.h"
#include "CloudCommon.h"
#include "DS_OrderedList.h"

Go to the source code of this file.

Classes

class | SLNet::CloudServerQueryFilter
Zero or more instances of CloudServerQueryFilter can be attached to CloudServer to restrict client queries All attached instances of CloudServerQueryFilter on each corresponding operation, from all directly connected clients If any attached instance returns false for a given operation, that operation is silently rejected. More...
class | SLNet::CloudServer
Stores client data, and allows cross-server communication to retrieve this data. More...
struct | SLNet::CloudServer::CloudData
struct | SLNet::CloudServer::CloudDataList
struct | SLNet::CloudServer::KeySubscriberID
struct | SLNet::CloudServer::RemoteCloudClient
struct | SLNet::CloudServer::RemoteServer
struct | SLNet::CloudServer::BufferedGetResponseFromServer
struct | SLNet::CloudServer::CloudQueryWithAddresses
struct | SLNet::CloudServer::GetRequest

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define CLOUD_SERVER_DATA_STACK_SIZE 32
If the data is smaller than this value, an allocation is avoid. However, this value exists for every row.

Detailed Description

Stores client data, and allows cross-server communication to retrieve this data.

TODO

Definition in file CloudServer.h.

Macro Definition Documentation

#define CLOUD_SERVER_DATA_STACK_SIZE 32

If the data is smaller than this value, an allocation is avoid. However, this value exists for every row.

Definition at line 37 of file CloudServer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/commandparser.h File Reference

  • include
  • slikenet
Classes | Namespaces
commandparser.h File Reference

Contains RakNetCommandParser , used to send commands to an instance of RakPeer. More...

#include "NativeFeatureIncludes.h"
#include "CommandParserInterface.h"
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::RakNetCommandParser
This allows a console client to call most of the functions in RakPeer. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains RakNetCommandParser , used to send commands to an instance of RakPeer.

Definition in file commandparser.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CommandParserInterface.h File Reference

  • include
  • slikenet
Classes | Namespaces | Functions
CommandParserInterface.h File Reference

Contains CommandParserInterface , from which you derive custom command parsers. More...

#include "memoryoverride.h"
#include "types.h"
#include "DS_OrderedList.h"
#include "Export.h"

Go to the source code of this file.

Classes

struct | SLNet::RegisteredCommand
class | SLNet::CommandParserInterface
The interface used by command parsers. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Functions

int RAK_DLL_EXPORT SLNet::RegisteredCommandComp (const char *const &key, const RegisteredCommand &data)
List of commands registered with RegisterCommand()

Detailed Description

Contains CommandParserInterface , from which you derive custom command parsers.

Definition in file CommandParserInterface.h.

Class Documentation

struct SLNet::RegisteredCommand

Definition at line 37 of file CommandParserInterface.h.

Class Members
const char * | command
const char * | commandHelp
unsigned char | parameterCount
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ConnectionGraph2.h File Reference

  • include
  • slikenet
Classes | Namespaces
ConnectionGraph2.h File Reference

Connection graph plugin, version 2. Tells new systems about existing and new connections. More...

#include "NativeFeatureIncludes.h"
#include "memoryoverride.h"
#include "types.h"
#include "PluginInterface2.h"
#include "DS_List.h"
#include "DS_WeightedGraph.h"
#include "GetTime.h"
#include "Export.h"

Go to the source code of this file.

Classes

class | SLNet::ConnectionGraph2
A one hop connection graph. More...
struct | SLNet::ConnectionGraph2::SystemAddressAndGuid
struct | SLNet::ConnectionGraph2::RemoteSystem

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Connection graph plugin, version 2. Tells new systems about existing and new connections.

Definition in file ConnectionGraph2.h.

Class Documentation

struct SLNet::ConnectionGraph2::SystemAddressAndGuid

Definition at line 94 of file ConnectionGraph2.h.

Class Members
RakNetGUID | guid
uint16_t | sendersPingToThatSystem
SystemAddress | systemAddress
struct SLNet::ConnectionGraph2::RemoteSystem

Definition at line 104 of file ConnectionGraph2.h.

Class Members
RakNetGUID | guid
OrderedList < SystemAddressAndGuid, SystemAddressAndGuid, SystemAddressAndGuidComp > | remoteConnections
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ConsoleServer.h File Reference

  • include
  • slikenet
Classes | Namespaces
ConsoleServer.h File Reference

Contains ConsoleServer , used to plugin to your game to accept remote console-based connections. More...

#include "NativeFeatureIncludes.h"
#include "memoryoverride.h"
#include "DS_List.h"
#include "types.h"
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::ConsoleServer
The main entry point for the server portion of your remote console application support. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains ConsoleServer , used to plugin to your game to accept remote console-based connections.

Definition in file ConsoleServer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DataCompressor.h File Reference

  • include
  • slikenet
Classes | Namespaces
DataCompressor.h File Reference

DataCompressor does compression on a block of data. More...

#include "memoryoverride.h"
#include "DS_HuffmanEncodingTree.h"
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::DataCompressor
Does compression on a block of data. Not very good compression, but it's small and fast so is something you can compute at runtime. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

DataCompressor does compression on a block of data.

Not very good compression, but it's small and fast so is something you can use per-message at runtime.

Definition in file DataCompressor.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/defineoverrides.h File Reference

  • include
  • slikenet
defineoverrides.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/defines.h File Reference

  • include
  • slikenet
Macros
defines.h File Reference
#include "defineoverrides.h"

Go to the source code of this file.

Macros

#define | __GET_TIME_64BIT 1
#define | _FILE_AND_LINE_ __FILE__,__LINE__
#define | MAX_ALLOCA_STACK_ALLOCATION 1048576
Maximum (stack) size to use with _alloca before using new and delete instead.
#define | USE_WAIT_FOR_MULTIPLE_EVENTS
#define | _USE_RAK_MEMORY_OVERRIDE 0
#define | OPEN_SSL_CLIENT_SUPPORT 0
#define | BITSTREAM_STACK_ALLOCATION_SIZE 256
#define | RAKNET_DEBUG_PRINTF printf
#define | RAKNET_DEBUG_TPRINTF _tprintf
#define | MAXIMUM_NUMBER_OF_INTERNAL_IDS 10
#define | RakAssert(x)
#define | DATAGRAM_MESSAGE_ID_ARRAY_LENGTH 512
#define | RESEND_BUFFER_ARRAY_LENGTH 512
#define | RESEND_BUFFER_ARRAY_MASK 511
#define | GET_TIME_SPIKE_LIMIT 0
Uncomment if you want to link in the DLMalloc library to use with RakMemoryOverride.
#define | USE_SLIDING_WINDOW_CONGESTION_CONTROL 1
#define | PREALLOCATE_LARGE_MESSAGES 0
#define | RAKNET_SUPPORT_IPV6 0
#define | RAKSTRING_TYPE RakString
#define | RAKSTRING_TYPE_IS_UNICODE 0
#define | RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS 48
#define | RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH 48
#define | XBOX_BYPASS_SECURITY 1
#define | BUFFERED_PACKETS_PAGE_SIZE 8
#define | INTERNAL_PACKET_PAGE_SIZE 8
#define | RAKPEER_USER_THREADED 0
#define | USE_ALLOCA 1
#define | SLNET_MAX_RETRIEVABLE_FILESIZE (0xFFFFFFFF)

Macro Definition Documentation

#define __GET_TIME_64BIT 1

Define __GET_TIME_64BIT to have SLNet::TimeMS use a 64, rather than 32 bit value. A 32 bit value will overflow after about 5 weeks. However, this doubles the bandwidth use for sending times, so don't do it unless you have a reason to. Comment out if you are using the iPod Touch TG. See http://www.jenkinssoftware.com/forum/index.php?topic=2717.0 This must be the same on all systems, or they won't connect

Definition at line 33 of file defines.h.

#define _FILE_AND_LINE_ __FILE__,__LINE__

Definition at line 47 of file defines.h.

Referenced by DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::Add(), DataStructures::CircularLinkedList< CircularLinkedListType >::Add(), SLNet::BitStream::AddBitsAndReallocate(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::AddChannel(), DataStructures::Tree< TreeType >::AddChild(), DataStructures::Table::AddColumn(), GridSectorizer::AddEntry(), ThreadPool< InputType, OutputType >::AddInput(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::AddNode(), ThreadPool< InputType, OutputType >::AddOutput(), SLNet::RakPeer::AddPacketToProducer(), SLNet::StringTable::AddReference(), SLNet::StringCompressor::AddReference(), DataStructures::Table::AddRow(), DataStructures::Table::AddRowColumns(), SLNet::StringTable::AddString(), SLNet::RakPeer::AddToBanList(), SLNet::RakPeer::AddToSecurityExceptionList(), DataStructures::BytePool::Allocate(), SLNet::RakString::Allocate(), SLNet::RakPeer::AllocatePacket(), SLNet::PluginInterface2::AllocatePacketUnified(), SLNet::VariableDeltaSerializer::AllocChangedVariablesList(), SLNet::RakNetSocket2Allocator::AllocRNS2(), SLNet::BitStream::AssertCopyData(), SLNet::RakString::Assign(), SLNet::RakPeer::AttachPlugin(), Base64Encoding(), DataStructures::BinarySearchTree< BinarySearchTreeType >::BinarySearchTree(), SLNet::RNS2_Berkley::BindShared(), SLNet::BitStream::BitStream(), SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), SLNet::BPSTracker::BPSTracker(), SLNet::RakPeer::CancelConnectionAttempt(), DataStructures::Table::Cell::Cell(), SLNet::RakPeer::ChangeSystemAddress(), DataStructures::CircularLinkedList< CircularLinkedListType >::CircularLinkedList(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Clear(), GridSectorizer::Clear(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::Clear(), DataStructures::RangeList< range_type >::Clear(), DataStructures::Table::Cell::Clear(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::Clear(), DataStructures::Map< key_type, data_type, key_comparison_func >::Clear(), SLNet::RakWString::Clear(), ThreadPool< InputType, OutputType >::Clear(), DataStructures::BPlusTree< KeyType, DataType, order >::Clear(), SLNet::CloudServer::CloudData::Clear(), DataStructures::CircularLinkedList< CircularLinkedListType >::Clear(), DataStructures::Table::Clear(), SLNet::RakPeer::ClearBanList(), SLNet::RakPeer::ClearBufferedCommands(), SLNet::RakPeer::ClearBufferedPackets(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::ClearDijkstra(), ThreadPool< InputType, OutputType >::ClearInput(), ThreadPool< InputType, OutputType >::ClearOutput(), SLNet::RakPeer::ClearRemoteSystemLookup(), SLNet::RakPeer::ClearRequestedConnectionList(), SLNet::RakPeer::ClearSocketQueryOutput(), SLNet::RakNetSmartPtr< T >::Clone(), SLNet::RakPeer::CloseConnection(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::BitStream::CopyData(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::CopySource(), SLNet::RakPeer::DeallocatePacket(), SLNet::TableSerializer::DeallocateQueryList(), SLNet::PluginInterface2::DeallocPacketUnified(), SLNet::RakNetSocket2Allocator::DeallocRNS2(), SLNet::StringCompressor::DecodeString(), SLNet::DataCompressor::DecompressAndAllocate(), DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::Del(), DataStructures::CircularLinkedList< CircularLinkedListType >::Del(), DataStructures::BPlusTree< KeyType, DataType, order >::Delete(), DataStructures::Tree< TreeType >::DeleteDecendants(), DataStructures::Table::DeleteRow(), RefCountedObj::Deref(), SLNet::RakPeer::DerefAllSockets(), SLNet::RakPeer::DereferenceRemoteSystem(), DataStructures::RangeList< range_type >::Deserialize(), SLNet::RakWString::Deserialize(), SLNet::RakPeer::DisableSecurity(), ExtendRows(), VariadicSQLParser::ExtractArguments(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::FindIntersection(), DataStructures::BPlusTree< KeyType, DataType, order >::FixUnderflow(), for(), SLNet::RakString::Free(), VariadicSQLParser::FreeArguments(), SLNet::VariableDeltaSerializer::FreeChangedVariablesList(), SLNet::HuffmanEncodingTree::FreeMemory(), SLNet::RakString::FreeMemoryNoMutex(), DataStructures::BPlusTree< KeyType, DataType, order >::FreePages(), FreeRow(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GenerateDisjktraMatrix(), SLNet::HuffmanEncodingTree::GenerateFromFrequencyTable(), SLNet::StringCompressor::GenerateTreeFromStrings(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::GetAsList(), GridSectorizer::GetEntries(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetShortestPath(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), SLNet::RakPeer::GetStatisticsList(), SLNet::RakPeer::GetSystemList(), VariadicSQLParser::GetTypeMappingIndices(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), GridSectorizer::Init(), SLNet::RakPeer::InitializeSecurity(), DataStructures::RangeList< range_type >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::Insert(), DataStructures::CircularLinkedList< CircularLinkedListType >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::InsertIntoNode(), SLNet::RakPeer::IsBanned(), SLNet::IRNS2_Berkley::IsPortInUse(), DataStructures::Tree< TreeType >::LevelOrderTraversal(), DataStructures::LinkedList< LinkedListType >::LinkedList(), DataStructures::List< list_type >::List(), operator+(), SLNet::RakWString::operator+=(), DataStructures::Queue< queue_type >::operator=(), SLNet::RakWString::operator=(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::operator=(), DataStructures::List< list_type >::operator=(), DataStructures::Table::Cell::operator=(), DataStructures::BinarySearchTree< BinarySearchTreeType >::operator=(), SLNet::RakNetSmartPtr< T >::operator=(), DataStructures::CircularLinkedList< CircularLinkedListType >::operator=(), DataStructures::LinkedList< LinkedListType >::operator=(), SLNet::RakPeer::Ping(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Pop(), DataStructures::BPlusTree< KeyType, DataType, order >::PrintGraph(), SLNet::ProcessOfflineNetworkPacket(), DataStructures::ThreadsafeAllocatingQueue< structureType >::Push(), SLNet::BPSTracker::Push1(), SLNet::RakPeer::PushBackPacket(), SLNet::RakPeer::PushBufferedPacket(), DataStructures::Table::QueryTable(), DataStructures::Queue< queue_type >::Queue(), SLNet::RakNetSmartPtr< T >::RakNetSmartPtr(), SLNet::RakNetRandomSync::RandomMT(), SLNet::BitStream::ReadAlignedBytesSafeAlloc(), SLNet::RakString::Realloc(), SLNet::RNS2_Berkley::RecvFromLoopInt(), SLNet::RakPeer::ReferenceRemoteSystem(), SLNet::CommandParserInterface::RegisterCommand(), DataStructures::BytePool::Release(), SLNet::RakPeer::ReleaseSockets(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::RemoveChannel(), DataStructures::Table::RemoveColumn(), SLNet::RakPeer::RemoveFromBanList(), SLNet::RakPeer::RemoveFromSecurityExceptionList(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::RemoveNode(), SLNet::StringTable::RemoveReference(), SLNet::StringCompressor::RemoveReference(), SLNet::VariableDeltaSerializer::RemoveRemoteSystemVariableHistory(), SLNet::RemoteClient::Reset(), SLNet::RakPeer::RunUpdateCycle(), SLNet::ReliabilityLayer::Send(), SLNet::RakPeer::SendBuffered(), SLNet::RakPeer::SendBufferedList(), SLNet::RakPeer::SendConnectionRequest(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendListUnified(), SLNet::RakPeer::SendLoopback(), SLNet::RakPeer::SendOutOfBand(), SLNet::RakPeer::SendTTL(), SLNet::RakWString::Serialize(), DataStructures::Map< key_type, data_type, key_comparison_func >::Set(), DataStructures::Table::Cell::Set(), SLNet::SystemAddress::SetBinaryAddress(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::SetMultilistType(), DataStructures::Map< key_type, data_type, key_comparison_func >::SetNew(), SLNet::RakNetSmartPtr< T >::SetNull(), SLNet::RakPeer::Shutdown(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::SingleProducerConsumer(), DataStructures::Table::SortTable(), SLNet::RakPeer::Startup(), SLNet::VariableDeltaSerializer::StartVariableHistoryWrite(), SLNet::VariableDeltaSerializer::StoreChangedVariablesList(), SLNet::StringCompressor::StringCompressor(), SLNet::ReliabilityLayer::Update(), SLNet::VariableListDeltaTracker::VariableLastValueNode::VariableLastValueNode(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::WeightedGraph(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::WriteLock(), SLNet::VariableListDeltaTracker::WriteVar(), DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >::~AVLBalancedBinarySearchTree(), DataStructures::BinarySearchTree< BinarySearchTreeType >::~BinarySearchTree(), SLNet::BitStream::~BitStream(), DataStructures::ByteQueue::~ByteQueue(), SLNet::CloudServer::CloudData::~CloudData(), GridSectorizer::~GridSectorizer(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::~Hash(), DataStructures::List< list_type >::~List(), DataStructures::MemoryPool< MemoryBlockType >::~MemoryPool(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::~Multilist(), DataStructures::OrderedList< key_type, data_type, default_comparison_function >::~OrderedList(), DataStructures::Queue< queue_type >::~Queue(), SLNet::RakNetSmartPtr< T >::~RakNetSmartPtr(), SLNet::RakPeer::~RakPeer(), SLNet::RakWString::~RakWString(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::~SingleProducerConsumer(), SLNet::StringCompressor::~StringCompressor(), SLNet::StringTable::~StringTable(), and SLNet::VariableListDeltaTracker::~VariableListDeltaTracker().

#define _USE_RAK_MEMORY_OVERRIDE 0

Uncomment to use RakMemoryOverride for custom memory tracking See memoryoverride.h.

Definition at line 78 of file defines.h.

#define BITSTREAM_STACK_ALLOCATION_SIZE 256

Threshold at which to do a malloc / free rather than pushing data onto a fixed stack for the bitstream class Arbitrary size, just picking something likely to be larger than most packets

Definition at line 93 of file defines.h.

Referenced by SLNet::BitStream::AddBitsAndReallocate(), SLNet::BitStream::BitStream(), and SLNet::BitStream::~BitStream().

#define BUFFERED_PACKETS_PAGE_SIZE 8

Definition at line 201 of file defines.h.

#define DATAGRAM_MESSAGE_ID_ARRAY_LENGTH 512

This controls the amount of memory used per connection. This many datagrams are tracked by datagramNumber. If more than this many datagrams are sent, then an ack for an older datagram would be ignored This results in an unnecessary resend in that case

Definition at line 129 of file defines.h.

#define GET_TIME_SPIKE_LIMIT 0

Uncomment if you want to link in the DLMalloc library to use with RakMemoryOverride.

Workaround for http://support.microsoft.com/kb/274323 If two calls between SLNet::GetTime() happen farther apart than this time in microseconds, this delta will be returned instead Note: This will cause ID_TIMESTAMP to be temporarily inaccurate if you set a breakpoint that pauses the UpdateNetworkLoop() thread in RakPeer Define in definesoverrides.h to enable (non-zero) or disable (0)

Definition at line 148 of file defines.h.

#define INTERNAL_PACKET_PAGE_SIZE 8

Definition at line 207 of file defines.h.

Referenced by SLNet::ReliabilityLayer::ReliabilityLayer().

#define MAX_ALLOCA_STACK_ALLOCATION 1048576

Maximum (stack) size to use with _alloca before using new and delete instead.

Define RAKNET_COMPATIBILITY to enable API compatibility with RakNet. This allows you to keep existing code which was compatible with RakNet 4.082 unmodified and use SLikeNet as an in-place replacement for the RakNet library without having to modify any of your code. Define __BITSTREAM_NATIVE_END to NOT support endian swapping in the BitStream class. This is faster and is what you should use unless you actually plan to have different endianness systems connect to each other Enabled by default.

Definition at line 65 of file defines.h.

Referenced by SLNet::RakThread::Create(), and SLNet::StringCompressor::DecodeString().

#define MAXIMUM_NUMBER_OF_INTERNAL_IDS 10

Definition at line 107 of file defines.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::FillIPList(), SLNet::SocketLayer::GetFirstBindableIP(), GetMyIP_Win32(), SLNet::RakPeer::GetNumberOfAddresses(), SLNet::RakPeer::IsLoopbackAddress(), SLNet::RakPeer::OnConnectionRequest(), SLNet::RakPeer::RakPeer(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SetInternalID(), and SLNet::RakPeer::Startup().

#define OPEN_SSL_CLIENT_SUPPORT 0

If defined, OpenSSL is enabled for the class TCPInterface This is necessary to use the SendEmail class with Google POP servers Note that OpenSSL carries its own license restrictions that you should be aware of. If you don't agree, don't enable this define This also requires that you enable header search paths to DependentExtensions/openssl-1.0.0d/include

Definition at line 87 of file defines.h.

#define PREALLOCATE_LARGE_MESSAGES 0

Definition at line 159 of file defines.h.

#define RakAssert ( x )

Definition at line 120 of file defines.h.

Referenced by SLNet::BitStream::AddBitsAndReallocate(), GridSectorizer::AddEntry(), SLNet::StringTable::AddString(), DataStructures::MemoryPool< MemoryBlockType >::Allocate(), SLNet::RakPeer::AllocPacket(), SLNet::BitStream::AssertCopyData(), SLNet::BitStream::AssertStreamEmpty(), SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::VariableDeltaSerializer::BeginUniqueSerialize(), SLNet::VariableDeltaSerializer::BeginUnreliableAckedSerialize(), SLNet::BitStream::BitStream(), DataStructures::BPlusTree< KeyType, DataType, order >::BPlusTree(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::CancelReadLock(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::Clear(), SLNet::RakString::Clone(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::DataCompressor::Compress(), SLNet::RakPeer::Connect(), SLNet::BitStream::CopyData(), SLNet::RakThread::Create(), SLNet::StringTable::DecodeString(), SLNet::DataCompressor::DecompressAndAllocate(), DefaultOutOfMemoryHandler(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::DeleteShiftArrayLeft(), SLNet::TableSerializer::DeserializeCell(), SLNet::TableSerializer::DeserializeFilterQuery(), SLNet::TableSerializer::DeserializeFilterQueryList(), SLNet::TableSerializer::DeserializeTable(), SLNet::HuffmanEncodingTree::EncodeArray(), SLNet::RakString::Erase(), SLNet::SystemAddress::FromString(), DataStructures::Map< key_type, data_type, key_comparison_func >::Get(), DataStructures::Table::Cell::Get(), DataStructures::Table::GetCellValueByIndex(), DataStructures::OrderedList< key_type, data_type, default_comparison_function >::GetElementFromKey(), DataStructures::Map< key_type, data_type, key_comparison_func >::GetIndexAtKey(), DataStructures::OrderedList< key_type, data_type, default_comparison_function >::GetIndexFromKey(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetIndexFromKeyInSortedList(), DataStructures::BPlusTree< KeyType, DataType, order >::GetIndexOf(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetIndexOf(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::GetInsertionIndex(), SLNet::RakPeer::GetRakNetSocketFromUserConnectionSocketIndex(), SLNet::RakPeer::GetRemoteSystemFromSystemAddress(), SLNet::SocketLayer::GetSubNetForSocketAndIp(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), GridSectorizer::Init(), DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Insert(), DataStructures::RangeList< range_type >::Insert(), DataStructures::List< list_type >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::Insert(), DataStructures::BPlusTree< KeyType, DataType, order >::InsertBranchDown(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::InsertInOrderedList(), DataStructures::BPlusTree< KeyType, DataType, order >::InsertIntoNode(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::InsertShiftArrayRight(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::ItemAtIndex(), DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::KeyAtIndex(), SLNet::SimpleMutex::Lock(), SLNet::RakPeer::OnConnectionRequest(), SLNet::RakWString::operator=(), SLNet::operator>>(), DataStructures::Queue< queue_type >::operator[](), DataStructures::List< list_type >::operator[](), SLNet::RakString::operator[](), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::operator[](), DataStructures::Heap< weight_type, data_type, isMaxHeap >::Parent(), SLNet::CommandParserInterface::ParseConsoleString(), DataStructures::Queue< queue_type >::Peek(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Peek(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PeekOpposite(), DataStructures::Queue< queue_type >::PeekTail(), SLNet::RakPeer::Ping(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Pop(), DataStructures::Queue< queue_type >::Pop(), DataStructures::List< list_type >::Pop(), DataStructures::Map< key_type, data_type, key_comparison_func >::Pop(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Pop(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PopOpposite(), DataStructures::Queue< queue_type >::PopTail(), SLNet::ProcessNetworkPacket(), SLNet::ProcessOfflineNetworkPacket(), DataStructures::Queue< queue_type >::Push(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::Push(), DataStructures::Queue< queue_type >::PushAtHead(), DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::PushAtHead(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::PushOpposite(), DataStructures::Table::QueryRow(), SLNet::BitStream::ReadAlignedBytes(), SLNet::BitStream::ReadAlignedVar16(), SLNet::BitStream::ReadAlignedVar32(), SLNet::BitStream::ReadAlignedVar8(), SLNet::BitStream::ReadBitsFromIntegerRange(), SLNet::BitStream::ReadFloat16(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::ReadUnlock(), SLNet::RakString::Realloc(), SLNet::RakPeer::Receive(), SLNet::RNS2_Berkley::RecvFromLoopInt(), SLNet::RakPeer::ReferenceRemoteSystem(), DataStructures::BytePool::Release(), DataStructures::MemoryPool< MemoryBlockType >::Release(), DataStructures::OrderedList< key_type, data_type, default_comparison_function >::Remove(), DataStructures::Queue< queue_type >::RemoveAtIndex(), DataStructures::List< list_type >::RemoveAtIndex(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::RemoveAtIndex(), DataStructures::List< list_type >::RemoveAtIndexFast(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::RemoveAtKey(), SLNet::RakPeer::RemoveFromActiveSystemList(), DataStructures::List< list_type >::RemoveFromEnd(), SLNet::StringTable::RemoveReference(), SLNet::StringCompressor::RemoveReference(), DataStructures::List< list_type >::Replace(), SLNet::RakString::Replace(), SLNet::RakPeer::RunUpdateCycle(), SLNet::ReliabilityLayer::Send(), SLNet::RakPeer::Send(), SLNet::RakPeer::SendBuffered(), SLNet::RakPeer::SendBufferedList(), SLNet::RakPeer::SendConnectionRequest(), SLNet::RakPeer::SendList(), SLNet::RakPeer::SendOutOfBand(), DataStructures::RangeList< range_type >::Serialize(), SLNet::TableSerializer::SerializeCell(), SLNet::TableSerializer::SerializeFilterQueryList(), SLNet::RakString::SetChar(), DataStructures::Map< key_type, data_type, key_comparison_func >::SetExisting(), SLNet::RakPeer::SetInternalID(), DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >::SetMultilistType(), DataStructures::Map< key_type, data_type, key_comparison_func >::SetNew(), SLNet::BitStream::SetNumberOfBitsAllocated(), SLNet::RakPeer::SetOfflinePingResponse(), SLNet::RakPeer::SetSplitMessageProgressInterval(), SLNet::RakPeer::ShiftIncomingTimestamp(), SLNet::RakPeer::Shutdown(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::SingleProducerConsumer(), DataStructures::Table::SortTable(), SLNet::RakPeer::Startup(), SLNet::NetworkIDManager::StopTrackingNetworkIDObject(), SLNet::NetworkIDManager::TrackNetworkIDObject(), SLNet::SimpleMutex::Unlock(), SLNet::ReliabilityLayer::Update(), DataStructures::Table::UpdateCell(), DataStructures::Table::UpdateCellByIndex(), DataStructures::BPlusTree< KeyType, DataType, order >::ValidateTreeRecursive(), SLNet::BitStream::WriteAlignedVar16(), SLNet::BitStream::WriteAlignedVar32(), SLNet::BitStream::WriteAlignedVar8(), SLNet::BitStream::WriteBitsFromIntegerRange(), SLNet::BitStream::WriteCompressed(), SLNet::BitStream::WriteFloat16(), DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::WriteLock(), SLNet::BitStream::WriteNormVector(), and DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::WriteUnlock().

#define RAKNET_DEBUG_PRINTF printf

Definition at line 98 of file defines.h.

Referenced by SLNet::StringTable::LogStringNotFound(), SLNet::RakWString::operator=(), DataStructures::ByteQueue::Print(), DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::Print(), SLNet::BitStream::PrintBits(), SLNet::RakString::Printf(), DataStructures::BPlusTree< KeyType, DataType, order >::PrintGraph(), SLNet::BitStream::PrintHex(), DataStructures::BPlusTree< KeyType, DataType, order >::PrintLeaf(), and SLNet::RakPeer::RunUpdateCycle().

#define RAKNET_DEBUG_TPRINTF _tprintf

Definition at line 102 of file defines.h.

Referenced by WSAStartupSingleton::AddRef(), GetMyIP_Win32(), SLNet::SocketLayer::GetSystemAddress(), SLNet::SocketLayer::GetSystemAddress_Old(), and SLNet::SocketLayer::SetSocketOptions().

#define RAKNET_SUPPORT_IPV6 0

Definition at line 163 of file defines.h.

Referenced by SLNet::RakPeer::Startup().

#define RAKPEER_USER_THREADED 0

Definition at line 212 of file defines.h.

#define RAKSTRING_TYPE RakString

Definition at line 181 of file defines.h.

#define RAKSTRING_TYPE_IS_UNICODE 0

Definition at line 182 of file defines.h.

#define RESEND_BUFFER_ARRAY_LENGTH 512

This is the maximum number of reliable user messages that can be on the wire at a time If this is too low, then high ping connections with a large throughput will be underutilized This will be evident because RakNetStatistics::messagesInSend buffer will increase over time, yet at the same time the outgoing bandwidth per second is less than your connection supports

Definition at line 136 of file defines.h.

#define RESEND_BUFFER_ARRAY_MASK 511

Definition at line 137 of file defines.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), and SLNet::ReliabilityLayer::Update().

#define RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH 48

Definition at line 191 of file defines.h.

#define RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS 48

Definition at line 187 of file defines.h.

#define SLNET_MAX_RETRIEVABLE_FILESIZE (0xFFFFFFFF)

Definition at line 233 of file defines.h.

#define USE_ALLOCA 1

Definition at line 216 of file defines.h.

#define USE_SLIDING_WINDOW_CONGESTION_CONTROL 1

Definition at line 153 of file defines.h.

#define USE_WAIT_FOR_MULTIPLE_EVENTS

Definition at line 72 of file defines.h.

#define XBOX_BYPASS_SECURITY 1

Definition at line 195 of file defines.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DirectoryDeltaTransfer.h File Reference

  • include
  • slikenet
Classes | Namespaces
DirectoryDeltaTransfer.h File Reference

Simple class to send changes between directories. More...

#include "NativeFeatureIncludes.h"
#include "memoryoverride.h"
#include "types.h"
#include "Export.h"
#include "PluginInterface2.h"
#include "DS_Map.h"
#include "PacketPriority.h"

Go to the source code of this file.

Classes

class SLNet::DirectoryDeltaTransfer

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Simple class to send changes between directories.

In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Definition in file DirectoryDeltaTransfer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_BinarySearchTree.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_BinarySearchTree.h File Reference
#include "DS_QueueLinkedList.h"
#include "memoryoverride.h"
#include "Export.h"

Go to the source code of this file.

Classes

class | DataStructures::BinarySearchTree< BinarySearchTreeType >
A binary search tree and an AVL balanced binary search tree. More...
struct | DataStructures::BinarySearchTree< BinarySearchTreeType >::node
class | DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >
An AVLBalancedBinarySearchTree is a binary tree that is always balanced. More...

Namespaces

namespace DataStructures

Class Documentation

struct DataStructures::BinarySearchTree::node

template<class BinarySearchTreeType>
struct DataStructures::BinarySearchTree< BinarySearchTreeType >::node

Definition at line 102 of file DS_BinarySearchTree.h.

Class Members
BinarySearchTreeType * | item
node * | left
node * | right
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_BPlusTree.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_BPlusTree.h File Reference
#include "DS_MemoryPool.h"
#include "DS_Queue.h"
#include <stdio.h>
#include "Export.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

struct | DataStructures::Page< KeyType, DataType, order >
class | DataStructures::BPlusTree< KeyType, DataType, order >
struct | DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction

Namespaces

namespace DataStructures

Class Documentation

struct DataStructures::Page

template<class KeyType, class DataType, int order>
struct DataStructures::Page< KeyType, DataType, order >

Used in the BPlusTree. Used for both leaf and index nodes. Don't use a constructor or destructor, due to the memory pool I am using

Definition at line 50 of file DS_BPlusTree.h.

+ Inheritance diagram for DataStructures::Page< KeyType, DataType, order >:
Class Members
Page * | children
DataType | data
bool | isLeaf
KeyType | keys
Page< KeyType, DataType, order > * | next
Page< KeyType, DataType, order > * | previous
int | size
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_BytePool.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_BytePool.h File Reference
#include "memoryoverride.h"
#include "DS_MemoryPool.h"
#include "Export.h"
#include "SimpleMutex.h"
#include "assert.h"

Go to the source code of this file.

Classes

class DataStructures::BytePool

Namespaces

namespace DataStructures
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_ByteQueue.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_ByteQueue.h File Reference
#include "memoryoverride.h"
#include "Export.h"

Go to the source code of this file.

Classes

class DataStructures::ByteQueue

Namespaces

namespace DataStructures
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Hash.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_Hash.h File Reference
#include "assert.h"
#include <string.h>
#include "Export.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

struct | DataStructures::HashIndex
class | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >
Using a string as a identifier for a node, store an allocated pointer to that node. More...
struct | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node

Namespaces

namespace DataStructures
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Heap.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_Heap.h File Reference
#include "memoryoverride.h"
#include "DS_List.h"
#include "Export.h"
#include "assert.h"

Go to the source code of this file.

Classes

class | DataStructures::Heap< weight_type, data_type, isMaxHeap >
struct | DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode

Namespaces

namespace DataStructures
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_HuffmanEncodingTree.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_HuffmanEncodingTree.h File Reference

[Internal] Generates a huffman encoding tree, used for string and global compression. More...

#include "memoryoverride.h"
#include "DS_HuffmanEncodingTreeNode.h"
#include "BitStream.h"
#include "Export.h"
#include "DS_LinkedList.h"

Go to the source code of this file.

Classes

class SLNet::HuffmanEncodingTree
This generates special cases of the huffman encoding tree using 8 bit keys with the additional condition that unused combinations of 8 bits are treated as a frequency of 1. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

[Internal] Generates a huffman encoding tree, used for string and global compression.

Definition in file DS_HuffmanEncodingTree.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_HuffmanEncodingTreeFactory.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_HuffmanEncodingTreeFactory.h File Reference
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class SLNet::HuffmanEncodingTreeFactory
Creates instances of the class HuffmanEncodingTree. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_LinkedList.h File Reference

  • include
  • slikenet
Classes | Namespaces | Variables
DS_LinkedList.h File Reference
#include "Export.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class | DataStructures::CircularLinkedList< CircularLinkedListType >
(Circular) Linked List ADT (Doubly Linked Pointer to Node Style) - More...
struct | DataStructures::CircularLinkedList< CircularLinkedListType >::node
class | DataStructures::LinkedList< LinkedListType >

Namespaces

namespace DataStructures

Variables

template<class LinkedListType >
class RAK_DLL_EXPORT DataStructures::LinkedList

Class Documentation

struct DataStructures::CircularLinkedList::node

template<class CircularLinkedListType>
struct DataStructures::CircularLinkedList< CircularLinkedListType >::node

Definition at line 158 of file DS_LinkedList.h.

Class Members
CircularLinkedListType | item
node * | next
node * | previous
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_List.h File Reference

  • include
  • slikenet
Classes | Namespaces | Variables
DS_List.h File Reference
#include "assert.h"
#include <string.h>
#include "Export.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class DataStructures::List< list_type >
Array based implementation of a list. More...

Namespaces

namespace DataStructures

Variables

static const unsigned int MAX_UNSIGNED_LONG = 4294967295U
Maximum unsigned long.

Variable Documentation

const unsigned int MAX_UNSIGNED_LONG = 4294967295U
static

Maximum unsigned long.

Definition at line 32 of file DS_List.h.

Referenced by SLNet::RakPeer::AttachPlugin(), SLNet::RakPeer::DetachPlugin(), DataStructures::List< list_type >::GetIndexOf(), and DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::Push().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Map.h File Reference

  • include
  • slikenet
Classes | Namespaces | Functions
DS_Map.h File Reference
#include "DS_OrderedList.h"
#include "Export.h"
#include "memoryoverride.h"
#include "assert.h"

Go to the source code of this file.

Classes

class | DataStructures::Map< key_type, data_type, key_comparison_func >
struct | DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode

Namespaces

namespace DataStructures

Functions

template<class key_type >
int DataStructures::defaultMapKeyComparison (const key_type &a, const key_type &b)
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_MemoryPool.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros
DS_MemoryPool.h File Reference
#include <stdlib.h>
#include "assert.h"
#include "Export.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class | DataStructures::MemoryPool< MemoryBlockType >
struct | DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage
struct | DataStructures::MemoryPool< MemoryBlockType >::Page

Namespaces

namespace DataStructures

Macros

#define DS_MEMORY_POOL_MAX_FREE_PAGES 4

Class Documentation

struct DataStructures::MemoryPool::MemoryWithPage

template<class MemoryBlockType>
struct DataStructures::MemoryPool< MemoryBlockType >::MemoryWithPage

Definition at line 46 of file DS_MemoryPool.h.

Class Members
Page * | parentPage
MemoryBlockType | userMemory
struct DataStructures::MemoryPool::Page

template<class MemoryBlockType>
struct DataStructures::MemoryPool< MemoryBlockType >::Page

Definition at line 51 of file DS_MemoryPool.h.

Class Members
MemoryWithPage ** | availableStack
int | availableStackSize
MemoryWithPage * | block
Page * | next
Page * | prev

Macro Definition Documentation

#define DS_MEMORY_POOL_MAX_FREE_PAGES 4

Definition at line 33 of file DS_MemoryPool.h.

Referenced by DataStructures::MemoryPool< MemoryBlockType >::Release().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Multilist.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions
DS_Multilist.h File Reference
#include "assert.h"
#include <string.h>
#include "Export.h"
#include "memoryoverride.h"
#include "NativeTypes.h"

Go to the source code of this file.

Classes

class | DataStructures::MLKeyRef< templateType >
class | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >
The multilist, representing an abstract data type that generally holds lists. More...

Namespaces

namespace DataStructures

Macros

#define DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS(_CLASS_NAME_, _KEY_TYPE_, _MEMBER_VARIABLE_NAME_)

Typedefs

typedef uint32_t DataStructures::DefaultIndexType

Enumerations

enum MultilistType {
ML_UNORDERED_LIST, ML_STACK, ML_QUEUE, ML_ORDERED_LIST,
ML_VARIABLE_DURING_RUNTIME
}
What algorithm to use to store the data for the Multilist. More...

Functions

template<class templateType >
void | DataStructures::DeletePtr_RakNet (templateType &ptr, const char *file, unsigned int line)
template<class templateType >
void | DataStructures::DeletePtr (templateType &ptr)

Macro Definition Documentation

#define DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS | ( | _CLASS_NAME_,
 |  | _KEY_TYPE_,
 |  | _MEMBER_VARIABLE_NAME_
 | ) |
Value:
bool operator<( const DataStructures::MLKeyRef<_KEY_TYPE_> &inputKey, const _CLASS_NAME_ *cls ) {return inputKey.Get() < cls->_MEMBER_VARIABLE_NAME_;} \
bool operator>( const DataStructures::MLKeyRef<_KEY_TYPE_> &inputKey, const _CLASS_NAME_ *cls ) {return inputKey.Get() > cls->_MEMBER_VARIABLE_NAME_;} \
bool operator==( const DataStructures::MLKeyRef<_KEY_TYPE_> &inputKey, const _CLASS_NAME_ *cls ) {return inputKey.Get() == cls->_MEMBER_VARIABLE_NAME_;}

For the Multilist, when _DataType != _KeyType, you must define the comparison operators between the key and the data This is non-trivial due to the need to use MLKeyRef in case the type held is a pointer to a structure or class and the key type is not a class For convenience, this macro will implement the comparison operators under the following conditions

  1. _DataType is a pointer to a class or structure
  2. The key is a member variable of _DataType

Definition at line 86 of file DS_Multilist.h.

Enumeration Type Documentation

enum MultilistType

What algorithm to use to store the data for the Multilist.

Enumerator:
ML_UNORDERED_LIST

Removing from the middle of the list will swap the end of the list rather than shift the elements. Push and Pop operate on the tail.

ML_STACK

A normal list, with the list order preserved. Push and Pop operate on the tail.

ML_QUEUE

A queue. Push and Pop operate on the head.

ML_ORDERED_LIST

A list that is always kept in order. Elements must be unique, and compare against each other consistently using <, ==, and >

ML_VARIABLE_DURING_RUNTIME

A list whose type can change at runtime.

Definition at line 32 of file DS_Multilist.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_OrderedChannelHeap.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_OrderedChannelHeap.h File Reference
#include "DS_Heap.h"
#include "DS_Map.h"
#include "DS_Queue.h"
#include "Export.h"
#include "assert.h"
#include "Rand.h"

Go to the source code of this file.

Classes

class | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >
struct | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight
struct | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData

Namespaces

namespace DataStructures

Class Documentation

struct DataStructures::OrderedChannelHeap::QueueAndWeight

template<class channel_key_type, class heap_data_type, int(*)(const channel_key_type &, const channel_key_type &) channel_key_comparison_func = defaultMapKeyComparison<channel_key_type>>
struct DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::QueueAndWeight

Definition at line 55 of file DS_OrderedChannelHeap.h.

Class Members
Queue< double > | randResultQueue
bool | signalDeletion
double | weight
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_OrderedList.h File Reference

  • include
  • slikenet
Classes | Namespaces | Functions
DS_OrderedList.h File Reference
#include "DS_List.h"
#include "memoryoverride.h"
#include "Export.h"

Go to the source code of this file.

Classes

class DataStructures::OrderedList< key_type, data_type, default_comparison_function >

Namespaces

namespace DataStructures

Functions

template<class key_type , class data_type >
int DataStructures::defaultOrderedListComparison (const key_type &a, const data_type &b)
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Queue.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_Queue.h File Reference
#include "assert.h"
#include "Export.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class DataStructures::Queue< queue_type >
A queue implemented as an array with a read and write index. More...

Namespaces

namespace DataStructures
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_QueueLinkedList.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_QueueLinkedList.h File Reference
#include "DS_LinkedList.h"
#include "Export.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class DataStructures::QueueLinkedList< QueueType >
A queue implemented using a linked list. Rarely used. More...

Namespaces

namespace DataStructures
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_RangeList.h File Reference

  • include
  • slikenet
Classes | Namespaces | Functions
DS_RangeList.h File Reference
#include "DS_OrderedList.h"
#include "BitStream.h"
#include "memoryoverride.h"
#include "assert.h"

Go to the source code of this file.

Classes

struct | DataStructures::RangeNode< range_type >
class | DataStructures::RangeList< range_type >

Namespaces

namespace DataStructures

Functions

template<class range_type >
int DataStructures::RangeNodeComp (const range_type &a, const RangeNode< range_type > &b)
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Table.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros
DS_Table.h File Reference
#include "DS_List.h"
#include "DS_BPlusTree.h"
#include "memoryoverride.h"
#include "Export.h"
#include "string.h"

Go to the source code of this file.

Classes

class | DataStructures::Table
Holds a set of columns, a set of rows, and rows times columns cells. More...
struct | DataStructures::Table::Cell
Holds the actual data in the table. More...
struct | DataStructures::Table::ColumnDescriptor
struct | DataStructures::Table::Row
Stores the list of cells for this row, and a special flag used for internal sorting. More...
struct | DataStructures::Table::FilterQuery
struct | DataStructures::Table::SortQuery

Namespaces

namespace DataStructures

Macros

#define | _TABLE_BPLUS_TREE_ORDER 16
#define | _TABLE_MAX_COLUMN_NAME_LENGTH 64

Class Documentation

struct DataStructures::Table::SortQuery

Definition at line 178 of file DS_Table.h.

Class Members
unsigned | columnIndex | The index of the table column we are sorting on.
SortQueryType | operation | See SortQueryType.

Macro Definition Documentation

#define _TABLE_BPLUS_TREE_ORDER 16

Definition at line 29 of file DS_Table.h.

#define _TABLE_MAX_COLUMN_NAME_LENGTH 64

Definition at line 30 of file DS_Table.h.

Referenced by SLNet::TableSerializer::DeserializeColumns(), SLNet::TableSerializer::DeserializeFilterQuery(), SLNet::TableSerializer::SerializeColumns(), and SLNet::TableSerializer::SerializeFilterQuery().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_ThreadsafeAllocatingQueue.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_ThreadsafeAllocatingQueue.h File Reference
#include "DS_Queue.h"
#include "SimpleMutex.h"
#include "DS_MemoryPool.h"

Go to the source code of this file.

Classes

class DataStructures::ThreadsafeAllocatingQueue< structureType >

Namespaces

namespace DataStructures
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Tree.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_Tree.h File Reference
#include "Export.h"
#include "DS_List.h"
#include "DS_Queue.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class DataStructures::Tree< TreeType >

Namespaces

namespace DataStructures
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_WeightedGraph.h File Reference

  • include
  • slikenet
Classes | Namespaces
DS_WeightedGraph.h File Reference
#include "DS_OrderedList.h"
#include "DS_Map.h"
#include "DS_Heap.h"
#include "DS_Queue.h"
#include "DS_Tree.h"
#include "assert.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >
struct | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent

Namespaces

namespace DataStructures

Class Documentation

struct DataStructures::WeightedGraph::NodeAndParent

template<class node_type, class weight_type, bool allow_unlinkedNodes>
struct DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::NodeAndParent

Definition at line 86 of file DS_WeightedGraph.h.

Class Members
Tree< node_type > * | node
Tree< node_type > * | parent
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DynDNS.h File Reference

  • include
  • slikenet
Classes | Namespaces | Enumerations
DynDNS.h File Reference

Helper to class to update DynDNS This can be used to determine what permissions are should be allowed to the other system. More...

#include "NativeFeatureIncludes.h"
#include "string.h"

Go to the source code of this file.

Classes

class SLNet::DynDNS

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Enumerations

enum SLNet::DynDnsResultCode {
SLNet::RC_SUCCESS, SLNet::RC_DNS_ALREADY_SET, SLNet::RC_NO_CHANGE, SLNet::RC_NOT_DONATOR,
SLNet::RC_NO_HOST, SLNet::RC_BAD_AUTH, SLNet::RC_NOT_YOURS, SLNet::RC_ABUSE,
SLNet::RC_TCP_FAILED_TO_START, SLNet::RC_TCP_DID_NOT_CONNECT, SLNet::RC_UNKNOWN_RESULT, SLNet::RC_PARSING_FAILURE,
SLNet::RC_CONNECTION_LOST_WITHOUT_RESPONSE, SLNet::RC_BAD_AGENT, SLNet::RC_BAD_SYS, SLNet::RC_DNS_ERROR,
SLNet::RC_NOT_FQDN, SLNet::RC_NUM_HOST, SLNet::RC_911, SLNet::RC_DYNDNS_TIMEOUT
}

Detailed Description

Helper to class to update DynDNS This can be used to determine what permissions are should be allowed to the other system.

Definition in file DynDNS.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/EmailSender.h File Reference

  • include
  • slikenet
Classes | Namespaces
EmailSender.h File Reference

Rudimentary class to send email from code. Don't expect anything fancy. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "memoryoverride.h"
#include "Export.h"
#include "Rand.h"
#include "TCPInterface.h"

Go to the source code of this file.

Classes

class SLNet::EmailSender
Rudimentary class to send email from code. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Rudimentary class to send email from code. Don't expect anything fancy.

Definition in file EmailSender.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/EmptyHeader.h File Reference

  • include
  • slikenet
EmptyHeader.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/EpochTimeToString.h File Reference

  • include
  • slikenet
Functions
EpochTimeToString.h File Reference
#include "Export.h"

Go to the source code of this file.

Functions

RAK_DLL_EXPORT char * EpochTimeToString (long long time)

Function Documentation

RAK_DLL_EXPORT char* EpochTimeToString ( long long time )

Definition at line 27 of file EpochTimeToString.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Export.h File Reference

  • include
  • slikenet
Macros
Export.h File Reference
#include "defines.h"

Go to the source code of this file.

Macros

#define | RAK_DLL_EXPORT
#define | STATIC_FACTORY_DECLARATIONS(x)
#define | STATIC_FACTORY_DEFINITIONS(x, y)

Macro Definition Documentation

#define RAK_DLL_EXPORT

Definition at line 21 of file Export.h.

#define STATIC_FACTORY_DECLARATIONS ( x )
Value:
static x* GetInstance(void); \
static void DestroyInstance( x *i);

Definition at line 24 of file Export.h.

#define STATIC_FACTORY_DEFINITIONS | ( | x,
 |  | y
 | ) |
Value:
x* x::GetInstance(void) {return SLNet::OP_NEW<y>( _FILE_AND_LINE_ );} \
void x::DestroyInstance( x *i) {SLNet::OP_DELETE(( y* ) i, _FILE_AND_LINE_);}

Definition at line 27 of file Export.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileList.h File Reference

  • include
  • slikenet
Classes | Namespaces
FileList.h File Reference
#include "NativeFeatureIncludes.h"
#include "Export.h"
#include "DS_List.h"
#include "memoryoverride.h"
#include "types.h"
#include "FileListNodeContext.h"
#include "string.h"

Go to the source code of this file.

Classes

struct | SLNet::FileListNode
Represents once instance of a file. More...
class | SLNet::FileListProgress
Callback interface set with FileList::SetCallback() in case you want progress notifications when FileList::AddFilesFromDirectory() is called. More...
class | SLNet::FLP_Printf
Implementation of FileListProgress to use RAKNET_DEBUG_PRINTF. More...
class | SLNet::FileList

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Class Documentation

struct SLNet::FileListNode

Represents once instance of a file.

Definition at line 46 of file FileList.h.

Class Members
FileListNodeContext | context | User specific data for whatever, describing this file.
char * | data | File data (may be null if not ready)
BitSize_t | dataLengthBytes | Length of data. May be greater than fileLength if prepended with a file hash.
unsigned | fileLengthBytes | Length of the file.
RakString | filename | Name of the file.
RakString | fullPathToFile | Full path to the file, which may be different than filename.
bool | isAReference | If true, data and dataLengthBytes should be empty. This is just storing the filename.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileListNodeContext.h File Reference

  • include
  • slikenet
Classes | Functions
FileListNodeContext.h File Reference
#include "BitStream.h"

Go to the source code of this file.

Classes

struct FileListNodeContext

Functions

SLNet::BitStream & | operator<< (SLNet::BitStream &out, FileListNodeContext &in)
SLNet::BitStream & | operator>> (SLNet::BitStream &in, FileListNodeContext &out)

Function Documentation

SLNet::BitStream& operator<< | ( | SLNet::BitStream & | out,
 |  | FileListNodeContext & | in
 | ) |  |
inline

Definition at line 39 of file FileListNodeContext.h.

References FileListNodeContext::flnc_extraData1, FileListNodeContext::flnc_extraData2, FileListNodeContext::flnc_extraData3, FileListNodeContext::op, and SLNet::BitStream::Write().

SLNet::BitStream& operator>> | ( | SLNet::BitStream & | in,
 |  | FileListNodeContext & | out
 | ) |  |
inline

Definition at line 47 of file FileListNodeContext.h.

References FileListNodeContext::flnc_extraData1, FileListNodeContext::flnc_extraData2, FileListNodeContext::flnc_extraData3, FileListNodeContext::op, and SLNet::BitStream::Read().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileListTransfer.h File Reference

  • include
  • slikenet
Classes | Namespaces
FileListTransfer.h File Reference

A plugin to provide a simple way to compress and incrementally send the files in the FileList structure. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "Export.h"
#include "PluginInterface2.h"
#include "DS_Map.h"
#include "PacketPriority.h"
#include "memoryoverride.h"
#include "FileList.h"
#include "DS_Queue.h"
#include "SimpleMutex.h"
#include "ThreadPool.h"

Go to the source code of this file.

Classes

class | SLNet::FileListTransfer
A plugin to provide a simple way to compress and incrementally send the files in the FileList structure. More...
struct | SLNet::FileListTransfer::FileToPush
struct | SLNet::FileListTransfer::FileToPushRecipient
struct | SLNet::FileListTransfer::ThreadData

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

A plugin to provide a simple way to compress and incrementally send the files in the FileList structure.

Definition in file FileListTransfer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileListTransferCBInterface.h File Reference

  • include
  • slikenet
Classes | Namespaces
FileListTransferCBInterface.h File Reference
#include "memoryoverride.h"
#include "FileListNodeContext.h"

Go to the source code of this file.

Classes

class | SLNet::FileListTransferCBInterface
Used by FileListTransfer plugin as a callback for when we get a file. More...
struct | SLNet::FileListTransferCBInterface::OnFileStruct
struct | SLNet::FileListTransferCBInterface::FileProgressStruct
struct | SLNet::FileListTransferCBInterface::DownloadCompleteStruct

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Class Documentation

struct SLNet::FileListTransferCBInterface::OnFileStruct

Definition at line 36 of file FileListTransferCBInterface.h.

Class Members
BitSize_t | byteLengthOfThisFile | The amount of data to be downloaded for this file.
unsigned | byteLengthOfThisSet | The total length of the transmitted files for this set, after being uncompressed.
BitSize_t | bytesDownloadedForThisFile | How many bytes of this file has been downloaded.
unsigned | bytesDownloadedForThisSet | The total length, in bytes, downloaded for this set.
FileListNodeContext | context | User data passed to one of the functions in the FileList class. However, on error, this is instead changed to one of the enumerations in the PatchContext structure.
char * | fileData | The data pointed to by the file.
unsigned | fileIndex | The index into the set of files, from 0 to numberOfFilesInThisSet.
char | fileName | The name of the file.
unsigned | numberOfFilesInThisSet | The number of files that are in this set.
RakNetGUID | senderGuid | Who sent this file. Not valid when using TCP, only RakPeer (UDP)
SystemAddress | senderSystemAddress | Who sent this file.
unsigned short | setID | Files are transmitted in sets, where more than one set of files can be transmitted at the same time. This is the identifier for the set, which is returned by FileListTransfer::SetupReceive
struct SLNet::FileListTransferCBInterface::FileProgressStruct

Definition at line 78 of file FileListTransferCBInterface.h.

Class Members
bool allocateIrIDataChunkAutomatically
Parameters
[in] allocateIrIDataChunkAutomatically If true, then RakNet will hold iriDataChunk for you and return it in OnFile. Defaults to true
unsigned int dataChunkLength
Parameters
[out] dataChunkLength How many bytes long firstDataChunk and iriDataChunk are
char * firstDataChunk
Parameters
[out] firstDataChunk The first partLength of the final file. If you store identifying information about the file in the first partLength bytes, you can read them while the download is taking place. If this hasn't arrived yet, firstDataChunk will be 0
char * iriDataChunk
Parameters
[out] iriDataChunk If the remote system is sending this file using IncrementalReadInterface, then this is the chunk we just downloaded. It will not exist in memory after this callback. You should either store this to disk, or in memory. If it is 0, then the file is smaller than one chunk, and will be held in memory automatically
unsigned int iriWriteOffset
Parameters
[out] iriWriteOffset Offset in bytes from the start of the file for the data pointed to by iriDataChunk
OnFileStruct * onFileStruct
Parameters
[out] onFileStruct General information about this file, such as the filename and the first partLength bytes. You do NOT need to save this data yourself. The complete file will arrive normally.
unsigned int partCount
Parameters
[out] partCount The zero based index into partTotal. The percentage complete done of this file is 100 * (partCount+1)/partTotal
unsigned int partTotal
Parameters
[out] partTotal The total number of parts this file was split into. Each part will be roughly the MTU size, minus the UDP header and RakNet headers
RakNetGUID senderGuid
Parameters
[out] Who sent this file. Not valid when using TCP, only RakPeer (UDP)
SystemAddress senderSystemAddress
Parameters
[out] Who sent this file
struct SLNet::FileListTransferCBInterface::DownloadCompleteStruct

Definition at line 102 of file FileListTransferCBInterface.h.

Class Members
unsigned | byteLengthOfThisSet | The total length of the transmitted files for this set, after being uncompressed.
unsigned | numberOfFilesInThisSet | The number of files that are in this set.
RakNetGUID | senderGuid | Who sent this file. Not valid when using TCP, only RakPeer (UDP)
SystemAddress | senderSystemAddress | Who sent this file.
unsigned short | setID | Files are transmitted in sets, where more than one set of files can be transmitted at the same time. This is the identifier for the set, which is returned by FileListTransfer::SetupReceive
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileOperations.h File Reference

  • include
  • slikenet
Functions
FileOperations.h File Reference
#include "NativeFeatureIncludes.h"
#include "Export.h"

Go to the source code of this file.

Functions

bool RAK_DLL_EXPORT | WriteFileWithDirectories (const char *path, char *data, unsigned dataLength)
bool RAK_DLL_EXPORT | IsSlash (unsigned char c)
void RAK_DLL_EXPORT | AddSlash (char *input)
void RAK_DLL_EXPORT | QuoteIfSpaces (char *str)
bool RAK_DLL_EXPORT | DirectoryExists (const char *directory)
unsigned int RAK_DLL_EXPORT | GetFileLength (const char *path)

Function Documentation

void RAK_DLL_EXPORT AddSlash ( char * input )
bool RAK_DLL_EXPORT DirectoryExists ( const char * directory )
unsigned int RAK_DLL_EXPORT GetFileLength ( const char * path )
bool RAK_DLL_EXPORT IsSlash ( unsigned char c )
void RAK_DLL_EXPORT QuoteIfSpaces ( char * str )
bool RAK_DLL_EXPORT WriteFileWithDirectories | ( | const char * | path,
 |  | char * | data,
 |  | unsigned | dataLength
 | ) |  |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FormatString.h File Reference

  • include
  • slikenet
Functions
FormatString.h File Reference
#include "Export.h"

Go to the source code of this file.

Functions

char * | FormatString (const char *format,...)
char * | FormatStringTS (char *output, const char *format,...)

Function Documentation

char* FormatString | ( | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 24 of file FormatString.cpp.

char* FormatStringTS | ( | char * | output,
 |  | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 39 of file FormatString.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FullyConnectedMesh2.h File Reference

  • include
  • slikenet
Typedefs
FullyConnectedMesh2.h File Reference

Fully connected mesh plugin, revision 2. More...

#include "NativeFeatureIncludes.h"
#include "PluginInterface2.h"
#include "memoryoverride.h"
#include "NativeTypes.h"
#include "DS_List.h"
#include "string.h"
#include "BitStream.h"

Go to the source code of this file.

Typedefs

typedef int64_t FCM2Guid

Detailed Description

Fully connected mesh plugin, revision 2.

This will connect RakPeer to all connecting peers, and all peers the connecting peer knows about.

Definition in file FullyConnectedMesh2.h.

Typedef Documentation

typedef int64_t FCM2Guid

Definition at line 35 of file FullyConnectedMesh2.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Getche.h File Reference

  • include
  • slikenet
Functions
Getche.h File Reference
#include <termios.h>
#include <stdio.h>
#include <unistd.h>

Go to the source code of this file.

Functions

char _getche ()

Function Documentation

char _getche ( )

Definition at line 24 of file Getche.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Gets.h File Reference

  • include
  • slikenet
Functions
Gets.h File Reference

Go to the source code of this file.

Functions

char * Gets (char *str, int num)

Function Documentation

char* Gets | ( | char * | str,
 |  | int | num
 | ) |  |

Definition at line 18 of file Gets.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/GetTime.h File Reference

  • include
  • slikenet
Namespaces | Functions
GetTime.h File Reference

Returns the value from QueryPerformanceCounter. This is the function RakNet uses to represent time. This time won't match the time returned by GetTimeCount(). See http://www.jenkinssoftware.com/forum/index.php?topic=2798.0. More...

#include "Export.h"
#include "time.h"

Go to the source code of this file.

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Functions

SLNet::Time RAK_DLL_EXPORT | SLNet::GetTime (void)
SLNet::TimeMS RAK_DLL_EXPORT | SLNet::GetTimeMS (void)
SLNet::TimeUS RAK_DLL_EXPORT | SLNet::GetTimeUS (void)
RAK_DLL_EXPORT bool | SLNet::GreaterThan (SLNet::Time a, SLNet::Time b)
a > b?
RAK_DLL_EXPORT bool | SLNet::LessThan (SLNet::Time a, SLNet::Time b)
a < b?

Detailed Description

Returns the value from QueryPerformanceCounter. This is the function RakNet uses to represent time. This time won't match the time returned by GetTimeCount(). See http://www.jenkinssoftware.com/forum/index.php?topic=2798.0.

Definition in file GetTime.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/gettimeofday.h File Reference

  • include
  • slikenet
gettimeofday.h File Reference
#include <sys/time.h>
#include <unistd.h>

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/GridSectorizer.h File Reference

  • include
  • slikenet
Classes
GridSectorizer.h File Reference
#include "memoryoverride.h"
#include "DS_List.h"

Go to the source code of this file.

Classes

class GridSectorizer
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/HTTPConnection.h File Reference

  • include
  • slikenet
Classes | Namespaces
HTTPConnection.h File Reference

Contains HTTPConnection, used to communicate with web servers. More...

#include "NativeFeatureIncludes.h"
#include "Export.h"
#include "string.h"
#include "memoryoverride.h"
#include "types.h"
#include "DS_Queue.h"

Go to the source code of this file.

Classes

class | SLNet::HTTPConnection
Use HTTPConnection to communicate with a web server. More...
struct | SLNet::HTTPConnection::BadResponse
Encapsulates a raw HTTP response and response code. More...
struct | SLNet::HTTPConnection::OutgoingCommand

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains HTTPConnection, used to communicate with web servers.

Definition in file HTTPConnection.h.

Class Documentation

struct SLNet::HTTPConnection::OutgoingCommand

Definition at line 126 of file HTTPConnection.h.

Class Members
RakString | contentType
RakString | data
bool | isPost
RakString | remotePath
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/HTTPConnection2.h File Reference

  • include
  • slikenet
Classes | Namespaces
HTTPConnection2.h File Reference

Contains HTTPConnection2, used to communicate with web servers. More...

#include "NativeFeatureIncludes.h"
#include "Export.h"
#include "string.h"
#include "memoryoverride.h"
#include "types.h"
#include "DS_List.h"
#include "DS_Queue.h"
#include "PluginInterface2.h"
#include "SimpleMutex.h"

Go to the source code of this file.

Classes

class | SLNet::HTTPConnection2
Use HTTPConnection2 to communicate with a web server. More...
struct | SLNet::HTTPConnection2::Request

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains HTTPConnection2, used to communicate with web servers.

Definition in file HTTPConnection2.h.

Class Documentation

struct SLNet::HTTPConnection2::Request

Definition at line 85 of file HTTPConnection2.h.

Class Members
size_t | bytesReadForThisChunk
bool | chunked
int | contentLength
ptrdiff_t | contentOffset
RakString | host
SystemAddress | hostCompletedAddress
SystemAddress | hostEstimatedAddress
int | ipVersion
unsigned short | port
RakString | stringReceived
RakString | stringToTransmit
size_t | thisChunkSize
void * | userData
bool | useSSL
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/IncrementalReadInterface.h File Reference

  • include
  • slikenet
Classes | Namespaces
IncrementalReadInterface.h File Reference
#include "FileListNodeContext.h"
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::IncrementalReadInterface

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/InternalPacket.h File Reference

  • include
  • slikenet
Classes | Namespaces | Typedefs
InternalPacket.h File Reference

[Internal] A class which stores a user message, and all information associated with sending and receiving that message. More...

#include "PacketPriority.h"
#include "types.h"
#include "memoryoverride.h"
#include "defines.h"
#include "NativeTypes.h"
#include "CCRakNetSlidingWindow.h"

Go to the source code of this file.

Classes

struct | SLNet::InternalPacketFixedSizeTransmissionHeader
struct | SLNet::InternalPacketRefCountedData
Used in InternalPacket when pointing to sharedDataBlock, rather than allocating itself. More...
struct | SLNet::InternalPacket

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Typedefs

typedef uint16_t | SLNet::SplitPacketIdType
typedef uint32_t | SLNet::SplitPacketIndexType
typedef uint24_t | SLNet::MessageNumberType
typedef MessageNumberType | SLNet::OrderingIndexType
typedef SLNet::TimeUS | SLNet::RemoteSystemTimeType

Detailed Description

[Internal] A class which stores a user message, and all information associated with sending and receiving that message.

Definition in file InternalPacket.h.

Class Documentation

struct SLNet::InternalPacketRefCountedData

Used in InternalPacket when pointing to sharedDataBlock, rather than allocating itself.

Definition at line 76 of file InternalPacket.h.

Class Members
unsigned int | refCount
unsigned char * | sharedDataBlock
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Itoa.h File Reference

  • include
  • slikenet
Functions
Itoa.h File Reference

Go to the source code of this file.

Functions

char * Itoa (int value, char *result, int base)

Function Documentation

char* Itoa | ( | int | value,
 |  | char * | result,
 |  | int | base
 | ) |  |

Definition at line 24 of file Itoa.cpp.

Referenced by SLNet::SystemAddress::ToString_Old(), and SLNet::RakString::URLEncode().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Kbhit.h File Reference

  • include
  • slikenet
Functions | Variables
Kbhit.h File Reference
#include <sys/time.h>
#include <termios.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Functions

static void | cooked (void)
static void | raw (void)
static int | _kbhit (void)
static int | _getch (void)

Variables

static struct termios g_old_kbd_mode

Function Documentation

static int _getch ( void )
static

Definition at line 80 of file Kbhit.h.

References raw().

static int _kbhit ( void )
static

Definition at line 59 of file Kbhit.h.

References raw().

static void cooked ( void )
static

Definition at line 31 of file Kbhit.h.

References g_old_kbd_mode.

Referenced by raw().

static void raw ( void )
static

Definition at line 37 of file Kbhit.h.

References cooked(), and g_old_kbd_mode.

Referenced by _getch(), and _kbhit().

Variable Documentation

struct termios g_old_kbd_mode
static

Definition at line 28 of file Kbhit.h.

Referenced by cooked(), and raw().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/linux_adapter.h File Reference

  • include
  • slikenet
linux_adapter.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/LinuxStrings.h File Reference

  • include
  • slikenet
LinuxStrings.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/LocklessTypes.h File Reference

  • include
  • slikenet
Classes | Namespaces
LocklessTypes.h File Reference
#include "Export.h"
#include "NativeTypes.h"
#include "WindowsIncludes.h"

Go to the source code of this file.

Classes

class SLNet::LocklessUint32_t

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/LogCommandParser.h File Reference

  • include
  • slikenet
Classes | Namespaces
LogCommandParser.h File Reference

Contains LogCommandParser , Used to send logs to connected consoles. More...

#include "NativeFeatureIncludes.h"
#include "CommandParserInterface.h"
#include "Export.h"

Go to the source code of this file.

Classes

class | SLNet::LogCommandParser
Adds the ability to send logging output to a remote console. More...
struct | SLNet::LogCommandParser::SystemAddressAndChannel
One of these structures is created per player. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains LogCommandParser , Used to send logs to connected consoles.

Definition in file LogCommandParser.h.

Class Documentation

struct SLNet::LogCommandParser::SystemAddressAndChannel

One of these structures is created per player.

Definition at line 109 of file LogCommandParser.h.

Class Members
unsigned | channels | Bitwise representations of the channels subscribed to. If bit 0 is set, then we subscribe to channelNames[0] and so on.
SystemAddress | systemAddress | The ID of the player.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/memoryoverride.h File Reference

  • include
  • slikenet
Namespaces | Functions | Variables
memoryoverride.h File Reference

If _USE_RAK_MEMORY_OVERRIDE is defined, memory allocations go through rakMalloc, rakRealloc, and rakFree. More...

#include "Export.h"
#include "defines.h"
#include <new>
#include "alloca.h"

Go to the source code of this file.

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Functions

void RAK_DLL_EXPORT | SetMalloc (void *(*userFunction)(size_t size))
void RAK_DLL_EXPORT | SetRealloc (void *(*userFunction)(void *p, size_t size))
void RAK_DLL_EXPORT | SetFree (void(*userFunction)(void *p))
void RAK_DLL_EXPORT | SetMalloc_Ex (void *(*userFunction)(size_t size, const char *file, unsigned int line))
void RAK_DLL_EXPORT | SetRealloc_Ex (void *(*userFunction)(void *p, size_t size, const char *file, unsigned int line))
void RAK_DLL_EXPORT | SetFree_Ex (void(*userFunction)(void *p, const char *file, unsigned int line))
void RAK_DLL_EXPORT | SetNotifyOutOfMemory (void(*userFunction)(const char *file, const long line))
void RAK_DLL_EXPORT | SetDLMallocMMap (void *(*userFunction)(size_t size))
void RAK_DLL_EXPORT | SetDLMallocDirectMMap (void *(*userFunction)(size_t size))
void RAK_DLL_EXPORT | SetDLMallocMUnmap (int(*userFunction)(void *ptr, size_t size))
template<class Type >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW (const char *file, unsigned int line)
template<class Type , class P1 >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_1 (const char *file, unsigned int line, const P1 &p1)
template<class Type , class P1 , class P2 >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_2 (const char *file, unsigned int line, const P1 &p1, const P2 &p2)
template<class Type , class P1 , class P2 , class P3 >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_3 (const char *file, unsigned int line, const P1 &p1, const P2 &p2, const P3 &p3)
template<class Type , class P1 , class P2 , class P3 , class P4 >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_4 (const char *file, unsigned int line, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
template<class Type >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_ARRAY (const int count, const char *file, unsigned int line)
template<class Type >
RAK_DLL_EXPORT void | SLNet::OP_DELETE (Type *buff, const char *file, unsigned int line)
template<class Type >
RAK_DLL_EXPORT void | SLNet::OP_DELETE_ARRAY (Type *buff, const char *file, unsigned int line)
void RAK_DLL_EXPORT * | SLNet::_RakMalloc (size_t size)
void RAK_DLL_EXPORT * | SLNet::_RakRealloc (void *p, size_t size)
void RAK_DLL_EXPORT | SLNet::_RakFree (void *p)
void RAK_DLL_EXPORT * | SLNet::_RakMalloc_Ex (size_t size, const char *file, unsigned int line)
void RAK_DLL_EXPORT * | SLNet::_RakRealloc_Ex (void *p, size_t size, const char *file, unsigned int line)
void RAK_DLL_EXPORT | SLNet::_RakFree_Ex (void *p, const char *file, unsigned int line)
void RAK_DLL_EXPORT * | SLNet::_DLMallocMMap (size_t size)
void RAK_DLL_EXPORT * | SLNet::_DLMallocDirectMMap (size_t size)
int RAK_DLL_EXPORT | SLNet::_DLMallocMUnmap (void *p, size_t size)
void | UseRaknetFixedHeap (size_t initialCapacity, void *(*yourMMapFunction)(size_t size)=SLNet::_DLMallocMMap, void *(*yourDirectMMapFunction)(size_t size)=SLNet::_DLMallocDirectMMap, int(*yourMUnmapFunction)(void *p, size_t size)=SLNet::_DLMallocMUnmap)
void | FreeRakNetFixedHeap (void)

Variables

RAK_DLL_EXPORT void *(* | rakMalloc )(size_t size)
RAK_DLL_EXPORT void *(* | rakRealloc )(void *p, size_t size)
RAK_DLL_EXPORT void(* | rakFree )(void *p)
RAK_DLL_EXPORT void *(* | rakMalloc_Ex )(size_t size, const char *file, unsigned int line)
RAK_DLL_EXPORT void *(* | rakRealloc_Ex )(void *p, size_t size, const char *file, unsigned int line)
RAK_DLL_EXPORT void(* | rakFree_Ex )(void *p, const char *file, unsigned int line)
RAK_DLL_EXPORT void(* | notifyOutOfMemory )(const char *file, const long line)
RAK_DLL_EXPORT void *(* | dlMallocMMap )(size_t size)
RAK_DLL_EXPORT void *(* | dlMallocDirectMMap )(size_t size)
RAK_DLL_EXPORT int(* | dlMallocMUnmap )(void *ptr, size_t size)
RAK_DLL_EXPORT void
*(*)(size_t size) 		GetMalloc ()
RAK_DLL_EXPORT void *(*)(void
*p, size_t size) 		GetRealloc ()
RAK_DLL_EXPORT void(*)(void *p) | GetFree ()
RAK_DLL_EXPORT void
*(*)(size_t size, const char
*file, unsigned int line) 		GetMalloc_Ex ()
RAK_DLL_EXPORT void *(*)(void
*p, size_t size, const char
*file, unsigned int line) 		GetRealloc_Ex ()
RAK_DLL_EXPORT void(*)(void *p,
const char *file, unsigned int
line) 		GetFree_Ex ()
RAK_DLL_EXPORT void
*(*)(size_t size) 		GetDLMallocMMap ()
RAK_DLL_EXPORT void
*(*)(size_t size) 		GetDLMallocDirectMMap ()
RAK_DLL_EXPORT int(*)(void
*ptr, size_t size) 		GetDLMallocMUnmap ()

Detailed Description

If _USE_RAK_MEMORY_OVERRIDE is defined, memory allocations go through rakMalloc, rakRealloc, and rakFree.

Definition in file memoryoverride.h.

Function Documentation

void FreeRakNetFixedHeap ( void )

Definition at line 293 of file RakMemoryOverride.cpp.

void RAK_DLL_EXPORT SetDLMallocDirectMMap ( void *(*)(size_t size) userFunction )

Definition at line 102 of file RakMemoryOverride.cpp.

References dlMallocDirectMMap.

void RAK_DLL_EXPORT SetDLMallocMMap ( void *(*)(size_t size) userFunction )

Definition at line 98 of file RakMemoryOverride.cpp.

References dlMallocMMap.

void RAK_DLL_EXPORT SetDLMallocMUnmap ( int(*)(void *ptr, size_t size) userFunction )

Definition at line 106 of file RakMemoryOverride.cpp.

References dlMallocMUnmap.

void RAK_DLL_EXPORT SetFree ( void(*)(void *p) userFunction )

Definition at line 78 of file RakMemoryOverride.cpp.

References rakFree.

void RAK_DLL_EXPORT SetFree_Ex ( void(*)(void *p, const char *file, unsigned int line) userFunction )

Definition at line 90 of file RakMemoryOverride.cpp.

References rakFree_Ex.

void RAK_DLL_EXPORT SetMalloc ( void *(*)(size_t size) userFunction )

Definition at line 70 of file RakMemoryOverride.cpp.

References rakMalloc.

void RAK_DLL_EXPORT SetMalloc_Ex ( void *(*)(size_t size, const char *file, unsigned int line) userFunction )

Definition at line 82 of file RakMemoryOverride.cpp.

References rakMalloc_Ex.

void RAK_DLL_EXPORT SetNotifyOutOfMemory ( void(*)(const char *file, const long line) userFunction )

Definition at line 94 of file RakMemoryOverride.cpp.

References notifyOutOfMemory.

void RAK_DLL_EXPORT SetRealloc ( void *(*)(void *p, size_t size) userFunction )

Definition at line 74 of file RakMemoryOverride.cpp.

References rakRealloc.

void RAK_DLL_EXPORT SetRealloc_Ex ( void *(*)(void *p, size_t size, const char *file, unsigned int line) userFunction )

Definition at line 86 of file RakMemoryOverride.cpp.

References rakRealloc_Ex.

void UseRaknetFixedHeap | ( | size_t | initialCapacity,
 |  | void *(*)(size_t size) | yourMMapFunction = SLNet::_DLMallocMMap,
 |  | void *(*)(size_t size) | yourDirectMMapFunction = SLNet::_DLMallocDirectMMap,
 |  | int(*)(void *p, size_t size) | yourMUnmapFunction = SLNet::_DLMallocMUnmap
 | ) |  |

Definition at line 283 of file RakMemoryOverride.cpp.

Variable Documentation

RAK_DLL_EXPORT void*(* dlMallocDirectMMap)(size_t size)

Definition at line 67 of file RakMemoryOverride.cpp.

Referenced by SetDLMallocDirectMMap().

RAK_DLL_EXPORT void*(* dlMallocMMap)(size_t size)

Definition at line 66 of file RakMemoryOverride.cpp.

Referenced by SetDLMallocMMap().

RAK_DLL_EXPORT int(* dlMallocMUnmap)(void *ptr, size_t size)

Definition at line 68 of file RakMemoryOverride.cpp.

Referenced by SetDLMallocMUnmap().

RAK_DLL_EXPORT void*(*)(size_t size) GetDLMallocDirectMMap()

Definition at line 138 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void*(*)(size_t size) GetDLMallocMMap()

Definition at line 134 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT int(*)(void* ptr, size_t size) GetDLMallocMUnmap()

Definition at line 142 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void(*)(void *p) GetFree()

Definition at line 118 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void(*)(void *p, const char *file, unsigned int line) GetFree_Ex()

Definition at line 130 of file RakMemoryOverride.cpp.

Referenced by SLNet::OP_DELETE(), and SLNet::OP_DELETE_ARRAY().

RAK_DLL_EXPORT void*(*)(size_t size) GetMalloc()

Definition at line 110 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void*(*)(size_t size, const char *file, unsigned int line) GetMalloc_Ex()

Definition at line 122 of file RakMemoryOverride.cpp.

Referenced by SLNet::OP_NEW(), SLNet::OP_NEW_1(), SLNet::OP_NEW_2(), SLNet::OP_NEW_3(), SLNet::OP_NEW_4(), and SLNet::OP_NEW_ARRAY().

RAK_DLL_EXPORT void*(*)(void *p, size_t size) GetRealloc()

Definition at line 114 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void*(*)(void *p, size_t size, const char *file, unsigned int line) GetRealloc_Ex()

Definition at line 126 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void(* notifyOutOfMemory)(const char *file, const long line)

Definition at line 65 of file RakMemoryOverride.cpp.

Referenced by SLNet::RakString::Assign(), SLNet::RakWString::operator+=(), SLNet::RakWString::operator=(), SLNet::ReliabilityLayer::Send(), SLNet::RakPeer::SendBuffered(), SLNet::RakPeer::SendBufferedList(), SLNet::PluginInterface2::SendListUnified(), and SetNotifyOutOfMemory().

RAK_DLL_EXPORT void(* rakFree)(void *p)

Definition at line 61 of file RakMemoryOverride.cpp.

Referenced by SetFree().

RAK_DLL_EXPORT void(* rakFree_Ex)(void *p, const char *file, unsigned int line)

Definition at line 64 of file RakMemoryOverride.cpp.

Referenced by SLNet::RakString::Assign(), DataStructures::Table::Cell::Cell(), DataStructures::ByteQueue::Clear(), DataStructures::MemoryPool< MemoryBlockType >::Clear(), DataStructures::Table::Cell::Clear(), SLNet::RakWString::Clear(), SLNet::CloudServer::CloudData::Clear(), SLNet::RakPeer::ClearBanList(), SLNet::RakPeer::ClearBufferedCommands(), SLNet::RakPeer::DeallocatePacket(), SLNet::PluginInterface2::DeallocPacketUnified(), SLNet::StringCompressor::DecodeString(), SLNet::RakWString::Deserialize(), SLNet::RakString::Free(), VariadicSQLParser::FreeArguments(), SLNet::HuffmanEncodingTree::FreeMemory(), SLNet::RakString::FreeMemoryNoMutex(), DataStructures::MemoryPool< MemoryBlockType >::InitPage(), SLNet::RakPeer::IsBanned(), DataStructures::Table::Cell::operator=(), SLNet::BitStream::ReadAlignedBytesSafeAlloc(), DataStructures::BytePool::Release(), DataStructures::MemoryPool< MemoryBlockType >::Release(), SLNet::RakPeer::RemoveFromBanList(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBufferedList(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendListUnified(), SLNet::RakWString::Serialize(), SetFree_Ex(), SLNet::BitStream::~BitStream(), SLNet::CloudServer::CloudData::~CloudData(), SLNet::RakWString::~RakWString(), SLNet::StringTable::~StringTable(), and SLNet::VariableListDeltaTracker::~VariableListDeltaTracker().

RAK_DLL_EXPORT void*(* rakMalloc)(size_t size)

Definition at line 59 of file RakMemoryOverride.cpp.

Referenced by SetMalloc().

RAK_DLL_EXPORT void*(* rakMalloc_Ex)(size_t size, const char *file, unsigned int line)

Definition at line 62 of file RakMemoryOverride.cpp.

Referenced by SLNet::BitStream::AddBitsAndReallocate(), SLNet::StringTable::AddString(), SLNet::RakPeer::AddToBanList(), DataStructures::BytePool::Allocate(), DataStructures::MemoryPool< MemoryBlockType >::Allocate(), SLNet::RakString::Allocate(), SLNet::PluginInterface2::AllocatePacketUnified(), SLNet::RakPeer::AllocPacket(), SLNet::BitStream::AssertCopyData(), Base64Encoding(), SLNet::BitStream::BitStream(), DataStructures::Table::Cell::Cell(), SLNet::BitStream::CopyData(), SLNet::StringCompressor::DecodeString(), SLNet::DataCompressor::DecompressAndAllocate(), SLNet::RakWString::Deserialize(), VariadicSQLParser::ExtractArguments(), DataStructures::MemoryPool< MemoryBlockType >::InitPage(), operator+(), SLNet::RakWString::operator+=(), SLNet::RakWString::operator=(), DataStructures::Table::Cell::operator=(), SLNet::BitStream::ReadAlignedBytesSafeAlloc(), SLNet::RakString::Realloc(), SLNet::RakPeer::SendBuffered(), SLNet::RakPeer::SendBufferedList(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendListUnified(), SLNet::RakWString::Serialize(), DataStructures::Table::Cell::Set(), SetMalloc_Ex(), and SLNet::VariableListDeltaTracker::VariableLastValueNode::VariableLastValueNode().

RAK_DLL_EXPORT void*(* rakRealloc)(void *p, size_t size)

Definition at line 60 of file RakMemoryOverride.cpp.

Referenced by SetRealloc().

RAK_DLL_EXPORT void*(* rakRealloc_Ex)(void *p, size_t size, const char *file, unsigned int line)

Definition at line 63 of file RakMemoryOverride.cpp.

Referenced by SLNet::BitStream::AddBitsAndReallocate(), SLNet::RakString::Assign(), SLNet::RakWString::operator+=(), SLNet::RakString::Realloc(), SetRealloc_Ex(), DataStructures::ByteQueue::WriteBytes(), and SLNet::VariableListDeltaTracker::WriteVar().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/MessageFilter.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Functions
MessageFilter.h File Reference

Message filter plugin. Assigns systems to FilterSets. Each FilterSet limits what messages are allowed. This is a security related plugin. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "PluginInterface2.h"
#include "DS_OrderedList.h"
#include "DS_Hash.h"
#include "Export.h"

Go to the source code of this file.

Classes

struct | SLNet::FilterSet
struct | SLNet::FilteredSystem
class | SLNet::MessageFilter
Assigns systems to FilterSets. Each FilterSet limits what kinds of messages are allowed. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define MESSAGE_FILTER_MAX_MESSAGE_ID 256
MessageIdentifier (ID_*) values shoudln't go higher than this. Change it if you do.

Functions

int RAK_DLL_EXPORT | SLNet::MessageFilterStrComp (char *const &key, char *const &data)
int RAK_DLL_EXPORT | SLNet::FilterSetComp (const int &key, FilterSet *const &data)

Detailed Description

Message filter plugin. Assigns systems to FilterSets. Each FilterSet limits what messages are allowed. This is a security related plugin.

Definition in file MessageFilter.h.

Class Documentation

struct SLNet::FilteredSystem

Definition at line 65 of file MessageFilter.h.

Class Members
FilterSet * | filter
TimeMS | timeEnteredThisSet

Macro Definition Documentation

#define MESSAGE_FILTER_MAX_MESSAGE_ID 256

MessageIdentifier (ID_*) values shoudln't go higher than this. Change it if you do.

Definition at line 33 of file MessageFilter.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/MessageIdentifiers.h File Reference

  • include
  • slikenet
Enumerations
MessageIdentifiers.h File Reference

All the message identifiers used by RakNet. Message identifiers comprise the first byte of any message. More...

Go to the source code of this file.

Enumerations

enum OutOfBandIdentifiers {
ID_NAT_ESTABLISH_UNIDIRECTIONAL, ID_NAT_ESTABLISH_BIDIRECTIONAL, ID_NAT_TYPE_DETECT, ID_ROUTER_2_REPLY_TO_SENDER_PORT,
ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT, ID_ROUTER_2_MINI_PUNCH_REPLY, ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE, ID_XBOX_360_VOICE,
ID_XBOX_360_GET_NETWORK_ROOM, ID_XBOX_360_RETURN_NETWORK_ROOM, ID_NAT_PING, ID_NAT_PONG
}
enum DefaultMessageIDTypes {
ID_CONNECTED_PING, ID_UNCONNECTED_PING, ID_UNCONNECTED_PING_OPEN_CONNECTIONS, ID_CONNECTED_PONG,
ID_DETECT_LOST_CONNECTIONS, ID_OPEN_CONNECTION_REQUEST_1, ID_OPEN_CONNECTION_REPLY_1, ID_OPEN_CONNECTION_REQUEST_2,
ID_OPEN_CONNECTION_REPLY_2, ID_CONNECTION_REQUEST, ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY, ID_OUR_SYSTEM_REQUIRES_SECURITY,
ID_PUBLIC_KEY_MISMATCH, ID_OUT_OF_BAND_INTERNAL, ID_SND_RECEIPT_ACKED, ID_SND_RECEIPT_LOSS,
ID_CONNECTION_REQUEST_ACCEPTED, ID_CONNECTION_ATTEMPT_FAILED, ID_ALREADY_CONNECTED, ID_NEW_INCOMING_CONNECTION,
ID_NO_FREE_INCOMING_CONNECTIONS, ID_DISCONNECTION_NOTIFICATION, ID_CONNECTION_LOST, ID_CONNECTION_BANNED,
ID_INVALID_PASSWORD, ID_INCOMPATIBLE_PROTOCOL_VERSION, ID_IP_RECENTLY_CONNECTED, ID_TIMESTAMP,
ID_UNCONNECTED_PONG, ID_ADVERTISE_SYSTEM, ID_DOWNLOAD_PROGRESS, ID_REMOTE_DISCONNECTION_NOTIFICATION,
ID_REMOTE_CONNECTION_LOST, ID_REMOTE_NEW_INCOMING_CONNECTION, ID_FILE_LIST_TRANSFER_HEADER, ID_FILE_LIST_TRANSFER_FILE,
ID_FILE_LIST_REFERENCE_PUSH_ACK, ID_DDT_DOWNLOAD_REQUEST, ID_TRANSPORT_STRING, ID_REPLICA_MANAGER_CONSTRUCTION,
ID_REPLICA_MANAGER_SCOPE_CHANGE, ID_REPLICA_MANAGER_SERIALIZE, ID_REPLICA_MANAGER_DOWNLOAD_STARTED, ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE,
ID_RAKVOICE_OPEN_CHANNEL_REQUEST, ID_RAKVOICE_OPEN_CHANNEL_REPLY, ID_RAKVOICE_CLOSE_CHANNEL, ID_RAKVOICE_DATA,
ID_AUTOPATCHER_GET_CHANGELIST_SINCE_DATE, ID_AUTOPATCHER_CREATION_LIST, ID_AUTOPATCHER_DELETION_LIST, ID_AUTOPATCHER_GET_PATCH,
ID_AUTOPATCHER_PATCH_LIST, ID_AUTOPATCHER_REPOSITORY_FATAL_ERROR, ID_AUTOPATCHER_CANNOT_DOWNLOAD_ORIGINAL_UNMODIFIED_FILES, ID_AUTOPATCHER_FINISHED_INTERNAL,
ID_AUTOPATCHER_FINISHED, ID_AUTOPATCHER_RESTART_APPLICATION, ID_NAT_PUNCHTHROUGH_REQUEST, ID_NAT_CONNECT_AT_TIME,
ID_NAT_GET_MOST_RECENT_PORT, ID_NAT_CLIENT_READY, ID_NAT_TARGET_NOT_CONNECTED, ID_NAT_TARGET_UNRESPONSIVE,
ID_NAT_CONNECTION_TO_TARGET_LOST, ID_NAT_ALREADY_IN_PROGRESS, ID_NAT_PUNCHTHROUGH_FAILED, ID_NAT_PUNCHTHROUGH_SUCCEEDED,
ID_READY_EVENT_SET, ID_READY_EVENT_UNSET, ID_READY_EVENT_ALL_SET, ID_READY_EVENT_QUERY,
ID_LOBBY_GENERAL, ID_RPC_REMOTE_ERROR, ID_RPC_PLUGIN, ID_FILE_LIST_REFERENCE_PUSH,
ID_READY_EVENT_FORCE_ALL_SET, ID_ROOMS_EXECUTE_FUNC, ID_ROOMS_LOGON_STATUS, ID_ROOMS_HANDLE_CHANGE,
ID_LOBBY2_SEND_MESSAGE, ID_LOBBY2_SERVER_ERROR, ID_FCM2_NEW_HOST, ID_FCM2_REQUEST_FCMGUID,
ID_FCM2_RESPOND_CONNECTION_COUNT, ID_FCM2_INFORM_FCMGUID, ID_FCM2_UPDATE_MIN_TOTAL_CONNECTION_COUNT, ID_FCM2_VERIFIED_JOIN_START,
ID_FCM2_VERIFIED_JOIN_CAPABLE, ID_FCM2_VERIFIED_JOIN_FAILED, ID_FCM2_VERIFIED_JOIN_ACCEPTED, ID_FCM2_VERIFIED_JOIN_REJECTED,
ID_UDP_PROXY_GENERAL, ID_SQLite3_EXEC, ID_SQLite3_UNKNOWN_DB, ID_SQLLITE_LOGGER,
ID_NAT_TYPE_DETECTION_REQUEST, ID_NAT_TYPE_DETECTION_RESULT, ID_ROUTER_2_INTERNAL, ID_ROUTER_2_FORWARDING_NO_PATH,
ID_ROUTER_2_FORWARDING_ESTABLISHED, ID_ROUTER_2_REROUTED, ID_TEAM_BALANCER_INTERNAL, ID_TEAM_BALANCER_REQUESTED_TEAM_FULL,
ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED, ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED, ID_TEAM_BALANCER_TEAM_ASSIGNED, ID_LIGHTSPEED_INTEGRATION,
ID_XBOX_LOBBY, ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS, ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS, ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE,
ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE, ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT, ID_TWO_WAY_AUTHENTICATION_NEGOTIATION, ID_CLOUD_POST_REQUEST,
ID_CLOUD_RELEASE_REQUEST, ID_CLOUD_GET_REQUEST, ID_CLOUD_GET_RESPONSE, ID_CLOUD_UNSUBSCRIBE_REQUEST,
ID_CLOUD_SERVER_TO_SERVER_COMMAND, ID_CLOUD_SUBSCRIPTION_NOTIFICATION, ID_LIB_VOICE, ID_RELAY_PLUGIN,
ID_NAT_REQUEST_BOUND_ADDRESSES, ID_NAT_RESPOND_BOUND_ADDRESSES, ID_FCM2_UPDATE_USER_CONTEXT, ID_RESERVED_3,
ID_RESERVED_4, ID_RESERVED_5, ID_RESERVED_6, ID_RESERVED_7,
ID_RESERVED_8, ID_RESERVED_9, ID_USER_PACKET_ENUM
}

Detailed Description

All the message identifiers used by RakNet. Message identifiers comprise the first byte of any message.

Definition in file MessageIdentifiers.h.

Enumeration Type Documentation

enum DefaultMessageIDTypes

You should not edit the file MessageIdentifiers.h as it is a part of RakNet static library To define your own message id, define an enum following the code example that follows.

enum {
ID_MYPROJECT_MSG_1 = ID_USER_PACKET_ENUM,
ID_MYPROJECT_MSG_2,
...
};
Note
All these enumerations should be casted to (unsigned char) before writing them to SLNet::BitStream
Enumerator:
ID_CONNECTED_PING

These types are never returned to the user. Ping from a connected system. Update timestamps (internal use only)

ID_UNCONNECTED_PING

Ping from an unconnected system. Reply but do not update timestamps. (internal use only)

ID_UNCONNECTED_PING_OPEN_CONNECTIONS

Ping from an unconnected system. Only reply if we have open connections. Do not update timestamps. (internal use only)

ID_CONNECTED_PONG

Pong from a connected system. Update timestamps (internal use only)

ID_DETECT_LOST_CONNECTIONS

A reliable packet to detect lost connections (internal use only)

ID_OPEN_CONNECTION_REQUEST_1

C2S: Initial query: Header(1), OfflineMesageID(16), Protocol number(1), Pad(toMTU), sent with no fragment set. If protocol fails on server, returns ID_INCOMPATIBLE_PROTOCOL_VERSION to client

ID_OPEN_CONNECTION_REPLY_1

S2C: Header(1), OfflineMesageID(16), server GUID(8), HasSecurity(1), Cookie(4, if HasSecurity) , public key (if do security is true), MTU(2). If public key fails on client, returns ID_PUBLIC_KEY_MISMATCH

ID_OPEN_CONNECTION_REQUEST_2

C2S: Header(1), OfflineMesageID(16), Cookie(4, if HasSecurity is true on the server), clientSupportsSecurity(1 bit), handshakeChallenge (if has security on both server and client), remoteBindingAddress(6), MTU(2), client GUID(8) Connection slot allocated if cookie is valid, server is not full, GUID and IP not already in use.

ID_OPEN_CONNECTION_REPLY_2

S2C: Header(1), OfflineMesageID(16), server GUID(8), mtu(2), doSecurity(1 bit), handshakeAnswer (if do security is true)

ID_CONNECTION_REQUEST

C2S: Header(1), GUID(8), Timestamp, HasSecurity(1), Proof(32)

ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY

RakPeer - Remote system requires secure connections, pass a public key to RakPeerInterface::Connect()

ID_OUR_SYSTEM_REQUIRES_SECURITY

RakPeer - We passed a public key to RakPeerInterface::Connect(), but the other system did not have security turned on.

ID_PUBLIC_KEY_MISMATCH

RakPeer - Wrong public key passed to RakPeerInterface::Connect()

ID_OUT_OF_BAND_INTERNAL

RakPeer - Same as ID_ADVERTISE_SYSTEM, but intended for internal use rather than being passed to the user. Second byte indicates type. Used currently for NAT punchthrough for receiver port advertisement. See ID_NAT_ADVERTISE_RECIPIENT_PORT

ID_SND_RECEIPT_ACKED

If RakPeerInterface::Send() is called where PacketReliability contains _WITH_ACK_RECEIPT, then on a later call to RakPeerInterface::Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS. The message will be 5 bytes long, and bytes 1-4 inclusive will contain a number in native order containing a number that identifies this message. This number will be returned by RakPeerInterface::Send() or RakPeerInterface::SendList(). ID_SND_RECEIPT_ACKED means that the message arrived

ID_SND_RECEIPT_LOSS

If RakPeerInterface::Send() is called where PacketReliability contains UNRELIABLE_WITH_ACK_RECEIPT, then on a later call to RakPeerInterface::Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS. The message will be 5 bytes long, and bytes 1-4 inclusive will contain a number in native order containing a number that identifies this message. This number will be returned by RakPeerInterface::Send() or RakPeerInterface::SendList(). ID_SND_RECEIPT_LOSS means that an ack for the message did not arrive (it may or may not have been delivered, probably not). On disconnect or shutdown, you will not get ID_SND_RECEIPT_LOSS for unsent messages, you should consider those messages as all lost.

ID_CONNECTION_REQUEST_ACCEPTED

RakPeer - In a client/server environment, our connection request to the server has been accepted.

ID_CONNECTION_ATTEMPT_FAILED

RakPeer - Sent to the player when a connection request cannot be completed due to inability to connect.

ID_ALREADY_CONNECTED

RakPeer - Sent a connect request to a system we are currently connected to.

ID_NEW_INCOMING_CONNECTION

RakPeer - A remote system has successfully connected.

ID_NO_FREE_INCOMING_CONNECTIONS

RakPeer - The system we attempted to connect to is not accepting new connections.

ID_DISCONNECTION_NOTIFICATION

RakPeer - The system specified in Packet::systemAddress has disconnected from us. For the client, this would mean the server has shutdown.

ID_CONNECTION_LOST

RakPeer - Reliable packets cannot be delivered to the system specified in Packet::systemAddress. The connection to that system has been closed.

ID_CONNECTION_BANNED

RakPeer - We are banned from the system we attempted to connect to.

ID_INVALID_PASSWORD

RakPeer - The remote system is using a password and has refused our connection because we did not set the correct password.

ID_INCOMPATIBLE_PROTOCOL_VERSION
ID_IP_RECENTLY_CONNECTED

RakPeer::SetLimitIPConnectionFrequency()

ID_TIMESTAMP

RakPeer - The sizeof(RakNetTime) bytes following this byte represent a value which is automatically modified by the difference in system times between the sender and the recipient. Requires that you call SetOccasionalPing.

ID_UNCONNECTED_PONG

RakPeer - Pong from an unconnected system. First byte is ID_UNCONNECTED_PONG, second sizeof(SLNet::TimeMS) bytes is the ping, following bytes is system specific enumeration data. Read using bitstreams

ID_ADVERTISE_SYSTEM

RakPeer - Inform a remote system of our IP/Port. On the recipient, all data past ID_ADVERTISE_SYSTEM is whatever was passed to the data parameter

ID_DOWNLOAD_PROGRESS

partTotal (unsigned int), partLength (unsigned int), first part data (length <= MAX_MTU_SIZE). See the three parameters partCount, partTotal and partLength in OnFileProgress in FileListTransferCBInterface.h

ID_REMOTE_DISCONNECTION_NOTIFICATION

ConnectionGraph2 plugin - In a client/server environment, a client other than ourselves has disconnected gracefully. Packet::systemAddress is modified to reflect the systemAddress of this client.

ID_REMOTE_CONNECTION_LOST

ConnectionGraph2 plugin - In a client/server environment, a client other than ourselves has been forcefully dropped. Packet::systemAddress is modified to reflect the systemAddress of this client.

ID_REMOTE_NEW_INCOMING_CONNECTION

ConnectionGraph2 plugin: Bytes 1-4 = count. for (count items) contains {SystemAddress, RakNetGUID, 2 byte ping}.

ID_FILE_LIST_TRANSFER_HEADER

FileListTransfer plugin - Setup data.

ID_FILE_LIST_TRANSFER_FILE

FileListTransfer plugin - A file.

ID_FILE_LIST_REFERENCE_PUSH_ACK
ID_DDT_DOWNLOAD_REQUEST

DirectoryDeltaTransfer plugin - Request from a remote system for a download of a directory.

ID_TRANSPORT_STRING

RakNetTransport plugin - Transport provider message, used for remote console.

ID_REPLICA_MANAGER_CONSTRUCTION

ReplicaManager plugin - Create an object.

ID_REPLICA_MANAGER_SCOPE_CHANGE

ReplicaManager plugin - Changed scope of an object.

ID_REPLICA_MANAGER_SERIALIZE

ReplicaManager plugin - Serialized data of an object.

ID_REPLICA_MANAGER_DOWNLOAD_STARTED

ReplicaManager plugin - New connection, about to send all world objects.

ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE

ReplicaManager plugin - Finished downloading all serialized objects.

ID_RAKVOICE_OPEN_CHANNEL_REQUEST

RakVoice plugin - Open a communication channel.

ID_RAKVOICE_OPEN_CHANNEL_REPLY

RakVoice plugin - Communication channel accepted.

ID_RAKVOICE_CLOSE_CHANNEL

RakVoice plugin - Close a communication channel.

ID_RAKVOICE_DATA

RakVoice plugin - Voice data.

ID_AUTOPATCHER_GET_CHANGELIST_SINCE_DATE

Autopatcher plugin - Get a list of files that have changed since a certain date.

ID_AUTOPATCHER_CREATION_LIST

Autopatcher plugin - A list of files to create.

ID_AUTOPATCHER_DELETION_LIST

Autopatcher plugin - A list of files to delete.

ID_AUTOPATCHER_GET_PATCH

Autopatcher plugin - A list of files to get patches for.

ID_AUTOPATCHER_PATCH_LIST

Autopatcher plugin - A list of patches for a list of files.

ID_AUTOPATCHER_REPOSITORY_FATAL_ERROR

Autopatcher plugin - Returned to the user: An error from the database repository for the autopatcher.

ID_AUTOPATCHER_CANNOT_DOWNLOAD_ORIGINAL_UNMODIFIED_FILES

Autopatcher plugin - Returned to the user: The server does not allow downloading unmodified game files.

ID_AUTOPATCHER_FINISHED_INTERNAL

Autopatcher plugin - Finished getting all files from the autopatcher.

ID_AUTOPATCHER_FINISHED
ID_AUTOPATCHER_RESTART_APPLICATION

Autopatcher plugin - Returned to the user: You must restart the application to finish patching.

ID_NAT_PUNCHTHROUGH_REQUEST

NATPunchthrough plugin: internal.

ID_NAT_CONNECT_AT_TIME

NATPunchthrough plugin: internal.

NATPunchthrough plugin: internal NATPunchthrough plugin: internal

ID_NAT_GET_MOST_RECENT_PORT

NATPunchthrough plugin: internal.

ID_NAT_CLIENT_READY

NATPunchthrough plugin: internal.

ID_NAT_TARGET_NOT_CONNECTED

NATPunchthrough plugin: internal.

NATPunchthrough plugin: Destination system is not connected to the server. Bytes starting at offset 1 contains the RakNetGUID destination field of NatPunchthroughClient::OpenNAT().

ID_NAT_TARGET_UNRESPONSIVE

NATPunchthrough plugin: Destination system is not responding to ID_NAT_GET_MOST_RECENT_PORT. Possibly the plugin is not installed. Bytes starting at offset 1 contains the RakNetGUID destination field of NatPunchthroughClient::OpenNAT().

ID_NAT_CONNECTION_TO_TARGET_LOST

NATPunchthrough plugin: The server lost the connection to the destination system while setting up punchthrough. Possibly the plugin is not installed. Bytes starting at offset 1 contains the RakNetGUID destination field of NatPunchthroughClient::OpenNAT().

ID_NAT_ALREADY_IN_PROGRESS

NATPunchthrough plugin: This punchthrough is already in progress. Possibly the plugin is not installed. Bytes starting at offset 1 contains the RakNetGUID destination field of NatPunchthroughClient::OpenNAT().

ID_NAT_PUNCHTHROUGH_FAILED

NATPunchthrough plugin: This message is generated on the local system, and does not come from the network. packet::guid contains the destination field of NatPunchthroughClient::OpenNAT(). Byte 1 contains 1 if you are the sender, 0 if not

ID_NAT_PUNCHTHROUGH_SUCCEEDED

NATPunchthrough plugin: Punchthrough succeeded. See packet::systemAddress and packet::guid. Byte 1 contains 1 if you are the sender, 0 if not. You can now use RakPeer::Connect() or other calls to communicate with this system.

ID_READY_EVENT_SET

ReadyEvent plugin - Set the ready state for a particular system First 4 bytes after the message contains the id

ID_READY_EVENT_UNSET

ReadyEvent plugin - Unset the ready state for a particular system First 4 bytes after the message contains the id

ID_READY_EVENT_ALL_SET

All systems are in state ID_READY_EVENT_SET First 4 bytes after the message contains the id

ID_READY_EVENT_QUERY
ID_LOBBY_GENERAL

Lobby packets. Second byte indicates type.

ID_RPC_REMOTE_ERROR
ID_RPC_PLUGIN

Plugin based replacement for RPC system.

ID_FILE_LIST_REFERENCE_PUSH

FileListTransfer transferring large files in chunks that are read only when needed, to save memory.

ID_READY_EVENT_FORCE_ALL_SET

Force the ready event to all set.

ID_ROOMS_EXECUTE_FUNC

Rooms function.

ID_ROOMS_LOGON_STATUS
ID_ROOMS_HANDLE_CHANGE
ID_LOBBY2_SEND_MESSAGE

Lobby2 message.

ID_LOBBY2_SERVER_ERROR
ID_FCM2_NEW_HOST

Informs user of a new host GUID. Packet::Guid contains this new host RakNetGuid. The old host can be read out using BitStream->Read(RakNetGuid) starting on byte 1 This is not returned until connected to a remote system If the oldHost is UNASSIGNED_RAKNET_GUID, then this is the first time the host has been determined

ID_FCM2_REQUEST_FCMGUID
ID_FCM2_RESPOND_CONNECTION_COUNT
ID_FCM2_INFORM_FCMGUID
ID_FCM2_UPDATE_MIN_TOTAL_CONNECTION_COUNT
ID_FCM2_VERIFIED_JOIN_START

A remote system (not necessarily the host) called FullyConnectedMesh2::StartVerifiedJoin() with our system as the client Use FullyConnectedMesh2::GetVerifiedJoinRequiredProcessingList() to read systems For each system, attempt NatPunchthroughClient::OpenNAT() and/or RakPeerInterface::Connect() When this has been done for all systems, the remote system will automatically be informed of the results

Note
Only the designated client gets this message
You won't get this message if you are already connected to all target systems
If you fail to connect to a system, this does not automatically mean you will get ID_FCM2_VERIFIED_JOIN_FAILED as that system may have been shutting down from the host too
See Also
FullyConnectedMesh2::StartVerifiedJoin()
ID_FCM2_VERIFIED_JOIN_CAPABLE
ID_FCM2_VERIFIED_JOIN_FAILED

Client failed to connect to a required systems notified via FullyConnectedMesh2::StartVerifiedJoin() RakPeerInterface::CloseConnection() was automatically called for all systems connected due to ID_FCM2_VERIFIED_JOIN_START Programmer should inform the player via the UI that they cannot join this session, and to choose a different session

Note
Server normally sends us this message, however if connection to the server was lost, message will be returned locally
Only the designated client gets this message
ID_FCM2_VERIFIED_JOIN_ACCEPTED

The system that called StartVerifiedJoin() got ID_FCM2_VERIFIED_JOIN_CAPABLE from the client and then called RespondOnVerifiedJoinCapable() with true AddParticipant() has automatically been called for this system Use GetVerifiedJoinAcceptedAdditionalData() to read any additional data passed to RespondOnVerifiedJoinCapable()

Note
All systems in the mesh get this message
See Also
RespondOnVerifiedJoinCapable()
ID_FCM2_VERIFIED_JOIN_REJECTED

The system that called StartVerifiedJoin() got ID_FCM2_VERIFIED_JOIN_CAPABLE from the client and then called RespondOnVerifiedJoinCapable() with false CloseConnection() has been automatically called for each system connected to since ID_FCM2_VERIFIED_JOIN_START. The connection is NOT automatically closed to the original host that sent StartVerifiedJoin() Use GetVerifiedJoinRejectedAdditionalData() to read any additional data passed to RespondOnVerifiedJoinCapable()

Note
Only the designated client gets this message
See Also
RespondOnVerifiedJoinCapable()
ID_UDP_PROXY_GENERAL

UDP proxy messages. Second byte indicates type.

ID_SQLite3_EXEC

SQLite3Plugin - execute.

ID_SQLite3_UNKNOWN_DB

SQLite3Plugin - Remote database is unknown.

ID_SQLLITE_LOGGER

Events happening with SQLiteClientLoggerPlugin.

ID_NAT_TYPE_DETECTION_REQUEST

Sent to NatTypeDetectionServer.

ID_NAT_TYPE_DETECTION_RESULT

Sent to NatTypeDetectionClient. Byte 1 contains the type of NAT detected.

ID_ROUTER_2_INTERNAL

Used by the router2 plugin.

ID_ROUTER_2_FORWARDING_NO_PATH

No path is available or can be established to the remote system Packet::guid contains the endpoint guid that we were trying to reach

ID_ROUTER_2_FORWARDING_ESTABLISHED

You can now call connect, ping, or other operations to the destination system.

Connect as follows:

SLNet::BitStream bs(packet->data, packet->length, false); bs.IgnoreBytes(sizeof(MessageID)); RakNetGUID endpointGuid; bs.Read(endpointGuid); unsigned short sourceToDestPort; bs.Read(sourceToDestPort); char ipAddressString[32]; packet->systemAddress.ToString(false, ipAddressString); rakPeerInterface->Connect(ipAddressString, sourceToDestPort, 0,0);

ID_ROUTER_2_REROUTED

The IP address for a forwarded connection has changed Read endpointGuid and port as per ID_ROUTER_2_FORWARDING_ESTABLISHED

ID_TEAM_BALANCER_INTERNAL
ID_TEAM_BALANCER_REQUESTED_TEAM_FULL

Cannot switch to the desired team because it is full. However, if someone on that team leaves, you will get ID_TEAM_BALANCER_TEAM_ASSIGNED later. For TeamBalancer: Byte 1 contains the team you requested to join. Following bytes contain NetworkID of which member

ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED

Cannot switch to the desired team because all teams are locked. However, if someone on that team leaves, you will get ID_TEAM_BALANCER_SET_TEAM later. For TeamBalancer: Byte 1 contains the team you requested to join.

ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED
ID_TEAM_BALANCER_TEAM_ASSIGNED

Team balancer plugin informing you of your team. Byte 1 contains the team you requested to join. Following bytes contain NetworkID of which member.

ID_LIGHTSPEED_INTEGRATION

Gamebryo Lightspeed integration.

ID_XBOX_LOBBY

XBOX integration.

ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS

The password we used to challenge the other system passed, meaning the other system has called TwoWayAuthentication::AddPassword() with the same password we passed to TwoWayAuthentication::Challenge() You can read the identifier used to challenge as follows: SLNet::BitStream bs(packet->data, packet->length, false); bs.IgnoreBytes(sizeof(SLNet::MessageID)); SLNet::RakString password; bs.Read(password);

ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS
ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE

A remote system sent us a challenge using TwoWayAuthentication::Challenge(), and the challenge failed. If the other system must pass the challenge to stay connected, you should call RakPeer::CloseConnection() to terminate the connection to the other system.

ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE

The other system did not add the password we used to TwoWayAuthentication::AddPassword() You can read the identifier used to challenge as follows: SLNet::BitStream bs(packet->data, packet->length, false); bs.IgnoreBytes(sizeof(MessageID)); SLNet::RakString password; bs.Read(password);

ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT

The other system did not respond within a timeout threshhold. Either the other system is not running the plugin or the other system was blocking on some operation for a long time. You can read the identifier used to challenge as follows: SLNet::BitStream bs(packet->data, packet->length, false); bs.IgnoreBytes(sizeof(MessageID)); SLNet::RakString password; bs.Read(password);

ID_TWO_WAY_AUTHENTICATION_NEGOTIATION
ID_CLOUD_POST_REQUEST

CloudClient / CloudServer.

ID_CLOUD_RELEASE_REQUEST
ID_CLOUD_GET_REQUEST
ID_CLOUD_GET_RESPONSE
ID_CLOUD_UNSUBSCRIBE_REQUEST
ID_CLOUD_SERVER_TO_SERVER_COMMAND
ID_CLOUD_SUBSCRIPTION_NOTIFICATION
ID_LIB_VOICE
ID_RELAY_PLUGIN
ID_NAT_REQUEST_BOUND_ADDRESSES
ID_NAT_RESPOND_BOUND_ADDRESSES
ID_FCM2_UPDATE_USER_CONTEXT
ID_RESERVED_3
ID_RESERVED_4
ID_RESERVED_5
ID_RESERVED_6
ID_RESERVED_7
ID_RESERVED_8
ID_RESERVED_9
ID_USER_PACKET_ENUM

Definition at line 56 of file MessageIdentifiers.h.

enum OutOfBandIdentifiers
Enumerator:
ID_NAT_ESTABLISH_UNIDIRECTIONAL
ID_NAT_ESTABLISH_BIDIRECTIONAL
ID_NAT_TYPE_DETECT
ID_ROUTER_2_REPLY_TO_SENDER_PORT
ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT
ID_ROUTER_2_MINI_PUNCH_REPLY
ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE
ID_XBOX_360_VOICE
ID_XBOX_360_GET_NETWORK_ROOM
ID_XBOX_360_RETURN_NETWORK_ROOM
ID_NAT_PING
ID_NAT_PONG

Definition at line 28 of file MessageIdentifiers.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/MTUSize.h File Reference

  • include
  • slikenet
Macros
MTUSize.h File Reference

[Internal] Defines the default maximum transfer unit. More...

Go to the source code of this file.

Macros

#define | MAXIMUM_MTU_SIZE 1492
#define | MINIMUM_MTU_SIZE 400

Detailed Description

[Internal] Defines the default maximum transfer unit.

Definition in file MTUSize.h.

Macro Definition Documentation

#define MAXIMUM_MTU_SIZE 1492
  • 17914 16 Mbit/Sec Token Ring
  • 4464 4 Mbits/Sec Token Ring
  • 4352 FDDI
  • 1500. The largest Ethernet packet size recommended. This is the typical setting for non-PPPoE, non-VPN connections. The default value for NETGEAR routers, adapters and switches.
  • 1492. The size PPPoE prefers.
  • 1472. Maximum size to use for pinging. (Bigger packets are fragmented.)
  • 1468. The size DHCP prefers.
  • 1460. Usable by AOL if you don't have large email attachments, etc.
  • 1430. The size VPN and PPTP prefer.
  • 1400. Maximum size for AOL DSL.
  • 576. Typical value to connect to dial-up ISPs. The largest value for an UDP datagram

Definition at line 33 of file MTUSize.h.

Referenced by SLNet::RakPeer::AssignSystemAddressToRemoteSystemList(), SLNet::RakPeer::CloseConnectionInternal(), SLNet::ProcessOfflineNetworkPacket(), RAK_THREAD_DECLARATION(), SLNet::RakPeer::RunUpdateCycle(), SLNet::ReliabilityLayer::Send(), SLNet::RakPeer::Shutdown(), and SLNet::ReliabilityLayer::Update().

#define MINIMUM_MTU_SIZE 400

Definition at line 36 of file MTUSize.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NativeFeatureIncludes.h File Reference

  • include
  • slikenet
Macros
NativeFeatureIncludes.h File Reference
#include "NativeFeatureIncludesOverrides.h"

Go to the source code of this file.

Macros

#define | LIBCAT_SECURITY 0
#define | _RAKNET_SUPPORT_ConnectionGraph2 1
#define | _RAKNET_SUPPORT_DirectoryDeltaTransfer 1
#define | _RAKNET_SUPPORT_FileListTransfer 1
#define | _RAKNET_SUPPORT_FullyConnectedMesh 1
#define | _RAKNET_SUPPORT_FullyConnectedMesh2 1
#define | _RAKNET_SUPPORT_MessageFilter 1
#define | _RAKNET_SUPPORT_NatPunchthroughClient 1
#define | _RAKNET_SUPPORT_NatPunchthroughServer 1
#define | _RAKNET_SUPPORT_NatTypeDetectionClient 1
#define | _RAKNET_SUPPORT_NatTypeDetectionServer 1
#define | _RAKNET_SUPPORT_PacketLogger 1
#define | _RAKNET_SUPPORT_ReadyEvent 1
#define | _RAKNET_SUPPORT_ReplicaManager3 1
#define | _RAKNET_SUPPORT_Router2 1
#define | _RAKNET_SUPPORT_RPC4Plugin 1
#define | _RAKNET_SUPPORT_TeamBalancer 1
#define | _RAKNET_SUPPORT_TeamManager 1
#define | _RAKNET_SUPPORT_UDPProxyClient 1
#define | _RAKNET_SUPPORT_UDPProxyCoordinator 1
#define | _RAKNET_SUPPORT_UDPProxyServer 1
#define | _RAKNET_SUPPORT_ConsoleServer 1
#define | _RAKNET_SUPPORT_RakNetTransport 1
#define | _RAKNET_SUPPORT_TelnetTransport 1
#define | _RAKNET_SUPPORT_TCPInterface 1
#define | _RAKNET_SUPPORT_LogCommandParser 1
#define | _RAKNET_SUPPORT_RakNetCommandParser 1
#define | _RAKNET_SUPPORT_EmailSender 1
#define | _RAKNET_SUPPORT_HTTPConnection 1
#define | _RAKNET_SUPPORT_HTTPConnection2 1
#define | _RAKNET_SUPPORT_PacketizedTCP 1
#define | _RAKNET_SUPPORT_TwoWayAuthentication 1
#define | _RAKNET_SUPPORT_CloudClient 1
#define | _RAKNET_SUPPORT_CloudServer 1
#define | _RAKNET_SUPPORT_DynDNS 1
#define | _RAKNET_SUPPORT_Rackspace 1
#define | _RAKNET_SUPPORT_FileOperations 1
#define | _RAKNET_SUPPORT_UDPForwarder 1
#define | _RAKNET_SUPPORT_StatisticsHistory 1
#define | _RAKNET_SUPPORT_LibVoice 0
#define | _RAKNET_SUPPORT_RelayPlugin 1
#define | _RAKNET_SUPPORT_FileListTransfer 1
#define | _RAKNET_SUPPORT_ConnectionGraph2 1
#define | _RAKNET_SUPPORT_PacketizedTCP 1
#define | _RAKNET_SUPPORT_TCPInterface 1

Macro Definition Documentation

#define _RAKNET_SUPPORT_CloudClient 1

Definition at line 150 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_CloudServer 1

Definition at line 153 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_ConnectionGraph2 1

Definition at line 184 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_ConnectionGraph2 1

Definition at line 184 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_ConsoleServer 1

Definition at line 117 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_DirectoryDeltaTransfer 1

Definition at line 60 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_DynDNS 1

Definition at line 156 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_EmailSender 1

Definition at line 135 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_FileListTransfer 1

Definition at line 180 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_FileListTransfer 1

Definition at line 180 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_FileOperations 1

Definition at line 162 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_FullyConnectedMesh 1

Definition at line 66 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_FullyConnectedMesh2 1

Definition at line 69 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_HTTPConnection 1

Definition at line 138 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_HTTPConnection2 1

Definition at line 141 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_LibVoice 0

Definition at line 171 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_LogCommandParser 1

Definition at line 129 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_MessageFilter 1

Definition at line 72 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_NatPunchthroughClient 1

Definition at line 75 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_NatPunchthroughServer 1

Definition at line 78 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_NatTypeDetectionClient 1

Definition at line 81 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_NatTypeDetectionServer 1

Definition at line 84 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_PacketizedTCP 1

Definition at line 188 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_PacketizedTCP 1

Definition at line 188 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_PacketLogger 1

Definition at line 87 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_Rackspace 1

Definition at line 159 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_RakNetCommandParser 1

Definition at line 132 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_RakNetTransport 1

Definition at line 120 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_ReadyEvent 1

Definition at line 90 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_RelayPlugin 1

Definition at line 174 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_ReplicaManager3 1

Definition at line 93 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_Router2 1

Definition at line 96 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_RPC4Plugin 1

Definition at line 99 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_StatisticsHistory 1

Definition at line 168 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_TCPInterface 1

Definition at line 192 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_TCPInterface 1

Definition at line 192 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_TeamBalancer 1

Definition at line 102 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_TeamManager 1

Definition at line 105 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_TelnetTransport 1

Definition at line 123 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_TwoWayAuthentication 1

Definition at line 147 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_UDPForwarder 1

Definition at line 165 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_UDPProxyClient 1

Definition at line 108 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_UDPProxyCoordinator 1

Definition at line 111 of file NativeFeatureIncludes.h.

#define _RAKNET_SUPPORT_UDPProxyServer 1

Definition at line 114 of file NativeFeatureIncludes.h.

#define LIBCAT_SECURITY 0

Definition at line 54 of file NativeFeatureIncludes.h.

Referenced by RAK_THREAD_DECLARATION().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NativeFeatureIncludesOverrides.h File Reference

  • include
  • slikenet
NativeFeatureIncludesOverrides.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NativeTypes.h File Reference

  • include
  • slikenet
Typedefs
NativeTypes.h File Reference

Go to the source code of this file.

Typedefs

typedef unsigned char | uint8_t
typedef unsigned short | uint16_t
typedef unsigned __int32 | uint32_t
typedef signed char | int8_t
typedef signed short | int16_t
typedef __int32 | int32_t
typedef unsigned long long int | uint64_t
typedef signed long long | int64_t

Typedef Documentation

typedef signed short int16_t

Definition at line 26 of file NativeTypes.h.

typedef __int32 int32_t

Definition at line 27 of file NativeTypes.h.

typedef signed long long int64_t

Definition at line 29 of file NativeTypes.h.

typedef signed char int8_t

Definition at line 25 of file NativeTypes.h.

typedef unsigned short uint16_t

Definition at line 23 of file NativeTypes.h.

typedef unsigned __int32 uint32_t

Definition at line 24 of file NativeTypes.h.

typedef unsigned long long int uint64_t

Definition at line 28 of file NativeTypes.h.

typedef unsigned char uint8_t

Definition at line 22 of file NativeTypes.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatPunchthroughClient.h File Reference

  • include
  • slikenet
Classes | Namespaces
NatPunchthroughClient.h File Reference

Contains the NAT-punchthrough plugin for the client. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "Export.h"
#include "PluginInterface2.h"
#include "PacketPriority.h"
#include "SocketIncludes.h"
#include "DS_List.h"
#include "string.h"
#include "DS_Queue.h"

Go to the source code of this file.

Classes

struct | SLNet::PunchthroughConfiguration
struct | SLNet::NatPunchthroughDebugInterface
struct | SLNet::NatPunchthroughDebugInterface_Printf
struct | SLNet::NatPunchthroughDebugInterface_PacketLogger
class | SLNet::NatPunchthroughClient
Client code for NATPunchthrough. More...
struct | SLNet::NatPunchthroughClient::SendPing
struct | SLNet::NatPunchthroughClient::AddrAndGuid
struct | SLNet::NatPunchthroughClient::DSTAndFac

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains the NAT-punchthrough plugin for the client.

Definition in file NatPunchthroughClient.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatPunchthroughServer.h File Reference

  • include
  • slikenet
Classes | Namespaces
NatPunchthroughServer.h File Reference

Contains the NAT-punchthrough plugin for the server. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "Export.h"
#include "PluginInterface2.h"
#include "PacketPriority.h"
#include "SocketIncludes.h"
#include "DS_OrderedList.h"
#include "string.h"

Go to the source code of this file.

Classes

struct | SLNet::NatPunchthroughServerDebugInterface
struct | SLNet::NatPunchthroughServerDebugInterface_Printf
struct | SLNet::NatPunchthroughServerDebugInterface_PacketLogger
class | SLNet::NatPunchthroughServer
Server code for NATPunchthrough. More...
struct | SLNet::NatPunchthroughServer::ConnectionAttempt
struct | SLNet::NatPunchthroughServer::User

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains the NAT-punchthrough plugin for the server.

Definition in file NatPunchthroughServer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatTypeDetectionClient.h File Reference

  • include
  • slikenet
Classes | Namespaces
NatTypeDetectionClient.h File Reference

Contains the NAT-type detection code for the client. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "Export.h"
#include "PluginInterface2.h"
#include "PacketPriority.h"
#include "SocketIncludes.h"
#include "DS_OrderedList.h"
#include "string.h"
#include "NatTypeDetectionCommon.h"

Go to the source code of this file.

Classes

class SLNet::NatTypeDetectionClient
Client code for NatTypeDetection. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains the NAT-type detection code for the client.

Definition in file NatTypeDetectionClient.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatTypeDetectionCommon.h File Reference

  • include
  • slikenet
Namespaces | Enumerations | Functions
NatTypeDetectionCommon.h File Reference
#include "NativeFeatureIncludes.h"
#include "SocketIncludes.h"
#include "types.h"
#include "socket2.h"

Go to the source code of this file.

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Enumerations

enum SLNet::NATTypeDetectionResult {
SLNet::NAT_TYPE_NONE, SLNet::NAT_TYPE_FULL_CONE, SLNet::NAT_TYPE_ADDRESS_RESTRICTED, SLNet::NAT_TYPE_PORT_RESTRICTED,
SLNet::NAT_TYPE_SYMMETRIC, SLNet::NAT_TYPE_UNKNOWN, SLNet::NAT_TYPE_DETECTION_IN_PROGRESS, SLNet::NAT_TYPE_SUPPORTS_UPNP,
SLNet::NAT_TYPE_COUNT
}
All possible types of NATs (except NAT_TYPE_COUNT, which is an internal value) More...

Functions

bool RAK_DLL_EXPORT | SLNet::CanConnect (NATTypeDetectionResult type1, NATTypeDetectionResult type2)
RAK_DLL_EXPORT const char * | SLNet::NATTypeDetectionResultToString (NATTypeDetectionResult type)
Return a technical string representin the enumeration.
RAK_DLL_EXPORT const char * | SLNet::NATTypeDetectionResultToStringFriendly (NATTypeDetectionResult type)
RAK_DLL_EXPORT RakNetSocket2 * | SLNet::CreateNonblockingBoundSocket (const char *bindAddr, RNS2EventHandler *eventHandler)
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatTypeDetectionServer.h File Reference

  • include
  • slikenet
Classes | Namespaces
NatTypeDetectionServer.h File Reference

Contains the NAT-type detection code for the server. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "Export.h"
#include "PluginInterface2.h"
#include "PacketPriority.h"
#include "SocketIncludes.h"
#include "DS_OrderedList.h"
#include "string.h"
#include "NatTypeDetectionCommon.h"

Go to the source code of this file.

Classes

class | SLNet::NatTypeDetectionServer
Server code for NatTypeDetection. More...
struct | SLNet::NatTypeDetectionServer::NATDetectionAttempt

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains the NAT-type detection code for the server.

Definition in file NatTypeDetectionServer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NetworkIDManager.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros
NetworkIDManager.h File Reference
#include "types.h"
#include "Export.h"
#include "memoryoverride.h"
#include "NetworkIDObject.h"
#include "Rand.h"

Go to the source code of this file.

Classes

class SLNet::NetworkIDManager

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define NETWORK_ID_MANAGER_HASH_LENGTH 1024

Macro Definition Documentation

#define NETWORK_ID_MANAGER_HASH_LENGTH 1024

Increase this value if you plan to have many persistent objects This value must match on all systems

Definition at line 34 of file NetworkIDManager.h.

Referenced by SLNet::NetworkIDManager::NetworkIDToHashIndex().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NetworkIDObject.h File Reference

  • include
  • slikenet
Classes | Namespaces | Typedefs
NetworkIDObject.h File Reference

A class you can derive from to make it easier to represent every networked object with an integer. This way you can refer to objects over the network. More...

#include "types.h"
#include "memoryoverride.h"
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::NetworkIDObject
Unique shared ids for each object instance. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Typedefs

typedef uint32_t SLNet::NetworkIDType

Detailed Description

A class you can derive from to make it easier to represent every networked object with an integer. This way you can refer to objects over the network.

Definition in file NetworkIDObject.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/osx_adapter.h File Reference

  • include
  • slikenet
osx_adapter.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketConsoleLogger.h File Reference

  • include
  • slikenet
Classes | Namespaces
PacketConsoleLogger.h File Reference

This will write all incoming and outgoing network messages to the log command parser, which can be accessed through Telnet. More...

#include "NativeFeatureIncludes.h"
#include "PacketLogger.h"

Go to the source code of this file.

Classes

class SLNet::PacketConsoleLogger
Packetlogger that logs to a remote command console. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

This will write all incoming and outgoing network messages to the log command parser, which can be accessed through Telnet.

Definition in file PacketConsoleLogger.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketFileLogger.h File Reference

  • include
  • slikenet
Classes | Namespaces
PacketFileLogger.h File Reference

This will write all incoming and outgoing network messages to a file. More...

#include "NativeFeatureIncludes.h"
#include "PacketLogger.h"
#include <stdio.h>

Go to the source code of this file.

Classes

class SLNet::PacketFileLogger
Packetlogger that outputs to a file. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

This will write all incoming and outgoing network messages to a file.

Definition in file PacketFileLogger.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketizedTCP.h File Reference

  • include
  • slikenet
Classes | Namespaces
PacketizedTCP.h File Reference

A simple TCP based server allowing sends and receives. Can be connected by any TCP client, including telnet. More...

#include "NativeFeatureIncludes.h"
#include "TCPInterface.h"
#include "DS_ByteQueue.h"
#include "DS_Map.h"

Go to the source code of this file.

Classes

class SLNet::PacketizedTCP

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

A simple TCP based server allowing sends and receives. Can be connected by any TCP client, including telnet.

Definition in file PacketizedTCP.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketLogger.h File Reference

  • include
  • slikenet
Classes | Namespaces
PacketLogger.h File Reference

This will write all incoming and outgoing network messages to the local console screen. See derived functions for other outputs. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "PluginInterface2.h"
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::PacketLogger
Writes incoming and outgoing messages to the screen. This will write all incoming and outgoing messages to the console window, or to a file if you override it and give it this functionality. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

This will write all incoming and outgoing network messages to the local console screen. See derived functions for other outputs.

Definition in file PacketLogger.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketOutputWindowLogger.h File Reference

  • include
  • slikenet
Classes | Namespaces
PacketOutputWindowLogger.h File Reference

This will write all incoming and outgoing network messages to a file. More...

#include "NativeFeatureIncludes.h"
#include "PacketLogger.h"

Go to the source code of this file.

Classes

class SLNet::PacketOutputWindowLogger
Packetlogger that outputs to the output window in the debugger. Windows only. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

This will write all incoming and outgoing network messages to a file.

Definition in file PacketOutputWindowLogger.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketPool.h File Reference

  • include
  • slikenet
PacketPool.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketPriority.h File Reference

  • include
  • slikenet
Enumerations
PacketPriority.h File Reference

This file contains enumerations for packet priority and reliability enumerations. More...

Go to the source code of this file.

Enumerations

enum PacketPriority {
IMMEDIATE_PRIORITY, HIGH_PRIORITY, MEDIUM_PRIORITY, LOW_PRIORITY,
NUMBER_OF_PRIORITIES
}
These enumerations are used to describe when packets are delivered. More...
enum PacketReliability {
UNRELIABLE, UNRELIABLE_SEQUENCED, RELIABLE, RELIABLE_ORDERED,
RELIABLE_SEQUENCED, UNRELIABLE_WITH_ACK_RECEIPT, RELIABLE_WITH_ACK_RECEIPT, RELIABLE_ORDERED_WITH_ACK_RECEIPT,
NUMBER_OF_RELIABILITIES
}

Detailed Description

This file contains enumerations for packet priority and reliability enumerations.

Definition in file PacketPriority.h.

Enumeration Type Documentation

enum PacketPriority

These enumerations are used to describe when packets are delivered.

Enumerator:
IMMEDIATE_PRIORITY

The highest possible priority. These message trigger sends immediately, and are generally not buffered or aggregated into a single datagram.

HIGH_PRIORITY

For every 2 IMMEDIATE_PRIORITY messages, 1 HIGH_PRIORITY will be sent. Messages at this priority and lower are buffered to be sent in groups at 10 millisecond intervals to reduce UDP overhead and better measure congestion control.

MEDIUM_PRIORITY

For every 2 HIGH_PRIORITY messages, 1 MEDIUM_PRIORITY will be sent. Messages at this priority and lower are buffered to be sent in groups at 10 millisecond intervals to reduce UDP overhead and better measure congestion control.

LOW_PRIORITY

For every 2 MEDIUM_PRIORITY messages, 1 LOW_PRIORITY will be sent. Messages at this priority and lower are buffered to be sent in groups at 10 millisecond intervals to reduce UDP overhead and better measure congestion control.

NUMBER_OF_PRIORITIES

Definition at line 21 of file PacketPriority.h.

enum PacketReliability

These enumerations are used to describe how packets are delivered.

Note
Note to self: I write this with 3 bits in the stream. If I add more remember to change that
In ReliabilityLayer::WriteToBitStreamFromInternalPacket I assume there are 5 major types
Do not reorder, I check on >= UNRELIABLE_WITH_ACK_RECEIPT
Enumerator:
UNRELIABLE

Same as regular UDP, except that it will also discard duplicate datagrams. RakNet adds (6 to 17) + 21 bits of overhead, 16 of which is used to detect duplicate packets and 6 to 17 of which is used for message length.

UNRELIABLE_SEQUENCED

Regular UDP with a sequence counter. Out of order messages will be discarded. Sequenced and ordered messages sent on the same channel will arrive in the order sent.

RELIABLE

The message is sent reliably, but not necessarily in any order. Same overhead as UNRELIABLE.

RELIABLE_ORDERED

This message is reliable and will arrive in the order you sent it. Messages will be delayed while waiting for out of order messages. Same overhead as UNRELIABLE_SEQUENCED. Sequenced and ordered messages sent on the same channel will arrive in the order sent.

RELIABLE_SEQUENCED

This message is reliable and will arrive in the sequence you sent it. Out or order messages will be dropped. Same overhead as UNRELIABLE_SEQUENCED. Sequenced and ordered messages sent on the same channel will arrive in the order sent.

UNRELIABLE_WITH_ACK_RECEIPT

Same as UNRELIABLE, however the user will get either ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS based on the result of sending this message when calling RakPeerInterface::Receive(). Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost.

RELIABLE_WITH_ACK_RECEIPT

Same as RELIABLE. The user will also get ID_SND_RECEIPT_ACKED after the message is delivered when calling RakPeerInterface::Receive(). ID_SND_RECEIPT_ACKED is returned when the message arrives, not necessarily the order when it was sent. Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost. This does not return ID_SND_RECEIPT_LOSS.

Same as UNRELIABLE_SEQUENCED, however the user will get either ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS based on the result of sending this message when calling RakPeerInterface::Receive(). Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost. 05/04/10 You can't have sequenced and ack receipts, because you don't know if the other system discarded the message, meaning you don't know if the message was processed

RELIABLE_ORDERED_WITH_ACK_RECEIPT

Same as RELIABLE_ORDERED_ACK_RECEIPT. The user will also get ID_SND_RECEIPT_ACKED after the message is delivered when calling RakPeerInterface::Receive(). ID_SND_RECEIPT_ACKED is returned when the message arrives, not necessarily the order when it was sent. Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost. This does not return ID_SND_RECEIPT_LOSS.

NUMBER_OF_RELIABILITIES

Same as RELIABLE_SEQUENCED. The user will also get ID_SND_RECEIPT_ACKED after the message is delivered when calling RakPeerInterface::Receive(). Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost. 05/04/10 You can't have sequenced and ack receipts, because you don't know if the other system discarded the message, meaning you don't know if the message was processed

Definition at line 46 of file PacketPriority.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/peer.h File Reference

  • include
  • slikenet
Classes | Namespaces
peer.h File Reference

Declares RakPeer class. More...

#include "ReliabilityLayer.h"
#include "peerinterface.h"
#include "BitStream.h"
#include "SingleProducerConsumer.h"
#include "SimpleMutex.h"
#include "DS_OrderedList.h"
#include "Export.h"
#include "string.h"
#include "thread.h"
#include "smartptr.h"
#include "DS_ThreadsafeAllocatingQueue.h"
#include "SignaledEvent.h"
#include "NativeFeatureIncludes.h"
#include "SecureHandshake.h"
#include "LocklessTypes.h"
#include "DS_Queue.h"

Go to the source code of this file.

Classes

struct | SLNet::RemoteSystemIndex
class | SLNet::RakPeer
Main interface for network communications. More...
struct | SLNet::RakPeer::PingAndClockDifferential
struct | SLNet::RakPeer::RemoteSystemStruct
struct | SLNet::RakPeer::BanStruct
struct | SLNet::RakPeer::RequestedConnectionStruct
struct | SLNet::RakPeer::BufferedCommandStruct
struct | SLNet::RakPeer::SocketQueryOutput

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Declares RakPeer class.

Definition in file peer.h.

Class Documentation

struct SLNet::RemoteSystemIndex

Definition at line 52 of file peer.h.

Class Members
unsigned | index
RemoteSystemIndex * | next
struct SLNet::RakPeer::PingAndClockDifferential

Definition at line 660 of file peer.h.

Class Members
Time | clockDifferential
unsigned short | pingTime
struct SLNet::RakPeer::BanStruct

Definition at line 830 of file peer.h.

Class Members
char * | IP
TimeMS | timeout
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/peerinterface.h File Reference

  • include
  • slikenet
Classes | Namespaces
peerinterface.h File Reference

An interface for RakPeer. Simply contains all user functions as pure virtuals. More...

#include "PacketPriority.h"
#include "types.h"
#include "memoryoverride.h"
#include "Export.h"
#include "DS_List.h"
#include "smartptr.h"
#include "socket2.h"

Go to the source code of this file.

Classes

class SLNet::RakPeerInterface
The main interface for network communications. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

An interface for RakPeer. Simply contains all user functions as pure virtuals.

Definition in file peerinterface.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PluginInterface2.h File Reference

  • include
  • slikenet
Classes | Namespaces | Enumerations
PluginInterface2.h File Reference

RakNet's plugin functionality system, version 2. You can derive from this to create your own plugins. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "Export.h"
#include "PacketPriority.h"

Go to the source code of this file.

Classes

class SLNet::PluginInterface2

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Enumerations

enum | SLNet::PluginReceiveResult { SLNet::RR_STOP_PROCESSING_AND_DEALLOCATE =0, SLNet::RR_CONTINUE_PROCESSING, SLNet::RR_STOP_PROCESSING }
enum | SLNet::PI2_LostConnectionReason { SLNet::LCR_CLOSED_BY_USER, SLNet::LCR_DISCONNECTION_NOTIFICATION, SLNet::LCR_CONNECTION_LOST }
enum SLNet::PI2_FailedConnectionAttemptReason {
SLNet::FCAR_CONNECTION_ATTEMPT_FAILED, SLNet::FCAR_ALREADY_CONNECTED, SLNet::FCAR_NO_FREE_INCOMING_CONNECTIONS, SLNet::FCAR_SECURITY_PUBLIC_KEY_MISMATCH,
SLNet::FCAR_CONNECTION_BANNED, SLNet::FCAR_INVALID_PASSWORD, SLNet::FCAR_INCOMPATIBLE_PROTOCOL, SLNet::FCAR_IP_RECENTLY_CONNECTED,
SLNet::FCAR_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY, SLNet::FCAR_OUR_SYSTEM_REQUIRES_SECURITY, SLNet::FCAR_PUBLIC_KEY_MISMATCH
}

Detailed Description

RakNet's plugin functionality system, version 2. You can derive from this to create your own plugins.

Definition in file PluginInterface2.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PS3Includes.h File Reference

  • include
  • slikenet
PS3Includes.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PS4Includes.h File Reference

  • include
  • slikenet
PS4Includes.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Rackspace.h File Reference

  • include
  • slikenet
Classes | Namespaces | Enumerations
Rackspace.h File Reference

Helper to class to manage Rackspace servers. More...

#include "NativeFeatureIncludes.h"
#include "Export.h"
#include "DS_List.h"
#include "types.h"
#include "DS_Queue.h"
#include "string.h"

Go to the source code of this file.

Classes

class | SLNet::Rackspace2EventCallback
Callback interface to receive the results of operations. More...
class | SLNet::RackspaceEventCallback_Default
Callback interface to receive the results of operations, with a default result. More...
class | SLNet::Rackspace
Code that uses the TCPInterface class to communicate with the Rackspace API servers. More...
struct | SLNet::Rackspace::RackspaceOperation

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Enumerations

enum SLNet::RackspaceEventType {
SLNet::RET_Success_200, SLNet::RET_Success_201, SLNet::RET_Success_202, SLNet::RET_Success_203,
SLNet::RET_Success_204, SLNet::RET_Cloud_Servers_Fault_500, SLNet::RET_Service_Unavailable_503, SLNet::RET_Unauthorized_401,
SLNet::RET_Bad_Request_400, SLNet::RET_Over_Limit_413, SLNet::RET_Bad_Media_Type_415, SLNet::RET_Item_Not_Found_404,
SLNet::RET_Build_In_Progress_409, SLNet::RET_Resize_Not_Allowed_403, SLNet::RET_Connection_Closed_Without_Reponse, SLNet::RET_Unknown_Failure
}
Result codes for Rackspace commands /sa Rackspace::EventTypeToString() More...
enum SLNet::RackspaceOperationType {
SLNet::RO_CONNECT_AND_AUTHENTICATE, SLNet::RO_LIST_SERVERS, SLNet::RO_LIST_SERVERS_WITH_DETAILS, SLNet::RO_CREATE_SERVER,
SLNet::RO_GET_SERVER_DETAILS, SLNet::RO_UPDATE_SERVER_NAME_OR_PASSWORD, SLNet::RO_DELETE_SERVER, SLNet::RO_LIST_SERVER_ADDRESSES,
SLNet::RO_SHARE_SERVER_ADDRESS, SLNet::RO_DELETE_SERVER_ADDRESS, SLNet::RO_REBOOT_SERVER, SLNet::RO_REBUILD_SERVER,
SLNet::RO_RESIZE_SERVER, SLNet::RO_CONFIRM_RESIZED_SERVER, SLNet::RO_REVERT_RESIZED_SERVER, SLNet::RO_LIST_FLAVORS,
SLNet::RO_GET_FLAVOR_DETAILS, SLNet::RO_LIST_IMAGES, SLNet::RO_CREATE_IMAGE, SLNet::RO_GET_IMAGE_DETAILS,
SLNet::RO_DELETE_IMAGE, SLNet::RO_LIST_SHARED_IP_GROUPS, SLNet::RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS, SLNet::RO_CREATE_SHARED_IP_GROUP,
SLNet::RO_GET_SHARED_IP_GROUP_DETAILS, SLNet::RO_DELETE_SHARED_IP_GROUP, SLNet::RO_NONE
}

Detailed Description

Helper to class to manage Rackspace servers.

Definition in file Rackspace.h.

Class Documentation

struct SLNet::Rackspace::RackspaceOperation

Definition at line 371 of file Rackspace.h.

Class Members
SystemAddress | connectionAddress
RakString | httpCommand
RakString | incomingStream
bool | isPendingAuthentication
RakString | operation
RackspaceOperationType | type
RakString | xml
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Rand.h File Reference

  • include
  • slikenet
Classes | Namespaces | Functions
Rand.h File Reference

[Internal] Random number generator More...

#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::RakNetRandom

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Functions

void RAK_DLL_EXPORT | seedMT (unsigned int seed)
unsigned int RAK_DLL_EXPORT | reloadMT (void)
unsigned int RAK_DLL_EXPORT | randomMT (void)
float RAK_DLL_EXPORT | frandomMT (void)
void RAK_DLL_EXPORT | fillBufferMT (void *buffer, unsigned int bytes)

Detailed Description

[Internal] Random number generator

Definition in file Rand.h.

Function Documentation

void RAK_DLL_EXPORT fillBufferMT | ( | void * | buffer,
 |  | unsigned int | bytes
 | ) |  |

Randomizes a buffer

Note
not threadSafe, use an instance of RakNetRandom if necessary per thread

Definition at line 99 of file Rand.cpp.

References _left, _next, _state, and fillBufferMT().

float RAK_DLL_EXPORT frandomMT ( void )

Gets a random float

Note
not threadSafe, use an instance of RakNetRandom if necessary per thread
Returns
0 to 1.0f, inclusive

Definition at line 95 of file Rand.cpp.

References _left, _next, _state, and frandomMT().

unsigned int RAK_DLL_EXPORT randomMT ( void )

Gets a random unsigned int

Note
not threadSafe, use an instance of RakNetRandom if necessary per thread
Returns
an integer random value.

Definition at line 91 of file Rand.cpp.

References _left, _next, _state, and randomMT().

unsigned int RAK_DLL_EXPORT reloadMT ( void )

Definition at line 87 of file Rand.cpp.

References _left, _next, _state, and reloadMT().

void RAK_DLL_EXPORT seedMT ( unsigned int seed )

Initialise seed for Random Generator

Note
not threadSafe, use an instance of RakNetRandom if necessary per thread
Parameters
[in] seed The seed value for the random number generator.

Definition at line 83 of file Rand.cpp.

References _left, _next, _state, and seedMT().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/RandSync.h File Reference

  • include
  • slikenet
Classes | Namespaces
RandSync.h File Reference

[Internal] Random number generator More...

#include "Export.h"
#include "Rand.h"
#include "DS_Queue.h"
#include "NativeTypes.h"

Go to the source code of this file.

Classes

class SLNet::RakNetRandomSync

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

[Internal] Random number generator

Definition in file RandSync.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ReadyEvent.h File Reference

  • include
  • slikenet
Classes | Namespaces | Enumerations
ReadyEvent.h File Reference

Ready event plugin. This enables a set of systems to create a signal event, set this signal as ready or unready, and to trigger the event when all systems are ready. More...

#include "NativeFeatureIncludes.h"
#include "PluginInterface2.h"
#include "DS_OrderedList.h"

Go to the source code of this file.

Classes

class | SLNet::ReadyEvent
Peer to peer synchronized ready and unready events. More...
struct | SLNet::ReadyEvent::RemoteSystem
struct | SLNet::ReadyEvent::ReadyEventNode

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Enumerations

enum SLNet::ReadyEventSystemStatus {
SLNet::RES_NOT_WAITING, SLNet::RES_WAITING, SLNet::RES_READY, SLNet::RES_ALL_READY,
SLNet::RES_UNKNOWN_EVENT
}

Detailed Description

Ready event plugin. This enables a set of systems to create a signal event, set this signal as ready or unready, and to trigger the event when all systems are ready.

Definition in file ReadyEvent.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/RefCountedObj.h File Reference

  • include
  • slikenet
Classes
RefCountedObj.h File Reference

Reference counted object. Very simple class for quick and dirty uses. More...

#include "memoryoverride.h"

Go to the source code of this file.

Classes

class RefCountedObj
World's simplest class :) More...

Detailed Description

Reference counted object. Very simple class for quick and dirty uses.

Definition in file RefCountedObj.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/RelayPlugin.h File Reference

  • include
  • slikenet
Classes | Namespaces | Enumerations
RelayPlugin.h File Reference

Contains the class RelayPlugin. More...

#include "NativeFeatureIncludes.h"
#include "PluginInterface2.h"
#include "string.h"
#include "DS_Hash.h"

Go to the source code of this file.

Classes

class | SLNet::RelayPlugin
A simple class to relay messages from one system to another, identifying remote systems by a string. More...
struct | SLNet::RelayPlugin::StrAndGuidAndRoom
struct | SLNet::RelayPlugin::StrAndGuid
struct | SLNet::RelayPlugin::RP_Group

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Enumerations

enum SLNet::RelayPluginEnums {
SLNet::RPE_MESSAGE_TO_SERVER_FROM_CLIENT, SLNet::RPE_ADD_CLIENT_REQUEST_FROM_CLIENT, SLNet::RPE_REMOVE_CLIENT_REQUEST_FROM_CLIENT, SLNet::RPE_GROUP_MESSAGE_FROM_CLIENT,
SLNet::RPE_JOIN_GROUP_REQUEST_FROM_CLIENT, SLNet::RPE_LEAVE_GROUP_REQUEST_FROM_CLIENT, SLNet::RPE_GET_GROUP_LIST_REQUEST_FROM_CLIENT, SLNet::RPE_MESSAGE_TO_CLIENT_FROM_SERVER,
SLNet::RPE_ADD_CLIENT_NOT_ALLOWED, SLNet::RPE_ADD_CLIENT_TARGET_NOT_CONNECTED, SLNet::RPE_ADD_CLIENT_NAME_ALREADY_IN_USE, SLNet::RPE_ADD_CLIENT_SUCCESS,
SLNet::RPE_USER_ENTERED_ROOM, SLNet::RPE_USER_LEFT_ROOM, SLNet::RPE_GROUP_MSG_FROM_SERVER, SLNet::RPE_GET_GROUP_LIST_REPLY_FROM_SERVER,
SLNet::RPE_JOIN_GROUP_SUCCESS, SLNet::RPE_JOIN_GROUP_FAILURE
}

Detailed Description

Contains the class RelayPlugin.

Definition in file RelayPlugin.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ReliabilityLayer.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Typedefs | Functions
ReliabilityLayer.h File Reference

[Internal] Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence. More...

#include "memoryoverride.h"
#include "MTUSize.h"
#include "DS_LinkedList.h"
#include "DS_List.h"
#include "SocketLayer.h"
#include "PacketPriority.h"
#include "DS_Queue.h"
#include "BitStream.h"
#include "InternalPacket.h"
#include "statistics.h"
#include "DR_SHA1.h"
#include "DS_OrderedList.h"
#include "DS_RangeList.h"
#include "DS_BPlusTree.h"
#include "DS_MemoryPool.h"
#include "defines.h"
#include "DS_Heap.h"
#include "NativeFeatureIncludes.h"
#include "SecureHandshake.h"
#include "PluginInterface2.h"
#include "Rand.h"
#include "socket2.h"
#include "CCRakNetSlidingWindow.h"

Go to the source code of this file.

Classes

struct | SLNet::SplitPacketChannel
struct | SLNet::BPSTracker
struct | SLNet::BPSTracker::TimeAndValue2
class | SLNet::ReliabilityLayer
Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define | INCLUDE_TIMESTAMP_WITH_DATAGRAMS 0
#define | NUMBER_OF_ORDERED_STREAMS 32
Number of ordered streams available. You can use up to 32 ordered streams.
#define | RESEND_TREE_ORDER 32

Typedefs

typedef uint64_t SLNet::reliabilityHeapWeightType

Functions

int RAK_DLL_EXPORT SLNet::SplitPacketChannelComp (SplitPacketIdType const &key, SplitPacketChannel *const &data)

Detailed Description

[Internal] Datagram reliable, ordered, unordered and sequenced sends. Flow control. Message splitting, reassembly, and coalescence.

Definition in file ReliabilityLayer.h.

Class Documentation

struct SLNet::SplitPacketChannel

Definition at line 69 of file ReliabilityLayer.h.

Class Members
InternalPacket * | firstPacket
CCTimeType | lastUpdateTime
List< InternalPacket * > | splitPacketList

Macro Definition Documentation

#define INCLUDE_TIMESTAMP_WITH_DATAGRAMS 0

Definition at line 53 of file ReliabilityLayer.h.

#define NUMBER_OF_ORDERED_STREAMS 32

Number of ordered streams available. You can use up to 32 ordered streams.

Definition at line 57 of file ReliabilityLayer.h.

Referenced by SLNet::RakPeer::Send(), SLNet::RakPeer::SendBuffered(), and SLNet::RakPeer::SendBufferedList().

#define RESEND_TREE_ORDER 32

Definition at line 59 of file ReliabilityLayer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ReplicaEnums.h File Reference

  • include
  • slikenet
Enumerations
ReplicaEnums.h File Reference

Contains enumerations used by the ReplicaManager system. This file is a lightweight header, so you can include it without worrying about linking in lots of other crap. More...

Go to the source code of this file.

Enumerations

enum {
REPLICA_RECEIVE_DESTRUCTION =1<<0, REPLICA_RECEIVE_SERIALIZE =1<<1, REPLICA_RECEIVE_SCOPE_CHANGE =1<<2, REPLICA_SEND_CONSTRUCTION =1<<3,
REPLICA_SEND_DESTRUCTION =1<<4, REPLICA_SEND_SCOPE_CHANGE =1<<5, REPLICA_SEND_SERIALIZE =1<<6, REPLICA_SET_ALL = 0xFF
}
enum ReplicaReturnResult {
REPLICA_PROCESS_LATER, REPLICA_PROCESSING_DONE, REPLICA_CANCEL_PROCESS, REPLICA_PROCESS_AGAIN,
REPLICA_PROCESS_IMPLICIT
}

Detailed Description

Contains enumerations used by the ReplicaManager system. This file is a lightweight header, so you can include it without worrying about linking in lots of other crap.

Definition in file ReplicaEnums.h.

Enumeration Type Documentation

anonymous enum

Replica interface flags, used to enable and disable function calls on the Replica object Passed to ReplicaManager::EnableReplicaInterfaces and ReplicaManager::DisableReplicaInterfaces

Enumerator:
REPLICA_RECEIVE_DESTRUCTION
REPLICA_RECEIVE_SERIALIZE
REPLICA_RECEIVE_SCOPE_CHANGE
REPLICA_SEND_CONSTRUCTION
REPLICA_SEND_DESTRUCTION
REPLICA_SEND_SCOPE_CHANGE
REPLICA_SEND_SERIALIZE
REPLICA_SET_ALL

Definition at line 22 of file ReplicaEnums.h.

enum ReplicaReturnResult
Enumerator:
REPLICA_PROCESS_LATER

This means call the function again later, with the same parameters.

REPLICA_PROCESSING_DONE

This means we are done processing (the normal result to return)

REPLICA_CANCEL_PROCESS

This means cancel the processing - don't send any network messages and don't change the current state.

REPLICA_PROCESS_AGAIN

Same as REPLICA_PROCESSING_DONE, where a message is sent, but does not clear the send bit. Useful for multi-part sends with different reliability levels. Only currently used by Replica::Serialize

REPLICA_PROCESS_IMPLICIT

Only returned from the Replica::SendConstruction interface, means act as if the other system had this object but don't actually Send a construction packet. This way you will still send scope and serialize packets to that system

Definition at line 34 of file ReplicaEnums.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ReplicaManager3.h File Reference

  • include
  • slikenet
Classes | Namespaces | Typedefs | Enumerations | Variables
ReplicaManager3.h File Reference

Contains the third iteration of the ReplicaManager class. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "time.h"
#include "BitStream.h"
#include "PacketPriority.h"
#include "PluginInterface2.h"
#include "NetworkIDObject.h"
#include "DS_OrderedList.h"
#include "DS_Queue.h"

Go to the source code of this file.

Classes

struct | SLNet::PRO
class | SLNet::ReplicaManager3
System to help automate game object construction, destruction, and serialization. More...
struct | SLNet::ReplicaManager3::RM3World
struct | SLNet::LastSerializationResultBS
struct | SLNet::LastSerializationResult
struct | SLNet::SerializeParameters
struct | SLNet::DeserializeParameters
class | SLNet::Connection_RM3
Each remote system is represented by Connection_RM3. Used to allocate Replica3 and track which instances have been allocated. More...
class | SLNet::Replica3
Base class for your replicated objects for the ReplicaManager3 system. More...
class | SLNet::Replica3Composite< parent_type >
Use Replica3 through composition instead of inheritance by containing an instance of this templated class Calls to parent class for all functions Parent class must still define and functions though! More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Typedefs

typedef uint8_t SLNet::WorldId

Enumerations

enum | SLNet::SendSerializeIfChangedResult { SLNet::SSICR_SENT_DATA, SLNet::SSICR_DID_NOT_SEND_DATA, SLNet::SSICR_NEVER_SERIALIZE }
enum SLNet::RM3ConstructionState {
SLNet::RM3CS_SEND_CONSTRUCTION, SLNet::RM3CS_ALREADY_EXISTS_REMOTELY, SLNet::RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT, SLNet::RM3CS_NEVER_CONSTRUCT,
SLNet::RM3CS_NO_ACTION, SLNet::RM3CS_MAX
}
Return codes for Connection_RM3::GetConstructionState() and Replica3::QueryConstruction() More...
enum | SLNet::RM3DestructionState { SLNet::RM3DS_SEND_DESTRUCTION, SLNet::RM3DS_DO_NOT_QUERY_DESTRUCTION, SLNet::RM3DS_NO_ACTION, SLNet::RM3DS_MAX }
enum SLNet::RM3SerializationResult {
SLNet::RM3SR_BROADCAST_IDENTICALLY, SLNet::RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION, SLNet::RM3SR_SERIALIZED_UNIQUELY, SLNet::RM3SR_SERIALIZED_ALWAYS,
SLNet::RM3SR_SERIALIZED_ALWAYS_IDENTICALLY, SLNet::RM3SR_DO_NOT_SERIALIZE, SLNet::RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION, SLNet::RM3SR_MAX
}
enum | SLNet::RM3QuerySerializationResult { SLNet::RM3QSR_CALL_SERIALIZE, SLNet::RM3QSR_DO_NOT_CALL_SERIALIZE, SLNet::RM3QSR_NEVER_CALL_SERIALIZE, SLNet::RM3QSR_MAX }
enum | SLNet::RM3ActionOnPopConnection { SLNet::RM3AOPC_DO_NOTHING, SLNet::RM3AOPC_DELETE_REPLICA, SLNet::RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION, SLNet::RM3AOPC_MAX }
enum SLNet::Replica3P2PMode {
SLNet::R3P2PM_SINGLE_OWNER, SLNet::R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE, SLNet::R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE, SLNet::R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE,
SLNet::R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE
}

Variables

static const int SLNet::RM3_NUM_OUTPUT_BITSTREAM_CHANNELS =16

Detailed Description

Contains the third iteration of the ReplicaManager class.

Definition in file ReplicaManager3.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Router2.h File Reference

  • include
  • slikenet
Classes | Namespaces
Router2.h File Reference

Router2 plugin. Allows you to connect to a system by routing packets through another system that is connected to both you and the destination. Useful for getting around NATs. More...

#include "NativeFeatureIncludes.h"
#include "types.h"
#include "PluginInterface2.h"
#include "PacketPriority.h"
#include "Export.h"
#include "UDPForwarder.h"
#include "MessageIdentifiers.h"
#include "DS_List.h"
#include "SimpleMutex.h"

Go to the source code of this file.

Classes

struct | SLNet::Router2DebugInterface
class | SLNet::Router2
Class interface for the Router2 system. More...
struct | SLNet::Router2::ConnectionRequestSystem
struct | SLNet::Router2::ConnnectRequest
struct | SLNet::Router2::MiniPunchRequest
struct | SLNet::Router2::ForwardedConnection

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Router2 plugin. Allows you to connect to a system by routing packets through another system that is connected to both you and the destination. Useful for getting around NATs.

Definition in file Router2.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/RPC4Plugin.h File Reference

  • include
  • slikenet
Classes | Namespaces | Enumerations
RPC4Plugin.h File Reference

Remote procedure call, supporting C functions only. No external dependencies required. More...

#include "NativeFeatureIncludes.h"
#include "PluginInterface2.h"
#include "PacketPriority.h"
#include "types.h"
#include "BitStream.h"
#include "string.h"
#include "NetworkIDObject.h"
#include "DS_Hash.h"
#include "DS_OrderedList.h"

Go to the source code of this file.

Classes

class | SLNet::RPC4GlobalRegistration
Instantiate this class globally if you want to register a function with RPC4 at the global space. More...
class | SLNet::RPC4
The RPC4 plugin is just an association between a C function pointer and a string. More...
struct | SLNet::RPC4::LocalCallback
struct | SLNet::RPC4::LocalSlotObject
struct | SLNet::RPC4::LocalSlot

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Enumerations

enum SLNet::RPCErrorCodes { SLNet::RPC_ERROR_FUNCTION_NOT_REGISTERED }
Error codes returned by a remote system as to why an RPC function call cannot execute. More...

Detailed Description

Remote procedure call, supporting C functions only. No external dependencies required.

Definition in file RPC4Plugin.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SecureHandshake.h File Reference

  • include
  • slikenet
SecureHandshake.h File Reference
#include "NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SendToThread.h File Reference

  • include
  • slikenet
SendToThread.h File Reference
#include "defines.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SignaledEvent.h File Reference

  • include
  • slikenet
Classes | Namespaces
SignaledEvent.h File Reference
#include <pthread.h>
#include <sys/types.h>
#include "SimpleMutex.h"
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::SignaledEvent

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SimpleMutex.h File Reference

  • include
  • slikenet
Classes | Namespaces
SimpleMutex.h File Reference

[Internal] Encapsulates a mutex More...

#include "memoryoverride.h"
#include <pthread.h>
#include <sys/types.h>
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::SimpleMutex
An easy to use mutex. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

[Internal] Encapsulates a mutex

Definition in file SimpleMutex.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SimpleTCPServer.h File Reference

  • include
  • slikenet
SimpleTCPServer.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SingleProducerConsumer.h File Reference

  • include
  • slikenet
Classes | Namespaces | Variables
SingleProducerConsumer.h File Reference

[Internal] Passes queued data between threads using a circular buffer with read and write pointers More...

#include "assert.h"
#include "memoryoverride.h"
#include "Export.h"

Go to the source code of this file.

Classes

class DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
A single producer consumer implementation without critical sections. More...

Namespaces

namespace DataStructures

Variables

static const int MINIMUM_LIST_SIZE =8

Detailed Description

[Internal] Passes queued data between threads using a circular buffer with read and write pointers

Definition in file SingleProducerConsumer.h.

Variable Documentation

const int MINIMUM_LIST_SIZE =8
static

Definition at line 27 of file SingleProducerConsumer.h.

Referenced by DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::Clear(), and DataStructures::SingleProducerConsumer< SingleProducerConsumerType >::SingleProducerConsumer().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/sleep.h File Reference

  • include
  • slikenet
Functions
sleep.h File Reference
#include "Export.h"

Go to the source code of this file.

Functions

void RAK_DLL_EXPORT RakSleep (unsigned int ms)

Function Documentation

void RAK_DLL_EXPORT RakSleep ( unsigned int ms )

Definition at line 41 of file RakSleep.cpp.

References fakeCond, and fakeMutex.

Referenced by SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), SLNet::RakPeerInterface::Get64BitUniqueRandomNumber(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), ThreadPool< InputType, OutputType >::Pause(), SLNet::RNS2_Berkley::RecvFromLoopInt(), SLNet::RakPeer::Shutdown(), ThreadPool< InputType, OutputType >::StartThreads(), SLNet::RakPeer::Startup(), and ThreadPool< InputType, OutputType >::StopThreads().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/smartptr.h File Reference

  • include
  • slikenet
Classes | Namespaces
smartptr.h File Reference
#include "memoryoverride.h"
#include "Export.h"

Go to the source code of this file.

Classes

class | SLNet::ReferenceCounter
class | SLNet::RakNetSmartPtr< T >

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/socket.h File Reference

  • include
  • slikenet
socket.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/socket2.h File Reference

  • include
  • slikenet
Classes | Namespaces | Typedefs | Enumerations
socket2.h File Reference
#include "types.h"
#include "MTUSize.h"
#include "LocklessTypes.h"
#include "thread.h"
#include "DS_ThreadsafeAllocatingQueue.h"
#include "Export.h"

Go to the source code of this file.

Classes

struct | SLNet::RNS2_SendParameters
struct | SLNet::RNS2RecvStruct
class | SLNet::RakNetSocket2Allocator
class | SLNet::RNS2EventHandler
class | SLNet::RakNetSocket2
struct | SLNet::RNS2_BerkleyBindParameters
class | SLNet::IRNS2_Berkley
class | SLNet::RNS2_Berkley
class | SLNet::RNS2_Linux

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Typedefs

typedef int | SLNet::RNS2Socket
typedef int | SLNet::RNS2SendResult

Enumerations

enum SLNet::RNS2BindResult { SLNet::BR_SUCCESS, SLNet::BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE, SLNet::BR_FAILED_TO_BIND_SOCKET, SLNet::BR_FAILED_SEND_TEST }
enum SLNet::RNS2Type {
SLNet::RNS2T_WINDOWS_STORE_8, SLNet::RNS2T_PS3, SLNet::RNS2T_PS4, SLNet::RNS2T_CHROME,
SLNet::RNS2T_VITA, SLNet::RNS2T_XBOX_360, SLNet::RNS2T_XBOX_720, SLNet::RNS2T_WINDOWS,
SLNet::RNS2T_LINUX
}

Class Documentation

struct SLNet::RNS2RecvStruct

Definition at line 87 of file socket2.h.

Class Members
int | bytesRead
char | data
RakNetSocket2 * | socket
SystemAddress | systemAddress
TimeUS | timeRead
struct SLNet::RNS2_BerkleyBindParameters

Definition at line 265 of file socket2.h.

Class Members
unsigned short | addressFamily
int | doNotFragment
RNS2EventHandler * | eventHandler
char * | hostAddress
bool | nonBlockingSocket
int | pollingThreadPriority
unsigned short | port
int | protocol
unsigned short | remotePortRakNetWasStartedOn_PS3_PS4_PSP2
int | setBroadcast
int | setIPHdrIncl
int | type
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SocketDefines.h File Reference

  • include
  • slikenet
Macros
SocketDefines.h File Reference

Go to the source code of this file.

Macros

#define | closesocket__ close
Internal.
#define | select__ select
#define | accept__ accept
#define | connect__ connect
#define | socket__ socket
#define | bind__ bind
#define | getsockname__ getsockname
#define | getsockopt__ getsockopt
#define | ioctlsocket__ ioctlsocket
#define | listen__ listen
#define | recv__ recv
#define | recvfrom__ recvfrom
#define | sendto__ sendto
#define | send__ send
#define | setsockopt__ setsockopt
#define | shutdown__ shutdown
#define | WSASendTo__ WSASendTo

Macro Definition Documentation

#define accept__ accept

Definition at line 92 of file SocketDefines.h.

#define bind__ bind

Definition at line 99 of file SocketDefines.h.

#define closesocket__ close

Internal.

Definition at line 89 of file SocketDefines.h.

Referenced by SLNet::RNS2_Berkley::~RNS2_Berkley().

#define connect__ connect

Definition at line 93 of file SocketDefines.h.

#define getsockname__ getsockname

Definition at line 100 of file SocketDefines.h.

Referenced by SLNet::SocketLayer::GetSystemAddress(), and SLNet::SocketLayer::GetSystemAddress_Old().

#define getsockopt__ getsockopt

Definition at line 101 of file SocketDefines.h.

#define ioctlsocket__ ioctlsocket

Definition at line 105 of file SocketDefines.h.

Referenced by SLNet::SocketLayer::SetSocketOptions().

#define listen__ listen

Definition at line 106 of file SocketDefines.h.

#define recv__ recv

Definition at line 107 of file SocketDefines.h.

#define recvfrom__ recvfrom

Definition at line 108 of file SocketDefines.h.

#define select__ select

Definition at line 90 of file SocketDefines.h.

#define send__ send

Definition at line 114 of file SocketDefines.h.

#define sendto__ sendto

Definition at line 112 of file SocketDefines.h.

#define setsockopt__ setsockopt

Definition at line 118 of file SocketDefines.h.

Referenced by SLNet::SocketLayer::SetSocketOptions().

#define shutdown__ shutdown

Definition at line 120 of file SocketDefines.h.

#define socket__ socket

Definition at line 97 of file SocketDefines.h.

Referenced by SLNet::SocketLayer::GetSubNetForSocketAndIp().

#define WSASendTo__ WSASendTo

Definition at line 121 of file SocketDefines.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SocketIncludes.h File Reference

  • include
  • slikenet
Macros | Typedefs
SocketIncludes.h File Reference
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>

Go to the source code of this file.

Macros

#define | _PP_Instance_ int
#define | closesocket close

Typedefs

typedef int | __UDPSOCKET__
Unix/Linux uses ints for sockets.
typedef int | __TCPSOCKET__

Macro Definition Documentation

#define _PP_Instance_ int

Definition at line 19 of file SocketIncludes.h.

#define closesocket close

Definition at line 63 of file SocketIncludes.h.

Typedef Documentation

typedef int __TCPSOCKET__

Definition at line 103 of file SocketIncludes.h.

typedef int __UDPSOCKET__

Unix/Linux uses ints for sockets.

Definition at line 102 of file SocketIncludes.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SocketLayer.h File Reference

  • include
  • slikenet
Classes | Namespaces
SocketLayer.h File Reference

SocketLayer class implementation. More...

#include "memoryoverride.h"
#include "types.h"
#include "smartptr.h"
#include "Export.h"
#include "MTUSize.h"
#include "string.h"

Go to the source code of this file.

Classes

class SLNet::SocketLayer

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

SocketLayer class implementation.

Definition in file SocketLayer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/statistics.h File Reference

  • include
  • slikenet
Classes | Namespaces | Enumerations | Functions
statistics.h File Reference

A structure that holds all statistical data returned by RakNet. More...

#include "PacketPriority.h"
#include "Export.h"
#include "types.h"

Go to the source code of this file.

Classes

struct SLNet::RakNetStatistics
Network Statisics Usage. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Enumerations

enum SLNet::RNSPerSecondMetrics {
SLNet::USER_MESSAGE_BYTES_PUSHED, SLNet::USER_MESSAGE_BYTES_SENT, SLNet::USER_MESSAGE_BYTES_RESENT, SLNet::USER_MESSAGE_BYTES_RECEIVED_PROCESSED,
SLNet::USER_MESSAGE_BYTES_RECEIVED_IGNORED, SLNet::ACTUAL_BYTES_SENT, SLNet::ACTUAL_BYTES_RECEIVED, SLNet::RNS_PER_SECOND_METRICS_COUNT
}

Functions

void RAK_DLL_EXPORT | SLNet::StatisticsToString (RakNetStatistics *s, char *buffer, int verbosityLevel)
void RAK_DLL_EXPORT | SLNet::StatisticsToString (RakNetStatistics *s, char *buffer, size_t bufferLength, int verbosityLevel)

Detailed Description

A structure that holds all statistical data returned by RakNet.

Definition in file statistics.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/StatisticsHistory.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Typedefs
StatisticsHistory.h File Reference

Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values. More...

#include "NativeFeatureIncludes.h"
#include "PluginInterface2.h"
#include "memoryoverride.h"
#include "NativeTypes.h"
#include "DS_List.h"
#include "types.h"
#include "DS_OrderedList.h"
#include "string.h"
#include "DS_Queue.h"
#include "DS_Hash.h"
#include <float.h>

Go to the source code of this file.

Classes

class | SLNet::StatisticsHistory
Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values. More...
struct | SLNet::StatisticsHistory::TrackedObjectData
struct | SLNet::StatisticsHistory::TimeAndValue
struct | SLNet::StatisticsHistory::TimeAndValueQueue
struct | SLNet::StatisticsHistory::TrackedObject
class | SLNet::StatisticsHistoryPlugin
Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define SH_TYPE_MAX DBL_MAX

Typedefs

typedef double SLNet::SHValueType

Detailed Description

Input numerical values over time. Get sum, average, highest, lowest, standard deviation on recent or all-time values.

Definition in file StatisticsHistory.h.

Class Documentation

struct SLNet::StatisticsHistory::TimeAndValue

Definition at line 129 of file StatisticsHistory.h.

Class Members
Time | time
SHValueType | val

Macro Definition Documentation

#define SH_TYPE_MAX DBL_MAX

Definition at line 44 of file StatisticsHistory.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/string.h File Reference

  • include
  • slikenet
Classes | Namespaces | Functions
string.h File Reference
#include "Export.h"
#include "DS_List.h"
#include "types.h"
#include <stdio.h>
#include "stdarg.h"

Go to the source code of this file.

Classes

class | SLNet::RakString
String class. More...
struct | SLNet::RakString::SharedString

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Functions

const SLNet::RakString
RAK_DLL_EXPORT 		operator+ (const SLNet::RakString &lhs, const SLNet::RakString &rhs)

Class Documentation

struct SLNet::RakString::SharedString

Definition at line 309 of file string.h.

Class Members
char * | bigString
size_t | bytesUsed
char * | c_str
unsigned int | refCount
SimpleMutex * | refCountMutex
char | smallString

Function Documentation

const SLNet::RakString RAK_DLL_EXPORT operator+ | ( | const SLNet::RakString & | lhs,
 |  | const SLNet::RakString & | rhs
 | ) |  |

Definition at line 286 of file RakString.cpp.

References _FILE_AND_LINE_, SLNet::RakString::SharedString::bigString, SLNet::RakString::SharedString::bytesUsed, SLNet::RakString::SharedString::c_str, SLNet::RakString::emptyString, SLNet::RakString::freeList, SLNet::RakString::GetLength(), SLNet::RakString::GetSizeToAllocate(), DataStructures::List< list_type >::Insert(), SLNet::RakString::IsEmpty(), SLNet::SimpleMutex::Lock(), SLNet::RakString::LockMutex(), rakMalloc_Ex, SLNet::RakString::SharedString::refCount, SLNet::RakString::SharedString::refCountMutex, DataStructures::List< list_type >::RemoveAtIndex(), SLNet::RakString::sharedString, DataStructures::List< list_type >::Size(), SLNet::RakString::SharedString::smallString, SLNet::SimpleMutex::Unlock(), and SLNet::RakString::UnlockMutex().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/StringCompressor.h File Reference

  • include
  • slikenet
Classes | Namespaces
StringCompressor.h File Reference

Compresses/Decompresses ASCII strings and writes/reads them to BitStream class instances. You can use this to easily serialize and deserialize your own strings. More...

#include "Export.h"
#include "DS_Map.h"
#include "memoryoverride.h"
#include "NativeTypes.h"

Go to the source code of this file.

Classes

class SLNet::StringCompressor
Writes and reads strings to and from bitstreams. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Compresses/Decompresses ASCII strings and writes/reads them to BitStream class instances. You can use this to easily serialize and deserialize your own strings.

Definition in file StringCompressor.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SuperFastHash.h File Reference

  • include
  • slikenet
Functions
SuperFastHash.h File Reference
#include <stdio.h>
#include "NativeTypes.h"

Go to the source code of this file.

Functions

uint32_t | SuperFastHash (const char *data, int length)
uint32_t | SuperFastHashIncremental (const char *data, int len, unsigned int lastHash)
uint32_t | SuperFastHashFile (const char *filename)
uint32_t | SuperFastHashFilePtr (FILE *fp)

Function Documentation

uint32_t SuperFastHash | ( | const char * | data,
 |  | int | length
 | ) |  |

Definition at line 38 of file SuperFastHash.cpp.

References INCREMENTAL_READ_BLOCK, and SuperFastHashIncremental().

uint32_t SuperFastHashFile ( const char * filename )

Definition at line 106 of file SuperFastHash.cpp.

References SuperFastHashFilePtr().

uint32_t SuperFastHashFilePtr ( FILE * fp )

Definition at line 116 of file SuperFastHash.cpp.

References INCREMENTAL_READ_BLOCK, and SuperFastHashIncremental().

Referenced by SuperFastHashFile().

uint32_t SuperFastHashIncremental | ( | const char * | data,
 |  | int | len,
 |  | unsigned int | lastHash
 | ) |  |

Definition at line 58 of file SuperFastHash.cpp.

References get16bits.

Referenced by SuperFastHash(), SuperFastHashFilePtr(), and SLNet::SystemAddress::ToInteger().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TableSerializer.h File Reference

  • include
  • slikenet
Classes | Namespaces
TableSerializer.h File Reference
#include "memoryoverride.h"
#include "DS_Table.h"
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::TableSerializer

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TCPInterface.h File Reference

  • include
  • slikenet
Classes | Namespaces
TCPInterface.h File Reference

A simple TCP based server allowing sends and receives. Can be connected by any TCP client, including telnet. More...

#include "NativeFeatureIncludes.h"
#include "memoryoverride.h"
#include "DS_List.h"
#include "types.h"
#include "Export.h"
#include "thread.h"
#include "DS_Queue.h"
#include "SimpleMutex.h"
#include "defines.h"
#include "SocketIncludes.h"
#include "DS_ByteQueue.h"
#include "DS_ThreadsafeAllocatingQueue.h"
#include "LocklessTypes.h"
#include "PluginInterface2.h"

Go to the source code of this file.

Classes

class | SLNet::TCPInterface
struct | SLNet::TCPInterface::ThisPtrPlusSysAddr
struct | SLNet::RemoteClient
Stores information about a remote client. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

A simple TCP based server allowing sends and receives. Can be connected by any TCP client, including telnet.

Definition in file TCPInterface.h.

Class Documentation

struct SLNet::TCPInterface::ThisPtrPlusSysAddr

Definition at line 205 of file TCPInterface.h.

Class Members
char | bindAddress
unsigned short | socketFamily
SystemAddress | systemAddress
TCPInterface * | tcpInterface
bool | useSSL
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TeamBalancer.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Typedefs
TeamBalancer.h File Reference

Set and network team selection (supports peer to peer or client/server) More...

#include "NativeFeatureIncludes.h"
#include "PluginInterface2.h"
#include "memoryoverride.h"
#include "NativeTypes.h"
#include "DS_List.h"
#include "string.h"

Go to the source code of this file.

Classes

class | SLNet::TeamBalancer
Set and network team selection (supports peer to peer or client/server) More...
struct | SLNet::TeamBalancer::TeamMember
struct | SLNet::TeamBalancer::MyTeamMembers

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define UNASSIGNED_TEAM_ID 255

Typedefs

typedef unsigned char SLNet::TeamId

Detailed Description

Set and network team selection (supports peer to peer or client/server)

Automatically handles transmission and resolution of team selection, including team switching and balancing

Deprecated:
Use TeamManager intead

Definition in file TeamBalancer.h.

Macro Definition Documentation

#define UNASSIGNED_TEAM_ID 255

Definition at line 51 of file TeamBalancer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TeamManager.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Typedefs | Enumerations
TeamManager.h File Reference

Automates networking and list management for teams. More...

#include "NativeFeatureIncludes.h"
#include "PluginInterface2.h"
#include "memoryoverride.h"
#include "NativeTypes.h"
#include "DS_List.h"
#include "types.h"
#include "DS_Hash.h"
#include "DS_OrderedList.h"

Go to the source code of this file.

Classes

struct | SLNet::TeamSelection
Parameter to TM_World::ReferenceTeamMember() More...
class | SLNet::TM_TeamMember
A member of one or more teams. More...
struct | SLNet::TM_TeamMember::RequestedTeam
class | SLNet::TM_Team
A team, containing a list of TM_TeamMember instances. More...
class | SLNet::TM_World
Stores a list of teams which may be enforcing a balanced number of members. More...
struct | SLNet::TM_World::JoinRequestHelper
class | SLNet::TeamManager
Automates networking and list management for teams. More...
union | SLNet::TeamSelection.teamParameter

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define | ALLOW_JOIN_ANY_AVAILABLE_TEAM (1<<0)
Allow members to join this team when they specify TeamSelection::JOIN_ANY_AVAILABLE_TEAM.
#define | ALLOW_JOIN_SPECIFIC_TEAM (1<<1)
Allow members to join this team when they specify TeamSelection::JOIN_SPECIFIC_TEAM.
#define | ALLOW_JOIN_REBALANCING (1<<2)
Allow the host to put members on this team when rebalancing with TM_World::SetBalanceTeams()

Typedefs

typedef unsigned char | SLNet::NoTeamId
A subcategory of not being on a team. For example, 0 may mean no team for a player, while 1 may mean no team for a spectator. Defined by the user.
typedef uint16_t | SLNet::TeamMemberLimit
typedef uint8_t | SLNet::JoinPermissions

Enumerations

enum | SLNet::JoinTeamType { SLNet::JOIN_ANY_AVAILABLE_TEAM, SLNet::JOIN_SPECIFIC_TEAM, SLNet::JOIN_NO_TEAM }
enum | SLNet::TMTopology { SLNet::TM_PEER_TO_PEER, SLNet::TM_CLIENT_SERVER }

Detailed Description

Automates networking and list management for teams.

TeamManager provides support for teams. A team is a list of team members. Teams contain properties including the number of team members per team, whether or not tagged teams must have equal numbers of members, and if a team is locked or not to certain entry conditions Team members contain properties including which teams they are on and which teams they want to join if a team is not immediately joinable Advanced functionality includes the ability for a team member to be on multiple teams simultaneously, the ability to swap teams with other members, and the ability to resize the number of members supported per team

Definition in file TeamManager.h.

Macro Definition Documentation

#define ALLOW_JOIN_ANY_AVAILABLE_TEAM (1<<0)

Allow members to join this team when they specify TeamSelection::JOIN_ANY_AVAILABLE_TEAM.

Definition at line 64 of file TeamManager.h.

#define ALLOW_JOIN_REBALANCING (1<<2)

Allow the host to put members on this team when rebalancing with TM_World::SetBalanceTeams()

Definition at line 68 of file TeamManager.h.

#define ALLOW_JOIN_SPECIFIC_TEAM (1<<1)

Allow members to join this team when they specify TeamSelection::JOIN_SPECIFIC_TEAM.

Definition at line 66 of file TeamManager.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TelnetTransport.h File Reference

  • include
  • slikenet
Classes | Namespaces
TelnetTransport.h File Reference

Contains TelnetTransport , used to supports the telnet transport protocol. Insecure. More...

#include "NativeFeatureIncludes.h"
#include "TransportInterface.h"
#include "DS_List.h"
#include "Export.h"

Go to the source code of this file.

Classes

class | SLNet::TelnetTransport
Use TelnetTransport to easily allow windows telnet to connect to your ConsoleServer. More...
struct | SLNet::TelnetTransport::TelnetClient

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains TelnetTransport , used to supports the telnet transport protocol. Insecure.

Definition in file TelnetTransport.h.

Class Documentation

struct SLNet::TelnetTransport::TelnetClient

Definition at line 62 of file TelnetTransport.h.

Class Members
unsigned | cursorPosition
char | lastSentTextInput
SystemAddress | systemAddress
char | textInput
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/thread.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros
thread.h File Reference
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::RakThread

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define RAK_THREAD_DECLARATION(functionName) void* functionName( void* arguments )
To define a thread, use RAK_THREAD_DECLARATION(functionName);.

Macro Definition Documentation

#define RAK_THREAD_DECLARATION ( functionName ) void* functionName( void* arguments )

To define a thread, use RAK_THREAD_DECLARATION(functionName);.

Definition at line 51 of file thread.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ThreadPool.h File Reference

  • include
  • slikenet
Classes | Functions | Variables
ThreadPool.h File Reference
#include "memoryoverride.h"
#include "DS_Queue.h"
#include "SimpleMutex.h"
#include "Export.h"
#include "thread.h"
#include "SignaledEvent.h"
#include "ThreadPool.h"
#include "sleep.h"
#include <unistd.h>

Go to the source code of this file.

Classes

class | ThreadDataInterface
struct | ThreadPool< InputType, OutputType >

Functions

if (threadPool->perThreadDataFactory) perThreadData =threadPool->threadDataInterface->PerThreadFactory(threadPool->tdiContext)
threadPool numThreadsRunningMutex | Lock ()
threadPool numThreadsRunningMutex | Unlock ()
for (;;)

Variables

template<class ThreadInputType , class ThreadOutputType >
ThreadPool< ThreadInputType,
ThreadOutputType > * 		threadPool = (ThreadPool<ThreadInputType, ThreadOutputType>*) arguments
bool | returnOutput
ThreadOutputType(* | userCallback )(ThreadInputType, bool *, void *) =0
ThreadInputType | inputData
ThreadOutputType | callbackOutput
void * | perThreadData =0
threadPool numThreadsRunning
return

Function Documentation

for ( ;; )

Definition at line 240 of file ThreadPool.h.

References _FILE_AND_LINE_, ThreadPool< InputType, OutputType >::inputFunctionQueue, ThreadPool< InputType, OutputType >::inputQueue, ThreadPool< InputType, OutputType >::inputQueueMutex, SLNet::SimpleMutex::Lock(), ThreadPool< InputType, OutputType >::numThreadsWorking, ThreadPool< InputType, OutputType >::outputQueue, ThreadPool< InputType, OutputType >::outputQueueMutex, ThreadPool< InputType, OutputType >::quitAndIncomingDataEvents, ThreadPool< InputType, OutputType >::runThreads, ThreadPool< InputType, OutputType >::runThreadsMutex, SLNet::SimpleMutex::Unlock(), userCallback, SLNet::SignaledEvent::WaitOnEvent(), and ThreadPool< InputType, OutputType >::workingThreadCountMutex.

Referenced by DataStructures::BPlusTree< KeyType, DataType, order >::InsertIntoNode().

else if ( threadPool-> perThreadDataFactory ) =threadPool->threadDataInterface->PerThreadFactory(threadPool->tdiContext)

Referenced by SLNet::HuffmanEncodingTree::DecodeArray(), DataStructures::BPlusTree< KeyType, DataType, order >::DeleteFromPageAtIndex(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), DataStructures::BPlusTree< KeyType, DataType, order >::InsertIntoNode(), and DataStructures::BPlusTree< KeyType, DataType, order >::ShiftNodeLeft().

threadPool numThreadsRunningMutex Lock ( )
threadPool numThreadsRunningMutex Unlock ( )

Variable Documentation

ThreadOutputType callbackOutput

Definition at line 223 of file ThreadPool.h.

ThreadInputType inputData

Definition at line 222 of file ThreadPool.h.

Referenced by DataStructures::Tree< TreeType >::Tree().

threadPool numThreadsRunning

Definition at line 237 of file ThreadPool.h.

Referenced by ThreadPool< InputType, OutputType >::StartThreads(), ThreadPool< InputType, OutputType >::StopThreads(), and ThreadPool< InputType, OutputType >::ThreadPool().

else perThreadData =0

Definition at line 227 of file ThreadPool.h.

return

Definition at line 303 of file ThreadPool.h.

Referenced by SLNet::RakPeer::AddToBanList(), DataStructures::CircularLinkedList< CircularLinkedListType >::CircularLinkedList(), DataStructures::Queue< queue_type >::Clear(), DataStructures::CircularLinkedList< CircularLinkedListType >::Clear(), DataStructures::List< list_type >::Compress(), DataStructures::CircularLinkedList< CircularLinkedListType >::Concatenate(), SLNet::HuffmanEncodingTree::DecodeArray(), DataStructures::CircularLinkedList< CircularLinkedListType >::Del(), DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayBreadthFirstSearch(), DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayInorder(), DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayPostorder(), DataStructures::BinarySearchTree< BinarySearchTreeType >::DisplayPreorder(), SLNet::StringCompressor::EncodeString(), SLNet::HuffmanEncodingTree::FreeMemory(), SLNet::StringCompressor::GenerateTreeFromStrings(), GetMyIP_Win32(), DataStructures::LinkedList< LinkedListType >::LinkedList(), SLNet::RakPeer::PingInternal(), DataStructures::Queue< queue_type >::Push(), DataStructures::Queue< queue_type >::RemoveAtIndex(), SLNet::RakPeer::RemoveFromBanList(), DataStructures::CircularLinkedList< CircularLinkedListType >::Sort(), and SLNet::StatisticsToString().

bool returnOutput

Definition at line 220 of file ThreadPool.h.

template<class ThreadInputType , class ThreadOutputType >
ThreadPool<ThreadInputType, ThreadOutputType>* threadPool = (ThreadPool<ThreadInputType, ThreadOutputType>*) arguments

Definition at line 217 of file ThreadPool.h.

userCallback =0

Definition at line 221 of file ThreadPool.h.

Referenced by for().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ThreadsafePacketLogger.h File Reference

  • include
  • slikenet
Classes | Namespaces
ThreadsafePacketLogger.h File Reference

Derivation of the packet logger to defer the call to WriteLog until the user thread. More...

#include "NativeFeatureIncludes.h"
#include "PacketLogger.h"
#include "SingleProducerConsumer.h"

Go to the source code of this file.

Classes

class SLNet::ThreadsafePacketLogger
Same as PacketLogger, but writes output in the user thread. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Derivation of the packet logger to defer the call to WriteLog until the user thread.

Definition in file ThreadsafePacketLogger.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/time.h File Reference

  • include
  • slikenet
Namespaces | Macros | Typedefs
time.h File Reference
#include "NativeTypes.h"
#include "defines.h"

Go to the source code of this file.

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define RAK_TIME_FORMAT_STRING "%llu"

Typedefs

typedef uint64_t | SLNet::Time
typedef uint32_t | SLNet::TimeMS
typedef uint64_t | SLNet::TimeUS

Macro Definition Documentation

#define RAK_TIME_FORMAT_STRING "%llu"

Definition at line 28 of file time.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/transport2.h File Reference

  • include
  • slikenet
Classes | Namespaces
transport2.h File Reference

Contains RakNetTransportCommandParser and RakNetTransport used to provide a secure console connection. More...

#include "NativeFeatureIncludes.h"
#include "TransportInterface.h"
#include "DS_Queue.h"
#include "CommandParserInterface.h"
#include "PluginInterface2.h"
#include "Export.h"

Go to the source code of this file.

Classes

class SLNet::RakNetTransport2
Use RakNetTransport if you need a secure connection between the client and the console server. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Contains RakNetTransportCommandParser and RakNetTransport used to provide a secure console connection.

Definition in file transport2.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TransportInterface.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros
TransportInterface.h File Reference

Contains TransportInterface from which you can derive custom transport providers for ConsoleServer. More...

#include "types.h"
#include "Export.h"
#include "memoryoverride.h"

Go to the source code of this file.

Classes

class SLNet::TransportInterface
Defines an interface that is used to send and receive null-terminated strings. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define REMOTE_MAX_TEXT_INPUT 2048

Detailed Description

Contains TransportInterface from which you can derive custom transport providers for ConsoleServer.

Definition in file TransportInterface.h.

Macro Definition Documentation

#define REMOTE_MAX_TEXT_INPUT 2048

Definition at line 29 of file TransportInterface.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TwoWayAuthentication.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Typedefs
TwoWayAuthentication.h File Reference

Implements two way authentication. More...

#include "NativeFeatureIncludes.h"
#include "DR_SHA1.h"
#include "PluginInterface2.h"
#include "memoryoverride.h"
#include "NativeTypes.h"
#include "string.h"
#include "DS_Hash.h"
#include "DS_Queue.h"

Go to the source code of this file.

Classes

class | SLNet::TwoWayAuthentication
Implements two way authentication. More...
struct | SLNet::TwoWayAuthentication::PendingChallenge
struct | SLNet::TwoWayAuthentication::NonceAndRemoteSystemRequest
struct | SLNet::TwoWayAuthentication::NonceGenerator

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define | NONCE_TIMEOUT_MS 10000
#define | CHALLENGE_MINIMUM_TIMEOUT 3000
#define | TWO_WAY_AUTHENTICATION_NONCE_LENGTH 20
#define | HASHED_NONCE_AND_PW_LENGTH SHA1_LENGTH

Typedefs

typedef int64_t FCM2Guid

Detailed Description

Implements two way authentication.

Given two systems, each of whom known a common password, verify the password without transmitting it This can be used to determine what permissions are should be allowed to the other system

Definition in file TwoWayAuthentication.h.

Macro Definition Documentation

#define CHALLENGE_MINIMUM_TIMEOUT 3000

Definition at line 32 of file TwoWayAuthentication.h.

#define HASHED_NONCE_AND_PW_LENGTH SHA1_LENGTH

Definition at line 44 of file TwoWayAuthentication.h.

#define NONCE_TIMEOUT_MS 10000

Definition at line 30 of file TwoWayAuthentication.h.

#define TWO_WAY_AUTHENTICATION_NONCE_LENGTH 20

Definition at line 43 of file TwoWayAuthentication.h.

Typedef Documentation

typedef int64_t FCM2Guid

Definition at line 54 of file TwoWayAuthentication.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/types.h File Reference

  • include
  • slikenet
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
types.h File Reference

Types used by RakNet, most of which involve user code. More...

#include "defines.h"
#include "NativeTypes.h"
#include "time.h"
#include "Export.h"
#include "WindowsIncludes.h"
#include "XBox360Includes.h"
#include "SocketIncludes.h"

Go to the source code of this file.

Classes

struct | SLNet::PublicKey
Passed to RakPeerInterface::Connect() More...
struct | SLNet::SocketDescriptor
Describes the local socket to use for RakPeer::Startup. More...
struct | SLNet::SystemAddress
Network address for a system. More...
struct | SLNet::RakNetGUID
struct | SLNet::AddressOrGUID
struct | SLNet::Packet
This represents a user message from another system. More...
struct | SLNet::uint24_t

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define | BITS_TO_BYTES(x) (((x)+7)>>3)
Given a number of bits, return how many bytes are needed to represent that.
#define | BYTES_TO_BITS(x) ((x)<<3)
#define | PRINTF_64_BIT_MODIFIER "ll"

Typedefs

typedef unsigned char | SLNet::UniqueIDType
typedef unsigned short | SLNet::SystemIndex
typedef unsigned char | SLNet::RPCIndex
typedef unsigned char | SLNet::MessageID
First byte of a network message.
typedef uint32_t | SLNet::BitSize_t
typedef uint64_t | SLNet::NetworkID

Enumerations

enum SLNet::StartupResult {
SLNet::RAKNET_STARTED, SLNet::RAKNET_ALREADY_STARTED, SLNet::INVALID_SOCKET_DESCRIPTORS, SLNet::INVALID_MAX_CONNECTIONS,
SLNet::SOCKET_FAMILY_NOT_SUPPORTED, SLNet::SOCKET_PORT_ALREADY_IN_USE, SLNet::SOCKET_FAILED_TO_BIND, SLNet::SOCKET_FAILED_TEST_SEND,
SLNet::PORT_CANNOT_BE_ZERO, SLNet::FAILED_TO_CREATE_NETWORK_THREAD, SLNet::COULD_NOT_GENERATE_GUID, SLNet::STARTUP_OTHER_FAILURE
}
enum SLNet::ConnectionAttemptResult {
SLNet::CONNECTION_ATTEMPT_STARTED, SLNet::INVALID_PARAMETER, SLNet::CANNOT_RESOLVE_DOMAIN_NAME, SLNet::ALREADY_CONNECTED_TO_ENDPOINT,
SLNet::CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS, SLNet::SECURITY_INITIALIZATION_FAILED
}
enum SLNet::ConnectionState {
SLNet::IS_PENDING, SLNet::IS_CONNECTING, SLNet::IS_CONNECTED, SLNet::IS_DISCONNECTING,
SLNet::IS_SILENTLY_DISCONNECTING, SLNet::IS_DISCONNECTED, SLNet::IS_NOT_CONNECTED
}
Returned from RakPeerInterface::GetConnectionState() More...
enum SLNet::PublicKeyMode { SLNet::PKM_INSECURE_CONNECTION, SLNet::PKM_ACCEPT_ANY_PUBLIC_KEY, SLNet::PKM_USE_KNOWN_PUBLIC_KEY, SLNet::PKM_USE_TWO_WAY_AUTHENTICATION }
Used with the PublicKey structure. More...

Functions

bool | SLNet::NonNumericHostString (const char *host)
const RakNetGUID | SLNet::UNASSIGNED_RAKNET_GUID ((uint64_t)-1)

Variables

const int | SLNet::MAX_RPC_MAP_SIZE =((RPCIndex)-1)-1
const int | SLNet::UNDEFINED_RPC_INDEX =((RPCIndex)-1)
const SystemAddress | SLNet::UNASSIGNED_SYSTEM_ADDRESS
Index of an invalid SystemAddress.
const SystemIndex | SLNet::UNASSIGNED_PLAYER_INDEX = 65535
Index of an unassigned player.
const NetworkID | SLNet::UNASSIGNED_NETWORK_ID = (uint64_t) -1
Unassigned object ID.
const int | SLNet::PING_TIMES_ARRAY_SIZE = 5

Detailed Description

Types used by RakNet, most of which involve user code.

Definition in file types.h.

Class Documentation

struct SLNet::PublicKey

Passed to RakPeerInterface::Connect()

Definition at line 133 of file types.h.

Class Members
char * | myPrivateKey | (Optional) Pointer to a private key of length cat::EasyHandshake::PRIVATE_KEY_BYTES
char * | myPublicKey | (Optional) Pointer to a public key of length cat::EasyHandshake::PUBLIC_KEY_BYTES
PublicKeyMode | publicKeyMode | How to interpret the public key, see above.
char * | remoteServerPublicKey | Pointer to a public key of length cat::EasyHandshake::PUBLIC_KEY_BYTES. See the Encryption sample.
struct SLNet::Packet

This represents a user message from another system.

Definition at line 434 of file types.h.

Class Members
BitSize_t | bitSize | The length of the data in bits.
unsigned char * | data | The data from the sender.
bool | deleteData |
RakNetGUID | guid | A unique identifier for the system that sent this packet, regardless of IP address (internal / external / remote system) Only valid once a connection has been established (ID_CONNECTION_REQUEST_ACCEPTED, or ID_NEW_INCOMING_CONNECTION) Until that time, will be UNASSIGNED_RAKNET_GUID
unsigned int | length | The length of the data in bytes.
SystemAddress | systemAddress | The system that send this packet.
bool | wasGeneratedLocally |

Macro Definition Documentation

#define BITS_TO_BYTES ( x ) (((x)+7)>>3)

Given a number of bits, return how many bytes are needed to represent that.

Definition at line 93 of file types.h.

Referenced by SLNet::BitStream::AddBitsAndReallocate(), SLNet::BitStream::AssertCopyData(), SLNet::BitStream::CopyData(), SLNet::HuffmanEncodingTree::DecodeArray(), SLNet::TableSerializer::DeserializeCell(), SLNet::BitStream::GetNumberOfBytesUsed(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::BitStream::PadWithZeroToByteLength(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::BitStream::PrintBits(), SLNet::BitStream::ReadBits(), SLNet::RakPeer::RunUpdateCycle(), SLNet::ReliabilityLayer::Send(), SLNet::RakPeer::SendBuffered(), SLNet::ReliabilityLayer::Update(), and SLNet::BitStream::Write().

#define BYTES_TO_BITS ( x ) ((x)<<3)

Definition at line 94 of file types.h.

Referenced by SLNet::PluginInterface2::AllocatePacketUnified(), SLNet::RakPeer::AllocPacket(), SLNet::TableSerializer::DeserializeCell(), SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::BitStream::IgnoreBytes(), SLNet::BitStream::PadWithZeroToByteLength(), SLNet::ProcessOfflineNetworkPacket(), SLNet::BitStream::ReadBitsFromIntegerRange(), SLNet::ReliabilityLayer::Send(), SLNet::RakPeer::SendBufferedList(), SLNet::RakPeer::SendOutOfBand(), SLNet::RakPeer::SendTTL(), SLNet::PluginInterface2::SendUnified(), SLNet::BitStream::SerializeBitsFromIntegerRange(), SLNet::ReliabilityLayer::Update(), SLNet::BitStream::Write(), and SLNet::BitStream::WriteBitsFromIntegerRange().

#define PRINTF_64_BIT_MODIFIER "ll"

Definition at line 108 of file types.h.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(), SLNet::StatisticsToString(), and SLNet::RakNetGUID::ToString().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPForwarder.h File Reference

  • include
  • slikenet
Classes | Namespaces | Enumerations
UDPForwarder.h File Reference

Forwards UDP datagrams. Independent of RakNet's protocol. More...

#include "NativeFeatureIncludes.h"
#include "Export.h"
#include "types.h"
#include "SocketIncludes.h"
#include "UDPProxyCommon.h"
#include "SimpleMutex.h"
#include "string.h"
#include "thread.h"
#include "DS_Queue.h"
#include "DS_OrderedList.h"
#include "LocklessTypes.h"
#include "DS_ThreadsafeAllocatingQueue.h"

Go to the source code of this file.

Classes

class | SLNet::UDPForwarder
Forwards UDP datagrams. Independent of RakNet's protocol. More...
struct | SLNet::UDPForwarder::ForwardEntry
struct | SLNet::UDPForwarder::StartForwardingInputStruct
struct | SLNet::UDPForwarder::StartForwardingOutputStruct
struct | SLNet::UDPForwarder::StopForwardingStruct

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Enumerations

enum SLNet::UDPForwarderResult {
SLNet::UDPFORWARDER_FORWARDING_ALREADY_EXISTS, SLNet::UDPFORWARDER_NO_SOCKETS, SLNet::UDPFORWARDER_BIND_FAILED, SLNet::UDPFORWARDER_INVALID_PARAMETERS,
SLNet::UDPFORWARDER_NOT_RUNNING, SLNet::UDPFORWARDER_SUCCESS, SLNet::UDPFORWARDER_RESULT_COUNT
}

Detailed Description

Forwards UDP datagrams. Independent of RakNet's protocol.

Definition in file UDPForwarder.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPProxyClient.h File Reference

  • include
  • slikenet
Classes | Namespaces
UDPProxyClient.h File Reference

A RakNet plugin performing networking to communicate with UDPProxyCoordinator. Ultimately used to tell UDPProxyServer to forward UDP packets. More...

#include "NativeFeatureIncludes.h"
#include "Export.h"
#include "types.h"
#include "PluginInterface2.h"
#include "DS_List.h"

Go to the source code of this file.

Classes

struct | SLNet::UDPProxyClientResultHandler
class | SLNet::UDPProxyClient
Communicates with UDPProxyCoordinator, in order to find a UDPProxyServer to forward our datagrams. More...
struct | SLNet::UDPProxyClient::ServerWithPing
struct | SLNet::UDPProxyClient::SenderAndTargetAddress
struct | SLNet::UDPProxyClient::PingServerGroup

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

A RakNet plugin performing networking to communicate with UDPProxyCoordinator. Ultimately used to tell UDPProxyServer to forward UDP packets.

Definition in file UDPProxyClient.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPProxyCommon.h File Reference

  • include
  • slikenet
Macros | Enumerations
UDPProxyCommon.h File Reference

Go to the source code of this file.

Macros

#define UDP_FORWARDER_MAXIMUM_TIMEOUT (60000 * 10)

Enumerations

enum UDPProxyMessages {
ID_UDP_PROXY_FORWARDING_SUCCEEDED, ID_UDP_PROXY_FORWARDING_NOTIFICATION, ID_UDP_PROXY_NO_SERVERS_ONLINE, ID_UDP_PROXY_RECIPIENT_GUID_NOT_CONNECTED_TO_COORDINATOR,
ID_UDP_PROXY_ALL_SERVERS_BUSY, ID_UDP_PROXY_IN_PROGRESS, ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR, ID_UDP_PROXY_PING_SERVERS_FROM_COORDINATOR_TO_CLIENT,
ID_UDP_PROXY_PING_SERVERS_REPLY_FROM_CLIENT_TO_COORDINATOR, ID_UDP_PROXY_FORWARDING_REQUEST_FROM_COORDINATOR_TO_SERVER, ID_UDP_PROXY_FORWARDING_REPLY_FROM_SERVER_TO_COORDINATOR, ID_UDP_PROXY_LOGIN_REQUEST_FROM_SERVER_TO_COORDINATOR,
ID_UDP_PROXY_LOGIN_SUCCESS_FROM_COORDINATOR_TO_SERVER, ID_UDP_PROXY_ALREADY_LOGGED_IN_FROM_COORDINATOR_TO_SERVER, ID_UDP_PROXY_NO_PASSWORD_SET_FROM_COORDINATOR_TO_SERVER, ID_UDP_PROXY_WRONG_PASSWORD_FROM_COORDINATOR_TO_SERVER
}

Macro Definition Documentation

#define UDP_FORWARDER_MAXIMUM_TIMEOUT (60000 * 10)

Definition at line 65 of file UDPProxyCommon.h.

Enumeration Type Documentation

enum UDPProxyMessages
Enumerator:
ID_UDP_PROXY_FORWARDING_SUCCEEDED
ID_UDP_PROXY_FORWARDING_NOTIFICATION
ID_UDP_PROXY_NO_SERVERS_ONLINE
ID_UDP_PROXY_RECIPIENT_GUID_NOT_CONNECTED_TO_COORDINATOR
ID_UDP_PROXY_ALL_SERVERS_BUSY
ID_UDP_PROXY_IN_PROGRESS
ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR
ID_UDP_PROXY_PING_SERVERS_FROM_COORDINATOR_TO_CLIENT
ID_UDP_PROXY_PING_SERVERS_REPLY_FROM_CLIENT_TO_COORDINATOR
ID_UDP_PROXY_FORWARDING_REQUEST_FROM_COORDINATOR_TO_SERVER
ID_UDP_PROXY_FORWARDING_REPLY_FROM_SERVER_TO_COORDINATOR
ID_UDP_PROXY_LOGIN_REQUEST_FROM_SERVER_TO_COORDINATOR
ID_UDP_PROXY_LOGIN_SUCCESS_FROM_COORDINATOR_TO_SERVER
ID_UDP_PROXY_ALREADY_LOGGED_IN_FROM_COORDINATOR_TO_SERVER
ID_UDP_PROXY_NO_PASSWORD_SET_FROM_COORDINATOR_TO_SERVER
ID_UDP_PROXY_WRONG_PASSWORD_FROM_COORDINATOR_TO_SERVER

Definition at line 44 of file UDPProxyCommon.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPProxyCoordinator.h File Reference

  • include
  • slikenet
Classes | Namespaces
UDPProxyCoordinator.h File Reference

Essentially maintains a list of servers running UDPProxyServer, and some state management for UDPProxyClient to find a free server to forward datagrams. More...

#include "NativeFeatureIncludes.h"
#include "Export.h"
#include "types.h"
#include "PluginInterface2.h"
#include "string.h"
#include "BitStream.h"
#include "DS_Queue.h"
#include "DS_OrderedList.h"

Go to the source code of this file.

Classes

class | SLNet::UDPProxyCoordinator
Middleman between UDPProxyServer and UDPProxyClient, maintaining a list of UDPProxyServer, and managing state for clients to find an available forwarding server. More...
struct | SLNet::UDPProxyCoordinator::SenderAndTargetAddress
struct | SLNet::UDPProxyCoordinator::ServerWithPing
struct | SLNet::UDPProxyCoordinator::ForwardingRequest

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

Essentially maintains a list of servers running UDPProxyServer, and some state management for UDPProxyClient to find a free server to forward datagrams.

Definition in file UDPProxyCoordinator.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPProxyServer.h File Reference

  • include
  • slikenet
Classes | Namespaces
UDPProxyServer.h File Reference

A RakNet plugin performing networking to communicate with UDPProxyServer. It allows UDPProxyServer to control our instance of UDPForwarder. More...

#include "NativeFeatureIncludes.h"
#include "Export.h"
#include "types.h"
#include "PluginInterface2.h"
#include "UDPForwarder.h"
#include "string.h"

Go to the source code of this file.

Classes

struct | SLNet::UDPProxyServerResultHandler
class | SLNet::UDPProxyServer
UDPProxyServer to control our instance of UDPForwarder. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Detailed Description

A RakNet plugin performing networking to communicate with UDPProxyServer. It allows UDPProxyServer to control our instance of UDPForwarder.

Definition in file UDPProxyServer.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/VariableDeltaSerializer.h File Reference

  • include
  • slikenet
Classes | Namespaces
VariableDeltaSerializer.h File Reference
#include "VariableListDeltaTracker.h"
#include "DS_MemoryPool.h"
#include "NativeTypes.h"
#include "BitStream.h"
#include "PacketPriority.h"
#include "DS_OrderedList.h"

Go to the source code of this file.

Classes

class | SLNet::VariableDeltaSerializer
Class to compare memory values of variables in a current state to a prior state Results of the comparisons will be written to a bitStream, such that only changed variables get written
Can be used with ReplicaManager3 to Serialize a Replica3 per-variable, rather than comparing the entire object against itself
Usage:
BR> More...
struct | SLNet::VariableDeltaSerializer::SerializationContext
struct | SLNet::VariableDeltaSerializer::DeserializationContext
struct | SLNet::VariableDeltaSerializer::ChangedVariablesList
struct | SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Class Documentation

struct SLNet::VariableDeltaSerializer::DeserializationContext

Definition at line 73 of file VariableDeltaSerializer.h.

Class Members
BitStream * bitStream
struct SLNet::VariableDeltaSerializer::ChangedVariablesList

Definition at line 224 of file VariableDeltaSerializer.h.

Class Members
unsigned char | bitField
unsigned short | bitWriteIndex
uint32_t | sendReceipt
struct SLNet::VariableDeltaSerializer::RemoteSystemVariableHistory

Definition at line 238 of file VariableDeltaSerializer.h.

Class Members
RakNetGUID | guid
OrderedList< uint32_t, ChangedVariablesList *, UpdatedVariablesListPtrComp > | updatedVariablesHistory
VariableListDeltaTracker | variableListDeltaTracker
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/VariableListDeltaTracker.h File Reference

  • include
  • slikenet
Classes | Namespaces
VariableListDeltaTracker.h File Reference
#include "NativeTypes.h"
#include "DS_List.h"
#include "memoryoverride.h"
#include "BitStream.h"

Go to the source code of this file.

Classes

class | SLNet::VariableListDeltaTracker
struct | SLNet::VariableListDeltaTracker::VariableLastValueNode

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/VariadicSQLParser.h File Reference

  • include
  • slikenet
Classes | Namespaces | Functions
VariadicSQLParser.h File Reference
#include "DS_List.h"
#include <stdarg.h>

Go to the source code of this file.

Classes

struct VariadicSQLParser::IndexAndType

Namespaces

namespace VariadicSQLParser

Functions

const char * | VariadicSQLParser::GetTypeMappingAtIndex (int i)
void | VariadicSQLParser::GetTypeMappingIndices (const char *format, DataStructures::List< IndexAndType > &indices)
void | VariadicSQLParser::ExtractArguments (va_list argptr, const DataStructures::List< IndexAndType > &indices, char ***argumentBinary, int **argumentLengths)
void | VariadicSQLParser::FreeArguments (const DataStructures::List< IndexAndType > &indices, char **argumentBinary, int *argumentLengths)

Class Documentation

struct VariadicSQLParser::IndexAndType

Definition at line 20 of file VariadicSQLParser.h.

Class Members
unsigned int | strIndex
unsigned int | typeMappingIndex
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/version.h File Reference

  • include
  • slikenet
Macros
version.h File Reference

Go to the source code of this file.

Macros

#define | RAKNET_VERSION "4.082"
#define | RAKNET_VERSION_NUMBER 4.082
#define | RAKNET_VERSION_NUMBER_INT 4082
#define | RAKNET_DATE "7/26/2017"
#define | SLIKENET_VERSION "0.1.3"
#define | SLIKENET_VERSION_NUMBER 0.1.3
#define | SLIKENET_VERSION_NUMBER_INT 000103
#define | SLIKENET_DATE "23/08/2019"
#define | RAKNET_PROTOCOL_VERSION 6

Macro Definition Documentation

#define RAKNET_DATE "7/26/2017"

Definition at line 21 of file version.h.

#define RAKNET_PROTOCOL_VERSION 6

Definition at line 30 of file version.h.

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

#define RAKNET_VERSION "4.082"

Definition at line 18 of file version.h.

#define RAKNET_VERSION_NUMBER 4.082

Definition at line 19 of file version.h.

#define RAKNET_VERSION_NUMBER_INT 4082

Definition at line 20 of file version.h.

#define SLIKENET_DATE "23/08/2019"

Definition at line 26 of file version.h.

#define SLIKENET_VERSION "0.1.3"

Definition at line 23 of file version.h.

#define SLIKENET_VERSION_NUMBER 0.1.3

Definition at line 24 of file version.h.

#define SLIKENET_VERSION_NUMBER_INT 000103

Definition at line 25 of file version.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/VitaIncludes.h File Reference

  • include
  • slikenet
VitaIncludes.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/WindowsIncludes.h File Reference

  • include
  • slikenet
Macros
WindowsIncludes.h File Reference

Go to the source code of this file.

Macros

#define NOMINMAX

Macro Definition Documentation

#define NOMINMAX

Definition at line 16 of file WindowsIncludes.h.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/WSAStartupSingleton.h File Reference

  • include
  • slikenet
Classes
WSAStartupSingleton.h File Reference

Go to the source code of this file.

Classes

class WSAStartupSingleton
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/wstring.h File Reference

  • include
  • slikenet
Classes | Namespaces | Functions
wstring.h File Reference
#include "Export.h"
#include "types.h"
#include "string.h"

Go to the source code of this file.

Classes

class SLNet::RakWString
String class for Unicode. More...

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Functions

const SLNet::RakWString
RAK_DLL_EXPORT 		operator+ (const SLNet::RakWString &lhs, const SLNet::RakWString &rhs)

Function Documentation

const SLNet::RakWString RAK_DLL_EXPORT operator+ | ( | const SLNet::RakWString & | lhs,
 |  | const SLNet::RakWString & | rhs
 | ) |  |

Definition at line 439 of file RakWString.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/XBox360Includes.h File Reference

  • include
  • slikenet
XBox360Includes.h File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src Directory Reference

  • src
src Directory Reference

Files

file | _FindFirst.cpp [code]
file | Base64Encoder.cpp [code]
file | BitStream.cpp [code]
file | CCRakNetSlidingWindow.cpp [code]
file | CCRakNetUDT.cpp [code]
file | CheckSum.cpp [code]
CheckSum implementation from http://www.flounder.com/checksum.htm.
file | CloudClient.cpp [code]
file | CloudCommon.cpp [code]
file | CloudServer.cpp [code]
file | CommandParserInterface.cpp [code]
file | ConnectionGraph2.cpp [code]
file | ConsoleServer.cpp [code]
file | DataCompressor.cpp [code]
file | DirectoryDeltaTransfer.cpp [code]
file | DR_SHA1.cpp [code]
file | DS_BytePool.cpp [code]
file | DS_ByteQueue.cpp [code]
file | DS_HuffmanEncodingTree.cpp [code]
file | DS_Table.cpp [code]
file | DynDNS.cpp [code]
file | EmailSender.cpp [code]
file | EpochTimeToString.cpp [code]
file | FileList.cpp [code]
file | FileListTransfer.cpp [code]
file | FileOperations.cpp [code]
file | FormatString.cpp [code]
file | FullyConnectedMesh2.cpp [code]
file | Getche.cpp [code]
file | Gets.cpp [code]
file | GetTime.cpp [code]
file | gettimeofday.cpp [code]
file | GridSectorizer.cpp [code]
file | HTTPConnection.cpp [code]
Contains HTTPConnection, used to communicate with web servers.
file | HTTPConnection2.cpp [code]
file | IncrementalReadInterface.cpp [code]
file | Itoa.cpp [code]
file | linux_adapter.cpp [code]
file | LinuxStrings.cpp [code]
file | LocklessTypes.cpp [code]
file | LogCommandParser.cpp [code]
file | MessageFilter.cpp [code]
file | NatPunchthroughClient.cpp [code]
file | NatPunchthroughServer.cpp [code]
file | NatTypeDetectionClient.cpp [code]
file | NatTypeDetectionCommon.cpp [code]
file | NatTypeDetectionServer.cpp [code]
file | NetworkIDManager.cpp [code]
file | NetworkIDObject.cpp [code]
file | osx_adapter.cpp [code]
file | PacketConsoleLogger.cpp [code]
file | PacketFileLogger.cpp [code]
file | PacketizedTCP.cpp [code]
file | PacketLogger.cpp [code]
file | PacketOutputWindowLogger.cpp [code]
file | PluginInterface2.cpp [code]
file | PS4Includes.cpp [code]
file | Rackspace.cpp [code]
file | RakMemoryOverride.cpp [code]
file | RakNetCommandParser.cpp [code]
file | RakNetSocket.cpp [code]
file | RakNetSocket2.cpp [code]
file | RakNetSocket2_360_720.cpp [code]
file | RakNetSocket2_Berkley.cpp [code]
file | RakNetSocket2_Berkley_NativeClient.cpp [code]
file | RakNetSocket2_NativeClient.cpp [code]
file | RakNetSocket2_PS3_PS4.cpp [code]
file | RakNetSocket2_PS4.cpp [code]
file | RakNetSocket2_Vita.cpp [code]
file | RakNetSocket2_Windows_Linux.cpp [code]
file | RakNetSocket2_Windows_Linux_360.cpp [code]
file | RakNetSocket2_WindowsStore8.cpp [code]
file | RakNetStatistics.cpp [code]
file | RakNetTransport2.cpp [code]
file | RakNetTypes.cpp [code]
file | RakPeer.cpp [code]
file | RakSleep.cpp [code]
file | RakString.cpp [code]
file | RakThread.cpp [code]
file | RakWString.cpp [code]
file | Rand.cpp [code]
file | RandSync.cpp [code]
file | ReadyEvent.cpp [code]
file | RelayPlugin.cpp [code]
file | ReliabilityLayer.cpp [code]
file | ReplicaManager3.cpp [code]
file | Router2.cpp [code]
file | RPC4Plugin.cpp [code]
file | SecureHandshake.cpp [code]
file | SendToThread.cpp [code]
file | SignaledEvent.cpp [code]
file | SimpleMutex.cpp [code]
file | SocketLayer.cpp [code]
SocketLayer class implementation.
file | StatisticsHistory.cpp [code]
file | StringCompressor.cpp [code]
file | StringTable.cpp [code]
file | SuperFastHash.cpp [code]
file | TableSerializer.cpp [code]
file | TCPInterface.cpp [code]
file | TeamBalancer.cpp [code]
file | TeamManager.cpp [code]
file | TelnetTransport.cpp [code]
file | ThreadsafePacketLogger.cpp [code]
file | TwoWayAuthentication.cpp [code]
file | UDPForwarder.cpp [code]
file | UDPProxyClient.cpp [code]
file | UDPProxyCoordinator.cpp [code]
file | UDPProxyServer.cpp [code]
file | VariableDeltaSerializer.cpp [code]
file | VariableListDeltaTracker.cpp [code]
file | VariadicSQLParser.cpp [code]
file | VitaIncludes.cpp [code]
file | WSAStartupSingleton.cpp [code]
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/_FindFirst.cpp File Reference

  • src
_FindFirst.cpp File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Base64Encoder.cpp File Reference

  • src
Functions | Variables
Base64Encoder.cpp File Reference
#include "slikenet/Base64Encoder.h"
#include "slikenet/memoryoverride.h"

Go to the source code of this file.

Functions

const char * | Base64Map (void)
int | Base64Encoding (const unsigned char *inputData, int dataLength, char *outputData)
Returns how many bytes were written.
int | Base64Encoding (const unsigned char *inputData, int dataLength, char **outputData)

Variables

const char * base64Map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Function Documentation

int Base64Encoding | ( | const unsigned char * | inputData,
 |  | int | dataLength,
 |  | char * | outputData
 | ) |  |

Returns how many bytes were written.

Definition at line 23 of file Base64Encoder.cpp.

References base64Map.

Referenced by Base64Encoding().

int Base64Encoding | ( | const unsigned char * | inputData,
 |  | int | dataLength,
 |  | char ** | outputData
 | ) |  |

Definition at line 96 of file Base64Encoder.cpp.

References _FILE_AND_LINE_, Base64Encoding(), and rakMalloc_Ex.

const char* Base64Map ( void )

Definition at line 19 of file Base64Encoder.cpp.

Variable Documentation

const char* base64Map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Definition at line 20 of file Base64Encoder.cpp.

Referenced by Base64Encoding().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/BitStream.cpp File Reference

  • src
Macros
BitStream.cpp File Reference
#include "slikenet/BitStream.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "slikenet/SocketIncludes.h"
#include "slikenet/defines.h"
#include <arpa/inet.h>
#include <memory.h>
#include <cmath>
#include <float.h>
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Macros

#define _copysign copysign

Macro Definition Documentation

#define _copysign copysign

Definition at line 53 of file BitStream.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CCRakNetSlidingWindow.cpp File Reference

  • src
CCRakNetSlidingWindow.cpp File Reference
#include "slikenet/CCRakNetSlidingWindow.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CCRakNetUDT.cpp File Reference

  • src
Macros | Variables
CCRakNetUDT.cpp File Reference
#include "slikenet/CCRakNetUDT.h"
#include "slikenet/Rand.h"
#include "slikenet/MTUSize.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "slikenet/assert.h"
#include "slikenet/alloca.h"

Go to the source code of this file.

Macros

#define | MAX_RTT 1000000
#define | RTT_TOLERANCE 30000

Variables

static const double | UNSET_TIME_US =-1
static const double | CWND_MIN_THRESHOLD =2.0
static const double | UNDEFINED_TRANSFER_RATE =0.0
static const CCTimeType | SYN =10000
double | RTTVarMultiple =4.0

Macro Definition Documentation

#define MAX_RTT 1000000

Definition at line 48 of file CCRakNetUDT.cpp.

#define RTT_TOLERANCE 30000

Definition at line 49 of file CCRakNetUDT.cpp.

Variable Documentation

const double CWND_MIN_THRESHOLD =2.0
static

Definition at line 32 of file CCRakNetUDT.cpp.

double RTTVarMultiple =4.0

Definition at line 53 of file CCRakNetUDT.cpp.

const CCTimeType SYN =10000
static

Interval at which to update aspects of the system

  1. send acks
  2. update time interval between outgoing packets 3, Yodate retransmit timeout

Definition at line 41 of file CCRakNetUDT.cpp.

const double UNDEFINED_TRANSFER_RATE =0.0
static

Definition at line 33 of file CCRakNetUDT.cpp.

const double UNSET_TIME_US =-1
static

Definition at line 31 of file CCRakNetUDT.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CheckSum.cpp File Reference

  • src
CheckSum.cpp File Reference

CheckSum implementation from http://www.flounder.com/checksum.htm. More...

#include "slikenet/CheckSum.h"

Go to the source code of this file.

Detailed Description

CheckSum implementation from http://www.flounder.com/checksum.htm.

[Internal] CheckSum implementation from http://www.flounder.com/checksum.htm

Definition in file CheckSum.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CloudClient.cpp File Reference

  • src
CloudClient.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CloudCommon.cpp File Reference

  • src
CloudCommon.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CloudServer.cpp File Reference

  • src
CloudServer.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CommandParserInterface.cpp File Reference

  • src
CommandParserInterface.cpp File Reference
#include "slikenet/CommandParserInterface.h"
#include "slikenet/TransportInterface.h"
#include <string.h>
#include "slikenet/assert.h"
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "slikenet/LinuxStrings.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ConnectionGraph2.cpp File Reference

  • src
ConnectionGraph2.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ConsoleServer.cpp File Reference

  • src
ConsoleServer.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DataCompressor.cpp File Reference

  • src
DataCompressor.cpp File Reference
#include "slikenet/DataCompressor.h"
#include "slikenet/DS_HuffmanEncodingTree.h"
#include "slikenet/assert.h"
#include <string.h>

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DirectoryDeltaTransfer.cpp File Reference

  • src
DirectoryDeltaTransfer.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DR_SHA1.cpp File Reference

  • src
Macros
DR_SHA1.cpp File Reference
#include "slikenet/DR_SHA1.h"
#include <stdlib.h>

Go to the source code of this file.

Macros

#define | _CRT_SECURE_NO_WARNINGS
#define | SHA1_MAX_FILE_BUFFER (32 * 20 * 820)
#define | ROL32(p_val32, p_nBits) (((p_val32)<<(p_nBits))|((p_val32)>>(32-(p_nBits))))
#define | SHABLK0(i) (m_block->l[i])
#define | SHABLK(i)
#define | S_R0(v, w, x, y, z, i) {z+=((w&(x^y))^y)+SHABLK0(i)+0x5A827999+ROL32(v,5);w=ROL32(w,30);}
#define | S_R1(v, w, x, y, z, i) {z+=((w&(x^y))^y)+SHABLK(i)+0x5A827999+ROL32(v,5);w=ROL32(w,30);}
#define | S_R2(v, w, x, y, z, i) {z+=(w^x^y)+SHABLK(i)+0x6ED9EBA1+ROL32(v,5);w=ROL32(w,30);}
#define | S_R3(v, w, x, y, z, i) {z+=(((w|x)&y)|(w&x))+SHABLK(i)+0x8F1BBCDC+ROL32(v,5);w=ROL32(w,30);}
#define | S_R4(v, w, x, y, z, i) {z+=(w^x^y)+SHABLK(i)+0xCA62C1D6+ROL32(v,5);w=ROL32(w,30);}

Macro Definition Documentation

#define _CRT_SECURE_NO_WARNINGS

Definition at line 19 of file DR_SHA1.cpp.

#define ROL32 | ( | p_val32,
 |  | p_nBits
 | ) | (((p_val32)<<(p_nBits))|((p_val32)>>(32-(p_nBits))))

Definition at line 30 of file DR_SHA1.cpp.

#define S_R0 | ( | v,
 |  | w,
 |  | x,
 |  | y,
 |  | z,
 |  | i
 | ) | {z+=((w&(x^y))^y)+SHABLK0(i)+0x5A827999+ROL32(v,5);w=ROL32(w,30);}

Definition at line 45 of file DR_SHA1.cpp.

#define S_R1 | ( | v,
 |  | w,
 |  | x,
 |  | y,
 |  | z,
 |  | i
 | ) | {z+=((w&(x^y))^y)+SHABLK(i)+0x5A827999+ROL32(v,5);w=ROL32(w,30);}

Definition at line 46 of file DR_SHA1.cpp.

#define S_R2 | ( | v,
 |  | w,
 |  | x,
 |  | y,
 |  | z,
 |  | i
 | ) | {z+=(w^x^y)+SHABLK(i)+0x6ED9EBA1+ROL32(v,5);w=ROL32(w,30);}

Definition at line 47 of file DR_SHA1.cpp.

#define S_R3 | ( | v,
 |  | w,
 |  | x,
 |  | y,
 |  | z,
 |  | i
 | ) | {z+=(((w|x)&y)|(w&x))+SHABLK(i)+0x8F1BBCDC+ROL32(v,5);w=ROL32(w,30);}

Definition at line 48 of file DR_SHA1.cpp.

#define S_R4 | ( | v,
 |  | w,
 |  | x,
 |  | y,
 |  | z,
 |  | i
 | ) | {z+=(w^x^y)+SHABLK(i)+0xCA62C1D6+ROL32(v,5);w=ROL32(w,30);}

Definition at line 49 of file DR_SHA1.cpp.

#define SHA1_MAX_FILE_BUFFER (32 * 20 * 820)

Definition at line 23 of file DR_SHA1.cpp.

#define SHABLK ( i )
Value:
(m_block->l[i&15] = ROL32(m_block->l[(i+13)&15] ^ \
m_block->l[(i+8)&15] ^ m_block->l[(i+2)&15] ^ m_block->l[i&15],1))

Definition at line 41 of file DR_SHA1.cpp.

#define SHABLK0 ( i ) (m_block->l[i])

Definition at line 38 of file DR_SHA1.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DS_BytePool.cpp File Reference

  • src
DS_BytePool.cpp File Reference
#include "slikenet/DS_BytePool.h"
#include "slikenet/assert.h"
#include <stdlib.h>

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DS_ByteQueue.cpp File Reference

  • src
DS_ByteQueue.cpp File Reference
#include "slikenet/DS_ByteQueue.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DS_HuffmanEncodingTree.cpp File Reference

  • src
DS_HuffmanEncodingTree.cpp File Reference
#include "slikenet/DS_HuffmanEncodingTree.h"
#include "slikenet/DS_Queue.h"
#include "slikenet/BitStream.h"
#include "slikenet/assert.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DS_Table.cpp File Reference

  • src
Functions | Variables
DS_Table.cpp File Reference
#include "slikenet/DS_Table.h"
#include "slikenet/DS_OrderedList.h"
#include <string.h>
#include "slikenet/assert.h"
#include "slikenet/Itoa.h"
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Functions

void | ExtendRows (Table::Row *input, int index)
void | FreeRow (Table::Row *input, int index)
int | RowSort (Table::Row *const &first, Table::Row *const &second)

Variables

static Table::SortQuery * | _sortQueries
static unsigned | _numSortQueries
static DataStructures::List
< unsigned > * 		_columnIndices
static DataStructures::List
< Table::ColumnDescriptor > * 		_columns

Function Documentation

void ExtendRows | ( | Table::Row * | input,
 |  | int | index
 | ) |  |

Definition at line 27 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Row::cells, and DataStructures::List< list_type >::Insert().

Referenced by DataStructures::Table::AddColumn().

void FreeRow | ( | Table::Row * | input,
 |  | int | index
 | ) |  |

Definition at line 32 of file DS_Table.cpp.

References _FILE_AND_LINE_, DataStructures::Table::Row::cells, SLNet::OP_DELETE(), and DataStructures::List< list_type >::Size().

Referenced by DataStructures::Table::Clear().

int RowSort | ( | Table::Row *const & | first,
 |  | Table::Row *const & | second
 | ) |  |

Definition at line 849 of file DS_Table.cpp.

References _columns, _numSortQueries, _sortQueries, DataStructures::Table::Row::cells, DataStructures::Table::NUMERIC, and DataStructures::Table::QS_INCREASING_ORDER.

Variable Documentation

DataStructures::List<unsigned>* _columnIndices
static

Definition at line 847 of file DS_Table.cpp.

Referenced by DataStructures::Table::SortTable().

DataStructures::List<Table::ColumnDescriptor>* _columns
static

Definition at line 848 of file DS_Table.cpp.

Referenced by RowSort(), and DataStructures::Table::SortTable().

unsigned _numSortQueries
static

Definition at line 846 of file DS_Table.cpp.

Referenced by RowSort(), and DataStructures::Table::SortTable().

Table::SortQuery* _sortQueries
static

Definition at line 845 of file DS_Table.cpp.

Referenced by RowSort(), and DataStructures::Table::SortTable().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DynDNS.cpp File Reference

  • src
DynDNS.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/EmailSender.cpp File Reference

  • src
EmailSender.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/EpochTimeToString.cpp File Reference

  • src
Functions
EpochTimeToString.cpp File Reference
#include "slikenet/FormatString.h"
#include "slikenet/EpochTimeToString.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>
#include "slikenet/LinuxStrings.h"
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Functions

char * EpochTimeToString (long long time)

Function Documentation

char* EpochTimeToString ( long long time )

Definition at line 27 of file EpochTimeToString.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FileList.cpp File Reference

  • src
FileList.cpp File Reference
#include "slikenet/FileList.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FileListTransfer.cpp File Reference

  • src
FileListTransfer.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FileOperations.cpp File Reference

  • src
FileOperations.cpp File Reference
#include "slikenet/FileOperations.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FormatString.cpp File Reference

  • src
Functions
FormatString.cpp File Reference
#include "slikenet/FormatString.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "slikenet/LinuxStrings.h"
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Functions

char * | FormatString (const char *format,...)
char * | FormatStringTS (char *output, const char *format,...)

Function Documentation

char* FormatString | ( | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 24 of file FormatString.cpp.

char* FormatStringTS | ( | char * | output,
 |  | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 39 of file FormatString.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FullyConnectedMesh2.cpp File Reference

  • src
FullyConnectedMesh2.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Getche.cpp File Reference

  • src
Functions
Getche.cpp File Reference
#include "slikenet/Getche.h"

Go to the source code of this file.

Functions

char _getche ()

Function Documentation

char _getche ( )

Definition at line 24 of file Getche.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Gets.cpp File Reference

  • src
Functions
Gets.cpp File Reference
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Functions

char * Gets (char *str, int num)

Function Documentation

char* Gets | ( | char * | str,
 |  | int | num
 | ) |  |

Definition at line 18 of file Gets.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/GetTime.cpp File Reference

  • src
Variables
GetTime.cpp File Reference
#include "slikenet/GetTime.h"
#include <sys/time.h>
#include <unistd.h>

Go to the source code of this file.

Variables

SLNet::TimeUS initialTime
static bool initialized =false

Variable Documentation

bool initialized =false
static

Definition at line 55 of file GetTime.cpp.

SLNet::TimeUS initialTime

Definition at line 52 of file GetTime.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/gettimeofday.cpp File Reference

  • src
gettimeofday.cpp File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/GridSectorizer.cpp File Reference

  • src
GridSectorizer.cpp File Reference
#include "slikenet/assert.h"
#include "slikenet/GridSectorizer.h"
#include <math.h>

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/HTTPConnection.cpp File Reference

  • src
HTTPConnection.cpp File Reference

Contains HTTPConnection, used to communicate with web servers. More...

#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Detailed Description

Contains HTTPConnection, used to communicate with web servers.

Definition in file HTTPConnection.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/HTTPConnection2.cpp File Reference

  • src
HTTPConnection2.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/IncrementalReadInterface.cpp File Reference

  • src
IncrementalReadInterface.cpp File Reference
#include "slikenet/IncrementalReadInterface.h"
#include <stdio.h>
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Itoa.cpp File Reference

  • src
Functions
Itoa.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Functions

char * Itoa (int value, char *result, int base)

Function Documentation

char* Itoa | ( | int | value,
 |  | char * | result,
 |  | int | base
 | ) |  |

Definition at line 24 of file Itoa.cpp.

Referenced by SLNet::SystemAddress::ToString_Old(), and SLNet::RakString::URLEncode().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/linux_adapter.cpp File Reference

  • src
linux_adapter.cpp File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/LinuxStrings.cpp File Reference

  • src
LinuxStrings.cpp File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/LocklessTypes.cpp File Reference

  • src
LocklessTypes.cpp File Reference
#include "slikenet/LocklessTypes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/LogCommandParser.cpp File Reference

  • src
LogCommandParser.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/MessageFilter.cpp File Reference

  • src
MessageFilter.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatPunchthroughClient.cpp File Reference

  • src
NatPunchthroughClient.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatPunchthroughServer.cpp File Reference

  • src
NatPunchthroughServer.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatTypeDetectionClient.cpp File Reference

  • src
NatTypeDetectionClient.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatTypeDetectionCommon.cpp File Reference

  • src
NatTypeDetectionCommon.cpp File Reference
#include "slikenet/NatTypeDetectionCommon.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatTypeDetectionServer.cpp File Reference

  • src
NatTypeDetectionServer.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NetworkIDManager.cpp File Reference

  • src
NetworkIDManager.cpp File Reference
#include "slikenet/NetworkIDManager.h"
#include "slikenet/NetworkIDObject.h"
#include "slikenet/assert.h"
#include "slikenet/GetTime.h"
#include "slikenet/sleep.h"
#include "slikenet/SuperFastHash.h"
#include "slikenet/peerinterface.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NetworkIDObject.cpp File Reference

  • src
NetworkIDObject.cpp File Reference
#include "slikenet/NetworkIDObject.h"
#include "slikenet/NetworkIDManager.h"
#include "slikenet/assert.h"
#include "slikenet/alloca.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/osx_adapter.cpp File Reference

  • src
osx_adapter.cpp File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketConsoleLogger.cpp File Reference

  • src
PacketConsoleLogger.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketFileLogger.cpp File Reference

  • src
PacketFileLogger.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketizedTCP.cpp File Reference

  • src
PacketizedTCP.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketLogger.cpp File Reference

  • src
PacketLogger.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketOutputWindowLogger.cpp File Reference

  • src
PacketOutputWindowLogger.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PluginInterface2.cpp File Reference

  • src
PluginInterface2.cpp File Reference
#include "slikenet/PluginInterface2.h"
#include "slikenet/PacketizedTCP.h"
#include "slikenet/peerinterface.h"
#include "slikenet/BitStream.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PS4Includes.cpp File Reference

  • src
PS4Includes.cpp File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Rackspace.cpp File Reference

  • src
Rackspace.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakMemoryOverride.cpp File Reference

  • src
Functions | Variables
RakMemoryOverride.cpp File Reference
#include "slikenet/memoryoverride.h"
#include "slikenet/assert.h"
#include <stdlib.h>

Go to the source code of this file.

Functions

void | DefaultOutOfMemoryHandler (const char *file, const long line)
void | SetMalloc (void *(*userFunction)(size_t size))
void | SetRealloc (void *(*userFunction)(void *p, size_t size))
void | SetFree (void(*userFunction)(void *p))
void | SetMalloc_Ex (void *(*userFunction)(size_t size, const char *file, unsigned int line))
void | SetRealloc_Ex (void *(*userFunction)(void *p, size_t size, const char *file, unsigned int line))
void | SetFree_Ex (void(*userFunction)(void *p, const char *file, unsigned int line))
void | SetNotifyOutOfMemory (void(*userFunction)(const char *file, const long line))
void | SetDLMallocMMap (void *(*userFunction)(size_t size))
void | SetDLMallocDirectMMap (void *(*userFunction)(size_t size))
void | SetDLMallocMUnmap (int(*userFunction)(void *ptr, size_t size))
void * | _DLMalloc (size_t size)
void * | _DLRealloc (void *p, size_t size)
void | _DLFree (void *p)
void * | _DLMalloc_Ex (size_t size, const char *file, unsigned int line)
void * | _DLRealloc_Ex (void *p, size_t size, const char *file, unsigned int line)
void | _DLFree_Ex (void *p, const char *file, unsigned int line)
void | UseRaknetFixedHeap (size_t initialCapacity, void *(*yourMMapFunction)(size_t size), void *(*yourDirectMMapFunction)(size_t size), int(*yourMUnmapFunction)(void *p, size_t size))
void | FreeRakNetFixedHeap (void)

Variables

void *(* | rakMalloc )(size_t size) = SLNet::_RakMalloc
void *(* | rakRealloc )(void *p, size_t size) = SLNet::_RakRealloc
void(* | rakFree )(void *p) = SLNet::_RakFree
void *(* | rakMalloc_Ex )(size_t size, const char *file, unsigned int line) = SLNet::_RakMalloc_Ex
void *(* | rakRealloc_Ex )(void *p, size_t size, const char *file, unsigned int line) = SLNet::_RakRealloc_Ex
void(* | rakFree_Ex )(void *p, const char *file, unsigned int line) = SLNet::_RakFree_Ex
void(* | notifyOutOfMemory )(const char *file, const long line) =DefaultOutOfMemoryHandler
void *(* | dlMallocMMap )(size_t size) = SLNet::_DLMallocMMap
void *(* | dlMallocDirectMMap )(size_t size) = SLNet::_DLMallocDirectMMap
int(* | dlMallocMUnmap )(void *ptr, size_t size) = SLNet::_DLMallocMUnmap
void *(*)(size_t size) | GetMalloc ()
void *(*)(void *p, size_t size) | GetRealloc ()
void(*)(void *p) | GetFree ()
void *(*)(size_t size, const
char *file, unsigned int line) 		GetMalloc_Ex ()
void *(*)(void *p, size_t size,
const char *file, unsigned int
line) 		GetRealloc_Ex ()
void(*)(void *p, const char
*file, unsigned int line) 		GetFree_Ex ()
void *(*)(size_t size) | GetDLMallocMMap ()
void *(*)(size_t size) | GetDLMallocDirectMMap ()
int(*)(void *ptr, size_t size) | GetDLMallocMUnmap ()

Function Documentation

void _DLFree ( void * p )

Definition at line 278 of file RakMemoryOverride.cpp.

void _DLFree_Ex | ( | void * | p,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 281 of file RakMemoryOverride.cpp.

void* _DLMalloc ( size_t size )

Definition at line 276 of file RakMemoryOverride.cpp.

void* _DLMalloc_Ex | ( | size_t | size,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 279 of file RakMemoryOverride.cpp.

void* _DLRealloc | ( | void * | p,
 |  | size_t | size
 | ) |  |

Definition at line 277 of file RakMemoryOverride.cpp.

void* _DLRealloc_Ex | ( | void * | p,
 |  | size_t | size,
 |  | const char * | file,
 |  | unsigned int | line
 | ) |  |

Definition at line 280 of file RakMemoryOverride.cpp.

void DefaultOutOfMemoryHandler | ( | const char * | file,
 |  | const long | line
 | ) |  |

Definition at line 52 of file RakMemoryOverride.cpp.

References RakAssert.

void FreeRakNetFixedHeap ( void )

Definition at line 293 of file RakMemoryOverride.cpp.

void SetDLMallocDirectMMap ( void *(*)(size_t size) userFunction )

Definition at line 102 of file RakMemoryOverride.cpp.

References dlMallocDirectMMap.

void SetDLMallocMMap ( void *(*)(size_t size) userFunction )

Definition at line 98 of file RakMemoryOverride.cpp.

References dlMallocMMap.

void SetDLMallocMUnmap ( int(*)(void *ptr, size_t size) userFunction )

Definition at line 106 of file RakMemoryOverride.cpp.

References dlMallocMUnmap.

void SetFree ( void(*)(void *p) userFunction )

Definition at line 78 of file RakMemoryOverride.cpp.

References rakFree.

void SetFree_Ex ( void(*)(void *p, const char *file, unsigned int line) userFunction )

Definition at line 90 of file RakMemoryOverride.cpp.

References rakFree_Ex.

void SetMalloc ( void *(*)(size_t size) userFunction )

Definition at line 70 of file RakMemoryOverride.cpp.

References rakMalloc.

void SetMalloc_Ex ( void *(*)(size_t size, const char *file, unsigned int line) userFunction )

Definition at line 82 of file RakMemoryOverride.cpp.

References rakMalloc_Ex.

void SetNotifyOutOfMemory ( void(*)(const char *file, const long line) userFunction )

Definition at line 94 of file RakMemoryOverride.cpp.

References notifyOutOfMemory.

void SetRealloc ( void *(*)(void *p, size_t size) userFunction )

Definition at line 74 of file RakMemoryOverride.cpp.

References rakRealloc.

void SetRealloc_Ex ( void *(*)(void *p, size_t size, const char *file, unsigned int line) userFunction )

Definition at line 86 of file RakMemoryOverride.cpp.

References rakRealloc_Ex.

void UseRaknetFixedHeap | ( | size_t | initialCapacity,
 |  | void *(*)(size_t size) | yourMMapFunction,
 |  | void *(*)(size_t size) | yourDirectMMapFunction,
 |  | int(*)(void *p, size_t size) | yourMUnmapFunction
 | ) |  |

Definition at line 283 of file RakMemoryOverride.cpp.

Variable Documentation

void*(* dlMallocDirectMMap)(size_t size) = SLNet::_DLMallocDirectMMap

Definition at line 67 of file RakMemoryOverride.cpp.

Referenced by SetDLMallocDirectMMap().

void*(* dlMallocMMap)(size_t size) = SLNet::_DLMallocMMap

Definition at line 66 of file RakMemoryOverride.cpp.

Referenced by SetDLMallocMMap().

int(* dlMallocMUnmap)(void *ptr, size_t size) = SLNet::_DLMallocMUnmap

Definition at line 68 of file RakMemoryOverride.cpp.

Referenced by SetDLMallocMUnmap().

void*(*)(size_t size) GetDLMallocDirectMMap()

Definition at line 138 of file RakMemoryOverride.cpp.

void*(*)(size_t size) GetDLMallocMMap()

Definition at line 134 of file RakMemoryOverride.cpp.

int(*)(void* ptr, size_t size) GetDLMallocMUnmap()

Definition at line 142 of file RakMemoryOverride.cpp.

void(*)(void *p) GetFree()

Definition at line 118 of file RakMemoryOverride.cpp.

void(*)(void *p, const char *file, unsigned int line) GetFree_Ex()

Definition at line 130 of file RakMemoryOverride.cpp.

Referenced by SLNet::OP_DELETE(), and SLNet::OP_DELETE_ARRAY().

void*(*)(size_t size) GetMalloc()

Definition at line 110 of file RakMemoryOverride.cpp.

void*(*)(size_t size, const char *file, unsigned int line) GetMalloc_Ex()

Definition at line 122 of file RakMemoryOverride.cpp.

Referenced by SLNet::OP_NEW(), SLNet::OP_NEW_1(), SLNet::OP_NEW_2(), SLNet::OP_NEW_3(), SLNet::OP_NEW_4(), and SLNet::OP_NEW_ARRAY().

void*(*)(void *p, size_t size) GetRealloc()

Definition at line 114 of file RakMemoryOverride.cpp.

void*(*)(void *p, size_t size, const char *file, unsigned int line) GetRealloc_Ex()

Definition at line 126 of file RakMemoryOverride.cpp.

void(* notifyOutOfMemory)(const char *file, const long line) =DefaultOutOfMemoryHandler

Definition at line 65 of file RakMemoryOverride.cpp.

Referenced by SLNet::RakString::Assign(), SLNet::RakWString::operator+=(), SLNet::RakWString::operator=(), SLNet::ReliabilityLayer::Send(), SLNet::RakPeer::SendBuffered(), SLNet::RakPeer::SendBufferedList(), SLNet::PluginInterface2::SendListUnified(), and SetNotifyOutOfMemory().

void(* rakFree)(void *p) = SLNet::_RakFree

Definition at line 61 of file RakMemoryOverride.cpp.

Referenced by SetFree().

void(* rakFree_Ex)(void *p, const char *file, unsigned int line) = SLNet::_RakFree_Ex

Definition at line 64 of file RakMemoryOverride.cpp.

Referenced by SLNet::RakString::Assign(), DataStructures::Table::Cell::Cell(), DataStructures::ByteQueue::Clear(), DataStructures::MemoryPool< MemoryBlockType >::Clear(), DataStructures::Table::Cell::Clear(), SLNet::RakWString::Clear(), SLNet::CloudServer::CloudData::Clear(), SLNet::RakPeer::ClearBanList(), SLNet::RakPeer::ClearBufferedCommands(), SLNet::RakPeer::DeallocatePacket(), SLNet::PluginInterface2::DeallocPacketUnified(), SLNet::StringCompressor::DecodeString(), SLNet::RakWString::Deserialize(), SLNet::RakString::Free(), VariadicSQLParser::FreeArguments(), SLNet::HuffmanEncodingTree::FreeMemory(), SLNet::RakString::FreeMemoryNoMutex(), DataStructures::MemoryPool< MemoryBlockType >::InitPage(), SLNet::RakPeer::IsBanned(), DataStructures::Table::Cell::operator=(), SLNet::BitStream::ReadAlignedBytesSafeAlloc(), DataStructures::BytePool::Release(), DataStructures::MemoryPool< MemoryBlockType >::Release(), SLNet::RakPeer::RemoveFromBanList(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBufferedList(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendListUnified(), SLNet::RakWString::Serialize(), SetFree_Ex(), SLNet::BitStream::~BitStream(), SLNet::CloudServer::CloudData::~CloudData(), SLNet::RakWString::~RakWString(), SLNet::StringTable::~StringTable(), and SLNet::VariableListDeltaTracker::~VariableListDeltaTracker().

void*(* rakMalloc)(size_t size) = SLNet::_RakMalloc

Definition at line 59 of file RakMemoryOverride.cpp.

Referenced by SetMalloc().

void*(* rakMalloc_Ex)(size_t size, const char *file, unsigned int line) = SLNet::_RakMalloc_Ex

Definition at line 62 of file RakMemoryOverride.cpp.

Referenced by SLNet::BitStream::AddBitsAndReallocate(), SLNet::StringTable::AddString(), SLNet::RakPeer::AddToBanList(), DataStructures::BytePool::Allocate(), DataStructures::MemoryPool< MemoryBlockType >::Allocate(), SLNet::RakString::Allocate(), SLNet::PluginInterface2::AllocatePacketUnified(), SLNet::RakPeer::AllocPacket(), SLNet::BitStream::AssertCopyData(), Base64Encoding(), SLNet::BitStream::BitStream(), DataStructures::Table::Cell::Cell(), SLNet::BitStream::CopyData(), SLNet::StringCompressor::DecodeString(), SLNet::DataCompressor::DecompressAndAllocate(), SLNet::RakWString::Deserialize(), VariadicSQLParser::ExtractArguments(), DataStructures::MemoryPool< MemoryBlockType >::InitPage(), operator+(), SLNet::RakWString::operator+=(), SLNet::RakWString::operator=(), DataStructures::Table::Cell::operator=(), SLNet::BitStream::ReadAlignedBytesSafeAlloc(), SLNet::RakString::Realloc(), SLNet::RakPeer::SendBuffered(), SLNet::RakPeer::SendBufferedList(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendListUnified(), SLNet::RakWString::Serialize(), DataStructures::Table::Cell::Set(), SetMalloc_Ex(), and SLNet::VariableListDeltaTracker::VariableLastValueNode::VariableLastValueNode().

void*(* rakRealloc)(void *p, size_t size) = SLNet::_RakRealloc

Definition at line 60 of file RakMemoryOverride.cpp.

Referenced by SetRealloc().

void*(* rakRealloc_Ex)(void *p, size_t size, const char *file, unsigned int line) = SLNet::_RakRealloc_Ex

Definition at line 63 of file RakMemoryOverride.cpp.

Referenced by SLNet::BitStream::AddBitsAndReallocate(), SLNet::RakString::Assign(), SLNet::RakWString::operator+=(), SLNet::RakString::Realloc(), SetRealloc_Ex(), DataStructures::ByteQueue::WriteBytes(), and SLNet::VariableListDeltaTracker::WriteVar().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetCommandParser.cpp File Reference

  • src
RakNetCommandParser.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket.cpp File Reference

  • src
RakNetSocket.cpp File Reference

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2.cpp File Reference

  • src
Macros | Functions
RakNetSocket2.cpp File Reference
#include "slikenet/socket2.h"
#include "slikenet/memoryoverride.h"
#include "slikenet/assert.h"
#include "slikenet/sleep.h"
#include "slikenet/SocketDefines.h"
#include "slikenet/GetTime.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <arpa/inet.h>
#include <errno.h>
#include <ifaddrs.h>
#include <netinet/in.h>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include "RakNetSocket2_360_720.cpp"
#include "RakNetSocket2_PS3_PS4.cpp"
#include "RakNetSocket2_PS4.cpp"
#include "RakNetSocket2_Windows_Linux.cpp"
#include "RakNetSocket2_Windows_Linux_360.cpp"
#include "RakNetSocket2_Vita.cpp"
#include "RakNetSocket2_NativeClient.cpp"
#include "RakNetSocket2_Berkley.cpp"
#include "RakNetSocket2_Berkley_NativeClient.cpp"
#include "RakNetSocket2_WindowsStore8.cpp"

Go to the source code of this file.

Macros

#define | RAKNET_SOCKET_2_INLINE_FUNCTIONS
#define | INVALID_SOCKET -1

Functions

RAK_THREAD_DECLARATION (RNS2_Berkley::RecvFromLoop)

Macro Definition Documentation

#define INVALID_SOCKET -1

Definition at line 61 of file RakNetSocket2.cpp.

Referenced by SLNet::RNS2_Berkley::RNS2_Berkley(), and SLNet::RNS2_Berkley::~RNS2_Berkley().

#define RAKNET_SOCKET_2_INLINE_FUNCTIONS

Definition at line 45 of file RakNetSocket2.cpp.

Function Documentation

RAK_THREAD_DECLARATION ( RNS2_Berkley::RecvFromLoop )

Definition at line 341 of file RakNetSocket2.cpp.

References SLNet::RNS2_Berkley::RecvFromLoopInt().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_360_720.cpp File Reference

  • src
RakNetSocket2_360_720.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Berkley.cpp File Reference

  • src
RakNetSocket2_Berkley.cpp File Reference
#include "slikenet/EmptyHeader.h"
#include "slikenet/LinuxStrings.h"
#include "slikenet/Itoa.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Berkley_NativeClient.cpp File Reference

  • src
RakNetSocket2_Berkley_NativeClient.cpp File Reference
#include "slikenet/EmptyHeader.h"
#include "slikenet/Itoa.h"
#include "slikenet/WSAStartupSingleton.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_NativeClient.cpp File Reference

  • src
RakNetSocket2_NativeClient.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_PS3_PS4.cpp File Reference

  • src
RakNetSocket2_PS3_PS4.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_PS4.cpp File Reference

  • src
RakNetSocket2_PS4.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Vita.cpp File Reference

  • src
RakNetSocket2_Vita.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Windows_Linux.cpp File Reference

  • src
RakNetSocket2_Windows_Linux.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Windows_Linux_360.cpp File Reference

  • src
RakNetSocket2_Windows_Linux_360.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_WindowsStore8.cpp File Reference

  • src
RakNetSocket2_WindowsStore8.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetStatistics.cpp File Reference

  • src
RakNetStatistics.cpp File Reference
#include "slikenet/statistics.h"
#include <stdio.h>
#include "slikenet/GetTime.h"
#include "slikenet/string.h"
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetTransport2.cpp File Reference

  • src
RakNetTransport2.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetTypes.cpp File Reference

  • src
Variables
RakNetTypes.cpp File Reference
#include "slikenet/types.h"
#include "slikenet/assert.h"
#include <string.h>
#include <stdio.h>
#include "slikenet/WindowsIncludes.h"
#include "slikenet/WSAStartupSingleton.h"
#include "slikenet/SocketDefines.h"
#include "slikenet/socket2.h"
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "slikenet/Itoa.h"
#include "slikenet/SocketLayer.h"
#include "slikenet/SuperFastHash.h"
#include <stdlib.h>
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Variables

const char * | IPV6_LOOPBACK ="::1"
const char * | IPV4_LOOPBACK ="127.0.0.1"

Variable Documentation

const char* IPV4_LOOPBACK ="127.0.0.1"

Definition at line 53 of file RakNetTypes.cpp.

Referenced by SLNet::SystemAddress::FixForIPVersion(), SLNet::SystemAddress::FromString(), and SLNet::SystemAddress::SetToLoopback().

const char* IPV6_LOOPBACK ="::1"

Definition at line 52 of file RakNetTypes.cpp.

Referenced by SLNet::SystemAddress::FixForIPVersion(), SLNet::SystemAddress::FromString(), and SLNet::SystemAddress::SetToLoopback().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakPeer.cpp File Reference

  • src
Namespaces | Macros | Functions | Variables
RakPeer.cpp File Reference
#include "slikenet/defines.h"
#include "slikenet/peer.h"
#include "slikenet/types.h"
#include <unistd.h>
#include <time.h>
#include <ctype.h>
#include <string.h>
#include "slikenet/GetTime.h"
#include "slikenet/MessageIdentifiers.h"
#include "slikenet/DS_HuffmanEncodingTree.h"
#include "slikenet/Rand.h"
#include "slikenet/PluginInterface2.h"
#include "slikenet/StringCompressor.h"
#include "slikenet/StringTable.h"
#include "slikenet/NetworkIDObject.h"
#include "slikenet/DR_SHA1.h"
#include "slikenet/sleep.h"
#include "slikenet/assert.h"
#include "slikenet/version.h"
#include "slikenet/NetworkIDManager.h"
#include "slikenet/gettimeofday.h"
#include "slikenet/SignaledEvent.h"
#include "slikenet/SuperFastHash.h"
#include "slikenet/alloca.h"
#include "slikenet/WSAStartupSingleton.h"
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"
#include <stdlib.h>

Go to the source code of this file.

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define | CAT_NEUTER_EXPORT /* Neuter dllimport for libcat */
#define | CAT_AUDIT_PRINTF(...)
#define | REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE 8

Functions

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

Variables

static const int | NUM_MTU_SIZES =3
static const int | mtuSizes [NUM_MTU_SIZES] ={MAXIMUM_MTU_SIZE, 1200, 576}
static RakNetRandom | rnr
static const unsigned int | MAX_OFFLINE_DATA_LENGTH =400
static const unsigned char | OFFLINE_MESSAGE_DATA_ID [16] ={0x00,0xFF,0xFF,0x00,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFD,0xFD,0x12,0x34,0x56,0x78}

Macro Definition Documentation

#define CAT_AUDIT_PRINTF ( ... )

Definition at line 71 of file RakPeer.cpp.

Referenced by SLNet::RakPeer::CancelConnectionAttempt(), SLNet::RakPeer::ClearRequestedConnectionList(), SLNet::RakPeer::DisableSecurity(), SLNet::RakPeer::InitializeSecurity(), SLNet::RakPeer::ParseConnectionRequestPacket(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RakPeer(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendConnectionRequest(), and SLNet::RakPeer::~RakPeer().

#define CAT_NEUTER_EXPORT /* Neuter dllimport for libcat */

Definition at line 21 of file RakPeer.cpp.

#define REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE 8

Definition at line 80 of file RakPeer.cpp.

Referenced by SLNet::RakPeer::RemoteSystemLookupHashIndex(), and SLNet::RakPeer::Startup().

Function Documentation

RAK_THREAD_DECLARATION ( SLNet::UpdateNetworkLoop )

Definition at line 6275 of file RakPeer.cpp.

References SLNet::RakPeer::endThreads, SLNet::RakPeer::isMainLoopThreadActive, LIBCAT_SECURITY, MAXIMUM_MTU_SIZE, SLNet::RakPeer::quitAndDataEvents, SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::userUpdateThreadData, SLNet::RakPeer::userUpdateThreadPtr, and SLNet::SignaledEvent::WaitOnEvent().

Variable Documentation

const unsigned int MAX_OFFLINE_DATA_LENGTH =400
static

Definition at line 130 of file RakPeer.cpp.

Referenced by SLNet::ProcessOfflineNetworkPacket(), and SLNet::RakPeer::SendOutOfBand().

const int mtuSizes[NUM_MTU_SIZES] ={MAXIMUM_MTU_SIZE, 1200, 576}
static

Definition at line 111 of file RakPeer.cpp.

Referenced by SLNet::RakPeer::RakPeer(), and SLNet::RakPeer::RunUpdateCycle().

const int NUM_MTU_SIZES =3
static

Definition at line 107 of file RakPeer.cpp.

Referenced by SLNet::RakPeer::RakPeer(), and SLNet::RakPeer::RunUpdateCycle().

const unsigned char OFFLINE_MESSAGE_DATA_ID[16] ={0x00,0xFF,0xFF,0x00,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFD,0xFD,0x12,0x34,0x56,0x78}
static

Definition at line 135 of file RakPeer.cpp.

Referenced by SLNet::RakPeer::Ping(), SLNet::ProcessOfflineNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendOutOfBand(), and SLNet::RakPeer::WriteOutOfBandHeader().

RakNetRandom rnr
static

Definition at line 120 of file RakPeer.cpp.

Referenced by SLNet::ProcessNetworkPacket(), SLNet::RakPeer::RunUpdateCycle(), and SLNet::RakPeer::Startup().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakSleep.cpp File Reference

  • src
Functions | Variables
RakSleep.cpp File Reference
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
#include "slikenet/sleep.h"

Go to the source code of this file.

Functions

void RakSleep (unsigned int ms)

Variables

pthread_mutex_t | fakeMutex = PTHREAD_MUTEX_INITIALIZER
pthread_cond_t | fakeCond = PTHREAD_COND_INITIALIZER

Function Documentation

void RakSleep ( unsigned int ms )

Definition at line 41 of file RakSleep.cpp.

References fakeCond, and fakeMutex.

Referenced by SLNet::RNS2_Berkley::BlockOnStopRecvPollingThread(), SLNet::RakPeerInterface::Get64BitUniqueRandomNumber(), SLNet::RakPeer::GetSocket(), SLNet::RakPeer::GetSockets(), ThreadPool< InputType, OutputType >::Pause(), SLNet::RNS2_Berkley::RecvFromLoopInt(), SLNet::RakPeer::Shutdown(), ThreadPool< InputType, OutputType >::StartThreads(), SLNet::RakPeer::Startup(), and ThreadPool< InputType, OutputType >::StopThreads().

Variable Documentation

pthread_cond_t fakeCond = PTHREAD_COND_INITIALIZER

Definition at line 30 of file RakSleep.cpp.

Referenced by RakSleep().

pthread_mutex_t fakeMutex = PTHREAD_MUTEX_INITIALIZER

Definition at line 29 of file RakSleep.cpp.

Referenced by RakSleep().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakString.cpp File Reference

  • src
Functions | Variables
RakString.cpp File Reference
#include "slikenet/string.h"
#include "slikenet/assert.h"
#include "slikenet/memoryoverride.h"
#include "slikenet/BitStream.h"
#include <stdarg.h>
#include "slikenet/LinuxStrings.h"
#include "slikenet/StringCompressor.h"
#include "slikenet/SimpleMutex.h"
#include <stdlib.h>
#include "slikenet/Itoa.h"
#include <limits>
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Functions

SimpleMutex & | GetPoolMutex (void)
const SLNet::RakString | operator+ (const SLNet::RakString &lhs, const SLNet::RakString &rhs)
int | porges_strlen2 (char *s)

Variables

static RakStringCleanup cleanup

Function Documentation

SimpleMutex& GetPoolMutex ( void )

Definition at line 50 of file RakString.cpp.

Referenced by SLNet::RakString::LockMutex(), and SLNet::RakString::UnlockMutex().

const SLNet::RakString operator+ | ( | const SLNet::RakString & | lhs,
 |  | const SLNet::RakString & | rhs
 | ) |  |

Definition at line 286 of file RakString.cpp.

References _FILE_AND_LINE_, SLNet::RakString::SharedString::bigString, SLNet::RakString::SharedString::bytesUsed, SLNet::RakString::SharedString::c_str, SLNet::RakString::emptyString, SLNet::RakString::freeList, SLNet::RakString::GetLength(), SLNet::RakString::GetSizeToAllocate(), DataStructures::List< list_type >::Insert(), SLNet::RakString::IsEmpty(), SLNet::SimpleMutex::Lock(), SLNet::RakString::LockMutex(), rakMalloc_Ex, SLNet::RakString::SharedString::refCount, SLNet::RakString::SharedString::refCountMutex, DataStructures::List< list_type >::RemoveAtIndex(), SLNet::RakString::sharedString, DataStructures::List< list_type >::Size(), SLNet::RakString::SharedString::smallString, SLNet::SimpleMutex::Unlock(), and SLNet::RakString::UnlockMutex().

int porges_strlen2 ( char * s )

Definition at line 401 of file RakString.cpp.

Referenced by SLNet::RakString::GetLengthUTF8().

Variable Documentation

RakStringCleanup cleanup
static

Definition at line 48 of file RakString.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakThread.cpp File Reference

  • src
RakThread.cpp File Reference
#include "slikenet/thread.h"
#include "slikenet/assert.h"
#include "slikenet/defines.h"
#include "slikenet/sleep.h"
#include "slikenet/memoryoverride.h"
#include <pthread.h>

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakWString.cpp File Reference

  • src
Macros | Functions
RakWString.cpp File Reference
#include "slikenet/wstring.h"
#include "slikenet/BitStream.h"
#include <string.h>
#include <wchar.h>
#include <stdlib.h>
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Macros

#define MAX_BYTES_PER_UNICODE_CHAR sizeof(wchar_t)

Functions

const SLNet::RakWString operator+ (const SLNet::RakWString &lhs, const SLNet::RakWString &rhs)

Macro Definition Documentation

#define MAX_BYTES_PER_UNICODE_CHAR sizeof(wchar_t)

Definition at line 28 of file RakWString.cpp.

Referenced by SLNet::RakWString::Deserialize(), SLNet::RakWString::operator+=(), SLNet::RakWString::operator=(), SLNet::RakWString::Serialize(), and SLNet::RakWString::ToInteger().

Function Documentation

const SLNet::RakWString operator+ | ( | const SLNet::RakWString & | lhs,
 |  | const SLNet::RakWString & | rhs
 | ) |  |

Definition at line 439 of file RakWString.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Rand.cpp File Reference

  • src
Macros | Functions | Variables
Rand.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "slikenet/Rand.h"

Go to the source code of this file.

Macros

#define | N (624)
#define | M (397)
#define | K (0x9908B0DFU)
#define | hiBit(u) ((u) & 0x80000000U)
#define | loBit(u) ((u) & 0x00000001U)
#define | loBits(u) ((u) & 0x7FFFFFFFU)
#define | mixBits(u, v) (hiBit(u)|loBits(v))

Functions

void | seedMT (unsigned int seed, unsigned int *state, unsigned int *&next, int &left)
unsigned int | reloadMT (unsigned int *state, unsigned int *&next, int &left)
unsigned int | randomMT (unsigned int *state, unsigned int *&next, int &left)
void | fillBufferMT (void *buffer, unsigned int bytes, unsigned int *state, unsigned int *&next, int &left)
float | frandomMT (unsigned int *state, unsigned int *&next, int &left)
void | seedMT (unsigned int seed)
unsigned int | reloadMT (void)
unsigned int | randomMT (void)
float | frandomMT (void)
void | fillBufferMT (void *buffer, unsigned int bytes)

Variables

static unsigned int | _state [N+1]
static unsigned int * | _next
static int | _left = -1

Macro Definition Documentation

#define hiBit ( u ) ((u) & 0x80000000U)

Definition at line 65 of file Rand.cpp.

#define K (0x9908B0DFU)

Definition at line 64 of file Rand.cpp.

Referenced by reloadMT().

#define loBit ( u ) ((u) & 0x00000001U)

Definition at line 66 of file Rand.cpp.

Referenced by reloadMT().

#define loBits ( u ) ((u) & 0x7FFFFFFFU)

Definition at line 67 of file Rand.cpp.

#define M (397)

Definition at line 63 of file Rand.cpp.

Referenced by reloadMT().

#define mixBits | ( | u,
 |  | v
 | ) | (hiBit(u)|loBits(v))

Definition at line 68 of file Rand.cpp.

Referenced by reloadMT().

#define N (624)

Grabbed by Kevin from http://www.math.keio.ac.jp/~matumoto/cokus.c This is the ``Mersenne Twister'' random number generator MT19937, which generates pseudorandom integers uniformly distributed in 0..(2^32 - 1) starting from any odd seed in 0..(2^32 - 1). This version is a recode by Shawn Cokus (Cokus.nosp@m.@mat.nosp@m.h.was.nosp@m.hing.nosp@m.ton.e.nosp@m.du) on March 8, 1998 of a version by Takuji Nishimura (who had suggestions from Topher Cooper and Marc Rieffel in July-August 1997).

Effectiveness of the recoding (on Goedel2.math.washington.edu, a DEC Alpha running OSF/1) using GCC -O3 as a compiler: before recoding: 51.6 sec. to generate 300 million random numbers; after recoding: 24.0 sec. for the same (i.e., 46.5% of original time), so speed is now about 12.5 million random number generations per second on this machine.

According to the URL http://www.math.keio.ac.jp/~matumoto/emt.html (and paraphrasing a bit in places), the Mersenne Twister is ``designed with consideration of the flaws of various existing generators,'' has a period of 2^19937 - 1, gives a sequence that is 623-dimensionally equidistributed, and ``has passed many stringent tests, including the die-hard test of G. Marsaglia and the load test of P. Hellekalek and S. Wegenkittl.'' It is efficient in memory usage (typically using 2506 to 5012 bytes of static data, depending on data type sizes, and the code is quite short as well). It generates random numbers in batches of 624 at a time, so the caching and pipelining of modern systems is exploited. It is also divide- and mod-free.

Licensing is free http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/elicense.html

The code as Shawn received it included the following notice:

Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. When you use this, send an e-mail to matum.nosp@m.oto@.nosp@m.math..nosp@m.keio.nosp@m..ac.j.nosp@m.p with an appropriate reference to your work.

It would be nice to CC: Cokus.nosp@m.@mat.nosp@m.h.was.nosp@m.hing.nosp@m.ton.e.nosp@m.du when you write.

Note from SLikeSoft: The mail addresses here seem to be dead ends and we could not determine any current ways to contact the authors.

Definition at line 62 of file Rand.cpp.

Referenced by reloadMT(), and seedMT().

Function Documentation

void fillBufferMT | ( | void * | buffer,
 |  | unsigned int | bytes,
 |  | unsigned int * | state,
 |  | unsigned int *& | next,
 |  | int & | left
 | ) |  |

Definition at line 213 of file Rand.cpp.

References randomMT().

Referenced by fillBufferMT(), and SLNet::RakNetRandom::FillBufferMT().

void fillBufferMT | ( | void * | buffer,
 |  | unsigned int | bytes
 | ) |  |

Randomizes a buffer

Note
not threadSafe, use an instance of RakNetRandom if necessary per thread

Definition at line 99 of file Rand.cpp.

References _left, _next, _state, and fillBufferMT().

float frandomMT | ( | unsigned int * | state,
 |  | unsigned int *& | next,
 |  | int & | left
 | ) |  |

Definition at line 228 of file Rand.cpp.

References randomMT().

Referenced by frandomMT(), SLNet::RakNetRandom::FrandomMT(), and DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::PushAtHead().

float frandomMT ( void )

Gets a random float

Note
not threadSafe, use an instance of RakNetRandom if necessary per thread
Returns
0 to 1.0f, inclusive

Definition at line 95 of file Rand.cpp.

References _left, _next, _state, and frandomMT().

unsigned int randomMT | ( | unsigned int * | state,
 |  | unsigned int *& | next,
 |  | int & | left
 | ) |  |

Definition at line 192 of file Rand.cpp.

References reloadMT().

Referenced by fillBufferMT(), frandomMT(), randomMT(), and SLNet::RakNetRandom::RandomMT().

unsigned int randomMT ( void )

Gets a random unsigned int

Note
not threadSafe, use an instance of RakNetRandom if necessary per thread
Returns
an integer random value.

Definition at line 91 of file Rand.cpp.

References _left, _next, _state, and randomMT().

unsigned int reloadMT | ( | unsigned int * | state,
 |  | unsigned int *& | next,
 |  | int & | left
 | ) |  |

Definition at line 164 of file Rand.cpp.

References K, loBit, M, mixBits, N, and seedMT().

Referenced by randomMT(), reloadMT(), and SLNet::RakNetRandom::ReloadMT().

unsigned int reloadMT ( void )

Definition at line 87 of file Rand.cpp.

References _left, _next, _state, and reloadMT().

void seedMT | ( | unsigned int | seed,
 |  | unsigned int * | state,
 |  | unsigned int *& | next,
 |  | int & | left
 | ) |  |

Definition at line 104 of file Rand.cpp.

References N.

Referenced by reloadMT(), seedMT(), and SLNet::RakNetRandom::SeedMT().

void seedMT ( unsigned int seed )

Initialise seed for Random Generator

Note
not threadSafe, use an instance of RakNetRandom if necessary per thread
Parameters
[in] seed The seed value for the random number generator.

Definition at line 83 of file Rand.cpp.

References _left, _next, _state, and seedMT().

Variable Documentation

int _left = -1
static

Definition at line 72 of file Rand.cpp.

Referenced by fillBufferMT(), frandomMT(), randomMT(), reloadMT(), and seedMT().

unsigned int* _next
static

Definition at line 71 of file Rand.cpp.

Referenced by fillBufferMT(), frandomMT(), randomMT(), reloadMT(), and seedMT().

unsigned int _state[N+1]
static

Definition at line 70 of file Rand.cpp.

Referenced by fillBufferMT(), frandomMT(), randomMT(), reloadMT(), and seedMT().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RandSync.cpp File Reference

  • src
Namespaces
RandSync.cpp File Reference
#include "slikenet/RandSync.h"
#include "slikenet/BitStream.h"
#include <limits>
#include <limits.h>

Go to the source code of this file.

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ReadyEvent.cpp File Reference

  • src
ReadyEvent.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RelayPlugin.cpp File Reference

  • src
RelayPlugin.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ReliabilityLayer.cpp File Reference

  • src
Typedefs | Functions | Variables
ReliabilityLayer.cpp File Reference
#include "slikenet/ReliabilityLayer.h"
#include "slikenet/GetTime.h"
#include "slikenet/SocketLayer.h"
#include "slikenet/PluginInterface2.h"
#include "slikenet/assert.h"
#include "slikenet/Rand.h"
#include "slikenet/MessageIdentifiers.h"
#include <math.h>
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Typedefs

typedef uint32_t BitstreamLengthEncoding

Functions

double | Ceil (double d)
int | SplitPacketIndexComp (SplitPacketIndexType const &key, InternalPacket *const &data)

Variables

static const CCTimeType | MAX_TIME_BETWEEN_PACKETS = 350000
static const int | DEFAULT_HAS_RECEIVED_PACKET_QUEUE_SIZE =512
static const CCTimeType | STARTING_TIME_BETWEEN_PACKETS =MAX_TIME_BETWEEN_PACKETS

Typedef Documentation

typedef uint32_t BitstreamLengthEncoding

Definition at line 61 of file ReliabilityLayer.cpp.

Function Documentation

double Ceil ( double d )

Definition at line 38 of file ReliabilityLayer.cpp.

int SplitPacketIndexComp | ( | SplitPacketIndexType const & | key,
 |  | InternalPacket *const & | data
 | ) |  |

Definition at line 291 of file ReliabilityLayer.cpp.

References SLNet::InternalPacketFixedSizeTransmissionHeader::splitPacketIndex.

Variable Documentation

const int DEFAULT_HAS_RECEIVED_PACKET_QUEUE_SIZE =512
static

Definition at line 56 of file ReliabilityLayer.cpp.

Referenced by SLNet::ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer().

const CCTimeType MAX_TIME_BETWEEN_PACKETS = 350000
static

Definition at line 53 of file ReliabilityLayer.cpp.

const CCTimeType STARTING_TIME_BETWEEN_PACKETS =MAX_TIME_BETWEEN_PACKETS
static

Definition at line 57 of file ReliabilityLayer.cpp.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ReplicaManager3.cpp File Reference

  • src
ReplicaManager3.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Router2.cpp File Reference

  • src
Router2.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RPC4Plugin.cpp File Reference

  • src
RPC4Plugin.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SecureHandshake.cpp File Reference

  • src
SecureHandshake.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SendToThread.cpp File Reference

  • src
SendToThread.cpp File Reference
#include "slikenet/SendToThread.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SignaledEvent.cpp File Reference

  • src
SignaledEvent.cpp File Reference
#include "slikenet/SignaledEvent.h"
#include "slikenet/assert.h"
#include "slikenet/sleep.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SimpleMutex.cpp File Reference

  • src
SimpleMutex.cpp File Reference
#include "slikenet/SimpleMutex.h"
#include "slikenet/assert.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SocketLayer.cpp File Reference

  • src
Namespaces | Macros | Functions
SocketLayer.cpp File Reference

SocketLayer class implementation. More...

#include "slikenet/SocketLayer.h"
#include "slikenet/assert.h"
#include "slikenet/types.h"
#include "slikenet/peer.h"
#include "slikenet/GetTime.h"
#include "slikenet/LinuxStrings.h"
#include "slikenet/SocketDefines.h"
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"
#include "slikenet/CCRakNetUDT.h"
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <ifaddrs.h>
#include <netinet/in.h>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include "slikenet/sleep.h"
#include "slikenet/Itoa.h"

Go to the source code of this file.

Namespaces

namespace SLNet
Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

Macros

#define _T(x) (x)

Functions

void | SLNet::ProcessNetworkPacket (const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, SLNet::TimeUS timeRead)
void | GetMyIP_Win32 (SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS])

Detailed Description

SocketLayer class implementation.

Definition in file SocketLayer.cpp.

Macro Definition Documentation

#define _T ( x ) (x)

Definition at line 38 of file SocketLayer.cpp.

Referenced by GetMyIP_Win32(), SLNet::SocketLayer::GetSystemAddress(), SLNet::SocketLayer::GetSystemAddress_Old(), and SLNet::SocketLayer::SetSocketOptions().

Function Documentation

void GetMyIP_Win32 ( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )

Definition at line 376 of file SocketLayer.cpp.

References _T, MAXIMUM_NUMBER_OF_INTERNAL_IDS, RAKNET_DEBUG_TPRINTF, return, and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by SLNet::SocketLayer::GetMyIP().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/StatisticsHistory.cpp File Reference

  • src
StatisticsHistory.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/StringCompressor.cpp File Reference

  • src
Variables
StringCompressor.cpp File Reference
#include "slikenet/StringCompressor.h"
#include "slikenet/DS_HuffmanEncodingTree.h"
#include "slikenet/BitStream.h"
#include "slikenet/string.h"
#include "slikenet/assert.h"
#include <memory.h>

Go to the source code of this file.

Variables

unsigned int englishCharacterFrequencies [256]

Variable Documentation

unsigned int englishCharacterFrequencies[256]

Definition at line 67 of file StringCompressor.cpp.

Referenced by SLNet::StringCompressor::StringCompressor().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/StringTable.cpp File Reference

  • src
StringTable.cpp File Reference
#include "slikenet/StringTable.h"
#include <string.h>
#include "slikenet/assert.h"
#include <stdio.h>
#include "slikenet/BitStream.h"
#include "slikenet/StringCompressor.h"
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SuperFastHash.cpp File Reference

  • src
Macros | Functions | Variables
SuperFastHash.cpp File Reference
#include "slikenet/SuperFastHash.h"
#include "slikenet/NativeTypes.h"
#include <stdlib.h>
#include <stdint.h>
#include "slikenet/linux_adapter.h"
#include "slikenet/osx_adapter.h"

Go to the source code of this file.

Macros

#define get16bits(d)

Functions

uint32_t | SuperFastHash (const char *data, int length)
uint32_t | SuperFastHashIncremental (const char *data, int len, unsigned int lastHash)
uint32_t | SuperFastHashFile (const char *filename)
uint32_t | SuperFastHashFilePtr (FILE *fp)

Variables

static const int INCREMENTAL_READ_BLOCK =65536

Macro Definition Documentation

#define get16bits ( d )
Value:
((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
+(uint32_t)(((const uint8_t *)(d))[0]) )

Definition at line 32 of file SuperFastHash.cpp.

Referenced by SuperFastHashIncremental().

Function Documentation

uint32_t SuperFastHash | ( | const char * | data,
 |  | int | length
 | ) |  |

Definition at line 38 of file SuperFastHash.cpp.

References INCREMENTAL_READ_BLOCK, and SuperFastHashIncremental().

uint32_t SuperFastHashFile ( const char * filename )

Definition at line 106 of file SuperFastHash.cpp.

References SuperFastHashFilePtr().

uint32_t SuperFastHashFilePtr ( FILE * fp )

Definition at line 116 of file SuperFastHash.cpp.

References INCREMENTAL_READ_BLOCK, and SuperFastHashIncremental().

Referenced by SuperFastHashFile().

uint32_t SuperFastHashIncremental | ( | const char * | data,
 |  | int | len,
 |  | unsigned int | lastHash
 | ) |  |

Definition at line 58 of file SuperFastHash.cpp.

References get16bits.

Referenced by SuperFastHash(), SuperFastHashFilePtr(), and SLNet::SystemAddress::ToInteger().

Variable Documentation

const int INCREMENTAL_READ_BLOCK =65536
static

Definition at line 36 of file SuperFastHash.cpp.

Referenced by SuperFastHash(), and SuperFastHashFilePtr().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TableSerializer.cpp File Reference

  • src
TableSerializer.cpp File Reference
#include "slikenet/TableSerializer.h"
#include "slikenet/DS_Table.h"
#include "slikenet/BitStream.h"
#include "slikenet/StringCompressor.h"
#include "slikenet/assert.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TCPInterface.cpp File Reference

  • src
TCPInterface.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TeamBalancer.cpp File Reference

  • src
TeamBalancer.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TeamManager.cpp File Reference

  • src
TeamManager.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TelnetTransport.cpp File Reference

  • src
TelnetTransport.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ThreadsafePacketLogger.cpp File Reference

  • src
ThreadsafePacketLogger.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TwoWayAuthentication.cpp File Reference

  • src
TwoWayAuthentication.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/UDPForwarder.cpp File Reference

  • src
UDPForwarder.cpp File Reference
#include "slikenet/UDPForwarder.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/UDPProxyClient.cpp File Reference

  • src
UDPProxyClient.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/UDPProxyCoordinator.cpp File Reference

  • src
UDPProxyCoordinator.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/UDPProxyServer.cpp File Reference

  • src
UDPProxyServer.cpp File Reference
#include "slikenet/NativeFeatureIncludes.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/VariableDeltaSerializer.cpp File Reference

  • src
VariableDeltaSerializer.cpp File Reference
#include "slikenet/VariableDeltaSerializer.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/VariableListDeltaTracker.cpp File Reference

  • src
VariableListDeltaTracker.cpp File Reference
#include "slikenet/VariableListDeltaTracker.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/VariadicSQLParser.cpp File Reference

  • src
Functions | Variables
VariadicSQLParser.cpp File Reference
#include "slikenet/VariadicSQLParser.h"
#include "slikenet/BitStream.h"
#include <stdarg.h>

Go to the source code of this file.

Functions

unsigned int GetTypeMappingIndex (char c)

Variables

const int | NUM_TYPE_MAPPINGS =7
TypeMapping | typeMappings [NUM_TYPE_MAPPINGS]

Function Documentation

unsigned int GetTypeMappingIndex ( char c )

Definition at line 38 of file VariadicSQLParser.cpp.

References NUM_TYPE_MAPPINGS, and typeMappings.

Referenced by VariadicSQLParser::GetTypeMappingIndices().

Variable Documentation

const int NUM_TYPE_MAPPINGS =7

Definition at line 27 of file VariadicSQLParser.cpp.

Referenced by GetTypeMappingIndex().

TypeMapping typeMappings[NUM_TYPE_MAPPINGS]
Initial value:
=
{
{'i', "int"},
{'d', "int"},
{'s', "text"},
{'b', "bool"},
{'f', "numeric"},
{'g', "double precision"},
{'a', "bytea"},
}

Definition at line 28 of file VariadicSQLParser.cpp.

Referenced by VariadicSQLParser::ExtractArguments(), VariadicSQLParser::GetTypeMappingAtIndex(), and GetTypeMappingIndex().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/VitaIncludes.cpp File Reference

  • src
VitaIncludes.cpp File Reference
#include "slikenet/EmptyHeader.h"

Go to the source code of this file.

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/WSAStartupSingleton.cpp File Reference

  • src
Macros
WSAStartupSingleton.cpp File Reference
#include "slikenet/WSAStartupSingleton.h"
#include "slikenet/defines.h"
#include <stdio.h>

Go to the source code of this file.

Macros

#define _T(x) (x)

Macro Definition Documentation

#define _T ( x ) (x)

Definition at line 38 of file WSAStartupSingleton.cpp.

Referenced by WSAStartupSingleton::AddRef().

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- _ -

  • __CLOUD_CLIENT_H : CloudClient.h
  • __GET_TIME_64BIT : defines.h
  • __TCPSOCKET__ : SocketIncludes.h
  • __UDPSOCKET__ : SocketIncludes.h
  • _columnIndices : DS_Table.cpp
  • _columns : DS_Table.cpp
  • _copysign : BitStream.h , BitStream.cpp
  • _CRT_SECURE_NO_WARNINGS : DR_SHA1.cpp
  • _DLFree() : RakMemoryOverride.cpp
  • _DLFree_Ex() : RakMemoryOverride.cpp
  • _DLMalloc() : RakMemoryOverride.cpp
  • _DLMalloc_Ex() : RakMemoryOverride.cpp
  • _DLRealloc() : RakMemoryOverride.cpp
  • _DLRealloc_Ex() : RakMemoryOverride.cpp
  • _FILE_AND_LINE_ : defines.h
  • _getch() : Kbhit.h
  • _getche() : Getche.cpp , Getche.h
  • _getts : DR_SHA1.h
  • _kbhit() : Kbhit.h
  • _left : Rand.cpp
  • _next : Rand.cpp
  • _numSortQueries : DS_Table.cpp
  • _PP_Instance_ : SocketIncludes.h
  • _RAKNET_SUPPORT_CloudClient : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_CloudServer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_ConnectionGraph2 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_ConsoleServer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_DirectoryDeltaTransfer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_DynDNS : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_EmailSender : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_FileListTransfer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_FileOperations : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_FullyConnectedMesh : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_FullyConnectedMesh2 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_HTTPConnection : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_HTTPConnection2 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_LibVoice : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_LogCommandParser : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_MessageFilter : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_NatPunchthroughClient : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_NatPunchthroughServer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_NatTypeDetectionClient : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_NatTypeDetectionServer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_PacketizedTCP : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_PacketLogger : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_Rackspace : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_RakNetCommandParser : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_RakNetTransport : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_ReadyEvent : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_RelayPlugin : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_ReplicaManager3 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_Router2 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_RPC4Plugin : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_StatisticsHistory : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TCPInterface : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TeamBalancer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TeamManager : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TelnetTransport : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TwoWayAuthentication : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_UDPForwarder : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_UDPProxyClient : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_UDPProxyCoordinator : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_UDPProxyServer : NativeFeatureIncludes.h
  • _sntprintf : DR_SHA1.h
  • _sortQueries : DS_Table.cpp
  • _state : Rand.cpp
  • _T : DR_SHA1.h , WSAStartupSingleton.cpp , SocketLayer.cpp
  • _TABLE_BPLUS_TREE_ORDER : DS_Table.h
  • _TABLE_MAX_COLUMN_NAME_LENGTH : DS_Table.h
  • _tcscat : DR_SHA1.h
  • _tcscpy : DR_SHA1.h
  • _tcslen : DR_SHA1.h
  • _tfopen : DR_SHA1.h
  • _tmain : DR_SHA1.h
  • _tprintf : DR_SHA1.h
  • _USE_RAK_MEMORY_OVERRIDE : defines.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- a -

  • accept__ : SocketDefines.h
  • AddSlash() : FileOperations.h
  • ALLOW_JOIN_ANY_AVAILABLE_TEAM : TeamManager.h
  • ALLOW_JOIN_REBALANCING : TeamManager.h
  • ALLOW_JOIN_SPECIFIC_TEAM : TeamManager.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- b -

  • Base64Encoding() : Base64Encoder.cpp , Base64Encoder.h
  • base64Map : Base64Encoder.cpp
  • Base64Map() : Base64Encoder.cpp , Base64Encoder.h
  • bind__ : SocketDefines.h
  • BITS_TO_BYTES : types.h
  • BITSTREAM_STACK_ALLOCATION_SIZE : defines.h
  • BitstreamLengthEncoding : ReliabilityLayer.cpp
  • BUFFERED_PACKETS_PAGE_SIZE : defines.h
  • BYTES_TO_BITS : types.h
  • BytesPerMicrosecond : CCRakNetSlidingWindow.h
  • BytesPerSecond : CCRakNetSlidingWindow.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- c -

  • callbackOutput : ThreadPool.h
  • CAT_AUDIT_PRINTF : RakPeer.cpp
  • CAT_NEUTER_EXPORT : RakPeer.cpp
  • CC_DEBUG_PRINTF_1 : CCRakNetSlidingWindow.h
  • CC_DEBUG_PRINTF_2 : CCRakNetSlidingWindow.h
  • CC_DEBUG_PRINTF_3 : CCRakNetSlidingWindow.h
  • CC_DEBUG_PRINTF_4 : CCRakNetSlidingWindow.h
  • CC_DEBUG_PRINTF_5 : CCRakNetSlidingWindow.h
  • CC_TIME_TYPE_BYTES : CCRakNetSlidingWindow.h
  • CCTimeType : CCRakNetSlidingWindow.h
  • Ceil() : ReliabilityLayer.cpp
  • CHALLENGE_MINIMUM_TIMEOUT : TwoWayAuthentication.h
  • cleanup : RakString.cpp
  • closesocket : SocketIncludes.h
  • closesocket__ : SocketDefines.h
  • CLOUD_SERVER_DATA_STACK_SIZE : CloudServer.h
  • connect__ : SocketDefines.h
  • cooked() : Kbhit.h
  • CWND_MIN_THRESHOLD : CCRakNetUDT.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- d -

  • DATAGRAM_MESSAGE_ID_ARRAY_LENGTH : defines.h
  • DatagramSequenceNumberType : CCRakNetSlidingWindow.h
  • DEFAULT_HAS_RECEIVED_PACKET_QUEUE_SIZE : ReliabilityLayer.cpp
  • DefaultMessageIDTypes : MessageIdentifiers.h
  • DefaultOutOfMemoryHandler() : RakMemoryOverride.cpp
  • DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS : DS_Multilist.h
  • DirectoryExists() : FileOperations.h
  • dlMallocDirectMMap : RakMemoryOverride.cpp , memoryoverride.h
  • dlMallocMMap : RakMemoryOverride.cpp , memoryoverride.h
  • dlMallocMUnmap : memoryoverride.h , RakMemoryOverride.cpp
  • DS_MEMORY_POOL_MAX_FREE_PAGES : DS_MemoryPool.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- e -

  • englishCharacterFrequencies : StringCompressor.cpp
  • EpochTimeToString() : EpochTimeToString.cpp , EpochTimeToString.h
  • ExtendRows() : DS_Table.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- f -

  • fakeCond : RakSleep.cpp
  • fakeMutex : RakSleep.cpp
  • FCM2Guid : TwoWayAuthentication.h , FullyConnectedMesh2.h
  • fillBufferMT() : Rand.cpp , Rand.h
  • for() : ThreadPool.h
  • FormatString() : FormatString.cpp , FormatString.h
  • FormatStringTS() : FormatString.cpp , FormatString.h
  • frandomMT() : Rand.cpp , Rand.h , Rand.cpp
  • FreeRakNetFixedHeap() : RakMemoryOverride.cpp , memoryoverride.h
  • FreeRow() : DS_Table.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- g -

  • g_old_kbd_mode : Kbhit.h
  • get16bits : SuperFastHash.cpp
  • GET_TIME_SPIKE_LIMIT : defines.h
  • GetDLMallocDirectMMap : RakMemoryOverride.cpp , memoryoverride.h
  • GetDLMallocMMap : RakMemoryOverride.cpp , memoryoverride.h
  • GetDLMallocMUnmap : RakMemoryOverride.cpp , memoryoverride.h
  • GetFileLength() : FileOperations.h
  • GetFree : RakMemoryOverride.cpp , memoryoverride.h
  • GetFree_Ex : RakMemoryOverride.cpp , memoryoverride.h
  • GetMalloc : memoryoverride.h , RakMemoryOverride.cpp
  • GetMalloc_Ex : RakMemoryOverride.cpp , memoryoverride.h
  • GetMyIP_Win32() : SocketLayer.cpp
  • GetPoolMutex() : RakString.cpp
  • GetRealloc : memoryoverride.h , RakMemoryOverride.cpp
  • GetRealloc_Ex : RakMemoryOverride.cpp , memoryoverride.h
  • Gets() : Gets.h , Gets.cpp
  • getsockname__ : SocketDefines.h
  • getsockopt__ : SocketDefines.h
  • GetTypeMappingIndex() : VariadicSQLParser.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- h -

  • HASHED_NONCE_AND_PW_LENGTH : TwoWayAuthentication.h
  • hiBit : Rand.cpp
  • HIGH_PRIORITY : PacketPriority.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- i -

  • ID_ADVERTISE_SYSTEM : MessageIdentifiers.h
  • ID_ALREADY_CONNECTED : MessageIdentifiers.h
  • ID_AUTOPATCHER_CANNOT_DOWNLOAD_ORIGINAL_UNMODIFIED_FILES : MessageIdentifiers.h
  • ID_AUTOPATCHER_CREATION_LIST : MessageIdentifiers.h
  • ID_AUTOPATCHER_DELETION_LIST : MessageIdentifiers.h
  • ID_AUTOPATCHER_FINISHED : MessageIdentifiers.h
  • ID_AUTOPATCHER_FINISHED_INTERNAL : MessageIdentifiers.h
  • ID_AUTOPATCHER_GET_CHANGELIST_SINCE_DATE : MessageIdentifiers.h
  • ID_AUTOPATCHER_GET_PATCH : MessageIdentifiers.h
  • ID_AUTOPATCHER_PATCH_LIST : MessageIdentifiers.h
  • ID_AUTOPATCHER_REPOSITORY_FATAL_ERROR : MessageIdentifiers.h
  • ID_AUTOPATCHER_RESTART_APPLICATION : MessageIdentifiers.h
  • ID_CLOUD_GET_REQUEST : MessageIdentifiers.h
  • ID_CLOUD_GET_RESPONSE : MessageIdentifiers.h
  • ID_CLOUD_POST_REQUEST : MessageIdentifiers.h
  • ID_CLOUD_RELEASE_REQUEST : MessageIdentifiers.h
  • ID_CLOUD_SERVER_TO_SERVER_COMMAND : MessageIdentifiers.h
  • ID_CLOUD_SUBSCRIPTION_NOTIFICATION : MessageIdentifiers.h
  • ID_CLOUD_UNSUBSCRIBE_REQUEST : MessageIdentifiers.h
  • ID_CONNECTED_PING : MessageIdentifiers.h
  • ID_CONNECTED_PONG : MessageIdentifiers.h
  • ID_CONNECTION_ATTEMPT_FAILED : MessageIdentifiers.h
  • ID_CONNECTION_BANNED : MessageIdentifiers.h
  • ID_CONNECTION_LOST : MessageIdentifiers.h
  • ID_CONNECTION_REQUEST : MessageIdentifiers.h
  • ID_CONNECTION_REQUEST_ACCEPTED : MessageIdentifiers.h
  • ID_DDT_DOWNLOAD_REQUEST : MessageIdentifiers.h
  • ID_DETECT_LOST_CONNECTIONS : MessageIdentifiers.h
  • ID_DISCONNECTION_NOTIFICATION : MessageIdentifiers.h
  • ID_DOWNLOAD_PROGRESS : MessageIdentifiers.h
  • ID_FCM2_INFORM_FCMGUID : MessageIdentifiers.h
  • ID_FCM2_NEW_HOST : MessageIdentifiers.h
  • ID_FCM2_REQUEST_FCMGUID : MessageIdentifiers.h
  • ID_FCM2_RESPOND_CONNECTION_COUNT : MessageIdentifiers.h
  • ID_FCM2_UPDATE_MIN_TOTAL_CONNECTION_COUNT : MessageIdentifiers.h
  • ID_FCM2_UPDATE_USER_CONTEXT : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_ACCEPTED : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_CAPABLE : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_FAILED : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_REJECTED : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_START : MessageIdentifiers.h
  • ID_FILE_LIST_REFERENCE_PUSH : MessageIdentifiers.h
  • ID_FILE_LIST_REFERENCE_PUSH_ACK : MessageIdentifiers.h
  • ID_FILE_LIST_TRANSFER_FILE : MessageIdentifiers.h
  • ID_FILE_LIST_TRANSFER_HEADER : MessageIdentifiers.h
  • ID_INCOMPATIBLE_PROTOCOL_VERSION : MessageIdentifiers.h
  • ID_INVALID_PASSWORD : MessageIdentifiers.h
  • ID_IP_RECENTLY_CONNECTED : MessageIdentifiers.h
  • ID_LIB_VOICE : MessageIdentifiers.h
  • ID_LIGHTSPEED_INTEGRATION : MessageIdentifiers.h
  • ID_LOBBY2_SEND_MESSAGE : MessageIdentifiers.h
  • ID_LOBBY2_SERVER_ERROR : MessageIdentifiers.h
  • ID_LOBBY_GENERAL : MessageIdentifiers.h
  • ID_NAT_ALREADY_IN_PROGRESS : MessageIdentifiers.h
  • ID_NAT_CLIENT_READY : MessageIdentifiers.h
  • ID_NAT_CONNECT_AT_TIME : MessageIdentifiers.h
  • ID_NAT_CONNECTION_TO_TARGET_LOST : MessageIdentifiers.h
  • ID_NAT_ESTABLISH_BIDIRECTIONAL : MessageIdentifiers.h
  • ID_NAT_ESTABLISH_UNIDIRECTIONAL : MessageIdentifiers.h
  • ID_NAT_GET_MOST_RECENT_PORT : MessageIdentifiers.h
  • ID_NAT_PING : MessageIdentifiers.h
  • ID_NAT_PONG : MessageIdentifiers.h
  • ID_NAT_PUNCHTHROUGH_FAILED : MessageIdentifiers.h
  • ID_NAT_PUNCHTHROUGH_REQUEST : MessageIdentifiers.h
  • ID_NAT_PUNCHTHROUGH_SUCCEEDED : MessageIdentifiers.h
  • ID_NAT_REQUEST_BOUND_ADDRESSES : MessageIdentifiers.h
  • ID_NAT_RESPOND_BOUND_ADDRESSES : MessageIdentifiers.h
  • ID_NAT_TARGET_NOT_CONNECTED : MessageIdentifiers.h
  • ID_NAT_TARGET_UNRESPONSIVE : MessageIdentifiers.h
  • ID_NAT_TYPE_DETECT : MessageIdentifiers.h
  • ID_NAT_TYPE_DETECTION_REQUEST : MessageIdentifiers.h
  • ID_NAT_TYPE_DETECTION_RESULT : MessageIdentifiers.h
  • ID_NEW_INCOMING_CONNECTION : MessageIdentifiers.h
  • ID_NO_FREE_INCOMING_CONNECTIONS : MessageIdentifiers.h
  • ID_OPEN_CONNECTION_REPLY_1 : MessageIdentifiers.h
  • ID_OPEN_CONNECTION_REPLY_2 : MessageIdentifiers.h
  • ID_OPEN_CONNECTION_REQUEST_1 : MessageIdentifiers.h
  • ID_OPEN_CONNECTION_REQUEST_2 : MessageIdentifiers.h
  • ID_OUR_SYSTEM_REQUIRES_SECURITY : MessageIdentifiers.h
  • ID_OUT_OF_BAND_INTERNAL : MessageIdentifiers.h
  • ID_PUBLIC_KEY_MISMATCH : MessageIdentifiers.h
  • ID_RAKVOICE_CLOSE_CHANNEL : MessageIdentifiers.h
  • ID_RAKVOICE_DATA : MessageIdentifiers.h
  • ID_RAKVOICE_OPEN_CHANNEL_REPLY : MessageIdentifiers.h
  • ID_RAKVOICE_OPEN_CHANNEL_REQUEST : MessageIdentifiers.h
  • ID_READY_EVENT_ALL_SET : MessageIdentifiers.h
  • ID_READY_EVENT_FORCE_ALL_SET : MessageIdentifiers.h
  • ID_READY_EVENT_QUERY : MessageIdentifiers.h
  • ID_READY_EVENT_SET : MessageIdentifiers.h
  • ID_READY_EVENT_UNSET : MessageIdentifiers.h
  • ID_RELAY_PLUGIN : MessageIdentifiers.h
  • ID_REMOTE_CONNECTION_LOST : MessageIdentifiers.h
  • ID_REMOTE_DISCONNECTION_NOTIFICATION : MessageIdentifiers.h
  • ID_REMOTE_NEW_INCOMING_CONNECTION : MessageIdentifiers.h
  • ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_CONSTRUCTION : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_DOWNLOAD_STARTED : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_SCOPE_CHANGE : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_SERIALIZE : MessageIdentifiers.h
  • ID_RESERVED_3 : MessageIdentifiers.h
  • ID_RESERVED_4 : MessageIdentifiers.h
  • ID_RESERVED_5 : MessageIdentifiers.h
  • ID_RESERVED_6 : MessageIdentifiers.h
  • ID_RESERVED_7 : MessageIdentifiers.h
  • ID_RESERVED_8 : MessageIdentifiers.h
  • ID_RESERVED_9 : MessageIdentifiers.h
  • ID_ROOMS_EXECUTE_FUNC : MessageIdentifiers.h
  • ID_ROOMS_HANDLE_CHANGE : MessageIdentifiers.h
  • ID_ROOMS_LOGON_STATUS : MessageIdentifiers.h
  • ID_ROUTER_2_FORWARDING_ESTABLISHED : MessageIdentifiers.h
  • ID_ROUTER_2_FORWARDING_NO_PATH : MessageIdentifiers.h
  • ID_ROUTER_2_INTERNAL : MessageIdentifiers.h
  • ID_ROUTER_2_MINI_PUNCH_REPLY : MessageIdentifiers.h
  • ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE : MessageIdentifiers.h
  • ID_ROUTER_2_REPLY_TO_SENDER_PORT : MessageIdentifiers.h
  • ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT : MessageIdentifiers.h
  • ID_ROUTER_2_REROUTED : MessageIdentifiers.h
  • ID_RPC_PLUGIN : MessageIdentifiers.h
  • ID_RPC_REMOTE_ERROR : MessageIdentifiers.h
  • ID_SND_RECEIPT_ACKED : MessageIdentifiers.h
  • ID_SND_RECEIPT_LOSS : MessageIdentifiers.h
  • ID_SQLite3_EXEC : MessageIdentifiers.h
  • ID_SQLite3_UNKNOWN_DB : MessageIdentifiers.h
  • ID_SQLLITE_LOGGER : MessageIdentifiers.h
  • ID_TEAM_BALANCER_INTERNAL : MessageIdentifiers.h
  • ID_TEAM_BALANCER_REQUESTED_TEAM_FULL : MessageIdentifiers.h
  • ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED : MessageIdentifiers.h
  • ID_TEAM_BALANCER_TEAM_ASSIGNED : MessageIdentifiers.h
  • ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED : MessageIdentifiers.h
  • ID_TIMESTAMP : MessageIdentifiers.h
  • ID_TRANSPORT_STRING : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_NEGOTIATION : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT : MessageIdentifiers.h
  • ID_UDP_PROXY_ALL_SERVERS_BUSY : UDPProxyCommon.h
  • ID_UDP_PROXY_ALREADY_LOGGED_IN_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_NOTIFICATION : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_REPLY_FROM_SERVER_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_REQUEST_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_SUCCEEDED : UDPProxyCommon.h
  • ID_UDP_PROXY_GENERAL : MessageIdentifiers.h
  • ID_UDP_PROXY_IN_PROGRESS : UDPProxyCommon.h
  • ID_UDP_PROXY_LOGIN_REQUEST_FROM_SERVER_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_LOGIN_SUCCESS_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UDP_PROXY_NO_PASSWORD_SET_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UDP_PROXY_NO_SERVERS_ONLINE : UDPProxyCommon.h
  • ID_UDP_PROXY_PING_SERVERS_FROM_COORDINATOR_TO_CLIENT : UDPProxyCommon.h
  • ID_UDP_PROXY_PING_SERVERS_REPLY_FROM_CLIENT_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_RECIPIENT_GUID_NOT_CONNECTED_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_WRONG_PASSWORD_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UNCONNECTED_PING : MessageIdentifiers.h
  • ID_UNCONNECTED_PING_OPEN_CONNECTIONS : MessageIdentifiers.h
  • ID_UNCONNECTED_PONG : MessageIdentifiers.h
  • ID_USER_PACKET_ENUM : MessageIdentifiers.h
  • ID_XBOX_360_GET_NETWORK_ROOM : MessageIdentifiers.h
  • ID_XBOX_360_RETURN_NETWORK_ROOM : MessageIdentifiers.h
  • ID_XBOX_360_VOICE : MessageIdentifiers.h
  • ID_XBOX_LOBBY : MessageIdentifiers.h
  • if() : ThreadPool.h
  • IMMEDIATE_PRIORITY : PacketPriority.h
  • INCLUDE_TIMESTAMP_WITH_DATAGRAMS : ReliabilityLayer.h
  • INCREMENTAL_READ_BLOCK : SuperFastHash.cpp
  • initialized : GetTime.cpp
  • initialTime : GetTime.cpp
  • inputData : ThreadPool.h
  • int16_t : NativeTypes.h
  • int32_t : NativeTypes.h
  • int64_t : NativeTypes.h
  • int8_t : NativeTypes.h
  • INT_64 : DR_SHA1.h
  • INTERNAL_PACKET_PAGE_SIZE : defines.h
  • INVALID_SOCKET : RakNetSocket2.cpp
  • ioctlsocket__ : SocketDefines.h
  • IPV4_LOOPBACK : RakNetTypes.cpp
  • IPV6_LOOPBACK : RakNetTypes.cpp
  • IsSlash() : FileOperations.h
  • Itoa() : Itoa.cpp , Itoa.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- k -

  • K : Rand.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- l -

  • LIBCAT_SECURITY : NativeFeatureIncludes.h
  • listen__ : SocketDefines.h
  • loBit : Rand.cpp
  • loBits : Rand.cpp
  • Lock() : ThreadPool.h
  • LOW_PRIORITY : PacketPriority.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- m -

  • M : Rand.cpp
  • MAX_ALLOCA_STACK_ALLOCATION : defines.h
  • MAX_BYTES_PER_UNICODE_CHAR : RakWString.cpp
  • MAX_OFFLINE_DATA_LENGTH : RakPeer.cpp
  • MAX_RTT : CCRakNetUDT.cpp
  • MAX_TIME_BETWEEN_PACKETS : ReliabilityLayer.cpp
  • MAX_UNSIGNED_LONG : DS_List.h
  • MAXIMUM_MTU_SIZE : MTUSize.h
  • MAXIMUM_NUMBER_OF_INTERNAL_IDS : defines.h
  • MEDIUM_PRIORITY : PacketPriority.h
  • MESSAGE_FILTER_MAX_MESSAGE_ID : MessageFilter.h
  • MicrosecondsPerByte : CCRakNetSlidingWindow.h
  • MINIMUM_LIST_SIZE : SingleProducerConsumer.h
  • MINIMUM_MTU_SIZE : MTUSize.h
  • mixBits : Rand.cpp
  • ML_ORDERED_LIST : DS_Multilist.h
  • ML_QUEUE : DS_Multilist.h
  • ML_STACK : DS_Multilist.h
  • ML_UNORDERED_LIST : DS_Multilist.h
  • ML_VARIABLE_DURING_RUNTIME : DS_Multilist.h
  • mtuSizes : RakPeer.cpp
  • MultilistType : DS_Multilist.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- n -

  • N : Rand.cpp
  • NETWORK_ID_MANAGER_HASH_LENGTH : NetworkIDManager.h
  • NOMINMAX : WindowsIncludes.h
  • NONCE_TIMEOUT_MS : TwoWayAuthentication.h
  • notifyOutOfMemory : RakMemoryOverride.cpp , memoryoverride.h
  • NUM_MTU_SIZES : RakPeer.cpp
  • NUM_TYPE_MAPPINGS : VariadicSQLParser.cpp
  • NUMBER_OF_ORDERED_STREAMS : ReliabilityLayer.h
  • NUMBER_OF_PRIORITIES : PacketPriority.h
  • NUMBER_OF_RELIABILITIES : PacketPriority.h
  • numThreadsRunning : ThreadPool.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- o -

  • OFFLINE_MESSAGE_DATA_ID : RakPeer.cpp
  • OPEN_SSL_CLIENT_SUPPORT : defines.h
  • operator+() : RakWString.cpp , string.h , wstring.h , RakString.cpp
  • operator<<() : FileListNodeContext.h
  • operator>>() : FileListNodeContext.h
  • OutOfBandIdentifiers : MessageIdentifiers.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- p -

  • PacketPriority : PacketPriority.h
  • PacketReliability : PacketPriority.h
  • PatchContext : AutopatcherPatchContext.h
  • PC_ERROR_FILE_WRITE_FAILURE : AutopatcherPatchContext.h
  • PC_ERROR_PATCH_APPLICATION_FAILURE : AutopatcherPatchContext.h
  • PC_ERROR_PATCH_RESULT_CHECKSUM_FAILURE : AutopatcherPatchContext.h
  • PC_ERROR_PATCH_TARGET_MISSING : AutopatcherPatchContext.h
  • PC_HASH_1_WITH_PATCH : AutopatcherPatchContext.h
  • PC_HASH_2_WITH_PATCH : AutopatcherPatchContext.h
  • PC_NOTICE_FILE_DOWNLOADED : AutopatcherPatchContext.h
  • PC_NOTICE_FILE_DOWNLOADED_PATCH : AutopatcherPatchContext.h
  • PC_NOTICE_WILL_COPY_ON_RESTART : AutopatcherPatchContext.h
  • PC_WRITE_FILE : AutopatcherPatchContext.h
  • perThreadData : ThreadPool.h
  • porges_strlen2() : RakString.cpp
  • PREALLOCATE_LARGE_MESSAGES : defines.h
  • PRINTF_64_BIT_MODIFIER : types.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- q -

  • QuoteIfSpaces() : FileOperations.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- r -

  • RAK_DLL_EXPORT : Export.h
  • RAK_THREAD_DECLARATION : thread.h , RakPeer.cpp , RakNetSocket2.cpp
  • RAK_TIME_FORMAT_STRING : time.h
  • RakAssert : defines.h
  • rakFree : memoryoverride.h , RakMemoryOverride.cpp
  • rakFree_Ex : RakMemoryOverride.cpp , memoryoverride.h
  • rakMalloc : RakMemoryOverride.cpp , memoryoverride.h
  • rakMalloc_Ex : RakMemoryOverride.cpp , memoryoverride.h
  • RAKNET_DATE : version.h
  • RAKNET_DEBUG_PRINTF : defines.h
  • RAKNET_DEBUG_TPRINTF : defines.h
  • RAKNET_PROTOCOL_VERSION : version.h
  • RAKNET_SOCKET_2_INLINE_FUNCTIONS : RakNetSocket2.cpp
  • RAKNET_SUPPORT_IPV6 : defines.h
  • RAKNET_VERSION : version.h
  • RAKNET_VERSION_NUMBER : version.h
  • RAKNET_VERSION_NUMBER_INT : version.h
  • RAKPEER_USER_THREADED : defines.h
  • rakRealloc : RakMemoryOverride.cpp , memoryoverride.h
  • rakRealloc_Ex : RakMemoryOverride.cpp , memoryoverride.h
  • RakSleep() : RakSleep.cpp , sleep.h
  • RAKSTRING_TYPE : defines.h
  • RAKSTRING_TYPE_IS_UNICODE : defines.h
  • randomMT() : Rand.cpp , Rand.h
  • raw() : Kbhit.h
  • recv__ : SocketDefines.h
  • recvfrom__ : SocketDefines.h
  • RELIABLE : PacketPriority.h
  • RELIABLE_ORDERED : PacketPriority.h
  • RELIABLE_ORDERED_WITH_ACK_RECEIPT : PacketPriority.h
  • RELIABLE_SEQUENCED : PacketPriority.h
  • RELIABLE_WITH_ACK_RECEIPT : PacketPriority.h
  • reloadMT() : Rand.cpp , Rand.h
  • REMOTE_MAX_TEXT_INPUT : TransportInterface.h
  • REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE : RakPeer.cpp
  • REPLICA_CANCEL_PROCESS : ReplicaEnums.h
  • REPLICA_PROCESS_AGAIN : ReplicaEnums.h
  • REPLICA_PROCESS_IMPLICIT : ReplicaEnums.h
  • REPLICA_PROCESS_LATER : ReplicaEnums.h
  • REPLICA_PROCESSING_DONE : ReplicaEnums.h
  • REPLICA_RECEIVE_DESTRUCTION : ReplicaEnums.h
  • REPLICA_RECEIVE_SCOPE_CHANGE : ReplicaEnums.h
  • REPLICA_RECEIVE_SERIALIZE : ReplicaEnums.h
  • REPLICA_SEND_CONSTRUCTION : ReplicaEnums.h
  • REPLICA_SEND_DESTRUCTION : ReplicaEnums.h
  • REPLICA_SEND_SCOPE_CHANGE : ReplicaEnums.h
  • REPLICA_SEND_SERIALIZE : ReplicaEnums.h
  • REPLICA_SET_ALL : ReplicaEnums.h
  • ReplicaReturnResult : ReplicaEnums.h
  • RESEND_BUFFER_ARRAY_LENGTH : defines.h
  • RESEND_BUFFER_ARRAY_MASK : defines.h
  • RESEND_TREE_ORDER : ReliabilityLayer.h
  • return : ThreadPool.h
  • returnOutput : ThreadPool.h
  • rnr : RakPeer.cpp
  • ROL32 : DR_SHA1.cpp
  • RowSort() : DS_Table.cpp
  • RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH : defines.h
  • RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS : defines.h
  • RTT_TOLERANCE : CCRakNetUDT.cpp
  • RTTVarMultiple : CCRakNetUDT.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- s -

  • S_R0 : DR_SHA1.cpp
  • S_R1 : DR_SHA1.cpp
  • S_R2 : DR_SHA1.cpp
  • S_R3 : DR_SHA1.cpp
  • S_R4 : DR_SHA1.cpp
  • seedMT() : Rand.h , Rand.cpp
  • select__ : SocketDefines.h
  • send__ : SocketDefines.h
  • sendto__ : SocketDefines.h
  • SetDLMallocDirectMMap() : RakMemoryOverride.cpp , memoryoverride.h
  • SetDLMallocMMap() : RakMemoryOverride.cpp , memoryoverride.h
  • SetDLMallocMUnmap() : RakMemoryOverride.cpp , memoryoverride.h
  • SetFree() : RakMemoryOverride.cpp , memoryoverride.h
  • SetFree_Ex() : RakMemoryOverride.cpp , memoryoverride.h
  • SetMalloc() : RakMemoryOverride.cpp , memoryoverride.h
  • SetMalloc_Ex() : RakMemoryOverride.cpp , memoryoverride.h
  • SetNotifyOutOfMemory() : RakMemoryOverride.cpp , memoryoverride.h
  • SetRealloc() : RakMemoryOverride.cpp , memoryoverride.h
  • SetRealloc_Ex() : RakMemoryOverride.cpp , memoryoverride.h
  • setsockopt__ : SocketDefines.h
  • SH_TYPE_MAX : StatisticsHistory.h
  • SHA1_LENGTH : DR_SHA1.h
  • SHA1_LITTLE_ENDIAN : DR_SHA1.h
  • SHA1_MAX_FILE_BUFFER : DR_SHA1.cpp
  • SHA1_STL_FUNCTIONS : DR_SHA1.h
  • SHA1_UTILITY_FUNCTIONS : DR_SHA1.h
  • SHA1_WIPE_VARIABLES : DR_SHA1.h
  • SHABLK : DR_SHA1.cpp
  • SHABLK0 : DR_SHA1.cpp
  • shutdown__ : SocketDefines.h
  • SLIKENET_DATE : version.h
  • SLIKENET_VERSION : version.h
  • SLIKENET_VERSION_NUMBER : version.h
  • SLIKENET_VERSION_NUMBER_INT : version.h
  • SLNET_MAX_RETRIEVABLE_FILESIZE : defines.h
  • socket__ : SocketDefines.h
  • SplitPacketIndexComp() : ReliabilityLayer.cpp
  • STARTING_TIME_BETWEEN_PACKETS : ReliabilityLayer.cpp
  • STATIC_FACTORY_DECLARATIONS : Export.h
  • STATIC_FACTORY_DEFINITIONS : Export.h
  • StringTableType : StringTable.h
  • SuperFastHash() : SuperFastHash.cpp , SuperFastHash.h
  • SuperFastHashFile() : SuperFastHash.cpp , SuperFastHash.h
  • SuperFastHashFilePtr() : SuperFastHash.h , SuperFastHash.cpp
  • SuperFastHashIncremental() : SuperFastHash.h , SuperFastHash.cpp
  • SYN : CCRakNetUDT.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- t -

  • TCHAR : DR_SHA1.h
  • threadPool : ThreadPool.h
  • TWO_WAY_AUTHENTICATION_NONCE_LENGTH : TwoWayAuthentication.h
  • typeMappings : VariadicSQLParser.cpp
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- u -

  • UDP_FORWARDER_MAXIMUM_TIMEOUT : UDPProxyCommon.h
  • UDP_HEADER_SIZE : CCRakNetSlidingWindow.h
  • UDPProxyMessages : UDPProxyCommon.h
  • uint16_t : NativeTypes.h
  • uint32_t : NativeTypes.h
  • uint64_t : NativeTypes.h
  • uint8_t : NativeTypes.h
  • UINT_32 : DR_SHA1.h
  • UINT_64 : DR_SHA1.h
  • UINT_8 : DR_SHA1.h
  • UNASSIGNED_TEAM_ID : TeamBalancer.h
  • UNDEFINED_TRANSFER_RATE : CCRakNetUDT.cpp
  • Unlock() : ThreadPool.h
  • UNRELIABLE : PacketPriority.h
  • UNRELIABLE_SEQUENCED : PacketPriority.h
  • UNRELIABLE_WITH_ACK_RECEIPT : PacketPriority.h
  • UNSET_TIME_US : CCRakNetUDT.cpp
  • USE_ALLOCA : defines.h
  • USE_SLIDING_WINDOW_CONGESTION_CONTROL : defines.h
  • USE_WAIT_FOR_MULTIPLE_EVENTS : defines.h
  • UseRaknetFixedHeap() : memoryoverride.h , RakMemoryOverride.cpp
  • userCallback : ThreadPool.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- w -

  • WriteFileWithDirectories() : FileOperations.h
  • WSASendTo__ : SocketDefines.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
Here is a list of all file members with links to the files they belong to:

- x -

  • XBOX_BYPASS_SECURITY : defines.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • l
  • o
  • p
  • q
  • r
  • s
  • u
  • w

- _ -

  • _DLFree() : RakMemoryOverride.cpp
  • _DLFree_Ex() : RakMemoryOverride.cpp
  • _DLMalloc() : RakMemoryOverride.cpp
  • _DLMalloc_Ex() : RakMemoryOverride.cpp
  • _DLRealloc() : RakMemoryOverride.cpp
  • _DLRealloc_Ex() : RakMemoryOverride.cpp
  • _getch() : Kbhit.h
  • _getche() : Getche.cpp , Getche.h
  • _kbhit() : Kbhit.h

- a -

  • AddSlash() : FileOperations.h

- b -

  • Base64Encoding() : Base64Encoder.cpp , Base64Encoder.h
  • Base64Map() : Base64Encoder.cpp , Base64Encoder.h

- c -

  • Ceil() : ReliabilityLayer.cpp
  • cooked() : Kbhit.h

- d -

  • DefaultOutOfMemoryHandler() : RakMemoryOverride.cpp
  • DirectoryExists() : FileOperations.h

- e -

  • EpochTimeToString() : EpochTimeToString.cpp , EpochTimeToString.h
  • ExtendRows() : DS_Table.cpp

- f -

  • fillBufferMT() : Rand.cpp , Rand.h
  • for() : ThreadPool.h
  • FormatString() : FormatString.cpp , FormatString.h
  • FormatStringTS() : FormatString.h , FormatString.cpp
  • frandomMT() : Rand.cpp , Rand.h , Rand.cpp
  • FreeRakNetFixedHeap() : RakMemoryOverride.cpp , memoryoverride.h
  • FreeRow() : DS_Table.cpp

- g -

  • GetFileLength() : FileOperations.h
  • GetMyIP_Win32() : SocketLayer.cpp
  • GetPoolMutex() : RakString.cpp
  • Gets() : Gets.cpp , Gets.h
  • GetTypeMappingIndex() : VariadicSQLParser.cpp

- i -

  • if() : ThreadPool.h
  • IsSlash() : FileOperations.h
  • Itoa() : Itoa.cpp , Itoa.h

- l -

  • Lock() : ThreadPool.h

- o -

  • operator+() : RakString.cpp , RakWString.cpp , wstring.h , string.h
  • operator<<() : FileListNodeContext.h
  • operator>>() : FileListNodeContext.h

- p -

  • porges_strlen2() : RakString.cpp

- q -

  • QuoteIfSpaces() : FileOperations.h

- r -

  • RAK_THREAD_DECLARATION() : RakNetSocket2.cpp , RakPeer.cpp
  • RakSleep() : sleep.h , RakSleep.cpp
  • randomMT() : Rand.cpp , Rand.h
  • raw() : Kbhit.h
  • reloadMT() : Rand.h , Rand.cpp
  • RowSort() : DS_Table.cpp

- s -

  • seedMT() : Rand.cpp , Rand.h
  • SetDLMallocDirectMMap() : RakMemoryOverride.cpp , memoryoverride.h
  • SetDLMallocMMap() : RakMemoryOverride.cpp , memoryoverride.h
  • SetDLMallocMUnmap() : RakMemoryOverride.cpp , memoryoverride.h
  • SetFree() : RakMemoryOverride.cpp , memoryoverride.h
  • SetFree_Ex() : RakMemoryOverride.cpp , memoryoverride.h
  • SetMalloc() : RakMemoryOverride.cpp , memoryoverride.h
  • SetMalloc_Ex() : RakMemoryOverride.cpp , memoryoverride.h
  • SetNotifyOutOfMemory() : RakMemoryOverride.cpp , memoryoverride.h
  • SetRealloc() : RakMemoryOverride.cpp , memoryoverride.h
  • SetRealloc_Ex() : memoryoverride.h , RakMemoryOverride.cpp
  • SplitPacketIndexComp() : ReliabilityLayer.cpp
  • SuperFastHash() : SuperFastHash.h , SuperFastHash.cpp
  • SuperFastHashFile() : SuperFastHash.cpp , SuperFastHash.h
  • SuperFastHashFilePtr() : SuperFastHash.h , SuperFastHash.cpp
  • SuperFastHashIncremental() : SuperFastHash.h , SuperFastHash.cpp

- u -

  • Unlock() : ThreadPool.h
  • UseRaknetFixedHeap() : memoryoverride.h , RakMemoryOverride.cpp

- w -

  • WriteFileWithDirectories() : FileOperations.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u

- _ -

  • _columnIndices : DS_Table.cpp
  • _columns : DS_Table.cpp
  • _left : Rand.cpp
  • _next : Rand.cpp
  • _numSortQueries : DS_Table.cpp
  • _sortQueries : DS_Table.cpp
  • _state : Rand.cpp

- b -

  • base64Map : Base64Encoder.cpp

- c -

  • callbackOutput : ThreadPool.h
  • cleanup : RakString.cpp
  • CWND_MIN_THRESHOLD : CCRakNetUDT.cpp

- d -

  • DEFAULT_HAS_RECEIVED_PACKET_QUEUE_SIZE : ReliabilityLayer.cpp
  • dlMallocDirectMMap : RakMemoryOverride.cpp , memoryoverride.h
  • dlMallocMMap : memoryoverride.h , RakMemoryOverride.cpp
  • dlMallocMUnmap : RakMemoryOverride.cpp , memoryoverride.h

- e -

  • englishCharacterFrequencies : StringCompressor.cpp

- f -

  • fakeCond : RakSleep.cpp
  • fakeMutex : RakSleep.cpp

- g -

  • g_old_kbd_mode : Kbhit.h
  • GetDLMallocDirectMMap : RakMemoryOverride.cpp , memoryoverride.h
  • GetDLMallocMMap : RakMemoryOverride.cpp , memoryoverride.h
  • GetDLMallocMUnmap : RakMemoryOverride.cpp , memoryoverride.h
  • GetFree : RakMemoryOverride.cpp , memoryoverride.h
  • GetFree_Ex : RakMemoryOverride.cpp , memoryoverride.h
  • GetMalloc : RakMemoryOverride.cpp , memoryoverride.h
  • GetMalloc_Ex : RakMemoryOverride.cpp , memoryoverride.h
  • GetRealloc : memoryoverride.h , RakMemoryOverride.cpp
  • GetRealloc_Ex : memoryoverride.h , RakMemoryOverride.cpp

- i -

  • INCREMENTAL_READ_BLOCK : SuperFastHash.cpp
  • initialized : GetTime.cpp
  • initialTime : GetTime.cpp
  • inputData : ThreadPool.h
  • IPV4_LOOPBACK : RakNetTypes.cpp
  • IPV6_LOOPBACK : RakNetTypes.cpp

- m -

  • MAX_OFFLINE_DATA_LENGTH : RakPeer.cpp
  • MAX_TIME_BETWEEN_PACKETS : ReliabilityLayer.cpp
  • MAX_UNSIGNED_LONG : DS_List.h
  • MINIMUM_LIST_SIZE : SingleProducerConsumer.h
  • mtuSizes : RakPeer.cpp

- n -

  • notifyOutOfMemory : RakMemoryOverride.cpp , memoryoverride.h
  • NUM_MTU_SIZES : RakPeer.cpp
  • NUM_TYPE_MAPPINGS : VariadicSQLParser.cpp
  • numThreadsRunning : ThreadPool.h

- o -

  • OFFLINE_MESSAGE_DATA_ID : RakPeer.cpp

- p -

  • perThreadData : ThreadPool.h

- r -

  • rakFree : RakMemoryOverride.cpp , memoryoverride.h
  • rakFree_Ex : memoryoverride.h , RakMemoryOverride.cpp
  • rakMalloc : RakMemoryOverride.cpp , memoryoverride.h
  • rakMalloc_Ex : memoryoverride.h , RakMemoryOverride.cpp
  • rakRealloc : RakMemoryOverride.cpp , memoryoverride.h
  • rakRealloc_Ex : RakMemoryOverride.cpp , memoryoverride.h
  • return : ThreadPool.h
  • returnOutput : ThreadPool.h
  • rnr : RakPeer.cpp
  • RTTVarMultiple : CCRakNetUDT.cpp

- s -

  • STARTING_TIME_BETWEEN_PACKETS : ReliabilityLayer.cpp
  • SYN : CCRakNetUDT.cpp

- t -

  • threadPool : ThreadPool.h
  • typeMappings : VariadicSQLParser.cpp

- u -

  • UNDEFINED_TRANSFER_RATE : CCRakNetUDT.cpp
  • UNSET_TIME_US : CCRakNetUDT.cpp
  • userCallback : ThreadPool.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • __TCPSOCKET__ : SocketIncludes.h
  • __UDPSOCKET__ : SocketIncludes.h
  • BitstreamLengthEncoding : ReliabilityLayer.cpp
  • BytesPerMicrosecond : CCRakNetSlidingWindow.h
  • BytesPerSecond : CCRakNetSlidingWindow.h
  • CCTimeType : CCRakNetSlidingWindow.h
  • DatagramSequenceNumberType : CCRakNetSlidingWindow.h
  • FCM2Guid : FullyConnectedMesh2.h , TwoWayAuthentication.h
  • int16_t : NativeTypes.h
  • int32_t : NativeTypes.h
  • int64_t : NativeTypes.h
  • int8_t : NativeTypes.h
  • MicrosecondsPerByte : CCRakNetSlidingWindow.h
  • StringTableType : StringTable.h
  • uint16_t : NativeTypes.h
  • uint32_t : NativeTypes.h
  • uint64_t : NativeTypes.h
  • uint8_t : NativeTypes.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • DefaultMessageIDTypes : MessageIdentifiers.h
  • MultilistType : DS_Multilist.h
  • OutOfBandIdentifiers : MessageIdentifiers.h
  • PacketPriority : PacketPriority.h
  • PacketReliability : PacketPriority.h
  • PatchContext : AutopatcherPatchContext.h
  • ReplicaReturnResult : ReplicaEnums.h
  • UDPProxyMessages : UDPProxyCommon.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • u

- h -

  • HIGH_PRIORITY : PacketPriority.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • u

- i -

  • ID_ADVERTISE_SYSTEM : MessageIdentifiers.h
  • ID_ALREADY_CONNECTED : MessageIdentifiers.h
  • ID_AUTOPATCHER_CANNOT_DOWNLOAD_ORIGINAL_UNMODIFIED_FILES : MessageIdentifiers.h
  • ID_AUTOPATCHER_CREATION_LIST : MessageIdentifiers.h
  • ID_AUTOPATCHER_DELETION_LIST : MessageIdentifiers.h
  • ID_AUTOPATCHER_FINISHED : MessageIdentifiers.h
  • ID_AUTOPATCHER_FINISHED_INTERNAL : MessageIdentifiers.h
  • ID_AUTOPATCHER_GET_CHANGELIST_SINCE_DATE : MessageIdentifiers.h
  • ID_AUTOPATCHER_GET_PATCH : MessageIdentifiers.h
  • ID_AUTOPATCHER_PATCH_LIST : MessageIdentifiers.h
  • ID_AUTOPATCHER_REPOSITORY_FATAL_ERROR : MessageIdentifiers.h
  • ID_AUTOPATCHER_RESTART_APPLICATION : MessageIdentifiers.h
  • ID_CLOUD_GET_REQUEST : MessageIdentifiers.h
  • ID_CLOUD_GET_RESPONSE : MessageIdentifiers.h
  • ID_CLOUD_POST_REQUEST : MessageIdentifiers.h
  • ID_CLOUD_RELEASE_REQUEST : MessageIdentifiers.h
  • ID_CLOUD_SERVER_TO_SERVER_COMMAND : MessageIdentifiers.h
  • ID_CLOUD_SUBSCRIPTION_NOTIFICATION : MessageIdentifiers.h
  • ID_CLOUD_UNSUBSCRIBE_REQUEST : MessageIdentifiers.h
  • ID_CONNECTED_PING : MessageIdentifiers.h
  • ID_CONNECTED_PONG : MessageIdentifiers.h
  • ID_CONNECTION_ATTEMPT_FAILED : MessageIdentifiers.h
  • ID_CONNECTION_BANNED : MessageIdentifiers.h
  • ID_CONNECTION_LOST : MessageIdentifiers.h
  • ID_CONNECTION_REQUEST : MessageIdentifiers.h
  • ID_CONNECTION_REQUEST_ACCEPTED : MessageIdentifiers.h
  • ID_DDT_DOWNLOAD_REQUEST : MessageIdentifiers.h
  • ID_DETECT_LOST_CONNECTIONS : MessageIdentifiers.h
  • ID_DISCONNECTION_NOTIFICATION : MessageIdentifiers.h
  • ID_DOWNLOAD_PROGRESS : MessageIdentifiers.h
  • ID_FCM2_INFORM_FCMGUID : MessageIdentifiers.h
  • ID_FCM2_NEW_HOST : MessageIdentifiers.h
  • ID_FCM2_REQUEST_FCMGUID : MessageIdentifiers.h
  • ID_FCM2_RESPOND_CONNECTION_COUNT : MessageIdentifiers.h
  • ID_FCM2_UPDATE_MIN_TOTAL_CONNECTION_COUNT : MessageIdentifiers.h
  • ID_FCM2_UPDATE_USER_CONTEXT : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_ACCEPTED : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_CAPABLE : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_FAILED : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_REJECTED : MessageIdentifiers.h
  • ID_FCM2_VERIFIED_JOIN_START : MessageIdentifiers.h
  • ID_FILE_LIST_REFERENCE_PUSH : MessageIdentifiers.h
  • ID_FILE_LIST_REFERENCE_PUSH_ACK : MessageIdentifiers.h
  • ID_FILE_LIST_TRANSFER_FILE : MessageIdentifiers.h
  • ID_FILE_LIST_TRANSFER_HEADER : MessageIdentifiers.h
  • ID_INCOMPATIBLE_PROTOCOL_VERSION : MessageIdentifiers.h
  • ID_INVALID_PASSWORD : MessageIdentifiers.h
  • ID_IP_RECENTLY_CONNECTED : MessageIdentifiers.h
  • ID_LIB_VOICE : MessageIdentifiers.h
  • ID_LIGHTSPEED_INTEGRATION : MessageIdentifiers.h
  • ID_LOBBY2_SEND_MESSAGE : MessageIdentifiers.h
  • ID_LOBBY2_SERVER_ERROR : MessageIdentifiers.h
  • ID_LOBBY_GENERAL : MessageIdentifiers.h
  • ID_NAT_ALREADY_IN_PROGRESS : MessageIdentifiers.h
  • ID_NAT_CLIENT_READY : MessageIdentifiers.h
  • ID_NAT_CONNECT_AT_TIME : MessageIdentifiers.h
  • ID_NAT_CONNECTION_TO_TARGET_LOST : MessageIdentifiers.h
  • ID_NAT_ESTABLISH_BIDIRECTIONAL : MessageIdentifiers.h
  • ID_NAT_ESTABLISH_UNIDIRECTIONAL : MessageIdentifiers.h
  • ID_NAT_GET_MOST_RECENT_PORT : MessageIdentifiers.h
  • ID_NAT_PING : MessageIdentifiers.h
  • ID_NAT_PONG : MessageIdentifiers.h
  • ID_NAT_PUNCHTHROUGH_FAILED : MessageIdentifiers.h
  • ID_NAT_PUNCHTHROUGH_REQUEST : MessageIdentifiers.h
  • ID_NAT_PUNCHTHROUGH_SUCCEEDED : MessageIdentifiers.h
  • ID_NAT_REQUEST_BOUND_ADDRESSES : MessageIdentifiers.h
  • ID_NAT_RESPOND_BOUND_ADDRESSES : MessageIdentifiers.h
  • ID_NAT_TARGET_NOT_CONNECTED : MessageIdentifiers.h
  • ID_NAT_TARGET_UNRESPONSIVE : MessageIdentifiers.h
  • ID_NAT_TYPE_DETECT : MessageIdentifiers.h
  • ID_NAT_TYPE_DETECTION_REQUEST : MessageIdentifiers.h
  • ID_NAT_TYPE_DETECTION_RESULT : MessageIdentifiers.h
  • ID_NEW_INCOMING_CONNECTION : MessageIdentifiers.h
  • ID_NO_FREE_INCOMING_CONNECTIONS : MessageIdentifiers.h
  • ID_OPEN_CONNECTION_REPLY_1 : MessageIdentifiers.h
  • ID_OPEN_CONNECTION_REPLY_2 : MessageIdentifiers.h
  • ID_OPEN_CONNECTION_REQUEST_1 : MessageIdentifiers.h
  • ID_OPEN_CONNECTION_REQUEST_2 : MessageIdentifiers.h
  • ID_OUR_SYSTEM_REQUIRES_SECURITY : MessageIdentifiers.h
  • ID_OUT_OF_BAND_INTERNAL : MessageIdentifiers.h
  • ID_PUBLIC_KEY_MISMATCH : MessageIdentifiers.h
  • ID_RAKVOICE_CLOSE_CHANNEL : MessageIdentifiers.h
  • ID_RAKVOICE_DATA : MessageIdentifiers.h
  • ID_RAKVOICE_OPEN_CHANNEL_REPLY : MessageIdentifiers.h
  • ID_RAKVOICE_OPEN_CHANNEL_REQUEST : MessageIdentifiers.h
  • ID_READY_EVENT_ALL_SET : MessageIdentifiers.h
  • ID_READY_EVENT_FORCE_ALL_SET : MessageIdentifiers.h
  • ID_READY_EVENT_QUERY : MessageIdentifiers.h
  • ID_READY_EVENT_SET : MessageIdentifiers.h
  • ID_READY_EVENT_UNSET : MessageIdentifiers.h
  • ID_RELAY_PLUGIN : MessageIdentifiers.h
  • ID_REMOTE_CONNECTION_LOST : MessageIdentifiers.h
  • ID_REMOTE_DISCONNECTION_NOTIFICATION : MessageIdentifiers.h
  • ID_REMOTE_NEW_INCOMING_CONNECTION : MessageIdentifiers.h
  • ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_CONSTRUCTION : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_DOWNLOAD_STARTED : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_SCOPE_CHANGE : MessageIdentifiers.h
  • ID_REPLICA_MANAGER_SERIALIZE : MessageIdentifiers.h
  • ID_RESERVED_3 : MessageIdentifiers.h
  • ID_RESERVED_4 : MessageIdentifiers.h
  • ID_RESERVED_5 : MessageIdentifiers.h
  • ID_RESERVED_6 : MessageIdentifiers.h
  • ID_RESERVED_7 : MessageIdentifiers.h
  • ID_RESERVED_8 : MessageIdentifiers.h
  • ID_RESERVED_9 : MessageIdentifiers.h
  • ID_ROOMS_EXECUTE_FUNC : MessageIdentifiers.h
  • ID_ROOMS_HANDLE_CHANGE : MessageIdentifiers.h
  • ID_ROOMS_LOGON_STATUS : MessageIdentifiers.h
  • ID_ROUTER_2_FORWARDING_ESTABLISHED : MessageIdentifiers.h
  • ID_ROUTER_2_FORWARDING_NO_PATH : MessageIdentifiers.h
  • ID_ROUTER_2_INTERNAL : MessageIdentifiers.h
  • ID_ROUTER_2_MINI_PUNCH_REPLY : MessageIdentifiers.h
  • ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE : MessageIdentifiers.h
  • ID_ROUTER_2_REPLY_TO_SENDER_PORT : MessageIdentifiers.h
  • ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT : MessageIdentifiers.h
  • ID_ROUTER_2_REROUTED : MessageIdentifiers.h
  • ID_RPC_PLUGIN : MessageIdentifiers.h
  • ID_RPC_REMOTE_ERROR : MessageIdentifiers.h
  • ID_SND_RECEIPT_ACKED : MessageIdentifiers.h
  • ID_SND_RECEIPT_LOSS : MessageIdentifiers.h
  • ID_SQLite3_EXEC : MessageIdentifiers.h
  • ID_SQLite3_UNKNOWN_DB : MessageIdentifiers.h
  • ID_SQLLITE_LOGGER : MessageIdentifiers.h
  • ID_TEAM_BALANCER_INTERNAL : MessageIdentifiers.h
  • ID_TEAM_BALANCER_REQUESTED_TEAM_FULL : MessageIdentifiers.h
  • ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED : MessageIdentifiers.h
  • ID_TEAM_BALANCER_TEAM_ASSIGNED : MessageIdentifiers.h
  • ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED : MessageIdentifiers.h
  • ID_TIMESTAMP : MessageIdentifiers.h
  • ID_TRANSPORT_STRING : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_NEGOTIATION : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS : MessageIdentifiers.h
  • ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT : MessageIdentifiers.h
  • ID_UDP_PROXY_ALL_SERVERS_BUSY : UDPProxyCommon.h
  • ID_UDP_PROXY_ALREADY_LOGGED_IN_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_NOTIFICATION : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_REPLY_FROM_SERVER_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_REQUEST_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UDP_PROXY_FORWARDING_SUCCEEDED : UDPProxyCommon.h
  • ID_UDP_PROXY_GENERAL : MessageIdentifiers.h
  • ID_UDP_PROXY_IN_PROGRESS : UDPProxyCommon.h
  • ID_UDP_PROXY_LOGIN_REQUEST_FROM_SERVER_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_LOGIN_SUCCESS_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UDP_PROXY_NO_PASSWORD_SET_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UDP_PROXY_NO_SERVERS_ONLINE : UDPProxyCommon.h
  • ID_UDP_PROXY_PING_SERVERS_FROM_COORDINATOR_TO_CLIENT : UDPProxyCommon.h
  • ID_UDP_PROXY_PING_SERVERS_REPLY_FROM_CLIENT_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_RECIPIENT_GUID_NOT_CONNECTED_TO_COORDINATOR : UDPProxyCommon.h
  • ID_UDP_PROXY_WRONG_PASSWORD_FROM_COORDINATOR_TO_SERVER : UDPProxyCommon.h
  • ID_UNCONNECTED_PING : MessageIdentifiers.h
  • ID_UNCONNECTED_PING_OPEN_CONNECTIONS : MessageIdentifiers.h
  • ID_UNCONNECTED_PONG : MessageIdentifiers.h
  • ID_USER_PACKET_ENUM : MessageIdentifiers.h
  • ID_XBOX_360_GET_NETWORK_ROOM : MessageIdentifiers.h
  • ID_XBOX_360_RETURN_NETWORK_ROOM : MessageIdentifiers.h
  • ID_XBOX_360_VOICE : MessageIdentifiers.h
  • ID_XBOX_LOBBY : MessageIdentifiers.h
  • IMMEDIATE_PRIORITY : PacketPriority.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • u

- l -

  • LOW_PRIORITY : PacketPriority.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • u

- m -

  • MEDIUM_PRIORITY : PacketPriority.h
  • ML_ORDERED_LIST : DS_Multilist.h
  • ML_QUEUE : DS_Multilist.h
  • ML_STACK : DS_Multilist.h
  • ML_UNORDERED_LIST : DS_Multilist.h
  • ML_VARIABLE_DURING_RUNTIME : DS_Multilist.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • u

- n -

  • NUMBER_OF_PRIORITIES : PacketPriority.h
  • NUMBER_OF_RELIABILITIES : PacketPriority.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • u

- p -

  • PC_ERROR_FILE_WRITE_FAILURE : AutopatcherPatchContext.h
  • PC_ERROR_PATCH_APPLICATION_FAILURE : AutopatcherPatchContext.h
  • PC_ERROR_PATCH_RESULT_CHECKSUM_FAILURE : AutopatcherPatchContext.h
  • PC_ERROR_PATCH_TARGET_MISSING : AutopatcherPatchContext.h
  • PC_HASH_1_WITH_PATCH : AutopatcherPatchContext.h
  • PC_HASH_2_WITH_PATCH : AutopatcherPatchContext.h
  • PC_NOTICE_FILE_DOWNLOADED : AutopatcherPatchContext.h
  • PC_NOTICE_FILE_DOWNLOADED_PATCH : AutopatcherPatchContext.h
  • PC_NOTICE_WILL_COPY_ON_RESTART : AutopatcherPatchContext.h
  • PC_WRITE_FILE : AutopatcherPatchContext.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • u

- r -

  • RELIABLE : PacketPriority.h
  • RELIABLE_ORDERED : PacketPriority.h
  • RELIABLE_ORDERED_WITH_ACK_RECEIPT : PacketPriority.h
  • RELIABLE_SEQUENCED : PacketPriority.h
  • RELIABLE_WITH_ACK_RECEIPT : PacketPriority.h
  • REPLICA_CANCEL_PROCESS : ReplicaEnums.h
  • REPLICA_PROCESS_AGAIN : ReplicaEnums.h
  • REPLICA_PROCESS_IMPLICIT : ReplicaEnums.h
  • REPLICA_PROCESS_LATER : ReplicaEnums.h
  • REPLICA_PROCESSING_DONE : ReplicaEnums.h
  • REPLICA_RECEIVE_DESTRUCTION : ReplicaEnums.h
  • REPLICA_RECEIVE_SCOPE_CHANGE : ReplicaEnums.h
  • REPLICA_RECEIVE_SERIALIZE : ReplicaEnums.h
  • REPLICA_SEND_CONSTRUCTION : ReplicaEnums.h
  • REPLICA_SEND_DESTRUCTION : ReplicaEnums.h
  • REPLICA_SEND_SCOPE_CHANGE : ReplicaEnums.h
  • REPLICA_SEND_SERIALIZE : ReplicaEnums.h
  • REPLICA_SET_ALL : ReplicaEnums.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • u

- u -

  • UNRELIABLE : PacketPriority.h
  • UNRELIABLE_SEQUENCED : PacketPriority.h
  • UNRELIABLE_WITH_ACK_RECEIPT : PacketPriority.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: File Members

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • w
  • x

- _ -

  • __CLOUD_CLIENT_H : CloudClient.h
  • __GET_TIME_64BIT : defines.h
  • _copysign : BitStream.h , BitStream.cpp
  • _CRT_SECURE_NO_WARNINGS : DR_SHA1.cpp
  • _FILE_AND_LINE_ : defines.h
  • _getts : DR_SHA1.h
  • _PP_Instance_ : SocketIncludes.h
  • _RAKNET_SUPPORT_CloudClient : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_CloudServer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_ConnectionGraph2 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_ConsoleServer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_DirectoryDeltaTransfer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_DynDNS : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_EmailSender : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_FileListTransfer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_FileOperations : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_FullyConnectedMesh : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_FullyConnectedMesh2 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_HTTPConnection : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_HTTPConnection2 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_LibVoice : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_LogCommandParser : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_MessageFilter : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_NatPunchthroughClient : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_NatPunchthroughServer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_NatTypeDetectionClient : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_NatTypeDetectionServer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_PacketizedTCP : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_PacketLogger : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_Rackspace : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_RakNetCommandParser : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_RakNetTransport : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_ReadyEvent : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_RelayPlugin : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_ReplicaManager3 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_Router2 : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_RPC4Plugin : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_StatisticsHistory : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TCPInterface : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TeamBalancer : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TeamManager : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TelnetTransport : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_TwoWayAuthentication : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_UDPForwarder : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_UDPProxyClient : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_UDPProxyCoordinator : NativeFeatureIncludes.h
  • _RAKNET_SUPPORT_UDPProxyServer : NativeFeatureIncludes.h
  • _sntprintf : DR_SHA1.h
  • _T : WSAStartupSingleton.cpp , DR_SHA1.h , SocketLayer.cpp
  • _TABLE_BPLUS_TREE_ORDER : DS_Table.h
  • _TABLE_MAX_COLUMN_NAME_LENGTH : DS_Table.h
  • _tcscat : DR_SHA1.h
  • _tcscpy : DR_SHA1.h
  • _tcslen : DR_SHA1.h
  • _tfopen : DR_SHA1.h
  • _tmain : DR_SHA1.h
  • _tprintf : DR_SHA1.h
  • _USE_RAK_MEMORY_OVERRIDE : defines.h

- a -

  • accept__ : SocketDefines.h
  • ALLOW_JOIN_ANY_AVAILABLE_TEAM : TeamManager.h
  • ALLOW_JOIN_REBALANCING : TeamManager.h
  • ALLOW_JOIN_SPECIFIC_TEAM : TeamManager.h

- b -

  • bind__ : SocketDefines.h
  • BITS_TO_BYTES : types.h
  • BITSTREAM_STACK_ALLOCATION_SIZE : defines.h
  • BUFFERED_PACKETS_PAGE_SIZE : defines.h
  • BYTES_TO_BITS : types.h

- c -

  • CAT_AUDIT_PRINTF : RakPeer.cpp
  • CAT_NEUTER_EXPORT : RakPeer.cpp
  • CC_DEBUG_PRINTF_1 : CCRakNetSlidingWindow.h
  • CC_DEBUG_PRINTF_2 : CCRakNetSlidingWindow.h
  • CC_DEBUG_PRINTF_3 : CCRakNetSlidingWindow.h
  • CC_DEBUG_PRINTF_4 : CCRakNetSlidingWindow.h
  • CC_DEBUG_PRINTF_5 : CCRakNetSlidingWindow.h
  • CC_TIME_TYPE_BYTES : CCRakNetSlidingWindow.h
  • CHALLENGE_MINIMUM_TIMEOUT : TwoWayAuthentication.h
  • closesocket : SocketIncludes.h
  • closesocket__ : SocketDefines.h
  • CLOUD_SERVER_DATA_STACK_SIZE : CloudServer.h
  • connect__ : SocketDefines.h

- d -

  • DATAGRAM_MESSAGE_ID_ARRAY_LENGTH : defines.h
  • DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS : DS_Multilist.h
  • DS_MEMORY_POOL_MAX_FREE_PAGES : DS_MemoryPool.h

- g -

  • get16bits : SuperFastHash.cpp
  • GET_TIME_SPIKE_LIMIT : defines.h
  • getsockname__ : SocketDefines.h
  • getsockopt__ : SocketDefines.h

- h -

  • HASHED_NONCE_AND_PW_LENGTH : TwoWayAuthentication.h
  • hiBit : Rand.cpp

- i -

  • INCLUDE_TIMESTAMP_WITH_DATAGRAMS : ReliabilityLayer.h
  • INT_64 : DR_SHA1.h
  • INTERNAL_PACKET_PAGE_SIZE : defines.h
  • INVALID_SOCKET : RakNetSocket2.cpp
  • ioctlsocket__ : SocketDefines.h

- k -

  • K : Rand.cpp

- l -

  • LIBCAT_SECURITY : NativeFeatureIncludes.h
  • listen__ : SocketDefines.h
  • loBit : Rand.cpp
  • loBits : Rand.cpp

- m -

  • M : Rand.cpp
  • MAX_ALLOCA_STACK_ALLOCATION : defines.h
  • MAX_BYTES_PER_UNICODE_CHAR : RakWString.cpp
  • MAX_RTT : CCRakNetUDT.cpp
  • MAXIMUM_MTU_SIZE : MTUSize.h
  • MAXIMUM_NUMBER_OF_INTERNAL_IDS : defines.h
  • MESSAGE_FILTER_MAX_MESSAGE_ID : MessageFilter.h
  • MINIMUM_MTU_SIZE : MTUSize.h
  • mixBits : Rand.cpp

- n -

  • N : Rand.cpp
  • NETWORK_ID_MANAGER_HASH_LENGTH : NetworkIDManager.h
  • NOMINMAX : WindowsIncludes.h
  • NONCE_TIMEOUT_MS : TwoWayAuthentication.h
  • NUMBER_OF_ORDERED_STREAMS : ReliabilityLayer.h

- o -

  • OPEN_SSL_CLIENT_SUPPORT : defines.h

- p -

  • PREALLOCATE_LARGE_MESSAGES : defines.h
  • PRINTF_64_BIT_MODIFIER : types.h

- r -

  • RAK_DLL_EXPORT : Export.h
  • RAK_THREAD_DECLARATION : thread.h
  • RAK_TIME_FORMAT_STRING : time.h
  • RakAssert : defines.h
  • RAKNET_DATE : version.h
  • RAKNET_DEBUG_PRINTF : defines.h
  • RAKNET_DEBUG_TPRINTF : defines.h
  • RAKNET_PROTOCOL_VERSION : version.h
  • RAKNET_SOCKET_2_INLINE_FUNCTIONS : RakNetSocket2.cpp
  • RAKNET_SUPPORT_IPV6 : defines.h
  • RAKNET_VERSION : version.h
  • RAKNET_VERSION_NUMBER : version.h
  • RAKNET_VERSION_NUMBER_INT : version.h
  • RAKPEER_USER_THREADED : defines.h
  • RAKSTRING_TYPE : defines.h
  • RAKSTRING_TYPE_IS_UNICODE : defines.h
  • recv__ : SocketDefines.h
  • recvfrom__ : SocketDefines.h
  • REMOTE_MAX_TEXT_INPUT : TransportInterface.h
  • REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE : RakPeer.cpp
  • RESEND_BUFFER_ARRAY_LENGTH : defines.h
  • RESEND_BUFFER_ARRAY_MASK : defines.h
  • RESEND_TREE_ORDER : ReliabilityLayer.h
  • ROL32 : DR_SHA1.cpp
  • RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH : defines.h
  • RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS : defines.h
  • RTT_TOLERANCE : CCRakNetUDT.cpp

- s -

  • S_R0 : DR_SHA1.cpp
  • S_R1 : DR_SHA1.cpp
  • S_R2 : DR_SHA1.cpp
  • S_R3 : DR_SHA1.cpp
  • S_R4 : DR_SHA1.cpp
  • select__ : SocketDefines.h
  • send__ : SocketDefines.h
  • sendto__ : SocketDefines.h
  • setsockopt__ : SocketDefines.h
  • SH_TYPE_MAX : StatisticsHistory.h
  • SHA1_LENGTH : DR_SHA1.h
  • SHA1_LITTLE_ENDIAN : DR_SHA1.h
  • SHA1_MAX_FILE_BUFFER : DR_SHA1.cpp
  • SHA1_STL_FUNCTIONS : DR_SHA1.h
  • SHA1_UTILITY_FUNCTIONS : DR_SHA1.h
  • SHA1_WIPE_VARIABLES : DR_SHA1.h
  • SHABLK : DR_SHA1.cpp
  • SHABLK0 : DR_SHA1.cpp
  • shutdown__ : SocketDefines.h
  • SLIKENET_DATE : version.h
  • SLIKENET_VERSION : version.h
  • SLIKENET_VERSION_NUMBER : version.h
  • SLIKENET_VERSION_NUMBER_INT : version.h
  • SLNET_MAX_RETRIEVABLE_FILESIZE : defines.h
  • socket__ : SocketDefines.h
  • STATIC_FACTORY_DECLARATIONS : Export.h
  • STATIC_FACTORY_DEFINITIONS : Export.h

- t -

  • TCHAR : DR_SHA1.h
  • TWO_WAY_AUTHENTICATION_NONCE_LENGTH : TwoWayAuthentication.h

- u -

  • UDP_FORWARDER_MAXIMUM_TIMEOUT : UDPProxyCommon.h
  • UDP_HEADER_SIZE : CCRakNetSlidingWindow.h
  • UINT_32 : DR_SHA1.h
  • UINT_64 : DR_SHA1.h
  • UINT_8 : DR_SHA1.h
  • UNASSIGNED_TEAM_ID : TeamBalancer.h
  • USE_ALLOCA : defines.h
  • USE_SLIDING_WINDOW_CONGESTION_CONTROL : defines.h
  • USE_WAIT_FOR_MULTIPLE_EVENTS : defines.h

- w -

  • WSASendTo__ : SocketDefines.h

- x -

  • XBOX_BYPASS_SECURITY : defines.h
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Graph Legend

Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };
/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };
/* Class not documented with doxygen comments */
class Undocumented { };
/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };
/*! A template class */
template<class T> class Templ { };
/*! Class that is inherited using protected inheritance */
class ProtectedBase { };
/*! Class that is inherited using private inheritance */
class PrivateBase { };
/*! Class that is used by the Inherited class */
class Used { };
/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
protected ProtectedBase,
private PrivateBase,
public Undocumented,
public Templ<int>
{
private:
Used *m_usedClass;
};

This will result in the following graph:

The boxes in the above graph have the following meaning:

  • A filled gray box represents the struct or class for which the graph is generated.
  • A box with a black border denotes a documented struct or class.
  • A box with a grey border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.

The arrows have the following meaning:

  • A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • A dark green arrow is used for protected inheritance.
  • A dark red arrow is used for private inheritance.
  • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Main Page

SLikeNet Documentation
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Class Hierarchy

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Class Hierarchy

Go to the textual class hierarchy

Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:24 for SLikeNet by doxygen 1.8.2


SLikeNet: Related Pages

Related Pages
Here is a list of all related documentation pages:
\ Deprecated List
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DS_Table.cpp Source File

  • src
DS_Table.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/DS_Table.h"
17 #include "slikenet/DS_OrderedList.h"
18 #include <string.h>
19 #include "slikenet/assert.h"
20 #include "slikenet/assert.h"
21 #include "slikenet/Itoa.h"
22 #include "slikenet/linux_adapter.h"
23 #include "slikenet/osx_adapter.h"
24
25 using namespace DataStructures;
26
27 void ExtendRows(Table::Row* input, int index)
28 {
29 (void) index;
30 input->cells.Insert(SLNet::OP_NEW<Table::Cell>(_FILE_AND_LINE_), _FILE_AND_LINE_ );
31 }
32 void FreeRow(Table::Row* input, int index)
33 {
34 (void) index;
35
36 unsigned i;
37 for (i=0; i < input->cells.Size(); i++)
38 {
39 SLNet::OP_DELETE(input->cells[i], _FILE_AND_LINE_);
40 }
41 SLNet::OP_DELETE(input, _FILE_AND_LINE_);
42 }
43 Table::Cell::Cell()
44 {
45 isEmpty=true;
46 c=0;
47 ptr=0;
48 i=0.0;
49 }
50 Table::Cell::~Cell()
51 {
52 Clear();
53 }
54 Table::Cell& Table::Cell::operator = ( const Table::Cell& input )
55 {
56 isEmpty=input.isEmpty;
57 i=input.i;
58 ptr=input.ptr;
59 if (c)
60 rakFree_Ex(c, _FILE_AND_LINE_);
61 if (input.c)
62 {
63 c = (char*) rakMalloc_Ex( (int) i, _FILE_AND_LINE_ );
64 memcpy(c, input.c, (int) i);
65 }
66 else
67 c=0;
68 return *this;
69 }
70 Table::Cell::Cell( const Table::Cell & input)
71 {
72 isEmpty=input.isEmpty;
73 i=input.i;
74 ptr=input.ptr;
75 if (input.c)
76 {
77 if (c)
78 rakFree_Ex(c, _FILE_AND_LINE_);
79 c = (char*) rakMalloc_Ex( (int) i, _FILE_AND_LINE_ );
80 memcpy(c, input.c, (int) i);
81 }
82 }
83 void Table::Cell::Set(double input)
84 {
85 Clear();
86 i=input;
87 c=0;
88 ptr=0;
89 isEmpty=false;
90 }
91 void Table::Cell::Set(unsigned int input)
92 {
93 Set((int) input);
94 }
95 void Table::Cell::Set(int input)
96 {
97 Clear();
98 i=(double) input;
99 c=0;
100 ptr=0;
101 isEmpty=false;
102 }
103
104 void Table::Cell::Set(const char *input)
105 {
106 Clear();
107
108 if (input)
109 {
110 i=(int)strlen(input)+1;
111 c = (char*) rakMalloc_Ex( (int) i, _FILE_AND_LINE_ );
112 strcpy_s(c, (int) i, input);
113 }
114 else
115 {
116 c=0;
117 i=0;
118 }
119 ptr=0;
120 isEmpty=false;
121 }
122 void Table::Cell::Set(const char *input, int inputLength)
123 {
124 Clear();
125 if (input)
126 {
127 c = (char*) rakMalloc_Ex( inputLength, _FILE_AND_LINE_ );
128 i=inputLength;
129 memcpy(c, input, inputLength);
130 }
131 else
132 {
133 c=0;
134 i=0;
135 }
136 ptr=0;
137 isEmpty=false;
138 }
139 void Table::Cell::SetPtr(void* p)
140 {
141 Clear();
142 c=0;
143 ptr=p;
144 isEmpty=false;
145 }
146 void Table::Cell::Get(int *output)
147 {
148 RakAssert(isEmpty==false);
149 int o = (int) i;
150 *output=o;
151 }
152 void Table::Cell::Get(double *output)
153 {
154 RakAssert(isEmpty==false);
155 *output=i;
156 }
157 void Table::Cell::Get(char *output)
158 {
159 RakAssert(isEmpty == false);
160 #pragma warning(push)
161 #pragma warning(disable:4996)
162 strcpy(output, c);
163 #pragma warning(pop)
164 }
165 void Table::Cell::Get(char *output, size_t outputLength)
166 {
167 RakAssert(isEmpty==false);
168 strcpy_s(output, outputLength, c);
169 }
170 void Table::Cell::Get(char *output, int *outputLength)
171 {
172 RakAssert(isEmpty==false);
173 memcpy(output, c, (int) i);
174 if (outputLength)
175 *outputLength=(int) i;
176 }
177 SLNet::RakString Table::Cell::ToString(ColumnType columnType)
178 {
179 if (isEmpty)
180 return SLNet::RakString();
181
182 if (columnType==NUMERIC)
183 {
184 return SLNet::RakString("%f", i);
185 }
186 else if (columnType==STRING)
187 {
188 return SLNet::RakString(c);
189 }
190 else if (columnType==BINARY)
191 {
192 return SLNet::RakString("<Binary>");
193 }
194 else if (columnType==POINTER)
195 {
196 return SLNet::RakString("%p", ptr);
197 }
198
199 return SLNet::RakString();
200 }
201 Table::Cell::Cell(double numericValue, char *charValue, void *ptr, ColumnType type)
202 {
203 SetByType(numericValue,charValue,ptr,type);
204 }
205 void Table::Cell::SetByType(double numericValue, char *charValue, void *inPtr, ColumnType type)
206 {
207 isEmpty=true;
208 if (type==NUMERIC)
209 {
210 Set(numericValue);
211 }
212 else if (type==STRING)
213 {
214 Set(charValue);
215 }
216 else if (type==BINARY)
217 {
218 Set(charValue, (int) numericValue);
219 }
220 else if (type==POINTER)
221 {
222 SetPtr(inPtr);
223 }
224 else
225 {
226 inPtr=(void*) charValue;
227 }
228 }
229 Table::ColumnType Table::Cell::EstimateColumnType(void) const
230 {
231 if (c)
232 {
233 if (i!=0.0f)
234 return BINARY;
235 else
236 return STRING;
237 }
238
239 if (ptr)
240 return POINTER;
241 return NUMERIC;
242 }
243 void Table::Cell::Clear(void)
244 {
245 if (isEmpty==false && c)
246 {
247 rakFree_Ex(c, _FILE_AND_LINE_);
248 c=0;
249 }
250 isEmpty=true;
251 }
252 Table::ColumnDescriptor::ColumnDescriptor()
253 {
254
255 }
256 Table::ColumnDescriptor::~ColumnDescriptor()
257 {
258
259 }
260 Table::ColumnDescriptor::ColumnDescriptor(const char cn[_TABLE_MAX_COLUMN_NAME_LENGTH], ColumnType ct)
261 {
262 columnType=ct;
263 strcpy_s(columnName, cn);
264 }
265 void Table::Row::UpdateCell(unsigned columnIndex, double value)
266 {
267 cells[columnIndex]->Clear();
268 cells[columnIndex]->Set(value);
269
270 // cells[columnIndex]->i=value;
271 // cells[columnIndex]->c=0;
272 // cells[columnIndex]->isEmpty=false;
273 }
274 void Table::Row::UpdateCell(unsigned columnIndex, const char *str)
275 {
276 cells[columnIndex]->Clear();
277 cells[columnIndex]->Set(str);
278 }
279 void Table::Row::UpdateCell(unsigned columnIndex, int byteLength, const char *data)
280 {
281 cells[columnIndex]->Clear();
282 cells[columnIndex]->Set(data,byteLength);
283 }
284 Table::Table()
285 {
286 }
287 Table::~Table()
288 {
289 Clear();
290 }
291 unsigned Table::AddColumn(const char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH], ColumnType columnType)
292 {
293 if (columnName[0]==0)
294 return (unsigned) -1;
295
296 // Add this column.
297 columns.Insert(Table::ColumnDescriptor(columnName, columnType), _FILE_AND_LINE_);
298
299 // Extend the rows by one
300 rows.ForEachData(ExtendRows);
301
302 return columns.Size()-1;
303 }
304 void Table::RemoveColumn(unsigned columnIndex)
305 {
306 if (columnIndex >= columns.Size())
307 return;
308
309 columns.RemoveAtIndex(columnIndex);
310
311 // Remove this index from each row.
312 int i;
313 DataStructures::Page<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> *cur = rows.GetListHead();
314 while (cur)
315 {
316 for (i=0; i < cur->size; i++)
317 {
318 SLNet::OP_DELETE(cur->data[i]->cells[columnIndex], _FILE_AND_LINE_);
319 cur->data[i]->cells.RemoveAtIndex(columnIndex);
320 }
321
322 cur=cur->next;
323 }
324 }
325 unsigned Table::ColumnIndex(const char *columnName) const
326 {
327 unsigned columnIndex;
328 for (columnIndex=0; columnIndex<columns.Size(); columnIndex++)
329 if (strcmp(columnName, columns[columnIndex].columnName)==0)
330 return columnIndex;
331 return (unsigned)-1;
332 }
333 unsigned Table::ColumnIndex(char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH]) const
334 {
335 return ColumnIndex((const char *) columnName);
336 }
337 char* Table::ColumnName(unsigned index) const
338 {
339 if (index >= columns.Size())
340 return 0;
341 else
342 return (char*)columns[index].columnName;
343 }
344 Table::ColumnType Table::GetColumnType(unsigned index) const
345 {
346 if (index >= columns.Size())
347 return (Table::ColumnType) 0;
348 else
349 return columns[index].columnType;
350 }
351 unsigned Table::GetColumnCount(void) const
352 {
353 return columns.Size();
354 }
355 unsigned Table::GetRowCount(void) const
356 {
357 return rows.Size();
358 }
359 Table::Row* Table::AddRow(unsigned rowId)
360 {
361 Row *newRow;
362 newRow = SLNet::OP_NEW<Row>( _FILE_AND_LINE_ );
363 if (rows.Insert(rowId, newRow)==false)
364 {
365 SLNet::OP_DELETE(newRow, _FILE_AND_LINE_);
366 return 0; // Already exists
367 }
368 unsigned rowIndex;
369 for (rowIndex=0; rowIndex < columns.Size(); rowIndex++)
370 newRow->cells.Insert(SLNet::OP_NEW<Table::Cell>(_FILE_AND_LINE_), _FILE_AND_LINE_ );
371 return newRow;
372 }
373 Table::Row* Table::AddRow(unsigned rowId, DataStructures::List<Cell> &initialCellValues)
374 {
375 Row *newRow = SLNet::OP_NEW<Row>( _FILE_AND_LINE_ );
376 unsigned rowIndex;
377 for (rowIndex=0; rowIndex < columns.Size(); rowIndex++)
378 {
379 if (rowIndex < initialCellValues.Size() && initialCellValues[rowIndex].isEmpty==false)
380 {
381 Table::Cell *c;
382 c = SLNet::OP_NEW<Table::Cell>(_FILE_AND_LINE_);
383 c->SetByType(initialCellValues[rowIndex].i,initialCellValues[rowIndex].c,initialCellValues[rowIndex].ptr,columns[rowIndex].columnType);
384 newRow->cells.Insert(c, _FILE_AND_LINE_ );
385 }
386 else
387 newRow->cells.Insert(SLNet::OP_NEW<Table::Cell>(_FILE_AND_LINE_), _FILE_AND_LINE_ );
388 }
389 rows.Insert(rowId, newRow);
390 return newRow;
391 }
392 Table::Row* Table::AddRow(unsigned rowId, DataStructures::List<Cell*> &initialCellValues, bool copyCells)
393 {
394 Row *newRow = SLNet::OP_NEW<Row>( _FILE_AND_LINE_ );
395 unsigned rowIndex;
396 for (rowIndex=0; rowIndex < columns.Size(); rowIndex++)
397 {
398 if (rowIndex < initialCellValues.Size() && initialCellValues[rowIndex] && initialCellValues[rowIndex]->isEmpty==false)
399 {
400 if (copyCells==false)
401 newRow->cells.Insert(SLNet::OP_NEW_4<Table::Cell>( _FILE_AND_LINE_, initialCellValues[rowIndex]->i, initialCellValues[rowIndex]->c, initialCellValues[rowIndex]->ptr, columns[rowIndex].columnType), _FILE_AND_LINE_);
402 else
403 {
404 Table::Cell *c = SLNet::OP_NEW<Table::Cell>( _FILE_AND_LINE_ );
405 newRow->cells.Insert(c, _FILE_AND_LINE_);
406 *c=*(initialCellValues[rowIndex]);
407 }
408 }
409 else
410 newRow->cells.Insert(SLNet::OP_NEW<Table::Cell>(_FILE_AND_LINE_), _FILE_AND_LINE_);
411 }
412 rows.Insert(rowId, newRow);
413 return newRow;
414 }
415 Table::Row* Table::AddRowColumns(unsigned rowId, Row *row, DataStructures::List<unsigned> columnIndices)
416 {
417 Row *newRow = SLNet::OP_NEW<Row>( _FILE_AND_LINE_ );
418 unsigned columnIndex;
419 for (columnIndex=0; columnIndex < columnIndices.Size(); columnIndex++)
420 {
421 if (row->cells[columnIndices[columnIndex]]->isEmpty==false)
422 {
423 newRow->cells.Insert(SLNet::OP_NEW_4<Table::Cell>( _FILE_AND_LINE_,
424 row->cells[columnIndices[columnIndex]]->i,
425 row->cells[columnIndices[columnIndex]]->c,
426 row->cells[columnIndices[columnIndex]]->ptr,
427 columns[columnIndex].columnType
428 ), _FILE_AND_LINE_);
429 }
430 else
431 {
432 newRow->cells.Insert(SLNet::OP_NEW<Table::Cell>(_FILE_AND_LINE_), _FILE_AND_LINE_);
433 }
434 }
435 rows.Insert(rowId, newRow);
436 return newRow;
437 }
438 bool Table::RemoveRow(unsigned rowId)
439 {
440 Row *out;
441 if (rows.Delete(rowId, out))
442 {
443 DeleteRow(out);
444 return true;
445 }
446 return false;
447 }
448 void Table::RemoveRows(Table *tableContainingRowIDs)
449 {
450 unsigned i;
451 DataStructures::Page<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> *cur = tableContainingRowIDs->GetRows().GetListHead();
452 while (cur)
453 {
454 for (i=0; i < (unsigned)cur->size; i++)
455 {
456 rows.Delete(cur->keys[i]);
457 }
458 cur=cur->next;
459 }
460 return;
461 }
462 bool Table::UpdateCell(unsigned rowId, unsigned columnIndex, int value)
463 {
464 RakAssert(columns[columnIndex].columnType==NUMERIC);
465
466 Row *row = GetRowByID(rowId);
467 if (row)
468 {
469 row->UpdateCell(columnIndex, value);
470 return true;
471 }
472 return false;
473 }
474 bool Table::UpdateCell(unsigned rowId, unsigned columnIndex, char *str)
475 {
476 RakAssert(columns[columnIndex].columnType==STRING);
477
478 Row *row = GetRowByID(rowId);
479 if (row)
480 {
481 row->UpdateCell(columnIndex, str);
482 return true;
483 }
484 return false;
485 }
486 bool Table::UpdateCell(unsigned rowId, unsigned columnIndex, int byteLength, char *data)
487 {
488 RakAssert(columns[columnIndex].columnType==BINARY);
489
490 Row *row = GetRowByID(rowId);
491 if (row)
492 {
493 row->UpdateCell(columnIndex, byteLength, data);
494 return true;
495 }
496 return false;
497 }
498 bool Table::UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, int value)
499 {
500 RakAssert(columns[columnIndex].columnType==NUMERIC);
501
502 Row *row = GetRowByIndex(rowIndex,0);
503 if (row)
504 {
505 row->UpdateCell(columnIndex, value);
506 return true;
507 }
508 return false;
509 }
510 bool Table::UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, char *str)
511 {
512 RakAssert(columns[columnIndex].columnType==STRING);
513
514 Row *row = GetRowByIndex(rowIndex,0);
515 if (row)
516 {
517 row->UpdateCell(columnIndex, str);
518 return true;
519 }
520 return false;
521 }
522 bool Table::UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, int byteLength, char *data)
523 {
524 RakAssert(columns[columnIndex].columnType==BINARY);
525
526 Row *row = GetRowByIndex(rowIndex,0);
527 if (row)
528 {
529 row->UpdateCell(columnIndex, byteLength, data);
530 return true;
531 }
532 return false;
533 }
534 void Table::GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, int *output)
535 {
536 RakAssert(columns[columnIndex].columnType==NUMERIC);
537
538 Row *row = GetRowByIndex(rowIndex,0);
539 if (row)
540 {
541 row->cells[columnIndex]->Get(output);
542 }
543 }
544 void Table::GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, char *output)
545 {
546 RakAssert(columns[columnIndex].columnType == STRING);
547
548 Row *row = GetRowByIndex(rowIndex, 0);
549 if (row)
550 {
551 row->cells[columnIndex]->Get(output);
552 }
553 }
554 void Table::GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, char *output, size_t outputLength)
555 {
556 RakAssert(columns[columnIndex].columnType==STRING);
557
558 Row *row = GetRowByIndex(rowIndex,0);
559 if (row)
560 {
561 row->cells[columnIndex]->Get(output, outputLength);
562 }
563 }
564 void Table::GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, char *output, int *outputLength)
565 {
566 RakAssert(columns[columnIndex].columnType==BINARY);
567
568 Row *row = GetRowByIndex(rowIndex,0);
569 if (row)
570 {
571 row->cells[columnIndex]->Get(output, outputLength);
572 }
573 }
574 Table::FilterQuery::FilterQuery()
575 {
576 columnName[0]=0;
577 }
578 Table::FilterQuery::~FilterQuery()
579 {
580
581 }
582 Table::FilterQuery::FilterQuery(unsigned column, Cell *cell, FilterQueryType op)
583 {
584 columnIndex=column;
585 cellValue=cell;
586 operation=op;
587 }
588 Table::Row* Table::GetRowByID(unsigned rowId) const
589 {
590 Row *row;
591 if (rows.Get(rowId, row))
592 return row;
593 return 0;
594 }
595
596 Table::Row* Table::GetRowByIndex(unsigned rowIndex, unsigned *key) const
597 {
598 DataStructures::Page<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> *cur = rows.GetListHead();
599 while (cur)
600 {
601 if (rowIndex < (unsigned)cur->size)
602 {
603 if (key)
604 *key=cur->keys[rowIndex];
605 return cur->data[rowIndex];
606 }
607 if (rowIndex <= (unsigned)cur->size)
608 rowIndex-=cur->size;
609 else
610 return 0;
611 cur=cur->next;
612 }
613 return 0;
614 }
615
616 void Table::QueryTable(unsigned *columnIndicesSubset, unsigned numColumnSubset, FilterQuery *inclusionFilters, unsigned numInclusionFilters, unsigned *rowIds, unsigned numRowIDs, Table *result)
617 {
618 unsigned i;
619 DataStructures::List<unsigned> columnIndicesToReturn;
620
621 // Clear the result table.
622 result->Clear();
623
624 if (columnIndicesSubset && numColumnSubset>0)
625 {
626 for (i=0; i < numColumnSubset; i++)
627 {
628 if (columnIndicesSubset[i]<columns.Size())
629 columnIndicesToReturn.Insert(columnIndicesSubset[i], _FILE_AND_LINE_);
630 }
631 }
632 else
633 {
634 for (i=0; i < columns.Size(); i++)
635 columnIndicesToReturn.Insert(i, _FILE_AND_LINE_);
636 }
637
638 if (columnIndicesToReturn.Size()==0)
639 return; // No valid columns specified
640
641 for (i=0; i < columnIndicesToReturn.Size(); i++)
642 {
643 result->AddColumn(columns[columnIndicesToReturn[i]].columnName,columns[columnIndicesToReturn[i]].columnType);
644 }
645
646 // Get the column indices of the filter queries.
647 DataStructures::List<unsigned> inclusionFilterColumnIndices;
648 if (inclusionFilters && numInclusionFilters>0)
649 {
650 for (i=0; i < numInclusionFilters; i++)
651 {
652 if (inclusionFilters[i].columnName[0])
653 inclusionFilters[i].columnIndex=ColumnIndex(inclusionFilters[i].columnName);
654 if (inclusionFilters[i].columnIndex<columns.Size())
655 inclusionFilterColumnIndices.Insert(inclusionFilters[i].columnIndex, _FILE_AND_LINE_);
656 else
657 inclusionFilterColumnIndices.Insert((unsigned)-1, _FILE_AND_LINE_);
658 }
659 }
660
661 if (rowIds==0 || numRowIDs==0)
662 {
663 // All rows
664 DataStructures::Page<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> *cur = rows.GetListHead();
665 while (cur)
666 {
667 for (i=0; i < (unsigned)cur->size; i++)
668 {
669 QueryRow(inclusionFilterColumnIndices, columnIndicesToReturn, cur->keys[i], cur->data[i], inclusionFilters, result);
670 }
671 cur=cur->next;
672 }
673 }
674 else
675 {
676 // Specific rows
677 Row *row;
678 for (i=0; i < numRowIDs; i++)
679 {
680 if (rows.Get(rowIds[i], row))
681 {
682 QueryRow(inclusionFilterColumnIndices, columnIndicesToReturn, rowIds[i], row, inclusionFilters, result);
683 }
684 }
685 }
686 }
687
688 void Table::QueryRow(DataStructures::List<unsigned> &inclusionFilterColumnIndices, DataStructures::List<unsigned> &columnIndicesToReturn, unsigned key, Table::Row* row, FilterQuery *inclusionFilters, Table *result)
689 {
690 bool pass=false;
691 unsigned columnIndex;
692 unsigned j;
693
694 // If no inclusion filters, just add the row
695 if (inclusionFilterColumnIndices.Size()==0)
696 {
697 result->AddRowColumns(key, row, columnIndicesToReturn);
698 }
699 else
700 {
701 // Go through all inclusion filters. Only add this row if all filters pass.
702 for (j=0; j<inclusionFilterColumnIndices.Size(); j++)
703 {
704 columnIndex=inclusionFilterColumnIndices[j];
705 if (columnIndex!=(unsigned)-1 && row->cells[columnIndex]->isEmpty==false )
706 {
707 if (columns[inclusionFilterColumnIndices[j]].columnType==STRING &&
708 (row->cells[columnIndex]->c==0 ||
709 inclusionFilters[j].cellValue->c==0) )
710 continue;
711
712 switch (inclusionFilters[j].operation)
713 {
714 case QF_EQUAL:
715 switch(columns[inclusionFilterColumnIndices[j]].columnType)
716 {
717 case NUMERIC:
718 pass=row->cells[columnIndex]->i==inclusionFilters[j].cellValue->i;
719 break;
720 case STRING:
721 pass=strcmp(row->cells[columnIndex]->c,inclusionFilters[j].cellValue->c)==0;
722 break;
723 case BINARY:
724 pass=row->cells[columnIndex]->i==inclusionFilters[j].cellValue->i &&
725 memcmp(row->cells[columnIndex]->c,inclusionFilters[j].cellValue->c, (int) row->cells[columnIndex]->i)==0;
726 break;
727 case POINTER:
728 pass=row->cells[columnIndex]->ptr==inclusionFilters[j].cellValue->ptr;
729 break;
730 }
731 break;
732 case QF_NOT_EQUAL:
733 switch(columns[inclusionFilterColumnIndices[j]].columnType)
734 {
735 case NUMERIC:
736 pass=row->cells[columnIndex]->i!=inclusionFilters[j].cellValue->i;
737 break;
738 case STRING:
739 pass=strcmp(row->cells[columnIndex]->c,inclusionFilters[j].cellValue->c)!=0;
740 break;
741 case BINARY:
742 pass=row->cells[columnIndex]->i==inclusionFilters[j].cellValue->i &&
743 memcmp(row->cells[columnIndex]->c,inclusionFilters[j].cellValue->c, (int) row->cells[columnIndex]->i)==0;
744 break;
745 case POINTER:
746 pass=row->cells[columnIndex]->ptr!=inclusionFilters[j].cellValue->ptr;
747 break;
748 }
749 break;
750 case QF_GREATER_THAN:
751 switch(columns[inclusionFilterColumnIndices[j]].columnType)
752 {
753 case NUMERIC:
754 pass=row->cells[columnIndex]->i>inclusionFilters[j].cellValue->i;
755 break;
756 case STRING:
757 pass=strcmp(row->cells[columnIndex]->c,inclusionFilters[j].cellValue->c)>0;
758 break;
759 case BINARY:
760 break;
761 case POINTER:
762 pass=row->cells[columnIndex]->ptr>inclusionFilters[j].cellValue->ptr;
763 break;
764 }
765 break;
766 case QF_GREATER_THAN_EQ:
767 switch(columns[inclusionFilterColumnIndices[j]].columnType)
768 {
769 case NUMERIC:
770 pass=row->cells[columnIndex]->i>=inclusionFilters[j].cellValue->i;
771 break;
772 case STRING:
773 pass=strcmp(row->cells[columnIndex]->c,inclusionFilters[j].cellValue->c)>=0;
774 break;
775 case BINARY:
776 break;
777 case POINTER:
778 pass=row->cells[columnIndex]->ptr>=inclusionFilters[j].cellValue->ptr;
779 break;
780 }
781 break;
782 case QF_LESS_THAN:
783 switch(columns[inclusionFilterColumnIndices[j]].columnType)
784 {
785 case NUMERIC:
786 pass=row->cells[columnIndex]->i<inclusionFilters[j].cellValue->i;
787 break;
788 case STRING:
789 pass=strcmp(row->cells[columnIndex]->c,inclusionFilters[j].cellValue->c)<0;
790 break;
791 case BINARY:
792 break;
793 case POINTER:
794 pass=row->cells[columnIndex]->ptr<inclusionFilters[j].cellValue->ptr;
795 break;
796 }
797 break;
798 case QF_LESS_THAN_EQ:
799 switch(columns[inclusionFilterColumnIndices[j]].columnType)
800 {
801 case NUMERIC:
802 pass=row->cells[columnIndex]->i<=inclusionFilters[j].cellValue->i;
803 break;
804 case STRING:
805 pass=strcmp(row->cells[columnIndex]->c,inclusionFilters[j].cellValue->c)<=0;
806 break;
807 case BINARY:
808 break;
809 case POINTER:
810 pass=row->cells[columnIndex]->ptr<=inclusionFilters[j].cellValue->ptr;
811 break;
812 }
813 break;
814 case QF_IS_EMPTY:
815 pass=false;
816 break;
817 case QF_NOT_EMPTY:
818 pass=true;
819 break;
820 default:
821 pass=false;
822 RakAssert(0);
823 break;
824 }
825 }
826 else
827 {
828 if (inclusionFilters[j].operation==QF_IS_EMPTY)
829 pass=true;
830 else
831 pass=false; // No value for this cell
832 }
833
834 if (pass==false)
835 break;
836 }
837
838 if (pass)
839 {
840 result->AddRowColumns(key, row, columnIndicesToReturn);
841 }
842 }
843 }
844
845 static Table::SortQuery *_sortQueries;
846 static unsigned _numSortQueries;
847 static DataStructures::List<unsigned> *_columnIndices;
848 static DataStructures::List<Table::ColumnDescriptor> *_columns;
849 int RowSort(Table::Row* const &first, Table::Row* const &second) // first is the one inserting, second is the one already there.
850 {
851 unsigned i, columnIndex;
852 for (i=0; i<_numSortQueries; i++)
853 {
854 columnIndex=(*_columnIndices)[i];
855 if (columnIndex==(unsigned)-1)
856 continue;
857
858 if (first->cells[columnIndex]->isEmpty==true && second->cells[columnIndex]->isEmpty==false)
859 return 1; // Empty cells always go at the end
860
861 if (first->cells[columnIndex]->isEmpty==false && second->cells[columnIndex]->isEmpty==true)
862 return -1; // Empty cells always go at the end
863
864 if (_sortQueries[i].operation==Table::QS_INCREASING_ORDER)
865 {
866 if ((*_columns)[columnIndex].columnType==Table::NUMERIC)
867 {
868 if (first->cells[columnIndex]->i>second->cells[columnIndex]->i)
869 return 1;
870 if (first->cells[columnIndex]->i<second->cells[columnIndex]->i)
871 return -1;
872 }
873 else
874 {
875 // String
876 if (strcmp(first->cells[columnIndex]->c,second->cells[columnIndex]->c)>0)
877 return 1;
878 if (strcmp(first->cells[columnIndex]->c,second->cells[columnIndex]->c)<0)
879 return -1;
880 }
881 }
882 else
883 {
884 if ((*_columns)[columnIndex].columnType==Table::NUMERIC)
885 {
886 if (first->cells[columnIndex]->i<second->cells[columnIndex]->i)
887 return 1;
888 if (first->cells[columnIndex]->i>second->cells[columnIndex]->i)
889 return -1;
890 }
891 else
892 {
893 // String
894 if (strcmp(first->cells[columnIndex]->c,second->cells[columnIndex]->c)<0)
895 return 1;
896 if (strcmp(first->cells[columnIndex]->c,second->cells[columnIndex]->c)>0)
897 return -1;
898 }
899 }
900 }
901
902 return 0;
903 }
904 void Table::SortTable(Table::SortQuery *sortQueries, unsigned numSortQueries, Table::Row** out)
905 {
906 unsigned i;
907 unsigned outLength;
908 DataStructures::List<unsigned> columnIndices;
909 _sortQueries=sortQueries;
910 _numSortQueries=numSortQueries;
911 _columnIndices=&columnIndices;
912 _columns=&columns;
913 bool anyValid=false;
914
915 for (i=0; i < numSortQueries; i++)
916 {
917 if (sortQueries[i].columnIndex<columns.Size() && columns[sortQueries[i].columnIndex].columnType!=BINARY)
918 {
919 columnIndices.Insert(sortQueries[i].columnIndex, _FILE_AND_LINE_);
920 anyValid=true;
921 }
922 else
923 columnIndices.Insert((unsigned)-1, _FILE_AND_LINE_); // Means don't check this column
924 }
925
926 DataStructures::Page<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> *cur;
927 cur = rows.GetListHead();
928 if (anyValid==false)
929 {
930 outLength=0;
931 while (cur)
932 {
933 for (i=0; i < (unsigned)cur->size; i++)
934 {
935 out[(outLength)++]=cur->data[i];
936 }
937 cur=cur->next;
938 }
939 return;
940 }
941
942 // Start adding to ordered list.
943 DataStructures::OrderedList<Row*, Row*, RowSort> orderedList;
944 while (cur)
945 {
946 for (i=0; i < (unsigned)cur->size; i++)
947 {
948 RakAssert(cur->data[i]);
949 orderedList.Insert(cur->data[i],cur->data[i], true, _FILE_AND_LINE_);
950 }
951 cur=cur->next;
952 }
953
954 outLength=0;
955 for (i=0; i < orderedList.Size(); i++)
956 out[(outLength)++]=orderedList[i];
957 }
958 void Table::PrintColumnHeaders(char *out, int outLength, char columnDelineator) const
959 {
960 if (outLength<=0)
961 return;
962 if (outLength==1)
963 {
964 *out=0;
965 return;
966 }
967
968 unsigned i;
969 out[0]=0;
970 int len;
971 for (i=0; i < columns.Size(); i++)
972 {
973 if (i!=0)
974 {
975 len = (int) strlen(out);
976 if (len < outLength-1)
977 sprintf_s(out+len, outLength-len, "%c", columnDelineator);
978 else
979 return;
980 }
981
982 len = (int) strlen(out);
983 if (len < outLength-(int) strlen(columns[i].columnName))
984 sprintf_s(out+len, outLength-len, "%s", columns[i].columnName);
985 else
986 return;
987 }
988 }
989 void Table::PrintRow(char *out, int outLength, char columnDelineator, bool printDelineatorForBinary, Table::Row* inputRow) const
990 {
991 if (outLength<=0)
992 return;
993 if (outLength==1)
994 {
995 *out=0;
996 return;
997 }
998
999 if (inputRow->cells.Size()!=columns.Size())
1000 {
1001 strncpy_s(out, outLength, "Cell width does not match column width.\n", outLength);
1002 out[outLength-1]=0;
1003 return;
1004 }
1005
1006 char buff[512];
1007 unsigned i;
1008 int len;
1009 out[0]=0;
1010 for (i=0; i < columns.Size(); i++)
1011 {
1012 if (columns[i].columnType==NUMERIC)
1013 {
1014 if (inputRow->cells[i]->isEmpty==false)
1015 {
1016 sprintf_s(buff, "%f", inputRow->cells[i]->i);
1017 len=(int)strlen(buff);
1018 }
1019 else
1020 len=0;
1021 if (i+1!=columns.Size())
1022 buff[len++]=columnDelineator;
1023 buff[len]=0;
1024 }
1025 else if (columns[i].columnType==STRING)
1026 {
1027 if (inputRow->cells[i]->isEmpty==false && inputRow->cells[i]->c)
1028 {
1029 strncpy_s(buff, inputRow->cells[i]->c, 512-2);
1030 buff[512-2]=0;
1031 len=(int)strlen(buff);
1032 }
1033 else
1034 len=0;
1035 if (i+1!=columns.Size())
1036 buff[len++]=columnDelineator;
1037 buff[len]=0;
1038 }
1039 else if (columns[i].columnType==POINTER)
1040 {
1041 if (inputRow->cells[i]->isEmpty==false && inputRow->cells[i]->ptr)
1042 {
1043 sprintf_s(buff, "%p", inputRow->cells[i]->ptr);
1044 len=(int)strlen(buff);
1045 }
1046 else
1047 len=0;
1048 if (i+1!=columns.Size())
1049 buff[len++]=columnDelineator;
1050 buff[len]=0;
1051 }
1052 else
1053 {
1054 if (printDelineatorForBinary)
1055 {
1056 if (i+1!=columns.Size())
1057 buff[0]=columnDelineator;
1058 buff[1]=0;
1059 }
1060 else
1061 buff[0]=0;
1062
1063 }
1064
1065 len=(int)strlen(out);
1066 if (outLength==len+1)
1067 break;
1068 strncpy_s(out+len, outLength-len, buff, outLength-len);
1069 out[outLength-1]=0;
1070 }
1071 }
1072
1073 void Table::Clear(void)
1074 {
1075 rows.ForEachData(FreeRow);
1076 rows.Clear();
1077 columns.Clear(true, _FILE_AND_LINE_);
1078 }
1079 const List<Table::ColumnDescriptor>& Table::GetColumns(void) const
1080 {
1081 return columns;
1082 }
1083 const DataStructures::BPlusTree<unsigned, Table::Row*, _TABLE_BPLUS_TREE_ORDER>& Table::GetRows(void) const
1084 {
1085 return rows;
1086 }
1087 DataStructures::Page<unsigned, DataStructures::Table::Row*, _TABLE_BPLUS_TREE_ORDER> * Table::GetListHead(void)
1088 {
1089 return rows.GetListHead();
1090 }
1091 unsigned Table::GetAvailableRowId(void) const
1092 {
1093 bool setKey=false;
1094 unsigned key=0;
1095 int i;
1096 DataStructures::Page<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> *cur = rows.GetListHead();
1097
1098 while (cur)
1099 {
1100 for (i=0; i < cur->size; i++)
1101 {
1102 if (setKey==false)
1103 {
1104 key=cur->keys[i]+1;
1105 setKey=true;
1106 }
1107 else
1108 {
1109 if (key!=cur->keys[i])
1110 return key;
1111 key++;
1112 }
1113 }
1114
1115 cur=cur->next;
1116 }
1117 return key;
1118 }
1119 void Table::DeleteRow(Table::Row *row)
1120 {
1121 unsigned rowIndex;
1122 for (rowIndex=0; rowIndex < row->cells.Size(); rowIndex++)
1123 {
1124 SLNet::OP_DELETE(row->cells[rowIndex], _FILE_AND_LINE_);
1125 }
1126 SLNet::OP_DELETE(row, _FILE_AND_LINE_);
1127 }
1128 Table& Table::operator = ( const Table& input )
1129 {
1130 Clear();
1131
1132 unsigned int i;
1133 for (i=0; i < input.GetColumnCount(); i++)
1134 AddColumn(input.ColumnName(i), input.GetColumnType(i));
1135
1136 DataStructures::Page<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> *cur = input.GetRows().GetListHead();
1137 while (cur)
1138 {
1139 for (i=0; i < (unsigned int) cur->size; i++)
1140 {
1141 AddRow(cur->keys[i], cur->data[i]->cells, false);
1142 }
1143
1144 cur=cur->next;
1145 }
1146
1147 return *this;
1148 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RelayPlugin.cpp Source File

  • src
RelayPlugin.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_RelayPlugin==1
18
19 #include "slikenet/RelayPlugin.h"
20 #include "slikenet/MessageIdentifiers.h"
21 #include "slikenet/peerinterface.h"
22 #include "slikenet/BitStream.h"
23
24 using namespace SLNet;
25
26 STATIC_FACTORY_DEFINITIONS(RelayPlugin,RelayPlugin);
27
28 RelayPlugin::RelayPlugin()
29 {
30 acceptAddParticipantRequests=false;
31 }
32
33 RelayPlugin::~RelayPlugin()
34 {
35 DataStructures::List<StrAndGuidAndRoom*> itemList;
36 DataStructures::List<RakString> keyList;
37 strToGuidHash.GetAsList(itemList, keyList, _FILE_AND_LINE_);
38 guidToStrHash.Clear(_FILE_AND_LINE_);
39 for (unsigned int i=0; i < itemList.Size(); i++)
40 SLNet::OP_DELETE(itemList[i], _FILE_AND_LINE_);
41 for (unsigned int i=0; i < chatRooms.Size(); i++)
42 SLNet::OP_DELETE(chatRooms[i], _FILE_AND_LINE_);
43 }
44
45 RelayPluginEnums RelayPlugin::AddParticipantOnServer(const RakString &key, const RakNetGUID &guid)
46 {
47 ConnectionState cs = rakPeerInterface->GetConnectionState(guid);
48 if (cs!=IS_CONNECTED)
49 return RPE_ADD_CLIENT_TARGET_NOT_CONNECTED;
50
51 if (strToGuidHash.HasData(key)==true)
52 return RPE_ADD_CLIENT_NAME_ALREADY_IN_USE; // Name already in use
53
54 // If GUID is already in use, remove existing
55 StrAndGuidAndRoom *strAndGuidExisting;
56 if (guidToStrHash.Pop(strAndGuidExisting, guid, _FILE_AND_LINE_))
57 {
58 strToGuidHash.Remove(strAndGuidExisting->str, _FILE_AND_LINE_);
59 SLNet::OP_DELETE(strAndGuidExisting, _FILE_AND_LINE_);
60 }
61
62 StrAndGuidAndRoom *strAndGuid = SLNet::OP_NEW<StrAndGuidAndRoom>(_FILE_AND_LINE_);
63 strAndGuid->guid=guid;
64 strAndGuid->str=key;
65
66 strToGuidHash.Push(key, strAndGuid, _FILE_AND_LINE_);
67 guidToStrHash.Push(guid, strAndGuid, _FILE_AND_LINE_);
68
69 return RPE_ADD_CLIENT_SUCCESS;
70 }
71 void RelayPlugin::RemoveParticipantOnServer(const RakNetGUID &guid)
72 {
73 StrAndGuidAndRoom *strAndGuid;
74 if (guidToStrHash.Pop(strAndGuid, guid, _FILE_AND_LINE_))
75 {
76 LeaveGroup(&strAndGuid);
77 strToGuidHash.Remove(strAndGuid->str, _FILE_AND_LINE_);
78 SLNet::OP_DELETE(strAndGuid, _FILE_AND_LINE_);
79 }
80 }
81
82 void RelayPlugin::SetAcceptAddParticipantRequests(bool accept)
83 {
84 acceptAddParticipantRequests=accept;
85 }
86 void RelayPlugin::AddParticipantRequestFromClient(const RakString &key, const RakNetGUID &relayPluginServerGuid)
87 {
88 BitStream bsOut;
89 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
90 bsOut.WriteCasted<MessageID>(RPE_ADD_CLIENT_REQUEST_FROM_CLIENT);
91 bsOut.WriteCompressed(key);
92 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, relayPluginServerGuid, false);
93 }
94 void RelayPlugin::RemoveParticipantRequestFromClient(const RakNetGUID &relayPluginServerGuid)
95 {
96 BitStream bsOut;
97 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
98 bsOut.WriteCasted<MessageID>(RPE_REMOVE_CLIENT_REQUEST_FROM_CLIENT);
99 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, relayPluginServerGuid, false);
100 }
101 // Send a message to a server running RelayPlugin, to forward a message to the system identified by \a key
102 void RelayPlugin::SendToParticipant(const RakNetGUID &relayPluginServerGuid, const RakString &key, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel)
103 {
104 BitStream bsOut;
105 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
106 bsOut.WriteCasted<MessageID>(RPE_MESSAGE_TO_SERVER_FROM_CLIENT);
107 bsOut.WriteCasted<unsigned char>(priority);
108 bsOut.WriteCasted<unsigned char>(reliability);
109 bsOut.Write(orderingChannel);
110 bsOut.WriteCompressed(key);
111 bsOut.Write(bitStream);
112 SendUnified(&bsOut, priority, reliability, orderingChannel, relayPluginServerGuid, false);
113 }
114 void RelayPlugin::SendGroupMessage(const RakNetGUID &relayPluginServerGuid, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel)
115 {
116 BitStream bsOut;
117 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
118 bsOut.WriteCasted<MessageID>(RPE_GROUP_MESSAGE_FROM_CLIENT);
119 bsOut.WriteCasted<unsigned char>(priority);
120 bsOut.WriteCasted<unsigned char>(reliability);
121 bsOut.Write(orderingChannel);
122 bsOut.Write(bitStream);
123 SendUnified(&bsOut, priority, reliability, orderingChannel, relayPluginServerGuid, false);
124 }
125 void RelayPlugin::LeaveGroup(const RakNetGUID &relayPluginServerGuid)
126 {
127 BitStream bsOut;
128 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
129 bsOut.WriteCasted<MessageID>(RPE_LEAVE_GROUP_REQUEST_FROM_CLIENT);
130 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, relayPluginServerGuid, false);
131 }
132 void RelayPlugin::GetGroupList(const RakNetGUID &relayPluginServerGuid)
133 {
134 BitStream bsOut;
135 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
136 bsOut.WriteCasted<MessageID>(RPE_GET_GROUP_LIST_REQUEST_FROM_CLIENT);
137 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, relayPluginServerGuid, false);
138 }
139 PluginReceiveResult RelayPlugin::OnReceive(Packet *packet)
140 {
141 if (packet->data[0]==ID_RELAY_PLUGIN)
142 {
143 switch (packet->data[1])
144 {
145 case RPE_MESSAGE_TO_SERVER_FROM_CLIENT:
146 {
147 BitStream bsIn(packet->data, packet->length, false);
148 bsIn.IgnoreBytes(sizeof(MessageID)*2);
149 PacketPriority priority;
150 PacketReliability reliability;
151 char orderingChannel;
152 unsigned char cIn;
153 bsIn.Read(cIn);
154 priority = (PacketPriority) cIn;
155 bsIn.Read(cIn);
156 reliability = (PacketReliability) cIn;
157 bsIn.Read(orderingChannel);
158 RakString key;
159 bsIn.ReadCompressed(key);
160 BitStream bsData;
161 bsIn.Read(&bsData);
162 StrAndGuidAndRoom **strAndGuid = strToGuidHash.Peek(key);
163 StrAndGuidAndRoom **strAndGuidSender = guidToStrHash.Peek(packet->guid);
164 if (strAndGuid && strAndGuidSender)
165 {
166 BitStream bsOut;
167 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
168 bsOut.WriteCasted<MessageID>(RPE_MESSAGE_TO_CLIENT_FROM_SERVER);
169 bsOut.WriteCompressed( (*strAndGuidSender)->str );
170 bsOut.AlignWriteToByteBoundary();
171 bsOut.Write(bsData);
172 SendUnified(&bsOut, priority, reliability, orderingChannel, (*strAndGuid)->guid, false);
173 }
174
175 return RR_STOP_PROCESSING_AND_DEALLOCATE;
176 }
177
178 case RPE_ADD_CLIENT_REQUEST_FROM_CLIENT:
179 {
180 BitStream bsIn(packet->data, packet->length, false);
181 bsIn.IgnoreBytes(sizeof(MessageID)*2);
182 RakString key;
183 bsIn.ReadCompressed(key);
184 BitStream bsOut;
185 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
186 if (acceptAddParticipantRequests)
187 bsOut.WriteCasted<MessageID>(AddParticipantOnServer(key, packet->guid));
188 else
189 bsOut.WriteCasted<MessageID>(RPE_ADD_CLIENT_NOT_ALLOWED);
190 bsOut.WriteCompressed(key);
191 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
192
193 return RR_STOP_PROCESSING_AND_DEALLOCATE;
194 }
195 case RPE_REMOVE_CLIENT_REQUEST_FROM_CLIENT:
196 {
197 RemoveParticipantOnServer(packet->guid);
198 }
199 return RR_STOP_PROCESSING_AND_DEALLOCATE;
200 case RPE_GROUP_MESSAGE_FROM_CLIENT:
201 {
202 OnGroupMessageFromClient(packet);
203 }
204 return RR_STOP_PROCESSING_AND_DEALLOCATE;
205 case RPE_JOIN_GROUP_REQUEST_FROM_CLIENT:
206 {
207 OnJoinGroupRequestFromClient(packet);
208 }
209 return RR_STOP_PROCESSING_AND_DEALLOCATE;
210 case RPE_LEAVE_GROUP_REQUEST_FROM_CLIENT:
211 {
212 OnLeaveGroupRequestFromClient(packet);
213 }
214 return RR_STOP_PROCESSING_AND_DEALLOCATE;
215 case RPE_GET_GROUP_LIST_REQUEST_FROM_CLIENT:
216 {
217 SendChatRoomsList(packet->guid);
218 }
219 return RR_STOP_PROCESSING_AND_DEALLOCATE;
220 }
221
222 }
223
224 return RR_CONTINUE_PROCESSING;
225 }
226
227 void RelayPlugin::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
228 {
229 (void) lostConnectionReason;
230 (void) systemAddress;
231
232 RemoveParticipantOnServer(rakNetGUID);
233 }
234
235 RelayPlugin::RP_Group* RelayPlugin::JoinGroup(RP_Group* room, StrAndGuidAndRoom **strAndGuidSender)
236 {
237 if (strAndGuidSender==0)
238 return 0;
239
240 NotifyUsersInRoom(room, RPE_USER_ENTERED_ROOM, (*strAndGuidSender)->str);
241 StrAndGuid sag;
242 sag.guid=(*strAndGuidSender)->guid;
243 sag.str=(*strAndGuidSender)->str;
244
245 room->usersInRoom.Push(sag, _FILE_AND_LINE_);
246 (*strAndGuidSender)->currentRoom=room->roomName;
247
248 return room;
249 }
250 void RelayPlugin::JoinGroupRequest(const RakNetGUID &relayPluginServerGuid, RakString groupName)
251 {
252 BitStream bsOut;
253 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
254 bsOut.WriteCasted<MessageID>(RPE_JOIN_GROUP_REQUEST_FROM_CLIENT);
255 bsOut.WriteCompressed(groupName);
256 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, relayPluginServerGuid, false);
257 }
258 RelayPlugin::RP_Group* RelayPlugin::JoinGroup(RakNetGUID userGuid, RakString roomName)
259 {
260 StrAndGuidAndRoom **strAndGuidSender = guidToStrHash.Peek(userGuid);
261 if (strAndGuidSender)
262 {
263 if (roomName.IsEmpty())
264 return 0;
265
266 if ((*strAndGuidSender)->currentRoom==roomName)
267 return 0;
268
269 if ((*strAndGuidSender)->currentRoom.IsEmpty()==false)
270 LeaveGroup(strAndGuidSender);
271
272 RakString userName = (*strAndGuidSender)->str;
273
274 for (unsigned int i=0; i < chatRooms.Size(); i++)
275 {
276 if (chatRooms[i]->roomName==roomName)
277 {
278 // Join existing room
279 return JoinGroup(chatRooms[i],strAndGuidSender);
280 }
281 }
282
283 // Create new room
284 RP_Group *room = SLNet::OP_NEW<RP_Group>(_FILE_AND_LINE_);
285 room->roomName=roomName;
286 chatRooms.Push(room, _FILE_AND_LINE_);
287 return JoinGroup(room,strAndGuidSender);
288 }
289
290 return 0;
291 }
292 void RelayPlugin::LeaveGroup(StrAndGuidAndRoom **strAndGuidSender)
293 {
294 if (strAndGuidSender==0)
295 return;
296
297 RakString userName = (*strAndGuidSender)->str;
298 for (unsigned int i=0; i < chatRooms.Size(); i++)
299 {
300 if (chatRooms[i]->roomName==(*strAndGuidSender)->currentRoom)
301 {
302 (*strAndGuidSender)->currentRoom.Clear();
303
304 RP_Group *room = chatRooms[i];
305 for (unsigned int j=0; j < room->usersInRoom.Size(); j++)
306 {
307 if (room->usersInRoom[j].guid==(*strAndGuidSender)->guid)
308 {
309 room->usersInRoom.RemoveAtIndexFast(j);
310
311 if (room->usersInRoom.Size()==0)
312 {
313 SLNet::OP_DELETE(room, _FILE_AND_LINE_);
314 chatRooms.RemoveAtIndexFast(i);
315 return;
316 }
317 }
318 }
319
320 NotifyUsersInRoom(room, RPE_USER_LEFT_ROOM, userName);
321
322 return;
323
324 }
325 }
326 }
327 void RelayPlugin::NotifyUsersInRoom(RP_Group *room, int msg, const RakString& message)
328 {
329 for (unsigned int i=0; i < room->usersInRoom.Size(); i++)
330 {
331 BitStream bsOut;
332 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
333 bsOut.WriteCasted<MessageID>(msg);
334 bsOut.WriteCompressed(message);
335
336 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, room->usersInRoom[i].guid, false);
337 }
338 }
339 void RelayPlugin::SendMessageToRoom(StrAndGuidAndRoom **strAndGuidSender, BitStream* message)
340 {
341 if ((*strAndGuidSender)->currentRoom.IsEmpty())
342 return;
343
344 for (unsigned int i=0; i < chatRooms.Size(); i++)
345 {
346 if (chatRooms[i]->roomName==(*strAndGuidSender)->currentRoom)
347 {
348 BitStream bsOut;
349 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
350 bsOut.WriteCasted<MessageID>(RPE_GROUP_MSG_FROM_SERVER);
351 message->ResetReadPointer();
352 bsOut.WriteCompressed((*strAndGuidSender)->str);
353 bsOut.AlignWriteToByteBoundary();
354 bsOut.Write(message);
355
356 RP_Group *room = chatRooms[i];
357 for (unsigned int j=0; j < room->usersInRoom.Size(); j++)
358 {
359 if (room->usersInRoom[j].guid!=(*strAndGuidSender)->guid)
360 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, room->usersInRoom[j].guid, false);
361 }
362
363 break;
364 }
365 }
366 }
367 void RelayPlugin::SendChatRoomsList(RakNetGUID target)
368 {
369 BitStream bsOut;
370 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
371 bsOut.WriteCasted<MessageID>(RPE_GET_GROUP_LIST_REPLY_FROM_SERVER);
372 bsOut.WriteCasted<uint16_t>(chatRooms.Size());
373 for (unsigned int i=0; i < chatRooms.Size(); i++)
374 {
375 bsOut.WriteCompressed(chatRooms[i]->roomName);
376 bsOut.WriteCasted<uint16_t>(chatRooms[i]->usersInRoom.Size());
377 }
378 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, target, false);
379 }
380 void RelayPlugin::OnGroupMessageFromClient(Packet *packet)
381 {
382 BitStream bsIn(packet->data, packet->length, false);
383 bsIn.IgnoreBytes(sizeof(MessageID)*2);
384
385 PacketPriority priority;
386 PacketReliability reliability;
387 char orderingChannel;
388 unsigned char cIn;
389 bsIn.Read(cIn);
390 priority = (PacketPriority) cIn;
391 bsIn.Read(cIn);
392 reliability = (PacketReliability) cIn;
393 bsIn.Read(orderingChannel);
394 BitStream bsData;
395 bsIn.Read(&bsData);
396
397 StrAndGuidAndRoom **strAndGuidSender = guidToStrHash.Peek(packet->guid);
398 if (strAndGuidSender)
399 {
400 SendMessageToRoom(strAndGuidSender,&bsData);
401 }
402 }
403 void RelayPlugin::OnJoinGroupRequestFromClient(Packet *packet)
404 {
405 BitStream bsIn(packet->data, packet->length, false);
406 bsIn.IgnoreBytes(sizeof(MessageID)*2);
407 RakString groupName;
408 bsIn.ReadCompressed(groupName);
409 RelayPlugin::RP_Group *groupJoined = JoinGroup(packet->guid, groupName);
410
411 BitStream bsOut;
412 bsOut.WriteCasted<MessageID>(ID_RELAY_PLUGIN);
413 if (groupJoined)
414 {
415 bsOut.WriteCasted<MessageID>(RPE_JOIN_GROUP_SUCCESS);
416 bsOut.WriteCasted<uint16_t>(groupJoined->usersInRoom.Size());
417 for (unsigned int i=0; i < groupJoined->usersInRoom.Size(); i++)
418 {
419 bsOut.WriteCompressed(groupJoined->usersInRoom[i].str);
420 }
421 }
422 else
423 {
424 bsOut.WriteCasted<MessageID>(RPE_JOIN_GROUP_FAILURE);
425 }
426
427 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
428 }
429 void RelayPlugin::OnLeaveGroupRequestFromClient(Packet *packet)
430 {
431 BitStream bsIn(packet->data, packet->length, false);
432 bsIn.IgnoreBytes(sizeof(MessageID)*2);
433 StrAndGuidAndRoom **strAndGuidSender = guidToStrHash.Peek(packet->guid);
434 if (strAndGuidSender)
435 LeaveGroup(strAndGuidSender);
436 }
437 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatPunchthroughClient.h Source File

  • include
  • slikenet
NatPunchthroughClient.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_NatPunchthroughClient==1
22
23 #ifndef __NAT_PUNCHTHROUGH_CLIENT_H
24 #define __NAT_PUNCHTHROUGH_CLIENT_H
25
26 #include "types.h"
27 #include "Export.h"
28 #include "PluginInterface2.h"
29 #include "PacketPriority.h"
30 #include "SocketIncludes.h"
31 #include "DS_List.h"
32 #include "string.h"
33 #include "DS_Queue.h"
34
35 // Trendnet TEW-632BRP sometimes starts at port 1024 and increments sequentially.
36 // Zonnet zsr1134we. Replies go out on the net, but are always absorbed by the remote router??
37 // Dlink ebr2310 to Trendnet ok
38 // Trendnet TEW-652BRP to Trendnet 632BRP OK
39 // Trendnet TEW-632BRP to Trendnet 632BRP OK
40 // Buffalo WHR-HP-G54 OK
41 // Netgear WGR614 ok
42
43 namespace SLNet
44 {
46 class RakPeerInterface;
47 struct Packet;
48 #if _RAKNET_SUPPORT_PacketLogger==1
49 class PacketLogger;
50 #endif
51
53 struct RAK_DLL_EXPORT PunchthroughConfiguration
54 {
58 PunchthroughConfiguration() {
59 TIME_BETWEEN_PUNCH_ATTEMPTS_INTERNAL=15;
60 TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL=50;
61 UDP_SENDS_PER_PORT_INTERNAL=2;
62 UDP_SENDS_PER_PORT_EXTERNAL=8;
63 INTERNAL_IP_WAIT_AFTER_ATTEMPTS=30;
64 MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK=5;
65 MAX_PREDICTIVE_PORT_RANGE=2;
66 EXTERNAL_IP_WAIT_BETWEEN_PORTS=200;
67 EXTERNAL_IP_WAIT_AFTER_FIRST_TTL=100;
68 EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS=EXTERNAL_IP_WAIT_BETWEEN_PORTS;
69 retryOnFailure=false;
70 }
71
73 SLNet::Time TIME_BETWEEN_PUNCH_ATTEMPTS_INTERNAL;
74 SLNet::Time TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL;
75
77 int UDP_SENDS_PER_PORT_INTERNAL;
78 int UDP_SENDS_PER_PORT_EXTERNAL;
79
81 int INTERNAL_IP_WAIT_AFTER_ATTEMPTS;
82
84 int MAX_PREDICTIVE_PORT_RANGE;
85
87 int EXTERNAL_IP_WAIT_AFTER_FIRST_TTL;
88
90 int EXTERNAL_IP_WAIT_BETWEEN_PORTS;
91
93 int EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS;
94
98 int MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK;
99
102 bool retryOnFailure;
103 };
104
106 struct RAK_DLL_EXPORT NatPunchthroughDebugInterface
107 {
108 NatPunchthroughDebugInterface() {}
109 virtual ~NatPunchthroughDebugInterface() {}
110 virtual void OnClientMessage(const char *msg)=0;
111 };
112
114 struct RAK_DLL_EXPORT NatPunchthroughDebugInterface_Printf : public NatPunchthroughDebugInterface
115 {
116 virtual void OnClientMessage(const char *msg);
117 };
118
119 #if _RAKNET_SUPPORT_PacketLogger==1
120
121 struct RAK_DLL_EXPORT NatPunchthroughDebugInterface_PacketLogger : public NatPunchthroughDebugInterface
122 {
123 // Set to non-zero to write to the packetlogger!
124 PacketLogger *pl;
125
126 NatPunchthroughDebugInterface_PacketLogger() {pl=0;}
127 ~NatPunchthroughDebugInterface_PacketLogger() {}
128 virtual void OnClientMessage(const char *msg);
129 };
130 #endif
131
139 class RAK_DLL_EXPORT NatPunchthroughClient : public PluginInterface2
140 {
141 public:
142
143 // GetInstance() and DestroyInstance(instance*)
144 STATIC_FACTORY_DECLARATIONS(NatPunchthroughClient)
145
146 NatPunchthroughClient();
147 ~NatPunchthroughClient();
148
153 void FindRouterPortStride(const SystemAddress &facilitator);
154
162 bool OpenNAT(RakNetGUID destination, const SystemAddress &facilitator);
163
164 /*
172 bool OpenNATGroup(DataStructures::List<RakNetGUID> destinationSystems, const SystemAddress &facilitator);
173 */
174
177 PunchthroughConfiguration* GetPunchthroughConfiguration(void);
178
181 void SetDebugInterface(NatPunchthroughDebugInterface *i);
182
184 void GetUPNPPortMappings(char *externalPort, char *internalPort, const SystemAddress &natPunchthroughServerAddress);
185
187 virtual void Update(void);
188
190 virtual PluginReceiveResult OnReceive(Packet *packet);
191
193 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
194
196 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
197
198 virtual void OnAttach(void);
199 virtual void OnDetach(void);
200 virtual void OnRakPeerShutdown(void);
201 void Clear(void);
202
203 struct SendPing
204 {
205 SLNet::Time nextActionTime;
206 SystemAddress targetAddress;
207 SystemAddress facilitator;
208 SystemAddress internalIds[MAXIMUM_NUMBER_OF_INTERNAL_IDS];
209 RakNetGUID targetGuid;
210 bool weAreSender;
211 int attemptCount;
212 int retryCount;
213 int punchingFixedPortAttempts; // only used for TestMode::PUNCHING_FIXED_PORT
214 uint16_t sessionId;
215 bool sentTTL;
216 // Give priority to internal IP addresses because if we are on a LAN, we don't want to try to connect through the internet
217 enum TestMode
218 {
219 TESTING_INTERNAL_IPS,
220 WAITING_FOR_INTERNAL_IPS_RESPONSE,
221 //SEND_WITH_TTL,
222 TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT,
223 TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT,
224 TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024,
225 TESTING_EXTERNAL_IPS_1024_TO_1024,
226 WAITING_AFTER_ALL_ATTEMPTS,
227
228 // The trendnet remaps the remote port to 1024.
229 // If you continue punching on a different port for the same IP it bans you and the communication becomes unidirectioal
230 PUNCHING_FIXED_PORT,
231
232 // try port 1024-1028
233 } testMode;
234 } sp;
235
236 protected:
237 unsigned short mostRecentExternalPort;
238 //void OnNatGroupPunchthroughRequest(Packet *packet);
239 void OnFailureNotification(Packet *packet);
240 //void OnNatGroupPunchthroughReply(Packet *packet);
241 void OnGetMostRecentPort(Packet *packet);
242 void OnConnectAtTime(Packet *packet);
243 unsigned int GetPendingOpenNATIndex(RakNetGUID destination, const SystemAddress &facilitator);
244 void SendPunchthrough(RakNetGUID destination, const SystemAddress &facilitator);
245 void QueueOpenNAT(RakNetGUID destination, const SystemAddress &facilitator);
246 void SendQueuedOpenNAT(void);
247 void SendTTL(const SystemAddress &sa);
248 void SendOutOfBand(SystemAddress sa, MessageID oobId);
249 void OnPunchthroughFailure(void);
250 void OnReadyForNextPunchthrough(void);
251 void PushFailure(void);
252 bool RemoveFromFailureQueue(void);
253 void PushSuccess(void);
254
255 PunchthroughConfiguration pc;
256 NatPunchthroughDebugInterface *natPunchthroughDebugInterface;
257
258 // The first time we fail a NAT attempt, we add it to failedAttemptList and try again, since sometimes trying again later fixes the problem
259 // The second time we fail, we return ID_NAT_PUNCHTHROUGH_FAILED
260 struct AddrAndGuid
261 {
262 SystemAddress addr;
263 RakNetGUID guid;
264 };
265 DataStructures::List<AddrAndGuid> failedAttemptList;
266
267 struct DSTAndFac
268 {
269 RakNetGUID destination;
270 SystemAddress facilitator;
271 };
272 DataStructures::Queue<DSTAndFac> queuedOpenNat;
273
274 void IncrementExternalAttemptCount(SLNet::Time time, SLNet::Time delta);
275 unsigned short portStride;
276 enum
277 {
278 HAS_PORT_STRIDE,
279 UNKNOWN_PORT_STRIDE,
280 CALCULATING_PORT_STRIDE,
281 INCAPABLE_PORT_STRIDE
282 } hasPortStride;
283 SLNet::Time portStrideCalTimeout;
284
285 /*
286 struct TimeAndGuid
287 {
288 SLNet::Time time;
289 RakNetGUID guid;
290 };
291 DataStructures::List<TimeAndGuid> groupRequestsInProgress;
292
293 struct GroupPunchRequest
294 {
295 SystemAddress facilitator;
296 DataStructures::List<RakNetGUID> pendingList;
297 DataStructures::List<RakNetGUID> passedListGuid;
298 DataStructures::List<SystemAddress> passedListAddress;
299 DataStructures::List<RakNetGUID> failedList;
300 DataStructures::List<RakNetGUID> ignoredList;
301 };
302 DataStructures::List<GroupPunchRequest*> groupPunchRequests;
303 void UpdateGroupPunchOnNatResult(SystemAddress facilitator, RakNetGUID targetSystem, SystemAddress targetSystemAddress, int result); // 0=failed, 1=success, 2=ignore
304 */
305 };
306
307 } // namespace SLNet
308
309 #endif
310
311 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • AddressOrGUID
SLNet::AddressOrGUID Member List

This is the complete list of members for SLNet::AddressOrGUID, including all inherited members.

AddressOrGUID() | SLNet::AddressOrGUID | inline
AddressOrGUID(const AddressOrGUID &input) | SLNet::AddressOrGUID | inline
AddressOrGUID(const SystemAddress &input) | SLNet::AddressOrGUID | inline
AddressOrGUID(Packet *packet) | SLNet::AddressOrGUID |
AddressOrGUID(const RakNetGUID &input) | SLNet::AddressOrGUID | inline
GetSystemIndex(void) const | SLNet::AddressOrGUID | inline
IsUndefined(void) const | SLNet::AddressOrGUID | inline
operator=(const AddressOrGUID &input) | SLNet::AddressOrGUID | inline
operator=(const SystemAddress &input) | SLNet::AddressOrGUID | inline
operator=(const RakNetGUID &input) | SLNet::AddressOrGUID | inline
operator==(const AddressOrGUID &right) const | SLNet::AddressOrGUID | inline
rakNetGuid | SLNet::AddressOrGUID |
SetUndefined(void) | SLNet::AddressOrGUID | inline
systemAddress | SLNet::AddressOrGUID |
ToInteger(const AddressOrGUID &aog) | SLNet::AddressOrGUID | static
ToString(bool writePort=true) const | SLNet::AddressOrGUID |
ToString(bool writePort, char *dest) const | SLNet::AddressOrGUID |
ToString(bool writePort, char *dest, size_t destLength) const | SLNet::AddressOrGUID |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FLP_Printf
SLNet::FLP_Printf Member List

This is the complete list of members for SLNet::FLP_Printf, including all inherited members.

FileListProgress() | SLNet::FileListProgress | inline
FLP_Printf() | SLNet::FLP_Printf | inline
OnAddFilesFromDirectoryStarted(FileList *fileList, char *dir) | SLNet::FLP_Printf | virtual
OnDirectory(FileList *fileList, char *dir, unsigned int directoriesRemaining) | SLNet::FLP_Printf | virtual
OnFile(FileList *fileList, char *dir, char *fileName, unsigned int fileSize) | SLNet::FileListProgress | inlinevirtual
OnFilePush(const char *fileName, unsigned int fileLengthBytes, unsigned int offset, unsigned int bytesBeingSent, bool done, SystemAddress targetSystem, unsigned short setId) | SLNet::FileListProgress | inlinevirtual
OnFilePushesComplete(SystemAddress systemAddress, unsigned short setID) | SLNet::FLP_Printf | virtual
OnSendAborted(SystemAddress systemAddress) | SLNet::FLP_Printf | virtual
~FileListProgress() | SLNet::FileListProgress | inlinevirtual
~FLP_Printf() | SLNet::FLP_Printf | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ReadyEvent.h Source File

  • include
  • slikenet
ReadyEvent.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_ReadyEvent==1
23
24 #ifndef __READY_EVENT_H
25 #define __READY_EVENT_H
26
27 #include "PluginInterface2.h"
28 #include "DS_OrderedList.h"
29
30 namespace SLNet {
31
32 class RakPeerInterface;
33
38
41 enum ReadyEventSystemStatus
42 {
46 RES_NOT_WAITING,
48 RES_WAITING,
50 RES_READY,
53 RES_ALL_READY,
54
56 RES_UNKNOWN_EVENT,
57 };
58
68 class ReadyEvent : public PluginInterface2
69 {
70 public:
71 // GetInstance() and DestroyInstance(instance*)
72 STATIC_FACTORY_DECLARATIONS(ReadyEvent)
73
74 // Constructor
75 ReadyEvent();
76
77 // Destructor
78 virtual ~ReadyEvent();
79
80 // --------------------------------------------------------------------------------------------
81 // User functions
82 // --------------------------------------------------------------------------------------------
92 bool SetEvent(int eventId, bool isReady);
93
99 void ForceCompletion(int eventId);
100
105 bool DeleteEvent(int eventId);
106
109 bool IsEventSet(int eventId);
110
116 bool IsEventCompletionProcessing(int eventId) const;
117
123 bool IsEventCompleted(int eventId) const;
124
129 bool HasEvent(int eventId);
130
133 unsigned GetEventListSize(void) const;
134
138 int GetEventAtIndex(unsigned index) const;
139
147 bool AddToWaitList(int eventId, RakNetGUID guid);
148
153 bool RemoveFromWaitList(int eventId, RakNetGUID guid);
154
159 bool IsInWaitList(int eventId, RakNetGUID guid);
160
165 unsigned GetRemoteWaitListSize(int eventId) const;
166
171 RakNetGUID GetFromWaitListAtIndex(int eventId, unsigned index) const;
172
177 ReadyEventSystemStatus GetReadyStatus(int eventId, RakNetGUID guid);
178
181 void SetSendChannel(unsigned char newChannel);
182
183 // ---------------------------- ALL INTERNAL AFTER HERE ----------------------------
186 struct RemoteSystem
187 {
188 MessageID lastSentStatus, lastReceivedStatus;
189 RakNetGUID rakNetGuid;
190 };
191 static int RemoteSystemCompByGuid( const RakNetGUID &key, const RemoteSystem &data );
194 struct ReadyEventNode
195 {
196 int eventId; // Sorted on this
197 MessageID eventStatus;
198 DataStructures::OrderedList<RakNetGUID,RemoteSystem,ReadyEvent::RemoteSystemCompByGuid> systemList;
199 };
200 static int ReadyEventNodeComp( const int &key, ReadyEvent::ReadyEventNode * const &data );
201
202
203 protected:
204 // --------------------------------------------------------------------------------------------
205 // Packet handling functions
206 // --------------------------------------------------------------------------------------------
207 virtual PluginReceiveResult OnReceive(Packet *packet);
208 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
209 virtual void OnRakPeerShutdown(void);
210
211 void Clear(void);
212 /*
213 bool AnyWaitersCompleted(unsigned eventIndex) const;
214 bool AllWaitersCompleted(unsigned eventIndex) const;
215 bool AllWaitersReady(unsigned eventIndex) const;
216 void SendAllReady(unsigned eventId, RakNetGUID guid);
217 void BroadcastAllReady(unsigned eventIndex);
218 void SendReadyStateQuery(unsigned eventId, RakNetGUID guid);
219 void BroadcastReadyUpdate(unsigned eventIndex);
220 bool AddToWaitListInternal(unsigned eventIndex, RakNetGUID guid);
221 bool IsLocked(unsigned eventIndex) const;
222 bool IsAllReadyByIndex(unsigned eventIndex) const;
223 */
224
225 void SendReadyStateQuery(unsigned eventId, RakNetGUID guid);
226 void SendReadyUpdate(unsigned eventIndex, unsigned systemIndex, bool forceIfNotDefault);
227 void BroadcastReadyUpdate(unsigned eventIndex, bool forceIfNotDefault);
228 void RemoveFromAllLists(RakNetGUID guid);
229 void OnReadyEventQuery(Packet *packet);
230 void PushCompletionPacket(unsigned eventId);
231 bool AddToWaitListInternal(unsigned eventIndex, RakNetGUID guid);
232 void OnReadyEventForceAllSet(Packet *packet);
233 void OnReadyEventPacketUpdate(Packet *packet);
234 void UpdateReadyStatus(unsigned eventIndex);
235 bool IsEventCompletedByIndex(unsigned eventIndex) const;
236 unsigned CreateNewEvent(int eventId, bool isReady);
237 bool SetEventByIndex(int eventIndex, bool isReady);
238
239 DataStructures::OrderedList<int, ReadyEventNode*, ReadyEvent::ReadyEventNodeComp> readyEventNodeList;
240 unsigned char channel;
241 };
242
243 } // namespace SLNet
244
245 #endif
246
247 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/RPC4Plugin.h Source File

  • include
  • slikenet
RPC4Plugin.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_RPC4Plugin==1
23
24 #ifndef __RPC_4_PLUGIN_H
25 #define __RPC_4_PLUGIN_H
26
27 #include "PluginInterface2.h"
28 #include "PacketPriority.h"
29 #include "types.h"
30 #include "BitStream.h"
31 #include "string.h"
32 #include "NetworkIDObject.h"
33 #include "DS_Hash.h"
34 #include "DS_OrderedList.h"
35
40
41 namespace SLNet
42 {
44 class RakPeerInterface;
45 class NetworkIDManager;
46
51 enum RPCErrorCodes
52 {
54 RPC_ERROR_FUNCTION_NOT_REGISTERED,
55 };
56
58 class RAK_DLL_EXPORT RPC4GlobalRegistration
59 {
60 public:
62 RPC4GlobalRegistration(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, Packet *packet ));
63
65 RPC4GlobalRegistration(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, Packet *packet ), int callPriority);
66
68 RPC4GlobalRegistration(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet ));
69
71 RPC4GlobalRegistration(const char* uniqueID, MessageID messageId);
72 };
73
79 class RAK_DLL_EXPORT RPC4 : public PluginInterface2
80 {
81 public:
82 // GetInstance() and DestroyInstance(instance*)
83 STATIC_FACTORY_DECLARATIONS(RPC4)
84
85 // Constructor
86 RPC4();
87
88 // Destructor
89 virtual ~RPC4();
90
99 bool RegisterFunction(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, Packet *packet ));
100
106 void RegisterSlot(const char *sharedIdentifier, void ( *functionPointer ) (SLNet::BitStream *userData, Packet *packet ), int callPriority);
107
109 bool RegisterBlockingFunction(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet ));
110
116 void RegisterLocalCallback(const char* uniqueID, MessageID messageId);
117
121 bool UnregisterFunction(const char* uniqueID);
122
124 bool UnregisterBlockingFunction(const char* uniqueID);
125
130 bool UnregisterLocalCallback(const char* uniqueID, MessageID messageId);
131
134 bool UnregisterSlot(const char* sharedIdentifier);
135
140 void CallLoopback( const char* uniqueID, SLNet::BitStream * bitStream );
141
151 void Call( const char* uniqueID, SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast );
152
164 bool CallBlocking( const char* uniqueID, SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, SLNet::BitStream *returnData );
165
175 void Signal(const char *sharedIdentifier, SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, bool invokeLocal);
176
178 void InterruptSignal(void);
179
181 struct LocalCallback
182 {
183 MessageID messageId;
184 DataStructures::OrderedList<SLNet::RakString, SLNet::RakString> functions;
185 };
186 static int LocalCallbackComp(const MessageID &key, LocalCallback* const &data );
187
189 // Callable object, along with priority to call relative to other objects
190 struct LocalSlotObject
191 {
192 LocalSlotObject() {}
193 LocalSlotObject(unsigned int _registrationCount,int _callPriority, void ( *_functionPointer ) (SLNet::BitStream *userData, Packet *packet ))
194 {registrationCount=_registrationCount;callPriority=_callPriority;functionPointer=_functionPointer;}
195 ~LocalSlotObject() {}
196
197 // Used so slots are called in the order they are registered
198 unsigned int registrationCount;
199 int callPriority;
200 void ( *functionPointer ) (SLNet::BitStream *userData, Packet *packet );
201 };
202
203 static int LocalSlotObjectComp( const LocalSlotObject &key, const LocalSlotObject &data );
204
206 struct LocalSlot
207 {
208 DataStructures::OrderedList<LocalSlotObject,LocalSlotObject,LocalSlotObjectComp> slotObjects;
209 };
210 DataStructures::Hash<SLNet::RakString, LocalSlot*,256, SLNet::RakString::ToInteger> localSlots;
211
212 protected:
213
214 // --------------------------------------------------------------------------------------------
215 // Packet handling functions
216 // --------------------------------------------------------------------------------------------
217 virtual void OnAttach(void);
218 virtual PluginReceiveResult OnReceive(Packet *packet);
219
220 DataStructures::Hash<SLNet::RakString, void ( * ) (SLNet::BitStream *, Packet * ),64, SLNet::RakString::ToInteger> registeredNonblockingFunctions;
221 DataStructures::Hash<SLNet::RakString, void ( * ) (SLNet::BitStream *, SLNet::BitStream *, Packet * ),64, SLNet::RakString::ToInteger> registeredBlockingFunctions;
222 DataStructures::OrderedList<MessageID,LocalCallback*,RPC4::LocalCallbackComp> localCallbacks;
223
224 SLNet::BitStream blockingReturnValue;
225 bool gotBlockingReturnValue;
226
227 DataStructures::HashIndex GetLocalSlotIndex(const char *sharedIdentifier);
228
230 unsigned int nextSlotRegistrationCount;
231
232 bool interruptSignal;
233
234 void InvokeSignal(DataStructures::HashIndex functionIndex, SLNet::BitStream *serializedParameters, Packet *packet);
235 };
236
237 } // End namespace
238
239 #endif
240
241 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketizedTCP.cpp Source File

  • src
PacketizedTCP.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
18
19 #include <algorithm> // used for std::min
20 #include "slikenet/PacketizedTCP.h"
21 #include "slikenet/NativeTypes.h"
22 #include "slikenet/BitStream.h"
23 #include "slikenet/MessageIdentifiers.h"
24 #include "slikenet/alloca.h"
25
26 using namespace SLNet;
27
28 typedef uint32_t PTCPHeader;
29
30 STATIC_FACTORY_DEFINITIONS(PacketizedTCP,PacketizedTCP);
31
32 PacketizedTCP::PacketizedTCP()
33 {
34
35 }
36 PacketizedTCP::~PacketizedTCP()
37 {
38 ClearAllConnections();
39 }
40
41 void PacketizedTCP::Stop(void)
42 {
43 unsigned int i;
44 TCPInterface::Stop();
45 for (i=0; i < waitingPackets.Size(); i++)
46 DeallocatePacket(waitingPackets[i]);
47 ClearAllConnections();
48 }
49
50 void PacketizedTCP::Send( const char *data, unsigned length, const SystemAddress &systemAddress, bool broadcast )
51 {
52 PTCPHeader dataLength;
53 dataLength=length;
54 #ifndef __BITSTREAM_NATIVE_END
55 if (SLNet::BitStream::DoEndianSwap())
56 SLNet::BitStream::ReverseBytes((unsigned char*) &length,(unsigned char*) &dataLength,sizeof(dataLength));
57 #else
58 dataLength=length;
59 #endif
60
61 unsigned int lengthsArray[2];
62 const char *dataArray[2];
63 dataArray[0]=(char*) &dataLength;
64 dataArray[1]=data;
65 lengthsArray[0]=sizeof(dataLength);
66 lengthsArray[1]=length;
67 TCPInterface::SendList(dataArray,lengthsArray,2,systemAddress,broadcast);
68 }
69 bool PacketizedTCP::SendList( const char **data, const unsigned int *lengths, const int numParameters, const SystemAddress &systemAddress, bool broadcast )
70 {
71 if (isStarted.GetValue()==0)
72 return false;
73 if (data==0)
74 return false;
75 if (systemAddress==UNASSIGNED_SYSTEM_ADDRESS && broadcast==false)
76 return false;
77 PTCPHeader totalLengthOfUserData=0;
78 int i;
79 for (i=0; i < numParameters; i++)
80 {
81 if (lengths[i]>0)
82 totalLengthOfUserData+=lengths[i];
83 }
84 if (totalLengthOfUserData==0)
85 return false;
86
87 PTCPHeader dataLength;
88 #ifndef __BITSTREAM_NATIVE_END
89 if (SLNet::BitStream::DoEndianSwap())
90 SLNet::BitStream::ReverseBytes((unsigned char*) &totalLengthOfUserData,(unsigned char*) &dataLength,sizeof(dataLength));
91 #else
92 dataLength=totalLengthOfUserData;
93 #endif
94
95
96 unsigned int lengthsArray[513];
97 const char *dataArray[513];
98 dataArray[0]=(char*) &dataLength;
99 lengthsArray[0]=sizeof(dataLength);
100 for (i=0; i < 512 && i < numParameters; i++)
101 {
102 dataArray[i+1]=data[i];
103 lengthsArray[i+1]=lengths[i];
104 }
105 return TCPInterface::SendList(dataArray,lengthsArray,std::min(numParameters, 511)+1,systemAddress,broadcast);
106 }
107 void PacketizedTCP::PushNotificationsToQueues(void)
108 {
109 SystemAddress sa;
110 sa = TCPInterface::HasNewIncomingConnection();
111 if (sa!=UNASSIGNED_SYSTEM_ADDRESS)
112 {
113 _newIncomingConnections.Push(sa, _FILE_AND_LINE_ );
114 AddToConnectionList(sa);
115 }
116
117 sa = TCPInterface::HasFailedConnectionAttempt();
118 if (sa!=UNASSIGNED_SYSTEM_ADDRESS)
119 {
120 _failedConnectionAttempts.Push(sa, _FILE_AND_LINE_ );
121 }
122
123 sa = TCPInterface::HasLostConnection();
124 if (sa!=UNASSIGNED_SYSTEM_ADDRESS)
125 {
126 _lostConnections.Push(sa, _FILE_AND_LINE_ );
127 RemoveFromConnectionList(sa);
128 }
129
130 sa = TCPInterface::HasCompletedConnectionAttempt();
131 if (sa!=UNASSIGNED_SYSTEM_ADDRESS)
132 {
133 _completedConnectionAttempts.Push(sa, _FILE_AND_LINE_ );
134 AddToConnectionList(sa);
135 }
136 }
137 Packet* PacketizedTCP::Receive( void )
138 {
139 PushNotificationsToQueues();
140
141 unsigned int i;
142 for (i=0; i < messageHandlerList.Size(); i++)
143 messageHandlerList[i]->Update();
144
145 Packet *outgoingPacket=ReturnOutgoingPacket();
146 if (outgoingPacket)
147 return outgoingPacket;
148
149 Packet *incomingPacket;
150 incomingPacket = TCPInterface::ReceiveInt();
151 unsigned int index;
152
153 while (incomingPacket)
154 {
155 if (connections.Has(incomingPacket->systemAddress))
156 index = connections.GetIndexAtKey(incomingPacket->systemAddress);
157 else
158 index=(unsigned int) -1;
159 if ((unsigned int)index==(unsigned int)-1)
160 {
161 DeallocatePacket(incomingPacket);
162 incomingPacket = TCPInterface::ReceiveInt();
163 continue;
164 }
165
166
167 if (incomingPacket->deleteData==true)
168 {
169 // Came from network
170 SystemAddress systemAddressFromPacket;
171 if (index < connections.Size())
172 {
173 DataStructures::ByteQueue *bq = connections[index];
174 // Buffer data
175 bq->WriteBytes((const char*) incomingPacket->data,incomingPacket->length, _FILE_AND_LINE_);
176 systemAddressFromPacket=incomingPacket->systemAddress;
177 PTCPHeader dataLength;
178
179 // Peek the header to see if a full message is waiting
180 bq->ReadBytes((char*) &dataLength,sizeof(PTCPHeader),true);
181 if (SLNet::BitStream::DoEndianSwap())
182 SLNet::BitStream::ReverseBytesInPlace((unsigned char*) &dataLength,sizeof(dataLength));
183 // Header indicates packet length. If enough data is available, read out and return one packet
184 if (bq->GetBytesWritten()>=dataLength+sizeof(PTCPHeader))
185 {
186 do
187 {
188 bq->IncrementReadOffset(sizeof(PTCPHeader));
189 outgoingPacket = SLNet::OP_NEW<Packet>(_FILE_AND_LINE_);
190 outgoingPacket->length=dataLength;
191 outgoingPacket->bitSize=BYTES_TO_BITS(dataLength);
192 outgoingPacket->guid=UNASSIGNED_RAKNET_GUID;
193 outgoingPacket->systemAddress=systemAddressFromPacket;
194 outgoingPacket->deleteData=false; // Did not come from the network
195 outgoingPacket->data=(unsigned char*) rakMalloc_Ex(dataLength, _FILE_AND_LINE_);
196 if (outgoingPacket->data==0)
197 {
198 notifyOutOfMemory(_FILE_AND_LINE_);
199 SLNet::OP_DELETE(outgoingPacket,_FILE_AND_LINE_);
200 return 0;
201 }
202 bq->ReadBytes((char*) outgoingPacket->data,dataLength,false);
203
204 waitingPackets.Push(outgoingPacket, _FILE_AND_LINE_ );
205
206 // Peek the header to see if a full message is waiting
207 if (bq->ReadBytes((char*) &dataLength,sizeof(PTCPHeader),true))
208 {
209 if (SLNet::BitStream::DoEndianSwap())
210 SLNet::BitStream::ReverseBytesInPlace((unsigned char*) &dataLength,sizeof(dataLength));
211 }
212 else
213 break;
214 } while (bq->GetBytesWritten()>=dataLength+sizeof(PTCPHeader));
215 }
216 else
217 {
218
219 unsigned int oldWritten = bq->GetBytesWritten()-incomingPacket->length;
220 unsigned int newWritten = bq->GetBytesWritten();
221
222 // Return ID_DOWNLOAD_PROGRESS
223 if (newWritten/65536!=oldWritten/65536)
224 {
225 outgoingPacket = SLNet::OP_NEW<Packet>(_FILE_AND_LINE_);
226 outgoingPacket->length=sizeof(MessageID) +
227 sizeof(unsigned int)*2 +
228 sizeof(unsigned int) +
229 65536;
230 outgoingPacket->bitSize=BYTES_TO_BITS(incomingPacket->length);
231 outgoingPacket->guid=UNASSIGNED_RAKNET_GUID;
232 outgoingPacket->systemAddress=incomingPacket->systemAddress;
233 outgoingPacket->deleteData=false;
234 outgoingPacket->data=(unsigned char*) rakMalloc_Ex(outgoingPacket->length, _FILE_AND_LINE_);
235 if (outgoingPacket->data==0)
236 {
237 notifyOutOfMemory(_FILE_AND_LINE_);
238 SLNet::OP_DELETE(outgoingPacket,_FILE_AND_LINE_);
239 return 0;
240 }
241
242 outgoingPacket->data[0]=(MessageID)ID_DOWNLOAD_PROGRESS;
243 unsigned int totalParts=dataLength/65536;
244 unsigned int partIndex=newWritten/65536;
245 unsigned int oneChunkSize=65536;
246 memcpy(outgoingPacket->data+sizeof(MessageID), &partIndex, sizeof(unsigned int));
247 memcpy(outgoingPacket->data+sizeof(MessageID)+sizeof(unsigned int)*1, &totalParts, sizeof(unsigned int));
248 memcpy(outgoingPacket->data+sizeof(MessageID)+sizeof(unsigned int)*2, &oneChunkSize, sizeof(unsigned int));
249 bq->IncrementReadOffset(sizeof(PTCPHeader));
250 bq->ReadBytes((char*) outgoingPacket->data+sizeof(MessageID)+sizeof(unsigned int)*3,oneChunkSize,true);
251 bq->DecrementReadOffset(sizeof(PTCPHeader));
252
253 waitingPackets.Push(outgoingPacket, _FILE_AND_LINE_ );
254 }
255 }
256
257 }
258
259 DeallocatePacket(incomingPacket);
260 incomingPacket=0;
261 }
262 else
263 waitingPackets.Push(incomingPacket, _FILE_AND_LINE_ );
264
265 incomingPacket = TCPInterface::ReceiveInt();
266 }
267
268 return ReturnOutgoingPacket();
269 }
270 Packet *PacketizedTCP::ReturnOutgoingPacket(void)
271 {
272 Packet *outgoingPacket=0;
273 unsigned int i;
274 while (outgoingPacket==0 && waitingPackets.IsEmpty()==false)
275 {
276 outgoingPacket=waitingPackets.Pop();
277 PluginReceiveResult pluginResult;
278 for (i=0; i < messageHandlerList.Size(); i++)
279 {
280 pluginResult=messageHandlerList[i]->OnReceive(outgoingPacket);
281 if (pluginResult==RR_STOP_PROCESSING_AND_DEALLOCATE)
282 {
283 DeallocatePacket( outgoingPacket );
284 outgoingPacket=0; // Will do the loop again and get another packet
285 break; // break out of the enclosing for
286 }
287 else if (pluginResult==RR_STOP_PROCESSING)
288 {
289 outgoingPacket=0;
290 break;
291 }
292 }
293 }
294
295 return outgoingPacket;
296 }
297 void PacketizedTCP::CloseConnection( SystemAddress systemAddress )
298 {
299 RemoveFromConnectionList(systemAddress);
300 TCPInterface::CloseConnection(systemAddress);
301 }
302 void PacketizedTCP::RemoveFromConnectionList(const SystemAddress &sa)
303 {
304 if (sa==UNASSIGNED_SYSTEM_ADDRESS)
305 return;
306 if (connections.Has(sa))
307 {
308 unsigned int index = connections.GetIndexAtKey(sa);
309 if (index!=(unsigned int)-1)
310 {
311 SLNet::OP_DELETE(connections[index],_FILE_AND_LINE_);
312 connections.RemoveAtIndex(index);
313 }
314 }
315 }
316 void PacketizedTCP::AddToConnectionList(const SystemAddress &sa)
317 {
318 if (sa==UNASSIGNED_SYSTEM_ADDRESS)
319 return;
320 connections.SetNew(sa, SLNet::OP_NEW<DataStructures::ByteQueue>(_FILE_AND_LINE_));
321 }
322 void PacketizedTCP::ClearAllConnections(void)
323 {
324 unsigned int i;
325 for (i=0; i < connections.Size(); i++)
326 SLNet::OP_DELETE(connections[i],_FILE_AND_LINE_);
327 connections.Clear();
328 }
329 SystemAddress PacketizedTCP::HasCompletedConnectionAttempt(void)
330 {
331 PushNotificationsToQueues();
332
333 if (_completedConnectionAttempts.IsEmpty()==false)
334 return _completedConnectionAttempts.Pop();
335 return UNASSIGNED_SYSTEM_ADDRESS;
336 }
337 SystemAddress PacketizedTCP::HasFailedConnectionAttempt(void)
338 {
339 PushNotificationsToQueues();
340
341 if (_failedConnectionAttempts.IsEmpty()==false)
342 return _failedConnectionAttempts.Pop();
343 return UNASSIGNED_SYSTEM_ADDRESS;
344 }
345 SystemAddress PacketizedTCP::HasNewIncomingConnection(void)
346 {
347 PushNotificationsToQueues();
348
349 if (_newIncomingConnections.IsEmpty()==false)
350 return _newIncomingConnections.Pop();
351 return UNASSIGNED_SYSTEM_ADDRESS;
352 }
353 SystemAddress PacketizedTCP::HasLostConnection(void)
354 {
355 PushNotificationsToQueues();
356
357 if (_lostConnections.IsEmpty()==false)
358 return _lostConnections.Pop();
359 return UNASSIGNED_SYSTEM_ADDRESS;
360 }
361
362 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DynDNS.cpp Source File

  • src
DynDNS.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_DynDNS==1 && _RAKNET_SUPPORT_TCPInterface==1
18
19 #include "slikenet/TCPInterface.h"
20 #include "slikenet/socket2.h"
21 #include "slikenet/DynDNS.h"
22 #include "slikenet/GetTime.h"
23 #include "slikenet/Base64Encoder.h"
24
25 using namespace SLNet;
26
27 struct DynDnsResult
28 {
29 const char *description;
30 const char *code;
31 DynDnsResultCode resultCode;
32 };
33
34 DynDnsResult resultTable[13] =
35 {
36 // See http://www.dyndns.com/developers/specs/flow.pdf
37 {"DNS update success.\nPlease wait up to 60 seconds for the change to take effect.\n", "good", RC_SUCCESS}, // Even with success, it takes time for the cache to update!
38 {"No change", "nochg", RC_NO_CHANGE},
39 {"Host has been blocked. You will need to contact DynDNS to reenable.", "abuse", RC_ABUSE},
40 {"Useragent is blocked", "badagent", RC_BAD_AGENT},
41 {"Username/password pair bad", "badauth", RC_BAD_AUTH},
42 {"Bad system parameter", "badsys", RC_BAD_SYS},
43 {"DNS inconsistency", "dnserr", RC_DNS_ERROR},
44 {"Paid account feature", "!donator", RC_NOT_DONATOR},
45 {"No such host in system", "nohost", RC_NO_HOST},
46 {"Invalid hostname format", "notfqdn", RC_NOT_FQDN},
47 {"Serious error", "numhost", RC_NUM_HOST},
48 {"This host exists, but does not belong to you", "!yours", RC_NOT_YOURS},
49 {"911", "911", RC_911}
50 };
51 DynDNS::DynDNS()
52 {
53 connectPhase=CP_IDLE;
54 tcp=0;
55 }
56 DynDNS::~DynDNS()
57 {
58 if (tcp)
59 SLNet::OP_DELETE(tcp, _FILE_AND_LINE_);
60 }
61 void DynDNS::Stop(void)
62 {
63 tcp->Stop();
64 connectPhase = CP_IDLE;
65 SLNet::OP_DELETE(tcp, _FILE_AND_LINE_);
66 tcp=0;
67 }
68
69
70 // newIPAddress is optional - if left out, DynDNS will use whatever it receives
71 void DynDNS::UpdateHostIPAsynch(const char *dnsHost, const char *newIPAddress, const char *usernameAndPassword )
72 {
73 myIPStr[0]=0;
74
75 if (tcp==0)
76 tcp = SLNet::OP_NEW<TCPInterface>(_FILE_AND_LINE_);
77 connectPhase = CP_IDLE;
78 host = dnsHost;
79
80 if (tcp->Start(0, 1)==false)
81 {
82 SetCompleted(RC_TCP_FAILED_TO_START, "TCP failed to start");
83 return;
84 }
85
86 connectPhase = CP_CONNECTING_TO_CHECKIP;
87 tcp->Connect("checkip.dyndns.org", 80, false);
88
89 // See https://www.dyndns.com/developers/specs/syntax.html
90 getString="GET /nic/update?hostname=";
91 getString+=dnsHost;
92 if (newIPAddress)
93 {
94 getString+="&myip=";
95 getString+=newIPAddress;
96 }
97 getString+="&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG HTTP/1.0\n";
98 getString+="Host: members.dyndns.org\n";
99 getString+="Authorization: Basic ";
100 char outputData[512];
101 Base64Encoding((const unsigned char*) usernameAndPassword, (int) strlen(usernameAndPassword), outputData);
102 getString+=outputData;
103 getString+="User-Agent: Jenkins Software LLC - PC - 1.0\n\n";
104 }
105 void DynDNS::Update(void)
106 {
107 if (connectPhase==CP_IDLE)
108 return;
109
110 serverAddress=tcp->HasFailedConnectionAttempt();
111 if (serverAddress!=UNASSIGNED_SYSTEM_ADDRESS)
112 {
113 SetCompleted(RC_TCP_DID_NOT_CONNECT, "Could not connect to DynDNS");
114 return;
115 }
116
117 serverAddress=tcp->HasCompletedConnectionAttempt();
118 if (serverAddress!=UNASSIGNED_SYSTEM_ADDRESS)
119 {
120 if (connectPhase == CP_CONNECTING_TO_CHECKIP)
121 {
122 checkIpAddress=serverAddress;
123 connectPhase = CP_WAITING_FOR_CHECKIP_RESPONSE;
124 tcp->Send("GET\n\n", (unsigned int) strlen("GET\n\n"), serverAddress, false); // Needs 2 newlines! This is not documented and wasted a lot of my time
125 }
126 else
127 {
128 connectPhase = CP_WAITING_FOR_DYNDNS_RESPONSE;
129 tcp->Send(getString.C_String(), (unsigned int) getString.GetLength(), serverAddress, false);
130 }
131 phaseTimeout= SLNet::GetTime()+1000;
132 }
133
134 if (connectPhase==CP_WAITING_FOR_CHECKIP_RESPONSE && SLNet::GetTime()>phaseTimeout)
135 {
136 connectPhase = CP_CONNECTING_TO_DYNDNS;
137 tcp->CloseConnection(checkIpAddress);
138 tcp->Connect("members.dyndns.org", 80, false);
139 }
140 else if (connectPhase==CP_WAITING_FOR_DYNDNS_RESPONSE && SLNet::GetTime()>phaseTimeout)
141 {
142 SetCompleted(RC_DYNDNS_TIMEOUT, "DynDNS did not respond");
143 return;
144 }
145
146 Packet *packet = tcp->Receive();
147 if (packet)
148 {
149 if (connectPhase==CP_WAITING_FOR_DYNDNS_RESPONSE)
150 {
151 unsigned int i;
152
153 char *curResult;
154 curResult=strstr((char*) packet->data, "Connection: close");
155 if (curResult!=0)
156 {
157 curResult+=strlen("Connection: close");
158 while (*curResult && ((*curResult=='\r') || (*curResult=='\n') || (*curResult==' ')) )
159 curResult++;
160 for (i=0; i < 13; i++)
161 {
162 if (strncmp(resultTable[i].code, curResult, strlen(resultTable[i].code))==0)
163 {
164 if (resultTable[i].resultCode==RC_SUCCESS)
165 {
166 // Read my external IP into myIPStr
167 // Advance until we hit a number
168 while (*curResult && ((*curResult<'0') || (*curResult>'9')) )
169 curResult++;
170 if (*curResult)
171 {
172 SystemAddress parser;
173 parser.FromString(curResult);
174 parser.ToString(false, myIPStr, static_cast<size_t>(32));
175 }
176 }
177 tcp->DeallocatePacket(packet);
178 SetCompleted(resultTable[i].resultCode, resultTable[i].description);
179 break;
180 }
181 }
182 if (i==13)
183 {
184 tcp->DeallocatePacket(packet);
185 SetCompleted(RC_UNKNOWN_RESULT, "DynDNS returned unknown result");
186 }
187 }
188 else
189 {
190 tcp->DeallocatePacket(packet);
191 SetCompleted(RC_PARSING_FAILURE, "Parsing failure on returned string from DynDNS");
192 }
193
194 return;
195 }
196 else
197 {
198 /*
199 HTTP/1.1 200 OK
200 Content-Type: text/html
201 Server: DynDNS-CheckIP/1.0
202 Connection: close
203 Cache-Control: no-cache
204 Pragma: no-cache
205 Content-Length: 105
206
207 <html><head><title>Current IP Check</title></head><body>Current IP Address: 98.1
208 89.219.22</body></html>
209
210
211 Connection to host lost.
212 */
213
214 char *curResult;
215 curResult=strstr((char*) packet->data, "Current IP Address: ");
216 if (curResult!=0)
217 {
218 curResult+=strlen("Current IP Address: ");
219 SystemAddress myIp;
220 myIp.FromString(curResult);
221 myIp.ToString(false, myIPStr, static_cast<size_t>(32));
222
223 char existingHost[65];
224 existingHost[0]=0;
225 // Resolve DNS we are setting. If equal to current then abort
226 RakNetSocket2::DomainNameToIP(host.C_String(), existingHost);
227 if (strcmp(existingHost, myIPStr)==0)
228 {
229 // DynDNS considers setting the IP to what it is already set abuse
230 tcp->DeallocatePacket(packet);
231 SetCompleted(RC_DNS_ALREADY_SET, "No action needed");
232 return;
233 }
234 }
235
236 tcp->DeallocatePacket(packet);
237 tcp->CloseConnection(packet->systemAddress);
238
239 connectPhase = CP_CONNECTING_TO_DYNDNS;
240 tcp->Connect("members.dyndns.org", 80, false);
241 }
242 }
243
244 if (tcp->HasLostConnection()!=UNASSIGNED_SYSTEM_ADDRESS)
245 {
246 if (connectPhase==CP_WAITING_FOR_DYNDNS_RESPONSE)
247 {
248 SetCompleted(RC_CONNECTION_LOST_WITHOUT_RESPONSE, "Connection lost to DynDNS during GET operation");
249 }
250 }
251 }
252
253
254 #endif // _RAKNET_SUPPORT_DynDNS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_PS3_PS4.cpp Source File

  • src
RakNetSocket2_PS3_PS4.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_PS3_PS4_CPP
21 #define RAKNETSOCKET2_PS3_PS4_CPP
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131 #endif // file header
132
133 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NativeFeatureIncludesOverrides.h Source File

  • include
  • slikenet
NativeFeatureIncludesOverrides.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 // USER EDITABLE FILE
12 // See NativeFeatureIncludes.h
13
14 #ifndef __NATIVE_FEATURE_INCLDUES_OVERRIDES_H
15 #define __NATIVE_FEATURE_INCLDUES_OVERRIDES_H
16
17 //#define LIBCAT_SECURITY 1
18
19 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/RelayPlugin.h Source File

  • include
  • slikenet
RelayPlugin.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_RelayPlugin==1
23
24 #ifndef __RELAY_PLUGIN_H
25 #define __RELAY_PLUGIN_H
26
27 #include "PluginInterface2.h"
28 #include "string.h"
29 #include "DS_Hash.h"
30
34
35 namespace SLNet
36 {
37
39 class RakPeerInterface;
40
41 enum RelayPluginEnums
42 {
43 // Server handled messages
44 RPE_MESSAGE_TO_SERVER_FROM_CLIENT,
45 RPE_ADD_CLIENT_REQUEST_FROM_CLIENT,
46 RPE_REMOVE_CLIENT_REQUEST_FROM_CLIENT,
47 RPE_GROUP_MESSAGE_FROM_CLIENT,
48 RPE_JOIN_GROUP_REQUEST_FROM_CLIENT,
49 RPE_LEAVE_GROUP_REQUEST_FROM_CLIENT,
50 RPE_GET_GROUP_LIST_REQUEST_FROM_CLIENT,
51 // Client handled messages
52 RPE_MESSAGE_TO_CLIENT_FROM_SERVER,
53 RPE_ADD_CLIENT_NOT_ALLOWED,
54 RPE_ADD_CLIENT_TARGET_NOT_CONNECTED,
55 RPE_ADD_CLIENT_NAME_ALREADY_IN_USE,
56 RPE_ADD_CLIENT_SUCCESS,
57 RPE_USER_ENTERED_ROOM,
58 RPE_USER_LEFT_ROOM,
59 RPE_GROUP_MSG_FROM_SERVER,
60 RPE_GET_GROUP_LIST_REPLY_FROM_SERVER,
61 RPE_JOIN_GROUP_SUCCESS,
62 RPE_JOIN_GROUP_FAILURE,
63 };
64
67 class RAK_DLL_EXPORT RelayPlugin : public PluginInterface2
68 {
69 public:
70 // GetInstance() and DestroyInstance(instance*)
71 STATIC_FACTORY_DECLARATIONS(RelayPlugin)
72
73
74 RelayPlugin();
75
77 virtual ~RelayPlugin();
78
83 RelayPluginEnums AddParticipantOnServer(const RakString &key, const RakNetGUID &guid);
84
86 void RemoveParticipantOnServer(const RakNetGUID &guid);
87
91 void SetAcceptAddParticipantRequests(bool accept);
92
97 void AddParticipantRequestFromClient(const RakString &key, const RakNetGUID &relayPluginServerGuid);
98
100 void RemoveParticipantRequestFromClient(const RakNetGUID &relayPluginServerGuid);
101
109 void SendToParticipant(const RakNetGUID &relayPluginServerGuid, const RakString &destinationGuid, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel);
110
111 void SendGroupMessage(const RakNetGUID &relayPluginServerGuid, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel);
112 void JoinGroupRequest(const RakNetGUID &relayPluginServerGuid, RakString groupName);
113 void LeaveGroup(const RakNetGUID &relayPluginServerGuid);
114 void GetGroupList(const RakNetGUID &relayPluginServerGuid);
115
117 virtual PluginReceiveResult OnReceive(Packet *packet);
119 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
120
121 struct StrAndGuidAndRoom
122 {
123 RakString str;
124 RakNetGUID guid;
125 RakString currentRoom;
126 };
127
128 struct StrAndGuid
129 {
130 RakString str;
131 RakNetGUID guid;
132 };
133
134 struct RP_Group
135 {
136 RakString roomName;
137 DataStructures::List<StrAndGuid> usersInRoom;
138 };
139
140 protected:
141
142 RelayPlugin::RP_Group* JoinGroup(RakNetGUID userGuid, RakString roomName);
143 RelayPlugin::RP_Group* JoinGroup(RP_Group* room, StrAndGuidAndRoom **strAndGuidSender);
144 void LeaveGroup(StrAndGuidAndRoom **strAndGuidSender);
145 void NotifyUsersInRoom(RP_Group *room, int msg, const RakString& message);
146 void SendMessageToRoom(StrAndGuidAndRoom **strAndGuidSender, BitStream* message);
147 void SendChatRoomsList(RakNetGUID target);
148 void OnGroupMessageFromClient(Packet *packet);
149 void OnJoinGroupRequestFromClient(Packet *packet);
150 void OnLeaveGroupRequestFromClient(Packet *packet);
151
152 DataStructures::Hash<RakString, StrAndGuidAndRoom*, 8096, SLNet::RakString::ToInteger> strToGuidHash;
153 DataStructures::Hash<RakNetGUID, StrAndGuidAndRoom*, 8096, SLNet::RakNetGUID::ToUint32> guidToStrHash;
154 DataStructures::List<RP_Group*> chatRooms;
155 bool acceptAddParticipantRequests;
156
157 };
158
159 } // End namespace
160
161 #endif
162
163 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RNS2_SendParameters
SLNet::RNS2_SendParameters Member List

This is the complete list of members for SLNet::RNS2_SendParameters, including all inherited members.

data | SLNet::RNS2_SendParameters |
length | SLNet::RNS2_SendParameters |
RNS2_SendParameters() | SLNet::RNS2_SendParameters | inline
systemAddress | SLNet::RNS2_SendParameters |
ttl | SLNet::RNS2_SendParameters |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FullyConnectedMesh2.h Source File

  • include
  • slikenet
FullyConnectedMesh2.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #include "NativeFeatureIncludes.h"
23 #if _RAKNET_SUPPORT_FullyConnectedMesh2==1
24
25 #ifndef __FULLY_CONNECTED_MESH_2_H
26 #define __FULLY_CONNECTED_MESH_2_H
27
28 #include "PluginInterface2.h"
29 #include "memoryoverride.h"
30 #include "NativeTypes.h"
31 #include "DS_List.h"
32 #include "string.h"
33 #include "BitStream.h"
34
35 typedef int64_t FCM2Guid;
36
37 namespace SLNet
38 {
40 class RakPeerInterface;
41
47 class RAK_DLL_EXPORT FullyConnectedMesh2 : public PluginInterface2
48 {
49 public:
50 // GetInstance() and DestroyInstance(instance*)
51 STATIC_FACTORY_DECLARATIONS(FullyConnectedMesh2)
52
53 FullyConnectedMesh2();
54 virtual ~FullyConnectedMesh2();
55
61 void SetConnectOnNewRemoteConnection(bool attemptConnection, SLNet::RakString pw);
62
69 RakNetGUID GetConnectedHost(void) const;
70 SystemAddress GetConnectedHostAddr(void) const;
71
73 RakNetGUID GetHostSystem(void) const;
74
76 bool IsHostSystem(void) const;
77
80 void GetHostOrder(DataStructures::List<RakNetGUID> &hostList);
81
84 bool IsConnectedHost(void) const;
85
90 void SetAutoparticipateConnections(bool b);
91
94 void ResetHostCalculation(void);
95
102 void AddParticipant(RakNetGUID rakNetGuid);
103
106 void GetParticipantList(DataStructures::List<RakNetGUID> &participantList);
107
111 bool HasParticipant(RakNetGUID participantGuid);
112
117 // bool GetParticipantContext(RakNetGUID participantGuid, BitStream *userContext);
118
121 // void SetMyContext(BitStream *userContext);
122
128 void ConnectToRemoteNewIncomingConnections(Packet *packet);
129
131 void Clear(void);
132
133 unsigned int GetParticipantCount(void) const;
134 void GetParticipantCount(unsigned int *participantListSize) const;
135
160 virtual void StartVerifiedJoin(RakNetGUID client);
161
170 virtual void RespondOnVerifiedJoinCapable(Packet *packet, bool accept, BitStream *additionalData);
171
184 virtual void GetVerifiedJoinRequiredProcessingList(RakNetGUID host,
185 DataStructures::List<SystemAddress> &addresses,
186 DataStructures::List<RakNetGUID> &guids,
187 DataStructures::List<BitStream*> &userData);
188
200 virtual void GetVerifiedJoinAcceptedAdditionalData(Packet *packet, bool *thisSystemAccepted, DataStructures::List<RakNetGUID> &systemsAccepted, BitStream *additionalData);
201
209 virtual void GetVerifiedJoinRejectedAdditionalData(Packet *packet, BitStream *additionalData);
210
212 virtual void WriteVJCUserData(SLNet::BitStream *bsOut) {(void) bsOut;}
213
219 static void SkipToVJCUserData(SLNet::BitStream *bsIn);
220
225 //virtual void WriteVJSUserData(SLNet::BitStream *bsOut, RakNetGUID userGuid, BitStream *userContext) {(void) bsOut; (void) userGuid; (void) userContext;}
226 virtual void WriteVJSUserData(SLNet::BitStream *bsOut, RakNetGUID userGuid) {(void) bsOut; (void) userGuid;}
227
229 SLNet::TimeUS GetElapsedRuntime(void);
230
232 virtual PluginReceiveResult OnReceive(Packet *packet);
234 virtual void OnRakPeerStartup(void);
236 virtual void OnAttach(void);
238 virtual void OnRakPeerShutdown(void);
240 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
242 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
244 virtual void OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason);
245
247 struct FCM2Participant
248 {
249 FCM2Participant() {}
250 FCM2Participant(const FCM2Guid &_fcm2Guid, const RakNetGUID &_rakNetGuid) : fcm2Guid(_fcm2Guid), rakNetGuid(_rakNetGuid) {}
251
252 // Low half is a random number.
253 // High half is the order we connected in (totalConnectionCount)
254 FCM2Guid fcm2Guid;
255 RakNetGUID rakNetGuid;
256 // BitStream userContext;
257 };
258
259 enum JoinInProgressState
260 {
261 JIPS_PROCESSING,
262 JIPS_FAILED,
263 JIPS_CONNECTED,
264 JIPS_UNNECESSARY,
265 };
266
267 struct VerifiedJoinInProgressMember
268 {
269 SystemAddress systemAddress;
270 RakNetGUID guid;
271 JoinInProgressState joinInProgressState;
272 BitStream *userData;
273
274 bool workingFlag;
275 };
276
278 struct VerifiedJoinInProgress
279 {
280 RakNetGUID requester;
281 DataStructures::List<VerifiedJoinInProgressMember> vjipMembers;
282 //bool sentResults;
283 };
284
286 unsigned int GetTotalConnectionCount(void) const;
287
288 protected:
289 void PushNewHost(const RakNetGUID &guid, RakNetGUID oldHost);
290 void SendOurFCMGuid(SystemAddress addr);
291 void SendFCMGuidRequest(RakNetGUID rakNetGuid);
292 void SendConnectionCountResponse(SystemAddress addr, unsigned int responseTotalConnectionCount);
293 void OnRequestFCMGuid(Packet *packet);
294 //void OnUpdateUserContext(Packet *packet);
295 void OnRespondConnectionCount(Packet *packet);
296 void OnInformFCMGuid(Packet *packet);
297 void OnUpdateMinTotalConnectionCount(Packet *packet);
298 void AssignOurFCMGuid(void);
299 void CalculateHost(RakNetGUID *rakNetGuid, FCM2Guid *fcm2Guid);
300 // bool AddParticipantInternal( RakNetGUID rakNetGuid, FCM2Guid theirFCMGuid, BitStream *userContext );
301 bool AddParticipantInternal( RakNetGUID rakNetGuid, FCM2Guid theirFCMGuid );
302 void CalculateAndPushHost(void);
303 bool ParticipantListComplete(void);
304 void IncrementTotalConnectionCount(unsigned int i);
305 PluginReceiveResult OnVerifiedJoinStart(Packet *packet);
306 PluginReceiveResult OnVerifiedJoinCapable(Packet *packet);
307 virtual void OnVerifiedJoinFailed(RakNetGUID hostGuid, bool callCloseConnection);
308 virtual void OnVerifiedJoinAccepted(Packet *packet);
309 virtual void OnVerifiedJoinRejected(Packet *packet);
310 unsigned int GetJoinsInProgressIndex(RakNetGUID requester) const;
311 void UpdateVerifiedJoinInProgressMember(const AddressOrGUID systemIdentifier, RakNetGUID guidToAssign, JoinInProgressState newState);
312 bool ProcessVerifiedJoinInProgressIfCompleted(VerifiedJoinInProgress *vjip);
313 void ReadVerifiedJoinInProgressMember(SLNet::BitStream *bsIn, VerifiedJoinInProgressMember *vjipm);
314 unsigned int GetVerifiedJoinInProgressMemberIndex(const AddressOrGUID systemIdentifier, VerifiedJoinInProgress *vjip);
315 void DecomposeJoinCapable(Packet *packet, VerifiedJoinInProgress *vjip);
316 void WriteVerifiedJoinCapable(SLNet::BitStream *bsOut, VerifiedJoinInProgress *vjip);
317 void CategorizeVJIP(VerifiedJoinInProgress *vjip,
318 DataStructures::List<RakNetGUID> &participatingMembersOnClientSucceeded,
319 DataStructures::List<RakNetGUID> &participatingMembersOnClientFailed,
320 DataStructures::List<RakNetGUID> &participatingMembersNotOnClient,
321 DataStructures::List<RakNetGUID> &clientMembersNotParticipatingSucceeded,
322 DataStructures::List<RakNetGUID> &clientMembersNotParticipatingFailed);
323
324 // Used to track how long RakNet has been running. This is so we know who has been running longest
325 SLNet::TimeUS startupTime;
326
327 // Option for SetAutoparticipateConnections
328 bool autoParticipateConnections;
329
330 // totalConnectionCount is roughly maintained across all systems, and increments by 1 each time a new system connects to the mesh
331 // It is always kept at the highest known value
332 // It is used as the high 4 bytes for new FCMGuids. This causes newer values of FCM2Guid to be higher than lower values. The lowest value is the host.
333 unsigned int totalConnectionCount;
334
335 // Our own ourFCMGuid. Starts at unassigned (0). Assigned once we send ID_FCM2_REQUEST_FCMGUID and get back ID_FCM2_RESPOND_CONNECTION_COUNT
336 FCM2Guid ourFCMGuid;
337
339 DataStructures::List<FCM2Participant*> fcm2ParticipantList;
340
341 RakNetGUID lastPushedHost;
342
343 // Optimization: Store last calculated host in these variables.
344 RakNetGUID hostRakNetGuid;
345 FCM2Guid hostFCM2Guid;
346
347 SLNet::RakString connectionPassword;
348 bool connectOnNewRemoteConnections;
349
350 DataStructures::List<VerifiedJoinInProgress*> joinsInProgress;
351 BitStream myContext;
352 };
353
354 } // namespace SLNet
355
356 /*
357 Startup()
358 ourFCMGuid=unknown
359 totalConnectionCount=0
360 Set startupTime
361
362 AddParticipant()
363 if (sender by guid is a participant)
364 return;
365 AddParticipantInternal(guid);
366 if (ourFCMGuid==unknown)
367 Send to that system a request for their fcmGuid, totalConnectionCount. Inform startupTime.
368 else
369 Send to that system a request for their fcmGuid. Inform total connection count, our fcmGuid
370
371 OnRequestGuid()
372 if (sender by guid is not a participant)
373 {
374 // They added us as a participant, but we didn't add them. This can be caused by lag where both participants are not added at the same time.
375 // It doesn't affect the outcome as long as we still process the data
376 AddParticipantInternal(guid);
377 }
378 if (ourFCMGuid==unknown)
379 {
380 if (includedStartupTime)
381 {
382 // Nobody has a fcmGuid
383
384 if (their startup time is greater than our startup time)
385 ReplyConnectionCount(1);
386 else
387 ReplyConnectionCount(2);
388 }
389 else
390 {
391 // They have a fcmGuid, we do not
392
393 SetMaxTotalConnectionCount(remoteCount);
394 AssignTheirGuid()
395 GenerateOurGuid();
396 SendOurGuid(all);
397 }
398 }
399 else
400 {
401 if (includedStartupTime)
402 {
403 // We have a fcmGuid they do not
404
405 ReplyConnectionCount(totalConnectionCount+1);
406 SendOurGuid(sender);
407 }
408 else
409 {
410 // We both have fcmGuids
411
412 SetMaxTotalConnectionCount(remoteCount);
413 AssignTheirGuid();
414 SendOurGuid(sender);
415 }
416 }
417
418 OnReplyConnectionCount()
419 SetMaxTotalConnectionCount(remoteCount);
420 GenerateOurGuid();
421 SendOurGuid(allParticipants);
422
423 OnReceiveTheirGuid()
424 AssignTheirGuid()
425 */
426
427 #endif
428
429 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileList.h Source File

  • include
  • slikenet
FileList.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_FileOperations==1
22
23 #ifndef __FILE_LIST
24 #define __FILE_LIST
25
26 #include "Export.h"
27 #include "DS_List.h"
28 #include "memoryoverride.h"
29 #include "types.h"
30 #include "FileListNodeContext.h"
31 #include "string.h"
32
33 namespace SLNet
34 {
35 class BitStream;
36 }
37
38 namespace SLNet
39 {
41 class RakPeerInterface;
42 class FileList;
43
44
46 struct FileListNode
47 {
49 SLNet::RakString filename;
50
52 SLNet::RakString fullPathToFile;
53
55 char *data;
56
58 BitSize_t dataLengthBytes;
59
61 unsigned fileLengthBytes;
62
64 FileListNodeContext context;
65
67 bool isAReference;
68 };
69
71 class RAK_DLL_EXPORT FileListProgress
72 {
73 public:
74 // GetInstance() and DestroyInstance(instance*)
75 STATIC_FACTORY_DECLARATIONS(FileListProgress)
76
77 FileListProgress() {}
78 virtual ~FileListProgress() {}
79
81 virtual void OnAddFilesFromDirectoryStarted(FileList *fileList, char *dir) {
82 (void) fileList;
83 (void) dir;
84 }
85
87 virtual void OnDirectory(FileList *fileList, char *dir, unsigned int directoriesRemaining) {
88 (void) fileList;
89 (void) dir;
90 (void) directoriesRemaining;
91 }
92
94 virtual void OnFile(FileList *fileList, char *dir, char *fileName, unsigned int fileSize) {
95 (void) fileList;
96 (void) dir;
97 (void) fileName;
98 (void) fileSize;
99 }
100
108 virtual void OnFilePush(const char *fileName, unsigned int fileLengthBytes, unsigned int offset, unsigned int bytesBeingSent, bool done, SystemAddress targetSystem, unsigned short setId)
109 {
110 (void) fileName;
111 (void) fileLengthBytes;
112 (void) offset;
113 (void) bytesBeingSent;
114 (void) done;
115 (void) targetSystem;
116 (void) setId;
117 }
118
120 virtual void OnFilePushesComplete( SystemAddress systemAddress, unsigned short setId )
121 {
122 (void) systemAddress;
123 (void) setId;
124 }
125
127 virtual void OnSendAborted( SystemAddress systemAddress )
128 {
129 (void) systemAddress;
130 }
131 };
132
134 class RAK_DLL_EXPORT FLP_Printf : public FileListProgress
135 {
136 public:
137 // GetInstance() and DestroyInstance(instance*)
138 STATIC_FACTORY_DECLARATIONS(FLP_Printf)
139
140 FLP_Printf() {}
141 virtual ~FLP_Printf() {}
142
144 virtual void OnAddFilesFromDirectoryStarted(FileList *fileList, char *dir);
145
147 virtual void OnDirectory(FileList *fileList, char *dir, unsigned int directoriesRemaining);
148
150 virtual void OnFilePushesComplete( SystemAddress systemAddress, unsigned short setID );
151
153 virtual void OnSendAborted( SystemAddress systemAddress );
154 };
155
156 class RAK_DLL_EXPORT FileList
157 {
158 public:
159 // GetInstance() and DestroyInstance(instance*)
160 STATIC_FACTORY_DECLARATIONS(FileList)
161
162 FileList();
163 ~FileList();
171 void AddFilesFromDirectory(const char *applicationDirectory, const char *subDirectory, bool writeHash, bool writeData, bool recursive, FileListNodeContext context);
172
174 void Clear(void);
175
177 void Serialize(SLNet::BitStream *outBitStream);
178
180 bool Deserialize(SLNet::BitStream *inBitStream);
181
189 void ListMissingOrChangedFiles(const char *applicationDirectory, FileList *missingOrChangedFiles, bool alwaysWriteHash, bool neverWriteHash);
190
198 void GetDeltaToCurrent(FileList *input, FileList *output, const char *dirSubset, const char *remoteSubdir);
199
205 void PopulateDataFromDisk(const char *applicationDirectory, bool writeFileData, bool writeFileHash, bool removeUnknownFiles);
206
209 void FlagFilesAsReferences(void);
210
213 void WriteDataToDisk(const char *applicationDirectory);
214
224 void AddFile(const char *filename, const char *fullPathToFile, const char *data, const unsigned dataLength, const unsigned fileLength, FileListNodeContext context, bool isAReference=false, bool takeDataPointer=false);
225
230 void AddFile(const char *filepath, const char *filename, FileListNodeContext context);
231
234 void DeleteFiles(const char *applicationDirectory);
235
238 void AddCallback(FileListProgress *cb);
239
242 void RemoveCallback(FileListProgress *cb);
243
245 void ClearCallbacks(void);
246
249 void GetCallbacks(DataStructures::List<FileListProgress*> &callbacks);
250
251 // Here so you can read it, but don't modify it
252 DataStructures::List<FileListNode> fileList;
253
254 static bool FixEndingSlash(char *str);
255 static bool FixEndingSlash(char *str, size_t strLength);
256 protected:
257 DataStructures::List<FileListProgress*> fileListProgressCallbacks;
258 };
259
260 } // namespace SLNet
261
262 #endif
263
264 #endif // _RAKNET_SUPPORT_FileOperations
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SingleProducerConsumer.h Source File

  • include
  • slikenet
SingleProducerConsumer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __SINGLE_PRODUCER_CONSUMER_H
23 #define __SINGLE_PRODUCER_CONSUMER_H
24
25 #include "assert.h"
26
27 static const int MINIMUM_LIST_SIZE=8;
28
29 #include "memoryoverride.h"
30 #include "Export.h"
31
34 namespace DataStructures
35 {
37 template <class SingleProducerConsumerType>
38 class RAK_DLL_EXPORT SingleProducerConsumer
39 {
40 public:
41 // Constructor
42 SingleProducerConsumer();
43
44 // Destructor
45 ~SingleProducerConsumer();
46
49 SingleProducerConsumerType* WriteLock(void);
50
54 void CancelWriteLock(SingleProducerConsumerType* cancelToLocation);
55
57 void WriteUnlock(void);
58
62 SingleProducerConsumerType* ReadLock(void);
63
64 // Cancelling locks cancels all locks back up to the data passed. So if you lock twice and cancel using the first lock, the second lock is ignored
66 void CancelReadLock(SingleProducerConsumerType* cancelToLocation);
67
70 void ReadUnlock(void);
71
73 void Clear(void);
74
77 int Size(void) const;
78
81 bool CheckReadUnlockOrder(const SingleProducerConsumerType* data) const;
82
85 bool ReadIsLocked(void) const;
86
87 private:
88 struct DataPlusPtr
89 {
90 DataPlusPtr () {readyToRead=false;}
91 SingleProducerConsumerType object;
92
93 // Ready to read is so we can use an equality boolean comparison, in case the writePointer var is trashed while context switching.
94 volatile bool readyToRead;
95 volatile DataPlusPtr *next;
96 };
97 volatile DataPlusPtr *readAheadPointer;
98 volatile DataPlusPtr *writeAheadPointer;
99 volatile DataPlusPtr *readPointer;
100 volatile DataPlusPtr *writePointer;
101 unsigned readCount, writeCount;
102 };
103
104 template <class SingleProducerConsumerType>
105 SingleProducerConsumer<SingleProducerConsumerType>::SingleProducerConsumer()
106 {
107 // Preallocate
108 readPointer = SLNet::OP_NEW<DataPlusPtr>( _FILE_AND_LINE_ );
109 writePointer=readPointer;
110 readPointer->next = SLNet::OP_NEW<DataPlusPtr>( _FILE_AND_LINE_ );
111 int listSize;
112 #ifdef _DEBUG
113 RakAssert(MINIMUM_LIST_SIZE>=3);
114 #endif
115 for (listSize=2; listSize < MINIMUM_LIST_SIZE; listSize++)
116 {
117 readPointer=readPointer->next;
118 readPointer->next = SLNet::OP_NEW<DataPlusPtr>( _FILE_AND_LINE_ );
119 }
120 readPointer->next->next=writePointer; // last to next = start
121 readPointer=writePointer;
122 readAheadPointer=readPointer;
123 writeAheadPointer=writePointer;
124 readCount=writeCount=0;
125 }
126
127 template <class SingleProducerConsumerType>
128 SingleProducerConsumer<SingleProducerConsumerType>::~SingleProducerConsumer()
129 {
130 volatile DataPlusPtr *next;
131 readPointer=writeAheadPointer->next;
132 while (readPointer!=writeAheadPointer)
133 {
134 next=readPointer->next;
135 SLNet::OP_DELETE((char*) readPointer, _FILE_AND_LINE_);
136 readPointer=next;
137 }
138 SLNet::OP_DELETE((char*) readPointer, _FILE_AND_LINE_);
139 }
140
141 template <class SingleProducerConsumerType>
142 SingleProducerConsumerType* SingleProducerConsumer<SingleProducerConsumerType>::WriteLock( void )
143 {
144 if (writeAheadPointer->next==readPointer ||
145 writeAheadPointer->next->readyToRead==true)
146 {
147 volatile DataPlusPtr *originalNext=writeAheadPointer->next;
148 writeAheadPointer->next= SLNet::OP_NEW<DataPlusPtr>(_FILE_AND_LINE_);
149 RakAssert(writeAheadPointer->next);
150 writeAheadPointer->next->next=originalNext;
151 }
152
153 volatile DataPlusPtr *last;
154 last=writeAheadPointer;
155 writeAheadPointer=writeAheadPointer->next;
156
157 return (SingleProducerConsumerType*) last;
158 }
159
160 template <class SingleProducerConsumerType>
161 void SingleProducerConsumer<SingleProducerConsumerType>::CancelWriteLock( SingleProducerConsumerType* cancelToLocation )
162 {
163 writeAheadPointer=(DataPlusPtr *)cancelToLocation;
164 }
165
166 template <class SingleProducerConsumerType>
167 void SingleProducerConsumer<SingleProducerConsumerType>::WriteUnlock( void )
168 {
169 // DataPlusPtr *dataContainer = (DataPlusPtr *)structure;
170
171 #ifdef _DEBUG
172 RakAssert(writePointer->next!=readPointer);
173 RakAssert(writePointer!=writeAheadPointer);
174 #endif
175
176 writeCount++;
177 // User is done with the data, allow send by updating the write pointer
178 writePointer->readyToRead=true;
179 writePointer=writePointer->next;
180 }
181
182 template <class SingleProducerConsumerType>
183 SingleProducerConsumerType* SingleProducerConsumer<SingleProducerConsumerType>::ReadLock( void )
184 {
185 if (readAheadPointer==writePointer ||
186 readAheadPointer->readyToRead==false)
187 {
188 return 0;
189 }
190
191 volatile DataPlusPtr *last;
192 last=readAheadPointer;
193 readAheadPointer=readAheadPointer->next;
194 return (SingleProducerConsumerType*)last;
195 }
196
197 template <class SingleProducerConsumerType>
198 void SingleProducerConsumer<SingleProducerConsumerType>::CancelReadLock( SingleProducerConsumerType* cancelToLocation )
199 {
200 #ifdef _DEBUG
201 RakAssert(readPointer!=writePointer);
202 #endif
203 readAheadPointer=(DataPlusPtr *)cancelToLocation;
204 }
205
206 template <class SingleProducerConsumerType>
207 void SingleProducerConsumer<SingleProducerConsumerType>::ReadUnlock( void )
208 {
209 #ifdef _DEBUG
210 RakAssert(readAheadPointer!=readPointer); // If hits, then called ReadUnlock before ReadLock
211 RakAssert(readPointer!=writePointer); // If hits, then called ReadUnlock when Read returns 0
212 #endif
213 readCount++;
214
215 // Allow writes to this memory block
216 readPointer->readyToRead=false;
217 readPointer=readPointer->next;
218 }
219
220 template <class SingleProducerConsumerType>
221 void SingleProducerConsumer<SingleProducerConsumerType>::Clear( void )
222 {
223 // Shrink the list down to MINIMUM_LIST_SIZE elements
224 volatile DataPlusPtr *next;
225 writePointer=readPointer->next;
226
227 int listSize=1;
228 next=readPointer->next;
229 while (next!=readPointer)
230 {
231 listSize++;
232 next=next->next;
233 }
234
235 while (listSize-- > MINIMUM_LIST_SIZE)
236 {
237 next=writePointer->next;
238 #ifdef _DEBUG
239 RakAssert(writePointer!=readPointer);
240 #endif
241 SLNet::OP_DELETE((char*) writePointer, _FILE_AND_LINE_);
242 writePointer=next;
243 }
244
245 readPointer->next=writePointer;
246 writePointer=readPointer;
247 readAheadPointer=readPointer;
248 writeAheadPointer=writePointer;
249 readCount=writeCount=0;
250 }
251
252 template <class SingleProducerConsumerType>
253 int SingleProducerConsumer<SingleProducerConsumerType>::Size( void ) const
254 {
255 return writeCount-readCount;
256 }
257
258 template <class SingleProducerConsumerType>
259 bool SingleProducerConsumer<SingleProducerConsumerType>::CheckReadUnlockOrder(const SingleProducerConsumerType* data) const
260 {
261 return const_cast<const SingleProducerConsumerType *>(&readPointer->object) == data;
262 }
263
264
265 template <class SingleProducerConsumerType>
266 bool SingleProducerConsumer<SingleProducerConsumerType>::ReadIsLocked(void) const
267 {
268 return readAheadPointer!=readPointer;
269 }
270 }
271
272 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakWString.cpp Source File

  • src
RakWString.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/wstring.h"
17 #include "slikenet/BitStream.h"
18 #include <string.h>
19 #include <wchar.h>
20 #include <stdlib.h>
21 #include "slikenet/linux_adapter.h"
22 #include "slikenet/osx_adapter.h"
23
24 using namespace SLNet;
25
26 // From http://www.joelonsoftware.com/articles/Unicode.html
27 // Only code points 128 and above are stored using 2, 3, in fact, up to 6 bytes.
28 #define MAX_BYTES_PER_UNICODE_CHAR sizeof(wchar_t)
29
30 RakWString::RakWString()
31 {
32 c_str=0;
33 c_strCharLength=0;
34 }
35 RakWString::RakWString( const RakString &right )
36 {
37 c_str=0;
38 c_strCharLength=0;
39 *this=right;
40 }
41 RakWString::RakWString( const char *input )
42 {
43 c_str=0;
44 c_strCharLength=0;
45 *this = input;
46 }
47 RakWString::RakWString( const wchar_t *input )
48 {
49 c_str=0;
50 c_strCharLength=0;
51 *this = input;
52 }
53 RakWString::RakWString( const RakWString & right)
54 {
55 c_str=0;
56 c_strCharLength=0;
57 *this = right;
58 }
59 RakWString::~RakWString()
60 {
61 rakFree_Ex(c_str,_FILE_AND_LINE_);
62 }
63 RakWString& RakWString::operator = ( const RakWString& right )
64 {
65 Clear();
66 if (right.IsEmpty())
67 return *this;
68 c_str = (wchar_t *) rakMalloc_Ex( (right.GetLength() + 1) * MAX_BYTES_PER_UNICODE_CHAR, _FILE_AND_LINE_);
69 if (!c_str)
70 {
71 c_strCharLength=0;
72 notifyOutOfMemory(_FILE_AND_LINE_);
73 return *this;
74 }
75 c_strCharLength = right.GetLength();
76 memcpy(c_str,right.C_String(),(right.GetLength() + 1) * MAX_BYTES_PER_UNICODE_CHAR);
77
78 return *this;
79 }
80 RakWString& RakWString::operator = ( const RakString& right )
81 {
82 return *this = right.C_String();
83 }
84 RakWString& RakWString::operator = ( const wchar_t * const str )
85 {
86 Clear();
87 if (str==0)
88 return *this;
89 c_strCharLength = wcslen(str);
90 if (c_strCharLength==0)
91 return *this;
92 c_str = (wchar_t *) rakMalloc_Ex( (c_strCharLength + 1) * MAX_BYTES_PER_UNICODE_CHAR, _FILE_AND_LINE_);
93 if (!c_str)
94 {
95 c_strCharLength=0;
96 notifyOutOfMemory(_FILE_AND_LINE_);
97 return *this;
98 }
99 wcscpy_s(c_str,c_strCharLength+1,str);
100
101 return *this;
102 }
103 RakWString& RakWString::operator = ( wchar_t *str )
104 {
105 *this = ( const wchar_t * const) str;
106 return *this;
107 }
108 RakWString& RakWString::operator = ( const char * const str )
109 {
110 Clear();
111
112 // Not supported on android
113 #if !defined(ANDROID)
114 if (str==0)
115 return *this;
116 if (str[0]==0)
117 return *this;
118
119 mbstowcs_s(&c_strCharLength, NULL, 0, str, 0);
120 c_str = (wchar_t *) rakMalloc_Ex( (c_strCharLength + 1) * MAX_BYTES_PER_UNICODE_CHAR, _FILE_AND_LINE_);
121 if (!c_str)
122 {
123 c_strCharLength=0;
124 notifyOutOfMemory(_FILE_AND_LINE_);
125 return *this;
126 }
127
128 mbstowcs_s(&c_strCharLength, c_str, c_strCharLength + 1, str, c_strCharLength);
129 if (c_strCharLength == (size_t) (-1))
130 {
131 RAKNET_DEBUG_PRINTF("Couldn't convert string--invalid multibyte character.\n");
132 Clear();
133 return *this;
134 }
135 #else
136 // mbstowcs not supported on android
137 RakAssert("mbstowcs not supported on Android" && 0);
138 #endif // defined(ANDROID)
139
140 return *this;
141 }
142 RakWString& RakWString::operator = ( char *str )
143 {
144 *this = ( const char * const) str;
145 return *this;
146 }
147 RakWString& RakWString::operator +=( const RakWString& right)
148 {
149 if (right.IsEmpty())
150 return *this;
151 size_t newCharLength = c_strCharLength + right.GetLength();
152 wchar_t *newCStr;
153 bool isEmpty = IsEmpty();
154 if (isEmpty)
155 newCStr = (wchar_t *) rakMalloc_Ex( (newCharLength + 1) * MAX_BYTES_PER_UNICODE_CHAR, _FILE_AND_LINE_);
156 else
157 newCStr = (wchar_t *) rakRealloc_Ex( c_str, (newCharLength + 1) * MAX_BYTES_PER_UNICODE_CHAR, _FILE_AND_LINE_);
158 if (!newCStr)
159 {
160 notifyOutOfMemory(_FILE_AND_LINE_);
161 return *this;
162 }
163 c_str = newCStr;
164 c_strCharLength = newCharLength;
165 if (isEmpty)
166 {
167 memcpy(newCStr,right.C_String(),(right.GetLength() + 1) * MAX_BYTES_PER_UNICODE_CHAR);
168 }
169 else
170 {
171 wcscat_s(c_str, newCharLength + 1, right.C_String());
172 }
173
174 return *this;
175 }
176 RakWString& RakWString::operator += ( const wchar_t * const right )
177 {
178 if (right==0)
179 return *this;
180 size_t rightLength = wcslen(right);
181 size_t newCharLength = c_strCharLength + rightLength;
182 wchar_t *newCStr;
183 bool isEmpty = IsEmpty();
184 if (isEmpty)
185 newCStr = (wchar_t *) rakMalloc_Ex( (newCharLength + 1) * MAX_BYTES_PER_UNICODE_CHAR, _FILE_AND_LINE_);
186 else
187 newCStr = (wchar_t *) rakRealloc_Ex( c_str, (newCharLength + 1) * MAX_BYTES_PER_UNICODE_CHAR, _FILE_AND_LINE_);
188 if (!newCStr)
189 {
190 notifyOutOfMemory(_FILE_AND_LINE_);
191 return *this;
192 }
193 c_str = newCStr;
194 c_strCharLength = newCharLength;
195 if (isEmpty)
196 {
197 memcpy(newCStr,right,(rightLength + 1) * MAX_BYTES_PER_UNICODE_CHAR);
198 }
199 else
200 {
201 wcscat_s(c_str, newCharLength + 1, right);
202 }
203
204 return *this;
205 }
206 RakWString& RakWString::operator += ( wchar_t *right )
207 {
208 return *this += (const wchar_t * const) right;
209 }
210 bool RakWString::operator==(const RakWString &right) const
211 {
212 if (GetLength()!=right.GetLength())
213 return false;
214 return wcscmp(C_String(),right.C_String())==0;
215 }
216 bool RakWString::operator < ( const RakWString& right ) const
217 {
218 return wcscmp(C_String(),right.C_String())<0;
219 }
220 bool RakWString::operator <= ( const RakWString& right ) const
221 {
222 return wcscmp(C_String(),right.C_String())<=0;
223 }
224 bool RakWString::operator > ( const RakWString& right ) const
225 {
226 return wcscmp(C_String(),right.C_String())>0;
227 }
228 bool RakWString::operator >= ( const RakWString& right ) const
229 {
230 return wcscmp(C_String(),right.C_String())>=0;
231 }
232 bool RakWString::operator!=(const RakWString &right) const
233 {
234 if (GetLength()!=right.GetLength())
235 return true;
236 return wcscmp(C_String(),right.C_String())!=0;
237 }
238 void RakWString::Set( wchar_t *str )
239 {
240 *this = str;
241 }
242 bool RakWString::IsEmpty(void) const
243 {
244 return GetLength()==0;
245 }
246 size_t RakWString::GetLength(void) const
247 {
248 return c_strCharLength;
249 }
250 unsigned long RakWString::ToInteger(const RakWString &rs)
251 {
252 unsigned long hash = 0;
253 int c;
254
255 const char *str = (const char *)rs.C_String();
256 size_t i;
257 for (i=0; i < rs.GetLength()*MAX_BYTES_PER_UNICODE_CHAR*sizeof(wchar_t); i++)
258 {
259 c = *str++;
260 hash = c + (hash << 6) + (hash << 16) - hash;
261 }
262
263 return hash;
264 }
265 int RakWString::StrCmp(const RakWString &right) const
266 {
267 return wcscmp(C_String(), right.C_String());
268 }
269 int RakWString::StrICmp(const RakWString &right) const
270 {
271 #ifdef _WIN32
272 return _wcsicmp(C_String(), right.C_String());
273 #else
274 // Not supported
275 return wcscmp(C_String(), right.C_String());
276 #endif
277 }
278 void RakWString::Clear(void)
279 {
280 rakFree_Ex(c_str,_FILE_AND_LINE_);
281 c_str=0;
282 c_strCharLength=0;
283 }
284 void RakWString::Printf(void)
285 {
286 printf("%ls", C_String());
287 }
288 void RakWString::FPrintf(FILE *fp)
289 {
290 fprintf(fp,"%ls", C_String());
291 }
292 void RakWString::Serialize(BitStream *bs) const
293 {
294 Serialize(C_String(), bs);
295 }
296 void RakWString::Serialize(const wchar_t * const str, BitStream *bs)
297 {
298 #if 0
299 char *multiByteBuffer;
300 size_t allocated = wcslen(str)*MAX_BYTES_PER_UNICODE_CHAR;
301 multiByteBuffer = (char*) rakMalloc_Ex(allocated, _FILE_AND_LINE_);
302 size_t used = wcstombs(multiByteBuffer, str, allocated);
303 bs->WriteCasted<unsigned short>(used);
304 bs->WriteAlignedBytes((const unsigned char*) multiByteBuffer,(const unsigned int) used);
305 rakFree_Ex(multiByteBuffer, _FILE_AND_LINE_);
306 #else
307 size_t mbByteLength = wcslen(str);
308 bs->WriteCasted<unsigned short>(mbByteLength);
309 for (unsigned int i=0; i < mbByteLength; i++)
310 {
311 uint16_t t;
312 t = (uint16_t) str[i];
313 // Force endian swapping, and write to 16 bits
314 bs->Write(t);
315 }
316 #endif
317 }
318 bool RakWString::Deserialize(BitStream *bs)
319 {
320 Clear();
321
322 size_t mbByteLength;
323 bs->ReadCasted<unsigned short>(mbByteLength);
324 if (mbByteLength>0)
325 {
326 #if 0
327 char *multiByteBuffer;
328 multiByteBuffer = (char*) rakMalloc_Ex(mbByteLength+1, _FILE_AND_LINE_);
329 bool result = bs->ReadAlignedBytes((unsigned char*) multiByteBuffer,(const unsigned int) mbByteLength);
330 if (result==false)
331 {
332 rakFree_Ex(multiByteBuffer, _FILE_AND_LINE_);
333 return false;
334 }
335 multiByteBuffer[mbByteLength]=0;
336 c_str = (wchar_t *) rakMalloc_Ex( (mbByteLength + 1) * MAX_BYTES_PER_UNICODE_CHAR, _FILE_AND_LINE_);
337 mbstowcs_s(&c_strCharLength, c_str, mbByteLength + 1, multiByteBuffer, mbByteLength);
338 rakFree_Ex(multiByteBuffer, _FILE_AND_LINE_);
339 c_str[c_strCharLength]=0;
340 #else
341 c_str = (wchar_t*) rakMalloc_Ex((mbByteLength+1) * MAX_BYTES_PER_UNICODE_CHAR, _FILE_AND_LINE_);
342 c_strCharLength = mbByteLength;
343 for (unsigned int i=0; i < mbByteLength; i++)
344 {
345 uint16_t t;
346 // Force endian swapping, and read 16 bits
347 bs->Read(t);
348 c_str[i]=t;
349 }
350 c_str[mbByteLength]=0;
351 #endif
352 return true;
353 }
354 else
355 {
356 return true;
357 }
358 }
359 bool RakWString::Deserialize(wchar_t *str, BitStream *bs)
360 {
361 size_t mbByteLength;
362 bs->ReadCasted<unsigned short>(mbByteLength);
363 if (mbByteLength > 0)
364 {
365 #if 0
366 char *multiByteBuffer;
367 multiByteBuffer = (char*)rakMalloc_Ex(mbByteLength + 1, _FILE_AND_LINE_);
368 bool result = bs->ReadAlignedBytes((unsigned char*)multiByteBuffer, (const unsigned int)mbByteLength);
369 if (result == false)
370 {
371 rakFree_Ex(multiByteBuffer, _FILE_AND_LINE_);
372 return false;
373 }
374 multiByteBuffer[mbByteLength] = 0;
375 size_t c_strCharLength;
376 mbstowcs(&c_strCharLength, str, multiByteBuffer, mbByteLength);
377 rakFree_Ex(multiByteBuffer, _FILE_AND_LINE_);
378 str[c_strCharLength] = 0;
379 #else
380 for (unsigned int i = 0; i < mbByteLength; i++)
381 {
382 uint16_t t;
383 // Force endian swapping, and read 16 bits
384 bs->Read(t);
385 str[i] = t;
386 }
387 str[mbByteLength] = 0;
388 #endif
389 return true;
390 }
391 else
392 {
393 #pragma warning(push)
394 #pragma warning(disable:4996)
395 wcscpy(str, L"");
396 #pragma warning(pop)
397 }
398 return true;
399 }
400 bool RakWString::Deserialize(wchar_t *str, size_t strLength, BitStream *bs)
401 {
402 size_t mbByteLength;
403 bs->ReadCasted<unsigned short>(mbByteLength);
404 if (mbByteLength>0)
405 {
406 #if 0
407 char *multiByteBuffer;
408 multiByteBuffer = (char*) rakMalloc_Ex(mbByteLength+1, _FILE_AND_LINE_);
409 bool result = bs->ReadAlignedBytes((unsigned char*) multiByteBuffer,(const unsigned int) mbByteLength);
410 if (result==false)
411 {
412 rakFree_Ex(multiByteBuffer, _FILE_AND_LINE_);
413 return false;
414 }
415 multiByteBuffer[mbByteLength]=0;
416 size_t c_strCharLength;
417 mbstowcs_s(&c_strCharLength, str, strLength, multiByteBuffer, mbByteLength);
418 rakFree_Ex(multiByteBuffer, _FILE_AND_LINE_);
419 str[c_strCharLength]=0;
420 #else
421 for (unsigned int i=0; i < mbByteLength; i++)
422 {
423 uint16_t t;
424 // Force endian swapping, and read 16 bits
425 bs->Read(t);
426 str[i]=t;
427 }
428 str[mbByteLength]=0;
429 #endif
430 return true;
431 }
432 else
433 {
434 wcscpy_s(str,strLength,L"");
435 }
436 return true;
437 }
438
439 const SLNet::RakWString operator+(const SLNet::RakWString &lhs, const SLNet::RakWString &rhs)
440 {
441 SLNet::RakWString returnvalue(lhs);
442 returnvalue += rhs;
443 return returnvalue;
444 }
445
446 /*
447 SLNet::BitStream bsTest;
448 SLNet::RakWString testString("cat"), testString2;
449 testString = "Hllo";
450 testString = L"Hello";
451 testString += L" world";
452 testString2 += testString2;
453 SLNet::RakWString ts3(L" from here");
454 testString2+=ts3;
455 SLNet::RakWString ts4(L" 222");
456 testString2=ts4;
457 SLNet::RakString rs("rakstring");
458 testString2+=rs;
459 testString2=rs;
460 bsTest.Write(L"one");
461 bsTest.Write(testString2);
462 bsTest.SetReadOffset(0);
463 SLNet::RakWString ts5, ts6;
464 wchar_t buff[99];
465 wchar_t *wptr = (wchar_t*)buff;
466 bsTest.Read(wptr);
467 bsTest.Read(ts5);
468 */
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CCRakNetSlidingWindow.h Source File

  • include
  • slikenet
CCRakNetSlidingWindow.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 /*
17 http://www.ssfnet.org/Exchange/tcp/tcpTutorialNotes.html
18
19 cwnd=max bytes allowed on wire at once
20
21 Start:
22 cwnd=mtu
23 ssthresh=unlimited
24
25 Slow start:
26 On ack cwnd*=2
27
28 congestion avoidance:
29 On ack during new period
30 cwnd+=mtu*mtu/cwnd
31
32 on loss or duplicate ack during period:
33 sshtresh=cwnd/2
34 cwnd=MTU
35 This reenters slow start
36
37 If cwnd < ssthresh, then use slow start
38 else use congestion avoidance
39
40
41 */
42
43 #include "defines.h"
44
45 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL==1
46
47 #ifndef __CONGESTION_CONTROL_SLIDING_WINDOW_H
48 #define __CONGESTION_CONTROL_SLIDING_WINDOW_H
49
50 #include "NativeTypes.h"
51 #include "time.h"
52 #include "types.h"
53 #include "DS_Queue.h"
54
56 #define UDP_HEADER_SIZE 28
57
58 #define CC_DEBUG_PRINTF_1(x)
59 #define CC_DEBUG_PRINTF_2(x,y)
60 #define CC_DEBUG_PRINTF_3(x,y,z)
61 #define CC_DEBUG_PRINTF_4(x,y,z,a)
62 #define CC_DEBUG_PRINTF_5(x,y,z,a,b)
63 //#define CC_DEBUG_PRINTF_1(x) printf(x)
64 //#define CC_DEBUG_PRINTF_2(x,y) printf(x,y)
65 //#define CC_DEBUG_PRINTF_3(x,y,z) printf(x,y,z)
66 //#define CC_DEBUG_PRINTF_4(x,y,z,a) printf(x,y,z,a)
67 //#define CC_DEBUG_PRINTF_5(x,y,z,a,b) printf(x,y,z,a,b)
68
70 #define CC_TIME_TYPE_BYTES 8
71
72 #if CC_TIME_TYPE_BYTES==8
73 typedef SLNet::TimeUS CCTimeType;
74 #else
75 typedef SLNet::TimeMS CCTimeType;
76 #endif
77
78 typedef SLNet::uint24_t DatagramSequenceNumberType;
79 typedef double BytesPerMicrosecond;
80 typedef double BytesPerSecond;
81 typedef double MicrosecondsPerByte;
82
83 namespace SLNet
84 {
85
86 class CCRakNetSlidingWindow
87 {
88 public:
89
90 CCRakNetSlidingWindow();
91 ~CCRakNetSlidingWindow();
92
94 void Init(CCTimeType curTime, uint32_t maxDatagramPayload);
95
97 void Update(CCTimeType curTime, bool hasDataToSendOrResend);
98
99 int GetRetransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend);
100 int GetTransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend);
101
106 bool ShouldSendACKs(CCTimeType curTime, CCTimeType estimatedTimeToNextTick);
107
110 DatagramSequenceNumberType GetAndIncrementNextDatagramSequenceNumber(void);
111 DatagramSequenceNumberType GetNextDatagramSequenceNumber(void);
112
118 void OnSendBytes(CCTimeType curTime, uint32_t numBytes);
119
121 void OnGotPacketPair(DatagramSequenceNumberType datagramSequenceNumber, uint32_t sizeInBytes, CCTimeType curTime);
122
126 bool OnGotPacket(DatagramSequenceNumberType datagramSequenceNumber, bool isContinuousSend, CCTimeType curTime, uint32_t sizeInBytes, uint32_t *skippedMessageCount);
127
130 void OnResend(CCTimeType curTime, SLNet::TimeUS nextActionTime);
131 void OnNAK(CCTimeType curTime, DatagramSequenceNumberType nakSequenceNumber);
132
137 void OnAck(CCTimeType curTime, CCTimeType rtt, bool hasBAndAS, BytesPerMicrosecond _B, BytesPerMicrosecond _AS, double totalUserDataBytesAcked, bool isContinuousSend, DatagramSequenceNumberType sequenceNumber );
138 void OnDuplicateAck( CCTimeType curTime, DatagramSequenceNumberType sequenceNumber );
139
142 void OnSendAckGetBAndAS(CCTimeType curTime, bool *hasBAndAS, BytesPerMicrosecond *_B, BytesPerMicrosecond *_AS);
143
148 void OnSendAck(CCTimeType curTime, uint32_t numBytes);
149
152 void OnSendNACK(CCTimeType curTime, uint32_t numBytes);
153
160 CCTimeType GetRTOForRetransmission(unsigned char timesSent) const;
161
164 void SetMTU(uint32_t bytes);
165
167 uint32_t GetMTU(void) const;
168
170 BytesPerMicrosecond GetLocalSendRate(void) const {return 0;}
171 BytesPerMicrosecond GetLocalReceiveRate(CCTimeType currentTime) const;
172 BytesPerMicrosecond GetRemoveReceiveRate(void) const {return 0;}
173 //BytesPerMicrosecond GetEstimatedBandwidth(void) const {return B;}
174 BytesPerMicrosecond GetEstimatedBandwidth(void) const {return GetLinkCapacityBytesPerSecond()*1000000.0;}
175 double GetLinkCapacityBytesPerSecond(void) const {return 0;}
176
178 double GetRTT(void) const;
179
180 bool GetIsInSlowStart(void) const {return IsInSlowStart();}
181 uint32_t GetCWNDLimit(void) const {return (uint32_t) 0;}
182
183
185 static bool GreaterThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b);
187 static bool LessThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b);
188 // void SetTimeBetweenSendsLimit(unsigned int bitsPerSecond);
189 uint64_t GetBytesPerSecondLimitByCongestionControl(void) const;
190
191 protected:
192
193 // Maximum amount of bytes that the user can send, e.g. the size of one full datagram
194 uint32_t MAXIMUM_MTU_INCLUDING_UDP_HEADER;
195
196 double cwnd; // max bytes on wire
197 double ssThresh; // Threshhold between slow start and congestion avoidance
198
201 CCTimeType oldestUnsentAck;
202
203 CCTimeType GetSenderRTOForACK(void) const;
204
206 DatagramSequenceNumberType nextDatagramSequenceNumber;
207 DatagramSequenceNumberType nextCongestionControlBlock;
208 bool backoffThisBlock, speedUpThisBlock;
211 DatagramSequenceNumberType expectedNextSequenceNumber;
212
213 bool _isContinuousSend;
214
215 bool IsInSlowStart(void) const;
216
217 double lastRtt, estimatedRTT, deviationRtt;
218
219 };
220
221 }
222
223 #endif
224
225 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/LinuxStrings.h Source File

  • include
  • slikenet
LinuxStrings.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef _GCC_WIN_STRINGS
17 #define _GCC_WIN_STRINGS
18
19 #if defined(__native_client__)
20 #ifndef _stricmp
21 int _stricmp(const char* s1, const char* s2);
22 #endif
23 int _strnicmp(const char* s1, const char* s2, size_t n);
24 char *_strlwr(char * str );
25 #else
26 #if (defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(_WIN32)
27 #ifndef _stricmp
28 int _stricmp(const char* s1, const char* s2);
29 #endif
30 int _strnicmp(const char* s1, const char* s2, size_t n);
31 // http://www.jenkinssoftware.com/forum/index.php?topic=5010.msg20920#msg20920
32 #ifndef __APPLE__
33 char *_strlwr(char * str ); //this won't compile on OSX for some reason
34 #endif
35
36
37
38 #endif
39 #endif
40
41 #endif // _GCC_WIN_STRINGS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • AutopatcherRepositoryInterface
SLNet::AutopatcherRepositoryInterface Member List

This is the complete list of members for SLNet::AutopatcherRepositoryInterface, including all inherited members.

GetChangelistSinceDate(const char *applicationName, FileList *addedOrModifiedFilesWithHashData, FileList *deletedFiles, double sinceDate)=0 | SLNet::AutopatcherRepositoryInterface | pure virtual
GetFilePart(const char *filename, unsigned int startReadBytes, unsigned int numBytesToRead, void *preallocatedDestination, FileListNodeContext context) | SLNet::IncrementalReadInterface | virtual
GetIncrementalReadChunkSize(void) const =0 | SLNet::AutopatcherRepositoryInterface | pure virtual
GetLastError(void) const =0 | SLNet::AutopatcherRepositoryInterface | pure virtual
GetMostRecentChangelistWithPatches(SLNet::RakString &applicationName, FileList *patchedFiles, FileList *updatedFiles, FileList *addedOrModifiedFileHashes, FileList *deletedFiles, double *priorRowPatchTime, double *mostRecentRowPatchTime)=0 | SLNet::AutopatcherRepositoryInterface | pure virtual
GetPatches(const char *applicationName, FileList *input, bool allowDownloadOfOriginalUnmodifiedFiles, FileList *patchList)=0 | SLNet::AutopatcherRepositoryInterface | pure virtual
IncrementalReadInterface() | SLNet::IncrementalReadInterface | inline
~IncrementalReadInterface() | SLNet::IncrementalReadInterface | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StatisticsHistory
  • TimeAndValueQueue
SLNet::StatisticsHistory::TimeAndValueQueue Member List

This is the complete list of members for SLNet::StatisticsHistory::TimeAndValueQueue, including all inherited members.

Clear(void) | SLNet::StatisticsHistory::TimeAndValueQueue |
CullExpiredValues(Time curTime) | SLNet::StatisticsHistory::TimeAndValueQueue |
GetLongTermAverage(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetLongTermHighest(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetLongTermLowest(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetLongTermSum(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetRecentAverage(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetRecentHighest(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetRecentLowest(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetRecentStandardDeviation(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetRecentSum(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetRecentSumOfSquares(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetSumSinceTime(Time t) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetTimeRange(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
GetTimeToTrackValues(void) const | SLNet::StatisticsHistory::TimeAndValueQueue |
Interpolate(TimeAndValue t1, TimeAndValue t2, Time time) | SLNet::StatisticsHistory::TimeAndValueQueue | static
key | SLNet::StatisticsHistory::TimeAndValueQueue |
longTermCount | SLNet::StatisticsHistory::TimeAndValueQueue |
longTermHighest | SLNet::StatisticsHistory::TimeAndValueQueue |
longTermLowest | SLNet::StatisticsHistory::TimeAndValueQueue |
longTermSum | SLNet::StatisticsHistory::TimeAndValueQueue |
MergeSets(const TimeAndValueQueue *lhs, SHDataCategory lhsDataCategory, const TimeAndValueQueue *rhs, SHDataCategory rhsDataCategory, TimeAndValueQueue *output) | SLNet::StatisticsHistory::TimeAndValueQueue | static
operator=(const TimeAndValueQueue &input) | SLNet::StatisticsHistory::TimeAndValueQueue |
recentSum | SLNet::StatisticsHistory::TimeAndValueQueue |
recentSumOfSquares | SLNet::StatisticsHistory::TimeAndValueQueue |
ResizeSampleSet(int approximateSamples, DataStructures::Queue< StatisticsHistory::TimeAndValue > &blendedSamples, SHDataCategory dataCategory, Time timeClipStart=0, Time timeClipEnd=0) | SLNet::StatisticsHistory::TimeAndValueQueue |
SetTimeToTrackValues(Time t) | SLNet::StatisticsHistory::TimeAndValueQueue |
sortValue | SLNet::StatisticsHistory::TimeAndValueQueue |
TimeAndValueQueue() | SLNet::StatisticsHistory::TimeAndValueQueue |
timeToTrackValues | SLNet::StatisticsHistory::TimeAndValueQueue |
values | SLNet::StatisticsHistory::TimeAndValueQueue |
~TimeAndValueQueue() | SLNet::StatisticsHistory::TimeAndValueQueue |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/_FindFirst.cpp Source File

  • src
_FindFirst.cpp
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 *
5 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
6 *
7 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
8 * license found in the license.txt file in the root directory of this source tree.
9 */
10
15 #if (defined(__GNUC__) || defined(__GCCXML__)) && !defined(_WIN32)
16 #include "slikenet/_FindFirst.h"
17 #include "slikenet/DS_List.h"
18
19 #include <sys/stat.h>
20
21 #include <fnmatch.h>
22 #include "slikenet/linux_adapter.h"
23 #include "slikenet/osx_adapter.h"
24
25
26 static DataStructures::List< _findinfo_t* > fileInfo;
27
28 #include "slikenet/memoryoverride.h"
29 #include "slikenet/assert.h"
30
34 long _findfirst(const char *name, _finddata_t *f)
35 {
36 SLNet::RakString nameCopy = name;
37 SLNet::RakString filter;
38
39 // This is linux only, so don't bother with '\'
40 const char* lastSep = strrchr(name,'/');
41 if(!lastSep)
42 {
43 // filter pattern only is given, search current directory.
44 filter = nameCopy;
45 nameCopy = ".";
46 } else
47 {
48 // strip filter pattern from directory name, leave
49 // trailing '/' intact.
50 filter = lastSep+1;
51 unsigned sepIndex = lastSep - name;
52 nameCopy.Erase(sepIndex+1, nameCopy.GetLength() - sepIndex-1);
53 }
54
55 DIR* dir = opendir(nameCopy);
56
57 if(!dir) return -1;
58
59 _findinfo_t* fi = SLNet::OP_NEW<_findinfo_t>( _FILE_AND_LINE_ );
60 fi->filter = filter;
61 fi->dirName = nameCopy; // we need to remember this for stat()
62 fi->openedDir = dir;
63 fileInfo.Insert(fi, _FILE_AND_LINE_);
64
65 long ret = fileInfo.Size()-1;
66
67 // Retrieve the first file. We cannot rely on the first item
68 // being '.'
69 if (_findnext(ret, f) == -1) return -1;
70 else return ret;
71 }
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103 int _findnext(long h, _finddata_t *f)
104 {
105 RakAssert(h >= 0 && h < (long)fileInfo.Size());
106 if (h < 0 || h >= (long)fileInfo.Size()) return -1;
107
108 _findinfo_t* fi = fileInfo[h];
109
110 while(true)
111 {
112 dirent* entry = readdir(fi->openedDir);
113 if(entry == 0) return -1;
114
115 // Only report stuff matching our filter
116 if (fnmatch(fi->filter, entry->d_name, FNM_PATHNAME) != 0) continue;
117
118 // To reliably determine the entry's type, we must do
119 // a stat... don't rely on entry->d_type, as this
120 // might be unavailable!
121 struct stat filestat;
122 SLNet::RakString fullPath = fi->dirName + entry->d_name;
123 if (stat(fullPath, &filestat) != 0)
124 {
125 RAKNET_DEBUG_PRINTF("Cannot stat %s\n", fullPath.C_String());
126 continue;
127 }
128
129 if (S_ISREG(filestat.st_mode))
130 {
131 f->attrib = _A_NORMAL;
132 } else if (S_ISDIR(filestat.st_mode))
133 {
134 f->attrib = _A_SUBDIR;
135 } else continue; // We are interested in files and
136 // directories only. Links currently
137 // are not supported.
138
139 f->size = filestat.st_size;
140 strncpy_s(f->name, entry->d_name, STRING_BUFFER_SIZE);
141
142 return 0;
143 }
144
145 return -1;
146 }
147
148
149
150
151
155 int _findclose(long h)
156 {
157 if (h==-1) return 0;
158
159 if (h < 0 || h >= (long)fileInfo.Size())
160 {
161 RakAssert(false);
162 return -1;
163 }
164
165 _findinfo_t* fi = fileInfo[h];
166 closedir(fi->openedDir);
167 fileInfo.RemoveAtIndex(h);
168 SLNet::OP_DELETE(fi, _FILE_AND_LINE_);
169 return 0;
170 }
171 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/alloca.h Source File

  • include
  • slikenet
alloca.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #if defined(__FreeBSD__)
12 #include <stdlib.h>
13
14
15
16
17 #elif defined ( __APPLE__ ) || defined ( __APPLE_CC__ )
18 #include <malloc/malloc.h>
19 #include <alloca.h>
20 #elif defined(_WIN32)
21 #include <malloc.h>
22 #else
23 #include <malloc.h>
24 // Alloca needed on Ubuntu apparently
25 #include <alloca.h>
26 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/UDPProxyServer.cpp Source File

  • src
UDPProxyServer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_UDPProxyServer==1 && _RAKNET_SUPPORT_UDPForwarder==1
18
19 #include "slikenet/UDPProxyServer.h"
20 #include "slikenet/BitStream.h"
21 #include "slikenet/UDPProxyCommon.h"
22 #include "slikenet/peerinterface.h"
23 #include "slikenet/MessageIdentifiers.h"
24
25 using namespace SLNet;
26
27 STATIC_FACTORY_DEFINITIONS(UDPProxyServer,UDPProxyServer);
28
29 UDPProxyServer::UDPProxyServer()
30 {
31 resultHandler=0;
32 socketFamily=AF_INET;
33 }
34 UDPProxyServer::~UDPProxyServer()
35 {
36
37 }
38 void UDPProxyServer::SetSocketFamily(unsigned short _socketFamily)
39 {
40 socketFamily=_socketFamily;
41 }
42 void UDPProxyServer::SetResultHandler(UDPProxyServerResultHandler *rh)
43 {
44 resultHandler=rh;
45 }
46 bool UDPProxyServer::LoginToCoordinator(SLNet::RakString password, SystemAddress coordinatorAddress)
47 {
48 unsigned int insertionIndex;
49 bool objectExists;
50 insertionIndex=loggingInCoordinators.GetIndexFromKey(coordinatorAddress,&objectExists);
51 if (objectExists==true)
52 return false;
53 loggedInCoordinators.GetIndexFromKey(coordinatorAddress,&objectExists);
54 if (objectExists==true)
55 return false;
56 SLNet::BitStream outgoingBs;
57 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
58 outgoingBs.Write((MessageID)ID_UDP_PROXY_LOGIN_REQUEST_FROM_SERVER_TO_COORDINATOR);
59 outgoingBs.Write(password);
60 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, coordinatorAddress, false);
61 loggingInCoordinators.InsertAtIndex(coordinatorAddress, insertionIndex, _FILE_AND_LINE_ );
62 return true;
63 }
64 void UDPProxyServer::SetServerPublicIP(RakString ip)
65 {
66 serverPublicIp = ip;
67 }
68 void UDPProxyServer::Update(void)
69 {
70 }
71 PluginReceiveResult UDPProxyServer::OnReceive(Packet *packet)
72 {
73 // Make sure incoming messages from from UDPProxyCoordinator
74
75 if (packet->data[0]==ID_UDP_PROXY_GENERAL && packet->length>1)
76 {
77 bool objectExists;
78
79 switch (packet->data[1])
80 {
81 case ID_UDP_PROXY_FORWARDING_REQUEST_FROM_COORDINATOR_TO_SERVER:
82 if (loggedInCoordinators.GetIndexFromKey(packet->systemAddress, &objectExists)!=(unsigned int)-1)
83 {
84 OnForwardingRequestFromCoordinatorToServer(packet);
85 return RR_STOP_PROCESSING_AND_DEALLOCATE;
86 }
87 break;
88 case ID_UDP_PROXY_NO_PASSWORD_SET_FROM_COORDINATOR_TO_SERVER:
89 case ID_UDP_PROXY_WRONG_PASSWORD_FROM_COORDINATOR_TO_SERVER:
90 case ID_UDP_PROXY_ALREADY_LOGGED_IN_FROM_COORDINATOR_TO_SERVER:
91 case ID_UDP_PROXY_LOGIN_SUCCESS_FROM_COORDINATOR_TO_SERVER:
92 {
93 unsigned int removalIndex = loggingInCoordinators.GetIndexFromKey(packet->systemAddress, &objectExists);
94 if (objectExists)
95 {
96 loggingInCoordinators.RemoveAtIndex(removalIndex);
97
98 SLNet::BitStream incomingBs(packet->data, packet->length, false);
99 incomingBs.IgnoreBytes(2);
100 SLNet::RakString password;
101 incomingBs.Read(password);
102 switch (packet->data[1])
103 {
104 case ID_UDP_PROXY_NO_PASSWORD_SET_FROM_COORDINATOR_TO_SERVER:
105 if (resultHandler)
106 resultHandler->OnNoPasswordSet(password, this);
107 break;
108 case ID_UDP_PROXY_WRONG_PASSWORD_FROM_COORDINATOR_TO_SERVER:
109 if (resultHandler)
110 resultHandler->OnWrongPassword(password, this);
111 break;
112 case ID_UDP_PROXY_ALREADY_LOGGED_IN_FROM_COORDINATOR_TO_SERVER:
113 if (resultHandler)
114 resultHandler->OnAlreadyLoggedIn(password, this);
115 break;
116 case ID_UDP_PROXY_LOGIN_SUCCESS_FROM_COORDINATOR_TO_SERVER:
117 // RakAssert(loggedInCoordinators.GetIndexOf(packet->systemAddress)==(unsigned int)-1);
118 loggedInCoordinators.Insert(packet->systemAddress, packet->systemAddress, true, _FILE_AND_LINE_);
119 if (resultHandler)
120 resultHandler->OnLoginSuccess(password, this);
121 break;
122 }
123 }
124
125
126 return RR_STOP_PROCESSING_AND_DEALLOCATE;
127 }
128 }
129 }
130 return RR_CONTINUE_PROCESSING;
131 }
132 void UDPProxyServer::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
133 {
134 (void) lostConnectionReason;
135 (void) rakNetGUID;
136
137 loggingInCoordinators.RemoveIfExists(systemAddress);
138 loggedInCoordinators.RemoveIfExists(systemAddress);
139 }
140 void UDPProxyServer::OnRakPeerStartup(void)
141 {
142 udpForwarder.Startup();
143 }
144 void UDPProxyServer::OnRakPeerShutdown(void)
145 {
146 udpForwarder.Shutdown();
147 loggingInCoordinators.Clear(true,_FILE_AND_LINE_);
148 loggedInCoordinators.Clear(true,_FILE_AND_LINE_);
149 }
150 void UDPProxyServer::OnAttach(void)
151 {
152 if (rakPeerInterface->IsActive())
153 OnRakPeerStartup();
154 }
155 void UDPProxyServer::OnDetach(void)
156 {
157 OnRakPeerShutdown();
158 }
159 void UDPProxyServer::OnForwardingRequestFromCoordinatorToServer(Packet *packet)
160 {
161 SystemAddress sourceAddress, targetAddress;
162 SLNet::BitStream incomingBs(packet->data, packet->length, false);
163 incomingBs.IgnoreBytes(2);
164 incomingBs.Read(sourceAddress);
165 incomingBs.Read(targetAddress);
166 SLNet::TimeMS timeoutOnNoDataMS;
167 incomingBs.Read(timeoutOnNoDataMS);
168 RakAssert(timeoutOnNoDataMS > 0 && timeoutOnNoDataMS <= UDP_FORWARDER_MAXIMUM_TIMEOUT);
169
170 unsigned short forwardingPort=0;
171 UDPForwarderResult success = udpForwarder.StartForwarding(sourceAddress, targetAddress, timeoutOnNoDataMS, 0, socketFamily, &forwardingPort, 0);
172 SLNet::BitStream outgoingBs;
173 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
174 outgoingBs.Write((MessageID)ID_UDP_PROXY_FORWARDING_REPLY_FROM_SERVER_TO_COORDINATOR);
175 outgoingBs.Write(sourceAddress);
176 outgoingBs.Write(targetAddress);
177 outgoingBs.Write(serverPublicIp);
178 outgoingBs.Write((unsigned char) success);
179 outgoingBs.Write(forwardingPort);
180 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
181 }
182
183 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • CommandParserInterface
SLNet::CommandParserInterface Member List

This is the complete list of members for SLNet::CommandParserInterface, including all inherited members.

commandList | SLNet::CommandParserInterface | protected
CommandParserInterface() | SLNet::CommandParserInterface |
GetName(void) const =0 | SLNet::CommandParserInterface | pure virtual
GetRegisteredCommand(const char *command, RegisteredCommand *rc) | SLNet::CommandParserInterface | virtual
OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)=0 | SLNet::CommandParserInterface | pure virtual
OnConnectionLost(const SystemAddress &systemAddress, TransportInterface *transport) | SLNet::CommandParserInterface | virtual
OnNewIncomingConnection(const SystemAddress &systemAddress, TransportInterface *transport) | SLNet::CommandParserInterface | virtual
OnTransportChange(TransportInterface *transport) | SLNet::CommandParserInterface | virtual
ParseConsoleString(char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength) | SLNet::CommandParserInterface | static
RegisterCommand(unsigned char parameterCount, const char *command, const char *commandHelp) | SLNet::CommandParserInterface | virtual
ReturnResult(bool res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(char *res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(SystemAddress res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(int res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
SendCommandList(TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
SendHelp(TransportInterface *transport, const SystemAddress &systemAddress)=0 | SLNet::CommandParserInterface | pure virtual
VARIABLE_NUMBER_OF_PARAMETERS | SLNet::CommandParserInterface | static
~CommandParserInterface() | SLNet::CommandParserInterface | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • VariableListDeltaTracker
  • VariableLastValueNode
SLNet::VariableListDeltaTracker::VariableLastValueNode Member List

This is the complete list of members for SLNet::VariableListDeltaTracker::VariableLastValueNode, including all inherited members.

byteLength | SLNet::VariableListDeltaTracker::VariableLastValueNode
isDirty | SLNet::VariableListDeltaTracker::VariableLastValueNode
lastData | SLNet::VariableListDeltaTracker::VariableLastValueNode
VariableLastValueNode() | SLNet::VariableListDeltaTracker::VariableLastValueNode
VariableLastValueNode(const unsigned char *data, int _byteLength) | SLNet::VariableListDeltaTracker::VariableLastValueNode
~VariableLastValueNode() | SLNet::VariableListDeltaTracker::VariableLastValueNode
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SimpleMutex
SLNet::SimpleMutex Member List

This is the complete list of members for SLNet::SimpleMutex, including all inherited members.

Lock(void) | SLNet::SimpleMutex
SimpleMutex() | SLNet::SimpleMutex
Unlock(void) | SLNet::SimpleMutex
~SimpleMutex() | SLNet::SimpleMutex
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/GridSectorizer.h Source File

  • include
  • slikenet
GridSectorizer.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef _GRID_SECTORIZER_H
17 #define _GRID_SECTORIZER_H
18
19 //#define _USE_ORDERED_LIST
20
21 #include "memoryoverride.h"
22
23 #ifdef _USE_ORDERED_LIST
24 #include "DS_OrderedList.h"
25 #else
26 #include "DS_List.h"
27 #endif
28
29 class GridSectorizer
30 {
31 public:
32 GridSectorizer();
33 ~GridSectorizer();
34
35 // _cellWidth, _cellHeight is the width and height of each cell in world units
36 // minX, minY, maxX, maxY are the world dimensions (can be changed to dynamically allocate later if needed)
37 void Init(const float _maxCellWidth, const float _maxCellHeight, const float minX, const float minY, const float maxX, const float maxY);
38
39 // Adds a pointer to the grid with bounding rectangle dimensions
40 void AddEntry(void *entry, const float minX, const float minY, const float maxX, const float maxY);
41
42 #ifdef _USE_ORDERED_LIST
43
44 // Removes a pointer, as above
45 void RemoveEntry(void *entry, const float minX, const float minY, const float maxX, const float maxY);
46
47 // Adds and removes in one pass, more efficient than calling both functions consecutively
48 void MoveEntry(void *entry, const float sourceMinX, const float sourceMinY, const float sourceMaxX, const float sourceMaxY,
49 const float destMinX, const float destMinY, const float destMaxX, const float destMaxY);
50
51 #endif
52
53 // Adds to intersectionList all entries in a certain radius
54 void GetEntries(DataStructures::List<void*>& intersectionList, const float minX, const float minY, const float maxX, const float maxY);
55
56 void Clear(void);
57
58 protected:
59 int WorldToCellX(const float input) const;
60 int WorldToCellY(const float input) const;
61 int WorldToCellXOffsetAndClamped(const float input) const;
62 int WorldToCellYOffsetAndClamped(const float input) const;
63
64 // Returns true or false if a position crosses cells in the grid. If false, you don't need to move entries
65 bool PositionCrossesCells(const float originX, const float originY, const float destinationX, const float destinationY) const;
66
67 float cellOriginX, cellOriginY;
68 float cellWidth, cellHeight;
69 float invCellWidth, invCellHeight;
70 float gridWidth, gridHeight;
71 int gridCellWidthCount, gridCellHeightCount;
72
73
74 // int gridWidth, gridHeight;
75
76 #ifdef _USE_ORDERED_LIST
77 DataStructures::OrderedList<void*, void*>* grid;
78 #else
79 DataStructures::List<void*>* grid;
80 #endif
81 };
82
83 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NetworkIDManager.h Source File

  • include
  • slikenet
NetworkIDManager.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #ifndef __NETWORK_ID_MANAGER_H
21 #define __NETWORK_ID_MANAGER_H
22
23 #include "types.h"
24 #include "Export.h"
25 #include "memoryoverride.h"
26 #include "NetworkIDObject.h"
27 #include "Rand.h"
28
29 namespace SLNet
30 {
31
34 #define NETWORK_ID_MANAGER_HASH_LENGTH 1024
35
40 class RAK_DLL_EXPORT NetworkIDManager
41 {
42 public:
43 // GetInstance() and DestroyInstance(instance*)
44 STATIC_FACTORY_DECLARATIONS(NetworkIDManager)
45
46 NetworkIDManager();
47 virtual ~NetworkIDManager(void);
48
52 template <class returnType>
53 returnType GET_OBJECT_FROM_ID(NetworkID x) {
54 NetworkIDObject *nio = GET_BASE_OBJECT_FROM_ID(x);
55 if (nio==0)
56 return 0;
57 if (nio->GetParent())
58 return (returnType) nio->GetParent();
59 return (returnType) nio;
60 }
61
62 // Stop tracking all NetworkID objects
63 void Clear(void);
64
66 NetworkIDObject *GET_BASE_OBJECT_FROM_ID(NetworkID x);
67
68 protected:
70 void TrackNetworkIDObject(NetworkIDObject *networkIdObject);
71 void StopTrackingNetworkIDObject(NetworkIDObject *networkIdObject);
72
73 friend class NetworkIDObject;
74
75 NetworkIDObject *networkIdHash[NETWORK_ID_MANAGER_HASH_LENGTH];
76 unsigned int NetworkIDToHashIndex(NetworkID networkId);
77 uint64_t startingOffset;
79 NetworkID GetNewNetworkID(void);
80
81 };
82
83 } // namespace SLNet
84
85 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CheckSum.cpp Source File

  • src
CheckSum.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
21 #include "slikenet/CheckSum.h"
22
23 /****************************************************************************
24 * CheckSum::add
25 * Inputs:
26 * unsigned int d: word to add
27 * Result: void
28 *
29 * Effect:
30 * Adds the bytes of the unsigned int to the CheckSum
31 ****************************************************************************/
32
33 void CheckSum::Add ( unsigned int value )
34 {
35 union
36 {
37 unsigned int value;
38 unsigned char bytes[ 4 ];
39 }
40
41 data;
42 data.value = value;
43
44 for ( unsigned int i = 0; i < sizeof( data.bytes ); i++ )
45 Add ( data.bytes[ i ] )
46
47 ;
48 } // CheckSum::add(unsigned int)
49
50 /****************************************************************************
51 * CheckSum::add
52 * Inputs:
53 * unsigned short value:
54 * Result: void
55 *
56 * Effect:
57 * Adds the bytes of the unsigned short value to the CheckSum
58 ****************************************************************************/
59
60 void CheckSum::Add ( unsigned short value )
61 {
62 union
63 {
64 unsigned short value;
65 unsigned char bytes[ 2 ];
66 }
67
68 data;
69 data.value = value;
70
71 for ( unsigned int i = 0; i < sizeof( data.bytes ); i++ )
72 Add ( data.bytes[ i ] )
73
74 ;
75 } // CheckSum::add(unsigned short)
76
77 /****************************************************************************
78 * CheckSum::add
79 * Inputs:
80 * unsigned char value:
81 * Result: void
82 *
83 * Effect:
84 * Adds the byte to the CheckSum
85 ****************************************************************************/
86
87 void CheckSum::Add ( unsigned char value )
88 {
89 unsigned char cipher = (unsigned char)( value ^ ( r >> 8 ) );
90 r = ( cipher + r ) * c1 + c2;
91 sum += cipher;
92 } // CheckSum::add(unsigned char)
93
94
95 /****************************************************************************
96 * CheckSum::add
97 * Inputs:
98 * LPunsigned char b: pointer to byte array
99 * unsigned int length: count
100 * Result: void
101 *
102 * Effect:
103 * Adds the bytes to the CheckSum
104 ****************************************************************************/
105
106 void CheckSum::Add ( unsigned char *b, unsigned int length )
107 {
108 for ( unsigned int i = 0; i < length; i++ )
109 Add ( b[ i ] )
110
111 ;
112 } // CheckSum::add(LPunsigned char, unsigned int)
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • TelnetTransport
SLNet::TelnetTransport Member List

This is the complete list of members for SLNet::TelnetTransport, including all inherited members.

AutoAllocate(void) | SLNet::TelnetTransport | protected
CloseConnection(SystemAddress systemAddress) | SLNet::TelnetTransport | virtual
DeallocatePacket(Packet *packet) | SLNet::TelnetTransport | virtual
GetCommandParser(void) | SLNet::TelnetTransport | virtual
HasLostConnection(void) | SLNet::TelnetTransport | virtual
HasNewIncomingConnection(void) | SLNet::TelnetTransport | virtual
ReassembleLine(TelnetTransport::TelnetClient *telnetClient, unsigned char c) | SLNet::TelnetTransport | protected
Receive(void) | SLNet::TelnetTransport | virtual
remoteClients | SLNet::TelnetTransport | protected
Send(SystemAddress systemAddress, const char *data,...) | SLNet::TelnetTransport | virtual
sendPrefix | SLNet::TelnetTransport | protected
sendSuffix | SLNet::TelnetTransport | protected
SetSendPrefix(const char *prefix) | SLNet::TelnetTransport |
SetSendSuffix(const char *suffix) | SLNet::TelnetTransport |
Start(unsigned short port, bool serverMode) | SLNet::TelnetTransport | virtual
Stop(void) | SLNet::TelnetTransport | virtual
tcpInterface | SLNet::TelnetTransport | protected
TelnetTransport() | SLNet::TelnetTransport |
TransportInterface() | SLNet::TransportInterface | inline
~TelnetTransport() | SLNet::TelnetTransport | virtual
~TransportInterface() | SLNet::TransportInterface | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FilterSet
SLNet::FilterSet Member List

This is the complete list of members for SLNet::FilterSet, including all inherited members.

allowedIDs | SLNet::FilterSet
allowedRPC4 | SLNet::FilterSet
banOnDisallowedMessage | SLNet::FilterSet
banOnFilterTimeExceed | SLNet::FilterSet
disallowedCallbackUserData | SLNet::FilterSet
disallowedMessageBanTimeMS | SLNet::FilterSet
filterSetID | SLNet::FilterSet
invalidMessageCallback | SLNet::FilterSet
kickOnDisallowedMessage | SLNet::FilterSet
maxMemberTimeMS | SLNet::FilterSet
timeExceedBanTimeMS | SLNet::FilterSet
timeoutCallback | SLNet::FilterSet
timeoutUserData | SLNet::FilterSet
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/AutopatcherRepositoryInterface.h Source File

  • include
  • slikenet
AutopatcherRepositoryInterface.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __AUTOPATCHER_REPOSITORY_INTERFACE_H
23 #define __AUTOPATCHER_REPOSITORY_INTERFACE_H
24
25 #include "IncrementalReadInterface.h"
26 #include "SimpleMutex.h"
27
28 namespace SLNet
29 {
31 class FileList;
32 class BitStream;
33
35 class AutopatcherRepositoryInterface : public IncrementalReadInterface
36 {
37 public:
45 virtual bool GetChangelistSinceDate(const char *applicationName, FileList *addedOrModifiedFilesWithHashData, FileList *deletedFiles, double sinceDate)=0;
46
53 virtual int GetPatches(const char *applicationName, FileList *input, bool allowDownloadOfOriginalUnmodifiedFiles, FileList *patchList)=0;
54
63 virtual bool GetMostRecentChangelistWithPatches(
64 SLNet::RakString &applicationName,
65 FileList *patchedFiles,
66 FileList *updatedFiles,
67 FileList *addedOrModifiedFileHashes,
68 FileList *deletedFiles,
69 double *priorRowPatchTime,
70 double *mostRecentRowPatchTime)=0;
71
73 virtual const char *GetLastError(void) const=0;
74
76 virtual const int GetIncrementalReadChunkSize(void) const=0;
77 };
78
79 } // namespace SLNet
80
81 #endif
82
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Multilist.h Source File

  • include
  • slikenet
DS_Multilist.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21 #ifndef __MULTILIST_H
22 #define __MULTILIST_H
23
24 #include "assert.h"
25 #include <string.h> // memmove
26 #include "Export.h"
27 #include "memoryoverride.h"
28 #include "NativeTypes.h"
29
30
32 enum MultilistType
33 {
35 ML_UNORDERED_LIST,
37 ML_STACK,
39 ML_QUEUE,
41 ML_ORDERED_LIST,
43 ML_VARIABLE_DURING_RUNTIME
44 };
45
48 namespace DataStructures
49 {
52 template <class templateType>
53 void DeletePtr_RakNet(templateType &ptr, const char *file, unsigned int line ) { SLNet::OP_DELETE(ptr, file, line);}
54
57 template <class templateType>
58 void DeletePtr(templateType &ptr) {delete ptr;}
59
65 template < class templateType >
66 class MLKeyRef
67 {
68 public:
69 MLKeyRef(const templateType& input) : val(input) {}
70 const templateType &Get(void) const {return val;}
71 bool operator<( const templateType &right ) {return val < right;}
72 bool operator>( const templateType &right ) {return val > right;}
73 bool operator==( const templateType &right ) {return val == right;}
74 protected:
75 const templateType &val;
76 private:
77 // MLKeyRef is not copy-assignable
78 MLKeyRef& operator=(const MLKeyRef& master);
79 };
80
86 #define DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS( _CLASS_NAME_, _KEY_TYPE_, _MEMBER_VARIABLE_NAME_ ) \
87 bool operator<( const DataStructures::MLKeyRef<_KEY_TYPE_> &inputKey, const _CLASS_NAME_ *cls ) {return inputKey.Get() < cls->_MEMBER_VARIABLE_NAME_;} \
88 bool operator>( const DataStructures::MLKeyRef<_KEY_TYPE_> &inputKey, const _CLASS_NAME_ *cls ) {return inputKey.Get() > cls->_MEMBER_VARIABLE_NAME_;} \
89 bool operator==( const DataStructures::MLKeyRef<_KEY_TYPE_> &inputKey, const _CLASS_NAME_ *cls ) {return inputKey.Get() == cls->_MEMBER_VARIABLE_NAME_;}
90
91 typedef uint32_t DefaultIndexType;
92
98 template <const MultilistType _MultilistType, class _DataType, class _KeyType=_DataType, class _IndexType=DefaultIndexType>
99 class RAK_DLL_EXPORT Multilist
100 {
101 public:
102 Multilist();
103 ~Multilist();
104 Multilist( const Multilist& source );
105 Multilist& operator= ( const Multilist& source );
106 _DataType& operator[] ( const _IndexType position ) const;
110 void Push(const _DataType &d, const char *file=__FILE__, unsigned int line=__LINE__ );
111 void Push(const _DataType &d, const _KeyType &key, const char *file=__FILE__, unsigned int line=__LINE__ );
112
115 _DataType &Pop(const char *file=__FILE__, unsigned int line=__LINE__);
116 _DataType &Peek(void) const;
117
120 void PushOpposite(const _DataType &d, const char *file=__FILE__, unsigned int line=__LINE__ );
121 void PushOpposite(const _DataType &d, const _KeyType &key, const char *file=__FILE__, unsigned int line=__LINE__ );
122
124 _DataType &PopOpposite(const char *file=__FILE__, unsigned int line=__LINE__);
125 _DataType &PeekOpposite(void) const;
126
129 void InsertAtIndex(const _DataType &d, _IndexType index, const char *file=__FILE__, unsigned int line=__LINE__);
130
135 void RemoveAtIndex(_IndexType position, const char *file=__FILE__, unsigned int line=__LINE__);
136
138 bool RemoveAtKey(_KeyType key, bool assertIfDoesNotExist, const char *file=__FILE__, unsigned int line=__LINE__);
139
141 _IndexType GetIndexOf(_KeyType key) const;
142
145 _IndexType GetInsertionIndex(_KeyType key) const;
146
148 _DataType GetPtr(_KeyType key) const;
149
151 void ForEach(void (*func)(_DataType &item, const char *file, unsigned int line), const char *file, unsigned int line);
152 void ForEach(void (*func)(_DataType &item));
153
155 bool IsEmpty(void) const;
156
158 _IndexType GetSize(void) const;
159
162 void Clear( bool deallocateSmallBlocks=true, const char *file=__FILE__, unsigned int line=__LINE__ );
163
166 void ClearPointers( bool deallocateSmallBlocks=true, const char *file=__FILE__, unsigned int line=__LINE__ );
167
169 void ClearPointer( _KeyType key, const char *file=__FILE__, unsigned int line=__LINE__ );
170
173 void ReverseList(void);
174
177 void Reallocate(_IndexType size, const char *file=__FILE__, unsigned int line=__LINE__);
178
182 void Sort(bool force);
183
186 void TagSorted(void);
187
190 void SetSortOrder(bool ascending);
191
193 bool GetSortOrder(void) const;
194
198 bool IsSorted(void) const;
199
201 MultilistType GetMultilistType(void) const;
202
206 void SetMultilistType(MultilistType newType);
207
210 static void FindIntersection(
211 Multilist& source1,
212 Multilist& source2,
213 Multilist& intersection,
214 Multilist& uniqueToSource1,
215 Multilist& uniqueToSource2);
216
217 protected:
218 void ReallocateIfNeeded(const char *file, unsigned int line);
219 void DeallocateIfNeeded(const char *file, unsigned int line);
220 void ReallocToSize(_IndexType newAllocationSize, const char *file, unsigned int line);
221 void ReverseListInternal(void);
222 void InsertInOrderedList(const _DataType &d, const _KeyType &key);
223 _IndexType GetIndexFromKeyInSortedList(const _KeyType &key, bool *objectExists) const;
224 void InsertShiftArrayRight(const _DataType &d, _IndexType index);
225 void DeleteShiftArrayLeft(_IndexType index);
226 void QSortAscending(_IndexType left, _IndexType right);
227 void QSortDescending(_IndexType left, _IndexType right);
228 void CopySource( const Multilist& source );
229
231 _DataType* data;
232
234 _IndexType dataSize;
235
237 _IndexType allocationSize;
238
240 _IndexType queueHead;
241
243 _IndexType queueTail;
244
247 _IndexType preallocationSize;
248
249 enum
250 {
251 ML_UNSORTED,
252 ML_SORTED_ASCENDING,
253 ML_SORTED_DESCENDING
254 } sortState;
255
256 bool ascendingSort;
257
258 // In case we are using the variable type multilist
259 MultilistType variableMultilistType;
260 };
261
262 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
263 Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::Multilist()
264 {
265 data=0;
266 dataSize=0;
267 allocationSize=0;
268 ascendingSort=true;
269 sortState=ML_UNSORTED;
270 queueHead=0;
271 queueTail=0;
272 preallocationSize=0;
273
274 #pragma warning( push )
275 #pragma warning(disable:4127) // conditional expression is constant
276 if (_MultilistType==ML_ORDERED_LIST)
277 sortState=ML_SORTED_ASCENDING;
278 else
279 sortState=ML_UNSORTED;
280
281 if (_MultilistType==ML_VARIABLE_DURING_RUNTIME)
282 variableMultilistType=ML_UNORDERED_LIST;
283 #pragma warning( pop )
284 }
285
286 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
287 Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::~Multilist()
288 {
289 if (data!=0)
290 SLNet::OP_DELETE_ARRAY(data, _FILE_AND_LINE_);
291 }
292
293 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
294 Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::Multilist( const Multilist& source )
295 {
296 CopySource(source);
297 }
298
299 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
300 Multilist<_MultilistType, _DataType, _KeyType, _IndexType>& Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::operator= ( const Multilist& source )
301 {
302 Clear(true);
303 CopySource(source);
304 return *this;
305 }
306
307 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
308 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::CopySource( const Multilist& source )
309 {
310 dataSize=source.GetSize();
311 ascendingSort=source.ascendingSort;
312 sortState=source.sortState;
313 queueHead=0;
314 queueTail=dataSize;
315 preallocationSize=source.preallocationSize;
316 variableMultilistType=source.variableMultilistType;
317 if (source.data==0)
318 {
319 data=0;
320 allocationSize=0;
321 }
322 else
323 {
324 allocationSize=dataSize;
325 data = SLNet::OP_NEW_ARRAY<_DataType>(dataSize,_FILE_AND_LINE_);
326 _IndexType i;
327 for (i=0; i < dataSize; i++)
328 data[i]=source[i];
329 }
330 }
331
332 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
333 _DataType& Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::operator[] ( const _IndexType position ) const
334 {
335 RakAssert(position<GetSize());
336
337 if (GetMultilistType()==ML_QUEUE)
338 {
339 if ( queueHead + position >= allocationSize )
340 return data[ queueHead + position - allocationSize ];
341 else
342 return data[ queueHead + position ];
343 }
344
345 return data[position];
346 }
347
348 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
349 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::Push(const _DataType &d, const char *file, unsigned int line )
350 {
351 Push(d,d,file,line);
352 }
353
354 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
355 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::Push(const _DataType &d, const _KeyType &key, const char *file, unsigned int line )
356 {
357 ReallocateIfNeeded(file,line);
358
359 if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK)
360 {
361 data[dataSize]=d;
362 dataSize++;
363 }
364 else if (GetMultilistType()==ML_QUEUE)
365 {
366 data[queueTail++] = d;
367
368 if ( queueTail == allocationSize )
369 queueTail = 0;
370 dataSize++;
371 }
372 else
373 {
374 RakAssert(GetMultilistType()==ML_ORDERED_LIST);
375 InsertInOrderedList(d,key);
376 }
377
378 if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK || GetMultilistType()==ML_QUEUE)
379 {
380 // Break sort if no longer sorted
381 if (sortState!=ML_UNSORTED && dataSize>1)
382 {
383 if (ascendingSort)
384 {
385 if ( MLKeyRef<_KeyType>(key) < operator[](dataSize-2) )
386 sortState=ML_UNSORTED;
387 }
388 else
389 {
390 if ( MLKeyRef<_KeyType>(key) > operator[](dataSize-2) )
391 sortState=ML_UNSORTED;
392 }
393
394 sortState=ML_UNSORTED;
395 }
396 }
397 }
398
399 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
400 _DataType &Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::Pop(const char *file, unsigned int line)
401 {
402 RakAssert(IsEmpty()==false);
403 DeallocateIfNeeded(file,line);
404 if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK || GetMultilistType()==ML_ORDERED_LIST)
405 {
406 dataSize--;
407 return data[dataSize];
408 }
409 else
410 {
411 RakAssert(GetMultilistType()==ML_QUEUE);
412
413 if ( ++queueHead == allocationSize )
414 queueHead = 0;
415
416 if ( queueHead == 0 )
417 return data[ allocationSize -1 ];
418
419 dataSize--;
420 return data[ queueHead -1 ];
421 }
422 }
423
424 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
425 _DataType &Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::Peek(void) const
426 {
427 RakAssert(IsEmpty()==false);
428 if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK || GetMultilistType()==ML_ORDERED_LIST)
429 {
430 return data[dataSize-1];
431 }
432 else
433 {
434 RakAssert(GetMultilistType()==ML_QUEUE);
435 return data[ queueHead ];
436 }
437 }
438
439 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
440 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::PushOpposite(const _DataType &d, const char *file, unsigned int line )
441 {
442 PushOpposite(d,d,file,line);
443 }
444
445 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
446 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::PushOpposite(const _DataType &d, const _KeyType &key, const char *file, unsigned int line )
447 {
448 ReallocateIfNeeded(file,line);
449
450 // Unordered list Push at back
451 if (GetMultilistType()==ML_UNORDERED_LIST)
452 {
453 data[dataSize]=d;
454 dataSize++;
455 }
456 else if (GetMultilistType()==ML_STACK)
457 {
458 // Stack push at front of the list, instead of back as normal
459 InsertAtIndex(d,0,file,line);
460 }
461 else if (GetMultilistType()==ML_QUEUE)
462 {
463 // Queue push at front of the list, instead of back as normal
464 InsertAtIndex(d,0,file,line);
465 }
466 else
467 {
468 RakAssert(GetMultilistType()==ML_ORDERED_LIST);
469 InsertInOrderedList(d,key);
470 }
471
472 if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK || GetMultilistType()==ML_QUEUE)
473 {
474 // Break sort if no longer sorted
475 if (sortState!=ML_UNSORTED && dataSize>1)
476 {
477 if (ascendingSort)
478 {
479 if ( MLKeyRef<_KeyType>(key) > operator[](1) )
480 sortState=ML_UNSORTED;
481 }
482 else
483 {
484 if ( MLKeyRef<_KeyType>(key) < operator[](1) )
485 sortState=ML_UNSORTED;
486 }
487 }
488 }
489 }
490
491 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
492 _DataType &Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::PopOpposite(const char *file, unsigned int line)
493 {
494 RakAssert(IsEmpty()==false);
495 if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK || GetMultilistType()==ML_ORDERED_LIST)
496 {
497 // Copy leftmost to end
498 ReallocateIfNeeded(file,line);
499 data[dataSize]=data[0];
500 DeleteShiftArrayLeft(0);
501 --dataSize;
502 // Assuming still leaves at least one element past the end of the list allocated
503 DeallocateIfNeeded(file,line);
504 // Return end
505 return data[dataSize+1];
506 }
507 else
508 {
509 RakAssert(GetMultilistType()==ML_QUEUE);
510 // Deallocate first, since we are returning off the existing list
511 DeallocateIfNeeded(file,line);
512 dataSize--;
513
514 if (queueTail==0)
515 queueTail=allocationSize-1;
516 else
517 --queueTail;
518
519 return data[queueTail];
520 }
521 }
522
523 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
524 _DataType &Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::PeekOpposite(void) const
525 {
526 RakAssert(IsEmpty()==false);
527 if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK || GetMultilistType()==ML_ORDERED_LIST)
528 {
529 return data[0];
530 }
531 else
532 {
533 RakAssert(GetMultilistType()==ML_QUEUE);
534 _IndexType priorIndex;
535 if (queueTail==0)
536 priorIndex=allocationSize-1;
537 else
538 priorIndex=queueTail-1;
539
540 return data[priorIndex];
541 }
542 }
543
544 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
545 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::InsertAtIndex(const _DataType &d, _IndexType index, const char *file, unsigned int line)
546 {
547 ReallocateIfNeeded(file,line);
548
549 if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK || GetMultilistType()==ML_ORDERED_LIST)
550 {
551 if (index>=dataSize)
552 {
553 // insert at end
554 data[dataSize]=d;
555
556 dataSize++;
557 }
558 else
559 {
560 // insert at index
561 InsertShiftArrayRight(d,index);
562 }
563 }
564 else
565 {
566 data[queueTail++] = d;
567
568 if ( queueTail == allocationSize )
569 queueTail = 0;
570
571 ++dataSize;
572
573 if (dataSize==1)
574 return;
575
576 _IndexType writeIndex, readIndex, trueWriteIndex, trueReadIndex;
577 writeIndex=dataSize-1;
578 readIndex=writeIndex-1;
579 while (readIndex >= index)
580 {
581 if ( queueHead + writeIndex >= allocationSize )
582 trueWriteIndex = queueHead + writeIndex - allocationSize;
583 else
584 trueWriteIndex = queueHead + writeIndex;
585
586 if ( queueHead + readIndex >= allocationSize )
587 trueReadIndex = queueHead + readIndex - allocationSize;
588 else
589 trueReadIndex = queueHead + readIndex;
590
591 data[trueWriteIndex]=data[trueReadIndex];
592
593 if (readIndex==0)
594 break;
595 writeIndex--;
596 readIndex--;
597 }
598
599 if ( queueHead + index >= allocationSize )
600 trueWriteIndex = queueHead + index - allocationSize;
601 else
602 trueWriteIndex = queueHead + index;
603
604 data[trueWriteIndex]=d;
605 }
606
607 if (_MultilistType!=ML_ORDERED_LIST)
608 sortState=ML_UNSORTED;
609 }
610
611 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
612 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::RemoveAtIndex(_IndexType position, const char *file, unsigned int line)
613 {
614 RakAssert(position < dataSize);
615 RakAssert(IsEmpty()==false);
616
617 if (GetMultilistType()==ML_UNORDERED_LIST)
618 {
619 // Copy tail to current
620 data[position]=data[dataSize-1];
621 }
622 else if (GetMultilistType()==ML_STACK || GetMultilistType()==ML_ORDERED_LIST)
623 {
624 DeleteShiftArrayLeft(position);
625 }
626 else
627 {
628 RakAssert(GetMultilistType()==ML_QUEUE);
629
630 _IndexType index, next;
631
632 if ( queueHead + position >= allocationSize )
633 index = queueHead + position - allocationSize;
634 else
635 index = queueHead + position;
636
637 next = index + 1;
638
639 if ( next == allocationSize )
640 next = 0;
641
642 while ( next != queueTail )
643 {
644 // Overwrite the previous element
645 data[ index ] = data[ next ];
646 index = next;
647 //next = (next + 1) % allocationSize;
648
649 if ( ++next == allocationSize )
650 next = 0;
651 }
652
653 // Move the queueTail back
654 if ( queueTail == 0 )
655 queueTail = allocationSize - 1;
656 else
657 --queueTail;
658 }
659
660
661 dataSize--;
662 DeallocateIfNeeded(file,line);
663 }
664
665 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
666 bool Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::RemoveAtKey(_KeyType key, bool assertIfDoesNotExist, const char *file, unsigned int line)
667 {
668 _IndexType index = GetIndexOf(key);
669 if (index==(_IndexType)-1)
670 {
671 RakAssert(assertIfDoesNotExist==false && "RemoveAtKey element not found");
672 return false;
673 }
674 RemoveAtIndex(index,file,line);
675 return true;
676 }
677
678 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
679 _IndexType Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::GetIndexOf(_KeyType key) const
680 {
681 _IndexType i;
682 if (IsSorted())
683 {
684 bool objectExists;
685 i=GetIndexFromKeyInSortedList(key, &objectExists);
686 if (objectExists)
687 return i;
688 return (_IndexType)-1;
689 }
690 else if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK)
691 {
692 for (i=0; i < dataSize; i++)
693 {
694 if (MLKeyRef<_KeyType>(key)==data[i])
695 return i;
696 }
697 return (_IndexType)-1;
698 }
699 else
700 {
701 RakAssert( GetMultilistType()==ML_QUEUE );
702
703 for (i=0; i < dataSize; i++)
704 {
705 if (MLKeyRef<_KeyType>(key)==operator[](i))
706 return i;
707 }
708 return (_IndexType)-1;
709 }
710 }
711
712 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
713 _IndexType Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::GetInsertionIndex(_KeyType key) const
714 {
715 _IndexType i;
716 if (IsSorted())
717 {
718 bool objectExists;
719 i=GetIndexFromKeyInSortedList(key, &objectExists);
720 if (objectExists)
721 return (_IndexType)-1;
722 return i;
723 }
724 else if (GetMultilistType()==ML_UNORDERED_LIST || GetMultilistType()==ML_STACK)
725 {
726 for (i=0; i < dataSize; i++)
727 {
728 if (MLKeyRef<_KeyType>(key)==data[i])
729 return (_IndexType)-1;
730 }
731 return dataSize;
732 }
733 else
734 {
735 RakAssert( GetMultilistType()==ML_QUEUE );
736
737 for (i=0; i < dataSize; i++)
738 {
739 if (MLKeyRef<_KeyType>(key)==operator[](i))
740 return (_IndexType)-1;
741 }
742 return dataSize;
743 }
744 }
745
746 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
747 _DataType Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::GetPtr(_KeyType key) const
748 {
749 _IndexType i = GetIndexOf(key);
750 if (i==(_IndexType)-1)
751 return 0;
752 return data[i];
753 }
754
755 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
756 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::ForEach(void (*func)(_DataType &item, const char *file, unsigned int line), const char *file, unsigned int line)
757 {
758 _IndexType i;
759 for (i=0; i < dataSize; i++)
760 func(operator[](i), file, line);
761 }
762
763 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
764 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::ForEach(void (*func)(_DataType &item))
765 {
766 _IndexType i;
767 for (i=0; i < dataSize; i++)
768 func(operator[](i));
769 }
770
771 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
772 bool Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::IsEmpty(void) const
773 {
774 return dataSize==0;
775 }
776
777 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
778 _IndexType Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::GetSize(void) const
779 {
780 return dataSize;
781 }
782
783 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
784 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::Clear( bool deallocateSmallBlocks, const char *file, unsigned int line )
785 {
786 dataSize=0;
787 if (GetMultilistType()==ML_ORDERED_LIST)
788 if (ascendingSort)
789 sortState=ML_SORTED_ASCENDING;
790 else
791 sortState=ML_SORTED_DESCENDING;
792 else
793 sortState=ML_UNSORTED;
794 queueHead=0;
795 queueTail=0;
796
797 if (deallocateSmallBlocks && allocationSize < 128 && data)
798 {
799 SLNet::OP_DELETE_ARRAY(data,file,line);
800 data=0;
801 allocationSize=0;
802 }
803 }
804
805 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
806 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::ClearPointers( bool deallocateSmallBlocks, const char *file, unsigned int line )
807 {
808 _IndexType i;
809 for (i=0; i < dataSize; i++)
810 SLNet::OP_DELETE(operator[](i), file, line);
811 Clear(deallocateSmallBlocks, file, line);
812 }
813
814 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
815 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::ClearPointer( _KeyType key, const char *file, unsigned int line )
816 {
817 _IndexType i;
818 i = GetIndexOf(key);
819 if (i!=-1)
820 {
821 SLNet::OP_DELETE(operator[](i), file, line);
822 RemoveAtIndex(i);
823 }
824 }
825
826 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
827 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::ReverseList(void)
828 {
829 if (IsSorted())
830 ascendingSort=!ascendingSort;
831
832 ReverseListInternal();
833 }
834
835 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
836 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::Reallocate(_IndexType size, const char *file, unsigned int line)
837 {
838 _IndexType newAllocationSize;
839 if (size < dataSize)
840 newAllocationSize=dataSize;
841 else
842 newAllocationSize=size;
843 preallocationSize=size;
844 ReallocToSize(newAllocationSize,file,line);
845 }
846
847 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
848 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::Sort(bool force)
849 {
850 if (IsSorted() && force==false)
851 return;
852
853 if (dataSize>1)
854 {
855 if (ascendingSort)
856 QSortAscending(0,dataSize-1);
857 else
858 QSortDescending(0,dataSize-1);
859 }
860
861 TagSorted();
862 }
863
864 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
865 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::TagSorted(void)
866 {
867 if (ascendingSort)
868 sortState=ML_SORTED_ASCENDING;
869 else
870 sortState=ML_SORTED_DESCENDING;
871 }
872
873 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
874 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::QSortAscending(_IndexType leftEdge, _IndexType rightEdge)
875 {
876 _DataType temp;
877 _IndexType left=leftEdge;
878 _IndexType right=rightEdge;
879 _IndexType pivotIndex=left++;
880
881 while (left<right)
882 {
883 if (data[left] <= data[pivotIndex])
884 {
885 ++left;
886 }
887 else
888 {
889 temp=data[left];
890 data[left]=data[right];
891 data[right]=temp;
892 --right;
893 }
894 }
895
896 temp=data[pivotIndex];
897
898 // Move pivot to center
899 if (data[left] > data[pivotIndex])
900 {
901 --left;
902
903 data[pivotIndex]=data[left];
904 data[left]=temp;
905 }
906 else
907 {
908 data[pivotIndex]=data[left];
909 data[left]=temp;
910
911 --left;
912 }
913
914 if (left!=leftEdge)
915 QSortAscending(leftEdge, left);
916
917 if (right!=rightEdge)
918 QSortAscending(right, rightEdge);
919 }
920
921 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
922 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::QSortDescending(_IndexType leftEdge, _IndexType rightEdge)
923 {
924 _DataType temp;
925 _IndexType left=leftEdge;
926 _IndexType right=rightEdge;
927 _IndexType pivotIndex=left++;
928
929 while (left<right)
930 {
931 if (data[left] >= data[pivotIndex])
932 {
933 ++left;
934 }
935 else
936 {
937 temp=data[left];
938 data[left]=data[right];
939 data[right]=temp;
940 --right;
941 }
942 }
943
944 temp=data[pivotIndex];
945
946 // Move pivot to center
947 if (data[left] < data[pivotIndex])
948 {
949 --left;
950
951 data[pivotIndex]=data[left];
952 data[left]=temp;
953 }
954 else
955 {
956 data[pivotIndex]=data[left];
957 data[left]=temp;
958
959 --left;
960 }
961
962 if (left!=leftEdge)
963 QSortDescending(leftEdge, left);
964
965 if (right!=rightEdge)
966 QSortDescending(right, rightEdge);
967 }
968
969 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
970 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::SetSortOrder(bool ascending)
971 {
972 if (ascendingSort!=ascending && IsSorted())
973 {
974 ascendingSort=ascending;
975 // List is sorted, and the sort order has changed. So reverse the list
976 ReverseListInternal();
977 }
978 else
979 ascendingSort=ascending;
980 }
981
982 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
983 bool Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::GetSortOrder(void) const
984 {
985 return ascendingSort;
986 }
987
988 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
989 bool Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::IsSorted(void) const
990 {
991 return GetMultilistType()==ML_ORDERED_LIST || sortState!=ML_UNSORTED;
992 }
993
994 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
995 MultilistType Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::GetMultilistType(void) const
996 {
997 #pragma warning( push )
998 #pragma warning(disable:4127) // conditional expression is constant
999 if (_MultilistType==ML_VARIABLE_DURING_RUNTIME)
1000 #pragma warning( pop )
1001 return variableMultilistType;
1002 return _MultilistType;
1003 }
1004
1005 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1006 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::SetMultilistType(MultilistType newType)
1007 {
1008 RakAssert(_MultilistType==ML_VARIABLE_DURING_RUNTIME);
1009 switch (variableMultilistType)
1010 {
1011 case ML_UNORDERED_LIST:
1012 switch (newType)
1013 {
1014 case ML_UNORDERED_LIST:
1015 // No change
1016 break;
1017 case ML_STACK:
1018 // Same data format
1019 break;
1020 case ML_QUEUE:
1021 queueHead=0;
1022 queueTail=dataSize;
1023 break;
1024 case ML_ORDERED_LIST:
1025 Sort(false);
1026 break;
1027 }
1028 break;
1029 case ML_STACK:
1030 switch (newType)
1031 {
1032 case ML_UNORDERED_LIST:
1033 // Same data format
1034 break;
1035 case ML_STACK:
1036 // No change
1037 break;
1038 case ML_QUEUE:
1039 queueHead=0;
1040 queueTail=dataSize;
1041 break;
1042 case ML_ORDERED_LIST:
1043 Sort(false);
1044 break;
1045 }
1046 break;
1047 case ML_QUEUE:
1048 switch (newType)
1049 {
1050 case ML_UNORDERED_LIST:
1051 case ML_STACK:
1052 case ML_ORDERED_LIST:
1053 if (queueTail < queueHead)
1054 {
1055 // Realign data if wrapped
1056 ReallocToSize(dataSize, _FILE_AND_LINE_);
1057 }
1058 else
1059 {
1060 // Else can just copy starting at head
1061 _IndexType i;
1062 for (i=0; i < dataSize; i++)
1063 data[i]=operator[](i);
1064 }
1065 if (newType==ML_ORDERED_LIST)
1066 Sort(false);
1067 break;
1068 case ML_QUEUE:
1069 // No change
1070 break;
1071 }
1072 break;
1073 case ML_ORDERED_LIST:
1074 switch (newType)
1075 {
1076 case ML_UNORDERED_LIST:
1077 case ML_STACK:
1078 case ML_QUEUE:
1079 // Same data format
1080 // Tag as sorted
1081 if (ascendingSort)
1082 sortState=ML_SORTED_ASCENDING;
1083 else
1084 sortState=ML_SORTED_DESCENDING;
1085 if (newType==ML_QUEUE)
1086 {
1087 queueHead=0;
1088 queueTail=dataSize;
1089 }
1090 break;
1091 case ML_ORDERED_LIST:
1092 // No change
1093 break;
1094 }
1095 break;
1096 }
1097
1098 variableMultilistType=newType;
1099 }
1100
1101 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1102 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::FindIntersection(
1103 Multilist& source1,
1104 Multilist& source2,
1105 Multilist& intersection,
1106 Multilist& uniqueToSource1,
1107 Multilist& uniqueToSource2)
1108 {
1109 _IndexType index1=0, index2=0;
1110 source1.SetSortOrder(true);
1111 source2.SetSortOrder(true);
1112 source1.Sort(false);
1113 source2.Sort(false);
1114 intersection.Clear(true,_FILE_AND_LINE_);
1115 uniqueToSource1.Clear(true,_FILE_AND_LINE_);
1116 uniqueToSource2.Clear(true,_FILE_AND_LINE_);
1117
1118 while (index1 < source1.GetSize() && index2 < source2.GetSize())
1119 {
1120 if (source1[index1]<source2[index2])
1121 {
1122 uniqueToSource1.Push(source1[index1],_FILE_AND_LINE_);
1123 index1++;
1124 }
1125 else if (source1[index1]==source2[index2])
1126 {
1127 intersection.Push(source1[index1],_FILE_AND_LINE_);
1128 index1++;
1129 index2++;
1130 }
1131 else
1132 {
1133 uniqueToSource2.Push(source2[index2],_FILE_AND_LINE_);
1134 index2++;
1135 }
1136 }
1137 while (index1 < source1.GetSize())
1138 {
1139 uniqueToSource1.Push(source1[index1],_FILE_AND_LINE_);
1140 index1++;
1141 }
1142 while (index2 < source2.GetSize())
1143 {
1144 uniqueToSource2.Push(source2[index2],_FILE_AND_LINE_);
1145 index2++;
1146 }
1147 }
1148
1149 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1150 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::ReallocateIfNeeded(const char *file, unsigned int line)
1151 {
1152 if (dataSize<allocationSize)
1153 return;
1154
1155 _IndexType newAllocationSize;
1156 if (allocationSize<16)
1157 newAllocationSize=32;
1158 else if (allocationSize>65536)
1159 newAllocationSize=allocationSize+65536;
1160 else
1161 {
1162 newAllocationSize=allocationSize<<1; // * 2
1163 // Protect against underflow
1164 if (newAllocationSize < allocationSize)
1165 newAllocationSize=allocationSize+65536;
1166 }
1167
1168 ReallocToSize(newAllocationSize,file,line);
1169 }
1170
1171 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1172 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::DeallocateIfNeeded(const char *file, unsigned int line)
1173 {
1174 if (allocationSize<512)
1175 return;
1176 if (dataSize >= allocationSize/3 )
1177 return;
1178 if (dataSize <= preallocationSize )
1179 return;
1180
1181 _IndexType newAllocationSize = dataSize<<1; // * 2
1182
1183 ReallocToSize(newAllocationSize,file,line);
1184 }
1185
1186 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1187 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::ReallocToSize(_IndexType newAllocationSize, const char *file, unsigned int line)
1188 {
1189 _DataType* newData = SLNet::OP_NEW_ARRAY<_DataType>(newAllocationSize,file,line);
1190 _IndexType i;
1191 for (i=0; i < dataSize; i++)
1192 newData[i]=operator[](i);
1193 if (dataSize>0)
1194 {
1195 SLNet::OP_DELETE_ARRAY(data,file,line);
1196 if (GetMultilistType()==ML_QUEUE)
1197 {
1198 queueHead=0;
1199 queueTail=dataSize;
1200 }
1201 }
1202 data=newData;
1203 allocationSize=newAllocationSize;
1204 }
1205
1206 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1207 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::ReverseListInternal(void)
1208 {
1209 _DataType temp;
1210 _IndexType i;
1211 for (i=0; i < dataSize/2; i++)
1212 {
1213 temp=operator[](i);
1214 operator[](i)=operator[](dataSize-1-i);
1215 operator[](dataSize-1-i)=temp;
1216 }
1217 }
1218
1219 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1220 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::InsertInOrderedList(const _DataType &d, const _KeyType &key)
1221 {
1222 RakAssert(GetMultilistType()==ML_ORDERED_LIST);
1223
1224 bool objectExists;
1225 _IndexType index;
1226 index = GetIndexFromKeyInSortedList(key, &objectExists);
1227
1228 // if (objectExists)
1229 // {
1230 // Ordered list only allows unique insertions
1231 // RakAssert("Duplicate insertion into ordered list" && false);
1232 // return;
1233 // }
1234
1235 if (index>=dataSize)
1236 {
1237 // insert at end
1238 data[dataSize]=d;
1239 dataSize++;
1240 }
1241 else
1242 {
1243 // insert at index
1244 InsertShiftArrayRight(d,index);
1245 }
1246 }
1247
1248 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1249 _IndexType Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::GetIndexFromKeyInSortedList(const _KeyType &key, bool *objectExists) const
1250 {
1251 RakAssert(IsSorted());
1252 _IndexType index, upperBound, lowerBound;
1253
1254 if (dataSize==0)
1255 {
1256 *objectExists=false;
1257 return 0;
1258 }
1259
1260 upperBound=dataSize-1;
1261 lowerBound=0;
1262 index = dataSize/2;
1263
1264 for(;;)
1265 {
1266 if (MLKeyRef<_KeyType>(key) > operator[](index) )
1267 {
1268 if (ascendingSort)
1269 lowerBound=index+1;
1270 else
1271 upperBound=index-1;
1272 }
1273 else if (MLKeyRef<_KeyType>(key) < operator[](index) )
1274 {
1275 if (ascendingSort)
1276 upperBound=index-1;
1277 else
1278 lowerBound=index+1;
1279 }
1280 else
1281 {
1282 // ==
1283 *objectExists=true;
1284 return index;
1285 }
1286
1287 index=lowerBound+(upperBound-lowerBound)/2;
1288
1289 if (lowerBound>upperBound || upperBound==(_IndexType)-1)
1290 {
1291 *objectExists=false;
1292 return lowerBound; // No match
1293 }
1294 }
1295 }
1296
1297 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1298 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::InsertShiftArrayRight(const _DataType &d, _IndexType index)
1299 {
1300 RakAssert(_MultilistType!=ML_QUEUE);
1301
1302 // Move the elements in the list to make room
1303 _IndexType i;
1304 for ( i = dataSize; i != index; i-- )
1305 data[ i ] = data[ i - 1 ];
1306
1307 // Insert the new item at the correct spot
1308 data[ index ] = d;
1309
1310 ++dataSize;
1311 }
1312
1313 template <const MultilistType _MultilistType, class _DataType, class _KeyType, class _IndexType>
1314 void Multilist<_MultilistType, _DataType, _KeyType, _IndexType>::DeleteShiftArrayLeft( _IndexType index )
1315 {
1316 RakAssert(index < dataSize);
1317 RakAssert(_MultilistType!=ML_QUEUE);
1318
1319 _IndexType i;
1320 for ( i = index; i < dataSize-1; i++ )
1321 data[i]=data[i+1];
1322 }
1323 };
1324
1325 /*
1326 struct KeyAndValue
1327 {
1328 int key;
1329 short value;
1330 };
1331
1332 DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS(KeyAndValue,int,key)
1333
1334 void MultilistUnitTest(void)
1335 {
1336 DataStructures::DefaultIndexType oldSize;
1337 DataStructures::Multilist<ML_UNORDERED_LIST, int> ml1;
1338 ml1.Reallocate(64);
1339 RakAssert(ml1.IsEmpty());
1340 ml1.Push(53);
1341 RakAssert(ml1.Peek()==53);
1342 RakAssert(ml1.IsEmpty()==false);
1343 RakAssert(ml1.Pop()==53);
1344 RakAssert(ml1.IsEmpty()==true);
1345 for (int i=0; i < 512; i++)
1346 ml1.Push(i);
1347 RakAssert(ml1.GetIndexOf(200)==200);
1348 RakAssert(ml1.PeekOpposite()==0);
1349 RakAssert(ml1.PopOpposite()==0);
1350 RakAssert(ml1.PeekOpposite()==1);
1351 RakAssert(ml1.Peek()==511);
1352 ml1.ReverseList();
1353 for (int i=0; i < 511; i++)
1354 RakAssert(ml1[i]==511-i);
1355 RakAssert(ml1.PeekOpposite()==511);
1356 RakAssert(ml1.Peek()==1);
1357 oldSize = ml1.GetSize();
1358 ml1.RemoveAtIndex(0);
1359 RakAssert(ml1.GetSize()==oldSize-1);
1360 RakAssert(ml1.PeekOpposite()==1);
1361 ml1.Clear(_FILE_AND_LINE_);
1362 RakAssert(ml1.IsEmpty()==true);
1363
1364 ml1.Sort(true);
1365 ml1.Clear(_FILE_AND_LINE_);
1366
1367 ml1.Push(100);
1368 ml1.Sort(true);
1369 ml1.Clear(_FILE_AND_LINE_);
1370
1371 ml1.Push(50);
1372 ml1.Push(100);
1373 ml1.Sort(true);
1374 ml1.Clear(_FILE_AND_LINE_);
1375
1376 ml1.Push(100);
1377 ml1.Push(50);
1378 ml1.Sort(true);
1379 ml1.Clear(_FILE_AND_LINE_);
1380
1381 ml1.Push(100);
1382 ml1.Push(50);
1383 ml1.Push(150);
1384 ml1.Push(25);
1385 ml1.Push(175);
1386 ml1.Sort(true);
1387 RakAssert(ml1[0]==25);
1388 RakAssert(ml1[1]==50);
1389 RakAssert(ml1[2]==100);
1390 RakAssert(ml1[3]==150);
1391 RakAssert(ml1[4]==175);
1392 RakAssert(ml1.GetIndexOf(25)==0);
1393 RakAssert(ml1.GetIndexOf(50)==1);
1394 RakAssert(ml1.GetIndexOf(100)==2);
1395 RakAssert(ml1.GetIndexOf(150)==3);
1396 RakAssert(ml1.GetIndexOf(175)==4);
1397 ml1.Clear(_FILE_AND_LINE_);
1398
1399 ml1.Push(1);
1400 ml1.Push(2);
1401 ml1.Push(3);
1402 ml1.Push(4);
1403 ml1.Push(5);
1404 ml1.Sort(true);
1405 RakAssert(ml1[0]==1);
1406 RakAssert(ml1[1]==2);
1407 RakAssert(ml1[2]==3);
1408 RakAssert(ml1[3]==4);
1409 RakAssert(ml1[4]==5);
1410 RakAssert(ml1.GetIndexOf(1)==0);
1411 RakAssert(ml1.GetIndexOf(2)==1);
1412 RakAssert(ml1.GetIndexOf(3)==2);
1413 RakAssert(ml1.GetIndexOf(4)==3);
1414 RakAssert(ml1.GetIndexOf(5)==4);
1415 ml1.Clear(_FILE_AND_LINE_);
1416
1417 ml1.Push(5);
1418 ml1.Push(4);
1419 ml1.Push(3);
1420 ml1.Push(2);
1421 ml1.Push(1);
1422 ml1.Sort(true);
1423 RakAssert(ml1[0]==1);
1424 RakAssert(ml1[1]==2);
1425 RakAssert(ml1[2]==3);
1426 RakAssert(ml1[3]==4);
1427 RakAssert(ml1[4]==5);
1428 RakAssert(ml1.GetIndexOf(1)==0);
1429 RakAssert(ml1.GetIndexOf(2)==1);
1430 RakAssert(ml1.GetIndexOf(3)==2);
1431 RakAssert(ml1.GetIndexOf(4)==3);
1432 RakAssert(ml1.GetIndexOf(5)==4);
1433 ml1.Sort(true);
1434 RakAssert(ml1[0]==1);
1435 RakAssert(ml1[1]==2);
1436 RakAssert(ml1[2]==3);
1437 RakAssert(ml1[3]==4);
1438 RakAssert(ml1[4]==5);
1439 RakAssert(ml1.GetIndexOf(1)==0);
1440 RakAssert(ml1.GetIndexOf(2)==1);
1441 RakAssert(ml1.GetIndexOf(3)==2);
1442 RakAssert(ml1.GetIndexOf(4)==3);
1443 RakAssert(ml1.GetIndexOf(5)==4);
1444 ml1.Clear(_FILE_AND_LINE_);
1445
1446 DataStructures::Multilist<ML_STACK, int> ml2;
1447 ml2.Reallocate(64);
1448 RakAssert(ml2.IsEmpty());
1449 ml2.Push(53);
1450 RakAssert(ml2.Peek()==53);
1451 RakAssert(ml2.IsEmpty()==false);
1452 RakAssert(ml2.Pop()==53);
1453 RakAssert(ml2.IsEmpty()==true);
1454 for (int i=0; i < 512; i++)
1455 ml2.Push(i);
1456 RakAssert(ml2.GetIndexOf(200)==200);
1457 RakAssert(ml2.PeekOpposite()==0);
1458 RakAssert(ml2.PopOpposite()==0);
1459 RakAssert(ml2.PeekOpposite()==1);
1460 RakAssert(ml2.Peek()==511);
1461 ml2.ReverseList();
1462 for (int i=0; i < 511; i++)
1463 RakAssert(ml2[i]==511-i);
1464 RakAssert(ml2.PeekOpposite()==511);
1465 RakAssert(ml2.Peek()==1);
1466 oldSize = ml2.GetSize();
1467 ml2.RemoveAtIndex(0);
1468 RakAssert(ml2.GetSize()==oldSize-1);
1469 RakAssert(ml2.Peek()==1);
1470 RakAssert(ml2.PeekOpposite()==510);
1471 ml2.Clear(_FILE_AND_LINE_);
1472 RakAssert(ml2.IsEmpty()==true);
1473
1474 DataStructures::Multilist<ML_QUEUE, int> ml3;
1475 RakAssert(ml3.IsEmpty());
1476 ml3.Push(53);
1477 RakAssert(ml3.Peek()==53);
1478 RakAssert(ml3.IsEmpty()==false);
1479 RakAssert(ml3.Pop()==53);
1480 RakAssert(ml3.IsEmpty()==true);
1481 for (int i=0; i < 512; i++)
1482 ml3.Push(i);
1483 RakAssert(ml3.GetIndexOf(200)==200);
1484 RakAssert(ml3.PeekOpposite()==511);
1485 RakAssert(ml3.PopOpposite()==511);
1486 RakAssert(ml3.PeekOpposite()==510);
1487 RakAssert(ml3.Peek()==0);
1488 ml3.ReverseList();
1489 for (int i=0; i < 511; i++)
1490 RakAssert(ml3[i]==511-1-i);
1491 RakAssert(ml3.PeekOpposite()==0);
1492 RakAssert(ml3.Peek()==510);
1493 oldSize = ml3.GetSize();
1494 ml3.RemoveAtIndex(0);
1495 RakAssert(ml3.GetSize()==oldSize-1);
1496 RakAssert(ml3.Peek()==509);
1497 RakAssert(ml3.PeekOpposite()==0);
1498 ml3.Clear(_FILE_AND_LINE_);
1499 RakAssert(ml3.IsEmpty()==true);
1500
1501 ml3.PushOpposite(100);
1502 ml3.PushOpposite(50);
1503 ml3.PushOpposite(150);
1504 ml3.PushOpposite(25);
1505 ml3.PushOpposite(175);
1506 ml3.Sort(true);
1507 RakAssert(ml3[0]==25);
1508 RakAssert(ml3[1]==50);
1509 RakAssert(ml3[2]==100);
1510 RakAssert(ml3[3]==150);
1511 RakAssert(ml3[4]==175);
1512 RakAssert(ml3.GetIndexOf(25)==0);
1513 RakAssert(ml3.GetIndexOf(50)==1);
1514 RakAssert(ml3.GetIndexOf(100)==2);
1515 RakAssert(ml3.GetIndexOf(150)==3);
1516 RakAssert(ml3.GetIndexOf(175)==4);
1517 ml3.Clear(_FILE_AND_LINE_);
1518
1519 ml3.PushOpposite(1);
1520 ml3.PushOpposite(2);
1521 ml3.PushOpposite(3);
1522 ml3.PushOpposite(4);
1523 ml3.PushOpposite(5);
1524 ml3.Sort(true);
1525 RakAssert(ml3[0]==1);
1526 RakAssert(ml3[1]==2);
1527 RakAssert(ml3[2]==3);
1528 RakAssert(ml3[3]==4);
1529 RakAssert(ml3[4]==5);
1530 RakAssert(ml3.GetIndexOf(1)==0);
1531 RakAssert(ml3.GetIndexOf(2)==1);
1532 RakAssert(ml3.GetIndexOf(3)==2);
1533 RakAssert(ml3.GetIndexOf(4)==3);
1534 RakAssert(ml3.GetIndexOf(5)==4);
1535 ml3.Clear(_FILE_AND_LINE_);
1536
1537 ml3.PushOpposite(5);
1538 ml3.PushOpposite(4);
1539 ml3.PushOpposite(3);
1540 ml3.PushOpposite(2);
1541 ml3.PushOpposite(1);
1542 ml3.Sort(true);
1543 RakAssert(ml3[0]==1);
1544 RakAssert(ml3[1]==2);
1545 RakAssert(ml3[2]==3);
1546 RakAssert(ml3[3]==4);
1547 RakAssert(ml3[4]==5);
1548 RakAssert(ml3.GetIndexOf(1)==0);
1549 RakAssert(ml3.GetIndexOf(2)==1);
1550 RakAssert(ml3.GetIndexOf(3)==2);
1551 RakAssert(ml3.GetIndexOf(4)==3);
1552 RakAssert(ml3.GetIndexOf(5)==4);
1553 ml3.Sort(true);
1554 RakAssert(ml3[0]==1);
1555 RakAssert(ml3[1]==2);
1556 RakAssert(ml3[2]==3);
1557 RakAssert(ml3[3]==4);
1558 RakAssert(ml3[4]==5);
1559 RakAssert(ml3.GetIndexOf(1)==0);
1560 RakAssert(ml3.GetIndexOf(2)==1);
1561 RakAssert(ml3.GetIndexOf(3)==2);
1562 RakAssert(ml3.GetIndexOf(4)==3);
1563 RakAssert(ml3.GetIndexOf(5)==4);
1564
1565 ml3.SetSortOrder(false);
1566 ml3.Sort(false);
1567 RakAssert(ml3[0]==5);
1568 RakAssert(ml3[1]==4);
1569 RakAssert(ml3[2]==3);
1570 RakAssert(ml3[3]==2);
1571 RakAssert(ml3[4]==1);
1572 RakAssert(ml3.GetIndexOf(1)==4);
1573 RakAssert(ml3.GetIndexOf(2)==3);
1574 RakAssert(ml3.GetIndexOf(3)==2);
1575 RakAssert(ml3.GetIndexOf(4)==1);
1576 RakAssert(ml3.GetIndexOf(5)==0);
1577
1578 ml3.Clear(_FILE_AND_LINE_);
1579
1580 DataStructures::Multilist<ML_ORDERED_LIST, int> ml4;
1581 ml4.Reallocate(64);
1582 RakAssert(ml4.IsEmpty());
1583 ml4.Push(53);
1584 RakAssert(ml4.Peek()==53);
1585 RakAssert(ml4.IsEmpty()==false);
1586 RakAssert(ml4.Pop()==53);
1587 RakAssert(ml4.IsEmpty()==true);
1588 for (int i=0; i < 512; i++)
1589 ml4.Push(i);
1590 RakAssert(ml4.GetIndexOf(200)==200);
1591 RakAssert(ml4.PeekOpposite()==0);
1592 RakAssert(ml4.PopOpposite()==0);
1593 RakAssert(ml4.PeekOpposite()==1);
1594 RakAssert(ml4.Peek()==511);
1595 ml4.ReverseList();
1596 for (int i=0; i < 511; i++)
1597 RakAssert(ml4[i]==511-i);
1598 RakAssert(ml4.PeekOpposite()==511);
1599 RakAssert(ml4.Peek()==1);
1600 oldSize = ml4.GetSize();
1601 ml4.RemoveAtIndex(0);
1602 RakAssert(ml4.GetSize()==oldSize-1);
1603 RakAssert(ml4.Peek()==1);
1604 RakAssert(ml4.PeekOpposite()==510);
1605 ml4.Clear(_FILE_AND_LINE_);
1606 RakAssert(ml4.IsEmpty()==true);
1607
1608 DataStructures::Multilist<ML_ORDERED_LIST, KeyAndValue*, int> ml5;
1609
1610 for (int i=0; i < 16; i++)
1611 {
1612 KeyAndValue *kav = new KeyAndValue;
1613 kav->key=i;
1614 kav->value=i+100;
1615 ml5.Push(kav,kav->key);
1616 }
1617
1618 RakAssert(ml5.GetIndexOf(0)==0);
1619 RakAssert(ml5.GetIndexOf(5)==5);
1620 RakAssert(ml5.GetIndexOf(15)==15);
1621 RakAssert(ml5.GetIndexOf(16)==-1);
1622 ml5.RemoveAtKey(0,true);
1623 RakAssert(ml5.GetIndexOf(1)==0);
1624 KeyAndValue *iPtr = ml5.GetPtr(5);
1625 RakAssert(iPtr);
1626 RakAssert(iPtr->value=105);
1627 iPtr = ml5.GetPtr(1234);
1628 RakAssert(iPtr==0);
1629 ml5.ForEach(DataStructures::DeletePtr<KeyAndValue*>);
1630
1631
1632 DataStructures::Multilist<ML_VARIABLE_DURING_RUNTIME, int> ml6;
1633 ml6.Push(2);
1634 ml6.Push(1);
1635 ml6.Push(6);
1636 ml6.Push(3);
1637 RakAssert(ml6.Peek()==3);
1638 ml6.SetMultilistType(ML_STACK);
1639 RakAssert(ml6.Peek()==3);
1640 ml6.SetMultilistType(ML_QUEUE);
1641 RakAssert(ml6.Peek()==2);
1642 ml6.SetMultilistType(ML_ORDERED_LIST);
1643 RakAssert(ml6.Peek()=6);
1644 ml6.SetMultilistType(ML_STACK);
1645 RakAssert(ml6.Peek()==6);
1646 ml6.SetMultilistType(ML_QUEUE);
1647 RakAssert(ml6.Peek()==1);
1648 }
1649
1650 */
1651
1652 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NetworkIDObject.h Source File

  • include
  • slikenet
NetworkIDObject.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #if !defined(__NETWORK_ID_GENERATOR)
22 #define __NETWORK_ID_GENERATOR
23
24 #include "types.h"
25 #include "memoryoverride.h"
26 #include "Export.h"
27
28 namespace SLNet
29 {
31 class NetworkIDManager;
32
33 typedef uint32_t NetworkIDType;
34
41 class RAK_DLL_EXPORT NetworkIDObject
42 {
43 public:
44 // Constructor. NetworkIDs, if IsNetworkIDAuthority() is true, are created here.
45 NetworkIDObject();
46
47 // Destructor. Used NetworkIDs, if any, are freed here.
48 virtual ~NetworkIDObject();
49
53 virtual void SetNetworkIDManager( NetworkIDManager *manager);
54
56 virtual NetworkIDManager * GetNetworkIDManager( void ) const;
57
62 virtual NetworkID GetNetworkID( void );
63
66 virtual void SetNetworkID( NetworkID id );
67
71 virtual void SetParent( void *_parent );
72
75 virtual void* GetParent( void ) const;
76
77 protected:
78
80 // networkID is assigned when networkIDManager is set.
81 NetworkID networkID;
82 NetworkIDManager *networkIDManager;
83
85 void *parent;
86
88 friend class NetworkIDManager;
89 NetworkIDObject *nextInstanceForNetworkIDManager;
90 };
91
92 } // namespace SLNet
93
94 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_LinkedList.h Source File

  • include
  • slikenet
DS_LinkedList.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __LINKED_LIST_H
23 #define __LINKED_LIST_H
24
25 #include "Export.h"
26 #include "memoryoverride.h"
27
30 namespace DataStructures
31 {
32 // Prototype to prevent error in CircularLinkedList class when a reference is made to a LinkedList class
33 template <class LinkedListType>
34 class RAK_DLL_EXPORT LinkedList;
35
151 template <class CircularLinkedListType>
152
153 class CircularLinkedList
154 {
155
156 public:
157
158 struct node
159 {
160 CircularLinkedListType item;
161
162 node* previous;
163 node* next;
164 };
165
166 CircularLinkedList();
167 ~CircularLinkedList();
168 CircularLinkedList( const CircularLinkedList& original_copy );
169 // CircularLinkedList(LinkedList<CircularLinkedListType> original_copy) {CircularLinkedList(original_copy);} // Converts linked list to circular type
170 bool operator= ( const CircularLinkedList& original_copy );
171 CircularLinkedList& operator++(); // CircularLinkedList A; ++A;
172 CircularLinkedList& operator++( int ); // Circular_Linked List A; A++;
173 CircularLinkedList& operator--(); // CircularLinkedList A; --A;
174 CircularLinkedList& operator--( int ); // Circular_Linked List A; A--;
175 bool IsIn( const CircularLinkedListType& input );
176 bool Find( const CircularLinkedListType& input );
177 void Insert( const CircularLinkedListType& input );
178
179 CircularLinkedListType& Add ( const CircularLinkedListType& input )
180
181 ; // Adds after the current position
182 void Replace( const CircularLinkedListType& input );
183
184 void Del( void );
185
186 unsigned int Size( void );
187
188 CircularLinkedListType& Peek( void );
189
190 CircularLinkedListType Pop( void );
191
192 void Clear( void );
193
194 void Sort( void );
195
196 void Beginning( void );
197
198 void End( void );
199
200 void Concatenate( const CircularLinkedList& L );
201
202 protected:
203 unsigned int list_size;
204
205 node *root;
206
207 node *position;
208
209 node* FindPointer( const CircularLinkedListType& input );
210
211 private:
212 CircularLinkedList Merge( CircularLinkedList L1, CircularLinkedList L2 );
213
214 CircularLinkedList Mergesort( const CircularLinkedList& L );
215 };
216
217 template <class LinkedListType>
218
219 class LinkedList : public CircularLinkedList<LinkedListType>
220 {
221
222 public:
223 LinkedList()
224 {}
225
226 LinkedList( const LinkedList& original_copy );
227 ~LinkedList();
228 bool operator= ( const LinkedList<LinkedListType>& original_copy );
229 LinkedList& operator++(); // LinkedList A; ++A;
230 LinkedList& operator++( int ); // Linked List A; A++;
231 LinkedList& operator--(); // LinkedList A; --A;
232 LinkedList& operator--( int ); // Linked List A; A--;
233
234 private:
235 LinkedList Merge( LinkedList L1, LinkedList L2 );
236 LinkedList Mergesort( const LinkedList& L );
237
238 };
239
240
241 template <class CircularLinkedListType>
242 inline void CircularLinkedList<CircularLinkedListType>::Beginning( void )
243 {
244 if ( this->root )
245 this->position = this->root;
246 }
247
248 template <class CircularLinkedListType>
249 inline void CircularLinkedList<CircularLinkedListType>::End( void )
250 {
251 if ( this->root )
252 this->position = this->root->previous;
253 }
254
255 template <class LinkedListType>
256 bool LinkedList<LinkedListType>::operator= ( const LinkedList<LinkedListType>& original_copy )
257 {
258 typename LinkedList::node * original_copy_pointer, *last, *save_position;
259
260 if ( ( &original_copy ) != this )
261 {
262
263 this->Clear();
264
265
266 if ( original_copy.list_size == 0 )
267 {
268 this->root = 0;
269 this->position = 0;
270 this->list_size = 0;
271 }
272
273 else
274 if ( original_copy.list_size == 1 )
275 {
276 this->root = SLNet::OP_NEW<typename LinkedList::node>( _FILE_AND_LINE_ );
277 // root->item = SLNet::OP_NEW<LinkedListType>( _FILE_AND_LINE_ );
278 this->root->next = this->root;
279 this->root->previous = this->root;
280 this->list_size = 1;
281 this->position = this->root;
282 // *(root->item)=*((original_copy.root)->item);
283 this->root->item = original_copy.root->item;
284 }
285
286 else
287 {
288 // Setup the first part of the root node
289 original_copy_pointer = original_copy.root;
290 this->root = SLNet::OP_NEW<typename LinkedList::node>( _FILE_AND_LINE_ );
291 // root->item = SLNet::OP_NEW<LinkedListType>( _FILE_AND_LINE_ );
292 this->position = this->root;
293 // *(root->item)=*((original_copy.root)->item);
294 this->root->item = original_copy.root->item;
295
296 if ( original_copy_pointer == original_copy.position )
297 save_position = this->position;
298
299 do
300 {
301
302
303 // Save the current element
304 last = this->position;
305
306 // Point to the next node in the source list
307 original_copy_pointer = original_copy_pointer->next;
308
309 // Create a new node and point position to it
310 this->position = SLNet::OP_NEW<typename LinkedList::node>( _FILE_AND_LINE_ );
311 // position->item = SLNet::OP_NEW<LinkedListType>( _FILE_AND_LINE_ );
312
313 // Copy the item to the new node
314 // *(position->item)=*(original_copy_pointer->item);
315 this->position->item = original_copy_pointer->item;
316
317 if ( original_copy_pointer == original_copy.position )
318 save_position = this->position;
319
320
321 // Set the previous pointer for the new node
322 ( this->position->previous ) = last;
323
324 // Set the next pointer for the old node to the new node
325 ( last->next ) = this->position;
326
327 }
328
329 while ( ( original_copy_pointer->next ) != ( original_copy.root ) );
330
331 // Complete the circle. Set the next pointer of the newest node to the root and the previous pointer of the root to the newest node
332 this->position->next = this->root;
333
334 this->root->previous = this->position;
335
336 this->list_size = original_copy.list_size;
337
338 this->position = save_position;
339 }
340 }
341
342 return true;
343 }
344
345
346 template <class CircularLinkedListType>
347 CircularLinkedList<CircularLinkedListType>::CircularLinkedList()
348 {
349 this->root = 0;
350 this->position = 0;
351 this->list_size = 0;
352 }
353
354 template <class CircularLinkedListType>
355 CircularLinkedList<CircularLinkedListType>::~CircularLinkedList()
356 {
357 this->Clear();
358 }
359
360 template <class LinkedListType>
361 LinkedList<LinkedListType>::~LinkedList()
362 {
363 this->Clear();
364 }
365
366 template <class LinkedListType>
367 LinkedList<LinkedListType>::LinkedList( const LinkedList& original_copy )
368 {
369 typename LinkedList::node * original_copy_pointer, *last, *save_position;
370
371 if ( original_copy.list_size == 0 )
372 {
373 this->root = 0;
374 this->position = 0;
375 this->list_size = 0;
376 return ;
377 }
378
379 else
380 if ( original_copy.list_size == 1 )
381 {
382 this->root = SLNet::OP_NEW<typename LinkedList::node>( _FILE_AND_LINE_ );
383 // root->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
384 this->root->next = this->root;
385 this->root->previous = this->root;
386 this->list_size = 1;
387 this->position = this->root;
388 // *(root->item) = *((original_copy.root)->item);
389 this->root->item = original_copy.root->item;
390 }
391
392 else
393 {
394 // Setup the first part of the root node
395 original_copy_pointer = original_copy.root;
396 this->root = SLNet::OP_NEW<typename LinkedList::node>( _FILE_AND_LINE_ );
397 // root->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
398 this->position = this->root;
399 // *(root->item)=*((original_copy.root)->item);
400 this->root->item = original_copy.root->item;
401
402 if ( original_copy_pointer == original_copy.position )
403 save_position = this->position;
404
405 do
406 {
407 // Save the current element
408 last = this->position;
409
410 // Point to the next node in the source list
411 original_copy_pointer = original_copy_pointer->next;
412
413 // Create a new node and point position to it
414 this->position = SLNet::OP_NEW<typename LinkedList::node>( _FILE_AND_LINE_ );
415 // position->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
416
417 // Copy the item to the new node
418 // *(position->item)=*(original_copy_pointer->item);
419 this->position->item = original_copy_pointer->item;
420
421 if ( original_copy_pointer == original_copy.position )
422 save_position = this->position;
423
424 // Set the previous pointer for the new node
425 ( this->position->previous ) = last;
426
427 // Set the next pointer for the old node to the new node
428 ( last->next ) = this->position;
429
430 }
431
432 while ( ( original_copy_pointer->next ) != ( original_copy.root ) );
433
434 // Complete the circle. Set the next pointer of the newest node to the root and the previous pointer of the root to the newest node
435 this->position->next = this->root;
436
437 this->root->previous = this->position;
438
439 this->list_size = original_copy.list_size;
440
441 this->position = save_position;
442 }
443 }
444
445 template <class CircularLinkedListType>
446 CircularLinkedList<CircularLinkedListType>::CircularLinkedList( const CircularLinkedList& original_copy )
447 {
448 node * original_copy_pointer;
449 node *last;
450 node *save_position = nullptr;
451
452 if ( original_copy.list_size == 0 )
453 {
454 this->root = 0;
455 this->position = 0;
456 this->list_size = 0;
457 return ;
458 }
459
460 else
461 if ( original_copy.list_size == 1 )
462 {
463 this->root = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
464 // root->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
465 this->root->next = this->root;
466 this->root->previous = this->root;
467 this->list_size = 1;
468 this->position = this->root;
469 // *(root->item) = *((original_copy.root)->item);
470 this->root->item = original_copy.root->item;
471 }
472
473 else
474 {
475 // Setup the first part of the root node
476 original_copy_pointer = original_copy.root;
477 this->root = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
478 // root->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
479 this->position = this->root;
480 // *(root->item)=*((original_copy.root)->item);
481 this->root->item = original_copy.root->item;
482
483 if ( original_copy_pointer == original_copy.position )
484 save_position = this->position;
485
486 do
487 {
488
489
490 // Save the current element
491 last = this->position;
492
493 // Point to the next node in the source list
494 original_copy_pointer = original_copy_pointer->next;
495
496 // Create a new node and point position to it
497 this->position = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
498 // position->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
499
500 // Copy the item to the new node
501 // *(position->item)=*(original_copy_pointer->item);
502 this->position->item = original_copy_pointer->item;
503
504 if ( original_copy_pointer == original_copy.position )
505 save_position = position;
506
507 // Set the previous pointer for the new node
508 ( this->position->previous ) = last;
509
510 // Set the next pointer for the old node to the new node
511 ( last->next ) = this->position;
512
513 }
514
515 while ( ( original_copy_pointer->next ) != ( original_copy.root ) );
516
517 // Complete the circle. Set the next pointer of the newest node to the root and the previous pointer of the root to the newest node
518 this->position->next = this->root;
519
520 this->root->previous = position;
521
522 this->list_size = original_copy.list_size;
523
524 this->position = save_position;
525 }
526 }
527
528 template <class CircularLinkedListType>
529 bool CircularLinkedList<CircularLinkedListType>::operator= ( const CircularLinkedList& original_copy )
530 {
531 node * original_copy_pointer;
532 node *last;
533 node *save_position = nullptr;
534
535 if ( ( &original_copy ) != this )
536 {
537
538 this->Clear();
539
540
541 if ( original_copy.list_size == 0 )
542 {
543 this->root = 0;
544 this->position = 0;
545 this->list_size = 0;
546 }
547
548 else
549 if ( original_copy.list_size == 1 )
550 {
551 this->root = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
552 // root->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
553 this->root->next = this->root;
554 this->root->previous = this->root;
555 this->list_size = 1;
556 this->position = this->root;
557 // *(root->item)=*((original_copy.root)->item);
558 this->root->item = original_copy.root->item;
559 }
560
561 else
562 {
563 // Setup the first part of the root node
564 original_copy_pointer = original_copy.root;
565 this->root = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
566 // root->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
567 this->position = this->root;
568 // *(root->item)=*((original_copy.root)->item);
569 this->root->item = original_copy.root->item;
570
571 if ( original_copy_pointer == original_copy.position )
572 save_position = this->position;
573
574 do
575 {
576 // Save the current element
577 last = this->position;
578
579 // Point to the next node in the source list
580 original_copy_pointer = original_copy_pointer->next;
581
582 // Create a new node and point position to it
583 this->position = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
584 // position->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
585
586 // Copy the item to the new node
587 // *(position->item)=*(original_copy_pointer->item);
588 this->position->item = original_copy_pointer->item;
589
590 if ( original_copy_pointer == original_copy.position )
591 save_position = this->position;
592
593 // Set the previous pointer for the new node
594 ( this->position->previous ) = last;
595
596 // Set the next pointer for the old node to the new node
597 ( last->next ) = this->position;
598
599 }
600
601 while ( ( original_copy_pointer->next ) != ( original_copy.root ) );
602
603 // Complete the circle. Set the next pointer of the newest node to the root and the previous pointer of the root to the newest node
604 this->position->next = this->root;
605
606 this->root->previous = this->position;
607
608 this->list_size = original_copy.list_size;
609
610 this->position = save_position;
611 }
612 }
613
614 return true;
615 }
616
617 template <class CircularLinkedListType>
618 void CircularLinkedList<CircularLinkedListType>::Insert( const CircularLinkedListType& input )
619 {
620 node * new_node;
621
622 if ( list_size == 0 )
623 {
624 this->root = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
625 // root->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
626 //*(root->item)=input;
627 this->root->item = input;
628 this->root->next = this->root;
629 this->root->previous = this->root;
630 this->list_size = 1;
631 this->position = this->root;
632 }
633
634 else
635 if ( list_size == 1 )
636 {
637 this->position = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
638 // position->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
639 this->root->next = this->position;
640 this->root->previous = this->position;
641 this->position->previous = this->root;
642 this->position->next = this->root;
643 // *(position->item)=input;
644 this->position->item = input;
645 this->root = this->position; // Since we're inserting into a 1 element list the old root is now the second item
646 this->list_size = 2;
647 }
648
649 else
650 {
651 /*
652
653 B
654 |
655 A --- C
656
657 position->previous=A
658 new_node=B
659 position=C
660
661 Note that the order of the following statements is important */
662
663 new_node = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
664 // new_node->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
665
666 // *(new_node->item)=input;
667 new_node->item = input;
668
669 // Point next of A to B
670 ( this->position->previous ) ->next = new_node;
671
672 // Point last of B to A
673 new_node->previous = this->position->previous;
674
675 // Point last of C to B
676 this->position->previous = new_node;
677
678 // Point next of B to C
679 new_node->next = this->position;
680
681 // Since the root pointer is bound to a node rather than an index this moves it back if you insert an element at the root
682
683 if ( this->position == this->root )
684 {
685 this->root = new_node;
686 this->position = this->root;
687 }
688
689 // Increase the recorded size of the list by one
690 this->list_size++;
691 }
692 }
693
694 template <class CircularLinkedListType>
695 CircularLinkedListType& CircularLinkedList<CircularLinkedListType>::Add ( const CircularLinkedListType& input )
696 {
697 node * new_node;
698
699 if ( this->list_size == 0 )
700 {
701 this->root = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
702 // root->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
703 // *(root->item)=input;
704 this->root->item = input;
705 this->root->next = this->root;
706 this->root->previous = this->root;
707 this->list_size = 1;
708 this->position = this->root;
709 // return *(position->item);
710 return this->position->item;
711 }
712
713 else
714 if ( list_size == 1 )
715 {
716 this->position = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
717 // position->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
718 this->root->next = this->position;
719 this->root->previous = this->position;
720 this->position->previous = this->root;
721 this->position->next = this->root;
722 // *(position->item)=input;
723 this->position->item = input;
724 this->list_size = 2;
725 this->position = this->root; // Don't move the position from the root
726 // return *(position->item);
727 return this->position->item;
728 }
729
730 else
731 {
732 /*
733
734 B
735 |
736 A --- C
737
738 new_node=B
739 position=A
740 position->next=C
741
742 Note that the order of the following statements is important */
743
744 new_node = SLNet::OP_NEW<typename CircularLinkedList::node>( _FILE_AND_LINE_ );
745 // new_node->item = SLNet::OP_NEW<CircularLinkedListType>( _FILE_AND_LINE_ );
746
747 // *(new_node->item)=input;
748 new_node->item = input;
749
750 // Point last of B to A
751 new_node->previous = this->position;
752
753 // Point next of B to C
754 new_node->next = ( this->position->next );
755
756 // Point last of C to B
757 ( this->position->next ) ->previous = new_node;
758
759 // Point next of A to B
760 ( this->position->next ) = new_node;
761
762 // Increase the recorded size of the list by one
763 this->list_size++;
764
765 // return *(new_node->item);
766 return new_node->item;
767 }
768 }
769
770 template <class CircularLinkedListType>
771 inline void CircularLinkedList<CircularLinkedListType>::Replace( const CircularLinkedListType& input )
772 {
773 if ( this->list_size > 0 )
774 // *(position->item)=input;
775 this->position->item = input;
776 }
777
778 template <class CircularLinkedListType>
779 void CircularLinkedList<CircularLinkedListType>::Del()
780 {
781 node * new_position;
782
783 if ( this->list_size == 0 )
784 return ;
785
786 else
787 if ( this->list_size == 1 )
788 {
789 // SLNet::OP_DELETE(root->item, _FILE_AND_LINE_);
790 SLNet::OP_DELETE(this->root, _FILE_AND_LINE_);
791 this->root = this->position = 0;
792 this->list_size = 0;
793 }
794
795 else
796 {
797 ( this->position->previous ) ->next = this->position->next;
798 ( this->position->next ) ->previous = this->position->previous;
799 new_position = this->position->next;
800
801 if ( this->position == this->root )
802 this->root = new_position;
803
804 // SLNet::OP_DELETE(position->item, _FILE_AND_LINE_);
805 SLNet::OP_DELETE(this->position, _FILE_AND_LINE_);
806
807 this->position = new_position;
808
809 this->list_size--;
810 }
811 }
812
813 template <class CircularLinkedListType>
814 bool CircularLinkedList<CircularLinkedListType>::IsIn(const CircularLinkedListType& input )
815 {
816 node * return_value, *old_position;
817
818 old_position = this->position;
819
820 return_value = FindPointer( input );
821 this->position = old_position;
822
823 if ( return_value != 0 )
824 return true;
825 else
826 return false; // Can't find the item don't do anything
827 }
828
829 template <class CircularLinkedListType>
830 bool CircularLinkedList<CircularLinkedListType>::Find( const CircularLinkedListType& input )
831 {
832 node * return_value;
833
834 return_value = FindPointer( input );
835
836 if ( return_value != 0 )
837 {
838 this->position = return_value;
839 return true;
840 }
841
842 else
843 return false; // Can't find the item don't do anything
844 }
845
846 template <class CircularLinkedListType>
847 typename CircularLinkedList<CircularLinkedListType>::node* CircularLinkedList<CircularLinkedListType>::FindPointer( const CircularLinkedListType& input )
848 {
849 node * current;
850
851 if ( this->list_size == 0 )
852 return 0;
853
854 current = this->root;
855
856 // Search for the item starting from the root node and incrementing the pointer after every check
857 // If you wind up pointing at the root again you looped around the list so didn't find the item, in which case return 0
858 do
859 {
860 // if (*(current->item) == input) return current;
861
862 if ( current->item == input )
863 return current;
864
865 current = current->next;
866 }
867
868 while ( current != this->root );
869
870 return 0;
871
872 }
873
874 template <class CircularLinkedListType>
875 inline unsigned int CircularLinkedList<CircularLinkedListType>::Size( void )
876 {
877 return this->list_size;
878 }
879
880 template <class CircularLinkedListType>
881 inline CircularLinkedListType& CircularLinkedList<CircularLinkedListType>::Peek( void )
882 {
883 // return *(position->item);
884 return this->position->item;
885 }
886
887 template <class CircularLinkedListType>
888 CircularLinkedListType CircularLinkedList<CircularLinkedListType>::Pop( void )
889 {
890 CircularLinkedListType element;
891 element = Peek();
892 Del();
893 return CircularLinkedListType( element ); // return temporary
894 }
895
896 // Prefix
897 template <class CircularLinkedListType>
898 CircularLinkedList<CircularLinkedListType>& CircularLinkedList<CircularLinkedListType>::operator++()
899 {
900 if ( this->list_size != 0 )
901 position = position->next;
902
903 return *this;
904 }
905
906 /*
907 // Postfix
908 template <class CircularLinkedListType>
909 CircularLinkedList<CircularLinkedListType>& CircularLinkedList<CircularLinkedListType>::operator++(int)
910 {
911 CircularLinkedList<CircularLinkedListType> before;
912 before=*this;
913 operator++();
914 return before;
915 }
916 */
917
918 template <class CircularLinkedListType>
919 CircularLinkedList<CircularLinkedListType>& CircularLinkedList<CircularLinkedListType>::operator++( int )
920 {
921 return this->operator++();
922 }
923
924 // Prefix
925 template <class CircularLinkedListType>
926 CircularLinkedList<CircularLinkedListType>& CircularLinkedList<CircularLinkedListType>::operator--()
927 {
928 if ( this->list_size != 0 )
929 this->position = this->position->previous;
930
931 return *this;
932 }
933
934 /*
935 // Postfix
936 template <class CircularLinkedListType>
937 CircularLinkedList<CircularLinkedListType>& CircularLinkedList<CircularLinkedListType>::operator--(int)
938 {
939 CircularLinkedList<CircularLinkedListType> before;
940 before=*this;
941 operator--();
942 return before;
943 }
944 */
945
946 template <class CircularLinkedListType>
947 CircularLinkedList<CircularLinkedListType>& CircularLinkedList<CircularLinkedListType>::operator--( int )
948 {
949 return this->operator--();
950 }
951
952 template <class CircularLinkedListType>
953 void CircularLinkedList<CircularLinkedListType>::Clear( void )
954 {
955 if ( this->list_size == 0 )
956 return ;
957 else
958 if ( this->list_size == 1 ) // {SLNet::OP_DELETE(root->item); SLNet::OP_DELETE(root, _FILE_AND_LINE_);}
959 {
960 SLNet::OP_DELETE(this->root, _FILE_AND_LINE_);
961 }
962
963 else
964 {
965 node* current;
966 node* temp;
967
968 current = this->root;
969
970 do
971 {
972 temp = current;
973 current = current->next;
974 // SLNet::OP_DELETE(temp->item, _FILE_AND_LINE_);
975 SLNet::OP_DELETE(temp, _FILE_AND_LINE_);
976 }
977
978 while ( current != this->root );
979 }
980
981 this->list_size = 0;
982 this->root = 0;
983 this->position = 0;
984 }
985
986 template <class CircularLinkedListType>
987 inline void CircularLinkedList<CircularLinkedListType>::Concatenate( const CircularLinkedList<CircularLinkedListType>& L )
988 {
989 unsigned int counter;
990 node* ptr;
991
992 if ( L.list_size == 0 )
993 return ;
994
995 if ( this->list_size == 0 )
996 * this = L;
997
998 ptr = L.root;
999
1000 this->position = this->root->previous;
1001
1002 // Cycle through each element in L and add it to the current list
1003 for ( counter = 0; counter < L.list_size; counter++ )
1004 {
1005 // Add item after the current item pointed to
1006 // add(*(ptr->item));
1007
1008 Add ( ptr->item );
1009
1010 // Update pointers. Moving ptr keeps the current pointer at the end of the list since the add function does not move the pointer
1011 ptr = ptr->next;
1012
1013 this->position = this->position->next;
1014 }
1015 }
1016
1017 template <class CircularLinkedListType>
1018 inline void CircularLinkedList<CircularLinkedListType>::Sort( void )
1019 {
1020 if ( this->list_size <= 1 )
1021 return ;
1022
1023 // Call equal operator to assign result of mergesort to current object
1024 *this = Mergesort( *this );
1025
1026 this->position = this->root;
1027 }
1028
1029 template <class CircularLinkedListType>
1030 CircularLinkedList<CircularLinkedListType> CircularLinkedList<CircularLinkedListType>::Mergesort( const CircularLinkedList& L )
1031 {
1032 unsigned int counter;
1033 node* location;
1034 CircularLinkedList<CircularLinkedListType> L1;
1035 CircularLinkedList<CircularLinkedListType> L2;
1036
1037 location = L.root;
1038
1039 // Split the list into two equal size sublists, L1 and L2
1040
1041 for ( counter = 0; counter < L.list_size / 2; counter++ )
1042 {
1043 // L1.add (*(location->item));
1044 L1.Add ( location->item );
1045 location = location->next;
1046 }
1047
1048 for ( ;counter < L.list_size; counter++ )
1049 {
1050 // L2.Add(*(location->item));
1051 L2.Add ( location->item );
1052 location = location->next;
1053 }
1054
1055 // Recursively sort the sublists
1056 if ( L1.list_size > 1 )
1057 L1 = Mergesort( L1 );
1058
1059 if ( L2.list_size > 1 )
1060 L2 = Mergesort( L2 );
1061
1062 // Merge the two sublists
1063 return Merge( L1, L2 );
1064 }
1065
1066 template <class CircularLinkedListType>
1067 CircularLinkedList<CircularLinkedListType> CircularLinkedList<CircularLinkedListType>::Merge( CircularLinkedList L1, CircularLinkedList L2 )
1068 {
1069 CircularLinkedList<CircularLinkedListType> X;
1070 CircularLinkedListType element;
1071 L1.position = L1.root;
1072 L2.position = L2.root;
1073
1074 // While neither list is empty
1075
1076 while ( ( L1.list_size != 0 ) && ( L2.list_size != 0 ) )
1077 {
1078 // Compare the first items of L1 and L2
1079 // Remove the smaller of the two items from the list
1080
1081 if ( ( ( L1.root ) ->item ) < ( ( L2.root ) ->item ) )
1082 // if ((*((L1.root)->item)) < (*((L2.root)->item)))
1083 {
1084 // element = *((L1.root)->item);
1085 element = ( L1.root ) ->item;
1086 L1.Del();
1087 }
1088 else
1089 {
1090 // element = *((L2.root)->item);
1091 element = ( L2.root ) ->item;
1092 L2.Del();
1093 }
1094
1095 // Add this item to the end of X
1096 X.Add( element );
1097
1098 X++;
1099 }
1100
1101 // Add the remaining list to X
1102 if ( L1.list_size != 0 )
1103 X.Concatenate( L1 );
1104 else
1105 X.Concatenate( L2 );
1106
1107 return X;
1108 }
1109
1110 template <class LinkedListType>
1111 LinkedList<LinkedListType> LinkedList<LinkedListType>::Mergesort( const LinkedList& L )
1112 {
1113 unsigned int counter;
1114 typename LinkedList::node* location;
1115 LinkedList<LinkedListType> L1;
1116 LinkedList<LinkedListType> L2;
1117
1118 location = L.root;
1119
1120 // Split the list into two equal size sublists, L1 and L2
1121
1122 for ( counter = 0; counter < L.LinkedList_size / 2; counter++ )
1123 {
1124 // L1.add (*(location->item));
1125 L1.Add ( location->item );
1126 location = location->next;
1127 }
1128
1129 for ( ;counter < L.LinkedList_size; counter++ )
1130 {
1131 // L2.Add(*(location->item));
1132 L2.Add ( location->item );
1133 location = location->next;
1134 }
1135
1136 // Recursively sort the sublists
1137 if ( L1.list_size > 1 )
1138 L1 = Mergesort( L1 );
1139
1140 if ( L2.list_size > 1 )
1141 L2 = Mergesort( L2 );
1142
1143 // Merge the two sublists
1144 return Merge( L1, L2 );
1145 }
1146
1147 template <class LinkedListType>
1148 LinkedList<LinkedListType> LinkedList<LinkedListType>::Merge( LinkedList L1, LinkedList L2 )
1149 {
1150 LinkedList<LinkedListType> X;
1151 LinkedListType element;
1152 L1.position = L1.root;
1153 L2.position = L2.root;
1154
1155 // While neither list is empty
1156
1157 while ( ( L1.LinkedList_size != 0 ) && ( L2.LinkedList_size != 0 ) )
1158 {
1159 // Compare the first items of L1 and L2
1160 // Remove the smaller of the two items from the list
1161
1162 if ( ( ( L1.root ) ->item ) < ( ( L2.root ) ->item ) )
1163 // if ((*((L1.root)->item)) < (*((L2.root)->item)))
1164 {
1165 element = ( L1.root ) ->item;
1166 // element = *((L1.root)->item);
1167 L1.Del();
1168 }
1169 else
1170 {
1171 element = ( L2.root ) ->item;
1172 // element = *((L2.root)->item);
1173 L2.Del();
1174 }
1175
1176 // Add this item to the end of X
1177 X.Add( element );
1178 }
1179
1180 // Add the remaining list to X
1181 if ( L1.LinkedList_size != 0 )
1182 X.concatenate( L1 );
1183 else
1184 X.concatenate( L2 );
1185
1186 return X;
1187 }
1188
1189
1190 // Prefix
1191 template <class LinkedListType>
1192 LinkedList<LinkedListType>& LinkedList<LinkedListType>::operator++()
1193 {
1194 if ( ( this->list_size != 0 ) && ( this->position->next != this->root ) )
1195 this->position = this->position->next;
1196
1197 return *this;
1198 }
1199
1200 /*
1201 // Postfix
1202 template <class LinkedListType>
1203 LinkedList<LinkedListType>& LinkedList<LinkedListType>::operator++(int)
1204 {
1205 LinkedList<LinkedListType> before;
1206 before=*this;
1207 operator++();
1208 return before;
1209 }
1210 */
1211 // Postfix
1212 template <class LinkedListType>
1213 LinkedList<LinkedListType>& LinkedList<LinkedListType>::operator++( int )
1214 {
1215 return this->operator++();
1216 }
1217
1218 // Prefix
1219 template <class LinkedListType>
1220 LinkedList<LinkedListType>& LinkedList<LinkedListType>::operator--()
1221 {
1222 if ( ( this->list_size != 0 ) && ( this->position != this->root ) )
1223 this->position = this->position->previous;
1224
1225 return *this;
1226 }
1227
1228 /*
1229 // Postfix
1230 template <class LinkedListType>
1231 LinkedList<LinkedListType>& LinkedList<LinkedListType>::operator--(int)
1232 {
1233 LinkedList<LinkedListType> before;
1234 before=*this;
1235 operator--();
1236 return before;
1237 }
1238 */
1239
1240 // Postfix
1241 template <class LinkedListType>
1242 LinkedList<LinkedListType>& LinkedList<LinkedListType>::operator--( int )
1243 {
1244 return this->operator--();
1245 }
1246
1247 } // End namespace
1248
1249 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TeamBalancer.h Source File

  • include
  • slikenet
TeamBalancer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
21
22
23 #include "NativeFeatureIncludes.h"
24 #if _RAKNET_SUPPORT_TeamBalancer==1
25
26 #ifndef __TEAM_BALANCER_H
27 #define __TEAM_BALANCER_H
28
29 #include "PluginInterface2.h"
30 #include "memoryoverride.h"
31 #include "NativeTypes.h"
32 #include "DS_List.h"
33 #include "string.h"
34
35 namespace SLNet
36 {
38 class RakPeerInterface;
39
45
49 typedef unsigned char TeamId;
50
51 #define UNASSIGNED_TEAM_ID 255
52
58 class RAK_DLL_EXPORT TeamBalancer : public PluginInterface2
59 {
60 public:
61 // GetInstance() and DestroyInstance(instance*)
62 STATIC_FACTORY_DECLARATIONS(TeamBalancer)
63
64 TeamBalancer();
65 virtual ~TeamBalancer();
66
72 void SetTeamSizeLimit(TeamId team, unsigned short limit);
73
74 enum DefaultAssigmentAlgorithm
75 {
77 SMALLEST_TEAM,
79 FILL_IN_ORDER
80 };
86 void SetDefaultAssignmentAlgorithm(DefaultAssigmentAlgorithm daa);
87
95 void SetForceEvenTeams(bool force);
96
102 void SetLockTeams(bool lock);
103
112 void RequestSpecificTeam(NetworkID memberId, TeamId desiredTeam);
113
118 void CancelRequestSpecificTeam(NetworkID memberId);
119
124 void RequestAnyTeam(NetworkID memberId);
125
132 TeamId GetMyTeam(NetworkID memberId) const;
133
138 void DeleteMember(NetworkID memberId);
139
140 struct TeamMember
141 {
142 RakNetGUID memberGuid;
143 NetworkID memberId;
144 TeamId currentTeam;
145 TeamId requestedTeam;
146 };
147 struct MyTeamMembers
148 {
149 NetworkID memberId;
150 TeamId currentTeam;
151 TeamId requestedTeam;
152 };
153
154 protected:
155
157 virtual PluginReceiveResult OnReceive(Packet *packet);
159 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
161 void OnAttach(void);
162
163 void OnStatusUpdateToNewHost(Packet *packet);
164 void OnCancelTeamRequest(Packet *packet);
165 void OnRequestAnyTeam(Packet *packet);
166 void OnRequestSpecificTeam(Packet *packet);
167
168 RakNetGUID hostGuid;
169 DefaultAssigmentAlgorithm defaultAssigmentAlgorithm;
170 bool forceTeamsToBeEven;
171 bool lockTeams;
172 // So if we lose the connection while processing, we request the same info of the new host
173 DataStructures::List<MyTeamMembers> myTeamMembers;
174
175 DataStructures::List<unsigned short> teamLimits;
176 DataStructures::List<unsigned short> teamMemberCounts;
177 DataStructures::List<TeamMember> teamMembers;
178 unsigned int GetMemberIndex(NetworkID memberId, RakNetGUID guid) const;
179 unsigned int AddTeamMember(const TeamMember &tm); // Returns index of new member
180 void RemoveTeamMember(unsigned int index);
181 void EvenTeams(void);
182 unsigned int GetMemberIndexToSwitchTeams(const DataStructures::List<TeamId> &sourceTeamNumbers, TeamId targetTeamNumber);
183 void GetOverpopulatedTeams(DataStructures::List<TeamId> &overpopulatedTeams, int maxTeamSize);
184 void SwitchMemberTeam(unsigned int teamMemberIndex, TeamId destinationTeam);
185 void NotifyTeamAssigment(unsigned int teamMemberIndex);
186 bool WeAreHost(void) const;
187 PluginReceiveResult OnTeamAssigned(Packet *packet);
188 PluginReceiveResult OnRequestedTeamChangePending(Packet *packet);
189 PluginReceiveResult OnTeamsLocked(Packet *packet);
190 void GetMinMaxTeamMembers(int &minMembersOnASingleTeam, int &maxMembersOnASingleTeam);
191 TeamId GetNextDefaultTeam(void); // Accounting for team balancing and team limits, get the team a player should be placed on
192 bool TeamWouldBeOverpopulatedOnAddition(TeamId teamId, unsigned int teamMemberSize); // Accounting for team balancing and team limits, would this team be overpopulated if a member was added to it?
193 bool TeamWouldBeUnderpopulatedOnLeave(TeamId teamId, unsigned int teamMemberSize);
194 TeamId GetSmallestNonFullTeam(void) const;
195 TeamId GetFirstNonFullTeam(void) const;
196 void MoveMemberThatWantsToJoinTeam(TeamId teamId);
197 TeamId MoveMemberThatWantsToJoinTeamInternal(TeamId teamId);
198 void NotifyTeamsLocked(RakNetGUID target, TeamId requestedTeam);
199 void NotifyTeamSwitchPending(RakNetGUID target, TeamId requestedTeam, NetworkID memberId);
200 void NotifyNoTeam(NetworkID memberId, RakNetGUID target);
201 void SwapTeamMembersByRequest(unsigned int memberIndex1, unsigned int memberIndex2);
202 void RemoveByGuid(RakNetGUID rakNetGUID);
203 bool TeamsWouldBeEvenOnSwitch(TeamId t1, TeamId t2);
204
205 };
206
207 } // namespace SLNet
208
209 #endif
210
211 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Tree.h Source File

  • include
  • slikenet
DS_Tree.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22
23 #ifndef __DS_TREE_H
24 #define __DS_TREE_H
25
26 #include "Export.h"
27 #include "DS_List.h"
28 #include "DS_Queue.h"
29 #include "memoryoverride.h"
30
33 namespace DataStructures
34 {
35 template <class TreeType>
36 class RAK_DLL_EXPORT Tree
37 {
38 public:
39 Tree();
40 Tree(TreeType &inputData);
41 ~Tree();
42 void LevelOrderTraversal(DataStructures::List<Tree*> &output);
43 void AddChild(TreeType &newData);
44 void DeleteDecendants(void);
45
46 TreeType data;
47 DataStructures::List<Tree *> children;
48 };
49
50 template <class TreeType>
51 Tree<TreeType>::Tree()
52 {
53
54 }
55
56 template <class TreeType>
57 Tree<TreeType>::Tree(TreeType &inputData)
58 {
59 data=inputData;
60 }
61
62 template <class TreeType>
63 Tree<TreeType>::~Tree()
64 {
65 DeleteDecendants();
66 }
67
68 template <class TreeType>
69 void Tree<TreeType>::LevelOrderTraversal(DataStructures::List<Tree*> &output)
70 {
71 unsigned i;
72 Tree<TreeType> *node;
73 DataStructures::Queue<Tree<TreeType>*> queue;
74
75 for (i=0; i < children.Size(); i++)
76 queue.Push(children[i]);
77
78 while (queue.Size())
79 {
80 node=queue.Pop();
81 output.Insert(node, _FILE_AND_LINE_);
82 for (i=0; i < node->children.Size(); i++)
83 queue.Push(node->children[i]);
84 }
85 }
86
87 template <class TreeType>
88 void Tree<TreeType>::AddChild(TreeType &newData)
89 {
90 children.Insert(SLNet::OP_NEW<Tree>(newData, _FILE_AND_LINE_));
91 }
92
93 template <class TreeType>
94 void Tree<TreeType>::DeleteDecendants(void)
95 {
96 /*
97 DataStructures::List<Tree*> output;
98 LevelOrderTraversal(output);
99 unsigned i;
100 for (i=0; i < output.Size(); i++)
101 SLNet::OP_DELETE(output[i], _FILE_AND_LINE_);
102 */
103
104 // Already recursive to do this
105 unsigned int i;
106 for (i=0; i < children.Size(); i++)
107 SLNet::OP_DELETE(children[i], _FILE_AND_LINE_);
108 }
109 }
110
111 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakString
SLNet::RakString Member List

This is the complete list of members for SLNet::RakString, including all inherited members.

Allocate(size_t len) | SLNet::RakString | protected
AppendBytes(const char *bytes, size_t count) | SLNet::RakString |
Assign(const char *str, size_t pos, size_t n) | SLNet::RakString |
Assign(const char *str) | SLNet::RakString | protected
Assign(const char *str, va_list ap) | SLNet::RakString | protected
C_String(void) const | SLNet::RakString | inline
C_StringUnsafe(void) | SLNet::RakString | inline
Clear(void) | SLNet::RakString |
Clone(void) | SLNet::RakString | protected
ContainsNonprintableExceptSpaces(void) const | SLNet::RakString |
Deserialize(BitStream *bs) | SLNet::RakString |
Deserialize(char *str, BitStream *bs) | SLNet::RakString | static
DeserializeCompressed(BitStream *bs, bool readLanguageId=false) | SLNet::RakString |
DeserializeCompressed(char *str, BitStream *bs, bool readLanguageId=false) | SLNet::RakString | static
emptyString | SLNet::RakString | static
Erase(unsigned int index, unsigned int count) | SLNet::RakString |
Find(const char *stringToFind, size_t pos=0) | SLNet::RakString |
FormatForDELETE(const char *uri, const char *extraHeaders="") | SLNet::RakString | static
FormatForGET(const char *uri, const char *extraHeaders="") | SLNet::RakString | static
FormatForPOST(const char *uri, const char *contentType, const char *body, const char *extraHeaders="") | SLNet::RakString | static
FormatForPUT(const char *uri, const char *contentType, const char *body, const char *extraHeaders="") | SLNet::RakString | static
FormatForPUTOrPost(const char *type, const char *uri, const char *contentType, const char *body, const char *extraHeaders) | SLNet::RakString | protectedstatic
FPrintf(FILE *fp) | SLNet::RakString |
Free(void) | SLNet::RakString | protected
freeList | SLNet::RakString | static
FreeMemory(void) | SLNet::RakString | static
FreeMemoryNoMutex(void) | SLNet::RakString | static
GetCharacterCount(char c) | SLNet::RakString |
GetLength(void) const | SLNet::RakString |
GetLengthUTF8(void) const | SLNet::RakString |
GetSizeToAllocate(size_t bytes) | SLNet::RakString | inlinestatic
IPAddressMatch(const char *IP) | SLNet::RakString |
IsEmailAddress(void) const | SLNet::RakString |
IsEmpty(void) const | SLNet::RakString |
LockMutex(void) | SLNet::RakString | static
MakeFilePath(void) | SLNet::RakString |
NonVariadic(const char *str) | SLNet::RakString | static
operator const char *() const | SLNet::RakString | inline
operator!=(const RakString &rhs) const | SLNet::RakString |
operator!=(const char *str) const | SLNet::RakString |
operator!=(char *str) const | SLNet::RakString |
operator+=(const RakString &rhs) | SLNet::RakString |
operator+=(const char *str) | SLNet::RakString |
operator+=(char *str) | SLNet::RakString |
operator+=(const unsigned char *str) | SLNet::RakString |
operator+=(char unsigned *str) | SLNet::RakString |
operator+=(const char c) | SLNet::RakString |
operator<(const RakString &right) const | SLNet::RakString |
operator<=(const RakString &right) const | SLNet::RakString |
operator=(const RakString &rhs) | SLNet::RakString |
operator=(const char *str) | SLNet::RakString |
operator=(char *str) | SLNet::RakString |
operator=(const unsigned char *str) | SLNet::RakString |
operator=(char unsigned *str) | SLNet::RakString |
operator=(const char c) | SLNet::RakString |
operator==(const RakString &rhs) const | SLNet::RakString |
operator==(const char *str) const | SLNet::RakString |
operator==(char *str) const | SLNet::RakString |
operator>(const RakString &right) const | SLNet::RakString |
operator>=(const RakString &right) const | SLNet::RakString |
operator[](const unsigned int position) const | SLNet::RakString |
Printf(void) | SLNet::RakString |
RakString() | SLNet::RakString |
RakString(char input) | SLNet::RakString |
RakString(unsigned char input) | SLNet::RakString |
RakString(const unsigned char *format,...) | SLNet::RakString |
RakString(const char *format,...) | SLNet::RakString |
RakString(const RakString &rhs) | SLNet::RakString |
RakString(SharedString *_sharedString) | SLNet::RakString |
RakStringComp(RakString const &key, RakString const &data) | SLNet::RakString | static
ReadIntFromSubstring(const char *str, size_t pos, size_t n) | SLNet::RakString | static
Realloc(SharedString *inSharedString, size_t bytes) | SLNet::RakString | protected
RemoveCharacter(char c) | SLNet::RakString |
Replace(unsigned index, unsigned count, unsigned char c) | SLNet::RakString |
Serialize(BitStream *bs) const | SLNet::RakString |
Serialize(const char *str, BitStream *bs) | SLNet::RakString | static
SerializeCompressed(BitStream *bs, uint8_t languageId=0, bool writeLanguageId=false) const | SLNet::RakString |
SerializeCompressed(const char *str, BitStream *bs, uint8_t languageId=0, bool writeLanguageId=false) | SLNet::RakString | static
Set(const char *format,...) | SLNet::RakString |
SetChar(unsigned index, unsigned char c) | SLNet::RakString |
SetChar(unsigned index, SLNet::RakString s) | SLNet::RakString |
sharedString | SLNet::RakString |
SplitURI(SLNet::RakString &header, SLNet::RakString &domain, SLNet::RakString &path) | SLNet::RakString |
SQLEscape(void) | SLNet::RakString |
StartAfterFirstCharacter(char c) | SLNet::RakString |
StartAfterLastCharacter(char c) | SLNet::RakString |
StrCmp(const RakString &rhs) const | SLNet::RakString |
StrICmp(const RakString &rhs) const | SLNet::RakString |
StrNCmp(const RakString &rhs, size_t num) const | SLNet::RakString |
SubStr(unsigned int index, size_t count) const | SLNet::RakString |
TerminateAtFirstCharacter(char c) | SLNet::RakString |
TerminateAtLastCharacter(char c) | SLNet::RakString |
ToInteger(const char *str) | SLNet::RakString | static
ToInteger(const RakString &rs) | SLNet::RakString | static
ToLower(void) | SLNet::RakString |
ToLower(unsigned char c) | SLNet::RakString | protected
ToString(int64_t i) | SLNet::RakString | static
ToString(uint64_t i) | SLNet::RakString | static
ToUpper(void) | SLNet::RakString |
ToUpper(unsigned char c) | SLNet::RakString | protected
Truncate(unsigned int length) | SLNet::RakString |
TruncateUTF8(unsigned int length) | SLNet::RakString |
UnlockMutex(void) | SLNet::RakString | static
URLDecode(void) | SLNet::RakString |
URLEncode(void) | SLNet::RakString |
~RakString() | SLNet::RakString |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DynDNS.h Source File

  • include
  • slikenet
DynDNS.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #include "NativeFeatureIncludes.h"
23 #if _RAKNET_SUPPORT_DynDNS==1 && _RAKNET_SUPPORT_TCPInterface==1
24
25 #ifndef __DYN_DNS_H
26 #define __DYN_DNS_H
27
28 #include "string.h"
29
30 namespace SLNet
31 {
32
33 class TCPInterface;
34
35 enum DynDnsResultCode
36 {
37 // ----- Success -----
38 RC_SUCCESS,
39 RC_DNS_ALREADY_SET, // RakNet detects no action is needed
40
41 // ----- Ignorable failure (treat same as success) -----
42 RC_NO_CHANGE, // DynDNS detects no action is needed (treated as abuse though)
43
44 // ----- User error -----
45 RC_NOT_DONATOR, // You have to pay to do this
46 RC_NO_HOST, // This host does not exist at all
47 RC_BAD_AUTH, // You set the wrong password
48 RC_NOT_YOURS, // This is not your host
49
50 // ----- Permanent failure -----
51 RC_ABUSE, // Your host has been blocked, too many failures disable your account
52 RC_TCP_FAILED_TO_START, // TCP port already in use
53 RC_TCP_DID_NOT_CONNECT, // DynDNS down?
54 RC_UNKNOWN_RESULT, // DynDNS returned a result code that was not documented as of 12/4/2010 on http://www.dyndns.com/developers/specs/flow.pdf
55 RC_PARSING_FAILURE, // Can't read the result returned, format change?
56 RC_CONNECTION_LOST_WITHOUT_RESPONSE, // Lost the connection to DynDNS while communicating
57 RC_BAD_AGENT, // ???
58 RC_BAD_SYS, // ???
59 RC_DNS_ERROR, // ???
60 RC_NOT_FQDN, // ???
61 RC_NUM_HOST, // ???
62 RC_911, // ???
63 RC_DYNDNS_TIMEOUT // DynDNS did not respond
64 };
65
66 // Can only process one at a time with the current implementation
67 class RAK_DLL_EXPORT DynDNS
68 {
69 public:
70 DynDNS();
71 ~DynDNS();
72
73 // Pass 0 for newIPAddress to autodetect whatever you are uploading from
74 // usernameAndPassword should be in the format username:password
75 void UpdateHostIPAsynch(const char *dnsHost, const char *newIPAddress, const char *usernameAndPassword );
76 void Update(void);
77
78 // Output
79 bool IsRunning(void) const {return connectPhase!=CP_IDLE;}
80 bool IsCompleted(void) const {return connectPhase==CP_IDLE;}
81 SLNet::DynDnsResultCode GetCompletedResultCode(void) {return result;}
82 const char *GetCompletedDescription(void) const {return resultDescription;}
83 bool WasResultSuccessful(void) const {return result==RC_SUCCESS || result==RC_DNS_ALREADY_SET || result==RC_NO_CHANGE;}
84 char *GetMyPublicIP(void) const {return (char*) myIPStr;} // We get our public IP as part of the process. This is valid once completed
85
86 protected:
87 void Stop(void);
88 void SetCompleted(SLNet::DynDnsResultCode _result, const char *_resultDescription) {Stop(); result=_result; resultDescription=_resultDescription;}
89
90 enum ConnectPhase
91 {
92 CP_CONNECTING_TO_CHECKIP,
93 CP_WAITING_FOR_CHECKIP_RESPONSE,
94 CP_CONNECTING_TO_DYNDNS,
95 CP_WAITING_FOR_DYNDNS_RESPONSE,
96 CP_IDLE
97 };
98
99 TCPInterface *tcp;
100 SLNet::RakString getString;
101 SystemAddress serverAddress;
102 ConnectPhase connectPhase;
103 SLNet::RakString host;
104 SLNet::Time phaseTimeout;
105 SystemAddress checkIpAddress;
106 const char *resultDescription;
107 SLNet::DynDnsResultCode result;
108 char myIPStr[32];
109 };
110
111 } // namespace SLNet
112
113 #endif // __DYN_DNS_H
114
115 #endif // _RAKNET_SUPPORT_DynDNS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HuffmanEncodingTreeFactory
SLNet::HuffmanEncodingTreeFactory Member List

This is the complete list of members for SLNet::HuffmanEncodingTreeFactory, including all inherited members.

AddToFrequencyTable(unsigned char *array, int size) | SLNet::HuffmanEncodingTreeFactory
GenerateTree(void) | SLNet::HuffmanEncodingTreeFactory
GetFrequencyTable(unsigned int _frequency[256]) | SLNet::HuffmanEncodingTreeFactory
GetFrequencyTable(void) | SLNet::HuffmanEncodingTreeFactory
HuffmanEncodingTreeFactory() | SLNet::HuffmanEncodingTreeFactory
Reset(void) | SLNet::HuffmanEncodingTreeFactory
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/MTUSize.h Source File

  • include
  • slikenet
MTUSize.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
14
15
16 #ifndef MAXIMUM_MTU_SIZE
17
30
31
32
33 #define MAXIMUM_MTU_SIZE 1492
34
35
36 #define MINIMUM_MTU_SIZE 400
37
38 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DR_SHA1.cpp Source File

  • src
DR_SHA1.cpp
Go to the documentation of this file.
1 /*
2 100% free public domain implementation of the SHA-1 algorithm
3 by Dominik Reichl <dominik.reichl@t-online.de>
4 Web: http://www.dominik-reichl.de/
5
6 See header file for version history and test vectors.
7 */
8
9 /*
10 * Modified work : Copyright(c) 2016-2017, SLikeSoft UG(haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications in this file are put under the public domain.
13 * Alternatively you are permitted to license the modifications under the MIT license, if you so desire. The
14 * license can be found in the license.txt file in the root directory of this source tree.
15 */
16
17 // If compiling with MFC, you might want to add #include "StdAfx.h"
18
19 #define _CRT_SECURE_NO_WARNINGS
20 #include "slikenet/DR_SHA1.h"
21 #include <stdlib.h>
22
23 #define SHA1_MAX_FILE_BUFFER (32 * 20 * 820)
24
25 // Rotate p_val32 by p_nBits bits to the left
26 #ifndef ROL32
27 #ifdef _MSC_VER
28 #define ROL32(p_val32,p_nBits) _rotl(p_val32,p_nBits)
29 #else
30 #define ROL32(p_val32,p_nBits) (((p_val32)<<(p_nBits))|((p_val32)>>(32-(p_nBits))))
31 #endif
32 #endif
33
34 #ifdef SHA1_LITTLE_ENDIAN
35 #define SHABLK0(i) (m_block->l[i] = \
36 (ROL32(m_block->l[i],24) & 0xFF00FF00) | (ROL32(m_block->l[i],8) & 0x00FF00FF))
37 #else
38 #define SHABLK0(i) (m_block->l[i])
39 #endif
40
41 #define SHABLK(i) (m_block->l[i&15] = ROL32(m_block->l[(i+13)&15] ^ \
42 m_block->l[(i+8)&15] ^ m_block->l[(i+2)&15] ^ m_block->l[i&15],1))
43
44 // SHA-1 rounds
45 #define S_R0(v,w,x,y,z,i) {z+=((w&(x^y))^y)+SHABLK0(i)+0x5A827999+ROL32(v,5);w=ROL32(w,30);}
46 #define S_R1(v,w,x,y,z,i) {z+=((w&(x^y))^y)+SHABLK(i)+0x5A827999+ROL32(v,5);w=ROL32(w,30);}
47 #define S_R2(v,w,x,y,z,i) {z+=(w^x^y)+SHABLK(i)+0x6ED9EBA1+ROL32(v,5);w=ROL32(w,30);}
48 #define S_R3(v,w,x,y,z,i) {z+=(((w|x)&y)|(w&x))+SHABLK(i)+0x8F1BBCDC+ROL32(v,5);w=ROL32(w,30);}
49 #define S_R4(v,w,x,y,z,i) {z+=(w^x^y)+SHABLK(i)+0xCA62C1D6+ROL32(v,5);w=ROL32(w,30);}
50
51 CSHA1::CSHA1()
52 {
53 m_block = (SHA1_WORKSPACE_BLOCK*)m_workspace;
54
55 Reset();
56 }
57
58 #ifdef SHA1_WIPE_VARIABLES
59 CSHA1::~CSHA1()
60 {
61 Reset();
62 }
63 #endif
64
65 void CSHA1::Reset()
66 {
67 // SHA1 initialization constants
68 m_state[0] = 0x67452301;
69 m_state[1] = 0xEFCDAB89;
70 m_state[2] = 0x98BADCFE;
71 m_state[3] = 0x10325476;
72 m_state[4] = 0xC3D2E1F0;
73
74 m_count[0] = 0;
75 m_count[1] = 0;
76 }
77
78 void CSHA1::Transform(UINT_32* pState, const UINT_8* pBuffer)
79 {
80 UINT_32 a = pState[0], b = pState[1], c = pState[2], d = pState[3], e = pState[4];
81
82 memcpy(m_block, pBuffer, 64);
83
84 // 4 rounds of 20 operations each, loop unrolled
85 S_R0(a,b,c,d,e, 0); S_R0(e,a,b,c,d, 1); S_R0(d,e,a,b,c, 2); S_R0(c,d,e,a,b, 3);
86 S_R0(b,c,d,e,a, 4); S_R0(a,b,c,d,e, 5); S_R0(e,a,b,c,d, 6); S_R0(d,e,a,b,c, 7);
87 S_R0(c,d,e,a,b, 8); S_R0(b,c,d,e,a, 9); S_R0(a,b,c,d,e,10); S_R0(e,a,b,c,d,11);
88 S_R0(d,e,a,b,c,12); S_R0(c,d,e,a,b,13); S_R0(b,c,d,e,a,14); S_R0(a,b,c,d,e,15);
89 S_R1(e,a,b,c,d,16); S_R1(d,e,a,b,c,17); S_R1(c,d,e,a,b,18); S_R1(b,c,d,e,a,19);
90 S_R2(a,b,c,d,e,20); S_R2(e,a,b,c,d,21); S_R2(d,e,a,b,c,22); S_R2(c,d,e,a,b,23);
91 S_R2(b,c,d,e,a,24); S_R2(a,b,c,d,e,25); S_R2(e,a,b,c,d,26); S_R2(d,e,a,b,c,27);
92 S_R2(c,d,e,a,b,28); S_R2(b,c,d,e,a,29); S_R2(a,b,c,d,e,30); S_R2(e,a,b,c,d,31);
93 S_R2(d,e,a,b,c,32); S_R2(c,d,e,a,b,33); S_R2(b,c,d,e,a,34); S_R2(a,b,c,d,e,35);
94 S_R2(e,a,b,c,d,36); S_R2(d,e,a,b,c,37); S_R2(c,d,e,a,b,38); S_R2(b,c,d,e,a,39);
95 S_R3(a,b,c,d,e,40); S_R3(e,a,b,c,d,41); S_R3(d,e,a,b,c,42); S_R3(c,d,e,a,b,43);
96 S_R3(b,c,d,e,a,44); S_R3(a,b,c,d,e,45); S_R3(e,a,b,c,d,46); S_R3(d,e,a,b,c,47);
97 S_R3(c,d,e,a,b,48); S_R3(b,c,d,e,a,49); S_R3(a,b,c,d,e,50); S_R3(e,a,b,c,d,51);
98 S_R3(d,e,a,b,c,52); S_R3(c,d,e,a,b,53); S_R3(b,c,d,e,a,54); S_R3(a,b,c,d,e,55);
99 S_R3(e,a,b,c,d,56); S_R3(d,e,a,b,c,57); S_R3(c,d,e,a,b,58); S_R3(b,c,d,e,a,59);
100 S_R4(a,b,c,d,e,60); S_R4(e,a,b,c,d,61); S_R4(d,e,a,b,c,62); S_R4(c,d,e,a,b,63);
101 S_R4(b,c,d,e,a,64); S_R4(a,b,c,d,e,65); S_R4(e,a,b,c,d,66); S_R4(d,e,a,b,c,67);
102 S_R4(c,d,e,a,b,68); S_R4(b,c,d,e,a,69); S_R4(a,b,c,d,e,70); S_R4(e,a,b,c,d,71);
103 S_R4(d,e,a,b,c,72); S_R4(c,d,e,a,b,73); S_R4(b,c,d,e,a,74); S_R4(a,b,c,d,e,75);
104 S_R4(e,a,b,c,d,76); S_R4(d,e,a,b,c,77); S_R4(c,d,e,a,b,78); S_R4(b,c,d,e,a,79);
105
106 // Add the working vars back into state
107 pState[0] += a;
108 pState[1] += b;
109 pState[2] += c;
110 pState[3] += d;
111 pState[4] += e;
112
113 // Wipe variables
114 #ifdef SHA1_WIPE_VARIABLES
115 a = b = c = d = e = 0;
116 #endif
117 }
118
119 void CSHA1::Update(const UINT_8* pbData, UINT_32 uLen)
120 {
121 UINT_32 j = ((m_count[0] >> 3) & 0x3F);
122
123 if((m_count[0] += (uLen << 3)) < (uLen << 3))
124 ++m_count[1]; // Overflow
125
126 m_count[1] += (uLen >> 29);
127
128 UINT_32 i;
129 if((j + uLen) > 63)
130 {
131 i = 64 - j;
132 memcpy(&m_buffer[j], pbData, i);
133 Transform(m_state, m_buffer);
134
135 for( ; (i + 63) < uLen; i += 64)
136 Transform(m_state, &pbData[i]);
137
138 j = 0;
139 }
140 else i = 0;
141
142 if((uLen - i) != 0)
143 memcpy(&m_buffer[j], &pbData[i], uLen - i);
144 }
145
146 #ifdef SHA1_UTILITY_FUNCTIONS
147 bool CSHA1::HashFile(const TCHAR* tszFileName)
148 {
149 if(tszFileName == NULL) return false;
150
151 FILE* fpIn = _tfopen(tszFileName, _T("rb"));
152 if(fpIn == NULL) return false;
153
154 UINT_8* pbData = new UINT_8[SHA1_MAX_FILE_BUFFER];
155 if(pbData == NULL) { fclose(fpIn); return false; }
156
157 bool bSuccess = true;
158 for(;;)
159 {
160 const size_t uRead = fread(pbData, 1, SHA1_MAX_FILE_BUFFER, fpIn);
161
162 if(uRead > 0)
163 Update(pbData, static_cast<UINT_32>(uRead));
164
165 if(uRead < SHA1_MAX_FILE_BUFFER)
166 {
167 if(feof(fpIn) == 0) bSuccess = false;
168 break;
169 }
170 }
171
172 fclose(fpIn);
173 delete[] pbData;
174 return bSuccess;
175 }
176 #endif
177
178 void CSHA1::Final()
179 {
180 UINT_32 i;
181
182 UINT_8 pbFinalCount[8];
183 for(i = 0; i < 8; ++i)
184 pbFinalCount[i] = static_cast<UINT_8>((m_count[((i >= 4) ? 0 : 1)] >>
185 ((3 - (i & 3)) * 8) ) & 0xFF); // Endian independent
186
187 Update((UINT_8*)"\200", 1);
188
189 while((m_count[0] & 504) != 448)
190 Update((UINT_8*)"\0", 1);
191
192 Update(pbFinalCount, 8); // Cause a Transform()
193
194 for(i = 0; i < 20; ++i)
195 m_digest[i] = static_cast<UINT_8>((m_state[i >> 2] >> ((3 -
196 (i & 3)) * 8)) & 0xFF);
197
198 // Wipe variables for security reasons
199 #ifdef SHA1_WIPE_VARIABLES
200 memset(m_buffer, 0, 64);
201 memset(m_state, 0, 20);
202 memset(m_count, 0, 8);
203 memset(pbFinalCount, 0, 8);
204 Transform(m_state, m_buffer);
205 #endif
206 }
207
208 #ifdef SHA1_UTILITY_FUNCTIONS
209 bool CSHA1::ReportHash(TCHAR* tszReport, REPORT_TYPE rtReportType) const
210 {
211 if(tszReport == NULL) return false;
212
213 TCHAR tszTemp[16];
214
215 if((rtReportType == REPORT_HEX) || (rtReportType == REPORT_HEX_SHORT))
216 {
217 _sntprintf(tszTemp, 15, _T("%02X"), m_digest[0]);
218 _tcscpy(tszReport, tszTemp);
219
220 const TCHAR* lpFmt = ((rtReportType == REPORT_HEX) ? _T(" %02X") : _T("%02X"));
221 for(size_t i = 1; i < 20; ++i)
222 {
223 _sntprintf(tszTemp, 15, lpFmt, m_digest[i]);
224 _tcscat(tszReport, tszTemp);
225 }
226 }
227 else if(rtReportType == REPORT_DIGIT)
228 {
229 _sntprintf(tszTemp, 15, _T("%u"), m_digest[0]);
230 _tcscpy(tszReport, tszTemp);
231
232 for(size_t i = 1; i < 20; ++i)
233 {
234 _sntprintf(tszTemp, 15, _T(" %u"), m_digest[i]);
235 _tcscat(tszReport, tszTemp);
236 }
237 }
238 else return false;
239
240 return true;
241 }
242 #endif
243
244 #ifdef SHA1_STL_FUNCTIONS
245 bool CSHA1::ReportHashStl(std::basic_string<TCHAR>& strOut, REPORT_TYPE rtReportType) const
246 {
247 TCHAR tszOut[84];
248 const bool bResult = ReportHash(tszOut, rtReportType);
249 if(bResult) strOut = tszOut;
250 return bResult;
251 }
252 #endif
253
254 bool CSHA1::GetHash(UINT_8* pbDest20) const
255 {
256 if(pbDest20 == NULL) return false;
257 memcpy(pbDest20, m_digest, 20);
258 return true;
259 }
260
261 // Get the raw message digest
262 // Added by Kevin to be quicker
263 unsigned char * CSHA1::GetHash( void ) const
264 {
265 return ( unsigned char * ) m_digest;
266 }
267
268 // http://cseweb.ucsd.edu/~mihir/papers/hmac-cb.pdf
269 // Sample code: http://www.opensource.apple.com/source/freeradius/freeradius-11/freeradius/src/lib/hmac.c
270 void CSHA1::HMAC(unsigned char *sharedKey, int sharedKeyLength, unsigned char *data, int dataLength, unsigned char output[SHA1_LENGTH])
271 {
272 // 1. Append zeros to the end of K to create a 64 byte string
273 static const int sha1BlockLength=64;
274
275 if (sharedKeyLength > sha1BlockLength)
276 sharedKeyLength = sha1BlockLength;
277
278 // ipad = the byte 0x36 repeated 64 times
279 // opad = the byte 0x5C repeated 64 times
280 unsigned char keyWithIpad[sha1BlockLength];
281 unsigned char keyWithOpad[sha1BlockLength];
282
283 memset( keyWithIpad, 0, sizeof(keyWithIpad));
284 memset( keyWithOpad, 0, sizeof(keyWithOpad));
285 memcpy( keyWithIpad, sharedKey, sharedKeyLength);
286 memcpy( keyWithOpad, sharedKey, sharedKeyLength);
287
288 for (int i = 0; i < sha1BlockLength; i++) {
289 keyWithIpad[i] ^= 0x36;
290 keyWithOpad[i] ^= 0x5c;
291 }
292
293 // 3. Append the data stream Text to the 64 byte string resulting from step (2)
294 // 4. Apply H to the stream generated in step (3)
295 CSHA1 firstHash;
296 firstHash.Reset();
297 firstHash.Update( keyWithIpad, sha1BlockLength );
298 firstHash.Update( data, dataLength );
299 firstHash.Final();
300
301 // 6. Append the H (hash) result from step (4) to the 64 byte string resulting from step (5)
302 // 7. Apply H to the stream generated in step (6) and output the result
303 CSHA1 secondHash;
304 secondHash.Reset();
305 secondHash.Update( keyWithOpad, sha1BlockLength );
306 secondHash.Update( firstHash.GetHash(), SHA1_LENGTH );
307 secondHash.Final();
308
309 memcpy(output, secondHash.GetHash(), SHA1_LENGTH);
310
311 // char report[128];
312 // memset(report,0,128);
313 // secondHash.ReportHash( report, 0 );
314 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • OrderedList
DataStructures::OrderedList< key_type, data_type, default_comparison_function > Member List

This is the complete list of members for DataStructures::OrderedList< key_type, data_type, default_comparison_function >, including all inherited members.

Clear(bool doNotDeallocate, const char *file, unsigned int line) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
GetElementFromKey(const key_type &key, int(*cf)(const key_type &, const data_type &)=default_comparison_function) const | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
GetElementFromKey(const key_type &key, data_type &element, int(*cf)(const key_type &, const data_type &)=default_comparison_function) const | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
GetIndexFromKey(const key_type &key, bool *objectExists, int(*cf)(const key_type &, const data_type &)=default_comparison_function) const | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
HasData(const key_type &key, int(*cf)(const key_type &, const data_type &)=default_comparison_function) const | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
IMPLEMENT_DEFAULT_COMPARISON(void) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > | inlinestatic
Insert(const key_type &key, const data_type &data, bool assertOnDuplicate, const char *file, unsigned int line, int(*cf)(const key_type &, const data_type &)=default_comparison_function) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
InsertAtEnd(const data_type &data, const char *file, unsigned int line) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
InsertAtIndex(const data_type &data, const unsigned index, const char *file, unsigned int line) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
operator=(const OrderedList &original_copy) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
operator[](const unsigned int position) const | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
orderedList | DataStructures::OrderedList< key_type, data_type, default_comparison_function > | protected
OrderedList() | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
OrderedList(const OrderedList &original_copy) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
Remove(const key_type &key, int(*cf)(const key_type &, const data_type &)=default_comparison_function) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
RemoveAtIndex(const unsigned index) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
RemoveFromEnd(const unsigned num=1) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
RemoveIfExists(const key_type &key, int(*cf)(const key_type &, const data_type &)=default_comparison_function) | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
Size(void) const | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
~OrderedList() | DataStructures::OrderedList< key_type, data_type, default_comparison_function > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Getche.cpp Source File

  • src
Getche.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #if defined(_WIN32)
17 #include <conio.h> /* _getche() */
18 #elif defined(__S3E__)
19
20 #else
21
22 #include "slikenet/Getche.h"
23
24 char _getche()
25 {
26
27
28 struct termios oldt,
29 newt;
30 char ch;
31 tcgetattr( STDIN_FILENO, &oldt );
32 newt = oldt;
33 newt.c_lflag &= ~( ICANON | ECHO );
34 tcsetattr( STDIN_FILENO, TCSANOW, &newt );
35 ch = getchar();
36 tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
37 return ch;
38
39 }
40 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StatisticsHistory
  • TrackedObject
SLNet::StatisticsHistory::TrackedObject Member List

This is the complete list of members for SLNet::StatisticsHistory::TrackedObject, including all inherited members.

dataQueues | SLNet::StatisticsHistory::TrackedObject
TrackedObject() | SLNet::StatisticsHistory::TrackedObject
trackedObjectData | SLNet::StatisticsHistory::TrackedObject
~TrackedObject() | SLNet::StatisticsHistory::TrackedObject
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • BytePool
DataStructures::BytePool Member List

This is the complete list of members for DataStructures::BytePool, including all inherited members.

Allocate(int bytesWanted, const char *file, unsigned int line) | DataStructures::BytePool |
BytePool() | DataStructures::BytePool |
Clear(const char *file, unsigned int line) | DataStructures::BytePool |
pool128 | DataStructures::BytePool | protected
pool2048 | DataStructures::BytePool | protected
pool512 | DataStructures::BytePool | protected
pool8192 | DataStructures::BytePool | protected
Release(unsigned char *data, const char *file, unsigned int line) | DataStructures::BytePool |
SetPageSize(int size) | DataStructures::BytePool |
~BytePool() | DataStructures::BytePool |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • ConsoleServer
SLNet::ConsoleServer Member List

This is the complete list of members for SLNet::ConsoleServer, including all inherited members.

AddCommandParser(CommandParserInterface *commandParserInterface) | SLNet::ConsoleServer |
commandParserList | SLNet::ConsoleServer | protected
ConsoleServer() | SLNet::ConsoleServer |
ListParsers(SystemAddress systemAddress) | SLNet::ConsoleServer | protected
password | SLNet::ConsoleServer | protected
prompt | SLNet::ConsoleServer | protected
RemoveCommandParser(CommandParserInterface *commandParserInterface) | SLNet::ConsoleServer |
SetPrompt(const char *_prompt) | SLNet::ConsoleServer |
SetTransportProvider(TransportInterface *transportInterface, unsigned short port) | SLNet::ConsoleServer |
ShowPrompt(SystemAddress systemAddress) | SLNet::ConsoleServer | protected
transport | SLNet::ConsoleServer | protected
Update(void) | SLNet::ConsoleServer |
~ConsoleServer() | SLNet::ConsoleServer |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Hash.h Source File

  • include
  • slikenet
DS_Hash.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #ifndef __HASH_H
22 #define __HASH_H
23
24 #include "assert.h"
25 #include <string.h> // memmove
26 #include "Export.h"
27 #include "memoryoverride.h"
28 #include "string.h"
29
32 namespace DataStructures
33 {
34 struct HashIndex
35 {
36 unsigned int primaryIndex;
37 unsigned int secondaryIndex;
38 bool IsInvalid(void) const {return primaryIndex==(unsigned int) -1;}
39 void SetInvalid(void) {primaryIndex=(unsigned int) -1; secondaryIndex=(unsigned int) -1;}
40 };
41
43 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
44 class RAK_DLL_EXPORT Hash
45 {
46 public:
48 Hash();
49
50 // Destructor
51 ~Hash();
52
53 void Push(key_type key, const data_type &input, const char *file, unsigned int line );
54 data_type* Peek(key_type key );
55 bool Pop(data_type& out, key_type key, const char *file, unsigned int line );
56 bool RemoveAtIndex(HashIndex index, const char *file, unsigned int line );
57 bool Remove(key_type key, const char *file, unsigned int line );
58 HashIndex GetIndexOf(key_type key);
59 bool HasData(key_type key);
60 data_type& ItemAtIndex(const HashIndex &index);
61 key_type KeyAtIndex(const HashIndex &index);
62 void GetAsList(DataStructures::List<data_type> &itemList,DataStructures::List<key_type > &keyList,const char *file, unsigned int line) const;
63 unsigned int Size(void) const;
64
66 void Clear( const char *file, unsigned int line );
67
68 struct Node
69 {
70 Node(key_type strIn, const data_type &_data) {string=strIn; data=_data;}
71 key_type string;
72 data_type data;
73 // Next in the list for this key
74 Node *next;
75 };
76
77 protected:
78 void ClearIndex(unsigned int index,const char *file, unsigned int line);
79 Node **nodeList;
80 unsigned int size;
81 };
82
83 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
84 Hash<key_type, data_type, HASH_SIZE, hashFunction>::Hash()
85 {
86 nodeList=0;
87 size=0;
88 }
89
90 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
91 Hash<key_type, data_type, HASH_SIZE, hashFunction>::~Hash()
92 {
93 Clear(_FILE_AND_LINE_);
94 }
95
96 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
97 void Hash<key_type, data_type, HASH_SIZE, hashFunction>::Push(key_type key, const data_type &input, const char *file, unsigned int line )
98 {
99 unsigned long hashIndex = (*hashFunction)(key) % HASH_SIZE;
100 if (nodeList==0)
101 {
102 nodeList= SLNet::OP_NEW_ARRAY<Node *>(HASH_SIZE,file,line);
103 memset(nodeList,0,sizeof(Node *)*HASH_SIZE);
104 }
105
106 Node *newNode= SLNet::OP_NEW_2<Node>(file,line,key,input);
107 newNode->next=nodeList[hashIndex];
108 nodeList[hashIndex]=newNode;
109
110 size++;
111 }
112
113 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
114 data_type* Hash<key_type, data_type, HASH_SIZE, hashFunction>::Peek(key_type key )
115 {
116 if (nodeList==0)
117 return 0;
118
119 unsigned long hashIndex = (*hashFunction)(key) % HASH_SIZE;
120 Node *node = nodeList[hashIndex];
121 while (node!=0)
122 {
123 if (node->string==key)
124 return &node->data;
125 node=node->next;
126 }
127 return 0;
128 }
129
130 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
131 bool Hash<key_type, data_type, HASH_SIZE, hashFunction>::Pop(data_type& out, key_type key, const char *file, unsigned int line )
132 {
133 if (nodeList==0)
134 return false;
135
136 unsigned long hashIndex = (*hashFunction)(key) % HASH_SIZE;
137 Node *node = nodeList[hashIndex];
138 if (node==0)
139 return false;
140 if (node->next==0)
141 {
142 // Only one item.
143 if (node->string==key)
144 {
145 // Delete last item
146 out=node->data;
147 ClearIndex(hashIndex,_FILE_AND_LINE_);
148 return true;
149 }
150 else
151 {
152 // Single item doesn't match
153 return false;
154 }
155 }
156 else if (node->string==key)
157 {
158 // First item does match, but more than one item
159 out=node->data;
160 nodeList[hashIndex]=node->next;
161 SLNet::OP_DELETE(node,file,line);
162 size--;
163 return true;
164 }
165
166 Node *last=node;
167 node=node->next;
168
169 while (node!=0)
170 {
171 // First item does not match, but subsequent item might
172 if (node->string==key)
173 {
174 out=node->data;
175 // Skip over subsequent item
176 last->next=node->next;
177 // Delete existing item
178 SLNet::OP_DELETE(node,file,line);
179 size--;
180 return true;
181 }
182 last=node;
183 node=node->next;
184 }
185 return false;
186 }
187
188 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
189 bool Hash<key_type, data_type, HASH_SIZE, hashFunction>::RemoveAtIndex(HashIndex index, const char *file, unsigned int line )
190 {
191 if (index.IsInvalid())
192 return false;
193
194 Node *node = nodeList[index.primaryIndex];
195 if (node==0)
196 return false;
197 if (node->next==0)
198 {
199 // Delete last item
200 ClearIndex(index.primaryIndex,file,line);
201 return true;
202 }
203 else if (index.secondaryIndex==0)
204 {
205 // First item does match, but more than one item
206 nodeList[index.primaryIndex]=node->next;
207 SLNet::OP_DELETE(node,file,line);
208 size--;
209 return true;
210 }
211
212 Node *last=node;
213 node=node->next;
214 --index.secondaryIndex;
215
216 while (index.secondaryIndex!=0)
217 {
218 last=node;
219 node=node->next;
220 --index.secondaryIndex;
221 }
222
223 // Skip over subsequent item
224 last->next=node->next;
225 // Delete existing item
226 SLNet::OP_DELETE(node,file,line);
227 size--;
228 return true;
229 }
230
231 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
232 bool Hash<key_type, data_type, HASH_SIZE, hashFunction>::Remove(key_type key, const char *file, unsigned int line )
233 {
234 return RemoveAtIndex(GetIndexOf(key),file,line);
235 }
236
237 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
238 HashIndex Hash<key_type, data_type, HASH_SIZE, hashFunction>::GetIndexOf(key_type key)
239 {
240 if (nodeList==0)
241 {
242 HashIndex temp;
243 temp.SetInvalid();
244 return temp;
245 }
246 HashIndex idx;
247 idx.primaryIndex=(*hashFunction)(key) % HASH_SIZE;
248 Node *node = nodeList[idx.primaryIndex];
249 if (node==0)
250 {
251 idx.SetInvalid();
252 return idx;
253 }
254 idx.secondaryIndex=0;
255 while (node!=0)
256 {
257 if (node->string==key)
258 {
259 return idx;
260 }
261 node=node->next;
262 idx.secondaryIndex++;
263 }
264
265 idx.SetInvalid();
266 return idx;
267 }
268
269 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
270 bool Hash<key_type, data_type, HASH_SIZE, hashFunction>::HasData(key_type key)
271 {
272 return GetIndexOf(key).IsInvalid()==false;
273 }
274
275 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
276 data_type& Hash<key_type, data_type, HASH_SIZE, hashFunction>::ItemAtIndex(const HashIndex &index)
277 {
278 Node *node = nodeList[index.primaryIndex];
279 RakAssert(node);
280 unsigned int i;
281 for (i=0; i < index.secondaryIndex; i++)
282 {
283 node=node->next;
284 RakAssert(node);
285 }
286 return node->data;
287 }
288
289 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
290 key_type Hash<key_type, data_type, HASH_SIZE, hashFunction>::KeyAtIndex(const HashIndex &index)
291 {
292 Node *node = nodeList[index.primaryIndex];
293 RakAssert(node);
294 unsigned int i;
295 for (i=0; i < index.secondaryIndex; i++)
296 {
297 node=node->next;
298 RakAssert(node);
299 }
300 return node->string;
301 }
302
303 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
304 void Hash<key_type, data_type, HASH_SIZE, hashFunction>::Clear(const char *file, unsigned int line)
305 {
306 if (nodeList)
307 {
308 unsigned int i;
309 for (i=0; i < HASH_SIZE; i++)
310 ClearIndex(i,file,line);
311 SLNet::OP_DELETE_ARRAY(nodeList,file,line);
312 nodeList=0;
313 size=0;
314 }
315 }
316
317 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
318 void Hash<key_type, data_type, HASH_SIZE, hashFunction>::ClearIndex(unsigned int index,const char *file, unsigned int line)
319 {
320 Node *node = nodeList[index];
321 Node *next;
322 while (node)
323 {
324 next=node->next;
325 SLNet::OP_DELETE(node,file,line);
326 node=next;
327 size--;
328 }
329 nodeList[index]=0;
330 }
331
332 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
333 void Hash<key_type, data_type, HASH_SIZE, hashFunction>::GetAsList(DataStructures::List<data_type> &itemList,DataStructures::List<key_type > &keyList,const char *file, unsigned int line) const
334 {
335 if (nodeList==0)
336 return;
337 itemList.Clear(false,_FILE_AND_LINE_);
338 keyList.Clear(false,_FILE_AND_LINE_);
339
340 Node *node;
341 unsigned int i;
342 for (i=0; i < HASH_SIZE; i++)
343 {
344 if (nodeList[i])
345 {
346 node=nodeList[i];
347 while (node)
348 {
349 itemList.Push(node->data,file,line);
350 keyList.Push(node->string,file,line);
351 node=node->next;
352 }
353 }
354 }
355 }
356 template <class key_type, class data_type, unsigned int HASH_SIZE, unsigned long (*hashFunction)(const key_type &) >
357 unsigned int Hash<key_type, data_type, HASH_SIZE, hashFunction>::Size(void) const
358 {
359 return size;
360 }
361 }
362 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/VariableDeltaSerializer.cpp Source File

  • src
VariableDeltaSerializer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/VariableDeltaSerializer.h"
17
18 using namespace SLNet;
19
20 VariableDeltaSerializer::VariableDeltaSerializer() {didComparisonThisTick=false;}
21 VariableDeltaSerializer::~VariableDeltaSerializer() {RemoveRemoteSystemVariableHistory();}
22
23 VariableDeltaSerializer::SerializationContext::SerializationContext() {variableHistoryIdentical=0; variableHistoryUnique=0;}
24 VariableDeltaSerializer::SerializationContext::~SerializationContext() {}
25
26 void VariableDeltaSerializer::OnMessageReceipt(RakNetGUID guid, uint32_t receiptId, bool messageArrived)
27 {
28 // Module?
29 if (messageArrived)
30 FreeVarsAssociatedWithReceipt(guid, receiptId);
31 else
32 DirtyAndFreeVarsAssociatedWithReceipt(guid, receiptId);
33
34 }
35
36 void VariableDeltaSerializer::BeginUnreliableAckedSerialize(SerializationContext *context, RakNetGUID _guid, BitStream *_bitStream, uint32_t _sendReceipt)
37 {
38 RakAssert(_guid!=UNASSIGNED_RAKNET_GUID);
39 context->anyVariablesWritten=false;
40 context->guid=_guid;
41 context->bitStream=_bitStream;
42 if (context->variableHistoryUnique==0)
43 context->variableHistoryUnique=StartVariableHistoryWrite(_guid);
44 context->variableHistory=context->variableHistoryUnique;
45 context->sendReceipt=_sendReceipt;
46 context->changedVariables = AllocChangedVariablesList();
47 context->newSystemSend=false;
48 context->serializationMode=UNRELIABLE_WITH_ACK_RECEIPT;
49 }
50
51 void VariableDeltaSerializer::BeginUniqueSerialize(SerializationContext *context, RakNetGUID _guid, BitStream *_bitStream)
52 {
53 RakAssert(_guid!=UNASSIGNED_RAKNET_GUID);
54 context->anyVariablesWritten=false;
55 context->guid=_guid;
56 context->bitStream=_bitStream;
57 if (context->variableHistoryUnique==0)
58 context->variableHistoryUnique=StartVariableHistoryWrite(_guid);
59 context->variableHistory=context->variableHistoryUnique;
60 context->newSystemSend=false;
61
62 context->serializationMode=RELIABLE;
63 }
64
65
66 void VariableDeltaSerializer::BeginIdenticalSerialize(SerializationContext *context, bool _isFirstSendToRemoteSystem, BitStream *_bitStream)
67 {
68 context->anyVariablesWritten=false;
69 context->guid=UNASSIGNED_RAKNET_GUID;
70 context->bitStream=_bitStream;
71 context->serializationMode=RELIABLE;
72 if (context->variableHistoryIdentical==0)
73 context->variableHistoryIdentical=StartVariableHistoryWrite(UNASSIGNED_RAKNET_GUID);
74 context->variableHistory=context->variableHistoryIdentical;
75 context->newSystemSend=_isFirstSendToRemoteSystem;
76 }
77
78 void VariableDeltaSerializer::EndSerialize(SerializationContext *context)
79 {
80 if (context->serializationMode==UNRELIABLE_WITH_ACK_RECEIPT)
81 {
82 if (context->anyVariablesWritten==false)
83 {
84 context->bitStream->Reset();
85 FreeChangedVariablesList(context->changedVariables);
86 return;
87 }
88
89 StoreChangedVariablesList(context->variableHistory, context->changedVariables, context->sendReceipt);
90 }
91 else
92 {
93 if (context->variableHistoryIdentical)
94 {
95 if (didComparisonThisTick==false)
96 {
97 didComparisonThisTick=true;
98 identicalSerializationBs.Reset();
99
100 if (context->anyVariablesWritten==false)
101 {
102 context->bitStream->Reset();
103 return;
104 }
105
106 identicalSerializationBs.Write(context->bitStream);
107 context->bitStream->ResetReadPointer();
108 }
109 else
110 {
111 context->bitStream->Write(&identicalSerializationBs);
112 identicalSerializationBs.ResetReadPointer();
113 }
114 }
115 else if (context->anyVariablesWritten==false)
116 {
117 context->bitStream->Reset();
118 return;
119 }
120 }
121 }
122
123 void VariableDeltaSerializer::BeginDeserialize(DeserializationContext *context, BitStream *_bitStream)
124 {
125 context->bitStream=_bitStream;
126 }
127
128 void VariableDeltaSerializer::EndDeserialize(DeserializationContext *context)
129 {
130 (void) context;
131 }
132
133 void VariableDeltaSerializer::AddRemoteSystemVariableHistory(RakNetGUID guid)
134 {
135 (void) guid;
136 }
137
138 void VariableDeltaSerializer::RemoveRemoteSystemVariableHistory(RakNetGUID guid)
139 {
140 unsigned int idx,idx2;
141 idx = GetVarsWrittenPerRemoteSystemListIndex(guid);
142 if (idx==(unsigned int)-1)
143 return;
144
145 if (remoteSystemVariableHistoryList[idx]->guid==guid)
146 {
147 // Memory pool doesn't call destructor
148 for (idx2=0; idx2 < remoteSystemVariableHistoryList[idx]->updatedVariablesHistory.Size(); idx2++)
149 {
150 FreeChangedVariablesList(remoteSystemVariableHistoryList[idx]->updatedVariablesHistory[idx2]);
151 }
152
153 delete remoteSystemVariableHistoryList[idx];
154 remoteSystemVariableHistoryList.RemoveAtIndexFast(idx);
155 return;
156 }
157 }
158
159 int SLNet::VariableDeltaSerializer::UpdatedVariablesListPtrComp( const uint32_t &key, ChangedVariablesList* const &data )
160 {
161 if (key<data->sendReceipt)
162 return -1;
163 if (key==data->sendReceipt)
164 return 0;
165 return 1;
166 }
167
168 void VariableDeltaSerializer::FreeVarsAssociatedWithReceipt(RakNetGUID guid, uint32_t receiptId)
169 {
170 unsigned int idx, idx2;
171 idx = GetVarsWrittenPerRemoteSystemListIndex(guid);
172 if (idx==(unsigned int)-1)
173 return;
174
175 RemoteSystemVariableHistory* vprs = remoteSystemVariableHistoryList[idx];
176 bool objectExists;
177 idx2=vprs->updatedVariablesHistory.GetIndexFromKey(receiptId,&objectExists);
178 if (objectExists)
179 {
180 // Free this history node
181 FreeChangedVariablesList(vprs->updatedVariablesHistory[idx2]);
182 vprs->updatedVariablesHistory.RemoveAtIndex(idx2);
183 }
184 }
185
186 void VariableDeltaSerializer::DirtyAndFreeVarsAssociatedWithReceipt(RakNetGUID guid, uint32_t receiptId)
187 {
188 unsigned int idx, idx2;
189 idx = GetVarsWrittenPerRemoteSystemListIndex(guid);
190 if (idx==(unsigned int)-1)
191 return;
192
193 RemoteSystemVariableHistory* vprs = remoteSystemVariableHistoryList[idx];
194 bool objectExists;
195 idx2=vprs->updatedVariablesHistory.GetIndexFromKey(receiptId,&objectExists);
196 if (objectExists)
197 {
198 // 'Dirty' all variables sent this update, meaning they will be resent the next time Serialize() is called
199 vprs->variableListDeltaTracker.FlagDirtyFromBitArray(vprs->updatedVariablesHistory[idx2]->bitField);
200
201 // Free this history node
202 FreeChangedVariablesList(vprs->updatedVariablesHistory[idx2]);
203 vprs->updatedVariablesHistory.RemoveAtIndex(idx2);
204 }
205 }
206 unsigned int VariableDeltaSerializer::GetVarsWrittenPerRemoteSystemListIndex(RakNetGUID guid)
207 {
208 unsigned int idx;
209 for (idx=0; idx < remoteSystemVariableHistoryList.Size(); idx++)
210 {
211 if (remoteSystemVariableHistoryList[idx]->guid==guid)
212 return idx;
213 }
214 return (unsigned int) -1;
215 }
216 void VariableDeltaSerializer::RemoveRemoteSystemVariableHistory(void)
217 {
218 unsigned int idx,idx2;
219 for (idx=0; idx < remoteSystemVariableHistoryList.Size(); idx++)
220 {
221 for (idx2=0; idx2 < remoteSystemVariableHistoryList[idx]->updatedVariablesHistory.Size(); idx2++)
222 {
223 FreeChangedVariablesList(remoteSystemVariableHistoryList[idx]->updatedVariablesHistory[idx2]);
224 }
225
226 delete remoteSystemVariableHistoryList[idx];
227 }
228 remoteSystemVariableHistoryList.Clear(false,_FILE_AND_LINE_);
229 }
230
231 VariableDeltaSerializer::RemoteSystemVariableHistory* VariableDeltaSerializer::GetRemoteSystemVariableHistory(RakNetGUID guid)
232 {
233 unsigned int rshli = GetRemoteSystemHistoryListIndex(guid);
234 return remoteSystemVariableHistoryList[rshli];
235 }
236
237 VariableDeltaSerializer::ChangedVariablesList *VariableDeltaSerializer::AllocChangedVariablesList(void)
238 {
239 VariableDeltaSerializer::ChangedVariablesList *p = updatedVariablesMemoryPool.Allocate(_FILE_AND_LINE_);
240 p->bitWriteIndex=0;
241 p->bitField[0]=0;
242 return p;
243 }
244 void VariableDeltaSerializer::FreeChangedVariablesList(ChangedVariablesList *changedVariables)
245 {
246 updatedVariablesMemoryPool.Release(changedVariables, _FILE_AND_LINE_);
247 }
248 void VariableDeltaSerializer::StoreChangedVariablesList(RemoteSystemVariableHistory *variableHistory, ChangedVariablesList *changedVariables, uint32_t sendReceipt)
249 {
250 changedVariables->sendReceipt=sendReceipt;
251 variableHistory->updatedVariablesHistory.Insert(changedVariables->sendReceipt,changedVariables,true,_FILE_AND_LINE_);
252 }
253
254 VariableDeltaSerializer::RemoteSystemVariableHistory *VariableDeltaSerializer::StartVariableHistoryWrite(RakNetGUID guid)
255 {
256 RemoteSystemVariableHistory *variableHistory;
257
258 unsigned int rshli = GetRemoteSystemHistoryListIndex(guid);
259 if (rshli==(unsigned int) -1)
260 {
261 variableHistory = new RemoteSystemVariableHistory;
262 variableHistory->guid=guid;
263 remoteSystemVariableHistoryList.Push(variableHistory,_FILE_AND_LINE_);
264 }
265 else
266 {
267 variableHistory=remoteSystemVariableHistoryList[rshli];
268 }
269
270 variableHistory->variableListDeltaTracker.StartWrite();
271 return variableHistory;
272 }
273 unsigned int VariableDeltaSerializer::GetRemoteSystemHistoryListIndex(RakNetGUID guid)
274 {
275 // Find the variable tracker for the target system
276 unsigned int idx;
277 for (idx=0; idx < remoteSystemVariableHistoryList.Size(); idx++)
278 {
279 if (remoteSystemVariableHistoryList[idx]->guid==guid)
280 {
281 return idx;
282 }
283 }
284 return (unsigned int) -1;
285 }
286
287 void VariableDeltaSerializer::OnPreSerializeTick(void)
288 {
289 didComparisonThisTick=false;
290 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TelnetTransport.h Source File

  • include
  • slikenet
TelnetTransport.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_TelnetTransport==1 && _RAKNET_SUPPORT_TCPInterface==1
23
24 #ifndef __TELNET_TRANSPORT
25 #define __TELNET_TRANSPORT
26
27 #include "TransportInterface.h"
28 #include "DS_List.h"
29 #include "Export.h"
30
31 namespace SLNet
32 {
34 class TCPInterface;
35 struct TelnetClient;
36
41 class RAK_DLL_EXPORT TelnetTransport : public TransportInterface
42 {
43 public:
44 // GetInstance() and DestroyInstance(instance*)
45 STATIC_FACTORY_DECLARATIONS(TelnetTransport)
46
47 TelnetTransport();
48 virtual ~TelnetTransport();
49 bool Start(unsigned short port, bool serverMode);
50 void Stop(void);
51 void Send( SystemAddress systemAddress, const char *data, ... );
52 void CloseConnection( SystemAddress systemAddress );
53 Packet* Receive( void );
54 void DeallocatePacket( Packet *packet );
55 SystemAddress HasNewIncomingConnection(void);
56 SystemAddress HasLostConnection(void);
57 CommandParserInterface* GetCommandParser(void);
58 void SetSendSuffix(const char *suffix);
59 void SetSendPrefix(const char *prefix);
60 protected:
61
62 struct TelnetClient
63 {
64 SystemAddress systemAddress;
65 char textInput[REMOTE_MAX_TEXT_INPUT];
66 char lastSentTextInput[REMOTE_MAX_TEXT_INPUT];
67 unsigned cursorPosition;
68 };
69
70 TCPInterface *tcpInterface;
71 void AutoAllocate(void);
72 bool ReassembleLine(TelnetTransport::TelnetClient* telnetClient, unsigned char c);
73
74 // Crap this sucks but because windows telnet won't send line at a time, I have to reconstruct the lines at the server per player
75 DataStructures::List<TelnetClient*> remoteClients;
76
77 char *sendSuffix, *sendPrefix;
78
79 };
80
81 } // namespace SLNet
82
83 #endif
84
85 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
  • SocketQueryOutput
SLNet::RakPeer::SocketQueryOutput Member List

This is the complete list of members for SLNet::RakPeer::SocketQueryOutput, including all inherited members.

SocketQueryOutput() | SLNet::RakPeer::SocketQueryOutput | inline
sockets | SLNet::RakPeer::SocketQueryOutput |
~SocketQueryOutput() | SLNet::RakPeer::SocketQueryOutput | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DirectoryDeltaTransfer.cpp Source File

  • src
DirectoryDeltaTransfer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_DirectoryDeltaTransfer==1 && _RAKNET_SUPPORT_FileOperations==1
18
19 #include "slikenet/DirectoryDeltaTransfer.h"
20 #include "slikenet/FileList.h"
21 #include "slikenet/StringCompressor.h"
22 #include "slikenet/peerinterface.h"
23 #include "slikenet/FileListTransfer.h"
24 #include "slikenet/FileListTransferCBInterface.h"
25 #include "slikenet/BitStream.h"
26 #include "slikenet/MessageIdentifiers.h"
27 #include "slikenet/FileOperations.h"
28 #include "slikenet/IncrementalReadInterface.h"
29 #include "slikenet/linux_adapter.h"
30 #include "slikenet/osx_adapter.h"
31
32 using namespace SLNet;
33
34 class DDTCallback : public FileListTransferCBInterface
35 {
36 public:
37 unsigned subdirLen;
38 char outputSubdir[512];
39 FileListTransferCBInterface *onFileCallback;
40
41 DDTCallback() {}
42 virtual ~DDTCallback() {}
43
44 virtual bool OnFile(OnFileStruct *onFileStruct)
45 {
46 char fullPathToDir[1024];
47
48 if (onFileStruct->fileData && subdirLen < strlen(onFileStruct->fileName))
49 {
50 strcpy_s(fullPathToDir, outputSubdir);
51 strcat_s(fullPathToDir, onFileStruct->fileName+subdirLen);
52 WriteFileWithDirectories(fullPathToDir, (char*)onFileStruct->fileData, (unsigned int ) onFileStruct->byteLengthOfThisFile);
53 }
54 else
55 fullPathToDir[0]=0;
56
57 return onFileCallback->OnFile(onFileStruct);
58 }
59
60 virtual void OnFileProgress(FileProgressStruct *fps)
61 {
62 char fullPathToDir[1024];
63
64 if (subdirLen < strlen(fps->onFileStruct->fileName))
65 {
66 strcpy_s(fullPathToDir, outputSubdir);
67 strcat_s(fullPathToDir, fps->onFileStruct->fileName+subdirLen);
68 }
69 else
70 fullPathToDir[0]=0;
71
72 onFileCallback->OnFileProgress(fps);
73 }
74 virtual bool OnDownloadComplete(DownloadCompleteStruct *dcs)
75 {
76 return onFileCallback->OnDownloadComplete(dcs);
77 }
78 };
79
80 STATIC_FACTORY_DEFINITIONS(DirectoryDeltaTransfer,DirectoryDeltaTransfer);
81
82 DirectoryDeltaTransfer::DirectoryDeltaTransfer()
83 {
84 applicationDirectory[0]=0;
85 fileListTransfer=0;
86 availableUploads = SLNet::OP_NEW<FileList>( _FILE_AND_LINE_ );
87 priority=HIGH_PRIORITY;
88 orderingChannel=0;
89 incrementalReadInterface=0;
90 }
91 DirectoryDeltaTransfer::~DirectoryDeltaTransfer()
92 {
93 SLNet::OP_DELETE(availableUploads, _FILE_AND_LINE_);
94 }
95 void DirectoryDeltaTransfer::SetFileListTransferPlugin(FileListTransfer *flt)
96 {
97 if (fileListTransfer)
98 {
99 DataStructures::List<FileListProgress*> fileListProgressList;
100 fileListTransfer->GetCallbacks(fileListProgressList);
101 unsigned int i;
102 for (i=0; i < fileListProgressList.Size(); i++)
103 availableUploads->RemoveCallback(fileListProgressList[i]);
104 }
105
106 fileListTransfer=flt;
107
108 if (flt)
109 {
110 DataStructures::List<FileListProgress*> fileListProgressList;
111 flt->GetCallbacks(fileListProgressList);
112 unsigned int i;
113 for (i=0; i < fileListProgressList.Size(); i++)
114 availableUploads->AddCallback(fileListProgressList[i]);
115 }
116 else
117 {
118 availableUploads->ClearCallbacks();
119 }
120 }
121 void DirectoryDeltaTransfer::SetApplicationDirectory(const char *pathToApplication)
122 {
123 if (pathToApplication==0 || pathToApplication[0]==0)
124 applicationDirectory[0]=0;
125 else
126 {
127 strncpy_s(applicationDirectory, pathToApplication, 510);
128 if (applicationDirectory[strlen(applicationDirectory)-1]!='/' && applicationDirectory[strlen(applicationDirectory)-1]!='\\')
129 strcat_s(applicationDirectory, "/");
130 applicationDirectory[511]=0;
131 }
132 }
133 void DirectoryDeltaTransfer::SetUploadSendParameters(PacketPriority _priority, char _orderingChannel)
134 {
135 priority=_priority;
136 orderingChannel=_orderingChannel;
137 }
138 void DirectoryDeltaTransfer::AddUploadsFromSubdirectory(const char *subdir)
139 {
140 availableUploads->AddFilesFromDirectory(applicationDirectory, subdir, true, false, true, FileListNodeContext(0,0,0,0));
141 }
142 unsigned short DirectoryDeltaTransfer::DownloadFromSubdirectory(FileList &localFiles, const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, SystemAddress host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel, FileListProgress *cb)
143 {
144 RakAssert(host!=UNASSIGNED_SYSTEM_ADDRESS);
145
146 DDTCallback *transferCallback;
147
148 localFiles.AddCallback(cb);
149
150 // Prepare the callback data
151 transferCallback = SLNet::OP_NEW<DDTCallback>( _FILE_AND_LINE_ );
152 if (subdir && subdir[0])
153 {
154 transferCallback->subdirLen=(unsigned int)strlen(subdir);
155 if (subdir[transferCallback->subdirLen-1]!='/' && subdir[transferCallback->subdirLen-1]!='\\')
156 transferCallback->subdirLen++;
157 }
158 else
159 transferCallback->subdirLen=0;
160 if (prependAppDirToOutputSubdir)
161 strcpy_s(transferCallback->outputSubdir, applicationDirectory);
162 else
163 transferCallback->outputSubdir[0]=0;
164 if (outputSubdir)
165 strcat_s(transferCallback->outputSubdir, outputSubdir);
166 if (transferCallback->outputSubdir[strlen(transferCallback->outputSubdir)-1]!='/' && transferCallback->outputSubdir[strlen(transferCallback->outputSubdir)-1]!='\\')
167 strcat_s(transferCallback->outputSubdir, "/");
168 transferCallback->onFileCallback=onFileCallback;
169
170 // Setup the transfer plugin to get the response to this download request
171 unsigned short setId = fileListTransfer->SetupReceive(transferCallback, true, host);
172
173 // Send to the host, telling it to process this request
174 SLNet::BitStream outBitstream;
175 outBitstream.Write((MessageID)ID_DDT_DOWNLOAD_REQUEST);
176 outBitstream.Write(setId);
177 StringCompressor::Instance()->EncodeString(subdir, 256, &outBitstream);
178 StringCompressor::Instance()->EncodeString(outputSubdir, 256, &outBitstream);
179 localFiles.Serialize(&outBitstream);
180 SendUnified(&outBitstream, _priority, RELIABLE_ORDERED, _orderingChannel, host, false);
181
182 return setId;
183 }
184 unsigned short DirectoryDeltaTransfer::DownloadFromSubdirectory(const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, SystemAddress host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel, FileListProgress *cb)
185 {
186 FileList localFiles;
187 // Get a hash of all the files that we already have (if any)
188 localFiles.AddFilesFromDirectory(prependAppDirToOutputSubdir ? applicationDirectory : 0, outputSubdir, true, false, true, FileListNodeContext(0,0,0,0));
189 return DownloadFromSubdirectory(localFiles, subdir, outputSubdir, prependAppDirToOutputSubdir, host, onFileCallback, _priority, _orderingChannel, cb);
190 }
191 void DirectoryDeltaTransfer::GenerateHashes(FileList &localFiles, const char *outputSubdir, bool prependAppDirToOutputSubdir)
192 {
193 localFiles.AddFilesFromDirectory(prependAppDirToOutputSubdir ? applicationDirectory : 0, outputSubdir, true, false, true, FileListNodeContext(0,0,0,0));
194 }
195 void DirectoryDeltaTransfer::ClearUploads(void)
196 {
197 availableUploads->Clear();
198 }
199 void DirectoryDeltaTransfer::OnDownloadRequest(Packet *packet)
200 {
201 char subdir[256];
202 char remoteSubdir[256];
203 SLNet::BitStream inBitstream(packet->data, packet->length, false);
204 FileList remoteFileHash;
205 FileList delta;
206 unsigned short setId;
207 inBitstream.IgnoreBits(8);
208 inBitstream.Read(setId);
209 StringCompressor::Instance()->DecodeString(subdir, 256, &inBitstream);
210 StringCompressor::Instance()->DecodeString(remoteSubdir, 256, &inBitstream);
211 if (remoteFileHash.Deserialize(&inBitstream)==false)
212 {
213 #ifdef _DEBUG
214 RakAssert(0);
215 #endif
216 return;
217 }
218
219 availableUploads->GetDeltaToCurrent(&remoteFileHash, &delta, subdir, remoteSubdir);
220 if (incrementalReadInterface==0)
221 delta.PopulateDataFromDisk(applicationDirectory, true, false, true);
222 else
223 delta.FlagFilesAsReferences();
224
225 // This will call the ddtCallback interface that was passed to FileListTransfer::SetupReceive on the remote system
226 fileListTransfer->Send(&delta, rakPeerInterface, packet->systemAddress, setId, priority, orderingChannel, incrementalReadInterface, chunkSize);
227 }
228 PluginReceiveResult DirectoryDeltaTransfer::OnReceive(Packet *packet)
229 {
230 switch (packet->data[0])
231 {
232 case ID_DDT_DOWNLOAD_REQUEST:
233 OnDownloadRequest(packet);
234 return RR_STOP_PROCESSING_AND_DEALLOCATE;
235 }
236
237 return RR_CONTINUE_PROCESSING;
238 }
239
240 unsigned DirectoryDeltaTransfer::GetNumberOfFilesForUpload(void) const
241 {
242 return availableUploads->fileList.Size();
243 }
244
245 void DirectoryDeltaTransfer::SetDownloadRequestIncrementalReadInterface(IncrementalReadInterface *_incrementalReadInterface, unsigned int _chunkSize)
246 {
247 incrementalReadInterface=_incrementalReadInterface;
248 chunkSize=_chunkSize;
249 }
250
251 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketizedTCP.h Source File

  • include
  • slikenet
PacketizedTCP.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
23
24 #ifndef __PACKETIZED_TCP
25 #define __PACKETIZED_TCP
26
27 #include "TCPInterface.h"
28 #include "DS_ByteQueue.h"
29 #include "DS_Map.h"
30
31 namespace SLNet
32 {
33
34 class RAK_DLL_EXPORT PacketizedTCP : public TCPInterface
35 {
36 public:
37 // GetInstance() and DestroyInstance(instance*)
38 STATIC_FACTORY_DECLARATIONS(PacketizedTCP)
39
40 PacketizedTCP();
41 virtual ~PacketizedTCP();
42
44 void Stop(void);
45
47 void Send( const char *data, unsigned length, const SystemAddress &systemAddress, bool broadcast );
48
49 // Sends a concatenated list of byte streams
50 bool SendList( const char **data, const unsigned int *lengths, const int numParameters, const SystemAddress &systemAddress, bool broadcast );
51
53 Packet* Receive( void );
54
56 void CloseConnection( SystemAddress systemAddress );
57
60 SystemAddress HasCompletedConnectionAttempt(void);
61
64 SystemAddress HasFailedConnectionAttempt(void);
65
67 SystemAddress HasNewIncomingConnection(void);
68
70 SystemAddress HasLostConnection(void);
71
72 protected:
73 void ClearAllConnections(void);
74 void RemoveFromConnectionList(const SystemAddress &sa);
75 void AddToConnectionList(const SystemAddress &sa);
76 void PushNotificationsToQueues(void);
77 Packet *ReturnOutgoingPacket(void);
78
79 // A single TCP recieve may generate multiple split packets. They are stored in the waitingPackets list until Receive is called
80 DataStructures::Queue<Packet*> waitingPackets;
81 DataStructures::Map<SystemAddress, DataStructures::ByteQueue *> connections;
82
83 // Mirrors single producer / consumer, but processes them in Receive() before returning to user
84 DataStructures::Queue<SystemAddress> _newIncomingConnections, _lostConnections, _failedConnectionAttempts, _completedConnectionAttempts;
85 };
86
87 } // namespace SLNet
88
89 #endif
90
91 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • PRO
SLNet::PRO Member List

This is the complete list of members for SLNet::PRO, including all inherited members.

operator!=(const PRO &right) const | SLNet::PRO
operator==(const PRO &right) const | SLNet::PRO
orderingChannel | SLNet::PRO
priority | SLNet::PRO
reliability | SLNet::PRO
sendReceipt | SLNet::PRO
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • SingleProducerConsumer
DataStructures::SingleProducerConsumer< SingleProducerConsumerType > Member List

This is the complete list of members for DataStructures::SingleProducerConsumer< SingleProducerConsumerType >, including all inherited members.

CancelReadLock(SingleProducerConsumerType *cancelToLocation) | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
CancelWriteLock(SingleProducerConsumerType *cancelToLocation) | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
CheckReadUnlockOrder(const SingleProducerConsumerType *data) const | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
Clear(void) | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
ReadIsLocked(void) const | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
ReadLock(void) | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
ReadUnlock(void) | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
SingleProducerConsumer() | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
Size(void) const | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
WriteLock(void) | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
WriteUnlock(void) | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
~SingleProducerConsumer() | DataStructures::SingleProducerConsumer< SingleProducerConsumerType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Windows_Linux_360.cpp Source File

  • src
RakNetSocket2_Windows_Linux_360.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_WINDOWS_LINUX_360_CPP
21 #define RAKNETSOCKET2_WINDOWS_LINUX_360_CPP
22
23 #if (defined(_WIN32) || defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(WINDOWS_STORE_RT) && !defined(__native_client__)
24
25 RNS2SendResult RNS2_Windows_Linux_360::Send_Windows_Linux_360NoVDP( RNS2Socket rns2Socket, RNS2_SendParameters *sendParameters, const char *file, unsigned int line ) {
26
27 int len=0;
28 do
29 {
30 (void) file;
31 (void) line;
32
33
34 int oldTTL=-1;
35 if (sendParameters->ttl>0)
36 {
37 socklen_t opLen=sizeof(oldTTL);
38 // Get the current TTL
39 if (getsockopt__(rns2Socket, sendParameters->systemAddress.GetIPPROTO(), IP_TTL, ( char * ) & oldTTL, &opLen ) != -1)
40 {
41 int newTTL=sendParameters->ttl;
42 setsockopt__(rns2Socket, sendParameters->systemAddress.GetIPPROTO(), IP_TTL, ( char * ) & newTTL, sizeof ( newTTL ) );
43 }
44 }
45
46
47 if (sendParameters->systemAddress.address.addr4.sin_family==AF_INET)
48 {
49 len = sendto__( rns2Socket, sendParameters->data, sendParameters->length, 0, ( const sockaddr* ) & sendParameters->systemAddress.address.addr4, sizeof( sockaddr_in ) );
50 }
51 else
52 {
53 #if RAKNET_SUPPORT_IPV6==1
54 len = sendto__( rns2Socket, sendParameters->data, sendParameters->length, 0, ( const sockaddr* ) & sendParameters->systemAddress.address.addr6, sizeof( sockaddr_in6 ) );
55 #endif
56 }
57
58 if (len<0)
59 {
60 RAKNET_DEBUG_PRINTF("sendto failed with code %i for char %i and length %i.\n", len, sendParameters->data[0], sendParameters->length);
61 }
62
63
64 if (oldTTL!=-1)
65 {
66 setsockopt__(rns2Socket, sendParameters->systemAddress.GetIPPROTO(), IP_TTL, ( char * ) & oldTTL, sizeof ( oldTTL ) );
67 }
68
69 }
70 while ( len == 0 );
71 return len;
72 }
73
74 #endif // Windows, Linux, 360
75
76 #endif // file header
77
78 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatPunchthroughServer.cpp Source File

  • src
NatPunchthroughServer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_NatPunchthroughServer==1
18
19 #include "slikenet/NatPunchthroughServer.h"
20 #include "slikenet/SocketLayer.h"
21 #include "slikenet/BitStream.h"
22 #include "slikenet/MessageIdentifiers.h"
23 #include "slikenet/peerinterface.h"
24 #include "slikenet/MTUSize.h"
25 #include "slikenet/GetTime.h"
26 #include "slikenet/PacketLogger.h"
27 #include "slikenet/linux_adapter.h"
28 #include "slikenet/osx_adapter.h"
29
30 using namespace SLNet;
31
32 void NatPunchthroughServerDebugInterface_Printf::OnServerMessage(const char *msg)
33 {
34 printf("%s\n", msg);
35 }
36 #if _RAKNET_SUPPORT_PacketLogger==1
37 void NatPunchthroughServerDebugInterface_PacketLogger::OnServerMessage(const char *msg)
38 {
39 if (pl)
40 {
41 pl->WriteMiscellaneous("Nat", msg);
42 }
43 }
44 #endif
45
46 void NatPunchthroughServer::User::DeleteConnectionAttempt(NatPunchthroughServer::ConnectionAttempt *ca)
47 {
48 unsigned int index = connectionAttempts.GetIndexOf(ca);
49 if ((unsigned int)index!=(unsigned int)-1)
50 {
51 SLNet::OP_DELETE(ca,_FILE_AND_LINE_);
52 connectionAttempts.RemoveAtIndex(index);
53 }
54 }
55 void NatPunchthroughServer::User::DerefConnectionAttempt(NatPunchthroughServer::ConnectionAttempt *ca)
56 {
57 unsigned int index = connectionAttempts.GetIndexOf(ca);
58 if ((unsigned int)index!=(unsigned int)-1)
59 {
60 connectionAttempts.RemoveAtIndex(index);
61 }
62 }
63 bool NatPunchthroughServer::User::HasConnectionAttemptToUser(User *user)
64 {
65 unsigned int index;
66 for (index=0; index < connectionAttempts.Size(); index++)
67 {
68 if (connectionAttempts[index]->recipient->guid==user->guid ||
69 connectionAttempts[index]->sender->guid==user->guid)
70 return true;
71 }
72 return false;
73 }
74 void NatPunchthroughServer::User::LogConnectionAttempts(SLNet::RakString &rs)
75 {
76 rs.Clear();
77 unsigned int index;
78 char guidStr[128], ipStr[128];
79 guid.ToString(guidStr, 128);
80 systemAddress.ToString(true,ipStr,static_cast<size_t>(128));
81 rs= SLNet::RakString("User systemAddress=%s guid=%s\n", ipStr, guidStr);
82 rs+= SLNet::RakString("%i attempts in list:\n", connectionAttempts.Size());
83 for (index=0; index < connectionAttempts.Size(); index++)
84 {
85 rs+= SLNet::RakString("%i. SessionID=%i ", index+1, connectionAttempts[index]->sessionId);
86 if (connectionAttempts[index]->sender==this)
87 rs+="(We are sender) ";
88 else
89 rs+="(We are recipient) ";
90 if (isReady)
91 rs+="(READY TO START) ";
92 else
93 rs+="(NOT READY TO START) ";
94 if (connectionAttempts[index]->attemptPhase==NatPunchthroughServer::ConnectionAttempt::NAT_ATTEMPT_PHASE_NOT_STARTED)
95 rs+="(NOT_STARTED). ";
96 else
97 rs+="(GETTING_RECENT_PORTS). ";
98 if (connectionAttempts[index]->sender==this)
99 {
100 connectionAttempts[index]->recipient->guid.ToString(guidStr, 128);
101 connectionAttempts[index]->recipient->systemAddress.ToString(true,ipStr,static_cast<size_t>(128));
102 }
103 else
104 {
105 connectionAttempts[index]->sender->guid.ToString(guidStr, 128);
106 connectionAttempts[index]->sender->systemAddress.ToString(true,ipStr,static_cast<size_t>(128));
107 }
108
109 rs+= SLNet::RakString("Target systemAddress=%s, guid=%s.\n", ipStr, guidStr);
110 }
111 }
112
113 int SLNet::NatPunchthroughServer::NatPunchthroughUserComp( const RakNetGUID &key, User * const &data )
114 {
115 if (key < data->guid)
116 return -1;
117 if (key > data->guid)
118 return 1;
119 return 0;
120 }
121
122 STATIC_FACTORY_DEFINITIONS(NatPunchthroughServer,NatPunchthroughServer);
123
124 NatPunchthroughServer::NatPunchthroughServer()
125 {
126 lastUpdate=0;
127 sessionId=0;
128 natPunchthroughServerDebugInterface=0;
129 for (int i=0; i < MAXIMUM_NUMBER_OF_INTERNAL_IDS; i++)
130 boundAddresses[i]=UNASSIGNED_SYSTEM_ADDRESS;
131 boundAddressCount=0;
132 }
133 NatPunchthroughServer::~NatPunchthroughServer()
134 {
135 User *user, *otherUser;
136 ConnectionAttempt *connectionAttempt;
137 unsigned int j;
138 while(users.Size())
139 {
140 user = users[0];
141 for (j=0; j < user->connectionAttempts.Size(); j++)
142 {
143 connectionAttempt=user->connectionAttempts[j];
144 if (connectionAttempt->sender==user)
145 otherUser=connectionAttempt->recipient;
146 else
147 otherUser=connectionAttempt->sender;
148 otherUser->DeleteConnectionAttempt(connectionAttempt);
149 }
150 SLNet::OP_DELETE(user,_FILE_AND_LINE_);
151 users[0]=users[users.Size()-1];
152 users.RemoveAtIndex(users.Size()-1);
153 }
154 }
155 void NatPunchthroughServer::SetDebugInterface(NatPunchthroughServerDebugInterface *i)
156 {
157 natPunchthroughServerDebugInterface=i;
158 }
159 void NatPunchthroughServer::Update(void)
160 {
161 ConnectionAttempt *connectionAttempt;
162 User *user, *recipient;
163 unsigned int i,j;
164 SLNet::Time time = SLNet::GetTime();
165 if (time > lastUpdate+250)
166 {
167 lastUpdate=time;
168
169 for (i=0; i < users.Size(); i++)
170 {
171 user=users[i];
172 for (j=0; j < user->connectionAttempts.Size(); j++)
173 {
174 connectionAttempt=user->connectionAttempts[j];
175 if (connectionAttempt->sender==user)
176 {
177 if (connectionAttempt->attemptPhase!=ConnectionAttempt::NAT_ATTEMPT_PHASE_NOT_STARTED &&
178 time > connectionAttempt->startTime &&
179 time > 10000 + connectionAttempt->startTime ) // Formerly 5000, but sometimes false positives
180 {
181 SLNet::BitStream outgoingBs;
182
183 // that other system might not be running the plugin
184 outgoingBs.Write((MessageID)ID_NAT_TARGET_UNRESPONSIVE);
185 outgoingBs.Write(connectionAttempt->recipient->guid);
186 outgoingBs.Write(connectionAttempt->sessionId);
187 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,connectionAttempt->sender->systemAddress,false);
188
189 // 05/28/09 Previously only told sender about ID_NAT_CONNECTION_TO_TARGET_LOST
190 // However, recipient may be expecting it due to external code
191 // In that case, recipient would never get any response if the sender dropped
192 outgoingBs.Reset();
193 outgoingBs.Write((MessageID)ID_NAT_TARGET_UNRESPONSIVE);
194 outgoingBs.Write(connectionAttempt->sender->guid);
195 outgoingBs.Write(connectionAttempt->sessionId);
196 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,connectionAttempt->recipient->systemAddress,false);
197
198 connectionAttempt->sender->isReady=true;
199 connectionAttempt->recipient->isReady=true;
200 recipient=connectionAttempt->recipient;
201
202
203 if (natPunchthroughServerDebugInterface)
204 {
205 char str[1024];
206 char addr1[128], addr2[128];
207 // 8/01/09 Fixed bug where this was after DeleteConnectionAttempt()
208 connectionAttempt->sender->systemAddress.ToString(true,addr1,static_cast<size_t>(128));
209 connectionAttempt->recipient->systemAddress.ToString(true,addr2,static_cast<size_t>(128));
210 sprintf_s(str, "Sending ID_NAT_TARGET_UNRESPONSIVE to sender %s and recipient %s.", addr1, addr2);
211 natPunchthroughServerDebugInterface->OnServerMessage(str);
212 SLNet::RakString log;
213 connectionAttempt->sender->LogConnectionAttempts(log);
214 connectionAttempt->recipient->LogConnectionAttempts(log);
215 }
216
217
218 connectionAttempt->sender->DerefConnectionAttempt(connectionAttempt);
219 connectionAttempt->recipient->DeleteConnectionAttempt(connectionAttempt);
220
221 StartPunchthroughForUser(user);
222 StartPunchthroughForUser(recipient);
223
224 break;
225 }
226 }
227 }
228 }
229 }
230 }
231 PluginReceiveResult NatPunchthroughServer::OnReceive(Packet *packet)
232 {
233 switch (packet->data[0])
234 {
235 case ID_NAT_PUNCHTHROUGH_REQUEST:
236 OnNATPunchthroughRequest(packet);
237 return RR_STOP_PROCESSING_AND_DEALLOCATE;
238 case ID_NAT_GET_MOST_RECENT_PORT:
239 OnGetMostRecentPort(packet);
240 return RR_STOP_PROCESSING_AND_DEALLOCATE;
241 case ID_NAT_CLIENT_READY:
242 OnClientReady(packet);
243 return RR_STOP_PROCESSING_AND_DEALLOCATE;
244 case ID_NAT_REQUEST_BOUND_ADDRESSES:
245 {
246 SLNet::BitStream outgoingBs;
247 outgoingBs.Write((MessageID)ID_NAT_RESPOND_BOUND_ADDRESSES);
248
249 if (boundAddresses[0]==UNASSIGNED_SYSTEM_ADDRESS)
250 {
251 DataStructures::List<RakNetSocket2* > sockets;
252 rakPeerInterface->GetSockets(sockets);
253 for (unsigned i=0; i < sockets.Size() && i < MAXIMUM_NUMBER_OF_INTERNAL_IDS; i++)
254 {
255 boundAddresses[i]=sockets[i]->GetBoundAddress();
256 boundAddressCount++;
257 }
258 }
259
260 outgoingBs.Write(boundAddressCount);
261 for (int i=0; i < boundAddressCount; i++)
262 {
263 outgoingBs.Write(boundAddresses[i]);
264 }
265
266 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
267 }
268 return RR_STOP_PROCESSING_AND_DEALLOCATE;
269 case ID_NAT_PING:
270 {
271 }
272 return RR_STOP_PROCESSING_AND_DEALLOCATE;
273 case ID_OUT_OF_BAND_INTERNAL:
274 if (packet->length>=2 && packet->data[1]==ID_NAT_PING)
275 {
276 SLNet::BitStream bs(packet->data,packet->length,false);
277 bs.IgnoreBytes(sizeof(MessageID)*2);
278 uint16_t externalPort;
279 bs.Read(externalPort);
280
281 SLNet::BitStream outgoingBs;
282 outgoingBs.Write((MessageID)ID_NAT_PONG);
283 outgoingBs.Write(externalPort);
284 uint16_t externalPort2 = packet->systemAddress.GetPort();
285 outgoingBs.Write(externalPort2);
286 rakPeerInterface->SendOutOfBand((const char*) packet->systemAddress.ToString(false),packet->systemAddress.GetPort(),(const char*) outgoingBs.GetData(),outgoingBs.GetNumberOfBytesUsed());
287
288 return RR_STOP_PROCESSING_AND_DEALLOCATE;
289 }
290 }
291 return RR_CONTINUE_PROCESSING;
292 }
293 void NatPunchthroughServer::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
294 {
295 (void) lostConnectionReason;
296 (void) systemAddress;
297
298 unsigned int i=0;
299 bool objectExists;
300 i = users.GetIndexFromKey(rakNetGUID, &objectExists);
301 if (objectExists)
302 {
303 SLNet::BitStream outgoingBs;
304 DataStructures::List<User *> freedUpInProgressUsers;
305 User *user = users[i];
306 User *otherUser;
307 unsigned int connectionAttemptIndex;
308 ConnectionAttempt *connectionAttempt;
309 for (connectionAttemptIndex=0; connectionAttemptIndex < user->connectionAttempts.Size(); connectionAttemptIndex++)
310 {
311 connectionAttempt=user->connectionAttempts[connectionAttemptIndex];
312 outgoingBs.Reset();
313 if (connectionAttempt->recipient==user)
314 {
315 otherUser=connectionAttempt->sender;
316 }
317 else
318 {
319 otherUser=connectionAttempt->recipient;
320 }
321
322 // 05/28/09 Previously only told sender about ID_NAT_CONNECTION_TO_TARGET_LOST
323 // However, recipient may be expecting it due to external code
324 // In that case, recipient would never get any response if the sender dropped
325 outgoingBs.Write((MessageID)ID_NAT_CONNECTION_TO_TARGET_LOST);
326 outgoingBs.Write(rakNetGUID);
327 outgoingBs.Write(connectionAttempt->sessionId);
328 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,otherUser->systemAddress,false);
329
330 // 4/22/09 - Bug: was checking inProgress, legacy variable not used elsewhere
331 if (connectionAttempt->attemptPhase==ConnectionAttempt::NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS)
332 {
333 otherUser->isReady=true;
334 freedUpInProgressUsers.Insert(otherUser, _FILE_AND_LINE_ );
335 }
336
337 otherUser->DeleteConnectionAttempt(connectionAttempt);
338 }
339
340 SLNet::OP_DELETE(users[i], _FILE_AND_LINE_);
341 users.RemoveAtIndex(i);
342
343 for (i=0; i < freedUpInProgressUsers.Size(); i++)
344 {
345 StartPunchthroughForUser(freedUpInProgressUsers[i]);
346 }
347 }
348
349 /*
350 // Also remove from groupPunchthroughRequests
351 for (i=0; i < users.Size(); i++)
352 {
353 bool objectExists;
354 unsigned int gprIndex;
355 gprIndex = users[i]->groupPunchthroughRequests.GetIndexFromKey(rakNetGUID, &objectExists);
356 if (objectExists)
357 {
358 // printf("DEBUG %i\n", __LINE__);
359
360 SLNet::BitStream outgoingBs;
361 outgoingBs.Write((MessageID)ID_NAT_TARGET_NOT_CONNECTED);
362 outgoingBs.Write(rakNetGUID);
363 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,users[i]->systemAddress,false);
364
365 users[i]->groupPunchthroughRequests.RemoveAtIndex(gprIndex);
366 }
367 }
368 */
369 }
370
371 void NatPunchthroughServer::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
372 {
373 (void) systemAddress;
374 (void) isIncoming;
375
376 User *user = SLNet::OP_NEW<User>(_FILE_AND_LINE_);
377 user->guid=rakNetGUID;
378 user->mostRecentPort=0;
379 user->systemAddress=systemAddress;
380 user->isReady=true;
381 users.Insert(rakNetGUID, user, true, _FILE_AND_LINE_);
382
383 // printf("Adding to users %s\n", rakNetGUID.ToString());
384 // printf("DEBUG users[0] guid=%s\n", users[0]->guid.ToString());
385 }
386 void NatPunchthroughServer::OnNATPunchthroughRequest(Packet *packet)
387 {
388 SLNet::BitStream outgoingBs;
389 SLNet::BitStream incomingBs(packet->data, packet->length, false);
390 incomingBs.IgnoreBytes(sizeof(MessageID));
391 RakNetGUID recipientGuid, senderGuid;
392 incomingBs.Read(recipientGuid);
393 senderGuid=packet->guid;
394 unsigned int i;
395 bool objectExists;
396 i = users.GetIndexFromKey(senderGuid, &objectExists);
397 RakAssert(objectExists);
398
399 ConnectionAttempt *ca = SLNet::OP_NEW<ConnectionAttempt>(_FILE_AND_LINE_);
400 ca->sender=users[i];
401 ca->sessionId=sessionId++;
402 i = users.GetIndexFromKey(recipientGuid, &objectExists);
403 if (objectExists==false || ca->sender == ca->recipient)
404 {
405 // printf("DEBUG %i\n", __LINE__);
406 // printf("DEBUG recipientGuid=%s\n", recipientGuid.ToString());
407 // printf("DEBUG users[0] guid=%s\n", users[0]->guid.ToString());
408
409 outgoingBs.Write((MessageID)ID_NAT_TARGET_NOT_CONNECTED);
410 outgoingBs.Write(recipientGuid);
411 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
412 SLNet::OP_DELETE(ca,_FILE_AND_LINE_);
413 return;
414 }
415 ca->recipient=users[i];
416 if (ca->recipient->HasConnectionAttemptToUser(ca->sender))
417 {
418 outgoingBs.Write((MessageID)ID_NAT_ALREADY_IN_PROGRESS);
419 outgoingBs.Write(recipientGuid);
420 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
421 SLNet::OP_DELETE(ca,_FILE_AND_LINE_);
422 return;
423 }
424
425 ca->sender->connectionAttempts.Insert(ca, _FILE_AND_LINE_ );
426 ca->recipient->connectionAttempts.Insert(ca, _FILE_AND_LINE_ );
427
428 StartPunchthroughForUser(ca->sender);
429 }
430 void NatPunchthroughServer::OnClientReady(Packet *packet)
431 {
432 unsigned int i;
433 bool objectExists;
434 i = users.GetIndexFromKey(packet->guid, &objectExists);
435 if (objectExists)
436 {
437 users[i]->isReady=true;
438 StartPunchthroughForUser(users[i]);
439 }
440 }
441 void NatPunchthroughServer::OnGetMostRecentPort(Packet *packet)
442 {
443 SLNet::BitStream bsIn(packet->data, packet->length, false);
444 bsIn.IgnoreBytes(sizeof(MessageID));
445 uint16_t curSessionId;
446 unsigned short mostRecentPort;
447 bsIn.Read(curSessionId);
448 bsIn.Read(mostRecentPort);
449
450 unsigned int i,j;
451 User *user;
452 ConnectionAttempt *connectionAttempt;
453 bool objectExists;
454 i = users.GetIndexFromKey(packet->guid, &objectExists);
455
456 if (natPunchthroughServerDebugInterface)
457 {
458 SLNet::RakString log;
459 char addr1[128], addr2[128];
460 packet->systemAddress.ToString(true,addr1,static_cast<size_t>(128));
461 packet->guid.ToString(addr2, 128);
462 log= SLNet::RakString("Got ID_NAT_GET_MOST_RECENT_PORT from systemAddress %s guid %s. port=%i. sessionId=%i. userFound=%i.", addr1, addr2, mostRecentPort, curSessionId, objectExists);
463 natPunchthroughServerDebugInterface->OnServerMessage(log.C_String());
464 }
465
466 if (objectExists)
467 {
468 user=users[i];
469 user->mostRecentPort=mostRecentPort;
470 SLNet::Time time = SLNet::GetTime();
471
472 for (j=0; j < user->connectionAttempts.Size(); j++)
473 {
474 connectionAttempt=user->connectionAttempts[j];
475 if (connectionAttempt->attemptPhase==ConnectionAttempt::NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS &&
476 connectionAttempt->sender->mostRecentPort!=0 &&
477 connectionAttempt->recipient->mostRecentPort!=0 &&
478 // 04/29/08 add sessionId to prevent processing for other systems
479 connectionAttempt->sessionId== curSessionId)
480 {
481 SystemAddress senderSystemAddress = connectionAttempt->sender->systemAddress;
482 SystemAddress recipientSystemAddress = connectionAttempt->recipient->systemAddress;
483 SystemAddress recipientTargetAddress = recipientSystemAddress;
484 SystemAddress senderTargetAddress = senderSystemAddress;
485 recipientTargetAddress.SetPortHostOrder(connectionAttempt->recipient->mostRecentPort);
486 senderTargetAddress.SetPortHostOrder(connectionAttempt->sender->mostRecentPort);
487
488 // Pick a time far enough in the future that both systems will have gotten the message
489 int targetPing = rakPeerInterface->GetAveragePing(recipientTargetAddress);
490 int senderPing = rakPeerInterface->GetAveragePing(senderSystemAddress);
491 SLNet::Time simultaneousAttemptTime;
492 if (targetPing==-1 || senderPing==-1)
493 simultaneousAttemptTime = time + 1500;
494 else
495 {
496 int largerPing = targetPing > senderPing ? targetPing : senderPing;
497 if (largerPing * 4 < 100)
498 simultaneousAttemptTime = time + 100;
499 else
500 simultaneousAttemptTime = time + (largerPing * 4);
501 }
502
503 if (natPunchthroughServerDebugInterface)
504 {
505 SLNet::RakString log;
506 char addr1[128], addr2[128];
507 recipientSystemAddress.ToString(true,addr1,static_cast<size_t>(128));
508 connectionAttempt->recipient->guid.ToString(addr2, 128);
509 log= SLNet::RakString("Sending ID_NAT_CONNECT_AT_TIME to recipient systemAddress %s guid %s", addr1, addr2);
510 natPunchthroughServerDebugInterface->OnServerMessage(log.C_String());
511 }
512
513 // Send to recipient timestamped message to connect at time
514 SLNet::BitStream bsOut;
515 bsOut.Write((MessageID)ID_TIMESTAMP);
516 bsOut.Write(simultaneousAttemptTime);
517 bsOut.Write((MessageID)ID_NAT_CONNECT_AT_TIME);
518 bsOut.Write(connectionAttempt->sessionId);
519 bsOut.Write(senderTargetAddress); // Public IP, using most recent port
520 for (j=0; j < MAXIMUM_NUMBER_OF_INTERNAL_IDS; j++) // Internal IP
521 bsOut.Write(rakPeerInterface->GetInternalID(senderSystemAddress,j));
522 bsOut.Write(connectionAttempt->sender->guid);
523 bsOut.Write(false);
524 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,recipientSystemAddress,false);
525
526
527 if (natPunchthroughServerDebugInterface)
528 {
529 SLNet::RakString log;
530 char addr1[128], addr2[128];
531 senderSystemAddress.ToString(true,addr1,static_cast<size_t>(128));
532 connectionAttempt->sender->guid.ToString(addr2, 128);
533 log= SLNet::RakString("Sending ID_NAT_CONNECT_AT_TIME to sender systemAddress %s guid %s", addr1, addr2);
534 natPunchthroughServerDebugInterface->OnServerMessage(log.C_String());
535 }
536
537
538 // Same for sender
539 bsOut.Reset();
540 bsOut.Write((MessageID)ID_TIMESTAMP);
541 bsOut.Write(simultaneousAttemptTime);
542 bsOut.Write((MessageID)ID_NAT_CONNECT_AT_TIME);
543 bsOut.Write(connectionAttempt->sessionId);
544 bsOut.Write(recipientTargetAddress); // Public IP, using most recent port
545 for (j=0; j < MAXIMUM_NUMBER_OF_INTERNAL_IDS; j++) // Internal IP
546 bsOut.Write(rakPeerInterface->GetInternalID(recipientSystemAddress,j));
547 bsOut.Write(connectionAttempt->recipient->guid);
548 bsOut.Write(true);
549 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,senderSystemAddress,false);
550
551 connectionAttempt->recipient->DerefConnectionAttempt(connectionAttempt);
552 connectionAttempt->sender->DeleteConnectionAttempt(connectionAttempt);
553
554 // 04/29/08 missing return
555 return;
556 }
557 }
558 }
559 else
560 {
561
562 if (natPunchthroughServerDebugInterface)
563 {
564 SLNet::RakString log;
565 char addr1[128], addr2[128];
566 packet->systemAddress.ToString(true,addr1,static_cast<size_t>(128));
567 packet->guid.ToString(addr2, 128);
568 log= SLNet::RakString("Ignoring ID_NAT_GET_MOST_RECENT_PORT from systemAddress %s guid %s", addr1, addr2);
569 natPunchthroughServerDebugInterface->OnServerMessage(log.C_String());
570 }
571
572 }
573 }
574 void NatPunchthroughServer::StartPunchthroughForUser(User *user)
575 {
576 if (user->isReady==false)
577 return;
578
579 ConnectionAttempt *connectionAttempt;
580 User *sender,*recipient,*otherUser;
581 unsigned int i;
582 for (i=0; i < user->connectionAttempts.Size(); i++)
583 {
584 connectionAttempt=user->connectionAttempts[i];
585 if (connectionAttempt->sender==user)
586 {
587 otherUser=connectionAttempt->recipient;
588 sender=user;
589 recipient=otherUser;
590 }
591 else
592 {
593 otherUser=connectionAttempt->sender;
594 recipient=user;
595 sender=otherUser;
596 }
597
598 if (otherUser->isReady)
599 {
600 if (natPunchthroughServerDebugInterface)
601 {
602 char str[1024];
603 char addr1[128], addr2[128];
604 sender->systemAddress.ToString(true,addr1,static_cast<size_t>(128));
605 recipient->systemAddress.ToString(true,addr2,static_cast<size_t>(128));
606 sprintf_s(str, "Sending NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS to sender %s and recipient %s.", addr1, addr2);
607 natPunchthroughServerDebugInterface->OnServerMessage(str);
608 }
609
610 sender->isReady=false;
611 recipient->isReady=false;
612 connectionAttempt->attemptPhase=ConnectionAttempt::NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS;
613 connectionAttempt->startTime= SLNet::GetTime();
614
615 sender->mostRecentPort=0;
616 recipient->mostRecentPort=0;
617
618 SLNet::BitStream outgoingBs;
619 outgoingBs.Write((MessageID)ID_NAT_GET_MOST_RECENT_PORT);
620 // 4/29/09 Write sessionID so we don't use returned port for a system we don't want
621 outgoingBs.Write(connectionAttempt->sessionId);
622 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,sender->systemAddress,false);
623 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,recipient->systemAddress,false);
624
625 // 4/22/09 - BUG: missing break statement here
626 break;
627 }
628 }
629 }
630
631 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/MessageFilter.cpp Source File

  • src
MessageFilter.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_MessageFilter==1
18
19 #include "slikenet/MessageFilter.h"
20 #include "slikenet/assert.h"
21 #include "slikenet/GetTime.h"
22 #include "slikenet/MessageIdentifiers.h"
23 #include "slikenet/assert.h"
24 #include "slikenet/peerinterface.h"
25 #include "slikenet/PacketizedTCP.h"
26 #include "slikenet/BitStream.h"
27
28 using namespace SLNet;
29
30 int SLNet::MessageFilterStrComp( char *const &key,char *const &data )
31 {
32 return strcmp(key,data);
33 }
34
35 int SLNet::FilterSetComp( const int &key, FilterSet * const &data )
36 {
37 if (key < data->filterSetID)
38 return -1;
39 else if (key==data->filterSetID)
40 return 0;
41 else
42 return 1;
43 }
44 STATIC_FACTORY_DEFINITIONS(MessageFilter,MessageFilter);
45
46 MessageFilter::MessageFilter()
47 {
48 whenLastTimeoutCheck= SLNet::GetTime();
49 }
50 MessageFilter::~MessageFilter()
51 {
52 Clear();
53 }
54 void MessageFilter::SetAutoAddNewConnectionsToFilter(int filterSetID)
55 {
56 autoAddNewConnectionsToFilter=filterSetID;
57 }
58 void MessageFilter::SetAllowMessageID(bool allow, int messageIDStart, int messageIDEnd,int filterSetID)
59 {
60 RakAssert(messageIDStart <= messageIDEnd);
61 FilterSet *filterSet = GetFilterSetByID(filterSetID);
62 int i;
63 for (i=messageIDStart; i <= messageIDEnd; ++i)
64 filterSet->allowedIDs[i]=allow;
65 }
66 void MessageFilter::SetAllowRPC4(bool allow, const char* uniqueID, int filterSetID)
67 {
68 FilterSet *filterSet = GetFilterSetByID(filterSetID);
69 bool objectExists;
70 unsigned int idx = filterSet->allowedRPC4.GetIndexFromKey(uniqueID, &objectExists);
71 if (allow)
72 {
73 if (objectExists==false)
74 {
75 filterSet->allowedRPC4.InsertAtIndex(uniqueID, idx, _FILE_AND_LINE_);
76 filterSet->allowedIDs[ID_RPC_PLUGIN]=true;
77 }
78 }
79 else
80 {
81 if (objectExists==true)
82 {
83 filterSet->allowedRPC4.RemoveAtIndex(idx);
84 if (filterSet->allowedRPC4.Size()==0)
85 {
86 filterSet->allowedIDs[ID_RPC_PLUGIN]=false;
87 }
88 }
89 }
90 }
91 void MessageFilter::SetActionOnDisallowedMessage(bool kickOnDisallowed, bool banOnDisallowed, SLNet::TimeMS banTimeMS, int filterSetID)
92 {
93 FilterSet *filterSet = GetFilterSetByID(filterSetID);
94 filterSet->kickOnDisallowedMessage=kickOnDisallowed;
95 filterSet->disallowedMessageBanTimeMS=banTimeMS;
96 filterSet->banOnDisallowedMessage=banOnDisallowed;
97 }
98 void MessageFilter::SetDisallowedMessageCallback(int filterSetID, void *userData, void (*invalidMessageCallback)(RakPeerInterface *peer, AddressOrGUID systemAddress, int filterSetID, void *userData, unsigned char messageID))
99 {
100 FilterSet *filterSet = GetFilterSetByID(filterSetID);
101 filterSet->invalidMessageCallback=invalidMessageCallback;
102 filterSet->disallowedCallbackUserData=userData;
103 }
104 void MessageFilter::SetTimeoutCallback(int filterSetID, void *userData, void (*invalidMessageCallback)(RakPeerInterface *peer, AddressOrGUID systemAddress, int filterSetID, void *userData))
105 {
106 FilterSet *filterSet = GetFilterSetByID(filterSetID);
107 filterSet->timeoutCallback=invalidMessageCallback;
108 filterSet->timeoutUserData=userData;
109 }
110 void MessageFilter::SetFilterMaxTime(int allowedTimeMS, bool banOnExceed, SLNet::TimeMS banTimeMS, int filterSetID)
111 {
112 FilterSet *filterSet = GetFilterSetByID(filterSetID);
113 filterSet->maxMemberTimeMS=allowedTimeMS;
114 filterSet->banOnFilterTimeExceed=banOnExceed;
115 filterSet->timeExceedBanTimeMS=banTimeMS;
116 }
117 int MessageFilter::GetSystemFilterSet(AddressOrGUID systemAddress)
118 {
119 // bool objectExists;
120 // unsigned index = systemList.GetIndexFromKey(systemAddress, &objectExists);
121 // if (objectExists==false)
122 // return -1;
123 // else
124 // return systemList[index].filter->filterSetID;
125
126 DataStructures::HashIndex index = systemList.GetIndexOf(systemAddress);
127 if (index.IsInvalid())
128 return -1;
129 else
130 return systemList.ItemAtIndex(index).filter->filterSetID;
131 }
132 void MessageFilter::SetSystemFilterSet(AddressOrGUID addressOrGUID, int filterSetID)
133 {
134 // Allocate this filter set if it doesn't exist.
135 RakAssert(addressOrGUID.IsUndefined()==false);
136 // bool objectExists;
137 // unsigned index = systemList.GetIndexFromKey(addressOrGUID, &objectExists);
138 // if (objectExists==false)
139 DataStructures::HashIndex index = systemList.GetIndexOf(addressOrGUID);
140 if (index.IsInvalid())
141 {
142 if (filterSetID<0)
143 return;
144
145 FilteredSystem filteredSystem;
146 filteredSystem.filter = GetFilterSetByID(filterSetID);
147 // filteredSystem.addressOrGUID=addressOrGUID;
148 filteredSystem.timeEnteredThisSet= SLNet::GetTimeMS();
149 // systemList.Insert(addressOrGUID, filteredSystem, true, _FILE_AND_LINE_);
150 systemList.Push(addressOrGUID,filteredSystem,_FILE_AND_LINE_);
151 }
152 else
153 {
154 if (filterSetID>=0)
155 {
156 FilterSet *filterSet = GetFilterSetByID(filterSetID);
157 systemList.ItemAtIndex(index).timeEnteredThisSet= SLNet::GetTimeMS();
158 systemList.ItemAtIndex(index).filter=filterSet;
159 }
160 else
161 {
162 systemList.RemoveAtIndex(index, _FILE_AND_LINE_);
163 }
164 }
165 }
166 unsigned MessageFilter::GetSystemCount(int filterSetID) const
167 {
168 if (filterSetID==-1)
169 {
170 return systemList.Size();
171 }
172 else
173 {
174 unsigned i;
175 unsigned count=0;
176 DataStructures::List< FilteredSystem > itemList;
177 DataStructures::List< AddressOrGUID > keyList;
178 systemList.GetAsList(itemList, keyList, _FILE_AND_LINE_);
179 for (i=0; i < itemList.Size(); i++)
180 if (itemList[i].filter->filterSetID==filterSetID)
181 ++count;
182 return count;
183 }
184 }
185 unsigned MessageFilter::GetFilterSetCount(void) const
186 {
187 return filterList.Size();
188 }
189 int MessageFilter::GetFilterSetIDByIndex(unsigned index)
190 {
191 return filterList[index]->filterSetID;
192 }
193 void MessageFilter::DeleteFilterSet(int filterSetID)
194 {
195 FilterSet *filterSet;
196 bool objectExists;
197 unsigned i,index;
198 index = filterList.GetIndexFromKey(filterSetID, &objectExists);
199 if (objectExists)
200 {
201 filterSet=filterList[index];
202 DeallocateFilterSet(filterSet);
203 filterList.RemoveAtIndex(index);
204
205 DataStructures::List< FilteredSystem > itemList;
206 DataStructures::List< AddressOrGUID > keyList;
207 systemList.GetAsList(itemList, keyList, _FILE_AND_LINE_);
208 for (i=0; i < itemList.Size(); i++)
209 {
210 if (itemList[i].filter==filterSet)
211 {
212 systemList.Remove(keyList[i], _FILE_AND_LINE_);
213 }
214 }
215
216 /*
217 // Don't reference this pointer any longer
218 i=0;
219 while (i < systemList.Size())
220 {
221 if (systemList[i].filter==filterSet)
222 systemList.RemoveAtIndex(i);
223 else
224 ++i;
225 }
226 */
227 }
228 }
229 void MessageFilter::Clear(void)
230 {
231 unsigned i;
232 systemList.Clear(_FILE_AND_LINE_);
233 for (i=0; i < filterList.Size(); i++)
234 DeallocateFilterSet(filterList[i]);
235 filterList.Clear(false, _FILE_AND_LINE_);
236 }
237 void MessageFilter::DeallocateFilterSet(FilterSet* filterSet)
238 {
239 SLNet::OP_DELETE(filterSet, _FILE_AND_LINE_);
240 }
241 FilterSet* MessageFilter::GetFilterSetByID(int filterSetID)
242 {
243 RakAssert(filterSetID>=0);
244 bool objectExists;
245 unsigned index;
246 index = filterList.GetIndexFromKey(filterSetID, &objectExists);
247 if (objectExists)
248 return filterList[index];
249 else
250 {
251 FilterSet *newFilterSet = SLNet::OP_NEW<FilterSet>( _FILE_AND_LINE_ );
252 memset(newFilterSet->allowedIDs, 0, MESSAGE_FILTER_MAX_MESSAGE_ID * sizeof(bool));
253 newFilterSet->banOnFilterTimeExceed=false;
254 newFilterSet->kickOnDisallowedMessage=false;
255 newFilterSet->banOnDisallowedMessage=false;
256 newFilterSet->disallowedMessageBanTimeMS=0;
257 newFilterSet->timeExceedBanTimeMS=0;
258 newFilterSet->maxMemberTimeMS=0;
259 newFilterSet->filterSetID=filterSetID;
260 newFilterSet->invalidMessageCallback=0;
261 newFilterSet->timeoutCallback=0;
262 newFilterSet->timeoutUserData=0;
263 filterList.Insert(filterSetID, newFilterSet, true, _FILE_AND_LINE_);
264 return newFilterSet;
265 }
266 }
267 void MessageFilter::OnInvalidMessage(FilterSet *filterSet, AddressOrGUID systemAddress, unsigned char messageID)
268 {
269 if (filterSet->invalidMessageCallback)
270 filterSet->invalidMessageCallback(rakPeerInterface, systemAddress, filterSet->filterSetID, filterSet->disallowedCallbackUserData, messageID);
271 if (filterSet->banOnDisallowedMessage && rakPeerInterface)
272 {
273 char str1[64];
274 systemAddress.systemAddress.ToString(false, str1, static_cast<size_t>(64));
275 rakPeerInterface->AddToBanList(str1, filterSet->disallowedMessageBanTimeMS);
276 }
277 if (filterSet->kickOnDisallowedMessage)
278 {
279 if (rakPeerInterface)
280 rakPeerInterface->CloseConnection(systemAddress, true, 0);
281 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
282 else
283 tcpInterface->CloseConnection(systemAddress.systemAddress);
284 #endif
285 }
286 }
287 void MessageFilter::Update(void)
288 {
289 // Update all timers for all systems. If those systems' filter sets are expired, take the appropriate action.
290 SLNet::Time curTime = SLNet::GetTime();
291 if (GreaterThan(curTime - 1000, whenLastTimeoutCheck))
292 {
293 DataStructures::List< FilteredSystem > itemList;
294 DataStructures::List< AddressOrGUID > keyList;
295 systemList.GetAsList(itemList, keyList, _FILE_AND_LINE_);
296
297 unsigned int index;
298 for (index=0; index < itemList.Size(); index++)
299 {
300 if (itemList[index].filter &&
301 itemList[index].filter->maxMemberTimeMS>0 &&
302 curTime-itemList[index].timeEnteredThisSet >= itemList[index].filter->maxMemberTimeMS)
303 {
304 if (itemList[index].filter->timeoutCallback)
305 itemList[index].filter->timeoutCallback(rakPeerInterface, keyList[index], itemList[index].filter->filterSetID, itemList[index].filter->timeoutUserData);
306
307 if (itemList[index].filter->banOnFilterTimeExceed && rakPeerInterface)
308 {
309 char str1[64];
310 keyList[index].ToString(false, str1, 64);
311 rakPeerInterface->AddToBanList(str1, itemList[index].filter->timeExceedBanTimeMS);
312 }
313 if (rakPeerInterface)
314 rakPeerInterface->CloseConnection(keyList[index], true, 0);
315 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
316 else
317 tcpInterface->CloseConnection(keyList[index].systemAddress);
318 #endif
319
320 systemList.Remove(keyList[index], _FILE_AND_LINE_);
321 }
322 }
323
324 whenLastTimeoutCheck=curTime+1000;
325 }
326 }
327 void MessageFilter::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
328 {
329 (void) systemAddress;
330 (void) rakNetGUID;
331 (void) isIncoming;
332
333 AddressOrGUID aog;
334 aog.rakNetGuid=rakNetGUID;
335 aog.systemAddress=systemAddress;
336
337 // New system, automatically assign to filter set if appropriate
338 if (autoAddNewConnectionsToFilter>=0 && systemList.HasData(aog)==false)
339 SetSystemFilterSet(aog, autoAddNewConnectionsToFilter);
340 }
341 void MessageFilter::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
342 {
343 (void) rakNetGUID;
344 (void) lostConnectionReason;
345
346 AddressOrGUID aog;
347 aog.rakNetGuid=rakNetGUID;
348 aog.systemAddress=systemAddress;
349
350 // Lost system, remove from the list
351 systemList.Remove(aog, _FILE_AND_LINE_);
352 }
353 PluginReceiveResult MessageFilter::OnReceive(Packet *packet)
354 {
355 DataStructures::HashIndex index;
356 unsigned char messageId;
357
358 switch (packet->data[0])
359 {
360 case ID_NEW_INCOMING_CONNECTION:
361 case ID_CONNECTION_REQUEST_ACCEPTED:
362 case ID_CONNECTION_LOST:
363 case ID_DISCONNECTION_NOTIFICATION:
364 case ID_CONNECTION_ATTEMPT_FAILED:
365 case ID_NO_FREE_INCOMING_CONNECTIONS:
366 case ID_IP_RECENTLY_CONNECTED:
367 case ID_CONNECTION_BANNED:
368 case ID_INVALID_PASSWORD:
369 case ID_UNCONNECTED_PONG:
370 case ID_ALREADY_CONNECTED:
371 case ID_ADVERTISE_SYSTEM:
372 case ID_REMOTE_DISCONNECTION_NOTIFICATION:
373 case ID_REMOTE_CONNECTION_LOST:
374 case ID_REMOTE_NEW_INCOMING_CONNECTION:
375 case ID_DOWNLOAD_PROGRESS:
376 break;
377 default:
378 if (packet->data[0]==ID_TIMESTAMP)
379 {
380 if (packet->length<sizeof(MessageID) + sizeof(SLNet::TimeMS))
381 return RR_STOP_PROCESSING_AND_DEALLOCATE; // Invalid message
382 messageId=packet->data[sizeof(MessageID) + sizeof(SLNet::TimeMS)];
383 }
384 else
385 messageId=packet->data[0];
386 // If this system is filtered, check if this message is allowed. If not allowed, return RR_STOP_PROCESSING_AND_DEALLOCATE
387 // index = systemList.GetIndexFromKey(packet->addressOrGUID, &objectExists);
388 index = systemList.GetIndexOf(packet);
389 if (index.IsInvalid())
390 break;
391 if (systemList.ItemAtIndex(index).filter->allowedIDs[messageId]==false)
392 {
393 OnInvalidMessage(systemList.ItemAtIndex(index).filter, packet, packet->data[0]);
394 return RR_STOP_PROCESSING_AND_DEALLOCATE;
395 }
396 if (packet->data[0]==ID_RPC_PLUGIN)
397 {
398 SLNet::BitStream bsIn(packet->data,packet->length,false);
399 bsIn.IgnoreBytes(2);
400 SLNet::RakString functionName;
401 bsIn.ReadCompressed(functionName);
402 if (systemList.ItemAtIndex(index).filter->allowedRPC4.HasData(functionName)==false)
403 {
404 OnInvalidMessage(systemList.ItemAtIndex(index).filter, packet, packet->data[0]);
405 return RR_STOP_PROCESSING_AND_DEALLOCATE;
406 }
407 }
408
409 break;
410 }
411
412 return RR_CONTINUE_PROCESSING;
413 }
414
415 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Router2.h Source File

  • include
  • slikenet
Router2.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_Router2==1 && _RAKNET_SUPPORT_UDPForwarder==1
23
24 #ifndef __ROUTER_2_PLUGIN_H
25 #define __ROUTER_2_PLUGIN_H
26
27 #include "types.h"
28 #include "PluginInterface2.h"
29 #include "PacketPriority.h"
30 #include "Export.h"
31 #include "UDPForwarder.h"
32 #include "MessageIdentifiers.h"
33 #include "DS_List.h"
34 #include "SimpleMutex.h"
35
36 namespace SLNet
37 {
39 class RakPeerInterface;
40
41 struct Router2DebugInterface
42 {
43 Router2DebugInterface() {}
44 virtual ~Router2DebugInterface() {}
45 virtual void ShowFailure(const char *message);
46 virtual void ShowDiagnostic(const char *message);
47 };
48
55
59 class RAK_DLL_EXPORT Router2 : public PluginInterface2
60 {
61 public:
62 // GetInstance() and DestroyInstance(instance*)
63 STATIC_FACTORY_DECLARATIONS(Router2)
64
65 Router2();
66 virtual ~Router2();
67
70 void SetSocketFamily(unsigned short _socketFamily);
71
90 void EstablishRouting(RakNetGUID endpointGuid);
91
94 void SetMaximumForwardingRequests(int max);
95
97 void SetDebugInterface(Router2DebugInterface *_debugInterface);
98
100 Router2DebugInterface *GetDebugInterface(void) const;
101
102 // --------------------------------------------------------------------------------------------
103 // Packet handling functions
104 // --------------------------------------------------------------------------------------------
105 virtual PluginReceiveResult OnReceive(Packet *packet);
106 virtual void Update(void);
107 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
108 virtual void OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason);
109 virtual void OnRakPeerShutdown(void);
110
111
112 enum Router2RequestStates
113 {
114 R2RS_REQUEST_STATE_QUERY_FORWARDING,
115 REQUEST_STATE_REQUEST_FORWARDING,
116 };
117
118 struct ConnectionRequestSystem
119 {
120 RakNetGUID guid;
121 int pingToEndpoint;
122 unsigned short usedForwardingEntries;
123 };
124
125 struct ConnnectRequest
126 {
127 ConnnectRequest();
128 ~ConnnectRequest();
129
130 DataStructures::List<ConnectionRequestSystem> connectionRequestSystems;
131 SimpleMutex connectionRequestSystemsMutex;
132 Router2RequestStates requestState;
133 SLNet::TimeMS pingTimeout;
134 RakNetGUID endpointGuid;
135 RakNetGUID lastRequestedForwardingSystem;
136 bool returnConnectionLostOnFailure;
137 unsigned int GetGuidIndex(RakNetGUID guid);
138 };
139
140 unsigned int GetConnectionRequestIndex(RakNetGUID endpointGuid);
141
142 struct MiniPunchRequest
143 {
144 RakNetGUID endpointGuid;
145 SystemAddress endpointAddress;
146 bool gotReplyFromEndpoint;
147 RakNetGUID sourceGuid;
148 SystemAddress sourceAddress;
149 bool gotReplyFromSource;
150 SLNet::TimeMS timeout;
151 SLNet::TimeMS nextAction;
152 unsigned short forwardingPort;
153 __UDPSOCKET__ forwardingSocket;
154 };
155
156 struct ForwardedConnection
157 {
158 RakNetGUID endpointGuid;
159 RakNetGUID intermediaryGuid;
160 SystemAddress intermediaryAddress;
161 bool returnConnectionLostOnFailure;
162 bool weInitiatedForwarding;
163 };
164
165 protected:
166
167 bool UpdateForwarding(ConnnectRequest* connectionRequest);
168 void RemoveConnectionRequest(unsigned int connectionRequestIndex);
169 void RequestForwarding(ConnnectRequest* connectionRequest);
170 void OnQueryForwarding(Packet *packet);
171 void OnQueryForwardingReply(Packet *packet);
172 void OnRequestForwarding(Packet *packet);
173 void OnRerouted(Packet *packet);
174 void OnMiniPunchReply(Packet *packet);
175 void OnMiniPunchReplyBounce(Packet *packet);
176 bool OnForwardingSuccess(Packet *packet);
177 int GetLargestPingAmongConnectedSystems(void) const;
178 void ReturnToUser(MessageID messageId, RakNetGUID endpointGuid, const SystemAddress &systemAddress, bool wasGeneratedLocally);
179 bool ConnectInternal(RakNetGUID endpointGuid, bool returnConnectionLostOnFailure);
180
181 UDPForwarder *udpForwarder;
182 int maximumForwardingRequests;
183 SimpleMutex connectionRequestsMutex, miniPunchesInProgressMutex, forwardedConnectionListMutex;
184 DataStructures::List<ConnnectRequest*> connectionRequests;
185 DataStructures::List<MiniPunchRequest> miniPunchesInProgress;
186 // Forwarding we have initiated
187 DataStructures::List<ForwardedConnection> forwardedConnectionList;
188
189 void ClearConnectionRequests(void);
190 void ClearMinipunches(void);
191 void ClearForwardedConnections(void);
192 void ClearAll(void);
193 int ReturnFailureOnCannotForward(RakNetGUID sourceGuid, RakNetGUID endpointGuid);
194 void SendFailureOnCannotForward(RakNetGUID sourceGuid, RakNetGUID endpointGuid);
195 void SendForwardingSuccess(MessageID messageId, RakNetGUID sourceGuid, RakNetGUID endpointGuid, unsigned short sourceToDstPort);
196 void SendOOBFromRakNetPort(OutOfBandIdentifiers oob, BitStream *extraData, SystemAddress sa);
197 void SendOOBFromSpecifiedSocket(OutOfBandIdentifiers oob, SystemAddress sa, __UDPSOCKET__ socket);
198 void SendOOBMessages(MiniPunchRequest *mpr);
199
200 Router2DebugInterface *debugInterface;
201 unsigned short socketFamily;
202 };
203
204 }
205
206 #endif
207
208 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/StringTable.h Source File

  • include
  • slikenet
StringTable.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __STRING_TABLE_H
23 #define __STRING_TABLE_H
24
25 #include "DS_OrderedList.h"
26 #include "Export.h"
27 #include "memoryoverride.h"
28
30 namespace SLNet
31 {
32 class BitStream;
33 };
34
36 typedef unsigned char StringTableType;
37
39 struct StrAndBool
40 {
41 char *str;
42 bool b;
43 };
44
45 namespace SLNet
46 {
47 int RAK_DLL_EXPORT StrAndBoolComp( char *const &key, const StrAndBool &data );
48
55 class RAK_DLL_EXPORT StringTable
56 {
57 public:
58
59 // Destructor
60 ~StringTable();
61
65 static StringTable* Instance(void);
66
70 void AddString(const char *str, bool copyString);
71
77 void EncodeString( const char *input, int maxCharsToWrite, SLNet::BitStream *output );
78
84 bool DecodeString( char *output, int maxCharsToWrite, SLNet::BitStream *input );
85
87 static void AddReference(void);
88
90 static void RemoveReference(void);
91
93 StringTable();
94
95 protected:
98 void LogStringNotFound(const char *strName);
99
101 static StringTable *instance;
102 static int referenceCount;
103
104 DataStructures::OrderedList<char *, StrAndBool, StrAndBoolComp> orderedStringList;
105 };
106 }
107
108
109 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Multilist
DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > Member List

This is the complete list of members for DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType >, including all inherited members.

allocationSize | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
ascendingSort | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
Clear(bool deallocateSmallBlocks=true, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
ClearPointer(_KeyType key, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
ClearPointers(bool deallocateSmallBlocks=true, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
CopySource(const Multilist &source) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
data | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
dataSize | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
DeallocateIfNeeded(const char *file, unsigned int line) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
DeleteShiftArrayLeft(_IndexType index) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
FindIntersection(Multilist &source1, Multilist &source2, Multilist &intersection, Multilist &uniqueToSource1, Multilist &uniqueToSource2) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | static
ForEach(void(*func)(_DataType &item, const char *file, unsigned int line), const char *file, unsigned int line) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
ForEach(void(*func)(_DataType &item)) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
GetIndexFromKeyInSortedList(const _KeyType &key, bool *objectExists) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
GetIndexOf(_KeyType key) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
GetInsertionIndex(_KeyType key) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
GetMultilistType(void) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
GetPtr(_KeyType key) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
GetSize(void) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
GetSortOrder(void) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
InsertAtIndex(const _DataType &d, _IndexType index, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
InsertInOrderedList(const _DataType &d, const _KeyType &key) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
InsertShiftArrayRight(const _DataType &d, _IndexType index) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
IsEmpty(void) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
IsSorted(void) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
ML_SORTED_ASCENDING enum value | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
ML_SORTED_DESCENDING enum value | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
ML_UNSORTED enum value | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
Multilist() | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
Multilist(const Multilist &source) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
operator=(const Multilist &source) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
operator[](const _IndexType position) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
Peek(void) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
PeekOpposite(void) const | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
Pop(const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
PopOpposite(const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
preallocationSize | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
Push(const _DataType &d, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
Push(const _DataType &d, const _KeyType &key, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
PushOpposite(const _DataType &d, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
PushOpposite(const _DataType &d, const _KeyType &key, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
QSortAscending(_IndexType left, _IndexType right) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
QSortDescending(_IndexType left, _IndexType right) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
queueHead | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
queueTail | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
Reallocate(_IndexType size, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
ReallocateIfNeeded(const char *file, unsigned int line) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
ReallocToSize(_IndexType newAllocationSize, const char *file, unsigned int line) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
RemoveAtIndex(_IndexType position, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
RemoveAtKey(_KeyType key, bool assertIfDoesNotExist, const char *file=__FILE__, unsigned int line=__LINE__) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
ReverseList(void) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
ReverseListInternal(void) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
SetMultilistType(MultilistType newType) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
SetSortOrder(bool ascending) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
Sort(bool force) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
sortState | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
TagSorted(void) | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
variableMultilistType | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > | protected
~Multilist() | DataStructures::Multilist< _MultilistType, _DataType, _KeyType, _IndexType > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_WindowsStore8.cpp Source File

  • src
RakNetSocket2_WindowsStore8.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_WINDOWS_STORE_8
21 #define RAKNETSOCKET2_WINDOWS_STORE_8
22
23 #if defined(WINDOWS_STORE_RT)
24
25 #include <ppltasks.h>
26 #include <collection.h>
27 #include "slikenet/string.h"
28 #include "slikenet/linux_adapter.h"
29 #include "slikenet/osx_adapter.h"
30
31 using namespace Concurrency;
32 using namespace Platform;
33 using namespace Windows::ApplicationModel::Core;
34 using namespace Windows::Foundation;
35 using namespace Windows::Networking;
36 using namespace Windows::Networking::Sockets;
37 using namespace Windows::UI::Core;
38 using namespace Windows::UI::Xaml;
39 using namespace Windows::UI::Xaml::Controls;
40 using namespace Windows::UI::Xaml::Navigation;
41 using namespace Windows::Storage::Streams;
42 //using namespace Platform::Collections;
43 //using namespace Windows::Foundation::Collections;
44
45 namespace SLNet
46 {
47
48 public ref class OutputStreamAndDataWriter sealed
49 {
50 public:
51 // http://msdn.microsoft.com/en-us/library/windows/apps/hh755807.aspx
52 property IOutputStream ^outputStream;
53 /*
54 {
55 IOutputStream ^ get() {return outputStream;}
56 void set(IOutputStream ^ value) {outputStream = value;}
57 }
58 */
59 property DataWriter ^dataWriter;
60 /*
61 {
62 DataWriter ^ get() {return dataWriter;}
63 void set(DataWriter ^ value) {dataWriter = value;}
64 }
65 */
66 private:
67 };
68
69 public ref class ListenerContext sealed
70 {
71 public:
72 ListenerContext(Windows::Networking::Sockets::DatagramSocket^ listener);
73 void OnMessage(Windows::Networking::Sockets::DatagramSocket^ socket, Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^ eventArguments);
74 OutputStreamAndDataWriter ^GetOutputStreamAndDataWriter(uint64_t s_addr);
75
76 private:
77 ~ListenerContext();
78 // CRITICAL_SECTION lock;
79 SimpleMutex outputStreamMapMutex;
80 Windows::Networking::Sockets::DatagramSocket^ listener;
81 //Windows::Storage::Streams::IOutputStream^ outputStream;
82 //Windows::Networking::HostName^ hostName;
83 //Platform::String^ port;
84 // http://msdn.microsoft.com/en-us/library/windows/apps/hh700103.aspx
85 Platform::Collections::Map<uint64_t,OutputStreamAndDataWriter^>^ outputStreamMap;
86
87 void EchoMessage(Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^ eventArguments);
88 };
89 }
90
91 using namespace SLNet;
92
93 ListenerContext::ListenerContext(Windows::Networking::Sockets::DatagramSocket^ listener)
94 {
95 this->listener = listener;
96 // InitializeCriticalSectionEx(&lock, 0, 0);
97 outputStreamMap = ref new Platform::Collections::Map<uint64_t,OutputStreamAndDataWriter^>();
98 }
99
100 ListenerContext::~ListenerContext()
101 {
102 // The listener can be closed in two ways:
103 // - explicit: by using delete operator (the listener is closed even if there are outstanding references to it).
104 // - implicit: by removing last reference to it (i.e. falling out-of-scope).
105 // In this case this is the last reference to the listener so both will yield the same result.
106 delete listener;
107 listener = nullptr;
108
109 // DeleteCriticalSection(&lock);
110 }
111
112 OutputStreamAndDataWriter ^ListenerContext::GetOutputStreamAndDataWriter(uint64_t s_addr)
113 {
114 outputStreamMapMutex.Lock();
115 if (outputStreamMap->HasKey(s_addr))
116 {
117 OutputStreamAndDataWriter ^o = outputStreamMap->Lookup(s_addr);
118 outputStreamMapMutex.Unlock();
119 return o;
120 }
121 outputStreamMapMutex.Unlock();
122 uint16_t port = s_addr & 0xFFFF;
123 uint32_t addr = (uint32_t) (s_addr >> 32);
124 //addr = ntohl(addr);
125 char buf[64];
126 unsigned char *ucp = (unsigned char *)&addr;
127 sprintf_s(buf, "%d.%d.%d.%d",
128 ucp[0] & 0xff,
129 ucp[1] & 0xff,
130 ucp[2] & 0xff,
131 ucp[3] & 0xff);
132 char portStr[32];
133 _itoa(port, portStr, 10);
134
135 SLNet::RakString rs1(buf);
136 WCHAR *w_char1 = rs1.ToWideChar();
137 HostName ^hostName = ref new HostName(ref new Platform::String(w_char1));
138 SLNet::RakString rs2(portStr);
139 WCHAR *w_char2 = rs2.ToWideChar();
140 task< IOutputStream^ > op(listener->GetOutputStreamAsync(hostName, ref new Platform::String(w_char2)));
141 op.wait();
142 OutputStreamAndDataWriter ^outputStreamAndDataWriter = ref new OutputStreamAndDataWriter;
143 outputStreamAndDataWriter->outputStream = op.get();
144 outputStreamAndDataWriter->dataWriter = ref new DataWriter(outputStreamAndDataWriter->outputStream);
145
146 rs1.DeallocWideChar(w_char1);
147 rs2.DeallocWideChar(w_char2);
148
149 outputStreamMapMutex.Lock();
150 if (outputStreamMap->HasKey(s_addr)==false)
151 {
152 outputStreamMap->Insert(s_addr, outputStreamAndDataWriter);
153 outputStreamMapMutex.Unlock();
154 return outputStreamAndDataWriter;
155 }
156 else
157 {
158 // Just use the one that was inserted from another thread
159 OutputStreamAndDataWriter ^o = outputStreamMap->Lookup(s_addr);
160 outputStreamMapMutex.Unlock();
161 return o;
162 }
163 }
164
165 void ListenerContext::OnMessage(Windows::Networking::Sockets::DatagramSocket^ socket, Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^ eventArguments)
166 {
167 HostName ^remoteHost=eventArguments->RemoteAddress;
168 eventArguments->RemoteAddress->DisplayName;
169 eventArguments->RemotePort;
170
171 RNS2_WindowsStore8 *rns2 = RNS2_WindowsStore8::GetRNS2FromDatagramSocket(socket);
172 if (rns2==0)
173 return;
174
175 //auto platformBuffer = ref new Platform::Array<BYTE>((unsigned char*) sendParameters->data, (UINT)sendParameters->length);
176 RNS2EventHandler *eventHandler = rns2->GetEventHandler();
177 RNS2RecvStruct *recvFromStruct = eventHandler->AllocRNS2RecvStruct(_FILE_AND_LINE_);
178
179 // http://stackoverflow.com/questions/11853838/getting-an-array-of-bytes-out-of-windowsstoragestreamsibuffer
180 IBuffer ^uselessBuffer = eventArguments->GetDataReader()->DetachBuffer();
181 Windows::Storage::Streams::DataReader^ uselessReader = Windows::Storage::Streams::DataReader::FromBuffer(uselessBuffer);
182 Platform::Array<unsigned char>^ managedBytes = ref new Platform::Array<unsigned char>(uselessBuffer->Length);
183 uselessReader->ReadBytes( managedBytes );
184 for(unsigned int i = 0; i < uselessBuffer->Length; i++)
185 recvFromStruct->data[i] = managedBytes[i];
186 recvFromStruct->bytesRead = uselessBuffer->Length;
187 char ip[64];
188 RakString rs2;
189 rs2.FromWideChar(eventArguments->RemoteAddress->DisplayName->Data());
190 strcpy_s(ip, rs2.C_String());
191 recvFromStruct->systemAddress.address.addr4.sin_addr.s_addr = RNS2_WindowsStore8::WinRTInet_Addr(ip);
192 char portStr[64];
193 rs2.FromWideChar(eventArguments->RemotePort->Data());
194 strcpy_s(portStr, rs2.C_String());
195 recvFromStruct->systemAddress.SetPortHostOrder(atoi(portStr));
196 recvFromStruct->timeRead= SLNet::GetTimeUS();
197 recvFromStruct->socket = rns2;
198 eventHandler->OnRNS2Recv(recvFromStruct);
199
200 /*
201 if (outputStream != nullptr)
202 {
203 EchoMessage(eventArguments);
204 return;
205 }
206
207
208 // We do not have an output stream yet so create one.
209 task<IOutputStream^>(socket->GetOutputStreamAsync(eventArguments->RemoteAddress, eventArguments->RemotePort)).then([this, socket, eventArguments] (IOutputStream^ stream)
210 {
211 // It might happen that the OnMessage was invoked more than once before the GetOutputStreamAsync completed.
212 // In this case we will end up with multiple streams - make sure we have just one of it.
213 EnterCriticalSection(&lock);
214
215 if (outputStream == nullptr)
216 {
217 outputStream = stream;
218 hostName = eventArguments->RemoteAddress;
219 port = eventArguments->RemotePort;
220 }
221
222 LeaveCriticalSection(&lock);
223
224 EchoMessage(eventArguments);
225 }).then([this, socket, eventArguments] (task<void> previousTask)
226 {
227 try
228 {
229 // Try getting all exceptions from the continuation chain above this point.
230 previousTask.get();
231 }
232 catch (Exception^ exception)
233 {
234 // NotifyUserFromAsyncThread("Getting an output stream failed with error: " + exception->Message, NotifyType::ErrorMessage);
235 }
236 });
237 */
238 }
239 void ListenerContext::EchoMessage(DatagramSocketMessageReceivedEventArgs^ eventArguments)
240 {
241 }
242 SLNet::DataStructures::List<RNS2_WindowsStore8*> RNS2_WindowsStore8::rns2List;
243 SimpleMutex RNS2_WindowsStore8::rns2ListMutex;
244 RNS2_WindowsStore8::RNS2_WindowsStore8()
245 {
246 rns2ListMutex.Lock();
247 rns2List.Insert(this, _FILE_AND_LINE_);
248 rns2ListMutex.Unlock();
249 }
250 RNS2_WindowsStore8::~RNS2_WindowsStore8()
251 {
252 unsigned int i;
253 rns2ListMutex.Lock();
254 for (i=0; i < rns2List.Size(); i++)
255 {
256 if (rns2List[i]==this)
257 {
258 rns2List.RemoveAtIndexFast(i);
259 break;
260 }
261 }
262 rns2ListMutex.Unlock();
263 }
264 RNS2_WindowsStore8 *RNS2_WindowsStore8::GetRNS2FromDatagramSocket(Windows::Networking::Sockets::DatagramSocket^ s)
265 {
266 RNS2_WindowsStore8 *out=0;
267 unsigned int i;
268 rns2ListMutex.Lock();
269 for (i=0; i < rns2List.Size(); i++)
270 {
271 if (rns2List[i]->listener==s)
272 {
273 out=rns2List[i];
274 break;
275 }
276 }
277 rns2ListMutex.Unlock();
278 return out;
279 }
280 RNS2BindResult RNS2_WindowsStore8::Bind( Platform::String ^localServiceName ) {
281
282 listener = ref new DatagramSocket();
283 listenerContext = ref new ListenerContext(listener);
284 listener->MessageReceived += ref new TypedEventHandler<DatagramSocket^, DatagramSocketMessageReceivedEventArgs^>(listenerContext, &ListenerContext::OnMessage);
285 // http://msdn.microsoft.com/en-us/library/dd492427.aspx
286 task<void> bindOp(listener->BindServiceNameAsync(localServiceName));
287 try
288 {
289 bindOp.wait();
290 }
291 catch (Exception^ exception)
292 {
293 return BR_FAILED_TO_BIND_SOCKET;
294 }
295
296 return BR_SUCCESS;
297 }
298 void RNS2_WindowsStore8::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] ) {RakAssert("GetMyIP Unsupported" && 0);}
299 RNS2SendResult RNS2_WindowsStore8::Send( RNS2_SendParameters *sendParameters, const char *file, unsigned int line ) {
300 uint64_t s_addr = sendParameters->systemAddress.address.addr4.sin_addr.s_addr;
301 s_addr <<=32;
302 s_addr |= sendParameters->systemAddress.debugPort;
303 OutputStreamAndDataWriter ^outputStreamAndDataWriter = listenerContext->GetOutputStreamAndDataWriter(s_addr);
304 // DataWriter ^dataWriter = ref new DataWriter(outputStream);
305
306 auto platformBuffer = ref new Platform::Array<BYTE>((unsigned char*) sendParameters->data, (UINT)sendParameters->length);
307 outputStreamAndDataWriter->dataWriter->WriteBytes(platformBuffer);
308
309
310 // Write the locally buffered data to the network. Please note that write operation will succeed
311 // even if the server is not listening.
312 task<unsigned int>(outputStreamAndDataWriter->dataWriter->StoreAsync()).then([&] (task<unsigned int> writeTask)
313 {
314 try
315 {
316 // Try getting an excpetion.
317 // writeTask.get();
318 // SendOutput->Style = dynamic_cast<Windows::UI::Xaml::Style^>(rootPage->Resources->Lookup("StatusStyle"));
319 // SendOutput->Text = "\"" + stringToSend + "\" sent successfully";
320 }
321 catch (Exception^ exception)
322 {
323 // rootPage->NotifyUser("Send failed with error: " + exception->Message, NotifyType::ErrorMessage);
324 OutputDebugStringW(exception->Message->Data());
325 }
326 });
327
328 return 0;
329 }
330 void RNS2_WindowsStore8::DomainNameToIP( const char *domainName, char ip[65] ) {
331 ip[0]=0;
332
333 // RakAssert("DomainNameToIP Unsupported" && 0);
334
335 // std::string s_str = std::string(domainName);
336 // std::wstring wid_str = std::wstring(s_str.begin(), s_str.end());
337 // const wchar_t* w_char = wid_str.c_str();
338
339 SLNet::RakString rs(domainName);
340 WCHAR *w_char = rs.ToWideChar();
341
342 // DatagramSocket ^listener = ref new DatagramSocket();
343
344
345 // task<void> bindOp(listener->BindServiceNameAsync(ref new Platform::String()));
346 //bindOp.wait();
347
348 HostName ^hostName = ref new HostName(ref new Platform::String(w_char));
349 //HostName ^hostName = ref new HostName(ref new Platform::String(L"microsoft.com"));
350 //HostName ^hostName = ref new HostName(ref new Platform::String(L"127.0.0.1"));
351 //task< Windows::Foundation::Collections::IVectorView<EndpointPair^>^ > op(listener->GetEndpointPairsAsync(hostName, L"42"));
352 //listener->GetEndpointPairsAsync(hostName, L"42");
353 // task< Windows::Foundation::Collections::IVectorView<EndpointPair^>^ > op(DatagramSocket::GetEndpointPairsAsync(hostName, L"42"));
354
355 IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::Networking::EndpointPair^>^>^ op = DatagramSocket::GetEndpointPairsAsync(hostName, L"0");
356
357 bool completed=false;
358 op->Completed = ref new AsyncOperationCompletedHandler< Windows::Foundation::Collections::IVectorView<Windows::Networking::EndpointPair^>^ >(
359 [&] (
360 IAsyncOperation< Windows::Foundation::Collections::IVectorView<Windows::Networking::EndpointPair^>^>^ result,
361 AsyncStatus status
362 ) {
363 Windows::Foundation::Collections::IVectorView<Windows::Networking::EndpointPair^>^ result2 = result->GetResults();
364 if (result2->Size>0)
365 {
366 Platform::String ^name = result2->GetAt(0)->RemoteHostName->DisplayName;
367 RakString rs2;
368 rs2.FromWideChar(name->Data());
369 strcpy_s(ip, rs2.C_String());
370 }
371 else
372 {
373 ip[0]=0;
374 }
375
376 result->Close();
377 completed=true;
378 }
379 ) ;
380
381 while (!completed)
382 RakSleep(0);
383 /*
384 op->Completed = ref new AsyncOperationCompletedHandler< Windows::Foundation::Collections::IVectorView<EndpointPair^>^ >(
385 [](IAsyncOperation< Windows::Foundation::Collections::IVectorView<EndpointPair^>^ >^ operation)
386 {
387 operation->GetResults();
388
389 });
390 */
391
392
393 // RakSleep(10000);
394 /*
395 try
396 {
397 op.wait();
398 }
399 catch (Exception^ exception)
400 {
401 int a=5;
402 }
403 Windows::Foundation::Collections::IVectorView<EndpointPair^>^view = op.get();
404 if (view->Size>0)
405 {
406 Platform::String ^name = view->GetAt(0)->RemoteHostName->DisplayName;
407 RakString rs2;
408 rs2.FromWideChar(name->Data());
409 strcpy_s(ip, rs2.C_String());
410 }
411 else
412 {
413 ip[0]=0;
414 }
415 */
416
417 rs.DeallocWideChar(w_char);
418
419 }
420
421
422 int RNS2_WindowsStore8::WinRTInet_Addr(const char *str) {
423 int parts[4];
424 unsigned char curVal;
425
426 const char *strIndex=str;
427 int partsIndex;
428
429 for (partsIndex=0; partsIndex < 4; partsIndex++)
430 parts[partsIndex]=0;
431
432 partsIndex=0;
433 curVal=0;
434 while (partsIndex < 4)
435 {
436 if (*strIndex < '0' || *strIndex > '9')
437 {
438 parts[partsIndex]=curVal;
439 partsIndex++;
440 curVal=0;
441
442 if (*strIndex==0)
443 break;
444 }
445 else
446 {
447 curVal*=10;
448 curVal+=*strIndex-'0';
449 }
450 strIndex++;
451 }
452
453 return htonl((parts[0]<<24) | (parts[1]<<16) | (parts[2]<<8) | (parts[3]<<0) );
454 }
455
456 int RNS2_WindowsStore8::WinRTSetSockOpt(Windows::Networking::Sockets::DatagramSocket ^s,
457 int level,
458 int optname,
459 const char * optval,
460 socklen_t optlen) {RakAssert("WinRTSetSockOpt Unsupported" && 0); return 0;}
461
462 int RNS2_WindowsStore8::WinRTIOCTLSocket(Windows::Networking::Sockets::DatagramSocket ^s,
463 long cmd,
464 unsigned long *argp) {RakAssert("WinRTIOCTLSocket Unsupported" && 0); return 0;}
465
466 int RNS2_WindowsStore8::WinRTGetSockName(Windows::Networking::Sockets::DatagramSocket ^s,
467 struct sockaddr *name,
468 socklen_t* namelen) {RakAssert("WinRTGetSockName Unsupported" && 0); return 0;}
469
470 #endif // WINDOWS_STORE_RT
471
472 #endif // file header
473
474 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_BPlusTree.h Source File

  • include
  • slikenet
DS_BPlusTree.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #ifndef __B_PLUS_TREE_CPP
21 #define __B_PLUS_TREE_CPP
22
23 #include "DS_MemoryPool.h"
24 #include "DS_Queue.h"
25 #include <stdio.h>
26 #include "Export.h"
27
28 // Java
29 // http://www.seanster.com/BplusTree/BplusTree.html
30
31 // Overview
32 // http://babbage.clarku.edu/~achou/cs160/B+Trees/B+Trees.htm
33
34 // Deletion
35 // http://dbpubs.stanford.edu:8090/pub/1995-19
36
37 #ifdef _MSC_VER
38 #pragma warning( push )
39 #endif
40
41 #include "memoryoverride.h"
42
45 namespace DataStructures
46 {
49 template <class KeyType, class DataType, int order>
50 struct RAK_DLL_EXPORT Page
51 {
52 // We use the same data structure for both leaf and index nodes.
53 // It uses a little more memory for index nodes but reduces
54 // memory fragmentation, allocations, and deallocations.
55 bool isLeaf;
56
57 // Used for both leaf and index nodes.
58 // For a leaf it means the number of elements in data
59 // For an index it means the number of keys and is one less than the number of children pointers.
60 int size;
61
62 // Used for both leaf and index nodes.
63 KeyType keys[order];
64
65 // Used only for leaf nodes. Data is the actual data, while next is the pointer to the next leaf (for B+)
66 DataType data[order];
67 Page<KeyType, DataType, order> *next;
68 Page<KeyType, DataType, order> *previous;
69
70 // Used only for index nodes. Pointers to the children of this node.
71 Page *children[order+1];
72 };
73
76 template <class KeyType, class DataType, int order>
77 class RAK_DLL_EXPORT BPlusTree
78 {
79 public:
80 struct ReturnAction
81 {
82 KeyType key1;
83 KeyType key2;
84 enum
85 {
86 NO_ACTION,
87 REPLACE_KEY1_WITH_KEY2,
88 PUSH_KEY_TO_PARENT,
89 SET_BRANCH_KEY,
90 } action; // 0=none, 1=replace key1 with key2
91 };
92
93 BPlusTree();
94 ~BPlusTree();
95 void SetPoolPageSize(int size); // Set the page size for the memory pool. Optionsl
96 bool Get(const KeyType key, DataType &out) const;
97 bool Delete(const KeyType key);
98 bool Delete(const KeyType key, DataType &out);
99 bool Insert(const KeyType key, const DataType &data);
100 void Clear(void);
101 unsigned Size(void) const;
102 bool IsEmpty(void) const;
103 Page<KeyType, DataType, order> *GetListHead(void) const;
104 DataType GetDataHead(void) const;
105 void PrintLeaves(void);
106 void ForEachLeaf(void (*func)(Page<KeyType, DataType, order> * leaf, int index));
107 void ForEachData(void (*func)(DataType input, int index));
108 void PrintGraph(void);
109 protected:
110 void ValidateTreeRecursive(Page<KeyType, DataType, order> *cur);
111 void DeleteFromPageAtIndex(const int index, Page<KeyType, DataType, order> *cur);
112 static void PrintLeaf(Page<KeyType, DataType, order> * leaf, int index);
113 void FreePages(void);
114 bool GetIndexOf(const KeyType key, Page<KeyType, DataType, order> *page, int *out) const;
115 void ShiftKeysLeft(Page<KeyType, DataType, order> *cur);
116 bool CanRotateLeft(Page<KeyType, DataType, order> *cur, int childIndex);
117 bool CanRotateRight(Page<KeyType, DataType, order> *cur, int childIndex);
118 void RotateRight(Page<KeyType, DataType, order> *cur, int childIndex, ReturnAction *returnAction);
119 void RotateLeft(Page<KeyType, DataType, order> *cur, int childIndex, ReturnAction *returnAction);
120 Page<KeyType, DataType, order>* InsertIntoNode(const KeyType key, const DataType &childData, int insertionIndex, Page<KeyType, DataType, order> *nodeData, Page<KeyType, DataType, order> *cur, ReturnAction* returnAction);
121 Page<KeyType, DataType, order>* InsertBranchDown(const KeyType key, const DataType &data,Page<KeyType, DataType, order> *cur, ReturnAction* returnAction, bool *success);
122 Page<KeyType, DataType, order>* GetLeafFromKey(const KeyType key) const;
123 bool FindDeleteRebalance(const KeyType key, Page<KeyType, DataType, order> *cur, bool *underflow, KeyType rightRootKey, ReturnAction *returnAction, DataType &out);
124 bool FixUnderflow(int branchIndex, Page<KeyType, DataType, order> *cur, KeyType rightRootKey, ReturnAction *returnAction);
125 void ShiftNodeLeft(Page<KeyType, DataType, order> *cur);
126 void ShiftNodeRight(Page<KeyType, DataType, order> *cur);
127
128 MemoryPool<Page<KeyType, DataType, order> > pagePool;
129 Page<KeyType, DataType, order> *root, *leftmostLeaf;
130 };
131
132 template<class KeyType, class DataType, int order>
133 BPlusTree<KeyType, DataType, order>::BPlusTree ()
134 {
135 RakAssert(order>1);
136 root=0;
137 leftmostLeaf=0;
138 }
139 template<class KeyType, class DataType, int order>
140 BPlusTree<KeyType, DataType, order>::~BPlusTree ()
141 {
142 Clear();
143 }
144 template<class KeyType, class DataType, int order>
145 void BPlusTree<KeyType, DataType, order>::SetPoolPageSize(int size)
146 {
147 pagePool.SetPageSize(size);
148 }
149 template<class KeyType, class DataType, int order>
150 bool BPlusTree<KeyType, DataType, order>::Get(const KeyType key, DataType &out) const
151 {
152 if (root==0)
153 return false;
154
155 Page<KeyType, DataType, order>* leaf = GetLeafFromKey(key);
156 int childIndex;
157
158 if (GetIndexOf(key, leaf, &childIndex))
159 {
160 out=leaf->data[childIndex];
161 return true;
162 }
163 return false;
164 }
165 template<class KeyType, class DataType, int order>
166 void BPlusTree<KeyType, DataType, order>::DeleteFromPageAtIndex(const int index, Page<KeyType, DataType, order> *cur)
167 {
168 int i;
169 for (i=index; i < cur->size-1; i++)
170 cur->keys[i]=cur->keys[i+1];
171 if (cur->isLeaf)
172 {
173 for (i=index; i < cur->size-1; i++)
174 cur->data[i]=cur->data[i+1];
175 }
176 else
177 {
178 for (i=index; i < cur->size-1; i++)
179 cur->children[i+1]=cur->children[i+2];
180 }
181 cur->size--;
182 }
183 template<class KeyType, class DataType, int order>
184 bool BPlusTree<KeyType, DataType, order>::Delete(const KeyType key)
185 {
186 DataType temp;
187 return Delete(key, temp);
188 }
189 template<class KeyType, class DataType, int order>
190 bool BPlusTree<KeyType, DataType, order>::Delete(const KeyType key, DataType &out)
191 {
192 if (root==0)
193 return false;
194
195 ReturnAction returnAction;
196 returnAction.action=ReturnAction::NO_ACTION;
197 int childIndex;
198 bool underflow=false;
199 if (root==leftmostLeaf)
200 {
201 if (GetIndexOf(key, root, &childIndex)==false)
202 return false;
203 out=root->data[childIndex];
204 DeleteFromPageAtIndex(childIndex,root);
205 if (root->size==0)
206 {
207 pagePool.Release(root, _FILE_AND_LINE_);
208 root=0;
209 leftmostLeaf=0;
210 }
211 return true;
212 }
213 else if (FindDeleteRebalance(key, root, &underflow,root->keys[0], &returnAction, out)==false)
214 return false;
215
216 // RakAssert(returnAction.action==ReturnAction::NO_ACTION);
217
218 if (underflow && root->size==0)
219 {
220 // Move the root down.
221 Page<KeyType, DataType, order> *oldRoot=root;
222 root=root->children[0];
223 pagePool.Release(oldRoot, _FILE_AND_LINE_);
224 // memset(oldRoot,0,sizeof(root));
225 }
226
227 return true;
228 }
229 template<class KeyType, class DataType, int order>
230 bool BPlusTree<KeyType, DataType, order>::FindDeleteRebalance(const KeyType key, Page<KeyType, DataType, order> *cur, bool *underflow, KeyType rightRootKey, ReturnAction *returnAction, DataType &out)
231 {
232 // Get index of child to follow.
233 int branchIndex, childIndex;
234 if (GetIndexOf(key, cur, &childIndex))
235 branchIndex=childIndex+1;
236 else
237 branchIndex=childIndex;
238
239 // If child is not a leaf, call recursively
240 if (cur->children[branchIndex]->isLeaf==false)
241 {
242 if (branchIndex<cur->size)
243 rightRootKey=cur->keys[branchIndex]; // Shift right to left
244 else
245 rightRootKey=cur->keys[branchIndex-1]; // Shift center to left
246
247 if (FindDeleteRebalance(key, cur->children[branchIndex], underflow, rightRootKey, returnAction, out)==false)
248 return false;
249
250 // Call again in case the root key changed
251 if (branchIndex<cur->size)
252 rightRootKey=cur->keys[branchIndex]; // Shift right to left
253 else
254 rightRootKey=cur->keys[branchIndex-1]; // Shift center to left
255
256 if (returnAction->action==ReturnAction::SET_BRANCH_KEY && branchIndex!=childIndex)
257 {
258 returnAction->action=ReturnAction::NO_ACTION;
259 cur->keys[childIndex]=returnAction->key1;
260
261 if (branchIndex<cur->size)
262 rightRootKey=cur->keys[branchIndex]; // Shift right to left
263 else
264 rightRootKey=cur->keys[branchIndex-1]; // Shift center to left
265 }
266 }
267 else
268 {
269 // If child is a leaf, get the index of the key. If the item is not found, cancel delete.
270 if (GetIndexOf(key, cur->children[branchIndex], &childIndex)==false)
271 return false;
272
273 // Delete:
274 // Remove childIndex from the child at branchIndex
275 out=cur->children[branchIndex]->data[childIndex];
276 DeleteFromPageAtIndex(childIndex, cur->children[branchIndex]);
277
278 if (childIndex==0)
279 {
280 if (branchIndex>0)
281 cur->keys[branchIndex-1]=cur->children[branchIndex]->keys[0];
282
283 if (branchIndex==0)
284 {
285 returnAction->action=ReturnAction::SET_BRANCH_KEY;
286 returnAction->key1=cur->children[0]->keys[0];
287 }
288 }
289
290 if (cur->children[branchIndex]->size < order/2)
291 *underflow=true;
292 else
293 *underflow=false;
294 }
295
296 // Fix underflow:
297 if (*underflow)
298 {
299 *underflow=FixUnderflow(branchIndex, cur, rightRootKey, returnAction);
300 }
301
302 return true;
303 }
304 template<class KeyType, class DataType, int order>
305 bool BPlusTree<KeyType, DataType, order>::FixUnderflow(int branchIndex, Page<KeyType, DataType, order> *cur, KeyType rightRootKey, ReturnAction *returnAction)
306 {
307 // Borrow from a neighbor that has excess.
308 Page<KeyType, DataType, order> *source;
309 Page<KeyType, DataType, order> *dest;
310
311 if (branchIndex>0 && cur->children[branchIndex-1]->size > order/2)
312 {
313 dest=cur->children[branchIndex];
314 source=cur->children[branchIndex-1];
315
316 // Left has excess
317 ShiftNodeRight(dest);
318 if (dest->isLeaf)
319 {
320 dest->keys[0]=source->keys[source->size-1];
321 dest->data[0]=source->data[source->size-1];
322 }
323 else
324 {
325 dest->children[0]=source->children[source->size];
326 dest->keys[0]=cur->keys[branchIndex-1];
327 }
328 // Update the parent key for the child (middle)
329 cur->keys[branchIndex-1]=source->keys[source->size-1];
330 source->size--;
331
332 // if (branchIndex==0)
333 // {
334 // returnAction->action=ReturnAction::SET_BRANCH_KEY;
335 // returnAction->key1=dest->keys[0];
336 // }
337
338 // No underflow
339 return false;
340 }
341 else if (branchIndex<cur->size && cur->children[branchIndex+1]->size > order/2)
342 {
343 dest=cur->children[branchIndex];
344 source=cur->children[branchIndex+1];
345
346 // Right has excess
347 if (dest->isLeaf)
348 {
349 dest->keys[dest->size]=source->keys[0];
350 dest->data[dest->size]=source->data[0];
351
352 // The first key in the leaf after shifting is the parent key for the right branch
353 cur->keys[branchIndex]=source->keys[1];
354
355 #ifdef _MSC_VER
356 #pragma warning( disable : 4127 ) // warning C4127: conditional expression is constant
357 #endif
358 if (order<=3 && dest->size==0)
359 {
360 if (branchIndex==0)
361 {
362 returnAction->action=ReturnAction::SET_BRANCH_KEY;
363 returnAction->key1=dest->keys[0];
364 }
365 else
366 cur->keys[branchIndex-1]=cur->children[branchIndex]->keys[0];
367 }
368 }
369 else
370 {
371 if (returnAction->action==ReturnAction::NO_ACTION)
372 {
373 returnAction->action=ReturnAction::SET_BRANCH_KEY;
374 returnAction->key1=dest->keys[0];
375 }
376
377 dest->keys[dest->size]=rightRootKey;
378 dest->children[dest->size+1]=source->children[0];
379
380 // The shifted off key is the leftmost key for a node
381 cur->keys[branchIndex]=source->keys[0];
382 }
383
384
385 dest->size++;
386 ShiftNodeLeft(source);
387
388 //cur->keys[branchIndex]=source->keys[0];
389
390 // returnAction->action=ReturnAction::SET_BRANCH_KEY;
391 // returnAction->key1=dest->keys[dest->size-1];
392
393 // No underflow
394 return false;
395 }
396 else
397 {
398 int sourceIndex;
399
400 // If no neighbors have excess, merge two branches.
401 //
402 // To merge two leaves, just copy the data and keys over.
403 //
404 // To merge two branches, copy the pointers and keys over, using rightRootKey as the key for the extra pointer
405 if (branchIndex<cur->size)
406 {
407 // Merge right child to current child and delete right child.
408 dest=cur->children[branchIndex];
409 source=cur->children[branchIndex+1];
410 }
411 else
412 {
413 // Move current child to left and delete current child
414 dest=cur->children[branchIndex-1];
415 source=cur->children[branchIndex];
416 }
417
418 // Merge
419 if (dest->isLeaf)
420 {
421 for (sourceIndex=0; sourceIndex<source->size; sourceIndex++)
422 {
423 dest->keys[dest->size]=source->keys[sourceIndex];
424 dest->data[dest->size++]=source->data[sourceIndex];
425 }
426 }
427 else
428 {
429 // We want the tree root key of the source, not the current.
430 dest->keys[dest->size]=rightRootKey;
431 dest->children[dest->size++ + 1]=source->children[0];
432 for (sourceIndex=0; sourceIndex<source->size; sourceIndex++)
433 {
434 dest->keys[dest->size]=source->keys[sourceIndex];
435 dest->children[dest->size++ + 1]=source->children[sourceIndex + 1];
436 }
437 }
438
439 #ifdef _MSC_VER
440 #pragma warning( disable : 4127 ) // warning C4127: conditional expression is constant
441 #endif
442 if (order<=3 && branchIndex>0 && cur->children[branchIndex]->isLeaf) // With order==2 it is possible to delete data[0], which is not possible with higher orders.
443 cur->keys[branchIndex-1]=cur->children[branchIndex]->keys[0];
444
445 if (branchIndex<cur->size)
446 {
447 // Update the parent key, removing the source (right)
448 DeleteFromPageAtIndex(branchIndex, cur);
449 }
450 else
451 {
452 if (branchIndex>0)
453 {
454 // Update parent key, removing the source (current)
455 DeleteFromPageAtIndex(branchIndex-1, cur);
456 }
457 }
458
459 if (branchIndex==0 && dest->isLeaf)
460 {
461 returnAction->action=ReturnAction::SET_BRANCH_KEY;
462 returnAction->key1=dest->keys[0];
463 }
464
465 if (source==leftmostLeaf)
466 leftmostLeaf=source->next;
467
468 if (source->isLeaf)
469 {
470 if (source->previous)
471 source->previous->next=source->next;
472 if (source->next)
473 source->next->previous=source->previous;
474 }
475
476 // Free the source node
477 pagePool.Release(source, _FILE_AND_LINE_);
478 // memset(source,0,sizeof(root));
479
480 // Return underflow or not of parent.
481 return cur->size < order/2;
482 }
483 }
484 template<class KeyType, class DataType, int order>
485 void BPlusTree<KeyType, DataType, order>::ShiftNodeRight(Page<KeyType, DataType, order> *cur)
486 {
487 int i;
488 for (i=cur->size; i>0; i--)
489 cur->keys[i]=cur->keys[i-1];
490 if (cur->isLeaf)
491 {
492 for (i=cur->size; i>0; i--)
493 cur->data[i]=cur->data[i-1];
494 }
495 else
496 {
497 for (i=cur->size+1; i>0; i--)
498 cur->children[i]=cur->children[i-1];
499 }
500
501 cur->size++;
502 }
503 template<class KeyType, class DataType, int order>
504 void BPlusTree<KeyType, DataType, order>::ShiftNodeLeft(Page<KeyType, DataType, order> *cur)
505 {
506 int i;
507 for (i=0; i < cur->size-1; i++)
508 cur->keys[i]=cur->keys[i+1];
509 if (cur->isLeaf)
510 {
511 for (i=0; i < cur->size; i++)
512 cur->data[i]=cur->data[i+1];
513 }
514 else
515 {
516 for (i=0; i < cur->size; i++)
517 cur->children[i]=cur->children[i+1];
518 }
519 cur->size--;
520 }
521 template<class KeyType, class DataType, int order>
522 Page<KeyType, DataType, order>* BPlusTree<KeyType, DataType, order>::InsertIntoNode(const KeyType key, const DataType &leafData, int insertionIndex, Page<KeyType, DataType, order> *nodeData, Page<KeyType, DataType, order> *cur, ReturnAction* returnAction)
523 {
524 int i;
525 if (cur->size < order)
526 {
527 for (i=cur->size; i > insertionIndex; i--)
528 cur->keys[i]=cur->keys[i-1];
529 if (cur->isLeaf)
530 {
531 for (i=cur->size; i > insertionIndex; i--)
532 cur->data[i]=cur->data[i-1];
533 }
534 else
535 {
536 for (i=cur->size+1; i > insertionIndex+1; i--)
537 cur->children[i]=cur->children[i-1];
538 }
539 cur->keys[insertionIndex]=key;
540 if (cur->isLeaf)
541 cur->data[insertionIndex]=leafData;
542 else
543 cur->children[insertionIndex+1]=nodeData;
544
545 cur->size++;
546 }
547 else
548 {
549 Page<KeyType, DataType, order>* newPage = pagePool.Allocate( _FILE_AND_LINE_ );
550 newPage->isLeaf=cur->isLeaf;
551 if (cur->isLeaf)
552 {
553 newPage->next=cur->next;
554 if (cur->next)
555 cur->next->previous=newPage;
556 newPage->previous=cur;
557 cur->next=newPage;
558 }
559
560 int destIndex, sourceIndex;
561
562 if (insertionIndex>=(order+1)/2)
563 {
564 destIndex=0;
565 sourceIndex=order/2;
566
567 for (; sourceIndex < insertionIndex; sourceIndex++, destIndex++)
568 {
569 newPage->keys[destIndex]=cur->keys[sourceIndex];
570 }
571 newPage->keys[destIndex++]=key;
572 for (; sourceIndex < order; sourceIndex++, destIndex++)
573 {
574 newPage->keys[destIndex]=cur->keys[sourceIndex];
575 }
576
577 destIndex=0;
578 sourceIndex=order/2;
579 if (cur->isLeaf)
580 {
581 for (; sourceIndex < insertionIndex; sourceIndex++, destIndex++)
582 {
583 newPage->data[destIndex]=cur->data[sourceIndex];
584 }
585 newPage->data[destIndex++]=leafData;
586 for (; sourceIndex < order; sourceIndex++, destIndex++)
587 {
588 newPage->data[destIndex]=cur->data[sourceIndex];
589 }
590 }
591 else
592 {
593
594 for (; sourceIndex < insertionIndex; sourceIndex++, destIndex++)
595 {
596 newPage->children[destIndex]=cur->children[sourceIndex+1];
597 }
598 newPage->children[destIndex++]=nodeData;
599
600 // sourceIndex+1 is sort of a hack but it works - because there is one extra child than keys
601 // skip past the last child for cur
602 for (; sourceIndex+1 < cur->size+1; sourceIndex++, destIndex++)
603 {
604 newPage->children[destIndex]=cur->children[sourceIndex+1];
605 }
606
607 // the first key is the middle key. Remove it from the page and push it to the parent
608 returnAction->action=ReturnAction::PUSH_KEY_TO_PARENT;
609 returnAction->key1=newPage->keys[0];
610 for (int j=0; j < destIndex-1; j++)
611 newPage->keys[j]=newPage->keys[j+1];
612
613 }
614 cur->size=order/2;
615 }
616 else
617 {
618 destIndex=0;
619 sourceIndex=(order+1)/2-1;
620 for (; sourceIndex < order; sourceIndex++, destIndex++)
621 newPage->keys[destIndex]=cur->keys[sourceIndex];
622 destIndex=0;
623 if (cur->isLeaf)
624 {
625 sourceIndex=(order+1)/2-1;
626 for (; sourceIndex < order; sourceIndex++, destIndex++)
627 newPage->data[destIndex]=cur->data[sourceIndex];
628 }
629 else
630 {
631 sourceIndex=(order+1)/2;
632 for (; sourceIndex < order+1; sourceIndex++, destIndex++)
633 newPage->children[destIndex]=cur->children[sourceIndex];
634
635 // the first key is the middle key. Remove it from the page and push it to the parent
636 returnAction->action=ReturnAction::PUSH_KEY_TO_PARENT;
637 returnAction->key1=newPage->keys[0];
638 for (int j=0; j < destIndex-1; j++)
639 newPage->keys[j]=newPage->keys[j+1];
640 }
641 cur->size=(order+1)/2-1;
642 if (cur->size)
643 {
644 bool b = GetIndexOf(key, cur, &insertionIndex);
645 (void) b;
646 RakAssert(b==false);
647 }
648 else
649 insertionIndex=0;
650 InsertIntoNode(key, leafData, insertionIndex, nodeData, cur, returnAction);
651 }
652
653 newPage->size=destIndex;
654
655 return newPage;
656 }
657
658 return 0;
659 }
660
661 template<class KeyType, class DataType, int order>
662 bool BPlusTree<KeyType, DataType, order>::CanRotateLeft(Page<KeyType, DataType, order> *cur, int childIndex)
663 {
664 return childIndex>0 && cur->children[childIndex-1]->size<order;
665 }
666
667 template<class KeyType, class DataType, int order>
668 void BPlusTree<KeyType, DataType, order>::RotateLeft(Page<KeyType, DataType, order> *cur, int childIndex, ReturnAction *returnAction)
669 {
670 Page<KeyType, DataType, order> *dest = cur->children[childIndex-1];
671 Page<KeyType, DataType, order> *source = cur->children[childIndex];
672 returnAction->key1=source->keys[0];
673 dest->keys[dest->size]=source->keys[0];
674 dest->data[dest->size]=source->data[0];
675 dest->size++;
676 for (int i=0; i < source->size-1; i++)
677 {
678 source->keys[i]=source->keys[i+1];
679 source->data[i]=source->data[i+1];
680 }
681 source->size--;
682 cur->keys[childIndex-1]=source->keys[0];
683 returnAction->key2=source->keys[0];
684 }
685
686 template<class KeyType, class DataType, int order>
687 bool BPlusTree<KeyType, DataType, order>::CanRotateRight(Page<KeyType, DataType, order> *cur, int childIndex)
688 {
689 return childIndex < cur->size && cur->children[childIndex+1]->size<order;
690 }
691
692 template<class KeyType, class DataType, int order>
693 void BPlusTree<KeyType, DataType, order>::RotateRight(Page<KeyType, DataType, order> *cur, int childIndex, ReturnAction *returnAction)
694 {
695 Page<KeyType, DataType, order> *dest = cur->children[childIndex+1];
696 Page<KeyType, DataType, order> *source = cur->children[childIndex];
697 returnAction->key1=dest->keys[0];
698 for (int i= dest->size; i > 0; i--)
699 {
700 dest->keys[i]=dest->keys[i-1];
701 dest->data[i]=dest->data[i-1];
702 }
703 dest->keys[0]=source->keys[source->size-1];
704 dest->data[0]=source->data[source->size-1];
705 dest->size++;
706 source->size--;
707
708 cur->keys[childIndex]=dest->keys[0];
709 returnAction->key2=dest->keys[0];
710 }
711 template<class KeyType, class DataType, int order>
712 Page<KeyType, DataType, order>* BPlusTree<KeyType, DataType, order>::GetLeafFromKey(const KeyType key) const
713 {
714 Page<KeyType, DataType, order>* cur = root;
715 int childIndex;
716 while (cur->isLeaf==false)
717 {
718 // When searching, if we match the exact key we go down the pointer after that index
719 if (GetIndexOf(key, cur, &childIndex))
720 childIndex++;
721 cur = cur->children[childIndex];
722 }
723 return cur;
724 }
725
726 template<class KeyType, class DataType, int order>
727 Page<KeyType, DataType, order>* BPlusTree<KeyType, DataType, order>::InsertBranchDown(const KeyType key, const DataType &data,Page<KeyType, DataType, order> *cur, ReturnAction *returnAction, bool *success)
728 {
729 int childIndex;
730 int branchIndex;
731 if (GetIndexOf(key, cur, &childIndex))
732 branchIndex=childIndex+1;
733 else
734 branchIndex=childIndex;
735 Page<KeyType, DataType, order>* newPage;
736 if (cur->isLeaf==false)
737 {
738 if (cur->children[branchIndex]->isLeaf==true && cur->children[branchIndex]->size==order)
739 {
740 if (branchIndex==childIndex+1)
741 {
742 *success=false;
743 return 0; // Already exists
744 }
745
746 if (CanRotateLeft(cur, branchIndex))
747 {
748 returnAction->action=ReturnAction::REPLACE_KEY1_WITH_KEY2;
749 if (key > cur->children[branchIndex]->keys[0])
750 {
751 RotateLeft(cur, branchIndex, returnAction);
752
753 int insertionIndex;
754 GetIndexOf(key, cur->children[branchIndex], &insertionIndex);
755 InsertIntoNode(key, data, insertionIndex, 0, cur->children[branchIndex], 0);
756 }
757 else
758 {
759 // Move head element to left and replace it with key,data
760 Page<KeyType, DataType, order>* dest=cur->children[branchIndex-1];
761 Page<KeyType, DataType, order>* source=cur->children[branchIndex];
762 returnAction->key1=source->keys[0];
763 returnAction->key2=key;
764 dest->keys[dest->size]=source->keys[0];
765 dest->data[dest->size]=source->data[0];
766 dest->size++;
767 source->keys[0]=key;
768 source->data[0]=data;
769 }
770 cur->keys[branchIndex-1]=cur->children[branchIndex]->keys[0];
771
772 return 0;
773 }
774 else if (CanRotateRight(cur, branchIndex))
775 {
776 returnAction->action=ReturnAction::REPLACE_KEY1_WITH_KEY2;
777
778 if (key < cur->children[branchIndex]->keys[cur->children[branchIndex]->size-1])
779 {
780 RotateRight(cur, branchIndex, returnAction);
781
782 int insertionIndex;
783 GetIndexOf(key, cur->children[branchIndex], &insertionIndex);
784 InsertIntoNode(key, data, insertionIndex, 0, cur->children[branchIndex], 0);
785
786 }
787 else
788 {
789 // Insert to the head of the right leaf instead and change our key
790 returnAction->key1=cur->children[branchIndex+1]->keys[0];
791 InsertIntoNode(key, data, 0, 0, cur->children[branchIndex+1], 0);
792 returnAction->key2=key;
793 }
794 cur->keys[branchIndex]=cur->children[branchIndex+1]->keys[0];
795 return 0;
796 }
797 }
798
799 newPage=InsertBranchDown(key,data,cur->children[branchIndex], returnAction, success);
800 if (returnAction->action==ReturnAction::REPLACE_KEY1_WITH_KEY2)
801 {
802 if (branchIndex>0 && cur->keys[branchIndex-1]==returnAction->key1)
803 cur->keys[branchIndex-1]=returnAction->key2;
804 }
805 if (newPage)
806 {
807 if (newPage->isLeaf==false)
808 {
809 RakAssert(returnAction->action==ReturnAction::PUSH_KEY_TO_PARENT);
810 newPage->size--;
811 return InsertIntoNode(returnAction->key1, data, branchIndex, newPage, cur, returnAction);
812 }
813 else
814 {
815 return InsertIntoNode(newPage->keys[0], data, branchIndex, newPage, cur, returnAction);
816 }
817 }
818 }
819 else
820 {
821 if (branchIndex==childIndex+1)
822 {
823 *success=false;
824 return 0; // Already exists
825 }
826 else
827 {
828 return InsertIntoNode(key, data, branchIndex, 0, cur, returnAction);
829 }
830 }
831
832 return 0;
833 }
834 template<class KeyType, class DataType, int order>
835 bool BPlusTree<KeyType, DataType, order>::Insert(const KeyType key, const DataType &data)
836 {
837 if (root==0)
838 {
839 // Allocate root and make root a leaf
840 root = pagePool.Allocate( _FILE_AND_LINE_ );
841 root->isLeaf=true;
842 leftmostLeaf=root;
843 root->size=1;
844 root->keys[0]=key;
845 root->data[0]=data;
846 root->next=0;
847 root->previous=0;
848 }
849 else
850 {
851 bool success=true;
852 ReturnAction returnAction;
853 returnAction.action=ReturnAction::NO_ACTION;
854 Page<KeyType, DataType, order>* newPage = InsertBranchDown(key, data, root, &returnAction, &success);
855 if (success==false)
856 return false;
857 if (newPage)
858 {
859 KeyType newKey;
860 if (newPage->isLeaf==false)
861 {
862 // One key is pushed up through the stack. I store that at keys[0] but it has to be removed for the page to be correct
863 RakAssert(returnAction.action==ReturnAction::PUSH_KEY_TO_PARENT);
864 newKey=returnAction.key1;
865 newPage->size--;
866 }
867 else
868 newKey = newPage->keys[0];
869 // propagate the root
870 Page<KeyType, DataType, order>* newRoot = pagePool.Allocate( _FILE_AND_LINE_ );
871 newRoot->isLeaf=false;
872 newRoot->size=1;
873 newRoot->keys[0]=newKey;
874 newRoot->children[0]=root;
875 newRoot->children[1]=newPage;
876 root=newRoot;
877 }
878 }
879
880 return true;
881 }
882 template<class KeyType, class DataType, int order>
883 void BPlusTree<KeyType, DataType, order>::ShiftKeysLeft(Page<KeyType, DataType, order> *cur)
884 {
885 int i;
886 for (i=0; i < cur->size; i++)
887 cur->keys[i]=cur->keys[i+1];
888 }
889 template<class KeyType, class DataType, int order>
890 void BPlusTree<KeyType, DataType, order>::Clear(void)
891 {
892 if (root)
893 {
894 FreePages();
895 leftmostLeaf=0;
896 root=0;
897 }
898 pagePool.Clear(_FILE_AND_LINE_);
899 }
900 template<class KeyType, class DataType, int order>
901 unsigned BPlusTree<KeyType, DataType, order>::Size(void) const
902 {
903 unsigned int count=0;
904 DataStructures::Page<KeyType, DataType, order> *cur = GetListHead();
905 while (cur)
906 {
907 count+=cur->size;
908 cur=cur->next;
909 }
910 return count;
911 }
912 template<class KeyType, class DataType, int order>
913 bool BPlusTree<KeyType, DataType, order>::IsEmpty(void) const
914 {
915 return root==0;
916 }
917 template<class KeyType, class DataType, int order>
918 bool BPlusTree<KeyType, DataType, order>::GetIndexOf(const KeyType key, Page<KeyType, DataType, order> *page, int *out) const
919 {
920 RakAssert(page->size>0);
921 int index, upperBound, lowerBound;
922 upperBound=page->size-1;
923 lowerBound=0;
924 index = page->size/2;
925
926 for(;;)
927 {
928 if (key==page->keys[index])
929 {
930 *out=index;
931 return true;
932 }
933 else if (key<page->keys[index])
934 upperBound=index-1;
935 else
936 lowerBound=index+1;
937
938 index=lowerBound+(upperBound-lowerBound)/2;
939
940 if (lowerBound>upperBound)
941 {
942 *out=lowerBound;
943 return false; // No match
944 }
945 }
946 }
947 template<class KeyType, class DataType, int order>
948 void BPlusTree<KeyType, DataType, order>::FreePages(void)
949 {
950 DataStructures::Queue<DataStructures::Page<KeyType, DataType, order> *> queue;
951 DataStructures::Page<KeyType, DataType, order> *ptr;
952 int i;
953 queue.Push(root, _FILE_AND_LINE_ );
954 while (queue.Size())
955 {
956 ptr=queue.Pop();
957 if (ptr->isLeaf==false)
958 {
959 for (i=0; i < ptr->size+1; i++)
960 queue.Push(ptr->children[i], _FILE_AND_LINE_ );
961 }
962 pagePool.Release(ptr, _FILE_AND_LINE_);
963 // memset(ptr,0,sizeof(root));
964 };
965 }
966 template<class KeyType, class DataType, int order>
967 Page<KeyType, DataType, order> *BPlusTree<KeyType, DataType, order>::GetListHead(void) const
968 {
969 return leftmostLeaf;
970 }
971 template<class KeyType, class DataType, int order>
972 DataType BPlusTree<KeyType, DataType, order>::GetDataHead(void) const
973 {
974 return leftmostLeaf->data[0];
975 }
976 template<class KeyType, class DataType, int order>
977 void BPlusTree<KeyType, DataType, order>::ForEachLeaf(void (*func)(Page<KeyType, DataType, order> * leaf, int index))
978 {
979 int count=0;
980 DataStructures::Page<KeyType, DataType, order> *cur = GetListHead();
981 while (cur)
982 {
983 func(cur, count++);
984 cur=cur->next;
985 }
986 }
987 template<class KeyType, class DataType, int order>
988 void BPlusTree<KeyType, DataType, order>::ForEachData(void (*func)(DataType input, int index))
989 {
990 int count=0,i;
991 DataStructures::Page<KeyType, DataType, order> *cur = GetListHead();
992 while (cur)
993 {
994 for (i=0; i < cur->size; i++)
995 func(cur->data[i], count++);
996 cur=cur->next;
997 }
998 }
999 template<class KeyType, class DataType, int order>
1000 void BPlusTree<KeyType, DataType, order>::PrintLeaf(Page<KeyType, DataType, order> * leaf, int index)
1001 {
1002 int i;
1003 RAKNET_DEBUG_PRINTF("%i] SELF=%p\n", index+1, leaf);
1004 for (i=0; i < leaf->size; i++)
1005 // #med - need to adjust printf-format specified based on the actual datatype
1006 RAKNET_DEBUG_PRINTF(" %i. %p\n", i+1, leaf->data[i]);
1007 }
1008 template<class KeyType, class DataType, int order>
1009 void BPlusTree<KeyType, DataType, order>::PrintLeaves(void)
1010 {
1011 ForEachLeaf(PrintLeaf);
1012 }
1013
1014 template<class KeyType, class DataType, int order>
1015 void BPlusTree<KeyType, DataType, order>::ValidateTreeRecursive(Page<KeyType, DataType, order> *cur)
1016 {
1017 RakAssert(cur==root || cur->size>=order/2);
1018
1019 if (cur->children[0]->isLeaf)
1020 {
1021 RakAssert(cur->children[0]->keys[0] < cur->keys[0]);
1022 for (int i=0; i < cur->size; i++)
1023 {
1024 RakAssert(cur->children[i+1]->keys[0]==cur->keys[i]);
1025 }
1026 }
1027 else
1028 {
1029 for (int i=0; i < cur->size+1; i++)
1030 ValidateTreeRecursive(cur->children[i]);
1031 }
1032 }
1033
1034 template<class KeyType, class DataType, int order>
1035 void BPlusTree<KeyType, DataType, order>::PrintGraph(void)
1036 {
1037 DataStructures::Queue<DataStructures::Page<KeyType, DataType, order> *> queue;
1038 queue.Push(root,_FILE_AND_LINE_);
1039 queue.Push(0,_FILE_AND_LINE_);
1040 DataStructures::Page<KeyType, DataType, order> *ptr;
1041 int i,j;
1042 if (root)
1043 {
1044 RAKNET_DEBUG_PRINTF("%p(", root);
1045 for (i=0; i < root->size; i++)
1046 {
1047 RAKNET_DEBUG_PRINTF("%i ", root->keys[i]);
1048 }
1049 RAKNET_DEBUG_PRINTF(") ");
1050 RAKNET_DEBUG_PRINTF("\n");
1051 }
1052 while (queue.Size())
1053 {
1054 ptr=queue.Pop();
1055 if (ptr==0)
1056 RAKNET_DEBUG_PRINTF("\n");
1057 else if (ptr->isLeaf==false)
1058 {
1059 for (i=0; i < ptr->size+1; i++)
1060 {
1061 RAKNET_DEBUG_PRINTF("%p(", ptr->children[i]);
1062 //RAKNET_DEBUG_PRINTF("(", ptr->children[i]);
1063 for (j=0; j < ptr->children[i]->size; j++)
1064 RAKNET_DEBUG_PRINTF("%i ", ptr->children[i]->keys[j]);
1065 RAKNET_DEBUG_PRINTF(") ");
1066 queue.Push(ptr->children[i],_FILE_AND_LINE_);
1067 }
1068 queue.Push(0,_FILE_AND_LINE_);
1069 RAKNET_DEBUG_PRINTF(" -- ");
1070 }
1071 }
1072 RAKNET_DEBUG_PRINTF("\n");
1073 }
1074 }
1075 #ifdef _MSC_VER
1076 #pragma warning( pop )
1077 #endif
1078
1079 #endif
1080
1081 // Code to test this hellish data structure.
1082 /*
1083 #include "DS_BPlusTree.h"
1084 #include <stdio.h>
1085
1086 // Handle underflow on root. If there is only one item left then I can go downwards.
1087 // Make sure I keep the leftmost pointer valid by traversing it
1088 // When I free a leaf, be sure to adjust the pointers around it.
1089
1090 #include "Rand.h"
1091
1092 void main(void)
1093 {
1094 DataStructures::BPlusTree<int, int, 16> btree;
1095 DataStructures::List<int> haveList, removedList;
1096 int temp;
1097 int i, j, index;
1098 int testSize;
1099 bool b;
1100
1101 for (testSize=0; testSize < 514; testSize++)
1102 {
1103 RAKNET_DEBUG_PRINTF("TestSize=%i\n", testSize);
1104
1105 for (i=0; i < testSize; i++)
1106 haveList.Insert(i);
1107
1108 for (i=0; i < testSize; i++)
1109 {
1110 index=i+randomMT()%(testSize-i);
1111 temp=haveList[index];
1112 haveList[index]=haveList[i];
1113 haveList[i]=temp;
1114 }
1115
1116 for (i=0; i<testSize; i++)
1117 {
1118 btree.Insert(haveList[i], haveList[i]);
1119 btree.ValidateTree();
1120 }
1121
1122 for (i=0; i < testSize; i++)
1123 {
1124 index=i+randomMT()%(testSize-i);
1125 temp=haveList[index];
1126 haveList[index]=haveList[i];
1127 haveList[i]=temp;
1128 }
1129 for (i=0; i<testSize; i++)
1130 {
1131 btree.Delete(haveList[0]); // Asserts on 8th call. Fails on going to remove 8 (7th call)
1132 removedList.Insert(haveList[0]);
1133 haveList.RemoveAtIndex(0);
1134 for (j=0; j < removedList.Size(); j++)
1135 {
1136 b=btree.Get(removedList[j], temp);
1137 RakAssert(b==false);
1138 }
1139 for (j=0; j < haveList.Size(); j++)
1140 {
1141 b=btree.Get(haveList[j], temp);
1142 RakAssert(b==true);
1143 RakAssert(haveList[j]==temp);
1144 }
1145 RakAssert(btree.Size()==haveList.Size());
1146 btree.ValidateTree();
1147 }
1148 btree.Clear(_FILE_AND_LINE_);
1149 removedList.Clear(_FILE_AND_LINE_);
1150 haveList.Clear(_FILE_AND_LINE_);
1151 }
1152
1153 RAKNET_DEBUG_PRINTF("Done. %i\n", btree.Size());
1154 char ch[256];
1155 Gets(ch, sizeof(ch));
1156 }
1157 */
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_RangeList.h Source File

  • include
  • slikenet
DS_RangeList.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __RANGE_LIST_H
23 #define __RANGE_LIST_H
24
25 #include "DS_OrderedList.h"
26 #include "BitStream.h"
27 #include "memoryoverride.h"
28 #include "assert.h"
29
30 namespace DataStructures
31 {
32 template <class range_type>
33 struct RangeNode
34 {
35 RangeNode() {}
36 ~RangeNode() {}
37 RangeNode(range_type min, range_type max) {minIndex=min; maxIndex=max;}
38 range_type minIndex;
39 range_type maxIndex;
40 };
41
42
43 template <class range_type>
44 int RangeNodeComp(const range_type &a, const RangeNode<range_type> &b)
45 {
46 if (a < b.minIndex) {
47 return -1;
48 }
49 if (a > b.maxIndex) {
50 return 1;
51 }
52 return 0;
53 }
54
55 template <class range_type>
56 class RAK_DLL_EXPORT RangeList
57 {
58 public:
59 RangeList();
60 ~RangeList();
61 void Insert(range_type index);
62 void Clear(void);
63 bool IsWithinRange(range_type value) const;
64 unsigned Size(void) const;
65 unsigned RangeSum(void) const;
66 SLNet::BitSize_t Serialize(SLNet::BitStream *in, SLNet::BitSize_t maxBits, bool clearSerialized);
67 bool Deserialize(SLNet::BitStream *out);
68
69 DataStructures::OrderedList<range_type, RangeNode<range_type> , RangeNodeComp<range_type> > ranges;
70
71 // internal helpers
72 private:
73 static bool DeserializeSingleRange(SLNet::BitStream *out, range_type& min, range_type& max);
74 };
75
76 template <class range_type>
77 SLNet::BitSize_t RangeList<range_type>::Serialize(SLNet::BitStream *in, SLNet::BitSize_t maxBits, bool clearSerialized)
78 {
79 RakAssert(ranges.Size() < (unsigned short)-1);
80 SLNet::BitStream tempBS;
81 SLNet::BitSize_t bitsWritten;
82 unsigned short countWritten;
83 unsigned i;
84 countWritten=0;
85 bitsWritten=0;
86 for (i=0; i < ranges.Size(); i++)
87 {
88 if ((int)sizeof(unsigned short)*8+bitsWritten+(int)sizeof(range_type)*8*2+1>maxBits)
89 break;
90 unsigned char minEqualsMax;
91 if (ranges[i].minIndex==ranges[i].maxIndex)
92 minEqualsMax=1;
93 else
94 minEqualsMax=0;
95 tempBS.Write(minEqualsMax); // Use one byte, intead of one bit, for speed, as this is done a lot
96 tempBS.Write(ranges[i].minIndex);
97 bitsWritten+=sizeof(range_type)*8+8;
98 if (ranges[i].minIndex!=ranges[i].maxIndex)
99 {
100 tempBS.Write(ranges[i].maxIndex);
101 bitsWritten+=sizeof(range_type)*8;
102 }
103 countWritten++;
104 }
105
106 in->AlignWriteToByteBoundary();
107 SLNet::BitSize_t before=in->GetWriteOffset();
108 in->Write(countWritten);
109 bitsWritten+=in->GetWriteOffset()-before;
110 // RAKNET_DEBUG_PRINTF("%i ", in->GetNumberOfBitsUsed());
111 in->Write(&tempBS, tempBS.GetNumberOfBitsUsed());
112 // RAKNET_DEBUG_PRINTF("%i %i \n", tempBS.GetNumberOfBitsUsed(),in->GetNumberOfBitsUsed());
113
114 if (clearSerialized && countWritten)
115 {
116 unsigned rangeSize=ranges.Size();
117 for (i=0; i < rangeSize-countWritten; i++)
118 {
119 ranges[i]=ranges[i+countWritten];
120 }
121 ranges.RemoveFromEnd(countWritten);
122 }
123
124 return bitsWritten;
125 }
126 template <class range_type>
127 bool RangeList<range_type>::Deserialize(SLNet::BitStream *out)
128 {
129 ranges.Clear(true, _FILE_AND_LINE_);
130 unsigned short count;
131 out->AlignReadToByteBoundary();
132 if (!out->Read(count)) {
133 return false;
134 }
135 unsigned short i;
136 range_type absMin;
137 range_type min, max;
138
139 if (count == 0) {
140 return true;
141 }
142
143 if (!DeserializeSingleRange(out, min, max)) {
144 return false;
145 }
146 ranges.InsertAtEnd(RangeNode<range_type>(min, max), _FILE_AND_LINE_);
147
148 for (i = 1; i < count; i++) {
149 absMin = max;
150
151 if (!DeserializeSingleRange(out, min, max)) {
152 return false;
153 }
154 if (min <= absMin) {
155 return false;
156 }
157 ranges.InsertAtEnd(RangeNode<range_type>(min, max), _FILE_AND_LINE_);
158 }
159 return true;
160 }
161
162 template <class range_type>
163 bool RangeList<range_type>::DeserializeSingleRange(SLNet::BitStream *out, range_type& min, range_type& max)
164 {
165 unsigned char maxEqualToMin;
166
167 if (!out->Read(maxEqualToMin)) {
168 return false;
169 }
170 if (!out->Read(min)) {
171 return false;
172 }
173 if (maxEqualToMin == 0) {
174 if (!out->Read(max)) {
175 return false;
176 }
177 if (max <= min) {
178 return false;
179 }
180 } else {
181 max = min;
182 }
183
184 return true;
185 }
186
187 template <class range_type>
188 RangeList<range_type>::RangeList()
189 {
190 RangeNodeComp<range_type>(0, RangeNode<range_type>());
191 }
192
193 template <class range_type>
194 RangeList<range_type>::~RangeList()
195 {
196 Clear();
197 }
198
199 template <class range_type>
200 void RangeList<range_type>::Insert(range_type index)
201 {
202 if (ranges.Size()==0)
203 {
204 ranges.Insert(index, RangeNode<range_type>(index, index), true, _FILE_AND_LINE_);
205 return;
206 }
207
208 bool objectExists;
209 unsigned insertionIndex=ranges.GetIndexFromKey(index, &objectExists);
210 if (objectExists) {
211 return; // index already covered by a range entry - do not create a duplicated entry
212 }
213
214 if (insertionIndex==ranges.Size())
215 {
216 if (index == ranges[insertionIndex-1].maxIndex+(range_type)1)
217 ranges[insertionIndex-1].maxIndex++;
218 else if (index > ranges[insertionIndex-1].maxIndex+(range_type)1)
219 {
220 // Insert at end
221 ranges.Insert(index, RangeNode<range_type>(index, index), true, _FILE_AND_LINE_);
222 }
223
224 return;
225 }
226
227 // verify it's really not within the current range (otherwise objectExists should have been true)
228 RakAssert(index < ranges[insertionIndex].minIndex || index > ranges[insertionIndex].maxIndex);
229
230 if (index < ranges[insertionIndex].minIndex-(range_type)1)
231 {
232 // Insert here
233 ranges.InsertAtIndex(RangeNode<range_type>(index, index), insertionIndex, _FILE_AND_LINE_);
234
235 return;
236 }
237 else if (index == ranges[insertionIndex].minIndex-(range_type)1)
238 {
239 // Decrease minIndex and join left
240 ranges[insertionIndex].minIndex--;
241 if (insertionIndex>0 && ranges[insertionIndex-1].maxIndex+(range_type)1==ranges[insertionIndex].minIndex)
242 {
243 ranges[insertionIndex-1].maxIndex=ranges[insertionIndex].maxIndex;
244 ranges.RemoveAtIndex(insertionIndex);
245 }
246
247 return;
248 }
249
250 if (index == ranges[insertionIndex].maxIndex+(range_type)1)
251 {
252 // Increase maxIndex and join right
253 ranges[insertionIndex].maxIndex++;
254 if (insertionIndex<ranges.Size()-1 && ranges[insertionIndex+(range_type)1].minIndex==ranges[insertionIndex].maxIndex+(range_type)1)
255 {
256 ranges[insertionIndex+1].minIndex=ranges[insertionIndex].minIndex;
257 ranges.RemoveAtIndex(insertionIndex);
258 }
259
260 return;
261 }
262 }
263
264 template <class range_type>
265 void RangeList<range_type>::Clear(void)
266 {
267 ranges.Clear(true, _FILE_AND_LINE_);
268 }
269
270 template <class range_type>
271 bool RangeList<range_type>::IsWithinRange(range_type value) const
272 {
273 bool objectExists;
274 // not interested in the return value
275 (void)ranges.GetIndexFromKey(value, &objectExists);
276 return objectExists;
277 }
278
279 template <class range_type>
280 unsigned RangeList<range_type>::Size(void) const
281 {
282 return ranges.Size();
283 }
284
285 template <class range_type>
286 unsigned RangeList<range_type>::RangeSum(void) const
287 {
288 unsigned sum=0,i;
289 for (i=0; i < ranges.Size(); i++)
290 sum+=ranges[i].maxIndex-ranges[i].minIndex+1;
291 return sum;
292 }
293
294 }
295
296 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TelnetTransport.cpp Source File

  • src
TelnetTransport.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_TelnetTransport==1 && _RAKNET_SUPPORT_TCPInterface==1
18
19 #include "slikenet/TelnetTransport.h"
20 #include "slikenet/TCPInterface.h"
21 #include <stdio.h>
22 #include <string.h>
23 #include <stdarg.h>
24 #include "slikenet/LinuxStrings.h"
25 #include "slikenet/linux_adapter.h"
26 #include "slikenet/osx_adapter.h"
27
28 // #define _PRINTF_DEBUG
29
30 #define ECHO_INPUT
31
32 using namespace SLNet;
33
34 STATIC_FACTORY_DEFINITIONS(TelnetTransport,TelnetTransport);
35
36 TelnetTransport::TelnetTransport()
37 {
38 tcpInterface=0;
39 sendSuffix=0;
40 sendPrefix=0;
41 }
42 TelnetTransport::~TelnetTransport()
43 {
44 Stop();
45 if (sendSuffix)
46 rakFree_Ex(sendSuffix, _FILE_AND_LINE_ );
47 if (sendPrefix)
48 rakFree_Ex(sendPrefix, _FILE_AND_LINE_ );
49 }
50 bool TelnetTransport::Start(unsigned short port, bool serverMode)
51 {
52 (void) serverMode;
53 AutoAllocate();
54 RakAssert(serverMode);
55 return tcpInterface->Start(port, 64);
56 }
57 void TelnetTransport::Stop(void)
58 {
59 if (tcpInterface==0) return;
60 tcpInterface->Stop();
61 unsigned i;
62 for (i=0; i < remoteClients.Size(); i++)
63 SLNet::OP_DELETE(remoteClients[i], _FILE_AND_LINE_);
64 remoteClients.Clear(false, _FILE_AND_LINE_);
65 SLNet::OP_DELETE(tcpInterface, _FILE_AND_LINE_);
66 tcpInterface=0;
67 }
68 void TelnetTransport::Send( SystemAddress systemAddress, const char *data,... )
69 {
70 if (tcpInterface==0) return;
71
72 if (data==0 || data[0]==0)
73 return;
74
75 char text[REMOTE_MAX_TEXT_INPUT];
76 size_t prefixLength;
77 if (sendPrefix)
78 {
79 strcpy_s(text, sendPrefix);
80 prefixLength = strlen(sendPrefix);
81 }
82 else
83 {
84 text[0]=0;
85 prefixLength=0;
86 }
87 va_list ap;
88 va_start(ap, data);
89 vsnprintf_s(text+prefixLength, REMOTE_MAX_TEXT_INPUT-prefixLength, REMOTE_MAX_TEXT_INPUT-prefixLength-1, data, ap);
90 va_end(ap);
91
92 if (sendSuffix)
93 {
94 size_t length = strlen(text);
95 size_t availableChars = REMOTE_MAX_TEXT_INPUT-length-1;
96 strncat_s(text, sendSuffix, availableChars);
97 }
98
99 tcpInterface->Send(text, (unsigned int) strlen(text), systemAddress, false);
100 }
101 void TelnetTransport::CloseConnection( SystemAddress systemAddress )
102 {
103 tcpInterface->CloseConnection(systemAddress);
104 }
105 Packet* TelnetTransport::Receive( void )
106 {
107 if (tcpInterface==0) return 0;
108 Packet *p = tcpInterface->Receive();
109 if (p==0)
110 return 0;
111
112 /*
113 if (p->data[0]==255)
114 {
115 unsigned i;
116 for (i=0; i < p->length; i++)
117 {
118 RAKNET_DEBUG_PRINTF("%i ", p->data[i]);
119 }
120 RAKNET_DEBUG_PRINTF("\n");
121 tcpInterface->DeallocatePacket(p);
122 return 0;
123 }
124 */
125
126 // Get this guy's cursor buffer. This is real bullcrap that I have to do this.
127 unsigned i;
128 TelnetClient *remoteClient=0;
129 for (i=0; i < remoteClients.Size(); i++)
130 {
131 if (remoteClients[i]->systemAddress==p->systemAddress)
132 remoteClient=remoteClients[i];
133 }
134 //RakAssert(remoteClient);
135 if (remoteClient==0)
136 {
137 tcpInterface->DeallocatePacket(p);
138 return 0;
139 }
140
141
142 if (p->length==3 && p->data[0]==27 && p->data[1]==91 && p->data[2]==65)
143 {
144 if (remoteClient->lastSentTextInput[0])
145 {
146 // Up arrow, return last string
147 for (i=0; remoteClient->textInput[i]; i++)
148 remoteClient->textInput[i]=8;
149 strcat_s(remoteClient->textInput, remoteClient->lastSentTextInput);
150 tcpInterface->Send((const char *)remoteClient->textInput, (unsigned int) strlen(remoteClient->textInput), p->systemAddress, false);
151 strcpy_s(remoteClient->textInput,remoteClient->lastSentTextInput);
152 remoteClient->cursorPosition=(unsigned int) strlen(remoteClient->textInput);
153 }
154
155 return 0;
156 }
157
158
159 // 127 is delete - ignore that
160 // 9 is tab
161 // 27 is escape
162 if (p->data[0]>=127 || p->data[0]==9 || p->data[0]==27)
163 {
164 tcpInterface->DeallocatePacket(p);
165 return 0;
166 }
167
168 // Hack - I don't know what the hell this is about but cursor keys send 3 characters at a time. I can block these
169 //Up=27,91,65
170 //Down=27,91,66
171 //Right=27,91,67
172 //Left=27,91,68
173 if (p->length==3 && p->data[0]==27 && p->data[1]==91 && p->data[2]>=65 && p->data[2]<=68)
174 {
175 tcpInterface->DeallocatePacket(p);
176 return 0;
177 }
178
179
180
181 // Echo
182 #ifdef ECHO_INPUT
183 tcpInterface->Send((const char *)p->data, p->length, p->systemAddress, false);
184 #endif
185
186 bool gotLine;
187 // Process each character in turn
188 for (i=0; i < p->length; i++)
189 {
190
191 #ifdef ECHO_INPUT
192 if (p->data[i]==8)
193 {
194 char spaceThenBack[2];
195 spaceThenBack[0]=' ';
196 spaceThenBack[1]=8;
197 tcpInterface->Send((const char *)spaceThenBack, 2, p->systemAddress, false);
198 }
199 #endif
200
201 gotLine=ReassembleLine(remoteClient, p->data[i]);
202 if (gotLine && remoteClient->textInput[0])
203 {
204
205 Packet *reassembledLine = (Packet*) rakMalloc_Ex(sizeof(Packet), _FILE_AND_LINE_);
206 reassembledLine->length=(unsigned int) strlen(remoteClient->textInput);
207 memcpy(remoteClient->lastSentTextInput, remoteClient->textInput, reassembledLine->length+1);
208 RakAssert(reassembledLine->length < REMOTE_MAX_TEXT_INPUT);
209 reassembledLine->data= (unsigned char*) rakMalloc_Ex( reassembledLine->length+1, _FILE_AND_LINE_ );
210 memcpy(reassembledLine->data, remoteClient->textInput, reassembledLine->length);
211 #ifdef _PRINTF_DEBUG
212 memset(remoteClient->textInput, 0, REMOTE_MAX_TEXT_INPUT);
213 #endif
214 reassembledLine->data[reassembledLine->length]=0;
215 reassembledLine->systemAddress=p->systemAddress;
216 tcpInterface->DeallocatePacket(p);
217 return reassembledLine;
218 }
219 }
220
221 tcpInterface->DeallocatePacket(p);
222 return 0;
223 }
224 void TelnetTransport::DeallocatePacket( Packet *packet )
225 {
226 if (tcpInterface==0) return;
227 rakFree_Ex(packet->data, _FILE_AND_LINE_ );
228 rakFree_Ex(packet, _FILE_AND_LINE_ );
229 }
230 SystemAddress TelnetTransport::HasNewIncomingConnection(void)
231 {
232 unsigned i;
233 SystemAddress newConnection;
234 newConnection = tcpInterface->HasNewIncomingConnection();
235 // 03/16/06 Can't force the stupid windows telnet to use line mode or local echo so now I have to track all the remote players and their
236 // input buffer
237 if (newConnection != UNASSIGNED_SYSTEM_ADDRESS)
238 {
239 unsigned char command[10];
240 // http://www.pcmicro.com/netfoss/RFC857.html
241 // IAC WON'T ECHO
242 command[0]=255; // IAC
243 //command[1]=253; // WON'T
244 command[1]=251; // WILL
245 command[2]=1; // ECHO
246 tcpInterface->Send((const char*)command, 3, newConnection, false);
247
248 /*
249 // Tell the other side to use line mode
250 // http://www.faqs.org/rfcs/rfc1184.html
251 // IAC DO LINEMODE
252 // command[0]=255; // IAC
253 // command[1]=252; // DO
254 // command[2]=34; // LINEMODE
255 // tcpInterface->Send((const char*)command, 3, newConnection);
256
257 */
258
259 TelnetClient *remoteClient=0;
260 for (i=0; i < remoteClients.Size(); i++)
261 {
262 if (remoteClients[i]->systemAddress==newConnection)
263 {
264 remoteClient=remoteClients[i];
265 remoteClient->cursorPosition=0;
266 }
267 }
268
269 if (remoteClient==0)
270 {
271 remoteClient=new TelnetClient;
272 remoteClient->lastSentTextInput[0]=0;
273 remoteClient->cursorPosition=0;
274 remoteClient->systemAddress=newConnection;
275 #ifdef _PRINTF_DEBUG
276 memset(remoteClient->textInput, 0, REMOTE_MAX_TEXT_INPUT);
277 #endif
278 }
279
280 remoteClients.Insert(remoteClient, _FILE_AND_LINE_);
281 }
282 return newConnection;
283 }
284 SystemAddress TelnetTransport::HasLostConnection(void)
285 {
286 SystemAddress systemAddress;
287 unsigned i;
288 systemAddress=tcpInterface->HasLostConnection();
289 if (systemAddress!=UNASSIGNED_SYSTEM_ADDRESS)
290 {
291 for (i=0; i < remoteClients.Size(); i++)
292 {
293 if (remoteClients[i]->systemAddress==systemAddress)
294 {
295 SLNet::OP_DELETE(remoteClients[i], _FILE_AND_LINE_);
296 remoteClients[i]=remoteClients[remoteClients.Size()-1];
297 remoteClients.RemoveFromEnd();
298 }
299 }
300 }
301 return systemAddress;
302 }
303 CommandParserInterface* TelnetTransport::GetCommandParser(void)
304 {
305 return 0;
306 }
307 void TelnetTransport::SetSendSuffix(const char *suffix)
308 {
309 if (sendSuffix)
310 {
311 rakFree_Ex(sendSuffix, _FILE_AND_LINE_ );
312 sendSuffix=0;
313 }
314 if (suffix)
315 {
316 sendSuffix = (char*) rakMalloc_Ex(strlen(suffix)+1, _FILE_AND_LINE_);
317 strcpy_s(sendSuffix, strlen(suffix)+1, suffix);
318 }
319 }
320 void TelnetTransport::SetSendPrefix(const char *prefix)
321 {
322 if (sendPrefix)
323 {
324 rakFree_Ex(sendPrefix, _FILE_AND_LINE_ );
325 sendPrefix=0;
326 }
327 if (prefix)
328 {
329 sendPrefix = (char*) rakMalloc_Ex(strlen(prefix)+1, _FILE_AND_LINE_);
330 strcpy_s(sendPrefix, strlen(prefix)+1, prefix);
331 }
332 }
333 void TelnetTransport::AutoAllocate(void)
334 {
335 if (tcpInterface==0)
336 tcpInterface=new TCPInterface;
337 }
338 bool TelnetTransport::ReassembleLine(TelnetTransport::TelnetClient* remoteClient, unsigned char c)
339 {
340 if (c=='\n')
341 {
342 remoteClient->textInput[remoteClient->cursorPosition]=0;
343 remoteClient->cursorPosition=0;
344 #ifdef _PRINTF_DEBUG
345 RAKNET_DEBUG_PRINTF("[Done] %s\n", remoteClient->textInput);
346 #endif
347 return true;
348 }
349 else if (c==8) // backspace
350 {
351 if (remoteClient->cursorPosition>0)
352 {
353 remoteClient->textInput[--remoteClient->cursorPosition]=0;
354 #ifdef _PRINTF_DEBUG
355 RAKNET_DEBUG_PRINTF("[Back] %s\n", remoteClient->textInput);
356 #endif
357 }
358 }
359 else if (c>=32 && c <127)
360 {
361 if (remoteClient->cursorPosition < REMOTE_MAX_TEXT_INPUT)
362 {
363 remoteClient->textInput[remoteClient->cursorPosition++]=c;
364 #ifdef _PRINTF_DEBUG
365 RAKNET_DEBUG_PRINTF("[Norm] %s\n", remoteClient->textInput);
366 #endif
367 }
368 }
369 return false;
370 }
371
372 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • WeightedGraph
DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > Member List

This is the complete list of members for DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >, including all inherited members.

AddConnection(const node_type &node1, const node_type &node2, weight_type weight) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
AddNode(const node_type &node) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
adjacencyLists | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > | protected
Clear(void) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
ClearDijkstra(void) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > | protected
costMatrix | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > | protected
costMatrixIndices | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > | protected
GenerateDisjktraMatrix(node_type startNode, weight_type INFINITE_WEIGHT) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > | protected
GetConnectionAtIndex(unsigned nodeIndex, unsigned connectionIndex, node_type &outNode, weight_type &outWeight) const | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
GetConnectionCount(unsigned nodeIndex) const | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
GetNodeAtIndex(unsigned nodeIndex) const | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
GetNodeCount(void) const | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
GetShortestPath(DataStructures::List< node_type > &path, node_type startNode, node_type endNode, weight_type INFINITE_WEIGHT) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
GetSpanningTree(DataStructures::Tree< node_type > &outTree, DataStructures::List< node_type > *inputNodes, node_type startNode, weight_type INFINITE_WEIGHT) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
HasConnection(const node_type &node1, const node_type &node2) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
IMPLEMENT_DEFAULT_COMPARISON(void) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > | inlinestatic
isValidPath | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > | protected
leastNodeArray | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > | protected
operator=(const WeightedGraph &original_copy) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
Print(void) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
RemoveConnection(const node_type &node1, const node_type &node2) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
RemoveNode(const node_type &node) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
rootNode | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > | protected
WeightedGraph() | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
WeightedGraph(const WeightedGraph &original_copy) | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
~WeightedGraph() | DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Table.h Source File

  • include
  • slikenet
DS_Table.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #ifndef __TABLE_H
21 #define __TABLE_H
22
23 #include "DS_List.h"
24 #include "DS_BPlusTree.h"
25 #include "memoryoverride.h"
26 #include "Export.h"
27 #include "string.h"
28
29 #define _TABLE_BPLUS_TREE_ORDER 16
30 #define _TABLE_MAX_COLUMN_NAME_LENGTH 64
31
34 namespace DataStructures
35 {
36
42 class RAK_DLL_EXPORT Table
43 {
44 public:
45
46 enum ColumnType
47 {
48 // Cell::i used
49 NUMERIC,
50
51 // Cell::c used to hold a null terminated string.
52 STRING,
53
54 // Cell::c holds data. Cell::i holds data length of c in bytes.
55 BINARY,
56
57 // Cell::c holds data. Not deallocated. Set manually by assigning ptr.
58 POINTER,
59 };
60
61
63 // Note: If this structure is changed the struct in the swig files need to be changed as well
64 struct RAK_DLL_EXPORT Cell
65 {
66 Cell();
67 ~Cell();
68 Cell(double numericValue, char *charValue, void *ptr, ColumnType type);
69 void SetByType(double numericValue, char *charValue, void *inPtr, ColumnType type);
70 void Clear(void);
71
73 void Set(int input);
74 void Set(unsigned int input);
75 void Set(double input);
76
78 void Set(const char *input);
79
81 void Set(const char *input, int inputLength);
82
84 void SetPtr(void* p);
85
87 void Get(int *output);
88 void Get(double *output);
89
91 void Get(char *output);
92 void Get(char *output, size_t outputLength);
93
95 void Get(char *output, int *outputLength);
96
97 SLNet::RakString ToString(ColumnType columnType);
98
99 // assignment operator and copy constructor
100 Cell& operator = ( const Cell& input );
101 Cell( const Cell & input);
102
103 ColumnType EstimateColumnType(void) const;
104
105 bool isEmpty;
106 double i;
107 char *c;
108 void *ptr;
109 };
110
113 // Note: If this structure is changed the struct in the swig files need to be changed as well
114 struct RAK_DLL_EXPORT ColumnDescriptor
115 {
116 ColumnDescriptor();
117 ~ColumnDescriptor();
118 ColumnDescriptor(const char cn[_TABLE_MAX_COLUMN_NAME_LENGTH],ColumnType ct);
119
120 char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH];
121 ColumnType columnType;
122 };
123
125 // Note: If this structure is changed the struct in the swig files need to be changed as well
126 struct RAK_DLL_EXPORT Row
127 {
128 // list of cells
129 DataStructures::List<Cell*> cells;
130
132 void UpdateCell(unsigned columnIndex, double value);
133
135 void UpdateCell(unsigned columnIndex, const char *str);
136
138 void UpdateCell(unsigned columnIndex, int byteLength, const char *data);
139 };
140
141 // Operations to perform for cell comparison
142 enum FilterQueryType
143 {
144 QF_EQUAL,
145 QF_NOT_EQUAL,
146 QF_GREATER_THAN,
147 QF_GREATER_THAN_EQ,
148 QF_LESS_THAN,
149 QF_LESS_THAN_EQ,
150 QF_IS_EMPTY,
151 QF_NOT_EMPTY,
152 };
153
154 // Compare the cell value for a row at columnName to the cellValue using operation.
155 // Note: If this structure is changed the struct in the swig files need to be changed as well
156 struct RAK_DLL_EXPORT FilterQuery
157 {
158 FilterQuery();
159 ~FilterQuery();
160 FilterQuery(unsigned column, Cell *cell, FilterQueryType op);
161
162 // If columnName is specified, columnIndex will be looked up using it.
163 char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH];
164 unsigned columnIndex;
165 Cell *cellValue;
166 FilterQueryType operation;
167 };
168
170 enum SortQueryType
171 {
172 QS_INCREASING_ORDER,
173 QS_DECREASING_ORDER,
174 };
175
176 // Sort on increasing or decreasing order for a particular column
177 // Note: If this structure is changed the struct in the swig files need to be changed as well
178 struct RAK_DLL_EXPORT SortQuery
179 {
181 unsigned columnIndex;
182
184 SortQueryType operation;
185 };
186
187 // Constructor
188 Table();
189
190 // Destructor
191 ~Table();
192
197 unsigned AddColumn(const char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH], ColumnType columnType);
198
201 void RemoveColumn(unsigned columnIndex);
202
207 unsigned ColumnIndex(char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH]) const;
208 unsigned ColumnIndex(const char *columnName) const;
209
213 char* ColumnName(unsigned index) const;
214
218 ColumnType GetColumnType(unsigned index) const;
219
222 unsigned GetColumnCount(void) const;
223
226 unsigned GetRowCount(void) const;
227
237 Table::Row* AddRow(unsigned rowId);
238 Table::Row* AddRow(unsigned rowId, DataStructures::List<Cell> &initialCellValues);
239 Table::Row* AddRow(unsigned rowId, DataStructures::List<Cell*> &initialCellValues, bool copyCells=false);
240
244 bool RemoveRow(unsigned rowId);
245
248 void RemoveRows(Table *tableContainingRowIDs);
249
256 bool UpdateCell(unsigned rowId, unsigned columnIndex, int value);
257 bool UpdateCell(unsigned rowId, unsigned columnIndex, char *str);
258 bool UpdateCell(unsigned rowId, unsigned columnIndex, int byteLength, char *data);
259 bool UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, int value);
260 bool UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, char *str);
261 bool UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, int byteLength, char *data);
262
265 void GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, int *output);
266 void GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, char *output);
267 void GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, char *output, size_t outputLength);
268 void GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, char *output, int *outputLength);
269
274 Row* GetRowByID(unsigned rowId) const;
275
281 Row* GetRowByIndex(unsigned rowIndex, unsigned *key) const;
282
291 void QueryTable(unsigned *columnIndicesSubset, unsigned numColumnSubset, FilterQuery *inclusionFilters, unsigned numInclusionFilters, unsigned *rowIds, unsigned numRowIDs, Table *result);
292
300 void SortTable(Table::SortQuery *sortQueries, unsigned numSortQueries, Table::Row** out);
301
303 void Clear(void);
304
309 void PrintColumnHeaders(char *out, int outLength, char columnDelineator) const;
310
317 void PrintRow(char *out, int outLength, char columnDelineator, bool printDelineatorForBinary, Table::Row* inputRow) const;
318
320 const DataStructures::List<ColumnDescriptor>& GetColumns(void) const;
321
323 const DataStructures::BPlusTree<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER>& GetRows(void) const;
324
326 DataStructures::Page<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> * GetListHead(void);
327
330 unsigned GetAvailableRowId(void) const;
331
332 Table& operator = ( const Table& input );
333
334 protected:
335 Table::Row* AddRowColumns(unsigned rowId, Row *row, DataStructures::List<unsigned> columnIndices);
336
337 void DeleteRow(Row *row);
338
339 void QueryRow(DataStructures::List<unsigned> &inclusionFilterColumnIndices, DataStructures::List<unsigned> &columnIndicesToReturn, unsigned key, Table::Row* row, FilterQuery *inclusionFilters, Table *result);
340
341 // 16 is arbitrary and is the order of the BPlus tree. Higher orders are better for searching while lower orders are better for
342 // Insertions and deletions.
343 DataStructures::BPlusTree<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> rows;
344
345 // Columns in the table.
346 DataStructures::List<ColumnDescriptor> columns;
347 };
348 }
349
350 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • NetworkIDManager
SLNet::NetworkIDManager Member List

This is the complete list of members for SLNet::NetworkIDManager, including all inherited members.

Clear(void) | SLNet::NetworkIDManager |
GET_BASE_OBJECT_FROM_ID(NetworkID x) | SLNet::NetworkIDManager |
GET_OBJECT_FROM_ID(NetworkID x) | SLNet::NetworkIDManager | inline
GetNewNetworkID(void) | SLNet::NetworkIDManager | protected
networkIdHash | SLNet::NetworkIDManager | protected
NetworkIDManager() | SLNet::NetworkIDManager |
NetworkIDToHashIndex(NetworkID networkId) | SLNet::NetworkIDManager | protected
startingOffset | SLNet::NetworkIDManager | protected
StopTrackingNetworkIDObject(NetworkIDObject *networkIdObject) | SLNet::NetworkIDManager | protected
TrackNetworkIDObject(NetworkIDObject *networkIdObject) | SLNet::NetworkIDManager | protected
~NetworkIDManager(void) | SLNet::NetworkIDManager | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • CCRakNetSlidingWindow
SLNet::CCRakNetSlidingWindow Member List

This is the complete list of members for SLNet::CCRakNetSlidingWindow, including all inherited members.

_isContinuousSend | SLNet::CCRakNetSlidingWindow | protected
backoffThisBlock | SLNet::CCRakNetSlidingWindow | protected
CCRakNetSlidingWindow() | SLNet::CCRakNetSlidingWindow |
cwnd | SLNet::CCRakNetSlidingWindow | protected
deviationRtt | SLNet::CCRakNetSlidingWindow | protected
estimatedRTT | SLNet::CCRakNetSlidingWindow | protected
expectedNextSequenceNumber | SLNet::CCRakNetSlidingWindow | protected
GetAndIncrementNextDatagramSequenceNumber(void) | SLNet::CCRakNetSlidingWindow |
GetBytesPerSecondLimitByCongestionControl(void) const | SLNet::CCRakNetSlidingWindow |
GetCWNDLimit(void) const | SLNet::CCRakNetSlidingWindow | inline
GetEstimatedBandwidth(void) const | SLNet::CCRakNetSlidingWindow | inline
GetIsInSlowStart(void) const | SLNet::CCRakNetSlidingWindow | inline
GetLinkCapacityBytesPerSecond(void) const | SLNet::CCRakNetSlidingWindow | inline
GetLocalReceiveRate(CCTimeType currentTime) const | SLNet::CCRakNetSlidingWindow |
GetLocalSendRate(void) const | SLNet::CCRakNetSlidingWindow | inline
GetMTU(void) const | SLNet::CCRakNetSlidingWindow |
GetNextDatagramSequenceNumber(void) | SLNet::CCRakNetSlidingWindow |
GetRemoveReceiveRate(void) const | SLNet::CCRakNetSlidingWindow | inline
GetRetransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend) | SLNet::CCRakNetSlidingWindow |
GetRTOForRetransmission(unsigned char timesSent) const | SLNet::CCRakNetSlidingWindow |
GetRTT(void) const | SLNet::CCRakNetSlidingWindow |
GetSenderRTOForACK(void) const | SLNet::CCRakNetSlidingWindow | protected
GetTransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend) | SLNet::CCRakNetSlidingWindow |
GreaterThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b) | SLNet::CCRakNetSlidingWindow | static
Init(CCTimeType curTime, uint32_t maxDatagramPayload) | SLNet::CCRakNetSlidingWindow |
IsInSlowStart(void) const | SLNet::CCRakNetSlidingWindow | protected
lastRtt | SLNet::CCRakNetSlidingWindow | protected
LessThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b) | SLNet::CCRakNetSlidingWindow | static
MAXIMUM_MTU_INCLUDING_UDP_HEADER | SLNet::CCRakNetSlidingWindow | protected
nextCongestionControlBlock | SLNet::CCRakNetSlidingWindow | protected
nextDatagramSequenceNumber | SLNet::CCRakNetSlidingWindow | protected
oldestUnsentAck | SLNet::CCRakNetSlidingWindow | protected
OnAck(CCTimeType curTime, CCTimeType rtt, bool hasBAndAS, BytesPerMicrosecond _B, BytesPerMicrosecond _AS, double totalUserDataBytesAcked, bool isContinuousSend, DatagramSequenceNumberType sequenceNumber) | SLNet::CCRakNetSlidingWindow |
OnDuplicateAck(CCTimeType curTime, DatagramSequenceNumberType sequenceNumber) | SLNet::CCRakNetSlidingWindow |
OnGotPacket(DatagramSequenceNumberType datagramSequenceNumber, bool isContinuousSend, CCTimeType curTime, uint32_t sizeInBytes, uint32_t *skippedMessageCount) | SLNet::CCRakNetSlidingWindow |
OnGotPacketPair(DatagramSequenceNumberType datagramSequenceNumber, uint32_t sizeInBytes, CCTimeType curTime) | SLNet::CCRakNetSlidingWindow |
OnNAK(CCTimeType curTime, DatagramSequenceNumberType nakSequenceNumber) | SLNet::CCRakNetSlidingWindow |
OnResend(CCTimeType curTime, SLNet::TimeUS nextActionTime) | SLNet::CCRakNetSlidingWindow |
OnSendAck(CCTimeType curTime, uint32_t numBytes) | SLNet::CCRakNetSlidingWindow |
OnSendAckGetBAndAS(CCTimeType curTime, bool *hasBAndAS, BytesPerMicrosecond *_B, BytesPerMicrosecond *_AS) | SLNet::CCRakNetSlidingWindow |
OnSendBytes(CCTimeType curTime, uint32_t numBytes) | SLNet::CCRakNetSlidingWindow |
OnSendNACK(CCTimeType curTime, uint32_t numBytes) | SLNet::CCRakNetSlidingWindow |
SetMTU(uint32_t bytes) | SLNet::CCRakNetSlidingWindow |
ShouldSendACKs(CCTimeType curTime, CCTimeType estimatedTimeToNextTick) | SLNet::CCRakNetSlidingWindow |
speedUpThisBlock | SLNet::CCRakNetSlidingWindow | protected
ssThresh | SLNet::CCRakNetSlidingWindow | protected
Update(CCTimeType curTime, bool hasDataToSendOrResend) | SLNet::CCRakNetSlidingWindow |
~CCRakNetSlidingWindow() | SLNet::CCRakNetSlidingWindow |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_PS4.cpp Source File

  • src
RakNetSocket2_PS4.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_PS4_CPP
21 #define RAKNETSOCKET2_PS4_CPP
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 #endif // file header
76
77 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/UDPForwarder.cpp Source File

  • src
UDPForwarder.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/UDPForwarder.h"
17
18 #if _RAKNET_SUPPORT_UDPForwarder==1
19
20 #include "slikenet/GetTime.h"
21 #include "slikenet/MTUSize.h"
22 #include "slikenet/SocketLayer.h"
23 #include "slikenet/WSAStartupSingleton.h"
24 #include "slikenet/sleep.h"
25 #include "slikenet/DS_OrderedList.h"
26 #include "slikenet/LinuxStrings.h"
27 #include "slikenet/SocketDefines.h"
28 #include "slikenet/VitaIncludes.h"
29 #include "errno.h"
30
31 #ifdef _WIN32
32 #include <tchar.h>
33 #else
34 #ifndef _T
35 #define _T(x) (x)
36 #endif
37 #include <sys/types.h> // used for getaddrinfo()
38 #include <sys/socket.h> // used for getaddrinfo()
39 #include <netdb.h> // used for getaddrinfo()
40 #endif
41
42 #ifndef INVALID_SOCKET
43 #define INVALID_SOCKET -1
44 #endif
45
46 using namespace SLNet;
47 static const unsigned short DEFAULT_MAX_FORWARD_ENTRIES=64;
48
49 namespace SLNet
50 {
51 RAK_THREAD_DECLARATION(UpdateUDPForwarderGlobal);
52 }
53
54 UDPForwarder::ForwardEntry::ForwardEntry()
55 {
56 socket=INVALID_SOCKET;
57 timeLastDatagramForwarded= SLNet::GetTimeMS();
58 addr1Confirmed=UNASSIGNED_SYSTEM_ADDRESS;
59 addr2Confirmed=UNASSIGNED_SYSTEM_ADDRESS;
60 }
61 UDPForwarder::ForwardEntry::~ForwardEntry() {
62 if (socket!=INVALID_SOCKET)
63 closesocket__(socket);
64 }
65
66 UDPForwarder::UDPForwarder()
67 {
68 #ifdef _WIN32
69 WSAStartupSingleton::AddRef();
70 #endif
71
72 maxForwardEntries=DEFAULT_MAX_FORWARD_ENTRIES;
73 nextInputId=0;
74 startForwardingInput.SetPageSize(sizeof(StartForwardingInputStruct)*16);
75 stopForwardingCommands.SetPageSize(sizeof(StopForwardingStruct)*16);
76 }
77 UDPForwarder::~UDPForwarder()
78 {
79 Shutdown();
80
81 #ifdef _WIN32
82 WSAStartupSingleton::Deref();
83 #endif
84 }
85 void UDPForwarder::Startup(void)
86 {
87 if (isRunning.GetValue()>0)
88 return;
89
90 isRunning.Increment();
91
92 int errorCode;
93
94
95
96 errorCode = SLNet::RakThread::Create(UpdateUDPForwarderGlobal, this);
97
98 if ( errorCode != 0 )
99 {
100 RakAssert(0);
101 return;
102 }
103
104 while (threadRunning.GetValue()==0)
105 RakSleep(30);
106 }
107 void UDPForwarder::Shutdown(void)
108 {
109 if (isRunning.GetValue()==0)
110 return;
111 isRunning.Decrement();
112
113 while (threadRunning.GetValue()>0)
114 RakSleep(30);
115
116 unsigned int j;
117 for (j=0; j < forwardListNotUpdated.Size(); j++)
118 SLNet::OP_DELETE(forwardListNotUpdated[j],_FILE_AND_LINE_);
119 forwardListNotUpdated.Clear(false, _FILE_AND_LINE_);
120 }
121 void UDPForwarder::SetMaxForwardEntries(unsigned short maxEntries)
122 {
123 RakAssert(maxEntries>0 && maxEntries<65535/2);
124 maxForwardEntries=maxEntries;
125 }
126 int UDPForwarder::GetMaxForwardEntries(void) const
127 {
128 return maxForwardEntries;
129 }
130 int UDPForwarder::GetUsedForwardEntries(void) const
131 {
132 return (int) forwardListNotUpdated.Size();
133 }
134 UDPForwarderResult UDPForwarder::StartForwarding(SystemAddress source, SystemAddress destination, SLNet::TimeMS timeoutOnNoDataMS, const char *forceHostAddress, unsigned short socketFamily,
135 unsigned short *forwardingPort, __UDPSOCKET__ *forwardingSocket)
136 {
137 // Invalid parameters?
138 if (timeoutOnNoDataMS == 0 || timeoutOnNoDataMS > UDP_FORWARDER_MAXIMUM_TIMEOUT || source==UNASSIGNED_SYSTEM_ADDRESS || destination==UNASSIGNED_SYSTEM_ADDRESS)
139 return UDPFORWARDER_INVALID_PARAMETERS;
140
141 if (isRunning.GetValue()==0)
142 return UDPFORWARDER_NOT_RUNNING;
143
144 (void) socketFamily;
145
146 unsigned int inputId = nextInputId++;
147
148 StartForwardingInputStruct *sfis;
149 sfis = startForwardingInput.Allocate(_FILE_AND_LINE_);
150 sfis->source=source;
151 sfis->destination=destination;
152 sfis->timeoutOnNoDataMS=timeoutOnNoDataMS;
153 RakAssert(timeoutOnNoDataMS!=0);
154 if (forceHostAddress && forceHostAddress[0])
155 sfis->forceHostAddress=forceHostAddress;
156 sfis->socketFamily=socketFamily;
157 sfis->inputId=inputId;
158 startForwardingInput.Push(sfis);
159
160 for(;;)
161 {
162 RakSleep(0);
163 startForwardingOutputMutex.Lock();
164 for (unsigned int i=0; i < startForwardingOutput.Size(); i++)
165 {
166 if (startForwardingOutput[i].inputId==inputId)
167 {
168 if (startForwardingOutput[i].result==UDPFORWARDER_SUCCESS)
169 {
170 if (forwardingPort)
171 *forwardingPort = startForwardingOutput[i].forwardingPort;
172 if (forwardingSocket)
173 *forwardingSocket = startForwardingOutput[i].forwardingSocket;
174 }
175 UDPForwarderResult res = startForwardingOutput[i].result;
176 startForwardingOutput.RemoveAtIndex(i);
177 startForwardingOutputMutex.Unlock();
178 return res;
179 }
180 }
181 startForwardingOutputMutex.Unlock();
182 }
183 }
184 void UDPForwarder::StopForwarding(SystemAddress source, SystemAddress destination)
185 {
186 StopForwardingStruct *sfs;
187 sfs = stopForwardingCommands.Allocate(_FILE_AND_LINE_);
188 sfs->destination=destination;
189 sfs->source=source;
190 stopForwardingCommands.Push(sfs);
191 }
192 void UDPForwarder::RecvFrom(SLNet::TimeMS curTime, ForwardEntry *forwardEntry)
193 {
194 #ifndef __native_client__
195 char data[ MAXIMUM_MTU_SIZE ];
196
197 #if RAKNET_SUPPORT_IPV6==1
198 sockaddr_storage their_addr;
199 memset(&their_addr,0,sizeof(their_addr));
200 sockaddr* sockAddrPtr;
201 socklen_t sockLen;
202 socklen_t* socketlenPtr=(socklen_t*) &sockLen;
203 sockaddr_in *sockAddrIn;
204 sockaddr_in6 *sockAddrIn6;
205 sockLen=sizeof(their_addr);
206 sockAddrPtr=(sockaddr*) &their_addr;
207 #else
208 sockaddr_in sockAddrIn;
209 memset(&sockAddrIn,0,sizeof(sockaddr_in));
210 socklen_t len2;
211 len2 = sizeof( sockAddrIn );
212 sockAddrIn.sin_family = AF_INET;
213 #endif
214
215 #if defined(__GNUC__)
216 #if defined(MSG_DONTWAIT)
217 const int flag=MSG_DONTWAIT;
218 #else
219 const int flag=0x40;
220 #endif
221 #else
222 const int flag=0;
223 #endif
224
225 int receivedDataLen, len=0;
226 //unsigned short portnum=0;
227
228 #if RAKNET_SUPPORT_IPV6==1
229 receivedDataLen = recvfrom__( forwardEntry->socket, data, MAXIMUM_MTU_SIZE, flag, sockAddrPtr, socketlenPtr );
230 #else
231 receivedDataLen = recvfrom__( forwardEntry->socket, data, MAXIMUM_MTU_SIZE, flag, ( sockaddr* ) & sockAddrIn, ( socklen_t* ) & len2 );
232 #endif
233
234 if (receivedDataLen<0)
235 {
236 #if defined(_WIN32) && defined(_DEBUG) && !defined(WINDOWS_PHONE_8) && !defined(WINDOWS_STORE_RT)
237 DWORD dwIOError = WSAGetLastError();
238
239 if (dwIOError!=WSAECONNRESET && dwIOError!=WSAEINTR && dwIOError!=WSAETIMEDOUT && dwIOError!=WSAEWOULDBLOCK)
240 {
241 LPTSTR messageBuffer;
242 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
243 NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
244 ( LPTSTR ) & messageBuffer, 0, NULL );
245 // something has gone wrong here...
246 RAKNET_DEBUG_TPRINTF( _T("recvfrom failed:Error code - %lu\n%s"), dwIOError, messageBuffer );
247
248 //Free the buffer.
249 LocalFree( messageBuffer );
250 }
251 #else
252 if (errno!=EAGAIN
253 && errno!=0
254 #if defined(__GNUC__)
255 && errno!=EWOULDBLOCK
256 #endif
257 )
258 {
259 printf("errno=%i\n", errno);
260 }
261 #endif
262
263
264 }
265
266 if (receivedDataLen<=0)
267 return;
268
269 SystemAddress receivedAddr;
270 #if RAKNET_SUPPORT_IPV6==1
271 if (their_addr.ss_family==AF_INET)
272 {
273 sockAddrIn=(sockaddr_in *)&their_addr;
274 sockAddrIn6=0;
275 memcpy(&receivedAddr.address.addr4,sockAddrIn,sizeof(sockaddr_in));
276 }
277 else
278 {
279 sockAddrIn=0;
280 sockAddrIn6=(sockaddr_in6 *)&their_addr;
281 memcpy(&receivedAddr.address.addr6,sockAddrIn6,sizeof(sockaddr_in6));
282 }
283 #else
284 memcpy(&receivedAddr.address.addr4,&sockAddrIn,sizeof(sockaddr_in));
285 #endif
286 //portnum=receivedAddr.GetPort();
287
288 SystemAddress forwardTarget;
289
290 bool confirmed1 = forwardEntry->addr1Confirmed!=UNASSIGNED_SYSTEM_ADDRESS;
291 bool confirmed2 = forwardEntry->addr2Confirmed!=UNASSIGNED_SYSTEM_ADDRESS;
292 bool matchConfirmed1 =
293 confirmed1 &&
294 forwardEntry->addr1Confirmed==receivedAddr;
295 bool matchConfirmed2 =
296 confirmed2 &&
297 forwardEntry->addr2Confirmed==receivedAddr;
298 bool matchUnconfirmed1 = forwardEntry->addr1Unconfirmed.EqualsExcludingPort(receivedAddr);
299 bool matchUnconfirmed2 = forwardEntry->addr2Unconfirmed.EqualsExcludingPort(receivedAddr);
300
301 if (matchConfirmed1==true || (matchConfirmed2==false && confirmed1==false && matchUnconfirmed1==true))
302 {
303 // Forward to addr2
304 if (forwardEntry->addr1Confirmed==UNASSIGNED_SYSTEM_ADDRESS)
305 {
306 forwardEntry->addr1Confirmed=receivedAddr;
307 }
308 if (forwardEntry->addr2Confirmed!=UNASSIGNED_SYSTEM_ADDRESS)
309 forwardTarget=forwardEntry->addr2Confirmed;
310 else
311 forwardTarget=forwardEntry->addr2Unconfirmed;
312 }
313 else if (matchConfirmed2==true || (confirmed2==false && matchUnconfirmed2==true))
314 {
315 // Forward to addr1
316 if (forwardEntry->addr2Confirmed==UNASSIGNED_SYSTEM_ADDRESS)
317 {
318 forwardEntry->addr2Confirmed=receivedAddr;
319 }
320 if (forwardEntry->addr1Confirmed!=UNASSIGNED_SYSTEM_ADDRESS)
321 forwardTarget=forwardEntry->addr1Confirmed;
322 else
323 forwardTarget=forwardEntry->addr1Unconfirmed;
324 }
325 else
326 {
327 return;
328 }
329
330 // Forward to dest
331 len=0;
332 // sockaddr_in saOut;
333 // saOut.sin_port = forwardTarget.GetPortNetworkOrder(); // User port
334 // saOut.sin_addr.s_addr = forwardTarget.address.addr4.sin_addr.s_addr;
335 // saOut.sin_family = AF_INET;
336 do
337 {
338
339
340
341 #if RAKNET_SUPPORT_IPV6==1
342 if (forwardTarget.address.addr4.sin_family==AF_INET)
343 {
344 do
345 {
346 len = sendto__( forwardEntry->socket, data, receivedDataLen, 0, ( const sockaddr* ) & forwardTarget.address.addr4, sizeof( sockaddr_in ) );
347 }
348 while ( len == 0 );
349 }
350 else
351 {
352 do
353 {
354 len = sendto__( forwardEntry->socket, data, receivedDataLen, 0, ( const sockaddr* ) & forwardTarget.address.addr6, sizeof( sockaddr_in6 ) );
355 }
356 while ( len == 0 );
357 }
358 #else
359 do
360 {
361 len = sendto__( forwardEntry->socket, data, receivedDataLen, 0, ( const sockaddr* ) & forwardTarget.address.addr4, sizeof( sockaddr_in ) );
362 }
363 while ( len == 0 );
364 #endif
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395 }
396 while ( len == 0 );
397
398 forwardEntry->timeLastDatagramForwarded=curTime;
399 #endif // __native_client__
400 }
401 void UDPForwarder::UpdateUDPForwarder(void)
402 {
403 /*
404 #if !defined(SN_TARGET_PSP2)
405 timeval tv;
406 tv.tv_sec=0;
407 tv.tv_usec=0;
408 #endif
409 */
410
411 SLNet::TimeMS curTime = SLNet::GetTimeMS();
412
413 StartForwardingInputStruct *sfis;
414 StartForwardingOutputStruct sfos;
415 sfos.forwardingSocket=INVALID_SOCKET;
416 sfos.forwardingPort=0;
417 sfos.inputId=0;
418 sfos.result=UDPFORWARDER_RESULT_COUNT;
419
420 for(;;)
421 {
422 sfis = startForwardingInput.Pop();
423 if (sfis==0)
424 break;
425
426 if (GetUsedForwardEntries()>maxForwardEntries)
427 {
428 sfos.result=UDPFORWARDER_NO_SOCKETS;
429 }
430 else
431 {
432 sfos.result=UDPFORWARDER_RESULT_COUNT;
433
434 for (unsigned int i=0; i < forwardListNotUpdated.Size(); i++)
435 {
436 if (
437 (forwardListNotUpdated[i]->addr1Unconfirmed==sfis->source &&
438 forwardListNotUpdated[i]->addr2Unconfirmed==sfis->destination)
439 ||
440 (forwardListNotUpdated[i]->addr1Unconfirmed==sfis->destination &&
441 forwardListNotUpdated[i]->addr2Unconfirmed==sfis->source)
442 )
443 {
444 ForwardEntry *fe = forwardListNotUpdated[i];
445 sfos.forwardingPort = SocketLayer::GetLocalPort ( fe->socket );
446 sfos.forwardingSocket=fe->socket;
447 sfos.result=UDPFORWARDER_FORWARDING_ALREADY_EXISTS;
448 break;
449 }
450 }
451
452 if (sfos.result==UDPFORWARDER_RESULT_COUNT)
453 {
454 int sock_opt;
455 sockaddr_in listenerSocketAddress;
456 listenerSocketAddress.sin_port = 0;
457 ForwardEntry *fe = SLNet::OP_NEW<UDPForwarder::ForwardEntry>(_FILE_AND_LINE_);
458 fe->addr1Unconfirmed=sfis->source;
459 fe->addr2Unconfirmed=sfis->destination;
460 fe->timeoutOnNoDataMS=sfis->timeoutOnNoDataMS;
461
462 #if RAKNET_SUPPORT_IPV6!=1
463 fe->socket = socket__( AF_INET, SOCK_DGRAM, 0 );
464 listenerSocketAddress.sin_family = AF_INET;
465 if (sfis->forceHostAddress.IsEmpty()==false)
466 {
467
468
469
470
471 inet_pton(AF_INET, sfis->forceHostAddress.C_String(), &listenerSocketAddress.sin_addr.s_addr);
472
473 }
474 else
475 {
476 listenerSocketAddress.sin_addr.s_addr = INADDR_ANY;
477 }
478 int ret = bind__( fe->socket, ( struct sockaddr * ) & listenerSocketAddress, sizeof( listenerSocketAddress ) );
479 if (ret==-1)
480 {
481 SLNet::OP_DELETE(fe,_FILE_AND_LINE_);
482 sfos.result=UDPFORWARDER_BIND_FAILED;
483 }
484 else
485 {
486 sfos.result=UDPFORWARDER_SUCCESS;
487 }
488
489 #else // RAKNET_SUPPORT_IPV6==1
490 struct addrinfo hints;
491 memset(&hints, 0, sizeof (addrinfo)); // make sure the struct is empty
492 hints.ai_family = sfis->socketFamily;
493 hints.ai_socktype = SOCK_DGRAM; // UDP sockets
494 hints.ai_flags = AI_PASSIVE; // fill in my IP for me
495 struct addrinfo *servinfo=0, *aip; // will point to the results
496
497 if (sfis->forceHostAddress.IsEmpty() || sfis->forceHostAddress=="UNASSIGNED_SYSTEM_ADDRESS")
498 getaddrinfo(0, "0", &hints, &servinfo);
499 else
500 getaddrinfo(sfis->forceHostAddress.C_String(), "0", &hints, &servinfo);
501
502 for (aip = servinfo; aip != NULL; aip = aip->ai_next)
503 {
504 // Open socket. The address type depends on what
505 // getaddrinfo() gave us.
506 fe->socket = socket__(aip->ai_family, aip->ai_socktype, aip->ai_protocol);
507 if (fe->socket != INVALID_SOCKET)
508 {
509 int ret = bind__( fe->socket, aip->ai_addr, (int) aip->ai_addrlen );
510 if (ret>=0)
511 {
512 break;
513 }
514 else
515 {
516 closesocket__(fe->socket);
517 fe->socket=INVALID_SOCKET;
518 }
519 }
520 }
521
522 if (fe->socket==INVALID_SOCKET)
523 sfos.result=UDPFORWARDER_BIND_FAILED;
524 else
525 sfos.result=UDPFORWARDER_SUCCESS;
526 #endif // RAKNET_SUPPORT_IPV6==1
527
528 if (sfos.result==UDPFORWARDER_SUCCESS)
529 {
530 sfos.forwardingPort = SocketLayer::GetLocalPort ( fe->socket );
531 sfos.forwardingSocket=fe->socket;
532
533 sock_opt=1024*256;
534 setsockopt__(fe->socket, SOL_SOCKET, SO_RCVBUF, ( char * ) & sock_opt, sizeof ( sock_opt ) );
535 sock_opt=0;
536 setsockopt__(fe->socket, SOL_SOCKET, SO_LINGER, ( char * ) & sock_opt, sizeof ( sock_opt ) );
537 #ifdef _WIN32
538 unsigned long nonblocking = 1;
539 ioctlsocket__( fe->socket, FIONBIO, &nonblocking );
540
541
542
543 #else
544 fcntl( fe->socket, F_SETFL, O_NONBLOCK );
545 #endif
546
547 forwardListNotUpdated.Insert(fe,_FILE_AND_LINE_);
548 }
549 }
550 }
551
552 // Push result
553 sfos.inputId=sfis->inputId;
554 startForwardingOutputMutex.Lock();
555 startForwardingOutput.Push(sfos,_FILE_AND_LINE_);
556 startForwardingOutputMutex.Unlock();
557
558 startForwardingInput.Deallocate(sfis, _FILE_AND_LINE_);
559 }
560
561 StopForwardingStruct *sfs;
562
563 for(;;)
564 {
565 sfs = stopForwardingCommands.Pop();
566 if (sfs==0)
567 break;
568
569 ForwardEntry *fe;
570 for (unsigned int i=0; i < forwardListNotUpdated.Size(); i++)
571 {
572 if (
573 (forwardListNotUpdated[i]->addr1Unconfirmed==sfs->source &&
574 forwardListNotUpdated[i]->addr2Unconfirmed==sfs->destination)
575 ||
576 (forwardListNotUpdated[i]->addr1Unconfirmed==sfs->destination &&
577 forwardListNotUpdated[i]->addr2Unconfirmed==sfs->source)
578 )
579 {
580 fe = forwardListNotUpdated[i];
581 forwardListNotUpdated.RemoveAtIndexFast(i);
582 SLNet::OP_DELETE(fe, _FILE_AND_LINE_);
583 break;
584 }
585 }
586
587 stopForwardingCommands.Deallocate(sfs, _FILE_AND_LINE_);
588 }
589
590 unsigned int i;
591
592 i=0;
593 while (i < forwardListNotUpdated.Size())
594 {
595 if (curTime > forwardListNotUpdated[i]->timeLastDatagramForwarded && // Account for timestamp wrap
596 curTime > forwardListNotUpdated[i]->timeLastDatagramForwarded+forwardListNotUpdated[i]->timeoutOnNoDataMS)
597 {
598 SLNet::OP_DELETE(forwardListNotUpdated[i],_FILE_AND_LINE_);
599 forwardListNotUpdated.RemoveAtIndex(i);
600 }
601 else
602 i++;
603 }
604
605 ForwardEntry *forwardEntry;
606 for (i=0; i < forwardListNotUpdated.Size(); i++)
607 {
608 forwardEntry = forwardListNotUpdated[i];
609 RecvFrom(curTime, forwardEntry);
610 }
611 }
612
613 namespace SLNet {
614 RAK_THREAD_DECLARATION(UpdateUDPForwarderGlobal)
615 {
616
617
618
619 UDPForwarder * udpForwarder = ( UDPForwarder * ) arguments;
620
621
622 udpForwarder->threadRunning.Increment();
623 while (udpForwarder->isRunning.GetValue()>0)
624 {
625 udpForwarder->UpdateUDPForwarder();
626
627 // 12/1/2010 Do not change from 0
628 // See http://www.jenkinssoftware.com/forum/index.php?topic=4033.0;topicseen
629 // Avoid 100% reported CPU usage
630 if (udpForwarder->forwardListNotUpdated.Size()==0)
631 RakSleep(30);
632 else
633 RakSleep(0);
634 }
635 udpForwarder->threadRunning.Decrement();
636
637
638
639
640 return 0;
641
642
643 }
644
645 } // namespace SLNet
646
647 #endif // #if _RAKNET_SUPPORT_FileOperations==1
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetTypes.cpp Source File

  • src
RakNetTypes.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #include "slikenet/types.h"
21 #include "slikenet/assert.h"
22 #include <string.h>
23 #include <stdio.h>
24 #include "slikenet/WindowsIncludes.h"
25 #include "slikenet/WSAStartupSingleton.h"
26 #include "slikenet/SocketDefines.h"
27 #include "slikenet/socket2.h"
28
29
30 #if defined(_WIN32)
31 // extern __int64 _strtoui64(const char*, char**, int); // needed for Code::Blocks. Does not compile on Visual Studio 2010
32 // IP_DONTFRAGMENT is different between winsock 1 and winsock 2. Therefore, Winsock2.h must be linked againt Ws2_32.lib
33 // winsock.h must be linked against WSock32.lib. If these two are mixed up the flag won't work correctly
34 #include "slikenet/WindowsIncludes.h"
35
36 #else
37 #include <sys/socket.h> // used for getnameinfo()
38 #include <netdb.h> // used for getnameinfo()
39 #include <netinet/in.h>
40 #include <arpa/inet.h>
41 #endif
42
43 #include "slikenet/Itoa.h"
44 #include "slikenet/SocketLayer.h"
45 #include "slikenet/SuperFastHash.h"
46 #include <stdlib.h>
47 #include "slikenet/linux_adapter.h"
48 #include "slikenet/osx_adapter.h"
49
50 using namespace SLNet;
51
52 const char *IPV6_LOOPBACK="::1";
53 const char *IPV4_LOOPBACK="127.0.0.1";
54
55 AddressOrGUID::AddressOrGUID( Packet *packet )
56 {
57 rakNetGuid=packet->guid;
58 systemAddress=packet->systemAddress;
59 }
60
61 unsigned long AddressOrGUID::ToInteger( const AddressOrGUID &aog )
62 {
63 if (aog.rakNetGuid!=UNASSIGNED_RAKNET_GUID)
64 return RakNetGUID::ToUint32(aog.rakNetGuid);
65 return SystemAddress::ToInteger(aog.systemAddress);
66 }
67 const char *AddressOrGUID::ToString(bool writePort) const
68 {
69 if (rakNetGuid!=UNASSIGNED_RAKNET_GUID)
70 return rakNetGuid.ToString();
71 return systemAddress.ToString(writePort);
72 }
73 void AddressOrGUID::ToString(bool writePort, char *dest) const
74 {
75 if (rakNetGuid != UNASSIGNED_RAKNET_GUID)
76 return rakNetGuid.ToString(dest);
77 return systemAddress.ToString(writePort, dest);
78 }
79 void AddressOrGUID::ToString(bool writePort, char *dest, size_t destLength) const
80 {
81 if (rakNetGuid!=UNASSIGNED_RAKNET_GUID)
82 return rakNetGuid.ToString(dest,destLength);
83 return systemAddress.ToString(writePort,dest,destLength);
84 }
85 bool SLNet::NonNumericHostString( const char *host )
86 {
87 // Return false if IP address. Return true if domain
88 unsigned int i=0;
89 while (host[i])
90 {
91 // IPV4: natpunch.jenkinssoftware.com
92 // IPV6: fe80::7c:31f7:fec4:27de%14
93 if ((host[i]>='g' && host[i]<='z') ||
94 (host[i]>='G' && host[i]<='Z'))
95 return true;
96 ++i;
97 }
98 return false;
99 }
100
101 SocketDescriptor::SocketDescriptor() {
102 #ifdef __native_client__
103 blockingSocket=false;
104 #else
105 blockingSocket=true;
106 #endif
107 port=0; hostAddress[0]=0; remotePortRakNetWasStartedOn_PS3_PSP2=0; extraSocketOptions=0; socketFamily=AF_INET;}
108 SocketDescriptor::SocketDescriptor(unsigned short _port, const char *_hostAddress)
109 {
110 #ifdef __native_client__
111 blockingSocket=false;
112 #else
113 blockingSocket=true;
114 #endif
115 remotePortRakNetWasStartedOn_PS3_PSP2=0;
116 port=_port;
117 if (_hostAddress)
118 strcpy_s(hostAddress, _hostAddress);
119 else
120 hostAddress[0]=0;
121 extraSocketOptions=0;
122 socketFamily=AF_INET;
123 }
124
125 // Defaults to not in peer to peer mode for NetworkIDs. This only sends the localSystemAddress portion in the BitStream class
126 // This is what you want for client/server, where the server assigns all NetworkIDs and it is unnecessary to transmit the full structure.
127 // For peer to peer, this will transmit the systemAddress of the system that created the object in addition to localSystemAddress. This allows
128 // Any system to create unique ids locally.
129 // All systems must use the same value for this variable.
130 //bool RAK_DLL_EXPORT NetworkID::peerToPeerMode=false;
131
132 SystemAddress& SystemAddress::operator = ( const SystemAddress& input )
133 {
134 memcpy(&address, &input.address, sizeof(address));
135 systemIndex = input.systemIndex;
136 debugPort = input.debugPort;
137 return *this;
138 }
139 bool SystemAddress::EqualsExcludingPort( const SystemAddress& right ) const
140 {
141 return (address.addr4.sin_family==AF_INET && address.addr4.sin_addr.s_addr==right.address.addr4.sin_addr.s_addr)
142 #if RAKNET_SUPPORT_IPV6==1
143 || (address.addr4.sin_family==AF_INET6 && memcmp(address.addr6.sin6_addr.s6_addr, right.address.addr6.sin6_addr.s6_addr, sizeof(address.addr6.sin6_addr.s6_addr))==0)
144 #endif
145 ;
146 }
147 unsigned short SystemAddress::GetPort(void) const
148 {
149 return ntohs(address.addr4.sin_port);
150 }
151 unsigned short SystemAddress::GetPortNetworkOrder(void) const
152 {
153 return address.addr4.sin_port;
154 }
155 void SystemAddress::SetPortHostOrder(unsigned short s)
156 {
157 address.addr4.sin_port=htons(s);
158 debugPort=s;
159 }
160 void SystemAddress::SetPortNetworkOrder(unsigned short s)
161 {
162 address.addr4.sin_port=s;
163 debugPort=ntohs(s);
164 }
165 bool SystemAddress::operator==( const SystemAddress& right ) const
166 {
167 return address.addr4.sin_port == right.address.addr4.sin_port && EqualsExcludingPort(right);
168 }
169
170 bool SystemAddress::operator!=( const SystemAddress& right ) const
171 {
172 return (*this==right)==false;
173 }
174
175 bool SystemAddress::operator>( const SystemAddress& right ) const
176 {
177 if (address.addr4.sin_port == right.address.addr4.sin_port)
178 {
179 #if RAKNET_SUPPORT_IPV6==1
180 if (address.addr4.sin_family==AF_INET)
181 return address.addr4.sin_addr.s_addr>right.address.addr4.sin_addr.s_addr;
182 return memcmp(address.addr6.sin6_addr.s6_addr, right.address.addr6.sin6_addr.s6_addr, sizeof(address.addr6.sin6_addr.s6_addr))>0;
183 #else
184 return address.addr4.sin_addr.s_addr>right.address.addr4.sin_addr.s_addr;
185 #endif
186 }
187 return address.addr4.sin_port>right.address.addr4.sin_port;
188 }
189
190 bool SystemAddress::operator<( const SystemAddress& right ) const
191 {
192 if (address.addr4.sin_port == right.address.addr4.sin_port)
193 {
194 #if RAKNET_SUPPORT_IPV6==1
195 if (address.addr4.sin_family==AF_INET)
196 return address.addr4.sin_addr.s_addr<right.address.addr4.sin_addr.s_addr;
197 return memcmp(address.addr6.sin6_addr.s6_addr, right.address.addr6.sin6_addr.s6_addr, sizeof(address.addr6.sin6_addr.s6_addr))>0;
198 #else
199 return address.addr4.sin_addr.s_addr<right.address.addr4.sin_addr.s_addr;
200 #endif
201 }
202 return address.addr4.sin_port<right.address.addr4.sin_port;
203 }
204 int SystemAddress::size(void)
205 {
206 #if RAKNET_SUPPORT_IPV6==1
207 return sizeof(sockaddr_in6) + sizeof(char);
208 #else
209 return sizeof(uint32_t) + sizeof(unsigned short) + sizeof(char);
210 #endif
211 }
212 unsigned long SystemAddress::ToInteger( const SystemAddress &sa )
213 {
214 unsigned int lastHash = SuperFastHashIncremental ((const char*) & sa.address.addr4.sin_port, sizeof(sa.address.addr4.sin_port), sizeof(sa.address.addr4.sin_port) );
215 #if RAKNET_SUPPORT_IPV6==1
216 if (sa.address.addr4.sin_family==AF_INET)
217 return SuperFastHashIncremental ((const char*) & sa.address.addr4.sin_addr.s_addr, sizeof(sa.address.addr4.sin_addr.s_addr), lastHash );
218 else
219 return SuperFastHashIncremental ((const char*) & sa.address.addr6.sin6_addr.s6_addr, sizeof(sa.address.addr6.sin6_addr.s6_addr), lastHash );
220 #else
221 return SuperFastHashIncremental ((const char*) & sa.address.addr4.sin_addr.s_addr, sizeof(sa.address.addr4.sin_addr.s_addr), lastHash );
222 #endif
223 }
224 unsigned char SystemAddress::GetIPVersion(void) const
225 {
226 if (address.addr4.sin_family==AF_INET)
227 return 4;
228 return 6;
229 }
230 unsigned int SystemAddress::GetIPPROTO(void) const
231 {
232 #if RAKNET_SUPPORT_IPV6==1
233 if (address.addr4.sin_family==AF_INET)
234 return IPPROTO_IP;
235 return IPPROTO_IPV6;
236 #else
237 return IPPROTO_IP;
238 #endif
239 }
240 void SystemAddress::SetToLoopback(void)
241 {
242 SetToLoopback(GetIPVersion());
243 }
244 void SystemAddress::SetToLoopback(unsigned char ipVersion)
245 {
246 if (ipVersion==4)
247 {
248 FromString(IPV4_LOOPBACK, 0, ipVersion);
249 }
250 else
251 {
252 FromString(IPV6_LOOPBACK, 0, ipVersion);
253 }
254 }
255 bool SystemAddress::IsLoopback(void) const
256 {
257 if (GetIPVersion()==4)
258 {
259 // unsigned long l = htonl(address.addr4.sin_addr.s_addr);
260 if (htonl(address.addr4.sin_addr.s_addr)==2130706433)
261 return true;
262 if (address.addr4.sin_addr.s_addr==0)
263 return true;
264 }
265 #if RAKNET_SUPPORT_IPV6==1
266 else
267 {
268 const static char localhost[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
269 if (memcmp(&address.addr6.sin6_addr, localhost, 16)==0)
270 return true;
271 }
272 #endif
273 return false;
274 }
275 void SystemAddress::ToString_Old(bool writePort, char *dest, char portDelineator) const
276 {
277 if (*this == UNASSIGNED_SYSTEM_ADDRESS)
278 {
279 #pragma warning(push)
280 #pragma warning(disable:4996)
281 strcpy(dest, "UNASSIGNED_SYSTEM_ADDRESS");
282 #pragma warning(pop)
283 return;
284 }
285
286 char portStr[2];
287 portStr[0] = portDelineator;
288 portStr[1] = 0;
289
290 in_addr in;
291 in.s_addr = address.addr4.sin_addr.s_addr;
292 char buf[1024];
293 inet_ntop(AF_INET, &in, buf, 1024);
294 #pragma warning(push)
295 #pragma warning(disable:4996)
296 strcpy(dest, buf);
297 #pragma warning(pop)
298 if (writePort)
299 {
300 #pragma warning(push)
301 #pragma warning(disable:4996)
302 strcat(dest, portStr);
303 #pragma warning(pop)
304 Itoa(GetPort(), dest + strlen(dest), 10);
305 }
306 }
307
308 void SystemAddress::ToString_Old(bool writePort, char *dest, size_t destLength, char portDelineator) const
309 {
310 if (*this==UNASSIGNED_SYSTEM_ADDRESS)
311 {
312 strcpy_s(dest, destLength, "UNASSIGNED_SYSTEM_ADDRESS");
313 return;
314 }
315
316 char portStr[2];
317 portStr[0]=portDelineator;
318 portStr[1]=0;
319
320 in_addr in;
321 in.s_addr = address.addr4.sin_addr.s_addr;
322 inet_ntop(AF_INET, &in, dest, destLength);
323 if (writePort)
324 {
325 strcat_s(dest, destLength, portStr);
326 Itoa(GetPort(), dest+strlen(dest), 10);
327 }
328
329 }
330 const char *SystemAddress::ToString(bool writePort, char portDelineator) const
331 {
332 static unsigned char strIndex=0;
333 #if RAKNET_SUPPORT_IPV6==1
334 static const size_t strLength=INET6_ADDRSTRLEN+5+1;
335 #else
336 static const size_t strLength=22+5+1;
337 #endif
338 static char str[8][strLength];
339
340 unsigned char lastStrIndex=strIndex;
341 strIndex++;
342 ToString(writePort, str[lastStrIndex&7], strLength, portDelineator);
343 return (char*) str[lastStrIndex&7];
344 }
345 #if RAKNET_SUPPORT_IPV6==1
346 void SystemAddress::ToString_New(bool writePort, char *dest, char portDelineator) const
347 {
348 int ret;
349 (void)ret;
350
351 if (*this == UNASSIGNED_SYSTEM_ADDRESS)
352 {
353 #pragma warning(push)
354 #pragma warning(disable:4996)
355 strcpy(dest, "UNASSIGNED_SYSTEM_ADDRESS");
356 #pragma warning(pop)
357 return;
358 }
359
360 if (address.addr4.sin_family == AF_INET)
361 {
362 ret = getnameinfo((struct sockaddr *) &address.addr4, sizeof(struct sockaddr_in), dest, 22, NULL, 0, NI_NUMERICHOST);
363 }
364 else
365 {
366 ret = getnameinfo((struct sockaddr *) &address.addr6, sizeof(struct sockaddr_in6), dest, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
367 }
368 if (ret != 0)
369 {
370 dest[0] = 0;
371 }
372
373 if (writePort)
374 {
375 unsigned char ch[2];
376 ch[0] = portDelineator;
377 ch[1] = 0;
378 #pragma warning(push)
379 #pragma warning(disable:4996)
380 strcat(dest, (const char*)ch);
381 #pragma warning(pop)
382 Itoa(ntohs(address.addr4.sin_port), dest + strlen(dest), 10);
383 }
384 }
385 void SystemAddress::ToString_New(bool writePort, char *dest, size_t destLength, char portDelineator) const
386 {
387 int ret;
388 (void) ret;
389
390 if (*this==UNASSIGNED_SYSTEM_ADDRESS)
391 {
392 strcpy_s(dest, destLength, "UNASSIGNED_SYSTEM_ADDRESS");
393 return;
394 }
395
396 if (address.addr4.sin_family==AF_INET)
397 {
398 ret=getnameinfo((struct sockaddr *) &address.addr4, sizeof(struct sockaddr_in), dest, 22, NULL, 0, NI_NUMERICHOST);
399 }
400 else
401 {
402 ret=getnameinfo((struct sockaddr *) &address.addr6, sizeof(struct sockaddr_in6), dest, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
403 }
404 if (ret!=0)
405 {
406 dest[0]=0;
407 }
408
409 if (writePort)
410 {
411 unsigned char ch[2];
412 ch[0]=portDelineator;
413 ch[1]=0;
414 strcat_s(dest, destLength, (const char*) ch);
415 Itoa(ntohs(address.addr4.sin_port), dest+strlen(dest), 10);
416 }
417 }
418 #endif // #if RAKNET_SUPPORT_IPV6!=1
419 void SystemAddress::ToString(bool writePort, char *dest, char portDelineator) const
420 {
421 #if RAKNET_SUPPORT_IPV6!=1
422 ToString_Old(writePort, dest, portDelineator);
423 #else
424 ToString_New(writePort, dest, portDelineator);
425 #endif // #if RAKNET_SUPPORT_IPV6!=1
426 }
427 void SystemAddress::ToString(bool writePort, char *dest, size_t destLength, char portDelineator) const
428 {
429
430 #if RAKNET_SUPPORT_IPV6!=1
431 ToString_Old(writePort,dest,destLength,portDelineator);
432 #else
433 ToString_New(writePort,dest,destLength,portDelineator);
434 #endif // #if RAKNET_SUPPORT_IPV6!=1
435 }
436 SystemAddress::SystemAddress()
437 {
438 address.addr4.sin_family=AF_INET;
439 // used for operator ==
440 memset(&address,0,sizeof(address)); address.addr4.sin_family=AF_INET;
441 systemIndex=(SystemIndex)-1;
442 debugPort=0;
443 }
444 SystemAddress::SystemAddress(const char *str)
445 {
446 address.addr4.sin_family=AF_INET;
447 SetPortHostOrder(0);
448 FromString(str);
449 systemIndex=(SystemIndex)-1;
450 }
451 SystemAddress::SystemAddress(const char *str, unsigned short port)
452 {
453 address.addr4.sin_family=AF_INET;
454 FromStringExplicitPort(str,port);
455 systemIndex=(SystemIndex)-1;
456 }
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495 void SystemAddress::FixForIPVersion(const SystemAddress &boundAddressToSocket)
496 {
497 char str[128];
498 ToString(false,str,static_cast<size_t>(128));
499 // TODO - what about 255.255.255.255?
500 if (strcmp(str, IPV6_LOOPBACK)==0)
501 {
502 if (boundAddressToSocket.GetIPVersion()==4)
503 {
504 FromString(IPV4_LOOPBACK,0,4);
505 }
506 }
507 else if (strcmp(str, IPV4_LOOPBACK)==0)
508 {
509 #if RAKNET_SUPPORT_IPV6==1
510 if (boundAddressToSocket.GetIPVersion()==6)
511 {
512 FromString(IPV6_LOOPBACK,0,6);
513 }
514 #endif
515
516 // if (boundAddressToSocket.GetIPVersion()==4)
517 // {
518 // // Some kind of bug with sendto: returns "The requested address is not valid in its context." if loopback doesn't have the same IP address
519 // address.addr4.sin_addr.s_addr=boundAddressToSocket.address.addr4.sin_addr.s_addr;
520 // }
521 }
522 }
523 bool SystemAddress::IsLANAddress(void)
524 {
525 // return address.addr4.sin_addr.S_un.S_un_b.s_b1==10 || address.addr4.sin_addr.S_un.s_b1==192;
526 #if defined(__WIN32__)
527 return address.addr4.sin_addr.S_un.S_un_b.s_b1==10 || address.addr4.sin_addr.S_un.S_un_b.s_b1==192;
528 #else
529 return (address.addr4.sin_addr.s_addr >> 24) == 10 || (address.addr4.sin_addr.s_addr >> 24) == 192;
530 #endif
531 }
532 bool SystemAddress::SetBinaryAddress(const char *str, char portDelineator)
533 {
534 size_t delimiterPos = 0;
535 size_t stringLength = strlen(str);
536 for (; delimiterPos < stringLength; ++delimiterPos) {
537 if (str[delimiterPos] == portDelineator) {
538 break; // found location of port delimiter
539 }
540 }
541
542 if (NonNumericHostString(str)) {
543 //const char *ip = ( char* ) SocketLayer::DomainNameToIP( str );
544 char ip[65];
545 ip[0]=0;
546
547 // copy the plain hostname (excluding the (optional) port part)
548 // #med - change OP_NEW_ARRAY to support size_t type
549 char* hostname = OP_NEW_ARRAY<char>(static_cast<int>(delimiterPos + 1), _FILE_AND_LINE_);
550 strncpy_s(hostname, delimiterPos + 1, str, delimiterPos);
551 RakNetSocket2::DomainNameToIP(hostname, ip);
552 OP_DELETE_ARRAY(hostname, _FILE_AND_LINE_);
553
554 if (ip[0] != '\0') {
555 inet_pton(AF_INET, ip, &address.addr4.sin_addr.s_addr);
556 }
557 else {
558 *this = UNASSIGNED_SYSTEM_ADDRESS;
559 return false;
560 }
561 }
562 else {
563 // Split the string into the first part, and the : part
564 char IPPart[22];
565 // Only write the valid parts, don't change existing if invalid
566 // binaryAddress=UNASSIGNED_SYSTEM_ADDRESS.binaryAddress;
567 // port=UNASSIGNED_SYSTEM_ADDRESS.port;
568 size_t index = 0;
569 // #med - revise this --- if the hostname length > 22 we'd reject it rather than skipping what is beyond the max length...
570 for (; index < delimiterPos && index < 22; ++index) {
571 if (str[index]!='.' && (str[index]<'0' || str[index]>'9')) {
572 break;
573 }
574 IPPart[index]=str[index];
575 }
576 IPPart[index]=0;
577 if (index > 0) {
578 inet_pton(AF_INET, IPPart, &address.addr4.sin_addr.s_addr);
579 }
580 }
581
582 char portPart[10];
583 portPart[0] = '\0';
584 if (str[delimiterPos] != '\0') {
585 size_t portIndex;
586 ++delimiterPos; // skip the delimiter
587 for (portIndex = 0; portIndex < 10 && str[delimiterPos] != '\0'; ++delimiterPos, ++portIndex) {
588 if (str[delimiterPos] < '0' || str[delimiterPos] > '9') {
589 break;
590 }
591
592 portPart[portIndex] = str[delimiterPos];
593 }
594 portPart[portIndex] = '\0';
595 }
596 if (portPart[0] != '\0') {
597 // #med - missing / insufficient port range range
598 address.addr4.sin_port = htons((unsigned short)atoi(portPart));
599 // #med - not set in IPv6 mode
600 debugPort = ntohs(address.addr4.sin_port);
601 }
602 return true;
603 }
604
605 bool SystemAddress::FromString(const char *str, char portDelineator, int ipVersion)
606 {
607 #if RAKNET_SUPPORT_IPV6!=1
608 (void) ipVersion;
609 return SetBinaryAddress(str,portDelineator);
610 #else
611 if (str==0)
612 {
613 memset(&address,0,sizeof(address));
614 address.addr4.sin_family=AF_INET;
615 return true;
616 }
617 #if RAKNET_SUPPORT_IPV6==1
618 char ipPart[INET6_ADDRSTRLEN];
619 #else
620 char ipPart[INET_ADDRSTRLEN];
621 #endif
622 char portPart[32];
623
624 // TODO - what about 255.255.255.255?
625 if (ipVersion==4 && strcmp(str, IPV6_LOOPBACK)==0)
626 {
627 strcpy_s(ipPart,IPV4_LOOPBACK);
628 }
629 else if (ipVersion==6 && strcmp(str, IPV4_LOOPBACK)==0)
630 {
631 address.addr4.sin_family=AF_INET6;
632 strcpy_s(ipPart,IPV6_LOOPBACK);
633 }
634
635 int i = 0;
636 for (; i < sizeof(ipPart) && str[i] != '\0'; ++i) {
637 if (str[i] == portDelineator) {
638 // #med - missing error checking, if portPart is non-numeric and/or exceeds max allowed port value
639 int j = 0;
640 ++i; // skip the delimiter
641 for (; j < sizeof(portPart) && str[i] != '\0'; ++i, ++j) {
642 portPart[j] = str[i];
643 }
644 portPart[j] = '\0';
645 i = i - j - 1; // reset the position to the last position, so the trailing '\0'-terminator is set correctly below
646 break;
647 }
648 ipPart[i] = str[i];
649 }
650 ipPart[i] = '\0';
651
652 // needed for getaddrinfo
653 WSAStartupSingleton::AddRef();
654
655 // This could be a domain, or a printable address such as "192.0.2.1" or "2001:db8:63b3:1::3490"
656 // I want to convert it to its binary representation
657 addrinfo hints, *servinfo=0;
658 memset(&hints, 0, sizeof hints);
659 hints.ai_socktype = SOCK_DGRAM;
660 if (ipVersion==6)
661 hints.ai_family = AF_INET6;
662 else if (ipVersion==4)
663 hints.ai_family = AF_INET;
664 else
665 hints.ai_family = AF_UNSPEC;
666 getaddrinfo(ipPart, "", &hints, &servinfo);
667 if (servinfo==0)
668 {
669 if (ipVersion==6)
670 {
671 ipVersion=4;
672 hints.ai_family = AF_UNSPEC;
673 getaddrinfo(ipPart, "", &hints, &servinfo);
674 if (servinfo==0)
675 return false;
676 }
677 else
678 return false;
679 }
680 RakAssert(servinfo);
681
682 unsigned short oldPort = address.addr4.sin_port;
683 #if RAKNET_SUPPORT_IPV6==1
684 if (servinfo->ai_family == AF_INET)
685 {
686 // if (ipVersion==6)
687 // {
688 // address.addr4.sin_family=AF_INET6;
689 // memset(&address.addr6,0,sizeof(address.addr6));
690 // memcpy(address.addr6.sin6_addr.s6_addr+12,&((struct sockaddr_in *)servinfo->ai_addr)->sin_addr.s_addr,sizeof(unsigned long));
691 // }
692 // else
693 // {
694 address.addr4.sin_family=AF_INET;
695 memcpy(&address.addr4, (struct sockaddr_in *)servinfo->ai_addr,sizeof(struct sockaddr_in));
696 // }
697 }
698 else
699 {
700 address.addr4.sin_family=AF_INET6;
701 memcpy(&address.addr6, (struct sockaddr_in6 *)servinfo->ai_addr,sizeof(struct sockaddr_in6));
702 }
703 #else
704 address.addr4.sin_family=AF_INET4;
705 memcpy(&address.addr4, (struct sockaddr_in *)servinfo->ai_addr,sizeof(struct sockaddr_in));
706 #endif
707
708 freeaddrinfo(servinfo); // free the linked list
709
710 // needed for getaddrinfo
711 WSAStartupSingleton::Deref();
712
713 // PORT
714 if (portPart[0])
715 {
716 address.addr4.sin_port=htons((unsigned short) atoi(portPart));
717 debugPort=ntohs(address.addr4.sin_port);
718 }
719 else
720 {
721 address.addr4.sin_port=oldPort;
722 }
723
724 return true;
725 #endif // #if RAKNET_SUPPORT_IPV6!=1
726 }
727 bool SystemAddress::FromStringExplicitPort(const char *str, unsigned short port, int ipVersion)
728 {
729 bool b = FromString(str,(char) 0,ipVersion);
730 if (b==false)
731 {
732 *this=UNASSIGNED_SYSTEM_ADDRESS;
733 return false;
734 }
735 address.addr4.sin_port=htons(port);
736 debugPort=ntohs(address.addr4.sin_port);
737 return true;
738 }
739 void SystemAddress::CopyPort( const SystemAddress& right )
740 {
741 address.addr4.sin_port=right.address.addr4.sin_port;
742 debugPort=right.debugPort;
743 }
744 RakNetGUID::RakNetGUID()
745 {
746 systemIndex=(SystemIndex)-1;
747 *this=UNASSIGNED_RAKNET_GUID;
748 }
749 bool RakNetGUID::operator==( const RakNetGUID& right ) const
750 {
751 return g==right.g;
752 }
753 bool RakNetGUID::operator!=( const RakNetGUID& right ) const
754 {
755 return g!=right.g;
756 }
757 bool RakNetGUID::operator > ( const RakNetGUID& right ) const
758 {
759 return g > right.g;
760 }
761 bool RakNetGUID::operator < ( const RakNetGUID& right ) const
762 {
763 return g < right.g;
764 }
765 const char *RakNetGUID::ToString(void) const
766 {
767 static unsigned char strIndex=0;
768 static char str[8][64];
769
770 unsigned char lastStrIndex=strIndex;
771 strIndex++;
772 ToString(str[lastStrIndex&7], 64);
773 return (char*) str[lastStrIndex&7];
774 }
775 void RakNetGUID::ToString(char *dest) const
776 {
777 if (*this == UNASSIGNED_RAKNET_GUID)
778 #pragma warning(push)
779 #pragma warning(disable:4996)
780 strcpy(dest, "UNASSIGNED_RAKNET_GUID");
781 #pragma warning(pop)
782 else
783 //sprintf_s(dest, destLength, "%u.%u.%u.%u.%u.%u", g[0], g[1], g[2], g[3], g[4], g[5]);
784 #pragma warning(push)
785 #pragma warning(disable:4996)
786 sprintf(dest, "%" PRINTF_64_BIT_MODIFIER "u", (long long unsigned int) g);
787 #pragma warning(pop)
788 // sprintf_s(dest, destLength, "%u.%u.%u.%u.%u.%u", g[0], g[1], g[2], g[3], g[4], g[5]);
789 }
790 void RakNetGUID::ToString(char *dest, size_t destLength) const
791 {
792 if (*this==UNASSIGNED_RAKNET_GUID)
793 strcpy_s(dest, destLength, "UNASSIGNED_RAKNET_GUID");
794 else
795 //sprintf_s(dest, destLength, "%u.%u.%u.%u.%u.%u", g[0], g[1], g[2], g[3], g[4], g[5]);
796 sprintf_s(dest, destLength, "%" PRINTF_64_BIT_MODIFIER "u", (long long unsigned int) g);
797 // sprintf_s(dest, destLength, "%u.%u.%u.%u.%u.%u", g[0], g[1], g[2], g[3], g[4], g[5]);
798 }
799 bool RakNetGUID::FromString(const char *source)
800 {
801 if (source==0)
802 return false;
803
804
805
806 #if defined(WIN32)
807 g=_strtoui64(source, NULL, 10);
808
809
810 #else
811 // Changed from g=strtoull(source,0,10); for android
812 g=strtoull(source, (char **)NULL, 10);
813 #endif
814 return true;
815
816 }
817 unsigned long RakNetGUID::ToUint32( const RakNetGUID &g )
818 {
819 return ((unsigned long) (g.g >> 32)) ^ ((unsigned long) (g.g & 0xFFFFFFFF));
820 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CCRakNetSlidingWindow.cpp Source File

  • src
CCRakNetSlidingWindow.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/CCRakNetSlidingWindow.h"
17
18 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL==1
19
20 static const double UNSET_TIME_US=-1;
21
22 #if CC_TIME_TYPE_BYTES==4
23 static const CCTimeType SYN=10;
24 #else
25 static const CCTimeType SYN=10000;
26 #endif
27
28 #include "slikenet/MTUSize.h"
29 #include <stdio.h>
30 #include <cmath>
31 #include <stdlib.h>
32 #include "slikenet/assert.h"
33 #include "slikenet/alloca.h"
34
35 using namespace SLNet;
36
37 // ****************************************************** PUBLIC METHODS ******************************************************
38
39 CCRakNetSlidingWindow::CCRakNetSlidingWindow()
40 {
41 }
42 // ----------------------------------------------------------------------------------------------------------------------------
43 CCRakNetSlidingWindow::~CCRakNetSlidingWindow()
44 {
45
46 }
47 // ----------------------------------------------------------------------------------------------------------------------------
48 void CCRakNetSlidingWindow::Init(CCTimeType curTime, uint32_t maxDatagramPayload)
49 {
50 (void) curTime;
51
52 lastRtt=estimatedRTT=deviationRtt=UNSET_TIME_US;
53 RakAssert(maxDatagramPayload <= MAXIMUM_MTU_SIZE);
54 MAXIMUM_MTU_INCLUDING_UDP_HEADER=maxDatagramPayload;
55 cwnd=maxDatagramPayload;
56 ssThresh=0.0;
57 oldestUnsentAck=0;
58 nextDatagramSequenceNumber=0;
59 nextCongestionControlBlock=0;
60 backoffThisBlock=speedUpThisBlock=false;
61 expectedNextSequenceNumber=0;
62 _isContinuousSend=false;
63 }
64 // ----------------------------------------------------------------------------------------------------------------------------
65 void CCRakNetSlidingWindow::Update(CCTimeType curTime, bool hasDataToSendOrResend)
66 {
67 (void) curTime;
68 (void) hasDataToSendOrResend;
69 }
70 // ----------------------------------------------------------------------------------------------------------------------------
71 int CCRakNetSlidingWindow::GetRetransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend)
72 {
73 (void) curTime;
74 (void) isContinuousSend;
75 (void) timeSinceLastTick;
76
77 return unacknowledgedBytes;
78 }
79 // ----------------------------------------------------------------------------------------------------------------------------
80 int CCRakNetSlidingWindow::GetTransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend)
81 {
82 (void) curTime;
83 (void) timeSinceLastTick;
84
85 _isContinuousSend=isContinuousSend;
86
87 if (unacknowledgedBytes<=cwnd)
88 return (int) (cwnd-unacknowledgedBytes);
89 else
90 return 0;
91 }
92 // ----------------------------------------------------------------------------------------------------------------------------
93 bool CCRakNetSlidingWindow::ShouldSendACKs(CCTimeType curTime, CCTimeType estimatedTimeToNextTick)
94 {
95 CCTimeType rto = GetSenderRTOForACK();
96 (void) estimatedTimeToNextTick;
97
98 // iphone crashes on comparison between double and int64 http://www.jenkinssoftware.com/forum/index.php?topic=2717.0
99 if (rto==(CCTimeType) UNSET_TIME_US)
100 {
101 // Unknown how long until the remote system will retransmit, so better send right away
102 return true;
103 }
104
105 return curTime >= oldestUnsentAck + SYN;
106 }
107 // ----------------------------------------------------------------------------------------------------------------------------
108 DatagramSequenceNumberType CCRakNetSlidingWindow::GetNextDatagramSequenceNumber(void)
109 {
110 return nextDatagramSequenceNumber;
111 }
112 // ----------------------------------------------------------------------------------------------------------------------------
113 DatagramSequenceNumberType CCRakNetSlidingWindow::GetAndIncrementNextDatagramSequenceNumber(void)
114 {
115 DatagramSequenceNumberType dsnt=nextDatagramSequenceNumber;
116 nextDatagramSequenceNumber++;
117 return dsnt;
118 }
119 // ----------------------------------------------------------------------------------------------------------------------------
120 void CCRakNetSlidingWindow::OnSendBytes(CCTimeType curTime, uint32_t numBytes)
121 {
122 (void) curTime;
123 (void) numBytes;
124 }
125 // ----------------------------------------------------------------------------------------------------------------------------
126 void CCRakNetSlidingWindow::OnGotPacketPair(DatagramSequenceNumberType datagramSequenceNumber, uint32_t sizeInBytes, CCTimeType curTime)
127 {
128 (void) curTime;
129 (void) sizeInBytes;
130 (void) datagramSequenceNumber;
131 }
132 // ----------------------------------------------------------------------------------------------------------------------------
133 bool CCRakNetSlidingWindow::OnGotPacket(DatagramSequenceNumberType datagramSequenceNumber, bool isContinuousSend, CCTimeType curTime, uint32_t sizeInBytes, uint32_t *skippedMessageCount)
134 {
135 (void) curTime;
136 (void) sizeInBytes;
137 (void) isContinuousSend;
138
139 if (oldestUnsentAck==0)
140 oldestUnsentAck=curTime;
141
142 if (datagramSequenceNumber==expectedNextSequenceNumber)
143 {
144 *skippedMessageCount=0;
145 expectedNextSequenceNumber=datagramSequenceNumber+(DatagramSequenceNumberType)1;
146 }
147 else if (GreaterThan(datagramSequenceNumber, expectedNextSequenceNumber))
148 {
149 *skippedMessageCount=datagramSequenceNumber-expectedNextSequenceNumber;
150 // Sanity check, just use timeout resend if this was really valid
151 if (*skippedMessageCount>1000)
152 {
153 // During testing, the nat punchthrough server got 51200 on the first packet. I have no idea where this comes from, but has happened twice
154 if (*skippedMessageCount>(uint32_t)50000)
155 return false;
156 *skippedMessageCount=1000;
157 }
158 expectedNextSequenceNumber=datagramSequenceNumber+(DatagramSequenceNumberType)1;
159 }
160 else
161 {
162 *skippedMessageCount=0;
163 }
164
165 return true;
166 }
167 // ----------------------------------------------------------------------------------------------------------------------------
168 void CCRakNetSlidingWindow::OnResend(CCTimeType curTime, SLNet::TimeUS nextActionTime)
169 {
170 (void) curTime;
171 (void) nextActionTime;
172
173 if (_isContinuousSend && backoffThisBlock==false && cwnd>MAXIMUM_MTU_INCLUDING_UDP_HEADER*2)
174 {
175 // Spec says 1/2 cwnd, but it never recovers because cwnd increases too slowly
176 //ssThresh=cwnd-8.0 * (MAXIMUM_MTU_INCLUDING_UDP_HEADER*MAXIMUM_MTU_INCLUDING_UDP_HEADER/cwnd);
177 ssThresh=cwnd/2;
178 if (ssThresh<MAXIMUM_MTU_INCLUDING_UDP_HEADER)
179 ssThresh=MAXIMUM_MTU_INCLUDING_UDP_HEADER;
180 cwnd=MAXIMUM_MTU_INCLUDING_UDP_HEADER;
181
182 // Only backoff once per period
183 nextCongestionControlBlock=nextDatagramSequenceNumber;
184 backoffThisBlock=true;
185
186 // CC PRINTF
187 //printf("-- %.0f (Resend) Enter slow start.\n", cwnd);
188 }
189 }
190 // ----------------------------------------------------------------------------------------------------------------------------
191 void CCRakNetSlidingWindow::OnNAK(CCTimeType curTime, DatagramSequenceNumberType nakSequenceNumber)
192 {
193 (void) nakSequenceNumber;
194 (void) curTime;
195
196 if (_isContinuousSend && backoffThisBlock==false)
197 {
198 // Start congestion avoidance
199 ssThresh=cwnd/2;
200
201 // CC PRINTF
202 //printf("- %.0f (NAK) Set congestion avoidance.\n", cwnd);
203 }
204 }
205 // ----------------------------------------------------------------------------------------------------------------------------
206 void CCRakNetSlidingWindow::OnAck(CCTimeType curTime, CCTimeType rtt, bool hasBAndAS, BytesPerMicrosecond _B, BytesPerMicrosecond _AS, double totalUserDataBytesAcked, bool isContinuousSend, DatagramSequenceNumberType sequenceNumber )
207 {
208 (void) _B;
209 (void) totalUserDataBytesAcked;
210 (void) _AS;
211 (void) hasBAndAS;
212 (void) curTime;
213 (void) rtt;
214
215 lastRtt=(double) rtt;
216 if (estimatedRTT==UNSET_TIME_US)
217 {
218 estimatedRTT=(double) rtt;
219 deviationRtt=(double)rtt;
220 }
221 else
222 {
223 double d = .05;
224 double difference = rtt - estimatedRTT;
225 estimatedRTT = estimatedRTT + d * difference;
226 deviationRtt = deviationRtt + d * (std::abs(difference) - deviationRtt);
227 }
228
229 _isContinuousSend=isContinuousSend;
230
231 if (isContinuousSend==false)
232 return;
233
234 bool isNewCongestionControlPeriod;
235 isNewCongestionControlPeriod = GreaterThan(sequenceNumber, nextCongestionControlBlock);
236
237 if (isNewCongestionControlPeriod)
238 {
239 backoffThisBlock=false;
240 speedUpThisBlock=false;
241 nextCongestionControlBlock=nextDatagramSequenceNumber;
242 }
243
244 if (IsInSlowStart())
245 {
246 cwnd+=MAXIMUM_MTU_INCLUDING_UDP_HEADER;
247 if (cwnd > ssThresh && ssThresh!=0)
248 cwnd = ssThresh + MAXIMUM_MTU_INCLUDING_UDP_HEADER*MAXIMUM_MTU_INCLUDING_UDP_HEADER/cwnd;
249
250 // CC PRINTF
251 // printf("++ %.0f Slow start increase.\n", cwnd);
252
253 }
254 else if (isNewCongestionControlPeriod)
255 {
256 cwnd+=MAXIMUM_MTU_INCLUDING_UDP_HEADER*MAXIMUM_MTU_INCLUDING_UDP_HEADER/cwnd;
257
258 // CC PRINTF
259 // printf("+ %.0f Congestion avoidance increase.\n", cwnd);
260 }
261 }
262 // ----------------------------------------------------------------------------------------------------------------------------
263 void CCRakNetSlidingWindow::OnDuplicateAck( CCTimeType curTime, DatagramSequenceNumberType sequenceNumber )
264 {
265 (void) curTime;
266 (void) sequenceNumber;
267 }
268 // ----------------------------------------------------------------------------------------------------------------------------
269 void CCRakNetSlidingWindow::OnSendAckGetBAndAS(CCTimeType curTime, bool *hasBAndAS, BytesPerMicrosecond *_B, BytesPerMicrosecond *_AS)
270 {
271 (void) curTime;
272 (void) _B;
273 (void) _AS;
274
275 *hasBAndAS=false;
276 }
277 // ----------------------------------------------------------------------------------------------------------------------------
278 void CCRakNetSlidingWindow::OnSendAck(CCTimeType curTime, uint32_t numBytes)
279 {
280 (void) curTime;
281 (void) numBytes;
282
283 oldestUnsentAck=0;
284 }
285 // ----------------------------------------------------------------------------------------------------------------------------
286 void CCRakNetSlidingWindow::OnSendNACK(CCTimeType curTime, uint32_t numBytes)
287 {
288 (void) curTime;
289 (void) numBytes;
290
291 }
292 // ----------------------------------------------------------------------------------------------------------------------------
293 CCTimeType CCRakNetSlidingWindow::GetRTOForRetransmission(unsigned char timesSent) const
294 {
295 (void) timesSent;
296
297 #if CC_TIME_TYPE_BYTES==4
298 const CCTimeType maxThreshold=2000;
299 //const CCTimeType minThreshold=100;
300 const CCTimeType additionalVariance=30;
301 #else
302 const CCTimeType maxThreshold=2000000;
303 //const CCTimeType minThreshold=100000;
304 const CCTimeType additionalVariance=30000;
305 #endif
306
307
308 if (estimatedRTT==UNSET_TIME_US)
309 return maxThreshold;
310
311 //double u=1.0f;
312 double u=2.0f;
313 double q=4.0f;
314
315 CCTimeType threshhold = (CCTimeType) (u * estimatedRTT + q * deviationRtt) + additionalVariance;
316 if (threshhold > maxThreshold)
317 return maxThreshold;
318 return threshhold;
319 }
320 // ----------------------------------------------------------------------------------------------------------------------------
321 void CCRakNetSlidingWindow::SetMTU(uint32_t bytes)
322 {
323 RakAssert(bytes < MAXIMUM_MTU_SIZE);
324 MAXIMUM_MTU_INCLUDING_UDP_HEADER=bytes;
325 }
326 // ----------------------------------------------------------------------------------------------------------------------------
327 uint32_t CCRakNetSlidingWindow::GetMTU(void) const
328 {
329 return MAXIMUM_MTU_INCLUDING_UDP_HEADER;
330 }
331 // ----------------------------------------------------------------------------------------------------------------------------
332 BytesPerMicrosecond CCRakNetSlidingWindow::GetLocalReceiveRate(CCTimeType currentTime) const
333 {
334 (void) currentTime;
335
336 return 0; // TODO
337 }
338 // ----------------------------------------------------------------------------------------------------------------------------
339 double CCRakNetSlidingWindow::GetRTT(void) const
340 {
341 if (lastRtt==UNSET_TIME_US)
342 return 0.0;
343 return lastRtt;
344 }
345 // ----------------------------------------------------------------------------------------------------------------------------
346 bool CCRakNetSlidingWindow::GreaterThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b)
347 {
348 // a > b?
349 const DatagramSequenceNumberType halfSpan =(DatagramSequenceNumberType) (((DatagramSequenceNumberType)(const uint32_t)-1)/(DatagramSequenceNumberType)2);
350 return b!=a && b-a>halfSpan;
351 }
352 // ----------------------------------------------------------------------------------------------------------------------------
353 bool CCRakNetSlidingWindow::LessThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b)
354 {
355 // a < b?
356 const DatagramSequenceNumberType halfSpan = ((DatagramSequenceNumberType)(const uint32_t)-1)/(DatagramSequenceNumberType)2;
357 return b!=a && b-a<halfSpan;
358 }
359 // ----------------------------------------------------------------------------------------------------------------------------
360 uint64_t CCRakNetSlidingWindow::GetBytesPerSecondLimitByCongestionControl(void) const
361 {
362 return 0; // TODO
363 }
364 // ----------------------------------------------------------------------------------------------------------------------------
365 CCTimeType CCRakNetSlidingWindow::GetSenderRTOForACK(void) const
366 {
367 if (lastRtt==UNSET_TIME_US)
368 return (CCTimeType) UNSET_TIME_US;
369 return (CCTimeType)(lastRtt + SYN);
370 }
371 // ----------------------------------------------------------------------------------------------------------------------------
372 bool CCRakNetSlidingWindow::IsInSlowStart(void) const
373 {
374 return cwnd <= ssThresh || ssThresh==0;
375 }
376 // ----------------------------------------------------------------------------------------------------------------------------
377 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/StatisticsHistory.h Source File

  • include
  • slikenet
StatisticsHistory.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_StatisticsHistory==1
22
23 #ifndef __STATISTICS_HISTORY_H
24 #define __STATISTICS_HISTORY_H
25
26 #include "PluginInterface2.h"
27 #include "memoryoverride.h"
28 #include "NativeTypes.h"
29 #include "DS_List.h"
30 #include "types.h"
31 #include "DS_OrderedList.h"
32 #include "string.h"
33 #include "DS_Queue.h"
34 #include "DS_Hash.h"
35 #include <float.h>
36
37 namespace SLNet
38 {
40 class RakPeerInterface;
41
42 // Type used to track values. If needed, change to double and recompile
43 typedef double SHValueType;
44 #define SH_TYPE_MAX DBL_MAX
45
47 class RAK_DLL_EXPORT StatisticsHistory
48 {
49 public:
50 // GetInstance() and DestroyInstance(instance*)
51 STATIC_FACTORY_DECLARATIONS(StatisticsHistory)
52
53 enum SHErrorCode
54 {
55 SH_OK,
56 SH_UKNOWN_OBJECT,
57 SH_UKNOWN_KEY,
58 SH_INVALID_PARAMETER,
59 };
60
61 enum SHSortOperation
62 {
63 SH_DO_NOT_SORT,
64
65 SH_SORT_BY_RECENT_SUM_ASCENDING,
66 SH_SORT_BY_RECENT_SUM_DESCENDING,
67 SH_SORT_BY_LONG_TERM_SUM_ASCENDING,
68 SH_SORT_BY_LONG_TERM_SUM_DESCENDING,
69 SH_SORT_BY_RECENT_SUM_OF_SQUARES_ASCENDING,
70 SH_SORT_BY_RECENT_SUM_OF_SQUARES_DESCENDING,
71 SH_SORT_BY_RECENT_AVERAGE_ASCENDING,
72 SH_SORT_BY_RECENT_AVERAGE_DESCENDING,
73 SH_SORT_BY_LONG_TERM_AVERAGE_ASCENDING,
74 SH_SORT_BY_LONG_TERM_AVERAGE_DESCENDING,
75 SH_SORT_BY_RECENT_HIGHEST_ASCENDING,
76 SH_SORT_BY_RECENT_HIGHEST_DESCENDING,
77 SH_SORT_BY_RECENT_LOWEST_ASCENDING,
78 SH_SORT_BY_RECENT_LOWEST_DESCENDING,
79 SH_SORT_BY_LONG_TERM_HIGHEST_ASCENDING,
80 SH_SORT_BY_LONG_TERM_HIGHEST_DESCENDING,
81 SH_SORT_BY_LONG_TERM_LOWEST_ASCENDING,
82 SH_SORT_BY_LONG_TERM_LOWEST_DESCENDING,
83 };
84
85 enum SHDataCategory
86 {
90 DC_DISCRETE,
91
96 DC_CONTINUOUS
97 };
98
99 struct TimeAndValue;
100 struct TimeAndValueQueue;
101
102 struct TrackedObjectData
103 {
104 TrackedObjectData();
105 TrackedObjectData(uint64_t _objectId, int _objectType, void *_userData);
106 uint64_t objectId;
107 int objectType;
108 void *userData;
109 };
110
111 StatisticsHistory();
112 virtual ~StatisticsHistory();
113 void SetDefaultTimeToTrack(Time defaultTimeToTrack);
114 Time GetDefaultTimeToTrack(void) const;
115 bool AddObject(TrackedObjectData tod);
116 bool RemoveObject(uint64_t objectId, void **userData);
117 void RemoveObjectAtIndex(unsigned int index);
118 void Clear(void);
119 unsigned int GetObjectCount(void) const;
120 StatisticsHistory::TrackedObjectData * GetObjectAtIndex(unsigned int index) const;
121 unsigned int GetObjectIndex(uint64_t objectId) const;
122 bool AddValueByObjectID(uint64_t objectId, RakString key, SHValueType val, Time curTime, bool combineEqualTimes);
123 void AddValueByIndex(unsigned int index, RakString key, SHValueType val, Time curTime, bool combineEqualTimes);
124 SHErrorCode GetHistoryForKey(uint64_t objectId, RakString key, TimeAndValueQueue **values, Time curTime) const;
125 bool GetHistorySorted(uint64_t objectId, SHSortOperation sortType, DataStructures::List<TimeAndValueQueue *> &values) const;
126 void MergeAllObjectsOnKey(RakString key, TimeAndValueQueue *tavqOutput, SHDataCategory dataCategory) const;
127 void GetUniqueKeyList(DataStructures::List<RakString> &keys);
128
129 struct TimeAndValue
130 {
131 Time time;
132 SHValueType val;
133 };
134
135 struct TimeAndValueQueue
136 {
137 TimeAndValueQueue();
138 ~TimeAndValueQueue();
139
140 DataStructures::Queue<TimeAndValue> values;
141
142 Time timeToTrackValues;
143 RakString key;
144
145 SHValueType recentSum;
146 SHValueType recentSumOfSquares;
147 SHValueType longTermSum;
148 SHValueType longTermCount;
149 SHValueType longTermLowest;
150 SHValueType longTermHighest;
151
152 void SetTimeToTrackValues(Time t);
153 Time GetTimeToTrackValues(void) const;
154 SHValueType GetRecentSum(void) const;
155 SHValueType GetRecentSumOfSquares(void) const;
156 SHValueType GetLongTermSum(void) const;
157 SHValueType GetRecentAverage(void) const;
158 SHValueType GetRecentLowest(void) const;
159 SHValueType GetRecentHighest(void) const;
160 SHValueType GetRecentStandardDeviation(void) const;
161 SHValueType GetLongTermAverage(void) const;
162 SHValueType GetLongTermLowest(void) const;
163 SHValueType GetLongTermHighest(void) const;
164 SHValueType GetSumSinceTime(Time t) const;
165 Time GetTimeRange(void) const;
166
167 // Merge two sets to output
168 static void MergeSets( const TimeAndValueQueue *lhs, SHDataCategory lhsDataCategory, const TimeAndValueQueue *rhs, SHDataCategory rhsDataCategory, TimeAndValueQueue *output );
169
170 // Shrink or expand a sample set to the approximate number given
171 // DC_DISCRETE will produce a histogram (sum) while DC_CONTINUOUS will produce an average
172 void ResizeSampleSet( int approximateSamples, DataStructures::Queue<StatisticsHistory::TimeAndValue> &blendedSamples, SHDataCategory dataCategory, Time timeClipStart=0, Time timeClipEnd=0 );
173
174 // Clear out all values
175 void Clear(void);
176
177 TimeAndValueQueue& operator = ( const TimeAndValueQueue& input );
178
180 void CullExpiredValues(Time curTime);
182 static SHValueType Interpolate(TimeAndValue t1, TimeAndValue t2, Time time);
184 SHValueType sortValue;
185 };
186
187 protected:
188 struct TrackedObject;
189 public:
190 static int TrackedObjectComp( const uint64_t &key, TrackedObject* const &data );
191 protected:
192
193 struct TrackedObject
194 {
195 TrackedObject();
196 ~TrackedObject();
197 TrackedObjectData trackedObjectData;
198 DataStructures::Hash<SLNet::RakString, TimeAndValueQueue*, 32, SLNet::RakString::ToInteger> dataQueues;
199 };
200
201 DataStructures::OrderedList<uint64_t, TrackedObject*,TrackedObjectComp> objects;
202
203 Time timeToTrack;
204 };
205
208 class RAK_DLL_EXPORT StatisticsHistoryPlugin : public PluginInterface2
209 {
210 public:
211 // GetInstance() and DestroyInstance(instance*)
212 STATIC_FACTORY_DECLARATIONS(StatisticsHistoryPlugin)
213
214 StatisticsHistory statistics;
215
216 StatisticsHistoryPlugin();
217 virtual ~StatisticsHistoryPlugin();
218 void SetTrackConnections(bool _addNewConnections, int newConnectionsObjectType, bool _removeLostConnections);
219
220 protected:
221 virtual void Update(void);
222 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
223 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
224
225 // Too slow
226 // virtual bool UsesReliabilityLayer(void) const {return true;}
227 // virtual void OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress);
228 // virtual void OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress);
229
230
231 bool addNewConnections;
232 bool removeLostConnections;
233 int newConnectionsObjectType;
234 };
235
236 } // namespace SLNet
237
238 #endif // __STATISTICS_HISTORY_H
239
240 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RackspaceEventCallback_Default
SLNet::RackspaceEventCallback_Default Member List

This is the complete list of members for SLNet::RackspaceEventCallback_Default, including all inherited members.

ExecuteDefault(const char *callbackName, RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnAuthenticationResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnConfirmResizedServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnConnectionAttemptFailure(RackspaceOperationType operationType, const char *url) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnCreateImageResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnCreateServerResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnCreateSharedIPGroup(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnDeleteImageResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnDeleteServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnDeleteServerAddress(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnDeleteSharedIPGroup(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnGetFlavorDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnGetImageDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnGetServerDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnGetSharedIPGroupDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnListFlavorsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnListImagesResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnListServerAddresses(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnListServersResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnListServersWithDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnListSharedIPGroups(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnListSharedIPGroupsWithDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnRebootServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnRebuildServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnResizeServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnRevertResizedServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnShareServerAddress(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
OnUpdateServerNameOrPassword(RackspaceEventType eventType, const char *htmlAdditionalInfo) | SLNet::RackspaceEventCallback_Default | inlinevirtual
Rackspace2EventCallback() | SLNet::Rackspace2EventCallback | inline
~Rackspace2EventCallback() | SLNet::Rackspace2EventCallback | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • VariableDeltaSerializer
SLNet::VariableDeltaSerializer Member List

This is the complete list of members for SLNet::VariableDeltaSerializer, including all inherited members.

AddRemoteSystemVariableHistory(RakNetGUID guid) | SLNet::VariableDeltaSerializer |
AllocChangedVariablesList(void) | SLNet::VariableDeltaSerializer | protected
BeginDeserialize(DeserializationContext *context, BitStream *_bitStream) | SLNet::VariableDeltaSerializer |
BeginIdenticalSerialize(SerializationContext *context, bool _isFirstSerializeToThisSystem, BitStream *_bitStream) | SLNet::VariableDeltaSerializer |
BeginUniqueSerialize(SerializationContext *context, RakNetGUID _guid, BitStream *_bitStream) | SLNet::VariableDeltaSerializer |
BeginUnreliableAckedSerialize(SerializationContext *context, RakNetGUID _guid, BitStream *_bitStream, uint32_t _sendReceipt) | SLNet::VariableDeltaSerializer |
DeserializeVariable(DeserializationContext *context, VarType &variable) | SLNet::VariableDeltaSerializer | inline
didComparisonThisTick | SLNet::VariableDeltaSerializer | protected
DirtyAndFreeVarsAssociatedWithReceipt(RakNetGUID guid, uint32_t receiptId) | SLNet::VariableDeltaSerializer | protected
EndDeserialize(DeserializationContext *context) | SLNet::VariableDeltaSerializer |
EndSerialize(SerializationContext *context) | SLNet::VariableDeltaSerializer |
FreeChangedVariablesList(ChangedVariablesList *changedVariables) | SLNet::VariableDeltaSerializer | protected
FreeVarsAssociatedWithReceipt(RakNetGUID guid, uint32_t receiptId) | SLNet::VariableDeltaSerializer | protected
GetRemoteSystemHistoryListIndex(RakNetGUID guid) | SLNet::VariableDeltaSerializer | protected
GetRemoteSystemVariableHistory(RakNetGUID guid) | SLNet::VariableDeltaSerializer | protected
GetVarsWrittenPerRemoteSystemListIndex(RakNetGUID guid) | SLNet::VariableDeltaSerializer | protected
identicalSerializationBs | SLNet::VariableDeltaSerializer | protected
OnMessageReceipt(RakNetGUID guid, uint32_t receiptId, bool messageArrived) | SLNet::VariableDeltaSerializer |
OnPreSerializeTick(void) | SLNet::VariableDeltaSerializer |
remoteSystemVariableHistoryList | SLNet::VariableDeltaSerializer | protected
RemoveRemoteSystemVariableHistory(RakNetGUID guid) | SLNet::VariableDeltaSerializer |
RemoveRemoteSystemVariableHistory(void) | SLNet::VariableDeltaSerializer | protected
SerializeVariable(SerializationContext *context, const VarType &variable) | SLNet::VariableDeltaSerializer | inline
StartVariableHistoryWrite(RakNetGUID guid) | SLNet::VariableDeltaSerializer | protected
StoreChangedVariablesList(RemoteSystemVariableHistory *variableHistory, ChangedVariablesList *changedVariables, uint32_t sendReceipt) | SLNet::VariableDeltaSerializer | protected
UpdatedVariablesListPtrComp(const uint32_t &key, ChangedVariablesList *const &data) | SLNet::VariableDeltaSerializer | protectedstatic
updatedVariablesMemoryPool | SLNet::VariableDeltaSerializer | protected
VariableDeltaSerializer() | SLNet::VariableDeltaSerializer |
~VariableDeltaSerializer() | SLNet::VariableDeltaSerializer |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Router2.cpp Source File

  • src
Router2.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_Router2==1 && _RAKNET_SUPPORT_UDPForwarder==1
18
19 #include "slikenet/Router2.h"
20 #include "slikenet/peerinterface.h"
21 #include "slikenet/BitStream.h"
22 #include "slikenet/time.h"
23 #include "slikenet/GetTime.h"
24 #include "slikenet/DS_OrderedList.h"
25 #include "slikenet/SocketLayer.h"
26 #include "slikenet/FormatString.h"
27 #include "slikenet/SocketDefines.h"
28
29 using namespace SLNet;
30
31 #ifndef INVALID_SOCKET
32 #define INVALID_SOCKET -1
33 #endif
34
35 /*
36 Algorithm:
37
38 1. Sender calls ConnectInternal(). A ConnnectRequest structure is allocated and stored in the connectionRequests list, containing a list of every system we are connected to. ID_ROUTER_2_QUERY_FORWARDING is sent to all connected systems.
39
40 2. Upon the router getting ID_ROUTER_2_QUERY_FORWARDING, ID_ROUTER_2_REPLY_FORWARDING is sent to the sender indicating if that router is connected to the endpoint, along with the ping from the router to the endpoint.
41
42 3. Upon the sender getting ID_ROUTER_2_REPLY_FORWARDING, the connection request structure is looked up in Router2::UpdateForwarding. The ping is stored in that structure. Once all systems have replied, the system continues to the next state. If every system in step 1 has been exhausted, and routing has occured at least once, then ID_CONNECTION_LOST is returned. If every system in step 1 has been exhausted and routing has never occured, then ID_ROUTER_2_FORWARDING_NO_PATH is returned. Otherwise, the router with the lowest ping is chosen, and RequestForwarding() is called with that system, which sends ID_ROUTER_2_REQUEST_FORWARDING to the router.
43
44 4. When the router gets ID_ROUTER_2_REQUEST_FORWARDING, a MiniPunchRequest structure is allocated and stored in the miniPunchesInProgress list. The function SendOOBMessages() sends ID_ROUTER_2_REPLY_TO_SENDER_PORT from the routing sockets to both the sender and endpoint. It also sends ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT through the regular RakNet connection.
45
46 5. The sender and endpoint should get ID_ROUTER_2_REPLY_TO_SENDER_PORT and/or ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT depending on what type of router they have. If ID_ROUTER_2_REPLY_TO_SENDER_PORT arrives, then this will reply back to the routing socket directly. If ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT arrives, then the reply port is modified to be the port specified by the router system. In both cases, ID_ROUTER_2_MINI_PUNCH_REPLY is sent. As the router has already setup the forwarding, ID_ROUTER_2_MINI_PUNCH_REPLY will actually arrive to the endpoint from the sender, and from the sender to the endpoint.
47
48 6. When ID_ROUTER_2_MINI_PUNCH_REPLY arrives, ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE will be sent to the router. This is to tell the router that the forwarding has succeeded.
49
50 7. When ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE arrives on the router, the router will find the two systems in the miniPunchesInProgress list, which was added in step 4 (See OnMiniPunchReplyBounce()). gotReplyFromSource or gotReplyFromEndpoint will be set to true, depending on the sender. When both gotReplyFromSource and gotReplyFromEndpoint have replied, then ID_ROUTER_2_REROUTE is sent to the endpoint, and ID_ROUTER_2_FORWARDING_ESTABLISHED is sent to the sender.
51
52 8. When the endpoint gets ID_ROUTER_2_REROUTE, the system address is updated for the guid of the sender using RakPeer::ChangeSystemAddress(). This happens in OnRerouted().
53
54 9. When the sender gets ID_ROUTER_2_FORWARDING_ESTABLISHED, then in OnForwardingSuccess() the endpoint is removed from the connectionRequest list and moved to the forwardedConnectionList.
55
56 10. In OnClosedConnection(), for the sender, if the closed connection is the endpoint, then the endpoint is removed from the forwardedConnectionList (this is a graceful disconnect). If the connection was instead lost to the router, then ConnectInternal() gets called, which goes back to step 1. If instead this was a connection requset in progress, then UpdateForwarding() gets called, which goes back to step 3.
57
58 11. When the user connects the endpoint and sender, then the sender will get ID_CONNECTION_REQUEST_ACCEPTED. The sender will look up the endpoint in the forwardedConnectionList, and send ID_ROUTER_2_INCREASE_TIMEOUT to the endpoint. This message will call SetTimeoutTime() on the endpoint, so that if the router disconnects, enough time is available for the reroute to complete.
59 */
60
61 #define MIN_MINIPUNCH_TIMEOUT 5000
62
63
64
65
66 void Router2DebugInterface::ShowFailure(const char *message)
67 {
68 printf("%s", message);
69 }
70 void Router2DebugInterface::ShowDiagnostic(const char *message)
71 {
72 printf("%s", message);
73 }
74
75 enum Router2MessageIdentifiers
76 {
77 ID_ROUTER_2_QUERY_FORWARDING,
78 ID_ROUTER_2_REPLY_FORWARDING,
79 ID_ROUTER_2_REQUEST_FORWARDING,
80 ID_ROUTER_2_INCREASE_TIMEOUT,
81 };
82 Router2::ConnnectRequest::ConnnectRequest()
83 {
84
85 }
86 Router2::ConnnectRequest::~ConnnectRequest()
87 {
88
89 }
90
91 STATIC_FACTORY_DEFINITIONS(Router2,Router2);
92
93 Router2::Router2()
94 {
95 udpForwarder=0;
96 maximumForwardingRequests=0;
97 debugInterface=0;
98 socketFamily=AF_INET;
99 }
100 Router2::~Router2()
101 {
102 ClearAll();
103
104 if (udpForwarder)
105 {
106 udpForwarder->Shutdown();
107 SLNet::OP_DELETE(udpForwarder,_FILE_AND_LINE_);
108 }
109 }
110 void Router2::ClearMinipunches(void)
111 {
112 miniPunchesInProgressMutex.Lock();
113 miniPunchesInProgress.Clear(false,_FILE_AND_LINE_);
114 miniPunchesInProgressMutex.Unlock();
115 }
116 void Router2::ClearConnectionRequests(void)
117 {
118 connectionRequestsMutex.Lock();
119 for (unsigned int i=0; i < connectionRequests.Size(); i++)
120 {
121 SLNet::OP_DELETE(connectionRequests[i],_FILE_AND_LINE_);
122 }
123 connectionRequests.Clear(false,_FILE_AND_LINE_);
124 connectionRequestsMutex.Unlock();
125 }
126 bool Router2::ConnectInternal(RakNetGUID endpointGuid, bool returnConnectionLostOnFailure)
127 {
128 int largestPing = GetLargestPingAmongConnectedSystems();
129 if (largestPing<0)
130 {
131 char buff[512];
132 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2: ConnectInternal(%I64d) failed at %s:%i\n", endpointGuid.g, __FILE__, __LINE__));
133
134 // Not connected to anyone
135 return false;
136 }
137
138 // ALready in progress?
139 connectionRequestsMutex.Lock();
140 if (GetConnectionRequestIndex(endpointGuid)!=(unsigned int)-1)
141 {
142 connectionRequestsMutex.Unlock();
143 char buff[512];
144 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2: ConnectInternal(%I64d) failed at %s:%i\n", endpointGuid.g, __FILE__, __LINE__));
145
146 return false;
147 }
148 connectionRequestsMutex.Unlock();
149
150 // StoreRequest(endpointGuid, Largest(ping*2), systemsSentTo). Set state REQUEST_STATE_QUERY_FORWARDING
151 Router2::ConnnectRequest *cr = SLNet::OP_NEW<Router2::ConnnectRequest>(_FILE_AND_LINE_);
152 DataStructures::List<SystemAddress> addresses;
153 DataStructures::List<RakNetGUID> guids;
154 rakPeerInterface->GetSystemList(addresses, guids);
155 if (guids.Size()==0)
156 {
157 char buff[512];
158 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed at %s:%i\n", _FILE_AND_LINE_));
159
160 return false;
161 }
162 cr->requestState=R2RS_REQUEST_STATE_QUERY_FORWARDING;
163 cr->pingTimeout= SLNet::GetTimeMS()+largestPing*2+1000;
164 cr->endpointGuid=endpointGuid;
165 cr->returnConnectionLostOnFailure=returnConnectionLostOnFailure;
166 for (unsigned int i=0; i < guids.Size(); i++)
167 {
168 ConnectionRequestSystem crs;
169 if (guids[i]!=endpointGuid)
170 {
171 crs.guid=guids[i];
172 crs.pingToEndpoint=-1;
173 cr->connectionRequestSystemsMutex.Lock();
174 cr->connectionRequestSystems.Push(crs,_FILE_AND_LINE_);
175 cr->connectionRequestSystemsMutex.Unlock();
176
177 // Broadcast(ID_ROUTER_2_QUERY_FORWARDING, endpointGuid);
178 SLNet::BitStream bsOut;
179 bsOut.Write((MessageID)ID_ROUTER_2_INTERNAL);
180 bsOut.Write((unsigned char) ID_ROUTER_2_QUERY_FORWARDING);
181 bsOut.Write(endpointGuid);
182 uint32_t pack_id = rakPeerInterface->Send(&bsOut,MEDIUM_PRIORITY,RELIABLE_ORDERED,0,crs.guid,false);
183
184 if (debugInterface)
185 {
186 char buff[512];
187 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Router2::ConnectInternal: at %s:%i, pack_id = %d", __FILE__, __LINE__,pack_id));
188 }
189
190 }
191 else
192 {
193 if (debugInterface)
194 {
195 char buff[512];
196 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Router2::ConnectInternal: at %s:%i [else ..].: %I64d==%I64d", __FILE__, __LINE__,
197 guids[i].g,endpointGuid.g));
198 }
199 }
200 }
201 connectionRequestsMutex.Lock();
202 connectionRequests.Push(cr,_FILE_AND_LINE_);
203 connectionRequestsMutex.Unlock();
204
205 if (debugInterface)
206 {
207 char buff[512];
208 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Broadcasting ID_ROUTER_2_QUERY_FORWARDING to %I64d at %s:%i\n", endpointGuid.g , __FILE__, __LINE__));
209 }
210
211 return true;
212 }
213 void Router2::SetSocketFamily(unsigned short _socketFamily)
214 {
215 socketFamily=_socketFamily;
216 }
217 void Router2::EstablishRouting(RakNetGUID endpointGuid)
218 {
219 ConnectionState cs = rakPeerInterface->GetConnectionState(endpointGuid);
220 if (cs!=IS_DISCONNECTED && cs!=IS_NOT_CONNECTED)
221 {
222 char buff[512];
223 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed at %s:%i "
224 "(already connected to the %I64d)\n", __FILE__, __LINE__, endpointGuid.g ));
225 return;
226 }
227
228 ConnectInternal(endpointGuid,false);
229 }
230 void Router2::SetMaximumForwardingRequests(int max)
231 {
232 if (max>0 && maximumForwardingRequests<=0)
233 {
234 udpForwarder = SLNet::OP_NEW<UDPForwarder>(_FILE_AND_LINE_);
235 udpForwarder->Startup();
236 }
237 else if (max<=0 && maximumForwardingRequests>0)
238 {
239 udpForwarder->Shutdown();
240 SLNet::OP_DELETE(udpForwarder,_FILE_AND_LINE_);
241 udpForwarder=0;
242 }
243
244 maximumForwardingRequests=max;
245 }
246 PluginReceiveResult Router2::OnReceive(Packet *packet)
247 {
248 SystemAddress sa;
249 SLNet::BitStream bs(packet->data,packet->length,false);
250 if (packet->data[0]==ID_ROUTER_2_INTERNAL)
251 {
252 switch (packet->data[1])
253 {
254 case ID_ROUTER_2_QUERY_FORWARDING:
255 {
256 OnQueryForwarding(packet);
257 return RR_STOP_PROCESSING_AND_DEALLOCATE;
258 }
259 case ID_ROUTER_2_REPLY_FORWARDING:
260 {
261 OnQueryForwardingReply(packet);
262 return RR_STOP_PROCESSING_AND_DEALLOCATE;
263 }
264 case ID_ROUTER_2_REQUEST_FORWARDING:
265 {
266
267 if (debugInterface)
268 {
269 char buff[512];
270 char buff2[32];
271 packet->systemAddress.ToString(true,buff2,static_cast<size_t>(32));
272 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_REQUEST_FORWARDING on ip %s from %I64d, ",
273 buff2,packet->guid.g));
274 }
275
276 OnRequestForwarding(packet);
277 return RR_STOP_PROCESSING_AND_DEALLOCATE;
278 }
279 case ID_ROUTER_2_INCREASE_TIMEOUT:
280 {
282 rakPeerInterface->SetTimeoutTime(rakPeerInterface->GetTimeoutTime(packet->systemAddress)+10000, packet->systemAddress);
283 return RR_STOP_PROCESSING_AND_DEALLOCATE;
284 }
285 }
286 }
287 else if (packet->data[0]==ID_OUT_OF_BAND_INTERNAL && packet->length>=2)
288 {
289 switch (packet->data[1])
290 {
291 case ID_ROUTER_2_REPLY_TO_SENDER_PORT:
292 {
293 SLNet::BitStream bsOut;
294 bsOut.Write(packet->guid);
295 SendOOBFromRakNetPort(ID_ROUTER_2_MINI_PUNCH_REPLY, &bsOut, packet->systemAddress);
296
297 if (debugInterface)
298 {
299 char buff[512];
300 char buff2[32];
301 sa.ToString(false,buff2,static_cast<size_t>(32));
302 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_REPLY_TO_SENDER_PORT %i on address %s, replying with ID_ROUTER_2_MINI_PUNCH_REPLY at %s:%i\n", sa.GetPort(), buff2, _FILE_AND_LINE_));
303
304 // packet->systemAddress.ToString(true,buff2);
305 // debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_REPLY_TO_SENDER_PORT on address %s (%I64d), "
306 // "replying with ID_ROUTER_2_MINI_PUNCH_REPLY at %s:%i\n", buff2,packet->guid.g, __FILE__, __LINE__));
307 }
308
309 return RR_STOP_PROCESSING_AND_DEALLOCATE;
310 }
311 case ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT:
312 {
313 SLNet::BitStream bsOut;
314 bsOut.Write(packet->guid);
315 bs.IgnoreBytes(2);
316 sa=packet->systemAddress;
317 unsigned short port;
318 bs.Read(port);
319 sa.SetPortHostOrder(port);
320 RakAssert(sa.GetPort()!=0);
321 SendOOBFromRakNetPort(ID_ROUTER_2_MINI_PUNCH_REPLY, &bsOut, sa);
322
323 if (debugInterface)
324 {
325 char buff[512];
326 char buff2[32];
327 sa.ToString(false,buff2,static_cast<size_t>(32));
328 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT %i on address %s, "
329 "replying with ID_ROUTER_2_MINI_PUNCH_REPLY at %s:%i\n", sa.GetPort(), buff2, __FILE__, __LINE__));
330 }
331
332 return RR_STOP_PROCESSING_AND_DEALLOCATE;
333 }
334 case ID_ROUTER_2_MINI_PUNCH_REPLY:
335 OnMiniPunchReply(packet);
336 return RR_STOP_PROCESSING_AND_DEALLOCATE;
337 case ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE:
338 OnMiniPunchReplyBounce(packet);
339 return RR_STOP_PROCESSING_AND_DEALLOCATE;
340 }
341 }
342 else if (packet->data[0]==ID_ROUTER_2_FORWARDING_ESTABLISHED)
343 {
344 // printf("Got ID_ROUTER_2_FORWARDING_ESTABLISHED\n");
345 if (OnForwardingSuccess(packet)==false)
346 return RR_STOP_PROCESSING_AND_DEALLOCATE;
347 }
348 else if (packet->data[0]==ID_ROUTER_2_REROUTED)
349 {
350 OnRerouted(packet);
351 }
352 else if (packet->data[0]==ID_CONNECTION_REQUEST_ACCEPTED)
353 {
354 unsigned int forwardingIndex;
355 forwardedConnectionListMutex.Lock();
356 for (forwardingIndex=0; forwardingIndex < forwardedConnectionList.Size(); forwardingIndex++)
357 {
358 if (forwardedConnectionList[forwardingIndex].endpointGuid==packet->guid && forwardedConnectionList[forwardingIndex].weInitiatedForwarding)
359 break;
360 }
361
362 if (forwardingIndex<forwardedConnectionList.Size())
363 {
364 forwardedConnectionListMutex.Unlock();
365
366 // We connected to this system through a forwarding system
367 // Have the endpoint take longer to drop us, in case the intermediary system drops
368 SLNet::BitStream bsOut;
369 bsOut.Write((MessageID)ID_ROUTER_2_INTERNAL);
370 bsOut.Write((unsigned char) ID_ROUTER_2_INCREASE_TIMEOUT);
371 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE,0,packet->guid,false);
372
373 if (debugInterface)
374 {
375 char buff[512];
376 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_CONNECTION_REQUEST_ACCEPTED, "
377 "sending ID_ROUTER_2_INCREASE_TIMEOUT to the %I64d at %s:%i\n", packet->guid.g, __FILE__, __LINE__));
378 }
379
380 // Also take longer ourselves
381 rakPeerInterface->SetTimeoutTime(rakPeerInterface->GetTimeoutTime(packet->systemAddress)+10000, packet->systemAddress);
382 }
383 else {
384 // ~Gwynn: Fix for Receive hanging up problem on Windows XP
385 // See http://blog.delphi-jedi.net/2008/04/23/the-case-of-the-unexplained-dead-lock-in-a-single-thread/ for details
386 forwardedConnectionListMutex.Unlock();
387 }
388 }
389 else if (packet->data[0]==ID_ROUTER_2_FORWARDING_NO_PATH)
390 {
391 if (packet->wasGeneratedLocally==false)
392 return RR_STOP_PROCESSING_AND_DEALLOCATE;
393 }
394
395 return RR_CONTINUE_PROCESSING;
396 }
397 void Router2::Update(void)
398 {
399 SLNet::TimeMS curTime = SLNet::GetTimeMS();
400 unsigned int connectionRequestIndex=0;
401 connectionRequestsMutex.Lock();
402 while (connectionRequestIndex < connectionRequests.Size())
403 {
404 ConnnectRequest* connectionRequest = connectionRequests[connectionRequestIndex];
405
406 // pingTimeout is only used with R2RS_REQUEST_STATE_QUERY_FORWARDING
407 if (connectionRequest->requestState==R2RS_REQUEST_STATE_QUERY_FORWARDING &&
408 connectionRequest->pingTimeout < curTime)
409 {
410 bool anyRemoved=false;
411 unsigned int connectionRequestGuidIndex=0;
412 connectionRequest->connectionRequestSystemsMutex.Lock();
413 while (connectionRequestGuidIndex < connectionRequest->connectionRequestSystems.Size())
414 {
415 if (connectionRequest->connectionRequestSystems[connectionRequestGuidIndex].pingToEndpoint<0)
416 {
417 anyRemoved=true;
418 connectionRequest->connectionRequestSystems.RemoveAtIndexFast(connectionRequestGuidIndex);
419 }
420 else
421 {
422 connectionRequestGuidIndex++;
423 }
424 }
425 connectionRequest->connectionRequestSystemsMutex.Unlock();
426
427 if (anyRemoved)
428 {
429 if (connectionRequestIndex!=(unsigned int)-1)
430 {
431 // connectionRequestsMutex should be locked before calling this function
432 if (UpdateForwarding(connectionRequest)==false)
433 {
434 RemoveConnectionRequest(connectionRequestIndex);
435 }
436 else
437 {
438 connectionRequestIndex++;
439 }
440 }
441 else
442 {
443 connectionRequestIndex++;
444 }
445 }
446 else
447 {
448 connectionRequestIndex++;
449 }
450 }
451 else
452 {
453 connectionRequestIndex++;
454 }
455 }
456 connectionRequestsMutex.Unlock();
457
458 unsigned int i=0;
459 miniPunchesInProgressMutex.Lock();
460 while (i < miniPunchesInProgress.Size())
461 {
462 if (miniPunchesInProgress[i].timeout<curTime)
463 {
464 SendFailureOnCannotForward(miniPunchesInProgress[i].sourceGuid, miniPunchesInProgress[i].endpointGuid);
465 miniPunchesInProgress.RemoveAtIndexFast(i);
466 }
467 else if (curTime>miniPunchesInProgress[i].nextAction)
468 {
469 miniPunchesInProgress[i].nextAction=curTime+100;
470 SendOOBMessages(&miniPunchesInProgress[i]);
471 }
472 else
473 i++;
474 }
475 miniPunchesInProgressMutex.Unlock();
476
477 }
478 void Router2::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
479 {
480 (void) lostConnectionReason;
481 (void) systemAddress;
482
483
484 unsigned int forwardedConnectionIndex=0;
485 forwardedConnectionListMutex.Lock();
486 while (forwardedConnectionIndex<forwardedConnectionList.Size())
487 {
488 if (forwardedConnectionList[forwardedConnectionIndex].endpointGuid==rakNetGUID)
489 {
490 if (debugInterface)
491 {
492 char buff[512];
493 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Closed connection to the %I64d, removing forwarding from list at %s:%i\n", rakNetGUID.g, __FILE__, __LINE__));
494 }
495
496 // No longer need forwarding
497 forwardedConnectionList.RemoveAtIndexFast(forwardedConnectionIndex);
498 }
499 else if (forwardedConnectionList[forwardedConnectionIndex].intermediaryGuid==rakNetGUID && forwardedConnectionList[forwardedConnectionIndex].weInitiatedForwarding)
500 {
501 // Lost connection to intermediary. Restart process to connect to endpoint. If failed, push ID_CONNECTION_LOST. Also remove connection request if it already is in the list, to restart it
502 connectionRequestsMutex.Lock();
503 unsigned int pos = GetConnectionRequestIndex(forwardedConnectionList[forwardedConnectionIndex].endpointGuid);
504 if((unsigned int)-1 != pos) { SLNet::OP_DELETE(connectionRequests[pos], __FILE__, __LINE__); connectionRequests.RemoveAtIndexFast(pos);}
505 connectionRequestsMutex.Unlock();
506
507 ConnectInternal(forwardedConnectionList[forwardedConnectionIndex].endpointGuid, true);
508
509 forwardedConnectionIndex++;
510
511 if (debugInterface)
512 {
513 char buff[512];
514 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Closed connection %I64d, restarting forwarding at %s:%i\n",rakNetGUID.g, __FILE__, __LINE__));
515 }
516
517 // This should not be removed - the connection is still forwarded, but perhaps through another system
518 // forwardedConnectionList.RemoveAtIndexFast(forwardedConnectionIndex);
519 }
520 else
521 forwardedConnectionIndex++;
522 }
523 forwardedConnectionListMutex.Unlock();
524
525 unsigned int connectionRequestIndex=0;
526 connectionRequestsMutex.Lock();
527 while (connectionRequestIndex < connectionRequests.Size())
528 {
529 ConnnectRequest *cr = connectionRequests[connectionRequestIndex];
530 cr->connectionRequestSystemsMutex.Lock();
531 unsigned int connectionRequestGuidIndex = cr->GetGuidIndex(rakNetGUID);
532 if (connectionRequestGuidIndex!=(unsigned int)-1)
533 {
534 cr->connectionRequestSystems.RemoveAtIndexFast(connectionRequestGuidIndex);
535 cr->connectionRequestSystemsMutex.Unlock();
536 if (UpdateForwarding(cr)==false) // If returns false, no connection request systems left
537 {
538 if (debugInterface)
539 {
540 char buff[512];
541 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Aborted connection to the %I64d, aborted forwarding at %s:%i\n", rakNetGUID.g, __FILE__, __LINE__));
542 }
543
544 RemoveConnectionRequest(connectionRequestIndex);
545 }
546 else // Else a system in the connection request list dropped. If cr->requestState==R2RS_REQUEST_STATE_QUERY_FORWARDING then we are still waiting for other systems to respond.
547 {
548 if (debugInterface)
549 {
550 char buff[512];
551 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Aborted connection attempt to %I64d, restarting forwarding to %I64d at %s:%i\n", rakNetGUID.g,cr->endpointGuid.g,__FILE__, __LINE__));
552 }
553 // if(volatile bool is_my_fix_a_truth = true) { // A system in the list of potential systems to try routing to dropped. There is no need to restart the whole process.
554 // connectionRequestsMutex.Lock();
555 // connectionRequests.RemoveAtIndexFast(connectionRequestIndex);
556 // connectionRequestsMutex.Unlock();
557 //
558 // if(false == ConnectInternal(cr->endpointGuid,cr->returnConnectionLostOnFailure))
559 // if (debugInterface)
560 // {
561 // char buff[512];
562 // debugInterface->ShowDiagnostic(FormatStringTS(buff,"ConnectInternal(cr->endpointGuid,cr->returnConnectionLostOnFailure) is false. at %s:%i\n", __FILE__, __LINE__));
563 // }
564 // }
565
566 connectionRequestIndex++;
567 }
568 }
569 else
570 {
571 cr->connectionRequestSystemsMutex.Unlock();
572 connectionRequestIndex++;
573 }
574 }
575 connectionRequestsMutex.Unlock();
576
577
578 unsigned int i=0;
579 miniPunchesInProgressMutex.Lock();
580 while (i < miniPunchesInProgress.Size())
581 {
582 if (miniPunchesInProgress[i].sourceGuid==rakNetGUID || miniPunchesInProgress[i].endpointGuid==rakNetGUID)
583 {
584 if (miniPunchesInProgress[i].sourceGuid!=rakNetGUID)
585 {
586 SendFailureOnCannotForward(miniPunchesInProgress[i].sourceGuid, miniPunchesInProgress[i].endpointGuid);
587 }
588 miniPunchesInProgress.RemoveAtIndexFast(i);
589 }
590 else
591 i++;
592 }
593 miniPunchesInProgressMutex.Unlock();
594 }
595 void Router2::OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
596 {
597 (void) failedConnectionAttemptReason;
598 (void) packet;
599
600 unsigned int forwardedConnectionIndex=0;
601 forwardedConnectionListMutex.Lock();
602 while (forwardedConnectionIndex<forwardedConnectionList.Size())
603 {
604 if (forwardedConnectionList[forwardedConnectionIndex].intermediaryAddress==packet->systemAddress)
605 {
606 if (debugInterface)
607 {
608 char buff[512];
609 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Failed connection attempt to forwarded system (%I64d : %s) at %s:%i\n",
610 forwardedConnectionList[forwardedConnectionIndex].endpointGuid.g, packet->systemAddress.ToString(true), __FILE__, __LINE__));
611 }
612
613 packet->guid=forwardedConnectionList[forwardedConnectionIndex].endpointGuid;
614 forwardedConnectionList.RemoveAtIndexFast(forwardedConnectionIndex);
615 }
616 else
617 forwardedConnectionIndex++;
618 }
619 forwardedConnectionListMutex.Unlock();
620 }
621 void Router2::OnRakPeerShutdown(void)
622 {
623 ClearAll();
624 }
625 // connectionRequestsMutex should already be locked
626 bool Router2::UpdateForwarding(ConnnectRequest* connectionRequest)
627 {
628 connectionRequest->connectionRequestSystemsMutex.Lock();
629
630 // RAKNET_DEBUG_PRINTF(__FUNCTION__": connectionRequest->connectionRequestSystems.Size = %d", connectionRequest->connectionRequestSystems.Size());
631
632 if (connectionRequest->connectionRequestSystems.Size()==0)
633 {
634 connectionRequest->connectionRequestSystemsMutex.Unlock();
635
636 // printf("Router2 failed at %s:%i\n", __FILE__, __LINE__);
637 if (connectionRequest->returnConnectionLostOnFailure) {
638 ReturnToUser(ID_CONNECTION_LOST, connectionRequest->endpointGuid, UNASSIGNED_SYSTEM_ADDRESS, true); // This is a connection which was previously established. Rerouting is not possible.
639 // bool sendDisconnectionNotification = false;
640 // rakPeerInterface->CloseConnection(rakPeerInterface->GetSystemAddressFromGuid(connectionRequest->endpointGuid), sendDisconnectionNotification);
641 // RAKNET_DEBUG_PRINTF(__FUNCTION__": call rakPeerInterface->CloseConnection(%I64d)" , connectionRequest->endpointGuid.g);
642 }
643 else
644 ReturnToUser(ID_ROUTER_2_FORWARDING_NO_PATH, connectionRequest->endpointGuid, UNASSIGNED_SYSTEM_ADDRESS, false);
645
646 if (debugInterface)
647 {
648 char buff[512];
649 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Forwarding failed, no remaining systems at %s:%i\n", _FILE_AND_LINE_));
650 }
651
652 forwardedConnectionListMutex.Lock();
653
654 for (unsigned int forwardedConnectionIndex=0; forwardedConnectionIndex < forwardedConnectionList.Size(); forwardedConnectionIndex++)
655 {
656 if (forwardedConnectionList[forwardedConnectionIndex].endpointGuid==connectionRequest->endpointGuid && forwardedConnectionList[forwardedConnectionIndex].weInitiatedForwarding)
657 {
658 forwardedConnectionList.RemoveAtIndexFast(forwardedConnectionIndex);
659 break;
660 }
661 }
662 forwardedConnectionListMutex.Unlock();
663
664 return false;
665 }
666 connectionRequest->connectionRequestSystemsMutex.Unlock();
667
668 if (connectionRequest->requestState==R2RS_REQUEST_STATE_QUERY_FORWARDING)
669 {
670 connectionRequest->connectionRequestSystemsMutex.Lock();
671
672 for (unsigned int i=0; i < connectionRequest->connectionRequestSystems.Size(); i++)
673 {
674 if (connectionRequest->connectionRequestSystems[i].pingToEndpoint<0)
675 {
676 connectionRequest->connectionRequestSystemsMutex.Unlock();
677 return true; // Forward query still in progress, just return
678 }
679 }
680 connectionRequest->connectionRequestSystemsMutex.Unlock();
681
682 RequestForwarding(connectionRequest);
683 }
684 // else if (connectionRequest->requestState==REQUEST_STATE_REQUEST_FORWARDING)
685 // {
686 // RequestForwarding(connectionRequestIndex);
687 // }
688
689 return true;
690 }
691 // connectionRequestsMutex should already be locked
692 void Router2::RemoveConnectionRequest(unsigned int connectionRequestIndex)
693 {
694 SLNet::OP_DELETE(connectionRequests[connectionRequestIndex],_FILE_AND_LINE_);
695 connectionRequests.RemoveAtIndexFast(connectionRequestIndex);
696 }
697 int ConnectionRequestSystemComp( const Router2::ConnectionRequestSystem & key, const Router2::ConnectionRequestSystem &data )
698 {
699 if (key.pingToEndpoint * (key.usedForwardingEntries+1) < data.pingToEndpoint * (data.usedForwardingEntries+1))
700 return -1;
701 if (key.pingToEndpoint * (key.usedForwardingEntries+1) == data.pingToEndpoint * (data.usedForwardingEntries+1))
702 return 1;
703 if (key.guid < data.guid)
704 return -1;
705 if (key.guid > data.guid)
706 return -1;
707 return 0;
708 }
709 // connectionRequestsMutex should already be locked
710 void Router2::RequestForwarding(ConnnectRequest* connectionRequest)
711 {
712 RakAssert(connectionRequest->requestState==R2RS_REQUEST_STATE_QUERY_FORWARDING);
713 connectionRequest->requestState=REQUEST_STATE_REQUEST_FORWARDING;
714
715 if (connectionRequest->GetGuidIndex(connectionRequest->lastRequestedForwardingSystem)!=(unsigned int)-1)
716 {
717 char buff[512];
718 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed at %s:%i\n", _FILE_AND_LINE_));
719 return;
720 }
721
722 // Prioritize systems to request forwarding
723 DataStructures::OrderedList<ConnectionRequestSystem, ConnectionRequestSystem, ConnectionRequestSystemComp> commandList;
724 unsigned int connectionRequestGuidIndex;
725 connectionRequest->connectionRequestSystemsMutex.Lock();
726 for (connectionRequestGuidIndex=0; connectionRequestGuidIndex < connectionRequest->connectionRequestSystems.Size(); connectionRequestGuidIndex++)
727 {
728 RakAssert(connectionRequest->connectionRequestSystems[connectionRequestGuidIndex].pingToEndpoint>=0);
729 commandList.Insert(connectionRequest->connectionRequestSystems[connectionRequestGuidIndex],
730 connectionRequest->connectionRequestSystems[connectionRequestGuidIndex],
731 true,
732 _FILE_AND_LINE_);
733 }
734 connectionRequest->connectionRequestSystemsMutex.Unlock();
735
736 connectionRequest->lastRequestedForwardingSystem=commandList[0].guid;
737
738 SLNet::BitStream bsOut;
739 bsOut.Write((MessageID)ID_ROUTER_2_INTERNAL);
740 bsOut.Write((unsigned char) ID_ROUTER_2_REQUEST_FORWARDING);
741 bsOut.Write(connectionRequest->endpointGuid);
742 rakPeerInterface->Send(&bsOut,MEDIUM_PRIORITY,RELIABLE_ORDERED,0,connectionRequest->lastRequestedForwardingSystem,false);
743
744 if (debugInterface)
745 {
746 char buff[512];
747 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Sending ID_ROUTER_2_REQUEST_FORWARDING "
748 "(connectionRequest->lastRequestedForwardingSystem = %I64d, connectionRequest->endpointGuid = %I64d) at %s:%i\n",
749 connectionRequest->lastRequestedForwardingSystem.g,connectionRequest->endpointGuid.g, __FILE__, __LINE__));
750 }
751 }
752 void Router2::SendFailureOnCannotForward(RakNetGUID sourceGuid, RakNetGUID endpointGuid)
753 {
754 SLNet::BitStream bsOut;
755 bsOut.Write((MessageID)ID_ROUTER_2_INTERNAL);
756 bsOut.Write((unsigned char) ID_ROUTER_2_REPLY_FORWARDING);
757 bsOut.Write(endpointGuid);
758 bsOut.Write(false);
759 rakPeerInterface->Send(&bsOut,MEDIUM_PRIORITY,RELIABLE_ORDERED,0,sourceGuid,false);
760 }
761 int Router2::ReturnFailureOnCannotForward(RakNetGUID sourceGuid, RakNetGUID endpointGuid)
762 {
763 // If the number of systems we are currently forwarding>=maxForwarding, return ID_ROUTER_2_REPLY_FORWARDING,endpointGuid,false
764 if (udpForwarder==0 || udpForwarder->GetUsedForwardEntries()/2>maximumForwardingRequests)
765 {
766 char buff[512];
767 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed (%I64d -> %I64d) at %s:%i\n",
768 sourceGuid.g, endpointGuid.g,__FILE__, __LINE__));
769 SendFailureOnCannotForward(sourceGuid,endpointGuid);
770 return -1;
771 }
772
773 // We cannot forward connections which are themselves forwarded. Return fail in that case
774 forwardedConnectionListMutex.Lock();
775 for (unsigned int i=0; i < forwardedConnectionList.Size(); i++)
776 {
777 if ((forwardedConnectionList[i].endpointGuid==endpointGuid)
778 || (forwardedConnectionList[i].endpointGuid==sourceGuid)) // sourceGuid is here so you do not respond to routing requests from systems you are already routing through.
779 {
780 forwardedConnectionListMutex.Unlock();
781
782 char buff[512];
783 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed at %s:%i\n", __FILE__, __LINE__));
784 SendFailureOnCannotForward(sourceGuid,endpointGuid);
785 return -1;
786 }
787 }
788 forwardedConnectionListMutex.Unlock();
789
790 int pingToEndpoint;
791 pingToEndpoint = rakPeerInterface->GetAveragePing(endpointGuid);
792 if (pingToEndpoint==-1)
793 {
794 char buff[512];
795 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed (%I64d -> %I64d) at %s:%i\n",
796 sourceGuid.g, endpointGuid.g,__FILE__, __LINE__));
797
798 SendFailureOnCannotForward(sourceGuid,endpointGuid);
799 return -1;
800 }
801 return pingToEndpoint;
802 }
803 void Router2::OnQueryForwarding(Packet *packet)
804 {
805 SLNet::BitStream bs(packet->data, packet->length, false);
806 bs.IgnoreBytes(sizeof(MessageID) + sizeof(unsigned char));
807 RakNetGUID endpointGuid;
808 // Read endpointGuid
809 bs.Read(endpointGuid);
810
811 int pingToEndpoint = ReturnFailureOnCannotForward(packet->guid, endpointGuid);
812 if (pingToEndpoint==-1)
813 {
814 char buff[512];
815 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed (%I64d) at %s:%i\n", packet->guid.g, __FILE__, __LINE__));
816 return;
817 }
818
819 // If we are connected to endpointGuid, reply ID_ROUTER_2_REPLY_FORWARDING,endpointGuid,true,ping,numCurrentlyForwarding
820 SLNet::BitStream bsOut;
821 bsOut.Write((MessageID)ID_ROUTER_2_INTERNAL);
822 bsOut.Write((unsigned char) ID_ROUTER_2_REPLY_FORWARDING);
823 bsOut.Write(endpointGuid);
824 bsOut.Write(true);
825 bsOut.Write((unsigned short) pingToEndpoint);
826 bsOut.Write((unsigned short) udpForwarder->GetUsedForwardEntries()/2);
827 rakPeerInterface->Send(&bsOut,MEDIUM_PRIORITY,RELIABLE_ORDERED,0,packet->guid,false);
828
829 if (debugInterface)
830 {
831 char buff[512];
832 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Sending ID_ROUTER_2_REPLY_FORWARDING to the %I64d at %s:%i\n", packet->guid.g, __FILE__, __LINE__));
833 }
834 }
835 void Router2::OnQueryForwardingReply(Packet *packet)
836 {
837 SLNet::BitStream bs(packet->data, packet->length, false);
838 bs.IgnoreBytes(sizeof(MessageID) + sizeof(unsigned char));
839 RakNetGUID endpointGuid;
840 bs.Read(endpointGuid);
841 // Find endpointGuid among stored requests
842 bool canForward=false;
843 bs.Read(canForward);
844
845
846 connectionRequestsMutex.Lock();
847 unsigned int connectionRequestIndex = GetConnectionRequestIndex(endpointGuid);
848 if (connectionRequestIndex==(unsigned int)-1)
849 {
850 connectionRequestsMutex.Unlock();
851 char buff[512];
852 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed (%I64d) at %s:%i\n", endpointGuid.g, __FILE__, __LINE__));
853 return;
854 }
855
856 connectionRequests[connectionRequestIndex]->connectionRequestSystemsMutex.Lock();
857 unsigned int connectionRequestGuidIndex = connectionRequests[connectionRequestIndex]->GetGuidIndex(packet->guid);
858 if (connectionRequestGuidIndex==(unsigned int)-1)
859 {
860 connectionRequests[connectionRequestIndex]->connectionRequestSystemsMutex.Unlock();
861 connectionRequestsMutex.Unlock();
862 char buff[512];
863 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed (%I64d) at %s:%i\n", endpointGuid.g, __FILE__, __LINE__));
864 return;
865 }
866
867 if (debugInterface)
868 {
869 char buff[512];
870 char buff2[512];
871 packet->systemAddress.ToString(true,buff2,static_cast<size_t>(512));
872 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_REPLY_FORWARDING on address %s(%I64d -> %I64d) canForward=%i at %s:%i\n",
873 buff2, packet->guid.g, endpointGuid.g, canForward, __FILE__, __LINE__));
874 }
875
876 if (canForward)
877 {
878 unsigned short pingToEndpoint;
879 unsigned short usedEntries;
880 bs.Read(pingToEndpoint);
881 bs.Read(usedEntries);
882 connectionRequests[connectionRequestIndex]->connectionRequestSystems[connectionRequestGuidIndex].usedForwardingEntries=usedEntries;
883 connectionRequests[connectionRequestIndex]->connectionRequestSystems[connectionRequestGuidIndex].pingToEndpoint=rakPeerInterface->GetAveragePing(packet->guid)+pingToEndpoint;
884 }
885 else
886 {
887 connectionRequests[connectionRequestIndex]->connectionRequestSystems.RemoveAtIndex(connectionRequestGuidIndex);
888 }
889 connectionRequests[connectionRequestIndex]->connectionRequestSystemsMutex.Unlock();
890
891 if (UpdateForwarding(connectionRequests[connectionRequestIndex])==false)
892 {
893 RemoveConnectionRequest(connectionRequestIndex);
894 }
895 connectionRequestsMutex.Unlock();
896 }
897 void Router2::SendForwardingSuccess(MessageID messageId, RakNetGUID sourceGuid, RakNetGUID endpointGuid, unsigned short sourceToDstPort)
898 {
899 SLNet::BitStream bsOut;
900 bsOut.Write(messageId);
901 bsOut.Write(endpointGuid);
902 bsOut.Write(sourceToDstPort);
903 rakPeerInterface->Send(&bsOut,MEDIUM_PRIORITY,RELIABLE_ORDERED,0,sourceGuid,false);
904
905 if (debugInterface)
906 {
907 char buff[512];
908 if (messageId==ID_ROUTER_2_FORWARDING_ESTABLISHED)
909 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Sending ID_ROUTER_2_FORWARDING_ESTABLISHED at %s:%i\n", _FILE_AND_LINE_ ));
910 else
911 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Sending ID_ROUTER_2_REROUTED at %s:%i\n", _FILE_AND_LINE_ ));
912 }
913 }
914 void Router2::SendOOBFromRakNetPort(OutOfBandIdentifiers oob, BitStream *extraData, SystemAddress sa)
915 {
916 SLNet::BitStream oobBs;
917 oobBs.Write((unsigned char)oob);
918 if (extraData)
919 {
920 extraData->ResetReadPointer();
921 oobBs.Write(*extraData);
922 }
923 char ipAddressString[32];
924 sa.ToString(false, ipAddressString,static_cast<size_t>(32));
925 rakPeerInterface->SendOutOfBand((const char*) ipAddressString,sa.GetPort(),(const char*) oobBs.GetData(),oobBs.GetNumberOfBytesUsed());
926 }
927 void Router2::SendOOBFromSpecifiedSocket(OutOfBandIdentifiers oob, SystemAddress sa, __UDPSOCKET__ socket)
928 {
929 SLNet::BitStream bs;
930 rakPeerInterface->WriteOutOfBandHeader(&bs);
931 bs.Write((unsigned char) oob);
932 // SocketLayer::SendTo_PC( socket, (const char*) bs.GetData(), bs.GetNumberOfBytesUsed(), sa, __FILE__, __LINE__ );
933
934
935 if (sa.address.addr4.sin_family==AF_INET)
936 {
937 sendto__( socket, (const char*) bs.GetData(), bs.GetNumberOfBytesUsed(), 0, ( const sockaddr* ) & sa.address.addr4, sizeof( sockaddr_in ) );
938 }
939 else
940 {
941 #if RAKNET_SUPPORT_IPV6==1
942 sendto__( socket, (const char*) bs.GetData(), bs.GetNumberOfBytesUsed(), 0, ( const sockaddr* ) & sa.address.addr6, sizeof( sockaddr_in6 ) );
943 #endif
944 }
945
946
947
948
949
950
951
952
953
954
955
956
957 }
958 void Router2::SendOOBMessages(Router2::MiniPunchRequest *mpr)
959 {
960 // Mini NAT punch
961 // Send from srcToDestPort to packet->systemAddress (source). If the message arrives, the remote system should reply.
962 SendOOBFromSpecifiedSocket(ID_ROUTER_2_REPLY_TO_SENDER_PORT, mpr->sourceAddress, mpr->forwardingSocket);
963
964 // Send from destToSourcePort to endpointSystemAddress (destination). If the message arrives, the remote system should reply.
965 SendOOBFromSpecifiedSocket(ID_ROUTER_2_REPLY_TO_SENDER_PORT, mpr->endpointAddress, mpr->forwardingSocket);
966
967
968 if (debugInterface) {
969 char buff [512];
970
971 char buff2[128];
972
973 mpr->sourceAddress .ToString(true,buff2,static_cast<size_t>(128));
974
975 debugInterface->ShowDiagnostic(FormatStringTS(buff,"call SendOOBFromSpecifiedSocket(...,%s,...)", buff2));
976
977 mpr->endpointAddress .ToString(true,buff2,static_cast<size_t>(128));
978
979 debugInterface->ShowDiagnostic(FormatStringTS(buff,"call SendOOBFromSpecifiedSocket(...,%s,...)", buff2));
980 }
981
982 // Tell source to send to forwardingPort
983 SLNet::BitStream extraData;
984 extraData.Write(mpr->forwardingPort);
985 RakAssert(mpr->forwardingPort!=0);
986 SendOOBFromRakNetPort(ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT, &extraData, mpr->sourceAddress);
987
988 // Tell destination to send to forwardingPort
989 extraData.Reset();
990 extraData.Write(mpr->forwardingPort);
991 RakAssert(mpr->forwardingPort);
992 SendOOBFromRakNetPort(ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT, &extraData, mpr->endpointAddress);
993 }
994 void Router2::OnRequestForwarding(Packet *packet)
995 {
996 SLNet::BitStream bs(packet->data, packet->length, false);
997 bs.IgnoreBytes(sizeof(MessageID) + sizeof(unsigned char));
998 RakNetGUID endpointGuid;
999 bs.Read(endpointGuid);
1000
1001 int pingToEndpoint = ReturnFailureOnCannotForward(packet->guid, endpointGuid);
1002 if (pingToEndpoint==-1)
1003 {
1004 char buff[512];
1005 if (debugInterface) debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed (packet->guid =%I64d, endpointGuid = %I64d) at %s:%i\n",
1006 packet->guid.g, endpointGuid.g, __FILE__, __LINE__));
1007 return;
1008 }
1009
1010 unsigned short forwardingPort=0;
1011 __UDPSOCKET__ forwardingSocket=INVALID_SOCKET;
1012 SystemAddress endpointSystemAddress = rakPeerInterface->GetSystemAddressFromGuid(endpointGuid);
1013 UDPForwarderResult result = udpForwarder->StartForwarding(
1014 packet->systemAddress, endpointSystemAddress, 30000, 0, socketFamily,
1015 &forwardingPort, &forwardingSocket);
1016
1017 if (result==UDPFORWARDER_FORWARDING_ALREADY_EXISTS)
1018 {
1019 if (debugInterface)
1020 {
1021 char buff[512];
1022 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_REQUEST_FORWARDING, result=UDPFORWARDER_FORWARDING_ALREADY_EXISTS "
1023 "(packet->guid =%I64d, endpointGuid = %I64d) at %s:%i\n",
1024 packet->guid.g, endpointGuid.g,__FILE__, __LINE__));
1025 }
1026
1027 SendForwardingSuccess(ID_ROUTER_2_FORWARDING_ESTABLISHED, packet->guid, endpointGuid, forwardingPort);
1028 }
1029 else if (result==UDPFORWARDER_NO_SOCKETS)
1030 {
1031 char buff[512];
1032 char buff2[64];
1033 char buff3[64];
1034 packet->systemAddress.ToString(true,buff2,static_cast<size_t>(64));
1035 endpointSystemAddress.ToString(true,buff3,static_cast<size_t>(64));
1036 if (debugInterface)
1037 debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed at %s:%i with UDPFORWARDER_NO_SOCKETS, packet->systemAddress=%s, endpointSystemAddress=%s, forwardingPort=%i, forwardingSocket=%i\n",
1038 __FILE__, __LINE__, buff2, buff3, forwardingPort, forwardingSocket));
1039 SendFailureOnCannotForward(packet->guid, endpointGuid);
1040 }
1041 else if (result==UDPFORWARDER_INVALID_PARAMETERS)
1042 {
1043 char buff[512];
1044 char buff2[64];
1045 char buff3[64];
1046 packet->systemAddress.ToString(true,buff2,static_cast<size_t>(64));
1047 endpointSystemAddress.ToString(true,buff3,static_cast<size_t>(64));
1048 if (debugInterface)
1049 debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed at %s:%i with UDPFORWARDER_INVALID_PARAMETERS, packet->systemAddress=%s, endpointSystemAddress=%s, forwardingPort=%i, forwardingSocket=%i\n",
1050 __FILE__, __LINE__, buff2, buff3, forwardingPort, forwardingSocket));
1051 SendFailureOnCannotForward(packet->guid, endpointGuid);
1052 }
1053 else if (result==UDPFORWARDER_BIND_FAILED)
1054 {
1055 char buff[512];
1056 char buff2[64];
1057 char buff3[64];
1058 packet->systemAddress.ToString(true,buff2,static_cast<size_t>(64));
1059 endpointSystemAddress.ToString(true,buff3,static_cast<size_t>(64));
1060 if (debugInterface)
1061 debugInterface->ShowFailure(FormatStringTS(buff,"Router2 failed at %s:%i with UDPFORWARDER_BIND_FAILED, packet->systemAddress=%s, endpointSystemAddress=%s, forwardingPort=%i, forwardingSocket=%i\n",
1062 __FILE__, __LINE__, buff2, buff3, forwardingPort, forwardingSocket));
1063 SendFailureOnCannotForward(packet->guid, endpointGuid);
1064 }
1065 else
1066 {
1067 if (debugInterface)
1068 {
1069 char buff2[32];
1070 char buff3[32];
1071 endpointSystemAddress.ToString(true,buff2,static_cast<size_t>(32));
1072 packet->systemAddress.ToString(true,buff3,static_cast<size_t>(32));
1073 char buff[512];
1074 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_REQUEST_FORWARDING.\n"
1075 "endpointAddress=%s\nsourceAddress=%s\nforwardingPort=%i\n "
1076 "calling SendOOBMessages at %s:%i\n", buff2,buff3,forwardingPort,_FILE_AND_LINE_));
1077 }
1078
1079 // Store the punch request
1080 MiniPunchRequest miniPunchRequest;
1081 miniPunchRequest.endpointAddress=endpointSystemAddress;
1082 miniPunchRequest.endpointGuid=endpointGuid;
1083 miniPunchRequest.gotReplyFromEndpoint=false;
1084 miniPunchRequest.gotReplyFromSource=false;
1085 miniPunchRequest.sourceGuid=packet->guid;
1086 miniPunchRequest.sourceAddress=packet->systemAddress;
1087 miniPunchRequest.forwardingPort=forwardingPort;
1088 miniPunchRequest.forwardingSocket=forwardingSocket;
1089 int ping1 = rakPeerInterface->GetAveragePing(packet->guid);
1090 int ping2 = rakPeerInterface->GetAveragePing(endpointGuid);
1091 if (ping1>ping2)
1092 miniPunchRequest.timeout= SLNet::GetTimeMS() + ping1*8+300;
1093 else
1094 miniPunchRequest.timeout= SLNet::GetTimeMS() + ping2*8+300;
1095 miniPunchRequest.nextAction= SLNet::GetTimeMS()+100;
1096 SendOOBMessages(&miniPunchRequest);
1097 miniPunchesInProgressMutex.Lock();
1098 miniPunchesInProgress.Push(miniPunchRequest,_FILE_AND_LINE_);
1099 miniPunchesInProgressMutex.Unlock();
1100 }
1101 }
1102 void Router2::OnMiniPunchReplyBounce(Packet *packet)
1103 {
1104 // Find stored punch request
1105 unsigned int i=0;
1106
1107 if (debugInterface)
1108 {
1109 char buff[512];
1110 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE from guid=%I64d (miniPunchesInProgress.Size() = %d)",
1111 packet->guid.g, miniPunchesInProgress.Size()));
1112 }
1113
1114 miniPunchesInProgressMutex.Lock();
1115 while (i < miniPunchesInProgress.Size())
1116 {
1117 if (miniPunchesInProgress[i].sourceGuid==packet->guid || miniPunchesInProgress[i].endpointGuid==packet->guid)
1118 {
1119 if (miniPunchesInProgress[i].sourceGuid==packet->guid)
1120 miniPunchesInProgress[i].gotReplyFromSource=true;
1121 if (miniPunchesInProgress[i].endpointGuid==packet->guid)
1122 miniPunchesInProgress[i].gotReplyFromEndpoint=true;
1123
1124 if (debugInterface)
1125 {
1126 char buff[512];
1127 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Processing ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE, gotReplyFromSource=%i gotReplyFromEndpoint=%i at %s:%i\n", miniPunchesInProgress[i].gotReplyFromSource, miniPunchesInProgress[i].gotReplyFromEndpoint, __FILE__, __LINE__));
1128 }
1129
1130 if (miniPunchesInProgress[i].gotReplyFromEndpoint==true &&
1131 miniPunchesInProgress[i].gotReplyFromSource==true)
1132 {
1133 SendForwardingSuccess(ID_ROUTER_2_REROUTED, miniPunchesInProgress[i].endpointGuid, miniPunchesInProgress[i].sourceGuid, miniPunchesInProgress[i].forwardingPort);
1134 SendForwardingSuccess(ID_ROUTER_2_FORWARDING_ESTABLISHED, miniPunchesInProgress[i].sourceGuid, miniPunchesInProgress[i].endpointGuid, miniPunchesInProgress[i].forwardingPort);
1135 miniPunchesInProgress.RemoveAtIndexFast(i);
1136 }
1137 else
1138 {
1139 i++;
1140 }
1141 }
1142 else
1143 i++;
1144 }
1145 miniPunchesInProgressMutex.Unlock();
1146 }
1147 void Router2::OnMiniPunchReply(Packet *packet)
1148 {
1149 SLNet::BitStream bs(packet->data, packet->length, false);
1150 bs.IgnoreBytes(sizeof(MessageID) + sizeof(unsigned char));
1151 RakNetGUID routerGuid;
1152 bs.Read(routerGuid);
1153 SendOOBFromRakNetPort(ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE, 0, rakPeerInterface->GetSystemAddressFromGuid(routerGuid));
1154
1155 if (debugInterface)
1156 {
1157 char buff[512];
1158
1159 char buff2[512];
1160
1161 rakPeerInterface->GetSystemAddressFromGuid(routerGuid).ToString(true,buff2,static_cast<size_t>(512));
1162
1163 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Sending ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE (%s) at %s:%i\n", buff2, __FILE__, __LINE__));
1164 }
1165 }
1166 void Router2::OnRerouted(Packet *packet)
1167 {
1168 SLNet::BitStream bs(packet->data, packet->length, false);
1169 bs.IgnoreBytes(sizeof(MessageID));
1170 RakNetGUID endpointGuid;
1171 bs.Read(endpointGuid);
1172 unsigned short sourceToDestPort;
1173 bs.Read(sourceToDestPort);
1174
1175 // Return rerouted notice
1176 SystemAddress intermediaryAddress=packet->systemAddress;
1177 intermediaryAddress.SetPortHostOrder(sourceToDestPort);
1178 rakPeerInterface->ChangeSystemAddress(endpointGuid, intermediaryAddress);
1179
1180 unsigned int forwardingIndex;
1181 forwardedConnectionListMutex.Lock();
1182 for (forwardingIndex=0; forwardingIndex < forwardedConnectionList.Size(); forwardingIndex++)
1183 {
1184 if (forwardedConnectionList[forwardingIndex].endpointGuid==endpointGuid)
1185 break;
1186 }
1187
1188 if (forwardingIndex<forwardedConnectionList.Size())
1189 {
1190 ForwardedConnection& ref_fc = forwardedConnectionList[forwardingIndex];
1191 forwardedConnectionListMutex.Unlock();
1192
1193 ref_fc.intermediaryAddress = packet->systemAddress;
1194 ref_fc.intermediaryAddress.SetPortHostOrder(sourceToDestPort);
1195 ref_fc.intermediaryGuid = packet->guid;
1196
1197 rakPeerInterface->ChangeSystemAddress(endpointGuid, intermediaryAddress);
1198
1199 if (debugInterface)
1200 {
1201 char buff[512];
1202 debugInterface->ShowDiagnostic(FormatStringTS(buff,"FIX: Got ID_ROUTER_2_REROUTE, returning ID_ROUTER_2_REROUTED,"
1203 " Calling RakPeer::ChangeSystemAddress(%I64d, %s) at %s:%i\n",endpointGuid.g, intermediaryAddress.ToString(true), __FILE__, __LINE__));
1204 }
1205 }
1206 else
1207 {
1208 ForwardedConnection fc;
1209 fc.endpointGuid=endpointGuid;
1210 fc.intermediaryAddress=packet->systemAddress;
1211 fc.intermediaryAddress.SetPortHostOrder(sourceToDestPort);
1212 fc.intermediaryGuid=packet->guid;
1213 fc.weInitiatedForwarding=false;
1214 // add to forwarding list. This is only here to avoid reporting direct connections in Router2::ReturnFailureOnCannotForward
1215 forwardedConnectionList.Push (fc,__FILE__, __LINE__);
1216 forwardedConnectionListMutex.Unlock();
1217
1218 rakPeerInterface->ChangeSystemAddress(endpointGuid, intermediaryAddress);
1219
1220 if (debugInterface)
1221 {
1222 char buff[512];
1223 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_REROUTE, returning ID_ROUTER_2_REROUTED, Calling RakPeer::ChangeSystemAddress at %s:%i\n", __FILE__, __LINE__));
1224 }
1225 }
1226
1227 }
1228 bool Router2::OnForwardingSuccess(Packet *packet)
1229 {
1230 SLNet::BitStream bs(packet->data, packet->length, false);
1231 bs.IgnoreBytes(sizeof(MessageID));
1232 RakNetGUID endpointGuid;
1233 bs.Read(endpointGuid);
1234 unsigned short sourceToDestPort;
1235 bs.Read(sourceToDestPort);
1236
1237 unsigned int forwardingIndex;
1238 forwardedConnectionListMutex.Lock();
1239 for (forwardingIndex=0; forwardingIndex < forwardedConnectionList.Size(); forwardingIndex++)
1240 {
1241 if (forwardedConnectionList[forwardingIndex].endpointGuid==endpointGuid)
1242 break;
1243 }
1244
1245 if (forwardingIndex<forwardedConnectionList.Size())
1246 {
1247 // Return rerouted notice
1248 SystemAddress intermediaryAddress=packet->systemAddress;
1249 intermediaryAddress.SetPortHostOrder(sourceToDestPort);
1250 rakPeerInterface->ChangeSystemAddress(endpointGuid, intermediaryAddress);
1251
1253 ForwardedConnection& ref_fc = forwardedConnectionList[forwardingIndex];
1254 ref_fc.intermediaryAddress = packet->systemAddress;
1255 ref_fc.intermediaryAddress.SetPortHostOrder(sourceToDestPort);
1256 ref_fc.intermediaryGuid = packet->guid;
1258
1259 if (debugInterface)
1260 {
1261 char buff[512];
1262 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got ID_ROUTER_2_FORWARDING_ESTABLISHED, returning ID_ROUTER_2_REROUTED, Calling RakPeer::ChangeSystemAddress at %s:%i\n", _FILE_AND_LINE_));
1263 }
1264
1265 packet->data[0]=ID_ROUTER_2_REROUTED;
1266
1267 forwardedConnectionListMutex.Unlock();
1268 return true; // Return packet to user
1269 }
1270 else
1271 {
1272 forwardedConnectionListMutex.Unlock();
1273
1274 // removeFrom connectionRequests;
1275 ForwardedConnection fc;
1276 connectionRequestsMutex.Lock();
1277 unsigned int connectionRequestIndex = GetConnectionRequestIndex(endpointGuid);
1278 fc.returnConnectionLostOnFailure=connectionRequests[connectionRequestIndex]->returnConnectionLostOnFailure;
1279 connectionRequests.RemoveAtIndexFast(connectionRequestIndex);
1280 connectionRequestsMutex.Unlock();
1281 fc.endpointGuid=endpointGuid;
1282 fc.intermediaryAddress=packet->systemAddress;
1283 fc.intermediaryAddress.SetPortHostOrder(sourceToDestPort);
1284 fc.intermediaryGuid=packet->guid;
1285 fc.weInitiatedForwarding=true;
1286
1287 // add to forwarding list
1288 forwardedConnectionListMutex.Lock();
1289 forwardedConnectionList.Push (fc,_FILE_AND_LINE_);
1290 forwardedConnectionListMutex.Unlock();
1291
1292 if (debugInterface)
1293 {
1294 char buff[512];
1295 debugInterface->ShowDiagnostic(FormatStringTS(buff,"Got and returning to user ID_ROUTER_2_FORWARDING_ESTABLISHED at %s:%i\n", _FILE_AND_LINE_));
1296 }
1297
1298 }
1299 return true; // Return packet to user
1300 }
1301 int Router2::GetLargestPingAmongConnectedSystems(void) const
1302 {
1303 int avePing;
1304 int largestPing=-1;
1305 unsigned int maxPeers = rakPeerInterface->GetMaximumNumberOfPeers();
1306 if (maxPeers==0)
1307 return 9999;
1308 unsigned int index;
1309 for (index=0; index < rakPeerInterface->GetMaximumNumberOfPeers(); index++)
1310 {
1311 RakNetGUID g = rakPeerInterface->GetGUIDFromIndex(index);
1312 if (g!=UNASSIGNED_RAKNET_GUID)
1313 {
1314 avePing=rakPeerInterface->GetAveragePing(rakPeerInterface->GetGUIDFromIndex(index));
1315 if (avePing>largestPing)
1316 largestPing=avePing;
1317 }
1318 }
1319 return largestPing;
1320 }
1321
1322 unsigned int Router2::GetConnectionRequestIndex(RakNetGUID endpointGuid)
1323 {
1324 unsigned int i;
1325 for (i=0; i < connectionRequests.Size(); i++)
1326 {
1327 if (connectionRequests[i]->endpointGuid==endpointGuid)
1328 return i;
1329 }
1330 return (unsigned int) -1;
1331 }
1332 unsigned int Router2::ConnnectRequest::GetGuidIndex(RakNetGUID guid)
1333 {
1334 unsigned int i;
1335 for (i=0; i < connectionRequestSystems.Size(); i++)
1336 {
1337 if (connectionRequestSystems[i].guid==guid)
1338 return i;
1339 }
1340 return (unsigned int) -1;
1341 }
1342 void Router2::ReturnToUser(MessageID messageId, RakNetGUID endpointGuid, const SystemAddress &systemAddress, bool wasGeneratedLocally)
1343 {
1344 Packet *p = AllocatePacketUnified(sizeof(MessageID)+sizeof(unsigned char));
1345 p->data[0]=messageId;
1346 p->systemAddress=systemAddress;
1347 p->systemAddress.systemIndex=(SystemIndex)-1;
1348 p->guid=endpointGuid;
1349 p->wasGeneratedLocally=wasGeneratedLocally;
1350 rakPeerInterface->PushBackPacket(p, true);
1351 }
1352 void Router2::ClearForwardedConnections(void)
1353 {
1354 forwardedConnectionListMutex.Lock();
1355 forwardedConnectionList.Clear(false,_FILE_AND_LINE_);
1356 forwardedConnectionListMutex.Unlock();
1357 }
1358 void Router2::ClearAll(void)
1359 {
1360 ClearConnectionRequests();
1361 ClearMinipunches();
1362 ClearForwardedConnections();
1363 }
1364 void Router2::SetDebugInterface(Router2DebugInterface *_debugInterface)
1365 {
1366 debugInterface=_debugInterface;
1367 }
1368 Router2DebugInterface *Router2::GetDebugInterface(void) const
1369 {
1370 return debugInterface;
1371 }
1372
1373 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketConsoleLogger.h Source File

  • include
  • slikenet
PacketConsoleLogger.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_LogCommandParser==1 && _RAKNET_SUPPORT_PacketLogger==1
22
23 #ifndef __PACKET_CONSOLE_LOGGER_H_
24 #define __PACKET_CONSOLE_LOGGER_H_
25
26 #include "PacketLogger.h"
27
28 namespace SLNet
29 {
31 class LogCommandParser;
32
35 class RAK_DLL_EXPORT PacketConsoleLogger : public PacketLogger
36 {
37 public:
38 PacketConsoleLogger();
39 // Writes to the command parser used for logging, which is accessed through a secondary communication layer (such as Telnet or RakNet) - See ConsoleServer.h
40 virtual void SetLogCommandParser(LogCommandParser *lcp);
41 virtual void WriteLog(const char *str);
42 protected:
43 LogCommandParser *logCommandParser;
44 };
45
46 } // namespace SLNet
47
48 #endif
49
50 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/LogCommandParser.cpp Source File

  • src
LogCommandParser.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_LogCommandParser==1
18
19 #include "slikenet/LogCommandParser.h"
20 #include "slikenet/TransportInterface.h"
21
22 #include <memory.h>
23
24 #include <stdio.h>
25 #include <string.h>
26 #include <stdarg.h>
27
28 #include "slikenet/LinuxStrings.h"
29 #include "slikenet/linux_adapter.h"
30 #include "slikenet/osx_adapter.h"
31
32 using namespace SLNet;
33
34 STATIC_FACTORY_DEFINITIONS(LogCommandParser,LogCommandParser);
35
36 LogCommandParser::LogCommandParser()
37 {
38 RegisterCommand(CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS,"Subscribe","[<ChannelName>] - Subscribes to a named channel, or all channels");
39 RegisterCommand(CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS,"Unsubscribe","[<ChannelName>] - Unsubscribes from a named channel, or all channels");
40 memset(channelNames,0,sizeof(channelNames));
41 }
42 LogCommandParser::~LogCommandParser()
43 {
44 }
45 bool LogCommandParser::OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)
46 {
47 (void) originalString;
48
49 if (strcmp(command, "Subscribe")==0)
50 {
51 unsigned channelIndex;
52 if (numParameters==0)
53 {
54 Subscribe(systemAddress, 0);
55 transport->Send(systemAddress, "Subscribed to all channels.\r\n");
56 }
57 else if (numParameters==1)
58 {
59 if ((channelIndex=Subscribe(systemAddress, parameterList[0]))!=(unsigned)-1)
60 {
61 transport->Send(systemAddress, "You are now subscribed to channel %s.\r\n", channelNames[channelIndex]);
62 }
63 else
64 {
65 transport->Send(systemAddress, "Cannot find channel %s.\r\n", parameterList[0]);
66 PrintChannels(systemAddress, transport);
67 }
68 }
69 else
70 {
71 transport->Send(systemAddress, "Subscribe takes either 0 or 1 parameters.\r\n");
72 }
73 }
74 else if (strcmp(command, "Unsubscribe")==0)
75 {
76 unsigned channelIndex;
77 if (numParameters==0)
78 {
79 Unsubscribe(systemAddress, 0);
80 transport->Send(systemAddress, "Unsubscribed from all channels.\r\n");
81 }
82 else if (numParameters==1)
83 {
84 if ((channelIndex=Unsubscribe(systemAddress, parameterList[0]))!=(unsigned)-1)
85 {
86 transport->Send(systemAddress, "You are now unsubscribed from channel %s.\r\n", channelNames[channelIndex]);
87 }
88 else
89 {
90 transport->Send(systemAddress, "Cannot find channel %s.\r\n", parameterList[0]);
91 PrintChannels(systemAddress, transport);
92 }
93 }
94 else
95 {
96 transport->Send(systemAddress, "Unsubscribe takes either 0 or 1 parameters.\r\n");
97 }
98 }
99
100 return true;
101 }
102 const char *LogCommandParser::GetName(void) const
103 {
104 return "Logger";
105 }
106 void LogCommandParser::SendHelp(TransportInterface *transport, const SystemAddress &systemAddress)
107 {
108 transport->Send(systemAddress, "The logger will accept user log data via the Log(...) function.\r\n");
109 transport->Send(systemAddress, "Each log is associated with a named channel.\r\n");
110 transport->Send(systemAddress, "You can subscribe to or unsubscribe from named channels.\r\n");
111 PrintChannels(systemAddress, transport);
112 }
113 void LogCommandParser::AddChannel(const char *channelName)
114 {
115 unsigned channelIndex=0;
116 channelIndex = GetChannelIndexFromName(channelName);
117 // Each channel can only be added once.
118 RakAssert(channelIndex==(unsigned)-1);
119
120 unsigned i;
121 for (i=0; i < 32; i++)
122 {
123 if (channelNames[i]==0)
124 {
125 // Assuming a persistent static string.
126 channelNames[i]=channelName;
127 return;
128 }
129 }
130
131 // No more available channels - max 32 with this implementation where I save subscribed channels with bit operations
132 RakAssert(0);
133 }
134 void LogCommandParser::WriteLog(const char *channelName, const char *format, ...)
135 {
136 if (channelName==0 || format==0)
137 return;
138
139 unsigned channelIndex;
140 channelIndex = GetChannelIndexFromName(channelName);
141 if (channelIndex==(unsigned)-1)
142 {
143 AddChannel(channelName);
144 }
145
146 char text[REMOTE_MAX_TEXT_INPUT];
147 va_list ap;
148 va_start(ap, format);
149 vsnprintf_s(text, REMOTE_MAX_TEXT_INPUT-1, format, ap);
150 va_end(ap);
151
152 // Make sure that text ends in \r\n
153 int textLen;
154 textLen=(int)strlen(text);
155 if (textLen==0)
156 return;
157 if (text[textLen-1]=='\n')
158 {
159 text[textLen-1]=0;
160 }
161 if (textLen < REMOTE_MAX_TEXT_INPUT-4)
162 strcat_s(text, "\r\n");
163 else
164 {
165 text[textLen-3]='\r';
166 text[textLen-2]='\n';
167 text[textLen-1]=0;
168 }
169
170 // For each user that subscribes to this channel, send to them.
171 unsigned i;
172 for (i=0; i < remoteUsers.Size(); i++)
173 {
174 if (remoteUsers[i].channels & (1 << channelIndex))
175 {
176 trans->Send(remoteUsers[i].systemAddress, text);
177 }
178 }
179 }
180 void LogCommandParser::PrintChannels(const SystemAddress &systemAddress, TransportInterface *transport) const
181 {
182 unsigned i;
183 bool anyChannels=false;
184 transport->Send(systemAddress, "CHANNELS:\r\n");
185 for (i=0; i < 32; i++)
186 {
187 if (channelNames[i])
188 {
189 transport->Send(systemAddress, "%i. %s\r\n", i+1,channelNames[i]);
190 anyChannels=true;
191 }
192 }
193 if (anyChannels==false)
194 transport->Send(systemAddress, "None.\r\n");
195 }
196 void LogCommandParser::OnNewIncomingConnection(const SystemAddress &systemAddress, TransportInterface *transport)
197 {
198 (void) systemAddress;
199 (void) transport;
200 }
201 void LogCommandParser::OnConnectionLost(const SystemAddress &systemAddress, TransportInterface *transport)
202 {
203 (void) transport;
204 Unsubscribe(systemAddress, 0);
205 }
206 unsigned LogCommandParser::Unsubscribe(const SystemAddress &systemAddress, const char *channelName)
207 {
208 unsigned i;
209 for (i=0; i < remoteUsers.Size(); i++)
210 {
211 if (remoteUsers[i].systemAddress==systemAddress)
212 {
213 if (channelName==0)
214 {
215 // Unsubscribe from all and delete this user.
216 remoteUsers[i]=remoteUsers[remoteUsers.Size()-1];
217 remoteUsers.RemoveFromEnd();
218 return 0;
219 }
220 else
221 {
222 unsigned channelIndex;
223 channelIndex = GetChannelIndexFromName(channelName);
224 if (channelIndex!=(unsigned)-1)
225 {
226 remoteUsers[i].channels&=0xFFFF ^ (1<<channelIndex); // Unset this bit
227 }
228 return channelIndex;
229 }
230 }
231 }
232 return (unsigned)-1;
233 }
234 unsigned LogCommandParser::Subscribe(const SystemAddress &systemAddress, const char *channelName)
235 {
236 unsigned i;
237 unsigned channelIndex=(unsigned)-1;
238 if (channelName)
239 {
240 channelIndex = GetChannelIndexFromName(channelName);
241 if (channelIndex==(unsigned)-1)
242 return channelIndex;
243 }
244
245 for (i=0; i < remoteUsers.Size(); i++)
246 {
247 if (remoteUsers[i].systemAddress==systemAddress)
248 {
249 if (channelName)
250 remoteUsers[i].channels|=1<<channelIndex; // Set this bit for an existing user
251 else
252 remoteUsers[i].channels=0xFFFF;
253 return channelIndex;
254 }
255 }
256
257 // Make a new user
258 SystemAddressAndChannel newUser;
259 newUser.systemAddress = systemAddress;
260 if (channelName)
261 newUser.channels=1<<channelIndex;
262 else
263 newUser.channels=0xFFFF;
264 remoteUsers.Insert(newUser, _FILE_AND_LINE_);
265 return channelIndex;
266 }
267 unsigned LogCommandParser::GetChannelIndexFromName(const char *channelName)
268 {
269 unsigned i;
270 for (i=0; i < 32; i++)
271 {
272 if (channelNames[i]==0)
273 return (unsigned) -1;
274
275 if (_stricmp(channelNames[i], channelName)==0)
276 return i;
277 }
278 return (unsigned)-1;
279 }
280
281 void LogCommandParser::OnTransportChange(TransportInterface *transport)
282 {
283 // I don't want users to have to pass TransportInterface *transport to Log.
284 trans=transport;
285 }
286
287 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
  • RemoteSystemStruct
SLNet::RakPeer::RemoteSystemStruct Member List

This is the complete list of members for SLNet::RakPeer::RemoteSystemStruct, including all inherited members.

CONNECTED enum value | SLNet::RakPeer::RemoteSystemStruct
connectionTime | SLNet::RakPeer::RemoteSystemStruct
connectMode | SLNet::RakPeer::RemoteSystemStruct
ConnectMode enum name | SLNet::RakPeer::RemoteSystemStruct
DISCONNECT_ASAP enum value | SLNet::RakPeer::RemoteSystemStruct
DISCONNECT_ASAP_SILENTLY enum value | SLNet::RakPeer::RemoteSystemStruct
DISCONNECT_ON_NO_ACK enum value | SLNet::RakPeer::RemoteSystemStruct
guid | SLNet::RakPeer::RemoteSystemStruct
HANDLING_CONNECTION_REQUEST enum value | SLNet::RakPeer::RemoteSystemStruct
isActive | SLNet::RakPeer::RemoteSystemStruct
lastReliableSend | SLNet::RakPeer::RemoteSystemStruct
lowestPing | SLNet::RakPeer::RemoteSystemStruct
MTUSize | SLNet::RakPeer::RemoteSystemStruct
myExternalSystemAddress | SLNet::RakPeer::RemoteSystemStruct
nextPingTime | SLNet::RakPeer::RemoteSystemStruct
NO_ACTION enum value | SLNet::RakPeer::RemoteSystemStruct
pingAndClockDifferential | SLNet::RakPeer::RemoteSystemStruct
pingAndClockDifferentialWriteIndex | SLNet::RakPeer::RemoteSystemStruct
rakNetSocket | SLNet::RakPeer::RemoteSystemStruct
reliabilityLayer | SLNet::RakPeer::RemoteSystemStruct
remoteSystemIndex | SLNet::RakPeer::RemoteSystemStruct
REQUESTED_CONNECTION enum value | SLNet::RakPeer::RemoteSystemStruct
systemAddress | SLNet::RakPeer::RemoteSystemStruct
theirInternalSystemAddress | SLNet::RakPeer::RemoteSystemStruct
UNVERIFIED_SENDER enum value | SLNet::RakPeer::RemoteSystemStruct
weInitiatedTheConnection | SLNet::RakPeer::RemoteSystemStruct
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NetworkIDManager.cpp Source File

  • src
NetworkIDManager.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #include "slikenet/NetworkIDManager.h"
21 #include "slikenet/NetworkIDObject.h"
22 #include "slikenet/assert.h"
23 #include "slikenet/GetTime.h"
24 #include "slikenet/sleep.h"
25 #include "slikenet/SuperFastHash.h"
26 #include "slikenet/peerinterface.h"
27
28 using namespace SLNet;
29
30 STATIC_FACTORY_DEFINITIONS(NetworkIDManager,NetworkIDManager)
31
32 NetworkIDManager::NetworkIDManager()
33 {
34 startingOffset = RakPeerInterface::Get64BitUniqueRandomNumber();
35 Clear();
36 }
37 NetworkIDManager::~NetworkIDManager(void)
38 {
39
40 }
41 void NetworkIDManager::Clear(void)
42 {
43 memset(networkIdHash,0,sizeof(networkIdHash));
44 }
45 NetworkIDObject *NetworkIDManager::GET_BASE_OBJECT_FROM_ID(NetworkID x)
46 {
47 unsigned int hashIndex=NetworkIDToHashIndex(x);
48 NetworkIDObject *nio=networkIdHash[hashIndex];
49 while (nio)
50 {
51 if (nio->GetNetworkID()==x)
52 return nio;
53 nio=nio->nextInstanceForNetworkIDManager;
54 }
55 return 0;
56 }
57 NetworkID NetworkIDManager::GetNewNetworkID(void)
58 {
59 while (GET_BASE_OBJECT_FROM_ID(++startingOffset))
60 ;
61 if (startingOffset==UNASSIGNED_NETWORK_ID)
62 {
63 while (GET_BASE_OBJECT_FROM_ID(++startingOffset))
64 ;
65 }
66 return startingOffset;
67 }
68 unsigned int NetworkIDManager::NetworkIDToHashIndex(NetworkID networkId)
69 {
70 // return SuperFastHash((const char*) &networkId.guid.g,sizeof(networkId.guid.g)) % NETWORK_ID_MANAGER_HASH_LENGTH;
71 return (unsigned int) (networkId % NETWORK_ID_MANAGER_HASH_LENGTH);
72 }
73 void NetworkIDManager::TrackNetworkIDObject(NetworkIDObject *networkIdObject)
74 {
75 RakAssert(networkIdObject->GetNetworkIDManager()==this);
76 NetworkID rawId = networkIdObject->GetNetworkID();
77 RakAssert(rawId!=UNASSIGNED_NETWORK_ID);
78
79 networkIdObject->nextInstanceForNetworkIDManager=0;
80
81 unsigned int hashIndex=NetworkIDToHashIndex(rawId);
82 // printf("TrackNetworkIDObject hashIndex=%i guid=%s\n",hashIndex, networkIdObject->GetNetworkID().guid.ToString()); // removeme
83 if (networkIdHash[hashIndex]==0)
84 {
85 networkIdHash[hashIndex]=networkIdObject;
86 return;
87 }
88 NetworkIDObject *nio=networkIdHash[hashIndex];
89 // Duplicate insertion?
90 RakAssert(nio!=networkIdObject);
91 // Random GUID conflict?
92 RakAssert(nio->GetNetworkID()!=rawId);
93
94 while (nio->nextInstanceForNetworkIDManager!=0)
95 {
96 nio=nio->nextInstanceForNetworkIDManager;
97
98 // Duplicate insertion?
99 RakAssert(nio!=networkIdObject);
100 // Random GUID conflict?
101 RakAssert(nio->GetNetworkID()!=rawId);
102 }
103
104 nio->nextInstanceForNetworkIDManager=networkIdObject;
105 }
106 void NetworkIDManager::StopTrackingNetworkIDObject(NetworkIDObject *networkIdObject)
107 {
108 RakAssert(networkIdObject->GetNetworkIDManager()==this);
109 NetworkID rawId = networkIdObject->GetNetworkID();
110 RakAssert(rawId!=UNASSIGNED_NETWORK_ID);
111
112 // RakAssert(networkIdObject->GetNetworkID()!=UNASSIGNED_NETWORK_ID);
113 unsigned int hashIndex=NetworkIDToHashIndex(rawId);
114 // printf("hashIndex=%i\n",hashIndex); // removeme
115 NetworkIDObject *nio=networkIdHash[hashIndex];
116 if (nio==0)
117 {
118 RakAssert("NetworkIDManager::StopTrackingNetworkIDObject didn't find object" && 0);
119 return;
120 }
121 if (nio==networkIdObject)
122 {
123 networkIdHash[hashIndex]=nio->nextInstanceForNetworkIDManager;
124 return;
125 }
126
127 while (nio)
128 {
129 if (nio->nextInstanceForNetworkIDManager==networkIdObject)
130 {
131 nio->nextInstanceForNetworkIDManager=networkIdObject->nextInstanceForNetworkIDManager;
132 return;
133 }
134 nio=nio->nextInstanceForNetworkIDManager;
135 }
136
137 RakAssert("NetworkIDManager::StopTrackingNetworkIDObject didn't find object" && 0);
138 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Base64Encoder.h Source File

  • include
  • slikenet
Base64Encoder.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __BASE_64_ENCODER_H
12 #define __BASE_64_ENCODER_H
13
14 #include "Export.h"
15
16 extern "C" {
18 // outputData should be at least the size of inputData * 2 + 6
19 int Base64Encoding(const unsigned char *inputData, int dataLength, char *outputData);
20 }
21
22 extern "C" {
23 const char *Base64Map(void);
24 }
25
26 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/VariableListDeltaTracker.cpp Source File

  • src
VariableListDeltaTracker.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/VariableListDeltaTracker.h"
17
18 using namespace SLNet;
19
20 VariableListDeltaTracker::VariableListDeltaTracker() {nextWriteIndex=0;}
21 VariableListDeltaTracker::~VariableListDeltaTracker()
22 {
23 unsigned int i;
24 for (i=0; i < variableList.Size(); i++)
25 rakFree_Ex(variableList[i].lastData,_FILE_AND_LINE_);
26 }
27
28 // Call before using a series of WriteVar
29 void VariableListDeltaTracker::StartWrite(void) {nextWriteIndex=0;}
30
31 void VariableListDeltaTracker::FlagDirtyFromBitArray(unsigned char *bArray)
32 {
33 unsigned short readOffset=0;
34 for (readOffset=0; readOffset < variableList.Size(); readOffset++)
35 {
36 bool result = ( bArray[ readOffset >> 3 ] & ( 0x80 >> ( readOffset & 7 ) ) ) !=0;
37
38 if (result==true)
39 variableList[readOffset].isDirty=true;
40 }
41 }
42 VariableListDeltaTracker::VariableLastValueNode::VariableLastValueNode()
43 {
44 lastData=0;
45 }
46 VariableListDeltaTracker::VariableLastValueNode::VariableLastValueNode(const unsigned char *data, int _byteLength)
47 {
48 lastData=(char*) rakMalloc_Ex(_byteLength,_FILE_AND_LINE_);
49 memcpy(lastData,data,_byteLength);
50 byteLength=_byteLength;
51 isDirty=false;
52 }
53 VariableListDeltaTracker::VariableLastValueNode::~VariableLastValueNode()
54 {
55 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • PacketizedTCP
SLNet::PacketizedTCP Member List

This is the complete list of members for SLNet::PacketizedTCP, including all inherited members.

_completedConnectionAttempts | SLNet::PacketizedTCP | protected
_failedConnectionAttempts | SLNet::PacketizedTCP | protected
_lostConnections | SLNet::PacketizedTCP | protected
_newIncomingConnections | SLNet::PacketizedTCP | protected
AddToConnectionList(const SystemAddress &sa) | SLNet::PacketizedTCP | protected
AllocatePacket(unsigned dataSize) | SLNet::TCPInterface |
AttachPlugin(PluginInterface2 *plugin) | SLNet::TCPInterface |
blockingSocketList | SLNet::TCPInterface | protected
blockingSocketListMutex | SLNet::TCPInterface | protected
ClearAllConnections(void) | SLNet::PacketizedTCP | protected
CloseConnection(SystemAddress systemAddress) | SLNet::PacketizedTCP |
completedConnectionAttemptMutex | SLNet::TCPInterface | protected
completedConnectionAttempts | SLNet::TCPInterface | protected
Connect(const char *host, unsigned short remotePort, bool block=true, unsigned short socketFamily=AF_INET, const char *bindAddress=0) | SLNet::TCPInterface |
connections | SLNet::PacketizedTCP | protected
CreateListenSocket(unsigned short port, unsigned short maxIncomingConnections, unsigned short socketFamily, const char *hostAddress) | SLNet::TCPInterface | protected
DeallocatePacket(Packet *packet) | SLNet::TCPInterface |
DetachPlugin(PluginInterface2 *plugin) | SLNet::TCPInterface |
failedConnectionAttemptMutex | SLNet::TCPInterface | protected
failedConnectionAttempts | SLNet::TCPInterface | protected
GetConnectionCount(void) const | SLNet::TCPInterface |
GetConnectionList(SystemAddress *remoteSystems, unsigned short *numberOfSystems) const | SLNet::TCPInterface |
GetOutgoingDataBufferSize(SystemAddress systemAddress) const | SLNet::TCPInterface |
HasCompletedConnectionAttempt(void) | SLNet::PacketizedTCP |
HasFailedConnectionAttempt(void) | SLNet::PacketizedTCP |
HasLostConnection(void) | SLNet::PacketizedTCP |
HasNewIncomingConnection(void) | SLNet::PacketizedTCP |
headPush | SLNet::TCPInterface | protected
incomingMessages | SLNet::TCPInterface | protected
isStarted | SLNet::TCPInterface | protected
listenSocket | SLNet::TCPInterface | protected
lostConnections | SLNet::TCPInterface | protected
messageHandlerList | SLNet::TCPInterface | protected
newIncomingConnections | SLNet::TCPInterface | protected
newRemoteClients | SLNet::TCPInterface | protected
PacketizedTCP() | SLNet::PacketizedTCP |
PushBackPacket(Packet *packet, bool pushAtHead) | SLNet::TCPInterface | virtual
PushNotificationsToQueues(void) | SLNet::PacketizedTCP | protected
RAK_THREAD_DECLARATION(UpdateTCPInterfaceLoop) | SLNet::TCPInterface | protected
RAK_THREAD_DECLARATION(ConnectionAttemptLoop) | SLNet::TCPInterface | protected
Receive(void) | SLNet::PacketizedTCP | virtual
ReceiveHasPackets(void) | SLNet::TCPInterface | virtual
ReceiveInt(void) | SLNet::TCPInterface | protected
remoteClients | SLNet::TCPInterface | protected
remoteClientsLength | SLNet::TCPInterface | protected
RemoveFromConnectionList(const SystemAddress &sa) | SLNet::PacketizedTCP | protected
requestedCloseConnections | SLNet::TCPInterface | protected
ReturnOutgoingPacket(void) | SLNet::PacketizedTCP | protected
Send(const char *data, unsigned length, const SystemAddress &systemAddress, bool broadcast) | SLNet::PacketizedTCP |
SLNet::TCPInterface::Send(const char *data, unsigned int length, const SystemAddress &systemAddress, bool broadcast) | SLNet::TCPInterface | virtual
SendList(const char **data, const unsigned int *lengths, const int numParameters, const SystemAddress &systemAddress, bool broadcast) | SLNet::PacketizedTCP | virtual
SocketConnect(const char *host, unsigned short remotePort, unsigned short socketFamily, const char *bindAddress) | SLNet::TCPInterface | protected
Start(unsigned short port, unsigned short maxIncomingConnections, unsigned short maxConnections=0, int _threadPriority=-99999, unsigned short socketFamily=AF_INET, const char *bindAddress=0) | SLNet::TCPInterface |
Stop(void) | SLNet::PacketizedTCP |
tailPush | SLNet::TCPInterface | protected
TCPInterface() | SLNet::TCPInterface |
threadPriority | SLNet::TCPInterface | protected
threadRunning | SLNet::TCPInterface | protected
waitingPackets | SLNet::PacketizedTCP | protected
WasStarted(void) const | SLNet::TCPInterface |
~PacketizedTCP() | SLNet::PacketizedTCP | virtual
~TCPInterface() | SLNet::TCPInterface | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StringCompressor
SLNet::StringCompressor Member List

This is the complete list of members for SLNet::StringCompressor, including all inherited members.

AddReference(void) | SLNet::StringCompressor | static
DecodeString(char *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId=0) | SLNet::StringCompressor |
DecodeString(SLNet::RakString *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId=0) | SLNet::StringCompressor |
EncodeString(const char *input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId=0) | SLNet::StringCompressor |
EncodeString(const SLNet::RakString *input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId=0) | SLNet::StringCompressor |
GenerateTreeFromStrings(unsigned char *input, unsigned inputLength, uint8_t languageId) | SLNet::StringCompressor |
Instance(void) | SLNet::StringCompressor | static
RemoveReference(void) | SLNet::StringCompressor | static
StringCompressor() | SLNet::StringCompressor |
~StringCompressor() | SLNet::StringCompressor |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/gettimeofday.h Source File

  • include
  • slikenet
gettimeofday.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __GET_TIME_OF_DAY_H
12 #define __GET_TIME_OF_DAY_H
13
14 #if defined(_WIN32) && !defined(__GNUC__) &&!defined(__GCCXML__)
15 #include < time.h >
16 struct timezone
17 {
18 int tz_minuteswest; /* minutes W of Greenwich */
19 int tz_dsttime; /* type of dst correction */
20 };
21
22 #if defined(WINDOWS_STORE_RT)
23 struct timeval {
24 long tv_sec;
25 long tv_usec;
26 };
27 #endif
28
29 int gettimeofday(struct timeval *tv, struct timezone *tz);
30
31
32 #else
33
34
35
36
37 #include <sys/time.h>
38
39 #include <unistd.h>
40
41 // Uncomment this if you need to
42 /*
43 // http://www.halcode.com/archives/2008/08/26/retrieving-system-time-gettimeofday/
44 struct timezone
45 {
46 int tz_minuteswest;
47 int tz_dsttime;
48 };
49
50 #ifdef __cplusplus
51
52 void GetSystemTimeAsFileTime(FILETIME*);
53
54 inline int gettimeofday(struct timeval* p, void* tz )
55 {
56 union {
57 long long ns100; // time since 1 Jan 1601 in 100ns units
58 FILETIME ft;
59 } now;
60
61 GetSystemTimeAsFileTime( &(now.ft) );
62 p->tv_usec=(long)((now.ns100 / 10LL) % 1000000LL );
63 p->tv_sec= (long)((now.ns100-(116444736000000000LL))/10000000LL);
64 return 0;
65 }
66
67 #else
68 int gettimeofday(struct timeval* p, void* tz );
69 #endif
70 */
71
72 #endif
73
74 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/EmailSender.cpp Source File

  • src
EmailSender.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_EmailSender==1 && _RAKNET_SUPPORT_TCPInterface==1 && _RAKNET_SUPPORT_FileOperations==1
18
19 // Useful sites
20 // http://www.faqs.org\rfcs\rfc2821.html
21 // http://www2.rad.com\networks/1995/mime/examples.htm
22
23 #include "slikenet/EmailSender.h"
24 #include "slikenet/TCPInterface.h"
25 #include "slikenet/GetTime.h"
26 #include "slikenet/Rand.h"
27 #include "slikenet/FileList.h"
28 #include "slikenet/BitStream.h"
29 #include "slikenet/Base64Encoder.h"
30 #include <stdio.h>
31 #include "slikenet/linux_adapter.h"
32 #include "slikenet/osx_adapter.h"
33
34
35
36
37
38 #include "slikenet/sleep.h"
39
40 using namespace SLNet;
41
42
43 STATIC_FACTORY_DEFINITIONS(EmailSender,EmailSender);
44
45 const char *EmailSender::Send(const char *hostAddress, unsigned short hostPort, const char *sender, const char *recipient, const char *senderName, const char *recipientName, const char *subject, const char *body, FileList *attachedFiles, bool doPrintf, const char *password)
46 {
47 SLNet::Packet *packet;
48 char query[1024];
49 TCPInterface tcpInterface;
50 SystemAddress emailServer;
51 if (tcpInterface.Start(0, 0)==false)
52 return "Unknown error starting TCP";
53 emailServer=tcpInterface.Connect(hostAddress, hostPort,true);
54 if (emailServer==UNASSIGNED_SYSTEM_ADDRESS)
55 return "Failed to connect to host";
56 #if OPEN_SSL_CLIENT_SUPPORT==1
57 tcpInterface.StartSSLClient(emailServer);
58 #endif
59 SLNet::TimeMS timeoutTime = SLNet::GetTimeMS()+3000;
60 packet=0;
61 while (SLNet::GetTimeMS() < timeoutTime)
62 {
63 packet = tcpInterface.Receive();
64 if (packet)
65 {
66 if (doPrintf)
67 {
68 RAKNET_DEBUG_PRINTF("%s", packet->data);
69 tcpInterface.DeallocatePacket(packet);
70 }
71 break;
72 }
73 RakSleep(250);
74 }
75
76 if (packet==0)
77 return "Timeout while waiting for initial data from server.";
78
79 tcpInterface.Send("EHLO\r\n", 6, emailServer,false);
80 const char *response;
81 bool authenticate=false;
82 for(;;)
83 {
84 response=GetResponse(&tcpInterface, emailServer, doPrintf);
85
86 if (response!=0 && strcmp(response, "AUTHENTICATE")==0)
87 {
88 authenticate=true;
89 break;
90 }
91
92 // Something other than continue?
93 if (response!=0 && strcmp(response, "CONTINUE")!=0)
94 return response;
95
96 // Success?
97 if (response==0)
98 break;
99 }
100
101 if (authenticate)
102 {
103 sprintf_s(query, "EHLO %s\r\n", sender);
104 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
105 response=GetResponse(&tcpInterface, emailServer, doPrintf);
106 if (response!=0)
107 return response;
108 if (password==0)
109 return "Password needed";
110 char *outputData = SLNet::OP_NEW_ARRAY<char >((const int) (strlen(sender)+strlen(password)+2)*3, _FILE_AND_LINE_ );
111 SLNet::BitStream bs;
112 char zero=0;
113 bs.Write(&zero,1);
114 bs.Write(sender,(const unsigned int)strlen(sender));
115 //bs.Write("jms1@jms1.net",(const unsigned int)strlen("jms1@jms1.net"));
116 bs.Write(&zero,1);
117 bs.Write(password,(const unsigned int)strlen(password));
118 bs.Write(&zero,1);
119 //bs.Write("not.my.real.password",(const unsigned int)strlen("not.my.real.password"));
120 Base64Encoding((const unsigned char*)bs.GetData(), bs.GetNumberOfBytesUsed(), outputData);
121 sprintf_s(query, "AUTH PLAIN %s", outputData);
122 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
123 response=GetResponse(&tcpInterface, emailServer, doPrintf);
124 if (response!=0)
125 return response;
126 }
127
128
129 if (sender)
130 sprintf_s(query, "MAIL From: <%s>\r\n", sender);
131 else
132 sprintf_s(query, "MAIL From: <>\r\n");
133 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
134 response=GetResponse(&tcpInterface, emailServer, doPrintf);
135 if (response!=0)
136 return response;
137
138 if (recipient)
139 sprintf_s(query, "RCPT TO: <%s>\r\n", recipient);
140 else
141 sprintf_s(query, "RCPT TO: <>\r\n");
142 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
143 response=GetResponse(&tcpInterface, emailServer, doPrintf);
144 if (response!=0)
145 return response;
146
147 tcpInterface.Send("DATA\r\n", (unsigned int)strlen("DATA\r\n"), emailServer,false);
148
149 // Wait for 354...
150
151 response=GetResponse(&tcpInterface, emailServer, doPrintf);
152 if (response!=0)
153 return response;
154
155 if (subject)
156 {
157 sprintf_s(query, "Subject: %s\r\n", subject);
158 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
159 }
160 if (senderName)
161 {
162 sprintf_s(query, "From: %s\r\n", senderName);
163 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
164 }
165 if (recipientName)
166 {
167 sprintf_s(query, "To: %s\r\n", recipientName);
168 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
169 }
170
171 const int boundarySize=60;
172 char boundary[boundarySize+1];
173 int i,j;
174 if (attachedFiles && attachedFiles->fileList.Size())
175 {
176 rakNetRandom.SeedMT((unsigned int)SLNet::GetTimeMS());
177 // Random multipart message boundary
178 for (i=0; i < boundarySize; i++)
179 boundary[i]=Base64Map()[rakNetRandom.RandomMT()%64];
180 boundary[boundarySize]=0;
181 }
182
183 sprintf_s(query, "MIME-version: 1.0\r\n");
184 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
185
186 if (attachedFiles && attachedFiles->fileList.Size())
187 {
188 sprintf_s(query, "Content-type: multipart/mixed; BOUNDARY=\"%s\"\r\n\r\n", boundary);
189 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
190
191 sprintf_s(query, "This is a multi-part message in MIME format.\r\n\r\n--%s\r\n", boundary);
192 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
193 }
194
195 sprintf_s(query, "Content-Type: text/plain; charset=\"US-ASCII\"\r\n\r\n");
196 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
197
198 // Write the body of the email, doing some lame shitty shit where I have to make periods at the start of a newline have a second period.
199 char *newBody;
200 int bodyLength;
201 bodyLength=(int)strlen(body);
202 newBody = (char*) rakMalloc_Ex( bodyLength*3, _FILE_AND_LINE_ );
203 if (bodyLength>=0)
204 newBody[0]=body[0];
205 for (i=1, j=1; i < bodyLength; i++)
206 {
207 // Transform \n . \r \n into \n . . \r \n
208 if (i < bodyLength-2 &&
209 body[i-1]=='\n' &&
210 body[i+0]=='.' &&
211 body[i+1]=='\r' &&
212 body[i+2]=='\n')
213 {
214 newBody[j++]='.';
215 newBody[j++]='.';
216 newBody[j++]='\r';
217 newBody[j++]='\n';
218 i+=2;
219 }
220 // Transform \n . . \r \n into \n . . . \r \n
221 // Having to process .. is a bug in the mail server - the spec says ONLY \r\n.\r\n should be transformed
222 else if (i <= bodyLength-3 &&
223 body[i-1]=='\n' &&
224 body[i+0]=='.' &&
225 body[i+1]=='.' &&
226 body[i+2]=='\r' &&
227 body[i+3]=='\n')
228 {
229 newBody[j++]='.';
230 newBody[j++]='.';
231 newBody[j++]='.';
232 newBody[j++]='\r';
233 newBody[j++]='\n';
234 i+=3;
235 }
236 // Transform \n . \n into \n . . \r \n (this is a bug in the mail server - the spec says do not count \n alone but it does)
237 else if (i < bodyLength-1 &&
238 body[i-1]=='\n' &&
239 body[i+0]=='.' &&
240 body[i+1]=='\n')
241 {
242 newBody[j++]='.';
243 newBody[j++]='.';
244 newBody[j++]='\r';
245 newBody[j++]='\n';
246 i+=1;
247 }
248 // Transform \n . . \n into \n . . . \r \n (this is a bug in the mail server - the spec says do not count \n alone but it does)
249 // In fact having to process .. is a bug too - because the spec says ONLY \r\n.\r\n should be transformed
250 else if (i <= bodyLength-2 &&
251 body[i-1]=='\n' &&
252 body[i+0]=='.' &&
253 body[i+1]=='.' &&
254 body[i+2]=='\n')
255 {
256 newBody[j++]='.';
257 newBody[j++]='.';
258 newBody[j++]='.';
259 newBody[j++]='\r';
260 newBody[j++]='\n';
261 i+=2;
262 }
263 else
264 newBody[j++]=body[i];
265 }
266
267 newBody[j++]='\r';
268 newBody[j++]='\n';
269 tcpInterface.Send(newBody, j, emailServer,false);
270
271 rakFree_Ex(newBody, _FILE_AND_LINE_ );
272 int outputOffset;
273
274 // What a pain in the rear. I have to map the binary to printable characters using 6 bits per character.
275 if (attachedFiles && attachedFiles->fileList.Size())
276 {
277 for (i=0; i < (int) attachedFiles->fileList.Size(); i++)
278 {
279 // Write boundary
280 sprintf_s(query, "\r\n--%s\r\n", boundary);
281 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
282
283 sprintf_s(query, "Content-Type: APPLICATION/Octet-Stream; SizeOnDisk=%i; name=\"%s\"\r\nContent-Transfer-Encoding: BASE64\r\nContent-Description: %s\r\n\r\n", attachedFiles->fileList[i].dataLengthBytes, attachedFiles->fileList[i].filename.C_String(), attachedFiles->fileList[i].filename.C_String());
284 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
285
286 newBody = (char*) rakMalloc_Ex( (size_t) (attachedFiles->fileList[i].dataLengthBytes*3)/2, _FILE_AND_LINE_ );
287
288 outputOffset=Base64Encoding((const unsigned char*) attachedFiles->fileList[i].data, (int) attachedFiles->fileList[i].dataLengthBytes, newBody);
289
290 // Send the base64 mapped file.
291 tcpInterface.Send(newBody, outputOffset, emailServer,false);
292 rakFree_Ex(newBody, _FILE_AND_LINE_ );
293
294 }
295
296 // Write last boundary
297 sprintf_s(query, "\r\n--%s--\r\n", boundary);
298 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
299 }
300
301
302 sprintf_s(query, "\r\n.\r\n");
303 tcpInterface.Send(query, (unsigned int)strlen(query), emailServer,false);
304 response=GetResponse(&tcpInterface, emailServer, doPrintf);
305 if (response!=0)
306 return response;
307
308 tcpInterface.Send("QUIT\r\n", (unsigned int)strlen("QUIT\r\n"), emailServer,false);
309
310 RakSleep(30);
311 if (doPrintf)
312 {
313 packet = tcpInterface.Receive();
314 while (packet)
315 {
316 RAKNET_DEBUG_PRINTF("%s", packet->data);
317 tcpInterface.DeallocatePacket(packet);
318 packet = tcpInterface.Receive();
319 }
320 }
321 tcpInterface.Stop();
322 return 0; // Success
323 }
324
325 const char *EmailSender::GetResponse(TCPInterface *tcpInterface, const SystemAddress &emailServer, bool doPrintf)
326 {
327 SLNet::Packet *packet;
328 SLNet::TimeMS timeout;
329 timeout= SLNet::GetTimeMS()+5000;
330 for(;;)
331 {
332 if (tcpInterface->HasLostConnection()==emailServer)
333 return "Connection to server lost.";
334 packet = tcpInterface->Receive();
335 if (packet)
336 {
337 if (doPrintf)
338 {
339 RAKNET_DEBUG_PRINTF("%s", packet->data);
340 }
341 #if OPEN_SSL_CLIENT_SUPPORT==1
342 if (strstr((const char*)packet->data, "220"))
343 {
344 tcpInterface->StartSSLClient(packet->systemAddress);
345 return "AUTHENTICATE"; // OK
346 }
347 // if (strstr((const char*)packet->data, "250-AUTH LOGIN PLAIN"))
348 // {
349 // tcpInterface->StartSSLClient(packet->systemAddress);
350 // return "AUTHENTICATE"; // OK
351 // }
352 #endif
353 if (strstr((const char*)packet->data, "235"))
354 return 0; // Authentication accepted
355 if (strstr((const char*)packet->data, "354"))
356 return 0; // Go ahead
357 #if OPEN_SSL_CLIENT_SUPPORT==1
358 if (strstr((const char*)packet->data, "250-STARTTLS"))
359 {
360 tcpInterface->Send("STARTTLS\r\n", (unsigned int) strlen("STARTTLS\r\n"), packet->systemAddress, false);
361 return "CONTINUE";
362 }
363 #endif
364 if (strstr((const char*)packet->data, "250"))
365 return 0; // OK
366 if (strstr((const char*)packet->data, "550"))
367 return "Failed on error code 550";
368 if (strstr((const char*)packet->data, "553"))
369 return "Failed on error code 553";
370 }
371 if (SLNet::GetTimeMS() > timeout)
372 return "Timed out";
373 RakSleep(100);
374 }
375 }
376
377
378 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_ByteQueue.h Source File

  • include
  • slikenet
DS_ByteQueue.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __BYTE_QUEUE_H
23 #define __BYTE_QUEUE_H
24
25 #include "memoryoverride.h"
26 #include "Export.h"
27
30 namespace DataStructures
31 {
32 class ByteQueue
33 {
34 public:
35 ByteQueue();
36 ~ByteQueue();
37 void WriteBytes(const char *in, unsigned length, const char *file, unsigned int line);
38 bool ReadBytes(char *out, unsigned maxLengthToRead, bool peek);
39 unsigned GetBytesWritten(void) const;
40 char* PeekContiguousBytes(unsigned int *outLength) const;
41 void IncrementReadOffset(unsigned length);
42 void DecrementReadOffset(unsigned length);
43 void Clear(const char *file, unsigned int line);
44 void Print(void);
45
46 protected:
47 char *data;
48 unsigned readOffset, writeOffset, lengthAllocated;
49 };
50 }
51
52 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SocketIncludes.h Source File

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


SLikeNet: Source/include/slikenet/DS_BytePool.h Source File

  • include
  • slikenet
DS_BytePool.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #ifndef __BYTE_POOL_H
21 #define __BYTE_POOL_H
22
23 #include "memoryoverride.h"
24 #include "DS_MemoryPool.h"
25 #include "Export.h"
26 #include "SimpleMutex.h"
27 #include "assert.h"
28
29 // #define _DISABLE_BYTE_POOL
30 // #define _THREADSAFE_BYTE_POOL
31
32 namespace DataStructures
33 {
34 // Allocate some number of bytes from pools. Uses the heap if necessary.
35 class RAK_DLL_EXPORT BytePool
36 {
37 public:
38 BytePool();
39 ~BytePool();
40 // Should be at least 8 times bigger than 8192
41 void SetPageSize(int size);
42 unsigned char* Allocate(int bytesWanted, const char *file, unsigned int line);
43 void Release(unsigned char *data, const char *file, unsigned int line);
44 void Clear(const char *file, unsigned int line);
45 protected:
46 MemoryPool<unsigned char[128]> pool128;
47 MemoryPool<unsigned char[512]> pool512;
48 MemoryPool<unsigned char[2048]> pool2048;
49 MemoryPool<unsigned char[8192]> pool8192;
50 #ifdef _THREADSAFE_BYTE_POOL
51 SimpleMutex mutex128;
52 SimpleMutex mutex512;
53 SimpleMutex mutex2048;
54 SimpleMutex mutex8192;
55 #endif
56 };
57 }
58
59 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SuperFastHash.cpp Source File

  • src
SuperFastHash.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/SuperFastHash.h"
17 #include "slikenet/NativeTypes.h"
18 #include <stdlib.h>
19
20 #if !defined(_WIN32)
21 #include <stdint.h>
22 #endif
23 #include "slikenet/linux_adapter.h"
24 #include "slikenet/osx_adapter.h"
25
26 #undef get16bits
27
28 #if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
29 || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
30 #define get16bits(d) (*((const uint16_t *) (d)))
31 #else
32 #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
33 +(uint32_t)(((const uint8_t *)(d))[0]) )
34 #endif
35
36 static const int INCREMENTAL_READ_BLOCK=65536;
37
38 uint32_t SuperFastHash (const char * data, int length)
39 {
40 // All this is necessary or the hash does not match SuperFastHashIncremental
41 int bytesRemaining=length;
42 unsigned int lastHash = length;
43 int offset=0;
44 while (bytesRemaining>=INCREMENTAL_READ_BLOCK)
45 {
46 lastHash=SuperFastHashIncremental (data+offset, INCREMENTAL_READ_BLOCK, lastHash );
47 bytesRemaining-=INCREMENTAL_READ_BLOCK;
48 offset+=INCREMENTAL_READ_BLOCK;
49 }
50 if (bytesRemaining>0)
51 {
52 lastHash=SuperFastHashIncremental (data+offset, bytesRemaining, lastHash );
53 }
54 return lastHash;
55
56 // return SuperFastHashIncremental(data,len,len);
57 }
58 uint32_t SuperFastHashIncremental (const char * data, int len, unsigned int lastHash )
59 {
60 uint32_t hash = (uint32_t) lastHash;
61 uint32_t tmp;
62 int rem;
63
64 if (len <= 0 || data == NULL) return 0;
65
66 rem = len & 3;
67 len >>= 2;
68
69 /* Main loop */
70 for (;len > 0; len--) {
71 hash += get16bits (data);
72 tmp = (get16bits (data+2) << 11) ^ hash;
73 hash = (hash << 16) ^ tmp;
74 data += 2*sizeof (uint16_t);
75 hash += hash >> 11;
76 }
77
78 /* Handle end cases */
79 switch (rem) {
80 case 3: hash += get16bits (data);
81 hash ^= hash << 16;
82 hash ^= data[sizeof (uint16_t)] << 18;
83 hash += hash >> 11;
84 break;
85 case 2: hash += get16bits (data);
86 hash ^= hash << 11;
87 hash += hash >> 17;
88 break;
89 case 1: hash += *data;
90 hash ^= hash << 10;
91 hash += hash >> 1;
92 }
93
94 /* Force "avalanching" of final 127 bits */
95 hash ^= hash << 3;
96 hash += hash >> 5;
97 hash ^= hash << 4;
98 hash += hash >> 17;
99 hash ^= hash << 25;
100 hash += hash >> 6;
101
102 return (uint32_t) hash;
103
104 }
105
106 uint32_t SuperFastHashFile (const char * filename)
107 {
108 FILE *fp;
109 if (fopen_s(&fp, filename, "rb")!=0)
110 return 0;
111 uint32_t hash = SuperFastHashFilePtr(fp);
112 fclose(fp);
113 return hash;
114 }
115
116 uint32_t SuperFastHashFilePtr (FILE *fp)
117 {
118 fseek(fp, 0, SEEK_END);
119 int length = ftell(fp);
120 fseek(fp, 0, SEEK_SET);
121 int bytesRemaining=length;
122 unsigned int lastHash = length;
123 char readBlock[INCREMENTAL_READ_BLOCK];
124 while (bytesRemaining>=(int) sizeof(readBlock))
125 {
126 fread(readBlock, sizeof(readBlock), 1, fp);
127 lastHash=SuperFastHashIncremental (readBlock, (int) sizeof(readBlock), lastHash );
128 bytesRemaining-=(int) sizeof(readBlock);
129 }
130 if (bytesRemaining>0)
131 {
132 fread(readBlock, bytesRemaining, 1, fp);
133 lastHash=SuperFastHashIncremental (readBlock, bytesRemaining, lastHash );
134 }
135 return lastHash;
136 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatTypeDetectionServer.h Source File

  • include
  • slikenet
NatTypeDetectionServer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_NatTypeDetectionServer==1
22
23 #ifndef __NAT_TYPE_DETECTION_SERVER_H
24 #define __NAT_TYPE_DETECTION_SERVER_H
25
26 #include "types.h"
27 #include "Export.h"
28 #include "PluginInterface2.h"
29 #include "PacketPriority.h"
30 #include "SocketIncludes.h"
31 #include "DS_OrderedList.h"
32 #include "string.h"
33 #include "NatTypeDetectionCommon.h"
34
35
36 namespace SLNet
37 {
39 class RakPeerInterface;
40 struct Packet;
41
60 class RAK_DLL_EXPORT NatTypeDetectionServer : public PluginInterface2, public RNS2EventHandler
61 {
62 public:
63
64 // GetInstance() and DestroyInstance(instance*)
65 STATIC_FACTORY_DECLARATIONS(NatTypeDetectionServer)
66
67 // Constructor
68 NatTypeDetectionServer();
69
70 // Destructor
71 virtual ~NatTypeDetectionServer();
72
77 void Startup(
78 const char *nonRakNetIP2,
79 const char *nonRakNetIP3,
80 const char *nonRakNetIP4
81 #ifdef __native_client__
82 ,_PP_Instance_ chromeInstance
83 #endif
84 );
85
86 // Releases the sockets created in Startup();
87 void Shutdown(void);
88
90 virtual void Update(void);
91
93 virtual PluginReceiveResult OnReceive(Packet *packet);
94 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
95
96 enum NATDetectionState
97 {
98 STATE_NONE,
99 STATE_TESTING_NONE_1,
100 STATE_TESTING_NONE_2,
101 STATE_TESTING_FULL_CONE_1,
102 STATE_TESTING_FULL_CONE_2,
103 STATE_TESTING_ADDRESS_RESTRICTED_1,
104 STATE_TESTING_ADDRESS_RESTRICTED_2,
105 STATE_TESTING_PORT_RESTRICTED_1,
106 STATE_TESTING_PORT_RESTRICTED_2,
107 STATE_DONE,
108 };
109
110 struct NATDetectionAttempt
111 {
112 SystemAddress systemAddress;
113 NATDetectionState detectionState;
114 SLNet::TimeMS nextStateTime;
115 SLNet::TimeMS timeBetweenAttempts;
116 unsigned short c2Port;
117 RakNetGUID guid;
118 };
119
120 virtual void OnRNS2Recv(RNS2RecvStruct *recvStruct);
121 virtual void DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line);
122 virtual RNS2RecvStruct *AllocRNS2RecvStruct(const char *file, unsigned int line);
123 protected:
124 DataStructures::Queue<RNS2RecvStruct*> bufferedPackets;
125 SimpleMutex bufferedPacketsMutex;
126
127 void OnDetectionRequest(Packet *packet);
128 DataStructures::List<NATDetectionAttempt> natDetectionAttempts;
129 unsigned int GetDetectionAttemptIndex(const SystemAddress &sa);
130 unsigned int GetDetectionAttemptIndex(RakNetGUID guid);
131
132 // s1p1 is rakpeer itself
133 RakNetSocket2 *s1p2,*s2p3,*s3p4,*s4p5;
134 //unsigned short s1p2Port, s2p3Port, s3p4Port, s4p5Port;
135 char s3p4Address[64];
136 };
137 }
138
139
140 #endif
141
142 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • RangeNode
DataStructures::RangeNode< range_type > Member List

This is the complete list of members for DataStructures::RangeNode< range_type >, including all inherited members.

maxIndex | DataStructures::RangeNode< range_type > |
minIndex | DataStructures::RangeNode< range_type > |
RangeNode() | DataStructures::RangeNode< range_type > | inline
RangeNode(range_type min, range_type max) | DataStructures::RangeNode< range_type > | inline
~RangeNode() | DataStructures::RangeNode< range_type > | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FormatString.cpp Source File

  • src
FormatString.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/FormatString.h"
17 #include <stdio.h>
18 #include <string.h>
19 #include <stdarg.h>
20 #include "slikenet/LinuxStrings.h"
21 #include "slikenet/linux_adapter.h"
22 #include "slikenet/osx_adapter.h"
23
24 char * FormatString(const char *format, ...)
25 {
26 static int textIndex=0;
27 static char text[4][8096];
28 va_list ap;
29 va_start(ap, format);
30
31 if (++textIndex==4)
32 textIndex=0;
33 vsnprintf_s(text[textIndex], 8096, _TRUNCATE, format, ap);
34 va_end(ap);
35
36 return text[textIndex];
37 }
38
39 char * FormatStringTS(char *output, const char *format, ...)
40 {
41 va_list ap;
42 va_start(ap, format);
43 vsnprintf_s(output, 512, _TRUNCATE, format, ap);
44 va_end(ap);
45 return output;
46 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPForwarder.h Source File

  • include
  • slikenet
UDPForwarder.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #include "NativeFeatureIncludes.h"
23 #if _RAKNET_SUPPORT_UDPForwarder==1
24
25 #ifndef __UDP_FORWARDER_H
26 #define __UDP_FORWARDER_H
27
28 #include "Export.h"
29 #include "types.h"
30 #include "SocketIncludes.h"
31 #include "UDPProxyCommon.h"
32 #include "SimpleMutex.h"
33 #include "string.h"
34 #include "thread.h"
35 #include "DS_Queue.h"
36 #include "DS_OrderedList.h"
37 #include "LocklessTypes.h"
38 #include "DS_ThreadsafeAllocatingQueue.h"
39
40 namespace SLNet
41 {
42
43 enum UDPForwarderResult
44 {
45 UDPFORWARDER_FORWARDING_ALREADY_EXISTS,
46 UDPFORWARDER_NO_SOCKETS,
47 UDPFORWARDER_BIND_FAILED,
48 UDPFORWARDER_INVALID_PARAMETERS,
49 UDPFORWARDER_NOT_RUNNING,
50 UDPFORWARDER_SUCCESS,
51 UDPFORWARDER_RESULT_COUNT
52 };
53
56 class RAK_DLL_EXPORT UDPForwarder
57 {
58 public:
59 UDPForwarder();
60 virtual ~UDPForwarder();
61
64 void Startup(void);
65
67 void Shutdown(void);
68
72 void SetMaxForwardEntries(unsigned short maxEntries);
73
75 int GetMaxForwardEntries(void) const;
76
78 int GetUsedForwardEntries(void) const;
79
92 UDPForwarderResult StartForwarding(
93 SystemAddress source, SystemAddress destination, SLNet::TimeMS timeoutOnNoDataMS,
94 const char *forceHostAddress, unsigned short socketFamily,
95 unsigned short *forwardingPort, __UDPSOCKET__ *forwardingSocket);
96
100 void StopForwarding(SystemAddress source, SystemAddress destination);
101
102
103 struct ForwardEntry
104 {
105 ForwardEntry();
106 ~ForwardEntry();
107 SystemAddress addr1Unconfirmed, addr2Unconfirmed, addr1Confirmed, addr2Confirmed;
108 SLNet::TimeMS timeLastDatagramForwarded;
109 __UDPSOCKET__ socket;
110 SLNet::TimeMS timeoutOnNoDataMS;
111 short socketFamily;
112 };
113
114
115 protected:
116 friend RAK_THREAD_DECLARATION(UpdateUDPForwarderGlobal);
117
118 void UpdateUDPForwarder(void);
119 void RecvFrom(SLNet::TimeMS curTime, ForwardEntry *forwardEntry);
120
121 struct StartForwardingInputStruct
122 {
123 SystemAddress source;
124 SystemAddress destination;
125 SLNet::TimeMS timeoutOnNoDataMS;
126 RakString forceHostAddress;
127 unsigned short socketFamily;
128 unsigned int inputId;
129 };
130
131 DataStructures::ThreadsafeAllocatingQueue<StartForwardingInputStruct> startForwardingInput;
132
133 struct StartForwardingOutputStruct
134 {
135 unsigned short forwardingPort;
136 __UDPSOCKET__ forwardingSocket;
137 UDPForwarderResult result;
138 unsigned int inputId;
139 };
140 DataStructures::Queue<StartForwardingOutputStruct> startForwardingOutput;
141 SimpleMutex startForwardingOutputMutex;
142
143 struct StopForwardingStruct
144 {
145 SystemAddress source;
146 SystemAddress destination;
147 };
148 DataStructures::ThreadsafeAllocatingQueue<StopForwardingStruct> stopForwardingCommands;
149 unsigned int nextInputId;
150
151 // New entries are added to forwardListNotUpdated
152 DataStructures::List<ForwardEntry*> forwardListNotUpdated;
153 // SimpleMutex forwardListNotUpdatedMutex;
154
155 unsigned short maxForwardEntries;
156 SLNet::LocklessUint32_t isRunning, threadRunning;
157
158 };
159
160 } // End namespace
161
162 #endif
163
164 #endif // #if _RAKNET_SUPPORT_UDPForwarder==1
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/HTTPConnection2.cpp Source File

  • src
HTTPConnection2.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_HTTPConnection2==1 && _RAKNET_SUPPORT_TCPInterface==1
18
19 #include "slikenet/HTTPConnection2.h"
20 #include "slikenet/TCPInterface.h"
21
22 using namespace SLNet;
23
24 STATIC_FACTORY_DEFINITIONS(HTTPConnection2,HTTPConnection2);
25
26 HTTPConnection2::HTTPConnection2()
27 {
28 }
29 HTTPConnection2::~HTTPConnection2()
30 {
31
32 }
33 bool HTTPConnection2::TransmitRequest(const char* stringToTransmit, const char* host, unsigned short port, bool useSSL, int ipVersion, SystemAddress useAddress, void *userData)
34 {
35 Request *request = SLNet::OP_NEW<Request>(_FILE_AND_LINE_);
36 request->host=host;
37 request->chunked = false;
38 if (useAddress!=UNASSIGNED_SYSTEM_ADDRESS)
39 {
40 request->hostEstimatedAddress=useAddress;
41 if (IsConnected(useAddress)==false)
42 {
43 SLNet::OP_DELETE(request, _FILE_AND_LINE_);
44 return false;
45 }
46 }
47 else
48 {
49 if (request->hostEstimatedAddress.FromString(host, '|', ipVersion)==false)
50 {
51 SLNet::OP_DELETE(request, _FILE_AND_LINE_);
52 return false;
53 }
54 }
55 request->hostEstimatedAddress.SetPortHostOrder(port);
56 request->port=port;
57 request->stringToTransmit=stringToTransmit;
58 request->contentLength=-1;
59 request->contentOffset=0;
60 request->useSSL=useSSL;
61 request->ipVersion=ipVersion;
62 request->userData=userData;
63
64 if (IsConnected(request->hostEstimatedAddress))
65 {
66 sentRequestsMutex.Lock();
67 if (sentRequests.Size()==0)
68 {
69 request->hostCompletedAddress=request->hostEstimatedAddress;
70 sentRequests.Push(request, _FILE_AND_LINE_);
71 sentRequestsMutex.Unlock();
72
73 SendRequest(request);
74 }
75 else
76 {
77 // Request pending, push it
78 pendingRequestsMutex.Lock();
79 pendingRequests.Push(request, _FILE_AND_LINE_);
80 pendingRequestsMutex.Unlock();
81
82 sentRequestsMutex.Unlock();
83 }
84 }
85 else
86 {
87 pendingRequestsMutex.Lock();
88 pendingRequests.Push(request, _FILE_AND_LINE_);
89 pendingRequestsMutex.Unlock();
90
91 if (ipVersion!=6)
92 {
93 tcpInterface->Connect(host, port, false, AF_INET);
94 }
95 else
96 {
97 #if RAKNET_SUPPORT_IPV6
98 tcpInterface->Connect(host, port, false, AF_INET6);
99 #else
100 RakAssert("HTTPConnection2::TransmitRequest needs define RAKNET_SUPPORT_IPV6" && 0);
101 #endif
102 }
103 }
104 return true;
105 }
106 bool HTTPConnection2::GetResponse( RakString &stringTransmitted, RakString &hostTransmitted, RakString &responseReceived, SystemAddress &hostReceived, ptrdiff_t &contentOffset )
107 {
108 void *userData;
109 return GetResponse(stringTransmitted, hostTransmitted, responseReceived, hostReceived, contentOffset, &userData);
110
111 }
112 bool HTTPConnection2::GetResponse( RakString &stringTransmitted, RakString &hostTransmitted, RakString &responseReceived, SystemAddress &hostReceived, ptrdiff_t &contentOffset, void **userData )
113 {
114 completedRequestsMutex.Lock();
115 if (completedRequests.Size()>0)
116 {
117 Request *completedRequest = completedRequests[0];
118 completedRequests.RemoveAtIndexFast(0);
119 completedRequestsMutex.Unlock();
120
121 responseReceived = completedRequest->stringReceived;
122 hostReceived = completedRequest->hostCompletedAddress;
123 stringTransmitted = completedRequest->stringToTransmit;
124 hostTransmitted = completedRequest->host;
125 contentOffset = completedRequest->contentOffset;
126 *userData = completedRequest->userData;
127
128 SLNet::OP_DELETE(completedRequest, _FILE_AND_LINE_);
129 return true;
130 }
131 else
132 {
133 completedRequestsMutex.Unlock();
134 }
135 return false;
136 }
137 bool HTTPConnection2::IsBusy(void) const
138 {
139 return pendingRequests.Size()>0 || sentRequests.Size()>0;
140 }
141 bool HTTPConnection2::HasResponse(void) const
142 {
143 return completedRequests.Size()>0;
144 }
145 int ReadChunkSize( char *txtStart, char **txtEnd )
146 {
147 // char lengthStr[32];
148 // memset(lengthStr, 0, 32);
149 // memcpy(lengthStr, txtStart, txtEnd - txtStart);
150 return strtoul(txtStart, txtEnd,16);
151 // return atoi(lengthStr);
152 }
153 void ReadChunkBlock( size_t &currentChunkSize, size_t &bytesReadSoFar, char *txtIn, RakString &txtOut)
154 {
155 size_t bytesToRead;
156 size_t sLen;
157
158 do
159 {
160 bytesToRead = currentChunkSize - bytesReadSoFar;
161 sLen = strlen(txtIn);
162 if (sLen < bytesToRead)
163 bytesToRead = sLen;
164 txtOut.AppendBytes(txtIn, bytesToRead);
165 txtIn += bytesToRead;
166 bytesReadSoFar += bytesToRead;
167 if (*txtIn == 0)
168 {
169 // currentChunkSize=0;
170 return;
171 }
172 // char *newLine = strstr(txtIn, "\r\n");
173 if (txtIn[0] && txtIn[0]=='\r' && txtIn[1] && txtIn[1]=='\n' )
174 txtIn += 2; // Newline
175 char *newLine;
176 currentChunkSize = ReadChunkSize(txtIn, &newLine);
177 RakAssert(currentChunkSize < 50000); // Sanity check
178 if (currentChunkSize == 0)
179 return;
180 if (newLine == 0)
181 return;
182 bytesReadSoFar=0;
183 txtIn = newLine + 2;
184 } while (txtIn);
185 }
186 PluginReceiveResult HTTPConnection2::OnReceive(Packet *packet)
187 {
188 unsigned int i;
189
190 bool locked=true;
191 sentRequestsMutex.Lock();
192 for (i=0; i < sentRequests.Size(); i++)
193 {
194 Request *sentRequest = sentRequests[i];
195 if (sentRequest->hostCompletedAddress==packet->systemAddress)
196 {
197 sentRequests.RemoveAtIndexFast(i);
198 locked=false;
199 sentRequestsMutex.Unlock();
200
201 /*
202 static FILE * pFile = 0;
203 if (pFile==0)
204 {
205 long lSize;
206 char * buffer;
207 size_t result;
208
209 pFile = fopen ( "string_received.txt" , "rb" );
210 if (pFile==NULL) {fputs ("File error",stderr); exit (1);}
211
212 // obtain file size:
213 fseek (pFile , 0 , SEEK_END);
214 lSize = ftell (pFile);
215 rewind (pFile);
216
217 // allocate memory to contain the whole file:
218 buffer = (char*) malloc (sizeof(char)*lSize);
219 if (buffer == NULL) {fputs ("Memory error",stderr); exit (2);}
220
221 // copy the file into the buffer:
222 result = fread (buffer,1,lSize,pFile);
223 if (result != lSize) {fputs ("Reading error",stderr); exit (3);}
224
225 packet->data=(unsigned char*) buffer;
226 packet->length=lSize;
227 }
228 */
229
230
231 const char *isFirstChunk = strstr((char*) packet->data, "Transfer-Encoding: chunked");
232 if (isFirstChunk)
233 {
234 //printf((char*) packet->data);
235
236 locked=false;
237 sentRequestsMutex.Unlock();
238
239 sentRequest->chunked = true;
240 char *chunkStrStart = strstr((char*) packet->data, "\r\n\r\n");
241 RakAssert(chunkStrStart);
242
243 chunkStrStart += 4; // strlen("\r\n\r\n");
244 char *body_header; // = strstr(chunkStrStart, "\r\n");
245 sentRequest->thisChunkSize = ReadChunkSize(chunkStrStart, &body_header);
246 sentRequest->bytesReadForThisChunk = 0;
247 sentRequest->contentOffset = 0;
248
249 if (sentRequest->thisChunkSize == 0)
250 {
251 // Done
252 completedRequestsMutex.Lock();
253 completedRequests.Push(sentRequest, _FILE_AND_LINE_);
254 completedRequestsMutex.Unlock();
255
256 // If there is another command waiting for this server, send it
257 SendPendingRequestToConnectedSystem(packet->systemAddress);
258 }
259 else
260 {
261
262 // char *offset = strstr((char*) packet->data+1, "2000");
263
264 body_header+=2;
265 ReadChunkBlock(sentRequest->thisChunkSize, sentRequest->bytesReadForThisChunk, body_header, sentRequest->stringReceived);
266
267 if (sentRequest->thisChunkSize==0)
268 {
269 // Done
270 completedRequestsMutex.Lock();
271 completedRequests.Push(sentRequest, _FILE_AND_LINE_);
272 completedRequestsMutex.Unlock();
273
274 // If there is another command waiting for this server, send it
275 SendPendingRequestToConnectedSystem(packet->systemAddress);
276 }
277 else
278 {
279 // Not done
280 sentRequestsMutex.Lock();
281 sentRequests.Push(sentRequest, _FILE_AND_LINE_);
282 sentRequestsMutex.Unlock();
283 }
284 }
285 }
286 else if (sentRequest->chunked)
287 {
288 ReadChunkBlock(sentRequest->thisChunkSize, sentRequest->bytesReadForThisChunk, (char*) packet->data, sentRequest->stringReceived);
289
290 if (sentRequest->thisChunkSize==0)
291 {
292 // Done
293 completedRequestsMutex.Lock();
294 completedRequests.Push(sentRequest, _FILE_AND_LINE_);
295 completedRequestsMutex.Unlock();
296
297 // If there is another command waiting for this server, send it
298 SendPendingRequestToConnectedSystem(packet->systemAddress);
299 }
300 else
301 {
302 // Not done
303 sentRequestsMutex.Lock();
304 sentRequests.Push(sentRequest, _FILE_AND_LINE_);
305 sentRequestsMutex.Unlock();
306 }
307
308 }
309 else
310 {
311 sentRequest->stringReceived+=packet->data;
312
313 if (sentRequest->contentLength==-1)
314 {
315 const char *length_header = strstr(sentRequest->stringReceived.C_String(), "Content-Length: ");
316 if(length_header)
317 {
318 length_header += 16; // strlen("Content-Length: ");
319
320 unsigned int clLength;
321 for (clLength=0; length_header[clLength] && length_header[clLength] >= '0' && length_header[clLength] <= '9'; clLength++)
322 ;
323 if (clLength>0 && (length_header[clLength]=='\r' || length_header[clLength]=='\n'))
324 {
325 sentRequest->contentLength = RakString::ReadIntFromSubstring(length_header, 0, clLength);
326 }
327 }
328 }
329
330 // If we know the content length, find \r\n\r\n
331 if (sentRequest->contentLength != -1)
332 {
333 if (sentRequest->contentLength > 0)
334 {
335 const char *body_header = strstr(sentRequest->stringReceived.C_String(), "\r\n\r\n");
336 if (body_header)
337 {
338 body_header += 4; // strlen("\r\n\r\n");
339 size_t slen = strlen(body_header);
340 //RakAssert(slen <= (size_t) sentRequest->contentLength);
341 if (slen >= (size_t) sentRequest->contentLength)
342 {
343 sentRequest->contentOffset = body_header - sentRequest->stringReceived.C_String();
344 completedRequestsMutex.Lock();
345 completedRequests.Push(sentRequest, _FILE_AND_LINE_);
346 completedRequestsMutex.Unlock();
347
348 // If there is another command waiting for this server, send it
349 SendPendingRequestToConnectedSystem(packet->systemAddress);
350 }
351 else
352 {
353 sentRequestsMutex.Lock();
354 sentRequests.Push(sentRequest, _FILE_AND_LINE_);
355 sentRequestsMutex.Unlock();
356 }
357 }
358
359 else
360 {
361 sentRequestsMutex.Lock();
362 sentRequests.Push(sentRequest, _FILE_AND_LINE_);
363 sentRequestsMutex.Unlock();
364 }
365 }
366 else
367 {
368 sentRequest->contentOffset=-1;
369 completedRequestsMutex.Lock();
370 completedRequests.Push(sentRequest, _FILE_AND_LINE_);
371 completedRequestsMutex.Unlock();
372
373 // If there is another command waiting for this server, send it
374 SendPendingRequestToConnectedSystem(packet->systemAddress);
375 }
376 }
377 else
378 {
379 const char *firstNewlineSet = strstr(sentRequest->stringReceived.C_String(), "\r\n\r\n");
380 if (firstNewlineSet!=0)
381 {
382 ptrdiff_t offset = firstNewlineSet - sentRequest->stringReceived.C_String();
383 if (sentRequest->stringReceived.C_String()[offset+4]==0)
384 sentRequest->contentOffset=-1;
385 else
386 sentRequest->contentOffset=offset+4;
387 completedRequestsMutex.Lock();
388 completedRequests.Push(sentRequest, _FILE_AND_LINE_);
389 completedRequestsMutex.Unlock();
390
391 // If there is another command waiting for this server, send it
392 SendPendingRequestToConnectedSystem(packet->systemAddress);
393 }
394 else
395 {
396 sentRequestsMutex.Lock();
397 sentRequests.Push(sentRequest, _FILE_AND_LINE_);
398 sentRequestsMutex.Unlock();
399 }
400 }
401 }
402
403
404 break;
405 }
406 }
407
408 if (locked==true)
409 sentRequestsMutex.Unlock();
410
411 return RR_CONTINUE_PROCESSING;
412 }
413
414 void HTTPConnection2::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
415 {
416 (void) rakNetGUID;
417 (void) isIncoming; // unknown
418
419 SendPendingRequestToConnectedSystem(systemAddress);
420 }
421 void HTTPConnection2::SendPendingRequestToConnectedSystem(SystemAddress sa)
422 {
423 if (sa==UNASSIGNED_SYSTEM_ADDRESS)
424 return;
425
426 unsigned int requestsSent=0;
427
428 // Search through requests to find a match for this instance of TCPInterface and SystemAddress
429 unsigned int i;
430 i=0;
431 pendingRequestsMutex.Lock();
432 while (i < pendingRequests.Size())
433 {
434 Request *request = pendingRequests[i];
435 if (request->hostEstimatedAddress==sa)
436 {
437 pendingRequests.RemoveAtIndex(i);
438 // Send this request
439 request->hostCompletedAddress=sa;
440
441 sentRequestsMutex.Lock();
442 sentRequests.Push(request, _FILE_AND_LINE_);
443 sentRequestsMutex.Unlock();
444
445 pendingRequestsMutex.Unlock();
446
447 #if OPEN_SSL_CLIENT_SUPPORT==1
448 if (request->useSSL)
449 tcpInterface->StartSSLClient(sa);
450 #endif
451
452 SendRequest(request);
453 requestsSent++;
454 pendingRequestsMutex.Lock();
455 break;
456 }
457 else
458 {
459 i++;
460 }
461 }
462 pendingRequestsMutex.Unlock();
463
464 if (requestsSent==0)
465 {
466 pendingRequestsMutex.Lock();
467 if (pendingRequests.Size() > 0)
468 {
469 // Just assign
470 Request *request = pendingRequests[0];
471 pendingRequests.RemoveAtIndex(0);
472
473 request->hostCompletedAddress=sa;
474
475 sentRequestsMutex.Lock();
476 sentRequests.Push(request, _FILE_AND_LINE_);
477 sentRequestsMutex.Unlock();
478 pendingRequestsMutex.Unlock();
479
480 // Send
481 #if OPEN_SSL_CLIENT_SUPPORT==1
482 if (request->useSSL)
483 tcpInterface->StartSSLClient(sa);
484 #endif
485
486
487 SendRequest(request);
488 }
489 else
490 {
491 pendingRequestsMutex.Unlock();
492 }
493 }
494 }
495 void HTTPConnection2::RemovePendingRequest(SystemAddress sa)
496 {
497 unsigned int i;
498 i=0;
499 pendingRequestsMutex.Lock();
500 for (i=0; i < pendingRequests.Size(); i++)
501 {
502 Request *request = pendingRequests[i];
503 if (request->hostEstimatedAddress==sa)
504 {
505 pendingRequests.RemoveAtIndex(i);
506 SLNet::OP_DELETE(request, _FILE_AND_LINE_);
507 }
508 else
509 i++;
510 }
511
512 pendingRequestsMutex.Unlock();
513 }
514 void HTTPConnection2::SendNextPendingRequest(void)
515 {
516 // Send a pending request
517 pendingRequestsMutex.Lock();
518 if (pendingRequests.Size()>0)
519 {
520 Request *pendingRequest = pendingRequests.Peek();
521 pendingRequestsMutex.Unlock();
522
523 if (pendingRequest->ipVersion!=6)
524 {
525 tcpInterface->Connect(pendingRequest->host.C_String(), pendingRequest->port, false, AF_INET);
526 }
527 else
528 {
529 #if RAKNET_SUPPORT_IPV6
530 tcpInterface->Connect(pendingRequest->host.C_String(), pendingRequest->port, false, AF_INET6);
531 #else
532 RakAssert("HTTPConnection2::TransmitRequest needs define RAKNET_SUPPORT_IPV6" && 0);
533 #endif
534 }
535 }
536 else
537 {
538 pendingRequestsMutex.Unlock();
539 }
540 }
541
542 void HTTPConnection2::OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
543 {
544 (void) failedConnectionAttemptReason;
545 if (packet->systemAddress==UNASSIGNED_SYSTEM_ADDRESS)
546 return;
547
548 RemovePendingRequest(packet->systemAddress);
549
550 SendNextPendingRequest();
551 }
552 void HTTPConnection2::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
553 {
554 (void) lostConnectionReason;
555 (void) rakNetGUID;
556
557 if (systemAddress==UNASSIGNED_SYSTEM_ADDRESS)
558 return;
559
560 // Update sent requests to completed requests
561 unsigned int i;
562 i=0;
563 sentRequestsMutex.Lock();
564 while (i < sentRequests.Size())
565 {
566 if (sentRequests[i]->hostCompletedAddress==systemAddress)
567 {
568 Request *sentRequest = sentRequests[i];
569 if (sentRequest->chunked==false && sentRequest->stringReceived.IsEmpty()==false)
570 {
571 if (strstr(sentRequest->stringReceived.C_String(), "Content-Length: "))
572 {
573 char *body_header = strstr((char*) sentRequest->stringReceived.C_String(), "\r\n\r\n");
574 if (body_header)
575 {
576 body_header += 4; // strlen("\r\n\r\n");
577 sentRequest->contentOffset = body_header - sentRequest->stringReceived.C_String();
578 }
579 else
580 {
581 sentRequest->contentOffset = 0;
582 }
583
584 }
585 else
586 {
587 sentRequest->contentOffset = 0;
588 }
589 }
590
591
592 completedRequestsMutex.Lock();
593 completedRequests.Push(sentRequests[i], _FILE_AND_LINE_);
594 completedRequestsMutex.Unlock();
595
596 sentRequests.RemoveAtIndexFast(i);
597 }
598 else
599 {
600 i++;
601 }
602 }
603 sentRequestsMutex.Unlock();
604
605 SendNextPendingRequest();
606 }
607 bool HTTPConnection2::IsConnected(SystemAddress sa)
608 {
609 SystemAddress remoteSystems[64];
610 unsigned short numberOfSystems=64;
611 tcpInterface->GetConnectionList(remoteSystems, &numberOfSystems);
612 for (unsigned int i=0; i < numberOfSystems; i++)
613 {
614 if (remoteSystems[i]==sa)
615 {
616 return true;
617 }
618 }
619 return false;
620 }
621 void HTTPConnection2::SendRequest(Request *request)
622 {
623 tcpInterface->Send(request->stringToTransmit.C_String(), (unsigned int) request->stringToTransmit.GetLength(), request->hostCompletedAddress, false);
624 }
625
626 #endif // #if _RAKNET_SUPPORT_HTTPConnection2==1 && _RAKNET_SUPPORT_TCPInterface==1
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CommandParserInterface.h Source File

  • include
  • slikenet
CommandParserInterface.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #ifndef __COMMAND_PARSER_INTERFACE
22 #define __COMMAND_PARSER_INTERFACE
23
24 #include "memoryoverride.h"
25 #include "types.h"
26 #include "DS_OrderedList.h"
27 #include "Export.h"
28
29 namespace SLNet
30 {
32 class TransportInterface;
33
37 struct RAK_DLL_EXPORT RegisteredCommand
38 {
39 const char *command;
40 const char *commandHelp;
41 unsigned char parameterCount;
42 };
43
45 int RAK_DLL_EXPORT RegisteredCommandComp( const char* const & key, const RegisteredCommand &data );
46
50 class RAK_DLL_EXPORT CommandParserInterface
51 {
52 public:
53 CommandParserInterface();
54 virtual ~CommandParserInterface();
55
59 virtual const char *GetName(void) const=0;
60
64 virtual void OnNewIncomingConnection(const SystemAddress &systemAddress, TransportInterface *transport);
65
69 virtual void OnConnectionLost(const SystemAddress &systemAddress, TransportInterface *transport);
70
74 virtual void SendHelp(TransportInterface *transport, const SystemAddress &systemAddress)=0;
75
83 virtual bool OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)=0;
84
89 virtual void OnTransportChange(TransportInterface *transport);
90
96 virtual bool GetRegisteredCommand(const char *command, RegisteredCommand *rc);
97
106 static void ParseConsoleString(char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength);
107
112 virtual void SendCommandList(TransportInterface *transport, const SystemAddress &systemAddress);
113
114 static const unsigned char VARIABLE_NUMBER_OF_PARAMETERS;
115
116 // Currently only takes static strings - doesn't make a copy of what you pass.
117 // parameterCount is the number of parameters that the sender has to include with the command.
118 // Pass 255 to parameterCount to indicate variable number of parameters
119
124 virtual void RegisterCommand(unsigned char parameterCount, const char *command, const char *commandHelp);
125
132 virtual void ReturnResult(bool res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress);
133 virtual void ReturnResult(char *res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress);
134 virtual void ReturnResult(SystemAddress res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress);
135 virtual void ReturnResult(int res, const char *command,TransportInterface *transport, const SystemAddress &systemAddress);
136
143 virtual void ReturnResult(const char *command,TransportInterface *transport, const SystemAddress &systemAddress);
144
145 protected:
146 DataStructures::OrderedList<const char*, RegisteredCommand, RegisteredCommandComp> commandList;
147 };
148
149 } // namespace SLNet
150
151 #endif
152
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketConsoleLogger.cpp Source File

  • src
PacketConsoleLogger.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_LogCommandParser==1 && _RAKNET_SUPPORT_PacketLogger==1
18 #include "slikenet/PacketConsoleLogger.h"
19 #include "slikenet/LogCommandParser.h"
20 #include <stdio.h>
21
22 using namespace SLNet;
23
24 PacketConsoleLogger::PacketConsoleLogger()
25 {
26 logCommandParser=0;
27 }
28
29 void PacketConsoleLogger::SetLogCommandParser(LogCommandParser *lcp)
30 {
31 logCommandParser=lcp;
32 if (logCommandParser)
33 logCommandParser->AddChannel("PacketConsoleLogger");
34 }
35 void PacketConsoleLogger::WriteLog(const char *str)
36 {
37 if (logCommandParser)
38 logCommandParser->WriteLog("PacketConsoleLogger", str);
39 }
40
41 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PluginInterface2.cpp Source File

  • src
PluginInterface2.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16
17 #include "slikenet/PluginInterface2.h"
18 #include "slikenet/PacketizedTCP.h"
19 #include "slikenet/peerinterface.h"
20 #include "slikenet/BitStream.h"
21
22 using namespace SLNet;
23
24 PluginInterface2::PluginInterface2()
25 {
26 rakPeerInterface=0;
27 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
28 tcpInterface=0;
29 #endif
30 }
31 PluginInterface2::~PluginInterface2()
32 {
33
34 }
35 void PluginInterface2::SendUnified( const SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast )
36 {
37 if (rakPeerInterface)
38 {
39 rakPeerInterface->Send(bitStream,priority,reliability,orderingChannel,systemIdentifier,broadcast);
40 return;
41 }
42 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
43 else if (tcpInterface)
44 {
45 tcpInterface->Send((const char*) bitStream->GetData(), bitStream->GetNumberOfBytesUsed(), systemIdentifier.systemAddress, broadcast);
46 return;
47 }
48 #endif
49
50 // Offline mode
51 if (broadcast==false && systemIdentifier.rakNetGuid==GetMyGUIDUnified())
52 {
53 // Packet *packet = AllocatePacketUnified(bitStream->GetNumberOfBytesUsed());
54 // memcpy(packet->data, bitStream->GetData(), bitStream->GetNumberOfBytesUsed());
55 Packet packet;
56 packet.bitSize=bitStream->GetNumberOfBitsUsed();
57 packet.data=bitStream->GetData();
58 packet.deleteData=false;
59 packet.guid=UNASSIGNED_RAKNET_GUID;
60 packet.length=bitStream->GetNumberOfBytesUsed();
61 packet.systemAddress=UNASSIGNED_SYSTEM_ADDRESS;
62 packet.wasGeneratedLocally=false;
63 OnReceive(&packet);
64 // DeallocPacketUnified(packet);
65
66 Update();
67 }
68 }
69 void PluginInterface2::SendUnified( const char * data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast )
70 {
71 if (rakPeerInterface)
72 {
73 rakPeerInterface->Send(data, length, priority,reliability,orderingChannel,systemIdentifier,broadcast);
74 return;
75 }
76 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
77 else if (tcpInterface)
78 {
79 tcpInterface->Send(data, length, systemIdentifier.systemAddress, broadcast);
80 return;
81 }
82 #endif
83
84 // Offline mode
85 if (broadcast==false && systemIdentifier.rakNetGuid==GetMyGUIDUnified())
86 {
87 // Packet *packet = AllocatePacketUnified(bitStream->GetNumberOfBytesUsed());
88 // memcpy(packet->data, bitStream->GetData(), bitStream->GetNumberOfBytesUsed());
89 Packet packet;
90 packet.bitSize=BYTES_TO_BITS(length);
91 packet.data=(unsigned char*) data;
92 packet.deleteData=false;
93 packet.guid=UNASSIGNED_RAKNET_GUID;
94 packet.length=length;
95 packet.systemAddress=UNASSIGNED_SYSTEM_ADDRESS;
96 packet.wasGeneratedLocally=false;
97 OnReceive(&packet);
98 // DeallocPacketUnified(packet);
99
100 Update();
101 }
102 }
103 Packet *PluginInterface2::AllocatePacketUnified(unsigned dataSize)
104 {
105 if (rakPeerInterface)
106 {
107 return rakPeerInterface->AllocatePacket(dataSize);
108 }
109 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
110 else if (tcpInterface)
111 {
112 return tcpInterface->AllocatePacket(dataSize);
113 }
114 #endif
115
116 Packet *packet = SLNet::OP_NEW<Packet>(_FILE_AND_LINE_);
117 packet->data = (unsigned char*) rakMalloc_Ex(dataSize, _FILE_AND_LINE_);
118 packet->bitSize=BYTES_TO_BITS(dataSize);
119 packet->deleteData=true;
120 packet->guid=UNASSIGNED_RAKNET_GUID;
121 packet->systemAddress=UNASSIGNED_SYSTEM_ADDRESS;
122 packet->wasGeneratedLocally=false;
123 return packet;
124 }
125 void PluginInterface2::PushBackPacketUnified(Packet *packet, bool pushAtHead)
126 {
127 if (rakPeerInterface)
128 {
129 rakPeerInterface->PushBackPacket(packet,pushAtHead);
130 return;
131 }
132 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
133 else if (tcpInterface)
134 {
135 tcpInterface->PushBackPacket(packet,pushAtHead);
136 return;
137 }
138 #endif
139
140 OnReceive(packet);
141 Update();
142 }
143 void PluginInterface2::DeallocPacketUnified(Packet *packet)
144 {
145 if (rakPeerInterface)
146 {
147 rakPeerInterface->DeallocatePacket(packet);
148 return;
149 }
150 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
151 else if (tcpInterface)
152 {
153 tcpInterface->DeallocatePacket(packet);
154 return;
155 }
156 #endif
157
158 rakFree_Ex(packet->data, _FILE_AND_LINE_);
159 SLNet::OP_DELETE(packet, _FILE_AND_LINE_);
160 }
161 bool PluginInterface2::SendListUnified( const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast )
162 {
163 if (rakPeerInterface)
164 {
165 return rakPeerInterface->SendList(data,lengths,numParameters,priority,reliability,orderingChannel,systemIdentifier,broadcast)!=0;
166 }
167 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
168 else if (tcpInterface)
169 {
170 return tcpInterface->SendList(data,(const unsigned int *) lengths,numParameters,systemIdentifier.systemAddress,broadcast );
171 }
172 #endif
173
174 if (broadcast==false && systemIdentifier.rakNetGuid==GetMyGUIDUnified())
175 {
176
177 unsigned int totalLength=0;
178 unsigned int lengthOffset;
179 int i;
180 for (i=0; i < numParameters; i++)
181 {
182 if (lengths[i]>0)
183 totalLength+=lengths[i];
184 }
185 if (totalLength==0)
186 return false;
187
188 char *dataAggregate;
189 dataAggregate = (char*) rakMalloc_Ex( (size_t) totalLength, _FILE_AND_LINE_ );
190 if (dataAggregate==0)
191 {
192 notifyOutOfMemory(_FILE_AND_LINE_);
193 return false;
194 }
195 for (i=0, lengthOffset=0; i < numParameters; i++)
196 {
197 if (lengths[i]>0)
198 {
199 memcpy(dataAggregate+lengthOffset, data[i], lengths[i]);
200 lengthOffset+=lengths[i];
201 }
202 }
203
204 SendUnified(dataAggregate, totalLength, priority, reliability,orderingChannel, systemIdentifier, broadcast);
205 rakFree_Ex(dataAggregate, _FILE_AND_LINE_);
206 return true;
207 }
208
209 return false;
210 }
211 void PluginInterface2::SetRakPeerInterface( RakPeerInterface *ptr )
212 {
213 rakPeerInterface=ptr;
214 }
215 #if _RAKNET_SUPPORT_TCPInterface==1
216 void PluginInterface2::SetTCPInterface( TCPInterface *ptr )
217 {
218 tcpInterface=ptr;
219 }
220 #endif
221 RakNetGUID PluginInterface2::GetMyGUIDUnified(void) const
222 {
223 if (rakPeerInterface)
224 return rakPeerInterface->GetMyGUID();
225 return UNASSIGNED_RAKNET_GUID;
226 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Vita.cpp Source File

  • src
RakNetSocket2_Vita.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_VITA
21 #define RAKNETSOCKET2_VITA
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162 #endif // file header
163
164 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakPeer.cpp Source File

  • src
RakPeer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 // \file
17 //
18
19
20
21 #define CAT_NEUTER_EXPORT /* Neuter dllimport for libcat */
22
23 #include "slikenet/defines.h"
24 #include "slikenet/peer.h"
25 #include "slikenet/types.h"
26
27 #ifdef _WIN32
28
29 #else
30 #include <unistd.h>
31 #endif
32
33 // #if defined(new)
34 // #pragma push_macro("new")
35 // #undef new
36 // #define RMO_NEW_UNDEF_ALLOCATING_QUEUE
37 // #endif
38
39 #include <time.h>
40 #include <ctype.h> // toupper
41 #include <string.h>
42 #include "slikenet/GetTime.h"
43 #include "slikenet/MessageIdentifiers.h"
44 #include "slikenet/DS_HuffmanEncodingTree.h"
45 #include "slikenet/Rand.h"
46 #include "slikenet/PluginInterface2.h"
47 #include "slikenet/StringCompressor.h"
48 #include "slikenet/StringTable.h"
49 #include "slikenet/NetworkIDObject.h"
50 #include "slikenet/types.h"
51 #include "slikenet/DR_SHA1.h"
52 #include "slikenet/sleep.h"
53 #include "slikenet/assert.h"
54 #include "slikenet/version.h"
55 #include "slikenet/NetworkIDManager.h"
56 #include "slikenet/gettimeofday.h"
57 #include "slikenet/SignaledEvent.h"
58 #include "slikenet/SuperFastHash.h"
59 #include "slikenet/alloca.h"
60 #include "slikenet/WSAStartupSingleton.h"
61 #include "slikenet/linux_adapter.h"
62 #include "slikenet/osx_adapter.h"
63
64 #ifdef USE_THREADED_SEND
65 #include "slikenet/SendToThread.h"
66 #endif
67
68 #ifdef CAT_AUDIT
69 #define CAT_AUDIT_PRINTF(...) printf(__VA_ARGS__)
70 #else
71 #define CAT_AUDIT_PRINTF(...)
72 #endif
73
74 namespace SLNet
75 {
76 RAK_THREAD_DECLARATION(UpdateNetworkLoop);
77 RAK_THREAD_DECLARATION(RecvFromLoop);
78 RAK_THREAD_DECLARATION(UDTConnect);
79 }
80 #define REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE 8
81
82 #if !defined ( __APPLE__ ) && !defined ( __APPLE_CC__ )
83 #include <stdlib.h> // malloc
84 #endif
85
86
87
88 #if defined(_WIN32)
89 //
90 #else
91 /*
92 #include <alloca.h> // Console 2
93 #include <stdlib.h>
94 extern bool _extern_Console2LoadModules(void);
95 extern int _extern_Console2GetConnectionStatus(void);
96 extern int _extern_Console2GetLobbyStatus(void);
97 //extern bool Console2StartupFluff(unsigned int *);
98 extern void Console2ShutdownFluff(void);
99 //extern unsigned int Console2ActivateConnection(unsigned int, void *);
100 //extern bool Console2BlockOnEstablished(void);
101 extern void Console2GetIPAndPort(unsigned int, char *, unsigned short *, unsigned int );
102 //extern void Console2DeactivateConnection(unsigned int, unsigned int);
103 */
104 #endif
105
106
107 static const int NUM_MTU_SIZES=3;
108
109
110
111 static const int mtuSizes[NUM_MTU_SIZES]={MAXIMUM_MTU_SIZE, 1200, 576};
112
113
114 // Note to self - if I change this it might affect RECIPIENT_OFFLINE_MESSAGE_INTERVAL in Natpunchthrough.cpp
115 //static const int MAX_OPEN_CONNECTION_REQUESTS=8;
116 //static const int TIME_BETWEEN_OPEN_CONNECTION_REQUESTS=500;
117
118 using namespace SLNet;
119
120 static RakNetRandom rnr;
121
122 /*
123 struct RakPeerAndIndex
124 {
125 RakNetSocket2 *s;
126 RakPeer *rakPeer;
127 };
128 */
129
130 static const unsigned int MAX_OFFLINE_DATA_LENGTH=400; // I set this because I limit ID_CONNECTION_REQUEST to 512 bytes, and the password is appended to that packet.
131
132 // Used to distinguish between offline messages with data, and messages from the reliability layer
133 // Should be different than any message that could result from messages from the reliability layer
134 // Make sure highest bit is 0, so isValid in DatagramHeaderFormat is false
135 static const unsigned char OFFLINE_MESSAGE_DATA_ID[16]={0x00,0xFF,0xFF,0x00,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFD,0xFD,0x12,0x34,0x56,0x78};
136
137 struct PacketFollowedByData
138 {
139 Packet p;
140 unsigned char data[1];
141 };
142
143 Packet *RakPeer::AllocPacket(unsigned dataSize, const char *file, unsigned int line)
144 {
145 // Crashes when dataSize is 4 bytes - not sure why
146 // unsigned char *data = (unsigned char *) rakMalloc_Ex(sizeof(PacketFollowedByData)+dataSize, file, line);
147 // Packet *p = &((PacketFollowedByData *)data)->p;
148 // p->data=((PacketFollowedByData *)data)->data;
149 // p->length=dataSize;
150 // p->bitSize=BYTES_TO_BITS(dataSize);
151 // p->deleteData=false;
152 // p->guid=UNASSIGNED_RAKNET_GUID;
153 // return p;
154
155 SLNet::Packet *p;
156 packetAllocationPoolMutex.Lock();
157 p = packetAllocationPool.Allocate(file,line);
158 packetAllocationPoolMutex.Unlock();
159 p = new ((void*)p) Packet;
160 p->data=(unsigned char*) rakMalloc_Ex(dataSize,file,line);
161 p->length=dataSize;
162 p->bitSize=BYTES_TO_BITS(dataSize);
163 p->deleteData=true;
164 p->guid=UNASSIGNED_RAKNET_GUID;
165 p->wasGeneratedLocally=false;
166 return p;
167 }
168
169 Packet *RakPeer::AllocPacket(unsigned dataSize, unsigned char *data, const char *file, unsigned int line)
170 {
171 // Packet *p = (Packet *)rakMalloc_Ex(sizeof(Packet), file, line);
172 SLNet::Packet *p;
173 packetAllocationPoolMutex.Lock();
174 p = packetAllocationPool.Allocate(file,line);
175 packetAllocationPoolMutex.Unlock();
176 p = new ((void*)p) Packet;
177 RakAssert(p);
178 p->data=data;
179 p->length=dataSize;
180 p->bitSize=BYTES_TO_BITS(dataSize);
181 p->deleteData=true;
182 p->guid=UNASSIGNED_RAKNET_GUID;
183 p->wasGeneratedLocally=false;
184 return p;
185 }
186
187 STATIC_FACTORY_DEFINITIONS(RakPeerInterface,RakPeer)
188
189 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
190 // Constructor
191 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
192 RakPeer::RakPeer()
193 {
194 #if LIBCAT_SECURITY==1
195 // Encryption and security
196 CAT_AUDIT_PRINTF("AUDIT: Initializing RakPeer security flags: using_security = false, server_handshake = null, cookie_jar = null\n");
197 _using_security = false;
198 _server_handshake = 0;
199 _cookie_jar = 0;
200 #endif
201
202 StringCompressor::AddReference();
203 SLNet::StringTable::AddReference();
204 WSAStartupSingleton::AddRef();
205
206 defaultMTUSize = mtuSizes[NUM_MTU_SIZES-1];
207 trackFrequencyTable = false;
208 maximumIncomingConnections = 0;
209 maximumNumberOfPeers = 0;
210 //remoteSystemListSize=0;
211 remoteSystemList = 0;
212 activeSystemList = 0;
213 activeSystemListSize=0;
214 remoteSystemLookup=0;
215 bytesSentPerSecond = bytesReceivedPerSecond = 0;
216 endThreads = true;
217 isMainLoopThreadActive = false;
218 incomingDatagramEventHandler=0;
219
220
221
222
223
224 // isRecvfromThreadActive=false;
225 #if defined(GET_TIME_SPIKE_LIMIT) && GET_TIME_SPIKE_LIMIT>0
226 occasionalPing = true;
227 #else
228 occasionalPing = false;
229 #endif
230 allowInternalRouting=false;
231 for (unsigned int i=0; i < MAXIMUM_NUMBER_OF_INTERNAL_IDS; i++)
232 ipList[i]=UNASSIGNED_SYSTEM_ADDRESS;
233 allowConnectionResponseIPMigration = false;
234 //incomingPasswordLength=outgoingPasswordLength=0;
235 incomingPasswordLength=0;
236 splitMessageProgressInterval=0;
237 //unreliableTimeout=0;
238 unreliableTimeout=1000;
239 maxOutgoingBPS=0;
240 firstExternalID=UNASSIGNED_SYSTEM_ADDRESS;
241 myGuid=UNASSIGNED_RAKNET_GUID;
242 userUpdateThreadPtr=0;
243 userUpdateThreadData=0;
244
245 #ifdef _DEBUG
246 // Wait longer to disconnect in debug so I don't get disconnected while tracing
247 defaultTimeoutTime=30000;
248 #else
249 defaultTimeoutTime=10000;
250 #endif
251
252 #ifdef _DEBUG
253 _packetloss=0.0;
254 _minExtraPing=0;
255 _extraPingVariance=0;
256 #endif
257
258 bufferedCommands.SetPageSize(sizeof(BufferedCommandStruct)*16);
259 socketQueryOutput.SetPageSize(sizeof(SocketQueryOutput)*8);
260
261 packetAllocationPoolMutex.Lock();
262 packetAllocationPool.SetPageSize(sizeof(DataStructures::MemoryPool<Packet>::MemoryWithPage)*32);
263 packetAllocationPoolMutex.Unlock();
264
265 remoteSystemIndexPool.SetPageSize(sizeof(DataStructures::MemoryPool<RemoteSystemIndex>::MemoryWithPage)*32);
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309 GenerateGUID();
310
311 quitAndDataEvents.InitEvent();
312 limitConnectionFrequencyFromTheSameIP=false;
313 ResetSendReceipt();
314 }
315
316 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
317 // Destructor
318 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
319 RakPeer::~RakPeer()
320 {
321 Shutdown( 0, 0 );
322
323 // Free the ban list.
324 ClearBanList();
325
326 StringCompressor::RemoveReference();
327 SLNet::StringTable::RemoveReference();
328 WSAStartupSingleton::Deref();
329
330 quitAndDataEvents.CloseEvent();
331
332 #if LIBCAT_SECURITY==1
333 // Encryption and security
334 CAT_AUDIT_PRINTF("AUDIT: Deleting RakPeer security objects, handshake = %x, cookie jar = %x\n", _server_handshake, _cookie_jar);
335 if (_server_handshake) SLNet::OP_DELETE(_server_handshake,_FILE_AND_LINE_);
336 if (_cookie_jar) SLNet::OP_DELETE(_cookie_jar,_FILE_AND_LINE_);
337 #endif
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354 // for (unsigned int i=0; i < pluginListTS.Size(); i++)
355 // pluginListTS[i]->SetRakPeerInterface(0);
356 // for (unsigned int i=0; i < pluginListNTS.Size(); i++)
357 // pluginListNTS[i]->SetRakPeerInterface(0);
358 }
359
360 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
361 // \brief Starts the network threads, opens the listen port.
362 // You must call this before calling Connect().
363 // Multiple calls while already active are ignored. To call this function again with different settings, you must first call Shutdown().
364 // \note Call SetMaximumIncomingConnections if you want to accept incoming connections
365 // \param[in] maxConnections The maximum number of connections between this instance of RakPeer and another instance of RakPeer. Required so 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
366 // \param[in] localPort The port to listen for connections on.
367 // \param[in] _threadSleepTimer How many ms to Sleep each internal update cycle. With new congestion control, the best results will be obtained by passing 10.
368 // \param[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, 1SocketDescriptor(myPort,0); such as for a server. For a client, it is usually OK to just pass SocketDescriptor();
369 // \param[in] socketDescriptorCount The size of the \a socketDescriptors array. Pass 1 if you are not sure what to pass.
370 // \return False on failure (can't create socket or thread), true on success.
371 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
372 StartupResult RakPeer::Startup( unsigned int maxConnections, SocketDescriptor *socketDescriptors, unsigned socketDescriptorCount, int threadPriority )
373 {
374 if (IsActive())
375 return RAKNET_ALREADY_STARTED;
376
377 // If getting the guid failed in the constructor, try again
378 if (myGuid.g==0)
379 {
380 GenerateGUID();
381 if (myGuid.g==0)
382 return COULD_NOT_GENERATE_GUID;
383 }
384
385 if (threadPriority==-99999)
386 {
387
388
389 #if defined(_WIN32)
390 threadPriority=0;
391
392
393
394
395 #else
396 threadPriority=1000;
397 #endif
398 }
399
400
401 FillIPList();
402
403 if (myGuid==UNASSIGNED_RAKNET_GUID)
404 {
405 rnr.SeedMT( GenerateSeedFromGuid() );
406 }
407
408 //RakPeerAndIndex rpai[32];
409 //RakAssert(socketDescriptorCount<32);
410
411 RakAssert(socketDescriptors && socketDescriptorCount>=1);
412
413 if (socketDescriptors==0 || socketDescriptorCount<1)
414 return INVALID_SOCKET_DESCRIPTORS;
415
416 //unsigned short localPort;
417 //localPort=socketDescriptors[0].port;
418
419 RakAssert( maxConnections > 0 );
420
421 if ( maxConnections <= 0 )
422 return INVALID_MAX_CONNECTIONS;
423
424 DerefAllSockets();
425
426
427 unsigned i;
428 // Go through all socket descriptors and precreate sockets on the specified addresses
429 for (i=0; i<socketDescriptorCount; i++)
430 {
431 /*
432 const char *addrToBind;
433 if (socketDescriptors[i].hostAddress[0]==0)
434 addrToBind=0;
435 else
436 addrToBind=socketDescriptors[i].hostAddress;
437 */
438
439
440
441
442
443
444
445
446
447 /*
448 #if RAKNET_SUPPORT_IPV6==1
449 if (SocketLayer::IsSocketFamilySupported(addrToBind, socketDescriptors[i].socketFamily)==false)
450 return SOCKET_FAMILY_NOT_SUPPORTED;
451 #endif
452
453 if (socketDescriptors[i].port!=0 && SocketLayer::IsPortInUse(socketDescriptors[i].port, addrToBind, socketDescriptors[i].socketFamily)==true)
454 {
455 DerefAllSockets();
456 return SOCKET_PORT_ALREADY_IN_USE;
457 }
458
459 RakNetSocket* rns = 0;
460 if (socketDescriptors[i].remotePortRakNetWasStartedOn_PS3_PSP2==0)
461 {
462 rns = SocketLayer::CreateBoundSocket( this, socketDescriptors[i].port, socketDescriptors[i].blockingSocket, addrToBind, 100, socketDescriptors[i].extraSocketOptions, socketDescriptors[i].socketFamily, socketDescriptors[i].chromeInstance );
463 }
464 else
465 {
466 #if defined(_PS3) || defined(__PS3__) || defined(SN_TARGET_PS3) || defined(_PS4)
467 rns = SocketLayer::CreateBoundSocket_PS3Lobby( socketDescriptors[i].port, socketDescriptors[i].blockingSocket, addrToBind, socketDescriptors[i].socketFamily );
468 #elif defined(SN_TARGET_PSP2)
469 rns = SocketLayer::CreateBoundSocket_PSP2( socketDescriptors[i].port, socketDescriptors[i].blockingSocket, addrToBind, socketDescriptors[i].socketFamily );
470 #endif
471 }
472 */
473
474 RakNetSocket2 *r2 = RakNetSocket2Allocator::AllocRNS2();
475 r2->SetUserConnectionSocketIndex(i);
476 #if defined(__native_client__)
477 NativeClientBindParameters ncbp;
478 RNS2_NativeClient * nativeClientSocket = (RNS2_NativeClient*) r2;
479 ncbp.eventHandler=this;
480 ncbp.forceHostAddress=(char*) socketDescriptors[i].hostAddress;
481 ncbp.is_ipv6=socketDescriptors[i].socketFamily==AF_INET6;
482 ncbp.nativeClientInstance=socketDescriptors[i].chromeInstance;
483 ncbp.port=socketDescriptors[i].port;
484 nativeClientSocket->Bind(&ncbp, _FILE_AND_LINE_);
485 #elif defined(WINDOWS_STORE_RT)
486 RNS2BindResult br;
487 ((RNS2_WindowsStore8*) r2)->SetRecvEventHandler(this);
488 br = ((RNS2_WindowsStore8*) r2)->Bind(ref new Platform::String());
489 if (br!=BR_SUCCESS)
490 {
491 RakNetSocket2Allocator::DeallocRNS2(r2);
492 DerefAllSockets();
493 return SOCKET_FAILED_TO_BIND;
494 }
495 #else
496 if (r2->IsBerkleySocket())
497 {
498 RNS2_BerkleyBindParameters bbp;
499 bbp.port=socketDescriptors[i].port;
500 bbp.hostAddress=(char*) socketDescriptors[i].hostAddress;
501 bbp.addressFamily=socketDescriptors[i].socketFamily;
502 bbp.type=SOCK_DGRAM;
503 bbp.protocol=socketDescriptors[i].extraSocketOptions;
504 bbp.nonBlockingSocket=false;
505 bbp.setBroadcast=true;
506 bbp.setIPHdrIncl=false;
507 bbp.doNotFragment=false;
508 bbp.pollingThreadPriority=threadPriority;
509 bbp.eventHandler=this;
510 bbp.remotePortRakNetWasStartedOn_PS3_PS4_PSP2=socketDescriptors[i].remotePortRakNetWasStartedOn_PS3_PSP2;
511 RNS2BindResult br = ((RNS2_Berkley*) r2)->Bind(&bbp, _FILE_AND_LINE_);
512
513 if (
514 #if RAKNET_SUPPORT_IPV6==0
515 socketDescriptors[i].socketFamily!=AF_INET ||
516 #endif
517 br==BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE)
518 {
519 RakNetSocket2Allocator::DeallocRNS2(r2);
520 DerefAllSockets();
521 return SOCKET_FAMILY_NOT_SUPPORTED;
522 }
523 else if (br==BR_FAILED_TO_BIND_SOCKET)
524 {
525 RakNetSocket2Allocator::DeallocRNS2(r2);
526 DerefAllSockets();
527 return SOCKET_PORT_ALREADY_IN_USE;
528 }
529 else if (br==BR_FAILED_SEND_TEST)
530 {
531 RakNetSocket2Allocator::DeallocRNS2(r2);
532 DerefAllSockets();
533 return SOCKET_FAILED_TEST_SEND;
534 }
535 else
536 {
537 RakAssert(br==BR_SUCCESS);
538 }
539 }
540 else
541 {
542 RakAssert("TODO" && 0);
543 }
544 #endif
545 /*
546
547 SystemAddress saOut;
548 SocketLayer::GetSystemAddress( rns, &saOut );
549 rns->SetBoundAddress(saOut);
550 rns->SetRemotePortRakNetWasStartedOn(socketDescriptors[i].remotePortRakNetWasStartedOn_PS3_PSP2);
551 rns->SetChromeInstance(socketDescriptors[i].chromeInstance);
552 rns->SetExtraSocketOptions(socketDescriptors[i].extraSocketOptions);
553 rns->SetUserConnectionSocketIndex(i);
554 rns->SetBlockingSocket(socketDescriptors[i].blockingSocket);
555
556 #if RAKNET_SUPPORT_IPV6==0
557 if (addrToBind==0)
558 rns->SetBoundAddressToLoopback(4);
559 #endif
560
561 // GetBoundAddress is asynch, which isn't supported by this architecture
562 #if !defined(__native_client__)
563 int zero=0;
564 if (SocketLayer::SendTo(rns, (const char*) &zero,4, rns->GetBoundAddress(), _FILE_AND_LINE_)!=0)
565 {
566 DerefAllSockets();
567 return SOCKET_FAILED_TEST_SEND;
568 }
569 #endif
570 */
571
572 socketList.Push(r2, _FILE_AND_LINE_ );
573
574 }
575
576 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
577 for (i=0; i<socketDescriptorCount; i++)
578 {
579 if (socketList[i]->IsBerkleySocket())
580 ((RNS2_Berkley*) socketList[i])->CreateRecvPollingThread(threadPriority);
581 }
582 #endif
583
584 // #if !defined(_XBOX) && !defined(_XBOX_720_COMPILE_AS_WINDOWS) && !defined(X360)
585 for (i=0; i < MAXIMUM_NUMBER_OF_INTERNAL_IDS; i++)
586 {
587 if (ipList[i]==UNASSIGNED_SYSTEM_ADDRESS)
588 break;
589 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
590 if (socketList[0]->IsBerkleySocket())
591 {
592 unsigned short port = ((RNS2_Berkley*)socketList[0])->GetBoundAddress().GetPort();
593 ipList[i].SetPortHostOrder(port);
594
595 }
596 #endif
597 // ipList[i].SetPort(((RNS2_360_720*)socketList[0])->GetBoundAddress().GetPort());
598 }
599 // #endif
600
601
602 if ( maximumNumberOfPeers == 0 )
603 {
604 // Don't allow more incoming connections than we have peers.
605 if ( maximumIncomingConnections > maxConnections )
606 maximumIncomingConnections = maxConnections;
607
608 maximumNumberOfPeers = maxConnections;
609 // 04/19/2006 - Don't overallocate because I'm no longer allowing connected pings.
610 // The disconnects are not consistently processed and the process was sloppy and complicated.
611 // Allocate 10% extra to handle new connections from players trying to connect when the server is full
612 //remoteSystemListSize = maxConnections;// * 11 / 10 + 1;
613
614 // remoteSystemList in Single thread
615 //remoteSystemList = SLNet::OP_NEW<RemoteSystemStruct[ remoteSystemListSize ]>( _FILE_AND_LINE_ );
616 remoteSystemList = SLNet::OP_NEW_ARRAY<RemoteSystemStruct>(maximumNumberOfPeers, _FILE_AND_LINE_ );
617
618 remoteSystemLookup = SLNet::OP_NEW_ARRAY<RemoteSystemIndex*>((unsigned int) maximumNumberOfPeers * REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE, _FILE_AND_LINE_ );
619
620 activeSystemList = SLNet::OP_NEW_ARRAY<RemoteSystemStruct*>(maximumNumberOfPeers, _FILE_AND_LINE_ );
621
622 for ( i = 0; i < maximumNumberOfPeers; i++ )
623 //for ( i = 0; i < remoteSystemListSize; i++ )
624 {
625 // remoteSystemList in Single thread
626 remoteSystemList[ i ].isActive = false;
627 remoteSystemList[ i ].systemAddress = UNASSIGNED_SYSTEM_ADDRESS;
628 remoteSystemList[ i ].guid = UNASSIGNED_RAKNET_GUID;
629 remoteSystemList[ i ].myExternalSystemAddress = UNASSIGNED_SYSTEM_ADDRESS;
630 remoteSystemList[ i ].connectMode=RemoteSystemStruct::NO_ACTION;
631 remoteSystemList[ i ].MTUSize = defaultMTUSize;
632 remoteSystemList[ i ].remoteSystemIndex = (SystemIndex) i;
633 #ifdef _DEBUG
634 remoteSystemList[ i ].reliabilityLayer.ApplyNetworkSimulator(_packetloss, _minExtraPing, _extraPingVariance);
635 #endif
636
637 // All entries in activeSystemList have valid pointers all the time.
638 activeSystemList[ i ] = &remoteSystemList[ i ];
639 }
640
641 for (i=0; i < (unsigned int) maximumNumberOfPeers*REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE; i++)
642 {
643 remoteSystemLookup[i]=0;
644 }
645 }
646
647 // For histogram statistics
648 // nextReadBytesTime=0;
649 // lastSentBytes=lastReceivedBytes=0;
650
651 if ( endThreads )
652 {
653 updateCycleIsRunning = false;
654 endThreads = false;
655 firstExternalID=UNASSIGNED_SYSTEM_ADDRESS;
656
657 ClearBufferedCommands();
658 ClearBufferedPackets();
659 ClearSocketQueryOutput();
660
661 if ( isMainLoopThreadActive == false )
662 {
663 #if RAKPEER_USER_THREADED!=1
664
665 int errorCode;
666
667
668
669
670
671
672
673 errorCode = SLNet::RakThread::Create(UpdateNetworkLoop, this, threadPriority);
674
675
676 if ( errorCode != 0 )
677 {
678 Shutdown( 0, 0 );
679 return FAILED_TO_CREATE_NETWORK_THREAD;
680 }
681 // RakAssert(isRecvFromLoopThreadActive.GetValue()==0);
682 #endif // RAKPEER_USER_THREADED!=1
683
684 /*
685 for (i=0; i<socketDescriptorCount; i++)
686 {
687 RakPeerAndIndex *rpai = SLNet::OP_NEW<RakPeerAndIndex>(_FILE_AND_LINE_);
688 rpai->s=socketList[i];
689 rpai->rakPeer=this;
690
691 #if RAKPEER_USER_THREADED!=1
692
693 #if defined(SN_TARGET_PSP2)
694 sprintf_s(threadName, "RecvFromLoop_%p", this);
695 //errorCode = SLNet::RakThread::Create(RecvFromLoop, rpai, threadPriority, threadName, 1+i, runtime);
696 errorCode = SLNet::RakThread::Create(RecvFromLoop, rpai, threadPriority, threadName, 1024*1);
697 #else
698 errorCode = SLNet::RakThread::Create(RecvFromLoop, rpai, threadPriority);
699 #endif
700
701 if ( errorCode != 0 )
702 {
703 Shutdown( 0, 0 );
704 return FAILED_TO_CREATE_NETWORK_THREAD;
705 }
706 #endif // RAKPEER_USER_THREADED!=1
707 }
708 */
709
710
711 /*
712 #if RAKPEER_USER_THREADED!=1
713
714 while ( isRecvFromLoopThreadActive.GetValue() < (uint32_t) socketDescriptorCount )
715 RakSleep(10);
716 #endif // RAKPEER_USER_THREADED!=1
717 */
718
719 }
720
721 #if RAKPEER_USER_THREADED!=1
722 // Wait for the threads to activate. When they are active they will set these variables to true
723 while ( isMainLoopThreadActive == false )
724 RakSleep(10);
725 #endif // RAKPEER_USER_THREADED!=1
726 }
727
728 for (i=0; i < pluginListTS.Size(); i++)
729 {
730 pluginListTS[i]->OnRakPeerStartup();
731 }
732
733 for (i=0; i < pluginListNTS.Size(); i++)
734 {
735 pluginListNTS[i]->OnRakPeerStartup();
736 }
737
738 #ifdef USE_THREADED_SEND
739 SLNet::SendToThread::AddRef();
740 #endif
741
742 return RAKNET_STARTED;
743 }
744
745 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
746 // Description:
747 // Must be called while offline
748 //
749 // If you accept connections, you must call this or else security will not be enabled for incoming connections.
750 //
751 // This feature requires more round trips, bandwidth, and CPU time for the connection handshake
752 // x64 builds require under 25% of the CPU time of other builds
753 //
754 // See the Encryption sample for example usage
755 //
756 // Parameters:
757 // publicKey = A pointer to the public key for accepting new connections
758 // privateKey = A pointer to the private key for accepting new connections
759 // If the private keys are 0, then a new key will be generated when this function is called
760 // 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
761 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
762 bool RakPeer::InitializeSecurity(const char *public_key, const char *private_key, bool bRequireClientKey)
763 {
764 #if LIBCAT_SECURITY==1
765 if ( endThreads == false )
766 return false;
767
768 // Copy client public key requirement flag
769 _require_client_public_key = bRequireClientKey;
770
771 if (_server_handshake)
772 {
773 CAT_AUDIT_PRINTF("AUDIT: Deleting old server_handshake %x\n", _server_handshake);
774 SLNet::OP_DELETE(_server_handshake,_FILE_AND_LINE_);
775 }
776 if (_cookie_jar)
777 {
778 CAT_AUDIT_PRINTF("AUDIT: Deleting old cookie jar %x\n", _cookie_jar);
779 SLNet::OP_DELETE(_cookie_jar,_FILE_AND_LINE_);
780 }
781
782 _server_handshake = SLNet::OP_NEW<cat::ServerEasyHandshake>(_FILE_AND_LINE_);
783 _cookie_jar = SLNet::OP_NEW<cat::CookieJar>(_FILE_AND_LINE_);
784
785 CAT_AUDIT_PRINTF("AUDIT: Created new server_handshake %x\n", _server_handshake);
786 CAT_AUDIT_PRINTF("AUDIT: Created new cookie jar %x\n", _cookie_jar);
787 CAT_AUDIT_PRINTF("AUDIT: Running _server_handshake->Initialize()\n");
788
789 if (_server_handshake->Initialize(public_key, private_key))
790 {
791 CAT_AUDIT_PRINTF("AUDIT: Successfully initialized, filling cookie jar with goodies, storing public key and setting using security flag to true\n");
792
793 _server_handshake->FillCookieJar(_cookie_jar);
794
795 memcpy(my_public_key, public_key, sizeof(my_public_key));
796
797 _using_security = true;
798 return true;
799 }
800
801 CAT_AUDIT_PRINTF("AUDIT: Failure to initialize so deleting server handshake and cookie jar; also setting using_security flag = false\n");
802
803 SLNet::OP_DELETE(_server_handshake,_FILE_AND_LINE_);
804 _server_handshake=0;
805 SLNet::OP_DELETE(_cookie_jar,_FILE_AND_LINE_);
806 _cookie_jar=0;
807 _using_security = false;
808 return false;
809 #else
810 (void) public_key;
811 (void) private_key;
812 (void) bRequireClientKey;
813
814 return false;
815 #endif
816 }
817
818 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
819 // Description
820 // Must be called while offline
821 // Disables security for incoming connections.
822 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
823 void RakPeer::DisableSecurity( void )
824 {
825 #if LIBCAT_SECURITY==1
826 CAT_AUDIT_PRINTF("AUDIT: DisableSecurity() called, so deleting _server_handshake %x and cookie_jar %x\n", _server_handshake, _cookie_jar);
827 SLNet::OP_DELETE(_server_handshake,_FILE_AND_LINE_);
828 _server_handshake=0;
829 SLNet::OP_DELETE(_cookie_jar,_FILE_AND_LINE_);
830 _cookie_jar=0;
831
832 _using_security = false;
833 #endif
834 }
835
836 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
837 void RakPeer::AddToSecurityExceptionList(const char *ip)
838 {
839 securityExceptionMutex.Lock();
840 securityExceptionList.Insert(RakString(ip), _FILE_AND_LINE_);
841 securityExceptionMutex.Unlock();
842 }
843
844 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
845 void RakPeer::RemoveFromSecurityExceptionList(const char *ip)
846 {
847 if (securityExceptionList.Size()==0)
848 return;
849
850 if (ip==0)
851 {
852 securityExceptionMutex.Lock();
853 securityExceptionList.Clear(false, _FILE_AND_LINE_);
854 securityExceptionMutex.Unlock();
855 }
856 else
857 {
858 unsigned i=0;
859 securityExceptionMutex.Lock();
860 while (i < securityExceptionList.Size())
861 {
862 if (securityExceptionList[i].IPAddressMatch(ip))
863 {
864 securityExceptionList[i]=securityExceptionList[securityExceptionList.Size()-1];
865 securityExceptionList.RemoveAtIndex(securityExceptionList.Size()-1);
866 }
867 else
868 i++;
869 }
870 securityExceptionMutex.Unlock();
871 }
872 }
873 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
874 bool RakPeer::IsInSecurityExceptionList(const char *ip)
875 {
876 if (securityExceptionList.Size()==0)
877 return false;
878
879 unsigned i=0;
880 securityExceptionMutex.Lock();
881 for (; i < securityExceptionList.Size(); i++)
882 {
883 if (securityExceptionList[i].IPAddressMatch(ip))
884 {
885 securityExceptionMutex.Unlock();
886 return true;
887 }
888 }
889 securityExceptionMutex.Unlock();
890 return false;
891 }
892
893 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
894 // Description:
895 // Sets how many incoming connections are allowed. If this is less than the number of players currently connected, no
896 // more players will be allowed to connect. If this is greater than the maximum number of peers allowed, it will be reduced
897 // to the maximum number of peers allowed. Defaults to 0.
898 //
899 // Parameters:
900 // numberAllowed - Maximum number of incoming connections allowed.
901 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
902 void RakPeer::SetMaximumIncomingConnections( unsigned short numberAllowed )
903 {
904 maximumIncomingConnections = numberAllowed;
905 }
906
907 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
908 // Description:
909 // Returns the maximum number of incoming connections, which is always <= maxConnections
910 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
911 unsigned int RakPeer::GetMaximumIncomingConnections( void ) const
912 {
913 return maximumIncomingConnections;
914 }
915
916 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
917 // Returns how many open connections there are at this time
918 // \return the number of open connections
919 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
920 unsigned short RakPeer::NumberOfConnections(void) const
921 {
922 DataStructures::List<SystemAddress> addresses;
923 DataStructures::List<RakNetGUID> guids;
924 GetSystemList(addresses, guids);
925 return (unsigned short) addresses.Size();
926 }
927
928 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
929 // Description:
930 // Sets the password incoming connections must match in the call to Connect (defaults to none)
931 // Pass 0 to passwordData to specify no password
932 //
933 // Parameters:
934 // passwordData: A data block that incoming connections must match. This can be just a password, or can be a stream of data.
935 // - Specify 0 for no password data
936 // passwordDataLength: The length in bytes of passwordData
937 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
938 void RakPeer::SetIncomingPassword( const char* passwordData, int passwordDataLength )
939 {
940 //if (passwordDataLength > MAX_OFFLINE_DATA_LENGTH)
941 // passwordDataLength=MAX_OFFLINE_DATA_LENGTH;
942
943 if (passwordDataLength > 255)
944 passwordDataLength=255;
945
946 if (passwordData==0)
947 passwordDataLength=0;
948
949 // Not threadsafe but it's not important enough to lock. Who is going to change the password a lot during runtime?
950 // It won't overflow at least because incomingPasswordLength is an unsigned char
951 if (passwordDataLength>0)
952 memcpy(incomingPassword, passwordData, passwordDataLength);
953 incomingPasswordLength=(unsigned char)passwordDataLength;
954 }
955
956 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
957 void RakPeer::GetIncomingPassword( char* passwordData, int *passwordDataLength )
958 {
959 if (passwordData==0)
960 {
961 *passwordDataLength=incomingPasswordLength;
962 return;
963 }
964
965 if (*passwordDataLength > incomingPasswordLength)
966 *passwordDataLength=incomingPasswordLength;
967
968 if (*passwordDataLength>0)
969 memcpy(passwordData, incomingPassword, *passwordDataLength);
970 }
971
972 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
973 // Description:
974 // Call this to connect to the specified host (ip or domain name) and server port.
975 // Calling Connect and not calling SetMaximumIncomingConnections acts as a dedicated client. Calling both acts as a true peer.
976 // This is a non-blocking connection. You know the connection is successful when IsConnected() returns true
977 // or receive gets a packet with the type identifier ID_CONNECTION_REQUEST_ACCEPTED. If the connection is not
978 // successful, such as rejected connection or no response then neither of these things will happen.
979 // Requires that you first call Initialize
980 //
981 // Parameters:
982 // host: Either a dotted IP address or a domain name
983 // remotePort: Which port to connect to on the remote machine.
984 // passwordData: A data block that must match the data block on the server. This can be just a password, or can be a stream of data
985 // passwordDataLength: The length in bytes of passwordData
986 //
987 // Returns:
988 // True on successful initiation. False on incorrect parameters, internal error, or too many existing peers
989 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
990 ConnectionAttemptResult RakPeer::Connect( const char* host, unsigned short remotePort, const char *passwordData, int passwordDataLength, PublicKey *publicKey, unsigned connectionSocketIndex, unsigned sendConnectionAttemptCount, unsigned timeBetweenSendConnectionAttemptsMS, SLNet::TimeMS timeoutTime )
991 {
992 // If endThreads is true here you didn't call Startup() first.
993 if ( host == 0 || endThreads || connectionSocketIndex>=socketList.Size() )
994 return INVALID_PARAMETER;
995
996 RakAssert(remotePort!=0);
997
998 connectionSocketIndex=GetRakNetSocketFromUserConnectionSocketIndex(connectionSocketIndex);
999
1000 if (passwordDataLength>255)
1001 passwordDataLength=255;
1002
1003 if (passwordData==0)
1004 passwordDataLength=0;
1005
1006 // Not threadsafe but it's not important enough to lock. Who is going to change the password a lot during runtime?
1007 // It won't overflow at least because outgoingPasswordLength is an unsigned char
1008 // if (passwordDataLength>0)
1009 // memcpy(outgoingPassword, passwordData, passwordDataLength);
1010 // outgoingPasswordLength=(unsigned char) passwordDataLength;
1011
1012 // 04/02/09 - Can't remember why I disabled connecting to self, but it seems to work
1013 // Connecting to ourselves in the same instance of the program?
1014 // if ( ( strcmp( host, "127.0.0.1" ) == 0 || strcmp( host, "0.0.0.0" ) == 0 ) && remotePort == mySystemAddress[0].port )
1015 // return false;
1016
1017 return SendConnectionRequest( host, remotePort, passwordData, passwordDataLength, publicKey, connectionSocketIndex, 0, sendConnectionAttemptCount, timeBetweenSendConnectionAttemptsMS, timeoutTime);
1018 }
1019
1020 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1021
1022 ConnectionAttemptResult RakPeer::ConnectWithSocket(const char* host, unsigned short remotePort, const char *passwordData, int passwordDataLength, RakNetSocket2* socket, PublicKey *publicKey, unsigned sendConnectionAttemptCount, unsigned timeBetweenSendConnectionAttemptsMS, SLNet::TimeMS timeoutTime)
1023 {
1024 if ( host == 0 || endThreads || socket == 0 )
1025 return INVALID_PARAMETER;
1026
1027 if (passwordDataLength>255)
1028 passwordDataLength=255;
1029
1030 if (passwordData==0)
1031 passwordDataLength=0;
1032
1033 return SendConnectionRequest( host, remotePort, passwordData, passwordDataLength, publicKey, 0, 0, sendConnectionAttemptCount, timeBetweenSendConnectionAttemptsMS, timeoutTime, socket );
1034
1035 }
1036
1037 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1038 // Description:
1039 // Stops the network threads and close all connections. Multiple calls are ok.
1040 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1041 void RakPeer::Shutdown( unsigned int blockDuration, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority )
1042 {
1043 unsigned i,j;
1044 bool anyActive;
1045 SLNet::TimeMS startWaitingTime;
1046 // SystemAddress systemAddress;
1047 SLNet::TimeMS time;
1048 //unsigned short systemListSize = remoteSystemListSize; // This is done for threading reasons
1049 unsigned int systemListSize = maximumNumberOfPeers;
1050
1051 if ( blockDuration > 0 )
1052 {
1053 for ( i = 0; i < systemListSize; i++ )
1054 {
1055 // remoteSystemList in user thread
1056 if (remoteSystemList[i].isActive)
1057 NotifyAndFlagForShutdown(remoteSystemList[i].systemAddress, false, orderingChannel, disconnectionNotificationPriority);
1058 }
1059
1060 time = SLNet::GetTimeMS();
1061 startWaitingTime = time;
1062 while ( time - startWaitingTime < blockDuration )
1063 {
1064 anyActive=false;
1065 for (j=0; j < systemListSize; j++)
1066 {
1067 // remoteSystemList in user thread
1068 if (remoteSystemList[j].isActive)
1069 {
1070 anyActive=true;
1071 break;
1072 }
1073 }
1074
1075 // If this system is out of packets to send, then stop waiting
1076 if ( anyActive==false )
1077 break;
1078
1079 // This will probably cause the update thread to run which will probably
1080 // send the disconnection notification
1081
1082 RakSleep(15);
1083 time = SLNet::GetTimeMS();
1084 }
1085 }
1086 for (i=0; i < pluginListTS.Size(); i++)
1087 {
1088 pluginListTS[i]->OnRakPeerShutdown();
1089 }
1090 for (i=0; i < pluginListNTS.Size(); i++)
1091 {
1092 pluginListNTS[i]->OnRakPeerShutdown();
1093 }
1094
1095 quitAndDataEvents.SetEvent();
1096
1097 endThreads = true;
1098
1099 // SLNet::TimeMS timeout;
1100 #if RAKPEER_USER_THREADED!=1
1101
1102 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
1103 for (i=0; i < socketList.Size(); i++)
1104 {
1105 if (socketList[i]->IsBerkleySocket())
1106 {
1107 ((RNS2_Berkley *)socketList[i])->SignalStopRecvPollingThread();
1108 }
1109 }
1110 #endif
1111
1112 /*
1113 // Get recvfrom to unblock
1114 for (i=0; i < socketList.Size(); i++)
1115 {
1116 if (SocketLayer::SendTo(socketList[i], (const char*) &i,1,socketList[i]->GetBoundAddress(), _FILE_AND_LINE_)!=0)
1117 break;
1118 }
1119 */
1120
1121 while ( isMainLoopThreadActive )
1122 {
1123 endThreads = true;
1124 RakSleep(15);
1125 }
1126
1127 activeSystemListSize = 0;
1128
1129 /*
1130 timeout = SLNet::GetTimeMS()+1000;
1131 while ( isRecvFromLoopThreadActive.GetValue()>0 && SLNet::GetTimeMS()<timeout )
1132 {
1133 // Get recvfrom to unblock
1134 for (i=0; i < socketList.Size(); i++)
1135 {
1136 SocketLayer::SendTo(socketList[i], (const char*) &i,1,socketList[i]->GetBoundAddress(), _FILE_AND_LINE_);
1137 }
1138
1139 RakSleep(30);
1140 }
1141 */
1142
1143 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
1144 for (i=0; i < socketList.Size(); i++)
1145 {
1146 if (socketList[i]->IsBerkleySocket())
1147 {
1148 ((RNS2_Berkley *)socketList[i])->BlockOnStopRecvPollingThread();
1149 }
1150 }
1151 #endif
1152
1153
1154 #endif // RAKPEER_USER_THREADED!=1
1155
1156 // char c=0;
1157 // unsigned int socketIndex;
1158 // remoteSystemList in Single thread
1159 for ( i = 0; i < systemListSize; i++ )
1160 {
1161 // Reserve this reliability layer for ourselves
1162 remoteSystemList[ i ].isActive = false;
1163
1164 // Remove any remaining packets
1165 RakAssert(remoteSystemList[ i ].MTUSize <= MAXIMUM_MTU_SIZE);
1166 remoteSystemList[ i ].reliabilityLayer.Reset(false, remoteSystemList[ i ].MTUSize, false);
1167 remoteSystemList[ i ].rakNetSocket = 0;
1168 }
1169
1170
1171 // Setting maximumNumberOfPeers to 0 allows remoteSystemList to be reallocated in Initialize.
1172 // Setting remoteSystemListSize prevents threads from accessing the reliability layer
1173 maximumNumberOfPeers = 0;
1174 //remoteSystemListSize = 0;
1175
1176 // Free any packets the user didn't deallocate
1177 packetReturnMutex.Lock();
1178 for (i=0; i < packetReturnQueue.Size(); i++)
1179 DeallocatePacket(packetReturnQueue[i]);
1180 packetReturnQueue.Clear(_FILE_AND_LINE_);
1181 packetReturnMutex.Unlock();
1182 packetAllocationPoolMutex.Lock();
1183 packetAllocationPool.Clear(_FILE_AND_LINE_);
1184 packetAllocationPoolMutex.Unlock();
1185
1186 /*
1187 if (isRecvFromLoopThreadActive.GetValue()>0)
1188 {
1189 timeout = SLNet::GetTimeMS()+1000;
1190 while ( isRecvFromLoopThreadActive.GetValue()>0 && SLNet::GetTimeMS()<timeout )
1191 {
1192 RakSleep(30);
1193 }
1194 }
1195 */
1196
1197 DerefAllSockets();
1198
1199 ClearBufferedCommands();
1200 ClearBufferedPackets();
1201 ClearSocketQueryOutput();
1202 bytesSentPerSecond = bytesReceivedPerSecond = 0;
1203
1204 ClearRequestedConnectionList();
1205
1206
1207 // Clear out the reliability layer list in case we want to reallocate it in a successive call to Init.
1208 RemoteSystemStruct * temp = remoteSystemList;
1209 remoteSystemList = 0;
1210 SLNet::OP_DELETE_ARRAY(temp, _FILE_AND_LINE_);
1211 SLNet::OP_DELETE_ARRAY(activeSystemList, _FILE_AND_LINE_);
1212 activeSystemList=0;
1213
1214 ClearRemoteSystemLookup();
1215
1216 #ifdef USE_THREADED_SEND
1217 SLNet::SendToThread::Deref();
1218 #endif
1219
1220 ResetSendReceipt();
1221 }
1222
1223 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1224 // Description:
1225 // Returns true if the network threads are running
1226 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1227 inline bool RakPeer::IsActive( void ) const
1228 {
1229 return endThreads == false;
1230 }
1231
1232 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1233 // Description:
1234 // Fills the array remoteSystems with the systemAddress of all the systems we are connected to
1235 //
1236 // Parameters:
1237 // remoteSystems (out): An array of SystemAddress structures to be filled with the SystemAddresss of the systems we are connected to
1238 // - pass 0 to remoteSystems to only get the number of systems we are connected to
1239 // numberOfSystems (int, out): As input, the size of remoteSystems array. As output, the number of elements put into the array
1240 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1241 bool RakPeer::GetConnectionList( SystemAddress *remoteSystems, unsigned short *numberOfSystems ) const
1242 {
1243 if (numberOfSystems==0)
1244 return false;
1245
1246 if ( remoteSystemList == 0 || endThreads == true )
1247 {
1248 if (numberOfSystems)
1249 *numberOfSystems=0;
1250 return false;
1251 }
1252
1253 DataStructures::List<SystemAddress> addresses;
1254 DataStructures::List<RakNetGUID> guids;
1255 GetSystemList(addresses, guids);
1256 if (remoteSystems)
1257 {
1258 unsigned short i;
1259 for (i=0; i < *numberOfSystems && i < addresses.Size(); i++)
1260 remoteSystems[i]=addresses[i];
1261 *numberOfSystems=i;
1262 }
1263 else
1264 {
1265 *numberOfSystems=(unsigned short) addresses.Size();
1266 }
1267 return true;
1268 }
1269
1270 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1271 uint32_t RakPeer::GetNextSendReceipt(void)
1272 {
1273 sendReceiptSerialMutex.Lock();
1274 uint32_t retVal = sendReceiptSerial;
1275 sendReceiptSerialMutex.Unlock();
1276 return retVal;
1277 }
1278 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1279 uint32_t RakPeer::IncrementNextSendReceipt(void)
1280 {
1281 sendReceiptSerialMutex.Lock();
1282 uint32_t returned = sendReceiptSerial;
1283 if (++sendReceiptSerial==0)
1284 sendReceiptSerial=1;
1285 sendReceiptSerialMutex.Unlock();
1286 return returned;
1287 }
1288
1289 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1290 // Description:
1291 // Sends a block of data to the specified system that you are connected to.
1292 // This function only works while the client is connected (Use the Connect function).
1293 // The first byte should be a message identifier starting at ID_USER_PACKET_ENUM
1294 //
1295 // Parameters:
1296 // data: The block of data to send
1297 // length: The size in bytes of the data to send
1298 // bitStream: The bitstream to send
1299 // priority: What priority level to send on.
1300 // reliability: How reliability to send this data
1301 // orderingChannel: When using ordered or sequenced packets, what channel to order these on.
1302 // - Packets are only ordered relative to other packets on the same stream
1303 // systemAddress: Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_SYSTEM_ADDRESS to specify none
1304 // broadcast: True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to.
1305 // Returns:
1306 // \return 0 on bad input. Otherwise a number that identifies this message. If \a 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
1307 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1308 uint32_t RakPeer::Send( const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber )
1309 {
1310 #ifdef _DEBUG
1311 RakAssert( data && length > 0 );
1312 #endif
1313 RakAssert( !( reliability >= NUMBER_OF_RELIABILITIES || reliability < 0 ) );
1314 RakAssert( !( priority > NUMBER_OF_PRIORITIES || priority < 0 ) );
1315 RakAssert( !( orderingChannel >= NUMBER_OF_ORDERED_STREAMS ) );
1316
1317 if ( data == 0 || length < 0 )
1318 return 0;
1319
1320 if ( remoteSystemList == 0 || endThreads == true )
1321 return 0;
1322
1323 if ( broadcast == false && systemIdentifier.IsUndefined())
1324 return 0;
1325
1326 uint32_t usedSendReceipt;
1327 if (forceReceiptNumber!=0)
1328 usedSendReceipt=forceReceiptNumber;
1329 else
1330 usedSendReceipt=IncrementNextSendReceipt();
1331
1332 if (broadcast==false && IsLoopbackAddress(systemIdentifier,true))
1333 {
1334 SendLoopback(data,length);
1335
1336 if (reliability>=UNRELIABLE_WITH_ACK_RECEIPT)
1337 {
1338 char buff[5];
1339 buff[0]=ID_SND_RECEIPT_ACKED;
1340 sendReceiptSerialMutex.Lock();
1341 memcpy(buff+1, &sendReceiptSerial, 4);
1342 sendReceiptSerialMutex.Unlock();
1343 SendLoopback( buff, 5 );
1344 }
1345
1346 return usedSendReceipt;
1347 }
1348
1349 SendBuffered(data, length*8, priority, reliability, orderingChannel, systemIdentifier, broadcast, RemoteSystemStruct::NO_ACTION, usedSendReceipt);
1350
1351 return usedSendReceipt;
1352 }
1353
1354 void RakPeer::SendLoopback( const char *data, const int length )
1355 {
1356 if ( data == 0 || length < 0 )
1357 return;
1358
1359 Packet *packet = AllocPacket(length, _FILE_AND_LINE_);
1360 memcpy(packet->data, data, length);
1361 packet->systemAddress = GetLoopbackAddress();
1362 packet->guid=myGuid;
1363 PushBackPacket(packet, false);
1364 }
1365
1366 uint32_t RakPeer::Send( const SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber )
1367 {
1368 #ifdef _DEBUG
1369 RakAssert( bitStream->GetNumberOfBytesUsed() > 0 );
1370 #endif
1371
1372 RakAssert( !( reliability >= NUMBER_OF_RELIABILITIES || reliability < 0 ) );
1373 RakAssert( !( priority > NUMBER_OF_PRIORITIES || priority < 0 ) );
1374 RakAssert( !( orderingChannel >= NUMBER_OF_ORDERED_STREAMS ) );
1375
1376 if ( bitStream->GetNumberOfBytesUsed() == 0 )
1377 return 0;
1378
1379 if ( remoteSystemList == 0 || endThreads == true )
1380 return 0;
1381
1382 if ( broadcast == false && systemIdentifier.IsUndefined() )
1383 return 0;
1384
1385 uint32_t usedSendReceipt;
1386 if (forceReceiptNumber!=0)
1387 usedSendReceipt=forceReceiptNumber;
1388 else
1389 usedSendReceipt=IncrementNextSendReceipt();
1390
1391 if (broadcast==false && IsLoopbackAddress(systemIdentifier,true))
1392 {
1393 SendLoopback((const char*) bitStream->GetData(),bitStream->GetNumberOfBytesUsed());
1394 if (reliability>=UNRELIABLE_WITH_ACK_RECEIPT)
1395 {
1396 char buff[5];
1397 buff[0]=ID_SND_RECEIPT_ACKED;
1398 sendReceiptSerialMutex.Lock();
1399 memcpy(buff+1, &sendReceiptSerial,4);
1400 sendReceiptSerialMutex.Unlock();
1401 SendLoopback( buff, 5 );
1402 }
1403 return usedSendReceipt;
1404 }
1405
1406 // Sends need to be buffered and processed in the update thread because the systemAddress associated with the reliability layer can change,
1407 // from that thread, resulting in a send to the wrong player! While I could mutex the systemAddress, that is much slower than doing this
1408 SendBuffered((const char*)bitStream->GetData(), bitStream->GetNumberOfBitsUsed(), priority, reliability, orderingChannel, systemIdentifier, broadcast, RemoteSystemStruct::NO_ACTION, usedSendReceipt);
1409
1410
1411 return usedSendReceipt;
1412 }
1413 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1414 // Sends multiple blocks of data, concatenating them automatically.
1415 //
1416 // This is equivalent to:
1417 // SLNet::BitStream bs;
1418 // bs.WriteAlignedBytes(block1, blockLength1);
1419 // bs.WriteAlignedBytes(block2, blockLength2);
1420 // bs.WriteAlignedBytes(block3, blockLength3);
1421 // Send(&bs, ...)
1422 //
1423 // This function only works while connected
1424 // \param[in] data An array of pointers to blocks of data
1425 // \param[in] lengths An array of integers indicating the length of each block of data
1426 // \param[in] numParameters Length of the arrays data and lengths
1427 // \param[in] priority What priority level to send on. See PacketPriority.h
1428 // \param[in] reliability How reliability to send this data. See PacketPriority.h
1429 // \param[in] orderingChannel When using ordered or sequenced messages, what channel to order these on. Messages are only ordered relative to other messages on the same stream
1430 // \param[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
1431 // \param[in] broadcast True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to.
1432 // \return False if we are not connected to the specified recipient. True otherwise
1433 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1434 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 )
1435 {
1436 #ifdef _DEBUG
1437 RakAssert( data );
1438 #endif
1439
1440 if ( data == 0 || lengths == 0 )
1441 return 0;
1442
1443 if ( remoteSystemList == 0 || endThreads == true )
1444 return 0;
1445
1446 if (numParameters==0)
1447 return 0;
1448
1449 if (lengths==0)
1450 return 0;
1451
1452 if ( broadcast == false && systemIdentifier.IsUndefined() )
1453 return 0;
1454
1455 uint32_t usedSendReceipt;
1456 if (forceReceiptNumber!=0)
1457 usedSendReceipt=forceReceiptNumber;
1458 else
1459 usedSendReceipt=IncrementNextSendReceipt();
1460
1461 SendBufferedList(data, lengths, numParameters, priority, reliability, orderingChannel, systemIdentifier, broadcast, RemoteSystemStruct::NO_ACTION, usedSendReceipt);
1462
1463 return usedSendReceipt;
1464 }
1465
1466 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1467 // Description:
1468 // Gets a packet from the incoming packet queue. Use DeallocatePacket to deallocate the packet after you are done with it.
1469 // Check the Packet struct at the top of CoreNetworkStructures.h for the format of the struct
1470 //
1471 // Returns:
1472 // 0 if no packets are waiting to be handled, otherwise an allocated packet
1473 // If the client is not active this will also return 0, as all waiting packets are flushed when the client is Disconnected
1474 // This also updates all memory blocks associated with synchronized memory and distributed objects
1475 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1476 Packet* RakPeer::Receive( void )
1477 {
1478 if ( !( IsActive() ) )
1479 return 0;
1480
1481 SLNet::Packet *packet;
1482 // Packet **threadPacket;
1483 PluginReceiveResult pluginResult;
1484
1485 int offset;
1486 unsigned int i;
1487
1488 // User should call RunUpdateCycle and RunRecvFromOnce to do this commented code
1489 /*
1490 #if RAKPEER_SINGLE_THREADED==1
1491 RakPeer::RecvFromStruct *recvFromStruct;
1492 for (i=0; i < socketList.Size(); i++)
1493 {
1494 for(;;)
1495 {
1496 recvFromStruct=bufferedPackets.Allocate( _FILE_AND_LINE_ );
1497 recvFromStruct->s=socketList[i]->s;
1498 recvFromStruct->remotePortRakNetWasStartedOn_PS3=socketList[i]->remotePortRakNetWasStartedOn_PS3_PSP2;
1499 recvFromStruct->extraSocketOptions=socketList[i]->extraSocketOptions;
1500 SocketLayer::RecvFromBlocking(
1501 recvFromStruct->s, this, recvFromStruct->remotePortRakNetWasStartedOn_PS3,
1502 recvFromStruct->extraSocketOptions, recvFromStruct->data, &recvFromStruct->bytesRead, &recvFromStruct->systemAddress, &recvFromStruct->timeRead);
1503 if (recvFromStruct->bytesRead<=0)
1504 {
1505 bufferedPackets.Deallocate(recvFromStruct, _FILE_AND_LINE_);
1506 break;
1507 }
1508 else
1509 {
1510 RakAssert(recvFromStruct->systemAddress.GetPort());
1511 bufferedPackets.Push(recvFromStruct);
1512 }
1513 }
1514 }
1515
1516 BitStream updateBitStream( MAXIMUM_MTU_SIZE
1517 #if LIBCAT_SECURITY==1
1518 + cat::AuthenticatedEncryption::OVERHEAD_BYTES
1519 #endif
1520 );
1521 RunUpdateCycle(0, 0, updateBitStream);
1522 #endif
1523 */
1524
1525 for (i=0; i < pluginListTS.Size(); i++)
1526 {
1527 pluginListTS[i]->Update();
1528 }
1529 for (i=0; i < pluginListNTS.Size(); i++)
1530 {
1531 pluginListNTS[i]->Update();
1532 }
1533
1534 do
1535 {
1536 packetReturnMutex.Lock();
1537 if (packetReturnQueue.IsEmpty())
1538 packet=0;
1539 else
1540 packet = packetReturnQueue.Pop();
1541 packetReturnMutex.Unlock();
1542 if (packet==0)
1543 return 0;
1544
1545 // unsigned char msgId;
1546 if ( ( packet->length >= sizeof(unsigned char) + sizeof(SLNet::Time ) ) &&
1547 ( (unsigned char) packet->data[ 0 ] == ID_TIMESTAMP ) )
1548 {
1549 offset = sizeof(unsigned char);
1550 ShiftIncomingTimestamp( packet->data + offset, packet->systemAddress );
1551 // msgId=packet->data[sizeof(unsigned char) + sizeof( SLNet::Time )];
1552 }
1553 // else
1554 // msgId=packet->data[0];
1555
1556 // Some locally generated packets need to be processed by plugins, for example ID_FCM2_NEW_HOST
1557 // The plugin itself should intercept these messages generated remotely
1558 // if (packet->wasGeneratedLocally)
1559 // return packet;
1560
1561
1562 CallPluginCallbacks(pluginListTS, packet);
1563 CallPluginCallbacks(pluginListNTS, packet);
1564
1565 for (i=0; i < pluginListTS.Size(); i++)
1566 {
1567 pluginResult=pluginListTS[i]->OnReceive(packet);
1568 if (pluginResult==RR_STOP_PROCESSING_AND_DEALLOCATE)
1569 {
1570 DeallocatePacket( packet );
1571 packet=0; // Will do the loop again and get another packet
1572 break; // break out of the enclosing for
1573 }
1574 else if (pluginResult==RR_STOP_PROCESSING)
1575 {
1576 packet=0;
1577 break;
1578 }
1579 }
1580
1581 for (i=0; i < pluginListNTS.Size(); i++)
1582 {
1583 pluginResult=pluginListNTS[i]->OnReceive(packet);
1584 if (pluginResult==RR_STOP_PROCESSING_AND_DEALLOCATE)
1585 {
1586 DeallocatePacket( packet );
1587 packet=0; // Will do the loop again and get another packet
1588 break; // break out of the enclosing for
1589 }
1590 else if (pluginResult==RR_STOP_PROCESSING)
1591 {
1592 packet=0;
1593 break;
1594 }
1595 }
1596
1597 } while(packet==0);
1598
1599 #ifdef _DEBUG
1600 RakAssert( packet->data );
1601 #endif
1602
1603 return packet;
1604 }
1605
1606 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1607 // Description:
1608 // Call this to deallocate a packet returned by Receive
1609 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1610 void RakPeer::DeallocatePacket( Packet *packet )
1611 {
1612 if ( packet == 0 )
1613 return;
1614
1615 if (packet->deleteData)
1616 {
1617 rakFree_Ex(packet->data, _FILE_AND_LINE_ );
1618 packet->~Packet();
1619 packetAllocationPoolMutex.Lock();
1620 packetAllocationPool.Release(packet,_FILE_AND_LINE_);
1621 packetAllocationPoolMutex.Unlock();
1622 }
1623 else
1624 {
1625 rakFree_Ex(packet, _FILE_AND_LINE_ );
1626 }
1627 }
1628
1629 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1630 // Description:
1631 // Return the total number of connections we are allowed
1632 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1633 unsigned int RakPeer::GetMaximumNumberOfPeers( void ) const
1634 {
1635 return maximumNumberOfPeers;
1636 }
1637
1638 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1639 // Description:
1640 // Close the connection to another host (if we initiated the connection it will disconnect, if they did it will kick them out).
1641 //
1642 // Parameters:
1643 // target: Which connection to close
1644 // sendDisconnectionNotification: True to send ID_DISCONNECTION_NOTIFICATION to the recipient. False to close it silently.
1645 // channel: If blockDuration > 0, the disconnect packet will be sent on this channel
1646 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1647 void RakPeer::CloseConnection( const AddressOrGUID target, bool sendDisconnectionNotification, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority )
1648 {
1649 /*
1650 // This only be called from the user thread, for the user shutting down.
1651 // From the network thread, this should occur because of ID_DISCONNECTION_NOTIFICATION and ID_CONNECTION_LOST
1652 unsigned j;
1653 for (j=0; j < messageHandlerList.Size(); j++)
1654 {
1655 messageHandlerList[j]->OnClosedConnection(
1656 target.systemAddress==UNASSIGNED_SYSTEM_ADDRESS ? GetSystemAddressFromGuid(target.rakNetGuid) : target.systemAddress,
1657 target.rakNetGuid==UNASSIGNED_RAKNET_GUID ? GetGuidFromSystemAddress(target.systemAddress) : target.rakNetGuid,
1658 LCR_CLOSED_BY_USER);
1659 }
1660 */
1661
1662 CloseConnectionInternal(target, sendDisconnectionNotification, false, orderingChannel, disconnectionNotificationPriority);
1663
1664 // 12/14/09 Return ID_CONNECTION_LOST when calling CloseConnection with sendDisconnectionNotification==false, elsewise it is never returned
1665 if (sendDisconnectionNotification==false && GetConnectionState(target)==IS_CONNECTED)
1666 {
1667 Packet *packet=AllocPacket(sizeof( char ), _FILE_AND_LINE_);
1668 packet->data[ 0 ] = ID_CONNECTION_LOST; // DeadConnection
1669 packet->guid = target.rakNetGuid==UNASSIGNED_RAKNET_GUID ? GetGuidFromSystemAddress(target.systemAddress) : target.rakNetGuid;
1670 packet->systemAddress = target.systemAddress==UNASSIGNED_SYSTEM_ADDRESS ? GetSystemAddressFromGuid(target.rakNetGuid) : target.systemAddress;
1671 packet->systemAddress.systemIndex = (SystemIndex) GetIndexFromSystemAddress(packet->systemAddress);
1672 packet->guid.systemIndex=packet->systemAddress.systemIndex;
1673 packet->wasGeneratedLocally=true; // else processed twice
1674 AddPacketToProducer(packet);
1675 }
1676 }
1677
1678 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1679 // Cancel a pending connection attempt
1680 // If we are already connected, the connection stays open
1681 // \param[in] target Which system to cancel
1682 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1683 void RakPeer::CancelConnectionAttempt( const SystemAddress target )
1684 {
1685 unsigned int i;
1686
1687 // Cancel pending connection attempt, if there is one
1688 i=0;
1689 requestedConnectionQueueMutex.Lock();
1690 while (i < requestedConnectionQueue.Size())
1691 {
1692 if (requestedConnectionQueue[i]->systemAddress==target)
1693 {
1694 #if LIBCAT_SECURITY==1
1695 CAT_AUDIT_PRINTF("AUDIT: Deleting requestedConnectionQueue %i client_handshake %x\n", i, requestedConnectionQueue[ i ]->client_handshake);
1696 SLNet::OP_DELETE(requestedConnectionQueue[i]->client_handshake, _FILE_AND_LINE_ );
1697 #endif
1698 SLNet::OP_DELETE(requestedConnectionQueue[i], _FILE_AND_LINE_ );
1699 requestedConnectionQueue.RemoveAtIndex(i);
1700 break;
1701 }
1702 else
1703 i++;
1704 }
1705 requestedConnectionQueueMutex.Unlock();
1706
1707 }
1708
1709 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1710
1711 ConnectionState RakPeer::GetConnectionState(const AddressOrGUID systemIdentifier)
1712 {
1713 if (systemIdentifier.systemAddress!=UNASSIGNED_SYSTEM_ADDRESS)
1714 {
1715 unsigned int i=0;
1716 requestedConnectionQueueMutex.Lock();
1717 for (; i < requestedConnectionQueue.Size(); i++)
1718 {
1719 if (requestedConnectionQueue[i]->systemAddress==systemIdentifier.systemAddress)
1720 {
1721 requestedConnectionQueueMutex.Unlock();
1722 return IS_PENDING;
1723 }
1724 }
1725 requestedConnectionQueueMutex.Unlock();
1726 }
1727
1728 int index;
1729 if (systemIdentifier.systemAddress!=UNASSIGNED_SYSTEM_ADDRESS)
1730 {
1731 index = GetIndexFromSystemAddress(systemIdentifier.systemAddress, false);
1732 }
1733 else
1734 {
1735 index = GetIndexFromGuid(systemIdentifier.rakNetGuid);
1736 }
1737
1738 if (index==-1)
1739 return IS_NOT_CONNECTED;
1740
1741 if (remoteSystemList[index].isActive==false)
1742 return IS_DISCONNECTED;
1743
1744 switch (remoteSystemList[index].connectMode)
1745 {
1746 case RemoteSystemStruct::DISCONNECT_ASAP:
1747 return IS_DISCONNECTING;
1748 case RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY:
1749 return IS_SILENTLY_DISCONNECTING;
1750 case RemoteSystemStruct::DISCONNECT_ON_NO_ACK:
1751 return IS_DISCONNECTING;
1752 case RemoteSystemStruct::REQUESTED_CONNECTION:
1753 return IS_CONNECTING;
1754 case RemoteSystemStruct::HANDLING_CONNECTION_REQUEST:
1755 return IS_CONNECTING;
1756 case RemoteSystemStruct::UNVERIFIED_SENDER:
1757 return IS_CONNECTING;
1758 case RemoteSystemStruct::CONNECTED:
1759 return IS_CONNECTED;
1760 default:
1761 return IS_NOT_CONNECTED;
1762 }
1763 }
1764
1765
1766 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1767 // Description:
1768 // Given a systemAddress, returns an index from 0 to the maximum number of players allowed - 1.
1769 //
1770 // Parameters
1771 // systemAddress - The systemAddress to search for
1772 //
1773 // Returns
1774 // An integer from 0 to the maximum number of peers -1, or -1 if that player is not found
1775 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1776 int RakPeer::GetIndexFromSystemAddress( const SystemAddress systemAddress ) const
1777 {
1778 return GetIndexFromSystemAddress(systemAddress, false);
1779 }
1780
1781 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1782 // Description:
1783 // This function is only useful for looping through all players.
1784 //
1785 // Parameters
1786 // index - an integer between 0 and the maximum number of players allowed - 1.
1787 //
1788 // Returns
1789 // A valid systemAddress or UNASSIGNED_SYSTEM_ADDRESS if no such player at that index
1790 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1791 SystemAddress RakPeer::GetSystemAddressFromIndex( unsigned int index )
1792 {
1793 // remoteSystemList in user thread
1794 //if ( index >= 0 && index < remoteSystemListSize )
1795 if ( index < maximumNumberOfPeers )
1796 if (remoteSystemList[index].isActive && remoteSystemList[ index ].connectMode==RakPeer::RemoteSystemStruct::CONNECTED) // Don't give the user players that aren't fully connected, since sends will fail
1797 return remoteSystemList[ index ].systemAddress;
1798
1799 return UNASSIGNED_SYSTEM_ADDRESS;
1800 }
1801
1802 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1803 // Same as GetSystemAddressFromIndex but returns RakNetGUID
1804 // \param[in] index Index should range between 0 and the maximum number of players allowed - 1.
1805 // \return The RakNetGUID
1806 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1807 RakNetGUID RakPeer::GetGUIDFromIndex( unsigned int index )
1808 {
1809 // remoteSystemList in user thread
1810 //if ( index >= 0 && index < remoteSystemListSize )
1811 if ( index < maximumNumberOfPeers )
1812 if (remoteSystemList[index].isActive && remoteSystemList[ index ].connectMode==RakPeer::RemoteSystemStruct::CONNECTED) // Don't give the user players that aren't fully connected, since sends will fail
1813 return remoteSystemList[ index ].guid;
1814
1815 return UNASSIGNED_RAKNET_GUID;
1816 }
1817
1818 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1819 // Same as calling GetSystemAddressFromIndex and GetGUIDFromIndex for all systems, but more efficient
1820 // Indices match each other, so \a addresses[0] and \a guids[0] refer to the same system
1821 // \param[out] addresses All system addresses. Size of the list is the number of connections. Size of the list will match the size of the \a guids list.
1822 // \param[out] guids All guids. Size of the list is the number of connections. Size of the list will match the size of the \a addresses list.
1823 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1824 void RakPeer::GetSystemList(DataStructures::List<SystemAddress> &addresses, DataStructures::List<RakNetGUID> &guids) const
1825 {
1826 addresses.Clear(false, _FILE_AND_LINE_);
1827 guids.Clear(false, _FILE_AND_LINE_);
1828
1829 if ( remoteSystemList == 0 || endThreads == true )
1830 return;
1831
1832 unsigned int i;
1833 for (i=0; i < activeSystemListSize; i++)
1834 {
1835 if ((activeSystemList[i])->isActive &&
1836 (activeSystemList[i])->connectMode==RakPeer::RemoteSystemStruct::CONNECTED)
1837 {
1838 addresses.Push((activeSystemList[i])->systemAddress, _FILE_AND_LINE_ );
1839 guids.Push((activeSystemList[i])->guid, _FILE_AND_LINE_ );
1840 }
1841 }
1842 }
1843
1844 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1845 // Description:
1846 // Bans an IP from connecting. Banned IPs persist between connections.
1847 //
1848 // Parameters
1849 // IP - Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will ban
1850 // All IP addresses starting with 128.0.0
1851 // milliseconds - how many ms for a temporary ban. Use 0 for a permanent ban
1852 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1853 void RakPeer::AddToBanList( const char *IP, SLNet::TimeMS milliseconds )
1854 {
1855 unsigned index;
1856 SLNet::TimeMS time = SLNet::GetTimeMS();
1857
1858 if ( IP == 0 || IP[ 0 ] == 0 || strlen( IP ) > 15 )
1859 return ;
1860
1861 // If this guy is already in the ban list, do nothing
1862 index = 0;
1863
1864 banListMutex.Lock();
1865
1866 for ( ; index < banList.Size(); index++ )
1867 {
1868 if ( strcmp( IP, banList[ index ]->IP ) == 0 )
1869 {
1870 // Already in the ban list. Just update the time
1871 if (milliseconds==0)
1872 banList[ index ]->timeout=0; // Infinite
1873 else
1874 banList[ index ]->timeout=time+milliseconds;
1875 banListMutex.Unlock();
1876 return;
1877 }
1878 }
1879
1880 banListMutex.Unlock();
1881
1882 BanStruct *banStruct = SLNet::OP_NEW<BanStruct>( _FILE_AND_LINE_ );
1883 banStruct->IP = (char*) rakMalloc_Ex( 16, _FILE_AND_LINE_ );
1884 if (milliseconds==0)
1885 banStruct->timeout=0; // Infinite
1886 else
1887 banStruct->timeout=time+milliseconds;
1888 strcpy_s( banStruct->IP, 16, IP );
1889 banListMutex.Lock();
1890 banList.Insert( banStruct, _FILE_AND_LINE_ );
1891 banListMutex.Unlock();
1892 }
1893
1894 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1895 // Description:
1896 // Allows a previously banned IP to connect.
1897 //
1898 // Parameters
1899 // IP - Dotted IP address. Can use * as a wildcard, such as 128.0.0.* will ban
1900 // All IP addresses starting with 128.0.0
1901 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1902 void RakPeer::RemoveFromBanList( const char *IP )
1903 {
1904 unsigned index;
1905 BanStruct *temp;
1906
1907 if ( IP == 0 || IP[ 0 ] == 0 || strlen( IP ) > 15 )
1908 return ;
1909
1910 index = 0;
1911 temp=0;
1912
1913 banListMutex.Lock();
1914
1915 for ( ; index < banList.Size(); index++ )
1916 {
1917 if ( strcmp( IP, banList[ index ]->IP ) == 0 )
1918 {
1919 temp = banList[ index ];
1920 banList[ index ] = banList[ banList.Size() - 1 ];
1921 banList.RemoveAtIndex( banList.Size() - 1 );
1922 break;
1923 }
1924 }
1925
1926 banListMutex.Unlock();
1927
1928 if (temp)
1929 {
1930 rakFree_Ex(temp->IP, _FILE_AND_LINE_ );
1931 SLNet::OP_DELETE(temp, _FILE_AND_LINE_);
1932 }
1933
1934 }
1935
1936 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1937 // Description:
1938 // Allows all previously banned IPs to connect.
1939 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1940 void RakPeer::ClearBanList( void )
1941 {
1942 unsigned index;
1943 index = 0;
1944 banListMutex.Lock();
1945
1946 for ( ; index < banList.Size(); index++ )
1947 {
1948 rakFree_Ex(banList[ index ]->IP, _FILE_AND_LINE_ );
1949 SLNet::OP_DELETE(banList[ index ], _FILE_AND_LINE_);
1950 }
1951
1952 banList.Clear(false, _FILE_AND_LINE_);
1953
1954 banListMutex.Unlock();
1955 }
1956 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1957 void RakPeer::SetLimitIPConnectionFrequency(bool b)
1958 {
1959 limitConnectionFrequencyFromTheSameIP=b;
1960 }
1961
1962 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1963 // Description:
1964 // Determines if a particular IP is banned.
1965 //
1966 // Parameters
1967 // IP - Complete dotted IP address
1968 //
1969 // Returns
1970 // True if IP matches any IPs in the ban list, accounting for any wildcards.
1971 // False otherwise.
1972 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1973 bool RakPeer::IsBanned( const char *IP )
1974 {
1975 unsigned banListIndex, characterIndex;
1976 SLNet::TimeMS time;
1977 BanStruct *temp;
1978
1979 if ( IP == 0 || IP[ 0 ] == 0 || strlen( IP ) > 15 )
1980 return false;
1981
1982 banListIndex = 0;
1983
1984 if ( banList.Size() == 0 )
1985 return false; // Skip the mutex if possible
1986
1987 time = SLNet::GetTimeMS();
1988
1989 banListMutex.Lock();
1990
1991 while ( banListIndex < banList.Size() )
1992 {
1993 if (banList[ banListIndex ]->timeout>0 && banList[ banListIndex ]->timeout<time)
1994 {
1995 // Delete expired ban
1996 temp = banList[ banListIndex ];
1997 banList[ banListIndex ] = banList[ banList.Size() - 1 ];
1998 banList.RemoveAtIndex( banList.Size() - 1 );
1999 rakFree_Ex(temp->IP, _FILE_AND_LINE_ );
2000 SLNet::OP_DELETE(temp, _FILE_AND_LINE_);
2001 }
2002 else
2003 {
2004 characterIndex = 0;
2005
2006 for(;;)
2007 {
2008 if ( banList[ banListIndex ]->IP[ characterIndex ] == IP[ characterIndex ] )
2009 {
2010 // Equal characters
2011
2012 if ( IP[ characterIndex ] == 0 )
2013 {
2014 banListMutex.Unlock();
2015 // End of the string and the strings match
2016
2017 return true;
2018 }
2019
2020 characterIndex++;
2021 }
2022
2023 else
2024 {
2025 if ( banList[ banListIndex ]->IP[ characterIndex ] == 0 || IP[ characterIndex ] == 0 )
2026 {
2027 // End of one of the strings
2028 break;
2029 }
2030
2031 // Characters do not match
2032 if ( banList[ banListIndex ]->IP[ characterIndex ] == '*' )
2033 {
2034 banListMutex.Unlock();
2035
2036 // Domain is banned.
2037 return true;
2038 }
2039
2040 // Characters do not match and it is not a *
2041 break;
2042 }
2043 }
2044
2045 banListIndex++;
2046 }
2047 }
2048
2049 banListMutex.Unlock();
2050
2051 // No match found.
2052 return false;
2053 }
2054
2055 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2056 // Description:
2057 // Send a ping to the specified connected system.
2058 //
2059 // Parameters:
2060 // target - who to ping
2061 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2062 void RakPeer::Ping( const SystemAddress target )
2063 {
2064 PingInternal(target, false, UNRELIABLE);
2065 }
2066
2067 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2068 // Description:
2069 // Send a ping to the specified unconnected system.
2070 // The remote system, if it is Initialized, will respond with ID_UNCONNECTED_PONG.
2071 // The final ping time will be encoded in the following sizeof(SLNet::TimeMS) bytes. (Default is 4 bytes - See __GET_TIME_64BIT in types.h
2072 //
2073 // Parameters:
2074 // host: Either a dotted IP address or a domain name. Can be 255.255.255.255 for LAN broadcast.
2075 // remotePort: Which port to connect to on the remote machine.
2076 // onlyReplyOnAcceptingConnections: Only request a reply if the remote system has open connections
2077 // connectionSocketIndex Index into the array of socket descriptors passed to socketDescriptors in RakPeer::Startup() to send on.
2078 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2079 bool RakPeer::Ping( const char* host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections, unsigned connectionSocketIndex )
2080 {
2081 if ( host == 0 )
2082 return false;
2083
2084 // If this assert hits then Startup wasn't called or the call failed.
2085 RakAssert(connectionSocketIndex < socketList.Size());
2086
2087 // if ( IsActive() == false )
2088 // return;
2089
2090 SLNet::BitStream bitStream( sizeof(unsigned char) + sizeof(SLNet::Time) );
2091 if ( onlyReplyOnAcceptingConnections )
2092 bitStream.Write((MessageID)ID_UNCONNECTED_PING_OPEN_CONNECTIONS);
2093 else
2094 bitStream.Write((MessageID)ID_UNCONNECTED_PING);
2095
2096 bitStream.Write(SLNet::GetTime());
2097
2098 bitStream.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
2099
2100 bitStream.Write(GetMyGUID());
2101
2102 // No timestamp for 255.255.255.255
2103 unsigned int realIndex = GetRakNetSocketFromUserConnectionSocketIndex(connectionSocketIndex);
2104 /*
2105
2106 SystemAddress systemAddress;
2107 systemAddress.FromStringExplicitPort(host,remotePort, socketList[realIndex]->GetBoundAddress().GetIPVersion());
2108 systemAddress.FixForIPVersion(socketList[realIndex]->GetBoundAddress());
2109
2110 unsigned i;
2111 for (i=0; i < pluginListNTS.Size(); i++)
2112 pluginListNTS[i]->OnDirectSocketSend((const char*)bitStream.GetData(), bitStream.GetNumberOfBitsUsed(), systemAddress);
2113 SocketLayer::SendTo( socketList[realIndex], (const char*)bitStream.GetData(), (int) bitStream.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
2114 */
2115
2116 RNS2_SendParameters bsp;
2117 bsp.data = (char*) bitStream.GetData() ;
2118 bsp.length = bitStream.GetNumberOfBytesUsed();
2119 bsp.systemAddress.FromStringExplicitPort(host,remotePort, socketList[realIndex]->GetBoundAddress().GetIPVersion());
2120 if (bsp.systemAddress==UNASSIGNED_SYSTEM_ADDRESS)
2121 return false;
2122 bsp.systemAddress.FixForIPVersion(socketList[realIndex]->GetBoundAddress());
2123 unsigned i;
2124 for (i=0; i < pluginListNTS.Size(); i++)
2125 pluginListNTS[i]->OnDirectSocketSend((const char*)bitStream.GetData(), bitStream.GetNumberOfBitsUsed(), bsp.systemAddress);
2126 socketList[realIndex]->Send(&bsp, _FILE_AND_LINE_);
2127
2128 return true;
2129 }
2130
2131 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2132 // Description:
2133 // Returns the average of all ping times read for a specified target
2134 //
2135 // Parameters:
2136 // target - whose time to read
2137 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2138 int RakPeer::GetAveragePing( const AddressOrGUID systemIdentifier )
2139 {
2140 int sum, quantity;
2141 RemoteSystemStruct *remoteSystem = GetRemoteSystem( systemIdentifier, false, false );
2142
2143 if ( remoteSystem == 0 )
2144 return -1;
2145
2146 for ( sum = 0, quantity = 0; quantity < PING_TIMES_ARRAY_SIZE; quantity++ )
2147 {
2148 if ( remoteSystem->pingAndClockDifferential[ quantity ].pingTime == 65535 )
2149 break;
2150 else
2151 sum += remoteSystem->pingAndClockDifferential[ quantity ].pingTime;
2152 }
2153
2154 if ( quantity > 0 )
2155 return sum / quantity;
2156 else
2157 return -1;
2158 }
2159
2160 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2161 // Description:
2162 // Returns the last ping time read for the specific player or -1 if none read yet
2163 //
2164 // Parameters:
2165 // target - whose time to read
2166 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2167 int RakPeer::GetLastPing( const AddressOrGUID systemIdentifier ) const
2168 {
2169 RemoteSystemStruct * remoteSystem = GetRemoteSystem( systemIdentifier, false, false );
2170
2171 if ( remoteSystem == 0 )
2172 return -1;
2173
2174 // return (int)(remoteSystem->reliabilityLayer.GetAckPing()/(SLNet::TimeUS)1000);
2175
2176 if ( remoteSystem->pingAndClockDifferentialWriteIndex == 0 )
2177 return remoteSystem->pingAndClockDifferential[ PING_TIMES_ARRAY_SIZE - 1 ].pingTime;
2178 else
2179 return remoteSystem->pingAndClockDifferential[ remoteSystem->pingAndClockDifferentialWriteIndex - 1 ].pingTime;
2180 }
2181
2182 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2183 // Description:
2184 // Returns the lowest ping time read or -1 if none read yet
2185 //
2186 // Parameters:
2187 // target - whose time to read
2188 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2189 int RakPeer::GetLowestPing( const AddressOrGUID systemIdentifier ) const
2190 {
2191 RemoteSystemStruct * remoteSystem = GetRemoteSystem( systemIdentifier, false, false );
2192
2193 if ( remoteSystem == 0 )
2194 return -1;
2195
2196 return remoteSystem->lowestPing;
2197 }
2198
2199 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2200 // Description:
2201 // Ping the remote systems every so often. This is off by default
2202 // This will work anytime
2203 //
2204 // Parameters:
2205 // doPing - True to start occasional pings. False to stop them.
2206 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2207 void RakPeer::SetOccasionalPing( bool doPing )
2208 {
2209 occasionalPing = doPing;
2210 }
2211
2212 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2216 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2217 SLNet::Time RakPeer::GetClockDifferential( const AddressOrGUID systemIdentifier )
2218 {
2219 RemoteSystemStruct *remoteSystem = GetRemoteSystem(systemIdentifier, false, false);
2220 if (remoteSystem == 0)
2221 return 0;
2222 return GetClockDifferentialInt(remoteSystem);
2223 }
2224
2225 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2226
2227 SLNet::Time RakPeer::GetClockDifferentialInt(RemoteSystemStruct *remoteSystem) const
2228 {
2229 int counter, lowestPingSoFar;
2230 SLNet::Time clockDifferential;
2231
2232 lowestPingSoFar = 65535;
2233
2234 clockDifferential = 0;
2235
2236 for ( counter = 0; counter < PING_TIMES_ARRAY_SIZE; counter++ )
2237 {
2238 if ( remoteSystem->pingAndClockDifferential[ counter ].pingTime == 65535 )
2239 break;
2240
2241 if ( remoteSystem->pingAndClockDifferential[ counter ].pingTime < lowestPingSoFar )
2242 {
2243 clockDifferential = remoteSystem->pingAndClockDifferential[ counter ].clockDifferential;
2244 lowestPingSoFar = remoteSystem->pingAndClockDifferential[ counter ].pingTime;
2245 }
2246 }
2247
2248 return clockDifferential;
2249 }
2250 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2251 // Description:
2252 // Length should be under 400 bytes, as a security measure against flood attacks
2253 // Sets the data to send with an (LAN server discovery) /(offline ping) response
2254 // See the Ping sample project for how this is used.
2255 // data: a block of data to store, or 0 for none
2256 // length: The length of data in bytes, or 0 for none
2257 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2258 void RakPeer::SetOfflinePingResponse( const char *data, const unsigned int length )
2259 {
2260 RakAssert(length < 400);
2261
2262 rakPeerMutexes[ offlinePingResponse_Mutex ].Lock();
2263 offlinePingResponse.Reset();
2264
2265 if ( data && length > 0 )
2266 offlinePingResponse.Write( data, length );
2267
2268 rakPeerMutexes[ offlinePingResponse_Mutex ].Unlock();
2269 }
2270
2271 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2272 // Returns pointers to a copy of the data passed to SetOfflinePingResponse
2273 // \param[out] data A pointer to a copy of the data passed to \a SetOfflinePingResponse()
2274 // \param[out] length A pointer filled in with the length parameter passed to SetOfflinePingResponse()
2275 // \sa SetOfflinePingResponse
2276 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2277 void RakPeer::GetOfflinePingResponse( char **data, unsigned int *length )
2278 {
2279 rakPeerMutexes[ offlinePingResponse_Mutex ].Lock();
2280 *data = (char*) offlinePingResponse.GetData();
2281 *length = (int) offlinePingResponse.GetNumberOfBytesUsed();
2282 rakPeerMutexes[ offlinePingResponse_Mutex ].Unlock();
2283 }
2284
2285 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2286 // Description:
2287 // Return the unique SystemAddress that represents you on the the network
2288 // Note that unlike in previous versions, this is a struct and is not sequential
2289 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2290 SystemAddress RakPeer::GetInternalID( const SystemAddress systemAddress, const int index ) const
2291 {
2292 if (systemAddress==UNASSIGNED_SYSTEM_ADDRESS)
2293 {
2294 return ipList[index];
2295 }
2296 else
2297 {
2298
2299 // SystemAddress returnValue;
2300 RemoteSystemStruct * remoteSystem = GetRemoteSystemFromSystemAddress( systemAddress, false, true );
2301 if (remoteSystem==0)
2302 return UNASSIGNED_SYSTEM_ADDRESS;
2303
2304 return remoteSystem->theirInternalSystemAddress[index];
2305 /*
2306 sockaddr_in sa;
2307 socklen_t len = sizeof(sa);
2308 if (getsockname__(connectionSockets[remoteSystem->connectionSocketIndex], (sockaddr*)&sa, &len)!=0)
2309 return UNASSIGNED_SYSTEM_ADDRESS;
2310 returnValue.port=ntohs(sa.sin_port);
2311 returnValue.binaryAddress=sa.sin_addr.s_addr;
2312 return returnValue;
2313 */
2314
2315
2316
2317 }
2318 }
2319
2320 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2324 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2325 void RakPeer::SetInternalID(SystemAddress systemAddress, int index)
2326 {
2327 RakAssert(index >=0 && index < MAXIMUM_NUMBER_OF_INTERNAL_IDS);
2328 ipList[index]=systemAddress;
2329 }
2330
2331 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2332 // Description:
2333 // Return the unique address identifier that represents you on the the network and is based on your external
2334 // IP / port (the IP / port the specified player uses to communicate with you)
2335 // Note that unlike in previous versions, this is a struct and is not sequential
2336 //
2337 // Parameters:
2338 // target: Which remote system you are referring to for your external ID
2339 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2340 SystemAddress RakPeer::GetExternalID( const SystemAddress target ) const
2341 {
2342 unsigned i;
2343 SystemAddress inactiveExternalId;
2344
2345 inactiveExternalId=UNASSIGNED_SYSTEM_ADDRESS;
2346
2347 if (target==UNASSIGNED_SYSTEM_ADDRESS)
2348 return firstExternalID;
2349
2350 // First check for active connection with this systemAddress
2351 for ( i = 0; i < maximumNumberOfPeers; i++ )
2352 {
2353 if (remoteSystemList[ i ].systemAddress == target )
2354 {
2355 if ( remoteSystemList[ i ].isActive )
2356 return remoteSystemList[ i ].myExternalSystemAddress;
2357 else if (remoteSystemList[ i ].myExternalSystemAddress!=UNASSIGNED_SYSTEM_ADDRESS)
2358 inactiveExternalId=remoteSystemList[ i ].myExternalSystemAddress;
2359 }
2360 }
2361
2362 return inactiveExternalId;
2363 }
2364
2365 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2366
2367 const RakNetGUID RakPeer::GetMyGUID(void) const
2368 {
2369 return myGuid;
2370 }
2371 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2372 SystemAddress RakPeer::GetMyBoundAddress(const int socketIndex)
2373 {
2374 DataStructures::List<RakNetSocket2* > sockets;
2375 GetSockets( sockets );
2376 if (sockets.Size()>0)
2377 return sockets[socketIndex]->GetBoundAddress();
2378 else
2379 return UNASSIGNED_SYSTEM_ADDRESS;
2380 }
2381 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2382
2383 const RakNetGUID& RakPeer::GetGuidFromSystemAddress( const SystemAddress input ) const
2384 {
2385 if (input==UNASSIGNED_SYSTEM_ADDRESS)
2386 return myGuid;
2387
2388 if (input.systemIndex!=(SystemIndex)-1 && input.systemIndex<maximumNumberOfPeers && remoteSystemList[ input.systemIndex ].systemAddress == input)
2389 return remoteSystemList[ input.systemIndex ].guid;
2390
2391 unsigned int i;
2392 for ( i = 0; i < maximumNumberOfPeers; i++ )
2393 {
2394 if (remoteSystemList[ i ].systemAddress == input )
2395 {
2396 // Set the systemIndex so future lookups will be fast
2397 remoteSystemList[i].guid.systemIndex = (SystemIndex) i;
2398
2399 return remoteSystemList[ i ].guid;
2400 }
2401 }
2402
2403 return UNASSIGNED_RAKNET_GUID;
2404 }
2405
2406 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2407
2408 unsigned int RakPeer::GetSystemIndexFromGuid( const RakNetGUID input ) const
2409 {
2410 if (input==UNASSIGNED_RAKNET_GUID)
2411 return (unsigned int) -1;
2412
2413 if (input==myGuid)
2414 return (unsigned int) -1;
2415
2416 if (input.systemIndex!=(SystemIndex)-1 && input.systemIndex<maximumNumberOfPeers && remoteSystemList[ input.systemIndex ].guid == input)
2417 return input.systemIndex;
2418
2419 unsigned int i;
2420 for ( i = 0; i < maximumNumberOfPeers; i++ )
2421 {
2422 if (remoteSystemList[ i ].guid == input )
2423 {
2424 // Set the systemIndex so future lookups will be fast
2425 remoteSystemList[i].guid.systemIndex = (SystemIndex) i;
2426
2427 return i;
2428 }
2429 }
2430
2431 return (unsigned int) -1;
2432 }
2433
2434 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2435
2436 SystemAddress RakPeer::GetSystemAddressFromGuid( const RakNetGUID input ) const
2437 {
2438 if (input==UNASSIGNED_RAKNET_GUID)
2439 return UNASSIGNED_SYSTEM_ADDRESS;
2440
2441 if (input==myGuid)
2442 return GetInternalID(UNASSIGNED_SYSTEM_ADDRESS);
2443
2444 if (input.systemIndex!=(SystemIndex)-1 && input.systemIndex<maximumNumberOfPeers && remoteSystemList[ input.systemIndex ].guid == input)
2445 return remoteSystemList[ input.systemIndex ].systemAddress;
2446
2447 unsigned int i;
2448 for ( i = 0; i < maximumNumberOfPeers; i++ )
2449 {
2450 if (remoteSystemList[ i ].guid == input )
2451 {
2452 // Set the systemIndex so future lookups will be fast
2453 remoteSystemList[i].guid.systemIndex = (SystemIndex) i;
2454
2455 return remoteSystemList[ i ].systemAddress;
2456 }
2457 }
2458
2459 return UNASSIGNED_SYSTEM_ADDRESS;
2460 }
2461
2462 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2463
2464 bool RakPeer::GetClientPublicKeyFromSystemAddress( const SystemAddress input, char *client_public_key ) const
2465 {
2466 #if LIBCAT_SECURITY == 1
2467 if (input == UNASSIGNED_SYSTEM_ADDRESS)
2468 return false;
2469
2470 char *copy_source = 0;
2471
2472 if (input.systemIndex!=(SystemIndex)-1 && input.systemIndex<maximumNumberOfPeers && remoteSystemList[ input.systemIndex ].systemAddress == input)
2473 {
2474 copy_source = remoteSystemList[ input.systemIndex ].client_public_key;
2475 }
2476 else
2477 {
2478 for ( unsigned int i = 0; i < maximumNumberOfPeers; i++ )
2479 {
2480 if (remoteSystemList[ i ].systemAddress == input )
2481 {
2482 copy_source = remoteSystemList[ i ].client_public_key;
2483 break;
2484 }
2485 }
2486 }
2487
2488 if (copy_source)
2489 {
2490 // Verify that at least one byte in the public key is non-zero to indicate that the key was received
2491 for (int ii = 0; ii < cat::EasyHandshake::PUBLIC_KEY_BYTES; ++ii)
2492 {
2493 if (copy_source[ii] != 0)
2494 {
2495 memcpy(client_public_key, copy_source, cat::EasyHandshake::PUBLIC_KEY_BYTES);
2496 return true;
2497 }
2498 }
2499 }
2500
2501 #else
2502 (void) input;
2503 (void) client_public_key;
2504 #endif
2505
2506 return false;
2507 }
2508
2509 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2510 // Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable packet
2511 // \param[in] time Time, in MS
2512 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2513 void RakPeer::SetTimeoutTime(SLNet::TimeMS timeMS, const SystemAddress target )
2514 {
2515 if (target==UNASSIGNED_SYSTEM_ADDRESS)
2516 {
2517 defaultTimeoutTime=timeMS;
2518
2519 unsigned i;
2520 for ( i = 0; i < maximumNumberOfPeers; i++ )
2521 {
2522 if (remoteSystemList[ i ].isActive)
2523 {
2524 if ( remoteSystemList[ i ].isActive )
2525 remoteSystemList[ i ].reliabilityLayer.SetTimeoutTime(timeMS);
2526 }
2527 }
2528 }
2529 else
2530 {
2531 RemoteSystemStruct * remoteSystem = GetRemoteSystemFromSystemAddress( target, false, true );
2532
2533 if ( remoteSystem != 0 )
2534 remoteSystem->reliabilityLayer.SetTimeoutTime(timeMS);
2535 }
2536 }
2537
2538 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2539
2540 SLNet::TimeMS RakPeer::GetTimeoutTime( const SystemAddress target )
2541 {
2542 if (target==UNASSIGNED_SYSTEM_ADDRESS)
2543 {
2544 return defaultTimeoutTime;
2545 }
2546 else
2547 {
2548 RemoteSystemStruct * remoteSystem = GetRemoteSystemFromSystemAddress( target, false, true );
2549
2550 if ( remoteSystem != 0 )
2551 return remoteSystem->reliabilityLayer.GetTimeoutTime();
2552 }
2553 return defaultTimeoutTime;
2554 }
2555
2556
2557 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2558 // Description:
2559 // Returns the current MTU size
2560 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2561 int RakPeer::GetMTUSize( const SystemAddress target ) const
2562 {
2563 if (target!=UNASSIGNED_SYSTEM_ADDRESS)
2564 {
2565 RemoteSystemStruct *rss=GetRemoteSystemFromSystemAddress(target, false, true);
2566 if (rss)
2567 return rss->MTUSize;
2568 }
2569 return defaultMTUSize;
2570 }
2571 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2572 // Description:
2573 // Returns the number of IP addresses we have
2574 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2575 unsigned int RakPeer::GetNumberOfAddresses( void )
2576 {
2577 if (IsActive() == false) {
2578 FillIPList();
2579 }
2580
2581 for (int i = 0; i < MAXIMUM_NUMBER_OF_INTERNAL_IDS && ipList[i] != UNASSIGNED_SYSTEM_ADDRESS; i++) {
2582 if (ipList[i] == UNASSIGNED_SYSTEM_ADDRESS) {
2583 return i; // first unassigned address entry found -> end of address list reached
2584 }
2585 }
2586
2587 return MAXIMUM_NUMBER_OF_INTERNAL_IDS;
2588 }
2589
2590 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2591 // Returns an IP address at index 0 to GetNumberOfAddresses-1
2592 // \param[in] index index into the list of IP addresses
2593 // \return The local IP address at this index
2594 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2595 const char* RakPeer::GetLocalIP( unsigned int index )
2596 {
2597 if (IsActive()==false)
2598 {
2599 // Fill out ipList structure
2600
2601 FillIPList();
2602
2603 }
2604
2605
2606 static char str[128];
2607 ipList[index].ToString(false,str,static_cast<size_t>(128));
2608 return str;
2609
2610
2611
2612
2613 }
2614
2615 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2616 // Is this a local IP?
2617 // \param[in] An IP address to check
2618 // \return True if this is one of the IP addresses returned by GetLocalIP
2619 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2620 bool RakPeer::IsLocalIP( const char *ip )
2621 {
2622 if (ip==0 || ip[0]==0)
2623 return false;
2624
2625
2626 if (strcmp(ip, "127.0.0.1")==0 || strcmp(ip, "localhost")==0)
2627 return true;
2628
2629 int num = GetNumberOfAddresses();
2630 int i;
2631 for (i=0; i < num; i++)
2632 {
2633 if (strcmp(ip, GetLocalIP(i))==0)
2634 return true;
2635 }
2636
2637
2638
2639
2640 return false;
2641 }
2642
2643 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2644 // Description:
2645 // Allow or disallow connection responses from any IP. Normally this should be false, but may be necessary
2646 // when connection to servers with multiple IP addresses
2647 //
2648 // Parameters:
2649 // allow - True to allow this behavior, false to not allow. Defaults to false. Value persists between connections
2650 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2651 void RakPeer::AllowConnectionResponseIPMigration( bool allow )
2652 {
2653 allowConnectionResponseIPMigration = allow;
2654 }
2655
2656 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2657 // Description:
2658 // Sends a message ID_ADVERTISE_SYSTEM to the remote unconnected system.
2659 // This will tell the remote system our external IP outside the LAN, and can be used for NAT punch through
2660 //
2661 // Requires:
2662 // The sender and recipient must already be started via a successful call to Initialize
2663 //
2664 // host: Either a dotted IP address or a domain name
2665 // remotePort: Which port to connect to on the remote machine.
2666 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2667 bool RakPeer::AdvertiseSystem( const char *host, unsigned short remotePort, const char *data, int dataLength, unsigned connectionSocketIndex )
2668 {
2669 SLNet::BitStream bs;
2670 bs.Write((MessageID)ID_ADVERTISE_SYSTEM);
2671 bs.WriteAlignedBytes((const unsigned char*) data,dataLength);
2672 return SendOutOfBand(host, remotePort, (const char*) bs.GetData(), bs.GetNumberOfBytesUsed(), connectionSocketIndex );
2673 }
2674
2675 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2676 // Controls how often to return ID_DOWNLOAD_PROGRESS for large message downloads.
2677 // ID_DOWNLOAD_PROGRESS is returned to indicate a new partial message chunk, roughly the MTU size, has arrived
2678 // As it can be slow or cumbersome to get this notification for every chunk, you can set the interval at which it is returned.
2679 // Defaults to 0 (never return this notification)
2680 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2681 void RakPeer::SetSplitMessageProgressInterval(int interval)
2682 {
2683 RakAssert(interval>=0);
2684 splitMessageProgressInterval=interval;
2685 for ( unsigned short i = 0; i < maximumNumberOfPeers; i++ )
2686 remoteSystemList[ i ].reliabilityLayer.SetSplitMessageProgressInterval(splitMessageProgressInterval);
2687 }
2688
2689 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2690 // Returns what was passed to SetSplitMessageProgressInterval()
2691 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2692 int RakPeer::GetSplitMessageProgressInterval(void) const
2693 {
2694 return splitMessageProgressInterval;
2695 }
2696
2697 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2698 // Set how long to wait before giving up on sending an unreliable message
2699 // Useful if the network is clogged up.
2700 // Set to 0 or less to never timeout. Defaults to 0.
2701 // timeoutMS How many ms to wait before simply not sending an unreliable message.
2702 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2703 void RakPeer::SetUnreliableTimeout(SLNet::TimeMS timeoutMS)
2704 {
2705 unreliableTimeout=timeoutMS;
2706 for ( unsigned short i = 0; i < maximumNumberOfPeers; i++ )
2707 remoteSystemList[ i ].reliabilityLayer.SetUnreliableTimeout(unreliableTimeout);
2708 }
2709
2710 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2711 // Send a message to host, with the IP socket option TTL set to 3
2712 // This message will not reach the host, but will open the router.
2713 // Used for NAT-Punchthrough
2714 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2715 void RakPeer::SendTTL( const char* host, unsigned short remotePort, int ttl, unsigned connectionSocketIndex )
2716 {
2717 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
2718 char fakeData[2];
2719 fakeData[0]=0;
2720 fakeData[1]=1;
2721 unsigned int realIndex = GetRakNetSocketFromUserConnectionSocketIndex(connectionSocketIndex);
2722 if (socketList[realIndex]->IsBerkleySocket())
2723 {
2724 RNS2_SendParameters bsp;
2725 bsp.data = (char*) fakeData;
2726 bsp.length = 2;
2727 bsp.systemAddress.FromStringExplicitPort(host,remotePort, socketList[realIndex]->GetBoundAddress().GetIPVersion());
2728 bsp.systemAddress.FixForIPVersion(socketList[realIndex]->GetBoundAddress());
2729 bsp.ttl=ttl;
2730 unsigned i;
2731 for (i=0; i < pluginListNTS.Size(); i++)
2732 pluginListNTS[i]->OnDirectSocketSend((const char*)bsp.data, BYTES_TO_BITS(bsp.length), bsp.systemAddress);
2733 socketList[realIndex]->Send(&bsp, _FILE_AND_LINE_);
2734 }
2735 #endif
2736 }
2737
2738
2739 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2740 // Attatches a Plugin interface to run code automatically on message receipt in the Receive call
2741 //
2742 // \param messageHandler Pointer to a plugin to attach
2743 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2744 void RakPeer::AttachPlugin( PluginInterface2 *plugin )
2745 {
2746 bool isNotThreadsafe = plugin->UsesReliabilityLayer();
2747 if (isNotThreadsafe)
2748 {
2749 if (pluginListNTS.GetIndexOf(plugin)==MAX_UNSIGNED_LONG)
2750 {
2751 plugin->SetRakPeerInterface(this);
2752 plugin->OnAttach();
2753 pluginListNTS.Insert(plugin, _FILE_AND_LINE_);
2754 }
2755 }
2756 else
2757 {
2758 if (pluginListTS.GetIndexOf(plugin)==MAX_UNSIGNED_LONG)
2759 {
2760 plugin->SetRakPeerInterface(this);
2761 plugin->OnAttach();
2762 pluginListTS.Insert(plugin, _FILE_AND_LINE_);
2763 }
2764 }
2765 }
2766
2767 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2768 // Detaches a Plugin interface to run code automatically on message receipt
2769 //
2770 // \param messageHandler Pointer to a plugin to detach
2771 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2772 void RakPeer::DetachPlugin( PluginInterface2 *plugin )
2773 {
2774 if (plugin==0)
2775 return;
2776
2777 unsigned int index;
2778
2779 bool isNotThreadsafe = plugin->UsesReliabilityLayer();
2780 if (isNotThreadsafe)
2781 {
2782 index = pluginListNTS.GetIndexOf(plugin);
2783 if (index!=MAX_UNSIGNED_LONG)
2784 {
2785 // Unordered list so delete from end for speed
2786 pluginListNTS[index]=pluginListNTS[pluginListNTS.Size()-1];
2787 pluginListNTS.RemoveFromEnd();
2788 }
2789 }
2790 else
2791 {
2792 index = pluginListTS.GetIndexOf(plugin);
2793 if (index!=MAX_UNSIGNED_LONG)
2794 {
2795 // Unordered list so delete from end for speed
2796 pluginListTS[index]=pluginListTS[pluginListTS.Size()-1];
2797 pluginListTS.RemoveFromEnd();
2798 }
2799 }
2800 plugin->OnDetach();
2801 plugin->SetRakPeerInterface(0);
2802 }
2803
2804 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2805 // Put a packet back at the end of the receive queue in case you don't want to deal with it immediately
2806 //
2807 // packet The packet you want to push back.
2808 // pushAtHead True to push the packet so that the next receive call returns it. False to push it at the end of the queue (obviously pushing it at the end makes the packets out of order)
2809 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2810 void RakPeer::PushBackPacket( Packet *packet, bool pushAtHead)
2811 {
2812 if (packet==0)
2813 return;
2814
2815 unsigned i;
2816 for (i=0; i < pluginListTS.Size(); i++)
2817 pluginListTS[i]->OnPushBackPacket((const char*) packet->data, packet->bitSize, packet->systemAddress);
2818 for (i=0; i < pluginListNTS.Size(); i++)
2819 pluginListNTS[i]->OnPushBackPacket((const char*) packet->data, packet->bitSize, packet->systemAddress);
2820
2821 packetReturnMutex.Lock();
2822 if (pushAtHead)
2823 packetReturnQueue.PushAtHead(packet,0,_FILE_AND_LINE_);
2824 else
2825 packetReturnQueue.Push(packet,_FILE_AND_LINE_);
2826 packetReturnMutex.Unlock();
2827 }
2828
2829 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2830 void RakPeer::ChangeSystemAddress(RakNetGUID guid, const SystemAddress &systemAddress)
2831 {
2832 BufferedCommandStruct *bcs;
2833
2834 bcs=bufferedCommands.Allocate( _FILE_AND_LINE_ );
2835 bcs->data = 0;
2836 bcs->systemIdentifier.systemAddress=systemAddress;
2837 bcs->systemIdentifier.rakNetGuid=guid;
2838 bcs->command=BufferedCommandStruct::BCS_CHANGE_SYSTEM_ADDRESS;
2839 bufferedCommands.Push(bcs);
2840 }
2841 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2842 Packet* RakPeer::AllocatePacket(unsigned dataSize)
2843 {
2844 return AllocPacket(dataSize, _FILE_AND_LINE_);
2845 }
2846 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2847 RakNetSocket2* RakPeer::GetSocket( const SystemAddress target )
2848 {
2849 // Send a query to the thread to get the socket, and return when we got it
2850 BufferedCommandStruct *bcs;
2851 bcs=bufferedCommands.Allocate( _FILE_AND_LINE_ );
2852 bcs->command=BufferedCommandStruct::BCS_GET_SOCKET;
2853 bcs->systemIdentifier=target;
2854 bcs->data=0;
2855 bufferedCommands.Push(bcs);
2856
2857 // Block up to one second to get the socket, although it should actually take virtually no time
2858 SocketQueryOutput *sqo;
2859 SLNet::TimeMS stopWaiting = SLNet::GetTimeMS()+1000;
2860 DataStructures::List<RakNetSocket2* > output;
2861 while (SLNet::GetTimeMS() < stopWaiting)
2862 {
2863 if (isMainLoopThreadActive==false)
2864 return 0;
2865
2866 RakSleep(0);
2867
2868 sqo = socketQueryOutput.Pop();
2869 if (sqo)
2870 {
2871 output=sqo->sockets;
2872 sqo->sockets.Clear(false, _FILE_AND_LINE_);
2873 socketQueryOutput.Deallocate(sqo, _FILE_AND_LINE_);
2874 if (output.Size())
2875 return output[0];
2876 break;
2877 }
2878 }
2879 return 0;
2880 }
2881 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2882 void RakPeer::GetSockets( DataStructures::List<RakNetSocket2* > &sockets )
2883 {
2884 sockets.Clear(false, _FILE_AND_LINE_);
2885
2886 // Send a query to the thread to get the socket, and return when we got it
2887 BufferedCommandStruct *bcs;
2888
2889 bcs=bufferedCommands.Allocate( _FILE_AND_LINE_ );
2890 bcs->command=BufferedCommandStruct::BCS_GET_SOCKET;
2891 bcs->systemIdentifier=UNASSIGNED_SYSTEM_ADDRESS;
2892 bcs->data=0;
2893 bufferedCommands.Push(bcs);
2894
2895 // Block up to one second to get the socket, although it should actually take virtually no time
2896 SocketQueryOutput *sqo;
2897 // RakNetSocket2* output;
2898 for(;;)
2899 {
2900 if (isMainLoopThreadActive==false)
2901 return;
2902
2903 RakSleep(0);
2904
2905 sqo = socketQueryOutput.Pop();
2906 if (sqo)
2907 {
2908 sockets=sqo->sockets;
2909 sqo->sockets.Clear(false, _FILE_AND_LINE_);
2910 socketQueryOutput.Deallocate(sqo, _FILE_AND_LINE_);
2911 return;
2912 }
2913 }
2914 return;
2915 }
2916 void RakPeer::ReleaseSockets( DataStructures::List<RakNetSocket2* > &sockets )
2917 {
2918 sockets.Clear(false,_FILE_AND_LINE_);
2919 }
2920 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2921
2922 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2923 // Adds simulated ping and packet loss to the outgoing data flow.
2924 // 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 maxSendBPS value on each.
2925 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2926 void RakPeer::ApplyNetworkSimulator( float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance)
2927 {
2928 #ifdef _DEBUG
2929 if (remoteSystemList)
2930 {
2931 unsigned short i;
2932 for (i=0; i < maximumNumberOfPeers; i++)
2933 //for (i=0; i < remoteSystemListSize; i++)
2934 remoteSystemList[i].reliabilityLayer.ApplyNetworkSimulator(packetloss, minExtraPing, extraPingVariance);
2935 }
2936
2937 _packetloss=packetloss;
2938 _minExtraPing=minExtraPing;
2939 _extraPingVariance=extraPingVariance;
2940 #endif
2941 }
2942
2943 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2944
2945 void RakPeer::SetPerConnectionOutgoingBandwidthLimit( unsigned maxBitsPerSecond )
2946 {
2947 maxOutgoingBPS=maxBitsPerSecond;
2948 }
2949
2950 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2951 // Returns if you previously called ApplyNetworkSimulator
2952 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2953 bool RakPeer::IsNetworkSimulatorActive( void )
2954 {
2955 #ifdef _DEBUG
2956 return _packetloss>0 || _minExtraPing>0 || _extraPingVariance>0;
2957 #else
2958 return false;
2959 #endif
2960 }
2961
2962 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2963 void RakPeer::WriteOutOfBandHeader(SLNet::BitStream *bitStream)
2964 {
2965 bitStream->Write((MessageID)ID_OUT_OF_BAND_INTERNAL);
2966 bitStream->Write(myGuid);
2967 bitStream->WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
2968 }
2969 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2970 void RakPeer::SetUserUpdateThread(void (*_userUpdateThreadPtr)(RakPeerInterface *, void *), void *_userUpdateThreadData)
2971 {
2972 userUpdateThreadPtr=_userUpdateThreadPtr;
2973 userUpdateThreadData=_userUpdateThreadData;
2974 }
2975 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2976 void RakPeer::SetIncomingDatagramEventHandler( bool (*_incomingDatagramEventHandler)(RNS2RecvStruct *) )
2977 {
2978 incomingDatagramEventHandler=_incomingDatagramEventHandler;
2979 }
2980 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2981 bool RakPeer::SendOutOfBand(const char *host, unsigned short remotePort, const char *data, BitSize_t dataLength, unsigned connectionSocketIndex )
2982 {
2983 if ( IsActive() == false )
2984 return false;
2985
2986 if (host==0 || host[0]==0)
2987 return false;
2988
2989 // If this assert hits then Startup wasn't called or the call failed.
2990 RakAssert(connectionSocketIndex < socketList.Size());
2991
2992 // This is a security measure. Don't send data longer than this value
2993 RakAssert(dataLength <= (MAX_OFFLINE_DATA_LENGTH + sizeof(unsigned char)+sizeof(SLNet::Time)+RakNetGUID::size()+sizeof(OFFLINE_MESSAGE_DATA_ID)));
2994
2995 if (host==0)
2996 return false;
2997
2998 // 34 bytes
2999 SLNet::BitStream bitStream;
3000 WriteOutOfBandHeader(&bitStream);
3001
3002 if (dataLength>0)
3003 {
3004 bitStream.Write(data, dataLength);
3005 }
3006
3007 unsigned int realIndex = GetRakNetSocketFromUserConnectionSocketIndex(connectionSocketIndex);
3008
3009 /*
3010 SystemAddress systemAddress;
3011 systemAddress.FromStringExplicitPort(host,remotePort, socketList[realIndex]->GetBoundAddress().GetIPVersion());
3012 systemAddress.FixForIPVersion(socketList[realIndex]->GetBoundAddress());
3013
3014 unsigned i;
3015 for (i=0; i < pluginListNTS.Size(); i++)
3016 pluginListNTS[i]->OnDirectSocketSend((const char*)bitStream.GetData(), bitStream.GetNumberOfBitsUsed(), systemAddress);
3017
3018 SocketLayer::SendTo( socketList[realIndex], (const char*)bitStream.GetData(), (int) bitStream.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
3019 */
3020
3021 RNS2_SendParameters bsp;
3022 bsp.data = (char*) bitStream.GetData();
3023 bsp.length = bitStream.GetNumberOfBytesUsed();
3024 bsp.systemAddress.FromStringExplicitPort(host,remotePort, socketList[realIndex]->GetBoundAddress().GetIPVersion());
3025 bsp.systemAddress.FixForIPVersion(socketList[realIndex]->GetBoundAddress());
3026 unsigned i;
3027 for (i=0; i < pluginListNTS.Size(); i++)
3028 pluginListNTS[i]->OnDirectSocketSend((const char*)bsp.data, BYTES_TO_BITS(bsp.length), bsp.systemAddress);
3029 socketList[realIndex]->Send(&bsp, _FILE_AND_LINE_);
3030
3031 return true;
3032 }
3033
3034 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3035 RakNetStatistics * RakPeer::GetStatistics( const SystemAddress systemAddress, RakNetStatistics *rns )
3036 {
3037 static RakNetStatistics staticStatistics;
3038 RakNetStatistics *systemStats;
3039 if (rns==0)
3040 systemStats=&staticStatistics;
3041 else
3042 systemStats=rns;
3043
3044 if (systemAddress==UNASSIGNED_SYSTEM_ADDRESS)
3045 {
3046 bool firstWrite=false;
3047 // Return a crude sum
3048 for ( unsigned short i = 0; i < maximumNumberOfPeers; i++ )
3049 {
3050 if (remoteSystemList[ i ].isActive)
3051 {
3052 RakNetStatistics rnsTemp;
3053 remoteSystemList[ i ].reliabilityLayer.GetStatistics(&rnsTemp);
3054
3055 if (firstWrite==false)
3056 {
3057 memcpy(systemStats, &rnsTemp, sizeof(RakNetStatistics));
3058 firstWrite=true;
3059 }
3060 else
3061 (*systemStats)+=rnsTemp;
3062 }
3063 }
3064 return systemStats;
3065 }
3066 else
3067 {
3068 RemoteSystemStruct * rss;
3069 rss = GetRemoteSystemFromSystemAddress( systemAddress, false, false );
3070 if ( rss && endThreads==false )
3071 {
3072 rss->reliabilityLayer.GetStatistics(systemStats);
3073 return systemStats;
3074 }
3075 }
3076
3077 return 0;
3078 }
3079 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3080 void RakPeer::GetStatisticsList(DataStructures::List<SystemAddress> &addresses, DataStructures::List<RakNetGUID> &guids, DataStructures::List<RakNetStatistics> &statistics)
3081 {
3082 addresses.Clear(false, _FILE_AND_LINE_);
3083 guids.Clear(false, _FILE_AND_LINE_);
3084 statistics.Clear(false, _FILE_AND_LINE_);
3085
3086 if ( remoteSystemList == 0 || endThreads == true )
3087 return;
3088
3089 unsigned int i;
3090 for (i=0; i < activeSystemListSize; i++)
3091 {
3092 if ((activeSystemList[i])->isActive &&
3093 (activeSystemList[i])->connectMode==RakPeer::RemoteSystemStruct::CONNECTED)
3094 {
3095 addresses.Push((activeSystemList[i])->systemAddress, _FILE_AND_LINE_ );
3096 guids.Push((activeSystemList[i])->guid, _FILE_AND_LINE_ );
3097 RakNetStatistics rns;
3098 (activeSystemList[i])->reliabilityLayer.GetStatistics(&rns);
3099 statistics.Push(rns, _FILE_AND_LINE_);
3100 }
3101 }
3102 }
3103 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3104 bool RakPeer::GetStatistics( const unsigned int index, RakNetStatistics *rns )
3105 {
3106 if (index < maximumNumberOfPeers && remoteSystemList[ index ].isActive)
3107 {
3108 remoteSystemList[ index ].reliabilityLayer.GetStatistics(rns);
3109 return true;
3110 }
3111 return false;
3112 }
3113 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3114 unsigned int RakPeer::GetReceiveBufferSize(void)
3115 {
3116 unsigned int size;
3117 packetReturnMutex.Lock();
3118 size=packetReturnQueue.Size();
3119 packetReturnMutex.Unlock();
3120 return size;
3121 }
3122 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3123 int RakPeer::GetIndexFromSystemAddress( const SystemAddress systemAddress, bool calledFromNetworkThread ) const
3124 {
3125 unsigned i;
3126
3127 if ( systemAddress == UNASSIGNED_SYSTEM_ADDRESS )
3128 return -1;
3129
3130 if (systemAddress.systemIndex!=(SystemIndex)-1 && systemAddress.systemIndex < maximumNumberOfPeers && remoteSystemList[systemAddress.systemIndex].systemAddress==systemAddress && remoteSystemList[ systemAddress.systemIndex ].isActive)
3131 return systemAddress.systemIndex;
3132
3133 if (calledFromNetworkThread)
3134 {
3135 return GetRemoteSystemIndex(systemAddress);
3136 }
3137 else
3138 {
3139 // remoteSystemList in user and network thread
3140 for ( i = 0; i < maximumNumberOfPeers; i++ )
3141 if ( remoteSystemList[ i ].isActive && remoteSystemList[ i ].systemAddress == systemAddress )
3142 return i;
3143
3144 // If no active results found, try previously active results.
3145 for ( i = 0; i < maximumNumberOfPeers; i++ )
3146 if ( remoteSystemList[ i ].systemAddress == systemAddress )
3147 return i;
3148 }
3149
3150 return -1;
3151 }
3152 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3153 int RakPeer::GetIndexFromGuid( const RakNetGUID guid )
3154 {
3155 unsigned i;
3156
3157 if ( guid == UNASSIGNED_RAKNET_GUID )
3158 return -1;
3159
3160 if (guid.systemIndex!=(SystemIndex)-1 && guid.systemIndex < maximumNumberOfPeers && remoteSystemList[guid.systemIndex].guid==guid && remoteSystemList[ guid.systemIndex ].isActive)
3161 return guid.systemIndex;
3162
3163 // remoteSystemList in user and network thread
3164 for ( i = 0; i < maximumNumberOfPeers; i++ )
3165 if ( remoteSystemList[ i ].isActive && remoteSystemList[ i ].guid == guid )
3166 return i;
3167
3168 // If no active results found, try previously active results.
3169 for ( i = 0; i < maximumNumberOfPeers; i++ )
3170 if ( remoteSystemList[ i ].guid == guid )
3171 return i;
3172
3173 return -1;
3174 }
3175 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3176 #if LIBCAT_SECURITY==1
3177 bool RakPeer::GenerateConnectionRequestChallenge(RequestedConnectionStruct *rcs,PublicKey *publicKey)
3178 {
3179 CAT_AUDIT_PRINTF("AUDIT: In GenerateConnectionRequestChallenge()\n");
3180
3181 rcs->client_handshake = 0;
3182 rcs->publicKeyMode = PKM_INSECURE_CONNECTION;
3183
3184 if (!publicKey) return true;
3185
3186 switch (publicKey->publicKeyMode)
3187 {
3188 default:
3189 case PKM_INSECURE_CONNECTION:
3190 break;
3191
3192 case PKM_ACCEPT_ANY_PUBLIC_KEY:
3193 CAT_OBJCLR(rcs->remote_public_key);
3194 rcs->client_handshake = SLNet::OP_NEW<cat::ClientEasyHandshake>(_FILE_AND_LINE_);
3195
3196 rcs->publicKeyMode = PKM_ACCEPT_ANY_PUBLIC_KEY;
3197 break;
3198
3199 case PKM_USE_TWO_WAY_AUTHENTICATION:
3200 if (publicKey->myPublicKey == 0 || publicKey->myPrivateKey == 0 ||
3201 publicKey->remoteServerPublicKey == 0)
3202 {
3203 return false;
3204 }
3205
3206 rcs->client_handshake = SLNet::OP_NEW<cat::ClientEasyHandshake>(_FILE_AND_LINE_);
3207 memcpy(rcs->remote_public_key, publicKey->remoteServerPublicKey, cat::EasyHandshake::PUBLIC_KEY_BYTES);
3208
3209 if (!rcs->client_handshake->Initialize(publicKey->remoteServerPublicKey) ||
3210 !rcs->client_handshake->SetIdentity(publicKey->myPublicKey, publicKey->myPrivateKey) ||
3211 !rcs->client_handshake->GenerateChallenge(rcs->handshakeChallenge))
3212 {
3213 CAT_AUDIT_PRINTF("AUDIT: Failure initializing new client_handshake object with identity for this RequestedConnectionStruct\n");
3214 SLNet::OP_DELETE(rcs->client_handshake,_FILE_AND_LINE_);
3215 rcs->client_handshake=0;
3216 return false;
3217 }
3218
3219 CAT_AUDIT_PRINTF("AUDIT: Success initializing new client handshake object with identity for this RequestedConnectionStruct -- pre-generated challenge\n");
3220
3221 rcs->publicKeyMode = PKM_USE_TWO_WAY_AUTHENTICATION;
3222 break;
3223
3224 case PKM_USE_KNOWN_PUBLIC_KEY:
3225 if (publicKey->remoteServerPublicKey == 0)
3226 return false;
3227
3228 rcs->client_handshake = SLNet::OP_NEW<cat::ClientEasyHandshake>(_FILE_AND_LINE_);
3229 memcpy(rcs->remote_public_key, publicKey->remoteServerPublicKey, cat::EasyHandshake::PUBLIC_KEY_BYTES);
3230
3231 if (!rcs->client_handshake->Initialize(publicKey->remoteServerPublicKey) ||
3232 !rcs->client_handshake->GenerateChallenge(rcs->handshakeChallenge))
3233 {
3234 CAT_AUDIT_PRINTF("AUDIT: Failure initializing new client_handshake object for this RequestedConnectionStruct\n");
3235 SLNet::OP_DELETE(rcs->client_handshake,_FILE_AND_LINE_);
3236 rcs->client_handshake=0;
3237 return false;
3238 }
3239
3240 CAT_AUDIT_PRINTF("AUDIT: Success initializing new client handshake object for this RequestedConnectionStruct -- pre-generated challenge\n");
3241
3242 rcs->publicKeyMode = PKM_USE_KNOWN_PUBLIC_KEY;
3243 break;
3244 }
3245
3246 return true;
3247 }
3248 #endif
3249 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3250 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 )
3251 {
3252 RakAssert(passwordDataLength <= 256);
3253 RakAssert(remotePort!=0);
3254 SystemAddress systemAddress;
3255 if (!systemAddress.FromStringExplicitPort(host,remotePort,socketList[connectionSocketIndex]->GetBoundAddress().GetIPVersion()))
3256 return CANNOT_RESOLVE_DOMAIN_NAME;
3257
3258 // Already connected?
3259 if (GetRemoteSystemFromSystemAddress(systemAddress, false, true))
3260 return ALREADY_CONNECTED_TO_ENDPOINT;
3261
3262 //RequestedConnectionStruct *rcs = (RequestedConnectionStruct *) rakMalloc_Ex(sizeof(RequestedConnectionStruct), _FILE_AND_LINE_);
3263 RequestedConnectionStruct *rcs = SLNet::OP_NEW<RequestedConnectionStruct>(_FILE_AND_LINE_);
3264
3265 rcs->systemAddress=systemAddress;
3266 rcs->nextRequestTime= SLNet::GetTimeMS();
3267 rcs->requestsMade=0;
3268 rcs->data=0;
3269 rcs->socket=0;
3270 rcs->extraData=extraData;
3271 rcs->socketIndex=connectionSocketIndex;
3272 rcs->actionToTake=RequestedConnectionStruct::CONNECT;
3273 rcs->sendConnectionAttemptCount=sendConnectionAttemptCount;
3274 rcs->timeBetweenSendConnectionAttemptsMS=timeBetweenSendConnectionAttemptsMS;
3275 memcpy(rcs->outgoingPassword, passwordData, passwordDataLength);
3276 rcs->outgoingPasswordLength=(unsigned char) passwordDataLength;
3277 rcs->timeoutTime=timeoutTime;
3278
3279 #if LIBCAT_SECURITY==1
3280 CAT_AUDIT_PRINTF("AUDIT: In SendConnectionRequest()\n");
3281 if (!GenerateConnectionRequestChallenge(rcs,publicKey))
3282 return SECURITY_INITIALIZATION_FAILED;
3283 #else
3284 (void) publicKey;
3285 #endif
3286
3287 // Return false if already pending, else push on queue
3288 unsigned int i=0;
3289 requestedConnectionQueueMutex.Lock();
3290 for (; i < requestedConnectionQueue.Size(); i++)
3291 {
3292 if (requestedConnectionQueue[i]->systemAddress==systemAddress)
3293 {
3294 requestedConnectionQueueMutex.Unlock();
3295 // Not necessary
3296 //SLNet::OP_DELETE(rcs->client_handshake,_FILE_AND_LINE_);
3297 SLNet::OP_DELETE(rcs,_FILE_AND_LINE_);
3298 return CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS;
3299 }
3300 }
3301 requestedConnectionQueue.Push(rcs, _FILE_AND_LINE_ );
3302 requestedConnectionQueueMutex.Unlock();
3303
3304 return CONNECTION_ATTEMPT_STARTED;
3305 }
3306 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 )
3307 {
3308 RakAssert(passwordDataLength <= 256);
3309 SystemAddress systemAddress;
3310 systemAddress.FromStringExplicitPort(host,remotePort);
3311
3312 // Already connected?
3313 if (GetRemoteSystemFromSystemAddress(systemAddress, false, true))
3314 return ALREADY_CONNECTED_TO_ENDPOINT;
3315
3316 //RequestedConnectionStruct *rcs = (RequestedConnectionStruct *) rakMalloc_Ex(sizeof(RequestedConnectionStruct), _FILE_AND_LINE_);
3317 RequestedConnectionStruct *rcs = SLNet::OP_NEW<RequestedConnectionStruct>(_FILE_AND_LINE_);
3318
3319 rcs->systemAddress=systemAddress;
3320 rcs->nextRequestTime= SLNet::GetTimeMS();
3321 rcs->requestsMade=0;
3322 rcs->data=0;
3323 rcs->socket=0;
3324 rcs->extraData=extraData;
3325 rcs->socketIndex=connectionSocketIndex;
3326 rcs->actionToTake=RequestedConnectionStruct::CONNECT;
3327 rcs->sendConnectionAttemptCount=sendConnectionAttemptCount;
3328 rcs->timeBetweenSendConnectionAttemptsMS=timeBetweenSendConnectionAttemptsMS;
3329 memcpy(rcs->outgoingPassword, passwordData, passwordDataLength);
3330 rcs->outgoingPasswordLength=(unsigned char) passwordDataLength;
3331 rcs->timeoutTime=timeoutTime;
3332 rcs->socket=socket;
3333
3334 #if LIBCAT_SECURITY==1
3335 if (!GenerateConnectionRequestChallenge(rcs,publicKey))
3336 return SECURITY_INITIALIZATION_FAILED;
3337 #else
3338 (void) publicKey;
3339 #endif
3340
3341 // Return false if already pending, else push on queue
3342 unsigned int i=0;
3343 requestedConnectionQueueMutex.Lock();
3344 for (; i < requestedConnectionQueue.Size(); i++)
3345 {
3346 if (requestedConnectionQueue[i]->systemAddress==systemAddress)
3347 {
3348 requestedConnectionQueueMutex.Unlock();
3349 // Not necessary
3350 //SLNet::OP_DELETE(rcs->client_handshake,_FILE_AND_LINE_);
3351 SLNet::OP_DELETE(rcs,_FILE_AND_LINE_);
3352 return CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS;
3353 }
3354 }
3355 requestedConnectionQueue.Push(rcs, _FILE_AND_LINE_ );
3356 requestedConnectionQueueMutex.Unlock();
3357
3358 return CONNECTION_ATTEMPT_STARTED;
3359 }
3360 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3361 void RakPeer::ValidateRemoteSystemLookup(void) const
3362 {
3363 }
3364 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3365 RakPeer::RemoteSystemStruct *RakPeer::GetRemoteSystem( const AddressOrGUID systemIdentifier, bool calledFromNetworkThread, bool onlyActive ) const
3366 {
3367 if (systemIdentifier.rakNetGuid!=UNASSIGNED_RAKNET_GUID)
3368 return GetRemoteSystemFromGUID(systemIdentifier.rakNetGuid, onlyActive);
3369 else
3370 return GetRemoteSystemFromSystemAddress(systemIdentifier.systemAddress, calledFromNetworkThread, onlyActive);
3371 }
3372 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3373 RakPeer::RemoteSystemStruct *RakPeer::GetRemoteSystemFromSystemAddress( const SystemAddress systemAddress, bool calledFromNetworkThread, bool onlyActive ) const
3374 {
3375 unsigned i;
3376
3377 if ( systemAddress == UNASSIGNED_SYSTEM_ADDRESS )
3378 return 0;
3379
3380 if (calledFromNetworkThread)
3381 {
3382 unsigned int index = GetRemoteSystemIndex(systemAddress);
3383 if (index!=(unsigned int) -1)
3384 {
3385 if (onlyActive==false || remoteSystemList[ index ].isActive==true )
3386 {
3387 RakAssert(remoteSystemList[index].systemAddress==systemAddress);
3388 return remoteSystemList + index;
3389 }
3390 }
3391 }
3392 else
3393 {
3394 int deadConnectionIndex=-1;
3395
3396 // Active connections take priority. But if there are no active connections, return the first systemAddress match found
3397 for ( i = 0; i < maximumNumberOfPeers; i++ )
3398 {
3399 if (remoteSystemList[ i ].systemAddress == systemAddress)
3400 {
3401 if ( remoteSystemList[ i ].isActive )
3402 return remoteSystemList + i;
3403 else if (deadConnectionIndex==-1)
3404 deadConnectionIndex=i;
3405 }
3406 }
3407
3408 if (deadConnectionIndex!=-1 && onlyActive==false)
3409 return remoteSystemList + deadConnectionIndex;
3410 }
3411
3412 return 0;
3413 }
3414 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3415 RakPeer::RemoteSystemStruct *RakPeer::GetRemoteSystemFromGUID( const RakNetGUID guid, bool onlyActive ) const
3416 {
3417 if (guid==UNASSIGNED_RAKNET_GUID)
3418 return 0;
3419
3420 unsigned i;
3421 for ( i = 0; i < maximumNumberOfPeers; i++ )
3422 {
3423 if (remoteSystemList[ i ].guid == guid && (onlyActive==false || remoteSystemList[ i ].isActive))
3424 {
3425 return remoteSystemList + i;
3426 }
3427 }
3428 return 0;
3429 }
3430 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3431 void RakPeer::ParseConnectionRequestPacket( RakPeer::RemoteSystemStruct *remoteSystem, const SystemAddress &systemAddress, const char *data, int byteSize )
3432 {
3433 SLNet::BitStream bs((unsigned char*) data,byteSize,false);
3434 bs.IgnoreBytes(sizeof(MessageID));
3435 RakNetGUID guid;
3436 bs.Read(guid);
3437 SLNet::Time incomingTimestamp;
3438 bs.Read(incomingTimestamp);
3439 unsigned char doSecurity;
3440 bs.Read(doSecurity);
3441
3442 #if LIBCAT_SECURITY==1
3443 unsigned char doClientKey;
3444 if (_using_security)
3445 {
3446 // Ignore message on bad state
3447 if (doSecurity != 1 || !remoteSystem->reliabilityLayer.GetAuthenticatedEncryption())
3448 return;
3449
3450 // Validate client proof of key
3451 unsigned char proof[cat::EasyHandshake::PROOF_BYTES];
3452 bs.ReadAlignedBytes(proof, sizeof(proof));
3453 if (!remoteSystem->reliabilityLayer.GetAuthenticatedEncryption()->ValidateProof(proof, sizeof(proof)))
3454 {
3455 remoteSystem->connectMode = RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY;
3456 return;
3457 }
3458
3459 CAT_OBJCLR(remoteSystem->client_public_key);
3460
3461 bs.Read(doClientKey);
3462
3463 // Check if client wants to prove identity
3464 if (doClientKey == 1)
3465 {
3466 // Read identity proof
3467 unsigned char ident[cat::EasyHandshake::IDENTITY_BYTES];
3468 bs.ReadAlignedBytes(ident, sizeof(ident));
3469
3470 // If we are listening to these proofs,
3471 if (_require_client_public_key)
3472 {
3473 // Validate client identity
3474 if (!_server_handshake->VerifyInitiatorIdentity(remoteSystem->answer, ident, remoteSystem->client_public_key))
3475 {
3476 SLNet::BitStream bitStream;
3477 bitStream.Write((MessageID)ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY); // Report an error since the client is not providing an identity when it is necessary to connect
3478 bitStream.Write((unsigned char)2); // Indicate client identity is invalid
3479 SendImmediate((char*) bitStream.GetData(), bitStream.GetNumberOfBytesUsed(), IMMEDIATE_PRIORITY, RELIABLE, 0, systemAddress, false, false, SLNet::GetTimeUS(), 0);
3480 remoteSystem->connectMode = RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY;
3481 return;
3482 }
3483 }
3484
3485 // Otherwise ignore the client public key
3486 }
3487 else
3488 {
3489 // If no client key was provided but it is required,
3490 if (_require_client_public_key)
3491 {
3492 SLNet::BitStream bitStream;
3493 bitStream.Write((MessageID)ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY); // Report an error since the client is not providing an identity when it is necessary to connect
3494 bitStream.Write((unsigned char)1); // Indicate client identity is missing
3495 SendImmediate((char*) bitStream.GetData(), bitStream.GetNumberOfBytesUsed(), IMMEDIATE_PRIORITY, RELIABLE, 0, systemAddress, false, false, SLNet::GetTimeUS(), 0);
3496 remoteSystem->connectMode = RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY;
3497 return;
3498 }
3499 }
3500 }
3501 #endif // LIBCAT_SECURITY
3502
3503 unsigned char *password = bs.GetData()+BITS_TO_BYTES(bs.GetReadOffset());
3504 int passwordLength = byteSize - BITS_TO_BYTES(bs.GetReadOffset());
3505 if ( incomingPasswordLength != passwordLength ||
3506 memcmp( password, incomingPassword, incomingPasswordLength ) != 0 )
3507 {
3508 CAT_AUDIT_PRINTF("AUDIT: Invalid password\n");
3509 // This one we only send once since we don't care if it arrives.
3510 SLNet::BitStream bitStream;
3511 bitStream.Write((MessageID)ID_INVALID_PASSWORD);
3512 bitStream.Write(GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS));
3513 SendImmediate((char*) bitStream.GetData(), bitStream.GetNumberOfBytesUsed(), IMMEDIATE_PRIORITY, RELIABLE, 0, systemAddress, false, false, SLNet::GetTimeUS(), 0);
3514 remoteSystem->connectMode=RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY;
3515 return;
3516 }
3517
3518 // OK
3519 remoteSystem->connectMode=RemoteSystemStruct::HANDLING_CONNECTION_REQUEST;
3520
3521 OnConnectionRequest( remoteSystem, incomingTimestamp );
3522 }
3523 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3524 void RakPeer::OnConnectionRequest( RakPeer::RemoteSystemStruct *remoteSystem, SLNet::Time incomingTimestamp )
3525 {
3526 SLNet::BitStream bitStream;
3527 bitStream.Write((MessageID)ID_CONNECTION_REQUEST_ACCEPTED);
3528 bitStream.Write(remoteSystem->systemAddress);
3529 SystemIndex systemIndex = (SystemIndex) GetIndexFromSystemAddress( remoteSystem->systemAddress, true );
3530 RakAssert(systemIndex!=65535);
3531 bitStream.Write(systemIndex);
3532 for (unsigned int i=0; i < MAXIMUM_NUMBER_OF_INTERNAL_IDS; i++)
3533 bitStream.Write(ipList[i]);
3534 bitStream.Write(incomingTimestamp);
3535 bitStream.Write(SLNet::GetTime());
3536
3537 SendImmediate((char*)bitStream.GetData(), bitStream.GetNumberOfBitsUsed(), IMMEDIATE_PRIORITY, RELIABLE_ORDERED, 0, remoteSystem->systemAddress, false, false, SLNet::GetTimeUS(), 0);
3538 }
3539
3540 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3541 void RakPeer::NotifyAndFlagForShutdown( const SystemAddress systemAddress, bool performImmediate, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority )
3542 {
3543 SLNet::BitStream temp( sizeof(unsigned char) );
3544 temp.Write( (MessageID)ID_DISCONNECTION_NOTIFICATION );
3545 if (performImmediate)
3546 {
3547 SendImmediate((char*)temp.GetData(), temp.GetNumberOfBitsUsed(), disconnectionNotificationPriority, RELIABLE_ORDERED, orderingChannel, systemAddress, false, false, SLNet::GetTimeUS(), 0);
3548 RemoteSystemStruct *rss=GetRemoteSystemFromSystemAddress(systemAddress, true, true);
3549 rss->connectMode=RemoteSystemStruct::DISCONNECT_ASAP;
3550 }
3551 else
3552 {
3553 SendBuffered((const char*)temp.GetData(), temp.GetNumberOfBitsUsed(), disconnectionNotificationPriority, RELIABLE_ORDERED, orderingChannel, systemAddress, false, RemoteSystemStruct::DISCONNECT_ASAP, 0);
3554 }
3555 }
3556 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3557 unsigned int RakPeer::GetNumberOfRemoteInitiatedConnections( void ) const
3558 {
3559 if ( remoteSystemList == 0 || endThreads == true )
3560 return 0;
3561
3562 unsigned int numberOfIncomingConnections;
3563 numberOfIncomingConnections = 0;
3564 unsigned int i;
3565 for (i=0; i < activeSystemListSize; i++)
3566 {
3567 if ((activeSystemList[i])->isActive &&
3568 (activeSystemList[i])->connectMode==RakPeer::RemoteSystemStruct::CONNECTED &&
3569 (activeSystemList[i])->weInitiatedTheConnection==false
3570 )
3571 {
3572 numberOfIncomingConnections++;
3573 }
3574 }
3575 return numberOfIncomingConnections;
3576 }
3577
3578 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3579 RakPeer::RemoteSystemStruct * RakPeer::AssignSystemAddressToRemoteSystemList( const SystemAddress systemAddress, RemoteSystemStruct::ConnectMode connectionMode, RakNetSocket2* incomingRakNetSocket, bool *thisIPConnectedRecently, SystemAddress bindingAddress, int incomingMTU, RakNetGUID guid, bool useSecurity )
3580 {
3581 RemoteSystemStruct * remoteSystem;
3582 unsigned i,j,assignedIndex;
3583 SLNet::TimeMS time = SLNet::GetTimeMS();
3584 #ifdef _DEBUG
3585 RakAssert(systemAddress!=UNASSIGNED_SYSTEM_ADDRESS);
3586 #endif
3587
3588 if (limitConnectionFrequencyFromTheSameIP)
3589 {
3590 if (IsLoopbackAddress(systemAddress,false)==false)
3591 {
3592 for ( i = 0; i < maximumNumberOfPeers; i++ )
3593 {
3594 if ( remoteSystemList[ i ].isActive==true &&
3595 remoteSystemList[ i ].systemAddress.EqualsExcludingPort(systemAddress) &&
3596 time >= remoteSystemList[ i ].connectionTime &&
3597 time - remoteSystemList[ i ].connectionTime < 100
3598 )
3599 {
3600 // 4/13/09 Attackers can flood ID_OPEN_CONNECTION_REQUEST and use up all available connection slots
3601 // Ignore connection attempts if this IP address connected within the last 100 milliseconds
3602 *thisIPConnectedRecently=true;
3603 ValidateRemoteSystemLookup();
3604 return 0;
3605 }
3606 }
3607 }
3608 }
3609
3610 // Don't use a different port than what we received on
3611 bindingAddress.CopyPort(incomingRakNetSocket->GetBoundAddress());
3612
3613 *thisIPConnectedRecently=false;
3614 for ( assignedIndex = 0; assignedIndex < maximumNumberOfPeers; assignedIndex++ )
3615 {
3616 if ( remoteSystemList[ assignedIndex ].isActive==false )
3617 {
3618 // printf("--- Address %s has become active\n", systemAddress.ToString());
3619
3620 remoteSystem=remoteSystemList+assignedIndex;
3621 ReferenceRemoteSystem(systemAddress, assignedIndex);
3622 remoteSystem->MTUSize=defaultMTUSize;
3623 remoteSystem->guid=guid;
3624 remoteSystem->isActive = true; // This one line causes future incoming packets to go through the reliability layer
3625 // Reserve this reliability layer for ourselves.
3626 if (incomingMTU > remoteSystem->MTUSize)
3627 remoteSystem->MTUSize=incomingMTU;
3628 RakAssert(remoteSystem->MTUSize <= MAXIMUM_MTU_SIZE);
3629 remoteSystem->reliabilityLayer.Reset(true, remoteSystem->MTUSize, useSecurity);
3630 remoteSystem->reliabilityLayer.SetSplitMessageProgressInterval(splitMessageProgressInterval);
3631 remoteSystem->reliabilityLayer.SetUnreliableTimeout(unreliableTimeout);
3632 remoteSystem->reliabilityLayer.SetTimeoutTime(defaultTimeoutTime);
3633 AddToActiveSystemList(assignedIndex);
3634 if (incomingRakNetSocket->GetBoundAddress()==bindingAddress)
3635 {
3636 remoteSystem->rakNetSocket=incomingRakNetSocket;
3637 }
3638 else
3639 {
3640 char str[256];
3641 bindingAddress.ToString(true,str,static_cast<size_t>(256));
3642 // See if this is an internal IP address.
3643 // If so, force binding on it so we reply on the same IP address as they sent to.
3644 unsigned int ipListIndex, foundIndex=(unsigned int)-1;
3645
3646 for (ipListIndex=0; ipListIndex < MAXIMUM_NUMBER_OF_INTERNAL_IDS; ipListIndex++)
3647 {
3648 if (ipList[ipListIndex]==UNASSIGNED_SYSTEM_ADDRESS)
3649 break;
3650
3651 if (bindingAddress.EqualsExcludingPort(ipList[ipListIndex]))
3652 {
3653 foundIndex=ipListIndex;
3654 break;
3655 }
3656 }
3657
3658 // 06/26/09 Unconfirmed report that Vista firewall blocks the reply if we force a binding
3659 // For now use the incoming socket only
3660 // Originally this code was to force a machine with multiple IP addresses to reply back on the IP
3661 // that the datagram came in on
3662 //if (1 || foundIndex==(unsigned int)-1)
3663 //{
3664 // Must not be an internal LAN address. Just use whatever socket it came in on
3665 remoteSystem->rakNetSocket=incomingRakNetSocket;
3666 //}
3667 //else
3668 //{
3669 /*
3670 // Force binding
3671 unsigned int socketListIndex;
3672 for (socketListIndex=0; socketListIndex < socketList.Size(); socketListIndex++)
3673 {
3674 if (socketList[socketListIndex]->GetBoundAddress()==bindingAddress)
3675 {
3676 // Force binding with existing socket
3677 remoteSystem->rakNetSocket=socketList[socketListIndex];
3678 break;
3679 }
3680 }
3681
3682 if (socketListIndex==socketList.Size())
3683 {
3684 char ipListFoundIndexStr[128];
3685 ipList[foundIndex].ToString(false,str);
3686
3687 // Force binding with new socket
3688 RakNetSocket* rns(SLNet::OP_NEW<RakNetSocket>(_FILE_AND_LINE_));
3689 if (incomingRakNetSocket->GetRemotePortRakNetWasStartedOn()==0)
3690 rns = SocketLayer::CreateBoundSocket( this, bindingAddress.GetPort(), incomingRakNetSocket->GetBlockingSocket(), ipListFoundIndexStr, 0, incomingRakNetSocket->GetExtraSocketOptions(), incomingRakNetSocket->GetSocketFamily(), incomingRakNetSocket->GetChromeInstance() );
3691 else
3692 rns = SocketLayer::CreateBoundSocket_PS3Lobby( bindingAddress.GetPort(), incomingRakNetSocket->GetBlockingSocket(), ipListFoundIndexStr, incomingRakNetSocket->GetSocketFamily() );
3693
3694
3695 if (rns==0)
3696 {
3697 // Can't bind. Just use whatever socket it came in on
3698 remoteSystem->rakNetSocket=incomingRakNetSocket;
3699 }
3700 else
3701 {
3702 rns->GetBoundAddress()=bindingAddress;
3703 rns->SetUserConnectionSocketIndex((unsigned int)-1);
3704 socketList.Push(rns, _FILE_AND_LINE_ );
3705 remoteSystem->rakNetSocket=rns;
3706
3707
3708 #ifdef _WIN32
3709 int highPriority=THREAD_PRIORITY_ABOVE_NORMAL;
3710 #else
3711 int highPriority=-10;
3712 #endif
3713
3714 highPriority=0;
3715
3716
3717 }
3718 }
3719
3720 */
3721 //}
3722 }
3723
3724 for ( j = 0; j < (unsigned) PING_TIMES_ARRAY_SIZE; j++ )
3725 {
3726 remoteSystem->pingAndClockDifferential[ j ].pingTime = 65535;
3727 remoteSystem->pingAndClockDifferential[ j ].clockDifferential = 0;
3728 }
3729
3730 remoteSystem->connectMode=connectionMode;
3731 remoteSystem->pingAndClockDifferentialWriteIndex = 0;
3732 remoteSystem->lowestPing = 65535;
3733 remoteSystem->nextPingTime = 0; // Ping immediately
3734 remoteSystem->weInitiatedTheConnection = false;
3735 remoteSystem->connectionTime = time;
3736 remoteSystem->myExternalSystemAddress = UNASSIGNED_SYSTEM_ADDRESS;
3737 remoteSystem->lastReliableSend=time;
3738
3739 #ifdef _DEBUG
3740 int indexLoopupCheck=GetIndexFromSystemAddress( systemAddress, true );
3741 if ((int) indexLoopupCheck!=(int) assignedIndex)
3742 {
3743 RakAssert((int) indexLoopupCheck==(int) assignedIndex);
3744 }
3745 #endif
3746
3747 return remoteSystem;
3748 }
3749 }
3750
3751 return 0;
3752 }
3753
3754 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3755 // Adjust the first four bytes (treated as unsigned int) of the pointer
3756 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3757 void RakPeer::ShiftIncomingTimestamp( unsigned char *data, const SystemAddress &systemAddress ) const
3758 {
3759 #ifdef _DEBUG
3760 RakAssert( IsActive() );
3761 RakAssert( data );
3762 #endif
3763
3764 SLNet::BitStream timeBS( data, sizeof(SLNet::Time), false);
3765 SLNet::Time encodedTimestamp;
3766 timeBS.Read(encodedTimestamp);
3767
3768 encodedTimestamp = encodedTimestamp - GetBestClockDifferential( systemAddress );
3769 timeBS.SetWriteOffset(0);
3770 timeBS.Write(encodedTimestamp);
3771 }
3772
3773 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3774 // Thanks to Chris Taylor (cat02e@fsu.edu) for the improved timestamping algorithm
3775 SLNet::Time RakPeer::GetBestClockDifferential( const SystemAddress systemAddress ) const
3776 {
3777 RemoteSystemStruct *remoteSystem = GetRemoteSystemFromSystemAddress( systemAddress, true, true );
3778
3779 if ( remoteSystem == 0 )
3780 return 0;
3781
3782 return GetClockDifferentialInt(remoteSystem);
3783 }
3784 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3785 unsigned int RakPeer::RemoteSystemLookupHashIndex(const SystemAddress &sa) const
3786 {
3787 return SystemAddress::ToInteger(sa) % ((unsigned int) maximumNumberOfPeers * REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE);
3788 }
3789 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3790 void RakPeer::ReferenceRemoteSystem(const SystemAddress &sa, unsigned int remoteSystemListIndex)
3791 {
3792 // #ifdef _DEBUG
3793 // for ( int remoteSystemIndex = 0; remoteSystemIndex < maximumNumberOfPeers; ++remoteSystemIndex )
3794 // {
3795 // if (remoteSystemList[remoteSystemIndex].isActive )
3796 // {
3797 // unsigned int hashIndex = GetRemoteSystemIndex(remoteSystemList[remoteSystemIndex].systemAddress);
3798 // RakAssert(hashIndex==remoteSystemIndex);
3799 // }
3800 // }
3801 // #endif
3802
3803
3804 SystemAddress oldAddress = remoteSystemList[remoteSystemListIndex].systemAddress;
3805 if (oldAddress!=UNASSIGNED_SYSTEM_ADDRESS)
3806 {
3807 // The system might be active if rerouting
3808 // RakAssert(remoteSystemList[remoteSystemListIndex].isActive==false);
3809
3810 // Remove the reference if the reference is pointing to this inactive system
3811 if (GetRemoteSystem(oldAddress)==&remoteSystemList[remoteSystemListIndex])
3812 DereferenceRemoteSystem(oldAddress);
3813 }
3814 DereferenceRemoteSystem(sa);
3815
3816 // #ifdef _DEBUG
3817 // for ( int remoteSystemIndex = 0; remoteSystemIndex < maximumNumberOfPeers; ++remoteSystemIndex )
3818 // {
3819 // if (remoteSystemList[remoteSystemIndex].isActive )
3820 // {
3821 // unsigned int hashIndex = GetRemoteSystemIndex(remoteSystemList[remoteSystemIndex].systemAddress);
3822 // if (hashIndex!=remoteSystemIndex)
3823 // {
3824 // RakAssert(hashIndex==remoteSystemIndex);
3825 // }
3826 // }
3827 // }
3828 // #endif
3829
3830
3831 remoteSystemList[remoteSystemListIndex].systemAddress=sa;
3832
3833 unsigned int hashIndex = RemoteSystemLookupHashIndex(sa);
3834 RemoteSystemIndex *rsi;
3835 rsi = remoteSystemIndexPool.Allocate(_FILE_AND_LINE_);
3836 if (remoteSystemLookup[hashIndex]==0)
3837 {
3838 rsi->next=0;
3839 rsi->index=remoteSystemListIndex;
3840 remoteSystemLookup[hashIndex]=rsi;
3841 }
3842 else
3843 {
3844 RemoteSystemIndex *cur = remoteSystemLookup[hashIndex];
3845 while (cur->next!=0)
3846 {
3847 cur=cur->next;
3848 }
3849
3850 rsi = remoteSystemIndexPool.Allocate(_FILE_AND_LINE_);
3851 rsi->next=0;
3852 rsi->index=remoteSystemListIndex;
3853 cur->next=rsi;
3854 }
3855
3856 // #ifdef _DEBUG
3857 // for ( int remoteSystemIndex = 0; remoteSystemIndex < maximumNumberOfPeers; ++remoteSystemIndex )
3858 // {
3859 // if (remoteSystemList[remoteSystemIndex].isActive )
3860 // {
3861 // unsigned int hashIndex = GetRemoteSystemIndex(remoteSystemList[remoteSystemIndex].systemAddress);
3862 // RakAssert(hashIndex==remoteSystemIndex);
3863 // }
3864 // }
3865 // #endif
3866
3867
3868 RakAssert(GetRemoteSystemIndex(sa)==remoteSystemListIndex);
3869 }
3870 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3871 void RakPeer::DereferenceRemoteSystem(const SystemAddress &sa)
3872 {
3873 unsigned int hashIndex = RemoteSystemLookupHashIndex(sa);
3874 RemoteSystemIndex *cur = remoteSystemLookup[hashIndex];
3875 RemoteSystemIndex *last = 0;
3876 while (cur!=0)
3877 {
3878 if (remoteSystemList[cur->index].systemAddress==sa)
3879 {
3880 if (last==0)
3881 {
3882 remoteSystemLookup[hashIndex]=cur->next;
3883 }
3884 else
3885 {
3886 last->next=cur->next;
3887 }
3888 remoteSystemIndexPool.Release(cur,_FILE_AND_LINE_);
3889 break;
3890 }
3891 last=cur;
3892 cur=cur->next;
3893 }
3894 }
3895 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3896 unsigned int RakPeer::GetRemoteSystemIndex(const SystemAddress &sa) const
3897 {
3898 unsigned int hashIndex = RemoteSystemLookupHashIndex(sa);
3899 RemoteSystemIndex *cur = remoteSystemLookup[hashIndex];
3900 while (cur!=0)
3901 {
3902 if (remoteSystemList[cur->index].systemAddress==sa)
3903 return cur->index;
3904 cur=cur->next;
3905 }
3906 return (unsigned int) -1;
3907 }
3908 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3909 RakPeer::RemoteSystemStruct* RakPeer::GetRemoteSystem(const SystemAddress &sa) const
3910 {
3911 unsigned int remoteSystemIndex = GetRemoteSystemIndex(sa);
3912 if (remoteSystemIndex==(unsigned int)-1)
3913 return 0;
3914 return remoteSystemList + remoteSystemIndex;
3915 }
3916 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3917 void RakPeer::ClearRemoteSystemLookup(void)
3918 {
3919 remoteSystemIndexPool.Clear(_FILE_AND_LINE_);
3920 SLNet::OP_DELETE_ARRAY(remoteSystemLookup,_FILE_AND_LINE_);
3921 remoteSystemLookup=0;
3922 }
3923 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3924 void RakPeer::AddToActiveSystemList(unsigned int remoteSystemListIndex)
3925 {
3926 activeSystemList[activeSystemListSize++]=remoteSystemList+remoteSystemListIndex;
3927 }
3928 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3929 void RakPeer::RemoveFromActiveSystemList(const SystemAddress &sa)
3930 {
3931 unsigned int i;
3932 for (i=0; i < activeSystemListSize; i++)
3933 {
3934 RemoteSystemStruct *rss=activeSystemList[i];
3935 if (rss->systemAddress==sa)
3936 {
3937 activeSystemList[i]=activeSystemList[activeSystemListSize-1];
3938 activeSystemListSize--;
3939 return;
3940 }
3941 }
3942 RakAssert("activeSystemList invalid, entry not found in RemoveFromActiveSystemList. Ensure that AddToActiveSystemList and RemoveFromActiveSystemList are called by the same thread." && 0);
3943 }
3944 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3945 /*
3946 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3947 unsigned int RakPeer::LookupIndexUsingHashIndex(const SystemAddress &sa) const
3948 {
3949 unsigned int scanCount=0;
3950 unsigned int index = RemoteSystemLookupHashIndex(sa);
3951 if (remoteSystemLookup[index].index==(unsigned int)-1)
3952 return (unsigned int) -1;
3953 while (remoteSystemList[remoteSystemLookup[index].index].systemAddress!=sa)
3954 {
3955 if (++index==(unsigned int) maximumNumberOfPeers*REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE)
3956 index=0;
3957 if (++scanCount>(unsigned int) maximumNumberOfPeers*REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE)
3958 return (unsigned int) -1;
3959 if (remoteSystemLookup[index].index==-1)
3960 return (unsigned int) -1;
3961 }
3962 return index;
3963 }
3964 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3965 unsigned int RakPeer::RemoteSystemListIndexUsingHashIndex(const SystemAddress &sa) const
3966 {
3967 unsigned int index = LookupIndexUsingHashIndex(sa);
3968 if (index!=(unsigned int) -1)
3969 {
3970 return remoteSystemLookup[index].index;
3971 }
3972 return (unsigned int) -1;
3973 }
3974 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3975 unsigned int RakPeer::FirstFreeRemoteSystemLookupIndex(const SystemAddress &sa) const
3976 {
3977 // unsigned int collisionCount=0;
3978 unsigned int index = RemoteSystemLookupHashIndex(sa);
3979 while (remoteSystemLookup[index].index!=(unsigned int)-1)
3980 {
3981 if (++index==(unsigned int) maximumNumberOfPeers*REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE)
3982 index=0;
3983 // collisionCount++;
3984 }
3985 // printf("%i collisions. Using index %i\n", collisionCount, index);
3986 return index;
3987 }
3988 */
3989 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3990 bool RakPeer::IsLoopbackAddress(const AddressOrGUID &systemIdentifier, bool matchPort) const
3991 {
3992 if (systemIdentifier.rakNetGuid!=UNASSIGNED_RAKNET_GUID)
3993 return systemIdentifier.rakNetGuid==myGuid;
3994
3995 for (int i=0; i < MAXIMUM_NUMBER_OF_INTERNAL_IDS && ipList[i]!=UNASSIGNED_SYSTEM_ADDRESS; i++)
3996 {
3997 if (matchPort)
3998 {
3999 if (ipList[i]==systemIdentifier.systemAddress)
4000 return true;
4001 }
4002 else
4003 {
4004 if (ipList[i].EqualsExcludingPort(systemIdentifier.systemAddress))
4005 return true;
4006 }
4007 }
4008
4009 return (matchPort==true && systemIdentifier.systemAddress==firstExternalID) ||
4010 (matchPort==false && systemIdentifier.systemAddress.EqualsExcludingPort(firstExternalID));
4011 }
4012 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4013 SystemAddress RakPeer::GetLoopbackAddress(void) const
4014 {
4015
4016 return ipList[0];
4017
4018
4019
4020 }
4021 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4022 bool RakPeer::AllowIncomingConnections(void) const
4023 {
4024 return GetNumberOfRemoteInitiatedConnections() < GetMaximumIncomingConnections();
4025 }
4026 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4027 void RakPeer::DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line)
4028 {
4029 bufferedPacketsFreePoolMutex.Lock();
4030 bufferedPacketsFreePool.Push(s, file, line);
4031 bufferedPacketsFreePoolMutex.Unlock();
4032 }
4033 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4034 RNS2RecvStruct *RakPeer::AllocRNS2RecvStruct(const char *file, unsigned int line)
4035 {
4036 bufferedPacketsFreePoolMutex.Lock();
4037 if (bufferedPacketsFreePool.Size()>0)
4038 {
4039 RNS2RecvStruct *s = bufferedPacketsFreePool.Pop();
4040 bufferedPacketsFreePoolMutex.Unlock();
4041 return s;
4042 }
4043 else
4044 {
4045 bufferedPacketsFreePoolMutex.Unlock();
4046 return SLNet::OP_NEW<RNS2RecvStruct>(file,line);
4047 }
4048 }
4049 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4050 void RakPeer::ClearBufferedPackets(void)
4051 {
4052 bufferedPacketsFreePoolMutex.Lock();
4053 while (bufferedPacketsFreePool.Size()>0)
4054 SLNet::OP_DELETE(bufferedPacketsFreePool.Pop(), _FILE_AND_LINE_);
4055 bufferedPacketsFreePoolMutex.Unlock();
4056
4057 bufferedPacketsQueueMutex.Lock();
4058 while (bufferedPacketsQueue.Size()>0)
4059 SLNet::OP_DELETE(bufferedPacketsQueue.Pop(), _FILE_AND_LINE_);
4060 bufferedPacketsQueueMutex.Unlock();
4061 }
4062 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4063 void RakPeer::SetupBufferedPackets(void)
4064 {
4065 }
4066 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4067 void RakPeer::PushBufferedPacket(RNS2RecvStruct * p)
4068 {
4069 bufferedPacketsQueueMutex.Lock();
4070 bufferedPacketsQueue.Push(p, _FILE_AND_LINE_);
4071 bufferedPacketsQueueMutex.Unlock();
4072 }
4073 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4074 RNS2RecvStruct *RakPeer::PopBufferedPacket(void)
4075 {
4076 bufferedPacketsQueueMutex.Lock();
4077 if (bufferedPacketsQueue.Size()>0)
4078 {
4079 RNS2RecvStruct *s = bufferedPacketsQueue.Pop();
4080 bufferedPacketsQueueMutex.Unlock();
4081 return s;
4082 }
4083 bufferedPacketsQueueMutex.Unlock();
4084 return 0;
4085 }
4086 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4087 void RakPeer::PingInternal( const SystemAddress target, bool performImmediate, PacketReliability reliability )
4088 {
4089 if ( IsActive() == false )
4090 return ;
4091
4092 SLNet::BitStream bitStream(sizeof(unsigned char)+sizeof(SLNet::Time));
4093 bitStream.Write((MessageID)ID_CONNECTED_PING);
4094 bitStream.Write(SLNet::GetTime());
4095 if (performImmediate)
4096 SendImmediate( (char*)bitStream.GetData(), bitStream.GetNumberOfBitsUsed(), IMMEDIATE_PRIORITY, reliability, 0, target, false, false, SLNet::GetTimeUS(), 0 );
4097 else
4098 Send( &bitStream, IMMEDIATE_PRIORITY, reliability, 0, target, false );
4099 }
4100 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4101 void RakPeer::CloseConnectionInternal( const AddressOrGUID& systemIdentifier, bool sendDisconnectionNotification, bool performImmediate, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority )
4102 {
4103 #ifdef _DEBUG
4104 RakAssert(orderingChannel < 32);
4105 #endif
4106
4107 if (systemIdentifier.IsUndefined())
4108 return;
4109
4110 if ( remoteSystemList == 0 || endThreads == true )
4111 return;
4112
4113 SystemAddress target;
4114 if (systemIdentifier.systemAddress!=UNASSIGNED_SYSTEM_ADDRESS)
4115 {
4116 target=systemIdentifier.systemAddress;
4117 }
4118 else
4119 {
4120 target=GetSystemAddressFromGuid(systemIdentifier.rakNetGuid);
4121 }
4122
4123 if (target!=UNASSIGNED_SYSTEM_ADDRESS && performImmediate)
4124 target.FixForIPVersion(socketList[0]->GetBoundAddress());
4125
4126 if (sendDisconnectionNotification)
4127 {
4128 NotifyAndFlagForShutdown(target, performImmediate, orderingChannel, disconnectionNotificationPriority);
4129 }
4130 else
4131 {
4132 if (performImmediate)
4133 {
4134 unsigned int index = GetRemoteSystemIndex(target);
4135 if (index!=(unsigned int) -1)
4136 {
4137 if ( remoteSystemList[index].isActive )
4138 {
4139 RemoveFromActiveSystemList(target);
4140
4141 // Found the index to stop
4142 // printf("--- Address %s has become inactive\n", remoteSystemList[index].systemAddress.ToString());
4143 remoteSystemList[index].isActive = false;
4144
4145 remoteSystemList[index].guid=UNASSIGNED_RAKNET_GUID;
4146
4147 // Reserve this reliability layer for ourselves
4148 //remoteSystemList[ remoteSystemLookup[index].index ].systemAddress = UNASSIGNED_SYSTEM_ADDRESS;
4149
4150 // Clear any remaining messages
4151 RakAssert(remoteSystemList[index].MTUSize <= MAXIMUM_MTU_SIZE);
4152 remoteSystemList[index].reliabilityLayer.Reset(false, remoteSystemList[index].MTUSize, false);
4153
4154 // Not using this socket
4155 remoteSystemList[index].rakNetSocket = 0;
4156 }
4157 }
4158 }
4159 else
4160 {
4161 BufferedCommandStruct *bcs;
4162 bcs=bufferedCommands.Allocate( _FILE_AND_LINE_ );
4163 bcs->command=BufferedCommandStruct::BCS_CLOSE_CONNECTION;
4164 bcs->systemIdentifier=target;
4165 bcs->data=0;
4166 bcs->orderingChannel=orderingChannel;
4167 bcs->priority=disconnectionNotificationPriority;
4168 bufferedCommands.Push(bcs);
4169 }
4170 }
4171 }
4172 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4173 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 )
4174 {
4175 BufferedCommandStruct *bcs;
4176
4177 bcs=bufferedCommands.Allocate( _FILE_AND_LINE_ );
4178 bcs->data = (char*) rakMalloc_Ex( (size_t) BITS_TO_BYTES(numberOfBitsToSend), _FILE_AND_LINE_ ); // Making a copy doesn't lose efficiency because I tell the reliability layer to use this allocation for its own copy
4179 if (bcs->data==0)
4180 {
4181 notifyOutOfMemory(_FILE_AND_LINE_);
4182 bufferedCommands.Deallocate(bcs, _FILE_AND_LINE_);
4183 return;
4184 }
4185
4186 RakAssert( !( reliability >= NUMBER_OF_RELIABILITIES || reliability < 0 ) );
4187 RakAssert( !( priority > NUMBER_OF_PRIORITIES || priority < 0 ) );
4188 RakAssert( !( orderingChannel >= NUMBER_OF_ORDERED_STREAMS ) );
4189
4190 memcpy(bcs->data, data, (size_t) BITS_TO_BYTES(numberOfBitsToSend));
4191 bcs->numberOfBitsToSend=numberOfBitsToSend;
4192 bcs->priority=priority;
4193 bcs->reliability=reliability;
4194 bcs->orderingChannel=orderingChannel;
4195 bcs->systemIdentifier=systemIdentifier;
4196 bcs->broadcast=broadcast;
4197 bcs->connectionMode=connectionMode;
4198 bcs->receipt=receipt;
4199 bcs->command=BufferedCommandStruct::BCS_SEND;
4200 bufferedCommands.Push(bcs);
4201
4202 if (priority==IMMEDIATE_PRIORITY)
4203 {
4204 // Forces pending sends to go out now, rather than waiting to the next update interval
4205 quitAndDataEvents.SetEvent();
4206 }
4207 }
4208 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4209 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 )
4210 {
4211 BufferedCommandStruct *bcs;
4212 unsigned int totalLength=0;
4213 unsigned int lengthOffset;
4214 int i;
4215 for (i=0; i < numParameters; i++)
4216 {
4217 if (lengths[i]>0)
4218 totalLength+=lengths[i];
4219 }
4220 if (totalLength==0)
4221 return;
4222
4223 char *dataAggregate;
4224 dataAggregate = (char*) rakMalloc_Ex( (size_t) totalLength, _FILE_AND_LINE_ ); // Making a copy doesn't lose efficiency because I tell the reliability layer to use this allocation for its own copy
4225 if (dataAggregate==0)
4226 {
4227 notifyOutOfMemory(_FILE_AND_LINE_);
4228 return;
4229 }
4230 for (i=0, lengthOffset=0; i < numParameters; i++)
4231 {
4232 if (lengths[i]>0)
4233 {
4234 memcpy(dataAggregate+lengthOffset, data[i], lengths[i]);
4235 lengthOffset+=lengths[i];
4236 }
4237 }
4238
4239 if (broadcast==false && IsLoopbackAddress(systemIdentifier,true))
4240 {
4241 SendLoopback(dataAggregate,totalLength);
4242 rakFree_Ex(dataAggregate,_FILE_AND_LINE_);
4243 return;
4244 }
4245
4246 RakAssert( !( reliability >= NUMBER_OF_RELIABILITIES || reliability < 0 ) );
4247 RakAssert( !( priority > NUMBER_OF_PRIORITIES || priority < 0 ) );
4248 RakAssert( !( orderingChannel >= NUMBER_OF_ORDERED_STREAMS ) );
4249
4250 bcs=bufferedCommands.Allocate( _FILE_AND_LINE_ );
4251 bcs->data = dataAggregate;
4252 bcs->numberOfBitsToSend=BYTES_TO_BITS(totalLength);
4253 bcs->priority=priority;
4254 bcs->reliability=reliability;
4255 bcs->orderingChannel=orderingChannel;
4256 bcs->systemIdentifier=systemIdentifier;
4257 bcs->broadcast=broadcast;
4258 bcs->connectionMode=connectionMode;
4259 bcs->receipt=receipt;
4260 bcs->command=BufferedCommandStruct::BCS_SEND;
4261 bufferedCommands.Push(bcs);
4262
4263 if (priority==IMMEDIATE_PRIORITY)
4264 {
4265 // Forces pending sends to go out now, rather than waiting to the next update interval
4266 quitAndDataEvents.SetEvent();
4267 }
4268 }
4269 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4270 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 )
4271 {
4272 unsigned *sendList;
4273 unsigned sendListSize;
4274 bool callerDataAllocationUsed;
4275 unsigned int remoteSystemIndex, sendListIndex; // Iterates into the list of remote systems
4276 // unsigned numberOfBytesUsed = (unsigned) BITS_TO_BYTES(numberOfBitsToSend);
4277 callerDataAllocationUsed=false;
4278
4279 sendListSize=0;
4280
4281 if (systemIdentifier.systemAddress!=UNASSIGNED_SYSTEM_ADDRESS)
4282 remoteSystemIndex=GetIndexFromSystemAddress( systemIdentifier.systemAddress, true );
4283 else if (systemIdentifier.rakNetGuid!=UNASSIGNED_RAKNET_GUID)
4284 remoteSystemIndex=GetSystemIndexFromGuid(systemIdentifier.rakNetGuid);
4285 else
4286 remoteSystemIndex=(unsigned int) -1;
4287
4288 // 03/06/06 - If broadcast is false, use the optimized version of GetIndexFromSystemAddress
4289 if (broadcast==false)
4290 {
4291 if (remoteSystemIndex==(unsigned int) -1)
4292 {
4293 #ifdef _DEBUG
4294 // int debugIndex = GetRemoteSystemIndex(systemIdentifier.systemAddress);
4295 #endif
4296 return false;
4297 }
4298
4299 #if USE_ALLOCA==1
4300 sendList=(unsigned *)alloca(sizeof(unsigned));
4301 #else
4302 sendList = (unsigned *) rakMalloc_Ex(sizeof(unsigned), _FILE_AND_LINE_);
4303 #endif
4304
4305 if (remoteSystemList[remoteSystemIndex].isActive &&
4306 remoteSystemList[remoteSystemIndex].connectMode!=RemoteSystemStruct::DISCONNECT_ASAP &&
4307 remoteSystemList[remoteSystemIndex].connectMode!=RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY &&
4308 remoteSystemList[remoteSystemIndex].connectMode!=RemoteSystemStruct::DISCONNECT_ON_NO_ACK)
4309 {
4310 sendList[0]=remoteSystemIndex;
4311 sendListSize=1;
4312 }
4313 }
4314 else
4315 {
4316 #if USE_ALLOCA==1
4317 sendList=(unsigned *)alloca(sizeof(unsigned)*maximumNumberOfPeers);
4318 #else
4319 sendList = (unsigned *) rakMalloc_Ex(sizeof(unsigned)*maximumNumberOfPeers, _FILE_AND_LINE_);
4320 #endif
4321
4322 // remoteSystemList in network thread
4323 unsigned int idx;
4324 for ( idx = 0; idx < maximumNumberOfPeers; idx++ )
4325 {
4326 if (remoteSystemIndex!=(unsigned int) -1 && idx==remoteSystemIndex)
4327 continue;
4328
4329 if ( remoteSystemList[ idx ].isActive && remoteSystemList[ idx ].systemAddress != UNASSIGNED_SYSTEM_ADDRESS )
4330 sendList[sendListSize++]=idx;
4331 }
4332 }
4333
4334 if (sendListSize==0)
4335 {
4336 #if !defined(USE_ALLOCA)
4337 rakFree_Ex(sendList, _FILE_AND_LINE_ );
4338 #endif
4339
4340 return false;
4341 }
4342
4343 for (sendListIndex=0; sendListIndex < sendListSize; sendListIndex++)
4344 {
4345 // Send may split the packet and thus deallocate data. Don't assume data is valid if we use the callerAllocationData
4346 bool useData = useCallerDataAllocation && callerDataAllocationUsed==false && sendListIndex+1==sendListSize;
4347 remoteSystemList[sendList[sendListIndex]].reliabilityLayer.Send( data, numberOfBitsToSend, priority, reliability, orderingChannel, useData==false, remoteSystemList[sendList[sendListIndex]].MTUSize, currentTime, receipt );
4348 if (useData)
4349 callerDataAllocationUsed=true;
4350
4351 if (reliability==RELIABLE ||
4352 reliability==RELIABLE_ORDERED ||
4353 reliability==RELIABLE_SEQUENCED ||
4354 reliability==RELIABLE_WITH_ACK_RECEIPT ||
4355 reliability==RELIABLE_ORDERED_WITH_ACK_RECEIPT
4356 // ||
4357 // reliability==RELIABLE_SEQUENCED_WITH_ACK_RECEIPT
4358 )
4359 remoteSystemList[sendList[sendListIndex]].lastReliableSend=(SLNet::TimeMS)(currentTime/(SLNet::TimeUS)1000);
4360 }
4361
4362 #if !defined(USE_ALLOCA)
4363 rakFree_Ex(sendList, _FILE_AND_LINE_ );
4364 #endif
4365
4366 // Return value only meaningful if true was passed for useCallerDataAllocation. Means the reliability layer used that data copy, so the caller should not deallocate it
4367 return callerDataAllocationUsed;
4368 }
4369 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4370 void RakPeer::ResetSendReceipt(void)
4371 {
4372 sendReceiptSerialMutex.Lock();
4373 sendReceiptSerial=1;
4374 sendReceiptSerialMutex.Unlock();
4375 }
4376 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4377 void RakPeer::OnConnectedPong(SLNet::Time sendPingTime, SLNet::Time sendPongTime, RemoteSystemStruct *remoteSystem)
4378 {
4379 SLNet::Time ping;
4380 // SLNet::TimeMS lastPing;
4381 SLNet::Time time = SLNet::GetTime(); // Update the time value to be accurate
4382 if (time > sendPingTime)
4383 ping = time - sendPingTime;
4384 else
4385 ping=0;
4386
4387 // lastPing = remoteSystem->pingAndClockDifferential[ remoteSystem->pingAndClockDifferentialWriteIndex ].pingTime;
4388
4389 remoteSystem->pingAndClockDifferential[ remoteSystem->pingAndClockDifferentialWriteIndex ].pingTime = ( unsigned short ) ping;
4390 // Thanks to Chris Taylor (cat02e@fsu.edu) for the improved timestamping algorithm
4391 // Divide each integer by 2, rather than the sum by 2, to prevent overflow
4392 remoteSystem->pingAndClockDifferential[ remoteSystem->pingAndClockDifferentialWriteIndex ].clockDifferential = sendPongTime - ( time/2 + sendPingTime/2 );
4393
4394 if ( remoteSystem->lowestPing == (unsigned short)-1 || remoteSystem->lowestPing > (int) ping )
4395 remoteSystem->lowestPing = (unsigned short) ping;
4396
4397 if ( ++( remoteSystem->pingAndClockDifferentialWriteIndex ) == (SLNet::Time) PING_TIMES_ARRAY_SIZE )
4398 remoteSystem->pingAndClockDifferentialWriteIndex = 0;
4399 }
4400 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4401 void RakPeer::ClearBufferedCommands(void)
4402 {
4403 BufferedCommandStruct *bcs;
4404
4405 while ((bcs=bufferedCommands.Pop())!=0)
4406 {
4407 if (bcs->data)
4408 rakFree_Ex(bcs->data, _FILE_AND_LINE_ );
4409
4410 bufferedCommands.Deallocate(bcs, _FILE_AND_LINE_);
4411 }
4412 bufferedCommands.Clear(_FILE_AND_LINE_);
4413 }
4414 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4415 void RakPeer::ClearSocketQueryOutput(void)
4416 {
4417 socketQueryOutput.Clear(_FILE_AND_LINE_);
4418 }
4419 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4420 void RakPeer::ClearRequestedConnectionList(void)
4421 {
4422 DataStructures::Queue<RequestedConnectionStruct*> freeQueue;
4423 requestedConnectionQueueMutex.Lock();
4424 while (requestedConnectionQueue.Size())
4425 freeQueue.Push(requestedConnectionQueue.Pop(), _FILE_AND_LINE_ );
4426 requestedConnectionQueueMutex.Unlock();
4427 unsigned i;
4428 for (i=0; i < freeQueue.Size(); i++)
4429 {
4430 #if LIBCAT_SECURITY==1
4431 CAT_AUDIT_PRINTF("AUDIT: In ClearRequestedConnectionList(), Deleting freeQueue index %i client_handshake %x\n", i, freeQueue[i]->client_handshake);
4432 SLNet::OP_DELETE(freeQueue[i]->client_handshake,_FILE_AND_LINE_);
4433 #endif
4434 SLNet::OP_DELETE(freeQueue[i], _FILE_AND_LINE_ );
4435 }
4436 }
4437 inline void RakPeer::AddPacketToProducer(SLNet::Packet *p)
4438 {
4439 packetReturnMutex.Lock();
4440 packetReturnQueue.Push(p,_FILE_AND_LINE_);
4441 packetReturnMutex.Unlock();
4442 }
4443 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4444 union Buff6AndBuff8
4445 {
4446 unsigned char buff6[6];
4447 uint64_t buff8;
4448 };
4449 uint64_t RakPeerInterface::Get64BitUniqueRandomNumber(void)
4450 {
4451 // Mac address is a poor solution because you can't have multiple connections from the same system
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482 #if defined(_WIN32)
4483 uint64_t g= SLNet::GetTimeUS();
4484
4485 SLNet::TimeUS lastTime, thisTime;
4486 int j;
4487 // Sleep a small random time, then use the last 4 bits as a source of randomness
4488 for (j=0; j < 8; j++)
4489 {
4490 lastTime = SLNet::GetTimeUS();
4491 RakSleep(1);
4492 RakSleep(0);
4493 thisTime = SLNet::GetTimeUS();
4494 SLNet::TimeUS diff = thisTime-lastTime;
4495 unsigned int diff4Bits = (unsigned int) (diff & 15);
4496 diff4Bits <<= 32-4;
4497 diff4Bits >>= j*4;
4498 ((char*)&g)[j] ^= diff4Bits;
4499 }
4500 return g;
4501
4502 #else
4503 struct timeval tv;
4504 gettimeofday(&tv, NULL);
4505 return tv.tv_usec + tv.tv_sec * 1000000;
4506 #endif
4507 }
4508 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4509 void RakPeer::GenerateGUID(void)
4510 {
4511 myGuid.g=Get64BitUniqueRandomNumber();
4512
4513 }
4514 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4515 // void SLNet::ProcessPortUnreachable( SystemAddress systemAddress, RakPeer *rakPeer )
4516 // {
4517 // (void) binaryAddress;
4518 // (void) port;
4519 // (void) rakPeer;
4520 //
4521 // }
4522 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4523 namespace SLNet {
4524 bool ProcessOfflineNetworkPacket( SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2* rakNetSocket, bool *isOfflineMessage, SLNet::TimeUS timeRead )
4525 {
4526 (void) timeRead;
4527 RakPeer::RemoteSystemStruct *remoteSystem;
4528 SLNet::Packet *packet;
4529 unsigned i;
4530
4531
4532 char str1[64];
4533 systemAddress.ToString(false, str1,static_cast<size_t>(64));
4534 if (rakPeer->IsBanned( str1 ))
4535 {
4536 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
4537 rakPeer->pluginListNTS[i]->OnDirectSocketReceive(data, length*8, systemAddress);
4538
4539 SLNet::BitStream bs;
4540 bs.Write((MessageID)ID_CONNECTION_BANNED);
4541 bs.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
4542 bs.Write(rakPeer->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS));
4543
4544
4545 RNS2_SendParameters bsp;
4546 bsp.data = (char*) bs.GetData();
4547 bsp.length = bs.GetNumberOfBytesUsed();
4548 bsp.systemAddress = systemAddress;
4549 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
4550 rakPeer->pluginListNTS[i]->OnDirectSocketSend((char*) bs.GetData(), bs.GetNumberOfBitsUsed(), systemAddress);
4551 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
4552
4553 /*
4554 unsigned i;
4555 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
4556 rakPeer->pluginListNTS[i]->OnDirectSocketSend((char*) bs.GetData(), bs.GetNumberOfBitsUsed(), systemAddress);
4557 SocketLayer::SendTo( rakNetSocket, (char*) bs.GetData(), bs.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
4558 */
4559
4560 return true;
4561 }
4562
4563
4564
4565 // The reason for all this is that the reliability layer has no way to tell between offline messages that arrived late for a player that is now connected,
4566 // and a regular encoding. So I insert OFFLINE_MESSAGE_DATA_ID into the stream, the encoding of which is essentially impossible to hit by chance
4567 if (length <=2)
4568 {
4569 *isOfflineMessage=true;
4570 }
4571 else if (
4572 ((unsigned char)data[0] == ID_UNCONNECTED_PING ||
4573 (unsigned char)data[0] == ID_UNCONNECTED_PING_OPEN_CONNECTIONS) &&
4574 length >= sizeof(unsigned char) + sizeof(SLNet::Time) + sizeof(OFFLINE_MESSAGE_DATA_ID))
4575 {
4576 *isOfflineMessage=memcmp(data+sizeof(unsigned char) + sizeof(SLNet::Time), OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID))==0;
4577 }
4578 else if ((unsigned char)data[0] == ID_UNCONNECTED_PONG && (size_t) length >= sizeof(unsigned char) + sizeof(SLNet::TimeMS) + RakNetGUID::size() + sizeof(OFFLINE_MESSAGE_DATA_ID))
4579 {
4580 *isOfflineMessage=memcmp(data+sizeof(unsigned char) + sizeof(SLNet::Time) + RakNetGUID::size(), OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID))==0;
4581 }
4582 else if (
4583 (unsigned char)data[0] == ID_OUT_OF_BAND_INTERNAL &&
4584 (size_t) length >= sizeof(MessageID) + RakNetGUID::size() + sizeof(OFFLINE_MESSAGE_DATA_ID))
4585 {
4586 *isOfflineMessage=memcmp(data+sizeof(MessageID) + RakNetGUID::size(), OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID))==0;
4587 }
4588 else if (
4589 (
4590 (unsigned char)data[0] == ID_OPEN_CONNECTION_REPLY_1 ||
4591 (unsigned char)data[0] == ID_OPEN_CONNECTION_REPLY_2 ||
4592 (unsigned char)data[0] == ID_OPEN_CONNECTION_REQUEST_1 ||
4593 (unsigned char)data[0] == ID_OPEN_CONNECTION_REQUEST_2 ||
4594 (unsigned char)data[0] == ID_CONNECTION_ATTEMPT_FAILED ||
4595 (unsigned char)data[0] == ID_NO_FREE_INCOMING_CONNECTIONS ||
4596 (unsigned char)data[0] == ID_CONNECTION_BANNED ||
4597 (unsigned char)data[0] == ID_ALREADY_CONNECTED ||
4598 (unsigned char)data[0] == ID_IP_RECENTLY_CONNECTED) &&
4599 (size_t) length >= sizeof(MessageID) + RakNetGUID::size() + sizeof(OFFLINE_MESSAGE_DATA_ID))
4600 {
4601 *isOfflineMessage=memcmp(data+sizeof(MessageID), OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID))==0;
4602 }
4603 else if (((unsigned char)data[0] == ID_INCOMPATIBLE_PROTOCOL_VERSION&&
4604 (size_t) length == sizeof(MessageID)*2 + RakNetGUID::size() + sizeof(OFFLINE_MESSAGE_DATA_ID)))
4605 {
4606 *isOfflineMessage=memcmp(data+sizeof(MessageID)*2, OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID))==0;
4607 }
4608 else
4609 {
4610 *isOfflineMessage=false;
4611 }
4612
4613 if (*isOfflineMessage)
4614 {
4615 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
4616 rakPeer->pluginListNTS[i]->OnDirectSocketReceive(data, length*8, systemAddress);
4617
4618 // These are all messages from unconnected systems. Messages here can be any size, but are never processed from connected systems.
4619 if ( ( (unsigned char) data[ 0 ] == ID_UNCONNECTED_PING_OPEN_CONNECTIONS
4620 || (unsigned char)(data)[0] == ID_UNCONNECTED_PING) && length >= sizeof(unsigned char)+sizeof(SLNet::Time)+sizeof(OFFLINE_MESSAGE_DATA_ID) )
4621 {
4622 if ( (unsigned char)(data)[0] == ID_UNCONNECTED_PING ||
4623 rakPeer->AllowIncomingConnections() ) // Open connections with players
4624 {
4625 SLNet::BitStream inBitStream( (unsigned char *) data, length, false );
4626 inBitStream.IgnoreBits(8);
4627 SLNet::Time sendPingTime;
4628 inBitStream.Read(sendPingTime);
4629 inBitStream.IgnoreBytes(sizeof(OFFLINE_MESSAGE_DATA_ID));
4630 RakNetGUID remoteGuid=UNASSIGNED_RAKNET_GUID;
4631 inBitStream.Read(remoteGuid);
4632
4633 SLNet::BitStream outBitStream;
4634 outBitStream.Write((MessageID)ID_UNCONNECTED_PONG); // Should be named ID_UNCONNECTED_PONG eventually
4635 outBitStream.Write(sendPingTime);
4636 outBitStream.Write(rakPeer->myGuid);
4637 outBitStream.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
4638
4639 rakPeer->rakPeerMutexes[ RakPeer::offlinePingResponse_Mutex ].Lock();
4640 // They are connected, so append offline ping data
4641 outBitStream.Write( (char*)rakPeer->offlinePingResponse.GetData(), rakPeer->offlinePingResponse.GetNumberOfBytesUsed() );
4642 rakPeer->rakPeerMutexes[ RakPeer::offlinePingResponse_Mutex ].Unlock();
4643
4644 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
4645 rakPeer->pluginListNTS[i]->OnDirectSocketSend((const char*)outBitStream.GetData(), outBitStream.GetNumberOfBytesUsed(), systemAddress);
4646
4647 RNS2_SendParameters bsp;
4648 bsp.data = (char*) outBitStream.GetData();
4649 bsp.length = outBitStream.GetNumberOfBytesUsed();
4650 bsp.systemAddress = systemAddress;
4651 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
4652
4653 // SocketLayer::SendTo( rakNetSocket, (const char*)outBitStream.GetData(), (unsigned int) outBitStream.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
4654
4655 packet=rakPeer->AllocPacket(sizeof(MessageID), _FILE_AND_LINE_);
4656 packet->data[0]=data[0];
4657 packet->systemAddress = systemAddress;
4658 packet->guid=remoteGuid;
4659 packet->systemAddress.systemIndex = ( SystemIndex ) rakPeer->GetIndexFromSystemAddress( systemAddress, true );
4660 packet->guid.systemIndex=packet->systemAddress.systemIndex;
4661 rakPeer->AddPacketToProducer(packet);
4662 }
4663 }
4664 // UNCONNECTED MESSAGE Pong with no data.
4665 else if ((unsigned char) data[ 0 ] == ID_UNCONNECTED_PONG && (size_t) length >= sizeof(unsigned char)+sizeof(SLNet::Time)+RakNetGUID::size()+sizeof(OFFLINE_MESSAGE_DATA_ID) && (size_t) length < sizeof(unsigned char)+sizeof(SLNet::Time)+RakNetGUID::size()+sizeof(OFFLINE_MESSAGE_DATA_ID)+MAX_OFFLINE_DATA_LENGTH)
4666 {
4667 packet=rakPeer->AllocPacket((unsigned int) (length-sizeof(OFFLINE_MESSAGE_DATA_ID)-RakNetGUID::size()-sizeof(SLNet::Time)+sizeof(SLNet::TimeMS)), _FILE_AND_LINE_);
4668 SLNet::BitStream bsIn((unsigned char*) data, length, false);
4669 bsIn.IgnoreBytes(sizeof(unsigned char));
4670 SLNet::Time ping;
4671 bsIn.Read(ping);
4672 bsIn.Read(packet->guid);
4673
4674 SLNet::BitStream bsOut((unsigned char*) packet->data, packet->length, false);
4675 bsOut.ResetWritePointer();
4676 bsOut.Write((unsigned char)ID_UNCONNECTED_PONG);
4677 SLNet::TimeMS pingMS=(SLNet::TimeMS)ping;
4678 bsOut.Write(pingMS);
4679 bsOut.WriteAlignedBytes(
4680 (const unsigned char*)data+sizeof(unsigned char)+sizeof(SLNet::Time)+RakNetGUID::size()+sizeof(OFFLINE_MESSAGE_DATA_ID),
4681 length-sizeof(unsigned char)-sizeof(SLNet::Time)-RakNetGUID::size()-sizeof(OFFLINE_MESSAGE_DATA_ID)
4682 );
4683
4684 packet->systemAddress = systemAddress;
4685 packet->systemAddress.systemIndex = ( SystemIndex ) rakPeer->GetIndexFromSystemAddress( systemAddress, true );
4686 packet->guid.systemIndex=packet->systemAddress.systemIndex;
4687 rakPeer->AddPacketToProducer(packet);
4688 }
4689 else if ((unsigned char) data[ 0 ] == ID_OUT_OF_BAND_INTERNAL &&
4690 (size_t) length > sizeof(OFFLINE_MESSAGE_DATA_ID)+sizeof(MessageID)+RakNetGUID::size() &&
4691 (size_t) length < MAX_OFFLINE_DATA_LENGTH+sizeof(OFFLINE_MESSAGE_DATA_ID)+sizeof(MessageID)+RakNetGUID::size())
4692 {
4693 unsigned int dataLength = (unsigned int) (length-sizeof(OFFLINE_MESSAGE_DATA_ID)-RakNetGUID::size()-sizeof(MessageID));
4694 RakAssert(dataLength<1024);
4695 packet=rakPeer->AllocPacket(dataLength+1, _FILE_AND_LINE_);
4696 RakAssert(packet->length<1024);
4697
4698 SLNet::BitStream bs2((unsigned char*) data, length, false);
4699 bs2.IgnoreBytes(sizeof(MessageID));
4700 bs2.Read(packet->guid);
4701
4702 if (data[sizeof(OFFLINE_MESSAGE_DATA_ID)+sizeof(MessageID) + RakNetGUID::size()]==ID_ADVERTISE_SYSTEM)
4703 {
4704 packet->length--;
4705 packet->bitSize=BYTES_TO_BITS(packet->length);
4706 packet->data[0]=ID_ADVERTISE_SYSTEM;
4707 memcpy(packet->data+1, data+sizeof(OFFLINE_MESSAGE_DATA_ID)+sizeof(MessageID)*2 + RakNetGUID::size(), dataLength-1);
4708 }
4709 else
4710 {
4711 packet->data[0]=ID_OUT_OF_BAND_INTERNAL;
4712 memcpy(packet->data+1, data+sizeof(OFFLINE_MESSAGE_DATA_ID)+sizeof(MessageID) + RakNetGUID::size(), dataLength);
4713 }
4714
4715 packet->systemAddress = systemAddress;
4716 packet->systemAddress.systemIndex = ( SystemIndex ) rakPeer->GetIndexFromSystemAddress( systemAddress, true );
4717 packet->guid.systemIndex=packet->systemAddress.systemIndex;
4718 rakPeer->AddPacketToProducer(packet);
4719 }
4720 else if ((unsigned char)(data)[0] == (MessageID)ID_OPEN_CONNECTION_REPLY_1)
4721 {
4722 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
4723 rakPeer->pluginListNTS[i]->OnDirectSocketReceive(data, length*8, systemAddress);
4724
4725 SLNet::BitStream bsIn((unsigned char*) data,length,false);
4726 bsIn.IgnoreBytes(sizeof(MessageID));
4727 bsIn.IgnoreBytes(sizeof(OFFLINE_MESSAGE_DATA_ID));
4728 RakNetGUID serverGuid;
4729 bsIn.Read(serverGuid);
4730 unsigned char serverHasSecurity;
4731 uint32_t cookie;
4732 (void) cookie;
4733 bsIn.Read(serverHasSecurity);
4734 // Even if the server has security, it may not be required of us if we are in the security exception list
4735 if (serverHasSecurity)
4736 {
4737 bsIn.Read(cookie);
4738 }
4739
4740 SLNet::BitStream bsOut;
4741 bsOut.Write((MessageID)ID_OPEN_CONNECTION_REQUEST_2);
4742 bsOut.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
4743 if (serverHasSecurity)
4744 bsOut.Write(cookie);
4745
4746 rakPeer->requestedConnectionQueueMutex.Lock();
4747 for (i=0; i < rakPeer->requestedConnectionQueue.Size(); i++)
4748 {
4749 RakPeer::RequestedConnectionStruct *rcs;
4750 rcs=rakPeer->requestedConnectionQueue[i];
4751 if (rcs->systemAddress==systemAddress)
4752 {
4753 if (serverHasSecurity)
4754 {
4755 #if LIBCAT_SECURITY==1
4756 unsigned char public_key[cat::EasyHandshake::PUBLIC_KEY_BYTES];
4757 bsIn.ReadAlignedBytes(public_key, sizeof(public_key));
4758
4759 if (rcs->publicKeyMode==PKM_ACCEPT_ANY_PUBLIC_KEY)
4760 {
4761 memcpy(rcs->remote_public_key, public_key, cat::EasyHandshake::PUBLIC_KEY_BYTES);
4762 if (!rcs->client_handshake->Initialize(public_key) ||
4763 !rcs->client_handshake->GenerateChallenge(rcs->handshakeChallenge))
4764 {
4765 CAT_AUDIT_PRINTF("AUDIT: Server passed a bad public key with PKM_ACCEPT_ANY_PUBLIC_KEY");
4766 rakPeer->requestedConnectionQueueMutex.Unlock();
4767 return true;
4768 }
4769 }
4770
4771 if (cat::SecureEqual(public_key,
4772 rcs->remote_public_key,
4773 cat::EasyHandshake::PUBLIC_KEY_BYTES)==false)
4774 {
4775 rakPeer->requestedConnectionQueueMutex.Unlock();
4776 CAT_AUDIT_PRINTF("AUDIT: Expected public key does not match what was sent by server -- Reporting back ID_PUBLIC_KEY_MISMATCH to user\n");
4777
4778 packet=rakPeer->AllocPacket(sizeof( char ), _FILE_AND_LINE_);
4779 packet->data[ 0 ] = ID_PUBLIC_KEY_MISMATCH; // Attempted a connection and couldn't
4780 packet->bitSize = ( sizeof( char ) * 8);
4781 packet->systemAddress = rcs->systemAddress;
4782 packet->guid=serverGuid;
4783 rakPeer->AddPacketToProducer(packet);
4784 return true;
4785 }
4786
4787 if (rcs->client_handshake==0)
4788 {
4789 // Message does not contain a challenge
4790 // We might still pass if we are in the security exception list
4791 bsOut.Write((unsigned char)0);
4792 }
4793 else
4794 {
4795 // Message contains a challenge
4796 bsOut.Write((unsigned char)1);
4797 // challenge
4798 CAT_AUDIT_PRINTF("AUDIT: Sending challenge\n");
4799 bsOut.WriteAlignedBytes((const unsigned char*) rcs->handshakeChallenge,cat::EasyHandshake::CHALLENGE_BYTES);
4800 }
4801 #else // LIBCAT_SECURITY
4802 // Message does not contain a challenge
4803 bsOut.Write((unsigned char)0);
4804 #endif // LIBCAT_SECURITY
4805 }
4806 else
4807 {
4808 // Server does not need security
4809 #if LIBCAT_SECURITY==1
4810 if (rcs->client_handshake!=0)
4811 {
4812 rakPeer->requestedConnectionQueueMutex.Unlock();
4813 CAT_AUDIT_PRINTF("AUDIT: Security disabled by server but we expected security (indicated by client_handshake not null) so failing!\n");
4814
4815 packet=rakPeer->AllocPacket(sizeof( char ), _FILE_AND_LINE_);
4816 packet->data[ 0 ] = ID_OUR_SYSTEM_REQUIRES_SECURITY; // Attempted a connection and couldn't
4817 packet->bitSize = ( sizeof( char ) * 8);
4818 packet->systemAddress = rcs->systemAddress;
4819 packet->guid=serverGuid;
4820 rakPeer->AddPacketToProducer(packet);
4821 return true;
4822 }
4823 #endif // LIBCAT_SECURITY
4824
4825 }
4826
4827 uint16_t mtu;
4828 bsIn.Read(mtu);
4829
4830 // Binding address
4831 bsOut.Write(rcs->systemAddress);
4832 rakPeer->requestedConnectionQueueMutex.Unlock();
4833 // MTU
4834 bsOut.Write(mtu);
4835 // Our guid
4836 bsOut.Write(rakPeer->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS));
4837
4838 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
4839 rakPeer->pluginListNTS[i]->OnDirectSocketSend((const char*) bsOut.GetData(), bsOut.GetNumberOfBitsUsed(), rcs->systemAddress);
4840
4841 // SocketLayer::SendTo( rakPeer->socketList[rcs->socketIndex], (const char*) bsOut.GetData(), bsOut.GetNumberOfBytesUsed(), rcs->systemAddress, _FILE_AND_LINE_ );
4842
4843 RNS2_SendParameters bsp;
4844 bsp.data = (char*) bsOut.GetData();
4845 bsp.length = bsOut.GetNumberOfBytesUsed();
4846 bsp.systemAddress = systemAddress;
4847 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
4848
4849 return true;
4850 }
4851 }
4852 rakPeer->requestedConnectionQueueMutex.Unlock();
4853 }
4854 else if ((unsigned char)(data)[0] == (MessageID)ID_OPEN_CONNECTION_REPLY_2)
4855 {
4856 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
4857 rakPeer->pluginListNTS[i]->OnDirectSocketReceive(data, length*8, systemAddress);
4858
4859 SLNet::BitStream bs((unsigned char*) data,length,false);
4860 bs.IgnoreBytes(sizeof(MessageID));
4861 bs.IgnoreBytes(sizeof(OFFLINE_MESSAGE_DATA_ID));
4862 RakNetGUID guid;
4863 bs.Read(guid);
4864 SystemAddress bindingAddress;
4865 bool b = bs.Read(bindingAddress);
4866 RakAssert(b);
4867 uint16_t mtu;
4868 b=bs.Read(mtu);
4869 RakAssert(b);
4870 bool doSecurity=false;
4871 b=bs.Read(doSecurity);
4872 RakAssert(b);
4873
4874 #if LIBCAT_SECURITY==1
4875 char answer[cat::EasyHandshake::ANSWER_BYTES];
4876 CAT_AUDIT_PRINTF("AUDIT: Got ID_OPEN_CONNECTION_REPLY_2 and given doSecurity=%i\n", (int)doSecurity);
4877 if (doSecurity)
4878 {
4879 CAT_AUDIT_PRINTF("AUDIT: Reading cookie and public key\n");
4880 bs.ReadAlignedBytes((unsigned char*) answer, sizeof(answer));
4881 }
4882 cat::ClientEasyHandshake *client_handshake=0;
4883 #endif // LIBCAT_SECURITY
4884
4885 RakPeer::RequestedConnectionStruct *rcs;
4886 bool unlock=true;
4887 rakPeer->requestedConnectionQueueMutex.Lock();
4888 for (i=0; i < rakPeer->requestedConnectionQueue.Size(); i++)
4889 {
4890 rcs=rakPeer->requestedConnectionQueue[i];
4891
4892
4893 if (rcs->systemAddress==systemAddress)
4894 {
4895 #if LIBCAT_SECURITY==1
4896 CAT_AUDIT_PRINTF("AUDIT: System address matches an entry in the requestedConnectionQueue and doSecurity=%i\n", (int)doSecurity);
4897 if (doSecurity)
4898 {
4899 if (rcs->client_handshake==0)
4900 {
4901 CAT_AUDIT_PRINTF("AUDIT: Server wants security but we didn't set a public key -- Reporting back ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY to user\n");
4902 rakPeer->requestedConnectionQueueMutex.Unlock();
4903
4904 packet=rakPeer->AllocPacket(2, _FILE_AND_LINE_);
4905 packet->data[ 0 ] = ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY; // Attempted a connection and couldn't
4906 packet->data[ 1 ] = 0; // Indicate server public key is missing
4907 packet->bitSize = ( sizeof( char ) * 8);
4908 packet->systemAddress = rcs->systemAddress;
4909 packet->guid=guid;
4910 rakPeer->AddPacketToProducer(packet);
4911 return true;
4912 }
4913
4914 CAT_AUDIT_PRINTF("AUDIT: Looks good, preparing to send challenge to server! client_handshake = %x\n", client_handshake);
4915 }
4916
4917 #endif // LIBCAT_SECURITY
4918
4919 rakPeer->requestedConnectionQueueMutex.Unlock();
4920 unlock=false;
4921
4922 RakAssert(rcs->actionToTake==RakPeer::RequestedConnectionStruct::CONNECT);
4923 // You might get this when already connected because of cross-connections
4924 bool thisIPConnectedRecently=false;
4925 remoteSystem=rakPeer->GetRemoteSystemFromSystemAddress( systemAddress, true, true );
4926 if (remoteSystem==0)
4927 {
4928 if (rcs->socket == 0)
4929 {
4930 remoteSystem=rakPeer->AssignSystemAddressToRemoteSystemList(systemAddress, RakPeer::RemoteSystemStruct::UNVERIFIED_SENDER, rakNetSocket, &thisIPConnectedRecently, bindingAddress, mtu, guid, doSecurity);
4931 }
4932 else
4933 {
4934 remoteSystem=rakPeer->AssignSystemAddressToRemoteSystemList(systemAddress, RakPeer::RemoteSystemStruct::UNVERIFIED_SENDER, rcs->socket, &thisIPConnectedRecently, bindingAddress, mtu, guid, doSecurity);
4935 }
4936 }
4937
4938 // 4/13/09 Attackers can flood ID_OPEN_CONNECTION_REQUEST and use up all available connection slots
4939 // Ignore connection attempts if this IP address connected within the last 100 milliseconds
4940 if (thisIPConnectedRecently==false)
4941 {
4942 // Don't check GetRemoteSystemFromGUID, server will verify
4943 if (remoteSystem)
4944 {
4945 // Move pointer from RequestedConnectionStruct to RemoteSystemStruct
4946 #if LIBCAT_SECURITY==1
4947 cat::u8 ident[cat::EasyHandshake::IDENTITY_BYTES];
4948 bool doIdentity = false;
4949
4950 if (rcs->client_handshake)
4951 {
4952 CAT_AUDIT_PRINTF("AUDIT: Processing answer\n");
4953 if (rcs->publicKeyMode == PKM_USE_TWO_WAY_AUTHENTICATION)
4954 {
4955 if (!rcs->client_handshake->ProcessAnswerWithIdentity(answer, ident, remoteSystem->reliabilityLayer.GetAuthenticatedEncryption()))
4956 {
4957 CAT_AUDIT_PRINTF("AUDIT: Processing answer -- Invalid Answer\n");
4958 return true;
4959 }
4960
4961 doIdentity = true;
4962 }
4963 else
4964 {
4965 if (!rcs->client_handshake->ProcessAnswer(answer, remoteSystem->reliabilityLayer.GetAuthenticatedEncryption()))
4966 {
4967 CAT_AUDIT_PRINTF("AUDIT: Processing answer -- Invalid Answer\n");
4968 return true;
4969 }
4970 }
4971 CAT_AUDIT_PRINTF("AUDIT: Success!\n");
4972
4973 SLNet::OP_DELETE(rcs->client_handshake,_FILE_AND_LINE_);
4974 rcs->client_handshake=0;
4975 }
4976 #endif // LIBCAT_SECURITY
4977
4978 remoteSystem->weInitiatedTheConnection=true;
4979 remoteSystem->connectMode=RakPeer::RemoteSystemStruct::REQUESTED_CONNECTION;
4980 if (rcs->timeoutTime!=0)
4981 remoteSystem->reliabilityLayer.SetTimeoutTime(rcs->timeoutTime);
4982
4983 SLNet::BitStream temp;
4984 temp.Write( (MessageID)ID_CONNECTION_REQUEST);
4985 temp.Write(rakPeer->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS));
4986 temp.Write(SLNet::GetTime());
4987
4988 #if LIBCAT_SECURITY==1
4989 temp.Write((unsigned char)(doSecurity ? 1 : 0));
4990
4991 if (doSecurity)
4992 {
4993 unsigned char proof[32];
4994 remoteSystem->reliabilityLayer.GetAuthenticatedEncryption()->GenerateProof(proof, sizeof(proof));
4995 temp.WriteAlignedBytes(proof, sizeof(proof));
4996
4997 temp.Write((unsigned char)(doIdentity ? 1 : 0));
4998
4999 if (doIdentity)
5000 {
5001 temp.WriteAlignedBytes(ident, sizeof(ident));
5002 }
5003 }
5004 #else
5005 temp.Write((unsigned char)0);
5006 #endif // LIBCAT_SECURITY
5007
5008 if ( rcs->outgoingPasswordLength > 0 )
5009 temp.Write( ( char* ) rcs->outgoingPassword, rcs->outgoingPasswordLength );
5010
5011 rakPeer->SendImmediate((char*)temp.GetData(), temp.GetNumberOfBitsUsed(), IMMEDIATE_PRIORITY, RELIABLE, 0, systemAddress, false, false, timeRead, 0 );
5012 }
5013 else
5014 {
5015 // Failed, no connections available anymore
5016 packet=rakPeer->AllocPacket(sizeof( char ), _FILE_AND_LINE_);
5017 packet->data[ 0 ] = ID_CONNECTION_ATTEMPT_FAILED; // Attempted a connection and couldn't
5018 packet->bitSize = ( sizeof( char ) * 8);
5019 packet->systemAddress = rcs->systemAddress;
5020 packet->guid=guid;
5021 rakPeer->AddPacketToProducer(packet);
5022 }
5023 }
5024
5025 rakPeer->requestedConnectionQueueMutex.Lock();
5026 for (unsigned int k=0; k < rakPeer->requestedConnectionQueue.Size(); k++)
5027 {
5028 if (rakPeer->requestedConnectionQueue[k]->systemAddress==systemAddress)
5029 {
5030 rakPeer->requestedConnectionQueue.RemoveAtIndex(k);
5031 break;
5032 }
5033 }
5034 rakPeer->requestedConnectionQueueMutex.Unlock();
5035
5036 #if LIBCAT_SECURITY==1
5037 CAT_AUDIT_PRINTF("AUDIT: Deleting client_handshake object %x and rcs->client_handshake object %x\n", client_handshake, rcs->client_handshake);
5038 SLNet::OP_DELETE(client_handshake,_FILE_AND_LINE_);
5039 SLNet::OP_DELETE(rcs->client_handshake,_FILE_AND_LINE_);
5040 #endif // LIBCAT_SECURITY
5041 SLNet::OP_DELETE(rcs,_FILE_AND_LINE_);
5042
5043 break;
5044 }
5045 }
5046
5047 if (unlock)
5048 rakPeer->requestedConnectionQueueMutex.Unlock();
5049
5050 return true;
5051
5052 }
5053 else if ((unsigned char)(data)[0] == (MessageID)ID_CONNECTION_ATTEMPT_FAILED ||
5054 (unsigned char)(data)[0] == (MessageID)ID_NO_FREE_INCOMING_CONNECTIONS ||
5055 (unsigned char)(data)[0] == (MessageID)ID_CONNECTION_BANNED ||
5056 (unsigned char)(data)[0] == (MessageID)ID_ALREADY_CONNECTED ||
5057 (unsigned char)(data)[0] == (MessageID)ID_INVALID_PASSWORD ||
5058 (unsigned char)(data)[0] == (MessageID)ID_IP_RECENTLY_CONNECTED ||
5059 (unsigned char)(data)[0] == (MessageID)ID_INCOMPATIBLE_PROTOCOL_VERSION)
5060 {
5061
5062 SLNet::BitStream bs((unsigned char*) data,length,false);
5063 bs.IgnoreBytes(sizeof(MessageID));
5064 bs.IgnoreBytes(sizeof(OFFLINE_MESSAGE_DATA_ID));
5065 if ((unsigned char)(data)[0] == (MessageID)ID_INCOMPATIBLE_PROTOCOL_VERSION)
5066 bs.IgnoreBytes(sizeof(unsigned char));
5067
5068 RakNetGUID guid;
5069 bs.Read(guid);
5070
5071 RakPeer::RequestedConnectionStruct *rcs;
5072 bool connectionAttemptCancelled=false;
5073 rakPeer->requestedConnectionQueueMutex.Lock();
5074 for (i=0; i < rakPeer->requestedConnectionQueue.Size(); i++)
5075 {
5076 rcs=rakPeer->requestedConnectionQueue[i];
5077 if (rcs->actionToTake==RakPeer::RequestedConnectionStruct::CONNECT && rcs->systemAddress==systemAddress)
5078 {
5079 connectionAttemptCancelled=true;
5080 rakPeer->requestedConnectionQueue.RemoveAtIndex(i);
5081
5082 #if LIBCAT_SECURITY==1
5083 CAT_AUDIT_PRINTF("AUDIT: Connection attempt canceled so deleting rcs->client_handshake object %x\n", rcs->client_handshake);
5084 SLNet::OP_DELETE(rcs->client_handshake,_FILE_AND_LINE_);
5085 #endif // LIBCAT_SECURITY
5086 SLNet::OP_DELETE(rcs,_FILE_AND_LINE_);
5087 break;
5088 }
5089 }
5090
5091 rakPeer->requestedConnectionQueueMutex.Unlock();
5092
5093 if (connectionAttemptCancelled)
5094 {
5095 // Tell user of connection attempt failed
5096 packet=rakPeer->AllocPacket(sizeof( char ), _FILE_AND_LINE_);
5097 packet->data[ 0 ] = data[0]; // Attempted a connection and couldn't
5098 packet->bitSize = ( sizeof( char ) * 8);
5099 packet->systemAddress = systemAddress;
5100 packet->guid=guid;
5101 rakPeer->AddPacketToProducer(packet);
5102 }
5103 }
5104 else if ((unsigned char)(data)[0] == ID_OPEN_CONNECTION_REQUEST_1 && length > (int) (1+sizeof(OFFLINE_MESSAGE_DATA_ID)))
5105 {/*
5106 static int x = 0;
5107 ++x;
5108
5109 SystemAddress *addr = (SystemAddress*)&systemAddress;
5110 addr->binaryAddress += x;*/
5111
5112 //RAKNET_DEBUG_PRINTF("%i:IOCR, ", __LINE__);
5113 char remoteProtocol=data[1+sizeof(OFFLINE_MESSAGE_DATA_ID)];
5114 if (remoteProtocol!=RAKNET_PROTOCOL_VERSION)
5115 {
5116 SLNet::BitStream bs;
5117 bs.Write((MessageID)ID_INCOMPATIBLE_PROTOCOL_VERSION);
5118 bs.Write((unsigned char)RAKNET_PROTOCOL_VERSION);
5119 bs.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
5120 bs.Write(rakPeer->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS));
5121
5122 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
5123 rakPeer->pluginListNTS[i]->OnDirectSocketSend((char*)bs.GetData(), bs.GetNumberOfBitsUsed(), systemAddress);
5124
5125 // SocketLayer::SendTo( rakNetSocket, (char*)bs.GetData(), bs.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
5126
5127 RNS2_SendParameters bsp;
5128 bsp.data = (char*) bs.GetData();
5129 bsp.length = bs.GetNumberOfBytesUsed();
5130 bsp.systemAddress = systemAddress;
5131
5132 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
5133 return true;
5134 }
5135
5136 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
5137 rakPeer->pluginListNTS[i]->OnDirectSocketReceive(data, length*8, systemAddress);
5138
5139 SLNet::BitStream bsOut;
5140 bsOut.Write((MessageID)ID_OPEN_CONNECTION_REPLY_1);
5141 bsOut.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
5142 bsOut.Write(rakPeer->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS));
5143 #if LIBCAT_SECURITY==1
5144 if (rakPeer->_using_security)
5145 {
5146 bsOut.Write((unsigned char) 1); // HasCookie Yes
5147 // Write cookie
5148 uint32_t cookie = rakPeer->_cookie_jar->Generate(&systemAddress.address,sizeof(systemAddress.address));
5149 CAT_AUDIT_PRINTF("AUDIT: Writing cookie %i to %i:%i\n", cookie, systemAddress);
5150 bsOut.Write(cookie);
5151 // Write my public key
5152 bsOut.WriteAlignedBytes((const unsigned char *) rakPeer->my_public_key,sizeof(rakPeer->my_public_key));
5153 }
5154 else
5155 #endif // LIBCAT_SECURITY
5156 bsOut.Write((unsigned char) 0); // HasCookie oN
5157
5158 // MTU. Lower MTU if it is exceeds our own limit
5159 if (length+UDP_HEADER_SIZE > MAXIMUM_MTU_SIZE)
5160 bsOut.WriteCasted<uint16_t>(MAXIMUM_MTU_SIZE);
5161 else
5162 bsOut.WriteCasted<uint16_t>(length+UDP_HEADER_SIZE);
5163
5164 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
5165 rakPeer->pluginListNTS[i]->OnDirectSocketSend((const char*) bsOut.GetData(), bsOut.GetNumberOfBitsUsed(), systemAddress);
5166 // SocketLayer::SendTo( rakNetSocket, (const char*) bsOut.GetData(), bsOut.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
5167
5168 RNS2_SendParameters bsp;
5169 bsp.data = (char*) bsOut.GetData();
5170 bsp.length = bsOut.GetNumberOfBytesUsed();
5171 bsp.systemAddress = systemAddress;
5172 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
5173 }
5174 else if ((unsigned char)(data)[0] == ID_OPEN_CONNECTION_REQUEST_2)
5175 {
5176 SystemAddress bindingAddress;
5177 RakNetGUID guid;
5178 SLNet::BitStream bsOut;
5179 SLNet::BitStream bs((unsigned char*) data, length, false);
5180 bs.IgnoreBytes(sizeof(MessageID));
5181 bs.IgnoreBytes(sizeof(OFFLINE_MESSAGE_DATA_ID));
5182
5183 bool requiresSecurityOfThisClient=false;
5184 #if LIBCAT_SECURITY==1
5185 char remoteHandshakeChallenge[cat::EasyHandshake::CHALLENGE_BYTES];
5186
5187 if (rakPeer->_using_security)
5188 {
5189 systemAddress.ToString(false, str1, static_cast<size_t>(64));
5190 requiresSecurityOfThisClient=rakPeer->IsInSecurityExceptionList(str1)==false;
5191
5192 uint32_t cookie;
5193 bs.Read(cookie);
5194 CAT_AUDIT_PRINTF("AUDIT: Got cookie %i from %i:%i\n", cookie, systemAddress);
5195 if (rakPeer->_cookie_jar->Verify(&systemAddress.address,sizeof(systemAddress.address), cookie)==false)
5196 {
5197 return true;
5198 }
5199 CAT_AUDIT_PRINTF("AUDIT: Cookie good!\n");
5200
5201 unsigned char clientWroteChallenge;
5202 bs.Read(clientWroteChallenge);
5203
5204 if (requiresSecurityOfThisClient==true && clientWroteChallenge==0)
5205 {
5206 // Fail, client doesn't support security, and it is required
5207 return true;
5208 }
5209
5210 if (clientWroteChallenge)
5211 {
5212 bs.ReadAlignedBytes((unsigned char*) remoteHandshakeChallenge, cat::EasyHandshake::CHALLENGE_BYTES);
5213 #ifdef CAT_AUDIT
5214 printf("AUDIT: RECV CHALLENGE ");
5215 for (int ii = 0; ii < sizeof(remoteHandshakeChallenge); ++ii)
5216 {
5217 printf("%02x", (cat::u8)remoteHandshakeChallenge[ii]);
5218 }
5219 printf("\n");
5220 #endif
5221 }
5222 }
5223 #endif // LIBCAT_SECURITY
5224
5225 bs.Read(bindingAddress);
5226 uint16_t mtu;
5227 bs.Read(mtu);
5228 bs.Read(guid);
5229
5230 RakPeer::RemoteSystemStruct *rssFromSA = rakPeer->GetRemoteSystemFromSystemAddress( systemAddress, true, true );
5231 bool IPAddrInUse = rssFromSA != 0 && rssFromSA->isActive;
5232 RakPeer::RemoteSystemStruct *rssFromGuid = rakPeer->GetRemoteSystemFromGUID(guid, true);
5233 bool GUIDInUse = rssFromGuid != 0 && rssFromGuid->isActive;
5234
5235 // IPAddrInUse, GuidInUse, outcome
5236 // TRUE, , TRUE , ID_OPEN_CONNECTION_REPLY if they are the same, else ID_ALREADY_CONNECTED
5237 // FALSE, , TRUE , ID_ALREADY_CONNECTED (someone else took this guid)
5238 // TRUE, , FALSE , ID_ALREADY_CONNECTED (silently disconnected, restarted rakNet)
5239 // FALSE , FALSE , Allow connection
5240
5241 int outcome;
5242 if (IPAddrInUse & GUIDInUse)
5243 {
5244 if (rssFromSA==rssFromGuid && rssFromSA->connectMode==RakPeer::RemoteSystemStruct::UNVERIFIED_SENDER)
5245 {
5246 // ID_OPEN_CONNECTION_REPLY if they are the same
5247 outcome=1;
5248
5249 // Note to self: If REQUESTED_CONNECTION, this means two systems attempted to connect to each other at the same time, and one finished first.
5250 // Returns ID)_CONNECTION_REQUEST_ACCEPTED to one system, and ID_ALREADY_CONNECTED followed by ID_NEW_INCOMING_CONNECTION to another
5251 }
5252 else
5253 {
5254 // ID_ALREADY_CONNECTED (restarted raknet, connected again from same ip, plus someone else took this guid)
5255 outcome=2;
5256 }
5257 }
5258 else if (IPAddrInUse==false && GUIDInUse==true)
5259 {
5260 // ID_ALREADY_CONNECTED (someone else took this guid)
5261 outcome=3;
5262 }
5263 else if (IPAddrInUse==true && GUIDInUse==false)
5264 {
5265 // ID_ALREADY_CONNECTED (silently disconnected, restarted rakNet)
5266 outcome=4;
5267 }
5268 else
5269 {
5270 // Allow connection
5271 outcome=0;
5272 }
5273
5274 SLNet::BitStream bsAnswer;
5275 bsAnswer.Write((MessageID)ID_OPEN_CONNECTION_REPLY_2);
5276 bsAnswer.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
5277 bsAnswer.Write(rakPeer->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS));
5278 bsAnswer.Write(systemAddress);
5279 bsAnswer.Write(mtu);
5280 bsAnswer.Write(requiresSecurityOfThisClient);
5281
5282 if (outcome==1)
5283 {
5284 // Duplicate connection request packet from packetloss
5285 // Send back the same answer
5286 #if LIBCAT_SECURITY==1
5287 if (requiresSecurityOfThisClient)
5288 {
5289 CAT_AUDIT_PRINTF("AUDIT: Resending public key and answer from packetloss. Sending ID_OPEN_CONNECTION_REPLY_2\n");
5290 bsAnswer.WriteAlignedBytes((const unsigned char *) rssFromSA->answer,sizeof(rssFromSA->answer));
5291 }
5292 #endif // LIBCAT_SECURITY
5293
5294 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
5295 rakPeer->pluginListNTS[i]->OnDirectSocketSend((const char*) bsAnswer.GetData(), bsAnswer.GetNumberOfBitsUsed(), systemAddress);
5296 // SocketLayer::SendTo( rakNetSocket, (const char*) bsAnswer.GetData(), bsAnswer.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
5297
5298 RNS2_SendParameters bsp;
5299 bsp.data = (char*) bsAnswer.GetData();
5300 bsp.length = bsAnswer.GetNumberOfBytesUsed();
5301 bsp.systemAddress = systemAddress;
5302 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
5303
5304 return true;
5305 }
5306 else if (outcome!=0)
5307 {
5308 bsOut.Write((MessageID)ID_ALREADY_CONNECTED);
5309 bsOut.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
5310 bsOut.Write(rakPeer->myGuid);
5311 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
5312 rakPeer->pluginListNTS[i]->OnDirectSocketSend((const char*) bsOut.GetData(), bsOut.GetNumberOfBitsUsed(), systemAddress);
5313 // SocketLayer::SendTo( rakNetSocket, (const char*) bsOut.GetData(), bsOut.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
5314 RNS2_SendParameters bsp;
5315 bsp.data = (char*) bsOut.GetData();
5316 bsp.length = bsOut.GetNumberOfBytesUsed();
5317 bsp.systemAddress = systemAddress;
5318 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
5319
5320 return true;
5321 }
5322
5323 if (rakPeer->AllowIncomingConnections()==false)
5324 {
5325 bsOut.Write((MessageID)ID_NO_FREE_INCOMING_CONNECTIONS);
5326 bsOut.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
5327 bsOut.Write(rakPeer->myGuid);
5328 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
5329 rakPeer->pluginListNTS[i]->OnDirectSocketSend((const char*) bsOut.GetData(), bsOut.GetNumberOfBitsUsed(), systemAddress);
5330 //SocketLayer::SendTo( rakNetSocket, (const char*) bsOut.GetData(), bsOut.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
5331 RNS2_SendParameters bsp;
5332 bsp.data = (char*) bsOut.GetData();
5333 bsp.length = bsOut.GetNumberOfBytesUsed();
5334 bsp.systemAddress = systemAddress;
5335 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
5336
5337 return true;
5338 }
5339
5340 bool thisIPConnectedRecently=false;
5341 rssFromSA = rakPeer->AssignSystemAddressToRemoteSystemList(systemAddress, RakPeer::RemoteSystemStruct::UNVERIFIED_SENDER, rakNetSocket, &thisIPConnectedRecently, bindingAddress, mtu, guid, requiresSecurityOfThisClient);
5342
5343 if (thisIPConnectedRecently==true)
5344 {
5345 bsOut.Write((MessageID)ID_IP_RECENTLY_CONNECTED);
5346 bsOut.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
5347 bsOut.Write(rakPeer->myGuid);
5348 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
5349 rakPeer->pluginListNTS[i]->OnDirectSocketSend((const char*) bsOut.GetData(), bsOut.GetNumberOfBitsUsed(), systemAddress);
5350 //SocketLayer::SendTo( rakNetSocket, (const char*) bsOut.GetData(), bsOut.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
5351
5352 RNS2_SendParameters bsp;
5353 bsp.data = (char*) bsOut.GetData();
5354 bsp.length = bsOut.GetNumberOfBytesUsed();
5355 bsp.systemAddress = systemAddress;
5356 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
5357
5358 return true;
5359 }
5360
5361 #if LIBCAT_SECURITY==1
5362 if (requiresSecurityOfThisClient)
5363 {
5364 CAT_AUDIT_PRINTF("AUDIT: Writing public key. Sending ID_OPEN_CONNECTION_REPLY_2\n");
5365 if (rakPeer->_server_handshake->ProcessChallenge(remoteHandshakeChallenge, rssFromSA->answer, rssFromSA->reliabilityLayer.GetAuthenticatedEncryption() ))
5366 {
5367 CAT_AUDIT_PRINTF("AUDIT: Challenge good!\n");
5368 // Keep going to OK block
5369 }
5370 else
5371 {
5372 CAT_AUDIT_PRINTF("AUDIT: Challenge BAD!\n");
5373
5374 // Unassign this remote system
5375 rakPeer->DereferenceRemoteSystem(systemAddress);
5376 return true;
5377 }
5378
5379 bsAnswer.WriteAlignedBytes((const unsigned char *) rssFromSA->answer,sizeof(rssFromSA->answer));
5380 }
5381 #endif // LIBCAT_SECURITY
5382
5383 for (i=0; i < rakPeer->pluginListNTS.Size(); i++)
5384 rakPeer->pluginListNTS[i]->OnDirectSocketSend((const char*) bsAnswer.GetData(), bsAnswer.GetNumberOfBitsUsed(), systemAddress);
5385 // SocketLayer::SendTo( rakNetSocket, (const char*) bsAnswer.GetData(), bsAnswer.GetNumberOfBytesUsed(), systemAddress, _FILE_AND_LINE_ );
5386 RNS2_SendParameters bsp;
5387 bsp.data = (char*) bsAnswer.GetData();
5388 bsp.length = bsAnswer.GetNumberOfBytesUsed();
5389 bsp.systemAddress = systemAddress;
5390 rakNetSocket->Send(&bsp, _FILE_AND_LINE_);
5391 }
5392 return true;
5393 }
5394
5395 return false;
5396 }
5397 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5398 void ProcessNetworkPacket( SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, SLNet::TimeUS timeRead, BitStream &updateBitStream )
5399 {
5400 ProcessNetworkPacket(systemAddress,data,length,rakPeer,rakPeer->socketList[0],timeRead, updateBitStream);
5401 }
5402 void ProcessNetworkPacket( SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2* rakNetSocket, SLNet::TimeUS timeRead, BitStream &updateBitStream )
5403 {
5404 #if LIBCAT_SECURITY==1
5405 #ifdef CAT_AUDIT
5406 printf("AUDIT: RECV ");
5407 for (int ii = 0; ii < length; ++ii)
5408 {
5409 printf("%02x", (cat::u8)data[ii]);
5410 }
5411 printf("\n");
5412 #endif
5413 #endif // LIBCAT_SECURITY
5414
5415 RakAssert(systemAddress.GetPort());
5416 bool isOfflineMessage;
5417 if (ProcessOfflineNetworkPacket(systemAddress, data, length, rakPeer, rakNetSocket, &isOfflineMessage, timeRead))
5418 {
5419 return;
5420 }
5421
5422 // SLNet::Packet *packet;
5423 RakPeer::RemoteSystemStruct *remoteSystem;
5424
5425 // See if this datagram came from a connected system
5426 remoteSystem = rakPeer->GetRemoteSystemFromSystemAddress( systemAddress, true, true );
5427 if ( remoteSystem )
5428 {
5429 // Handle regular incoming data
5430 // HandleSocketReceiveFromConnectedPlayer is only safe to be called from the same thread as Update, which is this thread
5431 if ( isOfflineMessage==false)
5432 {
5433 remoteSystem->reliabilityLayer.HandleSocketReceiveFromConnectedPlayer(
5434 data, length, systemAddress, rakPeer->pluginListNTS, remoteSystem->MTUSize,
5435 rakNetSocket, &rnr, timeRead, updateBitStream);
5436 }
5437 }
5438 else
5439 {
5440 // int a=5;
5441 // printf("--- Packet from unknown system %s\n", systemAddress.ToString());
5442 }
5443 }
5444
5445 }
5446 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5447 unsigned int RakPeer::GenerateSeedFromGuid(void)
5448 {
5449 /*
5450 // Construct a random seed based on the initial guid value, and the last digits of the difference to each subsequent number
5451 // This assumes that only the last 3 bits of each guidId integer has a meaningful amount of randomness between it and the prior number
5452 unsigned int t = guid.g[0];
5453 unsigned int i;
5454 for (i=1; i < sizeof(guid.g) / sizeof(guid.g[0]); i++)
5455 {
5456 unsigned int diff = guid.g[i]-guid.g[i-1];
5457 unsigned int diff3Bits = diff & 0x0007;
5458 diff3Bits <<= 29;
5459 diff3Bits >>= (i-1)*3;
5460 t ^= diff3Bits;
5461 }
5462
5463 return t;
5464 */
5465 return (unsigned int) ((myGuid.g >> 32) ^ myGuid.g);
5466 }
5467 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5468 void RakPeer::DerefAllSockets(void)
5469 {
5470 unsigned int i;
5471 for (i=0; i < socketList.Size(); i++)
5472 {
5473 SLNet::OP_DELETE(socketList[i], _FILE_AND_LINE_);
5474 }
5475 socketList.Clear(false, _FILE_AND_LINE_);
5476 }
5477 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5478 unsigned int RakPeer::GetRakNetSocketFromUserConnectionSocketIndex(unsigned int userIndex) const
5479 {
5480 unsigned int i;
5481 for (i=0; i < socketList.Size(); i++)
5482 {
5483 if (socketList[i]->GetUserConnectionSocketIndex()==userIndex)
5484 return i;
5485 }
5486 RakAssert("GetRakNetSocketFromUserConnectionSocketIndex failed" && 0);
5487 return (unsigned int) -1;
5488 }
5489
5490 /*
5491 // DS_APR
5492 void RakPeer::ProcessChromePacket(RakNetSocket2 *s, const char *buffer, int dataSize, const SystemAddress& recvFromAddress, SLNet::TimeUS timeRead)
5493 {
5494 RakAssert(buffer);
5495 RakAssert(dataSize > 0);
5496 RakAssert(recvFromAddress.GetPort());
5497
5498 RNS2RecvStruct *recvFromStruct;
5499 recvFromStruct=bufferedPackets.Allocate( _FILE_AND_LINE_ );
5500 RakAssert(dataSize <= (int)sizeof(recvFromStruct->data));
5501 memcpy(recvFromStruct->data, buffer, dataSize);
5502 recvFromStruct->bytesRead=dataSize;
5503 recvFromStruct->systemAddress=recvFromAddress;
5504 recvFromStruct->timeRead=timeRead;
5505 bufferedPackets.Push(recvFromStruct);
5506 }
5507 */
5508
5509 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5510 /*
5511 bool RakPeer::RunRecvFromOnce( RakNetSocket *s )
5512 {
5513 RakPeer::RecvFromStruct *recvFromStruct;
5514
5515 recvFromStruct=bufferedPackets.Allocate( _FILE_AND_LINE_ );
5516 if (recvFromStruct != NULL)
5517 {
5518 recvFromStruct->s=s;
5519 SocketLayer::RecvFromBlocking(s, this, recvFromStruct->data, &recvFromStruct->bytesRead, &recvFromStruct->systemAddress, &recvFromStruct->timeRead);
5520
5521 if (recvFromStruct->bytesRead>0)
5522 {
5523 RakAssert(recvFromStruct->systemAddress.GetPort());
5524 bufferedPackets.Push(recvFromStruct);
5525 quitAndDataEvents.SetEvent();
5526
5527 // Got data
5528 return true;
5529 }
5530 else
5531 {
5532 bufferedPackets.Deallocate(recvFromStruct, _FILE_AND_LINE_);
5533 }
5534 }
5535 // No data
5536 return false;
5537 }
5538 */
5539 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5540 bool RakPeer::RunUpdateCycle(BitStream &updateBitStream )
5541 {
5542 RakPeer::RemoteSystemStruct * remoteSystem;
5543 unsigned int activeSystemListIndex;
5544 Packet *packet;
5545 // int currentSentBytes,currentReceivedBytes;
5546 // unsigned numberOfBytesUsed;
5547 // BitSize_t numberOfBitsUsed;
5548 //SystemAddress authoritativeClientSystemAddress;
5549 BitSize_t bitSize;
5550 unsigned int byteSize;
5551 unsigned char *data;
5552 SystemAddress systemAddress;
5553 BufferedCommandStruct *bcs;
5554 bool callerDataAllocationUsed;
5555 RakNetStatistics *rnss;
5556 SLNet::TimeUS timeNS=0;
5557 SLNet::Time timeMS=0;
5558
5559 // This is here so RecvFromBlocking actually gets data from the same thread
5560
5561 #if defined(WINDOWS_STORE_RT)
5562 #elif defined(_WIN32)
5563 if (socketList[0]->GetSocketType()==RNS2T_WINDOWS && ((RNS2_Windows*)socketList[0])->GetSocketLayerOverride())
5564 {
5565 int len;
5566 SystemAddress sender;
5567 char dataOut[ MAXIMUM_MTU_SIZE ];
5568 do {
5569 len = ((RNS2_Windows*)socketList[0])->GetSocketLayerOverride()->RakNetRecvFrom(dataOut,&sender,true);
5570 if (len>0)
5571 ProcessNetworkPacket( sender, dataOut, len, this, socketList[0], SLNet::GetTimeUS(), updateBitStream );
5572 } while (len>0);
5573 }
5574 #endif
5575
5576 // unsigned int socketListIndex;
5577 RNS2RecvStruct *recvFromStruct;
5578 while ((recvFromStruct=PopBufferedPacket())!=0)
5579 {
5580 /*
5581 for (socketListIndex=0; socketListIndex < socketList.Size(); socketListIndex++)
5582 {
5583 if ((RakNetSocket*) socketList[socketListIndex]==recvFromStruct->s)
5584 break;
5585 }
5586 if (socketListIndex!=socketList.Size())
5587 */
5588 ProcessNetworkPacket(recvFromStruct->systemAddress, recvFromStruct->data, recvFromStruct->bytesRead, this, recvFromStruct->socket, recvFromStruct->timeRead, updateBitStream);
5589 DeallocRNS2RecvStruct(recvFromStruct, _FILE_AND_LINE_);
5590 }
5591
5592 while ((bcs=bufferedCommands.PopInaccurate())!=0)
5593 {
5594 if (bcs->command==BufferedCommandStruct::BCS_SEND)
5595 {
5596 // GetTime is a very slow call so do it once and as late as possible
5597 if (timeNS==0)
5598 {
5599 timeNS = SLNet::GetTimeUS();
5600 timeMS = (SLNet::TimeMS)(timeNS/(SLNet::TimeUS)1000);
5601 }
5602
5603 callerDataAllocationUsed=SendImmediate((char*)bcs->data, bcs->numberOfBitsToSend, bcs->priority, bcs->reliability, bcs->orderingChannel, bcs->systemIdentifier, bcs->broadcast, true, timeNS, bcs->receipt);
5604 if ( callerDataAllocationUsed==false )
5605 rakFree_Ex(bcs->data, _FILE_AND_LINE_ );
5606
5607 // Set the new connection state AFTER we call sendImmediate in case we are setting it to a disconnection state, which does not allow further sends
5608 if (bcs->connectionMode!=RemoteSystemStruct::NO_ACTION )
5609 {
5610 remoteSystem=GetRemoteSystem( bcs->systemIdentifier, true, true );
5611 if (remoteSystem)
5612 remoteSystem->connectMode=bcs->connectionMode;
5613 }
5614 }
5615 else if (bcs->command==BufferedCommandStruct::BCS_CLOSE_CONNECTION)
5616 {
5617 CloseConnectionInternal(bcs->systemIdentifier, false, true, bcs->orderingChannel, bcs->priority);
5618 }
5619 else if (bcs->command==BufferedCommandStruct::BCS_CHANGE_SYSTEM_ADDRESS)
5620 {
5621 // Reroute
5622 RakPeer::RemoteSystemStruct *rssFromGuid = GetRemoteSystem(bcs->systemIdentifier.rakNetGuid,true,true);
5623 if (rssFromGuid!=0)
5624 {
5625 unsigned int existingSystemIndex = GetRemoteSystemIndex(rssFromGuid->systemAddress);
5626 ReferenceRemoteSystem(bcs->systemIdentifier.systemAddress, existingSystemIndex);
5627 }
5628 }
5629 else if (bcs->command==BufferedCommandStruct::BCS_GET_SOCKET)
5630 {
5631 SocketQueryOutput *sqo;
5632 if (bcs->systemIdentifier.IsUndefined())
5633 {
5634 sqo = socketQueryOutput.Allocate( _FILE_AND_LINE_ );
5635 sqo->sockets=socketList;
5636 socketQueryOutput.Push(sqo);
5637 }
5638 else
5639 {
5640 remoteSystem=GetRemoteSystem( bcs->systemIdentifier, true, true );
5641 sqo = socketQueryOutput.Allocate( _FILE_AND_LINE_ );
5642
5643 sqo->sockets.Clear(false, _FILE_AND_LINE_);
5644 if (remoteSystem)
5645 {
5646 sqo->sockets.Push(remoteSystem->rakNetSocket, _FILE_AND_LINE_ );
5647 }
5648 else
5649 {
5650 // Leave empty smart pointer
5651 }
5652 socketQueryOutput.Push(sqo);
5653 }
5654
5655 }
5656
5657 #ifdef _DEBUG
5658 bcs->data=0;
5659 #endif
5660
5661 bufferedCommands.Deallocate(bcs, _FILE_AND_LINE_);
5662 }
5663
5664 if (requestedConnectionQueue.IsEmpty()==false)
5665 {
5666 if (timeNS==0)
5667 {
5668 timeNS = SLNet::GetTimeUS();
5669 timeMS = (SLNet::TimeMS)(timeNS/(SLNet::TimeUS)1000);
5670 }
5671
5672 bool condition1, condition2;
5673 unsigned requestedConnectionQueueIndex=0;
5674 requestedConnectionQueueMutex.Lock();
5675 while (requestedConnectionQueueIndex < requestedConnectionQueue.Size())
5676 {
5677 RequestedConnectionStruct *rcs;
5678 rcs = requestedConnectionQueue[requestedConnectionQueueIndex];
5679 requestedConnectionQueueMutex.Unlock();
5680 if (rcs->nextRequestTime < timeMS)
5681 {
5682 condition1=rcs->requestsMade==rcs->sendConnectionAttemptCount+1;
5683 condition2=(bool)((rcs->systemAddress==UNASSIGNED_SYSTEM_ADDRESS)==1);
5684 // If too many requests made or a hole then remove this if possible, otherwise invalidate it
5685 if (condition1 || condition2)
5686 {
5687 if (rcs->data)
5688 {
5689 rakFree_Ex(rcs->data, _FILE_AND_LINE_ );
5690 rcs->data=0;
5691 }
5692
5693 if (condition1 && !condition2 && rcs->actionToTake==RequestedConnectionStruct::CONNECT)
5694 {
5695 // Tell user of connection attempt failed
5696 packet=AllocPacket(sizeof( char ), _FILE_AND_LINE_);
5697 packet->data[ 0 ] = ID_CONNECTION_ATTEMPT_FAILED; // Attempted a connection and couldn't
5698 packet->bitSize = ( sizeof( char ) * 8);
5699 packet->systemAddress = rcs->systemAddress;
5700 AddPacketToProducer(packet);
5701 }
5702
5703 #if LIBCAT_SECURITY==1
5704 CAT_AUDIT_PRINTF("AUDIT: Connection attempt FAILED so deleting rcs->client_handshake object %x\n", rcs->client_handshake);
5705 SLNet::OP_DELETE(rcs->client_handshake,_FILE_AND_LINE_);
5706 #endif
5707 SLNet::OP_DELETE(rcs,_FILE_AND_LINE_);
5708
5709 requestedConnectionQueueMutex.Lock();
5710 for (unsigned int k=0; k < requestedConnectionQueue.Size(); k++)
5711 {
5712 if (requestedConnectionQueue[k]==rcs)
5713 {
5714 requestedConnectionQueue.RemoveAtIndex(k);
5715 break;
5716 }
5717 }
5718 requestedConnectionQueueMutex.Unlock();
5719 }
5720 else
5721 {
5722
5723 int MTUSizeIndex = rcs->requestsMade / (rcs->sendConnectionAttemptCount/NUM_MTU_SIZES);
5724 if (MTUSizeIndex>=NUM_MTU_SIZES)
5725 MTUSizeIndex=NUM_MTU_SIZES-1;
5726 rcs->requestsMade++;
5727 rcs->nextRequestTime=timeMS+rcs->timeBetweenSendConnectionAttemptsMS;
5728
5729 SLNet::BitStream bitStream;
5730 //WriteOutOfBandHeader(&bitStream, ID_USER_PACKET_ENUM);
5731 bitStream.Write((MessageID)ID_OPEN_CONNECTION_REQUEST_1);
5732 bitStream.WriteAlignedBytes((const unsigned char*) OFFLINE_MESSAGE_DATA_ID, sizeof(OFFLINE_MESSAGE_DATA_ID));
5733 bitStream.Write((MessageID)RAKNET_PROTOCOL_VERSION);
5734 bitStream.PadWithZeroToByteLength(mtuSizes[MTUSizeIndex]-UDP_HEADER_SIZE);
5735
5736 char str[256];
5737 rcs->systemAddress.ToString(true,str,static_cast<size_t>(256));
5738
5739 //RAKNET_DEBUG_PRINTF("%i:IOCR, ", __LINE__);
5740
5741 unsigned i;
5742 for (i=0; i < pluginListNTS.Size(); i++)
5743 pluginListNTS[i]->OnDirectSocketSend((const char*) bitStream.GetData(), bitStream.GetNumberOfBitsUsed(), rcs->systemAddress);
5744
5745 RakNetSocket2 *socketToUse;
5746 if (rcs->socket == 0)
5747 socketToUse = socketList[rcs->socketIndex];
5748 else
5749 socketToUse = rcs->socket;
5750
5751 rcs->systemAddress.FixForIPVersion(socketToUse->GetBoundAddress());
5752 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
5753 if (socketToUse->IsBerkleySocket())
5754 ((RNS2_Berkley*)socketToUse)->SetDoNotFragment(1);
5755 #endif
5756
5757 // SocketLayer::SetDoNotFragment(socketToUse, 1);
5758 SLNet::Time sendToStart= SLNet::GetTime();
5759
5760 RNS2_SendParameters bsp;
5761 bsp.data = (char*) bitStream.GetData();
5762 bsp.length = bitStream.GetNumberOfBytesUsed();
5763 bsp.systemAddress = rcs->systemAddress;
5764 if (socketToUse->Send(&bsp, _FILE_AND_LINE_) == 10040)
5765 // if (SocketLayer::SendTo( socketToUse, (const char*) bitStream.GetData(), bitStream.GetNumberOfBytesUsed(), rcs->systemAddress, _FILE_AND_LINE_ )==-10040)
5766 {
5767 // Don't use this MTU size again
5768 rcs->requestsMade = (unsigned char) ((MTUSizeIndex + 1) * (rcs->sendConnectionAttemptCount/NUM_MTU_SIZES));
5769 rcs->nextRequestTime=timeMS;
5770 }
5771 else
5772 {
5773 SLNet::Time sendToEnd= SLNet::GetTime();
5774 if (sendToEnd-sendToStart>100)
5775 {
5776 // Drop to lowest MTU
5777 int lowestMtuIndex = rcs->sendConnectionAttemptCount/NUM_MTU_SIZES * (NUM_MTU_SIZES - 1);
5778 if (lowestMtuIndex > rcs->requestsMade)
5779 {
5780 rcs->requestsMade = (unsigned char) lowestMtuIndex;
5781 rcs->nextRequestTime=timeMS;
5782 }
5783 else
5784 rcs->requestsMade=(unsigned char)(rcs->sendConnectionAttemptCount+1);
5785 }
5786 }
5787 // SocketLayer::SetDoNotFragment(socketToUse, 0);
5788 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
5789 if (socketToUse->IsBerkleySocket())
5790 ((RNS2_Berkley*)socketToUse)->SetDoNotFragment(0);
5791 #endif
5792
5793 requestedConnectionQueueIndex++;
5794 }
5795 }
5796 else
5797 requestedConnectionQueueIndex++;
5798
5799 requestedConnectionQueueMutex.Lock();
5800 }
5801 requestedConnectionQueueMutex.Unlock();
5802 }
5803
5804 // remoteSystemList in network thread
5805 for ( activeSystemListIndex = 0; activeSystemListIndex < activeSystemListSize; ++activeSystemListIndex )
5806 //for ( remoteSystemIndex = 0; remoteSystemIndex < remoteSystemListSize; ++remoteSystemIndex )
5807 {
5808 // I'm using systemAddress from remoteSystemList but am not locking it because this loop is called very frequently and it doesn't
5809 // matter if we miss or do an extra update. The reliability layers themselves never care which player they are associated with
5810 //systemAddress = remoteSystemList[ remoteSystemIndex ].systemAddress;
5811 // Allow the systemAddress for this remote system list to change. We don't care if it changes now.
5812 // remoteSystemList[ remoteSystemIndex ].allowSystemAddressAssigment=true;
5813
5814
5815 // Found an active remote system
5816 remoteSystem = activeSystemList[ activeSystemListIndex ];
5817 systemAddress = remoteSystem->systemAddress;
5818 RakAssert(systemAddress!=UNASSIGNED_SYSTEM_ADDRESS);
5819 // Update is only safe to call from the same thread that calls HandleSocketReceiveFromConnectedPlayer,
5820 // which is this thread
5821
5822 if (timeNS==0)
5823 {
5824 timeNS = SLNet::GetTimeUS();
5825 timeMS = (SLNet::TimeMS)(timeNS/(SLNet::TimeUS)1000);
5826 //RAKNET_DEBUG_PRINTF("timeNS = %I64i timeMS=%i\n", timeNS, timeMS);
5827 }
5828
5829
5830 if (timeMS > remoteSystem->lastReliableSend && timeMS-remoteSystem->lastReliableSend > remoteSystem->reliabilityLayer.GetTimeoutTime()/2 && remoteSystem->connectMode==RemoteSystemStruct::CONNECTED)
5831 {
5832 // If no reliable packets are waiting for an ack, do a one byte reliable send so that disconnections are noticed
5833 RakNetStatistics rakNetStatistics;
5834 rnss=remoteSystem->reliabilityLayer.GetStatistics(&rakNetStatistics);
5835 if (rnss->messagesInResendBuffer==0)
5836 {
5837 PingInternal( systemAddress, true, RELIABLE );
5838
5839 //remoteSystem->lastReliableSend=timeMS+remoteSystem->reliabilityLayer.GetTimeoutTime();
5840 remoteSystem->lastReliableSend=timeMS;
5841 }
5842 }
5843
5844 remoteSystem->reliabilityLayer.Update( remoteSystem->rakNetSocket, systemAddress, remoteSystem->MTUSize, timeNS, maxOutgoingBPS, pluginListNTS, &rnr, updateBitStream ); // systemAddress only used for the internet simulator test
5845
5846 // Check for failure conditions
5847 if ( remoteSystem->reliabilityLayer.IsDeadConnection() ||
5848 ((remoteSystem->connectMode==RemoteSystemStruct::DISCONNECT_ASAP || remoteSystem->connectMode==RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY) && remoteSystem->reliabilityLayer.IsOutgoingDataWaiting()==false) ||
5849 (remoteSystem->connectMode==RemoteSystemStruct::DISCONNECT_ON_NO_ACK && (remoteSystem->reliabilityLayer.AreAcksWaiting()==false || remoteSystem->reliabilityLayer.AckTimeout(timeMS)==true)) ||
5850 ((
5851 (remoteSystem->connectMode==RemoteSystemStruct::REQUESTED_CONNECTION ||
5852 remoteSystem->connectMode==RemoteSystemStruct::HANDLING_CONNECTION_REQUEST ||
5853 remoteSystem->connectMode==RemoteSystemStruct::UNVERIFIED_SENDER)
5854 && timeMS > remoteSystem->connectionTime && timeMS - remoteSystem->connectionTime > 10000))
5855 )
5856 {
5857 // RAKNET_DEBUG_PRINTF("timeMS=%i remoteSystem->connectionTime=%i\n", timeMS, remoteSystem->connectionTime );
5858
5859 // Failed. Inform the user?
5860 // TODO - RakNet 4.0 - Return a different message identifier for DISCONNECT_ASAP_SILENTLY and DISCONNECT_ASAP than for DISCONNECT_ON_NO_ACK
5861 // The first two mean we called CloseConnection(), the last means the other system sent us ID_DISCONNECTION_NOTIFICATION
5862 if (remoteSystem->connectMode==RemoteSystemStruct::CONNECTED || remoteSystem->connectMode==RemoteSystemStruct::REQUESTED_CONNECTION
5863 || remoteSystem->connectMode==RemoteSystemStruct::DISCONNECT_ASAP || remoteSystem->connectMode==RemoteSystemStruct::DISCONNECT_ON_NO_ACK)
5864 {
5865
5866 // SLNet::BitStream undeliveredMessages;
5867 // remoteSystem->reliabilityLayer.GetUndeliveredMessages(&undeliveredMessages,remoteSystem->MTUSize);
5868
5869 // packet=AllocPacket(sizeof( char ) + undeliveredMessages.GetNumberOfBytesUsed());
5870 packet=AllocPacket(sizeof( char ), _FILE_AND_LINE_);
5871 if (remoteSystem->connectMode==RemoteSystemStruct::REQUESTED_CONNECTION)
5872 packet->data[ 0 ] = ID_CONNECTION_ATTEMPT_FAILED; // Attempted a connection and couldn't
5873 else if (remoteSystem->connectMode==RemoteSystemStruct::CONNECTED)
5874 packet->data[ 0 ] = ID_CONNECTION_LOST; // DeadConnection
5875 else
5876 packet->data[ 0 ] = ID_DISCONNECTION_NOTIFICATION; // DeadConnection
5877
5878 // memcpy(packet->data+1, undeliveredMessages.GetData(), undeliveredMessages.GetNumberOfBytesUsed());
5879
5880 packet->guid = remoteSystem->guid;
5881 packet->systemAddress = systemAddress;
5882 packet->systemAddress.systemIndex = remoteSystem->remoteSystemIndex;
5883 packet->guid.systemIndex=packet->systemAddress.systemIndex;
5884
5885 AddPacketToProducer(packet);
5886 }
5887 // else connection shutting down, don't bother telling the user
5888
5889 #ifdef _DO_PRINTF
5890 RAKNET_DEBUG_PRINTF("Connection dropped for player %i:%i\n", systemAddress);
5891 #endif
5892 CloseConnectionInternal( systemAddress, false, true, 0, LOW_PRIORITY );
5893 continue;
5894 }
5895
5896 // Ping this guy if it is time to do so
5897 if ( remoteSystem->connectMode==RemoteSystemStruct::CONNECTED && timeMS > remoteSystem->nextPingTime && ( occasionalPing || remoteSystem->lowestPing == (unsigned short)-1 ) )
5898 {
5899 remoteSystem->nextPingTime = timeMS + 5000;
5900 PingInternal( systemAddress, true, UNRELIABLE );
5901
5902 // Update again immediately after this tick so the ping goes out right away
5903 quitAndDataEvents.SetEvent();
5904 }
5905
5906 // Find whoever has the lowest player ID
5907 //if (systemAddress < authoritativeClientSystemAddress)
5908 // authoritativeClientSystemAddress=systemAddress;
5909
5910 // Does the reliability layer have any packets waiting for us?
5911 // To be thread safe, this has to be called in the same thread as HandleSocketReceiveFromConnectedPlayer
5912 bitSize = remoteSystem->reliabilityLayer.Receive( &data );
5913
5914 while ( bitSize > 0 )
5915 {
5916 // These types are for internal use and should never arrive from a network packet
5917 if (data[0]==ID_CONNECTION_ATTEMPT_FAILED)
5918 {
5919 RakAssert(0);
5920 bitSize=0;
5921 continue;
5922 }
5923
5924 // Fast and easy - just use the data that was returned
5925 byteSize = (unsigned int) BITS_TO_BYTES( bitSize );
5926
5927 // For unknown senders we only accept a few specific packets
5928 if (remoteSystem->connectMode==RemoteSystemStruct::UNVERIFIED_SENDER)
5929 {
5930 if ( (unsigned char)(data)[0] == ID_CONNECTION_REQUEST )
5931 {
5932 ParseConnectionRequestPacket(remoteSystem, systemAddress, (const char*)data, byteSize);
5933 rakFree_Ex(data, _FILE_AND_LINE_ );
5934 }
5935 else
5936 {
5937 CloseConnectionInternal( systemAddress, false, true, 0, LOW_PRIORITY );
5938 #ifdef _DO_PRINTF
5939 RAKNET_DEBUG_PRINTF("Temporarily banning %i:%i for sending nonsense data\n", systemAddress);
5940 #endif
5941
5942 char str1[64];
5943 systemAddress.ToString(false, str1, static_cast<size_t>(64));
5944 AddToBanList(str1, remoteSystem->reliabilityLayer.GetTimeoutTime());
5945
5946
5947 rakFree_Ex(data, _FILE_AND_LINE_ );
5948 }
5949 }
5950 else
5951 {
5952 // However, if we are connected we still take a connection request in case both systems are trying to connect to each other
5953 // at the same time
5954 if ( (unsigned char)(data)[0] == ID_CONNECTION_REQUEST )
5955 {
5956 // 04/27/06 This is wrong. With cross connections, we can both have initiated the connection are in state REQUESTED_CONNECTION
5957 // 04/28/06 Downgrading connections from connected will close the connection due to security at ((remoteSystem->connectMode!=RemoteSystemStruct::CONNECTED && time > remoteSystem->connectionTime && time - remoteSystem->connectionTime > 10000))
5958 if (remoteSystem->connectMode==RemoteSystemStruct::REQUESTED_CONNECTION)
5959 {
5960 ParseConnectionRequestPacket(remoteSystem, systemAddress, (const char*)data, byteSize);
5961 }
5962 else
5963 {
5964
5965 SLNet::BitStream bs((unsigned char*) data,byteSize,false);
5966 bs.IgnoreBytes(sizeof(MessageID));
5967 bs.IgnoreBytes(sizeof(OFFLINE_MESSAGE_DATA_ID));
5968 bs.IgnoreBytes(RakNetGUID::size());
5969 SLNet::Time incomingTimestamp;
5970 bs.Read(incomingTimestamp);
5971
5972 // Got a connection request message from someone we are already connected to. Just reply normally.
5973 // This can happen due to race conditions with the fully connected mesh
5974 OnConnectionRequest( remoteSystem, incomingTimestamp );
5975 }
5976 rakFree_Ex(data, _FILE_AND_LINE_ );
5977 }
5978 else if ( (unsigned char) data[ 0 ] == ID_NEW_INCOMING_CONNECTION && byteSize > sizeof(unsigned char)+sizeof(unsigned int)+sizeof(unsigned short)+sizeof(SLNet::Time)*2 )
5979 {
5980 if (remoteSystem->connectMode==RemoteSystemStruct::HANDLING_CONNECTION_REQUEST)
5981 {
5982 remoteSystem->connectMode=RemoteSystemStruct::CONNECTED;
5983 PingInternal( systemAddress, true, UNRELIABLE );
5984
5985 // Update again immediately after this tick so the ping goes out right away
5986 quitAndDataEvents.SetEvent();
5987
5988 SLNet::BitStream inBitStream((unsigned char *) data, byteSize, false);
5989 SystemAddress bsSystemAddress;
5990
5991 inBitStream.IgnoreBits(8);
5992 inBitStream.Read(bsSystemAddress);
5993 for (unsigned int i=0; i < MAXIMUM_NUMBER_OF_INTERNAL_IDS; i++)
5994 inBitStream.Read(remoteSystem->theirInternalSystemAddress[i]);
5995
5996 SLNet::Time sendPingTime, sendPongTime;
5997 inBitStream.Read(sendPingTime);
5998 inBitStream.Read(sendPongTime);
5999 OnConnectedPong(sendPingTime,sendPongTime,remoteSystem);
6000
6001 // Overwrite the data in the packet
6002 // NewIncomingConnectionStruct newIncomingConnectionStruct;
6003 // SLNet::BitStream nICS_BS( data, NewIncomingConnectionStruct_Size, false );
6004 // newIncomingConnectionStruct.Deserialize( nICS_BS );
6005
6006 remoteSystem->myExternalSystemAddress = bsSystemAddress;
6007
6008 // Bug: If A connects to B through R, A's firstExternalID is set to R. If A tries to send to R, sends to loopback because R==firstExternalID
6009 // Correct fix is to specify in Connect() if target is through a proxy.
6010 // However, in practice you have to connect to something else first anyway to know about the proxy. So setting once only is good enough
6011 if (firstExternalID==UNASSIGNED_SYSTEM_ADDRESS)
6012 {
6013 firstExternalID=bsSystemAddress;
6014 firstExternalID.debugPort=ntohs(firstExternalID.address.addr4.sin_port);
6015 }
6016
6017 // Send this info down to the game
6018 packet=AllocPacket(byteSize, data, _FILE_AND_LINE_);
6019 packet->bitSize = bitSize;
6020 packet->systemAddress = systemAddress;
6021 packet->systemAddress.systemIndex = remoteSystem->remoteSystemIndex;
6022 packet->guid = remoteSystem->guid;
6023 packet->guid.systemIndex=packet->systemAddress.systemIndex;
6024 AddPacketToProducer(packet);
6025 }
6026 else
6027 {
6028 // Send to game even if already connected. This could happen when connecting to 127.0.0.1
6029 // Ignore, already connected
6030 // rakFree_Ex(data, _FILE_AND_LINE_ );
6031 }
6032 }
6033 else if ( (unsigned char) data[ 0 ] == ID_CONNECTED_PONG && byteSize == sizeof(unsigned char)+sizeof(SLNet::Time)*2 )
6034 {
6035 SLNet::Time sendPingTime, sendPongTime;
6036
6037 // Copy into the ping times array the current time - the value returned
6038 // First extract the sent ping
6039 SLNet::BitStream inBitStream( (unsigned char *) data, byteSize, false );
6040 //PingStruct ps;
6041 //ps.Deserialize(psBS);
6042 inBitStream.IgnoreBits(8);
6043 inBitStream.Read(sendPingTime);
6044 inBitStream.Read(sendPongTime);
6045
6046 OnConnectedPong(sendPingTime,sendPongTime,remoteSystem);
6047
6048 rakFree_Ex(data, _FILE_AND_LINE_ );
6049 }
6050 else if ( (unsigned char)data[0] == ID_CONNECTED_PING && byteSize == sizeof(unsigned char)+sizeof(SLNet::Time) )
6051 {
6052 SLNet::BitStream inBitStream( (unsigned char *) data, byteSize, false );
6053 inBitStream.IgnoreBits(8);
6054 SLNet::Time sendPingTime;
6055 inBitStream.Read(sendPingTime);
6056
6057 SLNet::BitStream outBitStream;
6058 outBitStream.Write((MessageID)ID_CONNECTED_PONG);
6059 outBitStream.Write(sendPingTime);
6060 outBitStream.Write(SLNet::GetTime());
6061 SendImmediate( (char*)outBitStream.GetData(), outBitStream.GetNumberOfBitsUsed(), IMMEDIATE_PRIORITY, UNRELIABLE, 0, systemAddress, false, false, SLNet::GetTimeUS(), 0 );
6062
6063 // Update again immediately after this tick so the ping goes out right away
6064 quitAndDataEvents.SetEvent();
6065
6066 rakFree_Ex(data, _FILE_AND_LINE_ );
6067 }
6068 else if ( (unsigned char) data[ 0 ] == ID_DISCONNECTION_NOTIFICATION )
6069 {
6070 // We shouldn't close the connection immediately because we need to ack the ID_DISCONNECTION_NOTIFICATION
6071 remoteSystem->connectMode=RemoteSystemStruct::DISCONNECT_ON_NO_ACK;
6072 rakFree_Ex(data, _FILE_AND_LINE_ );
6073
6074 // AddPacketToProducer(packet);
6075 }
6076 else if ( (unsigned char)(data)[0] == ID_DETECT_LOST_CONNECTIONS && byteSize == sizeof(unsigned char) )
6077 {
6078 // Do nothing
6079 rakFree_Ex(data, _FILE_AND_LINE_ );
6080 }
6081 else if ( (unsigned char)(data)[0] == ID_INVALID_PASSWORD )
6082 {
6083 if (remoteSystem->connectMode==RemoteSystemStruct::REQUESTED_CONNECTION)
6084 {
6085 packet=AllocPacket(byteSize, data, _FILE_AND_LINE_);
6086 packet->bitSize = bitSize;
6087 packet->systemAddress = systemAddress;
6088 packet->systemAddress.systemIndex = remoteSystem->remoteSystemIndex;
6089 packet->guid = remoteSystem->guid;
6090 packet->guid.systemIndex=packet->systemAddress.systemIndex;
6091 AddPacketToProducer(packet);
6092
6093 remoteSystem->connectMode=RemoteSystemStruct::DISCONNECT_ASAP_SILENTLY;
6094 }
6095 else
6096 {
6097 rakFree_Ex(data, _FILE_AND_LINE_ );
6098 }
6099 }
6100 else if ( (unsigned char)(data)[0] == ID_CONNECTION_REQUEST_ACCEPTED )
6101 {
6102 if (byteSize > sizeof(MessageID)+sizeof(unsigned int)+sizeof(unsigned short)+sizeof(SystemIndex)+sizeof(SLNet::Time)*2)
6103 {
6104 // Make sure this connection accept is from someone we wanted to connect to
6105 bool allowConnection, alreadyConnected;
6106
6107 if (remoteSystem->connectMode==RemoteSystemStruct::HANDLING_CONNECTION_REQUEST ||
6108 remoteSystem->connectMode==RemoteSystemStruct::REQUESTED_CONNECTION ||
6109 allowConnectionResponseIPMigration)
6110 allowConnection=true;
6111 else
6112 allowConnection=false;
6113
6114 if (remoteSystem->connectMode==RemoteSystemStruct::HANDLING_CONNECTION_REQUEST)
6115 alreadyConnected=true;
6116 else
6117 alreadyConnected=false;
6118
6119 if ( allowConnection )
6120 {
6121 SystemAddress externalID;
6122 SystemIndex systemIndex;
6123 // SystemAddress internalID;
6124
6125 SLNet::BitStream inBitStream((unsigned char *) data, byteSize, false);
6126 inBitStream.IgnoreBits(8);
6127 // inBitStream.Read(remotePort);
6128 inBitStream.Read(externalID);
6129 inBitStream.Read(systemIndex);
6130 for (unsigned int i=0; i < MAXIMUM_NUMBER_OF_INTERNAL_IDS; i++)
6131 inBitStream.Read(remoteSystem->theirInternalSystemAddress[i]);
6132
6133 SLNet::Time sendPingTime, sendPongTime;
6134 inBitStream.Read(sendPingTime);
6135 inBitStream.Read(sendPongTime);
6136 OnConnectedPong(sendPingTime, sendPongTime, remoteSystem);
6137
6138 // Find a free remote system struct to use
6139 // SLNet::BitStream casBitS(data, byteSize, false);
6140 // ConnectionAcceptStruct cas;
6141 // cas.Deserialize(casBitS);
6142 // systemAddress.GetPort() = remotePort;
6143
6144 // The remote system told us our external IP, so save it
6145 remoteSystem->myExternalSystemAddress = externalID;
6146 remoteSystem->connectMode=RemoteSystemStruct::CONNECTED;
6147
6148 // Bug: If A connects to B through R, A's firstExternalID is set to R. If A tries to send to R, sends to loopback because R==firstExternalID
6149 // Correct fix is to specify in Connect() if target is through a proxy.
6150 // However, in practice you have to connect to something else first anyway to know about the proxy. So setting once only is good enough
6151 if (firstExternalID==UNASSIGNED_SYSTEM_ADDRESS)
6152 {
6153 firstExternalID=externalID;
6154 firstExternalID.debugPort=ntohs(firstExternalID.address.addr4.sin_port);
6155 }
6156
6157 // Send the connection request complete to the game
6158 packet=AllocPacket(byteSize, data, _FILE_AND_LINE_);
6159 packet->bitSize = byteSize * 8;
6160 packet->systemAddress = systemAddress;
6161 packet->systemAddress.systemIndex = ( SystemIndex ) GetIndexFromSystemAddress( systemAddress, true );
6162 packet->guid = remoteSystem->guid;
6163 packet->guid.systemIndex=packet->systemAddress.systemIndex;
6164 AddPacketToProducer(packet);
6165
6166 SLNet::BitStream outBitStream;
6167 outBitStream.Write((MessageID)ID_NEW_INCOMING_CONNECTION);
6168 outBitStream.Write(systemAddress);
6169 for (unsigned int i=0; i < MAXIMUM_NUMBER_OF_INTERNAL_IDS; i++)
6170 outBitStream.Write(ipList[i]);
6171 outBitStream.Write(sendPongTime);
6172 outBitStream.Write(SLNet::GetTime());
6173
6174 SendImmediate( (char*)outBitStream.GetData(), outBitStream.GetNumberOfBitsUsed(), IMMEDIATE_PRIORITY, RELIABLE_ORDERED, 0, systemAddress, false, false, SLNet::GetTimeUS(), 0 );
6175
6176 if (alreadyConnected==false)
6177 {
6178 PingInternal( systemAddress, true, UNRELIABLE );
6179 }
6180 }
6181 else
6182 {
6183 // Ignore, already connected
6184 rakFree_Ex(data, _FILE_AND_LINE_ );
6185 }
6186 }
6187 else
6188 {
6189 // Version mismatch error?
6190 RakAssert(0);
6191 rakFree_Ex(data, _FILE_AND_LINE_ );
6192 }
6193 }
6194 else
6195 {
6196 // What do I do if I get a message from a system, before I am fully connected?
6197 // I can either ignore it or give it to the user
6198 // It seems like giving it to the user is a better option
6199 if ((data[0]>=(MessageID)ID_TIMESTAMP || data[0]==ID_SND_RECEIPT_ACKED || data[0]==ID_SND_RECEIPT_LOSS) &&
6200 remoteSystem->isActive
6201 )
6202 {
6203 packet=AllocPacket(byteSize, data, _FILE_AND_LINE_);
6204 packet->bitSize = bitSize;
6205 packet->systemAddress = systemAddress;
6206 packet->systemAddress.systemIndex = remoteSystem->remoteSystemIndex;
6207 packet->guid = remoteSystem->guid;
6208 packet->guid.systemIndex=packet->systemAddress.systemIndex;
6209 AddPacketToProducer(packet);
6210 }
6211 else
6212 {
6213 rakFree_Ex(data, _FILE_AND_LINE_ );
6214 }
6215 }
6216 }
6217
6218 // Does the reliability layer have any more packets waiting for us?
6219 // To be thread safe, this has to be called in the same thread as HandleSocketReceiveFromConnectedPlayer
6220 bitSize = remoteSystem->reliabilityLayer.Receive( &data );
6221 }
6222
6223 }
6224
6225 return true;
6226 }
6227
6228 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6229
6230 void RakPeer::OnRNS2Recv(RNS2RecvStruct *recvStruct)
6231 {
6232 if (incomingDatagramEventHandler)
6233 {
6234 if (incomingDatagramEventHandler(recvStruct)!=true)
6235 return;
6236 }
6237
6238 PushBufferedPacket(recvStruct);
6239 quitAndDataEvents.SetEvent();
6240 }
6241
6242 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6243
6244 /*
6245 RAK_THREAD_DECLARATION(SLNet::RecvFromLoop)
6246 {
6247 #if defined(SN_TARGET_PSP2)
6248 RakPeerAndIndex *rpai = ( RakPeerAndIndex * ) RakThread::GetRealThreadArgument(callGetRealThreadArgument);
6249 #else
6250 RakPeerAndIndex *rpai = ( RakPeerAndIndex * ) arguments;
6251 #endif
6252 RakPeer * rakPeer = rpai->rakPeer;
6253 RakNetSocket *s = rpai->s;
6254 SLNet::OP_DELETE(rpai,_FILE_AND_LINE_);
6255
6256 rakPeer->isRecvFromLoopThreadActive.Increment();
6257
6258 while ( rakPeer->endThreads == false )
6259 {
6260 if (rakPeer->RunRecvFromOnce(s)==false &&
6261 s->GetBlockingSocket()==false)
6262 RakSleep(0);
6263 }
6264 rakPeer->isRecvFromLoopThreadActive.Decrement();
6265
6266 #if defined(SN_TARGET_PSP2)
6267 return sceKernelExitDeleteThread(0);
6268 #else
6269 return 0;
6270 #endif
6271 }
6272 */
6273
6274 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6275 RAK_THREAD_DECLARATION(SLNet::UpdateNetworkLoop)
6276 {
6277
6278
6279
6280 RakPeer * rakPeer = ( RakPeer * ) arguments;
6281
6282
6283 /*
6284 // 11/15/05 - this is slower than Sleep()
6285 #ifdef _WIN32
6286 #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
6287 // Lets see if these timers give better performance than Sleep
6288 HANDLE timerHandle;
6289 LARGE_INTEGER dueTime;
6290
6291 if ( rakPeer->threadSleepTimer <= 0 )
6292 rakPeer->threadSleepTimer = 1;
6293
6294 // 2nd parameter of false means synchronization timer instead of manual-reset timer
6295 timerHandle = CreateWaitableTimer( NULL, FALSE, 0 );
6296
6297 RakAssert( timerHandle );
6298
6299 dueTime.QuadPart = -10000 * rakPeer->threadSleepTimer; // 10000 is 1 ms?
6300
6301 BOOL success = SetWaitableTimer( timerHandle, &dueTime, rakPeer->threadSleepTimer, NULL, NULL, FALSE );
6302 (void) success;
6303 RakAssert( success );
6304
6305 #endif
6306 #endif
6307 */
6308
6309 BitStream updateBitStream( MAXIMUM_MTU_SIZE
6310 #if LIBCAT_SECURITY==1
6311 + cat::AuthenticatedEncryption::OVERHEAD_BYTES
6312 #endif
6313 );
6314 //
6315 rakPeer->isMainLoopThreadActive = true;
6316
6317 bool running = true;
6318 while ( running )
6319 {
6320 if (rakPeer->endThreads) {
6321 // allow just one more final update-run prior to shutting down this thread to make sure that outstanding acks are still sent and the peers don't unnecessary wait for already retrieved packets
6322 // note: this fixes part of SLNET-123
6323 running = false;
6324 }
6325 // #ifdef _DEBUG
6326 // // Sanity check, make sure RunUpdateCycle does not block or not otherwise get called for a long time
6327 // RakNetTime thisCall=SLNet::GetTime();
6328 // RakAssert(thisCall-lastCall<250);
6329 // lastCall=thisCall;
6330 // #endif
6331 if (rakPeer->userUpdateThreadPtr)
6332 rakPeer->userUpdateThreadPtr(rakPeer, rakPeer->userUpdateThreadData);
6333
6334 rakPeer->RunUpdateCycle(updateBitStream);
6335
6336 // Pending sends go out this often, unless quitAndDataEvents is set
6337 rakPeer->quitAndDataEvents.WaitOnEvent(10);
6338
6339 /*
6340
6341 // #if ((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) &&
6342 #if defined(USE_WAIT_FOR_MULTIPLE_EVENTS) && defined(_WIN32)
6343
6344 if (rakPeer->threadSleepTimer>0)
6345 {
6346 WSAEVENT eventArray[256];
6347 unsigned int i, eventArrayIndex;
6348 for (i=0,eventArrayIndex=0; i < rakPeer->socketList.Size(); i++)
6349 {
6350 if (rakPeer->socketList[i]->recvEvent!=INVALID_HANDLE_VALUE)
6351 {
6352 eventArray[eventArrayIndex]=rakPeer->socketList[i]->recvEvent;
6353 eventArrayIndex++;
6354 if (eventArrayIndex==256)
6355 break;
6356 }
6357 }
6358 WSAWaitForMultipleEvents(eventArrayIndex,(const HANDLE*) &eventArray,FALSE,rakPeer->threadSleepTimer,FALSE);
6359 }
6360 else
6361 {
6362 RakSleep(0);
6363 }
6364
6365 #else // ((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && defined(USE_WAIT_FOR_MULTIPLE_EVENTS)
6366 #pragma message("-- RakNet: Using Sleep(). Uncomment USE_WAIT_FOR_MULTIPLE_EVENTS in defines.h if you want to use WaitForSingleObject instead. --")
6367
6368 RakSleep( rakPeer->threadSleepTimer );
6369 #endif
6370 */
6371 }
6372
6373 rakPeer->isMainLoopThreadActive = false;
6374
6375 /*
6376 #ifdef _WIN32
6377 #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
6378 CloseHandle(timerHandle);
6379 #endif
6380 #endif
6381 */
6382
6383
6384
6385
6386 return 0;
6387
6388 }
6389
6390 void RakPeer::CallPluginCallbacks(DataStructures::List<PluginInterface2*> &pluginList, Packet *packet)
6391 {
6392 for (unsigned int i=0; i < pluginList.Size(); i++)
6393 {
6394 switch (packet->data[0])
6395 {
6396 case ID_DISCONNECTION_NOTIFICATION:
6397 pluginList[i]->OnClosedConnection(packet->systemAddress, packet->guid, LCR_DISCONNECTION_NOTIFICATION);
6398 break;
6399 case ID_CONNECTION_LOST:
6400 pluginList[i]->OnClosedConnection(packet->systemAddress, packet->guid, LCR_CONNECTION_LOST);
6401 break;
6402 case ID_NEW_INCOMING_CONNECTION:
6403 pluginList[i]->OnNewConnection(packet->systemAddress, packet->guid, true);
6404 break;
6405 case ID_CONNECTION_REQUEST_ACCEPTED:
6406 pluginList[i]->OnNewConnection(packet->systemAddress, packet->guid, false);
6407 break;
6408 case ID_CONNECTION_ATTEMPT_FAILED:
6409 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_CONNECTION_ATTEMPT_FAILED);
6410 break;
6411 case ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY:
6412 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY);
6413 break;
6414 case ID_OUR_SYSTEM_REQUIRES_SECURITY:
6415 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_OUR_SYSTEM_REQUIRES_SECURITY);
6416 break;
6417 case ID_PUBLIC_KEY_MISMATCH:
6418 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_PUBLIC_KEY_MISMATCH);
6419 break;
6420 case ID_ALREADY_CONNECTED:
6421 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_ALREADY_CONNECTED);
6422 break;
6423 case ID_NO_FREE_INCOMING_CONNECTIONS:
6424 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_NO_FREE_INCOMING_CONNECTIONS);
6425 break;
6426 case ID_CONNECTION_BANNED:
6427 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_CONNECTION_BANNED);
6428 break;
6429 case ID_INVALID_PASSWORD:
6430 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_INVALID_PASSWORD);
6431 break;
6432 case ID_INCOMPATIBLE_PROTOCOL_VERSION:
6433 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_INCOMPATIBLE_PROTOCOL);
6434 break;
6435 case ID_IP_RECENTLY_CONNECTED:
6436 pluginList[i]->OnFailedConnectionAttempt(packet, FCAR_IP_RECENTLY_CONNECTED);
6437 break;
6438 }
6439 }
6440 }
6441
6442 void RakPeer::FillIPList(void)
6443 {
6444 if (ipList[0]!=UNASSIGNED_SYSTEM_ADDRESS)
6445 return;
6446
6447 // Fill out ipList structure
6448 #if !defined(WINDOWS_STORE_RT)
6449 RakNetSocket2::GetMyIP( ipList );
6450 #endif
6451
6452 // Sort the addresses from lowest to highest
6453 int startingIdx = 0;
6454 while (startingIdx < MAXIMUM_NUMBER_OF_INTERNAL_IDS-1 && ipList[startingIdx] != UNASSIGNED_SYSTEM_ADDRESS)
6455 {
6456 int lowestIdx = startingIdx;
6457 for (int curIdx = startingIdx + 1; curIdx < MAXIMUM_NUMBER_OF_INTERNAL_IDS-1 && ipList[curIdx] != UNASSIGNED_SYSTEM_ADDRESS; curIdx++ )
6458 {
6459 if (ipList[curIdx] < ipList[startingIdx])
6460 {
6461 lowestIdx = curIdx;
6462 }
6463 }
6464 if (startingIdx != lowestIdx)
6465 {
6466 SystemAddress temp = ipList[startingIdx];
6467 ipList[startingIdx] = ipList[lowestIdx];
6468 ipList[lowestIdx] = temp;
6469 }
6470 ++startingIdx;
6471 }
6472 }
6473
6474
6475 // #if defined(RMO_NEW_UNDEF_ALLOCATING_QUEUE)
6476 // #pragma pop_macro("new")
6477 // #undef RMO_NEW_UNDEF_ALLOCATING_QUEUE
6478 // #endif
6479
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • uint24_t
SLNet::uint24_t Member List

This is the complete list of members for SLNet::uint24_t, including all inherited members.

operator uint32_t() | SLNet::uint24_t | inline
operator uint32_t() const | SLNet::uint24_t | inline
operator!=(const uint24_t &right) const | SLNet::uint24_t | inline
operator!=(const uint32_t &right) const | SLNet::uint24_t | inline
operator&(const uint24_t &a) | SLNet::uint24_t | inline
operator&(const uint32_t &a) | SLNet::uint24_t | inline
operator*(const uint24_t &other) const | SLNet::uint24_t | inline
operator*(const uint32_t &other) const | SLNet::uint24_t | inline
operator+(const uint24_t &other) const | SLNet::uint24_t | inline
operator+(const uint32_t &other) const | SLNet::uint24_t | inline
operator++() | SLNet::uint24_t | inline
operator++(int) | SLNet::uint24_t | inline
operator+=(const uint24_t &a) | SLNet::uint24_t | inline
operator+=(const uint32_t &a) | SLNet::uint24_t | inline
operator-(const uint24_t &other) const | SLNet::uint24_t | inline
operator-(const uint32_t &other) const | SLNet::uint24_t | inline
operator--() | SLNet::uint24_t | inline
operator--(int) | SLNet::uint24_t | inline
operator-=(const uint24_t &a) | SLNet::uint24_t | inline
operator-=(const uint32_t &a) | SLNet::uint24_t | inline
operator/(const uint24_t &other) const | SLNet::uint24_t | inline
operator/(const uint32_t &other) const | SLNet::uint24_t | inline
operator<(const uint24_t &right) const | SLNet::uint24_t | inline
operator<(const uint32_t &right) const | SLNet::uint24_t | inline
operator=(const uint24_t &a) | SLNet::uint24_t | inline
operator=(const uint32_t &a) | SLNet::uint24_t | inline
operator==(const uint24_t &right) const | SLNet::uint24_t | inline
operator==(const uint32_t &right) const | SLNet::uint24_t | inline
operator>(const uint24_t &right) const | SLNet::uint24_t | inline
operator>(const uint32_t &right) const | SLNet::uint24_t | inline
uint24_t() | SLNet::uint24_t | inline
uint24_t(const uint24_t &a) | SLNet::uint24_t | inline
uint24_t(const uint32_t &a) | SLNet::uint24_t | inline
val | SLNet::uint24_t |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HTTPConnection2
SLNet::HTTPConnection2 Member List

This is the complete list of members for SLNet::HTTPConnection2, including all inherited members.

AllocatePacketUnified(unsigned dataSize) | SLNet::PluginInterface2 | protected
completedRequests | SLNet::HTTPConnection2 | protected
completedRequestsMutex | SLNet::HTTPConnection2 | protected
DeallocPacketUnified(Packet *packet) | SLNet::PluginInterface2 | protected
GetMyGUIDUnified(void) const | SLNet::PluginInterface2 |
GetRakPeerInterface(void) const | SLNet::PluginInterface2 | inline
GetResponse(RakString &stringTransmitted, RakString &hostTransmitted, RakString &responseReceived, SystemAddress &hostReceived, ptrdiff_t &contentOffset, void **userData) | SLNet::HTTPConnection2 |
GetResponse(RakString &stringTransmitted, RakString &hostTransmitted, RakString &responseReceived, SystemAddress &hostReceived, ptrdiff_t &contentOffset) | SLNet::HTTPConnection2 |
HasResponse(void) const | SLNet::HTTPConnection2 |
HTTPConnection2() | SLNet::HTTPConnection2 |
IsBusy(void) const | SLNet::HTTPConnection2 |
IsConnected(SystemAddress sa) | SLNet::HTTPConnection2 | protected
OnAck(unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time) | SLNet::PluginInterface2 | inlinevirtual
OnAttach(void) | SLNet::PluginInterface2 | inlinevirtual
OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) | SLNet::HTTPConnection2 | virtual
OnDetach(void) | SLNet::PluginInterface2 | inlinevirtual
OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) | SLNet::PluginInterface2 | inlinevirtual
OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) | SLNet::PluginInterface2 | inlinevirtual
OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason) | SLNet::HTTPConnection2 | virtual
OnInternalPacket(InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend) | SLNet::PluginInterface2 | inlinevirtual
OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming) | SLNet::HTTPConnection2 | virtual
OnPushBackPacket(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) | SLNet::PluginInterface2 | inlinevirtual
OnRakPeerShutdown(void) | SLNet::PluginInterface2 | inlinevirtual
OnRakPeerStartup(void) | SLNet::PluginInterface2 | inlinevirtual
OnReceive(Packet *packet) | SLNet::HTTPConnection2 | virtual
OnReliabilityLayerNotification(const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError) | SLNet::PluginInterface2 | inlinevirtual
pendingRequests | SLNet::HTTPConnection2 | protected
pendingRequestsMutex | SLNet::HTTPConnection2 | protected
PluginInterface2() | SLNet::PluginInterface2 |
PushBackPacketUnified(Packet *packet, bool pushAtHead) | SLNet::PluginInterface2 | protected
rakPeerInterface | SLNet::PluginInterface2 | protected
RemovePendingRequest(SystemAddress sa) | SLNet::HTTPConnection2 | protected
SendListUnified(const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast) | SLNet::PluginInterface2 | protected
SendNextPendingRequest(void) | SLNet::HTTPConnection2 | protected
SendPendingRequestToConnectedSystem(SystemAddress sa) | SLNet::HTTPConnection2 | protected
SendRequest(Request *request) | SLNet::HTTPConnection2 | protected
SendUnified(const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast) | SLNet::PluginInterface2 | protected
SendUnified(const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast) | SLNet::PluginInterface2 | protected
sentRequests | SLNet::HTTPConnection2 | protected
sentRequestsMutex | SLNet::HTTPConnection2 | protected
SetRakPeerInterface(RakPeerInterface *ptr) | SLNet::PluginInterface2 |
SetTCPInterface(TCPInterface *ptr) | SLNet::PluginInterface2 |
tcpInterface | SLNet::PluginInterface2 | protected
TransmitRequest(const char *stringToTransmit, const char *host, unsigned short port=80, bool useSSL=false, int ipVersion=4, SystemAddress useAddress=UNASSIGNED_SYSTEM_ADDRESS, void *userData=0) | SLNet::HTTPConnection2 |
Update(void) | SLNet::PluginInterface2 | inlinevirtual
UsesReliabilityLayer(void) const | SLNet::PluginInterface2 | inlinevirtual
~HTTPConnection2() | SLNet::HTTPConnection2 | virtual
~PluginInterface2() | SLNet::PluginInterface2 | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/UDPProxyCoordinator.cpp Source File

  • src
UDPProxyCoordinator.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_UDPProxyCoordinator==1 && _RAKNET_SUPPORT_UDPForwarder==1
18
19 #include "slikenet/UDPProxyCoordinator.h"
20 #include "slikenet/BitStream.h"
21 #include "slikenet/UDPProxyCommon.h"
22 #include "slikenet/peerinterface.h"
23 #include "slikenet/MessageIdentifiers.h"
24 #include "slikenet/Rand.h"
25 #include "slikenet/GetTime.h"
26 #include "slikenet/UDPForwarder.h"
27
28 // Larger than the client version
29 static const int DEFAULT_CLIENT_UNRESPONSIVE_PING_TIME=2000;
30 static const int DEFAULT_UNRESPONSIVE_PING_TIME_COORDINATOR=DEFAULT_CLIENT_UNRESPONSIVE_PING_TIME+1000;
31
32 using namespace SLNet;
33
34 // bool operator<( const DataStructures::MLKeyRef<unsigned short> &inputKey, const UDPProxyCoordinator::ServerWithPing &cls ) {return inputKey.Get() < cls.ping;}
35 // bool operator>( const DataStructures::MLKeyRef<unsigned short> &inputKey, const UDPProxyCoordinator::ServerWithPing &cls ) {return inputKey.Get() > cls.ping;}
36 // bool operator==( const DataStructures::MLKeyRef<unsigned short> &inputKey, const UDPProxyCoordinator::ServerWithPing &cls ) {return inputKey.Get() == cls.ping;}
37
38 int UDPProxyCoordinator::ServerWithPingComp( const unsigned short &key, const UDPProxyCoordinator::ServerWithPing &data )
39 {
40 if (key < data.ping)
41 return -1;
42 if (key > data.ping)
43 return 1;
44 return 0;
45 }
46
47 int UDPProxyCoordinator::ForwardingRequestComp( const SenderAndTargetAddress &key, ForwardingRequest* const &data)
48 {
49 if (key.senderClientAddress < data->sata.senderClientAddress )
50 return -1;
51 if (key.senderClientAddress > data->sata.senderClientAddress )
52 return 1;
53 if (key.targetClientAddress < data->sata.targetClientAddress )
54 return -1;
55 if (key.targetClientAddress > data->sata.targetClientAddress )
56 return 1;
57 return 0;
58 }
59 //
60 // bool operator<( const DataStructures::MLKeyRef<UDPProxyCoordinator::SenderAndTargetAddress> &inputKey, const UDPProxyCoordinator::ForwardingRequest *cls )
61 // {
62 // return inputKey.Get().senderClientAddress < cls->sata.senderClientAddress ||
63 // (inputKey.Get().senderClientAddress == cls->sata.senderClientAddress && inputKey.Get().targetClientAddress < cls->sata.targetClientAddress);
64 // }
65 // bool operator>( const DataStructures::MLKeyRef<UDPProxyCoordinator::SenderAndTargetAddress> &inputKey, const UDPProxyCoordinator::ForwardingRequest *cls )
66 // {
67 // return inputKey.Get().senderClientAddress > cls->sata.senderClientAddress ||
68 // (inputKey.Get().senderClientAddress == cls->sata.senderClientAddress && inputKey.Get().targetClientAddress > cls->sata.targetClientAddress);
69 // }
70 // bool operator==( const DataStructures::MLKeyRef<UDPProxyCoordinator::SenderAndTargetAddress> &inputKey, const UDPProxyCoordinator::ForwardingRequest *cls )
71 // {
72 // return inputKey.Get().senderClientAddress == cls->sata.senderClientAddress && inputKey.Get().targetClientAddress == cls->sata.targetClientAddress;
73 // }
74
75 STATIC_FACTORY_DEFINITIONS(UDPProxyCoordinator,UDPProxyCoordinator);
76
77 UDPProxyCoordinator::UDPProxyCoordinator()
78 {
79
80 }
81 UDPProxyCoordinator::~UDPProxyCoordinator()
82 {
83 Clear();
84 }
85 void UDPProxyCoordinator::SetRemoteLoginPassword(SLNet::RakString password)
86 {
87 remoteLoginPassword=password;
88 }
89 void UDPProxyCoordinator::Update(void)
90 {
91 unsigned int idx;
92 SLNet::TimeMS curTime = SLNet::GetTimeMS();
93 ForwardingRequest *fw;
94 idx=0;
95 while (idx < forwardingRequestList.Size())
96 {
97 fw=forwardingRequestList[idx];
98 if (fw->timeRequestedPings!=0 &&
99 curTime > fw->timeRequestedPings + DEFAULT_UNRESPONSIVE_PING_TIME_COORDINATOR)
100 {
101 fw->OrderRemainingServersToTry();
102 fw->timeRequestedPings=0;
103 TryNextServer(fw->sata, fw);
104 idx++;
105 }
106 else if (fw->timeoutAfterSuccess!=0 &&
107 curTime > fw->timeoutAfterSuccess)
108 {
109 // Forwarding request succeeded, we waited a bit to prevent duplicates. Can forget about the entry now.
110 SLNet::OP_DELETE(fw,_FILE_AND_LINE_);
111 forwardingRequestList.RemoveAtIndex(idx);
112 }
113 else
114 idx++;
115 }
116 }
117 PluginReceiveResult UDPProxyCoordinator::OnReceive(Packet *packet)
118 {
119 if (packet->data[0]==ID_UDP_PROXY_GENERAL && packet->length>1)
120 {
121 switch (packet->data[1])
122 {
123 case ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR:
124 OnForwardingRequestFromClientToCoordinator(packet);
125 return RR_STOP_PROCESSING_AND_DEALLOCATE;
126 case ID_UDP_PROXY_LOGIN_REQUEST_FROM_SERVER_TO_COORDINATOR:
127 OnLoginRequestFromServerToCoordinator(packet);
128 return RR_STOP_PROCESSING_AND_DEALLOCATE;
129 case ID_UDP_PROXY_FORWARDING_REPLY_FROM_SERVER_TO_COORDINATOR:
130 OnForwardingReplyFromServerToCoordinator(packet);
131 return RR_STOP_PROCESSING_AND_DEALLOCATE;
132 case ID_UDP_PROXY_PING_SERVERS_REPLY_FROM_CLIENT_TO_COORDINATOR:
133 OnPingServersReplyFromClientToCoordinator(packet);
134 return RR_STOP_PROCESSING_AND_DEALLOCATE;
135 }
136 }
137 return RR_CONTINUE_PROCESSING;
138 }
139 void UDPProxyCoordinator::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
140 {
141 (void) lostConnectionReason;
142 (void) rakNetGUID;
143
144 unsigned int idx, idx2;
145
146 idx=0;
147 while (idx < forwardingRequestList.Size())
148 {
149 if (forwardingRequestList[idx]->requestingAddress==systemAddress)
150 {
151 // Guy disconnected before the attempt completed
152 SLNet::OP_DELETE(forwardingRequestList[idx], _FILE_AND_LINE_);
153 forwardingRequestList.RemoveAtIndex(idx );
154 }
155 else
156 idx++;
157 }
158
159 idx = serverList.GetIndexOf(systemAddress);
160 if (idx!=(unsigned int)-1)
161 {
162 ForwardingRequest *fw;
163 // For each pending client for this server, choose from remaining servers.
164 for (idx2=0; idx2 < forwardingRequestList.Size(); idx2++)
165 {
166 fw = forwardingRequestList[idx2];
167 if (fw->currentlyAttemptedServerAddress==systemAddress)
168 {
169 // Try the next server
170 TryNextServer(fw->sata, fw);
171 }
172 }
173
174 // Remove dead server
175 serverList.RemoveAtIndexFast(idx);
176 }
177 }
178 void UDPProxyCoordinator::OnForwardingRequestFromClientToCoordinator(Packet *packet)
179 {
180 SLNet::BitStream incomingBs(packet->data, packet->length, false);
181 incomingBs.IgnoreBytes(2);
182 SystemAddress sourceAddress;
183 incomingBs.Read(sourceAddress);
184 if (sourceAddress==UNASSIGNED_SYSTEM_ADDRESS)
185 sourceAddress=packet->systemAddress;
186 SystemAddress targetAddress;
187 RakNetGUID targetGuid;
188 bool usesAddress=false;
189 incomingBs.Read(usesAddress);
190 if (usesAddress)
191 {
192 incomingBs.Read(targetAddress);
193 targetGuid=rakPeerInterface->GetGuidFromSystemAddress(targetAddress);
194 }
195 else
196 {
197 incomingBs.Read(targetGuid);
198 targetAddress=rakPeerInterface->GetSystemAddressFromGuid(targetGuid);
199 }
200 ForwardingRequest *fw = SLNet::OP_NEW<ForwardingRequest>(_FILE_AND_LINE_);
201 fw->timeoutAfterSuccess=0;
202 incomingBs.Read(fw->timeoutOnNoDataMS);
203 bool hasServerSelectionBitstream=false;
204 incomingBs.Read(hasServerSelectionBitstream);
205 if (hasServerSelectionBitstream)
206 incomingBs.Read(&(fw->serverSelectionBitstream));
207
208 SLNet::BitStream outgoingBs;
209 SenderAndTargetAddress sata;
210 sata.senderClientAddress=sourceAddress;
211 sata.targetClientAddress=targetAddress;
212 sata.targetClientGuid=targetGuid;
213 sata.senderClientGuid=rakPeerInterface->GetGuidFromSystemAddress(sourceAddress);
214 SenderAndTargetAddress sataReversed;
215 sataReversed.senderClientAddress=targetAddress;
216 sataReversed.targetClientAddress=sourceAddress;
217 sataReversed.senderClientGuid=sata.targetClientGuid;
218 sataReversed.targetClientGuid=sata.senderClientGuid;
219
220 unsigned int insertionIndex;
221 bool objectExists1, objectExists2;
222 insertionIndex=forwardingRequestList.GetIndexFromKey(sata, &objectExists1);
223 forwardingRequestList.GetIndexFromKey(sataReversed, &objectExists2);
224
225 if (objectExists1 || objectExists2)
226 {
227 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
228 outgoingBs.Write((MessageID)ID_UDP_PROXY_IN_PROGRESS);
229 outgoingBs.Write(sata.senderClientAddress);
230 outgoingBs.Write(targetAddress);
231 outgoingBs.Write(targetGuid);
232 // Request in progress, not completed
233 unsigned short forwardingPort=0;
234 RakString serverPublicIp;
235 outgoingBs.Write(serverPublicIp);
236 outgoingBs.Write(forwardingPort);
237 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
238 SLNet::OP_DELETE(fw, _FILE_AND_LINE_);
239 return;
240 }
241
242 if (serverList.Size()==0)
243 {
244 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
245 outgoingBs.Write((MessageID)ID_UDP_PROXY_NO_SERVERS_ONLINE);
246 outgoingBs.Write(sata.senderClientAddress);
247 outgoingBs.Write(targetAddress);
248 outgoingBs.Write(targetGuid);
249 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
250 SLNet::OP_DELETE(fw, _FILE_AND_LINE_);
251 return;
252 }
253
254 if (rakPeerInterface->GetConnectionState(targetAddress)!=IS_CONNECTED && usesAddress==false)
255 {
256 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
257 outgoingBs.Write((MessageID)ID_UDP_PROXY_RECIPIENT_GUID_NOT_CONNECTED_TO_COORDINATOR);
258 outgoingBs.Write(sata.senderClientAddress);
259 outgoingBs.Write(targetAddress);
260 outgoingBs.Write(targetGuid);
261 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
262 SLNet::OP_DELETE(fw, _FILE_AND_LINE_);
263 return;
264 }
265
266 fw->sata=sata;
267 fw->requestingAddress=packet->systemAddress;
268
269 if (serverList.Size()>1)
270 {
271 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
272 outgoingBs.Write((MessageID)ID_UDP_PROXY_PING_SERVERS_FROM_COORDINATOR_TO_CLIENT);
273 outgoingBs.Write(sourceAddress);
274 outgoingBs.Write(targetAddress);
275 outgoingBs.Write(targetGuid);
276 unsigned short serverListSize = (unsigned short) serverList.Size();
277 outgoingBs.Write(serverListSize);
278 unsigned int idx;
279 for (idx=0; idx < serverList.Size(); idx++)
280 outgoingBs.Write(serverList[idx]);
281 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, sourceAddress, false);
282 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, targetAddress, false);
283 fw->timeRequestedPings= SLNet::GetTimeMS();
284 unsigned int copyIndex;
285 for (copyIndex=0; copyIndex < serverList.Size(); copyIndex++)
286 fw->remainingServersToTry.Push(serverList[copyIndex], _FILE_AND_LINE_ );
287 forwardingRequestList.InsertAtIndex(fw, insertionIndex, _FILE_AND_LINE_ );
288 }
289 else
290 {
291 fw->timeRequestedPings=0;
292 fw->currentlyAttemptedServerAddress=serverList[0];
293 forwardingRequestList.InsertAtIndex(fw, insertionIndex, _FILE_AND_LINE_ );
294 SendForwardingRequest(sourceAddress, targetAddress, fw->currentlyAttemptedServerAddress, fw->timeoutOnNoDataMS);
295 }
296 }
297
298 void UDPProxyCoordinator::SendForwardingRequest(SystemAddress sourceAddress, SystemAddress targetAddress, SystemAddress serverAddress, SLNet::TimeMS timeoutOnNoDataMS)
299 {
300 SLNet::BitStream outgoingBs;
301 // Send request to desired server
302 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
303 outgoingBs.Write((MessageID)ID_UDP_PROXY_FORWARDING_REQUEST_FROM_COORDINATOR_TO_SERVER);
304 outgoingBs.Write(sourceAddress);
305 outgoingBs.Write(targetAddress);
306 outgoingBs.Write(timeoutOnNoDataMS);
307 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, serverAddress, false);
308 }
309 void UDPProxyCoordinator::OnLoginRequestFromServerToCoordinator(Packet *packet)
310 {
311 SLNet::BitStream incomingBs(packet->data, packet->length, false);
312 incomingBs.IgnoreBytes(2);
313 SLNet::RakString password;
314 incomingBs.Read(password);
315 SLNet::BitStream outgoingBs;
316
317 if (remoteLoginPassword.IsEmpty())
318 {
319 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
320 outgoingBs.Write((MessageID)ID_UDP_PROXY_NO_PASSWORD_SET_FROM_COORDINATOR_TO_SERVER);
321 outgoingBs.Write(password);
322 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
323 return;
324 }
325
326 if (remoteLoginPassword!=password)
327 {
328 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
329 outgoingBs.Write((MessageID)ID_UDP_PROXY_WRONG_PASSWORD_FROM_COORDINATOR_TO_SERVER);
330 outgoingBs.Write(password);
331 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
332 return;
333 }
334
335 unsigned int insertionIndex;
336 insertionIndex=serverList.GetIndexOf(packet->systemAddress);
337 if (insertionIndex!=(unsigned int)-1)
338 {
339 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
340 outgoingBs.Write((MessageID)ID_UDP_PROXY_ALREADY_LOGGED_IN_FROM_COORDINATOR_TO_SERVER);
341 outgoingBs.Write(password);
342 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
343 return;
344 }
345 serverList.Push(packet->systemAddress, _FILE_AND_LINE_ );
346 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
347 outgoingBs.Write((MessageID)ID_UDP_PROXY_LOGIN_SUCCESS_FROM_COORDINATOR_TO_SERVER);
348 outgoingBs.Write(password);
349 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
350 }
351 void UDPProxyCoordinator::OnForwardingReplyFromServerToCoordinator(Packet *packet)
352 {
353 SLNet::BitStream incomingBs(packet->data, packet->length, false);
354 incomingBs.IgnoreBytes(2);
355 SenderAndTargetAddress sata;
356 incomingBs.Read(sata.senderClientAddress);
357 incomingBs.Read(sata.targetClientAddress);
358 bool objectExists;
359 unsigned int index = forwardingRequestList.GetIndexFromKey(sata, &objectExists);
360 if (objectExists==false)
361 {
362 // The guy disconnected before the request finished
363 return;
364 }
365 ForwardingRequest *fw = forwardingRequestList[index];
366 sata.senderClientGuid = fw->sata.senderClientGuid;
367 sata.targetClientGuid = fw->sata.targetClientGuid;
368
369 RakString serverPublicIp;
370 incomingBs.Read(serverPublicIp);
371
372 if (serverPublicIp.IsEmpty())
373 {
374 char serverIP[64];
375 packet->systemAddress.ToString(false,serverIP,static_cast<size_t>(64));
376 serverPublicIp=serverIP;
377 }
378
379 UDPForwarderResult success;
380 unsigned char c;
381 incomingBs.Read(c);
382 success=(UDPForwarderResult)c;
383
384 unsigned short forwardingPort;
385 incomingBs.Read(forwardingPort);
386
387 SLNet::BitStream outgoingBs;
388 if (success==UDPFORWARDER_SUCCESS)
389 {
390 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
391 outgoingBs.Write((MessageID)ID_UDP_PROXY_FORWARDING_SUCCEEDED);
392 outgoingBs.Write(sata.senderClientAddress);
393 outgoingBs.Write(sata.targetClientAddress);
394 outgoingBs.Write(sata.targetClientGuid);
395 outgoingBs.Write(serverPublicIp);
396 outgoingBs.Write(forwardingPort);
397 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, fw->requestingAddress, false);
398
399 outgoingBs.Reset();
400 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
401 outgoingBs.Write((MessageID)ID_UDP_PROXY_FORWARDING_NOTIFICATION);
402 outgoingBs.Write(sata.senderClientAddress);
403 outgoingBs.Write(sata.targetClientAddress);
404 outgoingBs.Write(sata.targetClientGuid);
405 outgoingBs.Write(serverPublicIp);
406 outgoingBs.Write(forwardingPort);
407 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, sata.targetClientAddress, false);
408
409 // 05/18/09 Keep the entry around for some time after success, so duplicates are reported if attempting forwarding from the target system before notification of success
410 fw->timeoutAfterSuccess= SLNet::GetTimeMS()+fw->timeoutOnNoDataMS;
411 // forwardingRequestList.RemoveAtIndex(index);
412 // SLNet::OP_DELETE(fw,_FILE_AND_LINE_);
413
414 return;
415 }
416 else if (success==UDPFORWARDER_NO_SOCKETS)
417 {
418 // Try next server
419 TryNextServer(sata, fw);
420 }
421 else
422 {
423 RakAssert(success==UDPFORWARDER_FORWARDING_ALREADY_EXISTS);
424
425 // Return in progress
426 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
427 outgoingBs.Write((MessageID)ID_UDP_PROXY_IN_PROGRESS);
428 outgoingBs.Write(sata.senderClientAddress);
429 outgoingBs.Write(sata.targetClientAddress);
430 outgoingBs.Write(sata.targetClientGuid);
431 outgoingBs.Write(serverPublicIp);
432 outgoingBs.Write(forwardingPort);
433 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, fw->requestingAddress, false);
434 forwardingRequestList.RemoveAtIndex(index);
435 SLNet::OP_DELETE(fw,_FILE_AND_LINE_);
436 }
437 }
438 void UDPProxyCoordinator::OnPingServersReplyFromClientToCoordinator(Packet *packet)
439 {
440 SLNet::BitStream incomingBs(packet->data, packet->length, false);
441 incomingBs.IgnoreBytes(2);
442 unsigned short serversToPingSize;
443 SystemAddress serverAddress;
444 SenderAndTargetAddress sata;
445 incomingBs.Read(sata.senderClientAddress);
446 incomingBs.Read(sata.targetClientAddress);
447 bool objectExists;
448 unsigned int index = forwardingRequestList.GetIndexFromKey(sata, &objectExists);
449 if (objectExists==false)
450 return;
451 unsigned short idx;
452 ServerWithPing swp;
453 ForwardingRequest *fw = forwardingRequestList[index];
454 if (fw->timeRequestedPings==0)
455 return;
456
457 incomingBs.Read(serversToPingSize);
458 if (packet->systemAddress==sata.senderClientAddress)
459 {
460 for (idx=0; idx < serversToPingSize; idx++)
461 {
462 incomingBs.Read(swp.serverAddress);
463 incomingBs.Read(swp.ping);
464 unsigned int index2;
465 for (index2=0; index2 < fw->sourceServerPings.Size(); index2++)
466 {
467 if (fw->sourceServerPings[index2].ping >= swp.ping )
468 break;
469 }
470 fw->sourceServerPings.Insert(swp, index2, _FILE_AND_LINE_);
471 }
472 }
473 else
474 {
475 for (idx=0; idx < serversToPingSize; idx++)
476 {
477 incomingBs.Read(swp.serverAddress);
478 incomingBs.Read(swp.ping);
479
480 unsigned int index2;
481 for (index2=0; index2 < fw->targetServerPings.Size(); index2++)
482 {
483 if (fw->targetServerPings[index2].ping >= swp.ping )
484 break;
485 }
486 fw->sourceServerPings.Insert(swp, index2, _FILE_AND_LINE_);
487 }
488 }
489
490 // Both systems have to give us pings to progress here. Otherwise will timeout in Update()
491 if (fw->sourceServerPings.Size()>0 &&
492 fw->targetServerPings.Size()>0)
493 {
494 fw->OrderRemainingServersToTry();
495 fw->timeRequestedPings=0;
496 TryNextServer(fw->sata, fw);
497 }
498 }
499 void UDPProxyCoordinator::TryNextServer(SenderAndTargetAddress sata, ForwardingRequest *fw)
500 {
501 bool pickedGoodServer=false;
502 while(fw->remainingServersToTry.Size()>0)
503 {
504 fw->currentlyAttemptedServerAddress=fw->remainingServersToTry.Pop();
505 if (serverList.GetIndexOf(fw->currentlyAttemptedServerAddress)!=(unsigned int)-1)
506 {
507 pickedGoodServer=true;
508 break;
509 }
510 }
511
512 if (pickedGoodServer==false)
513 {
514 SendAllBusy(sata.senderClientAddress, sata.targetClientAddress, sata.targetClientGuid, fw->requestingAddress);
515 forwardingRequestList.Remove(sata);
516 SLNet::OP_DELETE(fw,_FILE_AND_LINE_);
517 return;
518 }
519
520 SendForwardingRequest(sata.senderClientAddress, sata.targetClientAddress, fw->currentlyAttemptedServerAddress, fw->timeoutOnNoDataMS);
521 }
522 void UDPProxyCoordinator::SendAllBusy(SystemAddress senderClientAddress, SystemAddress targetClientAddress, RakNetGUID targetClientGuid, SystemAddress requestingAddress)
523 {
524 SLNet::BitStream outgoingBs;
525 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
526 outgoingBs.Write((MessageID)ID_UDP_PROXY_ALL_SERVERS_BUSY);
527 outgoingBs.Write(senderClientAddress);
528 outgoingBs.Write(targetClientAddress);
529 outgoingBs.Write(targetClientGuid);
530 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, requestingAddress, false);
531 }
532 void UDPProxyCoordinator::Clear(void)
533 {
534 serverList.Clear(true, _FILE_AND_LINE_);
535 for (unsigned int i=0; i < forwardingRequestList.Size(); i++)
536 {
537 SLNet::OP_DELETE(forwardingRequestList[i],_FILE_AND_LINE_);
538 }
539 forwardingRequestList.Clear(false, _FILE_AND_LINE_);
540 }
541 void UDPProxyCoordinator::ForwardingRequest::OrderRemainingServersToTry(void)
542 {
543 //DataStructures::Multilist<ML_ORDERED_LIST,UDPProxyCoordinator::ServerWithPing,unsigned short> swpList;
544 DataStructures::OrderedList<unsigned short, UDPProxyCoordinator::ServerWithPing, ServerWithPingComp> swpList;
545 // swpList.SetSortOrder(true);
546
547 if (sourceServerPings.Size()==0 && targetServerPings.Size()==0)
548 return;
549
550 unsigned int idx;
551 UDPProxyCoordinator::ServerWithPing swp;
552 for (idx=0; idx < remainingServersToTry.Size(); idx++)
553 {
554 swp.serverAddress=remainingServersToTry[idx];
555 swp.ping=0;
556 if (sourceServerPings.Size())
557 swp.ping+=(unsigned short) (sourceServerPings[idx].ping);
558 else
559 swp.ping+=(unsigned short) (DEFAULT_CLIENT_UNRESPONSIVE_PING_TIME);
560 if (targetServerPings.Size())
561 swp.ping+=(unsigned short) (targetServerPings[idx].ping);
562 else
563 swp.ping+=(unsigned short) (DEFAULT_CLIENT_UNRESPONSIVE_PING_TIME);
564 swpList.Insert(swp.ping, swp, false, _FILE_AND_LINE_);
565 }
566 remainingServersToTry.Clear(_FILE_AND_LINE_ );
567 for (idx=0; idx < swpList.Size(); idx++)
568 {
569 remainingServersToTry.Push(swpList[idx].serverAddress, _FILE_AND_LINE_ );
570 }
571 }
572
573 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CloudCommon.cpp Source File

  • src
CloudCommon.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_CloudClient==1 || _RAKNET_SUPPORT_CloudServer==1
18
19 #include "slikenet/CloudCommon.h"
20 #include "slikenet/BitStream.h"
21
22 using namespace SLNet;
23
24 int SLNet::CloudKeyComp(const CloudKey &key, const CloudKey &data)
25 {
26 if (key.primaryKey < data.primaryKey)
27 return -1;
28 if (key.primaryKey > data.primaryKey)
29 return 1;
30 if (key.secondaryKey < data.secondaryKey)
31 return -1;
32 if (key.secondaryKey > data.secondaryKey)
33 return 1;
34 return 0;
35 }
36
37 CloudQueryRow* CloudAllocator::AllocateCloudQueryRow(void)
38 {
39 return SLNet::OP_NEW<CloudQueryRow>(_FILE_AND_LINE_);
40 }
41 void CloudAllocator::DeallocateCloudQueryRow(CloudQueryRow *row)
42 {
43 SLNet::OP_DELETE(row,_FILE_AND_LINE_);
44 }
45 unsigned char *CloudAllocator::AllocateRowData(uint32_t bytesNeededForData)
46 {
47 return (unsigned char*) rakMalloc_Ex(bytesNeededForData,_FILE_AND_LINE_);
48 }
49 void CloudAllocator::DeallocateRowData(void *data)
50 {
51 rakFree_Ex(data, _FILE_AND_LINE_);
52 }
53 void CloudKey::Serialize(bool writeToBitstream, BitStream *bitStream)
54 {
55 bitStream->Serialize(writeToBitstream, primaryKey);
56 bitStream->Serialize(writeToBitstream, secondaryKey);
57 }
58 void CloudQuery::Serialize(bool writeToBitstream, BitStream *bitStream)
59 {
60 bool startingRowIndexIsZero=0;
61 bool maxRowsToReturnIsZero=0;
62 startingRowIndexIsZero=startingRowIndex==0;
63 maxRowsToReturnIsZero=maxRowsToReturn==0;
64 bitStream->Serialize(writeToBitstream,startingRowIndexIsZero);
65 bitStream->Serialize(writeToBitstream,maxRowsToReturnIsZero);
66 bitStream->Serialize(writeToBitstream,subscribeToResults);
67 if (startingRowIndexIsZero==false)
68 bitStream->Serialize(writeToBitstream,startingRowIndex);
69 if (maxRowsToReturnIsZero==false)
70 bitStream->Serialize(writeToBitstream,maxRowsToReturn);
71 RakAssert(keys.Size()<(uint16_t)-1);
72 uint16_t numKeys = (uint16_t) keys.Size();
73 bitStream->Serialize(writeToBitstream,numKeys);
74 if (writeToBitstream)
75 {
76 for (uint16_t i=0; i < numKeys; i++)
77 {
78 keys[i].Serialize(true,bitStream);
79 }
80 }
81 else
82 {
83 CloudKey cmdk;
84 for (uint16_t i=0; i < numKeys; i++)
85 {
86 cmdk.Serialize(false,bitStream);
87 keys.Push(cmdk, _FILE_AND_LINE_);
88 }
89 }
90 }
91 void CloudQueryRow::Serialize(bool writeToBitstream, BitStream *bitStream, CloudAllocator *allocator)
92 {
93 key.Serialize(writeToBitstream,bitStream);
94 bitStream->Serialize(writeToBitstream,serverSystemAddress);
95 bitStream->Serialize(writeToBitstream,clientSystemAddress);
96 bitStream->Serialize(writeToBitstream,serverGUID);
97 bitStream->Serialize(writeToBitstream,clientGUID);
98 bitStream->Serialize(writeToBitstream,length);
99 if (writeToBitstream)
100 {
101 bitStream->WriteAlignedBytes((const unsigned char*) data,length);
102 }
103 else
104 {
105 if (length>0)
106 {
107 data = allocator->AllocateRowData(length);
108 if (data)
109 {
110 bitStream->ReadAlignedBytes((unsigned char *) data,length);
111 }
112 else
113 {
114 notifyOutOfMemory(_FILE_AND_LINE_);
115 }
116 }
117 else
118 data=0;
119 }
120 }
121 void CloudQueryResult::SerializeHeader(bool writeToBitstream, BitStream *bitStream)
122 {
123 cloudQuery.Serialize(writeToBitstream,bitStream);
124 bitStream->Serialize(writeToBitstream,subscribeToResults);
125 }
126 void CloudQueryResult::SerializeNumRows(bool writeToBitstream, uint32_t &numRows, BitStream *bitStream)
127 {
128 bitStream->Serialize(writeToBitstream,numRows);
129 }
130 void CloudQueryResult::SerializeCloudQueryRows(bool writeToBitstream, uint32_t &numRows, BitStream *bitStream, CloudAllocator *allocator)
131 {
132 if (writeToBitstream)
133 {
134 for (uint16_t i=0; i < numRows; i++)
135 {
136 rowsReturned[i]->Serialize(true,bitStream, allocator);
137 }
138 }
139 else
140 {
141 CloudQueryRow* cmdr;
142 for (uint16_t i=0; i < numRows; i++)
143 {
144 cmdr = allocator->AllocateCloudQueryRow();
145 if (cmdr)
146 {
147 cmdr->Serialize(false,bitStream,allocator);
148 if (cmdr->data==0 && cmdr->length>0)
149 {
150 allocator->DeallocateCloudQueryRow(cmdr);
151 notifyOutOfMemory(_FILE_AND_LINE_);
152 numRows=i;
153 return;
154 }
155 rowsReturned.Push(cmdr, _FILE_AND_LINE_);
156 }
157 else
158 {
159 notifyOutOfMemory(_FILE_AND_LINE_);
160 numRows=i;
161 return;
162 }
163 }
164 }
165 }
166 void CloudQueryResult::Serialize(bool writeToBitstream, BitStream *bitStream, CloudAllocator *allocator)
167 {
168 SerializeHeader(writeToBitstream, bitStream);
169 uint32_t numRows = (uint32_t) rowsReturned.Size();
170 SerializeNumRows(writeToBitstream, numRows, bitStream);
171 SerializeCloudQueryRows(writeToBitstream, numRows, bitStream, allocator);
172 }
173
174 #endif // #if _RAKNET_SUPPORT_CloudMemoryClient==1 || _RAKNET_SUPPORT_CloudMemoryServer==1
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
FileListNodeContext Member List

This is the complete list of members for FileListNodeContext, including all inherited members.

dataLength | FileListNodeContext |
dataPtr | FileListNodeContext |
FileListNodeContext() | FileListNodeContext | inline
FileListNodeContext(unsigned char o, uint32_t f1, uint32_t f2, uint32_t f3) | FileListNodeContext | inline
flnc_extraData1 | FileListNodeContext |
flnc_extraData2 | FileListNodeContext |
flnc_extraData3 | FileListNodeContext |
op | FileListNodeContext |
~FileListNodeContext() | FileListNodeContext | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • EmailSender
SLNet::EmailSender Member List

This is the complete list of members for SLNet::EmailSender, including all inherited members.

GetResponse(TCPInterface *tcpInterface, const SystemAddress &emailServer, bool doPrintf) | SLNet::EmailSender | protected
rakNetRandom | SLNet::EmailSender | protected
Send(const char *hostAddress, unsigned short hostPort, const char *sender, const char *recipient, const char *senderName, const char *recipientName, const char *subject, const char *body, FileList *attachedFiles, bool doPrintf, const char *password) | SLNet::EmailSender |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RandSync.cpp Source File

  • src
RandSync.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/RandSync.h"
17 #include "slikenet/BitStream.h"
18 #include <limits>
19 #include <limits.h>
20
21 namespace SLNet
22 {
23
24 RakNetRandomSync::RakNetRandomSync()
25 {
26 seed = (uint32_t) -1;
27 callCount = 0;
28 usedValueBufferCount = 0;
29 }
30 RakNetRandomSync::~RakNetRandomSync()
31 {
32 }
33 void RakNetRandomSync::SeedMT( uint32_t _seed )
34 {
35 seed = _seed;
36 rnr.SeedMT( seed );
37 callCount = 0;
38 usedValueBufferCount = 0;
39 }
40 void RakNetRandomSync::SeedMT( uint32_t _seed, uint32_t skipValues )
41 {
42 SeedMT(_seed);
43 Skip(skipValues);
44 }
45 float RakNetRandomSync::FrandomMT( void )
46 {
47 return ( float ) ( ( double ) RandomMT() / (double) UINT_MAX );
48 }
49 unsigned int RakNetRandomSync::RandomMT( void )
50 {
51 if (usedValueBufferCount > 0)
52 {
53 --usedValueBufferCount;
54 if (usedValueBufferCount < usedValues.Size())
55 {
56 // The remote system had less calls than the current system, so return values from the past
57 return usedValues[usedValues.Size()-usedValueBufferCount-1];
58 }
59 else
60 {
61 // Unknown past value, too far back
62 // Return true random
63 return rnr.RandomMT();
64 }
65 }
66 else
67 {
68 // Get random number and store what it is
69 usedValues.Push(rnr.RandomMT(), _FILE_AND_LINE_);
70 ++callCount;
71 while (usedValues.Size()>64)
72 usedValues.Pop();
73 return usedValues[usedValues.Size()-1];
74 }
75 }
76 uint32_t RakNetRandomSync::GetSeed( void ) const
77 {
78 return seed;
79 }
80 uint32_t RakNetRandomSync::GetCallCount( void ) const
81 {
82 return callCount;
83 }
84 void RakNetRandomSync::SetCallCount( uint32_t i )
85 {
86 callCount = i;
87 }
88 void RakNetRandomSync::SerializeConstruction(SLNet::BitStream *constructionBitstream)
89 {
90 constructionBitstream->Write(seed);
91 constructionBitstream->Write(callCount);
92 }
93 bool RakNetRandomSync::DeserializeConstruction(SLNet::BitStream *constructionBitstream)
94 {
95 uint32_t _seed;
96 uint32_t _skipValues;
97 constructionBitstream->Read(_seed);
98 bool success = constructionBitstream->Read(_skipValues);
99 if (success)
100 SeedMT(_seed, _skipValues);
101 return success;
102 }
103 void RakNetRandomSync::Serialize(SLNet::BitStream *outputBitstream)
104 {
105 outputBitstream->Write(callCount);
106 }
107 void RakNetRandomSync::Deserialize(SLNet::BitStream *outputBitstream)
108 {
109 uint32_t _callCount;
110 outputBitstream->Read(_callCount);
111 if (_callCount < callCount )
112 {
113 // We locally read more values than the remote system
114 // The next n calls should come from buffered values
115 usedValueBufferCount = callCount - _callCount;
116 }
117 else if (_callCount > callCount )
118 {
119 // Remote system read more values than us
120 uint32_t diff = _callCount - callCount;
121 if (diff <= usedValueBufferCount)
122 usedValueBufferCount -= diff;
123 if (diff > 0)
124 Skip(diff);
125 }
126 }
127 void RakNetRandomSync::Skip( uint32_t count )
128 {
129 for (uint32_t i = 0; i < count; i++)
130 rnr.RandomMT();
131 callCount+=count;
132 }
133
134 } // namespace SLNet
135
136 /*
137 RakNetRandomSync r1, r2;
138 BitStream bsTest;
139 r1.SeedMT(0);
140 r1.SerializeConstruction(&bsTest);
141 bsTest.SetReadOffset(0);
142 r2.DeserializeConstruction(&bsTest);
143 printf("1. (r1) %f\n", r1.FrandomMT());
144 printf("1. (r2) %f\n", r2.FrandomMT());
145 printf("2. (r1) %f\n", r1.FrandomMT());
146 printf("2. (r2) %f\n", r2.FrandomMT());
147 printf("3. (r1) %f\n", r1.FrandomMT());
148 printf("3. (r2) %f\n", r2.FrandomMT());
149 printf("4. (r1) %f\n", r1.FrandomMT());
150 printf("4. (r2) %f\n", r2.FrandomMT());
151 printf("5. (r2) %f\n", r2.FrandomMT());
152 printf("6. (r2) %f\n", r2.FrandomMT());
153 printf("7. (r2) %f\n", r2.FrandomMT());
154 bsTest.Reset();
155 r1.Serialize(&bsTest);
156 bsTest.SetReadOffset(0);
157 r2.Deserialize(&bsTest);
158 printf("Synched r2 to match r1\n");
159 printf("5. (r1) %f\n", r1.FrandomMT());
160 printf("5. (r2) %f --Should continue sequence from 5-\n", r2.FrandomMT());
161 printf("6. (r1) %f\n", r1.FrandomMT());
162 printf("6. (r2) %f\n", r2.FrandomMT());
163 printf("7. (r1) %f -- Extra call to r1, no r2 equivalent --\n", r1.FrandomMT());
164 printf("8. (r1) %f -- Extra call to r1, no r2 equivalent --\n", r1.FrandomMT());
165 bsTest.Reset();
166 r1.Serialize(&bsTest);
167 bsTest.SetReadOffset(0);
168 r2.Deserialize(&bsTest);
169 printf("Synched r2 to match r1\n");
170 printf("9. (r1) %f\n", r1.FrandomMT());
171 printf("9. (r2) %f --SKIPPED 7,8, SHOULD MATCH 9-\n", r2.FrandomMT());
172 */
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetSocket2Allocator
SLNet::RakNetSocket2Allocator Member List

This is the complete list of members for SLNet::RakNetSocket2Allocator, including all inherited members.

AllocRNS2(void) | SLNet::RakNetSocket2Allocator | static
DeallocRNS2(RakNetSocket2 *s) | SLNet::RakNetSocket2Allocator | static
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetCommandParser.cpp Source File

  • src
RakNetCommandParser.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_RakNetCommandParser==1
18
19 #include "slikenet/commandparser.h"
20 #include "slikenet/TransportInterface.h"
21 #include "slikenet/peerinterface.h"
22 #include "slikenet/BitStream.h"
23 #include "slikenet/assert.h"
24 #include <stdio.h>
25 #include <string.h>
26 #include <stdlib.h>
27
28 using namespace SLNet;
29
30 STATIC_FACTORY_DEFINITIONS(RakNetCommandParser,RakNetCommandParser);
31
32 RakNetCommandParser::RakNetCommandParser()
33 {
34 RegisterCommand(4, "Startup","( unsigned int maxConnections, unsigned short localPort, const char *forceHostAddress );");
35 RegisterCommand(0,"InitializeSecurity","();");
36 RegisterCommand(0,"DisableSecurity","( void );");
37 RegisterCommand(1,"AddToSecurityExceptionList","( const char *ip );");
38 RegisterCommand(1,"RemoveFromSecurityExceptionList","( const char *ip );");
39 RegisterCommand(1,"IsInSecurityExceptionList","( const char *ip );");
40 RegisterCommand(1,"SetMaximumIncomingConnections","( unsigned short numberAllowed );");
41 RegisterCommand(0,"GetMaximumIncomingConnections","( void ) const;");
42 RegisterCommand(4,"Connect","( const char* host, unsigned short remotePort, const char *passwordData, int passwordDataLength );");
43 RegisterCommand(2,"Disconnect","( unsigned int blockDuration, unsigned char orderingChannel=0 );");
44 RegisterCommand(0,"IsActive","( void ) const;");
45 RegisterCommand(0,"GetConnectionList","() const;");
46 RegisterCommand(3,"CloseConnection","( const SystemAddress target, bool sendDisconnectionNotification, unsigned char orderingChannel=0 );");
47 RegisterCommand(2,"IsConnected","( );");
48 RegisterCommand(1,"GetIndexFromSystemAddress","( const SystemAddress systemAddress );");
49 RegisterCommand(1,"GetSystemAddressFromIndex","( unsigned int index );");
50 RegisterCommand(2,"AddToBanList","( const char *IP, SLNet::TimeMS milliseconds=0 );");
51 RegisterCommand(1,"RemoveFromBanList","( const char *IP );");
52 RegisterCommand(0,"ClearBanList","( void );");
53 RegisterCommand(1,"IsBanned","( const char *IP );");
54 RegisterCommand(1,"Ping1","( const SystemAddress target );");
55 RegisterCommand(3,"Ping2","( const char* host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections );");
56 RegisterCommand(1,"GetAveragePing","( const SystemAddress systemAddress );");
57 RegisterCommand(1,"GetLastPing","( const SystemAddress systemAddress ) const;");
58 RegisterCommand(1,"GetLowestPing","( const SystemAddress systemAddress ) const;");
59 RegisterCommand(1,"SetOccasionalPing","( bool doPing );");
60 RegisterCommand(2,"SetOfflinePingResponse","( const char *data, const unsigned int length );");
61 RegisterCommand(0,"GetInternalID","( void ) const;");
62 RegisterCommand(1,"GetExternalID","( const SystemAddress target ) const;");
63 RegisterCommand(2,"SetTimeoutTime","( SLNet::TimeMS timeMS, const SystemAddress target );");
64 // RegisterCommand(1,"SetMTUSize","( int size );");
65 RegisterCommand(0,"GetMTUSize","( void ) const;");
66 RegisterCommand(0,"GetNumberOfAddresses","( void );");
67 RegisterCommand(1,"GetLocalIP","( unsigned int index );");
68 RegisterCommand(1,"AllowConnectionResponseIPMigration","( bool allow );");
69 RegisterCommand(4,"AdvertiseSystem","( const char *host, unsigned short remotePort, const char *data, int dataLength );");
70 RegisterCommand(2,"SetIncomingPassword","( const char* passwordData, int passwordDataLength );");
71 RegisterCommand(0,"GetIncomingPassword","( void );");
72 RegisterCommand(0,"IsNetworkSimulatorActive","( void );");
73 }
74 RakNetCommandParser::~RakNetCommandParser()
75 {
76 }
77 void RakNetCommandParser::SetRakPeerInterface(SLNet::RakPeerInterface *rakPeer)
78 {
79 peer=rakPeer;
80 }
81 bool RakNetCommandParser::OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)
82 {
83 (void) originalString;
84 (void) numParameters;
85
86 if (peer==0)
87 return false;
88
89 if (strcmp(command, "Startup")==0)
90 {
91 SLNet::SocketDescriptor socketDescriptor((unsigned short)atoi(parameterList[1]), parameterList[2]);
92 ReturnResult(peer->Startup((unsigned short)atoi(parameterList[0]), &socketDescriptor, 1), command, transport, systemAddress);
93 }
94 else if (strcmp(command, "InitializeSecurity")==0)
95 {
96 ReturnResult(peer->InitializeSecurity(parameterList[0],parameterList[1]), command, transport, systemAddress);
97 }
98 else if (strcmp(command, "DisableSecurity")==0)
99 {
100 peer->DisableSecurity();
101 ReturnResult(command, transport, systemAddress);
102 }
103 else if (strcmp(command, "AddToSecurityExceptionList")==0)
104 {
105 peer->AddToSecurityExceptionList(parameterList[1]);
106 ReturnResult(command, transport, systemAddress);
107 }
108 else if (strcmp(command, "RemoveFromSecurityExceptionList")==0)
109 {
110 peer->RemoveFromSecurityExceptionList(parameterList[1]);
111 ReturnResult(command, transport, systemAddress);
112 }
113 else if (strcmp(command, "IsInSecurityExceptionList")==0)
114 {
115 ReturnResult(peer->IsInSecurityExceptionList(parameterList[1]),command, transport, systemAddress);
116 }
117 else if (strcmp(command, "SetMaximumIncomingConnections")==0)
118 {
119 peer->SetMaximumIncomingConnections((unsigned short)atoi(parameterList[0]));
120 ReturnResult(command, transport, systemAddress);
121 }
122 else if (strcmp(command, "GetMaximumIncomingConnections")==0)
123 {
124 ReturnResult((int) peer->GetMaximumIncomingConnections(), command, transport, systemAddress);
125 }
126 else if (strcmp(command, "Connect")==0)
127 {
128 ReturnResult(peer->Connect(parameterList[0], (unsigned short)atoi(parameterList[1]),parameterList[2],atoi(parameterList[3]))== SLNet::CONNECTION_ATTEMPT_STARTED, command, transport, systemAddress);
129 }
130 else if (strcmp(command, "Disconnect")==0)
131 {
132 peer->Shutdown(atoi(parameterList[0]), (unsigned char)atoi(parameterList[1]));
133 ReturnResult(command, transport, systemAddress);
134 }
135 else if (strcmp(command, "IsActive")==0)
136 {
137 ReturnResult(peer->IsActive(), command, transport, systemAddress);
138 }
139 else if (strcmp(command, "GetConnectionList")==0)
140 {
141 SystemAddress remoteSystems[32];
142 unsigned short count=32;
143 unsigned i;
144 if (peer->GetConnectionList(remoteSystems, &count))
145 {
146 if (count==0)
147 {
148 transport->Send(systemAddress, "GetConnectionList() returned no systems connected.\r\n");
149 }
150 else
151 {
152 transport->Send(systemAddress, "GetConnectionList() returned:\r\n");
153 for (i=0; i < count; i++)
154 {
155 char str1[64];
156 remoteSystems[i].ToString(true, str1, static_cast<size_t>(64));
157 transport->Send(systemAddress, "%i %s\r\n", i, str1);
158 }
159 }
160 }
161 else
162 transport->Send(systemAddress, "GetConnectionList() returned false.\r\n");
163 }
164 else if (strcmp(command, "CloseConnection")==0)
165 {
166 peer->CloseConnection(SystemAddress(parameterList[0]), atoi(parameterList[1])!=0,(unsigned char)atoi(parameterList[2]));
167 ReturnResult(command, transport, systemAddress);
168 }
169 else if (strcmp(command, "GetConnectionState")==0)
170 {
171 ReturnResult((int) peer->GetConnectionState(SystemAddress(parameterList[0])), command, transport, systemAddress);
172 }
173 else if (strcmp(command, "GetIndexFromSystemAddress")==0)
174 {
175 ReturnResult(peer->GetIndexFromSystemAddress(SystemAddress(parameterList[0])), command, transport, systemAddress);
176 }
177 else if (strcmp(command, "GetSystemAddressFromIndex")==0)
178 {
179 ReturnResult(peer->GetSystemAddressFromIndex(atoi(parameterList[0])), command, transport, systemAddress);
180 }
181 else if (strcmp(command, "AddToBanList")==0)
182 {
183 peer->AddToBanList(parameterList[0], atoi(parameterList[1]));
184 ReturnResult(command, transport, systemAddress);
185 }
186 else if (strcmp(command, "RemoveFromBanList")==0)
187 {
188 peer->RemoveFromBanList(parameterList[0]);
189 ReturnResult(command, transport, systemAddress);
190 }
191 else if (strcmp(command, "ClearBanList")==0)
192 {
193 peer->ClearBanList();
194 ReturnResult(command, transport, systemAddress);
195 }
196 else if (strcmp(command, "IsBanned")==0)
197 {
198 ReturnResult(peer->IsBanned(parameterList[0]), command, transport, systemAddress);
199 }
200 else if (strcmp(command, "Ping1")==0)
201 {
202 peer->Ping(SystemAddress(parameterList[0]));
203 ReturnResult(command, transport, systemAddress);
204 }
205 else if (strcmp(command, "Ping2")==0)
206 {
207 peer->Ping(parameterList[0], (unsigned short) atoi(parameterList[1]), atoi(parameterList[2])!=0);
208 ReturnResult(command, transport, systemAddress);
209 }
210 else if (strcmp(command, "GetAveragePing")==0)
211 {
212 ReturnResult(peer->GetAveragePing(SystemAddress(parameterList[0])), command, transport, systemAddress);
213 }
214 else if (strcmp(command, "GetLastPing")==0)
215 {
216 ReturnResult(peer->GetLastPing(SystemAddress(parameterList[0])), command, transport, systemAddress);
217 }
218 else if (strcmp(command, "GetLowestPing")==0)
219 {
220 ReturnResult(peer->GetLowestPing(SystemAddress(parameterList[0])), command, transport, systemAddress);
221 }
222 else if (strcmp(command, "SetOccasionalPing")==0)
223 {
224 peer->SetOccasionalPing(atoi(parameterList[0])!=0);
225 ReturnResult(command, transport, systemAddress);
226 }
227 else if (strcmp(command, "SetOfflinePingResponse")==0)
228 {
229 peer->SetOfflinePingResponse(parameterList[0], atoi(parameterList[1]));
230 ReturnResult(command, transport, systemAddress);
231 }
232 else if (strcmp(command, "GetInternalID")==0)
233 {
234 ReturnResult(peer->GetInternalID(), command, transport, systemAddress);
235 }
236 else if (strcmp(command, "GetExternalID")==0)
237 {
238 ReturnResult(peer->GetExternalID(SystemAddress(parameterList[0])), command, transport, systemAddress);
239 }
240 else if (strcmp(command, "SetTimeoutTime")==0)
241 {
242 peer->SetTimeoutTime(atoi(parameterList[0]), SystemAddress(parameterList[1]));
243 ReturnResult(command, transport, systemAddress);
244 }
245 /*
246 else if (strcmp(command, "SetMTUSize")==0)
247 {
248 ReturnResult(peer->SetMTUSize(atoi(parameterList[0]), UNASSIGNED_SYSTEM_ADDRESS), command, transport, systemAddress);
249 }
250 */
251 else if (strcmp(command, "GetMTUSize")==0)
252 {
253 ReturnResult(peer->GetMTUSize(UNASSIGNED_SYSTEM_ADDRESS), command, transport, systemAddress);
254 }
255 else if (strcmp(command, "GetNumberOfAddresses")==0)
256 {
257 ReturnResult((int)peer->GetNumberOfAddresses(), command, transport, systemAddress);
258 }
259 else if (strcmp(command, "GetLocalIP")==0)
260 {
261 ReturnResult((char*) peer->GetLocalIP(atoi(parameterList[0])), command, transport, systemAddress);
262 }
263 else if (strcmp(command, "AllowConnectionResponseIPMigration")==0)
264 {
265 peer->AllowConnectionResponseIPMigration(atoi(parameterList[0])!=0);
266 ReturnResult(command, transport, systemAddress);
267 }
268 else if (strcmp(command, "AdvertiseSystem")==0)
269 {
270 peer->AdvertiseSystem(parameterList[0], (unsigned short) atoi(parameterList[1]),parameterList[2],atoi(parameterList[3]));
271 ReturnResult(command, transport, systemAddress);
272 }
273 else if (strcmp(command, "SetIncomingPassword")==0)
274 {
275 peer->SetIncomingPassword(parameterList[0], atoi(parameterList[1]));
276 ReturnResult(command, transport, systemAddress);
277 }
278 else if (strcmp(command, "GetIncomingPassword")==0)
279 {
280 char password[256];
281 int passwordLength;
282 peer->GetIncomingPassword(password, &passwordLength);
283 if (passwordLength)
284 ReturnResult((char*)password, command, transport, systemAddress);
285 else
286 ReturnResult(0, command, transport, systemAddress);
287 }
288
289 return true;
290 }
291 const char *RakNetCommandParser::GetName(void) const
292 {
293 return "RakNet";
294 }
295 void RakNetCommandParser::SendHelp(TransportInterface *transport, const SystemAddress &systemAddress)
296 {
297 if (peer)
298 {
299 transport->Send(systemAddress, "The RakNet parser provides mirror functions to RakPeer\r\n");
300 transport->Send(systemAddress, "SystemAddresss take two parameters: send <BinaryAddress> <Port>.\r\n");
301 transport->Send(systemAddress, "For bool, send 1 or 0.\r\n");
302 }
303 else
304 {
305 transport->Send(systemAddress, "Parser not active. Call SetRakPeerInterface.\r\n");
306 }
307 }
308
309 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • Rackspace2EventCallback
SLNet::Rackspace2EventCallback Member List

This is the complete list of members for SLNet::Rackspace2EventCallback, including all inherited members.

OnAuthenticationResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnConfirmResizedServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnConnectionAttemptFailure(RackspaceOperationType operationType, const char *url)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnCreateImageResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnCreateServerResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnCreateSharedIPGroup(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnDeleteImageResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnDeleteServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnDeleteServerAddress(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnDeleteSharedIPGroup(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnGetFlavorDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnGetImageDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnGetServerDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnGetSharedIPGroupDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnListFlavorsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnListImagesResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnListServerAddresses(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnListServersResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnListServersWithDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnListSharedIPGroups(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnListSharedIPGroupsWithDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnRebootServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnRebuildServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnResizeServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnRevertResizedServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnShareServerAddress(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
OnUpdateServerNameOrPassword(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0 | SLNet::Rackspace2EventCallback | pure virtual
Rackspace2EventCallback() | SLNet::Rackspace2EventCallback | inline
~Rackspace2EventCallback() | SLNet::Rackspace2EventCallback | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/osx_adapter.cpp Source File

  • src
osx_adapter.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
3 *
4 * This source code is licensed under the MIT-style license found in the
5 * license.txt file in the root directory of this source tree.
6 *
7 *
8 * This file defines adapters for all MS-specific functions used throughout SLikeNet.
9 */
10
11 #ifdef __APPLE__
12 #include "slikenet/osx_adapter.h"
13
14 #include <algorithm> // for std::max, std::min
15 #include <cerrno> // for errno
16 #include <cstdio> // for FILE, fopen, vsnprintf
17 #include <cstdlib> // for mbstowcs
18 #include <cstring> // for strcat, strcpy, strerror, strncat, strncpy
19 #include <cstdarg> // for va_start, va_end, va_list
20 #include <ctime> // for localtime, time_t
21 #include <cwchar> // for wcscat, wcscpy, wcslen
22
23 errno_t fopen_s(FILE **pfile, const char *filename, const char *mode)
24 {
25 if ((pfile == nullptr) || (filename == nullptr) || (mode == nullptr)) {
26 return 22; // error: EINVAL
27 }
28
29 FILE *file = fopen(filename, mode);
30 if (file == nullptr) {
31 return errno;
32 }
33
34 *pfile = file;
35 return 0;
36 }
37
38 errno_t localtime_s(struct tm *_tm, const time_t *time)
39 {
40 // #med - should actually also check for _*time > _MAX_TIME64_T according to MSDN, but can't seem to find the
41 // definition of _MAX_TIME64_T
42 if ((_tm == nullptr) || (time == nullptr) || (*time == 0)) {
43 if (_tm != nullptr) {
44 _tm->tm_hour = -1;
45 _tm->tm_isdst = -1;
46 _tm->tm_mday = -1;
47 _tm->tm_min = -1;
48 _tm->tm_mon = -1;
49 _tm->tm_sec = -1;
50 _tm->tm_wday = -1;
51 _tm->tm_yday = -1;
52 _tm->tm_year = -1;
53 }
54 return 22; // error: EINVAL
55 }
56
57 struct tm *curTime = localtime(time);
58 *_tm = *curTime;
59
60 return 0;
61 }
62
63 errno_t mbstowcs_s(size_t *pReturnValue, wchar_t *wcstr, size_t sizeInWords, const char *mbstr, size_t count)
64 {
65 if ((mbstr == nullptr) || ((wcstr == nullptr) && (sizeInWords > 0)) || ((wcstr != nullptr) && (sizeInWords != 0))) {
66 if (wcstr != nullptr) {
67 wcstr[0] = L'\0'; // ensure 0-termination
68 }
69 return 22; // error: EINVAL
70 }
71
72 size_t numMaxChars = sizeInWords;
73 if (count != _TRUNCATE) {
74 numMaxChars = std::min(numMaxChars, count);
75 }
76
77 size_t numCharsWritten = mbstowcs(wcstr, mbstr, numMaxChars);
78 if (numCharsWritten == (size_t)-1) {
79 // invalid multibyte character encountered
80 if (pReturnValue != nullptr) {
81 *pReturnValue = 0;
82 }
83 if (wcstr != nullptr) {
84 wcstr[0] = L'\0'; // ensure 0-termination
85 }
86 return 42; // error: EILSEQ
87 }
88
89 if (numCharsWritten == numMaxChars) {
90 if (wcstr != nullptr) {
91 wcstr[0] = L'\0'; // ensure 0-termination
92 }
93 return 34; // error: ERANGE
94 }
95
96 if (pReturnValue != nullptr) {
97 *pReturnValue = numCharsWritten + 1; // chars written, including terminating null character
98 }
99
100 // ensure we write a terminating null character (in case there was none in the original converted string)
101 if (wcstr != nullptr) {
102 wcstr[numCharsWritten] = L'\0'; // ensure 0-termination
103 }
104
105 return 0;
106 }
107
108 int sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...)
109 {
110 if ((buffer == nullptr) || (sizeOfBuffer == 0) || (format == nullptr)) {
111 return -1;
112 }
113
114 va_list arglist;
115 va_start(arglist, format);
116 int numCharsWritten = vsnprintf(buffer, sizeOfBuffer, format, arglist);
117 va_end(arglist);
118
119 if (numCharsWritten == -1) {
120 buffer[0] = '\0'; // error occurred ensure terminating \0-character
121 return -1;
122 }
123
124 if (numCharsWritten >= sizeOfBuffer) {
125 buffer[0] = '\0'; // buffer too small, write empty string to ensure terminating \0-char
126 }
127
128 return numCharsWritten;
129 }
130
131 errno_t strcat_s(char *strDestination, size_t numberOfElements, const char *strSource)
132 {
133 if ((strDestination == nullptr) || (strSource == nullptr)) {
134 if (strDestination != nullptr) {
135 strDestination[0] = '\0'; // ensure trailing \0 is written
136 }
137 return 22; // error: EINVAL
138 }
139
140 if (numberOfElements == 0) {
141 strDestination[0] = '\0'; // ensure trailing \0 is written
142 return 34; // error: ERANGE
143 }
144
145 const size_t destLen = strlen(strDestination);
146 const size_t sourceLen = strlen(strSource);
147 if ((destLen > numberOfElements - 1) || ((sourceLen > 0) && (destLen == numberOfElements - 1)) || (sourceLen > numberOfElements - destLen - 1)) {
148 strDestination[0] = '\0'; // ensure trailing \0 is written
149 return 34; // error: ERANGE
150 }
151
152 (void)strcat(strDestination, strSource);
153 return 0;
154 }
155
156 errno_t strcpy_s(char* strDestination, size_t numberOfElements, const char *strSource)
157 {
158 if ((strDestination == nullptr) || (strSource == nullptr)) {
159 if (strDestination != nullptr) {
160 strDestination[0] = '\0'; // ensure trailing \0 is written
161 }
162 return 22; // error: EINVAL
163 }
164
165 if ((numberOfElements == 0) || (strlen(strSource) >= numberOfElements)) {
166 strDestination[0] = '\0'; // ensure trailing \0 is written
167 return 34; // error: ERANGE
168 }
169
170 (void)strcpy(strDestination, strSource);
171 return 0;
172 }
173
174 errno_t strerror_s(char* buffer, size_t numberOfElements, int errnum)
175 {
176 // check valid parameters
177 if ((buffer == nullptr) || (numberOfElements == 0)) {
178 return 22; // error: EINVAL
179 }
180
181 const char *errorMessage = strerror(errnum);
182 return strcpy_s(buffer, numberOfElements, errorMessage);
183 }
184
185 errno_t strncat_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
186 {
187 // check valid parameters
188 if ((strDest == nullptr) || (strSource == nullptr)) {
189 return 22; // error: EINVAL
190 }
191
192 if (numberOfElements == 0) {
193 return 34; // error: ERANGE
194 }
195
196 size_t charsToWrite;
197 const size_t sourceLen = strlen(strSource);
198 if (count == _TRUNCATE) {
199 charsToWrite = sourceLen;
200 }
201 else {
202 charsToWrite = std::min(count, sourceLen);
203 }
204
205 const size_t destLen = strlen(strDest);
206 const size_t sizeLeft = numberOfElements - destLen;
207
208 if (((count != _TRUNCATE) && (charsToWrite > sizeLeft - 1)) || ((sourceLen > 0) && (destLen == numberOfElements - 1))) {
209 strDest[0] = '\0'; // ensure trailing \0 is written
210 return 34; // error: ERANGE
211 }
212
213 (void)strncat(strDest, strSource, charsToWrite);
214 return 0;
215 }
216
217 errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
218 {
219 // check valid parameters
220 if ((numberOfElements == 0) || (strDest == nullptr) || (strSource == nullptr)) {
221 if (strDest != nullptr) {
222 strDest[0] = '\0'; // ensure trailing \0 is written
223 }
224 return 22; // error: EINVAL
225 }
226
227 size_t numChars;
228 bool truncated = false;
229 if (count == _TRUNCATE) {
230 // if count == _TRUNCATE use the length of the source string
231 numChars = strlen(strSource);
232
233 // ensure we are not exceeding numberOfElements
234 if (numChars >= numberOfElements) {
235 numChars = numberOfElements - 1;
236 truncated = true; // we are going to truncate the copied string
237 }
238 }
239 else {
240 // otherwise we use count, but have to check that the destination buffer is of sufficient size
241 if ((count > numberOfElements) || ((count == numberOfElements) && (strSource[count] != '\0'))) {
242 strDest[0] = '\0'; // ensure trailing \0 is written
243 return 34; // error: ERANGE
244 }
245 numChars = count;
246 }
247
248 (void)strncpy(strDest, strSource, numChars);
249
250 // enforce the trailing \0
251 strDest[numChars] = '\0';
252
253 return truncated ? 80 : 0; // STRUNCATE, if we truncated the string, 0 otherwise
254 }
255
256 int vsnprintf_s(char *buffer, size_t sizeOfBuffer, size_t count, const char *format, va_list argptr)
257 {
258 if ((buffer == nullptr) || (format == nullptr) || (sizeOfBuffer == 0)) {
259 return -1;
260 }
261
262 size_t maxChars = sizeOfBuffer;
263 if (count != _TRUNCATE) {
264 if (count >= sizeOfBuffer) {
265 buffer[0] = '\0'; // ensure trailing \0 is written
266 return -1;
267 }
268 maxChars = count;
269 }
270
271 int numCharsWritten = vsnprintf(buffer, maxChars, format, argptr);
272 if (numCharsWritten >= maxChars) {
273 if (count != _TRUNCATE) {
274 buffer[0] = '\0'; // buffer set to empty string
275 return -1;
276 }
277
278 // truncation occurred, add terminating \0
279 buffer[sizeOfBuffer] = '\0';
280 }
281
282 return numCharsWritten;
283 }
284
285 errno_t wcscat_s(wchar_t *strDestination, size_t numberOfElements, const wchar_t *strSource)
286 {
287 if ((strDestination == nullptr) || (strSource == nullptr)) {
288 if (strDestination != nullptr) {
289 strDestination[0] = L'\0'; // ensure trailing \0 is written
290 }
291 return 22; // error: EINVAL
292 }
293
294 if (numberOfElements == 0) {
295 strDestination[0] = L'\0'; // ensure trailing \0 is written
296 return 34; // error: ERANGE
297 }
298
299 const size_t destLen = wcslen(strDestination);
300 const size_t sourceLen = wcslen(strSource);
301 if ((destLen > numberOfElements - 1) || ((sourceLen > 0) && (destLen == numberOfElements)) || (sourceLen > numberOfElements - destLen - 1)) {
302 strDestination[0] = L'\0'; // ensure trailing \0 is written
303 return 34; // error: ERANGE
304 }
305
306 (void)wcscat(strDestination, strSource);
307 return 0;
308 }
309
310 errno_t wcscpy_s(wchar_t* strDestination, size_t numberOfElements, const wchar_t *strSource)
311 {
312 if ((strDestination == nullptr) || (strSource == nullptr)) {
313 if (strDestination != nullptr) {
314 strDestination[0] = L'\0'; // ensure trailing \0 is written
315 }
316 return 22; // error: EINVAL
317 }
318
319 if ((numberOfElements == 0) || (wcslen(strSource) >= numberOfElements)) {
320 strDestination[0] = L'\0'; // ensure trailing \0 is written
321 return 34; // error: ERANGE
322 }
323
324 (void)wcscpy(strDestination, strSource);
325 return 0;
326 }
327
328 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/_FindFirst.h Source File

  • include
  • slikenet
_FindFirst.h
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 *
5 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
6 *
7 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
8 * license found in the license.txt file in the root directory of this source tree.
9 */
10
15
16 #ifndef GCC_FINDFIRST_H
17 #define GCC_FINDFIRST_H
18
19 #if (defined(__GNUC__) || defined(__ARMCC_VERSION) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(__WIN32)
20
21 #include <dirent.h>
22
23 #include "string.h"
24
25 #define _A_NORMAL 0x00 // Normal file
26 #define _A_RDONLY 0x01 // Read-only file
27 #define _A_HIDDEN 0x02 // Hidden file
28 #define _A_SYSTEM 0x04 // System file
29 #define _A_VOLID 0x08 // Volume ID
30 #define _A_SUBDIR 0x10 // Subdirectory
31 #define _A_ARCH 0x20 // File changed since last archive
32 #define FA_NORMAL 0x00 // Synonym of _A_NORMAL
33 #define FA_RDONLY 0x01 // Synonym of _A_RDONLY
34 #define FA_HIDDEN 0x02 // Synonym of _A_HIDDEN
35 #define FA_SYSTEM 0x04 // Synonym of _A_SYSTEM
36 #define FA_LABEL 0x08 // Synonym of _A_VOLID
37 #define FA_DIREC 0x10 // Synonym of _A_SUBDIR
38 #define FA_ARCH 0x20 // Synonym of _A_ARCH
39
40
41 const unsigned STRING_BUFFER_SIZE = 512;
42
43 typedef struct _finddata_t
44 {
45 char name[STRING_BUFFER_SIZE];
46 int attrib;
47 unsigned long size;
48 } _finddata;
49
53 typedef struct _findinfo_t
54 {
55 DIR* openedDir;
56 SLNet::RakString filter;
57 SLNet::RakString dirName;
58 } _findinfo;
59
60 long _findfirst(const char *name, _finddata_t *f);
61 int _findnext(long h, _finddata_t *f);
62 int _findclose(long h);
63
64 #endif
65 #endif
66
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/wstring.h Source File

  • include
  • slikenet
wstring.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __RAK_W_STRING_H
17 #define __RAK_W_STRING_H
18
19 #include "Export.h"
20 #include "types.h" // int64_t
21 #include "string.h"
22
23 #ifdef _WIN32
24
25
26
27 #include "WindowsIncludes.h"
28 #endif
29
30 namespace SLNet
31 {
33 class RAK_DLL_EXPORT RakWString
34 {
35 public:
36 // Constructors
37 RakWString();
38 RakWString( const RakString &right );
39 RakWString( const wchar_t *input );
40 RakWString( const RakWString & right);
41 RakWString( const char *input );
42 ~RakWString();
43
45 operator wchar_t* () const {if (c_str) return c_str; return (wchar_t*) L"";}
46
48 const wchar_t* C_String(void) const {if (c_str) return c_str; return (const wchar_t*) L"";}
49
51 RakWString& operator = ( const RakWString& right );
52 RakWString& operator = ( const RakString& right );
53 RakWString& operator = ( const wchar_t * const str );
54 RakWString& operator = ( wchar_t *str );
55 RakWString& operator = ( const char * const str );
56 RakWString& operator = ( char *str );
57
59 RakWString& operator +=( const RakWString& right);
60 RakWString& operator += ( const wchar_t * const right );
61 RakWString& operator += ( wchar_t *right );
62
64 bool operator==(const RakWString &right) const;
65
66 // Comparison
67 bool operator < ( const RakWString& right ) const;
68 bool operator <= ( const RakWString& right ) const;
69 bool operator > ( const RakWString& right ) const;
70 bool operator >= ( const RakWString& right ) const;
71
73 bool operator!=(const RakWString &right) const;
74
76 void Set( wchar_t *str );
77
79 bool IsEmpty(void) const;
80
82 size_t GetLength(void) const;
83
85 static unsigned long ToInteger(const RakWString &rs);
86
88 int StrCmp(const RakWString &right) const;
89
91 int StrICmp(const RakWString &right) const;
92
94 void Clear(void);
95
97 void Printf(void);
98
100 void FPrintf(FILE *fp);
101
104 void Serialize(BitStream *bs) const;
105
107 static void Serialize(const wchar_t * const str, BitStream *bs);
108
112 bool Deserialize(BitStream *bs);
113
115 static bool Deserialize(wchar_t *str, BitStream *bs);
116 static bool Deserialize(wchar_t *str, size_t strLength, BitStream *bs);
117
118
119 protected:
120 wchar_t* c_str;
121 size_t c_strCharLength;
122 };
123
124 }
125
126 const SLNet::RakWString RAK_DLL_EXPORT operator+(const SLNet::RakWString &lhs, const SLNet::RakWString &rhs);
127
128
129 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/InternalPacket.h Source File

  • include
  • slikenet
InternalPacket.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #ifndef __INTERNAL_PACKET_H
21 #define __INTERNAL_PACKET_H
22
23 #include "PacketPriority.h"
24 #include "types.h"
25 #include "memoryoverride.h"
26 #include "defines.h"
27 #include "NativeTypes.h"
28 #include "defines.h"
29 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL!=1
30 #include "CCRakNetUDT.h"
31 #else
32 #include "CCRakNetSlidingWindow.h"
33 #endif
34
35 namespace SLNet {
36
37 typedef uint16_t SplitPacketIdType;
38 typedef uint32_t SplitPacketIndexType;
39
42 typedef uint24_t MessageNumberType;
43
46 typedef MessageNumberType OrderingIndexType;
47
48 typedef SLNet::TimeUS RemoteSystemTimeType;
49
50 struct InternalPacketFixedSizeTransmissionHeader
51 {
53 MessageNumberType reliableMessageNumber;
55 OrderingIndexType orderingIndex;
56 // Used only with sequenced messages
57 OrderingIndexType sequencingIndex;
59 unsigned char orderingChannel;
61 SplitPacketIdType splitPacketId;
63 SplitPacketIndexType splitPacketIndex;
65 SplitPacketIndexType splitPacketCount;;
67 BitSize_t dataBitLength;
69 PacketReliability reliability;
70 // Not endian safe
71 // unsigned char priority : 3;
72 // unsigned char reliability : 5;
73 };
74
76 struct InternalPacketRefCountedData
77 {
78 unsigned char *sharedDataBlock;
79 unsigned int refCount;
80 };
81
84 struct InternalPacket : public InternalPacketFixedSizeTransmissionHeader
85 {
87 MessageNumberType messageInternalOrder;
91 bool messageNumberAssigned;
93 // bool allowWindowUpdate;
95 SLNet::TimeUS creationTime;
97 SLNet::TimeUS nextActionTime;
98 // For debugging
99 SLNet::TimeUS retransmissionTime;
100 // Size of the header when encoded into a bitstream
101 BitSize_t headerLength;
103 unsigned char *data;
105 enum AllocationScheme
106 {
108 NORMAL,
109
111 REF_COUNTED,
112
115 STACK
116 } allocationScheme;
117 InternalPacketRefCountedData *refCountedData;
119 unsigned char timesSent;
121 PacketPriority priority;
123 uint32_t sendReceiptSerial;
124
125 // Used for the resend queue
126 // Linked list implementation so I can remove from the list via a pointer, without finding it in the list
127 InternalPacket *resendPrev, *resendNext,*unreliablePrev,*unreliableNext;
128
129 unsigned char stackData[128];
130 };
131
132 } // namespace SLNet
133
134 #endif
135
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket.cpp Source File

  • src
RakNetSocket.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 /*
17 #include "slikenet/socket.h"
18 #include "slikenet/memoryoverride.h"
19
20 using namespace SLNet;
21
22 #if defined(__native_client__)
23 using namespace pp;
24 #endif
25
26 RakNetSocket::RakNetSocket() {
27 #if !defined(WINDOWS_STORE_RT)
28 s = 0;
29 #endif
30 remotePortRakNetWasStartedOn_PS3_PSP2 = 0;
31 userConnectionSocketIndex = (unsigned int) -1;
32 socketFamily = 0;
33 blockingSocket = 0;
34 extraSocketOptions = 0;
35 chromeInstance = 0;
36
37 #if defined (_WIN32) && defined(USE_WAIT_FOR_MULTIPLE_EVENTS)
38 recvEvent=INVALID_HANDLE_VALUE;
39 #endif
40
41 #ifdef __native_client__
42 s = 0;
43 sendInProgress = false;
44 nextSendSize = 0;
45 #endif
46 }
47 RakNetSocket::~RakNetSocket()
48 {
49 #ifdef __native_client__
50 if(s != 0)
51 ((PPB_UDPSocket_Private_0_4*) pp::Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4))->Close(s);
52 #elif defined(WINDOWS_STORE_RT)
53 WinRTClose(s);
54 #else
55 if ((__UDPSOCKET__)s != 0)
56 closesocket__(s);
57 #endif
58
59
60 #if defined (_WIN32) && defined(USE_WAIT_FOR_MULTIPLE_EVENTS)
61 if (recvEvent!=INVALID_HANDLE_VALUE)
62 {
63 CloseHandle( recvEvent );
64 recvEvent = INVALID_HANDLE_VALUE;
65 }
66 #endif
67 }
68 //
69 // void RakNetSocket::Accept(
70 // struct sockaddr *addr,
71 // int *addrlen)
72 // {
73 // accept__(s, addr, addrlen);
74 // }
75
76 //
77 // void RakNetSocket::Close( void )
78 // {
79 // closesocket__(s);
80 // }
81
82 RakNetSocket* RakNetSocket::Create
83 #ifdef __native_client__
84 (_PP_Instance_ _chromeInstance)
85 #else
86 (int af,
87 int type,
88 int protocol)
89 #endif
90 {
91 __UDPSOCKET__ sock;
92
93 #ifndef __native_client__
94 RakAssert(type==SOCK_DGRAM);
95 #endif
96
97 #ifdef __native_client__
98 sock = ((PPB_UDPSocket_Private_0_4*) Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4))->Create(_chromeInstance);
99 #elif defined(SN_TARGET_PSP2)
100 sock = sceNetSocket( "RakNetSocket::Create", SCE_NET_AF_INET, SCE_NET_SOCK_DGRAM_P2P, 0 );
101 #elif defined(WINDOWS_STORE_RT)
102 sock = WinRTCreateDatagramSocket(af,type,protocol);
103 #elif defined(_PS3) || defined(__PS3__) || defined(SN_TARGET_PS3) || defined(_PS4)
104 sock = socket__( AF_INET, SOCK_DGRAM_P2P, 0 );
105 #else
106 sock = socket__(af, type, protocol);
107 #endif
108
109 #if !defined(WINDOWS_STORE_RT)
110 if (sock<0)
111 return 0;
112 #endif
113 RakNetSocket *rns = SLNet::OP_NEW<RakNetSocket>(_FILE_AND_LINE_);
114 rns->s = sock;
115 #ifdef __native_client__
116 rns->chromeInstance = _chromeInstance;
117 #endif
118 return rns;
119 }
120
121 int RakNetSocket::Bind(
122 const struct sockaddr *addr,
123 int namelen)
124 {
125 return bind__(s,addr,namelen);
126 }
127
128 int RakNetSocket::IOCTLSocket(
129 long cmd,
130 unsigned long *argp)
131 {
132 #if defined(_WIN32)
133 return ioctlsocket__(s,cmd,argp);
134 #else
135 return 0;
136 #endif
137 }
138
139 int RakNetSocket::Listen (
140 int backlog)
141 {
142 return listen__(s,backlog);
143 }
144
145 int RakNetSocket::SetSockOpt(
146 int level,
147 int optname,
148 const char * optval,
149 int optlen)
150 {
151 return setsockopt__(s,level,optname,optval,optlen);
152 }
153
154 int RakNetSocket::Shutdown(
155 int how)
156 {
157 #ifndef SN_TARGET_PSP2
158 return shutdown__(s,how);
159 #else
160 return 0;
161 #endif
162 }
163 */
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2.cpp Source File

  • src
RakNetSocket2.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/socket2.h"
17 #include "slikenet/memoryoverride.h"
18 #include "slikenet/assert.h"
19 #include "slikenet/sleep.h"
20 #include "slikenet/SocketDefines.h"
21 #include "slikenet/GetTime.h"
22 #include <stdio.h>
23 #include <string.h> // memcpy
24
25 using namespace SLNet;
26
27 #ifdef _WIN32
28 #else
29 #include <unistd.h>
30 #include <fcntl.h>
31 #include <arpa/inet.h>
32 #include <errno.h> // error numbers
33 #if !defined(ANDROID)
34 #include <ifaddrs.h>
35 #endif
36 #include <netinet/in.h>
37 #include <net/if.h>
38 #include <sys/types.h>
39 #include <sys/socket.h>
40 #include <sys/ioctl.h>
41 #endif
42
43 #ifdef TEST_NATIVE_CLIENT_ON_WINDOWS
44 #else
45 #define RAKNET_SOCKET_2_INLINE_FUNCTIONS
46 #include "RakNetSocket2_360_720.cpp"
47 #include "RakNetSocket2_PS3_PS4.cpp"
48 #include "RakNetSocket2_PS4.cpp"
49 #include "RakNetSocket2_Windows_Linux.cpp"
50 #include "RakNetSocket2_Windows_Linux_360.cpp"
51 #include "RakNetSocket2_Vita.cpp"
52 #include "RakNetSocket2_NativeClient.cpp"
53 #include "RakNetSocket2_Berkley.cpp"
54 #include "RakNetSocket2_Berkley_NativeClient.cpp"
55 #include "RakNetSocket2_WindowsStore8.cpp"
56 #undef RAKNET_SOCKET_2_INLINE_FUNCTIONS
57
58 #endif
59
60 #ifndef INVALID_SOCKET
61 #define INVALID_SOCKET -1
62 #endif
63
64 void RakNetSocket2Allocator::DeallocRNS2(RakNetSocket2 *s) { SLNet::OP_DELETE(s,_FILE_AND_LINE_);}
65 RakNetSocket2::RakNetSocket2() {eventHandler=0;}
66 RakNetSocket2::~RakNetSocket2() {}
67 void RakNetSocket2::SetRecvEventHandler(RNS2EventHandler *_eventHandler) {eventHandler=_eventHandler;}
68 RNS2Type RakNetSocket2::GetSocketType(void) const {return socketType;}
69 void RakNetSocket2::SetSocketType(RNS2Type t) {socketType=t;}
70 bool RakNetSocket2::IsBerkleySocket(void) const {
71 return socketType!=RNS2T_CHROME && socketType!=RNS2T_WINDOWS_STORE_8;
72 }
73 SystemAddress RakNetSocket2::GetBoundAddress(void) const {return boundAddress;}
74
75 RakNetSocket2* RakNetSocket2Allocator::AllocRNS2(void)
76 {
77 RakNetSocket2* s2;
78 #if defined(WINDOWS_STORE_RT)
79 s2 = SLNet::OP_NEW<RNS2_WindowsStore8>(_FILE_AND_LINE_);
80 s2->SetSocketType(RNS2T_WINDOWS_STORE_8);
81
82
83
84
85
86
87 #elif defined(__native_client__)
88 s2 = SLNet::OP_NEW<RNS2_NativeClient>(_FILE_AND_LINE_);
89 s2->SetSocketType(RNS2T_CHROME);
90
91
92
93
94
95
96
97
98
99 #elif defined(_WIN32)
100 s2 = SLNet::OP_NEW<RNS2_Windows>(_FILE_AND_LINE_);
101 s2->SetSocketType(RNS2T_WINDOWS);
102 #else
103 s2 = SLNet::OP_NEW<RNS2_Linux>(_FILE_AND_LINE_);
104 s2->SetSocketType(RNS2T_LINUX);
105 #endif
106 return s2;
107 }
108 void RakNetSocket2::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
109 {
110 #if defined(WINDOWS_STORE_RT)
111 RNS2_WindowsStore8::GetMyIP( addresses );
112
113
114
115
116 #elif defined(__native_client__)
117 RNS2_NativeClient::GetMyIP( addresses );
118
119
120
121
122
123
124 #elif defined(_WIN32)
125 RNS2_Windows::GetMyIP( addresses );
126 #else
127 RNS2_Linux::GetMyIP( addresses );
128 #endif
129 }
130
131 unsigned int RakNetSocket2::GetUserConnectionSocketIndex(void) const {return userConnectionSocketIndex;}
132 void RakNetSocket2::SetUserConnectionSocketIndex(unsigned int i) {userConnectionSocketIndex=i;}
133 RNS2EventHandler * RakNetSocket2::GetEventHandler(void) const {return eventHandler;}
134
135 void RakNetSocket2::DomainNameToIP( const char *domainName, char ip[65] ) {
136 #if defined(WINDOWS_STORE_RT)
137 return RNS2_WindowsStore8::DomainNameToIP( domainName, ip );
138 #elif defined(__native_client__)
139 return DomainNameToIP_Berkley( domainName, ip );
140
141
142
143
144
145
146
147
148
149
150 #elif defined(_WIN32)
151 return DomainNameToIP_Berkley( domainName, ip );
152 #else
153 return DomainNameToIP_Berkley( domainName, ip );
154 #endif
155 }
156
157 #if defined(WINDOWS_STORE_RT)
158 #elif defined(__native_client__)
159 RNS2_NativeClient::RNS2_NativeClient() {bindState = BS_UNBOUND; sendInProgress=false;}
160 RNS2_NativeClient::~RNS2_NativeClient()
161 {
162 bufferedSendsMutex.Lock();
163 while (bufferedSends.Size())
164 SLNet::OP_DELETE(bufferedSends.Pop(), _FILE_AND_LINE_);
165 bufferedSendsMutex.Unlock();
166 }
167 void RNS2_NativeClient::onSocketBound(void* pData, int32_t dataSize)
168 {
169 RAKNET_DEBUG_PRINTF("onSocketBound ==> %d\n", dataSize);
170 RNS2_NativeClient *csc = (RNS2_NativeClient *)pData;
171
172 //any error codes will be given to us in the dataSize value
173 if(dataSize < 0)
174 {
175 csc->bindState=BS_FAILED;
176 fprintf(stderr,"onSocketBound exiting, dataSize = %d\n", dataSize);
177 return;
178 }
179
180 csc->bindState=BS_BOUND;
181
182 csc->ProcessBufferedSend();
183 csc->IssueReceiveCall();
184 }
185 void RNS2_NativeClient::ProcessBufferedSend(void)
186 {
187 // Don't send until bound
188 if (bindState!=BS_BOUND)
189 return;
190 // Fast non-threadsafe check
191 if (bufferedSends.IsEmpty()==true)
192 return;
193
194 sendInProgressMutex.Lock();
195 if (sendInProgress==true) {sendInProgressMutex.Unlock(); return;}
196 else {sendInProgress=true;}
197 sendInProgressMutex.Unlock();
198
199 RNS2_SendParameters_NativeClient *sp;
200 bufferedSendsMutex.Lock();
201 if (bufferedSends.IsEmpty()==false)
202 sp=bufferedSends.Pop();
203 else
204 sp=0;
205 bufferedSendsMutex.Unlock();
206 if (sp==0)
207 {
208 sendInProgressMutex.Lock();
209 sendInProgress=false;
210 sendInProgressMutex.Unlock();
211 return; // Nothing to send after all
212 }
213
214 SendImmediate(sp);
215 // sp remains in memory until the callback completes
216 // DeallocSP(sp);
217 }
218 void RNS2_NativeClient::DeallocSP(RNS2_SendParameters_NativeClient *sp)
219 {
220 rakFree_Ex(sp->data, _FILE_AND_LINE_);
221 SLNet::OP_DELETE(sp, _FILE_AND_LINE_);
222 }
223 RNS2_SendParameters_NativeClient* RNS2_NativeClient::CloneSP(RNS2_SendParameters *sp, RNS2_NativeClient *socket2, const char *file, unsigned int line)
224 {
225 RNS2_SendParameters_NativeClient *spNew = SLNet::OP_NEW<RNS2_SendParameters_NativeClient>(file, line);
226 spNew->data=(char*) rakMalloc(sp->length);
227 memcpy(spNew->data,sp->data,sp->length);
228 spNew->length = sp->length;
229 spNew->socket2=socket2;
230 spNew->systemAddress=sp->systemAddress;
231 spNew->ttl=0; // Unused
232 return spNew;
233 }
234 void RNS2_NativeClient::onSendTo(void* pData, int32_t dataSize)
235 {
236 if(dataSize <= 0)
237 RAKNET_DEBUG_PRINTF("onSendTo: send failed with error %d\n", dataSize);
238
239 RNS2_SendParameters_NativeClient *sp = (RNS2_SendParameters_NativeClient*) pData;
240
241 // Caller will check sendInProgress to send again if needed
242 sp->socket2->sendInProgressMutex.Lock();
243 sp->socket2->sendInProgress=false;
244 sp->socket2->sendInProgressMutex.Unlock();
245
246 DeallocSP(sp);
247
248 // if(dataSize == PP_ERROR_ABORTED)
249 // return;
250 }
251 RNS2SendResult RNS2_NativeClient::Send( RNS2_SendParameters *sendParameters, const char *file, unsigned int line )
252 {
253 if (bindState==BS_FAILED)
254 return -1;
255
256 // This is called from multiple threads. Always buffer the send, until native client is threadsafe
257 BufferSend(sendParameters, file, line);
258 return sendParameters->length;
259 }
260 void RNS2_NativeClient::BufferSend( RNS2_SendParameters *sendParameters, const char *file, unsigned int line )
261 {
262 if (bindState==BS_FAILED)
263 return;
264
265 RNS2_SendParameters_NativeClient* sp = CloneSP(sendParameters, this, file, line);
266 bufferedSendsMutex.Lock();
267 bufferedSends.Push(sp, file, line);
268 bufferedSendsMutex.Unlock();
269
270 // Do not check to send immediately, because this was probably invoked from a thread and native client is not threadsafe
271 }
272 void RNS2_NativeClient::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] ) {addresses[0]=UNASSIGNED_SYSTEM_ADDRESS; RakAssert("GetMyIP Unsupported?" && 0);}
273 const NativeClientBindParameters *RNS2_NativeClient::GetBindings(void) const {return &binding;}
274 void RNS2_NativeClient::Update(void)
275 {
276 // Don't send until bound
277 if (bindState==BS_BOUND)
278 {
279 do
280 {
281 ProcessBufferedSend();
282 } while (sendInProgress==false && bufferedSends.Size()>1);
283 }
284 }
285
286 #else // defined(__native_client__)
287 bool IRNS2_Berkley::IsPortInUse(unsigned short port, const char *hostAddress, unsigned short addressFamily, int type ) {
288 RNS2_BerkleyBindParameters bbp;
289 bbp.remotePortRakNetWasStartedOn_PS3_PS4_PSP2=0;
290 bbp.port=port; bbp.hostAddress=(char*) hostAddress; bbp.addressFamily=addressFamily;
291 bbp.type=type; bbp.protocol=0; bbp.nonBlockingSocket=false;
292 bbp.setBroadcast=false; bbp.doNotFragment=false; bbp.protocol=0;
293 bbp.setIPHdrIncl=false;
294 SystemAddress boundAddress;
295 RNS2_Berkley *rns2 = (RNS2_Berkley*) RakNetSocket2Allocator::AllocRNS2();
296 RNS2BindResult bindResult = rns2->Bind(&bbp, _FILE_AND_LINE_);
297 RakNetSocket2Allocator::DeallocRNS2(rns2);
298 return bindResult==BR_FAILED_TO_BIND_SOCKET;
299 }
300
301 #if defined(__APPLE__)
302 void SocketReadCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info)
303 // This C routine is called by CFSocket when there's data waiting on our
304 // UDP socket. It just redirects the call to Objective-C code.
305 { }
306 #endif
307
308 RNS2BindResult RNS2_Berkley::BindShared( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line ) {
309 RNS2BindResult br;
310 #if RAKNET_SUPPORT_IPV6==1
311 br=BindSharedIPV4And6(bindParameters, file, line);
312 #else
313 br=BindSharedIPV4(bindParameters, file, line);
314 #endif
315
316 if (br!=BR_SUCCESS)
317 return br;
318
319 unsigned long zero=0;
320 RNS2_SendParameters bsp;
321 bsp.data=(char*) &zero;
322 bsp.length=4;
323 bsp.systemAddress=boundAddress;
324 bsp.ttl=0;
325 RNS2SendResult sr = Send(&bsp, _FILE_AND_LINE_);
326 if (sr<0)
327 return BR_FAILED_SEND_TEST;
328
329 memcpy(&binding, bindParameters, sizeof(RNS2_BerkleyBindParameters));
330
331 /*
332 #if defined(__APPLE__)
333 const CFSocketContext context = { 0, this, NULL, NULL, NULL };
334 _cfSocket = CFSocketCreateWithNative(NULL, rns2Socket, kCFSocketReadCallBack, SocketReadCallback, &context);
335 #endif
336 */
337
338 return br;
339 }
340
341 RAK_THREAD_DECLARATION(RNS2_Berkley::RecvFromLoop)
342 {
343
344
345
346 RNS2_Berkley *b = ( RNS2_Berkley * ) arguments;
347
348 b->RecvFromLoopInt();
349 return 0;
350 }
351 unsigned RNS2_Berkley::RecvFromLoopInt(void)
352 {
353 isRecvFromLoopThreadActive.Increment();
354
355 while ( endThreads == false )
356 {
357 RNS2RecvStruct *recvFromStruct;
358 recvFromStruct=binding.eventHandler->AllocRNS2RecvStruct(_FILE_AND_LINE_);
359 if (recvFromStruct != NULL)
360 {
361 recvFromStruct->socket=this;
362 RecvFromBlocking(recvFromStruct);
363
364 if (recvFromStruct->bytesRead>0)
365 {
366 RakAssert(recvFromStruct->systemAddress.GetPort());
367 binding.eventHandler->OnRNS2Recv(recvFromStruct);
368 }
369 else
370 {
371 RakSleep(0);
372 binding.eventHandler->DeallocRNS2RecvStruct(recvFromStruct, _FILE_AND_LINE_);
373 }
374 }
375 }
376 isRecvFromLoopThreadActive.Decrement();
377
378
379
380
381 return 0;
382
383 }
384 RNS2_Berkley::RNS2_Berkley()
385 {
386 rns2Socket=(RNS2Socket)INVALID_SOCKET;
387 }
388 RNS2_Berkley::~RNS2_Berkley()
389 {
390 if (rns2Socket!=INVALID_SOCKET)
391 {
392 /*
393 #if defined(__APPLE__)
394 CFSocketInvalidate(_cfSocket);
395 #endif
396 */
397
398 closesocket__(rns2Socket);
399 }
400
401 }
402 int RNS2_Berkley::CreateRecvPollingThread(int threadPriority)
403 {
404 endThreads=false;
405
406
407
408
409
410
411 int errorCode = SLNet::RakThread::Create(RecvFromLoop, this, threadPriority);
412
413 return errorCode;
414 }
415 void RNS2_Berkley::SignalStopRecvPollingThread(void)
416 {
417 endThreads=true;
418 }
419 void RNS2_Berkley::BlockOnStopRecvPollingThread(void)
420 {
421 endThreads=true;
422
423 // Get recvfrom to unblock
424 RNS2_SendParameters bsp;
425 unsigned long zero=0;
426 bsp.data=(char*) &zero;
427 bsp.length=4;
428 bsp.systemAddress=boundAddress;
429 bsp.ttl=0;
430 Send(&bsp, _FILE_AND_LINE_);
431
432 SLNet::TimeMS timeout = SLNet::GetTimeMS()+1000;
433 while ( isRecvFromLoopThreadActive.GetValue()>0 && SLNet::GetTimeMS()<timeout )
434 {
435 // Get recvfrom to unblock
436 Send(&bsp, _FILE_AND_LINE_);
437 RakSleep(30);
438 }
439 }
440 const RNS2_BerkleyBindParameters *RNS2_Berkley::GetBindings(void) const {return &binding;}
441 RNS2Socket RNS2_Berkley::GetSocket(void) const {return rns2Socket;}
442 // See RakNetSocket2_Berkley.cpp for WriteSharedIPV4, BindSharedIPV4And6 and other implementations
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486 #if defined(_WIN32)
487 RNS2_Windows::RNS2_Windows() {slo=0;}
488 RNS2_Windows::~RNS2_Windows() {}
489 RNS2BindResult RNS2_Windows::Bind( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line ) {
490 RNS2BindResult bindResult = BindShared(bindParameters, file, line);
491 if (bindResult == BR_FAILED_TO_BIND_SOCKET)
492 {
493 // Sometimes windows will fail if the socket is recreated too quickly
494 RakSleep(100);
495 bindResult = BindShared(bindParameters, file, line);
496 }
497 return bindResult;
498 }
499 RNS2SendResult RNS2_Windows::Send( RNS2_SendParameters *sendParameters, const char *file, unsigned int line ) {
500 if (slo)
501 {
502 RNS2SendResult len;
503 len = slo->RakNetSendTo(sendParameters->data, sendParameters->length,sendParameters->systemAddress);
504 if (len>=0)
505 return len;
506 }
507 return Send_Windows_Linux_360NoVDP(rns2Socket,sendParameters, file, line);
508 }
509 void RNS2_Windows::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] ) {return GetMyIP_Windows_Linux(addresses);}
510 void RNS2_Windows::SetSocketLayerOverride(SocketLayerOverride *_slo) {slo = _slo;}
511 SocketLayerOverride* RNS2_Windows::GetSocketLayerOverride(void) {return slo;}
512 #else
513 RNS2BindResult RNS2_Linux::Bind( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line ) {return BindShared(bindParameters, file, line);}
514 RNS2SendResult RNS2_Linux::Send( RNS2_SendParameters *sendParameters, const char *file, unsigned int line ) {return Send_Windows_Linux_360NoVDP(rns2Socket,sendParameters, file, line);}
515 void RNS2_Linux::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] ) {return GetMyIP_Windows_Linux(addresses);}
516 #endif // Linux
517
518 #endif // defined(__native_client__)
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/IncrementalReadInterface.h Source File

  • include
  • slikenet
IncrementalReadInterface.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __INCREMENTAL_READ_INTERFACE_H
17 #define __INCREMENTAL_READ_INTERFACE_H
18
19 #include "FileListNodeContext.h"
20 #include "Export.h"
21
22 namespace SLNet
23 {
24
25 class RAK_DLL_EXPORT IncrementalReadInterface
26 {
27 public:
28 IncrementalReadInterface() {}
29 virtual ~IncrementalReadInterface() {}
30
38 virtual unsigned int GetFilePart( const char *filename, unsigned int startReadBytes, unsigned int numBytesToRead, void *preallocatedDestination, FileListNodeContext context);
39 };
40
41 } // namespace SLNet
42
43 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RNS2_Berkley
SLNet::RNS2_Berkley Member List

This is the complete list of members for SLNet::RNS2_Berkley, including all inherited members.

Bind(RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)=0 | SLNet::IRNS2_Berkley | pure virtual
binding | SLNet::RNS2_Berkley | protected
BindShared(RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line) | SLNet::RNS2_Berkley | protected
BindSharedIPV4(RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line) | SLNet::RNS2_Berkley | protected
BindSharedIPV4And6(RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line) | SLNet::RNS2_Berkley | protected
BlockOnStopRecvPollingThread(void) | SLNet::RNS2_Berkley |
boundAddress | SLNet::RakNetSocket2 | protected
CreateRecvPollingThread(int threadPriority) | SLNet::RNS2_Berkley |
DomainNameToIP(const char *domainName, char ip[65]) | SLNet::RakNetSocket2 | static
endThreads | SLNet::RNS2_Berkley | protected
eventHandler | SLNet::RakNetSocket2 | protected
GetBindings(void) const | SLNet::RNS2_Berkley |
GetBoundAddress(void) const | SLNet::RakNetSocket2 |
GetEventHandler(void) const | SLNet::RakNetSocket2 |
GetMyIP(SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS]) | SLNet::RakNetSocket2 | static
GetSocket(void) const | SLNet::RNS2_Berkley |
GetSocketType(void) const | SLNet::RakNetSocket2 |
GetSystemAddressIPV4(RNS2Socket rns2Socket, SystemAddress *systemAddressOut) | SLNet::RNS2_Berkley | protectedstatic
GetSystemAddressIPV4And6(RNS2Socket rns2Socket, SystemAddress *systemAddressOut) | SLNet::RNS2_Berkley | protectedstatic
GetUserConnectionSocketIndex(void) const | SLNet::RakNetSocket2 |
IsBerkleySocket(void) const | SLNet::RakNetSocket2 |
IsPortInUse(unsigned short port, const char *hostAddress, unsigned short addressFamily, int type) | SLNet::IRNS2_Berkley | static
isRecvFromLoopThreadActive | SLNet::RNS2_Berkley | protected
RAK_THREAD_DECLARATION(RecvFromLoop) | SLNet::RNS2_Berkley | protectedstatic
RakNetSocket2() | SLNet::RakNetSocket2 |
RecvFromBlocking(RNS2RecvStruct *recvFromStruct) | SLNet::RNS2_Berkley | protected
RecvFromBlockingIPV4(RNS2RecvStruct *recvFromStruct) | SLNet::RNS2_Berkley | protected
RecvFromBlockingIPV4And6(RNS2RecvStruct *recvFromStruct) | SLNet::RNS2_Berkley | protected
RecvFromLoopInt(void) | SLNet::RNS2_Berkley | protected
RNS2_Berkley() | SLNet::RNS2_Berkley |
rns2Socket | SLNet::RNS2_Berkley | protected
Send(RNS2_SendParameters *sendParameters, const char *file, unsigned int line)=0 | SLNet::RakNetSocket2 | pure virtual
SetBroadcastSocket(int broadcast) | SLNet::RNS2_Berkley | protected
SetDoNotFragment(int opt) | SLNet::RNS2_Berkley |
SetIPHdrIncl(int ipHdrIncl) | SLNet::RNS2_Berkley | protected
SetNonBlockingSocket(unsigned long nonblocking) | SLNet::RNS2_Berkley | protected
SetRecvEventHandler(RNS2EventHandler *_eventHandler) | SLNet::RakNetSocket2 |
SetSocketOptions(void) | SLNet::RNS2_Berkley | protected
SetSocketType(RNS2Type t) | SLNet::RakNetSocket2 |
SetUserConnectionSocketIndex(unsigned int i) | SLNet::RakNetSocket2 |
SignalStopRecvPollingThread(void) | SLNet::RNS2_Berkley |
socketType | SLNet::RakNetSocket2 | protected
userConnectionSocketIndex | SLNet::RakNetSocket2 | protected
~RakNetSocket2() | SLNet::RakNetSocket2 | virtual
~RNS2_Berkley() | SLNet::RNS2_Berkley | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Heap
  • HeapNode
DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode Member List

This is the complete list of members for DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode, including all inherited members.

data | DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode |
HeapNode() | DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode | inline
HeapNode(const weight_type &w, const data_type &d) | DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode | inline
weight | DataStructures::Heap< weight_type, data_type, isMaxHeap >::HeapNode |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/StringCompressor.cpp Source File

  • src
StringCompressor.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20
21 #include "slikenet/StringCompressor.h"
22 #include "slikenet/DS_HuffmanEncodingTree.h"
23 #include "slikenet/BitStream.h"
24 #include "slikenet/string.h"
25 #include "slikenet/assert.h"
26 #include <string.h>
27
28 #include <memory.h>
29
30
31
32
33
34
35
36 using namespace SLNet;
37
38 StringCompressor* StringCompressor::instance=0;
39 int StringCompressor::referenceCount=0;
40
41 void StringCompressor::AddReference(void)
42 {
43 if (++referenceCount==1)
44 {
45 instance = SLNet::OP_NEW<StringCompressor>( _FILE_AND_LINE_ );
46 }
47 }
48 void StringCompressor::RemoveReference(void)
49 {
50 RakAssert(referenceCount > 0);
51
52 if (referenceCount > 0)
53 {
54 if (--referenceCount==0)
55 {
56 SLNet::OP_DELETE(instance, _FILE_AND_LINE_);
57 instance=0;
58 }
59 }
60 }
61
62 StringCompressor* StringCompressor::Instance(void)
63 {
64 return instance;
65 }
66
67 unsigned int englishCharacterFrequencies[ 256 ] =
68 {
69 0,
70 0,
71 0,
72 0,
73 0,
74 0,
75 0,
76 0,
77 0,
78 0,
79 722,
80 0,
81 0,
82 2,
83 0,
84 0,
85 0,
86 0,
87 0,
88 0,
89 0,
90 0,
91 0,
92 0,
93 0,
94 0,
95 0,
96 0,
97 0,
98 0,
99 0,
100 0,
101 11084,
102 58,
103 63,
104 1,
105 0,
106 31,
107 0,
108 317,
109 64,
110 64,
111 44,
112 0,
113 695,
114 62,
115 980,
116 266,
117 69,
118 67,
119 56,
120 7,
121 73,
122 3,
123 14,
124 2,
125 69,
126 1,
127 167,
128 9,
129 1,
130 2,
131 25,
132 94,
133 0,
134 195,
135 139,
136 34,
137 96,
138 48,
139 103,
140 56,
141 125,
142 653,
143 21,
144 5,
145 23,
146 64,
147 85,
148 44,
149 34,
150 7,
151 92,
152 76,
153 147,
154 12,
155 14,
156 57,
157 15,
158 39,
159 15,
160 1,
161 1,
162 1,
163 2,
164 3,
165 0,
166 3611,
167 845,
168 1077,
169 1884,
170 5870,
171 841,
172 1057,
173 2501,
174 3212,
175 164,
176 531,
177 2019,
178 1330,
179 3056,
180 4037,
181 848,
182 47,
183 2586,
184 2919,
185 4771,
186 1707,
187 535,
188 1106,
189 152,
190 1243,
191 100,
192 0,
193 2,
194 0,
195 10,
196 0,
197 0,
198 0,
199 0,
200 0,
201 0,
202 0,
203 0,
204 0,
205 0,
206 0,
207 0,
208 0,
209 0,
210 0,
211 0,
212 0,
213 0,
214 0,
215 0,
216 0,
217 0,
218 0,
219 0,
220 0,
221 0,
222 0,
223 0,
224 0,
225 0,
226 0,
227 0,
228 0,
229 0,
230 0,
231 0,
232 0,
233 0,
234 0,
235 0,
236 0,
237 0,
238 0,
239 0,
240 0,
241 0,
242 0,
243 0,
244 0,
245 0,
246 0,
247 0,
248 0,
249 0,
250 0,
251 0,
252 0,
253 0,
254 0,
255 0,
256 0,
257 0,
258 0,
259 0,
260 0,
261 0,
262 0,
263 0,
264 0,
265 0,
266 0,
267 0,
268 0,
269 0,
270 0,
271 0,
272 0,
273 0,
274 0,
275 0,
276 0,
277 0,
278 0,
279 0,
280 0,
281 0,
282 0,
283 0,
284 0,
285 0,
286 0,
287 0,
288 0,
289 0,
290 0,
291 0,
292 0,
293 0,
294 0,
295 0,
296 0,
297 0,
298 0,
299 0,
300 0,
301 0,
302 0,
303 0,
304 0,
305 0,
306 0,
307 0,
308 0,
309 0,
310 0,
311 0,
312 0,
313 0,
314 0,
315 0,
316 0,
317 0,
318 0,
319 0,
320 0,
321 0,
322 0,
323 0,
324 0
325 };
326
327 StringCompressor::StringCompressor()
328 {
329 DataStructures::Map<int, HuffmanEncodingTree *>::IMPLEMENT_DEFAULT_COMPARISON();
330
331 // Make a default tree immediately, since this is used for RPC possibly from multiple threads at the same time
332 HuffmanEncodingTree *huffmanEncodingTree = SLNet::OP_NEW<HuffmanEncodingTree>( _FILE_AND_LINE_ );
333 huffmanEncodingTree->GenerateFromFrequencyTable( englishCharacterFrequencies );
334
335 huffmanEncodingTrees.Set(0, huffmanEncodingTree);
336 }
337 void StringCompressor::GenerateTreeFromStrings( unsigned char *input, unsigned inputLength, uint8_t languageId )
338 {
339 HuffmanEncodingTree *huffmanEncodingTree;
340 if (huffmanEncodingTrees.Has(languageId))
341 {
342 huffmanEncodingTree = huffmanEncodingTrees.Get(languageId);
343 SLNet::OP_DELETE(huffmanEncodingTree, _FILE_AND_LINE_);
344 }
345
346 unsigned index;
347 unsigned int frequencyTable[ 256 ];
348
349 if ( inputLength == 0 )
350 return ;
351
352 // Zero out the frequency table
353 memset( frequencyTable, 0, sizeof( frequencyTable ) );
354
355 // Generate the frequency table from the strings
356 for ( index = 0; index < inputLength; index++ )
357 frequencyTable[ input[ index ] ] ++;
358
359 // Build the tree
360 huffmanEncodingTree = SLNet::OP_NEW<HuffmanEncodingTree>( _FILE_AND_LINE_ );
361 huffmanEncodingTree->GenerateFromFrequencyTable( frequencyTable );
362 huffmanEncodingTrees.Set(languageId, huffmanEncodingTree);
363 }
364
365 StringCompressor::~StringCompressor()
366 {
367 for (unsigned i=0; i < huffmanEncodingTrees.Size(); i++)
368 SLNet::OP_DELETE(huffmanEncodingTrees[i], _FILE_AND_LINE_);
369 }
370
371 void StringCompressor::EncodeString( const char *input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId )
372 {
373 HuffmanEncodingTree *huffmanEncodingTree;
374 if (huffmanEncodingTrees.Has(languageId)==false)
375 return;
376 huffmanEncodingTree=huffmanEncodingTrees.Get(languageId);
377
378 if ( input == 0 )
379 {
380 output->WriteCompressed( (uint32_t) 0 );
381 return ;
382 }
383
384 SLNet::BitStream encodedBitStream;
385
386 uint32_t stringBitLength;
387
388 int charsToWrite;
389
390 if ( maxCharsToWrite<=0 || ( int ) strlen( input ) < maxCharsToWrite )
391 charsToWrite = ( int ) strlen( input );
392 else
393 charsToWrite = maxCharsToWrite - 1;
394
395 huffmanEncodingTree->EncodeArray( ( unsigned char* ) input, charsToWrite, &encodedBitStream );
396
397 stringBitLength = (uint32_t) encodedBitStream.GetNumberOfBitsUsed();
398
399 output->WriteCompressed( stringBitLength );
400
401 output->WriteBits( encodedBitStream.GetData(), stringBitLength );
402 }
403
404 bool StringCompressor::DecodeString( char *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId )
405 {
406 HuffmanEncodingTree *huffmanEncodingTree;
407 if (huffmanEncodingTrees.Has(languageId)==false)
408 return false;
409 if (maxCharsToWrite<=0)
410 return false;
411 huffmanEncodingTree=huffmanEncodingTrees.Get(languageId);
412
413 uint32_t stringBitLength;
414 int bytesInStream;
415
416 output[ 0 ] = 0;
417
418 if ( input->ReadCompressed( stringBitLength ) == false )
419 return false;
420
421 if ( (unsigned) input->GetNumberOfUnreadBits() < stringBitLength )
422 return false;
423
424 bytesInStream = huffmanEncodingTree->DecodeArray( input, stringBitLength, maxCharsToWrite, ( unsigned char* ) output );
425
426 if ( bytesInStream < maxCharsToWrite )
427 output[ bytesInStream ] = 0;
428 else
429 output[ maxCharsToWrite - 1 ] = 0;
430
431 return true;
432 }
433 #ifdef _CSTRING_COMPRESSOR
434 void StringCompressor::EncodeString( const CString &input, int maxCharsToWrite, SLNet::BitStream *output )
435 {
436 LPTSTR p = input;
437 EncodeString(p, maxCharsToWrite*sizeof(TCHAR), output, languageID);
438 }
439 bool StringCompressor::DecodeString( CString &output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId )
440 {
441 LPSTR p = output.GetBuffer(maxCharsToWrite*sizeof(TCHAR));
442 DecodeString(p,maxCharsToWrite*sizeof(TCHAR), input, languageID);
443 output.ReleaseBuffer(0)
444
445 }
446 #endif
447 #ifdef _STD_STRING_COMPRESSOR
448 void StringCompressor::EncodeString( const std::string &input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId )
449 {
450 EncodeString(input.c_str(), maxCharsToWrite, output, languageId);
451 }
452 bool StringCompressor::DecodeString( std::string *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId )
453 {
454 if (maxCharsToWrite <= 0)
455 {
456 output->clear();
457 return true;
458 }
459
460 char *destinationBlock;
461 bool out;
462
463 #if USE_ALLOCA==1
464 if (maxCharsToWrite < MAX_ALLOCA_STACK_ALLOCATION)
465 {
466 destinationBlock = (char*) alloca(maxCharsToWrite);
467 out=DecodeString(destinationBlock, maxCharsToWrite, input, languageId);
468 *output=destinationBlock;
469 }
470 else
471 #endif
472 {
473 destinationBlock = (char*) rakMalloc_Ex( maxCharsToWrite, _FILE_AND_LINE_ );
474 out=DecodeString(destinationBlock, maxCharsToWrite, input, languageId);
475 *output=destinationBlock;
476 rakFree_Ex(destinationBlock, _FILE_AND_LINE_ );
477 }
478
479 return out;
480 }
481 #endif
482 void StringCompressor::EncodeString( const RakString *input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId )
483 {
484 EncodeString(input->C_String(), maxCharsToWrite, output, languageId);
485 }
486 bool StringCompressor::DecodeString( RakString *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId )
487 {
488 if (maxCharsToWrite <= 0)
489 {
490 output->Clear();
491 return true;
492 }
493
494 char *destinationBlock;
495 bool out;
496
497 #if USE_ALLOCA==1
498 if (maxCharsToWrite < MAX_ALLOCA_STACK_ALLOCATION)
499 {
500 destinationBlock = (char*) alloca(maxCharsToWrite);
501 out=DecodeString(destinationBlock, maxCharsToWrite, input, languageId);
502 *output=destinationBlock;
503 }
504 else
505 #endif
506 {
507 destinationBlock = (char*) rakMalloc_Ex( maxCharsToWrite, _FILE_AND_LINE_ );
508 out=DecodeString(destinationBlock, maxCharsToWrite, input, languageId);
509 *output=destinationBlock;
510 rakFree_Ex(destinationBlock, _FILE_AND_LINE_ );
511 }
512
513 return out;
514 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • InternalPacketFixedSizeTransmissionHeader
SLNet::InternalPacketFixedSizeTransmissionHeader Member List

This is the complete list of members for SLNet::InternalPacketFixedSizeTransmissionHeader, including all inherited members.

dataBitLength | SLNet::InternalPacketFixedSizeTransmissionHeader
orderingChannel | SLNet::InternalPacketFixedSizeTransmissionHeader
orderingIndex | SLNet::InternalPacketFixedSizeTransmissionHeader
reliability | SLNet::InternalPacketFixedSizeTransmissionHeader
reliableMessageNumber | SLNet::InternalPacketFixedSizeTransmissionHeader
sequencingIndex | SLNet::InternalPacketFixedSizeTransmissionHeader
splitPacketCount | SLNet::InternalPacketFixedSizeTransmissionHeader
splitPacketId | SLNet::InternalPacketFixedSizeTransmissionHeader
splitPacketIndex | SLNet::InternalPacketFixedSizeTransmissionHeader
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SocketDescriptor
SLNet::SocketDescriptor Member List

This is the complete list of members for SLNet::SocketDescriptor, including all inherited members.

blockingSocket | SLNet::SocketDescriptor
chromeInstance | SLNet::SocketDescriptor
extraSocketOptions | SLNet::SocketDescriptor
hostAddress | SLNet::SocketDescriptor
port | SLNet::SocketDescriptor
remotePortRakNetWasStartedOn_PS3_PSP2 | SLNet::SocketDescriptor
SocketDescriptor() | SLNet::SocketDescriptor
SocketDescriptor(unsigned short _port, const char *_hostAddress) | SLNet::SocketDescriptor
socketFamily | SLNet::SocketDescriptor
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TeamManager.cpp Source File

  • src
TeamManager.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_TeamManager==1
18
19 #include "slikenet/TeamManager.h"
20 #include "slikenet/BitStream.h"
21 #include "slikenet/MessageIdentifiers.h"
22 #include "slikenet/GetTime.h"
23
24 using namespace SLNet;
25
26
27 enum TeamManagerOperations
28 {
29 ID_RUN_UpdateListsToNoTeam,
30 ID_RUN_UpdateTeamsRequestedToAny,
31 ID_RUN_JoinAnyTeam,
32 ID_RUN_JoinRequestedTeam,
33 ID_RUN_UpdateTeamsRequestedToNoneAndAddTeam,
34 ID_RUN_RemoveFromTeamsRequestedAndAddTeam,
35 ID_RUN_AddToRequestedTeams,
36 ID_RUN_LeaveTeam,
37 ID_RUN_SetMemberLimit,
38 ID_RUN_SetJoinPermissions,
39 ID_RUN_SetBalanceTeams,
40 ID_RUN_SetBalanceTeamsInitial,
41 ID_RUN_SerializeWorld,
42 };
43
44 STATIC_FACTORY_DEFINITIONS(TM_TeamMember,TM_TeamMember);
45 STATIC_FACTORY_DEFINITIONS(TM_Team,TM_Team);
46 STATIC_FACTORY_DEFINITIONS(TeamManager,TeamManager);
47
48 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
49
50 int TM_World::JoinRequestHelperComp(const TM_World::JoinRequestHelper &key, const TM_World::JoinRequestHelper &data)
51 {
52 if (key.whenRequestMade < data.whenRequestMade)
53 return -1;
54 if (key.whenRequestMade > data.whenRequestMade)
55 return 1;
56 if (key.requestIndex < data.requestIndex)
57 return -1;
58 if (key.requestIndex > data.requestIndex)
59 return 1;
60 return 0;
61 }
62
63 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
64
65 TeamSelection::TeamSelection() {}
66
67 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
68
69 TeamSelection::TeamSelection(JoinTeamType itt) : joinTeamType(itt) {}
70
71 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
72
73 TeamSelection::TeamSelection(JoinTeamType itt, TM_Team *param) : joinTeamType(itt) {teamParameter.specificTeamToJoin=param;}
74
75 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
76
77 TeamSelection::TeamSelection(JoinTeamType itt, NoTeamId param) : joinTeamType(itt) {teamParameter.noTeamSubcategory=param;}
78
79 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
80
81 TeamSelection TeamSelection::AnyAvailable(void) {return TeamSelection(JOIN_ANY_AVAILABLE_TEAM);}
82
83 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
84
85 TeamSelection TeamSelection::SpecificTeam(TM_Team *specificTeamToJoin) {return TeamSelection(JOIN_SPECIFIC_TEAM, specificTeamToJoin);}
86
87 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
88
89 TeamSelection TeamSelection::NoTeam(NoTeamId noTeamSubcategory) {return TeamSelection(JOIN_NO_TEAM, noTeamSubcategory);}
90
91 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
92
93
94
95 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
96
97 TM_TeamMember::TM_TeamMember()
98 {
99 networkId=0;
100 world=0;
101 joinTeamType=JOIN_NO_TEAM;
102 noTeamSubcategory=0;
103 }
104
105 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
106
107 TM_TeamMember::~TM_TeamMember()
108 {
109 if (world)
110 {
111 world->DereferenceTeamMember(this);
112 }
113 }
114
115 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
116
117 bool TM_TeamMember::RequestTeam(TeamSelection teamSelection)
118 {
119 if (teamSelection.joinTeamType==JOIN_NO_TEAM)
120 {
121 // If joining no team:
122 // - If already no team, and no team category is the same, return false.
123 // - Execute JoinNoTeam() locally. Return ID_TEAM_BALANCER_TEAM_ASSIGNED locally.
124 // - If we are host, broadcast event. Done.
125 // - Send to remote host event to call JoinNoTeam()
126 // - remote Host executes JoinNoTeam() and broadcasts event. This may cause may cause rebalance if team balancing is on.
127 // - - JoinNoTeam(): Remove from all current and requested teams. Set no-team category.
128
129 if (teams.Size()==0 && noTeamSubcategory==teamSelection.teamParameter.noTeamSubcategory)
130 {
131 // No change
132 return false;
133 }
134
135 BitStream bsOut;
136 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
137 bsOut.WriteCasted<MessageID>(ID_RUN_UpdateListsToNoTeam);
138 bsOut.Write(world->GetWorldId());
139 bsOut.Write(networkId);
140 bsOut.Write(teamSelection.teamParameter.noTeamSubcategory);
141 world->BroadcastToParticipants(&bsOut, UNASSIGNED_RAKNET_GUID);
142
143 StoreLastTeams();
144
145 UpdateListsToNoTeam(teamSelection.teamParameter.noTeamSubcategory);
146
147 world->GetTeamManager()->PushTeamAssigned(this);
148 if (world->GetHost()==world->GetTeamManager()->GetMyGUIDUnified())
149 {
150 world->FillRequestedSlots();
151 world->EnforceTeamBalance(teamSelection.teamParameter.noTeamSubcategory);
152 }
153 }
154 else if (teamSelection.joinTeamType==JOIN_ANY_AVAILABLE_TEAM)
155 {
156 // If joining any team
157 // Execute JoinAnyTeamCheck()
158 // - JoinAnyTeamCheck():
159 // - - If already on a team, return false
160 // - - If any team is already in requested teams, return false.
161 // On local, call UpdateTeamsRequestedToAny(). Send event to also execute this to remote host
162 // If we are host, execute JoinAnyTeam(myguid).
163 // - JoinAnyTeam(requesterGuid): Attempt to join any team immediately. If fails, send to all except requestGuid UpdateTeamsRequestedToAny(). Else sends out new team, including to caller.
164 // On remote host, execute JoinAnyTeamCheck(). If fails, this was because you were added to a team simultaneously on host. This is OK, just ignore the call.
165 // Assuming JoinAnyTeamCheck() passed on remote host, call UpdateTeamsRequestedToAny() for this player. execute JoinAnyTeam(packet->guid).
166
167 if (JoinAnyTeamCheck()==false)
168 return false;
169
170 UpdateTeamsRequestedToAny();
171
172 // Send request to host to execute JoinAnyTeam()
173 BitStream bsOut;
174 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
175 bsOut.WriteCasted<MessageID>(ID_RUN_JoinAnyTeam);
176 bsOut.Write(world->GetWorldId());
177 bsOut.Write(networkId);
178 world->GetTeamManager()->SendUnified(&bsOut,HIGH_PRIORITY, RELIABLE_ORDERED, 0, world->GetHost(), false);
179 }
180 else
181 {
182 RakAssert(teamSelection.joinTeamType==JOIN_SPECIFIC_TEAM);
183
184 // If joining specific team
185 // Execute JoinSpecificTeamCheck()
186 // JoinSpecificTeamCheck():
187 // - If already on specific team, return false
188 // - If specific team is in requested list, return false
189 // On local, call AddToRequestedTeams(). Send event to also execute this to remote host
190 // If we are host, execute JoinSpecificTeam(myguid)
191 // - JoinSpecificTeam(requesterGuid): Attempt to join specific team immediately. If fails, send to all except requesterGuid to execute AddSpecificToRequested(). Else sends out new team, including to caller.
192 // On remote host, execute JoinSpecificTeamCheck(). If fails, just ignore.
193 // Assuming JoinSpecificTeamCheck() passed on host, call AddSpecificToRequestedList(). Execute JoinSpecificTeam(packet->guid)
194
195 if (JoinSpecificTeamCheck(teamSelection.teamParameter.specificTeamToJoin,false)==false)
196 return false;
197
198 AddToRequestedTeams(teamSelection.teamParameter.specificTeamToJoin);
199
200 // Send request to host to execute JoinRequestedTeam()
201 BitStream bsOut;
202 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
203 bsOut.WriteCasted<MessageID>(ID_RUN_JoinRequestedTeam);
204 bsOut.Write(world->GetWorldId());
205 bsOut.Write(networkId);
206 bsOut.Write(teamSelection.teamParameter.specificTeamToJoin->GetNetworkID());
207 bsOut.Write(false);
208 world->GetTeamManager()->SendUnified(&bsOut,HIGH_PRIORITY, RELIABLE_ORDERED, 0, world->GetHost(), false);
209 }
210
211 return true;
212 }
213
214 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
215
216 bool TM_TeamMember::RequestTeamSwitch(TM_Team *teamToJoin, TM_Team *teamToLeave)
217 {
218 if (SwitchSpecificTeamCheck(teamToJoin,teamToLeave,false)==false)
219 return false;
220
221 AddToRequestedTeams(teamToJoin, teamToLeave);
222
223 // Send request to host to execute JoinRequestedTeam()
224 BitStream bsOut;
225 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
226 bsOut.WriteCasted<MessageID>(ID_RUN_JoinRequestedTeam);
227 bsOut.Write(world->GetWorldId());
228 bsOut.Write(networkId);
229 bsOut.Write(teamToJoin->GetNetworkID());
230 bsOut.Write(true);
231 if (teamToLeave)
232 {
233 bsOut.Write(true);
234 bsOut.Write(teamToLeave->GetNetworkID());
235 }
236 else
237 {
238 bsOut.Write(false);
239 }
240 world->GetTeamManager()->SendUnified(&bsOut,HIGH_PRIORITY, RELIABLE_ORDERED, 0, world->GetHost(), false);
241
242 return true;
243 }
244
245 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
246
247 TeamSelection TM_TeamMember::GetRequestedTeam(void) const
248 {
249 if (teamsRequested.Size()>0)
250 return TeamSelection::SpecificTeam(teamsRequested[0].requested);
251 else if (joinTeamType==JOIN_NO_TEAM)
252 return TeamSelection::NoTeam(noTeamSubcategory);
253 else
254 return TeamSelection::AnyAvailable();
255 }
256
257 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
258
259 void TM_TeamMember::GetRequestedSpecificTeams(DataStructures::List<TM_Team*> &requestedTeams) const
260 {
261 requestedTeams.Clear(true, _FILE_AND_LINE_);
262 for (unsigned int i=0; i < teamsRequested.Size(); i++)
263 requestedTeams.Push(teamsRequested[i].requested, _FILE_AND_LINE_);
264 }
265
266 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
267
268 bool TM_TeamMember::HasRequestedTeam(TM_Team *team) const
269 {
270 unsigned int i = GetRequestedTeamIndex(team);
271 if (i==(unsigned int)-1)
272 return false;
273 return true;
274 }
275
276 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
277
278 unsigned int TM_TeamMember::GetRequestedTeamIndex(TM_Team *team) const
279 {
280 unsigned int i;
281 for (i=0; i < teamsRequested.Size(); i++)
282 {
283 if (teamsRequested[i].requested==team)
284 return i;
285 }
286 return (unsigned int) -1;
287 }
288
289 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
290
291 unsigned int TM_TeamMember::GetRequestedTeamCount(void) const
292 {
293 return teamsRequested.Size();
294 }
295
296 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
297
298 bool TM_TeamMember::CancelTeamRequest(TM_Team *specificTeamToCancel)
299 {
300 if (RemoveFromRequestedTeams(specificTeamToCancel)==false)
301 return false;
302
303 // Send request to host to execute JoinRequestedTeam()
304 BitStream bsOut;
305 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED);
306 bsOut.Write(world->GetWorldId());
307 bsOut.Write(networkId);
308 if (specificTeamToCancel)
309 {
310 bsOut.Write(true);
311 bsOut.Write(specificTeamToCancel->GetNetworkID());
312 }
313 else
314 {
315 bsOut.Write(false);
316 }
317 world->BroadcastToParticipants(&bsOut, UNASSIGNED_RAKNET_GUID);
318
319 world->GetTeamManager()->PushBitStream(&bsOut);
320
321 return true;
322 }
323
324 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
325
326 bool TM_TeamMember::LeaveTeam(TM_Team* team, NoTeamId _noTeamSubcategory)
327 {
328 if (LeaveTeamCheck(team)==false)
329 return false;
330
331 RemoveFromSpecificTeamInternal(team);
332 if (teams.Size()==0)
333 {
334 noTeamSubcategory=_noTeamSubcategory;
335 joinTeamType=JOIN_NO_TEAM;
336 }
337
338 // Execute LeaveTeamCheck()
339 // - LeaveTeamCheck():
340 // - - If not on this team, return false
341 // On local, call RemoteFromTeamsList(). Send event to also execute this to remote host
342 // If we are host, execute OnLeaveTeamEvent(myGuid)
343 // - OnLeaveTeamEvent(requesterGuid):
344 // - - If rebalancing is active, rebalance
345 // - - If someone else wants to join this team, let them.
346 // - - Send leave team event notification to all except requesterGuid-
347 // On remote host, execute LeaveTeamCheck(). If fails, ignore.
348 // On remote host, execute RemoteFromTeamsList() followed by OnLeaveTeamEvent(packet->guid)
349
350 // Pattern:
351 // Execute local check, if fails return false
352 // Locally execute non-host guaranteed changes
353 // If local system is also host, execute host changes. Relay to all but local
354 // On remote host, execute check. If check passes, execute non-host changes, followed by host changes. Relay to all but sender.
355 BitStream bsOut;
356 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
357 bsOut.WriteCasted<MessageID>(ID_RUN_LeaveTeam);
358 bsOut.Write(world->GetWorldId());
359 bsOut.Write(networkId);
360 bsOut.Write(team->GetNetworkID());
361 bsOut.Write(noTeamSubcategory);
362 world->BroadcastToParticipants(&bsOut, UNASSIGNED_RAKNET_GUID);
363
364 if (world->GetHost()==world->GetTeamManager()->GetMyGUIDUnified())
365 {
366 // Rebalance teams
367 world->FillRequestedSlots();
368 world->EnforceTeamBalance(noTeamSubcategory);
369 }
370
371 return true;
372 }
373
374 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
375
376 bool TM_TeamMember::LeaveAllTeams(NoTeamId inNoTeamSubcategory)
377 {
378 return RequestTeam(TeamSelection::NoTeam(inNoTeamSubcategory));
379 }
380
381 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
382
383 TM_Team* TM_TeamMember::GetCurrentTeam(void) const
384 {
385 if (teams.Size()>0)
386 return teams[0];
387 return 0;
388 }
389
390 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
391
392 unsigned int TM_TeamMember::GetCurrentTeamCount(void) const
393 {
394 return teams.Size();
395 }
396
397 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
398
399 TM_Team* TM_TeamMember::GetCurrentTeamByIndex(unsigned int index)
400 {
401 return teams[index];
402 }
403
404 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
405
406 void TM_TeamMember::GetCurrentTeams(DataStructures::List<TM_Team*> &_teams) const
407 {
408 _teams=teams;
409 }
410
411 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
412
413 void TM_TeamMember::GetLastTeams(DataStructures::List<TM_Team*> &_teams) const
414 {
415 _teams=lastTeams;
416 }
417
418 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
419
420 bool TM_TeamMember::IsOnTeam(TM_Team *team) const
421 {
422 unsigned int i;
423 for (i=0; i < teams.Size(); i++)
424 {
425 if (teams[i]==team)
426 return true;
427 }
428 return false;
429 }
430
431 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
432
433 NetworkID TM_TeamMember::GetNetworkID(void) const
434 {
435 return networkId;
436 }
437
438 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
439
440 TM_World* TM_TeamMember::GetTM_World(void) const
441 {
442 return world;
443 }
444
445 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
446
447 void TM_TeamMember::SerializeConstruction(BitStream *constructionBitstream)
448 {
449 // Write requested teams
450 constructionBitstream->Write(world->GetWorldId());
451 constructionBitstream->Write(networkId);
452 constructionBitstream->WriteCasted<uint16_t>(teamsRequested.Size());
453 for (unsigned int i=0; i < teamsRequested.Size(); i++)
454 {
455 constructionBitstream->Write(teamsRequested[i].isTeamSwitch);
456 if (teamsRequested[i].teamToLeave)
457 {
458 constructionBitstream->Write(true);
459 constructionBitstream->Write(teamsRequested[i].teamToLeave->GetNetworkID());
460 }
461 else
462 {
463 constructionBitstream->Write(false);
464 }
465 if (teamsRequested[i].requested)
466 {
467 constructionBitstream->Write(true);
468 constructionBitstream->Write(teamsRequested[i].requested->GetNetworkID());
469 }
470 else
471 {
472 constructionBitstream->Write(false);
473 }
474 }
475
476 world->teamManager->EncodeTeamAssigned(constructionBitstream, this);
477 }
478
479 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
480
481 bool TM_TeamMember::DeserializeConstruction(TeamManager *teamManager, BitStream *constructionBitstream)
482 {
483 // Read requested teams
484 bool success;
485 uint16_t teamsRequestedSize;
486
487 WorldId worldId;
488 constructionBitstream->Read(worldId);
489 TM_World *curWorld = teamManager->GetWorldWithId(worldId);
490 RakAssert(curWorld);
491 constructionBitstream->Read(networkId);
492 curWorld->ReferenceTeamMember(this,networkId);
493
494 success=constructionBitstream->Read(teamsRequestedSize);
495 for (unsigned int i=0; i < teamsRequestedSize; i++)
496 {
497 RequestedTeam rt;
498 rt.isTeamSwitch=false;
499 rt.requested=0;
500 rt.whenRequested=0;
501 constructionBitstream->Read(rt.isTeamSwitch);
502 bool hasTeamToLeave=false;
503 constructionBitstream->Read(hasTeamToLeave);
504 NetworkID teamToLeaveId;
505 if (hasTeamToLeave)
506 {
507 constructionBitstream->Read(teamToLeaveId);
508 rt.teamToLeave = curWorld->GetTeamByNetworkID(teamToLeaveId);
509 RakAssert(rt.teamToLeave);
510 }
511 else
512 rt.teamToLeave=0;
513 bool hasTeamRequested=false;
514 success=constructionBitstream->Read(hasTeamRequested);
515 NetworkID teamRequestedId;
516 if (hasTeamRequested)
517 {
518 success=constructionBitstream->Read(teamRequestedId);
519 rt.requested = curWorld->GetTeamByNetworkID(teamRequestedId);
520 RakAssert(rt.requested);
521 }
522 rt.whenRequested= SLNet::GetTime();
523 rt.requestIndex= curWorld->teamRequestIndex++; // In case whenRequested is the same between two teams when sorting team requests
524 if (
525 (hasTeamToLeave==false || (hasTeamToLeave==true && rt.teamToLeave!=0)) &&
526 (hasTeamRequested==false || (hasTeamRequested==true && rt.requested!=0))
527 )
528 {
529 teamsRequested.Push(rt, _FILE_AND_LINE_);
530 }
531 }
532
533
534 if (success)
535 curWorld->teamManager->ProcessTeamAssigned(constructionBitstream);
536 return success;
537 }
538
539 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
540
541 void *TM_TeamMember::GetOwner(void) const
542 {
543 return owner;
544 }
545
546 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
547
548 void TM_TeamMember::SetOwner(void *o)
549 {
550 owner=o;
551 }
552
553 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
554
555 NoTeamId TM_TeamMember::GetNoTeamId(void) const
556 {
557 return noTeamSubcategory;
558 }
559
560 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
561
562 unsigned int TM_TeamMember::GetWorldIndex(void) const
563 {
564 return world->GetTeamMemberIndex(this);
565 }
566
567 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
568
569 unsigned long TM_TeamMember::ToUint32( const NetworkID &g )
570 {
571 return g & 0xFFFFFFFF;
572 }
573
574 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
575
576 void TM_TeamMember::UpdateListsToNoTeam(NoTeamId nti)
577 {
578 teamsRequested.Clear(true, _FILE_AND_LINE_ );
579 for (unsigned int i=0; i < teams.Size(); i++)
580 {
581 teams[i]->RemoveFromTeamMemberList(this);
582 }
583 teams.Clear(true, _FILE_AND_LINE_ );
584 noTeamSubcategory=nti;
585 joinTeamType=JOIN_NO_TEAM;
586 }
587
588 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
589
590 bool TM_TeamMember::JoinAnyTeamCheck(void) const
591 {
592 // - - If already on a team, return false
593 if (teams.Size() > 0)
594 return false;
595
596 // - - If any team is already in requested teams, return false.
597 if (teamsRequested.Size()==0 && joinTeamType==JOIN_ANY_AVAILABLE_TEAM)
598 return false;
599
600 return true;
601 }
602
603 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
604
605 bool TM_TeamMember::JoinSpecificTeamCheck(TM_Team *specificTeamToJoin, bool ignoreRequested) const
606 {
607 // - If already on specific team, return false
608 if (IsOnTeam(specificTeamToJoin))
609 return false;
610
611 if (ignoreRequested)
612 return true;
613
614 unsigned int i;
615 for (i=0; i < teamsRequested.Size(); i++)
616 {
617 if (teamsRequested[i].requested==specificTeamToJoin)
618 {
619 if (teamsRequested[i].isTeamSwitch==true)
620 return true; // Turn off team switch
621
622 // Same thing
623 return false;
624 }
625 }
626
627 // Not in teams requested
628 return true;
629 }
630
631 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
632
633 bool TM_TeamMember::SwitchSpecificTeamCheck(TM_Team *teamToJoin, TM_Team *teamToLeave, bool ignoreRequested) const
634 {
635 RakAssert(teamToJoin!=0);
636
637 // - If already on specific team, return false
638 if (IsOnTeam(teamToJoin))
639 return false;
640
641 if (teamToLeave!=0 && IsOnTeam(teamToLeave)==false)
642 return false;
643
644 if (teamToJoin==teamToLeave)
645 return false;
646
647 if (ignoreRequested)
648 return true;
649
650 unsigned int i;
651 for (i=0; i < teamsRequested.Size(); i++)
652 {
653 if (teamsRequested[i].requested==teamToJoin)
654 {
655 if (teamsRequested[i].isTeamSwitch==false)
656 return true; // Different - leave team was off, turn on
657
658 if (teamsRequested[i].teamToLeave==teamToLeave)
659 return false; // Same thing - leave all or a specific team
660
661 // Change leave team
662 return true;
663 }
664 }
665
666 // Not in teams requested
667 return true;
668 }
669
670 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
671
672 bool TM_TeamMember::LeaveTeamCheck(TM_Team *team) const
673 {
674 if (IsOnTeam(team)==false)
675 return false;
676 return true;
677 }
678
679 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
680
681 void TM_TeamMember::UpdateTeamsRequestedToAny(void)
682 {
683 teamsRequested.Clear(true, _FILE_AND_LINE_);
684 joinTeamType=JOIN_ANY_AVAILABLE_TEAM;
685 whenJoinAnyRequested= SLNet::GetTime();
686 joinAnyRequestIndex=world->teamRequestIndex++; // In case whenRequested is the same between two teams when sorting team requests
687 }
688
689 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
690
691 void TM_TeamMember::UpdateTeamsRequestedToNone(void)
692 {
693 teamsRequested.Clear(true, _FILE_AND_LINE_);
694 joinTeamType=JOIN_NO_TEAM;
695 }
696
697 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
698
699 void TM_TeamMember::AddToRequestedTeams(TM_Team *teamToJoin)
700 {
701 RemoveFromRequestedTeams(teamToJoin);
702
703 RequestedTeam rt;
704 rt.isTeamSwitch=false;
705 rt.requested=teamToJoin;
706 rt.teamToLeave=0;
707 rt.whenRequested= SLNet::GetTime();
708 rt.requestIndex=world->teamRequestIndex++; // In case whenRequested is the same between two teams when sorting team requests
709 teamsRequested.Push(rt, _FILE_AND_LINE_ );
710 }
711
712 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
713
714 void TM_TeamMember::AddToRequestedTeams(TM_Team *teamToJoin, TM_Team *teamToLeave)
715 {
716 RemoveFromRequestedTeams(teamToJoin);
717
718 RequestedTeam rt;
719 rt.isTeamSwitch=true;
720 rt.requested=teamToJoin;
721 rt.teamToLeave=teamToLeave;
722 rt.whenRequested= SLNet::GetTime();
723 rt.requestIndex=world->teamRequestIndex++; // In case whenRequested is the same between two teams when sorting team requests
724 teamsRequested.Push(rt, _FILE_AND_LINE_ );
725 }
726
727 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
728
729 bool TM_TeamMember::RemoveFromRequestedTeams(TM_Team *team)
730 {
731 if (team==0)
732 {
733 teamsRequested.Clear(true, _FILE_AND_LINE_);
734 joinTeamType=JOIN_NO_TEAM;
735 return true;
736 }
737 else
738 {
739 unsigned int i;
740 for (i=0; i < teamsRequested.Size(); i++)
741 {
742 if (teamsRequested[i].requested==team)
743 {
744 teamsRequested.RemoveAtIndex(i);
745 if (teamsRequested.Size()==0)
746 {
747 joinTeamType=JOIN_NO_TEAM;
748 }
749 return true;
750 }
751 }
752 }
753 return false;
754 }
755
756 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
757
758 void TM_TeamMember::AddToTeamList(TM_Team *team)
759 {
760 team->teamMembers.Push(this, _FILE_AND_LINE_ );
761 teams.Push(team, _FILE_AND_LINE_ );
762 }
763
764 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
765
766 void TM_TeamMember::RemoveFromSpecificTeamInternal(TM_Team *team)
767 {
768 unsigned int i,j;
769 for (i=0; i < teams.Size(); i++)
770 {
771 if (teams[i]==team)
772 {
773 for (j=0; j < team->teamMembers.Size(); j++)
774 {
775 if (team->teamMembers[j]==this)
776 {
777 team->teamMembers.RemoveAtIndex(j);
778 break;
779 }
780 }
781 teams.RemoveAtIndex(i);
782 break;
783 }
784 }
785 }
786
787 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
788
789 void TM_TeamMember::RemoveFromAllTeamsInternal(void)
790 {
791 TM_Team *team;
792 unsigned int i,j;
793 for (i=0; i < teams.Size(); i++)
794 {
795 team = teams[i];
796
797 for (j=0; j < team->teamMembers.Size(); j++)
798 {
799 if (team->teamMembers[j]==this)
800 {
801 team->teamMembers.RemoveAtIndex(j);
802 break;
803 }
804 }
805 }
806 teams.Clear(true, _FILE_AND_LINE_);
807 }
808
809 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
810
811 void TM_TeamMember::StoreLastTeams(void)
812 {
813 lastTeams=teams;
814 }
815
816 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
817
818
819
820 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
821
822
823
824 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
825
826 TM_Team::TM_Team()
827 {
828 ID=0;
829 world=0;
830 joinPermissions=ALLOW_JOIN_ANY_AVAILABLE_TEAM|ALLOW_JOIN_SPECIFIC_TEAM|ALLOW_JOIN_REBALANCING;
831 balancingApplies=true;
832 teamMemberLimit=65535;
833 owner=0;
834 }
835
836 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
837
838 TM_Team::~TM_Team()
839 {
840 if (world)
841 world->DereferenceTeam(this, 0);
842 }
843
844 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
845
846 bool TM_Team::SetMemberLimit(TeamMemberLimit _teamMemberLimit, NoTeamId noTeamId)
847 {
848 if (teamMemberLimit==_teamMemberLimit)
849 return false;
850
851 teamMemberLimit=_teamMemberLimit;
852 // Network this as request to host
853 BitStream bsOut;
854 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
855 bsOut.WriteCasted<MessageID>(ID_RUN_SetMemberLimit);
856 bsOut.Write(world->GetWorldId());
857 bsOut.Write(GetNetworkID());
858 bsOut.Write(teamMemberLimit);
859 bsOut.Write(noTeamId);
860 world->GetTeamManager()->Send(&bsOut, world->GetHost(), false);
861
862 return true;
863 }
864
865 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
866
867 TeamMemberLimit TM_Team::GetMemberLimit(void) const
868 {
869 if (world->GetBalanceTeams()==false)
870 {
871 return teamMemberLimit;
872 }
873 else
874 {
875 TeamMemberLimit limitWithBalancing=world->GetBalancedTeamLimit();
876 if (limitWithBalancing < teamMemberLimit)
877 return limitWithBalancing;
878 return teamMemberLimit;
879 }
880 }
881
882 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
883
884 TeamMemberLimit TM_Team::GetMemberLimitSetting(void) const
885 {
886 return teamMemberLimit;
887 }
888
889 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
890
891 bool TM_Team::SetJoinPermissions(JoinPermissions _joinPermissions)
892 {
893 if (joinPermissions==_joinPermissions)
894 return false;
895
896 joinPermissions=_joinPermissions;
897
898 // Network this as request to host
899 BitStream bsOut;
900 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
901 bsOut.WriteCasted<MessageID>(ID_RUN_SetJoinPermissions);
902 bsOut.Write(world->GetWorldId());
903 bsOut.Write(GetNetworkID());
904 bsOut.Write(_joinPermissions);
905 world->GetTeamManager()->Send(&bsOut,world->GetHost(), false);
906
907 return true;
908
909
910 }
911
912 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
913
914 JoinPermissions TM_Team::GetJoinPermissions(void) const
915 {
916 return joinPermissions;
917 }
918
919 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
920
921 void TM_Team::LeaveTeam(TM_TeamMember* teamMember, NoTeamId noTeamSubcategory)
922 {
923 teamMember->LeaveTeam(this, noTeamSubcategory);
924 }
925
926 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
927
928 bool TM_Team::GetBalancingApplies(void) const
929 {
930 return balancingApplies;
931 }
932
933 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
934
935 void TM_Team::GetTeamMembers(DataStructures::List<TM_TeamMember*> &_teamMembers) const
936 {
937 _teamMembers=teamMembers;
938 }
939
940 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
941
942 unsigned int TM_Team::GetTeamMembersCount(void) const
943 {
944 return teamMembers.Size();
945 }
946
947 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
948
949 TM_TeamMember *TM_Team::GetTeamMemberByIndex(unsigned int index) const
950 {
951 return teamMembers[index];
952 }
953
954 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
955
956 NetworkID TM_Team::GetNetworkID(void) const
957 {
958 return ID;
959 }
960
961 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
962
963 TM_World* TM_Team::GetTM_World(void) const
964 {
965 return world;
966 }
967
968 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
969
970 void TM_Team::SerializeConstruction(BitStream *constructionBitstream)
971 {
972 // Do not need to serialize member lists, the team members do this
973 constructionBitstream->Write(world->GetWorldId());
974 constructionBitstream->Write(ID);
975 constructionBitstream->Write(joinPermissions);
976 constructionBitstream->Write(balancingApplies);
977 constructionBitstream->Write(teamMemberLimit);
978
979 }
980
981 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
982
983 bool TM_Team::DeserializeConstruction(TeamManager *teamManager, BitStream *constructionBitstream)
984 {
985 WorldId worldId;
986 constructionBitstream->Read(worldId);
987 TM_World *curWorld = teamManager->GetWorldWithId(worldId);
988 RakAssert(curWorld);
989 constructionBitstream->Read(ID);
990 constructionBitstream->Read(joinPermissions);
991 constructionBitstream->Read(balancingApplies);
992 bool b = constructionBitstream->Read(teamMemberLimit);
993 RakAssert(b);
994 if (b)
995 {
996 curWorld->ReferenceTeam(this,ID,balancingApplies);
997 }
998 return b;
999 }
1000
1001
1002 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1003
1004 unsigned long TM_Team::ToUint32( const NetworkID &g )
1005 {
1006 return g & 0xFFFFFFFF;
1007 }
1008
1009 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1010
1011 void *TM_Team::GetOwner(void) const
1012 {
1013 return owner;
1014 }
1015
1016 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1017
1018
1019 unsigned int TM_Team::GetWorldIndex(void) const
1020 {
1021 return world->GetTeamIndex(this);
1022 }
1023
1024 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1025
1026 void TM_Team::SetOwner(void *o)
1027 {
1028 owner=o;
1029 }
1030
1031 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1032
1033 void TM_Team::RemoveFromTeamMemberList(TM_TeamMember *teamMember)
1034 {
1035 unsigned int index = teamMembers.GetIndexOf(teamMember);
1036 RakAssert(index != (unsigned int) -1);
1037 teamMembers.RemoveAtIndex(index);
1038 }
1039
1040 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1041
1042 unsigned int TM_Team::GetMemberWithRequestedSingleTeamSwitch(TM_Team *team)
1043 {
1044 unsigned int i;
1045 for (i=0; i < teamMembers.Size(); i++)
1046 {
1047 if (teamMembers[i]->GetCurrentTeamCount()==1)
1048 {
1049 unsigned int j = teamMembers[i]->GetRequestedTeamIndex(team);
1050 if (j!=(unsigned int)-1)
1051 {
1052 if (teamMembers[i]->teamsRequested[j].isTeamSwitch &&
1053 (teamMembers[i]->teamsRequested[j].teamToLeave==0 ||
1054 teamMembers[i]->teamsRequested[j].teamToLeave==teamMembers[i]->teams[0])
1055 )
1056 return i;
1057 }
1058 }
1059 }
1060 return (unsigned int) -1;
1061 }
1062
1063 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1064
1065
1066 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1067
1068 TM_World::TM_World()
1069 {
1070 teamManager=0;
1071 balanceTeamsIsActive=false;
1072 hostGuid=UNASSIGNED_RAKNET_GUID;
1073 worldId=0;
1074 autoAddParticipants=true;
1075 teamRequestIndex=0;
1076 }
1077
1078 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1079
1080 TM_World::~TM_World()
1081 {
1082 Clear();
1083 }
1084
1085 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1086
1087 TeamManager *TM_World::GetTeamManager(void) const
1088 {
1089 return teamManager;
1090 }
1091
1092 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1093
1094 void TM_World::AddParticipant(RakNetGUID rakNetGUID)
1095 {
1096 participants.Push(rakNetGUID, _FILE_AND_LINE_ );
1097
1098 // Send to remote system status of balanceTeamsIsActive
1099
1100 if (GetTeamManager()->GetMyGUIDUnified()==GetHost())
1101 {
1102 // Actually just transmitting initial value of balanceTeamsIsActive
1103 BitStream bsOut;
1104 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
1105 bsOut.WriteCasted<MessageID>(ID_RUN_SetBalanceTeamsInitial);
1106 bsOut.Write(GetWorldId());
1107 bsOut.Write(balanceTeamsIsActive);
1108 teamManager->SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0,rakNetGUID, false);
1109 }
1110 }
1111
1112 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1113
1114 void TM_World::RemoveParticipant(RakNetGUID rakNetGUID)
1115 {
1116 unsigned int i;
1117 i = participants.GetIndexOf(rakNetGUID);
1118 if (i!=(unsigned int)-1)
1119 participants.RemoveAtIndex(i);
1120 }
1121
1122 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1123
1124 void TM_World::SetAutoManageConnections(bool autoAdd)
1125 {
1126 autoAddParticipants=autoAdd;
1127 }
1128
1129 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1130
1131 void TM_World::GetParticipantList(DataStructures::List<RakNetGUID> &participantList)
1132 {
1133 participantList = participants;
1134 }
1135
1136 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1137
1138 void TM_World::ReferenceTeam(TM_Team *team, NetworkID networkId, bool applyBalancing)
1139 {
1140 unsigned int i;
1141 for (i=0; i < teams.Size(); i++)
1142 {
1143 if (teams[i]==team)
1144 return;
1145 }
1146
1147 team->ID=networkId;
1148 team->balancingApplies=applyBalancing;
1149 team->world=this;
1150
1151 // Add this team to the list of teams
1152 teams.Push(team, _FILE_AND_LINE_);
1153
1154 teamsHash.Push(networkId,team,_FILE_AND_LINE_);
1155
1156 // If autobalancing is on, and the team lock state supports it, then call EnforceTeamBalancing()
1157 if (applyBalancing && balanceTeamsIsActive)
1158 {
1159 EnforceTeamBalance(0);
1160 }
1161 }
1162
1163 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1164
1165 void TM_World::DereferenceTeam(TM_Team *team, NoTeamId noTeamSubcategory)
1166 {
1167 unsigned int i;
1168 for (i=0; i < teams.Size(); i++)
1169 {
1170 if (teams[i]==team)
1171 {
1172 TM_Team *curTeam = teams[i];
1173 while (curTeam->teamMembers.Size())
1174 {
1175 curTeam->teamMembers[curTeam->teamMembers.Size()-1]->LeaveTeam(curTeam, noTeamSubcategory);
1176 }
1177 teams.RemoveAtIndex(i);
1178
1179 teamsHash.Remove(curTeam->GetNetworkID(),_FILE_AND_LINE_);
1180
1181 break;
1182 }
1183 }
1184 }
1185
1186 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1187
1188 unsigned int TM_World::GetTeamCount(void) const
1189 {
1190 return teams.Size();
1191 }
1192
1193 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1194
1195 TM_Team *TM_World::GetTeamByIndex(unsigned int index) const
1196 {
1197 return teams[index];
1198 }
1199
1200 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1201
1202 TM_Team *TM_World::GetTeamByNetworkID(NetworkID teamId)
1203 {
1204 DataStructures::HashIndex hi = teamsHash.GetIndexOf(teamId);
1205 if (hi.IsInvalid())
1206 return 0;
1207 return teamsHash.ItemAtIndex(hi);
1208 }
1209
1210 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1211
1212 unsigned int TM_World::GetTeamIndex(const TM_Team *team) const
1213 {
1214 unsigned int i;
1215 for (i=0; i < teams.Size(); i++)
1216 {
1217 if (teams[i]==team)
1218 return i;
1219 }
1220 return (unsigned int) -1;
1221 }
1222
1223 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1224
1225 void TM_World::ReferenceTeamMember(TM_TeamMember *teamMember, NetworkID networkId)
1226 {
1227 unsigned int i;
1228 for (i=0; i < teamMembers.Size(); i++)
1229 {
1230 if (teamMembers[i]==teamMember)
1231 return;
1232 }
1233
1234 teamMember->world=this;
1235 teamMember->networkId=networkId;
1236
1237 teamMembers.Push(teamMember, _FILE_AND_LINE_);
1238
1239 teamMembersHash.Push(networkId,teamMember,_FILE_AND_LINE_);
1240 }
1241
1242 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1243
1244 void TM_World::DereferenceTeamMember(TM_TeamMember *teamMember)
1245 {
1246 unsigned int i;
1247 for (i=0; i < teamMembers.Size(); i++)
1248 {
1249 if (teamMembers[i]==teamMember)
1250 {
1251 teamMembers[i]->UpdateListsToNoTeam(0);
1252 teamMembersHash.Remove(teamMembers[i]->GetNetworkID(),_FILE_AND_LINE_);
1253 teamMembers.RemoveAtIndex(i);
1254 break;
1255 }
1256 }
1257 }
1258
1259 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1260
1261 unsigned int TM_World::GetTeamMemberCount(void) const
1262 {
1263 return teamMembers.Size();
1264 }
1265
1266 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1267
1268 TM_TeamMember *TM_World::GetTeamMemberByIndex(unsigned int index) const
1269 {
1270 return teamMembers[index];
1271 }
1272
1273 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1274
1275 NetworkID TM_World::GetTeamMemberIDByIndex(unsigned int index) const
1276 {
1277 return teamMembers[index]->GetNetworkID();
1278 }
1279
1280 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1281
1282 TM_TeamMember *TM_World::GetTeamMemberByNetworkID(NetworkID teamMemberId)
1283 {
1284 DataStructures::HashIndex hi = teamMembersHash.GetIndexOf(teamMemberId);
1285 if (hi.IsInvalid())
1286 return 0;
1287 return teamMembersHash.ItemAtIndex(hi);
1288 }
1289
1290 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1291
1292 unsigned int TM_World::GetTeamMemberIndex(const TM_TeamMember *teamMember) const
1293 {
1294 unsigned int i;
1295 for (i=0; i < teamMembers.Size(); i++)
1296 {
1297 if (teamMembers[i]==teamMember)
1298 return i;
1299 }
1300 return (unsigned int) -1;
1301 }
1302
1303 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1304
1305 bool TM_World::SetBalanceTeams(bool balanceTeams, NoTeamId noTeamId)
1306 {
1307 if (balanceTeams==balanceTeamsIsActive)
1308 return false;
1309
1310 balanceTeamsIsActive=balanceTeams;
1311
1312 // Network this as request to host
1313 BitStream bsOut;
1314 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
1315 bsOut.WriteCasted<MessageID>(ID_RUN_SetBalanceTeams);
1316 bsOut.Write(GetWorldId());
1317 bsOut.Write(balanceTeams);
1318 bsOut.Write(noTeamId);
1319 GetTeamManager()->SendUnified(&bsOut,HIGH_PRIORITY, RELIABLE_ORDERED, 0, GetHost(), false);
1320
1321 return true;
1322 }
1323
1324 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1325
1326 bool TM_World::GetBalanceTeams(void) const
1327 {
1328 return balanceTeamsIsActive;
1329 }
1330
1331 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1332
1333 void TM_World::SetHost(RakNetGUID _hostGuid)
1334 {
1335 if (hostGuid==_hostGuid)
1336 return;
1337
1338 RakAssert(_hostGuid!=UNASSIGNED_RAKNET_GUID);
1339
1340 hostGuid=_hostGuid;
1341
1342 if (GetHost()==GetTeamManager()->GetMyGUIDUnified())
1343 FillRequestedSlots();
1344 }
1345
1346 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1347
1348 RakNetGUID TM_World::GetHost(void) const
1349 {
1350 return hostGuid;
1351 }
1352
1353 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1354
1355 WorldId TM_World::GetWorldId(void) const
1356 {
1357 return worldId;
1358 }
1359
1360 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1361
1362 void TM_World::Clear(void)
1363 {
1364 for (unsigned int i=0; i < teams.Size(); i++)
1365 {
1366 teams[i]->world=0;
1367 }
1368 for (unsigned int i=0; i < teamMembers.Size(); i++)
1369 {
1370 teamMembers[i]->world=0;
1371 }
1372 participants.Clear(true, _FILE_AND_LINE_);
1373 teams.Clear(true, _FILE_AND_LINE_);
1374 teamMembers.Clear(true, _FILE_AND_LINE_);
1375 }
1376
1377 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1378
1379 void TM_World::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
1380 {
1381 (void) lostConnectionReason;
1382 (void) systemAddress;
1383
1384 RemoveParticipant(rakNetGUID);
1385 }
1386
1387 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1388
1389 void TM_World::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
1390 {
1391 (void) isIncoming;
1392 (void) systemAddress;
1393
1394 if (autoAddParticipants)
1395 AddParticipant(rakNetGUID);
1396 }
1397
1398 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1399
1400 void TM_World::EnforceTeamBalance(NoTeamId noTeamId)
1401 {
1402 // Host only function
1403 RakAssert(GetHost()==GetTeamManager()->GetMyGUIDUnified());
1404
1405 KickExcessMembers(noTeamId);
1406 }
1407
1408
1409 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1410
1411 void TM_World::KickExcessMembers(NoTeamId noTeamId)
1412 {
1413 // Host only function
1414 RakAssert(GetHost()==GetTeamManager()->GetMyGUIDUnified());
1415
1416 // For each team that applies balancing, if the team is overfull, put on a team that is not overfull if the team has ALLOW_JOIN_REBALANCING set
1417 // If cannot move the player to another team, just take the player off the team and set to noTeamId if they have no team at that point
1418
1419 TeamMemberLimit balancedTeamLimit;
1420 if (balanceTeamsIsActive)
1421 balancedTeamLimit = GetBalancedTeamLimit();
1422 else
1423 balancedTeamLimit = (TeamMemberLimit) -1;
1424
1425 TM_Team *team, *teamToJoin;
1426 unsigned int i, teamIndex;
1427 for (i=0; i < teams.Size(); i++)
1428 {
1429 team = teams[i];
1430 while (team->GetMemberLimitSetting() < team->GetTeamMembersCount() ||
1431 (balancedTeamLimit < team->GetTeamMembersCount() && team->GetBalancingApplies()) )
1432 {
1433 TM_TeamMember *teamMember = team->teamMembers[team->teamMembers.Size()-1];
1434
1435 teamIndex = GetAvailableTeamIndexWithFewestMembers(balancedTeamLimit, ALLOW_JOIN_REBALANCING);
1436 if (teamIndex == (unsigned int)-1)
1437 {
1438 // Move this member to no team
1439 teamMember->LeaveTeam(team, noTeamId);
1440 teamManager->PushTeamAssigned(teamMember);
1441 }
1442 else
1443 {
1444 teamToJoin = teams[teamIndex];
1445
1446 // Move this member
1447 teamMember->StoreLastTeams();
1448 teamManager->RemoveFromTeamsRequestedAndAddTeam(teamMember, teamToJoin, true, team);
1449
1450 BitStream bsOut;
1451 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
1452 bsOut.WriteCasted<MessageID>(ID_RUN_RemoveFromTeamsRequestedAndAddTeam);
1453 bsOut.Write(GetWorldId());
1454 bsOut.Write(teamMember->GetNetworkID());
1455 bsOut.Write(teamToJoin->GetNetworkID());
1456 bsOut.Write(true);
1457 bsOut.Write(true);
1458 bsOut.Write(team->GetNetworkID());
1459 BroadcastToParticipants(&bsOut, UNASSIGNED_RAKNET_GUID);
1460 }
1461
1462 }
1463 }
1464 }
1465 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1466
1467 void TM_World::FillRequestedSlots(void)
1468 {
1469 // Host only function
1470 RakAssert(GetHost()==GetTeamManager()->GetMyGUIDUnified());
1471
1472
1473 TeamMemberLimit balancedTeamLimit;
1474 if (balanceTeamsIsActive)
1475 balancedTeamLimit = GetBalancedTeamLimit();
1476 else
1477 balancedTeamLimit = (TeamMemberLimit) -1;
1478
1479 unsigned int teamIndex, indexIntoTeamsRequested = (unsigned int)-1;
1480 TM_Team *team;
1481 TM_TeamMember *teamMember;
1482 DataStructures::OrderedList<TM_World::JoinRequestHelper, TM_World::JoinRequestHelper, JoinRequestHelperComp> joinRequests;
1483 GetSortedJoinRequests(joinRequests);
1484 unsigned int joinRequestIndex;
1485
1486 for (joinRequestIndex=0; joinRequestIndex < joinRequests.Size(); joinRequestIndex++)
1487 {
1488 teamMember = teamMembers[joinRequests[joinRequestIndex].teamMemberIndex];
1489 if (teamMember->teamsRequested.Size()==0)
1490 {
1491 if (teamMember->joinTeamType==JOIN_ANY_AVAILABLE_TEAM)
1492 teamIndex = GetAvailableTeamIndexWithFewestMembers(balancedTeamLimit, ALLOW_JOIN_ANY_AVAILABLE_TEAM);
1493 else
1494 teamIndex=(unsigned int)-1;
1495 }
1496 else
1497 {
1498 indexIntoTeamsRequested = joinRequests[joinRequestIndex].indexIntoTeamsRequested;
1499
1500 team = teamMember->teamsRequested[indexIntoTeamsRequested].requested;
1501 if (team->GetTeamMembersCount() < balancedTeamLimit &&
1502 team->GetTeamMembersCount() < team->GetMemberLimitSetting() &&
1503 (ALLOW_JOIN_SPECIFIC_TEAM & team->GetJoinPermissions())!=0)
1504 {
1505 teamIndex=teams.GetIndexOf(team);
1506 }
1507 else
1508 {
1509 teamIndex=(unsigned int)-1;
1510 }
1511 }
1512
1513 if (teamIndex != (unsigned int)-1)
1514 {
1515 team = teams[teamIndex];
1516
1517 if (teamMember->teamsRequested.Size()==0)
1518 {
1519 if (teamMember->joinTeamType==JOIN_ANY_AVAILABLE_TEAM)
1520 {
1521 // Join any
1522 teamMember->StoreLastTeams();
1523 teamMember->UpdateTeamsRequestedToNone();
1524 teamMember->AddToTeamList(teams[teamIndex]);
1525 teamManager->PushTeamAssigned(teamMember);
1526
1527 BitStream bsOut;
1528 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
1529 bsOut.WriteCasted<MessageID>(ID_RUN_UpdateTeamsRequestedToNoneAndAddTeam);
1530 bsOut.Write(GetWorldId());
1531 bsOut.Write(teamMember->GetNetworkID());
1532 bsOut.Write(team->GetNetworkID());
1533 BroadcastToParticipants(&bsOut, UNASSIGNED_RAKNET_GUID);
1534 }
1535 }
1536 else
1537 {
1538 // Switch or join specific
1539 DataStructures::List<TM_Team*> teamsWeAreLeaving;
1540 bool isSwitch = teamMember->teamsRequested[indexIntoTeamsRequested].isTeamSwitch;
1541 TM_Team *teamToLeave;
1542 if (isSwitch)
1543 {
1544 teamToLeave=teamMember->teamsRequested[indexIntoTeamsRequested].teamToLeave;
1545 if (teamToLeave)
1546 {
1547 if (teamMember->IsOnTeam(teamToLeave))
1548 {
1549 teamsWeAreLeaving.Push(teamToLeave, _FILE_AND_LINE_);
1550 }
1551 else
1552 {
1553 teamToLeave=0;
1554 isSwitch=false;
1555 }
1556 }
1557 else
1558 {
1559 teamsWeAreLeaving=teamMember->teams;
1560 }
1561 }
1562 else
1563 teamToLeave=0;
1564
1565 int teamJoined = JoinSpecificTeam(teamMember, team, isSwitch, teamToLeave, teamsWeAreLeaving);
1566
1567 if (teamJoined==1)
1568 {
1569 BitStream bsOut;
1570 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
1571 bsOut.WriteCasted<MessageID>(ID_RUN_RemoveFromTeamsRequestedAndAddTeam);
1572 bsOut.Write(GetWorldId());
1573 bsOut.Write(teamMember->GetNetworkID());
1574 bsOut.Write(team->GetNetworkID());
1575 bsOut.Write(isSwitch);
1576 if (teamToLeave!=0)
1577 {
1578 bsOut.Write(true);
1579 bsOut.Write(teamToLeave->GetNetworkID());
1580 }
1581 else
1582 bsOut.Write(false);
1583 BroadcastToParticipants(&bsOut, UNASSIGNED_RAKNET_GUID);
1584 }
1585 }
1586 }
1587 }
1588 }
1589
1590 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1591
1592 unsigned int TM_World::GetAvailableTeamIndexWithFewestMembers(TeamMemberLimit secondaryLimit, JoinPermissions joinPermissions)
1593 {
1594 unsigned int teamIndex;
1595
1596 unsigned int lowestTeamMembers = (unsigned int) -1;
1597 unsigned int lowestIndex = (unsigned int) -1;
1598
1599 for (teamIndex=0; teamIndex < teams.Size(); teamIndex++)
1600 {
1601 if (teams[teamIndex]->GetTeamMembersCount() < secondaryLimit &&
1602 teams[teamIndex]->GetTeamMembersCount() < teams[teamIndex]->GetMemberLimitSetting() &&
1603 teams[teamIndex]->GetTeamMembersCount() < lowestTeamMembers &&
1604 (joinPermissions & teams[teamIndex]->GetJoinPermissions())!=0)
1605 {
1606 lowestTeamMembers = teams[teamIndex]->GetTeamMembersCount();
1607 lowestIndex = teamIndex;
1608 }
1609 }
1610
1611 return lowestIndex;
1612 }
1613
1614 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1615
1616 void TM_World::GetSortedJoinRequests(DataStructures::OrderedList<TM_World::JoinRequestHelper, TM_World::JoinRequestHelper, JoinRequestHelperComp> &joinRequests)
1617 {
1618 unsigned int i;
1619
1620 for (i=0; i < teamMembers.Size(); i++)
1621 {
1622 TM_TeamMember *teamMember = teamMembers[i];
1623 if (teamMember->teamsRequested.Size()==0)
1624 {
1625 if (teamMember->joinTeamType==JOIN_ANY_AVAILABLE_TEAM)
1626 {
1627 TM_World::JoinRequestHelper jrh;
1628 jrh.whenRequestMade=teamMember->whenJoinAnyRequested;
1629 jrh.teamMemberIndex=i;
1630 jrh.requestIndex=teamMember->joinAnyRequestIndex;
1631 joinRequests.Insert(jrh, jrh, true, _FILE_AND_LINE_);
1632 }
1633 }
1634 else
1635 {
1636 unsigned int j;
1637 for (j=0; j < teamMember->teamsRequested.Size(); j++)
1638 {
1639 TM_World::JoinRequestHelper jrh;
1640 jrh.whenRequestMade=teamMember->teamsRequested[j].whenRequested;
1641 jrh.teamMemberIndex=i;
1642 jrh.indexIntoTeamsRequested=j;
1643 jrh.requestIndex=teamMember->teamsRequested[j].requestIndex;
1644 joinRequests.Insert(jrh, jrh, true, _FILE_AND_LINE_);
1645 }
1646
1647 }
1648 }
1649 }
1650 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1651
1652 void TM_World::BroadcastToParticipants(SLNet::BitStream *bsOut, RakNetGUID exclusionGuid)
1653 {
1654 for (unsigned int i=0; i < participants.Size(); i++)
1655 {
1656 if (participants[i]==exclusionGuid)
1657 continue;
1658 teamManager->SendUnified(bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, participants[i], false);
1659 }
1660 }
1661
1662 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1663
1664 void TM_World::BroadcastToParticipants(unsigned char *data, const int length, RakNetGUID exclusionGuid)
1665 {
1666 for (unsigned int i=0; i < participants.Size(); i++)
1667 {
1668 if (participants[i]==exclusionGuid)
1669 continue;
1670 teamManager->SendUnified((const char*) data, length, HIGH_PRIORITY, RELIABLE_ORDERED, 0, participants[i], false);
1671 }
1672 }
1673
1674 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1675
1676 TM_Team* TM_World::JoinAnyTeam(TM_TeamMember *teamMember, int *resultCode)
1677 {
1678 TeamMemberLimit balancedLimit = GetBalancedTeamLimit();
1679
1680 unsigned int idx = GetAvailableTeamIndexWithFewestMembers(balancedLimit, ALLOW_JOIN_ANY_AVAILABLE_TEAM);
1681 if (idx == (unsigned int ) -1)
1682 {
1683 // If any team is joinable but full, return full. Otherwise return locked
1684 for (idx=0; idx < teams.Size(); idx++)
1685 {
1686 if ((teams[idx]->GetTeamMembersCount() >= balancedLimit ||
1687 teams[idx]->GetTeamMembersCount() >= teams[idx]->GetMemberLimitSetting()) &&
1688 teams[idx]->GetMemberLimitSetting() != 0 &&
1689 (ALLOW_JOIN_ANY_AVAILABLE_TEAM & teams[idx]->GetJoinPermissions())!=0)
1690 {
1691 // Full
1692 *resultCode=-2;
1693 return teams[idx];
1694 }
1695 }
1696
1697 // Locked
1698 *resultCode=-1;
1699 return 0;
1700 }
1701
1702 TM_Team* lowestMemberTeam = teams[idx];
1703
1704 teamMember->StoreLastTeams();
1705 teamMember->UpdateTeamsRequestedToNone();
1706 teamMember->AddToTeamList(lowestMemberTeam);
1707 teamManager->PushTeamAssigned(teamMember);
1708
1709 *resultCode=1;
1710 return lowestMemberTeam;
1711 }
1712
1713 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1714
1715 int TM_World::JoinSpecificTeam(TM_TeamMember *teamMember, TM_Team *team, bool isTeamSwitch, TM_Team *teamToLeave, DataStructures::List<TM_Team*> &teamsWeAreLeaving)
1716 {
1717 if (team->GetJoinPermissions() & ALLOW_JOIN_SPECIFIC_TEAM)
1718 {
1719 if (balanceTeamsIsActive==false || teamsWeAreLeaving.Size()==0)
1720 {
1721 if (team->GetMemberLimit() > team->GetTeamMembersCount())
1722 {
1723 // Can join normally
1724 teamMember->StoreLastTeams();
1725 teamManager->RemoveFromTeamsRequestedAndAddTeam(teamMember, team, isTeamSwitch, teamToLeave);
1726 return 1;
1727 }
1728 else
1729 {
1730 // Full
1731 return -2;
1732 }
1733 }
1734 else
1735 {
1736 // Note: balanceTeamsIsActive==true && isTeamSwitch==true
1737
1738 // Do limited team swap
1739 // We must be on one team, target must be on one team, and we want to exchange teams
1740 if (teamsWeAreLeaving.Size()==1)
1741 {
1742 unsigned int j = team->GetMemberWithRequestedSingleTeamSwitch(teamsWeAreLeaving[0]);
1743 if (j!=(unsigned int)-1)
1744 {
1745 TM_TeamMember *swappingMember = team->teamMembers[j];
1746 teamMember->StoreLastTeams();
1747 swappingMember->StoreLastTeams();
1748 teamManager->RemoveFromTeamsRequestedAndAddTeam(teamMember, team, true, 0);
1749 teamManager->RemoveFromTeamsRequestedAndAddTeam(swappingMember, teamsWeAreLeaving[0], true, 0);
1750
1751 // Send ID_TEAM_BALANCER_TEAM_ASSIGNED to all, for swapped member
1752 // Calling function sends ID_RUN_RemoveFromTeamsRequestedAndAddTeam which pushes ID_TEAM_BALANCER_TEAM_ASSIGNED for teamMember
1753 SLNet::BitStream bitStream;
1754 bitStream.WriteCasted<MessageID>(ID_TEAM_BALANCER_TEAM_ASSIGNED);
1755 teamManager->EncodeTeamAssigned(&bitStream, swappingMember);
1756 BroadcastToParticipants(&bitStream, UNASSIGNED_RAKNET_GUID);
1757
1758 return 1;
1759 }
1760 }
1761
1762 // Full
1763 return -2;
1764 }
1765 }
1766 else
1767 {
1768 // Locked
1769 return -1;
1770 }
1771 }
1772
1773 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1774
1775 TeamMemberLimit TM_World::GetBalancedTeamLimit(void) const
1776 {
1777 if (teams.Size()==0)
1778 return 0;
1779
1780 if (balanceTeamsIsActive==false)
1781 return (TeamMemberLimit) -1;
1782
1783 unsigned int i;
1784 bool additionalTeamsExcluded;
1785 TeamMemberLimit balancedLimit;
1786 unsigned int teamsCount=teams.Size();
1787 unsigned int membersCount=teamMembers.Size();
1788 DataStructures::List<TM_Team*> consideredTeams = teams;
1789
1790 do
1791 {
1792 additionalTeamsExcluded=false;
1793 balancedLimit = (TeamMemberLimit) ((membersCount+(teamsCount-1))/(teamsCount));
1794 i=0;
1795 while (i < consideredTeams.Size())
1796 {
1797 if (consideredTeams[i]->GetMemberLimitSetting() < balancedLimit)
1798 {
1799 additionalTeamsExcluded=true;
1800 membersCount-=consideredTeams[i]->GetMemberLimitSetting();
1801 teamsCount--;
1802 consideredTeams.RemoveAtIndexFast(i);
1803 }
1804 else
1805 {
1806 i++;
1807 }
1808 }
1809
1810 } while (additionalTeamsExcluded==true && teamsCount>0);
1811
1812 return balancedLimit;
1813 }
1814
1815 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1816
1817
1818 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1819
1820 TeamManager::TeamManager()
1821 {
1822 for (unsigned int i=0; i < 255; i++)
1823 worldsArray[i]=0;
1824 autoAddParticipants=true;
1825 topology=TM_PEER_TO_PEER;
1826 }
1827
1828 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1829
1830 TeamManager::~TeamManager()
1831 {
1832 Clear();
1833 }
1834
1835 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1836
1837 TM_World* TeamManager::AddWorld(WorldId worldId)
1838 {
1839 RakAssert(worldsArray[worldId]==0 && "World already in use");
1840
1841 TM_World *newWorld = SLNet::OP_NEW<TM_World>(_FILE_AND_LINE_);
1842 newWorld->worldId=worldId;
1843 newWorld->teamManager=this;
1844 newWorld->hostGuid=GetMyGUIDUnified();
1845 worldsArray[worldId]=newWorld;
1846 worldsList.Push(newWorld,_FILE_AND_LINE_);
1847 return newWorld;
1848 }
1849
1850 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1851
1852 void TeamManager::RemoveWorld(WorldId worldId)
1853 {
1854 RakAssert(worldsArray[worldId]!=0 && "World not in use");
1855 for (unsigned int i=0; i < worldsList.Size(); i++)
1856 {
1857 if (worldsList[i]==worldsArray[worldId])
1858 {
1859 SLNet::OP_DELETE(worldsList[i],_FILE_AND_LINE_);
1860 worldsList.RemoveAtIndexFast(i);
1861 break;
1862 }
1863 }
1864 worldsArray[worldId]=0;
1865 }
1866
1867 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1868
1869 unsigned int TeamManager::GetWorldCount(void) const
1870 {
1871 return worldsList.Size();
1872 }
1873
1874 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1875
1876 TM_World* TeamManager::GetWorldAtIndex(unsigned int index) const
1877 {
1878 return worldsList[index];
1879 }
1880
1881 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1882
1883 TM_World* TeamManager::GetWorldWithId(WorldId worldId) const
1884 {
1885 return worldsArray[worldId];
1886 }
1887
1888 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1889
1890 void TeamManager::SetAutoManageConnections(bool autoAdd)
1891 {
1892 autoAddParticipants=autoAdd;
1893
1894 for (unsigned int i=0; i < worldsList.Size(); i++)
1895 {
1896 worldsList[i]->SetAutoManageConnections(autoAdd);
1897 }
1898 }
1899
1900 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1901
1902 void TeamManager::SetTopology(TMTopology _topology)
1903 {
1904 topology=_topology;
1905 }
1906
1907 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1908
1909 void TeamManager::EncodeTeamFull(SLNet::BitStream *bitStream, TM_TeamMember *teamMember, TM_Team *team)
1910 {
1911 bitStream->WriteCasted<MessageID>(ID_TEAM_BALANCER_REQUESTED_TEAM_FULL);
1912 EncodeTeamFullOrLocked(bitStream, teamMember, team);
1913 }
1914
1915 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1916
1917 void TeamManager::DecomposeTeamFull(Packet *packet,
1918 TM_World **world, TM_TeamMember **teamMember, TM_Team **team,
1919 uint16_t &currentMembers, uint16_t &memberLimitIncludingBalancing, bool &balancingIsActive, JoinPermissions &joinPermissions)
1920 {
1921 BitStream bsIn(packet->data,packet->length,false);
1922 bsIn.IgnoreBytes(sizeof(MessageID));
1923 DecomposeTeamFullOrLocked(&bsIn, world, teamMember, team, currentMembers, memberLimitIncludingBalancing, balancingIsActive, joinPermissions);
1924 }
1925
1926 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1927
1928 void TeamManager::EncodeTeamLocked(SLNet::BitStream *bitStream, TM_TeamMember *teamMember, TM_Team *team)
1929 {
1930 bitStream->WriteCasted<MessageID>(ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED);
1931 EncodeTeamFullOrLocked(bitStream, teamMember, team);
1932 }
1933
1934 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1935
1936 void TeamManager::EncodeTeamFullOrLocked(SLNet::BitStream *bitStream, TM_TeamMember *teamMember, TM_Team *team)
1937 {
1938 bitStream->Write(teamMember->world->GetWorldId());
1939 bitStream->Write(teamMember->GetNetworkID());
1940 bitStream->Write(team->GetNetworkID());
1941 bitStream->WriteCasted<uint16_t>(team->GetTeamMembersCount());
1942 bitStream->Write(team->GetMemberLimit());
1943 bitStream->Write(team->GetBalancingApplies());
1944 bitStream->Write(team->GetJoinPermissions());
1945 }
1946
1947 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1948
1949 void TeamManager::DecomposeTeamFullOrLocked(SLNet::BitStream *bsIn, TM_World **world, TM_TeamMember **teamMember, TM_Team **team,
1950 uint16_t &currentMembers, uint16_t &memberLimitIncludingBalancing, bool &balancingIsActive, JoinPermissions &joinPermissions)
1951 {
1952 WorldId worldId;
1953 NetworkID teamMemberId;
1954 NetworkID teamId;
1955
1956 *teamMember=0;
1957 *team=0;
1958 *world=0;
1959
1960 bsIn->Read(worldId);
1961 bsIn->Read(teamMemberId);
1962 bsIn->Read(teamId);
1963 bsIn->Read(currentMembers);
1964 bsIn->Read(memberLimitIncludingBalancing);
1965 bsIn->Read(balancingIsActive);
1966 bsIn->Read(joinPermissions);
1967
1968 *world = GetWorldWithId(worldId);
1969 if (*world)
1970 {
1971 *teamMember = (*world)->GetTeamMemberByNetworkID(teamMemberId);
1972 *team = (*world)->GetTeamByNetworkID(teamId);
1973 }
1974 }
1975
1976 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1977
1978 void TeamManager::DecomposeTeamLocked(Packet *packet,
1979 TM_World **world, TM_TeamMember **teamMember, TM_Team **team,
1980 uint16_t &currentMembers, uint16_t &memberLimitIncludingBalancing, bool &balancingIsActive, JoinPermissions &joinPermissions)
1981 {
1982 BitStream bsIn(packet->data,packet->length,false);
1983 bsIn.IgnoreBytes(sizeof(MessageID));
1984 DecomposeTeamFullOrLocked(&bsIn, world, teamMember, team, currentMembers, memberLimitIncludingBalancing, balancingIsActive, joinPermissions);
1985 }
1986
1987 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1988
1989 void TeamManager::EncodeTeamAssigned(SLNet::BitStream *bitStream, TM_TeamMember *teamMember)
1990 {
1991 bitStream->Write(teamMember->world->GetWorldId());
1992 bitStream->Write(teamMember->GetNetworkID());
1993 bitStream->WriteCasted<uint16_t>(teamMember->teams.Size());
1994 for (unsigned int i=0; i < teamMember->teams.Size(); i++)
1995 {
1996 bitStream->Write(teamMember->teams[i]->GetNetworkID());
1997 }
1998 bitStream->Write(teamMember->noTeamSubcategory);
1999 bitStream->Write(teamMember->joinTeamType);
2000 }
2001
2002 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2003
2004 void TeamManager::ProcessTeamAssigned(SLNet::BitStream *bsIn)
2005 {
2006 TM_World *world;
2007 TM_TeamMember *teamMember;
2008 NoTeamId noTeamId;
2009 JoinTeamType joinTeamType;
2010 DataStructures::List<TM_Team *> newTeam;
2011 DataStructures::List<TM_Team *> teamsLeft;
2012 DataStructures::List<TM_Team *> teamsJoined;
2013 DecodeTeamAssigned(bsIn, &world, &teamMember, noTeamId, joinTeamType, newTeam, teamsLeft, teamsJoined);
2014 if (teamMember)
2015 {
2016 teamMember->StoreLastTeams();
2017 for (unsigned int i=0; i < teamsLeft.Size(); i++)
2018 {
2019 teamMember->RemoveFromSpecificTeamInternal(teamsLeft[i]);
2020 }
2021 for (unsigned int i=0; i < teamsJoined.Size(); i++)
2022 {
2023 if (teamMember->IsOnTeam(teamsJoined[i])==false)
2024 {
2025 teamMember->RemoveFromRequestedTeams(teamsJoined[i]);
2026 teamMember->AddToTeamList(teamsJoined[i]);
2027 }
2028 }
2029 teamMember->noTeamSubcategory=noTeamId;
2030 teamMember->joinTeamType=joinTeamType;
2031 }
2032 }
2033
2034 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2035
2036 void TeamManager::DecodeTeamAssigned(Packet *packet, TM_World **world, TM_TeamMember **teamMember)
2037 {
2038 WorldId worldId;
2039 NetworkID teamMemberId;
2040
2041 SLNet::BitStream bsIn(packet->data, packet->length, false);
2042 bsIn.IgnoreBytes(sizeof(MessageID));
2043 bsIn.Read(worldId);
2044 bsIn.Read(teamMemberId);
2045 *world = GetWorldWithId(worldId);
2046 if (*world)
2047 {
2048 *teamMember = (*world)->GetTeamMemberByNetworkID(teamMemberId);
2049 }
2050 else
2051 {
2052 *teamMember=0;
2053 }
2054 }
2055
2056 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2057
2058 void TeamManager::DecodeTeamCancelled(Packet *packet, TM_World **world, TM_TeamMember **teamMember, TM_Team **teamCancelled)
2059 {
2060 WorldId worldId;
2061 NetworkID teamMemberId;
2062
2063 SLNet::BitStream bsIn(packet->data, packet->length, false);
2064 bsIn.IgnoreBytes(sizeof(MessageID));
2065 bsIn.Read(worldId);
2066 bsIn.Read(teamMemberId);
2067 bool sp=false;
2068 *world = GetWorldWithId(worldId);
2069 if (*world)
2070 {
2071 *teamMember = (*world)->GetTeamMemberByNetworkID(teamMemberId);
2072 }
2073 else
2074 {
2075 *teamMember=0;
2076 }
2077
2078 bsIn.Read(sp);
2079 if (sp)
2080 {
2081 NetworkID nid;
2082 bsIn.Read(nid);
2083 *teamCancelled = (*world)->GetTeamByNetworkID(nid);
2084 }
2085 else
2086 {
2087 *teamCancelled = 0;
2088 }
2089 }
2090
2091 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2092
2093 void TeamManager::DecodeTeamAssigned(BitStream *bsIn, TM_World **world, TM_TeamMember **teamMember, NoTeamId &noTeamId,
2094 JoinTeamType &joinTeamType, DataStructures::List<TM_Team *> &newTeam,
2095 DataStructures::List<TM_Team *> &teamsLeft, DataStructures::List<TM_Team *> &teamsJoined
2096 )
2097 {
2098 newTeam.Clear(true, _FILE_AND_LINE_);
2099 teamsLeft.Clear(true, _FILE_AND_LINE_);
2100 teamsJoined.Clear(true, _FILE_AND_LINE_);
2101
2102 WorldId worldId;
2103 NetworkID teamMemberId;
2104 NetworkID teamId;
2105
2106 bsIn->Read(worldId);
2107 bsIn->Read(teamMemberId);
2108 *world = GetWorldWithId(worldId);
2109 if (*world)
2110 {
2111 *teamMember = (*world)->GetTeamMemberByNetworkID(teamMemberId);
2112 uint16_t teamsCount;
2113 bsIn->Read(teamsCount);
2114
2115 for (unsigned int i=0; i < teamsCount; i++)
2116 {
2117 bsIn->Read(teamId);
2118 TM_Team * team = (*world)->GetTeamByNetworkID(teamId);
2119 RakAssert(team);
2120 if (team)
2121 newTeam.Push(team, _FILE_AND_LINE_);
2122 // else probably didn't reference team first
2123 }
2124
2125 if (*teamMember)
2126 {
2127 for (unsigned int i=0; i < (*teamMember)->teams.Size(); i++)
2128 {
2129 TM_Team *team = (*teamMember)->teams[i];
2130 if (newTeam.GetIndexOf(team)==(unsigned int)-1)
2131 teamsLeft.Push(team, _FILE_AND_LINE_);
2132 }
2133 }
2134
2135 for (unsigned int i=0; i < newTeam.Size(); i++)
2136 {
2137 TM_Team *team = newTeam[i];
2138 if ((*teamMember)->teams.GetIndexOf(team)==(unsigned int)-1)
2139 teamsJoined.Push(team, _FILE_AND_LINE_);
2140 }
2141
2142 bsIn->Read(noTeamId);
2143 bsIn->Read(joinTeamType);
2144 }
2145 else
2146 {
2147 *teamMember=0;
2148 }
2149 }
2150
2151 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2152
2153 void TeamManager::Clear(void)
2154 {
2155 for (unsigned int i=0; i < worldsList.Size(); i++)
2156 {
2157 worldsArray[worldsList[i]->worldId]=0;
2158 worldsList[i]->Clear();
2159 SLNet::OP_DELETE(worldsList[i], _FILE_AND_LINE_);
2160 }
2161 worldsList.Clear(false, _FILE_AND_LINE_);
2162 }
2163
2164 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2165
2166 void TeamManager::Update(void)
2167 {
2168 }
2169
2170 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2171
2172 PluginReceiveResult TeamManager::OnReceive(Packet *packet)
2173 {
2174 switch (packet->data[0])
2175 {
2176 case ID_FCM2_NEW_HOST:
2177 {
2178 unsigned int i;
2179 for (i=0; i < worldsList.Size(); i++)
2180 worldsList[i]->SetHost(packet->guid);
2181 }
2182 break;
2183 case ID_TEAM_BALANCER_TEAM_ASSIGNED:
2184 {
2185 BitStream bsIn(packet->data,packet->length,false);
2186 bsIn.IgnoreBytes(sizeof(MessageID));
2187
2188 ProcessTeamAssigned(&bsIn);
2189 }
2190 break;
2191 case ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED:
2192 {
2193 BitStream bsIn(packet->data,packet->length,false);
2194 bsIn.IgnoreBytes(1);
2195 WorldId worldId;
2196 bsIn.Read(worldId);
2197 TM_World *world = GetWorldWithId(worldId);
2198 if (world==0)
2199 return RR_STOP_PROCESSING_AND_DEALLOCATE;
2200 bool validPacket = OnRemoveFromRequestedTeams(packet, world);
2201 if (validPacket==false)
2202 return RR_STOP_PROCESSING_AND_DEALLOCATE;
2203 break;
2204 }
2205 case ID_TEAM_BALANCER_INTERNAL:
2206 {
2207 if (packet->length>=2)
2208 {
2209 BitStream bsIn(packet->data,packet->length,false);
2210 bsIn.IgnoreBytes(2);
2211 WorldId worldId;
2212 bsIn.Read(worldId);
2213 TM_World *world = GetWorldWithId(worldId);
2214 if (world==0)
2215 return RR_STOP_PROCESSING_AND_DEALLOCATE;
2216
2217 switch (packet->data[1])
2218 {
2219 case ID_RUN_UpdateListsToNoTeam:
2220 OnUpdateListsToNoTeam(packet, world);
2221 break;
2222 case ID_RUN_UpdateTeamsRequestedToAny:
2223 OnUpdateTeamsRequestedToAny(packet, world);
2224 break;
2225 case ID_RUN_JoinAnyTeam:
2226 OnJoinAnyTeam(packet, world);
2227 break;
2228 case ID_RUN_JoinRequestedTeam:
2229 OnJoinRequestedTeam(packet, world);
2230 break;
2231 case ID_RUN_UpdateTeamsRequestedToNoneAndAddTeam:
2232 OnUpdateTeamsRequestedToNoneAndAddTeam(packet, world);
2233 break;
2234 case ID_RUN_RemoveFromTeamsRequestedAndAddTeam:
2235 OnRemoveFromTeamsRequestedAndAddTeam(packet, world);
2236 break;
2237 case ID_RUN_AddToRequestedTeams:
2238 OnAddToRequestedTeams(packet, world);
2239 break;
2240 case ID_RUN_LeaveTeam:
2241 OnLeaveTeam(packet, world);
2242 break;
2243 case ID_RUN_SetMemberLimit:
2244 OnSetMemberLimit(packet, world);
2245 break;
2246 case ID_RUN_SetJoinPermissions:
2247 OnSetJoinPermissions(packet, world);
2248 break;
2249 case ID_RUN_SetBalanceTeams:
2250 OnSetBalanceTeams(packet, world);
2251 break;
2252 case ID_RUN_SetBalanceTeamsInitial:
2253 OnSetBalanceTeamsInitial(packet, world);
2254 break;
2255 }
2256 }
2257 }
2258 return RR_STOP_PROCESSING_AND_DEALLOCATE;
2259 }
2260
2261 return RR_CONTINUE_PROCESSING;
2262 }
2263
2264 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2265
2266 void TeamManager::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
2267 {
2268 for (unsigned int i=0; i < worldsList.Size(); i++)
2269 {
2270 worldsList[i]->OnClosedConnection(systemAddress, rakNetGUID, lostConnectionReason);
2271 }
2272 }
2273
2274 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2275
2276 void TeamManager::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
2277 {
2278 for (unsigned int i=0; i < worldsList.Size(); i++)
2279 {
2280 worldsList[i]->OnNewConnection(systemAddress, rakNetGUID, isIncoming);
2281 }
2282 }
2283
2284 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2285
2286 void TeamManager::Send( const SLNet::BitStream * bitStream, const AddressOrGUID systemIdentifier, bool broadcast )
2287 {
2288 SendUnified(bitStream,HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemIdentifier, broadcast);
2289 }
2290
2291 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2292
2293 void TeamManager::RemoveFromTeamsRequestedAndAddTeam(TM_TeamMember *teamMember, TM_Team *team, bool isTeamSwitch, TM_Team *teamToLeave)
2294 {
2295 teamMember->RemoveFromRequestedTeams(team);
2296 if (isTeamSwitch)
2297 {
2298 if (teamToLeave==0)
2299 {
2300 // Leave all teams
2301 teamMember->RemoveFromAllTeamsInternal();
2302 }
2303 else
2304 {
2305 // Leave specific team if it exists
2306 teamMember->RemoveFromSpecificTeamInternal(teamToLeave);
2307 }
2308 }
2309 teamMember->AddToTeamList(team);
2310 PushTeamAssigned(teamMember);
2311 }
2312
2313 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2314
2315 void TeamManager::PushTeamAssigned(TM_TeamMember *teamMember)
2316 {
2317 // Push ID_TEAM_BALANCER_TEAM_ASSIGNED locally
2318 SLNet::BitStream bitStream;
2319 bitStream.WriteCasted<MessageID>(ID_TEAM_BALANCER_TEAM_ASSIGNED);
2320 EncodeTeamAssigned(&bitStream, teamMember);
2321
2322 PushBitStream(&bitStream);
2323 }
2324
2325 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2326
2327 void TeamManager::PushBitStream(SLNet::BitStream *bitStream)
2328 {
2329 Packet *p = AllocatePacketUnified(bitStream->GetNumberOfBytesUsed());
2330 memcpy(p->data, bitStream->GetData(), bitStream->GetNumberOfBytesUsed());
2331 p->systemAddress=UNASSIGNED_SYSTEM_ADDRESS;
2332 p->systemAddress.systemIndex=(SystemIndex)-1;
2333 p->guid=UNASSIGNED_RAKNET_GUID;
2334 p->wasGeneratedLocally=true;
2335 PushBackPacketUnified(p, true);
2336 }
2337
2338 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2339
2340 void TeamManager::OnUpdateListsToNoTeam(Packet *packet, TM_World *world)
2341 {
2342 BitStream bsIn(packet->data,packet->length,false);
2343 bsIn.IgnoreBytes(2+sizeof(WorldId));
2344 NetworkID networkId;
2345 bsIn.Read(networkId);
2346 TM_TeamMember *teamMember = world->GetTeamMemberByNetworkID(networkId);
2347 NoTeamId noTeamId;
2348 bsIn.Read(noTeamId);
2349 if (teamMember)
2350 {
2351 teamMember->StoreLastTeams();
2352 teamMember->UpdateListsToNoTeam(noTeamId);
2353 PushTeamAssigned(teamMember);
2354
2355 if (world->GetHost()==world->GetTeamManager()->GetMyGUIDUnified())
2356 {
2357 world->FillRequestedSlots();
2358 world->EnforceTeamBalance(noTeamId);
2359
2360 if (topology==TM_CLIENT_SERVER)
2361 {
2362 // Relay
2363 world->BroadcastToParticipants(packet->data, packet->length, packet->guid);
2364 }
2365 }
2366 }
2367 }
2368
2369 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2370
2371 void TeamManager::OnUpdateTeamsRequestedToAny(Packet *packet, TM_World *world)
2372 {
2373 BitStream bsIn(packet->data,packet->length,false);
2374 bsIn.IgnoreBytes(2+sizeof(WorldId));
2375 NetworkID networkId;
2376 bsIn.Read(networkId);
2377 TM_TeamMember *teamMember = world->GetTeamMemberByNetworkID(networkId);
2378 if (teamMember)
2379 {
2380 teamMember->UpdateTeamsRequestedToAny();
2381 }
2382 }
2383
2384 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2385
2386 void TeamManager::OnJoinAnyTeam(Packet *packet, TM_World *world)
2387 {
2388 BitStream bsIn(packet->data,packet->length,false);
2389 bsIn.IgnoreBytes(2+sizeof(WorldId));
2390 NetworkID networkId;
2391 bsIn.Read(networkId);
2392 TM_TeamMember *teamMember = world->GetTeamMemberByNetworkID(networkId);
2393 if (teamMember)
2394 {
2395 // This is a host-only operation
2396 RakAssert(world->GetHost()==world->GetTeamManager()->GetMyGUIDUnified());
2397
2398 teamMember->UpdateTeamsRequestedToAny();
2399
2400 int resultCode;
2401 TM_Team *newTeam = world->JoinAnyTeam(teamMember, &resultCode);
2402
2403 if (resultCode==1)
2404 {
2405 // Broadcast packet - remote systems should clear requested teams to none, and add the team we joined.
2406 // Broadcast includes non-host sender (all participants)
2407 BitStream bsOut;
2408 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
2409 bsOut.WriteCasted<MessageID>(ID_RUN_UpdateTeamsRequestedToNoneAndAddTeam);
2410 bsOut.Write(world->GetWorldId());
2411 bsOut.Write(networkId);
2412 bsOut.Write(newTeam->GetNetworkID());
2413 world->BroadcastToParticipants(&bsOut, packet->guid);
2414
2415 // Send to sender ID_TEAM_BALANCER_TEAM_ASSIGNED
2416 if (packet->guid!=GetMyGUIDUnified())
2417 {
2418 SLNet::BitStream bitStream;
2419 bitStream.WriteCasted<MessageID>(ID_TEAM_BALANCER_TEAM_ASSIGNED);
2420 EncodeTeamAssigned(&bitStream, teamMember);
2421 SendUnified(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
2422 }
2423 }
2424 else
2425 {
2426 // Relay packet to set requested teams to any
2427 BitStream bsOut;
2428 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
2429 bsOut.WriteCasted<MessageID>(ID_RUN_UpdateTeamsRequestedToAny);
2430 bsOut.Write(world->GetWorldId());
2431 bsOut.Write(networkId);
2432 world->BroadcastToParticipants(&bsOut, packet->guid);
2433
2434 bsOut.Reset();
2435 if (resultCode==-2)
2436 {
2437 EncodeTeamFull(&bsOut, teamMember, newTeam);
2438 }
2439 else if (resultCode==-1)
2440 {
2441 EncodeTeamLocked(&bsOut, teamMember, newTeam);
2442 }
2443 // SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
2444 world->BroadcastToParticipants(&bsOut, UNASSIGNED_RAKNET_GUID);
2445 if (packet->guid!=GetMyGUIDUnified())
2446 PushBitStream(&bsOut);
2447 }
2448 }
2449 }
2450
2451 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2452
2453 void TeamManager::OnJoinRequestedTeam(Packet *packet, TM_World *world)
2454 {
2455 BitStream bsIn(packet->data,packet->length,false);
2456 bsIn.IgnoreBytes(2+sizeof(WorldId));
2457 NetworkID networkId;
2458 bsIn.Read(networkId);
2459 TM_TeamMember *teamMember = world->GetTeamMemberByNetworkID(networkId);
2460 NetworkID teamToJoinNetworkId;
2461 bsIn.Read(teamToJoinNetworkId);
2462 TM_Team *teamToJoin = world->GetTeamByNetworkID(teamToJoinNetworkId);
2463 bool isTeamSwitch=false;
2464 bool switchSpecificTeam=false;
2465 NetworkID teamToLeaveNetworkId=UNASSIGNED_NETWORK_ID;
2466 TM_Team *teamToLeave=0;
2467 bsIn.Read(isTeamSwitch);
2468 if (isTeamSwitch)
2469 {
2470 bsIn.Read(switchSpecificTeam);
2471 if (switchSpecificTeam)
2472 {
2473 bsIn.Read(teamToLeaveNetworkId);
2474 teamToLeave = world->GetTeamByNetworkID(teamToLeaveNetworkId);
2475 if (teamToLeave==0)
2476 isTeamSwitch=false;
2477 }
2478 }
2479 if (teamToJoin && teamMember)
2480 {
2481 if (isTeamSwitch)
2482 {
2483 if (teamMember->SwitchSpecificTeamCheck(teamToJoin, teamToLeave, packet->guid==GetMyGUIDUnified())==false)
2484 return;
2485
2486 teamMember->AddToRequestedTeams(teamToJoin, teamToLeave);
2487 }
2488 else
2489 {
2490 if (teamMember->JoinSpecificTeamCheck(teamToJoin, packet->guid==GetMyGUIDUnified())==false)
2491 return;
2492
2493 teamMember->AddToRequestedTeams(teamToJoin);
2494 }
2495
2496 DataStructures::List<TM_Team*> teamsWeAreLeaving;
2497 if (isTeamSwitch)
2498 {
2499 if (teamToLeave==0)
2500 {
2501 teamsWeAreLeaving=teamMember->teams;
2502 }
2503 else
2504 {
2505 if (teamMember->IsOnTeam(teamToLeave))
2506 teamsWeAreLeaving.Push(teamToLeave, _FILE_AND_LINE_);
2507 }
2508
2509 if (teamsWeAreLeaving.Size()==0)
2510 isTeamSwitch=false;
2511 }
2512
2513 int resultCode = world->JoinSpecificTeam(teamMember, teamToJoin, isTeamSwitch, teamToLeave, teamsWeAreLeaving);
2514
2515 if (resultCode==1)
2516 {
2517 // Broadcast packet - remote systems should remove from requested teams and add the team we joined.
2518 // Broadcast includes non-host sender (all participants)
2519 BitStream bsOut;
2520 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
2521 bsOut.WriteCasted<MessageID>(ID_RUN_RemoveFromTeamsRequestedAndAddTeam);
2522 bsOut.Write(world->GetWorldId());
2523 bsOut.Write(networkId);
2524 bsOut.Write(teamToJoin->GetNetworkID());
2525 bsOut.Write(isTeamSwitch);
2526 if (isTeamSwitch)
2527 {
2528 bsOut.Write(switchSpecificTeam);
2529 if (switchSpecificTeam)
2530 bsOut.Write(teamToLeaveNetworkId);
2531 }
2532 world->BroadcastToParticipants(&bsOut, packet->guid);
2533
2534 // Send to sender ID_TEAM_BALANCER_TEAM_ASSIGNED
2535 if (packet->guid!=GetMyGUIDUnified())
2536 {
2537 SLNet::BitStream bitStream;
2538 bitStream.WriteCasted<MessageID>(ID_TEAM_BALANCER_TEAM_ASSIGNED);
2539 EncodeTeamAssigned(&bitStream, teamMember);
2540 SendUnified(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
2541 }
2542 }
2543 else
2544 {
2545 // Relay packet to set requested teams to any
2546 BitStream bsOut;
2547 bsOut.WriteCasted<MessageID>(ID_TEAM_BALANCER_INTERNAL);
2548 bsOut.WriteCasted<MessageID>(ID_RUN_AddToRequestedTeams);
2549 bsOut.Write(world->GetWorldId());
2550 bsOut.Write(networkId);
2551 bsOut.Write(teamToJoin->GetNetworkID());
2552 bsOut.Write(isTeamSwitch);
2553 if (isTeamSwitch)
2554 {
2555 bsOut.Write(switchSpecificTeam);
2556 if (switchSpecificTeam)
2557 bsOut.Write(teamToLeaveNetworkId);
2558 }
2559 world->BroadcastToParticipants(&bsOut, packet->guid);
2560
2561 bsOut.Reset();
2562 if (resultCode==-2)
2563 {
2564 EncodeTeamFull(&bsOut, teamMember, teamToJoin);
2565 }
2566 else if (resultCode==-1)
2567 {
2568 EncodeTeamLocked(&bsOut, teamMember, teamToJoin);
2569 }
2570 // SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
2571
2572 world->BroadcastToParticipants(&bsOut, UNASSIGNED_RAKNET_GUID);
2573 if (packet->guid!=GetMyGUIDUnified())
2574 PushBitStream(&bsOut);
2575 }
2576 }
2577 }
2578
2579 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2580
2581 void TeamManager::OnUpdateTeamsRequestedToNoneAndAddTeam(Packet *packet, TM_World *world)
2582 {
2583 BitStream bsIn(packet->data,packet->length,false);
2584 bsIn.IgnoreBytes(2+sizeof(WorldId));
2585 NetworkID networkId;
2586 bsIn.Read(networkId);
2587 TM_TeamMember *teamMember = world->GetTeamMemberByNetworkID(networkId);
2588 NetworkID teamNetworkId;
2589 bsIn.Read(teamNetworkId);
2590 TM_Team *team = world->GetTeamByNetworkID(teamNetworkId);
2591
2592 if (team && teamMember)
2593 {
2594 teamMember->StoreLastTeams();
2595 teamMember->UpdateTeamsRequestedToNone();
2596 teamMember->AddToTeamList(team);
2597 world->GetTeamManager()->PushTeamAssigned(teamMember);
2598 }
2599 }
2600
2601 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2602
2603 void TeamManager::OnRemoveFromTeamsRequestedAndAddTeam(Packet *packet, TM_World *world)
2604 {
2605 BitStream bsIn(packet->data,packet->length,false);
2606 bsIn.IgnoreBytes(2+sizeof(WorldId));
2607 NetworkID networkId;
2608 bsIn.Read(networkId);
2609 TM_TeamMember *teamMember = world->GetTeamMemberByNetworkID(networkId);
2610 NetworkID teamNetworkId;
2611 bsIn.Read(teamNetworkId);
2612 bool isTeamSwitch=false, switchSpecificTeam=false;
2613 NetworkID teamToLeaveNetworkId;
2614 TM_Team *teamToLeave=0;
2615 bsIn.Read(isTeamSwitch);
2616 if (isTeamSwitch)
2617 {
2618 bsIn.Read(switchSpecificTeam);
2619 if (switchSpecificTeam)
2620 {
2621 bsIn.Read(teamToLeaveNetworkId);
2622 teamToLeave = world->GetTeamByNetworkID(teamToLeaveNetworkId);
2623 }
2624 }
2625
2626 TM_Team *team = world->GetTeamByNetworkID(teamNetworkId);
2627 if (team && teamMember)
2628 {
2629 teamMember->StoreLastTeams();
2630 if (teamToLeave)
2631 teamMember->RemoveFromSpecificTeamInternal(teamToLeave);
2632 else if (isTeamSwitch==true && switchSpecificTeam==false)
2633 teamMember->RemoveFromAllTeamsInternal();
2634 RemoveFromTeamsRequestedAndAddTeam(teamMember, team, false, 0);
2635 }
2636 }
2637
2638 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2639
2640 void TeamManager::OnAddToRequestedTeams(Packet *packet, TM_World *world)
2641 {
2642 BitStream bsIn(packet->data,packet->length,false);
2643 bsIn.IgnoreBytes(2+sizeof(WorldId));
2644 NetworkID networkId;
2645 bsIn.Read(networkId);
2646 TM_TeamMember *teamMember = world->GetTeamMemberByNetworkID(networkId);
2647 NetworkID teamNetworkId;
2648 bsIn.Read(teamNetworkId);
2649 TM_Team *team = world->GetTeamByNetworkID(teamNetworkId);
2650
2651 bool isTeamSwitch=false;
2652 bool switchSpecificTeam=false;
2653 NetworkID teamToLeaveNetworkId=UNASSIGNED_NETWORK_ID;
2654 TM_Team *teamToLeave=0;
2655 bsIn.Read(isTeamSwitch);
2656 if (isTeamSwitch)
2657 {
2658 bsIn.Read(switchSpecificTeam);
2659 if (switchSpecificTeam)
2660 {
2661 bsIn.Read(teamToLeaveNetworkId);
2662 teamToLeave = world->GetTeamByNetworkID(teamToLeaveNetworkId);
2663 if (teamToLeave==0)
2664 isTeamSwitch=false;
2665 }
2666 }
2667
2668 if (team && teamMember)
2669 {
2670 if (isTeamSwitch)
2671 teamMember->AddToRequestedTeams(team, teamToLeave);
2672 else
2673 teamMember->AddToRequestedTeams(team);
2674 }
2675 }
2676
2677 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2678
2679 bool TeamManager::OnRemoveFromRequestedTeams(Packet *packet, TM_World *world)
2680 {
2681 BitStream bsIn(packet->data,packet->length,false);
2682 bsIn.IgnoreBytes(1+sizeof(WorldId));
2683 NetworkID networkId;
2684 bsIn.Read(networkId);
2685 TM_TeamMember *teamMember = world->GetTeamMemberByNetworkID(networkId);
2686 bool hasSpecificTeam=false;
2687 NetworkID teamNetworkId;
2688 TM_Team *team;
2689 bsIn.Read(hasSpecificTeam);
2690 if (hasSpecificTeam)
2691 {
2692 bsIn.Read(teamNetworkId);
2693 team = world->GetTeamByNetworkID(teamNetworkId);
2694 if (team==0)
2695 return false;
2696 }
2697 else
2698 {
2699 team=0;
2700 }
2701
2702 if (teamMember)
2703 {
2704 teamMember->RemoveFromRequestedTeams(team);
2705
2706 // Relay as host
2707 if (world->GetHost()==world->GetTeamManager()->GetMyGUIDUnified() && topology==TM_CLIENT_SERVER)
2708 {
2709 world->BroadcastToParticipants(packet->data, packet->length, packet->guid);
2710 }
2711 return true;
2712 }
2713 else
2714 {
2715 return false;
2716 }
2717 }
2718
2719 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2720
2721 void TeamManager::OnLeaveTeam(Packet *packet, TM_World *world)
2722 {
2723 BitStream bsIn(packet->data,packet->length,false);
2724 bsIn.IgnoreBytes(2+sizeof(WorldId));
2725 NetworkID networkId;
2726 bsIn.Read(networkId);
2727 TM_TeamMember *teamMember = world->GetTeamMemberByNetworkID(networkId);
2728 NetworkID teamNetworkId;
2729 bsIn.Read(teamNetworkId);
2730 TM_Team *team = world->GetTeamByNetworkID(teamNetworkId);
2731 NoTeamId noTeamId;
2732 bsIn.Read(noTeamId);
2733
2734 if (team && teamMember)
2735 {
2736 if (teamMember->LeaveTeamCheck(team)==false)
2737 return;
2738
2739 teamMember->StoreLastTeams();
2740 teamMember->RemoveFromSpecificTeamInternal(team);
2741 if (teamMember->GetCurrentTeamCount()==0)
2742 {
2743 teamMember->noTeamSubcategory=noTeamId;
2744 teamMember->joinTeamType=JOIN_NO_TEAM;
2745 }
2746 PushTeamAssigned(teamMember);
2747
2748 if (world->GetHost()==world->GetTeamManager()->GetMyGUIDUnified())
2749 {
2750 // Rebalance teams
2751 world->FillRequestedSlots();
2752 world->EnforceTeamBalance(noTeamId);
2753
2754 // Relay as host
2755 if (topology==TM_CLIENT_SERVER)
2756 world->BroadcastToParticipants(packet->data, packet->length, packet->guid);
2757 }
2758 }
2759 }
2760
2761 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2762
2763 void TeamManager::OnSetMemberLimit(Packet *packet, TM_World *world)
2764 {
2765 BitStream bsIn(packet->data,packet->length,false);
2766 bsIn.IgnoreBytes(2+sizeof(WorldId));
2767 NetworkID teamNetworkId;
2768 bsIn.Read(teamNetworkId);
2769 TeamMemberLimit teamMemberLimit;
2770 NoTeamId noTeamId;
2771 bsIn.Read(teamMemberLimit);
2772 bsIn.Read(noTeamId);
2773
2774 TM_Team *team = world->GetTeamByNetworkID(teamNetworkId);
2775 if (team)
2776 {
2777 team->teamMemberLimit=teamMemberLimit;
2778
2779 if (world->GetHost()==world->GetTeamManager()->GetMyGUIDUnified())
2780 {
2781 if (packet->guid==GetMyGUIDUnified())
2782 world->BroadcastToParticipants(packet->data, packet->length, packet->guid);
2783 else
2784 world->BroadcastToParticipants(packet->data, packet->length, UNASSIGNED_RAKNET_GUID);
2785 world->FillRequestedSlots();
2786 world->KickExcessMembers(noTeamId);
2787 }
2788 }
2789 }
2790
2791 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2792
2793 void TeamManager::OnSetJoinPermissions(Packet *packet, TM_World *world)
2794 {
2795 BitStream bsIn(packet->data,packet->length,false);
2796 bsIn.IgnoreBytes(2+sizeof(WorldId));
2797 NetworkID teamNetworkId;
2798 bsIn.Read(teamNetworkId);
2799 JoinPermissions joinPermissions;
2800 bsIn.Read(joinPermissions);
2801
2802 TM_Team *team = world->GetTeamByNetworkID(teamNetworkId);
2803 if (team)
2804 {
2805 team->joinPermissions=joinPermissions;
2806
2807 if (world->GetHost()==world->GetTeamManager()->GetMyGUIDUnified())
2808 {
2809 if (packet->guid==GetMyGUIDUnified())
2810 world->BroadcastToParticipants(packet->data, packet->length, packet->guid);
2811 else
2812 world->BroadcastToParticipants(packet->data, packet->length, UNASSIGNED_RAKNET_GUID);
2813 world->FillRequestedSlots();
2814 }
2815 }
2816 }
2817
2818 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2819
2820 void TeamManager::OnSetBalanceTeams(Packet *packet, TM_World *world)
2821 {
2822 BitStream bsIn(packet->data,packet->length,false);
2823 bsIn.IgnoreBytes(2+sizeof(WorldId));
2824 bool balanceTeams=false;
2825 bsIn.Read(balanceTeams);
2826 NoTeamId noTeamId;
2827 bsIn.Read(noTeamId);
2828
2829 world->balanceTeamsIsActive=balanceTeams;
2830 if (world->GetHost()==world->GetTeamManager()->GetMyGUIDUnified())
2831 {
2832 if (packet->guid==GetMyGUIDUnified())
2833 world->BroadcastToParticipants(packet->data, packet->length, packet->guid);
2834 else
2835 world->BroadcastToParticipants(packet->data, packet->length, UNASSIGNED_RAKNET_GUID);
2836
2837 if (balanceTeams)
2838 world->EnforceTeamBalance(noTeamId);
2839 else
2840 world->FillRequestedSlots();
2841 }
2842 }
2843
2844 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2845
2846 void TeamManager::OnSetBalanceTeamsInitial(Packet *packet, TM_World *world)
2847 {
2848 BitStream bsIn(packet->data,packet->length,false);
2849 bsIn.IgnoreBytes(2+sizeof(WorldId));
2850 bool balanceTeams=false;
2851 bsIn.Read(balanceTeams);
2852 world->balanceTeamsIsActive=balanceTeams;
2853 }
2854
2855 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2856
2857 #endif // _RAKNET_SUPPORT_TeamManager==1
2858
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/HTTPConnection.cpp Source File

  • src
HTTPConnection.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #include "slikenet/NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_HTTPConnection==1 && _RAKNET_SUPPORT_TCPInterface==1
22
23 #include "slikenet/TCPInterface.h"
24 #include "slikenet/HTTPConnection.h"
25 #include "slikenet/sleep.h"
26 #include "slikenet/string.h"
27 #include "slikenet/assert.h"
28 #include <string.h>
29 #include <stdlib.h>
30 #include <stdio.h>
31 #include <stdlib.h>
32
33 using namespace SLNet;
34
35 STATIC_FACTORY_DEFINITIONS(HTTPConnection,HTTPConnection);
36
37 HTTPConnection::HTTPConnection() : connectionState(CS_NONE)
38 {
39 tcp=0;
40 }
41
42 void HTTPConnection::Init(TCPInterface* _tcp, const char *_host, unsigned short _port)
43 {
44 tcp=_tcp;
45 host=_host;
46 port=_port;
47 }
48
49 void HTTPConnection::Post(const char *remote_path, const char *data, const char *_contentType)
50 {
51 OutgoingCommand op;
52 op.contentType=_contentType;
53 op.data=data;
54 op.remotePath=remote_path;
55 op.isPost=true;
56 outgoingCommand.Push(op, _FILE_AND_LINE_ );
57 //printf("Adding outgoing post\n");
58 }
59
60 void HTTPConnection::Get(const char *path)
61 {
62 OutgoingCommand op;
63 op.remotePath=path;
64 op.isPost=false;
65 outgoingCommand.Push(op, _FILE_AND_LINE_ );
66 }
67
68 bool HTTPConnection::HasBadResponse(int *code, SLNet::RakString *data)
69 {
70 if(badResponses.IsEmpty())
71 return false;
72
73 if (code)
74 *code = badResponses.Peek().code;
75 if (data)
76 *data = badResponses.Pop().data;
77 return true;
78 }
79 void HTTPConnection::CloseConnection()
80 {
81 connectionState=CS_DISCONNECTING;
82 }
83 void HTTPConnection::Update(void)
84 {
85 SystemAddress sa;
86 sa = tcp->HasCompletedConnectionAttempt();
87 while (sa!=UNASSIGNED_SYSTEM_ADDRESS)
88 {
89 // printf("Connected\n");
90 connectionState=CS_CONNECTED;
91 server=sa;
92 sa = tcp->HasCompletedConnectionAttempt();
93 }
94
95 sa = tcp->HasFailedConnectionAttempt();
96 while (sa!=UNASSIGNED_SYSTEM_ADDRESS)
97 {
98 //printf("Failed connected\n");
99 CloseConnection();
100 sa = tcp->HasFailedConnectionAttempt();
101 }
102
103 sa = tcp->HasLostConnection();
104 while (sa!=UNASSIGNED_SYSTEM_ADDRESS)
105 {
106 //printf("Lost connection\n");
107 CloseConnection();
108 sa = tcp->HasLostConnection();
109 }
110
111
112 switch (connectionState)
113 {
114 case CS_NONE:
115 {
116 if (outgoingCommand.IsEmpty())
117 return;
118
119 //printf("Connecting\n");
120 server = tcp->Connect(host, port, false);
121 connectionState = CS_CONNECTING;
122 }
123 break;
124 case CS_DISCONNECTING:
125 {
126 if (tcp->ReceiveHasPackets()==false)
127 {
128 if (incomingData.IsEmpty()==false)
129 {
130 results.Push(incomingData, _FILE_AND_LINE_ );
131 }
132 incomingData.Clear();
133 tcp->CloseConnection(server);
134 connectionState=CS_NONE;
135 }
136 }
137 break;
138 case CS_CONNECTING:
139 {
140 }
141 break;
142 case CS_CONNECTED:
143 {
144 //printf("Connected\n");
145 if (outgoingCommand.IsEmpty())
146 {
147 //printf("Closed connection (nothing to do)\n");
148 CloseConnection();
149 return;
150 }
151
152 #if OPEN_SSL_CLIENT_SUPPORT==1
153 tcp->StartSSLClient(server);
154 #endif
155
156 //printf("Sending request\n");
157 currentProcessingCommand = outgoingCommand.Pop();
158 RakString request;
159 if (currentProcessingCommand.isPost)
160 {
161 request.Set("POST %s HTTP/1.0\r\n"
162 "Host: %s:%i\r\n"
163 "Content-Type: %s\r\n"
164 "Content-Length: %u\r\n"
165 "\r\n"
166 "%s",
167 currentProcessingCommand.remotePath.C_String(),
168 host.C_String(),
169 port,
170 currentProcessingCommand.contentType.C_String(),
171 (unsigned) currentProcessingCommand.data.GetLength(),
172 currentProcessingCommand.data.C_String());
173 }
174 else
175 {
176 // request.Set("GET %s\r\n", host.C_String());
177 // http://www.jenkinssoftware.com/forum/index.php?topic=4601.0;topicseen
178 request.Set("GET %s HTTP/1.0\r\n"
179 "Host: %s:%i\r\n"
180 "\r\n",
181 currentProcessingCommand.remotePath.C_String(),
182 host.C_String(),
183 port);
184 }
185
186 // printf(request.C_String());
187 // request.URLEncode();
188 tcp->Send(request.C_String(), (unsigned int) request.GetLength(), server,false);
189 connectionState=CS_PROCESSING;
190 }
191 break;
192 case CS_PROCESSING:
193 {
194 }
195 }
196
197 // if (connectionState==CS_PROCESSING && currentProcessingCommand.data.IsEmpty()==false)
198 // outgoingCommand.PushAtHead(currentProcessingCommand);
199 }
200 bool HTTPConnection::HasRead(void) const
201 {
202 return results.IsEmpty()==false;
203 }
204 RakString HTTPConnection::Read(void)
205 {
206 if (results.IsEmpty())
207 return RakString();
208
209 SLNet::RakString resultStr = results.Pop();
210 // const char *start_of_body = strstr(resultStr.C_String(), "\r\n\r\n");
211 const char *start_of_body = strpbrk(resultStr.C_String(), "\001\002\003%");
212
213 if(start_of_body)
214 return SLNet::RakString::NonVariadic(start_of_body);
215 else
216 return resultStr;
217 }
218 SystemAddress HTTPConnection::GetServerAddress(void) const
219 {
220 return server;
221 }
222 void HTTPConnection::ProcessTCPPacket(Packet *packet)
223 {
224 RakAssert(packet);
225
226 // read all the packets possible
227 if(packet->systemAddress == server)
228 {
229 if(incomingData.GetLength() == 0)
230 {
231 int response_code = atoi((char *)packet->data + strlen("HTTP/1.0 "));
232
233 if(response_code > 299)
234 {
235 badResponses.Push(BadResponse(packet->data, response_code), _FILE_AND_LINE_ );
236 //printf("Closed connection (Bad response 2)\n");
237 CloseConnection();
238 return;
239 }
240 }
241
242 SLNet::RakString incomingTemp = SLNet::RakString::NonVariadic((const char*) packet->data);
243 incomingTemp.URLDecode();
244 incomingData += incomingTemp;
245
246 // printf((const char*) packet->data);
247 // printf("\n");
248
249 RakAssert(strlen((char *)packet->data) == packet->length); // otherwise it contains Null bytes
250
251 const char *start_of_body = strstr(incomingData, "\r\n\r\n");
252
253 // besides having the server close the connection, they may
254 // provide a length header and supply that many bytes
255 if(
256 // Why was start_of_body here? Makes the GET command fail
257 // start_of_body &&
258 connectionState == CS_PROCESSING)
259 {
260 /*
261 // The stupid programmer that wrote this originally didn't think that just because the header contains this value doesn't mean you got the whole message
262 if (strstr((const char*) packet->data, "\r\nConnection: close\r\n"))
263 {
264 CloseConnection();
265 }
266 else
267 {
268 */
269 long length_of_headers;
270 if (start_of_body)
271 {
272 length_of_headers = (long)(start_of_body + 4 - incomingData.C_String());
273 const char *length_header = strstr(incomingData, "\r\nLength: ");
274
275 if(length_header)
276 {
277 long length = atol(length_header + 10) + length_of_headers;
278
279 if((long) incomingData.GetLength() >= length)
280 {
281 //printf("Closed connection (Got all data due to length header)\n");
282 CloseConnection();
283 }
284 }
285 }
286 else
287 {
288 // No processing needed
289 }
290
291
292 //}
293 }
294 }
295 }
296
297 bool HTTPConnection::IsBusy(void) const
298 {
299 return connectionState != CS_NONE;
300 }
301
302 int HTTPConnection::GetState(void) const
303 {
304 return connectionState;
305 }
306
307
308 HTTPConnection::~HTTPConnection(void)
309 {
310 if (tcp)
311 tcp->CloseConnection(server);
312 }
313
314
315 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketLogger.cpp Source File

  • src
PacketLogger.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_PacketLogger==1
18
19 #include "slikenet/PacketLogger.h"
20 #include "slikenet/BitStream.h"
21 #include "slikenet/DS_List.h"
22 #include "slikenet/InternalPacket.h"
23 #include "slikenet/peerinterface.h"
24 #include "slikenet/MessageIdentifiers.h"
25 #include "slikenet/StringCompressor.h"
26 #include "slikenet/GetTime.h"
27 #include <stdio.h>
28 #include <string.h>
29 #include <stdlib.h>
30 #include "slikenet/Itoa.h"
31 #include <time.h>
32 #include "slikenet/SocketIncludes.h"
33 #include "slikenet/gettimeofday.h"
34 #include "slikenet/linux_adapter.h"
35 #include "slikenet/osx_adapter.h"
36
37 using namespace SLNet;
38
39 STATIC_FACTORY_DEFINITIONS(PacketLogger,PacketLogger);
40
41 PacketLogger::PacketLogger()
42 {
43 printId=true;
44 printAcks=true;
45 prefix[0]=0;
46 suffix[0]=0;
47 logDirectMessages=true;
48 }
49 PacketLogger::~PacketLogger()
50 {
51 }
52 void PacketLogger::FormatLine(char* into, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame
53 , unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
54 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
55 {
56 char numericID[16];
57 const char* idToPrint = NULL;
58 if (printId)
59 {
60 if (splitPacketCount > 0 && splitPacketCount != (unsigned int)-1)
61 idToPrint = "(SPLIT PACKET)";
62 else
63 idToPrint = IDTOString(id);
64 }
65 // If printId is false, idToPrint will be NULL, as it will
66 // in the case of an unrecognized id. Testing printId for false
67 // would just be redundant.
68 if (idToPrint == NULL)
69 {
70 sprintf_s(numericID, "%5u", id);
71 idToPrint = numericID;
72 }
73
74 FormatLine(into, dir, type, reliableMessageNumber, frame, idToPrint, bitLen, time, local, remote, splitPacketId, splitPacketIndex, splitPacketCount, orderingIndex);
75 }
76 void PacketLogger::FormatLine(
77 char* into, size_t intoLength, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame, unsigned char id
78 , const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
79 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
80 {
81 char numericID[16];
82 const char* idToPrint = NULL;
83 if(printId)
84 {
85 if (splitPacketCount>0 && splitPacketCount!=(unsigned int)-1)
86 idToPrint="(SPLIT PACKET)";
87 else
88 idToPrint = IDTOString(id);
89 }
90 // If printId is false, idToPrint will be NULL, as it will
91 // in the case of an unrecognized id. Testing printId for false
92 // would just be redundant.
93 if(idToPrint == NULL)
94 {
95 sprintf_s(numericID, "%5u", id);
96 idToPrint = numericID;
97 }
98
99 FormatLine(into, intoLength, dir, type, reliableMessageNumber, frame, idToPrint, bitLen, time, local, remote,splitPacketId,splitPacketIndex,splitPacketCount, orderingIndex);
100 }
101
102 void PacketLogger::FormatLine(
103 char* into, size_t intoLength, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame, const char* idToPrint
104 , const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
105 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
106 {
107 char str1[64], str2[62];
108 local.ToString(true, str1, static_cast<size_t>(64));
109 remote.ToString(true, str2, static_cast<size_t>(62));
110 char localtime[128];
111 GetLocalTime(localtime);
112 char str3[64];
113 if (reliableMessageNumber==(unsigned int)-1)
114 {
115 str3[0]='N';
116 str3[1]='/';
117 str3[2]='A';
118 str3[3]=0;
119 }
120 else
121 {
122 sprintf_s(str3,"%5u",reliableMessageNumber);
123 }
124
125 sprintf_s(into, intoLength, "%s,%s%s,%s,%s,%5u,%s,%u,%" PRINTF_64_BIT_MODIFIER "u,%s,%s,%i,%i,%i,%i,%s,"
126 , localtime
127 , prefix
128 , dir
129 , type
130 , str3
131 , frame
132 , idToPrint
133 , bitLen
134 , time
135 , str1
136 , str2
137 , splitPacketId
138 , splitPacketIndex
139 , splitPacketCount
140 , orderingIndex
141 , suffix
142 );
143 }
144 void PacketLogger::FormatLine(char* into, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame
145 , const char* idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
146 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex)
147 {
148 char str1[64], str2[62];
149 local.ToString(true, str1, static_cast<size_t>(64));
150 remote.ToString(true, str2, static_cast<size_t>(62));
151 char localtime[128];
152 GetLocalTime(localtime);
153 char str3[64];
154 if (reliableMessageNumber == (unsigned int)-1)
155 {
156 str3[0] = 'N';
157 str3[1] = '/';
158 str3[2] = 'A';
159 str3[3] = 0;
160 }
161 else
162 {
163 sprintf_s(str3, "%5u", reliableMessageNumber);
164 }
165
166 #pragma warning(push)
167 #pragma warning(disable:4996)
168 sprintf(into, "%s,%s%s,%s,%s,%5u,%s,%u,%" PRINTF_64_BIT_MODIFIER "u,%s,%s,%i,%i,%i,%i,%s,"
169 , localtime
170 , prefix
171 , dir
172 , type
173 , str3
174 , frame
175 , idToPrint
176 , bitLen
177 , time
178 , str1
179 , str2
180 , splitPacketId
181 , splitPacketIndex
182 , splitPacketCount
183 , orderingIndex
184 , suffix
185 );
186 #pragma warning(pop)
187 }
188 void PacketLogger::OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
189 {
190 if (logDirectMessages==false)
191 return;
192
193 char str[256];
194 FormatLine(str, 256, "Snd", "Raw", 0, 0, data[0], bitsUsed, SLNet::GetTimeMS(), rakPeerInterface->GetExternalID(remoteSystemAddress), remoteSystemAddress, (unsigned int)-1,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1);
195 AddToLog(str);
196 }
197
198 void PacketLogger::LogHeader(void)
199 {
200 // Last 5 are splitpacket id, split packet index, split packet count, ordering index, suffix
201 AddToLog("Clock,S|R,Typ,Reliable#,Frm #,PktID,BitLn,Time ,Local IP:Port ,RemoteIP:Port,SPID,SPIN,SPCO,OI,Suffix,Miscellaneous\n");
202 }
203 void PacketLogger::OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
204 {
205 if (logDirectMessages==false)
206 return;
207
208 char str[256];
209 FormatLine(str, 256, "Rcv", "Raw", 0, 0, data[0], bitsUsed, SLNet::GetTime(), rakPeerInterface->GetInternalID(UNASSIGNED_SYSTEM_ADDRESS), remoteSystemAddress,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1);
210 AddToLog(str);
211 }
212 void PacketLogger::OnReliabilityLayerNotification(const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
213 {
214 char str[1024];
215 char *type;
216 if (isError)
217 type=(char*) "RcvErr";
218 else
219 type=(char*) "RcvWrn";
220 FormatLine(str, 1024, type, errorMessage, 0, 0, "", bitsUsed, SLNet::GetTime(), rakPeerInterface->GetInternalID(UNASSIGNED_SYSTEM_ADDRESS), remoteSystemAddress,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1,(unsigned int)-1);
221 AddToLog(str);
222 RakAssert(isError==false);
223 }
224 void PacketLogger::OnAck(unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
225 {
226 char str[256];
227 char str1[64], str2[62];
228 SystemAddress localSystemAddress = rakPeerInterface->GetExternalID(remoteSystemAddress);
229 localSystemAddress.ToString(true, str1, static_cast<size_t>(64));
230 remoteSystemAddress.ToString(true, str2, static_cast<size_t>(62));
231 char localtime[128];
232 GetLocalTime(localtime);
233
234 sprintf_s(str, "%s,Rcv,Ack,%i,,,,%" PRINTF_64_BIT_MODIFIER "u,%s,%s,,,,,,"
235 , localtime
236 , messageNumber
237 , (unsigned long long) time
238 , str1
239 , str2
240 );
241 AddToLog(str);
242 }
243 void PacketLogger::OnPushBackPacket(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
244 {
245 char str[256];
246 char str1[64], str2[62];
247 SystemAddress localSystemAddress = rakPeerInterface->GetExternalID(remoteSystemAddress);
248 localSystemAddress.ToString(true, str1, static_cast<size_t>(64));
249 remoteSystemAddress.ToString(true, str2, static_cast<size_t>(62));
250 SLNet::TimeMS time = SLNet::GetTimeMS();
251 char localtime[128];
252 GetLocalTime(localtime);
253
254 sprintf_s(str, "%s,Lcl,PBP,,,%s,%i,%" PRINTF_64_BIT_MODIFIER "u,%s,%s,,,,,,"
255 , localtime
256 , BaseIDTOString(data[0])
257 , bitsUsed
258 , (unsigned long long) time
259 , str1
260 , str2
261 );
262 AddToLog(str);
263 }
264 void PacketLogger::OnInternalPacket(InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
265 {
266 char str[256];
267 const char *sendTypes[] =
268 {
269 "Rcv",
270 "Snd",
271 "Err1",
272 "Err2",
273 "Err3",
274 "Err4",
275 "Err5",
276 "Err6",
277 };
278 const char *sendType = sendTypes[isSend];
279 SystemAddress localSystemAddress = rakPeerInterface->GetExternalID(remoteSystemAddress);
280
281 unsigned int reliableMessageNumber;
282 if (internalPacket->reliability==UNRELIABLE || internalPacket->reliability==UNRELIABLE_SEQUENCED || internalPacket->reliability==UNRELIABLE_WITH_ACK_RECEIPT)
283 reliableMessageNumber=(unsigned int)-1;
284 else
285 reliableMessageNumber=internalPacket->reliableMessageNumber;
286
287 if (internalPacket->data[0]==ID_TIMESTAMP)
288 {
289 FormatLine(str, 256, sendType, "Tms", reliableMessageNumber, frameNumber, internalPacket->data[1+sizeof(SLNet::Time)], internalPacket->dataBitLength, (unsigned long long)time, localSystemAddress, remoteSystemAddress, internalPacket->splitPacketId, internalPacket->splitPacketIndex, internalPacket->splitPacketCount, internalPacket->orderingIndex);
290 }
291 else
292 {
293 FormatLine(str, 256, sendType, "Nrm", reliableMessageNumber, frameNumber, internalPacket->data[0], internalPacket->dataBitLength, (unsigned long long)time, localSystemAddress, remoteSystemAddress, internalPacket->splitPacketId, internalPacket->splitPacketIndex, internalPacket->splitPacketCount, internalPacket->orderingIndex);
294 }
295
296 AddToLog(str);
297 }
298 void PacketLogger::AddToLog(const char *str)
299 {
300 WriteLog(str);
301 }
302 void PacketLogger::WriteLog(const char *str)
303 {
304 RAKNET_DEBUG_PRINTF("%s\n", str);
305 }
306 void PacketLogger::WriteMiscellaneous(const char *type, const char *msg)
307 {
308 char str[1024];
309 char str1[64];
310 SystemAddress localSystemAddress = rakPeerInterface->GetInternalID();
311 localSystemAddress.ToString(true, str1, static_cast<size_t>(64));
312 SLNet::TimeMS time = SLNet::GetTimeMS();
313 char localtime[128];
314 GetLocalTime(localtime);
315
316 sprintf_s(str, "%s,Lcl,%s,,,,,%" PRINTF_64_BIT_MODIFIER "u,%s,,,,,,,%s"
317 , localtime
318 , type
319 , (unsigned long long) time
320 , str1
321 , msg
322 );
323
324 AddToLog(msg);
325 }
326 void PacketLogger::SetPrintID(bool print)
327 {
328 printId=print;
329 }
330 void PacketLogger::SetPrintAcks(bool print)
331 {
332 printAcks=print;
333 }
334 const char* PacketLogger::BaseIDTOString(unsigned char Id)
335 {
336 if (Id >= ID_USER_PACKET_ENUM)
337 return 0;
338
339 const char *IDTable[((int)ID_USER_PACKET_ENUM)+1]=
340 {
341 "ID_CONNECTED_PING",
342 "ID_UNCONNECTED_PING",
343 "ID_UNCONNECTED_PING_OPEN_CONNECTIONS",
344 "ID_CONNECTED_PONG",
345 "ID_DETECT_LOST_CONNECTIONS",
346 "ID_OPEN_CONNECTION_REQUEST_1",
347 "ID_OPEN_CONNECTION_REPLY_1",
348 "ID_OPEN_CONNECTION_REQUEST_2",
349 "ID_OPEN_CONNECTION_REPLY_2",
350 "ID_CONNECTION_REQUEST",
351 "ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY",
352 "ID_OUR_SYSTEM_REQUIRES_SECURITY",
353 "ID_PUBLIC_KEY_MISMATCH",
354 "ID_OUT_OF_BAND_INTERNAL",
355 "ID_SND_RECEIPT_ACKED",
356 "ID_SND_RECEIPT_LOSS",
357 "ID_CONNECTION_REQUEST_ACCEPTED",
358 "ID_CONNECTION_ATTEMPT_FAILED",
359 "ID_ALREADY_CONNECTED",
360 "ID_NEW_INCOMING_CONNECTION",
361 "ID_NO_FREE_INCOMING_CONNECTIONS",
362 "ID_DISCONNECTION_NOTIFICATION",
363 "ID_CONNECTION_LOST",
364 "ID_CONNECTION_BANNED",
365 "ID_INVALID_PASSWORD",
366 "ID_INCOMPATIBLE_PROTOCOL_VERSION",
367 "ID_IP_RECENTLY_CONNECTED",
368 "ID_TIMESTAMP",
369 "ID_UNCONNECTED_PONG",
370 "ID_ADVERTISE_SYSTEM",
371 "ID_DOWNLOAD_PROGRESS",
372 "ID_REMOTE_DISCONNECTION_NOTIFICATION",
373 "ID_REMOTE_CONNECTION_LOST",
374 "ID_REMOTE_NEW_INCOMING_CONNECTION",
375 "ID_FILE_LIST_TRANSFER_HEADER",
376 "ID_FILE_LIST_TRANSFER_FILE",
377 "ID_FILE_LIST_REFERENCE_PUSH_ACK",
378 "ID_DDT_DOWNLOAD_REQUEST",
379 "ID_TRANSPORT_STRING",
380 "ID_REPLICA_MANAGER_CONSTRUCTION",
381 "ID_REPLICA_MANAGER_SCOPE_CHANGE",
382 "ID_REPLICA_MANAGER_SERIALIZE",
383 "ID_REPLICA_MANAGER_DOWNLOAD_STARTED",
384 "ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE",
385 "ID_RAKVOICE_OPEN_CHANNEL_REQUEST",
386 "ID_RAKVOICE_OPEN_CHANNEL_REPLY",
387 "ID_RAKVOICE_CLOSE_CHANNEL",
388 "ID_RAKVOICE_DATA",
389 "ID_AUTOPATCHER_GET_CHANGELIST_SINCE_DATE",
390 "ID_AUTOPATCHER_CREATION_LIST",
391 "ID_AUTOPATCHER_DELETION_LIST",
392 "ID_AUTOPATCHER_GET_PATCH",
393 "ID_AUTOPATCHER_PATCH_LIST",
394 "ID_AUTOPATCHER_REPOSITORY_FATAL_ERROR",
395 "ID_AUTOPATCHER_CANNOT_DOWNLOAD_ORIGINAL_UNMODIFIED_FILES",
396 "ID_AUTOPATCHER_FINISHED_INTERNAL",
397 "ID_AUTOPATCHER_FINISHED",
398 "ID_AUTOPATCHER_RESTART_APPLICATION",
399 "ID_NAT_PUNCHTHROUGH_REQUEST",
400 "ID_NAT_CONNECT_AT_TIME",
401 "ID_NAT_GET_MOST_RECENT_PORT",
402 "ID_NAT_CLIENT_READY",
403 "ID_NAT_TARGET_NOT_CONNECTED",
404 "ID_NAT_TARGET_UNRESPONSIVE",
405 "ID_NAT_CONNECTION_TO_TARGET_LOST",
406 "ID_NAT_ALREADY_IN_PROGRESS",
407 "ID_NAT_PUNCHTHROUGH_FAILED",
408 "ID_NAT_PUNCHTHROUGH_SUCCEEDED",
409 "ID_READY_EVENT_SET",
410 "ID_READY_EVENT_UNSET",
411 "ID_READY_EVENT_ALL_SET",
412 "ID_READY_EVENT_QUERY",
413 "ID_LOBBY_GENERAL",
414 "ID_RPC_REMOTE_ERROR",
415 "ID_RPC_PLUGIN",
416 "ID_FILE_LIST_REFERENCE_PUSH",
417 "ID_READY_EVENT_FORCE_ALL_SET",
418 "ID_ROOMS_EXECUTE_FUNC",
419 "ID_ROOMS_LOGON_STATUS",
420 "ID_ROOMS_HANDLE_CHANGE",
421 "ID_LOBBY2_SEND_MESSAGE",
422 "ID_LOBBY2_SERVER_ERROR",
423 "ID_FCM2_NEW_HOST",
424 "ID_FCM2_REQUEST_FCMGUID",
425 "ID_FCM2_RESPOND_CONNECTION_COUNT",
426 "ID_FCM2_INFORM_FCMGUID",
427 "ID_FCM2_UPDATE_MIN_TOTAL_CONNECTION_COUNT",
428 "ID_FCM2_VERIFIED_JOIN_START",
429 "ID_FCM2_VERIFIED_JOIN_CAPABLE",
430 "ID_FCM2_VERIFIED_JOIN_FAILED",
431 "ID_FCM2_VERIFIED_JOIN_ACCEPTED",
432 "ID_FCM2_VERIFIED_JOIN_REJECTED",
433 "ID_UDP_PROXY_GENERAL",
434 "ID_SQLite3_EXEC",
435 "ID_SQLite3_UNKNOWN_DB",
436 "ID_SQLLITE_LOGGER",
437 "ID_NAT_TYPE_DETECTION_REQUEST",
438 "ID_NAT_TYPE_DETECTION_RESULT",
439 "ID_ROUTER_2_INTERNAL",
440 "ID_ROUTER_2_FORWARDING_NO_PATH",
441 "ID_ROUTER_2_FORWARDING_ESTABLISHED",
442 "ID_ROUTER_2_REROUTED",
443 "ID_TEAM_BALANCER_INTERNAL",
444 "ID_TEAM_BALANCER_REQUESTED_TEAM_FULL",
445 "ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED",
446 "ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED",
447 "ID_TEAM_BALANCER_TEAM_ASSIGNED",
448 "ID_LIGHTSPEED_INTEGRATION",
449 "ID_XBOX_LOBBY",
450 "ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS",
451 "ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS",
452 "ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE",
453 "ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE",
454 "ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT",
455 "ID_TWO_WAY_AUTHENTICATION_NEGOTIATION",
456 "ID_CLOUD_POST_REQUEST",
457 "ID_CLOUD_RELEASE_REQUEST",
458 "ID_CLOUD_GET_REQUEST",
459 "ID_CLOUD_GET_RESPONSE",
460 "ID_CLOUD_UNSUBSCRIBE_REQUEST",
461 "ID_CLOUD_SERVER_TO_SERVER_COMMAND",
462 "ID_CLOUD_SUBSCRIPTION_NOTIFICATION",
463 "ID_LIB_VOICE",
464 "ID_RELAY_PLUGIN",
465 "ID_NAT_REQUEST_BOUND_ADDRESSES",
466 "ID_NAT_RESPOND_BOUND_ADDRESSES",
467 "ID_FCM2_UPDATE_USER_CONTEXT",
468 "ID_RESERVED_3",
469 "ID_RESERVED_4",
470 "ID_RESERVED_5",
471 "ID_RESERVED_6",
472 "ID_RESERVED_7",
473 "ID_RESERVED_8",
474 "ID_RESERVED_9",
475 "ID_USER_PACKET_ENUM"
476 };
477
478 return (char*)IDTable[Id];
479 }
480 const char* PacketLogger::UserIDTOString(unsigned char Id)
481 {
482 // Users should override this
483 static char str[256];
484 Itoa(Id, str, 10);
485 return (const char*) str;
486 }
487 const char* PacketLogger::IDTOString(unsigned char Id)
488 {
489 const char *out;
490 out=BaseIDTOString(Id);
491 if (out)
492 return out;
493 return UserIDTOString(Id);
494 }
495 void PacketLogger::SetPrefix(const char *_prefix)
496 {
497 strncpy_s(prefix, _prefix, 255);
498 prefix[255]=0;
499 }
500 void PacketLogger::SetSuffix(const char *_suffix)
501 {
502 strncpy_s(suffix, _suffix, 255);
503 suffix[255]=0;
504 }
505 void PacketLogger::GetLocalTime(char buffer[128])
506 {
507 #if defined(_WIN32) && !defined(__GNUC__) && !defined(__GCCXML__)
508 time_t rawtime;
509 struct timeval tv;
510 // If you get an arror about an incomplete type, just delete this file
511 struct timezone tz;
512 gettimeofday(&tv, &tz);
513 // time ( &rawtime );
514 rawtime=tv.tv_sec;
515
516 struct tm timeinfo;
517 localtime_s ( &timeinfo, &rawtime );
518 strftime (buffer,128,"%x %X",&timeinfo);
519 char buff[32];
520 sprintf_s(buff, ".%i", tv.tv_usec);
521 strcat_s(buffer,128,buff);
522
523 // Commented version puts the time first
524 /*
525 struct tm timeinfo;
526 localtime_s ( &timeinfo, &rawtime );
527 strftime (buffer,128,"%X",&timeinfo);
528 char buff[32];
529 sprintf_s(buff, ".%i ", tv.tv_usec);
530 strcat_s(buffer,128,buff);
531 char buff2[32];
532 strftime (buff2,32,"%x",&timeinfo);
533 strcat_s(buffer,128,buff2);
534 */
535 #else
536 buffer[0]=0;
537 #endif
538 }
539 void PacketLogger::SetLogDirectMessages(bool send)
540 {
541 logDirectMessages=send;
542 }
543
544 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketPool.h Source File

  • include
  • slikenet
PacketPool.h
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082 without any modifications.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 */
5
6 // REMOVEME
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ReplicaManager3.cpp Source File

  • src
ReplicaManager3.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_ReplicaManager3==1
18
19 #include "slikenet/ReplicaManager3.h"
20 #include "slikenet/GetTime.h"
21 #include "slikenet/MessageIdentifiers.h"
22 #include "slikenet/peerinterface.h"
23 #include "slikenet/NetworkIDManager.h"
24
25 using namespace SLNet;
26
27 // DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS(LastSerializationResult,Replica3*,replica);
28
29 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
30
31 bool PRO::operator==( const PRO& right ) const
32 {
33 return priority == right.priority && reliability == right.reliability && orderingChannel == right.orderingChannel && sendReceipt == right.sendReceipt;
34 }
35
36 bool PRO::operator!=( const PRO& right ) const
37 {
38 return priority != right.priority || reliability != right.reliability || orderingChannel != right.orderingChannel || sendReceipt != right.sendReceipt;
39 }
40
41 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
42
43 int Connection_RM3::Replica3LSRComp( Replica3 * const &replica3, LastSerializationResult * const &data )
44 {
45 /*
46 if (replica3->GetNetworkID() < data->replica->GetNetworkID())
47 return -1;
48 if (replica3->GetNetworkID() > data->replica->GetNetworkID())
49 return 1;
50 */
51
52 // 7/28/2013 - If GetNetworkID chagned during runtime, the list would be out of order and lookup would always fail or go out of bounds
53 // I remember before that I could not directly compare
54 if (replica3->referenceIndex < data->replica->referenceIndex)
55 return -1;
56 if (replica3->referenceIndex > data->replica->referenceIndex)
57 return 1;
58 return 0;
59 }
60
61 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
62
63 LastSerializationResult::LastSerializationResult()
64 {
65 replica=0;
66 lastSerializationResultBS=0;
67 whenLastSerialized = SLNet::GetTime();
68 }
69 LastSerializationResult::~LastSerializationResult()
70 {
71 if (lastSerializationResultBS)
72 SLNet::OP_DELETE(lastSerializationResultBS,_FILE_AND_LINE_);
73 }
74 void LastSerializationResult::AllocBS(void)
75 {
76 if (lastSerializationResultBS==0)
77 {
78 lastSerializationResultBS= SLNet::OP_NEW<LastSerializationResultBS>(_FILE_AND_LINE_);
79 }
80 }
81 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
82
83 ReplicaManager3::ReplicaManager3()
84 {
85 defaultSendParameters.orderingChannel=0;
86 defaultSendParameters.priority=HIGH_PRIORITY;
87 defaultSendParameters.reliability=RELIABLE_ORDERED;
88 defaultSendParameters.sendReceipt=0;
89 autoSerializeInterval=30;
90 lastAutoSerializeOccurance=0;
91 autoCreateConnections=true;
92 autoDestroyConnections=true;
93 currentlyDeallocatingReplica=0;
94
95 for (unsigned int i=0; i < 255; i++)
96 worldsArray[i]=0;
97
98 AddWorld(0);
99 }
100
101 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
102
103 ReplicaManager3::~ReplicaManager3()
104 {
105 if (autoDestroyConnections)
106 {
107 for (unsigned int i=0; i < worldsList.Size(); i++)
108 {
109 RakAssert(worldsList[i]->connectionList.Size()==0);
110 }
111 }
112 Clear(true);
113 }
114
115 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
116
117 void ReplicaManager3::SetAutoManageConnections(bool autoCreate, bool autoDestroy)
118 {
119 autoCreateConnections=autoCreate;
120 autoDestroyConnections=autoDestroy;
121 }
122
123 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
124
125 bool ReplicaManager3::GetAutoCreateConnections(void) const
126 {
127 return autoCreateConnections;
128 }
129
130 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
131
132 bool ReplicaManager3::GetAutoDestroyConnections(void) const
133 {
134 return autoDestroyConnections;
135 }
136
137 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
138
139 void ReplicaManager3::AutoCreateConnectionList(
140 DataStructures::List<RakNetGUID> &participantListIn,
141 DataStructures::List<Connection_RM3*> &participantListOut,
142 WorldId worldId)
143 {
144 for (unsigned int index=0; index < participantListIn.Size(); index++)
145 {
146 if (GetConnectionByGUID(participantListIn[index], worldId)==NULL)
147 {
148 Connection_RM3 *connection = AllocConnection(rakPeerInterface->GetSystemAddressFromGuid(participantListIn[index]), participantListIn[index]);
149 if (connection)
150 {
151 PushConnection(connection);
152 participantListOut.Push(connection, _FILE_AND_LINE_);
153 }
154 }
155 }
156 }
157
158 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
159
160 bool ReplicaManager3::PushConnection(SLNet::Connection_RM3 *newConnection, WorldId worldId)
161 {
162 if (newConnection==0)
163 return false;
164 if (GetConnectionByGUID(newConnection->GetRakNetGUID(), worldId))
165 return false;
166 // Was this intended?
167 RakAssert(newConnection->GetRakNetGUID()!=rakPeerInterface->GetMyGUID());
168
169 RakAssert(worldsArray[worldId]!=0 && "World not in use");
170 RM3World *world = worldsArray[worldId];
171
172 unsigned int index = world->connectionList.GetIndexOf(newConnection);
173 if (index==(unsigned int)-1)
174 {
175 world->connectionList.Push(newConnection,_FILE_AND_LINE_);
176
177 // Send message to validate the connection
178 newConnection->SendValidation(rakPeerInterface, worldId);
179
180 Connection_RM3::ConstructionMode constructionMode = newConnection->QueryConstructionMode();
181 if (constructionMode==Connection_RM3::QUERY_REPLICA_FOR_CONSTRUCTION || constructionMode==Connection_RM3::QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION)
182 {
183 unsigned int pushIdx;
184 for (pushIdx=0; pushIdx < world->userReplicaList.Size(); pushIdx++)
185 newConnection->OnLocalReference(world->userReplicaList[pushIdx], this);
186 }
187 }
188 return true;
189 }
190
191 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
192
193 void ReplicaManager3::DeallocReplicaNoBroadcastDestruction(SLNet::Connection_RM3 *connection, SLNet::Replica3 *replica3)
194 {
195 currentlyDeallocatingReplica=replica3;
196 replica3->DeallocReplica(connection);
197 currentlyDeallocatingReplica=0;
198 }
199
200 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
201
202 SLNet::Connection_RM3 * ReplicaManager3::PopConnection(unsigned int index, WorldId worldId)
203 {
204 DataStructures::List<Replica3*> replicaList;
205 DataStructures::List<NetworkID> destructionList;
206 DataStructures::List<Replica3*> broadcastList;
207 SLNet::Connection_RM3 *connection;
208 unsigned int index2;
209 RM3ActionOnPopConnection action;
210
211 RakAssert(worldsArray[worldId]!=0 && "World not in use");
212 RM3World *world = worldsArray[worldId];
213
214 connection=world->connectionList[index];
215
216 // Clear out downloadGroup
217 connection->ClearDownloadGroup(rakPeerInterface);
218
219 RakNetGUID guid = connection->GetRakNetGUID();
220 // This might be wrong, I am relying on the variable creatingSystemGuid which is transmitted
221 // automatically from the first system to reference the object. However, if an object changes
222 // owners then it is not going to be returned here, and therefore QueryActionOnPopConnection()
223 // will not be called for the new owner.
224 GetReplicasCreatedByGuid(guid, replicaList);
225
226 for (index2=0; index2 < replicaList.Size(); index2++)
227 {
228 action = replicaList[index2]->QueryActionOnPopConnection(connection);
229 replicaList[index2]->OnPoppedConnection(connection);
230 if (action==RM3AOPC_DELETE_REPLICA)
231 {
232 if (replicaList[index2]->GetNetworkIDManager())
233 destructionList.Push( replicaList[index2]->GetNetworkID(), _FILE_AND_LINE_ );
234 }
235 else if (action==RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION)
236 {
237 if (replicaList[index2]->GetNetworkIDManager())
238 destructionList.Push( replicaList[index2]->GetNetworkID(), _FILE_AND_LINE_ );
239
240 broadcastList.Push( replicaList[index2], _FILE_AND_LINE_ );
241 }
242 else if (action==RM3AOPC_DO_NOTHING)
243 {
244 for (unsigned int index3 = 0; index3 < connection->queryToSerializeReplicaList.Size(); index3++)
245 {
246 LastSerializationResult *lsr = connection->queryToSerializeReplicaList[index3];
247 lsr->whenLastSerialized=0;
248 if (lsr->lastSerializationResultBS)
249 {
250 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
251 lsr->lastSerializationResultBS->bitStream[z].Reset();
252 }
253 }
254 }
255 }
256
257 BroadcastDestructionList(broadcastList, connection->GetSystemAddress());
258 for (index2=0; index2 < destructionList.Size(); index2++)
259 {
260 // Do lookup in case DeallocReplica destroyed one of of the later Replica3 instances in the list
261 Replica3* replicaToDestroy = world->networkIDManager->GET_OBJECT_FROM_ID<Replica3*>(destructionList[index2]);
262 if (replicaToDestroy)
263 {
264 replicaToDestroy->PreDestruction(connection);
265 replicaToDestroy->DeallocReplica(connection);
266 }
267 }
268
269 world->connectionList.RemoveAtIndex(index);
270 return connection;
271 }
272
273 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
274
275 SLNet::Connection_RM3 * ReplicaManager3::PopConnection(RakNetGUID guid, WorldId worldId)
276 {
277 unsigned int index;
278
279 RakAssert(worldsArray[worldId]!=0 && "World not in use");
280 RM3World *world = worldsArray[worldId];
281
282 for (index=0; index < world->connectionList.Size(); index++)
283 {
284 if (world->connectionList[index]->GetRakNetGUID()==guid)
285 {
286 return PopConnection(index, worldId);
287 }
288 }
289 return 0;
290 }
291
292 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
293
294 void ReplicaManager3::Reference(SLNet::Replica3 *replica3, WorldId worldId)
295 {
296 RakAssert(worldsArray[worldId]!=0 && "World not in use");
297 RM3World *world = worldsArray[worldId];
298
299 unsigned int index = ReferenceInternal(replica3, worldId);
300
301 if (index!=(unsigned int)-1)
302 {
303 unsigned int pushIdx;
304 for (pushIdx=0; pushIdx < world->connectionList.Size(); pushIdx++)
305 {
306 Connection_RM3::ConstructionMode constructionMode = world->connectionList[pushIdx]->QueryConstructionMode();
307 if (constructionMode==Connection_RM3::QUERY_REPLICA_FOR_CONSTRUCTION || constructionMode==Connection_RM3::QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION)
308 {
309 world->connectionList[pushIdx]->OnLocalReference(replica3, this);
310 }
311 }
312 }
313 }
314
315 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
316
317 unsigned int ReplicaManager3::ReferenceInternal(SLNet::Replica3 *replica3, WorldId worldId)
318 {
319 RakAssert(worldsArray[worldId]!=0 && "World not in use");
320 RM3World *world = worldsArray[worldId];
321
322 unsigned int index;
323 index = world->userReplicaList.GetIndexOf(replica3);
324 if (index==(unsigned int)-1)
325 {
326 RakAssert(world->networkIDManager);
327 replica3->SetNetworkIDManager(world->networkIDManager);
328 // If it crashes on rakPeerInterface==0 then you didn't call RakPeerInterface::AttachPlugin()
329 if (replica3->creatingSystemGUID==UNASSIGNED_RAKNET_GUID)
330 replica3->creatingSystemGUID=rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
331 replica3->replicaManager=this;
332 if (replica3->referenceIndex==(uint32_t)-1)
333 {
334 replica3->referenceIndex=nextReferenceIndex++;
335 }
336 world->userReplicaList.Push(replica3,_FILE_AND_LINE_);
337 return world->userReplicaList.Size()-1;
338 }
339 return (unsigned int) -1;
340 }
341
342 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
343
344 void ReplicaManager3::Dereference(SLNet::Replica3 *replica3, WorldId worldId)
345 {
346 RakAssert(worldsArray[worldId]!=0 && "World not in use");
347 RM3World *world = worldsArray[worldId];
348
349 unsigned int index, index2;
350 for (index=0; index < world->userReplicaList.Size(); index++)
351 {
352 if (world->userReplicaList[index]==replica3)
353 {
354 world->userReplicaList.RemoveAtIndex(index);
355 break;
356 }
357 }
358
359 // Remove from all connections
360 for (index2=0; index2 < world->connectionList.Size(); index2++)
361 {
362 world->connectionList[index2]->OnDereference(replica3, this);
363 }
364 }
365
366 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
367
368 void ReplicaManager3::DereferenceList(DataStructures::List<Replica3*> &replicaListIn, WorldId worldId)
369 {
370 unsigned int index;
371 for (index=0; index < replicaListIn.Size(); index++)
372 Dereference(replicaListIn[index], worldId);
373 }
374
375
376 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
377
378 void ReplicaManager3::GetReplicasCreatedByMe(DataStructures::List<Replica3*> &replicaListOut, WorldId worldId)
379 {
380 //RakNetGUID myGuid = rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
381 GetReplicasCreatedByGuid(rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS), replicaListOut, worldId);
382 }
383
384 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
385
386 void ReplicaManager3::GetReferencedReplicaList(DataStructures::List<Replica3*> &replicaListOut, WorldId worldId)
387 {
388 RakAssert(worldsArray[worldId]!=0 && "World not in use");
389 RM3World *world = worldsArray[worldId];
390
391 replicaListOut=world->userReplicaList;
392 }
393 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
394
395 void ReplicaManager3::GetReplicasCreatedByGuid(RakNetGUID guid, DataStructures::List<Replica3*> &replicaListOut, WorldId worldId)
396 {
397 RakAssert(worldsArray[worldId]!=0 && "World not in use");
398 RM3World *world = worldsArray[worldId];
399
400 replicaListOut.Clear(false,_FILE_AND_LINE_);
401 unsigned int index;
402 for (index=0; index < world->userReplicaList.Size(); index++)
403 {
404 if (world->userReplicaList[index]->creatingSystemGUID==guid)
405 replicaListOut.Push(world->userReplicaList[index],_FILE_AND_LINE_);
406 }
407 }
408
409
410 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
411
412 unsigned ReplicaManager3::GetReplicaCount(WorldId worldId) const
413 {
414 RakAssert(worldsArray[worldId]!=0 && "World not in use");
415 RM3World *world = worldsArray[worldId];
416
417 return world->userReplicaList.Size();
418 }
419
420 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
421
422 Replica3 *ReplicaManager3::GetReplicaAtIndex(unsigned index, WorldId worldId)
423 {
424 RakAssert(worldsArray[worldId]!=0 && "World not in use");
425 RM3World *world = worldsArray[worldId];
426
427 return world->userReplicaList[index];
428 }
429
430 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
431
432 unsigned int ReplicaManager3::GetConnectionCount(WorldId worldId) const
433 {
434 RakAssert(worldsArray[worldId]!=0 && "World not in use");
435 RM3World *world = worldsArray[worldId];
436
437 return world->connectionList.Size();
438 }
439
440 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
441
442 Connection_RM3* ReplicaManager3::GetConnectionAtIndex(unsigned index, WorldId worldId) const
443 {
444 RakAssert(worldsArray[worldId]!=0 && "World not in use");
445 RM3World *world = worldsArray[worldId];
446
447 return world->connectionList[index];
448 }
449
450 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
451
452 Connection_RM3* ReplicaManager3::GetConnectionBySystemAddress(const SystemAddress &sa, WorldId worldId) const
453 {
454 RakAssert(worldsArray[worldId]!=0 && "World not in use");
455 RM3World *world = worldsArray[worldId];
456
457 unsigned int index;
458 for (index=0; index < world->connectionList.Size(); index++)
459 {
460 if (world->connectionList[index]->GetSystemAddress()==sa)
461 {
462 return world->connectionList[index];
463 }
464 }
465 return 0;
466 }
467
468 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
469
470 Connection_RM3* ReplicaManager3::GetConnectionByGUID(RakNetGUID guid, WorldId worldId) const
471 {
472 RakAssert(worldsArray[worldId]!=0 && "World not in use");
473 RM3World *world = worldsArray[worldId];
474
475 unsigned int index;
476 for (index=0; index < world->connectionList.Size(); index++)
477 {
478 if (world->connectionList[index]->GetRakNetGUID()==guid)
479 {
480 return world->connectionList[index];
481 }
482 }
483 return 0;
484 }
485
486 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
487
488 void ReplicaManager3::SetDefaultOrderingChannel(char def)
489 {
490 defaultSendParameters.orderingChannel=def;
491 }
492
493 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
494
495 void ReplicaManager3::SetDefaultPacketPriority(PacketPriority def)
496 {
497 defaultSendParameters.priority=def;
498 }
499
500 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
501
502 void ReplicaManager3::SetDefaultPacketReliability(PacketReliability def)
503 {
504 defaultSendParameters.reliability=def;
505 }
506
507 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
508
509 void ReplicaManager3::SetAutoSerializeInterval(SLNet::Time intervalMS)
510 {
511 autoSerializeInterval=intervalMS;
512 }
513
514 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
515
516 void ReplicaManager3::GetConnectionsThatHaveReplicaConstructed(Replica3 *replica, DataStructures::List<Connection_RM3*> &connectionsThatHaveConstructedThisReplica, WorldId worldId)
517 {
518 RakAssert(worldsArray[worldId]!=0 && "World not in use");
519 RM3World *world = worldsArray[worldId];
520
521 connectionsThatHaveConstructedThisReplica.Clear(false,_FILE_AND_LINE_);
522 unsigned int index;
523 for (index=0; index < world->connectionList.Size(); index++)
524 {
525 if (world->connectionList[index]->HasReplicaConstructed(replica))
526 connectionsThatHaveConstructedThisReplica.Push(world->connectionList[index],_FILE_AND_LINE_);
527 }
528 }
529
530 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
531
532 bool ReplicaManager3::GetAllConnectionDownloadsCompleted(WorldId worldId) const
533 {
534 RakAssert(worldsArray[worldId]!=0 && "World not in use");
535 RM3World *world = worldsArray[worldId];
536
537 unsigned int index;
538 for (index=0; index < world->connectionList.Size(); index++)
539 {
540 if (world->connectionList[index]->GetDownloadWasCompleted()==false)
541 return false;
542 }
543 return true;
544 }
545
546 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
547
548 void ReplicaManager3::Clear(bool deleteWorlds)
549 {
550 for (unsigned int i=0; i < worldsList.Size(); i++)
551 {
552 worldsList[i]->Clear(this);
553 if (deleteWorlds)
554 {
555 worldsArray[worldsList[i]->worldId]=0;
556 SLNet::OP_DELETE(worldsList[i], _FILE_AND_LINE_);
557 }
558 }
559 if (deleteWorlds)
560 worldsList.Clear(false, _FILE_AND_LINE_);
561 }
562
563 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
564
565 ReplicaManager3::RM3World::RM3World()
566 {
567 networkIDManager=0;
568 }
569
570 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
571
572 void ReplicaManager3::RM3World::Clear(ReplicaManager3 *replicaManager3)
573 {
574 if (replicaManager3->GetAutoDestroyConnections())
575 {
576 for (unsigned int i=0; i < connectionList.Size(); i++)
577 replicaManager3->DeallocConnection(connectionList[i]);
578 }
579 else
580 {
581 // Clear out downloadGroup even if not auto destroying the connection, since the packets need to go back to RakPeer
582 for (unsigned int i=0; i < connectionList.Size(); i++)
583 connectionList[i]->ClearDownloadGroup(replicaManager3->GetRakPeerInterface());
584 }
585
586 for (unsigned int i=0; i < userReplicaList.Size(); i++)
587 {
588 userReplicaList[i]->replicaManager=0;
589 userReplicaList[i]->SetNetworkIDManager(0);
590 }
591 connectionList.Clear(true,_FILE_AND_LINE_);
592 userReplicaList.Clear(true,_FILE_AND_LINE_);
593 }
594
595 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
596
597 PRO ReplicaManager3::GetDefaultSendParameters(void) const
598 {
599 return defaultSendParameters;
600 }
601
602 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
603
604 void ReplicaManager3::AddWorld(WorldId worldId)
605 {
606 RakAssert(worldsArray[worldId]==0 && "World already in use");
607
608 RM3World *newWorld = SLNet::OP_NEW<RM3World>(_FILE_AND_LINE_);
609 newWorld->worldId=worldId;
610 worldsArray[worldId]=newWorld;
611 worldsList.Push(newWorld,_FILE_AND_LINE_);
612 }
613
614 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
615
616 void ReplicaManager3::RemoveWorld(WorldId worldId)
617 {
618 RakAssert(worldsArray[worldId]!=0 && "World not in use");
619 for (unsigned int i=0; i < worldsList.Size(); i++)
620 {
621 if (worldsList[i]==worldsArray[worldId])
622 {
623 SLNet::OP_DELETE(worldsList[i],_FILE_AND_LINE_);
624 worldsList.RemoveAtIndexFast(i);
625 break;
626 }
627 }
628 worldsArray[worldId]=0;
629
630 }
631
632 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
633
634 NetworkIDManager *ReplicaManager3::GetNetworkIDManager(WorldId worldId) const
635 {
636 RakAssert(worldsArray[worldId]!=0 && "World not in use");
637 RM3World *world = worldsArray[worldId];
638
639 return world->networkIDManager;
640 }
641
642 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
643
644 void ReplicaManager3::SetNetworkIDManager(NetworkIDManager *_networkIDManager, WorldId worldId)
645 {
646 RakAssert(worldsArray[worldId]!=0 && "World not in use");
647 RM3World *world = worldsArray[worldId];
648
649 world->networkIDManager=_networkIDManager;
650 }
651
652 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
653
654 PluginReceiveResult ReplicaManager3::OnReceive(Packet *packet)
655 {
656 if (packet->length<2)
657 return RR_CONTINUE_PROCESSING;
658
659 WorldId incomingWorldId;
660
661 SLNet::Time timestamp=0;
662 unsigned char packetIdentifier, packetDataOffset;
663 if ( ( unsigned char ) packet->data[ 0 ] == ID_TIMESTAMP )
664 {
665 if ( packet->length > sizeof( unsigned char ) + sizeof(SLNet::Time ) )
666 {
667 packetIdentifier = ( unsigned char ) packet->data[ sizeof( unsigned char ) + sizeof(SLNet::Time ) ];
668 // Required for proper endian swapping
669 SLNet::BitStream tsBs(packet->data+sizeof(MessageID),packet->length-1,false);
670 tsBs.Read(timestamp);
671 // Next line assumes worldId is only 1 byte
672 RakAssert(sizeof(WorldId)==1);
673 incomingWorldId=packet->data[sizeof( unsigned char )*2 + sizeof(SLNet::Time )];
674 packetDataOffset=sizeof( unsigned char )*3 + sizeof(SLNet::Time );
675 }
676 else
677 return RR_STOP_PROCESSING_AND_DEALLOCATE;
678 }
679 else
680 {
681 packetIdentifier = ( unsigned char ) packet->data[ 0 ];
682 // Next line assumes worldId is only 1 byte
683 RakAssert(sizeof(WorldId)==1);
684 incomingWorldId=packet->data[sizeof( unsigned char )];
685 packetDataOffset=sizeof( unsigned char )*2;
686 }
687
688 if (worldsArray[incomingWorldId]==0)
689 return RR_CONTINUE_PROCESSING;
690
691 switch (packetIdentifier)
692 {
693 case ID_REPLICA_MANAGER_CONSTRUCTION:
694 return OnConstruction(packet, packet->data, packet->length, packet->guid, packetDataOffset, incomingWorldId);
695 case ID_REPLICA_MANAGER_SERIALIZE:
696 return OnSerialize(packet, packet->data, packet->length, packet->guid, timestamp, packetDataOffset, incomingWorldId);
697 case ID_REPLICA_MANAGER_DOWNLOAD_STARTED:
698 if (packet->wasGeneratedLocally==false)
699 {
700 return OnDownloadStarted(packet, packet->data, packet->length, packet->guid, packetDataOffset, incomingWorldId);
701 }
702 else
703 break;
704 case ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE:
705 if (packet->wasGeneratedLocally==false)
706 {
707 return OnDownloadComplete(packet, packet->data, packet->length, packet->guid, packetDataOffset, incomingWorldId);
708 }
709 else
710 break;
711 case ID_REPLICA_MANAGER_SCOPE_CHANGE:
712 {
713 Connection_RM3 *connection = GetConnectionByGUID(packet->guid, incomingWorldId);
714 if (connection && connection->isValidated==false)
715 {
716 // This connection is now confirmed bidirectional
717 connection->isValidated=true;
718 // Reply back on validation
719 connection->SendValidation(rakPeerInterface,incomingWorldId);
720 }
721 }
722 }
723
724 return RR_CONTINUE_PROCESSING;
725 }
726
727 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
728
729 void Connection_RM3::AutoConstructByQuery(ReplicaManager3 *replicaManager3, WorldId worldId)
730 {
731 ValidateLists(replicaManager3);
732
733 ConstructionMode curConstructionMode = QueryConstructionMode();
734
735 unsigned int index;
736 RM3ConstructionState constructionState;
737 LastSerializationResult *lsr;
738 index=0;
739
740 constructedReplicasCulled.Clear(false,_FILE_AND_LINE_);
741 destroyedReplicasCulled.Clear(false,_FILE_AND_LINE_);
742
743 if (curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION || curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION)
744 {
745 while (index < queryToConstructReplicaList.Size())
746 {
747 lsr=queryToConstructReplicaList[index];
748 constructionState=lsr->replica->QueryConstruction(this, replicaManager3);
749 if (constructionState==RM3CS_ALREADY_EXISTS_REMOTELY || constructionState==RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT)
750 {
751 OnReplicaAlreadyExists(index, replicaManager3);
752 if (constructionState==RM3CS_ALREADY_EXISTS_REMOTELY)
753 constructedReplicasCulled.Push(lsr->replica,_FILE_AND_LINE_);
754
755 /*
756 if (constructionState==RM3CS_ALREADY_EXISTS_REMOTELY)
757 {
758 // Serialize construction data to this connection
759 SLNet::BitStream bsOut;
760 bsOut.Write((MessageID)ID_REPLICA_MANAGER_3_SERIALIZE_CONSTRUCTION_EXISTING);
761 bsOut.Write(replicaManager3->GetWorldID());
762 NetworkID networkId;
763 networkId=lsr->replica->GetNetworkID();
764 bsOut.Write(networkId);
765 BitSize_t bitsWritten = bsOut.GetNumberOfBitsUsed();
766 lsr->replica->SerializeConstructionExisting(&bsOut, this);
767 if (bsOut.GetNumberOfBitsUsed()!=bitsWritten)
768 replicaManager3->SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,GetSystemAddress(), false);
769 }
770
771 // Serialize first serialization to this connection.
772 // This is done here, as it isn't done in PushConstruction
773 SerializeParameters sp;
774 SLNet::BitStream emptyBs;
775 for (index=0; index < (unsigned int) RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; index++)
776 {
777 sp.lastSentBitstream[index]=&emptyBs;
778 sp.pro[index]=replicaManager3->GetDefaultSendParameters();
779 }
780 sp.bitsWrittenSoFar=0;
781 sp.destinationConnection=this;
782 sp.messageTimestamp=0;
783 sp.whenLastSerialized=0;
784
785 SLNet::Replica3 *replica = lsr->replica;
786
787 RM3SerializationResult res = replica->Serialize(&sp);
788 if (res!=RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION &&
789 res!=RM3SR_DO_NOT_SERIALIZE &&
790 res!=RM3SR_SERIALIZED_UNIQUELY)
791 {
792 bool allIndices[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
793 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
794 {
795 sp.bitsWrittenSoFar+=sp.outputBitstream[z].GetNumberOfBitsUsed();
796 allIndices[z]=true;
797 }
798 if (SendSerialize(replica, allIndices, sp.outputBitstream, sp.messageTimestamp, sp.pro, replicaManager3->GetRakPeerInterface(), replicaManager3->GetWorldID())==SSICR_SENT_DATA)
799 lsr->replica->whenLastSerialized=SLNet::GetTimeMS();
800 }
801 */
802 }
803 else if (constructionState==RM3CS_SEND_CONSTRUCTION)
804 {
805 OnConstructToThisConnection(index, replicaManager3);
806 RakAssert(lsr->replica);
807 constructedReplicasCulled.Push(lsr->replica,_FILE_AND_LINE_);
808 }
809 else if (constructionState==RM3CS_NEVER_CONSTRUCT)
810 {
811 OnNeverConstruct(index, replicaManager3);
812 }
813 else// if (constructionState==RM3CS_NO_ACTION)
814 {
815 // Do nothing
816 index++;
817 }
818 }
819
820 if (curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION)
821 {
822 RM3DestructionState destructionState;
823 index=0;
824 while (index < queryToDestructReplicaList.Size())
825 {
826 lsr=queryToDestructReplicaList[index];
827 destructionState=lsr->replica->QueryDestruction(this, replicaManager3);
828 if (destructionState==RM3DS_SEND_DESTRUCTION)
829 {
830 OnSendDestructionFromQuery(index, replicaManager3);
831 destroyedReplicasCulled.Push(lsr->replica,_FILE_AND_LINE_);
832 }
833 else if (destructionState==RM3DS_DO_NOT_QUERY_DESTRUCTION)
834 {
835 OnDoNotQueryDestruction(index, replicaManager3);
836 }
837 else// if (destructionState==RM3CS_NO_ACTION)
838 {
839 // Do nothing
840 index++;
841 }
842 }
843 }
844 }
845 else if (curConstructionMode==QUERY_CONNECTION_FOR_REPLICA_LIST)
846 {
847 QueryReplicaList(constructedReplicasCulled,destroyedReplicasCulled);
848
849 unsigned int idx1, idx2;
850
851 // Create new
852 for (idx2=0; idx2 < constructedReplicasCulled.Size(); idx2++)
853 OnConstructToThisConnection(constructedReplicasCulled[idx2], replicaManager3);
854
855 bool exists;
856 for (idx2=0; idx2 < destroyedReplicasCulled.Size(); idx2++)
857 {
858 exists=false;
859 bool objectExists;
860 idx1=constructedReplicaList.GetIndexFromKey(destroyedReplicasCulled[idx2], &objectExists);
861 if (objectExists)
862 {
863 constructedReplicaList.RemoveAtIndex(idx1);
864
865 unsigned int j;
866 for (j=0; j < queryToSerializeReplicaList.Size(); j++)
867 {
868 if (queryToSerializeReplicaList[j]->replica==destroyedReplicasCulled[idx2] )
869 {
870 queryToSerializeReplicaList.RemoveAtIndex(j);
871 break;
872 }
873 }
874 }
875 }
876 }
877
878 SendConstruction(constructedReplicasCulled,destroyedReplicasCulled,replicaManager3->defaultSendParameters,replicaManager3->rakPeerInterface,worldId,replicaManager3);
879 }
880 void ReplicaManager3::Update(void)
881 {
882 unsigned int index,index2,index3;
883
884 WorldId worldId;
885 RM3World *world;
886 SLNet::Time time = SLNet::GetTime();
887
888 for (index3=0; index3 < worldsList.Size(); index3++)
889 {
890 world = worldsList[index3];
891 worldId = world->worldId;
892
893 for (index=0; index < world->connectionList.Size(); index++)
894 {
895 if (world->connectionList[index]->isValidated==false)
896 continue;
897 world->connectionList[index]->AutoConstructByQuery(this, worldId);
898 }
899 }
900
901 if (time - lastAutoSerializeOccurance >= autoSerializeInterval)
902 {
903 for (index3=0; index3 < worldsList.Size(); index3++)
904 {
905 world = worldsList[index3];
906 worldId = world->worldId;
907
908 for (index=0; index < world->userReplicaList.Size(); index++)
909 {
910 world->userReplicaList[index]->forceSendUntilNextUpdate=false;
911 world->userReplicaList[index]->OnUserReplicaPreSerializeTick();
912 }
913
914 SerializeParameters sp;
915 sp.curTime=time;
916 Connection_RM3 *connection;
917 SendSerializeIfChangedResult ssicr;
918 LastSerializationResult *lsr;
919
920 sp.messageTimestamp=0;
921 for (int i=0; i < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; i++)
922 sp.pro[i]=defaultSendParameters;
923 index2=0;
924 for (index=0; index < world->connectionList.Size(); index++)
925 {
926 connection = world->connectionList[index];
927 sp.bitsWrittenSoFar=0;
928 index2=0;
929 sp.destinationConnection=connection;
930
931 DataStructures::List<Replica3*> replicasToSerialize;
932 replicasToSerialize.Clear(true, _FILE_AND_LINE_);
933 if (connection->QuerySerializationList(replicasToSerialize))
934 {
935 // Update replica->lsr so we can lookup in the next block
936 // lsr is per connection / per replica
937 while (index2 < connection->queryToSerializeReplicaList.Size())
938 {
939 connection->queryToSerializeReplicaList[index2]->replica->lsr=connection->queryToSerializeReplicaList[index2];
940 index2++;
941 }
942
943
944 // User is manually specifying list of replicas to serialize
945 index2=0;
946 while (index2 < replicasToSerialize.Size())
947 {
948 lsr=replicasToSerialize[index2]->lsr;
949 RakAssert(lsr->replica==replicasToSerialize[index2]);
950
951 sp.whenLastSerialized=lsr->whenLastSerialized;
952 ssicr=connection->SendSerializeIfChanged(lsr, &sp, GetRakPeerInterface(), worldId, this, time);
953 if (ssicr==SSICR_SENT_DATA)
954 lsr->whenLastSerialized=time;
955 index2++;
956 }
957 }
958 else
959 {
960 while (index2 < connection->queryToSerializeReplicaList.Size())
961 {
962 lsr=connection->queryToSerializeReplicaList[index2];
963
964 sp.destinationConnection=connection;
965 sp.whenLastSerialized=lsr->whenLastSerialized;
966 ssicr=connection->SendSerializeIfChanged(lsr, &sp, GetRakPeerInterface(), worldId, this, time);
967 if (ssicr==SSICR_SENT_DATA)
968 {
969 lsr->whenLastSerialized=time;
970 index2++;
971 }
972 else if (ssicr==SSICR_NEVER_SERIALIZE)
973 {
974 // Removed from the middle of the list
975 }
976 else
977 index2++;
978 }
979 }
980 }
981 }
982
983 lastAutoSerializeOccurance=time;
984 }
985 }
986
987 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
988
989 void ReplicaManager3::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
990 {
991 (void) lostConnectionReason;
992 (void) systemAddress;
993 if (autoDestroyConnections)
994 {
995 Connection_RM3 *connection = PopConnection(rakNetGUID);
996 if (connection)
997 DeallocConnection(connection);
998 }
999 }
1000
1001 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1002
1003 void ReplicaManager3::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
1004 {
1005 (void) isIncoming;
1006 if (autoCreateConnections)
1007 {
1008 Connection_RM3 *connection = AllocConnection(systemAddress, rakNetGUID);
1009 if (connection)
1010 PushConnection(connection);
1011 }
1012 }
1013
1014 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1015
1016 void ReplicaManager3::OnRakPeerShutdown(void)
1017 {
1018 if (autoDestroyConnections)
1019 {
1020 RM3World *world;
1021 unsigned int index3;
1022 for (index3=0; index3 < worldsList.Size(); index3++)
1023 {
1024 world = worldsList[index3];
1025
1026 while (world->connectionList.Size())
1027 {
1028 Connection_RM3 *connection = PopConnection(world->connectionList.Size()-1, world->worldId);
1029 if (connection)
1030 DeallocConnection(connection);
1031 }
1032 }
1033 }
1034
1035
1036 Clear(false);
1037 }
1038
1039 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1040
1041 void ReplicaManager3::OnDetach(void)
1042 {
1043 OnRakPeerShutdown();
1044 }
1045
1046 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1047
1048 PluginReceiveResult ReplicaManager3::OnConstruction(Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId)
1049 {
1050 RM3World *world = worldsArray[worldId];
1051
1052 Connection_RM3 *connection = GetConnectionByGUID(senderGuid, worldId);
1053 if (connection==0)
1054 {
1055 // Almost certainly a bug
1056 RakAssert("Got OnConstruction but no connection yet" && 0);
1057 return RR_CONTINUE_PROCESSING;
1058 }
1059 if (connection->groupConstructionAndSerialize)
1060 {
1061 connection->downloadGroup.Push(packet, __FILE__, __LINE__);
1062 return RR_STOP_PROCESSING;
1063 }
1064
1065 SLNet::BitStream bsIn(packetData,packetDataLength,false);
1066 bsIn.IgnoreBytes(packetDataOffset);
1067 uint16_t constructionObjectListSize, destructionObjectListSize, index, index2;
1068 BitSize_t streamEnd, writeAllocationIDEnd;
1069 Replica3 *replica;
1070 NetworkID networkId;
1071 RakNetGUID creatingSystemGuid;
1072 bool actuallyCreateObject=false;
1073
1074 DataStructures::List<bool> actuallyCreateObjectList;
1075 DataStructures::List<Replica3*> constructionTickStack;
1076
1077 RakAssert(world->networkIDManager);
1078
1079 bsIn.Read(constructionObjectListSize);
1080 for (index=0; index < constructionObjectListSize; index++)
1081 {
1082 bsIn.Read(streamEnd);
1083 bsIn.Read(networkId);
1084 Replica3* existingReplica = world->networkIDManager->GET_OBJECT_FROM_ID<Replica3*>(networkId);
1085 bsIn.Read(actuallyCreateObject);
1086 actuallyCreateObjectList.Push(actuallyCreateObject, _FILE_AND_LINE_);
1087 bsIn.AlignReadToByteBoundary();
1088
1089 if (actuallyCreateObject)
1090 {
1091 bsIn.Read(creatingSystemGuid);
1092 bsIn.Read(writeAllocationIDEnd);
1093
1094 //printf("OnConstruction: %i\n",networkId.guid.g); // Removeme
1095 if (existingReplica)
1096 {
1097 existingReplica->replicaManager=this;
1098
1099 // Network ID already in use
1100 connection->OnDownloadExisting(existingReplica, this);
1101
1102 constructionTickStack.Push(0, _FILE_AND_LINE_);
1103 bsIn.SetReadOffset(streamEnd);
1104 continue;
1105 }
1106
1107 bsIn.AlignReadToByteBoundary();
1108 replica = connection->AllocReplica(&bsIn, this);
1109 if (replica==0)
1110 {
1111 constructionTickStack.Push(0, _FILE_AND_LINE_);
1112 bsIn.SetReadOffset(streamEnd);
1113 continue;
1114 }
1115
1116 // Go past the bitStream written to with WriteAllocationID(). Necessary in case the user didn't read out the bitStream the same way it was written
1117 // bitOffset2 is already aligned
1118 bsIn.SetReadOffset(writeAllocationIDEnd);
1119
1120 replica->SetNetworkIDManager(world->networkIDManager);
1121 replica->SetNetworkID(networkId);
1122
1123 replica->replicaManager=this;
1124 replica->creatingSystemGUID=creatingSystemGuid;
1125
1126 if (!replica->QueryRemoteConstruction(connection) ||
1127 !replica->DeserializeConstruction(&bsIn, connection))
1128 {
1129 DeallocReplicaNoBroadcastDestruction(connection, replica);
1130 bsIn.SetReadOffset(streamEnd);
1131 constructionTickStack.Push(0, _FILE_AND_LINE_);
1132 continue;
1133 }
1134
1135 constructionTickStack.Push(replica, _FILE_AND_LINE_);
1136
1137 // Register the replica
1138 ReferenceInternal(replica, worldId);
1139 }
1140 else
1141 {
1142 if (existingReplica)
1143 {
1144 existingReplica->DeserializeConstructionExisting(&bsIn, connection);
1145 constructionTickStack.Push(existingReplica, _FILE_AND_LINE_);
1146 }
1147 else
1148 {
1149 constructionTickStack.Push(0, _FILE_AND_LINE_);
1150 }
1151 }
1152
1153
1154 bsIn.SetReadOffset(streamEnd);
1155 bsIn.AlignReadToByteBoundary();
1156 }
1157
1158 RakAssert(constructionTickStack.Size()==constructionObjectListSize);
1159 RakAssert(actuallyCreateObjectList.Size()==constructionObjectListSize);
1160
1161 SLNet::BitStream empty;
1162 for (index=0; index < constructionObjectListSize; index++)
1163 {
1164 bool pdcWritten=false;
1165 bsIn.Read(pdcWritten);
1166 if (pdcWritten)
1167 {
1168 bsIn.AlignReadToByteBoundary();
1169 bsIn.Read(streamEnd);
1170 bsIn.Read(networkId);
1171 if (constructionTickStack[index]!=0)
1172 {
1173 bsIn.AlignReadToByteBoundary();
1174 if (actuallyCreateObjectList[index])
1175 constructionTickStack[index]->PostDeserializeConstruction(&bsIn, connection);
1176 else
1177 constructionTickStack[index]->PostDeserializeConstructionExisting(&bsIn, connection);
1178 }
1179 bsIn.SetReadOffset(streamEnd);
1180 }
1181 else
1182 {
1183 if (constructionTickStack[index]!=0)
1184 {
1185 if (actuallyCreateObjectList[index])
1186 constructionTickStack[index]->PostDeserializeConstruction(&empty, connection);
1187 else
1188 constructionTickStack[index]->PostDeserializeConstructionExisting(&empty, connection);
1189 }
1190 }
1191 }
1192 bsIn.AlignReadToByteBoundary();
1193
1194 for (index=0; index < constructionObjectListSize; index++)
1195 {
1196 if (constructionTickStack[index]!=0)
1197 {
1198 if (actuallyCreateObjectList[index])
1199 {
1200 // Tell the connection(s) that this object exists since they just sent it to us
1201 connection->OnDownloadFromThisSystem(constructionTickStack[index], this);
1202
1203 for (index2=0; index2 < world->connectionList.Size(); index2++)
1204 {
1205 if (world->connectionList[index2]!=connection)
1206 world->connectionList[index2]->OnDownloadFromOtherSystem(constructionTickStack[index], this);
1207 }
1208 }
1209 }
1210 }
1211
1212 // Destructions
1213 bool b = bsIn.Read(destructionObjectListSize);
1214 (void) b;
1215 RakAssert(b);
1216 for (index=0; index < destructionObjectListSize; index++)
1217 {
1218 bsIn.Read(networkId);
1219 bsIn.Read(streamEnd);
1220 replica = world->networkIDManager->GET_OBJECT_FROM_ID<Replica3*>(networkId);
1221 if (replica==0)
1222 {
1223 // Unknown object
1224 bsIn.SetReadOffset(streamEnd);
1225 continue;
1226 }
1227 bsIn.Read(replica->deletingSystemGUID);
1228 if (replica->DeserializeDestruction(&bsIn,connection))
1229 {
1230 // Make sure it wasn't deleted in DeserializeDestruction
1231 if (world->networkIDManager->GET_OBJECT_FROM_ID<Replica3*>(networkId))
1232 {
1233 replica->PreDestruction(connection);
1234
1235 // Forward deletion by remote system
1236 if (replica->QueryRelayDestruction(connection))
1237 BroadcastDestruction(replica,connection->GetSystemAddress());
1238 Dereference(replica);
1239 DeallocReplicaNoBroadcastDestruction(connection, replica);
1240 }
1241 }
1242 else
1243 {
1244 replica->PreDestruction(connection);
1245 connection->OnDereference(replica, this);
1246 }
1247
1248 bsIn.AlignReadToByteBoundary();
1249 }
1250 return RR_CONTINUE_PROCESSING;
1251 }
1252
1253 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1254
1255 PluginReceiveResult ReplicaManager3::OnSerialize(Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, SLNet::Time timestamp, unsigned char packetDataOffset, WorldId worldId)
1256 {
1257 Connection_RM3 *connection = GetConnectionByGUID(senderGuid, worldId);
1258 if (connection==0)
1259 return RR_CONTINUE_PROCESSING;
1260 if (connection->groupConstructionAndSerialize)
1261 {
1262 connection->downloadGroup.Push(packet, __FILE__, __LINE__);
1263 return RR_STOP_PROCESSING;
1264 }
1265
1266 RM3World *world = worldsArray[worldId];
1267 RakAssert(world->networkIDManager);
1268 SLNet::BitStream bsIn(packetData,packetDataLength,false);
1269 bsIn.IgnoreBytes(packetDataOffset);
1270
1271 struct DeserializeParameters ds;
1272 ds.timeStamp=timestamp;
1273 ds.sourceConnection=connection;
1274
1275 Replica3 *replica;
1276 NetworkID networkId;
1277 BitSize_t bitsUsed;
1278 bsIn.Read(networkId);
1279 //printf("OnSerialize: %i\n",networkId.guid.g); // Removeme
1280 replica = world->networkIDManager->GET_OBJECT_FROM_ID<Replica3*>(networkId);
1281 if (replica)
1282 {
1283 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
1284 {
1285 bsIn.Read(ds.bitstreamWrittenTo[z]);
1286 if (ds.bitstreamWrittenTo[z])
1287 {
1288 bsIn.ReadCompressed(bitsUsed);
1289 bsIn.AlignReadToByteBoundary();
1290 bsIn.Read(ds.serializationBitstream[z], bitsUsed);
1291 }
1292 }
1293 replica->Deserialize(&ds);
1294 }
1295 return RR_CONTINUE_PROCESSING;
1296 }
1297 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1298
1299 PluginReceiveResult ReplicaManager3::OnDownloadStarted(Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId)
1300 {
1301 Connection_RM3 *connection = GetConnectionByGUID(senderGuid, worldId);
1302 if (connection==0)
1303 return RR_CONTINUE_PROCESSING;
1304 if (connection->QueryGroupDownloadMessages() &&
1305 // ID_DOWNLOAD_STARTED will be processed twice, being processed the second time once ID_DOWNLOAD_COMPLETE arrives.
1306 // However, the second time groupConstructionAndSerialize will be set to true so it won't be processed a third time
1307 connection->groupConstructionAndSerialize==false
1308 )
1309 {
1310 // These messages will be held by the plugin and returned when the download is complete
1311 connection->groupConstructionAndSerialize=true;
1312 RakAssert(connection->downloadGroup.Size()==0);
1313 connection->downloadGroup.Push(packet, __FILE__, __LINE__);
1314 return RR_STOP_PROCESSING;
1315 }
1316
1317 connection->groupConstructionAndSerialize=false;
1318 SLNet::BitStream bsIn(packetData,packetDataLength,false);
1319 bsIn.IgnoreBytes(packetDataOffset);
1320 connection->DeserializeOnDownloadStarted(&bsIn);
1321 return RR_CONTINUE_PROCESSING;
1322 }
1323
1324 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1325
1326 PluginReceiveResult ReplicaManager3::OnDownloadComplete(Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId)
1327 {
1328 Connection_RM3 *connection = GetConnectionByGUID(senderGuid, worldId);
1329 if (connection==0)
1330 return RR_CONTINUE_PROCESSING;
1331
1332 if (connection->groupConstructionAndSerialize==true && connection->downloadGroup.Size()>0)
1333 {
1334 // Push back buffered packets in front of this one
1335 unsigned int i;
1336 for (i=0; i < connection->downloadGroup.Size(); i++)
1337 rakPeerInterface->PushBackPacket(connection->downloadGroup[i],false);
1338
1339 // Push this one to be last too. It will be processed again, but the second time
1340 // groupConstructionAndSerialize will be false and downloadGroup will be empty, so it will go past this block
1341 connection->downloadGroup.Clear(__FILE__,__LINE__);
1342 rakPeerInterface->PushBackPacket(packet,false);
1343
1344 return RR_STOP_PROCESSING;
1345 }
1346
1347 SLNet::BitStream bsIn(packetData,packetDataLength,false);
1348 bsIn.IgnoreBytes(packetDataOffset);
1349 connection->gotDownloadComplete=true;
1350 connection->DeserializeOnDownloadComplete(&bsIn);
1351 return RR_CONTINUE_PROCESSING;
1352 }
1353
1354 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1355
1356 Replica3* ReplicaManager3::GetReplicaByNetworkID(NetworkID networkId, WorldId worldId)
1357 {
1358 RM3World *world = worldsArray[worldId];
1359
1360 unsigned int i;
1361 for (i=0; i < world->userReplicaList.Size(); i++)
1362 {
1363 if (world->userReplicaList[i]->GetNetworkID()==networkId)
1364 return world->userReplicaList[i];
1365 }
1366 return 0;
1367 }
1368
1369
1370 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1371
1372
1373 void ReplicaManager3::BroadcastDestructionList(DataStructures::List<Replica3*> &replicaListSource, const SystemAddress &exclusionAddress, WorldId worldId)
1374 {
1375 SLNet::BitStream bsOut;
1376 unsigned int i,j;
1377
1378 RakAssert(worldsArray[worldId]!=0 && "World not in use");
1379 RM3World *world = worldsArray[worldId];
1380
1381 DataStructures::List<Replica3*> replicaList;
1382
1383 for (i=0; i < replicaListSource.Size(); i++)
1384 {
1385 if (replicaListSource[i]==currentlyDeallocatingReplica)
1386 continue;
1387 replicaList.Push(replicaListSource[i], __FILE__, __LINE__);
1388 }
1389
1390 if (replicaList.Size()==0)
1391 return;
1392
1393 for (i=0; i < replicaList.Size(); i++)
1394 {
1395 if (replicaList[i]->deletingSystemGUID==UNASSIGNED_RAKNET_GUID)
1396 replicaList[i]->deletingSystemGUID=GetRakPeerInterface()->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
1397 }
1398
1399 for (j=0; j < world->connectionList.Size(); j++)
1400 {
1401 if (world->connectionList[j]->GetSystemAddress()==exclusionAddress)
1402 continue;
1403
1404 bsOut.Reset();
1405 bsOut.Write((MessageID)ID_REPLICA_MANAGER_CONSTRUCTION);
1406 bsOut.Write(worldId);
1407 uint16_t cnt=0;
1408 bsOut.Write(cnt); // No construction
1409 cnt=(uint16_t) replicaList.Size();
1410 BitSize_t cntOffset=bsOut.GetWriteOffset();;
1411 bsOut.Write(cnt); // Overwritten at send call
1412 cnt=0;
1413
1414 for (i=0; i < replicaList.Size(); i++)
1415 {
1416 if (world->connectionList[j]->HasReplicaConstructed(replicaList[i])==false)
1417 continue;
1418 cnt++;
1419
1420 NetworkID networkId;
1421 networkId=replicaList[i]->GetNetworkID();
1422 bsOut.Write(networkId);
1423 BitSize_t offsetStart, offsetEnd;
1424 offsetStart=bsOut.GetWriteOffset();
1425 bsOut.Write(offsetStart);
1426 bsOut.Write(replicaList[i]->deletingSystemGUID);
1427 replicaList[i]->SerializeDestruction(&bsOut, world->connectionList[j]);
1428 bsOut.AlignWriteToByteBoundary();
1429 offsetEnd=bsOut.GetWriteOffset();
1430 bsOut.SetWriteOffset(offsetStart);
1431 bsOut.Write(offsetEnd);
1432 bsOut.SetWriteOffset(offsetEnd);
1433 }
1434
1435 if (cnt>0)
1436 {
1437 BitSize_t curOffset=bsOut.GetWriteOffset();
1438 bsOut.SetWriteOffset(cntOffset);
1439 bsOut.Write(cnt);
1440 bsOut.SetWriteOffset(curOffset);
1441 rakPeerInterface->Send(&bsOut,defaultSendParameters.priority,defaultSendParameters.reliability,defaultSendParameters.orderingChannel,world->connectionList[j]->GetSystemAddress(),false, defaultSendParameters.sendReceipt);
1442 }
1443 }
1444 }
1445
1446 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1447
1448
1449 void ReplicaManager3::BroadcastDestruction(Replica3 *replica, const SystemAddress &exclusionAddress)
1450 {
1451 DataStructures::List<Replica3*> replicaList;
1452 replicaList.Push(replica, _FILE_AND_LINE_ );
1453 BroadcastDestructionList(replicaList,exclusionAddress);
1454 }
1455
1456 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1457
1458
1459 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1460
1461 Connection_RM3::Connection_RM3(const SystemAddress &_systemAddress, RakNetGUID _guid)
1462 : systemAddress(_systemAddress), guid(_guid)
1463 {
1464 isValidated=false;
1465 isFirstConstruction=true;
1466 groupConstructionAndSerialize=false;
1467 gotDownloadComplete=false;
1468 }
1469
1470 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1471
1472 Connection_RM3::~Connection_RM3()
1473 {
1474 unsigned int i;
1475 for (i=0; i < constructedReplicaList.Size(); i++)
1476 SLNet::OP_DELETE(constructedReplicaList[i], _FILE_AND_LINE_);
1477 for (i=0; i < queryToConstructReplicaList.Size(); i++)
1478 SLNet::OP_DELETE(queryToConstructReplicaList[i], _FILE_AND_LINE_);
1479 }
1480
1481 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1482
1483 void Connection_RM3::GetConstructedReplicas(DataStructures::List<Replica3*> &objectsTheyDoHave)
1484 {
1485 objectsTheyDoHave.Clear(true,_FILE_AND_LINE_);
1486 for (unsigned int idx=0; idx < constructedReplicaList.Size(); idx++)
1487 {
1488 objectsTheyDoHave.Push(constructedReplicaList[idx]->replica, _FILE_AND_LINE_ );
1489 }
1490 }
1491
1492 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1493
1494 bool Connection_RM3::HasReplicaConstructed(SLNet::Replica3 *replica)
1495 {
1496 bool objectExists;
1497 constructedReplicaList.GetIndexFromKey(replica, &objectExists);
1498 return objectExists;
1499 }
1500
1501 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1502 void Connection_RM3::SendSerializeHeader(SLNet::Replica3 *replica, SLNet::Time timestamp, SLNet::BitStream *bs, WorldId worldId)
1503 {
1504 bs->Reset();
1505
1506 if (timestamp!=0)
1507 {
1508 bs->Write((MessageID)ID_TIMESTAMP);
1509 bs->Write(timestamp);
1510 }
1511 bs->Write((MessageID)ID_REPLICA_MANAGER_SERIALIZE);
1512 bs->Write(worldId);
1513 bs->Write(replica->GetNetworkID());
1514 }
1515 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1516 void Connection_RM3::ClearDownloadGroup(RakPeerInterface *rakPeerInterface)
1517 {
1518 unsigned int i;
1519 for (i=0; i < downloadGroup.Size(); i++)
1520 rakPeerInterface->DeallocatePacket(downloadGroup[i]);
1521 downloadGroup.Clear(__FILE__,__LINE__);
1522 }
1523 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1524 SendSerializeIfChangedResult Connection_RM3::SendSerialize(SLNet::Replica3 *replica, bool indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::BitStream serializationData[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time timestamp, PRO sendParameters[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], RakPeerInterface *rakPeer, unsigned char worldId, SLNet::Time curTime)
1525 {
1526 bool channelHasData;
1527 BitSize_t sum=0;
1528 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
1529 {
1530 if (indicesToSend[z])
1531 sum+=serializationData[z].GetNumberOfBitsUsed();
1532 }
1533
1534 SLNet::BitStream out;
1535 BitSize_t bitsPerChannel[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
1536
1537 if (sum==0)
1538 {
1539 memset(bitsPerChannel, 0, sizeof(bitsPerChannel));
1540 replica->OnSerializeTransmission(&out, this, bitsPerChannel, curTime);
1541 return SSICR_DID_NOT_SEND_DATA;
1542 }
1543
1544 RakAssert(replica->GetNetworkID()!=UNASSIGNED_NETWORK_ID);
1545
1546 BitSize_t bitsUsed;
1547
1548 int channelIndex;
1549 PRO lastPro=sendParameters[0];
1550
1551 for (channelIndex=0; channelIndex < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; channelIndex++)
1552 {
1553 if (channelIndex==0)
1554 {
1555 SendSerializeHeader(replica, timestamp, &out, worldId);
1556 }
1557 else if (lastPro!=sendParameters[channelIndex])
1558 {
1559 // Write out remainder
1560 for (int channelIndex2=channelIndex; channelIndex2 < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; channelIndex2++)
1561 {
1562 bitsPerChannel[channelIndex2]=0;
1563 out.Write(false);
1564 }
1565
1566 // Send remainder
1567 replica->OnSerializeTransmission(&out, this, bitsPerChannel, curTime);
1568 rakPeer->Send(&out,lastPro.priority,lastPro.reliability,lastPro.orderingChannel,systemAddress,false,lastPro.sendReceipt);
1569
1570 // If no data left to send, quit out
1571 bool anyData=false;
1572 for (int channelIndex2=channelIndex; channelIndex2 < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; channelIndex2++)
1573 {
1574 if (serializationData[channelIndex2].GetNumberOfBitsUsed()>0)
1575 {
1576 anyData=true;
1577 break;
1578 }
1579 }
1580 if (anyData==false)
1581 return SSICR_SENT_DATA;
1582
1583 // Restart stream
1584 SendSerializeHeader(replica, timestamp, &out, worldId);
1585
1586 for (int channelIndex2=0; channelIndex2 < channelIndex; channelIndex2++)
1587 {
1588 bitsPerChannel[channelIndex2]=0;
1589 out.Write(false);
1590 }
1591 lastPro=sendParameters[channelIndex];
1592 }
1593
1594 bitsUsed=serializationData[channelIndex].GetNumberOfBitsUsed();
1595 channelHasData = indicesToSend[channelIndex]==true && bitsUsed>0;
1596 out.Write(channelHasData);
1597 if (channelHasData)
1598 {
1599 bitsPerChannel[channelIndex] = bitsUsed;
1600 out.WriteCompressed(bitsUsed);
1601 out.AlignWriteToByteBoundary();
1602 out.Write(serializationData[channelIndex]);
1603 // Crap, forgot this line, was a huge bug in that I'd only send to the first 3 systems
1604 serializationData[channelIndex].ResetReadPointer();
1605 }
1606 else
1607 {
1608 bitsPerChannel[channelIndex] = 0;
1609 }
1610 }
1611 replica->OnSerializeTransmission(&out, this, bitsPerChannel, curTime);
1612 rakPeer->Send(&out,lastPro.priority,lastPro.reliability,lastPro.orderingChannel,systemAddress,false,lastPro.sendReceipt);
1613 return SSICR_SENT_DATA;
1614 }
1615
1616 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1617
1618 SendSerializeIfChangedResult Connection_RM3::SendSerializeIfChanged(LastSerializationResult *lsr, SerializeParameters *sp, SLNet::RakPeerInterface *rakPeer, unsigned char worldId, ReplicaManager3 *replicaManager, SLNet::Time curTime)
1619 {
1620 SLNet::Replica3 *replica = lsr->replica;
1621
1622 if (replica->GetNetworkID()==UNASSIGNED_NETWORK_ID)
1623 return SSICR_DID_NOT_SEND_DATA;
1624
1625 RM3QuerySerializationResult rm3qsr = replica->QuerySerialization(this);
1626 if (rm3qsr==RM3QSR_NEVER_CALL_SERIALIZE)
1627 {
1628 // Never again for this connection and replica pair
1629 OnNeverSerialize(lsr, replicaManager);
1630 return SSICR_NEVER_SERIALIZE;
1631 }
1632
1633 if (rm3qsr==RM3QSR_DO_NOT_CALL_SERIALIZE)
1634 return SSICR_DID_NOT_SEND_DATA;
1635
1636 if (replica->forceSendUntilNextUpdate)
1637 {
1638 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
1639 {
1640 if (replica->lastSentSerialization.indicesToSend[z])
1641 sp->bitsWrittenSoFar+=replica->lastSentSerialization.bitStream[z].GetNumberOfBitsUsed();
1642 }
1643 return SendSerialize(replica, replica->lastSentSerialization.indicesToSend, replica->lastSentSerialization.bitStream, sp->messageTimestamp, sp->pro, rakPeer, worldId, curTime);
1644 }
1645
1646 for (int i=0; i < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; i++)
1647 {
1648 sp->outputBitstream[i].Reset();
1649 if (lsr->lastSerializationResultBS)
1650 sp->lastSentBitstream[i]=&lsr->lastSerializationResultBS->bitStream[i];
1651 else
1652 sp->lastSentBitstream[i]=&replica->lastSentSerialization.bitStream[i];
1653 }
1654
1655 RM3SerializationResult serializationResult = replica->Serialize(sp);
1656
1657 if (serializationResult==RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION)
1658 {
1659 // Never again for this connection and replica pair
1660 OnNeverSerialize(lsr, replicaManager);
1661 return SSICR_NEVER_SERIALIZE;
1662 }
1663
1664 if (serializationResult==RM3SR_DO_NOT_SERIALIZE)
1665 {
1666 // Don't serialize this tick only
1667 return SSICR_DID_NOT_SEND_DATA;
1668 }
1669
1670 // This is necessary in case the user in the Serialize() function for some reason read the bitstream they also wrote
1671 // WIthout this code, the Write calls to another bitstream would not write the entire bitstream
1672 BitSize_t sum=0;
1673 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
1674 {
1675 sp->outputBitstream[z].ResetReadPointer();
1676 sum+=sp->outputBitstream[z].GetNumberOfBitsUsed();
1677 }
1678
1679 if (sum==0)
1680 {
1681 // Don't serialize this tick only
1682 return SSICR_DID_NOT_SEND_DATA;
1683 }
1684
1685 if (serializationResult==RM3SR_SERIALIZED_ALWAYS)
1686 {
1687 bool allIndices[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
1688 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
1689 {
1690 sp->bitsWrittenSoFar+=sp->outputBitstream[z].GetNumberOfBitsUsed();
1691 allIndices[z]=true;
1692
1693 lsr->AllocBS();
1694 lsr->lastSerializationResultBS->bitStream[z].Reset();
1695 lsr->lastSerializationResultBS->bitStream[z].Write(&sp->outputBitstream[z]);
1696 sp->outputBitstream[z].ResetReadPointer();
1697 }
1698 return SendSerialize(replica, allIndices, sp->outputBitstream, sp->messageTimestamp, sp->pro, rakPeer, worldId, curTime);
1699 }
1700
1701 if (serializationResult==RM3SR_SERIALIZED_ALWAYS_IDENTICALLY)
1702 {
1703 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
1704 {
1705 replica->lastSentSerialization.indicesToSend[z]=sp->outputBitstream[z].GetNumberOfBitsUsed()>0;
1706 sp->bitsWrittenSoFar+=sp->outputBitstream[z].GetNumberOfBitsUsed();
1707 replica->lastSentSerialization.bitStream[z].Reset();
1708 replica->lastSentSerialization.bitStream[z].Write(&sp->outputBitstream[z]);
1709 sp->outputBitstream[z].ResetReadPointer();
1710 replica->forceSendUntilNextUpdate=true;
1711 }
1712 return SendSerialize(replica, replica->lastSentSerialization.indicesToSend, sp->outputBitstream, sp->messageTimestamp, sp->pro, rakPeer, worldId, curTime);
1713 }
1714
1715 bool indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
1716 if (serializationResult==RM3SR_BROADCAST_IDENTICALLY || serializationResult==RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION)
1717 {
1718 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
1719 {
1720 if (sp->outputBitstream[z].GetNumberOfBitsUsed() > 0 &&
1721 (serializationResult==RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION ||
1722 ((sp->outputBitstream[z].GetNumberOfBitsUsed()!=replica->lastSentSerialization.bitStream[z].GetNumberOfBitsUsed() ||
1723 memcmp(sp->outputBitstream[z].GetData(), replica->lastSentSerialization.bitStream[z].GetData(), sp->outputBitstream[z].GetNumberOfBytesUsed())!=0))))
1724 {
1725 indicesToSend[z]=true;
1726 replica->lastSentSerialization.indicesToSend[z]=true;
1727 sp->bitsWrittenSoFar+=sp->outputBitstream[z].GetNumberOfBitsUsed();
1728 replica->lastSentSerialization.bitStream[z].Reset();
1729 replica->lastSentSerialization.bitStream[z].Write(&sp->outputBitstream[z]);
1730 sp->outputBitstream[z].ResetReadPointer();
1731 replica->forceSendUntilNextUpdate=true;
1732 }
1733 else
1734 {
1735 indicesToSend[z]=false;
1736 replica->lastSentSerialization.indicesToSend[z]=false;
1737 }
1738 }
1739 }
1740 else
1741 {
1742 lsr->AllocBS();
1743
1744 // RM3SR_SERIALIZED_UNIQUELY
1745 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
1746 {
1747 if (sp->outputBitstream[z].GetNumberOfBitsUsed() > 0 &&
1748 (sp->outputBitstream[z].GetNumberOfBitsUsed()!=lsr->lastSerializationResultBS->bitStream[z].GetNumberOfBitsUsed() ||
1749 memcmp(sp->outputBitstream[z].GetData(), lsr->lastSerializationResultBS->bitStream[z].GetData(), sp->outputBitstream[z].GetNumberOfBytesUsed())!=0)
1750 )
1751 {
1752 indicesToSend[z]=true;
1753 sp->bitsWrittenSoFar+=sp->outputBitstream[z].GetNumberOfBitsUsed();
1754 lsr->lastSerializationResultBS->bitStream[z].Reset();
1755 lsr->lastSerializationResultBS->bitStream[z].Write(&sp->outputBitstream[z]);
1756 sp->outputBitstream[z].ResetReadPointer();
1757 }
1758 else
1759 {
1760 indicesToSend[z]=false;
1761 }
1762 }
1763 }
1764
1765
1766 if (serializationResult==RM3SR_BROADCAST_IDENTICALLY || serializationResult==RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION)
1767 replica->forceSendUntilNextUpdate=true;
1768
1769 // Send out the data
1770 return SendSerialize(replica, indicesToSend, sp->outputBitstream, sp->messageTimestamp, sp->pro, rakPeer, worldId, curTime);
1771 }
1772
1773 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1774 void Connection_RM3::OnLocalReference(Replica3* replica3, ReplicaManager3 *replicaManager)
1775 {
1776 ConstructionMode curConstructionMode = QueryConstructionMode();
1777 RakAssert(curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION || curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION);
1778 RakAssert(replica3);
1779 (void) replicaManager;
1780 (void) curConstructionMode;
1781
1782 #ifdef _DEBUG
1783 for (unsigned int i=0; i < queryToConstructReplicaList.Size(); i++)
1784 {
1785 if (queryToConstructReplicaList[i]->replica==replica3)
1786 {
1787 RakAssert("replica added twice to queryToConstructReplicaList" && 0);
1788 }
1789 }
1790
1791 if (constructedReplicaList.HasData(replica3)==true)
1792 {
1793 RakAssert("replica added to queryToConstructReplicaList when already in constructedReplicaList" && 0);
1794 }
1795 #endif
1796
1797 LastSerializationResult* lsr= SLNet::OP_NEW<LastSerializationResult>(_FILE_AND_LINE_);
1798 lsr->replica=replica3;
1799 queryToConstructReplicaList.Push(lsr,_FILE_AND_LINE_);
1800 }
1801
1802 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1803
1804 void Connection_RM3::OnDereference(Replica3* replica3, ReplicaManager3 *replicaManager)
1805 {
1806 ValidateLists(replicaManager);
1807
1808 if (replica3->GetNetworkIDManager() == 0)
1809 return;
1810
1811 LastSerializationResult* lsr=0;
1812 unsigned int idx;
1813
1814 bool objectExists;
1815 idx=constructedReplicaList.GetIndexFromKey(replica3, &objectExists);
1816 if (objectExists)
1817 {
1818 lsr=constructedReplicaList[idx];
1819 constructedReplicaList.RemoveAtIndex(idx);
1820 }
1821
1822 for (idx=0; idx < queryToConstructReplicaList.Size(); idx++)
1823 {
1824 if (queryToConstructReplicaList[idx]->replica==replica3)
1825 {
1826 lsr=queryToConstructReplicaList[idx];
1827 queryToConstructReplicaList.RemoveAtIndex(idx);
1828 break;
1829 }
1830 }
1831
1832 for (idx=0; idx < queryToSerializeReplicaList.Size(); idx++)
1833 {
1834 if (queryToSerializeReplicaList[idx]->replica==replica3)
1835 {
1836 lsr=queryToSerializeReplicaList[idx];
1837 queryToSerializeReplicaList.RemoveAtIndex(idx);
1838 break;
1839 }
1840 }
1841
1842 for (idx=0; idx < queryToDestructReplicaList.Size(); idx++)
1843 {
1844 if (queryToDestructReplicaList[idx]->replica==replica3)
1845 {
1846 lsr=queryToDestructReplicaList[idx];
1847 queryToDestructReplicaList.RemoveAtIndex(idx);
1848 break;
1849 }
1850 }
1851
1852 ValidateLists(replicaManager);
1853
1854 if (lsr)
1855 SLNet::OP_DELETE(lsr,_FILE_AND_LINE_);
1856
1857 ValidateLists(replicaManager);
1858 }
1859
1860 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1861
1862 void Connection_RM3::OnDownloadFromThisSystem(Replica3* replica3, ReplicaManager3 *replicaManager)
1863 {
1864 RakAssert(replica3);
1865
1866 ValidateLists(replicaManager);
1867 LastSerializationResult* lsr= SLNet::OP_NEW<LastSerializationResult>(_FILE_AND_LINE_);
1868 lsr->replica=replica3;
1869
1870 ConstructionMode curConstructionMode = QueryConstructionMode();
1871 if (curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION || curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION)
1872 {
1873 unsigned int j;
1874 for (j=0; j < queryToConstructReplicaList.Size(); j++)
1875 {
1876 if (queryToConstructReplicaList[j]->replica==replica3 )
1877 {
1878 queryToConstructReplicaList.RemoveAtIndex(j);
1879 break;
1880 }
1881 }
1882
1883 queryToDestructReplicaList.Push(lsr,_FILE_AND_LINE_);
1884 }
1885
1886 if (constructedReplicaList.Insert(lsr->replica, lsr, true, _FILE_AND_LINE_) != (unsigned) -1)
1887 {
1888 //assert(queryToSerializeReplicaList.GetIndexOf(replica3)==(unsigned int)-1);
1889 queryToSerializeReplicaList.Push(lsr,_FILE_AND_LINE_);
1890 }
1891
1892 ValidateLists(replicaManager);
1893 }
1894
1895 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1896
1897 void Connection_RM3::OnDownloadFromOtherSystem(Replica3* replica3, ReplicaManager3 *replicaManager)
1898 {
1899 ConstructionMode curConstructionMode = QueryConstructionMode();
1900 if (curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION || curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION)
1901 {
1902 unsigned int j;
1903 for (j=0; j < queryToConstructReplicaList.Size(); j++)
1904 {
1905 if (queryToConstructReplicaList[j]->replica==replica3 )
1906 {
1907 return;
1908 }
1909 }
1910
1911 OnLocalReference(replica3, replicaManager);
1912 }
1913 }
1914
1915 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1916
1917 void Connection_RM3::OnNeverConstruct(unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager)
1918 {
1919 ConstructionMode curConstructionMode = QueryConstructionMode();
1920 RakAssert(curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION || curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION);
1921 (void) curConstructionMode;
1922
1923 ValidateLists(replicaManager);
1924 LastSerializationResult* lsr = queryToConstructReplicaList[queryToConstructIdx];
1925 queryToConstructReplicaList.RemoveAtIndex(queryToConstructIdx);
1926 SLNet::OP_DELETE(lsr,_FILE_AND_LINE_);
1927 ValidateLists(replicaManager);
1928 }
1929
1930 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1931
1932 void Connection_RM3::OnConstructToThisConnection(unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager)
1933 {
1934 ConstructionMode curConstructionMode = QueryConstructionMode();
1935 RakAssert(curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION || curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION);
1936 (void) curConstructionMode;
1937
1938 ValidateLists(replicaManager);
1939 LastSerializationResult* lsr = queryToConstructReplicaList[queryToConstructIdx];
1940 queryToConstructReplicaList.RemoveAtIndex(queryToConstructIdx);
1941 //assert(constructedReplicaList.GetIndexOf(lsr->replica)==(unsigned int)-1);
1942 constructedReplicaList.Insert(lsr->replica,lsr,true,_FILE_AND_LINE_);
1943 //assert(queryToDestructReplicaList.GetIndexOf(lsr->replica)==(unsigned int)-1);
1944 queryToDestructReplicaList.Push(lsr,_FILE_AND_LINE_);
1945 //assert(queryToSerializeReplicaList.GetIndexOf(lsr->replica)==(unsigned int)-1);
1946 queryToSerializeReplicaList.Push(lsr,_FILE_AND_LINE_);
1947 ValidateLists(replicaManager);
1948 }
1949
1950 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1951
1952 void Connection_RM3::OnConstructToThisConnection(Replica3 *replica, ReplicaManager3 *replicaManager)
1953 {
1954 RakAssert(replica);
1955 RakAssert(QueryConstructionMode()==QUERY_CONNECTION_FOR_REPLICA_LIST);
1956 (void) replicaManager;
1957
1958 LastSerializationResult* lsr= SLNet::OP_NEW<LastSerializationResult>(_FILE_AND_LINE_);
1959 lsr->replica=replica;
1960 constructedReplicaList.Insert(replica,lsr,true,_FILE_AND_LINE_);
1961 queryToSerializeReplicaList.Push(lsr,_FILE_AND_LINE_);
1962 }
1963
1964 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1965
1966 void Connection_RM3::OnNeverSerialize(LastSerializationResult *lsr, ReplicaManager3 *replicaManager)
1967 {
1968 ValidateLists(replicaManager);
1969
1970 unsigned int j;
1971 for (j=0; j < queryToSerializeReplicaList.Size(); j++)
1972 {
1973 if (queryToSerializeReplicaList[j]==lsr )
1974 {
1975 queryToSerializeReplicaList.RemoveAtIndex(j);
1976 break;
1977 }
1978 }
1979
1980 ValidateLists(replicaManager);
1981 }
1982
1983 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1984
1985 void Connection_RM3::OnReplicaAlreadyExists(unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager)
1986 {
1987 ConstructionMode curConstructionMode = QueryConstructionMode();
1988 RakAssert(curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION || curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION);
1989 (void) curConstructionMode;
1990
1991 ValidateLists(replicaManager);
1992 LastSerializationResult* lsr = queryToConstructReplicaList[queryToConstructIdx];
1993 queryToConstructReplicaList.RemoveAtIndex(queryToConstructIdx);
1994 //assert(constructedReplicaList.GetIndexOf(lsr->replica)==(unsigned int)-1);
1995 constructedReplicaList.Insert(lsr->replica,lsr,true,_FILE_AND_LINE_);
1996 //assert(queryToDestructReplicaList.GetIndexOf(lsr->replica)==(unsigned int)-1);
1997 queryToDestructReplicaList.Push(lsr,_FILE_AND_LINE_);
1998 //assert(queryToSerializeReplicaList.GetIndexOf(lsr->replica)==(unsigned int)-1);
1999 queryToSerializeReplicaList.Push(lsr,_FILE_AND_LINE_);
2000 ValidateLists(replicaManager);
2001 }
2002
2003 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2004
2005 void Connection_RM3::OnDownloadExisting(Replica3* replica3, ReplicaManager3 *replicaManager)
2006 {
2007 ValidateLists(replicaManager);
2008
2009 ConstructionMode curConstructionMode = QueryConstructionMode();
2010 if (curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION || curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION)
2011 {
2012 unsigned int idx;
2013 for (idx=0; idx < queryToConstructReplicaList.Size(); idx++)
2014 {
2015 if (queryToConstructReplicaList[idx]->replica==replica3)
2016 {
2017 OnConstructToThisConnection(idx, replicaManager);
2018 return;
2019 }
2020 }
2021 }
2022 else
2023 {
2024 OnConstructToThisConnection(replica3, replicaManager);
2025 }
2026 }
2027 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2028
2029 void Connection_RM3::OnSendDestructionFromQuery(unsigned int queryToDestructIdx, ReplicaManager3 *replicaManager)
2030 {
2031 ConstructionMode curConstructionMode = QueryConstructionMode();
2032 RakAssert(curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION || curConstructionMode==QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION);
2033 (void) curConstructionMode;
2034
2035 ValidateLists(replicaManager);
2036 LastSerializationResult* lsr = queryToDestructReplicaList[queryToDestructIdx];
2037 queryToDestructReplicaList.RemoveAtIndex(queryToDestructIdx);
2038 unsigned int j;
2039 for (j=0; j < queryToSerializeReplicaList.Size(); j++)
2040 {
2041 if (queryToSerializeReplicaList[j]->replica==lsr->replica )
2042 {
2043 queryToSerializeReplicaList.RemoveAtIndex(j);
2044 break;
2045 }
2046 }
2047 for (j=0; j < constructedReplicaList.Size(); j++)
2048 {
2049 if (constructedReplicaList[j]->replica==lsr->replica )
2050 {
2051 constructedReplicaList.RemoveAtIndex(j);
2052 break;
2053 }
2054 }
2055 //assert(queryToConstructReplicaList.GetIndexOf(lsr->replica)==(unsigned int)-1);
2056 queryToConstructReplicaList.Push(lsr,_FILE_AND_LINE_);
2057 ValidateLists(replicaManager);
2058 }
2059
2060 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2061
2062 void Connection_RM3::OnDoNotQueryDestruction(unsigned int queryToDestructIdx, ReplicaManager3 *replicaManager)
2063 {
2064 ValidateLists(replicaManager);
2065 queryToDestructReplicaList.RemoveAtIndex(queryToDestructIdx);
2066 ValidateLists(replicaManager);
2067 }
2068
2069 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2070
2071 void Connection_RM3::ValidateLists(ReplicaManager3 *replicaManager) const
2072 {
2073 (void) replicaManager;
2074 /*
2075 #ifdef _DEBUG
2076 // Each object should exist only once in either constructedReplicaList or queryToConstructReplicaList
2077 // replicaPointer from LastSerializationResult should be same among all lists
2078 unsigned int idx, idx2;
2079 for (idx=0; idx < constructedReplicaList.Size(); idx++)
2080 {
2081 idx2=queryToConstructReplicaList.GetIndexOf(constructedReplicaList[idx]->replica);
2082 if (idx2!=(unsigned int)-1)
2083 {
2084 int a=5;
2085 assert(a==0);
2086 int *b=0;
2087 *b=5;
2088 }
2089 }
2090
2091 for (idx=0; idx < queryToConstructReplicaList.Size(); idx++)
2092 {
2093 idx2=constructedReplicaList.GetIndexOf(queryToConstructReplicaList[idx]->replica);
2094 if (idx2!=(unsigned int)-1)
2095 {
2096 int a=5;
2097 assert(a==0);
2098 int *b=0;
2099 *b=5;
2100 }
2101 }
2102
2103 LastSerializationResult *lsr, *lsr2;
2104 for (idx=0; idx < constructedReplicaList.Size(); idx++)
2105 {
2106 lsr=constructedReplicaList[idx];
2107
2108 idx2=queryToSerializeReplicaList.GetIndexOf(lsr->replica);
2109 if (idx2!=(unsigned int)-1)
2110 {
2111 lsr2=queryToSerializeReplicaList[idx2];
2112 if (lsr2!=lsr)
2113 {
2114 int a=5;
2115 assert(a==0);
2116 int *b=0;
2117 *b=5;
2118 }
2119 }
2120
2121 idx2=queryToDestructReplicaList.GetIndexOf(lsr->replica);
2122 if (idx2!=(unsigned int)-1)
2123 {
2124 lsr2=queryToDestructReplicaList[idx2];
2125 if (lsr2!=lsr)
2126 {
2127 int a=5;
2128 assert(a==0);
2129 int *b=0;
2130 *b=5;
2131 }
2132 }
2133 }
2134 for (idx=0; idx < queryToConstructReplicaList.Size(); idx++)
2135 {
2136 lsr=queryToConstructReplicaList[idx];
2137
2138 idx2=queryToSerializeReplicaList.GetIndexOf(lsr->replica);
2139 if (idx2!=(unsigned int)-1)
2140 {
2141 lsr2=queryToSerializeReplicaList[idx2];
2142 if (lsr2!=lsr)
2143 {
2144 int a=5;
2145 assert(a==0);
2146 int *b=0;
2147 *b=5;
2148 }
2149 }
2150
2151 idx2=queryToDestructReplicaList.GetIndexOf(lsr->replica);
2152 if (idx2!=(unsigned int)-1)
2153 {
2154 lsr2=queryToDestructReplicaList[idx2];
2155 if (lsr2!=lsr)
2156 {
2157 int a=5;
2158 assert(a==0);
2159 int *b=0;
2160 *b=5;
2161 }
2162 }
2163 }
2164
2165 // Verify pointer integrity
2166 for (idx=0; idx < constructedReplicaList.Size(); idx++)
2167 {
2168 if (constructedReplicaList[idx]->replica->replicaManager!=replicaManager)
2169 {
2170 int a=5;
2171 assert(a==0);
2172 int *b=0;
2173 *b=5;
2174 }
2175 }
2176
2177 // Verify pointer integrity
2178 for (idx=0; idx < queryToConstructReplicaList.Size(); idx++)
2179 {
2180 if (queryToConstructReplicaList[idx]->replica->replicaManager!=replicaManager)
2181 {
2182 int a=5;
2183 assert(a==0);
2184 int *b=0;
2185 *b=5;
2186 }
2187 }
2188 #endif
2189 */
2190 }
2191 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2192
2193 void Connection_RM3::SendConstruction(DataStructures::List<Replica3*> &newObjects, DataStructures::List<Replica3*> &deletedObjects, PRO sendParameters, SLNet::RakPeerInterface *rakPeer, unsigned char worldId, ReplicaManager3 *replicaManager3)
2194 {
2195 if (newObjects.Size()==0 && deletedObjects.Size()==0)
2196 return;
2197
2198 // All construction and destruction takes place in the same network message
2199 // Otherwise, if objects rely on each other being created the same tick to be valid, this won't always be true
2200 // DataStructures::List<LastSerializationResult* > serializedObjects;
2201 BitSize_t offsetStart, offsetStart2, offsetEnd;
2202 unsigned int newListIndex, oldListIndex;
2203 SLNet::BitStream bsOut;
2204 NetworkID networkId;
2205 if (isFirstConstruction)
2206 {
2207 bsOut.Write((MessageID)ID_REPLICA_MANAGER_DOWNLOAD_STARTED);
2208 bsOut.Write(worldId);
2209 SerializeOnDownloadStarted(&bsOut);
2210 rakPeer->Send(&bsOut,sendParameters.priority,RELIABLE_ORDERED,sendParameters.orderingChannel,systemAddress,false,sendParameters.sendReceipt);
2211 }
2212
2213 // LastSerializationResult* lsr;
2214 bsOut.Reset();
2215 bsOut.Write((MessageID)ID_REPLICA_MANAGER_CONSTRUCTION);
2216 bsOut.Write(worldId);
2217 uint16_t objectSize = (uint16_t) newObjects.Size();
2218 bsOut.Write(objectSize);
2219
2220 // Construction
2221 for (newListIndex=0; newListIndex < newObjects.Size(); newListIndex++)
2222 {
2223 offsetStart=bsOut.GetWriteOffset();
2224 bsOut.Write(offsetStart); // overwritten to point to the end of the stream
2225 networkId=newObjects[newListIndex]->GetNetworkID();
2226 bsOut.Write(networkId);
2227
2228 RM3ConstructionState cs = newObjects[newListIndex]->QueryConstruction(this, replicaManager3);
2229 bool actuallyCreateObject = cs==RM3CS_SEND_CONSTRUCTION;
2230 bsOut.Write(actuallyCreateObject);
2231 bsOut.AlignWriteToByteBoundary();
2232
2233 if (actuallyCreateObject)
2234 {
2235 // Actually create the object
2236 bsOut.Write(newObjects[newListIndex]->creatingSystemGUID);
2237 offsetStart2=bsOut.GetWriteOffset();
2238 bsOut.Write(offsetStart2); // overwritten to point to after the call to WriteAllocationID
2239 bsOut.AlignWriteToByteBoundary(); // Give the user an aligned bitStream in case they use memcpy
2240 newObjects[newListIndex]->WriteAllocationID(this, &bsOut);
2241 bsOut.AlignWriteToByteBoundary(); // Give the user an aligned bitStream in case they use memcpy
2242 offsetEnd=bsOut.GetWriteOffset();
2243 bsOut.SetWriteOffset(offsetStart2);
2244 bsOut.Write(offsetEnd);
2245 bsOut.SetWriteOffset(offsetEnd);
2246 newObjects[newListIndex]->SerializeConstruction(&bsOut, this);
2247 }
2248 else
2249 {
2250 newObjects[newListIndex]->SerializeConstructionExisting(&bsOut, this);
2251 }
2252
2253 bsOut.AlignWriteToByteBoundary();
2254 offsetEnd=bsOut.GetWriteOffset();
2255 bsOut.SetWriteOffset(offsetStart);
2256 bsOut.Write(offsetEnd);
2257 bsOut.SetWriteOffset(offsetEnd);
2258 }
2259
2260 SLNet::BitStream bsOut2;
2261 for (newListIndex=0; newListIndex < newObjects.Size(); newListIndex++)
2262 {
2263 bsOut2.Reset();
2264 RM3ConstructionState cs = newObjects[newListIndex]->QueryConstruction(this, replicaManager3);
2265 if (cs==RM3CS_SEND_CONSTRUCTION)
2266 {
2267 newObjects[newListIndex]->PostSerializeConstruction(&bsOut2, this);
2268 }
2269 else
2270 {
2271 RakAssert(cs==RM3CS_ALREADY_EXISTS_REMOTELY);
2272 newObjects[newListIndex]->PostSerializeConstructionExisting(&bsOut2, this);
2273 }
2274 if (bsOut2.GetNumberOfBitsUsed()>0)
2275 {
2276 bsOut.Write(true);
2277 bsOut.AlignWriteToByteBoundary();
2278 offsetStart=bsOut.GetWriteOffset();
2279 bsOut.Write(offsetStart); // overwritten to point to the end of the stream
2280 networkId=newObjects[newListIndex]->GetNetworkID();
2281 bsOut.Write(networkId);
2282 bsOut.AlignWriteToByteBoundary(); // Give the user an aligned bitStream in case they use memcpy
2283 bsOut.Write(&bsOut2);
2284 bsOut.AlignWriteToByteBoundary(); // Give the user an aligned bitStream in case they use memcpy
2285 offsetEnd=bsOut.GetWriteOffset();
2286 bsOut.SetWriteOffset(offsetStart);
2287 bsOut.Write(offsetEnd);
2288 bsOut.SetWriteOffset(offsetEnd);
2289 }
2290 else
2291 bsOut.Write(false);
2292 }
2293 bsOut.AlignWriteToByteBoundary();
2294
2295 // Destruction
2296 objectSize = (uint16_t) deletedObjects.Size();
2297 bsOut.Write(objectSize);
2298 for (oldListIndex=0; oldListIndex < deletedObjects.Size(); oldListIndex++)
2299 {
2300 networkId=deletedObjects[oldListIndex]->GetNetworkID();
2301 bsOut.Write(networkId);
2302 offsetStart=bsOut.GetWriteOffset();
2303 bsOut.Write(offsetStart);
2304 deletedObjects[oldListIndex]->deletingSystemGUID=rakPeer->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
2305 bsOut.Write(deletedObjects[oldListIndex]->deletingSystemGUID);
2306 deletedObjects[oldListIndex]->SerializeDestruction(&bsOut, this);
2307 bsOut.AlignWriteToByteBoundary();
2308 offsetEnd=bsOut.GetWriteOffset();
2309 bsOut.SetWriteOffset(offsetStart);
2310 bsOut.Write(offsetEnd);
2311 bsOut.SetWriteOffset(offsetEnd);
2312 }
2313 rakPeer->Send(&bsOut,sendParameters.priority,RELIABLE_ORDERED,sendParameters.orderingChannel,systemAddress,false,sendParameters.sendReceipt);
2314
2315 // TODO - shouldn't this be part of construction?
2316
2317 // Initial Download serialize to a new system
2318 // Immediately send serialize after construction if the replica object already has saved data
2319 // If the object was serialized identically, and does not change later on, then the new connection never gets the data
2320 SerializeParameters sp;
2321 sp.whenLastSerialized=0;
2322 SLNet::BitStream emptyBs;
2323 for (int index=0; index < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; index++)
2324 {
2325 sp.lastSentBitstream[index]=&emptyBs;
2326 sp.pro[index]=sendParameters;
2327 sp.pro[index].reliability=RELIABLE_ORDERED;
2328 }
2329
2330 sp.bitsWrittenSoFar=0;
2331 // SLNet::Time t = SLNet::GetTimeMS();
2332 for (newListIndex=0; newListIndex < newObjects.Size(); newListIndex++)
2333 {
2334 sp.destinationConnection=this;
2335 sp.messageTimestamp=0;
2336 SLNet::Replica3 *replica = newObjects[newListIndex];
2337 // 8/22/09 Forgot ResetWritePointer
2338 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
2339 {
2340 sp.outputBitstream[z].ResetWritePointer();
2341 }
2342
2343 RM3SerializationResult res = replica->Serialize(&sp);
2344 if (res!=RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION &&
2345 res!=RM3SR_DO_NOT_SERIALIZE &&
2346 res!=RM3SR_SERIALIZED_UNIQUELY)
2347 {
2348 bool allIndices[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
2349 for (int z=0; z < RM3_NUM_OUTPUT_BITSTREAM_CHANNELS; z++)
2350 {
2351 sp.bitsWrittenSoFar+=sp.outputBitstream[z].GetNumberOfBitsUsed();
2352 allIndices[z]=true;
2353 }
2354 SendSerialize(replica, allIndices, sp.outputBitstream, sp.messageTimestamp, sp.pro, rakPeer, worldId, GetTime());
2356
2357 }
2358 // else wait for construction request accepted before serializing
2359 }
2360
2361 if (isFirstConstruction)
2362 {
2363 bsOut.Reset();
2364 bsOut.Write((MessageID)ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE);
2365 bsOut.Write(worldId);
2366 SerializeOnDownloadComplete(&bsOut);
2367 rakPeer->Send(&bsOut,sendParameters.priority,RELIABLE_ORDERED,sendParameters.orderingChannel,systemAddress,false,sendParameters.sendReceipt);
2368 }
2369
2370 isFirstConstruction=false;
2371
2372 }
2373
2374 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2375
2376 void Connection_RM3::SendValidation(SLNet::RakPeerInterface *rakPeer, WorldId worldId)
2377 {
2378 // Hijack to mean sendValidation
2379 SLNet::BitStream bsOut;
2380 bsOut.Write((MessageID)ID_REPLICA_MANAGER_SCOPE_CHANGE);
2381 bsOut.Write(worldId);
2382 rakPeer->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,systemAddress,false);
2383 }
2384
2385 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2386
2387 Replica3::Replica3()
2388 {
2389 creatingSystemGUID=UNASSIGNED_RAKNET_GUID;
2390 deletingSystemGUID=UNASSIGNED_RAKNET_GUID;
2391 replicaManager=0;
2392 forceSendUntilNextUpdate=false;
2393 lsr=0;
2394 referenceIndex = (uint32_t)-1;
2395 }
2396
2397 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2398
2399 Replica3::~Replica3()
2400 {
2401 if (replicaManager)
2402 {
2403 replicaManager->Dereference(this);
2404 }
2405 }
2406
2407 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2408
2409 void Replica3::BroadcastDestruction(void)
2410 {
2411 replicaManager->BroadcastDestruction(this,UNASSIGNED_SYSTEM_ADDRESS);
2412 }
2413
2414 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2415
2416 RakNetGUID Replica3::GetCreatingSystemGUID(void) const
2417 {
2418 return creatingSystemGUID;
2419 }
2420
2421 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2422
2423 RM3ConstructionState Replica3::QueryConstruction_ClientConstruction(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
2424 {
2425 (void) destinationConnection;
2426 if (creatingSystemGUID==replicaManager->GetRakPeerInterface()->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS))
2427 return RM3CS_SEND_CONSTRUCTION;
2428 // Send back to the owner client too, because they couldn't assign the network ID
2429 if (isThisTheServer)
2430 return RM3CS_SEND_CONSTRUCTION;
2431 return RM3CS_NEVER_CONSTRUCT;
2432 }
2433
2434 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2435
2436 bool Replica3::QueryRemoteConstruction_ClientConstruction(SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer)
2437 {
2438 (void) sourceConnection;
2439 (void) isThisTheServer;
2440
2441 // OK to create
2442 return true;
2443 }
2444
2445 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2446
2447 RM3ConstructionState Replica3::QueryConstruction_ServerConstruction(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
2448 {
2449 (void) destinationConnection;
2450
2451 if (isThisTheServer)
2452 return RM3CS_SEND_CONSTRUCTION;
2453 return RM3CS_NEVER_CONSTRUCT;
2454 }
2455
2456 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2457
2458 bool Replica3::QueryRemoteConstruction_ServerConstruction(SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer)
2459 {
2460 (void) sourceConnection;
2461 if (isThisTheServer)
2462 return false;
2463 return true;
2464 }
2465
2466 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2467
2468 RM3ConstructionState Replica3::QueryConstruction_PeerToPeer(SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode)
2469 {
2470 (void) destinationConnection;
2471
2472 if (p2pMode==R3P2PM_SINGLE_OWNER)
2473 {
2474 // We send to all, others do nothing
2475 if (creatingSystemGUID==replicaManager->GetRakPeerInterface()->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS))
2476 return RM3CS_SEND_CONSTRUCTION;
2477
2478 // RM3CS_NEVER_CONSTRUCT will not send the object, and will not Serialize() it
2479 return RM3CS_NEVER_CONSTRUCT;
2480 }
2481 else if (p2pMode==R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE)
2482 {
2483 return RM3CS_SEND_CONSTRUCTION;
2484 }
2485 else if (p2pMode==R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE)
2486 {
2487 return RM3CS_ALREADY_EXISTS_REMOTELY;
2488 }
2489 else if (p2pMode==R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE)
2490 {
2491 return RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT;
2492 }
2493 else
2494 {
2495 RakAssert(p2pMode==R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE);
2496
2497 // RM3CS_ALREADY_EXISTS_REMOTELY will not send the object, but WILL call QuerySerialization() and Serialize() on it.
2498 return RM3CS_ALREADY_EXISTS_REMOTELY;
2499 }
2500 }
2501
2502 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2503
2504 bool Replica3::QueryRemoteConstruction_PeerToPeer(SLNet::Connection_RM3 *sourceConnection)
2505 {
2506 (void) sourceConnection;
2507
2508 return true;
2509 }
2510
2511 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2512
2513 RM3QuerySerializationResult Replica3::QuerySerialization_ClientSerializable(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
2514 {
2515 // Owner client sends to all
2516 if (creatingSystemGUID==replicaManager->GetRakPeerInterface()->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS))
2517 return RM3QSR_CALL_SERIALIZE;
2518 // Server sends to all but owner client
2519 if (isThisTheServer && destinationConnection->GetRakNetGUID()!=creatingSystemGUID)
2520 return RM3QSR_CALL_SERIALIZE;
2521 // Remote clients do not send
2522 return RM3QSR_NEVER_CALL_SERIALIZE;
2523 }
2524
2525 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2526
2527 RM3QuerySerializationResult Replica3::QuerySerialization_ServerSerializable(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
2528 {
2529 (void) destinationConnection;
2530 // Server sends to all
2531 if (isThisTheServer)
2532 return RM3QSR_CALL_SERIALIZE;
2533
2534 // Clients do not send
2535 return RM3QSR_NEVER_CALL_SERIALIZE;
2536 }
2537
2538 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2539
2540 RM3QuerySerializationResult Replica3::QuerySerialization_PeerToPeer(SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode)
2541 {
2542 (void) destinationConnection;
2543
2544 if (p2pMode==R3P2PM_SINGLE_OWNER)
2545 {
2546 // Owner peer sends to all
2547 if (creatingSystemGUID==replicaManager->GetRakPeerInterface()->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS))
2548 return RM3QSR_CALL_SERIALIZE;
2549
2550 // Remote peers do not send
2551 return RM3QSR_NEVER_CALL_SERIALIZE;
2552 }
2553 else if (p2pMode==R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE)
2554 {
2555 return RM3QSR_CALL_SERIALIZE;
2556 }
2557 else if (p2pMode==R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE)
2558 {
2559 return RM3QSR_CALL_SERIALIZE;
2560 }
2561 else if (p2pMode==R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE)
2562 {
2563 return RM3QSR_DO_NOT_CALL_SERIALIZE;
2564 }
2565 else
2566 {
2567 RakAssert(p2pMode==R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE);
2568 return RM3QSR_DO_NOT_CALL_SERIALIZE;
2569 }
2570 }
2571
2572 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2573
2574 RM3ActionOnPopConnection Replica3::QueryActionOnPopConnection_Client(SLNet::Connection_RM3 *droppedConnection) const
2575 {
2576 (void) droppedConnection;
2577 return RM3AOPC_DELETE_REPLICA;
2578 }
2579
2580 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2581
2582 RM3ActionOnPopConnection Replica3::QueryActionOnPopConnection_Server(SLNet::Connection_RM3 *droppedConnection) const
2583 {
2584 (void) droppedConnection;
2585 return RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION;
2586 }
2587
2588 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2589
2590 RM3ActionOnPopConnection Replica3::QueryActionOnPopConnection_PeerToPeer(SLNet::Connection_RM3 *droppedConnection) const
2591 {
2592 (void) droppedConnection;
2593 return RM3AOPC_DELETE_REPLICA;
2594 }
2595
2596 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2597
2598 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_OrderedList.h Source File

  • include
  • slikenet
DS_OrderedList.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21 #include "DS_List.h"
22 #include "memoryoverride.h"
23 #include "Export.h"
24
25 #ifndef __ORDERED_LIST_H
26 #define __ORDERED_LIST_H
27
30 namespace DataStructures
31 {
32 template <class key_type, class data_type>
33 int defaultOrderedListComparison(const key_type &a, const data_type &b)
34 {
35 if (a<b) return -1; if (a==b) return 0; return 1;
36 }
37
39 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)=defaultOrderedListComparison<key_type, data_type> >
40 class RAK_DLL_EXPORT OrderedList
41 {
42 public:
43 static void IMPLEMENT_DEFAULT_COMPARISON(void) {DataStructures::defaultOrderedListComparison<key_type, data_type>(key_type(),data_type());}
44
45 OrderedList();
46 ~OrderedList();
47 OrderedList( const OrderedList& original_copy );
48 OrderedList& operator= ( const OrderedList& original_copy );
49
52 bool HasData(const key_type &key, int (*cf)(const key_type&, const data_type&)=default_comparison_function) const;
53 // GetIndexFromKey returns where the insert should go at the same time checks if it is there
54 unsigned GetIndexFromKey(const key_type &key, bool *objectExists, int (*cf)(const key_type&, const data_type&)=default_comparison_function) const;
55 data_type GetElementFromKey(const key_type &key, int (*cf)(const key_type&, const data_type&)=default_comparison_function) const;
56 bool GetElementFromKey(const key_type &key, data_type &element, int (*cf)(const key_type&, const data_type&)=default_comparison_function) const;
57 unsigned Insert(const key_type &key, const data_type &data, bool assertOnDuplicate, const char *file, unsigned int line, int (*cf)(const key_type&, const data_type&)=default_comparison_function);
58 unsigned Remove(const key_type &key, int (*cf)(const key_type&, const data_type&)=default_comparison_function);
59 unsigned RemoveIfExists(const key_type &key, int (*cf)(const key_type&, const data_type&)=default_comparison_function);
60 data_type& operator[] ( const unsigned int position ) const;
61 void RemoveAtIndex(const unsigned index);
62 void InsertAtIndex(const data_type &data, const unsigned index, const char *file, unsigned int line);
63 void InsertAtEnd(const data_type &data, const char *file, unsigned int line);
64 void RemoveFromEnd(const unsigned num=1);
65 void Clear(bool doNotDeallocate, const char *file, unsigned int line);
66 unsigned Size(void) const;
67
68 protected:
69 DataStructures::List<data_type> orderedList;
70 };
71
72 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
73 OrderedList<key_type, data_type, default_comparison_function>::OrderedList()
74 {
75 }
76
77 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
78 OrderedList<key_type, data_type, default_comparison_function>::~OrderedList()
79 {
80 Clear(false, _FILE_AND_LINE_);
81 }
82
83 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
84 OrderedList<key_type, data_type, default_comparison_function>::OrderedList( const OrderedList& original_copy )
85 {
86 orderedList=original_copy.orderedList;
87 }
88
89 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
90 OrderedList<key_type, data_type, default_comparison_function>& OrderedList<key_type, data_type, default_comparison_function>::operator= ( const OrderedList& original_copy )
91 {
92 orderedList=original_copy.orderedList;
93 return *this;
94 }
95
96 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
97 bool OrderedList<key_type, data_type, default_comparison_function>::HasData(const key_type &key, int (*cf)(const key_type&, const data_type&)) const
98 {
99 bool objectExists;
100 GetIndexFromKey(key, &objectExists, cf);
101 return objectExists;
102 }
103
104 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
105 data_type OrderedList<key_type, data_type, default_comparison_function>::GetElementFromKey(const key_type &key, int (*cf)(const key_type&, const data_type&)) const
106 {
107 bool objectExists;
108 unsigned index;
109 index = GetIndexFromKey(key, &objectExists, cf);
110 RakAssert(objectExists);
111 return orderedList[index];
112 }
113 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
114 bool OrderedList<key_type, data_type, default_comparison_function>::GetElementFromKey(const key_type &key, data_type &element, int (*cf)(const key_type&, const data_type&)) const
115 {
116 bool objectExists;
117 unsigned index;
118 index = GetIndexFromKey(key, &objectExists, cf);
119 if (objectExists)
120 element = orderedList[index];
121 return objectExists;
122 }
123 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
124 unsigned OrderedList<key_type, data_type, default_comparison_function>::GetIndexFromKey(const key_type &key, bool *objectExists, int (*cf)(const key_type&, const data_type&)) const
125 {
126 int index, upperBound, lowerBound;
127 int res;
128
129 if (orderedList.Size()==0)
130 {
131 *objectExists=false;
132 return 0;
133 }
134
135 upperBound=(int)orderedList.Size()-1;
136 lowerBound=0;
137 index = (int)orderedList.Size()/2;
138
139 for(;;)
140 {
141 res = cf(key,orderedList[index]);
142 if (res==0)
143 {
144 *objectExists=true;
145 return (unsigned)index;
146 }
147 else if (res<0)
148 {
149 upperBound=index-1;
150 }
151 else// if (res>0)
152 {
153
154 lowerBound=index+1;
155 }
156
157 index=lowerBound+(upperBound-lowerBound)/2;
158
159 if (lowerBound>upperBound)
160 {
161 *objectExists=false;
162 return (unsigned)lowerBound; // No match
163 }
164
165 if (index < 0 || index >= (int) orderedList.Size())
166 {
167 // This should never hit unless the comparison function was inconsistent
168 RakAssert(index && 0);
169 *objectExists=false;
170 return 0;
171 }
172 }
173 }
174
175 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
176 unsigned OrderedList<key_type, data_type, default_comparison_function>::Insert(const key_type &key, const data_type &data, bool assertOnDuplicate, const char *file, unsigned int line, int (*cf)(const key_type&, const data_type&))
177 {
178 (void) assertOnDuplicate;
179 bool objectExists;
180 unsigned index;
181 index = GetIndexFromKey(key, &objectExists, cf);
182
183 // Don't allow duplicate insertion.
184 if (objectExists)
185 {
186 // This is usually a bug!
187 RakAssert(assertOnDuplicate==false);
188 return (unsigned)-1;
189 }
190
191 if (index>=orderedList.Size())
192 {
193 orderedList.Insert(data, file, line);
194 return orderedList.Size()-1;
195 }
196 else
197 {
198 orderedList.Insert(data,index, file, line);
199 return index;
200 }
201 }
202
203 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
204 unsigned OrderedList<key_type, data_type, default_comparison_function>::Remove(const key_type &key, int (*cf)(const key_type&, const data_type&))
205 {
206 bool objectExists;
207 unsigned index;
208 index = GetIndexFromKey(key, &objectExists, cf);
209
210 // Can't find the element to remove if this assert hits
211 // RakAssert(objectExists==true);
212 if (objectExists==false)
213 {
214 RakAssert(objectExists==true);
215 return 0;
216 }
217
218 orderedList.RemoveAtIndex(index);
219 return index;
220 }
221
222 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
223 unsigned OrderedList<key_type, data_type, default_comparison_function>::RemoveIfExists(const key_type &key, int (*cf)(const key_type&, const data_type&))
224 {
225 bool objectExists;
226 unsigned index;
227 index = GetIndexFromKey(key, &objectExists, cf);
228
229 // Can't find the element to remove if this assert hits
230 if (objectExists==false)
231 return 0;
232
233 orderedList.RemoveAtIndex(index);
234 return index;
235 }
236
237 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
238 void OrderedList<key_type, data_type, default_comparison_function>::RemoveAtIndex(const unsigned index)
239 {
240 orderedList.RemoveAtIndex(index);
241 }
242
243 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
244 void OrderedList<key_type, data_type, default_comparison_function>::InsertAtIndex(const data_type &data, const unsigned index, const char *file, unsigned int line)
245 {
246 orderedList.Insert(data, index, file, line);
247 }
248
249 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
250 void OrderedList<key_type, data_type, default_comparison_function>::InsertAtEnd(const data_type &data, const char *file, unsigned int line)
251 {
252 orderedList.Insert(data, file, line);
253 }
254
255 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
256 void OrderedList<key_type, data_type, default_comparison_function>::RemoveFromEnd(const unsigned num)
257 {
258 orderedList.RemoveFromEnd(num);
259 }
260
261 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
262 void OrderedList<key_type, data_type, default_comparison_function>::Clear(bool doNotDeallocate, const char *file, unsigned int line)
263 {
264 orderedList.Clear(doNotDeallocate, file, line);
265 }
266
267 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
268 data_type& OrderedList<key_type, data_type, default_comparison_function>::operator[]( const unsigned int position ) const
269 {
270 return orderedList[position];
271 }
272
273 template <class key_type, class data_type, int (*default_comparison_function)(const key_type&, const data_type&)>
274 unsigned OrderedList<key_type, data_type, default_comparison_function>::Size(void) const
275 {
276 return orderedList.Size();
277 }
278 }
279
280 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HTTPConnection
  • BadResponse
SLNet::HTTPConnection::BadResponse Member List

This is the complete list of members for SLNet::HTTPConnection::BadResponse, including all inherited members.

BadResponse() | SLNet::HTTPConnection::BadResponse | inline
BadResponse(const unsigned char *_data, int _code) | SLNet::HTTPConnection::BadResponse | inline
BadResponse(const char *_data, int _code) | SLNet::HTTPConnection::BadResponse | inline
code | SLNet::HTTPConnection::BadResponse |
data | SLNet::HTTPConnection::BadResponse |
operator int() const | SLNet::HTTPConnection::BadResponse | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Gets.cpp Source File

  • src
Gets.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #include <stdio.h>
12 #include <string.h>
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 char * Gets ( char * str, int num )
19 {
20 fgets(str, num, stdin);
21 if (str[0]=='\n' || str[0]=='\r')
22 str[0]=0;
23
24 size_t len=strlen(str);
25 if (len>0 && (str[len-1]=='\n' || str[len-1]=='\r'))
26 str[len-1]=0;
27 if (len>1 && (str[len-2]=='\n' || str[len-2]=='\r'))
28 str[len-2]=0;
29
30 return str;
31 }
32
33 #ifdef __cplusplus
34 }
35 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/GetTime.h Source File

  • include
  • slikenet
GetTime.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #ifndef __GET_TIME_H
22 #define __GET_TIME_H
23
24 #include "Export.h"
25 #include "time.h" // For SLNet::TimeMS
26
27 namespace SLNet
28 {
31 SLNet::Time RAK_DLL_EXPORT GetTime( void );
32
35 SLNet::TimeMS RAK_DLL_EXPORT GetTimeMS( void );
36
39 SLNet::TimeUS RAK_DLL_EXPORT GetTimeUS( void );
40
42 extern RAK_DLL_EXPORT bool GreaterThan(SLNet::Time a, SLNet::Time b);
44 extern RAK_DLL_EXPORT bool LessThan(SLNet::Time a, SLNet::Time b);
45 }
46
47 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • ThreadsafeAllocatingQueue
DataStructures::ThreadsafeAllocatingQueue< structureType > Member List

This is the complete list of members for DataStructures::ThreadsafeAllocatingQueue< structureType >, including all inherited members.

Allocate(const char *file, unsigned int line) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
Clear(const char *file, unsigned int line) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
Deallocate(structureType *s, const char *file, unsigned int line) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
IsEmpty(void) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
memoryPool | DataStructures::ThreadsafeAllocatingQueue< structureType > | mutableprotected
memoryPoolMutex | DataStructures::ThreadsafeAllocatingQueue< structureType > | protected
operator[](unsigned int position) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
Pop(void) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
PopInaccurate(void) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
Push(structureType *s) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
queue | DataStructures::ThreadsafeAllocatingQueue< structureType > | protected
queueMutex | DataStructures::ThreadsafeAllocatingQueue< structureType > | protected
RemoveAtIndex(unsigned int position) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
SetPageSize(int size) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
Size(void) | DataStructures::ThreadsafeAllocatingQueue< structureType > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/commandparser.h Source File

  • include
  • slikenet
commandparser.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_RakNetCommandParser==1
22
23 #ifndef __RAKNET_COMMAND_PARSER
24 #define __RAKNET_COMMAND_PARSER
25
26 #include "CommandParserInterface.h"
27 #include "Export.h"
28
29 namespace SLNet
30 {
31 class RakPeerInterface;
32
34 class RAK_DLL_EXPORT RakNetCommandParser : public CommandParserInterface
35 {
36 public:
37 // GetInstance() and DestroyInstance(instance*)
38 STATIC_FACTORY_DECLARATIONS(RakNetCommandParser)
39
40 RakNetCommandParser();
41 ~RakNetCommandParser();
42
50 bool OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString);
51
55 const char *GetName(void) const;
56
60 void SendHelp(TransportInterface *transport, const SystemAddress &systemAddress);
61
64 void SetRakPeerInterface(SLNet::RakPeerInterface *rakPeer);
65 protected:
66
68 RakPeerInterface *peer;
69 };
70
71 } // namespace SLNet
72
73 #endif
74
75 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_MemoryPool.h Source File

  • include
  • slikenet
DS_MemoryPool.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #ifndef __MEMORY_POOL_H
21 #define __MEMORY_POOL_H
22
23 #ifndef __APPLE__
24 // Use stdlib and not malloc for compatibility
25 #include <stdlib.h>
26 #endif
27 #include "assert.h"
28 #include "Export.h"
29
30 #include "memoryoverride.h"
31
32 // DS_MEMORY_POOL_MAX_FREE_PAGES must be > 1
33 #define DS_MEMORY_POOL_MAX_FREE_PAGES 4
34
35 //#define _DISABLE_MEMORY_POOL
36
37 namespace DataStructures
38 {
41 template <class MemoryBlockType>
42 class RAK_DLL_EXPORT MemoryPool
43 {
44 public:
45 struct Page;
46 struct MemoryWithPage
47 {
48 MemoryBlockType userMemory;
49 Page *parentPage;
50 };
51 struct Page
52 {
53 MemoryWithPage** availableStack;
54 int availableStackSize;
55 MemoryWithPage* block;
56 Page *next, *prev;
57 };
58
59 MemoryPool();
60 ~MemoryPool();
61 void SetPageSize(int size); // Defaults to 16384 bytes
62 MemoryBlockType *Allocate(const char *file, unsigned int line);
63 void Release(MemoryBlockType *m, const char *file, unsigned int line);
64 void Clear(const char *file, unsigned int line);
65
66 int GetAvailablePagesSize(void) const {return availablePagesSize;}
67 int GetUnavailablePagesSize(void) const {return unavailablePagesSize;}
68 int GetMemoryPoolPageSize(void) const {return memoryPoolPageSize;}
69 protected:
70 int BlocksPerPage(void) const;
71 void AllocateFirst(void);
72 bool InitPage(Page *page, Page *prev, const char *file, unsigned int line);
73
74 // availablePages contains pages which have room to give the user new blocks. We return these blocks from the head of the list
75 // unavailablePages are pages which are totally full, and from which we do not return new blocks.
76 // Pages move from the head of unavailablePages to the tail of availablePages, and from the head of availablePages to the tail of unavailablePages
77 Page *availablePages, *unavailablePages;
78 int availablePagesSize, unavailablePagesSize;
79 int memoryPoolPageSize;
80 };
81
82 template<class MemoryBlockType>
83 MemoryPool<MemoryBlockType>::MemoryPool()
84 {
85 #ifndef _DISABLE_MEMORY_POOL
86 //AllocateFirst();
87 availablePagesSize=0;
88 unavailablePagesSize=0;
89 memoryPoolPageSize=16384;
90 #endif
91 }
92 template<class MemoryBlockType>
93 MemoryPool<MemoryBlockType>::~MemoryPool()
94 {
95 #ifndef _DISABLE_MEMORY_POOL
96 Clear(_FILE_AND_LINE_);
97 #endif
98 }
99
100 template<class MemoryBlockType>
101 void MemoryPool<MemoryBlockType>::SetPageSize(int size)
102 {
103 memoryPoolPageSize=size;
104 }
105
106 template<class MemoryBlockType>
107 MemoryBlockType* MemoryPool<MemoryBlockType>::Allocate(const char *file, unsigned int line)
108 {
109 #ifdef _DISABLE_MEMORY_POOL
110 return (MemoryBlockType*) rakMalloc_Ex(sizeof(MemoryBlockType), file, line);
111 #else
112
113 if (availablePagesSize>0)
114 {
115 MemoryBlockType *retVal;
116 Page *curPage;
117 curPage=availablePages;
118 retVal = (MemoryBlockType*) curPage->availableStack[--(curPage->availableStackSize)];
119 if (curPage->availableStackSize==0)
120 {
121 --availablePagesSize;
122 availablePages=curPage->next;
123 RakAssert(availablePagesSize==0 || availablePages->availableStackSize>0);
124 curPage->next->prev=curPage->prev;
125 curPage->prev->next=curPage->next;
126
127 if (unavailablePagesSize++==0)
128 {
129 unavailablePages=curPage;
130 curPage->next=curPage;
131 curPage->prev=curPage;
132 }
133 else
134 {
135 curPage->next=unavailablePages;
136 curPage->prev=unavailablePages->prev;
137 unavailablePages->prev->next=curPage;
138 unavailablePages->prev=curPage;
139 }
140 }
141
142 RakAssert(availablePagesSize==0 || availablePages->availableStackSize>0);
143 return retVal;
144 }
145
146 availablePages = (Page *) rakMalloc_Ex(sizeof(Page), file, line);
147 if (availablePages==0)
148 return 0;
149 availablePagesSize=1;
150 if (InitPage(availablePages, availablePages, file, line)==false)
151 return 0;
152 // If this assert hits, we couldn't allocate even 1 block per page. Increase the page size
153 RakAssert(availablePages->availableStackSize>1);
154
155 return (MemoryBlockType *) availablePages->availableStack[--availablePages->availableStackSize];
156 #endif
157 }
158 template<class MemoryBlockType>
159 void MemoryPool<MemoryBlockType>::Release(MemoryBlockType *m, const char *file, unsigned int line)
160 {
161 #ifdef _DISABLE_MEMORY_POOL
162 rakFree_Ex(m, file, line);
163 return;
164 #else
165 // Find the page this block is in and return it.
166 Page *curPage;
167 MemoryWithPage *memoryWithPage = (MemoryWithPage*)m;
168 curPage=memoryWithPage->parentPage;
169
170 if (curPage->availableStackSize==0)
171 {
172 // The page is in the unavailable list so move it to the available list
173 curPage->availableStack[curPage->availableStackSize++]=memoryWithPage;
174 unavailablePagesSize--;
175
176 // As this page is no longer totally empty, move it to the end of available pages
177 curPage->next->prev=curPage->prev;
178 curPage->prev->next=curPage->next;
179
180 if (unavailablePagesSize>0 && curPage==unavailablePages)
181 unavailablePages=unavailablePages->next;
182
183 if (availablePagesSize++==0)
184 {
185 availablePages=curPage;
186 curPage->next=curPage;
187 curPage->prev=curPage;
188 }
189 else
190 {
191 curPage->next=availablePages;
192 curPage->prev=availablePages->prev;
193 availablePages->prev->next=curPage;
194 availablePages->prev=curPage;
195 }
196 }
197 else
198 {
199 curPage->availableStack[curPage->availableStackSize++]=memoryWithPage;
200
201 if (curPage->availableStackSize==BlocksPerPage() &&
202 availablePagesSize>=DS_MEMORY_POOL_MAX_FREE_PAGES)
203 {
204 // After a certain point, just deallocate empty pages rather than keep them around
205 if (curPage==availablePages)
206 {
207 availablePages=curPage->next;
208 RakAssert(availablePages->availableStackSize>0);
209 }
210 curPage->prev->next=curPage->next;
211 curPage->next->prev=curPage->prev;
212 availablePagesSize--;
213 rakFree_Ex(curPage->availableStack, file, line );
214 rakFree_Ex(curPage->block, file, line );
215 rakFree_Ex(curPage, file, line );
216 }
217 }
218 #endif
219 }
220 template<class MemoryBlockType>
221 void MemoryPool<MemoryBlockType>::Clear(const char *file, unsigned int line)
222 {
223 #ifdef _DISABLE_MEMORY_POOL
224 return;
225 #else
226 Page *cur, *freed;
227
228 if (availablePagesSize>0)
229 {
230 cur = availablePages;
231 for (;;)
232 // do
233 {
234 rakFree_Ex(cur->availableStack, file, line );
235 rakFree_Ex(cur->block, file, line );
236 freed=cur;
237 cur=cur->next;
238 if (cur==availablePages)
239 {
240 rakFree_Ex(freed, file, line );
241 break;
242 }
243 rakFree_Ex(freed, file, line );
244 }// while(cur!=availablePages);
245 }
246
247 if (unavailablePagesSize>0)
248 {
249 cur = unavailablePages;
250 for(;;)
251 //do
252 {
253 rakFree_Ex(cur->availableStack, file, line );
254 rakFree_Ex(cur->block, file, line );
255 freed=cur;
256 cur=cur->next;
257 if (cur==unavailablePages)
258 {
259 rakFree_Ex(freed, file, line );
260 break;
261 }
262 rakFree_Ex(freed, file, line );
263 } // while(cur!=unavailablePages);
264 }
265
266 availablePagesSize=0;
267 unavailablePagesSize=0;
268 #endif
269 }
270 template<class MemoryBlockType>
271 int MemoryPool<MemoryBlockType>::BlocksPerPage(void) const
272 {
273 return memoryPoolPageSize / sizeof(MemoryWithPage);
274 }
275 template<class MemoryBlockType>
276 bool MemoryPool<MemoryBlockType>::InitPage(Page *page, Page *prev, const char *file, unsigned int line)
277 {
278 int i=0;
279 const int bpp = BlocksPerPage();
280 page->block=(MemoryWithPage*) rakMalloc_Ex(memoryPoolPageSize, file, line);
281 if (page->block==0)
282 return false;
283 page->availableStack=(MemoryWithPage**)rakMalloc_Ex(sizeof(MemoryWithPage*)*bpp, file, line);
284 if (page->availableStack==0)
285 {
286 rakFree_Ex(page->block, file, line );
287 return false;
288 }
289 MemoryWithPage *curBlock = page->block;
290 MemoryWithPage **curStack = page->availableStack;
291 while (i < bpp)
292 {
293 curBlock->parentPage=page;
294 curStack[i]=curBlock++;
295 i++;
296 }
297 page->availableStackSize=bpp;
298 page->next=availablePages;
299 page->prev=prev;
300 return true;
301 }
302 }
303
304 #endif
305
306 /*
307 #include "DS_MemoryPool.h"
308 #include "DS_List.h"
309
310 struct TestMemoryPool
311 {
312 int allocationId;
313 };
314
315 int main(void)
316 {
317 DataStructures::MemoryPool<TestMemoryPool> memoryPool;
318 DataStructures::List<TestMemoryPool*> returnList;
319
320 for (int i=0; i < 100000; i++)
321 returnList.Push(memoryPool.Allocate(_FILE_AND_LINE_), _FILE_AND_LINE_);
322 for (int i=0; i < returnList.Size(); i+=2)
323 {
324 memoryPool.Release(returnList[i], _FILE_AND_LINE_);
325 returnList.RemoveAtIndexFast(i);
326 }
327 for (int i=0; i < 100000; i++)
328 returnList.Push(memoryPool.Allocate(_FILE_AND_LINE_), _FILE_AND_LINE_);
329 while (returnList.Size())
330 {
331 memoryPool.Release(returnList[returnList.Size()-1], _FILE_AND_LINE_);
332 returnList.RemoveAtIndex(returnList.Size()-1);
333 }
334 for (int i=0; i < 100000; i++)
335 returnList.Push(memoryPool.Allocate(_FILE_AND_LINE_), _FILE_AND_LINE_);
336 while (returnList.Size())
337 {
338 memoryPool.Release(returnList[returnList.Size()-1], _FILE_AND_LINE_);
339 returnList.RemoveAtIndex(returnList.Size()-1);
340 }
341 for (int i=0; i < 100000; i++)
342 returnList.Push(memoryPool.Allocate(_FILE_AND_LINE_), _FILE_AND_LINE_);
343 for (int i=100000-1; i <= 0; i-=2)
344 {
345 memoryPool.Release(returnList[i], _FILE_AND_LINE_);
346 returnList.RemoveAtIndexFast(i);
347 }
348 for (int i=0; i < 100000; i++)
349 returnList.Push(memoryPool.Allocate(_FILE_AND_LINE_), _FILE_AND_LINE_);
350 while (returnList.Size())
351 {
352 memoryPool.Release(returnList[returnList.Size()-1], _FILE_AND_LINE_);
353 returnList.RemoveAtIndex(returnList.Size()-1);
354 }
355
356 return 0;
357 }
358 */
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/MessageIdentifiers.h Source File

  • include
  • slikenet
MessageIdentifiers.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #ifndef __MESSAGE_IDENTIFIERS_H
22 #define __MESSAGE_IDENTIFIERS_H
23
24 #if defined(RAKNET_USE_CUSTOM_PACKET_IDS)
25 #include "CustomPacketIdentifiers.h"
26 #else
27
28 enum OutOfBandIdentifiers
29 {
30 ID_NAT_ESTABLISH_UNIDIRECTIONAL,
31 ID_NAT_ESTABLISH_BIDIRECTIONAL,
32 ID_NAT_TYPE_DETECT,
33 ID_ROUTER_2_REPLY_TO_SENDER_PORT,
34 ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT,
35 ID_ROUTER_2_MINI_PUNCH_REPLY,
36 ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE,
37 ID_XBOX_360_VOICE,
38 ID_XBOX_360_GET_NETWORK_ROOM,
39 ID_XBOX_360_RETURN_NETWORK_ROOM,
40 ID_NAT_PING,
41 ID_NAT_PONG,
42 };
43
56 enum DefaultMessageIDTypes
57 {
58 //
59 // RESERVED TYPES - DO NOT CHANGE THESE
60 // All types from RakPeer
61 //
64 ID_CONNECTED_PING,
66 ID_UNCONNECTED_PING,
68 ID_UNCONNECTED_PING_OPEN_CONNECTIONS,
70 ID_CONNECTED_PONG,
72 ID_DETECT_LOST_CONNECTIONS,
75 ID_OPEN_CONNECTION_REQUEST_1,
78 ID_OPEN_CONNECTION_REPLY_1,
82 ID_OPEN_CONNECTION_REQUEST_2,
84 ID_OPEN_CONNECTION_REPLY_2,
86 ID_CONNECTION_REQUEST,
88 ID_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY,
90 ID_OUR_SYSTEM_REQUIRES_SECURITY,
92 ID_PUBLIC_KEY_MISMATCH,
95 ID_OUT_OF_BAND_INTERNAL,
101 ID_SND_RECEIPT_ACKED,
108 ID_SND_RECEIPT_LOSS,
109
110
111 //
112 // USER TYPES - DO NOT CHANGE THESE
113 //
114
116 ID_CONNECTION_REQUEST_ACCEPTED,
118 ID_CONNECTION_ATTEMPT_FAILED,
120 ID_ALREADY_CONNECTED,
122 ID_NEW_INCOMING_CONNECTION,
124 ID_NO_FREE_INCOMING_CONNECTIONS,
127 ID_DISCONNECTION_NOTIFICATION,
130 ID_CONNECTION_LOST,
132 ID_CONNECTION_BANNED,
134 ID_INVALID_PASSWORD,
135 // RAKNET_PROTOCOL_VERSION in version.h does not match on the remote system what we have on our system
136 // This means the two systems cannot communicate.
137 // The 2nd byte of the message contains the value of RAKNET_PROTOCOL_VERSION for the remote system
138 ID_INCOMPATIBLE_PROTOCOL_VERSION,
139 // Means that this IP address connected recently, and can't connect again as a security measure. See
141 ID_IP_RECENTLY_CONNECTED,
144 ID_TIMESTAMP,
148 ID_UNCONNECTED_PONG,
151 ID_ADVERTISE_SYSTEM,
152 // RakPeer - Downloading a large message. Format is ID_DOWNLOAD_PROGRESS (MessageID), partCount (unsigned int),
156 ID_DOWNLOAD_PROGRESS,
157
160 ID_REMOTE_DISCONNECTION_NOTIFICATION,
163 ID_REMOTE_CONNECTION_LOST,
165 ID_REMOTE_NEW_INCOMING_CONNECTION,
166
168 ID_FILE_LIST_TRANSFER_HEADER,
170 ID_FILE_LIST_TRANSFER_FILE,
171 // Ack for reference push, to send more of the file
172 ID_FILE_LIST_REFERENCE_PUSH_ACK,
173
175 ID_DDT_DOWNLOAD_REQUEST,
176
178 ID_TRANSPORT_STRING,
179
181 ID_REPLICA_MANAGER_CONSTRUCTION,
183 ID_REPLICA_MANAGER_SCOPE_CHANGE,
185 ID_REPLICA_MANAGER_SERIALIZE,
187 ID_REPLICA_MANAGER_DOWNLOAD_STARTED,
189 ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE,
190
192 ID_RAKVOICE_OPEN_CHANNEL_REQUEST,
194 ID_RAKVOICE_OPEN_CHANNEL_REPLY,
196 ID_RAKVOICE_CLOSE_CHANNEL,
198 ID_RAKVOICE_DATA,
199
201 ID_AUTOPATCHER_GET_CHANGELIST_SINCE_DATE,
203 ID_AUTOPATCHER_CREATION_LIST,
205 ID_AUTOPATCHER_DELETION_LIST,
207 ID_AUTOPATCHER_GET_PATCH,
209 ID_AUTOPATCHER_PATCH_LIST,
211 ID_AUTOPATCHER_REPOSITORY_FATAL_ERROR,
213 ID_AUTOPATCHER_CANNOT_DOWNLOAD_ORIGINAL_UNMODIFIED_FILES,
215 ID_AUTOPATCHER_FINISHED_INTERNAL,
216 ID_AUTOPATCHER_FINISHED,
218 ID_AUTOPATCHER_RESTART_APPLICATION,
219
221 ID_NAT_PUNCHTHROUGH_REQUEST,
223 //ID_NAT_GROUP_PUNCHTHROUGH_REQUEST,
225 //ID_NAT_GROUP_PUNCHTHROUGH_REPLY,
227 ID_NAT_CONNECT_AT_TIME,
229 ID_NAT_GET_MOST_RECENT_PORT,
231 ID_NAT_CLIENT_READY,
233 //ID_NAT_GROUP_PUNCHTHROUGH_FAILURE_NOTIFICATION,
234
237 ID_NAT_TARGET_NOT_CONNECTED,
240 ID_NAT_TARGET_UNRESPONSIVE,
244 ID_NAT_CONNECTION_TO_TARGET_LOST,
247 ID_NAT_ALREADY_IN_PROGRESS,
250 ID_NAT_PUNCHTHROUGH_FAILED,
253 ID_NAT_PUNCHTHROUGH_SUCCEEDED,
254
257 ID_READY_EVENT_SET,
260 ID_READY_EVENT_UNSET,
263 ID_READY_EVENT_ALL_SET,
266 ID_READY_EVENT_QUERY,
267
269 ID_LOBBY_GENERAL,
270
271 // RPC3, RPC4 error
272 ID_RPC_REMOTE_ERROR,
274 ID_RPC_PLUGIN,
275
277 ID_FILE_LIST_REFERENCE_PUSH,
279 ID_READY_EVENT_FORCE_ALL_SET,
280
282 ID_ROOMS_EXECUTE_FUNC,
283 ID_ROOMS_LOGON_STATUS,
284 ID_ROOMS_HANDLE_CHANGE,
285
287 ID_LOBBY2_SEND_MESSAGE,
288 ID_LOBBY2_SERVER_ERROR,
289
293 ID_FCM2_NEW_HOST,
295 ID_FCM2_REQUEST_FCMGUID,
297 ID_FCM2_RESPOND_CONNECTION_COUNT,
299 ID_FCM2_INFORM_FCMGUID,
301 ID_FCM2_UPDATE_MIN_TOTAL_CONNECTION_COUNT,
310 ID_FCM2_VERIFIED_JOIN_START,
312 ID_FCM2_VERIFIED_JOIN_CAPABLE,
318 ID_FCM2_VERIFIED_JOIN_FAILED,
324 ID_FCM2_VERIFIED_JOIN_ACCEPTED,
331 ID_FCM2_VERIFIED_JOIN_REJECTED,
332
334 ID_UDP_PROXY_GENERAL,
335
337 ID_SQLite3_EXEC,
339 ID_SQLite3_UNKNOWN_DB,
341 ID_SQLLITE_LOGGER,
342
344 ID_NAT_TYPE_DETECTION_REQUEST,
346 ID_NAT_TYPE_DETECTION_RESULT,
347
349 ID_ROUTER_2_INTERNAL,
352 ID_ROUTER_2_FORWARDING_NO_PATH,
366 ID_ROUTER_2_FORWARDING_ESTABLISHED,
369 ID_ROUTER_2_REROUTED,
370
372 ID_TEAM_BALANCER_INTERNAL,
376 ID_TEAM_BALANCER_REQUESTED_TEAM_FULL,
380 ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED,
381 ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED,
383 ID_TEAM_BALANCER_TEAM_ASSIGNED,
384
386 ID_LIGHTSPEED_INTEGRATION,
387
389 ID_XBOX_LOBBY,
390
394 ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS,
395 ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS,
398 ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE,
402 ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE,
406 ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT,
408 ID_TWO_WAY_AUTHENTICATION_NEGOTIATION,
409
411 ID_CLOUD_POST_REQUEST,
412 ID_CLOUD_RELEASE_REQUEST,
413 ID_CLOUD_GET_REQUEST,
414 ID_CLOUD_GET_RESPONSE,
415 ID_CLOUD_UNSUBSCRIBE_REQUEST,
416 ID_CLOUD_SERVER_TO_SERVER_COMMAND,
417 ID_CLOUD_SUBSCRIPTION_NOTIFICATION,
418
419 // LibVoice
420 ID_LIB_VOICE,
421
422 ID_RELAY_PLUGIN,
423 ID_NAT_REQUEST_BOUND_ADDRESSES,
424 ID_NAT_RESPOND_BOUND_ADDRESSES,
425 ID_FCM2_UPDATE_USER_CONTEXT,
426 ID_RESERVED_3,
427 ID_RESERVED_4,
428 ID_RESERVED_5,
429 ID_RESERVED_6,
430 ID_RESERVED_7,
431 ID_RESERVED_8,
432 ID_RESERVED_9,
433
434 // For the user to use. Start your first enumeration at this value.
435 ID_USER_PACKET_ENUM
436 //-------------------------------------------------------------------------------------------------------------
437
438 };
439
440 #endif // RAKNET_USE_CUSTOM_PACKET_IDS
441
442 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • TableSerializer
SLNet::TableSerializer Member List

This is the complete list of members for SLNet::TableSerializer, including all inherited members.

DeallocateQueryList(DataStructures::Table::FilterQuery *query, unsigned int numQueries) | SLNet::TableSerializer | static
DeserializeCell(SLNet::BitStream *in, DataStructures::Table::Cell *cell, DataStructures::Table::ColumnType columnType) | SLNet::TableSerializer | static
DeserializeColumns(SLNet::BitStream *in, DataStructures::Table *out) | SLNet::TableSerializer | static
DeserializeFilterQuery(SLNet::BitStream *out, DataStructures::Table::FilterQuery *query) | SLNet::TableSerializer | static
DeserializeFilterQueryList(SLNet::BitStream *out, DataStructures::Table::FilterQuery **query, unsigned int *numQueries, unsigned int maxQueries, int allocateExtraQueries=0) | SLNet::TableSerializer | static
DeserializeRow(SLNet::BitStream *in, DataStructures::Table *out) | SLNet::TableSerializer | static
DeserializeTable(unsigned char *serializedTable, unsigned int dataLength, DataStructures::Table *out) | SLNet::TableSerializer | static
DeserializeTable(SLNet::BitStream *in, DataStructures::Table *out) | SLNet::TableSerializer | static
SerializeCell(SLNet::BitStream *out, DataStructures::Table::Cell *cell, DataStructures::Table::ColumnType columnType) | SLNet::TableSerializer | static
SerializeColumns(DataStructures::Table *in, SLNet::BitStream *out) | SLNet::TableSerializer | static
SerializeColumns(DataStructures::Table *in, SLNet::BitStream *out, DataStructures::List< int > &skipColumnIndices) | SLNet::TableSerializer | static
SerializeFilterQuery(SLNet::BitStream *in, DataStructures::Table::FilterQuery *query) | SLNet::TableSerializer | static
SerializeFilterQueryList(SLNet::BitStream *in, DataStructures::Table::FilterQuery *query, unsigned int numQueries, unsigned int maxQueries) | SLNet::TableSerializer | static
SerializeRow(DataStructures::Table::Row *in, unsigned keyIn, const DataStructures::List< DataStructures::Table::ColumnDescriptor > &columns, SLNet::BitStream *out) | SLNet::TableSerializer | static
SerializeRow(DataStructures::Table::Row *in, unsigned keyIn, const DataStructures::List< DataStructures::Table::ColumnDescriptor > &columns, SLNet::BitStream *out, DataStructures::List< int > &skipColumnIndices) | SLNet::TableSerializer | static
SerializeTable(DataStructures::Table *in, SLNet::BitStream *out) | SLNet::TableSerializer | static
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StatisticsHistory
SLNet::StatisticsHistory Member List

This is the complete list of members for SLNet::StatisticsHistory, including all inherited members.

AddObject(TrackedObjectData tod) | SLNet::StatisticsHistory |
AddValueByIndex(unsigned int index, RakString key, SHValueType val, Time curTime, bool combineEqualTimes) | SLNet::StatisticsHistory |
AddValueByObjectID(uint64_t objectId, RakString key, SHValueType val, Time curTime, bool combineEqualTimes) | SLNet::StatisticsHistory |
Clear(void) | SLNet::StatisticsHistory |
DC_CONTINUOUS enum value | SLNet::StatisticsHistory |
DC_DISCRETE enum value | SLNet::StatisticsHistory |
GetDefaultTimeToTrack(void) const | SLNet::StatisticsHistory |
GetHistoryForKey(uint64_t objectId, RakString key, TimeAndValueQueue **values, Time curTime) const | SLNet::StatisticsHistory |
GetHistorySorted(uint64_t objectId, SHSortOperation sortType, DataStructures::List< TimeAndValueQueue * > &values) const | SLNet::StatisticsHistory |
GetObjectAtIndex(unsigned int index) const | SLNet::StatisticsHistory |
GetObjectCount(void) const | SLNet::StatisticsHistory |
GetObjectIndex(uint64_t objectId) const | SLNet::StatisticsHistory |
GetUniqueKeyList(DataStructures::List< RakString > &keys) | SLNet::StatisticsHistory |
MergeAllObjectsOnKey(RakString key, TimeAndValueQueue *tavqOutput, SHDataCategory dataCategory) const | SLNet::StatisticsHistory |
objects | SLNet::StatisticsHistory | protected
RemoveObject(uint64_t objectId, void **userData) | SLNet::StatisticsHistory |
RemoveObjectAtIndex(unsigned int index) | SLNet::StatisticsHistory |
SetDefaultTimeToTrack(Time defaultTimeToTrack) | SLNet::StatisticsHistory |
SH_DO_NOT_SORT enum value | SLNet::StatisticsHistory |
SH_INVALID_PARAMETER enum value | SLNet::StatisticsHistory |
SH_OK enum value | SLNet::StatisticsHistory |
SH_SORT_BY_LONG_TERM_AVERAGE_ASCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_LONG_TERM_AVERAGE_DESCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_LONG_TERM_HIGHEST_ASCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_LONG_TERM_HIGHEST_DESCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_LONG_TERM_LOWEST_ASCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_LONG_TERM_LOWEST_DESCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_LONG_TERM_SUM_ASCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_LONG_TERM_SUM_DESCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_AVERAGE_ASCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_AVERAGE_DESCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_HIGHEST_ASCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_HIGHEST_DESCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_LOWEST_ASCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_LOWEST_DESCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_SUM_ASCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_SUM_DESCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_SUM_OF_SQUARES_ASCENDING enum value | SLNet::StatisticsHistory |
SH_SORT_BY_RECENT_SUM_OF_SQUARES_DESCENDING enum value | SLNet::StatisticsHistory |
SH_UKNOWN_KEY enum value | SLNet::StatisticsHistory |
SH_UKNOWN_OBJECT enum value | SLNet::StatisticsHistory |
SHDataCategory enum name | SLNet::StatisticsHistory |
SHErrorCode enum name | SLNet::StatisticsHistory |
SHSortOperation enum name | SLNet::StatisticsHistory |
StatisticsHistory() | SLNet::StatisticsHistory |
timeToTrack | SLNet::StatisticsHistory | protected
TrackedObjectComp(const uint64_t &key, TrackedObject *const &data) | SLNet::StatisticsHistory | static
~StatisticsHistory() | SLNet::StatisticsHistory | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • Replica3Composite
SLNet::Replica3Composite< parent_type > Member List

This is the complete list of members for SLNet::Replica3Composite< parent_type >, including all inherited members.

BroadcastDestruction(void) | SLNet::Replica3 | virtual
creatingSystemGUID | SLNet::Replica3 |
DeallocReplica(SLNet::Connection_RM3 *sourceConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
deletingSystemGUID | SLNet::Replica3 |
Deserialize(SLNet::DeserializeParameters *deserializeParameters) | SLNet::Replica3Composite< parent_type > | inlinevirtual
DeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
DeserializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
DeserializeDestruction(SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *sourceConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
forceSendUntilNextUpdate | SLNet::Replica3 |
GetCompositeOwner(void) const | SLNet::Replica3Composite< parent_type > | inline
GetCreatingSystemGUID(void) const | SLNet::Replica3 |
GetNetworkID(void) | SLNet::NetworkIDObject | virtual
GetNetworkIDManager(void) const | SLNet::NetworkIDObject | virtual
GetParent(void) const | SLNet::NetworkIDObject | virtual
lastSentSerialization | SLNet::Replica3 |
lsr | SLNet::Replica3 |
networkID | SLNet::NetworkIDObject | protected
networkIDManager | SLNet::NetworkIDObject | protected
NetworkIDObject() | SLNet::NetworkIDObject |
nextInstanceForNetworkIDManager | SLNet::NetworkIDObject | protected
OnPoppedConnection(SLNet::Connection_RM3 *droppedConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
OnSerializeTransmission(SLNet::BitStream *bitStream, SLNet::Connection_RM3 *destinationConnection, SLNet::BitSize_t bitsPerChannel[SLNet::RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time curTime) | SLNet::Replica3Composite< parent_type > | inlinevirtual
SLNet::Replica3::OnSerializeTransmission(SLNet::BitStream *bitStream, SLNet::Connection_RM3 *destinationConnection, BitSize_t bitsPerChannel[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time curTime) | SLNet::Replica3 | inlinevirtual
OnUserReplicaPreSerializeTick(void) | SLNet::Replica3Composite< parent_type > | inlinevirtual
parent | SLNet::NetworkIDObject | protected
PostDeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
PostDeserializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
PostSerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
PostSerializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
PreDestruction(SLNet::Connection_RM3 *sourceConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
QueryActionOnPopConnection(SLNet::Connection_RM3 *droppedConnection) const | SLNet::Replica3Composite< parent_type > | inlinevirtual
QueryActionOnPopConnection_Client(SLNet::Connection_RM3 *droppedConnection) const | SLNet::Replica3 | virtual
QueryActionOnPopConnection_PeerToPeer(SLNet::Connection_RM3 *droppedConnection) const | SLNet::Replica3 | virtual
QueryActionOnPopConnection_Server(SLNet::Connection_RM3 *droppedConnection) const | SLNet::Replica3 | virtual
QueryConstruction(SLNet::Connection_RM3 *destinationConnection, SLNet::ReplicaManager3 *replicaManager3) | SLNet::Replica3Composite< parent_type > | inlinevirtual
QueryConstruction_ClientConstruction(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer) | SLNet::Replica3 | virtual
QueryConstruction_PeerToPeer(SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER) | SLNet::Replica3 | virtual
QueryConstruction_ServerConstruction(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer) | SLNet::Replica3 | virtual
QueryDestruction(SLNet::Connection_RM3 *destinationConnection, SLNet::ReplicaManager3 *replicaManager3) | SLNet::Replica3Composite< parent_type > | inlinevirtual
QueryRelayDestruction(SLNet::Connection_RM3 *sourceConnection) const | SLNet::Replica3Composite< parent_type > | inlinevirtual
QueryRemoteConstruction(SLNet::Connection_RM3 *sourceConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
QueryRemoteConstruction_ClientConstruction(SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer) | SLNet::Replica3 | virtual
QueryRemoteConstruction_PeerToPeer(SLNet::Connection_RM3 *sourceConnection) | SLNet::Replica3 | virtual
QueryRemoteConstruction_ServerConstruction(SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer) | SLNet::Replica3 | virtual
QuerySerialization(SLNet::Connection_RM3 *destinationConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
QuerySerialization_ClientSerializable(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer) | SLNet::Replica3 | virtual
QuerySerialization_PeerToPeer(SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER) | SLNet::Replica3 | virtual
QuerySerialization_ServerSerializable(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer) | SLNet::Replica3 | virtual
r3CompositeOwner | SLNet::Replica3Composite< parent_type > | protected
referenceIndex | SLNet::Replica3 |
Replica3() | SLNet::Replica3 |
replicaManager | SLNet::Replica3 |
Serialize(SLNet::SerializeParameters *serializeParameters) | SLNet::Replica3Composite< parent_type > | inlinevirtual
SerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
SerializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
SerializeDestruction(SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *destinationConnection) | SLNet::Replica3Composite< parent_type > | inlinevirtual
SetCompositeOwner(parent_type *p) | SLNet::Replica3Composite< parent_type > | inline
SetNetworkID(NetworkID id) | SLNet::NetworkIDObject | virtual
SetNetworkIDManager(NetworkIDManager *manager) | SLNet::NetworkIDObject | virtual
SetParent(void *_parent) | SLNet::NetworkIDObject | virtual
WasReferenced(void) const | SLNet::Replica3 | inline
WriteAllocationID(SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const | SLNet::Replica3Composite< parent_type > | inlinevirtual
~NetworkIDObject() | SLNet::NetworkIDObject | virtual
~Replica3() | SLNet::Replica3 | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/HTTPConnection2.h Source File

  • include
  • slikenet
HTTPConnection2.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_HTTPConnection2==1 && _RAKNET_SUPPORT_TCPInterface==1
22
23 #ifndef __HTTP_CONNECTION_2
24 #define __HTTP_CONNECTION_2
25
26 #include "Export.h"
27 #include "string.h"
28 #include "memoryoverride.h"
29 #include "types.h"
30 #include "DS_List.h"
31 #include "DS_Queue.h"
32 #include "PluginInterface2.h"
33 #include "SimpleMutex.h"
34
35 namespace SLNet
36 {
38 class TCPInterface;
39 struct SystemAddress;
40
44 class RAK_DLL_EXPORT HTTPConnection2 : public PluginInterface2
45 {
46 public:
47 // GetInstance() and DestroyInstance(instance*)
48 STATIC_FACTORY_DECLARATIONS(HTTPConnection2)
49
50 HTTPConnection2();
51 virtual ~HTTPConnection2();
52
63 bool TransmitRequest(const char* stringToTransmit, const char* host, unsigned short port=80, bool useSSL=false, int ipVersion=4, SystemAddress useAddress=UNASSIGNED_SYSTEM_ADDRESS, void *userData=0);
64
76 bool GetResponse( RakString &stringTransmitted, RakString &hostTransmitted, RakString &responseReceived, SystemAddress &hostReceived, ptrdiff_t &contentOffset, void **userData );
77 bool GetResponse( RakString &stringTransmitted, RakString &hostTransmitted, RakString &responseReceived, SystemAddress &hostReceived, ptrdiff_t &contentOffset );
78
80 bool IsBusy(void) const;
81
83 bool HasResponse(void) const;
84
85 struct Request
86 {
87 RakString stringToTransmit;
88 RakString stringReceived;
89 RakString host;
90 SystemAddress hostEstimatedAddress;
91 SystemAddress hostCompletedAddress;
92 unsigned short port;
93 bool useSSL;
94 ptrdiff_t contentOffset;
95 int contentLength;
96 int ipVersion;
97 void *userData;
98 bool chunked;
99 size_t thisChunkSize;
100 size_t bytesReadForThisChunk;
101 };
102
104 virtual PluginReceiveResult OnReceive(Packet *packet);
105 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
106 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
107 virtual void OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason);
108
109 protected:
110
111 bool IsConnected(SystemAddress sa);
112 void SendRequest(Request *request);
113 void RemovePendingRequest(SystemAddress sa);
114 void SendNextPendingRequest(void);
115 void SendPendingRequestToConnectedSystem(SystemAddress sa);
116
117 DataStructures::Queue<Request*> pendingRequests;
118 DataStructures::List<Request*> sentRequests;
119 DataStructures::List<Request*> completedRequests;
120
121 SimpleMutex pendingRequestsMutex, sentRequestsMutex, completedRequestsMutex;
122
123 };
124
125 } // namespace SLNet
126
127 #endif
128
129 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SecureHandshake.cpp Source File

  • src
SecureHandshake.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #include "slikenet/NativeFeatureIncludes.h"
21
22 #if LIBCAT_SECURITY==1
23
24 // If building a RakNet DLL, be sure to tweak the CAT_EXPORT macro meaning
25 #if !defined(_RAKNET_LIB) && defined(_RAKNET_DLL)
26 # define CAT_BUILD_DLL
27 #else
28 # define CAT_NEUTER_EXPORT
29 #endif
30
31 #include "cat/src/port/EndianNeutral.cpp"
32 #include "cat/src/port/AlignedAlloc.cpp"
33 #include "cat/src/time/Clock.cpp"
34 #include "cat/src/threads/Mutex.cpp"
35 #include "cat/src/threads/Thread.cpp"
36 #include "cat/src/threads/WaitableFlag.cpp"
37 #include "cat/src/hash/MurmurHash2.cpp"
38 #include "cat/src/lang/Strings.cpp"
39
40 #include "cat/src/math/BigRTL.cpp"
41 #include "cat/src/math/BigPseudoMersenne.cpp"
42 #include "cat/src/math/BigTwistedEdwards.cpp"
43
44 #include "cat/src/crypt/SecureCompare.cpp"
45 #include "cat/src/crypt/cookie/CookieJar.cpp"
46 #include "cat/src/crypt/hash/HMAC_MD5.cpp"
47 #include "cat/src/crypt/privatekey/ChaCha.cpp"
48 #include "cat/src/crypt/hash/Skein.cpp"
49 #include "cat/src/crypt/hash/Skein256.cpp"
50 #include "cat/src/crypt/hash/Skein512.cpp"
51 #include "cat/src/crypt/pass/Passwords.cpp"
52
53 #include "cat/src/crypt/rand/EntropyWindows.cpp"
54 #include "cat/src/crypt/rand/EntropyLinux.cpp"
55 #include "cat/src/crypt/rand/EntropyWindowsCE.cpp"
56 #include "cat/src/crypt/rand/EntropyGeneric.cpp"
57 #ifdef _M_X64
58 #pragma warning(push)
59 #pragma warning(disable:4838)
60 #endif
61 #include "cat/src/crypt/rand/Fortuna.cpp"
62 #ifdef _M_X64
63 #pragma warning(pop)
64 #endif
65
66 #include "cat/src/crypt/tunnel/KeyAgreement.cpp"
67 #include "cat/src/crypt/tunnel/AuthenticatedEncryption.cpp"
68 #include "cat/src/crypt/tunnel/KeyAgreementInitiator.cpp"
69 #include "cat/src/crypt/tunnel/KeyAgreementResponder.cpp"
70 #include "cat/src/crypt/tunnel/KeyMaker.cpp"
71
72 #include "cat/src/crypt/tunnel/EasyHandshake.cpp"
73
74 #endif // LIBCAT_SECURITY
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ReplicaManager3.h Source File

  • include
  • slikenet
ReplicaManager3.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_ReplicaManager3==1
23
24 #ifndef __REPLICA_MANAGER_3
25 #define __REPLICA_MANAGER_3
26
27 #include "types.h"
28 #include "time.h"
29 #include "BitStream.h"
30 #include "PacketPriority.h"
31 #include "PluginInterface2.h"
32 #include "NetworkIDObject.h"
33 #include "DS_OrderedList.h"
34 #include "DS_Queue.h"
35
40
41 namespace SLNet
42 {
43 class Connection_RM3;
44 class Replica3;
45
48 typedef uint8_t WorldId;
49
50
53 struct PRO
54 {
56 PacketPriority priority;
57
59 PacketReliability reliability;
60
62 char orderingChannel;
63
65 uint32_t sendReceipt;
66
67 bool operator==( const PRO& right ) const;
68 bool operator!=( const PRO& right ) const;
69 };
70
71
86 class RAK_DLL_EXPORT ReplicaManager3 : public PluginInterface2
87 {
88 public:
89 ReplicaManager3();
90 virtual ~ReplicaManager3();
91
102 virtual Connection_RM3* AllocConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID) const=0;
103
108 virtual void DeallocConnection(Connection_RM3 *connection) const=0;
109
117 void SetAutoManageConnections(bool autoCreate, bool autoDestroy);
118
120 bool GetAutoCreateConnections(void) const;
121
123 bool GetAutoDestroyConnections(void) const;
124
129 void AutoCreateConnectionList(
130 DataStructures::List<RakNetGUID> &participantListIn,
131 DataStructures::List<Connection_RM3*> &participantListOut,
132 WorldId worldId=0);
133
139 bool PushConnection(SLNet::Connection_RM3 *newConnection, WorldId worldId=0);
140
146 SLNet::Connection_RM3 * PopConnection(RakNetGUID guid, WorldId worldId=0);
147
154 void Reference(SLNet::Replica3 *replica3, WorldId worldId=0);
155
161 void Dereference(SLNet::Replica3 *replica3, WorldId worldId=0);
162
168 void DereferenceList(DataStructures::List<Replica3*> &replicaListIn, WorldId worldId=0);
169
176 void GetReplicasCreatedByGuid(RakNetGUID guid, DataStructures::List<Replica3*> &replicaListOut, WorldId worldId=0);
177
182 void GetReplicasCreatedByMe(DataStructures::List<Replica3*> &replicaListOut, WorldId worldId=0);
183
188 void GetReferencedReplicaList(DataStructures::List<Replica3*> &replicaListOut, WorldId worldId=0);
189
194 unsigned GetReplicaCount(WorldId worldId=0) const;
195
201 Replica3 *GetReplicaAtIndex(unsigned index, WorldId worldId=0);
202
207 unsigned int GetConnectionCount(WorldId worldId=0) const;
208
213 Connection_RM3* GetConnectionAtIndex(unsigned index, WorldId worldId=0) const;
214
219 Connection_RM3* GetConnectionBySystemAddress(const SystemAddress &sa, WorldId worldId=0) const;
220
225 Connection_RM3* GetConnectionByGUID(RakNetGUID guid, WorldId worldId=0) const;
226
228 void SetDefaultOrderingChannel(char def);
229
231 void SetDefaultPacketPriority(PacketPriority def);
232
234 void SetDefaultPacketReliability(PacketReliability def);
235
241 void SetAutoSerializeInterval(SLNet::Time intervalMS);
242
248 void GetConnectionsThatHaveReplicaConstructed(Replica3 *replica, DataStructures::List<Connection_RM3*> &connectionsThatHaveConstructedThisReplica, WorldId worldId=0);
249
253 bool GetAllConnectionDownloadsCompleted(WorldId worldId=0) const;
254
258 void AddWorld(WorldId worldId);
259
263 void RemoveWorld(WorldId worldId);
264
269 WorldId GetWorldIdAtIndex(unsigned int index);
270
273 unsigned int GetWorldCount(void) const;
274
280 void SetNetworkIDManager(NetworkIDManager *_networkIDManager, WorldId worldId=0);
281
284 NetworkIDManager *GetNetworkIDManager(WorldId worldId=0) const;
285
292 void BroadcastDestructionList(DataStructures::List<Replica3*> &replicaListSource, const SystemAddress &exclusionAddress, WorldId worldId=0);
293
297 void BroadcastDestruction(Replica3 *replica, const SystemAddress &exclusionAddress);
298
303 void Clear(bool deleteWorlds=false);
304
306 PRO GetDefaultSendParameters(void) const;
307
309 virtual void Update(void);
310
312 struct RM3World
313 {
314 RM3World();
315 void Clear(ReplicaManager3 *replicaManager3);
316
317 DataStructures::List<Connection_RM3*> connectionList;
318 DataStructures::List<Replica3*> userReplicaList;
319 WorldId worldId;
320 NetworkIDManager *networkIDManager;
321 };
322 protected:
323 virtual PluginReceiveResult OnReceive(Packet *packet);
324 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
325 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
326 virtual void OnRakPeerShutdown(void);
327 virtual void OnDetach(void);
328
329 PluginReceiveResult OnConstruction(Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId);
330 PluginReceiveResult OnSerialize(Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, SLNet::Time timestamp, unsigned char packetDataOffset, WorldId worldId);
331 PluginReceiveResult OnDownloadStarted(Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId);
332 PluginReceiveResult OnDownloadComplete(Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId);
333
334 void DeallocReplicaNoBroadcastDestruction(SLNet::Connection_RM3 *connection, SLNet::Replica3 *replica3);
335 SLNet::Connection_RM3 * PopConnection(unsigned int index, WorldId worldId);
336 Replica3* GetReplicaByNetworkID(NetworkID networkId, WorldId worldId);
337 unsigned int ReferenceInternal(SLNet::Replica3 *replica3, WorldId worldId);
338
339 PRO defaultSendParameters;
340 SLNet::Time autoSerializeInterval;
341 SLNet::Time lastAutoSerializeOccurance;
342 bool autoCreateConnections, autoDestroyConnections;
343 Replica3 *currentlyDeallocatingReplica;
344 // Set on the first call to ReferenceInternal(), and should never be changed after that
345 // Used to lookup in Replica3LSRComp. I don't want to rely on GetNetworkID() in case it changes at runtime
346 uint32_t nextReferenceIndex;
347
348 // For O(1) lookup
349 RM3World *worldsArray[255];
350 // For fast traversal
351 DataStructures::List<RM3World *> worldsList;
352
353 friend class Connection_RM3;
354 };
355
356 static const int RM3_NUM_OUTPUT_BITSTREAM_CHANNELS=16;
357
359 struct LastSerializationResultBS
360 {
361 SLNet::BitStream bitStream[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
362 bool indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
363 };
364
367 struct LastSerializationResult
368 {
369 LastSerializationResult();
370 ~LastSerializationResult();
371
374 SLNet::Replica3 *replica;
375 //bool neverSerialize;
376 // bool isConstructed;
377 SLNet::Time whenLastSerialized;
378
379 void AllocBS(void);
380 LastSerializationResultBS* lastSerializationResultBS;
381 };
382
385 struct SerializeParameters
386 {
390 SLNet::BitStream outputBitstream[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
391
394 SLNet::BitStream* lastSentBitstream[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
395
399 SLNet::Time messageTimestamp;
400
404 PRO pro[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
405
407 SLNet::Connection_RM3 *destinationConnection;
408
411 BitSize_t bitsWrittenSoFar;
412
415 SLNet::Time whenLastSerialized;
416
419 SLNet::Time curTime;
420 };
421
423 struct DeserializeParameters
424 {
425 SLNet::BitStream serializationBitstream[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
426 bool bitstreamWrittenTo[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS];
427 SLNet::Time timeStamp;
428 SLNet::Connection_RM3 *sourceConnection;
429 };
430
432 enum SendSerializeIfChangedResult
433 {
434 SSICR_SENT_DATA,
435 SSICR_DID_NOT_SEND_DATA,
436 SSICR_NEVER_SERIALIZE,
437 };
438
442 class RAK_DLL_EXPORT Connection_RM3
443 {
444 public:
445
446 Connection_RM3(const SystemAddress &_systemAddress, RakNetGUID _guid);
447 virtual ~Connection_RM3();
448
460 virtual Replica3 *AllocReplica(SLNet::BitStream *allocationIdBitstream, ReplicaManager3 *replicaManager3)=0;
461
464 virtual void GetConstructedReplicas(DataStructures::List<Replica3*> &objectsTheyDoHave);
465
469 bool HasReplicaConstructed(SLNet::Replica3 *replica);
470
473 virtual void SerializeOnDownloadStarted(SLNet::BitStream *bitStream) {(void) bitStream;}
474
477 virtual void DeserializeOnDownloadStarted(SLNet::BitStream *bitStream) {(void) bitStream;}
478
481 virtual void SerializeOnDownloadComplete(SLNet::BitStream *bitStream) {(void) bitStream;}
482
485 virtual void DeserializeOnDownloadComplete(SLNet::BitStream *bitStream) {(void) bitStream;}
486
488 SystemAddress GetSystemAddress(void) const {return systemAddress;}
489
491 RakNetGUID GetRakNetGUID(void) const {return guid;}
492
494 bool GetDownloadWasCompleted(void) const {return gotDownloadComplete;}
495
497 enum ConstructionMode
498 {
502 QUERY_REPLICA_FOR_CONSTRUCTION,
503
507 QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION,
508
513 QUERY_CONNECTION_FOR_REPLICA_LIST
514 };
515
524 virtual bool QueryGroupDownloadMessages(void) const {return false;}
525
531 virtual ConstructionMode QueryConstructionMode(void) const {return QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION;}
532
541 virtual void QueryReplicaList(
542 DataStructures::List<Replica3*> &newReplicasToCreate,
543 DataStructures::List<Replica3*> &existingReplicasToDestroy) {(void) newReplicasToCreate; (void) existingReplicasToDestroy;}
544
557 virtual bool QuerySerializationList(DataStructures::List<Replica3*> &replicasToSerialize) {(void) replicasToSerialize; return false;}
558
569 virtual SendSerializeIfChangedResult SendSerialize(SLNet::Replica3 *replica, bool indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::BitStream serializationData[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time timestamp, PRO sendParameters[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::RakPeerInterface *rakPeer, unsigned char worldId, SLNet::Time curTime);
570
579 virtual SendSerializeIfChangedResult SendSerializeIfChanged(LastSerializationResult *lsr, SerializeParameters *sp, SLNet::RakPeerInterface *rakPeer, unsigned char worldId, ReplicaManager3 *replicaManager, SLNet::Time curTime);
580
589 virtual void SendConstruction(DataStructures::List<Replica3*> &newObjects, DataStructures::List<Replica3*> &deletedObjects, PRO sendParameters, SLNet::RakPeerInterface *rakPeer, unsigned char worldId, ReplicaManager3 *replicaManager3);
590
592 void SendValidation(SLNet::RakPeerInterface *rakPeer, WorldId worldId);
593
595 void AutoConstructByQuery(ReplicaManager3 *replicaManager3, WorldId worldId);
596
597
598 // Internal - does the other system have this connection too? Validated means we can now use it
599 bool isValidated;
600 // Internal - Used to see if we should send download started
601 bool isFirstConstruction;
602
603 static int Replica3LSRComp( Replica3 * const &replica3, LastSerializationResult * const &data );
604
605 // Internal
606 void ClearDownloadGroup(RakPeerInterface *rakPeerInterface);
607 protected:
608
609 SystemAddress systemAddress;
610 RakNetGUID guid;
611
612 /*
613 Operations:
614
615 Locally reference a new replica:
616 Add to queryToConstructReplicaList for all objects
617
618 Add all objects to queryToConstructReplicaList
619
620 Download:
621 Add to constructedReplicaList for connection that send the object to us
622 Add to queryToSerializeReplicaList for connection that send the object to us
623 Add to queryToConstructReplicaList for all other connections
624
625 Never construct for this connection:
626 Remove from queryToConstructReplicaList
627
628 Construct to this connection
629 Remove from queryToConstructReplicaList
630 Add to constructedReplicaList for this connection
631 Add to queryToSerializeReplicaList for this connection
632
633 Serialize:
634 Iterate through queryToSerializeReplicaList
635
636 Never serialize for this connection
637 Remove from queryToSerializeReplicaList
638
639 Reference (this system has this object already)
640 Remove from queryToConstructReplicaList
641 Add to constructedReplicaList for this connection
642 Add to queryToSerializeReplicaList for this connection
643
644 Downloaded an existing object
645 if replica is in queryToConstructReplicaList, OnConstructToThisConnection()
646 else ignore
647
648 Send destruction from query
649 Remove from queryToDestructReplicaList
650 Remove from queryToSerializeReplicaList
651 Remove from constructedReplicaList
652 Add to queryToConstructReplicaList
653
654 Do not query destruction again
655 Remove from queryToDestructReplicaList
656 */
657 void OnLocalReference(Replica3* replica3, ReplicaManager3 *replicaManager);
658 void OnDereference(Replica3* replica3, ReplicaManager3 *replicaManager);
659 void OnDownloadFromThisSystem(Replica3* replica3, ReplicaManager3 *replicaManager);
660 void OnDownloadFromOtherSystem(Replica3* replica3, ReplicaManager3 *replicaManager);
661 void OnNeverConstruct(unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager);
662 void OnConstructToThisConnection(unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager);
663 void OnConstructToThisConnection(Replica3 *replica, ReplicaManager3 *replicaManager);
664 void OnNeverSerialize(LastSerializationResult *lsr, ReplicaManager3 *replicaManager);
665 void OnReplicaAlreadyExists(unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager);
666 void OnDownloadExisting(Replica3* replica3, ReplicaManager3 *replicaManager);
667 void OnSendDestructionFromQuery(unsigned int queryToDestructIdx, ReplicaManager3 *replicaManager);
668 void OnDoNotQueryDestruction(unsigned int queryToDestructIdx, ReplicaManager3 *replicaManager);
669 void ValidateLists(ReplicaManager3 *replicaManager) const;
670 void SendSerializeHeader(SLNet::Replica3 *replica, SLNet::Time timestamp, SLNet::BitStream *bs, WorldId worldId);
671
672 // The list of objects that our local system and this remote system both have
673 // Either we sent this object to them, or they sent this object to us
674 // A given Replica can be either in queryToConstructReplicaList or constructedReplicaList but not both at the same time
675 DataStructures::OrderedList<Replica3*, LastSerializationResult*, Connection_RM3::Replica3LSRComp> constructedReplicaList;
676
677 // Objects that we have, but this system does not, and we will query each tick to see if it should be sent to them
678 // If we do send it to them, the replica is moved to constructedReplicaList
679 // A given Replica can be either in queryToConstructReplicaList or constructedReplicaList but not both at the same time
680 DataStructures::List<LastSerializationResult*> queryToConstructReplicaList;
681
682 // Objects that this system has constructed are added at the same time to queryToSerializeReplicaList
683 // This list is used to serialize all objects that this system has to this connection
684 DataStructures::List<LastSerializationResult*> queryToSerializeReplicaList;
685
686 // Objects that are constructed on this system are also queried if they should be destroyed to this system
687 DataStructures::List<LastSerializationResult*> queryToDestructReplicaList;
688
689 // Working lists
690 DataStructures::List<Replica3*> constructedReplicasCulled, destroyedReplicasCulled;
691
692 // This is used if QueryGroupDownloadMessages() returns true when ID_REPLICA_MANAGER_DOWNLOAD_STARTED arrives
693 // Packets will be gathered and not returned until ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE arrives
694 bool groupConstructionAndSerialize;
695 DataStructures::Queue<Packet*> downloadGroup;
696
697 // Stores if we got download complete for this connection
698 bool gotDownloadComplete;
699
700 friend class ReplicaManager3;
701 private:
702 Connection_RM3() {};
703
704 ConstructionMode constructionMode;
705 };
706
710 enum RM3ConstructionState
711 {
715 RM3CS_SEND_CONSTRUCTION,
716
722 RM3CS_ALREADY_EXISTS_REMOTELY,
723
725 RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT,
726
729 RM3CS_NEVER_CONSTRUCT,
730
732 RM3CS_NO_ACTION,
733
735 RM3CS_MAX,
736 };
737
740 enum RM3DestructionState
741 {
743 RM3DS_SEND_DESTRUCTION,
744
746 RM3DS_DO_NOT_QUERY_DESTRUCTION,
747
749 RM3DS_NO_ACTION,
750
752 RM3DS_MAX,
753 };
754
757 enum RM3SerializationResult
758 {
762 RM3SR_BROADCAST_IDENTICALLY,
763
769 RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION,
770
774 RM3SR_SERIALIZED_UNIQUELY,
775
780 RM3SR_SERIALIZED_ALWAYS,
781
783 RM3SR_SERIALIZED_ALWAYS_IDENTICALLY,
784
786 RM3SR_DO_NOT_SERIALIZE,
787
791 RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION,
792
794 RM3SR_MAX,
795 };
796
799 enum RM3QuerySerializationResult
800 {
802 RM3QSR_CALL_SERIALIZE,
804 RM3QSR_DO_NOT_CALL_SERIALIZE,
806 RM3QSR_NEVER_CALL_SERIALIZE,
808 RM3QSR_MAX,
809 };
810
812 enum RM3ActionOnPopConnection
813 {
814 RM3AOPC_DO_NOTHING,
815 RM3AOPC_DELETE_REPLICA,
816 RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION,
817 RM3AOPC_MAX,
818 };
819
822 enum Replica3P2PMode
823 {
826 R3P2PM_SINGLE_OWNER,
830 R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE,
834 R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE,
837 R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE,
840 R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE,
841
842 };
843
847 class RAK_DLL_EXPORT Replica3 : public NetworkIDObject
848 {
849 public:
850 Replica3();
851
854 virtual ~Replica3();
855
861 virtual void WriteAllocationID(SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const=0;
862
872 virtual RM3ConstructionState QueryConstruction(SLNet::Connection_RM3 *destinationConnection, ReplicaManager3 *replicaManager3)=0;
873
883 virtual RM3DestructionState QueryDestruction(SLNet::Connection_RM3 *destinationConnection, ReplicaManager3 *replicaManager3) {(void) destinationConnection; (void) replicaManager3; return RM3DS_DO_NOT_QUERY_DESTRUCTION;}
884
892 virtual bool QueryRemoteConstruction(SLNet::Connection_RM3 *sourceConnection)=0;
893
900 virtual bool QueryRelayDestruction(Connection_RM3 *sourceConnection) const {(void) sourceConnection; return true;}
901
909 virtual void SerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)=0;
910
916 virtual bool DeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)=0;
917
920 virtual void SerializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) {(void) constructionBitstream; (void) destinationConnection;};
921
924 virtual void DeserializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) {(void) constructionBitstream; (void) sourceConnection;};
925
931 virtual void SerializeDestruction(SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *destinationConnection)=0;
932
936 virtual bool DeserializeDestruction(SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *sourceConnection)=0;
937
940 virtual SLNet::RM3ActionOnPopConnection QueryActionOnPopConnection(SLNet::Connection_RM3 *droppedConnection) const=0;
941
943 virtual void OnPoppedConnection(SLNet::Connection_RM3 *droppedConnection) {(void) droppedConnection;}
944
955 virtual void DeallocReplica(SLNet::Connection_RM3 *sourceConnection)=0;
956
962 virtual SLNet::RM3QuerySerializationResult QuerySerialization(SLNet::Connection_RM3 *destinationConnection)=0;
963
966 virtual void OnUserReplicaPreSerializeTick(void) {}
967
975 virtual RM3SerializationResult Serialize(SLNet::SerializeParameters *serializeParameters)=0;
976
979 virtual void OnSerializeTransmission(SLNet::BitStream *bitStream, SLNet::Connection_RM3 *destinationConnection, BitSize_t bitsPerChannel[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time curTime) {(void) bitStream; (void) destinationConnection; (void) bitsPerChannel; (void) curTime;}
980
987 virtual void Deserialize(SLNet::DeserializeParameters *deserializeParameters)=0;
988
992 virtual void PostSerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) {(void) constructionBitstream; (void) destinationConnection;}
993
1000 virtual void PostDeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) {(void) constructionBitstream; (void) sourceConnection;}
1001
1003 virtual void PostSerializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) {(void) constructionBitstream; (void) destinationConnection;}
1004
1006 virtual void PostDeserializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) {(void) constructionBitstream; (void) sourceConnection;}
1007
1011 virtual void PreDestruction(SLNet::Connection_RM3 *sourceConnection) {(void) sourceConnection;}
1012
1017 virtual RM3ConstructionState QueryConstruction_ClientConstruction(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer);
1018
1024 virtual bool QueryRemoteConstruction_ClientConstruction(SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer);
1025
1030 virtual RM3ConstructionState QueryConstruction_ServerConstruction(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer);
1031
1037 virtual bool QueryRemoteConstruction_ServerConstruction(SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer);
1038
1043 virtual RM3ConstructionState QueryConstruction_PeerToPeer(SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER);
1047 virtual bool QueryRemoteConstruction_PeerToPeer(SLNet::Connection_RM3 *sourceConnection);
1048
1053 virtual SLNet::RM3QuerySerializationResult QuerySerialization_ClientSerializable(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer);
1058 virtual SLNet::RM3QuerySerializationResult QuerySerialization_ServerSerializable(SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer);
1063 virtual SLNet::RM3QuerySerializationResult QuerySerialization_PeerToPeer(SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER);
1064
1066 virtual RM3ActionOnPopConnection QueryActionOnPopConnection_Client(SLNet::Connection_RM3 *droppedConnection) const;
1068 virtual RM3ActionOnPopConnection QueryActionOnPopConnection_Server(SLNet::Connection_RM3 *droppedConnection) const;
1070 virtual RM3ActionOnPopConnection QueryActionOnPopConnection_PeerToPeer(SLNet::Connection_RM3 *droppedConnection) const;
1071
1074 virtual void BroadcastDestruction(void);
1075
1078 RakNetGUID GetCreatingSystemGUID(void) const;
1079
1081 bool WasReferenced(void) const {return replicaManager!=0;}
1082
1085 RakNetGUID creatingSystemGUID;
1087 RakNetGUID deletingSystemGUID;
1088
1091 ReplicaManager3 *replicaManager;
1092
1093 LastSerializationResultBS lastSentSerialization;
1094 bool forceSendUntilNextUpdate;
1095 LastSerializationResult *lsr;
1096 uint32_t referenceIndex;
1097 };
1098
1103 template <class parent_type>
1104 class RAK_DLL_EXPORT Replica3Composite : public Replica3
1105 {
1106 protected:
1107 parent_type *r3CompositeOwner;
1108 public:
1109 void SetCompositeOwner(parent_type *p) {r3CompositeOwner=p;}
1110 parent_type* GetCompositeOwner(void) const {return r3CompositeOwner;};
1111 virtual void WriteAllocationID(SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const {r3CompositeOwner->WriteAllocationID(destinationConnection, allocationIdBitstream);}
1112 virtual SLNet::RM3ConstructionState QueryConstruction(SLNet::Connection_RM3 *destinationConnection, SLNet::ReplicaManager3 *replicaManager3) {return r3CompositeOwner->QueryConstruction(destinationConnection, replicaManager3);}
1113 virtual SLNet::RM3DestructionState QueryDestruction(SLNet::Connection_RM3 *destinationConnection, SLNet::ReplicaManager3 *replicaManager3) {return r3CompositeOwner->QueryDestruction(destinationConnection, replicaManager3);}
1114 virtual bool QueryRemoteConstruction(SLNet::Connection_RM3 *sourceConnection) {return r3CompositeOwner->QueryRemoteConstruction(sourceConnection);}
1115 virtual bool QueryRelayDestruction(SLNet::Connection_RM3 *sourceConnection) const {return r3CompositeOwner->QueryRelayDestruction(sourceConnection);}
1116 virtual void SerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) {r3CompositeOwner->SerializeConstruction(constructionBitstream, destinationConnection);}
1117 virtual bool DeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) {return r3CompositeOwner->DeserializeConstruction(constructionBitstream, sourceConnection);}
1118 virtual void SerializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) {r3CompositeOwner->SerializeConstructionExisting(constructionBitstream, destinationConnection);}
1119 virtual void DeserializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) {r3CompositeOwner->DeserializeConstructionExisting(constructionBitstream, sourceConnection);}
1120 virtual void SerializeDestruction(SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *destinationConnection) {r3CompositeOwner->SerializeDestruction(destructionBitstream, destinationConnection);}
1121 virtual bool DeserializeDestruction(SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *sourceConnection) {return r3CompositeOwner->DeserializeDestruction(destructionBitstream, sourceConnection);}
1122 virtual SLNet::RM3ActionOnPopConnection QueryActionOnPopConnection(SLNet::Connection_RM3 *droppedConnection) const {return r3CompositeOwner->QueryActionOnPopConnection(droppedConnection);}
1123 virtual void OnPoppedConnection(SLNet::Connection_RM3 *droppedConnection) {r3CompositeOwner->OnPoppedConnection(droppedConnection);}
1124 virtual void DeallocReplica(SLNet::Connection_RM3 *sourceConnection) {r3CompositeOwner->DeallocReplica(sourceConnection);}
1125 virtual SLNet::RM3QuerySerializationResult QuerySerialization(SLNet::Connection_RM3 *destinationConnection) {return r3CompositeOwner->QuerySerialization(destinationConnection);}
1126 virtual void OnUserReplicaPreSerializeTick(void) {r3CompositeOwner->OnUserReplicaPreSerializeTick();}
1127 virtual SLNet::RM3SerializationResult Serialize(SLNet::SerializeParameters *serializeParameters) {return r3CompositeOwner->Serialize(serializeParameters);}
1128 virtual void OnSerializeTransmission(SLNet::BitStream *bitStream, SLNet::Connection_RM3 *destinationConnection, SLNet::BitSize_t bitsPerChannel[SLNet::RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time curTime) {r3CompositeOwner->OnSerializeTransmission(bitStream, destinationConnection, bitsPerChannel, curTime);}
1129 virtual void Deserialize(SLNet::DeserializeParameters *deserializeParameters) {r3CompositeOwner->Deserialize(deserializeParameters);}
1130 virtual void PostSerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) {r3CompositeOwner->PostSerializeConstruction(constructionBitstream, destinationConnection);}
1131 virtual void PostDeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) {r3CompositeOwner->PostDeserializeConstruction(constructionBitstream, sourceConnection);}
1132 virtual void PostSerializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection) {r3CompositeOwner->PostSerializeConstructionExisting(constructionBitstream, destinationConnection);}
1133 virtual void PostDeserializeConstructionExisting(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection) {r3CompositeOwner->PostDeserializeConstructionExisting(constructionBitstream, sourceConnection);}
1134 virtual void PreDestruction(SLNet::Connection_RM3 *sourceConnection) {r3CompositeOwner->PreDestruction(sourceConnection);}
1135 };
1136
1137 } // namespace SLNet
1138
1139
1140 #endif
1141
1142 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RNS2_Linux
SLNet::RNS2_Linux Member List

This is the complete list of members for SLNet::RNS2_Linux, including all inherited members.

Bind(RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line) | SLNet::RNS2_Linux | virtual
binding | SLNet::RNS2_Berkley | protected
BindShared(RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line) | SLNet::RNS2_Berkley | protected
BindSharedIPV4(RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line) | SLNet::RNS2_Berkley | protected
BindSharedIPV4And6(RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line) | SLNet::RNS2_Berkley | protected
BlockOnStopRecvPollingThread(void) | SLNet::RNS2_Berkley |
boundAddress | SLNet::RakNetSocket2 | protected
CreateRecvPollingThread(int threadPriority) | SLNet::RNS2_Berkley |
DomainNameToIP(const char *domainName, char ip[65]) | SLNet::RakNetSocket2 | static
endThreads | SLNet::RNS2_Berkley | protected
eventHandler | SLNet::RakNetSocket2 | protected
GetBindings(void) const | SLNet::RNS2_Berkley |
GetBoundAddress(void) const | SLNet::RakNetSocket2 |
GetEventHandler(void) const | SLNet::RakNetSocket2 |
GetMyIP(SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS]) | SLNet::RNS2_Linux | static
GetMyIPIPV4(SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS]) | SLNet::RNS2_Linux | protectedstatic
GetMyIPIPV4And6(SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS]) | SLNet::RNS2_Linux | protectedstatic
GetSocket(void) const | SLNet::RNS2_Berkley |
GetSocketType(void) const | SLNet::RakNetSocket2 |
GetSystemAddressIPV4(RNS2Socket rns2Socket, SystemAddress *systemAddressOut) | SLNet::RNS2_Berkley | protectedstatic
GetSystemAddressIPV4And6(RNS2Socket rns2Socket, SystemAddress *systemAddressOut) | SLNet::RNS2_Berkley | protectedstatic
GetUserConnectionSocketIndex(void) const | SLNet::RakNetSocket2 |
IsBerkleySocket(void) const | SLNet::RakNetSocket2 |
IsPortInUse(unsigned short port, const char *hostAddress, unsigned short addressFamily, int type) | SLNet::IRNS2_Berkley | static
isRecvFromLoopThreadActive | SLNet::RNS2_Berkley | protected
RAK_THREAD_DECLARATION(RecvFromLoop) | SLNet::RNS2_Berkley | protectedstatic
RakNetSocket2() | SLNet::RakNetSocket2 |
RecvFromBlocking(RNS2RecvStruct *recvFromStruct) | SLNet::RNS2_Berkley | protected
RecvFromBlockingIPV4(RNS2RecvStruct *recvFromStruct) | SLNet::RNS2_Berkley | protected
RecvFromBlockingIPV4And6(RNS2RecvStruct *recvFromStruct) | SLNet::RNS2_Berkley | protected
RecvFromLoopInt(void) | SLNet::RNS2_Berkley | protected
RNS2_Berkley() | SLNet::RNS2_Berkley |
rns2Socket | SLNet::RNS2_Berkley | protected
Send(RNS2_SendParameters *sendParameters, const char *file, unsigned int line) | SLNet::RNS2_Linux | virtual
SetBroadcastSocket(int broadcast) | SLNet::RNS2_Berkley | protected
SetDoNotFragment(int opt) | SLNet::RNS2_Berkley |
SetIPHdrIncl(int ipHdrIncl) | SLNet::RNS2_Berkley | protected
SetNonBlockingSocket(unsigned long nonblocking) | SLNet::RNS2_Berkley | protected
SetRecvEventHandler(RNS2EventHandler *_eventHandler) | SLNet::RakNetSocket2 |
SetSocketOptions(void) | SLNet::RNS2_Berkley | protected
SetSocketType(RNS2Type t) | SLNet::RakNetSocket2 |
SetUserConnectionSocketIndex(unsigned int i) | SLNet::RakNetSocket2 |
SignalStopRecvPollingThread(void) | SLNet::RNS2_Berkley |
socketType | SLNet::RakNetSocket2 | protected
userConnectionSocketIndex | SLNet::RakNetSocket2 | protected
~RakNetSocket2() | SLNet::RakNetSocket2 | virtual
~RNS2_Berkley() | SLNet::RNS2_Berkley | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakThread
SLNet::RakThread Member List

This is the complete list of members for SLNet::RakThread, including all inherited members.

Create(void *start_address(void *), void *arglist, int priority=0) SLNet::RakThread static
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • BPSTracker
SLNet::BPSTracker Member List

This is the complete list of members for SLNet::BPSTracker, including all inherited members.

BPSTracker() | SLNet::BPSTracker |
ClearExpired1(CCTimeType time) | SLNet::BPSTracker |
dataQueue | SLNet::BPSTracker |
GetBPS1(CCTimeType time) | SLNet::BPSTracker | inline
GetBPS1Threadsafe(CCTimeType time) | SLNet::BPSTracker | inline
GetTotal1(void) const | SLNet::BPSTracker |
lastSec1 | SLNet::BPSTracker |
Push1(CCTimeType time, uint64_t value1) | SLNet::BPSTracker | inline
Reset(const char *file, unsigned int line) | SLNet::BPSTracker |
total1 | SLNet::BPSTracker |
~BPSTracker() | SLNet::BPSTracker |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StringTable
SLNet::StringTable Member List

This is the complete list of members for SLNet::StringTable, including all inherited members.

AddReference(void) | SLNet::StringTable | static
AddString(const char *str, bool copyString) | SLNet::StringTable |
DecodeString(char *output, int maxCharsToWrite, SLNet::BitStream *input) | SLNet::StringTable |
EncodeString(const char *input, int maxCharsToWrite, SLNet::BitStream *output) | SLNet::StringTable |
Instance(void) | SLNet::StringTable | static
instance | SLNet::StringTable | protectedstatic
LogStringNotFound(const char *strName) | SLNet::StringTable | protected
orderedStringList | SLNet::StringTable | protected
referenceCount | SLNet::StringTable | protectedstatic
RemoveReference(void) | SLNet::StringTable | static
StringTable() | SLNet::StringTable |
~StringTable() | SLNet::StringTable |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketPriority.h Source File

  • include
  • slikenet
PacketPriority.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
14
15
16
17 #ifndef __PACKET_PRIORITY_H
18 #define __PACKET_PRIORITY_H
19
21 enum PacketPriority
22 {
24 IMMEDIATE_PRIORITY,
25
28 HIGH_PRIORITY,
29
32 MEDIUM_PRIORITY,
33
36 LOW_PRIORITY,
37
39 NUMBER_OF_PRIORITIES
40 };
41
46 enum PacketReliability
47 {
49 UNRELIABLE,
50
53 UNRELIABLE_SEQUENCED,
54
56 RELIABLE,
57
60 RELIABLE_ORDERED,
61
64 RELIABLE_SEQUENCED,
65
67 UNRELIABLE_WITH_ACK_RECEIPT,
68
71 // UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT,
72
74 RELIABLE_WITH_ACK_RECEIPT,
75
77 RELIABLE_ORDERED_WITH_ACK_RECEIPT,
78
81 // RELIABLE_SEQUENCED_WITH_ACK_RECEIPT,
82
84 NUMBER_OF_RELIABILITIES
85 };
86
87 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatTypeDetectionServer.cpp Source File

  • src
NatTypeDetectionServer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_NatTypeDetectionServer==1
18
19 #include "slikenet/NatTypeDetectionServer.h"
20 #include "slikenet/SocketLayer.h"
21 #include "slikenet/smartptr.h"
22 #include "slikenet/SocketIncludes.h"
23 #include "slikenet/peerinterface.h"
24 #include "slikenet/MessageIdentifiers.h"
25 #include "slikenet/GetTime.h"
26 #include "slikenet/BitStream.h"
27 #include "slikenet/SocketDefines.h"
28 #include "slikenet/linux_adapter.h"
29 #include "slikenet/osx_adapter.h"
30
31 // #define NTDS_VERBOSE
32
33 using namespace SLNet;
34
35 STATIC_FACTORY_DEFINITIONS(NatTypeDetectionServer,NatTypeDetectionServer);
36
37 NatTypeDetectionServer::NatTypeDetectionServer()
38 {
39 s1p2=s2p3=s3p4=s4p5=0;
40 }
41 NatTypeDetectionServer::~NatTypeDetectionServer()
42 {
43 Shutdown();
44 }
45 void NatTypeDetectionServer::Startup(
46 const char *nonRakNetIP2,
47 const char *nonRakNetIP3,
48 const char *nonRakNetIP4
49 #ifdef __native_client__
50 ,_PP_Instance_ chromeInstance
51 #endif
52 )
53 {
54 DataStructures::List<RakNetSocket2* > sockets;
55 rakPeerInterface->GetSockets(sockets);
56 char str[64];
57 sockets[0]->GetBoundAddress().ToString(false,str,static_cast<size_t>(64));
58 s1p2=
59 CreateNonblockingBoundSocket(str,
60 #ifdef __native_client__
61 chromeInstance,
62 #endif
63 this);
64
65 s2p3=
66 CreateNonblockingBoundSocket(nonRakNetIP2,
67 #ifdef __native_client__
68 chromeInstance,
69 #endif
70 this);
71
72
73 s3p4=
74 CreateNonblockingBoundSocket(nonRakNetIP3,
75 #ifdef __native_client__
76 chromeInstance,
77 #endif
78 this);
79
80 s4p5=
81 CreateNonblockingBoundSocket(nonRakNetIP4,
82 #ifdef __native_client__
83 chromeInstance,
84 #endif
85 this);
86
87 strcpy_s(s3p4Address, nonRakNetIP3);
88
89
90 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
91 if (s3p4->IsBerkleySocket())
92 ((RNS2_Berkley*) s3p4)->CreateRecvPollingThread(0);
93 #endif
94 }
95 void NatTypeDetectionServer::Shutdown()
96 {
97 if (s1p2!=0)
98 {
99 SLNet::OP_DELETE(s1p2,_FILE_AND_LINE_);
100 s1p2=0;
101 }
102 if (s2p3!=0)
103 {
104 SLNet::OP_DELETE(s2p3,_FILE_AND_LINE_);
105 s2p3=0;
106 }
107 if (s3p4!=0)
108 {
109 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
110 if (s3p4->IsBerkleySocket())
111 ((RNS2_Berkley *)s3p4)->BlockOnStopRecvPollingThread();
112 #endif
113
114 SLNet::OP_DELETE(s3p4,_FILE_AND_LINE_);
115 s3p4=0;
116 }
117 if (s4p5!=0)
118 {
119 SLNet::OP_DELETE(s4p5,_FILE_AND_LINE_);
120 s4p5=0;
121 }
122 bufferedPacketsMutex.Lock();
123 while (bufferedPackets.Size())
124 SLNet::OP_DELETE(bufferedPackets.Pop(), _FILE_AND_LINE_);
125 bufferedPacketsMutex.Unlock();
126 }
127 void NatTypeDetectionServer::Update(void)
128 {
129 int i=0;
130 SLNet::TimeMS time = SLNet::GetTimeMS();
131 SLNet::BitStream bs;
132 SystemAddress boundAddress;
133
134 RNS2RecvStruct *recvStruct;
135 bufferedPacketsMutex.Lock();
136 if (bufferedPackets.Size()>0)
137 recvStruct=bufferedPackets.Pop();
138 else
139 recvStruct=0;
140 bufferedPacketsMutex.Unlock();
141 while (recvStruct)
142 {
143 SystemAddress senderAddr = recvStruct->systemAddress;
144 char *data = recvStruct->data;
145 if (data[0]==NAT_TYPE_PORT_RESTRICTED && recvStruct->socket==s3p4)
146 {
147 SLNet::BitStream bsIn((unsigned char*) data,recvStruct->bytesRead,false);
148 RakNetGUID senderGuid;
149 bsIn.IgnoreBytes(sizeof(MessageID));
150 bool readSuccess = bsIn.Read(senderGuid);
151 RakAssert(readSuccess);
152 if (readSuccess)
153 {
154 unsigned int j = GetDetectionAttemptIndex(senderGuid);
155 if (j!=(unsigned int)-1)
156 {
157 bs.Reset();
158 bs.Write((unsigned char) ID_NAT_TYPE_DETECTION_RESULT);
159 // If different, then symmetric
160 if (senderAddr!=natDetectionAttempts[j].systemAddress)
161 {
162
163 #ifdef NTDS_VERBOSE
164 printf("Determined client is symmetric\n");
165 #endif
166 bs.Write((unsigned char) NAT_TYPE_SYMMETRIC);
167 }
168 else
169 {
170 // else port restricted
171 #ifdef NTDS_VERBOSE
172
173 printf("Determined client is port restricted\n");
174 #endif
175 bs.Write((unsigned char) NAT_TYPE_PORT_RESTRICTED);
176 }
177
178 rakPeerInterface->Send(&bs,HIGH_PRIORITY,RELIABLE,0,natDetectionAttempts[j].systemAddress,false);
179
180 // Done
181 natDetectionAttempts.RemoveAtIndexFast(j);
182 }
183 else
184 {
185 // RakAssert("j==0 in Update when looking up GUID in NatTypeDetectionServer.cpp. Either a bug or a late resend" && 0);
186 }
187 }
188 else
189 {
190 // RakAssert("Didn't read GUID in Update in NatTypeDetectionServer.cpp. Message format error" && 0);
191 }
192 }
193
194 DeallocRNS2RecvStruct(recvStruct, _FILE_AND_LINE_);
195 bufferedPacketsMutex.Lock();
196 if (bufferedPackets.Size()>0)
197 recvStruct=bufferedPackets.Pop();
198 else
199 recvStruct=0;
200 bufferedPacketsMutex.Unlock();
201 }
202
203 /*
204
205 // Only socket that receives messages is s3p4, to see if the external address is different than that of the connection to rakPeerInterface
206 char data[ MAXIMUM_MTU_SIZE ];
207 int len;
208 SystemAddress senderAddr;
209 len=NatTypeRecvFrom(data, s3p4, senderAddr);
210 // Client is asking us if this is port restricted. Only client requests of this type come in on s3p4
211 while (len>0 && data[0]==NAT_TYPE_PORT_RESTRICTED)
212 {
213 SLNet::BitStream bsIn((unsigned char*) data,len,false);
214 RakNetGUID senderGuid;
215 bsIn.IgnoreBytes(sizeof(MessageID));
216 bool readSuccess = bsIn.Read(senderGuid);
217 RakAssert(readSuccess);
218 if (readSuccess)
219 {
220 unsigned int i = GetDetectionAttemptIndex(senderGuid);
221 if (i!=(unsigned int)-1)
222 {
223 bs.Reset();
224 bs.Write((unsigned char) ID_NAT_TYPE_DETECTION_RESULT);
225 // If different, then symmetric
226 if (senderAddr!=natDetectionAttempts[i].systemAddress)
227 {
228
229 #ifdef NTDS_VERBOSE
230 printf("Determined client is symmetric\n");
231 #endif
232 bs.Write((unsigned char) NAT_TYPE_SYMMETRIC);
233 }
234 else
235 {
236 // else port restricted
237
238 #ifdef NTDS_VERBOSE
239 printf("Determined client is port restricted\n");
240 #endif
241 bs.Write((unsigned char) NAT_TYPE_PORT_RESTRICTED);
242 }
243
244 rakPeerInterface->Send(&bs,HIGH_PRIORITY,RELIABLE,0,natDetectionAttempts[i].systemAddress,false);
245
246 // Done
247 natDetectionAttempts.RemoveAtIndexFast(i);
248 }
249 else
250 {
251 // RakAssert("i==0 in Update when looking up GUID in NatTypeDetectionServer.cpp. Either a bug or a late resend" && 0);
252 }
253 }
254 else
255 {
256 // RakAssert("Didn't read GUID in Update in NatTypeDetectionServer.cpp. Message format error" && 0);
257 }
258
259 len=NatTypeRecvFrom(data, s3p4, senderAddr);
260 }
261 */
262
263
264 while (i < (int) natDetectionAttempts.Size())
265 {
266 if (time > natDetectionAttempts[i].nextStateTime)
267 {
268 RNS2_SendParameters bsp;
269 natDetectionAttempts[i].detectionState=(NATDetectionState)((int)natDetectionAttempts[i].detectionState+1);
270 natDetectionAttempts[i].nextStateTime=time+natDetectionAttempts[i].timeBetweenAttempts;
271 SystemAddress saOut;
272 unsigned char c;
273 bs.Reset();
274 switch (natDetectionAttempts[i].detectionState)
275 {
276 case STATE_TESTING_NONE_1:
277 case STATE_TESTING_NONE_2:
278 c = NAT_TYPE_NONE;
279
280 #ifdef NTDS_VERBOSE
281 printf("Testing NAT_TYPE_NONE\n");
282 #endif
283 // S4P5 sends to C2. If arrived, no NAT. Done. (Else S4P5 potentially banned, do not use again).
284 saOut=natDetectionAttempts[i].systemAddress;
285 saOut.SetPortHostOrder(natDetectionAttempts[i].c2Port);
286 // SocketLayer::SendTo_PC( s4p5, (const char*) &c, 1, saOut, __FILE__, __LINE__ );
287 bsp.data = (char*) &c;
288 bsp.length = 1;
289 bsp.systemAddress = saOut;
290 s4p5->Send(&bsp, _FILE_AND_LINE_);
291 break;
292 case STATE_TESTING_FULL_CONE_1:
293 case STATE_TESTING_FULL_CONE_2:
294
295 #ifdef NTDS_VERBOSE
296 printf("Testing NAT_TYPE_FULL_CONE\n");
297 #endif
298 rakPeerInterface->WriteOutOfBandHeader(&bs);
299 bs.Write((unsigned char) ID_NAT_TYPE_DETECT);
300 bs.Write((unsigned char) NAT_TYPE_FULL_CONE);
301 // S2P3 sends to C1 (Different address, different port, to previously used port on client). If received, Full-cone nat. Done. (Else S2P3 potentially banned, do not use again).
302 saOut=natDetectionAttempts[i].systemAddress;
303 saOut.SetPortHostOrder(natDetectionAttempts[i].systemAddress.GetPort());
304 // SocketLayer::SendTo_PC( s2p3, (const char*) bs.GetData(), bs.GetNumberOfBytesUsed(), saOut, __FILE__, __LINE__ );
305 bsp.data = (char*) bs.GetData();
306 bsp.length = bs.GetNumberOfBytesUsed();
307 bsp.systemAddress = saOut;
308 s2p3->Send(&bsp, _FILE_AND_LINE_);
309 break;
310 case STATE_TESTING_ADDRESS_RESTRICTED_1:
311 case STATE_TESTING_ADDRESS_RESTRICTED_2:
312
313 #ifdef NTDS_VERBOSE
314 printf("Testing NAT_TYPE_ADDRESS_RESTRICTED\n");
315 #endif
316 rakPeerInterface->WriteOutOfBandHeader(&bs);
317 bs.Write((unsigned char) ID_NAT_TYPE_DETECT);
318 bs.Write((unsigned char) NAT_TYPE_ADDRESS_RESTRICTED);
319 // S1P2 sends to C1 (Same address, different port, to previously used port on client). If received, address-restricted cone nat. Done.
320 saOut=natDetectionAttempts[i].systemAddress;
321 saOut.SetPortHostOrder(natDetectionAttempts[i].systemAddress.GetPort());
322 //SocketLayer::SendTo_PC( s1p2, (const char*) bs.GetData(), bs.GetNumberOfBytesUsed(), saOut, __FILE__, __LINE__ );
323 bsp.data = (char*) bs.GetData();
324 bsp.length = bs.GetNumberOfBytesUsed();
325 bsp.systemAddress = saOut;
326 s1p2->Send(&bsp, _FILE_AND_LINE_);
327 break;
328 case STATE_TESTING_PORT_RESTRICTED_1:
329 case STATE_TESTING_PORT_RESTRICTED_2:
330 // C1 sends to S3P4. If address of C1 as seen by S3P4 is the same as the address of C1 as seen by S1P1, then port-restricted cone nat. Done
331
332 #ifdef NTDS_VERBOSE
333 printf("Testing NAT_TYPE_PORT_RESTRICTED\n");
334 #endif
335 bs.Write((unsigned char) ID_NAT_TYPE_DETECTION_REQUEST);
336 bs.Write(RakString::NonVariadic(s3p4Address));
337 bs.Write(s3p4->GetBoundAddress().GetPort());
338 rakPeerInterface->Send(&bs,HIGH_PRIORITY,RELIABLE,0,natDetectionAttempts[i].systemAddress,false);
339 break;
340 default:
341
342 #ifdef NTDS_VERBOSE
343 printf("Warning, exceeded final check STATE_TESTING_PORT_RESTRICTED_2.\nExpected that client would have sent NAT_TYPE_PORT_RESTRICTED on s3p4.\nDefaulting to Symmetric\n");
344 #endif
345 bs.Write((unsigned char) ID_NAT_TYPE_DETECTION_RESULT);
346 bs.Write((unsigned char) NAT_TYPE_SYMMETRIC);
347 rakPeerInterface->Send(&bs,HIGH_PRIORITY,RELIABLE,0,natDetectionAttempts[i].systemAddress,false);
348 natDetectionAttempts.RemoveAtIndexFast(i);
349 i--;
350 break;
351 }
352
353 }
354 i++;
355 }
356 }
357 PluginReceiveResult NatTypeDetectionServer::OnReceive(Packet *packet)
358 {
359 switch (packet->data[0])
360 {
361 case ID_NAT_TYPE_DETECTION_REQUEST:
362 OnDetectionRequest(packet);
363 return RR_STOP_PROCESSING_AND_DEALLOCATE;
364 }
365 return RR_CONTINUE_PROCESSING;
366 }
367 void NatTypeDetectionServer::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
368 {
369 (void) lostConnectionReason;
370 (void) rakNetGUID;
371
372 unsigned int i = GetDetectionAttemptIndex(systemAddress);
373 if (i==(unsigned int)-1)
374 return;
375 natDetectionAttempts.RemoveAtIndexFast(i);
376 }
377 void NatTypeDetectionServer::OnDetectionRequest(Packet *packet)
378 {
379 unsigned int i = GetDetectionAttemptIndex(packet->systemAddress);
380
381 SLNet::BitStream bsIn(packet->data, packet->length, false);
382 bsIn.IgnoreBytes(1);
383 bool isRequest=false;
384 bsIn.Read(isRequest);
385 if (isRequest)
386 {
387 if (i!=(unsigned int)-1)
388 return; // Already in progress
389
390 NATDetectionAttempt nda;
391 nda.detectionState=STATE_NONE;
392 nda.systemAddress=packet->systemAddress;
393 nda.guid=packet->guid;
394 bsIn.Read(nda.c2Port);
395 nda.nextStateTime=0;
396 nda.timeBetweenAttempts=rakPeerInterface->GetLastPing(nda.systemAddress)*3+50;
397 natDetectionAttempts.Push(nda, _FILE_AND_LINE_);
398 }
399 else
400 {
401 if (i==(unsigned int)-1)
402 return; // Unknown
403 // They are done
404 natDetectionAttempts.RemoveAtIndexFast(i);
405 }
406
407 }
408 unsigned int NatTypeDetectionServer::GetDetectionAttemptIndex(const SystemAddress &sa)
409 {
410 for (unsigned int i=0; i < natDetectionAttempts.Size(); i++)
411 {
412 if (natDetectionAttempts[i].systemAddress==sa)
413 return i;
414 }
415 return (unsigned int) -1;
416 }
417 unsigned int NatTypeDetectionServer::GetDetectionAttemptIndex(RakNetGUID guid)
418 {
419 for (unsigned int i=0; i < natDetectionAttempts.Size(); i++)
420 {
421 if (natDetectionAttempts[i].guid==guid)
422 return i;
423 }
424 return (unsigned int) -1;
425 }
426
427 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
428 void NatTypeDetectionServer::DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line)
429 {
430 SLNet::OP_DELETE(s, file, line);
431 }
432 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
433 RNS2RecvStruct *NatTypeDetectionServer::AllocRNS2RecvStruct(const char *file, unsigned int line)
434 {
435 return SLNet::OP_NEW<RNS2RecvStruct>(file,line);
436 }
437
438 void NatTypeDetectionServer::OnRNS2Recv(RNS2RecvStruct *recvStruct)
439 {
440 bufferedPacketsMutex.Lock();
441 bufferedPackets.Push(recvStruct,_FILE_AND_LINE_);
442 bufferedPacketsMutex.Unlock();
443 }
444
445 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • LocklessUint32_t
SLNet::LocklessUint32_t Member List

This is the complete list of members for SLNet::LocklessUint32_t, including all inherited members.

Decrement(void) | SLNet::LocklessUint32_t |
GetValue(void) const | SLNet::LocklessUint32_t | inline
Increment(void) | SLNet::LocklessUint32_t |
LocklessUint32_t() | SLNet::LocklessUint32_t |
LocklessUint32_t(uint32_t initial) | SLNet::LocklessUint32_t | explicit
value | SLNet::LocklessUint32_t | protected
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Rand.h Source File

  • include
  • slikenet
Rand.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __RAND_H
23 #define __RAND_H
24
25 #include "Export.h"
26
30 extern void RAK_DLL_EXPORT seedMT( unsigned int seed );
31
34 extern unsigned int RAK_DLL_EXPORT reloadMT( void );
35
39 extern unsigned int RAK_DLL_EXPORT randomMT( void );
40
44 extern float RAK_DLL_EXPORT frandomMT( void );
45
48 extern void RAK_DLL_EXPORT fillBufferMT( void *buffer, unsigned int bytes );
49
50 namespace SLNet {
51
52 // Same thing as above functions, but not global
53 class RAK_DLL_EXPORT RakNetRandom
54 {
55 public:
56 RakNetRandom();
57 ~RakNetRandom();
58 void SeedMT( unsigned int seed );
59 unsigned int ReloadMT( void );
60 unsigned int RandomMT( void );
61 float FrandomMT( void );
62 void FillBufferMT( void *buffer, unsigned int bytes );
63
64 protected:
65 unsigned int state[ 624 + 1 ];
66 unsigned int *next;
67 int left;
68 };
69
70 } // namespace SLNet
71
72 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/LocklessTypes.h Source File

  • include
  • slikenet
LocklessTypes.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __LOCKLESS_TYPES_H
17 #define __LOCKLESS_TYPES_H
18
19 #include "Export.h"
20 #include "NativeTypes.h"
21 #include "WindowsIncludes.h"
22 #if defined(ANDROID) || defined(__S3E__) || defined(__APPLE__)
23 // __sync_fetch_and_add not supported apparently
24 #include "SimpleMutex.h"
25 #endif
26
27 namespace SLNet
28 {
29
30 class RAK_DLL_EXPORT LocklessUint32_t
31 {
32 public:
33 LocklessUint32_t();
34 explicit LocklessUint32_t(uint32_t initial);
35 // Returns variable value after changing it
36 uint32_t Increment(void);
37 // Returns variable value after changing it
38 uint32_t Decrement(void);
39 uint32_t GetValue(void) const {return value;}
40
41 protected:
42 #ifdef _WIN32
43 volatile LONG value;
44 #elif defined(ANDROID) || defined(__S3E__) || defined(__APPLE__)
45 // __sync_fetch_and_add not supported apparently
46 SimpleMutex mutex;
47 uint32_t value;
48 #else
49 volatile uint32_t value;
50 #endif
51 };
52
53 }
54
55 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DS_ByteQueue.cpp Source File

  • src
DS_ByteQueue.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/DS_ByteQueue.h"
17 #include <string.h> // Memmove
18 #include <stdlib.h> // realloc
19 #include <stdio.h>
20
21
22 using namespace DataStructures;
23
24 ByteQueue::ByteQueue()
25 {
26 readOffset=writeOffset=lengthAllocated=0;
27 data=0;
28 }
29 ByteQueue::~ByteQueue()
30 {
31 Clear(_FILE_AND_LINE_);
32
33
34 }
35 void ByteQueue::WriteBytes(const char *in, unsigned length, const char *file, unsigned int line)
36 {
37 unsigned bytesWritten;
38 bytesWritten=GetBytesWritten();
39 if (lengthAllocated==0 || length > lengthAllocated-bytesWritten-1)
40 {
41 unsigned oldLengthAllocated=lengthAllocated;
42 // Always need to waste 1 byte for the math to work, else writeoffset==readoffset
43 unsigned newAmountToAllocate=length+oldLengthAllocated+1;
44 if (newAmountToAllocate<256)
45 newAmountToAllocate=256;
46 lengthAllocated=lengthAllocated + newAmountToAllocate;
47 data=(char*)rakRealloc_Ex(data, lengthAllocated, file, line);
48 if (writeOffset < readOffset)
49 {
50 if (writeOffset <= newAmountToAllocate)
51 {
52 memcpy(data + oldLengthAllocated, data, writeOffset);
53 writeOffset=readOffset+bytesWritten;
54 }
55 else
56 {
57 memcpy(data + oldLengthAllocated, data, newAmountToAllocate);
58 memmove(data, data+newAmountToAllocate, writeOffset-newAmountToAllocate);
59 writeOffset-=newAmountToAllocate;
60 }
61 }
62 }
63
64 if (length <= lengthAllocated-writeOffset)
65 memcpy(data+writeOffset, in, length);
66 else
67 {
68 // Wrap
69 memcpy(data+writeOffset, in, lengthAllocated-writeOffset);
70 memcpy(data, in+(lengthAllocated-writeOffset), length-(lengthAllocated-writeOffset));
71 }
72 writeOffset=(writeOffset+length) % lengthAllocated;
73 }
74 bool ByteQueue::ReadBytes(char *out, unsigned maxLengthToRead, bool peek)
75 {
76 unsigned bytesWritten = GetBytesWritten();
77 unsigned bytesToRead = bytesWritten < maxLengthToRead ? bytesWritten : maxLengthToRead;
78 if (bytesToRead==0)
79 return false;
80 if (writeOffset>=readOffset)
81 {
82 memcpy(out, data+readOffset, bytesToRead);
83 }
84 else
85 {
86 unsigned availableUntilWrap = lengthAllocated-readOffset;
87 if (bytesToRead <= availableUntilWrap)
88 {
89 memcpy(out, data+readOffset, bytesToRead);
90 }
91 else
92 {
93 memcpy(out, data+readOffset, availableUntilWrap);
94 memcpy(out+availableUntilWrap, data, bytesToRead-availableUntilWrap);
95 }
96 }
97
98 if (peek==false)
99 IncrementReadOffset(bytesToRead);
100
101 return true;
102 }
103 char* ByteQueue::PeekContiguousBytes(unsigned int *outLength) const
104 {
105 if (writeOffset>=readOffset)
106 *outLength=writeOffset-readOffset;
107 else
108 *outLength=lengthAllocated-readOffset;
109 return data+readOffset;
110 }
111 void ByteQueue::Clear(const char *file, unsigned int line)
112 {
113 if (lengthAllocated)
114 rakFree_Ex(data, file, line );
115 readOffset=writeOffset=lengthAllocated=0;
116 data=0;
117 }
118 unsigned ByteQueue::GetBytesWritten(void) const
119 {
120 if (writeOffset>=readOffset)
121 return writeOffset-readOffset;
122 else
123 return writeOffset+(lengthAllocated-readOffset);
124 }
125 void ByteQueue::IncrementReadOffset(unsigned length)
126 {
127 readOffset=(readOffset+length) % lengthAllocated;
128 }
129 void ByteQueue::DecrementReadOffset(unsigned length)
130 {
131 if (length>readOffset)
132 readOffset=lengthAllocated-(length-readOffset);
133 else
134 readOffset-=length;
135 }
136 void ByteQueue::Print(void)
137 {
138 unsigned i;
139 for (i=readOffset; i!=writeOffset; i++)
140 RAKNET_DEBUG_PRINTF("%i ", data[i]);
141 RAKNET_DEBUG_PRINTF("\n");
142 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • InternalPacket
SLNet::InternalPacket Member List

This is the complete list of members for SLNet::InternalPacket, including all inherited members.

AllocationScheme enum name | SLNet::InternalPacket
allocationScheme | SLNet::InternalPacket
creationTime | SLNet::InternalPacket
data | SLNet::InternalPacket
dataBitLength | SLNet::InternalPacketFixedSizeTransmissionHeader
headerLength | SLNet::InternalPacket
messageInternalOrder | SLNet::InternalPacket
messageNumberAssigned | SLNet::InternalPacket
nextActionTime | SLNet::InternalPacket
NORMAL enum value | SLNet::InternalPacket
orderingChannel | SLNet::InternalPacketFixedSizeTransmissionHeader
orderingIndex | SLNet::InternalPacketFixedSizeTransmissionHeader
priority | SLNet::InternalPacket
REF_COUNTED enum value | SLNet::InternalPacket
refCountedData | SLNet::InternalPacket
reliability | SLNet::InternalPacketFixedSizeTransmissionHeader
reliableMessageNumber | SLNet::InternalPacketFixedSizeTransmissionHeader
resendNext | SLNet::InternalPacket
resendPrev | SLNet::InternalPacket
retransmissionTime | SLNet::InternalPacket
sendReceiptSerial | SLNet::InternalPacket
sequencingIndex | SLNet::InternalPacketFixedSizeTransmissionHeader
splitPacketCount | SLNet::InternalPacketFixedSizeTransmissionHeader
splitPacketId | SLNet::InternalPacketFixedSizeTransmissionHeader
splitPacketIndex | SLNet::InternalPacketFixedSizeTransmissionHeader
STACK enum value | SLNet::InternalPacket
stackData | SLNet::InternalPacket
timesSent | SLNet::InternalPacket
unreliableNext | SLNet::InternalPacket
unreliablePrev | SLNet::InternalPacket
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CloudClient.h Source File

  • include
  • slikenet
CloudClient.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_CloudClient==1
23
24 #ifndef __CLOUD_CLIENT_H
25 #define __CLOUD_CLIENT_H
26
27 #include "PluginInterface2.h"
28 #include "CloudCommon.h"
29 #include "memoryoverride.h"
30 #include "DS_Hash.h"
31
32 namespace SLNet
33 {
35 class RakPeerInterface;
36 class CloudClientCallback;
37
42
46 class RAK_DLL_EXPORT CloudClient : public PluginInterface2
47 {
48 public:
49 // GetInstance() and DestroyInstance(instance*)
50 STATIC_FACTORY_DECLARATIONS(CloudClient)
51
52 CloudClient();
53 virtual ~CloudClient();
54
59 virtual void SetDefaultCallbacks(CloudAllocator *_allocator, CloudClientCallback *_callback);
60
72 virtual void Post(CloudKey *cloudKey, const unsigned char *data, uint32_t dataLengthBytes, RakNetGUID systemIdentifier);
73
78 virtual void Release(DataStructures::List<CloudKey> &keys, RakNetGUID systemIdentifier);
79
92 virtual bool Get(CloudQuery *cloudQuery, RakNetGUID systemIdentifier);
93 virtual bool Get(CloudQuery *cloudQuery, DataStructures::List<RakNetGUID> &specificSystems, RakNetGUID systemIdentifier);
94 virtual bool Get(CloudQuery *cloudQuery, DataStructures::List<CloudQueryRow*> &specificSystems, RakNetGUID systemIdentifier);
95
100 virtual void Unsubscribe(DataStructures::List<CloudKey> &keys, RakNetGUID systemIdentifier);
101 virtual void Unsubscribe(DataStructures::List<CloudKey> &keys, DataStructures::List<RakNetGUID> &specificSystems, RakNetGUID systemIdentifier);
102 virtual void Unsubscribe(DataStructures::List<CloudKey> &keys, DataStructures::List<CloudQueryRow*> &specificSystems, RakNetGUID systemIdentifier);
103
109 virtual void OnGetReponse(Packet *packet, CloudClientCallback *_callback=0, CloudAllocator *_allocator=0);
110
118 virtual void OnGetReponse(CloudQueryResult *cloudQueryResult, Packet *packet, CloudAllocator *_allocator=0);
119
125 virtual void OnSubscriptionNotification(Packet *packet, CloudClientCallback *_callback=0, CloudAllocator *_allocator=0);
126
135 virtual void OnSubscriptionNotification(bool *wasUpdated, CloudQueryRow *row, Packet *packet, CloudAllocator *_allocator=0);
136
138 virtual void DeallocateWithDefaultAllocator(CloudQueryResult *cloudQueryResult);
139
141 virtual void DeallocateWithDefaultAllocator(CloudQueryRow *row);
142
143 protected:
144 PluginReceiveResult OnReceive(Packet *packet);
145
146 CloudClientCallback *callback;
147 CloudAllocator *allocator;
148
149 CloudAllocator unsetDefaultAllocator;
150 };
151
154 class RAK_DLL_EXPORT CloudClientCallback
155 {
156 public:
157 CloudClientCallback() {}
158 virtual ~CloudClientCallback() {}
159
163 virtual void OnGet(SLNet::CloudQueryResult *result, bool *deallocateRowsAfterReturn) {(void) result; (void) deallocateRowsAfterReturn;}
164
169 virtual void OnSubscriptionNotification(SLNet::CloudQueryRow *result, bool wasUpdated, bool *deallocateRowAfterReturn) {(void) result; (void) wasUpdated; (void) deallocateRowAfterReturn;}
170 };
171
172 } // namespace SLNet
173
174 #endif
175
176 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/EmptyHeader.h Source File

  • include
  • slikenet
EmptyHeader.h
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082 without any modifications.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 */
5
6 // This is here to remove Missing #include header? in the Unreal Engine
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
GridSectorizer Member List

This is the complete list of members for GridSectorizer, including all inherited members.

AddEntry(void *entry, const float minX, const float minY, const float maxX, const float maxY) | GridSectorizer |
cellHeight | GridSectorizer | protected
cellOriginX | GridSectorizer | protected
cellOriginY | GridSectorizer | protected
cellWidth | GridSectorizer | protected
Clear(void) | GridSectorizer |
GetEntries(DataStructures::List< void * > &intersectionList, const float minX, const float minY, const float maxX, const float maxY) | GridSectorizer |
grid | GridSectorizer | protected
gridCellHeightCount | GridSectorizer | protected
gridCellWidthCount | GridSectorizer | protected
gridHeight | GridSectorizer | protected
GridSectorizer() | GridSectorizer |
gridWidth | GridSectorizer | protected
Init(const float _maxCellWidth, const float _maxCellHeight, const float minX, const float minY, const float maxX, const float maxY) | GridSectorizer |
invCellHeight | GridSectorizer | protected
invCellWidth | GridSectorizer | protected
PositionCrossesCells(const float originX, const float originY, const float destinationX, const float destinationY) const | GridSectorizer | protected
WorldToCellX(const float input) const | GridSectorizer | protected
WorldToCellXOffsetAndClamped(const float input) const | GridSectorizer | protected
WorldToCellY(const float input) const | GridSectorizer | protected
WorldToCellYOffsetAndClamped(const float input) const | GridSectorizer | protected
~GridSectorizer() | GridSectorizer |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatPunchthroughClient.cpp Source File

  • src
NatPunchthroughClient.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_NatPunchthroughClient==1
18
19 #include "slikenet/NatPunchthroughClient.h"
20 #include "slikenet/BitStream.h"
21 #include "slikenet/MessageIdentifiers.h"
22 #include "slikenet/peerinterface.h"
23 #include "slikenet/GetTime.h"
24 #include "slikenet/PacketLogger.h"
25 #include "slikenet/Itoa.h"
26
27 using namespace SLNet;
28
29 void NatPunchthroughDebugInterface_Printf::OnClientMessage(const char *msg)
30 {
31 printf("%s\n", msg);
32 }
33 #if _RAKNET_SUPPORT_PacketLogger==1
34 void NatPunchthroughDebugInterface_PacketLogger::OnClientMessage(const char *msg)
35 {
36 if (pl)
37 {
38 pl->WriteMiscellaneous("Nat", msg);
39 }
40 }
41 #endif
42
43 STATIC_FACTORY_DEFINITIONS(NatPunchthroughClient,NatPunchthroughClient);
44
45 NatPunchthroughClient::NatPunchthroughClient()
46 {
47 natPunchthroughDebugInterface=0;
48 mostRecentExternalPort=0;
49 sp.nextActionTime=0;
50 portStride=0;
51 hasPortStride=UNKNOWN_PORT_STRIDE;
52 }
53 NatPunchthroughClient::~NatPunchthroughClient()
54 {
55 rakPeerInterface=0;
56 Clear();
57 }
58 void NatPunchthroughClient::FindRouterPortStride(const SystemAddress &facilitator)
59 {
60 ConnectionState cs = rakPeerInterface->GetConnectionState(facilitator);
61 if (cs!=IS_CONNECTED)
62 return;
63 if (hasPortStride!=UNKNOWN_PORT_STRIDE)
64 return;
65
66 hasPortStride=CALCULATING_PORT_STRIDE;
67 portStrideCalTimeout = SLNet::GetTime()+5000;
68
69 if (natPunchthroughDebugInterface)
70 {
71 natPunchthroughDebugInterface->OnClientMessage(RakString("Calculating port stride from %s", facilitator.ToString(true)));
72 }
73
74 SLNet::BitStream outgoingBs;
75 outgoingBs.Write((MessageID)ID_NAT_REQUEST_BOUND_ADDRESSES);
76 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,facilitator,false);
77 }
78 bool NatPunchthroughClient::OpenNAT(RakNetGUID destination, const SystemAddress &facilitator)
79 {
80 ConnectionState cs = rakPeerInterface->GetConnectionState(facilitator);
81 if (cs!=IS_CONNECTED)
82 return false;
83 if (hasPortStride==UNKNOWN_PORT_STRIDE)
84 {
85 FindRouterPortStride(facilitator);
86 QueueOpenNAT(destination, facilitator);
87 }
88 else if (hasPortStride==CALCULATING_PORT_STRIDE)
89 {
90 QueueOpenNAT(destination, facilitator);
91 }
92 else
93 {
94 SendPunchthrough(destination, facilitator);
95 }
96
97 return true;
98 }
99 /*
100 bool NatPunchthroughClient::OpenNATGroup(DataStructures::List<RakNetGUID> destinationSystems, const SystemAddress &facilitator)
101 {
102 ConnectionState cs = rakPeerInterface->GetConnectionState(facilitator);
103 if (cs!=IS_CONNECTED)
104 return false;
105
106 unsigned long i;
107 for (i=0; i < destinationSystems.Size(); i++)
108 {
109 SendPunchthrough(destinationSystems[i], facilitator);
110 }
111
112 GroupPunchRequest *gpr = SLNet::OP_NEW<GroupPunchRequest>(_FILE_AND_LINE_);
113 gpr->facilitator=facilitator;
114 gpr->pendingList=destinationSystems;
115 groupPunchRequests.Push(gpr, _FILE_AND_LINE_);
116
117 return true;
118 }
119 */
120 void NatPunchthroughClient::SetDebugInterface(NatPunchthroughDebugInterface *i)
121 {
122 natPunchthroughDebugInterface=i;
123 }
124 void NatPunchthroughClient::Update(void)
125 {
126 SLNet::Time time = SLNet::GetTime();
127
128 if (hasPortStride==CALCULATING_PORT_STRIDE && time > portStrideCalTimeout)
129 {
130 if (natPunchthroughDebugInterface)
131 {
132 natPunchthroughDebugInterface->OnClientMessage("CALCULATING_PORT_STRIDE timeout");
133 }
134
135 SendQueuedOpenNAT();
136 hasPortStride=UNKNOWN_PORT_STRIDE;
137 }
138
139 if (sp.nextActionTime && sp.nextActionTime < time)
140 {
141 SLNet::Time delta = time - sp.nextActionTime;
142 if (sp.testMode==SendPing::TESTING_INTERNAL_IPS)
143 {
144 SendOutOfBand(sp.internalIds[sp.attemptCount],ID_NAT_ESTABLISH_UNIDIRECTIONAL);
145
146 if (++sp.retryCount>=pc.UDP_SENDS_PER_PORT_INTERNAL)
147 {
148 ++sp.attemptCount;
149 sp.retryCount=0;
150 }
151
152 if (sp.attemptCount>=pc.MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK)
153 {
154 sp.testMode=SendPing::WAITING_FOR_INTERNAL_IPS_RESPONSE;
155 if (pc.INTERNAL_IP_WAIT_AFTER_ATTEMPTS>0)
156 {
157 sp.nextActionTime=time+pc.INTERNAL_IP_WAIT_AFTER_ATTEMPTS-delta;
158 }
159 else
160 {
161 sp.testMode=SendPing::TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT;
162 sp.attemptCount=0;
163 sp.sentTTL=false;
164 }
165 }
166 else
167 {
168 sp.nextActionTime=time+pc.TIME_BETWEEN_PUNCH_ATTEMPTS_INTERNAL-delta;
169 }
170 }
171 else if (sp.testMode==SendPing::WAITING_FOR_INTERNAL_IPS_RESPONSE)
172 {
173 sp.testMode=SendPing::TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT;
174 sp.attemptCount=0;
175 sp.sentTTL=false;
176 }
177 /*
178 else if (sp.testMode==SendPing::SEND_WITH_TTL)
179 {
180 // Send to unused port. We do not want the message to arrive, just to open our router's table
181 SystemAddress sa=sp.targetAddress;
182 int ttlSendIndex;
183 for (ttlSendIndex=0; ttlSendIndex <= pc.MAX_PREDICTIVE_PORT_RANGE; ttlSendIndex++)
184 {
185 sa.SetPortHostOrder((unsigned short) (sp.targetAddress.GetPort()+ttlSendIndex));
186 SendTTL(sa);
187 }
188
189 // Only do this stage once
190 // Wait 250 milliseconds for next stage. The delay is so that even with timing errors both systems send out the
191 // datagram with TTL before either sends a real one
192 sp.testMode=SendPing::TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT;
193 sp.nextActionTime=time-delta+250;
194 }
195 */
196 else if (sp.testMode==SendPing::TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT)
197 {
198 if (sp.sentTTL==false)
199 {
200 SystemAddress sa=sp.targetAddress;
201 sa.SetPortHostOrder((unsigned short) (sa.GetPort()+sp.attemptCount));
202 SendTTL(sa);
203
204 if (natPunchthroughDebugInterface)
205 {
206 natPunchthroughDebugInterface->OnClientMessage(RakString("Send with TTL 2 to %s", sa.ToString(true)));
207 }
208
209 sp.nextActionTime = time+pc.EXTERNAL_IP_WAIT_AFTER_FIRST_TTL-delta;
210 sp.sentTTL=true;
211 }
212 else
213 {
214 SystemAddress sa=sp.targetAddress;
215 sa.SetPortHostOrder((unsigned short) (sa.GetPort()+sp.attemptCount));
216 SendOutOfBand(sa,ID_NAT_ESTABLISH_UNIDIRECTIONAL);
217
218 IncrementExternalAttemptCount(time, delta);
219
220 if (sp.attemptCount>pc.MAX_PREDICTIVE_PORT_RANGE)
221 {
222 sp.testMode=SendPing::WAITING_AFTER_ALL_ATTEMPTS;
223 sp.nextActionTime=time+pc.EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS-delta;
224
225 // Skip TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT, etc.
226 /*
227 sp.testMode=SendPing::TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT;
228 sp.attemptCount=0;
229 */
230 }
231 }
232 }
233 else if (sp.testMode==SendPing::TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT)
234 {
235 SystemAddress sa=sp.targetAddress;
236 if ( sp.targetGuid < rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS) )
237 sa.SetPortHostOrder((unsigned short) (1024+sp.attemptCount));
238 else
239 sa.SetPortHostOrder((unsigned short) (sa.GetPort()+sp.attemptCount));
240 SendOutOfBand(sa,ID_NAT_ESTABLISH_UNIDIRECTIONAL);
241
242 IncrementExternalAttemptCount(time, delta);
243
244 if (sp.attemptCount>pc.MAX_PREDICTIVE_PORT_RANGE)
245 {
246 // From 1024 disabled, never helps as I've seen, but slows down the process by half
247 sp.testMode=SendPing::TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024;
248 sp.attemptCount=0;
249 }
250
251 }
252 else if (sp.testMode==SendPing::TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024)
253 {
254 SystemAddress sa=sp.targetAddress;
255 if ( sp.targetGuid > rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS) )
256 sa.SetPortHostOrder((unsigned short) (1024+sp.attemptCount));
257 else
258 sa.SetPortHostOrder((unsigned short) (sa.GetPort()+sp.attemptCount));
259 SendOutOfBand(sa,ID_NAT_ESTABLISH_UNIDIRECTIONAL);
260
261 IncrementExternalAttemptCount(time, delta);
262
263 if (sp.attemptCount>pc.MAX_PREDICTIVE_PORT_RANGE)
264 {
265 // From 1024 disabled, never helps as I've seen, but slows down the process by half
266 sp.testMode=SendPing::TESTING_EXTERNAL_IPS_1024_TO_1024;
267 sp.attemptCount=0;
268 }
269 }
270 else if (sp.testMode==SendPing::TESTING_EXTERNAL_IPS_1024_TO_1024)
271 {
272 SystemAddress sa=sp.targetAddress;
273 sa.SetPortHostOrder((unsigned short) (1024+sp.attemptCount));
274 SendOutOfBand(sa,ID_NAT_ESTABLISH_UNIDIRECTIONAL);
275
276 IncrementExternalAttemptCount(time, delta);
277
278 if (sp.attemptCount>pc.MAX_PREDICTIVE_PORT_RANGE)
279 {
280 if (natPunchthroughDebugInterface)
281 {
282 char ipAddressString[32];
283 sp.targetAddress.ToString(true, ipAddressString, static_cast<size_t>(32));
284 char guidString[128];
285 sp.targetGuid.ToString(guidString, 128);
286 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Likely bidirectional punchthrough failure to guid %s, system address %s.", guidString, ipAddressString));
287 }
288
289 sp.testMode=SendPing::WAITING_AFTER_ALL_ATTEMPTS;
290 sp.nextActionTime=time+pc.EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS-delta;
291 }
292 }
293 else if (sp.testMode==SendPing::WAITING_AFTER_ALL_ATTEMPTS)
294 {
295 // Failed. Tell the user
296 OnPunchthroughFailure();
297 // UpdateGroupPunchOnNatResult(sp.facilitator, sp.targetGuid, sp.targetAddress, 1);
298 }
299
300 if (sp.testMode==SendPing::PUNCHING_FIXED_PORT)
301 {
302 SendOutOfBand(sp.targetAddress,ID_NAT_ESTABLISH_BIDIRECTIONAL);
303 if (++sp.retryCount>=sp.punchingFixedPortAttempts)
304 {
305 if (natPunchthroughDebugInterface)
306 {
307 char ipAddressString[32];
308 sp.targetAddress.ToString(true, ipAddressString, static_cast<size_t>(32));
309 char guidString[128];
310 sp.targetGuid.ToString(guidString, 128);
311 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Likely unidirectional punchthrough failure to guid %s, system address %s.", guidString, ipAddressString));
312 }
313
314 sp.testMode=SendPing::WAITING_AFTER_ALL_ATTEMPTS;
315 sp.nextActionTime=time+pc.EXTERNAL_IP_WAIT_AFTER_ALL_ATTEMPTS-delta;
316 }
317 else
318 {
319 if ((sp.retryCount%pc.UDP_SENDS_PER_PORT_EXTERNAL)==0)
320 sp.nextActionTime=time+pc.EXTERNAL_IP_WAIT_BETWEEN_PORTS-delta;
321 else
322 sp.nextActionTime=time+pc.TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL-delta;
323 }
324 }
325 }
326
327 /*
328 // Remove elapsed groupRequestsInProgress
329 unsigned int i;
330 i=0;
331 while (i < groupRequestsInProgress.Size())
332 {
333 if (time > groupRequestsInProgress[i].time)
334 groupRequestsInProgress.RemoveAtIndexFast(i);
335 else
336 i++;
337 }
338 */
339 }
340 void NatPunchthroughClient::PushFailure(void)
341 {
342 Packet *p = AllocatePacketUnified(sizeof(MessageID)+sizeof(unsigned char));
343 p->data[0]=ID_NAT_PUNCHTHROUGH_FAILED;
344 p->systemAddress=sp.targetAddress;
345 p->systemAddress.systemIndex=(SystemIndex)-1;
346 p->guid=sp.targetGuid;
347 if (sp.weAreSender)
348 p->data[1]=1;
349 else
350 p->data[1]=0;
351 p->wasGeneratedLocally=true;
352 rakPeerInterface->PushBackPacket(p, true);
353 }
354 void NatPunchthroughClient::OnPunchthroughFailure(void)
355 {
356 if (pc.retryOnFailure==false)
357 {
358 if (natPunchthroughDebugInterface)
359 {
360 char ipAddressString[32];
361 sp.targetAddress.ToString(true, ipAddressString, static_cast<size_t>(32));
362 char guidString[128];
363 sp.targetGuid.ToString(guidString, 128);
364 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Failed punchthrough once. Returning failure to guid %s, system address %s to user.", guidString, ipAddressString));
365 }
366
367 PushFailure();
368 OnReadyForNextPunchthrough();
369 return;
370 }
371
372 unsigned int i;
373 for (i=0; i < failedAttemptList.Size(); i++)
374 {
375 if (failedAttemptList[i].guid==sp.targetGuid)
376 {
377 if (natPunchthroughDebugInterface)
378 {
379 char ipAddressString[32];
380 sp.targetAddress.ToString(true, ipAddressString, static_cast<size_t>(32));
381 char guidString[128];
382 sp.targetGuid.ToString(guidString, 128);
383 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Failed punchthrough twice. Returning failure to guid %s, system address %s to user.", guidString, ipAddressString));
384 }
385
386 // Failed a second time, so return failed to user
387 PushFailure();
388
389 OnReadyForNextPunchthrough();
390
391 failedAttemptList.RemoveAtIndexFast(i);
392 return;
393 }
394 }
395
396 if (rakPeerInterface->GetConnectionState(sp.facilitator)!=IS_CONNECTED)
397 {
398 if (natPunchthroughDebugInterface)
399 {
400 char ipAddressString[32];
401 sp.targetAddress.ToString(true, ipAddressString, static_cast<size_t>(32));
402 char guidString[128];
403 sp.targetGuid.ToString(guidString, 128);
404 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Not connected to facilitator, so cannot retry punchthrough after first failure. Returning failure onj guid %s, system address %s to user.", guidString, ipAddressString));
405 }
406
407 // Failed, and can't try again because no facilitator
408 PushFailure();
409 return;
410 }
411
412 if (natPunchthroughDebugInterface)
413 {
414 char ipAddressString[32];
415 sp.targetAddress.ToString(true, ipAddressString, static_cast<size_t>(32));
416 char guidString[128];
417 sp.targetGuid.ToString(guidString, 128);
418 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("First punchthrough failure on guid %s, system address %s. Reattempting.", guidString, ipAddressString));
419 }
420
421 // Failed the first time. Add to the failure queue and try again
422 AddrAndGuid aag;
423 aag.addr=sp.targetAddress;
424 aag.guid=sp.targetGuid;
425 failedAttemptList.Push(aag, _FILE_AND_LINE_);
426
427 // Tell the server we are ready
428 OnReadyForNextPunchthrough();
429
430 // If we are the sender, try again, immediately if possible, else added to the queue on the faciltiator
431 if (sp.weAreSender)
432 SendPunchthrough(sp.targetGuid, sp.facilitator);
433 }
434 PluginReceiveResult NatPunchthroughClient::OnReceive(Packet *packet)
435 {
436 switch (packet->data[0])
437 {
438 case ID_NAT_GET_MOST_RECENT_PORT:
439 {
440 OnGetMostRecentPort(packet);
441 return RR_STOP_PROCESSING_AND_DEALLOCATE;
442 }
443 case ID_NAT_PUNCHTHROUGH_FAILED:
444 case ID_NAT_PUNCHTHROUGH_SUCCEEDED:
445 if (packet->wasGeneratedLocally==false)
446 return RR_STOP_PROCESSING_AND_DEALLOCATE;
447 break;
448 case ID_NAT_RESPOND_BOUND_ADDRESSES:
449 {
450 SLNet::BitStream bs(packet->data,packet->length,false);
451 bs.IgnoreBytes(sizeof(MessageID));
452 unsigned char boundAddressCount;
453 bs.Read(boundAddressCount);
454 if (boundAddressCount<2)
455 {
456 if (natPunchthroughDebugInterface)
457 natPunchthroughDebugInterface->OnClientMessage(RakString("INCAPABLE_PORT_STRIDE. My external ID is %s", rakPeerInterface->GetExternalID(packet->systemAddress).ToString()));
458
459 hasPortStride=INCAPABLE_PORT_STRIDE;
460 SendQueuedOpenNAT();
461 }
462 SystemAddress boundAddresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS];
463 for (int i=0; i < boundAddressCount && i < MAXIMUM_NUMBER_OF_INTERNAL_IDS; i++)
464 {
465 bs.Read(boundAddresses[i]);
466 if (boundAddresses[i]!=packet->systemAddress)
467 {
468 SLNet::BitStream outgoingBs;
469 outgoingBs.Write((MessageID)ID_NAT_PING);
470 uint16_t externalPort = rakPeerInterface->GetExternalID(packet->systemAddress).GetPort();
471 outgoingBs.Write( externalPort );
472 rakPeerInterface->SendOutOfBand((const char*) boundAddresses[i].ToString(false),boundAddresses[i].GetPort(),(const char*) outgoingBs.GetData(),outgoingBs.GetNumberOfBytesUsed());
473 break;
474 }
475 }
476 }
477 return RR_STOP_PROCESSING_AND_DEALLOCATE;
478 case ID_OUT_OF_BAND_INTERNAL:
479 if (packet->length>=2 && packet->data[1]==ID_NAT_PONG)
480 {
481 SLNet::BitStream bs(packet->data,packet->length,false);
482 bs.IgnoreBytes(sizeof(MessageID)*2);
483 uint16_t externalPort;
484 bs.Read(externalPort);
485 uint16_t externalPort2;
486 bs.Read(externalPort2);
487 portStride = externalPort2 - externalPort;
488 mostRecentExternalPort = externalPort2;
489 hasPortStride=HAS_PORT_STRIDE;
490
491 if (natPunchthroughDebugInterface)
492 natPunchthroughDebugInterface->OnClientMessage(RakString("HAS_PORT_STRIDE %i. First external port %i. Second external port %i.", portStride, externalPort, externalPort2));
493
494 SendQueuedOpenNAT();
495 return RR_STOP_PROCESSING_AND_DEALLOCATE;
496 }
497 else if (packet->length>=2 &&
498 (packet->data[1]==ID_NAT_ESTABLISH_UNIDIRECTIONAL || packet->data[1]==ID_NAT_ESTABLISH_BIDIRECTIONAL) &&
499 sp.nextActionTime!=0)
500 {
501 SLNet::BitStream bs(packet->data,packet->length,false);
502 bs.IgnoreBytes(2);
503 uint16_t sessionId;
504 bs.Read(sessionId);
505 // RakAssert(sessionId<100);
506 if (sessionId!=sp.sessionId)
507 break;
508
509 char ipAddressString[32];
510 packet->systemAddress.ToString(true,ipAddressString,static_cast<size_t>(32));
511 // sp.targetGuid==packet->guid is because the internal IP addresses reported may include loopbacks not reported by RakPeer::IsLocalIP()
512 if (packet->data[1]==ID_NAT_ESTABLISH_UNIDIRECTIONAL && sp.targetGuid==packet->guid)
513 {
514
515 if (sp.testMode!=SendPing::PUNCHING_FIXED_PORT)
516 {
517 sp.testMode=SendPing::PUNCHING_FIXED_PORT;
518 sp.retryCount+=sp.attemptCount*pc.UDP_SENDS_PER_PORT_EXTERNAL;
519 sp.targetAddress=packet->systemAddress;
520 // Keeps trying until the other side gives up too, in case it is unidirectional
521 sp.punchingFixedPortAttempts=pc.UDP_SENDS_PER_PORT_EXTERNAL*(pc.MAX_PREDICTIVE_PORT_RANGE+1);
522
523 if (natPunchthroughDebugInterface)
524 {
525 char guidString[128];
526 sp.targetGuid.ToString(guidString, 128);
527 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("PUNCHING_FIXED_PORT: Received ID_NAT_ESTABLISH_UNIDIRECTIONAL from guid %s, system address %s.", guidString, ipAddressString));
528 }
529 }
530 else {
531 if (natPunchthroughDebugInterface)
532 {
533 char guidString[128];
534 sp.targetGuid.ToString(guidString, 128);
535 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Received ID_NAT_ESTABLISH_UNIDIRECTIONAL from guid %s, system address %s.", guidString, ipAddressString));
536 }
537 }
538
539 SendOutOfBand(sp.targetAddress,ID_NAT_ESTABLISH_BIDIRECTIONAL);
540 }
541 else if (packet->data[1]==ID_NAT_ESTABLISH_BIDIRECTIONAL &&
542 sp.targetGuid==packet->guid)
543 {
544 // They send back our port
545 unsigned short ourExternalPort;
546 bs.Read(ourExternalPort);
547 if (mostRecentExternalPort==0)
548 {
549 mostRecentExternalPort=ourExternalPort;
550
551 if (natPunchthroughDebugInterface)
552 {
553 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("ID_NAT_ESTABLISH_BIDIRECTIONAL mostRecentExternalPort first time set to %i", mostRecentExternalPort));
554 }
555 }
556 else
557 {
558 if (sp.testMode!=SendPing::TESTING_INTERNAL_IPS && sp.testMode!=SendPing::WAITING_FOR_INTERNAL_IPS_RESPONSE)
559 {
560 if (hasPortStride!=HAS_PORT_STRIDE)
561 {
562 portStride = ourExternalPort - mostRecentExternalPort;
563 hasPortStride=HAS_PORT_STRIDE;
564
565 if (natPunchthroughDebugInterface)
566 {
567 natPunchthroughDebugInterface->OnClientMessage(RakString("ID_NAT_ESTABLISH_BIDIRECTIONAL: Estimated port stride from incoming connection at %i. ourExternalPort=%i mostRecentExternalPort=%i", portStride, ourExternalPort, mostRecentExternalPort));
568 }
569
570 SendQueuedOpenNAT();
571 }
572
573 //nextExternalPort += portStride * (pc.MAX_PREDICTIVE_PORT_RANGE+1);
574 mostRecentExternalPort = ourExternalPort;
575
576 if (natPunchthroughDebugInterface)
577 {
578 natPunchthroughDebugInterface->OnClientMessage(RakString("ID_NAT_ESTABLISH_BIDIRECTIONAL: New mostRecentExternalPort %i", mostRecentExternalPort));
579 }
580 }
581 }
582 SendOutOfBand(packet->systemAddress,ID_NAT_ESTABLISH_BIDIRECTIONAL);
583
584 // Tell the user about the success
585 sp.targetAddress=packet->systemAddress;
586 PushSuccess();
587 //UpdateGroupPunchOnNatResult(sp.facilitator, sp.targetGuid, sp.targetAddress, 1);
588 OnReadyForNextPunchthrough();
589 bool removedFromFailureQueue=RemoveFromFailureQueue();
590
591 if (natPunchthroughDebugInterface)
592 {
593 char guidString[128];
594 sp.targetGuid.ToString(guidString, 128);
595 if (removedFromFailureQueue)
596 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Punchthrough to guid %s, system address %s succeeded on 2nd attempt.", guidString, ipAddressString));
597 else
598 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Punchthrough to guid %s, system address %s succeeded on 1st attempt.", guidString, ipAddressString));
599 }
600 }
601
602 // mostRecentNewExternalPort=packet->systemAddress.GetPort();
603 }
604 return RR_STOP_PROCESSING_AND_DEALLOCATE;
605 case ID_NAT_ALREADY_IN_PROGRESS:
606 {
607 SLNet::BitStream incomingBs(packet->data, packet->length, false);
608 incomingBs.IgnoreBytes(sizeof(MessageID));
609 RakNetGUID targetGuid;
610 incomingBs.Read(targetGuid);
611 // Don't update group, just use later message
612 // UpdateGroupPunchOnNatResult(packet->systemAddress, targetGuid, UNASSIGNED_SYSTEM_ADDRESS, 2);
613 if (natPunchthroughDebugInterface)
614 {
615 char guidString[128];
616 targetGuid.ToString(guidString, 128);
617 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Punchthrough retry to guid %s failed due to ID_NAT_ALREADY_IN_PROGRESS. Returning failure.", guidString));
618 }
619
620 }
621 break;
622 case ID_NAT_TARGET_NOT_CONNECTED:
623 case ID_NAT_CONNECTION_TO_TARGET_LOST:
624 case ID_NAT_TARGET_UNRESPONSIVE:
625 {
626 const char *reason;
627 if (packet->data[0]==ID_NAT_TARGET_NOT_CONNECTED)
628 reason=(char *)"ID_NAT_TARGET_NOT_CONNECTED";
629 else if (packet->data[0]==ID_NAT_CONNECTION_TO_TARGET_LOST)
630 reason=(char *)"ID_NAT_CONNECTION_TO_TARGET_LOST";
631 else
632 reason=(char *)"ID_NAT_TARGET_UNRESPONSIVE";
633
634
635 SLNet::BitStream incomingBs(packet->data, packet->length, false);
636 incomingBs.IgnoreBytes(sizeof(MessageID));
637
638 RakNetGUID targetGuid;
639 incomingBs.Read(targetGuid);
640 //UpdateGroupPunchOnNatResult(packet->systemAddress, targetGuid, UNASSIGNED_SYSTEM_ADDRESS, 2);
641
642 if (packet->data[0]==ID_NAT_CONNECTION_TO_TARGET_LOST ||
643 packet->data[0]==ID_NAT_TARGET_UNRESPONSIVE)
644 {
645 uint16_t sessionId;
646 incomingBs.Read(sessionId);
647 if (sessionId!=sp.sessionId)
648 break;
649 }
650
651 unsigned int i;
652 for (i=0; i < failedAttemptList.Size(); i++)
653 {
654 if (failedAttemptList[i].guid==targetGuid)
655 {
656 if (natPunchthroughDebugInterface)
657 {
658 char guidString[128];
659 targetGuid.ToString(guidString, 128);
660 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Punchthrough retry to guid %s failed due to %s.", guidString, reason));
661
662 }
663
664 // If the retry target is not connected, or loses connection, or is not responsive, then previous failures cannot be retried.
665
666 // Don't need to return failed, the other messages indicate failure anyway
667 /*
668 Packet *p = AllocatePacketUnified(sizeof(MessageID));
669 p->data[0]=ID_NAT_PUNCHTHROUGH_FAILED;
670 p->systemAddress=failedAttemptList[i].addr;
671 p->systemAddress.systemIndex=(SystemIndex)-1;
672 p->guid=failedAttemptList[i].guid;
673 rakPeerInterface->PushBackPacket(p, false);
674 */
675
676 failedAttemptList.RemoveAtIndexFast(i);
677 break;
678 }
679 }
680
681 if (natPunchthroughDebugInterface)
682 {
683 char guidString[128];
684 targetGuid.ToString(guidString, 128);
685 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Punchthrough attempt to guid %s failed due to %s.", guidString, reason));
686 }
687
688 // Stop trying punchthrough
689 sp.nextActionTime=0;
690
691 /*
692 SLNet::BitStream bs(packet->data, packet->length, false);
693 bs.IgnoreBytes(sizeof(MessageID));
694 RakNetGUID failedSystem;
695 bs.Read(failedSystem);
696 bool deletedFirst=false;
697 unsigned int i=0;
698 while (i < pendingOpenNAT.Size())
699 {
700 if (pendingOpenNAT[i].destination==failedSystem)
701 {
702 if (i==0)
703 deletedFirst=true;
704 pendingOpenNAT.RemoveAtIndex(i);
705 }
706 else
707 i++;
708 }
709 // Failed while in progress. Go to next in attempt queue
710 if (deletedFirst && pendingOpenNAT.Size())
711 {
712 SendPunchthrough(pendingOpenNAT[0].destination, pendingOpenNAT[0].facilitator);
713 sp.nextActionTime=0;
714 }
715 */
716 }
717 break;
718 case ID_TIMESTAMP:
719 if (packet->data[sizeof(MessageID)+sizeof(SLNet::Time)]==ID_NAT_CONNECT_AT_TIME)
720 {
721 OnConnectAtTime(packet);
722 return RR_STOP_PROCESSING_AND_DEALLOCATE;
723 }
724 break;
725 }
726 return RR_CONTINUE_PROCESSING;
727 }
728 /*
729 void NatPunchthroughClient::ProcessNextPunchthroughQueue(void)
730 {
731 // Go to the next attempt
732 if (pendingOpenNAT.Size())
733 pendingOpenNAT.RemoveAtIndex(0);
734
735 // Do next punchthrough attempt
736 if (pendingOpenNAT.Size())
737 SendPunchthrough(pendingOpenNAT[0].destination, pendingOpenNAT[0].facilitator);
738
739 sp.nextActionTime=0;
740 }
741 */
742 void NatPunchthroughClient::OnConnectAtTime(Packet *packet)
743 {
744 // RakAssert(sp.nextActionTime==0);
745
746 SLNet::BitStream bs(packet->data, packet->length, false);
747 bs.IgnoreBytes(sizeof(MessageID));
748 bs.Read(sp.nextActionTime);
749 bs.IgnoreBytes(sizeof(MessageID));
750 bs.Read(sp.sessionId);
751 bs.Read(sp.targetAddress);
752 int j;
753 // int k;
754 // k=0;
755 for (j=0; j < MAXIMUM_NUMBER_OF_INTERNAL_IDS; j++)
756 bs.Read(sp.internalIds[j]);
757
758 // Prevents local testing
759 /*
760 for (j=0; j < MAXIMUM_NUMBER_OF_INTERNAL_IDS; j++)
761 {
762 SystemAddress id;
763 bs.Read(id);
764 char str[32];
765 id.ToString(false,str);
766 if (rakPeerInterface->IsLocalIP(str)==false)
767 sp.internalIds[k++]=id;
768 }
769 */
770 sp.attemptCount=0;
771 sp.retryCount=0;
772 if (pc.MAXIMUM_NUMBER_OF_INTERNAL_IDS_TO_CHECK>0)
773 {
774 sp.testMode=SendPing::TESTING_INTERNAL_IPS;
775 }
776 else
777 {
778 // TESTING: Try sending to unused ports on the remote system to reserve our own ports while not getting banned
779 //sp.testMode=SendPing::SEND_WITH_TTL;
780 sp.testMode=SendPing::TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT;
781 sp.attemptCount=0;
782 sp.sentTTL=false;
783 }
784 bs.Read(sp.targetGuid);
785 bs.Read(sp.weAreSender);
786 }
787 void NatPunchthroughClient::SendTTL(const SystemAddress &sa)
788 {
789 if (sa==UNASSIGNED_SYSTEM_ADDRESS)
790 return;
791 if (sa.GetPort()==0)
792 return;
793
794 char ipAddressString[32];
795 sa.ToString(false, ipAddressString,static_cast<size_t>(32));
796 // TTL of 1 doesn't get past the router, 2 might hit the other system on a LAN
797 rakPeerInterface->SendTTL(ipAddressString,sa.GetPort(), 2);
798 }
799
800 const char *TestModeToString(NatPunchthroughClient::SendPing::TestMode tm)
801 {
802 switch (tm)
803 {
804 case NatPunchthroughClient::SendPing::TESTING_INTERNAL_IPS:
805 return "TESTING_INTERNAL_IPS";
806 break;
807 case NatPunchthroughClient::SendPing::WAITING_FOR_INTERNAL_IPS_RESPONSE:
808 return "WAITING_FOR_INTERNAL_IPS_RESPONSE";
809 break;
810 // case NatPunchthroughClient::SendPing::SEND_WITH_TTL:
811 // return "SEND_WITH_TTL";
812 // break;
813 case NatPunchthroughClient::SendPing::TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT:
814 return "TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_FACILITATOR_PORT";
815 break;
816 case NatPunchthroughClient::SendPing::TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT:
817 return "TESTING_EXTERNAL_IPS_1024_TO_FACILITATOR_PORT";
818 break;
819 case NatPunchthroughClient::SendPing::TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024:
820 return "TESTING_EXTERNAL_IPS_FACILITATOR_PORT_TO_1024";
821 break;
822 case NatPunchthroughClient::SendPing::TESTING_EXTERNAL_IPS_1024_TO_1024:
823 return "TESTING_EXTERNAL_IPS_1024_TO_1024";
824 break;
825 case NatPunchthroughClient::SendPing::WAITING_AFTER_ALL_ATTEMPTS:
826 return "WAITING_AFTER_ALL_ATTEMPTS";
827 break;
828 case NatPunchthroughClient::SendPing::PUNCHING_FIXED_PORT:
829 return "PUNCHING_FIXED_PORT";
830 break;
831 }
832 return "";
833 }
834 void NatPunchthroughClient::SendOutOfBand(SystemAddress sa, MessageID oobId)
835 {
836 if (sa==UNASSIGNED_SYSTEM_ADDRESS)
837 return;
838 if (sa.GetPort()==0)
839 return;
840
841 SLNet::BitStream oob;
842 oob.Write(oobId);
843 oob.Write(sp.sessionId);
844 // RakAssert(sp.sessionId<100);
845 if (oobId==ID_NAT_ESTABLISH_BIDIRECTIONAL)
846 oob.Write(sa.GetPort());
847 char ipAddressString[32];
848 sa.ToString(false, ipAddressString, static_cast<size_t>(32));
849 rakPeerInterface->SendOutOfBand((const char*) ipAddressString,sa.GetPort(),(const char*) oob.GetData(),oob.GetNumberOfBytesUsed());
850
851 if (natPunchthroughDebugInterface)
852 {
853 sa.ToString(true,ipAddressString,static_cast<size_t>(32));
854 char guidString[128];
855 sp.targetGuid.ToString(guidString, 128);
856
857 // server - diff = my time
858 // server = myTime + diff
859 SLNet::Time clockDifferential = rakPeerInterface->GetClockDifferential(sp.facilitator);
860 SLNet::Time serverTime = SLNet::GetTime() + clockDifferential;
861
862 if (oobId==ID_NAT_ESTABLISH_UNIDIRECTIONAL)
863 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString(RAK_TIME_FORMAT_STRING ": %s: OOB ID_NAT_ESTABLISH_UNIDIRECTIONAL to guid %s, system address %s.\n", serverTime, TestModeToString(sp.testMode), guidString, ipAddressString));
864 else
865 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString(RAK_TIME_FORMAT_STRING ": %s: OOB ID_NAT_ESTABLISH_BIDIRECTIONAL to guid %s, system address %s.\n", serverTime, TestModeToString(sp.testMode), guidString, ipAddressString));
866 }
867 }
868 void NatPunchthroughClient::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
869 {
870 (void) rakNetGUID;
871 (void) isIncoming;
872
873 // Try to track new port mappings on the router. Not reliable, but better than nothing.
874 SystemAddress ourExternalId = rakPeerInterface->GetExternalID(systemAddress);
875 if (ourExternalId!=UNASSIGNED_SYSTEM_ADDRESS && mostRecentExternalPort==0) {
876 mostRecentExternalPort=ourExternalId.GetPort();
877
878 if (natPunchthroughDebugInterface)
879 {
880 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("OnNewConnection mostRecentExternalPort first time set to %i", mostRecentExternalPort));
881 }
882 }
883
884 /*
885 unsigned int i;
886 i=0;
887 while (i < groupRequestsInProgress.Size())
888 {
889 if (groupRequestsInProgress[i].guid==rakNetGUID)
890 {
891 groupRequestsInProgress.RemoveAtIndexFast(i);
892 }
893 else
894 {
895 i++;
896 }
897 }
898 */
899 }
900
901 void NatPunchthroughClient::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
902 {
903 (void) systemAddress;
904 (void) rakNetGUID;
905 (void) lostConnectionReason;
906
907 if (sp.facilitator==systemAddress)
908 {
909 // If we lose the connection to the facilitator, all previous failures not currently in progress are returned as such
910 unsigned int i=0;
911 while (i < failedAttemptList.Size())
912 {
913 if (sp.nextActionTime!=0 && sp.targetGuid==failedAttemptList[i].guid)
914 {
915 i++;
916 continue;
917 }
918
919 PushFailure();
920
921 failedAttemptList.RemoveAtIndexFast(i);
922 }
923 }
924
925 /*
926 unsigned int i;
927 i=0;
928 while (i < groupPunchRequests.Size())
929 {
930 if (groupPunchRequests[i]->facilitator==systemAddress)
931 {
932 SLNet::OP_DELETE(groupPunchRequests[i],_FILE_AND_LINE_);
933 groupPunchRequests.RemoveAtIndexFast(i);
934 }
935 else
936 {
937 i++;
938 }
939 }
940 */
941
942 }
943 void NatPunchthroughClient::GetUPNPPortMappings(char *externalPort, char *internalPort, const SystemAddress &natPunchthroughServerAddress)
944 {
945 DataStructures::List< SLNet::RakNetSocket2* > sockets;
946 rakPeerInterface->GetSockets(sockets);
947 Itoa(sockets[0]->GetBoundAddress().GetPort(),internalPort,10);
948 if (mostRecentExternalPort==0)
949 mostRecentExternalPort=rakPeerInterface->GetExternalID(natPunchthroughServerAddress).GetPort();
950 Itoa(mostRecentExternalPort,externalPort,10);
951 }
952 void NatPunchthroughClient::OnFailureNotification(Packet *packet)
953 {
954 SLNet::BitStream incomingBs(packet->data,packet->length,false);
955 incomingBs.IgnoreBytes(sizeof(MessageID));
956 RakNetGUID senderGuid;
957 incomingBs.Read(senderGuid);
958
959 /*
960 unsigned int i;
961 i=0;
962 while (i < groupRequestsInProgress.Size())
963 {
964 if (groupRequestsInProgress[i].guid==senderGuid)
965 {
966 groupRequestsInProgress.RemoveAtIndexFast(i);
967 break;
968 }
969 else
970 {
971 i++;
972 }
973 }
974 */
975 }
976 void NatPunchthroughClient::OnGetMostRecentPort(Packet *packet)
977 {
978 SLNet::BitStream incomingBs(packet->data,packet->length,false);
979 incomingBs.IgnoreBytes(sizeof(MessageID));
980 uint16_t sessionId;
981 incomingBs.Read(sessionId);
982
983 SLNet::BitStream outgoingBs;
984 outgoingBs.Write((MessageID)ID_NAT_GET_MOST_RECENT_PORT);
985 outgoingBs.Write(sessionId);
986 if (mostRecentExternalPort==0)
987 {
988 mostRecentExternalPort=rakPeerInterface->GetExternalID(packet->systemAddress).GetPort();
989 RakAssert(mostRecentExternalPort!=0);
990
991 if (natPunchthroughDebugInterface)
992 {
993 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("OnGetMostRecentPort mostRecentExternalPort first time set to %i", mostRecentExternalPort));
994 }
995 }
996
997 unsigned short portWithStride;
998 if (hasPortStride==HAS_PORT_STRIDE)
999 portWithStride = mostRecentExternalPort + portStride;
1000 else
1001 portWithStride = mostRecentExternalPort;
1002 outgoingBs.Write(portWithStride);
1003
1004 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
1005 sp.facilitator=packet->systemAddress;
1006 }
1007 /*
1008 unsigned int NatPunchthroughClient::GetPendingOpenNATIndex(RakNetGUID destination, const SystemAddress &facilitator)
1009 {
1010 unsigned int i;
1011 for (i=0; i < pendingOpenNAT.Size(); i++)
1012 {
1013 if (pendingOpenNAT[i].destination==destination && pendingOpenNAT[i].facilitator==facilitator)
1014 return i;
1015 }
1016 return (unsigned int) -1;
1017 }
1018 */
1019 void NatPunchthroughClient::QueueOpenNAT(RakNetGUID destination, const SystemAddress &facilitator)
1020 {
1021 DSTAndFac daf;
1022 daf.destination=destination;
1023 daf.facilitator=facilitator;
1024 queuedOpenNat.Push(daf, _FILE_AND_LINE_);
1025 }
1026 void NatPunchthroughClient::SendQueuedOpenNAT(void)
1027 {
1028 while (queuedOpenNat.IsEmpty()==false)
1029 {
1030 DSTAndFac daf = queuedOpenNat.Pop();
1031 SendPunchthrough(daf.destination, daf.facilitator);
1032 }
1033 }
1034 void NatPunchthroughClient::SendPunchthrough(RakNetGUID destination, const SystemAddress &facilitator)
1035 {
1036 SLNet::BitStream outgoingBs;
1037 outgoingBs.Write((MessageID)ID_NAT_PUNCHTHROUGH_REQUEST);
1038 outgoingBs.Write(destination);
1039 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,facilitator,false);
1040
1041 // RakAssert(rakPeerInterface->GetSystemAddressFromGuid(destination)==UNASSIGNED_SYSTEM_ADDRESS);
1042
1043 if (natPunchthroughDebugInterface)
1044 {
1045 char guidString[128];
1046 destination.ToString(guidString, 128);
1047 natPunchthroughDebugInterface->OnClientMessage(SLNet::RakString("Starting ID_NAT_PUNCHTHROUGH_REQUEST to guid %s.", guidString));
1048 }
1049 }
1050 void NatPunchthroughClient::OnAttach(void)
1051 {
1052 Clear();
1053 }
1054 void NatPunchthroughClient::OnDetach(void)
1055 {
1056 Clear();
1057 }
1058 void NatPunchthroughClient::OnRakPeerShutdown(void)
1059 {
1060 Clear();
1061 }
1062 void NatPunchthroughClient::Clear(void)
1063 {
1064 OnReadyForNextPunchthrough();
1065
1066 failedAttemptList.Clear(false, _FILE_AND_LINE_);
1067
1068 queuedOpenNat.Clear(_FILE_AND_LINE_);
1069 /*
1070 groupRequestsInProgress.Clear(false, _FILE_AND_LINE_);
1071 unsigned int i;
1072 for (i=0; i < groupPunchRequests.Size(); i++)
1073 {
1074 SLNet::OP_DELETE(groupPunchRequests[i],_FILE_AND_LINE_);
1075 }
1076 groupPunchRequests.Clear(true, _FILE_AND_LINE_);
1077 */
1078 }
1079 PunchthroughConfiguration* NatPunchthroughClient::GetPunchthroughConfiguration(void)
1080 {
1081 return &pc;
1082 }
1083 void NatPunchthroughClient::OnReadyForNextPunchthrough(void)
1084 {
1085 if (rakPeerInterface==0)
1086 return;
1087
1088 sp.nextActionTime=0;
1089
1090 SLNet::BitStream outgoingBs;
1091 outgoingBs.Write((MessageID)ID_NAT_CLIENT_READY);
1092 rakPeerInterface->Send(&outgoingBs,HIGH_PRIORITY,RELIABLE_ORDERED,0,sp.facilitator,false);
1093 }
1094
1095 void NatPunchthroughClient::PushSuccess(void)
1096 {
1097 Packet *p = AllocatePacketUnified(sizeof(MessageID)+sizeof(unsigned char));
1098 p->data[0]=ID_NAT_PUNCHTHROUGH_SUCCEEDED;
1099 p->systemAddress=sp.targetAddress;
1100 p->systemAddress.systemIndex=(SystemIndex)-1;
1101 p->guid=sp.targetGuid;
1102 if (sp.weAreSender)
1103 p->data[1]=1;
1104 else
1105 p->data[1]=0;
1106 p->wasGeneratedLocally=true;
1107 rakPeerInterface->PushBackPacket(p, true);
1108 }
1109 bool NatPunchthroughClient::RemoveFromFailureQueue(void)
1110 {
1111 unsigned int i;
1112 for (i=0; i < failedAttemptList.Size(); i++)
1113 {
1114 if (failedAttemptList[i].guid==sp.targetGuid)
1115 {
1116 // Remove from failure queue
1117 failedAttemptList.RemoveAtIndexFast(i);
1118 return true;
1119 }
1120 }
1121 return false;
1122 }
1123
1124 void NatPunchthroughClient::IncrementExternalAttemptCount(SLNet::Time time, SLNet::Time delta)
1125 {
1126 if (++sp.retryCount>=pc.UDP_SENDS_PER_PORT_EXTERNAL)
1127 {
1128 ++sp.attemptCount;
1129 sp.retryCount=0;
1130 sp.nextActionTime=time+pc.EXTERNAL_IP_WAIT_BETWEEN_PORTS-delta;
1131 sp.sentTTL=false;
1132 }
1133 else
1134 {
1135 sp.nextActionTime=time+pc.TIME_BETWEEN_PUNCH_ATTEMPTS_EXTERNAL-delta;
1136 }
1137 }
1138 /*
1139 // 0=failed, 1=success, 2=ignore
1140 void NatPunchthroughClient::UpdateGroupPunchOnNatResult(SystemAddress facilitator, RakNetGUID targetSystem, SystemAddress targetSystemAddress, int result)
1141 {
1142 GroupPunchRequest *gpr;
1143 unsigned long i,j,k;
1144 i=0;
1145 while (i < groupPunchRequests.Size())
1146 {
1147 gpr = groupPunchRequests[i];
1148 if (gpr->facilitator==facilitator)
1149 {
1150 j=0;
1151 while (j < gpr->pendingList.Size())
1152 {
1153 if (gpr->pendingList[j]==targetSystem)
1154 {
1155 if (result==0)
1156 {
1157 gpr->failedList.Push(targetSystem, _FILE_AND_LINE_);
1158 }
1159 else if (result==1)
1160 {
1161 gpr->passedListGuid.Push(targetSystem, _FILE_AND_LINE_);
1162 gpr->passedListAddress.Push(targetSystemAddress, _FILE_AND_LINE_);
1163 }
1164 else
1165 {
1166 gpr->ignoredList.Push(targetSystem, _FILE_AND_LINE_);
1167 }
1168 gpr->pendingList.RemoveAtIndex(j);
1169 }
1170 else
1171 j++;
1172 }
1173 }
1174 if (gpr->pendingList.Size()==0)
1175 {
1176 SLNet::BitStream output;
1177 if (gpr->failedList.Size()==0)
1178 {
1179 output.Write(ID_NAT_GROUP_PUNCH_SUCCEEDED);
1180 }
1181 else
1182 {
1183 output.Write(ID_NAT_GROUP_PUNCH_FAILED);
1184 }
1185
1186 output.WriteCasted<unsigned char>(gpr->passedListGuid.Size());
1187 for (k=0; k < gpr->passedListGuid.Size(); k++)
1188 {
1189 output.Write(gpr->passedListGuid[k]);
1190 output.Write(gpr->passedListAddress[k]);
1191 }
1192 output.WriteCasted<unsigned char>(gpr->ignoredList.Size());
1193 for (k=0; k < gpr->ignoredList.Size(); k++)
1194 {
1195 output.Write(gpr->ignoredList[k]);
1196 }
1197 output.WriteCasted<unsigned char>(gpr->failedList.Size());
1198 for (k=0; k < gpr->failedList.Size(); k++)
1199 {
1200 output.Write(gpr->failedList[k]);
1201 }
1202
1203 Packet *p = AllocatePacketUnified(output.GetNumberOfBytesUsed());
1204 p->systemAddress=gpr->facilitator;
1205 p->systemAddress.systemIndex=(SystemIndex)-1;
1206 p->guid=rakPeerInterface->GetGuidFromSystemAddress(gpr->facilitator);
1207 p->wasGeneratedLocally=true;
1208 memcpy(p->data, output.GetData(), output.GetNumberOfBytesUsed());
1209 rakPeerInterface->PushBackPacket(p, true);
1210
1211 groupPunchRequests.RemoveAtIndex(i);
1212 SLNet::OP_DELETE(gpr, _FILE_AND_LINE_);
1213 }
1214 else
1215 i++;
1216 }
1217 }
1218 */
1219
1220 #endif // _RAKNET_SUPPORT_*
1221
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CloudCommon.h Source File

  • include
  • slikenet
CloudCommon.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_CloudClient==1 || _RAKNET_SUPPORT_CloudServer==1
18
19 #ifndef __CLOUD_COMMON_H
20 #define __CLOUD_COMMON_H
21
22 #include "types.h"
23 #include "string.h"
24
25 namespace SLNet
26 {
27
28 class BitStream;
29 struct CloudQueryRow;
30
33 class RAK_DLL_EXPORT CloudAllocator
34 {
35 public:
36 CloudAllocator() {}
37 virtual ~CloudAllocator() {}
38
40 virtual CloudQueryRow* AllocateCloudQueryRow(void);
42 virtual void DeallocateCloudQueryRow(CloudQueryRow *row);
44 virtual unsigned char *AllocateRowData(uint32_t bytesNeededForData);
46 virtual void DeallocateRowData(void *data);
47 };
48
51 struct RAK_DLL_EXPORT CloudKey
52 {
53 CloudKey() {}
54 CloudKey(SLNet::RakString _primaryKey, uint32_t _secondaryKey) : primaryKey(_primaryKey), secondaryKey(_secondaryKey) {}
55 ~CloudKey() {}
56
59 SLNet::RakString primaryKey;
60
62 uint32_t secondaryKey;
63
65 void Serialize(bool writeToBitstream, BitStream *bitStream);
66 };
67
69 int CloudKeyComp(const CloudKey &key, const CloudKey &data);
70
73 struct RAK_DLL_EXPORT CloudQuery
74 {
75 CloudQuery() {startingRowIndex=0; maxRowsToReturn=0; subscribeToResults=false;}
76
80 DataStructures::List<CloudKey> keys;
81
83 uint32_t startingRowIndex;
84
86 uint32_t maxRowsToReturn;
87
89 bool subscribeToResults;
90
92 void Serialize(bool writeToBitstream, BitStream *bitStream);
93 };
94
96 struct RAK_DLL_EXPORT CloudQueryRow
97 {
99 CloudKey key;
100
102 unsigned char *data;
103
105 uint32_t length;
106
108 SystemAddress serverSystemAddress;
109
111 SystemAddress clientSystemAddress;
112
114 RakNetGUID serverGUID;
115
117 RakNetGUID clientGUID;
118
120 void Serialize(bool writeToBitstream, BitStream *bitStream, CloudAllocator *allocator);
121 };
122
124 struct RAK_DLL_EXPORT CloudQueryResult
125 {
127 CloudQuery cloudQuery;
128
130 DataStructures::List<CloudQueryRow*> rowsReturned;
131
136 DataStructures::List<uint32_t> resultKeyIndices;
137
139 bool subscribeToResults;
140
142 void Serialize(bool writeToBitstream, BitStream *bitStream, CloudAllocator *allocator);
144 void SerializeHeader(bool writeToBitstream, BitStream *bitStream);
146 void SerializeNumRows(bool writeToBitstream, uint32_t &numRows, BitStream *bitStream);
148 void SerializeCloudQueryRows(bool writeToBitstream, uint32_t &numRows, BitStream *bitStream, CloudAllocator *allocator);
149 };
150
151 } // Namespace SLikeNet
152
153 #endif // __CLOUD_COMMON_H
154
155 #endif // #if _RAKNET_SUPPORT_CloudClient==1 || _RAKNET_SUPPORT_CloudServer==1
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_HuffmanEncodingTreeFactory.h Source File

  • include
  • slikenet
DS_HuffmanEncodingTreeFactory.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __HUFFMAN_ENCODING_TREE_FACTORY
23 #define __HUFFMAN_ENCODING_TREE_FACTORY
24
25 #include "memoryoverride.h"
26
27 namespace SLNet {
29 class HuffmanEncodingTree;
30
33 class HuffmanEncodingTreeFactory
34 {
35 public:
37 HuffmanEncodingTreeFactory();
38
41 void Reset( void );
42
46 void AddToFrequencyTable( unsigned char *array, int size );
47
50 void GetFrequencyTable( unsigned int _frequency[ 256 ] );
51
54 unsigned int * GetFrequencyTable( void );
55
59 HuffmanEncodingTree * GenerateTree( void );
60
61 private:
62
64 unsigned int frequency[ 256 ];
65 };
66
67 } // namespace SLNet
68
69 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/gettimeofday.cpp Source File

  • src
gettimeofday.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #if defined(_WIN32) && !defined(__GNUC__) &&!defined(__GCCXML__)
17
18 #include "slikenet/gettimeofday.h"
19
20 // From http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
21
22 #include "slikenet/WindowsIncludes.h"
23
24 #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
25 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
26 #else
27 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
28 #endif
29
30 int gettimeofday(struct timeval *tv, struct timezone *tz)
31 {
32 #if defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
33 // _tzset not supported
34 (void) tv;
35 (void) tz;
36 #else
37
38 FILETIME ft;
39 unsigned __int64 tmpres = 0;
40 static int tzflag;
41
42 if (NULL != tv)
43 {
44 GetSystemTimeAsFileTime(&ft);
45
46 tmpres |= ft.dwHighDateTime;
47 tmpres <<= 32;
48 tmpres |= ft.dwLowDateTime;
49
50 /*converting file time to unix epoch*/
51 tmpres /= 10; /*convert into microseconds*/
52 tmpres -= DELTA_EPOCH_IN_MICROSECS;
53 tv->tv_sec = (long)(tmpres / 1000000UL);
54 tv->tv_usec = (long)(tmpres % 1000000UL);
55 }
56
57 if (NULL != tz)
58 {
59 if (!tzflag)
60 {
61 _tzset();
62 tzflag++;
63 }
64 long seconds;
65 _get_timezone(&seconds);
66 tz->tz_minuteswest = seconds / 60;
67 _get_daylight(&(tz->tz_dsttime));
68 }
69
70 #endif
71
72 return 0;
73 }
74
75 #endif
76
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
RefCountedObj Member List

This is the complete list of members for RefCountedObj, including all inherited members.

AddRef(void) | RefCountedObj | inline
Deref(void) | RefCountedObj | inline
refCount | RefCountedObj |
RefCountedObj() | RefCountedObj | inline
~RefCountedObj() | RefCountedObj | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetGUID
SLNet::RakNetGUID Member List

This is the complete list of members for SLNet::RakNetGUID, including all inherited members.

FromString(const char *source) | SLNet::RakNetGUID |
g | SLNet::RakNetGUID |
operator!=(const RakNetGUID &right) const | SLNet::RakNetGUID |
operator<(const RakNetGUID &right) const | SLNet::RakNetGUID |
operator=(const RakNetGUID &input) | SLNet::RakNetGUID | inline
operator==(const RakNetGUID &right) const | SLNet::RakNetGUID |
operator>(const RakNetGUID &right) const | SLNet::RakNetGUID |
RakNetGUID() | SLNet::RakNetGUID |
RakNetGUID(uint64_t _g) | SLNet::RakNetGUID | inlineexplicit
size() | SLNet::RakNetGUID | inlinestatic
systemIndex | SLNet::RakNetGUID |
ToString(void) const | SLNet::RakNetGUID |
ToString(char *dest) const | SLNet::RakNetGUID |
ToString(char *dest, size_t destSize) const | SLNet::RakNetGUID |
ToUint32(const RakNetGUID &g) | SLNet::RakNetGUID | static
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TableSerializer.h Source File

  • include
  • slikenet
TableSerializer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __TABLE_SERIALIZER_H
17 #define __TABLE_SERIALIZER_H
18
19 #include "memoryoverride.h"
20 #include "DS_Table.h"
21 #include "Export.h"
22
23 namespace SLNet
24 {
25 class BitStream;
26 }
27
28 namespace SLNet
29 {
30
31 class RAK_DLL_EXPORT TableSerializer
32 {
33 public:
34 static void SerializeTable(DataStructures::Table *in, SLNet::BitStream *out);
35 static bool DeserializeTable(unsigned char *serializedTable, unsigned int dataLength, DataStructures::Table *out);
36 static bool DeserializeTable(SLNet::BitStream *in, DataStructures::Table *out);
37 static void SerializeColumns(DataStructures::Table *in, SLNet::BitStream *out);
38 static void SerializeColumns(DataStructures::Table *in, SLNet::BitStream *out, DataStructures::List<int> &skipColumnIndices);
39 static bool DeserializeColumns(SLNet::BitStream *in, DataStructures::Table *out);
40 static void SerializeRow(DataStructures::Table::Row *in, unsigned keyIn, const DataStructures::List<DataStructures::Table::ColumnDescriptor> &columns, SLNet::BitStream *out);
41 static void SerializeRow(DataStructures::Table::Row *in, unsigned keyIn, const DataStructures::List<DataStructures::Table::ColumnDescriptor> &columns, SLNet::BitStream *out, DataStructures::List<int> &skipColumnIndices);
42 static bool DeserializeRow(SLNet::BitStream *in, DataStructures::Table *out);
43 static void SerializeCell(SLNet::BitStream *out, DataStructures::Table::Cell *cell, DataStructures::Table::ColumnType columnType);
44 static bool DeserializeCell(SLNet::BitStream *in, DataStructures::Table::Cell *cell, DataStructures::Table::ColumnType columnType);
45 static void SerializeFilterQuery(SLNet::BitStream *in, DataStructures::Table::FilterQuery *query);
46 // Note that this allocates query->cell->c!
47 static bool DeserializeFilterQuery(SLNet::BitStream *out, DataStructures::Table::FilterQuery *query);
48 static void SerializeFilterQueryList(SLNet::BitStream *in, DataStructures::Table::FilterQuery *query, unsigned int numQueries, unsigned int maxQueries);
49 // Note that this allocates queries, cells, and query->cell->c!. Use DeallocateQueryList to free.
50 static bool DeserializeFilterQueryList(SLNet::BitStream *out, DataStructures::Table::FilterQuery **query, unsigned int *numQueries, unsigned int maxQueries, int allocateExtraQueries=0);
51 static void DeallocateQueryList(DataStructures::Table::FilterQuery *query, unsigned int numQueries);
52 };
53
54 } // namespace SLNet
55
56 #endif
57
58 // Test code for the table
59 /*
60 #include "LightweightDatabaseServer.h"
61 #include "LightweightDatabaseClient.h"
62 #include "TableSerializer.h"
63 #include "BitStream.h"
64 #include "StringCompressor.h"
65 #include "DS_Table.h"
66 void main(void)
67 {
68 DataStructures::Table table;
69 DataStructures::Table::Row *row;
70 unsigned int dummydata=12345;
71
72 // Add columns Name (string), IP (binary), score (int), and players (int).
73 table.AddColumn("Name", DataStructures::Table::STRING);
74 table.AddColumn("IP", DataStructures::Table::BINARY);
75 table.AddColumn("Score", DataStructures::Table::NUMERIC);
76 table.AddColumn("Players", DataStructures::Table::NUMERIC);
77 table.AddColumn("Empty Test Column", DataStructures::Table::STRING);
78 RakAssert(table.GetColumnCount()==5);
79 row=table.AddRow(0);
80 RakAssert(row);
81 row->UpdateCell(0,"Kevin Jenkins");
82 row->UpdateCell(1,sizeof(dummydata), (char*)&dummydata);
83 row->UpdateCell(2,5);
84 row->UpdateCell(3,10);
85 //row->UpdateCell(4,"should be unique");
86
87 row=table.AddRow(1);
88 row->UpdateCell(0,"Kevin Jenkins");
89 row->UpdateCell(1,sizeof(dummydata), (char*)&dummydata);
90 row->UpdateCell(2,5);
91 row->UpdateCell(3,15);
92
93 row=table.AddRow(2);
94 row->UpdateCell(0,"Kevin Jenkins");
95 row->UpdateCell(1,sizeof(dummydata), (char*)&dummydata);
96 row->UpdateCell(2,5);
97 row->UpdateCell(3,20);
98
99 row=table.AddRow(3);
100 RakAssert(row);
101 row->UpdateCell(0,"Kevin Jenkins");
102 row->UpdateCell(1,sizeof(dummydata), (char*)&dummydata);
103 row->UpdateCell(2,15);
104 row->UpdateCell(3,5);
105 row->UpdateCell(4,"col index 4");
106
107 row=table.AddRow(4);
108 RakAssert(row);
109 row->UpdateCell(0,"Kevin Jenkins");
110 row->UpdateCell(1,sizeof(dummydata), (char*)&dummydata);
111 //row->UpdateCell(2,25);
112 row->UpdateCell(3,30);
113 //row->UpdateCell(4,"should be unique");
114
115 row=table.AddRow(5);
116 RakAssert(row);
117 row->UpdateCell(0,"Kevin Jenkins");
118 row->UpdateCell(1,sizeof(dummydata), (char*)&dummydata);
119 //row->UpdateCell(2,25);
120 row->UpdateCell(3,5);
121 //row->UpdateCell(4,"should be unique");
122
123 row=table.AddRow(6);
124 RakAssert(row);
125 row->UpdateCell(0,"Kevin Jenkins");
126 row->UpdateCell(1,sizeof(dummydata), (char*)&dummydata);
127 row->UpdateCell(2,35);
128 //row->UpdateCell(3,40);
129 //row->UpdateCell(4,"should be unique");
130
131 row=table.AddRow(7);
132 RakAssert(row);
133 row->UpdateCell(0,"Bob Jenkins");
134
135 row=table.AddRow(8);
136 RakAssert(row);
137 row->UpdateCell(0,"Zack Jenkins");
138
139 // Test multi-column sorting
140 DataStructures::Table::Row *rows[30];
141 DataStructures::Table::SortQuery queries[4];
142 queries[0].columnIndex=0;
143 queries[0].operation=DataStructures::Table::QS_INCREASING_ORDER;
144 queries[1].columnIndex=1;
145 queries[1].operation=DataStructures::Table::QS_INCREASING_ORDER;
146 queries[2].columnIndex=2;
147 queries[2].operation=DataStructures::Table::QS_INCREASING_ORDER;
148 queries[3].columnIndex=3;
149 queries[3].operation=DataStructures::Table::QS_DECREASING_ORDER;
150 table.SortTable(queries, 4, rows);
151 unsigned i;
152 char out[256];
153 RAKNET_DEBUG_PRINTF("Sort: Ascending except for column index 3\n");
154 for (i=0; i < table.GetRowCount(); i++)
155 {
156 table.PrintRow(out,256,',',true, rows[i]);
157 RAKNET_DEBUG_PRINTF("%s\n", out);
158 }
159
160 // Test query:
161 // Don't return column 3, and swap columns 0 and 2
162 unsigned columnsToReturn[4];
163 columnsToReturn[0]=2;
164 columnsToReturn[1]=1;
165 columnsToReturn[2]=0;
166 columnsToReturn[3]=4;
167 DataStructures::Table resultsTable;
168 table.QueryTable(columnsToReturn,4,0,0,&resultsTable);
169 RAKNET_DEBUG_PRINTF("Query: Don't return column 3, and swap columns 0 and 2:\n");
170 for (i=0; i < resultsTable.GetRowCount(); i++)
171 {
172 resultsTable.PrintRow(out,256,',',true, resultsTable.GetRowByIndex(i));
173 RAKNET_DEBUG_PRINTF("%s\n", out);
174 }
175
176 // Test filter:
177 // Only return rows with column index 4 empty
178 DataStructures::Table::FilterQuery inclusionFilters[3];
179 inclusionFilters[0].columnIndex=4;
180 inclusionFilters[0].operation=DataStructures::Table::QF_IS_EMPTY;
181 // inclusionFilters[0].cellValue; // Unused for IS_EMPTY
182 table.QueryTable(0,0,inclusionFilters,1,&resultsTable);
183 RAKNET_DEBUG_PRINTF("Filter: Only return rows with column index 4 empty:\n");
184 for (i=0; i < resultsTable.GetRowCount(); i++)
185 {
186 resultsTable.PrintRow(out,256,',',true, resultsTable.GetRowByIndex(i));
187 RAKNET_DEBUG_PRINTF("%s\n", out);
188 }
189
190 // Column 5 empty and column 0 == Kevin Jenkins
191 inclusionFilters[0].columnIndex=4;
192 inclusionFilters[0].operation=DataStructures::Table::QF_IS_EMPTY;
193 inclusionFilters[1].columnIndex=0;
194 inclusionFilters[1].operation=DataStructures::Table::QF_EQUAL;
195 inclusionFilters[1].cellValue.Set("Kevin Jenkins");
196 table.QueryTable(0,0,inclusionFilters,2,&resultsTable);
197 RAKNET_DEBUG_PRINTF("Filter: Column 5 empty and column 0 == Kevin Jenkins:\n");
198 for (i=0; i < resultsTable.GetRowCount(); i++)
199 {
200 resultsTable.PrintRow(out,256,',',true, resultsTable.GetRowByIndex(i));
201 RAKNET_DEBUG_PRINTF("%s\n", out);
202 }
203
204 SLNet::BitStream bs;
205 RAKNET_DEBUG_PRINTF("PreSerialize:\n");
206 for (i=0; i < table.GetRowCount(); i++)
207 {
208 table.PrintRow(out,256,',',true, table.GetRowByIndex(i));
209 RAKNET_DEBUG_PRINTF("%s\n", out);
210 }
211 StringCompressor::AddReference();
212 TableSerializer::Serialize(&table, &bs);
213 TableSerializer::Deserialize(&bs, &table);
214 StringCompressor::RemoveReference();
215 RAKNET_DEBUG_PRINTF("PostDeserialize:\n");
216 for (i=0; i < table.GetRowCount(); i++)
217 {
218 table.PrintRow(out,256,',',true, table.GetRowByIndex(i));
219 RAKNET_DEBUG_PRINTF("%s\n", out);
220 }
221 int a=5;
222 }
223 */
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Hash
  • Node
DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node Member List

This is the complete list of members for DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node, including all inherited members.

data | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node |
next | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node |
Node(key_type strIn, const data_type &_data) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node | inline
string | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >::Node |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PS4Includes.h Source File

  • include
  • slikenet
PS4Includes.h
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082 without any modifications.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 */
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • BPlusTree
  • ReturnAction
DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction Member List

This is the complete list of members for DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction, including all inherited members.

action | DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
key1 | DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
key2 | DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
NO_ACTION enum value | DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
PUSH_KEY_TO_PARENT enum value | DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
REPLACE_KEY1_WITH_KEY2 enum value | DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
SET_BRANCH_KEY enum value | DataStructures::BPlusTree< KeyType, DataType, order >::ReturnAction
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/linux_adapter.h Source File

  • include
  • slikenet
linux_adapter.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
3 *
4 * This source code is licensed under the MIT-style license found in the
5 * license.txt file in the root directory of this source tree.
6 *
7 *
8 * This file declares adapters for all MS-specific functions used throughout SLikeNet.
9 */
10 #pragma once
11
12 #ifdef __linux__
13 #define _TRUNCATE ((size_t)-1)
14 typedef int errno_t;
15
16 #include <cstdarg> // for va_start, va_end, va_list
17 #include <cstdio> // for FILE
18 #include <ctime> // for time_t
19
20 // MS specific security enhanced functions
21 errno_t fopen_s(FILE **pfile, const char *filename, const char *mode);
22 errno_t localtime_s(struct tm* _tm, const time_t *time);
23 errno_t mbstowcs_s(size_t *pReturnValue, wchar_t *wcstr, size_t sizeInWords, const char *mbstr, size_t count);
24 int sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...);
25 errno_t strcat_s(char *strDestination, size_t numberOfElements, const char *strSource);
26 errno_t strcpy_s(char* strDestination, size_t numberOfElements, const char *strSource);
27 errno_t strerror_s(char* buffer, size_t numberOfElements, int errnum);
28 errno_t strncat_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count);
29 errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count);
30 int vsnprintf_s(char *buffer, size_t sizeOfBuffer, size_t count, const char *format, va_list argptr);
31 errno_t wcscat_s(wchar_t *strDestination, size_t numberOfElements, const wchar_t *strSource);
32 errno_t wcscpy_s(wchar_t* strDestination, size_t numberOfElements, const wchar_t *strSource);
33
34 // corresponding template overloads
35 template<size_t BufferSize> errno_t mbstowcs_s(size_t *pReturnValue, wchar_t(&wcstr)[BufferSize], const char *mbstr, size_t count)
36 {
37 return mbstowcs_s(pReturnValue, wcstr, BufferSize, mbstr, count);
38 }
39
40 template<size_t BufferSize> int sprintf_s(char (&buffer)[BufferSize], const char* format, ...)
41 {
42 va_list arglist;
43 va_start(arglist, format);
44 int numCharsWritten = vsnprintf_s(buffer, BufferSize, BufferSize - 1, format, arglist);
45 va_end(arglist);
46
47 return numCharsWritten;
48 }
49
50 template<size_t BufferSize> errno_t strcat_s(char (&strDestination)[BufferSize], const char* strSource)
51 {
52 return strcat_s(strDestination, BufferSize, strSource);
53 }
54
55 template<size_t BufferSize> errno_t strcpy_s(char (&strDestination)[BufferSize], const char* strSource)
56 {
57 return strcpy_s(strDestination, BufferSize, strSource);
58 }
59
60 template<size_t BufferSize> errno_t strerror_s(char(&buffer)[BufferSize], int errnum)
61 {
62 return strerror_s(buffer, BufferSize, errnum);
63 }
64
65 template<size_t BufferSize> errno_t strncat_s(char(&strDest)[BufferSize], const char *strSource, size_t count)
66 {
67 return strncat_s(strDest, BufferSize, strSource, count);
68 }
69
70 template<size_t BufferSize> errno_t strncpy_s(char(&strDest)[BufferSize], const char *strSource, size_t count)
71 {
72 return strncpy_s(strDest, BufferSize, strSource, count);
73 }
74
75 template<size_t BufferSize> int vsnprintf_s(char (&buffer)[BufferSize], size_t count, const char *format, va_list argptr)
76 {
77 return vsnprintf_s(buffer, BufferSize, count, format, argptr);
78 }
79
80 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HuffmanEncodingTree
SLNet::HuffmanEncodingTree Member List

This is the complete list of members for SLNet::HuffmanEncodingTree, including all inherited members.

DecodeArray(SLNet::BitStream *input, BitSize_t sizeInBits, size_t maxCharsToWrite, unsigned char *output) | SLNet::HuffmanEncodingTree
DecodeArray(unsigned char *input, BitSize_t sizeInBits, SLNet::BitStream *output) | SLNet::HuffmanEncodingTree
EncodeArray(unsigned char *input, size_t sizeInBytes, SLNet::BitStream *output) | SLNet::HuffmanEncodingTree
FreeMemory(void) | SLNet::HuffmanEncodingTree
GenerateFromFrequencyTable(unsigned int frequencyTable[256]) | SLNet::HuffmanEncodingTree
HuffmanEncodingTree() | SLNet::HuffmanEncodingTree
~HuffmanEncodingTree() | SLNet::HuffmanEncodingTree
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DataCompressor.cpp Source File

  • src
DataCompressor.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/DataCompressor.h"
17 #include "slikenet/DS_HuffmanEncodingTree.h"
18 #include "slikenet/assert.h"
19 #include <string.h> // Use string.h rather than memory.h for a console
20
21 using namespace SLNet;
22
23 STATIC_FACTORY_DEFINITIONS(DataCompressor,DataCompressor)
24
25 void DataCompressor::Compress( unsigned char *userData, unsigned sizeInBytes, SLNet::BitStream * output )
26 {
27 // Don't use this for small files as you will just make them bigger!
28 RakAssert(sizeInBytes > 2048);
29
30 unsigned int frequencyTable[ 256 ];
31 unsigned int i;
32 memset(frequencyTable,0,256*sizeof(unsigned int));
33 for (i=0; i < sizeInBytes; i++)
34 ++frequencyTable[userData[i]];
35 HuffmanEncodingTree tree;
36 BitSize_t writeOffset1, writeOffset2, bitsUsed1, bitsUsed2;
37 tree.GenerateFromFrequencyTable(frequencyTable);
38 output->WriteCompressed(sizeInBytes);
39 for (i=0; i < 256; i++)
40 output->WriteCompressed(frequencyTable[i]);
41 output->AlignWriteToByteBoundary();
42 writeOffset1=output->GetWriteOffset();
43 output->Write((unsigned int)0); // Dummy value
44 bitsUsed1=output->GetNumberOfBitsUsed();
45 tree.EncodeArray(userData, sizeInBytes, output);
46 bitsUsed2=output->GetNumberOfBitsUsed();
47 writeOffset2=output->GetWriteOffset();
48 output->SetWriteOffset(writeOffset1);
49 output->Write(bitsUsed2-bitsUsed1); // Go back and write how many bits were used for the encoding
50 output->SetWriteOffset(writeOffset2);
51 }
52
53 unsigned DataCompressor::DecompressAndAllocate(SLNet::BitStream * input, unsigned char **output )
54 {
55 HuffmanEncodingTree tree;
56 unsigned int bitsUsed, destinationSizeInBytes;
57 unsigned int decompressedBytes;
58 unsigned int frequencyTable[ 256 ];
59 unsigned i;
60
61 input->ReadCompressed(destinationSizeInBytes);
62 for (i=0; i < 256; i++)
63 input->ReadCompressed(frequencyTable[i]);
64 input->AlignReadToByteBoundary();
65 if (input->Read(bitsUsed)==false)
66 {
67 // Read error
68 #ifdef _DEBUG
69 RakAssert(0);
70 #endif
71 return 0;
72 }
73 *output = (unsigned char*) rakMalloc_Ex(destinationSizeInBytes, _FILE_AND_LINE_);
74 tree.GenerateFromFrequencyTable(frequencyTable);
75 decompressedBytes=tree.DecodeArray(input, bitsUsed, destinationSizeInBytes, *output );
76 RakAssert(decompressedBytes==destinationSizeInBytes);
77 return destinationSizeInBytes;
78 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/BitStream.h Source File

  • include
  • slikenet
BitStream.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21 #ifndef __BITSTREAM_H
22 #define __BITSTREAM_H
23
24 #include "memoryoverride.h"
25 #include "defines.h"
26 #include "Export.h"
27 #include "types.h"
28 #include "string.h"
29 #include "wstring.h"
30 #include "assert.h"
31 #include <cmath>
32 #include <float.h>
33
34 #ifdef _MSC_VER
35 #pragma warning( push )
36 #endif
37
38 // MSWin uses _copysign, others use copysign...
39 #ifndef _WIN32
40 #define _copysign copysign
41 #endif
42
43 namespace SLNet
44 {
47 class RAK_DLL_EXPORT BitStream
48 {
49
50 public:
51 // GetInstance() and DestroyInstance(instance*)
52 STATIC_FACTORY_DECLARATIONS(BitStream)
53
54
55 BitStream();
56
61 BitStream( const unsigned int initialBytesToAllocate );
62
73 BitStream( unsigned char* _data, const unsigned int lengthInBytes, bool _copyData );
74
75 // Destructor
76 ~BitStream();
77
79 void Reset( void );
80
86 template <class templateType>
87 bool Serialize(bool writeToBitstream, templateType &inOutTemplateVar);
88
96 template <class templateType>
97 bool SerializeDelta(bool writeToBitstream, templateType &inOutCurrentValue, const templateType &lastValue);
98
103 template <class templateType>
104 bool SerializeDelta(bool writeToBitstream, templateType &inOutCurrentValue);
105
114 template <class templateType>
115 bool SerializeCompressed(bool writeToBitstream, templateType &inOutTemplateVar);
116
127 template <class templateType>
128 bool SerializeCompressedDelta(bool writeToBitstream, templateType &inOutCurrentValue, const templateType &lastValue);
129
132 template <class templateType>
133 bool SerializeCompressedDelta(bool writeToBitstream, templateType &inOutTemplateVar);
134
140 bool Serialize(bool writeToBitstream, char* inOutByteArray, const unsigned int numberOfBytes );
141
147 bool SerializeFloat16(bool writeToBitstream, float &inOutFloat, float floatMin, float floatMax);
148
154 template <class serializationType, class sourceType >
155 bool SerializeCasted( bool writeToBitstream, sourceType &value );
156
165 template <class templateType>
166 bool SerializeBitsFromIntegerRange( bool writeToBitstream, templateType &value, const templateType minimum, const templateType maximum, bool allowOutsideRange=false );
168 template <class templateType>
169 bool SerializeBitsFromIntegerRange( bool writeToBitstream, templateType &value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange=false );
170
179 template <class templateType> // templateType for this function must be a float or double
180 bool SerializeNormVector(bool writeToBitstream, templateType &x, templateType &y, templateType &z );
181
189 template <class templateType> // templateType for this function must be a float or double
190 bool SerializeVector(bool writeToBitstream, templateType &x, templateType &y, templateType &z );
191
199 template <class templateType> // templateType for this function must be a float or double
200 bool SerializeNormQuat(bool writeToBitstream, templateType &w, templateType &x, templateType &y, templateType &z);
201
206 template <class templateType> // templateType for this function must be a float or double
207 bool SerializeOrthMatrix(
208 bool writeToBitstream,
209 templateType &m00, templateType &m01, templateType &m02,
210 templateType &m10, templateType &m11, templateType &m12,
211 templateType &m20, templateType &m21, templateType &m22 );
212
224 bool SerializeBits(bool writeToBitstream, unsigned char* inOutByteArray, const BitSize_t numberOfBitsToSerialize, const bool rightAlignedBits = true );
225
229 template <class templateType>
230 void Write(const templateType &inTemplateVar);
231
235 template <class templateType>
236 void WritePtr(templateType *inTemplateVar);
237
243 template <class templateType>
244 void WriteDelta(const templateType &currentValue, const templateType &lastValue);
245
248 template <class templateType>
249 void WriteDelta(const templateType &currentValue);
250
257 template <class templateType>
258 void WriteCompressed(const templateType &inTemplateVar);
259
268 template <class templateType>
269 void WriteCompressedDelta(const templateType &currentValue, const templateType &lastValue);
270
272 template <class templateType>
273 void WriteCompressedDelta(const templateType &currentValue);
274
279 template <class templateType>
280 bool Read(templateType &outTemplateVar);
281
287 bool Read(wchar_t *&varString);
288 bool Read(wchar_t *&varString, size_t varStringLength);
289
296 template <class templateType>
297 bool ReadDelta(templateType &outTemplateVar);
298
306 template <class templateType>
307 bool ReadCompressed(templateType &outTemplateVar);
308
316 bool ReadCompressed(wchar_t *&varString);
317 bool ReadCompressed(wchar_t *&varString, size_t varStringLength);
318
329 template <class templateType>
330 bool ReadCompressedDelta(templateType &outTemplateVar);
331
336 bool Read( BitStream *bitStream, BitSize_t numberOfBits );
337 bool Read( BitStream *bitStream );
338 bool Read( BitStream &bitStream, BitSize_t numberOfBits );
339 bool Read( BitStream &bitStream );
340
344 void Write( const char* inputByteArray, const unsigned int numberOfBytes );
345
349 void Write( BitStream *bitStream, BitSize_t numberOfBits );
350 void Write( BitStream *bitStream );
351 void Write( BitStream &bitStream, BitSize_t numberOfBits );
352 void Write( BitStream &bitStream );\
353
358 void WriteFloat16( float x, float floatMin, float floatMax );
359
364 template <class serializationType, class sourceType >
365 void WriteCasted( const sourceType &value );
366
374 template <class templateType>
375 void WriteBitsFromIntegerRange( const templateType value, const templateType minimum, const templateType maximum, bool allowOutsideRange=false );
377 template <class templateType>
378 void WriteBitsFromIntegerRange( const templateType value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange=false );
379
386 template <class templateType> // templateType for this function must be a float or double
387 void WriteNormVector( templateType x, templateType y, templateType z );
388
395 template <class templateType> // templateType for this function must be a float or double
396 void WriteVector( templateType x, templateType y, templateType z );
397
403 template <class templateType> // templateType for this function must be a float or double
404 void WriteNormQuat( templateType w, templateType x, templateType y, templateType z);
405
409 template <class templateType> // templateType for this function must be a float or double
410 void WriteOrthMatrix(
411 templateType m00, templateType m01, templateType m02,
412 templateType m10, templateType m11, templateType m12,
413 templateType m20, templateType m21, templateType m22 );
414
420 bool Read( char* output, const unsigned int numberOfBytes );
421
426 bool ReadFloat16( float &outFloat, float floatMin, float floatMax );
427
432 template <class serializationType, class sourceType >
433 bool ReadCasted( sourceType &value );
434
442 template <class templateType>
443 bool ReadBitsFromIntegerRange( templateType &value, const templateType minimum, const templateType maximum, bool allowOutsideRange=false );
445 template <class templateType>
446 bool ReadBitsFromIntegerRange( templateType &value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange=false );
447
455 template <class templateType> // templateType for this function must be a float or double
456 bool ReadNormVector( templateType &x, templateType &y, templateType &z );
457
465 template <class templateType> // templateType for this function must be a float or double
466 bool ReadVector( templateType &x, templateType &y, templateType &z );
467
474 template <class templateType> // templateType for this function must be a float or double
475 bool ReadNormQuat( templateType &w, templateType &x, templateType &y, templateType &z);
476
481 template <class templateType> // templateType for this function must be a float or double
482 bool ReadOrthMatrix(
483 templateType &m00, templateType &m01, templateType &m02,
484 templateType &m10, templateType &m11, templateType &m12,
485 templateType &m20, templateType &m21, templateType &m22 );
486
488 void ResetReadPointer( void );
489
491 void ResetWritePointer( void );
492
495 void AssertStreamEmpty( void );
496
498 void PrintBits( char *out ) const;
499 void PrintBits( char *out, size_t outLength ) const;
500 void PrintBits( void ) const;
501 void PrintHex( char *out) const;
502 void PrintHex( char *out, size_t outLength ) const;
503 void PrintHex( void ) const;
504
507 void IgnoreBits( const BitSize_t numberOfBits );
508
511 void IgnoreBytes( const unsigned int numberOfBytes );
512
518 void SetWriteOffset( const BitSize_t offset );
519
521 inline BitSize_t GetNumberOfBitsUsed( void ) const {return GetWriteOffset();}
522 inline BitSize_t GetWriteOffset( void ) const {return numberOfBitsUsed;}
523
525 inline BitSize_t GetNumberOfBytesUsed( void ) const {return BITS_TO_BYTES( numberOfBitsUsed );}
526
528 inline BitSize_t GetReadOffset( void ) const {return readOffset;}
529
531 void SetReadOffset( const BitSize_t newReadOffset ) {readOffset=newReadOffset;}
532
534 inline BitSize_t GetNumberOfUnreadBits( void ) const { return readOffset > numberOfBitsUsed ? 0 : numberOfBitsUsed - readOffset; }
535
540 BitSize_t CopyData( unsigned char** _data ) const;
541
544 void SetData( unsigned char *inByteArray );
545
549 inline unsigned char* GetData( void ) const {return data;}
550
560 void WriteBits( const unsigned char* inByteArray, BitSize_t numberOfBitsToWrite, const bool rightAlignedBits = true );
561
569 void WriteAlignedBytes( const unsigned char *inByteArray, const unsigned int numberOfBytesToWrite );
570
571 // Endian swap bytes already in the bitstream
572 void EndianSwapBytes( int byteOffset, int length );
573
578 void WriteAlignedBytesSafe( const char *inByteArray, const unsigned int inputLength, const unsigned int maxBytesToWrite );
579
587 bool ReadAlignedBytes( unsigned char *inOutByteArray, const unsigned int numberOfBytesToRead );
588
593 bool ReadAlignedBytesSafe( char *inOutByteArray, int &inputLength, const int maxBytesToRead );
594 bool ReadAlignedBytesSafe( char *inOutByteArray, unsigned int &inputLength, const unsigned int maxBytesToRead );
595
599 bool ReadAlignedBytesSafeAlloc( char **outByteArray, int &inputLength, const unsigned int maxBytesToRead );
600 bool ReadAlignedBytesSafeAlloc( char **outByteArray, unsigned int &inputLength, const unsigned int maxBytesToRead );
601
607 inline void AlignWriteToByteBoundary( void ) {numberOfBitsUsed += 8 - ( (( numberOfBitsUsed - 1 ) & 7) + 1 );}
608
614 inline void AlignReadToByteBoundary( void ) {readOffset += 8 - ( (( readOffset - 1 ) & 7 ) + 1 );}
615
624 bool ReadBits( unsigned char *inOutByteArray, BitSize_t numberOfBitsToRead, const bool alignBitsToRight = true );
625
627 void Write0( void );
628
630 void Write1( void );
631
633 bool ReadBit( void );
634
637 void AssertCopyData( void );
638
642 void SetNumberOfBitsAllocated( const BitSize_t lengthInBits );
643
645 void AddBitsAndReallocate( const BitSize_t numberOfBitsToWrite );
646
649 BitSize_t GetNumberOfBitsAllocated(void) const;
650
652 bool Read(char *varString);
653 bool Read(unsigned char *varString);
654
656 void PadWithZeroToByteLength( unsigned int bytes );
657
660 static int NumberOfLeadingZeroes( uint8_t x );
661 static int NumberOfLeadingZeroes( uint16_t x );
662 static int NumberOfLeadingZeroes( uint32_t x );
663 static int NumberOfLeadingZeroes( uint64_t x );
664 static int NumberOfLeadingZeroes( int8_t x );
665 static int NumberOfLeadingZeroes( int16_t x );
666 static int NumberOfLeadingZeroes( int32_t x );
667 static int NumberOfLeadingZeroes( int64_t x );
668
670 void WriteAlignedVar8(const char *inByteArray);
672 bool ReadAlignedVar8(char *inOutByteArray);
674 void WriteAlignedVar16(const char *inByteArray);
676 bool ReadAlignedVar16(char *inOutByteArray);
678 void WriteAlignedVar32(const char *inByteArray);
680 bool ReadAlignedVar32(char *inOutByteArray);
681
682 inline void Write(const char * const inStringVar)
683 {
684 RakString::Serialize(inStringVar, this);
685 }
686 inline void Write(const wchar_t * const inStringVar)
687 {
688 RakWString::Serialize(inStringVar, this);
689 }
690 inline void Write(const unsigned char * const inTemplateVar)
691 {
692 Write((const char*)inTemplateVar);
693 }
694 inline void Write(char * const inTemplateVar)
695 {
696 Write((const char*)inTemplateVar);
697 }
698 inline void Write(unsigned char * const inTemplateVar)
699 {
700 Write((const char*)inTemplateVar);
701 }
702 inline void WriteCompressed(const char * const inStringVar)
703 {
704 RakString::SerializeCompressed(inStringVar,this,0,false);
705 }
706 inline void WriteCompressed(const wchar_t * const inStringVar)
707 {
708 RakWString::Serialize(inStringVar,this);
709 }
710 inline void WriteCompressed(const unsigned char * const inTemplateVar)
711 {
712 WriteCompressed((const char*) inTemplateVar);
713 }
714 inline void WriteCompressed(char * const inTemplateVar)
715 {
716 WriteCompressed((const char*) inTemplateVar);
717 }
718 inline void WriteCompressed(unsigned char * const inTemplateVar)
719 {
720 WriteCompressed((const char*) inTemplateVar);
721 }
722
724 inline static bool DoEndianSwap(void) {
725 #ifndef __BITSTREAM_NATIVE_END
726 return IsNetworkOrder()==false;
727 #else
728 return false;
729 #endif
730 }
731 inline static bool IsBigEndian(void)
732 {
733 return IsNetworkOrder();
734 }
735 inline static bool IsNetworkOrder(void) {bool r = IsNetworkOrderInternal(); return r;}
736 // Not inline, won't compile on PC due to winsock include errors
737 static bool IsNetworkOrderInternal(void);
738 static void ReverseBytes(unsigned char *inByteArray, unsigned char *inOutByteArray, const unsigned int length);
739 static void ReverseBytesInPlace(unsigned char *inOutData,const unsigned int length);
740
741 private:
742
743 BitStream( const BitStream &invalid) {
744 (void) invalid;
745 RakAssert(0);
746 }
747
748 BitStream& operator = ( const BitStream& invalid ) {
749 (void) invalid;
750 RakAssert(0);
751 static BitStream i;
752 return i;
753 }
754
756 void WriteCompressed( const unsigned char* inByteArray, const unsigned int size, const bool unsignedData );
757
759 bool ReadCompressed( unsigned char* inOutByteArray, const unsigned int size, const bool unsignedData );
760
761
762 BitSize_t numberOfBitsUsed;
763
764 BitSize_t numberOfBitsAllocated;
765
766 BitSize_t readOffset;
767
768 unsigned char *data;
769
771 bool copyData;
772
774 unsigned char stackData[BITSTREAM_STACK_ALLOCATION_SIZE];
775 };
776
777 template <class templateType>
778 inline bool BitStream::Serialize(bool writeToBitstream, templateType &inOutTemplateVar)
779 {
780 if (writeToBitstream)
781 Write(inOutTemplateVar);
782 else
783 return Read(inOutTemplateVar);
784 return true;
785 }
786
787 template <class templateType>
788 inline bool BitStream::SerializeDelta(bool writeToBitstream, templateType &inOutCurrentValue, const templateType &lastValue)
789 {
790 if (writeToBitstream)
791 WriteDelta(inOutCurrentValue, lastValue);
792 else
793 return ReadDelta(inOutCurrentValue);
794 return true;
795 }
796
797 template <class templateType>
798 inline bool BitStream::SerializeDelta(bool writeToBitstream, templateType &inOutCurrentValue)
799 {
800 if (writeToBitstream)
801 WriteDelta(inOutCurrentValue);
802 else
803 return ReadDelta(inOutCurrentValue);
804 return true;
805 }
806
807 template <class templateType>
808 inline bool BitStream::SerializeCompressed(bool writeToBitstream, templateType &inOutTemplateVar)
809 {
810 if (writeToBitstream)
811 WriteCompressed(inOutTemplateVar);
812 else
813 return ReadCompressed(inOutTemplateVar);
814 return true;
815 }
816
817 template <class templateType>
818 inline bool BitStream::SerializeCompressedDelta(bool writeToBitstream, templateType &inOutCurrentValue, const templateType &lastValue)
819 {
820 if (writeToBitstream)
821 WriteCompressedDelta(inOutCurrentValue,lastValue);
822 else
823 return ReadCompressedDelta(inOutCurrentValue);
824 return true;
825 }
826 //Stoppedhere
827 template <class templateType>
828 inline bool BitStream::SerializeCompressedDelta(bool writeToBitstream, templateType &inOutCurrentValue)
829 {
830 if (writeToBitstream)
831 WriteCompressedDelta(inOutCurrentValue);
832 else
833 return ReadCompressedDelta(inOutCurrentValue);
834 return true;
835 }
836
837 inline bool BitStream::Serialize(bool writeToBitstream, char* inOutByteArray, const unsigned int numberOfBytes )
838 {
839 if (writeToBitstream)
840 Write(inOutByteArray, numberOfBytes);
841 else
842 return Read(inOutByteArray, numberOfBytes);
843 return true;
844 }
845
846 template <class serializationType, class sourceType >
847 bool BitStream::SerializeCasted( bool writeToBitstream, sourceType &value )
848 {
849 if (writeToBitstream) WriteCasted<serializationType>(value);
850 else return ReadCasted<serializationType>(value);
851 return true;
852 }
853
854 template <class templateType>
855 bool BitStream::SerializeBitsFromIntegerRange( bool writeToBitstream, templateType &value, const templateType minimum, const templateType maximum, bool allowOutsideRange )
856 {
857 int requiredBits=BYTES_TO_BITS(sizeof(templateType))-NumberOfLeadingZeroes(templateType(maximum-minimum));
858 return SerializeBitsFromIntegerRange(writeToBitstream,value,minimum,maximum,requiredBits,allowOutsideRange);
859 }
860 template <class templateType>
861 bool BitStream::SerializeBitsFromIntegerRange( bool writeToBitstream, templateType &value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange )
862 {
863 if (writeToBitstream) WriteBitsFromIntegerRange(value,minimum,maximum,requiredBits,allowOutsideRange);
864 else return ReadBitsFromIntegerRange(value,minimum,maximum,requiredBits,allowOutsideRange);
865 return true;
866 }
867
868 template <class templateType>
869 inline bool BitStream::SerializeNormVector(bool writeToBitstream, templateType &x, templateType &y, templateType &z )
870 {
871 if (writeToBitstream)
872 WriteNormVector(x,y,z);
873 else
874 return ReadNormVector(x,y,z);
875 return true;
876 }
877
878 template <class templateType>
879 inline bool BitStream::SerializeVector(bool writeToBitstream, templateType &x, templateType &y, templateType &z )
880 {
881 if (writeToBitstream)
882 WriteVector(x,y,z);
883 else
884 return ReadVector(x,y,z);
885 return true;
886 }
887
888 template <class templateType>
889 inline bool BitStream::SerializeNormQuat(bool writeToBitstream, templateType &w, templateType &x, templateType &y, templateType &z)
890 {
891 if (writeToBitstream)
892 WriteNormQuat(w,x,y,z);
893 else
894 return ReadNormQuat(w,x,y,z);
895 return true;
896 }
897
898 template <class templateType>
899 inline bool BitStream::SerializeOrthMatrix(
900 bool writeToBitstream,
901 templateType &m00, templateType &m01, templateType &m02,
902 templateType &m10, templateType &m11, templateType &m12,
903 templateType &m20, templateType &m21, templateType &m22 )
904 {
905 if (writeToBitstream)
906 WriteOrthMatrix(m00,m01,m02,m10,m11,m12,m20,m21,m22);
907 else
908 return ReadOrthMatrix(m00,m01,m02,m10,m11,m12,m20,m21,m22);
909 return true;
910 }
911
912 inline bool BitStream::SerializeBits(bool writeToBitstream, unsigned char* inOutByteArray, const BitSize_t numberOfBitsToSerialize, const bool rightAlignedBits )
913 {
914 if (writeToBitstream)
915 WriteBits(inOutByteArray,numberOfBitsToSerialize,rightAlignedBits);
916 else
917 return ReadBits(inOutByteArray,numberOfBitsToSerialize,rightAlignedBits);
918 return true;
919 }
920
921 template <class templateType>
922 inline void BitStream::Write(const templateType &inTemplateVar)
923 {
924 #ifdef _MSC_VER
925 #pragma warning(disable:4127) // conditional expression is constant
926 #endif
927 if (sizeof(inTemplateVar)==1)
928 WriteBits( ( unsigned char* ) & inTemplateVar, sizeof( templateType ) * 8, true );
929 else
930 {
931 #ifndef __BITSTREAM_NATIVE_END
932 if (DoEndianSwap())
933 {
934 unsigned char output[sizeof(templateType)];
935 ReverseBytes((unsigned char*)&inTemplateVar, output, sizeof(templateType));
936 WriteBits( ( unsigned char* ) output, sizeof(templateType) * 8, true );
937 }
938 else
939 #endif
940 WriteBits( ( unsigned char* ) & inTemplateVar, sizeof(templateType) * 8, true );
941 }
942 }
943
944 template <class templateType>
945 inline void BitStream::WritePtr(templateType *inTemplateVar)
946 {
947 #ifdef _MSC_VER
948 #pragma warning(disable:4127) // conditional expression is constant
949 #endif
950 if (sizeof(templateType)==1)
951 WriteBits( ( unsigned char* ) inTemplateVar, sizeof( templateType ) * 8, true );
952 else
953 {
954 #ifndef __BITSTREAM_NATIVE_END
955 if (DoEndianSwap())
956 {
957 unsigned char output[sizeof(templateType)];
958 ReverseBytes((unsigned char*) inTemplateVar, output, sizeof(templateType));
959 WriteBits( ( unsigned char* ) output, sizeof(templateType) * 8, true );
960 }
961 else
962 #endif
963 WriteBits( ( unsigned char* ) inTemplateVar, sizeof(templateType) * 8, true );
964 }
965 }
966
969 template <>
970 inline void BitStream::Write(const bool &inTemplateVar)
971 {
972 if ( inTemplateVar )
973 Write1();
974 else
975 Write0();
976 }
977
978
981 template <>
982 inline void BitStream::Write(const SystemAddress &inTemplateVar)
983 {
984 Write(inTemplateVar.GetIPVersion());
985 if (inTemplateVar.GetIPVersion()==4)
986 {
987 // Hide the address so routers don't modify it
988 SystemAddress var2=inTemplateVar;
989 uint32_t binaryAddress=~inTemplateVar.address.addr4.sin_addr.s_addr;
990 // Don't endian swap the address or port
991 WriteBits((unsigned char*)&binaryAddress, sizeof(binaryAddress)*8, true);
992 unsigned short p = var2.GetPortNetworkOrder();
993 WriteBits((unsigned char*)&p, sizeof(unsigned short)*8, true);
994 }
995 else
996 {
997 #if RAKNET_SUPPORT_IPV6==1
998 // Don't endian swap
999 WriteBits((const unsigned char*) &inTemplateVar.address.addr6, sizeof(inTemplateVar.address.addr6)*8, true);
1000 #endif
1001 }
1002 }
1003
1004 template <>
1005 inline void BitStream::Write(const uint24_t &inTemplateVar)
1006 {
1007 AlignWriteToByteBoundary();
1008 AddBitsAndReallocate(3*8);
1009
1010 if (IsBigEndian()==false)
1011 {
1012 data[( numberOfBitsUsed >> 3 ) + 0] = ((unsigned char *)&inTemplateVar.val)[0];
1013 data[( numberOfBitsUsed >> 3 ) + 1] = ((unsigned char *)&inTemplateVar.val)[1];
1014 data[( numberOfBitsUsed >> 3 ) + 2] = ((unsigned char *)&inTemplateVar.val)[2];
1015 }
1016 else
1017 {
1018 data[( numberOfBitsUsed >> 3 ) + 0] = ((unsigned char *)&inTemplateVar.val)[3];
1019 data[( numberOfBitsUsed >> 3 ) + 1] = ((unsigned char *)&inTemplateVar.val)[2];
1020 data[( numberOfBitsUsed >> 3 ) + 2] = ((unsigned char *)&inTemplateVar.val)[1];
1021 }
1022
1023 numberOfBitsUsed+=3*8;
1024 }
1025
1026 template <>
1027 inline void BitStream::Write(const RakNetGUID &inTemplateVar)
1028 {
1029 Write(inTemplateVar.g);
1030 }
1031
1034 template <>
1035 inline void BitStream::Write(const RakString &inTemplateVar)
1036 {
1037 inTemplateVar.Serialize(this);
1038 }
1039 template <>
1040 inline void BitStream::Write(const RakWString &inTemplateVar)
1041 {
1042 inTemplateVar.Serialize(this);
1043 }
1044 template <>
1045 inline void BitStream::Write(const char * const &inStringVar)
1046 {
1047 RakString::Serialize(inStringVar, this);
1048 }
1049 template <>
1050 inline void BitStream::Write(const wchar_t * const &inStringVar)
1051 {
1052 RakWString::Serialize(inStringVar, this);
1053 }
1054 template <>
1055 inline void BitStream::Write(const unsigned char * const &inTemplateVar)
1056 {
1057 Write((const char*)inTemplateVar);
1058 }
1059 template <>
1060 inline void BitStream::Write(char * const &inTemplateVar)
1061 {
1062 Write((const char*)inTemplateVar);
1063 }
1064 template <>
1065 inline void BitStream::Write(unsigned char * const &inTemplateVar)
1066 {
1067 Write((const char*)inTemplateVar);
1068 }
1069
1075 template <class templateType>
1076 inline void BitStream::WriteDelta(const templateType &currentValue, const templateType &lastValue)
1077 {
1078 if (currentValue==lastValue)
1079 {
1080 Write(false);
1081 }
1082 else
1083 {
1084 Write(true);
1085 Write(currentValue);
1086 }
1087 }
1088
1092 template <>
1093 inline void BitStream::WriteDelta(const bool &currentValue, const bool &lastValue)
1094 {
1095 (void) lastValue;
1096
1097 Write(currentValue);
1098 }
1099
1102 template <class templateType>
1103 inline void BitStream::WriteDelta(const templateType &currentValue)
1104 {
1105 Write(true);
1106 Write(currentValue);
1107 }
1108
1115 template <class templateType>
1116 inline void BitStream::WriteCompressed(const templateType &inTemplateVar)
1117 {
1118 #ifdef _MSC_VER
1119 #pragma warning(disable:4127) // conditional expression is constant
1120 #endif
1121 if (sizeof(inTemplateVar)==1)
1122 WriteCompressed( ( unsigned char* ) & inTemplateVar, sizeof( templateType ) * 8, true );
1123 else
1124 {
1125 #ifndef __BITSTREAM_NATIVE_END
1126 if (DoEndianSwap())
1127 {
1128 unsigned char output[sizeof(templateType)];
1129 ReverseBytes((unsigned char*)&inTemplateVar, output, sizeof(templateType));
1130 WriteCompressed( ( unsigned char* ) output, sizeof(templateType) * 8, true );
1131 }
1132 else
1133 #endif
1134 WriteCompressed( ( unsigned char* ) & inTemplateVar, sizeof(templateType) * 8, true );
1135 }
1136 }
1137
1138 template <>
1139 inline void BitStream::WriteCompressed(const SystemAddress &inTemplateVar)
1140 {
1141 Write(inTemplateVar);
1142 }
1143
1144 template <>
1145 inline void BitStream::WriteCompressed(const RakNetGUID &inTemplateVar)
1146 {
1147 Write(inTemplateVar);
1148 }
1149
1150 template <>
1151 inline void BitStream::WriteCompressed(const uint24_t &var)
1152 {
1153 Write(var);
1154 }
1155
1156 template <>
1157 inline void BitStream::WriteCompressed(const bool &inTemplateVar)
1158 {
1159 Write(inTemplateVar);
1160 }
1161
1163 template <>
1164 inline void BitStream::WriteCompressed(const float &inTemplateVar)
1165 {
1166 RakAssert(inTemplateVar > -1.01f && inTemplateVar < 1.01f);
1167 float varCopy=inTemplateVar;
1168 if (varCopy < -1.0f)
1169 varCopy=-1.0f;
1170 if (varCopy > 1.0f)
1171 varCopy=1.0f;
1172 Write((unsigned short)((varCopy+1.0f)*32767.5f));
1173 }
1174
1176 template <>
1177 inline void BitStream::WriteCompressed(const double &inTemplateVar)
1178 {
1179 RakAssert(inTemplateVar > -1.01 && inTemplateVar < 1.01);
1180 double varCopy=inTemplateVar;
1181 if (varCopy < -1.0f)
1182 varCopy=-1.0f;
1183 if (varCopy > 1.0f)
1184 varCopy=1.0f;
1185 Write((uint32_t)((varCopy+1.0)*2147483648.0));
1186 }
1187
1189 template <>
1190 inline void BitStream::WriteCompressed(const RakString &inTemplateVar)
1191 {
1192 inTemplateVar.SerializeCompressed(this,0,false);
1193 }
1194 template <>
1195 inline void BitStream::WriteCompressed(const RakWString &inTemplateVar)
1196 {
1197 inTemplateVar.Serialize(this);
1198 }
1199 template <>
1200 inline void BitStream::WriteCompressed(const char * const &inStringVar)
1201 {
1202 RakString::SerializeCompressed(inStringVar,this,0,false);
1203 }
1204 template <>
1205 inline void BitStream::WriteCompressed(const wchar_t * const &inStringVar)
1206 {
1207 RakWString::Serialize(inStringVar,this);
1208 }
1209 template <>
1210 inline void BitStream::WriteCompressed(const unsigned char * const &inTemplateVar)
1211 {
1212 WriteCompressed((const char*) inTemplateVar);
1213 }
1214 template <>
1215 inline void BitStream::WriteCompressed(char * const &inTemplateVar)
1216 {
1217 WriteCompressed((const char*) inTemplateVar);
1218 }
1219 template <>
1220 inline void BitStream::WriteCompressed(unsigned char * const &inTemplateVar)
1221 {
1222 WriteCompressed((const char*) inTemplateVar);
1223 }
1224
1225
1234 template <class templateType>
1235 inline void BitStream::WriteCompressedDelta(const templateType &currentValue, const templateType &lastValue)
1236 {
1237 if (currentValue==lastValue)
1238 {
1239 Write(false);
1240 }
1241 else
1242 {
1243 Write(true);
1244 WriteCompressed(currentValue);
1245 }
1246 }
1247
1251 template <>
1252 inline void BitStream::WriteCompressedDelta(const bool &currentValue, const bool &lastValue)
1253 {
1254 (void) lastValue;
1255
1256 Write(currentValue);
1257 }
1258
1261 template <class templateType>
1262 inline void BitStream::WriteCompressedDelta(const templateType &currentValue)
1263 {
1264 Write(true);
1265 WriteCompressed(currentValue);
1266 }
1267
1270 template <>
1271 inline void BitStream::WriteCompressedDelta(const bool &currentValue)
1272 {
1273 Write(currentValue);
1274 }
1275
1278 template <class templateType>
1279 inline bool BitStream::Read(templateType &outTemplateVar)
1280 {
1281 #ifdef _MSC_VER
1282 #pragma warning(disable:4127) // conditional expression is constant
1283 #endif
1284 if (sizeof(outTemplateVar)==1)
1285 return ReadBits( ( unsigned char* ) &outTemplateVar, sizeof(templateType) * 8, true );
1286 else
1287 {
1288 #ifndef __BITSTREAM_NATIVE_END
1289 if (DoEndianSwap())
1290 {
1291 unsigned char output[sizeof(templateType)];
1292 if (ReadBits( ( unsigned char* ) output, sizeof(templateType) * 8, true ))
1293 {
1294 ReverseBytes(output, (unsigned char*)&outTemplateVar, sizeof(templateType));
1295 return true;
1296 }
1297 return false;
1298 }
1299 else
1300 #endif
1301 return ReadBits( ( unsigned char* ) & outTemplateVar, sizeof(templateType) * 8, true );
1302 }
1303 }
1304
1307 template <>
1308 inline bool BitStream::Read(bool &outTemplateVar)
1309 {
1310 if (GetNumberOfUnreadBits() == 0)
1311 return false;
1312
1313 if ( data[ readOffset >> 3 ] & ( 0x80 >> ( readOffset & 7 ) ) ) // Is it faster to just write it out here?
1314 outTemplateVar = true;
1315 else
1316 outTemplateVar = false;
1317
1318 // Has to be on a different line for Mac
1319 readOffset++;
1320
1321 return true;
1322 }
1323
1326 template <>
1327 inline bool BitStream::Read(SystemAddress &outTemplateVar)
1328 {
1329 unsigned char ipVersion;
1330 Read(ipVersion);
1331 if (ipVersion==4)
1332 {
1333 outTemplateVar.address.addr4.sin_family=AF_INET;
1334 // Read(var.binaryAddress);
1335 // Don't endian swap the address or port
1336 uint32_t binaryAddress;
1337 ReadBits( ( unsigned char* ) & binaryAddress, sizeof(binaryAddress) * 8, true );
1338 // Unhide the IP address, done to prevent routers from changing it
1339 outTemplateVar.address.addr4.sin_addr.s_addr=~binaryAddress;
1340 bool b = ReadBits(( unsigned char* ) & outTemplateVar.address.addr4.sin_port, sizeof(outTemplateVar.address.addr4.sin_port) * 8, true);
1341 outTemplateVar.debugPort=ntohs(outTemplateVar.address.addr4.sin_port);
1342 return b;
1343 }
1344 else
1345 {
1346 #if RAKNET_SUPPORT_IPV6==1
1347 bool b = ReadBits((unsigned char*) &outTemplateVar.address.addr6, sizeof(outTemplateVar.address.addr6)*8, true);
1348 outTemplateVar.debugPort=ntohs(outTemplateVar.address.addr6.sin6_port);
1349 return b;
1350 #else
1351 return false;
1352 #endif
1353 }
1354 }
1355
1356 template <>
1357 inline bool BitStream::Read(uint24_t &outTemplateVar)
1358 {
1359 AlignReadToByteBoundary();
1360 if (GetNumberOfUnreadBits() < 3*8)
1361 return false;
1362
1363 if (IsBigEndian()==false)
1364 {
1365 ((unsigned char *)&outTemplateVar.val)[0]=data[ (readOffset >> 3) + 0];
1366 ((unsigned char *)&outTemplateVar.val)[1]=data[ (readOffset >> 3) + 1];
1367 ((unsigned char *)&outTemplateVar.val)[2]=data[ (readOffset >> 3) + 2];
1368 ((unsigned char *)&outTemplateVar.val)[3]=0;
1369 }
1370 else
1371 {
1372
1373 ((unsigned char *)&outTemplateVar.val)[3]=data[ (readOffset >> 3) + 0];
1374 ((unsigned char *)&outTemplateVar.val)[2]=data[ (readOffset >> 3) + 1];
1375 ((unsigned char *)&outTemplateVar.val)[1]=data[ (readOffset >> 3) + 2];
1376 ((unsigned char *)&outTemplateVar.val)[0]=0;
1377 }
1378
1379 readOffset+=3*8;
1380 return true;
1381 }
1382
1383 template <>
1384 inline bool BitStream::Read(RakNetGUID &outTemplateVar)
1385 {
1386 return Read(outTemplateVar.g);
1387 }
1388
1389
1390 template <>
1391 inline bool BitStream::Read(RakString &outTemplateVar)
1392 {
1393 return outTemplateVar.Deserialize(this);
1394 }
1395 template <>
1396 inline bool BitStream::Read(RakWString &outTemplateVar)
1397 {
1398 return outTemplateVar.Deserialize(this);
1399 }
1400 template <>
1401 inline bool BitStream::Read(char *&varString)
1402 {
1403 return RakString::Deserialize(varString,this);
1404 }
1405 inline bool BitStream::Read(wchar_t *&varString)
1406 {
1407 return RakWString::Deserialize(varString, this);
1408 }
1409 inline bool BitStream::Read(wchar_t *&varString, size_t varStringLength)
1410 {
1411 return RakWString::Deserialize(varString,varStringLength,this);
1412 }
1413 template <>
1414 inline bool BitStream::Read(unsigned char *&varString)
1415 {
1416 return RakString::Deserialize((char*) varString,this);
1417 }
1418
1424 template <class templateType>
1425 inline bool BitStream::ReadDelta(templateType &outTemplateVar)
1426 {
1427 bool dataWritten;
1428 bool success;
1429 success=Read(dataWritten);
1430 if (dataWritten)
1431 success=Read(outTemplateVar);
1432 return success;
1433 }
1434
1437 template <>
1438 inline bool BitStream::ReadDelta(bool &outTemplateVar)
1439 {
1440 return Read(outTemplateVar);
1441 }
1442
1449 template <class templateType>
1450 inline bool BitStream::ReadCompressed(templateType &outTemplateVar)
1451 {
1452 #ifdef _MSC_VER
1453 #pragma warning(disable:4127) // conditional expression is constant
1454 #endif
1455 if (sizeof(outTemplateVar)==1)
1456 return ReadCompressed( ( unsigned char* ) &outTemplateVar, sizeof(templateType) * 8, true );
1457 else
1458 {
1459 #ifndef __BITSTREAM_NATIVE_END
1460 if (DoEndianSwap())
1461 {
1462 unsigned char output[sizeof(templateType)];
1463 if (ReadCompressed( ( unsigned char* ) output, sizeof(templateType) * 8, true ))
1464 {
1465 ReverseBytes(output, (unsigned char*)&outTemplateVar, sizeof(templateType));
1466 return true;
1467 }
1468 return false;
1469 }
1470 else
1471 #endif
1472 return ReadCompressed( ( unsigned char* ) & outTemplateVar, sizeof(templateType) * 8, true );
1473 }
1474 }
1475
1476 template <>
1477 inline bool BitStream::ReadCompressed(SystemAddress &outTemplateVar)
1478 {
1479 return Read(outTemplateVar);
1480 }
1481
1482 template <>
1483 inline bool BitStream::ReadCompressed(uint24_t &outTemplateVar)
1484 {
1485 return Read(outTemplateVar);
1486 }
1487
1488 template <>
1489 inline bool BitStream::ReadCompressed(RakNetGUID &outTemplateVar)
1490 {
1491 return Read(outTemplateVar);
1492 }
1493
1494 template <>
1495 inline bool BitStream::ReadCompressed(bool &outTemplateVar)
1496 {
1497 return Read(outTemplateVar);
1498 }
1499
1501 template <>
1502 inline bool BitStream::ReadCompressed(float &outTemplateVar)
1503 {
1504 unsigned short compressedFloat;
1505 if (Read(compressedFloat))
1506 {
1507 outTemplateVar = ((float)compressedFloat / 32767.5f - 1.0f);
1508 return true;
1509 }
1510 return false;
1511 }
1512
1514 template <>
1515 inline bool BitStream::ReadCompressed(double &outTemplateVar)
1516 {
1517 uint32_t compressedFloat;
1518 if (Read(compressedFloat))
1519 {
1520 outTemplateVar = ((double)compressedFloat / 2147483648.0 - 1.0);
1521 return true;
1522 }
1523 return false;
1524 }
1525
1527 template <>
1528 inline bool BitStream::ReadCompressed(RakString &outTemplateVar)
1529 {
1530 return outTemplateVar.DeserializeCompressed(this,false);
1531 }
1532 template <>
1533 inline bool BitStream::ReadCompressed(RakWString &outTemplateVar)
1534 {
1535 return outTemplateVar.Deserialize(this);
1536 }
1537 template <>
1538 inline bool BitStream::ReadCompressed(char *&outTemplateVar)
1539 {
1540 return RakString::DeserializeCompressed(outTemplateVar,this,false);
1541 }
1542 inline bool BitStream::ReadCompressed(wchar_t *&outTemplateVar)
1543 {
1544 return RakWString::Deserialize(outTemplateVar, this);
1545 }
1546 inline bool BitStream::ReadCompressed(wchar_t *&outTemplateVar, size_t varStringLength)
1547 {
1548 return RakWString::Deserialize(outTemplateVar,varStringLength,this);
1549 }
1550 template <>
1551 inline bool BitStream::ReadCompressed(unsigned char *&outTemplateVar)
1552 {
1553 return RakString::DeserializeCompressed((char*) outTemplateVar,this,false);
1554 }
1555
1565 template <class templateType>
1566 inline bool BitStream::ReadCompressedDelta(templateType &outTemplateVar)
1567 {
1568 bool dataWritten;
1569 bool success;
1570 success=Read(dataWritten);
1571 if (dataWritten)
1572 success=ReadCompressed(outTemplateVar);
1573 return success;
1574 }
1575
1578 template <>
1579 inline bool BitStream::ReadCompressedDelta(bool &outTemplateVar)
1580 {
1581 return Read(outTemplateVar);
1582 }
1583
1584 template <class destinationType, class sourceType >
1585 void BitStream::WriteCasted( const sourceType &value )
1586 {
1587 destinationType val = (destinationType) value;
1588 Write(val);
1589 }
1590
1591 template <class templateType>
1592 void BitStream::WriteBitsFromIntegerRange( const templateType value, const templateType minimum,const templateType maximum, bool allowOutsideRange )
1593 {
1594 int requiredBits=BYTES_TO_BITS(sizeof(templateType))-NumberOfLeadingZeroes(templateType(maximum-minimum));
1595 WriteBitsFromIntegerRange(value,minimum,maximum,requiredBits,allowOutsideRange);
1596 }
1597 template <class templateType>
1598 void BitStream::WriteBitsFromIntegerRange( const templateType value, const templateType minimum,const templateType maximum, const int requiredBits, bool allowOutsideRange )
1599 {
1600 RakAssert(maximum>=minimum);
1601 RakAssert(allowOutsideRange==true || (value>=minimum && value<=maximum));
1602 if (allowOutsideRange)
1603 {
1604 if (value<minimum || value>maximum)
1605 {
1606 Write(true);
1607 Write(value);
1608 return;
1609 }
1610 Write(false);
1611 }
1612 templateType valueOffMin=value-minimum;
1613 if (IsBigEndian()==true)
1614 {
1615 unsigned char output[sizeof(templateType)];
1616 ReverseBytes((unsigned char*)&valueOffMin, output, sizeof(templateType));
1617 WriteBits(output,requiredBits);
1618 }
1619 else
1620 {
1621 WriteBits((unsigned char*) &valueOffMin,requiredBits);
1622 }
1623 }
1624
1625 template <class templateType> // templateType for this function must be a float or double
1626 void BitStream::WriteNormVector( templateType x, templateType y, templateType z )
1627 {
1628 #ifdef _DEBUG
1629 RakAssert(x <= 1.01 && y <= 1.01 && z <= 1.01 && x >= -1.01 && y >= -1.01 && z >= -1.01);
1630 #endif
1631
1632 WriteFloat16((float)x,-1.0f,1.0f);
1633 WriteFloat16((float)y,-1.0f,1.0f);
1634 WriteFloat16((float)z,-1.0f,1.0f);
1635 }
1636
1637 template <class templateType> // templateType for this function must be a float or double
1638 void BitStream::WriteVector( templateType x, templateType y, templateType z )
1639 {
1640 templateType magnitude = sqrt(x * x + y * y + z * z);
1641 Write((float)magnitude);
1642 if (magnitude > 0.00001f)
1643 {
1644 WriteCompressed((float)(x/magnitude));
1645 WriteCompressed((float)(y/magnitude));
1646 WriteCompressed((float)(z/magnitude));
1647 // Write((unsigned short)((x/magnitude+1.0f)*32767.5f));
1648 // Write((unsigned short)((y/magnitude+1.0f)*32767.5f));
1649 // Write((unsigned short)((z/magnitude+1.0f)*32767.5f));
1650 }
1651 }
1652
1653 template <class templateType> // templateType for this function must be a float or double
1654 void BitStream::WriteNormQuat( templateType w, templateType x, templateType y, templateType z)
1655 {
1656 Write((bool)(w<0.0));
1657 Write((bool)(x<0.0));
1658 Write((bool)(y<0.0));
1659 Write((bool)(z<0.0));
1660 Write((unsigned short)(fabs(x)*65535.0));
1661 Write((unsigned short)(fabs(y)*65535.0));
1662 Write((unsigned short)(fabs(z)*65535.0));
1663 // Leave out w and calculate it on the target
1664 }
1665
1666 template <class templateType> // templateType for this function must be a float or double
1667 void BitStream::WriteOrthMatrix(
1668 templateType m00, templateType m01, templateType m02,
1669 templateType m10, templateType m11, templateType m12,
1670 templateType m20, templateType m21, templateType m22 )
1671 {
1672
1673 double qw;
1674 double qx;
1675 double qy;
1676 double qz;
1677
1678 // Convert matrix to quat
1679 // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/
1680 float sum;
1681 sum = 1 + m00 + m11 + m22;
1682 if (sum < 0.0f) sum=0.0f;
1683 qw = sqrt( sum ) / 2;
1684 sum = 1 + m00 - m11 - m22;
1685 if (sum < 0.0f) sum=0.0f;
1686 qx = sqrt( sum ) / 2;
1687 sum = 1 - m00 + m11 - m22;
1688 if (sum < 0.0f) sum=0.0f;
1689 qy = sqrt( sum ) / 2;
1690 sum = 1 - m00 - m11 + m22;
1691 if (sum < 0.0f) sum=0.0f;
1692 qz = sqrt( sum ) / 2;
1693 if (qw < 0.0) qw=0.0;
1694 if (qx < 0.0) qx=0.0;
1695 if (qy < 0.0) qy=0.0;
1696 if (qz < 0.0) qz=0.0;
1697 qx = _copysign( (double) qx, (double) (m21 - m12) );
1698 qy = _copysign( (double) qy, (double) (m02 - m20) );
1699 qz = _copysign( (double) qz, (double) (m10 - m01) );
1700
1701 WriteNormQuat(qw,qx,qy,qz);
1702 }
1703
1704 template <class serializationType, class sourceType >
1705 bool BitStream::ReadCasted( sourceType &value )
1706 {
1707 serializationType val;
1708 bool success = Read(val);
1709 value=(sourceType) val;
1710 return success;
1711 }
1712
1713 template <class templateType>
1714 bool BitStream::ReadBitsFromIntegerRange( templateType &value, const templateType minimum, const templateType maximum, bool allowOutsideRange )
1715 {
1716 int requiredBits=BYTES_TO_BITS(sizeof(templateType))-NumberOfLeadingZeroes(templateType(maximum-minimum));
1717 return ReadBitsFromIntegerRange(value,minimum,maximum,requiredBits,allowOutsideRange);
1718 }
1719 template <class templateType>
1720 bool BitStream::ReadBitsFromIntegerRange( templateType &value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange )
1721 {
1722 RakAssert(maximum>=minimum);
1723 if (allowOutsideRange)
1724 {
1725 bool isOutsideRange;
1726 Read(isOutsideRange);
1727 if (isOutsideRange)
1728 return Read(value);
1729 }
1730 unsigned char output[sizeof(templateType)];
1731 memset(output,0,sizeof(output));
1732 bool success = ReadBits(output,requiredBits);
1733 if (success)
1734 {
1735 if (IsBigEndian()==true)
1736 ReverseBytesInPlace(output,sizeof(output));
1737 memcpy(&value,output,sizeof(output));
1738
1739 value+=minimum;
1740 }
1741
1742 return success;
1743 }
1744
1745 template <class templateType> // templateType for this function must be a float or double
1746 bool BitStream::ReadNormVector( templateType &x, templateType &y, templateType &z )
1747 {
1748 float xIn,yIn,zIn;
1749 ReadFloat16(xIn,-1.0f,1.0f);
1750 ReadFloat16(yIn,-1.0f,1.0f);
1751 ReadFloat16(zIn,-1.0f,1.0f);
1752 x=xIn;
1753 y=yIn;
1754 z=zIn;
1755 return true;
1756 }
1757
1758 template <class templateType> // templateType for this function must be a float or double
1759 bool BitStream::ReadVector( templateType &x, templateType &y, templateType &z )
1760 {
1761 float magnitude;
1762 //unsigned short sx,sy,sz;
1763 if (!Read(magnitude))
1764 return false;
1765 if (magnitude>0.00001f)
1766 {
1767 // Read(sx);
1768 // Read(sy);
1769 // if (!Read(sz))
1770 // return false;
1771 // x=((float)sx / 32767.5f - 1.0f) * magnitude;
1772 // y=((float)sy / 32767.5f - 1.0f) * magnitude;
1773 // z=((float)sz / 32767.5f - 1.0f) * magnitude;
1774 float cx=0.0f,cy=0.0f,cz=0.0f;
1775 ReadCompressed(cx);
1776 ReadCompressed(cy);
1777 if (!ReadCompressed(cz))
1778 return false;
1779 x=cx;
1780 y=cy;
1781 z=cz;
1782 x*=magnitude;
1783 y*=magnitude;
1784 z*=magnitude;
1785 }
1786 else
1787 {
1788 x=0.0;
1789 y=0.0;
1790 z=0.0;
1791 }
1792 return true;
1793 }
1794
1795 template <class templateType> // templateType for this function must be a float or double
1796 bool BitStream::ReadNormQuat( templateType &w, templateType &x, templateType &y, templateType &z)
1797 {
1798 bool cwNeg=false, cxNeg=false, cyNeg=false, czNeg=false;
1799 unsigned short cx,cy,cz;
1800 Read(cwNeg);
1801 Read(cxNeg);
1802 Read(cyNeg);
1803 Read(czNeg);
1804 Read(cx);
1805 Read(cy);
1806 if (!Read(cz))
1807 return false;
1808
1809 // Calculate w from x,y,z
1810 x=(templateType)(cx/65535.0);
1811 y=(templateType)(cy/65535.0);
1812 z=(templateType)(cz/65535.0);
1813 if (cxNeg) x=-x;
1814 if (cyNeg) y=-y;
1815 if (czNeg) z=-z;
1816 float difference = 1.0f - x*x - y*y - z*z;
1817 if (difference < 0.0f)
1818 difference=0.0f;
1819 w = (templateType)(sqrt(difference));
1820 if (cwNeg)
1821 w=-w;
1822
1823 return true;
1824 }
1825
1826 template <class templateType> // templateType for this function must be a float or double
1827 bool BitStream::ReadOrthMatrix(
1828 templateType &m00, templateType &m01, templateType &m02,
1829 templateType &m10, templateType &m11, templateType &m12,
1830 templateType &m20, templateType &m21, templateType &m22 )
1831 {
1832 float qw,qx,qy,qz;
1833 if (!ReadNormQuat(qw,qx,qy,qz))
1834 return false;
1835
1836 // Quat to orthogonal rotation matrix
1837 // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm
1838 double sqw = (double)qw*(double)qw;
1839 double sqx = (double)qx*(double)qx;
1840 double sqy = (double)qy*(double)qy;
1841 double sqz = (double)qz*(double)qz;
1842 m00 = (templateType)(sqx - sqy - sqz + sqw); // since sqw + sqx + sqy + sqz =1
1843 m11 = (templateType)(-sqx + sqy - sqz + sqw);
1844 m22 = (templateType)(-sqx - sqy + sqz + sqw);
1845
1846 double tmp1 = (double)qx*(double)qy;
1847 double tmp2 = (double)qz*(double)qw;
1848 m10 = (templateType)(2.0 * (tmp1 + tmp2));
1849 m01 = (templateType)(2.0 * (tmp1 - tmp2));
1850
1851 tmp1 = (double)qx*(double)qz;
1852 tmp2 = (double)qy*(double)qw;
1853 m20 =(templateType)(2.0 * (tmp1 - tmp2));
1854 m02 = (templateType)(2.0 * (tmp1 + tmp2));
1855 tmp1 = (double)qy*(double)qz;
1856 tmp2 = (double)qx*(double)qw;
1857 m21 = (templateType)(2.0 * (tmp1 + tmp2));
1858 m12 = (templateType)(2.0 * (tmp1 - tmp2));
1859
1860 return true;
1861 }
1862
1863 template <class templateType>
1864 BitStream& operator<<(BitStream& out, const templateType& c)
1865 {
1866 out.Write(c);
1867 return out;
1868 }
1869 template <class templateType>
1870 BitStream& operator>>(BitStream& in, templateType& c)
1871 {
1872 bool success = in.Read(c);
1873 (void)success;
1874
1875 RakAssert(success);
1876 return in;
1877 }
1878
1879 }
1880
1881 #ifdef _MSC_VER
1882 #pragma warning( pop )
1883 #endif
1884
1885 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/statistics.h Source File

  • include
  • slikenet
statistics.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __RAK_NET_STATISTICS_H
23 #define __RAK_NET_STATISTICS_H
24
25 #include "PacketPriority.h"
26 #include "Export.h"
27 #include "types.h"
28
29 namespace SLNet
30 {
31
32 enum RNSPerSecondMetrics
33 {
35 USER_MESSAGE_BYTES_PUSHED,
36
39 USER_MESSAGE_BYTES_SENT,
40
42 USER_MESSAGE_BYTES_RESENT,
43
45 USER_MESSAGE_BYTES_RECEIVED_PROCESSED,
46
48 USER_MESSAGE_BYTES_RECEIVED_IGNORED,
49
51 ACTUAL_BYTES_SENT,
52
54 ACTUAL_BYTES_RECEIVED,
55
57 RNS_PER_SECOND_METRICS_COUNT
58 };
59
63 struct RAK_DLL_EXPORT RakNetStatistics
64 {
66 uint64_t valueOverLastSecond[RNS_PER_SECOND_METRICS_COUNT];
67
69 uint64_t runningTotal[RNS_PER_SECOND_METRICS_COUNT];
70
73 SLNet::TimeUS connectionStartTime;
74
77 bool isLimitedByCongestionControl;
78
80 uint64_t BPSLimitByCongestionControl;
81
83 bool isLimitedByOutgoingBandwidthLimit;
84
86 uint64_t BPSLimitByOutgoingBandwidthLimit;
87
89 unsigned int messageInSendBuffer[NUMBER_OF_PRIORITIES];
90
92 double bytesInSendBuffer[NUMBER_OF_PRIORITIES];
93
96 unsigned int messagesInResendBuffer;
97
99 uint64_t bytesInResendBuffer;
100
102 float packetlossLastSecond;
103
105 float packetlossTotal;
106
107 RakNetStatistics& operator +=(const RakNetStatistics& other)
108 {
109 unsigned i;
110 for (i=0; i < NUMBER_OF_PRIORITIES; i++)
111 {
112 messageInSendBuffer[i]+=other.messageInSendBuffer[i];
113 bytesInSendBuffer[i]+=other.bytesInSendBuffer[i];
114 }
115
116 for (i=0; i < RNS_PER_SECOND_METRICS_COUNT; i++)
117 {
118 valueOverLastSecond[i]+=other.valueOverLastSecond[i];
119 runningTotal[i]+=other.runningTotal[i];
120 }
121
122 return *this;
123 }
124 };
125
135 void RAK_DLL_EXPORT StatisticsToString(RakNetStatistics *s, char *buffer, int verbosityLevel);
136 void RAK_DLL_EXPORT StatisticsToString( RakNetStatistics *s, char *buffer, size_t bufferLength, int verbosityLevel );
137
138 } // namespace SLNet
139
140 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/defineoverrides.h Source File

  • include
  • slikenet
defineoverrides.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 // USER EDITABLE FILE
12
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/StringTable.cpp Source File

  • src
StringTable.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/StringTable.h"
17 #include <string.h>
18 #include "slikenet/assert.h"
19 #include <stdio.h>
20 #include "slikenet/BitStream.h"
21 #include "slikenet/StringCompressor.h"
22 #include "slikenet/linux_adapter.h"
23 #include "slikenet/osx_adapter.h"
24 using namespace SLNet;
25
26 StringTable* StringTable::instance=0;
27 int StringTable::referenceCount=0;
28
29
30 int SLNet::StrAndBoolComp( char *const &key, const StrAndBool &data )
31 {
32 return strcmp(key,(const char*)data.str);
33 }
34
35 StringTable::StringTable()
36 {
37
38 }
39
40 StringTable::~StringTable()
41 {
42 unsigned i;
43 for (i=0; i < orderedStringList.Size(); i++)
44 {
45 if (orderedStringList[i].b)
46 rakFree_Ex(orderedStringList[i].str, _FILE_AND_LINE_ );
47 }
48 }
49
50 void StringTable::AddReference(void)
51 {
52 if (++referenceCount==1)
53 {
54 instance = SLNet::OP_NEW<StringTable>( _FILE_AND_LINE_ );
55 }
56 }
57 void StringTable::RemoveReference(void)
58 {
59 RakAssert(referenceCount > 0);
60
61 if (referenceCount > 0)
62 {
63 if (--referenceCount==0)
64 {
65 SLNet::OP_DELETE(instance, _FILE_AND_LINE_);
66 instance=0;
67 }
68 }
69 }
70
71 StringTable* StringTable::Instance(void)
72 {
73 return instance;
74 }
75
76 void StringTable::AddString(const char *str, bool copyString)
77 {
78 StrAndBool sab;
79 sab.b=copyString;
80 if (copyString)
81 {
82 sab.str = (char*) rakMalloc_Ex( strlen(str)+1, _FILE_AND_LINE_ );
83 strcpy_s(sab.str, strlen(str)+1, str);
84 }
85 else
86 {
87 sab.str=(char*)str;
88 }
89
90 // If it asserts inside here you are adding duplicate strings.
91 orderedStringList.Insert(sab.str,sab, true, _FILE_AND_LINE_);
92
93 // If this assert hits you need to increase the range of StringTableType
94 RakAssert(orderedStringList.Size() < (StringTableType)-1);
95
96 }
97 void StringTable::EncodeString( const char *input, int maxCharsToWrite, SLNet::BitStream *output )
98 {
99 unsigned index;
100 bool objectExists;
101 // This is fast because the list is kept ordered.
102 index=orderedStringList.GetIndexFromKey((char*)input, &objectExists);
103 if (objectExists)
104 {
105 output->Write(true);
106 output->Write((StringTableType)index);
107 }
108 else
109 {
110 LogStringNotFound(input);
111 output->Write(false);
112 StringCompressor::Instance()->EncodeString(input, maxCharsToWrite, output);
113 }
114 }
115
116 bool StringTable::DecodeString( char *output, int maxCharsToWrite, SLNet::BitStream *input )
117 {
118 bool hasIndex=false;
119 RakAssert(maxCharsToWrite>0);
120
121 if (maxCharsToWrite==0)
122 return false;
123 if (!input->Read(hasIndex))
124 return false;
125 if (hasIndex==false)
126 {
127 StringCompressor::Instance()->DecodeString(output, maxCharsToWrite, input);
128 }
129 else
130 {
131 StringTableType index;
132 if (!input->Read(index))
133 return false;
134 if (index >= orderedStringList.Size())
135 {
136 #ifdef _DEBUG
137 // Critical error - got a string index out of range, which means AddString was called more times on the remote system than on this system.
138 // All systems must call AddString the same number of types, with the same strings in the same order.
139 RakAssert(0);
140 #endif
141 return false;
142 }
143
144 strncpy_s(output, maxCharsToWrite, orderedStringList[index].str, maxCharsToWrite);
145 output[maxCharsToWrite-1]=0;
146 }
147
148 return true;
149 }
150 void StringTable::LogStringNotFound(const char *strName)
151 {
152 (void) strName;
153
154 #ifdef _DEBUG
155 RAKNET_DEBUG_PRINTF("Efficiency Warning! Unregistered String %s sent to StringTable.\n", strName);
156 #endif
157 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RPC4GlobalRegistration
SLNet::RPC4GlobalRegistration Member List

This is the complete list of members for SLNet::RPC4GlobalRegistration, including all inherited members.

RPC4GlobalRegistration(const char *uniqueID, void(*functionPointer)(SLNet::BitStream *userData, Packet *packet)) | SLNet::RPC4GlobalRegistration
RPC4GlobalRegistration(const char *uniqueID, void(*functionPointer)(SLNet::BitStream *userData, Packet *packet), int callPriority) | SLNet::RPC4GlobalRegistration
RPC4GlobalRegistration(const char *uniqueID, void(*functionPointer)(SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet)) | SLNet::RPC4GlobalRegistration
RPC4GlobalRegistration(const char *uniqueID, MessageID messageId) | SLNet::RPC4GlobalRegistration
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PluginInterface2.h Source File

  • include
  • slikenet
PluginInterface2.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #ifndef __PLUGIN_INTERFACE_2_H
22 #define __PLUGIN_INTERFACE_2_H
23
24 #include "NativeFeatureIncludes.h"
25 #include "types.h"
26 #include "Export.h"
27 #include "PacketPriority.h"
28
29 namespace SLNet {
30
32 class RakPeerInterface;
33 class TCPInterface;
34 struct Packet;
35 struct InternalPacket;
36
38
41
44 enum PluginReceiveResult
45 {
47 RR_STOP_PROCESSING_AND_DEALLOCATE=0,
48
50 RR_CONTINUE_PROCESSING,
51
53 RR_STOP_PROCESSING
54 };
55
58 enum PI2_LostConnectionReason
59 {
61 LCR_CLOSED_BY_USER,
62
64 LCR_DISCONNECTION_NOTIFICATION,
65
67 LCR_CONNECTION_LOST
68 };
69
72 enum PI2_FailedConnectionAttemptReason
73 {
74 FCAR_CONNECTION_ATTEMPT_FAILED,
75 FCAR_ALREADY_CONNECTED,
76 FCAR_NO_FREE_INCOMING_CONNECTIONS,
77 FCAR_SECURITY_PUBLIC_KEY_MISMATCH,
78 FCAR_CONNECTION_BANNED,
79 FCAR_INVALID_PASSWORD,
80 FCAR_INCOMPATIBLE_PROTOCOL,
81 FCAR_IP_RECENTLY_CONNECTED,
82 FCAR_REMOTE_SYSTEM_REQUIRES_PUBLIC_KEY,
83 FCAR_OUR_SYSTEM_REQUIRES_SECURITY,
84 FCAR_PUBLIC_KEY_MISMATCH
85 };
86
94 class RAK_DLL_EXPORT PluginInterface2
95 {
96 public:
97 PluginInterface2();
98 virtual ~PluginInterface2();
99
101 virtual void OnAttach(void) {}
102
104 virtual void OnDetach(void) {}
105
107 virtual void Update(void) {}
108
112 virtual PluginReceiveResult OnReceive(Packet *packet) {(void) packet; return RR_CONTINUE_PROCESSING;}
113
115 virtual void OnRakPeerStartup(void) {}
116
118 virtual void OnRakPeerShutdown(void) {}
119
124 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason ){(void) systemAddress; (void) rakNetGUID; (void) lostConnectionReason;}
125
130 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming) {(void) systemAddress; (void) rakNetGUID; (void) isIncoming;}
131
135 virtual void OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason) {(void) packet; (void) failedConnectionAttemptReason;}
136
140 virtual bool UsesReliabilityLayer(void) const {return false;}
141
147 virtual void OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) {(void) data; (void) bitsUsed; (void) remoteSystemAddress;}
148
154 virtual void OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) {(void) data; (void) bitsUsed; (void) remoteSystemAddress;}
155
160 virtual void OnReliabilityLayerNotification(const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError) {(void) errorMessage; (void) bitsUsed; (void) remoteSystemAddress; (void) isError;}
161
169 virtual void OnInternalPacket(InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend) {(void) internalPacket; (void) frameNumber; (void) remoteSystemAddress; (void) time; (void) isSend;}
170
176 virtual void OnAck(unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time) {(void) messageNumber; (void) remoteSystemAddress; (void) time;}
177
182 virtual void OnPushBackPacket(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) {(void) data; (void) bitsUsed; (void) remoteSystemAddress;}
183
184 RakPeerInterface *GetRakPeerInterface(void) const {return rakPeerInterface;}
185
186 RakNetGUID GetMyGUIDUnified(void) const;
187
189 void SetRakPeerInterface( RakPeerInterface *ptr );
190
191 #if _RAKNET_SUPPORT_TCPInterface==1
192
193 void SetTCPInterface( TCPInterface *ptr );
194 #endif
195
196 protected:
197 // Send through either rakPeerInterface or tcpInterface, whichever is available
198 void SendUnified( const SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast );
199 void SendUnified( const char * data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast );
200 bool SendListUnified( const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast );
201
202 Packet *AllocatePacketUnified(unsigned dataSize);
203 void PushBackPacketUnified(Packet *packet, bool pushAtHead);
204 void DeallocPacketUnified(Packet *packet);
205
206 // Filled automatically in when attached
207 RakPeerInterface *rakPeerInterface;
208 #if _RAKNET_SUPPORT_TCPInterface==1
209 TCPInterface *tcpInterface;
210 #endif
211 };
212
213 } // namespace SLNet
214
215 #endif
216
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SimpleMutex.h Source File

  • include
  • slikenet
SimpleMutex.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __SIMPLE_MUTEX_H
23 #define __SIMPLE_MUTEX_H
24
25 #include "memoryoverride.h"
26
27
28 #if defined(_WIN32)
29 #include "WindowsIncludes.h"
30
31
32 #else
33 #include <pthread.h>
34 #include <sys/types.h>
35 #endif
36 #include "Export.h"
37
38 namespace SLNet
39 {
40
45 class RAK_DLL_EXPORT SimpleMutex
46 {
47 public:
48
49 // Constructor
50 SimpleMutex();
51
52 // Destructor
53 ~SimpleMutex();
54
55 // Locks the mutex. Slow!
56 void Lock(void);
57
58 // Unlocks the mutex.
59 void Unlock(void);
60
61
62
63
64
65
66
67 private:
68 void Init(void);
69 #ifdef _WIN32
70 CRITICAL_SECTION criticalSection;
71
72
73 #else
74 pthread_mutex_t hMutex;
75 #endif
76 // Not threadsafe
77 // bool isInitialized;
78 };
79
80 } // namespace SLNet
81
82 #endif
83
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPProxyCommon.h Source File

  • include
  • slikenet
UDPProxyCommon.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __UDP_PROXY_COMMON_H
12 #define __UDP_PROXY_COMMON_H
13
14 // System flow:
15 /*
16 UDPProxyClient: End user
17 UDPProxyServer: open server, to route messages from end users that can't connect to each other using UDPForwarder class.
18 UDPProxyCoordinator: Server somewhere, connected to by RakNet, to maintain a list of UDPProxyServer
19
20 UDPProxyServer
21 On startup, log into UDPProxyCoordinator and register self
22
23 UDPProxyClient
24 Wish to open route to X
25 Send message to UDPProxyCoordinator containing X, desired timeout
26 Wait for success or failure
27
28 UDPProxyCoordinator:
29 * Get openRouteRequest
30 If no servers registered, return failure
31 Add entry to memory
32 chooseBestUDPProxyServer() (overridable, chooses at random by default)
33 Query this server to StartForwarding(). Return success or failure
34 If failure, choose another server from the remaining list. If none remaining, return failure. Else return success.
35 * Disconnect:
36 If disconnected system is pending client on openRouteRequest, delete that request
37 If disconnected system is UDPProxyServer, remove from list. For each pending client for this server, choose from remaining servers.
38 * Login:
39 Add to UDPProxyServer list, validating password if set
40 */
41
42 // Stored in the second byte after ID_UDP_PROXY_GENERAL
43 // Otherwise MessageIdentifiers.h is too cluttered and will hit the limit on enumerations in a single byte
44 enum UDPProxyMessages
45 {
46 ID_UDP_PROXY_FORWARDING_SUCCEEDED,
47 ID_UDP_PROXY_FORWARDING_NOTIFICATION,
48 ID_UDP_PROXY_NO_SERVERS_ONLINE,
49 ID_UDP_PROXY_RECIPIENT_GUID_NOT_CONNECTED_TO_COORDINATOR,
50 ID_UDP_PROXY_ALL_SERVERS_BUSY,
51 ID_UDP_PROXY_IN_PROGRESS,
52 ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR,
53 ID_UDP_PROXY_PING_SERVERS_FROM_COORDINATOR_TO_CLIENT,
54 ID_UDP_PROXY_PING_SERVERS_REPLY_FROM_CLIENT_TO_COORDINATOR,
55 ID_UDP_PROXY_FORWARDING_REQUEST_FROM_COORDINATOR_TO_SERVER,
56 ID_UDP_PROXY_FORWARDING_REPLY_FROM_SERVER_TO_COORDINATOR,
57 ID_UDP_PROXY_LOGIN_REQUEST_FROM_SERVER_TO_COORDINATOR,
58 ID_UDP_PROXY_LOGIN_SUCCESS_FROM_COORDINATOR_TO_SERVER,
59 ID_UDP_PROXY_ALREADY_LOGGED_IN_FROM_COORDINATOR_TO_SERVER,
60 ID_UDP_PROXY_NO_PASSWORD_SET_FROM_COORDINATOR_TO_SERVER,
61 ID_UDP_PROXY_WRONG_PASSWORD_FROM_COORDINATOR_TO_SERVER
62 };
63
64
65 #define UDP_FORWARDER_MAXIMUM_TIMEOUT (60000 * 10)
66
67 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Tree
DataStructures::Tree< TreeType > Member List

This is the complete list of members for DataStructures::Tree< TreeType >, including all inherited members.

AddChild(TreeType &newData) | DataStructures::Tree< TreeType >
children | DataStructures::Tree< TreeType >
data | DataStructures::Tree< TreeType >
DeleteDecendants(void) | DataStructures::Tree< TreeType >
LevelOrderTraversal(DataStructures::List< Tree * > &output) | DataStructures::Tree< TreeType >
Tree() | DataStructures::Tree< TreeType >
Tree(TreeType &inputData) | DataStructures::Tree< TreeType >
~Tree() | DataStructures::Tree< TreeType >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/VariableListDeltaTracker.h Source File

  • include
  • slikenet
VariableListDeltaTracker.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "NativeTypes.h"
17 #include "DS_List.h"
18 #include "memoryoverride.h"
19 #include "BitStream.h"
20
21 #ifndef __VARIABLE_LIST_DELTA_TRACKER
22 #define __VARIABLE_LIST_DELTA_TRACKER
23
24 namespace SLNet
25 {
28 class VariableListDeltaTracker
29 {
30 public:
31 VariableListDeltaTracker();
32 ~VariableListDeltaTracker();
33
34 // Call before using a series of WriteVar
35 void StartWrite(void);
36
37 bool IsPastEndOfList(void) const {return nextWriteIndex>=variableList.Size();}
38
42 template <class VarType>
43 bool WriteVar(const VarType &varData)
44 {
45 SLNet::BitStream temp;
46 temp.Write(varData);
47 if (nextWriteIndex>=variableList.Size())
48 {
49 variableList.Push(VariableLastValueNode(temp.GetData(),temp.GetNumberOfBytesUsed()),_FILE_AND_LINE_);
50 nextWriteIndex++;
51 return true; // Different because it's new
52 }
53
54 if (temp.GetNumberOfBytesUsed()!=variableList[nextWriteIndex].byteLength)
55 {
56 variableList[nextWriteIndex].lastData=(char*) rakRealloc_Ex(variableList[nextWriteIndex].lastData, temp.GetNumberOfBytesUsed(),_FILE_AND_LINE_);
57 variableList[nextWriteIndex].byteLength=temp.GetNumberOfBytesUsed();
58 memcpy(variableList[nextWriteIndex].lastData,temp.GetData(),temp.GetNumberOfBytesUsed());
59 nextWriteIndex++;
60 variableList[nextWriteIndex].isDirty=false;
61 return true; // Different because the serialized size is different
62 }
63 if (variableList[nextWriteIndex].isDirty==false && memcmp(temp.GetData(),variableList[nextWriteIndex].lastData, variableList[nextWriteIndex].byteLength)==0)
64 {
65 nextWriteIndex++;
66 return false; // Same because not dirty and memcmp is the same
67 }
68
69 variableList[nextWriteIndex].isDirty=false;
70 memcpy(variableList[nextWriteIndex].lastData,temp.GetData(),temp.GetNumberOfBytesUsed());
71 nextWriteIndex++;
72 return true; // Different because dirty or memcmp was different
73 }
75 template <class VarType>
76 bool WriteVarToBitstream(const VarType &varData, SLNet::BitStream *bitStream)
77 {
78 bool wasDifferent = WriteVar(varData);
79 bitStream->Write(wasDifferent);
80 if (wasDifferent)
81 {
82 bitStream->Write(varData);
83 return true;
84 }
85 return false;
86 }
88 template <class VarType>
89 bool WriteVarToBitstream(const VarType &varData, SLNet::BitStream *bitStream, unsigned char *bArray, unsigned short writeOffset)
90 {
91 if (WriteVarToBitstream(varData,bitStream)==true)
92 {
93 BitSize_t numberOfBitsMod8 = writeOffset & 7;
94
95 if ( numberOfBitsMod8 == 0 )
96 bArray[ writeOffset >> 3 ] = 0x80;
97 else
98 bArray[ writeOffset >> 3 ] |= 0x80 >> ( numberOfBitsMod8 ); // Set the bit to 1
99
100 return true;
101 }
102 else
103 {
104 if ( ( writeOffset & 7 ) == 0 )
105 bArray[ writeOffset >> 3 ] = 0;
106
107 return false;
108 }
109 }
110
112 template <class VarType>
113 static bool ReadVarFromBitstream(VarType &varData, SLNet::BitStream *bitStream)
114 {
115 bool wasWritten;
116 if (bitStream->Read(wasWritten)==false)
117 return false;
118 if (wasWritten)
119 {
120 if (bitStream->Read(varData)==false)
121 return false;
122 }
123 return wasWritten;
124 }
125
128 void FlagDirtyFromBitArray(unsigned char *bArray);
129
131 struct VariableLastValueNode
132 {
133 VariableLastValueNode();
134 VariableLastValueNode(const unsigned char *data, int _byteLength);
135 ~VariableLastValueNode();
136 char *lastData;
137 unsigned int byteLength;
138 bool isDirty;
139 };
140
141 protected:
143 DataStructures::List<VariableLastValueNode> variableList;
145 unsigned int nextWriteIndex;
146 };
147
148
149 }
150
151 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/EpochTimeToString.cpp Source File

  • src
EpochTimeToString.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/FormatString.h"
17 #include "slikenet/EpochTimeToString.h"
18 #include <stdio.h>
19 #include <string.h>
20 #include <stdarg.h>
21 // localtime
22 #include <time.h>
23 #include "slikenet/LinuxStrings.h"
24 #include "slikenet/linux_adapter.h"
25 #include "slikenet/osx_adapter.h"
26
27 char * EpochTimeToString(long long time)
28 {
29 static int textIndex=0;
30 static char text[4][64];
31
32 if (++textIndex==4)
33 textIndex=0;
34
35 struct tm timeinfo;
36 time_t t = time;
37 localtime_s ( &timeinfo, &t );
38 strftime (text[textIndex],64,"%c.",&timeinfo);
39
40 /*
41 time_t
42 // Copied from the docs
43 struct tm *newtime;
44 newtime = _localtime64(& time);
45 asctime_s( text[textIndex], sizeof(text[textIndex]), newtime );
46
47 while (text[textIndex][0] && (text[textIndex][strlen(text[textIndex])-1]=='\n' || text[textIndex][strlen(text[textIndex])-1]=='\r'))
48 text[textIndex][strlen(text[textIndex])-1]=0;
49 */
50
51 return text[textIndex];
52 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatTypeDetectionCommon.h Source File

  • include
  • slikenet
NatTypeDetectionCommon.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21 #ifndef __NAT_TYPE_DETECTION_COMMON_H
22 #define __NAT_TYPE_DETECTION_COMMON_H
23
24 #include "NativeFeatureIncludes.h"
25
26 #if _RAKNET_SUPPORT_NatTypeDetectionServer==1 || _RAKNET_SUPPORT_NatTypeDetectionClient==1
27
28 #include "SocketIncludes.h"
29 #include "types.h"
30 #include "socket2.h"
31
32 namespace SLNet
33 {
34
36 enum NATTypeDetectionResult
37 {
39 NAT_TYPE_NONE,
41 NAT_TYPE_FULL_CONE,
43 NAT_TYPE_ADDRESS_RESTRICTED,
45 NAT_TYPE_PORT_RESTRICTED,
47 NAT_TYPE_SYMMETRIC,
49 NAT_TYPE_UNKNOWN,
51 NAT_TYPE_DETECTION_IN_PROGRESS,
53 NAT_TYPE_SUPPORTS_UPNP,
55 NAT_TYPE_COUNT
56 };
57
59 bool RAK_DLL_EXPORT CanConnect(NATTypeDetectionResult type1, NATTypeDetectionResult type2);
60
62 RAK_DLL_EXPORT const char * NATTypeDetectionResultToString(NATTypeDetectionResult type);
63
68 RAK_DLL_EXPORT const char * NATTypeDetectionResultToStringFriendly(NATTypeDetectionResult type);
69
71 RAK_DLL_EXPORT RakNetSocket2* CreateNonblockingBoundSocket(const char *bindAddr
72 #ifdef __native_client__
73 ,_PP_Instance_ chromeInstance
74 #endif
75 , RNS2EventHandler *eventHandler
76 );
77
79 //int NatTypeRecvFrom(char *data, RakNetSocket2* socket, SystemAddress &sender, RNS2EventHandler *eventHandler);
80 }
81
82 #endif // #if _RAKNET_SUPPORT_NatTypeDetectionServer==1 || _RAKNET_SUPPORT_NatTypeDetectionClient==1
83
84 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • Router2DebugInterface
SLNet::Router2DebugInterface Member List

This is the complete list of members for SLNet::Router2DebugInterface, including all inherited members.

Router2DebugInterface() | SLNet::Router2DebugInterface | inline
ShowDiagnostic(const char *message) | SLNet::Router2DebugInterface | virtual
ShowFailure(const char *message) | SLNet::Router2DebugInterface | virtual
~Router2DebugInterface() | SLNet::Router2DebugInterface | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SocketLayer.cpp Source File

  • src
SocketLayer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "slikenet/SocketLayer.h"
22 #include "slikenet/assert.h"
23 #include "slikenet/types.h"
24 #include "slikenet/peer.h"
25 #include "slikenet/GetTime.h"
26 #include "slikenet/LinuxStrings.h"
27 #include "slikenet/SocketDefines.h"
28 #include "slikenet/linux_adapter.h"
29 #include "slikenet/osx_adapter.h"
30 #if (defined(__GNUC__) || defined(__GCCXML__)) && !defined(__WIN32__)
31 #include <netdb.h>
32 #endif
33
34 #ifdef _WIN32
35 #include <tchar.h>
36 #else
37 #ifndef _T
38 #define _T(x) (x)
39 #endif
40 #endif
41
42 using namespace SLNet;
43
44 /*
45 #if defined(__native_client__)
46 using namespace pp;
47 #endif
48 */
49
50 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL!=1
51 #include "slikenet/CCRakNetUDT.h"
52 #else
53 #include "slikenet/CCRakNetSlidingWindow.h"
54 #endif
55
56 //SocketLayerOverride *SocketLayer::slo=0;
57
58 #ifdef _WIN32
59 #else
60 #include <string.h> // memcpy
61 #include <unistd.h>
62 #include <fcntl.h>
63 #include <arpa/inet.h>
64 #include <errno.h> // error numbers
65 #include <stdio.h> // RAKNET_DEBUG_PRINTF
66 #if !defined(ANDROID)
67 #include <ifaddrs.h>
68 #endif
69 #include <netinet/in.h>
70 #include <net/if.h>
71 #include <sys/types.h>
72 #include <sys/socket.h>
73 #include <sys/ioctl.h>
74
75 #endif
76
77
78
79
80
81
82
83
84
85
86
87
88
89 #if defined(_WIN32)
90 #include "slikenet/WSAStartupSingleton.h"
91 #include "slikenet/WindowsIncludes.h"
92
93 #else
94 #include <unistd.h>
95 #endif
96
97 #include "slikenet/sleep.h"
98 #include <stdio.h>
99 #include "slikenet/Itoa.h"
100
101 namespace SLNet
102 {
103 extern void ProcessNetworkPacket( const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, SLNet::TimeUS timeRead );
104 //extern void ProcessNetworkPacket( const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket* rakNetSocket, SLNet::TimeUS timeRead );
105 }
106
107 #ifdef _DEBUG
108 #include <stdio.h>
109 #endif
110
111
112
113 // http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#ip4to6
114 // http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#getaddrinfo
115
116 #if RAKNET_SUPPORT_IPV6==1
117 void PrepareAddrInfoHints(addrinfo *hints)
118 {
119 memset(hints, 0, sizeof (addrinfo)); // make sure the struct is empty
120 hints->ai_socktype = SOCK_DGRAM; // UDP sockets
121 hints->ai_flags = AI_PASSIVE; // fill in my IP for me
122 }
123 #endif
124
125 void SocketLayer::SetSocketOptions( __UDPSOCKET__ listenSocket, bool blockingSocket, bool setBroadcast)
126 {
127 #ifdef __native_client__
128 (void) listenSocket;
129 #else
130 int sock_opt = 1;
131
132 // This doubles the max throughput rate
133 sock_opt=1024*256;
134 setsockopt__(listenSocket, SOL_SOCKET, SO_RCVBUF, ( char * ) & sock_opt, sizeof ( sock_opt ) );
135
136 // Immediate hard close. Don't linger the socket, or recreating the socket quickly on Vista fails.
137 // Fail with voice and xbox
138
139 sock_opt=0;
140 setsockopt__(listenSocket, SOL_SOCKET, SO_LINGER, ( char * ) & sock_opt, sizeof ( sock_opt ) );
141
142
143
144 // This doesn't make much difference: 10% maybe
145 // Not supported on console 2
146 sock_opt=1024*16;
147 setsockopt__(listenSocket, SOL_SOCKET, SO_SNDBUF, ( char * ) & sock_opt, sizeof ( sock_opt ) );
148
149
150 if (blockingSocket==false)
151 {
152 #ifdef _WIN32
153 unsigned long nonblocking = 1;
154 ioctlsocket__(listenSocket, FIONBIO, &nonblocking );
155
156
157
158 #else
159 fcntl( listenSocket, F_SETFL, O_NONBLOCK );
160 #endif
161 }
162 if (setBroadcast)
163 {
164 // Note: Fails with VDP but not xbox
165 // Set broadcast capable
166 sock_opt=1;
167 if ( setsockopt__(listenSocket, SOL_SOCKET, SO_BROADCAST, ( char * ) & sock_opt, sizeof( sock_opt ) ) == -1 )
168 {
169 #if defined(_WIN32) && defined(_DEBUG)
170 #if !defined(WINDOWS_PHONE_8)
171 DWORD dwIOError = GetLastError();
172 // On Vista, can get WSAEACCESS (10013)
173 // See http://support.microsoft.com/kb/819124
174 // http://blogs.msdn.com/wndp/archive/2007/03/19/winsock-so-exclusiveaddruse-on-vista.aspx
175 // http://msdn.microsoft.com/en-us/library/ms740621(VS.85).aspx
176 LPTSTR messageBuffer;
177 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
178 NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
179 ( LPTSTR ) & messageBuffer, 0, NULL );
180 // something has gone wrong here...
181 RAKNET_DEBUG_TPRINTF( _T("setsockopt__(SO_BROADCAST) failed:Error code - %lu\n%s"), dwIOError, messageBuffer );
182 //Free the buffer.
183 LocalFree( messageBuffer );
184 #endif
185 #endif
186
187 }
188
189 }
190
191 #endif
192 }
193
194
195 SLNet::RakString SocketLayer::GetSubNetForSocketAndIp(__UDPSOCKET__ inSock, SLNet::RakString inIpString)
196 {
197 SLNet::RakString netMaskString;
198 SLNet::RakString ipString;
199
200
201
202
203
204 #if defined(WINDOWS_STORE_RT)
205 RakAssert("Not yet supported" && 0);
206 return "";
207 #elif defined(_WIN32)
208 INTERFACE_INFO InterfaceList[20];
209 unsigned long nBytesReturned;
210 if (WSAIoctl(inSock, SIO_GET_INTERFACE_LIST, 0, 0, &InterfaceList,
211 sizeof(InterfaceList), &nBytesReturned, 0, 0) == SOCKET_ERROR) {
212 return "";
213 }
214
215 int nNumInterfaces = nBytesReturned / sizeof(INTERFACE_INFO);
216
217 for (int i = 0; i < nNumInterfaces; ++i)
218 {
219 sockaddr_in *pAddress;
220 pAddress = (sockaddr_in *) & (InterfaceList[i].iiAddress);
221 char ip[65];
222 inet_ntop(pAddress->sin_family, &pAddress->sin_addr, ip, 65);
223 ipString = ip;
224
225 if (inIpString==ipString)
226 {
227 pAddress = (sockaddr_in *) & (InterfaceList[i].iiNetmask);
228 char netmaskIP[65];
229 inet_ntop(pAddress->sin_family, &pAddress->sin_addr, netmaskIP, 65);
230 netMaskString=netmaskIP;
231 return netMaskString;
232 }
233 }
234 return "";
235 #else
236
237 int fd,fd2;
238 fd2 = socket__(AF_INET, SOCK_DGRAM, 0);
239
240 if(fd2 < 0)
241 {
242 return "";
243 }
244
245 struct ifconf ifc;
246 char buf[1999];
247 ifc.ifc_len = sizeof(buf);
248 ifc.ifc_buf = buf;
249 if(ioctl(fd2, SIOCGIFCONF, &ifc) < 0)
250 {
251 close(fd2);
252 return "";
253 }
254
255 struct ifreq *ifr;
256 ifr = ifc.ifc_req;
257 int intNum = ifc.ifc_len / sizeof(struct ifreq);
258 for(int i = 0; i < intNum; i++)
259 {
260 char ip[65];
261 inet_ntop(AF_INET, &((struct sockaddr_in *)&ifr[i].ifr_addr)->sin_addr, ip, 65);
262 ipString = ip;
263
264 if (inIpString==ipString)
265 {
266 struct ifreq ifr2;
267 fd = socket__(AF_INET, SOCK_DGRAM, 0);
268 if(fd < 0)
269 {
270 return "";
271 }
272 ifr2.ifr_addr.sa_family = AF_INET;
273
274 strncpy_s(ifr2.ifr_name, IFNAMSIZ, ifr[i].ifr_name, IFNAMSIZ-1);
275
276 ioctl(fd, SIOCGIFNETMASK, &ifr2);
277
278 close(fd);
279 close(fd2);
280 inet_ntop(AF_INET, &((struct sockaddr_in *)&ifr2.ifr_addr)->sin_addr, ip, 65);
281 netMaskString=ip;
282
283 return netMaskString;
284 }
285 }
286
287 close(fd2);
288 return "";
289
290 #endif
291
292 }
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369 #if defined(WINDOWS_STORE_RT)
370 void GetMyIP_WinRT( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
371 {
372 // Perhaps DatagramSocket.BindEndpointAsynch, use localHostName as an empty string, then query what it bound to?
373 RakAssert("Not yet supported" && 0);
374 }
375 #else
376 void GetMyIP_Win32( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
377 {
378 int idx=0;
379 idx=0;
380 char ac[ 80 ];
381 if ( gethostname( ac, sizeof( ac ) ) == -1 )
382 {
383 #if defined(_WIN32) && !defined(WINDOWS_PHONE_8)
384 DWORD dwIOError = GetLastError();
385 LPTSTR messageBuffer;
386 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
387 NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
388 ( LPTSTR ) & messageBuffer, 0, NULL );
389 // something has gone wrong here...
390 RAKNET_DEBUG_TPRINTF( _T("gethostname failed:Error code - %lu\n%s"), dwIOError, messageBuffer );
391 //Free the buffer.
392 LocalFree( messageBuffer );
393 #endif
394 return ;
395 }
396
397 #if RAKNET_SUPPORT_IPV6==1
398 struct addrinfo hints;
399 struct addrinfo *servinfo=0, *aip; // will point to the results
400 PrepareAddrInfoHints(&hints);
401 getaddrinfo(ac, "", &hints, &servinfo);
402
403 for (idx=0, aip = servinfo; aip != NULL && idx < MAXIMUM_NUMBER_OF_INTERNAL_IDS; aip = aip->ai_next, idx++)
404 {
405 if (aip->ai_family == AF_INET)
406 {
407 struct sockaddr_in *ipv4 = (struct sockaddr_in *)aip->ai_addr;
408 memcpy(&addresses[idx].address.addr4,ipv4,sizeof(sockaddr_in));
409 }
410 else
411 {
412 struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)aip->ai_addr;
413 memcpy(&addresses[idx].address.addr4,ipv6,sizeof(sockaddr_in6));
414 }
415
416 }
417
418 freeaddrinfo(servinfo); // free the linked-list
419 #else
420 struct addrinfo *curAddress = NULL;
421 int err = getaddrinfo(ac, NULL, NULL, &curAddress);
422
423 if ( err != 0 )
424 {
425 #if defined(_WIN32) && !defined(WINDOWS_PHONE_8)
426 int wsaError = WSAGetLastError();
427 LPTSTR messageBuffer;
428 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
429 NULL, wsaError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
430 ( LPTSTR ) & messageBuffer, 0, NULL );
431 // something has gone wrong here...
432 RAKNET_DEBUG_TPRINTF( _T("getaddrinfo failed:Error code - %d\n%s"), wsaError, messageBuffer );
433
434 //Free the buffer.
435 LocalFree( messageBuffer );
436 #endif
437 return ;
438 }
439 while (curAddress != NULL && idx < MAXIMUM_NUMBER_OF_INTERNAL_IDS)
440 {
441 if (curAddress->ai_family == AF_INET) {
442 addresses[idx].address.addr4 = *((struct sockaddr_in *)curAddress->ai_addr);
443 ++idx;
444 }
445 curAddress = curAddress->ai_next;
446 }
447
448 #endif // else RAKNET_SUPPORT_IPV6==1
449
450 while (idx < MAXIMUM_NUMBER_OF_INTERNAL_IDS)
451 {
452 addresses[idx]=UNASSIGNED_SYSTEM_ADDRESS;
453 idx++;
454 }
455 }
456
457 #endif
458
459
460 void SocketLayer::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
461 {
462
463
464
465
466
467
468 #if defined(WINDOWS_STORE_RT)
469 GetMyIP_WinRT(addresses);
470 #elif defined(_WIN32)
471 GetMyIP_Win32(addresses);
472 #else
473 // GetMyIP_Linux(addresses);
474 GetMyIP_Win32(addresses);
475 #endif
476 }
477
478
479 /*
480 unsigned short SocketLayer::GetLocalPort(RakNetSocket *s)
481 {
482 SystemAddress sa;
483 GetSystemAddress(s,&sa);
484 return sa.GetPort();
485 }
486 */
487 unsigned short SocketLayer::GetLocalPort(__UDPSOCKET__ s)
488 {
489 SystemAddress sa;
490 GetSystemAddress(s,&sa);
491 return sa.GetPort();
492 }
493 void SocketLayer::GetSystemAddress_Old ( __UDPSOCKET__ s, SystemAddress *systemAddressOut )
494 {
495 #if defined(__native_client__)
496 *systemAddressOut = UNASSIGNED_SYSTEM_ADDRESS;
497 #else
498 sockaddr_in sa;
499 memset(&sa,0,sizeof(sockaddr_in));
500 socklen_t len = sizeof(sa);
501 if (getsockname__(s, (sockaddr*)&sa, &len)!=0)
502 {
503 #if defined(_WIN32) && defined(_DEBUG) && !defined(WINDOWS_PHONE_8)
504 DWORD dwIOError = GetLastError();
505 LPTSTR messageBuffer;
506 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
507 NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
508 ( LPTSTR ) & messageBuffer, 0, NULL );
509 // something has gone wrong here...
510 RAKNET_DEBUG_TPRINTF( _T("getsockname failed:Error code - %lu\n%s"), dwIOError, messageBuffer );
511
512 //Free the buffer.
513 LocalFree( messageBuffer );
514 #endif
515 *systemAddressOut = UNASSIGNED_SYSTEM_ADDRESS;
516 return;
517 }
518
519 systemAddressOut->SetPortNetworkOrder(sa.sin_port);
520 systemAddressOut->address.addr4.sin_addr.s_addr=sa.sin_addr.s_addr;
521 #endif
522 }
523 /*
524 void SocketLayer::GetSystemAddress_Old ( RakNetSocket *s, SystemAddress *systemAddressOut )
525 {
526 return GetSystemAddress_Old(s->s, systemAddressOut);
527 }
528 */
529 void SocketLayer::GetSystemAddress ( __UDPSOCKET__ s, SystemAddress *systemAddressOut )
530 {
531 #if RAKNET_SUPPORT_IPV6!=1
532 GetSystemAddress_Old(s, systemAddressOut);
533 #else
534 socklen_t slen;
535 sockaddr_storage ss;
536 slen = sizeof(ss);
537
538 if (getsockname__(s, (struct sockaddr *)&ss, &slen)!=0)
539 {
540 #if defined(_WIN32) && defined(_DEBUG)
541 DWORD dwIOError = GetLastError();
542 LPVOID messageBuffer;
543 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
544 NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
545 ( LPTSTR ) & messageBuffer, 0, NULL );
546 // something has gone wrong here...
547 RAKNET_DEBUG_TPRINTF( _T("getsockname failed:Error code - %d\n%s"), dwIOError, static_cast<LPTSTR>(messageBuffer));
548
549 //Free the buffer.
550 LocalFree( messageBuffer );
551 #endif
552 systemAddressOut->FromString(0);
553 return;
554 }
555
556 if (ss.ss_family==AF_INET)
557 {
558 memcpy(&systemAddressOut->address.addr4,(sockaddr_in *)&ss,sizeof(sockaddr_in));
559 systemAddressOut->debugPort=ntohs(systemAddressOut->address.addr4.sin_port);
560
561 uint32_t zero = 0;
562 if (memcmp(&systemAddressOut->address.addr4.sin_addr.s_addr, &zero, sizeof(zero))==0)
563 systemAddressOut->SetToLoopback(4);
564 // systemAddressOut->address.addr4.sin_port=ntohs(systemAddressOut->address.addr4.sin_port);
565 }
566 else
567 {
568 memcpy(&systemAddressOut->address.addr6,(sockaddr_in6 *)&ss,sizeof(sockaddr_in6));
569 systemAddressOut->debugPort=ntohs(systemAddressOut->address.addr6.sin6_port);
570
571 char zero[16];
572 memset(zero,0,sizeof(zero));
573 if (memcmp(&systemAddressOut->address.addr4.sin_addr.s_addr, &zero, sizeof(zero))==0)
574 systemAddressOut->SetToLoopback(6);
575
576 // systemAddressOut->address.addr6.sin6_port=ntohs(systemAddressOut->address.addr6.sin6_port);
577 }
578 #endif // #if RAKNET_SUPPORT_IPV6!=1
579 }
580 /*
581 void SocketLayer::GetSystemAddress ( RakNetSocket *s, SystemAddress *systemAddressOut )
582 {
583 return GetSystemAddress(s->s, systemAddressOut);
584 }
585 */
586
587 // void SocketLayer::SetSocketLayerOverride(SocketLayerOverride *_slo)
588 // {
589 // slo=_slo;
590 // }
591
592 bool SocketLayer::GetFirstBindableIP(char firstBindable[128], int ipProto)
593 {
594 SystemAddress ipList[ MAXIMUM_NUMBER_OF_INTERNAL_IDS ];
595 SocketLayer::GetMyIP( ipList );
596
597
598 if (ipProto==AF_UNSPEC)
599
600 {
601 ipList[0].ToString(false,firstBindable,static_cast<size_t>(128));
602 return true;
603 }
604
605 // Find the first valid host address
606 unsigned int l;
607 for (l=0; l < MAXIMUM_NUMBER_OF_INTERNAL_IDS; l++)
608 {
609 if (ipList[l]==UNASSIGNED_SYSTEM_ADDRESS)
610 break;
611 if (ipList[l].GetIPVersion()==4 && ipProto==AF_INET)
612 break;
613 if (ipList[l].GetIPVersion()==6 && ipProto==AF_INET6)
614 break;
615 }
616
617 if (l==MAXIMUM_NUMBER_OF_INTERNAL_IDS || ipList[l]==UNASSIGNED_SYSTEM_ADDRESS)
618 return false;
619 // RAKNET_DEBUG_PRINTF("%i %i %i %i\n",
620 // ((char*)(&ipList[l].address.addr4.sin_addr.s_addr))[0],
621 // ((char*)(&ipList[l].address.addr4.sin_addr.s_addr))[1],
622 // ((char*)(&ipList[l].address.addr4.sin_addr.s_addr))[2],
623 // ((char*)(&ipList[l].address.addr4.sin_addr.s_addr))[3]
624 // );
625 ipList[l].ToString(false,firstBindable,static_cast<size_t>(128));
626 return true;
627
628 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CCRakNetUDT.cpp Source File

  • src
CCRakNetUDT.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/CCRakNetUDT.h"
17
18 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL!=1
19
20 #include "slikenet/Rand.h"
21 #include "slikenet/MTUSize.h"
22 #include <stdio.h>
23 #include <math.h>
24 #include <stdlib.h>
25 //#include <memory.h>
26 #include "slikenet/assert.h"
27 #include "slikenet/alloca.h"
28
29 using namespace SLNet;
30
31 static const double UNSET_TIME_US=-1;
32 static const double CWND_MIN_THRESHOLD=2.0;
33 static const double UNDEFINED_TRANSFER_RATE=0.0;
38 #if CC_TIME_TYPE_BYTES==4
39 static const CCTimeType SYN=10;
40 #else
41 static const CCTimeType SYN=10000;
42 #endif
43
44 #if CC_TIME_TYPE_BYTES==4
45 #define MAX_RTT 1000
46 #define RTT_TOLERANCE 30
47 #else
48 #define MAX_RTT 1000000
49 #define RTT_TOLERANCE 30000
50 #endif
51
52
53 double RTTVarMultiple=4.0;
54
55
56 // ****************************************************** PUBLIC METHODS ******************************************************
57
58 CCRakNetUDT::CCRakNetUDT()
59 {
60 }
61
62 // ----------------------------------------------------------------------------------------------------------------------------
63
64 CCRakNetUDT::~CCRakNetUDT()
65 {
66 }
67 // ----------------------------------------------------------------------------------------------------------------------------
68 void CCRakNetUDT::Init(CCTimeType curTime, uint32_t maxDatagramPayload)
69 {
70 (void) curTime;
71
72 nextSYNUpdate=0;
73 packetPairRecieptHistoryWriteIndex=0;
74 packetArrivalHistoryWriteIndex=0;
75 packetArrivalHistoryWriteCount=0;
76 RTT=UNSET_TIME_US;
77 // RTTVar=UNSET_TIME_US;
78 isInSlowStart=true;
79 NAKCount=1000;
80 AvgNAKNum=1;
81 DecInterval=1;
82 DecCount=0;
83 nextDatagramSequenceNumber=0;
84 lastPacketPairPacketArrivalTime=0;
85 lastPacketPairSequenceNumber=(DatagramSequenceNumberType)(const uint32_t)-1;
86 lastPacketArrivalTime=0;
87 CWND=CWND_MIN_THRESHOLD;
88 lastUpdateWindowSizeAndAck=0;
89 lastTransmitOfBAndAS=0;
90 ExpCount=1.0;
91 totalUserDataBytesSent=0;
92 oldestUnsentAck=0;
93 MAXIMUM_MTU_INCLUDING_UDP_HEADER=maxDatagramPayload;
94 CWND_MAX_THRESHOLD=RESEND_BUFFER_ARRAY_LENGTH;
95 #if CC_TIME_TYPE_BYTES==4
96 const BytesPerMicrosecond DEFAULT_TRANSFER_RATE=(BytesPerMicrosecond) 3.6;
97 #else
98 const BytesPerMicrosecond DEFAULT_TRANSFER_RATE=(BytesPerMicrosecond) .0036;
99 #endif
100
101 #if CC_TIME_TYPE_BYTES==4
102 lastRttOnIncreaseSendRate=1000;
103 #else
104 lastRttOnIncreaseSendRate=1000000;
105 #endif
106 nextCongestionControlBlock=0;
107 lastRtt=0;
108
109 // B=DEFAULT_TRANSFER_RATE;
110 AS=UNDEFINED_TRANSFER_RATE;
111 const MicrosecondsPerByte DEFAULT_BYTE_INTERVAL=(MicrosecondsPerByte) (1.0/DEFAULT_TRANSFER_RATE);
112 SND=DEFAULT_BYTE_INTERVAL;
113 expectedNextSequenceNumber=0;
114 sendBAndASCount=0;
115 packetArrivalHistoryContinuousGapsIndex=0;
116 //packetPairRecipetHistoryGapsIndex=0;
117 hasWrittenToPacketPairReceiptHistory=false;
118 InitPacketArrivalHistory();
119
120 estimatedLinkCapacityBytesPerSecond=0;
121 bytesCanSendThisTick=0;
122 hadPacketlossThisBlock=false;
123 pingsLastInterval.Clear(__FILE__,__LINE__);
124 }
125 // ----------------------------------------------------------------------------------------------------------------------------
126 void CCRakNetUDT::SetMTU(uint32_t bytes)
127 {
128 MAXIMUM_MTU_INCLUDING_UDP_HEADER=bytes;
129 }
130 // ----------------------------------------------------------------------------------------------------------------------------
131 uint32_t CCRakNetUDT::GetMTU(void) const
132 {
133 return MAXIMUM_MTU_INCLUDING_UDP_HEADER;
134 }
135 // ----------------------------------------------------------------------------------------------------------------------------
136 void CCRakNetUDT::Update(CCTimeType curTime, bool hasDataToSendOrResend)
137 {
138 (void) hasDataToSendOrResend;
139 (void) curTime;
140
141 return;
142
143 // I suspect this is causing major lag
144
145 /*
146 if (hasDataToSendOrResend==false)
147 halveSNDOnNoDataTime=0;
148 else if (halveSNDOnNoDataTime==0)
149 {
150 UpdateHalveSNDOnNoDataTime(curTime);
151 ExpCount=1.0;
152 }
153
154 // If you send, and get no data at all from that time to RTO, then halve send rate7
155 if (HasHalveSNDOnNoDataTimeElapsed(curTime))
156 {
161 // printf("No incoming data, halving send rate\n");
162 SND*=2.0;
163 CapMinSnd(_FILE_AND_LINE_);
164 ExpCount+=1.0;
165 if (ExpCount>8.0)
166 ExpCount=8.0;
167
168 UpdateHalveSNDOnNoDataTime(curTime);
169 }
170 */
171 }
172 // ----------------------------------------------------------------------------------------------------------------------------
173 int CCRakNetUDT::GetRetransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend)
174 {
175 (void) curTime;
176
177 if (isInSlowStart)
178 {
179 uint32_t CWNDLimit = (uint32_t) (CWND*MAXIMUM_MTU_INCLUDING_UDP_HEADER);
180 return CWNDLimit;
181 }
182 return GetTransmissionBandwidth(curTime,timeSinceLastTick,unacknowledgedBytes,isContinuousSend);
183 }
184 // ----------------------------------------------------------------------------------------------------------------------------
185 int CCRakNetUDT::GetTransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend)
186 {
187 (void) curTime;
188
189 if (isInSlowStart)
190 {
191 uint32_t CWNDLimit = (uint32_t) (CWND*MAXIMUM_MTU_INCLUDING_UDP_HEADER-unacknowledgedBytes);
192 return CWNDLimit;
193 }
194 if (bytesCanSendThisTick>0)
195 bytesCanSendThisTick=0;
196
197 #if CC_TIME_TYPE_BYTES==4
198 if (isContinuousSend==false && timeSinceLastTick>100)
199 timeSinceLastTick=100;
200 #else
201 if (isContinuousSend==false && timeSinceLastTick>100000)
202 timeSinceLastTick=100000;
203 #endif
204
205 bytesCanSendThisTick=(int)((double)timeSinceLastTick*((double)1.0/SND)+(double)bytesCanSendThisTick);
206 if (bytesCanSendThisTick>0)
207 return bytesCanSendThisTick;
208 return 0;
209 }
210 uint64_t CCRakNetUDT::GetBytesPerSecondLimitByCongestionControl(void) const
211 {
212 if (isInSlowStart)
213 return 0;
214 #if CC_TIME_TYPE_BYTES==4
215 return (uint64_t) ((double)1.0/(SND*1000.0));
216 #else
217 return (uint64_t) ((double)1.0/(SND*1000000.0));
218 #endif
219 }
220 // ----------------------------------------------------------------------------------------------------------------------------
221 bool CCRakNetUDT::ShouldSendACKs(CCTimeType curTime, CCTimeType estimatedTimeToNextTick)
222 {
223 CCTimeType rto = GetSenderRTOForACK();
224
225 // iphone crashes on comparison between double and int64 http://www.jenkinssoftware.com/forum/index.php?topic=2717.0
226 if (rto==(CCTimeType) UNSET_TIME_US)
227 {
228 // Unknown how long until the remote system will retransmit, so better send right away
229 return true;
230 }
231
232
233 // CCTimeType remoteRetransmitTime=oldestUnsentAck+rto-RTT*.5;
234 // CCTimeType ackArrivalTimeIfWeDelay=RTT*.5+estimatedTimeToNextTick+curTime;
235 // return ackArrivalTimeIfWeDelay<remoteRetransmitTime;
236
237 // Simplified equation
238 // GU: At least one ACK should be sent per SYN, otherwise your protocol will increase slower.
239 return curTime >= oldestUnsentAck + SYN ||
240 estimatedTimeToNextTick+curTime < oldestUnsentAck+rto-RTT;
241 }
242 // ----------------------------------------------------------------------------------------------------------------------------
243 DatagramSequenceNumberType CCRakNetUDT::GetNextDatagramSequenceNumber(void)
244 {
245 return nextDatagramSequenceNumber;
246 }
247 // ----------------------------------------------------------------------------------------------------------------------------
248 DatagramSequenceNumberType CCRakNetUDT::GetAndIncrementNextDatagramSequenceNumber(void)
249 {
250 DatagramSequenceNumberType dsnt=nextDatagramSequenceNumber;
251 nextDatagramSequenceNumber++;
252 return dsnt;
253 }
254 // ----------------------------------------------------------------------------------------------------------------------------
255 void CCRakNetUDT::OnSendBytes(CCTimeType curTime, uint32_t numBytes)
256 {
257 (void) curTime;
258
259 totalUserDataBytesSent+=numBytes;
260 if (isInSlowStart==false)
261 bytesCanSendThisTick-=numBytes;
262 }
263
264 // ****************************************************** PROTECTED METHODS ******************************************************
265
266 void CCRakNetUDT::SetNextSYNUpdate(CCTimeType currentTime)
267 {
268 nextSYNUpdate+=SYN;
269 if (nextSYNUpdate < currentTime)
270 nextSYNUpdate=currentTime+SYN;
271 }
272 // ----------------------------------------------------------------------------------------------------------------------------
273 BytesPerMicrosecond CCRakNetUDT::ReceiverCalculateDataArrivalRate(CCTimeType curTime) const
274 {
275 (void) curTime;
276 // Not an instantaneous measurement
277 /*
278 if (continuousBytesReceivedStartTime!=0 && curTime>continuousBytesReceivedStartTime)
279 {
280 #if CC_TIME_TYPE_BYTES==4
281 const CCTimeType threshold=100;
282 #else
283 const CCTimeType threshold=100000;
284 #endif
285 if (curTime-continuousBytesReceivedStartTime>threshold)
286 return (BytesPerMicrosecond) continuousBytesReceived/(BytesPerMicrosecond) (curTime-continuousBytesReceivedStartTime);
287 }
288
289 return UNDEFINED_TRANSFER_RATE;
290 */
291
292
293 if (packetArrivalHistoryWriteCount<CC_RAKNET_UDT_PACKET_HISTORY_LENGTH)
294 return UNDEFINED_TRANSFER_RATE;
295
296 BytesPerMicrosecond median = ReceiverCalculateDataArrivalRateMedian();
297 int i;
298 const BytesPerMicrosecond oneEighthMedian=median*(1.0/8.0);
299 const BytesPerMicrosecond eightTimesMedian=median*8.0f;
300 BytesPerMicrosecond medianListLength=0.0;
301 BytesPerMicrosecond sum=0.0;
302 // Find average of acceptedMedianValues
303 for (i=0; i < CC_RAKNET_UDT_PACKET_HISTORY_LENGTH; i++)
304 {
305 if (packetArrivalHistory[i]>=oneEighthMedian &&
306 packetArrivalHistory[i]<eightTimesMedian)
307 {
308 medianListLength=medianListLength+1.0;
309 sum+=packetArrivalHistory[i];
310 }
311 }
312 if (medianListLength==0.0)
313 return UNDEFINED_TRANSFER_RATE;
314 return sum/medianListLength;
315 }
316 // ----------------------------------------------------------------------------------------------------------------------------
317 BytesPerMicrosecond CCRakNetUDT::ReceiverCalculateDataArrivalRateMedian(void) const
318 {
319 return CalculateListMedianRecursive(packetArrivalHistory, CC_RAKNET_UDT_PACKET_HISTORY_LENGTH, 0, 0);
320 }
321 // ----------------------------------------------------------------------------------------------------------------------------
322 BytesPerMicrosecond CCRakNetUDT::CalculateListMedianRecursive(const BytesPerMicrosecond inputList[CC_RAKNET_UDT_PACKET_HISTORY_LENGTH], int inputListLength, int lessThanSum, int greaterThanSum)
323 {
324 BytesPerMicrosecond lessThanMedian[CC_RAKNET_UDT_PACKET_HISTORY_LENGTH], greaterThanMedian[CC_RAKNET_UDT_PACKET_HISTORY_LENGTH];
325 int lessThanMedianListLength=0, greaterThanMedianListLength=0;
326 BytesPerMicrosecond median=inputList[0];
327 int i;
328 for (i=1; i < inputListLength; i++)
329 {
330 // If same value, spread among lists evenly
331 if (inputList[i]<median || ((i&1)==0 && inputList[i]==median))
332 lessThanMedian[lessThanMedianListLength++]=inputList[i];
333 else
334 greaterThanMedian[greaterThanMedianListLength++]=inputList[i];
335 }
336 RakAssert(CC_RAKNET_UDT_PACKET_HISTORY_LENGTH%2==0);
337 if (lessThanMedianListLength+lessThanSum==greaterThanMedianListLength+greaterThanSum+1 ||
338 lessThanMedianListLength+lessThanSum==greaterThanMedianListLength+greaterThanSum-1)
339 return median;
340
341 if (lessThanMedianListLength+lessThanSum < greaterThanMedianListLength+greaterThanSum)
342 {
343 lessThanMedian[lessThanMedianListLength++]=median;
344 return CalculateListMedianRecursive(greaterThanMedian, greaterThanMedianListLength, lessThanMedianListLength+lessThanSum, greaterThanSum);
345 }
346 else
347 {
348 greaterThanMedian[greaterThanMedianListLength++]=median;
349 return CalculateListMedianRecursive(lessThanMedian, lessThanMedianListLength, lessThanSum, greaterThanMedianListLength+greaterThanSum);
350 }
351 }
352
353 // ----------------------------------------------------------------------------------------------------------------------------
354 bool CCRakNetUDT::GreaterThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b)
355 {
356 // a > b?
357 const DatagramSequenceNumberType halfSpan =(DatagramSequenceNumberType) (((DatagramSequenceNumberType)(const uint32_t)-1)/(DatagramSequenceNumberType)2);
358 return b!=a && b-a>halfSpan;
359 }
360 // ----------------------------------------------------------------------------------------------------------------------------
361 bool CCRakNetUDT::LessThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b)
362 {
363 // a < b?
364 const DatagramSequenceNumberType halfSpan = ((DatagramSequenceNumberType)(const uint32_t)-1)/(DatagramSequenceNumberType)2;
365 return b!=a && b-a<halfSpan;
366 }
367 // ----------------------------------------------------------------------------------------------------------------------------
368 CCTimeType CCRakNetUDT::GetSenderRTOForACK(void) const
369 {
370 if (RTT==UNSET_TIME_US)
371 return (CCTimeType) UNSET_TIME_US;
372 double RTTVar = maxRTT-minRTT;
373 return (CCTimeType)(RTT + RTTVarMultiple * RTTVar + SYN);
374 }
375 // ----------------------------------------------------------------------------------------------------------------------------
376 CCTimeType CCRakNetUDT::GetRTOForRetransmission(unsigned char timesSent) const
377 {
378 #if CC_TIME_TYPE_BYTES==4
379 const CCTimeType maxThreshold=10000;
380 const CCTimeType minThreshold=100;
381 #else
382 const CCTimeType maxThreshold=1000000;
383 const CCTimeType minThreshold=100000;
384 #endif
385
386 if (RTT==UNSET_TIME_US)
387 {
388 return (CCTimeType) maxThreshold;
389 }
390
391 CCTimeType ret = lastRttOnIncreaseSendRate*2;
392
393 if (ret<minThreshold)
394 return minThreshold;
395 if (ret>maxThreshold)
396 return maxThreshold;
397 return ret;
398 }
399 // ----------------------------------------------------------------------------------------------------------------------------
400 void CCRakNetUDT::OnResend(CCTimeType curTime, SLNet::TimeUS nextActionTime)
401 {
402 (void) curTime;
403
404 if (isInSlowStart)
405 {
406 if (AS!=UNDEFINED_TRANSFER_RATE)
407 EndSlowStart();
408 return;
409 }
410
411 if (hadPacketlossThisBlock==false)
412 {
413 // Logging
414 // printf("Sending SLOWER due to Resend, Rate=%f MBPS. Rtt=%i\n", GetLocalSendRate(), lastRtt );
415
416 IncreaseTimeBetweenSends();
417 hadPacketlossThisBlock=true;
418 }
419 }
420 // ----------------------------------------------------------------------------------------------------------------------------
421 void CCRakNetUDT::OnNAK(CCTimeType curTime, DatagramSequenceNumberType nakSequenceNumber)
422 {
423 (void) nakSequenceNumber;
424 (void) curTime;
425
426 if (isInSlowStart)
427 {
428 if (AS!=UNDEFINED_TRANSFER_RATE)
429 EndSlowStart();
430 return;
431 }
432
433 if (hadPacketlossThisBlock==false)
434 {
435 // Logging
436 //printf("Sending SLOWER due to NAK, Rate=%f MBPS. Rtt=%i\n", GetLocalSendRate(), lastRtt );
437 if (pingsLastInterval.Size()>10)
438 {
439 for (int i=0; i < 10; i++)
440 printf("%i, ", pingsLastInterval[pingsLastInterval.Size()-1-i]/1000);
441 }
442 printf("\n");
443 IncreaseTimeBetweenSends();
444
445 hadPacketlossThisBlock=true;
446 }
447 }
448 // ----------------------------------------------------------------------------------------------------------------------------
449 void CCRakNetUDT::EndSlowStart(void)
450 {
451 RakAssert(isInSlowStart==true);
452 RakAssert(AS!=UNDEFINED_TRANSFER_RATE);
453
454 // This overestimates
455 estimatedLinkCapacityBytesPerSecond=AS * 1000000.0;
456
457 isInSlowStart=false;
458 SND=1.0/AS;
459 CapMinSnd(_FILE_AND_LINE_);
460
461 // printf("ENDING SLOW START\n");
462 #if CC_TIME_TYPE_BYTES==4
463 // printf("Initial SND=%f Kilobytes per second\n", 1.0/SND);
464 #else
465 // printf("Initial SND=%f Megabytes per second\n", 1.0/SND);
466 #endif
467 if (SND > .1)
468 PrintLowBandwidthWarning();
469 }
470 // ----------------------------------------------------------------------------------------------------------------------------
471 void CCRakNetUDT::OnGotPacketPair(DatagramSequenceNumberType datagramSequenceNumber, uint32_t sizeInBytes, CCTimeType curTime)
472 {
473 (void) datagramSequenceNumber;
474 (void) sizeInBytes;
475 (void) curTime;
476
477 }
478 // ----------------------------------------------------------------------------------------------------------------------------
479 bool CCRakNetUDT::OnGotPacket(DatagramSequenceNumberType datagramSequenceNumber, bool isContinuousSend, CCTimeType curTime, uint32_t sizeInBytes, uint32_t *skippedMessageCount)
480 {
481 CC_DEBUG_PRINTF_2("R%i ",datagramSequenceNumber.val);
482
483 if (datagramSequenceNumber==expectedNextSequenceNumber)
484 {
485 *skippedMessageCount=0;
486 expectedNextSequenceNumber=datagramSequenceNumber+(DatagramSequenceNumberType)1;
487 }
488 else if (GreaterThan(datagramSequenceNumber, expectedNextSequenceNumber))
489 {
490 *skippedMessageCount=datagramSequenceNumber-expectedNextSequenceNumber;
491 // Sanity check, just use timeout resend if this was really valid
492 if (*skippedMessageCount>1000)
493 {
494 // During testing, the nat punchthrough server got 51200 on the first packet. I have no idea where this comes from, but has happened twice
495 if (*skippedMessageCount>(uint32_t)50000)
496 return false;
497 *skippedMessageCount=1000;
498 }
499 expectedNextSequenceNumber=datagramSequenceNumber+(DatagramSequenceNumberType)1;
500 }
501 else
502 {
503 *skippedMessageCount=0;
504 }
505
506 if (curTime>lastPacketArrivalTime)
507 {
508 CCTimeType interval = curTime-lastPacketArrivalTime;
509
510 // printf("Packet arrival gap is %I64u\n", (interval));
511
512 if (isContinuousSend)
513 {
514 continuousBytesReceived+=sizeInBytes;
515 if (continuousBytesReceivedStartTime==0)
516 continuousBytesReceivedStartTime=lastPacketArrivalTime;
517
518
519 mostRecentPacketArrivalHistory=(BytesPerMicrosecond)sizeInBytes/(BytesPerMicrosecond)interval;
520
521 // if (mostRecentPacketArrivalHistory < (BytesPerMicrosecond)0.0035)
522 // {
523 // printf("%s:%i LIKELY BUG: Calculated packetArrivalHistory is below 28.8 Kbps modem\nReport to rakkar@jenkinssoftware.com with file and line number\n", _FILE_AND_LINE_);
524 // }
525
526 packetArrivalHistoryContinuousGaps[packetArrivalHistoryContinuousGapsIndex++]=(int) interval;
527 packetArrivalHistoryContinuousGapsIndex&=(CC_RAKNET_UDT_PACKET_HISTORY_LENGTH-1);
528
529 packetArrivalHistoryWriteCount++;
530 packetArrivalHistory[packetArrivalHistoryWriteIndex++]=mostRecentPacketArrivalHistory;
531 // Wrap to 0 at the end of the range
532 // Assumes power of 2 for CC_RAKNET_UDT_PACKET_HISTORY_LENGTH
533 packetArrivalHistoryWriteIndex&=(CC_RAKNET_UDT_PACKET_HISTORY_LENGTH-1);
534 }
535 else
536 {
537 continuousBytesReceivedStartTime=0;
538 continuousBytesReceived=0;
539 }
540
541 lastPacketArrivalTime=curTime;
542 }
543 return true;
544 }
545 // ----------------------------------------------------------------------------------------------------------------------------
546 void CCRakNetUDT::OnAck(CCTimeType curTime, CCTimeType rtt, bool hasBAndAS, BytesPerMicrosecond _B, BytesPerMicrosecond _AS, double totalUserDataBytesAcked, bool isContinuousSend, DatagramSequenceNumberType sequenceNumber )
547 {
548 #if CC_TIME_TYPE_BYTES==4
549 RakAssert(rtt < 10000);
550 #else
551 RakAssert(rtt < 10000000);
552 #endif
553 (void) _B;
554
555 if (hasBAndAS)
556 {
558 // B=B * .875 + _B * .125;
559 // AS is packet arrival rate
560 RakAssert(_AS!=UNDEFINED_TRANSFER_RATE);
561 AS=_AS;
562 CC_DEBUG_PRINTF_4("ArrivalRate=%f linkCap=%f incomingLinkCap=%f\n", _AS,B,_B);
563 }
564
565 if (oldestUnsentAck==0)
566 oldestUnsentAck=curTime;
567
568 if (isInSlowStart==true)
569 {
570 nextCongestionControlBlock=nextDatagramSequenceNumber;
571 lastRttOnIncreaseSendRate=rtt;
572 UpdateWindowSizeAndAckOnAckPreSlowStart(totalUserDataBytesAcked);
573 }
574 else
575 {
576 UpdateWindowSizeAndAckOnAckPerSyn(curTime, rtt, isContinuousSend, sequenceNumber);
577 }
578
579 lastUpdateWindowSizeAndAck=curTime;
580 }
581 // ----------------------------------------------------------------------------------------------------------------------------
582 void CCRakNetUDT::OnSendAckGetBAndAS(CCTimeType curTime, bool *hasBAndAS, BytesPerMicrosecond *_B, BytesPerMicrosecond *_AS)
583 {
584 if (curTime>lastTransmitOfBAndAS+SYN)
585 {
586 *_B=0;
587 *_AS=ReceiverCalculateDataArrivalRate(curTime);
588
589 if (*_AS==UNDEFINED_TRANSFER_RATE)
590 {
591 *hasBAndAS=false;
592 }
593 else
594 {
595 *hasBAndAS=true;
596 }
597 }
598 else
599 {
600 *hasBAndAS=false;
601 }
602 }
603 // ----------------------------------------------------------------------------------------------------------------------------
604 void CCRakNetUDT::OnSendAck(CCTimeType curTime, uint32_t numBytes)
605 {
606 (void) numBytes;
607 (void) curTime;
608
609 // This is not accounted for on the remote system, and thus causes bandwidth to be underutilized
610 //UpdateNextAllowedSend(curTime, numBytes+UDP_HEADER_SIZE);
611
612 oldestUnsentAck=0;
613 }
614 // ----------------------------------------------------------------------------------------------------------------------------
615 void CCRakNetUDT::OnSendNACK(CCTimeType curTime, uint32_t numBytes)
616 {
617 (void) numBytes;
618 (void) curTime;
619
620 // This is not accounted for on the remote system, and thus causes bandwidth to be underutilized
621 // UpdateNextAllowedSend(curTime, numBytes+UDP_HEADER_SIZE);
622 }
623 // ----------------------------------------------------------------------------------------------------------------------------
624 void CCRakNetUDT::UpdateWindowSizeAndAckOnAckPreSlowStart(double totalUserDataBytesAcked)
625 {
626 // During slow start, max window size is the number of full packets that have been sent out
627 // CWND=(double) ((double)totalUserDataBytesSent/(double)MAXIMUM_MTU_INCLUDING_UDP_HEADER);
628 CC_DEBUG_PRINTF_3("CWND increasing from %f to %f\n", CWND, (double) ((double)totalUserDataBytesAcked/(double)MAXIMUM_MTU_INCLUDING_UDP_HEADER));
629 CWND=(double) ((double)totalUserDataBytesAcked/(double)MAXIMUM_MTU_INCLUDING_UDP_HEADER);
630 if (CWND>=CWND_MAX_THRESHOLD)
631 {
632 CWND=CWND_MAX_THRESHOLD;
633
634 if (AS!=UNDEFINED_TRANSFER_RATE)
635 EndSlowStart();
636 }
637 if (CWND<CWND_MIN_THRESHOLD)
638 CWND=CWND_MIN_THRESHOLD;
639 }
640 // ----------------------------------------------------------------------------------------------------------------------------
641 void CCRakNetUDT::UpdateWindowSizeAndAckOnAckPerSyn(CCTimeType curTime, CCTimeType rtt, bool isContinuousSend, DatagramSequenceNumberType sequenceNumber)
642 {
643 (void) curTime;
644 (void) sequenceNumber;
645 if (isContinuousSend==false)
646 {
647 nextCongestionControlBlock=nextDatagramSequenceNumber;
648 pingsLastInterval.Clear(__FILE__,__LINE__);
649 return;
650 }
651
652 pingsLastInterval.Push(rtt,__FILE__,__LINE__);
653 static const int intervalSize=33; // Should be odd
654 if (pingsLastInterval.Size()>intervalSize)
655 pingsLastInterval.Pop();
656 if (GreaterThan(sequenceNumber, nextCongestionControlBlock) &&
657 sequenceNumber-nextCongestionControlBlock>=intervalSize &&
658 pingsLastInterval.Size()==intervalSize)
659 {
660 double slopeSum=0.0;
661 double average=(double) pingsLastInterval[0];
662 int sampleSize=pingsLastInterval.Size();
663 for (int i=1; i < sampleSize; i++)
664 {
665 slopeSum+=(double)pingsLastInterval[i]-(double)pingsLastInterval[i-1];
666 average+=pingsLastInterval[i];
667 }
668 average/=sampleSize;
669
670 if (hadPacketlossThisBlock==true)
671 {
672 }
673 else if (slopeSum < -.10*average)
674 {
675 // Logging
676 //printf("Ping dropping. slope=%f%%. Rate=%f MBPS. Rtt=%i\n", 100.0*slopeSum/average, GetLocalSendRate(), rtt );
677 }
678 else if (slopeSum > .10*average)
679 {
680 // Logging
681 //printf("Ping rising. slope=%f%%. Rate=%f MBPS. Rtt=%i\n", 100.0*slopeSum/average, GetLocalSendRate(), rtt );
682 IncreaseTimeBetweenSends();
683 }
684 else
685 {
686 // Logging
687 //printf("Ping stable. slope=%f%%. Rate=%f MBPS. Rtt=%i\n", 100.0*slopeSum/average, GetLocalSendRate(), rtt );
688
689 // No packetloss over time threshhold, and rtt decreased, so send faster
690 lastRttOnIncreaseSendRate=rtt;
691 DecreaseTimeBetweenSends();
692 }
693
694 pingsLastInterval.Clear(__FILE__,__LINE__);
695 hadPacketlossThisBlock=false;
696 nextCongestionControlBlock=nextDatagramSequenceNumber;
697 }
698
699 lastRtt=rtt;
700 }
701
702 // ----------------------------------------------------------------------------------------------------------------------------
703 double CCRakNetUDT::BytesPerMicrosecondToPacketsPerMillisecond(BytesPerMicrosecond in)
704 {
705 #if CC_TIME_TYPE_BYTES==4
706 const BytesPerMicrosecond factor = 1.0 / (BytesPerMicrosecond) MAXIMUM_MTU_INCLUDING_UDP_HEADER;
707 #else
708 const BytesPerMicrosecond factor = 1000.0 / (BytesPerMicrosecond) MAXIMUM_MTU_INCLUDING_UDP_HEADER;
709 #endif
710 return in * factor;
711 }
712 // ----------------------------------------------------------------------------------------------------------------------------
713 void CCRakNetUDT::InitPacketArrivalHistory(void)
714 {
715 unsigned int i;
716 for (i=0; i < CC_RAKNET_UDT_PACKET_HISTORY_LENGTH; i++)
717 {
718 packetArrivalHistory[i]=UNDEFINED_TRANSFER_RATE;
719 packetArrivalHistoryContinuousGaps[i]=0;
720 }
721
722 packetArrivalHistoryWriteCount=0;
723 continuousBytesReceived=0;
724 continuousBytesReceivedStartTime=0;
725 }
726 // ----------------------------------------------------------------------------------------------------------------------------
727 void CCRakNetUDT::PrintLowBandwidthWarning(void)
728 {
729
730 /*
731 printf("\n-------LOW BANDWIDTH -----\n");
732 if (isInSlowStart==false)
733 printf("SND=%f Megabytes per second\n", 1.0/SND);
734 printf("Window size=%f\n", CWND);
735 printf("Pipe from packet pair = %f megabytes per second\n", B);
736 printf("RTT=%f milliseconds\n", RTT/1000.0);
737 printf("RTT Variance=%f milliseconds\n", RTTVar/1000.0);
738 printf("Retransmission=%i milliseconds\n", GetRTOForRetransmission(1)/1000);
739 printf("Packet arrival rate on the remote system=%f megabytes per second\n", AS);
740 printf("Packet arrival rate on our system=%f megabytes per second\n", ReceiverCalculateDataArrivalRate());
741 printf("isInSlowStart=%i\n", isInSlowStart);
742 printf("---------------\n");
743 */
744 }
745 BytesPerMicrosecond CCRakNetUDT::GetLocalReceiveRate(CCTimeType currentTime) const
746 {
747 return ReceiverCalculateDataArrivalRate(currentTime);
748 }
749 double CCRakNetUDT::GetRTT(void) const
750 {
751 if (RTT==UNSET_TIME_US)
752 return 0.0;
753 return RTT;
754 }
755 void CCRakNetUDT::CapMinSnd(const char *file, int line)
756 {
757 (void) file;
758 (void) line;
759
760 if (SND > 500)
761 {
762 SND=500;
763 CC_DEBUG_PRINTF_3("%s:%i LIKELY BUG: SND has gotten above 500 microseconds between messages (28.8 modem)\nReport to rakkar@jenkinssoftware.com with file and line number\n", file, line);
764 }
765 }
766 void CCRakNetUDT::IncreaseTimeBetweenSends(void)
767 {
768 // In order to converge, bigger numbers have to increase slower and decrease faster
769 // SND==500 then increment is .02
770 // SND==0 then increment is near 0
771 // (SND+1.0) brings it to the range of 1 to 501
772 // Square the number, which is the range of 1 to 251001
773 // Divide by 251001, which is the range of 1/251001 to 1
774
775 double increment;
776 increment = .02 * ((SND+1.0) * (SND+1.0)) / (501.0*501.0) ;
777 // SND=500 then increment=.02
778 // SND=0 then increment=near 0
779 SND*=(1.02 - increment);
780
781 // SND=0 then fast increase, slow decrease
782 // SND=500 then slow increase, fast decrease
783 CapMinSnd(__FILE__,__LINE__);
784 }
785 void CCRakNetUDT::DecreaseTimeBetweenSends(void)
786 {
787 double increment;
788 increment = .01 * ((SND+1.0) * (SND+1.0)) / (501.0*501.0) ;
789 // SND=500 then increment=.01
790 // SND=0 then increment=near 0
791 SND*=(.99 - increment);
792 }
793 /*
794 void CCRakNetUDT::SetTimeBetweenSendsLimit(unsigned int bitsPerSecond)
795 {
796 // bitsPerSecond / 1000000 = bitsPerMicrosecond
797 // bitsPerMicrosecond / 8 = BytesPerMicrosecond
798 // 1 / BytesPerMicrosecond = MicrosecondsPerByte
799 // 1 / ( (bitsPerSecond / 1000000) / 8 ) =
800 // 1 / (bitsPerSecond / 8000000) =
801 // 8000000 / bitsPerSecond
802
803 #if CC_TIME_TYPE_BYTES==4
804 MicrosecondsPerByte limit = (MicrosecondsPerByte) 8000 / (MicrosecondsPerByte)bitsPerSecond;
805 #else
806 MicrosecondsPerByte limit = (MicrosecondsPerByte) 8000000 / (MicrosecondsPerByte)bitsPerSecond;
807 #endif
808 if (limit > SND)
809 SND=limit;
810 }
811 */
812
813 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
  • Cell
DataStructures::Table::Cell Member List

This is the complete list of members for DataStructures::Table::Cell, including all inherited members.

c | DataStructures::Table::Cell
Cell() | DataStructures::Table::Cell
Cell(double numericValue, char *charValue, void *ptr, ColumnType type) | DataStructures::Table::Cell
Cell(const Cell &input) | DataStructures::Table::Cell
Clear(void) | DataStructures::Table::Cell
EstimateColumnType(void) const | DataStructures::Table::Cell
Get(int *output) | DataStructures::Table::Cell
Get(double *output) | DataStructures::Table::Cell
Get(char *output) | DataStructures::Table::Cell
Get(char *output, size_t outputLength) | DataStructures::Table::Cell
Get(char *output, int *outputLength) | DataStructures::Table::Cell
i | DataStructures::Table::Cell
isEmpty | DataStructures::Table::Cell
operator=(const Cell &input) | DataStructures::Table::Cell
ptr | DataStructures::Table::Cell
Set(int input) | DataStructures::Table::Cell
Set(unsigned int input) | DataStructures::Table::Cell
Set(double input) | DataStructures::Table::Cell
Set(const char *input) | DataStructures::Table::Cell
Set(const char *input, int inputLength) | DataStructures::Table::Cell
SetByType(double numericValue, char *charValue, void *inPtr, ColumnType type) | DataStructures::Table::Cell
SetPtr(void *p) | DataStructures::Table::Cell
ToString(ColumnType columnType) | DataStructures::Table::Cell
~Cell() | DataStructures::Table::Cell
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Gets.h Source File

  • include
  • slikenet
Gets.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __GETS__H_
12 #define __GETS__H_
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 char * Gets ( char * str, int num );
19
20 #ifdef __cplusplus
21 }
22 #endif
23
24 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Queue
DataStructures::Queue< queue_type > Member List

This is the complete list of members for DataStructures::Queue< queue_type >, including all inherited members.

AllocationSize(void) const | DataStructures::Queue< queue_type > | inline
Clear(const char *file, unsigned int line) | DataStructures::Queue< queue_type > | inline
ClearAndForceAllocation(int size, const char *file, unsigned int line) | DataStructures::Queue< queue_type > |
Compress(const char *file, unsigned int line) | DataStructures::Queue< queue_type > |
Find(const queue_type &q) | DataStructures::Queue< queue_type > |
IsEmpty(void) const | DataStructures::Queue< queue_type > | inline
operator=(const Queue &original_copy) | DataStructures::Queue< queue_type > |
operator[](unsigned int position) const | DataStructures::Queue< queue_type > | inline
Peek(void) const | DataStructures::Queue< queue_type > | inline
PeekTail(void) const | DataStructures::Queue< queue_type > | inline
Pop(void) | DataStructures::Queue< queue_type > | inline
PopDeref(void) | DataStructures::Queue< queue_type > | inline
PopTail(void) | DataStructures::Queue< queue_type > | inline
Push(const queue_type &input, const char *file, unsigned int line) | DataStructures::Queue< queue_type > |
PushAtHead(const queue_type &input, unsigned index, const char *file, unsigned int line) | DataStructures::Queue< queue_type > |
Queue() | DataStructures::Queue< queue_type > |
Queue(const Queue &original_copy) | DataStructures::Queue< queue_type > |
RemoveAtIndex(unsigned int position) | DataStructures::Queue< queue_type > |
Size(void) const | DataStructures::Queue< queue_type > | inline
~Queue() | DataStructures::Queue< queue_type > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SocketLayer.h Source File

  • include
  • slikenet
SocketLayer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22
23 #ifndef __SOCKET_LAYER_H
24 #define __SOCKET_LAYER_H
25
26 #include "memoryoverride.h"
27 #include "types.h"
28 #include "smartptr.h"
29 //#include "socket.h"
30 #include "Export.h"
31 #include "MTUSize.h"
32 #include "string.h"
33
34 //#include "ClientContextStruct.h"
35
36 namespace SLNet
37 {
39 class RakPeer;
40
41 /*
42 class RAK_DLL_EXPORT SocketLayerOverride
43 {
44 public:
45 SocketLayerOverride() {}
46 virtual ~SocketLayerOverride() {}
47
49 virtual int RakNetSendTo( const char *data, int length, const SystemAddress &systemAddress )=0;
50
52 // Return -1 to use RakNet's normal recvfrom, 0 to abort RakNet's normal recvfrom, and positive to return data
53 virtual int RakNetRecvFrom( char dataOut[ MAXIMUM_MTU_SIZE ], SystemAddress *senderOut, bool calledFromMainThread )=0;
54 };
55 */
56
57 // A platform independent implementation of Berkeley sockets, with settings used by RakNet
58 class RAK_DLL_EXPORT SocketLayer
59 {
60
61 public:
62
64 SocketLayer();
65
66 // Destructor
67 ~SocketLayer();
68
69 /*
74 static RakNetSocket* CreateBoundSocket( RakPeer *peer, unsigned short port, bool blockingSocket, const char *forceHostAddress, unsigned int sleepOn10048, unsigned int extraSocketOptions, unsigned short socketFamily, _PP_Instance_ chromeInstance );
75 #if defined(WINDOWS_STORE_RT)
76 static RakNetSocket* CreateWindowsStore8Socket( RakPeer *peer, unsigned short port, bool blockingSocket, const char *forceHostAddress, unsigned int sleepOn10048, unsigned int extraSocketOptions, _PP_Instance_ chromeInstance );
77 #endif
78 static RakNetSocket* CreateBoundSocket_IPV4( RakPeer *peer, unsigned short port, bool blockingSocket, const char *forceHostAddress, unsigned int sleepOn10048, unsigned int extraSocketOptions, _PP_Instance_ chromeInstance );
79 #if RAKNET_SUPPORT_IPV6==1
80 static RakNetSocket* CreateBoundSocket_SupportIPV4And6( RakPeer *peer, unsigned short port, bool blockingSocket, const char *forceHostAddress, unsigned int sleepOn10048, unsigned int extraSocketOptions, unsigned short socketFamily, _PP_Instance_ chromeInstance );
81 #endif
82 static RakNetSocket* CreateBoundSocket_PS3Lobby( unsigned short port, bool blockingSocket, const char *forceHostAddress, unsigned short socketFamily );
83 static RakNetSocket* CreateBoundSocket_PSP2( unsigned short port, bool blockingSocket, const char *forceHostAddress, unsigned short socketFamily );
84 */
85
86 /*
87 #ifndef WINDOWS_STORE_RT
91 //static bool IsPortInUse_Old(unsigned short port, const char *hostAddress);
92 //static bool IsPortInUse(unsigned short port, const char *hostAddress, unsigned short socketFamily );
93 static bool IsSocketFamilySupported(const char *hostAddress, unsigned short socketFamily);
94 #endif
95 */
96
97 // static const char* DomainNameToIP_Old( const char *domainName );
98 // static const char* DomainNameToIP( const char *domainName );
99
104 // static void Write( RakNetSocket*writeSocket, const char* data, const int length );
105
112 // static void RecvFromBlocking_IPV4( RakNetSocket *s, RakPeer *rakPeer, char *dataOut, int *bytesReadOut, SystemAddress *systemAddressOut, SLNet::TimeUS *timeRead );
113 // #if RAKNET_SUPPORT_IPV6==1
114 // static void RecvFromBlockingIPV4And6( RakNetSocket *s, RakPeer *rakPeer, char *dataOut, int *bytesReadOut, SystemAddress *systemAddressOut, SLNet::TimeUS *timeRead );
115 // #endif
116 // static void RecvFromBlocking( RakNetSocket *s, RakPeer *rakPeer, char *dataOut, int *bytesReadOut, SystemAddress *systemAddressOut, SLNet::TimeUS *timeRead );
117 #if defined(WINDOWS_STORE_RT)
118 // static void RecvFromBlocking_WindowsStore8( RakNetSocket *s, RakPeer *rakPeer, char *dataOut, int *bytesReadOut, SystemAddress *systemAddressOut, SLNet::TimeUS *timeRead );
119 #endif
120
125 static SLNet::RakString GetSubNetForSocketAndIp(__UDPSOCKET__ inSock, SLNet::RakString inIpString);
126
127
130 // static void SetNonBlocking( RakNetSocket* listenSocket);
131
132
136 static void GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
137
138
146 // static int SendTo( UDPSOCKET s, const char *data, int length, const char ip[ 16 ], unsigned short port, unsigned short remotePortRakNetWasStartedOn_PS3, unsigned int extraSocketOptions, const char *file, const long line );
147
158 // static int SendToTTL( RakNetSocket *s, const char *data, int length, SystemAddress &systemAddress, int ttl );
159
167 // static int SendTo( RakNetSocket *s, const char *data, int length, SystemAddress systemAddress, const char *file, const long line );
168
169 // static unsigned short GetLocalPort(RakNetSocket *s);
170 static unsigned short GetLocalPort( __UDPSOCKET__ s);
171 // static void GetSystemAddress_Old ( RakNetSocket *s, SystemAddress *systemAddressOut );
172 static void GetSystemAddress_Old ( __UDPSOCKET__ s, SystemAddress *systemAddressOut );
173 // static void GetSystemAddress ( RakNetSocket *s, SystemAddress *systemAddressOut );
174 static void GetSystemAddress ( __UDPSOCKET__ s, SystemAddress *systemAddressOut );
175
176 // static void SetSocketLayerOverride(SocketLayerOverride *_slo);
177 // static SocketLayerOverride* GetSocketLayerOverride(void) {return slo;}
178
179 // static int SendTo_PS3Lobby( RakNetSocket *s, const char *data, int length, const SystemAddress &systemAddress );
180 // static int SendTo_PSP2( RakNetSocket *s, const char *data, int length, const SystemAddress &systemAddress );
181 // static int SendTo_360( RakNetSocket *s, const char *data, int length, const char *voiceData, int voiceLength, const SystemAddress &systemAddress );
182 // static int SendTo_PC( RakNetSocket *s, const char *data, int length, const SystemAddress &systemAddress, const char *file, const long line );
183 // #if defined(WINDOWS_STORE_RT)
184 // static int SendTo_WindowsStore8( RakNetSocket *s, const char *data, int length, const SystemAddress &systemAddress, const char *file, const long line );
185 // #endif
186 //
187 // static void SetDoNotFragment( RakNetSocket* listenSocket, int opt );
188 // static void SetSocketOptions( RakNetSocket* listenSocket, bool blockingSocket, bool setBroadcast);
189 static void SetSocketOptions( __UDPSOCKET__ listenSocket, bool blockingSocket, bool setBroadcast);
190
191
192 // AF_INET (default). For IPV6, use AF_INET6. To autoselect, use AF_UNSPEC.
193 static bool GetFirstBindableIP(char firstBindable[128], int ipProto);
194
195 private:
196
197 // static SocketLayerOverride *slo;
198 };
199
200 } // namespace SLNet
201
202 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileOperations.h Source File

  • include
  • slikenet
FileOperations.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
13
14
15 #include "NativeFeatureIncludes.h"
16 #if _RAKNET_SUPPORT_FileOperations==1
17
18 #ifndef __FILE_OPERATIONS_H
19 #define __FILE_OPERATIONS_H
20
21 #include "Export.h"
22
23 bool RAK_DLL_EXPORT WriteFileWithDirectories( const char *path, char *data, unsigned dataLength );
24 bool RAK_DLL_EXPORT IsSlash(unsigned char c);
25 void RAK_DLL_EXPORT AddSlash( char *input );
26 void RAK_DLL_EXPORT QuoteIfSpaces(char *str);
27 bool RAK_DLL_EXPORT DirectoryExists(const char *directory);
28 unsigned int RAK_DLL_EXPORT GetFileLength(const char *path);
29
30 #endif
31
32 #endif // _RAKNET_SUPPORT_FileOperations
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/StatisticsHistory.cpp Source File

  • src
StatisticsHistory.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_StatisticsHistory==1
18
19 #include "slikenet/StatisticsHistory.h"
20 #include "slikenet/GetTime.h"
21 #include "slikenet/statistics.h"
22 #include "slikenet/peerinterface.h"
23
24 using namespace SLNet;
25
26 STATIC_FACTORY_DEFINITIONS(StatisticsHistory,StatisticsHistory);
27 STATIC_FACTORY_DEFINITIONS(StatisticsHistoryPlugin,StatisticsHistoryPlugin);
28
29 int StatisticsHistory::TrackedObjectComp( const uint64_t &key, StatisticsHistory::TrackedObject* const &data )
30 {
31 if (key < data->trackedObjectData.objectId)
32 return -1;
33 if (key == data->trackedObjectData.objectId)
34 return 0;
35 return 1;
36 }
37
38 int TimeAndValueQueueCompAsc( StatisticsHistory::TimeAndValueQueue* const &key, StatisticsHistory::TimeAndValueQueue* const &data )
39 {
40 if (key->sortValue < data->sortValue)
41 return -1;
42 if (key->sortValue > data->sortValue)
43 return 1;
44 if (key->key < data->key)
45 return -1;
46 if (key->key > data->key)
47 return 1;
48 return 0;
49 }
50
51 int TimeAndValueQueueCompDesc( StatisticsHistory::TimeAndValueQueue* const &key, StatisticsHistory::TimeAndValueQueue* const &data )
52 {
53 if (key->sortValue > data->sortValue)
54 return -1;
55 if (key->sortValue < data->sortValue)
56 return 1;
57 if (key->key > data->key)
58 return -1;
59 if (key->key < data->key)
60 return 1;
61 return 0;
62 }
63 StatisticsHistory::TrackedObjectData::TrackedObjectData() {}
64 StatisticsHistory::TrackedObjectData::TrackedObjectData(uint64_t _objectId, int _objectType, void *_userData)
65 {
66 objectId=_objectId;
67 objectType=_objectType;
68 userData=_userData;
69 }
70 StatisticsHistory::StatisticsHistory() {timeToTrack = 30000;}
71 StatisticsHistory::~StatisticsHistory()
72 {
73 Clear();
74 }
75 void StatisticsHistory::SetDefaultTimeToTrack(Time defaultTimeToTrack) {timeToTrack = defaultTimeToTrack;}
76 Time StatisticsHistory::GetDefaultTimeToTrack(void) const {return timeToTrack;}
77 bool StatisticsHistory::AddObject(TrackedObjectData tod)
78 {
79 bool objectExists;
80 unsigned int idx = objects.GetIndexFromKey(tod.objectId, &objectExists);
81 if (objectExists)
82 return false;
83 TrackedObject *to = SLNet::OP_NEW<TrackedObject>(_FILE_AND_LINE_);
84 to->trackedObjectData=tod;
85 objects.InsertAtIndex(to,idx,_FILE_AND_LINE_);
86 return true;
87 }
88 bool StatisticsHistory::RemoveObject(uint64_t objectId, void **userData)
89 {
90 unsigned int idx = GetObjectIndex(objectId);
91 if (idx == (unsigned int) -1)
92 return false;
93 if (userData)
94 *userData = objects[idx]->trackedObjectData.userData;
95 RemoveObjectAtIndex(idx);
96 return true;
97 }
98 void StatisticsHistory::RemoveObjectAtIndex(unsigned int index)
99 {
100 TrackedObject *to = objects[index];
101 objects.RemoveAtIndex(index);
102 SLNet::OP_DELETE(to, _FILE_AND_LINE_);
103 }
104 void StatisticsHistory::Clear(void)
105 {
106 for (unsigned int idx=0; idx < objects.Size(); idx++)
107 {
108 SLNet::OP_DELETE(objects[idx], _FILE_AND_LINE_);
109 }
110 objects.Clear(false, _FILE_AND_LINE_);
111 }
112 unsigned int StatisticsHistory::GetObjectCount(void) const {return objects.Size();}
113 StatisticsHistory::TrackedObjectData * StatisticsHistory::GetObjectAtIndex(unsigned int index) const {return &objects[index]->trackedObjectData;}
114 bool StatisticsHistory::AddValueByObjectID(uint64_t objectId, RakString key, SHValueType val, Time curTime, bool combineEqualTimes)
115 {
116 unsigned int idx = GetObjectIndex(objectId);
117 if (idx == (unsigned int) -1)
118 return false;
119 AddValueByIndex(idx, key, val, curTime, combineEqualTimes);
120 return true;
121 }
122 void StatisticsHistory::AddValueByIndex(unsigned int index, RakString key, SHValueType val, Time curTime, bool combineEqualTimes)
123 {
124 TimeAndValueQueue *queue;
125 TrackedObject *to = objects[index];
126 DataStructures::HashIndex hi = to->dataQueues.GetIndexOf(key);
127 if (hi.IsInvalid())
128 {
129 queue = SLNet::OP_NEW<TimeAndValueQueue>(_FILE_AND_LINE_);
130 queue->key=key;
131 queue->timeToTrackValues = timeToTrack;
132 to->dataQueues.Push(key, queue, _FILE_AND_LINE_);
133 }
134 else
135 {
136 queue = to->dataQueues.ItemAtIndex(hi);
137 }
138
139 TimeAndValue tav;
140 if (combineEqualTimes==true && queue->values.Size()>0 && queue->values.PeekTail().time==curTime)
141 {
142 tav = queue->values.PopTail();
143
144 queue->recentSum -= tav.val;
145 queue->recentSumOfSquares -= tav.val * tav.val;
146 queue->longTermSum -= tav.val;
147 queue->longTermCount = queue->longTermCount - 1;
148 }
149 else
150 {
151 tav.val=0.0;
152 tav.time=curTime;
153 }
154
155 tav.val+=val;
156 queue->values.Push(tav, _FILE_AND_LINE_);
157
158 queue->recentSum += tav.val;
159 queue->recentSumOfSquares += tav.val * tav.val;
160 queue->longTermSum += tav.val;
161 queue->longTermCount = queue->longTermCount + 1;
162 if (queue->longTermLowest > tav.val)
163 queue->longTermLowest = tav.val;
164 if (queue->longTermHighest < tav.val)
165 queue->longTermHighest = tav.val;
166 }
167 StatisticsHistory::SHErrorCode StatisticsHistory::GetHistoryForKey(uint64_t objectId, RakString key, StatisticsHistory::TimeAndValueQueue **values, Time curTime) const
168 {
169 if (values == 0)
170 return SH_INVALID_PARAMETER;
171
172 unsigned int idx = GetObjectIndex(objectId);
173 if (idx == (unsigned int) -1)
174 return SH_UKNOWN_OBJECT;
175 TrackedObject *to = objects[idx];
176 DataStructures::HashIndex hi = to->dataQueues.GetIndexOf(key);
177 if (hi.IsInvalid())
178 return SH_UKNOWN_KEY;
179 *values = to->dataQueues.ItemAtIndex(hi);
180 (*values)->CullExpiredValues(curTime);
181 return SH_OK;
182 }
183 bool StatisticsHistory::GetHistorySorted(uint64_t objectId, SHSortOperation sortType, DataStructures::List<StatisticsHistory::TimeAndValueQueue *> &values) const
184 {
185 unsigned int idx = GetObjectIndex(objectId);
186 if (idx == (unsigned int) -1)
187 return false;
188 TrackedObject *to = objects[idx];
189 DataStructures::List<TimeAndValueQueue*> itemList;
190 DataStructures::List<RakString> keyList;
191 to->dataQueues.GetAsList(itemList,keyList,_FILE_AND_LINE_);
192 Time curTime = GetTime();
193
194 DataStructures::OrderedList<TimeAndValueQueue*, TimeAndValueQueue*,TimeAndValueQueueCompAsc> sortedQueues;
195 for (unsigned int i=0; i < itemList.Size(); i++)
196 {
197 TimeAndValueQueue *tavq = itemList[i];
198 tavq->CullExpiredValues(curTime);
199
200 if (sortType == SH_SORT_BY_RECENT_SUM_ASCENDING || sortType == SH_SORT_BY_RECENT_SUM_DESCENDING)
201 tavq->sortValue = tavq->GetRecentSum();
202 else if (sortType == SH_SORT_BY_LONG_TERM_SUM_ASCENDING || sortType == SH_SORT_BY_LONG_TERM_SUM_DESCENDING)
203 tavq->sortValue = tavq->GetLongTermSum();
204 else if (sortType == SH_SORT_BY_RECENT_SUM_OF_SQUARES_ASCENDING || sortType == SH_SORT_BY_RECENT_SUM_OF_SQUARES_DESCENDING)
205 tavq->sortValue = tavq->GetRecentSumOfSquares();
206 else if (sortType == SH_SORT_BY_RECENT_AVERAGE_ASCENDING || sortType == SH_SORT_BY_RECENT_AVERAGE_DESCENDING)
207 tavq->sortValue = tavq->GetRecentAverage();
208 else if (sortType == SH_SORT_BY_LONG_TERM_AVERAGE_ASCENDING || sortType == SH_SORT_BY_LONG_TERM_AVERAGE_DESCENDING)
209 tavq->sortValue = tavq->GetLongTermAverage();
210 else if (sortType == SH_SORT_BY_RECENT_HIGHEST_ASCENDING || sortType == SH_SORT_BY_RECENT_HIGHEST_DESCENDING)
211 tavq->sortValue = tavq->GetRecentHighest();
212 else if (sortType == SH_SORT_BY_RECENT_LOWEST_ASCENDING || sortType == SH_SORT_BY_RECENT_LOWEST_DESCENDING)
213 tavq->sortValue = tavq->GetRecentLowest();
214 else if (sortType == SH_SORT_BY_LONG_TERM_HIGHEST_ASCENDING || sortType == SH_SORT_BY_LONG_TERM_HIGHEST_DESCENDING)
215 tavq->sortValue = tavq->GetLongTermHighest();
216 else
217 tavq->sortValue = tavq->GetLongTermLowest();
218
219 if (
220 sortType == SH_SORT_BY_RECENT_SUM_ASCENDING ||
221 sortType == SH_SORT_BY_LONG_TERM_SUM_ASCENDING ||
222 sortType == SH_SORT_BY_RECENT_SUM_OF_SQUARES_ASCENDING ||
223 sortType == SH_SORT_BY_RECENT_AVERAGE_ASCENDING ||
224 sortType == SH_SORT_BY_LONG_TERM_AVERAGE_ASCENDING ||
225 sortType == SH_SORT_BY_RECENT_HIGHEST_ASCENDING ||
226 sortType == SH_SORT_BY_RECENT_LOWEST_ASCENDING ||
227 sortType == SH_SORT_BY_LONG_TERM_HIGHEST_ASCENDING ||
228 sortType == SH_SORT_BY_LONG_TERM_LOWEST_ASCENDING)
229 sortedQueues.Insert(tavq, tavq, false, _FILE_AND_LINE_, TimeAndValueQueueCompAsc);
230 else
231 sortedQueues.Insert(tavq, tavq, false, _FILE_AND_LINE_, TimeAndValueQueueCompDesc);
232 }
233
234 for (unsigned int i=0; i < sortedQueues.Size(); i++)
235 values.Push(sortedQueues[i], _FILE_AND_LINE_);
236 return true;
237 }
238 void StatisticsHistory::MergeAllObjectsOnKey(RakString key, TimeAndValueQueue *tavqOutput, SHDataCategory dataCategory) const
239 {
240 tavqOutput->Clear();
241
242 Time curTime = GetTime();
243
244 // Find every object with this key
245 for (unsigned int idx=0; idx < objects.Size(); idx++)
246 {
247 TrackedObject *to = objects[idx];
248 DataStructures::HashIndex hi = to->dataQueues.GetIndexOf(key);
249 if (hi.IsInvalid()==false)
250 {
251 TimeAndValueQueue *tavqInput = to->dataQueues.ItemAtIndex(hi);
252 tavqInput->CullExpiredValues(curTime);
253 TimeAndValueQueue::MergeSets(tavqOutput, dataCategory, tavqInput, dataCategory, tavqOutput);
254 }
255 }
256 }
257 void StatisticsHistory::GetUniqueKeyList(DataStructures::List<RakString> &keys)
258 {
259 keys.Clear(true, _FILE_AND_LINE_);
260
261 for (unsigned int idx=0; idx < objects.Size(); idx++)
262 {
263 TrackedObject *to = objects[idx];
264 DataStructures::List<TimeAndValueQueue*> itemList;
265 DataStructures::List<SLNet::RakString> keyList;
266 to->dataQueues.GetAsList(itemList, keyList, _FILE_AND_LINE_);
267 for (unsigned int k=0; k < keyList.Size(); k++)
268 {
269 bool hasKey=false;
270 for (unsigned int j=0; j < keys.Size(); j++)
271 {
272 if (keys[j]==keyList[k])
273 {
274 hasKey=true;
275 break;
276 }
277 }
278
279 if (hasKey==false)
280 keys.Push(keyList[k], _FILE_AND_LINE_);
281 }
282 }
283 }
284 StatisticsHistory::TimeAndValueQueue::TimeAndValueQueue()
285 {
286 Clear();
287 }
288 StatisticsHistory::TimeAndValueQueue::~TimeAndValueQueue(){}
289 void StatisticsHistory::TimeAndValueQueue::SetTimeToTrackValues(Time t)
290 {
291 timeToTrackValues = t;
292 }
293 Time StatisticsHistory::TimeAndValueQueue::GetTimeToTrackValues(void) const {return timeToTrackValues;}
294 SHValueType StatisticsHistory::TimeAndValueQueue::GetRecentSum(void) const {return recentSum;}
295 SHValueType StatisticsHistory::TimeAndValueQueue::GetRecentSumOfSquares(void) const {return recentSumOfSquares;}
296 SHValueType StatisticsHistory::TimeAndValueQueue::GetLongTermSum(void) const {return longTermSum;}
297 SHValueType StatisticsHistory::TimeAndValueQueue::GetRecentAverage(void) const
298 {
299 if (values.Size() > 0)
300 return recentSum / (SHValueType) values.Size();
301 else
302 return 0;
303 }
304 SHValueType StatisticsHistory::TimeAndValueQueue::GetRecentLowest(void) const
305 {
306 SHValueType out = SH_TYPE_MAX;
307 for (unsigned int idx=0; idx < values.Size(); idx++)
308 {
309 if (values[idx].val < out)
310 out = values[idx].val;
311 }
312 return out;
313 }
314 SHValueType StatisticsHistory::TimeAndValueQueue::GetRecentHighest(void) const
315 {
316 SHValueType out = -SH_TYPE_MAX;
317 for (unsigned int idx=0; idx < values.Size(); idx++)
318 {
319 if (values[idx].val > out)
320 out = values[idx].val;
321 }
322 return out;
323 }
324 SHValueType StatisticsHistory::TimeAndValueQueue::GetRecentStandardDeviation(void) const
325 {
326 if (values.Size()==0)
327 return 0;
328
329 SHValueType recentMean= GetRecentAverage();
330 SHValueType squareOfMean = recentMean * recentMean;
331 SHValueType meanOfSquares = GetRecentSumOfSquares() / (SHValueType) values.Size();
332 return meanOfSquares - squareOfMean;
333 }
334 SHValueType StatisticsHistory::TimeAndValueQueue::GetLongTermAverage(void) const
335 {
336 if (longTermCount == 0)
337 return 0;
338 return longTermSum / longTermCount;
339 }
340 SHValueType StatisticsHistory::TimeAndValueQueue::GetLongTermLowest(void) const {return longTermLowest;}
341 SHValueType StatisticsHistory::TimeAndValueQueue::GetLongTermHighest(void) const {return longTermHighest;}
342 Time StatisticsHistory::TimeAndValueQueue::GetTimeRange(void) const
343 {
344 if (values.Size()<2)
345 return 0;
346 return values[values.Size()-1].time - values[0].time;
347 }
348 SHValueType StatisticsHistory::TimeAndValueQueue::GetSumSinceTime(Time t) const
349 {
350 SHValueType sum = 0;
351 for (int i=values.Size(); i > 0; --i)
352 {
353 if (values[i-1].time>=t)
354 sum+=values[i-1].val;
355 }
356 return sum;
357 }
358 void StatisticsHistory::TimeAndValueQueue::MergeSets( const TimeAndValueQueue *lhs, SHDataCategory lhsDataCategory, const TimeAndValueQueue *rhs, SHDataCategory rhsDataCategory, TimeAndValueQueue *output )
359 {
360 // Two ways to merge:
361 // 1. Treat rhs as just more data points.
362 // 1A. Sums are just added. If two values have the same time, just put in queue twice
363 // 1B. longTermLowest and longTermHighest are the lowest and highest of the two sets
364 //
365 // 2. Add by time. If time for the other set is missing, calculate slope to extrapolate
366 // 2A. Have to recalculate recentSum, recentSumOfSquares.
367 // 2B. longTermSum, longTermCount, longTermLowest, longTermHighest are unknown
368
369 if (lhs!=output)
370 {
371 output->key = lhs->key;
372 output->timeToTrackValues = lhs->timeToTrackValues;
373 }
374 else
375 {
376 output->key = rhs->key;
377 output->timeToTrackValues = rhs->timeToTrackValues;
378 }
379
380 unsigned int lhsIndex, rhsIndex;
381 lhsIndex=0;
382 rhsIndex=0;
383
384 // I use local valuesOutput in case lhs==output || rhs==output
385 DataStructures::Queue<TimeAndValue> valuesOutput;
386
387 if (lhsDataCategory==StatisticsHistory::DC_DISCRETE && rhsDataCategory==StatisticsHistory::DC_DISCRETE)
388 {
389 while (rhsIndex < rhs->values.Size() && lhsIndex < lhs->values.Size())
390 {
391 if (rhs->values[rhsIndex].time < lhs->values[lhsIndex].time)
392 {
393 valuesOutput.Push(rhs->values[rhsIndex], _FILE_AND_LINE_ );
394 rhsIndex++;
395 }
396 else if (rhs->values[rhsIndex].time > lhs->values[lhsIndex].time)
397 {
398 valuesOutput.Push(lhs->values[rhsIndex], _FILE_AND_LINE_ );
399 lhsIndex++;
400 }
401 else
402 {
403 valuesOutput.Push(rhs->values[rhsIndex], _FILE_AND_LINE_ );
404 rhsIndex++;
405 valuesOutput.Push(lhs->values[rhsIndex], _FILE_AND_LINE_ );
406 lhsIndex++;
407 }
408 }
409
410 while (rhsIndex < rhs->values.Size())
411 {
412 valuesOutput.Push(rhs->values[rhsIndex], _FILE_AND_LINE_ );
413 rhsIndex++;
414 }
415 while (lhsIndex < lhs->values.Size())
416 {
417 valuesOutput.Push(lhs->values[lhsIndex], _FILE_AND_LINE_ );
418 lhsIndex++;
419 }
420
421 output->recentSum = lhs->recentSum + rhs->recentSum;
422 output->recentSumOfSquares = lhs->recentSumOfSquares + rhs->recentSumOfSquares;
423 output->longTermSum = lhs->longTermSum + rhs->longTermSum;
424 output->longTermCount = lhs->longTermCount + rhs->longTermCount;
425 if (lhs->longTermLowest < rhs->longTermLowest)
426 output->longTermLowest = lhs->longTermLowest;
427 else
428 output->longTermLowest = rhs->longTermLowest;
429 if (lhs->longTermHighest > rhs->longTermHighest)
430 output->longTermHighest = lhs->longTermHighest;
431 else
432 output->longTermHighest = rhs->longTermHighest;
433 }
434 else
435 {
436 TimeAndValue lastTimeAndValueLhs, lastTimeAndValueRhs;
437 lastTimeAndValueLhs.time=0;
438 lastTimeAndValueLhs.val=0;
439 lastTimeAndValueRhs.time=0;
440 lastTimeAndValueRhs.val=0;
441 SHValueType lastSlopeLhs=0;
442 SHValueType lastSlopeRhs=0;
443 Time timeSinceOppositeValue;
444
445 TimeAndValue newTimeAndValue;
446
447 while (rhsIndex < rhs->values.Size() && lhsIndex < lhs->values.Size())
448 {
449 if (rhs->values[rhsIndex].time < lhs->values[lhsIndex].time)
450 {
451 timeSinceOppositeValue = rhs->values[rhsIndex].time - lastTimeAndValueLhs.time;
452 newTimeAndValue.val = rhs->values[rhsIndex].val + lastTimeAndValueLhs.val + lastSlopeLhs * timeSinceOppositeValue;
453 newTimeAndValue.time = rhs->values[rhsIndex].time;
454 lastTimeAndValueRhs = rhs->values[rhsIndex];
455 if (rhsIndex>0 && rhs->values[rhsIndex].time != rhs->values[rhsIndex-1].time && rhsDataCategory==StatisticsHistory::DC_CONTINUOUS)
456 lastSlopeRhs = (rhs->values[rhsIndex].val - rhs->values[rhsIndex-1].val) / (SHValueType) (rhs->values[rhsIndex].time - rhs->values[rhsIndex-1].time);
457 rhsIndex++;
458 }
459 else if (lhs->values[lhsIndex].time < rhs->values[rhsIndex].time)
460 {
461 timeSinceOppositeValue = lhs->values[lhsIndex].time - lastTimeAndValueRhs.time;
462 newTimeAndValue.val = lhs->values[lhsIndex].val + lastTimeAndValueRhs.val + lastSlopeRhs * timeSinceOppositeValue;
463 newTimeAndValue.time = lhs->values[lhsIndex].time;
464 lastTimeAndValueLhs = lhs->values[lhsIndex];
465 if (lhsIndex>0 && lhs->values[lhsIndex].time != lhs->values[lhsIndex-1].time && lhsDataCategory==StatisticsHistory::DC_CONTINUOUS)
466 lastSlopeLhs = (lhs->values[lhsIndex].val - lhs->values[lhsIndex-1].val) / (SHValueType) (lhs->values[lhsIndex].time - lhs->values[lhsIndex-1].time);
467 lhsIndex++;
468 }
469 else
470 {
471 newTimeAndValue.val = lhs->values[lhsIndex].val + rhs->values[rhsIndex].val;
472 newTimeAndValue.time = lhs->values[lhsIndex].time;
473 lastTimeAndValueRhs = rhs->values[rhsIndex];
474 lastTimeAndValueLhs = lhs->values[lhsIndex];
475 if (rhsIndex>0 && rhs->values[rhsIndex].time != rhs->values[rhsIndex-1].time && rhsDataCategory==StatisticsHistory::DC_CONTINUOUS)
476 lastSlopeRhs = (rhs->values[rhsIndex].val - rhs->values[rhsIndex-1].val) / (SHValueType) (rhs->values[rhsIndex].time - rhs->values[rhsIndex-1].time);
477 if (lhsIndex>0 && lhs->values[lhsIndex].time != lhs->values[lhsIndex-1].time && lhsDataCategory==StatisticsHistory::DC_CONTINUOUS)
478 lastSlopeLhs = (lhs->values[lhsIndex].val - lhs->values[lhsIndex-1].val) / (SHValueType) (lhs->values[lhsIndex].time - lhs->values[lhsIndex-1].time);
479 lhsIndex++;
480 rhsIndex++;
481 }
482
483 valuesOutput.Push(newTimeAndValue, _FILE_AND_LINE_ );
484 }
485
486 while (rhsIndex < rhs->values.Size())
487 {
488 timeSinceOppositeValue = rhs->values[rhsIndex].time - lastTimeAndValueLhs.time;
489 newTimeAndValue.val = rhs->values[rhsIndex].val + lastTimeAndValueLhs.val + lastSlopeLhs * timeSinceOppositeValue;
490 newTimeAndValue.time = rhs->values[rhsIndex].time;
491 valuesOutput.Push(newTimeAndValue, _FILE_AND_LINE_ );
492 rhsIndex++;
493 }
494 while (lhsIndex < lhs->values.Size())
495 {
496 timeSinceOppositeValue = lhs->values[lhsIndex].time - lastTimeAndValueRhs.time;
497 newTimeAndValue.val = lhs->values[lhsIndex].val + lastTimeAndValueRhs.val + lastSlopeRhs * timeSinceOppositeValue;
498 newTimeAndValue.time = lhs->values[lhsIndex].time;
499 valuesOutput.Push(newTimeAndValue, _FILE_AND_LINE_ );
500 lhsIndex++;
501 }
502
503 output->recentSum = 0;
504 output->recentSumOfSquares = 0;
505 for (unsigned int i=0; i < valuesOutput.Size(); i++)
506 {
507 output->recentSum += valuesOutput[i].val;
508 output->recentSumOfSquares += valuesOutput[i].val * valuesOutput[i].val;
509 }
510 }
511
512 output->values = valuesOutput;
513 }
514 void StatisticsHistory::TimeAndValueQueue::ResizeSampleSet( int maxSamples, DataStructures::Queue<StatisticsHistory::TimeAndValue> &histogram, SHDataCategory dataCategory, Time timeClipStart, Time timeClipEnd )
515 {
516 histogram.Clear(_FILE_AND_LINE_);
517 if (maxSamples==0)
518 return;
519 Time timeRange = GetTimeRange();
520 if (timeRange==0)
521 return;
522 if (maxSamples==1)
523 {
524 StatisticsHistory::TimeAndValue tav;
525 tav.time = timeRange;
526 tav.val = GetRecentSum();
527 histogram.Push(tav, _FILE_AND_LINE_);
528 return;
529 }
530 Time interval = timeRange / maxSamples;
531 if (interval==0)
532 interval=1;
533 unsigned int dataIndex;
534 Time timeBoundary;
535 StatisticsHistory::TimeAndValue currentSum;
536 Time currentTime;
537 SHValueType numSamples;
538 Time endTime;
539
540 numSamples=0;
541 endTime = values[values.Size()-1].time;
542 dataIndex=0;
543 currentTime=values[0].time;
544 currentSum.val=0;
545 currentSum.time=values[0].time + interval / 2;
546 timeBoundary = values[0].time + interval;
547 while (timeBoundary <= endTime)
548 {
549 while (dataIndex < values.Size() && values[dataIndex].time <= timeBoundary)
550 {
551 currentSum.val += values[dataIndex].val;
552 dataIndex++;
553 numSamples++;
554 }
555
556 if (dataCategory==DC_CONTINUOUS)
557 {
558 if (dataIndex > 0 &&
559 dataIndex < values.Size() &&
560 values[dataIndex-1].time < timeBoundary &&
561 values[dataIndex].time > timeBoundary)
562 {
563 SHValueType interpolatedValue = Interpolate(values[dataIndex-1], values[dataIndex], timeBoundary);
564 currentSum.val+=interpolatedValue;
565 numSamples++;
566 }
567
568 if (numSamples > 1)
569 {
570 currentSum.val /= numSamples;
571 }
572 }
573
574 histogram.Push(currentSum, _FILE_AND_LINE_);
575 currentSum.time=timeBoundary + interval / 2;
576 timeBoundary += interval;
577 currentSum.val=0;
578 numSamples=0;
579 }
580
581
582 if ( timeClipStart!=0 && histogram.Size()>=1)
583 {
584 timeClipStart = histogram.Peek().time+timeClipStart;
585 if (histogram.PeekTail().time < timeClipStart)
586 {
587 histogram.Clear(_FILE_AND_LINE_);
588 }
589 else if (histogram.Size()>=2 && histogram.Peek().time < timeClipStart)
590 {
591 StatisticsHistory::TimeAndValue tav;
592
593 do
594 {
595 tav = histogram.Pop();
596
597 if (histogram.Peek().time == timeClipStart)
598 {
599 break;
600 }
601 else if (histogram.Peek().time > timeClipStart)
602 {
603 StatisticsHistory::TimeAndValue tav2;
604 tav2.val = StatisticsHistory::TimeAndValueQueue::Interpolate(tav, histogram.Peek(), timeClipStart);
605 tav2.time=timeClipStart;
606 histogram.PushAtHead(tav2, 0, _FILE_AND_LINE_);
607 break;
608 }
609 } while (histogram.Size()>=2);
610 }
611 }
612
613 if ( timeClipEnd!=0 && histogram.Size()>=1)
614 {
615 timeClipEnd = histogram.PeekTail().time-timeClipEnd;
616 if (histogram.Peek().time > timeClipEnd)
617 {
618 histogram.Clear(_FILE_AND_LINE_);
619 }
620 else if (histogram.Size()>=2 && histogram.PeekTail().time > timeClipEnd)
621 {
622 StatisticsHistory::TimeAndValue tav;
623
624 do
625 {
626 tav = histogram.PopTail();
627
628 if (histogram.PeekTail().time == timeClipEnd)
629 {
630 break;
631 }
632 else if (histogram.PeekTail().time < timeClipEnd)
633 {
634 StatisticsHistory::TimeAndValue tav2;
635 tav2.val = StatisticsHistory::TimeAndValueQueue::Interpolate(tav, histogram.PeekTail(), timeClipEnd);
636 tav2.time=timeClipEnd;
637 histogram.Push(tav2, _FILE_AND_LINE_);
638 break;
639 }
640 } while (histogram.Size()>=2);
641 }
642 }
643 }
644 void StatisticsHistory::TimeAndValueQueue::CullExpiredValues(Time curTime)
645 {
646 while (values.Size())
647 {
648 StatisticsHistory::TimeAndValue tav = values.Peek();
649 if (curTime - tav.time > timeToTrackValues)
650 {
651 recentSum -= tav.val;
652 recentSumOfSquares -= tav.val * tav.val;
653 values.Pop();
654 }
655 else
656 {
657 break;
658 }
659 }
660 }
661 SHValueType StatisticsHistory::TimeAndValueQueue::Interpolate(StatisticsHistory::TimeAndValue t1, StatisticsHistory::TimeAndValue t2, Time time)
662 {
663 if (t2.time==t1.time)
664 return (t1.val + t2.val) / 2;
665 // if (t2.time > t1.time)
666 // {
667 SHValueType slope = (t2.val - t1.val) / ((SHValueType) t2.time - (SHValueType) t1.time);
668 return t1.val + slope * ((SHValueType) time - (SHValueType) t1.time);
669 // }
670 // else
671 // {
672 // SHValueType slope = (t1.val - t2.val) / (SHValueType) (t1.time - t2.time);
673 // return t2.val + slope * (SHValueType) (time - t2.time);
674 // }
675 }
676 void StatisticsHistory::TimeAndValueQueue::Clear(void)
677 {
678 recentSum = 0;
679 recentSumOfSquares = 0;
680 longTermSum = 0;
681 longTermCount = 0;
682 longTermLowest = SH_TYPE_MAX;
683 longTermHighest = -SH_TYPE_MAX;
684 values.Clear(_FILE_AND_LINE_);
685 }
686 StatisticsHistory::TimeAndValueQueue& StatisticsHistory::TimeAndValueQueue::operator = ( const TimeAndValueQueue& input )
687 {
688 values=input.values;
689 timeToTrackValues=input.timeToTrackValues;
690 key=input.key;
691 recentSum=input.recentSum;
692 recentSumOfSquares=input.recentSumOfSquares;
693 longTermSum=input.longTermSum;
694 longTermCount=input.longTermCount;
695 longTermLowest=input.longTermLowest;
696 longTermHighest=input.longTermHighest;
697 return *this;
698 }
699 StatisticsHistory::TrackedObject::TrackedObject() {}
700 StatisticsHistory::TrackedObject::~TrackedObject()
701 {
702 DataStructures::List<StatisticsHistory::TimeAndValueQueue*> itemList;
703 DataStructures::List<RakString> keyList;
704 for (unsigned int idx=0; idx < itemList.Size(); idx++)
705 SLNet::OP_DELETE(itemList[idx], _FILE_AND_LINE_);
706 }
707 unsigned int StatisticsHistory::GetObjectIndex(uint64_t objectId) const
708 {
709 bool objectExists;
710 unsigned int idx = objects.GetIndexFromKey(objectId, &objectExists);
711 if (objectExists)
712 return idx;
713 return (unsigned int) -1;
714 }
715 StatisticsHistoryPlugin::StatisticsHistoryPlugin()
716 {
717 addNewConnections = true;
718 removeLostConnections = true;
719 newConnectionsObjectType = 0;
720 }
721 StatisticsHistoryPlugin::~StatisticsHistoryPlugin()
722 {
723 }
724 void StatisticsHistoryPlugin::SetTrackConnections(bool _addNewConnections, int _newConnectionsObjectType, bool _removeLostConnections)
725 {
726 addNewConnections = _addNewConnections;
727 removeLostConnections = _removeLostConnections;
728 newConnectionsObjectType = _newConnectionsObjectType;
729 }
730 void StatisticsHistoryPlugin::Update(void)
731 {
732 DataStructures::List<SystemAddress> addresses;
733 DataStructures::List<RakNetGUID> guids;
734 DataStructures::List<RakNetStatistics> stats;
735 rakPeerInterface->GetStatisticsList(addresses, guids, stats);
736
737 Time curTime = GetTime();
738 for (unsigned int idx = 0; idx < guids.Size(); idx++)
739 {
740 unsigned int objectIndex = statistics.GetObjectIndex(guids[idx].g);
741 if (objectIndex!=(unsigned int)-1)
742 {
743 statistics.AddValueByIndex(objectIndex,
744 "RN_ACTUAL_BYTES_SENT",
745 (SHValueType) stats[idx].valueOverLastSecond[ACTUAL_BYTES_SENT],
746 curTime, false);
747
748 statistics.AddValueByIndex(objectIndex,
749 "RN_USER_MESSAGE_BYTES_RESENT",
750 (SHValueType) stats[idx].valueOverLastSecond[USER_MESSAGE_BYTES_RESENT],
751 curTime, false);
752
753 statistics.AddValueByIndex(objectIndex,
754 "RN_ACTUAL_BYTES_RECEIVED",
755 (SHValueType) stats[idx].valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
756 curTime, false);
757
758 statistics.AddValueByIndex(objectIndex,
759 "RN_USER_MESSAGE_BYTES_PUSHED",
760 (SHValueType) stats[idx].valueOverLastSecond[USER_MESSAGE_BYTES_PUSHED],
761 curTime, false);
762
763 statistics.AddValueByIndex(objectIndex,
764 "RN_USER_MESSAGE_BYTES_RECEIVED_PROCESSED",
765 (SHValueType) stats[idx].valueOverLastSecond[USER_MESSAGE_BYTES_RECEIVED_PROCESSED],
766 curTime, false);
767
768 statistics.AddValueByIndex(objectIndex,
769 "RN_lastPing",
770 (SHValueType) rakPeerInterface->GetLastPing(guids[idx]),
771 curTime, false);
772
773 statistics.AddValueByIndex(objectIndex,
774 "RN_bytesInResendBuffer",
775 (SHValueType) stats[idx].bytesInResendBuffer,
776 curTime, false);
777
778 statistics.AddValueByIndex(objectIndex,
779 "RN_packetlossLastSecond",
780 (SHValueType) stats[idx].packetlossLastSecond,
781 curTime, false);
782 }
783
784 }
785
786 /*
787 RakNetStatistics rns;
788 DataStructures::List<SystemAddress> addresses;
789 DataStructures::List<RakNetGUID> guids;
790 rakPeerInterface->GetSystemList(addresses, guids);
791 for (unsigned int idx = 0; idx < guids.Size(); idx++)
792 {
793 rakPeerInterface->GetStatistics(remoteSystems[idx], &rns);
794 statistics.AddValue();
795
796 bool AddValue(uint64_t objectId, RakString key, SHValueType val, Time curTime);
797
798 }
799 */
800 }
801 /*
802 void StatisticsHistoryPlugin::OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
803 {
804 // Would have to use GetGuidFromSystemAddress for every send
805 }
806 void StatisticsHistoryPlugin::OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
807 {
808 }
809 */
810 void StatisticsHistoryPlugin::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
811 {
812 (void) lostConnectionReason;
813 (void) systemAddress;
814
815 if (removeLostConnections)
816 {
817 statistics.RemoveObject(rakNetGUID.g, 0);
818 }
819 }
820 void StatisticsHistoryPlugin::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
821 {
822 (void) systemAddress;
823 (void) isIncoming;
824
825 if (addNewConnections)
826 {
827 statistics.AddObject(StatisticsHistory::TrackedObjectData(rakNetGUID.g, newConnectionsObjectType, 0));
828 }
829 }
830 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
831
832 #endif // _RAKNET_SUPPORT_StatisticsHistory==1
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/VariadicSQLParser.cpp Source File

  • src
VariadicSQLParser.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/VariadicSQLParser.h"
17 #include "slikenet/BitStream.h"
18 #include <stdarg.h>
19
20 using namespace VariadicSQLParser;
21
22 struct TypeMapping
23 {
24 char inputType;
25 const char *type;
26 };
27 const int NUM_TYPE_MAPPINGS=7;
28 TypeMapping typeMappings[NUM_TYPE_MAPPINGS] =
29 {
30 {'i', "int"},
31 {'d', "int"},
32 {'s', "text"},
33 {'b', "bool"},
34 {'f', "numeric"},
35 {'g', "double precision"},
36 {'a', "bytea"},
37 };
38 unsigned int GetTypeMappingIndex(char c)
39 {
40 unsigned int i;
41 for (i=0; i < (unsigned int) NUM_TYPE_MAPPINGS; i++ )
42 if (typeMappings[i].inputType==c)
43 return i;
44 return (unsigned int)-1;
45 }
46 const char* VariadicSQLParser::GetTypeMappingAtIndex(int i)
47 {
48 return typeMappings[i].type;
49 }
50 void VariadicSQLParser::GetTypeMappingIndices( const char *format, DataStructures::List<IndexAndType> &indices )
51 {
52 bool previousCharWasPercentSign;
53 unsigned int i;
54 unsigned int typeMappingIndex;
55 indices.Clear(false, _FILE_AND_LINE_);
56 unsigned int len = (unsigned int) strlen(format);
57 previousCharWasPercentSign=false;
58 for (i=0; i < len; i++)
59 {
60 if (previousCharWasPercentSign==true )
61 {
62 typeMappingIndex = GetTypeMappingIndex(format[i]);
63 if (typeMappingIndex!=(unsigned int) -1)
64 {
65 IndexAndType iat;
66 iat.strIndex=i-1;
67 iat.typeMappingIndex=typeMappingIndex;
68 indices.Insert(iat, _FILE_AND_LINE_ );
69 }
70 }
71
72 previousCharWasPercentSign=format[i]=='%';
73 }
74 }
75 void VariadicSQLParser::ExtractArguments( va_list argptr, const DataStructures::List<IndexAndType> &indices, char ***argumentBinary, int **argumentLengths )
76 {
77 if (indices.Size()==0)
78 return;
79
80 unsigned int i;
81 *argumentBinary= SLNet::OP_NEW_ARRAY<char *>(indices.Size(), _FILE_AND_LINE_);
82 *argumentLengths= SLNet::OP_NEW_ARRAY<int>(indices.Size(), _FILE_AND_LINE_);
83
84 char **paramData=*argumentBinary;
85 int *paramLength=*argumentLengths;
86
87 int variadicArgIndex;
88 for (variadicArgIndex=0, i=0; i < indices.Size(); i++, variadicArgIndex++)
89 {
90 switch (typeMappings[indices[i].typeMappingIndex].inputType)
91 {
92 case 'i':
93 case 'd':
94 {
95 int val = va_arg( argptr, int );
96 paramLength[i]=sizeof(val);
97 paramData[i]=(char*) rakMalloc_Ex(paramLength[i], _FILE_AND_LINE_);
98 memcpy(paramData[i], &val, paramLength[i]);
99 if (SLNet::BitStream::IsNetworkOrder()==false) SLNet::BitStream::ReverseBytesInPlace((unsigned char*) paramData[i], paramLength[i]);
100 }
101 break;
102 case 's':
103 {
104 char* val = va_arg( argptr, char* );
105 paramLength[i]=(int) strlen(val);
106 paramData[i]=(char*) rakMalloc_Ex(paramLength[i]+1, _FILE_AND_LINE_);
107 memcpy(paramData[i], val, paramLength[i]+1);
108 }
109 break;
110 case 'b':
111 {
112 bool val = (va_arg( argptr, int )!=0);
113 paramLength[i]=sizeof(val);
114 paramData[i]=(char*) rakMalloc_Ex(paramLength[i], _FILE_AND_LINE_);
115 memcpy(paramData[i], &val, paramLength[i]);
116 if (SLNet::BitStream::IsNetworkOrder()==false) SLNet::BitStream::ReverseBytesInPlace((unsigned char*) paramData[i], paramLength[i]);
117 }
118 break;
119 /*
120 case 'f':
121 {
122 // On MSVC at least, this only works with double as the 2nd param
123 float val = (float) va_arg( argptr, double );
124 //float val = va_arg( argptr, float );
125 paramLength[i]=sizeof(val);
126 paramData[i]=(char*) rakMalloc_Ex(paramLength[i], _FILE_AND_LINE_);
127 memcpy(paramData[i], &val, paramLength[i]);
128 if (SLNet::BitStream::IsNetworkOrder()==false) SLNet::BitStream::ReverseBytesInPlace((unsigned char*) paramData[i], paramLength[i]);
129 }
130 break;
131 */
132 // On MSVC at least, this only works with double as the 2nd param
133 case 'f':
134 case 'g':
135 {
136 double val = va_arg( argptr, double );
137 paramLength[i]=sizeof(val);
138 paramData[i]=(char*) rakMalloc_Ex(paramLength[i], _FILE_AND_LINE_);
139 memcpy(paramData[i], &val, paramLength[i]);
140 if (SLNet::BitStream::IsNetworkOrder()==false) SLNet::BitStream::ReverseBytesInPlace((unsigned char*) paramData[i], paramLength[i]);
141 }
142 break;
143 case 'a':
144 {
145 char* val = va_arg( argptr, char* );
146 paramLength[i]=va_arg( argptr, unsigned int );
147 paramData[i]=(char*) rakMalloc_Ex(paramLength[i], _FILE_AND_LINE_);
148 memcpy(paramData[i], val, paramLength[i]);
149 }
150 break;
151 }
152 }
153
154 }
155 void VariadicSQLParser::FreeArguments(const DataStructures::List<IndexAndType> &indices, char **argumentBinary, int *argumentLengths)
156 {
157 if (indices.Size()==0)
158 return;
159
160 unsigned int i;
161 for (i=0; i < indices.Size(); i++)
162 rakFree_Ex(argumentBinary[i],_FILE_AND_LINE_);
163 SLNet::OP_DELETE_ARRAY(argumentBinary,_FILE_AND_LINE_);
164 SLNet::OP_DELETE_ARRAY(argumentLengths,_FILE_AND_LINE_);
165 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/defines.h Source File

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


SLikeNet: Source/include/slikenet/DS_OrderedChannelHeap.h Source File

  • include
  • slikenet
DS_OrderedChannelHeap.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __RAKNET_ORDERED_CHANNEL_HEAP_H
23 #define __RAKNET_ORDERED_CHANNEL_HEAP_H
24
25 #include "DS_Heap.h"
26 #include "DS_Map.h"
27 #include "DS_Queue.h"
28 #include "Export.h"
29 #include "assert.h"
30 #include "Rand.h"
31
34 namespace DataStructures
35 {
36 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)=defaultMapKeyComparison<channel_key_type> >
37 class RAK_DLL_EXPORT OrderedChannelHeap
38 {
39 public:
40 static void IMPLEMENT_DEFAULT_COMPARISON(void) {DataStructures::defaultMapKeyComparison<channel_key_type>(channel_key_type(),channel_key_type());}
41
42 OrderedChannelHeap();
43 ~OrderedChannelHeap();
44 void Push(const channel_key_type &channelID, const heap_data_type &data);
45 void PushAtHead(const unsigned index, const channel_key_type &channelID, const heap_data_type &data);
46 heap_data_type Pop(const unsigned startingIndex=0);
47 heap_data_type Peek(const unsigned startingIndex) const;
48 void AddChannel(const channel_key_type &channelID, const double weight);
49 void RemoveChannel(channel_key_type channelID);
50 void Clear(void);
51 heap_data_type& operator[] ( const unsigned int position ) const;
52 unsigned ChannelSize(const channel_key_type &channelID);
53 unsigned Size(void) const;
54
55 struct QueueAndWeight
56 {
57 DataStructures::Queue<double> randResultQueue;
58 double weight;
59 bool signalDeletion;
60 };
61
62 struct HeapChannelAndData
63 {
64 HeapChannelAndData() {}
65 HeapChannelAndData(const channel_key_type &_channel, const heap_data_type &_data) : data(_data), channel(_channel) {}
66 heap_data_type data;
67 channel_key_type channel;
68 };
69
70 protected:
71 DataStructures::Map<channel_key_type, QueueAndWeight*, channel_key_comparison_func> map;
72 DataStructures::Heap<double, HeapChannelAndData, true> heap;
73 void GreatestRandResult(void);
74 };
75
76 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
77 OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::OrderedChannelHeap()
78 {
79 }
80
81 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
82 OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::~OrderedChannelHeap()
83 {
84 Clear();
85 }
86
87 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
88 void OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::Push(const channel_key_type &channelID, const heap_data_type &data)
89 {
90 PushAtHead(MAX_UNSIGNED_LONG, channelID, data);
91 }
92
93 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
94 void OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::GreatestRandResult(void)
95 {
96 double greatest;
97 unsigned i;
98 greatest=0.0;
99 for (i=0; i < map.Size(); i++)
100 {
101 if (map[i]->randResultQueue.Size() && map[i]->randResultQueue[0]>greatest)
102 greatest=map[i]->randResultQueue[0];
103 }
104 return greatest;
105 }
106
107 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
108 void OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::PushAtHead(const unsigned index, const channel_key_type &channelID, const heap_data_type &data)
109 {
110 // If an assert hits here then this is an unknown channel. Call AddChannel first.
111 QueueAndWeight *queueAndWeight=map.Get(channelID);
112 double maxRange, minRange, rnd;
113 if (queueAndWeight->randResultQueue.Size()==0)
114 {
115 // Set maxRange to the greatest random number waiting to be returned, rather than 1.0 necessarily
116 // This is so weights are scaled similarly among channels. For example, if the head weight for a used channel was .25
117 // and then we added another channel, the new channel would need to choose between .25 and 0
118 // If we chose between 1.0 and 0, it would be 1/.25 (4x) more likely to be at the head of the heap than it should be
119 maxRange=GreatestRandResult();
120 if (maxRange==0.0)
121 maxRange=1.0;
122 minRange=0.0;
123 }
124 else if (index >= queueAndWeight->randResultQueue.Size())
125 {
126 maxRange=queueAndWeight->randResultQueue[queueAndWeight->randResultQueue.Size()-1]*.99999999;
127 minRange=0.0;
128 }
129 else
130 {
131 if (index==0)
132 {
133 maxRange=GreatestRandResult();
134 if (maxRange==queueAndWeight->randResultQueue[0])
135 maxRange=1.0;
136 }
137 else if (index >= queueAndWeight->randResultQueue.Size())
138 maxRange=queueAndWeight->randResultQueue[queueAndWeight->randResultQueue.Size()-1]*.99999999;
139 else
140 maxRange=queueAndWeight->randResultQueue[index-1]*.99999999;
141
142 minRange=maxRange=queueAndWeight->randResultQueue[index]*1.00000001;
143 }
144
145 #ifdef _DEBUG
146 RakAssert(maxRange!=0.0);
147 #endif
148 rnd=frandomMT() * (maxRange - minRange);
149 if (rnd==0.0)
150 rnd=maxRange/2.0;
151
152 if (index >= queueAndWeight->randResultQueue.Size())
153 queueAndWeight->randResultQueue.Push(rnd);
154 else
155 queueAndWeight->randResultQueue.PushAtHead(rnd, index);
156
157 heap.Push(rnd*queueAndWeight->weight, HeapChannelAndData(channelID, data));
158 }
159
160 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
161 heap_data_type OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::Pop(const unsigned startingIndex)
162 {
163 RakAssert(startingIndex < heap.Size());
164
165 QueueAndWeight *queueAndWeight=map.Get(heap[startingIndex].channel);
166 if (startingIndex!=0)
167 {
168 // Ugly - have to count in the heap how many nodes have the same channel, so we know where to delete from in the queue
169 unsigned indiceCount=0;
170 unsigned i;
171 for (i=0; i < startingIndex; i++)
172 if (channel_key_comparison_func(heap[i].channel,heap[startingIndex].channel)==0)
173 indiceCount++;
174 queueAndWeight->randResultQueue.RemoveAtIndex(indiceCount);
175 }
176 else
177 {
178 // TODO - ordered channel heap uses progressively lower values as items are inserted. But this won't give relative ordering among channels. I have to renormalize after every pop.
179 queueAndWeight->randResultQueue.Pop();
180 }
181
182 // Try to remove the channel after every pop, because doing so is not valid while there are elements in the list.
183 if (queueAndWeight->signalDeletion)
184 RemoveChannel(heap[startingIndex].channel);
185
186 return heap.Pop(startingIndex).data;
187 }
188
189 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
190 heap_data_type OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::Peek(const unsigned startingIndex) const
191 {
192 HeapChannelAndData heapChannelAndData = heap.Peek(startingIndex);
193 return heapChannelAndData.data;
194 }
195
196 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
197 void OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::AddChannel(const channel_key_type &channelID, const double weight)
198 {
199 QueueAndWeight *qaw = SLNet::OP_NEW<QueueAndWeight>( _FILE_AND_LINE_ );
200 qaw->weight=weight;
201 qaw->signalDeletion=false;
202 map.SetNew(channelID, qaw);
203 }
204
205 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
206 void OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::RemoveChannel(channel_key_type channelID)
207 {
208 if (map.Has(channelID))
209 {
210 unsigned i;
211 i=map.GetIndexAtKey(channelID);
212 if (map[i]->randResultQueue.Size()==0)
213 {
214 SLNet::OP_DELETE(map[i], _FILE_AND_LINE_);
215 map.RemoveAtIndex(i);
216 }
217 else
218 {
219 // Signal this channel for deletion later, because the heap has nodes with this channel right now
220 map[i]->signalDeletion=true;
221 }
222 }
223 }
224
225 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
226 unsigned OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::Size(void) const
227 {
228 return heap.Size();
229 }
230
231 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
232 heap_data_type& OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::operator[]( const unsigned int position ) const
233 {
234 return heap[position].data;
235 }
236
237
238 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
239 unsigned OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::ChannelSize(const channel_key_type &channelID)
240 {
241 QueueAndWeight *queueAndWeight=map.Get(channelID);
242 return queueAndWeight->randResultQueue.Size();
243 }
244
245 template <class channel_key_type, class heap_data_type, int (*channel_key_comparison_func)(const channel_key_type&, const channel_key_type&)>
246 void OrderedChannelHeap<channel_key_type, heap_data_type, channel_key_comparison_func>::Clear(void)
247 {
248 unsigned i;
249 for (i=0; i < map.Size(); i++)
250 SLNet::OP_DELETE(map[i], _FILE_AND_LINE_);
251 map.Clear(_FILE_AND_LINE_);
252 heap.Clear(_FILE_AND_LINE_);
253 }
254 }
255
256 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • CircularLinkedList
DataStructures::CircularLinkedList< CircularLinkedListType > Member List

This is the complete list of members for DataStructures::CircularLinkedList< CircularLinkedListType >, including all inherited members.

Add(const CircularLinkedListType &input) | DataStructures::CircularLinkedList< CircularLinkedListType > |
Beginning(void) | DataStructures::CircularLinkedList< CircularLinkedListType > | inline
CircularLinkedList() | DataStructures::CircularLinkedList< CircularLinkedListType > |
CircularLinkedList(const CircularLinkedList &original_copy) | DataStructures::CircularLinkedList< CircularLinkedListType > |
Clear(void) | DataStructures::CircularLinkedList< CircularLinkedListType > |
Concatenate(const CircularLinkedList &L) | DataStructures::CircularLinkedList< CircularLinkedListType > | inline
Del(void) | DataStructures::CircularLinkedList< CircularLinkedListType > |
End(void) | DataStructures::CircularLinkedList< CircularLinkedListType > | inline
Find(const CircularLinkedListType &input) | DataStructures::CircularLinkedList< CircularLinkedListType > |
FindPointer(const CircularLinkedListType &input) | DataStructures::CircularLinkedList< CircularLinkedListType > | protected
Insert(const CircularLinkedListType &input) | DataStructures::CircularLinkedList< CircularLinkedListType > |
IsIn(const CircularLinkedListType &input) | DataStructures::CircularLinkedList< CircularLinkedListType > |
list_size | DataStructures::CircularLinkedList< CircularLinkedListType > | protected
operator++() | DataStructures::CircularLinkedList< CircularLinkedListType > |
operator++(int) | DataStructures::CircularLinkedList< CircularLinkedListType > |
operator--() | DataStructures::CircularLinkedList< CircularLinkedListType > |
operator--(int) | DataStructures::CircularLinkedList< CircularLinkedListType > |
operator=(const CircularLinkedList &original_copy) | DataStructures::CircularLinkedList< CircularLinkedListType > |
Peek(void) | DataStructures::CircularLinkedList< CircularLinkedListType > | inline
Pop(void) | DataStructures::CircularLinkedList< CircularLinkedListType > |
position | DataStructures::CircularLinkedList< CircularLinkedListType > | protected
Replace(const CircularLinkedListType &input) | DataStructures::CircularLinkedList< CircularLinkedListType > | inline
root | DataStructures::CircularLinkedList< CircularLinkedListType > | protected
Size(void) | DataStructures::CircularLinkedList< CircularLinkedListType > | inline
Sort(void) | DataStructures::CircularLinkedList< CircularLinkedListType > | inline
~CircularLinkedList() | DataStructures::CircularLinkedList< CircularLinkedListType > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/MessageFilter.h Source File

  • include
  • slikenet
MessageFilter.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_MessageFilter==1
22
23 #ifndef __MESSAGE_FILTER_PLUGIN_H
24 #define __MESSAGE_FILTER_PLUGIN_H
25
26 #include "types.h"
27 #include "PluginInterface2.h"
28 #include "DS_OrderedList.h"
29 #include "DS_Hash.h"
30 #include "Export.h"
31
33 #define MESSAGE_FILTER_MAX_MESSAGE_ID 256
34
35 namespace SLNet
36 {
38 class RakPeerInterface;
39
41 int RAK_DLL_EXPORT MessageFilterStrComp( char *const &key,char *const &data );
42
44 struct FilterSet
45 {
46 bool banOnFilterTimeExceed;
47 bool kickOnDisallowedMessage;
48 bool banOnDisallowedMessage;
49 SLNet::TimeMS disallowedMessageBanTimeMS;
50 SLNet::TimeMS timeExceedBanTimeMS;
51 SLNet::TimeMS maxMemberTimeMS;
52 void (*invalidMessageCallback)(RakPeerInterface *peer, AddressOrGUID systemAddress, int filterSetID, void *userData, unsigned char messageID);
53 void *disallowedCallbackUserData;
54 void (*timeoutCallback)(RakPeerInterface *peer, AddressOrGUID systemAddress, int filterSetID, void *userData);
55 void *timeoutUserData;
56 int filterSetID;
57 bool allowedIDs[MESSAGE_FILTER_MAX_MESSAGE_ID];
58 DataStructures::OrderedList<SLNet::RakString, SLNet::RakString> allowedRPC4;
59 };
60
62 int RAK_DLL_EXPORT FilterSetComp( const int &key, FilterSet * const &data );
63
65 struct FilteredSystem
66 {
67 FilterSet *filter;
68 SLNet::TimeMS timeEnteredThisSet;
69 };
70
75
85 class RAK_DLL_EXPORT MessageFilter : public PluginInterface2
86 {
87 public:
88
89 // GetInstance() and DestroyInstance(instance*)
90 STATIC_FACTORY_DECLARATIONS(MessageFilter)
91
92 MessageFilter();
93 virtual ~MessageFilter();
94
95 // --------------------------------------------------------------------------------------------
96 // User functions
97 // --------------------------------------------------------------------------------------------
98
102 void SetAutoAddNewConnectionsToFilter(int filterSetID);
103
111 void SetAllowMessageID(bool allow, int messageIDStart, int messageIDEnd,int filterSetID);
112
117 void SetAllowRPC4(bool allow, const char* uniqueID, int filterSetID);
118
126 void SetActionOnDisallowedMessage(bool kickOnDisallowed, bool banOnDisallowed, SLNet::TimeMS banTimeMS, int filterSetID);
127
132 void SetDisallowedMessageCallback(int filterSetID, void *userData, void (*invalidMessageCallback)(RakPeerInterface *peer, AddressOrGUID addressOrGUID, int filterSetID, void *userData, unsigned char messageID));
133
138 void SetTimeoutCallback(int filterSetID, void *userData, void (*invalidMessageCallback)(RakPeerInterface *peer, AddressOrGUID addressOrGUID, int filterSetID, void *userData));
139
146 void SetFilterMaxTime(int allowedTimeMS, bool banOnExceed, SLNet::TimeMS banTimeMS, int filterSetID);
147
150 int GetSystemFilterSet(AddressOrGUID addressOrGUID);
151
157 void SetSystemFilterSet(AddressOrGUID addressOrGUID, int filterSetID);
158
162 unsigned GetSystemCount(int filterSetID) const;
163
166 unsigned GetFilterSetCount(void) const;
167
170 int GetFilterSetIDByIndex(unsigned index);
171
174 void DeleteFilterSet(int filterSetID);
175
176 // --------------------------------------------------------------------------------------------
177 // Packet handling functions
178 // --------------------------------------------------------------------------------------------
179 virtual void Update(void);
180 virtual PluginReceiveResult OnReceive(Packet *packet);
181 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
182 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
183
184 protected:
185
186 void Clear(void);
187 void DeallocateFilterSet(FilterSet *filterSet);
188 FilterSet* GetFilterSetByID(int filterSetID);
189 void OnInvalidMessage(FilterSet *filterSet, AddressOrGUID systemAddress, unsigned char messageID);
190
191 DataStructures::OrderedList<int, FilterSet*, FilterSetComp> filterList;
192 // Change to guid
193 DataStructures::Hash<AddressOrGUID, FilteredSystem, 2048, AddressOrGUID::ToInteger> systemList;
194
195 int autoAddNewConnectionsToFilter;
196 SLNet::Time whenLastTimeoutCheck;
197 };
198
199 } // namespace SLNet
200
201 #endif
202
203 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PS3Includes.h Source File

  • include
  • slikenet
PS3Includes.h
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082 without any modifications.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 */
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • IncrementalReadInterface
SLNet::IncrementalReadInterface Member List

This is the complete list of members for SLNet::IncrementalReadInterface, including all inherited members.

GetFilePart(const char *filename, unsigned int startReadBytes, unsigned int numBytesToRead, void *preallocatedDestination, FileListNodeContext context) | SLNet::IncrementalReadInterface | virtual
IncrementalReadInterface() | SLNet::IncrementalReadInterface | inline
~IncrementalReadInterface() | SLNet::IncrementalReadInterface | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RPC4Plugin.cpp Source File

  • src
RPC4Plugin.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_RPC4Plugin==1
18
19 #include "slikenet/RPC4Plugin.h"
20 #include "slikenet/MessageIdentifiers.h"
21 #include "slikenet/peerinterface.h"
22 #include "slikenet/PacketizedTCP.h"
23 #include "slikenet/sleep.h"
24 #include "slikenet/defines.h"
25 #include "slikenet/DS_Queue.h"
26 //#include "slikenet/GetTime.h"
27 #include "slikenet/linux_adapter.h"
28 #include "slikenet/osx_adapter.h"
29
30 using namespace SLNet;
31
32 STATIC_FACTORY_DEFINITIONS(RPC4,RPC4);
33
34 struct GlobalRegistration
35 {
36 void ( *registerFunctionPointer ) (SLNet::BitStream *userData, Packet *packet );
37 void ( *registerBlockingFunctionPointer ) (SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet );
38 char functionName[RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH];
39 MessageID messageId;
40 int callPriority;
41 };
42 static GlobalRegistration globalRegistrationBuffer[RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS];
43 static unsigned int globalRegistrationIndex=0;
44
45 RPC4GlobalRegistration::RPC4GlobalRegistration(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, Packet *packet ))
46 {
47 RakAssert(globalRegistrationIndex!=RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS);
48 unsigned int i;
49 for (i=0; uniqueID[i]; i++)
50 {
51 RakAssert(i<=RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH-1);
52 globalRegistrationBuffer[globalRegistrationIndex].functionName[i]=uniqueID[i];
53 }
54 globalRegistrationBuffer[globalRegistrationIndex].registerFunctionPointer=functionPointer;
55 globalRegistrationBuffer[globalRegistrationIndex].registerBlockingFunctionPointer=0;
56 globalRegistrationBuffer[globalRegistrationIndex].callPriority=0xFFFFFFFF;
57 globalRegistrationIndex++;
58 }
59 RPC4GlobalRegistration::RPC4GlobalRegistration(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, Packet *packet ), int callPriority)
60 {
61 RakAssert(globalRegistrationIndex!=RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS);
62 unsigned int i;
63 for (i=0; uniqueID[i]; i++)
64 {
65 RakAssert(i<=RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH-1);
66 globalRegistrationBuffer[globalRegistrationIndex].functionName[i]=uniqueID[i];
67 }
68 globalRegistrationBuffer[globalRegistrationIndex].registerFunctionPointer=functionPointer;
69 globalRegistrationBuffer[globalRegistrationIndex].registerBlockingFunctionPointer=0;
70 RakAssert(callPriority!=(int) 0xFFFFFFFF);
71 globalRegistrationBuffer[globalRegistrationIndex].callPriority=callPriority;
72 globalRegistrationIndex++;
73 }
74 RPC4GlobalRegistration::RPC4GlobalRegistration(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet ))
75 {
76 RakAssert(globalRegistrationIndex!=RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS);
77 unsigned int i;
78 for (i=0; uniqueID[i]; i++)
79 {
80 RakAssert(i<=RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH-1);
81 globalRegistrationBuffer[globalRegistrationIndex].functionName[i]=uniqueID[i];
82 }
83 globalRegistrationBuffer[globalRegistrationIndex].registerFunctionPointer=0;
84 globalRegistrationBuffer[globalRegistrationIndex].registerBlockingFunctionPointer=functionPointer;
85 globalRegistrationIndex++;
86 }
87 RPC4GlobalRegistration::RPC4GlobalRegistration(const char* uniqueID, MessageID messageId)
88 {
89 RakAssert(globalRegistrationIndex!=RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS);
90 unsigned int i;
91 for (i=0; uniqueID[i]; i++)
92 {
93 RakAssert(i<=RPC4_GLOBAL_REGISTRATION_MAX_FUNCTION_NAME_LENGTH-1);
94 globalRegistrationBuffer[globalRegistrationIndex].functionName[i]=uniqueID[i];
95 }
96 globalRegistrationBuffer[globalRegistrationIndex].registerFunctionPointer=0;
97 globalRegistrationBuffer[globalRegistrationIndex].registerBlockingFunctionPointer=0;
98 globalRegistrationBuffer[globalRegistrationIndex].messageId=messageId;
99 globalRegistrationIndex++;
100 }
101
102 enum RPC4Identifiers
103 {
104 ID_RPC4_CALL,
105 ID_RPC4_RETURN,
106 ID_RPC4_SIGNAL,
107 };
108 int RPC4::LocalSlotObjectComp( const LocalSlotObject &key, const LocalSlotObject &data )
109 {
110 if (key.callPriority>data.callPriority)
111 return -1;
112 if (key.callPriority==data.callPriority)
113 {
114 if (key.registrationCount<data.registrationCount)
115 return -1;
116 if (key.registrationCount==data.registrationCount)
117 return 0;
118 return 1;
119 }
120
121 return 1;
122 }
123 int RPC4::LocalCallbackComp(const MessageID &key, RPC4::LocalCallback* const &data )
124 {
125 if (key < data->messageId)
126 return -1;
127 if (key > data->messageId)
128 return 1;
129 return 0;
130 }
131
132 RPC4::RPC4()
133 {
134 gotBlockingReturnValue=false;
135 nextSlotRegistrationCount=0;
136 interruptSignal=false;
137 }
138 RPC4::~RPC4()
139 {
140 unsigned int i;
141 for (i=0; i < localCallbacks.Size(); i++)
142 {
143 SLNet::OP_DELETE(localCallbacks[i],_FILE_AND_LINE_);
144 }
145
146 DataStructures::List<SLNet::RakString> keyList;
147 DataStructures::List<LocalSlot*> outputList;
148 localSlots.GetAsList(outputList,keyList,_FILE_AND_LINE_);
149 unsigned int j;
150 for (j=0; j < outputList.Size(); j++)
151 {
152 SLNet::OP_DELETE(outputList[j],_FILE_AND_LINE_);
153 }
154 localSlots.Clear(_FILE_AND_LINE_);
155 }
156 bool RPC4::RegisterFunction(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, Packet *packet ))
157 {
158 DataStructures::HashIndex skhi = registeredNonblockingFunctions.GetIndexOf(uniqueID);
159 if (skhi.IsInvalid()==false)
160 return false;
161
162 registeredNonblockingFunctions.Push(uniqueID,functionPointer,_FILE_AND_LINE_);
163 return true;
164 }
165 void RPC4::RegisterSlot(const char *sharedIdentifier, void ( *functionPointer ) (SLNet::BitStream *userData, Packet *packet ), int callPriority)
166 {
167 LocalSlotObject lso(nextSlotRegistrationCount++, callPriority, functionPointer);
168 DataStructures::HashIndex idx = GetLocalSlotIndex(sharedIdentifier);
169 LocalSlot *localSlot;
170 if (idx.IsInvalid())
171 {
172 localSlot = SLNet::OP_NEW<LocalSlot>(_FILE_AND_LINE_);
173 localSlots.Push(sharedIdentifier, localSlot,_FILE_AND_LINE_);
174 }
175 else
176 {
177 localSlot=localSlots.ItemAtIndex(idx);
178 }
179 localSlot->slotObjects.Insert(lso,lso,true,_FILE_AND_LINE_);
180 }
181 bool RPC4::RegisterBlockingFunction(const char* uniqueID, void ( *functionPointer ) (SLNet::BitStream *userData, SLNet::BitStream *returnData, Packet *packet ))
182 {
183 DataStructures::HashIndex skhi = registeredBlockingFunctions.GetIndexOf(uniqueID);
184 if (skhi.IsInvalid()==false)
185 return false;
186
187 registeredBlockingFunctions.Push(uniqueID,functionPointer,_FILE_AND_LINE_);
188 return true;
189 }
190 void RPC4::RegisterLocalCallback(const char* uniqueID, MessageID messageId)
191 {
192 bool objectExists;
193 unsigned int index;
194 LocalCallback *lc;
195 SLNet::RakString str;
196 str=uniqueID;
197 index = localCallbacks.GetIndexFromKey(messageId,&objectExists);
198 if (objectExists)
199 {
200 lc = localCallbacks[index];
201 index = lc->functions.GetIndexFromKey(str,&objectExists);
202 if (objectExists==false)
203 lc->functions.InsertAtIndex(str,index,_FILE_AND_LINE_);
204 }
205 else
206 {
207 lc = SLNet::OP_NEW<LocalCallback>(_FILE_AND_LINE_);
208 lc->messageId=messageId;
209 lc->functions.Insert(str,str,false,_FILE_AND_LINE_);
210 localCallbacks.InsertAtIndex(lc,index,_FILE_AND_LINE_);
211 }
212 }
213 bool RPC4::UnregisterFunction(const char* uniqueID)
214 {
215 void ( *f ) (SLNet::BitStream *, Packet * );
216 return registeredNonblockingFunctions.Pop(f,uniqueID,_FILE_AND_LINE_);
217 }
218 bool RPC4::UnregisterBlockingFunction(const char* uniqueID)
219 {
220 void ( *f ) (SLNet::BitStream *, SLNet::BitStream *,Packet * );
221 return registeredBlockingFunctions.Pop(f,uniqueID,_FILE_AND_LINE_);
222 }
223 bool RPC4::UnregisterLocalCallback(const char* uniqueID, MessageID messageId)
224 {
225 bool objectExists;
226 unsigned int index, index2;
227 LocalCallback *lc;
228 SLNet::RakString str;
229 str=uniqueID;
230 index = localCallbacks.GetIndexFromKey(messageId,&objectExists);
231 if (objectExists)
232 {
233 lc = localCallbacks[index];
234 index2 = lc->functions.GetIndexFromKey(str,&objectExists);
235 if (objectExists)
236 {
237 lc->functions.RemoveAtIndex(index2);
238 if (lc->functions.Size()==0)
239 {
240 SLNet::OP_DELETE(lc,_FILE_AND_LINE_);
241 localCallbacks.RemoveAtIndex(index);
242 return true;
243 }
244 }
245 }
246 return false;
247 }
248 bool RPC4::UnregisterSlot(const char* sharedIdentifier)
249 {
250 DataStructures::HashIndex hi = localSlots.GetIndexOf(sharedIdentifier);
251 if (hi.IsInvalid()==false)
252 {
253 LocalSlot *ls = localSlots.ItemAtIndex(hi);
254 SLNet::OP_DELETE(ls, _FILE_AND_LINE_);
255 localSlots.RemoveAtIndex(hi, _FILE_AND_LINE_);
256 return true;
257 }
258
259 return false;
260 }
261 void RPC4::CallLoopback( const char* uniqueID, SLNet::BitStream * bitStream )
262 {
263 Packet *p=0;
264
265 DataStructures::HashIndex skhi = registeredNonblockingFunctions.GetIndexOf(uniqueID);
266
267 if (skhi.IsInvalid()==true)
268 {
269 if (rakPeerInterface)
270 p=AllocatePacketUnified(sizeof(MessageID)+sizeof(unsigned char)+(unsigned int) strlen(uniqueID)+1);
271 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
272 else
273 p=tcpInterface->AllocatePacket(sizeof(MessageID)+sizeof(unsigned char)+(unsigned int) strlen(uniqueID)+1);
274 #endif
275
276 if (rakPeerInterface)
277 p->guid=rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
278 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
279 else
280 p->guid=UNASSIGNED_RAKNET_GUID;
281 #endif
282
283 p->systemAddress=UNASSIGNED_SYSTEM_ADDRESS;
284 p->systemAddress.systemIndex=(SystemIndex)-1;
285 p->data[0]=ID_RPC_REMOTE_ERROR;
286 p->data[1]=RPC_ERROR_FUNCTION_NOT_REGISTERED;
287 strcpy_s((char*) p->data+2, p->length-2, uniqueID);
288
289 PushBackPacketUnified(p,false);
290
291 return;
292 }
293
294 SLNet::BitStream out;
295 out.Write((MessageID) ID_RPC_PLUGIN);
296 out.Write((MessageID) ID_RPC4_CALL);
297 out.WriteCompressed(uniqueID);
298 out.Write(false); // nonblocking
299 if (bitStream)
300 {
301 bitStream->ResetReadPointer();
302 out.AlignWriteToByteBoundary();
303 out.Write(bitStream);
304 }
305 if (rakPeerInterface)
306 p=AllocatePacketUnified(out.GetNumberOfBytesUsed());
307 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
308 else
309 p=tcpInterface->AllocatePacket(out.GetNumberOfBytesUsed());
310 #endif
311
312 if (rakPeerInterface)
313 p->guid=rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
314 #if _RAKNET_SUPPORT_PacketizedTCP==1 && _RAKNET_SUPPORT_TCPInterface==1
315 else
316 p->guid=UNASSIGNED_RAKNET_GUID;
317 #endif
318 p->systemAddress=UNASSIGNED_SYSTEM_ADDRESS;
319 p->systemAddress.systemIndex=(SystemIndex)-1;
320 memcpy(p->data,out.GetData(),out.GetNumberOfBytesUsed());
321 PushBackPacketUnified(p,false);
322 return;
323 }
324 void RPC4::Call( const char* uniqueID, SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast )
325 {
326 SLNet::BitStream out;
327 out.Write((MessageID) ID_RPC_PLUGIN);
328 out.Write((MessageID) ID_RPC4_CALL);
329 out.WriteCompressed(uniqueID);
330 out.Write(false); // Nonblocking
331 if (bitStream)
332 {
333 bitStream->ResetReadPointer();
334 out.AlignWriteToByteBoundary();
335 out.Write(bitStream);
336 }
337 SendUnified(&out,priority,reliability,orderingChannel,systemIdentifier,broadcast);
338 }
339 bool RPC4::CallBlocking( const char* uniqueID, SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, SLNet::BitStream *returnData )
340 {
341 SLNet::BitStream out;
342 out.Write((MessageID) ID_RPC_PLUGIN);
343 out.Write((MessageID) ID_RPC4_CALL);
344 out.WriteCompressed(uniqueID);
345 out.Write(true); // Blocking
346 if (bitStream)
347 {
348 bitStream->ResetReadPointer();
349 out.AlignWriteToByteBoundary();
350 out.Write(bitStream);
351 }
352 RakAssert(returnData);
353 RakAssert(rakPeerInterface);
354 ConnectionState cs;
355 cs = rakPeerInterface->GetConnectionState(systemIdentifier);
356 if (cs!=IS_CONNECTED)
357 return false;
358
359 SendUnified(&out,priority,reliability,orderingChannel,systemIdentifier,false);
360
361 returnData->Reset();
362 blockingReturnValue.Reset();
363 gotBlockingReturnValue=false;
364 Packet *packet;
365 DataStructures::Queue<Packet*> packetQueue;
366 while (gotBlockingReturnValue==false)
367 {
368 // TODO - block, filter until gotBlockingReturnValue==true or ID_CONNECTION_LOST or ID_DISCONNECTION_NOTIFICXATION or ID_RPC_REMOTE_ERROR/RPC_ERROR_FUNCTION_NOT_REGISTERED
369 RakSleep(30);
370
371 packet=rakPeerInterface->Receive();
372
373 if (packet)
374 {
375 if (
376 (packet->data[0]==ID_CONNECTION_LOST || packet->data[0]==ID_DISCONNECTION_NOTIFICATION) &&
377 ((systemIdentifier.rakNetGuid!=UNASSIGNED_RAKNET_GUID && packet->guid==systemIdentifier.rakNetGuid) ||
378 (systemIdentifier.systemAddress!=UNASSIGNED_SYSTEM_ADDRESS && packet->systemAddress==systemIdentifier.systemAddress))
379 )
380 {
381 // Push back to head in reverse order
382 rakPeerInterface->PushBackPacket(packet,true);
383 while (packetQueue.Size())
384 rakPeerInterface->PushBackPacket(packetQueue.Pop(),true);
385 return false;
386 }
387 else if (packet->data[0]==ID_RPC_REMOTE_ERROR && packet->data[1]==RPC_ERROR_FUNCTION_NOT_REGISTERED)
388 {
389 SLNet::RakString functionName;
390 SLNet::BitStream bsIn(packet->data,packet->length,false);
391 bsIn.IgnoreBytes(2);
392 bsIn.Read(functionName);
393 if (functionName==uniqueID)
394 {
395 // Push back to head in reverse order
396 rakPeerInterface->PushBackPacket(packet,true);
397 while (packetQueue.Size())
398 rakPeerInterface->PushBackPacket(packetQueue.Pop(),true);
399 return false;
400 }
401 else
402 {
403 packetQueue.PushAtHead(packet,0,_FILE_AND_LINE_);
404 }
405 }
406 else
407 {
408 packetQueue.PushAtHead(packet,0,_FILE_AND_LINE_);
409 }
410 }
411 }
412
413 returnData->Write(blockingReturnValue);
414 returnData->ResetReadPointer();
415 return true;
416 }
417 void RPC4::Signal(const char *sharedIdentifier, SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, bool invokeLocal)
418 {
419 SLNet::BitStream out;
420 out.Write((MessageID) ID_RPC_PLUGIN);
421 out.Write((MessageID) ID_RPC4_SIGNAL);
422 out.WriteCompressed(sharedIdentifier);
423 if (bitStream)
424 {
425 bitStream->ResetReadPointer();
426 out.AlignWriteToByteBoundary();
427 out.Write(bitStream);
428 }
429 SendUnified(&out,priority,reliability,orderingChannel,systemIdentifier,broadcast);
430
431 if (invokeLocal)
432 {
433 //TimeUS t1 = GetTimeUS();
434
435 DataStructures::HashIndex functionIndex;
436 functionIndex = localSlots.GetIndexOf(sharedIdentifier);
437 //TimeUS t2 = GetTimeUS();
438 if (functionIndex.IsInvalid())
439 return;
440
441 Packet p;
442 p.guid=rakPeerInterface->GetMyGUID();
443 p.systemAddress=rakPeerInterface->GetInternalID(UNASSIGNED_SYSTEM_ADDRESS);
444 p.wasGeneratedLocally=true;
445 SLNet::BitStream *bsptr, bstemp;
446 if (bitStream)
447 {
448 bitStream->ResetReadPointer();
449 p.length=bitStream->GetNumberOfBytesUsed();
450 p.bitSize=bitStream->GetNumberOfBitsUsed();
451 bsptr=bitStream;
452 }
453 else
454 {
455 p.length=0;
456 p.bitSize=0;
457 bsptr=&bstemp;
458 }
459
460 //TimeUS t3 = GetTimeUS();
461 InvokeSignal(functionIndex, bsptr, &p);
462 //TimeUS t4 = GetTimeUS();
463 //printf("b1: %I64d\n", t2-t1);
464 //printf("b2: %I64d\n", t3-t2);
465 //printf("b3: %I64d\n", t4-t3);
466 }
467 }
468 void RPC4::InvokeSignal(DataStructures::HashIndex functionIndex, SLNet::BitStream *serializedParameters, Packet *packet)
469 {
470 if (functionIndex.IsInvalid())
471 return;
472
473 //TimeUS t1 = GetTimeUS();
474 //TimeUS t2=0;
475 //TimeUS t3=0;
476
477 interruptSignal=false;
478 LocalSlot *localSlot = localSlots.ItemAtIndex(functionIndex);
479 unsigned int i;
480 i=0;
481 while (i < localSlot->slotObjects.Size())
482 {
483 //t2 = GetTimeUS();
484
485 localSlot->slotObjects[i].functionPointer(serializedParameters, packet);
486
487 //t3 = GetTimeUS();
488
489 // Not threadsafe
490 if (interruptSignal==true)
491 break;
492
493 serializedParameters->ResetReadPointer();
494
495 i++;
496 }
497
498 //TimeUS t4 = GetTimeUS();
499
500 //printf("b1: %I64d\n", t2-t1);
501 //printf("b2: %I64d\n", t3-t2);
502 //printf("b3: %I64d\n", t4-t3);
503 }
504 void RPC4::InterruptSignal(void)
505 {
506 interruptSignal=true;
507 }
508 void RPC4::OnAttach(void)
509 {
510 unsigned int i;
511 for (i=0; i < globalRegistrationIndex; i++)
512 {
513 if (globalRegistrationBuffer[i].registerFunctionPointer)
514 {
515 if (globalRegistrationBuffer[i].callPriority==(int)0xFFFFFFFF)
516 RegisterFunction(globalRegistrationBuffer[i].functionName, globalRegistrationBuffer[i].registerFunctionPointer);
517 else
518 RegisterSlot(globalRegistrationBuffer[i].functionName, globalRegistrationBuffer[i].registerFunctionPointer, globalRegistrationBuffer[i].callPriority);
519 }
520 else if (globalRegistrationBuffer[i].registerBlockingFunctionPointer)
521 RegisterBlockingFunction(globalRegistrationBuffer[i].functionName, globalRegistrationBuffer[i].registerBlockingFunctionPointer);
522 else
523 RegisterLocalCallback(globalRegistrationBuffer[i].functionName, globalRegistrationBuffer[i].messageId);
524 }
525 }
526 PluginReceiveResult RPC4::OnReceive(Packet *packet)
527 {
528 if (packet->data[0]==ID_RPC_PLUGIN)
529 {
530 SLNet::BitStream bsIn(packet->data,packet->length,false);
531 bsIn.IgnoreBytes(2);
532
533 if (packet->data[1]==ID_RPC4_CALL)
534 {
535 SLNet::RakString functionName;
536 bsIn.ReadCompressed(functionName);
537 bool isBlocking=false;
538 bsIn.Read(isBlocking);
539 if (isBlocking==false)
540 {
541 DataStructures::HashIndex skhi = registeredNonblockingFunctions.GetIndexOf(functionName.C_String());
542 if (skhi.IsInvalid())
543 {
544 SLNet::BitStream bsOut;
545 bsOut.Write((unsigned char) ID_RPC_REMOTE_ERROR);
546 bsOut.Write((unsigned char) RPC_ERROR_FUNCTION_NOT_REGISTERED);
547 bsOut.Write(functionName.C_String(),(unsigned int) functionName.GetLength()+1);
548 SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
549 return RR_STOP_PROCESSING_AND_DEALLOCATE;
550 }
551
552 void ( *fp ) (SLNet::BitStream *, Packet * );
553 fp = registeredNonblockingFunctions.ItemAtIndex(skhi);
554 bsIn.AlignReadToByteBoundary();
555 fp(&bsIn,packet);
556 }
557 else
558 {
559 DataStructures::HashIndex skhi = registeredBlockingFunctions.GetIndexOf(functionName.C_String());
560 if (skhi.IsInvalid())
561 {
562 SLNet::BitStream bsOut;
563 bsOut.Write((unsigned char) ID_RPC_REMOTE_ERROR);
564 bsOut.Write((unsigned char) RPC_ERROR_FUNCTION_NOT_REGISTERED);
565 bsOut.Write(functionName.C_String(),(unsigned int) functionName.GetLength()+1);
566 SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
567 return RR_STOP_PROCESSING_AND_DEALLOCATE;
568 }
569
570 void ( *fp ) (SLNet::BitStream *, SLNet::BitStream *, Packet * );
571 fp = registeredBlockingFunctions.ItemAtIndex(skhi);
572 SLNet::BitStream returnData;
573 bsIn.AlignReadToByteBoundary();
574 fp(&bsIn, &returnData, packet);
575
576 SLNet::BitStream out;
577 out.Write((MessageID) ID_RPC_PLUGIN);
578 out.Write((MessageID) ID_RPC4_RETURN);
579 returnData.ResetReadPointer();
580 out.AlignWriteToByteBoundary();
581 out.Write(returnData);
582 SendUnified(&out,IMMEDIATE_PRIORITY,RELIABLE_ORDERED,0,packet->systemAddress,false);
583 }
584 }
585 else if (packet->data[1]==ID_RPC4_SIGNAL)
586 {
587 SLNet::RakString sharedIdentifier;
588 bsIn.ReadCompressed(sharedIdentifier);
589 DataStructures::HashIndex functionIndex;
590 functionIndex = localSlots.GetIndexOf(sharedIdentifier);
591 SLNet::BitStream serializedParameters;
592 bsIn.AlignReadToByteBoundary();
593 bsIn.Read(&serializedParameters);
594 InvokeSignal(functionIndex, &serializedParameters, packet);
595 }
596 else
597 {
598 RakAssert(packet->data[1]==ID_RPC4_RETURN);
599 blockingReturnValue.Reset();
600 blockingReturnValue.Write(bsIn);
601 gotBlockingReturnValue=true;
602 }
603
604 return RR_STOP_PROCESSING_AND_DEALLOCATE;
605 }
606
607 bool objectExists;
608 unsigned int index, index2;
609 index = localCallbacks.GetIndexFromKey(packet->data[0],&objectExists);
610 if (objectExists)
611 {
612 LocalCallback *lc;
613 lc = localCallbacks[index];
614 for (index2=0; index2 < lc->functions.Size(); index2++)
615 {
616 SLNet::BitStream bsIn(packet->data, packet->length, false);
617
618 DataStructures::HashIndex skhi = registeredNonblockingFunctions.GetIndexOf(lc->functions[index2].C_String());
619 if (skhi.IsInvalid()==false)
620 {
621 void ( *fp ) (SLNet::BitStream *, Packet * );
622 fp = registeredNonblockingFunctions.ItemAtIndex(skhi);
623 bsIn.AlignReadToByteBoundary();
624 fp(&bsIn,packet);
625 }
626 }
627 }
628
629 return RR_CONTINUE_PROCESSING;
630 }
631 DataStructures::HashIndex RPC4::GetLocalSlotIndex(const char *sharedIdentifier)
632 {
633 return localSlots.GetIndexOf(sharedIdentifier);
634 }
635
636 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_ThreadsafeAllocatingQueue.h Source File

  • include
  • slikenet
DS_ThreadsafeAllocatingQueue.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #ifndef __THREADSAFE_ALLOCATING_QUEUE
21 #define __THREADSAFE_ALLOCATING_QUEUE
22
23 #include "DS_Queue.h"
24 #include "SimpleMutex.h"
25 #include "DS_MemoryPool.h"
26
27 // #if defined(new)
28 // #pragma push_macro("new")
29 // #undef new
30 // #define RMO_NEW_UNDEF_ALLOCATING_QUEUE
31 // #endif
32
33 namespace DataStructures
34 {
35
36 template <class structureType>
37 class RAK_DLL_EXPORT ThreadsafeAllocatingQueue
38 {
39 public:
40 // Queue operations
41 void Push(structureType *s);
42 structureType *PopInaccurate(void);
43 structureType *Pop(void);
44 void SetPageSize(int size);
45 bool IsEmpty(void);
46 structureType * operator[] ( unsigned int position );
47 void RemoveAtIndex( unsigned int position );
48 unsigned int Size( void );
49
50 // Memory pool operations
51 structureType *Allocate(const char *file, unsigned int line);
52 void Deallocate(structureType *s, const char *file, unsigned int line);
53 void Clear(const char *file, unsigned int line);
54 protected:
55
56 mutable MemoryPool<structureType> memoryPool;
57 SLNet::SimpleMutex memoryPoolMutex;
58 Queue<structureType*> queue;
59 SLNet::SimpleMutex queueMutex;
60 };
61
62 template <class structureType>
63 void ThreadsafeAllocatingQueue<structureType>::Push(structureType *s)
64 {
65 queueMutex.Lock();
66 queue.Push(s, _FILE_AND_LINE_ );
67 queueMutex.Unlock();
68 }
69
70 template <class structureType>
71 structureType *ThreadsafeAllocatingQueue<structureType>::PopInaccurate(void)
72 {
73 structureType *s;
74 if (queue.IsEmpty())
75 return 0;
76 queueMutex.Lock();
77 if (queue.IsEmpty()==false)
78 s=queue.Pop();
79 else
80 s=0;
81 queueMutex.Unlock();
82 return s;
83 }
84
85 template <class structureType>
86 structureType *ThreadsafeAllocatingQueue<structureType>::Pop(void)
87 {
88 structureType *s;
89 queueMutex.Lock();
90 if (queue.IsEmpty())
91 {
92 queueMutex.Unlock();
93 return 0;
94 }
95 s=queue.Pop();
96 queueMutex.Unlock();
97 return s;
98 }
99
100 template <class structureType>
101 structureType *ThreadsafeAllocatingQueue<structureType>::Allocate(const char *file, unsigned int line)
102 {
103 structureType *s;
104 memoryPoolMutex.Lock();
105 s=memoryPool.Allocate(file, line);
106 memoryPoolMutex.Unlock();
107 // Call new operator, memoryPool doesn't do this
108 s = new ((void*)s) structureType;
109 return s;
110 }
111 template <class structureType>
112 void ThreadsafeAllocatingQueue<structureType>::Deallocate(structureType *s, const char *file, unsigned int line)
113 {
114 // Call delete operator, memory pool doesn't do this
115 s->~structureType();
116 memoryPoolMutex.Lock();
117 memoryPool.Release(s, file, line);
118 memoryPoolMutex.Unlock();
119 }
120
121 template <class structureType>
122 void ThreadsafeAllocatingQueue<structureType>::Clear(const char *file, unsigned int line)
123 {
124 memoryPoolMutex.Lock();
125 for (unsigned int i=0; i < queue.Size(); i++)
126 {
127 queue[i]->~structureType();
128 memoryPool.Release(queue[i], file, line);
129 }
130 queue.Clear(file, line);
131 memoryPoolMutex.Unlock();
132 memoryPoolMutex.Lock();
133 memoryPool.Clear(file, line);
134 memoryPoolMutex.Unlock();
135 }
136
137 template <class structureType>
138 void ThreadsafeAllocatingQueue<structureType>::SetPageSize(int size)
139 {
140 memoryPool.SetPageSize(size);
141 }
142
143 template <class structureType>
144 bool ThreadsafeAllocatingQueue<structureType>::IsEmpty(void)
145 {
146 bool isEmpty;
147 queueMutex.Lock();
148 isEmpty=queue.IsEmpty();
149 queueMutex.Unlock();
150 return isEmpty;
151 }
152
153 template <class structureType>
154 structureType * ThreadsafeAllocatingQueue<structureType>::operator[] ( unsigned int position )
155 {
156 structureType *s;
157 queueMutex.Lock();
158 s=queue[position];
159 queueMutex.Unlock();
160 return s;
161 }
162
163 template <class structureType>
164 void ThreadsafeAllocatingQueue<structureType>::RemoveAtIndex( unsigned int position )
165 {
166 queueMutex.Lock();
167 queue.RemoveAtIndex(position);
168 queueMutex.Unlock();
169 }
170
171 template <class structureType>
172 unsigned int ThreadsafeAllocatingQueue<structureType>::Size( void )
173 {
174 unsigned int s;
175 queueMutex.Lock();
176 s=queue.Size();
177 queueMutex.Unlock();
178 return s;
179 }
180
181 }
182
183
184 // #if defined(RMO_NEW_UNDEF_ALLOCATING_QUEUE)
185 // #pragma pop_macro("new")
186 // #undef RMO_NEW_UNDEF_ALLOCATING_QUEUE
187 // #endif
188
189 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/EmailSender.h Source File

  • include
  • slikenet
EmailSender.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_EmailSender==1 && _RAKNET_SUPPORT_TCPInterface==1 && _RAKNET_SUPPORT_FileOperations==1
22
23 #ifndef __EMAIL_SENDER_H
24 #define __EMAIL_SENDER_H
25
26 #include "types.h"
27 #include "memoryoverride.h"
28 #include "Export.h"
29 #include "Rand.h"
30 #include "TCPInterface.h"
31
32 namespace SLNet
33 {
35 class FileList;
36 class TCPInterface;
37
39 class RAK_DLL_EXPORT EmailSender
40 {
41 public:
42 // GetInstance() and DestroyInstance(instance*)
43 STATIC_FACTORY_DECLARATIONS(EmailSender)
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 const char *Send(const char *hostAddress, unsigned short hostPort, const char *sender, const char *recipient, const char *senderName, const char *recipientName, const char *subject, const char *body, FileList *attachedFiles, bool doPrintf, const char *password);
59
60 protected:
61 const char *GetResponse(TCPInterface *tcpInterface, const SystemAddress &emailServer, bool doPrintf);
62 RakNetRandom rakNetRandom;
63 };
64
65 } // namespace SLNet
66
67 #endif
68
69
70 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ConnectionGraph2.h Source File

  • include
  • slikenet
ConnectionGraph2.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_ConnectionGraph2==1
23
24 #ifndef __CONNECTION_GRAPH_2_H
25 #define __CONNECTION_GRAPH_2_H
26
27 #include "memoryoverride.h"
28 #include "types.h"
29 #include "PluginInterface2.h"
30 #include "DS_List.h"
31 #include "DS_WeightedGraph.h"
32 #include "GetTime.h"
33 #include "Export.h"
34
35 namespace SLNet
36 {
38 class RakPeerInterface;
39
45 class RAK_DLL_EXPORT ConnectionGraph2 : public PluginInterface2
46 {
47 public:
48
49 // GetInstance() and DestroyInstance(instance*)
50 STATIC_FACTORY_DECLARATIONS(ConnectionGraph2)
51
52 ConnectionGraph2();
53 ~ConnectionGraph2();
54
61 bool GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress *saOut, RakNetGUID *guidOut, unsigned int *outLength);
62
64 bool ConnectionExists(RakNetGUID g1, RakNetGUID g2);
65
67 uint16_t GetPingBetweenSystems(RakNetGUID g1, RakNetGUID g2) const;
68
71 RakNetGUID GetLowestAveragePingSystem(void) const;
72
76 void SetAutoProcessNewConnections(bool b);
77
80 bool GetAutoProcessNewConnections(void) const;
81
87 void AddParticipant(const SystemAddress &systemAddress, RakNetGUID rakNetGUID);
88
91 void GetParticipantList(DataStructures::OrderedList<RakNetGUID, RakNetGUID> &participantList);
92
94 struct SystemAddressAndGuid
95 {
96 SystemAddress systemAddress;
97 RakNetGUID guid;
98 uint16_t sendersPingToThatSystem;
99 };
101 static int SystemAddressAndGuidComp( const SystemAddressAndGuid &key, const SystemAddressAndGuid &data );
102
104 struct RemoteSystem
105 {
106 DataStructures::OrderedList<SystemAddressAndGuid,SystemAddressAndGuid,ConnectionGraph2::SystemAddressAndGuidComp> remoteConnections;
107 RakNetGUID guid;
108 };
110 static int RemoteSystemComp( const RakNetGUID &key, RemoteSystem * const &data );
111
112 protected:
114 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
116 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
118 virtual PluginReceiveResult OnReceive(Packet *packet);
119
120 // List of systems I am connected to, which in turn stores which systems they are connected to
121 DataStructures::OrderedList<RakNetGUID, RemoteSystem*, ConnectionGraph2::RemoteSystemComp> remoteSystems;
122
123 bool autoProcessNewConnections;
124
125 };
126
127 } // namespace SLNet
128
129 #endif // #ifndef __CONNECTION_GRAPH_2_H
130
131 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Map
DataStructures::Map< key_type, data_type, key_comparison_func > Member List

This is the complete list of members for DataStructures::Map< key_type, data_type, key_comparison_func >, including all inherited members.

Clear(void) | DataStructures::Map< key_type, data_type, key_comparison_func > |
Delete(const key_type &key) | DataStructures::Map< key_type, data_type, key_comparison_func > |
Get(const key_type &key) const | DataStructures::Map< key_type, data_type, key_comparison_func > |
GetIndexAtKey(const key_type &key) | DataStructures::Map< key_type, data_type, key_comparison_func > |
GetKeyAtIndex(const unsigned int position) const | DataStructures::Map< key_type, data_type, key_comparison_func > |
Has(const key_type &key) const | DataStructures::Map< key_type, data_type, key_comparison_func > |
HasSavedSearchResult(const key_type &key) const | DataStructures::Map< key_type, data_type, key_comparison_func > | protected
IMPLEMENT_DEFAULT_COMPARISON(void) | DataStructures::Map< key_type, data_type, key_comparison_func > | inlinestatic
lastSearchIndex | DataStructures::Map< key_type, data_type, key_comparison_func > | protected
lastSearchIndexValid | DataStructures::Map< key_type, data_type, key_comparison_func > | protected
lastSearchKey | DataStructures::Map< key_type, data_type, key_comparison_func > | protected
Map() | DataStructures::Map< key_type, data_type, key_comparison_func > |
Map(const Map &original_copy) | DataStructures::Map< key_type, data_type, key_comparison_func > |
mapNodeList | DataStructures::Map< key_type, data_type, key_comparison_func > | protected
NodeComparisonFunc(const key_type &a, const MapNode &b) | DataStructures::Map< key_type, data_type, key_comparison_func > | inlinestatic
operator=(const Map &original_copy) | DataStructures::Map< key_type, data_type, key_comparison_func > |
operator[](const unsigned int position) const | DataStructures::Map< key_type, data_type, key_comparison_func > |
Pop(const key_type &key) | DataStructures::Map< key_type, data_type, key_comparison_func > |
RemoveAtIndex(const unsigned index) | DataStructures::Map< key_type, data_type, key_comparison_func > |
SaveLastSearch(const key_type &key, unsigned index) const | DataStructures::Map< key_type, data_type, key_comparison_func > | protected
Set(const key_type &key, const data_type &data) | DataStructures::Map< key_type, data_type, key_comparison_func > |
SetExisting(const key_type &key, const data_type &data) | DataStructures::Map< key_type, data_type, key_comparison_func > |
SetNew(const key_type &key, const data_type &data) | DataStructures::Map< key_type, data_type, key_comparison_func > |
Size(void) const | DataStructures::Map< key_type, data_type, key_comparison_func > |
~Map() | DataStructures::Map< key_type, data_type, key_comparison_func > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_WeightedGraph.h Source File

  • include
  • slikenet
DS_WeightedGraph.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
21
22
23 #ifndef __WEIGHTED_GRAPH_H
24 #define __WEIGHTED_GRAPH_H
25
26 #include "DS_OrderedList.h"
27 #include "DS_Map.h"
28 #include "DS_Heap.h"
29 #include "DS_Queue.h"
30 #include "DS_Tree.h"
31 #include "assert.h"
32 #include "memoryoverride.h"
33 #ifdef _DEBUG
34 #include <stdio.h>
35 #endif
36
37 #ifdef _MSC_VER
38 #pragma warning( push )
39 #endif
40
43 namespace DataStructures
44 {
45 template <class node_type, class weight_type, bool allow_unlinkedNodes>
46 class RAK_DLL_EXPORT WeightedGraph
47 {
48 public:
49 static void IMPLEMENT_DEFAULT_COMPARISON(void) {DataStructures::defaultMapKeyComparison<node_type>(node_type(),node_type());}
50
51 WeightedGraph();
52 ~WeightedGraph();
53 WeightedGraph( const WeightedGraph& original_copy );
54 WeightedGraph& operator= ( const WeightedGraph& original_copy );
55 void AddNode(const node_type &node);
56 void RemoveNode(const node_type &node);
57 void AddConnection(const node_type &node1, const node_type &node2, weight_type weight);
58 void RemoveConnection(const node_type &node1, const node_type &node2);
59 bool HasConnection(const node_type &node1, const node_type &node2);
60 void Print(void);
61 void Clear(void);
62 bool GetShortestPath(DataStructures::List<node_type> &path, node_type startNode, node_type endNode, weight_type INFINITE_WEIGHT);
63 bool GetSpanningTree(DataStructures::Tree<node_type> &outTree, DataStructures::List<node_type> *inputNodes, node_type startNode, weight_type INFINITE_WEIGHT );
64 unsigned GetNodeCount(void) const;
65 unsigned GetConnectionCount(unsigned nodeIndex) const;
66 void GetConnectionAtIndex(unsigned nodeIndex, unsigned connectionIndex, node_type &outNode, weight_type &outWeight) const;
67 node_type GetNodeAtIndex(unsigned nodeIndex) const;
68
69 protected:
70 void ClearDijkstra(void);
71 void GenerateDisjktraMatrix(node_type startNode, weight_type INFINITE_WEIGHT);
72
73 DataStructures::Map<node_type, DataStructures::Map<node_type, weight_type> *> adjacencyLists;
74
75 // All these variables are for path finding with Dijkstra
76 // 08/23/06 Won't compile as a DLL inside this struct
77 // struct
78 // {
79 bool isValidPath;
80 node_type rootNode;
81 DataStructures::OrderedList<node_type, node_type> costMatrixIndices;
82 weight_type *costMatrix;
83 node_type *leastNodeArray;
84 // } dijkstra;
85
86 struct NodeAndParent
87 {
88 DataStructures::Tree<node_type>*node;
89 DataStructures::Tree<node_type>*parent;
90 };
91 };
92
93 template <class node_type, class weight_type, bool allow_unlinkedNodes>
94 WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::WeightedGraph()
95 {
96 isValidPath=false;
97 costMatrix=0;
98 }
99
100 template <class node_type, class weight_type, bool allow_unlinkedNodes>
101 WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::~WeightedGraph()
102 {
103 Clear();
104 }
105
106 template <class node_type, class weight_type, bool allow_unlinkedNodes>
107 WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::WeightedGraph( const WeightedGraph& original_copy )
108 {
109 adjacencyLists=original_copy.adjacencyLists;
110
111 isValidPath=original_copy.isValidPath;
112 if (isValidPath)
113 {
114 rootNode=original_copy.rootNode;
115 costMatrixIndices=original_copy.costMatrixIndices;
116 costMatrix = SLNet::OP_NEW_ARRAY<weight_type>(costMatrixIndices.Size() * costMatrixIndices.Size(), _FILE_AND_LINE_ );
117 leastNodeArray = SLNet::OP_NEW_ARRAY<node_type>(costMatrixIndices.Size(), _FILE_AND_LINE_ );
118 memcpy(costMatrix, original_copy.costMatrix, costMatrixIndices.Size() * costMatrixIndices.Size() * sizeof(weight_type));
119 memcpy(leastNodeArray, original_copy.leastNodeArray, costMatrixIndices.Size() * sizeof(weight_type));
120 }
121 }
122
123 template <class node_type, class weight_type, bool allow_unlinkedNodes>
124 WeightedGraph<node_type, weight_type, allow_unlinkedNodes>& WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::operator=( const WeightedGraph& original_copy )
125 {
126 adjacencyLists=original_copy.adjacencyLists;
127
128 isValidPath=original_copy.isValidPath;
129 if (isValidPath)
130 {
131 rootNode=original_copy.rootNode;
132 costMatrixIndices=original_copy.costMatrixIndices;
133 costMatrix = SLNet::OP_NEW_ARRAY<weight_type>(costMatrixIndices.Size() * costMatrixIndices.Size(), _FILE_AND_LINE_ );
134 leastNodeArray = SLNet::OP_NEW_ARRAY<node_type>(costMatrixIndices.Size(), _FILE_AND_LINE_ );
135 memcpy(costMatrix, original_copy.costMatrix, costMatrixIndices.Size() * costMatrixIndices.Size() * sizeof(weight_type));
136 memcpy(leastNodeArray, original_copy.leastNodeArray, costMatrixIndices.Size() * sizeof(weight_type));
137 }
138
139 return *this;
140 }
141
142 template <class node_type, class weight_type, bool allow_unlinkedNodes>
143 void WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::AddNode(const node_type &node)
144 {
145 adjacencyLists.SetNew(node, SLNet::OP_NEW<DataStructures::Map<node_type, weight_type> >( _FILE_AND_LINE_) );
146 }
147
148 template <class node_type, class weight_type, bool allow_unlinkedNodes>
149 void WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::RemoveNode(const node_type &node)
150 {
151 unsigned i;
152 DataStructures::Queue<node_type> removeNodeQueue;
153
154 removeNodeQueue.Push(node, _FILE_AND_LINE_ );
155 while (removeNodeQueue.Size())
156 {
157 SLNet::OP_DELETE(adjacencyLists.Pop(removeNodeQueue.Pop()), _FILE_AND_LINE_);
158
159 // Remove this node from all of the other lists as well
160 for (i=0; i < adjacencyLists.Size(); i++)
161 {
162 adjacencyLists[i]->Delete(node);
163
164 #ifdef _MSC_VER
165 #pragma warning( disable : 4127 ) // warning C4127: conditional expression is constant
166 #endif
167 if (allow_unlinkedNodes==false && adjacencyLists[i]->Size()==0)
168 removeNodeQueue.Push(adjacencyLists.GetKeyAtIndex(i), _FILE_AND_LINE_ );
169 }
170 }
171
172 ClearDijkstra();
173 }
174
175 template <class node_type, class weight_type, bool allow_unlinkedNodes>
176 bool WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::HasConnection(const node_type &node1, const node_type &node2)
177 {
178 if (node1==node2)
179 return false;
180 if (adjacencyLists.Has(node1)==false)
181 return false;
182 return adjacencyLists.Get(node1)->Has(node2);
183 }
184
185 template <class node_type, class weight_type, bool allow_unlinkedNodes>
186 void WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::AddConnection(const node_type &node1, const node_type &node2, weight_type weight)
187 {
188 if (node1==node2)
189 return;
190
191 if (adjacencyLists.Has(node1)==false)
192 AddNode(node1);
193 adjacencyLists.Get(node1)->Set(node2, weight);
194 if (adjacencyLists.Has(node2)==false)
195 AddNode(node2);
196 adjacencyLists.Get(node2)->Set(node1, weight);
197 }
198
199 template <class node_type, class weight_type, bool allow_unlinkedNodes>
200 void WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::RemoveConnection(const node_type &node1, const node_type &node2)
201 {
202 adjacencyLists.Get(node2)->Delete(node1);
203 adjacencyLists.Get(node1)->Delete(node2);
204
205 #ifdef _MSC_VER
206 #pragma warning( disable : 4127 ) // warning C4127: conditional expression is constant
207 #endif
208 if (allow_unlinkedNodes==false) // If we do not allow _unlinked nodes, then if there are no connections, remove the node
209 {
210 if (adjacencyLists.Get(node1)->Size()==0)
211 RemoveNode(node1); // Will also remove node1 from the adjacency list of node2
212 if (adjacencyLists.Has(node2) && adjacencyLists.Get(node2)->Size()==0)
213 RemoveNode(node2);
214 }
215
216 ClearDijkstra();
217 }
218
219 template <class node_type, class weight_type, bool allow_unlinkedNodes>
220 void WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::Clear(void)
221 {
222 unsigned i;
223 for (i=0; i < adjacencyLists.Size(); i++)
224 SLNet::OP_DELETE(adjacencyLists[i], _FILE_AND_LINE_);
225 adjacencyLists.Clear();
226
227 ClearDijkstra();
228 }
229
230 template <class node_type, class weight_type, bool allow_unlinkedNodes>
231 bool WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::GetShortestPath(DataStructures::List<node_type> &path, node_type startNode, node_type endNode, weight_type INFINITE_WEIGHT)
232 {
233 path.Clear(false, _FILE_AND_LINE_);
234 if (startNode==endNode)
235 {
236 path.Insert(startNode, _FILE_AND_LINE_);
237 path.Insert(endNode, _FILE_AND_LINE_);
238 return true;
239 }
240
241 if (isValidPath==false || rootNode!=startNode)
242 {
243 ClearDijkstra();
244 GenerateDisjktraMatrix(startNode, INFINITE_WEIGHT);
245 }
246
247 // return the results
248 bool objectExists;
249 unsigned col,row;
250 weight_type currentWeight;
251 DataStructures::Queue<node_type> outputQueue;
252 col=costMatrixIndices.GetIndexFromKey(endNode, &objectExists);
253 if (costMatrixIndices.Size()<2)
254 {
255 return false;
256 }
257 if (objectExists==false)
258 {
259 return false;
260 }
261 node_type vertex;
262 row=costMatrixIndices.Size()-2;
263 if (row==0)
264 {
265 path.Insert(startNode, _FILE_AND_LINE_);
266 path.Insert(endNode, _FILE_AND_LINE_);
267 return true;
268 }
269 currentWeight=costMatrix[row*adjacencyLists.Size() + col];
270 if (currentWeight==INFINITE_WEIGHT)
271 {
272 // No path
273 return true;
274 }
275 vertex=endNode;
276 outputQueue.PushAtHead(vertex, 0, _FILE_AND_LINE_);
277 row--;
278 for(;;)
279 {
280 while (costMatrix[row*adjacencyLists.Size() + col] == currentWeight)
281 {
282 if (row==0)
283 {
284 path.Insert(startNode, _FILE_AND_LINE_);
285 while(!outputQueue.IsEmpty())
286 path.Insert(outputQueue.Pop(), _FILE_AND_LINE_);
287 return true;
288 }
289 --row;
290 }
291
292 vertex=leastNodeArray[row];
293 outputQueue.PushAtHead(vertex, 0, _FILE_AND_LINE_);
294 if (row==0)
295 break;
296 col=costMatrixIndices.GetIndexFromKey(vertex, &objectExists);
297 currentWeight=costMatrix[row*adjacencyLists.Size() + col];
298 }
299
300 path.Insert(startNode, _FILE_AND_LINE_);
301 while(!outputQueue.IsEmpty())
302 path.Insert(outputQueue.Pop(), _FILE_AND_LINE_);
303 return true;
304 }
305
306 template <class node_type, class weight_type, bool allow_unlinkedNodes>
307 node_type WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::GetNodeAtIndex(unsigned nodeIndex) const
308 {
309 return adjacencyLists.GetKeyAtIndex(nodeIndex);
310 }
311
312 template <class node_type, class weight_type, bool allow_unlinkedNodes>
313 unsigned WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::GetNodeCount(void) const
314 {
315 return adjacencyLists.Size();
316 }
317
318 template <class node_type, class weight_type, bool allow_unlinkedNodes>
319 unsigned WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::GetConnectionCount(unsigned nodeIndex) const
320 {
321 return adjacencyLists[nodeIndex]->Size();
322 }
323
324 template <class node_type, class weight_type, bool allow_unlinkedNodes>
325 void WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::GetConnectionAtIndex(unsigned nodeIndex, unsigned connectionIndex, node_type &outNode, weight_type &outWeight) const
326 {
327 outWeight=adjacencyLists[nodeIndex]->operator[](connectionIndex);
328 outNode=adjacencyLists[nodeIndex]->GetKeyAtIndex(connectionIndex);
329 }
330
331 template <class node_type, class weight_type, bool allow_unlinkedNodes>
332 bool WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::GetSpanningTree(DataStructures::Tree<node_type> &outTree, DataStructures::List<node_type> *inputNodes, node_type startNode, weight_type INFINITE_WEIGHT )
333 {
334 // Find the shortest path from the start node to each of the input nodes. Add this path to a new WeightedGraph if the result is reachable
335 DataStructures::List<node_type> path;
336 DataStructures::WeightedGraph<node_type, weight_type, allow_unlinkedNodes> outGraph;
337 bool res;
338 unsigned i,j;
339 for (i=0; i < inputNodes->Size(); i++)
340 {
341 res=GetShortestPath(path, startNode, (*inputNodes)[i], INFINITE_WEIGHT);
342 if (res && path.Size()>0)
343 {
344 for (j=0; j < path.Size()-1; j++)
345 {
346 // Don't bother looking up the weight
347 outGraph.AddConnection(path[j], path[j+1], INFINITE_WEIGHT);
348 }
349 }
350 }
351
352 // Copy the graph to a tree.
353 DataStructures::Queue<NodeAndParent> nodesToProcess;
354 DataStructures::Tree<node_type> *current;
355 DataStructures::Map<node_type, weight_type> *adjacencyList;
356 node_type key;
357 NodeAndParent nap, nap2;
358 outTree.DeleteDecendants();
359 outTree.data=startNode;
360 current=&outTree;
361 if (outGraph.adjacencyLists.Has(startNode)==false)
362 return false;
363 adjacencyList = outGraph.adjacencyLists.Get(startNode);
364
365 for (i=0; i < adjacencyList->Size(); i++)
366 {
367 nap2.node= SLNet::OP_NEW<DataStructures::Tree<node_type> >( _FILE_AND_LINE_ );
368 nap2.node->data=adjacencyList->GetKeyAtIndex(i);
369 nap2.parent=current;
370 nodesToProcess.Push(nap2, _FILE_AND_LINE_ );
371 current->children.Insert(nap2.node, _FILE_AND_LINE_);
372 }
373
374 while (nodesToProcess.Size())
375 {
376 nap=nodesToProcess.Pop();
377 current=nap.node;
378 adjacencyList = outGraph.adjacencyLists.Get(nap.node->data);
379
380 for (i=0; i < adjacencyList->Size(); i++)
381 {
382 key=adjacencyList->GetKeyAtIndex(i);
383 if (key!=nap.parent->data)
384 {
385 nap2.node= SLNet::OP_NEW<DataStructures::Tree<node_type> >( _FILE_AND_LINE_ );
386 nap2.node->data=key;
387 nap2.parent=current;
388 nodesToProcess.Push(nap2, _FILE_AND_LINE_ );
389 current->children.Insert(nap2.node, _FILE_AND_LINE_);
390 }
391 }
392 }
393
394 return true;
395 }
396
397 template <class node_type, class weight_type, bool allow_unlinkedNodes>
398 void WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::GenerateDisjktraMatrix(node_type startNode, weight_type INFINITE_WEIGHT)
399 {
400 if (adjacencyLists.Size()==0)
401 return;
402
403 costMatrix = SLNet::OP_NEW_ARRAY<weight_type>(adjacencyLists.Size() * adjacencyLists.Size(), _FILE_AND_LINE_ );
404 leastNodeArray = SLNet::OP_NEW_ARRAY<node_type>(adjacencyLists.Size(), _FILE_AND_LINE_ );
405
406 node_type currentNode;
407 unsigned col, row, row2, openSetIndex;
408 node_type adjacentKey;
409 unsigned adjacentIndex;
410 weight_type edgeWeight, currentNodeWeight, adjacentNodeWeight;
411 DataStructures::Map<node_type, weight_type> *adjacencyList;
412 DataStructures::Heap<weight_type, node_type, false> minHeap;
413 DataStructures::Map<node_type, weight_type> openSet;
414
415 for (col=0; col < adjacencyLists.Size(); col++)
416 {
417 // This should be already sorted, so it's a bit inefficient to do an insertion sort, but what the heck
418 costMatrixIndices.Insert(adjacencyLists.GetKeyAtIndex(col),adjacencyLists.GetKeyAtIndex(col), true, _FILE_AND_LINE_);
419 }
420 for (col=0; col < adjacencyLists.Size() * adjacencyLists.Size(); col++)
421 costMatrix[col]=INFINITE_WEIGHT;
422 currentNode=startNode;
423 row=0;
424 currentNodeWeight=0;
425 rootNode=startNode;
426
427 // Clear the starting node column
428 if (adjacencyLists.Size())
429 {
430 adjacentIndex=adjacencyLists.GetIndexAtKey(startNode);
431 for (row2=0; row2 < adjacencyLists.Size(); row2++)
432 costMatrix[row2*adjacencyLists.Size() + adjacentIndex]=0;
433 }
434
435 while (row < adjacencyLists.Size()-1)
436 {
437 adjacencyList = adjacencyLists.Get(currentNode);
438 // Go through all connections from the current node. If the new weight is less than the current weight, then update that weight.
439 for (col=0; col < adjacencyList->Size(); col++)
440 {
441 edgeWeight=(*adjacencyList)[col];
442 adjacentKey=adjacencyList->GetKeyAtIndex(col);
443 adjacentIndex=adjacencyLists.GetIndexAtKey(adjacentKey);
444 adjacentNodeWeight=costMatrix[row*adjacencyLists.Size() + adjacentIndex];
445
446 if (currentNodeWeight + edgeWeight < adjacentNodeWeight)
447 {
448 // Update the weight for the adjacent node
449 for (row2=row; row2 < adjacencyLists.Size(); row2++)
450 costMatrix[row2*adjacencyLists.Size() + adjacentIndex]=currentNodeWeight + edgeWeight;
451 openSet.Set(adjacentKey, currentNodeWeight + edgeWeight);
452 }
453 }
454
455 // Find the lowest in the open set
456 minHeap.Clear(true,_FILE_AND_LINE_);
457 for (openSetIndex=0; openSetIndex < openSet.Size(); openSetIndex++)
458 minHeap.Push(openSet[openSetIndex], openSet.GetKeyAtIndex(openSetIndex),_FILE_AND_LINE_);
459
460 /*
461 unsigned i,j;
462 for (i=0; i < adjacencyLists.Size()-1; i++)
463 {
464 for (j=0; j < adjacencyLists.Size(); j++)
465 {
466 RAKNET_DEBUG_PRINTF("%2i ", costMatrix[i*adjacencyLists.Size() + j]);
467 }
468 RAKNET_DEBUG_PRINTF("Node=%i", leastNodeArray[i]);
469 RAKNET_DEBUG_PRINTF("\n");
470 }
471 */
472
473 if (minHeap.Size()==0)
474 {
475 // Unreachable nodes
476 isValidPath=true;
477 return;
478 }
479
480 currentNodeWeight=minHeap.PeekWeight(0);
481 leastNodeArray[row]=minHeap.Pop(0);
482 currentNode=leastNodeArray[row];
483 openSet.Delete(currentNode);
484 row++;
485 }
486
487 /*
488 #ifdef _DEBUG
489 unsigned i,j;
490 for (i=0; i < adjacencyLists.Size()-1; i++)
491 {
492 for (j=0; j < adjacencyLists.Size(); j++)
493 {
494 RAKNET_DEBUG_PRINTF("%2i ", costMatrix[i*adjacencyLists.Size() + j]);
495 }
496 RAKNET_DEBUG_PRINTF("Node=%i", leastNodeArray[i]);
497 RAKNET_DEBUG_PRINTF("\n");
498 }
499 #endif
500 */
501
502 isValidPath=true;
503 }
504
505 template <class node_type, class weight_type, bool allow_unlinkedNodes>
506 void WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::ClearDijkstra(void)
507 {
508 if (isValidPath)
509 {
510 isValidPath=false;
511 SLNet::OP_DELETE_ARRAY(costMatrix, _FILE_AND_LINE_);
512 SLNet::OP_DELETE_ARRAY(leastNodeArray, _FILE_AND_LINE_);
513 costMatrixIndices.Clear(false, _FILE_AND_LINE_);
514 }
515 }
516
517 template <class node_type, class weight_type, bool allow_unlinkedNodes>
518 void WeightedGraph<node_type, weight_type, allow_unlinkedNodes>::Print(void)
519 {
520 #ifdef _DEBUG
521 unsigned i,j;
522 for (i=0; i < adjacencyLists.Size(); i++)
523 {
524 //RAKNET_DEBUG_PRINTF("%i connected to ", i);
525 RAKNET_DEBUG_PRINTF("%s connected to ", adjacencyLists.GetKeyAtIndex(i).systemAddress.ToString());
526
527 if (adjacencyLists[i]->Size()==0)
528 RAKNET_DEBUG_PRINTF("<Empty>");
529 else
530 {
531 for (j=0; j < adjacencyLists[i]->Size(); j++)
532 // RAKNET_DEBUG_PRINTF("%i (%.2f) ", adjacencyLists.GetIndexAtKey(adjacencyLists[i]->GetKeyAtIndex(j)), (float) adjacencyLists[i]->operator[](j) );
533 RAKNET_DEBUG_PRINTF("%s (%.2f) ", adjacencyLists[i]->GetKeyAtIndex(j).systemAddress.ToString(), (float) adjacencyLists[i]->operator[](j) );
534 }
535
536 RAKNET_DEBUG_PRINTF("\n");
537 }
538 #endif
539 }
540 }
541
542 #ifdef _MSC_VER
543 #pragma warning( pop )
544 #endif
545
546 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SecureHandshake.h Source File

  • include
  • slikenet
SecureHandshake.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
13
14
15 #ifndef SECURE_HANDSHAKE_H
16 #define SECURE_HANDSHAKE_H
17
18 #include "NativeFeatureIncludes.h"
19
20 #if LIBCAT_SECURITY==1
21
22 // If building a RakNet DLL, be sure to tweak the CAT_EXPORT macro meaning
23 #if !defined(_RAKNET_LIB) && defined(_RAKNET_DLL)
24 # define CAT_BUILD_DLL
25 #else
26 # define CAT_NEUTER_EXPORT
27 #endif
28
29 // Include DependentExtensions in your path to include this
30 #ifdef _M_X64
31 #pragma warning(push)
32 #pragma warning(disable:4838)
33 #endif
34 #include "cat/AllTunnel.hpp"
35 #ifdef _M_X64
36 #pragma warning(pop)
37 #endif
38
39 #endif // LIBCAT_SECURITY
40
41 #endif // SECURE_HANDSHAKE_H
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_BinarySearchTree.h Source File

  • include
  • slikenet
DS_BinarySearchTree.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __BINARY_SEARCH_TREE_H
23 #define __BINARY_SEARCH_TREE_H
24
25 #include "DS_QueueLinkedList.h"
26 #include "memoryoverride.h"
27 #include "Export.h"
28
29
32 namespace DataStructures
33 {
96 template <class BinarySearchTreeType>
97 class RAK_DLL_EXPORT BinarySearchTree
98 {
99
100 public:
101
102 struct node
103 {
104 BinarySearchTreeType* item;
105 node* left;
106 node* right;
107 };
108
109 BinarySearchTree();
110 virtual ~BinarySearchTree();
111 BinarySearchTree( const BinarySearchTree& original_type );
112 BinarySearchTree& operator= ( const BinarySearchTree& original_copy );
113 unsigned int Size( void );
114 void Clear( const char *file, unsigned int line );
115 unsigned int Height( node* starting_node = 0 );
116 node* Add ( const BinarySearchTreeType& input, const char *file, unsigned int line );
117 node* Del( const BinarySearchTreeType& input, const char *file, unsigned int line );
118 bool IsIn( const BinarySearchTreeType& input );
119 void DisplayInorder( BinarySearchTreeType* return_array );
120 void DisplayPreorder( BinarySearchTreeType* return_array );
121 void DisplayPostorder( BinarySearchTreeType* return_array );
122 void DisplayBreadthFirstSearch( BinarySearchTreeType* return_array );
123 BinarySearchTreeType*& GetPointerToNode( const BinarySearchTreeType& element );
124
125 protected:
126
127 node* root;
128
129 enum Direction_Types
130 {
131 NOT_FOUND, LEFT, RIGHT, ROOT
132 } direction;
133 unsigned int HeightRecursive( node* current );
134 unsigned int BinarySearchTree_size;
135 node*& Find( const BinarySearchTreeType& element, node** parent );
136 node*& FindParent( const BinarySearchTreeType& element );
137 void DisplayPostorderRecursive( node* current, BinarySearchTreeType* return_array, unsigned int& index );
138 void FixTree( node* current );
139
140 };
141
143 template <class BinarySearchTreeType>
144 class RAK_DLL_EXPORT AVLBalancedBinarySearchTree : public BinarySearchTree<BinarySearchTreeType>
145 {
146
147 public:
148 AVLBalancedBinarySearchTree() {}
149 virtual ~AVLBalancedBinarySearchTree();
150 void Add ( const BinarySearchTreeType& input );
151 void Del( const BinarySearchTreeType& input );
152 BinarySearchTree<BinarySearchTreeType>& operator= ( BinarySearchTree<BinarySearchTreeType>& original_copy )
153 {
154 return BinarySearchTree<BinarySearchTreeType>::operator= ( original_copy );
155 }
156
157 private:
158 void BalanceTree( typename BinarySearchTree<BinarySearchTreeType>::node* current, bool rotateOnce );
159 void RotateRight( typename BinarySearchTree<BinarySearchTreeType>::node *C );
160 void RotateLeft( typename BinarySearchTree<BinarySearchTreeType>::node* C );
161 void DoubleRotateRight( typename BinarySearchTree<BinarySearchTreeType>::node *A );
162 void DoubleRotateLeft( typename BinarySearchTree<BinarySearchTreeType>::node* A );
163 bool RightHigher( typename BinarySearchTree<BinarySearchTreeType>::node* A );
164 bool LeftHigher( typename BinarySearchTree<BinarySearchTreeType>::node* A );
165 };
166
167 template <class BinarySearchTreeType>
168 void AVLBalancedBinarySearchTree<BinarySearchTreeType>::BalanceTree( typename BinarySearchTree<BinarySearchTreeType>::node* current, bool rotateOnce )
169 {
170 int left_height, right_height;
171
172 while ( current )
173 {
174 if ( current->left == 0 )
175 left_height = 0;
176 else
177 left_height = Height( current->left );
178
179 if ( current->right == 0 )
180 right_height = 0;
181 else
182 right_height = Height( current->right );
183
184 if ( right_height - left_height == 2 )
185 {
186 if ( RightHigher( current->right ) )
187 RotateLeft( current->right );
188 else
189 DoubleRotateLeft( current );
190
191 if ( rotateOnce )
192 break;
193 }
194
195 else
196 if ( right_height - left_height == -2 )
197 {
198 if ( LeftHigher( current->left ) )
199 RotateRight( current->left );
200 else
201 DoubleRotateRight( current );
202
203 if ( rotateOnce )
204 break;
205 }
206
207 if ( current == this->root )
208 break;
209
210 current = FindParent( *( current->item ) );
211
212 }
213 }
214
215 template <class BinarySearchTreeType>
216 void AVLBalancedBinarySearchTree<BinarySearchTreeType>::Add ( const BinarySearchTreeType& input )
217 {
218
219 typename BinarySearchTree<BinarySearchTreeType>::node * current = BinarySearchTree<BinarySearchTreeType>::Add ( input, _FILE_AND_LINE_ );
220 BalanceTree( current, true );
221 }
222
223 template <class BinarySearchTreeType>
224 void AVLBalancedBinarySearchTree<BinarySearchTreeType>::Del( const BinarySearchTreeType& input )
225 {
226 typename BinarySearchTree<BinarySearchTreeType>::node * current = BinarySearchTree<BinarySearchTreeType>::Del( input, _FILE_AND_LINE_ );
227 BalanceTree( current, false );
228
229 }
230
231 template <class BinarySearchTreeType>
232 bool AVLBalancedBinarySearchTree<BinarySearchTreeType>::RightHigher( typename BinarySearchTree<BinarySearchTreeType>::node *A )
233 {
234 if ( A == 0 )
235 return false;
236
237 return Height( A->right ) > Height( A->left );
238 }
239
240 template <class BinarySearchTreeType>
241 bool AVLBalancedBinarySearchTree<BinarySearchTreeType>::LeftHigher( typename BinarySearchTree<BinarySearchTreeType>::node *A )
242 {
243 if ( A == 0 )
244 return false;
245
246 return Height( A->left ) > Height( A->right );
247 }
248
249 template <class BinarySearchTreeType>
250 void AVLBalancedBinarySearchTree<BinarySearchTreeType>::RotateRight( typename BinarySearchTree<BinarySearchTreeType>::node *C )
251 {
252 typename BinarySearchTree<BinarySearchTreeType>::node * A, *B, *D;
253 /*
254 RIGHT ROTATION
255
256 A = parent(b)
257 b= parent(c)
258 c = node to rotate around
259
260 A
261 | // Either direction
262 B
263 / \
264 C
265 / \
266 D
267
268 TO
269
270 A
271 | // Either Direction
272 C
273 / \
274 B
275 / \
276 D
277
278
279 <Leave all other branches branches AS-IS whether they point to another node or simply 0>
280
281 */
282
283 B = FindParent( *( C->item ) );
284 A = FindParent( *( B->item ) );
285 D = C->right;
286
287 if ( A )
288 {
289 // Direction was set by the last find_parent call
290
291 if ( this->direction == this->LEFT )
292 A->left = C;
293 else
294 A->right = C;
295 }
296
297 else
298 this->root = C; // If B has no parent parent then B must have been the root node
299
300 B->left = D;
301
302 C->right = B;
303 }
304
305 template <class BinarySearchTreeType>
306 void AVLBalancedBinarySearchTree<BinarySearchTreeType>::DoubleRotateRight( typename BinarySearchTree<BinarySearchTreeType>::node *A )
307 {
308 // The left side of the left child must be higher for the tree to balance with a right rotation. If it isn't, rotate it left before the normal rotation so it is.
309 RotateLeft( A->left->right );
310 RotateRight( A->left );
311 }
312
313 template <class BinarySearchTreeType>
314 void AVLBalancedBinarySearchTree<BinarySearchTreeType>::RotateLeft( typename BinarySearchTree<BinarySearchTreeType>::node *C )
315 {
316 typename BinarySearchTree<BinarySearchTreeType>::node * A, *B, *D;
317 /*
318 RIGHT ROTATION
319
320 A = parent(b)
321 b= parent(c)
322 c = node to rotate around
323
324 A
325 | // Either direction
326 B
327 / \
328 C
329 / \
330 D
331
332 TO
333
334 A
335 | // Either Direction
336 C
337 / \
338 B
339 / \
340 D
341
342
343 <Leave all other branches branches AS-IS whether they point to another node or simply 0>
344
345 */
346
347 B = FindParent( *( C->item ) );
348 A = FindParent( *( B->item ) );
349 D = C->left;
350
351 if ( A )
352 {
353 // Direction was set by the last find_parent call
354
355 if ( this->direction == this->LEFT )
356 A->left = C;
357 else
358 A->right = C;
359 }
360
361 else
362 this->root = C; // If B has no parent parent then B must have been the root node
363
364 B->right = D;
365
366 C->left = B;
367 }
368
369 template <class BinarySearchTreeType>
370 void AVLBalancedBinarySearchTree<BinarySearchTreeType>::DoubleRotateLeft( typename BinarySearchTree<BinarySearchTreeType>::node *A )
371 {
372 // The left side of the right child must be higher for the tree to balance with a left rotation. If it isn't, rotate it right before the normal rotation so it is.
373 RotateRight( A->right->left );
374 RotateLeft( A->right );
375 }
376
377 template <class BinarySearchTreeType>
378 AVLBalancedBinarySearchTree<BinarySearchTreeType>::~AVLBalancedBinarySearchTree()
379 {
380 this->Clear(_FILE_AND_LINE_);
381 }
382
383 template <class BinarySearchTreeType>
384 unsigned int BinarySearchTree<BinarySearchTreeType>::Size( void )
385 {
386 return BinarySearchTree_size;
387 }
388
389 template <class BinarySearchTreeType>
390 unsigned int BinarySearchTree<BinarySearchTreeType>::Height( typename BinarySearchTree::node* starting_node )
391 {
392 if ( BinarySearchTree_size == 0 || starting_node == 0 )
393 return 0;
394 else
395 return HeightRecursive( starting_node );
396 }
397
398 // Recursively return the height of a binary tree
399 template <class BinarySearchTreeType>
400 unsigned int BinarySearchTree<BinarySearchTreeType>::HeightRecursive( typename BinarySearchTree::node* current )
401 {
402 unsigned int left_height = 0, right_height = 0;
403
404 if ( ( current->left == 0 ) && ( current->right == 0 ) )
405 return 1; // Leaf
406
407 if ( current->left != 0 )
408 left_height = 1 + HeightRecursive( current->left );
409
410 if ( current->right != 0 )
411 right_height = 1 + HeightRecursive( current->right );
412
413 if ( left_height > right_height )
414 return left_height;
415 else
416 return right_height;
417 }
418
419 template <class BinarySearchTreeType>
420 BinarySearchTree<BinarySearchTreeType>::BinarySearchTree()
421 {
422 BinarySearchTree_size = 0;
423 root = 0;
424 }
425
426 template <class BinarySearchTreeType>
427 BinarySearchTree<BinarySearchTreeType>::~BinarySearchTree()
428 {
429 this->Clear(_FILE_AND_LINE_);
430 }
431
432 template <class BinarySearchTreeType>
433 BinarySearchTreeType*& BinarySearchTree<BinarySearchTreeType>::GetPointerToNode( const BinarySearchTreeType& element )
434 {
435 static typename BinarySearchTree::node * tempnode;
436 static BinarySearchTreeType* dummyptr = 0;
437 tempnode = Find ( element, &tempnode );
438
439 if ( this->direction == this->NOT_FOUND )
440 return dummyptr;
441
442 return tempnode->item;
443 }
444
445 template <class BinarySearchTreeType>
446 typename BinarySearchTree<BinarySearchTreeType>::node*& BinarySearchTree<BinarySearchTreeType>::Find( const BinarySearchTreeType& element, typename BinarySearchTree<BinarySearchTreeType>::node** parent )
447 {
448 static typename BinarySearchTree::node * current;
449
450 current = this->root;
451 *parent = 0;
452 this->direction = this->ROOT;
453
454 if ( BinarySearchTree_size == 0 )
455 {
456 this->direction = this->NOT_FOUND;
457 return current = 0;
458 }
459
460 // Check if the item is at the root
461 if ( element == *( current->item ) )
462 {
463 this->direction = this->ROOT;
464 return current;
465 }
466
467 for (;;)
468 {
469 // Move pointer
470
471 if ( element < *( current->item ) )
472 {
473 *parent = current;
474 this->direction = this->LEFT;
475 current = current->left;
476 }
477
478 else
479 if ( element > *( current->item ) )
480 {
481 *parent = current;
482 this->direction = this->RIGHT;
483 current = current->right;
484 }
485
486 if ( current == 0 )
487 break;
488
489 // Check if new position holds the item
490 if ( element == *( current->item ) )
491 {
492 return current;
493 }
494 }
495
496
497 this->direction = this->NOT_FOUND;
498 return current = 0;
499 }
500
501 template <class BinarySearchTreeType>
502 typename BinarySearchTree<BinarySearchTreeType>::node*& BinarySearchTree<BinarySearchTreeType>::FindParent( const BinarySearchTreeType& element )
503 {
504 static typename BinarySearchTree::node * parent;
505 Find ( element, &parent );
506 return parent;
507 }
508
509 // Performs a series of value swaps starting with current to fix the tree if needed
510 template <class BinarySearchTreeType>
511 void BinarySearchTree<BinarySearchTreeType>::FixTree( typename BinarySearchTree::node* current )
512 {
513 BinarySearchTreeType temp;
514
515 while ( 1 )
516 {
517 if ( ( ( current->left ) != 0 ) && ( *( current->item ) < *( current->left->item ) ) )
518 {
519 // Swap the current value with the one to the left
520 temp = *( current->left->item );
521 *( current->left->item ) = *( current->item );
522 *( current->item ) = temp;
523 current = current->left;
524 }
525
526 else
527 if ( ( ( current->right ) != 0 ) && ( *( current->item ) > *( current->right->item ) ) )
528 {
529 // Swap the current value with the one to the right
530 temp = *( current->right->item );
531 *( current->right->item ) = *( current->item );
532 *( current->item ) = temp;
533 current = current->right;
534 }
535
536 else
537 break; // current points to the right place so quit
538 }
539 }
540
541 template <class BinarySearchTreeType>
542 typename BinarySearchTree<BinarySearchTreeType>::node* BinarySearchTree<BinarySearchTreeType>::Del( const BinarySearchTreeType& input, const char *file, unsigned int line )
543 {
544 typename BinarySearchTree::node * node_to_delete, *current, *parent;
545
546 if ( BinarySearchTree_size == 0 )
547 return 0;
548
549 if ( BinarySearchTree_size == 1 )
550 {
551 Clear(file, line);
552 return 0;
553 }
554
555 node_to_delete = Find( input, &parent );
556
557 if ( direction == NOT_FOUND )
558 return 0; // Couldn't find the element
559
560 current = node_to_delete;
561
562 // Replace the deleted node with the appropriate value
563 if ( ( current->right ) == 0 && ( current->left ) == 0 ) // Leaf node, just remove it
564 {
565
566 if ( parent )
567 {
568 if ( direction == LEFT )
569 parent->left = 0;
570 else
571 parent->right = 0;
572 }
573
574 SLNet::OP_DELETE(node_to_delete->item, file, line);
575 SLNet::OP_DELETE(node_to_delete, file, line);
576 BinarySearchTree_size--;
577 return parent;
578 }
579 else
580 if ( ( current->right ) != 0 && ( current->left ) == 0 ) // Node has only one child, delete it and cause the parent to point to that child
581 {
582
583 if ( parent )
584 {
585 if ( direction == RIGHT )
586 parent->right = current->right;
587 else
588 parent->left = current->right;
589 }
590
591 else
592 root = current->right; // Without a parent this must be the root node
593
594 SLNet::OP_DELETE(node_to_delete->item, file, line);
595
596 SLNet::OP_DELETE(node_to_delete, file, line);
597
598 BinarySearchTree_size--;
599
600 return parent;
601 }
602 else
603 if ( ( current->right ) == 0 && ( current->left ) != 0 ) // Node has only one child, delete it and cause the parent to point to that child
604 {
605
606 if ( parent )
607 {
608 if ( direction == RIGHT )
609 parent->right = current->left;
610 else
611 parent->left = current->left;
612 }
613
614 else
615 root = current->left; // Without a parent this must be the root node
616
617 SLNet::OP_DELETE(node_to_delete->item, file, line);
618
619 SLNet::OP_DELETE(node_to_delete, file, line);
620
621 BinarySearchTree_size--;
622
623 return parent;
624 }
625 else // Go right, then as left as far as you can
626 {
627 parent = current;
628 direction = RIGHT;
629 current = current->right; // Must have a right branch because the if statements above indicated that it has 2 branches
630
631 while ( current->left )
632 {
633 direction = LEFT;
634 parent = current;
635 current = current->left;
636 }
637
638 // Replace the value held by the node to SLNet::OP_DELETE(with the value pointed to by current, _FILE_AND_LINE_);
639 *( node_to_delete->item ) = *( current->item );
640
641 // Delete current.
642 // If it is a leaf node just delete it
643 if ( current->right == 0 )
644 {
645 if ( direction == RIGHT )
646 parent->right = 0;
647 else
648 parent->left = 0;
649
650 SLNet::OP_DELETE(current->item, file, line);
651
652 SLNet::OP_DELETE(current, file, line);
653
654 BinarySearchTree_size--;
655
656 return parent;
657 }
658
659 else
660 {
661 // Skip this node and make its parent point to its right branch
662
663 if ( direction == RIGHT )
664 parent->right = current->right;
665 else
666 parent->left = current->right;
667
668 SLNet::OP_DELETE(current->item, file, line);
669
670 SLNet::OP_DELETE(current, file, line);
671
672 BinarySearchTree_size--;
673
674 return parent;
675 }
676 }
677 }
678
679 template <class BinarySearchTreeType>
680 typename BinarySearchTree<BinarySearchTreeType>::node* BinarySearchTree<BinarySearchTreeType>::Add ( const BinarySearchTreeType& input, const char *file, unsigned int line )
681 {
682 typename BinarySearchTree::node * current;
683
684 // Add the new element to the tree according to the following alogrithm:
685 // 1. If the current node is empty add the new leaf
686 // 2. If the element is less than the current node then go down the left branch
687 // 3. If the element is greater than the current node then go down the right branch
688
689 if ( BinarySearchTree_size == 0 )
690 {
691 BinarySearchTree_size = 1;
692 root = SLNet::OP_NEW<typename BinarySearchTree::node>( file, line );
693 root->item = SLNet::OP_NEW<BinarySearchTreeType>( file, line );
694 *( root->item ) = input;
695 root->left = 0;
696 root->right = 0;
697
698 return root;
699 }
700
701 else
702 {
703 // start at the root
704 current = root;
705
706 for(;;) // This loop traverses the tree to find a spot for insertion
707 {
708
709 if ( input < *( current->item ) )
710 {
711 if ( current->left == 0 )
712 {
713 current->left = SLNet::OP_NEW<typename BinarySearchTree::node>( file, line );
714 current->left->item = SLNet::OP_NEW<BinarySearchTreeType>( file, line );
715 current = current->left;
716 current->left = 0;
717 current->right = 0;
718 *( current->item ) = input;
719
720 BinarySearchTree_size++;
721 return current;
722 }
723
724 else
725 {
726 current = current->left;
727 }
728 }
729
730 else
731 if ( input > *( current->item ) )
732 {
733 if ( current->right == 0 )
734 {
735 current->right = SLNet::OP_NEW<typename BinarySearchTree::node>( file, line );
736 current->right->item = SLNet::OP_NEW<BinarySearchTreeType>( file, line );
737 current = current->right;
738 current->left = 0;
739 current->right = 0;
740 *( current->item ) = input;
741
742 BinarySearchTree_size++;
743 return current;
744 }
745
746 else
747 {
748 current = current->right;
749 }
750 }
751
752 else
753 return 0; // ((input == current->item) == true) which is not allowed since the tree only takes discrete values. Do nothing
754 }
755 }
756 }
757
758 template <class BinarySearchTreeType>
759 bool BinarySearchTree<BinarySearchTreeType>::IsIn( const BinarySearchTreeType& input )
760 {
761 typename BinarySearchTree::node * parent;
762 find( input, &parent );
763
764 if ( direction != NOT_FOUND )
765 return true;
766 else
767 return false;
768 }
769
770
771 template <class BinarySearchTreeType>
772 void BinarySearchTree<BinarySearchTreeType>::DisplayInorder( BinarySearchTreeType* return_array )
773 {
774 typename BinarySearchTree::node * current, *parent;
775 bool just_printed = false;
776
777 unsigned int index = 0;
778
779 current = root;
780
781 if ( BinarySearchTree_size == 0 )
782 return ; // Do nothing for an empty tree
783
784 else
785 if ( BinarySearchTree_size == 1 )
786 {
787 return_array[ 0 ] = *( root->item );
788 return ;
789 }
790
791
792 direction = ROOT; // Reset the direction
793
794 while ( index != BinarySearchTree_size )
795 {
796 // direction is set by the find function and holds the direction of the parent to the last node visited. It is used to prevent revisiting nodes
797
798 if ( ( current->left != 0 ) && ( direction != LEFT ) && ( direction != RIGHT ) )
799 {
800 // Go left if the following 2 conditions are true
801 // I can go left
802 // I did not just move up from a right child
803 // I did not just move up from a left child
804
805 current = current->left;
806 direction = ROOT; // Reset the direction
807 }
808
809 else
810 if ( ( direction != RIGHT ) && ( just_printed == false ) )
811 {
812 // Otherwise, print the current node if the following 3 conditions are true:
813 // I did not just move up from a right child
814 // I did not print this ndoe last cycle
815
816 return_array[ index++ ] = *( current->item );
817 just_printed = true;
818 }
819
820 else
821 if ( ( current->right != 0 ) && ( direction != RIGHT ) )
822 {
823 // Otherwise, go right if the following 2 conditions are true
824 // I did not just move up from a right child
825 // I can go right
826
827 current = current->right;
828 direction = ROOT; // Reset the direction
829 just_printed = false;
830 }
831
832 else
833 {
834 // Otherwise I've done everything I can. Move up the tree one node
835 parent = FindParent( *( current->item ) );
836 current = parent;
837 just_printed = false;
838 }
839 }
840 }
841
842 template <class BinarySearchTreeType>
843 void BinarySearchTree<BinarySearchTreeType>::DisplayPreorder( BinarySearchTreeType* return_array )
844 {
845 typename BinarySearchTree::node * current, *parent;
846
847 unsigned int index = 0;
848
849 current = root;
850
851 if ( BinarySearchTree_size == 0 )
852 return ; // Do nothing for an empty tree
853
854 else
855 if ( BinarySearchTree_size == 1 )
856 {
857 return_array[ 0 ] = *( root->item );
858 return ;
859 }
860
861
862 direction = ROOT; // Reset the direction
863 return_array[ index++ ] = *( current->item );
864
865 while ( index != BinarySearchTree_size )
866 {
867 // direction is set by the find function and holds the direction of the parent to the last node visited. It is used to prevent revisiting nodes
868
869 if ( ( current->left != 0 ) && ( direction != LEFT ) && ( direction != RIGHT ) )
870 {
871
872 current = current->left;
873 direction = ROOT;
874
875 // Everytime you move a node print it
876 return_array[ index++ ] = *( current->item );
877 }
878
879 else
880 if ( ( current->right != 0 ) && ( direction != RIGHT ) )
881 {
882 current = current->right;
883 direction = ROOT;
884
885 // Everytime you move a node print it
886 return_array[ index++ ] = *( current->item );
887 }
888
889 else
890 {
891 // Otherwise I've done everything I can. Move up the tree one node
892 parent = FindParent( *( current->item ) );
893 current = parent;
894 }
895 }
896 }
897
898 template <class BinarySearchTreeType>
899 inline void BinarySearchTree<BinarySearchTreeType>::DisplayPostorder( BinarySearchTreeType* return_array )
900 {
901 unsigned int index = 0;
902
903 if ( BinarySearchTree_size == 0 )
904 return ; // Do nothing for an empty tree
905
906 else
907 if ( BinarySearchTree_size == 1 )
908 {
909 return_array[ 0 ] = *( root->item );
910 return ;
911 }
912
913 DisplayPostorderRecursive( root, return_array, index );
914 }
915
916
917 // Recursively do a postorder traversal
918 template <class BinarySearchTreeType>
919 void BinarySearchTree<BinarySearchTreeType>::DisplayPostorderRecursive( typename BinarySearchTree::node* current, BinarySearchTreeType* return_array, unsigned int& index )
920 {
921 if ( current->left != 0 )
922 DisplayPostorderRecursive( current->left, return_array, index );
923
924 if ( current->right != 0 )
925 DisplayPostorderRecursive( current->right, return_array, index );
926
927 return_array[ index++ ] = *( current->item );
928
929 }
930
931
932 template <class BinarySearchTreeType>
933 void BinarySearchTree<BinarySearchTreeType>::DisplayBreadthFirstSearch( BinarySearchTreeType* return_array )
934 {
935 typename BinarySearchTree::node * current;
936 unsigned int index = 0;
937
938 // Display the tree using a breadth first search
939 // Put the children of the current node into the queue
940 // Pop the queue, put its children into the queue, repeat until queue is empty
941
942 if ( BinarySearchTree_size == 0 )
943 return ; // Do nothing for an empty tree
944
945 else
946 if ( BinarySearchTree_size == 1 )
947 {
948 return_array[ 0 ] = *( root->item );
949 return ;
950 }
951
952 else
953 {
954 DataStructures::QueueLinkedList<node *> tree_queue;
955
956 // Add the root of the tree I am copying from
957 tree_queue.Push( root );
958
959 do
960 {
961 current = tree_queue.Pop();
962 return_array[ index++ ] = *( current->item );
963
964 // Add the child or children of the tree I am copying from to the queue
965
966 if ( current->left != 0 )
967 tree_queue.Push( current->left );
968
969 if ( current->right != 0 )
970 tree_queue.Push( current->right );
971
972 }
973
974 while ( tree_queue.Size() > 0 );
975 }
976 }
977
978
979 template <class BinarySearchTreeType>
980 BinarySearchTree<BinarySearchTreeType>::BinarySearchTree( const BinarySearchTree& original_copy )
981 {
982 typename BinarySearchTree::node * current;
983 // Copy the tree using a breadth first search
984 // Put the children of the current node into the queue
985 // Pop the queue, put its children into the queue, repeat until queue is empty
986
987 // This is a copy of the constructor. A bug in Visual C++ made it so if I just put the constructor call here the variable assignments were ignored.
988 BinarySearchTree_size = 0;
989 root = 0;
990
991 if ( original_copy.BinarySearchTree_size == 0 )
992 {
993 BinarySearchTree_size = 0;
994 }
995
996 else
997 {
998 DataStructures::QueueLinkedList<node *> tree_queue;
999
1000 // Add the root of the tree I am copying from
1001 tree_queue.Push( original_copy.root );
1002
1003 do
1004 {
1005 current = tree_queue.Pop();
1006
1007 Add ( *( current->item ), _FILE_AND_LINE_ )
1008
1009 ;
1010
1011 // Add the child or children of the tree I am copying from to the queue
1012 if ( current->left != 0 )
1013 tree_queue.Push( current->left );
1014
1015 if ( current->right != 0 )
1016 tree_queue.Push( current->right );
1017
1018 }
1019
1020 while ( tree_queue.Size() > 0 );
1021 }
1022 }
1023
1024 template <class BinarySearchTreeType>
1025 BinarySearchTree<BinarySearchTreeType>& BinarySearchTree<BinarySearchTreeType>::operator= ( const BinarySearchTree& original_copy )
1026 {
1027 typename BinarySearchTree::node * current;
1028
1029 if ( ( &original_copy ) == this )
1030 return *this;
1031
1032 Clear( _FILE_AND_LINE_ ); // Remove the current tree
1033
1034 // This is a copy of the constructor. A bug in Visual C++ made it so if I just put the constructor call here the variable assignments were ignored.
1035 BinarySearchTree_size = 0;
1036
1037 root = 0;
1038
1039
1040 // Copy the tree using a breadth first search
1041 // Put the children of the current node into the queue
1042 // Pop the queue, put its children into the queue, repeat until queue is empty
1043 if ( original_copy.BinarySearchTree_size == 0 )
1044 {
1045 BinarySearchTree_size = 0;
1046 }
1047
1048 else
1049 {
1050 DataStructures::QueueLinkedList<node *> tree_queue;
1051
1052 // Add the root of the tree I am copying from
1053 tree_queue.Push( original_copy.root );
1054
1055 do
1056 {
1057 current = tree_queue.Pop();
1058
1059 Add ( *( current->item ), _FILE_AND_LINE_ )
1060
1061 ;
1062
1063 // Add the child or children of the tree I am copying from to the queue
1064 if ( current->left != 0 )
1065 tree_queue.Push( current->left );
1066
1067 if ( current->right != 0 )
1068 tree_queue.Push( current->right );
1069
1070 }
1071
1072 while ( tree_queue.Size() > 0 );
1073 }
1074
1075 return *this;
1076 }
1077
1078 template <class BinarySearchTreeType>
1079 inline void BinarySearchTree<BinarySearchTreeType>::Clear ( const char *file, unsigned int line )
1080 {
1081 typename BinarySearchTree::node * current, *parent;
1082
1083 current = root;
1084
1085 while ( BinarySearchTree_size > 0 )
1086 {
1087 if ( BinarySearchTree_size == 1 )
1088 {
1089 SLNet::OP_DELETE(root->item, file, line);
1090 SLNet::OP_DELETE(root, file, line);
1091 root = 0;
1092 BinarySearchTree_size = 0;
1093 }
1094
1095 else
1096 {
1097 if ( current->left != 0 )
1098 {
1099 current = current->left;
1100 }
1101
1102 else
1103 if ( current->right != 0 )
1104 {
1105 current = current->right;
1106 }
1107
1108 else // leaf
1109 {
1110 // Not root node so must have a parent
1111 parent = FindParent( *( current->item ) );
1112
1113 if ( ( parent->left ) == current )
1114 parent->left = 0;
1115 else
1116 parent->right = 0;
1117
1118 SLNet::OP_DELETE(current->item, file, line);
1119
1120 SLNet::OP_DELETE(current, file, line);
1121
1122 current = parent;
1123
1124 BinarySearchTree_size--;
1125 }
1126 }
1127 }
1128 }
1129
1130 } // End namespace
1131
1132 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/AutopatcherPatchContext.h Source File

  • include
  • slikenet
AutopatcherPatchContext.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __AUTOPATCHER_PATCH_CONTEXT_H
12 #define __AUTOPATCHER_PATCH_CONTEXT_H
13
14 enum PatchContext
15 {
16 PC_HASH_1_WITH_PATCH,
17 PC_HASH_2_WITH_PATCH,
18 PC_WRITE_FILE,
19 PC_ERROR_FILE_WRITE_FAILURE,
20 PC_ERROR_PATCH_TARGET_MISSING,
21 PC_ERROR_PATCH_APPLICATION_FAILURE,
22 PC_ERROR_PATCH_RESULT_CHECKSUM_FAILURE,
23 PC_NOTICE_WILL_COPY_ON_RESTART,
24 PC_NOTICE_FILE_DOWNLOADED,
25 PC_NOTICE_FILE_DOWNLOADED_PATCH,
26 };
27
28 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ReliabilityLayer.cpp Source File

  • src
ReliabilityLayer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20
21 #include "slikenet/ReliabilityLayer.h"
22 #include "slikenet/GetTime.h"
23 #include "slikenet/SocketLayer.h"
24 #include "slikenet/PluginInterface2.h"
25 #include "slikenet/assert.h"
26 #include "slikenet/Rand.h"
27 #include "slikenet/MessageIdentifiers.h"
28 #ifdef USE_THREADED_SEND
29 #include "slikenet/SendToThread.h"
30 #endif
31 #include <math.h>
32 #include "slikenet/linux_adapter.h"
33 #include "slikenet/osx_adapter.h"
34
35 using namespace SLNet;
36
37 // Can't figure out which library has this function on the PS3
38 double Ceil(double d) {if (((double)((int)d))==d) return d; return (int) (d+1.0);}
39
40 // #if defined(new)
41 // #pragma push_macro("new")
42 // #undef new
43 // #define RELIABILITY_LAYER_NEW_UNDEF_ALLOCATING_QUEUE
44 // #endif
45
46
47 //#define _DEBUG_LOGGER
48
49 #if CC_TIME_TYPE_BYTES==4
50 static const CCTimeType MAX_TIME_BETWEEN_PACKETS= 350; // 350 milliseconds
51 static const CCTimeType HISTOGRAM_RESTART_CYCLE=10000; // Every 10 seconds reset the histogram
52 #else
53 static const CCTimeType MAX_TIME_BETWEEN_PACKETS= 350000; // 350 milliseconds
54 //static const CCTimeType HISTOGRAM_RESTART_CYCLE=10000000; // Every 10 seconds reset the histogram
55 #endif
56 static const int DEFAULT_HAS_RECEIVED_PACKET_QUEUE_SIZE=512;
57 static const CCTimeType STARTING_TIME_BETWEEN_PACKETS=MAX_TIME_BETWEEN_PACKETS;
58 //static const long double TIME_BETWEEN_PACKETS_INCREASE_MULTIPLIER_DEFAULT=.02;
59 //static const long double TIME_BETWEEN_PACKETS_DECREASE_MULTIPLIER_DEFAULT=1.0 / 9.0;
60
61 typedef uint32_t BitstreamLengthEncoding;
62
63 //#define PRINT_TO_FILE_RELIABLE_ORDERED_TEST
64 #ifdef PRINT_TO_FILE_RELIABLE_ORDERED_TEST
65 static unsigned int packetNumber=0;
66 static FILE *fp=0;
67 #endif
68
69 //#define FLIP_SEND_ORDER_TEST
70 //#define LOG_TRIVIAL_NOTIFICATIONS
71
72 BPSTracker::TimeAndValue2::TimeAndValue2() {}
73 BPSTracker::TimeAndValue2::~TimeAndValue2() {}
74 BPSTracker::TimeAndValue2::TimeAndValue2(SLNet::TimeUS t, uint64_t v1) : value1(v1), time(t) {}
75 //BPSTracker::TimeAndValue2::TimeAndValue2(SLNet::TimeUS t, uint64_t v1, uint64_t v2) : time(t), value1(v1), value2(v2) {}
76 BPSTracker::BPSTracker() {Reset(_FILE_AND_LINE_);}
77 BPSTracker::~BPSTracker() {}
78 //void BPSTracker::Reset(const char *file, unsigned int line) {total1=total2=lastSec1=lastSec2=0; dataQueue.Clear(file,line);}
79 void BPSTracker::Reset(const char *file, unsigned int line) {total1=lastSec1=0; dataQueue.Clear(file,line);}
80 //void BPSTracker::Push2(RakNetTimeUS time, uint64_t value1, uint64_t value2) {dataQueue.Push(TimeAndValue2(time,value1,value2),_FILE_AND_LINE_); total1+=value1; lastSec1+=value1; total2+=value2; lastSec2+=value2;}
81 //uint64_t BPSTracker::GetBPS2(RakNetTimeUS time) {ClearExpired2(time); return lastSec2;}
82 //void BPSTracker::GetBPS1And2(RakNetTimeUS time, uint64_t &out1, uint64_t &out2) {ClearExpired2(time); out1=lastSec1; out2=lastSec2;}
83 uint64_t BPSTracker::GetTotal1(void) const {return total1;}
84 //uint64_t BPSTracker::GetTotal2(void) const {return total2;}
85
86 // void BPSTracker::ClearExpired2(SLNet::TimeUS time) {
87 // SLNet::TimeUS threshold=time;
88 // if (threshold < 1000000)
89 // return;
90 // threshold-=1000000;
91 // while (dataQueue.IsEmpty()==false && dataQueue.Peek().time < threshold)
92 // {
93 // lastSec1-=dataQueue.Peek().value1;
94 // lastSec2-=dataQueue.Peek().value2;
95 // dataQueue.Pop();
96 // }
97 // }
98 void BPSTracker::ClearExpired1(SLNet::TimeUS time)
99 {
100 while (dataQueue.IsEmpty()==false &&
101 #if CC_TIME_TYPE_BYTES==8
102 dataQueue.Peek().time+1000000 < time
103 #else
104 dataQueue.Peek().time+1000 < time
105 #endif
106 )
107 {
108 lastSec1-=dataQueue.Peek().value1;
109 dataQueue.Pop();
110 }
111 }
112
113 struct DatagramHeaderFormat
114 {
115 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
116 CCTimeType sourceSystemTime;
117 #endif
118 DatagramSequenceNumberType datagramNumber;
119
120 // Use floats to save bandwidth
121 // float B; // Link capacity
122 float AS; // Data arrival rate
123 bool isACK;
124 bool isNAK;
125 bool isPacketPair;
126 bool hasBAndAS;
127 bool isContinuousSend;
128 bool needsBAndAs;
129 bool isValid; // To differentiate between what I serialized, and offline data
130
131 static BitSize_t GetDataHeaderBitLength()
132 {
133 return BYTES_TO_BITS(GetDataHeaderByteLength());
134 }
135
136 static unsigned int GetDataHeaderByteLength()
137 {
138 //return 2 + 3 + sizeof(SLNet::TimeMS) + sizeof(float)*2;
139 return 2 + 3 +
140 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
141 sizeof(RakNetTimeMS) +
142 #endif
143 sizeof(float)*1;
144 }
145
146 void Serialize(SLNet::BitStream *b)
147 {
148 // Not endian safe
149 // RakAssert(GetDataHeaderByteLength()==sizeof(DatagramHeaderFormat));
150 // b->WriteAlignedBytes((const unsigned char*) this, sizeof(DatagramHeaderFormat));
151 // return;
152
153 b->Write(true); // IsValid
154 if (isACK)
155 {
156 b->Write(true);
157 b->Write(hasBAndAS);
158 b->AlignWriteToByteBoundary();
159 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
160 SLNet::TimeMS timeMSLow=(SLNet::TimeMS) sourceSystemTime&0xFFFFFFFF; b->Write(timeMSLow);
161 #endif
162 if (hasBAndAS)
163 {
164 // b->Write(B);
165 b->Write(AS);
166 }
167 }
168 else if (isNAK)
169 {
170 b->Write(false);
171 b->Write(true);
172 }
173 else
174 {
175 b->Write(false);
176 b->Write(false);
177 b->Write(isPacketPair);
178 b->Write(isContinuousSend);
179 b->Write(needsBAndAs);
180 b->AlignWriteToByteBoundary();
181 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
182 SLNet::TimeMS timeMSLow=(SLNet::TimeMS) sourceSystemTime&0xFFFFFFFF; b->Write(timeMSLow);
183 #endif
184 b->Write(datagramNumber);
185 }
186 }
187 void Deserialize(SLNet::BitStream *b)
188 {
189 // Not endian safe
190 // b->ReadAlignedBytes((unsigned char*) this, sizeof(DatagramHeaderFormat));
191 // return;
192
193 b->Read(isValid);
194 b->Read(isACK);
195 if (isACK)
196 {
197 isNAK=false;
198 isPacketPair=false;
199 b->Read(hasBAndAS);
200 b->AlignReadToByteBoundary();
201 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
202 SLNet::TimeMS timeMS; b->Read(timeMS); sourceSystemTime=(CCTimeType) timeMS;
203 #endif
204 if (hasBAndAS)
205 {
206 // b->Read(B);
207 b->Read(AS);
208 }
209 }
210 else
211 {
212 b->Read(isNAK);
213 if (isNAK)
214 {
215 isPacketPair=false;
216 }
217 else
218 {
219 b->Read(isPacketPair);
220 b->Read(isContinuousSend);
221 b->Read(needsBAndAs);
222 b->AlignReadToByteBoundary();
223 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
224 SLNet::TimeMS timeMS; b->Read(timeMS); sourceSystemTime=(CCTimeType) timeMS;
225 #endif
226 b->Read(datagramNumber);
227 }
228 }
229 }
230 };
231
232 #ifdef _WIN32
233 //#define _DEBUG_LOGGER
234 #ifdef _DEBUG_LOGGER
235 #include "slikenet/WindowsIncludes.h"
236 #endif
237 #endif
238
239 //#define DEBUG_SPLIT_PACKET_PROBLEMS
240 #if defined (DEBUG_SPLIT_PACKET_PROBLEMS)
241 static int waitFlag=-1;
242 #endif
243
244 using namespace SLNet;
245
246 int SLNet::SplitPacketChannelComp( SplitPacketIdType const &key, SplitPacketChannel* const &data )
247 {
248 #if PREALLOCATE_LARGE_MESSAGES==1
249 if (key < data->returnedPacket->splitPacketId)
250 return -1;
251 if (key == data->returnedPacket->splitPacketId)
252 return 0;
253 #else
254 if (key < data->splitPacketList[0]->splitPacketId)
255 return -1;
256 if (key == data->splitPacketList[0]->splitPacketId)
257 return 0;
258 #endif
259 return 1;
260 }
261
262 // DEFINE_MULTILIST_PTR_TO_MEMBER_COMPARISONS( InternalPacket, SplitPacketIndexType, splitPacketIndex )
263 /*
264 bool operator<( const DataStructures::MLKeyRef<SplitPacketIndexType> &inputKey, const InternalPacket *cls )
265 {
266 return inputKey.Get() < cls->splitPacketIndex;
267 }
268 bool operator>( const DataStructures::MLKeyRef<SplitPacketIndexType> &inputKey, const InternalPacket *cls )
269 {
270 return inputKey.Get() > cls->splitPacketIndex;
271 }
272 bool operator==( const DataStructures::MLKeyRef<SplitPacketIndexType> &inputKey, const InternalPacket *cls )
273 {
274 return inputKey.Get() == cls->splitPacketIndex;
275 }
277 bool operator<( const DataStructures::MLKeyRef<InternalPacket *> &inputKey, const InternalPacket *cls )
278 {
279 return inputKey.Get()->splitPacketIndex < cls->splitPacketIndex;
280 }
281 bool operator>( const DataStructures::MLKeyRef<InternalPacket *> &inputKey, const InternalPacket *cls )
282 {
283 return inputKey.Get()->splitPacketIndex > cls->splitPacketIndex;
284 }
285 bool operator==( const DataStructures::MLKeyRef<InternalPacket *> &inputKey, const InternalPacket *cls )
286 {
287 return inputKey.Get()->splitPacketIndex == cls->splitPacketIndex;
288 }
289 */
290
291 int SplitPacketIndexComp( SplitPacketIndexType const &key, InternalPacket* const &data )
292 {
293 if (key < data->splitPacketIndex)
294 return -1;
295 if (key == data->splitPacketIndex)
296 return 0;
297 return 1;
298 }
299
300 //-------------------------------------------------------------------------------------------------------
301 // Constructor
302 //-------------------------------------------------------------------------------------------------------
303 // Add 21 to the default MTU so if we encrypt it can hold potentially 21 more bytes of extra data + padding.
304 ReliabilityLayer::ReliabilityLayer()
305 {
306
307 #ifdef _DEBUG
308 // Wait longer to disconnect in debug so I don't get disconnected while tracing
309 timeoutTime=30000;
310 #else
311 timeoutTime=10000;
312 #endif
313
314 #ifdef _DEBUG
315 minExtraPing=extraPingVariance=0;
316 packetloss=(double) minExtraPing;
317 #endif
318
319
320 #ifdef PRINT_TO_FILE_RELIABLE_ORDERED_TEST
321 if (fp==0 && 0)
322 {
323 fopen_s(&fp, "reliableorderedoutput.txt", "wt");
324 }
325 #endif
326
327 InitializeVariables();
328 //int i = sizeof(InternalPacket);
329 datagramHistoryMessagePool.SetPageSize(sizeof(MessageNumberNode)*128);
330 internalPacketPool.SetPageSize(sizeof(InternalPacket)*INTERNAL_PACKET_PAGE_SIZE);
331 refCountedDataPool.SetPageSize(sizeof(InternalPacketRefCountedData)*32);
332 }
333
334 //-------------------------------------------------------------------------------------------------------
335 // Destructor
336 //-------------------------------------------------------------------------------------------------------
337 ReliabilityLayer::~ReliabilityLayer()
338 {
339 FreeMemory( true ); // Free all memory immediately
340 }
341 //-------------------------------------------------------------------------------------------------------
342 // Resets the layer for reuse
343 //-------------------------------------------------------------------------------------------------------
344 void ReliabilityLayer::Reset( bool resetVariables, int MTUSize, bool _useSecurity )
345 {
346
347 FreeMemory( true ); // true because making a memory reset pending in the update cycle causes resets after reconnects. Instead, just call Reset from a single thread
348 if (resetVariables)
349 {
350 InitializeVariables();
351
352 #if LIBCAT_SECURITY==1
353 useSecurity = _useSecurity;
354
355 if (_useSecurity)
356 MTUSize -= cat::AuthenticatedEncryption::OVERHEAD_BYTES;
357 #else
358 (void) _useSecurity;
359 #endif // LIBCAT_SECURITY
360 congestionManager.Init(SLNet::GetTimeUS(), MTUSize - UDP_HEADER_SIZE);
361 }
362 }
363
364 //-------------------------------------------------------------------------------------------------------
365 // Set the time, in MS, to use before considering ourselves disconnected after not being able to deliver a reliable packet
366 //-------------------------------------------------------------------------------------------------------
367 void ReliabilityLayer::SetTimeoutTime(SLNet::TimeMS time )
368 {
369 timeoutTime=time;
370 }
371
372 //-------------------------------------------------------------------------------------------------------
373 // Returns the value passed to SetTimeoutTime. or the default if it was never called
374 //-------------------------------------------------------------------------------------------------------
375 SLNet::TimeMS ReliabilityLayer::GetTimeoutTime(void)
376 {
377 return timeoutTime;
378 }
379
380 //-------------------------------------------------------------------------------------------------------
381 // Initialize the variables
382 //-------------------------------------------------------------------------------------------------------
383 void ReliabilityLayer::InitializeVariables( void )
384 {
385 memset( orderedWriteIndex, 0, NUMBER_OF_ORDERED_STREAMS * sizeof(OrderingIndexType));
386 memset( sequencedWriteIndex, 0, NUMBER_OF_ORDERED_STREAMS * sizeof(OrderingIndexType) );
387 memset( orderedReadIndex, 0, NUMBER_OF_ORDERED_STREAMS * sizeof(OrderingIndexType) );
388 memset( highestSequencedReadIndex, 0, NUMBER_OF_ORDERED_STREAMS * sizeof(OrderingIndexType) );
389 memset( &statistics, 0, sizeof( statistics ) );
390 memset( &heapIndexOffsets, 0, sizeof( heapIndexOffsets ) );
391
392 statistics.connectionStartTime = SLNet::GetTimeUS();
393 splitPacketId = 0;
394 elapsedTimeSinceLastUpdate=0;
395 throughputCapCountdown=0;
396 sendReliableMessageNumberIndex = 0;
397 internalOrderIndex=0;
398 timeToNextUnreliableCull=0;
399 unreliableLinkedListHead=0;
400 lastUpdateTime= SLNet::GetTimeUS();
401 bandwidthExceededStatistic=false;
402 remoteSystemTime=0;
403 unreliableTimeout=0;
404 lastBpsClear=0;
405
406 // Disable packet pairs
407 countdownToNextPacketPair=15;
408
409 nextAllowedThroughputSample=0;
410 deadConnection = cheater = false;
411 timeOfLastContinualSend=0;
412
413 // timeResendQueueNonEmpty = 0;
414 timeLastDatagramArrived= SLNet::GetTimeMS();
415 // packetlossThisSample=false;
416 // backoffThisSample=0;
417 // packetlossThisSampleResendCount=0;
418 // lastPacketlossTime=0;
419 statistics.messagesInResendBuffer=0;
420 statistics.bytesInResendBuffer=0;
421
422 receivedPacketsBaseIndex=0;
423 resetReceivedPackets=true;
424 receivePacketCount=0;
425
426 // SetPing( 1000 );
427
428 timeBetweenPackets=STARTING_TIME_BETWEEN_PACKETS;
429
430 ackPingIndex=0;
431 ackPingSum=(CCTimeType)0;
432
433 nextSendTime=lastUpdateTime;
434 //nextLowestPingReset=(CCTimeType)0;
435 // continuousSend=false;
436
437 // histogramStart=(CCTimeType)0;
438 // histogramBitsSent=0;
439 unacknowledgedBytes=0;
440 resendLinkedListHead=0;
441 totalUserDataBytesAcked=0;
442
443 datagramHistoryPopCount=0;
444
445 InitHeapWeights();
446 for (int i=0; i < NUMBER_OF_PRIORITIES; i++)
447 {
448 statistics.messageInSendBuffer[i]=0;
449 statistics.bytesInSendBuffer[i]=0.0;
450 }
451
452 for (int i=0; i < RNS_PER_SECOND_METRICS_COUNT; i++)
453 {
454 bpsMetrics[i].Reset(_FILE_AND_LINE_);
455 }
456 }
457
458 //-------------------------------------------------------------------------------------------------------
459 // Frees all allocated memory
460 //-------------------------------------------------------------------------------------------------------
461 void ReliabilityLayer::FreeMemory( bool freeAllImmediately )
462 {
463 (void) freeAllImmediately;
464 FreeThreadSafeMemory();
465 }
466
467 void ReliabilityLayer::FreeThreadSafeMemory( void )
468 {
469 unsigned i,j;
470 InternalPacket *internalPacket;
471
472 ClearPacketsAndDatagrams();
473
474 for (i=0; i < splitPacketChannelList.Size(); i++)
475 {
476 for (j=0; j < splitPacketChannelList[i]->splitPacketList.Size(); j++)
477 {
478 FreeInternalPacketData(splitPacketChannelList[i]->splitPacketList[j], _FILE_AND_LINE_ );
479 ReleaseToInternalPacketPool( splitPacketChannelList[i]->splitPacketList[j] );
480 }
481 #if PREALLOCATE_LARGE_MESSAGES==1
482 if (splitPacketChannelList[i]->returnedPacket)
483 {
484 FreeInternalPacketData(splitPacketChannelList[i]->returnedPacket, __FILE__, __LINE__ );
485 ReleaseToInternalPacketPool( splitPacketChannelList[i]->returnedPacket );
486 }
487 #endif
488 SLNet::OP_DELETE(splitPacketChannelList[i], __FILE__, __LINE__);
489 }
490 splitPacketChannelList.Clear(false, _FILE_AND_LINE_);
491
492 while ( outputQueue.Size() > 0 )
493 {
494 internalPacket = outputQueue.Pop();
495 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
496 ReleaseToInternalPacketPool( internalPacket );
497 }
498
499 outputQueue.ClearAndForceAllocation( 32, _FILE_AND_LINE_ );
500
501 /*
502 for ( i = 0; i < orderingList.Size(); i++ )
503 {
504 if ( orderingList[ i ] )
505 {
506 DataStructures::LinkedList<InternalPacket*>* theList = orderingList[ i ];
507
508 if ( theList )
509 {
510 while ( theList->Size() )
511 {
512 internalPacket = orderingList[ i ]->Pop();
513 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
514 ReleaseToInternalPacketPool( internalPacket );
515 }
516
517 SLNet::OP_DELETE(theList, _FILE_AND_LINE_);
518 }
519 }
520 }
521
522 orderingList.Clear(false, _FILE_AND_LINE_);
523 */
524
525 for (i=0; i < NUMBER_OF_ORDERED_STREAMS; i++)
526 {
527 for (j=0; j < orderingHeaps[i].Size(); j++)
528 {
529 FreeInternalPacketData(orderingHeaps[i][j], _FILE_AND_LINE_ );
530 ReleaseToInternalPacketPool( orderingHeaps[i][j] );
531 }
532 orderingHeaps[i].Clear(true, _FILE_AND_LINE_);
533 }
534
535 //resendList.ForEachData(DeleteInternalPacket);
536 // resendTree.Clear(_FILE_AND_LINE_);
537 memset(resendBuffer, 0, sizeof(resendBuffer));
538 statistics.messagesInResendBuffer=0;
539 statistics.bytesInResendBuffer=0;
540
541 if (resendLinkedListHead)
542 {
543 InternalPacket *prev;
544 InternalPacket *iter = resendLinkedListHead;
545
546 for(;;)
547 {
548 if (iter->data)
549 FreeInternalPacketData(iter, _FILE_AND_LINE_ );
550 prev=iter;
551 iter=iter->resendNext;
552 if (iter==resendLinkedListHead)
553 {
554 ReleaseToInternalPacketPool(prev);
555 break;
556 }
557 ReleaseToInternalPacketPool(prev);
558 }
559 resendLinkedListHead=0;
560 }
561 unacknowledgedBytes=0;
562
563 // acknowlegements.Clear(_FILE_AND_LINE_);
564
565 for ( j=0 ; j < outgoingPacketBuffer.Size(); j++ )
566 {
567 if ( outgoingPacketBuffer[ j ]->data)
568 FreeInternalPacketData( outgoingPacketBuffer[ j ], _FILE_AND_LINE_ );
569 ReleaseToInternalPacketPool( outgoingPacketBuffer[ j ] );
570 }
571
572 outgoingPacketBuffer.Clear(true, _FILE_AND_LINE_);
573
574 #ifdef _DEBUG
575 for (i = 0; i < delayList.Size(); i++ )
576 SLNet::OP_DELETE(delayList[ i ], __FILE__, __LINE__);
577 delayList.Clear(__FILE__, __LINE__);
578 #endif
579
580 unreliableWithAckReceiptHistory.Clear(false, _FILE_AND_LINE_);
581
582 packetsToSendThisUpdate.Clear(false, _FILE_AND_LINE_);
583 packetsToSendThisUpdate.Preallocate(512, _FILE_AND_LINE_);
584 packetsToDeallocThisUpdate.Clear(false, _FILE_AND_LINE_);
585 packetsToDeallocThisUpdate.Preallocate(512, _FILE_AND_LINE_);
586 packetsToSendThisUpdateDatagramBoundaries.Clear(false, _FILE_AND_LINE_);
587 packetsToSendThisUpdateDatagramBoundaries.Preallocate(128, _FILE_AND_LINE_);
588 datagramSizesInBytes.Clear(false, _FILE_AND_LINE_);
589 datagramSizesInBytes.Preallocate(128, _FILE_AND_LINE_);
590
591 internalPacketPool.Clear(_FILE_AND_LINE_);
592
593 refCountedDataPool.Clear(_FILE_AND_LINE_);
594
595 /*
596 DataStructures::Page<DatagramSequenceNumberType, DatagramMessageIDList*, RESEND_TREE_ORDER> *cur = datagramMessageIDTree.GetListHead();
597 while (cur)
598 {
599 int treeIndex;
600 for (treeIndex=0; treeIndex < cur->size; treeIndex++)
601 ReleaseToDatagramMessageIDPool(cur->data[treeIndex]);
602 cur=cur->resendNext;
603 }
604 datagramMessageIDTree.Clear(_FILE_AND_LINE_);
605 datagramMessageIDPool.Clear(_FILE_AND_LINE_);
606 */
607
608 while (datagramHistory.Size())
609 {
610 RemoveFromDatagramHistory(datagramHistoryPopCount);
611 datagramHistory.Pop();
612 datagramHistoryPopCount++;
613 }
614 datagramHistoryMessagePool.Clear(_FILE_AND_LINE_);
615 datagramHistoryPopCount=0;
616
617 acknowlegements.Clear();
618 NAKs.Clear();
619
620 unreliableLinkedListHead=0;
621 }
622
623 //-------------------------------------------------------------------------------------------------------
624 // Packets are read directly from the socket layer and skip the reliability
625 //layer because unconnected players do not use the reliability layer
626 // This function takes packet data after a player has been confirmed as
627 //connected. The game should not use that data directly
628 // because some data is used internally, such as packet acknowledgment and
629 //split packets
630 //-------------------------------------------------------------------------------------------------------
631 bool ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(
632 const char *buffer, unsigned int length, SystemAddress &systemAddress, DataStructures::List<PluginInterface2*> &messageHandlerList, int MTUSize,
633 RakNetSocket2 *s, RakNetRandom *rnr, CCTimeType timeRead,
634 BitStream &updateBitStream)
635 {
636 #ifdef _DEBUG
637 RakAssert( !( buffer == 0 ) );
638 #endif
639
640 #if CC_TIME_TYPE_BYTES==4
641 timeRead/=1000;
642 #endif
643
644
645 bpsMetrics[(int) ACTUAL_BYTES_RECEIVED].Push1(timeRead,length);
646
647 (void) MTUSize;
648
649 if ( length <= 2 || buffer == 0 ) // Length of 1 is a connection request resend that we just ignore
650 {
651 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
652 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("length <= 2 || buffer == 0", BYTES_TO_BITS(length), systemAddress, true);
653 return true;
654 }
655
656 timeLastDatagramArrived= SLNet::GetTimeMS();
657
658 // CCTimeType time;
659 // bool indexFound;
660 // int count, size;
661 DatagramSequenceNumberType holeCount;
662 unsigned i;
663
664 #if LIBCAT_SECURITY==1
665 if (useSecurity)
666 {
667 unsigned int received = length;
668
669 if (!auth_enc.Decrypt((cat::u8*)buffer, received))
670 return false;
671
672 length = received;
673 }
674 #endif
675
676 SLNet::BitStream socketData( (unsigned char*) buffer, length, false ); // Convert the incoming data to a bitstream for easy parsing
677 // time = SLNet::GetTimeUS();
678
679 // Set to the current time if it is not zero, and we get incoming data
680 // if (timeResendQueueNonEmpty!=0)
681 // timeResendQueueNonEmpty=timeRead;
682
683 DatagramHeaderFormat dhf;
684 dhf.Deserialize(&socketData);
685 if (dhf.isValid==false)
686 {
687 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
688 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("dhf.isValid==false", BYTES_TO_BITS(length), systemAddress, true);
689
690 return true;
691 }
692 if (dhf.isACK)
693 {
694 DatagramSequenceNumberType datagramNumber;
695 // datagramNumber=dhf.datagramNumber;
696
697 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
698 SLNet::TimeMS timeMSLow=(SLNet::TimeMS) timeRead&0xFFFFFFFF;
699 CCTimeType rtt = timeMSLow-dhf.sourceSystemTime;
700 #if CC_TIME_TYPE_BYTES==4
701 if (rtt > 10000)
702 #else
703 if (rtt > 10000000)
704 #endif
705 {
706 // Sanity check. This could happen due to type overflow, especially since I only send the low 4 bytes to reduce bandwidth
707 rtt=(CCTimeType) congestionManager.GetRTT();
708 }
709 // RakAssert(rtt < 500000);
710 // printf("%i ", (SLNet::TimeMS)(rtt/1000));
711 ackPing=rtt;
712 #endif
713
714 #ifdef _DEBUG
715 if (dhf.hasBAndAS==false)
716 {
717 // dhf.B=0;
718 dhf.AS=0;
719 }
720 #endif
721 // congestionManager.OnAck(timeRead, rtt, dhf.hasBAndAS, dhf.B, dhf.AS, totalUserDataBytesAcked );
722
723
724 incomingAcks.Clear();
725 if (incomingAcks.Deserialize(&socketData)==false)
726 {
727 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
728 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("incomingAcks.Deserialize failed", BYTES_TO_BITS(length), systemAddress, true);
729
730 return false;
731 }
732
733 unsigned int k = 0;
734 while (k < unreliableWithAckReceiptHistory.Size()) {
735 if (incomingAcks.IsWithinRange(unreliableWithAckReceiptHistory[k].datagramNumber)) {
736 InternalPacket *ackReceipt = AllocateFromInternalPacketPool();
737 AllocInternalPacketData(ackReceipt, 5, false, _FILE_AND_LINE_);
738 ackReceipt->dataBitLength = BYTES_TO_BITS(5);
739 ackReceipt->data[0] = (MessageID)ID_SND_RECEIPT_ACKED;
740 memcpy(ackReceipt->data + sizeof(MessageID), &unreliableWithAckReceiptHistory[k].sendReceiptSerial, sizeof(uint32_t));
741 outputQueue.Push(ackReceipt, _FILE_AND_LINE_);
742
743 // Remove, swap with last
744 unreliableWithAckReceiptHistory.RemoveAtIndex(k);
745 } else {
746 k++;
747 }
748 }
749
750 // early out, if we've got no outstanding datagramHistory entries
751 if (datagramHistory.IsEmpty()) {
752 receivePacketCount++;
753 return true;
754 }
755
756 for (i = 0; i < incomingAcks.ranges.Size(); i++) {
757 // note: minIndex is ensured to be always <= maxIndex - otherwise Deserialize() would have failed
758 RakAssert(incomingAcks.ranges[i].minIndex <= incomingAcks.ranges[i].maxIndex);
759
760 if (incomingAcks.ranges[i].maxIndex == (uint24_t)(0xFFFFFFFF)) {
761 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
762 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("incomingAcks maxIndex is max value", BYTES_TO_BITS(length), systemAddress, true);
763 return false;
764 }
765
766 for (datagramNumber = incomingAcks.ranges[i].minIndex; datagramNumber <= incomingAcks.ranges[i].maxIndex; datagramNumber++) {
767 const DatagramSequenceNumberType offsetIntoList = datagramNumber - datagramHistoryPopCount;
768 if (offsetIntoList >= datagramHistory.Size()) {
769 // reached the end of the datagramHistory list - hence, we are done
770 receivePacketCount++;
771 return true;
772 }
773
774 CCTimeType whenSent;
775 MessageNumberNode *messageNumberNode = GetMessageNumberNodeByDatagramIndex(datagramNumber, &whenSent);
776 if (messageNumberNode)
777 {
778 // printf("%p Got ack for %i\n", this, datagramNumber.val);
779 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
780 congestionManager.OnAck(timeRead, rtt, dhf.hasBAndAS, 0, dhf.AS, totalUserDataBytesAcked, bandwidthExceededStatistic, datagramNumber );
781 #else
782 CCTimeType ping;
783 if (timeRead>whenSent)
784 ping=timeRead-whenSent;
785 else
786 ping=0;
787 congestionManager.OnAck(timeRead, ping, dhf.hasBAndAS, 0, dhf.AS, totalUserDataBytesAcked, bandwidthExceededStatistic, datagramNumber );
788 #endif
789 while (messageNumberNode)
790 {
791 // TESTING1
792 // printf("Remove %i on ack for datagramNumber=%i.\n", messageNumberNode->messageNumber.val, datagramNumber.val);
793
794 RemovePacketFromResendListAndDeleteOlderReliableSequenced( messageNumberNode->messageNumber, timeRead, messageHandlerList, systemAddress );
795 messageNumberNode=messageNumberNode->next;
796 }
797
798 RemoveFromDatagramHistory(datagramNumber);
799 }
800 // else if (isReliable)
801 // {
802 // // Previously used slot, rather than empty unreliable slot
803 // printf("%p Ack %i is duplicate\n", this, datagramNumber.val);
804 //
805 // congestionManager.OnDuplicateAck(timeRead, datagramNumber);
806 // }
807 }
808 }
809 }
810 else if (dhf.isNAK)
811 {
812 // early out, if we've got no outstanding datagramHistory entries
813 if (datagramHistory.IsEmpty()) {
814 receivePacketCount++;
815 return true;
816 }
817
818 DatagramSequenceNumberType messageNumber;
819 DataStructures::RangeList<DatagramSequenceNumberType> incomingNAKs;
820 if (incomingNAKs.Deserialize(&socketData)==false)
821 {
822 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
823 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("incomingNAKs.Deserialize failed", BYTES_TO_BITS(length), systemAddress, true);
824
825 return false;
826 }
827 for (i=0; i<incomingNAKs.ranges.Size();i++)
828 {
829 // note: minIndex is ensured to be always <= maxIndex - otherwise Deserialize() would have failed
830 RakAssert(incomingNAKs.ranges[i].minIndex <= incomingNAKs.ranges[i].maxIndex);
831
832 if (incomingNAKs.ranges[i].maxIndex == (uint24_t)(0xFFFFFFFF)) {
833 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
834 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("incomingNAKs maxIndex is max value", BYTES_TO_BITS(length), systemAddress, true);
835
836 return false;
837 }
838 // Sanity check
839 //RakAssert(incomingNAKs.ranges[i].maxIndex.val-incomingNAKs.ranges[i].minIndex.val<1000);
840 for (messageNumber = incomingNAKs.ranges[i].minIndex; messageNumber <= incomingNAKs.ranges[i].maxIndex; messageNumber++)
841 {
842 congestionManager.OnNAK(timeRead, messageNumber);
843
844 // REMOVEME
845 // printf("%p NAK %i\n", this, dhf.datagramNumber.val);
846
847
848 const DatagramSequenceNumberType offsetIntoList = messageNumber - datagramHistoryPopCount;
849 if (offsetIntoList >= datagramHistory.Size()) {
850 // reached the end of the datagramHistory list - hence, we are done
851 receivePacketCount++;
852 return true;
853 }
854
855 CCTimeType timeSent;
856 MessageNumberNode *messageNumberNode = GetMessageNumberNodeByDatagramIndex(messageNumber, &timeSent);
857 while (messageNumberNode)
858 {
859 // Update timers so resends occur immediately
860 InternalPacket *internalPacket = resendBuffer[messageNumberNode->messageNumber & (uint32_t) RESEND_BUFFER_ARRAY_MASK];
861 if (internalPacket)
862 {
863 if (internalPacket->nextActionTime!=0)
864 {
865 internalPacket->nextActionTime=timeRead;
866 }
867 }
868
869 messageNumberNode=messageNumberNode->next;
870 }
871 }
872 }
873 }
874 else
875 {
876 uint32_t skippedMessageCount;
877 if (!congestionManager.OnGotPacket(dhf.datagramNumber, dhf.isContinuousSend, timeRead, length, &skippedMessageCount))
878 {
879 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
880 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("congestionManager.OnGotPacket failed", BYTES_TO_BITS(length), systemAddress, true);
881
882 return true;
883 }
884 if (dhf.isPacketPair)
885 congestionManager.OnGotPacketPair(dhf.datagramNumber, length, timeRead);
886
887 DatagramHeaderFormat dhfNAK;
888 dhfNAK.isNAK=true;
889 uint32_t skippedMessageOffset;
890 for (skippedMessageOffset=skippedMessageCount; skippedMessageOffset > 0; skippedMessageOffset--)
891 {
892 NAKs.Insert(dhf.datagramNumber-skippedMessageOffset);
893 }
894 remoteSystemNeedsBAndAS=dhf.needsBAndAs;
895
896 // Ack dhf.datagramNumber
897 // Ack even unreliable messages for congestion control, just don't resend them on no ack
898 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
899 SendAcknowledgementPacket( dhf.datagramNumber, dhf.sourceSystemTime);
900 #else
901 SendAcknowledgementPacket( dhf.datagramNumber, 0);
902 #endif
903
904 InternalPacket* internalPacket = CreateInternalPacketFromBitStream( &socketData, timeRead );
905 if (internalPacket==0)
906 {
907 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
908 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("CreateInternalPacketFromBitStream failed", BYTES_TO_BITS(length), systemAddress, true);
909
910 return true;
911 }
912
913 while ( internalPacket )
914 {
915 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
916 {
917 #if CC_TIME_TYPE_BYTES==4
918 messageHandlerList[messageHandlerIndex]->OnInternalPacket(internalPacket, receivePacketCount, systemAddress, timeRead, false);
919 #else
920 messageHandlerList[messageHandlerIndex]->OnInternalPacket(internalPacket, receivePacketCount, systemAddress, (SLNet::TimeMS)(timeRead/(CCTimeType)1000), false);
921 #endif
922 }
923
924 {
925
926 // resetReceivedPackets is set from a non-threadsafe function.
927 // We do the actual reset in this function so the data is not modified by multiple threads
928 if (resetReceivedPackets)
929 {
930 hasReceivedPacketQueue.ClearAndForceAllocation(DEFAULT_HAS_RECEIVED_PACKET_QUEUE_SIZE, _FILE_AND_LINE_);
931 receivedPacketsBaseIndex=0;
932 resetReceivedPackets=false;
933 }
934
935 // Check for corrupt orderingChannel
936 if (
937 internalPacket->reliability == RELIABLE_SEQUENCED ||
938 internalPacket->reliability == UNRELIABLE_SEQUENCED ||
939 internalPacket->reliability == RELIABLE_ORDERED
940 )
941 {
942 if ( internalPacket->orderingChannel >= NUMBER_OF_ORDERED_STREAMS )
943 {
944 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
945 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("internalPacket->orderingChannel >= NUMBER_OF_ORDERED_STREAMS", BYTES_TO_BITS(length), systemAddress, true);
946
947 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_IGNORED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
948
949 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
950 ReleaseToInternalPacketPool( internalPacket );
951 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
952 }
953 }
954
955 // 8/12/09 was previously not checking if the message was reliable. However, on packetloss this would mean you'd eventually exceed the
956 // hole count because unreliable messages were never resent, and you'd stop getting messages
957 if (internalPacket->reliability == RELIABLE || internalPacket->reliability == RELIABLE_SEQUENCED || internalPacket->reliability == RELIABLE_ORDERED )
958 {
959 // If the following conditional is true then this either a duplicate packet
960 // or an older out of order packet
961 // The subtraction unsigned overflow is intentional
962 holeCount = (DatagramSequenceNumberType)(internalPacket->reliableMessageNumber-receivedPacketsBaseIndex);
963 const DatagramSequenceNumberType typeRange = (DatagramSequenceNumberType)(const uint32_t)-1;
964
965 // TESTING1
966 // printf("waiting on reliableMessageNumber=%i holeCount=%i datagramNumber=%i\n", receivedPacketsBaseIndex.val, holeCount.val, dhf.datagramNumber.val);
967
968 if (holeCount==(DatagramSequenceNumberType) 0)
969 {
970 // Got what we were expecting
971 if (hasReceivedPacketQueue.Size())
972 hasReceivedPacketQueue.Pop();
973 ++receivedPacketsBaseIndex;
974 }
975 else if (holeCount > typeRange/(DatagramSequenceNumberType) 2)
976 {
977 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_IGNORED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
978
979 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
980 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("holeCount > typeRange/(DatagramSequenceNumberType) 2", BYTES_TO_BITS(length), systemAddress, false);
981
982 // Duplicate packet
983 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
984 ReleaseToInternalPacketPool( internalPacket );
985
986 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
987 }
988 else if ((unsigned int) holeCount<hasReceivedPacketQueue.Size())
989 {
990 // Got a higher count out of order packet that was missing in the sequence or we already got
991 if (hasReceivedPacketQueue[holeCount]!=false) // non-zero means this is a hole
992 {
993 #ifdef LOG_TRIVIAL_NOTIFICATIONS
994 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
995 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("Higher count pushed to hasReceivedPacketQueue", BYTES_TO_BITS(length), systemAddress, false);
996 #endif
997
998 // Fill in the hole
999 hasReceivedPacketQueue[holeCount]=false; // We got the packet at holeCount
1000 }
1001 else
1002 {
1003 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_IGNORED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1004
1005 #ifdef LOG_TRIVIAL_NOTIFICATIONS
1006 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
1007 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("Duplicate packet ignored", BYTES_TO_BITS(length), systemAddress, false);
1008 #endif
1009
1010 // Duplicate packet
1011 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
1012 ReleaseToInternalPacketPool( internalPacket );
1013
1014 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1015 }
1016 }
1017 else // holeCount>=receivedPackets.Size()
1018 {
1019 if (holeCount > (DatagramSequenceNumberType) 1000000)
1020 {
1021 RakAssert("Hole count too high. See ReliabilityLayer.h" && 0);
1022
1023 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
1024 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("holeCount > 1000000", BYTES_TO_BITS(length), systemAddress, true);
1025
1026 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_IGNORED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1027
1028 // Would crash due to out of memory!
1029 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
1030 ReleaseToInternalPacketPool( internalPacket );
1031
1032 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1033 }
1034
1035 #ifdef LOG_TRIVIAL_NOTIFICATIONS
1036 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
1037 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("Adding to hasReceivedPacketQueue later ordered message", BYTES_TO_BITS(length), systemAddress, false);
1038 #endif
1039
1040 // Fix - sending on a higher priority gives us a very very high received packets base index if we formerly had pre-split a lot of messages and
1041 // used that as the message number. Because of this, a lot of time is spent in this linear loop and the timeout time expires because not
1042 // all of the message is sent in time.
1043 // Fixed by late assigning message IDs on the sender
1044
1045 // Add 0 times to the queue until (reliableMessageNumber - baseIndex) < queue size.
1046 while ((unsigned int)(holeCount) > hasReceivedPacketQueue.Size())
1047 hasReceivedPacketQueue.Push(true, _FILE_AND_LINE_ ); // time+(CCTimeType)60 * (CCTimeType)1000 * (CCTimeType)1000); // Didn't get this packet - set the time to give up waiting
1048 hasReceivedPacketQueue.Push(false, _FILE_AND_LINE_ ); // Got the packet
1049 #ifdef _DEBUG
1050 // If this assert hits then DatagramSequenceNumberType has overflowed
1051 RakAssert(hasReceivedPacketQueue.Size() < (unsigned int)((DatagramSequenceNumberType)(const uint32_t)(-1)));
1052 #endif
1053 }
1054
1055 while ( hasReceivedPacketQueue.Size()>0 && hasReceivedPacketQueue.Peek()==false )
1056 {
1057 hasReceivedPacketQueue.Pop();
1058 ++receivedPacketsBaseIndex;
1059 }
1060 }
1061
1062 // If the allocated buffer is > DEFAULT_HAS_RECEIVED_PACKET_QUEUE_SIZE and it is 3x greater than the number of elements actually being used
1063 if (hasReceivedPacketQueue.AllocationSize() > (unsigned int) DEFAULT_HAS_RECEIVED_PACKET_QUEUE_SIZE && hasReceivedPacketQueue.AllocationSize() > hasReceivedPacketQueue.Size() * 3)
1064 hasReceivedPacketQueue.Compress(_FILE_AND_LINE_);
1065
1066
1067 /*
1068 if ( internalPacket->reliability == RELIABLE_SEQUENCED || internalPacket->reliability == UNRELIABLE_SEQUENCED )
1069 {
1070 #ifdef _DEBUG
1071 RakAssert( internalPacket->orderingChannel < NUMBER_OF_ORDERED_STREAMS );
1072 #endif
1073
1074 if ( internalPacket->orderingChannel >= NUMBER_OF_ORDERED_STREAMS )
1075 {
1076
1077 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
1078 ReleaseToInternalPacketPool( internalPacket );
1079
1080 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
1081 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("internalPacket->orderingChannel >= NUMBER_OF_ORDERED_STREAMS", BYTES_TO_BITS(length), systemAddress);
1082
1083 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_IGNORED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1084
1085 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1086 }
1087
1088 if ( IsOlderOrderedPacket( internalPacket->orderingIndex, waitingForSequencedPacketReadIndex[ internalPacket->orderingChannel ] ) == false )
1089 {
1090 // Is this a split packet?
1091 if ( internalPacket->splitPacketCount > 0 )
1092 {
1093 // Generate the split
1094 // Verify some parameters to make sure we don't get junk data
1095
1096
1097 // Check for a rebuilt packet
1098 InsertIntoSplitPacketList( internalPacket, timeRead );
1099 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_PROCESSED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1100
1101 // Sequenced
1102 internalPacket = BuildPacketFromSplitPacketList( internalPacket->splitPacketId, timeRead,
1103 s, systemAddress, rnr, remotePortRakNetWasStartedOn_PS3, extraSocketOptions);
1104
1105 if ( internalPacket )
1106 {
1107 // Update our index to the newest packet
1108 waitingForSequencedPacketReadIndex[ internalPacket->orderingChannel ] = internalPacket->orderingIndex + (OrderingIndexType)1;
1109
1110 // If there is a rebuilt packet, add it to the output queue
1111 outputQueue.Push( internalPacket, _FILE_AND_LINE_ );
1112 internalPacket = 0;
1113 }
1114
1115 // else don't have all the parts yet
1116 }
1117 else
1118 {
1119 // Update our index to the newest packet
1120 waitingForSequencedPacketReadIndex[ internalPacket->orderingChannel ] = internalPacket->orderingIndex + (OrderingIndexType)1;
1121
1122 // Not a split packet. Add the packet to the output queue
1123 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_PROCESSED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1124 outputQueue.Push( internalPacket, _FILE_AND_LINE_ );
1125 internalPacket = 0;
1126 }
1127 }
1128 else
1129 {
1130 // Older sequenced packet. Discard it
1131 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
1132 ReleaseToInternalPacketPool( internalPacket );
1133
1134 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_IGNORED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1135
1136 }
1137
1138 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1139 }
1140
1141 // Is this an unsequenced split packet?
1142 if ( internalPacket->splitPacketCount > 0 )
1143 {
1144 // Check for a rebuilt packet
1145 if ( internalPacket->reliability != RELIABLE_ORDERED )
1146 internalPacket->orderingChannel = 255; // Use 255 to designate not sequenced and not ordered
1147
1148 InsertIntoSplitPacketList( internalPacket, timeRead );
1149
1150 internalPacket = BuildPacketFromSplitPacketList( internalPacket->splitPacketId, timeRead,
1151 s, systemAddress, rnr, remotePortRakNetWasStartedOn_PS3, extraSocketOptions);
1152
1153 if ( internalPacket == 0 )
1154 {
1155
1156 // Don't have all the parts yet
1157 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1158 }
1159 }
1160 */
1161
1162 /*
1163 if ( internalPacket->reliability == RELIABLE_ORDERED )
1164 {
1165 #ifdef _DEBUG
1166 RakAssert( internalPacket->orderingChannel < NUMBER_OF_ORDERED_STREAMS );
1167 #endif
1168
1169 if ( internalPacket->orderingChannel >= NUMBER_OF_ORDERED_STREAMS )
1170 {
1171 // Invalid packet
1172 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
1173 ReleaseToInternalPacketPool( internalPacket );
1174
1175 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_IGNORED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1176
1177 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1178 }
1179
1180 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_PROCESSED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1181
1182 if ( waitingForOrderedPacketReadIndex[ internalPacket->orderingChannel ] == internalPacket->orderingIndex )
1183 {
1184 // Get the list to hold ordered packets for this stream
1185 DataStructures::LinkedList<InternalPacket*> *orderingListAtOrderingStream;
1186 unsigned char orderingChannelCopy = internalPacket->orderingChannel;
1187
1188 // Push the packet for the user to read
1189 outputQueue.Push( internalPacket, _FILE_AND_LINE_ );
1190 internalPacket = 0; // Don't reference this any longer since other threads access it
1191
1192 // Wait for the resendNext ordered packet in sequence
1193 waitingForOrderedPacketReadIndex[ orderingChannelCopy ] ++; // This wraps
1194
1195 orderingListAtOrderingStream = GetOrderingListAtOrderingStream( orderingChannelCopy );
1196
1197 if ( orderingListAtOrderingStream != 0)
1198 {
1199 while ( orderingListAtOrderingStream->Size() > 0 )
1200 {
1201 // Cycle through the list until nothing is found
1202 orderingListAtOrderingStream->Beginning();
1203 indexFound=false;
1204 size=orderingListAtOrderingStream->Size();
1205 count=0;
1206
1207 while (count++ < size)
1208 {
1209 if ( orderingListAtOrderingStream->Peek()->orderingIndex == waitingForOrderedPacketReadIndex[ orderingChannelCopy ] )
1210 {
1211 outputQueue.Push( orderingListAtOrderingStream->Pop(), _FILE_AND_LINE_ );
1212 waitingForOrderedPacketReadIndex[ orderingChannelCopy ]++;
1213 indexFound=true;
1214 }
1215 else
1216 (*orderingListAtOrderingStream)++;
1217 }
1218
1219 if (indexFound==false)
1220 break;
1221 }
1222 }
1223 internalPacket = 0;
1224 }
1225 else
1226 {
1227 // This is a newer ordered packet than we are waiting for. Store it for future use
1228 AddToOrderingList( internalPacket );
1229 }
1230
1231
1232 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1233 }
1234 */
1235
1236 // Is this a split packet? If so then reassemble
1237 if ( internalPacket->splitPacketCount > 0 )
1238 {
1239 // Check for a rebuilt packet
1240 if ( internalPacket->reliability != RELIABLE_ORDERED && internalPacket->reliability!=RELIABLE_SEQUENCED && internalPacket->reliability!=UNRELIABLE_SEQUENCED)
1241 internalPacket->orderingChannel = 255; // Use 255 to designate not sequenced and not ordered
1242
1243 InsertIntoSplitPacketList( internalPacket, timeRead );
1244
1245 internalPacket = BuildPacketFromSplitPacketList( internalPacket->splitPacketId, timeRead,
1246 s, systemAddress, rnr, updateBitStream);
1247
1248 if ( internalPacket == 0 )
1249 {
1250 #ifdef LOG_TRIVIAL_NOTIFICATIONS
1251 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
1252 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("BuildPacketFromSplitPacketList did not return anything.", BYTES_TO_BITS(length), systemAddress, false);
1253 #endif
1254
1255 // Don't have all the parts yet
1256 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1257 }
1258 }
1259
1260 #ifdef PRINT_TO_FILE_RELIABLE_ORDERED_TEST
1261 unsigned char packetId;
1262 char *type="UNDEFINED";
1263 #endif
1264 if (internalPacket->reliability == RELIABLE_SEQUENCED ||
1265 internalPacket->reliability == UNRELIABLE_SEQUENCED ||
1266 internalPacket->reliability == RELIABLE_ORDERED)
1267 {
1268 #ifdef PRINT_TO_FILE_RELIABLE_ORDERED_TEST
1269
1270 // ___________________
1271 BitStream bitStream(internalPacket->data, BITS_TO_BYTES(internalPacket->dataBitLength), false);
1272 unsigned int receivedPacketNumber;
1273 SLNet::Time receivedTime;
1274 unsigned char streamNumber;
1275 PacketReliability reliability;
1276 // ___________________
1277
1278
1279 bitStream.IgnoreBits(8); // Ignore ID_TIMESTAMP
1280 bitStream.Read(receivedTime);
1281 bitStream.Read(packetId);
1282 bitStream.Read(receivedPacketNumber);
1283 bitStream.Read(streamNumber);
1284 bitStream.Read(reliability);
1285 if (packetId==ID_USER_PACKET_ENUM+1)
1286 {
1287
1288 if (reliability==UNRELIABLE_SEQUENCED)
1289 type="UNRELIABLE_SEQUENCED";
1290 else if (reliability==RELIABLE_ORDERED)
1291 type="RELIABLE_ORDERED";
1292 else
1293 type="RELIABLE_SEQUENCED";
1294 }
1295 // ___________________
1296 #endif
1297
1298
1299 if (internalPacket->orderingIndex==orderedReadIndex[internalPacket->orderingChannel])
1300 {
1301 // Has current ordering index
1302 if (internalPacket->reliability == RELIABLE_SEQUENCED ||
1303 internalPacket->reliability == UNRELIABLE_SEQUENCED)
1304 {
1305 // Is sequenced
1306 if (IsOlderOrderedPacket(internalPacket->sequencingIndex,highestSequencedReadIndex[internalPacket->orderingChannel])==false)
1307 {
1308 // Expected or highest known value
1309
1310 #ifdef PRINT_TO_FILE_RELIABLE_ORDERED_TEST
1311 if (packetId==ID_USER_PACKET_ENUM+1 && fp)
1312 {
1313 fprintf(fp, "Returning %i, %s by fallthrough. OI=%i. SI=%i.\n", receivedPacketNumber, type, internalPacket->orderingIndex.val, internalPacket->sequencingIndex);
1314 fflush(fp);
1315 }
1316
1317 if (packetId==ID_USER_PACKET_ENUM+1)
1318 {
1319 if (receivedPacketNumber<packetNumber)
1320 {
1321 if (fp)
1322 {
1323 fprintf(fp, "Out of order packet from fallthrough! Expecting %i got %i\n", receivedPacketNumber, packetNumber);
1324 fflush(fp);
1325 }
1326 }
1327 packetNumber=receivedPacketNumber+1;
1328 }
1329 #endif
1330 // Update highest sequence
1331 // 6/26/2012 - Did not have the +1 in the next statement
1332 // Means a duplicated RELIABLE_SEQUENCED or UNRELIABLE_SEQUENCED packet would be returned to the user
1333 highestSequencedReadIndex[internalPacket->orderingChannel] = internalPacket->sequencingIndex+(OrderingIndexType)1;
1334
1335 // Fallthrough, returned to user below
1336 }
1337 else
1338 {
1339 #ifdef PRINT_TO_FILE_RELIABLE_ORDERED_TEST
1340 if (packetId==ID_USER_PACKET_ENUM+1 && fp)
1341 {
1342 fprintf(fp, "Discarding %i, %s late sequenced. OI=%i. SI=%i.\n", receivedPacketNumber, type, internalPacket->orderingIndex.val, internalPacket->sequencingIndex);
1343 fflush(fp);
1344 }
1345 #endif
1346
1347 #ifdef LOG_TRIVIAL_NOTIFICATIONS
1348 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
1349 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("Sequenced rejected: lower than highest known value", BYTES_TO_BITS(length), systemAddress, false);
1350 #endif
1351
1352 // Lower than highest known value
1353 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
1354 ReleaseToInternalPacketPool( internalPacket );
1355
1356 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1357 }
1358 }
1359 else
1360 {
1361 // Push to output buffer immediately
1362 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_PROCESSED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1363 outputQueue.Push( internalPacket, _FILE_AND_LINE_ );
1364
1365 #ifdef PRINT_TO_FILE_RELIABLE_ORDERED_TEST
1366 if (packetId==ID_USER_PACKET_ENUM+1 && fp)
1367 {
1368 fprintf(fp, "outputting immediate %i, %s. OI=%i. SI=%i.", receivedPacketNumber, type, internalPacket->orderingIndex.val, internalPacket->sequencingIndex);
1369 if (orderingHeaps[internalPacket->orderingChannel].Size()==0)
1370 fprintf(fp, "heap empty\n");
1371 else
1372 fprintf(fp, "heap head=%i\n", orderingHeaps[internalPacket->orderingChannel].Peek()->orderingIndex.val);
1373
1374 if (receivedPacketNumber<packetNumber)
1375 {
1376 if (packetId==ID_USER_PACKET_ENUM+1 && fp)
1377 {
1378 fprintf(fp, "Out of order packet arrived! Expecting %i got %i\n", receivedPacketNumber, packetNumber);
1379 fflush(fp);
1380 }
1381 }
1382 packetNumber=receivedPacketNumber+1;
1383
1384 fflush(fp);
1385 }
1386 #endif
1387
1388 orderedReadIndex[internalPacket->orderingChannel]++;
1389 highestSequencedReadIndex[internalPacket->orderingChannel] = 0;
1390
1391 // Return off heap until order lost
1392 while (orderingHeaps[internalPacket->orderingChannel].Size()>0 &&
1393 orderingHeaps[internalPacket->orderingChannel].Peek()->orderingIndex==orderedReadIndex[internalPacket->orderingChannel])
1394 {
1395 internalPacket = orderingHeaps[internalPacket->orderingChannel].Pop(0);
1396
1397 #ifdef PRINT_TO_FILE_RELIABLE_ORDERED_TEST
1398 BitStream bitStream2(internalPacket->data, BITS_TO_BYTES(internalPacket->dataBitLength), false);
1399 bitStream2.IgnoreBits(8); // Ignore ID_TIMESTAMP
1400 bitStream2.Read(receivedTime);
1401 bitStream2.IgnoreBits(8); // Ignore ID_USER_ENUM+1
1402 bitStream2.Read(receivedPacketNumber);
1403 bitStream2.Read(streamNumber);
1404 bitStream2.Read(reliability);
1405 char *type="UNDEFINED";
1406 if (reliability==UNRELIABLE_SEQUENCED)
1407 type="UNRELIABLE_SEQUENCED";
1408 else if (reliability==RELIABLE_ORDERED)
1409 type="RELIABLE_ORDERED";
1410
1411 if (packetId==ID_USER_PACKET_ENUM+1 && fp)
1412 {
1413 fprintf(fp, "Heap pop %i, %s. OI=%i. SI=%i.\n", receivedPacketNumber, type, internalPacket->orderingIndex.val, internalPacket->sequencingIndex);
1414 fflush(fp);
1415
1416 if (receivedPacketNumber<packetNumber)
1417 {
1418 if (packetId==ID_USER_PACKET_ENUM+1 && fp)
1419 {
1420 fprintf(fp, "Out of order packet from heap! Expecting %i got %i\n", receivedPacketNumber, packetNumber);
1421 fflush(fp);
1422 }
1423 }
1424 packetNumber=receivedPacketNumber+1;
1425 }
1426 #endif
1427
1428 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_PROCESSED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1429 outputQueue.Push( internalPacket, _FILE_AND_LINE_ );
1430
1431 if (internalPacket->reliability == RELIABLE_ORDERED)
1432 {
1433 orderedReadIndex[internalPacket->orderingChannel]++;
1434 }
1435 else
1436 {
1437 highestSequencedReadIndex[internalPacket->orderingChannel] = internalPacket->sequencingIndex;
1438 }
1439 }
1440
1441 // Done
1442 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1443 }
1444 }
1445 else if (IsOlderOrderedPacket(internalPacket->orderingIndex,orderedReadIndex[internalPacket->orderingChannel])==false)
1446 {
1447 // internalPacket->_orderingIndex is greater
1448 // If a message has a greater ordering index, and is sequenced or ordered, buffer it
1449 // Sequenced has a lower heap weight, ordered has max sequenced weight
1450
1451 // Keep orderedHoleCount count small
1452 if (orderingHeaps[internalPacket->orderingChannel].Size()==0)
1453 heapIndexOffsets[internalPacket->orderingChannel]=orderedReadIndex[internalPacket->orderingChannel];
1454
1455 reliabilityHeapWeightType orderedHoleCount = internalPacket->orderingIndex-heapIndexOffsets[internalPacket->orderingChannel];
1456 reliabilityHeapWeightType weight = orderedHoleCount*1048576;
1457 if (internalPacket->reliability == RELIABLE_SEQUENCED ||
1458 internalPacket->reliability == UNRELIABLE_SEQUENCED)
1459 weight+=internalPacket->sequencingIndex;
1460 else
1461 weight+=(1048576-1);
1462 orderingHeaps[internalPacket->orderingChannel].Push(weight, internalPacket, _FILE_AND_LINE_);
1463
1464 #ifdef PRINT_TO_FILE_RELIABLE_ORDERED_TEST
1465 if (packetId==ID_USER_PACKET_ENUM+1 && fp)
1466 {
1467 fprintf(fp, "Heap push %i, %s, weight=%" PRINTF_64_BIT_MODIFIER "u. OI=%i. waiting on %i. SI=%i.\n", receivedPacketNumber, type, weight, internalPacket->orderingIndex.val, orderedReadIndex[internalPacket->orderingChannel].val, internalPacket->sequencingIndex);
1468 fflush(fp);
1469 }
1470 #endif
1471
1472 #ifdef LOG_TRIVIAL_NOTIFICATIONS
1473 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
1474 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("Larger number ordered packet leaving holes", BYTES_TO_BITS(length), systemAddress, false);
1475 #endif
1476
1477 // Buffered, nothing to do
1478 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1479 }
1480 else
1481 {
1482 // Out of order
1483 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
1484 ReleaseToInternalPacketPool( internalPacket );
1485
1486 #ifdef LOG_TRIVIAL_NOTIFICATIONS
1487 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
1488 messageHandlerList[messageHandlerIndex]->OnReliabilityLayerNotification("Rejected older resend", BYTES_TO_BITS(length), systemAddress, false);
1489 #endif
1490
1491 // Ignored, nothing to do
1492 goto CONTINUE_SOCKET_DATA_PARSE_LOOP;
1493 }
1494
1495 }
1496
1497 bpsMetrics[(int) USER_MESSAGE_BYTES_RECEIVED_PROCESSED].Push1(timeRead,BITS_TO_BYTES(internalPacket->dataBitLength));
1498
1499 // Nothing special about this packet. Add it to the output queue
1500 outputQueue.Push( internalPacket, _FILE_AND_LINE_ );
1501
1502 internalPacket = 0;
1503 }
1504
1505 // Used for a goto to jump to the resendNext packet immediately
1506
1507 CONTINUE_SOCKET_DATA_PARSE_LOOP:
1508 // Parse the bitstream to create an internal packet
1509 internalPacket = CreateInternalPacketFromBitStream( &socketData, timeRead );
1510 }
1511
1512 }
1513
1514
1515 receivePacketCount++;
1516
1517 return true;
1518 }
1519
1520 //-------------------------------------------------------------------------------------------------------
1521 // This gets an end-user packet already parsed out. Returns number of BITS put into the buffer
1522 //-------------------------------------------------------------------------------------------------------
1523 BitSize_t ReliabilityLayer::Receive( unsigned char **data )
1524 {
1525 InternalPacket * internalPacket;
1526
1527 if ( outputQueue.Size() > 0 )
1528 {
1529 // #ifdef _DEBUG
1530 // RakAssert(bitStream->GetNumberOfBitsUsed()==0);
1531 // #endif
1532 internalPacket = outputQueue.Pop();
1533
1534 BitSize_t bitLength;
1535 *data = internalPacket->data;
1536 bitLength = internalPacket->dataBitLength;
1537 ReleaseToInternalPacketPool( internalPacket );
1538 return bitLength;
1539 }
1540
1541 else
1542 {
1543 return 0;
1544 }
1545
1546 }
1547
1548 //-------------------------------------------------------------------------------------------------------
1549 // Puts data on the send queue
1550 // bitStream contains the data to send
1551 // priority is what priority to send the data at
1552 // reliability is what reliability to use
1553 // ordering channel is from 0 to 255 and specifies what stream to use
1554 //-------------------------------------------------------------------------------------------------------
1555 bool ReliabilityLayer::Send( char *data, BitSize_t numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, unsigned char orderingChannel, bool makeDataCopy, int MTUSize, CCTimeType currentTime, uint32_t receipt )
1556 {
1557 #ifdef _DEBUG
1558 RakAssert( !( reliability >= NUMBER_OF_RELIABILITIES || reliability < 0 ) );
1559 RakAssert( !( priority > NUMBER_OF_PRIORITIES || priority < 0 ) );
1560 RakAssert( !( orderingChannel >= NUMBER_OF_ORDERED_STREAMS ) );
1561 RakAssert( numberOfBitsToSend > 0 );
1562 #endif
1563
1564 #if CC_TIME_TYPE_BYTES==4
1565 currentTime/=1000;
1566 #endif
1567
1568 (void) MTUSize;
1569
1570 // int a = BITS_TO_BYTES(numberOfBitsToSend);
1571
1572 // Fix any bad parameters
1573 if ( reliability > RELIABLE_ORDERED_WITH_ACK_RECEIPT || reliability < 0 )
1574 reliability = RELIABLE;
1575
1576 if ( priority > NUMBER_OF_PRIORITIES || priority < 0 )
1577 priority = HIGH_PRIORITY;
1578
1579 if ( orderingChannel >= NUMBER_OF_ORDERED_STREAMS )
1580 orderingChannel = 0;
1581
1582 unsigned int numberOfBytesToSend=(unsigned int) BITS_TO_BYTES(numberOfBitsToSend);
1583 if ( numberOfBitsToSend == 0 )
1584 {
1585 return false;
1586 }
1587 InternalPacket * internalPacket = AllocateFromInternalPacketPool();
1588 if (internalPacket==0)
1589 {
1590 notifyOutOfMemory(_FILE_AND_LINE_);
1591 return false; // Out of memory
1592 }
1593
1594 bpsMetrics[(int) USER_MESSAGE_BYTES_PUSHED].Push1(currentTime,numberOfBytesToSend);
1595
1596 internalPacket->creationTime = currentTime;
1597
1598 if ( makeDataCopy )
1599 {
1600 AllocInternalPacketData(internalPacket, numberOfBytesToSend, true, _FILE_AND_LINE_ );
1601 //internalPacket->data = (unsigned char*) rakMalloc_Ex( numberOfBytesToSend, _FILE_AND_LINE_ );
1602 memcpy( internalPacket->data, data, numberOfBytesToSend );
1603 }
1604 else
1605 {
1606 // Allocated the data elsewhere, delete it in here
1607 //internalPacket->data = ( unsigned char* ) data;
1608 AllocInternalPacketData(internalPacket, (unsigned char*) data );
1609 }
1610
1611 internalPacket->dataBitLength = numberOfBitsToSend;
1612 internalPacket->messageInternalOrder = internalOrderIndex++;
1613 internalPacket->priority = priority;
1614 internalPacket->reliability = reliability;
1615 internalPacket->sendReceiptSerial=receipt;
1616
1617 // Calculate if I need to split the packet
1618 // int headerLength = BITS_TO_BYTES( GetMessageHeaderLengthBits( internalPacket, true ) );
1619
1620 unsigned int maxDataSizeBytes = GetMaxDatagramSizeExcludingMessageHeaderBytes() - BITS_TO_BYTES(GetMaxMessageHeaderLengthBits());
1621
1622 bool splitPacket = numberOfBytesToSend > maxDataSizeBytes;
1623
1624 // If a split packet, we might have to upgrade the reliability
1625 if ( splitPacket )
1626 {
1627 // Split packets cannot be unreliable, in case that one part doesn't arrive and the whole cannot be reassembled.
1628 // One part could not arrive either due to packetloss or due to unreliable discard
1629 if (internalPacket->reliability==UNRELIABLE)
1630 internalPacket->reliability=RELIABLE;
1631 else if (internalPacket->reliability==UNRELIABLE_WITH_ACK_RECEIPT)
1632 internalPacket->reliability=RELIABLE_WITH_ACK_RECEIPT;
1633 else if (internalPacket->reliability==UNRELIABLE_SEQUENCED)
1634 internalPacket->reliability=RELIABLE_SEQUENCED;
1635 // else if (internalPacket->reliability==UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT)
1636 // internalPacket->reliability=RELIABLE_SEQUENCED_WITH_ACK_RECEIPT;
1637 }
1638
1639 // ++sendMessageNumberIndex;
1640
1641 if ( internalPacket->reliability == RELIABLE_SEQUENCED ||
1642 internalPacket->reliability == UNRELIABLE_SEQUENCED
1643 // ||
1644 // internalPacket->reliability == RELIABLE_SEQUENCED_WITH_ACK_RECEIPT ||
1645 // internalPacket->reliability == UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT
1646 )
1647 {
1648 // Assign the sequence stream and index
1649 internalPacket->orderingChannel = orderingChannel;
1650 internalPacket->orderingIndex = orderedWriteIndex[ orderingChannel ];
1651 internalPacket->sequencingIndex = sequencedWriteIndex[ orderingChannel ]++;
1652
1653 // This packet supersedes all other sequenced packets on the same ordering channel
1654 // Delete all packets in all send lists that are sequenced and on the same ordering channel
1655 // UPDATE:
1656 // Disabled. We don't have enough info to consistently do this. Sometimes newer data does supercede
1657 // older data such as with constantly declining health, but not in all cases.
1658 // For example, with sequenced unreliable sound packets just because you send a newer one doesn't mean you
1659 // don't need the older ones because the odds are they will still arrive in order
1660 /*
1661 for (int i=0; i < NUMBER_OF_PRIORITIES; i++)
1662 {
1663 DeleteSequencedPacketsInList(orderingChannel, sendQueue[i]);
1664 }
1665 */
1666 }
1667 else if ( internalPacket->reliability == RELIABLE_ORDERED || internalPacket->reliability == RELIABLE_ORDERED_WITH_ACK_RECEIPT )
1668 {
1669 // Assign the ordering channel and index
1670 internalPacket->orderingChannel = orderingChannel;
1671 internalPacket->orderingIndex = orderedWriteIndex[ orderingChannel ] ++;
1672 sequencedWriteIndex[ orderingChannel ]=0;
1673 }
1674
1675 if ( splitPacket ) // If it uses a secure header it will be generated here
1676 {
1677 // Must split the packet. This will also generate the SHA1 if it is required. It also adds it to the send list.
1678 //InternalPacket packetCopy;
1679 //memcpy(&packetCopy, internalPacket, sizeof(InternalPacket));
1680 //sendPacketSet[priority].CancelWriteLock(internalPacket);
1681 //SplitPacket( &packetCopy, MTUSize );
1682 SplitPacket( internalPacket );
1683 //SLNet::OP_DELETE_ARRAY(packetCopy.data, _FILE_AND_LINE_);
1684 return true;
1685 }
1686
1687 RakAssert(internalPacket->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
1688 AddToUnreliableLinkedList(internalPacket);
1689
1690 RakAssert(internalPacket->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
1691 RakAssert(internalPacket->messageNumberAssigned==false);
1692 outgoingPacketBuffer.Push( GetNextWeight(internalPacket->priority), internalPacket, _FILE_AND_LINE_ );
1693 RakAssert(outgoingPacketBuffer.Size()==0 || outgoingPacketBuffer.Peek()->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
1694 statistics.messageInSendBuffer[(int)internalPacket->priority]++;
1695 statistics.bytesInSendBuffer[(int)internalPacket->priority]+=(double) BITS_TO_BYTES(internalPacket->dataBitLength);
1696
1697 // sendPacketSet[priority].WriteUnlock();
1698 return true;
1699 }
1700 //-------------------------------------------------------------------------------------------------------
1701 // Run this once per game cycle. Handles internal lists and actually does the send
1702 //-------------------------------------------------------------------------------------------------------
1703 void ReliabilityLayer::Update( RakNetSocket2 *s, SystemAddress &systemAddress, int MTUSize, CCTimeType time,
1704 unsigned bitsPerSecondLimit,
1705 DataStructures::List<PluginInterface2*> &messageHandlerList,
1706 RakNetRandom *rnr,
1707 BitStream &updateBitStream)
1708
1709 {
1710 (void) MTUSize;
1711
1712 SLNet::TimeMS timeMs;
1713 #if CC_TIME_TYPE_BYTES==4
1714 time/=1000;
1715 timeMs=time;
1716 #else
1717 timeMs=(SLNet::TimeMS) (time/(CCTimeType)1000);
1718 #endif
1719
1720 #ifdef _DEBUG
1721 while (delayList.Size())
1722 {
1723 if (delayList.Peek()->sendTime <= timeMs)
1724 {
1725 DataAndTime *dat = delayList.Pop();
1726 // SocketLayer::SendTo( dat->s, dat->data, dat->length, systemAddress, __FILE__, __LINE__ );
1727
1728 RNS2_SendParameters bsp;
1729 bsp.data = (char*) dat->data;
1730 bsp.length = dat->length;
1731 bsp.systemAddress = systemAddress;
1732 dat->s->Send(&bsp, _FILE_AND_LINE_);
1733
1734 SLNet::OP_DELETE(dat,__FILE__,__LINE__);
1735 }
1736 else
1737 {
1738 break;
1739 }
1740 }
1741 #endif
1742
1743 // This line is necessary because the timer isn't accurate
1744 if (time <= lastUpdateTime)
1745 {
1746 // Always set the last time in case of overflow
1747 lastUpdateTime=time;
1748 return;
1749 }
1750
1751 CCTimeType timeSinceLastTick = time - lastUpdateTime;
1752 lastUpdateTime=time;
1753 #if CC_TIME_TYPE_BYTES==4
1754 if (timeSinceLastTick>100)
1755 timeSinceLastTick=100;
1756 #else
1757 if (timeSinceLastTick>100000)
1758 timeSinceLastTick=100000;
1759 #endif
1760
1761 if (unreliableTimeout>0)
1762 {
1763 if (timeSinceLastTick>=timeToNextUnreliableCull)
1764 {
1765 if (unreliableLinkedListHead)
1766 {
1767 // Cull out all unreliable messages that have exceeded the timeout
1768 InternalPacket *cur = unreliableLinkedListHead;
1769 InternalPacket *end = unreliableLinkedListHead->unreliablePrev;
1770
1771 for(;;)
1772 {
1773 if (time > cur->creationTime+(CCTimeType)unreliableTimeout)
1774 {
1775 // Flag invalid, and clear the memory. Still needs to be removed from the sendPacketSet later
1776 // This fixes a problem where a remote system disconnects, but we don't know it yet, and memory consumption increases to a huge value
1777 FreeInternalPacketData(cur, _FILE_AND_LINE_ );
1778 cur->data=0;
1779 InternalPacket *next = cur->unreliableNext;
1780 RemoveFromUnreliableLinkedList(cur);
1781
1782 if (cur==end)
1783 break;
1784
1785 cur=next;
1786 }
1787 else
1788 {
1789 // if (cur==end)
1790 // break;
1791 //
1792 // cur=cur->unreliableNext;
1793
1794 // They should be inserted in-order, so no need to iterate past the first failure
1795 break;
1796 }
1797 }
1798 }
1799
1800 timeToNextUnreliableCull=unreliableTimeout/(CCTimeType)2;
1801 }
1802 else
1803 {
1804 timeToNextUnreliableCull-=timeSinceLastTick;
1805 }
1806 }
1807
1808
1809 // Due to thread vagarities and the way I store the time to avoid slow calls to SLNet::GetTime
1810 // time may be less than lastAck
1811 #if CC_TIME_TYPE_BYTES==4
1812 if ( statistics.messagesInResendBuffer!=0 && AckTimeout(time) )
1813 #else
1814 if ( statistics.messagesInResendBuffer!=0 && AckTimeout(SLNet::TimeMS(time/(CCTimeType)1000)) )
1815 #endif
1816 {
1817 // SHOW - dead connection
1818 // We've waited a very long time for a reliable packet to get an ack and it never has
1819 deadConnection = true;
1820 return;
1821 }
1822
1823 if (congestionManager.ShouldSendACKs(time,timeSinceLastTick))
1824 {
1825 SendACKs(s, systemAddress, time, rnr, updateBitStream);
1826 }
1827
1828 if (NAKs.Size()>0)
1829 {
1830 updateBitStream.Reset();
1831 DatagramHeaderFormat dhfNAK;
1832 dhfNAK.isNAK=true;
1833 dhfNAK.isACK=false;
1834 dhfNAK.isPacketPair=false;
1835 dhfNAK.Serialize(&updateBitStream);
1836 NAKs.Serialize(&updateBitStream, GetMaxDatagramSizeExcludingMessageHeaderBits(), true);
1837 SendBitStream( s, systemAddress, &updateBitStream, rnr, time );
1838 }
1839
1840 DatagramHeaderFormat dhf;
1841 dhf.needsBAndAs=congestionManager.GetIsInSlowStart();
1842 dhf.isContinuousSend=bandwidthExceededStatistic;
1843 // bandwidthExceededStatistic=sendPacketSet[0].IsEmpty()==false ||
1844 // sendPacketSet[1].IsEmpty()==false ||
1845 // sendPacketSet[2].IsEmpty()==false ||
1846 // sendPacketSet[3].IsEmpty()==false;
1847 bandwidthExceededStatistic=outgoingPacketBuffer.Size()>0;
1848
1849 const bool hasDataToSendOrResend = IsResendQueueEmpty()==false || bandwidthExceededStatistic;
1850 RakAssert(NUMBER_OF_PRIORITIES==4);
1851 congestionManager.Update(time, hasDataToSendOrResend);
1852
1853 statistics.BPSLimitByOutgoingBandwidthLimit = BITS_TO_BYTES(bitsPerSecondLimit);
1854 statistics.BPSLimitByCongestionControl = congestionManager.GetBytesPerSecondLimitByCongestionControl();
1855
1856 unsigned int i;
1857 if (time > lastBpsClear+
1858 #if CC_TIME_TYPE_BYTES==4
1859 100
1860 #else
1861 100000
1862 #endif
1863 )
1864 {
1865 for (i=0; i < RNS_PER_SECOND_METRICS_COUNT; i++)
1866 {
1867 bpsMetrics[i].ClearExpired1(time);
1868 }
1869
1870 lastBpsClear=time;
1871 }
1872
1873 if (unreliableWithAckReceiptHistory.Size()>0)
1874 {
1875 i=0;
1876 while (i < unreliableWithAckReceiptHistory.Size())
1877 {
1878 //if (unreliableWithAckReceiptHistory[i].nextActionTime < time)
1879 if (time - unreliableWithAckReceiptHistory[i].nextActionTime < (((CCTimeType)-1)/2) )
1880 {
1881 InternalPacket *ackReceipt = AllocateFromInternalPacketPool();
1882 AllocInternalPacketData(ackReceipt, 5, false, _FILE_AND_LINE_ );
1883 ackReceipt->dataBitLength=BYTES_TO_BITS(5);
1884 ackReceipt->data[0]=(MessageID)ID_SND_RECEIPT_LOSS;
1885 memcpy(ackReceipt->data+sizeof(MessageID), &unreliableWithAckReceiptHistory[i].sendReceiptSerial, sizeof(uint32_t));
1886 outputQueue.Push(ackReceipt, _FILE_AND_LINE_ );
1887
1888 // Remove, swap with last
1889 unreliableWithAckReceiptHistory.RemoveAtIndex(i);
1890 }
1891 else
1892 i++;
1893 }
1894 }
1895
1896 if (hasDataToSendOrResend==true)
1897 {
1898 InternalPacket *internalPacket;
1899 // bool forceSend=false;
1900 bool pushedAnything;
1901 BitSize_t nextPacketBitLength;
1902 dhf.isACK=false;
1903 dhf.isNAK=false;
1904 dhf.hasBAndAS=false;
1905 ResetPacketsAndDatagrams();
1906
1907 int transmissionBandwidth = congestionManager.GetTransmissionBandwidth(time, timeSinceLastTick, unacknowledgedBytes,dhf.isContinuousSend);
1908 int retransmissionBandwidth = congestionManager.GetRetransmissionBandwidth(time, timeSinceLastTick, unacknowledgedBytes,dhf.isContinuousSend);
1909 if (retransmissionBandwidth>0 || transmissionBandwidth>0)
1910 {
1911 statistics.isLimitedByCongestionControl=false;
1912
1913 allDatagramSizesSoFar=0;
1914
1915 // Keep filling datagrams until we exceed retransmission bandwidth
1916 while ((int)BITS_TO_BYTES(allDatagramSizesSoFar)<retransmissionBandwidth)
1917 {
1918 pushedAnything=false;
1919
1920 // Fill one datagram, then break
1921 while ( IsResendQueueEmpty()==false )
1922 {
1923 internalPacket = resendLinkedListHead;
1924 RakAssert(internalPacket->messageNumberAssigned==true);
1925
1926 //if ( internalPacket->nextActionTime < time )
1927 if ( time - internalPacket->nextActionTime < (((CCTimeType)-1)/2) )
1928 {
1929 nextPacketBitLength = internalPacket->headerLength + internalPacket->dataBitLength;
1930 if ( datagramSizeSoFar + nextPacketBitLength > GetMaxDatagramSizeExcludingMessageHeaderBits() )
1931 {
1932 // Gathers all PushPackets()
1933 PushDatagram();
1934 break;
1935 }
1936
1937 PopListHead(false);
1938
1939 CC_DEBUG_PRINTF_2("Rs %i ", internalPacket->reliableMessageNumber.val);
1940
1941 bpsMetrics[(int) USER_MESSAGE_BYTES_RESENT].Push1(time,BITS_TO_BYTES(internalPacket->dataBitLength));
1942
1943 // Testing1
1944 // if (internalPacket->reliability==RELIABLE_ORDERED || internalPacket->reliability==RELIABLE_ORDERED_WITH_ACK_RECEIPT)
1945 // printf("RESEND reliableMessageNumber %i with datagram %i\n", internalPacket->reliableMessageNumber.val, congestionManager.GetNextDatagramSequenceNumber().val);
1946
1947 PushPacket(time,internalPacket,true); // Affects GetNewTransmissionBandwidth()
1948 internalPacket->timesSent++;
1949 congestionManager.OnResend(time, internalPacket->nextActionTime);
1950 internalPacket->retransmissionTime = congestionManager.GetRTOForRetransmission(internalPacket->timesSent);
1951 internalPacket->nextActionTime = internalPacket->retransmissionTime+time;
1952
1953 pushedAnything=true;
1954
1955 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
1956 {
1957 #if CC_TIME_TYPE_BYTES==4
1958 messageHandlerList[messageHandlerIndex]->OnInternalPacket(internalPacket, packetsToSendThisUpdateDatagramBoundaries.Size()+congestionManager.GetNextDatagramSequenceNumber(), systemAddress, (SLNet::TimeMS) time, true);
1959 #else
1960 messageHandlerList[messageHandlerIndex]->OnInternalPacket(internalPacket, packetsToSendThisUpdateDatagramBoundaries.Size()+congestionManager.GetNextDatagramSequenceNumber(), systemAddress, (SLNet::TimeMS)(time/(CCTimeType)1000), true);
1961 #endif
1962 }
1963
1964 // Put the packet back into the resend list at the correct spot
1965 // Don't make a copy since I'm reinserting an allocated struct
1966 InsertPacketIntoResendList( internalPacket, time, false, false );
1967
1968 // Removeme
1969 // printf("Resend:%i ", internalPacket->reliableMessageNumber);
1970 }
1971 else
1972 {
1973 // Filled one datagram.
1974 // If the 2nd and it's time to send a datagram pair, will be marked as a pair
1975 PushDatagram();
1976 break;
1977 }
1978 }
1979
1980 if (pushedAnything==false)
1981 break;
1982 }
1983 }
1984 else
1985 {
1986 statistics.isLimitedByCongestionControl=true;
1987 }
1988
1989 if ((int)BITS_TO_BYTES(allDatagramSizesSoFar)<transmissionBandwidth)
1990 {
1991 // printf("S+ ");
1992 allDatagramSizesSoFar=0;
1993
1994 // Keep filling datagrams until we exceed transmission bandwidth
1995 while (
1996 ResendBufferOverflow()==false &&
1997 ((int)BITS_TO_BYTES(allDatagramSizesSoFar)<transmissionBandwidth ||
1998 // This condition means if we want to send a datagram pair, and only have one datagram buffered, exceed bandwidth to add another
1999 (countdownToNextPacketPair==0 &&
2000 datagramsToSendThisUpdateIsPair.Size()==1))
2001 )
2002 {
2003 // Fill with packets until MTU is reached
2004 // for ( i = 0; i < NUMBER_OF_PRIORITIES; i++ )
2005 // {
2006 pushedAnything=false;
2007
2008 statistics.isLimitedByOutgoingBandwidthLimit=bitsPerSecondLimit!=0 && BITS_TO_BYTES(bitsPerSecondLimit) < bpsMetrics[USER_MESSAGE_BYTES_SENT].GetBPS1(time);
2009
2010
2011 while (outgoingPacketBuffer.Size() &&
2012 statistics.isLimitedByOutgoingBandwidthLimit==false)
2013 //while ( sendPacketSet[ i ].Size() )
2014 {
2015 internalPacket=outgoingPacketBuffer.Peek();
2016 RakAssert(internalPacket->messageNumberAssigned==false);
2017 RakAssert(outgoingPacketBuffer.Size()==0 || outgoingPacketBuffer.Peek()->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
2018
2019 // internalPacket = sendPacketSet[ i ].Peek();
2020 if (internalPacket->data==0)
2021 {
2022 //sendPacketSet[ i ].Pop();
2023 outgoingPacketBuffer.Pop(0);
2024 RakAssert(outgoingPacketBuffer.Size()==0 || outgoingPacketBuffer.Peek()->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
2025 statistics.messageInSendBuffer[(int)internalPacket->priority]--;
2026 statistics.bytesInSendBuffer[(int)internalPacket->priority]-=(double) BITS_TO_BYTES(internalPacket->dataBitLength);
2027 ReleaseToInternalPacketPool( internalPacket );
2028 continue;
2029 }
2030
2031 internalPacket->headerLength=GetMessageHeaderLengthBits(internalPacket);
2032 nextPacketBitLength = internalPacket->headerLength + internalPacket->dataBitLength;
2033 if ( datagramSizeSoFar + nextPacketBitLength > GetMaxDatagramSizeExcludingMessageHeaderBits() )
2034 {
2035 // Hit MTU. May still push packets if smaller ones exist at a lower priority
2036 RakAssert(datagramSizeSoFar!=0);
2037 RakAssert(internalPacket->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
2038 break;
2039 }
2040
2041 bool isReliable;
2042 if ( internalPacket->reliability == RELIABLE ||
2043 internalPacket->reliability == RELIABLE_SEQUENCED ||
2044 internalPacket->reliability == RELIABLE_ORDERED ||
2045 internalPacket->reliability == RELIABLE_WITH_ACK_RECEIPT ||
2046 // internalPacket->reliability == RELIABLE_SEQUENCED_WITH_ACK_RECEIPT ||
2047 internalPacket->reliability == RELIABLE_ORDERED_WITH_ACK_RECEIPT
2048 )
2049 isReliable = true;
2050 else
2051 isReliable = false;
2052
2053 //sendPacketSet[ i ].Pop();
2054 outgoingPacketBuffer.Pop(0);
2055 RakAssert(outgoingPacketBuffer.Size()==0 || outgoingPacketBuffer.Peek()->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
2056 RakAssert(internalPacket->messageNumberAssigned==false);
2057 statistics.messageInSendBuffer[(int)internalPacket->priority]--;
2058 statistics.bytesInSendBuffer[(int)internalPacket->priority]-=(double) BITS_TO_BYTES(internalPacket->dataBitLength);
2059 if (isReliable
2060 /*
2061 I thought about this and agree that UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT and RELIABLE_SEQUENCED_WITH_ACK_RECEIPT is not useful unless you also know if the message was discarded.
2062
2063 The problem is that internally, message numbers are only assigned to reliable messages, because message numbers are only used to discard duplicate message receipt and only reliable messages get sent more than once. However, without message numbers getting assigned and transmitted, there is no way to tell the sender about which messages were discarded. In fact, in looking this over I realized that UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT introduced a bug, because the remote system assumes all message numbers are used (no holes). With that send type, on packetloss, a permanent hole would have been created which eventually would cause the system to discard all further packets.
2064
2065 So I have two options. Either do not support ack receipts when sending sequenced, or write complex and major new systems. UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT would need to send the message ID number on a special channel which allows for non-delivery. And both of them would need to have a special range list to indicate which message numbers were not delivered, so when acks are sent that can be indicated as well. A further problem is that the ack itself can be lost - it is possible that the message can arrive but be discarded, yet the ack is lost. On resend, the resent message would be ignored as duplicate, and you'd never get the discard message either (unless I made a special buffer for that case too).
2066 */
2067 // ||
2068 // If needs an ack receipt, keep the internal packet around in the list
2069 // internalPacket->reliability == UNRELIABLE_WITH_ACK_RECEIPT ||
2070 // internalPacket->reliability == UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT
2071 )
2072 {
2073 internalPacket->messageNumberAssigned=true;
2074 internalPacket->reliableMessageNumber=sendReliableMessageNumberIndex;
2075 internalPacket->retransmissionTime = congestionManager.GetRTOForRetransmission(internalPacket->timesSent+1);
2076 internalPacket->nextActionTime = internalPacket->retransmissionTime+time;
2077 #if CC_TIME_TYPE_BYTES==4
2078 const CCTimeType threshhold = 10000;
2079 #else
2080 const CCTimeType threshhold = 10000000;
2081 #endif
2082 if (internalPacket->nextActionTime-time > threshhold)
2083 {
2084 // int a=5;
2085 RakAssert(time-internalPacket->nextActionTime < threshhold);
2086 }
2087 //resendTree.Insert( internalPacket->reliableMessageNumber, internalPacket);
2088 if (resendBuffer[internalPacket->reliableMessageNumber & (uint32_t) RESEND_BUFFER_ARRAY_MASK]!=0)
2089 {
2090 // bool overflow = ResendBufferOverflow();
2091 RakAssert(0);
2092 }
2093 resendBuffer[internalPacket->reliableMessageNumber & (uint32_t) RESEND_BUFFER_ARRAY_MASK] = internalPacket;
2094 statistics.messagesInResendBuffer++;
2095 statistics.bytesInResendBuffer+=BITS_TO_BYTES(internalPacket->dataBitLength);
2096
2097 // printf("pre:%i ", unacknowledgedBytes);
2098
2099 InsertPacketIntoResendList( internalPacket, time, true, isReliable);
2100
2101
2102 // printf("post:%i ", unacknowledgedBytes);
2103 sendReliableMessageNumberIndex++;
2104 }
2105 else if (internalPacket->reliability == UNRELIABLE_WITH_ACK_RECEIPT)
2106 {
2107 unreliableWithAckReceiptHistory.Push(UnreliableWithAckReceiptNode(
2108 congestionManager.GetNextDatagramSequenceNumber() + packetsToSendThisUpdateDatagramBoundaries.Size(),
2109 internalPacket->sendReceiptSerial,
2110 congestionManager.GetRTOForRetransmission(internalPacket->timesSent+1)+time
2111 ), _FILE_AND_LINE_);
2112 }
2113
2114 // If isReliable is false, the packet and its contents will be added to a list to be freed in ClearPacketsAndDatagrams
2115 // However, the internalPacket structure will remain allocated and be in the resendBuffer list if it requires a receipt
2116 bpsMetrics[(int) USER_MESSAGE_BYTES_SENT].Push1(time,BITS_TO_BYTES(internalPacket->dataBitLength));
2117
2118 // Testing1
2119 // if (internalPacket->reliability==RELIABLE_ORDERED || internalPacket->reliability==RELIABLE_ORDERED_WITH_ACK_RECEIPT)
2120 // printf("SEND reliableMessageNumber %i in datagram %i\n", internalPacket->reliableMessageNumber.val, congestionManager.GetNextDatagramSequenceNumber().val);
2121
2122 PushPacket(time,internalPacket, isReliable);
2123 internalPacket->timesSent++;
2124
2125 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
2126 {
2127 #if CC_TIME_TYPE_BYTES==4
2128 messageHandlerList[messageHandlerIndex]->OnInternalPacket(internalPacket, packetsToSendThisUpdateDatagramBoundaries.Size()+congestionManager.GetNextDatagramSequenceNumber(), systemAddress, (SLNet::TimeMS)time, true);
2129 #else
2130 messageHandlerList[messageHandlerIndex]->OnInternalPacket(internalPacket, packetsToSendThisUpdateDatagramBoundaries.Size()+congestionManager.GetNextDatagramSequenceNumber(), systemAddress, (SLNet::TimeMS)(time/(CCTimeType)1000), true);
2131 #endif
2132 }
2133 pushedAnything=true;
2134
2135 if (ResendBufferOverflow())
2136 break;
2137 }
2138 // if (ResendBufferOverflow())
2139 // break;
2140 // }z
2141
2142 // No datagrams pushed?
2143 if (datagramSizeSoFar==0)
2144 break;
2145
2146 // Filled one datagram.
2147 // If the 2nd and it's time to send a datagram pair, will be marked as a pair
2148 PushDatagram();
2149 }
2150 }
2151
2152
2153 for (unsigned int datagramIndex=0; datagramIndex < packetsToSendThisUpdateDatagramBoundaries.Size(); datagramIndex++)
2154 {
2155 if (datagramIndex>0)
2156 dhf.isContinuousSend=true;
2157 MessageNumberNode* messageNumberNode = 0;
2158 dhf.datagramNumber=congestionManager.GetAndIncrementNextDatagramSequenceNumber();
2159 dhf.isPacketPair=datagramsToSendThisUpdateIsPair[datagramIndex];
2160
2161 //printf("%p pushing datagram %i\n", this, dhf.datagramNumber.val);
2162
2163 bool isSecondOfPacketPair=dhf.isPacketPair && datagramIndex>0 && datagramsToSendThisUpdateIsPair[datagramIndex-1];
2164 unsigned int msgIndex, msgTerm;
2165 if (datagramIndex==0)
2166 {
2167 msgIndex=0;
2168 msgTerm=packetsToSendThisUpdateDatagramBoundaries[0];
2169 }
2170 else
2171 {
2172 msgIndex=packetsToSendThisUpdateDatagramBoundaries[datagramIndex-1];
2173 msgTerm=packetsToSendThisUpdateDatagramBoundaries[datagramIndex];
2174 }
2175
2176 // More accurate time to reset here
2177 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
2178 dhf.sourceSystemTime= SLNet::GetTimeUS();
2179 #endif
2180 updateBitStream.Reset();
2181 dhf.Serialize(&updateBitStream);
2182 CC_DEBUG_PRINTF_2("S%i ",dhf.datagramNumber.val);
2183
2184 while (msgIndex < msgTerm)
2185 {
2186 // If reliable or needs receipt
2187 if ( packetsToSendThisUpdate[msgIndex]->reliability != UNRELIABLE &&
2188 packetsToSendThisUpdate[msgIndex]->reliability != UNRELIABLE_SEQUENCED
2189 )
2190 {
2191 if (messageNumberNode==0)
2192 {
2193 messageNumberNode = AddFirstToDatagramHistory(dhf.datagramNumber, packetsToSendThisUpdate[msgIndex]->reliableMessageNumber, time);
2194 }
2195 else
2196 {
2197 messageNumberNode = AddSubsequentToDatagramHistory(messageNumberNode, packetsToSendThisUpdate[msgIndex]->reliableMessageNumber);
2198 }
2199 }
2200
2201 RakAssert(updateBitStream.GetNumberOfBytesUsed()<=MAXIMUM_MTU_SIZE-UDP_HEADER_SIZE);
2202 WriteToBitStreamFromInternalPacket( &updateBitStream, packetsToSendThisUpdate[msgIndex], time );
2203 RakAssert(updateBitStream.GetNumberOfBytesUsed()<=MAXIMUM_MTU_SIZE-UDP_HEADER_SIZE);
2204 msgIndex++;
2205 }
2206
2207 if (isSecondOfPacketPair)
2208 {
2209 // Pad to size of first datagram
2210 RakAssert(updateBitStream.GetNumberOfBytesUsed()<=MAXIMUM_MTU_SIZE-UDP_HEADER_SIZE);
2211 updateBitStream.PadWithZeroToByteLength(datagramSizesInBytes[datagramIndex-1]);
2212 RakAssert(updateBitStream.GetNumberOfBytesUsed()<=MAXIMUM_MTU_SIZE-UDP_HEADER_SIZE);
2213 }
2214
2215 if (messageNumberNode==0)
2216 {
2217 // Unreliable, add dummy node
2218 AddFirstToDatagramHistory(dhf.datagramNumber, time);
2219 }
2220
2221 // Store what message ids were sent with this datagram
2222 // datagramMessageIDTree.Insert(dhf.datagramNumber,idList);
2223
2224 congestionManager.OnSendBytes(time,UDP_HEADER_SIZE+DatagramHeaderFormat::GetDataHeaderByteLength());
2225
2226 SendBitStream( s, systemAddress, &updateBitStream, rnr, time );
2227
2228 bandwidthExceededStatistic=outgoingPacketBuffer.Size()>0;
2229 // bandwidthExceededStatistic=sendPacketSet[0].IsEmpty()==false ||
2230 // sendPacketSet[1].IsEmpty()==false ||
2231 // sendPacketSet[2].IsEmpty()==false ||
2232 // sendPacketSet[3].IsEmpty()==false;
2233
2234
2235
2236 if (bandwidthExceededStatistic==true)
2237 timeOfLastContinualSend=time;
2238 else
2239 timeOfLastContinualSend=0;
2240 }
2241
2242 ClearPacketsAndDatagrams();
2243
2244 // Any data waiting to send after attempting to send, then bandwidth is exceeded
2245 bandwidthExceededStatistic=outgoingPacketBuffer.Size()>0;
2246 // bandwidthExceededStatistic=sendPacketSet[0].IsEmpty()==false ||
2247 // sendPacketSet[1].IsEmpty()==false ||
2248 // sendPacketSet[2].IsEmpty()==false ||
2249 // sendPacketSet[3].IsEmpty()==false;
2250 }
2251
2252
2253 // Keep on top of deleting old unreliable split packets so they don't clog the list.
2254 //DeleteOldUnreliableSplitPackets( time );
2255 }
2256
2257 //-------------------------------------------------------------------------------------------------------
2258 // Writes a bitstream to the socket
2259 //-------------------------------------------------------------------------------------------------------
2260 void ReliabilityLayer::SendBitStream( RakNetSocket2 *s, SystemAddress &systemAddress, SLNet::BitStream *bitStream, RakNetRandom *rnr, CCTimeType currentTime)
2261 {
2262 (void) systemAddress;
2263 (void) rnr;
2264
2265 unsigned int length;
2266
2267 length = (unsigned int) bitStream->GetNumberOfBytesUsed();
2268
2269
2270 #ifdef _DEBUG
2271 if (packetloss > 0.0)
2272 {
2273 if (frandomMT() < packetloss)
2274 return;
2275 }
2276
2277 if (minExtraPing > 0 || extraPingVariance > 0)
2278 {
2279 #ifdef FLIP_SEND_ORDER_TEST
2280 // Flip order of sends without delaying them for testing
2281 DataAndTime *dat = SLNet::OP_NEW<DataAndTime>(__FILE__,__LINE__);
2282 memcpy(dat->data, ( char* ) bitStream->GetData(), length );
2283 dat->s=s;
2284 dat->length=length;
2285 dat->sendTime = 0;
2286 dat->remotePortRakNetWasStartedOn_PS3=remotePortRakNetWasStartedOn_PS3;
2287 dat->extraSocketOptions=extraSocketOptions;
2288 delayList.PushAtHead(dat, 0, _FILE_AND_LINE_);
2289 #else
2290 SLNet::TimeMS delay = minExtraPing;
2291 if (extraPingVariance>0)
2292 delay += (randomMT() % extraPingVariance);
2293 if (delay > 0)
2294 {
2295 DataAndTime *dat = SLNet::OP_NEW<DataAndTime>(__FILE__,__LINE__);
2296 memcpy(dat->data, ( char* ) bitStream->GetData(), length );
2297 dat->s=s;
2298 dat->length=length;
2299 dat->sendTime = SLNet::GetTimeMS() + delay;
2300 for (unsigned int i=0; i < delayList.Size(); i++)
2301 {
2302 if (dat->sendTime < delayList[i]->sendTime)
2303 {
2304 delayList.PushAtHead(dat, i, __FILE__, __LINE__);
2305 dat=0;
2306 break;
2307 }
2308 }
2309 if (dat!=0)
2310 delayList.Push(dat,__FILE__,__LINE__);
2311 return;
2312 }
2313 #endif
2314 }
2315 #endif
2316
2317 #if LIBCAT_SECURITY==1
2318 if (useSecurity)
2319 {
2320 unsigned char *buffer = reinterpret_cast<unsigned char*>( bitStream->GetData() );
2321
2322 int buffer_size = bitStream->GetNumberOfBitsAllocated() / 8;
2323
2324 // Verify there is enough room for encrypted output and encrypt
2325 // Encrypt() will increase length
2326 bool success = auth_enc.Encrypt(buffer, buffer_size, length);
2327 RakAssert(success);
2328 }
2329 #endif
2330
2331 bpsMetrics[(int) ACTUAL_BYTES_SENT].Push1(currentTime,length);
2332
2333 RakAssert(length <= congestionManager.GetMTU());
2334
2335 #ifdef USE_THREADED_SEND
2336 SendToThread::SendToThreadBlock *block = SendToThread::AllocateBlock();
2337 memcpy(block->data, bitStream->GetData(), length);
2338 block->dataWriteOffset=length;
2339 block->extraSocketOptions=extraSocketOptions;
2340 block->remotePortRakNetWasStartedOn_PS3=remotePortRakNetWasStartedOn_PS3;
2341 block->s=s;
2342 block->systemAddress=systemAddress;
2343 SendToThread::ProcessBlock(block);
2344 #else
2345 // SocketLayer::SendTo( s, ( char* ) bitStream->GetData(), length, systemAddress, __FILE__, __LINE__ );
2346
2347 RNS2_SendParameters bsp;
2348 bsp.data = (char*) bitStream->GetData();
2349 bsp.length = length;
2350 bsp.systemAddress = systemAddress;
2351 s->Send(&bsp, _FILE_AND_LINE_);
2352 #endif
2353 }
2354
2355 //-------------------------------------------------------------------------------------------------------
2356 // Are we waiting for any data to be sent out or be processed by the player?
2357 //-------------------------------------------------------------------------------------------------------
2358 bool ReliabilityLayer::IsOutgoingDataWaiting(void)
2359 {
2360 if (outgoingPacketBuffer.Size()>0)
2361 return true;
2362
2363 // unsigned i;
2364 // for ( i = 0; i < NUMBER_OF_PRIORITIES; i++ )
2365 // {
2366 // if (sendPacketSet[ i ].Size() > 0)
2367 // return true;
2368 // }
2369
2370 return
2371 //acknowlegements.Size() > 0 ||
2372 //resendTree.IsEmpty()==false;// || outputQueue.Size() > 0 || orderingList.Size() > 0 || splitPacketChannelList.Size() > 0;
2373 statistics.messagesInResendBuffer!=0;
2374 }
2375 bool ReliabilityLayer::AreAcksWaiting(void)
2376 {
2377 return acknowlegements.Size() > 0;
2378 }
2379 //-------------------------------------------------------------------------------------------------------
2380 void ReliabilityLayer::ApplyNetworkSimulator( double _packetloss, SLNet::TimeMS _minExtraPing, SLNet::TimeMS _extraPingVariance )
2381 {
2382 #ifdef _DEBUG
2383 packetloss=_packetloss;
2384 minExtraPing=_minExtraPing;
2385 extraPingVariance=_extraPingVariance;
2386 // if (ping < (unsigned int)(minExtraPing+extraPingVariance)*2)
2387 // ping=(minExtraPing+extraPingVariance)*2;
2388 #endif
2389 }
2390 //-------------------------------------------------------------------------------------------------------
2391 void ReliabilityLayer::SetSplitMessageProgressInterval(int interval)
2392 {
2393 splitMessageProgressInterval=interval;
2394 }
2395 //-------------------------------------------------------------------------------------------------------
2396 void ReliabilityLayer::SetUnreliableTimeout(SLNet::TimeMS timeoutMS)
2397 {
2398 #if CC_TIME_TYPE_BYTES==4
2399 unreliableTimeout=timeoutMS;
2400 #else
2401 unreliableTimeout=(CCTimeType)timeoutMS*(CCTimeType)1000;
2402 #endif
2403 }
2404
2405 //-------------------------------------------------------------------------------------------------------
2406 // This will return true if we should not send at this time
2407 //-------------------------------------------------------------------------------------------------------
2408 bool ReliabilityLayer::IsSendThrottled( int MTUSize )
2409 {
2410 (void) MTUSize;
2411
2412 return false;
2413 // return resendList.Size() > windowSize;
2414
2415 // Disabling this, because it can get stuck here forever
2416 /*
2417 unsigned packetsWaiting;
2418 unsigned resendListDataSize=0;
2419 unsigned i;
2420 for (i=0; i < resendList.Size(); i++)
2421 {
2422 if (resendList[i])
2423 resendListDataSize+=resendList[i]->dataBitLength;
2424 }
2425 packetsWaiting = 1 + ((BITS_TO_BYTES(resendListDataSize)) / (MTUSize - UDP_HEADER_SIZE - 10)); // 10 to roughly estimate the raknet header
2426
2427 return packetsWaiting >= windowSize;
2428 */
2429 }
2430
2431 //-------------------------------------------------------------------------------------------------------
2432 // We lost a packet
2433 //-------------------------------------------------------------------------------------------------------
2434 void ReliabilityLayer::UpdateWindowFromPacketloss( CCTimeType time )
2435 {
2436 (void) time;
2437 }
2438
2439 //-------------------------------------------------------------------------------------------------------
2440 // Increase the window size
2441 //-------------------------------------------------------------------------------------------------------
2442 void ReliabilityLayer::UpdateWindowFromAck( CCTimeType time )
2443 {
2444 (void) time;
2445 }
2446
2447 //-------------------------------------------------------------------------------------------------------
2448 // Does what the function name says
2449 //-------------------------------------------------------------------------------------------------------
2450 unsigned ReliabilityLayer::RemovePacketFromResendListAndDeleteOlderReliableSequenced( const MessageNumberType messageNumber, CCTimeType time, DataStructures::List<PluginInterface2*> &messageHandlerList, const SystemAddress &systemAddress )
2451 {
2452 (void) time;
2453 (void) messageNumber;
2454 InternalPacket * internalPacket;
2455 //InternalPacket *temp;
2456 // PacketReliability reliability; // What type of reliability algorithm to use with this packet
2457 // unsigned char orderingChannel; // What ordering channel this packet is on, if the reliability type uses ordering channels
2458 // OrderingIndexType orderingIndex; // The ID used as identification for ordering channels
2459 // unsigned j;
2460
2461 for (unsigned int messageHandlerIndex=0; messageHandlerIndex < messageHandlerList.Size(); messageHandlerIndex++)
2462 {
2463 #if CC_TIME_TYPE_BYTES==4
2464 messageHandlerList[messageHandlerIndex]->OnAck(messageNumber, systemAddress, time);
2465 #else
2466 messageHandlerList[messageHandlerIndex]->OnAck(messageNumber, systemAddress, (SLNet::TimeMS)(time/(CCTimeType)1000));
2467 #endif
2468 }
2469
2470 // Testing1
2471 // if (resendLinkedListHead)
2472 // {
2473 // InternalPacket *internalPacket = resendLinkedListHead;
2474 // do
2475 // {
2476 // internalPacket=internalPacket->resendNext;
2477 // printf("%i ", internalPacket->reliableMessageNumber.val);
2478 // } while (internalPacket!=resendLinkedListHead);
2479 // printf("\n");
2480 // }
2481
2482 // bool deleted;
2483 // deleted=resendTree.Delete(messageNumber, internalPacket);
2484 internalPacket = resendBuffer[messageNumber & RESEND_BUFFER_ARRAY_MASK];
2485 // May ask to remove twice, for example resend twice, then second ack
2486 if (internalPacket && internalPacket->reliableMessageNumber==messageNumber)
2487 {
2488 // ValidateResendList();
2489 resendBuffer[messageNumber & RESEND_BUFFER_ARRAY_MASK]=0;
2490 CC_DEBUG_PRINTF_2("AckRcv %i ", messageNumber);
2491
2492 statistics.messagesInResendBuffer--;
2493 statistics.bytesInResendBuffer-=BITS_TO_BYTES(internalPacket->dataBitLength);
2494
2495 // orderingIndex = internalPacket->orderingIndex;
2496 totalUserDataBytesAcked+=(double) BITS_TO_BYTES(internalPacket->headerLength+internalPacket->dataBitLength);
2497
2498 // Return receipt if asked for
2499 if (internalPacket->reliability>=RELIABLE_WITH_ACK_RECEIPT &&
2500 (internalPacket->splitPacketCount==0 || internalPacket->splitPacketIndex+1==internalPacket->splitPacketCount)
2501 )
2502 {
2503 InternalPacket *ackReceipt = AllocateFromInternalPacketPool();
2504 AllocInternalPacketData(ackReceipt, 5, false, _FILE_AND_LINE_ );
2505 ackReceipt->dataBitLength=BYTES_TO_BITS(5);
2506 ackReceipt->data[0]=(MessageID)ID_SND_RECEIPT_ACKED;
2507 memcpy(ackReceipt->data+sizeof(MessageID), &internalPacket->sendReceiptSerial, sizeof(internalPacket->sendReceiptSerial));
2508 outputQueue.Push(ackReceipt, _FILE_AND_LINE_ );
2509 }
2510
2511 bool isReliable;
2512 if ( internalPacket->reliability == RELIABLE ||
2513 internalPacket->reliability == RELIABLE_SEQUENCED ||
2514 internalPacket->reliability == RELIABLE_ORDERED ||
2515 internalPacket->reliability == RELIABLE_WITH_ACK_RECEIPT ||
2516 // internalPacket->reliability == RELIABLE_SEQUENCED_WITH_ACK_RECEIPT ||
2517 internalPacket->reliability == RELIABLE_ORDERED_WITH_ACK_RECEIPT
2518 )
2519 isReliable = true;
2520 else
2521 isReliable = false;
2522
2523 RemoveFromList(internalPacket, isReliable);
2524 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
2525 ReleaseToInternalPacketPool( internalPacket );
2526
2527
2528 return 0;
2529 }
2530 else
2531 {
2532
2533 }
2534
2535 return (unsigned)-1;
2536 }
2537
2538 //-------------------------------------------------------------------------------------------------------
2539 // Acknowledge receipt of the packet with the specified messageNumber
2540 //-------------------------------------------------------------------------------------------------------
2541 void ReliabilityLayer::SendAcknowledgementPacket( const DatagramSequenceNumberType messageNumber, CCTimeType time )
2542 {
2543
2544 // REMOVEME
2545 // printf("%p Send ack %i\n", this, messageNumber.val);
2546
2547 nextAckTimeToSend=time;
2548 acknowlegements.Insert(messageNumber);
2549
2550 //printf("ACK_DG:%i ", messageNumber.val);
2551
2552 CC_DEBUG_PRINTF_2("AckPush %i ", messageNumber);
2553
2554 }
2555
2556 //-------------------------------------------------------------------------------------------------------
2557 // Parse an internalPacket and figure out how many header bits would be
2558 // written. Returns that number
2559 //-------------------------------------------------------------------------------------------------------
2560 BitSize_t ReliabilityLayer::GetMaxMessageHeaderLengthBits( void )
2561 {
2562 InternalPacket ip;
2563 ip.reliability=RELIABLE_SEQUENCED;
2564 ip.splitPacketCount=1;
2565 return GetMessageHeaderLengthBits(&ip);
2566 }
2567 //-------------------------------------------------------------------------------------------------------
2568 BitSize_t ReliabilityLayer::GetMessageHeaderLengthBits( const InternalPacket *const internalPacket )
2569 {
2570 BitSize_t bitLength;
2571
2572 // bitStream->AlignWriteToByteBoundary(); // Potentially unaligned
2573 // tempChar=(unsigned char)internalPacket->reliability; bitStream->WriteBits( (const unsigned char *)&tempChar, 3, true ); // 3 bits to write reliability.
2574 // bool hasSplitPacket = internalPacket->splitPacketCount>0; bitStream->Write(hasSplitPacket); // Write 1 bit to indicate if splitPacketCount>0
2575 bitLength = 8*1;
2576
2577 // bitStream->AlignWriteToByteBoundary();
2578 // RakAssert(internalPacket->dataBitLength < 65535);
2579 // unsigned short s; s = (unsigned short) internalPacket->dataBitLength; bitStream->WriteAlignedVar16((const char*)& s);
2580 bitLength += 8*2;
2581
2582 if ( internalPacket->reliability == RELIABLE ||
2583 internalPacket->reliability == RELIABLE_SEQUENCED ||
2584 internalPacket->reliability == RELIABLE_ORDERED ||
2585 internalPacket->reliability == RELIABLE_WITH_ACK_RECEIPT ||
2586 // internalPacket->reliability == RELIABLE_SEQUENCED_WITH_ACK_RECEIPT ||
2587 internalPacket->reliability == RELIABLE_ORDERED_WITH_ACK_RECEIPT
2588 )
2589 bitLength += 8*3; // bitStream->Write(internalPacket->reliableMessageNumber); // Message sequence number
2590 // bitStream->AlignWriteToByteBoundary(); // Potentially nothing else to write
2591
2592
2593
2594 if ( internalPacket->reliability == UNRELIABLE_SEQUENCED ||
2595 internalPacket->reliability == RELIABLE_SEQUENCED
2596 )
2597 {
2598 bitLength += 8*3;; // bitStream->Write(internalPacket->_sequencingIndex); // Used for UNRELIABLE_SEQUENCED, RELIABLE_SEQUENCED, RELIABLE_ORDERED.
2599 }
2600
2601 if ( internalPacket->reliability == UNRELIABLE_SEQUENCED ||
2602 internalPacket->reliability == RELIABLE_SEQUENCED ||
2603 internalPacket->reliability == RELIABLE_ORDERED ||
2604 internalPacket->reliability == RELIABLE_ORDERED_WITH_ACK_RECEIPT
2605 )
2606 {
2607 bitLength += 8*3; // bitStream->Write(internalPacket->orderingIndex); // Used for UNRELIABLE_SEQUENCED, RELIABLE_SEQUENCED, RELIABLE_ORDERED.
2608 bitLength += 8*1; // tempChar=internalPacket->orderingChannel; bitStream->WriteAlignedVar8((const char*)& tempChar); // Used for UNRELIABLE_SEQUENCED, RELIABLE_SEQUENCED, RELIABLE_ORDERED. 5 bits needed, write one byte
2609 }
2610 if (internalPacket->splitPacketCount>0)
2611 {
2612 bitLength += 8*4; // bitStream->WriteAlignedVar32((const char*)& internalPacket->splitPacketCount); RakAssert(sizeof(SplitPacketIndexType)==4); // Only needed if splitPacketCount>0. 4 bytes
2613 bitLength += 8*sizeof(SplitPacketIdType); // bitStream->WriteAlignedVar16((const char*)& internalPacket->splitPacketId); RakAssert(sizeof(SplitPacketIdType)==2); // Only needed if splitPacketCount>0.
2614 bitLength += 8*4; // bitStream->WriteAlignedVar32((const char*)& internalPacket->splitPacketIndex); // Only needed if splitPacketCount>0. 4 bytes
2615 }
2616
2617 return bitLength;
2618 }
2619
2620 //-------------------------------------------------------------------------------------------------------
2621 // Parse an internalPacket and create a bitstream to represent this data
2622 //-------------------------------------------------------------------------------------------------------
2623 BitSize_t ReliabilityLayer::WriteToBitStreamFromInternalPacket(SLNet::BitStream *bitStream, const InternalPacket *const internalPacket, CCTimeType curTime )
2624 {
2625 (void) curTime;
2626
2627 BitSize_t start = bitStream->GetNumberOfBitsUsed();
2628 unsigned char tempChar;
2629
2630 // (Incoming data may be all zeros due to padding)
2631 bitStream->AlignWriteToByteBoundary(); // Potentially unaligned
2632 if (internalPacket->reliability==UNRELIABLE_WITH_ACK_RECEIPT)
2633 tempChar=UNRELIABLE;
2634 else if (internalPacket->reliability==RELIABLE_WITH_ACK_RECEIPT)
2635 tempChar=RELIABLE;
2636 else if (internalPacket->reliability==RELIABLE_ORDERED_WITH_ACK_RECEIPT)
2637 tempChar=RELIABLE_ORDERED;
2638 else
2639 tempChar=(unsigned char)internalPacket->reliability;
2640
2641 bitStream->WriteBits( (const unsigned char *)&tempChar, 3, true ); // 3 bits to write reliability.
2642
2643 bool hasSplitPacket = internalPacket->splitPacketCount>0; bitStream->Write(hasSplitPacket); // Write 1 bit to indicate if splitPacketCount>0
2644 bitStream->AlignWriteToByteBoundary();
2645 RakAssert(internalPacket->dataBitLength < 65535);
2646 unsigned short s; s = (unsigned short) internalPacket->dataBitLength; bitStream->WriteAlignedVar16((const char*)& s);
2647 if ( internalPacket->reliability == RELIABLE ||
2648 internalPacket->reliability == RELIABLE_SEQUENCED ||
2649 internalPacket->reliability == RELIABLE_ORDERED ||
2650 internalPacket->reliability == RELIABLE_WITH_ACK_RECEIPT ||
2651 internalPacket->reliability == RELIABLE_ORDERED_WITH_ACK_RECEIPT
2652 )
2653 bitStream->Write(internalPacket->reliableMessageNumber); // Used for all reliable types
2654 bitStream->AlignWriteToByteBoundary(); // Potentially nothing else to write
2655
2656 if ( internalPacket->reliability == UNRELIABLE_SEQUENCED ||
2657 internalPacket->reliability == RELIABLE_SEQUENCED
2658 )
2659 {
2660 bitStream->Write(internalPacket->sequencingIndex); // Used for UNRELIABLE_SEQUENCED, RELIABLE_SEQUENCED, RELIABLE_ORDERED.
2661 }
2662
2663 if ( internalPacket->reliability == UNRELIABLE_SEQUENCED ||
2664 internalPacket->reliability == RELIABLE_SEQUENCED ||
2665 internalPacket->reliability == RELIABLE_ORDERED ||
2666 internalPacket->reliability == RELIABLE_ORDERED_WITH_ACK_RECEIPT
2667 )
2668 {
2669 bitStream->Write(internalPacket->orderingIndex); // Used for UNRELIABLE_SEQUENCED, RELIABLE_SEQUENCED, RELIABLE_ORDERED.
2670 tempChar=internalPacket->orderingChannel; bitStream->WriteAlignedVar8((const char*)& tempChar); // Used for UNRELIABLE_SEQUENCED, RELIABLE_SEQUENCED, RELIABLE_ORDERED. 5 bits needed, write one byte
2671 }
2672
2673 if (internalPacket->splitPacketCount>0)
2674 {
2675 // printf("Write before\n");
2676 // bitStream->PrintBits();
2677
2678 bitStream->WriteAlignedVar32((const char*)& internalPacket->splitPacketCount); RakAssert(sizeof(SplitPacketIndexType)==4); // Only needed if splitPacketCount>0. 4 bytes
2679 bitStream->WriteAlignedVar16((const char*)& internalPacket->splitPacketId); RakAssert(sizeof(SplitPacketIdType)==2); // Only needed if splitPacketCount>0.
2680 bitStream->WriteAlignedVar32((const char*)& internalPacket->splitPacketIndex); // Only needed if splitPacketCount>0. 4 bytes
2681
2682 // printf("Write after\n");
2683 // bitStream->PrintBits();
2684 }
2685
2686 // Write the actual data.
2687 bitStream->WriteAlignedBytes( ( unsigned char* ) internalPacket->data, BITS_TO_BYTES( internalPacket->dataBitLength ) );
2688
2689 return bitStream->GetNumberOfBitsUsed() - start;
2690 }
2691
2692 //-------------------------------------------------------------------------------------------------------
2693 // Parse a bitstream and create an internal packet to represent this data
2694 //-------------------------------------------------------------------------------------------------------
2695 InternalPacket* ReliabilityLayer::CreateInternalPacketFromBitStream(SLNet::BitStream *bitStream, CCTimeType time )
2696 {
2697 bool bitStreamSucceeded;
2698 InternalPacket* internalPacket;
2699 unsigned char tempChar;
2700 bool hasSplitPacket=false;
2701 bool readSuccess;
2702
2703 if ( bitStream->GetNumberOfUnreadBits() < (int) sizeof( internalPacket->reliableMessageNumber ) * 8 )
2704 return 0; // leftover bits
2705
2706 internalPacket = AllocateFromInternalPacketPool();
2707 if (internalPacket==0)
2708 {
2709 // Out of memory
2710 RakAssert(0);
2711 return 0;
2712 }
2713 internalPacket->creationTime = time;
2714
2715 // (Incoming data may be all zeros due to padding)
2716 bitStream->AlignReadToByteBoundary(); // Potentially unaligned
2717 bitStream->ReadBits( ( unsigned char* ) ( &( tempChar ) ), 3 );
2718 internalPacket->reliability = ( const PacketReliability ) tempChar;
2719 readSuccess=bitStream->Read(hasSplitPacket); // Read 1 bit to indicate if splitPacketCount>0
2720 bitStream->AlignReadToByteBoundary();
2721 unsigned short s; bitStream->ReadAlignedVar16((char*)&s); internalPacket->dataBitLength=s; // Length of message (2 bytes)
2722 if ( internalPacket->reliability == RELIABLE ||
2723 internalPacket->reliability == RELIABLE_SEQUENCED ||
2724 internalPacket->reliability == RELIABLE_ORDERED
2725 // I don't write ACK_RECEIPT to the remote system
2726 // ||
2727 // internalPacket->reliability == RELIABLE_WITH_ACK_RECEIPT ||
2728 // internalPacket->reliability == RELIABLE_SEQUENCED_WITH_ACK_RECEIPT ||
2729 // internalPacket->reliability == RELIABLE_ORDERED_WITH_ACK_RECEIPT
2730 )
2731 bitStream->Read(internalPacket->reliableMessageNumber); // Message sequence number
2732 else
2733 internalPacket->reliableMessageNumber=(MessageNumberType)(const uint32_t)-1;
2734 bitStream->AlignReadToByteBoundary(); // Potentially nothing else to Read
2735
2736 if ( internalPacket->reliability == UNRELIABLE_SEQUENCED ||
2737 internalPacket->reliability == RELIABLE_SEQUENCED
2738 )
2739 {
2740 bitStream->Read(internalPacket->sequencingIndex); // Used for UNRELIABLE_SEQUENCED, RELIABLE_SEQUENCED, RELIABLE_ORDERED.
2741 }
2742
2743 if ( internalPacket->reliability == UNRELIABLE_SEQUENCED ||
2744 internalPacket->reliability == RELIABLE_SEQUENCED ||
2745 internalPacket->reliability == RELIABLE_ORDERED ||
2746 internalPacket->reliability == RELIABLE_ORDERED_WITH_ACK_RECEIPT
2747 )
2748 {
2749 bitStream->Read(internalPacket->orderingIndex); // Used for UNRELIABLE_SEQUENCED, RELIABLE_SEQUENCED, RELIABLE_ORDERED. 4 bytes.
2750 readSuccess=bitStream->ReadAlignedVar8((char*)& internalPacket->orderingChannel); // Used for UNRELIABLE_SEQUENCED, RELIABLE_SEQUENCED, RELIABLE_ORDERED. 5 bits needed, Read one byte
2751 }
2752 else
2753 internalPacket->orderingChannel=0;
2754
2755 if (hasSplitPacket)
2756 {
2757 // printf("Read before\n");
2758 // bitStream->PrintBits();
2759
2760 bitStream->ReadAlignedVar32((char*)& internalPacket->splitPacketCount); // Only needed if splitPacketCount>0. 4 bytes
2761 bitStream->ReadAlignedVar16((char*)& internalPacket->splitPacketId); // Only needed if splitPacketCount>0.
2762 readSuccess=bitStream->ReadAlignedVar32((char*)& internalPacket->splitPacketIndex); // Only needed if splitPacketCount>0. 4 bytes
2763 RakAssert(readSuccess);
2764
2765 // printf("Read after\n");
2766 // bitStream->PrintBits();
2767 }
2768 else
2769 {
2770 internalPacket->splitPacketCount=0;
2771 }
2772
2773 if (readSuccess==false ||
2774 internalPacket->dataBitLength==0 ||
2775 internalPacket->reliability>=NUMBER_OF_RELIABILITIES ||
2776 internalPacket->orderingChannel>=32 ||
2777 (hasSplitPacket && (internalPacket->splitPacketIndex >= internalPacket->splitPacketCount)))
2778 {
2779 // If this assert hits, encoding is garbage
2780 RakAssert("Encoding is garbage" && 0);
2781 ReleaseToInternalPacketPool( internalPacket );
2782 return 0;
2783 }
2784
2785 // Allocate memory to hold our data
2786 AllocInternalPacketData(internalPacket, BITS_TO_BYTES( internalPacket->dataBitLength ), false, _FILE_AND_LINE_ );
2787 RakAssert(BITS_TO_BYTES( internalPacket->dataBitLength )<MAXIMUM_MTU_SIZE);
2788
2789 if (internalPacket->data == 0)
2790 {
2791 RakAssert("Out of memory in ReliabilityLayer::CreateInternalPacketFromBitStream" && 0);
2792 notifyOutOfMemory(_FILE_AND_LINE_);
2793 ReleaseToInternalPacketPool( internalPacket );
2794 return 0;
2795 }
2796
2797 // Set the last byte to 0 so if ReadBits does not read a multiple of 8 the last bits are 0'ed out
2798 internalPacket->data[ BITS_TO_BYTES( internalPacket->dataBitLength ) - 1 ] = 0;
2799
2800 // Read the data the packet holds
2801 bitStreamSucceeded = bitStream->ReadAlignedBytes( ( unsigned char* ) internalPacket->data, BITS_TO_BYTES( internalPacket->dataBitLength ) );
2802
2803 if ( bitStreamSucceeded == false )
2804 {
2805 // If this hits, most likely the variable buff is too small in RunUpdateCycle in RakPeer.cpp
2806 RakAssert("Couldn't read all the data" && 0);
2807
2808 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
2809 ReleaseToInternalPacketPool( internalPacket );
2810 return 0;
2811 }
2812
2813 return internalPacket;
2814 }
2815
2816
2817 //-------------------------------------------------------------------------------------------------------
2818 // Get the SHA1 code
2819 //-------------------------------------------------------------------------------------------------------
2820 void ReliabilityLayer::GetSHA1( unsigned char * const buffer, unsigned int
2821 nbytes, char code[ SHA1_LENGTH ] )
2822 {
2823 CSHA1 sha1;
2824
2825 sha1.Reset();
2826 sha1.Update( ( unsigned char* ) buffer, nbytes );
2827 sha1.Final();
2828 memcpy( code, sha1.GetHash(), SHA1_LENGTH );
2829 }
2830
2831 //-------------------------------------------------------------------------------------------------------
2832 // Check the SHA1 code
2833 //-------------------------------------------------------------------------------------------------------
2834 bool ReliabilityLayer::CheckSHA1( char code[ SHA1_LENGTH ], unsigned char *
2835 const buffer, unsigned int nbytes )
2836 {
2837 char code2[ SHA1_LENGTH ];
2838 GetSHA1( buffer, nbytes, code2 );
2839
2840 for ( int i = 0; i < SHA1_LENGTH; i++ )
2841 if ( code[ i ] != code2[ i ] )
2842 return false;
2843
2844 return true;
2845 }
2846
2847 /*
2848 //-------------------------------------------------------------------------------------------------------
2849 // Search the specified list for sequenced packets on the specified ordering
2850 // stream, optionally skipping those with splitPacketId, and delete them
2851 //-------------------------------------------------------------------------------------------------------
2852 void ReliabilityLayer::DeleteSequencedPacketsInList( unsigned char orderingChannel, DataStructures::List<InternalPacket*>&theList, int splitPacketId )
2853 {
2854 unsigned i = 0;
2855
2856 while ( i < theList.Size() )
2857 {
2858 if ( (
2859 theList[ i ]->reliability == RELIABLE_SEQUENCED ||
2860 theList[ i ]->reliability == UNRELIABLE_SEQUENCED
2861 // ||
2862 // theList[ i ]->reliability == RELIABLE_SEQUENCED_WITH_ACK_RECEIPT ||
2863 // theList[ i ]->reliability == UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT
2864 ) &&
2865 theList[ i ]->orderingChannel == orderingChannel && ( splitPacketId == -1 || theList[ i ]->splitPacketId != (unsigned int) splitPacketId ) )
2866 {
2867 InternalPacket * internalPacket = theList[ i ];
2868 theList.RemoveAtIndex( i );
2869 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
2870 ReleaseToInternalPacketPool( internalPacket );
2871 }
2872
2873 else
2874 i++;
2875 }
2876 }
2877
2878 //-------------------------------------------------------------------------------------------------------
2879 // Search the specified list for sequenced packets with a value less than orderingIndex and delete them
2880 // Note - I added functionality so you can use the Queue as a list (in this case for searching) but it is less efficient to do so than a regular list
2881 //-------------------------------------------------------------------------------------------------------
2882 void ReliabilityLayer::DeleteSequencedPacketsInList( unsigned char orderingChannel, DataStructures::Queue<InternalPacket*>&theList )
2883 {
2884 InternalPacket * internalPacket;
2885 int listSize = theList.Size();
2886 int i = 0;
2887
2888 while ( i < listSize )
2889 {
2890 if ( (
2891 theList[ i ]->reliability == RELIABLE_SEQUENCED ||
2892 theList[ i ]->reliability == UNRELIABLE_SEQUENCED
2893 // ||
2894 // theList[ i ]->reliability == RELIABLE_SEQUENCED_WITH_ACK_RECEIPT ||
2895 // theList[ i ]->reliability == UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT
2896 ) && theList[ i ]->orderingChannel == orderingChannel )
2897 {
2898 internalPacket = theList[ i ];
2899 theList.RemoveAtIndex( i );
2900 FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
2901 ReleaseToInternalPacketPool( internalPacket );
2902 listSize--;
2903 }
2904
2905 else
2906 i++;
2907 }
2908 }
2909 */
2910
2911 //-------------------------------------------------------------------------------------------------------
2912 // Returns true if newPacketOrderingIndex is older than the waitingForPacketOrderingIndex
2913 //-------------------------------------------------------------------------------------------------------
2914 bool ReliabilityLayer::IsOlderOrderedPacket( OrderingIndexType newPacketOrderingIndex, OrderingIndexType waitingForPacketOrderingIndex )
2915 {
2916 OrderingIndexType maxRange = (OrderingIndexType) (const uint32_t)-1;
2917
2918 if ( waitingForPacketOrderingIndex > maxRange/(OrderingIndexType)2 )
2919 {
2920 if ( newPacketOrderingIndex >= waitingForPacketOrderingIndex - maxRange/(OrderingIndexType)2+(OrderingIndexType)1 && newPacketOrderingIndex < waitingForPacketOrderingIndex )
2921 {
2922 return true;
2923 }
2924 }
2925
2926 else
2927 if ( newPacketOrderingIndex >= ( OrderingIndexType ) ( waitingForPacketOrderingIndex - (( OrderingIndexType ) maxRange/(OrderingIndexType)2+(OrderingIndexType)1) ) ||
2928 newPacketOrderingIndex < waitingForPacketOrderingIndex )
2929 {
2930 return true;
2931 }
2932
2933 // Old packet
2934 return false;
2935 }
2936
2937 //-------------------------------------------------------------------------------------------------------
2938 // Split the passed packet into chunks under MTU_SIZEbytes (including headers) and save those new chunks
2939 // Optimized version
2940 //-------------------------------------------------------------------------------------------------------
2941 void ReliabilityLayer::SplitPacket( InternalPacket *internalPacket )
2942 {
2943 // Doing all sizes in bytes in this function so I don't write partial bytes with split packets
2944 internalPacket->splitPacketCount = 1; // This causes GetMessageHeaderLengthBits to account for the split packet header
2945 unsigned int headerLength = (unsigned int) BITS_TO_BYTES( GetMessageHeaderLengthBits( internalPacket ) );
2946 unsigned int dataByteLength = (unsigned int) BITS_TO_BYTES( internalPacket->dataBitLength );
2947 int maximumSendBlockBytes, byteOffset, bytesToSend;
2948 SplitPacketIndexType splitPacketIndex;
2949 int i;
2950 InternalPacket **internalPacketArray;
2951
2952 maximumSendBlockBytes = GetMaxDatagramSizeExcludingMessageHeaderBytes() - BITS_TO_BYTES(GetMaxMessageHeaderLengthBits());
2953
2954 // Calculate how many packets we need to create
2955 internalPacket->splitPacketCount = ( ( dataByteLength - 1 ) / ( maximumSendBlockBytes ) + 1 );
2956
2957 // Optimization
2958 // internalPacketArray = SLNet::OP_NEW<InternalPacket*>(internalPacket->splitPacketCount, _FILE_AND_LINE_ );
2959 bool usedAlloca=false;
2960 #if USE_ALLOCA==1
2961 if (sizeof( InternalPacket* ) * internalPacket->splitPacketCount < MAX_ALLOCA_STACK_ALLOCATION)
2962 {
2963 internalPacketArray = ( InternalPacket** ) alloca( sizeof( InternalPacket* ) * internalPacket->splitPacketCount );
2964 usedAlloca=true;
2965 }
2966 else
2967 #endif
2968 internalPacketArray = (InternalPacket**) rakMalloc_Ex( sizeof(InternalPacket*) * internalPacket->splitPacketCount, _FILE_AND_LINE_ );
2969
2970 for ( i = 0; i < ( int ) internalPacket->splitPacketCount; i++ )
2971 {
2972 internalPacketArray[ i ] = AllocateFromInternalPacketPool();
2973
2974 //internalPacketArray[ i ] = (InternalPacket*) alloca( sizeof( InternalPacket ) );
2975 // internalPacketArray[ i ] = sendPacketSet[internalPacket->priority].WriteLock();
2976 *internalPacketArray[ i ]=*internalPacket;
2977 internalPacketArray[ i ]->messageNumberAssigned=false;
2978
2979 if (i!=0)
2980 internalPacket->messageInternalOrder = internalOrderIndex++;
2981 }
2982
2983 // This identifies which packet this is in the set
2984 splitPacketIndex = 0;
2985
2986 InternalPacketRefCountedData *refCounter=0;
2987
2988 // Do a loop to send out all the packets
2989 do
2990 {
2991 byteOffset = splitPacketIndex * maximumSendBlockBytes;
2992 bytesToSend = dataByteLength - byteOffset;
2993
2994 if ( bytesToSend > maximumSendBlockBytes )
2995 bytesToSend = maximumSendBlockBytes;
2996
2997 // Copy over our chunk of data
2998
2999 AllocInternalPacketData(internalPacketArray[ splitPacketIndex ], &refCounter, internalPacket->data, internalPacket->data + byteOffset);
3000 // internalPacketArray[ splitPacketIndex ]->data = (unsigned char*) rakMalloc_Ex( bytesToSend, _FILE_AND_LINE_ );
3001 // memcpy( internalPacketArray[ splitPacketIndex ]->data, internalPacket->data + byteOffset, bytesToSend );
3002
3003 if ( bytesToSend != maximumSendBlockBytes )
3004 internalPacketArray[ splitPacketIndex ]->dataBitLength = internalPacket->dataBitLength - splitPacketIndex * ( maximumSendBlockBytes << 3 );
3005 else
3006 internalPacketArray[ splitPacketIndex ]->dataBitLength = bytesToSend << 3;
3007
3008 internalPacketArray[ splitPacketIndex ]->splitPacketIndex = splitPacketIndex;
3009 internalPacketArray[ splitPacketIndex ]->splitPacketId = splitPacketId;
3010 internalPacketArray[ splitPacketIndex ]->splitPacketCount = internalPacket->splitPacketCount;
3011 RakAssert(internalPacketArray[ splitPacketIndex ]->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
3012 } while ( ++splitPacketIndex < internalPacket->splitPacketCount );
3013
3014 splitPacketId++; // It's ok if this wraps to 0
3015
3016 // InternalPacket *workingPacket;
3017
3018 // Tell the heap we are going to push a list of elements where each element in the list follows the heap order
3019 RakAssert(outgoingPacketBuffer.Size()==0 || outgoingPacketBuffer.Peek()->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
3020 outgoingPacketBuffer.StartSeries();
3021
3022 // Copy all the new packets into the split packet list
3023 for ( i = 0; i < ( int ) internalPacket->splitPacketCount; i++ )
3024 {
3025 internalPacketArray[ i ]->headerLength=headerLength;
3026 RakAssert(internalPacketArray[ i ]->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
3027 AddToUnreliableLinkedList(internalPacketArray[ i ]);
3028 // sendPacketSet[ internalPacket->priority ].Push( internalPacketArray[ i ], _FILE_AND_LINE_ );
3029 RakAssert(internalPacketArray[ i ]->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
3030 RakAssert(internalPacketArray[ i ]->messageNumberAssigned==false);
3031 outgoingPacketBuffer.PushSeries(GetNextWeight(internalPacketArray[ i ]->priority), internalPacketArray[ i ], _FILE_AND_LINE_);
3032 RakAssert(outgoingPacketBuffer.Size()==0 || outgoingPacketBuffer.Peek()->dataBitLength<BYTES_TO_BITS(MAXIMUM_MTU_SIZE));
3033 statistics.messageInSendBuffer[(int)internalPacketArray[ i ]->priority]++;
3034 statistics.bytesInSendBuffer[(int)(int)internalPacketArray[ i ]->priority]+=(double) BITS_TO_BYTES(internalPacketArray[ i ]->dataBitLength);
3035 // workingPacket=sendPacketSet[internalPacket->priority].WriteLock();
3036 // memcpy(workingPacket, internalPacketArray[ i ], sizeof(InternalPacket));
3037 // sendPacketSet[internalPacket->priority].WriteUnlock();
3038 }
3039
3040 // Do not delete, original is referenced by all split packets to avoid numerous allocations. See AllocInternalPacketData above
3041 // FreeInternalPacketData(internalPacket, _FILE_AND_LINE_ );
3042 ReleaseToInternalPacketPool( internalPacket );
3043
3044 if (usedAlloca==false)
3045 rakFree_Ex(internalPacketArray, _FILE_AND_LINE_ );
3046 }
3047
3048 //-------------------------------------------------------------------------------------------------------
3049 // Insert a packet into the split packet list
3050 //-------------------------------------------------------------------------------------------------------
3051 void ReliabilityLayer::InsertIntoSplitPacketList( InternalPacket * internalPacket, CCTimeType time )
3052 {
3053 bool objectExists;
3054 unsigned index;
3055 // Find in splitPacketChannelList if a SplitPacketChannel with this splitPacketId was already allocated. If not, allocate and insert the channel into the list.
3056 index=splitPacketChannelList.GetIndexFromKey(internalPacket->splitPacketId, &objectExists);
3057 if (objectExists==false)
3058 {
3059 SplitPacketChannel *newChannel = SLNet::OP_NEW<SplitPacketChannel>( __FILE__, __LINE__ );
3060 #if PREALLOCATE_LARGE_MESSAGES==1
3061 index=splitPacketChannelList.Insert(internalPacket->splitPacketId, newChannel, true, __FILE__,__LINE__);
3062 newChannel->returnedPacket=CreateInternalPacketCopy( internalPacket, 0, 0, time );
3063 newChannel->gotFirstPacket=false;
3064 newChannel->splitPacketsArrived=0;
3065 AllocInternalPacketData(newChannel->returnedPacket, BITS_TO_BYTES( internalPacket->dataBitLength*internalPacket->splitPacketCount ), false, __FILE__, __LINE__ );
3066 RakAssert(newChannel->returnedPacket->data);
3067 #else
3068 newChannel->firstPacket=0;
3069 index=splitPacketChannelList.Insert(internalPacket->splitPacketId, newChannel, true, __FILE__,__LINE__);
3070 // Preallocate to the final size, to avoid runtime copies
3071 newChannel->splitPacketList.Preallocate(internalPacket->splitPacketCount, __FILE__,__LINE__);
3072
3073 #endif
3074 }
3075
3076 #if PREALLOCATE_LARGE_MESSAGES==1
3077 splitPacketChannelList[index]->lastUpdateTime=time;
3078 splitPacketChannelList[index]->splitPacketsArrived++;
3079 splitPacketChannelList[index]->returnedPacket->dataBitLength+=internalPacket->dataBitLength;
3080
3081 bool dealloc;
3082 if (internalPacket->splitPacketIndex==0)
3083 {
3084 splitPacketChannelList[index]->gotFirstPacket=true;
3085 splitPacketChannelList[index]->stride=BITS_TO_BYTES(internalPacket->dataBitLength);
3086
3087 for (unsigned int j=0; j < splitPacketChannelList[index]->splitPacketList.Size(); j++)
3088 {
3089 memcpy(splitPacketChannelList[index]->returnedPacket->data+internalPacket->splitPacketIndex*splitPacketChannelList[index]->stride, internalPacket->data, (size_t) BITS_TO_BYTES(internalPacket->dataBitLength));
3090 FreeInternalPacketData(splitPacketChannelList[index]->splitPacketList[j], __FILE__, __LINE__ );
3091 ReleaseToInternalPacketPool(splitPacketChannelList[index]->splitPacketList[j]);
3092 }
3093
3094 memcpy(splitPacketChannelList[index]->returnedPacket->data, internalPacket->data, (size_t) BITS_TO_BYTES(internalPacket->dataBitLength));
3095 splitPacketChannelList[index]->splitPacketList.Clear(true,__FILE__,__LINE__);
3096 dealloc=true;
3097 }
3098 else
3099 {
3100 if (splitPacketChannelList[index]->gotFirstPacket==true)
3101 {
3102 memcpy(splitPacketChannelList[index]->returnedPacket->data+internalPacket->splitPacketIndex*splitPacketChannelList[index]->stride, internalPacket->data, (size_t) BITS_TO_BYTES(internalPacket->dataBitLength));
3103 dealloc=true;
3104 }
3105 else
3106 {
3107 splitPacketChannelList[index]->splitPacketList.Push(internalPacket,__FILE__,__LINE__);
3108 dealloc=false;
3109 }
3110 }
3111
3112 if (splitPacketChannelList[index]->gotFirstPacket==true &&
3113 splitMessageProgressInterval &&
3114 // splitPacketChannelList[index]->firstPacket &&
3115 // splitPacketChannelList[index]->splitPacketList.Size()!=splitPacketChannelList[index]->firstPacket->splitPacketCount &&
3116 // (splitPacketChannelList[index]->splitPacketList.Size()%splitMessageProgressInterval)==0
3117 splitPacketChannelList[index]->gotFirstPacket &&
3118 splitPacketChannelList[index]->splitPacketsArrived!=splitPacketChannelList[index]->returnedPacket->splitPacketCount &&
3119 (splitPacketChannelList[index]->splitPacketsArrived%splitMessageProgressInterval)==0
3120 )
3121 {
3122 // Return ID_DOWNLOAD_PROGRESS
3123 // Write splitPacketIndex (SplitPacketIndexType)
3124 // Write splitPacketCount (SplitPacketIndexType)
3125 // Write byteLength (4)
3126 // Write data, splitPacketChannelList[index]->splitPacketList[0]->data
3127 InternalPacket *progressIndicator = AllocateFromInternalPacketPool();
3128 // unsigned int len = sizeof(MessageID) + sizeof(unsigned int)*2 + sizeof(unsigned int) + (unsigned int) BITS_TO_BYTES(splitPacketChannelList[index]->firstPacket->dataBitLength);
3129 unsigned int l = (unsigned int) splitPacketChannelList[index]->stride;
3130 const unsigned int len = sizeof(MessageID) + sizeof(unsigned int)*2 + sizeof(unsigned int) + l;
3131 AllocInternalPacketData(progressIndicator, len, false, __FILE__, __LINE__ );
3132 progressIndicator->dataBitLength=BYTES_TO_BITS(len);
3133 progressIndicator->data[0]=(MessageID)ID_DOWNLOAD_PROGRESS;
3134 unsigned int temp;
3135 // temp=splitPacketChannelList[index]->splitPacketList.Size();
3136 temp=splitPacketChannelList[index]->splitPacketsArrived;
3137 memcpy(progressIndicator->data+sizeof(MessageID), &temp, sizeof(unsigned int));
3138 temp=(unsigned int)internalPacket->splitPacketCount;
3139 memcpy(progressIndicator->data+sizeof(MessageID)+sizeof(unsigned int)*1, &temp, sizeof(unsigned int));
3140 // temp=(unsigned int) BITS_TO_BYTES(splitPacketChannelList[index]->firstPacket->dataBitLength);
3141 temp=(unsigned int) BITS_TO_BYTES(l);
3142 memcpy(progressIndicator->data+sizeof(MessageID)+sizeof(unsigned int)*2, &temp, sizeof(unsigned int));
3143 //memcpy(progressIndicator->data+sizeof(MessageID)+sizeof(unsigned int)*3, splitPacketChannelList[index]->firstPacket->data, (size_t) BITS_TO_BYTES(splitPacketChannelList[index]->firstPacket->dataBitLength));
3144 memcpy(progressIndicator->data+sizeof(MessageID)+sizeof(unsigned int)*3, splitPacketChannelList[index]->returnedPacket->data, (size_t) BITS_TO_BYTES(l));
3145 }
3146
3147 if (dealloc)
3148 {
3149 FreeInternalPacketData(internalPacket, __FILE__, __LINE__ );
3150 ReleaseToInternalPacketPool(internalPacket);
3151 }
3152 #else
3153 // Insert the packet into the SplitPacketChannel
3154 splitPacketChannelList[index]->splitPacketList.Insert(internalPacket, __FILE__, __LINE__ );
3155 splitPacketChannelList[index]->lastUpdateTime=time;
3156
3157 // If the index is 0, then this is the first packet. Record this so it can be returned to the user with download progress
3158 if (internalPacket->splitPacketIndex==0)
3159 splitPacketChannelList[index]->firstPacket=internalPacket;
3160
3161 // Return download progress if we have the first packet, the list is not complete, and there are enough packets to justify it
3162 if (splitMessageProgressInterval &&
3163 splitPacketChannelList[index]->firstPacket &&
3164 splitPacketChannelList[index]->splitPacketList.Size()!=splitPacketChannelList[index]->firstPacket->splitPacketCount &&
3165 (splitPacketChannelList[index]->splitPacketList.Size()%splitMessageProgressInterval)==0)
3166 {
3167 // Return ID_DOWNLOAD_PROGRESS
3168 // Write splitPacketIndex (SplitPacketIndexType)
3169 // Write splitPacketCount (SplitPacketIndexType)
3170 // Write byteLength (4)
3171 // Write data, splitPacketChannelList[index]->splitPacketList[0]->data
3172 InternalPacket *progressIndicator = AllocateFromInternalPacketPool();
3173 unsigned int length = sizeof(MessageID) + sizeof(unsigned int)*2 + sizeof(unsigned int) + (unsigned int) BITS_TO_BYTES(splitPacketChannelList[index]->firstPacket->dataBitLength);
3174 AllocInternalPacketData(progressIndicator, length, false, __FILE__, __LINE__ );
3175 progressIndicator->dataBitLength=BYTES_TO_BITS(length);
3176 progressIndicator->data[0]=(MessageID)ID_DOWNLOAD_PROGRESS;
3177 unsigned int temp;
3178 temp=splitPacketChannelList[index]->splitPacketList.Size();
3179 memcpy(progressIndicator->data+sizeof(MessageID), &temp, sizeof(unsigned int));
3180 temp=(unsigned int)internalPacket->splitPacketCount;
3181 memcpy(progressIndicator->data+sizeof(MessageID)+sizeof(unsigned int)*1, &temp, sizeof(unsigned int));
3182 temp=(unsigned int) BITS_TO_BYTES(splitPacketChannelList[index]->firstPacket->dataBitLength);
3183 memcpy(progressIndicator->data+sizeof(MessageID)+sizeof(unsigned int)*2, &temp, sizeof(unsigned int));
3184
3185 memcpy(progressIndicator->data+sizeof(MessageID)+sizeof(unsigned int)*3, splitPacketChannelList[index]->firstPacket->data, (size_t) BITS_TO_BYTES(splitPacketChannelList[index]->firstPacket->dataBitLength));
3186 outputQueue.Push(progressIndicator, __FILE__, __LINE__ );
3187 }
3188
3189 #endif
3190 }
3191
3192 //-------------------------------------------------------------------------------------------------------
3193 // Take all split chunks with the specified splitPacketId and try to
3194 //reconstruct a packet. If we can, allocate and return it. Otherwise return 0
3195 // Optimized version
3196 //-------------------------------------------------------------------------------------------------------
3197 InternalPacket * ReliabilityLayer::BuildPacketFromSplitPacketList( SplitPacketChannel *splitPacketChannel, CCTimeType time )
3198 {
3199 #if PREALLOCATE_LARGE_MESSAGES==1
3200 InternalPacket *returnedPacket=splitPacketChannel->returnedPacket;
3201 SLNet::OP_DELETE(splitPacketChannel, __FILE__, __LINE__);
3202 (void) time;
3203 return returnedPacket;
3204 #else
3205 unsigned int j;
3206 InternalPacket * internalPacket, *splitPacket;
3207 // int splitPacketPartLength;
3208
3209 // Reconstruct
3210 internalPacket = CreateInternalPacketCopy( splitPacketChannel->splitPacketList[0], 0, 0, time );
3211 internalPacket->dataBitLength=0;
3212 for (j=0; j < splitPacketChannel->splitPacketList.Size(); j++)
3213 internalPacket->dataBitLength+=splitPacketChannel->splitPacketList[j]->dataBitLength;
3214 // splitPacketPartLength=BITS_TO_BYTES(splitPacketChannel->firstPacket->dataBitLength);
3215
3216 internalPacket->data = (unsigned char*) rakMalloc_Ex( (size_t) BITS_TO_BYTES( internalPacket->dataBitLength ), _FILE_AND_LINE_ );
3217 internalPacket->allocationScheme=InternalPacket::NORMAL;
3218
3219 BitSize_t offset = 0;
3220 for (j=0; j < splitPacketChannel->splitPacketList.Size(); j++)
3221 {
3222 splitPacket=splitPacketChannel->splitPacketList[j];
3223 memcpy(internalPacket->data + BITS_TO_BYTES(offset), splitPacket->data, (size_t)BITS_TO_BYTES(splitPacketChannel->splitPacketList[j]->dataBitLength));
3224 offset += splitPacketChannel->splitPacketList[j]->dataBitLength;
3225 }
3226
3227 for (j=0; j < splitPacketChannel->splitPacketList.Size(); j++)
3228 {
3229 FreeInternalPacketData(splitPacketChannel->splitPacketList[j], _FILE_AND_LINE_ );
3230 ReleaseToInternalPacketPool(splitPacketChannel->splitPacketList[j]);
3231 }
3232 SLNet::OP_DELETE(splitPacketChannel, __FILE__, __LINE__);
3233
3234 return internalPacket;
3235 #endif
3236 }
3237 //-------------------------------------------------------------------------------------------------------
3238 InternalPacket * ReliabilityLayer::BuildPacketFromSplitPacketList( SplitPacketIdType inSplitPacketId, CCTimeType time,
3239 RakNetSocket2 *s, SystemAddress &systemAddress, RakNetRandom *rnr,
3240 BitStream &updateBitStream)
3241 {
3242 unsigned int i;
3243 bool objectExists;
3244 SplitPacketChannel *splitPacketChannel;
3245 InternalPacket * internalPacket;
3246
3247 // Find in splitPacketChannelList the SplitPacketChannel with this splitPacketId
3248 i=splitPacketChannelList.GetIndexFromKey(inSplitPacketId, &objectExists);
3249 splitPacketChannel=splitPacketChannelList[i];
3250
3251 #if PREALLOCATE_LARGE_MESSAGES==1
3252 if (splitPacketChannel->splitPacketsArrived==splitPacketChannel->returnedPacket->splitPacketCount)
3253 #else
3254 if (splitPacketChannel->splitPacketList.Size()==splitPacketChannel->splitPacketList[0]->splitPacketCount)
3255 #endif
3256 {
3257 // Ack immediately, because for large files this can take a long time
3258 SendACKs(s, systemAddress, time, rnr, updateBitStream);
3259 internalPacket=BuildPacketFromSplitPacketList(splitPacketChannel,time);
3260 splitPacketChannelList.RemoveAtIndex(i);
3261 return internalPacket;
3262 }
3263 else
3264 {
3265 return 0;
3266 }
3267 }
3268 /*
3269 //-------------------------------------------------------------------------------------------------------
3270 // Delete any unreliable split packets that have long since expired
3271 void ReliabilityLayer::DeleteOldUnreliableSplitPackets( CCTimeType time )
3272 {
3273 unsigned i,j;
3274 i=0;
3275 while (i < splitPacketChannelList.Size())
3276 {
3277 #if CC_TIME_TYPE_BYTES==4
3278 if (time > splitPacketChannelList[i]->lastUpdateTime + timeoutTime &&
3279 #else
3280 if (time > splitPacketChannelList[i]->lastUpdateTime + (CCTimeType)timeoutTime*(CCTimeType)1000 &&
3281 #endif
3282 (splitPacketChannelList[i]->splitPacketList[0]->reliability==UNRELIABLE || splitPacketChannelList[i]->splitPacketList[0]->reliability==UNRELIABLE_SEQUENCED))
3283 {
3284 for (j=0; j < splitPacketChannelList[i]->splitPacketList.Size(); j++)
3285 {
3286 SLNet::OP_DELETE_ARRAY(splitPacketChannelList[i]->splitPacketList[j]->data, _FILE_AND_LINE_);
3287 ReleaseToInternalPacketPool(splitPacketChannelList[i]->splitPacketList[j]);
3288 }
3289 SLNet::OP_DELETE(splitPacketChannelList[i], _FILE_AND_LINE_);
3290 splitPacketChannelList.RemoveAtIndex(i);
3291 }
3292 else
3293 i++;
3294 }
3295 }
3296 */
3297
3298 //-------------------------------------------------------------------------------------------------------
3299 // Creates a copy of the specified internal packet with data copied from the original starting at dataByteOffset for dataByteLength bytes.
3300 // Does not copy any split data parameters as that information is always generated does not have any reason to be copied
3301 //-------------------------------------------------------------------------------------------------------
3302 InternalPacket * ReliabilityLayer::CreateInternalPacketCopy( InternalPacket *original, int dataByteOffset, int dataByteLength, CCTimeType time )
3303 {
3304 InternalPacket * copy = AllocateFromInternalPacketPool();
3305 #ifdef _DEBUG
3306 // Remove accessing undefined memory error
3307 memset( copy, 255, sizeof( InternalPacket ) );
3308 #endif
3309 // Copy over our chunk of data
3310
3311 if ( dataByteLength > 0 )
3312 {
3313 AllocInternalPacketData(copy, BITS_TO_BYTES(dataByteLength ), false, _FILE_AND_LINE_ );
3314 memcpy( copy->data, original->data + dataByteOffset, dataByteLength );
3315 }
3316 else
3317 copy->data = 0;
3318
3319 copy->dataBitLength = dataByteLength << 3;
3320 copy->creationTime = time;
3321 copy->nextActionTime = 0;
3322 copy->orderingIndex = original->orderingIndex;
3323 copy->sequencingIndex = original->sequencingIndex;
3324 copy->orderingChannel = original->orderingChannel;
3325 copy->reliableMessageNumber = original->reliableMessageNumber;
3326 copy->priority = original->priority;
3327 copy->reliability = original->reliability;
3328 #if PREALLOCATE_LARGE_MESSAGES==1
3329 copy->splitPacketCount = original->splitPacketCount;
3330 copy->splitPacketId = original->splitPacketId;
3331 copy->splitPacketIndex = original->splitPacketIndex;
3332 #endif
3333
3334 return copy;
3335 }
3336
3337 //-------------------------------------------------------------------------------------------------------
3338 // Get the specified ordering list
3339 //-------------------------------------------------------------------------------------------------------
3340 /*
3341 DataStructures::LinkedList<InternalPacket*> *ReliabilityLayer::GetOrderingListAtOrderingStream( unsigned char orderingChannel )
3342 {
3343 if ( orderingChannel >= orderingList.Size() )
3344 return 0;
3345
3346 return orderingList[ orderingChannel ];
3347 }
3348
3349 //-------------------------------------------------------------------------------------------------------
3350 // Add the internal packet to the ordering list in order based on order index
3351 //-------------------------------------------------------------------------------------------------------
3352 void ReliabilityLayer::AddToOrderingList( InternalPacket * internalPacket )
3353 {
3354 }
3355 */
3356
3357 //-------------------------------------------------------------------------------------------------------
3358 // Inserts a packet into the resend list in order
3359 //-------------------------------------------------------------------------------------------------------
3360 void ReliabilityLayer::InsertPacketIntoResendList( InternalPacket *internalPacket, CCTimeType time, bool firstResend, bool modifyUnacknowledgedBytes )
3361 {
3362 (void) firstResend;
3363 (void) time;
3364 (void) internalPacket;
3365
3366 AddToListTail(internalPacket, modifyUnacknowledgedBytes);
3367 RakAssert(internalPacket->nextActionTime!=0);
3368
3369 }
3370
3371 //-------------------------------------------------------------------------------------------------------
3372 // Were you ever unable to deliver a packet despite retries?
3373 //-------------------------------------------------------------------------------------------------------
3374 bool ReliabilityLayer::IsDeadConnection( void ) const
3375 {
3376 return deadConnection;
3377 }
3378
3379 //-------------------------------------------------------------------------------------------------------
3380 // Causes IsDeadConnection to return true
3381 //-------------------------------------------------------------------------------------------------------
3382 void ReliabilityLayer::KillConnection( void )
3383 {
3384 deadConnection=true;
3385 }
3386
3387
3388 //-------------------------------------------------------------------------------------------------------
3389 // Statistics
3390 //-------------------------------------------------------------------------------------------------------
3391 RakNetStatistics * ReliabilityLayer::GetStatistics( RakNetStatistics *rns )
3392 {
3393 unsigned i;
3394 SLNet::TimeUS time = SLNet::GetTimeUS();
3395 uint64_t uint64Denominator;
3396 double doubleDenominator;
3397
3398 for (i=0; i < RNS_PER_SECOND_METRICS_COUNT; i++)
3399 {
3400 statistics.valueOverLastSecond[i]=bpsMetrics[i].GetBPS1Threadsafe(time);
3401 statistics.runningTotal[i]=bpsMetrics[i].GetTotal1();
3402 }
3403
3404 memcpy(rns, &statistics, sizeof(statistics));
3405
3406 if (rns->valueOverLastSecond[USER_MESSAGE_BYTES_SENT]+rns->valueOverLastSecond[USER_MESSAGE_BYTES_RESENT]>0)
3407 rns->packetlossLastSecond=(float)((double) rns->valueOverLastSecond[USER_MESSAGE_BYTES_RESENT]/((double) rns->valueOverLastSecond[USER_MESSAGE_BYTES_SENT]+(double) rns->valueOverLastSecond[USER_MESSAGE_BYTES_RESENT]));
3408 else
3409 rns->packetlossLastSecond=0.0f;
3410
3411 rns->packetlossTotal=0.0f;
3412 uint64Denominator=(rns->runningTotal[USER_MESSAGE_BYTES_SENT]+rns->runningTotal[USER_MESSAGE_BYTES_RESENT]);
3413 if (uint64Denominator!=0&&rns->runningTotal[USER_MESSAGE_BYTES_SENT]/uint64Denominator>0)
3414 {
3415 doubleDenominator=((double) rns->runningTotal[USER_MESSAGE_BYTES_SENT]+(double) rns->runningTotal[USER_MESSAGE_BYTES_RESENT]);
3416 if(doubleDenominator!=0)
3417 {
3418 rns->packetlossTotal=(float)((double) rns->runningTotal[USER_MESSAGE_BYTES_RESENT]/doubleDenominator);
3419 }
3420 }
3421
3422 rns->isLimitedByCongestionControl=statistics.isLimitedByCongestionControl;
3423 rns->BPSLimitByCongestionControl=statistics.BPSLimitByCongestionControl;
3424 rns->isLimitedByOutgoingBandwidthLimit=statistics.isLimitedByOutgoingBandwidthLimit;
3425 rns->BPSLimitByOutgoingBandwidthLimit=statistics.BPSLimitByOutgoingBandwidthLimit;
3426
3427 return rns;
3428 }
3429
3430 //-------------------------------------------------------------------------------------------------------
3431 // Returns the number of packets in the resend queue, not counting holes
3432 //-------------------------------------------------------------------------------------------------------
3433 unsigned int ReliabilityLayer::GetResendListDataSize(void) const
3434 {
3435 // Not accurate but thread-safe. The commented version might crash if the queue is cleared while we loop through it
3436 // return resendTree.Size();
3437 return statistics.messagesInResendBuffer;
3438 }
3439
3440 //-------------------------------------------------------------------------------------------------------
3441 bool ReliabilityLayer::AckTimeout(SLNet::Time curTime)
3442 {
3443 // I check timeLastDatagramArrived-curTime because with threading it is possible that timeLastDatagramArrived is
3444 // slightly greater than curTime, in which case this is NOT an ack timeout
3445 return (timeLastDatagramArrived-curTime)>10000 && curTime-timeLastDatagramArrived>timeoutTime;
3446 }
3447 //-------------------------------------------------------------------------------------------------------
3448 CCTimeType ReliabilityLayer::GetNextSendTime(void) const
3449 {
3450 return nextSendTime;
3451 }
3452 //-------------------------------------------------------------------------------------------------------
3453 CCTimeType ReliabilityLayer::GetTimeBetweenPackets(void) const
3454 {
3455 return timeBetweenPackets;
3456 }
3457 //-------------------------------------------------------------------------------------------------------
3458 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
3459 CCTimeType ReliabilityLayer::GetAckPing(void) const
3460 {
3461 return ackPing;
3462 }
3463 #endif
3464 //-------------------------------------------------------------------------------------------------------
3465 void ReliabilityLayer::ResetPacketsAndDatagrams(void)
3466 {
3467 packetsToSendThisUpdate.Clear(true, _FILE_AND_LINE_);
3468 packetsToDeallocThisUpdate.Clear(true, _FILE_AND_LINE_);
3469 packetsToSendThisUpdateDatagramBoundaries.Clear(true, _FILE_AND_LINE_);
3470 datagramsToSendThisUpdateIsPair.Clear(true, _FILE_AND_LINE_);
3471 datagramSizesInBytes.Clear(true, _FILE_AND_LINE_);
3472 datagramSizeSoFar=0;
3473 }
3474 //-------------------------------------------------------------------------------------------------------
3475 void ReliabilityLayer::PushPacket(CCTimeType time, InternalPacket *internalPacket, bool isReliable)
3476 {
3477 BitSize_t bitsForThisPacket=BYTES_TO_BITS(BITS_TO_BYTES(internalPacket->dataBitLength)+BITS_TO_BYTES(internalPacket->headerLength));
3478 datagramSizeSoFar+=bitsForThisPacket;
3479 RakAssert(BITS_TO_BYTES(datagramSizeSoFar)<MAXIMUM_MTU_SIZE-UDP_HEADER_SIZE);
3480 allDatagramSizesSoFar+=bitsForThisPacket;
3481 packetsToSendThisUpdate.Push(internalPacket, _FILE_AND_LINE_ );
3482 packetsToDeallocThisUpdate.Push(isReliable==false, _FILE_AND_LINE_ );
3483 RakAssert(internalPacket->headerLength==GetMessageHeaderLengthBits(internalPacket));
3484
3485 // This code tells me how much time elapses between when you send, and when the message actually goes out
3486 // if (internalPacket->data[0]==0)
3487 // {
3488 // SLNet::TimeMS t;
3489 // SLNet::BitStream bs(internalPacket->data+1,sizeof(t),false);
3490 // bs.Read(t);
3491 // SLNet::TimeMS curTime=SLNet::GetTimeMS();
3492 // SLNet::TimeMS diff = curTime-t;
3493 // }
3494
3495 congestionManager.OnSendBytes(time, BITS_TO_BYTES(internalPacket->dataBitLength)+BITS_TO_BYTES(internalPacket->headerLength));
3496 }
3497 //-------------------------------------------------------------------------------------------------------
3498 void ReliabilityLayer::PushDatagram(void)
3499 {
3500 if (datagramSizeSoFar>0)
3501 {
3502 packetsToSendThisUpdateDatagramBoundaries.Push(packetsToSendThisUpdate.Size(), _FILE_AND_LINE_ );
3503 datagramsToSendThisUpdateIsPair.Push(false, _FILE_AND_LINE_ );
3504 RakAssert(BITS_TO_BYTES(datagramSizeSoFar)<MAXIMUM_MTU_SIZE-UDP_HEADER_SIZE);
3505 datagramSizesInBytes.Push(BITS_TO_BYTES(datagramSizeSoFar), _FILE_AND_LINE_ );
3506 datagramSizeSoFar=0;
3507
3508 // Disable packet pairs
3509 /*
3510 if (countdownToNextPacketPair==0)
3511 {
3512 if (TagMostRecentPushAsSecondOfPacketPair())
3513 countdownToNextPacketPair=15;
3514 }
3515 else
3516 countdownToNextPacketPair--;
3517 */
3518 }
3519 }
3520 //-------------------------------------------------------------------------------------------------------
3521 bool ReliabilityLayer::TagMostRecentPushAsSecondOfPacketPair(void)
3522 {
3523 if (datagramsToSendThisUpdateIsPair.Size()>=2)
3524 {
3525 datagramsToSendThisUpdateIsPair[datagramsToSendThisUpdateIsPair.Size()-2]=true;
3526 datagramsToSendThisUpdateIsPair[datagramsToSendThisUpdateIsPair.Size()-1]=true;
3527 return true;
3528 }
3529 return false;
3530 }
3531 //-------------------------------------------------------------------------------------------------------
3532 void ReliabilityLayer::ClearPacketsAndDatagrams(void)
3533 {
3534 unsigned int i;
3535 for (i=0; i < packetsToDeallocThisUpdate.Size(); i++)
3536 {
3537 // packetsToDeallocThisUpdate holds a boolean indicating if packetsToSendThisUpdate at this index should be freed
3538 if (packetsToDeallocThisUpdate[i])
3539 {
3540 RemoveFromUnreliableLinkedList(packetsToSendThisUpdate[i]);
3541 FreeInternalPacketData(packetsToSendThisUpdate[i], _FILE_AND_LINE_ );
3542 // if (keepInternalPacketIfNeedsAck==false || packetsToSendThisUpdate[i]->reliability<RELIABLE_WITH_ACK_RECEIPT)
3543 ReleaseToInternalPacketPool( packetsToSendThisUpdate[i] );
3544 }
3545 }
3546 packetsToDeallocThisUpdate.Clear(true, _FILE_AND_LINE_);
3547 }
3548 //-------------------------------------------------------------------------------------------------------
3549 void ReliabilityLayer::MoveToListHead(InternalPacket *internalPacket)
3550 {
3551 if ( internalPacket == resendLinkedListHead )
3552 return;
3553 if (resendLinkedListHead==0)
3554 {
3555 internalPacket->resendNext=internalPacket;
3556 internalPacket->resendPrev=internalPacket;
3557 resendLinkedListHead=internalPacket;
3558 return;
3559 }
3560 internalPacket->resendPrev->resendNext = internalPacket->resendNext;
3561 internalPacket->resendNext->resendPrev = internalPacket->resendPrev;
3562 internalPacket->resendNext=resendLinkedListHead;
3563 internalPacket->resendPrev=resendLinkedListHead->resendPrev;
3564 internalPacket->resendPrev->resendNext=internalPacket;
3565 resendLinkedListHead->resendPrev=internalPacket;
3566 resendLinkedListHead=internalPacket;
3567 RakAssert(internalPacket->headerLength+internalPacket->dataBitLength>0);
3568
3569 //ValidateResendList();
3570 }
3571 //-------------------------------------------------------------------------------------------------------
3572 void ReliabilityLayer::RemoveFromList(InternalPacket *internalPacket, bool modifyUnacknowledgedBytes)
3573 {
3574 InternalPacket *newPosition;
3575 internalPacket->resendPrev->resendNext = internalPacket->resendNext;
3576 internalPacket->resendNext->resendPrev = internalPacket->resendPrev;
3577 newPosition = internalPacket->resendNext;
3578 if ( internalPacket == resendLinkedListHead )
3579 resendLinkedListHead = newPosition;
3580 if (resendLinkedListHead==internalPacket)
3581 resendLinkedListHead=0;
3582
3583 if (modifyUnacknowledgedBytes)
3584 {
3585 RakAssert(unacknowledgedBytes>=BITS_TO_BYTES(internalPacket->headerLength+internalPacket->dataBitLength));
3586 unacknowledgedBytes-=BITS_TO_BYTES(internalPacket->headerLength+internalPacket->dataBitLength);
3587 // printf("-unacknowledgedBytes:%i ", unacknowledgedBytes);
3588
3589
3590 // ValidateResendList();
3591 }
3592 }
3593 //-------------------------------------------------------------------------------------------------------
3594 void ReliabilityLayer::AddToListTail(InternalPacket *internalPacket, bool modifyUnacknowledgedBytes)
3595 {
3596 if (modifyUnacknowledgedBytes)
3597 {
3598 unacknowledgedBytes+=BITS_TO_BYTES(internalPacket->headerLength+internalPacket->dataBitLength);
3599 // printf("+unacknowledgedBytes:%i ", unacknowledgedBytes);
3600 }
3601
3602 if (resendLinkedListHead==0)
3603 {
3604 internalPacket->resendNext=internalPacket;
3605 internalPacket->resendPrev=internalPacket;
3606 resendLinkedListHead=internalPacket;
3607 return;
3608 }
3609 internalPacket->resendNext=resendLinkedListHead;
3610 internalPacket->resendPrev=resendLinkedListHead->resendPrev;
3611 internalPacket->resendPrev->resendNext=internalPacket;
3612 resendLinkedListHead->resendPrev=internalPacket;
3613
3614 // ValidateResendList();
3615
3616 }
3617 //-------------------------------------------------------------------------------------------------------
3618 void ReliabilityLayer::PopListHead(bool modifyUnacknowledgedBytes)
3619 {
3620 RakAssert(resendLinkedListHead!=0);
3621 RemoveFromList(resendLinkedListHead, modifyUnacknowledgedBytes);
3622 }
3623 //-------------------------------------------------------------------------------------------------------
3624 bool ReliabilityLayer::IsResendQueueEmpty(void) const
3625 {
3626 return resendLinkedListHead==0;
3627 }
3628 //-------------------------------------------------------------------------------------------------------
3629 void ReliabilityLayer::SendACKs(RakNetSocket2 *s, SystemAddress &systemAddress, CCTimeType time, RakNetRandom *rnr, BitStream &updateBitStream)
3630 {
3631 BitSize_t maxDatagramPayload = GetMaxDatagramSizeExcludingMessageHeaderBits();
3632
3633 while (acknowlegements.Size()>0)
3634 {
3635 // Send acks
3636 updateBitStream.Reset();
3637 DatagramHeaderFormat dhf;
3638 dhf.isACK=true;
3639 dhf.isNAK=false;
3640 dhf.isPacketPair=false;
3641 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
3642 dhf.sourceSystemTime=time;
3643 #endif
3644 double B;
3645 double AS;
3646 bool hasBAndAS;
3647 if (remoteSystemNeedsBAndAS)
3648 {
3649 congestionManager.OnSendAckGetBAndAS(time, &hasBAndAS,&B,&AS);
3650 dhf.AS=(float)AS;
3651 dhf.hasBAndAS=hasBAndAS;
3652 }
3653 else
3654 dhf.hasBAndAS=false;
3655 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
3656 dhf.sourceSystemTime=nextAckTimeToSend;
3657 #endif
3658 // dhf.B=(float)B;
3659 updateBitStream.Reset();
3660 dhf.Serialize(&updateBitStream);
3661 CC_DEBUG_PRINTF_1("AckSnd ");
3662 acknowlegements.Serialize(&updateBitStream, maxDatagramPayload, true);
3663 SendBitStream( s, systemAddress, &updateBitStream, rnr, time );
3664 congestionManager.OnSendAck(time,updateBitStream.GetNumberOfBytesUsed());
3665
3666 // I think this is causing a bug where if the estimated bandwidth is very low for the recipient, only acks ever get sent
3667 // congestionManager.OnSendBytes(time,UDP_HEADER_SIZE+updateBitStream.GetNumberOfBytesUsed());
3668 }
3669 }
3670 /*
3671 //-------------------------------------------------------------------------------------------------------
3672 ReliabilityLayer::DatagramMessageIDList* ReliabilityLayer::AllocateFromDatagramMessageIDPool(void)
3673 {
3674 DatagramMessageIDList*s;
3675 s=datagramMessageIDPool.Allocate( _FILE_AND_LINE_ );
3676 // Call new operator, memoryPool doesn't do this
3677 s = new ((void*)s) DatagramMessageIDList;
3678 return s;
3679 }
3680 //-------------------------------------------------------------------------------------------------------
3681 void ReliabilityLayer::ReleaseToDatagramMessageIDPool(DatagramMessageIDList* d)
3682 {
3683 d->~DatagramMessageIDList();
3684 datagramMessageIDPool.Release(d);
3685 }
3686 */
3687 //-------------------------------------------------------------------------------------------------------
3688 InternalPacket* ReliabilityLayer::AllocateFromInternalPacketPool(void)
3689 {
3690 InternalPacket *ip = internalPacketPool.Allocate( _FILE_AND_LINE_ );
3691 ip->reliableMessageNumber = (MessageNumberType) (const uint32_t)-1;
3692 ip->messageNumberAssigned=false;
3693 ip->nextActionTime = 0;
3694 ip->splitPacketCount = 0;
3695 ip->splitPacketIndex = 0;
3696 ip->splitPacketId = 0;
3697 ip->allocationScheme=InternalPacket::NORMAL;
3698 ip->data=0;
3699 ip->timesSent=0;
3700 return ip;
3701 }
3702 //-------------------------------------------------------------------------------------------------------
3703 void ReliabilityLayer::ReleaseToInternalPacketPool(InternalPacket *ip)
3704 {
3705 internalPacketPool.Release(ip, _FILE_AND_LINE_);
3706 }
3707 //-------------------------------------------------------------------------------------------------------
3708 void ReliabilityLayer::RemoveFromUnreliableLinkedList(InternalPacket *internalPacket)
3709 {
3710 if (internalPacket->reliability==UNRELIABLE ||
3711 internalPacket->reliability==UNRELIABLE_SEQUENCED ||
3712 internalPacket->reliability==UNRELIABLE_WITH_ACK_RECEIPT
3713 // ||
3714 // internalPacket->reliability==UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT
3715 )
3716 {
3717 InternalPacket *newPosition;
3718 internalPacket->unreliablePrev->unreliableNext = internalPacket->unreliableNext;
3719 internalPacket->unreliableNext->unreliablePrev = internalPacket->unreliablePrev;
3720 newPosition = internalPacket->unreliableNext;
3721 if ( internalPacket == unreliableLinkedListHead )
3722 unreliableLinkedListHead = newPosition;
3723 if (unreliableLinkedListHead==internalPacket)
3724 unreliableLinkedListHead=0;
3725 }
3726 }
3727 //-------------------------------------------------------------------------------------------------------
3728 void ReliabilityLayer::AddToUnreliableLinkedList(InternalPacket *internalPacket)
3729 {
3730 if (internalPacket->reliability==UNRELIABLE ||
3731 internalPacket->reliability==UNRELIABLE_SEQUENCED ||
3732 internalPacket->reliability==UNRELIABLE_WITH_ACK_RECEIPT
3733 // ||
3734 // internalPacket->reliability==UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT
3735 )
3736 {
3737 if (unreliableLinkedListHead==0)
3738 {
3739 internalPacket->unreliableNext=internalPacket;
3740 internalPacket->unreliablePrev=internalPacket;
3741 unreliableLinkedListHead=internalPacket;
3742 return;
3743 }
3744 internalPacket->unreliableNext=unreliableLinkedListHead;
3745 internalPacket->unreliablePrev=unreliableLinkedListHead->unreliablePrev;
3746 internalPacket->unreliablePrev->unreliableNext=internalPacket;
3747 unreliableLinkedListHead->unreliablePrev=internalPacket;
3748 }
3749 }
3750 //-------------------------------------------------------------------------------------------------------
3751 void ReliabilityLayer::ValidateResendList(void) const
3752 {
3753 // unsigned int count1=0, count2=0;
3754 // for (unsigned int i=0; i < RESEND_BUFFER_ARRAY_LENGTH; i++)
3755 // if (resendBuffer[i])
3756 // count1++;
3757 //
3758 // if (resendLinkedListHead)
3759 // {
3760 // InternalPacket *internalPacket = resendLinkedListHead;
3761 // do
3762 // {
3763 // count2++;
3764 // internalPacket=internalPacket->resendNext;
3765 // } while (internalPacket!=resendLinkedListHead);
3766 // }
3767 // RakAssert(count1==count2);
3768 // RakAssert(count2<=RESEND_BUFFER_ARRAY_LENGTH);
3769 }
3770 //-------------------------------------------------------------------------------------------------------
3771 bool ReliabilityLayer::ResendBufferOverflow(void) const
3772 {
3773 int index1 = sendReliableMessageNumberIndex & (uint32_t) RESEND_BUFFER_ARRAY_MASK;
3774 // int index2 = (sendReliableMessageNumberIndex+(uint32_t)1) & (uint32_t) RESEND_BUFFER_ARRAY_MASK;
3775 RakAssert(index1<RESEND_BUFFER_ARRAY_LENGTH);
3776 return resendBuffer[index1]!=0; // || resendBuffer[index2]!=0;
3777
3778 }
3779 //-------------------------------------------------------------------------------------------------------
3780 ReliabilityLayer::MessageNumberNode* ReliabilityLayer::GetMessageNumberNodeByDatagramIndex(DatagramSequenceNumberType index, CCTimeType *timeSent)
3781 {
3782 if (datagramHistory.IsEmpty())
3783 return 0;
3784
3785 if (congestionManager.LessThan(index, datagramHistoryPopCount))
3786 return 0;
3787
3788 DatagramSequenceNumberType offsetIntoList = index - datagramHistoryPopCount;
3789 if (offsetIntoList >= datagramHistory.Size())
3790 return 0;
3791
3792 *timeSent=datagramHistory[offsetIntoList].timeSent;
3793 return datagramHistory[offsetIntoList].head;
3794 }
3795 //-------------------------------------------------------------------------------------------------------
3796 void ReliabilityLayer::RemoveFromDatagramHistory(DatagramSequenceNumberType index)
3797 {
3798 DatagramSequenceNumberType offsetIntoList = index - datagramHistoryPopCount;
3799 MessageNumberNode *mnm = datagramHistory[offsetIntoList].head;
3800 MessageNumberNode *next;
3801 while (mnm)
3802 {
3803 next=mnm->next;
3804 datagramHistoryMessagePool.Release(mnm, _FILE_AND_LINE_);
3805 mnm=next;
3806 }
3807 datagramHistory[offsetIntoList].head=0;
3808 }
3809 //-------------------------------------------------------------------------------------------------------
3810 void ReliabilityLayer::AddFirstToDatagramHistory(DatagramSequenceNumberType datagramNumber, CCTimeType timeSent)
3811 {
3812 (void) datagramNumber;
3813 if (datagramHistory.Size()>DATAGRAM_MESSAGE_ID_ARRAY_LENGTH)
3814 {
3815 RemoveFromDatagramHistory(datagramHistoryPopCount);
3816 datagramHistory.Pop();
3817 datagramHistoryPopCount++;
3818 }
3819
3820 datagramHistory.Push(DatagramHistoryNode(0, timeSent), _FILE_AND_LINE_);
3821 // printf("%p Pushed empty DatagramHistoryNode to datagram history at index %i\n", this, datagramHistory.Size()-1);
3822 }
3823 //-------------------------------------------------------------------------------------------------------
3824 ReliabilityLayer::MessageNumberNode* ReliabilityLayer::AddFirstToDatagramHistory(DatagramSequenceNumberType datagramNumber, DatagramSequenceNumberType messageNumber, CCTimeType timeSent)
3825 {
3826 (void) datagramNumber;
3827 // RakAssert(datagramHistoryPopCount+(unsigned int) datagramHistory.Size()==datagramNumber);
3828 if (datagramHistory.Size()>DATAGRAM_MESSAGE_ID_ARRAY_LENGTH)
3829 {
3830 RemoveFromDatagramHistory(datagramHistoryPopCount);
3831 datagramHistory.Pop();
3832 datagramHistoryPopCount++;
3833 }
3834
3835 MessageNumberNode *mnm = datagramHistoryMessagePool.Allocate(_FILE_AND_LINE_);
3836 mnm->next=0;
3837 mnm->messageNumber=messageNumber;
3838 datagramHistory.Push(DatagramHistoryNode(mnm, timeSent), _FILE_AND_LINE_);
3839 // printf("%p Pushed message %i to DatagramHistoryNode to datagram history at index %i\n", this, messageNumber.val, datagramHistory.Size()-1);
3840 return mnm;
3841 }
3842 //-------------------------------------------------------------------------------------------------------
3843 ReliabilityLayer::MessageNumberNode* ReliabilityLayer::AddSubsequentToDatagramHistory(MessageNumberNode *messageNumberNode, DatagramSequenceNumberType messageNumber)
3844 {
3845 messageNumberNode->next=datagramHistoryMessagePool.Allocate(_FILE_AND_LINE_);
3846 messageNumberNode->next->messageNumber=messageNumber;
3847 messageNumberNode->next->next=0;
3848 return messageNumberNode->next;
3849 }
3850 //-------------------------------------------------------------------------------------------------------
3851 void ReliabilityLayer::AllocInternalPacketData(InternalPacket *internalPacket, InternalPacketRefCountedData **refCounter, unsigned char *externallyAllocatedPtr, unsigned char *ourOffset)
3852 {
3853 internalPacket->allocationScheme=InternalPacket::REF_COUNTED;
3854 internalPacket->data=ourOffset;
3855 if (*refCounter==0)
3856 {
3857 *refCounter = refCountedDataPool.Allocate(_FILE_AND_LINE_);
3858 // *refCounter = SLNet::OP_NEW<InternalPacketRefCountedData>(_FILE_AND_LINE_);
3859 (*refCounter)->refCount=1;
3860 (*refCounter)->sharedDataBlock=externallyAllocatedPtr;
3861 }
3862 else
3863 (*refCounter)->refCount++;
3864 internalPacket->refCountedData=(*refCounter);
3865 }
3866 //-------------------------------------------------------------------------------------------------------
3867 void ReliabilityLayer::AllocInternalPacketData(InternalPacket *internalPacket, unsigned char *externallyAllocatedPtr)
3868 {
3869 internalPacket->allocationScheme=InternalPacket::NORMAL;
3870 internalPacket->data=externallyAllocatedPtr;
3871 }
3872 //-------------------------------------------------------------------------------------------------------
3873 void ReliabilityLayer::AllocInternalPacketData(InternalPacket *internalPacket, unsigned int numBytes, bool allowStack, const char *file, unsigned int line)
3874 {
3875 if (allowStack && numBytes <= sizeof(internalPacket->stackData))
3876 {
3877 internalPacket->allocationScheme=InternalPacket::STACK;
3878 internalPacket->data=internalPacket->stackData;
3879 }
3880 else
3881 {
3882 internalPacket->allocationScheme=InternalPacket::NORMAL;
3883 internalPacket->data=(unsigned char*) rakMalloc_Ex(numBytes,file,line);
3884 }
3885 }
3886 //-------------------------------------------------------------------------------------------------------
3887 void ReliabilityLayer::FreeInternalPacketData(InternalPacket *internalPacket, const char *file, unsigned int line)
3888 {
3889 if (internalPacket==0)
3890 return;
3891
3892 if (internalPacket->allocationScheme==InternalPacket::REF_COUNTED)
3893 {
3894 if (internalPacket->refCountedData==0)
3895 return;
3896
3897 internalPacket->refCountedData->refCount--;
3898 if (internalPacket->refCountedData->refCount==0)
3899 {
3900 rakFree_Ex(internalPacket->refCountedData->sharedDataBlock, file, line );
3901 internalPacket->refCountedData->sharedDataBlock=0;
3902 // SLNet::OP_DELETE(internalPacket->refCountedData,file, line);
3903 refCountedDataPool.Release(internalPacket->refCountedData,file, line);
3904 internalPacket->refCountedData=0;
3905 }
3906 }
3907 else if (internalPacket->allocationScheme==InternalPacket::NORMAL)
3908 {
3909 if (internalPacket->data==0)
3910 return;
3911
3912 rakFree_Ex(internalPacket->data, file, line );
3913 internalPacket->data=0;
3914 }
3915 else
3916 {
3917 // Data was on stack
3918 internalPacket->data=0;
3919 }
3920 }
3921 //-------------------------------------------------------------------------------------------------------
3922 unsigned int ReliabilityLayer::GetMaxDatagramSizeExcludingMessageHeaderBytes(void)
3923 {
3924 unsigned int val = congestionManager.GetMTU() - DatagramHeaderFormat::GetDataHeaderByteLength();
3925
3926 #if LIBCAT_SECURITY==1
3927 if (useSecurity)
3928 val -= cat::AuthenticatedEncryption::OVERHEAD_BYTES;
3929 #endif
3930
3931 return val;
3932 }
3933 //-------------------------------------------------------------------------------------------------------
3934 BitSize_t ReliabilityLayer::GetMaxDatagramSizeExcludingMessageHeaderBits(void)
3935 {
3936 return BYTES_TO_BITS(GetMaxDatagramSizeExcludingMessageHeaderBytes());
3937 }
3938 //-------------------------------------------------------------------------------------------------------
3939 void ReliabilityLayer::InitHeapWeights(void)
3940 {
3941 for (int priorityLevel=0; priorityLevel < NUMBER_OF_PRIORITIES; priorityLevel++)
3942 outgoingPacketBufferNextWeights[priorityLevel]=(1<<priorityLevel)*priorityLevel+priorityLevel;
3943 }
3944 //-------------------------------------------------------------------------------------------------------
3945 reliabilityHeapWeightType ReliabilityLayer::GetNextWeight(int priorityLevel)
3946 {
3947 uint64_t next = outgoingPacketBufferNextWeights[priorityLevel];
3948 if (outgoingPacketBuffer.Size()>0)
3949 {
3950 int peekPL = outgoingPacketBuffer.Peek()->priority;
3951 reliabilityHeapWeightType weight = outgoingPacketBuffer.PeekWeight();
3952 reliabilityHeapWeightType min = weight - (1<<peekPL)*peekPL+peekPL;
3953 if (next<min)
3954 next=min + (1<<priorityLevel)*priorityLevel+priorityLevel;
3955 outgoingPacketBufferNextWeights[priorityLevel]=next+(1<<priorityLevel)*(priorityLevel+1)+priorityLevel;
3956 }
3957 else
3958 {
3959 InitHeapWeights();
3960 }
3961 return next;
3962 }
3963
3964 //-------------------------------------------------------------------------------------------------------
3965 // #if defined(RELIABILITY_LAYER_NEW_UNDEF_ALLOCATING_QUEUE)
3966 // #pragma pop_macro("new")
3967 // #undef RELIABILITY_LAYER_NEW_UNDEF_ALLOCATING_QUEUE
3968 // #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
DataStructures::Table Member List

This is the complete list of members for DataStructures::Table, including all inherited members.

AddColumn(const char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH], ColumnType columnType) | DataStructures::Table |
AddRow(unsigned rowId) | DataStructures::Table |
AddRow(unsigned rowId, DataStructures::List< Cell > &initialCellValues) | DataStructures::Table |
AddRow(unsigned rowId, DataStructures::List< Cell * > &initialCellValues, bool copyCells=false) | DataStructures::Table |
AddRowColumns(unsigned rowId, Row *row, DataStructures::List< unsigned > columnIndices) | DataStructures::Table | protected
BINARY enum value | DataStructures::Table |
Clear(void) | DataStructures::Table |
ColumnIndex(char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH]) const | DataStructures::Table |
ColumnIndex(const char *columnName) const | DataStructures::Table |
ColumnName(unsigned index) const | DataStructures::Table |
columns | DataStructures::Table | protected
ColumnType enum name | DataStructures::Table |
DeleteRow(Row *row) | DataStructures::Table | protected
FilterQueryType enum name | DataStructures::Table |
GetAvailableRowId(void) const | DataStructures::Table |
GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, int *output) | DataStructures::Table |
GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, char *output) | DataStructures::Table |
GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, char *output, size_t outputLength) | DataStructures::Table |
GetCellValueByIndex(unsigned rowIndex, unsigned columnIndex, char *output, int *outputLength) | DataStructures::Table |
GetColumnCount(void) const | DataStructures::Table |
GetColumns(void) const | DataStructures::Table |
GetColumnType(unsigned index) const | DataStructures::Table |
GetListHead(void) | DataStructures::Table |
GetRowByID(unsigned rowId) const | DataStructures::Table |
GetRowByIndex(unsigned rowIndex, unsigned *key) const | DataStructures::Table |
GetRowCount(void) const | DataStructures::Table |
GetRows(void) const | DataStructures::Table |
NUMERIC enum value | DataStructures::Table |
operator=(const Table &input) | DataStructures::Table |
POINTER enum value | DataStructures::Table |
PrintColumnHeaders(char *out, int outLength, char columnDelineator) const | DataStructures::Table |
PrintRow(char *out, int outLength, char columnDelineator, bool printDelineatorForBinary, Table::Row *inputRow) const | DataStructures::Table |
QF_EQUAL enum value | DataStructures::Table |
QF_GREATER_THAN enum value | DataStructures::Table |
QF_GREATER_THAN_EQ enum value | DataStructures::Table |
QF_IS_EMPTY enum value | DataStructures::Table |
QF_LESS_THAN enum value | DataStructures::Table |
QF_LESS_THAN_EQ enum value | DataStructures::Table |
QF_NOT_EMPTY enum value | DataStructures::Table |
QF_NOT_EQUAL enum value | DataStructures::Table |
QS_DECREASING_ORDER enum value | DataStructures::Table |
QS_INCREASING_ORDER enum value | DataStructures::Table |
QueryRow(DataStructures::List< unsigned > &inclusionFilterColumnIndices, DataStructures::List< unsigned > &columnIndicesToReturn, unsigned key, Table::Row *row, FilterQuery *inclusionFilters, Table *result) | DataStructures::Table | protected
QueryTable(unsigned *columnIndicesSubset, unsigned numColumnSubset, FilterQuery *inclusionFilters, unsigned numInclusionFilters, unsigned *rowIds, unsigned numRowIDs, Table *result) | DataStructures::Table |
RemoveColumn(unsigned columnIndex) | DataStructures::Table |
RemoveRow(unsigned rowId) | DataStructures::Table |
RemoveRows(Table *tableContainingRowIDs) | DataStructures::Table |
rows | DataStructures::Table | protected
SortQueryType enum name | DataStructures::Table |
SortTable(Table::SortQuery *sortQueries, unsigned numSortQueries, Table::Row **out) | DataStructures::Table |
STRING enum value | DataStructures::Table |
Table() | DataStructures::Table |
UpdateCell(unsigned rowId, unsigned columnIndex, int value) | DataStructures::Table |
UpdateCell(unsigned rowId, unsigned columnIndex, char *str) | DataStructures::Table |
UpdateCell(unsigned rowId, unsigned columnIndex, int byteLength, char *data) | DataStructures::Table |
UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, int value) | DataStructures::Table |
UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, char *str) | DataStructures::Table |
UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, int byteLength, char *data) | DataStructures::Table |
~Table() | DataStructures::Table |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • RangeList
DataStructures::RangeList< range_type > Member List

This is the complete list of members for DataStructures::RangeList< range_type >, including all inherited members.

Clear(void) | DataStructures::RangeList< range_type >
Deserialize(SLNet::BitStream *out) | DataStructures::RangeList< range_type >
Insert(range_type index) | DataStructures::RangeList< range_type >
IsWithinRange(range_type value) const | DataStructures::RangeList< range_type >
RangeList() | DataStructures::RangeList< range_type >
ranges | DataStructures::RangeList< range_type >
RangeSum(void) const | DataStructures::RangeList< range_type >
Serialize(SLNet::BitStream *in, SLNet::BitSize_t maxBits, bool clearSerialized) | DataStructures::RangeList< range_type >
Size(void) const | DataStructures::RangeList< range_type >
~RangeList() | DataStructures::RangeList< range_type >
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Map
  • MapNode
DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode Member List

This is the complete list of members for DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode, including all inherited members.

MapNode() | DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode | inline
MapNode(key_type _key, data_type _data) | DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode | inline
MapNode(const MapNode &input) | DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode | inline
mapNodeData | DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode |
mapNodeKey | DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode |
operator=(const MapNode &input) | DataStructures::Map< key_type, data_type, key_comparison_func >::MapNode | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/types.h Source File

  • include
  • slikenet
types.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #ifndef __NETWORK_TYPES_H
22 #define __NETWORK_TYPES_H
23
24
25
26
27
28 #include "defines.h"
29 #include "NativeTypes.h"
30 #include "time.h"
31 #include "Export.h"
32 #include "WindowsIncludes.h"
33 #include "XBox360Includes.h"
34 #include "SocketIncludes.h"
35
36
37
38
39
40 namespace SLNet {
42 class RakPeerInterface;
43 class BitStream;
44 struct Packet;
45
46 enum StartupResult
47 {
48 RAKNET_STARTED,
49 RAKNET_ALREADY_STARTED,
50 INVALID_SOCKET_DESCRIPTORS,
51 INVALID_MAX_CONNECTIONS,
52 SOCKET_FAMILY_NOT_SUPPORTED,
53 SOCKET_PORT_ALREADY_IN_USE,
54 SOCKET_FAILED_TO_BIND,
55 SOCKET_FAILED_TEST_SEND,
56 PORT_CANNOT_BE_ZERO,
57 FAILED_TO_CREATE_NETWORK_THREAD,
58 COULD_NOT_GENERATE_GUID,
59 STARTUP_OTHER_FAILURE
60 };
61
62
63 enum ConnectionAttemptResult
64 {
65 CONNECTION_ATTEMPT_STARTED,
66 INVALID_PARAMETER,
67 CANNOT_RESOLVE_DOMAIN_NAME,
68 ALREADY_CONNECTED_TO_ENDPOINT,
69 CONNECTION_ATTEMPT_ALREADY_IN_PROGRESS,
70 SECURITY_INITIALIZATION_FAILED
71 };
72
74 enum ConnectionState
75 {
77 IS_PENDING,
79 IS_CONNECTING,
81 IS_CONNECTED,
83 IS_DISCONNECTING,
85 IS_SILENTLY_DISCONNECTING,
87 IS_DISCONNECTED,
89 IS_NOT_CONNECTED
90 };
91
93 #define BITS_TO_BYTES(x) (((x)+7)>>3)
94 #define BYTES_TO_BITS(x) ((x)<<3)
95
97 typedef unsigned char UniqueIDType;
98 typedef unsigned short SystemIndex;
99 typedef unsigned char RPCIndex;
100 const int MAX_RPC_MAP_SIZE=((RPCIndex)-1)-1;
101 const int UNDEFINED_RPC_INDEX=((RPCIndex)-1);
102
104 typedef unsigned char MessageID;
105
106 typedef uint32_t BitSize_t;
107
108 #define PRINTF_64_BIT_MODIFIER "ll"
109
111 enum PublicKeyMode
112 {
114 PKM_INSECURE_CONNECTION,
115
118 PKM_ACCEPT_ANY_PUBLIC_KEY,
119
122 PKM_USE_KNOWN_PUBLIC_KEY,
123
129 PKM_USE_TWO_WAY_AUTHENTICATION
130 };
131
133 struct RAK_DLL_EXPORT PublicKey
134 {
136 PublicKeyMode publicKeyMode;
137
139 char *remoteServerPublicKey;
140
142 char *myPublicKey;
143
145 char *myPrivateKey;
146 };
147
149 struct RAK_DLL_EXPORT SocketDescriptor
150 {
151 SocketDescriptor();
152 SocketDescriptor(unsigned short _port, const char *_hostAddress);
153
155 unsigned short port;
156
158 char hostAddress[32];
159
166 short socketFamily;
167
168
169
170
171
172
173
174
175
176 unsigned short remotePortRakNetWasStartedOn_PS3_PSP2;
177
178 // Required for Google chrome
179 _PP_Instance_ chromeInstance;
180
181 // Set to true to use a blocking socket (default, do not change unless you have a reason to)
182 bool blockingSocket;
183
185 unsigned int extraSocketOptions;
186 };
187
188 extern bool NonNumericHostString( const char *host );
189
195 struct RAK_DLL_EXPORT SystemAddress
196 {
198 SystemAddress();
199 SystemAddress(const char *str);
200 SystemAddress(const char *str, unsigned short port);
201
202
203
204
205
206
207
208
209
210
212 union// In6OrIn4
213 {
214 #if RAKNET_SUPPORT_IPV6==1
215 struct sockaddr_storage sa_stor;
216 sockaddr_in6 addr6;
217 #endif
218
219 sockaddr_in addr4;
220 } address;
221
223 unsigned short debugPort;
224
226 static int size(void);
227
229 static unsigned long ToInteger( const SystemAddress &sa );
230
233 unsigned char GetIPVersion(void) const;
234
237 unsigned int GetIPPROTO(void) const;
238
240 void SetToLoopback(void);
241
244 void SetToLoopback(unsigned char ipVersion);
245
247 bool IsLoopback(void) const;
248
249 // Return the systemAddress as a string in the format <IP>|<Port>
250 // Returns a static string
251 // NOT THREADSAFE
252 // portDelineator should not be '.', ':', '%', '-', '/', a number, or a-f
253 const char *ToString(bool writePort=true, char portDelineator='|') const;
254
255 // Return the systemAddress as a string in the format <IP>|<Port>
256 // dest must be large enough to hold the output
257 // portDelineator should not be '.', ':', '%', '-', '/', a number, or a-f
258 // THREADSAFE
259 void ToString(bool writePort, char *dest, char portDelineator = '|') const;
260 void ToString(bool writePort, char *dest, size_t destLength, char portDelineator='|') const;
261
269 bool FromString(const char *str, char portDelineator='|', int ipVersion=0);
270
272 bool FromStringExplicitPort(const char *str, unsigned short port, int ipVersion=0);
273
275 void CopyPort( const SystemAddress& right );
276
278 bool EqualsExcludingPort( const SystemAddress& right ) const;
279
281 unsigned short GetPort(void) const;
282
284 unsigned short GetPortNetworkOrder(void) const;
285
288 void SetPortHostOrder(unsigned short s);
289
291 void SetPortNetworkOrder(unsigned short s);
292
294 bool SetBinaryAddress(const char *str, char portDelineator=':');
296 void ToString_Old(bool writePort, char *dest, char portDelineator = ':') const;
297 void ToString_Old(bool writePort, char *dest, size_t destLength, char portDelineator = ':') const;
298
300 void FixForIPVersion(const SystemAddress &boundAddressToSocket);
301
302 bool IsLANAddress(void);
303
304 SystemAddress& operator = ( const SystemAddress& input );
305 bool operator==( const SystemAddress& right ) const;
306 bool operator!=( const SystemAddress& right ) const;
307 bool operator > ( const SystemAddress& right ) const;
308 bool operator < ( const SystemAddress& right ) const;
309
311 SystemIndex systemIndex;
312
313 private:
314
315 #if RAKNET_SUPPORT_IPV6==1
316 void ToString_New(bool writePort, char *dest, char portDelineator) const;
317 void ToString_New(bool writePort, char *dest, size_t destLength, char portDelineator) const;
318 #endif
319 };
320
323 struct RAK_DLL_EXPORT RakNetGUID
324 {
325 RakNetGUID();
326 explicit RakNetGUID(uint64_t _g) {g=_g; systemIndex=(SystemIndex)-1;}
327 // uint32_t g[6];
328 uint64_t g;
329
330 // Return the GUID as a string
331 // Returns a static string
332 // NOT THREADSAFE
333 const char *ToString(void) const;
334
335 // Return the GUID as a string
336 // dest must be large enough to hold the output
337 // THREADSAFE
338 void ToString(char *dest) const;
339 void ToString(char *dest, size_t destSize) const;
340
341 bool FromString(const char *source);
342
343 static unsigned long ToUint32( const RakNetGUID &g );
344
345 RakNetGUID& operator = ( const RakNetGUID& input )
346 {
347 g=input.g;
348 systemIndex=input.systemIndex;
349 return *this;
350 }
351
352 // Used internally for fast lookup. Optional (use -1 to do regular lookup). Don't transmit this.
353 SystemIndex systemIndex;
354 static int size() {return (int) sizeof(uint64_t);}
355
356 bool operator==( const RakNetGUID& right ) const;
357 bool operator!=( const RakNetGUID& right ) const;
358 bool operator > ( const RakNetGUID& right ) const;
359 bool operator < ( const RakNetGUID& right ) const;
360 };
361
363 //const SystemAddress UNASSIGNED_SYSTEM_ADDRESS =
364 //{
365 // 0xFFFFFFFF, 0xFFFF
366 //};
367 #ifndef SWIG
368 const SystemAddress UNASSIGNED_SYSTEM_ADDRESS;
369 const RakNetGUID UNASSIGNED_RAKNET_GUID((uint64_t)-1);
370 #endif
371 //{
372 // {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}
373 // 0xFFFFFFFFFFFFFFFF
374 //};
375
376
377 struct RAK_DLL_EXPORT AddressOrGUID
378 {
379 RakNetGUID rakNetGuid;
380 SystemAddress systemAddress;
381
382 SystemIndex GetSystemIndex(void) const {if (rakNetGuid!=UNASSIGNED_RAKNET_GUID) return rakNetGuid.systemIndex; else return systemAddress.systemIndex;}
383 bool IsUndefined(void) const {return rakNetGuid==UNASSIGNED_RAKNET_GUID && systemAddress==UNASSIGNED_SYSTEM_ADDRESS;}
384 void SetUndefined(void) {rakNetGuid=UNASSIGNED_RAKNET_GUID; systemAddress=UNASSIGNED_SYSTEM_ADDRESS;}
385 static unsigned long ToInteger( const AddressOrGUID &aog );
386 const char *ToString(bool writePort=true) const;
387 void ToString(bool writePort, char *dest) const;
388 void ToString(bool writePort, char *dest, size_t destLength) const;
389
390 AddressOrGUID() {}
391 AddressOrGUID( const AddressOrGUID& input )
392 {
393 rakNetGuid=input.rakNetGuid;
394 systemAddress=input.systemAddress;
395 }
396 AddressOrGUID( const SystemAddress& input )
397 {
398 rakNetGuid=UNASSIGNED_RAKNET_GUID;
399 systemAddress=input;
400 }
401 AddressOrGUID( Packet *packet );
402 AddressOrGUID( const RakNetGUID& input )
403 {
404 rakNetGuid=input;
405 systemAddress=UNASSIGNED_SYSTEM_ADDRESS;
406 }
407 AddressOrGUID& operator = ( const AddressOrGUID& input )
408 {
409 rakNetGuid=input.rakNetGuid;
410 systemAddress=input.systemAddress;
411 return *this;
412 }
413
414 AddressOrGUID& operator = ( const SystemAddress& input )
415 {
416 rakNetGuid=UNASSIGNED_RAKNET_GUID;
417 systemAddress=input;
418 return *this;
419 }
420
421 AddressOrGUID& operator = ( const RakNetGUID& input )
422 {
423 rakNetGuid=input;
424 systemAddress=UNASSIGNED_SYSTEM_ADDRESS;
425 return *this;
426 }
427
428 inline bool operator==( const AddressOrGUID& right ) const {return (rakNetGuid!=UNASSIGNED_RAKNET_GUID && rakNetGuid==right.rakNetGuid) || (systemAddress!=UNASSIGNED_SYSTEM_ADDRESS && systemAddress==right.systemAddress);}
429 };
430
431 typedef uint64_t NetworkID;
432
434 struct Packet
435 {
437 SystemAddress systemAddress;
438
442 RakNetGUID guid;
443
445 unsigned int length;
446
448 BitSize_t bitSize;
449
451 unsigned char* data;
452
455 bool deleteData;
456
459 bool wasGeneratedLocally;
460 };
461
463 const SystemIndex UNASSIGNED_PLAYER_INDEX = 65535;
464
466 const NetworkID UNASSIGNED_NETWORK_ID = (uint64_t) -1;
467
468 const int PING_TIMES_ARRAY_SIZE = 5;
469
470 struct RAK_DLL_EXPORT uint24_t
471 {
472 uint32_t val;
473
474 uint24_t() {}
475 inline operator uint32_t() { return val; }
476 inline operator uint32_t() const { return val; }
477
478 inline uint24_t(const uint24_t& a) {val=a.val;}
479 inline uint24_t operator++() {++val; val&=0x00FFFFFF; return *this;}
480 inline uint24_t operator--() {--val; val&=0x00FFFFFF; return *this;}
481 inline uint24_t operator++(int) {uint24_t temp(val); ++val; val&=0x00FFFFFF; return temp;}
482 inline uint24_t operator--(int) {uint24_t temp(val); --val; val&=0x00FFFFFF; return temp;}
483 inline uint24_t operator&(const uint24_t& a) {return uint24_t(val&a.val);}
484 inline uint24_t& operator=(const uint24_t& a) { val=a.val; return *this; }
485 inline uint24_t& operator+=(const uint24_t& a) { val+=a.val; val&=0x00FFFFFF; return *this; }
486 inline uint24_t& operator-=(const uint24_t& a) { val-=a.val; val&=0x00FFFFFF; return *this; }
487 inline bool operator==( const uint24_t& right ) const {return val==right.val;}
488 inline bool operator!=( const uint24_t& right ) const {return val!=right.val;}
489 inline bool operator > ( const uint24_t& right ) const {return val>right.val;}
490 inline bool operator < ( const uint24_t& right ) const {return val<right.val;}
491 inline const uint24_t operator+( const uint24_t &other ) const { return uint24_t(val+other.val); }
492 inline const uint24_t operator-( const uint24_t &other ) const { return uint24_t(val-other.val); }
493 inline const uint24_t operator/( const uint24_t &other ) const { return uint24_t(val/other.val); }
494 inline const uint24_t operator*( const uint24_t &other ) const { return uint24_t(val*other.val); }
495
496 inline uint24_t(const uint32_t& a) {val=a; val&=0x00FFFFFF;}
497 inline uint24_t operator&(const uint32_t& a) {return uint24_t(val&a);}
498 inline uint24_t& operator=(const uint32_t& a) { val=a; val&=0x00FFFFFF; return *this; }
499 inline uint24_t& operator+=(const uint32_t& a) { val+=a; val&=0x00FFFFFF; return *this; }
500 inline uint24_t& operator-=(const uint32_t& a) { val-=a; val&=0x00FFFFFF; return *this; }
501 inline bool operator==( const uint32_t& right ) const {return val==(right&0x00FFFFFF);}
502 inline bool operator!=( const uint32_t& right ) const {return val!=(right&0x00FFFFFF);}
503 inline bool operator > ( const uint32_t& right ) const {return val>(right&0x00FFFFFF);}
504 inline bool operator < ( const uint32_t& right ) const {return val<(right&0x00FFFFFF);}
505 inline const uint24_t operator+( const uint32_t &other ) const { return uint24_t(val+other); }
506 inline const uint24_t operator-( const uint32_t &other ) const { return uint24_t(val-other); }
507 inline const uint24_t operator/( const uint32_t &other ) const { return uint24_t(val/other); }
508 inline const uint24_t operator*( const uint32_t &other ) const { return uint24_t(val*other); }
509 };
510
511 } // namespace SLNet
512
513 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakMemoryOverride.cpp Source File

  • src
RakMemoryOverride.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/memoryoverride.h"
17 #include "slikenet/assert.h"
18 #include <stdlib.h>
19
20 #ifdef _RAKNET_SUPPORT_DL_MALLOC
21 #include "rdlmalloc.h"
22 #endif
23
24
25
26
27
28
29
30 using namespace SLNet;
31
32 #if _USE_RAK_MEMORY_OVERRIDE==1
33 #if defined(malloc)
34 #pragma push_macro("malloc")
35 #undef malloc
36 #define RMO_MALLOC_UNDEF
37 #endif
38
39 #if defined(realloc)
40 #pragma push_macro("realloc")
41 #undef realloc
42 #define RMO_REALLOC_UNDEF
43 #endif
44
45 #if defined(free)
46 #pragma push_macro("free")
47 #undef free
48 #define RMO_FREE_UNDEF
49 #endif
50 #endif
51
52 void DefaultOutOfMemoryHandler(const char *file, const long line)
53 {
54 (void) file;
55 (void) line;
56 RakAssert(0);
57 }
58
59 void * (*rakMalloc) (size_t size) = SLNet::_RakMalloc;
60 void* (*rakRealloc) (void *p, size_t size) = SLNet::_RakRealloc;
61 void (*rakFree) (void *p) = SLNet::_RakFree;
62 void* (*rakMalloc_Ex) (size_t size, const char *file, unsigned int line) = SLNet::_RakMalloc_Ex;
63 void* (*rakRealloc_Ex) (void *p, size_t size, const char *file, unsigned int line) = SLNet::_RakRealloc_Ex;
64 void (*rakFree_Ex) (void *p, const char *file, unsigned int line) = SLNet::_RakFree_Ex;
65 void (*notifyOutOfMemory) (const char *file, const long line)=DefaultOutOfMemoryHandler;
66 void * (*dlMallocMMap) (size_t size) = SLNet::_DLMallocMMap;
67 void * (*dlMallocDirectMMap) (size_t size) = SLNet::_DLMallocDirectMMap;
68 int (*dlMallocMUnmap) (void* ptr, size_t size) = SLNet::_DLMallocMUnmap;
69
70 void SetMalloc( void* (*userFunction)(size_t size) )
71 {
72 rakMalloc=userFunction;
73 }
74 void SetRealloc( void* (*userFunction)(void *p, size_t size) )
75 {
76 rakRealloc=userFunction;
77 }
78 void SetFree( void (*userFunction)(void *p) )
79 {
80 rakFree=userFunction;
81 }
82 void SetMalloc_Ex( void* (*userFunction)(size_t size, const char *file, unsigned int line) )
83 {
84 rakMalloc_Ex=userFunction;
85 }
86 void SetRealloc_Ex( void* (*userFunction)(void *p, size_t size, const char *file, unsigned int line) )
87 {
88 rakRealloc_Ex=userFunction;
89 }
90 void SetFree_Ex( void (*userFunction)(void *p, const char *file, unsigned int line) )
91 {
92 rakFree_Ex=userFunction;
93 }
94 void SetNotifyOutOfMemory( void (*userFunction)(const char *file, const long line) )
95 {
96 notifyOutOfMemory=userFunction;
97 }
98 void SetDLMallocMMap( void* (*userFunction)(size_t size) )
99 {
100 dlMallocMMap=userFunction;
101 }
102 void SetDLMallocDirectMMap( void* (*userFunction)(size_t size) )
103 {
104 dlMallocDirectMMap=userFunction;
105 }
106 void SetDLMallocMUnmap( int (*userFunction)(void* ptr, size_t size) )
107 {
108 dlMallocMUnmap=userFunction;
109 }
110 void * (*GetMalloc()) (size_t size)
111 {
112 return rakMalloc;
113 }
114 void * (*GetRealloc()) (void *p, size_t size)
115 {
116 return rakRealloc;
117 }
118 void (*GetFree()) (void *p)
119 {
120 return rakFree;
121 }
122 void * (*GetMalloc_Ex()) (size_t size, const char *file, unsigned int line)
123 {
124 return rakMalloc_Ex;
125 }
126 void * (*GetRealloc_Ex()) (void *p, size_t size, const char *file, unsigned int line)
127 {
128 return rakRealloc_Ex;
129 }
130 void (*GetFree_Ex()) (void *p, const char *file, unsigned int line)
131 {
132 return rakFree_Ex;
133 }
134 void *(*GetDLMallocMMap())(size_t size)
135 {
136 return dlMallocMMap;
137 }
138 void *(*GetDLMallocDirectMMap())(size_t size)
139 {
140 return dlMallocDirectMMap;
141 }
142 int (*GetDLMallocMUnmap())(void* ptr, size_t size)
143 {
144 return dlMallocMUnmap;
145 }
146 void* SLNet::_RakMalloc (size_t size)
147 {
148 return malloc(size);
149 }
150
151 void* SLNet::_RakRealloc (void *p, size_t size)
152 {
153 return realloc(p,size);
154 }
155
156 void SLNet::_RakFree (void *p)
157 {
158 free(p);
159 }
160
161 void* SLNet::_RakMalloc_Ex (size_t size, const char *file, unsigned int line)
162 {
163 (void) file;
164 (void) line;
165
166 return malloc(size);
167 }
168
169 void* SLNet::_RakRealloc_Ex (void *p, size_t size, const char *file, unsigned int line)
170 {
171 (void) file;
172 (void) line;
173
174 return realloc(p,size);
175 }
176
177 void SLNet::_RakFree_Ex (void *p, const char *file, unsigned int line)
178 {
179 (void) file;
180 (void) line;
181
182 free(p);
183 }
184 #ifdef _RAKNET_SUPPORT_DL_MALLOC
185 void * SLNet::_DLMallocMMap (size_t size)
186 {
187 return RAK_MMAP_DEFAULT(size);
188 }
189 void * SLNet::_DLMallocDirectMMap (size_t size)
190 {
191 return RAK_DIRECT_MMAP_DEFAULT(size);
192 }
193 int SLNet::_DLMallocMUnmap (void *p, size_t size)
194 {
195 return RAK_MUNMAP_DEFAULT(p,size);
196 }
197
198 static mspace rakNetFixedHeapMSpace=0;
199
200 void* _DLMalloc(size_t size)
201 {
202 return rak_mspace_malloc(rakNetFixedHeapMSpace,size);
203 }
204
205 void* _DLRealloc(void *p, size_t size)
206 {
207 return rak_mspace_realloc(rakNetFixedHeapMSpace,p,size);
208 }
209
210 void _DLFree(void *p)
211 {
212 if (p)
213 rak_mspace_free(rakNetFixedHeapMSpace,p);
214 }
215 void* _DLMalloc_Ex (size_t size, const char *file, unsigned int line)
216 {
217 (void) file;
218 (void) line;
219
220 return rak_mspace_malloc(rakNetFixedHeapMSpace,size);
221 }
222
223 void* _DLRealloc_Ex (void *p, size_t size, const char *file, unsigned int line)
224 {
225 (void) file;
226 (void) line;
227
228 return rak_mspace_realloc(rakNetFixedHeapMSpace,p,size);
229 }
230
231 void _DLFree_Ex (void *p, const char *file, unsigned int line)
232 {
233 (void) file;
234 (void) line;
235
236 if (p)
237 rak_mspace_free(rakNetFixedHeapMSpace,p);
238 }
239
240 void UseRaknetFixedHeap(size_t initialCapacity,
241 void * (*yourMMapFunction) (size_t size),
242 void * (*yourDirectMMapFunction) (size_t size),
243 int (*yourMUnmapFunction) (void *p, size_t size))
244 {
245 SetDLMallocMMap(yourMMapFunction);
246 SetDLMallocDirectMMap(yourDirectMMapFunction);
247 SetDLMallocMUnmap(yourMUnmapFunction);
248 SetMalloc(_DLMalloc);
249 SetRealloc(_DLRealloc);
250 SetFree(_DLFree);
251 SetMalloc_Ex(_DLMalloc_Ex);
252 SetRealloc_Ex(_DLRealloc_Ex);
253 SetFree_Ex(_DLFree_Ex);
254
255 rakNetFixedHeapMSpace=rak_create_mspace(initialCapacity, 0);
256 }
257 void FreeRakNetFixedHeap(void)
258 {
259 if (rakNetFixedHeapMSpace)
260 {
261 rak_destroy_mspace(rakNetFixedHeapMSpace);
262 rakNetFixedHeapMSpace=0;
263 }
264
265 SetMalloc(_RakMalloc);
266 SetRealloc(_RakRealloc);
267 SetFree(_RakFree);
268 SetMalloc_Ex(_RakMalloc_Ex);
269 SetRealloc_Ex(_RakRealloc_Ex);
270 SetFree_Ex(_RakFree_Ex);
271 }
272 #else
273 void * SLNet::_DLMallocMMap (size_t size) {(void) size; return 0;}
274 void * SLNet::_DLMallocDirectMMap (size_t size) {(void) size; return 0;}
275 int SLNet::_DLMallocMUnmap (void *p, size_t size) {(void) size; (void) p; return 0;}
276 void* _DLMalloc(size_t size) {(void) size; return 0;}
277 void* _DLRealloc(void *p, size_t size) {(void) p; (void) size; return 0;}
278 void _DLFree(void *p) {(void) p;}
279 void* _DLMalloc_Ex (size_t size, const char *file, unsigned int line) {(void) size; (void) file; (void) line; return 0;}
280 void* _DLRealloc_Ex (void *p, size_t size, const char *file, unsigned int line) {(void) p; (void) size; (void) file; (void) line; return 0;}
281 void _DLFree_Ex (void *p, const char *file, unsigned int line) {(void) p; (void) file; (void) line;}
282
283 void UseRaknetFixedHeap(size_t initialCapacity,
284 void * (*yourMMapFunction) (size_t size),
285 void * (*yourDirectMMapFunction) (size_t size),
286 int (*yourMUnmapFunction) (void *p, size_t size))
287 {
288 (void) initialCapacity;
289 (void) yourMMapFunction;
290 (void) yourDirectMMapFunction;
291 (void) yourMUnmapFunction;
292 }
293 void FreeRakNetFixedHeap(void) {}
294 #endif
295
296 #if _USE_RAK_MEMORY_OVERRIDE==1
297 #if defined(RMO_MALLOC_UNDEF)
298 #pragma pop_macro("malloc")
299 #undef RMO_MALLOC_UNDEF
300 #endif
301
302 #if defined(RMO_REALLOC_UNDEF)
303 #pragma pop_macro("realloc")
304 #undef RMO_REALLOC_UNDEF
305 #endif
306
307 #if defined(RMO_FREE_UNDEF)
308 #pragma pop_macro("free")
309 #undef RMO_FREE_UNDEF
310 #endif
311 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • StatisticsHistory
  • TrackedObjectData
SLNet::StatisticsHistory::TrackedObjectData Member List

This is the complete list of members for SLNet::StatisticsHistory::TrackedObjectData, including all inherited members.

objectId | SLNet::StatisticsHistory::TrackedObjectData
objectType | SLNet::StatisticsHistory::TrackedObjectData
TrackedObjectData() | SLNet::StatisticsHistory::TrackedObjectData
TrackedObjectData(uint64_t _objectId, int _objectType, void *_userData) | SLNet::StatisticsHistory::TrackedObjectData
userData | SLNet::StatisticsHistory::TrackedObjectData
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • BPlusTree
DataStructures::BPlusTree< KeyType, DataType, order > Member List

This is the complete list of members for DataStructures::BPlusTree< KeyType, DataType, order >, including all inherited members.

BPlusTree() | DataStructures::BPlusTree< KeyType, DataType, order > |
CanRotateLeft(Page< KeyType, DataType, order > *cur, int childIndex) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
CanRotateRight(Page< KeyType, DataType, order > *cur, int childIndex) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
Clear(void) | DataStructures::BPlusTree< KeyType, DataType, order > |
Delete(const KeyType key) | DataStructures::BPlusTree< KeyType, DataType, order > |
Delete(const KeyType key, DataType &out) | DataStructures::BPlusTree< KeyType, DataType, order > |
DeleteFromPageAtIndex(const int index, Page< KeyType, DataType, order > *cur) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
FindDeleteRebalance(const KeyType key, Page< KeyType, DataType, order > *cur, bool *underflow, KeyType rightRootKey, ReturnAction *returnAction, DataType &out) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
FixUnderflow(int branchIndex, Page< KeyType, DataType, order > *cur, KeyType rightRootKey, ReturnAction *returnAction) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
ForEachData(void(*func)(DataType input, int index)) | DataStructures::BPlusTree< KeyType, DataType, order > |
ForEachLeaf(void(*func)(Page< KeyType, DataType, order > *leaf, int index)) | DataStructures::BPlusTree< KeyType, DataType, order > |
FreePages(void) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
Get(const KeyType key, DataType &out) const | DataStructures::BPlusTree< KeyType, DataType, order > |
GetDataHead(void) const | DataStructures::BPlusTree< KeyType, DataType, order > |
GetIndexOf(const KeyType key, Page< KeyType, DataType, order > *page, int *out) const | DataStructures::BPlusTree< KeyType, DataType, order > | protected
GetLeafFromKey(const KeyType key) const | DataStructures::BPlusTree< KeyType, DataType, order > | protected
GetListHead(void) const | DataStructures::BPlusTree< KeyType, DataType, order > |
Insert(const KeyType key, const DataType &data) | DataStructures::BPlusTree< KeyType, DataType, order > |
InsertBranchDown(const KeyType key, const DataType &data, Page< KeyType, DataType, order > *cur, ReturnAction *returnAction, bool *success) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
InsertIntoNode(const KeyType key, const DataType &childData, int insertionIndex, Page< KeyType, DataType, order > *nodeData, Page< KeyType, DataType, order > *cur, ReturnAction *returnAction) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
IsEmpty(void) const | DataStructures::BPlusTree< KeyType, DataType, order > |
leftmostLeaf | DataStructures::BPlusTree< KeyType, DataType, order > | protected
pagePool | DataStructures::BPlusTree< KeyType, DataType, order > | protected
PrintGraph(void) | DataStructures::BPlusTree< KeyType, DataType, order > |
PrintLeaf(Page< KeyType, DataType, order > *leaf, int index) | DataStructures::BPlusTree< KeyType, DataType, order > | protectedstatic
PrintLeaves(void) | DataStructures::BPlusTree< KeyType, DataType, order > |
root | DataStructures::BPlusTree< KeyType, DataType, order > | protected
RotateLeft(Page< KeyType, DataType, order > *cur, int childIndex, ReturnAction *returnAction) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
RotateRight(Page< KeyType, DataType, order > *cur, int childIndex, ReturnAction *returnAction) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
SetPoolPageSize(int size) | DataStructures::BPlusTree< KeyType, DataType, order > |
ShiftKeysLeft(Page< KeyType, DataType, order > *cur) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
ShiftNodeLeft(Page< KeyType, DataType, order > *cur) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
ShiftNodeRight(Page< KeyType, DataType, order > *cur) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
Size(void) const | DataStructures::BPlusTree< KeyType, DataType, order > |
ValidateTreeRecursive(Page< KeyType, DataType, order > *cur) | DataStructures::BPlusTree< KeyType, DataType, order > | protected
~BPlusTree() | DataStructures::BPlusTree< KeyType, DataType, order > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/transport2.h Source File

  • include
  • slikenet
transport2.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_TelnetTransport==1
23
24 #ifndef __RAKNET_TRANSPORT_2
25 #define __RAKNET_TRANSPORT_2
26
27 #include "TransportInterface.h"
28 #include "DS_Queue.h"
29 #include "CommandParserInterface.h"
30 #include "PluginInterface2.h"
31 #include "Export.h"
32
33 namespace SLNet
34 {
36 class BitStream;
37 class RakPeerInterface;
38 class RakNetTransport;
39
44
49 class RAK_DLL_EXPORT RakNetTransport2 : public TransportInterface, public PluginInterface2
50 {
51 public:
52 // GetInstance() and DestroyInstance(instance*)
53 STATIC_FACTORY_DECLARATIONS(RakNetTransport2)
54
55 RakNetTransport2();
56 virtual ~RakNetTransport2();
57
62 bool Start(unsigned short port, bool serverMode);
63
65 void Stop(void);
66
73 void Send( SystemAddress systemAddress, const char *data, ... );
74
77 void CloseConnection( SystemAddress systemAddress );
78
84 Packet* Receive( void );
85
88 void DeallocatePacket( Packet *packet );
89
92 SystemAddress HasNewIncomingConnection(void);
93
96 SystemAddress HasLostConnection(void);
97
98 virtual CommandParserInterface* GetCommandParser(void) {return 0;}
99
101 virtual PluginReceiveResult OnReceive(Packet *packet);
103 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
105 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
106 protected:
107 DataStructures::Queue<SystemAddress> newConnections, lostConnections;
108 DataStructures::Queue<Packet*> packetQueue;
109 };
110
111 } // namespace SLNet
112
113 #endif
114
115 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeerInterface
SLNet::RakPeerInterface Member List

This is the complete list of members for SLNet::RakPeerInterface, including all inherited members.

AddToBanList(const char *IP, SLNet::TimeMS milliseconds=0)=0 | SLNet::RakPeerInterface | pure virtual
AddToSecurityExceptionList(const char *ip)=0 | SLNet::RakPeerInterface | pure virtual
AdvertiseSystem(const char *host, unsigned short remotePort, const char *data, int dataLength, unsigned connectionSocketIndex=0)=0 | SLNet::RakPeerInterface | pure virtual
AllocatePacket(unsigned dataSize)=0 | SLNet::RakPeerInterface | pure virtual
AllowConnectionResponseIPMigration(bool allow)=0 | SLNet::RakPeerInterface | pure virtual
ApplyNetworkSimulator(float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance)=0 | SLNet::RakPeerInterface | pure virtual
AttachPlugin(PluginInterface2 *plugin)=0 | SLNet::RakPeerInterface | pure virtual
CancelConnectionAttempt(const SystemAddress target)=0 | SLNet::RakPeerInterface | pure virtual
ChangeSystemAddress(RakNetGUID guid, const SystemAddress &systemAddress)=0 | SLNet::RakPeerInterface | pure virtual
ClearBanList(void)=0 | SLNet::RakPeerInterface | pure virtual
CloseConnection(const AddressOrGUID target, bool sendDisconnectionNotification, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY)=0 | SLNet::RakPeerInterface | pure virtual
Connect(const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, PublicKey *publicKey=0, unsigned connectionSocketIndex=0, unsigned sendConnectionAttemptCount=12, unsigned timeBetweenSendConnectionAttemptsMS=500, SLNet::TimeMS timeoutTime=0)=0 | SLNet::RakPeerInterface | pure virtual
ConnectWithSocket(const char *host, unsigned short remotePort, const char *passwordData, int passwordDataLength, RakNetSocket2 *socket, PublicKey *publicKey=0, unsigned sendConnectionAttemptCount=12, unsigned timeBetweenSendConnectionAttemptsMS=500, SLNet::TimeMS timeoutTime=0)=0 | SLNet::RakPeerInterface | pure virtual
DeallocatePacket(Packet *packet)=0 | SLNet::RakPeerInterface | pure virtual
DetachPlugin(PluginInterface2 *messageHandler)=0 | SLNet::RakPeerInterface | pure virtual
DisableSecurity(void)=0 | SLNet::RakPeerInterface | pure virtual
Get64BitUniqueRandomNumber(void) | SLNet::RakPeerInterface | static
GetAveragePing(const AddressOrGUID systemIdentifier)=0 | SLNet::RakPeerInterface | pure virtual
GetClientPublicKeyFromSystemAddress(const SystemAddress input, char *client_public_key) const =0 | SLNet::RakPeerInterface | pure virtual
GetClockDifferential(const AddressOrGUID systemIdentifier)=0 | SLNet::RakPeerInterface | pure virtual
GetConnectionList(SystemAddress *remoteSystems, unsigned short *numberOfSystems) const =0 | SLNet::RakPeerInterface | pure virtual
GetConnectionState(const AddressOrGUID systemIdentifier)=0 | SLNet::RakPeerInterface | pure virtual
GetExternalID(const SystemAddress target) const =0 | SLNet::RakPeerInterface | pure virtual
GetGUIDFromIndex(unsigned int index)=0 | SLNet::RakPeerInterface | pure virtual
GetGuidFromSystemAddress(const SystemAddress input) const =0 | SLNet::RakPeerInterface | pure virtual
GetIncomingPassword(char *passwordData, int *passwordDataLength)=0 | SLNet::RakPeerInterface | pure virtual
GetIndexFromSystemAddress(const SystemAddress systemAddress) const =0 | SLNet::RakPeerInterface | pure virtual
GetInternalID(const SystemAddress systemAddress=UNASSIGNED_SYSTEM_ADDRESS, const int index=0) const =0 | SLNet::RakPeerInterface | pure virtual
GetLastPing(const AddressOrGUID systemIdentifier) const =0 | SLNet::RakPeerInterface | pure virtual
GetLocalIP(unsigned int index)=0 | SLNet::RakPeerInterface | pure virtual
GetLowestPing(const AddressOrGUID systemIdentifier) const =0 | SLNet::RakPeerInterface | pure virtual
GetMaximumIncomingConnections(void) const =0 | SLNet::RakPeerInterface | pure virtual
GetMaximumNumberOfPeers(void) const =0 | SLNet::RakPeerInterface | pure virtual
GetMTUSize(const SystemAddress target) const =0 | SLNet::RakPeerInterface | pure virtual
GetMyBoundAddress(const int socketIndex=0)=0 | SLNet::RakPeerInterface | pure virtual
GetMyGUID(void) const =0 | SLNet::RakPeerInterface | pure virtual
GetNextSendReceipt(void)=0 | SLNet::RakPeerInterface | pure virtual
GetNumberOfAddresses(void)=0 | SLNet::RakPeerInterface | pure virtual
GetOfflinePingResponse(char **data, unsigned int *length)=0 | SLNet::RakPeerInterface | pure virtual
GetReceiveBufferSize(void)=0 | SLNet::RakPeerInterface | pure virtual
GetSocket(const SystemAddress target)=0 | SLNet::RakPeerInterface | pure virtual
GetSockets(DataStructures::List< RakNetSocket2 * > &sockets)=0 | SLNet::RakPeerInterface | pure virtual
GetSplitMessageProgressInterval(void) const =0 | SLNet::RakPeerInterface | pure virtual
GetStatistics(const SystemAddress systemAddress, RakNetStatistics *rns=0)=0 | SLNet::RakPeerInterface | pure virtual
GetStatistics(const unsigned int index, RakNetStatistics *rns)=0 | SLNet::RakPeerInterface | pure virtual
GetStatisticsList(DataStructures::List< SystemAddress > &addresses, DataStructures::List< RakNetGUID > &guids, DataStructures::List< RakNetStatistics > &statistics)=0 | SLNet::RakPeerInterface | pure virtual
GetSystemAddressFromGuid(const RakNetGUID input) const =0 | SLNet::RakPeerInterface | pure virtual
GetSystemAddressFromIndex(unsigned int index)=0 | SLNet::RakPeerInterface | pure virtual
GetSystemList(DataStructures::List< SystemAddress > &addresses, DataStructures::List< RakNetGUID > &guids) const =0 | SLNet::RakPeerInterface | pure virtual
GetTimeoutTime(const SystemAddress target)=0 | SLNet::RakPeerInterface | pure virtual
IncrementNextSendReceipt(void)=0 | SLNet::RakPeerInterface | pure virtual
InitializeSecurity(const char *publicKey, const char *privateKey, bool bRequireClientKey=false)=0 | SLNet::RakPeerInterface | pure virtual
IsActive(void) const =0 | SLNet::RakPeerInterface | pure virtual
IsBanned(const char *IP)=0 | SLNet::RakPeerInterface | pure virtual
IsInSecurityExceptionList(const char *ip)=0 | SLNet::RakPeerInterface | pure virtual
IsLocalIP(const char *ip)=0 | SLNet::RakPeerInterface | pure virtual
IsNetworkSimulatorActive(void)=0 | SLNet::RakPeerInterface | pure virtual
NumberOfConnections(void) const =0 | SLNet::RakPeerInterface | pure virtual
Ping(const SystemAddress target)=0 | SLNet::RakPeerInterface | pure virtual
Ping(const char *host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections, unsigned connectionSocketIndex=0)=0 | SLNet::RakPeerInterface | pure virtual
PushBackPacket(Packet *packet, bool pushAtHead)=0 | SLNet::RakPeerInterface | pure virtual
Receive(void)=0 | SLNet::RakPeerInterface | pure virtual
ReleaseSockets(DataStructures::List< RakNetSocket2 * > &sockets)=0 | SLNet::RakPeerInterface | pure virtual
RemoveFromBanList(const char *IP)=0 | SLNet::RakPeerInterface | pure virtual
RemoveFromSecurityExceptionList(const char *ip)=0 | SLNet::RakPeerInterface | pure virtual
RunUpdateCycle(BitStream &updateBitStream)=0 | SLNet::RakPeerInterface | pure virtual
Send(const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)=0 | SLNet::RakPeerInterface | pure virtual
Send(const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0)=0 | SLNet::RakPeerInterface | pure virtual
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)=0 | SLNet::RakPeerInterface | pure virtual
SendLoopback(const char *data, const int length)=0 | SLNet::RakPeerInterface | pure virtual
SendOutOfBand(const char *host, unsigned short remotePort, const char *data, BitSize_t dataLength, unsigned connectionSocketIndex=0)=0 | SLNet::RakPeerInterface | pure virtual
SendTTL(const char *host, unsigned short remotePort, int ttl, unsigned connectionSocketIndex=0)=0 | SLNet::RakPeerInterface | pure virtual
SetIncomingDatagramEventHandler(bool(*_incomingDatagramEventHandler)(RNS2RecvStruct *))=0 | SLNet::RakPeerInterface | pure virtual
SetIncomingPassword(const char *passwordData, int passwordDataLength)=0 | SLNet::RakPeerInterface | pure virtual
SetInternalID(SystemAddress systemAddress, int index=0)=0 | SLNet::RakPeerInterface | pure virtual
SetLimitIPConnectionFrequency(bool b)=0 | SLNet::RakPeerInterface | pure virtual
SetMaximumIncomingConnections(unsigned short numberAllowed)=0 | SLNet::RakPeerInterface | pure virtual
SetOccasionalPing(bool doPing)=0 | SLNet::RakPeerInterface | pure virtual
SetOfflinePingResponse(const char *data, const unsigned int length)=0 | SLNet::RakPeerInterface | pure virtual
SetPerConnectionOutgoingBandwidthLimit(unsigned maxBitsPerSecond)=0 | SLNet::RakPeerInterface | pure virtual
SetSplitMessageProgressInterval(int interval)=0 | SLNet::RakPeerInterface | pure virtual
SetTimeoutTime(SLNet::TimeMS timeMS, const SystemAddress target)=0 | SLNet::RakPeerInterface | pure virtual
SetUnreliableTimeout(SLNet::TimeMS timeoutMS)=0 | SLNet::RakPeerInterface | pure virtual
SetUserUpdateThread(void(*_userUpdateThreadPtr)(RakPeerInterface *, void *), void *_userUpdateThreadData)=0 | SLNet::RakPeerInterface | pure virtual
Shutdown(unsigned int blockDuration, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY)=0 | SLNet::RakPeerInterface | pure virtual
Startup(unsigned int maxConnections, SocketDescriptor *socketDescriptors, unsigned socketDescriptorCount, int threadPriority=-99999)=0 | SLNet::RakPeerInterface | pure virtual
WriteOutOfBandHeader(SLNet::BitStream *bitStream)=0 | SLNet::RakPeerInterface | pure virtual
~RakPeerInterface() | SLNet::RakPeerInterface | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FileListTransferCBInterface
SLNet::FileListTransferCBInterface Member List

This is the complete list of members for SLNet::FileListTransferCBInterface, including all inherited members.

FileListTransferCBInterface() | SLNet::FileListTransferCBInterface | inline
OnDereference(void) | SLNet::FileListTransferCBInterface | inlinevirtual
OnDownloadComplete(DownloadCompleteStruct *dcs) | SLNet::FileListTransferCBInterface | inlinevirtual
OnFile(OnFileStruct *onFileStruct)=0 | SLNet::FileListTransferCBInterface | pure virtual
OnFileProgress(FileProgressStruct *fps)=0 | SLNet::FileListTransferCBInterface | pure virtual
Update(void) | SLNet::FileListTransferCBInterface | inlinevirtual
~FileListTransferCBInterface() | SLNet::FileListTransferCBInterface | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetStatistics.cpp Source File

  • src
RakNetStatistics.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20
21 #include "slikenet/statistics.h"
22 #include <stdio.h> // sprintf
23 #include "slikenet/GetTime.h"
24 #include "slikenet/string.h"
25 #include "slikenet/linux_adapter.h"
26 #include "slikenet/osx_adapter.h"
27
28 using namespace SLNet;
29
30 // Verbosity level currently supports 0 (low), 1 (medium), 2 (high)
31 // Buffer must be hold enough to hold the output string. See the source to get an idea of how many bytes will be output
32 void RAK_DLL_EXPORT SLNet::StatisticsToString(RakNetStatistics *s, char *buffer, int verbosityLevel)
33 {
34 if (s == 0)
35 {
36 #pragma warning(push)
37 #pragma warning(disable:4996)
38 sprintf(buffer, "stats is a NULL pointer in statsToString\n");
39 #pragma warning(pop)
40 return;
41 }
42
43 if (verbosityLevel == 0)
44 {
45 #pragma warning(push)
46 #pragma warning(disable:4996)
47 sprintf(buffer,
48 "Bytes per second sent %" PRINTF_64_BIT_MODIFIER "u\n"
49 "Bytes per second received %" PRINTF_64_BIT_MODIFIER "u\n"
50 "Current packetloss %.1f%%\n",
51 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT],
52 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
53 s->packetlossLastSecond*100.0f
54 );
55 #pragma warning(pop)
56 }
57 else if (verbosityLevel == 1)
58 {
59 #pragma warning(push)
60 #pragma warning(disable:4996)
61 sprintf(buffer,
62 "Actual bytes per second sent %" PRINTF_64_BIT_MODIFIER "u\n"
63 "Actual bytes per second received %" PRINTF_64_BIT_MODIFIER "u\n"
64 "Message bytes per second pushed %" PRINTF_64_BIT_MODIFIER "u\n"
65 "Total actual bytes sent %" PRINTF_64_BIT_MODIFIER "u\n"
66 "Total actual bytes received %" PRINTF_64_BIT_MODIFIER "u\n"
67 "Total message bytes pushed %" PRINTF_64_BIT_MODIFIER "u\n"
68 "Current packetloss %.1f%%\n"
69 "Average packetloss %.1f%%\n"
70 "Elapsed connection time in seconds %" PRINTF_64_BIT_MODIFIER "u\n",
71 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT],
72 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
73 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_PUSHED],
74 (long long unsigned int) s->runningTotal[ACTUAL_BYTES_SENT],
75 (long long unsigned int) s->runningTotal[ACTUAL_BYTES_RECEIVED],
76 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_PUSHED],
77 s->packetlossLastSecond*100.0f,
78 s->packetlossTotal*100.0f,
79 (long long unsigned int) (uint64_t)((SLNet::GetTimeUS() - s->connectionStartTime) / 1000000)
80 );
81 #pragma warning(pop)
82
83 if (s->BPSLimitByCongestionControl != 0)
84 {
85 char buff2[128];
86 sprintf_s(buff2,
87 "Send capacity %" PRINTF_64_BIT_MODIFIER "u bytes per second (%.0f%%)\n",
88 (long long unsigned int) s->BPSLimitByCongestionControl,
89 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByCongestionControl
90 );
91 #pragma warning(push)
92 #pragma warning(disable:4996)
93 strcat(buffer, buff2);
94 #pragma warning(pop)
95 }
96 if (s->BPSLimitByOutgoingBandwidthLimit != 0)
97 {
98 char buff2[128];
99 sprintf_s(buff2,
100 "Send limit %" PRINTF_64_BIT_MODIFIER "u (%.0f%%)\n",
101 (long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit,
102 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByOutgoingBandwidthLimit
103 );
104 #pragma warning(push)
105 #pragma warning(disable:4996)
106 strcat(buffer, buff2);
107 #pragma warning(pop)
108 }
109 }
110 else
111 {
112 #pragma warning(push)
113 #pragma warning(disable:4996)
114 sprintf(buffer,
115 "Actual bytes per second sent %" PRINTF_64_BIT_MODIFIER "u\n"
116 "Actual bytes per second received %" PRINTF_64_BIT_MODIFIER "u\n"
117 "Message bytes per second sent %" PRINTF_64_BIT_MODIFIER "u\n"
118 "Message bytes per second resent %" PRINTF_64_BIT_MODIFIER "u\n"
119 "Message bytes per second pushed %" PRINTF_64_BIT_MODIFIER "u\n"
120 "Message bytes per second returned %" PRINTF_64_BIT_MODIFIER "u\n"
121 "Message bytes per second ignored %" PRINTF_64_BIT_MODIFIER "u\n"
122 "Total bytes sent %" PRINTF_64_BIT_MODIFIER "u\n"
123 "Total bytes received %" PRINTF_64_BIT_MODIFIER "u\n"
124 "Total message bytes sent %" PRINTF_64_BIT_MODIFIER "u\n"
125 "Total message bytes resent %" PRINTF_64_BIT_MODIFIER "u\n"
126 "Total message bytes pushed %" PRINTF_64_BIT_MODIFIER "u\n"
127 "Total message bytes returned %" PRINTF_64_BIT_MODIFIER "u\n"
128 "Total message bytes ignored %" PRINTF_64_BIT_MODIFIER "u\n"
129 "Messages in send buffer, by priority %i,%i,%i,%i\n"
130 "Bytes in send buffer, by priority %i,%i,%i,%i\n"
131 "Messages in resend buffer %i\n"
132 "Bytes in resend buffer %" PRINTF_64_BIT_MODIFIER "u\n"
133 "Current packetloss %.1f%%\n"
134 "Average packetloss %.1f%%\n"
135 "Elapsed connection time in seconds %" PRINTF_64_BIT_MODIFIER "u\n",
136 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT],
137 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
138 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_SENT],
139 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_RESENT],
140 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_PUSHED],
141 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_RECEIVED_PROCESSED],
142 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_RECEIVED_IGNORED],
143 (long long unsigned int) s->runningTotal[ACTUAL_BYTES_SENT],
144 (long long unsigned int) s->runningTotal[ACTUAL_BYTES_RECEIVED],
145 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_SENT],
146 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_RESENT],
147 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_PUSHED],
148 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_RECEIVED_PROCESSED],
149 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_RECEIVED_IGNORED],
150 s->messageInSendBuffer[IMMEDIATE_PRIORITY], s->messageInSendBuffer[HIGH_PRIORITY], s->messageInSendBuffer[MEDIUM_PRIORITY], s->messageInSendBuffer[LOW_PRIORITY],
151 (unsigned int)s->bytesInSendBuffer[IMMEDIATE_PRIORITY], (unsigned int)s->bytesInSendBuffer[HIGH_PRIORITY], (unsigned int)s->bytesInSendBuffer[MEDIUM_PRIORITY], (unsigned int)s->bytesInSendBuffer[LOW_PRIORITY],
152 s->messagesInResendBuffer,
153 (long long unsigned int) s->bytesInResendBuffer,
154 s->packetlossLastSecond*100.0f,
155 s->packetlossTotal*100.0f,
156 (long long unsigned int) (uint64_t)((SLNet::GetTimeUS() - s->connectionStartTime) / 1000000)
157 );
158 #pragma warning(pop)
159
160 if (s->BPSLimitByCongestionControl != 0)
161 {
162 char buff2[128];
163 sprintf_s(buff2,
164 "Send capacity %" PRINTF_64_BIT_MODIFIER "u bytes per second (%.0f%%)\n",
165 (long long unsigned int) s->BPSLimitByCongestionControl,
166 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByCongestionControl
167 );
168 #pragma warning(push)
169 #pragma warning(disable:4996)
170 strcat(buffer, buff2);
171 #pragma warning(pop)
172 }
173 if (s->BPSLimitByOutgoingBandwidthLimit != 0)
174 {
175 char buff2[128];
176 sprintf_s(buff2,
177 "Send limit %" PRINTF_64_BIT_MODIFIER "u (%.0f%%)\n",
178 (long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit,
179 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByOutgoingBandwidthLimit
180 );
181 #pragma warning(push)
182 #pragma warning(disable:4996)
183 strcat(buffer, buff2);
184 #pragma warning(pop)
185 }
186 }
187 }
188 void RAK_DLL_EXPORT SLNet::StatisticsToString( RakNetStatistics *s, char *buffer, size_t bufferLength, int verbosityLevel )
189 {
190 if ( s == 0 )
191 {
192 sprintf_s( buffer, bufferLength, "stats is a NULL pointer in statsToString\n" );
193 return ;
194 }
195
196 if (verbosityLevel==0)
197 {
198 sprintf_s(buffer, bufferLength,
199 "Bytes per second sent %" PRINTF_64_BIT_MODIFIER "u\n"
200 "Bytes per second received %" PRINTF_64_BIT_MODIFIER "u\n"
201 "Current packetloss %.1f%%\n",
202 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT],
203 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
204 s->packetlossLastSecond*100.0f
205 );
206 }
207 else if (verbosityLevel==1)
208 {
209 sprintf_s(buffer, bufferLength,
210 "Actual bytes per second sent %" PRINTF_64_BIT_MODIFIER "u\n"
211 "Actual bytes per second received %" PRINTF_64_BIT_MODIFIER "u\n"
212 "Message bytes per second pushed %" PRINTF_64_BIT_MODIFIER "u\n"
213 "Total actual bytes sent %" PRINTF_64_BIT_MODIFIER "u\n"
214 "Total actual bytes received %" PRINTF_64_BIT_MODIFIER "u\n"
215 "Total message bytes pushed %" PRINTF_64_BIT_MODIFIER "u\n"
216 "Current packetloss %.1f%%\n"
217 "Average packetloss %.1f%%\n"
218 "Elapsed connection time in seconds %" PRINTF_64_BIT_MODIFIER "u\n",
219 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT],
220 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
221 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_PUSHED],
222 (long long unsigned int) s->runningTotal[ACTUAL_BYTES_SENT],
223 (long long unsigned int) s->runningTotal[ACTUAL_BYTES_RECEIVED],
224 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_PUSHED],
225 s->packetlossLastSecond*100.0f,
226 s->packetlossTotal*100.0f,
227 (long long unsigned int) (uint64_t)((SLNet::GetTimeUS()-s->connectionStartTime)/1000000)
228 );
229
230 if (s->BPSLimitByCongestionControl!=0)
231 {
232 char buff2[128];
233 sprintf_s(buff2,
234 "Send capacity %" PRINTF_64_BIT_MODIFIER "u bytes per second (%.0f%%)\n",
235 (long long unsigned int) s->BPSLimitByCongestionControl,
236 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByCongestionControl
237 );
238 strcat_s(buffer,bufferLength,buff2);
239 }
240 if (s->BPSLimitByOutgoingBandwidthLimit!=0)
241 {
242 char buff2[128];
243 sprintf_s(buff2,
244 "Send limit %" PRINTF_64_BIT_MODIFIER "u (%.0f%%)\n",
245 (long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit,
246 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByOutgoingBandwidthLimit
247 );
248 strcat_s(buffer,bufferLength,buff2);
249 }
250 }
251 else
252 {
253 sprintf_s(buffer, bufferLength,
254 "Actual bytes per second sent %" PRINTF_64_BIT_MODIFIER "u\n"
255 "Actual bytes per second received %" PRINTF_64_BIT_MODIFIER "u\n"
256 "Message bytes per second sent %" PRINTF_64_BIT_MODIFIER "u\n"
257 "Message bytes per second resent %" PRINTF_64_BIT_MODIFIER "u\n"
258 "Message bytes per second pushed %" PRINTF_64_BIT_MODIFIER "u\n"
259 "Message bytes per second returned %" PRINTF_64_BIT_MODIFIER "u\n"
260 "Message bytes per second ignored %" PRINTF_64_BIT_MODIFIER "u\n"
261 "Total bytes sent %" PRINTF_64_BIT_MODIFIER "u\n"
262 "Total bytes received %" PRINTF_64_BIT_MODIFIER "u\n"
263 "Total message bytes sent %" PRINTF_64_BIT_MODIFIER "u\n"
264 "Total message bytes resent %" PRINTF_64_BIT_MODIFIER "u\n"
265 "Total message bytes pushed %" PRINTF_64_BIT_MODIFIER "u\n"
266 "Total message bytes returned %" PRINTF_64_BIT_MODIFIER "u\n"
267 "Total message bytes ignored %" PRINTF_64_BIT_MODIFIER "u\n"
268 "Messages in send buffer, by priority %i,%i,%i,%i\n"
269 "Bytes in send buffer, by priority %i,%i,%i,%i\n"
270 "Messages in resend buffer %i\n"
271 "Bytes in resend buffer %" PRINTF_64_BIT_MODIFIER "u\n"
272 "Current packetloss %.1f%%\n"
273 "Average packetloss %.1f%%\n"
274 "Elapsed connection time in seconds %" PRINTF_64_BIT_MODIFIER "u\n",
275 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT],
276 (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
277 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_SENT],
278 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_RESENT],
279 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_PUSHED],
280 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_RECEIVED_PROCESSED],
281 (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_RECEIVED_IGNORED],
282 (long long unsigned int) s->runningTotal[ACTUAL_BYTES_SENT],
283 (long long unsigned int) s->runningTotal[ACTUAL_BYTES_RECEIVED],
284 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_SENT],
285 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_RESENT],
286 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_PUSHED],
287 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_RECEIVED_PROCESSED],
288 (long long unsigned int) s->runningTotal[USER_MESSAGE_BYTES_RECEIVED_IGNORED],
289 s->messageInSendBuffer[IMMEDIATE_PRIORITY],s->messageInSendBuffer[HIGH_PRIORITY],s->messageInSendBuffer[MEDIUM_PRIORITY],s->messageInSendBuffer[LOW_PRIORITY],
290 (unsigned int) s->bytesInSendBuffer[IMMEDIATE_PRIORITY],(unsigned int) s->bytesInSendBuffer[HIGH_PRIORITY],(unsigned int) s->bytesInSendBuffer[MEDIUM_PRIORITY],(unsigned int) s->bytesInSendBuffer[LOW_PRIORITY],
291 s->messagesInResendBuffer,
292 (long long unsigned int) s->bytesInResendBuffer,
293 s->packetlossLastSecond*100.0f,
294 s->packetlossTotal*100.0f,
295 (long long unsigned int) (uint64_t)((SLNet::GetTimeUS()-s->connectionStartTime)/1000000)
296 );
297
298 if (s->BPSLimitByCongestionControl!=0)
299 {
300 char buff2[128];
301 sprintf_s(buff2,
302 "Send capacity %" PRINTF_64_BIT_MODIFIER "u bytes per second (%.0f%%)\n",
303 (long long unsigned int) s->BPSLimitByCongestionControl,
304 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByCongestionControl
305 );
306 strcat_s(buffer,bufferLength,buff2);
307 }
308 if (s->BPSLimitByOutgoingBandwidthLimit!=0)
309 {
310 char buff2[128];
311 sprintf_s(buff2,
312 "Send limit %" PRINTF_64_BIT_MODIFIER "u (%.0f%%)\n",
313 (long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit,
314 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByOutgoingBandwidthLimit
315 );
316 strcat_s(buffer,bufferLength,buff2);
317 }
318 }
319 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RemoteClient
SLNet::RemoteClient Member List

This is the complete list of members for SLNet::RemoteClient, including all inherited members.

isActive | SLNet::RemoteClient |
isActiveMutex | SLNet::RemoteClient |
outgoingData | SLNet::RemoteClient |
outgoingDataMutex | SLNet::RemoteClient |
Recv(char *data, const int dataSize) | SLNet::RemoteClient |
RemoteClient() | SLNet::RemoteClient | inline
Reset(void) | SLNet::RemoteClient | inline
Send(const char *data, unsigned int length) | SLNet::RemoteClient |
SendOrBuffer(const char **data, const unsigned int *lengths, const int numParameters) | SLNet::RemoteClient |
SetActive(bool a) | SLNet::RemoteClient |
socket | SLNet::RemoteClient |
systemAddress | SLNet::RemoteClient |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_List.h Source File

  • include
  • slikenet
DS_List.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
21
22
23 #ifndef __LIST_H
24 #define __LIST_H
25
26 #include "assert.h"
27 #include <string.h> // memmove
28 #include "Export.h"
29 #include "memoryoverride.h"
30
32 static const unsigned int MAX_UNSIGNED_LONG = 4294967295U;
33
36 namespace DataStructures
37 {
40 template <class list_type>
41 class RAK_DLL_EXPORT List
42 {
43 public:
45 List();
46
47 // Destructor
48 ~List();
49
52 List( const List& original_copy );
53
55 List& operator= ( const List& original_copy );
56
60 list_type& operator[] ( const unsigned int position ) const;
61
65 list_type& Get ( const unsigned int position ) const;
66
69 void Push(const list_type &input, const char *file, unsigned int line );
70
74 list_type& Pop(void);
75
79 void Insert( const list_type &input, const unsigned int position, const char *file, unsigned int line );
80
83 void Insert( const list_type &input, const char *file, unsigned int line );
84
91 void Replace( const list_type &input, const list_type filler, const unsigned int position, const char *file, unsigned int line );
92
95 void Replace( const list_type &input );
96
99 void RemoveAtIndex( const unsigned int position );
100
104 void RemoveAtIndexFast( const unsigned int position );
105
107 void RemoveFromEnd(const unsigned num=1);
108
114 unsigned int GetIndexOf( const list_type &input ) const;
115
117 unsigned int Size( void ) const;
118
120 void Clear( bool doNotDeallocateSmallBlocks, const char *file, unsigned int line );
121
123 void Preallocate( unsigned countNeeded, const char *file, unsigned int line );
124
128 void Compress( const char *file, unsigned int line );
129
130 private:
132 list_type* listArray;
133
135 unsigned int list_size;
136
138 unsigned int allocation_size;
139 };
140 template <class list_type>
141 List<list_type>::List()
142 {
143 allocation_size = 0;
144 listArray = 0;
145 list_size = 0;
146 }
147
148 template <class list_type>
149 List<list_type>::~List()
150 {
151 if (allocation_size>0)
152 SLNet::OP_DELETE_ARRAY(listArray, _FILE_AND_LINE_);
153 }
154
155
156 template <class list_type>
157 List<list_type>::List( const List& original_copy )
158 {
159 // Allocate memory for copy
160
161 if ( original_copy.list_size == 0 )
162 {
163 list_size = 0;
164 allocation_size = 0;
165 }
166 else
167 {
168 listArray = SLNet::OP_NEW_ARRAY<list_type >( original_copy.list_size , _FILE_AND_LINE_ );
169
170 for ( unsigned int counter = 0; counter < original_copy.list_size; ++counter )
171 listArray[ counter ] = original_copy.listArray[ counter ];
172
173 // Don't call constructors, assignment operators, etc.
174 //memcpy(listArray, original_copy.listArray, original_copy.list_size*sizeof(list_type));
175
176 list_size = allocation_size = original_copy.list_size;
177 }
178 }
179
180 template <class list_type>
181 List<list_type>& List<list_type>::operator= ( const List& original_copy )
182 {
183 if ( ( &original_copy ) != this )
184 {
185 Clear( false, _FILE_AND_LINE_ );
186
187 // Allocate memory for copy
188
189 if ( original_copy.list_size == 0 )
190 {
191 list_size = 0;
192 allocation_size = 0;
193 }
194
195 else
196 {
197 listArray = SLNet::OP_NEW_ARRAY<list_type >( original_copy.list_size , _FILE_AND_LINE_ );
198
199 for ( unsigned int counter = 0; counter < original_copy.list_size; ++counter )
200 listArray[ counter ] = original_copy.listArray[ counter ];
201 // Don't call constructors, assignment operators, etc.
202 //memcpy(listArray, original_copy.listArray, original_copy.list_size*sizeof(list_type));
203
204 list_size = allocation_size = original_copy.list_size;
205 }
206 }
207
208 return *this;
209 }
210
211
212 template <class list_type>
213 inline list_type& List<list_type>::operator[] ( const unsigned int position ) const
214 {
215 #ifdef _DEBUG
216 if (position>=list_size)
217 {
218 RakAssert ( position < list_size );
219 }
220 #endif
221 return listArray[ position ];
222 }
223
224 // Just here for debugging
225 template <class list_type>
226 inline list_type& List<list_type>::Get ( const unsigned int position ) const
227 {
228 return listArray[ position ];
229 }
230
231 template <class list_type>
232 void List<list_type>::Push(const list_type &input, const char *file, unsigned int line)
233 {
234 Insert(input, file, line);
235 }
236
237 template <class list_type>
238 inline list_type& List<list_type>::Pop(void)
239 {
240 #ifdef _DEBUG
241 RakAssert(list_size>0);
242 #endif
243 --list_size;
244 return listArray[list_size];
245 }
246
247 template <class list_type>
248 void List<list_type>::Insert( const list_type &input, const unsigned int position, const char *file, unsigned int line )
249 {
250 #ifdef _DEBUG
251 if (position>list_size)
252 {
253 RakAssert( position <= list_size );
254 }
255 #endif
256
257 // Reallocate list if necessary
258 if ( list_size == allocation_size )
259 {
260 // allocate twice the currently allocated memory
261 list_type * new_array;
262
263 if ( allocation_size == 0 )
264 allocation_size = 16;
265 else
266 allocation_size *= 2;
267
268 new_array = SLNet::OP_NEW_ARRAY<list_type >( allocation_size , file, line );
269
270 // copy old array over
271 for ( unsigned int counter = 0; counter < list_size; ++counter )
272 new_array[ counter ] = listArray[ counter ];
273
274 // Don't call constructors, assignment operators, etc.
275 //memcpy(new_array, listArray, list_size*sizeof(list_type));
276
277 // set old array to point to the newly allocated and twice as large array
278 SLNet::OP_DELETE_ARRAY(listArray, file, line);
279
280 listArray = new_array;
281 }
282
283 // Move the elements in the list to make room
284 for ( unsigned int counter = list_size; counter != position; counter-- )
285 listArray[ counter ] = listArray[ counter - 1 ];
286
287 // Don't call constructors, assignment operators, etc.
288 //memmove(listArray+position+1, listArray+position, (list_size-position)*sizeof(list_type));
289
290 // Insert the new item at the correct spot
291 listArray[ position ] = input;
292
293 ++list_size;
294
295 }
296
297
298 template <class list_type>
299 void List<list_type>::Insert( const list_type &input, const char *file, unsigned int line )
300 {
301 // Reallocate list if necessary
302
303 if ( list_size == allocation_size )
304 {
305 // allocate twice the currently allocated memory
306 list_type * new_array;
307
308 if ( allocation_size == 0 )
309 allocation_size = 16;
310 else
311 allocation_size *= 2;
312
313 new_array = SLNet::OP_NEW_ARRAY<list_type >( allocation_size , file, line );
314
315 if (listArray)
316 {
317 // copy old array over
318 for ( unsigned int counter = 0; counter < list_size; ++counter )
319 new_array[ counter ] = listArray[ counter ];
320
321 // Don't call constructors, assignment operators, etc.
322 //memcpy(new_array, listArray, list_size*sizeof(list_type));
323
324 // set old array to point to the newly allocated and twice as large array
325 SLNet::OP_DELETE_ARRAY(listArray, file, line);
326 }
327
328 listArray = new_array;
329 }
330
331 // Insert the new item at the correct spot
332 listArray[ list_size ] = input;
333
334 ++list_size;
335 }
336
337 template <class list_type>
338 inline void List<list_type>::Replace( const list_type &input, const list_type filler, const unsigned int position, const char *file, unsigned int line )
339 {
340 if ( ( list_size > 0 ) && ( position < list_size ) )
341 {
342 // Direct replacement
343 listArray[ position ] = input;
344 }
345 else
346 {
347 if ( position >= allocation_size )
348 {
349 // Reallocate the list to size position and fill in blanks with filler
350 list_type * new_array;
351 allocation_size = position + 1;
352
353 new_array = SLNet::OP_NEW_ARRAY<list_type >( allocation_size , file, line );
354
355 // copy old array over
356
357 for ( unsigned int counter = 0; counter < list_size; ++counter )
358 new_array[ counter ] = listArray[ counter ];
359
360 // Don't call constructors, assignment operators, etc.
361 //memcpy(new_array, listArray, list_size*sizeof(list_type));
362
363 // set old array to point to the newly allocated array
364 SLNet::OP_DELETE_ARRAY(listArray, file, line);
365
366 listArray = new_array;
367 }
368
369 // Fill in holes with filler
370 while ( list_size < position )
371 listArray[ list_size++ ] = filler;
372
373 // Fill in the last element with the new item
374 listArray[ list_size++ ] = input;
375
376 #ifdef _DEBUG
377
378 RakAssert( list_size == position + 1 );
379
380 #endif
381
382 }
383 }
384
385 template <class list_type>
386 inline void List<list_type>::Replace( const list_type &input )
387 {
388 if ( list_size > 0 )
389 listArray[ list_size - 1 ] = input;
390 }
391
392 template <class list_type>
393 void List<list_type>::RemoveAtIndex( const unsigned int position )
394 {
395 #ifdef _DEBUG
396 if (position >= list_size)
397 {
398 RakAssert( position < list_size );
399 return;
400 }
401 #endif
402
403 if ( position < list_size )
404 {
405 // Compress the array
406 for ( unsigned int counter = position; counter < list_size - 1 ; ++counter )
407 listArray[ counter ] = listArray[ counter + 1 ];
408 // Don't call constructors, assignment operators, etc.
409 // memmove(listArray+position, listArray+position+1, (list_size-1-position) * sizeof(list_type));
410
411 RemoveFromEnd();
412 }
413 }
414
415 template <class list_type>
416 void List<list_type>::RemoveAtIndexFast( const unsigned int position )
417 {
418 #ifdef _DEBUG
419 if (position >= list_size)
420 {
421 RakAssert( position < list_size );
422 return;
423 }
424 #endif
425 --list_size;
426 listArray[position]=listArray[list_size];
427 }
428
429 template <class list_type>
430 inline void List<list_type>::RemoveFromEnd( const unsigned num )
431 {
432 // Delete the last elements on the list. No compression needed
433 #ifdef _DEBUG
434 RakAssert(list_size>=num);
435 #endif
436 list_size-=num;
437 }
438
439 template <class list_type>
440 unsigned int List<list_type>::GetIndexOf( const list_type &input ) const
441 {
442 for ( unsigned int i = 0; i < list_size; ++i )
443 if ( listArray[ i ] == input )
444 return i;
445
446 return MAX_UNSIGNED_LONG;
447 }
448
449 template <class list_type>
450 inline unsigned int List<list_type>::Size( void ) const
451 {
452 return list_size;
453 }
454
455 template <class list_type>
456 void List<list_type>::Clear( bool doNotDeallocateSmallBlocks, const char *file, unsigned int line )
457 {
458 if ( allocation_size == 0 )
459 return;
460
461 if (allocation_size>512 || doNotDeallocateSmallBlocks==false)
462 {
463 SLNet::OP_DELETE_ARRAY(listArray, file, line);
464 allocation_size = 0;
465 listArray = 0;
466 }
467 list_size = 0;
468 }
469
470 template <class list_type>
471 void List<list_type>::Compress( const char *file, unsigned int line )
472 {
473 list_type * new_array;
474
475 if ( allocation_size == 0 )
476 return ;
477
478 new_array = SLNet::OP_NEW_ARRAY<list_type >( allocation_size , file, line );
479
480 // copy old array over
481 for ( unsigned int counter = 0; counter < list_size; ++counter )
482 new_array[ counter ] = listArray[ counter ];
483
484 // Don't call constructors, assignment operators, etc.
485 //memcpy(new_array, listArray, list_size*sizeof(list_type));
486
487 // set old array to point to the newly allocated array
488 SLNet::OP_DELETE_ARRAY(listArray, file, line);
489
490 listArray = new_array;
491 }
492
493 template <class list_type>
494 void List<list_type>::Preallocate( unsigned countNeeded, const char *file, unsigned int line )
495 {
496 unsigned amountToAllocate = allocation_size;
497 if (allocation_size==0)
498 amountToAllocate=16;
499 while (amountToAllocate < countNeeded)
500 amountToAllocate<<=1;
501
502 if ( allocation_size < amountToAllocate)
503 {
504 // allocate twice the currently allocated memory
505 list_type * new_array;
506
507 allocation_size=amountToAllocate;
508
509 new_array = SLNet::OP_NEW_ARRAY< list_type >( allocation_size , file, line );
510
511 if (listArray)
512 {
513 // copy old array over
514 for ( unsigned int counter = 0; counter < list_size; ++counter )
515 new_array[ counter ] = listArray[ counter ];
516
517 // Don't call constructors, assignment operators, etc.
518 //memcpy(new_array, listArray, list_size*sizeof(list_type));
519
520 // set old array to point to the newly allocated and twice as large array
521 SLNet::OP_DELETE_ARRAY(listArray, file, line);
522 }
523
524 listArray = new_array;
525 }
526 }
527
528 } // End namespace
529
530 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetTransport2.cpp Source File

  • src
RakNetTransport2.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_TelnetTransport==1
18
19 #include "slikenet/transport2.h"
20
21 #include "slikenet/peerinterface.h"
22 #include "slikenet/BitStream.h"
23 #include "slikenet/MessageIdentifiers.h"
24 #include <stdio.h>
25 #include <string.h>
26 #include <stdarg.h>
27 #include "slikenet/LinuxStrings.h"
28 #include "slikenet/linux_adapter.h"
29 #include "slikenet/osx_adapter.h"
30
31 using namespace SLNet;
32
33 STATIC_FACTORY_DEFINITIONS(RakNetTransport2,RakNetTransport2);
34
35 RakNetTransport2::RakNetTransport2()
36 {
37 }
38 RakNetTransport2::~RakNetTransport2()
39 {
40 Stop();
41 }
42 bool RakNetTransport2::Start(unsigned short port, bool serverMode)
43 {
44 (void) port;
45 (void) serverMode;
46 return true;
47 }
48 void RakNetTransport2::Stop(void)
49 {
50 newConnections.Clear(_FILE_AND_LINE_);
51 lostConnections.Clear(_FILE_AND_LINE_);
52 for (unsigned int i=0; i < packetQueue.Size(); i++)
53 {
54 rakFree_Ex(packetQueue[i]->data,_FILE_AND_LINE_);
55 SLNet::OP_DELETE(packetQueue[i],_FILE_AND_LINE_);
56 }
57 packetQueue.Clear(_FILE_AND_LINE_);
58 }
59 void RakNetTransport2::Send( SystemAddress systemAddress, const char *data, ... )
60 {
61 if (data==0 || data[0]==0) return;
62
63 char text[REMOTE_MAX_TEXT_INPUT];
64 va_list ap;
65 va_start(ap, data);
66 vsnprintf_s(text, REMOTE_MAX_TEXT_INPUT-1, data, ap);
67 va_end(ap);
68
69 SLNet::BitStream str;
70 str.Write((MessageID)ID_TRANSPORT_STRING);
71 str.Write(text, (int) strlen(text));
72 str.Write((unsigned char) 0); // Null terminate the string
73 rakPeerInterface->Send(&str, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, systemAddress, (systemAddress==UNASSIGNED_SYSTEM_ADDRESS)!=0);
74 }
75 void RakNetTransport2::CloseConnection( SystemAddress systemAddress )
76 {
77 rakPeerInterface->CloseConnection(systemAddress, true, 0);
78 }
79 Packet* RakNetTransport2::Receive( void )
80 {
81 if (packetQueue.Size()==0)
82 return 0;
83 return packetQueue.Pop();
84 }
85 SystemAddress RakNetTransport2::HasNewIncomingConnection(void)
86 {
87 if (newConnections.Size())
88 return newConnections.Pop();
89 return UNASSIGNED_SYSTEM_ADDRESS;
90 }
91 SystemAddress RakNetTransport2::HasLostConnection(void)
92 {
93 if (lostConnections.Size())
94 return lostConnections.Pop();
95 return UNASSIGNED_SYSTEM_ADDRESS;
96 }
97 void RakNetTransport2::DeallocatePacket( Packet *packet )
98 {
99 rakFree_Ex(packet->data, _FILE_AND_LINE_ );
100 SLNet::OP_DELETE(packet, _FILE_AND_LINE_ );
101 }
102 PluginReceiveResult RakNetTransport2::OnReceive(Packet *packet)
103 {
104 switch (packet->data[0])
105 {
106 case ID_TRANSPORT_STRING:
107 {
108 if (packet->length==sizeof(MessageID))
109 return RR_STOP_PROCESSING_AND_DEALLOCATE;
110
111 Packet *p = SLNet::OP_NEW<Packet>(_FILE_AND_LINE_);
112 *p=*packet;
113 p->bitSize-=8;
114 p->length--;
115 p->data=(unsigned char*) rakMalloc_Ex(p->length,_FILE_AND_LINE_);
116 memcpy(p->data, packet->data+1, p->length);
117 packetQueue.Push(p, _FILE_AND_LINE_ );
118
119 }
120 return RR_STOP_PROCESSING_AND_DEALLOCATE;
121 }
122 return RR_CONTINUE_PROCESSING;
123 }
124 void RakNetTransport2::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
125 {
126 (void) rakNetGUID;
127 (void) lostConnectionReason;
128 lostConnections.Push(systemAddress, _FILE_AND_LINE_ );
129 }
130 void RakNetTransport2::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
131 {
132 (void) rakNetGUID;
133 (void) isIncoming;
134 newConnections.Push(systemAddress, _FILE_AND_LINE_ );
135 }
136
137 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/sleep.h Source File

  • include
  • slikenet
sleep.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __RAK_SLEEP_H
12 #define __RAK_SLEEP_H
13
14 #include "Export.h"
15
16 void RAK_DLL_EXPORT RakSleep(unsigned int ms);
17
18 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • VariableDeltaSerializer
  • SerializationContext
SLNet::VariableDeltaSerializer::SerializationContext Member List

This is the complete list of members for SLNet::VariableDeltaSerializer::SerializationContext, including all inherited members.

anyVariablesWritten | SLNet::VariableDeltaSerializer::SerializationContext
bitStream | SLNet::VariableDeltaSerializer::SerializationContext
changedVariables | SLNet::VariableDeltaSerializer::SerializationContext
guid | SLNet::VariableDeltaSerializer::SerializationContext
newSystemSend | SLNet::VariableDeltaSerializer::SerializationContext
rakPeerSendReceipt | SLNet::VariableDeltaSerializer::SerializationContext
sendReceipt | SLNet::VariableDeltaSerializer::SerializationContext
SerializationContext() | SLNet::VariableDeltaSerializer::SerializationContext
serializationMode | SLNet::VariableDeltaSerializer::SerializationContext
variableHistory | SLNet::VariableDeltaSerializer::SerializationContext
variableHistoryIdentical | SLNet::VariableDeltaSerializer::SerializationContext
variableHistoryUnique | SLNet::VariableDeltaSerializer::SerializationContext
~SerializationContext() | SLNet::VariableDeltaSerializer::SerializationContext
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • ByteQueue
DataStructures::ByteQueue Member List

This is the complete list of members for DataStructures::ByteQueue, including all inherited members.

ByteQueue() | DataStructures::ByteQueue |
Clear(const char *file, unsigned int line) | DataStructures::ByteQueue |
data | DataStructures::ByteQueue | protected
DecrementReadOffset(unsigned length) | DataStructures::ByteQueue |
GetBytesWritten(void) const | DataStructures::ByteQueue |
IncrementReadOffset(unsigned length) | DataStructures::ByteQueue |
lengthAllocated | DataStructures::ByteQueue | protected
PeekContiguousBytes(unsigned int *outLength) const | DataStructures::ByteQueue |
Print(void) | DataStructures::ByteQueue |
ReadBytes(char *out, unsigned maxLengthToRead, bool peek) | DataStructures::ByteQueue |
readOffset | DataStructures::ByteQueue | protected
WriteBytes(const char *in, unsigned length, const char *file, unsigned int line) | DataStructures::ByteQueue |
writeOffset | DataStructures::ByteQueue | protected
~ByteQueue() | DataStructures::ByteQueue |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Base64Encoder.cpp Source File

  • src
Base64Encoder.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/Base64Encoder.h"
17 #include "slikenet/memoryoverride.h"
18
19 const char *Base64Map(void) {return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";}
20 const char *base64Map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
21
22 // 3/17/2013 must be unsigned char or else it will use negative indices
23 int Base64Encoding(const unsigned char *inputData, int dataLength, char *outputData)
24 {
25 // http://en.wikipedia.org/wiki/Base64
26
27 int outputOffset, charCount;
28 int write3Count;
29 outputOffset=0;
30 charCount=0;
31 int j;
32
33 write3Count=dataLength/3;
34 for (j=0; j < write3Count; j++)
35 {
36 // 6 leftmost bits from first byte, shifted to bits 7,8 are 0
37 outputData[outputOffset++]=base64Map[inputData[j*3+0] >> 2];
38 if ((++charCount % 76)==0) {outputData[outputOffset++]='\r'; outputData[outputOffset++]='\n'; charCount=0;}
39
40 // Remaining 2 bits from first byte, placed in position, and 4 high bits from the second byte, masked to ignore bits 7,8
41 outputData[outputOffset++]=base64Map[((inputData[j*3+0] << 4) | (inputData[j*3+1] >> 4)) & 63];
42 if ((++charCount % 76)==0) {outputData[outputOffset++]='\r'; outputData[outputOffset++]='\n'; charCount=0;}
43
44 // 4 low bits from the second byte and the two high bits from the third byte, masked to ignore bits 7,8
45 outputData[outputOffset++]=base64Map[((inputData[j*3+1] << 2) | (inputData[j*3+2] >> 6)) & 63]; // Third 6 bits
46 if ((++charCount % 76)==0) {outputData[outputOffset++]='\r'; outputData[outputOffset++]='\n'; charCount=0;}
47
48 // Last 6 bits from the third byte, masked to ignore bits 7,8
49 outputData[outputOffset++]=base64Map[inputData[j*3+2] & 63];
50 if ((++charCount % 76)==0) {outputData[outputOffset++]='\r'; outputData[outputOffset++]='\n'; charCount=0;}
51 }
52
53 if (dataLength % 3==1)
54 {
55 // One input byte remaining
56 outputData[outputOffset++]=base64Map[inputData[j*3+0] >> 2];
57 if ((++charCount % 76)==0) {outputData[outputOffset++]='\r'; outputData[outputOffset++]='\n'; charCount=0;}
58
59 // Remaining 2 bits from first byte, placed in position, and 4 high bits from the second byte, masked to ignore bits 7,8
60 outputData[outputOffset++]=base64Map[((inputData[j*3+0] << 4) | (inputData[j*3+1] >> 4)) & 63];
61 if ((++charCount % 76)==0) {outputData[outputOffset++]='\r'; outputData[outputOffset++]='\n'; charCount=0;}
62
63 // Pad with two equals
64 outputData[outputOffset++]='=';
65 outputData[outputOffset++]='=';
66 }
67 else if (dataLength % 3==2)
68 {
69 // Two input bytes remaining
70
71 // 6 leftmost bits from first byte, shifted to bits 7,8 are 0
72 outputData[outputOffset++]=base64Map[inputData[j*3+0] >> 2];
73 if ((++charCount % 76)==0) {outputData[outputOffset++]='\r'; outputData[outputOffset++]='\n'; charCount=0;}
74
75 // Remaining 2 bits from first byte, placed in position, and 4 high bits from the second byte, masked to ignore bits 7,8
76 outputData[outputOffset++]=base64Map[((inputData[j*3+0] << 4) | (inputData[j*3+1] >> 4)) & 63];
77 if ((++charCount % 76)==0) {outputData[outputOffset++]='\r'; outputData[outputOffset++]='\n'; charCount=0;}
78
79 // 4 low bits from the second byte, followed by 00
80 outputData[outputOffset++]=base64Map[(inputData[j*3+1] << 2) & 63]; // Third 6 bits
81 if ((++charCount % 76)==0) {outputData[outputOffset++]='\r'; outputData[outputOffset++]='\n'; charCount=0;}
82
83 // Pad with one equal
84 outputData[outputOffset++]='=';
85 //outputData[outputOffset++]='=';
86 }
87
88 // Append \r\n
89 outputData[outputOffset++]='\r';
90 outputData[outputOffset++]='\n';
91 outputData[outputOffset]=0;
92
93 return outputOffset;
94 }
95
96 int Base64Encoding(const unsigned char *inputData, int dataLength, char **outputData)
97 {
98 *outputData = (char*) rakMalloc_Ex(dataLength * 2 + 6, _FILE_AND_LINE_);
99 return Base64Encoding(inputData, dataLength, *outputData);
100 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
CheckSum Member List

This is the complete list of members for CheckSum, including all inherited members.

Add(unsigned int w) | CheckSum |
Add(unsigned short w) | CheckSum |
Add(unsigned char *b, unsigned int length) | CheckSum |
Add(unsigned char b) | CheckSum |
c1 | CheckSum | protected
c2 | CheckSum | protected
CheckSum() | CheckSum | inline
Clear() | CheckSum | inline
Get() | CheckSum | inline
r | CheckSum | protected
sum | CheckSum | protected
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DirectoryDeltaTransfer.h Source File

  • include
  • slikenet
DirectoryDeltaTransfer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #include "NativeFeatureIncludes.h"
23 #if _RAKNET_SUPPORT_DirectoryDeltaTransfer==1 && _RAKNET_SUPPORT_FileOperations==1
24
25 #ifndef __DIRECTORY_DELTA_TRANSFER_H
26 #define __DIRECTORY_DELTA_TRANSFER_H
27
28 #include "memoryoverride.h"
29 #include "types.h"
30 #include "Export.h"
31 #include "PluginInterface2.h"
32 #include "DS_Map.h"
33 #include "PacketPriority.h"
34
39
55
56 namespace SLNet
57 {
59 class RakPeerInterface;
60 class FileList;
61 struct Packet;
62 struct InternalPacket;
63 struct DownloadRequest;
64 class FileListTransfer;
65 class FileListTransferCBInterface;
66 class FileListProgress;
67 class IncrementalReadInterface;
68
69 class RAK_DLL_EXPORT DirectoryDeltaTransfer : public PluginInterface2
70 {
71 public:
72 // GetInstance() and DestroyInstance(instance*)
73 STATIC_FACTORY_DECLARATIONS(DirectoryDeltaTransfer)
74
75 // Constructor
76 DirectoryDeltaTransfer();
77
78 // Destructor
79 virtual ~DirectoryDeltaTransfer();
80
84 void SetFileListTransferPlugin(FileListTransfer *flt);
85
88 void SetApplicationDirectory(const char *pathToApplication);
89
93 void SetUploadSendParameters(PacketPriority _priority, char _orderingChannel);
94
100 void AddUploadsFromSubdirectory(const char *subdir);
101
118 unsigned short DownloadFromSubdirectory(const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, SystemAddress host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel, FileListProgress *cb);
119
137 unsigned short DownloadFromSubdirectory(FileList &localFiles, const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, SystemAddress host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel, FileListProgress *cb);
138
144 void GenerateHashes(FileList &localFiles, const char *outputSubdir, bool prependAppDirToOutputSubdir);
145
147 void ClearUploads(void);
148
151 unsigned GetNumberOfFilesForUpload(void) const;
152
157 void SetDownloadRequestIncrementalReadInterface(IncrementalReadInterface *_incrementalReadInterface, unsigned int _chunkSize);
158
160 virtual PluginReceiveResult OnReceive(Packet *packet);
161 protected:
162 void OnDownloadRequest(Packet *packet);
163
164 char applicationDirectory[512];
165 FileListTransfer *fileListTransfer;
166 FileList *availableUploads;
167 PacketPriority priority;
168 char orderingChannel;
169 IncrementalReadInterface *incrementalReadInterface;
170 unsigned int chunkSize;
171 };
172
173 } // namespace SLNet
174
175 #endif
176
177 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • HashIndex
DataStructures::HashIndex Member List

This is the complete list of members for DataStructures::HashIndex, including all inherited members.

IsInvalid(void) const | DataStructures::HashIndex | inline
primaryIndex | DataStructures::HashIndex |
secondaryIndex | DataStructures::HashIndex |
SetInvalid(void) | DataStructures::HashIndex | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CommandParserInterface.cpp Source File

  • src
CommandParserInterface.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/CommandParserInterface.h"
17 #include "slikenet/TransportInterface.h"
18 #include <string.h>
19 #include "slikenet/assert.h"
20 #include <stdio.h>
21
22
23 #if defined(WINDOWS_STORE_RT)
24 #elif defined(_WIN32)
25 // IP_DONTFRAGMENT is different between winsock 1 and winsock 2. Therefore, Winsock2.h must be linked againt Ws2_32.lib
26 // winsock.h must be linked against WSock32.lib. If these two are mixed up the flag won't work correctly
27 #include <winsock2.h>
28
29 #else
30 #include <sys/socket.h>
31 #include <netinet/in.h>
32 #include <arpa/inet.h>
33 #endif
34
35 #include "slikenet/LinuxStrings.h"
36
37 using namespace SLNet;
38
39 const unsigned char CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS=255;
40
41 int SLNet::RegisteredCommandComp( const char* const & key, const RegisteredCommand &data )
42 {
43 return _stricmp(key,data.command);
44 }
45
46 CommandParserInterface::CommandParserInterface() {}
47 CommandParserInterface::~CommandParserInterface() {}
48
49 void CommandParserInterface::ParseConsoleString(char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength)
50 {
51 unsigned strIndex, parameterListIndex;
52 unsigned strLen;
53 bool replaceDelineator=true;
54
55 strLen = (unsigned) strlen(str);
56
57 // Replace every instance of delineator, \n, \r with 0
58 for (strIndex=0; strIndex < strLen; strIndex++)
59 {
60 if (str[strIndex]==delineator && replaceDelineator)
61 str[strIndex]=0;
62
63 if (str[strIndex]=='\n' || str[strIndex]=='\r')
64 str[strIndex]=0;
65
66 if (str[strIndex]==delineatorToggle)
67 {
68 str[strIndex]=0;
69 replaceDelineator=!replaceDelineator;
70 }
71 }
72
73 // Fill up parameterList starting at each non-0
74 for (strIndex=0, parameterListIndex=0; strIndex < strLen; )
75 {
76 if (str[strIndex]!=0)
77 {
78 parameterList[parameterListIndex]=str+strIndex;
79 parameterListIndex++;
80 RakAssert(parameterListIndex < parameterListLength);
81 if (parameterListIndex >= parameterListLength)
82 break;
83
84 strIndex++;
85 while (str[strIndex]!=0 && strIndex < strLen)
86 strIndex++;
87 }
88 else
89 strIndex++;
90 }
91
92 parameterList[parameterListIndex]=0;
93 *numParameters=parameterListIndex;
94 }
95 void CommandParserInterface::SendCommandList(TransportInterface *transport, const SystemAddress &systemAddress)
96 {
97 unsigned i;
98 if (commandList.Size())
99 {
100 for (i=0; i < commandList.Size(); i++)
101 {
102 transport->Send(systemAddress, "%s", commandList[i].command);
103 if (i < commandList.Size()-1)
104 transport->Send(systemAddress, ", ");
105 }
106 transport->Send(systemAddress, "\r\n");
107 }
108 else
109 transport->Send(systemAddress, "No registered commands\r\n");
110 }
111 void CommandParserInterface::RegisterCommand(unsigned char parameterCount, const char *command, const char *commandHelp)
112 {
113 RegisteredCommand rc;
114 rc.command=command;
115 rc.commandHelp=commandHelp;
116 rc.parameterCount=parameterCount;
117 commandList.Insert( command, rc, true, _FILE_AND_LINE_);
118 }
119 bool CommandParserInterface::GetRegisteredCommand(const char *command, RegisteredCommand *rc)
120 {
121 bool objectExists;
122 unsigned index;
123 index=commandList.GetIndexFromKey(command, &objectExists);
124 if (objectExists)
125 *rc=commandList[index];
126 return objectExists;
127 }
128 void CommandParserInterface::OnTransportChange(TransportInterface *transport)
129 {
130 (void) transport;
131 }
132 void CommandParserInterface::OnNewIncomingConnection(const SystemAddress &systemAddress, TransportInterface *transport)
133 {
134 (void) systemAddress;
135 (void) transport;
136 }
137 void CommandParserInterface::OnConnectionLost(const SystemAddress &systemAddress, TransportInterface *transport)
138 {
139 (void) systemAddress;
140 (void) transport;
141 }
142 void CommandParserInterface::ReturnResult(bool res, const char *command,TransportInterface *transport, const SystemAddress &systemAddress)
143 {
144 if (res)
145 transport->Send(systemAddress, "%s returned true.\r\n", command);
146 else
147 transport->Send(systemAddress, "%s returned false.\r\n", command);
148 }
149 void CommandParserInterface::ReturnResult(int res, const char *command,TransportInterface *transport, const SystemAddress &systemAddress)
150 {
151 transport->Send(systemAddress, "%s returned %i.\r\n", command, res);
152 }
153 void CommandParserInterface::ReturnResult(const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
154 {
155 transport->Send(systemAddress, "Successfully called %s.\r\n", command);
156 }
157 void CommandParserInterface::ReturnResult(char *res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
158 {
159 transport->Send(systemAddress, "%s returned %s.\r\n", command, res);
160 }
161 void CommandParserInterface::ReturnResult(SystemAddress res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
162 {
163 char addr[128];
164 systemAddress.ToString(false,addr,static_cast<size_t>(128));
165 char addr2[128];
166 res.ToString(false,addr2,static_cast<size_t>(128));
167 transport->Send(systemAddress, "%s returned %s %s:%i\r\n", command,addr,addr2,res.GetPort());
168 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/HTTPConnection.h Source File

  • include
  • slikenet
HTTPConnection.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_HTTPConnection==1 && _RAKNET_SUPPORT_TCPInterface==1
23
24 #ifndef __HTTP_CONNECTION
25 #define __HTTP_CONNECTION
26
27 #include "Export.h"
28 #include "string.h"
29 #include "memoryoverride.h"
30 #include "types.h"
31 #include "DS_Queue.h"
32
33 namespace SLNet
34 {
36 class TCPInterface;
37 struct SystemAddress;
38
47 class RAK_DLL_EXPORT HTTPConnection
48 {
49 public:
50 // GetInstance() and DestroyInstance(instance*)
51 STATIC_FACTORY_DECLARATIONS(HTTPConnection)
52
53
54 HTTPConnection();
55 virtual ~HTTPConnection();
56
58 void Init(TCPInterface *_tcp, const char *host, unsigned short port=80);
59
67 void Post(const char *path, const char *data, const char *_contentType="application/x-www-form-urlencoded");
68
71 void Get(const char *path);
72
74 bool HasRead(void) const;
75
78 SLNet::RakString Read(void);
79
81 void Update(void);
82
84 SystemAddress GetServerAddress(void) const;
85
91 void ProcessTCPPacket(Packet *packet);
92
95 enum ResponseCodes { NoBody=1001, OK=200, Deleted=1002 };
96
97 HTTPConnection& operator=(const HTTPConnection& rhs){(void) rhs; return *this;}
98
100 struct BadResponse
101 {
102 public:
103 BadResponse() {code=0;}
104
105 BadResponse(const unsigned char *_data, int _code)
106 : data((const char *)_data), code(_code) {}
107
108 BadResponse(const char *_data, int _code)
109 : data(_data), code(_code) {}
110
111 operator int () const { return code; }
112
113 SLNet::RakString data;
114 int code; // ResponseCodes
115 };
116
118 bool HasBadResponse(int *code, SLNet::RakString *data);
119
121 bool IsBusy(void) const;
122
124 int GetState(void) const;
125
126 struct OutgoingCommand
127 {
128 SLNet::RakString remotePath;
129 SLNet::RakString data;
130 SLNet::RakString contentType;
131 bool isPost;
132 };
133
134 DataStructures::Queue<OutgoingCommand> outgoingCommand;
135 OutgoingCommand currentProcessingCommand;
136
137 private:
138 SystemAddress server;
139 TCPInterface *tcp;
140 SLNet::RakString host;
141 unsigned short port;
142 DataStructures::Queue<BadResponse> badResponses;
143
144 enum ConnectionState
145 {
146 CS_NONE,
147 CS_DISCONNECTING,
148 CS_CONNECTING,
149 CS_CONNECTED,
150 CS_PROCESSING,
151 } connectionState;
152
153 SLNet::RakString incomingData;
154 DataStructures::Queue<SLNet::RakString> results;
155
156 void CloseConnection();
157
158 /*
159 enum { RAK_HTTP_INITIAL,
160 RAK_HTTP_STARTING,
161 RAK_HTTP_CONNECTING,
162 RAK_HTTP_ESTABLISHED,
163 RAK_HTTP_REQUEST_SENT,
164 RAK_HTTP_IDLE } state;
165
166 SLNet::RakString outgoing, incoming, path, contentType;
167 void Process(Packet *packet); // the workhorse
168
169 // this helps check the various status lists in TCPInterface
170 typedef SystemAddress (TCPInterface::*StatusCheckFunction)(void);
171 bool InList(StatusCheckFunction func);
172 */
173
174 };
175
176 } // namespace SLNet
177
178 #endif
179
180 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetRandomSync
SLNet::RakNetRandomSync Member List

This is the complete list of members for SLNet::RakNetRandomSync, including all inherited members.

callCount | SLNet::RakNetRandomSync | protected
Deserialize(SLNet::BitStream *outputBitstream) | SLNet::RakNetRandomSync | virtual
DeserializeConstruction(SLNet::BitStream *constructionBitstream) | SLNet::RakNetRandomSync | virtual
FrandomMT(void) | SLNet::RakNetRandomSync |
GetCallCount(void) const | SLNet::RakNetRandomSync |
GetSeed(void) const | SLNet::RakNetRandomSync |
RakNetRandomSync() | SLNet::RakNetRandomSync |
RandomMT(void) | SLNet::RakNetRandomSync |
rnr | SLNet::RakNetRandomSync | protected
seed | SLNet::RakNetRandomSync | protected
SeedMT(uint32_t _seed) | SLNet::RakNetRandomSync |
SeedMT(uint32_t _seed, uint32_t skipValues) | SLNet::RakNetRandomSync |
Serialize(SLNet::BitStream *outputBitstream) | SLNet::RakNetRandomSync | virtual
SerializeConstruction(SLNet::BitStream *constructionBitstream) | SLNet::RakNetRandomSync | virtual
SetCallCount(uint32_t i) | SLNet::RakNetRandomSync |
Skip(uint32_t count) | SLNet::RakNetRandomSync | protected
usedValueBufferCount | SLNet::RakNetRandomSync | protected
usedValues | SLNet::RakNetRandomSync | protected
~RakNetRandomSync() | SLNet::RakNetRandomSync | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SendToThread.h Source File

  • include
  • slikenet
SendToThread.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __SENDTO_THREAD
17 #define __SENDTO_THREAD
18
19 #include "defines.h"
20
21 #ifdef USE_THREADED_SEND
22
23 #include "InternalPacket.h"
24 #include "SocketLayer.h"
25 #include "DS_ThreadsafeAllocatingQueue.h"
26 #include "ThreadPool.h"
27
28 namespace SLNet
29 {
30 class SendToThread
31 {
32 public:
33 SendToThread();
34 ~SendToThread();
35
36 struct SendToThreadBlock
37 {
38 SOCKET s;
39 SystemAddress systemAddress;
40 unsigned short remotePortRakNetWasStartedOn_PS3;
41 unsigned int extraSocketOptions;
42 char data[MAXIMUM_MTU_SIZE];
43 unsigned short dataWriteOffset;
44 };
45
46 static SendToThreadBlock* AllocateBlock(void);
47 static void ProcessBlock(SendToThreadBlock* threadedSend);
48
49 static void AddRef(void);
50 static void Deref(void);
51 static DataStructures::ThreadsafeAllocatingQueue<SendToThreadBlock> objectQueue;
52 protected:
53 static int refCount;
54 static ThreadPool<SendToThreadBlock*,SendToThreadBlock*> threadPool;
55
56 };
57 }
58
59
60 #endif
61
62 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
WSAStartupSingleton Member List

This is the complete list of members for WSAStartupSingleton, including all inherited members.

AddRef(void) | WSAStartupSingleton | static
Deref(void) | WSAStartupSingleton | static
refCount | WSAStartupSingleton | protectedstatic
WSAStartupSingleton() | WSAStartupSingleton |
~WSAStartupSingleton() | WSAStartupSingleton |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/GridSectorizer.cpp Source File

  • src
GridSectorizer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/assert.h"
17 #include "slikenet/GridSectorizer.h"
18 //#include <stdlib.h>
19 #include <math.h>
20
21 GridSectorizer::GridSectorizer()
22 {
23 grid=0;
24 }
25 GridSectorizer::~GridSectorizer()
26 {
27 if (grid)
28 SLNet::OP_DELETE_ARRAY(grid, _FILE_AND_LINE_);
29 }
30 void GridSectorizer::Init(const float _maxCellWidth, const float _maxCellHeight, const float minX, const float minY, const float maxX, const float maxY)
31 {
32 RakAssert(_maxCellWidth > 0.0f && _maxCellHeight > 0.0f);
33 if (grid)
34 SLNet::OP_DELETE_ARRAY(grid, _FILE_AND_LINE_);
35
36 cellOriginX=minX;
37 cellOriginY=minY;
38 gridWidth=maxX-minX;
39 gridHeight=maxY-minY;
40 gridCellWidthCount=(int) ceil(gridWidth/_maxCellWidth);
41 gridCellHeightCount=(int) ceil(gridHeight/_maxCellHeight);
42 // Make the cells slightly smaller, so we allocate an extra unneeded cell if on the edge. This way we don't go outside the array on rounding errors.
43 cellWidth=gridWidth/gridCellWidthCount;
44 cellHeight=gridHeight/gridCellHeightCount;
45 invCellWidth = 1.0f / cellWidth;
46 invCellHeight = 1.0f / cellHeight;
47
48 #ifdef _USE_ORDERED_LIST
49 grid = SLNet::OP_NEW<DataStructures::OrderedList<void*, void*>>(gridCellWidthCount*gridCellHeightCount, _FILE_AND_LINE_ );
50 DataStructures::OrderedList<void*,void*>::IMPLEMENT_DEFAULT_COMPARISON();
51 #else
52 grid = SLNet::OP_NEW_ARRAY<DataStructures::List<void*> >(gridCellWidthCount*gridCellHeightCount, _FILE_AND_LINE_ );
53 #endif
54 }
55 void GridSectorizer::AddEntry(void *entry, const float minX, const float minY, const float maxX, const float maxY)
56 {
57 RakAssert(cellWidth>0.0f);
58 RakAssert(minX < maxX && minY < maxY);
59
60 int xStart, yStart, xEnd, yEnd, xCur, yCur;
61 xStart=WorldToCellXOffsetAndClamped(minX);
62 yStart=WorldToCellYOffsetAndClamped(minY);
63 xEnd=WorldToCellXOffsetAndClamped(maxX);
64 yEnd=WorldToCellYOffsetAndClamped(maxY);
65
66 for (xCur=xStart; xCur <= xEnd; ++xCur)
67 {
68 for (yCur=yStart; yCur <= yEnd; ++yCur)
69 {
70 #ifdef _USE_ORDERED_LIST
71 grid[yCur*gridCellWidthCount+xCur].Insert(entry,entry, true);
72 #else
73 grid[yCur*gridCellWidthCount+xCur].Insert(entry, _FILE_AND_LINE_);
74 #endif
75 }
76 }
77 }
78 #ifdef _USE_ORDERED_LIST
79 void GridSectorizer::RemoveEntry(void *entry, const float minX, const float minY, const float maxX, const float maxY)
80 {
81 RakAssert(cellWidth>0.0f);
82 RakAssert(minX <= maxX && minY <= maxY);
83
84 int xStart, yStart, xEnd, yEnd, xCur, yCur;
85 xStart=WorldToCellXOffsetAndClamped(minX);
86 yStart=WorldToCellYOffsetAndClamped(minY);
87 xEnd=WorldToCellXOffsetAndClamped(maxX);
88 yEnd=WorldToCellYOffsetAndClamped(maxY);
89
90 for (xCur=xStart; xCur <= xEnd; ++xCur)
91 {
92 for (yCur=yStart; yCur <= yEnd; ++yCur)
93 {
94 grid[yCur*gridCellWidthCount+xCur].RemoveIfExists(entry);
95 }
96 }
97 }
98 void GridSectorizer::MoveEntry(void *entry, const float sourceMinX, const float sourceMinY, const float sourceMaxX, const float sourceMaxY,
99 const float destMinX, const float destMinY, const float destMaxX, const float destMaxY)
100 {
101 RakAssert(cellWidth>0.0f);
102 RakAssert(sourceMinX < sourceMaxX && sourceMinY < sourceMaxY);
103 RakAssert(destMinX < destMaxX && destMinY < destMaxY);
104
105 if (PositionCrossesCells(sourceMinX, sourceMinY, destMinX, destMinY)==false &&
106 PositionCrossesCells(destMinX, destMinY, destMinX, destMinY)==false)
107 return;
108
109 int xStartSource, yStartSource, xEndSource, yEndSource;
110 int xStartDest, yStartDest, xEndDest, yEndDest;
111 int xCur, yCur;
112 xStartSource=WorldToCellXOffsetAndClamped(sourceMinX);
113 yStartSource=WorldToCellYOffsetAndClamped(sourceMinY);
114 xEndSource=WorldToCellXOffsetAndClamped(sourceMaxX);
115 yEndSource=WorldToCellYOffsetAndClamped(sourceMaxY);
116
117 xStartDest=WorldToCellXOffsetAndClamped(destMinX);
118 yStartDest=WorldToCellYOffsetAndClamped(destMinY);
119 xEndDest=WorldToCellXOffsetAndClamped(destMaxX);
120 yEndDest=WorldToCellYOffsetAndClamped(destMaxY);
121
122 // Remove source that is not in dest
123 for (xCur=xStartSource; xCur <= xEndSource; ++xCur)
124 {
125 for (yCur=yStartSource; yCur <= yEndSource; ++yCur)
126 {
127 if (xCur < xStartDest || xCur > xEndDest ||
128 yCur < yStartDest || yCur > yEndDest)
129 {
130 grid[yCur*gridCellWidthCount+xCur].RemoveIfExists(entry);
131 }
132 }
133 }
134
135 // Add dest that is not in source
136 for (xCur=xStartDest; xCur <= xEndDest; ++xCur)
137 {
138 for (yCur=yStartDest; yCur <= yEndDest; ++yCur)
139 {
140 if (xCur < xStartSource || xCur > xEndSource ||
141 yCur < yStartSource || yCur > yEndSource)
142 {
143 grid[yCur*gridCellWidthCount+xCur].Insert(entry,entry, true);
144 }
145 }
146 }
147 }
148 #endif
149 void GridSectorizer::GetEntries(DataStructures::List<void*>& intersectionList, const float minX, const float minY, const float maxX, const float maxY)
150 {
151 #ifdef _USE_ORDERED_LIST
152 DataStructures::OrderedList<void*, void*>* cell;
153 #else
154 DataStructures::List<void*>* cell;
155 #endif
156 int xStart, yStart, xEnd, yEnd, xCur, yCur;
157 unsigned index;
158 xStart=WorldToCellXOffsetAndClamped(minX);
159 yStart=WorldToCellYOffsetAndClamped(minY);
160 xEnd=WorldToCellXOffsetAndClamped(maxX);
161 yEnd=WorldToCellYOffsetAndClamped(maxY);
162
163 intersectionList.Clear(true, _FILE_AND_LINE_);
164 for (xCur=xStart; xCur <= xEnd; ++xCur)
165 {
166 for (yCur=yStart; yCur <= yEnd; ++yCur)
167 {
168 cell = grid+yCur*gridCellWidthCount+xCur;
169 for (index=0; index < cell->Size(); ++index)
170 intersectionList.Insert(cell->operator [](index), _FILE_AND_LINE_);
171 }
172 }
173 }
174 bool GridSectorizer::PositionCrossesCells(const float originX, const float originY, const float destinationX, const float destinationY) const
175 {
176 return originX/cellWidth!=destinationX/cellWidth || originY/cellHeight!=destinationY/cellHeight;
177 }
178 int GridSectorizer::WorldToCellX(const float input) const
179 {
180 return (int)((input-cellOriginX)*invCellWidth);
181 }
182 int GridSectorizer::WorldToCellY(const float input) const
183 {
184 return (int)((input-cellOriginY)*invCellHeight);
185 }
186 int GridSectorizer::WorldToCellXOffsetAndClamped(const float input) const
187 {
188 int cell=WorldToCellX(input);
189 cell = cell > 0 ? cell : 0; // __max(cell,0);
190 cell = gridCellWidthCount-1 < cell ? gridCellWidthCount-1 : cell; // __min(gridCellWidthCount-1, cell);
191 return cell;
192 }
193 int GridSectorizer::WorldToCellYOffsetAndClamped(const float input) const
194 {
195 int cell=WorldToCellY(input);
196 cell = cell > 0 ? cell : 0; // __max(cell,0);
197 cell = gridCellHeightCount-1 < cell ? gridCellHeightCount-1 : cell; // __min(gridCellHeightCount-1, cell);
198 return cell;
199 }
200 void GridSectorizer::Clear(void)
201 {
202 int cur;
203 int count = gridCellWidthCount*gridCellHeightCount;
204 for (cur=0; cur<count;cur++)
205 grid[cur].Clear(true, _FILE_AND_LINE_);
206 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/UDPProxyClient.cpp Source File

  • src
UDPProxyClient.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_UDPProxyClient==1
18
19 #include "slikenet/UDPProxyClient.h"
20 #include "slikenet/BitStream.h"
21 #include "slikenet/UDPProxyCommon.h"
22 #include "slikenet/peerinterface.h"
23 #include "slikenet/MessageIdentifiers.h"
24 #include "slikenet/GetTime.h"
25
26 using namespace SLNet;
27 static const int DEFAULT_UNRESPONSIVE_PING_TIME_COORDINATOR=1000;
28
29 // bool operator<( const DataStructures::MLKeyRef<UDPProxyClient::ServerWithPing> &inputKey, const UDPProxyClient::ServerWithPing &cls ) {return inputKey.Get().serverAddress < cls.serverAddress;}
30 // bool operator>( const DataStructures::MLKeyRef<UDPProxyClient::ServerWithPing> &inputKey, const UDPProxyClient::ServerWithPing &cls ) {return inputKey.Get().serverAddress > cls.serverAddress;}
31 // bool operator==( const DataStructures::MLKeyRef<UDPProxyClient::ServerWithPing> &inputKey, const UDPProxyClient::ServerWithPing &cls ) {return inputKey.Get().serverAddress == cls.serverAddress;}
32
33 STATIC_FACTORY_DEFINITIONS(UDPProxyClient,UDPProxyClient);
34
35 UDPProxyClient::UDPProxyClient()
36 {
37 resultHandler=0;
38 }
39 UDPProxyClient::~UDPProxyClient()
40 {
41 Clear();
42 }
43 void UDPProxyClient::SetResultHandler(UDPProxyClientResultHandler *rh)
44 {
45 resultHandler=rh;
46 }
47 bool UDPProxyClient::RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, SLNet::TimeMS timeoutOnNoDataMS, SLNet::BitStream *serverSelectionBitstream)
48 {
49 // Return false if not connected
50 ConnectionState cs = rakPeerInterface->GetConnectionState(proxyCoordinator);
51 if (cs!=IS_CONNECTED)
52 return false;
53
54 // Pretty much a bug not to set the result handler, as otherwise you won't know if the operation succeeed or not
55 RakAssert(resultHandler!=0);
56 if (resultHandler==0)
57 return false;
58
59 BitStream outgoingBs;
60 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
61 outgoingBs.Write((MessageID)ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR);
62 outgoingBs.Write(sourceAddress);
63 outgoingBs.Write(false);
64 outgoingBs.Write(targetGuid);
65 outgoingBs.Write(timeoutOnNoDataMS);
66 if (serverSelectionBitstream && serverSelectionBitstream->GetNumberOfBitsUsed()>0)
67 {
68 outgoingBs.Write(true);
69 outgoingBs.Write(serverSelectionBitstream);
70 }
71 else
72 {
73 outgoingBs.Write(false);
74 }
75 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, proxyCoordinator, false);
76
77 return true;
78 }
79 bool UDPProxyClient::RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddressAsSeenFromCoordinator, SLNet::TimeMS timeoutOnNoDataMS, SLNet::BitStream *serverSelectionBitstream)
80 {
81 // Return false if not connected
82 ConnectionState cs = rakPeerInterface->GetConnectionState(proxyCoordinator);
83 if (cs!=IS_CONNECTED)
84 return false;
85
86 // Pretty much a bug not to set the result handler, as otherwise you won't know if the operation succeeed or not
87 RakAssert(resultHandler!=0);
88 if (resultHandler==0)
89 return false;
90
91 BitStream outgoingBs;
92 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
93 outgoingBs.Write((MessageID)ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR);
94 outgoingBs.Write(sourceAddress);
95 outgoingBs.Write(true);
96 outgoingBs.Write(targetAddressAsSeenFromCoordinator);
97 outgoingBs.Write(timeoutOnNoDataMS);
98 if (serverSelectionBitstream && serverSelectionBitstream->GetNumberOfBitsUsed()>0)
99 {
100 outgoingBs.Write(true);
101 outgoingBs.Write(serverSelectionBitstream);
102 }
103 else
104 {
105 outgoingBs.Write(false);
106 }
107 rakPeerInterface->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, proxyCoordinator, false);
108
109 return true;
110 }
111 void UDPProxyClient::Update(void)
112 {
113 unsigned int idx1=0;
114 while (idx1 < pingServerGroups.Size())
115 {
116 PingServerGroup *psg = pingServerGroups[idx1];
117
118 if (psg->serversToPing.Size() > 0 &&
119 SLNet::GetTimeMS() > psg->startPingTime+DEFAULT_UNRESPONSIVE_PING_TIME_COORDINATOR)
120 {
121 // If they didn't reply within DEFAULT_UNRESPONSIVE_PING_TIME_COORDINATOR, just give up on them
122 psg->SendPingedServersToCoordinator(rakPeerInterface);
123
124 SLNet::OP_DELETE(psg,_FILE_AND_LINE_);
125 pingServerGroups.RemoveAtIndex(idx1);
126 }
127 else
128 idx1++;
129 }
130
131 }
132 PluginReceiveResult UDPProxyClient::OnReceive(Packet *packet)
133 {
134 if (packet->data[0]==ID_UNCONNECTED_PONG)
135 {
136 unsigned int idx1, idx2;
137 PingServerGroup *psg;
138 for (idx1=0; idx1 < pingServerGroups.Size(); idx1++)
139 {
140 psg = pingServerGroups[idx1];
141 for (idx2=0; idx2 < psg->serversToPing.Size(); idx2++)
142 {
143 if (psg->serversToPing[idx2].serverAddress==packet->systemAddress)
144 {
145 SLNet::BitStream bsIn(packet->data,packet->length,false);
146 bsIn.IgnoreBytes(sizeof(MessageID));
147 SLNet::TimeMS sentTime;
148 bsIn.Read(sentTime);
149 SLNet::TimeMS curTime = SLNet::GetTimeMS();
150 int ping;
151 if (curTime>sentTime)
152 ping=(int) (curTime-sentTime);
153 else
154 ping=0;
155 psg->serversToPing[idx2].ping=(unsigned short) ping;
156
157 // If all servers to ping are now pinged, reply to coordinator
158 if (psg->AreAllServersPinged())
159 {
160 psg->SendPingedServersToCoordinator(rakPeerInterface);
161 SLNet::OP_DELETE(psg,_FILE_AND_LINE_);
162 pingServerGroups.RemoveAtIndex(idx1);
163 }
164
165 return RR_STOP_PROCESSING_AND_DEALLOCATE;
166 }
167 }
168
169 }
170 }
171 else if (packet->data[0]==ID_UDP_PROXY_GENERAL && packet->length>1)
172 {
173 switch (packet->data[1])
174 {
175 case ID_UDP_PROXY_PING_SERVERS_FROM_COORDINATOR_TO_CLIENT:
176 {
177 OnPingServers(packet);
178 }
179 break;
180 case ID_UDP_PROXY_FORWARDING_SUCCEEDED:
181 case ID_UDP_PROXY_ALL_SERVERS_BUSY:
182 case ID_UDP_PROXY_IN_PROGRESS:
183 case ID_UDP_PROXY_NO_SERVERS_ONLINE:
184 case ID_UDP_PROXY_RECIPIENT_GUID_NOT_CONNECTED_TO_COORDINATOR:
185 case ID_UDP_PROXY_FORWARDING_NOTIFICATION:
186 {
187 RakNetGUID targetGuid;
188 SystemAddress senderAddress, targetAddress;
189 SLNet::BitStream incomingBs(packet->data, packet->length, false);
190 incomingBs.IgnoreBytes(sizeof(MessageID)*2);
191 incomingBs.Read(senderAddress);
192 incomingBs.Read(targetAddress);
193 incomingBs.Read(targetGuid);
194
195 switch (packet->data[1])
196 {
197 case ID_UDP_PROXY_FORWARDING_NOTIFICATION:
198 case ID_UDP_PROXY_FORWARDING_SUCCEEDED:
199 case ID_UDP_PROXY_IN_PROGRESS:
200 {
201 unsigned short forwardingPort;
202 SLNet::RakString serverIP;
203 incomingBs.Read(serverIP);
204 incomingBs.Read(forwardingPort);
205 if (packet->data[1]==ID_UDP_PROXY_FORWARDING_SUCCEEDED)
206 {
207 if (resultHandler)
208 resultHandler->OnForwardingSuccess(serverIP.C_String(), forwardingPort, packet->systemAddress, senderAddress, targetAddress, targetGuid, this);
209 }
210 else if (packet->data[1]==ID_UDP_PROXY_IN_PROGRESS)
211 {
212 if (resultHandler)
213 resultHandler->OnForwardingInProgress(serverIP.C_String(), forwardingPort, packet->systemAddress, senderAddress, targetAddress, targetGuid, this);
214 }
215 else
216 {
217 // Send a datagram to the proxy, so if we are behind a router, that router adds an entry to the routing table.
218 // Otherwise the router would block the incoming datagrams from source
219 // It doesn't matter if the message actually arrives as long as it goes through the router
220 rakPeerInterface->Ping(serverIP.C_String(), forwardingPort, false);
221
222 if (resultHandler)
223 resultHandler->OnForwardingNotification(serverIP.C_String(), forwardingPort, packet->systemAddress, senderAddress, targetAddress, targetGuid, this);
224 }
225 }
226 break;
227 case ID_UDP_PROXY_ALL_SERVERS_BUSY:
228 if (resultHandler)
229 resultHandler->OnAllServersBusy(packet->systemAddress, senderAddress, targetAddress, targetGuid, this);
230 break;
231 case ID_UDP_PROXY_NO_SERVERS_ONLINE:
232 if (resultHandler)
233 resultHandler->OnNoServersOnline(packet->systemAddress, senderAddress, targetAddress, targetGuid, this);
234 break;
235 case ID_UDP_PROXY_RECIPIENT_GUID_NOT_CONNECTED_TO_COORDINATOR:
236 {
237 if (resultHandler)
238 resultHandler->OnRecipientNotConnected(packet->systemAddress, senderAddress, targetAddress, targetGuid, this);
239 break;
240 }
241 }
242
243 }
244 return RR_STOP_PROCESSING_AND_DEALLOCATE;
245 }
246 }
247 return RR_CONTINUE_PROCESSING;
248 }
249 void UDPProxyClient::OnRakPeerShutdown(void)
250 {
251 Clear();
252 }
253 void UDPProxyClient::OnPingServers(Packet *packet)
254 {
255 SLNet::BitStream incomingBs(packet->data, packet->length, false);
256 incomingBs.IgnoreBytes(2);
257
258 PingServerGroup *psg = SLNet::OP_NEW<PingServerGroup>(_FILE_AND_LINE_);
259
260 ServerWithPing swp;
261 incomingBs.Read(psg->sata.senderClientAddress);
262 incomingBs.Read(psg->sata.targetClientAddress);
263 // #med - might be possible to drop - see pull request 35 - however kept as is to ensure ABI
264 // compatibility to RakNet in MaxNet 0.x - see #39
265 RakNetGUID targetGuid;
266 incomingBs.Read(targetGuid);
267 psg->startPingTime= SLNet::GetTimeMS();
268 psg->coordinatorAddressForPings=packet->systemAddress;
269 unsigned short serverListSize;
270 incomingBs.Read(serverListSize);
271 SystemAddress serverAddress;
272 unsigned short serverListIndex;
273 char ipStr[64];
274 for (serverListIndex=0; serverListIndex<serverListSize; serverListIndex++)
275 {
276 incomingBs.Read(swp.serverAddress);
277 swp.ping=DEFAULT_UNRESPONSIVE_PING_TIME_COORDINATOR;
278 psg->serversToPing.Push(swp, _FILE_AND_LINE_ );
279 swp.serverAddress.ToString(false,ipStr,static_cast<size_t>(64));
280 rakPeerInterface->Ping(ipStr,swp.serverAddress.GetPort(),false,0);
281 }
282 pingServerGroups.Push(psg,_FILE_AND_LINE_);
283 }
284
285 bool UDPProxyClient::PingServerGroup::AreAllServersPinged(void) const
286 {
287 unsigned int serversToPingIndex;
288 for (serversToPingIndex=0; serversToPingIndex < serversToPing.Size(); serversToPingIndex++)
289 {
290 if (serversToPing[serversToPingIndex].ping==DEFAULT_UNRESPONSIVE_PING_TIME_COORDINATOR)
291 return false;
292 }
293 return true;
294 }
295
296 void UDPProxyClient::PingServerGroup::SendPingedServersToCoordinator(RakPeerInterface *rakPeer)
297 {
298 BitStream outgoingBs;
299 outgoingBs.Write((MessageID)ID_UDP_PROXY_GENERAL);
300 outgoingBs.Write((MessageID)ID_UDP_PROXY_PING_SERVERS_REPLY_FROM_CLIENT_TO_COORDINATOR);
301 outgoingBs.Write(sata.senderClientAddress);
302 outgoingBs.Write(sata.targetClientAddress);
303 unsigned short serversToPingSize = (unsigned short) serversToPing.Size();
304 outgoingBs.Write(serversToPingSize);
305 unsigned int serversToPingIndex;
306 for (serversToPingIndex=0; serversToPingIndex < serversToPingSize; serversToPingIndex++)
307 {
308 outgoingBs.Write(serversToPing[serversToPingIndex].serverAddress);
309 outgoingBs.Write(serversToPing[serversToPingIndex].ping);
310 }
311 rakPeer->Send(&outgoingBs, MEDIUM_PRIORITY, RELIABLE_ORDERED, 0, coordinatorAddressForPings, false);
312 }
313 void UDPProxyClient::Clear(void)
314 {
315 for (unsigned int i=0; i < pingServerGroups.Size(); i++)
316 SLNet::OP_DELETE(pingServerGroups[i],_FILE_AND_LINE_);
317 pingServerGroups.Clear(false, _FILE_AND_LINE_);
318 }
319
320
321 #endif // _RAKNET_SUPPORT_*
322
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RNS2EventHandler
SLNet::RNS2EventHandler Member List

This is the complete list of members for SLNet::RNS2EventHandler, including all inherited members.

AllocRNS2RecvStruct(const char *file, unsigned int line)=0 | SLNet::RNS2EventHandler | pure virtual
DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line)=0 | SLNet::RNS2EventHandler | pure virtual
OnRNS2Recv(RNS2RecvStruct *recvStruct)=0 | SLNet::RNS2EventHandler | pure virtual
RNS2EventHandler() | SLNet::RNS2EventHandler | inline
~RNS2EventHandler() | SLNet::RNS2EventHandler | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/LocklessTypes.cpp Source File

  • src
LocklessTypes.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/LocklessTypes.h"
17
18 using namespace SLNet;
19
20 LocklessUint32_t::LocklessUint32_t()
21 {
22 value=0;
23 }
24 LocklessUint32_t::LocklessUint32_t(uint32_t initial)
25 {
26 value=initial;
27 }
28 uint32_t LocklessUint32_t::Increment(void)
29 {
30 #ifdef _WIN32
31 return (uint32_t) InterlockedIncrement(&value);
32 #elif defined(ANDROID) || defined(__S3E__) || defined(__APPLE__)
33 uint32_t v;
34 mutex.Lock();
35 ++value;
36 v=value;
37 mutex.Unlock();
38 return v;
39 #else
40 return __sync_fetch_and_add (&value, (uint32_t) 1);
41 #endif
42 }
43 uint32_t LocklessUint32_t::Decrement(void)
44 {
45 #ifdef _WIN32
46 return (uint32_t) InterlockedDecrement(&value);
47 #elif defined(ANDROID) || defined(__S3E__) || defined(__APPLE__)
48 uint32_t v;
49 mutex.Lock();
50 --value;
51 v=value;
52 mutex.Unlock();
53 return v;
54 #else
55 return __sync_fetch_and_add (&value, (uint32_t) -1);
56 #endif
57 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Rackspace.cpp Source File

  • src
Rackspace.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_Rackspace==1 && _RAKNET_SUPPORT_TCPInterface==1
18
19 #include "slikenet/Rackspace.h"
20 #include "slikenet/string.h"
21 #include "slikenet/TCPInterface.h"
22
23 using namespace SLNet;
24
25 Rackspace::Rackspace()
26 {
27 tcpInterface=0;
28 }
29
30 Rackspace::~Rackspace()
31 {
32
33 }
34
35 void Rackspace::AddEventCallback(Rackspace2EventCallback *callback)
36 {
37 unsigned int idx = eventCallbacks.GetIndexOf(callback);
38 if (idx == (unsigned int)-1)
39 eventCallbacks.Push(callback,_FILE_AND_LINE_);
40 }
41 void Rackspace::RemoveEventCallback(Rackspace2EventCallback *callback)
42 {
43 unsigned int idx = eventCallbacks.GetIndexOf(callback);
44 if (idx != (unsigned int)-1)
45 eventCallbacks.RemoveAtIndex(idx);
46 }
47 void Rackspace::ClearEventCallbacks(void)
48 {
49 eventCallbacks.Clear(true, _FILE_AND_LINE_);
50 }
51 SystemAddress Rackspace::Authenticate(TCPInterface *_tcpInterface, const char *_authenticationURL, const char *_rackspaceCloudUsername, const char *_apiAccessKey)
52 {
53 unsigned int index = GetOperationOfTypeIndex(RO_CONNECT_AND_AUTHENTICATE);
54 if (index!=(unsigned int)-1)
55 {
56 // In progress
57 return operations[index].connectionAddress;
58 }
59
60 tcpInterface=_tcpInterface;
61
62 rackspaceCloudUsername=_rackspaceCloudUsername;
63 apiAccessKey=_apiAccessKey;
64
65 unsigned int i;
66
67 RackspaceOperation ro;
68 ro.type=RO_CONNECT_AND_AUTHENTICATE;
69 ro.isPendingAuthentication=false;
70
71 RakAssert(tcpInterface->WasStarted());
72 ro.connectionAddress=tcpInterface->Connect(_authenticationURL,443,true);
73 if (ro.connectionAddress==UNASSIGNED_SYSTEM_ADDRESS)
74 {
75 for (i=0; i < eventCallbacks.Size(); i++)
76 eventCallbacks[i]->OnConnectionAttemptFailure(RO_CONNECT_AND_AUTHENTICATE, _authenticationURL);
77
78 return UNASSIGNED_SYSTEM_ADDRESS;
79 }
80
81 #if OPEN_SSL_CLIENT_SUPPORT==1
82 tcpInterface->StartSSLClient(ro.connectionAddress);
83 #endif
84
85 SLNet::RakString command(
86 "GET /v1.0 HTTP/1.1\n"
87 "Host: %s\n"
88 "X-Auth-User: %s\n"
89 "X-Auth-Key: %s\n\n"
90 ,_authenticationURL, _rackspaceCloudUsername, _apiAccessKey);
91 tcpInterface->Send(command.C_String(), (unsigned int) command.GetLength(), ro.connectionAddress, false);
92
93 operations.Insert(ro,_FILE_AND_LINE_);
94 return ro.connectionAddress;
95 }
96
97 const char * Rackspace::EventTypeToString(RackspaceEventType eventType)
98 {
99 switch (eventType)
100 {
101 case RET_Success_200:
102 return "Success_200";
103 case RET_Success_201:
104 return "Success_201";
105 case RET_Success_202:
106 return "Success_202";
107 case RET_Success_203:
108 return "Success_203";
109 case RET_Success_204:
110 return "Success_204";
111 case RET_Cloud_Servers_Fault_500:
112 return "Cloud_Servers_Fault_500";
113 case RET_Service_Unavailable_503:
114 return "Service_Unavailable_503";
115 case RET_Unauthorized_401:
116 return "Unauthorized_401";
117 case RET_Bad_Request_400:
118 return "Bad_Request_400";
119 case RET_Over_Limit_413:
120 return "Over_Limit_413";
121 case RET_Bad_Media_Type_415:
122 return "Bad_Media_Type_415";
123 case RET_Item_Not_Found_404:
124 return "Item_Not_Found_404";
125 case RET_Build_In_Progress_409:
126 return "Build_In_Progress_409";
127 case RET_Resize_Not_Allowed_403:
128 return "Resize_Not_Allowed_403";
129 case RET_Connection_Closed_Without_Reponse:
130 return "Connection_Closed_Without_Reponse";
131 case RET_Unknown_Failure:
132 return "Unknown_Failure";
133 }
134 return "Unknown event type (bug)";
135 }
136 void Rackspace::AddOperation(RackspaceOperationType type, SLNet::RakString httpCommand, SLNet::RakString operation, SLNet::RakString xml)
137 {
138 RackspaceOperation ro;
139 ro.type=type;
140 ro.httpCommand=httpCommand;
141 ro.operation=operation;
142 ro.xml=xml;
143 ro.isPendingAuthentication=HasOperationOfType(RO_CONNECT_AND_AUTHENTICATE);
144 if (ro.isPendingAuthentication==false)
145 {
146 if (ExecuteOperation(ro))
147 operations.Insert(ro,_FILE_AND_LINE_);
148 }
149 else
150 operations.Insert(ro,_FILE_AND_LINE_);
151 }
152 void Rackspace::ListServers(void)
153 {
154 AddOperation(RO_LIST_SERVERS, "GET", "servers", "");
155 }
156 void Rackspace::ListServersWithDetails(void)
157 {
158 AddOperation(RO_LIST_SERVERS_WITH_DETAILS, "GET", "servers/detail", "");
159 }
160 void Rackspace::CreateServer(SLNet::RakString name, SLNet::RakString imageId, SLNet::RakString flavorId)
161 {
162 SLNet::RakString xml(
163 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
164 "<server xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"%s\" imageId=\"%s\" flavorId=\"%s\">"
165 "</server>"
166 ,name.C_String() ,imageId.C_String(), flavorId.C_String());
167 AddOperation(RO_CREATE_SERVER, "POST", "servers", xml);
168 }
169 void Rackspace::GetServerDetails(SLNet::RakString serverId)
170 {
171 AddOperation(RO_GET_SERVER_DETAILS, "GET", SLNet::RakString("servers/%s", serverId.C_String()), "");
172 }
173 void Rackspace::UpdateServerNameOrPassword(SLNet::RakString serverId, SLNet::RakString newName, SLNet::RakString newPassword)
174 {
175 if (newName.IsEmpty() && newPassword.IsEmpty())
176 return;
177 SLNet::RakString xml(
178 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
179 "<server xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\""
180 );
181 if (newName.IsEmpty()==false)
182 xml += SLNet::RakString(" name=\"%s\"", newName.C_String());
183 if (newPassword.IsEmpty()==false)
184 xml += SLNet::RakString(" adminPass=\"%s\"", newPassword.C_String());
185 xml += " />";
186 AddOperation(RO_UPDATE_SERVER_NAME_OR_PASSWORD, "PUT", SLNet::RakString("servers/%s", serverId.C_String()), xml);
187 }
188 void Rackspace::DeleteServer(SLNet::RakString serverId)
189 {
190 AddOperation(RO_DELETE_SERVER, "DELETE", SLNet::RakString("servers/%s", serverId.C_String()), "");
191 }
192 void Rackspace::ListServerAddresses(SLNet::RakString serverId)
193 {
194 AddOperation(RO_LIST_SERVER_ADDRESSES, "GET", SLNet::RakString("servers/%s/ips", serverId.C_String()), "");
195 }
196 void Rackspace::ShareServerAddress(SLNet::RakString serverId, SLNet::RakString ipAddress)
197 {
198 AddOperation(RO_SHARE_SERVER_ADDRESS, "PUT", SLNet::RakString("servers/%s/ips/public/%s", serverId.C_String(), ipAddress.C_String()), "");
199 }
200 void Rackspace::DeleteServerAddress(SLNet::RakString serverId, SLNet::RakString ipAddress)
201 {
202 AddOperation(RO_DELETE_SERVER_ADDRESS, "DELETE", SLNet::RakString("servers/%s/ips/public/%s", serverId.C_String(), ipAddress.C_String()), "");
203 }
204 void Rackspace::RebootServer(SLNet::RakString serverId, SLNet::RakString rebootType)
205 {
206 SLNet::RakString xml(
207 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
208 "<reboot xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" type=\"%s\""
209 "/>",
210 rebootType.C_String());
211
212 AddOperation(RO_REBOOT_SERVER, "POST", SLNet::RakString("servers/%s/action", serverId.C_String()), xml);
213 }
214 void Rackspace::RebuildServer(SLNet::RakString serverId, SLNet::RakString imageId)
215 {
216 SLNet::RakString xml(
217 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
218 "<rebuild xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" imageId=\"%s\""
219 "/>",
220 imageId.C_String());
221
222 AddOperation(RO_REBUILD_SERVER, "POST", SLNet::RakString("servers/%s/action", serverId.C_String()), xml);
223 }
224 void Rackspace::ResizeServer(SLNet::RakString serverId, SLNet::RakString flavorId)
225 {
226 SLNet::RakString xml(
227 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
228 "<resize xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" flavorId=\"%s\""
229 "/>",
230 flavorId.C_String());
231
232 AddOperation(RO_RESIZE_SERVER, "POST", SLNet::RakString("servers/%s/action", serverId.C_String()), xml);
233 }
234 void Rackspace::ConfirmResizedServer(SLNet::RakString serverId)
235 {
236 SLNet::RakString xml(
237 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
238 "<confirmResize xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" "
239 "/>");
240 AddOperation(RO_CONFIRM_RESIZED_SERVER, "POST", SLNet::RakString("servers/%s/action", serverId.C_String()), xml);
241 }
242 void Rackspace::RevertResizedServer(SLNet::RakString serverId)
243 {
244 SLNet::RakString xml(
245 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
246 "<revertResize xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" "
247 "/>");
248 AddOperation(RO_REVERT_RESIZED_SERVER, "POST", SLNet::RakString("servers/%s/action", serverId.C_String()), xml);
249 }
250 void Rackspace::ListFlavors(void)
251 {
252 AddOperation(RO_LIST_FLAVORS, "GET", "flavors", "");
253 }
254 void Rackspace::GetFlavorDetails(SLNet::RakString flavorId)
255 {
256 AddOperation(RO_GET_FLAVOR_DETAILS, "GET", SLNet::RakString("flavors/%s", flavorId.C_String()), "");
257 }
258 void Rackspace::ListImages(void)
259 {
260 AddOperation(RO_LIST_IMAGES, "GET", "images", "");
261 }
262 void Rackspace::CreateImage(SLNet::RakString serverId, SLNet::RakString imageName)
263 {
264 SLNet::RakString xml(
265 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
266 "<image xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"%s\" serverId=\"%s\""
267 "/>",
268 imageName.C_String(),serverId.C_String());
269
270 AddOperation(RO_CREATE_IMAGE, "POST", "images", xml);
271 }
272 void Rackspace::GetImageDetails(SLNet::RakString imageId)
273 {
274 AddOperation(RO_GET_IMAGE_DETAILS, "GET", SLNet::RakString("images/%s", imageId.C_String()), "");
275 }
276 void Rackspace::DeleteImage(SLNet::RakString imageId)
277 {
278 AddOperation(RO_DELETE_IMAGE, "DELETE", SLNet::RakString("images/%s", imageId.C_String()), "");
279 }
280 void Rackspace::ListSharedIPGroups(void)
281 {
282 AddOperation(RO_LIST_SHARED_IP_GROUPS, "GET", "shared_ip_groups", "");
283 }
284 void Rackspace::ListSharedIPGroupsWithDetails(void)
285 {
286 AddOperation(RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS, "GET", "shared_ip_groups/detail", "");
287 }
288 void Rackspace::CreateSharedIPGroup(SLNet::RakString name, SLNet::RakString optionalServerId)
289 {
290 SLNet::RakString xml(
291 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
292 "<sharedIpGroup xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"%s\">", name.C_String());
293 if (optionalServerId.IsEmpty()==false)
294 xml+= SLNet::RakString("<server id=\"%s\"/>", optionalServerId.C_String());
295 xml+="</sharedIpGroup>";
296
297 AddOperation(RO_CREATE_SHARED_IP_GROUP, "POST", "shared_ip_groups", xml);
298 }
299 void Rackspace::GetSharedIPGroupDetails(SLNet::RakString groupId)
300 {
301 AddOperation(RO_GET_SHARED_IP_GROUP_DETAILS, "GET", SLNet::RakString("shared_ip_groups/%s", groupId.C_String()), "");
302 }
303 void Rackspace::DeleteSharedIPGroup(SLNet::RakString groupId)
304 {
305 AddOperation(RO_DELETE_SHARED_IP_GROUP, "DELETE", SLNet::RakString("shared_ip_groups/%s", groupId.C_String()), "");
306 }
307 void Rackspace::OnClosedConnection(SystemAddress systemAddress)
308 {
309 if (systemAddress==UNASSIGNED_SYSTEM_ADDRESS)
310 return;
311
312 unsigned int i, operationsIndex;
313 operationsIndex=0;
314 while (operationsIndex < operations.Size())
315 {
316 if (operations[operationsIndex].isPendingAuthentication==false && operations[operationsIndex].connectionAddress==systemAddress)
317 {
318 RackspaceOperation ro = operations[operationsIndex];
319 operations.RemoveAtIndex(operationsIndex);
320
321 SLNet::RakString packetDataString = ro.incomingStream;
322 const char *packetData = packetDataString.C_String();
323
324 char resultCodeStr[32];
325 int resultCodeInt;
326
327 RackspaceEventType rackspaceEventType;
328 char *result;
329 result=strstr((char*) packetData, "HTTP/1.1 ");
330 if (result!=0)
331 {
332 result+=strlen("HTTP/1.1 ");
333 for (i=0; i < sizeof(resultCodeStr)-1 && result[i] && result[i]>='0' && result[i]<='9'; i++)
334 resultCodeStr[i]=result[i];
335 resultCodeStr[i]=0;
336 resultCodeInt=atoi(resultCodeStr);
337
338 switch (resultCodeInt)
339 {
340 case 200: rackspaceEventType=RET_Success_200; break;
341 case 201: rackspaceEventType=RET_Success_201; break;
342 case 202: rackspaceEventType=RET_Success_202; break;
343 case 203: rackspaceEventType=RET_Success_203; break;
344 case 204: rackspaceEventType=RET_Success_204; break;
345 case 500: rackspaceEventType=RET_Cloud_Servers_Fault_500; break;
346 case 503: rackspaceEventType=RET_Service_Unavailable_503; break;
347 case 401: rackspaceEventType=RET_Unauthorized_401; break;
348 case 400: rackspaceEventType=RET_Bad_Request_400; break;
349 case 413: rackspaceEventType=RET_Over_Limit_413; break;
350 case 415: rackspaceEventType=RET_Bad_Media_Type_415; break;
351 case 404: rackspaceEventType=RET_Item_Not_Found_404; break;
352 case 409: rackspaceEventType=RET_Build_In_Progress_409; break;
353 case 403: rackspaceEventType=RET_Resize_Not_Allowed_403; break;
354 default: rackspaceEventType=RET_Unknown_Failure; break;
355 }
356 }
357 else
358 {
359 rackspaceEventType=RET_Connection_Closed_Without_Reponse;
360 }
361
362 switch (ro.type)
363 {
364 case RO_CONNECT_AND_AUTHENTICATE:
365 {
366 if (rackspaceEventType==RET_Success_204)
367 {
368 SLNet::RakString header;
369 ReadLine(packetData, "X-Server-Management-Url: ", serverManagementURL);
370 serverManagementURL.SplitURI(header, serverManagementDomain, serverManagementPath);
371 ReadLine(packetData, "X-Storage-Url: ", storageURL);
372 storageURL.SplitURI(header, storageDomain, storagePath);
373 ReadLine(packetData, "X-CDN-Management-Url: ", cdnManagementURL);
374 cdnManagementURL.SplitURI(header, cdnManagementDomain, cdnManagementPath);
375 ReadLine(packetData, "X-Auth-Token: ", authToken);
376 ReadLine(packetData, "X-Storage-Token: ", storageToken);
377
378 operationsIndex=0;
379 while (operationsIndex < operations.Size())
380 {
381 if (operations[operationsIndex].isPendingAuthentication==true)
382 {
383 operations[operationsIndex].isPendingAuthentication=false;
384 if (ExecuteOperation(operations[operationsIndex])==false)
385 {
386 operations.RemoveAtIndex(operationsIndex);
387 }
388 else
389 operationsIndex++;
390 }
391 else
392 operationsIndex++;
393 }
394
395 // Restart in list
396 operationsIndex=0;
397 }
398
399 for (i=0; i < eventCallbacks.Size(); i++)
400 eventCallbacks[i]->OnAuthenticationResult(rackspaceEventType, (const char*) packetData);
401
402 break;
403 }
404 case RO_LIST_SERVERS:
405 {
406 for (i=0; i < eventCallbacks.Size(); i++)
407 eventCallbacks[i]->OnListServersResult(rackspaceEventType, (const char*) packetData);
408 break;
409 }
410 case RO_LIST_SERVERS_WITH_DETAILS:
411 {
412 for (i=0; i < eventCallbacks.Size(); i++)
413 eventCallbacks[i]->OnListServersWithDetailsResult(rackspaceEventType, (const char*) packetData);
414 break;
415 }
416 case RO_CREATE_SERVER:
417 {
418 for (i=0; i < eventCallbacks.Size(); i++)
419 eventCallbacks[i]->OnCreateServerResult(rackspaceEventType, (const char*) packetData);
420 break;
421 }
422
423 case RO_GET_SERVER_DETAILS:
424 {
425 for (i=0; i < eventCallbacks.Size(); i++)
426 eventCallbacks[i]->OnGetServerDetails(rackspaceEventType, (const char*) packetData);
427 break;
428 }
429 case RO_UPDATE_SERVER_NAME_OR_PASSWORD:
430 {
431 for (i=0; i < eventCallbacks.Size(); i++)
432 eventCallbacks[i]->OnUpdateServerNameOrPassword(rackspaceEventType, (const char*) packetData);
433 break;
434 }
435 case RO_DELETE_SERVER:
436 {
437 for (i=0; i < eventCallbacks.Size(); i++)
438 eventCallbacks[i]->OnDeleteServer(rackspaceEventType, (const char*) packetData);
439 break;
440 }
441 case RO_LIST_SERVER_ADDRESSES:
442 {
443 for (i=0; i < eventCallbacks.Size(); i++)
444 eventCallbacks[i]->OnListServerAddresses(rackspaceEventType, (const char*) packetData);
445 break;
446 }
447 case RO_SHARE_SERVER_ADDRESS:
448 {
449 for (i=0; i < eventCallbacks.Size(); i++)
450 eventCallbacks[i]->OnShareServerAddress(rackspaceEventType, (const char*) packetData);
451 break;
452 }
453 case RO_DELETE_SERVER_ADDRESS:
454 {
455 for (i=0; i < eventCallbacks.Size(); i++)
456 eventCallbacks[i]->OnDeleteServerAddress(rackspaceEventType, (const char*) packetData);
457 break;
458 }
459 case RO_REBOOT_SERVER:
460 {
461 for (i=0; i < eventCallbacks.Size(); i++)
462 eventCallbacks[i]->OnRebootServer(rackspaceEventType, (const char*) packetData);
463 break;
464 }
465 case RO_REBUILD_SERVER:
466 {
467 for (i=0; i < eventCallbacks.Size(); i++)
468 eventCallbacks[i]->OnRebuildServer(rackspaceEventType, (const char*) packetData);
469 break;
470 }
471 case RO_RESIZE_SERVER:
472 {
473 for (i=0; i < eventCallbacks.Size(); i++)
474 eventCallbacks[i]->OnResizeServer(rackspaceEventType, (const char*) packetData);
475 break;
476 }
477 case RO_CONFIRM_RESIZED_SERVER:
478 {
479 for (i=0; i < eventCallbacks.Size(); i++)
480 eventCallbacks[i]->OnConfirmResizedServer(rackspaceEventType, (const char*) packetData);
481 break;
482 }
483 case RO_REVERT_RESIZED_SERVER:
484 {
485 for (i=0; i < eventCallbacks.Size(); i++)
486 eventCallbacks[i]->OnRevertResizedServer(rackspaceEventType, (const char*) packetData);
487 break;
488 }
489
490
491 case RO_LIST_FLAVORS:
492 {
493 for (i=0; i < eventCallbacks.Size(); i++)
494 eventCallbacks[i]->OnListFlavorsResult(rackspaceEventType, (const char*) packetData);
495 break;
496 }
497 case RO_GET_FLAVOR_DETAILS:
498 {
499 for (i=0; i < eventCallbacks.Size(); i++)
500 eventCallbacks[i]->OnGetFlavorDetailsResult(rackspaceEventType, (const char*) packetData);
501 break;
502 }
503 case RO_LIST_IMAGES:
504 {
505 for (i=0; i < eventCallbacks.Size(); i++)
506 eventCallbacks[i]->OnListImagesResult(rackspaceEventType, (const char*) packetData);
507 break;
508 }
509 case RO_CREATE_IMAGE:
510 {
511 for (i=0; i < eventCallbacks.Size(); i++)
512 eventCallbacks[i]->OnCreateImageResult(rackspaceEventType, (const char*) packetData);
513 break;
514 }
515 case RO_GET_IMAGE_DETAILS:
516 {
517 for (i=0; i < eventCallbacks.Size(); i++)
518 eventCallbacks[i]->OnGetImageDetailsResult(rackspaceEventType, (const char*) packetData);
519 break;
520 }
521 case RO_DELETE_IMAGE:
522 {
523 for (i=0; i < eventCallbacks.Size(); i++)
524 eventCallbacks[i]->OnDeleteImageResult(rackspaceEventType, (const char*) packetData);
525 break;
526 }
527 case RO_LIST_SHARED_IP_GROUPS:
528 {
529 for (i=0; i < eventCallbacks.Size(); i++)
530 eventCallbacks[i]->OnListSharedIPGroups(rackspaceEventType, (const char*) packetData);
531 break;
532 }
533 case RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS:
534 {
535 for (i=0; i < eventCallbacks.Size(); i++)
536 eventCallbacks[i]->OnListSharedIPGroupsWithDetails(rackspaceEventType, (const char*) packetData);
537 break;
538 }
539 case RO_CREATE_SHARED_IP_GROUP:
540 {
541 for (i=0; i < eventCallbacks.Size(); i++)
542 eventCallbacks[i]->OnCreateSharedIPGroup(rackspaceEventType, (const char*) packetData);
543 break;
544 }
545 case RO_GET_SHARED_IP_GROUP_DETAILS:
546 {
547 for (i=0; i < eventCallbacks.Size(); i++)
548 eventCallbacks[i]->OnGetSharedIPGroupDetails(rackspaceEventType, (const char*) packetData);
549 break;
550 }
551 case RO_DELETE_SHARED_IP_GROUP:
552 {
553 for (i=0; i < eventCallbacks.Size(); i++)
554 eventCallbacks[i]->OnDeleteSharedIPGroup(rackspaceEventType, (const char*) packetData);
555 break;
556 }
557 default:
558 break;
559
560 }
561 }
562 else
563 {
564 operationsIndex++;
565 }
566 }
567 }
568 void Rackspace::OnReceive(Packet *packet)
569 {
570 unsigned int operationsIndex;
571 for (operationsIndex=0; operationsIndex < operations.Size(); operationsIndex++)
572 {
573 if (operations[operationsIndex].isPendingAuthentication==false && operations[operationsIndex].connectionAddress==packet->systemAddress)
574 {
575 operations[operationsIndex].incomingStream+=packet->data;
576 }
577 }
578 }
579 bool Rackspace::ExecuteOperation(RackspaceOperation &ro)
580 {
581 if (ConnectToServerManagementDomain(ro)==false)
582 return false;
583
584 SLNet::RakString command(
585 "%s %s/%s HTTP/1.1\n"
586 "Host: %s\n"
587 "Content-Type: application/xml\n"
588 "Content-Length: %i\n"
589 "Accept: application/xml\n"
590 "X-Auth-Token: %s\n",
591 ro.httpCommand.C_String(), serverManagementPath.C_String(), ro.operation.C_String(), serverManagementDomain.C_String(),
592 ro.xml.GetLength(),
593 authToken.C_String());
594
595 if (ro.xml.IsEmpty()==false)
596 {
597 command+="\n";
598 command+=ro.xml;
599 command+="\n";
600 }
601
602 command+="\n";
603
604 //printf(command.C_String());
605
606 tcpInterface->Send(command.C_String(), (unsigned int) command.GetLength(), ro.connectionAddress, false);
607 return true;
608 }
609 void Rackspace::ReadLine(const char *data, const char *stringStart, SLNet::RakString &output)
610 {
611 output.Clear();
612
613 char *result, *resultEnd;
614
615 result=strstr((char*) data, stringStart);
616 if (result==0)
617 {
618 RakAssert(0);
619 return;
620 }
621
622 result+=strlen(stringStart);
623 if (result==0)
624 {
625 RakAssert(0);
626 return;
627 }
628
629 output=result;
630 resultEnd=result;
631 while (*resultEnd && (*resultEnd!='\r') && (*resultEnd!='\n') )
632 resultEnd++;
633 output.Truncate((unsigned int) (resultEnd-result));
634 }
635
636
637 bool Rackspace::ConnectToServerManagementDomain(RackspaceOperation &ro)
638 {
639 unsigned int i;
640
641 ro.connectionAddress=tcpInterface->Connect(serverManagementDomain.C_String(),443,true);
642 if (ro.connectionAddress==UNASSIGNED_SYSTEM_ADDRESS)
643 {
644 for (i=0; i < eventCallbacks.Size(); i++)
645 eventCallbacks[i]->OnConnectionAttemptFailure(ro.type, serverManagementURL);
646 return false;
647 }
648
649 #if OPEN_SSL_CLIENT_SUPPORT==1
650 tcpInterface->StartSSLClient(ro.connectionAddress);
651 #endif
652
653 return true;
654 }
655 bool Rackspace::HasOperationOfType(RackspaceOperationType t)
656 {
657 unsigned int i;
658 for (i=0; i < operations.Size(); i++)
659 {
660 if (operations[i].type==t)
661 return true;
662 }
663 return false;
664 }
665 unsigned int Rackspace::GetOperationOfTypeIndex(RackspaceOperationType t)
666 {
667 unsigned int i;
668 for (i=0; i < operations.Size(); i++)
669 {
670 if (operations[i].type==t)
671 return i;
672 }
673 return (unsigned int) -1;
674 }
675
676 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/string.h Source File

  • include
  • slikenet
string.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __RAK_STRING_H
17 #define __RAK_STRING_H
18
19 #include "Export.h"
20 #include "DS_List.h"
21 #include "types.h" // int64_t
22 #include <stdio.h>
23 #include "stdarg.h"
24
25
26 #ifdef _WIN32
27
28
29
30 #include "WindowsIncludes.h"
31 #endif
32
33 namespace SLNet
34 {
36 class SimpleMutex;
37 class BitStream;
38
44 class RAK_DLL_EXPORT RakString
45 {
46 public:
47 // Constructors
48 RakString();
49 RakString(char input);
50 RakString(unsigned char input);
51 RakString(const unsigned char *format, ...);
52 RakString(const char *format, ...);
53 ~RakString();
54 RakString( const RakString & rhs);
55
57 operator const char* () const {return sharedString->c_str;}
58
60 const char *C_String(void) const {return sharedString->c_str;}
61
62 // Lets you modify the string. Do not make the string longer - however, you can make it shorter, or change the contents.
63 // Pointer is only valid in the scope of RakString itself
64 char *C_StringUnsafe(void) {Clone(); return sharedString->c_str;}
65
67 RakString& operator = ( const RakString& rhs );
68 RakString& operator = ( const char *str );
69 RakString& operator = ( char *str );
70 RakString& operator = ( const unsigned char *str );
71 RakString& operator = ( char unsigned *str );
72 RakString& operator = ( const char c );
73
75 RakString& operator +=( const RakString& rhs);
76 RakString& operator += ( const char *str );
77 RakString& operator += ( char *str );
78 RakString& operator += ( const unsigned char *str );
79 RakString& operator += ( char unsigned *str );
80 RakString& operator += ( const char c );
81
83 unsigned char operator[] ( const unsigned int position ) const;
84
85 #ifdef _WIN32
86 // Return as Wide char
87 // Deallocate with DeallocWideChar
88 WCHAR * ToWideChar(void);
89 void DeallocWideChar(WCHAR * w);
90
91 void FromWideChar(const wchar_t *source);
92 static SLNet::RakString FromWideChar_S(const wchar_t *source);
93 #endif
94
101 size_t Find(const char *stringToFind,size_t pos = 0 );
102
104 bool operator==(const RakString &rhs) const;
105 bool operator==(const char *str) const;
106 bool operator==(char *str) const;
107
108 // Comparison
109 bool operator < ( const RakString& right ) const;
110 bool operator <= ( const RakString& right ) const;
111 bool operator > ( const RakString& right ) const;
112 bool operator >= ( const RakString& right ) const;
113
115 bool operator!=(const RakString &rhs) const;
116 bool operator!=(const char *str) const;
117 bool operator!=(char *str) const;
118
120 const char * ToLower(void);
121
123 const char * ToUpper(void);
124
126 void Set(const char *format, ...);
127
135 RakString Assign(const char *str,size_t pos, size_t n );
136
138 bool IsEmpty(void) const;
139
141 size_t GetLength(void) const;
142 size_t GetLengthUTF8(void) const;
143
145 void Replace(unsigned index, unsigned count, unsigned char c);
146
148 void SetChar( unsigned index, unsigned char c );
149
151 void SetChar( unsigned index, SLNet::RakString s );
152
154 void Truncate(unsigned int length);
155 void TruncateUTF8(unsigned int length);
156
157 // Gets the substring starting at index for count characters
158 RakString SubStr(unsigned int index, size_t count) const;
159
161 void Erase(unsigned int index, unsigned int count);
162
164 void TerminateAtFirstCharacter(char c);
166 void TerminateAtLastCharacter(char c);
167
168 void StartAfterFirstCharacter(char c);
169 void StartAfterLastCharacter(char c);
170
172 int GetCharacterCount(char c);
173
175 void RemoveCharacter(char c);
176
179 static SLNet::RakString NonVariadic(const char *str);
180
182 static unsigned long ToInteger(const char *str);
183 static unsigned long ToInteger(const RakString &rs);
184
189 static int ReadIntFromSubstring(const char *str, size_t pos, size_t n);
190
191 // Like strncat, but for a fixed length
192 void AppendBytes(const char *bytes, size_t count);
193
195 int StrCmp(const RakString &rhs) const;
196
198 int StrNCmp(const RakString &rhs, size_t num) const;
199
201 int StrICmp(const RakString &rhs) const;
202
204 void Clear(void);
205
207 void Printf(void);
208
210 void FPrintf(FILE *fp);
211
213 bool IPAddressMatch(const char *IP);
214
216 bool ContainsNonprintableExceptSpaces(void) const;
217
219 bool IsEmailAddress(void) const;
220
222 SLNet::RakString& URLEncode(void);
223
225 SLNet::RakString& URLDecode(void);
226
228 void SplitURI(SLNet::RakString &header, SLNet::RakString &domain, SLNet::RakString &path);
229
231 SLNet::RakString& SQLEscape(void);
232
238 static SLNet::RakString FormatForPOST(const char* uri, const char* contentType, const char* body, const char* extraHeaders="");
239 static SLNet::RakString FormatForPUT(const char* uri, const char* contentType, const char* body, const char* extraHeaders="");
240
244 static SLNet::RakString FormatForGET(const char* uri, const char* extraHeaders="");
245
249 static SLNet::RakString FormatForDELETE(const char* uri, const char* extraHeaders="");
250
252 SLNet::RakString& MakeFilePath(void);
253
256 static void FreeMemory(void);
258 static void FreeMemoryNoMutex(void);
259
262 void Serialize(BitStream *bs) const;
263
265 static void Serialize(const char *str, BitStream *bs);
266
272 void SerializeCompressed(BitStream *bs, uint8_t languageId=0, bool writeLanguageId=false) const;
273
275 static void SerializeCompressed(const char *str, BitStream *bs, uint8_t languageId=0, bool writeLanguageId=false);
276
280 bool Deserialize(BitStream *bs);
281
283 static bool Deserialize(char *str, BitStream *bs);
284
290 bool DeserializeCompressed(BitStream *bs, bool readLanguageId=false);
291
293 static bool DeserializeCompressed(char *str, BitStream *bs, bool readLanguageId=false);
294
295 static const char *ToString(int64_t i);
296 static const char *ToString(uint64_t i);
297
299 static size_t GetSizeToAllocate(size_t bytes)
300 {
301 const size_t smallStringSize = 128-sizeof(unsigned int)-sizeof(size_t)-sizeof(char*)*2;
302 if (bytes<=smallStringSize)
303 return smallStringSize;
304 else
305 return bytes*2;
306 }
307
309 struct SharedString
310 {
311 SimpleMutex *refCountMutex;
312 unsigned int refCount;
313 size_t bytesUsed;
314 char *bigString;
315 char *c_str;
316 char smallString[128-sizeof(unsigned int)-sizeof(size_t)-sizeof(char*)*2];
317 };
318
320 RakString( SharedString *_sharedString );
321
323 SharedString *sharedString;
324
325 // static SimpleMutex poolMutex;
326 // static DataStructures::MemoryPool<SharedString> pool;
328 static SharedString emptyString;
329
330 //static SharedString *sharedStringFreeList;
331 //static unsigned int sharedStringFreeListAllocationCount;
334 static DataStructures::List<SharedString*> freeList;
335
336 static int RakStringComp( RakString const &key, RakString const &data );
337
338 static void LockMutex(void);
339 static void UnlockMutex(void);
340
341 protected:
342 static SLNet::RakString FormatForPUTOrPost(const char* type, const char* uri, const char* contentType, const char* body, const char* extraHeaders);
343 void Allocate(size_t len);
344 void Assign(const char *str);
345 void Assign(const char *str, va_list ap);
346
347 void Clone(void);
348 void Free(void);
349 unsigned char ToLower(unsigned char c);
350 unsigned char ToUpper(unsigned char c);
351 void Realloc(SharedString *inSharedString, size_t bytes);
352 };
353
354 }
355
356 const SLNet::RakString RAK_DLL_EXPORT operator+(const SLNet::RakString &lhs, const SLNet::RakString &rhs);
357
358
359 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TwoWayAuthentication.cpp Source File

  • src
TwoWayAuthentication.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_TwoWayAuthentication==1
18
19 #include "slikenet/TwoWayAuthentication.h"
20 #include "slikenet/Rand.h"
21 #include "slikenet/GetTime.h"
22 #include "slikenet/MessageIdentifiers.h"
23 #include "slikenet/BitStream.h"
24 #include "slikenet/peerinterface.h"
25
26 #if LIBCAT_SECURITY==1
27 static const int HASH_BITS = 256;
28 static const int HASH_BYTES = HASH_BITS / 8;
29 static const int STRENGTHENING_FACTOR = 256;
30
31 // If building a RakNet DLL, be sure to tweak the CAT_EXPORT macro meaning
32 #if !defined(_RAKNET_LIB) && defined(_RAKNET_DLL)
33 # define CAT_BUILD_DLL
34 #else
35 # define CAT_NEUTER_EXPORT
36 #endif
37 #include <cat/crypt/hash/Skein.hpp>
38 #endif
39
40 using namespace SLNet;
41
42 enum NegotiationIdentifiers
43 {
44 ID_NONCE_REQUEST,
45 ID_NONCE_REPLY,
46 ID_HASHED_NONCE_AND_PASSWORD,
47 };
48
49 TwoWayAuthentication::NonceGenerator::NonceGenerator() {nextRequestId=0;}
50 TwoWayAuthentication::NonceGenerator::~NonceGenerator()
51 {
52 Clear();
53 }
54 void TwoWayAuthentication::NonceGenerator::GetNonce(char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], unsigned short *requestId, SLNet::AddressOrGUID remoteSystem)
55 {
56 TwoWayAuthentication::NonceAndRemoteSystemRequest *narsr = SLNet::OP_NEW<TwoWayAuthentication::NonceAndRemoteSystemRequest>(_FILE_AND_LINE_);
57 narsr->remoteSystem=remoteSystem;
58 GenerateNonce(narsr->nonce);
59 narsr->requestId=nextRequestId++;
60 *requestId=narsr->requestId;
61 memcpy(nonce,narsr->nonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
62 narsr->whenGenerated= SLNet::GetTime();
63 generatedNonces.Push(narsr,_FILE_AND_LINE_);
64 }
65 void TwoWayAuthentication::NonceGenerator::GenerateNonce(char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH])
66 {
67 fillBufferMT(nonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
68 }
69 bool TwoWayAuthentication::NonceGenerator::GetNonceById(char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], unsigned short requestId, SLNet::AddressOrGUID remoteSystem, bool popIfFound)
70 {
71 unsigned int i;
72 for (i=0; i < generatedNonces.Size(); i++)
73 {
74 if (generatedNonces[i]->requestId==requestId)
75 {
76 if (remoteSystem==generatedNonces[i]->remoteSystem)
77 {
78 memcpy(nonce,generatedNonces[i]->nonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
79 if (popIfFound)
80 {
81 SLNet::OP_DELETE(generatedNonces[i],_FILE_AND_LINE_);
82 generatedNonces.RemoveAtIndex(i);
83 }
84 return true;
85 }
86 else
87 {
88 return false;
89 }
90 }
91 }
92 return false;
93 }
94 void TwoWayAuthentication::NonceGenerator::Clear(void)
95 {
96 unsigned int i;
97 for (i=0; i < generatedNonces.Size(); i++)
98 SLNet::OP_DELETE(generatedNonces[i],_FILE_AND_LINE_);
99 generatedNonces.Clear(true,_FILE_AND_LINE_);
100 }
101 void TwoWayAuthentication::NonceGenerator::ClearByAddress(SLNet::AddressOrGUID remoteSystem)
102 {
103 unsigned int i=0;
104 while (i < generatedNonces.Size())
105 {
106 if (generatedNonces[i]->remoteSystem==remoteSystem)
107 {
108 SLNet::OP_DELETE(generatedNonces[i],_FILE_AND_LINE_);
109 generatedNonces.RemoveAtIndex(i);
110 }
111 else
112 {
113 i++;
114 }
115 }
116 }
117 void TwoWayAuthentication::NonceGenerator::Update(SLNet::Time curTime)
118 {
119 if (generatedNonces.Size()>0 && GreaterThan(curTime-5000, generatedNonces[0]->whenGenerated))
120 {
121 SLNet::OP_DELETE(generatedNonces[0], _FILE_AND_LINE_);
122 generatedNonces.RemoveAtIndex(0);
123 }
124 }
125 TwoWayAuthentication::TwoWayAuthentication()
126 {
127 whenLastTimeoutCheck= SLNet::GetTime();
128 seedMT(SLNet::GetTimeMS());
129 }
130 TwoWayAuthentication::~TwoWayAuthentication()
131 {
132 Clear();
133 }
134 bool TwoWayAuthentication::AddPassword(SLNet::RakString identifier, SLNet::RakString password)
135 {
136 if (password.IsEmpty())
137 return false;
138
139 if (identifier.IsEmpty())
140 return false;
141
142 if (password==identifier)
143 return false; // Insecure
144
145 if (passwords.GetIndexOf(identifier.C_String()).IsInvalid()==false)
146 return false; // This identifier already in use
147
148 passwords.Push(identifier, password,_FILE_AND_LINE_);
149 return true;
150 }
151 bool TwoWayAuthentication::Challenge(SLNet::RakString identifier, AddressOrGUID remoteSystem)
152 {
153 DataStructures::HashIndex skhi = passwords.GetIndexOf(identifier.C_String());
154 if (skhi.IsInvalid())
155 return false;
156
157 SLNet::BitStream bsOut;
158 bsOut.Write((MessageID)ID_TWO_WAY_AUTHENTICATION_NEGOTIATION);
159 bsOut.Write((MessageID)ID_NONCE_REQUEST);
160 SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,remoteSystem,false);
161
162 PendingChallenge pc;
163 pc.identifier=identifier;
164 pc.remoteSystem=remoteSystem;
165 pc.time= SLNet::GetTime();
166 pc.sentHash=false;
167 outgoingChallenges.Push(pc,_FILE_AND_LINE_);
168
169 return true;
170 }
171 void TwoWayAuthentication::Update(void)
172 {
173 SLNet::Time curTime = SLNet::GetTime();
174 nonceGenerator.Update(curTime);
175 if (GreaterThan(curTime - CHALLENGE_MINIMUM_TIMEOUT, whenLastTimeoutCheck))
176 {
177 while (outgoingChallenges.Size() && GreaterThan(curTime - CHALLENGE_MINIMUM_TIMEOUT, outgoingChallenges.Peek().time))
178 {
179 PendingChallenge pc = outgoingChallenges.Pop();
180
181 // Tell the user about the timeout
182 PushToUser(ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT, pc.identifier, pc.remoteSystem);
183 }
184
185 whenLastTimeoutCheck=curTime+CHALLENGE_MINIMUM_TIMEOUT;
186 }
187 }
188 PluginReceiveResult TwoWayAuthentication::OnReceive(Packet *packet)
189 {
190 switch (packet->data[0])
191 {
192 case ID_TWO_WAY_AUTHENTICATION_NEGOTIATION:
193 {
194 if (packet->length>=sizeof(MessageID)*2)
195 {
196 switch (packet->data[sizeof(MessageID)])
197 {
198 case ID_NONCE_REQUEST:
199 {
200 OnNonceRequest(packet);
201 }
202 break;
203 case ID_NONCE_REPLY:
204 {
205 OnNonceReply(packet);
206 }
207 break;
208 case ID_HASHED_NONCE_AND_PASSWORD:
209 {
210 return OnHashedNonceAndPassword(packet);
211 }
212 break;
213 }
214 }
215 return RR_STOP_PROCESSING_AND_DEALLOCATE;
216 }
217 case ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE:
218 case ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS:
219 {
220 if (packet->wasGeneratedLocally==false)
221 {
222 OnPasswordResult(packet);
223 return RR_STOP_PROCESSING_AND_DEALLOCATE;
224 }
225 else
226 break;
227 }
228 break;
229 // These should only be generated locally
230 case ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS:
231 case ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE:
232 case ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT:
233 if (packet->wasGeneratedLocally==false)
234 return RR_STOP_PROCESSING_AND_DEALLOCATE;
235 break;
236 }
237
238 return RR_CONTINUE_PROCESSING;
239 }
240 void TwoWayAuthentication::OnRakPeerShutdown(void)
241 {
242 Clear();
243 }
244 void TwoWayAuthentication::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
245 {
246 (void) lostConnectionReason;
247
248 // Remove from pending challenges
249 unsigned int i=0;
250 while (i < outgoingChallenges.Size())
251 {
252 if ((rakNetGUID!=UNASSIGNED_RAKNET_GUID && outgoingChallenges[i].remoteSystem.rakNetGuid==rakNetGUID) ||
253 (systemAddress!=UNASSIGNED_SYSTEM_ADDRESS && outgoingChallenges[i].remoteSystem.systemAddress==systemAddress))
254 {
255 outgoingChallenges.RemoveAtIndex(i);
256 }
257 else
258 {
259 i++;
260 }
261 }
262
263 if (rakNetGUID!=UNASSIGNED_RAKNET_GUID)
264 nonceGenerator.ClearByAddress(rakNetGUID);
265 else
266 nonceGenerator.ClearByAddress(systemAddress);
267 }
268 void TwoWayAuthentication::Clear(void)
269 {
270 outgoingChallenges.Clear(_FILE_AND_LINE_);
271 passwords.Clear(_FILE_AND_LINE_);
272 nonceGenerator.Clear();
273 }
274 void TwoWayAuthentication::PushToUser(MessageID messageId, SLNet::RakString password, SLNet::AddressOrGUID remoteSystem)
275 {
276 SLNet::BitStream output;
277 output.Write(messageId);
278 if (password.IsEmpty()==false)
279 output.Write(password);
280 Packet *p = AllocatePacketUnified(output.GetNumberOfBytesUsed());
281 p->systemAddress=remoteSystem.systemAddress;
282 p->systemAddress.systemIndex=(SystemIndex)-1;
283 p->guid=remoteSystem.rakNetGuid;
284 p->wasGeneratedLocally=true;
285 memcpy(p->data, output.GetData(), output.GetNumberOfBytesUsed());
286 rakPeerInterface->PushBackPacket(p, true);
287 }
288 void TwoWayAuthentication::OnNonceRequest(Packet *packet)
289 {
290 SLNet::BitStream bsIn(packet->data, packet->length, false);
291 bsIn.IgnoreBytes(sizeof(MessageID)*2);
292
293 char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH];
294 unsigned short requestId;
295 nonceGenerator.GetNonce(nonce,&requestId,packet);
296
297 SLNet::BitStream bsOut;
298 bsOut.Write((MessageID)ID_TWO_WAY_AUTHENTICATION_NEGOTIATION);
299 bsOut.Write((MessageID)ID_NONCE_REPLY);
300 bsOut.Write(requestId);
301 bsOut.WriteAlignedBytes((const unsigned char*) nonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
302 SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet,false);
303 }
304 void TwoWayAuthentication::OnNonceReply(Packet *packet)
305 {
306 SLNet::BitStream bsIn(packet->data, packet->length, false);
307 bsIn.IgnoreBytes(sizeof(MessageID)*2);
308
309 char thierNonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH];
310 unsigned short requestId;
311 bsIn.Read(requestId);
312 bsIn.ReadAlignedBytes((unsigned char *) thierNonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
313
314 // Lookup one of the negotiations for this guid/system address
315 AddressOrGUID aog(packet);
316 unsigned int i;
317 for (i=0; i < outgoingChallenges.Size(); i++)
318 {
319 if (outgoingChallenges[i].remoteSystem==aog && outgoingChallenges[i].sentHash==false)
320 {
321 outgoingChallenges[i].sentHash=true;
322
323 // Get the password for this identifier
324 DataStructures::HashIndex skhi = passwords.GetIndexOf(outgoingChallenges[i].identifier.C_String());
325 if (skhi.IsInvalid()==false)
326 {
327 SLNet::RakString password = passwords.ItemAtIndex(skhi);
328
329 // Hash their nonce with password and reply
330 char hashedNonceAndPw[HASHED_NONCE_AND_PW_LENGTH];
331 Hash(thierNonce, password, hashedNonceAndPw);
332
333 // Send
334 SLNet::BitStream bsOut;
335 bsOut.Write((MessageID)ID_TWO_WAY_AUTHENTICATION_NEGOTIATION);
336 bsOut.Write((MessageID)ID_HASHED_NONCE_AND_PASSWORD);
337 bsOut.Write(requestId);
338 bsOut.Write(outgoingChallenges[i].identifier); // Identifier helps the other system lookup the password quickly.
339 bsOut.WriteAlignedBytes((const unsigned char*) hashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH);
340 SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet,false);
341 }
342
343 return;
344 }
345 }
346 }
347 PluginReceiveResult TwoWayAuthentication::OnHashedNonceAndPassword(Packet *packet)
348 {
349 SLNet::BitStream bsIn(packet->data, packet->length, false);
350 bsIn.IgnoreBytes(sizeof(MessageID)*2);
351
352 char remoteHashedNonceAndPw[HASHED_NONCE_AND_PW_LENGTH];
353 unsigned short requestId;
354 bsIn.Read(requestId);
355 SLNet::RakString passwordIdentifier;
356 bsIn.Read(passwordIdentifier);
357 bsIn.ReadAlignedBytes((unsigned char *) remoteHashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH);
358
359 // Look up used nonce from requestId
360 char usedNonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH];
361 if (nonceGenerator.GetNonceById(usedNonce, requestId, packet, true)==false)
362 return RR_STOP_PROCESSING_AND_DEALLOCATE;
363
364 DataStructures::HashIndex skhi = passwords.GetIndexOf(passwordIdentifier.C_String());
365 if (skhi.IsInvalid()==false)
366 {
367 char hashedThisNonceAndPw[HASHED_NONCE_AND_PW_LENGTH];
368 Hash(usedNonce, passwords.ItemAtIndex(skhi), hashedThisNonceAndPw);
369 if (memcmp(hashedThisNonceAndPw, remoteHashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH)==0)
370 {
371 // Pass
372 SLNet::BitStream bsOut;
373 bsOut.Write((MessageID)ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS);
374 bsOut.WriteAlignedBytes((const unsigned char*) usedNonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
375 bsOut.WriteAlignedBytes((const unsigned char*) remoteHashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH);
376 bsOut.Write(passwordIdentifier);
377 SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet,false);
378
379 // Incoming success, modify packet header to tell user
380 PushToUser(ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS, passwordIdentifier, packet);
381
382 return RR_STOP_PROCESSING_AND_DEALLOCATE;
383 }
384 }
385
386 // Incoming failure, modify arrived packet header to tell user
387 packet->data[0]=(MessageID) ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE;
388
389 SLNet::BitStream bsOut;
390 bsOut.Write((MessageID)ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE);
391 bsOut.WriteAlignedBytes((const unsigned char*) usedNonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
392 bsOut.WriteAlignedBytes((const unsigned char*) remoteHashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH);
393 bsOut.Write(passwordIdentifier);
394 SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet,false);
395
396 return RR_CONTINUE_PROCESSING;
397 }
398 void TwoWayAuthentication::OnPasswordResult(Packet *packet)
399 {
400 SLNet::BitStream bsIn(packet->data, packet->length, false);
401 bsIn.IgnoreBytes(sizeof(MessageID)*1);
402 char usedNonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH];
403 bsIn.ReadAlignedBytes((unsigned char *)usedNonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
404 char hashedNonceAndPw[HASHED_NONCE_AND_PW_LENGTH];
405 bsIn.ReadAlignedBytes((unsigned char *)hashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH);
406 SLNet::RakString passwordIdentifier;
407 bsIn.Read(passwordIdentifier);
408
409 DataStructures::HashIndex skhi = passwords.GetIndexOf(passwordIdentifier.C_String());
410 if (skhi.IsInvalid()==false)
411 {
412 SLNet::RakString password = passwords.ItemAtIndex(skhi);
413 char testHash[HASHED_NONCE_AND_PW_LENGTH];
414 Hash(usedNonce, password, testHash);
415 if (memcmp(testHash,hashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH)==0)
416 {
417 // Lookup the outgoing challenge and remove it from the list
418 unsigned int i;
419 AddressOrGUID aog(packet);
420 for (i=0; i < outgoingChallenges.Size(); i++)
421 {
422 if (outgoingChallenges[i].identifier==passwordIdentifier &&
423 outgoingChallenges[i].remoteSystem==aog &&
424 outgoingChallenges[i].sentHash==true)
425 {
426 outgoingChallenges.RemoveAtIndex(i);
427
428 PushToUser(packet->data[0], passwordIdentifier, packet);
429 return;
430 }
431 }
432 }
433 }
434 }
435 void TwoWayAuthentication::Hash(char thierNonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], SLNet::RakString password, char out[HASHED_NONCE_AND_PW_LENGTH])
436 {
437 #if LIBCAT_SECURITY==1
438 cat::Skein hash;
439 if (!hash.BeginKey(HASH_BITS)) return;
440 hash.Crunch(thierNonce, TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
441 hash.Crunch(password.C_String(), (int) password.GetLength());
442 hash.End();
443 hash.Generate(out, HASH_BYTES, STRENGTHENING_FACTOR);
444 #else
445 CSHA1 sha1;
446 sha1.Update((unsigned char *) thierNonce, TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
447 sha1.Update((unsigned char *) password.C_String(), (unsigned int) password.GetLength());
448 sha1.Final();
449 sha1.GetHash((unsigned char *) out);
450 #endif
451 }
452
453 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • TransportInterface
SLNet::TransportInterface Member List

This is the complete list of members for SLNet::TransportInterface, including all inherited members.

CloseConnection(SystemAddress systemAddress)=0 | SLNet::TransportInterface | pure virtual
DeallocatePacket(Packet *packet)=0 | SLNet::TransportInterface | pure virtual
GetCommandParser(void)=0 | SLNet::TransportInterface | pure virtual
HasLostConnection(void)=0 | SLNet::TransportInterface | pure virtual
HasNewIncomingConnection(void)=0 | SLNet::TransportInterface | pure virtual
Receive(void)=0 | SLNet::TransportInterface | pure virtual
Send(SystemAddress systemAddress, const char *data,...)=0 | SLNet::TransportInterface | pure virtual
Start(unsigned short port, bool serverMode)=0 | SLNet::TransportInterface | pure virtual
Stop(void)=0 | SLNet::TransportInterface | pure virtual
TransportInterface() | SLNet::TransportInterface | inline
~TransportInterface() | SLNet::TransportInterface | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DS_HuffmanEncodingTree.cpp Source File

  • src
DS_HuffmanEncodingTree.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/DS_HuffmanEncodingTree.h"
17 #include "slikenet/DS_Queue.h"
18 #include "slikenet/BitStream.h"
19 #include "slikenet/assert.h"
20
21 using namespace SLNet;
22
23 HuffmanEncodingTree::HuffmanEncodingTree()
24 {
25 root = 0;
26 }
27
28 HuffmanEncodingTree::~HuffmanEncodingTree()
29 {
30 FreeMemory();
31 }
32
33 void HuffmanEncodingTree::FreeMemory( void )
34 {
35 if ( root == 0 )
36 return ;
37
38 // Use an in-order traversal to delete the tree
39 DataStructures::Queue<HuffmanEncodingTreeNode *> nodeQueue;
40
41 HuffmanEncodingTreeNode *node;
42
43 nodeQueue.Push( root, _FILE_AND_LINE_ );
44
45 while ( nodeQueue.Size() > 0 )
46 {
47 node = nodeQueue.Pop();
48
49 if ( node->left )
50 nodeQueue.Push( node->left, _FILE_AND_LINE_ );
51
52 if ( node->right )
53 nodeQueue.Push( node->right, _FILE_AND_LINE_ );
54
55 SLNet::OP_DELETE(node, _FILE_AND_LINE_);
56 }
57
58 // Delete the encoding table
59 for ( int i = 0; i < 256; i++ )
60 rakFree_Ex(encodingTable[ i ].encoding, _FILE_AND_LINE_ );
61
62 root = 0;
63 }
64
65
67
68 // Given a frequency table of 256 elements, all with a frequency of 1 or more, generate the tree
69 void HuffmanEncodingTree::GenerateFromFrequencyTable( unsigned int frequencyTable[ 256 ] )
70 {
71 int counter;
72 HuffmanEncodingTreeNode * node;
73 HuffmanEncodingTreeNode *leafList[ 256 ]; // Keep a copy of the pointers to all the leaves so we can generate the encryption table bottom-up, which is easier
74 // 1. Make 256 trees each with a weight equal to the frequency of the corresponding character
75 DataStructures::LinkedList<HuffmanEncodingTreeNode *> huffmanEncodingTreeNodeList;
76
77 FreeMemory();
78
79 for ( counter = 0; counter < 256; counter++ )
80 {
81 node = SLNet::OP_NEW<HuffmanEncodingTreeNode>( _FILE_AND_LINE_ );
82 node->left = 0;
83 node->right = 0;
84 node->value = (unsigned char) counter;
85 node->weight = frequencyTable[ counter ];
86
87 if ( node->weight == 0 )
88 node->weight = 1; // 0 weights are illegal
89
90 leafList[ counter ] = node; // Used later to generate the encryption table
91
92 InsertNodeIntoSortedList( node, &huffmanEncodingTreeNodeList ); // Insert and maintain sort order.
93 }
94
95
96 // 2. While there is more than one tree, take the two smallest trees and merge them so that the two trees are the left and right
97 // children of a new node, where the new node has the weight the sum of the weight of the left and right child nodes.
98 for(;;)
99 {
100 huffmanEncodingTreeNodeList.Beginning();
101 HuffmanEncodingTreeNode *lesser, *greater;
102 lesser = huffmanEncodingTreeNodeList.Pop();
103 greater = huffmanEncodingTreeNodeList.Pop();
104 node = SLNet::OP_NEW<HuffmanEncodingTreeNode>( _FILE_AND_LINE_ );
105 node->left = lesser;
106 node->right = greater;
107 node->weight = lesser->weight + greater->weight;
108 lesser->parent = node; // This is done to make generating the encryption table easier
109 greater->parent = node; // This is done to make generating the encryption table easier
110
111 if ( huffmanEncodingTreeNodeList.Size() == 0 )
112 {
113 // 3. Assign the one remaining node in the list to the root node.
114 root = node;
115 root->parent = 0;
116 break;
117 }
118
119 // Put the new node back into the list at the correct spot to maintain the sort. Linear search time
120 InsertNodeIntoSortedList( node, &huffmanEncodingTreeNodeList );
121 }
122
123 bool tempPath[ 256 ]; // Maximum path length is 256
124 unsigned short tempPathLength;
125 HuffmanEncodingTreeNode *currentNode;
126 SLNet::BitStream bitStream;
127
128 // Generate the encryption table. From before, we have an array of pointers to all the leaves which contain pointers to their parents.
129 // This can be done more efficiently but this isn't bad and it's way easier to program and debug
130
131 for ( counter = 0; counter < 256; counter++ )
132 {
133 // Already done at the end of the loop and before it!
134 tempPathLength = 0;
135
136 // Set the current node at the leaf
137 currentNode = leafList[ counter ];
138
139 do
140 {
141 if ( currentNode->parent->left == currentNode ) // We're storing the paths in reverse order.since we are going from the leaf to the root
142 tempPath[ tempPathLength++ ] = false;
143 else
144 tempPath[ tempPathLength++ ] = true;
145
146 currentNode = currentNode->parent;
147 }
148
149 while ( currentNode != root );
150
151 // Write to the bitstream in the reverse order that we stored the path, which gives us the correct order from the root to the leaf
152 while ( tempPathLength-- > 0 )
153 {
154 if ( tempPath[ tempPathLength ] ) // Write 1's and 0's because writing a bool will write the BitStream TYPE_CHECKING validation bits if that is defined along with the actual data bit, which is not what we want
155 bitStream.Write1();
156 else
157 bitStream.Write0();
158 }
159
160 // Read data from the bitstream, which is written to the encoding table in bits and bitlength. Note this function allocates the encodingTable[counter].encoding pointer
161 encodingTable[ counter ].bitLength = ( unsigned char ) bitStream.CopyData( &encodingTable[ counter ].encoding );
162
163 // Reset the bitstream for the next iteration
164 bitStream.Reset();
165 }
166 }
167
168 // Pass an array of bytes to array and a preallocated BitStream to receive the output
169 void HuffmanEncodingTree::EncodeArray( unsigned char *input, size_t sizeInBytes, SLNet::BitStream * output )
170 {
171 unsigned counter;
172
173 // For each input byte, Write out the corresponding series of 1's and 0's that give the encoded representation
174 for ( counter = 0; counter < sizeInBytes; counter++ )
175 {
176 output->WriteBits( encodingTable[ input[ counter ] ].encoding, encodingTable[ input[ counter ] ].bitLength, false ); // Data is left aligned
177 }
178
179 // Byte align the output so the unassigned remaining bits don't equate to some actual value
180 if ( output->GetNumberOfBitsUsed() % 8 != 0 )
181 {
182 // Find an input that is longer than the remaining bits. Write out part of it to pad the output to be byte aligned.
183 unsigned char remainingBits = (unsigned char) ( 8 - ( output->GetNumberOfBitsUsed() % 8 ) );
184
185 for ( counter = 0; counter < 256; counter++ )
186 if ( encodingTable[ counter ].bitLength > remainingBits )
187 {
188 output->WriteBits( encodingTable[ counter ].encoding, remainingBits, false ); // Data is left aligned
189 break;
190 }
191
192 #ifdef _DEBUG
193 RakAssert( counter != 256 ); // Given 256 elements, we should always be able to find an input that would be >= 7 bits
194
195 #endif
196
197 }
198 }
199
200 unsigned HuffmanEncodingTree::DecodeArray(SLNet::BitStream * input, BitSize_t sizeInBits, size_t maxCharsToWrite, unsigned char *output )
201 {
202 HuffmanEncodingTreeNode * currentNode;
203
204 unsigned outputWriteIndex;
205 outputWriteIndex = 0;
206 currentNode = root;
207
208 // For each bit, go left if it is a 0 and right if it is a 1. When we reach a leaf, that gives us the desired value and we restart from the root
209
210 for ( unsigned counter = 0; counter < sizeInBits; counter++ )
211 {
212 if ( input->ReadBit() == false ) // left!
213 currentNode = currentNode->left;
214 else
215 currentNode = currentNode->right;
216
217 if ( currentNode->left == 0 && currentNode->right == 0 ) // Leaf
218 {
219
220 if ( outputWriteIndex < maxCharsToWrite )
221 output[ outputWriteIndex ] = currentNode->value;
222
223 outputWriteIndex++;
224
225 currentNode = root;
226 }
227 }
228
229 return outputWriteIndex;
230 }
231
232 // Pass an array of encoded bytes to array and a preallocated BitStream to receive the output
233 void HuffmanEncodingTree::DecodeArray( unsigned char *input, BitSize_t sizeInBits, SLNet::BitStream * output )
234 {
235 HuffmanEncodingTreeNode * currentNode;
236
237 if ( sizeInBits <= 0 )
238 return ;
239
240 SLNet::BitStream bitStream( input, BITS_TO_BYTES(sizeInBits), false );
241
242 currentNode = root;
243
244 // For each bit, go left if it is a 0 and right if it is a 1. When we reach a leaf, that gives us the desired value and we restart from the root
245 for ( unsigned counter = 0; counter < sizeInBits; counter++ )
246 {
247 if ( bitStream.ReadBit() == false ) // left!
248 currentNode = currentNode->left;
249 else
250 currentNode = currentNode->right;
251
252 if ( currentNode->left == 0 && currentNode->right == 0 ) // Leaf
253 {
254 output->WriteBits( &( currentNode->value ), sizeof( char ) * 8, true ); // Use WriteBits instead of Write(char) because we want to avoid TYPE_CHECKING
255 currentNode = root;
256 }
257 }
258 }
259
260 // Insertion sort. Slow but easy to write in this case
261 void HuffmanEncodingTree::InsertNodeIntoSortedList( HuffmanEncodingTreeNode * node, DataStructures::LinkedList<HuffmanEncodingTreeNode *> *huffmanEncodingTreeNodeList ) const
262 {
263 if ( huffmanEncodingTreeNodeList->Size() == 0 )
264 {
265 huffmanEncodingTreeNodeList->Insert( node );
266 return ;
267 }
268
269 huffmanEncodingTreeNodeList->Beginning();
270
271 unsigned counter = 0;
272 for(;;)
273 {
274 if ( huffmanEncodingTreeNodeList->Peek()->weight < node->weight )
275 ++( *huffmanEncodingTreeNodeList );
276 else
277 {
278 huffmanEncodingTreeNodeList->Insert( node );
279 break;
280 }
281
282 // Didn't find a spot in the middle - add to the end
283 if ( ++counter == huffmanEncodingTreeNodeList->Size() )
284 {
285 huffmanEncodingTreeNodeList->End();
286
287 huffmanEncodingTreeNodeList->Add( node )
288
289 ; // Add to the end
290 break;
291 }
292 }
293 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/WSAStartupSingleton.h Source File

  • include
  • slikenet
WSAStartupSingleton.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __WSA_STARTUP_SINGLETON_H
12 #define __WSA_STARTUP_SINGLETON_H
13
14 class WSAStartupSingleton
15 {
16 public:
17 WSAStartupSingleton();
18 ~WSAStartupSingleton();
19 static void AddRef(void);
20 static void Deref(void);
21
22 protected:
23 static int refCount;
24 };
25
26 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Rand.cpp Source File

  • src
Rand.cpp
Go to the documentation of this file.
1
42 /*
43 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
44 *
45 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
46 * license found in the license.txt file in the root directory of this source tree.
47 */
48
49 #include <stdio.h>
50 #include <stdlib.h>
51 #include <string.h>
52 #include "slikenet/Rand.h"
53
54 //
55 // uint32 must be an unsigned integer type capable of holding at least 32
56 // bits; exactly 32 should be fastest, but 64 is better on an Alpha with
57 // GCC at -O3 optimization so try your options and see what's best for you
58 //
59
60 //typedef unsigned int uint32;
61
62 #define N (624) // length of state vector
63 #define M (397) // a period parameter
64 #define K (0x9908B0DFU) // a magic constant
65 #define hiBit(u) ((u) & 0x80000000U) // mask all but highest bit of u
66 #define loBit(u) ((u) & 0x00000001U) // mask all but lowest bit of u
67 #define loBits(u) ((u) & 0x7FFFFFFFU) // mask the highest bit of u
68 #define mixBits(u, v) (hiBit(u)|loBits(v)) // move hi bit of u to hi bit of v
69
70 static unsigned int _state[ N + 1 ]; // state vector + 1 extra to not violate ANSI C
71 static unsigned int *_next; // next random value is computed from here
72 static int _left = -1; // can *next++ this many times before reloading
73
74 using namespace SLNet;
75
76 void seedMT( unsigned int seed, unsigned int *state, unsigned int *&next, int &left );
77 unsigned int reloadMT( unsigned int *state, unsigned int *&next, int &left );
78 unsigned int randomMT( unsigned int *state, unsigned int *&next, int &left );
79 void fillBufferMT( void *buffer, unsigned int bytes, unsigned int *state, unsigned int *&next, int &left );
80 float frandomMT( unsigned int *state, unsigned int *&next, int &left );
81
82 // Uses global vars
83 void seedMT( unsigned int seed )
84 {
85 seedMT(seed, _state, _next, _left);
86 }
87 unsigned int reloadMT( void )
88 {
89 return reloadMT(_state, _next, _left);
90 }
91 unsigned int randomMT( void )
92 {
93 return randomMT(_state, _next, _left);
94 }
95 float frandomMT( void )
96 {
97 return frandomMT(_state, _next, _left);
98 }
99 void fillBufferMT( void *buffer, unsigned int bytes )
100 {
101 fillBufferMT(buffer, bytes, _state, _next, _left);
102 }
103
104 void seedMT( unsigned int seed, unsigned int *state, unsigned int *&next, int &left ) // Defined in cokus_c.c
105 {
106 (void) next;
107
108 //
109 // We initialize state[0..(N-1)] via the generator
110 //
111 // x_new = (69069 * x_old) mod 2^32
112 //
113 // from Line 15 of Table 1, p. 106, Sec. 3.3.4 of Knuth's
114 // _The Art of Computer Programming_, Volume 2, 3rd ed.
115 //
116 // Notes (SJC): I do not know what the initial state requirements
117 // of the Mersenne Twister are, but it seems this seeding generator
118 // could be better. It achieves the maximum period for its modulus
119 // (2^30) iff x_initial is odd (p. 20-21, Sec. 3.2.1.2, Knuth); if
120 // x_initial can be even, you have sequences like 0, 0, 0, ...;
121 // 2^31, 2^31, 2^31, ...; 2^30, 2^30, 2^30, ...; 2^29, 2^29 + 2^31,
122 // 2^29, 2^29 + 2^31, ..., etc. so I force seed to be odd below.
123 //
124 // Even if x_initial is odd, if x_initial is 1 mod 4 then
125 //
126 // the lowest bit of x is always 1,
127 // the next-to-lowest bit of x is always 0,
128 // the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... ,
129 // the 3rd-from-lowest bit of x 4-cycles ... 0 1 1 0 0 1 1 0 ... ,
130 // the 4th-from-lowest bit of x has the 8-cycle ... 0 0 0 1 1 1 1 0 ... ,
131 // ...
132 //
133 // and if x_initial is 3 mod 4 then
134 //
135 // the lowest bit of x is always 1,
136 // the next-to-lowest bit of x is always 1,
137 // the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... ,
138 // the 3rd-from-lowest bit of x 4-cycles ... 0 0 1 1 0 0 1 1 ... ,
139 // the 4th-from-lowest bit of x has the 8-cycle ... 0 0 1 1 1 1 0 0 ... ,
140 // ...
141 //
142 // The generator's potency (min. s>=0 with (69069-1)^s = 0 mod 2^32) is
143 // 16, which seems to be alright by p. 25, Sec. 3.2.1.3 of Knuth. It
144 // also does well in the dimension 2..5 spectral tests, but it could be
145 // better in dimension 6 (Line 15, Table 1, p. 106, Sec. 3.3.4, Knuth).
146 //
147 // Note that the random number user does not see the values generated
148 // here directly since reloadMT() will always munge them first, so maybe
149 // none of all of this matters. In fact, the seed values made here could
150 // even be extra-special desirable if the Mersenne Twister theory says
151 // so-- that's why the only change I made is to restrict to odd seeds.
152 //
153
154 unsigned int x = ( seed | 1U ) & 0xFFFFFFFFU, *s = state;
155 int j;
156
157 for ( left = 0, *s++ = x, j = N; --j;
158 *s++ = ( x *= 69069U ) & 0xFFFFFFFFU )
159
160 ;
161 }
162
163
164 unsigned int reloadMT( unsigned int *state, unsigned int *&next, int &left )
165 {
166 unsigned int * p0 = state, *p2 = state + 2, *pM = state + M, s0, s1;
167 int j;
168
169 if ( left < -1 )
170 seedMT( 4357U );
171
172 left = N - 1, next = state + 1;
173
174 for ( s0 = state[ 0 ], s1 = state[ 1 ], j = N - M + 1; --j; s0 = s1, s1 = *p2++ )
175 * p0++ = *pM++ ^ ( mixBits( s0, s1 ) >> 1 ) ^ ( loBit( s1 ) ? K : 0U );
176
177 for ( pM = state, j = M; --j; s0 = s1, s1 = *p2++ )
178 * p0++ = *pM++ ^ ( mixBits( s0, s1 ) >> 1 ) ^ ( loBit( s1 ) ? K : 0U );
179
180 s1 = state[ 0 ], *p0 = *pM ^ ( mixBits( s0, s1 ) >> 1 ) ^ ( loBit( s1 ) ? K : 0U );
181
182 s1 ^= ( s1 >> 11 );
183
184 s1 ^= ( s1 << 7 ) & 0x9D2C5680U;
185
186 s1 ^= ( s1 << 15 ) & 0xEFC60000U;
187
188 return ( s1 ^ ( s1 >> 18 ) );
189 }
190
191
192 unsigned int randomMT( unsigned int *state, unsigned int *&next, int &left )
193 {
194 unsigned int y;
195
196 if ( --left < 0 )
197 return ( reloadMT(state, next, left) );
198
199 y = *next++;
200
201 y ^= ( y >> 11 );
202
203 y ^= ( y << 7 ) & 0x9D2C5680U;
204
205 y ^= ( y << 15 ) & 0xEFC60000U;
206
207 return ( y ^ ( y >> 18 ) );
208
209 // This change made so the value returned is in the same range as what rand() returns
210 // return(y ^ (y >> 18)) % 32767;
211 }
212
213 void fillBufferMT( void *buffer, unsigned int bytes, unsigned int *state, unsigned int *&next, int &left )
214 {
215 unsigned int offset=0;
216 unsigned int r;
217 while (bytes-offset>=sizeof(r))
218 {
219 r = randomMT(state, next, left);
220 memcpy((char*)buffer+offset, &r, sizeof(r));
221 offset+=sizeof(r);
222 }
223
224 r = randomMT(state, next, left);
225 memcpy((char*)buffer+offset, &r, bytes-offset);
226 }
227
228 float frandomMT( unsigned int *state, unsigned int *&next, int &left )
229 {
230 return ( float ) ( ( double ) randomMT(state, next, left) / 4294967296.0 );
231 }
232 RakNetRandom::RakNetRandom()
233 {
234 left=-1;
235 }
236 RakNetRandom::~RakNetRandom()
237 {
238 }
239 void RakNetRandom::SeedMT( unsigned int seed )
240 {
241 printf("%i\n",seed);
242 seedMT(seed, state, next, left);
243 }
244
245 unsigned int RakNetRandom::ReloadMT( void )
246 {
247 return reloadMT(state, next, left);
248 }
249
250 unsigned int RakNetRandom::RandomMT( void )
251 {
252 return randomMT(state, next, left);
253 }
254
255 float RakNetRandom::FrandomMT( void )
256 {
257 return frandomMT(state, next, left);
258 }
259
260 void RakNetRandom::FillBufferMT( void *buffer, unsigned int bytes )
261 {
262 fillBufferMT(buffer, bytes, state, next, left);
263 }
264
265 /*
266 int main(void)
267 {
268 int j;
269
270 // you can seed with any uint32, but the best are odds in 0..(2^32 - 1)
271
272 seedMT(4357U);
273
274 // print the first 2,002 random numbers seven to a line as an example
275
276 for(j=0; j<2002; j++)
277 RAKNET_DEBUG_PRINTF(" %10lu%s", (unsigned int) randomMT(), (j%7)==6 ? "\n" : "");
278
279 return(EXIT_SUCCESS);
280 }
281
282 */
283
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetCommandParser
SLNet::RakNetCommandParser Member List

This is the complete list of members for SLNet::RakNetCommandParser, including all inherited members.

commandList | SLNet::CommandParserInterface | protected
CommandParserInterface() | SLNet::CommandParserInterface |
GetName(void) const | SLNet::RakNetCommandParser | virtual
GetRegisteredCommand(const char *command, RegisteredCommand *rc) | SLNet::CommandParserInterface | virtual
OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString) | SLNet::RakNetCommandParser | virtual
OnConnectionLost(const SystemAddress &systemAddress, TransportInterface *transport) | SLNet::CommandParserInterface | virtual
OnNewIncomingConnection(const SystemAddress &systemAddress, TransportInterface *transport) | SLNet::CommandParserInterface | virtual
OnTransportChange(TransportInterface *transport) | SLNet::CommandParserInterface | virtual
ParseConsoleString(char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength) | SLNet::CommandParserInterface | static
peer | SLNet::RakNetCommandParser | protected
RakNetCommandParser() | SLNet::RakNetCommandParser |
RegisterCommand(unsigned char parameterCount, const char *command, const char *commandHelp) | SLNet::CommandParserInterface | virtual
ReturnResult(bool res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(char *res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(SystemAddress res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(int res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
SendCommandList(TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
SendHelp(TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::RakNetCommandParser | virtual
SetRakPeerInterface(SLNet::RakPeerInterface *rakPeer) | SLNet::RakNetCommandParser |
VARIABLE_NUMBER_OF_PARAMETERS | SLNet::CommandParserInterface | static
~CommandParserInterface() | SLNet::CommandParserInterface | virtual
~RakNetCommandParser() | SLNet::RakNetCommandParser |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SignaledEvent.h Source File

  • include
  • slikenet
SignaledEvent.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __SIGNALED_EVENT_H
17 #define __SIGNALED_EVENT_H
18
19
20
21 #if defined(_WIN32)
22 #include "WindowsIncludes.h"
23
24
25
26 #else
27 #include <pthread.h>
28 #include <sys/types.h>
29 #include "SimpleMutex.h"
30
31
32
33
34 #endif
35
36 #include "Export.h"
37
38 namespace SLNet
39 {
40
41 class RAK_DLL_EXPORT SignaledEvent
42 {
43 public:
44 SignaledEvent();
45 ~SignaledEvent();
46
47 void InitEvent(void);
48 void CloseEvent(void);
49 void SetEvent(void);
50 void WaitOnEvent(int timeoutMs);
51
52 protected:
53 #ifdef _WIN32
54 HANDLE eventList;
55
56
57
58
59
60 #else
61 SimpleMutex isSignaledMutex;
62 bool isSignaled;
63 #if !defined(ANDROID)
64 pthread_condattr_t condAttr;
65 #endif
66 pthread_cond_t eventList;
67 pthread_mutex_t hMutex;
68 pthread_mutexattr_t mutexAttr;
69 #endif
70 };
71
72 } // namespace SLNet
73
74 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketFileLogger.h Source File

  • include
  • slikenet
PacketFileLogger.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_PacketLogger==1
23
24 #ifndef __PACKET_FILE_LOGGER_H_
25 #define __PACKET_FILE_LOGGER_H_
26
27 #include "PacketLogger.h"
28 #include <stdio.h>
29
30 namespace SLNet
31 {
32
35 class RAK_DLL_EXPORT PacketFileLogger : public PacketLogger
36 {
37 public:
38 // GetInstance() and DestroyInstance(instance*)
39 STATIC_FACTORY_DECLARATIONS(PacketFileLogger)
40
41 PacketFileLogger();
42 virtual ~PacketFileLogger();
43 void StartLog(const char *filenamePrefix);
44 virtual void WriteLog(const char *str);
45 protected:
46 FILE *packetLogFile;
47 };
48
49 } // namespace SLNet
50
51 #endif
52
53 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Heap.h Source File

  • include
  • slikenet
DS_Heap.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22
23 #ifndef __RAKNET_HEAP_H
24 #define __RAKNET_HEAP_H
25
26 #include "memoryoverride.h"
27 #include "DS_List.h"
28 #include "Export.h"
29 #include "assert.h"
30
31 #ifdef _MSC_VER
32 #pragma warning( push )
33 #endif
34
37 namespace DataStructures
38 {
39 template <class weight_type, class data_type, bool isMaxHeap>
40 class RAK_DLL_EXPORT Heap
41 {
42 public:
43 struct HeapNode
44 {
45 HeapNode() {}
46 HeapNode(const weight_type &w, const data_type &d) : weight(w), data(d) {}
47 weight_type weight; // I'm assuming key is a native numerical type - float or int
48 data_type data;
49 };
50
51 Heap();
52 ~Heap();
53 void Push(const weight_type &weight, const data_type &data, const char *file, unsigned int line);
55 void StartSeries(void) {optimizeNextSeriesPush=false;}
57 void PushSeries(const weight_type &weight, const data_type &data, const char *file, unsigned int line);
58 data_type Pop(const unsigned startingIndex);
59 data_type Peek(const unsigned startingIndex=0) const;
60 weight_type PeekWeight(const unsigned startingIndex=0) const;
61 void Clear(bool doNotDeallocateSmallBlocks, const char *file, unsigned int line);
62 data_type& operator[] ( const unsigned int position ) const;
63 unsigned Size(void) const;
64
65 protected:
66 unsigned LeftChild(const unsigned i) const;
67 unsigned RightChild(const unsigned i) const;
68 unsigned Parent(const unsigned i) const;
69 void Swap(const unsigned i, const unsigned j);
70 DataStructures::List<HeapNode> heap;
71 bool optimizeNextSeriesPush;
72 };
73
74 template <class weight_type, class data_type, bool isMaxHeap>
75 Heap<weight_type, data_type, isMaxHeap>::Heap()
76 {
77 optimizeNextSeriesPush=false;
78 }
79
80 template <class weight_type, class data_type, bool isMaxHeap>
81 Heap<weight_type, data_type, isMaxHeap>::~Heap()
82 {
83 //Clear(true, _FILE_AND_LINE_);
84 }
85
86 template <class weight_type, class data_type, bool isMaxHeap>
87 void Heap<weight_type, data_type, isMaxHeap>::PushSeries(const weight_type &weight, const data_type &data, const char *file, unsigned int line)
88 {
89 if (optimizeNextSeriesPush==false)
90 {
91 // If the weight of what we are inserting is greater than / less than in order of the heap of every sibling and sibling of parent, then can optimize next push
92 unsigned currentIndex = heap.Size();
93 unsigned parentIndex;
94 if (currentIndex>0)
95 {
96 for (parentIndex = Parent(currentIndex); parentIndex < currentIndex; parentIndex++)
97 {
98 #ifdef _MSC_VER
99 #pragma warning(disable:4127) // conditional expression is constant
100 #endif
101 if (isMaxHeap)
102 {
103 // Every child is less than its parent
104 if (weight>heap[parentIndex].weight)
105 {
106 // Can't optimize
107 Push(weight,data,file,line);
108 return;
109 }
110 }
111 else
112 {
113 // Every child is greater than than its parent
114 if (weight<heap[parentIndex].weight)
115 {
116 // Can't optimize
117 Push(weight,data,file,line);
118 return;
119 }
120 }
121 }
122 }
123
124 // Parent's subsequent siblings and this row's siblings all are less than / greater than inserted element. Can insert all further elements straight to the end
125 heap.Insert(HeapNode(weight, data), file, line);
126 optimizeNextSeriesPush=true;
127 }
128 else
129 {
130 heap.Insert(HeapNode(weight, data), file, line);
131 }
132 }
133
134 template <class weight_type, class data_type, bool isMaxHeap>
135 void Heap<weight_type, data_type, isMaxHeap>::Push(const weight_type &weight, const data_type &data, const char *file, unsigned int line)
136 {
137 unsigned currentIndex = heap.Size();
138 unsigned parentIndex;
139 heap.Insert(HeapNode(weight, data), file, line);
140 while (currentIndex!=0)
141 {
142 parentIndex = Parent(currentIndex);
143 #ifdef _MSC_VER
144 #pragma warning( disable : 4127 ) // warning C4127: conditional expression is constant
145 #endif
146 if (isMaxHeap)
147 {
148 if (heap[parentIndex].weight < weight)
149 {
150 Swap(currentIndex, parentIndex);
151 currentIndex=parentIndex;
152 }
153 else
154 break;
155 }
156 else
157 {
158 if (heap[parentIndex].weight > weight)
159 {
160 Swap(currentIndex, parentIndex);
161 currentIndex=parentIndex;
162 }
163 else
164 break;
165 }
166 }
167 }
168
169 template <class weight_type, class data_type, bool isMaxHeap>
170 data_type Heap<weight_type, data_type, isMaxHeap>::Pop(const unsigned startingIndex)
171 {
172 // While we have children, swap out with the larger of the two children.
173
174 // This line will assert on an empty heap
175 data_type returnValue=heap[startingIndex].data;
176
177 // Move the last element to the head, and re-heapify
178 heap[startingIndex]=heap[heap.Size()-1];
179
180 unsigned currentIndex,leftChild,rightChild;
181 weight_type currentWeight;
182 currentIndex=startingIndex;
183 currentWeight=heap[startingIndex].weight;
184 heap.RemoveFromEnd();
185
186 #ifdef _MSC_VER
187 #pragma warning( disable : 4127 ) // warning C4127: conditional expression is constant
188 #endif
189 for(;;)
190 {
191 leftChild=LeftChild(currentIndex);
192 rightChild=RightChild(currentIndex);
193 if (leftChild >= heap.Size())
194 {
195 // Done
196 return returnValue;
197 }
198 if (rightChild >= heap.Size())
199 {
200 // Only left node.
201 if ((isMaxHeap==true && currentWeight < heap[leftChild].weight) ||
202 (isMaxHeap==false && currentWeight > heap[leftChild].weight))
203 Swap(leftChild, currentIndex);
204
205 return returnValue;
206 }
207 else
208 {
209 // Swap with the bigger/smaller of the two children and continue
210 if (isMaxHeap)
211 {
212 if (heap[leftChild].weight <= currentWeight && heap[rightChild].weight <= currentWeight)
213 return returnValue;
214
215 if (heap[leftChild].weight > heap[rightChild].weight)
216 {
217 Swap(leftChild, currentIndex);
218 currentIndex=leftChild;
219 }
220 else
221 {
222 Swap(rightChild, currentIndex);
223 currentIndex=rightChild;
224 }
225 }
226 else
227 {
228 if (heap[leftChild].weight >= currentWeight && heap[rightChild].weight >= currentWeight)
229 return returnValue;
230
231 if (heap[leftChild].weight < heap[rightChild].weight)
232 {
233 Swap(leftChild, currentIndex);
234 currentIndex=leftChild;
235 }
236 else
237 {
238 Swap(rightChild, currentIndex);
239 currentIndex=rightChild;
240 }
241 }
242 }
243 }
244 }
245
246 template <class weight_type, class data_type, bool isMaxHeap>
247 inline data_type Heap<weight_type, data_type, isMaxHeap>::Peek(const unsigned startingIndex) const
248 {
249 return heap[startingIndex].data;
250 }
251
252 template <class weight_type, class data_type, bool isMaxHeap>
253 inline weight_type Heap<weight_type, data_type, isMaxHeap>::PeekWeight(const unsigned startingIndex) const
254 {
255 return heap[startingIndex].weight;
256 }
257
258 template <class weight_type, class data_type, bool isMaxHeap>
259 void Heap<weight_type, data_type, isMaxHeap>::Clear(bool doNotDeallocateSmallBlocks, const char *file, unsigned int line)
260 {
261 heap.Clear(doNotDeallocateSmallBlocks, file, line);
262 }
263
264 template <class weight_type, class data_type, bool isMaxHeap>
265 inline data_type& Heap<weight_type, data_type, isMaxHeap>::operator[] ( const unsigned int position ) const
266 {
267 return heap[position].data;
268 }
269 template <class weight_type, class data_type, bool isMaxHeap>
270 unsigned Heap<weight_type, data_type, isMaxHeap>::Size(void) const
271 {
272 return heap.Size();
273 }
274
275 template <class weight_type, class data_type, bool isMaxHeap>
276 inline unsigned Heap<weight_type, data_type, isMaxHeap>::LeftChild(const unsigned i) const
277 {
278 return i*2+1;
279 }
280
281 template <class weight_type, class data_type, bool isMaxHeap>
282 inline unsigned Heap<weight_type, data_type, isMaxHeap>::RightChild(const unsigned i) const
283 {
284 return i*2+2;
285 }
286
287 template <class weight_type, class data_type, bool isMaxHeap>
288 inline unsigned Heap<weight_type, data_type, isMaxHeap>::Parent(const unsigned i) const
289 {
290 #ifdef _DEBUG
291 RakAssert(i!=0);
292 #endif
293 return (i-1)/2;
294 }
295
296 template <class weight_type, class data_type, bool isMaxHeap>
297 void Heap<weight_type, data_type, isMaxHeap>::Swap(const unsigned i, const unsigned j)
298 {
299 HeapNode temp;
300 temp=heap[i];
301 heap[i]=heap[j];
302 heap[j]=temp;
303 }
304 }
305
306 #ifdef _MSC_VER
307 #pragma warning( pop )
308 #endif
309
310 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ConnectionGraph2.cpp Source File

  • src
ConnectionGraph2.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_ConnectionGraph2==1
18
19 #include "slikenet/ConnectionGraph2.h"
20 #include "slikenet/peerinterface.h"
21 #include "slikenet/MessageIdentifiers.h"
22 #include "slikenet/BitStream.h"
23
24 using namespace SLNet;
25
26 STATIC_FACTORY_DEFINITIONS(ConnectionGraph2,ConnectionGraph2)
27
28 int SLNet::ConnectionGraph2::RemoteSystemComp( const RakNetGUID &key, RemoteSystem * const &data )
29 {
30 if (key < data->guid)
31 return -1;
32 if (key > data->guid)
33 return 1;
34 return 0;
35 }
36
37 int SLNet::ConnectionGraph2::SystemAddressAndGuidComp( const SystemAddressAndGuid &key, const SystemAddressAndGuid &data )
38 {
39 if (key.guid<data.guid)
40 return -1;
41 if (key.guid>data.guid)
42 return 1;
43 return 0;
44 }
45 ConnectionGraph2::ConnectionGraph2()
46 {
47 autoProcessNewConnections=true;
48 }
49 ConnectionGraph2::~ConnectionGraph2()
50 {
51
52 }
53 bool ConnectionGraph2::GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress *saOut, RakNetGUID *guidOut, unsigned int *outLength)
54 {
55 if ((saOut==0 && guidOut==0) || outLength==0 || *outLength==0 || remoteSystemGuid==UNASSIGNED_RAKNET_GUID)
56 {
57 *outLength=0;
58 return false;
59 }
60
61 bool objectExists;
62 unsigned int idx = remoteSystems.GetIndexFromKey(remoteSystemGuid, &objectExists);
63 if (objectExists==false)
64 {
65 *outLength=0;
66 return false;
67 }
68
69 unsigned int idx2;
70 if (remoteSystems[idx]->remoteConnections.Size() < *outLength)
71 *outLength=remoteSystems[idx]->remoteConnections.Size();
72 for (idx2=0; idx2 < *outLength; idx2++)
73 {
74 if (guidOut)
75 guidOut[idx2]=remoteSystems[idx]->remoteConnections[idx2].guid;
76 if (saOut)
77 saOut[idx2]=remoteSystems[idx]->remoteConnections[idx2].systemAddress;
78 }
79 return true;
80 }
81 bool ConnectionGraph2::ConnectionExists(RakNetGUID g1, RakNetGUID g2)
82 {
83 if (g1==g2)
84 return false;
85
86 bool objectExists;
87 unsigned int idx = remoteSystems.GetIndexFromKey(g1, &objectExists);
88 if (objectExists==false)
89 {
90 return false;
91 }
92 SystemAddressAndGuid sag;
93 sag.guid=g2;
94 return remoteSystems[idx]->remoteConnections.HasData(sag);
95 }
96 uint16_t ConnectionGraph2::GetPingBetweenSystems(RakNetGUID g1, RakNetGUID g2) const
97 {
98 if (g1==g2)
99 return 0;
100
101 if (g1==rakPeerInterface->GetMyGUID())
102 return (uint16_t) rakPeerInterface->GetAveragePing(g2);
103 if (g2==rakPeerInterface->GetMyGUID())
104 return (uint16_t) rakPeerInterface->GetAveragePing(g1);
105
106 bool objectExists;
107 unsigned int idx = remoteSystems.GetIndexFromKey(g1, &objectExists);
108 if (objectExists==false)
109 {
110 return (uint16_t) -1;
111 }
112
113 SystemAddressAndGuid sag;
114 sag.guid=g2;
115 unsigned int idx2 = remoteSystems[idx]->remoteConnections.GetIndexFromKey(sag, &objectExists);
116 if (objectExists==false)
117 {
118 return (uint16_t) -1;
119 }
120 return remoteSystems[idx]->remoteConnections[idx2].sendersPingToThatSystem;
121 }
122
124 RakNetGUID ConnectionGraph2::GetLowestAveragePingSystem(void) const
125 {
126 float lowestPing=-1.0;
127 unsigned int lowestPingIdx=(unsigned int) -1;
128 float thisAvePing=0.0f;
129 unsigned int idx, idx2;
130 int ap, count=0;
131
132 for (idx=0; idx<remoteSystems.Size(); idx++)
133 {
134 thisAvePing=0.0f;
135
136 ap = rakPeerInterface->GetAveragePing(remoteSystems[idx]->guid);
137 if (ap!=-1)
138 {
139 thisAvePing+=(float) ap;
140 count++;
141 }
142 }
143
144 if (count>0)
145 {
146 lowestPing=thisAvePing/count;
147 }
148
149 for (idx=0; idx<remoteSystems.Size(); idx++)
150 {
151 thisAvePing=0.0f;
152 count=0;
153
154 RemoteSystem *remoteSystem = remoteSystems[idx];
155 for (idx2=0; idx2 < remoteSystem->remoteConnections.Size(); idx2++)
156 {
157 ap=remoteSystem->remoteConnections[idx2].sendersPingToThatSystem;
158 if (ap!=-1)
159 {
160 thisAvePing+=(float) ap;
161 count++;
162 }
163 }
164
165 if (count>0 && (lowestPing==-1.0f || thisAvePing/count < lowestPing))
166 {
167 lowestPing=thisAvePing/count;
168 lowestPingIdx=idx;
169 }
170 }
171
172 if (lowestPingIdx==(unsigned int) -1)
173 return rakPeerInterface->GetMyGUID();
174 return remoteSystems[lowestPingIdx]->guid;
175 }
176
177 void ConnectionGraph2::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
178 {
179 // Send notice to all existing connections
180 SLNet::BitStream bs;
181 if (lostConnectionReason==LCR_CONNECTION_LOST)
182 bs.Write((MessageID)ID_REMOTE_CONNECTION_LOST);
183 else
184 bs.Write((MessageID)ID_REMOTE_DISCONNECTION_NOTIFICATION);
185 bs.Write(systemAddress);
186 bs.Write(rakNetGUID);
187 SendUnified(&bs,HIGH_PRIORITY,RELIABLE_ORDERED,0,systemAddress,true);
188
189 bool objectExists;
190 unsigned int idx = remoteSystems.GetIndexFromKey(rakNetGUID, &objectExists);
191 if (objectExists)
192 {
193 SLNet::OP_DELETE(remoteSystems[idx],_FILE_AND_LINE_);
194 remoteSystems.RemoveAtIndex(idx);
195 }
196 }
197 void ConnectionGraph2::SetAutoProcessNewConnections(bool b)
198 {
199 autoProcessNewConnections=b;
200 }
201 bool ConnectionGraph2::GetAutoProcessNewConnections(void) const
202 {
203 return autoProcessNewConnections;
204 }
205 void ConnectionGraph2::AddParticipant(const SystemAddress &systemAddress, RakNetGUID rakNetGUID)
206 {
207 // Relay the new connection to other systems.
208 SLNet::BitStream bs;
209 bs.Write((MessageID)ID_REMOTE_NEW_INCOMING_CONNECTION);
210 bs.Write((uint32_t)1);
211 bs.Write(systemAddress);
212 bs.Write(rakNetGUID);
213 bs.WriteCasted<uint16_t>(rakPeerInterface->GetAveragePing(rakNetGUID));
214 SendUnified(&bs,HIGH_PRIORITY,RELIABLE_ORDERED,0,systemAddress,true);
215
216 // Send everyone to the new guy
217 DataStructures::List<SystemAddress> addresses;
218 DataStructures::List<RakNetGUID> guids;
219 rakPeerInterface->GetSystemList(addresses, guids);
220 bs.Reset();
221 bs.Write((MessageID)ID_REMOTE_NEW_INCOMING_CONNECTION);
222 BitSize_t writeOffset = bs.GetWriteOffset();
223 bs.Write((uint32_t) addresses.Size());
224
225 unsigned int i;
226 uint32_t count=0;
227 for (i=0; i < addresses.Size(); i++)
228 {
229 if (addresses[i]==systemAddress)
230 continue;
231
232 bs.Write(addresses[i]);
233 bs.Write(guids[i]);
234 bs.WriteCasted<uint16_t>(rakPeerInterface->GetAveragePing(guids[i]));
235 count++;
236 }
237
238 if (count>0)
239 {
240 BitSize_t writeOffset2 = bs.GetWriteOffset();
241 bs.SetWriteOffset(writeOffset);
242 bs.Write(count);
243 bs.SetWriteOffset(writeOffset2);
244 SendUnified(&bs,HIGH_PRIORITY,RELIABLE_ORDERED,0,systemAddress,false);
245 }
246
247 bool objectExists;
248 unsigned int ii = remoteSystems.GetIndexFromKey(rakNetGUID, &objectExists);
249 if (objectExists==false)
250 {
251 RemoteSystem* remoteSystem = SLNet::OP_NEW<RemoteSystem>(_FILE_AND_LINE_);
252 remoteSystem->guid=rakNetGUID;
253 remoteSystems.InsertAtIndex(remoteSystem,ii,_FILE_AND_LINE_);
254 }
255 }
256 void ConnectionGraph2::GetParticipantList(DataStructures::OrderedList<RakNetGUID, RakNetGUID> &participantList)
257 {
258 participantList.Clear(true, _FILE_AND_LINE_);
259 unsigned int i;
260 for (i=0; i < remoteSystems.Size(); i++)
261 participantList.InsertAtEnd(remoteSystems[i]->guid, _FILE_AND_LINE_);
262 }
263 void ConnectionGraph2::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
264 {
265 (void) isIncoming;
266 if (autoProcessNewConnections)
267 AddParticipant(systemAddress, rakNetGUID);
268 }
269 PluginReceiveResult ConnectionGraph2::OnReceive(Packet *packet)
270 {
271 if (packet->data[0]==ID_REMOTE_CONNECTION_LOST || packet->data[0]==ID_REMOTE_DISCONNECTION_NOTIFICATION)
272 {
273 bool objectExists;
274 unsigned idx = remoteSystems.GetIndexFromKey(packet->guid, &objectExists);
275 if (objectExists)
276 {
277 SLNet::BitStream bs(packet->data,packet->length,false);
278 bs.IgnoreBytes(1);
279 SystemAddressAndGuid saag;
280 bs.Read(saag.systemAddress);
281 bs.Read(saag.guid);
282 unsigned long idx2 = remoteSystems[idx]->remoteConnections.GetIndexFromKey(saag, &objectExists);
283 if (objectExists)
284 remoteSystems[idx]->remoteConnections.RemoveAtIndex(idx2);
285 }
286 }
287 else if (packet->data[0]==ID_REMOTE_NEW_INCOMING_CONNECTION)
288 {
289 bool objectExists;
290 unsigned idx = remoteSystems.GetIndexFromKey(packet->guid, &objectExists);
291 if (objectExists)
292 {
293 uint32_t numAddresses;
294 SLNet::BitStream bs(packet->data,packet->length,false);
295 bs.IgnoreBytes(1);
296 bs.Read(numAddresses);
297 for (unsigned int idx2=0; idx2 < numAddresses; idx2++)
298 {
299 SystemAddressAndGuid saag;
300 bs.Read(saag.systemAddress);
301 bs.Read(saag.guid);
302 bs.Read(saag.sendersPingToThatSystem);
303 unsigned int ii = remoteSystems[idx]->remoteConnections.GetIndexFromKey(saag, &objectExists);
304 if (objectExists==false)
305 remoteSystems[idx]->remoteConnections.InsertAtIndex(saag,ii,_FILE_AND_LINE_);
306 }
307 }
308 }
309
310 return RR_CONTINUE_PROCESSING;
311 }
312
313 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • MLKeyRef
DataStructures::MLKeyRef< templateType > Member List

This is the complete list of members for DataStructures::MLKeyRef< templateType >, including all inherited members.

Get(void) const | DataStructures::MLKeyRef< templateType > | inline
MLKeyRef(const templateType &input) | DataStructures::MLKeyRef< templateType > | inline
operator<(const templateType &right) | DataStructures::MLKeyRef< templateType > | inline
operator==(const templateType &right) | DataStructures::MLKeyRef< templateType > | inline
operator>(const templateType &right) | DataStructures::MLKeyRef< templateType > | inline
val | DataStructures::MLKeyRef< templateType > | protected
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/socket.h Source File

  • include
  • slikenet
socket.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 /*
17 #ifndef __RAKNET_SOCKET_H
18 #define __RAKNET_SOCKET_H
19
20 #include "types.h"
21 #include "defines.h"
22 #include "Export.h"
23 #include "SocketIncludes.h"
24 #include "assert.h"
25 #include "SocketDefines.h"
26 #include "MTUSize.h"
27
28 namespace SLNet
29 {
30
31 struct RAK_DLL_EXPORT RakNetSocket
32 {
33 public:
34 RakNetSocket();
35 ~RakNetSocket();
36
37 // void Accept(
38 // struct sockaddr *addr,
39 // int *addrlen);
40
41 inline int Connect(
42 const struct sockaddr *name,
43 int namelen) {return connect__(s,name,namelen);}
44
45 static RakNetSocket* Create
46 #ifdef __native_client__
47 (_PP_Instance_ _chromeInstance);
48 #else
49 (int af,
50 int type,
51 int protocol);
52 #endif
53
54 int Bind(
55 const struct sockaddr *addr,
56 int namelen);
57
58 inline int GetSockName(
59 struct sockaddr *name,
60 socklen_t * namelen) {return getsockname__(s,name,namelen);}
61
62 inline int GetSockOpt (
63 int level,
64 int optname,
65 char * optval,
66 socklen_t *optlen) {return getsockopt__(s,level,optname,optval,optlen);}
67
68
69 int IOCTLSocket(
70 long cmd,
71 unsigned long *argp);
72
73 int Listen (
74 int backlog);
75
76 inline int Recv(
77 char * buf,
78 int len,
79 int flags) {return recv__(s,buf,len,flags);}
80
81 inline int RecvFrom(
82 char * buf,
83 int len,
84 int flags,
85 struct sockaddr * from,
86 socklen_t * fromlen) {return recvfrom__(s,buf,len,flags,from,fromlen);}
87
88 // inline int Select(
89 // int nfds,
90 // fd_set *readfds,
91 // fd_set *writefds,
92 // fd_set *exceptfds,
93 // struct timeval *timeout) {return select__(nfds,readfds,writefds,exceptfds,timeout);}
94
95 inline int Send(
96 const char * buf,
97 int len,
98 int flags) {return send__(s,buf,len,flags);}
99
100 inline int SendTo(
101 const char * buf,
102 int len,
103 int flags,
104 const struct sockaddr *to,
105 int tolen) {return sendto__(s,buf,len,flags,to,tolen);}
106
107 #ifdef _WIN32
108 #elif defined(_PS3) || defined(__PS3__) || defined(SN_TARGET_PS3) || defined(_PS4) || defined(SN_TARGET_PSP2)
109 #else
110 inline int Fcntl(int cmd, int arg) {return fcntl(s,cmd,arg);}
111 #endif
112
113
114 #if defined(_WIN32) && !defined(WINDOWS_STORE_RT)
115 inline int _WSASendTo(
116 LPWSABUF lpBuffers,
117 DWORD dwBufferCount,
118 LPDWORD lpNumberOfBytesSent,
119 DWORD dwFlags,
120 const struct sockaddr FAR * lpTo,
121 int iTolen,
122 LPWSAOVERLAPPED lpOverlapped,
123 LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
124 )
125 { return WSASendTo(s,lpBuffers,dwBufferCount,lpNumberOfBytesSent,dwFlags,lpTo,iTolen,lpOverlapped,lpCompletionRoutine);}
126
127 #endif
128
129 int SetSockOpt(
130 int level,
131 int optname,
132 const char * optval,
133 int optlen);
134
135 int Shutdown(
136 int how);
137
138
139 inline void SetRemotePortRakNetWasStartedOn(unsigned short i) {remotePortRakNetWasStartedOn_PS3_PSP2=i;}
140 inline void SetUserConnectionSocketIndex(unsigned int i) {userConnectionSocketIndex=i;}
141 inline void SetBoundAddress(SystemAddress i) {boundAddress=i;}
142 inline void SetSocketFamily(unsigned short i) {socketFamily=i;}
143 inline void SetBlockingSocket(bool i) {blockingSocket=i;}
144 inline void SetExtraSocketOptions(unsigned int i) {extraSocketOptions=i;}
145 inline void SetChromeInstance(_PP_Instance_ i) {chromeInstance=i;}
146 inline void SetBoundAddressToLoopback(unsigned char ipVersion) {boundAddress.SetToLoopback(ipVersion);}
147
148 inline SystemAddress GetBoundAddress(void) const {return boundAddress;}
149 inline unsigned short GetRemotePortRakNetWasStartedOn(void) const {return remotePortRakNetWasStartedOn_PS3_PSP2;}
150 inline bool GetBlockingSocket(void) {return blockingSocket;}
151 inline unsigned int GetExtraSocketOptions(void) const {return extraSocketOptions;}
152 inline unsigned short GetSocketFamily(void) const {return socketFamily;}
153 inline _PP_Instance_ GetChromeInstance(void) const {return chromeInstance;}
154 inline unsigned int GetUserConnectionSocketIndex(void) const {
155 RakAssert(userConnectionSocketIndex!=(unsigned int)-1);
156 return userConnectionSocketIndex;}
157
158
159 #ifdef __native_client__
160 // Flag indicating if a SendTo is currently in progress
161 bool sendInProgress;
162
163 // Data for next queued packet to send, if nextSendSize > 0
164 char nextSendBuffer[MAXIMUM_MTU_SIZE];
165
166 // Size of next queued packet to send, or 0 if no queued packet
167 int nextSendSize;
168
169 // Destination address of queued packet
170 PP_NetAddress_Private nextSendAddr;
171 #endif
172
173 __UDPSOCKET__ s;
174
175 protected:
176
177 #if defined (_WIN32) && defined(USE_WAIT_FOR_MULTIPLE_EVENTS)
178 void* recvEvent;
179 #endif
180
181 #if defined(_PS3) || defined(__PS3__) || defined(SN_TARGET_PS3) || defined(_PS4) || defined(SN_TARGET_PSP2)
185 #endif
186
187 unsigned short remotePortRakNetWasStartedOn_PS3_PSP2;
188 unsigned int userConnectionSocketIndex;
189 SystemAddress boundAddress;
190 unsigned short socketFamily;
191 bool blockingSocket;
192 unsigned int extraSocketOptions;
193 _PP_Instance_ chromeInstance;
194 };
195
196 } // namespace SLNet
197
198 #endif
199 */
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Heap
DataStructures::Heap< weight_type, data_type, isMaxHeap > Member List

This is the complete list of members for DataStructures::Heap< weight_type, data_type, isMaxHeap >, including all inherited members.

Clear(bool doNotDeallocateSmallBlocks, const char *file, unsigned int line) | DataStructures::Heap< weight_type, data_type, isMaxHeap > |
heap | DataStructures::Heap< weight_type, data_type, isMaxHeap > | protected
Heap() | DataStructures::Heap< weight_type, data_type, isMaxHeap > |
LeftChild(const unsigned i) const | DataStructures::Heap< weight_type, data_type, isMaxHeap > | inlineprotected
operator[](const unsigned int position) const | DataStructures::Heap< weight_type, data_type, isMaxHeap > | inline
optimizeNextSeriesPush | DataStructures::Heap< weight_type, data_type, isMaxHeap > | protected
Parent(const unsigned i) const | DataStructures::Heap< weight_type, data_type, isMaxHeap > | inlineprotected
Peek(const unsigned startingIndex=0) const | DataStructures::Heap< weight_type, data_type, isMaxHeap > | inline
PeekWeight(const unsigned startingIndex=0) const | DataStructures::Heap< weight_type, data_type, isMaxHeap > | inline
Pop(const unsigned startingIndex) | DataStructures::Heap< weight_type, data_type, isMaxHeap > |
Push(const weight_type &weight, const data_type &data, const char *file, unsigned int line) | DataStructures::Heap< weight_type, data_type, isMaxHeap > |
PushSeries(const weight_type &weight, const data_type &data, const char *file, unsigned int line) | DataStructures::Heap< weight_type, data_type, isMaxHeap > |
RightChild(const unsigned i) const | DataStructures::Heap< weight_type, data_type, isMaxHeap > | inlineprotected
Size(void) const | DataStructures::Heap< weight_type, data_type, isMaxHeap > |
StartSeries(void) | DataStructures::Heap< weight_type, data_type, isMaxHeap > | inline
Swap(const unsigned i, const unsigned j) | DataStructures::Heap< weight_type, data_type, isMaxHeap > | protected
~Heap() | DataStructures::Heap< weight_type, data_type, isMaxHeap > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TableSerializer.cpp Source File

  • src
TableSerializer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/TableSerializer.h"
17 #include "slikenet/DS_Table.h"
18 #include "slikenet/BitStream.h"
19 #include "slikenet/StringCompressor.h"
20 #include "slikenet/assert.h"
21
22 using namespace SLNet;
23
24 void TableSerializer::SerializeTable(DataStructures::Table *in, SLNet::BitStream *out)
25 {
26 DataStructures::Page<unsigned, DataStructures::Table::Row*, _TABLE_BPLUS_TREE_ORDER> *cur = in->GetRows().GetListHead();
27 const DataStructures::List<DataStructures::Table::ColumnDescriptor> &columns=in->GetColumns();
28 SerializeColumns(in, out);
29 out->Write((unsigned)in->GetRows().Size());
30 unsigned rowIndex;
31 while (cur)
32 {
33 for (rowIndex=0; rowIndex < (unsigned)cur->size; rowIndex++)
34 {
35 SerializeRow(cur->data[rowIndex], cur->keys[rowIndex], columns, out);
36 }
37 cur=cur->next;
38 }
39 }
40 void TableSerializer::SerializeColumns(DataStructures::Table *in, SLNet::BitStream *out)
41 {
42 const DataStructures::List<DataStructures::Table::ColumnDescriptor> &columns=in->GetColumns();
43 out->Write((unsigned)columns.Size());
44 unsigned i;
45 for (i=0; i<columns.Size(); i++)
46 {
47 StringCompressor::Instance()->EncodeString(columns[i].columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, out);
48 out->Write((unsigned char)columns[i].columnType);
49 }
50 }
51 void TableSerializer::SerializeColumns(DataStructures::Table *in, SLNet::BitStream *out, DataStructures::List<int> &skipColumnIndices)
52 {
53 const DataStructures::List<DataStructures::Table::ColumnDescriptor> &columns=in->GetColumns();
54 out->Write((unsigned)columns.Size()-skipColumnIndices.Size());
55 unsigned i;
56 for (i=0; i<columns.Size(); i++)
57 {
58 if (skipColumnIndices.GetIndexOf(i)==(unsigned)-1)
59 {
60 StringCompressor::Instance()->EncodeString(columns[i].columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, out);
61 out->Write((unsigned char)columns[i].columnType);
62 }
63 }
64 }
65 bool TableSerializer::DeserializeTable(unsigned char *serializedTable, unsigned int dataLength, DataStructures::Table *out)
66 {
67 SLNet::BitStream in((unsigned char*) serializedTable, dataLength, false);
68 return DeserializeTable(&in, out);
69 }
70 bool TableSerializer::DeserializeTable(SLNet::BitStream *in, DataStructures::Table *out)
71 {
72 unsigned rowSize;
73 DeserializeColumns(in,out);
74 if (in->Read(rowSize)==false || rowSize>100000)
75 {
76 RakAssert(0);
77 return false; // Hacker crash prevention
78 }
79
80 unsigned rowIndex;
81 for (rowIndex=0; rowIndex < rowSize; rowIndex++)
82 {
83 if (DeserializeRow(in, out)==false)
84 return false;
85 }
86 return true;
87 }
88 bool TableSerializer::DeserializeColumns(SLNet::BitStream *in, DataStructures::Table *out)
89 {
90 unsigned columnSize;
91 unsigned char columnType;
92 char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH];
93 if (in->Read(columnSize)==false || columnSize > 10000)
94 return false; // Hacker crash prevention
95
96 out->Clear();
97 unsigned i;
98 for (i=0; i<columnSize; i++)
99 {
100 StringCompressor::Instance()->DecodeString(columnName, 32, in);
101 in->Read(columnType);
102 out->AddColumn(columnName, (DataStructures::Table::ColumnType)columnType);
103 }
104 return true;
105 }
106 void TableSerializer::SerializeRow(DataStructures::Table::Row *in, unsigned keyIn, const DataStructures::List<DataStructures::Table::ColumnDescriptor> &columns, SLNet::BitStream *out)
107 {
108 unsigned cellIndex;
109 out->Write(keyIn);
110 unsigned int columnsSize = columns.Size();
111 out->Write(columnsSize);
112 for (cellIndex=0; cellIndex<columns.Size(); cellIndex++)
113 {
114 out->Write(cellIndex);
115 SerializeCell(out, in->cells[cellIndex], columns[cellIndex].columnType);
116 }
117 }
118 void TableSerializer::SerializeRow(DataStructures::Table::Row *in, unsigned keyIn, const DataStructures::List<DataStructures::Table::ColumnDescriptor> &columns, SLNet::BitStream *out, DataStructures::List<int> &skipColumnIndices)
119 {
120 unsigned cellIndex;
121 out->Write(keyIn);
122 unsigned int numEntries=0;
123 for (cellIndex=0; cellIndex<columns.Size(); cellIndex++)
124 {
125 if (skipColumnIndices.GetIndexOf(cellIndex)==(unsigned)-1)
126 {
127 numEntries++;
128 }
129 }
130 out->Write(numEntries);
131
132 for (cellIndex=0; cellIndex<columns.Size(); cellIndex++)
133 {
134 if (skipColumnIndices.GetIndexOf(cellIndex)==(unsigned)-1)
135 {
136 out->Write(cellIndex);
137 SerializeCell(out, in->cells[cellIndex], columns[cellIndex].columnType);
138 }
139 }
140 }
141 bool TableSerializer::DeserializeRow(SLNet::BitStream *in, DataStructures::Table *out)
142 {
143 const DataStructures::List<DataStructures::Table::ColumnDescriptor> &columns=out->GetColumns();
144 unsigned numEntries;
145 DataStructures::Table::Row *row;
146 unsigned key;
147 if (in->Read(key)==false)
148 return false;
149 row=out->AddRow(key);
150 unsigned int cnt;
151 in->Read(numEntries);
152 for (cnt=0; cnt<numEntries; cnt++)
153 {
154 unsigned cellIndex;
155 in->Read(cellIndex);
156 if (DeserializeCell(in, row->cells[cellIndex], columns[cellIndex].columnType)==false)
157 {
158 out->RemoveRow(key);
159 return false;
160 }
161 }
162 return true;
163 }
164 void TableSerializer::SerializeCell(SLNet::BitStream *out, DataStructures::Table::Cell *cell, DataStructures::Table::ColumnType columnType)
165 {
166 out->Write(cell->isEmpty);
167 if (cell->isEmpty==false)
168 {
169 if (columnType==DataStructures::Table::NUMERIC)
170 {
171 out->Write(cell->i);
172 }
173 else if (columnType==DataStructures::Table::STRING)
174 {
175 StringCompressor::Instance()->EncodeString(cell->c, 65535, out);
176 }
177 else if (columnType==DataStructures::Table::POINTER)
178 {
179 out->Write(cell->ptr);
180 }
181 else
182 {
183 // Binary
184 RakAssert(columnType==DataStructures::Table::BINARY);
185 RakAssert(cell->i>0);
186 unsigned binaryLength;
187 binaryLength=(unsigned)cell->i;
188 out->Write(binaryLength);
189 out->WriteAlignedBytes((const unsigned char*) cell->c, (const unsigned int) cell->i);
190 }
191 }
192 }
193 bool TableSerializer::DeserializeCell(SLNet::BitStream *in, DataStructures::Table::Cell *cell, DataStructures::Table::ColumnType columnType)
194 {
195 bool isEmpty=false;
196 double value;
197 void *ptr;
198 char tempString[65535];
199 cell->Clear();
200
201 if (in->Read(isEmpty)==false)
202 return false;
203 if (isEmpty==false)
204 {
205 if (columnType==DataStructures::Table::NUMERIC)
206 {
207 if (in->Read(value)==false)
208 return false;
209 cell->Set(value);
210 }
211 else if (columnType==DataStructures::Table::STRING)
212 {
213 if (StringCompressor::Instance()->DecodeString(tempString, 65535, in)==false)
214 return false;
215 cell->Set(tempString);
216 }
217 else if (columnType==DataStructures::Table::POINTER)
218 {
219 if (in->Read(ptr)==false)
220 return false;
221 cell->SetPtr(ptr);
222 }
223 else
224 {
225 unsigned binaryLength;
226 // Binary
227 RakAssert(columnType==DataStructures::Table::BINARY);
228 if (in->Read(binaryLength)==false || binaryLength > 10000000)
229 return false; // Sanity check to max binary cell of 10 megabytes
230 in->AlignReadToByteBoundary();
231 if (BITS_TO_BYTES(in->GetNumberOfUnreadBits())<(BitSize_t)binaryLength)
232 return false;
233 cell->Set((char*) in->GetData()+BITS_TO_BYTES(in->GetReadOffset()), (int) binaryLength);
234 in->IgnoreBits(BYTES_TO_BITS((int) binaryLength));
235 }
236 }
237 return true;
238 }
239 void TableSerializer::SerializeFilterQuery(SLNet::BitStream *in, DataStructures::Table::FilterQuery *query)
240 {
241 StringCompressor::Instance()->EncodeString(query->columnName,_TABLE_MAX_COLUMN_NAME_LENGTH,in,0);
242 in->WriteCompressed(query->columnIndex);
243 in->Write((unsigned char) query->operation);
244 in->Write(query->cellValue->isEmpty);
245 if (query->cellValue->isEmpty==false)
246 {
247 in->Write(query->cellValue->i);
248 in->WriteAlignedBytesSafe((const char*)query->cellValue->c,(const unsigned int)query->cellValue->i,10000000); // Sanity check to max binary cell of 10 megabytes
249 in->Write(query->cellValue->ptr);
250
251 }
252 }
253 bool TableSerializer::DeserializeFilterQuery(SLNet::BitStream *out, DataStructures::Table::FilterQuery *query)
254 {
255 bool b;
256 RakAssert(query->cellValue);
257 StringCompressor::Instance()->DecodeString(query->columnName,_TABLE_MAX_COLUMN_NAME_LENGTH,out,0);
258 out->ReadCompressed(query->columnIndex);
259 unsigned char op;
260 out->Read(op);
261 query->operation=(DataStructures::Table::FilterQueryType) op;
262 query->cellValue->Clear();
263 b=out->Read(query->cellValue->isEmpty);
264 if (query->cellValue->isEmpty==false)
265 {
266 // HACK - cellValue->i is used for integer, character, and binary data. However, for character and binary c will be 0. So use that to determine if the data was integer or not.
267 out->Read(query->cellValue->i);
268 unsigned int inputLength;
269 out->ReadAlignedBytesSafeAlloc(&query->cellValue->c,inputLength,10000000); // Sanity check to max binary cell of 10 megabytes
270 if (query->cellValue->c)
271 query->cellValue->i=inputLength;
272 b=out->Read(query->cellValue->ptr);
273 }
274 return b;
275 }
276 void TableSerializer::SerializeFilterQueryList(SLNet::BitStream *in, DataStructures::Table::FilterQuery *query, unsigned int numQueries, unsigned int maxQueries)
277 {
278 (void) maxQueries;
279 in->Write((bool)(query && numQueries>0));
280 if (query==0 || numQueries<=0)
281 return;
282
283 RakAssert(numQueries<=maxQueries);
284 in->WriteCompressed(numQueries);
285 unsigned i;
286 for (i=0; i < numQueries; i++)
287 {
288 SerializeFilterQuery(in, query);
289 }
290 }
291 bool TableSerializer::DeserializeFilterQueryList(SLNet::BitStream *out, DataStructures::Table::FilterQuery **query, unsigned int *numQueries, unsigned int maxQueries, int allocateExtraQueries)
292 {
293 bool b, anyQueries=false;
294 out->Read(anyQueries);
295 if (anyQueries==false)
296 {
297 if (allocateExtraQueries<=0)
298 *query=0;
299 else
300 *query=new DataStructures::Table::FilterQuery[allocateExtraQueries];
301
302 *numQueries=0;
303 return true;
304 }
305 b=out->ReadCompressed(*numQueries);
306 if (*numQueries>maxQueries)
307 {
308 RakAssert(0);
309 *numQueries=maxQueries;
310 }
311 if (*numQueries==0)
312 return b;
313
314 *query=new DataStructures::Table::FilterQuery[*numQueries+allocateExtraQueries];
315 DataStructures::Table::FilterQuery *queryPtr = *query;
316
317 unsigned i;
318 for (i=0; i < *numQueries; i++)
319 {
320 queryPtr[i].cellValue=new DataStructures::Table::Cell;
321 b=DeserializeFilterQuery(out, queryPtr+i);
322 }
323
324 return b;
325 }
326 void TableSerializer::DeallocateQueryList(DataStructures::Table::FilterQuery *query, unsigned int numQueries)
327 {
328 if (query==0 || numQueries==0)
329 return;
330
331 unsigned i;
332 for (i=0; i < numQueries; i++)
333 SLNet::OP_DELETE(query[i].cellValue, _FILE_AND_LINE_);
334 SLNet::OP_DELETE_ARRAY(query, _FILE_AND_LINE_);
335 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • ConnectionGraph2
SLNet::ConnectionGraph2 Member List

This is the complete list of members for SLNet::ConnectionGraph2, including all inherited members.

AddParticipant(const SystemAddress &systemAddress, RakNetGUID rakNetGUID) | SLNet::ConnectionGraph2 |
AllocatePacketUnified(unsigned dataSize) | SLNet::PluginInterface2 | protected
autoProcessNewConnections | SLNet::ConnectionGraph2 | protected
ConnectionExists(RakNetGUID g1, RakNetGUID g2) | SLNet::ConnectionGraph2 |
ConnectionGraph2() | SLNet::ConnectionGraph2 |
DeallocPacketUnified(Packet *packet) | SLNet::PluginInterface2 | protected
GetAutoProcessNewConnections(void) const | SLNet::ConnectionGraph2 |
GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress *saOut, RakNetGUID *guidOut, unsigned int *outLength) | SLNet::ConnectionGraph2 |
GetLowestAveragePingSystem(void) const | SLNet::ConnectionGraph2 |
GetMyGUIDUnified(void) const | SLNet::PluginInterface2 |
GetParticipantList(DataStructures::OrderedList< RakNetGUID, RakNetGUID > &participantList) | SLNet::ConnectionGraph2 |
GetPingBetweenSystems(RakNetGUID g1, RakNetGUID g2) const | SLNet::ConnectionGraph2 |
GetRakPeerInterface(void) const | SLNet::PluginInterface2 | inline
OnAck(unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time) | SLNet::PluginInterface2 | inlinevirtual
OnAttach(void) | SLNet::PluginInterface2 | inlinevirtual
OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) | SLNet::ConnectionGraph2 | protectedvirtual
OnDetach(void) | SLNet::PluginInterface2 | inlinevirtual
OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) | SLNet::PluginInterface2 | inlinevirtual
OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) | SLNet::PluginInterface2 | inlinevirtual
OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason) | SLNet::PluginInterface2 | inlinevirtual
OnInternalPacket(InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend) | SLNet::PluginInterface2 | inlinevirtual
OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming) | SLNet::ConnectionGraph2 | protectedvirtual
OnPushBackPacket(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) | SLNet::PluginInterface2 | inlinevirtual
OnRakPeerShutdown(void) | SLNet::PluginInterface2 | inlinevirtual
OnRakPeerStartup(void) | SLNet::PluginInterface2 | inlinevirtual
OnReceive(Packet *packet) | SLNet::ConnectionGraph2 | protectedvirtual
OnReliabilityLayerNotification(const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError) | SLNet::PluginInterface2 | inlinevirtual
PluginInterface2() | SLNet::PluginInterface2 |
PushBackPacketUnified(Packet *packet, bool pushAtHead) | SLNet::PluginInterface2 | protected
rakPeerInterface | SLNet::PluginInterface2 | protected
RemoteSystemComp(const RakNetGUID &key, RemoteSystem *const &data) | SLNet::ConnectionGraph2 | static
remoteSystems | SLNet::ConnectionGraph2 | protected
SendListUnified(const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast) | SLNet::PluginInterface2 | protected
SendUnified(const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast) | SLNet::PluginInterface2 | protected
SendUnified(const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast) | SLNet::PluginInterface2 | protected
SetAutoProcessNewConnections(bool b) | SLNet::ConnectionGraph2 |
SetRakPeerInterface(RakPeerInterface *ptr) | SLNet::PluginInterface2 |
SetTCPInterface(TCPInterface *ptr) | SLNet::PluginInterface2 |
SystemAddressAndGuidComp(const SystemAddressAndGuid &key, const SystemAddressAndGuid &data) | SLNet::ConnectionGraph2 | static
tcpInterface | SLNet::PluginInterface2 | protected
Update(void) | SLNet::PluginInterface2 | inlinevirtual
UsesReliabilityLayer(void) const | SLNet::PluginInterface2 | inlinevirtual
~ConnectionGraph2() | SLNet::ConnectionGraph2 |
~PluginInterface2() | SLNet::PluginInterface2 | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FullyConnectedMesh2.cpp Source File

  • src
FullyConnectedMesh2.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #include "slikenet/NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_FullyConnectedMesh2==1
22
23 #include "slikenet/FullyConnectedMesh2.h"
24 #include "slikenet/peerinterface.h"
25 #include "slikenet/MessageIdentifiers.h"
26 #include "slikenet/assert.h"
27 #include "slikenet/GetTime.h"
28 #include "slikenet/Rand.h"
29 #include "slikenet/DS_OrderedList.h"
30
31 using namespace SLNet;
32
33 int FCM2ParticipantComp( FullyConnectedMesh2::FCM2Participant * const &key, FullyConnectedMesh2::FCM2Participant * const &data )
34 {
35 if (key->fcm2Guid < data->fcm2Guid)
36 return -1;
37 if (key->fcm2Guid > data->fcm2Guid)
38 return 1;
39 return 0;
40 }
41
42 STATIC_FACTORY_DEFINITIONS(FullyConnectedMesh2,FullyConnectedMesh2);
43
44 FullyConnectedMesh2::FullyConnectedMesh2()
45 {
46 startupTime=0;
47 totalConnectionCount=0;
48 ourFCMGuid=0;
49 autoParticipateConnections=true;
50
51
52
53
54 connectOnNewRemoteConnections=true;
55
56 hostRakNetGuid=UNASSIGNED_RAKNET_GUID;
57 }
58 FullyConnectedMesh2::~FullyConnectedMesh2()
59 {
60 Clear();
61 }
62 RakNetGUID FullyConnectedMesh2::GetConnectedHost(void) const
63 {
64 if (ourFCMGuid==0)
65 return UNASSIGNED_RAKNET_GUID;
66 return hostRakNetGuid;
67 }
68 SystemAddress FullyConnectedMesh2::GetConnectedHostAddr(void) const
69 {
70 if (ourFCMGuid==0)
71 return UNASSIGNED_SYSTEM_ADDRESS;
72 return rakPeerInterface->GetSystemAddressFromGuid(hostRakNetGuid);
73 }
74 RakNetGUID FullyConnectedMesh2::GetHostSystem(void) const
75 {
76 if (ourFCMGuid==0)
77 return rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
78
79 return hostRakNetGuid;
80 }
81 bool FullyConnectedMesh2::IsHostSystem(void) const
82 {
83 return GetHostSystem()==rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
84 }
85 void FullyConnectedMesh2::GetHostOrder(DataStructures::List<RakNetGUID> &hostList)
86 {
87 hostList.Clear(true, _FILE_AND_LINE_);
88
89 if (ourFCMGuid==0 || fcm2ParticipantList.Size()==0)
90 {
91 hostList.Push(rakPeerInterface->GetMyGUID(), _FILE_AND_LINE_);
92 return;
93 }
94
95 FCM2Participant fcm2;
96 fcm2.fcm2Guid=ourFCMGuid;
97 fcm2.rakNetGuid=rakPeerInterface->GetMyGUID();
98
99 DataStructures::OrderedList<FCM2Participant*, FCM2Participant*, FCM2ParticipantComp> olist;
100 olist.Insert(&fcm2, &fcm2, true, _FILE_AND_LINE_);
101 for (unsigned int i=0; i < fcm2ParticipantList.Size(); i++)
102 olist.Insert(fcm2ParticipantList[i], fcm2ParticipantList[i], true, _FILE_AND_LINE_);
103
104 for (unsigned int i=0; i < olist.Size(); i++)
105 {
106 hostList.Push(olist[i]->rakNetGuid, _FILE_AND_LINE_);
107 }
108 }
109 bool FullyConnectedMesh2::IsConnectedHost(void) const
110 {
111 return GetConnectedHost()==rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
112 }
113 void FullyConnectedMesh2::SetAutoparticipateConnections(bool b)
114 {
115 autoParticipateConnections=b;
116 }
117 void FullyConnectedMesh2::ResetHostCalculation(void)
118 {
119 hostRakNetGuid=UNASSIGNED_RAKNET_GUID;
120 startupTime= SLNet::GetTimeUS();
121 totalConnectionCount=0;
122 ourFCMGuid=0;
123 for (unsigned int i=0; i < fcm2ParticipantList.Size(); i++)
124 SendFCMGuidRequest(fcm2ParticipantList[i]->rakNetGuid);
125 }
126 // bool FullyConnectedMesh2::AddParticipantInternal( RakNetGUID rakNetGuid, FCM2Guid theirFCMGuid, BitStream *userContext )
127 bool FullyConnectedMesh2::AddParticipantInternal( RakNetGUID rakNetGuid, FCM2Guid theirFCMGuid )
128 {
129 for (unsigned int i=0; i < fcm2ParticipantList.Size(); i++)
130 {
131 if (fcm2ParticipantList[i]->rakNetGuid==rakNetGuid)
132 {
133 if (theirFCMGuid!=0)
134 fcm2ParticipantList[i]->fcm2Guid=theirFCMGuid;
135 /*
136 fcm2ParticipantList[i]->userContext.Reset();
137 if (userContext)
138 {
139 userContext->ResetReadPointer();
140 fcm2ParticipantList[i]->userContext.Write(userContext);
141 }
142 */
143 return false;
144 }
145 }
146
147 FCM2Participant *participant = SLNet::OP_NEW<FCM2Participant>(_FILE_AND_LINE_);
148 participant->rakNetGuid=rakNetGuid;
149 participant->fcm2Guid=theirFCMGuid;
150 /*
151 if (userContext)
152 {
153 userContext->ResetReadPointer();
154 participant->userContext.Write(userContext);
155 }
156 */
157 fcm2ParticipantList.Push(participant,_FILE_AND_LINE_);
158
159 SendFCMGuidRequest(rakNetGuid);
160
161 return true;
162 }
163 void FullyConnectedMesh2::AddParticipant( RakNetGUID rakNetGuid )
164 {
165 if (rakPeerInterface->GetConnectionState(rakPeerInterface->GetSystemAddressFromGuid(rakNetGuid))!=IS_CONNECTED)
166 {
167 #ifdef DEBUG_FCM2
168 printf("AddParticipant to %s failed (not connected)\n", rakNetGuid.ToString());
169 #endif
170 return;
171 }
172
173 // Need to query other system for userdata before calling AddParticipantInternal
174 // But maybe I can call with no data, and piggyback on ID_FCM2_REQUEST_FCMGUID
175 //AddParticipantInternal(rakNetGuid,0,0);
176 AddParticipantInternal(rakNetGuid,0);
177 }
178 void FullyConnectedMesh2::GetParticipantList(DataStructures::List<RakNetGUID> &participantList)
179 {
180 participantList.Clear(true, _FILE_AND_LINE_);
181 unsigned int i;
182 for (i=0; i < fcm2ParticipantList.Size(); i++)
183 participantList.Push(fcm2ParticipantList[i]->rakNetGuid, _FILE_AND_LINE_);
184 }
185 bool FullyConnectedMesh2::HasParticipant(RakNetGUID participantGuid)
186 {
187 unsigned int i;
188 for (i=0; i < fcm2ParticipantList.Size(); i++)
189 {
190 if (fcm2ParticipantList[i]->rakNetGuid==participantGuid)
191 return true;
192 }
193 return false;
194 }
195 /*
196 bool FullyConnectedMesh2::GetParticipantContext(RakNetGUID participantGuid, BitStream *userContext)
197 {
198 unsigned int i;
199 for (i=0; i < fcm2ParticipantList.Size(); i++)
200 {
201 if (fcm2ParticipantList[i]->rakNetGuid==participantGuid)
202 {
203 if (fcm2ParticipantList[i]->userContext.GetNumberOfBitsUsed() > 0)
204 {
205 userContext->Write(fcm2ParticipantList[i]->userContext);
206 fcm2ParticipantList[i]->userContext.ResetReadPointer();
207 return true;
208 }
209 return false;
210 }
211 }
212 return false;
213 }
214 void FullyConnectedMesh2::SetMyContext(BitStream *userContext)
215 {
216 if (userContext==0)
217 {
218 if (myContext.GetNumberOfBitsUsed()==0)
219 return;
220 myContext.Reset();
221 }
222 else
223 {
224 myContext.Write(userContext);
225 userContext->ResetReadPointer();
226 }
227
228 SLNet::BitStream bsOut;
229 bsOut.Write((MessageID)ID_FCM2_UPDATE_USER_CONTEXT);
230 bsOut.Write(myContext);
231 myContext.ResetReadPointer();
232
233 unsigned int idx;
234 for (idx=0; idx < fcm2ParticipantList.Size(); idx++)
235 {
236 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,fcm2ParticipantList[idx]->rakNetGuid,false);
237 }
238 }
239 */
240 PluginReceiveResult FullyConnectedMesh2::OnReceive(Packet *packet)
241 {
242 switch (packet->data[0])
243 {
244 case ID_REMOTE_NEW_INCOMING_CONNECTION:
245 {
246 if (connectOnNewRemoteConnections)
247 ConnectToRemoteNewIncomingConnections(packet);
248 }
249 break;
250 case ID_FCM2_REQUEST_FCMGUID:
251 OnRequestFCMGuid(packet);
252 return RR_STOP_PROCESSING_AND_DEALLOCATE;
253 //case ID_FCM2_UPDATE_USER_CONTEXT:
254 // OnUpdateUserContext(packet);
255 // return RR_STOP_PROCESSING_AND_DEALLOCATE;
256 case ID_FCM2_RESPOND_CONNECTION_COUNT:
257 OnRespondConnectionCount(packet);
258 return RR_STOP_PROCESSING_AND_DEALLOCATE;
259 case ID_FCM2_INFORM_FCMGUID:
260 OnInformFCMGuid(packet);
261 return RR_STOP_PROCESSING_AND_DEALLOCATE;
262 case ID_FCM2_UPDATE_MIN_TOTAL_CONNECTION_COUNT:
263 OnUpdateMinTotalConnectionCount(packet);
264 return RR_STOP_PROCESSING_AND_DEALLOCATE;
265 case ID_FCM2_NEW_HOST:
266 if (packet->wasGeneratedLocally==false)
267 return RR_STOP_PROCESSING_AND_DEALLOCATE;
268 break;
269 case ID_FCM2_VERIFIED_JOIN_START:
270 return OnVerifiedJoinStart(packet);
271 case ID_FCM2_VERIFIED_JOIN_CAPABLE:
272 return OnVerifiedJoinCapable(packet);
273 case ID_FCM2_VERIFIED_JOIN_FAILED:
274 OnVerifiedJoinFailed(packet->guid, true);
275 return RR_CONTINUE_PROCESSING;
276 case ID_FCM2_VERIFIED_JOIN_ACCEPTED:
277 if (packet->wasGeneratedLocally==false)
278 OnVerifiedJoinAccepted(packet);
279 return RR_CONTINUE_PROCESSING;
280 case ID_FCM2_VERIFIED_JOIN_REJECTED:
281 OnVerifiedJoinRejected(packet);
282 return RR_CONTINUE_PROCESSING;
283
284 case ID_NAT_TARGET_UNRESPONSIVE:
285 case ID_NAT_TARGET_NOT_CONNECTED:
286 case ID_NAT_CONNECTION_TO_TARGET_LOST:
287 {
288 SLNet::RakNetGUID g;
289 SLNet::BitStream b(packet->data, packet->length, false);
290 b.IgnoreBits(8); // Ignore the ID_...
291 b.Read(g);
292 UpdateVerifiedJoinInProgressMember(g, UNASSIGNED_RAKNET_GUID, JIPS_FAILED);
293 return RR_CONTINUE_PROCESSING;
294 }
295 case ID_NAT_PUNCHTHROUGH_FAILED:
296 UpdateVerifiedJoinInProgressMember(packet->guid, UNASSIGNED_RAKNET_GUID, JIPS_FAILED);
297 return RR_CONTINUE_PROCESSING;
298 }
299
300 return RR_CONTINUE_PROCESSING;
301 }
302 void FullyConnectedMesh2::OnRakPeerStartup(void)
303 {
304 Clear();
305 startupTime= SLNet::GetTimeUS();
306 }
307 void FullyConnectedMesh2::OnAttach(void)
308 {
309 Clear();
310 // In case Startup() was called first
311 if (rakPeerInterface->IsActive())
312 startupTime= SLNet::GetTimeUS();
313 }
314 void FullyConnectedMesh2::OnRakPeerShutdown(void)
315 {
316 Clear();
317 startupTime=0;
318 }
319 void FullyConnectedMesh2::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
320 {
321 (void) lostConnectionReason;
322 (void) systemAddress;
323 (void) rakNetGUID;
324
325 unsigned int idx;
326 idx=0;
327 while (idx < joinsInProgress.Size())
328 {
329 if (joinsInProgress[idx]->requester==rakNetGUID)
330 {
331 Packet *p = AllocatePacketUnified(sizeof(MessageID)+sizeof(unsigned char));
332 p->data[0]=ID_FCM2_VERIFIED_JOIN_FAILED;
333 p->systemAddress=systemAddress;
334 p->systemAddress.systemIndex=(SystemIndex)-1;
335 p->guid=rakNetGUID;
336 p->wasGeneratedLocally=true;
337 rakPeerInterface->PushBackPacket(p, true);
338
339 for (unsigned int j=0; j < joinsInProgress[idx]->vjipMembers.Size(); j++)
340 {
341 if ( joinsInProgress[idx]->vjipMembers[j].userData != 0)
342 {
343 SLNet::OP_DELETE(joinsInProgress[idx]->vjipMembers[j].userData, _FILE_AND_LINE_);
344 }
345 }
346
347 SLNet::OP_DELETE(joinsInProgress[idx], _FILE_AND_LINE_);
348 joinsInProgress.RemoveAtIndex(idx);
349 }
350 else
351 {
352 idx++;
353 }
354 }
355
356 UpdateVerifiedJoinInProgressMember(rakNetGUID, UNASSIGNED_RAKNET_GUID, JIPS_FAILED);
357
358 for (idx=0; idx < fcm2ParticipantList.Size(); idx++)
359 {
360 if (fcm2ParticipantList[idx]->rakNetGuid==rakNetGUID)
361 {
362 fcm2ParticipantList[idx]=fcm2ParticipantList[fcm2ParticipantList.Size()-1];
363 #ifdef DEBUG_FCM2
364 printf("Popping participant %s\n", fcm2ParticipantList[fcm2ParticipantList.Size()-1].rakNetGuid.ToString());
365 #endif
366
367 fcm2ParticipantList.Pop();
368 if (rakNetGUID==hostRakNetGuid && ourFCMGuid!=0)
369 {
370 if (fcm2ParticipantList.Size()==0)
371 {
372 hostRakNetGuid=rakPeerInterface->GetMyGUID();
373 hostFCM2Guid=ourFCMGuid;
374 }
375 else
376 {
377 CalculateHost(&hostRakNetGuid, &hostFCM2Guid);
378 }
379 PushNewHost(hostRakNetGuid, rakNetGUID);
380 }
381 return;
382 }
383 }
384
385 }
386 SLNet::TimeUS FullyConnectedMesh2::GetElapsedRuntime(void)
387 {
388 SLNet::TimeUS curTime= SLNet::GetTimeUS();
389 if (curTime>startupTime)
390 return curTime-startupTime;
391 else
392 return 0;
393 }
394 void FullyConnectedMesh2::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
395 {
396 (void) isIncoming;
397 (void) rakNetGUID;
398 (void) systemAddress;
399
400 UpdateVerifiedJoinInProgressMember(rakNetGUID, rakNetGUID, JIPS_CONNECTED);
401
402 if (autoParticipateConnections)
403 AddParticipant(rakNetGUID);
404 }
405 void FullyConnectedMesh2::OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
406 {
407 if (failedConnectionAttemptReason==FCAR_ALREADY_CONNECTED)
408 {
409 UpdateVerifiedJoinInProgressMember(packet->guid, packet->guid, JIPS_CONNECTED);
410 }
411 else
412 {
413 UpdateVerifiedJoinInProgressMember(packet->systemAddress, UNASSIGNED_RAKNET_GUID, JIPS_FAILED);
414 }
415 }
416 void FullyConnectedMesh2::Clear(void)
417 {
418 for (unsigned int i=0; i < fcm2ParticipantList.Size(); i++)
419 {
420 SLNet::OP_DELETE(fcm2ParticipantList[i], _FILE_AND_LINE_);
421 }
422 fcm2ParticipantList.Clear(false, _FILE_AND_LINE_);
423
424 for (unsigned int i=0; i < joinsInProgress.Size(); i++)
425 {
426 for (unsigned int j=0; j < joinsInProgress[i]->vjipMembers.Size(); j++)
427 {
428 if ( joinsInProgress[i]->vjipMembers[j].userData != 0)
429 {
430 SLNet::OP_DELETE(joinsInProgress[i]->vjipMembers[j].userData, _FILE_AND_LINE_);
431 }
432 }
433
434 SLNet::OP_DELETE(joinsInProgress[i], _FILE_AND_LINE_);
435 }
436 joinsInProgress.Clear(true, _FILE_AND_LINE_);
437
438 totalConnectionCount=0;
439 ourFCMGuid=0;
440 lastPushedHost=UNASSIGNED_RAKNET_GUID;
441 }
442 void FullyConnectedMesh2::PushNewHost(const RakNetGUID &guid, RakNetGUID oldHost)
443 {
444 Packet *p = AllocatePacketUnified(sizeof(MessageID)+sizeof(oldHost));
445 SLNet::BitStream bs(p->data,p->length,false);
446 bs.SetWriteOffset(0);
447 bs.Write((MessageID)ID_FCM2_NEW_HOST);
448 bs.Write(oldHost);
449 p->systemAddress=rakPeerInterface->GetSystemAddressFromGuid(guid);
450 p->systemAddress.systemIndex=(SystemIndex)-1;
451 p->guid=guid;
452 p->wasGeneratedLocally=true;
453 rakPeerInterface->PushBackPacket(p, true);
454
455 lastPushedHost=guid;
456 }
457 void FullyConnectedMesh2::SendFCMGuidRequest(RakNetGUID rakNetGuid)
458 {
459 if (rakNetGuid==rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS))
460 return;
461
462 SLNet::BitStream bsOut;
463 bsOut.Write((MessageID)ID_FCM2_REQUEST_FCMGUID);
464 if (ourFCMGuid==0)
465 {
466 bsOut.Write(false);
467 bsOut.Write(GetElapsedRuntime());
468 }
469 else
470 {
471 bsOut.Write(true);
472 bsOut.Write(totalConnectionCount);
473 bsOut.Write(ourFCMGuid);
474 }
475 bsOut.Write(myContext);
476 myContext.ResetReadPointer();
477 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,rakNetGuid,false);
478 }
479 void FullyConnectedMesh2::SendOurFCMGuid(SystemAddress addr)
480 {
481 SLNet::BitStream bsOut;
482 bsOut.Write((MessageID)ID_FCM2_INFORM_FCMGUID);
483 RakAssert(ourFCMGuid!=0); // Can't inform others of our FCM2Guid if it's unset!
484 bsOut.Write(ourFCMGuid);
485 bsOut.Write(totalConnectionCount);
486 bsOut.Write(myContext);
487 myContext.ResetReadPointer();
488 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,addr,false);
489 }
490 void FullyConnectedMesh2::SendConnectionCountResponse(SystemAddress addr, unsigned int responseTotalConnectionCount)
491 {
492 SLNet::BitStream bsOut;
493 bsOut.Write((MessageID)ID_FCM2_RESPOND_CONNECTION_COUNT);
494 bsOut.Write(responseTotalConnectionCount);
495 //bsOut.Write(myContext);
496 //myContext.ResetReadPointer();
497 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,addr,false);
498 }
499 void FullyConnectedMesh2::AssignOurFCMGuid(void)
500 {
501 // Only assigned once ever
502 RakAssert(ourFCMGuid==0);
503 unsigned int randomNumber = randomMT();
504 randomNumber ^= (unsigned int) (SLNet::GetTimeUS() & 0xFFFFFFFF);
505 randomNumber ^= (unsigned int) (rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS).g & 0xFFFFFFFF);
506 ourFCMGuid |= randomNumber;
507 uint64_t reponse64 = totalConnectionCount;
508 ourFCMGuid |= reponse64<<32;
509 }
510 void FullyConnectedMesh2::CalculateHost(RakNetGUID *rakNetGuid, FCM2Guid *fcm2Guid)
511 {
512 // Can't calculate host without knowing our own
513 RakAssert(ourFCMGuid!=0);
514
515 // Can't calculate host without being connected to anyone else
516 RakAssert(fcm2ParticipantList.Size()>0);
517
518 // Return the lowest value of all FCM2Guid
519 FCM2Guid lowestFCMGuid=ourFCMGuid;
520 // SystemAddress associatedSystemAddress=UNASSIGNED_SYSTEM_ADDRESS;
521 RakNetGUID associatedRakNetGuid=rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
522
523 unsigned int idx;
524 for (idx=0; idx < fcm2ParticipantList.Size(); idx++)
525 {
526 if (fcm2ParticipantList[idx]->fcm2Guid!=0 && fcm2ParticipantList[idx]->fcm2Guid<lowestFCMGuid)
527 {
528 lowestFCMGuid=fcm2ParticipantList[idx]->fcm2Guid;
529 associatedRakNetGuid=fcm2ParticipantList[idx]->rakNetGuid;
530 }
531 }
532
533 *rakNetGuid=associatedRakNetGuid;
534 *fcm2Guid=lowestFCMGuid;
535 }
536 void FullyConnectedMesh2::OnRequestFCMGuid(Packet *packet)
537 {
538 SLNet::BitStream bsIn(packet->data,packet->length,false);
539 bsIn.IgnoreBytes(sizeof(MessageID));
540 bool hasRemoteFCMGuid=false;
541 bsIn.Read(hasRemoteFCMGuid);
542 SLNet::TimeUS senderElapsedRuntime=0;
543 unsigned int remoteTotalConnectionCount=0;
544 FCM2Guid theirFCMGuid=0;
545 if (hasRemoteFCMGuid)
546 {
547 bsIn.Read(remoteTotalConnectionCount);
548 bsIn.Read(theirFCMGuid);
549 }
550 else
551 {
552 bsIn.Read(senderElapsedRuntime);
553 }
554 /*
555 BitStream remoteContext;
556 bsIn.Read(remoteContext);
557 AddParticipantInternal(packet->guid,theirFCMGuid, &remoteContext);
558 */
559 AddParticipantInternal(packet->guid,theirFCMGuid);
560 if (ourFCMGuid==0)
561 {
562 if (hasRemoteFCMGuid==false)
563 {
564 // Nobody has a fcmGuid
565
566 SLNet::TimeUS ourElapsedRuntime = GetElapsedRuntime();
567 if (ourElapsedRuntime>senderElapsedRuntime)
568 {
569 // We are probably host
570 SendConnectionCountResponse(packet->systemAddress, 2);
571 }
572 else
573 {
574 // They are probably host
575 SendConnectionCountResponse(packet->systemAddress, 1);
576 }
577 }
578 else
579 {
580 // They have a fcmGuid, we do not
581 IncrementTotalConnectionCount(remoteTotalConnectionCount+1);
582
583 AssignOurFCMGuid();
584 unsigned int idx;
585 for (idx=0; idx < fcm2ParticipantList.Size(); idx++)
586 SendOurFCMGuid(rakPeerInterface->GetSystemAddressFromGuid(fcm2ParticipantList[idx]->rakNetGuid));
587 }
588 }
589 else
590 {
591 if (hasRemoteFCMGuid==false)
592 {
593 // We have a fcmGuid they do not
594 SendConnectionCountResponse(packet->systemAddress, totalConnectionCount+1);
595 }
596 else
597 {
598 // We both have fcmGuids
599 IncrementTotalConnectionCount(remoteTotalConnectionCount);
600
601 SendOurFCMGuid(packet->systemAddress);
602 }
603 }
604 CalculateAndPushHost();
605 }
606 /*
607 void FullyConnectedMesh2::OnUpdateUserContext(Packet *packet)
608 {
609 SLNet::BitStream bsIn(packet->data,packet->length,false);
610 bsIn.IgnoreBytes(sizeof(MessageID));
611 BitStream remoteContext;
612 bsIn.Read(remoteContext);
613
614 for (unsigned int i=0; i < fcm2ParticipantList.Size(); i++)
615 {
616 if (fcm2ParticipantList[i]->rakNetGuid==packet->guid)
617 {
618 fcm2ParticipantList[i]->userContext.Reset();
619 remoteContext.Read(fcm2ParticipantList[i]->userContext);
620 break;
621 }
622 }
623 }
624 */
625 void FullyConnectedMesh2::OnRespondConnectionCount(Packet *packet)
626 {
627 SLNet::BitStream bsIn(packet->data,packet->length,false);
628 bsIn.IgnoreBytes(sizeof(MessageID));
629 unsigned int responseTotalConnectionCount;
630 bsIn.Read(responseTotalConnectionCount);
631 /*
632 BitStream remoteContext;
633 bsIn.Read(remoteContext);
634
635 for (unsigned int i=0; i < fcm2ParticipantList.Size(); i++)
636 {
637 if (fcm2ParticipantList[i]->rakNetGuid==packet->guid)
638 {
639 fcm2ParticipantList[i]->userContext.Reset();
640 remoteContext.Read(fcm2ParticipantList[i]->userContext);
641 break;
642 }
643 }
644 */
645
646 IncrementTotalConnectionCount(responseTotalConnectionCount);
647 bool wasAssigned;
648 if (ourFCMGuid==0)
649 {
650 wasAssigned=true;
651 AssignOurFCMGuid();
652 }
653 else
654 wasAssigned=false;
655
656 // 1 is returned to give us lower priority, but the actual minimum is 2
657 IncrementTotalConnectionCount(2);
658
659 if (wasAssigned==true)
660 {
661 unsigned int idx;
662 for (idx=0; idx < fcm2ParticipantList.Size(); idx++)
663 SendOurFCMGuid(rakPeerInterface->GetSystemAddressFromGuid(fcm2ParticipantList[idx]->rakNetGuid));
664 CalculateAndPushHost();
665 }
666 }
667 void FullyConnectedMesh2::OnInformFCMGuid(Packet *packet)
668 {
669 SLNet::BitStream bsIn(packet->data,packet->length,false);
670 bsIn.IgnoreBytes(sizeof(MessageID));
671
672 FCM2Guid theirFCMGuid;
673 unsigned int theirTotalConnectionCount;
674 bsIn.Read(theirFCMGuid);
675 bsIn.Read(theirTotalConnectionCount);
676
677 BitStream remoteContext;
678 bsIn.Read(remoteContext);
679
680 IncrementTotalConnectionCount(theirTotalConnectionCount);
681
682 //if (AddParticipantInternal(packet->guid,theirFCMGuid, &remoteContext))
683 if (AddParticipantInternal(packet->guid,theirFCMGuid))
684 {
685 // 1/19/2010 - Relay increased total connection count in case new participant only connects to part of the mesh
686 unsigned int idx;
687 SLNet::BitStream bsOut;
688 bsOut.Write((MessageID)ID_FCM2_UPDATE_MIN_TOTAL_CONNECTION_COUNT);
689 bsOut.Write(totalConnectionCount);
690 for (idx=0; idx < fcm2ParticipantList.Size(); idx++)
691 {
692 if (packet->guid!=fcm2ParticipantList[idx]->rakNetGuid)
693 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,fcm2ParticipantList[idx]->rakNetGuid,false);
694 }
695 }
696
697 if (ourFCMGuid==0)
698 {
699 AssignOurFCMGuid();
700 unsigned int idx;
701 for (idx=0; idx < fcm2ParticipantList.Size(); idx++)
702 SendOurFCMGuid(rakPeerInterface->GetSystemAddressFromGuid(fcm2ParticipantList[idx]->rakNetGuid));
703 }
704
705 CalculateAndPushHost();
706 }
707 void FullyConnectedMesh2::OnUpdateMinTotalConnectionCount(Packet *packet)
708 {
709 SLNet::BitStream bsIn(packet->data,packet->length,false);
710 bsIn.IgnoreBytes(sizeof(MessageID));
711 unsigned int newMin;
712 bsIn.Read(newMin);
713 IncrementTotalConnectionCount(newMin);
714 }
715 void FullyConnectedMesh2::GetParticipantCount(unsigned int *participantListSize) const
716 {
717 *participantListSize=fcm2ParticipantList.Size();
718 }
719
720 unsigned int FullyConnectedMesh2::GetParticipantCount(void) const
721 {
722 return fcm2ParticipantList.Size();
723 }
724 void FullyConnectedMesh2::CalculateAndPushHost(void)
725 {
726 RakNetGUID newHostGuid;
727 FCM2Guid newFcmGuid;
728 if (ParticipantListComplete())
729 {
730 CalculateHost(&newHostGuid, &newFcmGuid);
731 if (newHostGuid!=lastPushedHost)
732 {
733 hostRakNetGuid=newHostGuid;
734 hostFCM2Guid=newFcmGuid;
735 PushNewHost(hostRakNetGuid, lastPushedHost);
736 }
737 }
738 }
739 bool FullyConnectedMesh2::ParticipantListComplete(void)
740 {
741 for (unsigned int i=0; i < fcm2ParticipantList.Size(); i++)
742 {
743 if (fcm2ParticipantList[i]->fcm2Guid==0)
744 return false;
745 }
746 return true;
747 }
748 void FullyConnectedMesh2::IncrementTotalConnectionCount(unsigned int i)
749 {
750 if (i>totalConnectionCount)
751 {
752 totalConnectionCount=i;
753 // printf("totalConnectionCount=%i\n",i);
754 }
755 }
756 void FullyConnectedMesh2::SetConnectOnNewRemoteConnection(bool attemptConnection, SLNet::RakString pw)
757 {
758 connectOnNewRemoteConnections=attemptConnection;
759 connectionPassword=pw;
760 }
761
762 void FullyConnectedMesh2::ConnectToRemoteNewIncomingConnections(Packet *packet)
763 {
764 unsigned int count;
765 SLNet::BitStream bsIn(packet->data, packet->length, false);
766 bsIn.IgnoreBytes(sizeof(MessageID));
767 bsIn.Read(count);
768 SystemAddress remoteAddress;
769 RakNetGUID remoteGuid;
770 char str[64];
771 for (unsigned int i=0; i < count; i++)
772 {
773 bsIn.Read(remoteAddress);
774 bsIn.Read(remoteGuid);
775 remoteAddress.ToString(false,str,static_cast<size_t>(64));
776 rakPeerInterface->Connect(str,remoteAddress.GetPort(),connectionPassword.C_String(),(int) connectionPassword.GetLength());
777 }
778 }
779 unsigned int FullyConnectedMesh2::GetTotalConnectionCount(void) const
780 {
781 return totalConnectionCount;
782 }
783 void FullyConnectedMesh2::StartVerifiedJoin(RakNetGUID client)
784 {
785 // Assert is because there is no point calling StartVerifiedJoin() if this client is already a participant
786 RakAssert(HasParticipant(client)==false);
787 RakAssert(client!=rakPeerInterface->GetMyGUID());
788
789 BitStream bsOut;
790 bsOut.Write((MessageID) ID_FCM2_VERIFIED_JOIN_START);
791 bsOut.WriteCasted<unsigned short>(fcm2ParticipantList.Size());
792 unsigned int i;
793 for (i=0; i < fcm2ParticipantList.Size(); i++)
794 {
795 bsOut.Write(fcm2ParticipantList[i]->rakNetGuid);
796 bsOut.Write(rakPeerInterface->GetSystemAddressFromGuid(fcm2ParticipantList[i]->rakNetGuid));
797
798 BitStream vjsOut;
799 //WriteVJSUserData(&vjsOut, fcm2ParticipantList[i]->rakNetGuid, &fcm2ParticipantList[i]->userContext );
800 WriteVJSUserData(&vjsOut, fcm2ParticipantList[i]->rakNetGuid );
801 bsOut.Write(vjsOut.GetNumberOfBitsUsed());
802 bsOut.Write(&vjsOut);
803 bsOut.AlignWriteToByteBoundary();
804 }
805 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, client, false);
806 }
807 void FullyConnectedMesh2::RespondOnVerifiedJoinCapable(Packet *packet, bool accept, BitStream *additionalData)
808 {
809 VerifiedJoinInProgress vjip;
810 DecomposeJoinCapable(packet, &vjip);
811
812 DataStructures::List<RakNetGUID> participatingMembersOnClientSucceeded;
813 DataStructures::List<RakNetGUID> participatingMembersOnClientFailed;
814 DataStructures::List<RakNetGUID> participatingMembersNotOnClient;
815 DataStructures::List<RakNetGUID> clientMembersNotParticipatingSucceeded;
816 DataStructures::List<RakNetGUID> clientMembersNotParticipatingFailed;
817 CategorizeVJIP(&vjip,
818 participatingMembersOnClientSucceeded,
819 participatingMembersOnClientFailed,
820 participatingMembersNotOnClient,
821 clientMembersNotParticipatingSucceeded,
822 clientMembersNotParticipatingFailed);
823
824 if (participatingMembersNotOnClient.Size()>0)
825 {
826 BitStream bsOut;
827 bsOut.Write((MessageID) ID_FCM2_VERIFIED_JOIN_START);
828 bsOut.WriteCasted<unsigned short>(participatingMembersNotOnClient.Size());
829 unsigned int i;
830 for (i=0; i < participatingMembersNotOnClient.Size(); i++)
831 {
832 bsOut.Write(participatingMembersNotOnClient[i]);
833 bsOut.Write(rakPeerInterface->GetSystemAddressFromGuid(participatingMembersNotOnClient[i]));
834
835 bool written=false;
836 for (unsigned int j=0; j < fcm2ParticipantList.Size(); j++)
837 {
838 if (fcm2ParticipantList[j]->rakNetGuid == participatingMembersNotOnClient[i])
839 {
840 written=true;
841
842 BitStream vjsOut;
843 //WriteVJSUserData(&vjsOut, fcm2ParticipantList[j]->rakNetGuid, &fcm2ParticipantList[j]->userContext );
844 WriteVJSUserData(&vjsOut, fcm2ParticipantList[j]->rakNetGuid );
845 bsOut.Write(vjsOut.GetNumberOfBitsUsed());
846 bsOut.Write(&vjsOut);
847 bsOut.AlignWriteToByteBoundary();
848 break;
849 }
850 }
851 RakAssert(written==true);
852 }
853 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
854 return;
855 }
856
857 RakAssert(participatingMembersOnClientFailed.Size()==0);
858 RakAssert(participatingMembersNotOnClient.Size()==0);
859
860 SLNet::BitStream bsOut;
861 if (accept)
862 {
863 bsOut.Write((MessageID)ID_FCM2_VERIFIED_JOIN_ACCEPTED);
864 bsOut.Write(packet->guid);
865
866 // Tell client to disconnect from clientMembersNotParticipatingSucceeded
867 bsOut.WriteCasted<unsigned short>(clientMembersNotParticipatingSucceeded.Size());
868 for (unsigned int i=0; i < clientMembersNotParticipatingSucceeded.Size(); i++)
869 bsOut.Write(clientMembersNotParticipatingSucceeded[i]);
870
871 // Tell client to call AddParticipant() for participatingMembersOnClientSucceeded
872 bsOut.WriteCasted<unsigned short>(participatingMembersOnClientSucceeded.Size());
873 for (unsigned int i=0; i < participatingMembersOnClientSucceeded.Size(); i++)
874 bsOut.Write(participatingMembersOnClientSucceeded[i]);
875
876 if (additionalData)
877 bsOut.Write(additionalData);
878
879 for (unsigned int i=0; i < fcm2ParticipantList.Size(); i++)
880 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, fcm2ParticipantList[i]->rakNetGuid, false);
881
882 // Process immediately
883 // This is so if another ID_FCM2_VERIFIED_JOIN_CAPABLE is buffered, it responds with ID_FCM2_VERIFIED_JOIN_START
884 AddParticipant(packet->guid);
885
886 Packet *p = AllocatePacketUnified(bsOut.GetNumberOfBytesUsed());
887 memcpy(p->data, bsOut.GetData(), bsOut.GetNumberOfBytesUsed());
888 p->systemAddress=packet->systemAddress;
889 p->systemAddress.systemIndex=(SystemIndex)-1;
890 p->guid=packet->guid;
891 p->wasGeneratedLocally=true;
892 rakPeerInterface->PushBackPacket(p, true);
893 }
894 else
895 {
896 // Tell client rejected, otherwise process the same as ID_FCM2_VERIFIED_JOIN_FAILED
897 bsOut.Write((MessageID)ID_FCM2_VERIFIED_JOIN_REJECTED);
898 if (additionalData)
899 bsOut.Write(additionalData);
900 }
901
902 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
903 }
904 void FullyConnectedMesh2::GetVerifiedJoinRequiredProcessingList(RakNetGUID host, DataStructures::List<SystemAddress> &addresses, DataStructures::List<RakNetGUID> &guids, DataStructures::List<BitStream*> &userData)
905 {
906 addresses.Clear(true, _FILE_AND_LINE_);
907 guids.Clear(true, _FILE_AND_LINE_);
908
909 unsigned int curIndex = GetJoinsInProgressIndex(host);
910 if (curIndex!=(unsigned int) -1)
911 {
912 VerifiedJoinInProgress *vjip = joinsInProgress[curIndex];
913 unsigned int j;
914 for (j=0; j < vjip->vjipMembers.Size(); j++)
915 {
916 if (vjip->vjipMembers[j].joinInProgressState==JIPS_PROCESSING)
917 {
918 addresses.Push(vjip->vjipMembers[j].systemAddress, _FILE_AND_LINE_);
919 guids.Push(vjip->vjipMembers[j].guid, _FILE_AND_LINE_);
920 userData.Push(vjip->vjipMembers[j].userData, _FILE_AND_LINE_);
921 }
922 }
923 }
924 }
925 void FullyConnectedMesh2::GetVerifiedJoinAcceptedAdditionalData(Packet *packet, bool *thisSystemAccepted, DataStructures::List<RakNetGUID> &systemsAccepted, BitStream *additionalData)
926 {
927 systemsAccepted.Clear(true, _FILE_AND_LINE_);
928
929 SLNet::BitStream bsIn(packet->data, packet->length, false);
930 bsIn.IgnoreBytes(sizeof(MessageID));
931 RakNetGUID systemToAddGuid;
932 bsIn.Read(systemToAddGuid);
933 *thisSystemAccepted = systemToAddGuid == rakPeerInterface->GetMyGUID();
934 unsigned short listSize;
935 bsIn.Read(listSize);
936 bsIn.IgnoreBytes(listSize*RakNetGUID::size());
937 bsIn.Read(listSize);
938 if (systemToAddGuid==rakPeerInterface->GetMyGUID())
939 {
940 for (unsigned short i=0; i < listSize; i++)
941 {
942 bsIn.Read(systemToAddGuid);
943 systemsAccepted.Push(systemToAddGuid, _FILE_AND_LINE_);
944 }
945 systemsAccepted.Push(packet->guid, _FILE_AND_LINE_);
946 }
947 else
948 {
949 systemsAccepted.Push(systemToAddGuid, _FILE_AND_LINE_);
950 bsIn.IgnoreBytes(listSize*RakNetGUID::size());
951 }
952 if (additionalData)
953 {
954 additionalData->Reset();
955 additionalData->Write(bsIn);
956 }
957 }
958 void FullyConnectedMesh2::GetVerifiedJoinRejectedAdditionalData(Packet *packet, BitStream *additionalData)
959 {
960 SLNet::BitStream bsIn(packet->data, packet->length, false);
961 bsIn.IgnoreBytes(sizeof(MessageID));
962 if (additionalData)
963 {
964 additionalData->Reset();
965 additionalData->Write(bsIn);
966 }
967 }
968 PluginReceiveResult FullyConnectedMesh2::OnVerifiedJoinStart(Packet *packet)
969 {
970 SLNet::BitStream bsIn(packet->data,packet->length,false);
971 bsIn.IgnoreBytes(sizeof(MessageID));
972
973 unsigned short listSize;
974 bsIn.Read(listSize);
975
976 unsigned int curIndex = GetJoinsInProgressIndex(packet->guid);
977 if (curIndex!=(unsigned int) -1)
978 {
979 // Got update to existing list
980
981 VerifiedJoinInProgress *vjip = joinsInProgress[curIndex];
982 // if (vjip->sentResults==false)
983 // {
984 // // Got ID_FCM2_VERIFIED_JOIN_START twice before sending ID_FCM2_VERIFIED_JOIN_CAPABLE
985 // RakAssert(vjip->sentResults!=false);
986 // return RR_STOP_PROCESSING_AND_DEALLOCATE;
987 // }
988
989 for (unsigned int i=0; i < vjip->vjipMembers.Size(); i++)
990 {
991 vjip->vjipMembers[i].workingFlag=false;
992 }
993
994 // Server has updated list of participants
995 for (unsigned short i=0; i < listSize; i++)
996 {
997 VerifiedJoinInProgressMember vjipm;
998 ReadVerifiedJoinInProgressMember(&bsIn, &vjipm);
999
1000 unsigned int j;
1001 if (vjipm.guid!=UNASSIGNED_RAKNET_GUID)
1002 j = GetVerifiedJoinInProgressMemberIndex(vjipm.guid, vjip);
1003 else
1004 j = GetVerifiedJoinInProgressMemberIndex(vjipm.systemAddress, vjip);
1005
1006 if (j==(unsigned int)-1)
1007 {
1008 // New
1009 vjipm.workingFlag=true;
1010
1011 // 11/13/2013 - ReadVerifiedJoinInProgressMember already sets joinInProgressState
1012 // http://www.jenkinssoftware.com/forum/index.php?topic=5211.0
1013 // vjipm.joinInProgressState=JIPS_PROCESSING;
1014 vjip->vjipMembers.Push(vjipm, _FILE_AND_LINE_);
1015
1016 // Allow resend of ID_FCM2_VERIFIED_JOIN_CAPABLE
1017 //vjip->sentResults=false;
1018 }
1019 else
1020 {
1021 vjip->vjipMembers[j].workingFlag=true;
1022 }
1023 }
1024
1025 for (unsigned int i=0; i < vjip->vjipMembers.Size(); i++)
1026 {
1027 if (vjip->vjipMembers[i].workingFlag==false)
1028 vjip->vjipMembers[i].joinInProgressState=JIPS_UNNECESSARY;
1029 }
1030
1031 if (ProcessVerifiedJoinInProgressIfCompleted(vjip))
1032 {
1033 // Completed
1034 return RR_STOP_PROCESSING_AND_DEALLOCATE;
1035 }
1036
1037 // Else tell user about new list
1038 return RR_CONTINUE_PROCESSING;
1039 }
1040
1041 VerifiedJoinInProgress *vjip = SLNet::OP_NEW<VerifiedJoinInProgress>(_FILE_AND_LINE_);
1042 vjip->requester=packet->guid;
1043 if (listSize==0)
1044 {
1045 //vjip->sentResults=true;
1046
1047 // Send back result
1048 SLNet::BitStream bsOut;
1049 bsOut.Write((MessageID)ID_FCM2_VERIFIED_JOIN_CAPABLE);
1050 bsOut.WriteCasted<unsigned short>(0);
1051 WriteVJCUserData(&bsOut);
1052 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
1053 //vjip->sentResults=true;
1054 joinsInProgress.Push(vjip, _FILE_AND_LINE_);
1055 return RR_STOP_PROCESSING_AND_DEALLOCATE;
1056 }
1057
1058 //vjip->sentResults=false;
1059
1060 for (unsigned short i=0; i < listSize; i++)
1061 {
1062 VerifiedJoinInProgressMember vjipm;
1063 ReadVerifiedJoinInProgressMember(&bsIn, &vjipm);
1064 vjip->vjipMembers.Push(vjipm, _FILE_AND_LINE_);
1065 }
1066
1067 joinsInProgress.Push(vjip, _FILE_AND_LINE_);
1068
1069 // 11/13/2013 - ReadVerifiedJoinInProgressMember may set JIPS_CONNECTED, so this may already be done
1070 // http://www.jenkinssoftware.com/forum/index.php?topic=5211.0
1071 if (ProcessVerifiedJoinInProgressIfCompleted(vjip))
1072 {
1073 // Completed
1074 return RR_STOP_PROCESSING_AND_DEALLOCATE;
1075 }
1076
1077 return RR_CONTINUE_PROCESSING;
1078 }
1079 void FullyConnectedMesh2::SkipToVJCUserData(SLNet::BitStream *bsIn)
1080 {
1081 bsIn->IgnoreBytes(sizeof(MessageID));
1082 unsigned short listSize;
1083 bsIn->Read(listSize);
1084 for (unsigned short i=0; i < listSize; i++)
1085 {
1086 bsIn->IgnoreBytes(RakNetGUID::size());
1087 bsIn->IgnoreBytes(SystemAddress::size());
1088 bsIn->IgnoreBytes(sizeof(unsigned char));
1089 }
1090 }
1091 void FullyConnectedMesh2::DecomposeJoinCapable(Packet *packet, VerifiedJoinInProgress *vjip)
1092 {
1093 SLNet::BitStream bsIn(packet->data,packet->length,false);
1094 bsIn.IgnoreBytes(sizeof(MessageID));
1095
1096 unsigned short listSize;
1097 bsIn.Read(listSize);
1098
1099 for (unsigned short i=0; i < listSize; i++)
1100 {
1101 VerifiedJoinInProgressMember member;
1102 bsIn.Read(member.guid);
1103 bsIn.Read(member.systemAddress);
1104 bsIn.ReadCasted<unsigned char>(member.joinInProgressState);
1105 member.userData = 0;
1106 member.workingFlag=false;
1107 vjip->vjipMembers.Push(member, _FILE_AND_LINE_);
1108 }
1109 }
1110 PluginReceiveResult FullyConnectedMesh2::OnVerifiedJoinCapable(Packet *packet)
1111 {
1112 VerifiedJoinInProgress vjip;
1113 DecomposeJoinCapable(packet, &vjip);
1114
1115 // If this assert hits, AddParticipant() was called on this system, or another system, which it should not have been.
1116 RakAssert(HasParticipant(packet->guid)==false);
1117
1118 DataStructures::List<RakNetGUID> participatingMembersOnClientSucceeded;
1119 DataStructures::List<RakNetGUID> participatingMembersOnClientFailed;
1120 DataStructures::List<RakNetGUID> participatingMembersNotOnClient;
1121 DataStructures::List<RakNetGUID> clientMembersNotParticipatingSucceeded;
1122 DataStructures::List<RakNetGUID> clientMembersNotParticipatingFailed;
1123 CategorizeVJIP(&vjip,
1124 participatingMembersOnClientSucceeded,
1125 participatingMembersOnClientFailed,
1126 participatingMembersNotOnClient,
1127 clientMembersNotParticipatingSucceeded,
1128 clientMembersNotParticipatingFailed);
1129
1130 if (participatingMembersOnClientFailed.Size()>0)
1131 {
1132 // Send ID_FCM2_VERIFIED_JOIN_FAILED with GUIDs to disconnect
1133 BitStream bsOut;
1134 bsOut.Write((MessageID) ID_FCM2_VERIFIED_JOIN_FAILED);
1135 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
1136 return RR_STOP_PROCESSING_AND_DEALLOCATE;
1137 }
1138
1139 if (participatingMembersNotOnClient.Size()>0)
1140 {
1141 BitStream bsOut;
1142 bsOut.Write((MessageID) ID_FCM2_VERIFIED_JOIN_START);
1143 bsOut.WriteCasted<unsigned short>(participatingMembersNotOnClient.Size());
1144 unsigned int i;
1145 for (i=0; i < participatingMembersNotOnClient.Size(); i++)
1146 {
1147 bsOut.Write(participatingMembersNotOnClient[i]);
1148 bsOut.Write(rakPeerInterface->GetSystemAddressFromGuid(participatingMembersNotOnClient[i]));
1149
1150 bool written=false;
1151 for (unsigned int j=0; j < fcm2ParticipantList.Size(); j++)
1152 {
1153 if (fcm2ParticipantList[j]->rakNetGuid == participatingMembersNotOnClient[i])
1154 {
1155 written=true;
1156
1157 BitStream vjsOut;
1158 //WriteVJSUserData(&vjsOut, fcm2ParticipantList[j]->rakNetGuid, &fcm2ParticipantList[j]->userContext );
1159 WriteVJSUserData(&vjsOut, fcm2ParticipantList[j]->rakNetGuid );
1160 bsOut.Write(vjsOut.GetNumberOfBitsUsed());
1161 bsOut.Write(&vjsOut);
1162 bsOut.AlignWriteToByteBoundary();
1163 break;
1164 }
1165 }
1166 RakAssert(written);
1167 }
1168 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
1169 return RR_STOP_PROCESSING_AND_DEALLOCATE;
1170 }
1171
1172 // Let server decide if to accept or reject via RespondOnVerifiedJoinCapable
1173 return RR_CONTINUE_PROCESSING;
1174 }
1175 void FullyConnectedMesh2::OnVerifiedJoinFailed(RakNetGUID hostGuid, bool callCloseConnection)
1176 {
1177 unsigned int curIndex = GetJoinsInProgressIndex(hostGuid);
1178 if (curIndex==(unsigned int) -1)
1179 return;
1180
1181 if (callCloseConnection)
1182 {
1183 VerifiedJoinInProgress *vjip = joinsInProgress[curIndex];
1184 for (unsigned int j=0; j < vjip->vjipMembers.Size(); j++)
1185 {
1186 if (vjip->vjipMembers[j].joinInProgressState!=JIPS_FAILED)
1187 {
1188 rakPeerInterface->CloseConnection(vjip->vjipMembers[j].guid, true);
1189 }
1190
1191 if (vjip->vjipMembers[j].userData != 0)
1192 SLNet::OP_DELETE(vjip->vjipMembers[j].userData, _FILE_AND_LINE_);
1193 }
1194 }
1195
1196 for (unsigned int j=0; j < joinsInProgress[curIndex]->vjipMembers.Size(); j++)
1197 {
1198 if ( joinsInProgress[curIndex]->vjipMembers[j].userData != 0)
1199 {
1200 SLNet::OP_DELETE(joinsInProgress[curIndex]->vjipMembers[j].userData, _FILE_AND_LINE_);
1201 }
1202 }
1203
1204
1205 // Clear joinsInProgress for packet->guid
1206 SLNet::OP_DELETE(joinsInProgress[curIndex], _FILE_AND_LINE_);
1207 joinsInProgress.RemoveAtIndex(curIndex);
1208 }
1209 void FullyConnectedMesh2::OnVerifiedJoinAccepted(Packet *packet)
1210 {
1211 SLNet::BitStream bsIn(packet->data,packet->length,false);
1212 bsIn.IgnoreBytes(sizeof(MessageID));
1213
1214 RakNetGUID systemToAddGuid;
1215 bsIn.Read(systemToAddGuid);
1216
1217 if (systemToAddGuid==rakPeerInterface->GetMyGUID())
1218 {
1219 // My own system
1220 unsigned int curIndex = GetJoinsInProgressIndex(packet->guid);
1221 if (curIndex==(unsigned int)-1)
1222 return;
1223
1224 unsigned short listSize;
1225 bsIn.Read(listSize);
1226 for (unsigned short i=0; i < listSize; i++)
1227 {
1228 // List of clientMembersNotParticipatingSucceeded
1229 RakNetGUID guid;
1230 bsIn.Read(guid);
1231 rakPeerInterface->CloseConnection(guid, true);
1232 }
1233
1234 bsIn.Read(listSize);
1235 for (unsigned short i=0; i < listSize; i++)
1236 {
1237 // List of participatingMembersOnClientSucceeded
1238 RakNetGUID guid;
1239 bsIn.Read(guid);
1240 AddParticipant(guid);
1241 }
1242 AddParticipant(packet->guid);
1243
1244 for (unsigned int j=0; j < joinsInProgress[curIndex]->vjipMembers.Size(); j++)
1245 {
1246 if ( joinsInProgress[curIndex]->vjipMembers[j].userData != 0)
1247 {
1248 SLNet::OP_DELETE(joinsInProgress[curIndex]->vjipMembers[j].userData, _FILE_AND_LINE_);
1249 }
1250 }
1251
1252 // Clear joinsInProgress for packet->guid
1253 SLNet::OP_DELETE(joinsInProgress[curIndex], _FILE_AND_LINE_);
1254 joinsInProgress.RemoveAtIndex(curIndex);
1255 }
1256 else
1257 {
1258 // Another system
1259 ConnectionState cs = rakPeerInterface->GetConnectionState(systemToAddGuid);
1260 RakAssert(cs==IS_CONNECTED);
1261 if (cs==IS_CONNECTED)
1262 AddParticipant(systemToAddGuid);
1263 }
1264 }
1265 void FullyConnectedMesh2::OnVerifiedJoinRejected(Packet *packet)
1266 {
1267 OnVerifiedJoinFailed(packet->guid, true);
1268 }
1269 unsigned int FullyConnectedMesh2::GetJoinsInProgressIndex(RakNetGUID requester) const
1270 {
1271 for (unsigned int i=0; i < joinsInProgress.Size(); i++)
1272 {
1273 if (joinsInProgress[i]->requester==requester)
1274 return i;
1275 }
1276 return (unsigned int) -1;
1277 }
1278 void FullyConnectedMesh2::UpdateVerifiedJoinInProgressMember(const AddressOrGUID systemIdentifier, RakNetGUID guidToAssign, FullyConnectedMesh2::JoinInProgressState newState)
1279 {
1280 bool anythingChanged;
1281
1282 for (unsigned int i=0; i < joinsInProgress.Size(); i++)
1283 {
1284 VerifiedJoinInProgress *vjip = joinsInProgress[i];
1285 //if (vjip->sentResults==true)
1286 // continue;
1287 anythingChanged=false;
1288
1289 unsigned int j;
1290 j = GetVerifiedJoinInProgressMemberIndex(systemIdentifier, vjip);
1291 if (j!=(unsigned int)-1)
1292 {
1293 if (vjip->vjipMembers[j].guid==UNASSIGNED_RAKNET_GUID && guidToAssign!=UNASSIGNED_RAKNET_GUID)
1294 vjip->vjipMembers[j].guid = guidToAssign;
1295
1296 if (vjip->vjipMembers[j].joinInProgressState==JIPS_PROCESSING)
1297 {
1298 anythingChanged=true;
1299 vjip->vjipMembers[j].joinInProgressState=newState;
1300 }
1301 }
1302
1303 if (anythingChanged)
1304 {
1305 ProcessVerifiedJoinInProgressIfCompleted(vjip);
1306 }
1307 }
1308 }
1309 bool FullyConnectedMesh2::ProcessVerifiedJoinInProgressIfCompleted(VerifiedJoinInProgress *vjip)
1310 {
1311 //if (vjip->sentResults)
1312 // return true;
1313
1314 // If no systems in processing state, send results to server
1315 // Return true if this was done
1316 bool anyProcessing=false;
1317 for (unsigned int i=0; i < vjip->vjipMembers.Size(); i++)
1318 {
1319 if (vjip->vjipMembers[i].joinInProgressState==JIPS_PROCESSING)
1320 {
1321 anyProcessing=true;
1322 break;
1323 }
1324 }
1325
1326 if (anyProcessing==true)
1327 return false;
1328
1329 // Send results to server
1330 BitStream bsOut;
1331 WriteVerifiedJoinCapable(&bsOut, vjip);
1332 WriteVJCUserData(&bsOut);
1333 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, vjip->requester, false);
1334
1335 //vjip->sentResults=true;
1336 return true;
1337 }
1338 void FullyConnectedMesh2::WriteVerifiedJoinCapable(SLNet::BitStream *bsOut, VerifiedJoinInProgress *vjip)
1339 {
1340 bsOut->Write((MessageID) ID_FCM2_VERIFIED_JOIN_CAPABLE);
1341 bsOut->WriteCasted<unsigned short>(vjip->vjipMembers.Size());
1342 unsigned int i;
1343 for (i=0; i < vjip->vjipMembers.Size(); i++)
1344 {
1345 bsOut->Write(vjip->vjipMembers[i].guid);
1346 bsOut->Write(vjip->vjipMembers[i].systemAddress);
1347 bsOut->WriteCasted<unsigned char>(vjip->vjipMembers[i].joinInProgressState);
1348 }
1349 }
1350
1351 void FullyConnectedMesh2::ReadVerifiedJoinInProgressMember(SLNet::BitStream *bsIn, VerifiedJoinInProgressMember *vjipm)
1352 {
1353 bsIn->Read(vjipm->guid);
1354 bsIn->Read(vjipm->systemAddress);
1355 ConnectionState cs = rakPeerInterface->GetConnectionState(vjipm->guid);
1356 if (cs==IS_CONNECTED)
1357 vjipm->joinInProgressState=JIPS_CONNECTED;
1358 else if (cs==IS_DISCONNECTING || cs==IS_SILENTLY_DISCONNECTING)
1359 vjipm->joinInProgressState=JIPS_FAILED;
1360 else
1361 vjipm->joinInProgressState=JIPS_PROCESSING;
1362
1363 BitSize_t vjsUserDataSize;
1364 bsIn->Read(vjsUserDataSize);
1365 if (vjsUserDataSize > 0)
1366 {
1367 vjipm->userData = SLNet::OP_NEW<BitStream>(_FILE_AND_LINE_);
1368 bsIn->Read(vjipm->userData, vjsUserDataSize);
1369 }
1370 else
1371 vjipm->userData = 0;
1372 bsIn->AlignReadToByteBoundary();
1373 }
1374
1375 unsigned int FullyConnectedMesh2::GetVerifiedJoinInProgressMemberIndex(const AddressOrGUID systemIdentifier, VerifiedJoinInProgress *vjip)
1376 {
1377 for (unsigned int j=0; j < vjip->vjipMembers.Size(); j++)
1378 {
1379 if ((systemIdentifier.rakNetGuid!=UNASSIGNED_RAKNET_GUID && vjip->vjipMembers[j].guid==systemIdentifier.rakNetGuid) ||
1380 (systemIdentifier.systemAddress!=UNASSIGNED_SYSTEM_ADDRESS && vjip->vjipMembers[j].systemAddress==systemIdentifier.systemAddress))
1381 {
1382 return j;
1383 }
1384 }
1385 return (unsigned int) -1;
1386 }
1387
1388 void FullyConnectedMesh2::CategorizeVJIP(VerifiedJoinInProgress *vjip,
1389 DataStructures::List<RakNetGUID> &participatingMembersOnClientSucceeded,
1390 DataStructures::List<RakNetGUID> &participatingMembersOnClientFailed,
1391 DataStructures::List<RakNetGUID> &participatingMembersNotOnClient,
1392 DataStructures::List<RakNetGUID> &clientMembersNotParticipatingSucceeded,
1393 DataStructures::List<RakNetGUID> &clientMembersNotParticipatingFailed)
1394 {
1395 for (unsigned int i=0; i < vjip->vjipMembers.Size(); i++)
1396 vjip->vjipMembers[i].workingFlag=false;
1397
1398 for (unsigned int i=0; i < fcm2ParticipantList.Size(); i++)
1399 {
1400 unsigned int j = GetVerifiedJoinInProgressMemberIndex(fcm2ParticipantList[i]->rakNetGuid, vjip);
1401 if (j==(unsigned int)-1)
1402 {
1403 participatingMembersNotOnClient.Push(fcm2ParticipantList[i]->rakNetGuid, _FILE_AND_LINE_);
1404 }
1405 else
1406 {
1407 if (vjip->vjipMembers[j].joinInProgressState==JIPS_FAILED)
1408 participatingMembersOnClientFailed.Push(fcm2ParticipantList[i]->rakNetGuid, _FILE_AND_LINE_);
1409 else
1410 participatingMembersOnClientSucceeded.Push(fcm2ParticipantList[i]->rakNetGuid, _FILE_AND_LINE_);
1411 vjip->vjipMembers[j].workingFlag=true;
1412 }
1413 }
1414
1415
1416 for (unsigned int j=0; j < vjip->vjipMembers.Size(); j++)
1417 {
1418 if (vjip->vjipMembers[j].workingFlag==false)
1419 {
1420 if (vjip->vjipMembers[j].joinInProgressState==JIPS_FAILED)
1421 clientMembersNotParticipatingFailed.Push(vjip->vjipMembers[j].guid, _FILE_AND_LINE_);
1422 else
1423 clientMembersNotParticipatingSucceeded.Push(vjip->vjipMembers[j].guid, _FILE_AND_LINE_);
1424 }
1425 }
1426 }
1427
1428 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/osx_adapter.h Source File

  • include
  • slikenet
osx_adapter.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2016, SLikeSoft UG (haftungsbeschränkt)
3 *
4 * This source code is licensed under the MIT-style license found in the
5 * license.txt file in the root directory of this source tree.
6 *
7 *
8 * This file declares adapters for all MS-specific functions used throughout SLikeNet.
9 */
10 #pragma once
11
12 #ifdef __APPLE__
13 #define _TRUNCATE ((size_t)-1)
14 typedef int errno_t;
15
16 #include <cstdarg> // for va_start, va_end, va_list
17 #include <cstdio> // for FILE
18 #include <ctime> // for time_t
19
20 // MS specific security enhanced functions
21 errno_t fopen_s(FILE **pfile, const char *filename, const char *mode);
22 errno_t localtime_s(struct tm* _tm, const time_t *time);
23 errno_t mbstowcs_s(size_t *pReturnValue, wchar_t *wcstr, size_t sizeInWords, const char *mbstr, size_t count);
24 int sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...);
25 errno_t strcat_s(char *strDestination, size_t numberOfElements, const char *strSource);
26 errno_t strcpy_s(char* strDestination, size_t numberOfElements, const char *strSource);
27 errno_t strerror_s(char* buffer, size_t numberOfElements, int errnum);
28 errno_t strncat_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count);
29 errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count);
30 int vsnprintf_s(char *buffer, size_t sizeOfBuffer, size_t count, const char *format, va_list argptr);
31 errno_t wcscat_s(wchar_t *strDestination, size_t numberOfElements, const wchar_t *strSource);
32 errno_t wcscpy_s(wchar_t* strDestination, size_t numberOfElements, const wchar_t *strSource);
33
34 // corresponding template overloads
35 template<size_t BufferSize> errno_t mbstowcs_s(size_t *pReturnValue, wchar_t(&wcstr)[BufferSize], const char *mbstr, size_t count)
36 {
37 return mbstowcs_s(pReturnValue, wcstr, BufferSize, mbstr, count);
38 }
39
40 template<size_t BufferSize> int sprintf_s(char (&buffer)[BufferSize], const char* format, ...)
41 {
42 va_list arglist;
43 va_start(arglist, format);
44 int numCharsWritten = vsnprintf_s(buffer, BufferSize, BufferSize - 1, format, arglist);
45 va_end(arglist);
46
47 return numCharsWritten;
48 }
49
50 template<size_t BufferSize> errno_t strcat_s(char (&strDestination)[BufferSize], const char* strSource)
51 {
52 return strcat_s(strDestination, BufferSize, strSource);
53 }
54
55 template<size_t BufferSize> errno_t strcpy_s(char (&strDestination)[BufferSize], const char* strSource)
56 {
57 return strcpy_s(strDestination, BufferSize, strSource);
58 }
59
60 template<size_t BufferSize> errno_t strerror_s(char(&buffer)[BufferSize], int errnum)
61 {
62 return strerror_s(buffer, BufferSize, errnum);
63 }
64
65 template<size_t BufferSize> errno_t strncat_s(char(&strDest)[BufferSize], const char *strSource, size_t count)
66 {
67 return strncat_s(strDest, BufferSize, strSource, count);
68 }
69
70 template<size_t BufferSize> errno_t strncpy_s(char(&strDest)[BufferSize], const char *strSource, size_t count)
71 {
72 return strncpy_s(strDest, BufferSize, strSource, count);
73 }
74
75 template<size_t BufferSize> int vsnprintf_s(char (&buffer)[BufferSize], size_t count, const char *format, va_list argptr)
76 {
77 return vsnprintf_s(buffer, BufferSize, count, format, argptr);
78 }
79
80 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CCRakNetUDT.h Source File

  • include
  • slikenet
CCRakNetUDT.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "defines.h"
17
18 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL!=1
19
20 #ifndef __CONGESTION_CONTROL_UDT_H
21 #define __CONGESTION_CONTROL_UDT_H
22
23 #include "NativeTypes.h"
24 #include "time.h"
25 #include "types.h"
26 #include "DS_Queue.h"
27
29 #define CC_TIME_TYPE_BYTES 8
30
31 namespace SLNet
32 {
33
34 #if CC_TIME_TYPE_BYTES==8
35 typedef uint64_t CCTimeType;
36 #else
37 typedef uint32_t CCTimeType;
38 #endif
39
40 typedef uint24_t DatagramSequenceNumberType;
41 typedef double BytesPerMicrosecond;
42 typedef double BytesPerSecond;
43 typedef double MicrosecondsPerByte;
44
46 #define CC_RAKNET_UDT_PACKET_HISTORY_LENGTH 64
47 #define RTT_HISTORY_LENGTH 64
48
50 #define UDP_HEADER_SIZE 28
51
52 #define CC_DEBUG_PRINTF_1(x)
53 #define CC_DEBUG_PRINTF_2(x,y)
54 #define CC_DEBUG_PRINTF_3(x,y,z)
55 #define CC_DEBUG_PRINTF_4(x,y,z,a)
56 #define CC_DEBUG_PRINTF_5(x,y,z,a,b)
57 //#define CC_DEBUG_PRINTF_1(x) printf(x)
58 //#define CC_DEBUG_PRINTF_2(x,y) printf(x,y)
59 //#define CC_DEBUG_PRINTF_3(x,y,z) printf(x,y,z)
60 //#define CC_DEBUG_PRINTF_4(x,y,z,a) printf(x,y,z,a)
61 //#define CC_DEBUG_PRINTF_5(x,y,z,a,b) printf(x,y,z,a,b)
62
91 class CCRakNetUDT
92 {
93 public:
94
95 CCRakNetUDT();
96 ~CCRakNetUDT();
97
99 void Init(CCTimeType curTime, uint32_t maxDatagramPayload);
100
102 void Update(CCTimeType curTime, bool hasDataToSendOrResend);
103
104 int GetRetransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend);
105 int GetTransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint32_t unacknowledgedBytes, bool isContinuousSend);
106
111 bool ShouldSendACKs(CCTimeType curTime, CCTimeType estimatedTimeToNextTick);
112
115 DatagramSequenceNumberType GetAndIncrementNextDatagramSequenceNumber(void);
116 DatagramSequenceNumberType GetNextDatagramSequenceNumber(void);
117
123 void OnSendBytes(CCTimeType curTime, uint32_t numBytes);
124
126 void OnGotPacketPair(DatagramSequenceNumberType datagramSequenceNumber, uint32_t sizeInBytes, CCTimeType curTime);
127
131 bool OnGotPacket(DatagramSequenceNumberType datagramSequenceNumber, bool isContinuousSend, CCTimeType curTime, uint32_t sizeInBytes, uint32_t *skippedMessageCount);
132
135 void OnResend(CCTimeType curTime, SLNet::TimeUS nextActionTime);
136 void OnNAK(CCTimeType curTime, DatagramSequenceNumberType nakSequenceNumber);
137
142 void OnAck(CCTimeType curTime, CCTimeType rtt, bool hasBAndAS, BytesPerMicrosecond _B, BytesPerMicrosecond _AS, double totalUserDataBytesAcked, bool isContinuousSend, DatagramSequenceNumberType sequenceNumber );
143 void OnDuplicateAck( CCTimeType curTime, DatagramSequenceNumberType sequenceNumber ) {}
144
147 void OnSendAckGetBAndAS(CCTimeType curTime, bool *hasBAndAS, BytesPerMicrosecond *_B, BytesPerMicrosecond *_AS);
148
153 void OnSendAck(CCTimeType curTime, uint32_t numBytes);
154
157 void OnSendNACK(CCTimeType curTime, uint32_t numBytes);
158
165 CCTimeType GetRTOForRetransmission(unsigned char timesSent) const;
166
169 void SetMTU(uint32_t bytes);
170
172 uint32_t GetMTU(void) const;
173
175 BytesPerMicrosecond GetLocalSendRate(void) const {return 1.0 / SND;}
176 BytesPerMicrosecond GetLocalReceiveRate(CCTimeType currentTime) const;
177 BytesPerMicrosecond GetRemoveReceiveRate(void) const {return AS;}
178 //BytesPerMicrosecond GetEstimatedBandwidth(void) const {return B;}
179 BytesPerMicrosecond GetEstimatedBandwidth(void) const {return GetLinkCapacityBytesPerSecond()*1000000.0;}
180 double GetLinkCapacityBytesPerSecond(void) const {return estimatedLinkCapacityBytesPerSecond;};
181
183 double GetRTT(void) const;
184
185 bool GetIsInSlowStart(void) const {return isInSlowStart;}
186 uint32_t GetCWNDLimit(void) const {return (uint32_t) (CWND*MAXIMUM_MTU_INCLUDING_UDP_HEADER);}
187
188
190 static bool GreaterThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b);
192 static bool LessThan(DatagramSequenceNumberType a, DatagramSequenceNumberType b);
193 // void SetTimeBetweenSendsLimit(unsigned int bitsPerSecond);
194 uint64_t GetBytesPerSecondLimitByCongestionControl(void) const;
195
196 protected:
197 // --------------------------- PROTECTED VARIABLES ---------------------------
203 MicrosecondsPerByte SND;
204
210 double CWND;
211
215 CCTimeType nextSYNUpdate;
216
217
220 int packetPairRecieptHistoryWriteIndex;
221
224 //BytesPerMicrosecond B;
225
231 double RTT;
232
237 // double RTTVar;
239 double minRTT, maxRTT;
240
247 BytesPerMicrosecond packetArrivalHistory[CC_RAKNET_UDT_PACKET_HISTORY_LENGTH];
248 BytesPerMicrosecond packetArrivalHistoryContinuousGaps[CC_RAKNET_UDT_PACKET_HISTORY_LENGTH];
249 unsigned char packetArrivalHistoryContinuousGapsIndex;
250 uint64_t continuousBytesReceived;
251 CCTimeType continuousBytesReceivedStartTime;
252 unsigned int packetArrivalHistoryWriteCount;
253
256 int packetArrivalHistoryWriteIndex;
257
259 CCTimeType lastPacketArrivalTime;
260
263 BytesPerMicrosecond AS;
264
267 CCTimeType lastTransmitOfBAndAS;
268
273 bool isInSlowStart;
274
277 uint32_t NAKCount;
278
282 uint32_t AvgNAKNum;
283
285 uint32_t DecCount;
286
288 uint32_t DecInterval;
289
291 DatagramSequenceNumberType nextDatagramSequenceNumber;
292
295 CCTimeType lastPacketPairPacketArrivalTime;
296
301 DatagramSequenceNumberType lastPacketPairSequenceNumber;
302
305 CCTimeType lastUpdateWindowSizeAndAck;
306
310 double ExpCount;
311
314 uint64_t totalUserDataBytesSent;
315
318 CCTimeType oldestUnsentAck;
319
320 // Maximum amount of bytes that the user can send, e.g. the size of one full datagram
321 uint32_t MAXIMUM_MTU_INCLUDING_UDP_HEADER;
322
323 // Max window size
324 double CWND_MAX_THRESHOLD;
325
328 DatagramSequenceNumberType expectedNextSequenceNumber;
329
330 // How many times have we sent B and AS? Used to force it to send at least CC_RAKNET_UDT_PACKET_HISTORY_LENGTH times
331 // Otherwise, the default values in the array generate inaccuracy
332 uint32_t sendBAndASCount;
333
336 BytesPerMicrosecond mostRecentPacketArrivalHistory;
337
338 bool hasWrittenToPacketPairReceiptHistory;
339
340 // uint32_t rttHistory[RTT_HISTORY_LENGTH];
341 // uint32_t rttHistoryIndex;
342 // uint32_t rttHistoryWriteCount;
343 // uint32_t rttSum, rttLow;
344 // CCTimeType lastSndUpdateTime;
345 double estimatedLinkCapacityBytesPerSecond;
346
347 // --------------------------- PROTECTED METHODS ---------------------------
349 void SetNextSYNUpdate(CCTimeType currentTime);
350
352 BytesPerMicrosecond ReceiverCalculateDataArrivalRate(CCTimeType curTime) const;
354 BytesPerMicrosecond ReceiverCalculateDataArrivalRateMedian(void) const;
355
357 static BytesPerMicrosecond CalculateListMedianRecursive(const BytesPerMicrosecond inputList[CC_RAKNET_UDT_PACKET_HISTORY_LENGTH], int inputListLength, int lessThanSum, int greaterThanSum);
358 // static uint32_t CalculateListMedianRecursive(const uint32_t inputList[RTT_HISTORY_LENGTH], int inputListLength, int lessThanSum, int greaterThanSum);
359
362 CCTimeType GetSenderRTOForACK(void) const;
363
365 void EndSlowStart(void);
366
368 inline double BytesPerMicrosecondToPacketsPerMillisecond(BytesPerMicrosecond in);
369
371 //void UpdateRTT(CCTimeType rtt);
372
374 void UpdateWindowSizeAndAckOnAckPreSlowStart(double totalUserDataBytesAcked);
375
377 void UpdateWindowSizeAndAckOnAckPerSyn(CCTimeType curTime, CCTimeType rtt, bool isContinuousSend, DatagramSequenceNumberType sequenceNumber);
378
379
381 void ResetOnDataArrivalHalveSNDOnNoDataTime(CCTimeType curTime);
382
383 // Init array
384 void InitPacketArrivalHistory(void);
385
386 // Printf
387 void PrintLowBandwidthWarning(void);
388
389 // Bug: SND can sometimes get super high - have seen 11693
390 void CapMinSnd(const char *file, int line);
391
392 void DecreaseTimeBetweenSends(void);
393 void IncreaseTimeBetweenSends(void);
394
395 int bytesCanSendThisTick;
396
397 CCTimeType lastRttOnIncreaseSendRate;
398 CCTimeType lastRtt;
399
400 DatagramSequenceNumberType nextCongestionControlBlock;
401 bool hadPacketlossThisBlock;
402 DataStructures::Queue<CCTimeType> pingsLastInterval;
403 };
404
405 }
406
407 #endif
408
409 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • ReliabilityLayer
SLNet::ReliabilityLayer Member List

This is the complete list of members for SLNet::ReliabilityLayer, including all inherited members.

AckTimeout(SLNet::Time curTime) | SLNet::ReliabilityLayer |
ApplyNetworkSimulator(double _maxSendBPS, SLNet::TimeMS _minExtraPing, SLNet::TimeMS _extraPingVariance) | SLNet::ReliabilityLayer |
AreAcksWaiting(void) | SLNet::ReliabilityLayer |
GetNextSendTime(void) const | SLNet::ReliabilityLayer |
GetStatistics(RakNetStatistics *rns) | SLNet::ReliabilityLayer |
GetTimeBetweenPackets(void) const | SLNet::ReliabilityLayer |
GetTimeLastDatagramArrived(void) const | SLNet::ReliabilityLayer | inline
GetTimeoutTime(void) | SLNet::ReliabilityLayer |
HandleSocketReceiveFromConnectedPlayer(const char *buffer, unsigned int length, SystemAddress &systemAddress, DataStructures::List< PluginInterface2 * > &messageHandlerList, int MTUSize, RakNetSocket2 *s, RakNetRandom *rnr, CCTimeType timeRead, BitStream &updateBitStream) | SLNet::ReliabilityLayer |
IsDeadConnection(void) const | SLNet::ReliabilityLayer |
IsNetworkSimulatorActive(void) | SLNet::ReliabilityLayer |
IsOutgoingDataWaiting(void) | SLNet::ReliabilityLayer |
KillConnection(void) | SLNet::ReliabilityLayer |
Receive(unsigned char **data) | SLNet::ReliabilityLayer |
ReliabilityLayer() | SLNet::ReliabilityLayer |
Reset(bool resetVariables, int MTUSize, bool _useSecurity) | SLNet::ReliabilityLayer |
Send(char *data, BitSize_t numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, unsigned char orderingChannel, bool makeDataCopy, int MTUSize, CCTimeType currentTime, uint32_t receipt) | SLNet::ReliabilityLayer |
SetSplitMessageProgressInterval(int interval) | SLNet::ReliabilityLayer |
SetTimeoutTime(SLNet::TimeMS time) | SLNet::ReliabilityLayer |
SetUnreliableTimeout(SLNet::TimeMS timeoutMS) | SLNet::ReliabilityLayer |
Update(RakNetSocket2 *s, SystemAddress &systemAddress, int MTUSize, CCTimeType time, unsigned bitsPerSecondLimit, DataStructures::List< PluginInterface2 * > &messageHandlerList, RakNetRandom *rnr, BitStream &updateBitStream) | SLNet::ReliabilityLayer |
~ReliabilityLayer() | SLNet::ReliabilityLayer |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatTypeDetectionClient.h Source File

  • include
  • slikenet
NatTypeDetectionClient.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_NatTypeDetectionClient==1
23
24 #ifndef __NAT_TYPE_DETECTION_CLIENT_H
25 #define __NAT_TYPE_DETECTION_CLIENT_H
26
27 #include "types.h"
28 #include "Export.h"
29 #include "PluginInterface2.h"
30 #include "PacketPriority.h"
31 #include "SocketIncludes.h"
32 #include "DS_OrderedList.h"
33 #include "string.h"
34 #include "NatTypeDetectionCommon.h"
35
36 namespace SLNet
37 {
39 class RakPeerInterface;
40 struct Packet;
41
50 class RAK_DLL_EXPORT NatTypeDetectionClient : public PluginInterface2, public RNS2EventHandler
51 {
52 public:
53
54 // GetInstance() and DestroyInstance(instance*)
55 STATIC_FACTORY_DECLARATIONS(NatTypeDetectionClient)
56
57 // Constructor
58 NatTypeDetectionClient();
59
60 // Destructor
61 virtual ~NatTypeDetectionClient();
62
67 void DetectNATType(SystemAddress _serverAddress);
68
70 virtual void Update(void);
71
73 virtual PluginReceiveResult OnReceive(Packet *packet);
74
75 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
76 virtual void OnRakPeerShutdown(void);
77 virtual void OnDetach(void);
78
79 virtual void OnRNS2Recv(RNS2RecvStruct *recvStruct);
80 virtual void DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line);
81 virtual RNS2RecvStruct *AllocRNS2RecvStruct(const char *file, unsigned int line);
82 protected:
83 DataStructures::Queue<RNS2RecvStruct*> bufferedPackets;
84 SimpleMutex bufferedPacketsMutex;
85
86 RakNetSocket2* c2;
87 //unsigned short c2Port;
88 void Shutdown(void);
89 void OnCompletion(NATTypeDetectionResult result);
90 bool IsInProgress(void) const;
91
92 void OnTestPortRestricted(Packet *packet);
93 SystemAddress serverAddress;
94 };
95
96
97 }
98
99
100 #endif
101
102 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DR_SHA1.h Source File

  • include
  • slikenet
DR_SHA1.h
Go to the documentation of this file.
1 /*
2 100% free public domain implementation of the SHA-1 algorithm
3 by Dominik Reichl <dominik.reichl@t-online.de>
4 Web: http://www.dominik-reichl.de/
5
6 Version 2.1 - 2012-06-19
7 - Deconstructor (resetting internal variables) is now only
8 implemented if SHA1_WIPE_VARIABLES is defined (which is the
9 default).
10 - Renamed inclusion guard to contain a GUID.
11 - Demo application is now using C++/STL objects and functions.
12 - Unicode build of the demo application now outputs the hashes of both
13 the ANSI and Unicode representations of strings.
14 - Various other demo application improvements.
15
16 Version 2.0 - 2012-06-14
17 - Added 'limits.h' include.
18 - Renamed inclusion guard and macros for compliancy (names beginning
19 with an underscore are reserved).
20
21 Version 1.9 - 2011-11-10
22 - Added Unicode test vectors.
23 - Improved support for hashing files using the HashFile method that
24 are larger than 4 GB.
25 - Improved file hashing performance (by using a larger buffer).
26 - Disabled unnecessary compiler warnings.
27 - Internal variables are now private.
28
29 Version 1.8 - 2009-03-16
30 - Converted project files to Visual Studio 2008 format.
31 - Added Unicode support for HashFile utility method.
32 - Added support for hashing files using the HashFile method that are
33 larger than 2 GB.
34 - HashFile now returns an error code instead of copying an error
35 message into the output buffer.
36 - GetHash now returns an error code and validates the input parameter.
37 - Added ReportHashStl STL utility method.
38 - Added REPORT_HEX_SHORT reporting mode.
39 - Improved Linux compatibility of test program.
40
41 Version 1.7 - 2006-12-21
42 - Fixed buffer underrun warning that appeared when compiling with
43 Borland C Builder (thanks to Rex Bloom and Tim Gallagher for the
44 patch).
45 - Breaking change: ReportHash writes the final hash to the start
46 of the buffer, i.e. it's not appending it to the string anymore.
47 - Made some function parameters const.
48 - Added Visual Studio 2005 project files to demo project.
49
50 Version 1.6 - 2005-02-07 (thanks to Howard Kapustein for patches)
51 - You can set the endianness in your files, no need to modify the
52 header file of the CSHA1 class anymore.
53 - Aligned data support.
54 - Made support/compilation of the utility functions (ReportHash and
55 HashFile) optional (useful when bytes count, for example in embedded
56 environments).
57
58 Version 1.5 - 2005-01-01
59 - 64-bit compiler compatibility added.
60 - Made variable wiping optional (define SHA1_WIPE_VARIABLES).
61 - Removed unnecessary variable initializations.
62 - ROL32 improvement for the Microsoft compiler (using _rotl).
63
64 Version 1.4 - 2004-07-22
65 - CSHA1 now compiles fine with GCC 3.3 under Mac OS X (thanks to Larry
66 Hastings).
67
68 Version 1.3 - 2003-08-17
69 - Fixed a small memory bug and made a buffer array a class member to
70 ensure correct working when using multiple CSHA1 class instances at
71 one time.
72
73 Version 1.2 - 2002-11-16
74 - Borlands C++ compiler seems to have problems with string addition
75 using sprintf. Fixed the bug which caused the digest report function
76 not to work properly. CSHA1 is now Borland compatible.
77
78 Version 1.1 - 2002-10-11
79 - Removed two unnecessary header file includes and changed BOOL to
80 bool. Fixed some minor bugs in the web page contents.
81
82 Version 1.0 - 2002-06-20
83 - First official release.
84
85 ================ Test Vectors ================
86
87 SHA1("abc" in ANSI) =
88 A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
89 SHA1("abc" in Unicode LE) =
90 9F04F41A 84851416 2050E3D6 8C1A7ABB 441DC2B5
91
92 SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
93 in ANSI) =
94 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
95 SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
96 in Unicode LE) =
97 51D7D876 9AC72C40 9C5B0E3F 69C60ADC 9A039014
98
99 SHA1(A million repetitions of "a" in ANSI) =
100 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
101 SHA1(A million repetitions of "a" in Unicode LE) =
102 C4609560 A108A0C6 26AA7F2B 38A65566 739353C5
103 */
104
105 /*
106 * This file was taken from RakNet 4.082.
107 *
108 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
109 *
110 * This source code was modified by SLikeSoft. Modifications in this file are put under the public domain.
111 * Alternatively you are permitted to license the modifications under the MIT license, if you so desire. The
112 * license can be found in the license.txt file in the root directory of this source tree.
113 */
114
115 #ifndef SHA1_H_A545E61D43E9404E8D736869AB3CBFE7
116 #define SHA1_H_A545E61D43E9404E8D736869AB3CBFE7
117
118 // KevinJ:
119 #include "memoryoverride.h"
120 #include <stdio.h> // Needed for file access
121
122 #include <memory.h> // Needed for memset and memcpy
123
124 #include <string.h> // Needed for strcat and strcpy
125 #include "Export.h"
126 //#define MAX_FILE_READ_BUFFER 8000
127 #define SHA1_LENGTH 20
128
129
130
131 #if !defined(SHA1_UTILITY_FUNCTIONS) && !defined(SHA1_NO_UTILITY_FUNCTIONS)
132 #define SHA1_UTILITY_FUNCTIONS
133 #endif
134
135 #if !defined(SHA1_STL_FUNCTIONS) && !defined(SHA1_NO_STL_FUNCTIONS)
136 #define SHA1_STL_FUNCTIONS
137 #if !defined(SHA1_UTILITY_FUNCTIONS)
138 #error STL functions require SHA1_UTILITY_FUNCTIONS.
139 #endif
140 #endif
141
142
143 #include <memory.h>
144
145 #include <limits.h>
146
147 #ifdef SHA1_UTILITY_FUNCTIONS
148 #include <stdio.h>
149 #include <string.h>
150 #endif
151
152 #ifdef SHA1_STL_FUNCTIONS
153 #include <string>
154 #endif
155
156 #ifdef _MSC_VER
157 #include <stdlib.h>
158 #endif
159
160 // You can define the endian mode in your files without modifying the SHA-1
161 // source files. Just #define SHA1_LITTLE_ENDIAN or #define SHA1_BIG_ENDIAN
162 // in your files, before including the DR_SHA1.h header file. If you don't
163 // define anything, the class defaults to little endian.
164 #if !defined(SHA1_LITTLE_ENDIAN) && !defined(SHA1_BIG_ENDIAN)
165 #define SHA1_LITTLE_ENDIAN
166 #endif
167
168 // If you want variable wiping, #define SHA1_WIPE_VARIABLES, if not,
169 // #define SHA1_NO_WIPE_VARIABLES. If you don't define anything, it
170 // defaults to wiping.
171 #if !defined(SHA1_WIPE_VARIABLES) && !defined(SHA1_NO_WIPE_VARIABLES)
172 #define SHA1_WIPE_VARIABLES
173 #endif
174
175 #if defined(SHA1_HAS_TCHAR)
176 #include <tchar.h>
177 #else
178 #ifdef _MSC_VER
179 #include <tchar.h>
180 #else
181 #ifndef TCHAR
182 #define TCHAR char
183 #endif
184 #ifndef _T
185 #define _T(__x) (__x)
186 #define _tmain main
187 #define _tprintf printf
188 #define _getts gets
189 #define _tcslen strlen
190 #define _tfopen fopen
191 #define _tcscpy strcpy
192 #define _tcscat strcat
193 #define _sntprintf snprintf
194 #endif
195 #endif
196 #endif
197
199 // Define variable types
200
201 #ifndef UINT_8
202 #ifdef _MSC_VER // Compiling with Microsoft compiler
203 #define UINT_8 unsigned __int8
204 #else // !_MSC_VER
205 #define UINT_8 unsigned char
206 #endif // _MSC_VER
207 #endif
208
209 #ifndef UINT_32
210 #ifdef _MSC_VER // Compiling with Microsoft compiler
211 #define UINT_32 unsigned __int32
212 #else // !_MSC_VER
213 #if (ULONG_MAX == 0xFFFFFFFFUL)
214 #define UINT_32 unsigned long
215 #else
216 #define UINT_32 unsigned int
217 #endif
218 #endif // _MSC_VER
219 #endif // UINT_32
220
221 #ifndef INT_64
222 #ifdef _MSC_VER // Compiling with Microsoft compiler
223 #define INT_64 __int64
224 #else // !_MSC_VER
225 #define INT_64 long long
226 #endif // _MSC_VER
227 #endif // INT_64
228
229 #ifndef UINT_64
230 #ifdef _MSC_VER // Compiling with Microsoft compiler
231 #define UINT_64 unsigned __int64
232 #else // !_MSC_VER
233 #define UINT_64 unsigned long long
234 #endif // _MSC_VER
235 #endif // UINT_64
236
238 // Declare SHA-1 workspace
239
240 typedef union
241 {
242 UINT_8 c[64];
243 UINT_32 l[16];
244 } SHA1_WORKSPACE_BLOCK;
245
246 class RAK_DLL_EXPORT CSHA1
247 {
248 public:
249 #ifdef SHA1_UTILITY_FUNCTIONS
250 // Different formats for ReportHash(Stl)
251 enum REPORT_TYPE
252 {
253 REPORT_HEX = 0,
254 REPORT_DIGIT = 1,
255 REPORT_HEX_SHORT = 2
256 };
257 #endif
258
259 // Constructor and destructor
260 CSHA1();
261
262 #ifdef SHA1_WIPE_VARIABLES
263 ~CSHA1();
264 #endif
265
266 void Reset();
267
268 // Hash in binary data and strings
269 void Update(const UINT_8* pbData, UINT_32 uLen);
270
271 #ifdef SHA1_UTILITY_FUNCTIONS
272 // Hash in file contents
273 bool HashFile(const TCHAR* tszFileName);
274 #endif
275
276 // Finalize hash; call it before using ReportHash(Stl)
277 void Final();
278
279 #ifdef SHA1_UTILITY_FUNCTIONS
280 bool ReportHash(TCHAR* tszReport, REPORT_TYPE rtReportType = REPORT_HEX) const;
281 #endif
282
283 #ifdef SHA1_STL_FUNCTIONS
284 bool ReportHashStl(std::basic_string<TCHAR>& strOut, REPORT_TYPE rtReportType =
285 REPORT_HEX) const;
286 #endif
287
288 // Get the raw message digest (20 bytes)
289 bool GetHash(UINT_8* pbDest20) const;
290
291 unsigned char * GetHash( void ) const;
292 // KevinJ: http://cseweb.ucsd.edu/~mihir/papers/hmac-cb.pdf
293 static void HMAC(unsigned char *sharedKey, int sharedKeyLength, unsigned char *data, int dataLength, unsigned char output[SHA1_LENGTH]);
294
295 private:
296 // Private SHA-1 transformation
297 void Transform(UINT_32* pState, const UINT_8* pBuffer);
298
299 // Member variables
300 UINT_32 m_state[5];
301 UINT_32 m_count[2];
302 UINT_32 m_reserved0[1]; // Memory alignment padding
303 UINT_8 m_buffer[64];
304 UINT_8 m_digest[20];
305 UINT_32 m_reserved1[3]; // Memory alignment padding
306
307 UINT_8 m_workspace[64];
308 SHA1_WORKSPACE_BLOCK* m_block; // SHA1 pointer to the byte array above
309 };
310
311 #endif // SHA1_H_A545E61D43E9404E8D736869AB3CBFE7
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • BPSTracker
  • TimeAndValue2
SLNet::BPSTracker::TimeAndValue2 Member List

This is the complete list of members for SLNet::BPSTracker::TimeAndValue2, including all inherited members.

time | SLNet::BPSTracker::TimeAndValue2
TimeAndValue2() | SLNet::BPSTracker::TimeAndValue2
TimeAndValue2(CCTimeType t, uint64_t v1) | SLNet::BPSTracker::TimeAndValue2
value1 | SLNet::BPSTracker::TimeAndValue2
~TimeAndValue2() | SLNet::BPSTracker::TimeAndValue2
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • QueueLinkedList
DataStructures::QueueLinkedList< QueueType > Member List

This is the complete list of members for DataStructures::QueueLinkedList< QueueType >, including all inherited members.

Clear(void) | DataStructures::QueueLinkedList< QueueType > |
Compress(void) | DataStructures::QueueLinkedList< QueueType > |
EndPeek(void) | DataStructures::QueueLinkedList< QueueType > | inline
operator=(const QueueLinkedList &original_copy) | DataStructures::QueueLinkedList< QueueType > |
Peek(void) | DataStructures::QueueLinkedList< QueueType > | inline
Pop(void) | DataStructures::QueueLinkedList< QueueType > | inline
Push(const QueueType &input) | DataStructures::QueueLinkedList< QueueType > |
QueueLinkedList() | DataStructures::QueueLinkedList< QueueType > |
QueueLinkedList(const QueueLinkedList &original_copy) | DataStructures::QueueLinkedList< QueueType > |
Size(void) | DataStructures::QueueLinkedList< QueueType > | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SignaledEvent
SLNet::SignaledEvent Member List

This is the complete list of members for SLNet::SignaledEvent, including all inherited members.

CloseEvent(void) | SLNet::SignaledEvent |
condAttr | SLNet::SignaledEvent | protected
eventList | SLNet::SignaledEvent | protected
hMutex | SLNet::SignaledEvent | protected
InitEvent(void) | SLNet::SignaledEvent |
isSignaled | SLNet::SignaledEvent | protected
isSignaledMutex | SLNet::SignaledEvent | protected
mutexAttr | SLNet::SignaledEvent | protected
SetEvent(void) | SLNet::SignaledEvent |
SignaledEvent() | SLNet::SignaledEvent |
WaitOnEvent(int timeoutMs) | SLNet::SignaledEvent |
~SignaledEvent() | SLNet::SignaledEvent |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/WindowsIncludes.h Source File

  • include
  • slikenet
WindowsIncludes.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #define NOMINMAX
17
18 #if defined (WINDOWS_STORE_RT)
19 #include <windows.h>
20 #include <winsock.h>
21 #elif defined (_WIN32)
22 #include <winsock2.h>
23 #include <windows.h>
24 #include <ws2tcpip.h>
25
26 // Must always include Winsock2.h before windows.h
27 // or else:
28 // winsock2.h(99) : error C2011: 'fd_set' : 'struct' type redefinition
29 // winsock2.h(134) : warning C4005: 'FD_SET' : macro redefinition
30 // winsock.h(83) : see previous definition of 'FD_SET'
31 // winsock2.h(143) : error C2011: 'timeval' : 'struct' type redefinition
32 // winsock2.h(199) : error C2011: 'hostent' : 'struct' type redefinition
33 // winsock2.h(212) : error C2011: 'netent' : 'struct' type redefinition
34 // winsock2.h(219) : error C2011: 'servent' : 'struct' type redefinition
35
36 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DataCompressor.h Source File

  • include
  • slikenet
DataCompressor.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __DATA_COMPRESSOR_H
23 #define __DATA_COMPRESSOR_H
24
25 #include "memoryoverride.h"
26 #include "DS_HuffmanEncodingTree.h"
27 #include "Export.h"
28
29 namespace SLNet
30 {
31
33 class RAK_DLL_EXPORT DataCompressor
34 {
35 public:
36 // GetInstance() and DestroyInstance(instance*)
37 STATIC_FACTORY_DECLARATIONS(DataCompressor)
38
39 static void Compress( unsigned char *userData, unsigned sizeInBytes, SLNet::BitStream * output );
40 static unsigned DecompressAndAllocate(SLNet::BitStream * input, unsigned char **output );
41 };
42
43 } // namespace SLNet
44
45 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ReadyEvent.cpp Source File

  • src
ReadyEvent.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_ReadyEvent==1
18
19 #include "slikenet/ReadyEvent.h"
20 #include "slikenet/peerinterface.h"
21 #include "slikenet/BitStream.h"
22 #include "slikenet/MessageIdentifiers.h"
23 #include "slikenet/assert.h"
24
25 using namespace SLNet;
26
27 int SLNet::ReadyEvent::RemoteSystemCompByGuid( const RakNetGUID &key, const RemoteSystem &data )
28 {
29 if (key < data.rakNetGuid)
30 return -1;
31 else if (key==data.rakNetGuid)
32 return 0;
33 else
34 return 1;
35 }
36
37 int SLNet::ReadyEvent::ReadyEventNodeComp( const int &key, ReadyEvent::ReadyEventNode * const &data )
38 {
39 if (key < data->eventId)
40 return -1;
41 else if (key==data->eventId)
42 return 0;
43 else
44 return 1;
45 }
46
47 STATIC_FACTORY_DEFINITIONS(ReadyEvent,ReadyEvent);
48
49 ReadyEvent::ReadyEvent()
50 {
51 channel=0;
52 }
53
54 ReadyEvent::~ReadyEvent()
55 {
56 Clear();
57 }
58
59
60 bool ReadyEvent::SetEvent(int eventId, bool isReady)
61 {
62 bool objectExists;
63 unsigned eventIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
64 if (objectExists==false)
65 {
66 // Totally new event
67 CreateNewEvent(eventId, isReady);
68 }
69 else
70 {
71 return SetEventByIndex(eventIndex, isReady);
72 }
73 return true;
74 }
75 void ReadyEvent::ForceCompletion(int eventId)
76 {
77 bool objectExists;
78 unsigned eventIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
79 if (objectExists==false)
80 {
81 // Totally new event
82 CreateNewEvent(eventId, true);
83 eventIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
84 }
85
86 ReadyEventNode *ren = readyEventNodeList[eventIndex];
87 ren->eventStatus=ID_READY_EVENT_FORCE_ALL_SET;
88 UpdateReadyStatus(eventIndex);
89 }
90 bool ReadyEvent::DeleteEvent(int eventId)
91 {
92 bool objectExists;
93 unsigned eventIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
94 if (objectExists)
95 {
96 SLNet::OP_DELETE(readyEventNodeList[eventIndex], _FILE_AND_LINE_);
97 readyEventNodeList.RemoveAtIndex(eventIndex);
98 return true;
99 }
100 return false;
101 }
102 bool ReadyEvent::IsEventSet(int eventId)
103 {
104 bool objectExists;
105 unsigned eventIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
106 if (objectExists)
107 {
108 return readyEventNodeList[eventIndex]->eventStatus==ID_READY_EVENT_SET || readyEventNodeList[eventIndex]->eventStatus==ID_READY_EVENT_ALL_SET;
109 }
110 return false;
111 }
112 bool ReadyEvent::IsEventCompletionProcessing(int eventId) const
113 {
114 bool objectExists;
115 unsigned eventIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
116 if (objectExists)
117 {
118 bool anyAllReady=false;
119 bool allAllReady=true;
120 ReadyEventNode *ren = readyEventNodeList[eventIndex];
121 if (ren->eventStatus==ID_READY_EVENT_FORCE_ALL_SET)
122 return false;
123 for (unsigned i=0; i < ren->systemList.Size(); i++)
124 {
125 if (ren->systemList[i].lastReceivedStatus==ID_READY_EVENT_ALL_SET)
126 anyAllReady=true;
127 else
128 allAllReady=false;
129 }
130 return anyAllReady==true && allAllReady==false;
131 }
132 return false;
133 }
134 bool ReadyEvent::IsEventCompleted(int eventId) const
135 {
136 bool objectExists;
137 unsigned eventIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
138 if (objectExists)
139 {
140 return IsEventCompletedByIndex(eventIndex);
141 }
142 return false;
143 }
144
145 bool ReadyEvent::HasEvent(int eventId)
146 {
147 return readyEventNodeList.HasData(eventId);
148 }
149
150 unsigned ReadyEvent::GetEventListSize(void) const
151 {
152 return readyEventNodeList.Size();
153 }
154
155 int ReadyEvent::GetEventAtIndex(unsigned index) const
156 {
157 return readyEventNodeList[index]->eventId;
158 }
159
160 bool ReadyEvent::AddToWaitList(int eventId, RakNetGUID guid)
161 {
162 bool eventExists;
163 unsigned eventIndex = readyEventNodeList.GetIndexFromKey(eventId, &eventExists);
164 if (eventExists==false)
165 eventIndex=CreateNewEvent(eventId, false);
166
167 // Don't do this, otherwise if we are trying to start a 3 player game, it will not allow the 3rd player to hit ready if the first two players have already done so
168 //if (IsLocked(eventIndex))
169 // return false; // Not in the list, but event is already completed, or is starting to complete, and adding more waiters would fail this.
170
171 unsigned i;
172 unsigned numAdded=0;
173 if (guid==UNASSIGNED_RAKNET_GUID)
174 {
175 for (i=0; i < rakPeerInterface->GetMaximumNumberOfPeers(); i++)
176 {
177 RakNetGUID firstGuid = rakPeerInterface->GetGUIDFromIndex(i);
178 if (firstGuid!=UNASSIGNED_RAKNET_GUID)
179 {
180 numAdded+=AddToWaitListInternal(eventIndex, firstGuid);
181 }
182 }
183 }
184 else
185 {
186 numAdded=AddToWaitListInternal(eventIndex, guid);
187 }
188
189 if (numAdded>0)
190 UpdateReadyStatus(eventIndex);
191 return numAdded>0;
192 }
193 bool ReadyEvent::RemoveFromWaitList(int eventId, RakNetGUID guid)
194 {
195 bool eventExists;
196 unsigned eventIndex = readyEventNodeList.GetIndexFromKey(eventId, &eventExists);
197 if (eventExists)
198 {
199 if (guid==UNASSIGNED_RAKNET_GUID)
200 {
201 // Remove all waiters
202 readyEventNodeList[eventIndex]->systemList.Clear(false, _FILE_AND_LINE_);
203 UpdateReadyStatus(eventIndex);
204 }
205 else
206 {
207 bool systemExists;
208 unsigned systemIndex = readyEventNodeList[eventIndex]->systemList.GetIndexFromKey(guid, &systemExists);
209 if (systemExists)
210 {
211 bool isCompleted = IsEventCompletedByIndex(eventIndex);
212 readyEventNodeList[eventIndex]->systemList.RemoveAtIndex(systemIndex);
213
214 if (isCompleted==false && IsEventCompletedByIndex(eventIndex))
215 PushCompletionPacket(readyEventNodeList[eventIndex]->eventId);
216
217 UpdateReadyStatus(eventIndex);
218
219 return true;
220 }
221 }
222 }
223
224 return false;
225 }
226 bool ReadyEvent::IsInWaitList(int eventId, RakNetGUID guid)
227 {
228 bool objectExists;
229 unsigned readyIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
230 if (objectExists)
231 {
232 return readyEventNodeList[readyIndex]->systemList.HasData(guid);
233 }
234 return false;
235 }
236
237 unsigned ReadyEvent::GetRemoteWaitListSize(int eventId) const
238 {
239 bool objectExists;
240 unsigned readyIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
241 if (objectExists)
242 {
243 return readyEventNodeList[readyIndex]->systemList.Size();
244 }
245 return 0;
246 }
247
248 RakNetGUID ReadyEvent::GetFromWaitListAtIndex(int eventId, unsigned index) const
249 {
250 bool objectExists;
251 unsigned readyIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
252 if (objectExists)
253 {
254 return readyEventNodeList[readyIndex]->systemList[index].rakNetGuid;
255 }
256 return UNASSIGNED_RAKNET_GUID;
257 }
258 ReadyEventSystemStatus ReadyEvent::GetReadyStatus(int eventId, RakNetGUID guid)
259 {
260 bool objectExists;
261 unsigned readyIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
262 if (objectExists)
263 {
264 ReadyEventNode *ren = readyEventNodeList[readyIndex];
265 unsigned systemIndex = ren->systemList.GetIndexFromKey(guid, &objectExists);
266 if (objectExists==false)
267 return RES_NOT_WAITING;
268 if (ren->systemList[systemIndex].lastReceivedStatus==ID_READY_EVENT_SET)
269 return RES_READY;
270 if (ren->systemList[systemIndex].lastReceivedStatus==ID_READY_EVENT_UNSET)
271 return RES_WAITING;
272 if (ren->systemList[systemIndex].lastReceivedStatus==ID_READY_EVENT_ALL_SET)
273 return RES_ALL_READY;
274 }
275
276 return RES_UNKNOWN_EVENT;
277 }
278 void ReadyEvent::SetSendChannel(unsigned char newChannel)
279 {
280 channel=newChannel;
281 }
282 PluginReceiveResult ReadyEvent::OnReceive(Packet *packet)
283 {
284 unsigned char packetIdentifier;
285 packetIdentifier = ( unsigned char ) packet->data[ 0 ];
286
287 // bool doPrint = packet->systemAddress.GetPort()==60002 || rakPeerInterface->GetInternalID(UNASSIGNED_SYSTEM_ADDRESS).GetPort()==60002;
288
289 switch (packetIdentifier)
290 {
291 case ID_READY_EVENT_UNSET:
292 case ID_READY_EVENT_SET:
293 case ID_READY_EVENT_ALL_SET:
294 // if (doPrint) {if (packet->systemAddress.GetPort()==60002) RAKNET_DEBUG_PRINTF("FROM 60002: "); else if (rakPeerInterface->GetInternalID(UNASSIGNED_SYSTEM_ADDRESS).port==60002) RAKNET_DEBUG_PRINTF("TO 60002: "); RAKNET_DEBUG_PRINTF("ID_READY_EVENT_SET\n");}
295 OnReadyEventPacketUpdate(packet);
296 return RR_CONTINUE_PROCESSING;
297 case ID_READY_EVENT_FORCE_ALL_SET:
298 OnReadyEventForceAllSet(packet);
299 return RR_CONTINUE_PROCESSING;
300 case ID_READY_EVENT_QUERY:
301 // if (doPrint) {if (packet->systemAddress.GetPort()==60002) RAKNET_DEBUG_PRINTF("FROM 60002: "); else if (rakPeerInterface->GetInternalID(UNASSIGNED_SYSTEM_ADDRESS).port==60002) RAKNET_DEBUG_PRINTF("TO 60002: "); RAKNET_DEBUG_PRINTF("ID_READY_EVENT_QUERY\n");}
302 OnReadyEventQuery(packet);
303 return RR_STOP_PROCESSING_AND_DEALLOCATE;
304 }
305
306 return RR_CONTINUE_PROCESSING;
307 }
308 bool ReadyEvent::AddToWaitListInternal(unsigned eventIndex, RakNetGUID guid)
309 {
310 ReadyEventNode *ren = readyEventNodeList[eventIndex];
311 bool objectExists;
312 unsigned systemIndex = ren->systemList.GetIndexFromKey(guid, &objectExists);
313 if (objectExists==false)
314 {
315 RemoteSystem rs;
316 rs.lastReceivedStatus=ID_READY_EVENT_UNSET;
317 rs.lastSentStatus=ID_READY_EVENT_UNSET;
318 rs.rakNetGuid=guid;
319 ren->systemList.InsertAtIndex(rs,systemIndex, _FILE_AND_LINE_);
320
321 SendReadyStateQuery(ren->eventId, guid);
322 return true;
323 }
324 return false;
325 }
326 void ReadyEvent::OnReadyEventForceAllSet(Packet *packet)
327 {
328 SLNet::BitStream incomingBitStream(packet->data, packet->length, false);
329 incomingBitStream.IgnoreBits(8);
330 int eventId;
331 incomingBitStream.Read(eventId);
332 bool objectExists;
333 unsigned readyIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
334 if (objectExists)
335 {
336 ReadyEventNode *ren = readyEventNodeList[readyIndex];
337 if (ren->eventStatus!=ID_READY_EVENT_FORCE_ALL_SET)
338 {
339 ren->eventStatus=ID_READY_EVENT_FORCE_ALL_SET;
340 PushCompletionPacket(ren->eventId);
341 }
342 }
343 }
344 void ReadyEvent::OnReadyEventPacketUpdate(Packet *packet)
345 {
346 SLNet::BitStream incomingBitStream(packet->data, packet->length, false);
347 incomingBitStream.IgnoreBits(8);
348 int eventId;
349 incomingBitStream.Read(eventId);
350 bool objectExists;
351 unsigned readyIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
352 if (objectExists)
353 {
354 ReadyEventNode *ren = readyEventNodeList[readyIndex];
355 bool systemExists;
356 unsigned systemIndex = ren->systemList.GetIndexFromKey(packet->guid, &systemExists);
357 if (systemExists)
358 {
359 // Just return if no change
360 if (ren->systemList[systemIndex].lastReceivedStatus==packet->data[0])
361 return;
362
363 bool wasCompleted = IsEventCompletedByIndex(readyIndex);
364 ren->systemList[systemIndex].lastReceivedStatus=packet->data[0];
365 // If forced all set, doesn't matter what the new packet is
366 if (ren->eventStatus==ID_READY_EVENT_FORCE_ALL_SET)
367 return;
368 UpdateReadyStatus(readyIndex);
369 if (wasCompleted==false && IsEventCompletedByIndex(readyIndex))
370 PushCompletionPacket(readyIndex);
371 }
372 }
373 }
374 void ReadyEvent::OnReadyEventQuery(Packet *packet)
375 {
376 SLNet::BitStream incomingBitStream(packet->data, packet->length, false);
377 incomingBitStream.IgnoreBits(8);
378 int eventId;
379 incomingBitStream.Read(eventId);
380 bool objectExists;
381 unsigned readyIndex = readyEventNodeList.GetIndexFromKey(eventId, &objectExists);
382 if (objectExists)
383 {
384 unsigned systemIndex = readyEventNodeList[readyIndex]->systemList.GetIndexFromKey(packet->guid,&objectExists);
385 // Force the non-default send, because our initial send may have arrived at a system that didn't yet create the ready event
386 if (objectExists)
387 SendReadyUpdate(readyIndex, systemIndex, true);
388 }
389 }
390 void ReadyEvent::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
391 {
392 (void) systemAddress;
393 (void) rakNetGUID;
394 (void) lostConnectionReason;
395
396 RemoveFromAllLists(rakNetGUID);
397 }
398 void ReadyEvent::OnRakPeerShutdown(void)
399 {
400 Clear();
401 }
402
403 bool ReadyEvent::SetEventByIndex(int eventIndex, bool isReady)
404 {
405 ReadyEventNode *ren = readyEventNodeList[eventIndex];
406 if ((ren->eventStatus==ID_READY_EVENT_ALL_SET || ren->eventStatus==ID_READY_EVENT_SET) && isReady==true)
407 return false; // Success - no change
408 if (ren->eventStatus==ID_READY_EVENT_UNSET && isReady==false)
409 return false; // Success - no change
410 if (ren->eventStatus==ID_READY_EVENT_FORCE_ALL_SET)
411 return false; // Can't change
412
413 if (isReady)
414 ren->eventStatus=ID_READY_EVENT_SET;
415 else
416 ren->eventStatus=ID_READY_EVENT_UNSET;
417
418 UpdateReadyStatus(eventIndex);
419
420 // Check if now completed, and if so, tell the user about it
421 if (IsEventCompletedByIndex(eventIndex))
422 {
423 PushCompletionPacket(ren->eventId);
424 }
425
426 return true;
427 }
428
429 bool ReadyEvent::IsEventCompletedByIndex(unsigned eventIndex) const
430 {
431 ReadyEventNode *ren = readyEventNodeList[eventIndex];
432 unsigned i;
433 if (ren->eventStatus==ID_READY_EVENT_FORCE_ALL_SET)
434 return true;
435 if (ren->eventStatus!=ID_READY_EVENT_ALL_SET)
436 return false;
437 for (i=0; i < ren->systemList.Size(); i++)
438 if (ren->systemList[i].lastReceivedStatus!=ID_READY_EVENT_ALL_SET)
439 return false;
440 return true;
441 }
442
443 void ReadyEvent::Clear(void)
444 {
445 unsigned i;
446 for (i=0; i < readyEventNodeList.Size(); i++)
447 {
448 SLNet::OP_DELETE(readyEventNodeList[i], _FILE_AND_LINE_);
449 }
450 readyEventNodeList.Clear(false, _FILE_AND_LINE_);
451 }
452
453 unsigned ReadyEvent::CreateNewEvent(int eventId, bool isReady)
454 {
455 ReadyEventNode *ren = SLNet::OP_NEW<ReadyEventNode>( _FILE_AND_LINE_ );
456 ren->eventId=eventId;
457 if (isReady==false)
458 ren->eventStatus=ID_READY_EVENT_UNSET;
459 else
460 ren->eventStatus=ID_READY_EVENT_SET;
461 return readyEventNodeList.Insert(eventId, ren, true, _FILE_AND_LINE_);
462 }
463 void ReadyEvent::UpdateReadyStatus(unsigned eventIndex)
464 {
465 ReadyEventNode *ren = readyEventNodeList[eventIndex];
466 bool anyUnset;
467 unsigned i;
468 if (ren->eventStatus==ID_READY_EVENT_SET)
469 {
470 // If you are set, and no other systems are ID_READY_EVENT_UNSET, then change your status to ID_READY_EVENT_ALL_SET
471 anyUnset=false;
472 for (i=0; i < ren->systemList.Size(); i++)
473 {
474 if (ren->systemList[i].lastReceivedStatus==ID_READY_EVENT_UNSET)
475 {
476 anyUnset=true;
477 break;
478 }
479 }
480 if (anyUnset==false)
481 {
482 ren->eventStatus=ID_READY_EVENT_ALL_SET;
483 }
484 }
485 else if (ren->eventStatus==ID_READY_EVENT_ALL_SET)
486 {
487 // If you are all set, and any systems are ID_READY_EVENT_UNSET, then change your status to ID_READY_EVENT_SET
488 anyUnset=false;
489 for (i=0; i < ren->systemList.Size(); i++)
490 {
491 if (ren->systemList[i].lastReceivedStatus==ID_READY_EVENT_UNSET)
492 {
493 anyUnset=true;
494 break;
495 }
496 }
497 if (anyUnset==true)
498 {
499 ren->eventStatus=ID_READY_EVENT_SET;
500 }
501 }
502 BroadcastReadyUpdate(eventIndex, false);
503 }
504 void ReadyEvent::SendReadyUpdate(unsigned eventIndex, unsigned systemIndex, bool forceIfNotDefault)
505 {
506 ReadyEventNode *ren = readyEventNodeList[eventIndex];
507 SLNet::BitStream bs;
508 // I do this rather than write true or false, so users that do not use BitStreams can still read the data
509 if ((ren->eventStatus!=ren->systemList[systemIndex].lastSentStatus) ||
510 (forceIfNotDefault && ren->eventStatus!=ID_READY_EVENT_UNSET))
511 {
512 bs.Write(ren->eventStatus);
513 bs.Write(ren->eventId);
514 SendUnified(&bs, HIGH_PRIORITY, RELIABLE_ORDERED, channel, ren->systemList[systemIndex].rakNetGuid, false);
515
516 ren->systemList[systemIndex].lastSentStatus=ren->eventStatus;
517 }
518
519 }
520 void ReadyEvent::BroadcastReadyUpdate(unsigned eventIndex, bool forceIfNotDefault)
521 {
522 ReadyEventNode *ren = readyEventNodeList[eventIndex];
523 unsigned systemIndex;
524 for (systemIndex=0; systemIndex < ren->systemList.Size(); systemIndex++)
525 {
526 SendReadyUpdate(eventIndex, systemIndex, forceIfNotDefault);
527 }
528 }
529 void ReadyEvent::SendReadyStateQuery(unsigned eventId, RakNetGUID guid)
530 {
531 SLNet::BitStream bs;
532 bs.Write((MessageID)ID_READY_EVENT_QUERY);
533 bs.Write(eventId);
534 SendUnified(&bs, HIGH_PRIORITY, RELIABLE_ORDERED, channel, guid, false);
535 }
536 void ReadyEvent::RemoveFromAllLists(RakNetGUID guid)
537 {
538 unsigned eventIndex;
539 for (eventIndex=0; eventIndex < readyEventNodeList.Size(); eventIndex++)
540 {
541 bool isCompleted = IsEventCompletedByIndex(eventIndex);
542 bool systemExists;
543 unsigned systemIndex;
544
545 systemIndex = readyEventNodeList[eventIndex]->systemList.GetIndexFromKey(guid, &systemExists);
546 if (systemExists)
547 readyEventNodeList[eventIndex]->systemList.RemoveAtIndex(systemIndex);
548
549 UpdateReadyStatus(eventIndex);
550
551 if (isCompleted==false && IsEventCompletedByIndex(eventIndex))
552 PushCompletionPacket(readyEventNodeList[eventIndex]->eventId);
553 }
554 }
555 void ReadyEvent::PushCompletionPacket(unsigned eventId)
556 {
557 (void) eventId;
558 // Not necessary
559 /*
560 // Pass a packet to the user that we are now completed, as setting ourselves to signaled was the last thing being waited on
561 Packet *p = AllocatePacketUnified(sizeof(MessageID)+sizeof(int));
562 SLNet::BitStream bs(p->data, sizeof(MessageID)+sizeof(int), false);
563 bs.SetWriteOffset(0);
564 bs.Write((MessageID)ID_READY_EVENT_ALL_SET);
565 bs.Write(eventId);
566 rakPeerInterface->PushBackPacket(p, false);
567 */
568 }
569
570 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ConsoleServer.cpp Source File

  • src
ConsoleServer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_ConsoleServer==1
18
19 #include "slikenet/ConsoleServer.h"
20 #include "slikenet/TransportInterface.h"
21 #include "slikenet/CommandParserInterface.h"
22 #include <string.h>
23 #include <stdlib.h>
24
25 #define COMMAND_DELINATOR ' '
26 #define COMMAND_DELINATOR_TOGGLE '"'
27
28 #include "slikenet/LinuxStrings.h"
29 #include "slikenet/linux_adapter.h"
30 #include "slikenet/osx_adapter.h"
31
32 using namespace SLNet;
33
34 STATIC_FACTORY_DEFINITIONS(ConsoleServer,ConsoleServer);
35
36 ConsoleServer::ConsoleServer()
37 {
38 transport=0;
39 password[0]=0;
40 prompt=0;
41 }
42 ConsoleServer::~ConsoleServer()
43 {
44 if (prompt)
45 rakFree_Ex(prompt, _FILE_AND_LINE_);
46 }
47 void ConsoleServer::SetTransportProvider(TransportInterface *transportInterface, unsigned short port)
48 {
49 // Replace the current TransportInterface, stopping the old one, if present, and starting the new one.
50 if (transportInterface)
51 {
52 if (transport)
53 {
54 RemoveCommandParser(transport->GetCommandParser());
55 transport->Stop();
56 }
57 transport=transportInterface;
58 transport->Start(port, true);
59
60 unsigned i;
61 for (i=0; i < commandParserList.Size(); i++)
62 commandParserList[i]->OnTransportChange(transport);
63
64 // The transport itself might have a command parser - for example password for the RakNet transport
65 AddCommandParser(transport->GetCommandParser());
66 }
67 }
68 void ConsoleServer::AddCommandParser(CommandParserInterface *commandParserInterface)
69 {
70 if (commandParserInterface==0)
71 return;
72
73 // Non-duplicate insertion
74 unsigned i;
75 for (i=0; i < commandParserList.Size(); i++)
76 {
77 if (commandParserList[i]==commandParserInterface)
78 return;
79
80 if (_stricmp(commandParserList[i]->GetName(), commandParserInterface->GetName())==0)
81 {
82 // Naming conflict between two command parsers
83 RakAssert(0);
84 return;
85 }
86 }
87
88 commandParserList.Insert(commandParserInterface, _FILE_AND_LINE_);
89 if (transport)
90 commandParserInterface->OnTransportChange(transport);
91 }
92 void ConsoleServer::RemoveCommandParser(CommandParserInterface *commandParserInterface)
93 {
94 if (commandParserInterface==0)
95 return;
96
97 // Overwrite the element we are removing from the back of the list and delete the back of the list
98 unsigned i;
99 for (i=0; i < commandParserList.Size(); i++)
100 {
101 if (commandParserList[i]==commandParserInterface)
102 {
103 commandParserList[i]=commandParserList[commandParserList.Size()-1];
104 commandParserList.RemoveFromEnd();
105 return;
106 }
107 }
108 }
109 void ConsoleServer::Update(void)
110 {
111 unsigned i;
112 char *parameterList[20]; // Up to 20 parameters
113 unsigned numParameters;
114 SLNet::SystemAddress newOrLostConnectionId;
115 SLNet::Packet *p;
116 SLNet::RegisteredCommand rc;
117
118 p = transport->Receive();
119 newOrLostConnectionId=transport->HasNewIncomingConnection();
120
121 if (newOrLostConnectionId!=UNASSIGNED_SYSTEM_ADDRESS)
122 {
123 for (i=0; i < commandParserList.Size(); i++)
124 {
125 commandParserList[i]->OnNewIncomingConnection(newOrLostConnectionId, transport);
126 }
127
128 transport->Send(newOrLostConnectionId, "Connected to remote command console.\r\nType 'help' for help.\r\n");
129 ListParsers(newOrLostConnectionId);
130 ShowPrompt(newOrLostConnectionId);
131 }
132
133 newOrLostConnectionId=transport->HasLostConnection();
134 if (newOrLostConnectionId!=UNASSIGNED_SYSTEM_ADDRESS)
135 {
136 for (i=0; i < commandParserList.Size(); i++)
137 commandParserList[i]->OnConnectionLost(newOrLostConnectionId, transport);
138 }
139
140 while (p)
141 {
142 bool commandParsed=false;
143 char copy[REMOTE_MAX_TEXT_INPUT];
144 memcpy(copy, p->data, p->length);
145 copy[p->length]=0;
146 SLNet::CommandParserInterface::ParseConsoleString((char*)p->data, COMMAND_DELINATOR, COMMAND_DELINATOR_TOGGLE, &numParameters, parameterList, 20); // Up to 20 parameters
147 if (numParameters==0)
148 {
149 transport->DeallocatePacket(p);
150 p = transport->Receive();
151 continue;
152 }
153 if (_stricmp(*parameterList, "help")==0 && numParameters<=2)
154 {
155 // Find the parser specified and display help for it
156 if (numParameters==1)
157 {
158 transport->Send(p->systemAddress, "\r\nINSTRUCTIONS:\r\n");
159 transport->Send(p->systemAddress, "Enter commands on your keyboard, using spaces to delineate parameters.\r\n");
160 transport->Send(p->systemAddress, "You can use quotation marks to toggle space delineation.\r\n");
161 transport->Send(p->systemAddress, "You can connect multiple times from the same computer.\r\n");
162 transport->Send(p->systemAddress, "You can direct commands to a parser by prefixing the parser name or number.\r\n");
163 transport->Send(p->systemAddress, "COMMANDS:\r\n");
164 transport->Send(p->systemAddress, "help Show this display.\r\n");
165 transport->Send(p->systemAddress, "help <ParserName> Show help on a particular parser.\r\n");
166 transport->Send(p->systemAddress, "help <CommandName> Show help on a particular command.\r\n");
167 transport->Send(p->systemAddress, "quit Disconnects from the server.\r\n");
168 transport->Send(p->systemAddress, "[<ParserName>] <Command> [<Parameters>] Execute a command\r\n");
169 transport->Send(p->systemAddress, "[<ParserNumber>] <Command> [<Parameters>] Execute a command\r\n");
170 ListParsers(p->systemAddress);
171 //ShowPrompt(p->systemAddress);
172 }
173 else // numParameters == 2, including the help tag
174 {
175 for (i=0; i < commandParserList.Size(); i++)
176 {
177 if (_stricmp(parameterList[1], commandParserList[i]->GetName())==0)
178 {
179 commandParsed=true;
180 commandParserList[i]->SendHelp(transport, p->systemAddress);
181 transport->Send(p->systemAddress, "COMMAND LIST:\r\n");
182 commandParserList[i]->SendCommandList(transport, p->systemAddress);
183 transport->Send(p->systemAddress, "\r\n");
184 break;
185 }
186 }
187
188 if (commandParsed==false)
189 {
190 // Try again, for all commands for all parsers.
191 SLNet::RegisteredCommand rc2;
192 for (i=0; i < commandParserList.Size(); i++)
193 {
194 if (commandParserList[i]->GetRegisteredCommand(parameterList[1], &rc2))
195 {
196 if (rc2.parameterCount== SLNet::CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS)
197 transport->Send(p->systemAddress, "(Variable parms): %s %s\r\n", rc2.command, rc2.commandHelp);
198 else
199 transport->Send(p->systemAddress, "(%i parms): %s %s\r\n", rc2.parameterCount, rc2.command, rc2.commandHelp);
200 commandParsed=true;
201 break;
202 }
203 }
204 }
205
206 if (commandParsed==false)
207 {
208 // Don't know what to do
209 transport->Send(p->systemAddress, "Unknown help topic: %s.\r\n", parameterList[1]);
210 }
211 //ShowPrompt(p->systemAddress);
212 }
213 }
214 else if (_stricmp(*parameterList, "quit")==0 && numParameters==1)
215 {
216 transport->Send(p->systemAddress, "Goodbye!\r\n");
217 transport->CloseConnection(p->systemAddress);
218 }
219 else
220 {
221 bool tryAllParsers=true;
222 bool failed=false;
223
224 if (numParameters >=2) // At minimum <CommandParserName> <Command>
225 {
226 unsigned commandParserIndex=(unsigned)-1;
227 // Prefixing with numbers directs to a particular parser
228 if (**parameterList>='0' && **parameterList<='9')
229 {
230 commandParserIndex=atoi(*parameterList); // Use specified parser unless it's an invalid number
231 commandParserIndex--; // Subtract 1 since we displayed numbers starting at index+1
232 if (commandParserIndex >= commandParserList.Size())
233 {
234 transport->Send(p->systemAddress, "Invalid index.\r\n");
235 failed=true;
236 }
237 }
238 else
239 {
240 // // Prefixing with the name of a command parser directs to that parser. See if the first word matches a parser
241 for (i=0; i < commandParserList.Size(); i++)
242 {
243 if (_stricmp(parameterList[0], commandParserList[i]->GetName())==0)
244 {
245 commandParserIndex=i; // Matches parser at index i
246 break;
247 }
248 }
249 }
250
251 if (failed==false)
252 {
253 // -1 means undirected, so otherwise this is directed to a target
254 if (commandParserIndex!=(unsigned)-1)
255 {
256 // Only this parser should use this command
257 tryAllParsers=false;
258 if (commandParserList[commandParserIndex]->GetRegisteredCommand(parameterList[1], &rc))
259 {
260 commandParsed=true;
261 if (rc.parameterCount==CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS || rc.parameterCount==numParameters-2)
262 commandParserList[commandParserIndex]->OnCommand(rc.command, numParameters-2, parameterList+2, transport, p->systemAddress, copy);
263 else
264 transport->Send(p->systemAddress, "Invalid parameter count.\r\n(%i parms): %s %s\r\n", rc.parameterCount, rc.command, rc.commandHelp);
265 }
266 }
267 }
268 }
269
270 if (failed == false && tryAllParsers)
271 {
272 for (i=0; i < commandParserList.Size(); i++)
273 {
274 // Undirected command. Try all the parsers to see if they understand the command
275 // Pass the 1nd element as the command, and the remainder as the parameter list
276 if (commandParserList[i]->GetRegisteredCommand(parameterList[0], &rc))
277 {
278 commandParsed=true;
279
280 if (rc.parameterCount==CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS || rc.parameterCount==numParameters-1)
281 commandParserList[i]->OnCommand(rc.command, numParameters-1, parameterList+1, transport, p->systemAddress, copy);
282 else
283 transport->Send(p->systemAddress, "Invalid parameter count.\r\n(%i parms): %s %s\r\n", rc.parameterCount, rc.command, rc.commandHelp);
284 }
285 }
286 }
287 if (commandParsed==false && commandParserList.Size() > 0)
288 {
289 transport->Send(p->systemAddress, "Unknown command: Type 'help' for help.\r\n");
290 }
291
292 }
293
294 ShowPrompt(p->systemAddress);
295
296 transport->DeallocatePacket(p);
297 p = transport->Receive();
298 }
299 }
300
301 void ConsoleServer::ListParsers(SystemAddress systemAddress)
302 {
303 transport->Send(systemAddress,"INSTALLED PARSERS:\r\n");
304 unsigned i;
305 for (i=0; i < commandParserList.Size(); i++)
306 {
307 transport->Send(systemAddress, "%i. %s\r\n", i+1, commandParserList[i]->GetName());
308 }
309 }
310 void ConsoleServer::ShowPrompt(SystemAddress systemAddress)
311 {
312 transport->Send(systemAddress, prompt);
313 }
314 void ConsoleServer::SetPrompt(const char *_prompt)
315 {
316 if (prompt)
317 rakFree_Ex(prompt,_FILE_AND_LINE_);
318 if (_prompt && _prompt[0])
319 {
320 size_t len = strlen(_prompt);
321 prompt = (char*) rakMalloc_Ex(len+1,_FILE_AND_LINE_);
322 strcpy_s(prompt,len+1,_prompt);
323 }
324 else
325 prompt=0;
326 }
327
328 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/XBox360Includes.h Source File

  • include
  • slikenet
XBox360Includes.h
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082 without any modifications.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 */
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/RandSync.h Source File

  • include
  • slikenet
RandSync.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __RAND_SYNC_H
23 #define __RAND_SYNC_H
24
25 #include "Export.h"
26 #include "Rand.h"
27 #include "DS_Queue.h"
28 #include "NativeTypes.h"
29
30 namespace SLNet {
31
32 class BitStream;
33
34 class RAK_DLL_EXPORT RakNetRandomSync
35 {
36 public:
37 RakNetRandomSync();
38 virtual ~RakNetRandomSync();
39 void SeedMT( uint32_t _seed );
40 void SeedMT( uint32_t _seed, uint32_t skipValues );
41 float FrandomMT( void );
42 unsigned int RandomMT( void );
43 uint32_t GetSeed( void ) const;
44 uint32_t GetCallCount( void ) const;
45 void SetCallCount( uint32_t i );
46
47 virtual void SerializeConstruction(SLNet::BitStream *constructionBitstream);
48 virtual bool DeserializeConstruction(SLNet::BitStream *constructionBitstream);
49 virtual void Serialize(SLNet::BitStream *outputBitstream);
50 virtual void Deserialize(SLNet::BitStream *outputBitstream);
51
52 protected:
53 void Skip( uint32_t count );
54 DataStructures::Queue<unsigned int> usedValues;
55 uint32_t seed;
56 uint32_t callCount;
57 uint32_t usedValueBufferCount;
58 RakNetRandom rnr;
59 };
60 } // namespace SLNet
61
62
63 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SignaledEvent.cpp Source File

  • src
SignaledEvent.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/SignaledEvent.h"
17 #include "slikenet/assert.h"
18 #include "slikenet/sleep.h"
19
20 #if defined(__GNUC__)
21 #include <sys/time.h>
22 #include <unistd.h>
23 #endif
24
25 using namespace SLNet;
26
27
28
29
30
31 SignaledEvent::SignaledEvent()
32 {
33 #ifdef _WIN32
34 eventList=INVALID_HANDLE_VALUE;
35
36
37 #else
38 isSignaled=false;
39 #endif
40 }
41 SignaledEvent::~SignaledEvent()
42 {
43 // Intentionally do not close event, so it doesn't close twice on linux
44 }
45
46 void SignaledEvent::InitEvent(void)
47 {
48 #if defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
49 eventList=CreateEventEx(0, 0, 0, 0);
50 #elif defined(_WIN32)
51 eventList=CreateEvent(0, false, false, 0);
52
53
54
55
56
57
58
59
60
61 #else
62
63 #if !defined(ANDROID)
64 pthread_condattr_init( &condAttr );
65 pthread_cond_init(&eventList, &condAttr);
66 #else
67 pthread_cond_init(&eventList, 0);
68 #endif
69 pthread_mutexattr_init( &mutexAttr );
70 pthread_mutex_init(&hMutex, &mutexAttr);
71 #endif
72 }
73
74 void SignaledEvent::CloseEvent(void)
75 {
76 #ifdef _WIN32
77 if (eventList!=INVALID_HANDLE_VALUE)
78 {
79 CloseHandle(eventList);
80 eventList=INVALID_HANDLE_VALUE;
81 }
82
83
84
85
86
87
88
89
90
91 #else
92 pthread_cond_destroy(&eventList);
93 pthread_mutex_destroy(&hMutex);
94 #if !defined(ANDROID)
95 pthread_condattr_destroy( &condAttr );
96 #endif
97 pthread_mutexattr_destroy( &mutexAttr );
98 #endif
99 }
100
101 void SignaledEvent::SetEvent(void)
102 {
103 #ifdef _WIN32
104 ::SetEvent(eventList);
105
106
107
108
109
110
111
112
113
114
115 #else
116 // Different from SetEvent which stays signaled.
117 // We have to record manually that the event was signaled
118 isSignaledMutex.Lock();
119 isSignaled=true;
120 isSignaledMutex.Unlock();
121
122 // Unblock waiting threads
123 pthread_cond_broadcast(&eventList);
124 #endif
125 }
126
127 void SignaledEvent::WaitOnEvent(int timeoutMs)
128 {
129 #ifdef _WIN32
130 // WaitForMultipleObjects(
131 // 2,
132 // eventList,
133 // false,
134 // timeoutMs);
135 WaitForSingleObjectEx(eventList,timeoutMs,FALSE);
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177 #else
178
179 // If was previously set signaled, just unset and return
180 isSignaledMutex.Lock();
181 if (isSignaled==true)
182 {
183 isSignaled=false;
184 isSignaledMutex.Unlock();
185 return;
186 }
187 isSignaledMutex.Unlock();
188
189
190
191 //struct timespec ts;
192
193 // Else wait for SetEvent to be called
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211 struct timespec ts;
212
213 int rc;
214 struct timeval tp;
215 rc = gettimeofday(&tp, NULL);
216 ts.tv_sec = tp.tv_sec;
217 ts.tv_nsec = tp.tv_usec * 1000;
218 // #endif
219
220 while (timeoutMs > 30)
221 {
222 // Wait 30 milliseconds for the signal, then check again.
223 // This is in case we missed the signal between the top of this function and pthread_cond_timedwait, or after the end of the loop and pthread_cond_timedwait
224 ts.tv_nsec += 30*1000000;
225 if (ts.tv_nsec >= 1000000000)
226 {
227 ts.tv_nsec -= 1000000000;
228 ts.tv_sec++;
229 }
230
231 // [SBC] added mutex lock/unlock around cond_timedwait.
232 // this prevents airplay from generating a whole much of errors.
233 // not sure how this works on other platforms since according to
234 // the docs you are suppost to hold the lock before you wait
235 // on the cond.
236 pthread_mutex_lock(&hMutex);
237 pthread_cond_timedwait(&eventList, &hMutex, &ts);
238 pthread_mutex_unlock(&hMutex);
239
240 timeoutMs-=30;
241
242 isSignaledMutex.Lock();
243 if (isSignaled==true)
244 {
245 isSignaled=false;
246 isSignaledMutex.Unlock();
247 return;
248 }
249 isSignaledMutex.Unlock();
250 }
251
252 // Wait the remaining time, and turn off the signal in case it was set
253 ts.tv_nsec += timeoutMs*1000000;
254 if (ts.tv_nsec >= 1000000000)
255 {
256 ts.tv_nsec -= 1000000000;
257 ts.tv_sec++;
258 }
259
260 pthread_mutex_lock(&hMutex);
261 pthread_cond_timedwait(&eventList, &hMutex, &ts);
262 pthread_mutex_unlock(&hMutex);
263
264 isSignaledMutex.Lock();
265 isSignaled=false;
266 isSignaledMutex.Unlock();
267
268 #endif
269 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/Itoa.cpp Source File

  • src
Itoa.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 // Fast itoa from http://www.jb.man.ac.uk/~slowe/cpp/itoa.html for Linux since it seems like Linux doesn't support this function.
23 // I modified it to remove the std dependencies.
24 char* Itoa( int value, char* result, int base )
25 {
26 // check that the base if valid
27 if (base < 2 || base > 16) { *result = 0; return result; }
28 char* out = result;
29 int quotient = value;
30
31 int absQModB;
32
33 do {
34 // KevinJ - get rid of this dependency
35 //*out = "0123456789abcdef"[ std::abs( quotient % base ) ];
36 absQModB=quotient % base;
37 if (absQModB < 0)
38 absQModB=-absQModB;
39 *out = "0123456789abcdef"[ absQModB ];
40 ++out;
41 quotient /= base;
42 } while ( quotient );
43
44 // Only apply negative sign for base 10
45 if ( value < 0 && base == 10) *out++ = '-';
46
47 // KevinJ - get rid of this dependency
48 // std::reverse( result, out );
49 *out = 0;
50
51 // KevinJ - My own reverse code
52 char *start = result;
53 char temp;
54 out--;
55 while (start < out)
56 {
57 temp=*start;
58 *start=*out;
59 *out=temp;
60 start++;
61 out--;
62 }
63
64 return result;
65 }
66
67 #ifdef __cplusplus
68 }
69 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Export.h Source File

  • include
  • slikenet
Export.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "defines.h"
17
18 #if defined(_WIN32) && !(defined(__GNUC__) || defined(__GCCXML__)) && !defined(_RAKNET_LIB) && defined(_RAKNET_DLL)
19 #define RAK_DLL_EXPORT __declspec(dllexport)
20 #else
21 #define RAK_DLL_EXPORT
22 #endif
23
24 #define STATIC_FACTORY_DECLARATIONS(x) static x* GetInstance(void); \
25 static void DestroyInstance( x *i);
26
27 #define STATIC_FACTORY_DEFINITIONS(x,y) x* x::GetInstance(void) {return SLNet::OP_NEW<y>( _FILE_AND_LINE_ );} \
28 void x::DestroyInstance( x *i) {SLNet::OP_DELETE(( y* ) i, _FILE_AND_LINE_);}
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/VitaIncludes.h Source File

  • include
  • slikenet
VitaIncludes.h
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082 without any modifications.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 */
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CheckSum.h Source File

  • include
  • slikenet
CheckSum.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21 #ifndef __CHECKSUM_H
22 #define __CHECKSUM_H
23
24 #include "memoryoverride.h"
25
27 class CheckSum
28 {
29
30 public:
31
33
34 CheckSum()
35 {
36 Clear();
37 }
38
39 void Clear()
40 {
41 sum = 0;
42 r = 55665;
43 c1 = 52845;
44 c2 = 22719;
45 }
46
47 void Add ( unsigned int w );
48
49
50 void Add ( unsigned short w );
51
52 void Add ( unsigned char* b, unsigned int length );
53
54 void Add ( unsigned char b );
55
56 unsigned int Get ()
57 {
58 return sum;
59 }
60
61 protected:
62 unsigned short r;
63 unsigned short c1;
64 unsigned short c2;
65 unsigned int sum;
66 };
67
68 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SendToThread.cpp Source File

  • src
SendToThread.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/SendToThread.h"
17 #ifdef USE_THREADED_SEND
18 #include "slikenet/thread.h"
19 #include "slikenet/InternalPacket.h"
20 #include "slikenet/GetTime.h"
21
22 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL!=1
23 #include "slikenet/CCRakNetUDT.h"
24 #else
25 #include "slikenet/CCRakNetSlidingWindow.h"
26 #endif
27
28 using namespace SLNet;
29
30 int SendToThread::refCount=0;
31 DataStructures::ThreadsafeAllocatingQueue<SendToThread::SendToThreadBlock> SendToThread::objectQueue;
32 ThreadPool<SendToThread::SendToThreadBlock*,SendToThread::SendToThreadBlock*> SendToThread::threadPool;
33
34 SendToThread::SendToThreadBlock* SendToWorkerThread(SendToThread::SendToThreadBlock* input, bool *returnOutput, void* perThreadData)
35 {
36 (void) perThreadData;
37 *returnOutput=false;
38 // SLNet::TimeUS *mostRecentTime=(SLNet::TimeUS *)input->data;
39 // *mostRecentTime=SLNet::GetTimeUS();
40 SocketLayer::SendTo(input->s, input->data, input->dataWriteOffset, input->systemAddress, _FILE_AND_LINE_);
41 SendToThread::objectQueue.Push(input);
42 return 0;
43 }
44 SendToThread::SendToThread()
45 {
46 }
47 SendToThread::~SendToThread()
48 {
49
50 }
51 void SendToThread::AddRef(void)
52 {
53 if (++refCount==1)
54 {
55 threadPool.StartThreads(1,0);
56 }
57 }
58 void SendToThread::Deref(void)
59 {
60 if (refCount>0)
61 {
62 if (--refCount==0)
63 {
64 threadPool.StopThreads();
65 RakAssert(threadPool.NumThreadsWorking()==0);
66
67 unsigned i;
68 SendToThreadBlock* info;
69 for (i=0; i < threadPool.InputSize(); i++)
70 {
71 info = threadPool.GetInputAtIndex(i);
72 objectQueue.Push(info);
73 }
74 threadPool.ClearInput();
75 objectQueue.Clear(_FILE_AND_LINE_);
76 }
77 }
78 }
79 SendToThread::SendToThreadBlock* SendToThread::AllocateBlock(void)
80 {
81 SendToThread::SendToThreadBlock *b;
82 b=objectQueue.Pop();
83 if (b==0)
84 b=objectQueue.Allocate(_FILE_AND_LINE_);
85 return b;
86 }
87 void SendToThread::ProcessBlock(SendToThread::SendToThreadBlock* threadedSend)
88 {
89 RakAssert(threadedSend->dataWriteOffset>0 && threadedSend->dataWriteOffset<=MAXIMUM_MTU_SIZE-UDP_HEADER_SIZE);
90 threadPool.AddInput(SendToWorkerThread,threadedSend);
91 }
92 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/thread.h Source File

  • include
  • slikenet
thread.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __RAK_THREAD_H
17 #define __RAK_THREAD_H
18
19 #if defined(_WIN32_WCE)
20 #include "WindowsIncludes.h"
21 #endif
22
23
24
25
26
27 #include "Export.h"
28
29
30
31
32
33
34 #if defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
35 #include "../DependentExtensions/WinPhone8/ThreadEmulation.h"
36 using namespace ThreadEmulation;
37 #endif
38
39 namespace SLNet
40 {
42 #if defined(_WIN32_WCE) || defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
43 #define RAK_THREAD_DECLARATION(functionName) DWORD WINAPI functionName(LPVOID arguments)
44
45
46 #elif defined(_WIN32)
47 #define RAK_THREAD_DECLARATION(functionName) unsigned __stdcall functionName( void* arguments )
48
49
50 #else
51 #define RAK_THREAD_DECLARATION(functionName) void* functionName( void* arguments )
52 #endif
53
54 class RAK_DLL_EXPORT RakThread
55 {
56 public:
57
58
59
60
66
67 /*
68 nice value Win32 Priority
69 -20 to -16 THREAD_PRIORITY_HIGHEST
70 -15 to -6 THREAD_PRIORITY_ABOVE_NORMAL
71 -5 to +4 THREAD_PRIORITY_NORMAL
72 +5 to +14 THREAD_PRIORITY_BELOW_NORMAL
73 +15 to +19 THREAD_PRIORITY_LOWEST
74 */
75 #if defined(_WIN32_WCE) || defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
76 static int Create( LPTHREAD_START_ROUTINE start_address, void *arglist, int priority=0);
77
78
79 #elif defined(_WIN32)
80 static int Create( unsigned __stdcall start_address( void* ), void *arglist, int priority=0);
81
82
83
84 #else
85 static int Create( void* start_address( void* ), void *arglist, int priority=0);
86 #endif
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 };
108
109 }
110
111 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • VariableListDeltaTracker
SLNet::VariableListDeltaTracker Member List

This is the complete list of members for SLNet::VariableListDeltaTracker, including all inherited members.

FlagDirtyFromBitArray(unsigned char *bArray) | SLNet::VariableListDeltaTracker |
IsPastEndOfList(void) const | SLNet::VariableListDeltaTracker | inline
nextWriteIndex | SLNet::VariableListDeltaTracker | protected
ReadVarFromBitstream(VarType &varData, SLNet::BitStream *bitStream) | SLNet::VariableListDeltaTracker | inlinestatic
StartWrite(void) | SLNet::VariableListDeltaTracker |
variableList | SLNet::VariableListDeltaTracker | protected
VariableListDeltaTracker() | SLNet::VariableListDeltaTracker |
WriteVar(const VarType &varData) | SLNet::VariableListDeltaTracker | inline
WriteVarToBitstream(const VarType &varData, SLNet::BitStream *bitStream) | SLNet::VariableListDeltaTracker | inline
WriteVarToBitstream(const VarType &varData, SLNet::BitStream *bitStream, unsigned char *bArray, unsigned short writeOffset) | SLNet::VariableListDeltaTracker | inline
~VariableListDeltaTracker() | SLNet::VariableListDeltaTracker |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetSmartPtr
SLNet::RakNetSmartPtr< T > Member List

This is the complete list of members for SLNet::RakNetSmartPtr< T >, including all inherited members.

Clone(bool copyContents) | SLNet::RakNetSmartPtr< T > | inline
GetRefCount(void) const | SLNet::RakNetSmartPtr< T > | inline
IsNull(void) const | SLNet::RakNetSmartPtr< T > | inline
IsUnique(void) const | SLNet::RakNetSmartPtr< T > | inline
operator!=(const RakNetSmartPtr< T > &sp) | SLNet::RakNetSmartPtr< T > | inline
operator*() | SLNet::RakNetSmartPtr< T > | inline
operator*() const | SLNet::RakNetSmartPtr< T > | inline
operator->() | SLNet::RakNetSmartPtr< T > | inline
operator->() const | SLNet::RakNetSmartPtr< T > | inline
operator<(const RakNetSmartPtr< T > &right) | SLNet::RakNetSmartPtr< T > | inline
operator=(const RakNetSmartPtr< T > &sp) | SLNet::RakNetSmartPtr< T > | inline
operator==(const RakNetSmartPtr< T > &sp) | SLNet::RakNetSmartPtr< T > | inline
operator>(const RakNetSmartPtr< T > &right) | SLNet::RakNetSmartPtr< T > | inline
RakNetSmartPtr() | SLNet::RakNetSmartPtr< T > | inline
RakNetSmartPtr(T *pValue) | SLNet::RakNetSmartPtr< T > | inline
RakNetSmartPtr(const RakNetSmartPtr< T > &sp) | SLNet::RakNetSmartPtr< T > | inline
SetNull(void) | SLNet::RakNetSmartPtr< T > | inline
~RakNetSmartPtr() | SLNet::RakNetSmartPtr< T > | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ThreadPool.h Source File

  • include
  • slikenet
ThreadPool.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __THREAD_POOL_H
17 #define __THREAD_POOL_H
18
19 #include "memoryoverride.h"
20 #include "DS_Queue.h"
21 #include "SimpleMutex.h"
22 #include "Export.h"
23 #include "thread.h"
24 #include "SignaledEvent.h"
25
26 class ThreadDataInterface
27 {
28 public:
29 ThreadDataInterface() {}
30 virtual ~ThreadDataInterface() {}
31
32 virtual void* PerThreadFactory(void *context)=0;
33 virtual void PerThreadDestructor(void* factoryResult, void *context)=0;
34 };
39 template <class InputType, class OutputType>
40 struct RAK_DLL_EXPORT ThreadPool
41 {
42 ThreadPool();
43 ~ThreadPool();
44
51 bool StartThreads(int numThreads, int stackSize, void* (*_perThreadInit)()=0, void (*_perThreadDeinit)(void*)=0);
52
53 // Alternate form of _perThreadDataFactory, _perThreadDataDestructor
54 void SetThreadDataInterface(ThreadDataInterface *tdi, void *context);
55
57 void StopThreads(void);
58
67 void AddInput(OutputType (*workerThreadCallback)(InputType, bool *returnOutput, void* perThreadData), InputType inputData);
68
72 void AddOutput(OutputType outputData);
73
76 bool HasOutput(void);
77
80 bool HasOutputFast(void);
81
84 bool HasInput(void);
85
88 bool HasInputFast(void);
89
93 OutputType GetOutput(void);
94
96 void Clear(void);
97
100 void LockInput(void);
101
103 void UnlockInput(void);
104
106 unsigned InputSize(void);
107
109 InputType GetInputAtIndex(unsigned index);
110
112 void RemoveInputAtIndex(unsigned index);
113
116 void LockOutput(void);
117
119 void UnlockOutput(void);
120
122 unsigned OutputSize(void);
123
125 OutputType GetOutputAtIndex(unsigned index);
126
128 void RemoveOutputAtIndex(unsigned index);
129
131 void ClearInput(void);
132
134 void ClearOutput(void);
135
137 bool IsWorking(void);
138
140 int NumThreadsWorking(void);
141
143 bool WasStarted(void);
144
145 // Block until all threads are stopped.
146 bool Pause(void);
147
148 // Continue running
149 void Resume(void);
150
151 protected:
152 // It is valid to cancel input before it is processed. To do so, lock the inputQueue with inputQueueMutex,
153 // Scan the list, and remove the item you don't want.
154 SLNet::SimpleMutex inputQueueMutex, outputQueueMutex, workingThreadCountMutex, runThreadsMutex;
155
156 void* (*perThreadDataFactory)();
157 void (*perThreadDataDestructor)(void*);
158
159 // inputFunctionQueue & inputQueue are paired arrays so if you delete from one at a particular index you must delete from the other
160 // at the same index
161 DataStructures::Queue<OutputType (*)(InputType, bool *, void*)> inputFunctionQueue;
162 DataStructures::Queue<InputType> inputQueue;
163 DataStructures::Queue<OutputType> outputQueue;
164
165 ThreadDataInterface *threadDataInterface;
166 void *tdiContext;
167
168
169 template <class ThreadInputType, class ThreadOutputType>
170 friend RAK_THREAD_DECLARATION(WorkerThread);
171
172 /*
173 #ifdef _WIN32
174 friend unsigned __stdcall WorkerThread( LPVOID arguments );
175 #else
176 friend void* WorkerThread( void* arguments );
177 #endif
178 */
179
181 bool runThreads;
183 int numThreadsRunning;
185 int numThreadsWorking;
187 SLNet::SimpleMutex numThreadsRunningMutex;
188
189 SLNet::SignaledEvent quitAndIncomingDataEvents;
190
191 // #if defined(SN_TARGET_PSP2)
192 // SLNet::RakThread::UltUlThreadRuntime *runtime;
193 // #endif
194 };
195
196 #include "ThreadPool.h"
197 #include "sleep.h"
198 #ifdef _WIN32
199
200 #else
201 #include <unistd.h>
202 #endif
203
204 template <class ThreadInputType, class ThreadOutputType>
205 RAK_THREAD_DECLARATION(WorkerThread)
206 /*
207 #ifdef _WIN32
208 unsigned __stdcall WorkerThread( LPVOID arguments )
209 #else
210 void* WorkerThread( void* arguments )
211 #endif
212 */
213 {
214
215
216
217 ThreadPool<ThreadInputType, ThreadOutputType> *threadPool = (ThreadPool<ThreadInputType, ThreadOutputType>*) arguments;
218
219
220 bool returnOutput;
221 ThreadOutputType (*userCallback)(ThreadInputType, bool *, void*);
222 ThreadInputType inputData;
223 ThreadOutputType callbackOutput;
224
225 userCallback=0;
226
227 void *perThreadData;
228 if (threadPool->perThreadDataFactory)
229 perThreadData=threadPool->perThreadDataFactory();
230 else if (threadPool->threadDataInterface)
231 perThreadData=threadPool->threadDataInterface->PerThreadFactory(threadPool->tdiContext);
232 else
233 perThreadData=0;
234
235 // Increase numThreadsRunning
236 threadPool->numThreadsRunningMutex.Lock();
237 ++threadPool->numThreadsRunning;
238 threadPool->numThreadsRunningMutex.Unlock();
239
240 for(;;)
241 {
242 //#ifdef _WIN32
243 if (userCallback==0)
244 {
245 threadPool->quitAndIncomingDataEvents.WaitOnEvent(1000);
246 }
247 // #else
248 // if (userCallback==0)
249 // RakSleep(30);
250 // #endif
251
252 threadPool->runThreadsMutex.Lock();
253 if (threadPool->runThreads==false)
254 {
255 threadPool->runThreadsMutex.Unlock();
256 break;
257 }
258 threadPool->runThreadsMutex.Unlock();
259
260 threadPool->workingThreadCountMutex.Lock();
261 ++threadPool->numThreadsWorking;
262 threadPool->workingThreadCountMutex.Unlock();
263
264 // Read input data
265 userCallback=0;
266 threadPool->inputQueueMutex.Lock();
267 if (threadPool->inputFunctionQueue.Size())
268 {
269 userCallback=threadPool->inputFunctionQueue.Pop();
270 inputData=threadPool->inputQueue.Pop();
271 }
272 threadPool->inputQueueMutex.Unlock();
273
274 if (userCallback)
275 {
276 callbackOutput=userCallback(inputData, &returnOutput,perThreadData);
277 if (returnOutput)
278 {
279 threadPool->outputQueueMutex.Lock();
280 threadPool->outputQueue.Push(callbackOutput, _FILE_AND_LINE_ );
281 threadPool->outputQueueMutex.Unlock();
282 }
283 }
284
285 threadPool->workingThreadCountMutex.Lock();
286 --threadPool->numThreadsWorking;
287 threadPool->workingThreadCountMutex.Unlock();
288 }
289
290 // Decrease numThreadsRunning
291 threadPool->numThreadsRunningMutex.Lock();
292 --threadPool->numThreadsRunning;
293 threadPool->numThreadsRunningMutex.Unlock();
294
295 if (threadPool->perThreadDataDestructor)
296 threadPool->perThreadDataDestructor(perThreadData);
297 else if (threadPool->threadDataInterface)
298 threadPool->threadDataInterface->PerThreadDestructor(perThreadData, threadPool->tdiContext);
299
300
301
302
303 return 0;
304
305 }
306 template <class InputType, class OutputType>
307 ThreadPool<InputType, OutputType>::ThreadPool()
308 {
309 runThreads=false;
310 numThreadsRunning=0;
311 threadDataInterface=0;
312 tdiContext=0;
313 numThreadsWorking=0;
314
315 }
316 template <class InputType, class OutputType>
317 ThreadPool<InputType, OutputType>::~ThreadPool()
318 {
319 StopThreads();
320 Clear();
321 }
322 template <class InputType, class OutputType>
323 bool ThreadPool<InputType, OutputType>::StartThreads(int numThreads, int stackSize, void* (*_perThreadDataFactory)(), void (*_perThreadDataDestructor)(void *))
324 {
325 (void) stackSize;
326
327 // #if defined(SN_TARGET_PSP2)
328 // runtime = SLNet::RakThread::AllocRuntime(numThreads);
329 // #endif
330
331 runThreadsMutex.Lock();
332 if (runThreads==true)
333 {
334 // Already running
335 runThreadsMutex.Unlock();
336 return false;
337 }
338 runThreadsMutex.Unlock();
339
340 quitAndIncomingDataEvents.InitEvent();
341
342 perThreadDataFactory=_perThreadDataFactory;
343 perThreadDataDestructor=_perThreadDataDestructor;
344
345 runThreadsMutex.Lock();
346 runThreads=true;
347 runThreadsMutex.Unlock();
348
349 numThreadsWorking=0;
350 unsigned threadId = 0;
351 (void) threadId;
352 int i;
353 for (i=0; i < numThreads; i++)
354 {
355 int errorCode;
356
357
358
359
360 errorCode = SLNet::RakThread::Create(WorkerThread<InputType, OutputType>, this);
361
362 if (errorCode!=0)
363 {
364 StopThreads();
365 return false;
366 }
367 }
368 // Wait for number of threads running to increase to numThreads
369 bool done=false;
370 while (done==false)
371 {
372 RakSleep(50);
373 numThreadsRunningMutex.Lock();
374 if (numThreadsRunning==numThreads)
375 done=true;
376 numThreadsRunningMutex.Unlock();
377 }
378
379 return true;
380 }
381 template <class InputType, class OutputType>
382 void ThreadPool<InputType, OutputType>::SetThreadDataInterface(ThreadDataInterface *tdi, void *context)
383 {
384 threadDataInterface=tdi;
385 tdiContext=context;
386 }
387 template <class InputType, class OutputType>
388 void ThreadPool<InputType, OutputType>::StopThreads(void)
389 {
390 runThreadsMutex.Lock();
391 if (runThreads==false)
392 {
393 runThreadsMutex.Unlock();
394 return;
395 }
396
397 runThreads=false;
398 runThreadsMutex.Unlock();
399
400 // Wait for number of threads running to decrease to 0
401 bool done=false;
402 while (done==false)
403 {
404 quitAndIncomingDataEvents.SetEvent();
405
406 RakSleep(50);
407 numThreadsRunningMutex.Lock();
408 if (numThreadsRunning==0)
409 done=true;
410 numThreadsRunningMutex.Unlock();
411 }
412
413 quitAndIncomingDataEvents.CloseEvent();
414
415 // #if defined(SN_TARGET_PSP2)
416 // SLNet::RakThread::DeallocRuntime(runtime);
417 // runtime=0;
418 // #endif
419
420 }
421 template <class InputType, class OutputType>
422 void ThreadPool<InputType, OutputType>::AddInput(OutputType (*workerThreadCallback)(InputType, bool *returnOutput, void* perThreadData), InputType inputData)
423 {
424 inputQueueMutex.Lock();
425 inputQueue.Push(inputData, _FILE_AND_LINE_ );
426 inputFunctionQueue.Push(workerThreadCallback, _FILE_AND_LINE_ );
427 inputQueueMutex.Unlock();
428
429 quitAndIncomingDataEvents.SetEvent();
430 }
431 template <class InputType, class OutputType>
432 void ThreadPool<InputType, OutputType>::AddOutput(OutputType outputData)
433 {
434 outputQueueMutex.Lock();
435 outputQueue.Push(outputData, _FILE_AND_LINE_ );
436 outputQueueMutex.Unlock();
437 }
438 template <class InputType, class OutputType>
439 bool ThreadPool<InputType, OutputType>::HasOutputFast(void)
440 {
441 return outputQueue.IsEmpty()==false;
442 }
443 template <class InputType, class OutputType>
444 bool ThreadPool<InputType, OutputType>::HasOutput(void)
445 {
446 bool res;
447 outputQueueMutex.Lock();
448 res=outputQueue.IsEmpty()==false;
449 outputQueueMutex.Unlock();
450 return res;
451 }
452 template <class InputType, class OutputType>
453 bool ThreadPool<InputType, OutputType>::HasInputFast(void)
454 {
455 return inputQueue.IsEmpty()==false;
456 }
457 template <class InputType, class OutputType>
458 bool ThreadPool<InputType, OutputType>::HasInput(void)
459 {
460 bool res;
461 inputQueueMutex.Lock();
462 res=inputQueue.IsEmpty()==false;
463 inputQueueMutex.Unlock();
464 return res;
465 }
466 template <class InputType, class OutputType>
467 OutputType ThreadPool<InputType, OutputType>::GetOutput(void)
468 {
469 // Real output check
470 OutputType output;
471 outputQueueMutex.Lock();
472 output=outputQueue.Pop();
473 outputQueueMutex.Unlock();
474 return output;
475 }
476 template <class InputType, class OutputType>
477 void ThreadPool<InputType, OutputType>::Clear(void)
478 {
479 runThreadsMutex.Lock();
480 if (runThreads)
481 {
482 runThreadsMutex.Unlock();
483 inputQueueMutex.Lock();
484 inputFunctionQueue.Clear(_FILE_AND_LINE_);
485 inputQueue.Clear(_FILE_AND_LINE_);
486 inputQueueMutex.Unlock();
487
488 outputQueueMutex.Lock();
489 outputQueue.Clear(_FILE_AND_LINE_);
490 outputQueueMutex.Unlock();
491 }
492 else
493 {
494 inputFunctionQueue.Clear(_FILE_AND_LINE_);
495 inputQueue.Clear(_FILE_AND_LINE_);
496 outputQueue.Clear(_FILE_AND_LINE_);
497 }
498 }
499 template <class InputType, class OutputType>
500 void ThreadPool<InputType, OutputType>::LockInput(void)
501 {
502 inputQueueMutex.Lock();
503 }
504 template <class InputType, class OutputType>
505 void ThreadPool<InputType, OutputType>::UnlockInput(void)
506 {
507 inputQueueMutex.Unlock();
508 }
509 template <class InputType, class OutputType>
510 unsigned ThreadPool<InputType, OutputType>::InputSize(void)
511 {
512 return inputQueue.Size();
513 }
514 template <class InputType, class OutputType>
515 InputType ThreadPool<InputType, OutputType>::GetInputAtIndex(unsigned index)
516 {
517 return inputQueue[index];
518 }
519 template <class InputType, class OutputType>
520 void ThreadPool<InputType, OutputType>::RemoveInputAtIndex(unsigned index)
521 {
522 inputQueue.RemoveAtIndex(index);
523 inputFunctionQueue.RemoveAtIndex(index);
524 }
525 template <class InputType, class OutputType>
526 void ThreadPool<InputType, OutputType>::LockOutput(void)
527 {
528 outputQueueMutex.Lock();
529 }
530 template <class InputType, class OutputType>
531 void ThreadPool<InputType, OutputType>::UnlockOutput(void)
532 {
533 outputQueueMutex.Unlock();
534 }
535 template <class InputType, class OutputType>
536 unsigned ThreadPool<InputType, OutputType>::OutputSize(void)
537 {
538 return outputQueue.Size();
539 }
540 template <class InputType, class OutputType>
541 OutputType ThreadPool<InputType, OutputType>::GetOutputAtIndex(unsigned index)
542 {
543 return outputQueue[index];
544 }
545 template <class InputType, class OutputType>
546 void ThreadPool<InputType, OutputType>::RemoveOutputAtIndex(unsigned index)
547 {
548 outputQueue.RemoveAtIndex(index);
549 }
550 template <class InputType, class OutputType>
551 void ThreadPool<InputType, OutputType>::ClearInput(void)
552 {
553 inputQueue.Clear(_FILE_AND_LINE_);
554 inputFunctionQueue.Clear(_FILE_AND_LINE_);
555 }
556
557 template <class InputType, class OutputType>
558 void ThreadPool<InputType, OutputType>::ClearOutput(void)
559 {
560 outputQueue.Clear(_FILE_AND_LINE_);
561 }
562 template <class InputType, class OutputType>
563 bool ThreadPool<InputType, OutputType>::IsWorking(void)
564 {
565 bool isWorking;
566 // workingThreadCountMutex.Lock();
567 // isWorking=numThreadsWorking!=0;
568 // workingThreadCountMutex.Unlock();
569
570 // if (isWorking)
571 // return true;
572
573 // Bug fix: Originally the order of these two was reversed.
574 // It's possible with the thread timing that working could have been false, then it picks up the data in the other thread, then it checks
575 // here and sees there is no data. So it thinks the thread is not working when it was.
576 if (HasOutputFast() && HasOutput())
577 return true;
578
579 if (HasInputFast() && HasInput())
580 return true;
581
582 // Need to check is working again, in case the thread was between the first and second checks
583 workingThreadCountMutex.Lock();
584 isWorking=numThreadsWorking!=0;
585 workingThreadCountMutex.Unlock();
586
587 return isWorking;
588 }
589
590 template <class InputType, class OutputType>
591 int ThreadPool<InputType, OutputType>::NumThreadsWorking(void)
592 {
593 return numThreadsWorking;
594 }
595
596 template <class InputType, class OutputType>
597 bool ThreadPool<InputType, OutputType>::WasStarted(void)
598 {
599 bool b;
600 runThreadsMutex.Lock();
601 b = runThreads;
602 runThreadsMutex.Unlock();
603 return b;
604 }
605 template <class InputType, class OutputType>
606 bool ThreadPool<InputType, OutputType>::Pause(void)
607 {
608 if (WasStarted()==false)
609 return false;
610
611 workingThreadCountMutex.Lock();
612 while (numThreadsWorking>0)
613 {
614 RakSleep(30);
615 }
616 return true;
617 }
618 template <class InputType, class OutputType>
619 void ThreadPool<InputType, OutputType>::Resume(void)
620 {
621 workingThreadCountMutex.Unlock();
622 }
623
624 #endif
625
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • BinarySearchTree
DataStructures::BinarySearchTree< BinarySearchTreeType > Member List

This is the complete list of members for DataStructures::BinarySearchTree< BinarySearchTreeType >, including all inherited members.

Add(const BinarySearchTreeType &input, const char *file, unsigned int line) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
BinarySearchTree() | DataStructures::BinarySearchTree< BinarySearchTreeType > |
BinarySearchTree(const BinarySearchTree &original_type) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
BinarySearchTree_size | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
Clear(const char *file, unsigned int line) | DataStructures::BinarySearchTree< BinarySearchTreeType > | inline
Del(const BinarySearchTreeType &input, const char *file, unsigned int line) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
direction | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
Direction_Types enum name | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
DisplayBreadthFirstSearch(BinarySearchTreeType *return_array) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
DisplayInorder(BinarySearchTreeType *return_array) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
DisplayPostorder(BinarySearchTreeType *return_array) | DataStructures::BinarySearchTree< BinarySearchTreeType > | inline
DisplayPostorderRecursive(node *current, BinarySearchTreeType *return_array, unsigned int &index) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
DisplayPreorder(BinarySearchTreeType *return_array) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
Find(const BinarySearchTreeType &element, node **parent) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
FindParent(const BinarySearchTreeType &element) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
FixTree(node *current) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
GetPointerToNode(const BinarySearchTreeType &element) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
Height(node *starting_node=0) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
HeightRecursive(node *current) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
IsIn(const BinarySearchTreeType &input) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
LEFT enum value | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
NOT_FOUND enum value | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
operator=(const BinarySearchTree &original_copy) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
RIGHT enum value | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
root | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
ROOT enum value | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
Size(void) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
~BinarySearchTree() | DataStructures::BinarySearchTree< BinarySearchTreeType > | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • HTTPConnection
SLNet::HTTPConnection Member List

This is the complete list of members for SLNet::HTTPConnection, including all inherited members.

currentProcessingCommand | SLNet::HTTPConnection |
Deleted enum value | SLNet::HTTPConnection |
Get(const char *path) | SLNet::HTTPConnection |
GetServerAddress(void) const | SLNet::HTTPConnection |
GetState(void) const | SLNet::HTTPConnection |
HasBadResponse(int *code, SLNet::RakString *data) | SLNet::HTTPConnection |
HasRead(void) const | SLNet::HTTPConnection |
HTTPConnection() | SLNet::HTTPConnection |
Init(TCPInterface *_tcp, const char *host, unsigned short port=80) | SLNet::HTTPConnection |
IsBusy(void) const | SLNet::HTTPConnection |
NoBody enum value | SLNet::HTTPConnection |
OK enum value | SLNet::HTTPConnection |
operator=(const HTTPConnection &rhs) | SLNet::HTTPConnection | inline
outgoingCommand | SLNet::HTTPConnection |
Post(const char *path, const char *data, const char *_contentType="application/x-www-form-urlencoded") | SLNet::HTTPConnection |
ProcessTCPPacket(Packet *packet) | SLNet::HTTPConnection |
Read(void) | SLNet::HTTPConnection |
ResponseCodes enum name | SLNet::HTTPConnection |
Update(void) | SLNet::HTTPConnection |
~HTTPConnection() | SLNet::HTTPConnection | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • LogCommandParser
SLNet::LogCommandParser Member List

This is the complete list of members for SLNet::LogCommandParser, including all inherited members.

AddChannel(const char *channelName) | SLNet::LogCommandParser |
channelNames | SLNet::LogCommandParser | protected
commandList | SLNet::CommandParserInterface | protected
CommandParserInterface() | SLNet::CommandParserInterface |
GetChannelIndexFromName(const char *channelName) | SLNet::LogCommandParser | protected
GetName(void) const | SLNet::LogCommandParser | virtual
GetRegisteredCommand(const char *command, RegisteredCommand *rc) | SLNet::CommandParserInterface | virtual
LogCommandParser() | SLNet::LogCommandParser |
OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString) | SLNet::LogCommandParser | virtual
OnConnectionLost(const SystemAddress &systemAddress, TransportInterface *transport) | SLNet::LogCommandParser | virtual
OnNewIncomingConnection(const SystemAddress &systemAddress, TransportInterface *transport) | SLNet::LogCommandParser | virtual
OnTransportChange(TransportInterface *transport) | SLNet::LogCommandParser | virtual
ParseConsoleString(char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength) | SLNet::CommandParserInterface | static
PrintChannels(const SystemAddress &systemAddress, TransportInterface *transport) const | SLNet::LogCommandParser | protected
RegisterCommand(unsigned char parameterCount, const char *command, const char *commandHelp) | SLNet::CommandParserInterface | virtual
remoteUsers | SLNet::LogCommandParser | protected
ReturnResult(bool res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(char *res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(SystemAddress res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(int res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
ReturnResult(const char *command, TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
SendCommandList(TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::CommandParserInterface | virtual
SendHelp(TransportInterface *transport, const SystemAddress &systemAddress) | SLNet::LogCommandParser | virtual
Subscribe(const SystemAddress &systemAddress, const char *channelName) | SLNet::LogCommandParser | protected
trans | SLNet::LogCommandParser | protected
Unsubscribe(const SystemAddress &systemAddress, const char *channelName) | SLNet::LogCommandParser | protected
VARIABLE_NUMBER_OF_PARAMETERS | SLNet::CommandParserInterface | static
WriteLog(const char *channelName, const char *format,...) | SLNet::LogCommandParser |
~CommandParserInterface() | SLNet::CommandParserInterface | virtual
~LogCommandParser() | SLNet::LogCommandParser |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketOutputWindowLogger.h Source File

  • include
  • slikenet
PacketOutputWindowLogger.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_PacketLogger==1
23
24 #ifndef __PACKET_OUTPUT_WINDOW_LOGGER_H_
25 #define __PACKET_OUTPUT_WINDOW_LOGGER_H_
26
27 #include "PacketLogger.h"
28
29 namespace SLNet
30 {
31
34 class RAK_DLL_EXPORT PacketOutputWindowLogger : public PacketLogger
35 {
36 public:
37 PacketOutputWindowLogger();
38 virtual ~PacketOutputWindowLogger();
39 virtual void WriteLog(const char *str);
40 protected:
41 };
42
43 } // namespace SLNet
44
45 #endif
46
47 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/WSAStartupSingleton.cpp Source File

  • src
WSAStartupSingleton.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/WSAStartupSingleton.h"
17
18
19
20
21
22 #if defined(_WIN32) && !defined(WINDOWS_STORE_RT)
23 #include <winsock2.h>
24 #include <ws2tcpip.h>
25
26
27
28
29
30 #endif
31 #include "slikenet/defines.h"
32 #include <stdio.h>
33
34 #ifdef _WIN32
35 #include <tchar.h>
36 #else
37 #ifndef _T
38 #define _T(x) (x)
39 #endif
40 #endif
41
42 int WSAStartupSingleton::refCount=0;
43
44 WSAStartupSingleton::WSAStartupSingleton() {}
45 WSAStartupSingleton::~WSAStartupSingleton() {}
46 void WSAStartupSingleton::AddRef(void)
47 {
48 #if defined(_WIN32) && !defined(WINDOWS_STORE_RT)
49
50 refCount++;
51
52 if (refCount!=1)
53 return;
54
55
56
57
58
59 WSADATA winsockInfo;
60 if ( WSAStartup( MAKEWORD( 2, 2 ), &winsockInfo ) != 0 )
61 {
62 #if defined(_DEBUG) && !defined(WINDOWS_PHONE_8)
63 DWORD dwIOError = GetLastError();
64 LPTSTR messageBuffer;
65 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
66 NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
67 ( LPTSTR ) & messageBuffer, 0, NULL );
68 // something has gone wrong here...
69 RAKNET_DEBUG_TPRINTF( _T("WSAStartup failed:Error code - %lu\n%s"), dwIOError, messageBuffer );
70 //Free the buffer.
71 LocalFree( messageBuffer );
72 #endif
73 }
74
75 #endif
76 }
77 void WSAStartupSingleton::Deref(void)
78 {
79 #if defined(_WIN32) && !defined(WINDOWS_STORE_RT)
80 if (refCount==0)
81 return;
82
83 if (refCount>1)
84 {
85 refCount--;
86 return;
87 }
88
89 WSACleanup();
90
91
92
93
94
95
96 refCount=0;
97 #endif
98 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
CSHA1 Member List

This is the complete list of members for CSHA1, including all inherited members.

CSHA1() | CSHA1 |
Final() | CSHA1 |
GetHash(UINT_8 *pbDest20) const | CSHA1 |
GetHash(void) const | CSHA1 |
HashFile(const TCHAR *tszFileName) | CSHA1 |
HMAC(unsigned char *sharedKey, int sharedKeyLength, unsigned char *data, int dataLength, unsigned char output[SHA1_LENGTH]) | CSHA1 | static
REPORT_DIGIT enum value | CSHA1 |
REPORT_HEX enum value | CSHA1 |
REPORT_HEX_SHORT enum value | CSHA1 |
REPORT_TYPE enum name | CSHA1 |
ReportHash(TCHAR *tszReport, REPORT_TYPE rtReportType=REPORT_HEX) const | CSHA1 |
ReportHashStl(std::basic_string< TCHAR > &strOut, REPORT_TYPE rtReportType=REPORT_HEX) const | CSHA1 |
Reset() | CSHA1 |
Update(const UINT_8 *pbData, UINT_32 uLen) | CSHA1 |
~CSHA1() | CSHA1 |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TCPInterface.cpp Source File

  • src
TCPInterface.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_TCPInterface==1
18
22
23
24
25 #include "slikenet/TCPInterface.h"
26 #ifdef _WIN32
27 #if !defined (WINDOWS_STORE_RT)
28 typedef int socklen_t;
29 #endif
30
31
32 #else
33 #include <sys/time.h>
34 #include <unistd.h>
35 #include <pthread.h>
36 #endif
37 #include <string.h>
38 #include "slikenet/assert.h"
39 #include <stdio.h>
40 #include "slikenet/assert.h"
41 #include "slikenet/sleep.h"
42 #include "slikenet/StringCompressor.h"
43 #include "slikenet/StringTable.h"
44 #include "slikenet/Itoa.h"
45 #include "slikenet/SocketLayer.h"
46 #include "slikenet/SocketDefines.h"
47 #if (defined(__GNUC__) || defined(__GCCXML__)) && !defined(__WIN32__)
48 #include <netdb.h>
49 #endif
50
51 #ifdef _DO_PRINTF
52 #endif
53
54 #ifdef _WIN32
55 #include "slikenet/WSAStartupSingleton.h"
56 #endif
57 namespace SLNet
58 {
59 RAK_THREAD_DECLARATION(UpdateTCPInterfaceLoop);
60 RAK_THREAD_DECLARATION(ConnectionAttemptLoop);
61 }
62 #ifdef _MSC_VER
63 #pragma warning( push )
64 #endif
65 #include "slikenet/linux_adapter.h"
66 #include "slikenet/osx_adapter.h"
67
68 using namespace SLNet;
69
70 STATIC_FACTORY_DEFINITIONS(TCPInterface,TCPInterface);
71
72 TCPInterface::TCPInterface()
73 {
74 #if !defined(WINDOWS_STORE_RT)
75 listenSocket=0;
76 #endif
77 remoteClients=0;
78 remoteClientsLength=0;
79
80 StringCompressor::AddReference();
81 SLNet::StringTable::AddReference();
82
83 #if OPEN_SSL_CLIENT_SUPPORT==1
84 ctx=0;
85 meth=0;
86 #endif
87
88 #ifdef _WIN32
89 WSAStartupSingleton::AddRef();
90 #endif
91 }
92 TCPInterface::~TCPInterface()
93 {
94 Stop();
95 #ifdef _WIN32
96 WSAStartupSingleton::Deref();
97 #endif
98
99 SLNet::OP_DELETE_ARRAY(remoteClients,_FILE_AND_LINE_);
100
101 StringCompressor::RemoveReference();
102 SLNet::StringTable::RemoveReference();
103 }
104 #if !defined(WINDOWS_STORE_RT)
105 bool TCPInterface::CreateListenSocket(unsigned short port, unsigned short maxIncomingConnections, unsigned short socketFamily, const char *bindAddress)
106 {
107 (void) maxIncomingConnections;
108 (void) socketFamily;
109 #if RAKNET_SUPPORT_IPV6!=1
110 listenSocket = socket__(AF_INET, SOCK_STREAM, 0);
111 if ((int)listenSocket ==-1)
112 return false;
113
114 struct sockaddr_in serverAddress;
115 memset(&serverAddress,0,sizeof(sockaddr_in));
116 serverAddress.sin_family = AF_INET;
117 if ( bindAddress && bindAddress[0] )
118 {
119
120
121
122
123
124 inet_pton(AF_INET, bindAddress, &serverAddress.sin_addr.s_addr);
125
126 }
127 else
128 serverAddress.sin_addr.s_addr = INADDR_ANY;
129
130 serverAddress.sin_port = htons(port);
131
132 SocketLayer::SetSocketOptions(listenSocket, false, false);
133
134 if (bind__(listenSocket,(struct sockaddr *) &serverAddress,sizeof(serverAddress)) < 0)
135 return false;
136
137 listen__(listenSocket, maxIncomingConnections);
138 #else
139 (void)bindAddress;
140 struct addrinfo hints;
141 memset(&hints, 0, sizeof (addrinfo)); // make sure the struct is empty
142 hints.ai_family = socketFamily; // don't care IPv4 or IPv6
143 hints.ai_socktype = SOCK_STREAM; // TCP sockets
144 hints.ai_flags = AI_PASSIVE; // fill in my IP for me
145 struct addrinfo *servinfo=0, *aip; // will point to the results
146 char portStr[32];
147 Itoa(port,portStr,10);
148
149 getaddrinfo(0, portStr, &hints, &servinfo);
150 for (aip = servinfo; aip != NULL; aip = aip->ai_next)
151 {
152 // Open socket. The address type depends on what
153 // getaddrinfo() gave us.
154 listenSocket = socket__(aip->ai_family, aip->ai_socktype, aip->ai_protocol);
155 if (listenSocket != 0)
156 {
157 int ret = bind__( listenSocket, aip->ai_addr, (int) aip->ai_addrlen );
158 if (ret>=0)
159 {
160 break;
161 }
162 else
163 {
164 closesocket__(listenSocket);
165 listenSocket=0;
166 }
167 }
168 }
169
170 if (listenSocket==0)
171 return false;
172
173 SocketLayer::SetSocketOptions(listenSocket, false, false);
174
175 listen__(listenSocket, maxIncomingConnections);
176 #endif // #if RAKNET_SUPPORT_IPV6!=1
177
178 return true;
179 }
180 #endif
181
182 #if defined(WINDOWS_STORE_RT)
183 bool TCPInterface::CreateListenSocket_WinStore8(unsigned short port, unsigned short maxIncomingConnections, unsigned short socketFamily, const char *bindAddress)
184 {
185 listenSocket = WinRTCreateStreamSocket(AF_INET, SOCK_STREAM, 0);
186 return true;
187 }
188 #endif
189 bool TCPInterface::Start(unsigned short port, unsigned short maxIncomingConnections, unsigned short maxConnections, int _threadPriority, unsigned short socketFamily, const char *bindAddress)
190 {
191 #ifdef __native_client__
192 return false;
193 #else
194 (void) socketFamily;
195
196 if (isStarted.GetValue()>0)
197 return false;
198
199 threadPriority=_threadPriority;
200
201 if (threadPriority==-99999)
202 {
203
204
205 #if defined(_WIN32)
206 threadPriority=0;
207
208
209 #else
210 threadPriority=1000;
211 #endif
212 }
213
214 isStarted.Increment();
215 if (maxConnections==0)
216 maxConnections=maxIncomingConnections;
217 if (maxConnections==0)
218 maxConnections=1;
219 remoteClientsLength=maxConnections;
220 remoteClients= SLNet::OP_NEW_ARRAY<RemoteClient>(maxConnections,_FILE_AND_LINE_);
221
222
223 listenSocket=0;
224 if (maxIncomingConnections>0)
225 {
226 #if defined(WINDOWS_STORE_RT)
227 CreateListenSocket_WinStore8(port, maxIncomingConnections, socketFamily, bindAddress);
228 #else
229 CreateListenSocket(port, maxIncomingConnections, socketFamily, bindAddress);
230 #endif
231 }
232
233
234 // Start the update thread
235 int errorCode;
236
237
238
239
240
241 errorCode = SLNet::RakThread::Create(UpdateTCPInterfaceLoop, this, threadPriority);
242
243
244 if (errorCode!=0)
245 return false;
246
247 while (threadRunning.GetValue()==0)
248 RakSleep(0);
249
250 unsigned int i;
251 for (i=0; i < messageHandlerList.Size(); i++)
252 messageHandlerList[i]->OnRakPeerStartup();
253
254 return true;
255 #endif // __native_client__
256 }
257 void TCPInterface::Stop(void)
258 {
259 unsigned int i;
260 for (i=0; i < messageHandlerList.Size(); i++)
261 messageHandlerList[i]->OnRakPeerShutdown();
262
263 #ifndef __native_client__
264 if (isStarted.GetValue()==0)
265 return;
266
267 #if OPEN_SSL_CLIENT_SUPPORT==1
268 for (i=0; i < remoteClientsLength; i++)
269 remoteClients[i].DisconnectSSL();
270 #endif
271
272 isStarted.Decrement();
273
274 #if !defined(WINDOWS_STORE_RT)
275 if (listenSocket!=0)
276 #endif
277 {
278 #ifdef _WIN32
279 shutdown__(listenSocket, SD_BOTH);
280
281 #else
282 shutdown__(listenSocket, SHUT_RDWR);
283 #endif
284 closesocket__(listenSocket);
285 }
286
287 // Abort waiting connect calls
288 blockingSocketListMutex.Lock();
289 for (i=0; i < blockingSocketList.Size(); i++)
290 {
291 closesocket__(blockingSocketList[i]);
292 }
293 blockingSocketListMutex.Unlock();
294
295 // Wait for the thread to stop
296 while ( threadRunning.GetValue()>0 )
297 RakSleep(15);
298
299 RakSleep(100);
300
301 #if !defined(WINDOWS_STORE_RT)
302 listenSocket=0;
303 #endif
304
305 // Stuff from here on to the end of the function is not threadsafe
306 for (i=0; i < remoteClientsLength; i++)
307 {
308 closesocket__(remoteClients[i].socket);
309 #if OPEN_SSL_CLIENT_SUPPORT==1
310 remoteClients[i].FreeSSL();
311 #endif
312 }
313 remoteClientsLength=0;
314 SLNet::OP_DELETE_ARRAY(remoteClients,_FILE_AND_LINE_);
315 remoteClients=0;
316
317 // #low review whether we'd rather use PopInaccurate() here (i.e. check whether related threads accessing the queue terminated already)
318 // consider even adding a dtor to Packet which would then clear its data (at this point drop this explicit packet deallocation here)
319 SLNet::Packet* packet = incomingMessages.Pop();
320 while (packet != nullptr) {
321 DeallocatePacket(packet);
322 packet = incomingMessages.Pop();
323 }
324 incomingMessages.Clear(_FILE_AND_LINE_);
325 newIncomingConnections.Clear(_FILE_AND_LINE_);
326 newRemoteClients.Clear(_FILE_AND_LINE_);
327 lostConnections.Clear(_FILE_AND_LINE_);
328 requestedCloseConnections.Clear(_FILE_AND_LINE_);
329 failedConnectionAttempts.Clear(_FILE_AND_LINE_);
330 completedConnectionAttempts.Clear(_FILE_AND_LINE_);
331 failedConnectionAttempts.Clear(_FILE_AND_LINE_);
332 for (i=0; i < headPush.Size(); i++)
333 DeallocatePacket(headPush[i]);
334 headPush.Clear(_FILE_AND_LINE_);
335 for (i=0; i < tailPush.Size(); i++)
336 DeallocatePacket(tailPush[i]);
337 tailPush.Clear(_FILE_AND_LINE_);
338
339 #if OPEN_SSL_CLIENT_SUPPORT==1
340 SSL_CTX_free (ctx);
341 startSSL.Clear(_FILE_AND_LINE_);
342 activeSSLConnections.Clear(false, _FILE_AND_LINE_);
343 #endif
344
345
346
347
348
349 #endif // __native_client__
350 }
351 SystemAddress TCPInterface::Connect(const char* host, unsigned short remotePort, bool block, unsigned short socketFamily, const char *bindAddress)
352 {
353 if (threadRunning.GetValue()==0)
354 return UNASSIGNED_SYSTEM_ADDRESS;
355
356 int newRemoteClientIndex=-1;
357 for (newRemoteClientIndex=0; newRemoteClientIndex < remoteClientsLength; newRemoteClientIndex++)
358 {
359 remoteClients[newRemoteClientIndex].isActiveMutex.Lock();
360 if (remoteClients[newRemoteClientIndex].isActive==false)
361 {
362 remoteClients[newRemoteClientIndex].SetActive(true);
363 remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
364 break;
365 }
366 remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
367 }
368 if (newRemoteClientIndex==-1)
369 return UNASSIGNED_SYSTEM_ADDRESS;
370
371 if (block)
372 {
373 SystemAddress systemAddress;
374 systemAddress.FromString(host);
375 systemAddress.SetPortHostOrder(remotePort);
376 systemAddress.systemIndex=(SystemIndex) newRemoteClientIndex;
377 char buffout[128];
378 systemAddress.ToString(false,buffout, static_cast<size_t>(128));
379
380 __TCPSOCKET__ sockfd = SocketConnect(buffout, remotePort, socketFamily, bindAddress);
381 // Windows RT TODO
382 #if !defined(WINDOWS_STORE_RT)
383 if (sockfd==0)
384 #endif
385 {
386 remoteClients[newRemoteClientIndex].isActiveMutex.Lock();
387 remoteClients[newRemoteClientIndex].SetActive(false);
388 remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
389
390 failedConnectionAttemptMutex.Lock();
391 failedConnectionAttempts.Push(systemAddress, _FILE_AND_LINE_ );
392 failedConnectionAttemptMutex.Unlock();
393
394 return UNASSIGNED_SYSTEM_ADDRESS;
395 }
396
397 remoteClients[newRemoteClientIndex].socket=sockfd;
398 remoteClients[newRemoteClientIndex].systemAddress=systemAddress;
399
400 completedConnectionAttemptMutex.Lock();
401 completedConnectionAttempts.Push(remoteClients[newRemoteClientIndex].systemAddress, _FILE_AND_LINE_ );
402 completedConnectionAttemptMutex.Unlock();
403
404 return remoteClients[newRemoteClientIndex].systemAddress;
405 }
406 else
407 {
408 ThisPtrPlusSysAddr *s = SLNet::OP_NEW<ThisPtrPlusSysAddr>( _FILE_AND_LINE_ );
409 s->systemAddress.FromStringExplicitPort(host,remotePort);
410 s->systemAddress.systemIndex=(SystemIndex) newRemoteClientIndex;
411 if (bindAddress)
412 strcpy_s(s->bindAddress, bindAddress);
413 else
414 s->bindAddress[0]=0;
415 s->tcpInterface=this;
416 s->socketFamily=socketFamily;
417
418 // Start the connection thread
419 int errorCode;
420
421
422
423
424 errorCode = SLNet::RakThread::Create(ConnectionAttemptLoop, s, threadPriority);
425
426 if (errorCode!=0)
427 {
428 SLNet::OP_DELETE(s, _FILE_AND_LINE_);
429 failedConnectionAttempts.Push(s->systemAddress, _FILE_AND_LINE_ );
430 }
431 return UNASSIGNED_SYSTEM_ADDRESS;
432 }
433 }
434 #if OPEN_SSL_CLIENT_SUPPORT==1
435 void TCPInterface::StartSSLClient(SystemAddress systemAddress)
436 {
437 if (ctx==0)
438 {
439 sharedSslMutex.Lock();
440 SSLeay_add_ssl_algorithms();
441 meth = (SSL_METHOD*) SSLv23_client_method();
442 SSL_load_error_strings();
443 ctx = SSL_CTX_new (meth);
444 RakAssert(ctx!=0);
445 sharedSslMutex.Unlock();
446 }
447
448 SystemAddress *id = startSSL.Allocate( _FILE_AND_LINE_ );
449 *id=systemAddress;
450 startSSL.Push(id);
451 unsigned index = activeSSLConnections.GetIndexOf(systemAddress);
452 if (index==(unsigned)-1)
453 activeSSLConnections.Insert(systemAddress,_FILE_AND_LINE_);
454 }
455 bool TCPInterface::IsSSLActive(SystemAddress systemAddress)
456 {
457 return activeSSLConnections.GetIndexOf(systemAddress)!=-1;
458 }
459 #endif
460 void TCPInterface::Send( const char *data, unsigned length, const SystemAddress &systemAddress, bool broadcast )
461 {
462 SendList( &data, &length, 1, systemAddress,broadcast );
463 }
464 bool TCPInterface::SendList( const char **data, const unsigned int *lengths, const int numParameters, const SystemAddress &systemAddress, bool broadcast )
465 {
466 if (isStarted.GetValue()==0)
467 return false;
468 if (data==0)
469 return false;
470 if (systemAddress==UNASSIGNED_SYSTEM_ADDRESS && broadcast==false)
471 return false;
472 unsigned int totalLength=0;
473 int i;
474 for (i=0; i < numParameters; i++)
475 {
476 if (lengths[i]>0)
477 totalLength+=lengths[i];
478 }
479 if (totalLength==0)
480 return false;
481
482 if (broadcast)
483 {
484 // Send to all, possible exception system
485 for (i=0; i < remoteClientsLength; i++)
486 {
487 if (remoteClients[i].systemAddress!=systemAddress)
488 {
489 remoteClients[i].SendOrBuffer(data, lengths, numParameters);
490 }
491 }
492 }
493 else
494 {
495 // Send to this player
496 if (systemAddress.systemIndex<remoteClientsLength &&
497 remoteClients[systemAddress.systemIndex].systemAddress==systemAddress)
498 {
499 remoteClients[systemAddress.systemIndex].SendOrBuffer(data, lengths, numParameters);
500 }
501 else
502 {
503 for (i=0; i < remoteClientsLength; i++)
504 {
505 if (remoteClients[i].systemAddress==systemAddress )
506 {
507 remoteClients[i].SendOrBuffer(data, lengths, numParameters);
508 }
509 }
510 }
511 }
512
513
514 return true;
515 }
516 bool TCPInterface::ReceiveHasPackets( void )
517 {
518 return headPush.IsEmpty()==false || incomingMessages.IsEmpty()==false || tailPush.IsEmpty()==false;
519 }
520 Packet* TCPInterface::Receive( void )
521 {
522 unsigned int i;
523 for (i=0; i < messageHandlerList.Size(); i++)
524 messageHandlerList[i]->Update();
525
526 Packet* outgoingPacket = ReceiveInt();
527
528 if (outgoingPacket)
529 {
530 PluginReceiveResult pluginResult;
531 for (i=0; i < messageHandlerList.Size(); i++)
532 {
533 pluginResult=messageHandlerList[i]->OnReceive(outgoingPacket);
534 if (pluginResult==RR_STOP_PROCESSING_AND_DEALLOCATE)
535 {
536 DeallocatePacket( outgoingPacket );
537 outgoingPacket=0; // Will do the loop again and get another packet
538 break; // break out of the enclosing for
539 }
540 else if (pluginResult==RR_STOP_PROCESSING)
541 {
542 outgoingPacket=0;
543 break;
544 }
545 }
546 }
547
548
549 return outgoingPacket;
550 }
551 Packet* TCPInterface::ReceiveInt( void )
552 {
553 if (isStarted.GetValue()==0)
554 return 0;
555 if (headPush.IsEmpty()==false)
556 return headPush.Pop();
557 Packet *p = incomingMessages.PopInaccurate();
558 if (p)
559 return p;
560 if (tailPush.IsEmpty()==false)
561 return tailPush.Pop();
562 return 0;
563 }
564
565
566 void TCPInterface::AttachPlugin( PluginInterface2 *plugin )
567 {
568 if (messageHandlerList.GetIndexOf(plugin)==MAX_UNSIGNED_LONG)
569 {
570 messageHandlerList.Insert(plugin, _FILE_AND_LINE_);
571 plugin->SetTCPInterface(this);
572 plugin->OnAttach();
573 }
574 }
575 void TCPInterface::DetachPlugin( PluginInterface2 *plugin )
576 {
577 if (plugin==0)
578 return;
579
580 unsigned int index;
581 index = messageHandlerList.GetIndexOf(plugin);
582 if (index!=MAX_UNSIGNED_LONG)
583 {
584 messageHandlerList[index]->OnDetach();
585 // Unordered list so delete from end for speed
586 messageHandlerList[index]=messageHandlerList[messageHandlerList.Size()-1];
587 messageHandlerList.RemoveFromEnd();
588 plugin->SetTCPInterface(0);
589 }
590 }
591 void TCPInterface::CloseConnection( SystemAddress systemAddress )
592 {
593 if (isStarted.GetValue()==0)
594 return;
595 if (systemAddress==UNASSIGNED_SYSTEM_ADDRESS)
596 return;
597
598 unsigned int i;
599 for (i=0; i < messageHandlerList.Size(); i++)
600 messageHandlerList[i]->OnClosedConnection(systemAddress, UNASSIGNED_RAKNET_GUID, LCR_CLOSED_BY_USER);
601
602 if (systemAddress.systemIndex<remoteClientsLength && remoteClients[systemAddress.systemIndex].systemAddress==systemAddress)
603 {
604 remoteClients[systemAddress.systemIndex].isActiveMutex.Lock();
605 remoteClients[systemAddress.systemIndex].SetActive(false);
606 remoteClients[systemAddress.systemIndex].isActiveMutex.Unlock();
607 }
608 else
609 {
610 for (i=0; i < remoteClientsLength; i++)
611 {
612 remoteClients[i].isActiveMutex.Lock();
613 if (remoteClients[i].isActive && remoteClients[i].systemAddress==systemAddress)
614 {
615 remoteClients[systemAddress.systemIndex].SetActive(false);
616 remoteClients[i].isActiveMutex.Unlock();
617 break;
618 }
619 remoteClients[i].isActiveMutex.Unlock();
620 }
621 }
622
623
624 #if OPEN_SSL_CLIENT_SUPPORT==1
625 unsigned index = activeSSLConnections.GetIndexOf(systemAddress);
626 if (index!=(unsigned)-1)
627 activeSSLConnections.RemoveAtIndex(index);
628 #endif
629 }
630 void TCPInterface::DeallocatePacket( Packet *packet )
631 {
632 if (packet==0)
633 return;
634 if (packet->deleteData)
635 {
636 rakFree_Ex(packet->data, _FILE_AND_LINE_ );
637 incomingMessages.Deallocate(packet, _FILE_AND_LINE_);
638 }
639 else
640 {
641 // Came from userspace AllocatePacket
642 rakFree_Ex(packet->data, _FILE_AND_LINE_ );
643 SLNet::OP_DELETE(packet, _FILE_AND_LINE_);
644 }
645 }
646 Packet* TCPInterface::AllocatePacket(unsigned dataSize)
647 {
648 Packet*p = SLNet::OP_NEW<Packet>(_FILE_AND_LINE_);
649 p->data=(unsigned char*) rakMalloc_Ex(dataSize,_FILE_AND_LINE_);
650 p->length=dataSize;
651 p->bitSize=BYTES_TO_BITS(dataSize);
652 p->deleteData=false;
653 p->guid=UNASSIGNED_RAKNET_GUID;
654 p->systemAddress=UNASSIGNED_SYSTEM_ADDRESS;
655 p->systemAddress.systemIndex=(SystemIndex)-1;
656 return p;
657 }
658 void TCPInterface::PushBackPacket( Packet *packet, bool pushAtHead )
659 {
660 if (pushAtHead)
661 headPush.Push(packet, _FILE_AND_LINE_ );
662 else
663 tailPush.Push(packet, _FILE_AND_LINE_ );
664 }
665 bool TCPInterface::WasStarted(void) const
666 {
667 return threadRunning.GetValue()>0;
668 }
669 SystemAddress TCPInterface::HasCompletedConnectionAttempt(void)
670 {
671 SystemAddress sysAddr=UNASSIGNED_SYSTEM_ADDRESS;
672 completedConnectionAttemptMutex.Lock();
673 if (completedConnectionAttempts.IsEmpty()==false)
674 sysAddr=completedConnectionAttempts.Pop();
675 completedConnectionAttemptMutex.Unlock();
676
677 if (sysAddr!=UNASSIGNED_SYSTEM_ADDRESS)
678 {
679 unsigned int i;
680 for (i=0; i < messageHandlerList.Size(); i++)
681 messageHandlerList[i]->OnNewConnection(sysAddr, UNASSIGNED_RAKNET_GUID, true);
682 }
683
684 return sysAddr;
685 }
686 SystemAddress TCPInterface::HasFailedConnectionAttempt(void)
687 {
688 SystemAddress sysAddr=UNASSIGNED_SYSTEM_ADDRESS;
689 failedConnectionAttemptMutex.Lock();
690 if (failedConnectionAttempts.IsEmpty()==false)
691 sysAddr=failedConnectionAttempts.Pop();
692 failedConnectionAttemptMutex.Unlock();
693
694 if (sysAddr!=UNASSIGNED_SYSTEM_ADDRESS)
695 {
696 unsigned int i;
697 for (i=0; i < messageHandlerList.Size(); i++)
698 {
699 Packet p;
700 p.systemAddress=sysAddr;
701 p.data=0;
702 p.length=0;
703 p.bitSize=0;
704 messageHandlerList[i]->OnFailedConnectionAttempt(&p, FCAR_CONNECTION_ATTEMPT_FAILED);
705 }
706 }
707
708 return sysAddr;
709 }
710 SystemAddress TCPInterface::HasNewIncomingConnection(void)
711 {
712 SystemAddress *out, out2;
713 out = newIncomingConnections.PopInaccurate();
714 if (out)
715 {
716 out2=*out;
717 newIncomingConnections.Deallocate(out, _FILE_AND_LINE_);
718
719 unsigned int i;
720 for (i=0; i < messageHandlerList.Size(); i++)
721 messageHandlerList[i]->OnNewConnection(out2, UNASSIGNED_RAKNET_GUID, true);
722
723 return *out;
724 }
725 else
726 {
727 return UNASSIGNED_SYSTEM_ADDRESS;
728 }
729 }
730 SystemAddress TCPInterface::HasLostConnection(void)
731 {
732 SystemAddress *out, out2;
733 out = lostConnections.PopInaccurate();
734 if (out)
735 {
736 out2=*out;
737 lostConnections.Deallocate(out, _FILE_AND_LINE_);
738
739 unsigned int i;
740 for (i=0; i < messageHandlerList.Size(); i++)
741 messageHandlerList[i]->OnClosedConnection(out2, UNASSIGNED_RAKNET_GUID, LCR_DISCONNECTION_NOTIFICATION);
742
743 return *out;
744 }
745 else
746 {
747 return UNASSIGNED_SYSTEM_ADDRESS;
748 }
749 }
750 void TCPInterface::GetConnectionList( SystemAddress *remoteSystems, unsigned short *numberOfSystems ) const
751 {
752 unsigned short systemCount=0;
753 unsigned short maxToWrite=*numberOfSystems;
754 for (int i=0; i < remoteClientsLength; i++)
755 {
756 if (remoteClients[i].isActive)
757 {
758 if (systemCount < maxToWrite)
759 remoteSystems[systemCount]=remoteClients[i].systemAddress;
760 systemCount++;
761 }
762 }
763 *numberOfSystems=systemCount;
764 }
765 unsigned short TCPInterface::GetConnectionCount(void) const
766 {
767 unsigned short systemCount=0;
768 for (int i=0; i < remoteClientsLength; i++)
769 {
770 if (remoteClients[i].isActive)
771 systemCount++;
772 }
773 return systemCount;
774 }
775
776 unsigned int TCPInterface::GetOutgoingDataBufferSize(SystemAddress systemAddress) const
777 {
778 unsigned bytesWritten=0;
779 if (systemAddress.systemIndex<remoteClientsLength &&
780 remoteClients[systemAddress.systemIndex].isActive &&
781 remoteClients[systemAddress.systemIndex].systemAddress==systemAddress)
782 {
783 remoteClients[systemAddress.systemIndex].outgoingDataMutex.Lock();
784 bytesWritten=remoteClients[systemAddress.systemIndex].outgoingData.GetBytesWritten();
785 remoteClients[systemAddress.systemIndex].outgoingDataMutex.Unlock();
786 return bytesWritten;
787 }
788
789 for (int i=0; i < remoteClientsLength; i++)
790 {
791 if (remoteClients[i].isActive && remoteClients[i].systemAddress==systemAddress)
792 {
793 remoteClients[i].outgoingDataMutex.Lock();
794 bytesWritten+=remoteClients[i].outgoingData.GetBytesWritten();
795 remoteClients[i].outgoingDataMutex.Unlock();
796 }
797 }
798 return bytesWritten;
799 }
800 __TCPSOCKET__ TCPInterface::SocketConnect(const char* host, unsigned short remotePort, unsigned short socketFamily, const char *bindAddress)
801 {
802 #ifdef __native_client__
803 return 0;
804 #else
805 int connectResult;
806 (void) connectResult;
807 (void) socketFamily;
808
809 #if RAKNET_SUPPORT_IPV6!=1
810 sockaddr_in serverAddress;
811
812 struct addrinfo *curAddress = NULL;
813 int err = getaddrinfo(host, NULL, NULL, &curAddress);
814
815 // #med This should also work with IPv6 addresses in principle. However the old code in RakNet only worked with IPv4. Hence this behavior change won't be in MaxNet 0.1.
816 // get the (first) IPv4 address
817 while(curAddress != NULL) {
818 if (curAddress->ai_family == AF_INET) {
819 break; // found an IPv4 address
820 }
821 curAddress = curAddress->ai_next;
822 }
823
824 if (curAddress == NULL)
825 return 0;
826
827 if (err != 0)
828 return 0;
829
830
831 #if defined(WINDOWS_STORE_RT)
832 __TCPSOCKET__ sockfd = WinRTCreateStreamSocket(AF_INET, SOCK_STREAM, 0);
833 #else
834 __TCPSOCKET__ sockfd = socket__(AF_INET, SOCK_STREAM, 0);
835 if (sockfd < 0)
836 return 0;
837 #endif
838
839 memset(&serverAddress, 0, sizeof(serverAddress));
840 serverAddress.sin_family = AF_INET;
841 serverAddress.sin_port = htons( remotePort );
842
843
844 if ( bindAddress && bindAddress[0] )
845 {
846
847
848
849
850
851 inet_pton(AF_INET, bindAddress, &serverAddress.sin_addr.s_addr);
852
853 }
854 else
855 serverAddress.sin_addr.s_addr = INADDR_ANY;
856
857 int sock_opt=1024*256;
858 setsockopt__(sockfd, SOL_SOCKET, SO_RCVBUF, ( char * ) & sock_opt, sizeof ( sock_opt ) );
859
860 serverAddress.sin_addr = ((struct sockaddr_in *)curAddress->ai_addr)->sin_addr;
861
862
863
864
865
866
867
868
869
870
871 blockingSocketListMutex.Lock();
872 blockingSocketList.Insert(sockfd, _FILE_AND_LINE_);
873 blockingSocketListMutex.Unlock();
874
875 // This is blocking
876 connectResult = connect__( sockfd, ( struct sockaddr * ) &serverAddress, sizeof( struct sockaddr ) );
877
878 #else
879
880 (void)bindAddress;
881 struct addrinfo hints, *res;
882 __TCPSOCKET__ sockfd;
883 memset(&hints, 0, sizeof hints);
884 hints.ai_family = socketFamily;
885 hints.ai_socktype = SOCK_STREAM;
886 char portStr[32];
887 Itoa(remotePort,portStr,10);
888 getaddrinfo(host, portStr, &hints, &res);
889 sockfd = socket__(res->ai_family, res->ai_socktype, res->ai_protocol);
890 blockingSocketListMutex.Lock();
891 blockingSocketList.Insert(sockfd, _FILE_AND_LINE_);
892 blockingSocketListMutex.Unlock();
893 // #low - review usage of static cast here
894 connectResult=connect__(sockfd, res->ai_addr, static_cast<int>(res->ai_addrlen));
895 freeaddrinfo(res); // free the linked-list
896
897 #endif // #if RAKNET_SUPPORT_IPV6!=1
898
899 if (connectResult==-1)
900 {
901 unsigned sockfdIndex;
902 blockingSocketListMutex.Lock();
903 sockfdIndex=blockingSocketList.GetIndexOf(sockfd);
904 if (sockfdIndex!=(unsigned)-1)
905 blockingSocketList.RemoveAtIndexFast(sockfdIndex);
906 blockingSocketListMutex.Unlock();
907
908 closesocket__(sockfd);
909 return 0;
910 }
911
912 return sockfd;
913 #endif // __native_client__
914 }
915
916 RAK_THREAD_DECLARATION(SLNet::ConnectionAttemptLoop)
917 {
918
919
920
921 TCPInterface::ThisPtrPlusSysAddr *s = (TCPInterface::ThisPtrPlusSysAddr *) arguments;
922
923
924
925 SystemAddress systemAddress = s->systemAddress;
926 TCPInterface *tcpInterface = s->tcpInterface;
927 int newRemoteClientIndex=systemAddress.systemIndex;
928 unsigned short socketFamily = s->socketFamily;
929 SLNet::OP_DELETE(s, _FILE_AND_LINE_);
930
931 char str1[64];
932 systemAddress.ToString(false, str1, static_cast<size_t>(64));
933 __TCPSOCKET__ sockfd = tcpInterface->SocketConnect(str1, systemAddress.GetPort(), socketFamily, s->bindAddress);
934 if (sockfd==0)
935 {
936 tcpInterface->remoteClients[newRemoteClientIndex].isActiveMutex.Lock();
937 tcpInterface->remoteClients[newRemoteClientIndex].SetActive(false);
938 tcpInterface->remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
939
940 tcpInterface->failedConnectionAttemptMutex.Lock();
941 tcpInterface->failedConnectionAttempts.Push(systemAddress, _FILE_AND_LINE_ );
942 tcpInterface->failedConnectionAttemptMutex.Unlock();
943 return 0;
944 }
945
946 tcpInterface->remoteClients[newRemoteClientIndex].socket=sockfd;
947 tcpInterface->remoteClients[newRemoteClientIndex].systemAddress=systemAddress;
948
949 // Notify user that the connection attempt has completed.
950 if (tcpInterface->threadRunning.GetValue()>0)
951 {
952 tcpInterface->completedConnectionAttemptMutex.Lock();
953 tcpInterface->completedConnectionAttempts.Push(systemAddress, _FILE_AND_LINE_ );
954 tcpInterface->completedConnectionAttemptMutex.Unlock();
955 }
956
957
958
959
960 return 0;
961
962 }
963
964 RAK_THREAD_DECLARATION(SLNet::UpdateTCPInterfaceLoop)
965 {
966
967
968
969 TCPInterface * sts = ( TCPInterface * ) arguments;
970
971
972 // const int BUFF_SIZE=8096;
973 const unsigned int BUFF_SIZE=1048576;
974 //char data[ BUFF_SIZE ];
975 char * data = (char*) rakMalloc_Ex(BUFF_SIZE,_FILE_AND_LINE_);
976 Packet *incomingMessage;
977 fd_set readFD, exceptionFD, writeFD;
978 sts->threadRunning.Increment();
979
980 #if RAKNET_SUPPORT_IPV6!=1
981 sockaddr_in sockAddr;
982 int sockAddrSize = sizeof(sockAddr);
983 #else
984 struct sockaddr_storage sockAddr;
985 socklen_t sockAddrSize = sizeof(sockAddr);
986 #endif
987
988 int len;
989 __TCPSOCKET__ newSock;
990 int selectResult;
991
992
993 timeval tv;
994 tv.tv_sec=0;
995 tv.tv_usec=30000;
996
997
998 while (sts->isStarted.GetValue()>0)
999 {
1000 #if OPEN_SSL_CLIENT_SUPPORT==1
1001 SystemAddress *sslSystemAddress;
1002 sslSystemAddress = sts->startSSL.PopInaccurate();
1003 if (sslSystemAddress)
1004 {
1005 if (sslSystemAddress->systemIndex>=0 &&
1006 sslSystemAddress->systemIndex<sts->remoteClientsLength &&
1007 sts->remoteClients[sslSystemAddress->systemIndex].systemAddress==*sslSystemAddress)
1008 {
1009 sts->remoteClients[sslSystemAddress->systemIndex].InitSSL(sts->ctx,sts->meth);
1010 }
1011 else
1012 {
1013 for (int i=0; i < sts->remoteClientsLength; i++)
1014 {
1015 sts->remoteClients[i].isActiveMutex.Lock();
1016 if (sts->remoteClients[i].isActive && sts->remoteClients[i].systemAddress==*sslSystemAddress)
1017 {
1018 if (sts->remoteClients[i].ssl==0)
1019 sts->remoteClients[i].InitSSL(sts->ctx,sts->meth);
1020 }
1021 sts->remoteClients[i].isActiveMutex.Unlock();
1022 }
1023 }
1024 sts->startSSL.Deallocate(sslSystemAddress,_FILE_AND_LINE_);
1025 }
1026 #endif
1027
1028
1029 __TCPSOCKET__ largestDescriptor=0; // see select__()'s first parameter's documentation under linux
1030
1031
1032 // Linux' select__() implementation changes the timeout
1033
1034 tv.tv_sec=0;
1035 tv.tv_usec=30000;
1036
1037
1038 #ifdef _MSC_VER
1039 #pragma warning( disable : 4127 ) // warning C4127: conditional expression is constant
1040 #endif
1041 for(;;)
1042 {
1043 // Reset readFD, writeFD, and exceptionFD since select seems to clear it
1044 FD_ZERO(&readFD);
1045 FD_ZERO(&exceptionFD);
1046 FD_ZERO(&writeFD);
1047 largestDescriptor=0;
1048 if (sts->listenSocket!=0)
1049 {
1050 FD_SET(sts->listenSocket, &readFD);
1051 FD_SET(sts->listenSocket, &exceptionFD);
1052 largestDescriptor = sts->listenSocket; // @see largestDescriptor def
1053 }
1054
1055 unsigned i;
1056 for (i=0; i < sts->remoteClientsLength; i++)
1057 {
1058 sts->remoteClients[i].isActiveMutex.Lock();
1059 if (sts->remoteClients[i].isActive)
1060 {
1061 // calling FD_ISSET with -1 as socket (that’s what 0 is set to) produces a bus error under Linux 64-Bit
1062 __TCPSOCKET__ socketCopy = sts->remoteClients[i].socket;
1063 if (socketCopy != 0)
1064 {
1065 FD_SET(socketCopy, &readFD);
1066 FD_SET(socketCopy, &exceptionFD);
1067 if (sts->remoteClients[i].outgoingData.GetBytesWritten()>0)
1068 FD_SET(socketCopy, &writeFD);
1069 if(socketCopy > largestDescriptor) // @see largestDescriptorDef
1070 largestDescriptor = socketCopy;
1071 }
1072 }
1073 sts->remoteClients[i].isActiveMutex.Unlock();
1074 }
1075
1076 #ifdef _MSC_VER
1077 #pragma warning( disable : 4244 ) // warning C4127: conditional expression is constant
1078 #endif
1079
1080
1081 selectResult=(int) select__(largestDescriptor+1, &readFD, &writeFD, &exceptionFD, &tv);
1082
1083
1084
1085
1086 if (selectResult<=0)
1087 break;
1088
1089 if (sts->listenSocket!=0 && FD_ISSET(sts->listenSocket, &readFD))
1090 {
1091 newSock = accept__(sts->listenSocket, (sockaddr*)&sockAddr, (socklen_t*)&sockAddrSize);
1092
1093 if (newSock != 0)
1094 {
1095 int newRemoteClientIndex=-1;
1096 for (newRemoteClientIndex=0; newRemoteClientIndex < sts->remoteClientsLength; newRemoteClientIndex++)
1097 {
1098 sts->remoteClients[newRemoteClientIndex].isActiveMutex.Lock();
1099 if (sts->remoteClients[newRemoteClientIndex].isActive==false)
1100 {
1101 sts->remoteClients[newRemoteClientIndex].socket=newSock;
1102
1103 #if RAKNET_SUPPORT_IPV6!=1
1104 sts->remoteClients[newRemoteClientIndex].systemAddress.address.addr4.sin_addr.s_addr=sockAddr.sin_addr.s_addr;
1105 sts->remoteClients[newRemoteClientIndex].systemAddress.SetPortNetworkOrder( sockAddr.sin_port);
1106 sts->remoteClients[newRemoteClientIndex].systemAddress.systemIndex=newRemoteClientIndex;
1107 #else
1108 if (sockAddr.ss_family==AF_INET)
1109 {
1110 memcpy(&sts->remoteClients[newRemoteClientIndex].systemAddress.address.addr4,(sockaddr_in *)&sockAddr,sizeof(sockaddr_in));
1111 // sts->remoteClients[newRemoteClientIndex].systemAddress.address.addr4.sin_port=ntohs( sts->remoteClients[newRemoteClientIndex].systemAddress.address.addr4.sin_port );
1112 }
1113 else
1114 {
1115 memcpy(&sts->remoteClients[newRemoteClientIndex].systemAddress.address.addr6,(sockaddr_in6 *)&sockAddr,sizeof(sockaddr_in6));
1116 // sts->remoteClients[newRemoteClientIndex].systemAddress.address.addr6.sin6_port=ntohs( sts->remoteClients[newRemoteClientIndex].systemAddress.address.addr6.sin6_port );
1117 }
1118
1119 #endif // #if RAKNET_SUPPORT_IPV6!=1
1120 sts->remoteClients[newRemoteClientIndex].SetActive(true);
1121 sts->remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
1122
1123
1124 SystemAddress *newConnectionSystemAddress=sts->newIncomingConnections.Allocate( _FILE_AND_LINE_ );
1125 *newConnectionSystemAddress=sts->remoteClients[newRemoteClientIndex].systemAddress;
1126 sts->newIncomingConnections.Push(newConnectionSystemAddress);
1127
1128 break;
1129 }
1130 sts->remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
1131 }
1132 if (newRemoteClientIndex==-1)
1133 {
1134 closesocket__(sts->listenSocket);
1135 }
1136 }
1137 else
1138 {
1139 #ifdef _DO_PRINTF
1140 RAKNET_DEBUG_PRINTF("Error: connection failed\n");
1141 #endif
1142 }
1143 }
1144 else if (sts->listenSocket!=0 && FD_ISSET(sts->listenSocket, &exceptionFD))
1145 {
1146 #ifdef _DO_PRINTF
1147 int err;
1148 int errlen = sizeof(err);
1149 getsockopt__(sts->listenSocket, SOL_SOCKET, SO_ERROR,(char*)&err, &errlen);
1150 RAKNET_DEBUG_PRINTF("Socket error %s on listening socket\n", err);
1151 #endif
1152 }
1153
1154 {
1155 i=0;
1156 while (i < sts->remoteClientsLength)
1157 {
1158 if (sts->remoteClients[i].isActive==false)
1159 {
1160 i++;
1161 continue;
1162 }
1163 // calling FD_ISSET with -1 as socket (that’s what 0 is set to) produces a bus error under Linux 64-Bit
1164 __TCPSOCKET__ socketCopy = sts->remoteClients[i].socket;
1165 if (socketCopy == 0)
1166 {
1167 i++;
1168 continue;
1169 }
1170
1171 if (FD_ISSET(socketCopy, &exceptionFD))
1172 {
1173 // #ifdef _DO_PRINTF
1174 // if (sts->listenSocket!=-1)
1175 // {
1176 // int err;
1177 // int errlen = sizeof(err);
1178 // getsockopt__(sts->listenSocket, SOL_SOCKET, SO_ERROR,(char*)&err, &errlen);
1179 // in_addr in;
1180 // in.s_addr = sts->remoteClients[i].systemAddress.binaryAddress;
1181 // char ip[65];
1182 // inet_ntop(sts->remoteClients[i].systemAddress.address.addr4.sin_family, &in, ip, 65);
1183 // RAKNET_DEBUG_PRINTF("Socket error %i on %s:%i\n", err,ip, sts->remoteClients[i].systemAddress.GetPort() );
1184 // }
1185 //
1186 // #endif
1187 // Connection lost abruptly
1188 SystemAddress *lostConnectionSystemAddress=sts->lostConnections.Allocate( _FILE_AND_LINE_ );
1189 *lostConnectionSystemAddress=sts->remoteClients[i].systemAddress;
1190 sts->lostConnections.Push(lostConnectionSystemAddress);
1191 sts->remoteClients[i].isActiveMutex.Lock();
1192 sts->remoteClients[i].SetActive(false);
1193 sts->remoteClients[i].isActiveMutex.Unlock();
1194 }
1195 else
1196 {
1197 if (FD_ISSET(socketCopy, &readFD))
1198 {
1199 // if recv returns 0 this was a graceful close
1200 len = sts->remoteClients[i].Recv(data,BUFF_SIZE);
1201
1202
1203 // removeme
1204 // data[len]=0;
1205 // printf(data);
1206
1207 if (len>0)
1208 {
1209 incomingMessage=sts->incomingMessages.Allocate( _FILE_AND_LINE_ );
1210 incomingMessage->data = (unsigned char*) rakMalloc_Ex( len+1, _FILE_AND_LINE_ );
1211 memcpy(incomingMessage->data, data, len);
1212 incomingMessage->data[len]=0; // Null terminate this so we can print it out as regular strings. This is different from RakNet which does not do this.
1213 // printf("RECV: %s\n",incomingMessage->data);
1214 /*
1215 if (1)
1216 {
1217 static FILE *fp=0;
1218 if (fp==0)
1219 {
1220 fopen_s(&fp, "tcpRcv.txt", "wb");
1221 }
1222 fwrite(data,1,len,fp);
1223 }
1224 */
1225 incomingMessage->length=len;
1226 incomingMessage->deleteData=true; // actually means came from SPSC, rather than AllocatePacket
1227 incomingMessage->systemAddress=sts->remoteClients[i].systemAddress;
1228 sts->incomingMessages.Push(incomingMessage);
1229 }
1230 else
1231 {
1232 // Connection lost gracefully
1233 SystemAddress *lostConnectionSystemAddress=sts->lostConnections.Allocate( _FILE_AND_LINE_ );
1234 *lostConnectionSystemAddress=sts->remoteClients[i].systemAddress;
1235 sts->lostConnections.Push(lostConnectionSystemAddress);
1236 sts->remoteClients[i].isActiveMutex.Lock();
1237 sts->remoteClients[i].SetActive(false);
1238 sts->remoteClients[i].isActiveMutex.Unlock();
1239 continue;
1240 }
1241 }
1242 if (FD_ISSET(socketCopy, &writeFD))
1243 {
1244 RemoteClient *rc = &sts->remoteClients[i];
1245 unsigned int bytesInBuffer;
1246 int bytesAvailable;
1247 int bytesSent;
1248 rc->outgoingDataMutex.Lock();
1249 bytesInBuffer=rc->outgoingData.GetBytesWritten();
1250 if (bytesInBuffer>0)
1251 {
1252 unsigned int contiguousLength;
1253 char* contiguousBytesPointer = rc->outgoingData.PeekContiguousBytes(&contiguousLength);
1254 if (contiguousLength < (unsigned int) BUFF_SIZE && contiguousLength<bytesInBuffer)
1255 {
1256 if (bytesInBuffer > BUFF_SIZE)
1257 bytesAvailable=BUFF_SIZE;
1258 else
1259 bytesAvailable=bytesInBuffer;
1260 rc->outgoingData.ReadBytes(data,bytesAvailable,true);
1261 bytesSent=rc->Send(data,bytesAvailable);
1262 }
1263 else
1264 {
1265 bytesSent=rc->Send(contiguousBytesPointer,contiguousLength);
1266 }
1267
1268 if (bytesSent>0)
1269 rc->outgoingData.IncrementReadOffset(bytesSent);
1270 bytesInBuffer=rc->outgoingData.GetBytesWritten();
1271 }
1272 rc->outgoingDataMutex.Unlock();
1273 }
1274
1275 i++; // Nothing deleted so increment the index
1276 }
1277 }
1278 }
1279 }
1280
1281 // Sleep 0 on Linux monopolizes the CPU
1282 RakSleep(30);
1283 }
1284 sts->threadRunning.Decrement();
1285
1286 rakFree_Ex(data,_FILE_AND_LINE_);
1287
1288
1289
1290
1291 return 0;
1292
1293 }
1294
1295 void RemoteClient::SetActive(bool a)
1296 {
1297 if (isActive != a)
1298 {
1299 isActive=a;
1300 Reset();
1301 if (isActive==false && socket!=0)
1302 {
1303 closesocket__(socket);
1304 socket=0;
1305 }
1306 }
1307 }
1308 void RemoteClient::SendOrBuffer(const char **data, const unsigned int *lengths, const int numParameters)
1309 {
1310 // True can save memory and buffer copies, but gives worse performance overall
1311 // Do not use true for the XBOX, as it just locks up
1312 const bool ALLOW_SEND_FROM_USER_THREAD=false;
1313
1314 int parameterIndex;
1315 if (isActive==false)
1316 return;
1317 parameterIndex=0;
1318 for (; parameterIndex < numParameters; parameterIndex++)
1319 {
1320 outgoingDataMutex.Lock();
1321 if (ALLOW_SEND_FROM_USER_THREAD && outgoingData.GetBytesWritten()==0)
1322 {
1323 outgoingDataMutex.Unlock();
1324 int bytesSent = Send(data[parameterIndex],lengths[parameterIndex]);
1325 if (bytesSent<(int) lengths[parameterIndex])
1326 {
1327 // Push remainder
1328 outgoingDataMutex.Lock();
1329 outgoingData.WriteBytes(data[parameterIndex]+bytesSent,lengths[parameterIndex]-bytesSent,_FILE_AND_LINE_);
1330 outgoingDataMutex.Unlock();
1331 }
1332 }
1333 else
1334 {
1335 outgoingData.WriteBytes(data[parameterIndex],lengths[parameterIndex],_FILE_AND_LINE_);
1336 outgoingDataMutex.Unlock();
1337 }
1338 }
1339 }
1340 #if OPEN_SSL_CLIENT_SUPPORT==1
1341 bool RemoteClient::InitSSL(SSL_CTX* ctx, SSL_METHOD *meth)
1342 {
1343 (void) meth;
1344
1345 ssl = SSL_new (ctx);
1346 RakAssert(ssl);
1347 int res;
1348 res = SSL_set_fd (ssl, socket);
1349 if (res!=1)
1350 {
1351 printf("SSL_set_fd error: %s\n", ERR_reason_error_string(ERR_get_error()));
1352 SSL_free(ssl);
1353 ssl=0;
1354 return false;
1355 }
1356 RakAssert(res==1);
1357 res = SSL_connect (ssl);
1358 if (res<0)
1359 {
1360 unsigned long err = ERR_get_error();
1361 printf("SSL_connect error: %s\n", ERR_reason_error_string(err));
1362 SSL_free(ssl);
1363 ssl=0;
1364 return false;
1365 }
1366 else if (res==0)
1367 {
1368 // The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason.
1369 int err = SSL_get_error(ssl, res);
1370 switch (err)
1371 {
1372 case SSL_ERROR_NONE:
1373 printf("SSL_ERROR_NONE\n");
1374 break;
1375 case SSL_ERROR_ZERO_RETURN:
1376 printf("SSL_ERROR_ZERO_RETURN\n");
1377 break;
1378 case SSL_ERROR_WANT_READ:
1379 printf("SSL_ERROR_WANT_READ\n");
1380 break;
1381 case SSL_ERROR_WANT_WRITE:
1382 printf("SSL_ERROR_WANT_WRITE\n");
1383 break;
1384 case SSL_ERROR_WANT_CONNECT:
1385 printf("SSL_ERROR_WANT_CONNECT\n");
1386 break;
1387 case SSL_ERROR_WANT_ACCEPT:
1388 printf("SSL_ERROR_WANT_ACCEPT\n");
1389 break;
1390 case SSL_ERROR_WANT_X509_LOOKUP:
1391 printf("SSL_ERROR_WANT_X509_LOOKUP\n");
1392 break;
1393 case SSL_ERROR_SYSCALL:
1394 {
1395 // http://www.openssl.org/docs/ssl/SSL_get_error.html
1396 char buff[1024];
1397 unsigned long ege = ERR_get_error();
1398 if (ege==0 && res==0)
1399 printf("SSL_ERROR_SYSCALL EOF in violation of the protocol\n");
1400 else if (ege==0 && res==-1) {
1401 strerror_s(buff, errno);
1402 printf("SSL_ERROR_SYSCALL %s\n", buff);
1403 }
1404 else
1405 printf("SSL_ERROR_SYSCALL %s\n", ERR_error_string(ege, buff));
1406 }
1407 break;
1408 case SSL_ERROR_SSL:
1409 printf("SSL_ERROR_SSL\n");
1410 break;
1411 }
1412
1413 }
1414
1415 if (res!=1)
1416 {
1417 SSL_free(ssl);
1418 ssl=0;
1419 return false;
1420 }
1421 return true;
1422 }
1423 void RemoteClient::DisconnectSSL(void)
1424 {
1425 if (ssl)
1426 SSL_shutdown (ssl); /* send SSL/TLS close_notify */
1427 }
1428 void RemoteClient::FreeSSL(void)
1429 {
1430 if (ssl)
1431 SSL_free (ssl);
1432 }
1433 int RemoteClient::Send(const char *data, unsigned int length)
1434 {
1435 if (ssl)
1436 return SSL_write (ssl, data, length);
1437 else
1438 return send__(socket, data, length, 0);
1439 }
1440 int RemoteClient::Recv(char *data, const int dataSize)
1441 {
1442 if (ssl)
1443 return SSL_read (ssl, data, dataSize);
1444 else
1445 return recv__(socket, data, dataSize, 0);
1446 }
1447 #else
1448 int RemoteClient::Send(const char *data, unsigned int length)
1449 {
1450 #ifdef __native_client__
1451 return -1;
1452 #else
1453 return send__(socket, data, length, 0);
1454 #endif
1455 }
1456 int RemoteClient::Recv(char *data, const int dataSize)
1457 {
1458 #ifdef __native_client__
1459 return -1;
1460 #else
1461 return recv__(socket, data, dataSize, 0);
1462 #endif
1463 }
1464 #endif
1465
1466 #ifdef _MSC_VER
1467 #pragma warning( pop )
1468 #endif
1469
1470 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Berkley.cpp Source File

  • src
RakNetSocket2_Berkley.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_BERKLEY_CPP
21 #define RAKNETSOCKET2_BERKLEY_CPP
22
23 // Every platform except windows store 8 and native client supports Berkley sockets
24 #if !defined(WINDOWS_STORE_RT) && !defined(__native_client__)
25
26 #ifdef _WIN32
27 #include <tchar.h> // used for _tprintf() (via RAKNET_DEBUG_TPRINTF)
28 #else
29 #include "slikenet/LinuxStrings.h" // used for _stricmp()
30 #endif
31
32 #include "slikenet/Itoa.h"
33
34 void RNS2_Berkley::SetSocketOptions(void)
35 {
36 int r;
37 // This doubles the max throughput rate
38 int sock_opt=1024*256;
39 r = setsockopt__( rns2Socket, SOL_SOCKET, SO_RCVBUF, ( char * ) & sock_opt, sizeof ( sock_opt ) );
40 RakAssert(r==0);
41
42 // Immediate hard close. Don't linger the socket, or recreating the socket quickly on Vista fails.
43 // Fail with voice and xbox
44
45 sock_opt=0;
46 r = setsockopt__( rns2Socket, SOL_SOCKET, SO_LINGER, ( char * ) & sock_opt, sizeof ( sock_opt ) );
47 // Do not assert, ignore failure
48
49
50
51 // This doesn't make much difference: 10% maybe
52 // Not supported on console 2
53 sock_opt=1024*16;
54 r = setsockopt__( rns2Socket, SOL_SOCKET, SO_SNDBUF, ( char * ) & sock_opt, sizeof ( sock_opt ) );
55 RakAssert(r==0);
56
57 }
58
59 void RNS2_Berkley::SetNonBlockingSocket(unsigned long nonblocking)
60 {
61 #ifdef _WIN32
62 int res = ioctlsocket__( rns2Socket, FIONBIO, &nonblocking );
63 RakAssert(res==0);
64
65
66
67 #else
68 if (nonblocking)
69 fcntl( rns2Socket, F_SETFL, O_NONBLOCK );
70 #endif
71 }
72 void RNS2_Berkley::SetBroadcastSocket(int broadcast)
73 {
74 setsockopt__( rns2Socket, SOL_SOCKET, SO_BROADCAST, ( char * ) & broadcast, sizeof( broadcast ) );
75 }
76 void RNS2_Berkley::SetIPHdrIncl(int ipHdrIncl)
77 {
78
79 setsockopt__( rns2Socket, IPPROTO_IP, IP_HDRINCL, ( char * ) & ipHdrIncl, sizeof( ipHdrIncl ) );
80
81 }
82 void RNS2_Berkley::SetDoNotFragment( int opt )
83 {
84 #if defined( IP_DONTFRAGMENT )
85 #if defined(_WIN32) && !defined(_DEBUG)
86 // If this assert hit you improperly linked against WSock32.h
87 RakAssert(IP_DONTFRAGMENT==14);
88 #endif
89 setsockopt__( rns2Socket, boundAddress.GetIPPROTO(), IP_DONTFRAGMENT, ( char * ) & opt, sizeof ( opt ) );
90 #endif
91 }
92
93 void RNS2_Berkley::GetSystemAddressIPV4 ( RNS2Socket rns2Socket, SystemAddress *systemAddressOut )
94 {
95 sockaddr_in sa;
96 memset(&sa,0,sizeof(sockaddr_in));
97 socklen_t len = sizeof(sa);
98 //int r =
99 getsockname__(rns2Socket, (sockaddr*)&sa, &len);
100 systemAddressOut->SetPortNetworkOrder(sa.sin_port);
101 systemAddressOut->address.addr4.sin_addr.s_addr=sa.sin_addr.s_addr;
102
103 if (systemAddressOut->address.addr4.sin_addr.s_addr == INADDR_ANY)
104 {
105
106
107
108
109 inet_pton(AF_INET, "127.0.0.1", &systemAddressOut->address.addr4.sin_addr.s_addr);
110
111 }
112 }
113 void RNS2_Berkley::GetSystemAddressIPV4And6 ( RNS2Socket rns2Socket, SystemAddress *systemAddressOut )
114 {
115 #if RAKNET_SUPPORT_IPV6==1
116
117 socklen_t slen;
118 sockaddr_storage ss;
119 slen = sizeof(ss);
120
121 if ( getsockname__(rns2Socket, (struct sockaddr *)&ss, &slen)!=0)
122 {
123 #if defined(_WIN32) && defined(_DEBUG)
124 DWORD dwIOError = GetLastError();
125 LPVOID messageBuffer;
126 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
127 NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
128 ( LPTSTR ) & messageBuffer, 0, NULL );
129 // something has gone wrong here...
130 RAKNET_DEBUG_TPRINTF( _T("getsockname failed:Error code - %d\n%s"), dwIOError, static_cast<LPTSTR>(messageBuffer));
131
132 //Free the buffer.
133 LocalFree( messageBuffer );
134 #endif
135 systemAddressOut->FromString(0);
136 return;
137 }
138
139 if (ss.ss_family==AF_INET)
140 {
141 memcpy(&systemAddressOut->address.addr4,(sockaddr_in *)&ss,sizeof(sockaddr_in));
142 systemAddressOut->debugPort=ntohs(systemAddressOut->address.addr4.sin_port);
143
144 uint32_t zero = 0;
145 if (memcmp(&systemAddressOut->address.addr4.sin_addr.s_addr, &zero, sizeof(zero))==0)
146 systemAddressOut->SetToLoopback(4);
147 // systemAddressOut->address.addr4.sin_port=ntohs(systemAddressOut->address.addr4.sin_port);
148 }
149 else
150 {
151 memcpy(&systemAddressOut->address.addr6,(sockaddr_in6 *)&ss,sizeof(sockaddr_in6));
152 systemAddressOut->debugPort=ntohs(systemAddressOut->address.addr6.sin6_port);
153
154 char zero[16];
155 memset(zero,0,sizeof(zero));
156 if (memcmp(&systemAddressOut->address.addr4.sin_addr.s_addr, &zero, sizeof(zero))==0)
157 systemAddressOut->SetToLoopback(6);
158
159 // systemAddressOut->address.addr6.sin6_port=ntohs(systemAddressOut->address.addr6.sin6_port);
160 }
161
162 #else
163 (void) rns2Socket;
164 (void) systemAddressOut;
165 return;
166 #endif
167 }
168
169 RNS2BindResult RNS2_Berkley::BindSharedIPV4( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line ) {
170
171 (void) file;
172 (void) line;
173
174 int ret;
175 memset(&boundAddress.address.addr4,0,sizeof(sockaddr_in));
176 boundAddress.address.addr4.sin_port = htons( bindParameters->port );
177 rns2Socket = (int) socket__( bindParameters->addressFamily, bindParameters->type, bindParameters->protocol );
178 if (rns2Socket == -1)
179 return BR_FAILED_TO_BIND_SOCKET;
180
181 SetSocketOptions();
182 SetNonBlockingSocket(bindParameters->nonBlockingSocket);
183 SetBroadcastSocket(bindParameters->setBroadcast);
184 SetIPHdrIncl(bindParameters->setIPHdrIncl);
185
186 // Fill in the rest of the address structure
187 boundAddress.address.addr4.sin_family = AF_INET;
188
189
190
191
192
193 if (bindParameters->hostAddress && bindParameters->hostAddress[0])
194 {
195
196
197
198
199
200 inet_pton(AF_INET, bindParameters->hostAddress, &boundAddress.address.addr4.sin_addr.s_addr);
201
202 }
203 else
204 {
205 // RAKNET_DEBUG_PRINTF("Binding any on port %i\n", port);
206 boundAddress.address.addr4.sin_addr.s_addr = INADDR_ANY;
207 }
208
209
210
211
212
213 // bind our name to the socket
214 ret = bind__( rns2Socket, ( struct sockaddr * ) &boundAddress.address.addr4, sizeof( boundAddress.address.addr4 ) );
215
216 if ( ret <= -1 )
217 {
218
219
220
221
222
223
224
225
226 #if defined(_WIN32)
227 closesocket__(rns2Socket);
228 return BR_FAILED_TO_BIND_SOCKET;
229 #elif (defined(__GNUC__) || defined(__GCCXML__) ) && !defined(_WIN32)
230 closesocket__(rns2Socket);
231 switch (errno)
232 {
233 case EBADF:
234 RAKNET_DEBUG_PRINTF("bind__(): sockfd is not a valid descriptor.\n"); break;
235
236 case ENOTSOCK:
237 RAKNET_DEBUG_PRINTF("bind__(): Argument is a descriptor for a file, not a socket.\n"); break;
238
239 case EINVAL:
240 RAKNET_DEBUG_PRINTF("bind__(): The addrlen is wrong, or the socket was not in the AF_UNIX family.\n"); break;
241 case EROFS:
242 RAKNET_DEBUG_PRINTF("bind__(): The socket inode would reside on a read-only file system.\n"); break;
243 case EFAULT:
244 RAKNET_DEBUG_PRINTF("bind__(): my_addr points outside the user's accessible address space.\n"); break;
245 case ENAMETOOLONG:
246 RAKNET_DEBUG_PRINTF("bind__(): my_addr is too long.\n"); break;
247 case ENOENT:
248 RAKNET_DEBUG_PRINTF("bind__(): The file does not exist.\n"); break;
249 case ENOMEM:
250 RAKNET_DEBUG_PRINTF("bind__(): Insufficient kernel memory was available.\n"); break;
251 case ENOTDIR:
252 RAKNET_DEBUG_PRINTF("bind__(): A component of the path prefix is not a directory.\n"); break;
253 case EACCES:
254 // Port reserved on PS4
255 RAKNET_DEBUG_PRINTF("bind__(): Search permission is denied on a component of the path prefix.\n"); break;
256
257 case ELOOP:
258 RAKNET_DEBUG_PRINTF("bind__(): Too many symbolic links were encountered in resolving my_addr.\n"); break;
259
260 default:
261 RAKNET_DEBUG_PRINTF("Unknown bind__() error %i.\n", errno); break;
262 }
263
264 return BR_FAILED_TO_BIND_SOCKET;
265 #endif
266 }
267
268 GetSystemAddressIPV4(rns2Socket, &boundAddress );
269
270 return BR_SUCCESS;
271
272 }
273 RNS2BindResult RNS2_Berkley::BindSharedIPV4And6( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line ) {
274
275 (void) file;
276 (void) line;
277 (void) bindParameters;
278
279 #if RAKNET_SUPPORT_IPV6==1
280
281 int ret=0;
282 struct addrinfo hints;
283 struct addrinfo *servinfo=0, *aip; // will point to the results
284 PrepareAddrInfoHints2(&hints);
285 hints.ai_family=bindParameters->addressFamily;
286 char portStr[32];
287 Itoa(bindParameters->port,portStr,10);
288
289
290 // On Ubuntu, "" returns "No address associated with hostname" while 0 works.
291 if (bindParameters->hostAddress &&
292 (_stricmp(bindParameters->hostAddress,"UNASSIGNED_SYSTEM_ADDRESS")==0 || bindParameters->hostAddress[0]==0))
293 {
294 getaddrinfo(0, portStr, &hints, &servinfo);
295 }
296 else
297 {
298 getaddrinfo(bindParameters->hostAddress, portStr, &hints, &servinfo);
299 }
300
301 // Try all returned addresses until one works
302 for (aip = servinfo; aip != NULL; aip = aip->ai_next)
303 {
304 // Open socket. The address type depends on what
305 // getaddrinfo() gave us.
306 rns2Socket = socket__(aip->ai_family, aip->ai_socktype, aip->ai_protocol);
307
308 if (rns2Socket == -1)
309 return BR_FAILED_TO_BIND_SOCKET;
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329 ret = bind__(rns2Socket, aip->ai_addr, (int) aip->ai_addrlen );
330 if (ret>=0)
331 {
332 if (aip->ai_family == AF_INET)
333 {
334 memcpy(&boundAddress.address.addr4, aip->ai_addr, sizeof(sockaddr_in));
335 }
336 else
337 {
338 memcpy(&boundAddress.address.addr6, aip->ai_addr, sizeof(sockaddr_in6));
339 }
340
341 freeaddrinfo(servinfo); // free the linked-list
342
343 SetSocketOptions();
344 SetNonBlockingSocket(bindParameters->nonBlockingSocket);
345 SetBroadcastSocket(bindParameters->setBroadcast);
346 SetIPHdrIncl(bindParameters->setIPHdrIncl);
347
348 GetSystemAddressIPV4And6( rns2Socket, &boundAddress );
349
350 return BR_SUCCESS;
351 }
352 else
353 {
354 closesocket__(rns2Socket);
355 }
356 }
357
358 return BR_FAILED_TO_BIND_SOCKET;
359
360 #else
361 return BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE;
362 #endif
363 }
364
365 void RNS2_Berkley::RecvFromBlockingIPV4And6(RNS2RecvStruct *recvFromStruct)
366 {
367 #if RAKNET_SUPPORT_IPV6==1
368
369 sockaddr_storage their_addr;
370 sockaddr* sockAddrPtr;
371 socklen_t sockLen;
372 socklen_t* socketlenPtr=(socklen_t*) &sockLen;
373 memset(&their_addr,0,sizeof(their_addr));
374 int dataOutSize;
375 const int flag=0;
376
377
378
379
380
381
382
383
384
385
386
387 {
388 sockLen=sizeof(their_addr);
389 sockAddrPtr=(sockaddr*) &their_addr;
390 }
391
392
393
394
395 dataOutSize=MAXIMUM_MTU_SIZE;
396
397
398 recvFromStruct->bytesRead = recvfrom__(rns2Socket, recvFromStruct->data, dataOutSize, flag, sockAddrPtr, socketlenPtr );
399
400 #if defined(_WIN32) && defined(_DEBUG) && !defined(WINDOWS_PHONE_8)
401 if (recvFromStruct->bytesRead==-1)
402 {
403 DWORD dwIOError = GetLastError();
404 if (dwIOError != 10035)
405 {
406 LPVOID messageBuffer;
407 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
408 NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
409 ( LPTSTR ) & messageBuffer, 0, NULL );
410 // I see this hit on XP with IPV6 for some reason
411 RAKNET_DEBUG_TPRINTF( _T("Warning: recvfrom failed:Error code - %d\n%s"), dwIOError, static_cast<LPTSTR>(messageBuffer) );
412 LocalFree( messageBuffer );
413 }
414 }
415 #endif
416
417
418
419
420
421
422
423
424
425
426 if (recvFromStruct->bytesRead<=0)
427 return;
428 recvFromStruct->timeRead= SLNet::GetTimeUS();
429
430
431
432
433
434
435
436
437
438 {
439 if (their_addr.ss_family==AF_INET)
440 {
441 memcpy(&recvFromStruct->systemAddress.address.addr4,(sockaddr_in *)&their_addr,sizeof(sockaddr_in));
442 recvFromStruct->systemAddress.debugPort=ntohs(recvFromStruct->systemAddress.address.addr4.sin_port);
443 // systemAddressOut->address.addr4.sin_port=ntohs( systemAddressOut->address.addr4.sin_port );
444 }
445 else
446 {
447 memcpy(&recvFromStruct->systemAddress.address.addr6,(sockaddr_in6 *)&their_addr,sizeof(sockaddr_in6));
448 recvFromStruct->systemAddress.debugPort=ntohs(recvFromStruct->systemAddress.address.addr6.sin6_port);
449 // systemAddressOut->address.addr6.sin6_port=ntohs( systemAddressOut->address.addr6.sin6_port );
450 }
451 }
452
453
454 #else
455 (void) recvFromStruct;
456 #endif
457 }
458
459 void RNS2_Berkley::RecvFromBlockingIPV4(RNS2RecvStruct *recvFromStruct)
460 {
461 sockaddr* sockAddrPtr;
462 socklen_t sockLen;
463 socklen_t* socketlenPtr=(socklen_t*) &sockLen;
464 sockaddr_in sa;
465 memset(&sa,0,sizeof(sockaddr_in));
466 const int flag=0;
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488 {
489 sockLen=sizeof(sa);
490 sa.sin_family = AF_INET;
491 sa.sin_port=0;
492 sockAddrPtr=(sockaddr*) &sa;
493 }
494
495 recvFromStruct->bytesRead = recvfrom__( GetSocket(), recvFromStruct->data, sizeof(recvFromStruct->data), flag, sockAddrPtr, socketlenPtr );
496
497
498
499
500
501
502
503
504
505 if (recvFromStruct->bytesRead<=0)
506 {
507 /*
508 DWORD dwIOError = WSAGetLastError();
509
510 if ( dwIOError == WSAECONNRESET )
511 {
512 #if defined(_DEBUG)
513 RAKNET_DEBUG_PRINTF( "A previous send operation resulted in an ICMP Port Unreachable message.\n" );
514 #endif
515
516 }
517 else if ( dwIOError != WSAEWOULDBLOCK && dwIOError != WSAEADDRNOTAVAIL)
518 {
519 #if defined(_WIN32) && !defined(_XBOX) && !defined(_XBOX_720_COMPILE_AS_WINDOWS) && !defined(X360) && defined(_DEBUG) && !defined(_XBOX_720_COMPILE_AS_WINDOWS) && !defined(WINDOWS_PHONE_8)
520 LPVOID messageBuffer;
521 FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
522 NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
523 ( LPTSTR ) & messageBuffer, 0, NULL );
524 // something has gone wrong here...
525 RAKNET_DEBUG_PRINTF( "sendto failed:Error code - %d\n%s", dwIOError, static_cast<LPTSTR>(messageBuffer) );
526
527 //Free the buffer.
528 LocalFree( messageBuffer );
529 #endif
530 }
531 */
532
533 return;
534 }
535 recvFromStruct->timeRead= SLNet::GetTimeUS();
536
537
538
539
540
541
542
543
544
545 {
546
547 recvFromStruct->systemAddress.SetPortNetworkOrder( sa.sin_port );
548 recvFromStruct->systemAddress.address.addr4.sin_addr.s_addr=sa.sin_addr.s_addr;
549 }
550
551 // printf("--- Got %i bytes from %s\n", recvFromStruct->bytesRead, recvFromStruct->systemAddress.ToString());
552 }
553
554 void RNS2_Berkley::RecvFromBlocking(RNS2RecvStruct *recvFromStruct)
555 {
556 #if RAKNET_SUPPORT_IPV6==1
557 return RecvFromBlockingIPV4And6(recvFromStruct);
558 #else
559 return RecvFromBlockingIPV4(recvFromStruct);
560 #endif
561 }
562
563 #endif // !defined(WINDOWS_STORE_RT) && !defined(__native_client__)
564
565 #endif // file header
566
567 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CloudServer.cpp Source File

  • src
CloudServer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_CloudServer==1
18
19 #include "slikenet/CloudServer.h"
20 #include "slikenet/GetTime.h"
21 #include "slikenet/MessageIdentifiers.h"
22 #include "slikenet/BitStream.h"
23 #include "slikenet/peerinterface.h"
24
25 enum ServerToServerCommands
26 {
27 STSC_PROCESS_GET_REQUEST,
28 STSC_PROCESS_GET_RESPONSE,
29 STSC_ADD_UPLOADED_AND_SUBSCRIBED_KEYS,
30 STSC_ADD_UPLOADED_KEY,
31 STSC_ADD_SUBSCRIBED_KEY,
32 STSC_REMOVE_UPLOADED_KEY,
33 STSC_REMOVE_SUBSCRIBED_KEY,
34 STSC_DATA_CHANGED,
35 };
36
37 using namespace SLNet;
38
39 int CloudServer::RemoteServerComp(const RakNetGUID &key, RemoteServer* const &data )
40 {
41 if (key < data->serverAddress)
42 return -1;
43 if (key > data->serverAddress)
44 return 1;
45 return 0;
46 }
47 int CloudServer::KeySubscriberIDComp(const CloudKey &key, KeySubscriberID * const &data )
48 {
49 if (key.primaryKey < data->key.primaryKey)
50 return -1;
51 if (key.primaryKey > data->key.primaryKey)
52 return 1;
53 if (key.secondaryKey < data->key.secondaryKey)
54 return -1;
55 if (key.secondaryKey > data->key.secondaryKey)
56 return 1;
57 return 0;
58 }
59 int CloudServer::KeyDataPtrComp( const RakNetGUID &key, CloudData* const &data )
60 {
61 if (key < data->clientGUID)
62 return -1;
63 if (key > data->clientGUID)
64 return 1;
65 return 0;
66 }
67 int CloudServer::KeyDataListComp( const CloudKey &key, CloudDataList * const &data )
68 {
69 if (key.primaryKey < data->key.primaryKey)
70 return -1;
71 if (key.primaryKey > data->key.primaryKey)
72 return 1;
73 if (key.secondaryKey < data->key.secondaryKey)
74 return -1;
75 if (key.secondaryKey > data->key.secondaryKey)
76 return 1;
77 return 0;
78 }
79 int CloudServer::BufferedGetResponseFromServerComp(const RakNetGUID &key, CloudServer::BufferedGetResponseFromServer* const &data )
80 {
81 if (key < data->serverAddress)
82 return -1;
83 if (key > data->serverAddress)
84 return 1;
85 return 0;
86 }
87 int CloudServer::GetRequestComp(const uint32_t &key, CloudServer::GetRequest* const &data )
88 {
89 if (key < data->requestId)
90 return -1;
91 if (key > data->requestId)
92 return -1;
93 return 0;
94 }
95 void CloudServer::CloudQueryWithAddresses::Serialize(bool writeToBitstream, BitStream *bitStream)
96 {
97 cloudQuery.Serialize(writeToBitstream, bitStream);
98
99 if (writeToBitstream)
100 {
101 bitStream->WriteCasted<uint16_t>(specificSystems.Size());
102 RakAssert(specificSystems.Size() < (uint16_t)-1 );
103 for (uint16_t i=0; i < specificSystems.Size(); i++)
104 {
105 bitStream->Write(specificSystems[i]);
106 }
107 }
108 else
109 {
110 uint16_t specificSystemsCount;
111 RakNetGUID addressOrGuid;
112 bitStream->Read(specificSystemsCount);
113 for (uint16_t i=0; i < specificSystemsCount; i++)
114 {
115 bitStream->Read(addressOrGuid);
116 specificSystems.Push(addressOrGuid, _FILE_AND_LINE_);
117 }
118 }
119 }
120 bool CloudServer::GetRequest::AllRemoteServersHaveResponded(void) const
121 {
122 unsigned int i;
123 for (i=0; i < remoteServerResponses.Size(); i++)
124 if (remoteServerResponses[i]->gotResult==false)
125 return false;
126 return true;
127 }
128 void CloudServer::GetRequest::Clear(CloudAllocator *allocator)
129 {
130 unsigned int i;
131 for (i=0; i < remoteServerResponses.Size(); i++)
132 {
133 remoteServerResponses[i]->Clear(allocator);
134 SLNet::OP_DELETE(remoteServerResponses[i], _FILE_AND_LINE_);
135 }
136 remoteServerResponses.Clear(false, _FILE_AND_LINE_);
137 }
138 void CloudServer::BufferedGetResponseFromServer::Clear(CloudAllocator *allocator)
139 {
140 unsigned int i;
141 for (i=0; i < queryResult.rowsReturned.Size(); i++)
142 {
143 allocator->DeallocateRowData(queryResult.rowsReturned[i]->data);
144 allocator->DeallocateCloudQueryRow(queryResult.rowsReturned[i]);
145 }
146 queryResult.rowsReturned.Clear(false, _FILE_AND_LINE_);
147 }
148 CloudServer::CloudServer()
149 {
150 maxUploadBytesPerClient=0;
151 maxBytesPerDowload=0;
152 nextGetRequestId=0;
153 nextGetRequestsCheck=0;
154 }
155 CloudServer::~CloudServer()
156 {
157 Clear();
158 }
159 void CloudServer::SetMaxUploadBytesPerClient(uint64_t bytes)
160 {
161 maxUploadBytesPerClient=bytes;
162 }
163 void CloudServer::SetMaxBytesPerDownload(uint64_t bytes)
164 {
165 maxBytesPerDowload=bytes;
166 }
167 void CloudServer::Update(void)
168 {
169 // Timeout getRequests
170 SLNet::Time time = SLNet::Time();
171 if (time > nextGetRequestsCheck)
172 {
173 nextGetRequestsCheck=time+1000;
174
175 unsigned int i=0;
176 while (i < getRequests.Size())
177 {
178 if (time - getRequests[i]->requestStartTime > 3000)
179 {
180 // Remote server is not responding, just send back data with whoever did respond
181 ProcessAndTransmitGetRequest(getRequests[i]);
182 getRequests[i]->Clear(this);
183 SLNet::OP_DELETE(getRequests[i],_FILE_AND_LINE_);
184 getRequests.RemoveAtIndex(i);
185 }
186 else
187 {
188 i++;
189 }
190 }
191 }
192 }
193 PluginReceiveResult CloudServer::OnReceive(Packet *packet)
194 {
195 switch (packet->data[0])
196 {
197 case ID_CLOUD_POST_REQUEST:
198 OnPostRequest(packet);
199 return RR_STOP_PROCESSING_AND_DEALLOCATE;
200 case ID_CLOUD_RELEASE_REQUEST:
201 OnReleaseRequest(packet);
202 return RR_STOP_PROCESSING_AND_DEALLOCATE;
203 case ID_CLOUD_GET_REQUEST:
204 OnGetRequest(packet);
205 return RR_STOP_PROCESSING_AND_DEALLOCATE;
206 case ID_CLOUD_UNSUBSCRIBE_REQUEST:
207 OnUnsubscribeRequest(packet);
208 return RR_STOP_PROCESSING_AND_DEALLOCATE;
209 case ID_CLOUD_SERVER_TO_SERVER_COMMAND:
210 if (packet->length>1)
211 {
212 switch (packet->data[1])
213 {
214 case STSC_PROCESS_GET_REQUEST:
215 OnServerToServerGetRequest(packet);
216 return RR_STOP_PROCESSING_AND_DEALLOCATE;
217 case STSC_PROCESS_GET_RESPONSE:
218 OnServerToServerGetResponse(packet);
219 return RR_STOP_PROCESSING_AND_DEALLOCATE;
220 case STSC_ADD_UPLOADED_AND_SUBSCRIBED_KEYS:
221 OnSendUploadedAndSubscribedKeysToServer(packet);
222 return RR_STOP_PROCESSING_AND_DEALLOCATE;
223 case STSC_ADD_UPLOADED_KEY:
224 OnSendUploadedKeyToServers(packet);
225 return RR_STOP_PROCESSING_AND_DEALLOCATE;
226 case STSC_ADD_SUBSCRIBED_KEY:
227 OnSendSubscribedKeyToServers(packet);
228 return RR_STOP_PROCESSING_AND_DEALLOCATE;
229 case STSC_REMOVE_UPLOADED_KEY:
230 OnRemoveUploadedKeyFromServers(packet);
231 return RR_STOP_PROCESSING_AND_DEALLOCATE;
232 case STSC_REMOVE_SUBSCRIBED_KEY:
233 OnRemoveSubscribedKeyFromServers(packet);
234 return RR_STOP_PROCESSING_AND_DEALLOCATE;
235 case STSC_DATA_CHANGED:
236 OnServerDataChanged(packet);
237 return RR_STOP_PROCESSING_AND_DEALLOCATE;
238 }
239 }
240 return RR_STOP_PROCESSING_AND_DEALLOCATE;
241 }
242 return RR_CONTINUE_PROCESSING;
243 }
244 void CloudServer::OnPostRequest(Packet *packet)
245 {
246 SLNet::BitStream bsIn(packet->data, packet->length, false);
247 bsIn.IgnoreBytes(sizeof(MessageID));
248 CloudKey key;
249 key.Serialize(false,&bsIn);
250 uint32_t dataLengthBytes;
251 bsIn.Read(dataLengthBytes);
252 if (maxUploadBytesPerClient>0 && dataLengthBytes>maxUploadBytesPerClient)
253 return; // Exceeded max upload bytes
254
255 bsIn.AlignReadToByteBoundary();
256 for (unsigned int filterIndex=0; filterIndex < queryFilters.Size(); filterIndex++)
257 {
258 if (queryFilters[filterIndex]->OnPostRequest(packet->guid, packet->systemAddress, key, dataLengthBytes, (const char*) bsIn.GetData()+BITS_TO_BYTES(bsIn.GetReadOffset()))==false)
259 return;
260 }
261
262 unsigned char *data;
263 if (dataLengthBytes>CLOUD_SERVER_DATA_STACK_SIZE)
264 {
265 data = (unsigned char *) rakMalloc_Ex(dataLengthBytes,_FILE_AND_LINE_);
266 if (data==0)
267 {
268 notifyOutOfMemory(_FILE_AND_LINE_);
269 return;
270 }
271 bsIn.ReadAlignedBytes(data,dataLengthBytes);
272 }
273 else
274 data=0;
275
276 // Add this system to remoteSystems if they aren't there already
277 DataStructures::HashIndex remoteSystemsHashIndex = remoteSystems.GetIndexOf(packet->guid);
278 RemoteCloudClient *remoteCloudClient;
279 if (remoteSystemsHashIndex.IsInvalid())
280 {
281 remoteCloudClient = SLNet::OP_NEW<RemoteCloudClient>(_FILE_AND_LINE_);
282 remoteCloudClient->uploadedKeys.Insert(key,key,true,_FILE_AND_LINE_);
283 remoteCloudClient->uploadedBytes=0;
284 remoteSystems.Push(packet->guid, remoteCloudClient, _FILE_AND_LINE_);
285 }
286 else
287 {
288 remoteCloudClient = remoteSystems.ItemAtIndex(remoteSystemsHashIndex);
289 bool objectExists;
290 // Add to RemoteCloudClient::uploadedKeys if it isn't there already
291 unsigned int uploadedKeysIndex = remoteCloudClient->uploadedKeys.GetIndexFromKey(key,&objectExists);
292 if (objectExists==false)
293 {
294 remoteCloudClient->uploadedKeys.InsertAtIndex(key, uploadedKeysIndex, _FILE_AND_LINE_);
295 }
296 }
297
298 bool cloudDataAlreadyUploaded;
299 unsigned int dataRepositoryIndex;
300 bool dataRepositoryExists;
301 CloudDataList* cloudDataList = GetOrAllocateCloudDataList(key, &dataRepositoryExists, dataRepositoryIndex);
302 if (dataRepositoryExists==false)
303 {
304 cloudDataList->uploaderCount=1;
305 cloudDataAlreadyUploaded=false;
306 }
307 else
308 {
309 cloudDataAlreadyUploaded=cloudDataList->uploaderCount>0;
310 cloudDataList->uploaderCount++;
311 }
312
313 CloudData *cloudData;
314 bool keyDataListExists;
315 unsigned int keyDataListIndex = cloudDataList->keyData.GetIndexFromKey(packet->guid, &keyDataListExists);
316 if (keyDataListExists==false)
317 {
318 if (maxUploadBytesPerClient>0 && remoteCloudClient->uploadedBytes+dataLengthBytes>maxUploadBytesPerClient)
319 {
320 // Undo prior insertion of cloudDataList into cloudData if needed
321 if (keyDataListExists==false)
322 {
323 SLNet::OP_DELETE(cloudDataList,_FILE_AND_LINE_);
324 dataRepository.RemoveAtIndex(dataRepositoryIndex);
325 }
326
327 if (remoteCloudClient->IsUnused())
328 {
329 SLNet::OP_DELETE(remoteCloudClient, _FILE_AND_LINE_);
330 remoteSystems.Remove(packet->guid, _FILE_AND_LINE_);
331 }
332
333 if (dataLengthBytes>CLOUD_SERVER_DATA_STACK_SIZE)
334 rakFree_Ex(data, _FILE_AND_LINE_);
335
336 return;
337 }
338
339 cloudData = SLNet::OP_NEW<CloudData>(_FILE_AND_LINE_);
340 cloudData->dataLengthBytes=dataLengthBytes;
341 cloudData->isUploaded=true;
342 if (forceAddress!=UNASSIGNED_SYSTEM_ADDRESS)
343 {
344 cloudData->serverSystemAddress=forceAddress;
345 cloudData->serverSystemAddress.SetPortHostOrder(rakPeerInterface->GetExternalID(packet->systemAddress).GetPort());
346 }
347 else
348 {
349 cloudData->serverSystemAddress=rakPeerInterface->GetExternalID(packet->systemAddress);
350 if (cloudData->serverSystemAddress.IsLoopback())
351 cloudData->serverSystemAddress.FromString(rakPeerInterface->GetLocalIP(0));
352 }
353 if (cloudData->serverSystemAddress.GetPort()==0)
354 {
355 // Fix localhost port
356 cloudData->serverSystemAddress.SetPortHostOrder(rakPeerInterface->GetSocket(UNASSIGNED_SYSTEM_ADDRESS)->GetBoundAddress().GetPort());
357 }
358 cloudData->clientSystemAddress=packet->systemAddress;
359 cloudData->serverGUID=rakPeerInterface->GetMyGUID();
360 cloudData->clientGUID=packet->guid;
361 cloudDataList->keyData.Insert(packet->guid,cloudData,true,_FILE_AND_LINE_);
362 }
363 else
364 {
365 cloudData = cloudDataList->keyData[keyDataListIndex];
366
367 if (cloudDataAlreadyUploaded==false)
368 {
369 if (forceAddress!=UNASSIGNED_SYSTEM_ADDRESS)
370 {
371 cloudData->serverSystemAddress=forceAddress;
372 cloudData->serverSystemAddress.SetPortHostOrder(rakPeerInterface->GetExternalID(packet->systemAddress).GetPort());
373 }
374 else
375 {
376 cloudData->serverSystemAddress=rakPeerInterface->GetExternalID(packet->systemAddress);
377 }
378 if (cloudData->serverSystemAddress.GetPort()==0)
379 {
380 // Fix localhost port
381 cloudData->serverSystemAddress.SetPortHostOrder(rakPeerInterface->GetSocket(UNASSIGNED_SYSTEM_ADDRESS)->GetBoundAddress().GetPort());
382 }
383
384 cloudData->clientSystemAddress=packet->systemAddress;
385 }
386
387 if (maxUploadBytesPerClient>0 && remoteCloudClient->uploadedBytes-cloudData->dataLengthBytes+dataLengthBytes>maxUploadBytesPerClient)
388 {
389 // Undo prior insertion of cloudDataList into cloudData if needed
390 if (dataRepositoryExists==false)
391 {
392 SLNet::OP_DELETE(cloudDataList,_FILE_AND_LINE_);
393 dataRepository.RemoveAtIndex(dataRepositoryIndex);
394 }
395 return;
396 }
397 else
398 {
399 // Subtract already used bytes we are overwriting
400 remoteCloudClient->uploadedBytes-=cloudData->dataLengthBytes;
401 }
402
403 if (cloudData->allocatedData!=0)
404 rakFree_Ex(cloudData->allocatedData,_FILE_AND_LINE_);
405 }
406
407 if (dataLengthBytes>CLOUD_SERVER_DATA_STACK_SIZE)
408 {
409 // Data already allocated
410 cloudData->allocatedData=data;
411 cloudData->dataPtr=data;
412 }
413 else
414 {
415 // Read to stack
416 if (dataLengthBytes>0)
417 bsIn.ReadAlignedBytes(cloudData->stackData,dataLengthBytes);
418 cloudData->allocatedData=0;
419 cloudData->dataPtr=cloudData->stackData;
420 }
421 // Update how many bytes were written for this data
422 cloudData->dataLengthBytes=dataLengthBytes;
423 remoteCloudClient->uploadedBytes+=dataLengthBytes;
424
425 if (cloudDataAlreadyUploaded==false)
426 {
427 // New data field
428 SendUploadedKeyToServers(cloudDataList->key);
429 }
430
431 // Existing data field changed
432 NotifyClientSubscribersOfDataChange(cloudData, cloudDataList->key, cloudData->specificSubscribers, true );
433 NotifyClientSubscribersOfDataChange(cloudData, cloudDataList->key, cloudDataList->nonSpecificSubscribers, true );
434
435 // Send update to all remote servers that subscribed to this key
436 NotifyServerSubscribersOfDataChange(cloudData, cloudDataList->key, true);
437
438 // I could have also subscribed to a key not yet updated locally
439 // This means I have to go through every RemoteClient that wants this key
440 // Seems like cloudData->specificSubscribers is unnecessary in that case
441 }
442 void CloudServer::OnReleaseRequest(Packet *packet)
443 {
444 SLNet::BitStream bsIn(packet->data, packet->length, false);
445 bsIn.IgnoreBytes(sizeof(MessageID));
446
447 uint16_t keyCount;
448 bsIn.Read(keyCount);
449
450 if (keyCount==0)
451 return;
452
453 DataStructures::HashIndex remoteSystemIndex = remoteSystems.GetIndexOf(packet->guid);
454 if (remoteSystemIndex.IsInvalid()==true)
455 return;
456
457 RemoteCloudClient* remoteCloudClient = remoteSystems.ItemAtIndex(remoteSystemIndex);
458
459 CloudKey key;
460
461 // Read all in a list first so I can run filter on it
462 DataStructures::List<CloudKey> cloudKeys;
463 for (uint16_t keyCountIndex=0; keyCountIndex < keyCount; keyCountIndex++)
464 {
465 key.Serialize(false, &bsIn);
466 cloudKeys.Push(key, _FILE_AND_LINE_);
467 }
468
469 for (unsigned int filterIndex=0; filterIndex < queryFilters.Size(); filterIndex++)
470 {
471 if (queryFilters[filterIndex]->OnReleaseRequest(packet->guid, packet->systemAddress, cloudKeys)==false)
472 return;
473 }
474
475 for (uint16_t keyCountIndex=0; keyCountIndex < keyCount; keyCountIndex++)
476 {
477 // Serialize in list above so I can run the filter on it
478 // key.Serialize(false, &bsIn);
479 key=cloudKeys[keyCountIndex];
480
481 // Remove remote systems uploaded keys
482 bool objectExists;
483 unsigned int uploadedKeysIndex = remoteCloudClient->uploadedKeys.GetIndexFromKey(key,&objectExists);
484 if (objectExists)
485 {
486 bool dataRepositoryExists;
487 unsigned int dataRepositoryIndex = dataRepository.GetIndexFromKey(key, &dataRepositoryExists);
488 CloudDataList* cloudDataList = dataRepository[dataRepositoryIndex];
489 RakAssert(cloudDataList);
490
491 CloudData *cloudData;
492 bool keyDataListExists;
493 unsigned int keyDataListIndex = cloudDataList->keyData.GetIndexFromKey(packet->guid, &keyDataListExists);
494 cloudData = cloudDataList->keyData[keyDataListIndex];
495
496 remoteCloudClient->uploadedKeys.RemoveAtIndex(uploadedKeysIndex);
497 remoteCloudClient->uploadedBytes-=cloudData->dataLengthBytes;
498 cloudDataList->uploaderCount--;
499
500 // Broadcast destruction of this key to subscribers
501 NotifyClientSubscribersOfDataChange(cloudData, cloudDataList->key, cloudData->specificSubscribers, false );
502 NotifyClientSubscribersOfDataChange(cloudData, cloudDataList->key, cloudDataList->nonSpecificSubscribers, false );
503 NotifyServerSubscribersOfDataChange(cloudData, cloudDataList->key, false );
504
505 cloudData->Clear();
506
507 if (cloudData->IsUnused())
508 {
509 SLNet::OP_DELETE(cloudData, _FILE_AND_LINE_);
510 cloudDataList->keyData.RemoveAtIndex(keyDataListIndex);
511 if (cloudDataList->IsNotUploaded())
512 {
513 // Tell other servers that this key is no longer uploaded, so they do not request it from us
514 RemoveUploadedKeyFromServers(cloudDataList->key);
515 }
516
517 if (cloudDataList->IsUnused())
518 {
519 SLNet::OP_DELETE(cloudDataList, _FILE_AND_LINE_);
520 dataRepository.RemoveAtIndex(dataRepositoryIndex);
521 }
522 }
523
524 if (remoteCloudClient->IsUnused())
525 {
526 SLNet::OP_DELETE(remoteCloudClient, _FILE_AND_LINE_);
527 remoteSystems.RemoveAtIndex(remoteSystemIndex, _FILE_AND_LINE_);
528 break;
529 }
530 }
531 }
532 }
533 void CloudServer::OnGetRequest(Packet *packet)
534 {
535 SLNet::BitStream bsIn(packet->data, packet->length, false);
536 bsIn.IgnoreBytes(sizeof(MessageID));
537 uint16_t specificSystemsCount;
538 CloudKey cloudKey;
539
540 // Create a new GetRequest
541 GetRequest *getRequest;
542 getRequest = SLNet::OP_NEW<GetRequest>(_FILE_AND_LINE_);
543 getRequest->cloudQueryWithAddresses.cloudQuery.Serialize(false, &bsIn);
544 getRequest->requestingClient=packet->guid;
545
546 RakNetGUID addressOrGuid;
547 bsIn.Read(specificSystemsCount);
548 for (uint16_t i=0; i < specificSystemsCount; i++)
549 {
550 bsIn.Read(addressOrGuid);
551 getRequest->cloudQueryWithAddresses.specificSystems.Push(addressOrGuid, _FILE_AND_LINE_);
552 }
553
554 if (getRequest->cloudQueryWithAddresses.cloudQuery.keys.Size()==0)
555 {
556 SLNet::OP_DELETE(getRequest, _FILE_AND_LINE_);
557 return;
558 }
559
560 for (unsigned int filterIndex=0; filterIndex < queryFilters.Size(); filterIndex++)
561 {
562 if (queryFilters[filterIndex]->OnGetRequest(packet->guid, packet->systemAddress, getRequest->cloudQueryWithAddresses.cloudQuery, getRequest->cloudQueryWithAddresses.specificSystems )==false)
563 return;
564 }
565
566 getRequest->requestStartTime= SLNet::GetTime();
567 getRequest->requestId=nextGetRequestId++;
568
569 // Send request to servers that have this data
570 DataStructures::List<RemoteServer*> remoteServersWithData;
571 GetServersWithUploadedKeys(getRequest->cloudQueryWithAddresses.cloudQuery.keys, remoteServersWithData);
572
573 if (remoteServersWithData.Size()==0)
574 {
575 ProcessAndTransmitGetRequest(getRequest);
576 }
577 else
578 {
579 SLNet::BitStream bsOut;
580 bsOut.Write((MessageID)ID_CLOUD_SERVER_TO_SERVER_COMMAND);
581 bsOut.Write((MessageID)STSC_PROCESS_GET_REQUEST);
582 getRequest->cloudQueryWithAddresses.Serialize(true, &bsOut);
583 bsOut.Write(getRequest->requestId);
584
585 for (unsigned int remoteServerIndex=0; remoteServerIndex < remoteServersWithData.Size(); remoteServerIndex++)
586 {
587 BufferedGetResponseFromServer* bufferedGetResponseFromServer = SLNet::OP_NEW<BufferedGetResponseFromServer>(_FILE_AND_LINE_);
588 bufferedGetResponseFromServer->serverAddress=remoteServersWithData[remoteServerIndex]->serverAddress;
589 bufferedGetResponseFromServer->gotResult=false;
590 getRequest->remoteServerResponses.Insert(remoteServersWithData[remoteServerIndex]->serverAddress, bufferedGetResponseFromServer, true, _FILE_AND_LINE_);
591
592 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, remoteServersWithData[remoteServerIndex]->serverAddress, false);
593 }
594
595 // Record that this system made this request
596 getRequests.Insert(getRequest->requestId, getRequest, true, _FILE_AND_LINE_);
597 }
598
599 if (getRequest->cloudQueryWithAddresses.cloudQuery.subscribeToResults)
600 {
601 // Add to key subscription list for the client, which contains a keyId / specificUploaderList pair
602 DataStructures::HashIndex remoteSystemsHashIndex = remoteSystems.GetIndexOf(packet->guid);
603 RemoteCloudClient *remoteCloudClient;
604 if (remoteSystemsHashIndex.IsInvalid())
605 {
606 remoteCloudClient = SLNet::OP_NEW<RemoteCloudClient>(_FILE_AND_LINE_);
607 remoteCloudClient->uploadedBytes=0;
608 remoteSystems.Push(packet->guid, remoteCloudClient, _FILE_AND_LINE_);
609 }
610 else
611 {
612 remoteCloudClient = remoteSystems.ItemAtIndex(remoteSystemsHashIndex);
613 }
614
615 unsigned int keyIndex;
616 for (keyIndex=0; keyIndex < getRequest->cloudQueryWithAddresses.cloudQuery.keys.Size(); keyIndex++)
617 {
618 cloudKey = getRequest->cloudQueryWithAddresses.cloudQuery.keys[keyIndex];
619
620 unsigned int keySubscriberIndex;
621 bool hasKeySubscriber;
622 keySubscriberIndex = remoteCloudClient->subscribedKeys.GetIndexFromKey(cloudKey, &hasKeySubscriber);
623 KeySubscriberID* keySubscriberId;
624 if (hasKeySubscriber)
625 {
626 DataStructures::List<RakNetGUID> specificSystems;
627 UnsubscribeFromKey(remoteCloudClient, packet->guid, keySubscriberIndex, cloudKey, specificSystems);
628 }
629
630 keySubscriberId = SLNet::OP_NEW<KeySubscriberID>(_FILE_AND_LINE_);
631 keySubscriberId->key=cloudKey;
632
633 unsigned int specificSystemIndex;
634 for (specificSystemIndex=0; specificSystemIndex < getRequest->cloudQueryWithAddresses.specificSystems.Size(); specificSystemIndex++)
635 {
636 keySubscriberId->specificSystemsSubscribedTo.Insert(getRequest->cloudQueryWithAddresses.specificSystems[specificSystemIndex], getRequest->cloudQueryWithAddresses.specificSystems[specificSystemIndex], true, _FILE_AND_LINE_);
637 }
638
639 remoteCloudClient->subscribedKeys.InsertAtIndex(keySubscriberId, keySubscriberIndex, _FILE_AND_LINE_);
640
641 // Add CloudData in a similar way
642 unsigned int dataRepositoryIndex;
643 bool dataRepositoryExists;
644 CloudDataList* cloudDataList = GetOrAllocateCloudDataList(cloudKey, &dataRepositoryExists, dataRepositoryIndex);
645
646 // If this is the first local client to subscribe to this key, call SendSubscribedKeyToServers
647 if (cloudDataList->subscriberCount==0)
648 SendSubscribedKeyToServers(cloudKey);
649
650 // If the subscription is specific, may have to also allocate CloudData
651 if (getRequest->cloudQueryWithAddresses.specificSystems.Size())
652 {
653 CloudData *cloudData;
654 bool keyDataListExists;
655
656 for (specificSystemIndex=0; specificSystemIndex < getRequest->cloudQueryWithAddresses.specificSystems.Size(); specificSystemIndex++)
657 {
658 RakNetGUID specificSystem = getRequest->cloudQueryWithAddresses.specificSystems[specificSystemIndex];
659
660 unsigned int keyDataListIndex = cloudDataList->keyData.GetIndexFromKey(specificSystem, &keyDataListExists);
661 if (keyDataListExists==false)
662 {
663 cloudData = SLNet::OP_NEW<CloudData>(_FILE_AND_LINE_);
664 cloudData->dataLengthBytes=0;
665 cloudData->allocatedData=0;
666 cloudData->isUploaded=false;
667 cloudData->dataPtr=0;
668 cloudData->serverSystemAddress=UNASSIGNED_SYSTEM_ADDRESS;
669 cloudData->clientSystemAddress=UNASSIGNED_SYSTEM_ADDRESS;
670 cloudData->serverGUID=rakPeerInterface->GetMyGUID();
671 cloudData->clientGUID=specificSystem;
672 cloudDataList->keyData.Insert(specificSystem,cloudData,true,_FILE_AND_LINE_);
673 }
674 else
675 {
676 cloudData = cloudDataList->keyData[keyDataListIndex];
677 }
678
679 ++cloudDataList->subscriberCount;
680 cloudData->specificSubscribers.Insert(packet->guid, packet->guid, true, _FILE_AND_LINE_);
681 }
682 }
683 else
684 {
685 ++cloudDataList->subscriberCount;
686 cloudDataList->nonSpecificSubscribers.Insert(packet->guid, packet->guid, true, _FILE_AND_LINE_);
687
688 // Remove packet->guid from CloudData::specificSubscribers among all instances of cloudDataList->keyData
689 unsigned int subscribedKeysIndex;
690 bool subscribedKeysIndexExists;
691 subscribedKeysIndex = remoteCloudClient->subscribedKeys.GetIndexFromKey(cloudDataList->key, &subscribedKeysIndexExists);
692 if (subscribedKeysIndexExists)
693 {
694 keySubscriberId = remoteCloudClient->subscribedKeys[subscribedKeysIndex];
695 for (specificSystemIndex=0; specificSystemIndex < keySubscriberId->specificSystemsSubscribedTo.Size(); specificSystemIndex++)
696 {
697 bool keyDataExists;
698 unsigned int keyDataIndex = cloudDataList->keyData.GetIndexFromKey(keySubscriberId->specificSystemsSubscribedTo[specificSystemIndex], &keyDataExists);
699 if (keyDataExists)
700 {
701 CloudData *keyData = cloudDataList->keyData[keyDataIndex];
702 keyData->specificSubscribers.Remove(packet->guid);
703 --cloudDataList->subscriberCount;
704 }
705 }
706 }
707 }
708 }
709
710 if (remoteCloudClient->subscribedKeys.Size()==0)
711 {
712 // Didn't do anything
713 remoteSystems.Remove(packet->guid, _FILE_AND_LINE_);
714 SLNet::OP_DELETE(remoteCloudClient, _FILE_AND_LINE_);
715 }
716 }
717
718 if (remoteServersWithData.Size()==0)
719 SLNet::OP_DELETE(getRequest, _FILE_AND_LINE_);
720 }
721 void CloudServer::OnUnsubscribeRequest(Packet *packet)
722 {
723 SLNet::BitStream bsIn(packet->data, packet->length, false);
724 bsIn.IgnoreBytes(sizeof(MessageID));
725
726 DataStructures::HashIndex remoteSystemIndex = remoteSystems.GetIndexOf(packet->guid);
727 if (remoteSystemIndex.IsInvalid()==true)
728 return;
729
730 RemoteCloudClient* remoteCloudClient = remoteSystems.ItemAtIndex(remoteSystemIndex);
731
732 uint16_t keyCount, specificSystemCount;
733 DataStructures::List<CloudKey> cloudKeys;
734 DataStructures::List<RakNetGUID> specificSystems;
735 uint16_t index;
736
737 CloudKey cloudKey;
738 bsIn.Read(keyCount);
739 for (index=0; index < keyCount; index++)
740 {
741 cloudKey.Serialize(false, &bsIn);
742 cloudKeys.Push(cloudKey, _FILE_AND_LINE_);
743 }
744
745 RakNetGUID specificSystem;
746 bsIn.Read(specificSystemCount);
747 for (index=0; index < specificSystemCount; index++)
748 {
749 bsIn.Read(specificSystem);
750 specificSystems.Push(specificSystem, _FILE_AND_LINE_);
751 }
752
753 for (unsigned int filterIndex=0; filterIndex < queryFilters.Size(); filterIndex++)
754 {
755 if (queryFilters[filterIndex]->OnUnsubscribeRequest(packet->guid, packet->systemAddress, cloudKeys, specificSystems )==false)
756 return;
757 }
758
759 // CloudDataList *cloudDataList;
760 bool dataRepositoryExists;
761 // unsigned int dataRepositoryIndex;
762
763 for (index=0; index < keyCount; index++)
764 {
765 cloudKey = cloudKeys[index];
766
767 // dataRepositoryIndex =
768 dataRepository.GetIndexFromKey(cloudKey, &dataRepositoryExists);
769 if (dataRepositoryExists==false)
770 continue;
771 // cloudDataList = dataRepository[dataRepositoryIndex];
772
773 unsigned int keySubscriberIndex;
774 bool hasKeySubscriber;
775 keySubscriberIndex = remoteCloudClient->subscribedKeys.GetIndexFromKey(cloudKey, &hasKeySubscriber);
776
777 if (hasKeySubscriber==false)
778 continue;
779
780 UnsubscribeFromKey(remoteCloudClient, packet->guid, keySubscriberIndex, cloudKey, specificSystems);
781 }
782
783 if (remoteCloudClient->IsUnused())
784 {
785 SLNet::OP_DELETE(remoteCloudClient, _FILE_AND_LINE_);
786 remoteSystems.RemoveAtIndex(remoteSystemIndex, _FILE_AND_LINE_);
787 }
788 }
789 void CloudServer::OnServerToServerGetRequest(Packet *packet)
790 {
791 // unsigned int remoteServerIndex;
792 bool objectExists;
793 //remoteServerIndex =
794 remoteServers.GetIndexFromKey(packet->guid, &objectExists);
795 if (objectExists==false)
796 return;
797
798 SLNet::BitStream bsIn(packet->data, packet->length, false);
799 bsIn.IgnoreBytes(sizeof(MessageID)*2);
800
801 CloudQueryWithAddresses cloudQueryWithAddresses;
802 uint32_t requestId;
803 cloudQueryWithAddresses.Serialize(false, &bsIn);
804 bsIn.Read(requestId);
805
806 DataStructures::List<CloudData*> cloudDataResultList;
807 DataStructures::List<CloudKey> cloudKeyResultList;
808 ProcessCloudQueryWithAddresses(cloudQueryWithAddresses, cloudDataResultList, cloudKeyResultList);
809
810 SLNet::BitStream bsOut;
811 bsOut.Write((MessageID)ID_CLOUD_SERVER_TO_SERVER_COMMAND);
812 bsOut.Write((MessageID)STSC_PROCESS_GET_RESPONSE);
813 bsOut.Write(requestId);
814 WriteCloudQueryRowFromResultList(cloudDataResultList, cloudKeyResultList, &bsOut);
815 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->guid, false);
816 }
817 void CloudServer::OnServerToServerGetResponse(Packet *packet)
818 {
819 unsigned int remoteServerIndex;
820 bool objectExists;
821 remoteServerIndex = remoteServers.GetIndexFromKey(packet->guid, &objectExists);
822 if (objectExists==false)
823 return;
824
825 RemoteServer *remoteServer = remoteServers[remoteServerIndex];
826 if (remoteServer==0)
827 return;
828
829 SLNet::BitStream bsIn(packet->data, packet->length, false);
830 bsIn.IgnoreBytes(sizeof(MessageID)*2);
831
832 uint32_t requestId;
833 bsIn.Read(requestId);
834
835 // Lookup request id
836 bool hasGetRequest;
837 unsigned int getRequestIndex;
838 getRequestIndex = getRequests.GetIndexFromKey(requestId, &hasGetRequest);
839 if (hasGetRequest==false)
840 return;
841 GetRequest *getRequest = getRequests[getRequestIndex];
842 bool hasRemoteServer;
843 unsigned int remoteServerResponsesIndex;
844 remoteServerResponsesIndex = getRequest->remoteServerResponses.GetIndexFromKey(packet->guid, &hasRemoteServer);
845 if (hasRemoteServer==false)
846 return;
847 BufferedGetResponseFromServer *bufferedGetResponseFromServer;
848 bufferedGetResponseFromServer = getRequest->remoteServerResponses[remoteServerResponsesIndex];
849 if (bufferedGetResponseFromServer->gotResult==true)
850 return;
851 bufferedGetResponseFromServer->gotResult=true;
852 uint32_t numRows;
853 bufferedGetResponseFromServer->queryResult.SerializeNumRows(false, numRows, &bsIn);
854 bufferedGetResponseFromServer->queryResult.SerializeCloudQueryRows(false, numRows, &bsIn, this);
855
856 // If all results returned, then also process locally, and return to user
857 if (getRequest->AllRemoteServersHaveResponded())
858 {
859 ProcessAndTransmitGetRequest(getRequest);
860
861 getRequest->Clear(this);
862 SLNet::OP_DELETE(getRequest, _FILE_AND_LINE_);
863
864 getRequests.RemoveAtIndex(getRequestIndex);
865 }
866 }
867 void CloudServer::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
868 {
869 (void) lostConnectionReason;
870 (void) systemAddress;
871
872 unsigned int remoteServerIndex;
873 bool objectExists;
874 remoteServerIndex = remoteServers.GetIndexFromKey(rakNetGUID, &objectExists);
875 if (objectExists)
876 {
877 // Update remoteServerResponses by removing this server and sending the response if it is now complete
878 unsigned int getRequestIndex=0;
879 while (getRequestIndex < getRequests.Size())
880 {
881 GetRequest *getRequest = getRequests[getRequestIndex];
882 bool waitingForThisServer;
883 unsigned int remoteServerResponsesIndex = getRequest->remoteServerResponses.GetIndexFromKey(rakNetGUID, &waitingForThisServer);
884 if (waitingForThisServer)
885 {
886 getRequest->remoteServerResponses[remoteServerResponsesIndex]->Clear(this);
887 SLNet::OP_DELETE(getRequest->remoteServerResponses[remoteServerResponsesIndex], _FILE_AND_LINE_);
888 getRequest->remoteServerResponses.RemoveAtIndex(remoteServerResponsesIndex);
889
890 if (getRequest->AllRemoteServersHaveResponded())
891 {
892 ProcessAndTransmitGetRequest(getRequest);
893 getRequest->Clear(this);
894 SLNet::OP_DELETE(getRequest, _FILE_AND_LINE_);
895
896 getRequests.RemoveAtIndex(getRequestIndex);
897 }
898 else
899 getRequestIndex++;
900 }
901 else
902 getRequestIndex++;
903 }
904
905 SLNet::OP_DELETE(remoteServers[remoteServerIndex],_FILE_AND_LINE_);
906 remoteServers.RemoveAtIndex(remoteServerIndex);
907 }
908
909 DataStructures::HashIndex remoteSystemIndex = remoteSystems.GetIndexOf(rakNetGUID);
910 if (remoteSystemIndex.IsInvalid()==false)
911 {
912 RemoteCloudClient* remoteCloudClient = remoteSystems.ItemAtIndex(remoteSystemIndex);
913 unsigned int uploadedKeysIndex;
914 for (uploadedKeysIndex=0; uploadedKeysIndex < remoteCloudClient->uploadedKeys.Size(); uploadedKeysIndex++)
915 {
916 // Delete keys this system has uploaded
917 bool keyDataRepositoryExists;
918 unsigned int dataRepositoryIndex = dataRepository.GetIndexFromKey(remoteCloudClient->uploadedKeys[uploadedKeysIndex], &keyDataRepositoryExists);
919 if (keyDataRepositoryExists)
920 {
921 CloudDataList* cloudDataList = dataRepository[dataRepositoryIndex];
922 bool keyDataExists;
923 unsigned int keyDataIndex = cloudDataList->keyData.GetIndexFromKey(rakNetGUID, &keyDataExists);
924 if (keyDataExists)
925 {
926 CloudData *cloudData = cloudDataList->keyData[keyDataIndex];
927 cloudDataList->uploaderCount--;
928
929 NotifyClientSubscribersOfDataChange(cloudData, cloudDataList->key, cloudData->specificSubscribers, false );
930 NotifyClientSubscribersOfDataChange(cloudData, cloudDataList->key, cloudDataList->nonSpecificSubscribers, false );
931 NotifyServerSubscribersOfDataChange(cloudData, cloudDataList->key, false );
932
933 cloudData->Clear();
934
935 if (cloudData->IsUnused())
936 {
937 SLNet::OP_DELETE(cloudData,_FILE_AND_LINE_);
938 cloudDataList->keyData.RemoveAtIndex(keyDataIndex);
939
940 if (cloudDataList->IsNotUploaded())
941 {
942 // Tell other servers that this key is no longer uploaded, so they do not request it from us
943 RemoveUploadedKeyFromServers(cloudDataList->key);
944 }
945
946 if (cloudDataList->IsUnused())
947 {
948 // Tell other servers that this key is no longer uploaded, so they do not request it from us
949 RemoveUploadedKeyFromServers(cloudDataList->key);
950
951 SLNet::OP_DELETE(cloudDataList, _FILE_AND_LINE_);
952 dataRepository.RemoveAtIndex(dataRepositoryIndex);
953 }
954 }
955 }
956 }
957 }
958
959 unsigned int subscribedKeysIndex;
960 for (subscribedKeysIndex=0; subscribedKeysIndex < remoteCloudClient->subscribedKeys.Size(); subscribedKeysIndex++)
961 {
962 KeySubscriberID* keySubscriberId;
963 keySubscriberId = remoteCloudClient->subscribedKeys[subscribedKeysIndex];
964
965 bool keyDataRepositoryExists;
966 unsigned int keyDataRepositoryIndex = dataRepository.GetIndexFromKey(remoteCloudClient->subscribedKeys[subscribedKeysIndex]->key, &keyDataRepositoryExists);
967 if (keyDataRepositoryExists)
968 {
969 CloudDataList* cloudDataList = dataRepository[keyDataRepositoryIndex];
970 if (keySubscriberId->specificSystemsSubscribedTo.Size()==0)
971 {
972 cloudDataList->nonSpecificSubscribers.Remove(rakNetGUID);
973 --cloudDataList->subscriberCount;
974 }
975 else
976 {
977 unsigned int specificSystemIndex;
978 for (specificSystemIndex=0; specificSystemIndex < keySubscriberId->specificSystemsSubscribedTo.Size(); specificSystemIndex++)
979 {
980 bool keyDataExists;
981 unsigned int keyDataIndex = cloudDataList->keyData.GetIndexFromKey(keySubscriberId->specificSystemsSubscribedTo[specificSystemIndex], &keyDataExists);
982 if (keyDataExists)
983 {
984 CloudData *keyData = cloudDataList->keyData[keyDataIndex];
985 keyData->specificSubscribers.Remove(rakNetGUID);
986 --cloudDataList->subscriberCount;
987 }
988 }
989 }
990 }
991
992 SLNet::OP_DELETE(keySubscriberId, _FILE_AND_LINE_);
993 }
994
995 // Delete and remove from remoteSystems
996 SLNet::OP_DELETE(remoteCloudClient, _FILE_AND_LINE_);
997 remoteSystems.RemoveAtIndex(remoteSystemIndex, _FILE_AND_LINE_);
998 }
999 }
1000 void CloudServer::OnRakPeerShutdown(void)
1001 {
1002 Clear();
1003 }
1004 void CloudServer::Clear(void)
1005 {
1006 unsigned int i,j;
1007 for (i=0; i < dataRepository.Size(); i++)
1008 {
1009 CloudDataList *cloudDataList = dataRepository[i];
1010 for (j=0; j < cloudDataList->keyData.Size(); j++)
1011 {
1012 cloudDataList->keyData[j]->Clear();
1013 SLNet::OP_DELETE(cloudDataList->keyData[j], _FILE_AND_LINE_);
1014 }
1015 SLNet::OP_DELETE(cloudDataList, _FILE_AND_LINE_);
1016 }
1017 dataRepository.Clear(false, _FILE_AND_LINE_);
1018
1019 for (i=0; i < remoteServers.Size(); i++)
1020 {
1021 SLNet::OP_DELETE(remoteServers[i], _FILE_AND_LINE_);
1022 }
1023 remoteServers.Clear(false, _FILE_AND_LINE_);
1024
1025 for (i=0; i < getRequests.Size(); i++)
1026 {
1027 GetRequest *getRequest = getRequests[i];
1028 getRequest->Clear(this);
1029 SLNet::OP_DELETE(getRequests[i], _FILE_AND_LINE_);
1030 }
1031 getRequests.Clear(false, _FILE_AND_LINE_);
1032
1033 DataStructures::List<RakNetGUID> keyList;
1034 DataStructures::List<RemoteCloudClient*> itemList;
1035 remoteSystems.GetAsList(itemList, keyList, _FILE_AND_LINE_);
1036 for (i=0; i < itemList.Size(); i++)
1037 {
1038 RemoteCloudClient* remoteCloudClient = itemList[i];
1039 for (j=0; j < remoteCloudClient->subscribedKeys.Size(); j++)
1040 {
1041 SLNet::OP_DELETE(remoteCloudClient->subscribedKeys[j], _FILE_AND_LINE_);
1042 }
1043 SLNet::OP_DELETE(remoteCloudClient, _FILE_AND_LINE_);
1044 }
1045 remoteSystems.Clear(_FILE_AND_LINE_);
1046 }
1047 void CloudServer::WriteCloudQueryRowFromResultList(DataStructures::List<CloudData*> &cloudDataResultList, DataStructures::List<CloudKey> &cloudKeyResultList, BitStream *bsOut)
1048 {
1049 bsOut->WriteCasted<uint32_t>(cloudKeyResultList.Size());
1050 unsigned int i;
1051 for (i=0; i < cloudKeyResultList.Size(); i++)
1052 {
1053 WriteCloudQueryRowFromResultList(i, cloudDataResultList, cloudKeyResultList, bsOut);
1054 }
1055 }
1056 void CloudServer::WriteCloudQueryRowFromResultList(unsigned int i, DataStructures::List<CloudData*> &cloudDataResultList, DataStructures::List<CloudKey> &cloudKeyResultList, BitStream *bsOut)
1057 {
1058 CloudQueryRow cloudQueryRow;
1059 CloudData *cloudData = cloudDataResultList[i];
1060 cloudQueryRow.key=cloudKeyResultList[i];
1061 cloudQueryRow.data=cloudData->dataPtr;
1062 cloudQueryRow.length=cloudData->dataLengthBytes;
1063 cloudQueryRow.serverSystemAddress=cloudData->serverSystemAddress;
1064 cloudQueryRow.clientSystemAddress=cloudData->clientSystemAddress;
1065 cloudQueryRow.serverGUID=cloudData->serverGUID;
1066 cloudQueryRow.clientGUID=cloudData->clientGUID;
1067 cloudQueryRow.Serialize(true, bsOut, 0);
1068 }
1069 void CloudServer::NotifyClientSubscribersOfDataChange( CloudData *cloudData, CloudKey &key, DataStructures::OrderedList<RakNetGUID, RakNetGUID> &subscribers, bool wasUpdated )
1070 {
1071 SLNet::BitStream bsOut;
1072 bsOut.Write((MessageID) ID_CLOUD_SUBSCRIPTION_NOTIFICATION);
1073 bsOut.Write(wasUpdated);
1074 CloudQueryRow row;
1075 row.key=key;
1076 row.data=cloudData->dataPtr;
1077 row.length=cloudData->dataLengthBytes;
1078 row.serverSystemAddress=cloudData->serverSystemAddress;
1079 row.clientSystemAddress=cloudData->clientSystemAddress;
1080 row.serverGUID=cloudData->serverGUID;
1081 row.clientGUID=cloudData->clientGUID;
1082 row.Serialize(true,&bsOut,0);
1083
1084 unsigned int i;
1085 for (i=0; i < subscribers.Size(); i++)
1086 {
1087 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, subscribers[i], false);
1088 }
1089 }
1090 void CloudServer::NotifyClientSubscribersOfDataChange( CloudQueryRow *row, DataStructures::OrderedList<RakNetGUID, RakNetGUID> &subscribers, bool wasUpdated )
1091 {
1092 SLNet::BitStream bsOut;
1093 bsOut.Write((MessageID) ID_CLOUD_SUBSCRIPTION_NOTIFICATION);
1094 bsOut.Write(wasUpdated);
1095 row->Serialize(true,&bsOut,0);
1096
1097 unsigned int i;
1098 for (i=0; i < subscribers.Size(); i++)
1099 {
1100 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, subscribers[i], false);
1101 }
1102 }
1103 void CloudServer::NotifyServerSubscribersOfDataChange( CloudData *cloudData, CloudKey &key, bool wasUpdated )
1104 {
1105 // Find every server that has subscribed
1106 // Send them change notifications
1107 SLNet::BitStream bsOut;
1108 bsOut.Write((MessageID)ID_CLOUD_SERVER_TO_SERVER_COMMAND);
1109 bsOut.Write((MessageID)STSC_DATA_CHANGED);
1110 bsOut.Write(wasUpdated);
1111 CloudQueryRow row;
1112 row.key=key;
1113 row.data=cloudData->dataPtr;
1114 row.length=cloudData->dataLengthBytes;
1115 row.serverSystemAddress=cloudData->serverSystemAddress;
1116 row.clientSystemAddress=cloudData->clientSystemAddress;
1117 row.serverGUID=cloudData->serverGUID;
1118 row.clientGUID=cloudData->clientGUID;
1119 row.Serialize(true,&bsOut,0);
1120
1121 unsigned int i;
1122 for (i=0; i < remoteServers.Size(); i++)
1123 {
1124 if (remoteServers[i]->gotSubscribedAndUploadedKeys==false || remoteServers[i]->subscribedKeys.HasData(key))
1125 {
1126 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, remoteServers[i]->serverAddress, false);
1127 }
1128 }
1129 }
1130 void CloudServer::AddServer(RakNetGUID systemIdentifier)
1131 {
1132 ConnectionState cs = rakPeerInterface->GetConnectionState(systemIdentifier);
1133 if (cs==IS_DISCONNECTED || cs==IS_NOT_CONNECTED)
1134 return;
1135 bool objectExists;
1136 unsigned int index = remoteServers.GetIndexFromKey(systemIdentifier,&objectExists);
1137 if (objectExists==false)
1138 {
1139 RemoteServer *remoteServer = SLNet::OP_NEW<RemoteServer>(_FILE_AND_LINE_);
1140 remoteServer->gotSubscribedAndUploadedKeys=false;
1141 remoteServer->serverAddress=systemIdentifier;
1142 remoteServers.InsertAtIndex(remoteServer, index, _FILE_AND_LINE_);
1143
1144 SendUploadedAndSubscribedKeysToServer(systemIdentifier);
1145 }
1146 }
1147 void CloudServer::RemoveServer(RakNetGUID systemAddress)
1148 {
1149 bool objectExists;
1150 unsigned int index = remoteServers.GetIndexFromKey(systemAddress,&objectExists);
1151 if (objectExists==true)
1152 {
1153 SLNet::OP_DELETE(remoteServers[index],_FILE_AND_LINE_);
1154 remoteServers.RemoveAtIndex(index);
1155 }
1156 }
1157 void CloudServer::GetRemoteServers(DataStructures::List<RakNetGUID> &remoteServersOut)
1158 {
1159 remoteServersOut.Clear(true, _FILE_AND_LINE_);
1160
1161 unsigned int i;
1162 for (i=0; i < remoteServers.Size(); i++)
1163 {
1164 remoteServersOut.Push(remoteServers[i]->serverAddress, _FILE_AND_LINE_);
1165 }
1166 }
1167 void CloudServer::ProcessAndTransmitGetRequest(GetRequest *getRequest)
1168 {
1169 SLNet::BitStream bsOut;
1170 bsOut.Write((MessageID) ID_CLOUD_GET_RESPONSE);
1171
1172 // BufferedGetResponseFromServer getResponse;
1173 CloudQueryResult cloudQueryResult;
1174 cloudQueryResult.cloudQuery=getRequest->cloudQueryWithAddresses.cloudQuery;
1175 cloudQueryResult.subscribeToResults=getRequest->cloudQueryWithAddresses.cloudQuery.subscribeToResults;
1176 cloudQueryResult.SerializeHeader(true, &bsOut);
1177
1178 DataStructures::List<CloudData*> cloudDataResultList;
1179 DataStructures::List<CloudKey> cloudKeyResultList;
1180 ProcessCloudQueryWithAddresses(getRequest->cloudQueryWithAddresses, cloudDataResultList, cloudKeyResultList);
1181 bool unlimitedRows=getRequest->cloudQueryWithAddresses.cloudQuery.maxRowsToReturn==0;
1182
1183 uint32_t localNumRows = (uint32_t) cloudDataResultList.Size();
1184 if (unlimitedRows==false &&
1185 localNumRows > getRequest->cloudQueryWithAddresses.cloudQuery.startingRowIndex &&
1186 localNumRows - getRequest->cloudQueryWithAddresses.cloudQuery.startingRowIndex > getRequest->cloudQueryWithAddresses.cloudQuery.maxRowsToReturn )
1187 localNumRows=getRequest->cloudQueryWithAddresses.cloudQuery.startingRowIndex + getRequest->cloudQueryWithAddresses.cloudQuery.maxRowsToReturn;
1188
1189 BitSize_t bitStreamOffset = bsOut.GetWriteOffset();
1190 uint32_t localRowsToWrite;
1191 unsigned int skipRows;
1192 if (localNumRows>getRequest->cloudQueryWithAddresses.cloudQuery.startingRowIndex)
1193 {
1194 localRowsToWrite=localNumRows-getRequest->cloudQueryWithAddresses.cloudQuery.startingRowIndex;
1195 skipRows=0;
1196 }
1197 else
1198 {
1199 localRowsToWrite=0;
1200 skipRows=getRequest->cloudQueryWithAddresses.cloudQuery.startingRowIndex-localNumRows;
1201 }
1202 cloudQueryResult.SerializeNumRows(true, localRowsToWrite, &bsOut);
1203 for (unsigned int i=getRequest->cloudQueryWithAddresses.cloudQuery.startingRowIndex; i < localNumRows; i++)
1204 {
1205 WriteCloudQueryRowFromResultList(i, cloudDataResultList, cloudKeyResultList, &bsOut);
1206 }
1207
1208 // Append remote systems for remaining rows
1209 if (unlimitedRows==true || getRequest->cloudQueryWithAddresses.cloudQuery.maxRowsToReturn>localRowsToWrite)
1210 {
1211 uint32_t remainingRows=0;
1212 uint32_t additionalRowsWritten=0;
1213 if (unlimitedRows==false)
1214 remainingRows=getRequest->cloudQueryWithAddresses.cloudQuery.maxRowsToReturn-localRowsToWrite;
1215
1216 unsigned int remoteServerResponseIndex;
1217 for (remoteServerResponseIndex=0; remoteServerResponseIndex < getRequest->remoteServerResponses.Size(); remoteServerResponseIndex++)
1218 {
1219 BufferedGetResponseFromServer *bufferedGetResponseFromServer = getRequest->remoteServerResponses[remoteServerResponseIndex];
1220 unsigned int cloudQueryRowIndex;
1221 for (cloudQueryRowIndex=0; cloudQueryRowIndex < bufferedGetResponseFromServer->queryResult.rowsReturned.Size(); cloudQueryRowIndex++)
1222 {
1223 if (skipRows>0)
1224 {
1225 --skipRows;
1226 continue;
1227 }
1228 bufferedGetResponseFromServer->queryResult.rowsReturned[cloudQueryRowIndex]->Serialize(true, &bsOut, this);
1229
1230 ++additionalRowsWritten;
1231 if (unlimitedRows==false && --remainingRows==0)
1232 break;
1233 }
1234
1235 if (unlimitedRows==false && remainingRows==0)
1236 break;
1237 }
1238
1239 if (additionalRowsWritten>0)
1240 {
1241 BitSize_t curOffset = bsOut.GetWriteOffset();
1242 bsOut.SetWriteOffset(bitStreamOffset);
1243 localRowsToWrite+=additionalRowsWritten;
1244 cloudQueryResult.SerializeNumRows(true, localRowsToWrite, &bsOut);
1245 bsOut.SetWriteOffset(curOffset);
1246 }
1247 }
1248
1249 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, getRequest->requestingClient, false);
1250 }
1251 void CloudServer::ProcessCloudQueryWithAddresses( CloudServer::CloudQueryWithAddresses &cloudQueryWithAddresses, DataStructures::List<CloudData*> &cloudDataResultList, DataStructures::List<CloudKey> &cloudKeyResultList )
1252 {
1253 CloudQueryResult cloudQueryResult;
1254 CloudQueryRow cloudQueryRow;
1255 unsigned int queryIndex;
1256 bool dataRepositoryExists;
1257 CloudDataList* cloudDataList;
1258 unsigned int keyDataIndex;
1259
1260 // If specificSystems list empty, applies to all systems
1261 // For each of keys in cloudQueryWithAddresses, return that data, limited by maxRowsToReturn
1262 for (queryIndex=0; queryIndex < cloudQueryWithAddresses.cloudQuery.keys.Size(); queryIndex++)
1263 {
1264 const CloudKey &key = cloudQueryWithAddresses.cloudQuery.keys[queryIndex];
1265
1266 unsigned int dataRepositoryIndex = dataRepository.GetIndexFromKey(key, &dataRepositoryExists);
1267 if (dataRepositoryExists)
1268 {
1269 cloudDataList=dataRepository[dataRepositoryIndex];
1270
1271 if (cloudDataList->uploaderCount>0)
1272 {
1273 // Return all keyData that was uploaded by specificSystems, or all if not specified
1274 if (cloudQueryWithAddresses.specificSystems.Size()>0)
1275 {
1276 // Return data for matching systems
1277 unsigned int specificSystemIndex;
1278 for (specificSystemIndex=0; specificSystemIndex < cloudQueryWithAddresses.specificSystems.Size(); specificSystemIndex++)
1279 {
1280 bool uploaderExists;
1281 keyDataIndex = cloudDataList->keyData.GetIndexFromKey(cloudQueryWithAddresses.specificSystems[specificSystemIndex], &uploaderExists);
1282 if (uploaderExists)
1283 {
1284 cloudDataResultList.Push(cloudDataList->keyData[keyDataIndex], _FILE_AND_LINE_);
1285 cloudKeyResultList.Push(key, _FILE_AND_LINE_);
1286 }
1287 }
1288 }
1289 else
1290 {
1291 // Return data for all systems
1292 for (keyDataIndex=0; keyDataIndex < cloudDataList->keyData.Size(); keyDataIndex++)
1293 {
1294 cloudDataResultList.Push(cloudDataList->keyData[keyDataIndex], _FILE_AND_LINE_);
1295 cloudKeyResultList.Push(key, _FILE_AND_LINE_);
1296 }
1297 }
1298 }
1299 }
1300 }
1301 }
1302 void CloudServer::SendUploadedAndSubscribedKeysToServer( RakNetGUID systemAddress )
1303 {
1304 SLNet::BitStream bsOut;
1305 bsOut.Write((MessageID)ID_CLOUD_SERVER_TO_SERVER_COMMAND);
1306 bsOut.Write((MessageID)STSC_ADD_UPLOADED_AND_SUBSCRIBED_KEYS);
1307 bsOut.WriteCasted<uint16_t>(dataRepository.Size());
1308 for (unsigned int i=0; i < dataRepository.Size(); i++)
1309 dataRepository[i]->key.Serialize(true, &bsOut);
1310
1311 BitSize_t startOffset, endOffset;
1312 uint16_t subscribedKeyCount=0;
1313 startOffset=bsOut.GetWriteOffset();
1314 bsOut.WriteCasted<uint16_t>(subscribedKeyCount);
1315 for (unsigned int i=0; i < dataRepository.Size(); i++)
1316 {
1317 if (dataRepository[i]->subscriberCount>0)
1318 {
1319 dataRepository[i]->key.Serialize(true, &bsOut);
1320 subscribedKeyCount++;
1321 }
1322 }
1323 endOffset=bsOut.GetWriteOffset();
1324 bsOut.SetWriteOffset(startOffset);
1325 bsOut.WriteCasted<uint16_t>(subscribedKeyCount);
1326 bsOut.SetWriteOffset(endOffset);
1327
1328 if (dataRepository.Size()>0 || subscribedKeyCount>0)
1329 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemAddress, false);
1330 }
1331 void CloudServer::SendUploadedKeyToServers( CloudKey &cloudKey )
1332 {
1333 SLNet::BitStream bsOut;
1334 bsOut.Write((MessageID)ID_CLOUD_SERVER_TO_SERVER_COMMAND);
1335 bsOut.Write((MessageID)STSC_ADD_UPLOADED_KEY);
1336 cloudKey.Serialize(true, &bsOut);
1337 for (unsigned int i=0; i < remoteServers.Size(); i++)
1338 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, remoteServers[i]->serverAddress, false);
1339 }
1340 void CloudServer::SendSubscribedKeyToServers( CloudKey &cloudKey )
1341 {
1342 SLNet::BitStream bsOut;
1343 bsOut.Write((MessageID)ID_CLOUD_SERVER_TO_SERVER_COMMAND);
1344 bsOut.Write((MessageID)STSC_ADD_SUBSCRIBED_KEY);
1345 cloudKey.Serialize(true, &bsOut);
1346 for (unsigned int i=0; i < remoteServers.Size(); i++)
1347 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, remoteServers[i]->serverAddress, false);
1348 }
1349 void CloudServer::RemoveUploadedKeyFromServers( CloudKey &cloudKey )
1350 {
1351 SLNet::BitStream bsOut;
1352 bsOut.Write((MessageID)ID_CLOUD_SERVER_TO_SERVER_COMMAND);
1353 bsOut.Write((MessageID)STSC_REMOVE_UPLOADED_KEY);
1354 cloudKey.Serialize(true, &bsOut);
1355 for (unsigned int i=0; i < remoteServers.Size(); i++)
1356 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, remoteServers[i]->serverAddress, false);
1357 }
1358 void CloudServer::RemoveSubscribedKeyFromServers( CloudKey &cloudKey )
1359 {
1360 SLNet::BitStream bsOut;
1361 bsOut.Write((MessageID)ID_CLOUD_SERVER_TO_SERVER_COMMAND);
1362 bsOut.Write((MessageID)STSC_REMOVE_SUBSCRIBED_KEY);
1363 cloudKey.Serialize(true, &bsOut);
1364 for (unsigned int i=0; i < remoteServers.Size(); i++)
1365 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, remoteServers[i]->serverAddress, false);
1366 }
1367 void CloudServer::OnSendUploadedAndSubscribedKeysToServer( Packet *packet )
1368 {
1369 SLNet::BitStream bsIn(packet->data, packet->length, false);
1370 bsIn.IgnoreBytes(sizeof(MessageID)*2);
1371
1372 bool objectExists;
1373 unsigned int index = remoteServers.GetIndexFromKey(packet->guid,&objectExists);
1374 if (objectExists==false)
1375 return;
1376 RemoteServer *remoteServer = remoteServers[index];
1377 remoteServer->gotSubscribedAndUploadedKeys=true;
1378
1379 // unsigned int insertionIndex;
1380 bool alreadyHasKey;
1381 uint16_t numUploadedKeys, numSubscribedKeys;
1382 bsIn.Read(numUploadedKeys);
1383 for (uint16_t i=0; i < numUploadedKeys; i++)
1384 {
1385 CloudKey cloudKey;
1386 cloudKey.Serialize(false, &bsIn);
1387
1388 // insertionIndex =
1389 remoteServer->uploadedKeys.GetIndexFromKey(cloudKey, &alreadyHasKey);
1390 if (alreadyHasKey==false)
1391 remoteServer->uploadedKeys.Insert(cloudKey,cloudKey,true,_FILE_AND_LINE_);
1392 }
1393
1394 bsIn.Read(numSubscribedKeys);
1395 for (uint16_t i=0; i < numSubscribedKeys; i++)
1396 {
1397 CloudKey cloudKey;
1398 cloudKey.Serialize(false, &bsIn);
1399
1400 //insertionIndex =
1401 remoteServer->subscribedKeys.GetIndexFromKey(cloudKey, &alreadyHasKey);
1402 if (alreadyHasKey==false)
1403 remoteServer->subscribedKeys.Insert(cloudKey,cloudKey,true,_FILE_AND_LINE_);
1404 }
1405
1406 // Potential todo - join servers
1407 // For each uploaded key that we subscribe to, query it
1408 // For each subscribed key that we have, send it
1409 }
1410 void CloudServer::OnSendUploadedKeyToServers( Packet *packet )
1411 {
1412 SLNet::BitStream bsIn(packet->data, packet->length, false);
1413 bsIn.IgnoreBytes(sizeof(MessageID)*2);
1414
1415 bool objectExists;
1416 unsigned int index = remoteServers.GetIndexFromKey(packet->guid,&objectExists);
1417 if (objectExists==false)
1418 return;
1419 RemoteServer *remoteServer = remoteServers[index];
1420 CloudKey cloudKey;
1421 cloudKey.Serialize(false, &bsIn);
1422 // unsigned int insertionIndex;
1423 bool alreadyHasKey;
1424 // insertionIndex =
1425 remoteServer->uploadedKeys.GetIndexFromKey(cloudKey, &alreadyHasKey);
1426 if (alreadyHasKey==false)
1427 remoteServer->uploadedKeys.Insert(cloudKey,cloudKey,true,_FILE_AND_LINE_);
1428 }
1429 void CloudServer::OnSendSubscribedKeyToServers( Packet *packet )
1430 {
1431 SLNet::BitStream bsIn(packet->data, packet->length, false);
1432 bsIn.IgnoreBytes(sizeof(MessageID)*2);
1433
1434 bool objectExists;
1435 unsigned int index = remoteServers.GetIndexFromKey(packet->guid,&objectExists);
1436 if (objectExists==false)
1437 return;
1438 RemoteServer *remoteServer = remoteServers[index];
1439 CloudKey cloudKey;
1440 cloudKey.Serialize(false, &bsIn);
1441 // unsigned int insertionIndex;
1442 bool alreadyHasKey;
1443 // insertionIndex =
1444 remoteServer->subscribedKeys.GetIndexFromKey(cloudKey, &alreadyHasKey);
1445
1446 // Do not need to send current values, the Get request will do that as the Get request is sent at the same time
1447 if (alreadyHasKey==false)
1448 remoteServer->subscribedKeys.Insert(cloudKey,cloudKey,true,_FILE_AND_LINE_);
1449 }
1450 void CloudServer::OnRemoveUploadedKeyFromServers( Packet *packet )
1451 {
1452 SLNet::BitStream bsIn(packet->data, packet->length, false);
1453 bsIn.IgnoreBytes(sizeof(MessageID)*2);
1454
1455 bool objectExists;
1456 unsigned int index = remoteServers.GetIndexFromKey(packet->guid,&objectExists);
1457 if (objectExists==false)
1458 return;
1459 RemoteServer *remoteServer = remoteServers[index];
1460 CloudKey cloudKey;
1461 cloudKey.Serialize(false, &bsIn);
1462 unsigned int insertionIndex;
1463 bool alreadyHasKey;
1464 insertionIndex = remoteServer->uploadedKeys.GetIndexFromKey(cloudKey, &alreadyHasKey);
1465 if (alreadyHasKey==true)
1466 remoteServer->uploadedKeys.RemoveAtIndex(insertionIndex);
1467 }
1468 void CloudServer::OnRemoveSubscribedKeyFromServers( Packet *packet )
1469 {
1470 SLNet::BitStream bsIn(packet->data, packet->length, false);
1471 bsIn.IgnoreBytes(sizeof(MessageID)*2);
1472
1473 bool objectExists;
1474 unsigned int index = remoteServers.GetIndexFromKey(packet->guid,&objectExists);
1475 if (objectExists==false)
1476 return;
1477 RemoteServer *remoteServer = remoteServers[index];
1478 CloudKey cloudKey;
1479 cloudKey.Serialize(false, &bsIn);
1480 unsigned int insertionIndex;
1481 bool alreadyHasKey;
1482 insertionIndex = remoteServer->subscribedKeys.GetIndexFromKey(cloudKey, &alreadyHasKey);
1483 if (alreadyHasKey==true)
1484 remoteServer->subscribedKeys.RemoveAtIndex(insertionIndex);
1485 }
1486 void CloudServer::OnServerDataChanged( Packet *packet )
1487 {
1488 SLNet::BitStream bsIn(packet->data, packet->length, false);
1489 bsIn.IgnoreBytes(sizeof(MessageID)*2);
1490
1491 bool objectExists;
1492 remoteServers.GetIndexFromKey(packet->guid,&objectExists);
1493 if (objectExists==false)
1494 return;
1495
1496 // Find everyone that cares about this change and relay
1497 bool wasUpdated=false;
1498 bsIn.Read(wasUpdated);
1499 CloudQueryRow row;
1500 row.Serialize(false, &bsIn, this);
1501
1502 CloudDataList *cloudDataList;
1503 bool dataRepositoryExists;
1504 unsigned int dataRepositoryIndex;
1505 dataRepositoryIndex = dataRepository.GetIndexFromKey(row.key, &dataRepositoryExists);
1506 if (dataRepositoryExists==false)
1507 {
1508 DeallocateRowData(row.data);
1509 return;
1510 }
1511 cloudDataList = dataRepository[dataRepositoryIndex];
1512 CloudData *cloudData;
1513 bool keyDataListExists;
1514 unsigned int keyDataListIndex = cloudDataList->keyData.GetIndexFromKey(row.clientGUID, &keyDataListExists);
1515 if (keyDataListExists==true)
1516 {
1517 cloudData = cloudDataList->keyData[keyDataListIndex];
1518 NotifyClientSubscribersOfDataChange(&row, cloudData->specificSubscribers, wasUpdated );
1519 }
1520
1521 NotifyClientSubscribersOfDataChange(&row, cloudDataList->nonSpecificSubscribers, wasUpdated );
1522 DeallocateRowData(row.data);
1523 }
1524 void CloudServer::GetServersWithUploadedKeys(
1525 DataStructures::List<CloudKey> &keys,
1526 DataStructures::List<CloudServer::RemoteServer*> &remoteServersWithData
1527 )
1528 {
1529 remoteServersWithData.Clear(true, _FILE_AND_LINE_);
1530
1531 unsigned int i,j;
1532 for (i=0; i < remoteServers.Size(); i++)
1533 {
1534 remoteServers[i]->workingFlag=false;
1535 }
1536
1537 for (i=0; i < remoteServers.Size(); i++)
1538 {
1539 if (remoteServers[i]->workingFlag==false)
1540 {
1541 if (remoteServers[i]->gotSubscribedAndUploadedKeys==false)
1542 {
1543 remoteServers[i]->workingFlag=true;
1544 remoteServersWithData.Push(remoteServers[i], _FILE_AND_LINE_);
1545 }
1546 else
1547 {
1548 remoteServers[i]->workingFlag=false;
1549 for (j=0; j < keys.Size(); j++)
1550 {
1551 if (remoteServers[i]->workingFlag==false && remoteServers[i]->uploadedKeys.HasData(keys[j]))
1552 {
1553 remoteServers[i]->workingFlag=true;
1554 remoteServersWithData.Push(remoteServers[i], _FILE_AND_LINE_);
1555 break;
1556 }
1557 }
1558 }
1559 }
1560 }
1561 }
1562
1563 CloudServer::CloudDataList *CloudServer::GetOrAllocateCloudDataList(CloudKey key, bool *dataRepositoryExists, unsigned int &dataRepositoryIndex)
1564 {
1565 CloudDataList *cloudDataList;
1566
1567 dataRepositoryIndex = dataRepository.GetIndexFromKey(key, dataRepositoryExists);
1568 if (*dataRepositoryExists==false)
1569 {
1570 cloudDataList = SLNet::OP_NEW<CloudDataList>(_FILE_AND_LINE_);
1571 cloudDataList->key=key;
1572 cloudDataList->uploaderCount=0;
1573 cloudDataList->subscriberCount=0;
1574 dataRepository.InsertAtIndex(cloudDataList,dataRepositoryIndex,_FILE_AND_LINE_);
1575 }
1576 else
1577 {
1578 cloudDataList = dataRepository[dataRepositoryIndex];
1579 }
1580
1581 return cloudDataList;
1582 }
1583
1584 void CloudServer::UnsubscribeFromKey(RemoteCloudClient *remoteCloudClient, RakNetGUID remoteCloudClientGuid, unsigned int keySubscriberIndex, CloudKey &cloudKey, DataStructures::List<RakNetGUID> &specificSystems)
1585 {
1586 KeySubscriberID* keySubscriberId = remoteCloudClient->subscribedKeys[keySubscriberIndex];
1587
1588 // If removing specific systems, but global subscription, fail
1589 if (keySubscriberId->specificSystemsSubscribedTo.Size()==0 && specificSystems.Size()>0)
1590 return;
1591
1592 bool dataRepositoryExists;
1593 CloudDataList *cloudDataList;
1594 unsigned int dataRepositoryIndex = dataRepository.GetIndexFromKey(cloudKey, &dataRepositoryExists);
1595 if (dataRepositoryExists==false)
1596 return;
1597
1598 unsigned int i,j;
1599
1600 cloudDataList = dataRepository[dataRepositoryIndex];
1601 if (specificSystems.Size()==0)
1602 {
1603 // Remove global subscriber. If returns false, have to remove specific subscribers
1604 if (cloudDataList->RemoveSubscriber(remoteCloudClientGuid)==false)
1605 {
1606 for (i=0; i < keySubscriberId->specificSystemsSubscribedTo.Size(); i++)
1607 {
1608 RemoveSpecificSubscriber(keySubscriberId->specificSystemsSubscribedTo[i], cloudDataList, remoteCloudClientGuid);
1609 }
1610 }
1611 keySubscriberId->specificSystemsSubscribedTo.Clear(true, _FILE_AND_LINE_);
1612 }
1613 else
1614 {
1615 for (j=0; j < specificSystems.Size(); j++)
1616 {
1617 unsigned int specificSystemsSubscribedToIndex;
1618 bool hasSpecificSystemsSubscribedTo;
1619 specificSystemsSubscribedToIndex=keySubscriberId->specificSystemsSubscribedTo.GetIndexFromKey(specificSystems[j], &hasSpecificSystemsSubscribedTo);
1620 if (hasSpecificSystemsSubscribedTo)
1621 {
1622 RemoveSpecificSubscriber(specificSystems[j], cloudDataList, remoteCloudClientGuid);
1623 keySubscriberId->specificSystemsSubscribedTo.RemoveAtIndex(specificSystemsSubscribedToIndex);
1624 }
1625 }
1626 }
1627
1628 if (keySubscriberId->specificSystemsSubscribedTo.Size()==0)
1629 {
1630 SLNet::OP_DELETE(keySubscriberId, _FILE_AND_LINE_);
1631 remoteCloudClient->subscribedKeys.RemoveAtIndex(keySubscriberIndex);
1632 }
1633
1634 if (cloudDataList->subscriberCount==0)
1635 RemoveSubscribedKeyFromServers(cloudKey);
1636
1637 if (cloudDataList->IsUnused())
1638 {
1639 SLNet::OP_DELETE(cloudDataList, _FILE_AND_LINE_);
1640 dataRepository.RemoveAtIndex(dataRepositoryIndex);
1641 }
1642 }
1643 void CloudServer::RemoveSpecificSubscriber(RakNetGUID specificSubscriber, CloudDataList *cloudDataList, RakNetGUID remoteCloudClientGuid)
1644 {
1645 bool keyDataListExists;
1646 unsigned int keyDataListIndex = cloudDataList->keyData.GetIndexFromKey(specificSubscriber, &keyDataListExists);
1647 if (keyDataListExists==false)
1648 return;
1649 CloudData *cloudData = cloudDataList->keyData[keyDataListIndex];
1650 bool hasSpecificSubscriber;
1651 unsigned int specificSubscriberIndex = cloudData->specificSubscribers.GetIndexFromKey(remoteCloudClientGuid, &hasSpecificSubscriber);
1652 if (hasSpecificSubscriber)
1653 {
1654 cloudData->specificSubscribers.RemoveAtIndex(specificSubscriberIndex);
1655 cloudDataList->subscriberCount--;
1656
1657 if (cloudData->IsUnused())
1658 {
1659 SLNet::OP_DELETE(cloudData, _FILE_AND_LINE_);
1660 cloudDataList->keyData.RemoveAtIndex(keyDataListIndex);
1661 }
1662 }
1663 }
1664
1665 void CloudServer::ForceExternalSystemAddress(SystemAddress forcedAddress)
1666 {
1667 forceAddress=forcedAddress;
1668 }
1669 void CloudServer::AddQueryFilter(CloudServerQueryFilter* filter)
1670 {
1671 if (queryFilters.GetIndexOf(filter)!=(unsigned int) -1)
1672 return;
1673 queryFilters.Push(filter, _FILE_AND_LINE_);
1674 }
1675 void CloudServer::RemoveQueryFilter(CloudServerQueryFilter* filter)
1676 {
1677 unsigned int index;
1678 index = queryFilters.GetIndexOf(filter);
1679 if (index != (unsigned int) -1)
1680 queryFilters.RemoveAtIndex(index);
1681 }
1682 void CloudServer::RemoveAllQueryFilters(void)
1683 {
1684 queryFilters.Clear(true, _FILE_AND_LINE_);
1685 }
1686
1687 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/CloudClient.cpp Source File

  • src
CloudClient.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_CloudClient==1
18
19 #include "slikenet/CloudClient.h"
20 #include "slikenet/GetTime.h"
21 #include "slikenet/MessageIdentifiers.h"
22 #include "slikenet/BitStream.h"
23 #include "slikenet/peerinterface.h"
24
25 using namespace SLNet;
26
27 STATIC_FACTORY_DEFINITIONS(CloudClient,CloudClient);
28
29 CloudClient::CloudClient()
30 {
31 callback=0;
32 allocator=&unsetDefaultAllocator;
33 }
34 CloudClient::~CloudClient()
35 {
36 }
37 void CloudClient::SetDefaultCallbacks(CloudAllocator *_allocator, CloudClientCallback *_callback)
38 {
39 callback=_callback;
40 allocator=_allocator;
41 }
42 void CloudClient::Post(CloudKey *cloudKey, const unsigned char *data, uint32_t dataLengthBytes, RakNetGUID systemIdentifier)
43 {
44 RakAssert(cloudKey);
45
46 SLNet::BitStream bsOut;
47 bsOut.Write((MessageID)ID_CLOUD_POST_REQUEST);
48 cloudKey->Serialize(true,&bsOut);
49 if (data==0)
50 dataLengthBytes=0;
51 bsOut.Write(dataLengthBytes);
52 if (dataLengthBytes>0)
53 bsOut.WriteAlignedBytes((const unsigned char*) data, dataLengthBytes);
54 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemIdentifier, false);
55 }
56 void CloudClient::Release(DataStructures::List<CloudKey> &keys, RakNetGUID systemIdentifier)
57 {
58 SLNet::BitStream bsOut;
59 bsOut.Write((MessageID)ID_CLOUD_RELEASE_REQUEST);
60 RakAssert(keys.Size() < (uint16_t)-1 );
61 bsOut.WriteCasted<uint16_t>(keys.Size());
62 for (uint16_t i=0; i < keys.Size(); i++)
63 {
64 keys[i].Serialize(true,&bsOut);
65 }
66 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemIdentifier, false);
67 }
68 bool CloudClient::Get(CloudQuery *keyQuery, RakNetGUID systemIdentifier)
69 {
70 SLNet::BitStream bsOut;
71 bsOut.Write((MessageID)ID_CLOUD_GET_REQUEST);
72 keyQuery->Serialize(true, &bsOut);
73 bsOut.WriteCasted<uint16_t>(0); // Specific systems
74 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemIdentifier, false);
75 return true;
76 }
77 bool CloudClient::Get(CloudQuery *keyQuery, DataStructures::List<RakNetGUID> &specificSystems, RakNetGUID systemIdentifier)
78 {
79 SLNet::BitStream bsOut;
80 bsOut.Write((MessageID)ID_CLOUD_GET_REQUEST);
81 keyQuery->Serialize(true, &bsOut);
82 bsOut.WriteCasted<uint16_t>(specificSystems.Size());
83 RakAssert(specificSystems.Size() < (uint16_t)-1 );
84 for (uint16_t i=0; i < specificSystems.Size(); i++)
85 {
86 bsOut.Write(specificSystems[i]);
87 }
88 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemIdentifier, false);
89 return true;
90 }
91 bool CloudClient::Get(CloudQuery *keyQuery, DataStructures::List<CloudQueryRow*> &specificSystems, RakNetGUID systemIdentifier)
92 {
93 SLNet::BitStream bsOut;
94 bsOut.Write((MessageID)ID_CLOUD_GET_REQUEST);
95 keyQuery->Serialize(true, &bsOut);
96 bsOut.WriteCasted<uint16_t>(specificSystems.Size());
97 RakAssert(specificSystems.Size() < (uint16_t)-1 );
98 for (uint16_t i=0; i < specificSystems.Size(); i++)
99 {
100 if (specificSystems[i]->clientGUID!=UNASSIGNED_RAKNET_GUID)
101 {
102 bsOut.Write(true);
103 bsOut.Write(specificSystems[i]->clientGUID);
104 }
105 else
106 {
107 bsOut.Write(false);
108 bsOut.Write(specificSystems[i]->clientSystemAddress);
109 }
110 }
111 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemIdentifier, false);
112 return true;
113 }
114 void CloudClient::Unsubscribe(DataStructures::List<CloudKey> &keys, RakNetGUID systemIdentifier)
115 {
116 SLNet::BitStream bsOut;
117 bsOut.Write((MessageID)ID_CLOUD_UNSUBSCRIBE_REQUEST);
118 RakAssert(keys.Size() < (uint16_t)-1 );
119 bsOut.WriteCasted<uint16_t>(keys.Size());
120 for (uint16_t i=0; i < keys.Size(); i++)
121 {
122 keys[i].Serialize(true,&bsOut);
123 }
124 bsOut.WriteCasted<uint16_t>(0);
125 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemIdentifier, false);
126 }
127 void CloudClient::Unsubscribe(DataStructures::List<CloudKey> &keys, DataStructures::List<RakNetGUID> &specificSystems, RakNetGUID systemIdentifier)
128 {
129 SLNet::BitStream bsOut;
130 bsOut.Write((MessageID)ID_CLOUD_UNSUBSCRIBE_REQUEST);
131 RakAssert(keys.Size() < (uint16_t)-1 );
132 bsOut.WriteCasted<uint16_t>(keys.Size());
133 for (uint16_t i=0; i < keys.Size(); i++)
134 {
135 keys[i].Serialize(true,&bsOut);
136 }
137 bsOut.WriteCasted<uint16_t>(specificSystems.Size());
138 RakAssert(specificSystems.Size() < (uint16_t)-1 );
139 for (uint16_t i=0; i < specificSystems.Size(); i++)
140 {
141 bsOut.Write(specificSystems[i]);
142 }
143 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemIdentifier, false);
144 }
145 void CloudClient::Unsubscribe(DataStructures::List<CloudKey> &keys, DataStructures::List<CloudQueryRow*> &specificSystems, RakNetGUID systemIdentifier)
146 {
147 SLNet::BitStream bsOut;
148 bsOut.Write((MessageID)ID_CLOUD_UNSUBSCRIBE_REQUEST);
149 RakAssert(keys.Size() < (uint16_t)-1 );
150 bsOut.WriteCasted<uint16_t>(keys.Size());
151 for (uint16_t i=0; i < keys.Size(); i++)
152 {
153 keys[i].Serialize(true,&bsOut);
154 }
155 bsOut.WriteCasted<uint16_t>(specificSystems.Size());
156 RakAssert(specificSystems.Size() < (uint16_t)-1 );
157 for (uint16_t i=0; i < specificSystems.Size(); i++)
158 {
159 if (specificSystems[i]->clientGUID!=UNASSIGNED_RAKNET_GUID)
160 {
161 bsOut.Write(true);
162 bsOut.Write(specificSystems[i]->clientGUID);
163 }
164 else
165 {
166 bsOut.Write(false);
167 bsOut.Write(specificSystems[i]->clientSystemAddress);
168 }
169 }
170 SendUnified(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, systemIdentifier, false);
171 }
172 PluginReceiveResult CloudClient::OnReceive(Packet *packet)
173 {
174 (void) packet;
175
176 return RR_CONTINUE_PROCESSING;
177 }
178 void CloudClient::OnGetReponse(Packet *packet, CloudClientCallback *_callback, CloudAllocator *_allocator)
179 {
180 if (_callback==0)
181 _callback=callback;
182 if (_allocator==0)
183 _allocator=allocator;
184
185 CloudQueryResult cloudQueryResult;
186
187 SLNet::BitStream bsIn(packet->data, packet->length, false);
188 bsIn.IgnoreBytes(sizeof(MessageID));
189 cloudQueryResult.Serialize(false,&bsIn,_allocator);
190 bool deallocateRowsAfterReturn=true;
191 _callback->OnGet(&cloudQueryResult, &deallocateRowsAfterReturn);
192 if (deallocateRowsAfterReturn)
193 {
194 unsigned int i;
195 for (i=0; i < cloudQueryResult.rowsReturned.Size(); i++)
196 {
197 _allocator->DeallocateRowData(cloudQueryResult.rowsReturned[i]->data);
198 _allocator->DeallocateCloudQueryRow(cloudQueryResult.rowsReturned[i]);
199 }
200 }
201 }
202 void CloudClient::OnGetReponse(CloudQueryResult *cloudQueryResult, Packet *packet, CloudAllocator *_allocator)
203 {
204 if (_allocator==0)
205 _allocator=allocator;
206
207 SLNet::BitStream bsIn(packet->data, packet->length, false);
208 bsIn.IgnoreBytes(sizeof(MessageID));
209 cloudQueryResult->Serialize(false,&bsIn,_allocator);
210 }
211 void CloudClient::OnSubscriptionNotification(Packet *packet, CloudClientCallback *_callback, CloudAllocator *_allocator)
212 {
213 if (_callback==0)
214 _callback=callback;
215 if (_allocator==0)
216 _allocator=allocator;
217
218 bool wasUpdated=false;
219 CloudQueryRow row;
220
221 SLNet::BitStream bsIn(packet->data, packet->length, false);
222 bsIn.IgnoreBytes(sizeof(MessageID));
223 bsIn.Read(wasUpdated);
224 row.Serialize(false,&bsIn,_allocator);
225 bool deallocateRowAfterReturn=true;
226 _callback->OnSubscriptionNotification(&row, wasUpdated, &deallocateRowAfterReturn);
227 if (deallocateRowAfterReturn)
228 {
229 _allocator->DeallocateRowData(row.data);
230 }
231 }
232 void CloudClient::OnSubscriptionNotification(bool *wasUpdated, CloudQueryRow *row, Packet *packet, CloudAllocator *_allocator)
233 {
234 if (_allocator==0)
235 _allocator=allocator;
236
237 SLNet::BitStream bsIn(packet->data, packet->length, false);
238 bsIn.IgnoreBytes(sizeof(MessageID));
239 bool b=false;
240 bsIn.Read(b);
241 *wasUpdated=b;
242 row->Serialize(false,&bsIn,_allocator);
243 }
244 void CloudClient::DeallocateWithDefaultAllocator(CloudQueryResult *cloudQueryResult)
245 {
246 unsigned int i;
247 for (i=0; i < cloudQueryResult->rowsReturned.Size(); i++)
248 {
249 allocator->DeallocateRowData(cloudQueryResult->rowsReturned[i]->data);
250 allocator->DeallocateCloudQueryRow(cloudQueryResult->rowsReturned[i]);
251 }
252
253 cloudQueryResult->rowsReturned.Clear(false, _FILE_AND_LINE_);
254 cloudQueryResult->resultKeyIndices.Clear(false, _FILE_AND_LINE_);
255 cloudQueryResult->cloudQuery.keys.Clear(false, _FILE_AND_LINE_);
256 }
257 void CloudClient::DeallocateWithDefaultAllocator(CloudQueryRow *row)
258 {
259 allocator->DeallocateRowData(row->data);
260 }
261 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPProxyServer.h Source File

  • include
  • slikenet
UDPProxyServer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_UDPProxyServer==1 && _RAKNET_SUPPORT_UDPForwarder==1
23
24 #ifndef __UDP_PROXY_SERVER_H
25 #define __UDP_PROXY_SERVER_H
26
27 #include "Export.h"
28 #include "types.h"
29 #include "PluginInterface2.h"
30 #include "UDPForwarder.h"
31 #include "string.h"
32
33 namespace SLNet
34 {
35 class UDPProxyServer;
36
39 struct UDPProxyServerResultHandler
40 {
41 UDPProxyServerResultHandler() {}
42 virtual ~UDPProxyServerResultHandler() {}
43
47 virtual void OnLoginSuccess(SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0;
48
53 virtual void OnAlreadyLoggedIn(SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0;
54
58 virtual void OnNoPasswordSet(SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0;
59
63 virtual void OnWrongPassword(SLNet::RakString usedPassword, SLNet::UDPProxyServer *proxyServerPlugin)=0;
64 };
65
71 class RAK_DLL_EXPORT UDPProxyServer : public PluginInterface2
72 {
73 public:
74 // GetInstance() and DestroyInstance(instance*)
75 STATIC_FACTORY_DECLARATIONS(UDPProxyServer)
76
77 UDPProxyServer();
78 ~UDPProxyServer();
79
82 void SetSocketFamily(unsigned short _socketFamily);
83
87 void SetResultHandler(UDPProxyServerResultHandler *rh);
88
93 bool LoginToCoordinator(SLNet::RakString password, SystemAddress coordinatorAddress);
94
98 void SetServerPublicIP(RakString ip);
99
103 UDPForwarder udpForwarder;
104
105 virtual void OnAttach(void);
106 virtual void OnDetach(void);
107
109 virtual void Update(void);
110 virtual PluginReceiveResult OnReceive(Packet *packet);
111 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
112 virtual void OnRakPeerStartup(void);
113 virtual void OnRakPeerShutdown(void);
114
115 protected:
116 void OnForwardingRequestFromCoordinatorToServer(Packet *packet);
117
118 DataStructures::OrderedList<SystemAddress, SystemAddress> loggingInCoordinators;
119 DataStructures::OrderedList<SystemAddress, SystemAddress> loggedInCoordinators;
120
121 UDPProxyServerResultHandler *resultHandler;
122 unsigned short socketFamily;
123 RakString serverPublicIp;
124
125 };
126
127 } // End namespace
128
129 #endif
130
131 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • IRNS2_Berkley
SLNet::IRNS2_Berkley Member List

This is the complete list of members for SLNet::IRNS2_Berkley, including all inherited members.

Bind(RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line)=0 | SLNet::IRNS2_Berkley | pure virtual
boundAddress | SLNet::RakNetSocket2 | protected
DomainNameToIP(const char *domainName, char ip[65]) | SLNet::RakNetSocket2 | static
eventHandler | SLNet::RakNetSocket2 | protected
GetBoundAddress(void) const | SLNet::RakNetSocket2 |
GetEventHandler(void) const | SLNet::RakNetSocket2 |
GetMyIP(SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS]) | SLNet::RakNetSocket2 | static
GetSocketType(void) const | SLNet::RakNetSocket2 |
GetUserConnectionSocketIndex(void) const | SLNet::RakNetSocket2 |
IsBerkleySocket(void) const | SLNet::RakNetSocket2 |
IsPortInUse(unsigned short port, const char *hostAddress, unsigned short addressFamily, int type) | SLNet::IRNS2_Berkley | static
RakNetSocket2() | SLNet::RakNetSocket2 |
Send(RNS2_SendParameters *sendParameters, const char *file, unsigned int line)=0 | SLNet::RakNetSocket2 | pure virtual
SetRecvEventHandler(RNS2EventHandler *_eventHandler) | SLNet::RakNetSocket2 |
SetSocketType(RNS2Type t) | SLNet::RakNetSocket2 |
SetUserConnectionSocketIndex(unsigned int i) | SLNet::RakNetSocket2 |
socketType | SLNet::RakNetSocket2 | protected
userConnectionSocketIndex | SLNet::RakNetSocket2 | protected
~RakNetSocket2() | SLNet::RakNetSocket2 | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Hash
DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > Member List

This is the complete list of members for DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >, including all inherited members.

Clear(const char *file, unsigned int line) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
ClearIndex(unsigned int index, const char *file, unsigned int line) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > | protected
GetAsList(DataStructures::List< data_type > &itemList, DataStructures::List< key_type > &keyList, const char *file, unsigned int line) const | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
GetIndexOf(key_type key) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
HasData(key_type key) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
Hash() | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
ItemAtIndex(const HashIndex &index) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
KeyAtIndex(const HashIndex &index) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
nodeList | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > | protected
Peek(key_type key) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
Pop(data_type &out, key_type key, const char *file, unsigned int line) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
Push(key_type key, const data_type &input, const char *file, unsigned int line) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
Remove(key_type key, const char *file, unsigned int line) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
RemoveAtIndex(HashIndex index, const char *file, unsigned int line) | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
Size(void) const | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
size | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > | protected
~Hash() | DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Queue.h Source File

  • include
  • slikenet
DS_Queue.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __QUEUE_H
23 #define __QUEUE_H
24
25 // Template classes have to have all the code in the header file
26 #include "assert.h"
27 #include "Export.h"
28 #include "memoryoverride.h"
29
32 namespace DataStructures
33 {
35 template <class queue_type>
36 class RAK_DLL_EXPORT Queue
37 {
38 public:
39 Queue();
40 ~Queue();
41 Queue( const Queue& original_copy );
42 bool operator= ( const Queue& original_copy );
43 void Push( const queue_type& input, const char *file, unsigned int line );
44 void PushAtHead( const queue_type& input, unsigned index, const char *file, unsigned int line );
45 queue_type& operator[] ( unsigned int position ) const; // Not a normal thing you do with a queue but can be used for efficiency
46 void RemoveAtIndex( unsigned int position ); // Not a normal thing you do with a queue but can be used for efficiency
47 inline queue_type Peek( void ) const;
48 inline queue_type PeekTail( void ) const;
49 inline queue_type Pop( void );
50 inline queue_type PopTail( void );
51 // Debug: Set pointer to 0, for memory leak detection
52 inline queue_type PopDeref( void );
53 inline unsigned int Size( void ) const;
54 inline bool IsEmpty(void) const;
55 inline unsigned int AllocationSize( void ) const;
56 inline void Clear( const char *file, unsigned int line );
57 void Compress( const char *file, unsigned int line );
58 bool Find ( const queue_type& q );
59 void ClearAndForceAllocation( int size, const char *file, unsigned int line ); // Force a memory allocation to a certain larger size
60
61 private:
62 queue_type* array;
63 unsigned int head; // Array index for the head of the queue
64 unsigned int tail; // Array index for the tail of the queue
65 unsigned int allocation_size;
66 };
67
68
69 template <class queue_type>
70 inline unsigned int Queue<queue_type>::Size( void ) const
71 {
72 if ( head <= tail )
73 return tail -head;
74 else
75 return allocation_size -head + tail;
76 }
77
78 template <class queue_type>
79 inline bool Queue<queue_type>::IsEmpty(void) const
80 {
81 return head==tail;
82 }
83
84 template <class queue_type>
85 inline unsigned int Queue<queue_type>::AllocationSize( void ) const
86 {
87 return allocation_size;
88 }
89
90 template <class queue_type>
91 Queue<queue_type>::Queue()
92 {
93 //allocation_size = 16;
94 //array = SLNet::OP_NEW_ARRAY<queue_type>(allocation_size, _FILE_AND_LINE_ );
95 allocation_size = 0;
96 array=0;
97 head = 0;
98 tail = 0;
99 }
100
101 template <class queue_type>
102 Queue<queue_type>::~Queue()
103 {
104 if (allocation_size>0)
105 SLNet::OP_DELETE_ARRAY(array, _FILE_AND_LINE_);
106 }
107
108 template <class queue_type>
109 inline queue_type Queue<queue_type>::Pop( void )
110 {
111 #ifdef _DEBUG
112 RakAssert( head != tail);
113 #endif
114 //head=(head+1) % allocation_size;
115
116 if ( ++head == allocation_size )
117 head = 0;
118
119 if ( head == 0 )
120 return ( queue_type ) array[ allocation_size -1 ];
121
122 return ( queue_type ) array[ head -1 ];
123 }
124
125 template <class queue_type>
126 inline queue_type Queue<queue_type>::PopTail( void )
127 {
128 #ifdef _DEBUG
129 RakAssert( head != tail );
130 #endif
131 if (tail!=0)
132 {
133 --tail;
134 return ( queue_type ) array[ tail ];
135 }
136 else
137 {
138 tail=allocation_size-1;
139 return ( queue_type ) array[ tail ];
140 }
141 }
142
143 template <class queue_type>
144 inline queue_type Queue<queue_type>::PopDeref( void )
145 {
146 if ( ++head == allocation_size )
147 head = 0;
148
149 queue_type q;
150 if ( head == 0 )
151 {
152 q=array[ allocation_size -1 ];
153 array[ allocation_size -1 ]=0;
154 return q;
155 }
156
157 q=array[ head -1 ];
158 array[ head -1 ]=0;
159 return q;
160 }
161
162 template <class queue_type>
163 void Queue<queue_type>::PushAtHead( const queue_type& input, unsigned index, const char *file, unsigned int line )
164 {
165 RakAssert(index <= Size());
166
167 // Just force a reallocation, will be overwritten
168 Push(input, file, line );
169
170 if (Size()==1)
171 return;
172
173 unsigned writeIndex, readIndex, trueWriteIndex, trueReadIndex;
174 writeIndex=Size()-1;
175 readIndex=writeIndex-1;
176 while (readIndex >= index)
177 {
178 if ( head + writeIndex >= allocation_size )
179 trueWriteIndex = head + writeIndex - allocation_size;
180 else
181 trueWriteIndex = head + writeIndex;
182
183 if ( head + readIndex >= allocation_size )
184 trueReadIndex = head + readIndex - allocation_size;
185 else
186 trueReadIndex = head + readIndex;
187
188 array[trueWriteIndex]=array[trueReadIndex];
189
190 if (readIndex==0)
191 break;
192 writeIndex--;
193 readIndex--;
194 }
195
196 if ( head + index >= allocation_size )
197 trueWriteIndex = head + index - allocation_size;
198 else
199 trueWriteIndex = head + index;
200
201 array[trueWriteIndex]=input;
202 }
203
204
205 template <class queue_type>
206 inline queue_type Queue<queue_type>::Peek( void ) const
207 {
208 #ifdef _DEBUG
209 RakAssert( head != tail );
210 #endif
211
212 return ( queue_type ) array[ head ];
213 }
214
215 template <class queue_type>
216 inline queue_type Queue<queue_type>::PeekTail( void ) const
217 {
218 #ifdef _DEBUG
219 RakAssert( head != tail );
220 #endif
221 if (tail!=0)
222 return ( queue_type ) array[ tail-1 ];
223 else
224 return ( queue_type ) array[ allocation_size-1 ];
225 }
226
227 template <class queue_type>
228 void Queue<queue_type>::Push( const queue_type& input, const char *file, unsigned int line )
229 {
230 if ( allocation_size == 0 )
231 {
232 array = SLNet::OP_NEW_ARRAY<queue_type>(16, file, line );
233 head = 0;
234 tail = 1;
235 array[ 0 ] = input;
236 allocation_size = 16;
237 return ;
238 }
239
240 array[ tail++ ] = input;
241
242 if ( tail == allocation_size )
243 tail = 0;
244
245 if ( tail == head )
246 {
247 // unsigned int index=tail;
248
249 // Need to allocate more memory.
250 queue_type * new_array;
251 new_array = SLNet::OP_NEW_ARRAY<queue_type>((int)allocation_size * 2, file, line );
252 #ifdef _DEBUG
253 RakAssert( new_array );
254 #endif
255 if (new_array==0)
256 return;
257
258 for ( unsigned int counter = 0; counter < allocation_size; ++counter )
259 new_array[ counter ] = array[ ( head + counter ) % ( allocation_size ) ];
260
261 head = 0;
262
263 tail = allocation_size;
264
265 allocation_size *= 2;
266
267 // Delete the old array and move the pointer to the new array
268 SLNet::OP_DELETE_ARRAY(array, file, line);
269
270 array = new_array;
271 }
272
273 }
274
275 template <class queue_type>
276 Queue<queue_type>::Queue( const Queue& original_copy )
277 {
278 // Allocate memory for copy
279
280 if ( original_copy.Size() == 0 )
281 {
282 allocation_size = 0;
283 }
284
285 else
286 {
287 array = SLNet::OP_NEW_ARRAY<queue_type >( original_copy.Size() + 1 , _FILE_AND_LINE_ );
288
289 for ( unsigned int counter = 0; counter < original_copy.Size(); ++counter )
290 array[ counter ] = original_copy.array[ ( original_copy.head + counter ) % ( original_copy.allocation_size ) ];
291
292 head = 0;
293
294 tail = original_copy.Size();
295
296 allocation_size = original_copy.Size() + 1;
297 }
298 }
299
300 template <class queue_type>
301 bool Queue<queue_type>::operator= ( const Queue& original_copy )
302 {
303 if ( ( &original_copy ) == this )
304 return false;
305
306 Clear(_FILE_AND_LINE_);
307
308 // Allocate memory for copy
309 if ( original_copy.Size() == 0 )
310 {
311 allocation_size = 0;
312 }
313
314 else
315 {
316 array = SLNet::OP_NEW_ARRAY<queue_type >( original_copy.Size() + 1 , _FILE_AND_LINE_ );
317
318 for ( unsigned int counter = 0; counter < original_copy.Size(); ++counter )
319 array[ counter ] = original_copy.array[ ( original_copy.head + counter ) % ( original_copy.allocation_size ) ];
320
321 head = 0;
322
323 tail = original_copy.Size();
324
325 allocation_size = original_copy.Size() + 1;
326 }
327
328 return true;
329 }
330
331 template <class queue_type>
332 inline void Queue<queue_type>::Clear ( const char *file, unsigned int line )
333 {
334 if ( allocation_size == 0 )
335 return ;
336
337 if (allocation_size > 32)
338 {
339 SLNet::OP_DELETE_ARRAY(array, file, line);
340 allocation_size = 0;
341 }
342
343 head = 0;
344 tail = 0;
345 }
346
347 template <class queue_type>
348 void Queue<queue_type>::Compress ( const char *file, unsigned int line )
349 {
350 queue_type* new_array;
351 unsigned int newAllocationSize;
352 if (allocation_size==0)
353 return;
354
355 newAllocationSize=1;
356 while (newAllocationSize <= Size())
357 newAllocationSize<<=1; // Must be a better way to do this but I'm too dumb to figure it out quickly :)
358
359 new_array = SLNet::OP_NEW_ARRAY<queue_type >(newAllocationSize, file, line );
360
361 for (unsigned int counter=0; counter < Size(); ++counter)
362 new_array[counter] = array[(head + counter)%(allocation_size)];
363
364 tail=Size();
365 allocation_size=newAllocationSize;
366 head=0;
367
368 // Delete the old array and move the pointer to the new array
369 SLNet::OP_DELETE_ARRAY(array, file, line);
370 array=new_array;
371 }
372
373 template <class queue_type>
374 bool Queue<queue_type>::Find ( const queue_type &q )
375 {
376 if ( allocation_size == 0 )
377 return false;
378
379 unsigned int counter = head;
380
381 while ( counter != tail )
382 {
383 if ( array[ counter ] == q )
384 return true;
385
386 counter = ( counter + 1 ) % allocation_size;
387 }
388
389 return false;
390 }
391
392 template <class queue_type>
393 void Queue<queue_type>::ClearAndForceAllocation( int size, const char *file, unsigned int line )
394 {
395 SLNet::OP_DELETE_ARRAY(array, file, line);
396 if (size>0)
397 array = SLNet::OP_NEW_ARRAY<queue_type>(size, file, line );
398 else
399 array=0;
400 allocation_size = size;
401 head = 0;
402 tail = 0;
403 }
404
405 template <class queue_type>
406 inline queue_type& Queue<queue_type>::operator[] ( unsigned int position ) const
407 {
408 #ifdef _DEBUG
409 RakAssert( position < Size() );
410 #endif
411 //return array[(head + position) % allocation_size];
412
413 if ( head + position >= allocation_size )
414 return array[ head + position - allocation_size ];
415 else
416 return array[ head + position ];
417 }
418
419 template <class queue_type>
420 void Queue<queue_type>::RemoveAtIndex( unsigned int position )
421 {
422 #ifdef _DEBUG
423 RakAssert( position < Size() );
424 RakAssert( head != tail );
425 #endif
426
427 if ( head == tail || position >= Size() )
428 return ;
429
430 unsigned int index;
431
432 unsigned int next;
433
434 //index = (head + position) % allocation_size;
435 if ( head + position >= allocation_size )
436 index = head + position - allocation_size;
437 else
438 index = head + position;
439
440 //next = (index + 1) % allocation_size;
441 next = index + 1;
442
443 if ( next == allocation_size )
444 next = 0;
445
446 while ( next != tail )
447 {
448 // Overwrite the previous element
449 array[ index ] = array[ next ];
450 index = next;
451 //next = (next + 1) % allocation_size;
452
453 if ( ++next == allocation_size )
454 next = 0;
455 }
456
457 // Move the tail back
458 if ( tail == 0 )
459 tail = allocation_size - 1;
460 else
461 --tail;
462 }
463 } // End namespace
464
465 #endif
466
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/TeamBalancer.cpp Source File

  • src
TeamBalancer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_TeamBalancer==1
18
19 #include "slikenet/TeamBalancer.h"
20 #include "slikenet/BitStream.h"
21 #include "slikenet/MessageIdentifiers.h"
22 #include "slikenet/peerinterface.h"
23 #include "slikenet/Rand.h"
24
25 using namespace SLNet;
26
27 enum TeamBalancerOperations
28 {
29 ID_STATUS_UPDATE_TO_NEW_HOST,
30 ID_CANCEL_TEAM_REQUEST,
31 ID_REQUEST_ANY_TEAM,
32 ID_REQUEST_SPECIFIC_TEAM
33 };
34
35 STATIC_FACTORY_DEFINITIONS(TeamBalancer,TeamBalancer);
36
37 TeamBalancer::TeamBalancer()
38 {
39 defaultAssigmentAlgorithm=SMALLEST_TEAM;
40 forceTeamsToBeEven=false;
41 lockTeams=false;
42 hostGuid=UNASSIGNED_RAKNET_GUID;
43 }
44 TeamBalancer::~TeamBalancer()
45 {
46
47 }
48 void TeamBalancer::SetTeamSizeLimit(TeamId team, unsigned short limit)
49 {
50 teamLimits.Replace(limit,0,team,_FILE_AND_LINE_);
51 if (teamLimits.Size() > teamMemberCounts.Size())
52 teamMemberCounts.Replace(0,0,teamLimits.Size()-1,_FILE_AND_LINE_);
53 }
54 void TeamBalancer::SetDefaultAssignmentAlgorithm(DefaultAssigmentAlgorithm daa)
55 {
56 // Just update the default. Currently active teams are not affected.
57 defaultAssigmentAlgorithm=daa;
58 }
59 void TeamBalancer::SetForceEvenTeams(bool force)
60 {
61 // Set flag to indicate that teams should be even.
62 forceTeamsToBeEven=force;
63
64 // If teams are locked, just return.
65 if (lockTeams==true)
66 return;
67
68 if (forceTeamsToBeEven==true)
69 {
70 // Run the even team algorithm
71 EvenTeams();
72 }
73 }
74 void TeamBalancer::SetLockTeams(bool lock)
75 {
76 if (lock==lockTeams)
77 return;
78
79 // Set flag to indicate that teams can no longer be changed.
80 lockTeams=lock;
81
82 // If lock is false, and teams were set to be forced as even, then run through the even team algorithm
83 if (lockTeams==false)
84 {
85 // Process even swaps
86 TeamId i,j;
87 for (i=0; i < teamMembers.Size(); i++)
88 {
89 if (teamMembers[i].requestedTeam!=UNASSIGNED_TEAM_ID)
90 {
91 for (j=i+1; j < teamMembers.Size(); j++)
92 {
93 if (teamMembers[j].requestedTeam==teamMembers[i].currentTeam &&
94 teamMembers[i].requestedTeam==teamMembers[j].currentTeam)
95 {
96 SwapTeamMembersByRequest(i,j);
97 NotifyTeamAssigment(i);
98 NotifyTeamAssigment(j);
99 }
100 }
101 }
102 }
103
104 if (forceTeamsToBeEven==true)
105 {
106 EvenTeams();
107 }
108 else
109 {
110 // Process requested team changes
111 // Process movement while not full
112 for (i=0; i < teamMembers.Size(); i++)
113 {
114 TeamId requestedTeam = teamMembers[i].requestedTeam;
115 if (requestedTeam!=UNASSIGNED_TEAM_ID)
116 {
117 if (teamMemberCounts[requestedTeam]<teamLimits[requestedTeam])
118 {
119 SwitchMemberTeam(i,requestedTeam);
120 NotifyTeamAssigment(i);
121 }
122 }
123 }
124 }
125 }
126 }
127 void TeamBalancer::RequestSpecificTeam(NetworkID memberId, TeamId desiredTeam)
128 {
129 bool foundMatch=false;
130 for (unsigned int i=0; i < myTeamMembers.Size(); i++)
131 {
132 if (myTeamMembers[i].memberId==memberId)
133 {
134 foundMatch=true;
135 if (myTeamMembers[i].requestedTeam==desiredTeam && myTeamMembers[i].currentTeam==desiredTeam)
136 {
137 return;
138 }
139 else
140 {
141 myTeamMembers[i].requestedTeam=desiredTeam;
142 }
143 }
144 }
145
146 if (foundMatch==false)
147 {
148 MyTeamMembers mtm;
149 mtm.currentTeam=UNASSIGNED_TEAM_ID;
150 mtm.memberId=memberId;
151 mtm.requestedTeam=desiredTeam;
152 myTeamMembers.Push(mtm, _FILE_AND_LINE_);
153 }
154
155 // Send desiredTeam to the current host.
156 // Also flag that we have requested a team, and record desiredTeam in case the host changes and it needs to be resent.
157 BitStream bsOut;
158 bsOut.Write((MessageID)ID_TEAM_BALANCER_INTERNAL);
159 bsOut.Write((MessageID)ID_REQUEST_SPECIFIC_TEAM);
160 bsOut.Write(memberId);
161 bsOut.Write(desiredTeam);
162 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,hostGuid,false);
163 }
164 void TeamBalancer::CancelRequestSpecificTeam(NetworkID memberId)
165 {
166 for (unsigned int i=0; i < myTeamMembers.Size(); i++)
167 {
168 if (myTeamMembers[i].memberId==memberId)
169 {
170 myTeamMembers[i].requestedTeam=UNASSIGNED_TEAM_ID;
171
172 // Send packet to the host to remove our request flag.
173 BitStream bsOut;
174 bsOut.Write((MessageID)ID_TEAM_BALANCER_INTERNAL);
175 bsOut.Write((MessageID)ID_CANCEL_TEAM_REQUEST);
176 bsOut.Write(memberId);
177 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,hostGuid,false);
178
179 return;
180 }
181 }
182 }
183 void TeamBalancer::RequestAnyTeam(NetworkID memberId)
184 {
185 bool foundMatch=false;
186
187 for (unsigned int i=0; i < myTeamMembers.Size(); i++)
188 {
189 if (myTeamMembers[i].memberId==memberId)
190 {
191 foundMatch=true;
192 if (myTeamMembers[i].currentTeam!=UNASSIGNED_TEAM_ID)
193 return;
194 else
195 myTeamMembers[i].requestedTeam=UNASSIGNED_TEAM_ID;
196 break;
197 }
198 }
199
200 if (foundMatch==false)
201 {
202 MyTeamMembers mtm;
203 mtm.currentTeam=UNASSIGNED_TEAM_ID;
204 mtm.memberId=memberId;
205 mtm.requestedTeam=UNASSIGNED_TEAM_ID;
206 myTeamMembers.Push(mtm, _FILE_AND_LINE_);
207 }
208
209 // Else send to the current host that we need a team.
210 BitStream bsOut;
211 bsOut.Write((MessageID)ID_TEAM_BALANCER_INTERNAL);
212 bsOut.Write((MessageID)ID_REQUEST_ANY_TEAM);
213 bsOut.Write(memberId);
214 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,hostGuid,false);
215 }
216 TeamId TeamBalancer::GetMyTeam(NetworkID memberId) const
217 {
218 // Return team returned by last ID_TEAM_BALANCER_TEAM_ASSIGNED packet
219 for (unsigned int i=0; i < myTeamMembers.Size(); i++)
220 {
221 if (myTeamMembers[i].memberId==memberId)
222 {
223 return myTeamMembers[i].currentTeam;
224 }
225 }
226
227 return UNASSIGNED_TEAM_ID;
228 }
229 void TeamBalancer::DeleteMember(NetworkID memberId)
230 {
231 for (unsigned int i=0; i < myTeamMembers.Size(); i++)
232 {
233 if (myTeamMembers[i].memberId==memberId)
234 {
235 myTeamMembers.RemoveAtIndexFast(i);
236 break;
237 }
238 }
239
240 for (unsigned int i=0; i < teamMembers.Size(); i++)
241 {
242 if (teamMembers[i].memberId==memberId)
243 {
244 RemoveTeamMember(i);
245 break;
246 }
247 }
248 }
249 PluginReceiveResult TeamBalancer::OnReceive(Packet *packet)
250 {
251 switch (packet->data[0])
252 {
253 case ID_FCM2_NEW_HOST:
254 {
255 hostGuid=packet->guid;
256
257 if (myTeamMembers.Size()>0)
258 {
259 BitStream bsOut;
260 bsOut.Write((MessageID)ID_TEAM_BALANCER_INTERNAL);
261 bsOut.Write((MessageID)ID_STATUS_UPDATE_TO_NEW_HOST);
262
263 bsOut.WriteCasted<uint8_t>(myTeamMembers.Size());
264 for (unsigned int i=0; i < myTeamMembers.Size(); i++)
265 {
266 bsOut.Write(myTeamMembers[i].memberId);
267 bsOut.Write(myTeamMembers[i].currentTeam);
268 bsOut.Write(myTeamMembers[i].requestedTeam);
269 }
270 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,hostGuid,false);
271 }
272 }
273 break;
274 case ID_TEAM_BALANCER_INTERNAL:
275 {
276 if (packet->length>=2)
277 {
278 switch (packet->data[1])
279 {
280 case ID_STATUS_UPDATE_TO_NEW_HOST:
281 OnStatusUpdateToNewHost(packet);
282 break;
283 case ID_CANCEL_TEAM_REQUEST:
284 OnCancelTeamRequest(packet);
285 break;
286 case ID_REQUEST_ANY_TEAM:
287 OnRequestAnyTeam(packet);
288 break;
289 case ID_REQUEST_SPECIFIC_TEAM:
290 OnRequestSpecificTeam(packet);
291 break;
292 }
293 }
294 }
295 return RR_STOP_PROCESSING_AND_DEALLOCATE;
296
297 case ID_TEAM_BALANCER_TEAM_ASSIGNED:
298 {
299 return OnTeamAssigned(packet);
300 }
301
302 case ID_TEAM_BALANCER_REQUESTED_TEAM_FULL:
303 {
304 return OnRequestedTeamChangePending(packet);
305 }
306
307 case ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED:
308 {
309 return OnTeamsLocked(packet);
310 }
311 }
312
313 // Got RequestSpecificTeam
314 // If teams are locked
315 // - If this user already has a team, return ID_TEAM_BALANCER_TEAMS_LOCKED
316 // - This user does not already have a team. Assign a team as if the user called RequestAnyTeam(), with a preference for the requested team. Return ID_TEAM_BALANCER_TEAM_ASSIGNED once the team has been assigned.
317 // If teams are not locked
318 // - If even team balancing is on, only assign this user if this would not cause teams to be unbalanced. If teams WOULD be unbalanced, then flag this user as wanting to join this team. Return ID_TEAM_BALANCER_REQUESTED_TEAM_CHANGE_PENDING
319 // - If the destination team is full, flag this user as wanting to join this team. Return ID_TEAM_BALANCER_REQUESTED_TEAM_CHANGE_PENDING
320 // - Else, join this team. Return ID_TEAM_BALANCER_TEAM_ASSIGNED
321
322 // Got RequestAnyTeam
323 // Put user on a team following the algorithm. No team is set as preferred.
324
325 return RR_CONTINUE_PROCESSING;
326 }
327 void TeamBalancer::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
328 {
329 (void) systemAddress;
330 (void) lostConnectionReason;
331
332 RemoveByGuid(rakNetGUID);
333 }
334 void TeamBalancer::OnAttach(void)
335 {
336 hostGuid = rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
337 }
338 void TeamBalancer::RemoveByGuid(RakNetGUID rakNetGUID)
339 {
340 // If we are the host, and the closed connection has a team, and teams are not locked:
341 if (WeAreHost())
342 {
343 unsigned int droppedMemberIndex=0;
344 while (droppedMemberIndex < teamMembers.Size())
345 {
346 if (teamMembers[droppedMemberIndex].memberGuid==rakNetGUID)
347 {
348 TeamId droppedTeam = teamMembers[droppedMemberIndex].currentTeam;
349 RemoveTeamMember(droppedMemberIndex);
350 if (lockTeams==false)
351 {
352 if (forceTeamsToBeEven)
353 {
354 // - teams were forced to be even, then run the even team algorithm
355 EvenTeams();
356 }
357 else
358 {
359 // - teams were NOT forced to be even, and the team the dropped player on was full, then move users wanting to join that team (if any)
360 if (teamMemberCounts[ droppedTeam ]==teamLimits[ droppedTeam ]-1)
361 {
362 MoveMemberThatWantsToJoinTeam(droppedTeam);
363 }
364 }
365 }
366 }
367 else
368 {
369 droppedMemberIndex++;
370 }
371 }
372 }
373 }
374 void TeamBalancer::OnStatusUpdateToNewHost(Packet *packet)
375 {
376 if (WeAreHost()==false)
377 return;
378
379 BitStream bsIn(packet->data,packet->length,false);
380 bsIn.IgnoreBytes(2);
381 uint8_t requestedTeamChangeListSize;
382 bsIn.Read(requestedTeamChangeListSize);
383 TeamMember tm;
384 tm.memberGuid=packet->guid;
385 for (uint8_t i=0; i < requestedTeamChangeListSize; i++)
386 {
387 bsIn.Read(tm.memberId);
388 bsIn.Read(tm.currentTeam);
389 bsIn.Read(tm.requestedTeam);
390
391 if (tm.currentTeam!=UNASSIGNED_TEAM_ID && tm.currentTeam>teamLimits.Size())
392 {
393 RakAssert("Current team out of range in TeamBalancer::OnStatusUpdateToNewHost" && 0);
394 return;
395 }
396
397 if (tm.requestedTeam!=UNASSIGNED_TEAM_ID && tm.requestedTeam>teamLimits.Size())
398 {
399 RakAssert("Requested team out of range in TeamBalancer::OnStatusUpdateToNewHost" && 0);
400 return;
401 }
402
403 if (tm.currentTeam==UNASSIGNED_TEAM_ID && tm.requestedTeam==UNASSIGNED_TEAM_ID)
404 return;
405
406 unsigned int memberIndex = GetMemberIndex(tm.memberId, packet->guid);
407 if (memberIndex==(unsigned int) -1)
408 {
409 // Add this system (by GUID) to the list of members if he is not already there
410 // Also update his requested team flag.
411 // Do not process balancing on requested teams, since we don't necessarily have all data from all systems yet and hopefully the state during the host migration was stable.
412 if (tm.currentTeam==UNASSIGNED_TEAM_ID)
413 {
414 // Assign a default team, then add team member
415 if (tm.requestedTeam==UNASSIGNED_TEAM_ID)
416 {
417 // Assign a default team
418 tm.currentTeam=GetNextDefaultTeam();
419 }
420 else
421 {
422 // Assign to requested team if possible. Otherwise, assign to a default team
423 if (TeamWouldBeOverpopulatedOnAddition(tm.requestedTeam, teamMembers.Size())==false)
424 {
425 tm.currentTeam=tm.requestedTeam;
426 }
427 else
428 {
429 tm.currentTeam=GetNextDefaultTeam();
430 }
431 }
432 }
433
434 if (tm.currentTeam==UNASSIGNED_TEAM_ID)
435 {
436 RakAssert("Too many members asking for teams!" && 0);
437 return;
438 }
439 NotifyTeamAssigment(AddTeamMember(tm));
440 }
441 }
442 }
443 void TeamBalancer::OnCancelTeamRequest(Packet *packet)
444 {
445 if (WeAreHost()==false)
446 return;
447
448 BitStream bsIn(packet->data,packet->length,false);
449 bsIn.IgnoreBytes(2);
450 NetworkID memberId;
451 bsIn.Read(memberId);
452
453 unsigned int memberIndex = GetMemberIndex(memberId, packet->guid);
454 if (memberIndex!=(unsigned int)-1)
455 teamMembers[memberIndex].requestedTeam=UNASSIGNED_TEAM_ID;
456 }
457 void TeamBalancer::OnRequestAnyTeam(Packet *packet)
458 {
459 if (WeAreHost()==false)
460 return;
461
462 BitStream bsIn(packet->data,packet->length,false);
463 bsIn.IgnoreBytes(2);
464 NetworkID memberId;
465 bsIn.Read(memberId);
466
467 unsigned int memberIndex = GetMemberIndex(memberId, packet->guid);
468 if (memberIndex==(unsigned int)-1)
469 {
470 TeamMember tm;
471 tm.currentTeam=GetNextDefaultTeam();
472 tm.requestedTeam=UNASSIGNED_TEAM_ID;
473 tm.memberGuid=packet->guid;
474 tm.memberId=memberId;
475 if (tm.currentTeam==UNASSIGNED_TEAM_ID)
476 {
477 RakAssert("Too many members asking for teams!" && 0);
478 return;
479 }
480 NotifyTeamAssigment(AddTeamMember(tm));
481 }
482 }
483 void TeamBalancer::OnRequestSpecificTeam(Packet *packet)
484 {
485 if (WeAreHost()==false)
486 return;
487
488 BitStream bsIn(packet->data,packet->length,false);
489 bsIn.IgnoreBytes(2);
490 TeamMember tm;
491 bsIn.Read(tm.memberId);
492 bsIn.Read(tm.requestedTeam);
493
494 unsigned int memberIndex = GetMemberIndex(tm.memberId, packet->guid);
495 if (tm.requestedTeam==UNASSIGNED_TEAM_ID)
496 {
497 NotifyNoTeam(tm.memberId, packet->guid);
498 if (memberIndex != (unsigned int) -1)
499 RemoveTeamMember(memberIndex);
500 return;
501 }
502
503 if (tm.requestedTeam>teamLimits.Size())
504 {
505 RakAssert("Requested team out of range in TeamBalancer::OnRequestSpecificTeam" && 0);
506 return;
507 }
508 if (memberIndex==(unsigned int) -1)
509 {
510 tm.memberGuid=packet->guid;
511
512 // Assign to requested team if possible. Otherwise, assign to a default team
513 if (TeamWouldBeOverpopulatedOnAddition(tm.requestedTeam, teamMembers.Size())==false)
514 {
515 tm.currentTeam=tm.requestedTeam;
516 tm.requestedTeam=UNASSIGNED_TEAM_ID;
517 }
518 else
519 {
520 tm.currentTeam=GetNextDefaultTeam();
521 }
522 if (tm.currentTeam==UNASSIGNED_TEAM_ID)
523 {
524 RakAssert("Too many members asking for teams!" && 0);
525 return;
526 }
527 NotifyTeamAssigment(AddTeamMember(tm));
528 }
529 else
530 {
531 teamMembers[memberIndex].requestedTeam=tm.requestedTeam;
532 TeamId oldTeamThisUserWasOn = teamMembers[memberIndex].currentTeam;
533
534 if (lockTeams)
535 {
536 NotifyTeamsLocked(packet->guid, tm.requestedTeam);
537 return;
538 }
539
540 // Assign to requested team if possible. Otherwise, assign to a default team
541 if (TeamsWouldBeEvenOnSwitch(tm.requestedTeam,oldTeamThisUserWasOn)==true)
542 {
543 SwitchMemberTeam(memberIndex,tm.requestedTeam);
544 NotifyTeamAssigment(memberIndex);
545 }
546 else
547 {
548 // If someone wants to join this user's old team, and we want to join their team, they can swap
549 unsigned int swappableMemberIndex;
550 for (swappableMemberIndex=0; swappableMemberIndex < teamMembers.Size(); swappableMemberIndex++)
551 {
552 if (teamMembers[swappableMemberIndex].currentTeam==tm.requestedTeam && teamMembers[swappableMemberIndex].requestedTeam==oldTeamThisUserWasOn)
553 break;
554 }
555
556 if (swappableMemberIndex!=teamMembers.Size())
557 {
558 SwapTeamMembersByRequest(memberIndex,swappableMemberIndex);
559 NotifyTeamAssigment(memberIndex);
560 NotifyTeamAssigment(swappableMemberIndex);
561 }
562 else
563 {
564 // Full or would not be even
565 NotifyTeamSwitchPending(packet->guid, tm.requestedTeam, tm.memberId);
566 }
567 }
568 }
569 }
570 unsigned int TeamBalancer::GetMemberIndex(NetworkID memberId, RakNetGUID guid) const
571 {
572 for (unsigned int i=0; i < teamMembers.Size(); i++)
573 {
574 if (teamMembers[i].memberGuid==guid && teamMembers[i].memberId==memberId)
575 return i;
576 }
577 return (unsigned int) -1;
578 }
579 unsigned int TeamBalancer::AddTeamMember(const TeamMember &tm)
580 {
581 if (tm.currentTeam>teamLimits.Size())
582 {
583 RakAssert("TeamBalancer::AddTeamMember team index out of bounds" && 0);
584 return (unsigned int) -1;
585 }
586
587 RakAssert(tm.currentTeam!=UNASSIGNED_TEAM_ID);
588
589 teamMembers.Push(tm,_FILE_AND_LINE_);
590 if (teamMemberCounts.Size()<tm.currentTeam)
591 teamMemberCounts.Replace(1,0,tm.currentTeam,_FILE_AND_LINE_);
592 else
593 teamMemberCounts[tm.currentTeam]=teamMemberCounts[tm.currentTeam]+1;
594 return teamMembers.Size()-1;
595 }
596 void TeamBalancer::RemoveTeamMember(unsigned int index)
597 {
598 RakAssert( teamMemberCounts[ teamMembers[index].currentTeam ] != 0);
599 teamMemberCounts[ teamMembers[index].currentTeam ]=teamMemberCounts[ teamMembers[index].currentTeam ]-1;
600 teamMembers.RemoveAtIndexFast(index);
601 }
602 void TeamBalancer::GetMinMaxTeamMembers(int &minMembersOnASingleTeam, int &maxMembersOnASingleTeam)
603 {
604 minMembersOnASingleTeam = teamMembers.Size()/teamLimits.Size();
605 if ((teamMembers.Size() % teamLimits.Size()) == 0)
606 maxMembersOnASingleTeam = minMembersOnASingleTeam;
607 else
608 maxMembersOnASingleTeam = minMembersOnASingleTeam+1;
609 }
610 void TeamBalancer::EvenTeams(void)
611 {
612 // Ensure all teams are even. If not, pick players at random from overpopulated teams, and move to underpopulated teams.
613 int minMembersOnASingleTeam;
614 int maxMembersOnASingleTeam;
615 GetMinMaxTeamMembers(minMembersOnASingleTeam,maxMembersOnASingleTeam);
616
617 // First select among players that have requested to switch teams, if any, before choosing players that did not want to switch teams.
618 // Players that are moved should be notified of ID_TEAM_BALANCER_TEAM_ASSIGNED
619 DataStructures::List<TeamId> overpopulatedTeams;
620 TeamId teamMemberCountsIndex;
621 unsigned int memberIndexToSwitch;
622 for (teamMemberCountsIndex=0; teamMemberCountsIndex<teamMemberCounts.Size(); teamMemberCountsIndex++)
623 {
624 while (teamMemberCounts[teamMemberCountsIndex]<minMembersOnASingleTeam && teamMemberCounts[teamMemberCountsIndex]<teamLimits[teamMemberCountsIndex])
625 {
626 GetOverpopulatedTeams(overpopulatedTeams,maxMembersOnASingleTeam);
627 RakAssert(overpopulatedTeams.Size()>0);
628 memberIndexToSwitch=GetMemberIndexToSwitchTeams(overpopulatedTeams,teamMemberCountsIndex);
629 RakAssert(memberIndexToSwitch!=(unsigned int)-1);
630 SwitchMemberTeam(memberIndexToSwitch,teamMemberCountsIndex);
631 // Tell this member he switched teams
632 NotifyTeamAssigment(memberIndexToSwitch);
633 }
634 }
635 }
636 unsigned int TeamBalancer::GetMemberIndexToSwitchTeams(const DataStructures::List<TeamId> &sourceTeamNumbers, TeamId targetTeamNumber)
637 {
638 DataStructures::List<unsigned int> preferredSwapIndices;
639 DataStructures::List<unsigned int> potentialSwapIndices;
640 unsigned int i,j;
641 for (j=0; j < sourceTeamNumbers.Size(); j++)
642 {
643 RakAssert(sourceTeamNumbers[j]!=targetTeamNumber);
644 for (i=0; i < teamMembers.Size(); i++)
645 {
646 if (teamMembers[i].currentTeam==sourceTeamNumbers[j])
647 {
648 if (teamMembers[i].requestedTeam==targetTeamNumber)
649 preferredSwapIndices.Push(i,_FILE_AND_LINE_);
650 else
651 potentialSwapIndices.Push(i,_FILE_AND_LINE_);
652 }
653 }
654 }
655
656 if (preferredSwapIndices.Size()>0)
657 {
658 return preferredSwapIndices[ randomMT() % preferredSwapIndices.Size() ];
659 }
660 else if (potentialSwapIndices.Size()>0)
661 {
662 return potentialSwapIndices[ randomMT() % potentialSwapIndices.Size() ];
663 }
664 else
665 {
666 return (unsigned int) -1;
667 }
668 }
669 void TeamBalancer::SwitchMemberTeam(unsigned int teamMemberIndex, TeamId destinationTeam)
670 {
671 teamMemberCounts[ teamMembers[teamMemberIndex].currentTeam ]=teamMemberCounts[ teamMembers[teamMemberIndex].currentTeam ]-1;
672 teamMemberCounts[ destinationTeam ]=teamMemberCounts[ destinationTeam ]+1;
673 teamMembers[teamMemberIndex].currentTeam=destinationTeam;
674 if (teamMembers[teamMemberIndex].requestedTeam==destinationTeam)
675 teamMembers[teamMemberIndex].requestedTeam=UNASSIGNED_TEAM_ID;
676 }
677 void TeamBalancer::GetOverpopulatedTeams(DataStructures::List<TeamId> &overpopulatedTeams, int maxTeamSize)
678 {
679 overpopulatedTeams.Clear(true,_FILE_AND_LINE_);
680 for (TeamId i=0; i < teamMemberCounts.Size(); i++)
681 {
682 if (teamMemberCounts[i]>=maxTeamSize)
683 overpopulatedTeams.Push(i,_FILE_AND_LINE_);
684 }
685 }
686 void TeamBalancer::NotifyTeamAssigment(unsigned int teamMemberIndex)
687 {
688 RakAssert(teamMemberIndex < teamMembers.Size());
689 if (teamMemberIndex>=teamMembers.Size())
690 return;
691
692 BitStream bsOut;
693 bsOut.Write((MessageID)ID_TEAM_BALANCER_TEAM_ASSIGNED);
694 bsOut.Write(teamMembers[teamMemberIndex].currentTeam);
695 bsOut.Write(teamMembers[teamMemberIndex].memberId);
696 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,teamMembers[teamMemberIndex].memberGuid,false);
697 }
698 bool TeamBalancer::WeAreHost(void) const
699 {
700 return hostGuid==rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS);
701 }
702 PluginReceiveResult TeamBalancer::OnTeamAssigned(Packet *packet)
703 {
704 if (packet->guid!=hostGuid)
705 return RR_STOP_PROCESSING_AND_DEALLOCATE;
706
707 BitStream bsIn(packet->data,packet->length,false);
708 bsIn.IgnoreBytes(1);
709
710 MyTeamMembers mtm;
711 bsIn.Read(mtm.currentTeam);
712 bsIn.Read(mtm.memberId);
713 mtm.requestedTeam=UNASSIGNED_TEAM_ID;
714
715 bool foundMatch=false;
716 for (unsigned int i=0; i < myTeamMembers.Size(); i++)
717 {
718 if (myTeamMembers[i].memberId==mtm.memberId)
719 {
720 foundMatch=true;
721 if (myTeamMembers[i].requestedTeam==mtm.currentTeam)
722 myTeamMembers[i].requestedTeam=UNASSIGNED_TEAM_ID;
723 myTeamMembers[i].currentTeam=mtm.currentTeam;
724 break;
725 }
726 }
727
728 if (foundMatch==false)
729 {
730 return RR_STOP_PROCESSING_AND_DEALLOCATE;
731 }
732
733 return RR_CONTINUE_PROCESSING;
734 }
735 PluginReceiveResult TeamBalancer::OnRequestedTeamChangePending(Packet *packet)
736 {
737 if (packet->guid!=hostGuid)
738 return RR_STOP_PROCESSING_AND_DEALLOCATE;
739
740 return RR_CONTINUE_PROCESSING;
741 }
742 PluginReceiveResult TeamBalancer::OnTeamsLocked(Packet *packet)
743 {
744 if (packet->guid!=hostGuid)
745 return RR_STOP_PROCESSING_AND_DEALLOCATE;
746
747 return RR_CONTINUE_PROCESSING;
748 }
749 TeamId TeamBalancer::GetNextDefaultTeam(void)
750 {
751 // Accounting for team balancing and team limits, get the team a player should be placed on
752 switch (defaultAssigmentAlgorithm)
753 {
754 case SMALLEST_TEAM:
755 {
756 return GetSmallestNonFullTeam();
757 }
758
759 case FILL_IN_ORDER:
760 {
761 return GetFirstNonFullTeam();
762 }
763
764 default:
765 {
766 RakAssert("TeamBalancer::GetNextDefaultTeam unknown algorithm enumeration" && 0);
767 return UNASSIGNED_TEAM_ID;
768 }
769 }
770 }
771 bool TeamBalancer::TeamWouldBeOverpopulatedOnAddition(TeamId teamId, unsigned int teamMemberSize)
772 {
773 // Accounting for team balancing and team limits, would this team be overpopulated if a member was added to it?
774 if (teamMemberCounts[teamId]>=teamLimits[teamId])
775 {
776 return true;
777 }
778
779 if (forceTeamsToBeEven)
780 {
781 int allowedLimit = teamMemberSize/teamLimits.Size() + 1;
782 return teamMemberCounts[teamId]>=allowedLimit;
783 }
784
785 return false;
786 }
787 bool TeamBalancer::TeamWouldBeUnderpopulatedOnLeave(TeamId teamId, unsigned int teamMemberSize)
788 {
789 if (forceTeamsToBeEven)
790 {
791 unsigned int minMembersOnASingleTeam = (teamMemberSize-1)/teamLimits.Size();
792 return teamMemberCounts[teamId]<=minMembersOnASingleTeam;
793 }
794 return false;
795 }
796 TeamId TeamBalancer::GetSmallestNonFullTeam(void) const
797 {
798 TeamId idx;
799 unsigned long smallestTeamCount=MAX_UNSIGNED_LONG;
800 TeamId smallestTeamIndex = UNASSIGNED_TEAM_ID;
801 for (idx=0; idx < teamMemberCounts.Size(); idx++)
802 {
803 if (teamMemberCounts[idx]<smallestTeamCount && teamMemberCounts[idx]<teamLimits[idx])
804 {
805 smallestTeamCount=teamMemberCounts[idx];
806 smallestTeamIndex=idx;
807 }
808 }
809 return smallestTeamIndex;
810 }
811 TeamId TeamBalancer::GetFirstNonFullTeam(void) const
812 {
813 TeamId idx;
814 for (idx=0; idx < teamMemberCounts.Size(); idx++)
815 {
816 if (teamMemberCounts[idx]<teamLimits[idx])
817 {
818 return idx;
819 }
820 }
821 return UNASSIGNED_TEAM_ID;
822 }
823 void TeamBalancer::MoveMemberThatWantsToJoinTeam(TeamId teamId)
824 {
825 RakAssert(forceTeamsToBeEven==false && lockTeams==false);
826
827 do
828 {
829 teamId = MoveMemberThatWantsToJoinTeamInternal(teamId);
830 } while (teamId!=UNASSIGNED_TEAM_ID);
831 }
832 TeamId TeamBalancer::MoveMemberThatWantsToJoinTeamInternal(TeamId teamId)
833 {
834 DataStructures::List<TeamId> membersThatWantToJoinTheTeam;
835 for (TeamId i=0; i < teamMembers.Size(); i++)
836 {
837 if (teamMembers[i].requestedTeam==teamId)
838 membersThatWantToJoinTheTeam.Push(i,_FILE_AND_LINE_);
839 }
840
841 if (membersThatWantToJoinTheTeam.Size()>0)
842 {
843 TeamId oldTeam;
844 unsigned int swappedMemberIndex = membersThatWantToJoinTheTeam[ randomMT() % membersThatWantToJoinTheTeam.Size() ];
845 oldTeam=teamMembers[swappedMemberIndex].currentTeam;
846 SwitchMemberTeam(swappedMemberIndex,teamId);
847 NotifyTeamAssigment(swappedMemberIndex);
848 return oldTeam;
849 }
850 return UNASSIGNED_TEAM_ID;
851 }
852 void TeamBalancer::NotifyTeamsLocked(RakNetGUID target, TeamId requestedTeam)
853 {
854 BitStream bsOut;
855 bsOut.Write((MessageID)ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED);
856 bsOut.Write(requestedTeam);
857 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,target,false);
858 }
859 void TeamBalancer::NotifyTeamSwitchPending(RakNetGUID target, TeamId requestedTeam, NetworkID memberId)
860 {
861 BitStream bsOut;
862 bsOut.Write((MessageID)ID_TEAM_BALANCER_REQUESTED_TEAM_FULL);
863 bsOut.Write(requestedTeam);
864 bsOut.Write(memberId);
865 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,target,false);
866 }
867 void TeamBalancer::SwapTeamMembersByRequest(unsigned int memberIndex1, unsigned int memberIndex2)
868 {
869 TeamId index1Team = teamMembers[memberIndex1].currentTeam;
870 teamMembers[memberIndex1].currentTeam=teamMembers[memberIndex2].currentTeam;
871 teamMembers[memberIndex2].currentTeam=index1Team;
872 teamMembers[memberIndex1].requestedTeam=UNASSIGNED_TEAM_ID;
873 teamMembers[memberIndex2].requestedTeam=UNASSIGNED_TEAM_ID;
874 }
875 void TeamBalancer::NotifyNoTeam(NetworkID memberId, RakNetGUID target)
876 {
877 BitStream bsOut;
878 bsOut.Write((MessageID)ID_TEAM_BALANCER_TEAM_ASSIGNED);
879 bsOut.Write((unsigned char)UNASSIGNED_TEAM_ID);
880 bsOut.Write(memberId);
881 rakPeerInterface->Send(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,target,false);
882 }
883 bool TeamBalancer::TeamsWouldBeEvenOnSwitch(TeamId t1, TeamId t2)
884 {
885 RakAssert(teamMembers.Size()!=0);
886 return TeamWouldBeOverpopulatedOnAddition(t1, teamMembers.Size()-1)==false &&
887 TeamWouldBeUnderpopulatedOnLeave(t2, teamMembers.Size()-1)==false;
888 }
889
890 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/linux_adapter.cpp Source File

  • src
linux_adapter.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
3 *
4 * This source code is licensed under the MIT-style license found in the
5 * license.txt file in the root directory of this source tree.
6 *
7 *
8 * This file defines adapters for all MS-specific functions used throughout SLikeNet.
9 */
10
11 #ifdef __linux__
12 #include "slikenet/linux_adapter.h"
13
14 #include <algorithm> // for std::max, std::min
15 #include <cerrno> // for errno
16 #include <cstdio> // for FILE, fopen, vsnprintf
17 #include <cstdlib> // for mbstowcs
18 #include <cstring> // for strcat, strcpy, strerror, strncat, strncpy
19 #include <cstdarg> // for va_start, va_end, va_list
20 #include <ctime> // for localtime, time_t
21 #include <cwchar> // for wcscat, wcscpy, wcslen
22
23 errno_t fopen_s(FILE **pfile, const char *filename, const char *mode)
24 {
25 if ((pfile == nullptr) || (filename == nullptr) || (mode == nullptr)) {
26 return 22; // error: EINVAL
27 }
28
29 FILE *file = fopen(filename, mode);
30 if (file == nullptr) {
31 return errno;
32 }
33
34 *pfile = file;
35 return 0;
36 }
37
38 errno_t localtime_s(struct tm *_tm, const time_t *time)
39 {
40 // #med - should actually also check for _*time > _MAX_TIME64_T according to MSDN, but can't seem to find the
41 // definition of _MAX_TIME64_T
42 if ((_tm == nullptr) || (time == nullptr) || (*time == 0)) {
43 if (_tm != nullptr) {
44 _tm->tm_hour = -1;
45 _tm->tm_isdst = -1;
46 _tm->tm_mday = -1;
47 _tm->tm_min = -1;
48 _tm->tm_mon = -1;
49 _tm->tm_sec = -1;
50 _tm->tm_wday = -1;
51 _tm->tm_yday = -1;
52 _tm->tm_year = -1;
53 }
54 return 22; // error: EINVAL
55 }
56
57 struct tm *curTime = localtime(time);
58 *_tm = *curTime;
59
60 return 0;
61 }
62
63 errno_t mbstowcs_s(size_t *pReturnValue, wchar_t *wcstr, size_t sizeInWords, const char *mbstr, size_t count)
64 {
65 if ((mbstr == nullptr) || ((wcstr == nullptr) && (sizeInWords > 0)) || ((wcstr != nullptr) && (sizeInWords != 0))) {
66 if (wcstr != nullptr) {
67 wcstr[0] = L'\0'; // ensure 0-termination
68 }
69 return 22; // error: EINVAL
70 }
71
72 size_t numMaxChars = sizeInWords;
73 if (count != _TRUNCATE) {
74 numMaxChars = std::min(numMaxChars, count);
75 }
76
77 size_t numCharsWritten = mbstowcs(wcstr, mbstr, numMaxChars);
78 if (numCharsWritten == (size_t)-1) {
79 // invalid multibyte character encountered
80 if (pReturnValue != nullptr) {
81 *pReturnValue = 0;
82 }
83 if (wcstr != nullptr) {
84 wcstr[0] = L'\0'; // ensure 0-termination
85 }
86 return 42; // error: EILSEQ
87 }
88
89 if (numCharsWritten == numMaxChars) {
90 if (wcstr != nullptr) {
91 wcstr[0] = L'\0'; // ensure 0-termination
92 }
93 return 34; // error: ERANGE
94 }
95
96 if (pReturnValue != nullptr) {
97 *pReturnValue = numCharsWritten + 1; // chars written, including terminating null character
98 }
99
100 // ensure we write a terminating null character (in case there was none in the original converted string)
101 if (wcstr != nullptr) {
102 wcstr[numCharsWritten] = L'\0'; // ensure 0-termination
103 }
104
105 return 0;
106 }
107
108 int sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...)
109 {
110 if ((buffer == nullptr) || (sizeOfBuffer == 0) || (format == nullptr)) {
111 return -1;
112 }
113
114 va_list arglist;
115 va_start(arglist, format);
116 int numCharsWritten = vsnprintf(buffer, sizeOfBuffer, format, arglist);
117 va_end(arglist);
118
119 if (numCharsWritten == -1) {
120 buffer[0] = '\0'; // error occurred ensure terminating \0-character
121 return -1;
122 }
123
124 if (numCharsWritten >= sizeOfBuffer) {
125 buffer[0] = '\0'; // buffer too small, write empty string to ensure terminating \0-char
126 }
127
128 return numCharsWritten;
129 }
130
131 errno_t strcat_s(char *strDestination, size_t numberOfElements, const char *strSource)
132 {
133 if ((strDestination == nullptr) || (strSource == nullptr)) {
134 if (strDestination != nullptr) {
135 strDestination[0] = '\0'; // ensure trailing \0 is written
136 }
137 return 22; // error: EINVAL
138 }
139
140 if (numberOfElements == 0) {
141 strDestination[0] = '\0'; // ensure trailing \0 is written
142 return 34; // error: ERANGE
143 }
144
145 const size_t destLen = strlen(strDestination);
146 const size_t sourceLen = strlen(strSource);
147 if ((destLen > numberOfElements - 1) || ((sourceLen > 0) && (destLen == numberOfElements - 1)) || (sourceLen > numberOfElements - destLen - 1)) {
148 strDestination[0] = '\0'; // ensure trailing \0 is written
149 return 34; // error: ERANGE
150 }
151
152 (void)strcat(strDestination, strSource);
153 return 0;
154 }
155
156 errno_t strcpy_s(char* strDestination, size_t numberOfElements, const char *strSource)
157 {
158 if ((strDestination == nullptr) || (strSource == nullptr)) {
159 if (strDestination != nullptr) {
160 strDestination[0] = '\0'; // ensure trailing \0 is written
161 }
162 return 22; // error: EINVAL
163 }
164
165 if ((numberOfElements == 0) || (strlen(strSource) >= numberOfElements)) {
166 strDestination[0] = '\0'; // ensure trailing \0 is written
167 return 34; // error: ERANGE
168 }
169
170 (void)strcpy(strDestination, strSource);
171 return 0;
172 }
173
174 errno_t strerror_s(char* buffer, size_t numberOfElements, int errnum)
175 {
176 // check valid parameters
177 if ((buffer == nullptr) || (numberOfElements == 0)) {
178 return 22; // error: EINVAL
179 }
180
181 const char *errorMessage = strerror(errnum);
182 return strcpy_s(buffer, numberOfElements, errorMessage);
183 }
184
185 errno_t strncat_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
186 {
187 // check valid parameters
188 if ((strDest == nullptr) || (strSource == nullptr)) {
189 return 22; // error: EINVAL
190 }
191
192 if (numberOfElements == 0) {
193 return 34; // error: ERANGE
194 }
195
196 size_t charsToWrite;
197 const size_t sourceLen = strlen(strSource);
198 if (count == _TRUNCATE) {
199 charsToWrite = sourceLen;
200 }
201 else {
202 charsToWrite = std::min(count, sourceLen);
203 }
204
205 const size_t destLen = strlen(strDest);
206 const size_t sizeLeft = numberOfElements - destLen;
207
208 if (((count != _TRUNCATE) && (charsToWrite > sizeLeft - 1)) || ((sourceLen > 0) && (destLen == numberOfElements - 1))) {
209 strDest[0] = '\0'; // ensure trailing \0 is written
210 return 34; // error: ERANGE
211 }
212
213 (void)strncat(strDest, strSource, charsToWrite);
214 return 0;
215 }
216
217 errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count)
218 {
219 // check valid parameters
220 if ((numberOfElements == 0) || (strDest == nullptr) || (strSource == nullptr)) {
221 if (strDest != nullptr) {
222 strDest[0] = '\0'; // ensure trailing \0 is written
223 }
224 return 22; // error: EINVAL
225 }
226
227 size_t numChars;
228 bool truncated = false;
229 if (count == _TRUNCATE) {
230 // if count == _TRUNCATE use the length of the source string
231 numChars = strlen(strSource);
232
233 // ensure we are not exceeding numberOfElements
234 if (numChars >= numberOfElements) {
235 numChars = numberOfElements - 1;
236 truncated = true; // we are going to truncate the copied string
237 }
238 }
239 else {
240 // otherwise we use count, but have to check that the destination buffer is of sufficient size
241 if ((count > numberOfElements) || ((count == numberOfElements) && (strSource[count] != '\0'))) {
242 strDest[0] = '\0'; // ensure trailing \0 is written
243 return 34; // error: ERANGE
244 }
245 numChars = count;
246 }
247
248 (void)strncpy(strDest, strSource, numChars);
249
250 // enforce the trailing \0
251 strDest[numChars] = '\0';
252
253 return truncated ? 80 : 0; // STRUNCATE, if we truncated the string, 0 otherwise
254 }
255
256 int vsnprintf_s(char *buffer, size_t sizeOfBuffer, size_t count, const char *format, va_list argptr)
257 {
258 if ((buffer == nullptr) || (format == nullptr) || (sizeOfBuffer == 0)) {
259 return -1;
260 }
261
262 size_t maxChars = sizeOfBuffer;
263 if (count != _TRUNCATE) {
264 if (count >= sizeOfBuffer) {
265 buffer[0] = '\0'; // ensure trailing \0 is written
266 return -1;
267 }
268 maxChars = count;
269 }
270
271 int numCharsWritten = vsnprintf(buffer, maxChars, format, argptr);
272 if (numCharsWritten >= maxChars) {
273 if (count != _TRUNCATE) {
274 buffer[0] = '\0'; // buffer set to empty string
275 return -1;
276 }
277
278 // truncation occurred, add terminating \0
279 buffer[sizeOfBuffer] = '\0';
280 }
281
282 return numCharsWritten;
283 }
284
285 errno_t wcscat_s(wchar_t *strDestination, size_t numberOfElements, const wchar_t *strSource)
286 {
287 if ((strDestination == nullptr) || (strSource == nullptr)) {
288 if (strDestination != nullptr) {
289 strDestination[0] = L'\0'; // ensure trailing \0 is written
290 }
291 return 22; // error: EINVAL
292 }
293
294 if (numberOfElements == 0) {
295 strDestination[0] = L'\0'; // ensure trailing \0 is written
296 return 34; // error: ERANGE
297 }
298
299 const size_t destLen = wcslen(strDestination);
300 const size_t sourceLen = wcslen(strSource);
301 if ((destLen > numberOfElements - 1) || ((sourceLen > 0) && (destLen == numberOfElements)) || (sourceLen > numberOfElements - destLen - 1)) {
302 strDestination[0] = L'\0'; // ensure trailing \0 is written
303 return 34; // error: ERANGE
304 }
305
306 (void)wcscat(strDestination, strSource);
307 return 0;
308 }
309
310 errno_t wcscpy_s(wchar_t* strDestination, size_t numberOfElements, const wchar_t *strSource)
311 {
312 if ((strDestination == nullptr) || (strSource == nullptr)) {
313 if (strDestination != nullptr) {
314 strDestination[0] = L'\0'; // ensure trailing \0 is written
315 }
316 return 22; // error: EINVAL
317 }
318
319 if ((numberOfElements == 0) || (wcslen(strSource) >= numberOfElements)) {
320 strDestination[0] = L'\0'; // ensure trailing \0 is written
321 return 34; // error: ERANGE
322 }
323
324 (void)wcscpy(strDestination, strSource);
325 return 0;
326 }
327
328 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
SLNet::RakPeer Member List

This is the complete list of members for SLNet::RakPeer, including all inherited members.

activeSystemList | SLNet::RakPeer | protected
activeSystemListSize | SLNet::RakPeer | protected
AddPacketToProducer(SLNet::Packet *p) | SLNet::RakPeer | inlineprotected
AddToActiveSystemList(unsigned int remoteSystemListIndex) | SLNet::RakPeer | protected
AddToBanList(const char *IP, SLNet::TimeMS milliseconds=0) | SLNet::RakPeer | virtual
AddToSecurityExceptionList(const char *ip) | SLNet::RakPeer | virtual
AdvertiseSystem(const char *host, unsigned short remotePort, const char *data, int dataLength, unsigned connectionSocketIndex=0) | SLNet::RakPeer | virtual
AllocatePacket(unsigned dataSize) | SLNet::RakPeer | virtual
AllocPacket(unsigned dataSize, const char *file, unsigned int line) | SLNet::RakPeer | protected
AllocPacket(unsigned dataSize, unsigned char *data, const char *file, unsigned int line) | SLNet::RakPeer | protected
AllocRNS2RecvStruct(const char *file, unsigned int line) | SLNet::RakPeer | protectedvirtual
allowConnectionResponseIPMigration | SLNet::RakPeer | protected
AllowConnectionResponseIPMigration(bool allow) | SLNet::RakPeer | virtual
AllowIncomingConnections(void) const | SLNet::RakPeer | protected
allowInternalRouting | SLNet::RakPeer | protected
ApplyNetworkSimulator(float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance) | SLNet::RakPeer | virtual
AssignSystemAddressToRemoteSystemList(const SystemAddress systemAddress, RemoteSystemStruct::ConnectMode connectionMode, RakNetSocket2 *incomingRakNetSocket, bool *thisIPConnectedRecently, SystemAddress bindingAddress, int incomingMTU, RakNetGUID guid, bool useSecurity) | SLNet::RakPeer | protected
AttachPlugin(PluginInterface2 *plugin) | SLNet::RakPeer | virtual
banList | SLNet::RakPeer | protected
banListMutex | SLNet::RakPeer | protected
bufferedCommands | SLNet::RakPeer | protected
bufferedPacketsFreePool | SLNet::RakPeer | protected
bufferedPacketsFreePoolMutex | SLNet::RakPeer | protected
bufferedPacketsQueue | SLNet::RakPeer | protected
bufferedPacketsQueueMutex | SLNet::RakPeer | protected
bytesReceivedPerSecond | SLNet::RakPeer | protected
bytesSentPerSecond | SLNet::RakPeer | protected
CallPluginCallbacks(DataStructures::List< PluginInterface2 * > &pluginList, Packet *packet) | SLNet::RakPeer | protected
CancelConnectionAttempt(const SystemAddress target) | SLNet::RakPeer | virtual
ChangeSystemAddress(RakNetGUID guid, const SystemAddress &systemAddress) | SLNet::RakPeer | virtual
ClearBanList(void) | SLNet::RakPeer | virtual
ClearBufferedCommands(void) | SLNet::RakPeer | protected
ClearBufferedPackets(void) | SLNet::RakPeer | protected
ClearRemoteSystemLookup(void) | SLNet::RakPeer | protected
ClearRequestedConnectionList(void) | SLNet::RakPeer | protected
ClearSocketQueryOutput(void) | SLNet::RakPeer | protected
CloseConnection(const AddressOrGUID target, bool sendDisconnectionNotification, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY) | SLNet::RakPeer | virtual
CloseConnectionInternal(const AddressOrGUID &systemIdentifier, bool sendDisconnectionNotification, bool performImmediate, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority) | SLNet::RakPeer | protected
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) | SLNet::RakPeer | virtual
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) | SLNet::RakPeer | virtual
DeallocatePacket(Packet *packet) | SLNet::RakPeer | virtual
DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line) | SLNet::RakPeer | protectedvirtual
defaultMTUSize | SLNet::RakPeer | protected
defaultTimeoutTime | SLNet::RakPeer | protected
DerefAllSockets(void) | SLNet::RakPeer | protected
DereferenceRemoteSystem(const SystemAddress &sa) | SLNet::RakPeer | protected
DetachPlugin(PluginInterface2 *messageHandler) | SLNet::RakPeer | virtual
DisableSecurity(void) | SLNet::RakPeer | virtual
endThreads | SLNet::RakPeer | protected
FillIPList(void) | SLNet::RakPeer | protected
firstExternalID | SLNet::RakPeer | protected
GenerateGUID(void) | SLNet::RakPeer | protected
GenerateSeedFromGuid(void) | SLNet::RakPeer | protected
Get64BitUniqueRandomNumber(void) | SLNet::RakPeerInterface | static
GetAveragePing(const AddressOrGUID systemIdentifier) | SLNet::RakPeer | virtual
GetBestClockDifferential(const SystemAddress systemAddress) const | SLNet::RakPeer | protected
GetClientPublicKeyFromSystemAddress(const SystemAddress input, char *client_public_key) const | SLNet::RakPeer | virtual
GetClockDifferential(const AddressOrGUID systemIdentifier) | SLNet::RakPeer | virtual
GetClockDifferentialInt(RemoteSystemStruct *remoteSystem) const | SLNet::RakPeer | protected
GetConnectionList(SystemAddress *remoteSystems, unsigned short *numberOfSystems) const | SLNet::RakPeer | virtual
GetConnectionState(const AddressOrGUID systemIdentifier) | SLNet::RakPeer | virtual
GetExternalID(const SystemAddress target) const | SLNet::RakPeer | virtual
GetGUIDFromIndex(unsigned int index) | SLNet::RakPeer | virtual
GetGuidFromSystemAddress(const SystemAddress input) const | SLNet::RakPeer | virtual
GetIncomingPassword(char *passwordData, int *passwordDataLength) | SLNet::RakPeer | virtual
GetIndexFromGuid(const RakNetGUID guid) | SLNet::RakPeer | protected
GetIndexFromSystemAddress(const SystemAddress systemAddress) const | SLNet::RakPeer | virtual
GetIndexFromSystemAddress(const SystemAddress systemAddress, bool calledFromNetworkThread) const | SLNet::RakPeer | protected
GetInternalID(const SystemAddress systemAddress=UNASSIGNED_SYSTEM_ADDRESS, const int index=0) const | SLNet::RakPeer | virtual
GetLastPing(const AddressOrGUID systemIdentifier) const | SLNet::RakPeer | virtual
GetLocalIP(unsigned int index) | SLNet::RakPeer | virtual
GetLoopbackAddress(void) const | SLNet::RakPeer | protected
GetLowestPing(const AddressOrGUID systemIdentifier) const | SLNet::RakPeer | virtual
GetMaximumIncomingConnections(void) const | SLNet::RakPeer | virtual
GetMaximumNumberOfPeers(void) const | SLNet::RakPeer | virtual
GetMTUSize(const SystemAddress target) const | SLNet::RakPeer | virtual
GetMyBoundAddress(const int socketIndex=0) | SLNet::RakPeer | virtual
GetMyGUID(void) const | SLNet::RakPeer | virtual
GetNextSendReceipt(void) | SLNet::RakPeer | virtual
GetNumberOfAddresses(void) | SLNet::RakPeer | virtual
GetNumberOfRemoteInitiatedConnections(void) const | SLNet::RakPeer | protected
GetOfflinePingResponse(char **data, unsigned int *length) | SLNet::RakPeer | virtual
GetRakNetSocketFromUserConnectionSocketIndex(unsigned int userIndex) const | SLNet::RakPeer | protected
GetReceiveBufferSize(void) | SLNet::RakPeer | virtual
GetRemoteSystem(const AddressOrGUID systemIdentifier, bool calledFromNetworkThread, bool onlyActive) const | SLNet::RakPeer | protected
GetRemoteSystem(const SystemAddress &sa) const | SLNet::RakPeer | protected
GetRemoteSystemFromGUID(const RakNetGUID guid, bool onlyActive) const | SLNet::RakPeer | protected
GetRemoteSystemFromSystemAddress(const SystemAddress systemAddress, bool calledFromNetworkThread, bool onlyActive) const | SLNet::RakPeer | protected
GetRemoteSystemIndex(const SystemAddress &sa) const | SLNet::RakPeer | protected
GetSocket(const SystemAddress target) | SLNet::RakPeer | virtual
GetSockets(DataStructures::List< RakNetSocket2 * > &sockets) | SLNet::RakPeer | virtual
GetSplitMessageProgressInterval(void) const | SLNet::RakPeer | virtual
GetStatistics(const SystemAddress systemAddress, RakNetStatistics *rns=0) | SLNet::RakPeer | virtual
GetStatistics(const unsigned int index, RakNetStatistics *rns) | SLNet::RakPeer | virtual
GetStatisticsList(DataStructures::List< SystemAddress > &addresses, DataStructures::List< RakNetGUID > &guids, DataStructures::List< RakNetStatistics > &statistics) | SLNet::RakPeer | virtual
GetSystemAddressFromGuid(const RakNetGUID input) const | SLNet::RakPeer | virtual
GetSystemAddressFromIndex(unsigned int index) | SLNet::RakPeer | virtual
GetSystemIndexFromGuid(const RakNetGUID input) const | SLNet::RakPeer | protected
GetSystemList(DataStructures::List< SystemAddress > &addresses, DataStructures::List< RakNetGUID > &guids) const | SLNet::RakPeer | virtual
GetTimeoutTime(const SystemAddress target) | SLNet::RakPeer | virtual
incomingDatagramEventHandler | SLNet::RakPeer | protected
incomingPassword | SLNet::RakPeer | protected
incomingPasswordLength | SLNet::RakPeer | protected
incomingQueueMutex | SLNet::RakPeer | protected
IncrementNextSendReceipt(void) | SLNet::RakPeer | virtual
InitializeSecurity(const char *publicKey, const char *privateKey, bool bRequireClientKey=false) | SLNet::RakPeer | virtual
ipList | SLNet::RakPeer | protected
IsActive(void) const | SLNet::RakPeer | inlinevirtual
IsBanned(const char *IP) | SLNet::RakPeer | virtual
IsInSecurityExceptionList(const char *ip) | SLNet::RakPeer | virtual
IsLocalIP(const char *ip) | SLNet::RakPeer | virtual
IsLoopbackAddress(const AddressOrGUID &systemIdentifier, bool matchPort) const | SLNet::RakPeer | protected
isMainLoopThreadActive | SLNet::RakPeer | protected
IsNetworkSimulatorActive(void) | SLNet::RakPeer | virtual
limitConnectionFrequencyFromTheSameIP | SLNet::RakPeer | protected
maximumIncomingConnections | SLNet::RakPeer | protected
maximumNumberOfPeers | SLNet::RakPeer | protected
maxOutgoingBPS | SLNet::RakPeer | protected
myGuid | SLNet::RakPeer | protected
NotifyAndFlagForShutdown(const SystemAddress systemAddress, bool performImmediate, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority) | SLNet::RakPeer | protected
NUMBER_OF_RAKPEER_MUTEXES enum value | SLNet::RakPeer | protected
NumberOfConnections(void) const | SLNet::RakPeer | virtual
occasionalPing | SLNet::RakPeer | protected
offlinePingResponse | SLNet::RakPeer | protected
offlinePingResponse_Mutex enum value | SLNet::RakPeer | protected
OnConnectedPong(SLNet::Time sendPingTime, SLNet::Time sendPongTime, RemoteSystemStruct *remoteSystem) | SLNet::RakPeer | protected
OnConnectionRequest(RakPeer::RemoteSystemStruct *remoteSystem, SLNet::Time incomingTimestamp) | SLNet::RakPeer | protected
OnRNS2Recv(RNS2RecvStruct *recvStruct) | SLNet::RakPeer | protectedvirtual
packetAllocationPool | SLNet::RakPeer | protected
packetAllocationPoolMutex | SLNet::RakPeer | protected
packetReturnMutex | SLNet::RakPeer | protected
packetReturnQueue | SLNet::RakPeer | protected
ParseConnectionRequestPacket(RakPeer::RemoteSystemStruct *remoteSystem, const SystemAddress &systemAddress, const char *data, int byteSize) | SLNet::RakPeer | protected
Ping(const SystemAddress target) | SLNet::RakPeer | virtual
Ping(const char *host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections, unsigned connectionSocketIndex=0) | SLNet::RakPeer | virtual
PingInternal(const SystemAddress target, bool performImmediate, PacketReliability reliability) | SLNet::RakPeer | protected
pluginListNTS | SLNet::RakPeer | protected
pluginListTS | SLNet::RakPeer | protected
PopBufferedPacket(void) | SLNet::RakPeer | protected
ProcessNetworkPacket(const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, SLNet::TimeUS timeRead, BitStream &updateBitStream) | SLNet::RakPeer | friend
ProcessNetworkPacket(const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2 *rakNetSocket, SLNet::TimeUS timeRead, BitStream &updateBitStream) | SLNet::RakPeer | friend
ProcessOfflineNetworkPacket(SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2 *rakNetSocket, bool *isOfflineMessage, SLNet::TimeUS timeRead) | SLNet::RakPeer | friend
PushBackPacket(Packet *packet, bool pushAtHead) | SLNet::RakPeer | virtual
PushBufferedPacket(RNS2RecvStruct *p) | SLNet::RakPeer | protected
quitAndDataEvents | SLNet::RakPeer | protected
RAK_THREAD_DECLARATION(UpdateNetworkLoop) | SLNet::RakPeer | protected
RAK_THREAD_DECLARATION(UDTConnect) | SLNet::RakPeer | protected
RakPeer() | SLNet::RakPeer |
rakPeerMutexes | SLNet::RakPeer | protected
Receive(void) | SLNet::RakPeer | virtual
ReferenceRemoteSystem(const SystemAddress &sa, unsigned int remoteSystemListIndex) | SLNet::RakPeer | protected
ReleaseSockets(DataStructures::List< RakNetSocket2 * > &sockets) | SLNet::RakPeer | virtual
remoteSystemIndexPool | SLNet::RakPeer | protected
remoteSystemList | SLNet::RakPeer | protected
remoteSystemLookup | SLNet::RakPeer | protected
RemoteSystemLookupHashIndex(const SystemAddress &sa) const | SLNet::RakPeer | protected
RemoveFromActiveSystemList(const SystemAddress &sa) | SLNet::RakPeer | protected
RemoveFromBanList(const char *IP) | SLNet::RakPeer | virtual
RemoveFromSecurityExceptionList(const char *ip) | SLNet::RakPeer | virtual
replyFromTargetBroadcast | SLNet::RakPeer | protected
replyFromTargetBS | SLNet::RakPeer | protected
replyFromTargetPlayer | SLNet::RakPeer | protected
requestedConnectionList_Mutex enum value | SLNet::RakPeer | protected
requestedConnectionQueue | SLNet::RakPeer | protected
requestedConnectionQueueMutex | SLNet::RakPeer | protected
ResetSendReceipt(void) | SLNet::RakPeer | protected
RNS2EventHandler() | SLNet::RNS2EventHandler | inline
RunUpdateCycle(BitStream &updateBitStream) | SLNet::RakPeer | virtual
securityExceptionList | SLNet::RakPeer | protected
securityExceptionMutex | SLNet::RakPeer | protected
Send(const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0) | SLNet::RakPeer | virtual
Send(const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0) | SLNet::RakPeer | virtual
SendBuffered(const char *data, BitSize_t numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, RemoteSystemStruct::ConnectMode connectionMode, uint32_t receipt) | SLNet::RakPeer | protected
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) | SLNet::RakPeer | protected
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) | SLNet::RakPeer | protected
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) | SLNet::RakPeer | protected
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) | SLNet::RakPeer | protected
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) | SLNet::RakPeer | virtual
SendLoopback(const char *data, const int length) | SLNet::RakPeer | virtual
SendOutOfBand(const char *host, unsigned short remotePort, const char *data, BitSize_t dataLength, unsigned connectionSocketIndex=0) | SLNet::RakPeer | virtual
sendReceiptSerial | SLNet::RakPeer | protected
sendReceiptSerialMutex | SLNet::RakPeer | protected
SendTTL(const char *host, unsigned short remotePort, int ttl, unsigned connectionSocketIndex=0) | SLNet::RakPeer | virtual
SetIncomingDatagramEventHandler(bool(*_incomingDatagramEventHandler)(RNS2RecvStruct *)) | SLNet::RakPeer | virtual
SetIncomingPassword(const char *passwordData, int passwordDataLength) | SLNet::RakPeer | virtual
SetInternalID(SystemAddress systemAddress, int index=0) | SLNet::RakPeer | virtual
SetLimitIPConnectionFrequency(bool b) | SLNet::RakPeer | virtual
SetMaximumIncomingConnections(unsigned short numberAllowed) | SLNet::RakPeer | virtual
SetOccasionalPing(bool doPing) | SLNet::RakPeer | virtual
SetOfflinePingResponse(const char *data, const unsigned int length) | SLNet::RakPeer | virtual
SetPerConnectionOutgoingBandwidthLimit(unsigned maxBitsPerSecond) | SLNet::RakPeer | virtual
SetSplitMessageProgressInterval(int interval) | SLNet::RakPeer | virtual
SetTimeoutTime(SLNet::TimeMS timeMS, const SystemAddress target) | SLNet::RakPeer | virtual
SetUnreliableTimeout(SLNet::TimeMS timeoutMS) | SLNet::RakPeer | virtual
SetupBufferedPackets(void) | SLNet::RakPeer | protected
SetUserUpdateThread(void(*_userUpdateThreadPtr)(RakPeerInterface *, void *), void *_userUpdateThreadData) | SLNet::RakPeer | virtual
ShiftIncomingTimestamp(unsigned char *data, const SystemAddress &systemAddress) const | SLNet::RakPeer | protected
Shutdown(unsigned int blockDuration, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY) | SLNet::RakPeer | virtual
socketList | SLNet::RakPeer | protected
socketQueryOutput | SLNet::RakPeer | protected
splitMessageProgressInterval | SLNet::RakPeer | protected
Startup(unsigned int maxConnections, SocketDescriptor *socketDescriptors, unsigned socketDescriptorCount, int threadPriority=-99999) | SLNet::RakPeer | virtual
trackFrequencyTable | SLNet::RakPeer | protected
unreliableTimeout | SLNet::RakPeer | protected
updateCycleIsRunning | SLNet::RakPeer | protected
userUpdateThreadData | SLNet::RakPeer | protected
userUpdateThreadPtr | SLNet::RakPeer | protected
ValidateRemoteSystemLookup(void) const | SLNet::RakPeer | protected
validationInteger | SLNet::RakPeer | protected
WriteOutOfBandHeader(SLNet::BitStream *bitStream) | SLNet::RakPeer | virtual
~RakPeer() | SLNet::RakPeer | virtual
~RakPeerInterface() | SLNet::RakPeerInterface | inlinevirtual
~RNS2EventHandler() | SLNet::RNS2EventHandler | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FileList
SLNet::FileList Member List

This is the complete list of members for SLNet::FileList, including all inherited members.

AddCallback(FileListProgress *cb) | SLNet::FileList |
AddFile(const char *filename, const char *fullPathToFile, const char *data, const unsigned dataLength, const unsigned fileLength, FileListNodeContext context, bool isAReference=false, bool takeDataPointer=false) | SLNet::FileList |
AddFile(const char *filepath, const char *filename, FileListNodeContext context) | SLNet::FileList |
AddFilesFromDirectory(const char *applicationDirectory, const char *subDirectory, bool writeHash, bool writeData, bool recursive, FileListNodeContext context) | SLNet::FileList |
Clear(void) | SLNet::FileList |
ClearCallbacks(void) | SLNet::FileList |
DeleteFiles(const char *applicationDirectory) | SLNet::FileList |
Deserialize(SLNet::BitStream *inBitStream) | SLNet::FileList |
fileList | SLNet::FileList |
FileList() | SLNet::FileList |
fileListProgressCallbacks | SLNet::FileList | protected
FixEndingSlash(char *str) | SLNet::FileList | static
FixEndingSlash(char *str, size_t strLength) | SLNet::FileList | static
FlagFilesAsReferences(void) | SLNet::FileList |
GetCallbacks(DataStructures::List< FileListProgress * > &callbacks) | SLNet::FileList |
GetDeltaToCurrent(FileList *input, FileList *output, const char *dirSubset, const char *remoteSubdir) | SLNet::FileList |
ListMissingOrChangedFiles(const char *applicationDirectory, FileList *missingOrChangedFiles, bool alwaysWriteHash, bool neverWriteHash) | SLNet::FileList |
PopulateDataFromDisk(const char *applicationDirectory, bool writeFileData, bool writeFileHash, bool removeUnknownFiles) | SLNet::FileList |
RemoveCallback(FileListProgress *cb) | SLNet::FileList |
Serialize(SLNet::BitStream *outBitStream) | SLNet::FileList |
WriteDataToDisk(const char *applicationDirectory) | SLNet::FileList |
~FileList() | SLNet::FileList |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/assert.h Source File

  • include
  • slikenet
assert.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include <assert.h>
17 #include "defines.h"
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/VariadicSQLParser.h Source File

  • include
  • slikenet
VariadicSQLParser.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __VARIADIC_SQL_PARSER_H
12 #define __VARIADIC_SQL_PARSER_H
13
14 #include "DS_List.h"
15
16 #include <stdarg.h>
17
18 namespace VariadicSQLParser
19 {
20 struct IndexAndType
21 {
22 unsigned int strIndex;
23 unsigned int typeMappingIndex;
24 };
25 const char* GetTypeMappingAtIndex(int i);
26 void GetTypeMappingIndices( const char *format, DataStructures::List<IndexAndType> &indices );
27 // Given an SQL string with variadic arguments, allocate argumentBinary and argumentLengths, and hold the parameters in binary format
28 // Last 2 parameters are out parameters
29 void ExtractArguments( va_list argptr, const DataStructures::List<IndexAndType> &indices, char ***argumentBinary, int **argumentLengths );
30 void FreeArguments(const DataStructures::List<IndexAndType> &indices, char **argumentBinary, int *argumentLengths);
31 }
32
33
34 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/BitStream.cpp Source File

  • src
BitStream.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19 #include "slikenet/BitStream.h"
20 #include <stdio.h>
21 #include <string.h>
22 #include <stdlib.h>
23
24 #include "slikenet/SocketIncludes.h"
25 #include "slikenet/defines.h"
26
27
28
29 #if defined(_WIN32)
30 #include "slikenet/WindowsIncludes.h"
31 #include <memory.h>
32 #include <cmath>
33 #include <float.h>
34
35
36
37
38 #else
39 #include <arpa/inet.h>
40 #include <memory.h>
41 #if defined(ANDROID)
42 #include <math.h>
43 #else
44 #include <cmath>
45 #endif
46 #include <float.h>
47 #endif
48 #include "slikenet/linux_adapter.h"
49 #include "slikenet/osx_adapter.h"
50
51 // MSWin uses _copysign, others use copysign...
52 #ifndef _WIN32
53 #define _copysign copysign
54 #endif
55
56 using namespace SLNet;
57
58 STATIC_FACTORY_DEFINITIONS(BitStream,BitStream)
59
60 BitStream::BitStream()
61 {
62 numberOfBitsUsed = 0;
63 //numberOfBitsAllocated = 32 * 8;
64 numberOfBitsAllocated = BITSTREAM_STACK_ALLOCATION_SIZE * 8;
65 readOffset = 0;
66 //data = ( unsigned char* ) rakMalloc_Ex( 32, _FILE_AND_LINE_ );
67 data = ( unsigned char* ) stackData;
68
69 #ifdef _DEBUG
70 // RakAssert( data );
71 #endif
72 //memset(data, 0, 32);
73 copyData = true;
74 }
75
76 BitStream::BitStream( const unsigned int initialBytesToAllocate )
77 {
78 numberOfBitsUsed = 0;
79 readOffset = 0;
80 if (initialBytesToAllocate <= BITSTREAM_STACK_ALLOCATION_SIZE)
81 {
82 data = ( unsigned char* ) stackData;
83 numberOfBitsAllocated = BITSTREAM_STACK_ALLOCATION_SIZE * 8;
84 }
85 else
86 {
87 data = ( unsigned char* ) rakMalloc_Ex( (size_t) initialBytesToAllocate, _FILE_AND_LINE_ );
88 numberOfBitsAllocated = initialBytesToAllocate << 3;
89 }
90 #ifdef _DEBUG
91 RakAssert( data );
92 #endif
93 // memset(data, 0, initialBytesToAllocate);
94 copyData = true;
95 }
96
97 BitStream::BitStream( unsigned char* _data, const unsigned int lengthInBytes, bool _copyData )
98 {
99 numberOfBitsUsed = lengthInBytes << 3;
100 readOffset = 0;
101 copyData = _copyData;
102 numberOfBitsAllocated = lengthInBytes << 3;
103
104 if ( copyData )
105 {
106 if ( lengthInBytes > 0 )
107 {
108 if (lengthInBytes < BITSTREAM_STACK_ALLOCATION_SIZE)
109 {
110 data = ( unsigned char* ) stackData;
111 numberOfBitsAllocated = BITSTREAM_STACK_ALLOCATION_SIZE << 3;
112 }
113 else
114 {
115 data = ( unsigned char* ) rakMalloc_Ex( (size_t) lengthInBytes, _FILE_AND_LINE_ );
116 }
117 #ifdef _DEBUG
118 RakAssert( data );
119 #endif
120 memcpy( data, _data, (size_t) lengthInBytes );
121 }
122 else
123 data = 0;
124 }
125 else
126 data = ( unsigned char* ) _data;
127 }
128
129 // Use this if you pass a pointer copy to the constructor (_copyData==false) and want to overallocate to prevent reallocation
130 void BitStream::SetNumberOfBitsAllocated( const BitSize_t lengthInBits )
131 {
132 #ifdef _DEBUG
133 RakAssert( lengthInBits >= ( BitSize_t ) numberOfBitsAllocated );
134 #endif
135 numberOfBitsAllocated = lengthInBits;
136 }
137
138 BitStream::~BitStream()
139 {
140 if ( copyData && numberOfBitsAllocated > (BITSTREAM_STACK_ALLOCATION_SIZE << 3))
141 rakFree_Ex( data , _FILE_AND_LINE_ ); // Use realloc and free so we are more efficient than delete and new for resizing
142 }
143
144 void BitStream::Reset( void )
145 {
146 // Note: Do NOT reallocate memory because BitStream is used
147 // in places to serialize/deserialize a buffer. Reallocation
148 // is a dangerous operation (may result in leaks).
149
150 if ( numberOfBitsUsed > 0 )
151 {
152 // memset(data, 0, BITS_TO_BYTES(numberOfBitsUsed));
153 }
154
155 // Don't free memory here for speed efficiency
156 //free(data); // Use realloc and free so we are more efficient than delete and new for resizing
157 numberOfBitsUsed = 0;
158
159 //numberOfBitsAllocated=8;
160 readOffset = 0;
161
162 //data=(unsigned char*)rakMalloc_Ex(1, _FILE_AND_LINE_);
163 // if (numberOfBitsAllocated>0)
164 // memset(data, 0, BITS_TO_BYTES(numberOfBitsAllocated));
165 }
166
167 // Write an array or casted stream
168 void BitStream::Write( const char* inputByteArray, const unsigned int numberOfBytes )
169 {
170 if (numberOfBytes==0)
171 return;
172
173 // Optimization:
174 if ((numberOfBitsUsed & 7) == 0)
175 {
176 AddBitsAndReallocate( BYTES_TO_BITS(numberOfBytes) );
177 memcpy(data+BITS_TO_BYTES(numberOfBitsUsed), inputByteArray, (size_t) numberOfBytes);
178 numberOfBitsUsed+=BYTES_TO_BITS(numberOfBytes);
179 }
180 else
181 {
182 WriteBits( ( unsigned char* ) inputByteArray, numberOfBytes * 8, true );
183 }
184
185 }
186 void BitStream::Write( BitStream *bitStream)
187 {
188 Write(bitStream, bitStream->GetNumberOfBitsUsed()-bitStream->GetReadOffset());
189 }
190 void BitStream::Write( BitStream *bitStream, BitSize_t numberOfBits )
191 {
192 if (numberOfBits > bitStream->GetNumberOfUnreadBits())
193 return;
194
195 AddBitsAndReallocate( numberOfBits );
196 BitSize_t numberOfBitsMod8;
197
198 if ((bitStream->GetReadOffset()&7)==0 && (numberOfBitsUsed&7)==0)
199 {
200 int readOffsetBytes=bitStream->GetReadOffset()/8;
201 int numBytes=numberOfBits/8;
202 memcpy(data + (numberOfBitsUsed >> 3), bitStream->GetData()+readOffsetBytes, numBytes);
203 numberOfBits-=BYTES_TO_BITS(numBytes);
204 bitStream->SetReadOffset(BYTES_TO_BITS(numBytes+readOffsetBytes));
205 numberOfBitsUsed+=BYTES_TO_BITS(numBytes);
206 }
207
208 while (numberOfBits-->0)
209 {
210 numberOfBitsMod8 = numberOfBitsUsed & 7;
211 if ( numberOfBitsMod8 == 0 )
212 {
213 // New byte
214 if (bitStream->data[ bitStream->readOffset >> 3 ] & ( 0x80 >> ( bitStream->readOffset & 7 ) ) )
215 {
216 // Write 1
217 data[ numberOfBitsUsed >> 3 ] = 0x80;
218 }
219 else
220 {
221 // Write 0
222 data[ numberOfBitsUsed >> 3 ] = 0;
223 }
224
225 }
226 else
227 {
228 // Existing byte
229 if (bitStream->data[ bitStream->readOffset >> 3 ] & ( 0x80 >> ( bitStream->readOffset & 7 ) ) )
230 data[ numberOfBitsUsed >> 3 ] |= 0x80 >> ( numberOfBitsMod8 ); // Set the bit to 1
231 // else 0, do nothing
232 }
233
234 bitStream->readOffset++;
235 numberOfBitsUsed++;
236 }
237 }
238 void BitStream::Write( BitStream &bitStream, BitSize_t numberOfBits )
239 {
240 Write(&bitStream, numberOfBits);
241 }
242 void BitStream::Write( BitStream &bitStream )
243 {
244 Write(&bitStream);
245 }
246 bool BitStream::Read( BitStream *bitStream, BitSize_t numberOfBits )
247 {
248 if (GetNumberOfUnreadBits() < numberOfBits)
249 return false;
250 bitStream->Write(this, numberOfBits);
251 return true;
252 }
253 bool BitStream::Read( BitStream *bitStream )
254 {
255 bitStream->Write(this);
256 return true;
257 }
258 bool BitStream::Read( BitStream &bitStream, BitSize_t numberOfBits )
259 {
260 if (GetNumberOfUnreadBits() < numberOfBits)
261 return false;
262 bitStream.Write(this, numberOfBits);
263 return true;
264 }
265 bool BitStream::Read( BitStream &bitStream )
266 {
267 bitStream.Write(this);
268 return true;
269 }
270
271 // Read an array or casted stream
272 bool BitStream::Read( char* outByteArray, const unsigned int numberOfBytes )
273 {
274 // Optimization:
275 if ((readOffset & 7) == 0)
276 {
277 if (GetNumberOfUnreadBits() < (numberOfBytes << 3))
278 return false;
279
280 // Write the data
281 memcpy( outByteArray, data + ( readOffset >> 3 ), (size_t) numberOfBytes );
282
283 readOffset += numberOfBytes << 3;
284 return true;
285 }
286 else
287 {
288 return ReadBits( ( unsigned char* ) outByteArray, numberOfBytes * 8 );
289 }
290 }
291
292 // Sets the read pointer back to the beginning of your data.
293 void BitStream::ResetReadPointer( void )
294 {
295 readOffset = 0;
296 }
297
298 // Sets the write pointer back to the beginning of your data.
299 void BitStream::ResetWritePointer( void )
300 {
301 numberOfBitsUsed = 0;
302 }
303
304 // Write a 0
305 void BitStream::Write0( void )
306 {
307 AddBitsAndReallocate( 1 );
308
309 // New bytes need to be zeroed
310 if ( ( numberOfBitsUsed & 7 ) == 0 )
311 data[ numberOfBitsUsed >> 3 ] = 0;
312
313 numberOfBitsUsed++;
314 }
315
316 // Write a 1
317 void BitStream::Write1( void )
318 {
319 AddBitsAndReallocate( 1 );
320
321 BitSize_t numberOfBitsMod8 = numberOfBitsUsed & 7;
322
323 if ( numberOfBitsMod8 == 0 )
324 data[ numberOfBitsUsed >> 3 ] = 0x80;
325 else
326 data[ numberOfBitsUsed >> 3 ] |= 0x80 >> ( numberOfBitsMod8 ); // Set the bit to 1
327
328 numberOfBitsUsed++;
329 }
330
331 // Returns true if the next data read is a 1, false if it is a 0
332 bool BitStream::ReadBit( void )
333 {
334 if (GetNumberOfUnreadBits() == 0) {
335 return false;
336 }
337
338 bool result = ( data[ readOffset >> 3 ] & ( 0x80 >> ( readOffset & 7 ) ) ) !=0;
339 readOffset++;
340 return result;
341 }
342
343 // Align the bitstream to the byte boundary and then write the specified number of bits.
344 // This is faster than WriteBits but wastes the bits to do the alignment and requires you to call
345 // SetReadToByteAlignment at the corresponding read position
346 void BitStream::WriteAlignedBytes( const unsigned char* inByteArray, const unsigned int numberOfBytesToWrite )
347 {
348 AlignWriteToByteBoundary();
349 Write((const char*) inByteArray, numberOfBytesToWrite);
350 }
351 void BitStream::EndianSwapBytes( int byteOffset, int length )
352 {
353 if (DoEndianSwap())
354 {
355 ReverseBytesInPlace(data+byteOffset, length);
356 }
357 }
359 void BitStream::WriteAlignedBytesSafe( const char *inByteArray, const unsigned int inputLength, const unsigned int maxBytesToWrite )
360 {
361 if (inByteArray==0 || inputLength==0)
362 {
363 WriteCompressed((unsigned int)0);
364 return;
365 }
366 WriteCompressed(inputLength);
367 WriteAlignedBytes((const unsigned char*) inByteArray, inputLength < maxBytesToWrite ? inputLength : maxBytesToWrite);
368 }
369
370 // Read bits, starting at the next aligned bits. Note that the modulus 8 starting offset of the
371 // sequence must be the same as was used with WriteBits. This will be a problem with packet coalescence
372 // unless you byte align the coalesced packets.
373 bool BitStream::ReadAlignedBytes( unsigned char* inOutByteArray, const unsigned int numberOfBytesToRead )
374 {
375 #ifdef _DEBUG
376 RakAssert( numberOfBytesToRead > 0 );
377 #endif
378
379 if ( numberOfBytesToRead <= 0 )
380 return false;
381
382 // Byte align
383 AlignReadToByteBoundary();
384
385 if (GetNumberOfUnreadBits() < (numberOfBytesToRead << 3))
386 return false;
387
388 // Write the data
389 memcpy( inOutByteArray, data + ( readOffset >> 3 ), (size_t) numberOfBytesToRead );
390
391 readOffset += numberOfBytesToRead << 3;
392
393 return true;
394 }
395 bool BitStream::ReadAlignedBytesSafe( char *inOutByteArray, int &inputLength, const int maxBytesToRead )
396 {
397 return ReadAlignedBytesSafe(inOutByteArray,(unsigned int&) inputLength,(unsigned int)maxBytesToRead);
398 }
399 bool BitStream::ReadAlignedBytesSafe( char *inOutByteArray, unsigned int &inputLength, const unsigned int maxBytesToRead )
400 {
401 if (ReadCompressed(inputLength)==false)
402 return false;
403 if (inputLength > maxBytesToRead)
404 inputLength=maxBytesToRead;
405 if (inputLength==0)
406 return true;
407 return ReadAlignedBytes((unsigned char*) inOutByteArray, inputLength);
408 }
409 bool BitStream::ReadAlignedBytesSafeAlloc( char **outByteArray, int &inputLength, const unsigned int maxBytesToRead )
410 {
411 return ReadAlignedBytesSafeAlloc(outByteArray,(unsigned int&) inputLength, maxBytesToRead);
412 }
413 bool BitStream::ReadAlignedBytesSafeAlloc( char ** outByteArray, unsigned int &inputLength, const unsigned int maxBytesToRead )
414 {
415 rakFree_Ex(*outByteArray, _FILE_AND_LINE_ );
416 *outByteArray=0;
417 if (ReadCompressed(inputLength)==false)
418 return false;
419 if (inputLength > maxBytesToRead)
420 inputLength=maxBytesToRead;
421 if (inputLength==0)
422 return true;
423 *outByteArray = (char*) rakMalloc_Ex( (size_t) inputLength, _FILE_AND_LINE_ );
424 return ReadAlignedBytes((unsigned char*) *outByteArray, inputLength);
425 }
426
427 // Write numberToWrite bits from the input source
428 void BitStream::WriteBits( const unsigned char* inByteArray, BitSize_t numberOfBitsToWrite, const bool rightAlignedBits )
429 {
430 // if (numberOfBitsToWrite<=0)
431 // return;
432
433 AddBitsAndReallocate( numberOfBitsToWrite );
434
435 const BitSize_t numberOfBitsUsedMod8 = numberOfBitsUsed & 7;
436
437 // If currently aligned and numberOfBits is a multiple of 8, just memcpy for speed
438 if (numberOfBitsUsedMod8==0 && (numberOfBitsToWrite&7)==0)
439 {
440 memcpy( data + ( numberOfBitsUsed >> 3 ), inByteArray, numberOfBitsToWrite>>3);
441 numberOfBitsUsed+=numberOfBitsToWrite;
442 return;
443 }
444
445 unsigned char dataByte;
446 const unsigned char* inputPtr=inByteArray;
447
448 // Faster to put the while at the top surprisingly enough
449 while ( numberOfBitsToWrite > 0 )
450 //do
451 {
452 dataByte = *( inputPtr++ );
453
454 if ( numberOfBitsToWrite < 8 && rightAlignedBits ) // rightAlignedBits means in the case of a partial byte, the bits are aligned from the right (bit 0) rather than the left (as in the normal internal representation)
455 dataByte <<= 8 - numberOfBitsToWrite; // shift left to get the bits on the left, as in our internal representation
456
457 // Writing to a new byte each time
458 if ( numberOfBitsUsedMod8 == 0 )
459 * ( data + ( numberOfBitsUsed >> 3 ) ) = dataByte;
460 else
461 {
462 // Copy over the new data.
463 *( data + ( numberOfBitsUsed >> 3 ) ) |= dataByte >> ( numberOfBitsUsedMod8 ); // First half
464
465 if ( 8 - ( numberOfBitsUsedMod8 ) < 8 && 8 - ( numberOfBitsUsedMod8 ) < numberOfBitsToWrite ) // If we didn't write it all out in the first half (8 - (numberOfBitsUsed%8) is the number we wrote in the first half)
466 {
467 *( data + ( numberOfBitsUsed >> 3 ) + 1 ) = (unsigned char) ( dataByte << ( 8 - ( numberOfBitsUsedMod8 ) ) ); // Second half (overlaps byte boundary)
468 }
469 }
470
471 if ( numberOfBitsToWrite >= 8 )
472 {
473 numberOfBitsUsed += 8;
474 numberOfBitsToWrite -= 8;
475 }
476 else
477 {
478 numberOfBitsUsed += numberOfBitsToWrite;
479 numberOfBitsToWrite=0;
480 }
481 }
482 // } while(numberOfBitsToWrite>0);
483 }
484
485 // Set the stream to some initial data. For internal use
486 void BitStream::SetData( unsigned char *inByteArray )
487 {
488 data=inByteArray;
489 copyData=false;
490 }
491
492 // Assume the input source points to a native type, compress and write it
493 void BitStream::WriteCompressed( const unsigned char* inByteArray,
494 const unsigned int size, const bool unsignedData )
495 {
496 BitSize_t currentByte = ( size >> 3 ) - 1; // PCs
497
498 unsigned char byteMatch;
499
500 if ( unsignedData )
501 {
502 byteMatch = 0;
503 }
504
505 else
506 {
507 byteMatch = 0xFF;
508 }
509
510 // Write upper bytes with a single 1
511 // From high byte to low byte, if high byte is a byteMatch then write a 1 bit. Otherwise write a 0 bit and then write the remaining bytes
512 while ( currentByte > 0 )
513 {
514 if ( inByteArray[ currentByte ] == byteMatch ) // If high byte is byteMatch (0 of 0xff) then it would have the same value shifted
515 {
516 bool b = true;
517 Write( b );
518 }
519 else
520 {
521 // Write the remainder of the data after writing 0
522 bool b = false;
523 Write( b );
524
525 WriteBits( inByteArray, ( currentByte + 1 ) << 3, true );
526 // currentByte--;
527
528
529 return ;
530 }
531
532 currentByte--;
533 }
534
535 // If the upper half of the last byte is a 0 (positive) or 16 (negative) then write a 1 and the remaining 4 bits. Otherwise write a 0 and the 8 bites.
536 if ( ( unsignedData && ( ( *( inByteArray + currentByte ) ) & 0xF0 ) == 0x00 ) ||
537 ( unsignedData == false && ( ( *( inByteArray + currentByte ) ) & 0xF0 ) == 0xF0 ) )
538 {
539 bool b = true;
540 Write( b );
541 WriteBits( inByteArray + currentByte, 4, true );
542 }
543
544 else
545 {
546 bool b = false;
547 Write( b );
548 WriteBits( inByteArray + currentByte, 8, true );
549 }
550 }
551
552 // Read numberOfBitsToRead bits to the output source
553 // alignBitsToRight should be set to true to convert internal bitstream data to userdata
554 // It should be false if you used WriteBits with rightAlignedBits false
555 bool BitStream::ReadBits( unsigned char *inOutByteArray, BitSize_t numberOfBitsToRead, const bool alignBitsToRight )
556 {
557 #ifdef _DEBUG
558 // RakAssert( numberOfBitsToRead > 0 );
559 #endif
560 if (numberOfBitsToRead<=0)
561 return false;
562
563 if (GetNumberOfUnreadBits() < numberOfBitsToRead)
564 return false;
565
566
567 const BitSize_t readOffsetMod8 = readOffset & 7;
568
569 // If currently aligned and numberOfBits is a multiple of 8, just memcpy for speed
570 if (readOffsetMod8==0 && (numberOfBitsToRead&7)==0)
571 {
572 memcpy( inOutByteArray, data + ( readOffset >> 3 ), numberOfBitsToRead>>3);
573 readOffset+=numberOfBitsToRead;
574 return true;
575 }
576
577
578
579 BitSize_t offset = 0;
580
581 memset( inOutByteArray, 0, (size_t) BITS_TO_BYTES( numberOfBitsToRead ) );
582
583 while ( numberOfBitsToRead > 0 )
584 {
585 *( inOutByteArray + offset ) |= *( data + ( readOffset >> 3 ) ) << ( readOffsetMod8 ); // First half
586
587 if ( readOffsetMod8 > 0 && numberOfBitsToRead > 8 - ( readOffsetMod8 ) ) // If we have a second half, we didn't read enough bytes in the first half
588 *( inOutByteArray + offset ) |= *( data + ( readOffset >> 3 ) + 1 ) >> ( 8 - ( readOffsetMod8 ) ); // Second half (overlaps byte boundary)
589
590 if (numberOfBitsToRead>=8)
591 {
592 numberOfBitsToRead -= 8;
593 readOffset += 8;
594 offset++;
595 }
596 else
597 {
598 int neg = (int) numberOfBitsToRead - 8;
599
600 if ( neg < 0 ) // Reading a partial byte for the last byte, shift right so the data is aligned on the right
601 {
602
603 if ( alignBitsToRight )
604 * ( inOutByteArray + offset ) >>= -neg;
605
606 readOffset += 8 + neg;
607 }
608 else
609 readOffset += 8;
610
611 offset++;
612
613 numberOfBitsToRead=0;
614 }
615 }
616
617 return true;
618 }
619
620 // Assume the input source points to a compressed native type. Decompress and read it
621 bool BitStream::ReadCompressed( unsigned char* inOutByteArray,
622 const unsigned int size, const bool unsignedData )
623 {
624 unsigned int currentByte = ( size >> 3 ) - 1;
625
626
627 unsigned char byteMatch, halfByteMatch;
628
629 if ( unsignedData )
630 {
631 byteMatch = 0;
632 halfByteMatch = 0;
633 }
634
635 else
636 {
637 byteMatch = 0xFF;
638 halfByteMatch = 0xF0;
639 }
640
641 // Upper bytes are specified with a single 1 if they match byteMatch
642 // From high byte to low byte, if high byte is a byteMatch then write a 1 bit. Otherwise write a 0 bit and then write the remaining bytes
643 while ( currentByte > 0 )
644 {
645 // If we read a 1 then the data is byteMatch.
646
647 bool b;
648
649 if ( Read( b ) == false )
650 return false;
651
652 if ( b ) // Check that bit
653 {
654 inOutByteArray[ currentByte ] = byteMatch;
655 currentByte--;
656 }
657 else
658 {
659 // Read the rest of the bytes
660
661 if ( ReadBits( inOutByteArray, ( currentByte + 1 ) << 3 ) == false )
662 return false;
663
664 return true;
665 }
666 }
667
668 // All but the first bytes are byteMatch. If the upper half of the last byte is a 0 (positive) or 16 (negative) then what we read will be a 1 and the remaining 4 bits.
669 // Otherwise we read a 0 and the 8 bytes
670 //RakAssert(readOffset+1 <=numberOfBitsUsed); // If this assert is hit the stream wasn't long enough to read from
671 if ( readOffset + 1 > numberOfBitsUsed )
672 return false;
673
674 bool b=false;
675
676 if ( Read( b ) == false )
677 return false;
678
679 if ( b ) // Check that bit
680 {
681
682 if ( ReadBits( inOutByteArray + currentByte, 4 ) == false )
683 return false;
684
685 inOutByteArray[ currentByte ] |= halfByteMatch; // We have to set the high 4 bits since these are set to 0 by ReadBits
686 }
687 else
688 {
689 if ( ReadBits( inOutByteArray + currentByte, 8 ) == false )
690 return false;
691 }
692
693 return true;
694 }
695
696 // Reallocates (if necessary) in preparation of writing numberOfBitsToWrite
697 void BitStream::AddBitsAndReallocate( const BitSize_t numberOfBitsToWrite )
698 {
699 BitSize_t newNumberOfBitsAllocated = numberOfBitsToWrite + numberOfBitsUsed;
700
701 if ( numberOfBitsToWrite + numberOfBitsUsed > 0 && ( ( numberOfBitsAllocated - 1 ) >> 3 ) < ( ( newNumberOfBitsAllocated - 1 ) >> 3 ) ) // If we need to allocate 1 or more new bytes
702 {
703 #ifdef _DEBUG
704 // If this assert hits then we need to specify true for the third parameter in the constructor
705 // It needs to reallocate to hold all the data and can't do it unless we allocated to begin with
706 // Often hits if you call Write or Serialize on a read-only bitstream
707 RakAssert( copyData == true );
708 #endif
709
710 // Less memory efficient but saves on news and deletes
712 newNumberOfBitsAllocated = ( numberOfBitsToWrite + numberOfBitsUsed ) * 2;
713 if (newNumberOfBitsAllocated - ( numberOfBitsToWrite + numberOfBitsUsed ) > 1048576 )
714 newNumberOfBitsAllocated = numberOfBitsToWrite + numberOfBitsUsed + 1048576;
715
716 // BitSize_t newByteOffset = BITS_TO_BYTES( numberOfBitsAllocated );
717 // Use realloc and free so we are more efficient than delete and new for resizing
718 BitSize_t amountToAllocate = BITS_TO_BYTES( newNumberOfBitsAllocated );
719 if (data==(unsigned char*)stackData)
720 {
721 if (amountToAllocate > BITSTREAM_STACK_ALLOCATION_SIZE)
722 {
723 data = ( unsigned char* ) rakMalloc_Ex( (size_t) amountToAllocate, _FILE_AND_LINE_ );
724 RakAssert(data);
725
726 // need to copy the stack data over to our new memory area too
727 memcpy ((void *)data, (void *)stackData, (size_t) BITS_TO_BYTES( numberOfBitsAllocated ));
728 }
729 }
730 else
731 {
732 data = ( unsigned char* ) rakRealloc_Ex( data, (size_t) amountToAllocate, _FILE_AND_LINE_ );
733 }
734
735 #ifdef _DEBUG
736 RakAssert( data ); // Make sure realloc succeeded
737 #endif
738 // memset(data+newByteOffset, 0, ((newNumberOfBitsAllocated-1)>>3) - ((numberOfBitsAllocated-1)>>3)); // Set the new data block to 0
739 }
740
741 if ( newNumberOfBitsAllocated > numberOfBitsAllocated )
742 numberOfBitsAllocated = newNumberOfBitsAllocated;
743 }
744 BitSize_t BitStream::GetNumberOfBitsAllocated(void) const
745 {
746 return numberOfBitsAllocated;
747 }
748 void BitStream::PadWithZeroToByteLength( unsigned int bytes )
749 {
750 if (GetNumberOfBytesUsed() < bytes)
751 {
752 AlignWriteToByteBoundary();
753 unsigned int numToWrite = bytes - GetNumberOfBytesUsed();
754 AddBitsAndReallocate( BYTES_TO_BITS(numToWrite) );
755 memset(data+BITS_TO_BYTES(numberOfBitsUsed), 0, (size_t) numToWrite);
756 numberOfBitsUsed+=BYTES_TO_BITS(numToWrite);
757 }
758 }
759
760 /*
761 // Julius Goryavsky's version of Harley's algorithm.
762 // 17 elementary ops plus an indexed load, if the machine
763 // has "and not."
764
765 int nlz10b(unsigned x) {
766
767 static char table[64] =
768 {32,20,19, u, u,18, u, 7, 10,17, u, u,14, u, 6, u,
769 u, 9, u,16, u, u, 1,26, u,13, u, u,24, 5, u, u,
770 u,21, u, 8,11, u,15, u, u, u, u, 2,27, 0,25, u,
771 22, u,12, u, u, 3,28, u, 23, u, 4,29, u, u,30,31};
772
773 x = x | (x >> 1); // Propagate leftmost
774 x = x | (x >> 2); // 1-bit to the right.
775 x = x | (x >> 4);
776 x = x | (x >> 8);
777 x = x & ~(x >> 16);
778 x = x*0xFD7049FF; // Activate this line or the following 3.
779 // x = (x << 9) - x; // Multiply by 511.
780 // x = (x << 11) - x; // Multiply by 2047.
781 // x = (x << 14) - x; // Multiply by 16383.
782 return table[x >> 26];
783 }
784 */
785 int BitStream::NumberOfLeadingZeroes( int8_t x ) {return NumberOfLeadingZeroes((uint8_t)x);}
786 int BitStream::NumberOfLeadingZeroes( uint8_t x )
787 {
788 uint8_t y;
789 int n;
790
791 n = 8;
792 y = x >> 4; if (y != 0) {n = n - 4; x = y;}
793 y = x >> 2; if (y != 0) {n = n - 2; x = y;}
794 y = x >> 1; if (y != 0) return n - 2;
795 return (int)(n - x);
796 }
797 int BitStream::NumberOfLeadingZeroes( int16_t x ) {return NumberOfLeadingZeroes((uint16_t)x);}
798 int BitStream::NumberOfLeadingZeroes( uint16_t x )
799 {
800 uint16_t y;
801 int n;
802
803 n = 16;
804 y = x >> 8; if (y != 0) {n = n - 8; x = y;}
805 y = x >> 4; if (y != 0) {n = n - 4; x = y;}
806 y = x >> 2; if (y != 0) {n = n - 2; x = y;}
807 y = x >> 1; if (y != 0) return n - 2;
808 return (int)(n - x);
809 }
810 int BitStream::NumberOfLeadingZeroes( int32_t x ) {return NumberOfLeadingZeroes((uint32_t)x);}
811 int BitStream::NumberOfLeadingZeroes( uint32_t x )
812 {
813 uint32_t y;
814 int n;
815
816 n = 32;
817 y = x >>16; if (y != 0) {n = n -16; x = y;}
818 y = x >> 8; if (y != 0) {n = n - 8; x = y;}
819 y = x >> 4; if (y != 0) {n = n - 4; x = y;}
820 y = x >> 2; if (y != 0) {n = n - 2; x = y;}
821 y = x >> 1; if (y != 0) return n - 2;
822 return (int)(n - x);
823 }
824 int BitStream::NumberOfLeadingZeroes( int64_t x ) {return NumberOfLeadingZeroes((uint64_t)x);}
825 int BitStream::NumberOfLeadingZeroes( uint64_t x )
826 {
827 uint64_t y;
828 int n;
829
830 n = 64;
831 y = x >>32; if (y != 0) {n = n -32; x = y;}
832 y = x >>16; if (y != 0) {n = n -16; x = y;}
833 y = x >> 8; if (y != 0) {n = n - 8; x = y;}
834 y = x >> 4; if (y != 0) {n = n - 4; x = y;}
835 y = x >> 2; if (y != 0) {n = n - 2; x = y;}
836 y = x >> 1; if (y != 0) return n - 2;
837 return (int)(n - x);
838 }
839
840 // Should hit if reads didn't match writes
841 void BitStream::AssertStreamEmpty( void )
842 {
843 RakAssert( readOffset == numberOfBitsUsed );
844 }
845
846 void BitStream::PrintBits( char *out ) const
847 {
848 if (numberOfBitsUsed <= 0)
849 {
850 #pragma warning(push)
851 #pragma warning(disable:4996)
852 strcpy(out, "No bits\n");
853 #pragma warning(pop)
854 return;
855 }
856
857 unsigned int strIndex = 0;
858 for (BitSize_t counter = 0; counter < BITS_TO_BYTES(numberOfBitsUsed) && strIndex < 2000; counter++)
859 {
860 BitSize_t stop;
861
862 if (counter == (numberOfBitsUsed - 1) >> 3)
863 stop = 8 - (((numberOfBitsUsed - 1) & 7) + 1);
864 else
865 stop = 0;
866
867 for (BitSize_t counter2 = 7; counter2 >= stop; counter2--)
868 {
869 if ((data[counter] >> counter2) & 1)
870 out[strIndex++] = '1';
871 else
872 out[strIndex++] = '0';
873
874 if (counter2 == 0)
875 break;
876 }
877
878 out[strIndex++] = ' ';
879 }
880
881 out[strIndex++] = '\n';
882
883 out[strIndex++] = 0;
884 }
885
886 void BitStream::PrintBits( char *out, size_t outLength ) const
887 {
888 if ( numberOfBitsUsed <= 0 )
889 {
890 strcpy_s(out, outLength, "No bits\n" );
891 return;
892 }
893
894 unsigned int strIndex=0;
895 for ( BitSize_t counter = 0; counter < BITS_TO_BYTES( numberOfBitsUsed ) && strIndex < 2000 ; counter++ )
896 {
897 BitSize_t stop;
898
899 if ( counter == ( numberOfBitsUsed - 1 ) >> 3 )
900 stop = 8 - ( ( ( numberOfBitsUsed - 1 ) & 7 ) + 1 );
901 else
902 stop = 0;
903
904 for ( BitSize_t counter2 = 7; counter2 >= stop; counter2-- )
905 {
906 if ( ( data[ counter ] >> counter2 ) & 1 )
907 out[strIndex++]='1';
908 else
909 out[strIndex++]='0';
910
911 if (counter2==0)
912 break;
913 }
914
915 out[strIndex++]=' ';
916 }
917
918 out[strIndex++]='\n';
919
920 out[strIndex++]=0;
921 }
922 void BitStream::PrintBits( void ) const
923 {
924 char out[2048];
925 PrintBits(out, 2048);
926 RAKNET_DEBUG_PRINTF("%s", out);
927 }
928
929 void BitStream::PrintHex( char *out, size_t outLength ) const
930 {
931 BitSize_t i;
932 for ( i=0; i < GetNumberOfBytesUsed(); i++)
933 {
934 sprintf_s(out+i*3, outLength-i*3, "%02x ", data[i]);
935 }
936 }
937
938 void BitStream::PrintHex( char *out ) const
939 {
940 BitSize_t i;
941 for (i = 0; i < GetNumberOfBytesUsed(); i++)
942 {
943 #pragma warning(push)
944 #pragma warning(disable:4996)
945 sprintf(out + i * 3, "%02x ", data[i]);
946 #pragma warning(pop)
947 }
948 }
949
950 void BitStream::PrintHex( void ) const
951 {
952 char out[2048];
953 PrintHex(out, 2048);
954 RAKNET_DEBUG_PRINTF("%s", out);
955 }
956
957 // Exposes the data for you to look at, like PrintBits does.
958 // Data will point to the stream. Returns the length in bits of the stream.
959 BitSize_t BitStream::CopyData( unsigned char** _data ) const
960 {
961 #ifdef _DEBUG
962 RakAssert( numberOfBitsUsed > 0 );
963 #endif
964
965 *_data = (unsigned char*) rakMalloc_Ex( (size_t) BITS_TO_BYTES( numberOfBitsUsed ), _FILE_AND_LINE_ );
966 memcpy( *_data, data, sizeof(unsigned char) * (size_t) ( BITS_TO_BYTES( numberOfBitsUsed ) ) );
967 return numberOfBitsUsed;
968 }
969
970 // Ignore data we don't intend to read
971 void BitStream::IgnoreBits( const BitSize_t numberOfBits )
972 {
973 readOffset += numberOfBits;
974 }
975
976 void BitStream::IgnoreBytes( const unsigned int numberOfBytes )
977 {
978 IgnoreBits(BYTES_TO_BITS(numberOfBytes));
979 }
980
981 // Move the write pointer to a position on the array. Dangerous if you don't know what you are doing!
982 // Doesn't work with non-aligned data!
983 void BitStream::SetWriteOffset( const BitSize_t offset )
984 {
985 numberOfBitsUsed = offset;
986 }
987
988 /*
989 BitSize_t BitStream::GetWriteOffset( void ) const
990 {
991 return numberOfBitsUsed;
992 }
993
994 // Returns the length in bits of the stream
995 BitSize_t BitStream::GetNumberOfBitsUsed( void ) const
996 {
997 return GetWriteOffset();
998 }
999
1000 // Returns the length in bytes of the stream
1001 BitSize_t BitStream::GetNumberOfBytesUsed( void ) const
1002 {
1003 return BITS_TO_BYTES( numberOfBitsUsed );
1004 }
1005
1006 // Returns the number of bits into the stream that we have read
1007 BitSize_t BitStream::GetReadOffset( void ) const
1008 {
1009 return readOffset;
1010 }
1011
1012
1013 // Sets the read bit index
1014 void BitStream::SetReadOffset( const BitSize_t newReadOffset )
1015 {
1016 readOffset=newReadOffset;
1017 }
1018
1019 // Returns the number of bits left in the stream that haven't been read
1020 BitSize_t BitStream::GetNumberOfUnreadBits( void ) const
1021 {
1022 return numberOfBitsUsed - readOffset;
1023 }
1024 // Exposes the internal data
1025 unsigned char* BitStream::GetData( void ) const
1026 {
1027 return data;
1028 }
1029
1030 */
1031 // If we used the constructor version with copy data off, this makes sure it is set to on and the data pointed to is copied.
1032 void BitStream::AssertCopyData( void )
1033 {
1034 if ( copyData == false )
1035 {
1036 copyData = true;
1037
1038 if ( numberOfBitsAllocated > 0 )
1039 {
1040 unsigned char * newdata = ( unsigned char* ) rakMalloc_Ex( (size_t) BITS_TO_BYTES( numberOfBitsAllocated ), _FILE_AND_LINE_ );
1041 #ifdef _DEBUG
1042
1043 RakAssert( data );
1044 #endif
1045
1046 memcpy( newdata, data, (size_t) BITS_TO_BYTES( numberOfBitsAllocated ) );
1047 data = newdata;
1048 }
1049
1050 else
1051 data = 0;
1052 }
1053 }
1054 bool BitStream::IsNetworkOrderInternal(void)
1055 {
1056
1057
1058
1059
1060
1061 static unsigned long htonlValue = htonl(12345);
1062 return htonlValue == 12345;
1063
1064 }
1065 void BitStream::ReverseBytes(unsigned char *inByteArray, unsigned char *inOutByteArray, const unsigned int length)
1066 {
1067 for (BitSize_t i=0; i < length; i++)
1068 inOutByteArray[i]=inByteArray[length-i-1];
1069 }
1070 void BitStream::ReverseBytesInPlace(unsigned char *inOutData,const unsigned int length)
1071 {
1072 unsigned char temp;
1073 BitSize_t i;
1074 for (i=0; i < (length>>1); i++)
1075 {
1076 temp = inOutData[i];
1077 inOutData[i]=inOutData[length-i-1];
1078 inOutData[length-i-1]=temp;
1079 }
1080 }
1081
1082 bool BitStream::Read(char *varString)
1083 {
1084 return RakString::Deserialize(varString,this);
1085 }
1086 bool BitStream::Read(unsigned char *varString)
1087 {
1088 return RakString::Deserialize((char*) varString,this);
1089 }
1090 void BitStream::WriteAlignedVar8(const char *inByteArray)
1091 {
1092 RakAssert((numberOfBitsUsed&7)==0);
1093 AddBitsAndReallocate(1*8);
1094 data[( numberOfBitsUsed >> 3 ) + 0] = inByteArray[0];
1095 numberOfBitsUsed+=1*8;
1096 }
1097 bool BitStream::ReadAlignedVar8(char *inOutByteArray)
1098 {
1099 RakAssert((readOffset&7)==0);
1100 if (GetNumberOfUnreadBits() < 1 * 8)
1101 return false;
1102
1103 inOutByteArray[0] = data[( readOffset >> 3 ) + 0];
1104 readOffset+=1*8;
1105 return true;
1106 }
1107 void BitStream::WriteAlignedVar16(const char *inByteArray)
1108 {
1109 RakAssert((numberOfBitsUsed&7)==0);
1110 AddBitsAndReallocate(2*8);
1111 #ifndef __BITSTREAM_NATIVE_END
1112 if (DoEndianSwap())
1113 {
1114 data[( numberOfBitsUsed >> 3 ) + 0] = inByteArray[1];
1115 data[( numberOfBitsUsed >> 3 ) + 1] = inByteArray[0];
1116 }
1117 else
1118 #endif
1119 {
1120 data[( numberOfBitsUsed >> 3 ) + 0] = inByteArray[0];
1121 data[( numberOfBitsUsed >> 3 ) + 1] = inByteArray[1];
1122 }
1123
1124 numberOfBitsUsed+=2*8;
1125 }
1126 bool BitStream::ReadAlignedVar16(char *inOutByteArray)
1127 {
1128 RakAssert((readOffset&7)==0);
1129 if (GetNumberOfUnreadBits() < 2 * 8)
1130 return false;
1131 #ifndef __BITSTREAM_NATIVE_END
1132 if (DoEndianSwap())
1133 {
1134 inOutByteArray[0] = data[( readOffset >> 3 ) + 1];
1135 inOutByteArray[1] = data[( readOffset >> 3 ) + 0];
1136 }
1137 else
1138 #endif
1139 {
1140 inOutByteArray[0] = data[( readOffset >> 3 ) + 0];
1141 inOutByteArray[1] = data[( readOffset >> 3 ) + 1];
1142 }
1143
1144 readOffset+=2*8;
1145 return true;
1146 }
1147 void BitStream::WriteAlignedVar32(const char *inByteArray)
1148 {
1149 RakAssert((numberOfBitsUsed&7)==0);
1150 AddBitsAndReallocate(4*8);
1151 #ifndef __BITSTREAM_NATIVE_END
1152 if (DoEndianSwap())
1153 {
1154 data[( numberOfBitsUsed >> 3 ) + 0] = inByteArray[3];
1155 data[( numberOfBitsUsed >> 3 ) + 1] = inByteArray[2];
1156 data[( numberOfBitsUsed >> 3 ) + 2] = inByteArray[1];
1157 data[( numberOfBitsUsed >> 3 ) + 3] = inByteArray[0];
1158 }
1159 else
1160 #endif
1161 {
1162 data[( numberOfBitsUsed >> 3 ) + 0] = inByteArray[0];
1163 data[( numberOfBitsUsed >> 3 ) + 1] = inByteArray[1];
1164 data[( numberOfBitsUsed >> 3 ) + 2] = inByteArray[2];
1165 data[( numberOfBitsUsed >> 3 ) + 3] = inByteArray[3];
1166 }
1167
1168 numberOfBitsUsed+=4*8;
1169 }
1170 bool BitStream::ReadAlignedVar32(char *inOutByteArray)
1171 {
1172 RakAssert((readOffset&7)==0);
1173 if (GetNumberOfUnreadBits() < 4*8)
1174 return false;
1175 #ifndef __BITSTREAM_NATIVE_END
1176 if (DoEndianSwap())
1177 {
1178 inOutByteArray[0] = data[( readOffset >> 3 ) + 3];
1179 inOutByteArray[1] = data[( readOffset >> 3 ) + 2];
1180 inOutByteArray[2] = data[( readOffset >> 3 ) + 1];
1181 inOutByteArray[3] = data[( readOffset >> 3 ) + 0];
1182 }
1183 else
1184 #endif
1185 {
1186 inOutByteArray[0] = data[( readOffset >> 3 ) + 0];
1187 inOutByteArray[1] = data[( readOffset >> 3 ) + 1];
1188 inOutByteArray[2] = data[( readOffset >> 3 ) + 2];
1189 inOutByteArray[3] = data[( readOffset >> 3 ) + 3];
1190 }
1191
1192 readOffset+=4*8;
1193 return true;
1194 }
1195 bool BitStream::ReadFloat16( float &outFloat, float floatMin, float floatMax )
1196 {
1197 unsigned short percentile;
1198 if (Read(percentile))
1199 {
1200 RakAssert(floatMax>floatMin);
1201 outFloat = floatMin + ((float) percentile / 65535.0f) * (floatMax-floatMin);
1202 if (outFloat<floatMin)
1203 outFloat=floatMin;
1204 else if (outFloat>floatMax)
1205 outFloat=floatMax;
1206 return true;
1207 }
1208 return false;
1209 }
1210 bool BitStream::SerializeFloat16(bool writeToBitstream, float &inOutFloat, float floatMin, float floatMax)
1211 {
1212 if (writeToBitstream)
1213 WriteFloat16(inOutFloat, floatMin, floatMax);
1214 else
1215 return ReadFloat16(inOutFloat, floatMin, floatMax);
1216 return true;
1217 }
1218 void BitStream::WriteFloat16( float inOutFloat, float floatMin, float floatMax )
1219 {
1220 RakAssert(floatMax>floatMin);
1221 if (inOutFloat>floatMax+.001)
1222 {
1223 RakAssert(inOutFloat<=floatMax+.001);
1224 }
1225 if (inOutFloat<floatMin-.001)
1226 {
1227 RakAssert(inOutFloat>=floatMin-.001);
1228 }
1229 float percentile=65535.0f * (inOutFloat-floatMin)/(floatMax-floatMin);
1230 if (percentile<0.0)
1231 percentile=0.0;
1232 if (percentile>65535.0f)
1233 percentile=65535.0f;
1234 Write((unsigned short)percentile);
1235 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • BitStream
SLNet::BitStream Member List

This is the complete list of members for SLNet::BitStream, including all inherited members.

AddBitsAndReallocate(const BitSize_t numberOfBitsToWrite) | SLNet::BitStream |
AlignReadToByteBoundary(void) | SLNet::BitStream | inline
AlignWriteToByteBoundary(void) | SLNet::BitStream | inline
AssertCopyData(void) | SLNet::BitStream |
AssertStreamEmpty(void) | SLNet::BitStream |
BitStream() | SLNet::BitStream |
BitStream(const unsigned int initialBytesToAllocate) | SLNet::BitStream |
BitStream(unsigned char *_data, const unsigned int lengthInBytes, bool _copyData) | SLNet::BitStream |
CopyData(unsigned char **_data) const | SLNet::BitStream |
DoEndianSwap(void) | SLNet::BitStream | inlinestatic
EndianSwapBytes(int byteOffset, int length) | SLNet::BitStream |
GetData(void) const | SLNet::BitStream | inline
GetNumberOfBitsAllocated(void) const | SLNet::BitStream |
GetNumberOfBitsUsed(void) const | SLNet::BitStream | inline
GetNumberOfBytesUsed(void) const | SLNet::BitStream | inline
GetNumberOfUnreadBits(void) const | SLNet::BitStream | inline
GetReadOffset(void) const | SLNet::BitStream | inline
GetWriteOffset(void) const | SLNet::BitStream | inline
IgnoreBits(const BitSize_t numberOfBits) | SLNet::BitStream |
IgnoreBytes(const unsigned int numberOfBytes) | SLNet::BitStream |
IsBigEndian(void) | SLNet::BitStream | inlinestatic
IsNetworkOrder(void) | SLNet::BitStream | inlinestatic
IsNetworkOrderInternal(void) | SLNet::BitStream | static
NumberOfLeadingZeroes(uint8_t x) | SLNet::BitStream | static
NumberOfLeadingZeroes(uint16_t x) | SLNet::BitStream | static
NumberOfLeadingZeroes(uint32_t x) | SLNet::BitStream | static
NumberOfLeadingZeroes(uint64_t x) | SLNet::BitStream | static
NumberOfLeadingZeroes(int8_t x) | SLNet::BitStream | static
NumberOfLeadingZeroes(int16_t x) | SLNet::BitStream | static
NumberOfLeadingZeroes(int32_t x) | SLNet::BitStream | static
NumberOfLeadingZeroes(int64_t x) | SLNet::BitStream | static
PadWithZeroToByteLength(unsigned int bytes) | SLNet::BitStream |
PrintBits(char *out) const | SLNet::BitStream |
PrintBits(char *out, size_t outLength) const | SLNet::BitStream |
PrintBits(void) const | SLNet::BitStream |
PrintHex(char *out) const | SLNet::BitStream |
PrintHex(char *out, size_t outLength) const | SLNet::BitStream |
PrintHex(void) const | SLNet::BitStream |
Read(templateType &outTemplateVar) | SLNet::BitStream | inline
Read(wchar_t *&varString) | SLNet::BitStream | inline
Read(wchar_t *&varString, size_t varStringLength) | SLNet::BitStream | inline
Read(BitStream *bitStream, BitSize_t numberOfBits) | SLNet::BitStream |
Read(BitStream *bitStream) | SLNet::BitStream |
Read(BitStream &bitStream, BitSize_t numberOfBits) | SLNet::BitStream |
Read(BitStream &bitStream) | SLNet::BitStream |
Read(char *output, const unsigned int numberOfBytes) | SLNet::BitStream |
Read(char *varString) | SLNet::BitStream |
Read(unsigned char *varString) | SLNet::BitStream |
Read(bool &outTemplateVar) | SLNet::BitStream | inline
Read(SystemAddress &outTemplateVar) | SLNet::BitStream | inline
Read(uint24_t &outTemplateVar) | SLNet::BitStream | inline
Read(RakNetGUID &outTemplateVar) | SLNet::BitStream | inline
Read(RakString &outTemplateVar) | SLNet::BitStream | inline
Read(RakWString &outTemplateVar) | SLNet::BitStream | inline
Read(char *&varString) | SLNet::BitStream | inline
Read(unsigned char *&varString) | SLNet::BitStream | inline
ReadAlignedBytes(unsigned char *inOutByteArray, const unsigned int numberOfBytesToRead) | SLNet::BitStream |
ReadAlignedBytesSafe(char *inOutByteArray, int &inputLength, const int maxBytesToRead) | SLNet::BitStream |
ReadAlignedBytesSafe(char *inOutByteArray, unsigned int &inputLength, const unsigned int maxBytesToRead) | SLNet::BitStream |
ReadAlignedBytesSafeAlloc(char **outByteArray, int &inputLength, const unsigned int maxBytesToRead) | SLNet::BitStream |
ReadAlignedBytesSafeAlloc(char **outByteArray, unsigned int &inputLength, const unsigned int maxBytesToRead) | SLNet::BitStream |
ReadAlignedVar16(char *inOutByteArray) | SLNet::BitStream |
ReadAlignedVar32(char *inOutByteArray) | SLNet::BitStream |
ReadAlignedVar8(char *inOutByteArray) | SLNet::BitStream |
ReadBit(void) | SLNet::BitStream |
ReadBits(unsigned char *inOutByteArray, BitSize_t numberOfBitsToRead, const bool alignBitsToRight=true) | SLNet::BitStream |
ReadBitsFromIntegerRange(templateType &value, const templateType minimum, const templateType maximum, bool allowOutsideRange=false) | SLNet::BitStream |
ReadBitsFromIntegerRange(templateType &value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange=false) | SLNet::BitStream |
ReadCasted(sourceType &value) | SLNet::BitStream |
ReadCompressed(templateType &outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(wchar_t *&varString) | SLNet::BitStream | inline
ReadCompressed(wchar_t *&varString, size_t varStringLength) | SLNet::BitStream | inline
ReadCompressed(SystemAddress &outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(uint24_t &outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(RakNetGUID &outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(bool &outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(float &outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(double &outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(RakString &outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(RakWString &outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(char *&outTemplateVar) | SLNet::BitStream | inline
ReadCompressed(unsigned char *&outTemplateVar) | SLNet::BitStream | inline
ReadCompressedDelta(templateType &outTemplateVar) | SLNet::BitStream | inline
ReadCompressedDelta(bool &outTemplateVar) | SLNet::BitStream | inline
ReadDelta(templateType &outTemplateVar) | SLNet::BitStream | inline
ReadDelta(bool &outTemplateVar) | SLNet::BitStream | inline
ReadFloat16(float &outFloat, float floatMin, float floatMax) | SLNet::BitStream |
ReadNormQuat(templateType &w, templateType &x, templateType &y, templateType &z) | SLNet::BitStream |
ReadNormVector(templateType &x, templateType &y, templateType &z) | SLNet::BitStream |
ReadOrthMatrix(templateType &m00, templateType &m01, templateType &m02, templateType &m10, templateType &m11, templateType &m12, templateType &m20, templateType &m21, templateType &m22) | SLNet::BitStream |
ReadVector(templateType &x, templateType &y, templateType &z) | SLNet::BitStream |
Reset(void) | SLNet::BitStream |
ResetReadPointer(void) | SLNet::BitStream |
ResetWritePointer(void) | SLNet::BitStream |
ReverseBytes(unsigned char *inByteArray, unsigned char *inOutByteArray, const unsigned int length) | SLNet::BitStream | static
ReverseBytesInPlace(unsigned char *inOutData, const unsigned int length) | SLNet::BitStream | static
Serialize(bool writeToBitstream, templateType &inOutTemplateVar) | SLNet::BitStream | inline
Serialize(bool writeToBitstream, char *inOutByteArray, const unsigned int numberOfBytes) | SLNet::BitStream | inline
SerializeBits(bool writeToBitstream, unsigned char *inOutByteArray, const BitSize_t numberOfBitsToSerialize, const bool rightAlignedBits=true) | SLNet::BitStream | inline
SerializeBitsFromIntegerRange(bool writeToBitstream, templateType &value, const templateType minimum, const templateType maximum, bool allowOutsideRange=false) | SLNet::BitStream |
SerializeBitsFromIntegerRange(bool writeToBitstream, templateType &value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange=false) | SLNet::BitStream |
SerializeCasted(bool writeToBitstream, sourceType &value) | SLNet::BitStream |
SerializeCompressed(bool writeToBitstream, templateType &inOutTemplateVar) | SLNet::BitStream | inline
SerializeCompressedDelta(bool writeToBitstream, templateType &inOutCurrentValue, const templateType &lastValue) | SLNet::BitStream | inline
SerializeCompressedDelta(bool writeToBitstream, templateType &inOutTemplateVar) | SLNet::BitStream | inline
SerializeDelta(bool writeToBitstream, templateType &inOutCurrentValue, const templateType &lastValue) | SLNet::BitStream | inline
SerializeDelta(bool writeToBitstream, templateType &inOutCurrentValue) | SLNet::BitStream | inline
SerializeFloat16(bool writeToBitstream, float &inOutFloat, float floatMin, float floatMax) | SLNet::BitStream |
SerializeNormQuat(bool writeToBitstream, templateType &w, templateType &x, templateType &y, templateType &z) | SLNet::BitStream | inline
SerializeNormVector(bool writeToBitstream, templateType &x, templateType &y, templateType &z) | SLNet::BitStream | inline
SerializeOrthMatrix(bool writeToBitstream, templateType &m00, templateType &m01, templateType &m02, templateType &m10, templateType &m11, templateType &m12, templateType &m20, templateType &m21, templateType &m22) | SLNet::BitStream | inline
SerializeVector(bool writeToBitstream, templateType &x, templateType &y, templateType &z) | SLNet::BitStream | inline
SetData(unsigned char *inByteArray) | SLNet::BitStream |
SetNumberOfBitsAllocated(const BitSize_t lengthInBits) | SLNet::BitStream |
SetReadOffset(const BitSize_t newReadOffset) | SLNet::BitStream | inline
SetWriteOffset(const BitSize_t offset) | SLNet::BitStream |
Write(const templateType &inTemplateVar) | SLNet::BitStream | inline
Write(const char *inputByteArray, const unsigned int numberOfBytes) | SLNet::BitStream |
Write(BitStream *bitStream, BitSize_t numberOfBits) | SLNet::BitStream |
Write(BitStream *bitStream) | SLNet::BitStream |
Write(BitStream &bitStream, BitSize_t numberOfBits) | SLNet::BitStream |
Write(BitStream &bitStream) | SLNet::BitStream |
Write(const char *const inStringVar) | SLNet::BitStream | inline
Write(const wchar_t *const inStringVar) | SLNet::BitStream | inline
Write(const unsigned char *const inTemplateVar) | SLNet::BitStream | inline
Write(char *const inTemplateVar) | SLNet::BitStream | inline
Write(unsigned char *const inTemplateVar) | SLNet::BitStream | inline
Write(const bool &inTemplateVar) | SLNet::BitStream | inline
Write(const SystemAddress &inTemplateVar) | SLNet::BitStream | inline
Write(const uint24_t &inTemplateVar) | SLNet::BitStream | inline
Write(const RakNetGUID &inTemplateVar) | SLNet::BitStream | inline
Write(const RakString &inTemplateVar) | SLNet::BitStream | inline
Write(const RakWString &inTemplateVar) | SLNet::BitStream | inline
Write(const char *const &inStringVar) | SLNet::BitStream | inline
Write(const wchar_t *const &inStringVar) | SLNet::BitStream | inline
Write(const unsigned char *const &inTemplateVar) | SLNet::BitStream | inline
Write(char *const &inTemplateVar) | SLNet::BitStream | inline
Write(unsigned char *const &inTemplateVar) | SLNet::BitStream | inline
Write0(void) | SLNet::BitStream |
Write1(void) | SLNet::BitStream |
WriteAlignedBytes(const unsigned char *inByteArray, const unsigned int numberOfBytesToWrite) | SLNet::BitStream |
WriteAlignedBytesSafe(const char *inByteArray, const unsigned int inputLength, const unsigned int maxBytesToWrite) | SLNet::BitStream |
WriteAlignedVar16(const char *inByteArray) | SLNet::BitStream |
WriteAlignedVar32(const char *inByteArray) | SLNet::BitStream |
WriteAlignedVar8(const char *inByteArray) | SLNet::BitStream |
WriteBits(const unsigned char *inByteArray, BitSize_t numberOfBitsToWrite, const bool rightAlignedBits=true) | SLNet::BitStream |
WriteBitsFromIntegerRange(const templateType value, const templateType minimum, const templateType maximum, bool allowOutsideRange=false) | SLNet::BitStream |
WriteBitsFromIntegerRange(const templateType value, const templateType minimum, const templateType maximum, const int requiredBits, bool allowOutsideRange=false) | SLNet::BitStream |
WriteCasted(const sourceType &value) | SLNet::BitStream |
WriteCompressed(const templateType &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(const char *const inStringVar) | SLNet::BitStream | inline
WriteCompressed(const wchar_t *const inStringVar) | SLNet::BitStream | inline
WriteCompressed(const unsigned char *const inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(char *const inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(unsigned char *const inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(const SystemAddress &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(const RakNetGUID &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(const uint24_t &var) | SLNet::BitStream | inline
WriteCompressed(const bool &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(const float &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(const double &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(const RakString &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(const RakWString &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(const char *const &inStringVar) | SLNet::BitStream | inline
WriteCompressed(const wchar_t *const &inStringVar) | SLNet::BitStream | inline
WriteCompressed(const unsigned char *const &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(char *const &inTemplateVar) | SLNet::BitStream | inline
WriteCompressed(unsigned char *const &inTemplateVar) | SLNet::BitStream | inline
WriteCompressedDelta(const templateType &currentValue, const templateType &lastValue) | SLNet::BitStream | inline
WriteCompressedDelta(const templateType &currentValue) | SLNet::BitStream | inline
WriteCompressedDelta(const bool &currentValue, const bool &lastValue) | SLNet::BitStream | inline
WriteCompressedDelta(const bool &currentValue) | SLNet::BitStream | inline
WriteDelta(const templateType &currentValue, const templateType &lastValue) | SLNet::BitStream | inline
WriteDelta(const templateType &currentValue) | SLNet::BitStream | inline
WriteDelta(const bool &currentValue, const bool &lastValue) | SLNet::BitStream | inline
WriteFloat16(float x, float floatMin, float floatMax) | SLNet::BitStream |
WriteNormQuat(templateType w, templateType x, templateType y, templateType z) | SLNet::BitStream |
WriteNormVector(templateType x, templateType y, templateType z) | SLNet::BitStream |
WriteOrthMatrix(templateType m00, templateType m01, templateType m02, templateType m10, templateType m11, templateType m12, templateType m20, templateType m21, templateType m22) | SLNet::BitStream |
WritePtr(templateType *inTemplateVar) | SLNet::BitStream | inline
WriteVector(templateType x, templateType y, templateType z) | SLNet::BitStream |
~BitStream() | SLNet::BitStream |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Kbhit.h Source File

  • include
  • slikenet
Kbhit.h
Go to the documentation of this file.
1 /*****************************************************************************
2 _kbhit() and _getch() for Linux/UNIX
3 Chris Giese <geezer@execpc.com> http://my.execpc.com/~geezer
4 Release date: ?
5 This code is public domain (no copyright).
6 You can do whatever you want with it.
7 *****************************************************************************/
8 /*
9 * Modified work: Copyright (c) 2016, SLikeSoft UG (haftungsbeschränkt)
10 *
11 * This source code was modified by SLikeSoft. Modifications in this file are put under the public domain.
12 * Alternatively you are permitted to license the modifications under the MIT license, if you so desire. The
13 * license can be found in the license.txt file in the root directory of this source tree.
14 */
15
16 #if defined(_WIN32)
17 #include <conio.h> /* _kbhit(), _getch() */
18
19 #else
20 #include <sys/time.h> /* struct timeval, select() */
21 /* ICANON, ECHO, TCSANOW, struct termios */
22 #include <termios.h> /* tcgetattr(), tcsetattr() */
23 #include <stdlib.h> /* atexit(), exit() */
24 #include <unistd.h> /* read() */
25 #include <stdio.h> /* printf() */
26 #include <string.h> /* memcpy */
27
28 static struct termios g_old_kbd_mode;
29 /*****************************************************************************
30 *****************************************************************************/
31 static void cooked(void)
32 {
33 tcsetattr(0, TCSANOW, &g_old_kbd_mode);
34 }
35 /*****************************************************************************
36 *****************************************************************************/
37 static void raw(void)
38 {
39 static char init;
40
41 struct termios new_kbd_mode;
42
43 if(init)
44 return;
45 /* put keyboard (stdin, actually) in raw, unbuffered mode */
46 tcgetattr(0, &g_old_kbd_mode);
47 memcpy(&new_kbd_mode, &g_old_kbd_mode, sizeof(struct termios));
48 new_kbd_mode.c_lflag &= ~(ICANON /*| ECHO */ );
49 new_kbd_mode.c_cc[VTIME] = 0;
50 new_kbd_mode.c_cc[VMIN] = 1;
51 tcsetattr(0, TCSANOW, &new_kbd_mode);
52 /* when we exit, go back to normal, "cooked" mode */
53 atexit(cooked);
54
55 init = 1;
56 }
57 /*****************************************************************************
58 *****************************************************************************/
59 static int _kbhit(void)
60 {
61 struct timeval timeout;
62 fd_set read_handles;
63 int status;
64
65 raw();
66 /* check stdin (fd 0) for activity */
67 FD_ZERO(&read_handles);
68 FD_SET(0, &read_handles);
69 timeout.tv_sec = timeout.tv_usec = 0;
70 status = select(0 + 1, &read_handles, NULL, NULL, &timeout);
71 if(status < 0)
72 {
73 printf("select() failed in _kbhit()\n");
74 exit(1);
75 }
76 return status;
77 }
78 /*****************************************************************************
79 *****************************************************************************/
80 static int _getch(void)
81 {
82 unsigned char temp;
83
84 raw();
85 /* stdin = fd 0 */
86 if(read(0, &temp, 1) != 1)
87 return 0;
88 return temp;
89 }
90 #endif
91
92
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_QueueLinkedList.h Source File

  • include
  • slikenet
DS_QueueLinkedList.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __QUEUE_LINKED_LIST_H
23 #define __QUEUE_LINKED_LIST_H
24
25 #include "DS_LinkedList.h"
26 #include "Export.h"
27 #include "memoryoverride.h"
28
31 namespace DataStructures
32 {
34 template <class QueueType>
35 class RAK_DLL_EXPORT QueueLinkedList
36 {
37
38 public:
39 QueueLinkedList();
40 QueueLinkedList( const QueueLinkedList& original_copy );
41 bool operator= ( const QueueLinkedList& original_copy );
42 QueueType Pop( void );
43 QueueType& Peek( void );
44 QueueType& EndPeek( void );
45 void Push( const QueueType& input );
46 unsigned int Size( void );
47 void Clear( void );
48 void Compress( void );
49
50 private:
51 LinkedList<QueueType> data;
52 };
53
54 template <class QueueType>
55 QueueLinkedList<QueueType>::QueueLinkedList()
56 {
57 }
58
59 template <class QueueType>
60 inline unsigned int QueueLinkedList<QueueType>::Size()
61 {
62 return data.Size();
63 }
64
65 template <class QueueType>
66 inline QueueType QueueLinkedList<QueueType>::Pop( void )
67 {
68 data.Beginning();
69 return ( QueueType ) data.Pop();
70 }
71
72 template <class QueueType>
73 inline QueueType& QueueLinkedList<QueueType>::Peek( void )
74 {
75 data.Beginning();
76 return ( QueueType ) data.Peek();
77 }
78
79 template <class QueueType>
80 inline QueueType& QueueLinkedList<QueueType>::EndPeek( void )
81 {
82 data.End();
83 return ( QueueType ) data.Peek();
84 }
85
86 template <class QueueType>
87 void QueueLinkedList<QueueType>::Push( const QueueType& input )
88 {
89 data.End();
90 data.Add( input );
91 }
92
93 template <class QueueType>
94 QueueLinkedList<QueueType>::QueueLinkedList( const QueueLinkedList& original_copy )
95 {
96 data = original_copy.data;
97 }
98
99 template <class QueueType>
100 bool QueueLinkedList<QueueType>::operator= ( const QueueLinkedList& original_copy )
101 {
102 if ( ( &original_copy ) == this )
103 return false;
104
105 data = original_copy.data;
106 }
107
108 template <class QueueType>
109 void QueueLinkedList<QueueType>::Clear ( void )
110 {
111 data.Clear();
112 }
113 } // End namespace
114
115 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NatPunchthroughServer.h Source File

  • include
  • slikenet
NatPunchthroughServer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_NatPunchthroughServer==1
23
24 #ifndef __NAT_PUNCHTHROUGH_SERVER_H
25 #define __NAT_PUNCHTHROUGH_SERVER_H
26
27 #include "types.h"
28 #include "Export.h"
29 #include "PluginInterface2.h"
30 #include "PacketPriority.h"
31 #include "SocketIncludes.h"
32 #include "DS_OrderedList.h"
33 #include "string.h"
34
35 namespace SLNet
36 {
38 class RakPeerInterface;
39 struct Packet;
40 #if _RAKNET_SUPPORT_PacketLogger==1
41 class PacketLogger;
42 #endif
43
48
50 struct RAK_DLL_EXPORT NatPunchthroughServerDebugInterface
51 {
52 NatPunchthroughServerDebugInterface() {}
53 virtual ~NatPunchthroughServerDebugInterface() {}
54 virtual void OnServerMessage(const char *msg)=0;
55 };
56
58 struct RAK_DLL_EXPORT NatPunchthroughServerDebugInterface_Printf : public NatPunchthroughServerDebugInterface
59 {
60 virtual void OnServerMessage(const char *msg);
61 };
62
63 #if _RAKNET_SUPPORT_PacketLogger==1
64
65 struct RAK_DLL_EXPORT NatPunchthroughServerDebugInterface_PacketLogger : public NatPunchthroughServerDebugInterface
66 {
67 // Set to non-zero to write to the packetlogger!
68 PacketLogger *pl;
69
70 NatPunchthroughServerDebugInterface_PacketLogger() {pl=0;}
71 ~NatPunchthroughServerDebugInterface_PacketLogger() {}
72 virtual void OnServerMessage(const char *msg);
73 };
74 #endif
75
83 class RAK_DLL_EXPORT NatPunchthroughServer : public PluginInterface2
84 {
85 public:
86
87 STATIC_FACTORY_DECLARATIONS(NatPunchthroughServer)
88
89 // Constructor
90 NatPunchthroughServer();
91
92 // Destructor
93 virtual ~NatPunchthroughServer();
94
97 void SetDebugInterface(NatPunchthroughServerDebugInterface *i);
98
100 virtual void Update(void);
101
103 virtual PluginReceiveResult OnReceive(Packet *packet);
104
106 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
107 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
108
109 // Each connected user has a ready state. Ready means ready for nat punchthrough.
110 struct User;
111 struct ConnectionAttempt
112 {
113 ConnectionAttempt() {sender=0; recipient=0; startTime=0; attemptPhase=NAT_ATTEMPT_PHASE_NOT_STARTED;}
114 User *sender, *recipient;
115 uint16_t sessionId;
116 SLNet::Time startTime;
117 enum
118 {
119 NAT_ATTEMPT_PHASE_NOT_STARTED,
120 NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS,
121 } attemptPhase;
122 };
123 struct User
124 {
125 RakNetGUID guid;
126 SystemAddress systemAddress;
127 unsigned short mostRecentPort;
128 bool isReady;
129 DataStructures::OrderedList<RakNetGUID,RakNetGUID> groupPunchthroughRequests;
130
131 DataStructures::List<ConnectionAttempt *> connectionAttempts;
132 bool HasConnectionAttemptToUser(User *user);
133 void DerefConnectionAttempt(ConnectionAttempt *ca);
134 void DeleteConnectionAttempt(ConnectionAttempt *ca);
135 void LogConnectionAttempts(SLNet::RakString &rs);
136 };
137 SLNet::Time lastUpdate;
138 static int NatPunchthroughUserComp( const RakNetGUID &key, User * const &data );
139 protected:
140 void OnNATPunchthroughRequest(Packet *packet);
141 DataStructures::OrderedList<RakNetGUID, User*, NatPunchthroughServer::NatPunchthroughUserComp> users;
142
143 void OnGetMostRecentPort(Packet *packet);
144 void OnClientReady(Packet *packet);
145
146 void SendTimestamps(void);
147 void StartPendingPunchthrough(void);
148 void StartPunchthroughForUser(User*user);
149 uint16_t sessionId;
150 NatPunchthroughServerDebugInterface *natPunchthroughServerDebugInterface;
151
152 SystemAddress boundAddresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS];
153 unsigned char boundAddressCount;
154
155 };
156
157 } // namespace SLNet
158
159 #endif
160
161 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Berkley_NativeClient.cpp Source File

  • src
RakNetSocket2_Berkley_NativeClient.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_BERKLEY_NATIVE_CLIENT_CPP
21 #define RAKNETSOCKET2_BERKLEY_NATIVE_CLIENT_CPP
22
23 // Every platform except windows store 8 and native client supports Berkley sockets
24 #if !defined(WINDOWS_STORE_RT)
25
26 #include "slikenet/Itoa.h"
27 #include "slikenet/WSAStartupSingleton.h" // used for WSAStartupSingleton
28
29 // Shared on most platforms, but excluded from the listed
30
31 // #low - maybe change to char (&ip)[65] - then we can also use sizeof again
32 void DomainNameToIP_Berkley_IPV4And6( const char *domainName, char ip[65] )
33 {
34 #if RAKNET_SUPPORT_IPV6==1
35 struct addrinfo hints, *res, *p;
36 int status;
37 memset(&hints, 0, sizeof hints);
38 hints.ai_family = AF_UNSPEC; // AF_INET or AF_INET6 to force version
39 hints.ai_socktype = SOCK_DGRAM;
40
41 if ((status = getaddrinfo(domainName, NULL, &hints, &res)) != 0) {
42 // #high - review/update callers - some unnecessarily initialize ip unnecessarily
43 ip[0] = '\0';
44 return;
45 }
46
47 p=res;
48 // for(p = res;p != NULL; p = p->ai_next) {
49 void *addr;
50 // char *ipver;
51
52 // get the pointer to the address itself,
53 // different fields in IPv4 and IPv6:
54 if (p->ai_family == AF_INET)
55 {
56 struct sockaddr_in *ipv4 = (struct sockaddr_in *)p->ai_addr;
57 addr = &(ipv4->sin_addr);
58 inet_ntop(AF_INET, &ipv4->sin_addr, ip, 65);
59 }
60 else
61 {
62 // TODO - test
63 struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)p->ai_addr;
64 addr = &(ipv6->sin6_addr);
65 // inet_ntop function does not exist on windows
66 // http://www.mail-archive.com/users@ipv6.org/msg02107.html
67 getnameinfo((struct sockaddr *)ipv6, sizeof(struct sockaddr_in6), ip, 1, NULL, 0, NI_NUMERICHOST);
68 }
69 freeaddrinfo(res); // free the linked list
70 // }
71 #else
72 (void) domainName;
73 (void) ip;
74 #endif // #if RAKNET_SUPPORT_IPV6==1
75 }
76
77
78 void DomainNameToIP_Berkley_IPV4( const char *domainName, char ip[65] )
79 {
80 // Use inet_addr instead? What is the difference?
81 struct addrinfo *addressinfo = NULL;
82 // needed for getaddrinfo
83 WSAStartupSingleton::AddRef();
84 int error = getaddrinfo(domainName, NULL, NULL, &addressinfo);
85 WSAStartupSingleton::Deref();
86
87 if ( error != 0 || addressinfo == 0 )
88 {
89 //cerr << "Yow! Bad host lookup." << endl;
90 // #high - review/update callers - some unnecessarily initialize ip unnecessarily
91 ip[0] = '\0';
92 return;
93 }
94
95 // get the (first) IPv4 address
96 while (addressinfo != NULL) {
97 if (addressinfo->ai_family == AF_INET) {
98 break; // found an IPv4 address
99 }
100 addressinfo = addressinfo->ai_next;
101 }
102
103 if (addressinfo == NULL) {
104 return;
105 }
106
107 struct sockaddr_in *sockaddr_ipv4 = (struct sockaddr_in *) addressinfo->ai_addr;
108
109 inet_ntop(AF_INET, &sockaddr_ipv4->sin_addr, ip, 65);
110 }
111
112
113
114 void DomainNameToIP_Berkley( const char *domainName, char ip[65] )
115 {
116 #if RAKNET_SUPPORT_IPV6==1
117 return DomainNameToIP_Berkley_IPV4And6(domainName, ip);
118 #else
119 return DomainNameToIP_Berkley_IPV4(domainName, ip);
120 #endif
121 }
122
123
124
125
126 #endif // !defined(WINDOWS_STORE_RT) && !defined(__native_client__)
127
128 #endif // file header
129
130 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
ThreadPool< InputType, OutputType > Member List

This is the complete list of members for ThreadPool< InputType, OutputType >, including all inherited members.

AddInput(OutputType(*workerThreadCallback)(InputType, bool *returnOutput, void *perThreadData), InputType inputData) | ThreadPool< InputType, OutputType > |
AddOutput(OutputType outputData) | ThreadPool< InputType, OutputType > |
Clear(void) | ThreadPool< InputType, OutputType > |
ClearInput(void) | ThreadPool< InputType, OutputType > |
ClearOutput(void) | ThreadPool< InputType, OutputType > |
GetInputAtIndex(unsigned index) | ThreadPool< InputType, OutputType > |
GetOutput(void) | ThreadPool< InputType, OutputType > |
GetOutputAtIndex(unsigned index) | ThreadPool< InputType, OutputType > |
HasInput(void) | ThreadPool< InputType, OutputType > |
HasInputFast(void) | ThreadPool< InputType, OutputType > |
HasOutput(void) | ThreadPool< InputType, OutputType > |
HasOutputFast(void) | ThreadPool< InputType, OutputType > |
inputFunctionQueue | ThreadPool< InputType, OutputType > | protected
inputQueue | ThreadPool< InputType, OutputType > | protected
inputQueueMutex | ThreadPool< InputType, OutputType > | protected
InputSize(void) | ThreadPool< InputType, OutputType > |
IsWorking(void) | ThreadPool< InputType, OutputType > |
LockInput(void) | ThreadPool< InputType, OutputType > |
LockOutput(void) | ThreadPool< InputType, OutputType > |
numThreadsRunning | ThreadPool< InputType, OutputType > | protected
numThreadsRunningMutex | ThreadPool< InputType, OutputType > | protected
NumThreadsWorking(void) | ThreadPool< InputType, OutputType > |
numThreadsWorking | ThreadPool< InputType, OutputType > | protected
outputQueue | ThreadPool< InputType, OutputType > | protected
outputQueueMutex | ThreadPool< InputType, OutputType > | protected
OutputSize(void) | ThreadPool< InputType, OutputType > |
Pause(void) | ThreadPool< InputType, OutputType > |
perThreadDataDestructor | ThreadPool< InputType, OutputType > | protected
perThreadDataFactory | ThreadPool< InputType, OutputType > | protected
quitAndIncomingDataEvents | ThreadPool< InputType, OutputType > | protected
RAK_THREAD_DECLARATION(WorkerThread) | ThreadPool< InputType, OutputType > | protected
RemoveInputAtIndex(unsigned index) | ThreadPool< InputType, OutputType > |
RemoveOutputAtIndex(unsigned index) | ThreadPool< InputType, OutputType > |
Resume(void) | ThreadPool< InputType, OutputType > |
runThreads | ThreadPool< InputType, OutputType > | protected
runThreadsMutex | ThreadPool< InputType, OutputType > | protected
SetThreadDataInterface(ThreadDataInterface *tdi, void *context) | ThreadPool< InputType, OutputType > |
StartThreads(int numThreads, int stackSize, void *(*_perThreadInit)()=0, void(*_perThreadDeinit)(void *)=0) | ThreadPool< InputType, OutputType > |
StopThreads(void) | ThreadPool< InputType, OutputType > |
tdiContext | ThreadPool< InputType, OutputType > | protected
threadDataInterface | ThreadPool< InputType, OutputType > | protected
ThreadPool() | ThreadPool< InputType, OutputType > |
UnlockInput(void) | ThreadPool< InputType, OutputType > |
UnlockOutput(void) | ThreadPool< InputType, OutputType > |
WasStarted(void) | ThreadPool< InputType, OutputType > |
workingThreadCountMutex | ThreadPool< InputType, OutputType > | protected
~ThreadPool() | ThreadPool< InputType, OutputType > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/ThreadsafePacketLogger.cpp Source File

  • src
ThreadsafePacketLogger.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_PacketLogger==1
18
19 #include "slikenet/ThreadsafePacketLogger.h"
20 #include <string.h>
21 #include "slikenet/linux_adapter.h"
22 #include "slikenet/osx_adapter.h"
23
24 using namespace SLNet;
25
26 ThreadsafePacketLogger::ThreadsafePacketLogger()
27 {
28
29 }
30 ThreadsafePacketLogger::~ThreadsafePacketLogger()
31 {
32 char **msg;
33 while ((msg = logMessages.ReadLock()) != 0)
34 {
35 rakFree_Ex((*msg), _FILE_AND_LINE_ );
36 }
37 }
38 void ThreadsafePacketLogger::Update(void)
39 {
40 char **msg;
41 while ((msg = logMessages.ReadLock()) != 0)
42 {
43 WriteLog(*msg);
44 rakFree_Ex((*msg), _FILE_AND_LINE_ );
45 }
46 }
47 void ThreadsafePacketLogger::AddToLog(const char *str)
48 {
49 char **msg = logMessages.WriteLock();
50 *msg = (char*) rakMalloc_Ex( strlen(str)+1, _FILE_AND_LINE_ );
51 strcpy_s(*msg, strlen(str)+1, str);
52 logMessages.WriteUnlock();
53 }
54
55 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileListTransfer.h Source File

  • include
  • slikenet
FileListTransfer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_FileListTransfer==1 && _RAKNET_SUPPORT_FileOperations==1
23
24 #ifndef __FILE_LIST_TRANFER_H
25 #define __FILE_LIST_TRANFER_H
26
27 #include "types.h"
28 #include "Export.h"
29 #include "PluginInterface2.h"
30 #include "DS_Map.h"
31 #include "types.h"
32 #include "PacketPriority.h"
33 #include "memoryoverride.h"
34 #include "FileList.h"
35 #include "DS_Queue.h"
36 #include "SimpleMutex.h"
37 #include "ThreadPool.h"
38
39 namespace SLNet
40 {
42 class IncrementalReadInterface;
43 class FileListTransferCBInterface;
44 class FileListProgress;
45 struct FileListReceiver;
46
51
62 class RAK_DLL_EXPORT FileListTransfer : public PluginInterface2
63 {
64 public:
65
66 // GetInstance() and DestroyInstance(instance*)
67 STATIC_FACTORY_DECLARATIONS(FileListTransfer)
68
69 FileListTransfer();
70 virtual ~FileListTransfer();
71
75 void StartIncrementalReadThreads(int numThreads, int threadPriority=-99999);
76
82 unsigned short SetupReceive(FileListTransferCBInterface *handler, bool deleteHandler, SystemAddress allowedSender);
83
93 void Send(FileList *fileList, SLNet::RakPeerInterface *rakPeer, SystemAddress recipient, unsigned short setID, PacketPriority priority, char orderingChannel, IncrementalReadInterface *_incrementalReadInterface=0, unsigned int _chunkSize=262144*4*16);
94
96 unsigned int GetPendingFilesToAddress(SystemAddress recipient);
97
99 void CancelReceive(unsigned short inSetId);
100
102 void RemoveReceiver(SystemAddress systemAddress);
103
105 bool IsHandlerActive(unsigned short inSetId);
106
109 void AddCallback(FileListProgress *cb);
110
113 void RemoveCallback(FileListProgress *cb);
114
116 void ClearCallbacks(void);
117
120 void GetCallbacks(DataStructures::List<FileListProgress*> &callbacks);
121
123 virtual PluginReceiveResult OnReceive(Packet *packet);
125 virtual void OnRakPeerShutdown(void);
127 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
129 virtual void Update(void);
130
131 protected:
132 bool DecodeSetHeader(Packet *packet);
133 bool DecodeFile(Packet *packet, bool fullFile);
134
135 void Clear(void);
136
137 void OnReferencePush(Packet *packet, bool fullFile);
138 void OnReferencePushAck(Packet *packet);
139 void SendIRIToAddress(SystemAddress systemAddress, unsigned short inSetId);
140
141 DataStructures::Map<unsigned short, FileListReceiver*> fileListReceivers;
142 unsigned short setId;
143 DataStructures::List<FileListProgress*> fileListProgressCallbacks;
144
145 struct FileToPush
146 {
147 FileListNode fileListNode;
148 PacketPriority packetPriority;
149 char orderingChannel;
150 unsigned int currentOffset;
152 unsigned int setIndex;
153 IncrementalReadInterface *incrementalReadInterface;
154 unsigned int chunkSize;
155 };
156 struct FileToPushRecipient
157 {
158 unsigned int refCount;
159 SimpleMutex refCountMutex;
160 void DeleteThis(void);
161 void AddRef(void);
162 void Deref(void);
163
164 SystemAddress systemAddress;
165 unsigned short setId;
166
168 DataStructures::Queue<FileToPush*> filesToPush;
169 };
170 DataStructures::List< FileToPushRecipient* > fileToPushRecipientList;
171 SimpleMutex fileToPushRecipientListMutex;
172 void RemoveFromList(FileToPushRecipient *ftpr);
173
174 struct ThreadData
175 {
176 FileListTransfer *fileListTransfer;
177 SystemAddress systemAddress;
178 unsigned short setId;
179 };
180
181 ThreadPool<ThreadData, int> threadPool;
182
183 friend int SendIRIToAddressCB(FileListTransfer::ThreadData threadData, bool *returnOutput, void* perThreadData);
184 };
185
186 } // namespace SLNet
187
188 #endif
189
190 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/smartptr.h Source File

  • include
  • slikenet
smartptr.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __RAKNET_SMART_PTR_H
17 #define __RAKNET_SMART_PTR_H
18
19 // From http://www.codeproject.com/KB/cpp/SmartPointers.aspx
20 // with bugs fixed
21
22 #include "memoryoverride.h"
23 #include "Export.h"
24
25 //static int allocCount=0;
26 //static int deallocCount=0;
27
28 namespace SLNet
29 {
30
31 class RAK_DLL_EXPORT ReferenceCounter
32 {
33 private:
34 int refCount;
35
36 public:
37 ReferenceCounter() {refCount=0;}
38 ~ReferenceCounter() {}
39 void AddRef() {refCount++;}
40 int Release() {return --refCount;}
41 int GetRefCount(void) const {return refCount;}
42 };
43
44 template < typename T > class RAK_DLL_EXPORT RakNetSmartPtr
45 {
46 private:
47 T* ptr; // pointer
48 ReferenceCounter* reference; // Reference refCount
49
50 public:
51 RakNetSmartPtr() : ptr(0), reference(0)
52 {
53 // Do not allocate by default, wasteful if we just have a list of preallocated and unassigend smart pointers
54 }
55
56 RakNetSmartPtr(T* pValue) : ptr(pValue)
57 {
58 reference = SLNet::OP_NEW<ReferenceCounter>(_FILE_AND_LINE_);
59 reference->AddRef();
60
61 // allocCount+=2;
62 // printf("allocCount=%i deallocCount=%i Line=%i\n",allocCount, deallocCount, __LINE__);
63 }
64
65 RakNetSmartPtr(const RakNetSmartPtr<T>& sp) : ptr(sp.ptr), reference(sp.reference)
66 {
67 if (reference)
68 reference->AddRef();
69 }
70
71 ~RakNetSmartPtr()
72 {
73 if(reference && reference->Release() == 0)
74 {
75 SLNet::OP_DELETE(ptr, _FILE_AND_LINE_);
76 SLNet::OP_DELETE(reference, _FILE_AND_LINE_);
77
78 // deallocCount+=2;
79 // printf("allocCount=%i deallocCount=%i Line=%i\n",allocCount, deallocCount, __LINE__);
80 }
81 }
82
83 bool IsNull(void) const
84 {
85 return ptr==0;
86 }
87
88 void SetNull(void)
89 {
90 if(reference && reference->Release() == 0)
91 {
92 SLNet::OP_DELETE(ptr, _FILE_AND_LINE_);
93 SLNet::OP_DELETE(reference, _FILE_AND_LINE_);
94
95 // deallocCount+=2;
96 // printf("allocCount=%i deallocCount=%i Line=%i\n",allocCount, deallocCount, __LINE__);
97 }
98 ptr=0;
99 reference=0;
100 }
101
102 bool IsUnique(void) const
103 {
104 return reference->GetRefCount()==1;
105 }
106
107 // Allow you to change the values of the internal contents of the pointer, without changing what is pointed to by other instances of the smart pointer
108 void Clone(bool copyContents)
109 {
110 if (IsUnique()==false)
111 {
112 reference->Release();
113
114 reference = SLNet::OP_NEW<ReferenceCounter>(_FILE_AND_LINE_);
115 reference->AddRef();
116 T* oldPtr=ptr;
117 ptr= SLNet::OP_NEW<T>(_FILE_AND_LINE_);
118 if (copyContents)
119 *ptr=*oldPtr;
120 }
121 }
122
123 int GetRefCount(void) const
124 {
125 return reference->GetRefCount();
126 }
127
128 T& operator* ()
129 {
130 return *ptr;
131 }
132
133 const T& operator* () const
134 {
135 return *ptr;
136 }
137
138 T* operator-> ()
139 {
140 return ptr;
141 }
142
143 const T* operator-> () const
144 {
145 return ptr;
146 }
147
148 bool operator == (const RakNetSmartPtr<T>& sp)
149 {
150 return ptr == sp.ptr;
151 }
152 bool operator<( const RakNetSmartPtr<T> &right ) {return ptr < right.ptr;}
153 bool operator>( const RakNetSmartPtr<T> &right ) {return ptr > right.ptr;}
154
155 bool operator != (const RakNetSmartPtr<T>& sp)
156 {
157 return ptr != sp.ptr;
158 }
159
160 RakNetSmartPtr<T>& operator = (const RakNetSmartPtr<T>& sp)
161 {
162 // Assignment operator
163
164 if (this != &sp) // Avoid self assignment
165 {
166 if(reference && reference->Release() == 0)
167 {
168 SLNet::OP_DELETE(ptr, _FILE_AND_LINE_);
169 SLNet::OP_DELETE(reference, _FILE_AND_LINE_);
170
171 // deallocCount+=2;
172 // printf("allocCount=%i deallocCount=%i Line=%i\n",allocCount, deallocCount, __LINE__);
173 }
174
175 ptr = sp.ptr;
176 reference = sp.reference;
177 if (reference)
178 reference->AddRef();
179 }
180 return *this;
181 }
182
183
184 };
185
186 } // namespace SLNet
187
188 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileListNodeContext.h Source File

  • include
  • slikenet
FileListNodeContext.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #ifndef __FILE_LIST_NODE_CONTEXT_H
21 #define __FILE_LIST_NODE_CONTEXT_H
22
23 #include "BitStream.h"
24
25 struct FileListNodeContext
26 {
27 FileListNodeContext() {dataPtr=0; dataLength=0;}
28 FileListNodeContext(unsigned char o, uint32_t f1, uint32_t f2, uint32_t f3) : op(o), flnc_extraData1(f1), flnc_extraData2(f2), flnc_extraData3(f3) {dataPtr=0; dataLength=0;}
29 ~FileListNodeContext() {}
30
31 unsigned char op;
32 uint32_t flnc_extraData1;
33 uint32_t flnc_extraData2;
34 uint32_t flnc_extraData3;
35 void *dataPtr;
36 unsigned int dataLength;
37 };
38
39 inline SLNet::BitStream& operator<<(SLNet::BitStream& out, FileListNodeContext& in)
40 {
41 out.Write(in.op);
42 out.Write(in.flnc_extraData1);
43 out.Write(in.flnc_extraData2);
44 out.Write(in.flnc_extraData3);
45 return out;
46 }
47 inline SLNet::BitStream& operator>>(SLNet::BitStream& in, FileListNodeContext& out)
48 {
49 in.Read(out.op);
50 bool success = in.Read(out.flnc_extraData1);
51 (void) success;
52 assert(success);
53 success = in.Read(out.flnc_extraData2);
54 (void) success;
55 assert(success);
56 success = in.Read(out.flnc_extraData3);
57 (void) success;
58 assert(success);
59 return in;
60 }
61
62 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/VitaIncludes.cpp Source File

  • src
VitaIncludes.cpp
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 *
5 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
6 *
7 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
8 * license found in the license.txt file in the root directory of this source tree.
9 */
10
11 #include "slikenet/EmptyHeader.h"
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SocketLayer
SLNet::SocketLayer Member List

This is the complete list of members for SLNet::SocketLayer, including all inherited members.

GetFirstBindableIP(char firstBindable[128], int ipProto) | SLNet::SocketLayer | static
GetLocalPort(__UDPSOCKET__ s) | SLNet::SocketLayer | static
GetMyIP(SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS]) | SLNet::SocketLayer | static
GetSubNetForSocketAndIp(__UDPSOCKET__ inSock, SLNet::RakString inIpString) | SLNet::SocketLayer | static
GetSystemAddress(__UDPSOCKET__ s, SystemAddress *systemAddressOut) | SLNet::SocketLayer | static
GetSystemAddress_Old(__UDPSOCKET__ s, SystemAddress *systemAddressOut) | SLNet::SocketLayer | static
SetSocketOptions(__UDPSOCKET__ listenSocket, bool blockingSocket, bool setBroadcast) | SLNet::SocketLayer | static
SocketLayer() | SLNet::SocketLayer |
~SocketLayer() | SLNet::SocketLayer |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatTypeDetectionClient.cpp Source File

  • src
NatTypeDetectionClient.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_NatTypeDetectionClient==1
18
19 #include "slikenet/NatTypeDetectionClient.h"
20 #include "slikenet/smartptr.h"
21 #include "slikenet/BitStream.h"
22 #include "slikenet/SocketIncludes.h"
23 #include "slikenet/string.h"
24 #include "slikenet/peerinterface.h"
25 #include "slikenet/MessageIdentifiers.h"
26 #include "slikenet/SocketLayer.h"
27 #include "slikenet/SocketDefines.h"
28
29 using namespace SLNet;
30
31 STATIC_FACTORY_DEFINITIONS(NatTypeDetectionClient,NatTypeDetectionClient);
32
33 NatTypeDetectionClient::NatTypeDetectionClient()
34 {
35 c2=0;
36 }
37 NatTypeDetectionClient::~NatTypeDetectionClient()
38 {
39 if (c2!=0)
40 {
41 SLNet::OP_DELETE(c2,_FILE_AND_LINE_);
42 }
43 }
44 void NatTypeDetectionClient::DetectNATType(SystemAddress _serverAddress)
45 {
46 if (IsInProgress())
47 return;
48
49 if (c2==0)
50 {
51 DataStructures::List<RakNetSocket2* > sockets;
52 rakPeerInterface->GetSockets(sockets);
53 //SystemAddress sockAddr;
54 //SocketLayer::GetSystemAddress(sockets[0], &sockAddr);
55 char str[64];
56 //sockAddr.ToString(false,str);
57 sockets[0]->GetBoundAddress().ToString(false,str,static_cast<size_t>(64));
58 c2=CreateNonblockingBoundSocket(str
59 #ifdef __native_client__
60 , sockets[0]->chromeInstance
61 #endif
62 ,this
63 );
64 //c2Port=SocketLayer::GetLocalPort(c2);
65 }
66
67 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
68 if (c2->IsBerkleySocket())
69 ((RNS2_Berkley*) c2)->CreateRecvPollingThread(0);
70 #endif
71
72 serverAddress=_serverAddress;
73
74 SLNet::BitStream bs;
75 bs.Write((unsigned char)ID_NAT_TYPE_DETECTION_REQUEST);
76 bs.Write(true); // IsRequest
77 bs.Write(c2->GetBoundAddress().GetPort());
78 rakPeerInterface->Send(&bs,MEDIUM_PRIORITY,RELIABLE,0,serverAddress,false);
79 }
80 void NatTypeDetectionClient::OnCompletion(NATTypeDetectionResult result)
81 {
82 Packet *p = AllocatePacketUnified(sizeof(MessageID)+sizeof(unsigned char)*2);
83 //printf("Returning nat detection result to the user\n");
84 p->data[0]=ID_NAT_TYPE_DETECTION_RESULT;
85 p->systemAddress=serverAddress;
86 p->systemAddress.systemIndex=(SystemIndex)-1;
87 p->guid=rakPeerInterface->GetGuidFromSystemAddress(serverAddress);
88 p->data[1]=(unsigned char) result;
89 p->wasGeneratedLocally=true;
90 rakPeerInterface->PushBackPacket(p, true);
91
92 // Symmetric and port restricted are determined by server, so no need to notify server we are done
93 if (result!=NAT_TYPE_PORT_RESTRICTED && result!=NAT_TYPE_SYMMETRIC)
94 {
95 // Otherwise tell the server we got this message, so it stops sending tests to us
96 SLNet::BitStream bs;
97 bs.Write((unsigned char)ID_NAT_TYPE_DETECTION_REQUEST);
98 bs.Write(false); // Done
99 rakPeerInterface->Send(&bs,HIGH_PRIORITY,RELIABLE,0,serverAddress,false);
100 }
101
102 Shutdown();
103 }
104 bool NatTypeDetectionClient::IsInProgress(void) const
105 {
106 return serverAddress!=UNASSIGNED_SYSTEM_ADDRESS;
107 }
108 void NatTypeDetectionClient::Update(void)
109 {
110 if (IsInProgress())
111 {
112 RNS2RecvStruct *recvStruct;
113 bufferedPacketsMutex.Lock();
114 if (bufferedPackets.Size()>0)
115 recvStruct=bufferedPackets.Pop();
116 else
117 recvStruct=0;
118 bufferedPacketsMutex.Unlock();
119 while (recvStruct)
120 {
121 if (recvStruct->bytesRead==1 && recvStruct->data[0]==NAT_TYPE_NONE)
122 {
123 OnCompletion(NAT_TYPE_NONE);
124 RakAssert(IsInProgress()==false);
125 }
126 DeallocRNS2RecvStruct(recvStruct, _FILE_AND_LINE_);
127
128 bufferedPacketsMutex.Lock();
129 if (bufferedPackets.Size()>0)
130 recvStruct=bufferedPackets.Pop();
131 else
132 recvStruct=0;
133 bufferedPacketsMutex.Unlock();
134 }
135 }
136 }
137 PluginReceiveResult NatTypeDetectionClient::OnReceive(Packet *packet)
138 {
139 if (IsInProgress())
140 {
141 switch (packet->data[0])
142 {
143 case ID_OUT_OF_BAND_INTERNAL:
144 {
145 if (packet->length>=3 && packet->data[1]==ID_NAT_TYPE_DETECT)
146 {
147 OnCompletion((NATTypeDetectionResult)packet->data[2]);
148 return RR_STOP_PROCESSING_AND_DEALLOCATE;
149 }
150 }
151 break;
152 case ID_NAT_TYPE_DETECTION_RESULT:
153 if (packet->wasGeneratedLocally==false)
154 {
155 OnCompletion((NATTypeDetectionResult)packet->data[1]);
156 return RR_STOP_PROCESSING_AND_DEALLOCATE;
157 }
158 else
159 break;
160 case ID_NAT_TYPE_DETECTION_REQUEST:
161 OnTestPortRestricted(packet);
162 return RR_STOP_PROCESSING_AND_DEALLOCATE;
163 }
164 }
165
166 return RR_CONTINUE_PROCESSING;
167 }
168 void NatTypeDetectionClient::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
169 {
170 (void) lostConnectionReason;
171 (void) rakNetGUID;
172
173 if (IsInProgress() && systemAddress==serverAddress)
174 Shutdown();
175 }
176 void NatTypeDetectionClient::OnRakPeerShutdown(void)
177 {
178 Shutdown();
179 }
180 void NatTypeDetectionClient::OnDetach(void)
181 {
182 Shutdown();
183 }
184 void NatTypeDetectionClient::OnTestPortRestricted(Packet *packet)
185 {
186 SLNet::BitStream bsIn(packet->data,packet->length,false);
187 bsIn.IgnoreBytes(sizeof(MessageID));
188 SLNet::RakString s3p4StrAddress;
189 bsIn.Read(s3p4StrAddress);
190 unsigned short s3p4Port;
191 bsIn.Read(s3p4Port);
192
193 DataStructures::List<RakNetSocket2* > sockets;
194 rakPeerInterface->GetSockets(sockets);
195 SystemAddress s3p4Addr = sockets[0]->GetBoundAddress();
196 s3p4Addr.FromStringExplicitPort(s3p4StrAddress.C_String(), s3p4Port);
197
198 // Send off the RakNet socket to the specified address, message is unformatted
199 // Server does this twice, so don't have to unduly worry about packetloss
200 SLNet::BitStream bsOut;
201 bsOut.Write((MessageID) NAT_TYPE_PORT_RESTRICTED);
202 bsOut.Write(rakPeerInterface->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS));
203 // SocketLayer::SendTo_PC( sockets[0], (const char*) bsOut.GetData(), bsOut.GetNumberOfBytesUsed(), s3p4Addr, __FILE__, __LINE__ );
204
205 RNS2_SendParameters bsp;
206 bsp.data = (char*) bsOut.GetData();
207 bsp.length = bsOut.GetNumberOfBytesUsed();
208 bsp.systemAddress=s3p4Addr;
209 sockets[0]->Send(&bsp, _FILE_AND_LINE_);
210
211 }
212 void NatTypeDetectionClient::Shutdown(void)
213 {
214 serverAddress=UNASSIGNED_SYSTEM_ADDRESS;
215 if (c2!=0)
216 {
217 #if !defined(__native_client__) && !defined(WINDOWS_STORE_RT)
218 if (c2->IsBerkleySocket())
219 ((RNS2_Berkley *)c2)->BlockOnStopRecvPollingThread();
220 #endif
221
222 SLNet::OP_DELETE(c2, _FILE_AND_LINE_);
223 c2=0;
224 }
225
226 bufferedPacketsMutex.Lock();
227 while (bufferedPackets.Size())
228 SLNet::OP_DELETE(bufferedPackets.Pop(), _FILE_AND_LINE_);
229 bufferedPacketsMutex.Unlock();
230 }
231
232 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
233 void NatTypeDetectionClient::DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line)
234 {
235 SLNet::OP_DELETE(s, file, line);
236 }
237 // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
238 RNS2RecvStruct *NatTypeDetectionClient::AllocRNS2RecvStruct(const char *file, unsigned int line)
239 {
240 return SLNet::OP_NEW<RNS2RecvStruct>(file,line);
241 }
242 void NatTypeDetectionClient::OnRNS2Recv(RNS2RecvStruct *recvStruct)
243 {
244 bufferedPacketsMutex.Lock();
245 bufferedPackets.Push(recvStruct,_FILE_AND_LINE_);
246 bufferedPacketsMutex.Unlock();
247 }
248
249 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/RefCountedObj.h Source File

  • include
  • slikenet
RefCountedObj.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __REF_COUNTED_OBJ_H
23 #define __REF_COUNTED_OBJ_H
24
25 #include "memoryoverride.h"
26
28 class RefCountedObj
29 {
30 public:
31 RefCountedObj() {refCount=1;}
32 virtual ~RefCountedObj() {}
33 void AddRef(void) {refCount++;}
34 void Deref(void) {if (--refCount==0) SLNet::OP_DELETE(this, _FILE_AND_LINE_);}
35 int refCount;
36 };
37
38 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketOutputWindowLogger.cpp Source File

  • src
PacketOutputWindowLogger.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_PacketLogger==1
18
19 #if defined(UNICODE)
20 #include "slikenet/wstring.h"
21 #endif
22
23 #include "slikenet/PacketOutputWindowLogger.h"
24 #include "slikenet/string.h"
25 #if defined(_WIN32)
26 #include "slikenet/WindowsIncludes.h"
27 #endif
28
29 using namespace SLNet;
30
31 PacketOutputWindowLogger::PacketOutputWindowLogger()
32 {
33 }
34 PacketOutputWindowLogger::~PacketOutputWindowLogger()
35 {
36 }
37 void PacketOutputWindowLogger::WriteLog(const char *str)
38 {
39 #if defined(_WIN32)
40
41 #if defined(UNICODE)
42 SLNet::RakWString str2 = str;
43 str2+="\n";
44 OutputDebugString(str2.C_String());
45 #else
46 SLNet::RakString str2 = str;
47 str2+="\n";
48 OutputDebugString(str2.C_String());
49 #endif
50 // DS_APR
51 #elif defined(__native_client__)
52 fprintf(stderr, "%s\n", str);
53 // /DS_APR
54 #endif
55 }
56
57 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • DynDNS
SLNet::DynDNS Member List

This is the complete list of members for SLNet::DynDNS, including all inherited members.

checkIpAddress | SLNet::DynDNS | protected
ConnectPhase enum name | SLNet::DynDNS | protected
connectPhase | SLNet::DynDNS | protected
CP_CONNECTING_TO_CHECKIP enum value | SLNet::DynDNS | protected
CP_CONNECTING_TO_DYNDNS enum value | SLNet::DynDNS | protected
CP_IDLE enum value | SLNet::DynDNS | protected
CP_WAITING_FOR_CHECKIP_RESPONSE enum value | SLNet::DynDNS | protected
CP_WAITING_FOR_DYNDNS_RESPONSE enum value | SLNet::DynDNS | protected
DynDNS() | SLNet::DynDNS |
GetCompletedDescription(void) const | SLNet::DynDNS | inline
GetCompletedResultCode(void) | SLNet::DynDNS | inline
GetMyPublicIP(void) const | SLNet::DynDNS | inline
getString | SLNet::DynDNS | protected
host | SLNet::DynDNS | protected
IsCompleted(void) const | SLNet::DynDNS | inline
IsRunning(void) const | SLNet::DynDNS | inline
myIPStr | SLNet::DynDNS | protected
phaseTimeout | SLNet::DynDNS | protected
result | SLNet::DynDNS | protected
resultDescription | SLNet::DynDNS | protected
serverAddress | SLNet::DynDNS | protected
SetCompleted(SLNet::DynDnsResultCode _result, const char *_resultDescription) | SLNet::DynDNS | inlineprotected
Stop(void) | SLNet::DynDNS | protected
tcp | SLNet::DynDNS | protected
Update(void) | SLNet::DynDNS |
UpdateHostIPAsynch(const char *dnsHost, const char *newIPAddress, const char *usernameAndPassword) | SLNet::DynDNS |
WasResultSuccessful(void) const | SLNet::DynDNS | inline
~DynDNS() | SLNet::DynDNS |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PS4Includes.cpp Source File

  • src
PS4Includes.cpp
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082 without any modifications.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 */
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakString.cpp Source File

  • src
RakString.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/string.h"
17 #include "slikenet/assert.h"
18 #include "slikenet/memoryoverride.h"
19 #include "slikenet/BitStream.h"
20 #include <stdarg.h>
21 #include <string.h>
22 #include "slikenet/LinuxStrings.h"
23 #include "slikenet/StringCompressor.h"
24 #include "slikenet/SimpleMutex.h"
25 #include <stdlib.h>
26 #include "slikenet/Itoa.h"
27 #include <limits>
28 #include "slikenet/linux_adapter.h"
29 #include "slikenet/osx_adapter.h"
30
31 using namespace SLNet;
32
33 //DataStructures::MemoryPool<RakString::SharedString> RakString::pool;
34 RakString::SharedString RakString::emptyString={0,0,0,(char*) "",(char*) ""};
35 //RakString::SharedString *RakString::sharedStringFreeList=0;
36 //unsigned int RakString::sharedStringFreeListAllocationCount=0;
37 DataStructures::List<RakString::SharedString*> RakString::freeList;
38
39 class RakStringCleanup
40 {
41 public:
42 ~RakStringCleanup()
43 {
44 SLNet::RakString::FreeMemoryNoMutex();
45 }
46 };
47
48 static RakStringCleanup cleanup;
49
50 SimpleMutex& GetPoolMutex(void)
51 {
52 static SimpleMutex poolMutex;
53 return poolMutex;
54 }
55
56 int SLNet::RakString::RakStringComp( RakString const &key, RakString const &data )
57 {
58 return key.StrCmp(data);
59 }
60
61 RakString::RakString()
62 {
63 sharedString=&emptyString;
64 }
65 RakString::RakString( RakString::SharedString *_sharedString )
66 {
67 sharedString=_sharedString;
68 }
69 RakString::RakString(char input)
70 {
71 char str[2];
72 str[0]=input;
73 str[1]=0;
74 Assign(str);
75 }
76 RakString::RakString(unsigned char input)
77 {
78 char str[2];
79 str[0]=(char) input;
80 str[1]=0;
81 Assign(str);
82 }
83 RakString::RakString(const unsigned char *format, ...){
84 va_list ap;
85 va_start(ap, format);
86 Assign((const char*) format,ap);
87 va_end(ap);
88 }
89 RakString::RakString(const char *format, ...){
90 va_list ap;
91 va_start(ap, format);
92 Assign(format,ap);
93 va_end(ap);
94 }
95 RakString::RakString( const RakString & rhs)
96 {
97 if (rhs.sharedString==&emptyString)
98 {
99 sharedString=&emptyString;
100 return;
101 }
102
103 rhs.sharedString->refCountMutex->Lock();
104 if (rhs.sharedString->refCount==0)
105 {
106 sharedString=&emptyString;
107 }
108 else
109 {
110 rhs.sharedString->refCount++;
111 sharedString=rhs.sharedString;
112 }
113 rhs.sharedString->refCountMutex->Unlock();
114 }
115 RakString::~RakString()
116 {
117 Free();
118 }
119 RakString& RakString::operator = ( const RakString& rhs )
120 {
121 Free();
122 if (rhs.sharedString==&emptyString)
123 return *this;
124
125 rhs.sharedString->refCountMutex->Lock();
126 if (rhs.sharedString->refCount==0)
127 {
128 sharedString=&emptyString;
129 }
130 else
131 {
132 sharedString=rhs.sharedString;
133 sharedString->refCount++;
134 }
135 rhs.sharedString->refCountMutex->Unlock();
136 return *this;
137 }
138 RakString& RakString::operator = ( const char *str )
139 {
140 Free();
141 Assign(str);
142 return *this;
143 }
144 RakString& RakString::operator = ( char *str )
145 {
146 return operator = ((const char*)str);
147 }
148 RakString& RakString::operator = ( const unsigned char *str )
149 {
150 return operator = ((const char*)str);
151 }
152 RakString& RakString::operator = ( char unsigned *str )
153 {
154 return operator = ((const char*)str);
155 }
156 RakString& RakString::operator = ( const char c )
157 {
158 char buff[2];
159 buff[0]=c;
160 buff[1]=0;
161 return operator = ((const char*)buff);
162 }
163 void RakString::Realloc(SharedString *inSharedString, size_t bytes)
164 {
165 if (bytes<= inSharedString->bytesUsed)
166 return;
167
168 RakAssert(bytes>0);
169 size_t oldBytes = inSharedString->bytesUsed;
170 size_t newBytes;
171 const size_t smallStringSize = 128-sizeof(unsigned int)-sizeof(size_t)-sizeof(char*)*2;
172 newBytes = GetSizeToAllocate(bytes);
173 if (oldBytes <=(size_t) smallStringSize && newBytes > (size_t) smallStringSize)
174 {
175 inSharedString->bigString=(char*) rakMalloc_Ex(newBytes, _FILE_AND_LINE_);
176 strcpy_s(inSharedString->bigString, newBytes, inSharedString->smallString);
177 inSharedString->c_str= inSharedString->bigString;
178 }
179 else if (oldBytes > smallStringSize)
180 {
181 inSharedString->bigString=(char*) rakRealloc_Ex(inSharedString->bigString,newBytes, _FILE_AND_LINE_);
182 inSharedString->c_str= inSharedString->bigString;
183 }
184 inSharedString->bytesUsed=newBytes;
185 }
186 RakString& RakString::operator +=( const RakString& rhs)
187 {
188 if (rhs.IsEmpty())
189 return *this;
190
191 if (IsEmpty())
192 {
193 return operator=(rhs);
194 }
195 else
196 {
197 Clone();
198 size_t strLen=rhs.GetLength()+GetLength()+1;
199 Realloc(sharedString, strLen+GetLength());
200 strcat_s(sharedString->c_str,sharedString->bytesUsed,rhs.C_String());
201 }
202 return *this;
203 }
204 RakString& RakString::operator +=( const char *str )
205 {
206 if (str==0 || str[0]==0)
207 return *this;
208
209 if (IsEmpty())
210 {
211 Assign(str);
212 }
213 else
214 {
215 Clone();
216 size_t strLen=strlen(str)+GetLength()+1;
217 Realloc(sharedString, strLen);
218 strcat_s(sharedString->c_str,sharedString->bytesUsed,str);
219 }
220 return *this;
221 }
222 RakString& RakString::operator +=( char *str )
223 {
224 return operator += ((const char*)str);
225 }
226 RakString& RakString::operator +=( const unsigned char *str )
227 {
228 return operator += ((const char*)str);
229 }
230 RakString& RakString::operator +=( unsigned char *str )
231 {
232 return operator += ((const char*)str);
233 }
234 RakString& RakString::operator +=( const char c )
235 {
236 char buff[2];
237 buff[0]=c;
238 buff[1]=0;
239 return operator += ((const char*)buff);
240 }
241 unsigned char RakString::operator[] ( const unsigned int position ) const
242 {
243 RakAssert(position<GetLength());
244 return sharedString->c_str[position];
245 }
246 bool RakString::operator==(const RakString &rhs) const
247 {
248 return strcmp(sharedString->c_str,rhs.sharedString->c_str)==0;
249 }
250 bool RakString::operator==(const char *str) const
251 {
252 return strcmp(sharedString->c_str,str)==0;
253 }
254 bool RakString::operator==(char *str) const
255 {
256 return strcmp(sharedString->c_str,str)==0;
257 }
258 bool RakString::operator < ( const RakString& right ) const
259 {
260 return strcmp(sharedString->c_str,right.C_String()) < 0;
261 }
262 bool RakString::operator <= ( const RakString& right ) const
263 {
264 return strcmp(sharedString->c_str,right.C_String()) <= 0;
265 }
266 bool RakString::operator > ( const RakString& right ) const
267 {
268 return strcmp(sharedString->c_str,right.C_String()) > 0;
269 }
270 bool RakString::operator >= ( const RakString& right ) const
271 {
272 return strcmp(sharedString->c_str,right.C_String()) >= 0;
273 }
274 bool RakString::operator!=(const RakString &rhs) const
275 {
276 return strcmp(sharedString->c_str,rhs.sharedString->c_str)!=0;
277 }
278 bool RakString::operator!=(const char *str) const
279 {
280 return strcmp(sharedString->c_str,str)!=0;
281 }
282 bool RakString::operator!=(char *str) const
283 {
284 return strcmp(sharedString->c_str,str)!=0;
285 }
286 const SLNet::RakString operator+(const SLNet::RakString &lhs, const SLNet::RakString &rhs)
287 {
288 if (lhs.IsEmpty() && rhs.IsEmpty())
289 {
290 return RakString(&RakString::emptyString);
291 }
292 if (lhs.IsEmpty())
293 {
294 rhs.sharedString->refCountMutex->Lock();
295 if (rhs.sharedString->refCount==0)
296 {
297 rhs.sharedString->refCountMutex->Unlock();
298 lhs.sharedString->refCountMutex->Lock();
299 lhs.sharedString->refCount++;
300 lhs.sharedString->refCountMutex->Unlock();
301 return RakString(lhs.sharedString);
302 }
303 else
304 {
305 rhs.sharedString->refCount++;
306 rhs.sharedString->refCountMutex->Unlock();
307 return RakString(rhs.sharedString);
308 }
309 // rhs.sharedString->refCountMutex->Unlock();
310 }
311 if (rhs.IsEmpty())
312 {
313 lhs.sharedString->refCountMutex->Lock();
314 lhs.sharedString->refCount++;
315 lhs.sharedString->refCountMutex->Unlock();
316 return RakString(lhs.sharedString);
317 }
318
319 size_t len1 = lhs.GetLength();
320 size_t len2 = rhs.GetLength();
321 size_t allocatedBytes = len1 + len2 + 1;
322 allocatedBytes = RakString::GetSizeToAllocate(allocatedBytes);
323 RakString::SharedString *sharedString;
324
325 RakString::LockMutex();
326 // sharedString = RakString::pool.Allocate( _FILE_AND_LINE_ );
327 if (RakString::freeList.Size()==0)
328 {
329 //RakString::sharedStringFreeList=(RakString::SharedString*) rakRealloc_Ex(RakString::sharedStringFreeList,(RakString::sharedStringFreeListAllocationCount+1024)*sizeof(RakString::SharedString), _FILE_AND_LINE_);
330 unsigned i;
331 for (i=0; i < 128; i++)
332 {
333 // RakString::freeList.Insert(RakString::sharedStringFreeList+i+RakString::sharedStringFreeListAllocationCount);
334 RakString::SharedString *ss;
335 ss = (RakString::SharedString*) rakMalloc_Ex(sizeof(RakString::SharedString), _FILE_AND_LINE_);
336 ss->refCountMutex= SLNet::OP_NEW<SimpleMutex>(_FILE_AND_LINE_);
337 RakString::freeList.Insert(ss, _FILE_AND_LINE_);
338
339 }
340 //RakString::sharedStringFreeListAllocationCount+=1024;
341 }
342 sharedString = RakString::freeList[RakString::freeList.Size()-1];
343 RakString::freeList.RemoveAtIndex(RakString::freeList.Size()-1);
344 RakString::UnlockMutex();
345
346 const int smallStringSize = 128-sizeof(unsigned int)-sizeof(size_t)-sizeof(char*)*2;
347 sharedString->bytesUsed=allocatedBytes;
348 sharedString->refCount=1;
349 if (allocatedBytes <= (size_t) smallStringSize)
350 {
351 sharedString->c_str=sharedString->smallString;
352 }
353 else
354 {
355 sharedString->bigString=(char*)rakMalloc_Ex(sharedString->bytesUsed, _FILE_AND_LINE_);
356 sharedString->c_str=sharedString->bigString;
357 }
358
359 strcpy_s(sharedString->c_str, sharedString->bytesUsed, lhs);
360 strcat_s(sharedString->c_str, sharedString->bytesUsed, rhs);
361
362 return RakString(sharedString);
363 }
364 const char * RakString::ToLower(void)
365 {
366 Clone();
367
368 size_t strLen = strlen(sharedString->c_str);
369 unsigned i;
370 for (i=0; i < strLen; i++)
371 sharedString->c_str[i]=ToLower(sharedString->c_str[i]);
372 return sharedString->c_str;
373 }
374 const char * RakString::ToUpper(void)
375 {
376 Clone();
377
378 size_t strLen = strlen(sharedString->c_str);
379 unsigned i;
380 for (i=0; i < strLen; i++)
381 sharedString->c_str[i]=ToUpper(sharedString->c_str[i]);
382 return sharedString->c_str;
383 }
384 void RakString::Set(const char *format, ...)
385 {
386 va_list ap;
387 va_start(ap, format);
388 Clear();
389 Assign(format,ap);
390 va_end(ap);
391 }
392 bool RakString::IsEmpty(void) const
393 {
394 return sharedString==&emptyString;
395 }
396 size_t RakString::GetLength(void) const
397 {
398 return strlen(sharedString->c_str);
399 }
400 // http://porg.es/blog/counting-characters-in-utf-8-strings-is-faster
401 int porges_strlen2(char *s)
402 {
403 int i = 0;
404 int iBefore = 0;
405 int count = 0;
406
407 while (s[i] > 0)
408 ascii: i++;
409
410 count += i-iBefore;
411 while (s[i])
412 {
413 if (s[i] > 0)
414 {
415 iBefore = i;
416 goto ascii;
417 }
418 else
419 switch (0xF0 & s[i])
420 {
421 case 0xE0: i += 3; break;
422 case 0xF0: i += 4; break;
423 default: i += 2; break;
424 }
425 ++count;
426 }
427 return count;
428 }
429 size_t RakString::GetLengthUTF8(void) const
430 {
431 return porges_strlen2(sharedString->c_str);
432 }
433 void RakString::Replace(unsigned index, unsigned count, unsigned char c)
434 {
435 RakAssert(index+count < GetLength());
436 Clone();
437 unsigned countIndex=0;
438 while (countIndex<count)
439 {
440 sharedString->c_str[index]=c;
441 index++;
442 countIndex++;
443 }
444
445 }
446 void RakString::SetChar( unsigned index, unsigned char c )
447 {
448 RakAssert(index < GetLength());
449 Clone();
450 sharedString->c_str[index]=c;
451 }
452 void RakString::SetChar( unsigned index, SLNet::RakString s )
453 {
454 RakAssert(index < GetLength());
455 Clone();
456 SLNet::RakString firstHalf = SubStr(0, index);
457 SLNet::RakString secondHalf = SubStr(index+1, (unsigned int)-1);
458 *this = firstHalf;
459 *this += s;
460 *this += secondHalf;
461 }
462
463 #ifdef _WIN32
464 WCHAR * RakString::ToWideChar(void)
465 {
466 //
467 // Special case of NULL or empty input string
468 //
469 if ( (sharedString->c_str == NULL) || (*sharedString->c_str == '\0') )
470 {
471 // Return empty string
472 WCHAR* buf = SLNet::OP_NEW_ARRAY<WCHAR>(1, __FILE__, __LINE__);
473 buf[0] = L'\0';
474 return buf;
475 }
476
477 //
478 // Get size of destination UTF-16 buffer, in WCHAR's
479 //
480 int cchUTF16 = ::MultiByteToWideChar(
481 CP_UTF8, // convert from UTF-8
482 0, // Flags
483 sharedString->c_str, // source UTF-8 string
484 -1, // -1 means string is zero-terminated
485 NULL, // unused - no conversion done in this step
486 0 // request size of destination buffer, in WCHAR's
487 );
488
489 if ( cchUTF16 == 0 )
490 {
491 RakAssert("RakString::ToWideChar exception from cchUTF16==0" && 0);
492 return 0;
493 }
494
495 //
496 // Allocate destination buffer to store UTF-16 string
497 //
498 WCHAR * pszUTF16 = SLNet::OP_NEW_ARRAY<WCHAR>(cchUTF16,__FILE__,__LINE__);
499
500 //
501 // Do the conversion from UTF-8 to UTF-16
502 //
503 int result = ::MultiByteToWideChar(
504 CP_UTF8, // convert from UTF-8
505 0, // Buffer
506 sharedString->c_str, // source UTF-8 string
507 -1, // -1 means string is zero-terminated
508 pszUTF16, // destination buffer
509 cchUTF16 // size of destination buffer, in WCHAR's
510 );
511
512 if ( result == 0 )
513 {
514 RakAssert("RakString::ToWideChar exception from MultiByteToWideChar" && 0);
515 return 0;
516 }
517
518 return pszUTF16;
519 }
520 void RakString::DeallocWideChar(WCHAR * w)
521 {
522 SLNet::OP_DELETE_ARRAY(w,__FILE__,__LINE__);
523 }
524 void RakString::FromWideChar(const wchar_t *source)
525 {
526 Clear();
527 size_t bufSize = wcslen(source)*4;
528
529 // #low - add return value indicating to the caller whether we succeeded (and then handle error case / or thrown an exception)
530 if (bufSize > static_cast<size_t>(std::numeric_limits<int>::max())) {
531 RakAssert("RakString::FromWideChar given string is too long and cannot be converted");
532 return;
533 }
534
535 Allocate(bufSize);
536 WideCharToMultiByte ( CP_ACP, // ANSI code page
537
538
539
540 WC_COMPOSITECHECK, // Check for accented characters
541
542 source, // Source Unicode string
543 -1, // -1 means string is zero-terminated
544 sharedString->c_str, // Destination char string
545 static_cast<int>(bufSize), // Size of buffer
546 NULL, // No default character
547 NULL ); // Don't care about this flag
548
549
550 }
551 SLNet::RakString RakString::FromWideChar_S(const wchar_t *source)
552 {
553 SLNet::RakString rs;
554 rs.FromWideChar(source);
555 return rs;
556 }
557 #endif
558 size_t RakString::Find(const char *stringToFind,size_t pos)
559 {
560 size_t len=GetLength();
561 if (pos>=len || stringToFind==0 || stringToFind[0]==0)
562 {
563 return (size_t) -1;
564 }
565 size_t matchLen= strlen(stringToFind);
566 size_t matchPos=0;
567 size_t iStart=0;
568
569 for (size_t i=pos;i<len;i++)
570 {
571 if (stringToFind[matchPos]==sharedString->c_str[i])
572 {
573 if(matchPos==0)
574 {
575 iStart=i;
576 }
577 matchPos++;
578 }
579 else
580 {
581 matchPos=0;
582 }
583
584 if (matchPos>=matchLen)
585 {
586 return iStart;
587 }
588 }
589
590 return (size_t) -1;
591 }
592
593 void RakString::TruncateUTF8(unsigned int length)
594 {
595 int i = 0;
596 unsigned int count = 0;
597
598 while (sharedString->c_str[i]!=0)
599 {
600 if (count==length)
601 {
602 sharedString->c_str[i]=0;
603 return;
604 }
605 else if (sharedString->c_str[i]>0)
606 {
607 i++;
608 }
609 else
610 {
611 switch (0xF0 & sharedString->c_str[i])
612 {
613 case 0xE0: i += 3; break;
614 case 0xF0: i += 4; break;
615 default: i += 2; break;
616 }
617 }
618
619 count++;
620 }
621 }
622
623 void RakString::Truncate(unsigned int length)
624 {
625 if (length < GetLength())
626 {
627 SetChar(length, 0);
628 }
629 }
630
631 RakString RakString::SubStr(unsigned int index, size_t count) const
632 {
633 size_t length = GetLength();
634 if (index >= length || count==0)
635 return RakString();
636 RakString copy;
637 size_t numBytes = length-index;
638 if (count < numBytes)
639 numBytes=count;
640 copy.Allocate(numBytes+1);
641 size_t i;
642 for (i=0; i < numBytes; i++)
643 copy.sharedString->c_str[i]=sharedString->c_str[index+i];
644 copy.sharedString->c_str[i]=0;
645 return copy;
646 }
647 void RakString::Erase(unsigned int index, unsigned int count)
648 {
649 size_t len = GetLength();
650 RakAssert(index+count <= len);
651
652 Clone();
653 unsigned i;
654 for (i=index; i < len-count; i++)
655 {
656 sharedString->c_str[i]=sharedString->c_str[i+count];
657 }
658 sharedString->c_str[i]=0;
659 }
660 void RakString::TerminateAtLastCharacter(char c)
661 {
662 int i, len=(int) GetLength();
663 for (i=len-1; i >= 0; i--)
664 {
665 if (sharedString->c_str[i]==c)
666 {
667 Clone();
668 sharedString->c_str[i]=0;
669 return;
670 }
671 }
672 }
673 void RakString::StartAfterLastCharacter(char c)
674 {
675 int i, len=(int) GetLength();
676 for (i=len-1; i >= 0; i--)
677 {
678 if (sharedString->c_str[i]==c)
679 {
680 ++i;
681 if (i < len)
682 {
683 *this = SubStr(i,GetLength()-i);
684 }
685 return;
686 }
687 }
688 }
689 void RakString::TerminateAtFirstCharacter(char c)
690 {
691 unsigned int i, len=(unsigned int) GetLength();
692 for (i=0; i < len; i++)
693 {
694 if (sharedString->c_str[i]==c)
695 {
696 if (i > 0)
697 {
698 Clone();
699 sharedString->c_str[i]=0;
700 }
701 }
702 }
703 }
704 void RakString::StartAfterFirstCharacter(char c)
705 {
706 unsigned int i, len=(unsigned int) GetLength();
707 for (i=0; i < len; i++)
708 {
709 if (sharedString->c_str[i]==c)
710 {
711 ++i;
712 if (i < len)
713 {
714 *this = SubStr(i,GetLength()-i);
715 }
716 return;
717 }
718 }
719 }
720 int RakString::GetCharacterCount(char c)
721 {
722 int count=0;
723 unsigned int i, len=(unsigned int) GetLength();
724 for (i=0; i < len; i++)
725 {
726 if (sharedString->c_str[i]==c)
727 {
728 ++count;
729 }
730 }
731 return count;
732 }
733 void RakString::RemoveCharacter(char c)
734 {
735 if (c==0)
736 return;
737
738 unsigned int readIndex, writeIndex=0;
739 for (readIndex=0; sharedString->c_str[readIndex]; readIndex++)
740 {
741 if (sharedString->c_str[readIndex]!=c)
742 sharedString->c_str[writeIndex++]=sharedString->c_str[readIndex];
743 else
744 Clone();
745 }
746 sharedString->c_str[writeIndex]=0;
747 if (writeIndex==0)
748 Clear();
749 }
750 int RakString::StrCmp(const RakString &rhs) const
751 {
752 return strcmp(sharedString->c_str, rhs.C_String());
753 }
754 int RakString::StrNCmp(const RakString &rhs, size_t num) const
755 {
756 return strncmp(sharedString->c_str, rhs.C_String(), num);
757 }
758 int RakString::StrICmp(const RakString &rhs) const
759 {
760 return _stricmp(sharedString->c_str, rhs.C_String());
761 }
762 void RakString::Printf(void)
763 {
764 RAKNET_DEBUG_PRINTF("%s", sharedString->c_str);
765 }
766 void RakString::FPrintf(FILE *fp)
767 {
768 fprintf(fp,"%s", sharedString->c_str);
769 }
770 bool RakString::IPAddressMatch(const char *IP)
771 {
772 unsigned characterIndex;
773
774 if ( IP == 0 || IP[ 0 ] == 0 || strlen( IP ) > 15 )
775 return false;
776
777 characterIndex = 0;
778
779 for(;;)
780 {
781 if (sharedString->c_str[ characterIndex ] == IP[ characterIndex ] )
782 {
783 // Equal characters
784 if ( IP[ characterIndex ] == 0 )
785 {
786 // End of the string and the strings match
787
788 return true;
789 }
790
791 characterIndex++;
792 }
793
794 else
795 {
796 if ( sharedString->c_str[ characterIndex ] == 0 || IP[ characterIndex ] == 0 )
797 {
798 // End of one of the strings
799 break;
800 }
801
802 // Characters do not match
803 if ( sharedString->c_str[ characterIndex ] == '*' )
804 {
805 // Domain is banned.
806 return true;
807 }
808
809 // Characters do not match and it is not a *
810 break;
811 }
812 }
813
814
815 // No match found.
816 return false;
817 }
818 bool RakString::ContainsNonprintableExceptSpaces(void) const
819 {
820 size_t strLen = strlen(sharedString->c_str);
821 unsigned i;
822 for (i=0; i < strLen; i++)
823 {
824 if (sharedString->c_str[i] < ' ' || sharedString->c_str[i] >126)
825 return true;
826 }
827 return false;
828 }
829 bool RakString::IsEmailAddress(void) const
830 {
831 if (IsEmpty())
832 return false;
833 size_t strLen = strlen(sharedString->c_str);
834 if (strLen < 6) // a@b.de
835 return false;
836 if (sharedString->c_str[strLen-4]!='.' && sharedString->c_str[strLen-3]!='.') // .com, .net., .org, .de
837 return false;
838 unsigned i;
839 // Has non-printable?
840 for (i=0; i < strLen; i++)
841 {
842 if (sharedString->c_str[i] <= ' ' || sharedString->c_str[i] >126)
843 return false;
844 }
845 int atCount=0;
846 for (i=0; i < strLen; i++)
847 {
848 if (sharedString->c_str[i]=='@')
849 {
850 atCount++;
851 }
852 }
853 if (atCount!=1)
854 return false;
855 int dotCount=0;
856 for (i=0; i < strLen; i++)
857 {
858 if (sharedString->c_str[i]=='.')
859 {
860 dotCount++;
861 }
862 }
863 if (dotCount==0)
864 return false;
865
866 // There's more I could check, but this is good enough
867 return true;
868 }
869 SLNet::RakString& RakString::URLEncode(void)
870 {
871 RakString result;
872 size_t strLen = strlen(sharedString->c_str);
873 result.Allocate(strLen*3);
874 char *output=result.sharedString->c_str;
875 unsigned int outputIndex=0;
876 unsigned i;
877 unsigned char c;
878 for (i=0; i < strLen; i++)
879 {
880 c=sharedString->c_str[i];
881 if (
882 (c<=47) ||
883 (c>=58 && c<=64) ||
884 (c>=91 && c<=96) ||
885 (c>=123)
886 )
887 {
888 char buff[3];
889 Itoa(c, buff, 16);
890 output[outputIndex++]='%';
891 output[outputIndex++]=buff[0];
892 output[outputIndex++]=buff[1];
893 }
894 else
895 {
896 output[outputIndex++]=c;
897 }
898 }
899
900 output[outputIndex]=0;
901
902 *this = result;
903 return *this;
904 }
905 SLNet::RakString& RakString::URLDecode(void)
906 {
907 RakString result;
908 size_t strLen = strlen(sharedString->c_str);
909 result.Allocate(strLen);
910 char *output=result.sharedString->c_str;
911 unsigned int outputIndex=0;
912 char c;
913 char hexDigits[2];
914 char hexValues[2];
915 unsigned int i;
916 for (i=0; i < strLen; i++)
917 {
918 c=sharedString->c_str[i];
919 if (c=='%')
920 {
921 hexDigits[0]=sharedString->c_str[++i];
922 hexDigits[1]=sharedString->c_str[++i];
923
924 if (hexDigits[0]==' ')
925 hexValues[0]=0;
926
927 if (hexDigits[0]>='A' && hexDigits[0]<='F')
928 hexValues[0]=hexDigits[0]-'A'+10;
929 if (hexDigits[0]>='a' && hexDigits[0]<='f')
930 hexValues[0]=hexDigits[0]-'a'+10;
931 else
932 hexValues[0]=hexDigits[0]-'0';
933
934 if (hexDigits[1]>='A' && hexDigits[1]<='F')
935 hexValues[1]=hexDigits[1]-'A'+10;
936 if (hexDigits[1]>='a' && hexDigits[1]<='f')
937 hexValues[1]=hexDigits[1]-'a'+10;
938 else
939 hexValues[1]=hexDigits[1]-'0';
940
941 output[outputIndex++]=hexValues[0]*16+hexValues[1];
942 }
943 else
944 {
945 output[outputIndex++]=c;
946 }
947 }
948
949 output[outputIndex]=0;
950
951 *this = result;
952 return *this;
953 }
954 void RakString::SplitURI(SLNet::RakString &header, SLNet::RakString &domain, SLNet::RakString &path)
955 {
956 header.Clear();
957 domain.Clear();
958 path.Clear();
959
960 size_t strLen = strlen(sharedString->c_str);
961
962 char c;
963 unsigned int i=0;
964 if (strncmp(sharedString->c_str, "http://", 7)==0)
965 i+=(unsigned int) strlen("http://");
966 else if (strncmp(sharedString->c_str, "https://", 8)==0)
967 i+=(unsigned int) strlen("https://");
968
969 if (strncmp(sharedString->c_str, "www.", 4)==0)
970 i+=(unsigned int) strlen("www.");
971
972 if (i!=0)
973 {
974 header.Allocate(i+1);
975 strncpy_s(header.sharedString->c_str, header.sharedString->bytesUsed, sharedString->c_str, i);
976 header.sharedString->c_str[i]=0;
977 }
978
979
980 domain.Allocate(strLen-i+1);
981 char *domainOutput=domain.sharedString->c_str;
982 unsigned int outputIndex=0;
983 for (; i < strLen; i++)
984 {
985 c=sharedString->c_str[i];
986 if (c=='/')
987 {
988 break;
989 }
990 else
991 {
992 domainOutput[outputIndex++]=sharedString->c_str[i];
993 }
994 }
995
996 domainOutput[outputIndex]=0;
997
998 path.Allocate(strLen-header.GetLength()-outputIndex+1);
999 outputIndex=0;
1000 char *pathOutput=path.sharedString->c_str;
1001 for (; i < strLen; i++)
1002 {
1003 pathOutput[outputIndex++]=sharedString->c_str[i];
1004 }
1005 pathOutput[outputIndex]=0;
1006 }
1007 SLNet::RakString& RakString::SQLEscape(void)
1008 {
1009 int strLen=(int)GetLength();
1010 int escapedCharacterCount=0;
1011 int index;
1012 for (index=0; index < strLen; index++)
1013 {
1014 if (sharedString->c_str[index]=='\'' ||
1015 sharedString->c_str[index]=='"' ||
1016 sharedString->c_str[index]=='\\')
1017 escapedCharacterCount++;
1018 }
1019 if (escapedCharacterCount==0)
1020 return *this;
1021
1022 Clone();
1023 Realloc(sharedString, strLen+escapedCharacterCount);
1024 int writeIndex, readIndex;
1025 writeIndex = strLen+escapedCharacterCount;
1026 readIndex=strLen;
1027 while (readIndex>=0)
1028 {
1029 if (sharedString->c_str[readIndex]=='\'' ||
1030 sharedString->c_str[readIndex]=='"' ||
1031 sharedString->c_str[readIndex]=='\\')
1032 {
1033 sharedString->c_str[writeIndex--]=sharedString->c_str[readIndex--];
1034 sharedString->c_str[writeIndex--]='\\';
1035 }
1036 else
1037 {
1038 sharedString->c_str[writeIndex--]=sharedString->c_str[readIndex--];
1039 }
1040 }
1041 return *this;
1042 }
1043 SLNet::RakString RakString::FormatForPUTOrPost(const char* type, const char* uri, const char* contentType, const char* body, const char* extraHeaders)
1044 {
1045 RakString out;
1046 RakString host;
1047 RakString remotePath;
1048 SLNet::RakString header;
1049 RakString uriRs;
1050 uriRs = uri;
1051 uriRs.SplitURI(header, host, remotePath);
1052
1053 if (host.IsEmpty() || remotePath.IsEmpty())
1054 return out;
1055
1056 // RakString bodyEncoded = body;
1057 // bodyEncoded.URLEncode();
1058
1059 if (extraHeaders!=0 && extraHeaders[0])
1060 {
1061 out.Set("%s %s HTTP/1.1\r\n"
1062 "%s\r\n"
1063 "Host: %s\r\n"
1064 "Content-Type: %s\r\n"
1065 "Content-Length: %u\r\n"
1066 "\r\n"
1067 "%s",
1068 type,
1069 remotePath.C_String(),
1070 extraHeaders,
1071 host.C_String(),
1072 contentType,
1073 //bodyEncoded.GetLength(),
1074 //bodyEncoded.C_String());
1075 strlen(body),
1076 body);
1077 }
1078 else
1079 {
1080 out.Set("%s %s HTTP/1.1\r\n"
1081 "Host: %s\r\n"
1082 "Content-Type: %s\r\n"
1083 "Content-Length: %u\r\n"
1084 "\r\n"
1085 "%s",
1086 type,
1087 remotePath.C_String(),
1088 host.C_String(),
1089 contentType,
1090 //bodyEncoded.GetLength(),
1091 //bodyEncoded.C_String());
1092 strlen(body),
1093 body);
1094 }
1095
1096 return out;
1097 }
1098 RakString RakString::FormatForPOST(const char* uri, const char* contentType, const char* body, const char* extraHeaders)
1099 {
1100 return FormatForPUTOrPost("POST", uri, contentType, body, extraHeaders);
1101 }
1102 RakString RakString::FormatForPUT(const char* uri, const char* contentType, const char* body, const char* extraHeaders)
1103 {
1104 return FormatForPUTOrPost("PUT", uri, contentType, body, extraHeaders);
1105 }
1106 RakString RakString::FormatForGET(const char* uri, const char* extraHeaders)
1107 {
1108 RakString out;
1109 RakString host;
1110 RakString remotePath;
1111 SLNet::RakString header;
1112 SLNet::RakString uriRs;
1113 uriRs = uri;
1114
1115 uriRs.SplitURI(header, host, remotePath);
1116 if (host.IsEmpty() || remotePath.IsEmpty())
1117 return out;
1118
1119 if (extraHeaders && extraHeaders[0])
1120 {
1121 out.Set("GET %s HTTP/1.1\r\n"
1122 "%s\r\n"
1123 "Host: %s\r\n"
1124 "\r\n",
1125 remotePath.C_String(),
1126 extraHeaders,
1127 host.C_String());
1128 }
1129 else
1130 {
1131 out.Set("GET %s HTTP/1.1\r\n"
1132 "Host: %s\r\n"
1133 "\r\n",
1134 remotePath.C_String(),
1135 host.C_String());
1136
1137 }
1138
1139
1140 return out;
1141 }
1142 RakString RakString::FormatForDELETE(const char* uri, const char* extraHeaders)
1143 {
1144 RakString out;
1145 RakString host;
1146 RakString remotePath;
1147 SLNet::RakString header;
1148 SLNet::RakString uriRs;
1149 uriRs = uri;
1150
1151 uriRs.SplitURI(header, host, remotePath);
1152 if (host.IsEmpty() || remotePath.IsEmpty())
1153 return out;
1154
1155 if (extraHeaders && extraHeaders[0])
1156 {
1157 out.Set("DELETE %s HTTP/1.1\r\n"
1158 "%s\r\n"
1159 "Content-Length: 0\r\n"
1160 "Host: %s\r\n"
1161 "Connection: close\r\n"
1162 "\r\n",
1163 remotePath.C_String(),
1164 extraHeaders,
1165 host.C_String());
1166 }
1167 else
1168 {
1169 out.Set("DELETE %s HTTP/1.1\r\n"
1170 "Content-Length: 0\r\n"
1171 "Host: %s\r\n"
1172 "Connection: close\r\n"
1173 "\r\n",
1174 remotePath.C_String(),
1175 host.C_String());
1176 }
1177
1178 return out;
1179 }
1180 SLNet::RakString& RakString::MakeFilePath(void)
1181 {
1182 if (IsEmpty())
1183 return *this;
1184
1185 SLNet::RakString fixedString = *this;
1186 fixedString.Clone();
1187 for (int i=0; fixedString.sharedString->c_str[i]; i++)
1188 {
1189 #ifdef _WIN32
1190 if (fixedString.sharedString->c_str[i]=='/')
1191 fixedString.sharedString->c_str[i]='\\';
1192 #else
1193 if (fixedString.sharedString->c_str[i]=='\\')
1194 fixedString.sharedString->c_str[i]='/';
1195 #endif
1196 }
1197
1198 #ifdef _WIN32
1199 if (fixedString.sharedString->c_str[strlen(fixedString.sharedString->c_str)-1]!='\\')
1200 {
1201 fixedString+='\\';
1202 }
1203 #else
1204 if (fixedString.sharedString->c_str[strlen(fixedString.sharedString->c_str)-1]!='/')
1205 {
1206 fixedString+='/';
1207 }
1208 #endif
1209
1210 if (fixedString!=*this)
1211 *this = fixedString;
1212 return *this;
1213 }
1214 void RakString::FreeMemory(void)
1215 {
1216 LockMutex();
1217 FreeMemoryNoMutex();
1218 UnlockMutex();
1219 }
1220 void RakString::FreeMemoryNoMutex(void)
1221 {
1222 for (unsigned int i=0; i < freeList.Size(); i++)
1223 {
1224 SLNet::OP_DELETE(freeList[i]->refCountMutex,_FILE_AND_LINE_);
1225 rakFree_Ex(freeList[i], _FILE_AND_LINE_ );
1226 }
1227 freeList.Clear(false, _FILE_AND_LINE_);
1228 }
1229 void RakString::Serialize(BitStream *bs) const
1230 {
1231 Serialize(sharedString->c_str, bs);
1232 }
1233 void RakString::Serialize(const char *str, BitStream *bs)
1234 {
1235 unsigned short l = (unsigned short) strlen(str);
1236 bs->Write(l);
1237 bs->WriteAlignedBytes((const unsigned char*) str, (const unsigned int) l);
1238 }
1239 void RakString::SerializeCompressed(BitStream *bs, uint8_t languageId, bool writeLanguageId) const
1240 {
1241 SerializeCompressed(C_String(), bs, languageId, writeLanguageId);
1242 }
1243 void RakString::SerializeCompressed(const char *str, BitStream *bs, uint8_t languageId, bool writeLanguageId)
1244 {
1245 if (writeLanguageId)
1246 bs->WriteCompressed(languageId);
1247 StringCompressor::Instance()->EncodeString(str,0xFFFF,bs,languageId);
1248 }
1249 bool RakString::Deserialize(BitStream *bs)
1250 {
1251 Clear();
1252
1253 bool b;
1254 unsigned short l;
1255 b=bs->Read(l);
1256 if (l>0)
1257 {
1258 Allocate(((unsigned int) l)+1);
1259 b=bs->ReadAlignedBytes((unsigned char*) sharedString->c_str, l);
1260 if (b)
1261 sharedString->c_str[l]=0;
1262 else
1263 Clear();
1264 }
1265 else
1266 bs->AlignReadToByteBoundary();
1267 return b;
1268 }
1269 bool RakString::Deserialize(char *str, BitStream *bs)
1270 {
1271 bool b;
1272 unsigned short l;
1273 b=bs->Read(l);
1274 if (b && l>0)
1275 b=bs->ReadAlignedBytes((unsigned char*) str, l);
1276
1277 if (b==false)
1278 str[0]=0;
1279
1280 str[l]=0;
1281 return b;
1282 }
1283 bool RakString::DeserializeCompressed(BitStream *bs, bool readLanguageId)
1284 {
1285 uint8_t languageId;
1286 if (readLanguageId)
1287 bs->ReadCompressed(languageId);
1288 else
1289 languageId=0;
1290 return StringCompressor::Instance()->DecodeString(this,0xFFFF,bs,languageId);
1291 }
1292 bool RakString::DeserializeCompressed(char *str, BitStream *bs, bool readLanguageId)
1293 {
1294 uint8_t languageId;
1295 if (readLanguageId)
1296 bs->ReadCompressed(languageId);
1297 else
1298 languageId=0;
1299 return StringCompressor::Instance()->DecodeString(str,0xFFFF,bs,languageId);
1300 }
1301 const char *RakString::ToString(int64_t i)
1302 {
1303 static int index=0;
1304 static char buff[64][64];
1305 #if defined(_WIN32)
1306 sprintf_s(buff[index], "%I64d", i);
1307 #else
1308 sprintf_s(buff[index], "%lld", (long long unsigned int) i);
1309 #endif
1310 int lastIndex=index;
1311 if (++index==64)
1312 index=0;
1313 return buff[lastIndex];
1314 }
1315 const char *RakString::ToString(uint64_t i)
1316 {
1317 static int index=0;
1318 static char buff[64][64];
1319 #if defined(_WIN32)
1320 sprintf_s(buff[index], "%I64u", i);
1321 #else
1322 sprintf_s(buff[index], "%llu", (long long unsigned int) i);
1323 #endif
1324 int lastIndex=index;
1325 if (++index==64)
1326 index=0;
1327 return buff[lastIndex];
1328 }
1329 void RakString::Clear(void)
1330 {
1331 Free();
1332 }
1333 void RakString::Allocate(size_t len)
1334 {
1335 RakString::LockMutex();
1336 // sharedString = RakString::pool.Allocate( _FILE_AND_LINE_ );
1337 if (RakString::freeList.Size()==0)
1338 {
1339 //RakString::sharedStringFreeList=(RakString::SharedString*) rakRealloc_Ex(RakString::sharedStringFreeList,(RakString::sharedStringFreeListAllocationCount+1024)*sizeof(RakString::SharedString), _FILE_AND_LINE_);
1340 unsigned i;
1341 for (i=0; i < 128; i++)
1342 {
1343 // RakString::freeList.Insert(RakString::sharedStringFreeList+i+RakString::sharedStringFreeListAllocationCount);
1344 // RakString::freeList.Insert((RakString::SharedString*)rakMalloc_Ex(sizeof(RakString::SharedString), _FILE_AND_LINE_), _FILE_AND_LINE_);
1345
1346 RakString::SharedString *ss;
1347 ss = (RakString::SharedString*) rakMalloc_Ex(sizeof(RakString::SharedString), _FILE_AND_LINE_);
1348 ss->refCountMutex= SLNet::OP_NEW<SimpleMutex>(_FILE_AND_LINE_);
1349 RakString::freeList.Insert(ss, _FILE_AND_LINE_);
1350 }
1351 //RakString::sharedStringFreeListAllocationCount+=1024;
1352 }
1353 sharedString = RakString::freeList[RakString::freeList.Size()-1];
1354 RakString::freeList.RemoveAtIndex(RakString::freeList.Size()-1);
1355 RakString::UnlockMutex();
1356
1357 const size_t smallStringSize = 128-sizeof(unsigned int)-sizeof(size_t)-sizeof(char*)*2;
1358 sharedString->refCount=1;
1359 if (len <= smallStringSize)
1360 {
1361 sharedString->bytesUsed=smallStringSize;
1362 sharedString->c_str=sharedString->smallString;
1363 }
1364 else
1365 {
1366 sharedString->bytesUsed=len<<1;
1367 sharedString->bigString=(char*)rakMalloc_Ex(sharedString->bytesUsed, _FILE_AND_LINE_);
1368 sharedString->c_str=sharedString->bigString;
1369 }
1370 }
1371 void RakString::Assign(const char *str)
1372 {
1373 if (str==0 || str[0]==0)
1374 {
1375 sharedString=&emptyString;
1376 return;
1377 }
1378
1379 size_t len = strlen(str)+1;
1380 Allocate(len);
1381 memcpy(sharedString->c_str, str, len);
1382 }
1383 void RakString::Assign(const char *str, va_list ap)
1384 {
1385 if (str==0 || str[0]==0)
1386 {
1387 sharedString=&emptyString;
1388 return;
1389 }
1390
1391 char stackBuff[512];
1392 int numChars = vsnprintf_s(stackBuff, 511, str, ap);
1393 if (numChars != -1)
1394 {
1395 Assign(stackBuff);
1396 return;
1397 }
1398 char *buff=0, *newBuff;
1399 size_t buffSize=8096;
1400 for(;;)
1401 {
1402 newBuff = (char*) rakRealloc_Ex(buff, buffSize,__FILE__,__LINE__);
1403 if (newBuff==0)
1404 {
1405 notifyOutOfMemory(_FILE_AND_LINE_);
1406 if (buff!=0)
1407 {
1408 Assign(buff);
1409 rakFree_Ex(buff,__FILE__,__LINE__);
1410 }
1411 else
1412 {
1413 Assign(stackBuff);
1414 }
1415 return;
1416 }
1417 buff=newBuff;
1418 if (vsnprintf_s(buff, buffSize, buffSize-1, str, ap)!=-1)
1419 {
1420 Assign(buff);
1421 rakFree_Ex(buff,__FILE__,__LINE__);
1422 return;
1423 }
1424 buffSize*=2;
1425 }
1426 }
1427 SLNet::RakString RakString::Assign(const char *str,size_t pos, size_t n )
1428 {
1429 size_t incomingLen=strlen(str);
1430
1431 Clone();
1432
1433 if (str==0 || str[0]==0||pos>=incomingLen)
1434 {
1435 sharedString=&emptyString;
1436 return (*this);
1437 }
1438
1439 if (pos+n>=incomingLen)
1440 {
1441 n=incomingLen-pos;
1442
1443 }
1444 const char * tmpStr=&(str[pos]);
1445
1446 size_t len = n+1;
1447 Allocate(len);
1448 memcpy(sharedString->c_str, tmpStr, len);
1449 sharedString->c_str[n]=0;
1450
1451 return (*this);
1452 }
1453
1454 SLNet::RakString RakString::NonVariadic(const char *str)
1455 {
1456 SLNet::RakString rs;
1457 rs=str;
1458 return rs;
1459 }
1460 unsigned long RakString::ToInteger(const char *str)
1461 {
1462 unsigned long hash = 0;
1463 int c;
1464
1465 while ((c = *str++))
1466 hash = c + (hash << 6) + (hash << 16) - hash;
1467
1468 return hash;
1469 }
1470 unsigned long RakString::ToInteger(const RakString &rs)
1471 {
1472 return RakString::ToInteger(rs.C_String());
1473 }
1474 int RakString::ReadIntFromSubstring(const char *str, size_t pos, size_t n)
1475 {
1476 char tmp[32];
1477 if (n >= 32)
1478 return 0;
1479 for (size_t i=0; i < n; i++)
1480 tmp[i]=str[i+pos];
1481 return atoi(tmp);
1482 }
1483 void RakString::AppendBytes(const char *bytes, size_t count)
1484 {
1485 if (IsEmpty())
1486 {
1487 Allocate(count);
1488 memcpy(sharedString->c_str, bytes, count+1);
1489 sharedString->c_str[count]=0;
1490 }
1491 else
1492 {
1493 Clone();
1494 unsigned int length=(unsigned int) GetLength();
1495 Realloc(sharedString, count+length+1);
1496 memcpy(sharedString->c_str+length, bytes, count);
1497 sharedString->c_str[length+count]=0;
1498 }
1499
1500
1501 }
1502 void RakString::Clone(void)
1503 {
1504 RakAssert(sharedString!=&emptyString);
1505 if (sharedString==&emptyString)
1506 {
1507 return;
1508 }
1509
1510 // Empty or solo then no point to cloning
1511 sharedString->refCountMutex->Lock();
1512 if (sharedString->refCount==1)
1513 {
1514 sharedString->refCountMutex->Unlock();
1515 return;
1516 }
1517
1518 sharedString->refCount--;
1519 sharedString->refCountMutex->Unlock();
1520 Assign(sharedString->c_str);
1521 }
1522 void RakString::Free(void)
1523 {
1524 if (sharedString==&emptyString)
1525 return;
1526 sharedString->refCountMutex->Lock();
1527 sharedString->refCount--;
1528 if (sharedString->refCount==0)
1529 {
1530 sharedString->refCountMutex->Unlock();
1531 const size_t smallStringSize = 128-sizeof(unsigned int)-sizeof(size_t)-sizeof(char*)*2;
1532 if (sharedString->bytesUsed>smallStringSize)
1533 rakFree_Ex(sharedString->bigString, _FILE_AND_LINE_ );
1534 /*
1535 poolMutex->Lock();
1536 pool.Release(sharedString);
1537 poolMutex->Unlock();
1538 */
1539
1540 RakString::LockMutex();
1541 RakString::freeList.Insert(sharedString, _FILE_AND_LINE_);
1542 RakString::UnlockMutex();
1543
1544 sharedString=&emptyString;
1545 }
1546 else
1547 {
1548 sharedString->refCountMutex->Unlock();
1549 }
1550 sharedString=&emptyString;
1551 }
1552 unsigned char RakString::ToLower(unsigned char c)
1553 {
1554 if (c >= 'A' && c <= 'Z')
1555 return c-'A'+'a';
1556 return c;
1557 }
1558 unsigned char RakString::ToUpper(unsigned char c)
1559 {
1560 if (c >= 'a' && c <= 'z')
1561 return c-'a'+'A';
1562 return c;
1563 }
1564 void RakString::LockMutex(void)
1565 {
1566 GetPoolMutex().Lock();
1567 }
1568 void RakString::UnlockMutex(void)
1569 {
1570 GetPoolMutex().Unlock();
1571 }
1572
1573 /*
1574 #include "slikenet/string.h"
1575 #include <string>
1576 #include "slikenet/GetTime.h"
1577
1578 using namespace SLNet;
1579
1580 int main(void)
1581 {
1582 RakString s3("Hello world");
1583 RakString s5=s3;
1584
1585 RakString s1;
1586 RakString s2('a');
1587
1588 RakString s4("%i %f", 5, 6.0);
1589
1590 RakString s6=s3;
1591 RakString s7=s6;
1592 RakString s8=s6;
1593 RakString s9;
1594 s9=s9;
1595 RakString s10(s3);
1596 RakString s11=s10 + s4 + s9 + s2;
1597 s11+=RakString("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
1598 RakString s12("Test");
1599 s12+=s11;
1600 bool b1 = s12==s12;
1601 s11=s5;
1602 s12.ToUpper();
1603 s12.ToLower();
1604 RakString s13;
1605 bool b3 = s13.IsEmpty();
1606 s13.Set("blah %s", s12.C_String());
1607 bool b4 = s13.IsEmpty();
1608 size_t i1=s13.GetLength();
1609 s3.Clear(_FILE_AND_LINE_);
1610 s4.Clear(_FILE_AND_LINE_);
1611 s5.Clear(_FILE_AND_LINE_);
1612 s5.Clear(_FILE_AND_LINE_);
1613 s6.Printf();
1614 s7.Printf();
1615 RAKNET_DEBUG_PRINTF("\n");
1616
1617 static const int repeatCount=750;
1618 DataStructures::List<RakString> rakStringList;
1619 DataStructures::List<std::string> stdStringList;
1620 DataStructures::List<char*> referenceStringList;
1621 char *c;
1622 unsigned i;
1623 SLNet::TimeMS beforeReferenceList, beforeRakString, beforeStdString, afterStdString;
1624
1625 unsigned loop;
1626 for (loop=0; loop<2; loop++)
1627 {
1628 beforeReferenceList=SLNet::GetTimeMS();
1629 for (i=0; i < repeatCount; i++)
1630 {
1631 c = SLNet::OP_NEW_ARRAY<char >(56,_FILE_AND_LINE_ );
1632 strcpy_s(c, 56, "Aalsdkj alsdjf laksdjf ;lasdfj ;lasjfd");
1633 referenceStringList.Insert(c);
1634 }
1635 beforeRakString=SLNet::GetTimeMS();
1636 for (i=0; i < repeatCount; i++)
1637 rakStringList.Insert("Aalsdkj alsdjf laksdjf ;lasdfj ;lasjfd");
1638 beforeStdString=SLNet::GetTimeMS();
1639
1640 for (i=0; i < repeatCount; i++)
1641 stdStringList.Insert("Aalsdkj alsdjf laksdjf ;lasdfj ;lasjfd");
1642 afterStdString=SLNet::GetTimeMS();
1643 RAKNET_DEBUG_PRINTF("Insertion 1 Ref=%i Rak=%i, Std=%i\n", beforeRakString-beforeReferenceList, beforeStdString-beforeRakString, afterStdString-beforeStdString);
1644
1645 beforeReferenceList=SLNet::GetTimeMS();
1646 for (i=0; i < repeatCount; i++)
1647 {
1648 SLNet::OP_DELETE_ARRAY(referenceStringList[0], _FILE_AND_LINE_);
1649 referenceStringList.RemoveAtIndex(0);
1650 }
1651 beforeRakString=SLNet::GetTimeMS();
1652 for (i=0; i < repeatCount; i++)
1653 rakStringList.RemoveAtIndex(0);
1654 beforeStdString=SLNet::GetTimeMS();
1655 for (i=0; i < repeatCount; i++)
1656 stdStringList.RemoveAtIndex(0);
1657 afterStdString=SLNet::GetTimeMS();
1658 RAKNET_DEBUG_PRINTF("RemoveHead Ref=%i Rak=%i, Std=%i\n", beforeRakString-beforeReferenceList, beforeStdString-beforeRakString, afterStdString-beforeStdString);
1659
1660 beforeReferenceList=SLNet::GetTimeMS();
1661 for (i=0; i < repeatCount; i++)
1662 {
1663 c = SLNet::OP_NEW_ARRAY<char >(56, _FILE_AND_LINE_ );
1664 strcpy_s(c, 56, "Aalsdkj alsdjf laksdjf ;lasdfj ;lasjfd");
1665 referenceStringList.Insert(0);
1666 }
1667 beforeRakString=SLNet::GetTimeMS();
1668 for (i=0; i < repeatCount; i++)
1669 rakStringList.Insert("Aalsdkj alsdjf laksdjf ;lasdfj ;lasjfd");
1670 beforeStdString=SLNet::GetTimeMS();
1671 for (i=0; i < repeatCount; i++)
1672 stdStringList.Insert("Aalsdkj alsdjf laksdjf ;lasdfj ;lasjfd");
1673 afterStdString=SLNet::GetTimeMS();
1674 RAKNET_DEBUG_PRINTF("Insertion 2 Ref=%i Rak=%i, Std=%i\n", beforeRakString-beforeReferenceList, beforeStdString-beforeRakString, afterStdString-beforeStdString);
1675
1676 beforeReferenceList=SLNet::GetTimeMS();
1677 for (i=0; i < repeatCount; i++)
1678 {
1679 SLNet::OP_DELETE_ARRAY(referenceStringList[referenceStringList.Size()-1], _FILE_AND_LINE_);
1680 referenceStringList.RemoveAtIndex(referenceStringList.Size()-1);
1681 }
1682 beforeRakString=SLNet::GetTimeMS();
1683 for (i=0; i < repeatCount; i++)
1684 rakStringList.RemoveAtIndex(rakStringList.Size()-1);
1685 beforeStdString=SLNet::GetTimeMS();
1686 for (i=0; i < repeatCount; i++)
1687 stdStringList.RemoveAtIndex(stdStringList.Size()-1);
1688 afterStdString=SLNet::GetTimeMS();
1689 RAKNET_DEBUG_PRINTF("RemoveTail Ref=%i Rak=%i, Std=%i\n", beforeRakString-beforeReferenceList, beforeStdString-beforeRakString, afterStdString-beforeStdString);
1690
1691 }
1692
1693 printf("Done.");
1694 char str[128];
1695 Gets(str, sizeof(str));
1696 return 1;
1697 }
1698 */
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NetworkIDObject.cpp Source File

  • src
NetworkIDObject.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #include "slikenet/NetworkIDObject.h"
21 #include "slikenet/NetworkIDManager.h"
22 #include "slikenet/assert.h"
23 #include "slikenet/alloca.h"
24
25 using namespace SLNet;
26
27 NetworkIDObject::NetworkIDObject()
28 {
29 networkID=UNASSIGNED_NETWORK_ID;
30 parent=0;
31 networkIDManager=0;
32 nextInstanceForNetworkIDManager=0;
33 }
34 NetworkIDObject::~NetworkIDObject()
35 {
36 if (networkIDManager)
37 networkIDManager->StopTrackingNetworkIDObject(this);
38 }
39 void NetworkIDObject::SetNetworkIDManager( NetworkIDManager *manager)
40 {
41 if (manager==networkIDManager)
42 return;
43
44 if (networkIDManager)
45 networkIDManager->StopTrackingNetworkIDObject(this);
46
47 networkIDManager=manager;
48 if (networkIDManager==0)
49 {
50 networkID = UNASSIGNED_NETWORK_ID;
51 return;
52 }
53
54 if (networkID == UNASSIGNED_NETWORK_ID)
55 {
56 // Prior ID not set
57 networkID = networkIDManager->GetNewNetworkID();
58 }
59
60 networkIDManager->TrackNetworkIDObject(this);
61 }
62 NetworkIDManager * NetworkIDObject::GetNetworkIDManager( void ) const
63 {
64 return networkIDManager;
65 }
66 NetworkID NetworkIDObject::GetNetworkID( void )
67 {
68 return networkID;
69 }
70 void NetworkIDObject::SetNetworkID( NetworkID id )
71 {
72 if (networkID==id)
73 return;
74
75 if ( id == UNASSIGNED_NETWORK_ID )
76 {
77 SetNetworkIDManager(0);
78 return;
79 }
80
81 if ( networkIDManager )
82 networkIDManager->StopTrackingNetworkIDObject(this);
83
84 networkID = id;
85
86 if (networkIDManager)
87 networkIDManager->TrackNetworkIDObject(this);
88 }
89 void NetworkIDObject::SetParent( void *_parent )
90 {
91 parent=_parent;
92 }
93 void* NetworkIDObject::GetParent( void ) const
94 {
95 return parent;
96 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/DS_BytePool.cpp Source File

  • src
DS_BytePool.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/DS_BytePool.h"
17 #include "slikenet/assert.h"
18 #ifndef __APPLE__
19 // Use stdlib and not malloc for compatibility
20 #include <stdlib.h>
21 #endif
22
23 using namespace DataStructures;
24
25 BytePool::BytePool()
26 {
27 pool128.SetPageSize(8192*4);
28 pool512.SetPageSize(8192*4);
29 pool2048.SetPageSize(8192*4);
30 pool8192.SetPageSize(8192*4);
31 }
32 BytePool::~BytePool()
33 {
34 }
35 void BytePool::SetPageSize(int size)
36 {
37 pool128.SetPageSize(size);
38 pool512.SetPageSize(size);
39 pool2048.SetPageSize(size);
40 pool8192.SetPageSize(size);
41 }
42 unsigned char *BytePool::Allocate(int bytesWanted, const char *file, unsigned int line)
43 {
44 #ifdef _DISABLE_BYTE_POOL
45 return rakMalloc_Ex(bytesWanted, _FILE_AND_LINE_);
46 #endif
47 unsigned char *out;
48 if (bytesWanted <= 127)
49 {
50 #ifdef _THREADSAFE_BYTE_POOL
51 mutex128.Lock();
52 #endif
53 out = (unsigned char*) pool128.Allocate(file, line);
54 #ifdef _THREADSAFE_BYTE_POOL
55 mutex128.Unlock();
56 #endif
57 out[0]=0;
58 return ((unsigned char*) out)+1;
59 }
60 if (bytesWanted <= 511)
61 {
62 #ifdef _THREADSAFE_BYTE_POOL
63 mutex512.Lock();
64 #endif
65 out = (unsigned char*) pool512.Allocate(file, line);
66 #ifdef _THREADSAFE_BYTE_POOL
67 mutex512.Unlock();
68 #endif
69 out[0]=1;
70 return ((unsigned char*) out)+1;
71 }
72 if (bytesWanted <= 2047)
73 {
74 #ifdef _THREADSAFE_BYTE_POOL
75 mutex2048.Lock();
76 #endif
77 out = (unsigned char*) pool2048.Allocate(file, line);
78 #ifdef _THREADSAFE_BYTE_POOL
79 mutex2048.Unlock();
80 #endif
81 out[0]=2;
82 return ((unsigned char*) out)+1;
83 }
84 if (bytesWanted <= 8191)
85 {
86 #ifdef _THREADSAFE_BYTE_POOL
87 mutex8192.Lock();
88 #endif
89 out = (unsigned char*) pool8192.Allocate(file, line);
90 #ifdef _THREADSAFE_BYTE_POOL
91 mutex8192.Unlock();
92 #endif
93 out[0]=3;
94 return ((unsigned char*) out)+1;
95 }
96
97 out = (unsigned char*) rakMalloc_Ex(bytesWanted+1, _FILE_AND_LINE_);
98 out[0]=(unsigned char)255;
99 return out+1;
100 }
101 void BytePool::Release(unsigned char *data, const char *file, unsigned int line)
102 {
103 #ifdef _DISABLE_BYTE_POOL
104 _rakFree_Ex(data, _FILE_AND_LINE_ );
105 #endif
106 unsigned char *realData = data-1;
107 switch (realData[0])
108 {
109 case 0:
110 #ifdef _THREADSAFE_BYTE_POOL
111 mutex128.Lock();
112 #endif
113 pool128.Release((unsigned char(*)[128]) realData, file, line );
114 #ifdef _THREADSAFE_BYTE_POOL
115 mutex128.Unlock();
116 #endif
117 break;
118 case 1:
119 #ifdef _THREADSAFE_BYTE_POOL
120 mutex512.Lock();
121 #endif
122 pool512.Release((unsigned char(*)[512]) realData, file, line );
123 #ifdef _THREADSAFE_BYTE_POOL
124 mutex512.Unlock();
125 #endif
126 break;
127 case 2:
128 #ifdef _THREADSAFE_BYTE_POOL
129 mutex2048.Lock();
130 #endif
131 pool2048.Release((unsigned char(*)[2048]) realData, file, line );
132 #ifdef _THREADSAFE_BYTE_POOL
133 mutex2048.Unlock();
134 #endif
135 break;
136 case 3:
137 #ifdef _THREADSAFE_BYTE_POOL
138 mutex8192.Lock();
139 #endif
140 pool8192.Release((unsigned char(*)[8192]) realData, file, line );
141 #ifdef _THREADSAFE_BYTE_POOL
142 mutex8192.Unlock();
143 #endif
144 break;
145 case 255:
146 rakFree_Ex(realData, file, line );
147 break;
148 default:
149 RakAssert(0);
150 break;
151 }
152 }
153 void BytePool::Clear(const char *file, unsigned int line)
154 {
155 (void) file;
156 (void) line;
157
158 #ifdef _THREADSAFE_BYTE_POOL
159 pool128.Clear(file, line);
160 pool512.Clear(file, line);
161 pool2048.Clear(file, line);
162 pool8192.Clear(file, line);
163 #endif
164 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/peerinterface.h Source File

  • include
  • slikenet
peerinterface.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __RAK_PEER_INTERFACE_H
23 #define __RAK_PEER_INTERFACE_H
24
25 #include "PacketPriority.h"
26 #include "types.h"
27 #include "memoryoverride.h"
28 #include "Export.h"
29 #include "DS_List.h"
30 #include "smartptr.h"
31 #include "socket2.h"
32
33 namespace SLNet
34 {
35 // Forward declarations
36 class BitStream;
37 class PluginInterface2;
38 struct RPCMap;
39 struct RakNetStatistics;
40 struct RakNetBandwidth;
41 class RouterInterface;
42 class NetworkIDManager;
43
47 class RAK_DLL_EXPORT RakPeerInterface
48 {
49 public:
50 // GetInstance() and DestroyInstance(instance*)
51 STATIC_FACTORY_DECLARATIONS(RakPeerInterface)
52
53
54 virtual ~RakPeerInterface() {}
55
56 // --------------------------------------------------------------------------------------------Major Low Level Functions - Functions needed by most users--------------------------------------------------------------------------------------------
69 virtual StartupResult Startup( unsigned int maxConnections, SocketDescriptor *socketDescriptors, unsigned socketDescriptorCount, int threadPriority=-99999 )=0;
70
80 virtual bool InitializeSecurity( const char *publicKey, const char *privateKey, bool bRequireClientKey = false )=0;
81
84 virtual void DisableSecurity( void )=0;
85
90 virtual void AddToSecurityExceptionList(const char *ip)=0;
91
94 virtual void RemoveFromSecurityExceptionList(const char *ip)=0;
95
98 virtual bool IsInSecurityExceptionList(const char *ip)=0;
99
105 virtual void SetMaximumIncomingConnections( unsigned short numberAllowed )=0;
106
109 virtual unsigned int GetMaximumIncomingConnections( void ) const=0;
110
113 virtual unsigned short NumberOfConnections(void) const=0;
114
119 virtual void SetIncomingPassword( const char* passwordData, int passwordDataLength )=0;
120
124 virtual void GetIncomingPassword( char* passwordData, int *passwordDataLength )=0;
125
144 virtual ConnectionAttemptResult Connect( const char* host, unsigned short remotePort, const char *passwordData, int passwordDataLength, PublicKey *publicKey=0, unsigned connectionSocketIndex=0, unsigned sendConnectionAttemptCount=12, unsigned timeBetweenSendConnectionAttemptsMS=500, SLNet::TimeMS timeoutTime=0 )=0;
145
157 virtual ConnectionAttemptResult ConnectWithSocket(const char* host, unsigned short remotePort, const char *passwordData, int passwordDataLength, RakNetSocket2* socket, PublicKey *publicKey=0, unsigned sendConnectionAttemptCount=12, unsigned timeBetweenSendConnectionAttemptsMS=500, SLNet::TimeMS timeoutTime=0)=0;
158
163 //virtual bool Console2LobbyConnect( void *networkServiceId, const char *passwordData, int passwordDataLength )=0;
164
170 virtual void Shutdown( unsigned int blockDuration, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY )=0;
171
174 virtual bool IsActive( void ) const=0;
175
179 virtual bool GetConnectionList( SystemAddress *remoteSystems, unsigned short *numberOfSystems ) const=0;
180
184 virtual uint32_t GetNextSendReceipt(void)=0;
185
189 virtual uint32_t IncrementNextSendReceipt(void)=0;
190
203 virtual uint32_t Send( const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0 )=0;
204
210 virtual void SendLoopback( const char *data, const int length )=0;
211
222 virtual uint32_t Send( const SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0 )=0;
223
244 virtual 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 )=0;
245
252 virtual Packet* Receive( void )=0;
253
256 virtual void DeallocatePacket( Packet *packet )=0;
257
259 virtual unsigned int GetMaximumNumberOfPeers( void ) const=0;
260
261 // -------------------------------------------------------------------------------------------- Connection Management Functions--------------------------------------------------------------------------------------------
267 virtual void CloseConnection( const AddressOrGUID target, bool sendDisconnectionNotification, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY )=0;
268
273 virtual ConnectionState GetConnectionState(const AddressOrGUID systemIdentifier)=0;
274
278 virtual void CancelConnectionAttempt( const SystemAddress target )=0;
279
283 virtual int GetIndexFromSystemAddress( const SystemAddress systemAddress ) const=0;
284
289 virtual SystemAddress GetSystemAddressFromIndex( unsigned int index )=0;
290
294 virtual RakNetGUID GetGUIDFromIndex( unsigned int index )=0;
295
300 virtual void GetSystemList(DataStructures::List<SystemAddress> &addresses, DataStructures::List<RakNetGUID> &guids) const=0;
301
305 virtual void AddToBanList( const char *IP, SLNet::TimeMS milliseconds=0 )=0;
306
309 virtual void RemoveFromBanList( const char *IP )=0;
310
312 virtual void ClearBanList( void )=0;
313
317 virtual bool IsBanned( const char *IP )=0;
318
322 virtual void SetLimitIPConnectionFrequency(bool b)=0;
323
324 // --------------------------------------------------------------------------------------------Pinging Functions - Functions dealing with the automatic ping mechanism--------------------------------------------------------------------------------------------
328 virtual void Ping( const SystemAddress target )=0;
329
337 virtual bool Ping( const char* host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections, unsigned connectionSocketIndex=0 )=0;
338
342 virtual int GetAveragePing( const AddressOrGUID systemIdentifier )=0;
343
347 virtual int GetLastPing( const AddressOrGUID systemIdentifier ) const=0;
348
352 virtual int GetLowestPing( const AddressOrGUID systemIdentifier ) const=0;
353
358 virtual void SetOccasionalPing( bool doPing )=0;
359
364 virtual SLNet::Time GetClockDifferential( const AddressOrGUID systemIdentifier )=0;
365
366 // --------------------------------------------------------------------------------------------Static Data Functions - Functions dealing with API defined synchronized memory--------------------------------------------------------------------------------------------
372 virtual void SetOfflinePingResponse( const char *data, const unsigned int length )=0;
373
378 virtual void GetOfflinePingResponse( char **data, unsigned int *length )=0;
379
380 //--------------------------------------------------------------------------------------------Network Functions - Functions dealing with the network in general--------------------------------------------------------------------------------------------
386 virtual SystemAddress GetInternalID( const SystemAddress systemAddress=UNASSIGNED_SYSTEM_ADDRESS, const int index=0 ) const=0;
387
391 virtual void SetInternalID(SystemAddress systemAddress, int index=0)=0;
392
396 virtual SystemAddress GetExternalID( const SystemAddress target ) const=0;
397
399 virtual const RakNetGUID GetMyGUID(void) const=0;
400
402 virtual SystemAddress GetMyBoundAddress(const int socketIndex=0)=0;
403
405 static uint64_t Get64BitUniqueRandomNumber(void);
406
414 virtual const RakNetGUID& GetGuidFromSystemAddress( const SystemAddress input ) const=0;
415
421 virtual SystemAddress GetSystemAddressFromGuid( const RakNetGUID input ) const=0;
422
427 virtual bool GetClientPublicKeyFromSystemAddress( const SystemAddress input, char *client_public_key ) const=0;
428
434 virtual void SetTimeoutTime(SLNet::TimeMS timeMS, const SystemAddress target )=0;
435
438 virtual SLNet::TimeMS GetTimeoutTime( const SystemAddress target )=0;
439
443 virtual int GetMTUSize( const SystemAddress target ) const=0;
444
446 virtual unsigned GetNumberOfAddresses( void )=0;
447
451 virtual const char* GetLocalIP( unsigned int index )=0;
452
456 virtual bool IsLocalIP( const char *ip )=0;
457
461 virtual void AllowConnectionResponseIPMigration( bool allow )=0;
462
472 virtual bool AdvertiseSystem( const char *host, unsigned short remotePort, const char *data, int dataLength, unsigned connectionSocketIndex=0 )=0;
473
479 virtual void SetSplitMessageProgressInterval(int interval)=0;
480
483 virtual int GetSplitMessageProgressInterval(void) const=0;
484
489 virtual void SetUnreliableTimeout(SLNet::TimeMS timeoutMS)=0;
490
494 virtual void SendTTL( const char* host, unsigned short remotePort, int ttl, unsigned connectionSocketIndex=0 )=0;
495
496 // -------------------------------------------------------------------------------------------- Plugin Functions--------------------------------------------------------------------------------------------
500 virtual void AttachPlugin( PluginInterface2 *plugin )=0;
501
506 virtual void DetachPlugin( PluginInterface2 *messageHandler )=0;
507
508 // --------------------------------------------------------------------------------------------Miscellaneous Functions--------------------------------------------------------------------------------------------
512 virtual void PushBackPacket( Packet *packet, bool pushAtHead )=0;
513
518 virtual void ChangeSystemAddress(RakNetGUID guid, const SystemAddress &systemAddress)=0;
519
524 virtual Packet* AllocatePacket(unsigned dataSize)=0;
525
531 virtual RakNetSocket2* GetSocket( const SystemAddress target )=0;
532
536 virtual void GetSockets( DataStructures::List<RakNetSocket2* > &sockets )=0;
537 virtual void ReleaseSockets( DataStructures::List<RakNetSocket2* > &sockets )=0;
538
539 virtual void WriteOutOfBandHeader(SLNet::BitStream *bitStream)=0;
540
544 virtual void SetUserUpdateThread(void (*_userUpdateThreadPtr)(RakPeerInterface *, void *), void *_userUpdateThreadData)=0;
545
553 virtual void SetIncomingDatagramEventHandler( bool (*_incomingDatagramEventHandler)(RNS2RecvStruct *) )=0;
554
555 // --------------------------------------------------------------------------------------------Network Simulator Functions--------------------------------------------------------------------------------------------
564 virtual void ApplyNetworkSimulator( float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance)=0;
565
570 virtual void SetPerConnectionOutgoingBandwidthLimit( unsigned maxBitsPerSecond )=0;
571
574 virtual bool IsNetworkSimulatorActive( void )=0;
575
576 // --------------------------------------------------------------------------------------------Statistical Functions - Functions dealing with API performance--------------------------------------------------------------------------------------------
577
584 virtual RakNetStatistics * GetStatistics( const SystemAddress systemAddress, RakNetStatistics *rns=0 )=0;
587 virtual bool GetStatistics( const unsigned int index, RakNetStatistics *rns )=0;
593 virtual void GetStatisticsList(DataStructures::List<SystemAddress> &addresses, DataStructures::List<RakNetGUID> &guids, DataStructures::List<RakNetStatistics> &statistics)=0;
594
596 virtual unsigned int GetReceiveBufferSize(void)=0;
597
598 // --------------------------------------------------------------------------------------------EVERYTHING AFTER THIS COMMENT IS FOR INTERNAL USE ONLY--------------------------------------------------------------------------------------------
599
601 // Call manually if RAKPEER_USER_THREADED==1 at least every 30 milliseconds.
602 // updateBitStream should be:
603 // BitStream updateBitStream( MAXIMUM_MTU_SIZE
604 // #if LIBCAT_SECURITY==1
605 // + cat::AuthenticatedEncryption::OVERHEAD_BYTES
606 // #endif
607 // );
608 virtual bool RunUpdateCycle( BitStream &updateBitStream )=0;
609
611 virtual bool SendOutOfBand(const char *host, unsigned short remotePort, const char *data, BitSize_t dataLength, unsigned connectionSocketIndex=0 )=0;
612
613 }
614 // #if defined(SN_TARGET_PSP2)
615 // __attribute__((aligned(8)))
616 // #endif
617 ;
618
619 } // namespace SLNet
620
621 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
  • FilterQuery
DataStructures::Table::FilterQuery Member List

This is the complete list of members for DataStructures::Table::FilterQuery, including all inherited members.

cellValue | DataStructures::Table::FilterQuery
columnIndex | DataStructures::Table::FilterQuery
columnName | DataStructures::Table::FilterQuery
FilterQuery() | DataStructures::Table::FilterQuery
FilterQuery(unsigned column, Cell *cell, FilterQueryType op) | DataStructures::Table::FilterQuery
operation | DataStructures::Table::FilterQuery
~FilterQuery() | DataStructures::Table::FilterQuery
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_NativeClient.cpp Source File

  • src
RakNetSocket2_NativeClient.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_NATIVE_CLIENT_CPP
21 #define RAKNETSOCKET2_NATIVE_CLIENT_CPP
22
23 #if defined(__native_client__)
24
25 using namespace pp;
26
27 RNS2BindResult RNS2_NativeClient::Bind( NativeClientBindParameters *bindParameters, const char *file, unsigned int line )
28 {
29 memcpy(&binding, bindParameters, sizeof(NativeClientBindParameters));
30
31 if(Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4))
32 {
33 rns2Socket = ((PPB_UDPSocket_Private_0_4*) Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4))->Create(bindParameters->nativeClientInstance);
34 RAKNET_DEBUG_PRINTF("CreateChromeSocket(%d,%s,0x%08x,%d) ==> 0x%08x\n", bindParameters->port, bindParameters->forceHostAddress?bindParameters->forceHostAddress:"(null)",bindParameters->nativeClientInstance,bindParameters->is_ipv6, rns2Socket);
35
36 // Enable the broadcast feature on the socket (must happen before the
37 // bind call)
38 ((PPB_UDPSocket_Private_0_4*) pp::Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4))->SetSocketFeature(rns2Socket, PP_UDPSOCKETFEATURE_BROADCAST, PP_MakeBool(PP_TRUE));
39
40 PP_NetAddress_Private client_addr;
41 uint8_t ipv6[16], ipv4[4];
42 if (bindParameters->forceHostAddress)
43 {
44 unsigned int ipIdx=0;
45 char * pch;
46 pch = strtok ((char*) bindParameters->forceHostAddress,".");
47 if (bindParameters->is_ipv6)
48 {
49 while (pch != NULL && ipIdx<16)
50 {
51 ipv6[ipIdx++]=atoi(pch);
52 pch = strtok (NULL, ".");
53 }
54 NetAddressPrivate::CreateFromIPv6Address(ipv6,0,bindParameters->port,&client_addr);
55 }
56 else
57 {
58 while (pch != NULL && ipIdx<4)
59 {
60 ipv4[ipIdx++]=atoi(pch);
61 pch = strtok (NULL, ".");
62 }
63 NetAddressPrivate::CreateFromIPv4Address(ipv4,bindParameters->port,&client_addr);
64 }
65 }
66 else
67 {
68 NetAddressPrivate::GetAnyAddress(bindParameters->is_ipv6, &client_addr);
69 NetAddressPrivate::ReplacePort(client_addr, bindParameters->port, &client_addr);
70 }
71
72 bindState = BS_IN_PROGRESS;
73
74 RAKNET_DEBUG_PRINTF("attempting to bind to %s\n", NetAddressPrivate::Describe(client_addr, true).c_str());
75 PP_CompletionCallback cc = PP_MakeCompletionCallback(RNS2_NativeClient::onSocketBound, this);
76 ((PPB_UDPSocket_Private_0_4*) Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4))->Bind(rns2Socket, &client_addr, cc);
77 return BR_SUCCESS;
78 }
79 return BR_FAILED_TO_BIND_SOCKET;
80 }
81
82 void RNS2_NativeClient::SendImmediate(RNS2_SendParameters_NativeClient *sp)
83 {
84 // Assuming data does not have to remain valid until callback called
85 PP_NetAddress_Private client_addr;
86 #if RAKNET_SUPPORT_IPV6==1
87 NetAddressPrivate::CreateFromIPv6Address(sp->systemAddress.address.addr6.sin6_addr.u.Byte,0,sp->systemAddress.GetPort(),&client_addr);
88 #else
89 NetAddressPrivate::CreateFromIPv4Address((const uint8_t*) &sp->systemAddress.address.addr4.sin_addr,sp->systemAddress.GetPort(),&client_addr);
90 #endif
91
92 // sp remains in memory until the callback completes
93 PP_CompletionCallback cc = PP_MakeCompletionCallback(onSendTo, sp);
94 ((PPB_UDPSocket_Private_0_4*) Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4))->SendTo(sp->socket2->rns2Socket, sp->data, sp->length, &client_addr, cc);
95 }
96
97 void RNS2_NativeClient::onRecvFrom(void* pData, int32_t dataSize)
98 {
99 RNS2RecvStruct *recvStruct = (RNS2RecvStruct *) pData;
100 RNS2_NativeClient *socket2 = (RNS2_NativeClient *) recvStruct->socket;
101
102 //any error codes will be given to us in the dataSize value; see pp_errors.h for a list of errors
103 if(dataSize <=0 || !pData )
104 {
105 // Free data
106 socket2->eventHandler->DeallocRNS2RecvStruct(recvStruct, _FILE_AND_LINE_);
107
108 // This value indicates failure due to an asynchronous operation being
109 // interrupted. The most common cause of this error code is destroying
110 // a resource that still has a callback pending. All callbacks are
111 // guaranteed to execute, so any callbacks pending on a destroyed
112 // resource will be issued with PP_ERROR_ABORTED.
113 if(dataSize==PP_ERROR_ABORTED)
114 {
115 RAKNET_DEBUG_PRINTF("onRecvFrom error PP_ERROR_ABORTED, killing recvfrom loop\n");
116 }
117 else
118 {
119 RAKNET_DEBUG_PRINTF("onRecvFrom error %d\n", dataSize);
120
121 // Reissue call
122 socket2->IssueReceiveCall();
123 }
124
125 return;
126 }
127
128 recvStruct->bytesRead=dataSize;
129 recvStruct->timeRead= SLNet::GetTimeUS();
130
131
132 PP_NetAddress_Private addr;
133 bool ok=false;
134 if(((PPB_UDPSocket_Private_0_4*) Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4))->GetRecvFromAddress(socket2->rns2Socket, &addr) == PP_TRUE)
135 {
136 PP_NetAddressFamily_Private family = NetAddressPrivate::GetFamily(addr);
137 if (family == PP_NETADDRESSFAMILY_IPV4)
138 {
139 ok = NetAddressPrivate::GetAddress(addr, &recvStruct->systemAddress.address.addr4.sin_addr, sizeof(in_addr));
140 }
141 #if RAKNET_SUPPORT_IPV6==1
142 else
143 {
144 ok = NetAddressPrivate::GetAddress(addr, &recvStruct->systemAddress.address.addr6.sin6_addr, sizeof(in6_addr));
145 }
146 #endif
147 }
148
149 if(ok)
150 {
151 recvStruct->systemAddress.SetPortHostOrder(pp::NetAddressPrivate::GetPort(addr));
152 socket2->binding.eventHandler->OnRNS2Recv(recvStruct);
153 }
154
155 // Reissue call
156 socket2->IssueReceiveCall();
157 }
158 void RNS2_NativeClient::IssueReceiveCall(void)
159 {
160 RNS2RecvStruct *recvFromStruct;
161 recvFromStruct=binding.eventHandler->AllocRNS2RecvStruct(_FILE_AND_LINE_);
162 if (recvFromStruct != NULL)
163 {
164 recvFromStruct->socket=this;
165 PP_CompletionCallback cc = PP_MakeCompletionCallback(onRecvFrom, recvFromStruct);
166 ((PPB_UDPSocket_Private_0_4*) Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4))->RecvFrom(rns2Socket, recvFromStruct->data, MAXIMUM_MTU_SIZE, cc);
167 }
168 }
169
170 #endif // defined(__native_client__)
171
172 #endif // file header
173
174 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FileList.cpp Source File

  • src
FileList.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/FileList.h"
17
18 #if _RAKNET_SUPPORT_FileOperations==1
19
20 #include <stdio.h> // RAKNET_DEBUG_PRINTF
21 #include "slikenet/assert.h"
22 #if defined(ANDROID)
23 #include <asm/io.h>
24 #elif defined(_WIN32) || defined(__CYGWIN__)
25 #include <io.h>
26
27
28 #elif !defined ( __APPLE__ ) && !defined ( __APPLE_CC__ ) && !defined ( __PPC__ ) && !defined ( __FreeBSD__ ) && !defined ( __S3E__ )
29 #include <sys/io.h>
30 #endif
31
32
33 #ifdef _WIN32
34 // For mkdir
35 #include <direct.h>
36
37
38 #else
39 #include <sys/stat.h>
40 #endif
41
42 //#include "slikenet/DR_SHA1.h"
43 #include "slikenet/DS_Queue.h"
44 #include "slikenet/StringCompressor.h"
45 #include "slikenet/BitStream.h"
46 #include "slikenet/FileOperations.h"
47 #include "slikenet/SuperFastHash.h"
48 #include "slikenet/assert.h"
49 #include "slikenet/LinuxStrings.h"
50 #include "slikenet/linux_adapter.h"
51 #include "slikenet/osx_adapter.h"
52
53 #define MAX_FILENAME_LENGTH 512
54 static const unsigned HASH_LENGTH=4;
55
56 using namespace SLNet;
57
58 // alloca
59
60 #if defined(_WIN32)
61 #include <malloc.h>
62
63
64 #else
65 #if !defined ( __FreeBSD__ )
66 #include <alloca.h>
67 #endif
68 #include <unistd.h>
69 #include <stdlib.h>
70 #include <sys/stat.h>
71 #include "slikenet/_FindFirst.h"
72 #include <stdint.h> //defines intptr_t
73 #endif
74
75 #include "slikenet/alloca.h"
76
77 //int RAK_DLL_EXPORT FileListNodeComp( char * const &key, const FileListNode &data )
78 //{
79 // return strcmp(key, data.filename);
80 //}
81
82
83 STATIC_FACTORY_DEFINITIONS(FileListProgress,FileListProgress)
84 STATIC_FACTORY_DEFINITIONS(FLP_Printf,FLP_Printf)
85 STATIC_FACTORY_DEFINITIONS(FileList,FileList)
86
88 void FLP_Printf::OnAddFilesFromDirectoryStarted(FileList *fileList, char *dir) {
89 (void) fileList;
90 RAKNET_DEBUG_PRINTF("Adding files from directory %s\n",dir);}
91
93 void FLP_Printf::OnDirectory(FileList *fileList, char *dir, unsigned int directoriesRemaining) {
94 (void) fileList;
95 RAKNET_DEBUG_PRINTF("Adding %s. %i remaining.\n", dir, directoriesRemaining);}
96 void FLP_Printf::OnFilePushesComplete( SystemAddress systemAddress, unsigned short setID )
97 {
98 (void) setID;
99
100 char str[32];
101 systemAddress.ToString(true, (char*) str, static_cast<size_t>(32));
102 RAKNET_DEBUG_PRINTF("File pushes complete to %s\n", str);
103 }
104 void FLP_Printf::OnSendAborted( SystemAddress systemAddress )
105 {
106 char str[32];
107 systemAddress.ToString(true, (char*) str, static_cast<size_t>(32));
108 RAKNET_DEBUG_PRINTF("Send aborted to %s\n", str);
109 }
110 FileList::FileList()
111 {
112 }
113 FileList::~FileList()
114 {
115 Clear();
116 }
117 void FileList::AddFile(const char *filepath, const char *filename, FileListNodeContext context)
118 {
119 if (filepath==0 || filename==0)
120 return;
121
122 char *data;
123 //std::fstream file;
124 //file.open(filename, std::ios::in | std::ios::binary);
125
126 FILE *fp;
127 if (fopen_s(&fp, filepath, "rb") != 0)
128 return;
129 fseek(fp, 0, SEEK_END);
130 int length = ftell(fp);
131 fseek(fp, 0, SEEK_SET);
132
133 if (length > (int) ((unsigned int)-1 / 8))
134 {
135 // If this assert hits, split up your file. You could also change BitSize_t in types.h to unsigned long long but this is not recommended for performance reasons
136 RakAssert("Cannot add files over 536 MB" && 0);
137 fclose(fp);
138 return;
139 }
140
141
142 #if USE_ALLOCA==1
143 bool usedAlloca=false;
144 if (length < MAX_ALLOCA_STACK_ALLOCATION)
145 {
146 data = ( char* ) alloca( length );
147 usedAlloca=true;
148 }
149 else
150 #endif
151 {
152 data = (char*) rakMalloc_Ex( length, _FILE_AND_LINE_ );
153 RakAssert(data);
154 }
155
156 fread(data, 1, length, fp);
157 AddFile(filename, filepath, data, length, length, context);
158 fclose(fp);
159
160 #if USE_ALLOCA==1
161 if (usedAlloca==false)
162 #endif
163 rakFree_Ex(data, _FILE_AND_LINE_ );
164
165 }
166 void FileList::AddFile(const char *filename, const char *fullPathToFile, const char *data, const unsigned dataLength, const unsigned fileLength, FileListNodeContext context, bool isAReference, bool takeDataPointer)
167 {
168 if (filename==0)
169 return;
170 if (strlen(filename)>MAX_FILENAME_LENGTH)
171 {
172 // Should be enough for anyone
173 RakAssert(0);
174 return;
175 }
176 // If adding a reference, do not send data
177 RakAssert(isAReference==false || data==0);
178 // Avoid duplicate insertions unless the data is different, in which case overwrite the old data
179 unsigned i;
180 for (i=0; i<fileList.Size();i++)
181 {
182 if (strcmp(fileList[i].filename, filename)==0)
183 {
184 if (fileList[i].fileLengthBytes==fileLength && fileList[i].dataLengthBytes==dataLength &&
185 (dataLength==0 || fileList[i].data==0 ||
186 memcmp(fileList[i].data, data, dataLength)==0
187 ))
188 // Exact same file already here
189 return;
190
191 // File of the same name, but different contents, so overwrite
192 rakFree_Ex(fileList[i].data, _FILE_AND_LINE_ );
193 fileList.RemoveAtIndex(i);
194 break;
195 }
196 }
197
198 FileListNode n;
199 // size_t fileNameLen = strlen(filename);
200 if (dataLength && data)
201 {
202 if (takeDataPointer)
203 {
204 n.data=(char*) data;
205 }
206 else
207 {
208 n.data=(char*) rakMalloc_Ex( dataLength, _FILE_AND_LINE_ );
209 RakAssert(n.data);
210 memcpy(n.data, data, dataLength);
211 }
212 }
213 else
214 n.data=0;
215 n.dataLengthBytes=dataLength;
216 n.fileLengthBytes=fileLength;
217 n.isAReference=isAReference;
218 n.context=context;
219 if (n.context.dataPtr==0)
220 n.context.dataPtr=n.data;
221 if (n.context.dataLength==0)
222 n.context.dataLength=dataLength;
223 n.filename=filename;
224 n.fullPathToFile=fullPathToFile;
225
226 fileList.Insert(n, _FILE_AND_LINE_);
227 }
228 void FileList::AddFilesFromDirectory(const char *applicationDirectory, const char *subDirectory, bool writeHash, bool writeData, bool recursive, FileListNodeContext context)
229 {
230
231
232
233 DataStructures::Queue<char*> dirList;
234 char root[260];
235 char fullPath[520];
236 _finddata_t fileInfo;
237 intptr_t dir;
238 FILE *fp;
239 char *dirSoFar, *fileData;
240 dirSoFar=(char*) rakMalloc_Ex( 520, _FILE_AND_LINE_ );
241 RakAssert(dirSoFar);
242
243 if (applicationDirectory)
244 strcpy_s(root, applicationDirectory);
245 else
246 root[0]=0;
247
248 int rootLen=(int)strlen(root);
249 if (rootLen)
250 {
251 strcpy_s(dirSoFar, 520, root);
252 if (FixEndingSlash(dirSoFar, 520))
253 rootLen++;
254 }
255 else
256 dirSoFar[0]=0;
257
258 if (subDirectory)
259 {
260 strcat_s(dirSoFar, 520, subDirectory);
261 FixEndingSlash(dirSoFar, 520);
262 }
263 for (unsigned int flpcIndex=0; flpcIndex < fileListProgressCallbacks.Size(); flpcIndex++)
264 fileListProgressCallbacks[flpcIndex]->OnAddFilesFromDirectoryStarted(this, dirSoFar);
265 // RAKNET_DEBUG_PRINTF("Adding files from directory %s\n",dirSoFar);
266 dirList.Push(dirSoFar, _FILE_AND_LINE_ );
267 while (dirList.Size())
268 {
269 dirSoFar=dirList.Pop();
270 strcpy_s(fullPath, dirSoFar);
271 // Changed from *.* to * for Linux compatibility
272 strcat_s(fullPath, "*");
273
274
275 dir=_findfirst(fullPath, &fileInfo );
276 if (dir==-1)
277 {
278 _findclose(dir);
279 rakFree_Ex(dirSoFar, _FILE_AND_LINE_ );
280 unsigned i;
281 for (i=0; i < dirList.Size(); i++)
282 rakFree_Ex(dirList[i], _FILE_AND_LINE_ );
283 return;
284 }
285
286 // RAKNET_DEBUG_PRINTF("Adding %s. %i remaining.\n", fullPath, dirList.Size());
287 for (unsigned int flpcIndex=0; flpcIndex < fileListProgressCallbacks.Size(); flpcIndex++)
288 fileListProgressCallbacks[flpcIndex]->OnDirectory(this, fullPath, dirList.Size());
289
290 do
291 {
292 // no guarantee these entries are first...
293 if (strcmp("." , fileInfo.name) == 0 ||
294 strcmp("..", fileInfo.name) == 0)
295 {
296 continue;
297 }
298
299 if ((fileInfo.attrib & (_A_HIDDEN | _A_SUBDIR | _A_SYSTEM))==0)
300 {
301 strcpy_s(fullPath, dirSoFar);
302 strcat_s(fullPath, fileInfo.name);
303 fileData=0;
304
305 for (unsigned int flpcIndex=0; flpcIndex < fileListProgressCallbacks.Size(); flpcIndex++)
306 fileListProgressCallbacks[flpcIndex]->OnFile(this, dirSoFar, fileInfo.name, fileInfo.size);
307
308 if (writeData && writeHash)
309 {
310 if (fopen_s(&fp, fullPath, "rb") == 0)
311 {
312 fileData= (char*) rakMalloc_Ex( fileInfo.size+HASH_LENGTH, _FILE_AND_LINE_ );
313 RakAssert(fileData);
314 fread(fileData+HASH_LENGTH, fileInfo.size, 1, fp);
315 fclose(fp);
316
317 unsigned int hash = SuperFastHash(fileData+HASH_LENGTH, fileInfo.size);
318 if (SLNet::BitStream::DoEndianSwap())
319 SLNet::BitStream::ReverseBytesInPlace((unsigned char*) &hash, sizeof(hash));
320 memcpy(fileData, &hash, HASH_LENGTH);
321
322 // sha1.Reset();
323 // sha1.Update( ( unsigned char* ) fileData+HASH_LENGTH, fileInfo.size );
324 // sha1.Final();
325 // memcpy(fileData, sha1.GetHash(), HASH_LENGTH);
326 // File data and hash
327 AddFile((const char*)fullPath+rootLen, fullPath, fileData, fileInfo.size+HASH_LENGTH, fileInfo.size, context);
328 }
329 }
330 else if (writeHash)
331 {
332 // sha1.Reset();
333 // DR_SHA1.hashFile((char*)fullPath);
334 // sha1.Final();
335
336 unsigned int hash = SuperFastHashFile(fullPath);
337 if (SLNet::BitStream::DoEndianSwap())
338 SLNet::BitStream::ReverseBytesInPlace((unsigned char*) &hash, sizeof(hash));
339
340 // Hash only
341 // AddFile((const char*)fullPath+rootLen, (const char*)sha1.GetHash(), HASH_LENGTH, fileInfo.size, context);
342 AddFile((const char*)fullPath+rootLen, fullPath, (const char*)&hash, HASH_LENGTH, fileInfo.size, context);
343 }
344 else if (writeData)
345 {
346 fileData= (char*) rakMalloc_Ex( fileInfo.size, _FILE_AND_LINE_ );
347 RakAssert(fileData);
348 fopen_s(&fp, fullPath, "rb");
349 fread(fileData, fileInfo.size, 1, fp);
350 fclose(fp);
351
352 // File data only
353 AddFile(fullPath+rootLen, fullPath, fileData, fileInfo.size, fileInfo.size, context);
354 }
355 else
356 {
357 // Just the filename
358 AddFile(fullPath+rootLen, fullPath, 0, 0, fileInfo.size, context);
359 }
360
361 if (fileData)
362 rakFree_Ex(fileData, _FILE_AND_LINE_ );
363 }
364 else if ((fileInfo.attrib & _A_SUBDIR) && (fileInfo.attrib & (_A_HIDDEN | _A_SYSTEM))==0 && recursive)
365 {
366 char *newDir=(char*) rakMalloc_Ex( 520, _FILE_AND_LINE_ );
367 RakAssert(newDir);
368 strcpy_s(newDir, 520, dirSoFar);
369 strcat_s(newDir, 520, fileInfo.name);
370 strcat_s(newDir, 520, "/");
371 dirList.Push(newDir, _FILE_AND_LINE_ );
372 }
373
374 } while (_findnext(dir, &fileInfo ) != -1);
375
376 _findclose(dir);
377 rakFree_Ex(dirSoFar, _FILE_AND_LINE_ );
378 }
379
380 }
381 void FileList::Clear(void)
382 {
383 unsigned i;
384 for (i=0; i<fileList.Size(); i++)
385 {
386 rakFree_Ex(fileList[i].data, _FILE_AND_LINE_ );
387 }
388 fileList.Clear(false, _FILE_AND_LINE_);
389 }
390 void FileList::Serialize(SLNet::BitStream *outBitStream)
391 {
392 outBitStream->WriteCompressed(fileList.Size());
393 unsigned i;
394 for (i=0; i < fileList.Size(); i++)
395 {
396 outBitStream->WriteCompressed(fileList[i].context.op);
397 outBitStream->WriteCompressed(fileList[i].context.flnc_extraData1);
398 outBitStream->WriteCompressed(fileList[i].context.flnc_extraData2);
399 StringCompressor::Instance()->EncodeString(fileList[i].filename.C_String(), MAX_FILENAME_LENGTH, outBitStream);
400
401 bool writeFileData = (fileList[i].dataLengthBytes>0)==true;
402 outBitStream->Write(writeFileData);
403 if (writeFileData)
404 {
405 outBitStream->WriteCompressed(fileList[i].dataLengthBytes);
406 outBitStream->Write(fileList[i].data, fileList[i].dataLengthBytes);
407 }
408
409 outBitStream->Write((bool)(fileList[i].fileLengthBytes==fileList[i].dataLengthBytes));
410 if (fileList[i].fileLengthBytes!=fileList[i].dataLengthBytes)
411 outBitStream->WriteCompressed(fileList[i].fileLengthBytes);
412 }
413 }
414 bool FileList::Deserialize(SLNet::BitStream *inBitStream)
415 {
416 bool b, dataLenNonZero=false, fileLenMatchesDataLen=false;
417 char filename[512];
418 uint32_t fileListSize;
419 FileListNode n;
420 b=inBitStream->ReadCompressed(fileListSize);
421 #ifdef _DEBUG
422 RakAssert(b);
423 RakAssert(fileListSize < 10000);
424 #endif
425 if (b==false || fileListSize > 10000)
426 return false; // Sanity check
427 Clear();
428 unsigned i;
429 for (i=0; i < fileListSize; i++)
430 {
431 inBitStream->ReadCompressed(n.context.op);
432 inBitStream->ReadCompressed(n.context.flnc_extraData1);
433 inBitStream->ReadCompressed(n.context.flnc_extraData2);
434 StringCompressor::Instance()->DecodeString((char*)filename, MAX_FILENAME_LENGTH, inBitStream);
435 inBitStream->Read(dataLenNonZero);
436 if (dataLenNonZero)
437 {
438 inBitStream->ReadCompressed(n.dataLengthBytes);
439 // sanity check
440 if (n.dataLengthBytes>2000000000)
441 {
442 #ifdef _DEBUG
443 RakAssert(n.dataLengthBytes<=2000000000);
444 #endif
445 return false;
446 }
447 n.data=(char*) rakMalloc_Ex( (size_t) n.dataLengthBytes, _FILE_AND_LINE_ );
448 RakAssert(n.data);
449 inBitStream->Read(n.data, n.dataLengthBytes);
450 }
451 else
452 {
453 n.dataLengthBytes=0;
454 n.data=0;
455 }
456
457 b=inBitStream->Read(fileLenMatchesDataLen);
458 if (fileLenMatchesDataLen)
459 n.fileLengthBytes=(unsigned) n.dataLengthBytes;
460 else
461 b=inBitStream->ReadCompressed(n.fileLengthBytes);
462 #ifdef _DEBUG
463 RakAssert(b);
464 #endif
465 if (b==0)
466 {
467 Clear();
468 return false;
469 }
470 n.filename=filename;
471 n.fullPathToFile=filename;
472 fileList.Insert(n, _FILE_AND_LINE_);
473 }
474
475 return true;
476 }
477 void FileList::GetDeltaToCurrent(FileList *input, FileList *output, const char *dirSubset, const char *remoteSubdir)
478 {
479 // For all files in this list that do not match the input list, write them to the output list.
480 // dirSubset allows checking only a portion of the files in this list.
481 unsigned thisIndex, inputIndex;
482 unsigned dirSubsetLen, localPathLen, remoteSubdirLen;
483 bool match;
484 if (dirSubset)
485 dirSubsetLen = (unsigned int) strlen(dirSubset);
486 else
487 dirSubsetLen = 0;
488 if (remoteSubdir && remoteSubdir[0])
489 {
490 remoteSubdirLen=(unsigned int) strlen(remoteSubdir);
491 if (IsSlash(remoteSubdir[remoteSubdirLen-1]))
492 remoteSubdirLen--;
493 }
494 else
495 remoteSubdirLen=0;
496
497 for (thisIndex=0; thisIndex < fileList.Size(); thisIndex++)
498 {
499 localPathLen = (unsigned int) fileList[thisIndex].filename.GetLength();
500 while (localPathLen>0)
501 {
502 if (IsSlash(fileList[thisIndex].filename[localPathLen-1]))
503 {
504 localPathLen--;
505 break;
506 }
507 localPathLen--;
508 }
509
510 // fileList[thisIndex].filename has to match dirSubset and be shorter or equal to it in length.
511 if (dirSubsetLen>0 &&
512 (localPathLen<dirSubsetLen ||
513 _strnicmp(fileList[thisIndex].filename.C_String(), dirSubset, dirSubsetLen)!=0 ||
514 (localPathLen>dirSubsetLen && IsSlash(fileList[thisIndex].filename[dirSubsetLen])==false)))
515 continue;
516
517 match=false;
518 for (inputIndex=0; inputIndex < input->fileList.Size(); inputIndex++)
519 {
520 // If the filenames, hashes, and lengths match then skip this element in fileList. Otherwise write it to output
521 if (_stricmp(input->fileList[inputIndex].filename.C_String()+remoteSubdirLen,fileList[thisIndex].filename.C_String()+dirSubsetLen)==0)
522 {
523 match=true;
524 if (input->fileList[inputIndex].fileLengthBytes==fileList[thisIndex].fileLengthBytes &&
525 input->fileList[inputIndex].dataLengthBytes==fileList[thisIndex].dataLengthBytes &&
526 memcmp(input->fileList[inputIndex].data,fileList[thisIndex].data,(size_t) fileList[thisIndex].dataLengthBytes)==0)
527 {
528 // File exists on both machines and is the same.
529 break;
530 }
531 else
532 {
533 // File exists on both machines and is not the same.
534 output->AddFile(fileList[thisIndex].filename, fileList[thisIndex].fullPathToFile, 0,0, fileList[thisIndex].fileLengthBytes, FileListNodeContext(0,0,0,0), false);
535 break;
536 }
537 }
538 }
539 if (match==false)
540 {
541 // Other system does not have the file at all
542 output->AddFile(fileList[thisIndex].filename, fileList[thisIndex].fullPathToFile, 0,0, fileList[thisIndex].fileLengthBytes, FileListNodeContext(0,0,0,0), false);
543 }
544 }
545 }
546 void FileList::ListMissingOrChangedFiles(const char *applicationDirectory, FileList *missingOrChangedFiles, bool alwaysWriteHash, bool neverWriteHash)
547 {
548 unsigned fileLength;
549 // CSHA1 sha1;
550 FILE *fp;
551 char fullPath[512];
552 unsigned i;
553 // char *fileData;
554
555 for (i=0; i < fileList.Size(); i++)
556 {
557 strcpy_s(fullPath, applicationDirectory);
558 FixEndingSlash(fullPath, 512);
559 strcat_s(fullPath,fileList[i].filename);
560 if (fopen_s(&fp, fullPath, "rb") != 0)
561 {
562 missingOrChangedFiles->AddFile(fileList[i].filename, fileList[i].fullPathToFile, 0, 0, 0, FileListNodeContext(0,0,0,0), false);
563 }
564 else
565 {
566 fseek(fp, 0, SEEK_END);
567 fileLength = ftell(fp);
568 fseek(fp, 0, SEEK_SET);
569
570 if (fileLength != fileList[i].fileLengthBytes && alwaysWriteHash==false)
571 {
572 missingOrChangedFiles->AddFile(fileList[i].filename, fileList[i].fullPathToFile, 0, 0, fileLength, FileListNodeContext(0,0,0,0), false);
573 }
574 else
575 {
576
577 // fileData= (char*) rakMalloc_Ex( fileLength, _FILE_AND_LINE_ );
578 // fread(fileData, fileLength, 1, fp);
579
580 // sha1.Reset();
581 // sha1.Update( ( unsigned char* ) fileData, fileLength );
582 // sha1.Final();
583
584 // rakFree_Ex(fileData, _FILE_AND_LINE_ );
585
586 unsigned int hash = SuperFastHashFilePtr(fp);
587 if (SLNet::BitStream::DoEndianSwap())
588 SLNet::BitStream::ReverseBytesInPlace((unsigned char*) &hash, sizeof(hash));
589
590 //if (fileLength != fileList[i].fileLength || memcmp( sha1.GetHash(), fileList[i].data, HASH_LENGTH)!=0)
591 if (fileLength != fileList[i].fileLengthBytes || memcmp( &hash, fileList[i].data, HASH_LENGTH)!=0)
592 {
593 if (neverWriteHash==false)
594 // missingOrChangedFiles->AddFile((const char*)fileList[i].filename, (const char*)sha1.GetHash(), HASH_LENGTH, fileLength, 0);
595 missingOrChangedFiles->AddFile((const char*)fileList[i].filename, (const char*)fileList[i].fullPathToFile, (const char *) &hash, HASH_LENGTH, fileLength, FileListNodeContext(0,0,0,0), false);
596 else
597 missingOrChangedFiles->AddFile((const char*)fileList[i].filename, (const char*)fileList[i].fullPathToFile, 0, 0, fileLength, FileListNodeContext(0,0,0,0), false);
598 }
599 }
600 fclose(fp);
601 }
602 }
603 }
604 void FileList::PopulateDataFromDisk(const char *applicationDirectory, bool writeFileData, bool writeFileHash, bool removeUnknownFiles)
605 {
606 FILE *fp;
607 char fullPath[512];
608 unsigned i;
609 // CSHA1 sha1;
610
611 i=0;
612 while (i < fileList.Size())
613 {
614 rakFree_Ex(fileList[i].data, _FILE_AND_LINE_ );
615 strcpy_s(fullPath, applicationDirectory);
616 FixEndingSlash(fullPath, 512);
617 strcat_s(fullPath,fileList[i].filename.C_String());
618 if (fopen_s(&fp, fullPath, "rb") == 0)
619 {
620 if (writeFileHash || writeFileData)
621 {
622 fseek(fp, 0, SEEK_END);
623 fileList[i].fileLengthBytes = ftell(fp);
624 fseek(fp, 0, SEEK_SET);
625 if (writeFileHash)
626 {
627 if (writeFileData)
628 {
629 // Hash + data so offset the data by HASH_LENGTH
630 fileList[i].data=(char*) rakMalloc_Ex( fileList[i].fileLengthBytes+HASH_LENGTH, _FILE_AND_LINE_ );
631 RakAssert(fileList[i].data);
632 fread(fileList[i].data+HASH_LENGTH, fileList[i].fileLengthBytes, 1, fp);
633 // sha1.Reset();
634 // sha1.Update((unsigned char*)fileList[i].data+HASH_LENGTH, fileList[i].fileLength);
635 // sha1.Final();
636 unsigned int hash = SuperFastHash(fileList[i].data+HASH_LENGTH, fileList[i].fileLengthBytes);
637 if (SLNet::BitStream::DoEndianSwap())
638 SLNet::BitStream::ReverseBytesInPlace((unsigned char*) &hash, sizeof(hash));
639 // memcpy(fileList[i].data, sha1.GetHash(), HASH_LENGTH);
640 memcpy(fileList[i].data, &hash, HASH_LENGTH);
641 }
642 else
643 {
644 // Hash only
645 fileList[i].dataLengthBytes=HASH_LENGTH;
646 if (fileList[i].fileLengthBytes < HASH_LENGTH)
647 fileList[i].data=(char*) rakMalloc_Ex( HASH_LENGTH, _FILE_AND_LINE_ );
648 else
649 fileList[i].data=(char*) rakMalloc_Ex( fileList[i].fileLengthBytes, _FILE_AND_LINE_ );
650 RakAssert(fileList[i].data);
651 fread(fileList[i].data, fileList[i].fileLengthBytes, 1, fp);
652 // sha1.Reset();
653 // sha1.Update((unsigned char*)fileList[i].data, fileList[i].fileLength);
654 // sha1.Final();
655 unsigned int hash = SuperFastHash(fileList[i].data, fileList[i].fileLengthBytes);
656 if (SLNet::BitStream::DoEndianSwap())
657 SLNet::BitStream::ReverseBytesInPlace((unsigned char*) &hash, sizeof(hash));
658 // memcpy(fileList[i].data, sha1.GetHash(), HASH_LENGTH);
659 memcpy(fileList[i].data, &hash, HASH_LENGTH);
660 }
661 }
662 else
663 {
664 // Data only
665 fileList[i].dataLengthBytes=fileList[i].fileLengthBytes;
666 fileList[i].data=(char*) rakMalloc_Ex( fileList[i].fileLengthBytes, _FILE_AND_LINE_ );
667 RakAssert(fileList[i].data);
668 fread(fileList[i].data, fileList[i].fileLengthBytes, 1, fp);
669 }
670
671 fclose(fp);
672 i++;
673 }
674 else
675 {
676 fileList[i].data=0;
677 fileList[i].dataLengthBytes=0;
678 }
679 }
680 else
681 {
682 if (removeUnknownFiles)
683 {
684 fileList.RemoveAtIndex(i);
685 }
686 else
687 i++;
688 }
689 }
690 }
691 void FileList::FlagFilesAsReferences(void)
692 {
693 for (unsigned int i=0; i < fileList.Size(); i++)
694 {
695 fileList[i].isAReference=true;
696 fileList[i].dataLengthBytes=fileList[i].fileLengthBytes;
697 }
698 }
699 void FileList::WriteDataToDisk(const char *applicationDirectory)
700 {
701 char fullPath[512];
702 unsigned i,j;
703
704 for (i=0; i < fileList.Size(); i++)
705 {
706 strcpy_s(fullPath, applicationDirectory);
707 FixEndingSlash(fullPath, 512);
708 strcat_s(fullPath,fileList[i].filename.C_String());
709
710 // Security - Don't allow .. in the filename anywhere so you can't write outside of the root directory
711 for (j=1; j < fileList[i].filename.GetLength(); j++)
712 {
713 if (fileList[i].filename[j]=='.' && fileList[i].filename[j-1]=='.')
714 {
715 #ifdef _DEBUG
716 RakAssert(0);
717 #endif
718 // Just cancel the write entirely
719 return;
720 }
721 }
722
723 WriteFileWithDirectories(fullPath, fileList[i].data, (unsigned int) fileList[i].dataLengthBytes);
724 }
725 }
726
727 void FileList::DeleteFiles(const char *applicationDirectory)
728 {
729
730
731
732 char fullPath[512];
733 unsigned i,j;
734
735 for (i=0; i < fileList.Size(); i++)
736 {
737 // The filename should not have .. in the path - if it does ignore it
738 for (j=1; j < fileList[i].filename.GetLength(); j++)
739 {
740 if (fileList[i].filename[j]=='.' && fileList[i].filename[j-1]=='.')
741 {
742 #ifdef _DEBUG
743 RakAssert(0);
744 #endif
745 // Just cancel the deletion entirely
746 return;
747 }
748 }
749
750 strcpy_s(fullPath, applicationDirectory);
751 FixEndingSlash(fullPath, 512);
752 strcat_s(fullPath, fileList[i].filename.C_String());
753
754 // Do not rename to _unlink as linux uses unlink
755 #if defined(_WIN32)
756 int result = _unlink(fullPath);
757 #else
758 int result = unlink(fullPath);
759 #endif
760 if (result!=0)
761 {
762 RAKNET_DEBUG_PRINTF("FileList::DeleteFiles: unlink (%s) failed.\n", fullPath);
763 }
764 }
765
766 }
767
768 void FileList::AddCallback(FileListProgress *cb)
769 {
770 if (cb==0)
771 return;
772
773 if ((unsigned int) fileListProgressCallbacks.GetIndexOf(cb)==(unsigned int)-1)
774 fileListProgressCallbacks.Push(cb, _FILE_AND_LINE_);
775 }
776 void FileList::RemoveCallback(FileListProgress *cb)
777 {
778 unsigned int idx = fileListProgressCallbacks.GetIndexOf(cb);
779 if (idx!=(unsigned int) -1)
780 fileListProgressCallbacks.RemoveAtIndex(idx);
781 }
782 void FileList::ClearCallbacks(void)
783 {
784 fileListProgressCallbacks.Clear(true, _FILE_AND_LINE_);
785 }
786 void FileList::GetCallbacks(DataStructures::List<FileListProgress*> &callbacks)
787 {
788 callbacks = fileListProgressCallbacks;
789 }
790
791 bool FileList::FixEndingSlash(char *str)
792 {
793 #ifdef _WIN32
794 if (str[strlen(str) - 1] != '/' && str[strlen(str) - 1] != '\\')
795 {
796 #pragma warning(push)
797 #pragma warning(disable:4996)
798 strcat(str, "\\"); // Only \ works with system commands, used by AutopatcherClient
799 #pragma warning(pop)
800 return true;
801 }
802 #else
803 if (str[strlen(str) - 1] != '\\' && str[strlen(str) - 1] != '/')
804 {
805 strcat(str, "/"); // Only / works with Linux
806 return true;
807 }
808 #endif
809
810 return false;
811 }
812
813 bool FileList::FixEndingSlash(char *str, size_t strLength)
814 {
815 #ifdef _WIN32
816 if (str[strlen(str)-1]!='/' && str[strlen(str)-1]!='\\')
817 {
818 strcat_s(str, strLength, "\\"); // Only \ works with system commands, used by AutopatcherClient
819 return true;
820 }
821 #else
822 if (str[strlen(str)-1]!='\\' && str[strlen(str)-1]!='/')
823 {
824 strcat_s(str, strLength, "/"); // Only / works with Linux
825 return true;
826 }
827 #endif
828
829 return false;
830 }
831
832 #endif // _RAKNET_SUPPORT_FileOperations
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/CloudServer.h Source File

  • include
  • slikenet
CloudServer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #include "NativeFeatureIncludes.h"
23 #if _RAKNET_SUPPORT_CloudServer==1
24
25 #ifndef __CLOUD_SERVER_H
26 #define __CLOUD_SERVER_H
27
28 #include "PluginInterface2.h"
29 #include "memoryoverride.h"
30 #include "NativeTypes.h"
31 #include "string.h"
32 #include "DS_Hash.h"
33 #include "CloudCommon.h"
34 #include "DS_OrderedList.h"
35
37 #define CLOUD_SERVER_DATA_STACK_SIZE 32
38
39 namespace SLNet
40 {
42 class RakPeerInterface;
43
48 class RAK_DLL_EXPORT CloudServerQueryFilter
49 {
50 public:
51 CloudServerQueryFilter() {}
52 virtual ~CloudServerQueryFilter() {}
53
56 virtual bool OnPostRequest(RakNetGUID clientGuid, SystemAddress clientAddress, CloudKey key, uint32_t dataLength, const char *data)=0;
57
60 virtual bool OnReleaseRequest(RakNetGUID clientGuid, SystemAddress clientAddress, DataStructures::List<CloudKey> &cloudKeys)=0;
61
65 virtual bool OnGetRequest(RakNetGUID clientGuid, SystemAddress clientAddress, CloudQuery &query, DataStructures::List<RakNetGUID> &specificSystems)=0;
66
70 virtual bool OnUnsubscribeRequest(RakNetGUID clientGuid, SystemAddress clientAddress, DataStructures::List<CloudKey> &cloudKeys, DataStructures::List<RakNetGUID> &specificSystems)=0;
71 };
72
75 class RAK_DLL_EXPORT CloudServer : public PluginInterface2, CloudAllocator
76 {
77 public:
78 // GetInstance() and DestroyInstance(instance*)
79 STATIC_FACTORY_DECLARATIONS(CloudServer)
80
81 CloudServer();
82 virtual ~CloudServer();
83
88 void SetMaxUploadBytesPerClient(uint64_t bytes);
89
93 void SetMaxBytesPerDownload(uint64_t bytes);
94
100 void AddServer(RakNetGUID systemIdentifier);
101
104 void RemoveServer(RakNetGUID systemIdentifier);
105
108 void GetRemoteServers(DataStructures::List<RakNetGUID> &remoteServersOut);
109
111 void Clear(void);
112
117 void ForceExternalSystemAddress(SystemAddress forcedAddress);
118
122 void AddQueryFilter(CloudServerQueryFilter* filter);
123
127 void RemoveQueryFilter(CloudServerQueryFilter* filter);
128
131 void RemoveAllQueryFilters(void);
132
133 protected:
134 virtual void Update(void);
135 virtual PluginReceiveResult OnReceive(Packet *packet);
136 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
137 virtual void OnRakPeerShutdown(void);
138
139
140 virtual void OnPostRequest(Packet *packet);
141 virtual void OnReleaseRequest(Packet *packet);
142 virtual void OnGetRequest(Packet *packet);
143 virtual void OnUnsubscribeRequest(Packet *packet);
144 virtual void OnServerToServerGetRequest(Packet *packet);
145 virtual void OnServerToServerGetResponse(Packet *packet);
146
147 uint64_t maxUploadBytesPerClient, maxBytesPerDowload;
148
149 // ----------------------------------------------------------------------------
150 // For a given data key, quickly look up one or all systems that have uploaded
151 // ----------------------------------------------------------------------------
152 struct CloudData
153 {
154 CloudData() {}
155 ~CloudData() {if (allocatedData) rakFree_Ex(allocatedData, _FILE_AND_LINE_);}
156 bool IsUnused(void) const {return isUploaded==false && specificSubscribers.Size()==0;}
157 void Clear(void) {if (dataPtr==allocatedData) rakFree_Ex(allocatedData, _FILE_AND_LINE_); allocatedData=0; dataPtr=0; dataLengthBytes=0; isUploaded=false;}
158
159 unsigned char stackData[CLOUD_SERVER_DATA_STACK_SIZE];
160 unsigned char *allocatedData; // Uses allocatedData instead of stackData if length of data exceeds CLOUD_SERVER_DATA_STACK_SIZE
161 unsigned char *dataPtr; // Points to either stackData or allocatedData
162 uint32_t dataLengthBytes;
163 bool isUploaded;
164
166 SystemAddress serverSystemAddress;
167
169 SystemAddress clientSystemAddress;
170
172 RakNetGUID serverGUID;
173
175 RakNetGUID clientGUID;
176
179 DataStructures::OrderedList<RakNetGUID, RakNetGUID> specificSubscribers;
180 };
181 void WriteCloudQueryRowFromResultList(unsigned int i, DataStructures::List<CloudData*> &cloudDataResultList, DataStructures::List<CloudKey> &cloudKeyResultList, BitStream *bsOut);
182 void WriteCloudQueryRowFromResultList(DataStructures::List<CloudData*> &cloudDataResultList, DataStructures::List<CloudKey> &cloudKeyResultList, BitStream *bsOut);
183
184 static int KeyDataPtrComp( const RakNetGUID &key, CloudData* const &data );
185 struct CloudDataList
186 {
187 bool IsUnused(void) const {return keyData.Size()==0 && nonSpecificSubscribers.Size()==0;}
188 bool IsNotUploaded(void) const {return uploaderCount==0;}
189 bool RemoveSubscriber(RakNetGUID g) {
190 bool objectExists;
191 unsigned int index;
192 index = nonSpecificSubscribers.GetIndexFromKey(g, &objectExists);
193 if (objectExists)
194 {
195 subscriberCount--;
196 nonSpecificSubscribers.RemoveAtIndex(index);
197 return true;
198 }
199 return false;
200 }
201
202 unsigned int uploaderCount, subscriberCount;
203 CloudKey key;
204
205 // Data uploaded from or subscribed to for various systems
206 DataStructures::OrderedList<RakNetGUID, CloudData*, CloudServer::KeyDataPtrComp> keyData;
207
210 DataStructures::OrderedList<RakNetGUID, RakNetGUID> nonSpecificSubscribers;
211 };
212
213 static int KeyDataListComp( const CloudKey &key, CloudDataList * const &data );
214 DataStructures::OrderedList<CloudKey, CloudDataList*, CloudServer::KeyDataListComp> dataRepository;
215
216 struct KeySubscriberID
217 {
218 CloudKey key;
219 DataStructures::OrderedList<RakNetGUID, RakNetGUID> specificSystemsSubscribedTo;
220 };
221 static int KeySubscriberIDComp(const CloudKey &key, KeySubscriberID * const &data );
222
223 // Remote systems
224 struct RemoteCloudClient
225 {
226 bool IsUnused(void) const {return uploadedKeys.Size()==0 && subscribedKeys.Size()==0;}
227
228 DataStructures::OrderedList<CloudKey,CloudKey,CloudKeyComp> uploadedKeys;
229 DataStructures::OrderedList<CloudKey,KeySubscriberID*,CloudServer::KeySubscriberIDComp> subscribedKeys;
230 uint64_t uploadedBytes;
231 };
232 DataStructures::Hash<RakNetGUID, RemoteCloudClient*, 2048, RakNetGUID::ToUint32> remoteSystems;
233
234 // For a given user, release all subscribed and uploaded keys
235 void ReleaseSystem(RakNetGUID clientAddress );
236
237 // For a given user, release a set of keys
238 void ReleaseKeys(RakNetGUID clientAddress, DataStructures::List<CloudKey> &keys );
239
240 void NotifyClientSubscribersOfDataChange( CloudData *cloudData, CloudKey &key, DataStructures::OrderedList<RakNetGUID, RakNetGUID> &subscribers, bool wasUpdated );
241 void NotifyClientSubscribersOfDataChange( CloudQueryRow *row, DataStructures::OrderedList<RakNetGUID, RakNetGUID> &subscribers, bool wasUpdated );
242 void NotifyServerSubscribersOfDataChange( CloudData *cloudData, CloudKey &key, bool wasUpdated );
243
244 struct RemoteServer
245 {
246 RakNetGUID serverAddress;
247 // This server needs to know about these keys when they are updated or deleted
248 DataStructures::OrderedList<CloudKey,CloudKey,CloudKeyComp> subscribedKeys;
249 // This server has uploaded these keys, and needs to know about Get() requests
250 DataStructures::OrderedList<CloudKey,CloudKey,CloudKeyComp> uploadedKeys;
251
252 // Just for processing
253 bool workingFlag;
254
255 // If false, we don't know what keys they have yet, so send everything
256 bool gotSubscribedAndUploadedKeys;
257 };
258
259 static int RemoteServerComp(const RakNetGUID &key, RemoteServer* const &data );
260 DataStructures::OrderedList<RakNetGUID, RemoteServer*, CloudServer::RemoteServerComp> remoteServers;
261
262 struct BufferedGetResponseFromServer
263 {
264 void Clear(CloudAllocator *allocator);
265
266 RakNetGUID serverAddress;
267 CloudQueryResult queryResult;
268 bool gotResult;
269 };
270
271 struct CloudQueryWithAddresses
272 {
273 // Inputs
274 CloudQuery cloudQuery;
275 DataStructures::List<RakNetGUID> specificSystems;
276
277 void Serialize(bool writeToBitstream, BitStream *bitStream);
278 };
279
280 static int BufferedGetResponseFromServerComp(const RakNetGUID &key, BufferedGetResponseFromServer* const &data );
281 struct GetRequest
282 {
283 void Clear(CloudAllocator *allocator);
284 bool AllRemoteServersHaveResponded(void) const;
285 CloudQueryWithAddresses cloudQueryWithAddresses;
286
287 // When request started. If takes too long for a response from another system, can abort remaining systems
288 SLNet::Time requestStartTime;
289
290 // Assigned by server that gets the request to identify response. See nextGetRequestId
291 uint32_t requestId;
292
293 RakNetGUID requestingClient;
294
295 DataStructures::OrderedList<RakNetGUID, BufferedGetResponseFromServer*, CloudServer::BufferedGetResponseFromServerComp> remoteServerResponses;
296 };
297 static int GetRequestComp(const uint32_t &key, GetRequest* const &data );
298 DataStructures::OrderedList<uint32_t, GetRequest*, CloudServer::GetRequestComp> getRequests;
299 SLNet::Time nextGetRequestsCheck;
300
301 uint32_t nextGetRequestId;
302
303 void ProcessAndTransmitGetRequest(GetRequest *getRequest);
304
305 void ProcessCloudQueryWithAddresses(
306 CloudServer::CloudQueryWithAddresses &cloudQueryWithAddresses,
307 DataStructures::List<CloudData*> &cloudDataResultList,
308 DataStructures::List<CloudKey> &cloudKeyResultList
309 );
310
311 void SendUploadedAndSubscribedKeysToServer( RakNetGUID systemAddress );
312 void SendUploadedKeyToServers( CloudKey &cloudKey );
313 void SendSubscribedKeyToServers( CloudKey &cloudKey );
314 void RemoveUploadedKeyFromServers( CloudKey &cloudKey );
315 void RemoveSubscribedKeyFromServers( CloudKey &cloudKey );
316
317 void OnSendUploadedAndSubscribedKeysToServer( Packet *packet );
318 void OnSendUploadedKeyToServers( Packet *packet );
319 void OnSendSubscribedKeyToServers( Packet *packet );
320 void OnRemoveUploadedKeyFromServers( Packet *packet );
321 void OnRemoveSubscribedKeyFromServers( Packet *packet );
322 void OnServerDataChanged( Packet *packet );
323
324 void GetServersWithUploadedKeys(
325 DataStructures::List<CloudKey> &keys,
326 DataStructures::List<RemoteServer*> &remoteServersWithData
327 );
328
329 CloudServer::CloudDataList *GetOrAllocateCloudDataList(CloudKey key, bool *dataRepositoryExists, unsigned int &dataRepositoryIndex);
330
331 void UnsubscribeFromKey(RemoteCloudClient *remoteCloudClient, RakNetGUID remoteCloudClientGuid, unsigned int keySubscriberIndex, CloudKey &cloudKey, DataStructures::List<RakNetGUID> &specificSystems);
332 void RemoveSpecificSubscriber(RakNetGUID specificSubscriber, CloudDataList *cloudDataList, RakNetGUID remoteCloudClientGuid);
333
334 DataStructures::List<CloudServerQueryFilter*> queryFilters;
335
336 SystemAddress forceAddress;
337 };
338
339
340 } // namespace SLNet
341
342 #endif
343
344
345 // Key subscription
346 //
347 // A given system can subscribe to one or more keys.
348 // The subscription can be further be defined as only subscribing to keys uploaded by or changed by a given system.
349 // It is possible to subscribe to keys not yet uploaded, or uploaded to another system
350 //
351 // Operations:
352 //
353 // 1. SubscribeToKey() - Get() operation with subscription
354 // A. Add to key subscription list for the client, which contains a keyId / specificUploaderList pair
355 // B. Send to remote servers that for this key, they should send us updates
356 // C. (Done, get operation returns current values)
357 //
358 // 2. UpdateData() - Post() operation
359 // A. Find all subscribers to this data, for the uploading system.
360 // B. Send them the uploaded data
361 // C. Find all servers that subscribe to this data
362 // D. Send them the uploaded data
363 //
364 // 3. DeleteData() - Release() operation
365 // A. Find all subscribers to this data, for the deleting system.
366 // B. Inform them of the deletion
367 // C. Find all servers that subscribe to this data
368 // D. Inform them of the deletion
369 //
370 // 4. Unsubscribe()
371 // A. Find this subscriber, and remove their subscription
372 // B. If no one else is subscribing to this key for any system, notify remote servers we no longer need subscription updates
373 //
374 // Internal operations:
375 //
376 // 1. Find if any connected client has subscribed to a given key
377 // A. This is used add and remove our subscription for this key to remote servers
378 //
379 // 2. For a given key and updating address, find all connected clients that care
380 // A. First find connected clients that have subscribed to this key, regardless of address
381 // B. Then find connected clients that have subscribed to this key for this particular address
382 //
383 // 3. Find all remote servers that have subscribed to a given key
384 // A. This is so when the key is updated or deleted, we know who to send it to
385 //
386 // 4. For a given client (such as on disconnect), remove all records of their subscriptions
387
388 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_HuffmanEncodingTreeNode.h Source File

  • include
  • slikenet
DS_HuffmanEncodingTreeNode.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
14
15 #ifndef __HUFFMAN_ENCODING_TREE_NODE
16 #define __HUFFMAN_ENCODING_TREE_NODE
17
18 struct HuffmanEncodingTreeNode
19 {
20 unsigned char value;
21 unsigned weight;
22 HuffmanEncodingTreeNode *left;
23 HuffmanEncodingTreeNode *right;
24 HuffmanEncodingTreeNode *parent;
25 };
26
27 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_Windows_Linux.cpp Source File

  • src
RakNetSocket2_Windows_Linux.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_WINDOWS_LINUX_CPP
21 #define RAKNETSOCKET2_WINDOWS_LINUX_CPP
22
23 #if !defined(WINDOWS_STORE_RT) && !defined(__native_client__)
24
25 #if RAKNET_SUPPORT_IPV6==1
26
27 void PrepareAddrInfoHints2(addrinfo *hints)
28 {
29 memset(hints, 0, sizeof (addrinfo)); // make sure the struct is empty
30 hints->ai_socktype = SOCK_DGRAM; // UDP sockets
31 hints->ai_flags = AI_PASSIVE; // fill in my IP for me
32 }
33
34 void GetMyIP_Windows_Linux_IPV4And6( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
35 {
36 int idx=0;
37 char ac[ 80 ];
38 int err = gethostname( ac, sizeof( ac ) );
39 RakAssert(err != -1);
40
41 struct addrinfo hints;
42 struct addrinfo *servinfo=0, *aip; // will point to the results
43 PrepareAddrInfoHints2(&hints);
44 getaddrinfo(ac, "", &hints, &servinfo);
45
46 for (idx=0, aip = servinfo; aip != NULL && idx < MAXIMUM_NUMBER_OF_INTERNAL_IDS; aip = aip->ai_next, idx++)
47 {
48 if (aip->ai_family == AF_INET)
49 {
50 struct sockaddr_in *ipv4 = (struct sockaddr_in *)aip->ai_addr;
51 memcpy(&addresses[idx].address.addr4,ipv4,sizeof(sockaddr_in));
52 }
53 else
54 {
55 struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)aip->ai_addr;
56 memcpy(&addresses[idx].address.addr4,ipv6,sizeof(sockaddr_in6));
57 }
58
59 }
60
61 freeaddrinfo(servinfo); // free the linked-list
62
63 while (idx < MAXIMUM_NUMBER_OF_INTERNAL_IDS)
64 {
65 addresses[idx]=UNASSIGNED_SYSTEM_ADDRESS;
66 idx++;
67 }
68 }
69
70 #else
71
72 #if (defined(__GNUC__) || defined(__GCCXML__)) && !defined(__WIN32__)
73 #include <netdb.h>
74 #endif
75 void GetMyIP_Windows_Linux_IPV4( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
76 {
77
78
79
80 int idx=0;
81 char ac[ 80 ];
82 int err = gethostname( ac, sizeof( ac ) );
83 (void) err;
84 RakAssert(err != -1);
85
86 struct addrinfo *curAddress = NULL;
87 err = getaddrinfo(ac, NULL, NULL, &curAddress);
88
89 if ( err != 0 || curAddress == 0 )
90 {
91 RakAssert(false);
92 return ;
93 }
94 while (curAddress != NULL && idx < MAXIMUM_NUMBER_OF_INTERNAL_IDS)
95 {
96 if (curAddress->ai_family == AF_INET) {
97 addresses[idx].address.addr4 = *((struct sockaddr_in *)curAddress->ai_addr);
98 ++idx;
99 }
100 curAddress = curAddress->ai_next;
101 }
102
103 while (idx < MAXIMUM_NUMBER_OF_INTERNAL_IDS)
104 {
105 addresses[idx]=UNASSIGNED_SYSTEM_ADDRESS;
106 idx++;
107 }
108
109 }
110
111 #endif // RAKNET_SUPPORT_IPV6==1
112
113
114 void GetMyIP_Windows_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
115 {
116 #if RAKNET_SUPPORT_IPV6==1
117 GetMyIP_Windows_Linux_IPV4And6(addresses);
118 #else
119 GetMyIP_Windows_Linux_IPV4(addresses);
120 #endif
121 }
122
123
124 #endif // Windows and Linux
125
126 #endif // file header
127
128 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ReliabilityLayer.h Source File

  • include
  • slikenet
ReliabilityLayer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #ifndef __RELIABILITY_LAYER_H
22 #define __RELIABILITY_LAYER_H
23
24 #include "memoryoverride.h"
25 #include "MTUSize.h"
26 #include "DS_LinkedList.h"
27 #include "DS_List.h"
28 #include "SocketLayer.h"
29 #include "PacketPriority.h"
30 #include "DS_Queue.h"
31 #include "BitStream.h"
32 #include "InternalPacket.h"
33 #include "statistics.h"
34 #include "DR_SHA1.h"
35 #include "DS_OrderedList.h"
36 #include "DS_RangeList.h"
37 #include "DS_BPlusTree.h"
38 #include "DS_MemoryPool.h"
39 #include "defines.h"
40 #include "DS_Heap.h"
41 #include "BitStream.h"
42 #include "NativeFeatureIncludes.h"
43 #include "SecureHandshake.h"
44 #include "PluginInterface2.h"
45 #include "Rand.h"
46 #include "socket2.h"
47
48 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL!=1
49 #include "CCRakNetUDT.h"
50 #define INCLUDE_TIMESTAMP_WITH_DATAGRAMS 1
51 #else
52 #include "CCRakNetSlidingWindow.h"
53 #define INCLUDE_TIMESTAMP_WITH_DATAGRAMS 0
54 #endif
55
57 #define NUMBER_OF_ORDERED_STREAMS 32 // 2^5
58
59 #define RESEND_TREE_ORDER 32
60
61 namespace SLNet {
62
64 class PluginInterface2;
65 class RakNetRandom;
66 typedef uint64_t reliabilityHeapWeightType;
67
68 // int SplitPacketIndexComp( SplitPacketIndexType const &key, InternalPacket* const &data );
69 struct SplitPacketChannel //<SplitPacketChannel>
70 {
71 CCTimeType lastUpdateTime;
72
73 DataStructures::List<InternalPacket*> splitPacketList;
74
75 #if PREALLOCATE_LARGE_MESSAGES==1
76 InternalPacket *returnedPacket;
77 bool gotFirstPacket;
78 unsigned int stride;
79 unsigned int splitPacketsArrived;
80 #else
81 // This is here for progress notifications, since progress notifications return the first packet data, if available
82 InternalPacket *firstPacket;
83 #endif
84
85 };
86 int RAK_DLL_EXPORT SplitPacketChannelComp( SplitPacketIdType const &key, SplitPacketChannel* const &data );
87
88 // Helper class
89 struct BPSTracker
90 {
91 BPSTracker();
92 ~BPSTracker();
93 void Reset(const char *file, unsigned int line);
94 inline void Push1(CCTimeType time, uint64_t value1) {dataQueue.Push(TimeAndValue2(time,value1),_FILE_AND_LINE_); total1+=value1; lastSec1+=value1;}
95 // void Push2(SLNet::TimeUS time, uint64_t value1, uint64_t value2);
96 inline uint64_t GetBPS1(CCTimeType time) {(void) time; return lastSec1;}
97 inline uint64_t GetBPS1Threadsafe(CCTimeType time) {(void) time; return lastSec1;}
98 // uint64_t GetBPS2(RakNetTimeUS time);
99 // void GetBPS1And2(RakNetTimeUS time, uint64_t &out1, uint64_t &out2);
100 uint64_t GetTotal1(void) const;
101 // uint64_t GetTotal2(void) const;
102
103 struct TimeAndValue2
104 {
105 TimeAndValue2();
106 ~TimeAndValue2();
107 TimeAndValue2(CCTimeType t, uint64_t v1);
108 // TimeAndValue2(SLNet::TimeUS t, uint64_t v1, uint64_t v2);
109 // uint64_t value1, value2;
110 uint64_t value1;
111 CCTimeType time;
112 };
113
114 uint64_t total1, lastSec1;
115 // uint64_t total2, lastSec2;
116 DataStructures::Queue<TimeAndValue2> dataQueue;
117 void ClearExpired1(CCTimeType time);
118 // void ClearExpired2(SLNet::TimeUS time);
119 };
120
122 class ReliabilityLayer //<ReliabilityLayer>
123 {
124 public:
125
126 // Constructor
127 ReliabilityLayer();
128
129 // Destructor
130 ~ReliabilityLayer();
131
133 void Reset( bool resetVariables, int MTUSize, bool _useSecurity );
134
138 void SetTimeoutTime(SLNet::TimeMS time );
139
142 SLNet::TimeMS GetTimeoutTime(void);
143
153 bool HandleSocketReceiveFromConnectedPlayer(
154 const char *buffer, unsigned int length, SystemAddress &systemAddress, DataStructures::List<PluginInterface2*> &messageHandlerList, int MTUSize,
155 RakNetSocket2 *s, RakNetRandom *rnr, CCTimeType timeRead, BitStream &updateBitStream);
156
160 BitSize_t Receive( unsigned char**data );
161
173 bool Send( char *data, BitSize_t numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, unsigned char orderingChannel, bool makeDataCopy, int MTUSize, CCTimeType currentTime, uint32_t receipt );
174
182 void Update( RakNetSocket2 *s, SystemAddress &systemAddress, int MTUSize, CCTimeType time,
183 unsigned bitsPerSecondLimit,
184 DataStructures::List<PluginInterface2*> &messageHandlerList,
185 RakNetRandom *rnr, BitStream &updateBitStream);
186
189 bool IsDeadConnection( void ) const;
190
192 void KillConnection(void);
193
196 RakNetStatistics * GetStatistics( RakNetStatistics *rns );
197
199 bool IsOutgoingDataWaiting(void);
200 bool AreAcksWaiting(void);
201
202 // Set outgoing lag and packet loss properties
203 void ApplyNetworkSimulator( double _maxSendBPS, SLNet::TimeMS _minExtraPing, SLNet::TimeMS _extraPingVariance );
204
207 bool IsNetworkSimulatorActive( void );
208
209 void SetSplitMessageProgressInterval(int interval);
210 void SetUnreliableTimeout(SLNet::TimeMS timeoutMS);
212 bool AckTimeout(SLNet::Time curTime);
213 CCTimeType GetNextSendTime(void) const;
214 CCTimeType GetTimeBetweenPackets(void) const;
215 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
216 CCTimeType GetAckPing(void) const;
217 #endif
218 SLNet::TimeMS GetTimeLastDatagramArrived(void) const {return timeLastDatagramArrived;}
219
220 // If true, will update time between packets quickly based on ping calculations
221 //void SetDoFastThroughputReactions(bool fast);
222
223 // Encoded as numMessages[unsigned int], message1BitLength[unsigned int], message1Data (aligned), ...
224 //void GetUndeliveredMessages(SLNet::BitStream *messages, int MTUSize);
225
226 private:
231 void SendBitStream( RakNetSocket2 *s, SystemAddress &systemAddress, SLNet::BitStream *bitStream, RakNetRandom *rnr, CCTimeType currentTime);
232
235 BitSize_t WriteToBitStreamFromInternalPacket(SLNet::BitStream *bitStream, const InternalPacket *const internalPacket, CCTimeType curTime );
236
237
239 InternalPacket* CreateInternalPacketFromBitStream(SLNet::BitStream *bitStream, CCTimeType time );
240
242 unsigned RemovePacketFromResendListAndDeleteOlderReliableSequenced( const MessageNumberType messageNumber, CCTimeType time, DataStructures::List<PluginInterface2*> &messageHandlerList, const SystemAddress &systemAddress );
243
245 void SendAcknowledgementPacket( const DatagramSequenceNumberType messageNumber, CCTimeType time);
246
248 bool IsSendThrottled( int MTUSize );
249
251 void UpdateWindowFromPacketloss( CCTimeType time );
252
254 void UpdateWindowFromAck( CCTimeType time );
255
257 BitSize_t GetMaxMessageHeaderLengthBits( void );
258 BitSize_t GetMessageHeaderLengthBits( const InternalPacket *const internalPacket );
259
261 void GetSHA1( unsigned char * const buffer, unsigned int nbytes, char code[ SHA1_LENGTH ] );
262
264 bool CheckSHA1( char code[ SHA1_LENGTH ], unsigned char * const buffer, unsigned int nbytes );
265
267 // void DeleteSequencedPacketsInList( unsigned char orderingChannel, DataStructures::List<InternalPacket*>&theList, int splitPacketId = -1 );
268
270 // void DeleteSequencedPacketsInList( unsigned char orderingChannel, DataStructures::Queue<InternalPacket*>&theList );
271
273 bool IsOlderOrderedPacket( OrderingIndexType newPacketOrderingIndex, OrderingIndexType waitingForPacketOrderingIndex );
274
276 void SplitPacket( InternalPacket *internalPacket );
277
279 void InsertIntoSplitPacketList( InternalPacket * internalPacket, CCTimeType time );
280
282 InternalPacket * BuildPacketFromSplitPacketList( SplitPacketIdType inSplitPacketId, CCTimeType time,
283 RakNetSocket2 *s, SystemAddress &systemAddress, RakNetRandom *rnr, BitStream &updateBitStream);
284 InternalPacket * BuildPacketFromSplitPacketList( SplitPacketChannel *splitPacketChannel, CCTimeType time );
285
287 //void DeleteOldUnreliableSplitPackets( CCTimeType time );
288
291 InternalPacket * CreateInternalPacketCopy( InternalPacket *original, int dataByteOffset, int dataByteLength, CCTimeType time );
292
294 // DataStructures::LinkedList<InternalPacket*> *GetOrderingListAtOrderingStream( unsigned char orderingChannel );
295
297 // void AddToOrderingList( InternalPacket * internalPacket );
298
300 void InsertPacketIntoResendList( InternalPacket *internalPacket, CCTimeType time, bool firstResend, bool modifyUnacknowledgedBytes );
301
303 void FreeMemory( bool freeAllImmediately );
304
306 void FreeThreadSafeMemory( void );
307
308 // Initialize the variables
309 void InitializeVariables( void );
310
312 bool IsExpiredTime(unsigned int input, CCTimeType currentTime) const;
313
314 // Make it so we don't do resends within a minimum threshold of time
315 void UpdateNextActionTime(void);
316
317
319 //unsigned int IsReceivedPacketHole(unsigned int input, SLNet::TimeMS currentTime) const;
320
322 //unsigned int MakeReceivedPacketHole(unsigned int input) const;
323
325 unsigned int GetResendListDataSize(void) const;
326
328 void UpdateThreadedMemory(void);
329
330 void CalculateHistogramAckSize(void);
331
332 // Used ONLY for RELIABLE_ORDERED
333 // RELIABLE_SEQUENCED just returns the newest one
334 // DataStructures::List<DataStructures::LinkedList<InternalPacket*>*> orderingList;
335 DataStructures::Queue<InternalPacket*> outputQueue;
336 int splitMessageProgressInterval;
337 CCTimeType unreliableTimeout;
338
339 struct MessageNumberNode
340 {
341 DatagramSequenceNumberType messageNumber;
342 MessageNumberNode *next;
343 };
344 struct DatagramHistoryNode
345 {
346 DatagramHistoryNode() {}
347 DatagramHistoryNode(MessageNumberNode *_head, CCTimeType ts
348 ) :
349 head(_head), timeSent(ts)
350 {}
351 MessageNumberNode *head;
352 CCTimeType timeSent;
353 };
354 // Queue length is programmatically restricted to DATAGRAM_MESSAGE_ID_ARRAY_LENGTH
355 // This is essentially an O(1) lookup to get a DatagramHistoryNode given an index
356 // datagramHistory holds a linked list of MessageNumberNode. Each MessageNumberNode refers to one element in resendList which can be cleared on an ack.
357 DataStructures::Queue<DatagramHistoryNode> datagramHistory;
358 DataStructures::MemoryPool<MessageNumberNode> datagramHistoryMessagePool;
359
360 struct UnreliableWithAckReceiptNode
361 {
362 UnreliableWithAckReceiptNode() {}
363 UnreliableWithAckReceiptNode(DatagramSequenceNumberType _datagramNumber, uint32_t _sendReceiptSerial, SLNet::TimeUS _nextActionTime) :
364 datagramNumber(_datagramNumber), sendReceiptSerial(_sendReceiptSerial), nextActionTime(_nextActionTime)
365 {}
366 DatagramSequenceNumberType datagramNumber;
367 uint32_t sendReceiptSerial;
368 SLNet::TimeUS nextActionTime;
369 };
370 DataStructures::List<UnreliableWithAckReceiptNode> unreliableWithAckReceiptHistory;
371
372 void RemoveFromDatagramHistory(DatagramSequenceNumberType index);
373 MessageNumberNode* GetMessageNumberNodeByDatagramIndex(DatagramSequenceNumberType index, CCTimeType *timeSent);
374 void AddFirstToDatagramHistory(DatagramSequenceNumberType datagramNumber, CCTimeType timeSent);
375 MessageNumberNode* AddFirstToDatagramHistory(DatagramSequenceNumberType datagramNumber, DatagramSequenceNumberType messageNumber, CCTimeType timeSent);
376 MessageNumberNode* AddSubsequentToDatagramHistory(MessageNumberNode *messageNumberNode, DatagramSequenceNumberType messageNumber);
377 DatagramSequenceNumberType datagramHistoryPopCount;
378
379 DataStructures::MemoryPool<InternalPacket> internalPacketPool;
380 // DataStructures::BPlusTree<DatagramSequenceNumberType, InternalPacket*, RESEND_TREE_ORDER> resendTree;
381 InternalPacket *resendBuffer[RESEND_BUFFER_ARRAY_LENGTH];
382 InternalPacket *resendLinkedListHead;
383 InternalPacket *unreliableLinkedListHead;
384 void RemoveFromUnreliableLinkedList(InternalPacket *internalPacket);
385 void AddToUnreliableLinkedList(InternalPacket *internalPacket);
386 // unsigned int numPacketsOnResendBuffer;
387 //unsigned int blockWindowIncreaseUntilTime;
388 // DataStructures::RangeList<DatagramSequenceNumberType> acknowlegements;
389 // Resend list is a tree of packets we need to resend
390
391 // Set to the current time when the resend queue is no longer empty
392 // Set to zero when it becomes empty
393 // Set to the current time if it is not zero, and we get incoming data
394 // If the current time - timeResendQueueNonEmpty is greater than a threshold, we are disconnected
395 // CCTimeType timeResendQueueNonEmpty;
396 SLNet::TimeMS timeLastDatagramArrived;
397
398
399 // If we backoff due to packetloss, don't remeasure until all waiting resends have gone out or else we overcount
400 // bool packetlossThisSample;
401 // int backoffThisSample;
402 // unsigned packetlossThisSampleResendCount;
403 // CCTimeType lastPacketlossTime;
404
405 //DataStructures::Queue<InternalPacket*> sendPacketSet[ NUMBER_OF_PRIORITIES ];
406 DataStructures::Heap<reliabilityHeapWeightType, InternalPacket*, false> outgoingPacketBuffer;
407 reliabilityHeapWeightType outgoingPacketBufferNextWeights[NUMBER_OF_PRIORITIES];
408 void InitHeapWeights(void);
409 reliabilityHeapWeightType GetNextWeight(int priorityLevel);
410 // unsigned int messageInSendBuffer[NUMBER_OF_PRIORITIES];
411 // double bytesInSendBuffer[NUMBER_OF_PRIORITIES];
412
413
414 DataStructures::OrderedList<SplitPacketIdType, SplitPacketChannel*, SplitPacketChannelComp> splitPacketChannelList;
415
416 MessageNumberType sendReliableMessageNumberIndex;
417 MessageNumberType internalOrderIndex;
418 //unsigned int windowSize;
419 //SLNet::BitStream updateBitStream;
420 bool deadConnection, cheater;
421 SplitPacketIdType splitPacketId;
422 SLNet::TimeMS timeoutTime; // How long to wait in MS before timing someone out
423 //int MAX_AVERAGE_PACKETS_PER_SECOND; // Name says it all
424 // int RECEIVED_PACKET_LOG_LENGTH, requestedReceivedPacketLogLength; // How big the receivedPackets array is
425 // unsigned int *receivedPackets;
426 RakNetStatistics statistics;
427
428 // Algorithm for blending ordered and sequenced on the same channel:
429 // 1. Each ordered message transmits OrderingIndexType orderedWriteIndex. There are NUMBER_OF_ORDERED_STREAMS independent values of these. The value
430 // starts at 0. Every time an ordered message is sent, the value increments by 1
431 // 2. Each sequenced message contains the current value of orderedWriteIndex for that channel, and additionally OrderingIndexType sequencedWriteIndex.
432 // sequencedWriteIndex resets to 0 every time orderedWriteIndex increments. It increments by 1 every time a sequenced message is sent.
433 // 3. The receiver maintains the next expected value for the orderedWriteIndex, stored in orderedReadIndex.
434 // 4. As messages arrive:
435 // If a message has the current ordering index, and is sequenced, and is < the current highest sequence value, discard
436 // If a message has the current ordering index, and is sequenced, and is >= the current highest sequence value, return immediately
437 // If a message has a greater ordering index, and is sequenced or ordered, buffer it
438 // If a message has the current ordering index, and is ordered, buffer, then push off messages from buffer
439 // 5. Pushing off messages from buffer:
440 // Messages in buffer are put in a minheap. The value of each node is calculated such that messages are returned:
441 // A. (lowest ordering index, lowest sequence index)
442 // B. (lowest ordering index, no sequence index)
443 // Messages are pushed off until the heap is empty, or the next message to be returned does not preserve the ordered index
444 // For an empty heap, the heap weight should start at the lowest value based on the next expected ordering index, to avoid variable overflow
445
446 // Sender increments this by 1 for every ordered message sent
447 OrderingIndexType orderedWriteIndex[NUMBER_OF_ORDERED_STREAMS];
448 // Sender increments by 1 for every sequenced message sent. Resets to 0 when an ordered message is sent
449 OrderingIndexType sequencedWriteIndex[NUMBER_OF_ORDERED_STREAMS];
450 // Next expected index for ordered messages.
451 OrderingIndexType orderedReadIndex[NUMBER_OF_ORDERED_STREAMS];
452 // Highest value received for sequencedWriteIndex for the current value of orderedReadIndex on the same channel.
453 OrderingIndexType highestSequencedReadIndex[NUMBER_OF_ORDERED_STREAMS];
454 DataStructures::Heap<reliabilityHeapWeightType, InternalPacket*, false> orderingHeaps[NUMBER_OF_ORDERED_STREAMS];
455 OrderingIndexType heapIndexOffsets[NUMBER_OF_ORDERED_STREAMS];
456
457
458
459
460
461
462
463 // CCTimeType histogramStart;
464 // unsigned histogramBitsSent;
465
466
475 // DataStructures::Queue<CCTimeType> hasReceivedPacketQueue;
476 DataStructures::Queue<bool> hasReceivedPacketQueue;
477 DatagramSequenceNumberType receivedPacketsBaseIndex;
478 bool resetReceivedPackets;
479
480 CCTimeType lastUpdateTime;
481 CCTimeType timeBetweenPackets, nextSendTime;
482 #if INCLUDE_TIMESTAMP_WITH_DATAGRAMS==1
483 CCTimeType ackPing;
484 #endif
485 // CCTimeType ackPingSamples[ACK_PING_SAMPLES_SIZE]; // Must be range of unsigned char to wrap ackPingIndex properly
486 CCTimeType ackPingSum;
487 unsigned char ackPingIndex;
488 //CCTimeType nextLowestPingReset;
489 RemoteSystemTimeType remoteSystemTime;
490 // bool continuousSend;
491 // CCTimeType lastTimeBetweenPacketsIncrease,lastTimeBetweenPacketsDecrease;
492 // Limit changes in throughput to once per ping - otherwise even if lag starts we don't know about it
493 // In the meantime the connection is flooded and overrun.
494 CCTimeType nextAllowedThroughputSample;
495 bool bandwidthExceededStatistic;
496
497 // If Update::maxBitsPerSecond > 0, then throughputCapCountdown is used as a timer to prevent sends for some amount of time after each send, depending on
498 // the amount of data sent
499 long long throughputCapCountdown;
500
501 unsigned receivePacketCount;
502
503 #ifdef _DEBUG
504 struct DataAndTime//<InternalPacket>
505 {
506 RakNetSocket2 *s;
507 char data[ MAXIMUM_MTU_SIZE ];
508 unsigned int length;
509 SLNet::TimeMS sendTime;
510 // SystemAddress systemAddress;
511 unsigned short remotePortRakNetWasStartedOn_PS3;
512 unsigned int extraSocketOptions;
513 };
514 DataStructures::Queue<DataAndTime*> delayList;
515
516 // Internet simulator
517 double packetloss;
518 SLNet::TimeMS minExtraPing, extraPingVariance;
519 #endif
520
521 CCTimeType elapsedTimeSinceLastUpdate;
522
523 CCTimeType nextAckTimeToSend;
524
525
526 #if USE_SLIDING_WINDOW_CONGESTION_CONTROL==1
527 SLNet::CCRakNetSlidingWindow congestionManager;
528 #else
529 SLNet::CCRakNetUDT congestionManager;
530 #endif
531
532
533 uint32_t unacknowledgedBytes;
534
535 bool ResendBufferOverflow(void) const;
536 void ValidateResendList(void) const;
537 void ResetPacketsAndDatagrams(void);
538 void PushPacket(CCTimeType time, InternalPacket *internalPacket, bool isReliable);
539 void PushDatagram(void);
540 bool TagMostRecentPushAsSecondOfPacketPair(void);
541 void ClearPacketsAndDatagrams(void);
542 void MoveToListHead(InternalPacket *internalPacket);
543 void RemoveFromList(InternalPacket *internalPacket, bool modifyUnacknowledgedBytes);
544 void AddToListTail(InternalPacket *internalPacket, bool modifyUnacknowledgedBytes);
545 void PopListHead(bool modifyUnacknowledgedBytes);
546 bool IsResendQueueEmpty(void) const;
547 void SortSplitPacketList(DataStructures::List<InternalPacket*> &data, unsigned int leftEdge, unsigned int rightEdge) const;
548 void SendACKs(RakNetSocket2 *s, SystemAddress &systemAddress, CCTimeType time, RakNetRandom *rnr, BitStream &updateBitStream);
549
550 DataStructures::List<InternalPacket*> packetsToSendThisUpdate;
551 DataStructures::List<bool> packetsToDeallocThisUpdate;
552 // boundary is in packetsToSendThisUpdate, inclusive
553 DataStructures::List<unsigned int> packetsToSendThisUpdateDatagramBoundaries;
554 DataStructures::List<bool> datagramsToSendThisUpdateIsPair;
555 DataStructures::List<unsigned int> datagramSizesInBytes;
556 BitSize_t datagramSizeSoFar;
557 BitSize_t allDatagramSizesSoFar;
558 double totalUserDataBytesAcked;
559 CCTimeType timeOfLastContinualSend;
560 CCTimeType timeToNextUnreliableCull;
561
562 // This doesn't need to be a member, but I do it to avoid reallocations
563 DataStructures::RangeList<DatagramSequenceNumberType> incomingAcks;
564
565 // Every 16 datagrams, we make sure the 17th datagram goes out the same update tick, and is the same size as the 16th
566 int countdownToNextPacketPair;
567 InternalPacket* AllocateFromInternalPacketPool(void);
568 void ReleaseToInternalPacketPool(InternalPacket *ip);
569
570 DataStructures::RangeList<DatagramSequenceNumberType> acknowlegements;
571 DataStructures::RangeList<DatagramSequenceNumberType> NAKs;
572 bool remoteSystemNeedsBAndAS;
573
574 unsigned int GetMaxDatagramSizeExcludingMessageHeaderBytes(void);
575 BitSize_t GetMaxDatagramSizeExcludingMessageHeaderBits(void);
576
577 // ourOffset refers to a section within externallyAllocatedPtr. Do not deallocate externallyAllocatedPtr until all references are lost
578 void AllocInternalPacketData(InternalPacket *internalPacket, InternalPacketRefCountedData **refCounter, unsigned char *externallyAllocatedPtr, unsigned char *ourOffset);
579 // Set the data pointer to externallyAllocatedPtr, do not allocate
580 void AllocInternalPacketData(InternalPacket *internalPacket, unsigned char *externallyAllocatedPtr);
581 // Allocate new
582 void AllocInternalPacketData(InternalPacket *internalPacket, unsigned int numBytes, bool allowStack, const char *file, unsigned int line);
583 void FreeInternalPacketData(InternalPacket *internalPacket, const char *file, unsigned int line);
584 DataStructures::MemoryPool<InternalPacketRefCountedData> refCountedDataPool;
585
586 BPSTracker bpsMetrics[RNS_PER_SECOND_METRICS_COUNT];
587 CCTimeType lastBpsClear;
588
589 #if LIBCAT_SECURITY==1
590 public:
591 cat::AuthenticatedEncryption* GetAuthenticatedEncryption(void) { return &auth_enc; }
592
593 protected:
594 cat::AuthenticatedEncryption auth_enc;
595 bool useSecurity;
596 #endif // LIBCAT_SECURITY
597 };
598
599 } // namespace SLNet
600
601 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • TCPInterface
SLNet::TCPInterface Member List

This is the complete list of members for SLNet::TCPInterface, including all inherited members.

AllocatePacket(unsigned dataSize) | SLNet::TCPInterface |
AttachPlugin(PluginInterface2 *plugin) | SLNet::TCPInterface |
blockingSocketList | SLNet::TCPInterface | protected
blockingSocketListMutex | SLNet::TCPInterface | protected
CloseConnection(SystemAddress systemAddress) | SLNet::TCPInterface |
completedConnectionAttemptMutex | SLNet::TCPInterface | protected
completedConnectionAttempts | SLNet::TCPInterface | protected
Connect(const char *host, unsigned short remotePort, bool block=true, unsigned short socketFamily=AF_INET, const char *bindAddress=0) | SLNet::TCPInterface |
CreateListenSocket(unsigned short port, unsigned short maxIncomingConnections, unsigned short socketFamily, const char *hostAddress) | SLNet::TCPInterface | protected
DeallocatePacket(Packet *packet) | SLNet::TCPInterface |
DetachPlugin(PluginInterface2 *plugin) | SLNet::TCPInterface |
failedConnectionAttemptMutex | SLNet::TCPInterface | protected
failedConnectionAttempts | SLNet::TCPInterface | protected
GetConnectionCount(void) const | SLNet::TCPInterface |
GetConnectionList(SystemAddress *remoteSystems, unsigned short *numberOfSystems) const | SLNet::TCPInterface |
GetOutgoingDataBufferSize(SystemAddress systemAddress) const | SLNet::TCPInterface |
HasCompletedConnectionAttempt(void) | SLNet::TCPInterface |
HasFailedConnectionAttempt(void) | SLNet::TCPInterface |
HasLostConnection(void) | SLNet::TCPInterface |
HasNewIncomingConnection(void) | SLNet::TCPInterface |
headPush | SLNet::TCPInterface | protected
incomingMessages | SLNet::TCPInterface | protected
isStarted | SLNet::TCPInterface | protected
listenSocket | SLNet::TCPInterface | protected
lostConnections | SLNet::TCPInterface | protected
messageHandlerList | SLNet::TCPInterface | protected
newIncomingConnections | SLNet::TCPInterface | protected
newRemoteClients | SLNet::TCPInterface | protected
PushBackPacket(Packet *packet, bool pushAtHead) | SLNet::TCPInterface | virtual
RAK_THREAD_DECLARATION(UpdateTCPInterfaceLoop) | SLNet::TCPInterface | protected
RAK_THREAD_DECLARATION(ConnectionAttemptLoop) | SLNet::TCPInterface | protected
Receive(void) | SLNet::TCPInterface | virtual
ReceiveHasPackets(void) | SLNet::TCPInterface | virtual
ReceiveInt(void) | SLNet::TCPInterface | protected
remoteClients | SLNet::TCPInterface | protected
remoteClientsLength | SLNet::TCPInterface | protected
requestedCloseConnections | SLNet::TCPInterface | protected
Send(const char *data, unsigned int length, const SystemAddress &systemAddress, bool broadcast) | SLNet::TCPInterface | virtual
SendList(const char **data, const unsigned int *lengths, const int numParameters, const SystemAddress &systemAddress, bool broadcast) | SLNet::TCPInterface | virtual
SocketConnect(const char *host, unsigned short remotePort, unsigned short socketFamily, const char *bindAddress) | SLNet::TCPInterface | protected
Start(unsigned short port, unsigned short maxIncomingConnections, unsigned short maxConnections=0, int _threadPriority=-99999, unsigned short socketFamily=AF_INET, const char *bindAddress=0) | SLNet::TCPInterface |
Stop(void) | SLNet::TCPInterface |
tailPush | SLNet::TCPInterface | protected
TCPInterface() | SLNet::TCPInterface |
threadPriority | SLNet::TCPInterface | protected
threadRunning | SLNet::TCPInterface | protected
WasStarted(void) const | SLNet::TCPInterface |
~TCPInterface() | SLNet::TCPInterface | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/memoryoverride.h Source File

  • include
  • slikenet
memoryoverride.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __RAK_MEMORY_H
23 #define __RAK_MEMORY_H
24
25 #include "Export.h"
26 #include "defines.h"
27 #include <new>
28
29
30
31
32
33
34
35 #include "alloca.h"
36
37 // #if _USE_RAK_MEMORY_OVERRIDE==1
38 // #if defined(new)
39 // #pragma push_macro("new")
40 // #undef new
41 // #define RMO_NEW_UNDEF
42 // #endif
43 // #endif
44
45
46 // These pointers are statically and globally defined in RakMemoryOverride.cpp
47 // Change them to point to your own allocators if you want.
48 // Use the functions for a DLL, or just reassign the variable if using source
49 extern RAK_DLL_EXPORT void * (*rakMalloc) (size_t size);
50 extern RAK_DLL_EXPORT void * (*rakRealloc) (void *p, size_t size);
51 extern RAK_DLL_EXPORT void (*rakFree) (void *p);
52 extern RAK_DLL_EXPORT void * (*rakMalloc_Ex) (size_t size, const char *file, unsigned int line);
53 extern RAK_DLL_EXPORT void * (*rakRealloc_Ex) (void *p, size_t size, const char *file, unsigned int line);
54 extern RAK_DLL_EXPORT void (*rakFree_Ex) (void *p, const char *file, unsigned int line);
55 extern RAK_DLL_EXPORT void (*notifyOutOfMemory) (const char *file, const long line);
56 extern RAK_DLL_EXPORT void * (*dlMallocMMap) (size_t size);
57 extern RAK_DLL_EXPORT void * (*dlMallocDirectMMap) (size_t size);
58 extern RAK_DLL_EXPORT int (*dlMallocMUnmap) (void* ptr, size_t size);
59
60 // Change to a user defined allocation function
61 void RAK_DLL_EXPORT SetMalloc( void* (*userFunction)(size_t size) );
62 void RAK_DLL_EXPORT SetRealloc( void* (*userFunction)(void *p, size_t size) );
63 void RAK_DLL_EXPORT SetFree( void (*userFunction)(void *p) );
64 void RAK_DLL_EXPORT SetMalloc_Ex( void* (*userFunction)(size_t size, const char *file, unsigned int line) );
65 void RAK_DLL_EXPORT SetRealloc_Ex( void* (*userFunction)(void *p, size_t size, const char *file, unsigned int line) );
66 void RAK_DLL_EXPORT SetFree_Ex( void (*userFunction)(void *p, const char *file, unsigned int line) );
67 // Change to a user defined out of memory function
68 void RAK_DLL_EXPORT SetNotifyOutOfMemory( void (*userFunction)(const char *file, const long line) );
69 void RAK_DLL_EXPORT SetDLMallocMMap( void* (*userFunction)(size_t size) );
70 void RAK_DLL_EXPORT SetDLMallocDirectMMap( void* (*userFunction)(size_t size) );
71 void RAK_DLL_EXPORT SetDLMallocMUnmap( int (*userFunction)(void* ptr, size_t size) );
72
73 extern RAK_DLL_EXPORT void * (*GetMalloc()) (size_t size);
74 extern RAK_DLL_EXPORT void * (*GetRealloc()) (void *p, size_t size);
75 extern RAK_DLL_EXPORT void (*GetFree()) (void *p);
76 extern RAK_DLL_EXPORT void * (*GetMalloc_Ex()) (size_t size, const char *file, unsigned int line);
77 extern RAK_DLL_EXPORT void * (*GetRealloc_Ex()) (void *p, size_t size, const char *file, unsigned int line);
78 extern RAK_DLL_EXPORT void (*GetFree_Ex()) (void *p, const char *file, unsigned int line);
79 extern RAK_DLL_EXPORT void *(*GetDLMallocMMap())(size_t size);
80 extern RAK_DLL_EXPORT void *(*GetDLMallocDirectMMap())(size_t size);
81 extern RAK_DLL_EXPORT int (*GetDLMallocMUnmap())(void* ptr, size_t size);
82
83 namespace SLNet
84 {
85
86 template <class Type>
87 RAK_DLL_EXPORT Type* OP_NEW(const char *file, unsigned int line)
88 {
89 #if _USE_RAK_MEMORY_OVERRIDE==1
90 char *buffer = (char *) (GetMalloc_Ex())(sizeof(Type), file, line);
91 Type *t = new (buffer) Type;
92 return t;
93 #else
94 (void) file;
95 (void) line;
96 return new Type;
97 #endif
98 }
99
100 template <class Type, class P1>
101 RAK_DLL_EXPORT Type* OP_NEW_1(const char *file, unsigned int line, const P1 &p1)
102 {
103 #if _USE_RAK_MEMORY_OVERRIDE==1
104 char *buffer = (char *) (GetMalloc_Ex())(sizeof(Type), file, line);
105 Type *t = new (buffer) Type(p1);
106 return t;
107 #else
108 (void) file;
109 (void) line;
110 return new Type(p1);
111 #endif
112 }
113
114 template <class Type, class P1, class P2>
115 RAK_DLL_EXPORT Type* OP_NEW_2(const char *file, unsigned int line, const P1 &p1, const P2 &p2)
116 {
117 #if _USE_RAK_MEMORY_OVERRIDE==1
118 char *buffer = (char *) (GetMalloc_Ex())(sizeof(Type), file, line);
119 Type *t = new (buffer) Type(p1, p2);
120 return t;
121 #else
122 (void) file;
123 (void) line;
124 return new Type(p1, p2);
125 #endif
126 }
127
128 template <class Type, class P1, class P2, class P3>
129 RAK_DLL_EXPORT Type* OP_NEW_3(const char *file, unsigned int line, const P1 &p1, const P2 &p2, const P3 &p3)
130 {
131 #if _USE_RAK_MEMORY_OVERRIDE==1
132 char *buffer = (char *) (GetMalloc_Ex())(sizeof(Type), file, line);
133 Type *t = new (buffer) Type(p1, p2, p3);
134 return t;
135 #else
136 (void) file;
137 (void) line;
138 return new Type(p1, p2, p3);
139 #endif
140 }
141
142 template <class Type, class P1, class P2, class P3, class P4>
143 RAK_DLL_EXPORT Type* OP_NEW_4(const char *file, unsigned int line, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
144 {
145 #if _USE_RAK_MEMORY_OVERRIDE==1
146 char *buffer = (char *) (GetMalloc_Ex())(sizeof(Type), file, line);
147 Type *t = new (buffer) Type(p1, p2, p3, p4);
148 return t;
149 #else
150 (void) file;
151 (void) line;
152 return new Type(p1, p2, p3, p4);
153 #endif
154 }
155
156
157 template <class Type>
158 RAK_DLL_EXPORT Type* OP_NEW_ARRAY(const int count, const char *file, unsigned int line)
159 {
160 if (count==0)
161 return 0;
162
163 #if _USE_RAK_MEMORY_OVERRIDE==1
164 // Type *t;
165 char *buffer = (char *) (GetMalloc_Ex())(sizeof(int)+sizeof(Type)*count, file, line);
166 ((int*)buffer)[0]=count;
167 for (int i=0; i<count; i++)
168 {
169 //t =
170 new(buffer+sizeof(int)+i*sizeof(Type)) Type;
171 }
172 return (Type *) (buffer+sizeof(int));
173 #else
174 (void) file;
175 (void) line;
176 return new Type[count];
177 #endif
178
179 }
180
181 template <class Type>
182 RAK_DLL_EXPORT void OP_DELETE(Type *buff, const char *file, unsigned int line)
183 {
184 #if _USE_RAK_MEMORY_OVERRIDE==1
185 if (buff==0) return;
186 buff->~Type();
187 (GetFree_Ex())((char*)buff, file, line );
188 #else
189 (void) file;
190 (void) line;
191 delete buff;
192 #endif
193
194 }
195
196 template <class Type>
197 RAK_DLL_EXPORT void OP_DELETE_ARRAY(Type *buff, const char *file, unsigned int line)
198 {
199 #if _USE_RAK_MEMORY_OVERRIDE==1
200 if (buff==0)
201 return;
202
203 int count = ((int*)((char*)buff-sizeof(int)))[0];
204 Type *t;
205 for (int i=0; i<count; i++)
206 {
207 t = buff+i;
208 t->~Type();
209 }
210 (GetFree_Ex())((char*)buff-sizeof(int), file, line );
211 #else
212 (void) file;
213 (void) line;
214 delete [] buff;
215 #endif
216
217 }
218
219 void RAK_DLL_EXPORT * _RakMalloc (size_t size);
220 void RAK_DLL_EXPORT * _RakRealloc (void *p, size_t size);
221 void RAK_DLL_EXPORT _RakFree (void *p);
222 void RAK_DLL_EXPORT * _RakMalloc_Ex (size_t size, const char *file, unsigned int line);
223 void RAK_DLL_EXPORT * _RakRealloc_Ex (void *p, size_t size, const char *file, unsigned int line);
224 void RAK_DLL_EXPORT _RakFree_Ex (void *p, const char *file, unsigned int line);
225 void RAK_DLL_EXPORT * _DLMallocMMap (size_t size);
226 void RAK_DLL_EXPORT * _DLMallocDirectMMap (size_t size);
227 int RAK_DLL_EXPORT _DLMallocMUnmap (void *p, size_t size);
228
229 }
230
231 // Call to make RakNet allocate a large block of memory, and do all subsequent allocations in that memory block
232 // Initial and reallocations will be done through whatever function is pointed to by yourMMapFunction, and yourDirectMMapFunction (default is malloc)
233 // Allocations will be freed through whatever function is pointed to by yourMUnmapFunction (default free)
234 void UseRaknetFixedHeap(size_t initialCapacity,
235 void * (*yourMMapFunction) (size_t size) = SLNet::_DLMallocMMap,
236 void * (*yourDirectMMapFunction) (size_t size) = SLNet::_DLMallocDirectMMap,
237 int (*yourMUnmapFunction) (void *p, size_t size) = SLNet::_DLMallocMUnmap);
238
239 // Free memory allocated from UseRaknetFixedHeap
240 void FreeRakNetFixedHeap(void);
241
242 // #if _USE_RAK_MEMORY_OVERRIDE==1
243 // #if defined(RMO_NEW_UNDEF)
244 // #pragma pop_macro("new")
245 // #undef RMO_NEW_UNDEF
246 // #endif
247 // #endif
248
249 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Rackspace.h Source File

  • include
  • slikenet
Rackspace.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22
23 #if _RAKNET_SUPPORT_Rackspace==1 && _RAKNET_SUPPORT_TCPInterface==1
24
25 #include "Export.h"
26 #include "DS_List.h"
27 #include "types.h"
28 #include "DS_Queue.h"
29 #include "string.h"
30
31 #ifndef __RACKSPACE_H
32 #define __RACKSPACE_H
33
34 namespace SLNet
35 {
36
37 class TCPInterface;
38 struct Packet;
39
42 enum RackspaceEventType
43 {
44 RET_Success_200,
45 RET_Success_201,
46 RET_Success_202,
47 RET_Success_203,
48 RET_Success_204,
49 RET_Cloud_Servers_Fault_500,
50 RET_Service_Unavailable_503,
51 RET_Unauthorized_401,
52 RET_Bad_Request_400,
53 RET_Over_Limit_413,
54 RET_Bad_Media_Type_415,
55 RET_Item_Not_Found_404,
56 RET_Build_In_Progress_409,
57 RET_Resize_Not_Allowed_403,
58 RET_Connection_Closed_Without_Reponse,
59 RET_Unknown_Failure,
60 };
61
63 enum RackspaceOperationType
64 {
65 RO_CONNECT_AND_AUTHENTICATE,
66 RO_LIST_SERVERS,
67 RO_LIST_SERVERS_WITH_DETAILS,
68 RO_CREATE_SERVER,
69 RO_GET_SERVER_DETAILS,
70 RO_UPDATE_SERVER_NAME_OR_PASSWORD,
71 RO_DELETE_SERVER,
72 RO_LIST_SERVER_ADDRESSES,
73 RO_SHARE_SERVER_ADDRESS,
74 RO_DELETE_SERVER_ADDRESS,
75 RO_REBOOT_SERVER,
76 RO_REBUILD_SERVER,
77 RO_RESIZE_SERVER,
78 RO_CONFIRM_RESIZED_SERVER,
79 RO_REVERT_RESIZED_SERVER,
80 RO_LIST_FLAVORS,
81 RO_GET_FLAVOR_DETAILS,
82 RO_LIST_IMAGES,
83 RO_CREATE_IMAGE,
84 RO_GET_IMAGE_DETAILS,
85 RO_DELETE_IMAGE,
86 RO_LIST_SHARED_IP_GROUPS,
87 RO_LIST_SHARED_IP_GROUPS_WITH_DETAILS,
88 RO_CREATE_SHARED_IP_GROUP,
89 RO_GET_SHARED_IP_GROUP_DETAILS,
90 RO_DELETE_SHARED_IP_GROUP,
91
92 RO_NONE,
93 };
94
96 class RAK_DLL_EXPORT Rackspace2EventCallback
97 {
98 public:
99 Rackspace2EventCallback() {}
100 virtual ~Rackspace2EventCallback() {}
101 virtual void OnAuthenticationResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
102 virtual void OnListServersResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
103 virtual void OnListServersWithDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
104 virtual void OnCreateServerResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
105 virtual void OnGetServerDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
106 virtual void OnUpdateServerNameOrPassword(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
107 virtual void OnDeleteServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
108 virtual void OnListServerAddresses(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
109 virtual void OnShareServerAddress(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
110 virtual void OnDeleteServerAddress(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
111 virtual void OnRebootServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
112 virtual void OnRebuildServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
113 virtual void OnResizeServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
114 virtual void OnConfirmResizedServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
115 virtual void OnRevertResizedServer(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
116 virtual void OnListFlavorsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
117 virtual void OnGetFlavorDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
118 virtual void OnListImagesResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
119 virtual void OnCreateImageResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
120 virtual void OnGetImageDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
121 virtual void OnDeleteImageResult(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
122 virtual void OnListSharedIPGroups(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
123 virtual void OnListSharedIPGroupsWithDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
124 virtual void OnCreateSharedIPGroup(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
125 virtual void OnGetSharedIPGroupDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
126 virtual void OnDeleteSharedIPGroup(RackspaceEventType eventType, const char *htmlAdditionalInfo)=0;
127
128 virtual void OnConnectionAttemptFailure(RackspaceOperationType operationType, const char *url)=0;
129 };
130
132 class RAK_DLL_EXPORT RackspaceEventCallback_Default : public Rackspace2EventCallback
133 {
134 public:
135 virtual void ExecuteDefault(const char *callbackName, RackspaceEventType eventType, const char *htmlAdditionalInfo) {(void) callbackName; (void) eventType; (void) htmlAdditionalInfo;}
136
137 virtual void OnAuthenticationResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnAuthenticationResult", eventType, htmlAdditionalInfo);}
138 virtual void OnListServersResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnListServersResult", eventType, htmlAdditionalInfo);}
139 virtual void OnListServersWithDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnListServersWithDetailsResult", eventType, htmlAdditionalInfo);}
140 virtual void OnCreateServerResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnCreateServerResult", eventType, htmlAdditionalInfo);}
141 virtual void OnGetServerDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnGetServerDetails", eventType, htmlAdditionalInfo);}
142 virtual void OnUpdateServerNameOrPassword(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnUpdateServerNameOrPassword", eventType, htmlAdditionalInfo);}
143 virtual void OnDeleteServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnDeleteServer", eventType, htmlAdditionalInfo);}
144 virtual void OnListServerAddresses(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnListServerAddresses", eventType, htmlAdditionalInfo);}
145 virtual void OnShareServerAddress(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnShareServerAddress", eventType, htmlAdditionalInfo);}
146 virtual void OnDeleteServerAddress(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnDeleteServerAddress", eventType, htmlAdditionalInfo);}
147 virtual void OnRebootServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnRebootServer", eventType, htmlAdditionalInfo);}
148 virtual void OnRebuildServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnRebuildServer", eventType, htmlAdditionalInfo);}
149 virtual void OnResizeServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnResizeServer", eventType, htmlAdditionalInfo);}
150 virtual void OnConfirmResizedServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnConfirmResizedServer", eventType, htmlAdditionalInfo);}
151 virtual void OnRevertResizedServer(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnRevertResizedServer", eventType, htmlAdditionalInfo);}
152 virtual void OnListFlavorsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnListFlavorsResult", eventType, htmlAdditionalInfo);}
153 virtual void OnGetFlavorDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnGetFlavorDetailsResult", eventType, htmlAdditionalInfo);}
154 virtual void OnListImagesResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnListImagesResult", eventType, htmlAdditionalInfo);}
155 virtual void OnCreateImageResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnCreateImageResult", eventType, htmlAdditionalInfo);}
156 virtual void OnGetImageDetailsResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnGetImageDetailsResult", eventType, htmlAdditionalInfo);}
157 virtual void OnDeleteImageResult(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnDeleteImageResult", eventType, htmlAdditionalInfo);}
158 virtual void OnListSharedIPGroups(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnListSharedIPGroups", eventType, htmlAdditionalInfo);}
159 virtual void OnListSharedIPGroupsWithDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnListSharedIPGroupsWithDetails", eventType, htmlAdditionalInfo);}
160 virtual void OnCreateSharedIPGroup(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnCreateSharedIPGroup", eventType, htmlAdditionalInfo);}
161 virtual void OnGetSharedIPGroupDetails(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnGetSharedIPGroupDetails", eventType, htmlAdditionalInfo);}
162 virtual void OnDeleteSharedIPGroup(RackspaceEventType eventType, const char *htmlAdditionalInfo) {ExecuteDefault("OnDeleteSharedIPGroup", eventType, htmlAdditionalInfo);}
163
164 virtual void OnConnectionAttemptFailure(RackspaceOperationType operationType, const char *url) {(void) operationType; (void) url;}
165 };
166
171 class RAK_DLL_EXPORT Rackspace
172 {
173 public:
174 Rackspace();
175 ~Rackspace();
176
186 SystemAddress Authenticate(TCPInterface *_tcpInterface, const char *_authenticationURL, const char *_rackspaceCloudUsername, const char *_apiAccessKey);
187
191 void ListServers(void);
192
197 void ListServersWithDetails(void);
198
211 void CreateServer(SLNet::RakString name, SLNet::RakString imageId, SLNet::RakString flavorId);
212
217 void GetServerDetails(SLNet::RakString serverId);
218
225 void UpdateServerNameOrPassword(SLNet::RakString serverId, SLNet::RakString newName, SLNet::RakString newPassword);
226
231 void DeleteServer(SLNet::RakString serverId);
232
237 void ListServerAddresses(SLNet::RakString serverId);
238
244 void ShareServerAddress(SLNet::RakString serverId, SLNet::RakString ipAddress);
245
251 void DeleteServerAddress(SLNet::RakString serverId, SLNet::RakString ipAddress);
252
258 void RebootServer(SLNet::RakString serverId, SLNet::RakString rebootType);
259
265 void RebuildServer(SLNet::RakString serverId, SLNet::RakString imageId);
266
273 void ResizeServer(SLNet::RakString serverId, SLNet::RakString flavorId);
274
280 void ConfirmResizedServer(SLNet::RakString serverId);
281
287 void RevertResizedServer(SLNet::RakString serverId);
288
292 void ListFlavors(void);
293
299 void GetFlavorDetails(SLNet::RakString flavorId);
300
305 void ListImages(void);
306
313 void CreateImage(SLNet::RakString serverId, SLNet::RakString imageName);
314
320 void GetImageDetails(SLNet::RakString imageId);
321
327 void DeleteImage(SLNet::RakString imageId);
328
332 void ListSharedIPGroups(void);
333
337 void ListSharedIPGroupsWithDetails(void);
338
339 // I don't know what this does
340 void CreateSharedIPGroup(SLNet::RakString name, SLNet::RakString optionalServerId);
341 // I don't know what this does
342 void GetSharedIPGroupDetails(SLNet::RakString groupId);
343 // I don't know what this does
344 void DeleteSharedIPGroup(SLNet::RakString groupId);
345
348 void AddEventCallback(Rackspace2EventCallback *callback);
351 void RemoveEventCallback(Rackspace2EventCallback *callback);
353 void ClearEventCallbacks(void);
354
356 void OnReceive(Packet *packet);
357
359 void OnClosedConnection(SystemAddress systemAddress);
360
362 static const char * EventTypeToString(RackspaceEventType eventType);
363
366 void AddOperation(RackspaceOperationType type, SLNet::RakString httpCommand, SLNet::RakString operation, SLNet::RakString xml);
367 protected:
368
369 DataStructures::List<Rackspace2EventCallback*> eventCallbacks;
370
371 struct RackspaceOperation
372 {
373 RackspaceOperationType type;
374 // SLNet::RakString stringInfo;
375 SystemAddress connectionAddress;
376 bool isPendingAuthentication;
377 SLNet::RakString incomingStream;
378 SLNet::RakString httpCommand;
379 SLNet::RakString operation;
380 SLNet::RakString xml;
381 };
382
383 TCPInterface *tcpInterface;
384
385 // RackspaceOperationType currentOperation;
386 // DataStructures::Queue<RackspaceOperation> nextOperationQueue;
387
388 DataStructures::List<RackspaceOperation> operations;
389 bool HasOperationOfType(RackspaceOperationType t);
390 unsigned int GetOperationOfTypeIndex(RackspaceOperationType t);
391
392 SLNet::RakString serverManagementURL;
393 SLNet::RakString serverManagementDomain;
394 SLNet::RakString serverManagementPath;
395 SLNet::RakString storageURL;
396 SLNet::RakString storageDomain;
397 SLNet::RakString storagePath;
398 SLNet::RakString cdnManagementURL;
399 SLNet::RakString cdnManagementDomain;
400 SLNet::RakString cdnManagementPath;
401
402 SLNet::RakString storageToken;
403 SLNet::RakString authToken;
404 SLNet::RakString rackspaceCloudUsername;
405 SLNet::RakString apiAccessKey;
406
407 bool ExecuteOperation(RackspaceOperation &ro);
408 void ReadLine(const char *data, const char *stringStart, SLNet::RakString &output);
409 bool ConnectToServerManagementDomain(RackspaceOperation &ro);
410
411
412 };
413
414 } // namespace SLNet
415
416 #endif // __RACKSPACE_API_H
417
418 #endif // _RAKNET_SUPPORT_Rackspace
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/LinuxStrings.cpp Source File

  • src
LinuxStrings.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #if (defined(__GNUC__) || defined(__ARMCC_VERSION) || defined(__GCCXML__) || defined(__S3E__) ) && !defined(_WIN32)
17 #include <string.h>
18 #ifndef _stricmp
19 int _stricmp(const char* s1, const char* s2)
20 {
21 return strcasecmp(s1,s2);
22 }
23 #endif
24 int _strnicmp(const char* s1, const char* s2, size_t n)
25 {
26 return strncasecmp(s1,s2,n);
27 }
28 #ifndef __APPLE__
29 char *_strlwr(char * str )
30 {
31 if (str==0)
32 return 0;
33 for (int i=0; str[i]; i++)
34 {
35 if (str[i]>='A' && str[i]<='Z')
36 str[i]+='a'-'A';
37 }
38 return str;
39 }
40 #endif
41 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/EpochTimeToString.h Source File

  • include
  • slikenet
EpochTimeToString.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11
14
15
16 #ifndef __EPOCH_TIME_TO_STRING_H
17 #define __EPOCH_TIME_TO_STRING_H
18
19 #include "Export.h"
20
21 RAK_DLL_EXPORT char * EpochTimeToString(long long time);
22
23 #endif
24
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • DataCompressor
SLNet::DataCompressor Member List

This is the complete list of members for SLNet::DataCompressor, including all inherited members.

Compress(unsigned char *userData, unsigned sizeInBytes, SLNet::BitStream *output) | SLNet::DataCompressor | static
DecompressAndAllocate(SLNet::BitStream *input, unsigned char **output) | SLNet::DataCompressor | static
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TransportInterface.h Source File

  • include
  • slikenet
TransportInterface.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __TRANSPORT_INTERFACE_H
23 #define __TRANSPORT_INTERFACE_H
24
25 #include "types.h"
26 #include "Export.h"
27 #include "memoryoverride.h"
28
29 #define REMOTE_MAX_TEXT_INPUT 2048
30
31 namespace SLNet
32 {
33
34 class CommandParserInterface;
35
36
39 class RAK_DLL_EXPORT TransportInterface
40 {
41 public:
42 TransportInterface() {}
43 virtual ~TransportInterface() {}
44
49 virtual bool Start(unsigned short port, bool serverMode)=0;
50
52 virtual void Stop(void)=0;
53
60 virtual void Send( SystemAddress systemAddress, const char *data, ... )=0;
61
64 virtual void CloseConnection( SystemAddress systemAddress )=0;
65
71 virtual Packet* Receive( void )=0;
72
75 virtual void DeallocatePacket( Packet *packet )=0;
76
79 virtual SystemAddress HasNewIncomingConnection(void)=0;
80
83 virtual SystemAddress HasLostConnection(void)=0;
84
89 virtual CommandParserInterface* GetCommandParser(void)=0;
90 protected:
91 };
92
93 } // namespace SLNet
94
95 #endif
96
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
ThreadDataInterface Member List

This is the complete list of members for ThreadDataInterface, including all inherited members.

PerThreadDestructor(void *factoryResult, void *context)=0 | ThreadDataInterface | pure virtual
PerThreadFactory(void *context)=0 | ThreadDataInterface | pure virtual
ThreadDataInterface() | ThreadDataInterface | inline
~ThreadDataInterface() | ThreadDataInterface | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetStatistics
SLNet::RakNetStatistics Member List

This is the complete list of members for SLNet::RakNetStatistics, including all inherited members.

BPSLimitByCongestionControl | SLNet::RakNetStatistics |
BPSLimitByOutgoingBandwidthLimit | SLNet::RakNetStatistics |
bytesInResendBuffer | SLNet::RakNetStatistics |
bytesInSendBuffer | SLNet::RakNetStatistics |
connectionStartTime | SLNet::RakNetStatistics |
isLimitedByCongestionControl | SLNet::RakNetStatistics |
isLimitedByOutgoingBandwidthLimit | SLNet::RakNetStatistics |
messageInSendBuffer | SLNet::RakNetStatistics |
messagesInResendBuffer | SLNet::RakNetStatistics |
operator+=(const RakNetStatistics &other) | SLNet::RakNetStatistics | inline
packetlossLastSecond | SLNet::RakNetStatistics |
packetlossTotal | SLNet::RakNetStatistics |
runningTotal | SLNet::RakNetStatistics |
valueOverLastSecond | SLNet::RakNetStatistics |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
  • BufferedCommandStruct
SLNet::RakPeer::BufferedCommandStruct Member List

This is the complete list of members for SLNet::RakPeer::BufferedCommandStruct, including all inherited members.

BCS_CHANGE_SYSTEM_ADDRESS enum value | SLNet::RakPeer::BufferedCommandStruct
BCS_CLOSE_CONNECTION enum value | SLNet::RakPeer::BufferedCommandStruct
BCS_DO_NOTHING enum value | SLNet::RakPeer::BufferedCommandStruct
BCS_GET_SOCKET enum value | SLNet::RakPeer::BufferedCommandStruct
BCS_SEND enum value | SLNet::RakPeer::BufferedCommandStruct
blockingCommand | SLNet::RakPeer::BufferedCommandStruct
broadcast | SLNet::RakPeer::BufferedCommandStruct
command | SLNet::RakPeer::BufferedCommandStruct
connectionMode | SLNet::RakPeer::BufferedCommandStruct
connectionSocketIndex | SLNet::RakPeer::BufferedCommandStruct
data | SLNet::RakPeer::BufferedCommandStruct
extraSocketOptions | SLNet::RakPeer::BufferedCommandStruct
haveRakNetCloseSocket | SLNet::RakPeer::BufferedCommandStruct
networkID | SLNet::RakPeer::BufferedCommandStruct
numberOfBitsToSend | SLNet::RakPeer::BufferedCommandStruct
orderingChannel | SLNet::RakPeer::BufferedCommandStruct
port | SLNet::RakPeer::BufferedCommandStruct
priority | SLNet::RakPeer::BufferedCommandStruct
receipt | SLNet::RakPeer::BufferedCommandStruct
reliability | SLNet::RakPeer::BufferedCommandStruct
remotePortRakNetWasStartedOn_PS3 | SLNet::RakPeer::BufferedCommandStruct
socket | SLNet::RakPeer::BufferedCommandStruct
systemIdentifier | SLNet::RakPeer::BufferedCommandStruct
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakWString
SLNet::RakWString Member List

This is the complete list of members for SLNet::RakWString, including all inherited members.

c_str | SLNet::RakWString | protected
c_strCharLength | SLNet::RakWString | protected
C_String(void) const | SLNet::RakWString | inline
Clear(void) | SLNet::RakWString |
Deserialize(BitStream *bs) | SLNet::RakWString |
Deserialize(wchar_t *str, BitStream *bs) | SLNet::RakWString | static
Deserialize(wchar_t *str, size_t strLength, BitStream *bs) | SLNet::RakWString | static
FPrintf(FILE *fp) | SLNet::RakWString |
GetLength(void) const | SLNet::RakWString |
IsEmpty(void) const | SLNet::RakWString |
operator wchar_t *() const | SLNet::RakWString | inline
operator!=(const RakWString &right) const | SLNet::RakWString |
operator+=(const RakWString &right) | SLNet::RakWString |
operator+=(const wchar_t *const right) | SLNet::RakWString |
operator+=(wchar_t *right) | SLNet::RakWString |
operator<(const RakWString &right) const | SLNet::RakWString |
operator<=(const RakWString &right) const | SLNet::RakWString |
operator=(const RakWString &right) | SLNet::RakWString |
operator=(const RakString &right) | SLNet::RakWString |
operator=(const wchar_t *const str) | SLNet::RakWString |
operator=(wchar_t *str) | SLNet::RakWString |
operator=(const char *const str) | SLNet::RakWString |
operator=(char *str) | SLNet::RakWString |
operator==(const RakWString &right) const | SLNet::RakWString |
operator>(const RakWString &right) const | SLNet::RakWString |
operator>=(const RakWString &right) const | SLNet::RakWString |
Printf(void) | SLNet::RakWString |
RakWString() | SLNet::RakWString |
RakWString(const RakString &right) | SLNet::RakWString |
RakWString(const wchar_t *input) | SLNet::RakWString |
RakWString(const RakWString &right) | SLNet::RakWString |
RakWString(const char *input) | SLNet::RakWString |
Serialize(BitStream *bs) const | SLNet::RakWString |
Serialize(const wchar_t *const str, BitStream *bs) | SLNet::RakWString | static
Set(wchar_t *str) | SLNet::RakWString |
StrCmp(const RakWString &right) const | SLNet::RakWString |
StrICmp(const RakWString &right) const | SLNet::RakWString |
ToInteger(const RakWString &rs) | SLNet::RakWString | static
~RakWString() | SLNet::RakWString |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/peer.h Source File

  • include
  • slikenet
peer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 // TODO - RakNet 4 - Add network simulator
22 // TODO - RakNet 4 - Enable disabling flow control per connections
23
24 #ifndef __RAK_PEER_H
25 #define __RAK_PEER_H
26
27 #include "ReliabilityLayer.h"
28 #include "peerinterface.h"
29 #include "BitStream.h"
30 #include "SingleProducerConsumer.h"
31 #include "SimpleMutex.h"
32 #include "DS_OrderedList.h"
33 #include "Export.h"
34 #include "string.h"
35 #include "thread.h"
36 //#include "socket.h"
37 #include "smartptr.h"
38 #include "DS_ThreadsafeAllocatingQueue.h"
39 #include "SignaledEvent.h"
40 #include "NativeFeatureIncludes.h"
41 #include "SecureHandshake.h"
42 #include "LocklessTypes.h"
43 #include "DS_Queue.h"
44
45 namespace SLNet {
47 class HuffmanEncodingTree;
48 class PluginInterface2;
49
50 // Sucks but this struct has to be outside the class. Inside and DevCPP won't let you refer to the struct as RakPeer::RemoteSystemIndex while GCC
51 // forces you to do RakPeer::RemoteSystemIndex
52 struct RemoteSystemIndex{unsigned index; RemoteSystemIndex *next;};
53 //int RAK_DLL_EXPORT SystemAddressAndIndexComp( const SystemAddress &key, const RemoteSystemIndex &data ); // GCC requires RakPeer::RemoteSystemIndex or it won't compile
54
62 class RAK_DLL_EXPORT RakPeer : public RakPeerInterface, public RNS2EventHandler
63 {
64 public:
66 RakPeer();
67
69 virtual ~RakPeer();
70
71 // --------------------------------------------------------------------------------------------Major Low Level Functions - Functions needed by most users--------------------------------------------------------------------------------------------
83 StartupResult Startup( unsigned int maxConnections, SocketDescriptor *socketDescriptors, unsigned socketDescriptorCount, int threadPriority=-99999 );
84
94 bool InitializeSecurity( const char *publicKey, const char *privateKey, bool bRequireClientKey = false );
95
98 void DisableSecurity( void );
99
105 void AddToSecurityExceptionList(const char *ip);
106
109 void RemoveFromSecurityExceptionList(const char *ip);
110
114 bool IsInSecurityExceptionList(const char *ip);
115
123 void SetMaximumIncomingConnections( unsigned short numberAllowed );
124
127 unsigned int GetMaximumIncomingConnections( void ) const;
128
131 unsigned short NumberOfConnections(void) const;
132
139 void SetIncomingPassword( const char* passwordData, int passwordDataLength );
140
144 void GetIncomingPassword( char* passwordData, int *passwordDataLength );
145
167 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 );
168
180 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);
181
182 /* /// \brief Connect to the specified network ID (Platform specific console function)
187 //bool Console2LobbyConnect( void *networkServiceId, const char *passwordData, int passwordDataLength );*/
188
194 void Shutdown( unsigned int blockDuration, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY );
195
198 bool IsActive( void ) const;
199
203 bool GetConnectionList( SystemAddress *remoteSystems, unsigned short *numberOfSystems ) const;
204
208 virtual uint32_t GetNextSendReceipt(void);
209
213 virtual uint32_t IncrementNextSendReceipt(void);
214
227 uint32_t Send( const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0 );
228
235 void SendLoopback( const char *data, const int length );
236
249 uint32_t Send( const SLNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, uint32_t forceReceiptNumber=0 );
250
271 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 );
272
279 Packet* Receive( void );
280
283 void DeallocatePacket( Packet *packet );
284
287 unsigned int GetMaximumNumberOfPeers( void ) const;
288
289 // -------------------------------------------------------------------------------------------- Connection Management Functions--------------------------------------------------------------------------------------------
296 void CloseConnection( const AddressOrGUID target, bool sendDisconnectionNotification, unsigned char orderingChannel=0, PacketPriority disconnectionNotificationPriority=LOW_PRIORITY );
297
301 void CancelConnectionAttempt( const SystemAddress target );
306 ConnectionState GetConnectionState(const AddressOrGUID systemIdentifier);
307
313 int GetIndexFromSystemAddress( const SystemAddress systemAddress ) const;
314
320 SystemAddress GetSystemAddressFromIndex( unsigned int index );
321
325 RakNetGUID GetGUIDFromIndex( unsigned int index );
326
331 void GetSystemList(DataStructures::List<SystemAddress> &addresses, DataStructures::List<RakNetGUID> &guids) const;
332
337 void AddToBanList( const char *IP, SLNet::TimeMS milliseconds=0 );
338
341 void RemoveFromBanList( const char *IP );
342
344 void ClearBanList( void );
345
349 bool IsBanned( const char *IP );
350
354 void SetLimitIPConnectionFrequency(bool b);
355
356 // --------------------------------------------------------------------------------------------Pinging Functions - Functions dealing with the automatic ping mechanism--------------------------------------------------------------------------------------------
360 void Ping( const SystemAddress target );
361
370 bool Ping( const char* host, unsigned short remotePort, bool onlyReplyOnAcceptingConnections, unsigned connectionSocketIndex=0 );
371
375 int GetAveragePing( const AddressOrGUID systemIdentifier );
376
380 int GetLastPing( const AddressOrGUID systemIdentifier ) const;
381
385 int GetLowestPing( const AddressOrGUID systemIdentifier ) const;
386
391 void SetOccasionalPing( bool doPing );
392
397 SLNet::Time GetClockDifferential( const AddressOrGUID systemIdentifier );
398
399 // --------------------------------------------------------------------------------------------Static Data Functions - Functions dealing with API defined synchronized memory--------------------------------------------------------------------------------------------
405 void SetOfflinePingResponse( const char *data, const unsigned int length );
406
411 void GetOfflinePingResponse( char **data, unsigned int *length );
412
413 //--------------------------------------------------------------------------------------------Network Functions - Functions dealing with the network in general--------------------------------------------------------------------------------------------
419 SystemAddress GetInternalID( const SystemAddress systemAddress=UNASSIGNED_SYSTEM_ADDRESS, const int index=0 ) const;
420
424 void SetInternalID(SystemAddress systemAddress, int index=0);
425
428 SystemAddress GetExternalID( const SystemAddress target ) const;
429
431 const RakNetGUID GetMyGUID(void) const;
432
434 SystemAddress GetMyBoundAddress(const int socketIndex=0);
435
442 const RakNetGUID& GetGuidFromSystemAddress( const SystemAddress input ) const;
443
449 SystemAddress GetSystemAddressFromGuid( const RakNetGUID input ) const;
450
455 bool GetClientPublicKeyFromSystemAddress( const SystemAddress input, char *client_public_key ) const;
456
458
464 void SetTimeoutTime(SLNet::TimeMS timeMS, const SystemAddress target );
465
469 SLNet::TimeMS GetTimeoutTime( const SystemAddress target );
470
474 int GetMTUSize( const SystemAddress target ) const;
475
478 unsigned GetNumberOfAddresses( void );
479
483 const char* GetLocalIP( unsigned int index );
484
489 bool IsLocalIP( const char *ip );
490
494 void AllowConnectionResponseIPMigration( bool allow );
495
505 bool AdvertiseSystem( const char *host, unsigned short remotePort, const char *data, int dataLength, unsigned connectionSocketIndex=0 );
506
512 void SetSplitMessageProgressInterval(int interval);
513
516 int GetSplitMessageProgressInterval(void) const;
517
522 void SetUnreliableTimeout(SLNet::TimeMS timeoutMS);
523
531 void SendTTL( const char* host, unsigned short remotePort, int ttl, unsigned connectionSocketIndex=0 );
532
533 // -------------------------------------------------------------------------------------------- Plugin Functions--------------------------------------------------------------------------------------------
537 void AttachPlugin( PluginInterface2 *plugin );
538
543 void DetachPlugin( PluginInterface2 *messageHandler );
544
545 // --------------------------------------------------------------------------------------------Miscellaneous Functions--------------------------------------------------------------------------------------------
550 void PushBackPacket( Packet *packet, bool pushAtHead );
551
556 void ChangeSystemAddress(RakNetGUID guid, const SystemAddress &systemAddress);
557
562 Packet* AllocatePacket(unsigned dataSize);
563
569 virtual RakNetSocket2* GetSocket( const SystemAddress target );
570
574 virtual void GetSockets( DataStructures::List<RakNetSocket2* > &sockets );
575 virtual void ReleaseSockets( DataStructures::List<RakNetSocket2* > &sockets );
576
578 virtual void WriteOutOfBandHeader(SLNet::BitStream *bitStream);
579
583 virtual void SetUserUpdateThread(void (*_userUpdateThreadPtr)(RakPeerInterface *, void *), void *_userUpdateThreadData);
584
589 virtual void SetIncomingDatagramEventHandler( bool (*_incomingDatagramEventHandler)(RNS2RecvStruct *) );
590
591 // --------------------------------------------------------------------------------------------Network Simulator Functions--------------------------------------------------------------------------------------------
600 virtual void ApplyNetworkSimulator( float packetloss, unsigned short minExtraPing, unsigned short extraPingVariance);
601
606 virtual void SetPerConnectionOutgoingBandwidthLimit( unsigned maxBitsPerSecond );
607
610 virtual bool IsNetworkSimulatorActive( void );
611
612 // --------------------------------------------------------------------------------------------Statistical Functions - Functions dealing with API performance--------------------------------------------------------------------------------------------
613
620 RakNetStatistics * GetStatistics( const SystemAddress systemAddress, RakNetStatistics *rns=0 );
623 bool GetStatistics( const unsigned int index, RakNetStatistics *rns );
629 virtual void GetStatisticsList(DataStructures::List<SystemAddress> &addresses, DataStructures::List<RakNetGUID> &guids, DataStructures::List<RakNetStatistics> &statistics);
630
632 virtual unsigned int GetReceiveBufferSize(void);
633
634 // --------------------------------------------------------------------------------------------EVERYTHING AFTER THIS COMMENT IS FOR INTERNAL USE ONLY--------------------------------------------------------------------------------------------
635
636
638 // Call manually if RAKPEER_USER_THREADED==1 at least every 30 milliseconds.
639 // updateBitStream should be:
640 // BitStream updateBitStream( MAXIMUM_MTU_SIZE
641 // #if LIBCAT_SECURITY==1
642 // + cat::AuthenticatedEncryption::OVERHEAD_BYTES
643 // #endif
644 // );
645 bool RunUpdateCycle( BitStream &updateBitStream );
646
648 // Call manually if RAKPEER_USER_THREADED==1 at least every 30 milliseconds.
649 // Call in a loop until returns false if the socket is non-blocking
650 // remotePortRakNetWasStartedOn_PS3 and extraSocketOptions are from SocketDescriptor when the socket was created
651 // bool RunRecvFromOnce( RakNetSocket *s );
652
654 bool SendOutOfBand(const char *host, unsigned short remotePort, const char *data, BitSize_t dataLength, unsigned connectionSocketIndex=0 );
655
656 // static Packet *AllocPacket(unsigned dataSize, const char *file, unsigned int line);
657
660 struct PingAndClockDifferential
661 {
662 unsigned short pingTime;
663 SLNet::Time clockDifferential;
664 };
665
668 struct RemoteSystemStruct
669 {
670 bool isActive; // Is this structure in use?
671 SystemAddress systemAddress;
672 SystemAddress myExternalSystemAddress;
673 SystemAddress theirInternalSystemAddress[MAXIMUM_NUMBER_OF_INTERNAL_IDS];
674 ReliabilityLayer reliabilityLayer;
675 bool weInitiatedTheConnection;
676 PingAndClockDifferential pingAndClockDifferential[ PING_TIMES_ARRAY_SIZE ];
677 SLNet::Time pingAndClockDifferentialWriteIndex;
678 unsigned short lowestPing;
679 SLNet::Time nextPingTime;
680 SLNet::Time lastReliableSend;
681 SLNet::Time connectionTime;
682 // int connectionSocketIndex; // index into connectionSockets to send back on.
683 RakNetGUID guid;
684 int MTUSize;
685 // Reference counted socket to send back on
686 RakNetSocket2* rakNetSocket;
687 SystemIndex remoteSystemIndex;
688
689 #if LIBCAT_SECURITY==1
690 // Cached answer used internally by RakPeer to prevent DoS attacks based on the connexion handshake
691 char answer[cat::EasyHandshake::ANSWER_BYTES];
692
693 // If the server has bRequireClientKey = true, then this is set to the validated public key of the connected client
694 // Valid after connectMode reaches HANDLING_CONNECTION_REQUEST
695 char client_public_key[cat::EasyHandshake::PUBLIC_KEY_BYTES];
696 #endif
697
698 enum ConnectMode {NO_ACTION, DISCONNECT_ASAP, DISCONNECT_ASAP_SILENTLY, DISCONNECT_ON_NO_ACK, REQUESTED_CONNECTION, HANDLING_CONNECTION_REQUEST, UNVERIFIED_SENDER, CONNECTED} connectMode;
699 };
700
701 // DS_APR
702 //void ProcessChromePacket(RakNetSocket2 *s, const char *buffer, int dataSize, const SystemAddress& recvFromAddress, SLNet::TimeUS timeRead);
703 // /DS_APR
704 protected:
705
706 friend RAK_THREAD_DECLARATION(UpdateNetworkLoop);
707 //friend RAK_THREAD_DECLARATION(RecvFromLoop);
708 friend RAK_THREAD_DECLARATION(UDTConnect);
709
710 friend bool ProcessOfflineNetworkPacket( SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2* rakNetSocket, bool *isOfflineMessage, SLNet::TimeUS timeRead );
711 friend void ProcessNetworkPacket( const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, SLNet::TimeUS timeRead, BitStream &updateBitStream );
712 friend void ProcessNetworkPacket( const SystemAddress systemAddress, const char *data, const int length, RakPeer *rakPeer, RakNetSocket2* rakNetSocket, SLNet::TimeUS timeRead, BitStream &updateBitStream );
713
714 int GetIndexFromSystemAddress( const SystemAddress systemAddress, bool calledFromNetworkThread ) const;
715 int GetIndexFromGuid( const RakNetGUID guid );
716
717 //void RemoveFromRequestedConnectionsList( const SystemAddress systemAddress );
718 // Two versions needed because some buggy compilers strip the last parameter if unused, and crashes
719 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 );
720 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 );
724 RemoteSystemStruct *GetRemoteSystemFromSystemAddress( const SystemAddress systemAddress, bool calledFromNetworkThread, bool onlyActive ) const;
725 RakPeer::RemoteSystemStruct *GetRemoteSystem( const AddressOrGUID systemIdentifier, bool calledFromNetworkThread, bool onlyActive ) const;
726 void ValidateRemoteSystemLookup(void) const;
727 RemoteSystemStruct *GetRemoteSystemFromGUID( const RakNetGUID guid, bool onlyActive ) const;
729 void ParseConnectionRequestPacket( RakPeer::RemoteSystemStruct *remoteSystem, const SystemAddress &systemAddress, const char *data, int byteSize);
730 void OnConnectionRequest( RakPeer::RemoteSystemStruct *remoteSystem, SLNet::Time incomingTimestamp );
732 void NotifyAndFlagForShutdown( const SystemAddress systemAddress, bool performImmediate, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority );
734 unsigned int GetNumberOfRemoteInitiatedConnections( void ) const;
743 RemoteSystemStruct * AssignSystemAddressToRemoteSystemList( const SystemAddress systemAddress, RemoteSystemStruct::ConnectMode connectionMode, RakNetSocket2* incomingRakNetSocket, bool *thisIPConnectedRecently, SystemAddress bindingAddress, int incomingMTU, RakNetGUID guid, bool useSecurity );
747 void ShiftIncomingTimestamp( unsigned char *data, const SystemAddress &systemAddress ) const;
751 SLNet::Time GetBestClockDifferential( const SystemAddress systemAddress ) const;
752
753 bool IsLoopbackAddress(const AddressOrGUID &systemIdentifier, bool matchPort) const;
754 SystemAddress GetLoopbackAddress(void) const;
755
757 volatile bool endThreads;
759 volatile bool isMainLoopThreadActive;
760
761 // SLNet::LocklessUint32_t isRecvFromLoopThreadActive;
762
763
764 bool occasionalPing;
765
766 unsigned int maximumNumberOfPeers;
767 //05/02/06 Just using maximumNumberOfPeers instead
769 //unsigned short remoteSystemListSize;
771 unsigned int maximumIncomingConnections;
772 SLNet::BitStream offlinePingResponse;
774 // SystemAddress mySystemAddress[MAXIMUM_NUMBER_OF_INTERNAL_IDS];
775 char incomingPassword[256];
776 unsigned char incomingPasswordLength;
777
782 RemoteSystemStruct* remoteSystemList;
786 RemoteSystemStruct** activeSystemList;
787 unsigned int activeSystemListSize;
788
789 // Use a hash, with binaryAddress plus port mod length as the index
790 RemoteSystemIndex **remoteSystemLookup;
791 unsigned int RemoteSystemLookupHashIndex(const SystemAddress &sa) const;
792 void ReferenceRemoteSystem(const SystemAddress &sa, unsigned int remoteSystemListIndex);
793 void DereferenceRemoteSystem(const SystemAddress &sa);
794 RemoteSystemStruct* GetRemoteSystem(const SystemAddress &sa) const;
795 unsigned int GetRemoteSystemIndex(const SystemAddress &sa) const;
796 void ClearRemoteSystemLookup(void);
797 DataStructures::MemoryPool<RemoteSystemIndex> remoteSystemIndexPool;
798
799 void AddToActiveSystemList(unsigned int remoteSystemListIndex);
800 void RemoveFromActiveSystemList(const SystemAddress &sa);
801
802 // unsigned int LookupIndexUsingHashIndex(const SystemAddress &sa) const;
803 // unsigned int RemoteSystemListIndexUsingHashIndex(const SystemAddress &sa) const;
804 // unsigned int FirstFreeRemoteSystemLookupIndex(const SystemAddress &sa) const;
805
806 enum
807 {
808 // Only put these mutexes in user thread functions!
809 requestedConnectionList_Mutex,
810 offlinePingResponse_Mutex,
811 NUMBER_OF_RAKPEER_MUTEXES
812 };
813 SimpleMutex rakPeerMutexes[ NUMBER_OF_RAKPEER_MUTEXES ];
815
816 bool updateCycleIsRunning;
818
819 //DataStructures::Queue<RequestedConnectionStruct*> requestedConnectionsList;
821
822 unsigned int bytesSentPerSecond, bytesReceivedPerSecond;
823 // bool isSocketLayerBlocking;
824 // bool continualPing,isRecvfromThreadActive,isMainLoopThreadActive, endThreads, isSocketLayerBlocking;
825 unsigned int validationInteger;
826 SimpleMutex incomingQueueMutex, banListMutex; //,synchronizedMemoryQueueMutex, automaticVariableSynchronizationMutex;
827 //DataStructures::Queue<Packet *> incomingpacketSingleProducerConsumer; //, synchronizedMemorypacketSingleProducerConsumer;
828 // BitStream enumerationData;
829
830 struct BanStruct
831 {
832 char *IP;
833 SLNet::TimeMS timeout; // 0 for none
834 };
835
836 struct RequestedConnectionStruct
837 {
838 SystemAddress systemAddress;
839 SLNet::Time nextRequestTime;
840 unsigned char requestsMade;
841 char *data;
842 unsigned short dataLength;
843 char outgoingPassword[256];
844 unsigned char outgoingPasswordLength;
845 unsigned socketIndex;
846 unsigned int extraData;
847 unsigned sendConnectionAttemptCount;
848 unsigned timeBetweenSendConnectionAttemptsMS;
849 SLNet::TimeMS timeoutTime;
850 PublicKeyMode publicKeyMode;
851 RakNetSocket2* socket;
852 enum {CONNECT=1, /*PING=2, PING_OPEN_CONNECTIONS=4,*/ /*ADVERTISE_SYSTEM=2*/} actionToTake;
853
854 #if LIBCAT_SECURITY==1
855 char handshakeChallenge[cat::EasyHandshake::CHALLENGE_BYTES];
856 cat::ClientEasyHandshake *client_handshake;
857 char remote_public_key[cat::EasyHandshake::PUBLIC_KEY_BYTES];
858 // char remote_challenge[cat::EasyHandshake::CHALLENGE_BYTES];
859 // char random[16];
860 #endif
861 };
862 #if LIBCAT_SECURITY==1
863 bool GenerateConnectionRequestChallenge(RequestedConnectionStruct *rcs,PublicKey *publicKey);
864 #endif
865
866 //DataStructures::List<DataStructures::List<MemoryBlock>* > automaticVariableSynchronizationList;
867 DataStructures::List<BanStruct*> banList;
868 // Threadsafe, and not thread safe
869 DataStructures::List<PluginInterface2*> pluginListTS, pluginListNTS;
870
871 DataStructures::Queue<RequestedConnectionStruct*> requestedConnectionQueue;
872 SimpleMutex requestedConnectionQueueMutex;
873
874 // void RunMutexedUpdateCycle(void);
875
876 struct BufferedCommandStruct
877 {
878 BitSize_t numberOfBitsToSend;
879 PacketPriority priority;
880 PacketReliability reliability;
881 char orderingChannel;
882 AddressOrGUID systemIdentifier;
883 bool broadcast;
884 RemoteSystemStruct::ConnectMode connectionMode;
885 NetworkID networkID;
886 bool blockingCommand; // Only used for RPC
887 char *data;
888 bool haveRakNetCloseSocket;
889 unsigned connectionSocketIndex;
890 unsigned short remotePortRakNetWasStartedOn_PS3;
891 unsigned int extraSocketOptions;
892 RakNetSocket2* socket;
893 unsigned short port;
894 uint32_t receipt;
895 enum {BCS_SEND, BCS_CLOSE_CONNECTION, BCS_GET_SOCKET, BCS_CHANGE_SYSTEM_ADDRESS,/* BCS_USE_USER_SOCKET, BCS_REBIND_SOCKET_ADDRESS, BCS_RPC, BCS_RPC_SHIFT,*/ BCS_DO_NOTHING} command;
896 };
897
898 // Single producer single consumer queue using a linked list
899 //BufferedCommandStruct* bufferedCommandReadIndex, bufferedCommandWriteIndex;
900
901 DataStructures::ThreadsafeAllocatingQueue<BufferedCommandStruct> bufferedCommands;
902
903
904 // DataStructures::ThreadsafeAllocatingQueue<RNS2RecvStruct> bufferedPackets;
905
906 DataStructures::Queue<RNS2RecvStruct*> bufferedPacketsFreePool;
907 SLNet::SimpleMutex bufferedPacketsFreePoolMutex;
908 DataStructures::Queue<RNS2RecvStruct*> bufferedPacketsQueue;
909 SLNet::SimpleMutex bufferedPacketsQueueMutex;
910
911 virtual void DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line);
912 virtual RNS2RecvStruct *AllocRNS2RecvStruct(const char *file, unsigned int line);
913 void SetupBufferedPackets(void);
914 void PushBufferedPacket(RNS2RecvStruct * p);
915 RNS2RecvStruct *PopBufferedPacket(void);
916
917 struct SocketQueryOutput
918 {
919 SocketQueryOutput() {}
920 ~SocketQueryOutput() {}
921 DataStructures::List<RakNetSocket2* > sockets;
922 };
923
924 DataStructures::ThreadsafeAllocatingQueue<SocketQueryOutput> socketQueryOutput;
925
926
927 bool AllowIncomingConnections(void) const;
928
929 void PingInternal( const SystemAddress target, bool performImmediate, PacketReliability reliability );
930 // This stores the user send calls to be handled by the update thread. This way we don't have thread contention over systemAddresss
931 void CloseConnectionInternal( const AddressOrGUID& systemIdentifier, bool sendDisconnectionNotification, bool performImmediate, unsigned char orderingChannel, PacketPriority disconnectionNotificationPriority );
932 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 );
933 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 );
934 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 );
935 //bool HandleBufferedRPC(BufferedCommandStruct *bcs, SLNet::TimeMS time);
936 void ClearBufferedCommands(void);
937 void ClearBufferedPackets(void);
938 void ClearSocketQueryOutput(void);
939 void ClearRequestedConnectionList(void);
940 void AddPacketToProducer(SLNet::Packet *p);
941 unsigned int GenerateSeedFromGuid(void);
942 SLNet::Time GetClockDifferentialInt(RemoteSystemStruct *remoteSystem) const;
943 SimpleMutex securityExceptionMutex;
944
945 //DataStructures::AVLBalancedBinarySearchTree<RPCNode> rpcTree;
946 int defaultMTUSize;
947 bool trackFrequencyTable;
948
949 // Smart pointer so I can return the object to the user
950 DataStructures::List<RakNetSocket2* > socketList;
951 void DerefAllSockets(void);
952 unsigned int GetRakNetSocketFromUserConnectionSocketIndex(unsigned int userIndex) const;
953 // Used for RPC replies
954 SLNet::BitStream *replyFromTargetBS;
955 SystemAddress replyFromTargetPlayer;
956 bool replyFromTargetBroadcast;
957
958 SLNet::TimeMS defaultTimeoutTime;
959
960 // Generate and store a unique GUID
961 void GenerateGUID(void);
962 unsigned int GetSystemIndexFromGuid( const RakNetGUID input ) const;
963 RakNetGUID myGuid;
964
965 unsigned maxOutgoingBPS;
966
967 // Nobody would use the internet simulator in a final build.
968 #ifdef _DEBUG
969 double _packetloss;
970 unsigned short _minExtraPing, _extraPingVariance;
971 #endif
972
974 //unsigned int lastUserUpdateCycle;
976 bool allowConnectionResponseIPMigration;
977
978 SystemAddress firstExternalID;
979 int splitMessageProgressInterval;
980 SLNet::TimeMS unreliableTimeout;
981
982 bool (*incomingDatagramEventHandler)(RNS2RecvStruct *);
983
984 // Systems in this list will not go through the secure connection process, even when secure connections are turned on. Wildcards are accepted.
985 DataStructures::List<SLNet::RakString> securityExceptionList;
986
987 SystemAddress ipList[ MAXIMUM_NUMBER_OF_INTERNAL_IDS ];
988
989 bool allowInternalRouting;
990
991 void (*userUpdateThreadPtr)(RakPeerInterface *, void *);
992 void *userUpdateThreadData;
993
994
995 SignaledEvent quitAndDataEvents;
996 bool limitConnectionFrequencyFromTheSameIP;
997
998 SimpleMutex packetAllocationPoolMutex;
999 DataStructures::MemoryPool<Packet> packetAllocationPool;
1000
1001 SimpleMutex packetReturnMutex;
1002 DataStructures::Queue<Packet*> packetReturnQueue;
1003 Packet *AllocPacket(unsigned dataSize, const char *file, unsigned int line);
1004 Packet *AllocPacket(unsigned dataSize, unsigned char *data, const char *file, unsigned int line);
1005
1009 SimpleMutex sendReceiptSerialMutex;
1010 uint32_t sendReceiptSerial;
1011 void ResetSendReceipt(void);
1012 void OnConnectedPong(SLNet::Time sendPingTime, SLNet::Time sendPongTime, RemoteSystemStruct *remoteSystem);
1013 void CallPluginCallbacks(DataStructures::List<PluginInterface2*> &pluginList, Packet *packet);
1014
1015 #if LIBCAT_SECURITY==1
1016 // Encryption and security
1017 bool _using_security, _require_client_public_key;
1018 char my_public_key[cat::EasyHandshake::PUBLIC_KEY_BYTES];
1019 cat::ServerEasyHandshake *_server_handshake;
1020 cat::CookieJar *_cookie_jar;
1021 bool InitializeClientSecurity(RequestedConnectionStruct *rcs, const char *public_key);
1022 #endif
1023
1024
1025
1026
1027
1028
1029 virtual void OnRNS2Recv(RNS2RecvStruct *recvStruct);
1030 void FillIPList(void);
1031 }
1032 // #if defined(SN_TARGET_PSP2)
1033 // __attribute__((aligned(8)))
1034 // #endif
1035 ;
1036
1037 } // namespace SLNet
1038
1039 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/NatTypeDetectionCommon.cpp Source File

  • src
NatTypeDetectionCommon.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NatTypeDetectionCommon.h"
17
18 #if _RAKNET_SUPPORT_NatTypeDetectionServer==1 || _RAKNET_SUPPORT_NatTypeDetectionClient==1
19
20 #include "slikenet/SocketLayer.h"
21 #include "slikenet/SocketIncludes.h"
22 #include "slikenet/SocketDefines.h"
23
24 using namespace SLNet;
25
26 bool SLNet::CanConnect(NATTypeDetectionResult type1, NATTypeDetectionResult type2)
27 {
30 bool connectionGraph[NAT_TYPE_COUNT][NAT_TYPE_COUNT] =
31 {
32 // None, Full Cone, Address Restricted, Port Restricted, Symmetric, Unknown, InProgress, Supports_UPNP
33 {true, true, true, true, true, false, false, true}, // None
34 {true, true, true, true, true, false, false, true}, // Full Cone
35 {true, true, true, true, true, false, false, true}, // Address restricted
36 {true, true, true, true, false, false, false, true}, // Port restricted
37 {true, true, true, false, false, false, false, true}, // Symmetric
38 {false, false, false, false, false, false, false, false}, // Unknown
39 {false, false, false, false, false, false, false, false}, // InProgress
40 {true, true, true, true, true, false, false, true} // Supports_UPNP
41 };
42
43 return connectionGraph[(int) type1][(int) type2];
44 }
45
46 const char *SLNet::NATTypeDetectionResultToString(NATTypeDetectionResult type)
47 {
48 switch (type)
49 {
50 case NAT_TYPE_NONE:
51 return "None";
52 case NAT_TYPE_FULL_CONE:
53 return "Full cone";
54 case NAT_TYPE_ADDRESS_RESTRICTED:
55 return "Address restricted";
56 case NAT_TYPE_PORT_RESTRICTED:
57 return "Port restricted";
58 case NAT_TYPE_SYMMETRIC:
59 return "Symmetric";
60 case NAT_TYPE_UNKNOWN:
61 return "Unknown";
62 case NAT_TYPE_DETECTION_IN_PROGRESS:
63 return "In Progress";
64 case NAT_TYPE_SUPPORTS_UPNP:
65 return "Supports UPNP";
66 case NAT_TYPE_COUNT:
67 return "NAT_TYPE_COUNT";
68 }
69 return "Error, unknown enum in NATTypeDetectionResult";
70 }
71
72 // None and relaxed can connect to anything
73 // Moderate can connect to moderate or less
74 // Strict can connect to relaxed or less
75 const char *SLNet::NATTypeDetectionResultToStringFriendly(NATTypeDetectionResult type)
76 {
77 switch (type)
78 {
79 case NAT_TYPE_NONE:
80 return "Open";
81 case NAT_TYPE_FULL_CONE:
82 return "Relaxed";
83 case NAT_TYPE_ADDRESS_RESTRICTED:
84 return "Relaxed";
85 case NAT_TYPE_PORT_RESTRICTED:
86 return "Moderate";
87 case NAT_TYPE_SYMMETRIC:
88 return "Strict";
89 case NAT_TYPE_UNKNOWN:
90 return "Unknown";
91 case NAT_TYPE_DETECTION_IN_PROGRESS:
92 return "In Progress";
93 case NAT_TYPE_SUPPORTS_UPNP:
94 return "Supports UPNP";
95 case NAT_TYPE_COUNT:
96 return "NAT_TYPE_COUNT";
97 }
98 return "Error, unknown enum in NATTypeDetectionResult";
99 }
100
101
102 RakNetSocket2* SLNet::CreateNonblockingBoundSocket(const char *bindAddr
103 #ifdef __native_client__
104 ,_PP_Instance_ chromeInstance
105 #endif
106 , RNS2EventHandler *eventHandler
107 )
108 {
109 RakNetSocket2 *r2 = RakNetSocket2Allocator::AllocRNS2();
110 #if defined(__native_client__)
111 NativeClientBindParameters ncbp;
112 RNS2_NativeClient * nativeClientSocket = (RNS2_NativeClient*) r2;
113 ncbp.eventHandler=eventHandler;
114 ncbp.forceHostAddress=(char*) bindAddr;
115 ncbp.is_ipv6=false;
116 ncbp.nativeClientInstance=chromeInstance;
117 ncbp.port=0;
118 nativeClientSocket->Bind(&ncbp, _FILE_AND_LINE_);
119 #elif defined(WINDOWS_STORE_RT)
120 RakAssert("TODO" && 0);
121 #else
122 if (r2->IsBerkleySocket())
123 {
124 RNS2_BerkleyBindParameters bbp;
125 bbp.port=0;
126 bbp.hostAddress=(char*)bindAddr;
127 bbp.addressFamily=AF_INET;
128 bbp.type=SOCK_DGRAM;
129 bbp.protocol=0;
130 bbp.nonBlockingSocket=true;
131 bbp.setBroadcast=true;
132 bbp.setIPHdrIncl=false;
133 bbp.doNotFragment=false;
134 bbp.pollingThreadPriority=0;
135 bbp.eventHandler=eventHandler;
136 bbp.remotePortRakNetWasStartedOn_PS3_PS4_PSP2=0;
137 RNS2BindResult br = ((RNS2_Berkley*) r2)->Bind(&bbp, _FILE_AND_LINE_);
138
139 if (br==BR_FAILED_TO_BIND_SOCKET)
140 {
141 RakNetSocket2Allocator::DeallocRNS2(r2);
142 return 0;
143 }
144 else if (br==BR_FAILED_SEND_TEST)
145 {
146 RakNetSocket2Allocator::DeallocRNS2(r2);
147 return 0;
148 }
149 else
150 {
151 RakAssert(br==BR_SUCCESS);
152 }
153
154 ((RNS2_Berkley*) r2)->CreateRecvPollingThread(0);
155 }
156 else
157 {
158 RakAssert("TODO" && 0);
159 }
160 #endif
161
162 return r2;
163
164 /*
165 #ifdef __native_client__
166 RakNetSocket2 *s = SocketLayer::CreateBoundSocket( 0, 0, false, bindAddr, true, 0, AF_INET, chromeInstance );
167 #else
168 RakNetSocket2 *s = SocketLayer::CreateBoundSocket( 0, 0, false, bindAddr, true, 0, AF_INET, 0 );
169 #endif
170
171 #ifdef _WIN32
172 unsigned long nonblocking = 1;
173 s->IOCTLSocket( FIONBIO, &nonblocking );
174 #elif defined(_PS3) || defined(__PS3__) || defined(SN_TARGET_PS3) || defined(_PS4) || defined(SN_TARGET_PSP2)
175 int sock_opt=1;
176 s->SetSockOpt(SOL_SOCKET, SO_NBIO, ( char * ) & sock_opt, sizeof ( sock_opt ) );
177 #elif defined(__native_client__)
178 // Nop
179 #else
180 s->Fcntl( F_SETFL, O_NONBLOCK );
181 #endif
182 return s;
183 */
184 }
185
186 /*
187 int SLNet::NatTypeRecvFrom(char *data, RakNetSocket2* socket, SystemAddress &sender, RNS2EventHandler *eventHandler)
188 {
189 #if defined(__native_client__)
190 RakAssert("TODO" && 0);
191 #elif defined(WINDOWS_STORE_RT)
192 RakAssert("TODO" && 0);
193 #else
194 if (socket->IsBerkleySocket())
195 {
196 RNS2RecvStruct *recvFromStruct;
197 recvFromStruct=AllocRNS2RecvStruct(_FILE_AND_LINE_);
198 if (recvFromStruct != NULL)
199 {
200 recvFromStruct->socket=this;
201 socket->RecvFromBlocking(recvFromStruct);
202 }
203 if (recvFromStruct->bytesRead>0)
204 {
205 sender = recvFromStruct->systemAddress;
206 }
207 return recvFromStruct->bytesRead;
208 }
209 return 0;
210 #endif
211 }
212 */
213
214 #endif // #if _RAKNET_SUPPORT_NatTypeDetectionServer==1 || _RAKNET_SUPPORT_NatTypeDetectionClient==1
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • AVLBalancedBinarySearchTree
DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType > Member List

This is the complete list of members for DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType >, including all inherited members.

Add(const BinarySearchTreeType &input) | DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType > |
DataStructures::BinarySearchTree::Add(const BinarySearchTreeType &input, const char *file, unsigned int line) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
AVLBalancedBinarySearchTree() | DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType > | inline
BinarySearchTree() | DataStructures::BinarySearchTree< BinarySearchTreeType > |
BinarySearchTree(const BinarySearchTree &original_type) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
BinarySearchTree_size | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
Clear(const char *file, unsigned int line) | DataStructures::BinarySearchTree< BinarySearchTreeType > | inline
Del(const BinarySearchTreeType &input) | DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType > |
DataStructures::BinarySearchTree::Del(const BinarySearchTreeType &input, const char *file, unsigned int line) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
direction | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
Direction_Types enum name | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
DisplayBreadthFirstSearch(BinarySearchTreeType *return_array) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
DisplayInorder(BinarySearchTreeType *return_array) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
DisplayPostorder(BinarySearchTreeType *return_array) | DataStructures::BinarySearchTree< BinarySearchTreeType > | inline
DisplayPostorderRecursive(node *current, BinarySearchTreeType *return_array, unsigned int &index) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
DisplayPreorder(BinarySearchTreeType *return_array) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
Find(const BinarySearchTreeType &element, node **parent) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
FindParent(const BinarySearchTreeType &element) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
FixTree(node *current) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
GetPointerToNode(const BinarySearchTreeType &element) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
Height(node *starting_node=0) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
HeightRecursive(node *current) | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
IsIn(const BinarySearchTreeType &input) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
LEFT enum value | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
NOT_FOUND enum value | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
operator=(BinarySearchTree< BinarySearchTreeType > &original_copy) | DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType > | inline
DataStructures::BinarySearchTree::operator=(const BinarySearchTree &original_copy) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
RIGHT enum value | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
root | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
ROOT enum value | DataStructures::BinarySearchTree< BinarySearchTreeType > | protected
Size(void) | DataStructures::BinarySearchTree< BinarySearchTreeType > |
~AVLBalancedBinarySearchTree() | DataStructures::AVLBalancedBinarySearchTree< BinarySearchTreeType > | virtual
~BinarySearchTree() | DataStructures::BinarySearchTree< BinarySearchTreeType > | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • DirectoryDeltaTransfer
SLNet::DirectoryDeltaTransfer Member List

This is the complete list of members for SLNet::DirectoryDeltaTransfer, including all inherited members.

AddUploadsFromSubdirectory(const char *subdir) | SLNet::DirectoryDeltaTransfer |
AllocatePacketUnified(unsigned dataSize) | SLNet::PluginInterface2 | protected
applicationDirectory | SLNet::DirectoryDeltaTransfer | protected
availableUploads | SLNet::DirectoryDeltaTransfer | protected
chunkSize | SLNet::DirectoryDeltaTransfer | protected
ClearUploads(void) | SLNet::DirectoryDeltaTransfer |
DeallocPacketUnified(Packet *packet) | SLNet::PluginInterface2 | protected
DirectoryDeltaTransfer() | SLNet::DirectoryDeltaTransfer |
DownloadFromSubdirectory(const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, SystemAddress host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel, FileListProgress *cb) | SLNet::DirectoryDeltaTransfer |
DownloadFromSubdirectory(FileList &localFiles, const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, SystemAddress host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel, FileListProgress *cb) | SLNet::DirectoryDeltaTransfer |
fileListTransfer | SLNet::DirectoryDeltaTransfer | protected
GenerateHashes(FileList &localFiles, const char *outputSubdir, bool prependAppDirToOutputSubdir) | SLNet::DirectoryDeltaTransfer |
GetMyGUIDUnified(void) const | SLNet::PluginInterface2 |
GetNumberOfFilesForUpload(void) const | SLNet::DirectoryDeltaTransfer |
GetRakPeerInterface(void) const | SLNet::PluginInterface2 | inline
incrementalReadInterface | SLNet::DirectoryDeltaTransfer | protected
OnAck(unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time) | SLNet::PluginInterface2 | inlinevirtual
OnAttach(void) | SLNet::PluginInterface2 | inlinevirtual
OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) | SLNet::PluginInterface2 | inlinevirtual
OnDetach(void) | SLNet::PluginInterface2 | inlinevirtual
OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) | SLNet::PluginInterface2 | inlinevirtual
OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) | SLNet::PluginInterface2 | inlinevirtual
OnDownloadRequest(Packet *packet) | SLNet::DirectoryDeltaTransfer | protected
OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason) | SLNet::PluginInterface2 | inlinevirtual
OnInternalPacket(InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend) | SLNet::PluginInterface2 | inlinevirtual
OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming) | SLNet::PluginInterface2 | inlinevirtual
OnPushBackPacket(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) | SLNet::PluginInterface2 | inlinevirtual
OnRakPeerShutdown(void) | SLNet::PluginInterface2 | inlinevirtual
OnRakPeerStartup(void) | SLNet::PluginInterface2 | inlinevirtual
OnReceive(Packet *packet) | SLNet::DirectoryDeltaTransfer | virtual
OnReliabilityLayerNotification(const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError) | SLNet::PluginInterface2 | inlinevirtual
orderingChannel | SLNet::DirectoryDeltaTransfer | protected
PluginInterface2() | SLNet::PluginInterface2 |
priority | SLNet::DirectoryDeltaTransfer | protected
PushBackPacketUnified(Packet *packet, bool pushAtHead) | SLNet::PluginInterface2 | protected
rakPeerInterface | SLNet::PluginInterface2 | protected
SendListUnified(const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast) | SLNet::PluginInterface2 | protected
SendUnified(const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast) | SLNet::PluginInterface2 | protected
SendUnified(const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast) | SLNet::PluginInterface2 | protected
SetApplicationDirectory(const char *pathToApplication) | SLNet::DirectoryDeltaTransfer |
SetDownloadRequestIncrementalReadInterface(IncrementalReadInterface *_incrementalReadInterface, unsigned int _chunkSize) | SLNet::DirectoryDeltaTransfer |
SetFileListTransferPlugin(FileListTransfer *flt) | SLNet::DirectoryDeltaTransfer |
SetRakPeerInterface(RakPeerInterface *ptr) | SLNet::PluginInterface2 |
SetTCPInterface(TCPInterface *ptr) | SLNet::PluginInterface2 |
SetUploadSendParameters(PacketPriority _priority, char _orderingChannel) | SLNet::DirectoryDeltaTransfer |
tcpInterface | SLNet::PluginInterface2 | protected
Update(void) | SLNet::PluginInterface2 | inlinevirtual
UsesReliabilityLayer(void) const | SLNet::PluginInterface2 | inlinevirtual
~DirectoryDeltaTransfer() | SLNet::DirectoryDeltaTransfer | virtual
~PluginInterface2() | SLNet::PluginInterface2 | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Itoa.h Source File

  • include
  • slikenet
Itoa.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __RAK_ITOA_H
12 #define __RAK_ITOA_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 char* Itoa( int value, char* result, int base );
19
20 #ifdef __cplusplus
21 }
22 #endif
23
24
25 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FileOperations.cpp Source File

  • src
FileOperations.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/FileOperations.h"
17 #if _RAKNET_SUPPORT_FileOperations==1
18 #include "slikenet/memoryoverride.h"
19 #include "slikenet/_FindFirst.h" // For linux
20 #include <stdio.h>
21 #include <string.h>
22 #ifdef _WIN32
23 // For mkdir
24 #include <direct.h>
25 #include <io.h>
26 #else
27 #include <sys/stat.h>
28 #include <unistd.h>
29 #include "slikenet/_FindFirst.h"
30 #endif
31 #include "errno.h"
32 #include "slikenet/linux_adapter.h"
33 #include "slikenet/osx_adapter.h"
34
35 #ifndef MAX_PATH
36 #define MAX_PATH 260
37 #endif
38
39 bool WriteFileWithDirectories( const char *path, char *data, unsigned dataLength )
40 {
41 int index;
42 FILE *fp;
43 char pathCopy[MAX_PATH];
44 int res;
45
46 if ( path == 0 || path[ 0 ] == 0 )
47 return false;
48
49 strcpy_s( pathCopy, path );
50
51 // Ignore first / if there is one
52 if (pathCopy[0])
53 {
54 index = 1;
55 while ( pathCopy[ index ] )
56 {
57 if ( pathCopy[ index ] == '/' || pathCopy[ index ] == '\\')
58 {
59 pathCopy[ index ] = 0;
60
61 #ifdef _WIN32
62 res = _mkdir( pathCopy );
63 #else
64
65 res = mkdir( pathCopy, 0744 );
66 #endif
67 if (res<0 && errno!=EEXIST && errno!=EACCES)
68 {
69 return false;
70 }
71
72 pathCopy[ index ] = '/';
73 }
74
75 index++;
76 }
77 }
78
79 if (data)
80 {
81 if ( fopen_s( &fp, path, "wb" ) != 0 )
82 {
83 return false;
84 }
85
86 fwrite( data, 1, dataLength, fp );
87
88 fclose( fp );
89 }
90 else
91 {
92 #ifdef _WIN32
93 res = _mkdir( pathCopy );
94 #else
95 res = mkdir( pathCopy, 0744 );
96 #endif
97
98 if (res<0 && errno!=EEXIST)
99 {
100 return false;
101 }
102 }
103
104 return true;
105 }
106 bool IsSlash(unsigned char c)
107 {
108 return c=='/' || c=='\\';
109 }
110
111 void AddSlash( char *input )
112 {
113 if (input==0 || input[0]==0)
114 return;
115
116 int lastCharIndex=(int) strlen(input)-1;
117 if (input[lastCharIndex]=='\\')
118 input[lastCharIndex]='/';
119 else if (input[lastCharIndex]!='/')
120 {
121 input[lastCharIndex+1]='/';
122 input[lastCharIndex+2]=0;
123 }
124 }
125 bool DirectoryExists(const char *directory)
126 {
127 _finddata_t fileInfo;
128 intptr_t dir;
129 char baseDirWithStars[560];
130 strcpy_s(baseDirWithStars, directory);
131 AddSlash(baseDirWithStars);
132 strcat_s(baseDirWithStars, "*.*");
133 dir=_findfirst(baseDirWithStars, &fileInfo );
134 if (dir==-1)
135 return false;
136 _findclose(dir);
137 return true;
138 }
139 void QuoteIfSpaces(char *str)
140 {
141 unsigned i;
142 bool hasSpace=false;
143 for (i=0; str[i]; i++)
144 {
145 if (str[i]==' ')
146 {
147 hasSpace=true;
148 break;
149 }
150 }
151 if (hasSpace)
152 {
153 int len=(int)strlen(str);
154 memmove(str+1, str, len);
155 str[0]='\"';
156 str[len]='\"';
157 str[len+1]=0;
158 }
159 }
160 unsigned int GetFileLength(const char *path)
161 {
162 FILE *fp;
163 if (fopen_s(&fp, path, "rb")!=0) return 0;
164 fseek(fp, 0, SEEK_END);
165 unsigned int fileLength = ftell(fp);
166 fclose(fp);
167 return fileLength;
168
169 }
170
171 #endif // _RAKNET_SUPPORT_FileOperations
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • FileListProgress
SLNet::FileListProgress Member List

This is the complete list of members for SLNet::FileListProgress, including all inherited members.

FileListProgress() | SLNet::FileListProgress | inline
OnAddFilesFromDirectoryStarted(FileList *fileList, char *dir) | SLNet::FileListProgress | inlinevirtual
OnDirectory(FileList *fileList, char *dir, unsigned int directoriesRemaining) | SLNet::FileListProgress | inlinevirtual
OnFile(FileList *fileList, char *dir, char *fileName, unsigned int fileSize) | SLNet::FileListProgress | inlinevirtual
OnFilePush(const char *fileName, unsigned int fileLengthBytes, unsigned int offset, unsigned int bytesBeingSent, bool done, SystemAddress targetSystem, unsigned short setId) | SLNet::FileListProgress | inlinevirtual
OnFilePushesComplete(SystemAddress systemAddress, unsigned short setId) | SLNet::FileListProgress | inlinevirtual
OnSendAborted(SystemAddress systemAddress) | SLNet::FileListProgress | inlinevirtual
~FileListProgress() | SLNet::FileListProgress | inlinevirtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • OrderedChannelHeap
  • HeapChannelAndData
DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData Member List

This is the complete list of members for DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData, including all inherited members.

channel | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData |
data | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData |
HeapChannelAndData() | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData | inline
HeapChannelAndData(const channel_key_type &_channel, const heap_data_type &_data) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >::HeapChannelAndData | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • Rackspace
SLNet::Rackspace Member List

This is the complete list of members for SLNet::Rackspace, including all inherited members.

AddEventCallback(Rackspace2EventCallback *callback) | SLNet::Rackspace |
AddOperation(RackspaceOperationType type, SLNet::RakString httpCommand, SLNet::RakString operation, SLNet::RakString xml) | SLNet::Rackspace |
apiAccessKey | SLNet::Rackspace | protected
Authenticate(TCPInterface *_tcpInterface, const char *_authenticationURL, const char *_rackspaceCloudUsername, const char *_apiAccessKey) | SLNet::Rackspace |
authToken | SLNet::Rackspace | protected
cdnManagementDomain | SLNet::Rackspace | protected
cdnManagementPath | SLNet::Rackspace | protected
cdnManagementURL | SLNet::Rackspace | protected
ClearEventCallbacks(void) | SLNet::Rackspace |
ConfirmResizedServer(SLNet::RakString serverId) | SLNet::Rackspace |
ConnectToServerManagementDomain(RackspaceOperation &ro) | SLNet::Rackspace | protected
CreateImage(SLNet::RakString serverId, SLNet::RakString imageName) | SLNet::Rackspace |
CreateServer(SLNet::RakString name, SLNet::RakString imageId, SLNet::RakString flavorId) | SLNet::Rackspace |
CreateSharedIPGroup(SLNet::RakString name, SLNet::RakString optionalServerId) | SLNet::Rackspace |
DeleteImage(SLNet::RakString imageId) | SLNet::Rackspace |
DeleteServer(SLNet::RakString serverId) | SLNet::Rackspace |
DeleteServerAddress(SLNet::RakString serverId, SLNet::RakString ipAddress) | SLNet::Rackspace |
DeleteSharedIPGroup(SLNet::RakString groupId) | SLNet::Rackspace |
eventCallbacks | SLNet::Rackspace | protected
EventTypeToString(RackspaceEventType eventType) | SLNet::Rackspace | static
ExecuteOperation(RackspaceOperation &ro) | SLNet::Rackspace | protected
GetFlavorDetails(SLNet::RakString flavorId) | SLNet::Rackspace |
GetImageDetails(SLNet::RakString imageId) | SLNet::Rackspace |
GetOperationOfTypeIndex(RackspaceOperationType t) | SLNet::Rackspace | protected
GetServerDetails(SLNet::RakString serverId) | SLNet::Rackspace |
GetSharedIPGroupDetails(SLNet::RakString groupId) | SLNet::Rackspace |
HasOperationOfType(RackspaceOperationType t) | SLNet::Rackspace | protected
ListFlavors(void) | SLNet::Rackspace |
ListImages(void) | SLNet::Rackspace |
ListServerAddresses(SLNet::RakString serverId) | SLNet::Rackspace |
ListServers(void) | SLNet::Rackspace |
ListServersWithDetails(void) | SLNet::Rackspace |
ListSharedIPGroups(void) | SLNet::Rackspace |
ListSharedIPGroupsWithDetails(void) | SLNet::Rackspace |
OnClosedConnection(SystemAddress systemAddress) | SLNet::Rackspace |
OnReceive(Packet *packet) | SLNet::Rackspace |
operations | SLNet::Rackspace | protected
Rackspace() | SLNet::Rackspace |
rackspaceCloudUsername | SLNet::Rackspace | protected
ReadLine(const char *data, const char *stringStart, SLNet::RakString &output) | SLNet::Rackspace | protected
RebootServer(SLNet::RakString serverId, SLNet::RakString rebootType) | SLNet::Rackspace |
RebuildServer(SLNet::RakString serverId, SLNet::RakString imageId) | SLNet::Rackspace |
RemoveEventCallback(Rackspace2EventCallback *callback) | SLNet::Rackspace |
ResizeServer(SLNet::RakString serverId, SLNet::RakString flavorId) | SLNet::Rackspace |
RevertResizedServer(SLNet::RakString serverId) | SLNet::Rackspace |
serverManagementDomain | SLNet::Rackspace | protected
serverManagementPath | SLNet::Rackspace | protected
serverManagementURL | SLNet::Rackspace | protected
ShareServerAddress(SLNet::RakString serverId, SLNet::RakString ipAddress) | SLNet::Rackspace |
storageDomain | SLNet::Rackspace | protected
storagePath | SLNet::Rackspace | protected
storageToken | SLNet::Rackspace | protected
storageURL | SLNet::Rackspace | protected
tcpInterface | SLNet::Rackspace | protected
UpdateServerNameOrPassword(SLNet::RakString serverId, SLNet::RakString newName, SLNet::RakString newPassword) | SLNet::Rackspace |
~Rackspace() | SLNet::Rackspace |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_HuffmanEncodingTree.h Source File

  • include
  • slikenet
DS_HuffmanEncodingTree.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #ifndef __HUFFMAN_ENCODING_TREE
22 #define __HUFFMAN_ENCODING_TREE
23
24 #include "memoryoverride.h"
25 #include "DS_HuffmanEncodingTreeNode.h"
26 #include "BitStream.h"
27 #include "Export.h"
28 #include "DS_LinkedList.h"
29
30 namespace SLNet
31 {
32
34 class RAK_DLL_EXPORT HuffmanEncodingTree
35 {
36
37 public:
38 HuffmanEncodingTree();
39 ~HuffmanEncodingTree();
40
45 void EncodeArray( unsigned char *input, size_t sizeInBytes, SLNet::BitStream * output );
46
47 // \brief Decodes an array encoded by EncodeArray().
48 unsigned DecodeArray(SLNet::BitStream * input, BitSize_t sizeInBits, size_t maxCharsToWrite, unsigned char *output );
49 void DecodeArray( unsigned char *input, BitSize_t sizeInBits, SLNet::BitStream * output );
50
52 void GenerateFromFrequencyTable( unsigned int frequencyTable[ 256 ] );
53
55 void FreeMemory( void );
56
57 private:
58
60
61 HuffmanEncodingTreeNode *root;
62
64
65
66 struct CharacterEncoding
67 {
68 unsigned char* encoding;
69 unsigned short bitLength;
70 };
71
72 CharacterEncoding encodingTable[ 256 ];
73
74 void InsertNodeIntoSortedList( HuffmanEncodingTreeNode * node, DataStructures::LinkedList<HuffmanEncodingTreeNode *> *huffmanEncodingTreeNodeList ) const;
75 };
76
77 } // namespace SLNet
78
79 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakPeer
  • RequestedConnectionStruct
SLNet::RakPeer::RequestedConnectionStruct Member List

This is the complete list of members for SLNet::RakPeer::RequestedConnectionStruct, including all inherited members.

actionToTake | SLNet::RakPeer::RequestedConnectionStruct
CONNECT enum value | SLNet::RakPeer::RequestedConnectionStruct
data | SLNet::RakPeer::RequestedConnectionStruct
dataLength | SLNet::RakPeer::RequestedConnectionStruct
extraData | SLNet::RakPeer::RequestedConnectionStruct
nextRequestTime | SLNet::RakPeer::RequestedConnectionStruct
outgoingPassword | SLNet::RakPeer::RequestedConnectionStruct
outgoingPasswordLength | SLNet::RakPeer::RequestedConnectionStruct
publicKeyMode | SLNet::RakPeer::RequestedConnectionStruct
requestsMade | SLNet::RakPeer::RequestedConnectionStruct
sendConnectionAttemptCount | SLNet::RakPeer::RequestedConnectionStruct
socket | SLNet::RakPeer::RequestedConnectionStruct
socketIndex | SLNet::RakPeer::RequestedConnectionStruct
systemAddress | SLNet::RakPeer::RequestedConnectionStruct
timeBetweenSendConnectionAttemptsMS | SLNet::RakPeer::RequestedConnectionStruct
timeoutTime | SLNet::RakPeer::RequestedConnectionStruct
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • NetworkIDObject
SLNet::NetworkIDObject Member List

This is the complete list of members for SLNet::NetworkIDObject, including all inherited members.

GetNetworkID(void) | SLNet::NetworkIDObject | virtual
GetNetworkIDManager(void) const | SLNet::NetworkIDObject | virtual
GetParent(void) const | SLNet::NetworkIDObject | virtual
networkID | SLNet::NetworkIDObject | protected
networkIDManager | SLNet::NetworkIDObject | protected
NetworkIDObject() | SLNet::NetworkIDObject |
nextInstanceForNetworkIDManager | SLNet::NetworkIDObject | protected
parent | SLNet::NetworkIDObject | protected
SetNetworkID(NetworkID id) | SLNet::NetworkIDObject | virtual
SetNetworkIDManager(NetworkIDManager *manager) | SLNet::NetworkIDObject | virtual
SetParent(void *_parent) | SLNet::NetworkIDObject | virtual
~NetworkIDObject() | SLNet::NetworkIDObject | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TeamManager.h Source File

  • include
  • slikenet
TeamManager.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 // TODO: optimize the list of teams and team members to be O(1). Store in hashes, use linked lists to get ordered traversal
17
25
26
27 #include "NativeFeatureIncludes.h"
28 #if _RAKNET_SUPPORT_TeamManager==1
29
30 #ifndef __TEAM_MANAGER_H
31 #define __TEAM_MANAGER_H
32
33 #include "PluginInterface2.h"
34 #include "memoryoverride.h"
35 #include "NativeTypes.h"
36 #include "DS_List.h"
37 #include "types.h"
38 #include "DS_Hash.h"
39 #include "DS_OrderedList.h"
40
41 namespace SLNet
42 {
44 class RakPeerInterface;
45
50
53 typedef unsigned char NoTeamId;
54
57 typedef uint8_t WorldId;
58
61 typedef uint16_t TeamMemberLimit;
62
64 #define ALLOW_JOIN_ANY_AVAILABLE_TEAM (1<<0)
65
66 #define ALLOW_JOIN_SPECIFIC_TEAM (1<<1)
67
68 #define ALLOW_JOIN_REBALANCING (1<<2)
69
70 // Bitwise combination of ALLOW_JOIN_ANY_AVAILABLE_TEAM, ALLOW_JOIN_SPECIFIC_TEAM, ALLOW_JOIN_REBALANCING
71 typedef uint8_t JoinPermissions;
72
73 // Forward declarations
74 class TM_Team;
75 class TM_TeamMember;
76 class TM_World;
77 class TeamManager;
78
80 enum JoinTeamType
81 {
83 JOIN_ANY_AVAILABLE_TEAM,
85 JOIN_SPECIFIC_TEAM,
87 JOIN_NO_TEAM
88 };
89
91 enum TMTopology
92 {
93 // Each system will send all messages to all participants
94 TM_PEER_TO_PEER,
95
96 // The host will relay incoming messages to all participants
97 TM_CLIENT_SERVER,
98 };
99
103 struct TeamSelection
104 {
105 TeamSelection();
106 TeamSelection(JoinTeamType itt);
107 TeamSelection(JoinTeamType itt, TM_Team *param);
108 TeamSelection(JoinTeamType itt, NoTeamId param);
109 JoinTeamType joinTeamType;
110
111 union
112 {
113 TM_Team *specificTeamToJoin;
114 NoTeamId noTeamSubcategory;
115 } teamParameter;
116
119 static TeamSelection AnyAvailable(void);
123 static TeamSelection SpecificTeam(TM_Team *specificTeamToJoin);
127 static TeamSelection NoTeam(NoTeamId noTeamSubcategory);
128 };
129
136 class RAK_DLL_EXPORT TM_TeamMember
137 {
138 public:
139 // GetInstance() and DestroyInstance(instance*)
140 STATIC_FACTORY_DECLARATIONS(TM_TeamMember)
141
142 TM_TeamMember();
143 virtual ~TM_TeamMember();
144
153 bool RequestTeam(TeamSelection teamSelection);
154
159 bool RequestTeamSwitch(TM_Team *teamToJoin, TM_Team *teamToLeave);
160
163 TeamSelection GetRequestedTeam(void) const;
164
167 void GetRequestedSpecificTeams(DataStructures::List<TM_Team*> &requestedTeams) const;
168
172 bool HasRequestedTeam(TM_Team *team) const;
173
177 unsigned int GetRequestedTeamIndex(TM_Team *team) const;
178
180 unsigned int GetRequestedTeamCount(void) const;
181
187 bool CancelTeamRequest(TM_Team *specificTeamToCancel);
188
196 bool LeaveTeam(TM_Team* team, NoTeamId _noTeamSubcategory);
197
202 bool LeaveAllTeams(NoTeamId inNoTeamSubcategory);
203
205 TM_Team* GetCurrentTeam(void) const;
206
208 unsigned int GetCurrentTeamCount(void) const;
209
211 TM_Team* GetCurrentTeamByIndex(unsigned int index);
212
214 void GetCurrentTeams(DataStructures::List<TM_Team*> &_teams) const;
215
219 void GetLastTeams(DataStructures::List<TM_Team*> &_teams) const;
220
223 bool IsOnTeam(TM_Team *team) const;
224
226 NetworkID GetNetworkID(void) const;
227
229 TM_World* GetTM_World(void) const;
230
237 void SerializeConstruction(BitStream *constructionBitstream);
238
244 bool DeserializeConstruction(TeamManager *teamManager, BitStream *constructionBitstream);
245
247 void SetOwner(void *o);
248
250 void *GetOwner(void) const;
251
253 NoTeamId GetNoTeamId(void) const;
254
256 unsigned int GetWorldIndex(void) const;
257
259 static unsigned long ToUint32( const NetworkID &g );
260
262 struct RequestedTeam
263 {
264 SLNet::Time whenRequested;
265 unsigned int requestIndex;
266 TM_Team *requested;
267 bool isTeamSwitch;
268 TM_Team *teamToLeave;
269 };
270
271 protected:
272 NetworkID networkId;
273 TM_World* world;
274 // Teams we are a member of. We can be on more than one team, but not on the same team more than once
275 DataStructures::List<TM_Team*> teams;
276 // If teams is empty, which subcategory of noTeam we are on
277 NoTeamId noTeamSubcategory;
278 // Teams we have requested to join. Mutually exclusive with teams we are already on. Cannot request the same team more than once.
279 DataStructures::List<RequestedTeam> teamsRequested;
280 // If teamsRequested is not empty, we want to join a specific team
281 // If teamsRequested is empty, then joinTeamType is either JOIN_NO_TEAM or JOIN_ANY_AVAILABLE_TEAM
282 JoinTeamType joinTeamType;
283 // Set by StoreLastTeams()
284 DataStructures::List<TM_Team*> lastTeams;
285 SLNet::Time whenJoinAnyRequested;
286 unsigned int joinAnyRequestIndex;
287 void *owner;
288
289 // Remove from all requested and current teams.
290 void UpdateListsToNoTeam(NoTeamId nti);
291 bool JoinAnyTeamCheck(void) const;
292 bool JoinSpecificTeamCheck(TM_Team *specificTeamToJoin, bool ignoreRequested) const;
293 bool SwitchSpecificTeamCheck(TM_Team *teamToJoin, TM_Team *teamToLeave, bool ignoreRequested) const;
294 bool LeaveTeamCheck(TM_Team *team) const;
295 void UpdateTeamsRequestedToAny(void);
296 void UpdateTeamsRequestedToNone(void);
297 void AddToRequestedTeams(TM_Team *teamToJoin);
298 void AddToRequestedTeams(TM_Team *teamToJoin, TM_Team *teamToLeave);
299 bool RemoveFromRequestedTeams(TM_Team *team);
300 void AddToTeamList(TM_Team *team);
301 void RemoveFromSpecificTeamInternal(TM_Team *team);
302 void RemoveFromAllTeamsInternal(void);
303 void StoreLastTeams(void);
304
305 friend class TM_World;
306 friend class TM_Team;
307 friend class TeamManager;
308 };
309
316 class RAK_DLL_EXPORT TM_Team
317 {
318 public:
319 // GetInstance() and DestroyInstance(instance*)
320 STATIC_FACTORY_DECLARATIONS(TM_Team)
321
322 TM_Team();
323 virtual ~TM_Team();
324
332 bool SetMemberLimit(TeamMemberLimit _teamMemberLimit, NoTeamId noTeamSubcategory);
333
335 TeamMemberLimit GetMemberLimit(void) const;
336
338 TeamMemberLimit GetMemberLimitSetting(void) const;
339
347 bool SetJoinPermissions(JoinPermissions _joinPermissions);
348
350 JoinPermissions GetJoinPermissions(void) const;
351
356 void LeaveTeam(TM_TeamMember* teamMember, NoTeamId noTeamSubcategory);
357
359 bool GetBalancingApplies(void) const;
360
362 void GetTeamMembers(DataStructures::List<TM_TeamMember*> &_teamMembers) const;
363
365 unsigned int GetTeamMembersCount(void) const;
366
369 TM_TeamMember *GetTeamMemberByIndex(unsigned int index) const;
370
372 NetworkID GetNetworkID(void) const;
373
375 TM_World* GetTM_World(void) const;
376
380 void SerializeConstruction(BitStream *constructionBitstream);
381
385 bool DeserializeConstruction(TeamManager *teamManager, BitStream *constructionBitstream);
386
388 void SetOwner(void *o);
389
391 void *GetOwner(void) const;
392
394 unsigned int GetWorldIndex(void) const;
395
397 static unsigned long ToUint32( const NetworkID &g );
398
399 protected:
400 NetworkID ID;
401 TM_World* world;
402 // Which members are on this team. The same member cannot be on the same team more than once
403 DataStructures::List<TM_TeamMember*> teamMembers;
404 // Permissions on who can join this team
405 JoinPermissions joinPermissions;
406 // Whether or not to consider this team when balancing teams
407 bool balancingApplies;
408 TeamMemberLimit teamMemberLimit;
409 void *owner;
410
411 // Remove input from list teamMembers
412 void RemoveFromTeamMemberList(TM_TeamMember *teamMember);
413
414 // Find the member index that wants to join the indicated team, is only on one team, and wants to leave that team
415 unsigned int GetMemberWithRequestedSingleTeamSwitch(TM_Team *team);
416
417
418 friend class TM_World;
419 friend class TM_TeamMember;
420 friend class TeamManager;
421 };
422
427 class TM_World
428 {
429 public:
430 TM_World();
431 virtual ~TM_World();
432
434 TeamManager *GetTeamManager(void) const;
435
438 void AddParticipant(RakNetGUID rakNetGUID);
439
443 void RemoveParticipant(RakNetGUID rakNetGUID);
444
448 void SetAutoManageConnections(bool autoAdd);
449
452 void GetParticipantList(DataStructures::List<RakNetGUID> &participantList);
453
461 void ReferenceTeam(TM_Team *team, NetworkID networkId, bool applyBalancing);
462
467 void DereferenceTeam(TM_Team *team, NoTeamId noTeamSubcategory);
468
470 unsigned int GetTeamCount(void) const;
471
474 TM_Team *GetTeamByIndex(unsigned int index) const;
475
478 TM_Team *GetTeamByNetworkID(NetworkID teamId);
479
483 unsigned int GetTeamIndex(const TM_Team *team) const;
484
491 void ReferenceTeamMember(TM_TeamMember *teamMember, NetworkID networkId);
492
496 void DereferenceTeamMember(TM_TeamMember *teamMember);
497
499 unsigned int GetTeamMemberCount(void) const;
500
503 TM_TeamMember *GetTeamMemberByIndex(unsigned int index) const;
504
507 NetworkID GetTeamMemberIDByIndex(unsigned int index) const;
508
511 TM_TeamMember *GetTeamMemberByNetworkID(NetworkID teamMemberId);
512
516 unsigned int GetTeamMemberIndex(const TM_TeamMember *teamMember) const;
517
525 bool SetBalanceTeams(bool balanceTeams, NoTeamId noTeamSubcategory);
526
528 bool GetBalanceTeams(void) const;
529
536 void SetHost(RakNetGUID _hostGuid);
537
539 RakNetGUID GetHost(void) const;
540
542 WorldId GetWorldId(void) const;
543
546 void Clear(void);
547
549 struct JoinRequestHelper
550 {
551 SLNet::Time whenRequestMade;
552 unsigned int teamMemberIndex;
553 unsigned int indexIntoTeamsRequested;
554 unsigned int requestIndex;
555 };
557 static int JoinRequestHelperComp(const TM_World::JoinRequestHelper &key, const TM_World::JoinRequestHelper &data);
558
559 protected:
560 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
561 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
562
563 // Teams with too many members have those members go to other teams.
564 void EnforceTeamBalance(NoTeamId noTeamSubcategory);
565 void KickExcessMembers(NoTeamId noTeamSubcategory);
566 void FillRequestedSlots(void);
567 unsigned int GetAvailableTeamIndexWithFewestMembers(TeamMemberLimit secondaryLimit, JoinPermissions joinPermissions);
568
569 void GetSortedJoinRequests(DataStructures::OrderedList<JoinRequestHelper, JoinRequestHelper, JoinRequestHelperComp> &joinRequests);
570
571
572 // Send a message to all participants
573 void BroadcastToParticipants(SLNet::BitStream *bsOut, RakNetGUID exclusionGuid);
574 void BroadcastToParticipants(unsigned char *data, const int length, RakNetGUID exclusionGuid);
575
576 // 1. If can join a team:
577 // A. teamMember->UpdateTeamsRequestedToNone();
578 // B. teamMember->AddToTeamList()
579 // C. Return new team
580 // 2. Else return 0
581 TM_Team* JoinAnyTeam(TM_TeamMember *teamMember, int *resultCode);
582
583 int JoinSpecificTeam(TM_TeamMember *teamMember, TM_Team *team, bool isTeamSwitch, TM_Team *teamToLeave, DataStructures::List<TM_Team*> &teamsWeAreLeaving);
584
585 TeamMemberLimit GetBalancedTeamLimit(void) const;
586
587 // For fast lookup. Shares pointers with list teams
588 DataStructures::Hash<NetworkID, TM_Team*, 256, TM_Team::ToUint32> teamsHash;
589 // For fast lookup. Shares pointers with list teamMembers
590 DataStructures::Hash<NetworkID, TM_TeamMember*, 256, TM_TeamMember::ToUint32> teamMembersHash;
591
592 TeamManager *teamManager;
593 DataStructures::List<RakNetGUID> participants;
594 DataStructures::List<TM_Team*> teams;
595 DataStructures::List<TM_TeamMember*> teamMembers;
596 bool balanceTeamsIsActive;
597 RakNetGUID hostGuid;
598 WorldId worldId;
599 bool autoAddParticipants;
600 int teamRequestIndex;
601
602 friend class TeamManager;
603 friend class TM_TeamMember;
604 friend class TM_Team;
605 };
606
626 class RAK_DLL_EXPORT TeamManager : public PluginInterface2
627 {
628 public:
629 // GetInstance() and DestroyInstance(instance*)
630 STATIC_FACTORY_DECLARATIONS(TeamManager)
631
632 TeamManager();
633 virtual ~TeamManager();
634
639 TM_World* AddWorld(WorldId worldId);
640
643 void RemoveWorld(WorldId worldId);
644
646 unsigned int GetWorldCount(void) const;
647
650 TM_World* GetWorldAtIndex(unsigned int index) const;
651
654 TM_World* GetWorldWithId(WorldId worldId) const;
655
660 void SetAutoManageConnections(bool autoAdd);
661
667 void SetTopology(TMTopology _topology);
668
672 void DecomposeTeamFull(Packet *packet,
673 TM_World **world, TM_TeamMember **teamMember, TM_Team **team,
674 uint16_t &currentMembers, uint16_t &memberLimitIncludingBalancing, bool &balancingIsActive, JoinPermissions &joinPermissions);
675
679 void DecomposeTeamLocked(Packet *packet,
680 TM_World **world, TM_TeamMember **teamMember, TM_Team **team,
681 uint16_t &currentMembers, uint16_t &memberLimitIncludingBalancing, bool &balancingIsActive, JoinPermissions &joinPermissions);
682
685 void Clear(void);
686
692 void DecodeTeamAssigned(Packet *packet, TM_World **world, TM_TeamMember **teamMember);
693
694 // \brief Reads out the world and teamMember from ID_TEAM_BALANCER_TEAM_REQUESTED_CANCELLED
700 void DecodeTeamCancelled(Packet *packet, TM_World **world, TM_TeamMember **teamMember, TM_Team **teamCancelled);
701
702 protected:
703
704 virtual void Update(void);
705 virtual PluginReceiveResult OnReceive(Packet *packet);
706 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
707 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
708 void Send( const SLNet::BitStream * bitStream, const AddressOrGUID systemIdentifier, bool broadcast );
709
710 void EncodeTeamFullOrLocked(SLNet::BitStream *bitStream, TM_TeamMember *teamMember, TM_Team *team);
711 void DecomposeTeamFullOrLocked(SLNet::BitStream *bsIn, TM_World **world, TM_TeamMember **teamMember, TM_Team **team,
712 uint16_t &currentMembers, uint16_t &memberLimitIncludingBalancing, bool &balancingIsActive, JoinPermissions &joinPermissions);
713 void ProcessTeamAssigned(SLNet::BitStream *bsIn);
714
715 void EncodeTeamAssigned(SLNet::BitStream *bitStream, TM_TeamMember *teamMember);
716 void RemoveFromTeamsRequestedAndAddTeam(TM_TeamMember *teamMember, TM_Team *team, bool isTeamSwitch, TM_Team *teamToLeave);
717
718 void PushTeamAssigned(TM_TeamMember *teamMember);
719 void PushBitStream(SLNet::BitStream *bitStream);
720 void OnUpdateListsToNoTeam(Packet *packet, TM_World *world);
721 void OnUpdateTeamsRequestedToAny(Packet *packet, TM_World *world);
722 void OnJoinAnyTeam(Packet *packet, TM_World *world);
723 void OnJoinRequestedTeam(Packet *packet, TM_World *world);
724 void OnUpdateTeamsRequestedToNoneAndAddTeam(Packet *packet, TM_World *world);
725 void OnRemoveFromTeamsRequestedAndAddTeam(Packet *packet, TM_World *world);
726 void OnAddToRequestedTeams(Packet *packet, TM_World *world);
727 bool OnRemoveFromRequestedTeams(Packet *packet, TM_World *world);
728 void OnLeaveTeam(Packet *packet, TM_World *world);
729 void OnSetMemberLimit(Packet *packet, TM_World *world);
730 void OnSetJoinPermissions(Packet *packet, TM_World *world);
731 void OnSetBalanceTeams(Packet *packet, TM_World *world);
732 void OnSetBalanceTeamsInitial(Packet *packet, TM_World *world);
733
734
735 void EncodeTeamFull(SLNet::BitStream *bitStream, TM_TeamMember *teamMember, TM_Team *team);
736 void EncodeTeamLocked(SLNet::BitStream *bitStream, TM_TeamMember *teamMember, TM_Team *team);
737
741 void DecodeTeamAssigned(SLNet::BitStream *bsIn, TM_World **world, TM_TeamMember **teamMember, NoTeamId &noTeamSubcategory,
742 JoinTeamType &joinTeamType, DataStructures::List<TM_Team *> &newTeam,
743 DataStructures::List<TM_Team *> &teamsLeft, DataStructures::List<TM_Team *> &teamsJoined);
744
745 // O(1) lookup for a given world. If I need more worlds, change this to a hash or ordered list
746 TM_World *worldsArray[255];
747 // All allocated worlds for linear traversal
748 DataStructures::List<TM_World*> worldsList;
749 bool autoAddParticipants;
750 TMTopology topology;
751
752 friend class TM_TeamMember;
753 friend class TM_World;
754 friend class TM_Team;
755 };
756
757 } // namespace SLNet
758
759 #endif // __TEAM_MANAGER_H
760
761 #endif // _RAKNET_SUPPORT_*
762
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/DS_Map.h Source File

  • include
  • slikenet
DS_Map.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __RAKNET_MAP_H
23 #define __RAKNET_MAP_H
24
25 #include "DS_OrderedList.h"
26 #include "Export.h"
27 #include "memoryoverride.h"
28 #include "assert.h"
29
30 // If I want to change this to a red-black tree, this is a good site: http://www.cs.auckland.ac.nz/software/AlgAnim/red_black.html
31 // This makes insertions and deletions faster. But then traversals are slow, while they are currently fast.
32
35 namespace DataStructures
36 {
39 template <class key_type>
40 int defaultMapKeyComparison(const key_type &a, const key_type &b)
41 {
42 if (a<b) return -1; if (a==b) return 0; return 1;
43 }
44
46 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&, const key_type&)=defaultMapKeyComparison<key_type> >
47 class RAK_DLL_EXPORT Map
48 {
49 public:
50 static void IMPLEMENT_DEFAULT_COMPARISON(void) {DataStructures::defaultMapKeyComparison<key_type>(key_type(),key_type());}
51
52 struct MapNode
53 {
54 MapNode() {}
55 MapNode(key_type _key, data_type _data) : mapNodeKey(_key), mapNodeData(_data) {}
56 MapNode& operator = ( const MapNode& input ) {mapNodeKey=input.mapNodeKey; mapNodeData=input.mapNodeData; return *this;}
57 MapNode( const MapNode & input) {mapNodeKey=input.mapNodeKey; mapNodeData=input.mapNodeData;}
58 key_type mapNodeKey;
59 data_type mapNodeData;
60 };
61
62 // Has to be a static because the comparison callback for DataStructures::OrderedList is a C function
63 static int NodeComparisonFunc(const key_type &a, const MapNode &b)
64 {
65 return key_comparison_func(a, b.mapNodeKey);
66 }
67
68 Map();
69 ~Map();
70 Map( const Map& original_copy );
71 Map& operator= ( const Map& original_copy );
72
73 data_type& Get(const key_type &key) const;
74 data_type Pop(const key_type &key);
75 // Add if needed
76 void Set(const key_type &key, const data_type &data);
77 // Must already exist
78 void SetExisting(const key_type &key, const data_type &data);
79 // Must add
80 void SetNew(const key_type &key, const data_type &data);
81 bool Has(const key_type &key) const;
82 bool Delete(const key_type &key);
83 data_type& operator[] ( const unsigned int position ) const;
84 key_type GetKeyAtIndex( const unsigned int position ) const;
85 unsigned GetIndexAtKey( const key_type &key );
86 void RemoveAtIndex(const unsigned index);
87 void Clear(void);
88 unsigned Size(void) const;
89
90 protected:
91 DataStructures::OrderedList< key_type,MapNode,&Map::NodeComparisonFunc > mapNodeList;
92
93 void SaveLastSearch(const key_type &key, unsigned index) const;
94 bool HasSavedSearchResult(const key_type &key) const;
95
96 unsigned lastSearchIndex;
97 key_type lastSearchKey;
98 bool lastSearchIndexValid;
99 };
100
101 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
102 Map<key_type, data_type, key_comparison_func>::Map()
103 {
104 lastSearchIndexValid=false;
105 }
106
107 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
108 Map<key_type, data_type, key_comparison_func>::~Map()
109 {
110 Clear();
111 }
112
113 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
114 Map<key_type, data_type, key_comparison_func>::Map( const Map& original_copy )
115 {
116 mapNodeList=original_copy.mapNodeList;
117 lastSearchIndex=original_copy.lastSearchIndex;
118 lastSearchKey=original_copy.lastSearchKey;
119 lastSearchIndexValid=original_copy.lastSearchIndexValid;
120 }
121
122 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
123 Map<key_type, data_type, key_comparison_func>& Map<key_type, data_type, key_comparison_func>::operator= ( const Map& original_copy )
124 {
125 mapNodeList=original_copy.mapNodeList;
126 lastSearchIndex=original_copy.lastSearchIndex;
127 lastSearchKey=original_copy.lastSearchKey;
128 lastSearchIndexValid=original_copy.lastSearchIndexValid;
129 return *this;
130 }
131
132 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
133 data_type& Map<key_type, data_type, key_comparison_func>::Get(const key_type &key) const
134 {
135 if (HasSavedSearchResult(key))
136 return mapNodeList[lastSearchIndex].mapNodeData;
137
138 bool objectExists;
139 unsigned index;
140 index=mapNodeList.GetIndexFromKey(key, &objectExists);
141 RakAssert(objectExists);
142 SaveLastSearch(key,index);
143 return mapNodeList[index].mapNodeData;
144 }
145
146 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
147 unsigned Map<key_type, data_type, key_comparison_func>::GetIndexAtKey( const key_type &key )
148 {
149 if (HasSavedSearchResult(key))
150 return lastSearchIndex;
151
152 bool objectExists;
153 unsigned index;
154 index=mapNodeList.GetIndexFromKey(key, &objectExists);
155 if (objectExists==false)
156 {
157 RakAssert(objectExists);
158 }
159 SaveLastSearch(key,index);
160 return index;
161 }
162
163 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
164 void Map<key_type, data_type, key_comparison_func>::RemoveAtIndex(const unsigned index)
165 {
166 mapNodeList.RemoveAtIndex(index);
167 lastSearchIndexValid=false;
168 }
169
170 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
171 data_type Map<key_type, data_type, key_comparison_func>::Pop(const key_type &key)
172 {
173 bool objectExists;
174 unsigned index;
175 if (HasSavedSearchResult(key))
176 index=lastSearchIndex;
177 else
178 {
179 index=mapNodeList.GetIndexFromKey(key, &objectExists);
180 RakAssert(objectExists);
181 }
182 data_type tmp = mapNodeList[index].mapNodeData;
183 mapNodeList.RemoveAtIndex(index);
184 lastSearchIndexValid=false;
185 return tmp;
186 }
187
188 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
189 void Map<key_type, data_type, key_comparison_func>::Set(const key_type &key, const data_type &data)
190 {
191 bool objectExists;
192 unsigned index;
193
194 if (HasSavedSearchResult(key))
195 {
196 mapNodeList[lastSearchIndex].mapNodeData=data;
197 return;
198 }
199
200 index=mapNodeList.GetIndexFromKey(key, &objectExists);
201
202 if (objectExists)
203 {
204 SaveLastSearch(key,index);
205 mapNodeList[index].mapNodeData=data;
206 }
207 else
208 {
209 SaveLastSearch(key,mapNodeList.Insert(key,MapNode(key,data), true, _FILE_AND_LINE_));
210 }
211 }
212
213 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
214 void Map<key_type, data_type, key_comparison_func>::SetExisting(const key_type &key, const data_type &data)
215 {
216 bool objectExists;
217 unsigned index;
218
219 if (HasSavedSearchResult(key))
220 {
221 index=lastSearchIndex;
222 }
223 else
224 {
225 index=mapNodeList.GetIndexFromKey(key, &objectExists);
226 RakAssert(objectExists);
227 SaveLastSearch(key,index);
228 }
229
230 mapNodeList[index].mapNodeData=data;
231 }
232
233 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
234 void Map<key_type, data_type, key_comparison_func>::SetNew(const key_type &key, const data_type &data)
235 {
236 #ifdef _DEBUG
237 bool objectExists;
238 mapNodeList.GetIndexFromKey(key, &objectExists);
239 RakAssert(objectExists==false);
240 #endif
241 SaveLastSearch(key,mapNodeList.Insert(key,MapNode(key,data), true, _FILE_AND_LINE_));
242 }
243
244 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
245 bool Map<key_type, data_type, key_comparison_func>::Has(const key_type &key) const
246 {
247 if (HasSavedSearchResult(key))
248 return true;
249
250 bool objectExists;
251 unsigned index;
252 index=mapNodeList.GetIndexFromKey(key, &objectExists);
253 if (objectExists)
254 SaveLastSearch(key,index);
255 return objectExists;
256 }
257
258 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
259 bool Map<key_type, data_type, key_comparison_func>::Delete(const key_type &key)
260 {
261 if (HasSavedSearchResult(key))
262 {
263 lastSearchIndexValid=false;
264 mapNodeList.RemoveAtIndex(lastSearchIndex);
265 return true;
266 }
267
268 bool objectExists;
269 unsigned index;
270 index=mapNodeList.GetIndexFromKey(key, &objectExists);
271 if (objectExists)
272 {
273 lastSearchIndexValid=false;
274 mapNodeList.RemoveAtIndex(index);
275 return true;
276 }
277 else
278 return false;
279 }
280
281 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
282 void Map<key_type, data_type, key_comparison_func>::Clear(void)
283 {
284 lastSearchIndexValid=false;
285 mapNodeList.Clear(false, _FILE_AND_LINE_);
286 }
287
288 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
289 data_type& Map<key_type, data_type, key_comparison_func>::operator[]( const unsigned int position ) const
290 {
291 return mapNodeList[position].mapNodeData;
292 }
293
294 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
295 key_type Map<key_type, data_type, key_comparison_func>::GetKeyAtIndex( const unsigned int position ) const
296 {
297 return mapNodeList[position].mapNodeKey;
298 }
299
300 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
301 unsigned Map<key_type, data_type, key_comparison_func>::Size(void) const
302 {
303 return mapNodeList.Size();
304 }
305
306 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
307 void Map<key_type, data_type, key_comparison_func>::SaveLastSearch(const key_type &key, const unsigned index) const
308 {
309 (void) key;
310 (void) index;
311
312 /*
313 lastSearchIndex=index;
314 lastSearchKey=key;
315 lastSearchIndexValid=true;
316 */
317 }
318
319 template <class key_type, class data_type, int (*key_comparison_func)(const key_type&,const key_type&)>
320 bool Map<key_type, data_type, key_comparison_func>::HasSavedSearchResult(const key_type &key) const
321 {
322 (void) key;
323
324 // Not threadsafe!
325 return false;
326 // return lastSearchIndexValid && key_comparison_func(key,lastSearchKey)==0;
327 }
328 }
329
330 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/PacketLogger.h Source File

  • include
  • slikenet
PacketLogger.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_PacketLogger==1
23
24 #ifndef __PACKET_LOGGER_H
25 #define __PACKET_LOGGER_H
26
27 #include "types.h"
28 #include "PluginInterface2.h"
29 #include "Export.h"
30
31 namespace SLNet
32 {
34 class RakPeerInterface;
35
40
44 class RAK_DLL_EXPORT PacketLogger : public PluginInterface2
45 {
46 public:
47 // GetInstance() and DestroyInstance(instance*)
48 STATIC_FACTORY_DECLARATIONS(PacketLogger)
49
50 PacketLogger();
51 virtual ~PacketLogger();
52
53 // Translate the supplied parameters into an output line - overloaded version that takes a MessageIdentifier
54 // and translates it into a string (numeric or textual representation based on printId); this calls the
55 // second version which takes a const char* argument for the messageIdentifier
56 virtual void FormatLine(char* into, size_t intoLength, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame
57 , unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
58 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex);
59 virtual void FormatLine(char* into, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame
60 , unsigned char id, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
61 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex);
62 virtual void FormatLine(char* into, size_t intoLength, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame
63 , const char* idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
64 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex);
65 virtual void FormatLine(char* into, const char* dir, const char* type, unsigned int reliableMessageNumber, unsigned int frame
66 , const char* idToPrint, const BitSize_t bitLen, unsigned long long time, const SystemAddress& local, const SystemAddress& remote,
67 unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPacketCount, unsigned int orderingIndex);
68
70 virtual void OnDirectSocketSend(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress);
71 virtual void OnDirectSocketReceive(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress);
72 virtual void OnReliabilityLayerNotification(const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError);
73 virtual void OnInternalPacket(InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend);
74 virtual void OnAck(unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time);
75 virtual void OnPushBackPacket(const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress);
76
78 virtual void LogHeader(void);
79
81 virtual void WriteLog(const char *str);
82
83 // Write informational messages
84 virtual void WriteMiscellaneous(const char *type, const char *msg);
85
86
87 // Set to true to print ID_* instead of numbers
88 virtual void SetPrintID(bool print);
89 // Print or hide acks (clears up the screen not to print them but is worse for debugging)
90 virtual void SetPrintAcks(bool print);
91
93 virtual void SetPrefix(const char *_prefix);
94
96 virtual void SetSuffix(const char *_suffix);
97 static const char* BaseIDTOString(unsigned char Id);
98
100 void SetLogDirectMessages(bool send);
101 protected:
102
103 virtual bool UsesReliabilityLayer(void) const {return true;}
104 const char* IDTOString(unsigned char Id);
105 virtual void AddToLog(const char *str);
106 // Users should override this
107 virtual const char* UserIDTOString(unsigned char Id);
108 void GetLocalTime(char buffer[128]);
109 bool logDirectMessages;
110
111 bool printId, printAcks;
112 char prefix[256];
113 char suffix[256];
114 };
115
116 } // namespace SLNet
117
118 #endif
119
120 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TCPInterface.h Source File

  • include
  • slikenet
TCPInterface.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_TCPInterface==1
23
24 #ifndef __SIMPLE_TCP_SERVER
25 #define __SIMPLE_TCP_SERVER
26
27 #include "memoryoverride.h"
28 #include "DS_List.h"
29 #include "types.h"
30 #include "Export.h"
31 #include "thread.h"
32 #include "DS_Queue.h"
33 #include "SimpleMutex.h"
34 #include "defines.h"
35 #include "SocketIncludes.h"
36 #include "DS_ByteQueue.h"
37 #include "DS_ThreadsafeAllocatingQueue.h"
38 #include "LocklessTypes.h"
39 #include "PluginInterface2.h"
40
41 #if OPEN_SSL_CLIENT_SUPPORT==1
42 #include <openssl/crypto.h>
43 #include <openssl/x509.h>
44 #include <openssl/pem.h>
45 #include <openssl/ssl.h>
46 #include <openssl/err.h>
47 #endif
48
49 namespace SLNet
50 {
52 struct RemoteClient;
53
56 class RAK_DLL_EXPORT TCPInterface
57 {
58 public:
59 // GetInstance() and DestroyInstance(instance*)
60 STATIC_FACTORY_DECLARATIONS(TCPInterface)
61
62 TCPInterface();
63 virtual ~TCPInterface();
64
65 // TODO - add socketdescriptor
72 bool Start(unsigned short port, unsigned short maxIncomingConnections, unsigned short maxConnections=0, int _threadPriority=-99999, unsigned short socketFamily=AF_INET, const char *bindAddress=0);
73
75 void Stop(void);
76
78 SystemAddress Connect(const char* host, unsigned short remotePort, bool block=true, unsigned short socketFamily=AF_INET, const char *bindAddress=0);
79
80 #if OPEN_SSL_CLIENT_SUPPORT==1
81
82 void StartSSLClient(SystemAddress systemAddress);
83
85 bool IsSSLActive(SystemAddress systemAddress);
86 #endif
87
89 virtual void Send( const char *data, unsigned int length, const SystemAddress &systemAddress, bool broadcast );
90
91 // Sends a concatenated list of byte streams
92 virtual bool SendList( const char **data, const unsigned int *lengths, const int numParameters, const SystemAddress &systemAddress, bool broadcast );
93
94 // Get how many bytes are waiting to be sent. If too many, you may want to skip sending
95 unsigned int GetOutgoingDataBufferSize(SystemAddress systemAddress) const;
96
99 virtual bool ReceiveHasPackets( void );
100
102 virtual Packet* Receive( void );
103
105 void CloseConnection( SystemAddress systemAddress );
106
108 void DeallocatePacket( Packet *packet );
109
113 void GetConnectionList( SystemAddress *remoteSystems, unsigned short *numberOfSystems ) const;
114
116 unsigned short GetConnectionCount(void) const;
117
120 SystemAddress HasCompletedConnectionAttempt(void);
121
124 SystemAddress HasFailedConnectionAttempt(void);
125
127 SystemAddress HasNewIncomingConnection(void);
128
130 SystemAddress HasLostConnection(void);
131
133 Packet* AllocatePacket(unsigned dataSize);
134
135 // Push a packet back to the queue
136 virtual void PushBackPacket( Packet *packet, bool pushAtHead );
137
139 bool WasStarted(void) const;
140
141 void AttachPlugin( PluginInterface2 *plugin );
142 void DetachPlugin( PluginInterface2 *plugin );
143 protected:
144
145 Packet* ReceiveInt( void );
146
147 #if defined(WINDOWS_STORE_RT)
148 bool CreateListenSocket_WinStore8(unsigned short port, unsigned short maxIncomingConnections, unsigned short socketFamily, const char *hostAddress);
149 #else
150 bool CreateListenSocket(unsigned short port, unsigned short maxIncomingConnections, unsigned short socketFamily, const char *hostAddress);
151 #endif
152
153 // Plugins
154 DataStructures::List<PluginInterface2*> messageHandlerList;
155
156 SLNet::LocklessUint32_t isStarted, threadRunning;
157 __TCPSOCKET__ listenSocket;
158
159 DataStructures::Queue<Packet*> headPush, tailPush;
160 RemoteClient* remoteClients;
161 unsigned short remoteClientsLength;
162
163 // Assuming remoteClients is only used by one thread!
164 // DataStructures::List<RemoteClient*> remoteClients;
165 // Use this thread-safe queue to add to remoteClients
166 // DataStructures::Queue<RemoteClient*> remoteClientsInsertionQueue;
167 // SimpleMutex remoteClientsInsertionQueueMutex;
168
169 /*
170 struct OutgoingMessage
171 {
172 unsigned char* data;
173 SystemAddress systemAddress;
174 bool broadcast;
175 unsigned int length;
176 };
177 */
178 // DataStructures::SingleProducerConsumer<OutgoingMessage> outgoingMessages;
179 // DataStructures::SingleProducerConsumer<Packet> incomingMessages;
180 // DataStructures::SingleProducerConsumer<SystemAddress> newIncomingConnections, lostConnections, requestedCloseConnections;
181 // DataStructures::SingleProducerConsumer<RemoteClient*> newRemoteClients;
182 // DataStructures::ThreadsafeAllocatingQueue<OutgoingMessage> outgoingMessages;
183 DataStructures::ThreadsafeAllocatingQueue<Packet> incomingMessages;
184 DataStructures::ThreadsafeAllocatingQueue<SystemAddress> newIncomingConnections, lostConnections, requestedCloseConnections;
185 DataStructures::ThreadsafeAllocatingQueue<RemoteClient*> newRemoteClients;
186 SimpleMutex completedConnectionAttemptMutex, failedConnectionAttemptMutex;
187 DataStructures::Queue<SystemAddress> completedConnectionAttempts, failedConnectionAttempts;
188
189 int threadPriority;
190
191 DataStructures::List<__TCPSOCKET__> blockingSocketList;
192 SimpleMutex blockingSocketListMutex;
193
194
195
196
197
198 friend RAK_THREAD_DECLARATION(UpdateTCPInterfaceLoop);
199 friend RAK_THREAD_DECLARATION(ConnectionAttemptLoop);
200
201 // void DeleteRemoteClient(RemoteClient *remoteClient, fd_set *exceptionFD);
202 // void InsertRemoteClient(RemoteClient* remoteClient);
203 __TCPSOCKET__ SocketConnect(const char* host, unsigned short remotePort, unsigned short socketFamily, const char *bindAddress);
204
205 struct ThisPtrPlusSysAddr
206 {
207 TCPInterface *tcpInterface;
208 SystemAddress systemAddress;
209 bool useSSL;
210 char bindAddress[64];
211 unsigned short socketFamily;
212 };
213
214 #if OPEN_SSL_CLIENT_SUPPORT==1
215 SSL_CTX* ctx;
216 SSL_METHOD *meth;
217 DataStructures::ThreadsafeAllocatingQueue<SystemAddress> startSSL;
218 DataStructures::List<SystemAddress> activeSSLConnections;
219 SimpleMutex sharedSslMutex;
220 #endif
221 };
222
224 struct RemoteClient
225 {
226 RemoteClient() {
227 #if OPEN_SSL_CLIENT_SUPPORT==1
228 ssl=0;
229 #endif
230 isActive=false;
231 #if !defined(WINDOWS_STORE_RT)
232 socket=0;
233 #endif
234 }
235 __TCPSOCKET__ socket;
236 SystemAddress systemAddress;
237 DataStructures::ByteQueue outgoingData;
238 bool isActive;
239 SimpleMutex outgoingDataMutex;
240 SimpleMutex isActiveMutex;
241
242 #if OPEN_SSL_CLIENT_SUPPORT==1
243 SSL* ssl;
244 bool InitSSL(SSL_CTX* ctx, SSL_METHOD *meth);
245 void DisconnectSSL(void);
246 void FreeSSL(void);
247 int Send(const char *data, unsigned int length);
248 int Recv(char *data, const int dataSize);
249 #else
250 int Send(const char *data, unsigned int length);
251 int Recv(char *data, const int dataSize);
252 #endif
253 void Reset(void)
254 {
255 outgoingDataMutex.Lock();
256 outgoingData.Clear(_FILE_AND_LINE_);
257 outgoingDataMutex.Unlock();
258 }
259 void SetActive(bool a);
260 void SendOrBuffer(const char **data, const unsigned int *lengths, const int numParameters);
261 };
262
263 } // namespace SLNet
264
265 #endif
266
267 #endif // _RAKNET_SUPPORT_*
268
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
  • ColumnDescriptor
DataStructures::Table::ColumnDescriptor Member List

This is the complete list of members for DataStructures::Table::ColumnDescriptor, including all inherited members.

ColumnDescriptor() | DataStructures::Table::ColumnDescriptor
ColumnDescriptor(const char cn[_TABLE_MAX_COLUMN_NAME_LENGTH], ColumnType ct) | DataStructures::Table::ColumnDescriptor
columnName | DataStructures::Table::ColumnDescriptor
columnType | DataStructures::Table::ColumnDescriptor
~ColumnDescriptor() | DataStructures::Table::ColumnDescriptor
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/SimpleMutex.cpp Source File

  • src
SimpleMutex.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20
21 #include "slikenet/SimpleMutex.h"
22 #include "slikenet/assert.h"
23
24 using namespace SLNet;
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 SimpleMutex::SimpleMutex() //: isInitialized(false)
62 {
63
64
65
66
67
68
69
70 // Prior implementation of Initializing in Lock() was not threadsafe
71 Init();
72 }
73
74 SimpleMutex::~SimpleMutex()
75 {
76 // if (isInitialized==false)
77 // return;
78 #ifdef _WIN32
79 // CloseHandle(hMutex);
80 DeleteCriticalSection(&criticalSection);
81
82
83
84
85
86
87 #else
88 pthread_mutex_destroy(&hMutex);
89 #endif
90
91
92
93
94
95
96
97 }
98
99 #ifdef _WIN32
100 #ifdef _DEBUG
101 #include <stdio.h>
102 #endif
103 #endif
104
105 void SimpleMutex::Lock(void)
106 {
107 // if (isInitialized==false)
108 // Init();
109
110 #ifdef _WIN32
111 /*
112 DWORD d = WaitForSingleObject(hMutex, INFINITE);
113 #ifdef _DEBUG
114 if (d==WAIT_FAILED)
115 {
116 LPVOID messageBuffer;
117 FormatMessage(
118 FORMAT_MESSAGE_ALLOCATE_BUFFER |
119 FORMAT_MESSAGE_FROM_SYSTEM |
120 FORMAT_MESSAGE_IGNORE_INSERTS,
121 NULL,
122 GetLastError(),
123 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
124 (LPTSTR) &messageBuffer,
125 0,
126 NULL
127 );
128 // Process any inserts in messageBuffer.
129 // ...
130 // Display the string.
131 //MessageBox( NULL, (LPCTSTR)messageBuffer, "Error", MB_OK | MB_ICONINFORMATION );
132 RAKNET_DEBUG_PRINTF("SimpleMutex error: %s", messageBuffer);
133 // Free the buffer.
134 LocalFree( messageBuffer );
135
136 }
137
138 RakAssert(d==WAIT_OBJECT_0);
139 */
140 EnterCriticalSection(&criticalSection);
141
142
143
144
145
146
147 #else
148 int error = pthread_mutex_lock(&hMutex);
149 (void) error;
150 RakAssert(error==0);
151 #endif
152 }
153
154 void SimpleMutex::Unlock(void)
155 {
156 // if (isInitialized==false)
157 // return;
158 #ifdef _WIN32
159 // ReleaseMutex(hMutex);
160 LeaveCriticalSection(&criticalSection);
161
162
163
164
165
166
167 #else
168 int error = pthread_mutex_unlock(&hMutex);
169 (void) error;
170 RakAssert(error==0);
171 #endif
172 }
173
174 void SimpleMutex::Init(void)
175 {
176 #if defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
177 InitializeCriticalSectionEx(&criticalSection,0,CRITICAL_SECTION_NO_DEBUG_INFO);
178 #elif defined(_WIN32)
179 // hMutex = CreateMutex(NULL, FALSE, 0);
180 // RakAssert(hMutex);
181 InitializeCriticalSection(&criticalSection);
182
183
184
185
186
187
188
189
190 #else
191 int error = pthread_mutex_init(&hMutex, 0);
192 (void) error;
193 RakAssert(error==0);
194 #endif
195 // isInitialized=true;
196 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:21 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NativeFeatureIncludes.h Source File

  • include
  • slikenet
NativeFeatureIncludes.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 // If you want to change these defines, put them in NativeFeatureIncludesOverrides so your changes are not lost when updating RakNet
12 // The user should not edit this file
13 #include "NativeFeatureIncludesOverrides.h"
14
15 #ifndef __NATIVE_FEATURE_INCLDUES_H
16 #define __NATIVE_FEATURE_INCLDUES_H
17
18 // Uncomment below defines, and paste to NativeFeatureIncludesOverrides.h, to exclude plugins that you do not want to build into the static library, or DLL
19 // These are not all the plugins, only those that are in the core library
20 // Other plugins are located in DependentExtensions
21 // #define _RAKNET_SUPPORT_ConnectionGraph2 0
22 // #define _RAKNET_SUPPORT_DirectoryDeltaTransfer 0
23 // #define _RAKNET_SUPPORT_FileListTransfer 0
24 // #define _RAKNET_SUPPORT_FullyConnectedMesh2 0
25 // #define _RAKNET_SUPPORT_MessageFilter 0
26 // #define _RAKNET_SUPPORT_NatPunchthroughClient 0
27 // #define _RAKNET_SUPPORT_NatPunchthroughServer 0
28 // #define _RAKNET_SUPPORT_NatTypeDetectionClient 0
29 // #define _RAKNET_SUPPORT_NatTypeDetectionServer 0
30 // #define _RAKNET_SUPPORT_PacketLogger 0
31 // #define _RAKNET_SUPPORT_ReadyEvent 0
32 // #define _RAKNET_SUPPORT_ReplicaManager3 0
33 // #define _RAKNET_SUPPORT_Router2 0
34 // #define _RAKNET_SUPPORT_RPC4Plugin 0
35 // #define _RAKNET_SUPPORT_TeamBalancer 0
36 // #define _RAKNET_SUPPORT_TeamManager 0
37 // #define _RAKNET_SUPPORT_UDPProxyClient 0
38 // #define _RAKNET_SUPPORT_UDPProxyCoordinator 0
39 // #define _RAKNET_SUPPORT_UDPProxyServer 0
40 // #define _RAKNET_SUPPORT_ConsoleServer 0
41 // #define _RAKNET_SUPPORT_RakNetTransport 0
42 // #define _RAKNET_SUPPORT_TelnetTransport 0
43 // #define _RAKNET_SUPPORT_TCPInterface 0
44 // #define _RAKNET_SUPPORT_LogCommandParser 0
45 // #define _RAKNET_SUPPORT_RakNetCommandParser 0
46 // #define _RAKNET_SUPPORT_EmailSender 0
47 // #define _RAKNET_SUPPORT_HTTPConnection 0
48 // #define _RAKNET_SUPPORT_HTTPConnection2 0
49 // #define _RAKNET_SUPPORT_PacketizedTCP 0
50 // #define _RAKNET_SUPPORT_TwoWayAuthentication 0
51
52 // SET DEFAULTS IF UNDEFINED
53 #ifndef LIBCAT_SECURITY
54 #define LIBCAT_SECURITY 0
55 #endif
56 #ifndef _RAKNET_SUPPORT_ConnectionGraph2
57 #define _RAKNET_SUPPORT_ConnectionGraph2 1
58 #endif
59 #ifndef _RAKNET_SUPPORT_DirectoryDeltaTransfer
60 #define _RAKNET_SUPPORT_DirectoryDeltaTransfer 1
61 #endif
62 #ifndef _RAKNET_SUPPORT_FileListTransfer
63 #define _RAKNET_SUPPORT_FileListTransfer 1
64 #endif
65 #ifndef _RAKNET_SUPPORT_FullyConnectedMesh
66 #define _RAKNET_SUPPORT_FullyConnectedMesh 1
67 #endif
68 #ifndef _RAKNET_SUPPORT_FullyConnectedMesh2
69 #define _RAKNET_SUPPORT_FullyConnectedMesh2 1
70 #endif
71 #ifndef _RAKNET_SUPPORT_MessageFilter
72 #define _RAKNET_SUPPORT_MessageFilter 1
73 #endif
74 #ifndef _RAKNET_SUPPORT_NatPunchthroughClient
75 #define _RAKNET_SUPPORT_NatPunchthroughClient 1
76 #endif
77 #ifndef _RAKNET_SUPPORT_NatPunchthroughServer
78 #define _RAKNET_SUPPORT_NatPunchthroughServer 1
79 #endif
80 #ifndef _RAKNET_SUPPORT_NatTypeDetectionClient
81 #define _RAKNET_SUPPORT_NatTypeDetectionClient 1
82 #endif
83 #ifndef _RAKNET_SUPPORT_NatTypeDetectionServer
84 #define _RAKNET_SUPPORT_NatTypeDetectionServer 1
85 #endif
86 #ifndef _RAKNET_SUPPORT_PacketLogger
87 #define _RAKNET_SUPPORT_PacketLogger 1
88 #endif
89 #ifndef _RAKNET_SUPPORT_ReadyEvent
90 #define _RAKNET_SUPPORT_ReadyEvent 1
91 #endif
92 #ifndef _RAKNET_SUPPORT_ReplicaManager3
93 #define _RAKNET_SUPPORT_ReplicaManager3 1
94 #endif
95 #ifndef _RAKNET_SUPPORT_Router2
96 #define _RAKNET_SUPPORT_Router2 1
97 #endif
98 #ifndef _RAKNET_SUPPORT_RPC4Plugin
99 #define _RAKNET_SUPPORT_RPC4Plugin 1
100 #endif
101 #ifndef _RAKNET_SUPPORT_TeamBalancer
102 #define _RAKNET_SUPPORT_TeamBalancer 1
103 #endif
104 #ifndef _RAKNET_SUPPORT_TeamManager
105 #define _RAKNET_SUPPORT_TeamManager 1
106 #endif
107 #ifndef _RAKNET_SUPPORT_UDPProxyClient
108 #define _RAKNET_SUPPORT_UDPProxyClient 1
109 #endif
110 #ifndef _RAKNET_SUPPORT_UDPProxyCoordinator
111 #define _RAKNET_SUPPORT_UDPProxyCoordinator 1
112 #endif
113 #ifndef _RAKNET_SUPPORT_UDPProxyServer
114 #define _RAKNET_SUPPORT_UDPProxyServer 1
115 #endif
116 #ifndef _RAKNET_SUPPORT_ConsoleServer
117 #define _RAKNET_SUPPORT_ConsoleServer 1
118 #endif
119 #ifndef _RAKNET_SUPPORT_RakNetTransport
120 #define _RAKNET_SUPPORT_RakNetTransport 1
121 #endif
122 #ifndef _RAKNET_SUPPORT_TelnetTransport
123 #define _RAKNET_SUPPORT_TelnetTransport 1
124 #endif
125 #ifndef _RAKNET_SUPPORT_TCPInterface
126 #define _RAKNET_SUPPORT_TCPInterface 1
127 #endif
128 #ifndef _RAKNET_SUPPORT_LogCommandParser
129 #define _RAKNET_SUPPORT_LogCommandParser 1
130 #endif
131 #ifndef _RAKNET_SUPPORT_RakNetCommandParser
132 #define _RAKNET_SUPPORT_RakNetCommandParser 1
133 #endif
134 #ifndef _RAKNET_SUPPORT_EmailSender
135 #define _RAKNET_SUPPORT_EmailSender 1
136 #endif
137 #ifndef _RAKNET_SUPPORT_HTTPConnection
138 #define _RAKNET_SUPPORT_HTTPConnection 1
139 #endif
140 #ifndef _RAKNET_SUPPORT_HTTPConnection2
141 #define _RAKNET_SUPPORT_HTTPConnection2 1
142 #endif
143 #ifndef _RAKNET_SUPPORT_PacketizedTCP
144 #define _RAKNET_SUPPORT_PacketizedTCP 1
145 #endif
146 #ifndef _RAKNET_SUPPORT_TwoWayAuthentication
147 #define _RAKNET_SUPPORT_TwoWayAuthentication 1
148 #endif
149 #ifndef _RAKNET_SUPPORT_CloudClient
150 #define _RAKNET_SUPPORT_CloudClient 1
151 #endif
152 #ifndef _RAKNET_SUPPORT_CloudServer
153 #define _RAKNET_SUPPORT_CloudServer 1
154 #endif
155 #ifndef _RAKNET_SUPPORT_DynDNS
156 #define _RAKNET_SUPPORT_DynDNS 1
157 #endif
158 #ifndef _RAKNET_SUPPORT_Rackspace
159 #define _RAKNET_SUPPORT_Rackspace 1
160 #endif
161 #ifndef _RAKNET_SUPPORT_FileOperations
162 #define _RAKNET_SUPPORT_FileOperations 1
163 #endif
164 #ifndef _RAKNET_SUPPORT_UDPForwarder
165 #define _RAKNET_SUPPORT_UDPForwarder 1
166 #endif
167 #ifndef _RAKNET_SUPPORT_StatisticsHistory
168 #define _RAKNET_SUPPORT_StatisticsHistory 1
169 #endif
170 #ifndef _RAKNET_SUPPORT_LibVoice
171 #define _RAKNET_SUPPORT_LibVoice 0
172 #endif
173 #ifndef _RAKNET_SUPPORT_RelayPlugin
174 #define _RAKNET_SUPPORT_RelayPlugin 1
175 #endif
176
177 // Take care of dependencies
178 #if _RAKNET_SUPPORT_DirectoryDeltaTransfer==1
179 #undef _RAKNET_SUPPORT_FileListTransfer
180 #define _RAKNET_SUPPORT_FileListTransfer 1
181 #endif
182 #if _RAKNET_SUPPORT_FullyConnectedMesh2==1
183 #undef _RAKNET_SUPPORT_ConnectionGraph2
184 #define _RAKNET_SUPPORT_ConnectionGraph2 1
185 #endif
186 #if _RAKNET_SUPPORT_TelnetTransport==1
187 #undef _RAKNET_SUPPORT_PacketizedTCP
188 #define _RAKNET_SUPPORT_PacketizedTCP 1
189 #endif
190 #if _RAKNET_SUPPORT_PacketizedTCP==1 || _RAKNET_SUPPORT_EmailSender==1 || _RAKNET_SUPPORT_HTTPConnection==1
191 #undef _RAKNET_SUPPORT_TCPInterface
192 #define _RAKNET_SUPPORT_TCPInterface 1
193 #endif
194
195
196
197
198
199
200
201
202
203
204
205
206 #endif // __NATIVE_FEATURE_INCLDUES_H
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • OrderedChannelHeap
DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > Member List

This is the complete list of members for DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func >, including all inherited members.

AddChannel(const channel_key_type &channelID, const double weight) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
ChannelSize(const channel_key_type &channelID) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
Clear(void) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
GreatestRandResult(void) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > | protected
heap | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > | protected
IMPLEMENT_DEFAULT_COMPARISON(void) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > | inlinestatic
map | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > | protected
operator[](const unsigned int position) const | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
OrderedChannelHeap() | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
Peek(const unsigned startingIndex) const | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
Pop(const unsigned startingIndex=0) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
Push(const channel_key_type &channelID, const heap_data_type &data) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
PushAtHead(const unsigned index, const channel_key_type &channelID, const heap_data_type &data) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
RemoveChannel(channel_key_type channelID) | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
Size(void) const | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
~OrderedChannelHeap() | DataStructures::OrderedChannelHeap< channel_key_type, heap_data_type, channel_key_comparison_func > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • List
DataStructures::List< list_type > Member List

This is the complete list of members for DataStructures::List< list_type >, including all inherited members.

Clear(bool doNotDeallocateSmallBlocks, const char *file, unsigned int line) | DataStructures::List< list_type > |
Compress(const char *file, unsigned int line) | DataStructures::List< list_type > |
Get(const unsigned int position) const | DataStructures::List< list_type > | inline
GetIndexOf(const list_type &input) const | DataStructures::List< list_type > |
Insert(const list_type &input, const unsigned int position, const char *file, unsigned int line) | DataStructures::List< list_type > |
Insert(const list_type &input, const char *file, unsigned int line) | DataStructures::List< list_type > |
List() | DataStructures::List< list_type > |
List(const List &original_copy) | DataStructures::List< list_type > |
operator=(const List &original_copy) | DataStructures::List< list_type > |
operator[](const unsigned int position) const | DataStructures::List< list_type > | inline
Pop(void) | DataStructures::List< list_type > | inline
Preallocate(unsigned countNeeded, const char *file, unsigned int line) | DataStructures::List< list_type > |
Push(const list_type &input, const char *file, unsigned int line) | DataStructures::List< list_type > |
RemoveAtIndex(const unsigned int position) | DataStructures::List< list_type > |
RemoveAtIndexFast(const unsigned int position) | DataStructures::List< list_type > |
RemoveFromEnd(const unsigned num=1) | DataStructures::List< list_type > | inline
Replace(const list_type &input, const list_type filler, const unsigned int position, const char *file, unsigned int line) | DataStructures::List< list_type > | inline
Replace(const list_type &input) | DataStructures::List< list_type > | inline
Size(void) const | DataStructures::List< list_type > | inline
~List() | DataStructures::List< list_type > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/time.h Source File

  • include
  • slikenet
time.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __RAKNET_TIME_H
17 #define __RAKNET_TIME_H
18
19 #include "NativeTypes.h"
20 #include "defines.h"
21
22 namespace SLNet {
23
24 // Define __GET_TIME_64BIT if you want to use large types for GetTime (takes more bandwidth when you transmit time though!)
25 // You would want to do this if your system is going to run long enough to overflow the millisecond counter (over a month)
26 #if __GET_TIME_64BIT==1
27 typedef uint64_t Time;
28 #define RAK_TIME_FORMAT_STRING "%llu"
29 typedef uint32_t TimeMS;
30 typedef uint64_t TimeUS;
31 #else
32 typedef uint32_t Time;
33 #define RAK_TIME_FORMAT_STRING "%u"
34 typedef uint32_t TimeMS;
35 typedef uint64_t TimeUS;
36 #endif
37
38 } // namespace SLNet
39
40 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ReplicaEnums.h Source File

  • include
  • slikenet
ReplicaEnums.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
14
15
16
17 #ifndef __REPLICA_ENUMS_H
18 #define __REPLICA_ENUMS_H
19
22 enum
23 {
24 REPLICA_RECEIVE_DESTRUCTION=1<<0,
25 REPLICA_RECEIVE_SERIALIZE=1<<1,
26 REPLICA_RECEIVE_SCOPE_CHANGE=1<<2,
27 REPLICA_SEND_CONSTRUCTION=1<<3,
28 REPLICA_SEND_DESTRUCTION=1<<4,
29 REPLICA_SEND_SCOPE_CHANGE=1<<5,
30 REPLICA_SEND_SERIALIZE=1<<6,
31 REPLICA_SET_ALL = 0xFF // Allow all of the above
32 };
33
34 enum ReplicaReturnResult
35 {
37 REPLICA_PROCESS_LATER,
39 REPLICA_PROCESSING_DONE,
41 REPLICA_CANCEL_PROCESS,
45 REPLICA_PROCESS_AGAIN,
48 REPLICA_PROCESS_IMPLICIT
49 };
50
51 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPProxyCoordinator.h Source File

  • include
  • slikenet
UDPProxyCoordinator.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_UDPProxyCoordinator==1 && _RAKNET_SUPPORT_UDPForwarder==1
23
24 #ifndef __UDP_PROXY_COORDINATOR_H
25 #define __UDP_PROXY_COORDINATOR_H
26
27 #include "Export.h"
28 #include "types.h"
29 #include "PluginInterface2.h"
30 #include "string.h"
31 #include "BitStream.h"
32 #include "DS_Queue.h"
33 #include "DS_OrderedList.h"
34
35 namespace SLNet
36 {
42 class RAK_DLL_EXPORT UDPProxyCoordinator : public PluginInterface2
43 {
44 public:
45 // GetInstance() and DestroyInstance(instance*)
46 STATIC_FACTORY_DECLARATIONS(UDPProxyCoordinator)
47
48 UDPProxyCoordinator();
49 virtual ~UDPProxyCoordinator();
50
54 void SetRemoteLoginPassword(SLNet::RakString password);
55
57 virtual void Update(void);
58 virtual PluginReceiveResult OnReceive(Packet *packet);
59 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
60
61 struct SenderAndTargetAddress
62 {
63 SystemAddress senderClientAddress;
64 RakNetGUID senderClientGuid;
65 SystemAddress targetClientAddress;
66 RakNetGUID targetClientGuid;
67 };
68
69 struct ServerWithPing
70 {
71 unsigned short ping;
72 SystemAddress serverAddress;
73 };
74
75 struct ForwardingRequest
76 {
77 SLNet::TimeMS timeoutOnNoDataMS;
78 SLNet::TimeMS timeoutAfterSuccess;
79 SenderAndTargetAddress sata;
80 SystemAddress requestingAddress; // Which system originally sent the network message to start forwarding
81 SystemAddress currentlyAttemptedServerAddress;
82 DataStructures::Queue<SystemAddress> remainingServersToTry;
83 SLNet::BitStream serverSelectionBitstream;
84
85 DataStructures::List<ServerWithPing> sourceServerPings, targetServerPings;
86 SLNet::TimeMS timeRequestedPings;
87 // Order based on sourceServerPings and targetServerPings
88 void OrderRemainingServersToTry(void);
89
90 };
91 protected:
92
93 static int ServerWithPingComp( const unsigned short &key, const UDPProxyCoordinator::ServerWithPing &data );
94 static int ForwardingRequestComp( const SenderAndTargetAddress &key, ForwardingRequest* const &data);
95
96 void OnForwardingRequestFromClientToCoordinator(Packet *packet);
97 void OnLoginRequestFromServerToCoordinator(Packet *packet);
98 void OnForwardingReplyFromServerToCoordinator(Packet *packet);
99 void OnPingServersReplyFromClientToCoordinator(Packet *packet);
100 void TryNextServer(SenderAndTargetAddress sata, ForwardingRequest *fw);
101 void SendAllBusy(SystemAddress senderClientAddress, SystemAddress targetClientAddress, RakNetGUID targetClientGuid, SystemAddress requestingAddress);
102 void Clear(void);
103
104 void SendForwardingRequest(SystemAddress sourceAddress, SystemAddress targetAddress, SystemAddress serverAddress, SLNet::TimeMS timeoutOnNoDataMS);
105
106 // Logged in servers
107 //DataStructures::Multilist<ML_UNORDERED_LIST, SystemAddress> serverList;
108 DataStructures::List<SystemAddress> serverList;
109
110 // Forwarding requests in progress
111 //DataStructures::Multilist<ML_ORDERED_LIST, ForwardingRequest*, SenderAndTargetAddress> forwardingRequestList;
112 DataStructures::OrderedList<SenderAndTargetAddress, ForwardingRequest*, ForwardingRequestComp> forwardingRequestList;
113
114 SLNet::RakString remoteLoginPassword;
115
116 };
117
118 } // End namespace
119
120 #endif
121
122 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ConsoleServer.h Source File

  • include
  • slikenet
ConsoleServer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_ConsoleServer==1
23
24 #ifndef __CONSOLE_SERVER_H
25 #define __CONSOLE_SERVER_H
26
27 #include "memoryoverride.h"
28 #include "DS_List.h"
29 #include "types.h"
30 #include "Export.h"
31
32 namespace SLNet
33 {
35 class TransportInterface;
36 class CommandParserInterface;
37
38
44 class RAK_DLL_EXPORT ConsoleServer
45 {
46 public:
47 // GetInstance() and DestroyInstance(instance*)
48 STATIC_FACTORY_DECLARATIONS(ConsoleServer)
49
50 ConsoleServer();
51 ~ConsoleServer();
52
56 void SetTransportProvider(TransportInterface *transportInterface, unsigned short port);
57
60 void AddCommandParser(CommandParserInterface *commandParserInterface);
61
64 void RemoveCommandParser(CommandParserInterface *commandParserInterface);
65
68 void Update(void);
69
74 void SetPrompt(const char *_prompt);
75
76 protected:
77 void ListParsers(SystemAddress systemAddress);
78 void ShowPrompt(SystemAddress systemAddress);
79 TransportInterface *transport;
80 DataStructures::List<CommandParserInterface *> commandParserList;
81 char* password[256];
82 char *prompt;
83 };
84
85 } // namespace SLNet
86
87 #endif
88
89 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/ThreadsafePacketLogger.h Source File

  • include
  • slikenet
ThreadsafePacketLogger.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_PacketLogger==1
23
24 #ifndef __THREADSAFE_PACKET_LOGGER_H
25 #define __THREADSAFE_PACKET_LOGGER_H
26
27 #include "PacketLogger.h"
28 #include "SingleProducerConsumer.h"
29
30 namespace SLNet
31 {
32
35 class RAK_DLL_EXPORT ThreadsafePacketLogger : public PacketLogger
36 {
37 public:
38 ThreadsafePacketLogger();
39 virtual ~ThreadsafePacketLogger();
40
41 virtual void Update(void);
42
43 protected:
44 virtual void AddToLog(const char *str);
45
46 DataStructures::SingleProducerConsumer<char*> logMessages;
47 };
48
49 } // namespace SLNet
50
51 #endif
52
53 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetRandom
SLNet::RakNetRandom Member List

This is the complete list of members for SLNet::RakNetRandom, including all inherited members.

FillBufferMT(void *buffer, unsigned int bytes) | SLNet::RakNetRandom |
FrandomMT(void) | SLNet::RakNetRandom |
left | SLNet::RakNetRandom | protected
next | SLNet::RakNetRandom | protected
RakNetRandom() | SLNet::RakNetRandom |
RandomMT(void) | SLNet::RakNetRandom |
ReloadMT(void) | SLNet::RakNetRandom |
SeedMT(unsigned int seed) | SLNet::RakNetRandom |
state | SLNet::RakNetRandom | protected
~RakNetRandom() | SLNet::RakNetRandom |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • SystemAddress
SLNet::SystemAddress Member List

This is the complete list of members for SLNet::SystemAddress, including all inherited members.

address | SLNet::SystemAddress |
CopyPort(const SystemAddress &right) | SLNet::SystemAddress |
debugPort | SLNet::SystemAddress |
EqualsExcludingPort(const SystemAddress &right) const | SLNet::SystemAddress |
FixForIPVersion(const SystemAddress &boundAddressToSocket) | SLNet::SystemAddress |
FromString(const char *str, char portDelineator='|', int ipVersion=0) | SLNet::SystemAddress |
FromStringExplicitPort(const char *str, unsigned short port, int ipVersion=0) | SLNet::SystemAddress |
GetIPPROTO(void) const | SLNet::SystemAddress |
GetIPVersion(void) const | SLNet::SystemAddress |
GetPort(void) const | SLNet::SystemAddress |
GetPortNetworkOrder(void) const | SLNet::SystemAddress |
IsLANAddress(void) | SLNet::SystemAddress |
IsLoopback(void) const | SLNet::SystemAddress |
operator!=(const SystemAddress &right) const | SLNet::SystemAddress |
operator<(const SystemAddress &right) const | SLNet::SystemAddress |
operator=(const SystemAddress &input) | SLNet::SystemAddress |
operator==(const SystemAddress &right) const | SLNet::SystemAddress |
operator>(const SystemAddress &right) const | SLNet::SystemAddress |
SetBinaryAddress(const char *str, char portDelineator=':') | SLNet::SystemAddress |
SetPortHostOrder(unsigned short s) | SLNet::SystemAddress |
SetPortNetworkOrder(unsigned short s) | SLNet::SystemAddress |
SetToLoopback(void) | SLNet::SystemAddress |
SetToLoopback(unsigned char ipVersion) | SLNet::SystemAddress |
size(void) | SLNet::SystemAddress | static
SystemAddress() | SLNet::SystemAddress |
SystemAddress(const char *str) | SLNet::SystemAddress |
SystemAddress(const char *str, unsigned short port) | SLNet::SystemAddress |
systemIndex | SLNet::SystemAddress |
ToInteger(const SystemAddress &sa) | SLNet::SystemAddress | static
ToString(bool writePort=true, char portDelineator='|') const | SLNet::SystemAddress |
ToString(bool writePort, char *dest, char portDelineator= '|') const | SLNet::SystemAddress |
ToString(bool writePort, char *dest, size_t destLength, char portDelineator='|') const | SLNet::SystemAddress |
ToString_Old(bool writePort, char *dest, char portDelineator= ':') const | SLNet::SystemAddress |
ToString_Old(bool writePort, char *dest, size_t destLength, char portDelineator= ':') const | SLNet::SystemAddress |
union | SLNet::SystemAddress |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakSleep.cpp Source File

  • src
RakSleep.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #if defined(_WIN32)
17 #include "slikenet/WindowsIncludes.h" // Sleep
18
19
20
21
22
23
24
25 #else
26 #include <pthread.h>
27 #include <time.h>
28 #include <sys/time.h>
29 pthread_mutex_t fakeMutex = PTHREAD_MUTEX_INITIALIZER;
30 pthread_cond_t fakeCond = PTHREAD_COND_INITIALIZER;
31 #endif
32
33 #include "slikenet/sleep.h"
34
35
36 #if defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
37 #include "ThreadEmulation.h"
38 using namespace ThreadEmulation;
39 #endif
40
41 void RakSleep(unsigned int ms)
42 {
43 #ifdef _WIN32
44 Sleep(ms);
45
46
47
48
49
50
51
52 #else
53 //Single thread sleep code thanks to Furquan Shaikh, http://somethingswhichidintknow.blogspot.com/2009/09/sleep-in-pthread.html
54 //Modified slightly from the original
55 struct timespec timeToWait;
56 struct timeval now;
57 int rt;
58
59 gettimeofday(&now,NULL);
60
61 long seconds = ms/1000;
62 long nanoseconds = (ms - seconds * 1000) * 1000000;
63 timeToWait.tv_sec = now.tv_sec + seconds;
64 timeToWait.tv_nsec = now.tv_usec*1000 + nanoseconds;
65
66 if (timeToWait.tv_nsec >= 1000000000)
67 {
68 timeToWait.tv_nsec -= 1000000000;
69 timeToWait.tv_sec++;
70 }
71
72 pthread_mutex_lock(&fakeMutex);
73 rt = pthread_cond_timedwait(&fakeCond, &fakeMutex, &timeToWait);
74 pthread_mutex_unlock(&fakeMutex);
75 #endif
76 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • RakNetSocket2
SLNet::RakNetSocket2 Member List

This is the complete list of members for SLNet::RakNetSocket2, including all inherited members.

boundAddress | SLNet::RakNetSocket2 | protected
DomainNameToIP(const char *domainName, char ip[65]) | SLNet::RakNetSocket2 | static
eventHandler | SLNet::RakNetSocket2 | protected
GetBoundAddress(void) const | SLNet::RakNetSocket2 |
GetEventHandler(void) const | SLNet::RakNetSocket2 |
GetMyIP(SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS]) | SLNet::RakNetSocket2 | static
GetSocketType(void) const | SLNet::RakNetSocket2 |
GetUserConnectionSocketIndex(void) const | SLNet::RakNetSocket2 |
IsBerkleySocket(void) const | SLNet::RakNetSocket2 |
RakNetSocket2() | SLNet::RakNetSocket2 |
Send(RNS2_SendParameters *sendParameters, const char *file, unsigned int line)=0 | SLNet::RakNetSocket2 | pure virtual
SetRecvEventHandler(RNS2EventHandler *_eventHandler) | SLNet::RakNetSocket2 |
SetSocketType(RNS2Type t) | SLNet::RakNetSocket2 |
SetUserConnectionSocketIndex(unsigned int i) | SLNet::RakNetSocket2 |
socketType | SLNet::RakNetSocket2 | protected
userConnectionSocketIndex | SLNet::RakNetSocket2 | protected
~RakNetSocket2() | SLNet::RakNetSocket2 | virtual
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakNetSocket2_360_720.cpp Source File

  • src
RakNetSocket2_360_720.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/EmptyHeader.h"
17
18 #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
19
20 #ifndef RAKNETSOCKET2_360_720_CPP
21 #define RAKNETSOCKET2_360_720_CPP
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 #endif // file header
90
91 #endif // #ifdef RAKNET_SOCKET_2_INLINE_FUNCTIONS
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/UDPProxyClient.h Source File

  • include
  • slikenet
UDPProxyClient.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_UDPProxyClient==1
22
23 #ifndef __UDP_PROXY_CLIENT_H
24 #define __UDP_PROXY_CLIENT_H
25
26 #include "Export.h"
27 #include "types.h"
28 #include "PluginInterface2.h"
29 #include "DS_List.h"
30
35
36 namespace SLNet
37 {
38 class UDPProxyClient;
39
42 struct UDPProxyClientResultHandler
43 {
44 UDPProxyClientResultHandler() {}
45 virtual ~UDPProxyClientResultHandler() {}
46
55 virtual void OnForwardingSuccess(const char *proxyIPAddress, unsigned short proxyPort,
56 SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
57
67 virtual void OnForwardingNotification(const char *proxyIPAddress, unsigned short proxyPort,
68 SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
69
76 virtual void OnNoServersOnline(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
77
84 virtual void OnRecipientNotConnected(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
85
93 virtual void OnAllServersBusy(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
94
104 virtual void OnForwardingInProgress(const char *proxyIPAddress, unsigned short proxyPort, SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, SLNet::UDPProxyClient *proxyClientPlugin)=0;
105 };
106
107
115 class RAK_DLL_EXPORT UDPProxyClient : public PluginInterface2
116 {
117 public:
118 // GetInstance() and DestroyInstance(instance*)
119 STATIC_FACTORY_DECLARATIONS(UDPProxyClient)
120
121 UDPProxyClient();
122 ~UDPProxyClient();
123
127 void SetResultHandler(UDPProxyClientResultHandler *rh);
128
141 bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddressAsSeenFromCoordinator, SLNet::TimeMS timeoutOnNoDataMS, SLNet::BitStream *serverSelectionBitstream=0);
142
145 bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, SLNet::TimeMS timeoutOnNoDataMS, SLNet::BitStream *serverSelectionBitstream=0);
146
148 virtual void Update(void);
149 virtual PluginReceiveResult OnReceive(Packet *packet);
150 virtual void OnRakPeerShutdown(void);
151
152 struct ServerWithPing
153 {
154 unsigned short ping;
155 SystemAddress serverAddress;
156 };
157 struct SenderAndTargetAddress
158 {
159 SystemAddress senderClientAddress;
160 SystemAddress targetClientAddress;
161 };
162 struct PingServerGroup
163 {
164 SenderAndTargetAddress sata;
165 SLNet::TimeMS startPingTime;
166 SystemAddress coordinatorAddressForPings;
167 //DataStructures::Multilist<ML_UNORDERED_LIST, ServerWithPing> serversToPing;
168 DataStructures::List<ServerWithPing> serversToPing;
169 bool AreAllServersPinged(void) const;
170 void SendPingedServersToCoordinator(RakPeerInterface *rakPeer);
171 };
172 //DataStructures::Multilist<ML_UNORDERED_LIST, PingServerGroup*> pingServerGroups;
173 DataStructures::List<PingServerGroup*> pingServerGroups;
174 protected:
175
176 void OnPingServers(Packet *packet);
177 void Clear(void);
178 UDPProxyClientResultHandler *resultHandler;
179
180 };
181
182 } // End namespace
183
184 #endif
185
186 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/PacketFileLogger.cpp Source File

  • src
PacketFileLogger.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_PacketLogger==1
18
19 #include "slikenet/PacketFileLogger.h"
20 #include "slikenet/GetTime.h"
21 #include "slikenet/linux_adapter.h"
22 #include "slikenet/osx_adapter.h"
23 #include "slikenet/memoryoverride.h"
24
25 using namespace SLNet;
26
27 STATIC_FACTORY_DEFINITIONS(PacketFileLogger,PacketFileLogger);
28
29 PacketFileLogger::PacketFileLogger()
30 {
31 packetLogFile=0;
32 }
33 PacketFileLogger::~PacketFileLogger()
34 {
35 if (packetLogFile)
36 {
37 fflush(packetLogFile);
38 fclose(packetLogFile);
39 }
40 }
41 void PacketFileLogger::StartLog(const char *filenamePrefix)
42 {
43 // Open file for writing
44 char filename[256];
45 if (filenamePrefix)
46 sprintf_s(filename, "%s_%i.csv", filenamePrefix, (int)SLNet::GetTimeMS());
47 else
48 sprintf_s(filename, "PacketLog_%i.csv", (int)SLNet::GetTimeMS());
49 errno_t error = fopen_s(&packetLogFile, filename, "wt");
50 LogHeader();
51 if (error == 0)
52 {
53 fflush(packetLogFile);
54 }
55 }
56
57 void PacketFileLogger::WriteLog(const char *str)
58 {
59 if (packetLogFile)
60 {
61 fprintf(packetLogFile, "%s\n", str);
62 fflush(packetLogFile);
63 }
64 }
65
66 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/FileListTransfer.cpp Source File

  • src
FileListTransfer.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_FileListTransfer==1 && _RAKNET_SUPPORT_FileOperations==1
18
19 #include "slikenet/FileListTransfer.h"
20 #include "slikenet/DS_HuffmanEncodingTree.h"
21 #include "slikenet/FileListTransferCBInterface.h"
22 #include "slikenet/StringCompressor.h"
23 #include "slikenet/FileList.h"
24 #include "slikenet/DS_Queue.h"
25 #include "slikenet/MessageIdentifiers.h"
26 #include "slikenet/types.h"
27 #include "slikenet/peerinterface.h"
28 #include "slikenet/statistics.h"
29 #include "slikenet/IncrementalReadInterface.h"
30 #include "slikenet/assert.h"
31 #include "slikenet/alloca.h"
32
33 namespace SLNet
34 {
35
36 struct FLR_MemoryBlock
37 {
38 char *flrMemoryBlock;
39 };
40
41 struct FileListReceiver
42 {
43 FileListReceiver();
44 ~FileListReceiver();
45 FileListTransferCBInterface *downloadHandler;
46 SystemAddress allowedSender;
47 unsigned short setID;
48 unsigned setCount;
49 unsigned setTotalCompressedTransmissionLength;
50 unsigned setTotalFinalLength;
51 unsigned setTotalDownloadedLength;
52 bool gotSetHeader;
53 bool deleteDownloadHandler;
54 bool isCompressed;
55 int filesReceived;
56 DataStructures::Map<unsigned int, FLR_MemoryBlock> pushedFiles;
57
58 // Notifications
59 unsigned int partLength;
60
61 };
62
63 } // namespace SLNet
64
65 using namespace SLNet;
66
67 FileListReceiver::FileListReceiver() {filesReceived=0; setTotalDownloadedLength=0; partLength=1; DataStructures::Map<unsigned int, FLR_MemoryBlock>::IMPLEMENT_DEFAULT_COMPARISON();}
68 FileListReceiver::~FileListReceiver() {
69 unsigned int i=0;
70 for (i=0; i < pushedFiles.Size(); i++)
71 rakFree_Ex(pushedFiles[i].flrMemoryBlock, _FILE_AND_LINE_ );
72 }
73
74 STATIC_FACTORY_DEFINITIONS(FileListTransfer,FileListTransfer)
75
76 void FileListTransfer::FileToPushRecipient::DeleteThis(void)
77 {
79 for (unsigned int j=0; j < filesToPush.Size(); j++)
80 SLNet::OP_DELETE(filesToPush[j],_FILE_AND_LINE_);
82 SLNet::OP_DELETE(this,_FILE_AND_LINE_);
83 }
84 void FileListTransfer::FileToPushRecipient::AddRef(void)
85 {
86 refCountMutex.Lock();
87 ++refCount;
88 refCountMutex.Unlock();
89 }
90 void FileListTransfer::FileToPushRecipient::Deref(void)
91 {
92 refCountMutex.Lock();
93 --refCount;
94 if (refCount==0)
95 {
96 refCountMutex.Unlock();
97 DeleteThis();
98 return;
99 }
100 refCountMutex.Unlock();
101 }
102 FileListTransfer::FileListTransfer()
103 {
104 setId=0;
105 DataStructures::Map<unsigned short, FileListReceiver*>::IMPLEMENT_DEFAULT_COMPARISON();
106 }
107 FileListTransfer::~FileListTransfer()
108 {
109 threadPool.StopThreads();
110 Clear();
111 }
112 void FileListTransfer::StartIncrementalReadThreads(int numThreads, int threadPriority)
113 {
114 (void) threadPriority;
115
116 threadPool.StartThreads(numThreads, 0);
117 }
118 unsigned short FileListTransfer::SetupReceive(FileListTransferCBInterface *handler, bool deleteHandler, SystemAddress allowedSender)
119 {
120 if (rakPeerInterface && rakPeerInterface->GetConnectionState(allowedSender)!=IS_CONNECTED)
121 return (unsigned short)-1;
122 FileListReceiver *receiver;
123
124 if (fileListReceivers.Has(setId))
125 {
126 receiver=fileListReceivers.Get(setId);
127 receiver->downloadHandler->OnDereference();
128 if (receiver->deleteDownloadHandler)
129 SLNet::OP_DELETE(receiver->downloadHandler, _FILE_AND_LINE_);
130 SLNet::OP_DELETE(receiver, _FILE_AND_LINE_);
131 fileListReceivers.Delete(setId);
132 }
133
134 unsigned short oldId;
135 receiver = SLNet::OP_NEW<FileListReceiver>( _FILE_AND_LINE_ );
136 RakAssert(handler);
137 receiver->downloadHandler=handler;
138 receiver->allowedSender=allowedSender;
139 receiver->gotSetHeader=false;
140 receiver->deleteDownloadHandler=deleteHandler;
141 receiver->setID=setId;
142 fileListReceivers.Set(setId, receiver);
143 oldId=setId;
144 if (++setId==(unsigned short)-1)
145 setId=0;
146 return oldId;
147 }
148
149 void FileListTransfer::Send(FileList *fileList, SLNet::RakPeerInterface *rakPeer, SystemAddress recipient, unsigned short setID, PacketPriority priority, char orderingChannel, IncrementalReadInterface *_incrementalReadInterface, unsigned int _chunkSize)
150 {
151 for (unsigned int flpcIndex=0; flpcIndex < fileListProgressCallbacks.Size(); flpcIndex++)
152 fileList->AddCallback(fileListProgressCallbacks[flpcIndex]);
153
154 unsigned int i, totalLength;
155 SLNet::BitStream outBitstream;
156 bool sendReference;
157 const char *dataBlocks[2];
158 int lengths[2];
159 totalLength=0;
160 for (i=0; i < fileList->fileList.Size(); i++)
161 {
162 const FileListNode &fileListNode = fileList->fileList[i];
163 totalLength+=fileListNode.dataLengthBytes;
164 }
165
166 // Write the chunk header, which contains the frequency table, the total number of files, and the total number of bytes
167 bool anythingToWrite;
168 outBitstream.Write((MessageID)ID_FILE_LIST_TRANSFER_HEADER);
169 outBitstream.Write(setID);
170 anythingToWrite=fileList->fileList.Size()>0;
171 outBitstream.Write(anythingToWrite);
172 if (anythingToWrite)
173 {
174 outBitstream.WriteCompressed(fileList->fileList.Size());
175 outBitstream.WriteCompressed(totalLength);
176
177 if (rakPeer)
178 rakPeer->Send(&outBitstream, priority, RELIABLE_ORDERED, orderingChannel, recipient, false);
179 else
180 SendUnified(&outBitstream, priority, RELIABLE_ORDERED, orderingChannel, recipient, false);
181
182 DataStructures::Queue<FileToPush*> filesToPush;
183
184 for (i=0; i < fileList->fileList.Size(); i++)
185 {
186 sendReference = fileList->fileList[i].isAReference && _incrementalReadInterface!=0;
187 if (sendReference)
188 {
189 FileToPush *fileToPush = SLNet::OP_NEW<FileToPush>(_FILE_AND_LINE_);
190 fileToPush->fileListNode.context=fileList->fileList[i].context;
191 fileToPush->setIndex=i;
192 fileToPush->fileListNode.filename=fileList->fileList[i].filename;
193 fileToPush->fileListNode.fullPathToFile=fileList->fileList[i].fullPathToFile;
194 fileToPush->fileListNode.fileLengthBytes=fileList->fileList[i].fileLengthBytes;
195 fileToPush->fileListNode.dataLengthBytes=fileList->fileList[i].dataLengthBytes;
196 // fileToPush->systemAddress=recipient;
197 //fileToPush->setID=setID;
198 fileToPush->packetPriority=priority;
199 fileToPush->orderingChannel=orderingChannel;
200 fileToPush->currentOffset=0;
201 fileToPush->incrementalReadInterface=_incrementalReadInterface;
202 fileToPush->chunkSize=_chunkSize;
203 filesToPush.Push(fileToPush,_FILE_AND_LINE_);
204 }
205 else
206 {
207 outBitstream.Reset();
208 outBitstream.Write((MessageID)ID_FILE_LIST_TRANSFER_FILE);
209 outBitstream << fileList->fileList[i].context;
210 // outBitstream.Write(fileList->fileList[i].context);
211 outBitstream.Write(setID);
212 StringCompressor::Instance()->EncodeString(fileList->fileList[i].filename, 512, &outBitstream);
213
214 outBitstream.WriteCompressed(i);
215 outBitstream.WriteCompressed(fileList->fileList[i].dataLengthBytes); // Original length in bytes
216
217 outBitstream.AlignWriteToByteBoundary();
218
219 dataBlocks[0]=(char*) outBitstream.GetData();
220 lengths[0]=outBitstream.GetNumberOfBytesUsed();
221 dataBlocks[1]=fileList->fileList[i].data;
222 lengths[1]=fileList->fileList[i].dataLengthBytes;
223 SendListUnified(dataBlocks,lengths,2,priority, RELIABLE_ORDERED, orderingChannel, recipient, false);
224 }
225 }
226
227 if (filesToPush.IsEmpty()==false)
228 {
229 FileToPushRecipient *ftpr;
230
231 fileToPushRecipientListMutex.Lock();
232 for (i=0; i < fileToPushRecipientList.Size(); i++)
233 {
234 if (fileToPushRecipientList[i]->systemAddress==recipient && fileToPushRecipientList[i]->setId==setId)
235 {
236 // ftpr=fileToPushRecipientList[i];
237 // ftpr->AddRef();
238 // break;
239 RakAssert("setId already in use for this recipient" && 0);
240 }
241 }
242 fileToPushRecipientListMutex.Unlock();
243
244 //if (ftpr==0)
245 //{
246 ftpr = SLNet::OP_NEW<FileToPushRecipient>(_FILE_AND_LINE_);
247 ftpr->systemAddress=recipient;
248 ftpr->setId=setID;
249 ftpr->refCount=2; // Allocated and in the list
250 fileToPushRecipientList.Push(ftpr, _FILE_AND_LINE_);
251 //}
252 while (filesToPush.IsEmpty()==false)
253 {
255 ftpr->filesToPush.Push(filesToPush.Pop(), _FILE_AND_LINE_);
257 }
258 // ftpr out of scope
259 ftpr->Deref();
260 SendIRIToAddress(recipient, setID);
261 return;
262 }
263 else
264 {
265 for (unsigned int flpcIndex=0; flpcIndex < fileListProgressCallbacks.Size(); flpcIndex++)
266 fileListProgressCallbacks[flpcIndex]->OnFilePushesComplete(recipient, setID);
267 }
268 }
269 else
270 {
271 for (unsigned int flpcIndex=0; flpcIndex < fileListProgressCallbacks.Size(); flpcIndex++)
272 fileListProgressCallbacks[flpcIndex]->OnFilePushesComplete(recipient, setID);
273
274 if (rakPeer)
275 rakPeer->Send(&outBitstream, priority, RELIABLE_ORDERED, orderingChannel, recipient, false);
276 else
277 SendUnified(&outBitstream, priority, RELIABLE_ORDERED, orderingChannel, recipient, false);
278 }
279 }
280
281 bool FileListTransfer::DecodeSetHeader(Packet *packet)
282 {
283 bool anythingToWrite=false;
284 unsigned short setID;
285 SLNet::BitStream inBitStream(packet->data, packet->length, false);
286 inBitStream.IgnoreBits(8);
287 inBitStream.Read(setID);
288 FileListReceiver *fileListReceiver;
289 if (fileListReceivers.Has(setID)==false)
290 {
291 // If this assert hits you didn't call SetupReceive
292 #ifdef _DEBUG
293 RakAssert(0);
294 #endif
295 return false;
296 }
297 fileListReceiver=fileListReceivers.Get(setID);
298 if (fileListReceiver->allowedSender!=packet->systemAddress)
299 {
300 #ifdef _DEBUG
301 RakAssert(0);
302 #endif
303 return false;
304 }
305
306 #ifdef _DEBUG
307 RakAssert(fileListReceiver->gotSetHeader==false);
308 #endif
309
310 inBitStream.Read(anythingToWrite);
311
312 if (anythingToWrite)
313 {
314 inBitStream.ReadCompressed(fileListReceiver->setCount);
315 if (inBitStream.ReadCompressed(fileListReceiver->setTotalFinalLength))
316 {
317 fileListReceiver->setTotalCompressedTransmissionLength=fileListReceiver->setTotalFinalLength;
318 fileListReceiver->gotSetHeader=true;
319 return true;
320 }
321
322 }
323 else
324 {
325 FileListTransferCBInterface::DownloadCompleteStruct dcs;
326 dcs.setID=fileListReceiver->setID;
327 dcs.numberOfFilesInThisSet=fileListReceiver->setCount;
328 dcs.byteLengthOfThisSet=fileListReceiver->setTotalFinalLength;
329 dcs.senderSystemAddress=packet->systemAddress;
330 dcs.senderGuid=packet->guid;
331
332 if (fileListReceiver->downloadHandler->OnDownloadComplete(&dcs)==false)
333 {
334 fileListReceiver->downloadHandler->OnDereference();
335 fileListReceivers.Delete(setID);
336 if (fileListReceiver->deleteDownloadHandler)
337 SLNet::OP_DELETE(fileListReceiver->downloadHandler, _FILE_AND_LINE_);
338 SLNet::OP_DELETE(fileListReceiver, _FILE_AND_LINE_);
339 }
340
341 return true;
342 }
343
344 return false;
345 }
346
347 bool FileListTransfer::DecodeFile(Packet *packet, bool isTheFullFile)
348 {
349 FileListTransferCBInterface::OnFileStruct onFileStruct;
350 SLNet::BitStream inBitStream(packet->data, packet->length, false);
351 inBitStream.IgnoreBits(8);
352
353 onFileStruct.senderSystemAddress=packet->systemAddress;
354 onFileStruct.senderGuid=packet->guid;
355
356 unsigned int partCount=0;
357 unsigned int partTotal=0;
358 unsigned int partLength=0;
359 onFileStruct.fileData=0;
360 if (isTheFullFile==false)
361 {
362 // Disable endian swapping on reading this, as it's generated locally in ReliabilityLayer.cpp
363 inBitStream.ReadBits( (unsigned char* ) &partCount, BYTES_TO_BITS(sizeof(partCount)), true );
364 inBitStream.ReadBits( (unsigned char* ) &partTotal, BYTES_TO_BITS(sizeof(partTotal)), true );
365 inBitStream.ReadBits( (unsigned char* ) &partLength, BYTES_TO_BITS(sizeof(partLength)), true );
366 inBitStream.IgnoreBits(8);
367 // The header is appended to every chunk, which we continue to read after this statement flrMemoryBlock
368 }
369 inBitStream >> onFileStruct.context;
370 // inBitStream.Read(onFileStruct.context);
371 inBitStream.Read(onFileStruct.setID);
372 FileListReceiver *fileListReceiver;
373 if (fileListReceivers.Has(onFileStruct.setID)==false)
374 {
375 return false;
376 }
377 fileListReceiver=fileListReceivers.Get(onFileStruct.setID);
378 if (fileListReceiver->allowedSender!=packet->systemAddress)
379 {
380 #ifdef _DEBUG
381 RakAssert(0);
382 #endif
383 return false;
384 }
385
386 #ifdef _DEBUG
387 RakAssert(fileListReceiver->gotSetHeader==true);
388 #endif
389
390 if (StringCompressor::Instance()->DecodeString(onFileStruct.fileName, 512, &inBitStream)==false)
391 {
392 #ifdef _DEBUG
393 RakAssert(0);
394 #endif
395 return false;
396 }
397
398 inBitStream.ReadCompressed(onFileStruct.fileIndex);
399 inBitStream.ReadCompressed(onFileStruct.byteLengthOfThisFile);
400
401 onFileStruct.numberOfFilesInThisSet=fileListReceiver->setCount;
402 onFileStruct.byteLengthOfThisSet=fileListReceiver->setTotalFinalLength;
403
404 if (isTheFullFile)
405 {
406 onFileStruct.bytesDownloadedForThisFile=onFileStruct.byteLengthOfThisFile;
407 fileListReceiver->setTotalDownloadedLength+=onFileStruct.byteLengthOfThisFile;
408 onFileStruct.bytesDownloadedForThisSet=fileListReceiver->setTotalDownloadedLength;
409 }
410 else
411 {
412 onFileStruct.bytesDownloadedForThisFile=partLength*partCount;
413 onFileStruct.bytesDownloadedForThisSet=fileListReceiver->setTotalDownloadedLength+onFileStruct.bytesDownloadedForThisFile;
414 }
415
416 // User callback for this file.
417 if (isTheFullFile)
418 {
419 inBitStream.AlignReadToByteBoundary();
420 onFileStruct.fileData = (char*) rakMalloc_Ex( (size_t) onFileStruct.byteLengthOfThisFile, _FILE_AND_LINE_ );
421 inBitStream.Read((char*)onFileStruct.fileData, onFileStruct.byteLengthOfThisFile);
422
423 FileListTransferCBInterface::FileProgressStruct fps;
424 fps.onFileStruct=&onFileStruct;
425 fps.partCount=1;
426 fps.partTotal=1;
427 fps.dataChunkLength=onFileStruct.byteLengthOfThisFile;
428 fps.firstDataChunk=onFileStruct.fileData;
429 fps.iriDataChunk=onFileStruct.fileData;
430 fps.allocateIrIDataChunkAutomatically=true;
431 fps.iriWriteOffset=0;
432 fps.senderSystemAddress=packet->systemAddress;
433 fps.senderGuid=packet->guid;
434 fileListReceiver->downloadHandler->OnFileProgress(&fps);
435
436 // Got a complete file
437 // Either we are using IncrementalReadInterface and it was a small file or
438 // We are not using IncrementalReadInterface
439 if (fileListReceiver->downloadHandler->OnFile(&onFileStruct))
440 rakFree_Ex(onFileStruct.fileData, _FILE_AND_LINE_ );
441
442 fileListReceiver->filesReceived++;
443
444 // If this set is done, free the memory for it.
445 if ((int) fileListReceiver->setCount==fileListReceiver->filesReceived)
446 {
447 FileListTransferCBInterface::DownloadCompleteStruct dcs;
448 dcs.setID=fileListReceiver->setID;
449 dcs.numberOfFilesInThisSet=fileListReceiver->setCount;
450 dcs.byteLengthOfThisSet=fileListReceiver->setTotalFinalLength;
451 dcs.senderSystemAddress=packet->systemAddress;
452 dcs.senderGuid=packet->guid;
453
454 if (fileListReceiver->downloadHandler->OnDownloadComplete(&dcs)==false)
455 {
456 fileListReceiver->downloadHandler->OnDereference();
457 if (fileListReceiver->deleteDownloadHandler)
458 SLNet::OP_DELETE(fileListReceiver->downloadHandler, _FILE_AND_LINE_);
459 fileListReceivers.Delete(onFileStruct.setID);
460 SLNet::OP_DELETE(fileListReceiver, _FILE_AND_LINE_);
461 }
462 }
463
464 }
465 else
466 {
467 inBitStream.AlignReadToByteBoundary();
468
469 char *firstDataChunk;
470 unsigned int unreadBits = inBitStream.GetNumberOfUnreadBits();
471 unsigned int unreadBytes = BITS_TO_BYTES(unreadBits);
472 firstDataChunk=(char*) inBitStream.GetData()+BITS_TO_BYTES(inBitStream.GetReadOffset());
473
474 FileListTransferCBInterface::FileProgressStruct fps;
475 fps.onFileStruct=&onFileStruct;
476 fps.partCount=partCount;
477 fps.partTotal=partTotal;
478 fps.dataChunkLength=unreadBytes;
479 fps.firstDataChunk=firstDataChunk;
480 fps.iriDataChunk=0;
481 fps.allocateIrIDataChunkAutomatically=true;
482 fps.iriWriteOffset=0;
483 fps.senderSystemAddress=packet->systemAddress;
484 fps.senderGuid=packet->guid;
485
486 // Remote system is sending a complete file, but the file is large enough that we get ID_PROGRESS_NOTIFICATION from the transport layer
487 fileListReceiver->downloadHandler->OnFileProgress(&fps);
488
489 }
490
491 return true;
492 }
493 PluginReceiveResult FileListTransfer::OnReceive(Packet *packet)
494 {
495 switch (packet->data[0])
496 {
497 case ID_FILE_LIST_TRANSFER_HEADER:
498 DecodeSetHeader(packet);
499 return RR_STOP_PROCESSING_AND_DEALLOCATE;
500 case ID_FILE_LIST_TRANSFER_FILE:
501 DecodeFile(packet, true);
502 return RR_STOP_PROCESSING_AND_DEALLOCATE;
503 case ID_FILE_LIST_REFERENCE_PUSH:
504 OnReferencePush(packet, true);
505 return RR_STOP_PROCESSING_AND_DEALLOCATE;
506 case ID_FILE_LIST_REFERENCE_PUSH_ACK:
507 OnReferencePushAck(packet);
508 return RR_STOP_PROCESSING_AND_DEALLOCATE;
509 case ID_DOWNLOAD_PROGRESS:
510 if (packet->length>sizeof(MessageID)+sizeof(unsigned int)*3)
511 {
512 if (packet->data[sizeof(MessageID)+sizeof(unsigned int)*3]==ID_FILE_LIST_TRANSFER_FILE)
513 {
514 DecodeFile(packet, false);
515 return RR_STOP_PROCESSING_AND_DEALLOCATE;
516 }
517 if (packet->data[sizeof(MessageID)+sizeof(unsigned int)*3]==ID_FILE_LIST_REFERENCE_PUSH)
518 {
519 OnReferencePush(packet, false);
520 return RR_STOP_PROCESSING_AND_DEALLOCATE;
521 }
522 }
523 break;
524 }
525
526 return RR_CONTINUE_PROCESSING;
527 }
528 void FileListTransfer::OnRakPeerShutdown(void)
529 {
530 threadPool.StopThreads();
531 threadPool.ClearInput();
532 Clear();
533 }
534 void FileListTransfer::Clear(void)
535 {
536 unsigned i;
537 for (i=0; i < fileListReceivers.Size(); i++)
538 {
539 fileListReceivers[i]->downloadHandler->OnDereference();
540 if (fileListReceivers[i]->deleteDownloadHandler)
541 SLNet::OP_DELETE(fileListReceivers[i]->downloadHandler, _FILE_AND_LINE_);
542 SLNet::OP_DELETE(fileListReceivers[i], _FILE_AND_LINE_);
543 }
544 fileListReceivers.Clear();
545
546 fileToPushRecipientListMutex.Lock();
547 for (i=0; i < fileToPushRecipientList.Size(); i++)
548 {
549 FileToPushRecipient *ftpr = fileToPushRecipientList[i];
550 // Taken out of the list
551 ftpr->Deref();
552 }
553 fileToPushRecipientList.Clear(false,_FILE_AND_LINE_);
554 fileToPushRecipientListMutex.Unlock();
555
556 //filesToPush.Clear(false, _FILE_AND_LINE_);
557 }
558 void FileListTransfer::OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason )
559 {
560 (void) lostConnectionReason;
561 (void) rakNetGUID;
562
563 RemoveReceiver(systemAddress);
564 }
565 void FileListTransfer::CancelReceive(unsigned short inSetId)
566 {
567 if (fileListReceivers.Has(inSetId)==false)
568 {
569 #ifdef _DEBUG
570 RakAssert(0);
571 #endif
572 return;
573 }
574 FileListReceiver *fileListReceiver=fileListReceivers.Get(inSetId);
575 fileListReceiver->downloadHandler->OnDereference();
576 if (fileListReceiver->deleteDownloadHandler)
577 SLNet::OP_DELETE(fileListReceiver->downloadHandler, _FILE_AND_LINE_);
578 SLNet::OP_DELETE(fileListReceiver, _FILE_AND_LINE_);
579 fileListReceivers.Delete(inSetId);
580 }
581 void FileListTransfer::RemoveReceiver(SystemAddress systemAddress)
582 {
583 unsigned i;
584 i=0;
585 threadPool.LockInput();
586 while (i < threadPool.InputSize())
587 {
588 if (threadPool.GetInputAtIndex(i).systemAddress==systemAddress)
589 {
590 threadPool.RemoveInputAtIndex(i);
591 }
592 else
593 i++;
594 }
595 threadPool.UnlockInput();
596
597 i=0;
598 while (i < fileListReceivers.Size())
599 {
600 if (fileListReceivers[i]->allowedSender==systemAddress)
601 {
602 fileListReceivers[i]->downloadHandler->OnDereference();
603 if (fileListReceivers[i]->deleteDownloadHandler)
604 SLNet::OP_DELETE(fileListReceivers[i]->downloadHandler, _FILE_AND_LINE_);
605 SLNet::OP_DELETE(fileListReceivers[i], _FILE_AND_LINE_);
606 fileListReceivers.RemoveAtIndex(i);
607 }
608 else
609 i++;
610 }
611
612 fileToPushRecipientListMutex.Lock();
613 i=0;
614 while (i < fileToPushRecipientList.Size())
615 {
616 if (fileToPushRecipientList[i]->systemAddress==systemAddress)
617 {
618 FileToPushRecipient *ftpr = fileToPushRecipientList[i];
619
620 // Tell the user that this recipient was lost
621 for (unsigned int flpcIndex=0; flpcIndex < fileListProgressCallbacks.Size(); flpcIndex++)
622 fileListProgressCallbacks[flpcIndex]->OnSendAborted(ftpr->systemAddress);
623
624 fileToPushRecipientList.RemoveAtIndex(i);
625 // Taken out of the list
626 ftpr->Deref();
627 }
628 else
629 {
630 i++;
631 }
632 }
633 fileToPushRecipientListMutex.Unlock();
634 }
635 bool FileListTransfer::IsHandlerActive(unsigned short inSetId)
636 {
637 return fileListReceivers.Has(inSetId);
638 }
639 void FileListTransfer::AddCallback(FileListProgress *cb)
640 {
641 if (cb==0)
642 return;
643
644 if (fileListProgressCallbacks.GetIndexOf(cb)==(unsigned int) -1)
645 fileListProgressCallbacks.Push(cb, _FILE_AND_LINE_);
646 }
647 void FileListTransfer::RemoveCallback(FileListProgress *cb)
648 {
649 unsigned int idx = fileListProgressCallbacks.GetIndexOf(cb);
650 if (idx!=(unsigned int) -1)
651 fileListProgressCallbacks.RemoveAtIndex(idx);
652 }
653 void FileListTransfer::ClearCallbacks(void)
654 {
655 fileListProgressCallbacks.Clear(true, _FILE_AND_LINE_);
656 }
657 void FileListTransfer::GetCallbacks(DataStructures::List<FileListProgress*> &callbacks)
658 {
659 callbacks = fileListProgressCallbacks;
660 }
661
662 void FileListTransfer::Update(void)
663 {
664 unsigned i;
665 i=0;
666 while (i < fileListReceivers.Size())
667 {
668 if (fileListReceivers[i]->downloadHandler->Update()==false)
669 {
670 fileListReceivers[i]->downloadHandler->OnDereference();
671 if (fileListReceivers[i]->deleteDownloadHandler)
672 SLNet::OP_DELETE(fileListReceivers[i]->downloadHandler, _FILE_AND_LINE_);
673 SLNet::OP_DELETE(fileListReceivers[i], _FILE_AND_LINE_);
674 fileListReceivers.RemoveAtIndex(i);
675 }
676 else
677 i++;
678 }
679 }
680 void FileListTransfer::OnReferencePush(Packet *packet, bool isTheFullFile)
681 {
682 SLNet::BitStream refPushAck;
683 if (isTheFullFile==false)
684 {
685 // 12/23/09 Why do I care about ID_DOWNLOAD_PROGRESS for reference pushes?
686 // 2/16/2012 I care because a reference push is 16 megabytes by default. Also, if it is the last file "if (ftpr->filesToPush.Size()<2)" or total file size exceeds smallFileTotalSize it always sends a reference push.
687 // return;
688 }
689
690 FileListTransferCBInterface::OnFileStruct onFileStruct;
691 SLNet::BitStream inBitStream(packet->data, packet->length, false);
692 inBitStream.IgnoreBits(8);
693
694 unsigned int partCount=0;
695 unsigned int partTotal=1;
696 unsigned int partLength=0;
697 onFileStruct.fileData=0;
698 if (isTheFullFile==false)
699 {
700 // Disable endian swapping on reading this, as it's generated locally in ReliabilityLayer.cpp
701 inBitStream.ReadBits( (unsigned char* ) &partCount, BYTES_TO_BITS(sizeof(partCount)), true );
702 inBitStream.ReadBits( (unsigned char* ) &partTotal, BYTES_TO_BITS(sizeof(partTotal)), true );
703 inBitStream.ReadBits( (unsigned char* ) &partLength, BYTES_TO_BITS(sizeof(partLength)), true );
704 inBitStream.IgnoreBits(8);
705 // The header is appended to every chunk, which we continue to read after this statement flrMemoryBlock
706 }
707
708 inBitStream >> onFileStruct.context;
709 inBitStream.Read(onFileStruct.setID);
710
711 // This is not a progress notification, it is actually the entire packet
712 if (isTheFullFile==true)
713 {
714 refPushAck.Write((MessageID)ID_FILE_LIST_REFERENCE_PUSH_ACK);
715 refPushAck.Write(onFileStruct.setID);
716 SendUnified(&refPushAck,HIGH_PRIORITY, RELIABLE, 0, packet->systemAddress, false);
717 }
718
719 // inBitStream.Read(onFileStruct.context);
720 FileListReceiver *fileListReceiver;
721 if (fileListReceivers.Has(onFileStruct.setID)==false)
722 {
723 return;
724 }
725 fileListReceiver=fileListReceivers.Get(onFileStruct.setID);
726 if (fileListReceiver->allowedSender!=packet->systemAddress)
727 {
728 #ifdef _DEBUG
729 RakAssert(0);
730 #endif
731 return;
732 }
733
734 #ifdef _DEBUG
735 RakAssert(fileListReceiver->gotSetHeader==true);
736 #endif
737
738 if (StringCompressor::Instance()->DecodeString(onFileStruct.fileName, 512, &inBitStream)==false)
739 {
740 #ifdef _DEBUG
741 RakAssert(0);
742 #endif
743 return;
744 }
745
746 inBitStream.ReadCompressed(onFileStruct.fileIndex);
747 inBitStream.ReadCompressed(onFileStruct.byteLengthOfThisFile);
748 unsigned int offset;
749 unsigned int chunkLength;
750 inBitStream.ReadCompressed(offset);
751 inBitStream.ReadCompressed(chunkLength);
752
753 bool lastChunk=false;
754 inBitStream.Read(lastChunk);
755 bool finished = lastChunk && isTheFullFile;
756
757 if (isTheFullFile==false)
758 fileListReceiver->partLength=partLength;
759
760 FLR_MemoryBlock mb;
761 if (fileListReceiver->pushedFiles.Has(onFileStruct.fileIndex)==false)
762 {
763 if (onFileStruct.byteLengthOfThisFile <= SLNET_MAX_RETRIEVABLE_FILESIZE)
764 mb.flrMemoryBlock = (char*)rakMalloc_Ex(onFileStruct.byteLengthOfThisFile, _FILE_AND_LINE_);
765 else
766 mb.flrMemoryBlock = nullptr;
767 fileListReceiver->pushedFiles.SetNew(onFileStruct.fileIndex, mb);
768 }
769 else
770 {
771 mb=fileListReceiver->pushedFiles.Get(onFileStruct.fileIndex);
772 }
773
774 unsigned int unreadBits = inBitStream.GetNumberOfUnreadBits();
775 unsigned int unreadBytes = BITS_TO_BYTES(unreadBits);
776 unsigned int amountToRead;
777 if (isTheFullFile)
778 amountToRead=chunkLength;
779 else
780 amountToRead=unreadBytes;
781
782 inBitStream.AlignReadToByteBoundary();
783
784 FileListTransferCBInterface::FileProgressStruct fps;
785
786 if (isTheFullFile)
787 {
788 if (mb.flrMemoryBlock)
789 {
790 // Either the very first block, or a subsequent block and allocateIrIDataChunkAutomatically was true for the first block
791 memcpy(mb.flrMemoryBlock+offset, inBitStream.GetData()+BITS_TO_BYTES(inBitStream.GetReadOffset()), amountToRead);
792 fps.iriDataChunk=mb.flrMemoryBlock+offset;
793 }
794 else
795 {
796 // In here mb.flrMemoryBlock is null
797 // This means the first block explicitly deallocated the memory, and no blocks will be permanently held by RakNet
798 fps.iriDataChunk=(char*) inBitStream.GetData()+BITS_TO_BYTES(inBitStream.GetReadOffset());
799 }
800
801 onFileStruct.bytesDownloadedForThisFile=offset+chunkLength;
802 fileListReceiver->setTotalDownloadedLength+=chunkLength;
803 onFileStruct.bytesDownloadedForThisSet=fileListReceiver->setTotalDownloadedLength;
804 }
805 else
806 {
807 onFileStruct.bytesDownloadedForThisFile=offset+partLength*partCount;
808 onFileStruct.bytesDownloadedForThisSet=fileListReceiver->setTotalDownloadedLength+partCount*partLength;
809 fps.iriDataChunk=(char*) inBitStream.GetData()+BITS_TO_BYTES(inBitStream.GetReadOffset());
810 }
811
812 onFileStruct.numberOfFilesInThisSet=fileListReceiver->setCount;
813 // onFileStruct.setTotalCompressedTransmissionLength=fileListReceiver->setTotalCompressedTransmissionLength;
814 onFileStruct.byteLengthOfThisSet=fileListReceiver->setTotalFinalLength;
815 // Note: mb.flrMemoryBlock may be null here
816 onFileStruct.fileData=mb.flrMemoryBlock;
817 onFileStruct.senderSystemAddress=packet->systemAddress;
818 onFileStruct.senderGuid=packet->guid;
819
820 unsigned int totalNotifications;
821 unsigned int currentNotificationIndex;
822 if (chunkLength==0 || chunkLength==onFileStruct.byteLengthOfThisFile)
823 totalNotifications=1;
824 else
825 totalNotifications = onFileStruct.byteLengthOfThisFile / chunkLength + 1;
826
827 if (chunkLength==0)
828 currentNotificationIndex = 0;
829 else
830 currentNotificationIndex = offset / chunkLength;
831
832 fps.onFileStruct=&onFileStruct;
833 fps.partCount=currentNotificationIndex;
834 fps.partTotal=totalNotifications;
835 fps.dataChunkLength=amountToRead;
836 fps.firstDataChunk=mb.flrMemoryBlock;
837 fps.allocateIrIDataChunkAutomatically=true;
838 fps.onFileStruct->fileData=mb.flrMemoryBlock;
839 fps.iriWriteOffset=offset;
840 fps.senderSystemAddress=packet->systemAddress;
841 fps.senderGuid=packet->guid;
842
843 if (finished)
844 {
845 char *oldFileData=fps.onFileStruct->fileData;
846 if (fps.partCount==0)
847 fps.firstDataChunk=fps.iriDataChunk;
848 if (fps.partTotal==1)
849 fps.onFileStruct->fileData=fps.iriDataChunk;
850 fileListReceiver->downloadHandler->OnFileProgress(&fps);
851
852 // Incremental read interface sent us a file chunk
853 // This is the last file chunk we were waiting for to consider the file done
854 if (fileListReceiver->downloadHandler->OnFile(&onFileStruct))
855 rakFree_Ex(oldFileData, _FILE_AND_LINE_ );
856 fileListReceiver->pushedFiles.Delete(onFileStruct.fileIndex);
857
858 fileListReceiver->filesReceived++;
859
860 // If this set is done, free the memory for it.
861 if ((int) fileListReceiver->setCount==fileListReceiver->filesReceived)
862 {
863 FileListTransferCBInterface::DownloadCompleteStruct dcs;
864 dcs.setID=fileListReceiver->setID;
865 dcs.numberOfFilesInThisSet=fileListReceiver->setCount;
866 dcs.byteLengthOfThisSet=fileListReceiver->setTotalFinalLength;
867 dcs.senderSystemAddress=packet->systemAddress;
868 dcs.senderGuid=packet->guid;
869
870 if (fileListReceiver->downloadHandler->OnDownloadComplete(&dcs)==false)
871 {
872 fileListReceiver->downloadHandler->OnDereference();
873 fileListReceivers.Delete(onFileStruct.setID);
874 if (fileListReceiver->deleteDownloadHandler)
875 SLNet::OP_DELETE(fileListReceiver->downloadHandler, _FILE_AND_LINE_);
876 SLNet::OP_DELETE(fileListReceiver, _FILE_AND_LINE_);
877 }
878 }
879 }
880 else
881 {
882 if (isTheFullFile)
883 {
884 // 12/23/09 Don't use OnReferencePush anymore, just use OnFileProgress
885 fileListReceiver->downloadHandler->OnFileProgress(&fps);
886
887 if (fps.allocateIrIDataChunkAutomatically==false)
888 {
889 rakFree_Ex(fileListReceiver->pushedFiles.Get(onFileStruct.fileIndex).flrMemoryBlock, _FILE_AND_LINE_ );
890 fileListReceiver->pushedFiles.Get(onFileStruct.fileIndex).flrMemoryBlock=0;
891 }
892 }
893 else
894 {
895 // This is a download progress notification for a file chunk using incremental read interface
896 // We don't have all the data for this chunk yet
897
898 totalNotifications = onFileStruct.byteLengthOfThisFile / fileListReceiver->partLength + 1;
899 if (isTheFullFile==false)
900 currentNotificationIndex = (offset+partCount*fileListReceiver->partLength) / fileListReceiver->partLength ;
901 else
902 currentNotificationIndex = (offset+chunkLength) / fileListReceiver->partLength ;
903 unreadBytes = onFileStruct.byteLengthOfThisFile - ((currentNotificationIndex+1) * fileListReceiver->partLength);
904 fps.partCount=currentNotificationIndex;
905 fps.partTotal=totalNotifications;
906
907 // 2/19/2013 Why was this check here? It prevent smaller progress notifications
908 // if (rakPeerInterface)
909 {
910 // Thus chunk is incomplete
911 fps.iriDataChunk=0;
912
913 fileListReceiver->downloadHandler->OnFileProgress(&fps);
914 }
915 }
916 }
917
918 return;
919 }
920 namespace SLNet
921 {
922
923 /*
924 SendIRIToAddress - executes from Send(). =
925 1, Find the recipient to send for
926 2. Send ID_FILE_LIST_TRANSFER_FILE for each small file in the queue of ifles to be sent
927 3. If the file we are working on is done, remove it from the list
928 4. Send ID_FILE_LIST_REFERENCE_PUSH for the file we are working on
929
930 File sender:
931 ID_FILE_LIST_REFERENCE_PUSH sent from end of SendIRIToAddressCB
932
933 Recipient:
934 send ID_FILE_LIST_REFERENCE_PUSH_ACK sent from OnReferencePush() when 2nd parameter is true.
935
936 File sender:
937 Got ID_FILE_LIST_REFERENCE_PUSH_ACK. Calls OnReferencePushAck, calls SendIRIToAddress, calls SendIRIToAddressCB
938 */
939
940 int SendIRIToAddressCB(FileListTransfer::ThreadData threadData, bool *returnOutput, void* perThreadData)
941 {
942 (void) perThreadData;
943
944 FileListTransfer *fileListTransfer = threadData.fileListTransfer;
945 SystemAddress systemAddress = threadData.systemAddress;
946 unsigned short setId = threadData.setId;
947 *returnOutput=false;
948
949 // Was previously using GetStatistics to get outgoing buffer size, but TCP with UnifiedSend doesn't have this
950 unsigned int bytesRead;
951 const char *dataBlocks[2];
952 int lengths[2];
953 unsigned int smallFileTotalSize=0;
954 SLNet::BitStream outBitstream;
955 unsigned int ftpIndex;
956
957 fileListTransfer->fileToPushRecipientListMutex.Lock();
958 for (ftpIndex=0; ftpIndex < fileListTransfer->fileToPushRecipientList.Size(); ftpIndex++)
959 {
960 FileListTransfer::FileToPushRecipient *ftpr = fileListTransfer->fileToPushRecipientList[ftpIndex];
961 // Referenced by both ftpr and list
962 ftpr->AddRef();
963
964 fileListTransfer->fileToPushRecipientListMutex.Unlock();
965
966 if (ftpr->systemAddress==systemAddress && ftpr->setId==setId)
967 {
968 FileListTransfer::FileToPush *ftp;
970 ftp = ftpr->filesToPush.Pop();
972
973 // Read and send chunk. If done, delete at this index
974 void *buff = rakMalloc_Ex(ftp->chunkSize, _FILE_AND_LINE_);
975 if (buff==0)
976 {
978 ftpr->filesToPush.PushAtHead(ftp,0,_FILE_AND_LINE_);
980
981 ftpr->Deref();
982 notifyOutOfMemory(_FILE_AND_LINE_);
983 return 0;
984 }
985
986 // Read the next file chunk
987 bytesRead=ftp->incrementalReadInterface->GetFilePart(ftp->fileListNode.fullPathToFile, ftp->currentOffset, ftp->chunkSize, buff, ftp->fileListNode.context);
988
989 bool done = ftp->fileListNode.dataLengthBytes == ftp->currentOffset+bytesRead;
990 while (done && ftp->currentOffset==0 && smallFileTotalSize<ftp->chunkSize)
991 {
993 // The reason for 2 is that ID_FILE_LIST_REFERENCE_PUSH gets ID_FILE_LIST_REFERENCE_PUSH_ACK. WIthout ID_FILE_LIST_REFERENCE_PUSH_ACK, SendIRIToAddressCB would not be called again
994 if (ftpr->filesToPush.Size()<2)
995 {
997 break;
998 }
1000
1001 // Send all small files at once, rather than wait for ID_FILE_LIST_REFERENCE_PUSH. But at least one ID_FILE_LIST_REFERENCE_PUSH must be sent
1002 outBitstream.Reset();
1003 outBitstream.Write((MessageID)ID_FILE_LIST_TRANSFER_FILE);
1004 // outBitstream.Write(ftp->fileListNode.context);
1005 outBitstream << ftp->fileListNode.context;
1006 outBitstream.Write(setId);
1007 StringCompressor::Instance()->EncodeString(ftp->fileListNode.filename, 512, &outBitstream);
1008 outBitstream.WriteCompressed(ftp->setIndex);
1009 outBitstream.WriteCompressed(ftp->fileListNode.dataLengthBytes); // Original length in bytes
1010 outBitstream.AlignWriteToByteBoundary();
1011 dataBlocks[0]=(char*) outBitstream.GetData();
1012 lengths[0]=outBitstream.GetNumberOfBytesUsed();
1013 dataBlocks[1]=(const char*) buff;
1014 lengths[1]=bytesRead;
1015
1016 fileListTransfer->SendListUnified(dataBlocks,lengths,2,ftp->packetPriority, RELIABLE_ORDERED, ftp->orderingChannel, systemAddress, false);
1017
1018 // LWS : fixed freed pointer reference
1019 // unsigned int chunkSize = ftp->chunkSize;
1020 SLNet::OP_DELETE(ftp,_FILE_AND_LINE_);
1021 smallFileTotalSize+=bytesRead;
1022 //done = bytesRead!=ftp->chunkSize;
1024 ftp = ftpr->filesToPush.Pop();
1026
1027 bytesRead=ftp->incrementalReadInterface->GetFilePart(ftp->fileListNode.fullPathToFile, ftp->currentOffset, ftp->chunkSize, buff, ftp->fileListNode.context);
1028 done = ftp->fileListNode.dataLengthBytes == ftp->currentOffset+bytesRead;
1029 }
1030
1031
1032 outBitstream.Reset();
1033 outBitstream.Write((MessageID)ID_FILE_LIST_REFERENCE_PUSH);
1034 // outBitstream.Write(ftp->fileListNode.context);
1035 outBitstream << ftp->fileListNode.context;
1036 outBitstream.Write(setId);
1037 StringCompressor::Instance()->EncodeString(ftp->fileListNode.filename, 512, &outBitstream);
1038 outBitstream.WriteCompressed(ftp->setIndex);
1039 outBitstream.WriteCompressed(ftp->fileListNode.dataLengthBytes); // Original length in bytes
1040 outBitstream.WriteCompressed(ftp->currentOffset);
1041 ftp->currentOffset+=bytesRead;
1042 outBitstream.WriteCompressed(bytesRead);
1043 outBitstream.Write(done);
1044
1045 for (unsigned int flpcIndex=0; flpcIndex < fileListTransfer->fileListProgressCallbacks.Size(); flpcIndex++)
1046 fileListTransfer->fileListProgressCallbacks[flpcIndex]->OnFilePush(ftp->fileListNode.filename, ftp->fileListNode.fileLengthBytes, ftp->currentOffset-bytesRead, bytesRead, done, systemAddress, setId);
1047
1048 dataBlocks[0]=(char*) outBitstream.GetData();
1049 lengths[0]=outBitstream.GetNumberOfBytesUsed();
1050 dataBlocks[1]=(char*) buff;
1051 lengths[1]=bytesRead;
1052 //rakPeerInterface->SendList(dataBlocks,lengths,2,ftp->packetPriority, RELIABLE_ORDERED, ftp->orderingChannel, ftp->systemAddress, false);
1053 char orderingChannel = ftp->orderingChannel;
1054 PacketPriority packetPriority = ftp->packetPriority;
1055
1056 // Mutex state: FileToPushRecipient (ftpr) has AddRef. fileToPushRecipientListMutex not locked.
1057 if (done)
1058 {
1059 // Done
1060 //unsigned short setId = ftp->setID;
1061 SLNet::OP_DELETE(ftp,_FILE_AND_LINE_);
1062
1064 if (ftpr->filesToPush.Size()==0)
1065 {
1067
1068 for (unsigned int flpcIndex=0; flpcIndex < fileListTransfer->fileListProgressCallbacks.Size(); flpcIndex++)
1069 fileListTransfer->fileListProgressCallbacks[flpcIndex]->OnFilePushesComplete(systemAddress, setId);
1070
1071 // Remove ftpr from fileToPushRecipientList
1072 fileListTransfer->RemoveFromList(ftpr);
1073 }
1074 else
1075 {
1077 }
1078 }
1079 else
1080 {
1082 ftpr->filesToPush.PushAtHead(ftp,0,_FILE_AND_LINE_);
1084 }
1085 // ftpr out of scope
1086 ftpr->Deref();
1087
1088 // 2/12/2012 Moved this line at after the if (done) block above.
1089 // See http://www.jenkinssoftware.com/forum/index.php?topic=4768.msg19738#msg19738
1090 fileListTransfer->SendListUnified(dataBlocks,lengths,2, packetPriority, RELIABLE_ORDERED, orderingChannel, systemAddress, false);
1091
1092 rakFree_Ex(buff, _FILE_AND_LINE_ );
1093 return 0;
1094 }
1095 else
1096 {
1097 ftpr->Deref();
1098 fileListTransfer->fileToPushRecipientListMutex.Lock();
1099 }
1100 }
1101
1102 fileListTransfer->fileToPushRecipientListMutex.Unlock();
1103
1104 return 0;
1105 }
1106 }
1107 void FileListTransfer::SendIRIToAddress(SystemAddress systemAddress, unsigned short inSetId)
1108 {
1109 ThreadData threadData;
1110 threadData.fileListTransfer=this;
1111 threadData.systemAddress=systemAddress;
1112 threadData.setId= inSetId;
1113
1114 if (threadPool.WasStarted())
1115 {
1116 threadPool.AddInput(SendIRIToAddressCB, threadData);
1117 }
1118 else
1119 {
1120 bool doesNothing;
1121 SendIRIToAddressCB(threadData, &doesNothing, 0);
1122 }
1123 }
1124 void FileListTransfer::OnReferencePushAck(Packet *packet)
1125 {
1126 SLNet::BitStream inBitStream(packet->data, packet->length, false);
1127 inBitStream.IgnoreBits(8);
1128 unsigned short curSetId;
1129 inBitStream.Read(curSetId);
1130 SendIRIToAddress(packet->systemAddress, curSetId);
1131 }
1132 void FileListTransfer::RemoveFromList(FileToPushRecipient *ftpr)
1133 {
1134 fileToPushRecipientListMutex.Lock();
1135 for (unsigned int i=0; i < fileToPushRecipientList.Size(); i++)
1136 {
1137 if (fileToPushRecipientList[i]==ftpr)
1138 {
1139 fileToPushRecipientList.RemoveAtIndex(i);
1140 // List no longer references
1141 ftpr->Deref();
1142 fileToPushRecipientListMutex.Unlock();
1143 return;
1144 }
1145 }
1146 fileToPushRecipientListMutex.Unlock();
1147 }
1148 unsigned int FileListTransfer::GetPendingFilesToAddress(SystemAddress recipient)
1149 {
1150 fileToPushRecipientListMutex.Lock();
1151 for (unsigned int i=0; i < fileToPushRecipientList.Size(); i++)
1152 {
1153 if (fileToPushRecipientList[i]->systemAddress==recipient)
1154 {
1155 unsigned int size = fileToPushRecipientList[i]->filesToPush.Size();
1156 fileToPushRecipientListMutex.Unlock();
1157 return size;
1158 }
1159 }
1160 fileToPushRecipientListMutex.Unlock();
1161
1162 return 0;
1163 }
1164
1165 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/StringCompressor.h Source File

  • include
  • slikenet
StringCompressor.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21
22 #ifndef __STRING_COMPRESSOR_H
23 #define __STRING_COMPRESSOR_H
24
25 #include "Export.h"
26 #include "DS_Map.h"
27 #include "memoryoverride.h"
28 #include "NativeTypes.h"
29
30 #ifdef _STD_STRING_COMPRESSOR
31 #include <string>
32 #endif
33
35 namespace SLNet
36 {
37 class BitStream;
38 class RakString;
39 };
40
41
42 namespace SLNet
43 {
45 class HuffmanEncodingTree;
46
51 class RAK_DLL_EXPORT StringCompressor
52 {
53 public:
54
55 // Destructor
56 ~StringCompressor();
57
61 static StringCompressor* Instance(void);
62
68 void GenerateTreeFromStrings( unsigned char *input, unsigned inputLength, uint8_t languageId );
69
75 void EncodeString( const char *input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId=0 );
76
82 bool DecodeString( char *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId=0 );
83
84 #ifdef _CSTRING_COMPRESSOR
85 void EncodeString( const CString &input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId=0 );
86 bool DecodeString( CString &output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId=0 );
87 #endif
88
89 #ifdef _STD_STRING_COMPRESSOR
90 void EncodeString( const std::string &input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId=0 );
91 bool DecodeString( std::string *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId=0 );
92 #endif
93
94 void EncodeString( const SLNet::RakString *input, int maxCharsToWrite, SLNet::BitStream *output, uint8_t languageId=0 );
95 bool DecodeString(SLNet::RakString *output, int maxCharsToWrite, SLNet::BitStream *input, uint8_t languageId=0 );
96
98 static void AddReference(void);
99
101 static void RemoveReference(void);
102
103 StringCompressor();
104
105 private:
106
108 static StringCompressor *instance;
109
111 DataStructures::Map<int, HuffmanEncodingTree *> huffmanEncodingTrees;
112
113 static int referenceCount;
114 };
115
116 } // namespace SLNet
117
118 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • Table
  • Row
DataStructures::Table::Row Member List

This is the complete list of members for DataStructures::Table::Row, including all inherited members.

cells | DataStructures::Table::Row
UpdateCell(unsigned columnIndex, double value) | DataStructures::Table::Row
UpdateCell(unsigned columnIndex, const char *str) | DataStructures::Table::Row
UpdateCell(unsigned columnIndex, int byteLength, const char *data) | DataStructures::Table::Row
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SimpleTCPServer.h Source File

  • include
  • slikenet
SimpleTCPServer.h
Go to the documentation of this file.
1 /*
2 * This file was taken from RakNet 4.082 without any modifications.
3 * Please see licenses/RakNet license.txt for the underlying license and related copyright.
4 */
5
6 // Eraseme
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/IncrementalReadInterface.cpp Source File

  • src
IncrementalReadInterface.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/IncrementalReadInterface.h"
17 #include <stdio.h>
18 #include "slikenet/linux_adapter.h"
19 #include "slikenet/osx_adapter.h"
20
21 using namespace SLNet;
22
23 unsigned int IncrementalReadInterface::GetFilePart( const char *filename, unsigned int startReadBytes, unsigned int numBytesToRead, void *preallocatedDestination, FileListNodeContext context)
24 {
25 FILE *fp;
26 if (fopen_s(&fp, filename, "rb")!=0)
27 return 0;
28 fseek(fp,startReadBytes,SEEK_SET);
29 unsigned int numRead = (unsigned int) fread(preallocatedDestination,1,numBytesToRead, fp);
30 fclose(fp);
31 return numRead;
32 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SuperFastHash.h Source File

  • include
  • slikenet
SuperFastHash.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __SUPER_FAST_HASH_H
12 #define __SUPER_FAST_HASH_H
13
14 #include <stdio.h>
15 #include "NativeTypes.h"
16
17 // From http://www.azillionmonkeys.com/qed/hash.html
18 // Author of main code is Paul Hsieh
19 // I just added some convenience functions
20 // Also note http://burtleburtle.net/bob/hash/doobs.html, which shows that this is 20% faster than the one on that page but has more collisions
21
22 uint32_t SuperFastHash (const char * data, int length);
23 uint32_t SuperFastHashIncremental (const char * data, int len, unsigned int lastHash );
24 uint32_t SuperFastHashFile (const char * filename);
25 uint32_t SuperFastHashFilePtr (FILE *fp);
26
27 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • MemoryPool
DataStructures::MemoryPool< MemoryBlockType > Member List

This is the complete list of members for DataStructures::MemoryPool< MemoryBlockType >, including all inherited members.

Allocate(const char *file, unsigned int line) | DataStructures::MemoryPool< MemoryBlockType > |
AllocateFirst(void) | DataStructures::MemoryPool< MemoryBlockType > | protected
availablePages | DataStructures::MemoryPool< MemoryBlockType > | protected
availablePagesSize | DataStructures::MemoryPool< MemoryBlockType > | protected
BlocksPerPage(void) const | DataStructures::MemoryPool< MemoryBlockType > | protected
Clear(const char *file, unsigned int line) | DataStructures::MemoryPool< MemoryBlockType > |
GetAvailablePagesSize(void) const | DataStructures::MemoryPool< MemoryBlockType > | inline
GetMemoryPoolPageSize(void) const | DataStructures::MemoryPool< MemoryBlockType > | inline
GetUnavailablePagesSize(void) const | DataStructures::MemoryPool< MemoryBlockType > | inline
InitPage(Page *page, Page *prev, const char *file, unsigned int line) | DataStructures::MemoryPool< MemoryBlockType > | protected
MemoryPool() | DataStructures::MemoryPool< MemoryBlockType > |
memoryPoolPageSize | DataStructures::MemoryPool< MemoryBlockType > | protected
Release(MemoryBlockType *m, const char *file, unsigned int line) | DataStructures::MemoryPool< MemoryBlockType > |
SetPageSize(int size) | DataStructures::MemoryPool< MemoryBlockType > |
unavailablePages | DataStructures::MemoryPool< MemoryBlockType > | protected
unavailablePagesSize | DataStructures::MemoryPool< MemoryBlockType > | protected
~MemoryPool() | DataStructures::MemoryPool< MemoryBlockType > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/LogCommandParser.h Source File

  • include
  • slikenet
LogCommandParser.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20 #include "NativeFeatureIncludes.h"
21 #if _RAKNET_SUPPORT_LogCommandParser==1
22
23 #ifndef __LOG_COMMAND_PARSER
24 #define __LOG_COMMAND_PARSER
25
26 #include "CommandParserInterface.h"
27 #include "Export.h"
28
29 namespace SLNet
30 {
32 class RakPeerInterface;
33
35 class RAK_DLL_EXPORT LogCommandParser : public CommandParserInterface
36 {
37 public:
38 // GetInstance() and DestroyInstance(instance*)
39 STATIC_FACTORY_DECLARATIONS(LogCommandParser)
40
41 LogCommandParser();
42 ~LogCommandParser();
43
51 bool OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString);
52
56 const char *GetName(void) const;
57
61 void SendHelp(TransportInterface *transport, const SystemAddress &systemAddress);
62
64 // If you call Log with a channel that is unknown, that channel will automatically be added
66 void AddChannel(const char *channelName);
67
72 void WriteLog(const char *channelName, const char *format, ...);
73
77 void OnNewIncomingConnection(const SystemAddress &systemAddress, TransportInterface *transport);
78
82 void OnConnectionLost(const SystemAddress &systemAddress, TransportInterface *transport);
83
87 void OnTransportChange(TransportInterface *transport);
88 protected:
92 void PrintChannels(const SystemAddress &systemAddress, TransportInterface *transport) const;
93
97 unsigned Unsubscribe(const SystemAddress &systemAddress, const char *channelName);
98
102 unsigned Subscribe(const SystemAddress &systemAddress, const char *channelName);
103
106 unsigned GetChannelIndexFromName(const char *channelName);
107
109 struct SystemAddressAndChannel
110 {
112 SystemAddress systemAddress;
113
115 unsigned channels;
116 };
117
119 DataStructures::List<SystemAddressAndChannel> remoteUsers;
120
122 const char *channelNames[32];
123
125 TransportInterface *trans;
126 };
127
128 } // namespace SLNet
129
130 #endif
131
132 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FormatString.h Source File

  • include
  • slikenet
FormatString.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
13
14
15 #ifndef __FORMAT_STRING_H
16 #define __FORMAT_STRING_H
17
18 #include "Export.h"
19
20 extern "C" {
21 char * FormatString(const char *format, ...);
22 }
23 // Threadsafe
24 extern "C" {
25 char * FormatStringTS(char *output, const char *format, ...);
26 }
27
28
29 #endif
30
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • DataStructures
  • LinkedList
DataStructures::LinkedList< LinkedListType > Member List

This is the complete list of members for DataStructures::LinkedList< LinkedListType >, including all inherited members.

Add(const LinkedListType &input) | DataStructures::CircularLinkedList< LinkedListType > |
Beginning(void) | DataStructures::CircularLinkedList< LinkedListType > |
CircularLinkedList() | DataStructures::CircularLinkedList< LinkedListType > |
CircularLinkedList(const CircularLinkedList &original_copy) | DataStructures::CircularLinkedList< LinkedListType > |
Clear(void) | DataStructures::CircularLinkedList< LinkedListType > |
Concatenate(const CircularLinkedList &L) | DataStructures::CircularLinkedList< LinkedListType > |
Del(void) | DataStructures::CircularLinkedList< LinkedListType > |
End(void) | DataStructures::CircularLinkedList< LinkedListType > |
Find(const LinkedListType &input) | DataStructures::CircularLinkedList< LinkedListType > |
FindPointer(const LinkedListType &input) | DataStructures::CircularLinkedList< LinkedListType > | protected
Insert(const LinkedListType &input) | DataStructures::CircularLinkedList< LinkedListType > |
IsIn(const LinkedListType &input) | DataStructures::CircularLinkedList< LinkedListType > |
LinkedList() | DataStructures::LinkedList< LinkedListType > | inline
LinkedList(const LinkedList &original_copy) | DataStructures::LinkedList< LinkedListType > |
list_size | DataStructures::CircularLinkedList< LinkedListType > | protected
operator++() | DataStructures::LinkedList< LinkedListType > |
operator++(int) | DataStructures::LinkedList< LinkedListType > |
operator--() | DataStructures::LinkedList< LinkedListType > |
operator--(int) | DataStructures::LinkedList< LinkedListType > |
operator=(const LinkedList< LinkedListType > &original_copy) | DataStructures::LinkedList< LinkedListType > |
CircularLinkedList< LinkedListType >::operator=(const CircularLinkedList &original_copy) | DataStructures::CircularLinkedList< LinkedListType > |
Peek(void) | DataStructures::CircularLinkedList< LinkedListType > |
Pop(void) | DataStructures::CircularLinkedList< LinkedListType > |
position | DataStructures::CircularLinkedList< LinkedListType > | protected
Replace(const LinkedListType &input) | DataStructures::CircularLinkedList< LinkedListType > |
root | DataStructures::CircularLinkedList< LinkedListType > | protected
Size(void) | DataStructures::CircularLinkedList< LinkedListType > |
Sort(void) | DataStructures::CircularLinkedList< LinkedListType > |
~CircularLinkedList() | DataStructures::CircularLinkedList< LinkedListType > |
~LinkedList() | DataStructures::LinkedList< LinkedListType > |
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:22 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/GetTime.cpp Source File

  • src
GetTime.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #if defined(_WIN32)
21 #include "slikenet/WindowsIncludes.h"
22
23 #if !defined(WINDOWS_PHONE_8)
24 // To call timeGetTime
25 // on Code::Blocks, this needs to be libwinmm.a instead
26 #pragma comment(lib, "Winmm.lib")
27 #endif
28
29 #endif
30
31 #include "slikenet/GetTime.h"
32
33
34
35
36 #if defined(_WIN32)
37 //DWORD mProcMask;
38 //DWORD mSysMask;
39 //HANDLE mThread;
40
41
42
43
44
45
46
47
48
49 #else
50 #include <sys/time.h>
51 #include <unistd.h>
52 SLNet::TimeUS initialTime;
53 #endif
54
55 static bool initialized=false;
56
57 #if defined(GET_TIME_SPIKE_LIMIT) && GET_TIME_SPIKE_LIMIT>0
58 #include "slikenet/SimpleMutex.h"
59 SLNet::TimeUS lastNormalizedReturnedValue=0;
60 SLNet::TimeUS lastNormalizedInputValue=0;
64 SLNet::TimeUS NormalizeTime(SLNet::TimeUS timeIn)
65 {
66 SLNet::TimeUS diff, lastNormalizedReturnedValueCopy;
67 static SLNet::SimpleMutex mutex;
68
69 mutex.Lock();
70 if (timeIn>=lastNormalizedInputValue)
71 {
72 diff = timeIn-lastNormalizedInputValue;
73 if (diff > GET_TIME_SPIKE_LIMIT)
74 lastNormalizedReturnedValue+=GET_TIME_SPIKE_LIMIT;
75 else
76 lastNormalizedReturnedValue+=diff;
77 }
78 else
79 lastNormalizedReturnedValue+=GET_TIME_SPIKE_LIMIT;
80
81 lastNormalizedInputValue=timeIn;
82 lastNormalizedReturnedValueCopy=lastNormalizedReturnedValue;
83 mutex.Unlock();
84
85 return lastNormalizedReturnedValueCopy;
86 }
87 #endif // #if defined(GET_TIME_SPIKE_LIMIT) && GET_TIME_SPIKE_LIMIT>0
88 SLNet::Time SLNet::GetTime( void )
89 {
90 return (SLNet::Time)(GetTimeUS()/1000);
91 }
92 SLNet::TimeMS SLNet::GetTimeMS( void )
93 {
94 return (SLNet::TimeMS)(GetTimeUS()/1000);
95 }
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 #if defined(_WIN32)
145 SLNet::TimeUS GetTimeUS_Windows( void )
146 {
147 if ( initialized == false)
148 {
149 initialized = true;
150
151 // Save the current process
152 #if !defined(_WIN32_WCE)
153 // HANDLE mProc = GetCurrentProcess();
154
155 // Get the current Affinity
156 #if defined (_M_X64)
157 // GetProcessAffinityMask(mProc, (PDWORD_PTR)&mProcMask, (PDWORD_PTR)&mSysMask);
158 #else
159 // GetProcessAffinityMask(mProc, &mProcMask, &mSysMask);
160 #endif
161 // mThread = GetCurrentThread();
162
163 #endif // _WIN32_WCE
164 }
165
166 // 9/26/2010 In China running LuDaShi, QueryPerformanceFrequency has to be called every time because CPU clock speeds can be different
167 SLNet::TimeUS curTime;
168 LARGE_INTEGER PerfVal;
169 LARGE_INTEGER yo1;
170
171 QueryPerformanceFrequency( &yo1 );
172 QueryPerformanceCounter( &PerfVal );
173
174 __int64 quotient, remainder;
175 quotient=((PerfVal.QuadPart) / yo1.QuadPart);
176 remainder=((PerfVal.QuadPart) % yo1.QuadPart);
177 curTime = (SLNet::TimeUS) quotient*(SLNet::TimeUS)1000000 + (remainder*(SLNet::TimeUS)1000000 / yo1.QuadPart);
178
179 #if defined(GET_TIME_SPIKE_LIMIT) && GET_TIME_SPIKE_LIMIT>0
180 return NormalizeTime(curTime);
181 #else
182 return curTime;
183 #endif // #if defined(GET_TIME_SPIKE_LIMIT) && GET_TIME_SPIKE_LIMIT>0
184 }
185 #elif defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__)
186 SLNet::TimeUS GetTimeUS_Linux( void )
187 {
188 timeval tp;
189 if ( initialized == false)
190 {
191 gettimeofday( &tp, 0 );
192 initialized=true;
193 // I do this because otherwise SLNet::Time in milliseconds won't work as it will underflow when dividing by 1000 to do the conversion
194 initialTime = ( tp.tv_sec ) * (SLNet::TimeUS) 1000000 + ( tp.tv_usec );
195 }
196
197 // GCC
198 SLNet::TimeUS curTime;
199 gettimeofday( &tp, 0 );
200
201 curTime = ( tp.tv_sec ) * (SLNet::TimeUS) 1000000 + ( tp.tv_usec );
202
203 #if defined(GET_TIME_SPIKE_LIMIT) && GET_TIME_SPIKE_LIMIT>0
204 return NormalizeTime(curTime - initialTime);
205 #else
206 return curTime - initialTime;
207 #endif // #if defined(GET_TIME_SPIKE_LIMIT) && GET_TIME_SPIKE_LIMIT>0
208 }
209 #endif
210
211 SLNet::TimeUS SLNet::GetTimeUS( void )
212 {
213
214
215
216
217
218
219 #if defined(_WIN32)
220 return GetTimeUS_Windows();
221 #else
222 return GetTimeUS_Linux();
223 #endif
224 }
225 bool SLNet::GreaterThan(SLNet::Time a, SLNet::Time b)
226 {
227 // a > b?
228 const SLNet::Time halfSpan =(SLNet::Time) (((SLNet::Time)(const SLNet::Time)-1)/(SLNet::Time)2);
229 return b!=a && b-a>halfSpan;
230 }
231 bool SLNet::LessThan(SLNet::Time a, SLNet::Time b)
232 {
233 // a < b?
234 const SLNet::Time halfSpan = ((SLNet::Time)(const SLNet::Time)-1)/(SLNet::Time)2;
235 return b!=a && b-a<halfSpan;
236 }
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/Getche.h Source File

  • include
  • slikenet
Getche.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #if defined(_WIN32)
17 #include <conio.h> /* _getche() */
18
19 #else
20 #include <termios.h>
21 #include <stdio.h>
22 #include <unistd.h>
23 char _getche();
24 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/FileListTransferCBInterface.h Source File

  • include
  • slikenet
FileListTransferCBInterface.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
18
19
20 #ifndef __FILE_LIST_TRANSFER_CALLBACK_INTERFACE_H
21 #define __FILE_LIST_TRANSFER_CALLBACK_INTERFACE_H
22
23 #include "memoryoverride.h"
24 #include "FileListNodeContext.h"
25
26 namespace SLNet
27 {
28
32 class FileListTransferCBInterface
33 {
34 public:
35 // Note: If this structure is changed the struct in the swig files need to be changed as well
36 struct OnFileStruct
37 {
39 unsigned fileIndex;
40
42 char fileName[512];
43
45 char *fileData;
46
48 BitSize_t byteLengthOfThisFile;
49
51 BitSize_t bytesDownloadedForThisFile;
52
55 unsigned short setID;
56
58 unsigned numberOfFilesInThisSet;
59
61 unsigned byteLengthOfThisSet;
62
64 unsigned bytesDownloadedForThisSet;
65
68 FileListNodeContext context;
69
71 SystemAddress senderSystemAddress;
72
74 RakNetGUID senderGuid;
75 };
76
77 // Note: If this structure is changed the struct in the swig files need to be changed as well
78 struct FileProgressStruct
79 {
81 OnFileStruct *onFileStruct;
83 unsigned int partCount;
85 unsigned int partTotal;
87 unsigned int dataChunkLength;
89 char *firstDataChunk;
91 char *iriDataChunk;
93 unsigned int iriWriteOffset;
95 SystemAddress senderSystemAddress;
97 RakNetGUID senderGuid;
99 bool allocateIrIDataChunkAutomatically;
100 };
101
102 struct DownloadCompleteStruct
103 {
106 unsigned short setID;
107
109 unsigned numberOfFilesInThisSet;
110
112 unsigned byteLengthOfThisSet;
113
115 SystemAddress senderSystemAddress;
116
118 RakNetGUID senderGuid;
119 };
120
121 FileListTransferCBInterface() {}
122 virtual ~FileListTransferCBInterface() {}
123
127 virtual bool OnFile(OnFileStruct *onFileStruct)=0;
128
136 virtual void OnFileProgress(FileProgressStruct *fps)=0;
137
141 virtual bool Update(void) {return true;}
142
147 virtual bool OnDownloadComplete(DownloadCompleteStruct *dcs) {(void) dcs; return false;}
148
153 virtual void OnDereference(void) {}
154 };
155
156 } // namespace SLNet
157
158 #endif
159
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/VariableDeltaSerializer.h Source File

  • include
  • slikenet
VariableDeltaSerializer.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __VARIABLE_DELTA_SERIALIZER_H
17 #define __VARIABLE_DELTA_SERIALIZER_H
18
19 #include "VariableListDeltaTracker.h"
20 #include "DS_MemoryPool.h"
21 #include "NativeTypes.h"
22 #include "BitStream.h"
23 #include "PacketPriority.h"
24 #include "DS_OrderedList.h"
25
26 namespace SLNet
27 {
28
45 class RAK_DLL_EXPORT VariableDeltaSerializer
46 {
47 protected:
48 struct RemoteSystemVariableHistory;
49 struct ChangedVariablesList;
50
51 public:
52 VariableDeltaSerializer();
53 ~VariableDeltaSerializer();
54
55 struct SerializationContext
56 {
57 SerializationContext();
58 ~SerializationContext();
59
60 RakNetGUID guid;
61 BitStream *bitStream;
62 uint32_t rakPeerSendReceipt;
63 RemoteSystemVariableHistory *variableHistory;
64 RemoteSystemVariableHistory *variableHistoryIdentical;
65 RemoteSystemVariableHistory *variableHistoryUnique;
66 ChangedVariablesList *changedVariables;
67 uint32_t sendReceipt;
68 PacketReliability serializationMode;
69 bool anyVariablesWritten;
70 bool newSystemSend; // Force send all, do not record
71 };
72
73 struct DeserializationContext
74 {
75 BitStream *bitStream;
76 };
77
89 void BeginUnreliableAckedSerialize(SerializationContext *context, RakNetGUID _guid, BitStream *_bitStream, uint32_t _sendReceipt);
90
100 void BeginUniqueSerialize(SerializationContext *context, RakNetGUID _guid, BitStream *_bitStream);
101
110 void BeginIdenticalSerialize(SerializationContext *context, bool _isFirstSerializeToThisSystem, BitStream *_bitStream);
111
114 void EndSerialize(SerializationContext *context);
115
119 void BeginDeserialize(DeserializationContext *context, BitStream *_bitStream);
120
122 void EndDeserialize(DeserializationContext *context);
123
127 void AddRemoteSystemVariableHistory(RakNetGUID guid);
128
132 void RemoveRemoteSystemVariableHistory(RakNetGUID guid);
133
137 void OnPreSerializeTick(void);
138
155 void OnMessageReceipt(RakNetGUID guid, uint32_t receiptId, bool messageArrived);
156
164 template <class VarType>
165 void SerializeVariable(SerializationContext *context, const VarType &variable)
166 {
167 if (context->newSystemSend)
168 {
169 if (context->variableHistory->variableListDeltaTracker.IsPastEndOfList()==false)
170 {
171 // previously sent data to another system
172 context->bitStream->Write(true);
173 context->bitStream->Write(variable);
174 context->anyVariablesWritten=true;
175 }
176 else
177 {
178 // never sent data to another system
179 context->variableHistory->variableListDeltaTracker.WriteVarToBitstream(variable, context->bitStream);
180 context->anyVariablesWritten=true;
181 }
182 }
183 else if (context->serializationMode==UNRELIABLE_WITH_ACK_RECEIPT)
184 {
185 context->anyVariablesWritten|=
186 context->variableHistory->variableListDeltaTracker.WriteVarToBitstream(variable, context->bitStream, context->changedVariables->bitField, context->changedVariables->bitWriteIndex++);
187 }
188 else
189 {
190 if (context->variableHistoryIdentical)
191 {
192 // Identical serialization to a number of systems
193 if (didComparisonThisTick==false)
194 context->anyVariablesWritten|=
195 context->variableHistory->variableListDeltaTracker.WriteVarToBitstream(variable, context->bitStream);
196 // Else bitstream is written to at the end
197 }
198 else
199 {
200 // Per-system serialization
201 context->anyVariablesWritten|=
202 context->variableHistory->variableListDeltaTracker.WriteVarToBitstream(variable, context->bitStream);
203 }
204 }
205 }
206
212 template <class VarType>
213 bool DeserializeVariable(DeserializationContext *context, VarType &variable)
214 {
215 return VariableListDeltaTracker::ReadVarFromBitstream(variable, context->bitStream);
216 }
217
218
219
220 protected:
221
222 // For a given send receipt from RakPeer::Send() track which variables we updated
223 // That way if that send does not arrive (ID_SND_RECEIPT_LOSS) we can mark those variables as dirty to resend them with current values
224 struct ChangedVariablesList
225 {
226 uint32_t sendReceipt;
227 unsigned short bitWriteIndex;
228 unsigned char bitField[56];
229 };
230
231 // static int Replica2ObjectComp( const uint32_t &key, ChangedVariablesList* const &data );
232
233 static int UpdatedVariablesListPtrComp( const uint32_t &key, ChangedVariablesList* const &data );
234
235 // For each remote system, track the last values of variables we sent to them, and the history of what values changed per call to Send()
236 // Every serialize if a variable changes from its last value, send it out again
237 // Also if a send does not arrive (ID_SND_RECEIPT_LOSS) we use updatedVariablesHistory to mark those variables as dirty, to resend them unreliably with the current values
238 struct RemoteSystemVariableHistory
239 {
240 RakNetGUID guid;
241 VariableListDeltaTracker variableListDeltaTracker;
242 DataStructures::OrderedList<uint32_t,ChangedVariablesList*,VariableDeltaSerializer::UpdatedVariablesListPtrComp> updatedVariablesHistory;
243 };
246 DataStructures::List<RemoteSystemVariableHistory*> remoteSystemVariableHistoryList;
247
248 // Because the ChangedVariablesList is created every serialize and destroyed every receipt I use a pool to avoid fragmentation
249 DataStructures::MemoryPool<ChangedVariablesList> updatedVariablesMemoryPool;
250
251 bool didComparisonThisTick;
252 SLNet::BitStream identicalSerializationBs;
253
254 void FreeVarsAssociatedWithReceipt(RakNetGUID guid, uint32_t receiptId);
255 void DirtyAndFreeVarsAssociatedWithReceipt(RakNetGUID guid, uint32_t receiptId);
256 unsigned int GetVarsWrittenPerRemoteSystemListIndex(RakNetGUID guid);
257 void RemoveRemoteSystemVariableHistory(void);
258
259 RemoteSystemVariableHistory* GetRemoteSystemVariableHistory(RakNetGUID guid);
260
261 ChangedVariablesList *AllocChangedVariablesList(void);
262 void FreeChangedVariablesList(ChangedVariablesList *changedVariables);
263 void StoreChangedVariablesList(RemoteSystemVariableHistory *variableHistory, ChangedVariablesList *changedVariables, uint32_t sendReceipt);
264
265 RemoteSystemVariableHistory *StartVariableHistoryWrite(RakNetGUID guid);
266 unsigned int GetRemoteSystemHistoryListIndex(RakNetGUID guid);
267
268 };
269
270 }
271
272 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/src/RakThread.cpp Source File

  • src
RakThread.cpp
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "slikenet/thread.h"
17 #include "slikenet/assert.h"
18 #include "slikenet/defines.h"
19 #include "slikenet/sleep.h"
20 #include "slikenet/memoryoverride.h"
21
22 using namespace SLNet;
23
24
25
26
27 #if defined(_WIN32)
28 #include "slikenet/WindowsIncludes.h"
29 #include <stdio.h>
30 #if !defined(_WIN32_WCE)
31 #include <process.h>
32 #endif
33
34
35
36
37 #else
38 #include <pthread.h>
39 #endif
40
41 #if defined(_WIN32_WCE) || defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
42 int RakThread::Create( LPTHREAD_START_ROUTINE start_address, void *arglist, int priority)
43 #elif defined(_WIN32)
44 int RakThread::Create( unsigned __stdcall start_address( void* ), void *arglist, int priority)
45
46
47
48 #else
49 int RakThread::Create( void* start_address( void* ), void *arglist, int priority)
50 #endif
51 {
52 #ifdef _WIN32
53 HANDLE threadHandle;
54 unsigned threadID = 0;
55
56
57 #if defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
58 threadHandle = CreateThread(NULL,0,start_address,arglist,CREATE_SUSPENDED, 0);
59 #elif defined _WIN32_WCE
60 threadHandle = CreateThread(NULL,MAX_ALLOCA_STACK_ALLOCATION*2,start_address,arglist,0,(DWORD*)&threadID);
61 #else
62 threadHandle = (HANDLE) _beginthreadex( NULL, MAX_ALLOCA_STACK_ALLOCATION*2, start_address, arglist, 0, &threadID );
63 #endif
64
65 SetThreadPriority(threadHandle, priority);
66
67 #if defined(WINDOWS_PHONE_8) || defined(WINDOWS_STORE_RT)
68 ResumeThread(threadHandle);
69 #endif
70
71 if (threadHandle==0)
72 {
73 return 1;
74 }
75 else
76 {
77 CloseHandle( threadHandle );
78 return 0;
79 }
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 #else
120 pthread_t threadHandle;
121 // Create thread linux
122 pthread_attr_t attr;
123 sched_param param;
124 param.sched_priority=priority;
125 pthread_attr_init( &attr );
126 pthread_attr_setschedparam(&attr, &param);
127
128
129
130
131
132 pthread_attr_setstacksize(&attr, MAX_ALLOCA_STACK_ALLOCATION*2);
133
134 pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
135 int res = pthread_create( &threadHandle, &attr, start_address, arglist );
136 RakAssert(res==0 && "pthread_create in RakThread.cpp failed.")
137 return res;
138 #endif
139 }
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:20 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/SocketDefines.h Source File

  • include
  • slikenet
SocketDefines.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __SOCKET_DEFINES_H
17 #define __SOCKET_DEFINES_H
18
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 #if defined(WINDOWS_STORE_RT)
56 #include "WinRTSocketAdapter.h"
57 #define accept__ WinRTAccept
58 #define connect__ WinRTConnect
59 #define closesocket__ WinRTClose
60 #define socket__ WinRTCreateDatagramSocket
61 #define bind__ WinRTBind
62 #define getsockname__ RNS2_WindowsStore8::WinRTGetSockName
63 #define getsockopt__ WinRTGetSockOpt
64 #define ioctlsocket__ RNS2_WindowsStore8::WinRTIOCTLSocket
65 #define listen__ WinRTListen
66 #define recv__ WinRTRecv
67 #define recvfrom__ WinRTRecvFrom
68 #define select__ WinRTSelect
69 #define send__ WinRTSend
70 #define sendto__ WinRTSendTo
71 #define setsockopt__ RNS2_WindowsStore8::WinRTSetSockOpt
72 #define shutdown__ WinRTShutdown
73 #define WSASendTo__ WinRTSendTo
74 #else
75
76
77
78
79
80
81 #if defined(_WIN32)
82 #define closesocket__ closesocket
83 #define select__ select
84 #elif defined(__native_client__)
85 // namespace SLNet { void CloseSocket(SOCKET s); }
86 // #define closesocket__ SLNet::CloseSocket
87 #define select__ select
88 #else
89 #define closesocket__ close
90 #define select__ select
91 #endif
92 #define accept__ accept
93 #define connect__ connect
94
95
96
97 #define socket__ socket
98
99 #define bind__ bind
100 #define getsockname__ getsockname
101 #define getsockopt__ getsockopt
102
103
104
105 #define ioctlsocket__ ioctlsocket
106 #define listen__ listen
107 #define recv__ recv
108 #define recvfrom__ recvfrom
109
110
111
112 #define sendto__ sendto
113
114 #define send__ send
115
116
117
118 #define setsockopt__ setsockopt
119
120 #define shutdown__ shutdown
121 #define WSASendTo__ WSASendTo
122 #endif
123
124 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/socket2.h Source File

  • include
  • slikenet
socket2.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __RAKNET_SOCKET_2_H
17 #define __RAKNET_SOCKET_2_H
18
19 #include "types.h"
20 #include "MTUSize.h"
21 #include "LocklessTypes.h"
22 #include "thread.h"
23 #include "DS_ThreadsafeAllocatingQueue.h"
24 #include "Export.h"
25
26 // For CFSocket
27 // https://developer.apple.com/library/mac/#documentation/CoreFOundation/Reference/CFSocketRef/Reference/reference.html
28 // Reason: http://sourceforge.net/p/open-dis/discussion/683284/thread/0929d6a0
29 #if defined(__APPLE__)
30 #import <CoreFoundation/CoreFoundation.h>
31 #include <sys/socket.h>
32 #include <netinet/in.h>
33 #endif
34
35 // #define TEST_NATIVE_CLIENT_ON_WINDOWS
36
37 #ifdef TEST_NATIVE_CLIENT_ON_WINDOWS
38 #define __native_client__
39 typedef int PP_Resource;
40 #endif
41
42 namespace SLNet
43 {
44
45 class RakNetSocket2;
46 struct RNS2_BerkleyBindParameters;
47 struct RNS2_SendParameters;
48 #ifdef WIN32
49 typedef SOCKET RNS2Socket;
50 #else
51 // #low determine whether we cannot use SOCKET on all platforms...
52 typedef int RNS2Socket;
53 #endif
54
55 enum RNS2BindResult
56 {
57 BR_SUCCESS,
58 BR_REQUIRES_RAKNET_SUPPORT_IPV6_DEFINE,
59 BR_FAILED_TO_BIND_SOCKET,
60 BR_FAILED_SEND_TEST,
61 };
62
63 typedef int RNS2SendResult;
64
65 enum RNS2Type
66 {
67 RNS2T_WINDOWS_STORE_8,
68 RNS2T_PS3,
69 RNS2T_PS4,
70 RNS2T_CHROME,
71 RNS2T_VITA,
72 RNS2T_XBOX_360,
73 RNS2T_XBOX_720,
74 RNS2T_WINDOWS,
75 RNS2T_LINUX
76 };
77
78 struct RNS2_SendParameters
79 {
80 RNS2_SendParameters() {ttl=0;}
81 char *data;
82 int length;
83 SystemAddress systemAddress;
84 int ttl;
85 };
86
87 struct RNS2RecvStruct
88 {
89
90
91
92 char data[MAXIMUM_MTU_SIZE];
93
94 int bytesRead;
95 SystemAddress systemAddress;
96 SLNet::TimeUS timeRead;
97 RakNetSocket2 *socket;
98 };
99
100 class RakNetSocket2Allocator
101 {
102 public:
103 static RakNetSocket2* AllocRNS2(void);
104 static void DeallocRNS2(RakNetSocket2 *s);
105 };
106
107 class RAK_DLL_EXPORT RNS2EventHandler
108 {
109 public:
110 RNS2EventHandler() {}
111 virtual ~RNS2EventHandler() {}
112
113 // bufferedPackets.Push(recvFromStruct);
114 // quitAndDataEvents.SetEvent();
115 virtual void OnRNS2Recv(RNS2RecvStruct *recvStruct)=0;
116 virtual void DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line)=0;
117 virtual RNS2RecvStruct *AllocRNS2RecvStruct(const char *file, unsigned int line)=0;
118
119 // recvFromStruct=bufferedPackets.Allocate( _FILE_AND_LINE_ );
120 // DataStructures::ThreadsafeAllocatingQueue<RNS2RecvStruct> bufferedPackets;
121 };
122
123 class RakNetSocket2
124 {
125 public:
126 RakNetSocket2();
127 virtual ~RakNetSocket2();
128
129 // In order for the handler to trigger, some platforms must call PollRecvFrom, some platforms this create an internal thread.
130 void SetRecvEventHandler(RNS2EventHandler *_eventHandler);
131 virtual RNS2SendResult Send( RNS2_SendParameters *sendParameters, const char *file, unsigned int line )=0;
132 RNS2Type GetSocketType(void) const;
133 void SetSocketType(RNS2Type t);
134 bool IsBerkleySocket(void) const;
135 SystemAddress GetBoundAddress(void) const;
136 unsigned int GetUserConnectionSocketIndex(void) const;
137 void SetUserConnectionSocketIndex(unsigned int i);
138 RNS2EventHandler * GetEventHandler(void) const;
139
140 // ----------- STATICS ------------
141 static void GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
142 static void DomainNameToIP( const char *domainName, char ip[65] );
143
144 protected:
145 RNS2EventHandler *eventHandler;
146 RNS2Type socketType;
147 SystemAddress boundAddress;
148 unsigned int userConnectionSocketIndex;
149 };
150
151 #if defined(WINDOWS_STORE_RT)
152
153 ref class ListenerContext;
154
155 // #include <collection.h>
156 //#include <map>
157 #include "DS_List.h"
158 class RNS2_WindowsStore8 : public RakNetSocket2
159 {
160 public:
161 RNS2_WindowsStore8();
162 ~RNS2_WindowsStore8();
163
164 virtual RNS2SendResult Send( RNS2_SendParameters *sendParameters, const char *file, unsigned int line );
165 RNS2BindResult Bind( Platform::String ^localServiceName );
166 // ----------- STATICS ------------
167 static void GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
168 static void DomainNameToIP( const char *domainName, char ip[65] );
169
170 static int WinRTInet_Addr(const char * cp);
171
172 static int WinRTSetSockOpt(Windows::Networking::Sockets::DatagramSocket ^s,
173 int level,
174 int optname,
175 const char * optval,
176 socklen_t optlen);
177
178 static int WinRTIOCTLSocket(Windows::Networking::Sockets::DatagramSocket ^s,
179 long cmd,
180 unsigned long *argp);
181
182 static int WinRTGetSockName(Windows::Networking::Sockets::DatagramSocket ^s,
183 struct sockaddr *name,
184 socklen_t* namelen);
185
186 static RNS2_WindowsStore8 *GetRNS2FromDatagramSocket(Windows::Networking::Sockets::DatagramSocket^ s);
187 protected:
188 static DataStructures::List<RNS2_WindowsStore8*> rns2List;
189 static SimpleMutex rns2ListMutex;
190
191 Windows::Networking::Sockets::DatagramSocket^ listener;
192 // Platform::Collections::Map<Windows::Storage::Streams::IOutputStream> ^outputStreamMap;
193 // Platform::Collections::Map<String^, int>^ m;
194 //std::map<> m;
195 ListenerContext^ listenerContext;
196 };
197 #elif defined(__native_client__)
198 struct NativeClientBindParameters
199 {
200 _PP_Instance_ nativeClientInstance;
201 unsigned short port;
202 const char *forceHostAddress;
203 bool is_ipv6;
204 RNS2EventHandler *eventHandler;
205 };
206 class RNS2_NativeClient;
207 struct RNS2_SendParameters_NativeClient : public RNS2_SendParameters
208 {
209 RNS2_NativeClient *socket2;
210 };
211 class RNS2_NativeClient : public RakNetSocket2
212 {
213 public:
214 RNS2_NativeClient();
215 virtual ~RNS2_NativeClient();
216 RNS2BindResult Bind( NativeClientBindParameters *bindParameters, const char *file, unsigned int line );
217 RNS2SendResult Send( RNS2_SendParameters *sendParameters, const char *file, unsigned int line );
218 const NativeClientBindParameters *GetBindings(void) const;
219
220 // ----------- STATICS ------------
221 static bool IsPortInUse(unsigned short port, const char *hostAddress, unsigned short addressFamily, int type );
222 static void GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
223
224 // RNS2_NativeClient doesn't automatically call recvfrom in a thread - user must call Update() from the main thread
225 // This causes buffered sends to send, until send is asynch pending
226 // It causes recvfrom events to trigger the callback, and push a message to the event handler
227 //
228 // Example:
229 //
230 // DataStructures::List< SLNet::RakNetSocket2* > sockets;
231 // rakPeerInterface->GetSockets(sockets);
232 // for (unsigned int i=0; i < sockets.Size(); i++)
233 // {
234 // ((RNS2_NativeClient*)sockets[i])->Update();
235 // }
236
237 void Update(void);
238 protected:
239 void ProcessBufferedSend(void);
240 static void SendImmediate(RNS2_SendParameters_NativeClient *sp);
241 static void DeallocSP(RNS2_SendParameters_NativeClient *sp);
242 static RNS2_SendParameters_NativeClient* CloneSP(RNS2_SendParameters *sp, RNS2_NativeClient *socket2, const char *file, unsigned int line);
243 static void onRecvFrom(void* pData, int32_t dataSize);
244 void IssueReceiveCall(void);
245 static void onSocketBound(void* pData, int32_t dataSize);
246 static void onSendTo(void* pData, int32_t dataSize);
247 void BufferSend( RNS2_SendParameters *sendParameters, const char *file, unsigned int line );
248 PP_Resource rns2Socket;
249 NativeClientBindParameters binding;
250 bool sendInProgress;
251 SimpleMutex sendInProgressMutex;
252
253 enum BindState
254 {
255 BS_UNBOUND,
256 BS_IN_PROGRESS,
257 BS_BOUND,
258 BS_FAILED
259 } bindState;
260 DataStructures::Queue<RNS2_SendParameters_NativeClient*> bufferedSends;
261 SimpleMutex bufferedSendsMutex;
262 };
263 #else // defined(WINDOWS_STORE_RT)
264
265 struct RNS2_BerkleyBindParameters
266 {
267 // Input parameters
268 unsigned short port;
269 char *hostAddress;
270 unsigned short addressFamily; // AF_INET or AF_INET6
271 int type; // SOCK_DGRAM
272 int protocol; // 0
273 bool nonBlockingSocket;
274 int setBroadcast;
275 int setIPHdrIncl;
276 int doNotFragment;
277 int pollingThreadPriority;
278 RNS2EventHandler *eventHandler;
279 unsigned short remotePortRakNetWasStartedOn_PS3_PS4_PSP2;
280 };
281
282 // Every platform except Windows Store 8 can use the Berkley sockets interface
283 class IRNS2_Berkley : public RakNetSocket2
284 {
285 public:
286 // ----------- STATICS ------------
287 // For addressFamily, use AF_INET
288 // For type, use SOCK_DGRAM
289 static bool IsPortInUse(unsigned short port, const char *hostAddress, unsigned short addressFamily, int type );
290
291 // ----------- MEMBERS ------------
292 virtual RNS2BindResult Bind( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line )=0;
293 };
294 // Every platform that uses Berkley sockets, except native client, can compile some common functions
295 class RNS2_Berkley : public IRNS2_Berkley
296 {
297 public:
298 RNS2_Berkley();
299 virtual ~RNS2_Berkley();
300 int CreateRecvPollingThread(int threadPriority);
301 void SignalStopRecvPollingThread(void);
302 void BlockOnStopRecvPollingThread(void);
303 const RNS2_BerkleyBindParameters *GetBindings(void) const;
304 RNS2Socket GetSocket(void) const;
305 void SetDoNotFragment( int opt );
306
307 protected:
308 // Used by other classes
309 RNS2BindResult BindShared( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line );
310 RNS2BindResult BindSharedIPV4( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line );
311 RNS2BindResult BindSharedIPV4And6( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line );
312
313 static void GetSystemAddressIPV4 ( RNS2Socket rns2Socket, SystemAddress *systemAddressOut );
314 static void GetSystemAddressIPV4And6 ( RNS2Socket rns2Socket, SystemAddress *systemAddressOut );
315
316 // Internal
317 void SetNonBlockingSocket(unsigned long nonblocking);
318 void SetSocketOptions(void);
319 void SetBroadcastSocket(int broadcast);
320 void SetIPHdrIncl(int ipHdrIncl);
321 void RecvFromBlocking(RNS2RecvStruct *recvFromStruct);
322 void RecvFromBlockingIPV4(RNS2RecvStruct *recvFromStruct);
323 void RecvFromBlockingIPV4And6(RNS2RecvStruct *recvFromStruct);
324
325 RNS2Socket rns2Socket;
326 RNS2_BerkleyBindParameters binding;
327
328 unsigned RecvFromLoopInt(void);
329 SLNet::LocklessUint32_t isRecvFromLoopThreadActive;
330 volatile bool endThreads;
331 // Constructor not called!
332
333 #if defined(__APPLE__)
334 // http://sourceforge.net/p/open-dis/discussion/683284/thread/0929d6a0
335 CFSocketRef _cfSocket;
336 #endif
337
338 static RAK_THREAD_DECLARATION(RecvFromLoop);
339 };
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357 #if defined(_WIN32) || defined(__GNUC__) || defined(__GCCXML__) || defined(__S3E__)
358 class RNS2_Windows_Linux_360
359 {
360 public:
361 protected:
362 static RNS2SendResult Send_Windows_Linux_360NoVDP( RNS2Socket rns2Socket, RNS2_SendParameters *sendParameters, const char *file, unsigned int line );
363 };
364 #endif
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410 #if defined(_WIN32)
411
412 class RAK_DLL_EXPORT SocketLayerOverride
413 {
414 public:
415 SocketLayerOverride() {}
416 virtual ~SocketLayerOverride() {}
417
419 virtual int RakNetSendTo( const char *data, int length, const SystemAddress &systemAddress )=0;
420
422 // Return -1 to use RakNet's normal recvfrom, 0 to abort RakNet's normal recvfrom, and positive to return data
423 virtual int RakNetRecvFrom( char dataOut[ MAXIMUM_MTU_SIZE ], SystemAddress *senderOut, bool calledFromMainThread )=0;
424 };
425
426 class RNS2_Windows : public RNS2_Berkley, public RNS2_Windows_Linux_360
427 {
428 public:
429 RNS2_Windows();
430 virtual ~RNS2_Windows();
431 RNS2BindResult Bind( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line );
432 RNS2SendResult Send( RNS2_SendParameters *sendParameters, const char *file, unsigned int line );
433 void SetSocketLayerOverride(SocketLayerOverride *_slo);
434 SocketLayerOverride* GetSocketLayerOverride(void);
435 // ----------- STATICS ------------
436 static void GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
437 protected:
438 static void GetMyIPIPV4( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
439 static void GetMyIPIPV4And6( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
440 SocketLayerOverride *slo;
441 };
442
443 #else
444 class RNS2_Linux : public RNS2_Berkley, public RNS2_Windows_Linux_360
445 {
446 public:
447 RNS2BindResult Bind( RNS2_BerkleyBindParameters *bindParameters, const char *file, unsigned int line );
448 RNS2SendResult Send( RNS2_SendParameters *sendParameters, const char *file, unsigned int line );
449
450 // ----------- STATICS ------------
451 static void GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
452 protected:
453 static void GetMyIPIPV4( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
454 static void GetMyIPIPV4And6( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] );
455 };
456
457 #endif // Linux
458
459 #endif // #elif !defined(WINDOWS_STORE_RT)
460
461 } // namespace SLNet
462
463 #endif // __RAKNET_SOCKET_2_H
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/NativeTypes.h Source File

  • include
  • slikenet
NativeTypes.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2016, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __NATIVE_TYPES_H
17 #define __NATIVE_TYPES_H
18
19 #if defined(__GNUC__) || defined(__GCCXML__) || defined(__SNC__) || defined(__S3E__)
20 #include <stdint.h>
21 #elif !defined(_STDINT_H) && !defined(_SN_STDINT_H) && !defined(_SYS_STDINT_H_) && !defined(_STDINT) && !defined(_MACHTYPES_H_) && !defined(_STDINT_H_)
22 typedef unsigned char uint8_t;
23 typedef unsigned short uint16_t;
24 typedef unsigned __int32 uint32_t;
25 typedef signed char int8_t;
26 typedef signed short int16_t;
27 typedef __int32 int32_t;
28 typedef unsigned long long int uint64_t;
29 typedef signed long long int64_t;
30 #endif
31
32
33 #endif
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/TwoWayAuthentication.h Source File

  • include
  • slikenet
TwoWayAuthentication.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
21
22
23 #include "NativeFeatureIncludes.h"
24 #if _RAKNET_SUPPORT_TwoWayAuthentication==1
25
26 #ifndef __TWO_WAY_AUTHENTICATION_H
27 #define __TWO_WAY_AUTHENTICATION_H
28
29 // How often to change the nonce.
30 #define NONCE_TIMEOUT_MS 10000
31 // How often to check for ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT, and the minimum timeout time. Maximum is double this value.
32 #define CHALLENGE_MINIMUM_TIMEOUT 3000
33
34 #if LIBCAT_SECURITY==1
35 // From CPP FILE:
36 // static const int HASH_BITS = 256;
37 // static const int HASH_BYTES = HASH_BITS / 8;
38 // static const int STRENGTHENING_FACTOR = 1000;
39 #define TWO_WAY_AUTHENTICATION_NONCE_LENGTH 32
40 #define HASHED_NONCE_AND_PW_LENGTH 32
41 #else
42 #include "DR_SHA1.h"
43 #define TWO_WAY_AUTHENTICATION_NONCE_LENGTH 20
44 #define HASHED_NONCE_AND_PW_LENGTH SHA1_LENGTH
45 #endif
46
47 #include "PluginInterface2.h"
48 #include "memoryoverride.h"
49 #include "NativeTypes.h"
50 #include "string.h"
51 #include "DS_Hash.h"
52 #include "DS_Queue.h"
53
54 typedef int64_t FCM2Guid;
55
56 namespace SLNet
57 {
59 class RakPeerInterface;
60
67 class RAK_DLL_EXPORT TwoWayAuthentication : public PluginInterface2
68 {
69 public:
70 // GetInstance() and DestroyInstance(instance*)
71 STATIC_FACTORY_DECLARATIONS(TwoWayAuthentication)
72
73 TwoWayAuthentication();
74 virtual ~TwoWayAuthentication();
75
83 bool AddPassword(SLNet::RakString identifier, SLNet::RakString password);
84
90 bool Challenge(SLNet::RakString identifier, AddressOrGUID remoteSystem);
91
93 void Clear(void);
94
96 virtual void Update(void);
98 virtual PluginReceiveResult OnReceive(Packet *packet);
100 virtual void OnRakPeerShutdown(void);
102 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
103
105 struct PendingChallenge
106 {
107 SLNet::RakString identifier;
108 AddressOrGUID remoteSystem;
109 SLNet::Time time;
110 bool sentHash;
111 };
112
113 DataStructures::Queue<PendingChallenge> outgoingChallenges;
114
116 struct NonceAndRemoteSystemRequest
117 {
118 char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH];
119 SLNet::AddressOrGUID remoteSystem;
120 unsigned short requestId;
121 SLNet::Time whenGenerated;
122 };
124 struct RAK_DLL_EXPORT NonceGenerator
125 {
126 NonceGenerator();
127 ~NonceGenerator();
128 void GetNonce(char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], unsigned short *requestId, SLNet::AddressOrGUID remoteSystem);
129 void GenerateNonce(char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH]);
130 bool GetNonceById(char nonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], unsigned short requestId, SLNet::AddressOrGUID remoteSystem, bool popIfFound);
131 void Clear(void);
132 void ClearByAddress(SLNet::AddressOrGUID remoteSystem);
133 void Update(SLNet::Time curTime);
134
135 DataStructures::List<TwoWayAuthentication::NonceAndRemoteSystemRequest*> generatedNonces;
136 unsigned short nextRequestId;
137 };
138
139 protected:
140 void PushToUser(MessageID messageId, SLNet::RakString password, SLNet::AddressOrGUID remoteSystem);
141 // Key is identifier, data is password
142 DataStructures::Hash<SLNet::RakString, SLNet::RakString, 16, SLNet::RakString::ToInteger > passwords;
143
144 SLNet::Time whenLastTimeoutCheck;
145
146 NonceGenerator nonceGenerator;
147
148 void OnNonceRequest(Packet *packet);
149 void OnNonceReply(Packet *packet);
150 PluginReceiveResult OnHashedNonceAndPassword(Packet *packet);
151 void OnPasswordResult(Packet *packet);
152 void Hash(char thierNonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], SLNet::RakString password, char out[HASHED_NONCE_AND_PW_LENGTH]);
153 };
154
155 } // namespace SLNet
156
157 #endif
158
159 #endif // _RAKNET_SUPPORT_*
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2


SLikeNet: Member List

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SLNet
  • ReferenceCounter
SLNet::ReferenceCounter Member List

This is the complete list of members for SLNet::ReferenceCounter, including all inherited members.

AddRef() | SLNet::ReferenceCounter | inline
GetRefCount(void) const | SLNet::ReferenceCounter | inline
ReferenceCounter() | SLNet::ReferenceCounter | inline
Release() | SLNet::ReferenceCounter | inline
~ReferenceCounter() | SLNet::ReferenceCounter | inline
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:23 for SLikeNet by doxygen 1.8.2


SLikeNet: Source/include/slikenet/version.h Source File

  • include
  • slikenet
version.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017-2019, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 // Defines kept here for backwards compatibility with RAKNET 4.081/4.082.
17 // Usage of these defines is deprecated. Please switch to using SLIKENET version defines.
18 #define RAKNET_VERSION "4.082"
19 #define RAKNET_VERSION_NUMBER 4.082
20 #define RAKNET_VERSION_NUMBER_INT 4082
21 #define RAKNET_DATE "7/26/2017"
22
23 #define SLIKENET_VERSION "0.1.3"
24 #define SLIKENET_VERSION_NUMBER 0.1.3
25 #define SLIKENET_VERSION_NUMBER_INT 000103
26 #define SLIKENET_DATE "23/08/2019"
27
28 // What compatible protocol version RakNet is using. When this value changes, it indicates this version of RakNet cannot connection to an older version.
29 // ID_INCOMPATIBLE_PROTOCOL_VERSION will be returned on connection attempt in this case
30 #define RAKNET_PROTOCOL_VERSION 6
Original work: Copyright (c) 2014, Oculus VR, Inc.
Modified work: Copyright (c) 2016-2017, SLikeSoft UG (haftungbeschänkt)
Generated on Wed Aug 14 2019 22:11:19 for SLikeNet by doxygen 1.8.2