ReplicaNet and RNLobby
1
|
A server base class that handles encrypted messages to and from a socket. More...
#include <BaseServer.h>
Public Member Functions | |
virtual bool | StartWithSocket (t_XPSocket *socket, const bool allowDelete=true) |
virtual bool | Stop (void) |
void | SetEncryptionKey (const void *data, const int length) |
virtual void | CallbackDataReceived (DynamicMessageHelper &message, XPAddress &address) |
virtual void | CallbackDataSend (DynamicMessageHelper &message, XPAddress &address) |
virtual void | CallbackQueryReplyTime (const float seconds) |
virtual bool | CallbackPoll (void) |
virtual void | CallbackTidy (void) |
![]() | |
ThreadClass () | |
virtual | ~ThreadClass () |
void | Sleep (int milliseconds) |
![]() | |
MutexClass () | |
virtual | ~MutexClass () |
void | Lock (void) |
void | UnLock (void) |
![]() | |
Thread () | |
virtual | ~Thread () |
void | Begin (ThreadClass *threaded_class) |
void | Terminate (void) |
bool | GetTerminated (void) |
bool | GetEverTerminated (void) |
bool | GetIsRunning (void) const |
void | SetPreferredProcessor (int processor=kReplicaNetPreferredProcessorOSChoice) |
int | GetPreferredProcessor (void) |
Static Public Member Functions | |
static SysTimeType | FloatTime (void) |
![]() | |
static int | CallThreadEntry (ThreadClass *thread_class) |
static int | GetCurrentProcessorNumber (void) |
static size_t | GetNumAllocated (void) |
static size_t | GetNumActive (void) |
Protected Member Functions | |
virtual bool | CallbackParseValidMessage (DynamicMessageHelper &message, const size_t length, const XPAddress &address) |
virtual bool | PackageAndSendData (t_XPSocket *socket, const DynamicMessageHelper &message, const XPAddress &address) |
virtual bool | CallbackParsePacketData (t_XPSocket *socket, const XPAddress &addr, void *data, size_t &length, DynamicMessageHelper &result) |
int | ThreadEntry (void) |
![]() | |
void | DoQuitNow (const int returnCode) |
void | CheckQuit (void) |
Protected Attributes | |
t_XPSocket * | mSocket |
bool | mAllowDelete |
int | mNOnce |
Additional Inherited Members | |
![]() | |
enum | { kNoOwnerThread = -1 } |
![]() | |
static size_t | GetNumAllocated (void) |
A server base class that handles encrypted messages to and from a socket.
|
inlinevirtual |
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. |
address | The network address for this data packet. The contents of the address may be changed if required. |
|
inlinevirtual |
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. |
address | The network address for this data packet. The contents of the address may be changed if required. |
|
protectedvirtual |
The class mutex is locked during the context of this function.
result | The resultant data after decrypting and length will be updated with the new packet length. |
|
inlineprotectedvirtual |
Called from the scope of the thread but without the class mutex being locked.
|
inlinevirtual |
Called from the scope of the thread but without the class mutex being locked.
|
inlinevirtual |
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. |
|
inlinevirtual |
This callback may be used to tidy allocation of objects when the thread terminates. The class mutex is locked when executing this callback.
|
protectedvirtual |
The class mutex is locked during the context of this function.
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::BaseServer querying this server.
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 |
Starts the thread. If this function is overridden then this base implementation must also be called.
socket | The socket to poll for this class. |
allowDelete | When true this class is responsible for deleting the socket. |
|
virtual |
Stops the thread. If this function is overridden then this base implementation must also be called.
|
protectedvirtual |
The thread starts executing from here.
Implements ThreadClass.