# RakNet::Lobby2Server Class Reference
[Lobby2Server]

The base class for the lobby server, without database specific functionality. More...

`#include <Lobby2Server.h>`

Inheritance diagram for RakNet::Lobby2Server:

List of all members.

## Classes

struct | ConfigurationProperties
| Server configuration properties, to customize how the server runs specific commands. More...

## Public Member Functions

virtual bool | ConnectToDB (const char *conninfo, int numWorkerThreads)=0
| Connect to the database numWorkerThreads times using the connection string.
void | SendMessage (Lobby2Message *msg, const DataStructures::List< SystemAddress > &recipients)
| Lobby2Message encapsulates a user command, containing both input and output data.
void | ExecuteCommand (Lobby2ServerCommand *command)
| Add a command, which contains a message and other data such as who send the message.
void | AddAdminAddress (SystemAddress addr)
| If Lobby2Message::RequiresAdmin() returns true, the message can only be processed from a remote system if the sender's system address is first added().
bool | HasAdminAddress (const DataStructures::List< SystemAddress > &addresses)
| If AddAdminAddress() was previously called with addr then this returns true.
void | RemoveAdminAddress (SystemAddress addr)
| Removes a system address previously added with AddAdminAddress().
void | ClearAdminAddresses (void)
| Removes all system addresses previously added with AddAdminAddress().
void | AddRankingAddress (SystemAddress addr)
| If Lobby2Message::RequiresRankingPermission() returns true, then the system that sent the command must be registered with AddRankingAddress().
bool | HasRankingAddress (const DataStructures::List< SystemAddress > &addresses)
void | RemoveRankingAddress (SystemAddress addr)
void | ClearRankingAddresses (void)
| Clears all addresses added with AddRankingAddress().
void | SetRoomsPlugin (RoomsPlugin *rp)
| To use RoomsPlugin and Lobby2Server together, register RoomsPlugin with this funcrtion.
void | SetRoomsPluginAddress (SystemAddress address)
| This is similar to SetRoomsPlugin(), except the plugin is on another system.
void | SetConfigurationProperties (ConfigurationProperties c)
| Set the desired configuration properties. This is read during runtime from threads.
const ConfigurationProperties * | GetConfigurationProperties (void) const
| Get the previously set configuration properties.
void | SetPresence (const RakNet::Lobby2Presence &presence, RakNet::RakString userHandle)
void | GetPresence (RakNet::Lobby2Presence &presence, RakNet::RakString userHandle)

## Protected Member Functions

void | Update (void)
| Update is called every time a packet is checked for .
PluginReceiveResult | OnReceive (Packet *packet)
void | OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)

## Detailed Description

The base class for the lobby server, without database specific functionality.

This is a plugin which will take incoming messages via Lobby2Client_PC::SendMessage(), process them, and send back the same messages with output and a result code Unlike the first implementation of the lobby server, this is a thin plugin that mostly just sends messages to threads and sends back the results.

## Member Function Documentation

void RakNet::Lobby2Server::AddAdminAddress | ( | SystemAddress | addr | ) |

If Lobby2Message::RequiresAdmin() returns true, the message can only be processed from a remote system if the sender's system address is first added().

This is useful if you want to administrate the server remotely

void RakNet::Lobby2Server::AddRankingAddress | ( | SystemAddress | addr | ) |

If Lobby2Message::RequiresRankingPermission() returns true, then the system that sent the command must be registered with AddRankingAddress().

Parameters:

  `[in]` | addr | Address to allow

virtual bool RakNet::Lobby2Server::ConnectToDB | ( | const char * | conninfo,
|  | int | numWorkerThreads |
| ) |  |  | `[pure virtual]`

Connect to the database numWorkerThreads times using the connection string.

Parameters:

  `[in]` | conninfo | See the postgre docs

Returns:
  True on success, false on failure.

Implemented in RakNet::Lobby2Server_PGSQL.

void RakNet::Lobby2Server::ExecuteCommand | ( | Lobby2ServerCommand * | command | ) |

Add a command, which contains a message and other data such as who send the message.

The command will be processed according to its implemented virtual functions. Most likely it will be processed in a thread to run database commands

void RakNet::Lobby2Server::GetPresence | ( | RakNet::Lobby2Presence & | presence,
|  | RakNet::RakString | userHandle |
| ) |  |  |

Get the presence of a logged in user, by handle

Parameters:

  `[out]` | presence | Presence info of requested user
  `[in]` | userHandle | Handle of the user

bool RakNet::Lobby2Server::HasRankingAddress | ( | const DataStructures::List< SystemAddress > & | addresses | ) |

Returns if an address was previously added with AddRankingAddress()

Parameters:

  `[in]` | addr | Address to check

void RakNet::Lobby2Server::OnClosedConnection | ( | SystemAddress | systemAddress,
|  | RakNetGUID | rakNetGUID,
|  | PI2_LostConnectionReason | lostConnectionReason |
| ) |  |  | `[protected, 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.

PluginReceiveResult RakNet::Lobby2Server::OnReceive | ( | Packet * | packet | ) | `[protected, 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.

void RakNet::Lobby2Server::RemoveRankingAddress | ( | SystemAddress | addr | ) |

Removes an addressed added with AddRankingAddress()

Parameters:

  `[in]` | addr | Address to check

void RakNet::Lobby2Server::SendMessage | ( | Lobby2Message * | msg,
|  | const DataStructures::List< SystemAddress > & | recipients |
| ) |  |  |

Lobby2Message encapsulates a user command, containing both input and output data.

This will serialize and transmit that command

void RakNet::Lobby2Server::SetPresence | ( | const RakNet::Lobby2Presence & | presence,
|  | RakNet::RakString | userHandle |
| ) |  |  |

Set the presence of a logged in user

Parameters:

  `[in]` | presence | Presence info of this user

void RakNet::Lobby2Server::SetRoomsPlugin | ( | RoomsPlugin * | rp | ) |

To use RoomsPlugin and Lobby2Server together, register RoomsPlugin with this funcrtion.

The rooms plugin does not automatically handle users logging in and logging off, or renaming users. You can have Lobby2Server manage this for you by calling SetRoomsPlugin() with a pointer to the rooms plugin, if it is on the local system. This will call RoomsPlugin::LoginRoomsParticipant() and RoomsPlugin::LogoffRoomsParticipant() as the messages L2MID_Client_Login and L2MID_Client_Logoff arrive This will use the pointer to RoomsPlugin directly. Setting this will disable SetRoomsPluginAddress()

Note:
  This is an empty function. You must define __INTEGRATE_LOBBY2_WITH_ROOMS_PLUGIN and link with RoomsPlugin.h to use it()

void RakNet::Lobby2Server::SetRoomsPluginAddress | ( | SystemAddress | address | ) |

This is similar to SetRoomsPlugin(), except the plugin is on another system.

This will set the system address of that system to send the login and logoff commands to. For this function to work, you must first call RoomsPlugin::AddLoginServerAddress() so that RoomsPlugin will accept the incoming login and logoff messages.

Note:
  This is an empty function. You must define __INTEGRATE_LOBBY2_WITH_ROOMS_PLUGIN and link with RoomsPlugin.h to use it()

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

- d:/RakNet-3.x/DependentExtensions/Lobby2/Lobby2Server.h