#pragma once #include "ehs/io/socket/ehc/NetEnc.h" #include "ehs/Array.h" #include "Socket.h" #include "UDP.h" namespace ehs { class NetServerCh; class NetClientCh; class NetEnd; class EHC; class EHC { private: friend class NetEnc; friend class NetChannel; friend class NetServerCh; friend class NetClientCh; friend class NetEnd; static const Version version; UDP udp; Byte* buffer; UInt_32 bufferSize; UInt_64 lastTSC; float delta; Array encryptions; Array servers; Array clients; public: ~EHC(); EHC(IP version = IP::V6); EHC(EHC &&sock) noexcept; EHC(const EHC &sock); EHC &operator=(EHC&& sock) noexcept; EHC &operator=(const EHC &sock); void Initialize(); void Release(); void Bind(const Endpoint &endpoint); void Poll(); bool IsInitialized() const; Endpoint GetLocalEndpoint() const; bool IsBound() const; static Version GetVersion(); bool AddEncryption(NetEnc *enc); bool AddServer(NetServerCh *server); bool AddClient(NetClientCh *channel); private: bool HasEncryption(UInt_64 encId) const; bool HasEncryption(const Str_8& encName) const; NetEnc* GetEncryption(UInt_64 encId) const; NetEnc* GetEncryption(const Str_8& encName) const; bool HasServer(UInt_64 serverId) const; bool HasServer(const Str_8& serverName) const; NetServerCh *GetServer(UInt_64 serverId) const; NetServerCh *GetServer(const Str_8& serverName) const; bool HasClient(UInt_64 clientId) const; bool HasClient(const Str_8& clientName) const; NetClientCh *GetClient(UInt_64 clientId) const; NetClientCh *GetClient(const Str_8& clientName) const; }; }