#include <ReliabilityLayer.h>
Public Member Functions | |
ReliabilityLayer () | |
Constructor. | |
~ReliabilityLayer () | |
Destructor. | |
void | Reset (bool resetVariables) |
Resets the layer for reuse. | |
void | SetEncryptionKey (const unsigned char *key) |
void | SetTimeoutTime (RakNetTime time) |
RakNetTime | GetTimeoutTime (void) |
bool | HandleSocketReceiveFromConnectedPlayer (const char *buffer, int length, SystemAddress systemAddress, DataStructures::List< PluginInterface * > &messageHandlerList, int MTUSize) |
int | Receive (unsigned char **data) |
bool | Send (char *data, int numberOfBitsToSend, PacketPriority priority, PacketReliability reliability, unsigned char orderingChannel, bool makeDataCopy, int MTUSize, RakNetTimeNS currentTime) |
void | Update (SOCKET s, SystemAddress systemAddress, int MTUSize, RakNetTimeNS time, unsigned maxBitsPerSecond, DataStructures::List< PluginInterface * > &messageHandlerList) |
bool | IsCheater (void) const |
bool | IsDeadConnection (void) const |
void | KillConnection (void) |
Causes IsDeadConnection to return true. | |
RakNetStatistics *const | GetStatistics (void) |
bool | IsOutgoingDataWaiting (void) |
Are we waiting for any data to be sent out or be processed by the player? | |
bool | IsNetworkSimulatorActive (void) |
bool | AckTimeout (RakNetTimeNS curTime) |
Has a lot of time passed since the last ack. |
void ReliabilityLayer::SetEncryptionKey | ( | const unsigned char * | key | ) |
Sets the encryption key. Doing so will activate secure connections
[in] | key | Byte stream for the encryption key |
void ReliabilityLayer::SetTimeoutTime | ( | RakNetTime | 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.
[in] | time | Time, in MS |
RakNetTime ReliabilityLayer::GetTimeoutTime | ( | void | ) |
Returns the value passed to SetTimeoutTime. or the default if it was never called
[out] | the | value passed to SetTimeoutTime |
bool ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer | ( | const char * | buffer, | |
int | length, | |||
SystemAddress | systemAddress, | |||
DataStructures::List< PluginInterface * > & | messageHandlerList, | |||
int | MTUSize | |||
) |
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.
[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 |
true | Success | |
false | Modified packet |
int ReliabilityLayer::Receive | ( | unsigned char ** | data | ) |
This allocates bytes and writes a user-level message to those bytes.
[out] | data | The message |
bool ReliabilityLayer::Send | ( | char * | data, | |
int | numberOfBitsToSend, | |||
PacketPriority | priority, | |||
PacketReliability | reliability, | |||
unsigned char | orderingChannel, | |||
bool | makeDataCopy, | |||
int | MTUSize, | |||
RakNetTimeNS | currentTime | |||
) |
Puts data on the send queue
[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 RakNet::GetTime() |
void ReliabilityLayer::Update | ( | SOCKET | s, | |
SystemAddress | systemAddress, | |||
int | MTUSize, | |||
RakNetTimeNS | time, | |||
unsigned | maxBitsPerSecond, | |||
DataStructures::List< PluginInterface * > & | messageHandlerList | |||
) |
Call once per game cycle. Handles internal lists and actually does the send.
[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 |
bool ReliabilityLayer::IsCheater | ( | void | ) | const |
If Read returns -1 and this returns true then a modified packetwas detected
bool ReliabilityLayer::IsDeadConnection | ( | void | ) | const |
Were you ever unable to deliver a packet despite retries?
RakNetStatistics *const ReliabilityLayer::GetStatistics | ( | void | ) |
Get Statistics
bool ReliabilityLayer::IsNetworkSimulatorActive | ( | void | ) |
Returns if you previously called ApplyNetworkSimulator