Finished implementing, now for the testing phase.

This commit is contained in:
2025-01-26 21:43:17 -08:00
parent 7bc4b9977d
commit 981b40d3b1
47 changed files with 2070 additions and 1597 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#include "NetUtils.h"
#include "NetFrags.h"
#include "NetFrag.h"
#include "ehs/Str.h"
#include "ehs/Vector.h"
@@ -10,27 +10,23 @@
namespace ehs
{
class EHC;
class NetServerCh;
class NetEnd
{
private:
friend class EHC;
friend class NetServerCh;
EHC* owner;
EndDisp disposition;
UInt_64 hashName;
NetServerCh* owner;
UInt_64 id;
Str_8 name;
Status status;
Architecture arch;
NetStatus status;
Char_8 token[64];
UInt_64 nextSendId;
Vector<Insurance> sent;
UInt_64 nextRecvId;
Vector<NetFrags> received;
AddrType type;
Str_8 address;
UInt_16 port;
Vector<NetFrag> received;
Endpoint endpoint;
float deltaDuration;
float deltaRate;
float timeout;
@@ -42,9 +38,9 @@ namespace ehs
public:
NetEnd();
NetEnd(EndDisp disposition, Str_8 id, Architecture arch, AddrType type, Str_8 address, UInt_16 port);
NetEnd(Str_8 id, Endpoint endpoint);
NetEnd(AddrType type, Str_8 address, UInt_16 port);
NetEnd(Endpoint endpoint);
NetEnd(NetEnd &&end) noexcept;
@@ -54,15 +50,11 @@ namespace ehs
NetEnd &operator=(const NetEnd &end);
EndDisp GetDisposition() const;
UInt_64 GetHashName() const;
UInt_64 GetId() const;
Str_8 GetName() const;
Status GetStatus() const;
Architecture GetArchitecture() const;
NetStatus GetStatus() const;
UInt_64 GetNextSendId() const;
@@ -73,7 +65,7 @@ namespace ehs
/// @param [in] sys The system hash id to execute an operation from.
/// @param [in] op The operation hash id in the system to execute.
/// @param [in] payload Additional parameters and data to send to the remote endpoint.
void Send(bool deltaLocked, UInt_64 encHashId, bool ensure, UInt_64 sys, UInt_64 op, const Serializer<UInt_64>& payload);
void Send(bool deltaLocked, UInt_64 encId, bool ensure, UInt_64 sysId, UInt_64 opId, const Serializer<UInt_64>& payload);
/// Sends data to the remote endpoint.
/// @param [in] deltaLocked Whether or not to match the remote endpoint's delta time to prevent overloading the client. This will drop data if delta time does not match.
@@ -82,13 +74,11 @@ namespace ehs
/// @param [in] sys The system string id to execute an operation from.
/// @param [in] op The operation string id in the system to execute.
/// @param [in] payload Additional parameters and data to send to the remote endpoint.
void Send(bool deltaLocked, const Str_8 &encID, bool ensure, const Str_8& sys, const Str_8& op, const Serializer<UInt_64>& payload);
void Send(bool deltaLocked, const Str_8 &encName, bool ensure, const Str_8& sysName, const Str_8& opName, const Serializer<UInt_64>& payload);
UInt_64 GetNextRecvId() const;
Str_8 GetAddress() const;
UInt_16 GetPort() const;
Endpoint GetEndpoint() const;
void SetDeltaRate(float newDeltaRate);
@@ -107,23 +97,21 @@ namespace ehs
private:
void Poll(float delta);
void SetStatus(Status newStatus);
void SetStatus(NetStatus newStatus);
void RemoveInsurance(UInt_64 msgId, UInt_64 fragment);
void AddReceived(const Header& header, const Serializer<>& payload);
Vector<NetFrags>* GetReceived();
Vector<NetFrag>* GetReceived();
void Ping(float delta);
void Pong(float delta);
void SetLatency(float newLatency);
void SetQueueSlot(UInt_64 slot);
NetFrags FragmentData(const Header& header, const Serializer<>& data);
NetFrag FragmentData(const Header& header, const Serializer<>& data);
void Send(const Header& header, const Serializer<>& payload);