network_internal.h File Reference

Variables and function used internally. More...

#include "network_func.h"
#include "core/tcp_game.h"
#include "../command_type.h"

Go to the source code of this file.

Data Structures

struct  CommandPacket
 Everything we need to know about a command to be able to execute it. More...

Defines

#define _ddc_fastforward   (false)
 Helper variable to make the dedicated server go fast until the (first) join.

Typedefs

typedef class
ServerNetworkGameSocketHandler 
NetworkClientSocket

Enumerations

enum  NetworkJoinStatus {
  NETWORK_JOIN_STATUS_CONNECTING, NETWORK_JOIN_STATUS_AUTHORIZING, NETWORK_JOIN_STATUS_WAITING, NETWORK_JOIN_STATUS_DOWNLOADING,
  NETWORK_JOIN_STATUS_PROCESSING, NETWORK_JOIN_STATUS_REGISTERING, NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO, NETWORK_JOIN_STATUS_END
}
enum  NetworkLanguage {
  NETLANG_ANY = 0, NETLANG_ENGLISH, NETLANG_GERMAN, NETLANG_FRENCH,
  NETLANG_BRAZILIAN, NETLANG_BULGARIAN, NETLANG_CHINESE, NETLANG_CZECH,
  NETLANG_DANISH, NETLANG_DUTCH, NETLANG_ESPERANTO, NETLANG_FINNISH,
  NETLANG_HUNGARIAN, NETLANG_ICELANDIC, NETLANG_ITALIAN, NETLANG_JAPANESE,
  NETLANG_KOREAN, NETLANG_LITHUANIAN, NETLANG_NORWEGIAN, NETLANG_POLISH,
  NETLANG_PORTUGUESE, NETLANG_ROMANIAN, NETLANG_RUSSIAN, NETLANG_SLOVAK,
  NETLANG_SLOVENIAN, NETLANG_SPANISH, NETLANG_SWEDISH, NETLANG_TURKISH,
  NETLANG_UKRAINIAN, NETLANG_AFRIKAANS, NETLANG_CROATIAN, NETLANG_CATALAN,
  NETLANG_ESTONIAN, NETLANG_GALICIAN, NETLANG_GREEK, NETLANG_LATVIAN,
  NETLANG_COUNT
}
 

Language ids for server_lang and client_lang.

More...

Functions

void NetworkTCPQueryServer (NetworkAddress address)
void GetBindAddresses (NetworkAddressList *addresses, uint16 port)
 Get the addresses to bind to.
void NetworkAddServer (const char *b)
void NetworkRebuildHostList ()
void UpdateNetworkGameWindow (bool unselect)
 Update the network new window because a new server is found on the network.
bool IsNetworkCompatibleVersion (const char *version)
 Checks whether the given version string is compatible with our version.
void NetworkDistributeCommands ()
void NetworkExecuteLocalCommandQueue ()
 Execute all commands on the local command queue that ought to be executed this frame.
void NetworkFreeLocalCommandQueue ()
 Free the local command queues.
void NetworkSyncCommandQueue (NetworkClientSocket *cs)
 Sync our local command queue to the command queue of the given socket.
void NetworkError (StringID error_string)
void NetworkTextMessage (NetworkAction action, TextColour colour, bool self_send, const char *name, const char *str="", int64 data=0)
uint NetworkCalculateLag (const NetworkClientSocket *cs)
NetworkClientSocket * NetworkFindClientStateFromClientID (ClientID client_id)
 Return the client state given it's client-identifier.
StringID GetNetworkErrorMsg (NetworkErrorCode err)
 Retrieve the string id of an internal error number.
bool NetworkFindName (char new_name[NETWORK_CLIENT_NAME_LENGTH])
const char * GenerateCompanyPasswordHash (const char *password, const char *password_server_id, uint32 password_game_seed)
 Hash the given password using server ID and game seed.

Variables

uint32 _frame_counter_server
uint32 _frame_counter_max
uint32 _frame_counter
uint32 _last_sync_frame
NetworkAddressList _broadcast_list
uint32 _sync_seed_1
uint32 _sync_frame
bool _network_first_time
NetworkJoinStatus _network_join_status
uint8 _network_join_waiting
uint32 _network_join_bytes
uint32 _network_join_bytes_total
uint8 _network_reconnect
bool _network_udp_server
uint16 _network_udp_broadcast
uint8 _network_advertise_retries
CompanyMask _network_company_passworded
 Bitmask of the password status of all companies.

Detailed Description

Variables and function used internally.

Definition in file network_internal.h.


Define Documentation

#define _ddc_fastforward   (false)

Helper variable to make the dedicated server go fast until the (first) join.

Used to load the desync debug logs, i.e. for reproducing a desync. There's basically no need to ever enable this, unless you really know what you are doing, i.e. debugging a desync.

Definition at line 50 of file network_internal.h.


Enumeration Type Documentation

Language ids for server_lang and client_lang.

Do NOT modify the order.

Definition at line 69 of file network_internal.h.


Function Documentation

const char* GenerateCompanyPasswordHash ( const char *  password,
const char *  password_server_id,
uint32  password_game_seed 
)

Hash the given password using server ID and game seed.

Parameters:
password Password to hash.
password_server_id Server ID.
password_game_seed Game seed.
Returns:
The hashed password.

Definition at line 179 of file network.cpp.

References lengthof, NETWORK_SERVER_ID_LENGTH, and StrEmpty().

Referenced by NetworkServerSetCompanyPassword().

void GetBindAddresses ( NetworkAddressList addresses,
uint16  port 
)

Get the addresses to bind to.

Parameters:
addresses the list to write to.
port the port to bind to.

Definition at line 610 of file network.cpp.

References SmallVector< T, S >::Append(), SmallVector< T, S >::Begin(), SmallVector< T, S >::End(), and SmallVector< T, S >::Length().

Referenced by TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::Listen().

StringID GetNetworkErrorMsg ( NetworkErrorCode  err  ) 

Retrieve the string id of an internal error number.

Parameters:
err NetworkErrorCode
Returns:
the StringID

Definition at line 297 of file network.cpp.

References lengthof.

bool IsNetworkCompatibleVersion ( const char *  other  ) 

Checks whether the given version string is compatible with our version.

Parameters:
other the version string to compare to

Definition at line 1077 of file network.cpp.

References NETWORK_REVISION_LENGTH.

NetworkClientSocket* NetworkFindClientStateFromClientID ( ClientID  client_id  ) 

Return the client state given it's client-identifier.

Parameters:
client_id the ClientID to search for
Returns:
return a pointer to the corresponding NetworkClientSocket struct or NULL when not found

Definition at line 127 of file network.cpp.

Referenced by NetworkServerDoMove().

void NetworkSyncCommandQueue ( NetworkClientSocket *  cs  ) 

Sync our local command queue to the command queue of the given socket.

This is needed for the case where we receive a command before saving the game for a joining client, but without the execution of those commands. Not syncing those commands means that the client will never get them and as such will be in a desynced state from the time it started with joining.

Parameters:
cs The client to sync the queue to.

Definition at line 183 of file network_command.cpp.

References CommandContainer::callback, CommandPacket::next, and CommandQueue::Peek().

void UpdateNetworkGameWindow ( bool  unselect  ) 

Update the network new window because a new server is found on the network.

Parameters:
unselect unselect the currently selected item

Definition at line 73 of file network_gui.cpp.

References InvalidateWindowData().

Referenced by NetworkGameListAddItem(), NetworkGameListHandleDelayedInsert(), and NetworkGameListRemoveItem().


Generated on Fri Mar 18 23:17:45 2011 for OpenTTD by  doxygen 1.6.1