#include <BaseTransportServer.h>


Public Member Functions | |
| void | SetEncryptionKey (const void *data, const int length) |
| virtual bool | Start (Transport *transport, const bool allowDelete=true, const bool isListen=true) |
| virtual bool | Stop (void) |
| size_t | GetNumConnections (void) const |
| bool | SetAsDisconnecting (Transport *transport) |
| This will put the connection into a list pending disconnection after a timeout period. | |
Static Public Member Functions | |
| static float | FloatTime (void) |
Protected Member Functions | |
| virtual bool | CallbackParseValidMessage (Transport *transport, DynamicMessageHelper &message, const size_t length) |
| virtual bool | PackageAndSendData (Transport *transport, const DynamicMessageHelper &message) |
| The class mutex is locked during the context of this function. | |
| virtual bool | CallbackParsePacketData (Transport *transport, void *data, size_t &length, DynamicMessageHelper &result) |
| virtual void | CallbackAccepted (Transport *transport) |
| Called when the server accepts a connection or when a non-listen class instance connection becomes stable. | |
| virtual void | CallbackDisconnected (Transport *transport) |
| Called when the transport is disconnected. | |
| virtual void | CallbackDataReceived (DynamicMessageHelper &message) |
| virtual void | CallbackDataSend (DynamicMessageHelper &message) |
| virtual void | CallbackQueryReplyTime (const float seconds) |
| virtual bool | CallbackPoll (void) |
| virtual void | CallbackTidy (void) |
| int | ThreadEntry (void) |
| void | GenerateNewNonce (void) |
Protected Attributes | |
| Transport * | mTransport |
| bool | mAllowDelete |
| int | mNOnce |
|
std::map< Transport *, Entry > | mConnected |
| bool | mIsListen |
| bool | mClientIsStable |
| Entry | mClientEntry |
| size_t | mNumConnections |
Classes | |
| struct | Entry |
| void SetEncryptionKey | ( | const void * | data, | |
| const int | length | |||
| ) |
Sets the encryption key to be used by all queries for this server. The same key must be used with any other RNLobby::BaseTransportServer querying this server. The default encryption key is the same for RNLobby::CodeServer and RNLobby::CodeClient.
| data | The data to use as a seed for the key. This can be NULL to use the default key. | |
| length | The length of the data to use for creating the key. |
| virtual bool Start | ( | Transport * | transport, | |
| const bool | allowDelete = true, |
|||
| const bool | isListen = true | |||
| ) | [virtual] |
Starts the thread. If this function is overridden then this base implementation must also be called.
| transport | The transport to poll for this class. | |
| allowDelete | When true this class is responsible for deleting the socket. | |
| isListen | When true this class will listen for connections on the |
| virtual bool Stop | ( | void | ) | [virtual] |
Stops the thread. If this function is overridden then this base implementation must also be called. This will not generate CallbackDisconnected() events for any existing connections.
Reimplemented in UserClient.
| virtual bool CallbackParseValidMessage | ( | Transport * | transport, | |
| DynamicMessageHelper & | message, | |||
| const size_t | length | |||
| ) | [inline, protected, virtual] |
Called from the scope of the thread but without the class mutex being locked. If a MessageHelper::Exception() is caught by this server class the connection will be terminated.
Reimplemented in AdvertiseClient, and UserClient.
| virtual bool CallbackParsePacketData | ( | Transport * | transport, | |
| void * | data, | |||
| size_t & | length, | |||
| DynamicMessageHelper & | result | |||
| ) | [protected, virtual] |
The class mutex is locked during the context of this function. The default operation is to decrypt the packet and then set result.SetGuardSize() with the size of the data and then call CallbackParseValidMessage(). This will cause a MessageHepler::Exception() exception to be thrown and may be caught by the user parser routines or will be caught by this server class.
| result | The resultant data after decrypting and length will be updated with the new packet length. |
| virtual void CallbackDataReceived | ( | DynamicMessageHelper & | message | ) | [inline, protected, virtual] |
This callback may be used to alter data after it has been received and before the data received is processed.
| message | The data held in a DynamicMessageHelper class. |
| virtual void CallbackDataSend | ( | DynamicMessageHelper & | message | ) | [inline, protected, virtual] |
This callback may be used to alter any data in a reply, just before it gets sent by the socket.
| message | The data held in a DynamicMessageHelper class. |
| virtual void CallbackQueryReplyTime | ( | const float | seconds | ) | [inline, protected, virtual] |
This callback reports how long an query and reply took starting from when packet data was received until the packet data is sent.
| seconds | The time in seconds. |
| virtual bool CallbackPoll | ( | void | ) | [inline, protected, virtual] |
Called from the scope of the thread but without the class mutex being locked. This can be called with or without a valid mTransport
Reimplemented in AdvertiseClient, and UserClient.
| virtual void CallbackTidy | ( | void | ) | [inline, protected, virtual] |
This callback may be used to tidy allocation of objects when the thread terminates. The class mutex is locked when executing this callback.
Reimplemented in AdvertiseClient, and UserClient.
| int ThreadEntry | ( | void | ) | [protected, virtual] |
The thread starts executing from here.
Implements ThreadClass.
1.5.3