12#include "../../stdafx.h"
13#include "../../timer/timer_game_calendar.h"
14#include "../../debug.h"
17#include "../../safeguards.h"
35 Debug(net, 0,
"[tcp/turn] Received invalid packet type {}", type);
46 std::unique_ptr<Packet> p;
47 static const int MAX_PACKETS_TO_RECEIVE = 4;
48 int i = MAX_PACKETS_TO_RECEIVE;
51 if (!cont)
return true;
54 return i != MAX_PACKETS_TO_RECEIVE - 1;
64 Debug(net, 0,
"[tcp/turn] Received illegal packet type {}", type);
virtual std::unique_ptr< Packet > ReceivePacket()
Receives a packet for the given client.
virtual bool Receive_SERCLI_CONNECT(Packet &p)
Client or servers wants to connect to the TURN server (on request by the Game Coordinator).
bool ReceivePackets()
Receive a packet at TCP level.
virtual bool Receive_TURN_CONNECTED(Packet &p)
TURN server has connected client and server together and will now relay all packets to each other.
virtual bool Receive_TURN_ERROR(Packet &p)
TURN server was unable to connect the client or server based on the token.
bool ReceiveInvalidPacket(PacketTurnType type)
Helper for logging receiving invalid packets.
bool HandlePacket(Packet &p)
Handle the given packet, i.e.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
Internal entity of a packet.
uint8_t Recv_uint8()
Read a 8 bits integer from the packet.
Basic functions to receive and send TCP packets to/from the TURN server.
PacketTurnType
Enum with all types of TCP TURN packets.
@ PACKET_TURN_TURN_CONNECTED
TURN server indicates the socket is now being relayed.
@ PACKET_TURN_SERCLI_CONNECT
Client or server is connecting to the TURN server.
@ PACKET_TURN_TURN_ERROR
TURN server is unable to relay.