#include <CodeServer.h>
Public Types | |
enum | Reply { kReply_ValidKey = 0, kReply_UnspecifiedError, kReply_InvalidKey, kReply_KeyInUse, kReply_Timeout, kReply_CorruptReply } |
enum | { kDefaultPort = 20001 } |
Public Member Functions | |
bool | ReadCodeFile (const char *filename, const bool duplicateCodeCheck=false) |
bool | AddCode (const char *code, const bool duplicateCodeCheck=false, const int userSuppliedReply=0) |
bool | RemoveCode (const char *code=0) |
bool | Start (const int UDPPort=CodeServer::kDefaultPort) |
bool | Stop (bool hardware=false) |
void | SetEncryptionKey (const void *data, const int length) |
void | SetCodeTimeout (const float time=(60.0f *30.0f)) |
float | GetCodeTimeout (void) const |
virtual void | CallbackDataReceived (void *data, int &length, const int maxLength, XPAddress &address) |
virtual void | CallbackVersion (const int version) |
virtual void | CallbackKeyData (char *keyData, const int maxLength, int &nOnce1, int &nOnce2, bool &updateDatabase) |
virtual void | CallbackQueryReply (Reply &reply, int &userSuppliedReply, int &nOnce1, int &nOnce2) |
virtual void | CallbackDataSend (void *data, int &length, const int maxLength, XPAddress &address) |
virtual void | CallbackQueryReplyTime (const float seconds) |
Protected Attributes | |
RegistryManagerMap< std::string, CodeEntry, CodeEntry::ThisLess > | mCodes |
MutexClass | mCodesMutex |
Classes | |
class | CodeEntry |
|
Adds a code to the database in memory. Each code must be no longer than 255 characters. This function may be used when the code server has been started.
|
|
This callback may be used to alter data after it has been received and before the data is processed.
|
|
This callback may be used to alter any data in a reply, just before it gets sent.
|
|
This callback may be used to alter the actual key queried before it is matched with the database.
|
|
This callback may be used to alter the CodeServer::Reply.
|
|
This callback reports how long an query and reply took starting from when packet data was received until the packet data is sent.
|
|
This callback may be used to ascertain the version of the request made.
|
|
Gets the value configured by SetCodeTimeout()
|
|
Reads codes from a file and stores the codes in a database in memory. Each code must be in a separate line. This function may be used when the code server has been started. Each call to this function will add codes to the database held in memory. Each code must be no longer than 255 characters.
|
|
Removes codes from the database in memory. This function may be used when the code server has been started.
|
|
This sets the time period that a code will be flagged as being used and kReply_KeyInUse will be returned from CodeClient::GetReply(). After this time period has elapsed a request to validate the same code will be allowed.
|
|
Sets the encryption key to be used by all queries for this server. The same key must be used with any RNLobby::CodeClient querying this server. The default encryption key is the same for RNLobby::CodeServer and RNLobby::CodeClient.
|
|
Starts the code server thread and processes code queries. If not already started the network hardware is started.
|
|
Stops the code server thread and stops processing code queries.
|