Made NetChannel methods public in EHC.

This commit is contained in:
Arron Nelson 2025-01-30 12:32:52 -08:00
parent 62f8a662a0
commit 16b56a7084
2 changed files with 65 additions and 65 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

@ -270,58 +270,6 @@ namespace ehs
return true;
}
bool EHC::AddServer(NetServerCh *server)
{
if (HasServer(server->GetId()))
return false;
server->owner = this;
servers.Push(server);
return true;
}
bool EHC::AddClient(NetClientCh *client)
{
if (HasServer(client->GetId()))
return false;
client->owner = this;
clients.Push(client);
return true;
}
bool EHC::HasEncryption(UInt_64 encId) const
{
for (UInt_64 i = 0; i < encryptions.Size(); ++i)
if (encryptions[i]->GetId() == encId)
return true;
return false;
}
bool EHC::HasEncryption(const Str_8& encName) const
{
return HasEncryption(encName.Hash_64());
}
NetEnc* EHC::GetEncryption(UInt_64 encId) const
{
for (UInt_64 i = 0; i < encryptions.Size(); ++i)
if (encryptions[i]->GetId() == encId)
return encryptions[i];
return nullptr;
}
NetEnc* EHC::GetEncryption(const Str_8& encName) const
{
return GetEncryption(encName.Hash_64());
}
bool EHC::HasServer(const UInt_64 serverId) const
{
for (UInt_64 i = 0; i < servers.Size(); ++i)
@ -336,6 +284,18 @@ namespace ehs
return HasServer(serverName.Hash_64());
}
bool EHC::AddServer(NetServerCh *server)
{
if (HasServer(server->GetId()))
return false;
server->owner = this;
servers.Push(server);
return true;
}
NetServerCh *EHC::GetServer(const UInt_64 serverId) const
{
for (UInt_64 i = 0; i < servers.Size(); ++i)
@ -364,6 +324,18 @@ namespace ehs
return HasClient(clientName.Hash_64());
}
bool EHC::AddClient(NetClientCh *client)
{
if (HasServer(client->GetId()))
return false;
client->owner = this;
clients.Push(client);
return true;
}
NetClientCh *EHC::GetClient(const UInt_64 clientId) const
{
for (UInt_64 i = 0; i < clients.Size(); ++i)
@ -377,4 +349,32 @@ namespace ehs
{
return GetClient(clientName.Hash_64());
}
bool EHC::HasEncryption(UInt_64 encId) const
{
for (UInt_64 i = 0; i < encryptions.Size(); ++i)
if (encryptions[i]->GetId() == encId)
return true;
return false;
}
bool EHC::HasEncryption(const Str_8& encName) const
{
return HasEncryption(encName.Hash_64());
}
NetEnc* EHC::GetEncryption(UInt_64 encId) const
{
for (UInt_64 i = 0; i < encryptions.Size(); ++i)
if (encryptions[i]->GetId() == encId)
return encryptions[i];
return nullptr;
}
NetEnc* EHC::GetEncryption(const Str_8& encName) const
{
return GetEncryption(encName.Hash_64());
}
}