[*] Refactor INetAdapter

This commit is contained in:
Reece Wilson 2023-12-10 15:42:04 +00:00
parent 76d3759295
commit fc6902d231
3 changed files with 33 additions and 33 deletions

View File

@ -14,23 +14,23 @@ namespace Aurora::IO::Net
struct INetAdapter
{
virtual const AuString &ToName() = 0;
virtual const AuString &ToDevice() = 0;
virtual const AuString &GetName() = 0;
virtual const AuString &GetDevice() = 0;
virtual AuUInt16 GetIndex() = 0;
virtual ENetworkAdapterType ToNetworkType() = 0;
virtual ENetworkAdapterStatus ToStatus() = 0;
virtual ENetworkAdapterType GetAdapterType() = 0;
virtual ENetworkAdapterStatus GetStatus() = 0;
virtual EIPProtocol ToFamily() = 0;
virtual EIPProtocol GetFamily() = 0;
virtual IPAddress ToAddress() = 0;
virtual IPAddress ToBroadcastAddress() = 0;
virtual IPAddress ToAnycastAddress() = 0;
virtual IPAddress ToSubnetMask() = 0;
virtual IPAddress ToGateway() = 0;
virtual IPAddress GetAddress() = 0;
virtual IPAddress GetBroadcastAddress() = 0;
virtual IPAddress GetAnycastAddress() = 0;
virtual IPAddress GetSubnetMask() = 0;
virtual IPAddress GetGateway() = 0;
virtual AuArray<AuUInt8, 8> ToMacAddress() = 0;
virtual AuArray<AuUInt8, 8> GetMacAddress() = 0;
virtual bool HasDHCP() = 0;

View File

@ -11,44 +11,44 @@
namespace Aurora::IO::Net
{
const AuString &NetAdapter::ToName()
const AuString &NetAdapter::GetName()
{
return this->name.empty() ? this->device : this->name;
}
IPAddress NetAdapter::ToAddress()
IPAddress NetAdapter::GetAddress()
{
AuMemory::GetDefaultDiscontiguousHeapShared()->NewClass<NetAdapter>();
return this->address;
}
IPAddress NetAdapter::ToBroadcastAddress()
IPAddress NetAdapter::GetBroadcastAddress()
{
return this->broadcast;
}
IPAddress NetAdapter::ToSubnetMask()
IPAddress NetAdapter::GetSubnetMask()
{
return this->subnet;
}
const AuString &NetAdapter::ToDevice()
const AuString &NetAdapter::GetDevice()
{
return this->device;
}
ENetworkAdapterType NetAdapter::ToNetworkType()
ENetworkAdapterType NetAdapter::GetAdapterType()
{
return this->eNetworkType;
}
ENetworkAdapterStatus NetAdapter::ToStatus()
ENetworkAdapterStatus NetAdapter::GetStatus()
{
return this->eNetworkStatus;
}
EIPProtocol NetAdapter::ToFamily()
EIPProtocol NetAdapter::GetFamily()
{
return this->address.ip;
}
@ -58,12 +58,12 @@ namespace Aurora::IO::Net
return this->index;
}
IPAddress NetAdapter::ToAnycastAddress()
IPAddress NetAdapter::GetAnycastAddress()
{
return this->anycast;
}
IPAddress NetAdapter::ToGateway()
IPAddress NetAdapter::GetGateway()
{
return this->gateway;
}
@ -73,7 +73,7 @@ namespace Aurora::IO::Net
return this->dns;
}
AuArray<AuUInt8, 8> NetAdapter::ToMacAddress()
AuArray<AuUInt8, 8> NetAdapter::GetMacAddress()
{
return this->mac;
}

View File

@ -11,25 +11,25 @@ namespace Aurora::IO::Net
{
struct NetAdapter : INetAdapter
{
const AuString &ToName() override;
const AuString &ToDevice() override;
const AuString &GetName() override;
const AuString &GetDevice() override;
AuUInt16 GetIndex() override;
EIPProtocol ToFamily() override;
EIPProtocol GetFamily() override;
ENetworkAdapterType ToNetworkType() override;
ENetworkAdapterStatus ToStatus() override;
ENetworkAdapterType GetAdapterType() override;
ENetworkAdapterStatus GetStatus() override;
IPAddress ToAddress() override;
IPAddress ToBroadcastAddress() override;
IPAddress ToAnycastAddress() override;
IPAddress ToSubnetMask() override;
IPAddress ToGateway() override;
IPAddress GetAddress() override;
IPAddress GetBroadcastAddress() override;
IPAddress GetAnycastAddress() override;
IPAddress GetSubnetMask() override;
IPAddress GetGateway() override;
AuList<IPAddress> GetDNS() override;
AuArray<AuUInt8, 8> ToMacAddress() override;
AuArray<AuUInt8, 8> GetMacAddress() override;
bool HasDHCP() override;