Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions

# ServerNetworkAdminSocketHandler Class Reference

Class for handling the server side of the game connection. More...

`#include <network_admin.h>`

Inheritance diagram for ServerNetworkAdminSocketHandler:

## Public Member Functions
| ServerNetworkAdminSocketHandler (SOCKET s)
| Create a new socket for the server side of the admin network.
| ~ServerNetworkAdminSocketHandler ()
| Clear everything related to this admin.
NetworkRecvStatus | SendError (NetworkErrorCode error)
NetworkRecvStatus | SendWelcome ()
NetworkRecvStatus | SendNewGame ()
NetworkRecvStatus | SendShutdown ()
NetworkRecvStatus | SendDate ()
NetworkRecvStatus | SendClientJoin (ClientID client_id)
NetworkRecvStatus | SendClientInfo (const NetworkClientSocket *cs, const NetworkClientInfo *ci)
| Send an initial set of data from some client's information.
NetworkRecvStatus | SendClientUpdate (const NetworkClientInfo *ci)
NetworkRecvStatus | SendClientQuit (ClientID client_id)
NetworkRecvStatus | SendClientError (ClientID client_id, NetworkErrorCode error)
NetworkRecvStatus | SendCompanyNew (CompanyID company_id)
NetworkRecvStatus | SendCompanyInfo (const Company *c)
NetworkRecvStatus | SendCompanyUpdate (const Company *c)
NetworkRecvStatus | SendCompanyRemove (CompanyID company_id, AdminCompanyRemoveReason bcrr)
NetworkRecvStatus | SendCompanyEconomy ()
NetworkRecvStatus | SendCompanyStats ()
NetworkRecvStatus | SendChat (NetworkAction action, DestType desttype, ClientID client_id, const char *msg, int64 data)
NetworkRecvStatus | SendRcon (uint16 colour, const char *command)
NetworkRecvStatus | SendConsole (const char *origin, const char *command)
NetworkRecvStatus | SendCmdNames ()
NetworkRecvStatus | SendCmdLogging (ClientID client_id, const CommandPacket *cp)
## Static Public Member Functions
static void | Send ()
| Send the packets for the server sockets.
static void | AcceptConnection (SOCKET s, const NetworkAddress &address)
static bool | AllowConnection ()
| Whether a connection is allowed or not at this moment.
static void | WelcomeAll ()
| Send a Welcome packet to all connected admins.
static const char * | GetName ()
| Get the name used by the listener.
## Data Fields
AdminUpdateFrequency | update_frequency [ADMIN_UPDATE_END]
| Admin requested update intervals.
uint32 | realtime_connect
| Time of connection.
NetworkAddress | address
| Address of the admin.
## Protected Member Functions
| DECLARE_ADMIN_RECEIVE_COMMAND (ADMIN_PACKET_ADMIN_JOIN)
| DECLARE_ADMIN_RECEIVE_COMMAND (ADMIN_PACKET_ADMIN_QUIT)
| DECLARE_ADMIN_RECEIVE_COMMAND (ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY)
| DECLARE_ADMIN_RECEIVE_COMMAND (ADMIN_PACKET_ADMIN_POLL)
| DECLARE_ADMIN_RECEIVE_COMMAND (ADMIN_PACKET_ADMIN_CHAT)
| DECLARE_ADMIN_RECEIVE_COMMAND (ADMIN_PACKET_ADMIN_RCON)
NetworkRecvStatus | SendProtocol ()

## Detailed Description

Class for handling the server side of the game connection.

Definition at line 28 of file network_admin.h.

## Constructor & Destructor Documentation

ServerNetworkAdminSocketHandler::ServerNetworkAdminSocketHandler | ( | SOCKET | s | ) |

Create a new socket for the server side of the admin network.

Parameters:

  | s | The socket to connect with.

Definition at line 61 of file network_admin.cpp.

References _network_admins_connected, _realtime_tick, realtime_connect, and NetworkAdminSocketHandler::status.

## Member Function Documentation

bool ServerNetworkAdminSocketHandler::AllowConnection | ( |  | ) | `[static]`

Whether a connection is allowed or not at this moment.

Returns:
  Whether the connection is allowed.

Definition at line 82 of file network_admin.cpp.

References _network_admins_connected, _settings_client, NetworkSettings::admin_password, MAX_ADMINS, ClientSettings::network, and StrEmpty().

static const char* ServerNetworkAdminSocketHandler::GetName | ( |  | ) | `[inline, static]`

Get the name used by the listener.

Returns:
  the name to show in debug logs and the like.

Definition at line 79 of file network_admin.h.

void ServerNetworkAdminSocketHandler::Send | ( |  | ) | `[static]`

Send the packets for the server sockets.

Definition at line 88 of file network_admin.cpp.

References _realtime_tick, ADMIN_AUTHORISATION_TIMEOUT, ADMIN_STATUS_INACTIVE, NetworkAdminSocketHandler::CloseConnection(), DEBUG, realtime_connect, NetworkTCPSocketHandler::SendPackets(), NetworkAdminSocketHandler::status, and NetworkTCPSocketHandler::writable.

NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo | ( | const NetworkClientSocket * | cs,
|  | const NetworkClientInfo * | ci |
| ) |  |  |

Send an initial set of data from some client's information.

Parameters:

  | cs | The socket of the client.
  | ci | The information about the client.

Definition at line 207 of file network_admin.cpp.

References ADMIN_PACKET_SERVER_CLIENT_INFO, NetworkClientInfo::client_id, NetworkClientInfo::client_lang, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, NetworkClientInfo::join_date, Packet::Send_string(), and NetworkTCPSocketHandler::SendPacket().

Referenced by NetworkAdminClientInfo().

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

- src/network/network_admin.h
- src/network/network_admin.cpp