Files
@ r23371:9cd9ac4bfc93
Branch filter:
Location: cpp/openttd-patchpack/source/src/network/network_admin.h - annotation
r23371:9cd9ac4bfc93
5.6 KiB
text/x-c
Update: Translations from eints
dutch: 80 changes by JanWillem
dutch: 80 changes by JanWillem
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16263:61b0e0090f37 r16263:61b0e0090f37 r16252:adb3a595a401 r17642:ab10f4b22179 r17360:71e102cec3ce r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r17618:de4cf2622741 r17618:de4cf2622741 r17618:de4cf2622741 r17618:de4cf2622741 r17618:de4cf2622741 r17618:de4cf2622741 r18765:0c8917c89d77 r20557:e9618cd6365a r16252:adb3a595a401 r16252:adb3a595a401 r20557:e9618cd6365a r16252:adb3a595a401 r16256:b1e0699fee93 r16253:de82cc911ea3 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16262:95a75f09ea09 r16257:dd9a925ab7de r16258:7148460f4b1c r18269:684d990fd667 r16258:7148460f4b1c r16258:7148460f4b1c r16258:7148460f4b1c r16259:4ee91980c70f r16259:4ee91980c70f r16259:4ee91980c70f r16259:4ee91980c70f r16260:359332f8a09d r16261:f961727096d5 r16252:adb3a595a401 r16262:95a75f09ea09 r16263:61b0e0090f37 r16264:1f7e2ab6252c r18765:0c8917c89d77 r16923:67617ddad8d5 r16923:67617ddad8d5 r20556:36a12bc1d60a r16262:95a75f09ea09 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r16252:adb3a595a401 r17642:ab10f4b22179 r17642:ab10f4b22179 r17642:ab10f4b22179 r17642:ab10f4b22179 r17642:ab10f4b22179 r16252:adb3a595a401 r17642:ab10f4b22179 r17642:ab10f4b22179 r17642:ab10f4b22179 r17642:ab10f4b22179 r17642:ab10f4b22179 r16252:adb3a595a401 r16252:adb3a595a401 r18103:7fb0594f0cc7 r18103:7fb0594f0cc7 r18103:7fb0594f0cc7 r18103:7fb0594f0cc7 r18103:7fb0594f0cc7 r18103:7fb0594f0cc7 r18103:7fb0594f0cc7 r18103:7fb0594f0cc7 r17593:ff93f229063c r16258:7148460f4b1c r16258:7148460f4b1c r16258:7148460f4b1c r16259:4ee91980c70f r16259:4ee91980c70f r16259:4ee91980c70f r16262:95a75f09ea09 r16262:95a75f09ea09 r16256:b1e0699fee93 r16955:558d50c26a94 r16264:1f7e2ab6252c r18765:0c8917c89d77 r16923:67617ddad8d5 r16256:b1e0699fee93 r16252:adb3a595a401 r16252:adb3a595a401 | /* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file network_admin.h Server part of the admin network protocol. */
#ifndef NETWORK_ADMIN_H
#define NETWORK_ADMIN_H
#ifdef ENABLE_NETWORK
#include "network_internal.h"
#include "core/tcp_listen.h"
#include "core/tcp_admin.h"
extern AdminIndex _redirect_console_to_admin;
class ServerNetworkAdminSocketHandler;
/** Pool with all admin connections. */
typedef Pool<ServerNetworkAdminSocketHandler, AdminIndex, 2, MAX_ADMINS, PT_NADMIN> NetworkAdminSocketPool;
extern NetworkAdminSocketPool _networkadminsocket_pool;
/** Class for handling the server side of the game connection. */
class ServerNetworkAdminSocketHandler : public NetworkAdminSocketPool::PoolItem<&_networkadminsocket_pool>, public NetworkAdminSocketHandler, public TCPListenHandler<ServerNetworkAdminSocketHandler, ADMIN_PACKET_SERVER_FULL, ADMIN_PACKET_SERVER_BANNED> {
protected:
virtual NetworkRecvStatus Receive_ADMIN_JOIN(Packet *p);
virtual NetworkRecvStatus Receive_ADMIN_QUIT(Packet *p);
virtual NetworkRecvStatus Receive_ADMIN_UPDATE_FREQUENCY(Packet *p);
virtual NetworkRecvStatus Receive_ADMIN_POLL(Packet *p);
virtual NetworkRecvStatus Receive_ADMIN_CHAT(Packet *p);
virtual NetworkRecvStatus Receive_ADMIN_RCON(Packet *p);
virtual NetworkRecvStatus Receive_ADMIN_GAMESCRIPT(Packet *p);
virtual NetworkRecvStatus Receive_ADMIN_PING(Packet *p);
NetworkRecvStatus SendProtocol();
NetworkRecvStatus SendPong(uint32 d1);
public:
AdminUpdateFrequency update_frequency[ADMIN_UPDATE_END]; ///< Admin requested update intervals.
uint32 realtime_connect; ///< Time of connection.
NetworkAddress address; ///< Address of the admin.
ServerNetworkAdminSocketHandler(SOCKET s);
~ServerNetworkAdminSocketHandler();
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);
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 SendGameScript(const char *json);
NetworkRecvStatus SendCmdNames();
NetworkRecvStatus SendCmdLogging(ClientID client_id, const CommandPacket *cp);
NetworkRecvStatus SendRconEnd(const char *command);
static void Send();
static void AcceptConnection(SOCKET s, const NetworkAddress &address);
static bool AllowConnection();
static void WelcomeAll();
/**
* Get the name used by the listener.
* @return the name to show in debug logs and the like.
*/
static const char *GetName()
{
return "admin";
}
};
/**
* Iterate over all the sockets from a given starting point.
* @param var The variable to iterate with.
* @param start The start of the iteration.
*/
#define FOR_ALL_ADMIN_SOCKETS_FROM(var, start) FOR_ALL_ITEMS_FROM(ServerNetworkAdminSocketHandler, adminsocket_index, var, start)
/**
* Iterate over all the sockets.
* @param var The variable to iterate with.
*/
#define FOR_ALL_ADMIN_SOCKETS(var) FOR_ALL_ADMIN_SOCKETS_FROM(var, 0)
/**
* Iterate over all the active sockets.
* @param var The variable to iterate with.
*/
#define FOR_ALL_ACTIVE_ADMIN_SOCKETS(var) \
FOR_ALL_ADMIN_SOCKETS(var) \
if (var->GetAdminStatus() == ADMIN_STATUS_ACTIVE)
void NetworkAdminClientInfo(const NetworkClientSocket *cs, bool new_client = false);
void NetworkAdminClientUpdate(const NetworkClientInfo *ci);
void NetworkAdminClientQuit(ClientID client_id);
void NetworkAdminClientError(ClientID client_id, NetworkErrorCode error_code);
void NetworkAdminCompanyInfo(const Company *company, bool new_company);
void NetworkAdminCompanyUpdate(const Company *company);
void NetworkAdminCompanyRemove(CompanyID company_id, AdminCompanyRemoveReason bcrr);
void NetworkAdminChat(NetworkAction action, DestType desttype, ClientID client_id, const char *msg, int64 data = 0, bool from_admin = false);
void NetworkAdminUpdate(AdminUpdateFrequency freq);
void NetworkServerSendAdminRcon(AdminIndex admin_index, TextColour colour_code, const char *string);
void NetworkAdminConsole(const char *origin, const char *string);
void NetworkAdminGameScript(const char *json);
void NetworkAdminCmdLogging(const NetworkClientSocket *owner, const CommandPacket *cp);
#endif /* ENABLE_NETWORK */
#endif /* NETWORK_ADMIN_H */
|