OpenTTD Source 20260421-master-gc2fbc6fdeb
tcp_coordinator.h File Reference

Basic functions to receive and send TCP packets to/from the Game Coordinator server. More...

#include "os_abstraction.h"
#include "tcp.h"
#include "packet.h"
#include "network_game_info.h"

Go to the source code of this file.

Data Structures

struct  IsEnumPacketType< PacketCoordinatorType >
 Mark PacketCoordinatorType as PacketType. More...
class  NetworkCoordinatorSocketHandler
 Base socket handler for all Game Coordinator TCP sockets. More...

Enumerations

enum class  PacketCoordinatorType : uint8_t {
  GameCoordinatorError , ServerRegister , GameCoordinatorRegisterAck , ServerUpdate ,
  ClientListing , GameCoordinatorListing , ClientConnect , GameCoordinatorConnecting ,
  ServerOrClientConnectFailed , GameCoordinatorConnectFailed , ClientConnected , GameCoordinatorDirectConnect ,
  GameCoordinatorStunRequest , ServerOrClientStunResult , GameCoordinatorStunConnect , GameCoordinatorNewGRFLookup ,
  GameCoordinatorTurnConnect
}
 Enum with all types of TCP Game Coordinator packets. More...
enum  ConnectionType : uint8_t {
  CONNECTION_TYPE_UNKNOWN , CONNECTION_TYPE_ISOLATED , CONNECTION_TYPE_DIRECT , CONNECTION_TYPE_STUN ,
  CONNECTION_TYPE_TURN
}
 The type of connection the Game Coordinator can detect we have. More...
enum  NetworkCoordinatorErrorType : uint8_t { NETWORK_COORDINATOR_ERROR_UNKNOWN , NETWORK_COORDINATOR_ERROR_REGISTRATION_FAILED , NETWORK_COORDINATOR_ERROR_INVALID_INVITE_CODE , NETWORK_COORDINATOR_ERROR_REUSE_OF_INVITE_CODE }
 The type of error from the Game Coordinator. More...

Detailed Description

Basic functions to receive and send TCP packets to/from the Game Coordinator server.

Definition in file tcp_coordinator.h.

Enumeration Type Documentation

◆ ConnectionType

enum ConnectionType : uint8_t

The type of connection the Game Coordinator can detect we have.

Enumerator
CONNECTION_TYPE_UNKNOWN 

The Game Coordinator hasn't informed us yet what type of connection we have.

CONNECTION_TYPE_ISOLATED 

The Game Coordinator failed to find a way to connect to your server. Nobody will be able to join.

CONNECTION_TYPE_DIRECT 

The Game Coordinator can directly connect to your server.

CONNECTION_TYPE_STUN 

The Game Coordinator can connect to your server via a STUN request.

CONNECTION_TYPE_TURN 

The Game Coordinator needs you to connect to a relay.

Definition at line 55 of file tcp_coordinator.h.

◆ NetworkCoordinatorErrorType

The type of error from the Game Coordinator.

Enumerator
NETWORK_COORDINATOR_ERROR_UNKNOWN 

There was an unknown error.

NETWORK_COORDINATOR_ERROR_REGISTRATION_FAILED 

Your request for registration failed.

NETWORK_COORDINATOR_ERROR_INVALID_INVITE_CODE 

The invite code given is invalid.

NETWORK_COORDINATOR_ERROR_REUSE_OF_INVITE_CODE 

The invite code is used by another (newer) server.

Definition at line 66 of file tcp_coordinator.h.

◆ PacketCoordinatorType

enum class PacketCoordinatorType : uint8_t
strong

Enum with all types of TCP Game Coordinator packets.

GameCoordinator -> packets from Game Coordinator to either Client or Server. Server -> packets from Server to Game Coordinator. Client -> packets from Client to Game Coordinator. ServerOrClient -> packets from either the Server or Client to Game Coordinator.

Attention
The order MUST not be changed.
Enumerator
GameCoordinatorError 

Game Coordinator indicates there was an error.

ServerRegister 

Server registration.

GameCoordinatorRegisterAck 

Game Coordinator accepts the registration.

ServerUpdate 

Server sends an set intervals an update of the server.

ClientListing 

Client is requesting a listing of all public servers.

GameCoordinatorListing 

Game Coordinator returns a listing of all public servers.

ClientConnect 

Client wants to connect to a server based on an invite code.

GameCoordinatorConnecting 

Game Coordinator informs the client of the token assigned to the connection attempt.

ServerOrClientConnectFailed 

Client/server tells the Game Coordinator the current connection attempt failed.

GameCoordinatorConnectFailed 

Game Coordinator informs client/server it has given up on the connection attempt.

ClientConnected 

Client informs the Game Coordinator the connection with the server is established.

GameCoordinatorDirectConnect 

Game Coordinator tells client to directly connect to the hostname:port of the server.

GameCoordinatorStunRequest 

Game Coordinator tells client/server to initiate a STUN request.

ServerOrClientStunResult 

Client/server informs the Game Coordinator of the result of the STUN request.

GameCoordinatorStunConnect 

Game Coordinator tells client/server to connect() reusing the STUN local address.

GameCoordinatorNewGRFLookup 

Game Coordinator informs client about NewGRF lookup table updates needed for GC_LISTING.

GameCoordinatorTurnConnect 

Game Coordinator tells client/server to connect to a specific TURN server.

Definition at line 28 of file tcp_coordinator.h.