Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

LightweightDatabaseServer Class Reference
[MySQLNetworkedDatabase]

A simple flat database included with RakNet, useful for a server browser or a lobby server. More...

#include <LightweightDatabaseServer.h>

Inherits PluginInterface2.

Collaboration diagram for LightweightDatabaseServer:
Collaboration graph
[legend]

List of all members.

Classes

struct  DatabaseTable

Public Member Functions

 LightweightDatabaseServer ()
virtual ~LightweightDatabaseServer ()
DataStructures::TableGetTable (const char *tableName)
DataStructures::TableAddTable (const char *tableName, bool allowRemoteQuery, bool allowRemoteUpdate, bool allowRemoteRemove, const char *queryPassword, const char *updatePassword, const char *removePassword, bool oneRowPerSystemAddress, bool onlyUpdateOwnRows, bool removeRowOnPingFailure, bool removeRowOnDisconnect, bool autogenerateRowIDs)
bool RemoveTable (const char *tableName)
void Clear (void)
 Clears all memory.
unsigned GetAndIncrementRowID (const char *tableName)
DataStructures::Page< unsigned,
DataStructures::Table::Row
*, _TABLE_BPLUS_TREE_ORDER > * 
GetTableRows (const char *tableName)
virtual void Update (void)
 Update is called every time a packet is checked for .
virtual PluginReceiveResult OnReceive (Packet *packet)
virtual void OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)

Static Public Member Functions

static int DatabaseTableComp (const char *const &key1, const char *const &key2)

Protected Member Functions

void OnQueryRequest (Packet *packet)
void OnUpdateRow (Packet *packet)
void OnRemoveRow (Packet *packet)
void OnPong (Packet *packet)
DatabaseTableDeserializeClientHeader (RakNet::BitStream *inBitstream, RakPeerInterface *peer, Packet *packet, int mode)
DataStructures::Table::RowGetRowFromIP (DatabaseTable *databaseTable, SystemAddress systemAddress, unsigned *rowId)
bool RowHasIP (DataStructures::Table::Row *row, SystemAddress systemAddress, unsigned SystemAddressColumnIndex)
DataStructures::Table::RowAddRow (LightweightDatabaseServer::DatabaseTable *databaseTable, SystemAddress systemAddress, RakNetGUID guid, bool hasRowId, unsigned rowId)
void RemoveRowsFromIP (SystemAddress systemAddress)

Protected Attributes

DataStructures::Map< const
char
*, LightweightDatabaseServer::DatabaseTable
*, LightweightDatabaseServer::DatabaseTableComp > 
database

Detailed Description

A simple flat database included with RakNet, useful for a server browser or a lobby server.

Deprecated:
Use RakNet::SQLite3ServerPlugin found at DependentExtensions/SQLite3Plugin/SQLite3ServerPlugin.h

A flat database interface. Adds the ability to track IPs of row updaters and passwords for table read and write operations, Best used for data in which queries which do not need to be updated in real-time

Definition at line 27 of file LightweightDatabaseServer.h.


Constructor & Destructor Documentation

LightweightDatabaseServer::LightweightDatabaseServer (  ) 

Definition at line 26 of file LightweightDatabaseServer.cpp.

LightweightDatabaseServer::~LightweightDatabaseServer (  )  [virtual]

Definition at line 30 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:


Member Function Documentation

DataStructures::Table::Row * LightweightDatabaseServer::AddRow ( LightweightDatabaseServer::DatabaseTable databaseTable,
SystemAddress  systemAddress,
RakNetGUID  guid,
bool  hasRowId,
unsigned  rowId 
) [protected]

Definition at line 615 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

DataStructures::Table * LightweightDatabaseServer::AddTable ( const char *  tableName,
bool  allowRemoteQuery,
bool  allowRemoteUpdate,
bool  allowRemoteRemove,
const char *  queryPassword,
const char *  updatePassword,
const char *  removePassword,
bool  oneRowPerSystemAddress,
bool  onlyUpdateOwnRows,
bool  removeRowOnPingFailure,
bool  removeRowOnDisconnect,
bool  autogenerateRowIDs 
)

Adds a new table It is valid to read and write to the returned pointer.

Parameters:
[in] tableName Name of the new table to create. Remote systems will refer to this table by this name.
[in] allowRemoteQuery true to allow remote systems to query the table. false to not allow this.
[in] allowRemoteUpdate true to allow remote systems to update rows in the table. false to not allow this.
[in] allowRemoteRemove true to allow remote systems to remove rows from the table. false to not allow this.
[in] queryPassword The password required to query the table. Pass an empty string for no password.
[in] updatePassword The password required to update rows in the table. Pass an empty string for no password.
[in] removePassword The password required to remove rows from the table. Pass an empty string for no password.
[in] oneRowPerSystemAddress Only used if allowRemoteUpdate==true. This limits remote systems to one row.
[in] onlyUpdateOwnRows Only used if allowRemoteUpdate==true. This limits remote systems to only updating rows they created.
[in] removeRowOnPingFailure Only used if allowRemoteUpdate==true and removeRowOnDisconnect==false. If true, this will periodically ping disconnected systems and remove rows created by that system if that system does not respond to pings.
[in] removeRowOnDisconnect Only used if allowRemoteUpdate==true. This removes rows created by a system when that system disconnects.
[in] autogenerateRowIDs true to automatically generate row IDs. Rows are stored in order by row ID. If false, the clients must specify a unique row ID when adding rows. If they specify a row that already exists the addition is ignored.
Returns:
The newly created table, or 0 on failure.

Definition at line 52 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

void LightweightDatabaseServer::Clear ( void   ) 

Clears all memory.

Definition at line 160 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int LightweightDatabaseServer::DatabaseTableComp ( const char *const &  key1,
const char *const &  key2 
) [static]

Definition at line 21 of file LightweightDatabaseServer.cpp.

LightweightDatabaseServer::DatabaseTable * LightweightDatabaseServer::DeserializeClientHeader ( RakNet::BitStream inBitstream,
RakPeerInterface peer,
Packet packet,
int  mode 
) [protected]

Definition at line 525 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned LightweightDatabaseServer::GetAndIncrementRowID ( const char *  tableName  ) 

Definition at line 172 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

DataStructures::Table::Row * LightweightDatabaseServer::GetRowFromIP ( DatabaseTable databaseTable,
SystemAddress  systemAddress,
unsigned *  rowId 
) [protected]

Definition at line 576 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

DataStructures::Table * LightweightDatabaseServer::GetTable ( const char *  tableName  ) 

Returns a table by name. It is valid to read and write to the returned pointer.

Parameters:
[in] tableName The name of the table that was passed to AddTable
Returns:
The requested table, or 0 if tableName cannot be found.

Definition at line 34 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

DataStructures::Page< unsigned, DataStructures::Table::Row *, _TABLE_BPLUS_TREE_ORDER > * LightweightDatabaseServer::GetTableRows ( const char *  tableName  ) 

Returns a linked list of ordered lists containing the rows of a table, by name. The returned structure is internal to the BPlus tree. See DS_BPlusTree This is a convenience accessor, as you can also get this from the table returned from GetTable()

Parameters:
[in] tableName The name of the table that was passed to AddTable
Returns:
The requested rows, or 0 if tableName cannot be found.

Definition at line 46 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

void LightweightDatabaseServer::OnClosedConnection ( 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 PluginInterface2.

Definition at line 264 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

void LightweightDatabaseServer::OnPong ( Packet packet  )  [protected]

Definition at line 489 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void LightweightDatabaseServer::OnQueryRequest ( Packet packet  )  [protected]

Definition at line 271 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

PluginReceiveResult LightweightDatabaseServer::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 PluginInterface2.

Definition at line 245 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

void LightweightDatabaseServer::OnRemoveRow ( Packet packet  )  [protected]

Definition at line 477 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void LightweightDatabaseServer::OnUpdateRow ( Packet packet  )  [protected]

Definition at line 332 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void LightweightDatabaseServer::RemoveRowsFromIP ( SystemAddress  systemAddress  )  [protected]

Definition at line 651 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool LightweightDatabaseServer::RemoveTable ( const char *  tableName  ) 

Removes a table by name.

Parameters:
[in] tableName The name of the table that was passed to AddTable
Returns:
true on success, false on failure.

Definition at line 148 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

bool LightweightDatabaseServer::RowHasIP ( DataStructures::Table::Row row,
SystemAddress  systemAddress,
unsigned  SystemAddressColumnIndex 
) [protected]

Definition at line 600 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void LightweightDatabaseServer::Update ( void   )  [virtual]

Update is called every time a packet is checked for .

Reimplemented from PluginInterface2.

Definition at line 181 of file LightweightDatabaseServer.cpp.

Here is the call graph for this function:


Member Data Documentation

DataStructures::Map<const char *, LightweightDatabaseServer::DatabaseTable*, LightweightDatabaseServer::DatabaseTableComp> LightweightDatabaseServer::database [protected]

Definition at line 125 of file LightweightDatabaseServer.h.


The documentation for this class was generated from the following files: