OpenTTD Source: src/network/core/tcp_stun.h Source File

OpenTTD Source 14.0-beta3

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 <http://www.gnu.org/licenses/>.
6 */
7
12 #ifndef NETWORK_CORE_TCP_STUN_H
13 #define NETWORK_CORE_TCP_STUN_H
14
15 #include "os_abstraction.h"
16 #include "tcp.h"
17 #include "packet.h"
18
20 enum PacketStunType : uint8_t {
21 PACKET_STUN_SERCLI_STUN,
22 PACKET_STUN_END,
23 };
24
26 class NetworkStunSocketHandler : public NetworkTCPSocketHandler {
27 protected:
28 bool ReceiveInvalidPacket(PacketStunType type);
29
42 virtual bool Receive_SERCLI_STUN(Packet &p);
43
44 public:
50 NetworkStunSocketHandler(SOCKET s = INVALID_SOCKET) : NetworkTCPSocketHandler(s) {}
51 };
52
53 #endif /* NETWORK_CORE_TCP_STUN_H */
PacketStunType
PacketStunType
Enum with all types of TCP STUN packets.
Definition: tcp_stun.h:20
NetworkStunSocketHandler::Receive_SERCLI_STUN
virtual bool Receive_SERCLI_STUN(Packet &p)
Send a STUN request to the STUN server letting the Game Coordinator know what our actually public IP:...
Definition: tcp_stun.cpp:29
NetworkStunSocketHandler::ReceiveInvalidPacket
bool ReceiveInvalidPacket(PacketStunType type)
Helper for logging receiving invalid packets.
Definition: tcp_stun.cpp:23
Packet
Internal entity of a packet.
Definition: packet.h:42
PACKET_STUN_END
@ PACKET_STUN_END
Must ALWAYS be on the end of this list!! (period)
Definition: tcp_stun.h:22
packet.h
tcp.h
os_abstraction.h
NetworkStunSocketHandler::NetworkStunSocketHandler
NetworkStunSocketHandler(SOCKET s=INVALID_SOCKET)
Create a new cs socket handler for a given cs.
Definition: tcp_stun.h:50
NetworkStunSocketHandler
Base socket handler for all STUN TCP sockets.
Definition: tcp_stun.h:26
PACKET_STUN_SERCLI_STUN
@ PACKET_STUN_SERCLI_STUN
Send a STUN request to the STUN server.
Definition: tcp_stun.h:21
NetworkTCPSocketHandler
Base socket handler for all TCP sockets.
Definition: tcp.h:31