EHS
Loading...
Searching...
No Matches
EHC.h
Go to the documentation of this file.
1#pragma once
2
4#include "ehs/Array.h"
5#include "Socket.h"
6#include "UDP.h"
7
8namespace ehs
9{
10 class NetServerCh;
11 class NetClientCh;
12 class NetEnd;
13 class EHC;
14
15 class EHC
16 {
17 private:
18 friend class NetEnc;
19 friend class NetChannel;
20 friend class NetServerCh;
21 friend class NetClientCh;
22 friend class NetEnd;
23
24 static const Version version;
25
26 UDP udp;
27 Byte* buffer;
28 UInt_32 bufferSize;
29 UInt_64 lastTSC;
30 float delta;
31 Array<NetEnc *> encryptions;
34
35 public:
36 ~EHC();
37
38 EHC(IP version = IP::V6);
39
40 EHC(EHC &&sock) noexcept;
41
42 EHC(const EHC &sock);
43
44 EHC &operator=(EHC&& sock) noexcept;
45
46 EHC &operator=(const EHC &sock);
47
48 void Initialize();
49
50 void Release();
51
52 void Bind(const Endpoint &endpoint);
53
54 void Poll();
55
56 bool IsInitialized() const;
57
59
60 bool IsBound() const;
61
62 static Version GetVersion();
63
64 bool AddEncryption(NetEnc *enc);
65
66 bool HasServer(UInt_64 serverId) const;
67
68 bool HasServer(const Str_8& serverName) const;
69
70 bool AddServer(NetServerCh *server);
71
72 NetServerCh *GetServer(UInt_64 serverId) const;
73
74 NetServerCh *GetServer(const Str_8& serverName) const;
75
76 bool HasClient(UInt_64 clientId) const;
77
78 bool HasClient(const Str_8& clientName) const;
79
80 bool AddClient(NetClientCh *channel);
81
82 NetClientCh *GetClient(UInt_64 clientId) const;
83
84 NetClientCh *GetClient(const Str_8& clientName) const;
85
86 private:
87 bool HasEncryption(UInt_64 encId) const;
88
89 bool HasEncryption(const Str_8& encName) const;
90
91 NetEnc* GetEncryption(UInt_64 encId) const;
92
93 NetEnc* GetEncryption(const Str_8& encName) const;
94 };
95}
Definition Array.h:16
Definition EHC.h:16
friend class NetServerCh
Definition EHC.h:20
bool HasClient(UInt_64 clientId) const
Definition EHC.cpp:313
bool AddEncryption(NetEnc *enc)
Definition EHC.cpp:263
NetServerCh * GetServer(UInt_64 serverId) const
Definition EHC.cpp:299
~EHC()
Definition EHC.cpp:14
void Poll()
Definition EHC.cpp:179
friend class NetChannel
Definition EHC.h:19
void Bind(const Endpoint &endpoint)
Definition EHC.cpp:174
Endpoint GetLocalEndpoint() const
Definition EHC.cpp:248
friend class NetEnd
Definition EHC.h:22
bool IsBound() const
Definition EHC.cpp:253
bool HasServer(UInt_64 serverId) const
Definition EHC.cpp:273
bool AddServer(NetServerCh *server)
Definition EHC.cpp:287
EHC & operator=(EHC &&sock) noexcept
Definition EHC.cpp:54
void Initialize()
Definition EHC.cpp:131
static Version GetVersion()
Definition EHC.cpp:258
friend class NetEnc
Definition EHC.h:18
EHC(IP version=IP::V6)
Definition EHC.cpp:19
friend class NetClientCh
Definition EHC.h:21
bool IsInitialized() const
Definition EHC.cpp:243
void Release()
Definition EHC.cpp:150
bool AddClient(NetClientCh *channel)
Definition EHC.cpp:327
NetClientCh * GetClient(UInt_64 clientId) const
Definition EHC.cpp:339
Definition NetClientCh.h:11
Definition NetEnd.h:16
Definition NetServerCh.h:10
A wrapper class for the user datagram protocol socket.
Definition UDP_BSD.h:11
A helper class for storing version major, minor and patch.
Definition Version.h:9
Definition Anchor.h:6
unsigned int UInt_32
Definition Types.h:49
IP
Definition Socket.h:29
@ V6
Definition Socket.h:31
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1953
unsigned char Byte
Definition Types.h:39
Definition Socket.h:48