# 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 (void)
| Update is called every time a packet is checked for .
PluginReceiveResult | OnReceive (Packet *packet)
void | OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
void | OnShutdown (void)
| Called when RakPeer is shutdown.

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

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

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