Merge remote-tracking branch 'origin/NetChannels' into NetChannels
Some checks failed
Build & Release / Windows-AMD64-Build (push) Failing after 9m34s
Build & Release / Linux-AMD64-Build (push) Failing after 1m58s
Build & Release / Linux-AARCH64-Build (push) Failing after 5m21s

This commit is contained in:
2025-03-23 03:11:24 -07:00
11 changed files with 173 additions and 159 deletions

View File

@@ -63,23 +63,12 @@ namespace ehs
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;
bool AddServer(NetServerCh *server);
NetServerCh *GetServer(UInt_64 serverId) const;
NetServerCh *GetServer(const Str_8& serverName) const;
@@ -88,8 +77,19 @@ namespace ehs
bool HasClient(const Str_8& clientName) const;
bool AddClient(NetClientCh *channel);
NetClientCh *GetClient(UInt_64 clientId) const;
NetClientCh *GetClient(const Str_8& clientName) const;
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;
};
}

View File

@@ -41,7 +41,7 @@ namespace ehs
/// @param [in] address The local IPv4 or IPv6 address to bind to. Resolves domain names. The given address can be empty, "127.0.0.1", or "localhost" to automatically find the appropriate device.
/// @param [in] port The port to bind to.
/// @note Requires the port given to be forwarded if this is called.
void Bind(IP type, const Str_8& address, UInt_16 port) override;
void Bind(const Endpoint &endpoint) override;
/// Sends data using a C-style byte array.
/// @param [in] addr The remote Ipv4 or Ipv6 address to send to. Resolves domain names. The given address can be empty, "127.0.0.1", or "localhost" to automatically find the appropriate device.
@@ -49,7 +49,7 @@ namespace ehs
/// @param [in] data The C-style byte array to send.
/// @param [in] size The size of the C-style byte array.
/// @note The size of data to be sent cannot exceed "UDP::maxPayloadIpv4" or "UDP::maxPayloadIpv6".
UInt_64 Send(IP type, const Str_8& addr, UInt_16 port, const Byte* data, UInt_64 size) override;
UInt_64 Send(const Endpoint &endpoint, const Byte* data, UInt_64 size) override;
/// Receives data using the packet helper class.
/// @param [out] addr The Ipv4 or Ipv6 address of the sender.
@@ -58,7 +58,7 @@ namespace ehs
/// @param [in] size The size of the pre-allocated C-style byte array.
/// @returns The size of the data received.
/// @warning The provided C-style byte array must be freed when finished using.
UInt_64 Receive(IP* type, Str_8* addr, UInt_16* port, Byte* data, UInt_64 size) override;
UInt_64 Receive(Endpoint *endpoint, Byte* data, UInt_64 size) override;
/// Sets whether or not receiving data blocks the next task.
/// @param [in] blocking Whether or not to block.

View File

@@ -83,12 +83,12 @@ namespace ehs
virtual void Poll(const float &delta);
protected:
bool HasSystem(UInt_64 sysHashId) const;
bool HasSystem(UInt_64 sysId) const;
bool HasSystem(const Str_8& sysId) const;
bool HasSystem(const Str_8& sysName) const;
NetSys* GetSystem(UInt_64 sysHashId) const;
NetSys* GetSystem(UInt_64 sysId) const;
NetSys* GetSystem(const Str_8& sysId) const;
NetSys* GetSystem(const Str_8& sysName) const;
};
}

View File

@@ -14,15 +14,15 @@ namespace ehs
private:
friend class NetSys;
UInt_64 hashId;
Str_8 id;
UInt_64 id;
Str_8 name;
public:
virtual ~NetOp() = default;
NetOp();
NetOp(Str_8 id);
NetOp(Str_8 name);
NetOp(NetOp &&op) noexcept;
@@ -32,11 +32,11 @@ namespace ehs
NetOp &operator=(const NetOp &op);
Str_8 GetId() const;
UInt_64 GetId() const;
UInt_64 GetHashId() const;
Str_8 GetName() const;
private:
virtual void Process(NetChannel *channel, NetEnd *endpoint, NetSys *sys, Serializer<UInt_64> &payload);
virtual void Execute(NetChannel *channel, NetEnd *issuer, NetSys *sys, Serializer<UInt_64> &payload);
};
}

View File

@@ -17,8 +17,8 @@ namespace ehs
friend class NetServerCh;
friend class NetClientCh;
UInt_64 hashId;
Str_8 id;
UInt_64 id;
Str_8 name;
Array<NetOp*> ops;
public:
@@ -26,7 +26,7 @@ namespace ehs
NetSys();
NetSys(Str_8 id);
NetSys(Str_8 name);
NetSys(NetSys &&sys) noexcept;
@@ -36,15 +36,15 @@ namespace ehs
NetSys &operator=(const NetSys &sys);
Str_8 GetId() const;
UInt_64 GetId() const;
UInt_64 GetHashId() const;
Str_8 GetName() const;
bool HasOperation(UInt_64 hashId) const;
bool HasOperation(UInt_64 id) const;
bool AddOperation(NetOp *op);
private:
void Execute(NetChannel *channel, NetEnd *endpoint, UInt_64 hashId, Serializer<UInt_64> &payload);
void Execute(NetChannel *channel, NetEnd *issuer, UInt_64 opId, Serializer<UInt_64> &payload);
};
}