OpenTTD
Data Structures | Macros | Typedefs | Functions | Variables
network_server.h File Reference

Server part of the network protocol. More...

#include "network_internal.h"
#include "core/tcp_listen.h"
#include "../thread/thread.h"

Go to the source code of this file.

Data Structures

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

Macros

#define FOR_ALL_CLIENT_SOCKETS_FROM(var, start)   FOR_ALL_ITEMS_FROM(NetworkClientSocket, clientsocket_index, var, start)
 Iterate over all the sockets from a given starting point.
#define FOR_ALL_CLIENT_SOCKETS(var)   FOR_ALL_CLIENT_SOCKETS_FROM(var, 0)
 Iterate over all the sockets.

Typedefs

typedef
ServerNetworkGameSocketHandler 
NetworkClientSocket
 Make the code look slightly nicer/simpler.
typedef Pool
< NetworkClientSocket,
ClientIndex,
8, MAX_CLIENT_SLOTS,
PT_NCLIENT
NetworkClientSocketPool
 Pool with all client sockets.

Functions

void NetworkServer_Tick (bool send_frame)
 This is called every tick if this is a _network_server.
void NetworkServerSetCompanyPassword (CompanyID company_id, const char *password, bool already_hashed=true)
 Set/Reset a company password on the server end.
void NetworkServerUpdateCompanyPassworded (CompanyID company_id, bool passworded)
 Tell that a particular company is (not) passworded.

Variables

NetworkClientSocketPool _networkclientsocket_pool
 The pool with clients.

Detailed Description

Server part of the network protocol.

Definition in file network_server.h.

Macro Definition Documentation

#define FOR_ALL_CLIENT_SOCKETS (   var)    FOR_ALL_CLIENT_SOCKETS_FROM(var, 0)
#define FOR_ALL_CLIENT_SOCKETS_FROM (   var,
  start 
)    FOR_ALL_ITEMS_FROM(NetworkClientSocket, clientsocket_index, var, start)

Iterate over all the sockets from a given starting point.

Parameters
varThe variable to iterate with.
startThe start of the iteration.

Definition at line 133 of file network_server.h.

Typedef Documentation

typedef ServerNetworkGameSocketHandler NetworkClientSocket

Make the code look slightly nicer/simpler.

Definition at line 21 of file network_server.h.

Pool with all client sockets.

Definition at line 25 of file network_server.h.

Function Documentation

void NetworkServer_Tick ( bool  send_frame)
void NetworkServerSetCompanyPassword ( CompanyID  company_id,
const char *  password,
bool  already_hashed 
)

Set/Reset a company password on the server end.

Parameters
company_idID of the company the password should be changed for.
passwordThe new password.
already_hashedIs the given password already hashed?

Definition at line 1775 of file network_server.cpp.

References _network_company_states, _settings_client, _settings_game, GameSettings::game_creation, GenerateCompanyPasswordHash(), GameCreationSettings::generation_seed, Company::IsValidHumanID(), lastof, ClientSettings::network, NetworkSettings::network_id, NetworkServerUpdateCompanyPassworded(), strecpy(), and StrEmpty().

Referenced by NetworkChangeCompanyPassword(), and ServerNetworkGameSocketHandler::Receive_CLIENT_SET_PASSWORD().

void NetworkServerUpdateCompanyPassworded ( CompanyID  company_id,
bool  passworded 
)

Tell that a particular company is (not) passworded.

Parameters
company_idThe company that got/removed the password.
passwordedWhether the password was received or removed.

Definition at line 2009 of file network_server.cpp.

References _network_company_passworded, FOR_ALL_CLIENT_SOCKETS, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), NetworkAdminCompanyUpdate(), NetworkCompanyIsPassworded(), SB(), SetWindowClassesDirty(), and WC_COMPANY.

Referenced by NetworkAutoCleanCompanies(), NetworkServerNewCompany(), and NetworkServerSetCompanyPassword().

Variable Documentation

NetworkClientSocketPool _networkclientsocket_pool

The pool with clients.