[*] Refactor INetAdapter
This commit is contained in:
parent
76d3759295
commit
fc6902d231
@ -14,23 +14,23 @@ namespace Aurora::IO::Net
|
|||||||
|
|
||||||
struct INetAdapter
|
struct INetAdapter
|
||||||
{
|
{
|
||||||
virtual const AuString &ToName() = 0;
|
virtual const AuString &GetName() = 0;
|
||||||
virtual const AuString &ToDevice() = 0;
|
virtual const AuString &GetDevice() = 0;
|
||||||
|
|
||||||
virtual AuUInt16 GetIndex() = 0;
|
virtual AuUInt16 GetIndex() = 0;
|
||||||
|
|
||||||
virtual ENetworkAdapterType ToNetworkType() = 0;
|
virtual ENetworkAdapterType GetAdapterType() = 0;
|
||||||
virtual ENetworkAdapterStatus ToStatus() = 0;
|
virtual ENetworkAdapterStatus GetStatus() = 0;
|
||||||
|
|
||||||
virtual EIPProtocol ToFamily() = 0;
|
virtual EIPProtocol GetFamily() = 0;
|
||||||
|
|
||||||
virtual IPAddress ToAddress() = 0;
|
virtual IPAddress GetAddress() = 0;
|
||||||
virtual IPAddress ToBroadcastAddress() = 0;
|
virtual IPAddress GetBroadcastAddress() = 0;
|
||||||
virtual IPAddress ToAnycastAddress() = 0;
|
virtual IPAddress GetAnycastAddress() = 0;
|
||||||
virtual IPAddress ToSubnetMask() = 0;
|
virtual IPAddress GetSubnetMask() = 0;
|
||||||
virtual IPAddress ToGateway() = 0;
|
virtual IPAddress GetGateway() = 0;
|
||||||
|
|
||||||
virtual AuArray<AuUInt8, 8> ToMacAddress() = 0;
|
virtual AuArray<AuUInt8, 8> GetMacAddress() = 0;
|
||||||
|
|
||||||
virtual bool HasDHCP() = 0;
|
virtual bool HasDHCP() = 0;
|
||||||
|
|
||||||
|
@ -11,44 +11,44 @@
|
|||||||
|
|
||||||
namespace Aurora::IO::Net
|
namespace Aurora::IO::Net
|
||||||
{
|
{
|
||||||
const AuString &NetAdapter::ToName()
|
const AuString &NetAdapter::GetName()
|
||||||
{
|
{
|
||||||
return this->name.empty() ? this->device : this->name;
|
return this->name.empty() ? this->device : this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress NetAdapter::ToAddress()
|
IPAddress NetAdapter::GetAddress()
|
||||||
{
|
{
|
||||||
AuMemory::GetDefaultDiscontiguousHeapShared()->NewClass<NetAdapter>();
|
AuMemory::GetDefaultDiscontiguousHeapShared()->NewClass<NetAdapter>();
|
||||||
|
|
||||||
return this->address;
|
return this->address;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress NetAdapter::ToBroadcastAddress()
|
IPAddress NetAdapter::GetBroadcastAddress()
|
||||||
{
|
{
|
||||||
return this->broadcast;
|
return this->broadcast;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress NetAdapter::ToSubnetMask()
|
IPAddress NetAdapter::GetSubnetMask()
|
||||||
{
|
{
|
||||||
return this->subnet;
|
return this->subnet;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AuString &NetAdapter::ToDevice()
|
const AuString &NetAdapter::GetDevice()
|
||||||
{
|
{
|
||||||
return this->device;
|
return this->device;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENetworkAdapterType NetAdapter::ToNetworkType()
|
ENetworkAdapterType NetAdapter::GetAdapterType()
|
||||||
{
|
{
|
||||||
return this->eNetworkType;
|
return this->eNetworkType;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENetworkAdapterStatus NetAdapter::ToStatus()
|
ENetworkAdapterStatus NetAdapter::GetStatus()
|
||||||
{
|
{
|
||||||
return this->eNetworkStatus;
|
return this->eNetworkStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
EIPProtocol NetAdapter::ToFamily()
|
EIPProtocol NetAdapter::GetFamily()
|
||||||
{
|
{
|
||||||
return this->address.ip;
|
return this->address.ip;
|
||||||
}
|
}
|
||||||
@ -58,12 +58,12 @@ namespace Aurora::IO::Net
|
|||||||
return this->index;
|
return this->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress NetAdapter::ToAnycastAddress()
|
IPAddress NetAdapter::GetAnycastAddress()
|
||||||
{
|
{
|
||||||
return this->anycast;
|
return this->anycast;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress NetAdapter::ToGateway()
|
IPAddress NetAdapter::GetGateway()
|
||||||
{
|
{
|
||||||
return this->gateway;
|
return this->gateway;
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ namespace Aurora::IO::Net
|
|||||||
return this->dns;
|
return this->dns;
|
||||||
}
|
}
|
||||||
|
|
||||||
AuArray<AuUInt8, 8> NetAdapter::ToMacAddress()
|
AuArray<AuUInt8, 8> NetAdapter::GetMacAddress()
|
||||||
{
|
{
|
||||||
return this->mac;
|
return this->mac;
|
||||||
}
|
}
|
||||||
|
@ -11,25 +11,25 @@ namespace Aurora::IO::Net
|
|||||||
{
|
{
|
||||||
struct NetAdapter : INetAdapter
|
struct NetAdapter : INetAdapter
|
||||||
{
|
{
|
||||||
const AuString &ToName() override;
|
const AuString &GetName() override;
|
||||||
const AuString &ToDevice() override;
|
const AuString &GetDevice() override;
|
||||||
|
|
||||||
AuUInt16 GetIndex() override;
|
AuUInt16 GetIndex() override;
|
||||||
|
|
||||||
EIPProtocol ToFamily() override;
|
EIPProtocol GetFamily() override;
|
||||||
|
|
||||||
ENetworkAdapterType ToNetworkType() override;
|
ENetworkAdapterType GetAdapterType() override;
|
||||||
ENetworkAdapterStatus ToStatus() override;
|
ENetworkAdapterStatus GetStatus() override;
|
||||||
|
|
||||||
IPAddress ToAddress() override;
|
IPAddress GetAddress() override;
|
||||||
IPAddress ToBroadcastAddress() override;
|
IPAddress GetBroadcastAddress() override;
|
||||||
IPAddress ToAnycastAddress() override;
|
IPAddress GetAnycastAddress() override;
|
||||||
IPAddress ToSubnetMask() override;
|
IPAddress GetSubnetMask() override;
|
||||||
IPAddress ToGateway() override;
|
IPAddress GetGateway() override;
|
||||||
|
|
||||||
AuList<IPAddress> GetDNS() override;
|
AuList<IPAddress> GetDNS() override;
|
||||||
|
|
||||||
AuArray<AuUInt8, 8> ToMacAddress() override;
|
AuArray<AuUInt8, 8> GetMacAddress() override;
|
||||||
|
|
||||||
bool HasDHCP() override;
|
bool HasDHCP() override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user