OpenTTD Source: src/network/network_type.h File Reference

OpenTTD Source 15.3

Data Structures | Typedefs | Enumerations | Variables
network_type.h File Reference

Types used for networking. More...

`#include "../core/enum_type.hpp"`
`#include "../core/pool_type.hpp"`

Go to the source code of this file.

## Data Structures
struct | NetworkCompanyStats
| Simple calculated statistics of a company. More...
class | NetworkAuthorizedKeys
| Simple helper to (more easily) manage authorized keys. More...

## Typedefs
using | ClientPoolID = PoolID< uint16_t, struct ClientPoolIDTag, MAX_CLIENTS+1, 0xFFFF >
| Indices into the client related pools.
using | AdminID = PoolID< uint8_t, struct AdminIDTag, 16, 0xFF >
| Indices into the admin tables.

## Enumerations
enum | NetworkVehicleType : uint8_t { NETWORK_VEH_TRAIN = 0 , NETWORK_VEH_LORRY , NETWORK_VEH_BUS , NETWORK_VEH_PLANE , NETWORK_VEH_SHIP , NETWORK_VEH_END }
| Vehicletypes in the order they are send in info packets. More...
enum | ServerGameType : uint8_t { SERVER_GAME_TYPE_LOCAL = 0 , SERVER_GAME_TYPE_PUBLIC , SERVER_GAME_TYPE_INVITE_ONLY }
| Game type the server can be using. More...
enum | ClientID : uint32_t { INVALID_CLIENT_ID = 0 , CLIENT_ID_SERVER = 1 , CLIENT_ID_FIRST = 2 }
| 'Unique' identifier to be given to clients More...
enum | DestType : uint8_t { DESTTYPE_BROADCAST , DESTTYPE_TEAM , DESTTYPE_CLIENT }
| Destination of our chat messages. More...
enum | NetworkAction : uint8_t { NETWORK_ACTION_JOIN , NETWORK_ACTION_LEAVE , NETWORK_ACTION_SERVER_MESSAGE , NETWORK_ACTION_CHAT , NETWORK_ACTION_CHAT_COMPANY , NETWORK_ACTION_CHAT_CLIENT , NETWORK_ACTION_GIVE_MONEY , NETWORK_ACTION_NAME_CHANGE , NETWORK_ACTION_COMPANY_SPECTATOR , NETWORK_ACTION_COMPANY_JOIN , NETWORK_ACTION_COMPANY_NEW , NETWORK_ACTION_KICKED , NETWORK_ACTION_EXTERNAL_CHAT }
| Actions that can be used for NetworkTextMessage. More...
enum | NetworkErrorCode : uint8_t { NETWORK_ERROR_GENERAL , NETWORK_ERROR_DESYNC , NETWORK_ERROR_SAVEGAME_FAILED , NETWORK_ERROR_CONNECTION_LOST , NETWORK_ERROR_ILLEGAL_PACKET , NETWORK_ERROR_NEWGRF_MISMATCH , NETWORK_ERROR_NOT_AUTHORIZED , NETWORK_ERROR_NOT_EXPECTED , NETWORK_ERROR_WRONG_REVISION , NETWORK_ERROR_NAME_IN_USE , NETWORK_ERROR_WRONG_PASSWORD , NETWORK_ERROR_COMPANY_MISMATCH , NETWORK_ERROR_KICKED , NETWORK_ERROR_CHEATER , NETWORK_ERROR_FULL , NETWORK_ERROR_TOO_MANY_COMMANDS , NETWORK_ERROR_TIMEOUT_PASSWORD , NETWORK_ERROR_TIMEOUT_COMPUTER , NETWORK_ERROR_TIMEOUT_MAP , NETWORK_ERROR_TIMEOUT_JOIN , NETWORK_ERROR_INVALID_CLIENT_NAME , NETWORK_ERROR_NOT_ON_ALLOW_LIST , NETWORK_ERROR_NO_AUTHENTICATION_METHOD_AVAILABLE , NETWORK_ERROR_END }
| The error codes we send around in the protocols. More...

## Variables
static const uint | MAX_CLIENTS = 255
| How many clients can we have.

## Detailed Description

Types used for networking.

Definition in file network_type.h.

## Typedef Documentation

## ◆ AdminID

using AdminID = PoolID<uint8_t, struct AdminIDTag, 16, 0xFF>

Indices into the admin tables.

Definition at line 53 of file network_type.h.

## ◆ ClientPoolID

using ClientPoolID = PoolID<uint16_t, struct ClientPoolIDTag, MAX_CLIENTS + 1 , 0xFFFF>

Indices into the client related pools.

Definition at line 50 of file network_type.h.

## Enumeration Type Documentation

## ◆ ClientID

enum ClientID : uint32_t

'Unique' identifier to be given to clients

Enumerator
INVALID_CLIENT_ID | Client is not part of anything.
CLIENT_ID_SERVER | Servers always have this ID.
CLIENT_ID_FIRST | The first client ID.

Definition at line 43 of file network_type.h.

## ◆ DestType

enum DestType : uint8_t

Destination of our chat messages.

Warning
  The values of the enum items are part of the admin network API. Only append at the end.

Enumerator
DESTTYPE_BROADCAST | Send message/notice to all clients (All)
DESTTYPE_TEAM | Send message/notice to everyone playing the same company (Team)
DESTTYPE_CLIENT | Send message/notice to only a certain client (Private)

Definition at line 68 of file network_type.h.

## ◆ NetworkAction

enum NetworkAction : uint8_t

Actions that can be used for NetworkTextMessage.

Warning
  The values of the enum items are part of the admin network API. Only append at the end.

Definition at line 79 of file network_type.h.

## ◆ NetworkErrorCode

enum NetworkErrorCode : uint8_t

The error codes we send around in the protocols.

Warning
  The values of the enum items are part of the admin network API. Only append at the end.

Definition at line 99 of file network_type.h.

## ◆ NetworkVehicleType

enum NetworkVehicleType : uint8_t

Vehicletypes in the order they are send in info packets.

Definition at line 22 of file network_type.h.

## ◆ ServerGameType

enum ServerGameType : uint8_t

Game type the server can be using.

Used on the network protocol to communicate with Game Coordinator.

Definition at line 36 of file network_type.h.

## Variable Documentation

## ◆ MAX_CLIENTS

const uint MAX_CLIENTS = 255
| static

How many clients can we have.

Definition at line 17 of file network_type.h.

Referenced by ServerNetworkGameSocketHandler::AllowConnection(), NetworkMakeClientNameUnique(), NetworkStartServerWindow::OnClick(), NetworkStartServerWindow::OnQueryTextFinished(), NetworkGameWindow::UpdateWidgetSize(), and NetworkJoinStatusWindow::UpdateWidgetSize().