SLikeNet 0.1.3

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 |