# RakNet::Lobby2Server Class Reference

`#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
void | SendMessage (Lobby2Message *msg, SystemAddress recipient)
void | ExecuteCommand (Lobby2ServerCommand *command)
void | AddAdminAddress (SystemAddress addr)
bool | IsAdminAddress (SystemAddress addr)
| 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 | SetRoomsPlugin (RoomsPlugin *rp)
void | SetRoomsPluginAddress (SystemAddress address)
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.
## Protected Member Functions
void | Update (RakPeerInterface *peer)
PluginReceiveResult | OnReceive (RakPeerInterface *peer, Packet *packet)
void | OnCloseConnection (RakPeerInterface *peer, SystemAddress systemAddress)
void | OnShutdown (RakPeerInterface *peer)

## 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 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

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 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 Lobby2Server::OnCloseConnection | ( | RakPeerInterface * | peer,
|  | SystemAddress | systemAddress |
| ) |  |  | `[protected, virtual]`

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive
  `[in]` | systemAddress | The system whose connection was closed

Reimplemented from PluginInterface.

PluginReceiveResult Lobby2Server::OnReceive | ( | RakPeerInterface * | peer,
|  | Packet * | packet |
| ) |  |  | `[protected, virtual]`

OnReceive is called for every packet.

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive
  `[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 PluginInterface.

void Lobby2Server::OnShutdown | ( | RakPeerInterface * | peer | ) | `[protected, virtual]`

Called when RakPeer is shutdown

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface.

void Lobby2Server::SendMessage | ( | Lobby2Message * | msg,
|  | SystemAddress | recipient |
| ) |  |  |

Lobby2Message encapsulates a user command, containing both input and output data This will serialize and transmit that command

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

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 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()

void Lobby2Server::Update | ( | RakPeerInterface * | peer | ) | `[protected, virtual]`

Update is called every time a packet is checked for .

Parameters:

  `[in]` | peer | - the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface.

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

- C:/RakNet/DependentExtensions/Lobby2/Lobby2Server.h
- C:/RakNet/DependentExtensions/Lobby2/Lobby2Server.cpp