diff options
author | Patric Stout <truebrain@openttd.org> | 2021-05-05 10:47:01 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-07-20 19:57:23 +0200 |
commit | fa1e27994dd1284f6fefbe08c47a5c4145ccf00d (patch) | |
tree | bbe8fab946192e5667ef176673590d2fae60e969 /src/network/core/tcp_coordinator.h | |
parent | 8a361340037d6908c9a4df10aefdb58860a22b80 (diff) | |
download | openttd-fa1e27994dd1284f6fefbe08c47a5c4145ccf00d.tar.xz |
Feature: allow the use of TURN to connect client and server together
TURN is a last resort, used only if all other methods failed.
TURN is a relay approach to connect client and server together, where
openttd.org (by default) is the middleman.
It is very unlikely either the client or server cannot connect to
the STUN server, as they are both already connected to the Game
Coordinator. But in the odd case it does fail, estabilishing the
connection fails without any further possibility to recover.
Diffstat (limited to 'src/network/core/tcp_coordinator.h')
-rw-r--r-- | src/network/core/tcp_coordinator.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/network/core/tcp_coordinator.h b/src/network/core/tcp_coordinator.h index b5395ad73..dea61cdec 100644 --- a/src/network/core/tcp_coordinator.h +++ b/src/network/core/tcp_coordinator.h @@ -42,6 +42,7 @@ enum PacketCoordinatorType { PACKET_COORDINATOR_SERCLI_STUN_RESULT, ///< Client/server informs the Game Coordinator of the result of the STUN request. PACKET_COORDINATOR_GC_STUN_CONNECT, ///< Game Coordinator tells client/server to connect() reusing the STUN local address. PACKET_COORDINATOR_GC_NEWGRF_LOOKUP, ///< Game Coordinator informs client about NewGRF lookup table updates needed for GC_LISTING. + PACKET_COORDINATOR_GC_TURN_CONNECT, ///< Game Coordinator tells client/server to connect to a specific TURN server. PACKET_COORDINATOR_END, ///< Must ALWAYS be on the end of this list!! (period) }; @@ -53,6 +54,7 @@ enum ConnectionType { 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. }; /** @@ -288,6 +290,20 @@ protected: */ virtual bool Receive_GC_NEWGRF_LOOKUP(Packet *p); + /** + * Game Coordinator requests that we make a connection to the indicated + * peer, which is a TURN server. + * + * string Token to track the current connect request. + * uint8 Tracking number to track current connect request. + * string Ticket to hand over to the TURN server. + * string Connection string of the TURN server. + * + * @param p The packet that was just received. + * @return True upon success, otherwise false. + */ + virtual bool Receive_GC_TURN_CONNECT(Packet *p); + bool HandlePacket(Packet *p); public: /** |