OpenTTD: src/network/network_type.h File Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

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

Types used for networking. More...

`#include "core/game.h"`

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 | ClientIndex
| Indices into the client tables.
typedef uint8 | 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 | ClientID { 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 { 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 }
| Actions that can be used for NetworkTextMessage.
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_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.
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.

## Typedef Documentation

typedef uint8 AdminIndex

Indices into the admin tables.

Definition at line 53 of file network_type.h.

## Enumeration Type Documentation

enum ClientID

'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.

enum DestType

Destination of our chat messages.

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

enum NetworkErrorCode

The error codes we send around in the protocols.

Definition at line 104 of file network_type.h.

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

## Variable Documentation

const AdminIndex INVALID_ADMIN_ID = UINT8_MAX
| static

An invalid admin marker.

Definition at line 58 of file network_type.h.

Referenced by IConsolePrint(), ServerNetworkAdminSocketHandler::Receive_ADMIN_RCON(), and ServerNetworkAdminSocketHandler::~ServerNetworkAdminSocketHandler().

const AdminIndex MAX_ADMINS = 16
| static

Maximum number of allowed admins.

Definition at line 56 of file network_type.h.

Referenced by ServerNetworkAdminSocketHandler::AllowConnection().

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

Referenced by NetworkChatWindow::ChatTabCompletionNextItem().