1 #ifndef BLANK_NET_CONNECTIONHANDLER_HPP_
2 #define BLANK_NET_CONNECTIONHANDLER_HPP_
4 #include "CongestionControl.hpp"
12 class ConnectionHandler {
17 const CongestionControl &NetStat() const noexcept { return cc; }
19 void PacketSent(std::uint16_t) noexcept;
20 void PacketLost(std::uint16_t);
21 void PacketReceived(std::uint16_t);
23 void PacketIn(const UDPpacket &) noexcept;
24 void PacketOut(const UDPpacket &) noexcept;
26 void Handle(const UDPpacket &);
28 virtual void OnTimeout() { }
31 // called as soon as the remote end ack'd given packet
32 virtual void OnPacketReceived(std::uint16_t) { }
33 // called if the remote end probably didn't get given packet
34 virtual void OnPacketLost(std::uint16_t) { }
36 virtual void On(const Packet::Ping &) { }
37 virtual void On(const Packet::Login &) { }
38 virtual void On(const Packet::Join &) { }
39 virtual void On(const Packet::Part &) { }
40 virtual void On(const Packet::PlayerUpdate &) { }
41 virtual void On(const Packet::SpawnEntity &) { }
42 virtual void On(const Packet::DespawnEntity &) { }
43 virtual void On(const Packet::EntityUpdate &) { }
44 virtual void On(const Packet::PlayerCorrection &) { }
45 virtual void On(const Packet::ChunkBegin &) { }
46 virtual void On(const Packet::ChunkData &) { }
47 virtual void On(const Packet::BlockUpdate &) { }
48 virtual void On(const Packet::Message &) { }