Fix #10490: Allow ships to exit depots if another is not moving at the exit point...
[openttd-github.git] / src / network / network_turn.h
blob961a9617884e1bc22abef0d154f86dd074f64cea
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file network_turn.h Part of the network protocol handling TURN requests. */
10 #ifndef NETWORK_TURN_H
11 #define NETWORK_TURN_H
13 #include "core/tcp_turn.h"
15 /** Class for handling the client side of the TURN connection. */
16 class ClientNetworkTurnSocketHandler : public NetworkTurnSocketHandler {
17 private:
18 std::string token; ///< Token of this connection.
19 uint8_t tracking_number; ///< Tracking number of this connection.
20 std::string connection_string; ///< The connection string of the TURN server we are connecting to.
22 protected:
23 bool Receive_TURN_ERROR(Packet &p) override;
24 bool Receive_TURN_CONNECTED(Packet &p) override;
26 public:
27 std::shared_ptr<TCPConnecter> connecter{}; ///< Connecter instance.
28 bool connect_started = false; ///< Whether we started the connection.
30 ClientNetworkTurnSocketHandler(const std::string &token, uint8_t tracking_number, const std::string &connection_string) : token(token), tracking_number(tracking_number), connection_string(connection_string) {}
32 NetworkRecvStatus CloseConnection(bool error = true) override;
33 ~ClientNetworkTurnSocketHandler() override;
34 void SendReceive();
36 void Connect();
37 void ConnectFailure();
39 static std::unique_ptr<ClientNetworkTurnSocketHandler> Turn(const std::string &token, uint8_t tracking_number, const std::string &ticket, const std::string &connection_string);
42 #endif /* NETWORK_TURN_H */