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

OpenTTD Source 14.0-beta1

Data Structures | Typedefs | Enumerations | Variables
network_type.h File Reference
`#include "../core/enum_type.hpp"`

Go to the source code of this file.

## Data Structures
struct | NetworkCompanyStats
| Simple calculated statistics of a company. More...
struct | NetworkCompanyState
| Some state information of a company, especially for servers. More...

## Typedefs
typedef uint8_t | ClientIndex
| Indices into the client tables.
typedef uint8_t | AdminIndex
| Indices into the admin tables.

## Enumerations
enum | NetworkVehicleType { 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.
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 | NetworkPasswordType { NETWORK_GAME_PASSWORD, NETWORK_COMPANY_PASSWORD }
| The type of password we're asking for. More...
enum | DestType : byte { DESTTYPE_BROADCAST, DESTTYPE_TEAM, DESTTYPE_CLIENT }
| Destination of our chat messages. More...
enum | NetworkAction { 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 { 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_END }
| The error codes we send around in the protocols. More...

## Variables
static const uint | MAX_CLIENTS = 255
| How many clients can we have.
static const uint | MAX_CLIENT_SLOTS = 256
| The number of slots; must be at least 1 more than MAX_CLIENTS. More...
static const AdminIndex | MAX_ADMINS = 16
| Maximum number of allowed admins.
static const AdminIndex | INVALID_ADMIN_ID = UINT8_MAX
| An invalid admin marker.

## Detailed Description

Types used for networking.

Definition in 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 49 of file network_type.h.

## ◆ DestType

enum DestType : byte

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 91 of file network_type.h.

## ◆ NetworkAction

enum NetworkAction

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 102 of file network_type.h.

## ◆ NetworkErrorCode

enum NetworkErrorCode

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 122 of file network_type.h.

## ◆ NetworkPasswordType

enum NetworkPasswordType

The type of password we're asking for.

Enumerator
NETWORK_GAME_PASSWORD | The password of the game.
NETWORK_COMPANY_PASSWORD | The password of the company.

Definition at line 82 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 42 of file network_type.h.

## Variable Documentation

## ◆ MAX_CLIENT_SLOTS

const uint MAX_CLIENT_SLOTS = 256
| static

The number of slots; must be at least 1 more than MAX_CLIENTS.

It must furthermore be less than or equal to 256 as client indices (sent over the network) are 8 bits. It needs 1 more for the dedicated server.

Definition at line 23 of file network_type.h.

Referenced by NetworkChatWindow::ChatTabCompletionNextItem().