network_admin.cpp File Reference

Server part of the admin network protocol. More...

#include "../stdafx.h"
#include "../debug.h"
#include "../strings_func.h"
#include "../date_func.h"
#include "network_admin.h"
#include "network.h"
#include "network_base.h"
#include "../company_base.h"
#include "../console_func.h"
#include "../core/pool_func.hpp"
#include "../map_func.h"
#include "../rev.h"
#include "table/strings.h"

Go to the source code of this file.

Functions

 assert_compile (lengthof(_admin_update_type_frequencies)==ADMIN_UPDATE_END)
 DEF_ADMIN_RECEIVE_COMMAND (Server, ADMIN_PACKET_ADMIN_RCON)
 DEF_ADMIN_RECEIVE_COMMAND (Server, ADMIN_PACKET_ADMIN_JOIN)
 DEF_ADMIN_RECEIVE_COMMAND (Server, ADMIN_PACKET_ADMIN_QUIT)
 DEF_ADMIN_RECEIVE_COMMAND (Server, ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY)
 DEF_ADMIN_RECEIVE_COMMAND (Server, ADMIN_PACKET_ADMIN_POLL)
 DEF_ADMIN_RECEIVE_COMMAND (Server, ADMIN_PACKET_ADMIN_CHAT)
void NetworkAdminClientInfo (const NetworkClientInfo *ci, bool new_client)
 Notify the admin network of a new client (if they did opt in for the respective update).
void NetworkAdminClientUpdate (const NetworkClientInfo *ci)
 Notify the admin network of a client update (if they did opt in for the respective update).
void NetworkAdminClientQuit (ClientID client_id)
 Notify the admin network that a client quit (if they have opt in for the respective update).
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).
void NetworkAdminCompanyInfo (const Company *company, bool new_company)
 Notify the admin network of company details.
void NetworkAdminCompanyUpdate (const Company *company)
 Notify the admin network of company updates.
void NetworkAdminCompanyRemove (CompanyID company_id, AdminCompanyRemoveReason bcrr)
 Notify the admin network of a company to be removed (including the reason why).
void NetworkAdminChat (NetworkAction action, DestType desttype, ClientID client_id, const char *msg, int64 data, bool from_admin)
 Send chat to the admin network (if they did opt in for the respective update).
void NetworkServerSendAdminRcon (AdminIndex admin_index, ConsoleColour colour_code, const char *string)
 Pass the rcon reply to the admin.
void NetworkAdminConsole (const char *origin, const char *string)
 Send console 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.

Variables

AdminIndex _redirect_console_to_admin = INVALID_ADMIN_ID
 Redirection of the (remote) console to the admin.
byte _network_admins_connected = 0
 The amount of admins connected.
NetworkAdminSocketPool _networkadminsocket_pool ("NetworkAdminSocket")
static const int ADMIN_AUTHORISATION_TIMEOUT = 10000
 The timeout for authorisation of the client.
static const AdminUpdateFrequency _admin_update_type_frequencies []
 Frequencies, which may be registered for a certain update type.

Detailed Description

Server part of the admin network protocol.

Definition in file network_admin.cpp.


Function Documentation

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_id the client that made the error.
error_code the error that was caused.

Definition at line 645 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CLIENT_INFO, and ServerNetworkAdminSocketHandler::update_frequency.

void NetworkAdminClientInfo ( const NetworkClientInfo ci,
bool  new_client 
)

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

Parameters:
ci the client info.
new_client if this is a new client, send the respective packet too.

Definition at line 599 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CLIENT_INFO, NetworkClientInfo::client_id, and ServerNetworkAdminSocketHandler::update_frequency.

void NetworkAdminClientQuit ( ClientID  client_id  ) 

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

Parameters:
client_id of the client that quit.

Definition at line 630 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CLIENT_INFO, and ServerNetworkAdminSocketHandler::update_frequency.

void NetworkAdminClientUpdate ( const NetworkClientInfo ci  ) 

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

Parameters:
ci the client info.

Definition at line 616 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CLIENT_INFO, and ServerNetworkAdminSocketHandler::update_frequency.

void NetworkAdminCompanyInfo ( const Company company,
bool  new_company 
)

Notify the admin network of company details.

Parameters:
company the company of which details will be sent into the admin network.
new_company whether this is a new company or not.

Definition at line 660 of file network_admin.cpp.

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

Referenced by CmdCompanyCtrl().

void NetworkAdminCompanyRemove ( CompanyID  company_id,
AdminCompanyRemoveReason  bcrr 
)

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

Parameters:
company_id ID of the company that got removed.
bcrr the reason why the company got removed (e.g. bankruptcy).

Definition at line 699 of file network_admin.cpp.

Referenced by CompanyAdminBankrupt().

void NetworkAdminCompanyUpdate ( const Company company  ) 

Notify the admin network of company updates.

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

Definition at line 682 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_COMPANY_INFO, and ServerNetworkAdminSocketHandler::update_frequency.

Referenced by CompanyAdminUpdate().

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

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

Parameters:
origin the origin of the message.
string the message as printed on the console.

Definition at line 739 of file network_admin.cpp.

References ADMIN_FREQUENCY_AUTOMATIC, ADMIN_UPDATE_CONSOLE, and ServerNetworkAdminSocketHandler::update_frequency.

Referenced by debug_print(), and IConsolePrint().

void NetworkAdminUpdate ( AdminUpdateFrequency  freq  ) 

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

Parameters:
freq the frequency to be processd.

Definition at line 764 of file network_admin.cpp.

References ADMIN_UPDATE_COMPANY_ECONOMY, ADMIN_UPDATE_COMPANY_STATS, ADMIN_UPDATE_DATE, and ServerNetworkAdminSocketHandler::update_frequency.

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

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

Pass the rcon reply to the admin.

Parameters:
admin_index The admin to give the reply.
colour_code The colour of the string.
string The string to show.

Definition at line 729 of file network_admin.cpp.

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

Referenced by IConsolePrint().


Variable Documentation

Redirection of the (remote) console to the admin.

Definition at line 32 of file network_admin.cpp.

Referenced by IConsolePrint(), and ServerNetworkAdminSocketHandler::~ServerNetworkAdminSocketHandler().

const int ADMIN_AUTHORISATION_TIMEOUT = 10000 [static]

The timeout for authorisation of the client.

Definition at line 41 of file network_admin.cpp.

Referenced by ServerNetworkAdminSocketHandler::Send().


Generated on Thu Dec 23 23:41:39 2010 for OpenTTD by  doxygen 1.6.1