Added the capability for custom encryption's to be added to EHC.

This commit is contained in:
2024-10-06 22:54:29 -07:00
parent 1feff0a25c
commit 8b01ee3c46
15 changed files with 392 additions and 182 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#include "ehs/io/socket/ehc/Utils.h"
#include "ehs/io/socket/ehc/NetUtils.h"
#include "ehs/io/socket/ehc/NetEnc.h"
#include "ehs/Serializer.h"
#include "ehs/Vector.h"
#include "ehs/Array.h"
@@ -10,7 +10,7 @@
namespace ehs
{
class NetSystem;
class NetSys;
class NetEnd;
class EHC;
@@ -24,6 +24,7 @@ namespace ehs
class EHC
{
private:
friend class NetEnc;
friend class NetEnd;
static const Version version;
@@ -47,7 +48,8 @@ namespace ehs
bool dropPackets;
Byte* buffer;
UInt_32 bufferSize;
Array<NetSystem *> systems;
Array<NetEnc *> encryptions;
Array<NetSys *> systems;
UInt_32 maxEndpoints;
UInt_64 lastTSC;
float delta;
@@ -90,13 +92,13 @@ namespace ehs
bool Disconnect(EndDisp endDisp, const Char_8 token[64], const Str_8& msg);
void Broadcast(EndDisp endDisp, Status endStatus, bool deltaLocked, bool encrypted,
void Broadcast(EndDisp endDisp, Status endStatus, bool deltaLocked, UInt_64 encHashId,
bool ensure, UInt_64 sysHashId, UInt_64 opHashId,
const Serializer<>& payload);
const Serializer<UInt_64> &payload);
void Broadcast(EndDisp endDisp, Status endStatus, bool deltaLocked, bool encrypted,
bool ensure, const Str_8& sysId, const Str_8& opId,
const Serializer<>& payload);
void Broadcast(EndDisp endDisp, Status endStatus, bool deltaLocked, const Str_8 &encId,
bool ensure, const Str_8 &sysId, const Str_8 &opId,
const Serializer<UInt_64> &payload);
void Poll();
@@ -124,15 +126,25 @@ namespace ehs
bool IsDropPacketsEnabled() const;
bool HasEncryption(UInt_64 encHashId) const;
bool HasEncryption(const Str_8& encId) const;
bool AddEncryption(NetEnc *enc);
NetEnc* GetEncryption(UInt_64 encHashId) const;
NetEnc* GetEncryption(const Str_8& encId) const;
bool HasSystem(UInt_64 sysHashId) const;
bool HasSystem(const Str_8& sysId) const;
bool AddSystem(NetSystem *sys);
bool AddSystem(NetSys *sys);
NetSystem* GetSystem(UInt_64 sysHashId) const;
NetSys* GetSystem(UInt_64 sysHashId) const;
NetSystem* GetSystem(const Str_8& sysId) const;
NetSys* GetSystem(const Str_8& sysId) const;
bool HasEndpoint(EndDisp endDisp, Status endStatus, const Char_8 token[64]) const;