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
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.