OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
12 #include "../../stdafx.h"
13 #include "../../date_func.h"
14 #include "../../debug.h"
17 #include "../../safeguards.h"
49 Debug(net, 0,
"[tcp/coordinator] Received invalid packet type {}", type);
68 static const int MAX_PACKETS_TO_RECEIVE = 42;
69 int i = MAX_PACKETS_TO_RECEIVE;
73 if (!cont)
return true;
76 return i != MAX_PACKETS_TO_RECEIVE - 1;
86 Debug(net, 0,
"[tcp/coordinator] Received illegal packet type {}", type);
virtual bool Receive_GC_REGISTER_ACK(Packet *p)
Game Coordinator acknowledges the registration.
virtual bool Receive_GC_LISTING(Packet *p)
Game Coordinator replies with a list of all public servers.
virtual bool Receive_GC_NEWGRF_LOOKUP(Packet *p)
Game Coordinator informs the client of updates for the NewGRFs lookup table as used by the NewGRF des...
virtual bool Receive_SERVER_REGISTER(Packet *p)
Server is starting a multiplayer game and wants to let the Game Coordinator know.
virtual bool Receive_GC_STUN_CONNECT(Packet *p)
Game Coordinator informs the client/server of its STUN peer (the host:ip of the other side).
@ PACKET_COORDINATOR_CLIENT_CONNECTED
Client informs the Game Coordinator the connection with the server is established.
virtual bool Receive_CLIENT_CONNECTED(Packet *p)
Client informs the Game Coordinator the connection with the Server is established.
virtual bool Receive_SERCLI_STUN_RESULT(Packet *p)
Client/server informs the Game Coordinator the result of a STUN request.
@ PACKET_COORDINATOR_GC_CONNECT_FAILED
Game Coordinator informs client/server it has given up on the connection attempt.
virtual bool Receive_SERCLI_CONNECT_FAILED(Packet *p)
Client or Server failed to connect to the remote side.
@ PACKET_COORDINATOR_CLIENT_LISTING
Client is requesting a listing of all public servers.
virtual Packet * ReceivePacket()
Receives a packet for the given client.
virtual bool Receive_CLIENT_LISTING(Packet *p)
Client requests a list of all public servers.
virtual bool Receive_GC_TURN_CONNECT(Packet *p)
Game Coordinator requests that we make a connection to the indicated peer, which is a TURN server.
bool HandlePacket(Packet *p)
Handle the given packet, i.e.
virtual bool Receive_SERVER_UPDATE(Packet *p)
Send an update of the current state of the server to the Game Coordinator.
@ PACKET_COORDINATOR_SERCLI_STUN_RESULT
Client/server informs the Game Coordinator of the result of the STUN request.
virtual bool Receive_GC_DIRECT_CONNECT(Packet *p)
Game Coordinator requests that the Client makes a direct connection to the indicated peer,...
@ PACKET_COORDINATOR_GC_STUN_CONNECT
Game Coordinator tells client/server to connect() reusing the STUN local address.
@ PACKET_COORDINATOR_CLIENT_CONNECT
Client wants to connect to a server based on an invite code.
virtual bool Receive_CLIENT_CONNECT(Packet *p)
Client wants to connect to a Server.
@ PACKET_COORDINATOR_SERVER_REGISTER
Server registration.
Internal entity of a packet.
@ PACKET_COORDINATOR_GC_REGISTER_ACK
Game Coordinator accepts the registration.
@ PACKET_COORDINATOR_GC_NEWGRF_LOOKUP
Game Coordinator informs client about NewGRF lookup table updates needed for GC_LISTING.
@ PACKET_COORDINATOR_GC_CONNECTING
Game Coordinator informs the client of the token assigned to the connection attempt.
@ PACKET_COORDINATOR_GC_ERROR
Game Coordinator indicates there was an error.
virtual bool Receive_GC_STUN_REQUEST(Packet *p)
Game Coordinator requests the client/server to do a STUN request to the STUN server.
bool ReceiveInvalidPacket(PacketCoordinatorType type)
Helper for logging receiving invalid packets.
virtual bool Receive_GC_ERROR(Packet *p)
Game Coordinator indicates there was an error.
@ PACKET_COORDINATOR_GC_LISTING
Game Coordinator returns a listing of all public servers.
uint8 Recv_uint8()
Read a 8 bits integer from the packet.
virtual bool Receive_GC_CONNECT_FAILED(Packet *p)
Game Coordinator informs the Client that it failed to find a way to connect the Client to the Server.
#define Debug(name, level, format_string,...)
Ouptut a line of debugging information.
@ PACKET_COORDINATOR_GC_STUN_REQUEST
Game Coordinator tells client/server to initiate a STUN request.
virtual bool Receive_GC_CONNECTING(Packet *p)
Game Coordinator informs the Client under what token it will start the attempt to connect the Server ...
bool ReceivePackets()
Receive a packet at TCP level.
@ PACKET_COORDINATOR_GC_DIRECT_CONNECT
Game Coordinator tells client to directly connect to the hostname:port of the server.
@ PACKET_COORDINATOR_SERCLI_CONNECT_FAILED
Client/server tells the Game Coordinator the current connection attempt failed.
@ PACKET_COORDINATOR_SERVER_UPDATE
Server sends an set intervals an update of the server.
@ PACKET_COORDINATOR_GC_TURN_CONNECT
Game Coordinator tells client/server to connect to a specific TURN server.
PacketCoordinatorType
Enum with all types of TCP Game Coordinator packets.