OpenTTD Source 20260311-master-g511d3794ce
tcp_stun.h
Go to the documentation of this file.
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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#ifndef NETWORK_CORE_TCP_STUN_H
11#define NETWORK_CORE_TCP_STUN_H
12
13#include "os_abstraction.h"
14#include "tcp.h"
15#include "packet.h"
16
21enum class PacketStunType : uint8_t {
23};
24
25template <> struct IsEnumPacketType<PacketStunType> {
26 static constexpr bool value = true;
27};
28
31protected:
33
46 virtual bool ReceiveClientStun(Packet &p);
47
48public:
53 NetworkStunSocketHandler(SOCKET s = INVALID_SOCKET) : NetworkTCPSocketHandler(s) {}
54};
55
56#endif /* NETWORK_CORE_TCP_STUN_H */
virtual bool ReceiveClientStun(Packet &p)
Send a STUN request to the STUN server letting the Game Coordinator know what our actually public IP:...
Definition tcp_stun.cpp:27
NetworkStunSocketHandler(SOCKET s=INVALID_SOCKET)
Create a new cs socket handler for a given cs.
Definition tcp_stun.h:53
bool ReceiveInvalidPacket(PacketStunType type)
Helper for logging receiving invalid packets.
Definition tcp_stun.cpp:21
NetworkTCPSocketHandler(SOCKET s=INVALID_SOCKET)
Construct a socket handler for a TCP connection.
Definition tcp.h:64
Includes and/or implementations for the network stuff.
Basic functions to create, fill and read packets.
static constexpr bool value
This is an enumeration of a PacketType.
Definition tcp_stun.h:26
Trait to mark an enumeration as a PacketType.
Definition packet.h:24
Basic functions to receive and send TCP packets.
PacketStunType
Enum with all types of TCP STUN packets.
Definition tcp_stun.h:21
@ ClientStun
Send a STUN request to the STUN server.
Definition tcp_stun.h:22