X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fnet%2FConnectionHandler.hpp;h=ff5e0e42204c8ab9998b83ac9630aae71e19d210;hb=b4e5dad2ed5c7e77573de413f3bf5be88577856d;hp=6e18da2727821b754904a3ebcc39534714f3b881;hpb=ae5a7e7d8517fac406a88e9bf98fd3d5bb1728b9;p=blank.git diff --git a/src/net/ConnectionHandler.hpp b/src/net/ConnectionHandler.hpp index 6e18da2..ff5e0e4 100644 --- a/src/net/ConnectionHandler.hpp +++ b/src/net/ConnectionHandler.hpp @@ -1,6 +1,7 @@ #ifndef BLANK_NET_CONNECTIONHANDLER_HPP_ #define BLANK_NET_CONNECTIONHANDLER_HPP_ +#include "CongestionControl.hpp" #include "Packet.hpp" #include @@ -11,16 +12,27 @@ namespace blank { class ConnectionHandler { public: + ConnectionHandler(); + + const CongestionControl &NetStat() const noexcept { return cc; } + + void PacketSent(std::uint16_t) noexcept; + void PacketLost(std::uint16_t); + void PacketReceived(std::uint16_t); + + void PacketIn(const UDPpacket &) noexcept; + void PacketOut(const UDPpacket &) noexcept; + void Handle(const UDPpacket &); + virtual void OnTimeout() { } + +private: // called as soon as the remote end ack'd given packet virtual void OnPacketReceived(std::uint16_t) { } // called if the remote end probably didn't get given packet virtual void OnPacketLost(std::uint16_t) { } - virtual void OnTimeout() { } - -private: virtual void On(const Packet::Ping &) { } virtual void On(const Packet::Login &) { } virtual void On(const Packet::Join &) { } @@ -32,6 +44,11 @@ private: virtual void On(const Packet::PlayerCorrection &) { } virtual void On(const Packet::ChunkBegin &) { } virtual void On(const Packet::ChunkData &) { } + virtual void On(const Packet::BlockUpdate &) { } + virtual void On(const Packet::Message &) { } + +private: + CongestionControl cc; };