[*] Refactor ENetworkAdapterType->EAdapterType

[*] Refactor ENetworkAdapterStatus->EAdapterStatus
This commit is contained in:
Reece Wilson 2024-04-01 06:41:51 +01:00
parent 2717178681
commit 2a2e40fc8c
5 changed files with 26 additions and 26 deletions

View File

@ -9,8 +9,8 @@
namespace Aurora::IO::Net
{
AUE_DEFINE_VA(ENetworkAdapterStatus, eUp, eDown);
AUE_DEFINE_VA(ENetworkAdapterType, eUnknown, eOther, eIPGRE, eTunnel, eLoopback, eEthernet, eIEEE80211, eMobileNetwork, eTokenRing);
AUE_DEFINE_VA(EAdapterStatus, eUp, eDown);
AUE_DEFINE_VA(EAdapterType, eUnknown, eOther, eIPGRE, eTunnel, eLoopback, eEthernet, eIEEE80211, eMobileNetwork, eTokenRing);
struct INetAdapter
{
@ -19,8 +19,8 @@ namespace Aurora::IO::Net
virtual AuUInt16 GetIndex() = 0;
virtual ENetworkAdapterType GetAdapterType() = 0;
virtual ENetworkAdapterStatus GetAdapterStatus() = 0;
virtual EAdapterType GetAdapterType() = 0;
virtual EAdapterStatus GetAdapterStatus() = 0;
virtual EIPProtocol GetFamily() = 0;

View File

@ -483,15 +483,15 @@ namespace Aurora::IO::Net
}
adapter.eNetworkStatus = ifa->ifi_flags & IFF_RUNNING ?
ENetworkAdapterStatus::eUp :
ENetworkAdapterStatus::eDown;
EAdapterStatus::eUp :
EAdapterStatus::eDown;
{
switch (ifa->ifi_type)
{
case ARPHRD_ETHER:
case ARPHRD_EETHER:
adapter.eNetworkType = ENetworkAdapterType::eEthernet;
adapter.eNetworkType = EAdapterType::eEthernet;
break;
case ARPHRD_IEEE802:
case ARPHRD_IEEE802_TR:
@ -500,20 +500,20 @@ namespace Aurora::IO::Net
case ARPHRD_IEEE80211_RADIOTAP:
case ARPHRD_IEEE802154:
case ARPHRD_IEEE802154_MONITOR:
adapter.eNetworkType = ENetworkAdapterType::eIEEE80211;
adapter.eNetworkType = EAdapterType::eIEEE80211;
break;
case ARPHRD_PRONET:
adapter.eNetworkType = ENetworkAdapterType::eTokenRing;
adapter.eNetworkType = EAdapterType::eTokenRing;
break;
case ARPHRD_LOOPBACK:
adapter.eNetworkType = ENetworkAdapterType::eLoopback;
adapter.eNetworkType = EAdapterType::eLoopback;
break;
case ARPHRD_TUNNEL:
case ARPHRD_TUNNEL6:
adapter.eNetworkType = ENetworkAdapterType::eTunnel;
adapter.eNetworkType = EAdapterType::eTunnel;
break;
case ARPHRD_IPGRE:
adapter.eNetworkType = ENetworkAdapterType::eIPGRE;
adapter.eNetworkType = EAdapterType::eIPGRE;
break;
}
}

View File

@ -182,29 +182,29 @@ namespace Aurora::IO::Net
switch (pCurrAddresses->IfType)
{
case IF_TYPE_OTHER:
adapter.eNetworkType = ENetworkAdapterType::eOther;
adapter.eNetworkType = EAdapterType::eOther;
break;
case IF_TYPE_ETHERNET_CSMACD:
adapter.eNetworkType = ENetworkAdapterType::eEthernet;
adapter.eNetworkType = EAdapterType::eEthernet;
break;
case IF_TYPE_IEEE80211:
adapter.eNetworkType = ENetworkAdapterType::eIEEE80211;
adapter.eNetworkType = EAdapterType::eIEEE80211;
break;
case IF_TYPE_ISO88025_TOKENRING:
adapter.eNetworkType = ENetworkAdapterType::eTokenRing;
adapter.eNetworkType = EAdapterType::eTokenRing;
break;
case IF_TYPE_SOFTWARE_LOOPBACK:
adapter.eNetworkType = ENetworkAdapterType::eLoopback;
adapter.eNetworkType = EAdapterType::eLoopback;
break;
case IF_TYPE_TUNNEL:
adapter.eNetworkType = ENetworkAdapterType::eTunnel;
adapter.eNetworkType = EAdapterType::eTunnel;
break;
}
}
adapter.eNetworkStatus = pCurrAddresses->OperStatus == IfOperStatusUp ?
ENetworkAdapterStatus::eUp :
ENetworkAdapterStatus::eDown;
EAdapterStatus::eUp :
EAdapterStatus::eDown;
auto pAnycast = pCurrAddresses->FirstAnycastAddress;
if (pAnycast)

View File

@ -26,12 +26,12 @@ namespace Aurora::IO::Net
return this->device;
}
ENetworkAdapterType NetAdapter::GetAdapterType()
EAdapterType NetAdapter::GetAdapterType()
{
return this->eNetworkType;
}
ENetworkAdapterStatus NetAdapter::GetAdapterStatus()
EAdapterStatus NetAdapter::GetAdapterStatus()
{
return this->eNetworkStatus;
}

View File

@ -18,8 +18,8 @@ namespace Aurora::IO::Net
EIPProtocol GetFamily() override;
ENetworkAdapterType GetAdapterType() override;
ENetworkAdapterStatus GetAdapterStatus() override;
EAdapterType GetAdapterType() override;
EAdapterStatus GetAdapterStatus() override;
const IPAddress &GetAddress() override;
const IPAddress &GetBroadcastAddress() override;
@ -51,8 +51,8 @@ namespace Aurora::IO::Net
IPAddress anycast;
IPAddress subnet;
IPAddress gateway;
ENetworkAdapterType eNetworkType { ENetworkAdapterType::eUnknown };
ENetworkAdapterStatus eNetworkStatus { ENetworkAdapterStatus::eUp };
EAdapterType eNetworkType { EAdapterType::eUnknown };
EAdapterStatus eNetworkStatus { EAdapterStatus::eUp };
bool dhcp {};
AuArray<AuUInt8, 8> mac;
AuUInt64 uTransmitBytesPerSec { 10 * 1000 * 1000 / 8 };