OpenTTD Source  1.11.0-beta2
network_admin.h File Reference
#include "network_internal.h"
#include "core/tcp_listen.h"
#include "core/tcp_admin.h"

Go to the source code of this file.

Data Structures

class  ServerNetworkAdminSocketHandler
 Class for handling the server side of the game connection. More...
 
struct  ServerNetworkAdminSocketHandler::ServerNetworkAdminSocketHandlerFilter
 

Typedefs

typedef Pool< ServerNetworkAdminSocketHandler, AdminIndex, 2, MAX_ADMINS, PT_NADMINNetworkAdminSocketPool
 Pool with all admin connections.
 

Functions

void NetworkAdminClientInfo (const NetworkClientSocket *cs, bool new_client=false)
 Notify the admin network of a new client (if they did opt in for the respective update). More...
 
void NetworkAdminClientUpdate (const NetworkClientInfo *ci)
 Notify the admin network of a client update (if they did opt in for the respective update). More...
 
void NetworkAdminClientQuit (ClientID client_id)
 Notify the admin network that a client quit (if they have opt in for the respective update). More...
 
void NetworkAdminClientError (ClientID client_id, NetworkErrorCode error_code)
 Notify the admin network of a client error (if they have opt in for the respective update). More...
 
void NetworkAdminCompanyInfo (const Company *company, bool new_company)
 Notify the admin network of company details. More...
 
void NetworkAdminCompanyUpdate (const Company *company)
 Notify the admin network of company updates. More...
 
void NetworkAdminCompanyRemove (CompanyID company_id, AdminCompanyRemoveReason bcrr)
 Notify the admin network of a company to be removed (including the reason why). More...
 
void NetworkAdminChat (NetworkAction action, DestType desttype, ClientID client_id, const char *msg, int64 data=0, bool from_admin=false)
 Send chat to the admin network (if they did opt in for the respective update).
 
void NetworkAdminUpdate (AdminUpdateFrequency freq)
 Send (push) updates to the admin network as they have registered for these updates. More...
 
void NetworkServerSendAdminRcon (AdminIndex admin_index, TextColour colour_code, const char *string)
 Pass the rcon reply to the admin. More...
 
void NetworkAdminConsole (const char *origin, const char *string)
 Send console to the admin network (if they did opt in for the respective update). More...
 
void NetworkAdminGameScript (const char *json)
 Send GameScript JSON to the admin network (if they did opt in for the respective update). More...
 
void NetworkAdminCmdLogging (const NetworkClientSocket *owner, const CommandPacket *cp)
 Distribute CommandPacket details over the admin network for logging purposes. More...
 

Variables

AdminIndex _redirect_console_to_admin
 Redirection of the (remote) console to the admin.
 
NetworkAdminSocketPool _networkadminsocket_pool
 The pool with sockets/clients.
 

Detailed Description

Server part of the admin network protocol.

Definition in file network_admin.h.

Function Documentation

◆ NetworkAdminClientError()

void NetworkAdminClientError ( ClientID  client_id,
NetworkErrorCode  error_code 
)

Notify the admin network of a client error (if they have opt in for the respective update).

Parameters
client_idthe client that made the error.
error_codethe error that was caused.

Definition at line 859 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CLIENT_INFO, and ServerNetworkAdminSocketHandler::IterateActive().

◆ NetworkAdminClientInfo()

void NetworkAdminClientInfo ( const NetworkClientSocket cs,
bool  new_client 
)

Notify the admin network of a new client (if they did opt in for the respective update).

Parameters
csthe client info.
new_clientif this is a new client, send the respective packet too.

Definition at line 816 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CLIENT_INFO, and ServerNetworkAdminSocketHandler::IterateActive().

◆ NetworkAdminClientQuit()

void NetworkAdminClientQuit ( ClientID  client_id)

Notify the admin network that a client quit (if they have opt in for the respective update).

Parameters
client_idof the client that quit.

Definition at line 845 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CLIENT_INFO, and ServerNetworkAdminSocketHandler::IterateActive().

◆ NetworkAdminClientUpdate()

void NetworkAdminClientUpdate ( const NetworkClientInfo ci)

Notify the admin network of a client update (if they did opt in for the respective update).

Parameters
cithe client info.

Definition at line 832 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CLIENT_INFO, and ServerNetworkAdminSocketHandler::IterateActive().

Referenced by NetworkUpdateClientInfo().

◆ NetworkAdminCmdLogging()

void NetworkAdminCmdLogging ( const NetworkClientSocket owner,
const CommandPacket cp 
)

Distribute CommandPacket details over the admin network for logging purposes.

Parameters
ownerThe owner of the CommandPacket (who sent us the CommandPacket).
cpThe CommandPacket to be distributed.

Definition at line 975 of file network_admin.cpp.

References _network_own_client_id, ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CMD_LOGGING, and ServerNetworkAdminSocketHandler::IterateActive().

◆ NetworkAdminCompanyInfo()

void NetworkAdminCompanyInfo ( const Company company,
bool  new_company 
)

Notify the admin network of company details.

Parameters
companythe company of which details will be sent into the admin network.
new_companywhether this is a new company or not.

Definition at line 873 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_COMPANY_INFO, DEBUG, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and ServerNetworkAdminSocketHandler::IterateActive().

Referenced by NetworkServerNewCompany().

◆ NetworkAdminCompanyRemove()

void NetworkAdminCompanyRemove ( CompanyID  company_id,
AdminCompanyRemoveReason  bcrr 
)

Notify the admin network of a company to be removed (including the reason why).

Parameters
company_idID of the company that got removed.
bcrrthe reason why the company got removed (e.g. bankruptcy).

Definition at line 910 of file network_admin.cpp.

References ServerNetworkAdminSocketHandler::IterateActive().

Referenced by CompanyAdminRemove().

◆ NetworkAdminCompanyUpdate()

void NetworkAdminCompanyUpdate ( const Company company)

Notify the admin network of company updates.

Parameters
companycompany of which updates are going to be sent into the admin network.

Definition at line 894 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_COMPANY_INFO, and ServerNetworkAdminSocketHandler::IterateActive().

Referenced by CompanyAdminUpdate(), and NetworkServerUpdateCompanyPassworded().

◆ NetworkAdminConsole()

void NetworkAdminConsole ( const char *  origin,
const char *  string 
)

Send console to the admin network (if they did opt in for the respective update).

Parameters
originthe origin of the message.
stringthe message as printed on the console.

Definition at line 948 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CONSOLE, and ServerNetworkAdminSocketHandler::IterateActive().

◆ NetworkAdminGameScript()

void NetworkAdminGameScript ( const char *  json)

Send GameScript JSON to the admin network (if they did opt in for the respective update).

Parameters
jsonThe JSON data as received from the GameScript.

Definition at line 961 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_GAMESCRIPT, and ServerNetworkAdminSocketHandler::IterateActive().

◆ NetworkAdminUpdate()

void NetworkAdminUpdate ( AdminUpdateFrequency  freq)

Send (push) updates to the admin network as they have registered for these updates.

Parameters
freqthe frequency to be processed.

Definition at line 1000 of file network_admin.cpp.

References ADMIN_UPDATE_COMPANY_ECONOMY, ADMIN_UPDATE_COMPANY_STATS, ADMIN_UPDATE_DATE, ADMIN_UPDATE_END, and ServerNetworkAdminSocketHandler::IterateActive().

Referenced by NetworkServerDailyLoop(), NetworkServerMonthlyLoop(), and NetworkServerYearlyLoop().

◆ NetworkServerSendAdminRcon()

void NetworkServerSendAdminRcon ( AdminIndex  admin_index,
TextColour  colour_code,
const char *  string 
)

Pass the rcon reply to the admin.

Parameters
admin_indexThe admin to give the reply.
colour_codeThe colour of the string.
stringThe string to show.

Definition at line 938 of file network_admin.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkadminsocket_pool >::Get().

Referenced by IConsolePrint().