[*] Refactor ENetworkAdapterType->EAdapterType
[*] Refactor ENetworkAdapterStatus->EAdapterStatus
This commit is contained in:
parent
2717178681
commit
2a2e40fc8c
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
namespace Aurora::IO::Net
|
namespace Aurora::IO::Net
|
||||||
{
|
{
|
||||||
AUE_DEFINE_VA(ENetworkAdapterStatus, eUp, eDown);
|
AUE_DEFINE_VA(EAdapterStatus, eUp, eDown);
|
||||||
AUE_DEFINE_VA(ENetworkAdapterType, eUnknown, eOther, eIPGRE, eTunnel, eLoopback, eEthernet, eIEEE80211, eMobileNetwork, eTokenRing);
|
AUE_DEFINE_VA(EAdapterType, eUnknown, eOther, eIPGRE, eTunnel, eLoopback, eEthernet, eIEEE80211, eMobileNetwork, eTokenRing);
|
||||||
|
|
||||||
struct INetAdapter
|
struct INetAdapter
|
||||||
{
|
{
|
||||||
@ -19,8 +19,8 @@ namespace Aurora::IO::Net
|
|||||||
|
|
||||||
virtual AuUInt16 GetIndex() = 0;
|
virtual AuUInt16 GetIndex() = 0;
|
||||||
|
|
||||||
virtual ENetworkAdapterType GetAdapterType() = 0;
|
virtual EAdapterType GetAdapterType() = 0;
|
||||||
virtual ENetworkAdapterStatus GetAdapterStatus() = 0;
|
virtual EAdapterStatus GetAdapterStatus() = 0;
|
||||||
|
|
||||||
virtual EIPProtocol GetFamily() = 0;
|
virtual EIPProtocol GetFamily() = 0;
|
||||||
|
|
||||||
|
@ -483,15 +483,15 @@ namespace Aurora::IO::Net
|
|||||||
}
|
}
|
||||||
|
|
||||||
adapter.eNetworkStatus = ifa->ifi_flags & IFF_RUNNING ?
|
adapter.eNetworkStatus = ifa->ifi_flags & IFF_RUNNING ?
|
||||||
ENetworkAdapterStatus::eUp :
|
EAdapterStatus::eUp :
|
||||||
ENetworkAdapterStatus::eDown;
|
EAdapterStatus::eDown;
|
||||||
|
|
||||||
{
|
{
|
||||||
switch (ifa->ifi_type)
|
switch (ifa->ifi_type)
|
||||||
{
|
{
|
||||||
case ARPHRD_ETHER:
|
case ARPHRD_ETHER:
|
||||||
case ARPHRD_EETHER:
|
case ARPHRD_EETHER:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eEthernet;
|
adapter.eNetworkType = EAdapterType::eEthernet;
|
||||||
break;
|
break;
|
||||||
case ARPHRD_IEEE802:
|
case ARPHRD_IEEE802:
|
||||||
case ARPHRD_IEEE802_TR:
|
case ARPHRD_IEEE802_TR:
|
||||||
@ -500,20 +500,20 @@ namespace Aurora::IO::Net
|
|||||||
case ARPHRD_IEEE80211_RADIOTAP:
|
case ARPHRD_IEEE80211_RADIOTAP:
|
||||||
case ARPHRD_IEEE802154:
|
case ARPHRD_IEEE802154:
|
||||||
case ARPHRD_IEEE802154_MONITOR:
|
case ARPHRD_IEEE802154_MONITOR:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eIEEE80211;
|
adapter.eNetworkType = EAdapterType::eIEEE80211;
|
||||||
break;
|
break;
|
||||||
case ARPHRD_PRONET:
|
case ARPHRD_PRONET:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eTokenRing;
|
adapter.eNetworkType = EAdapterType::eTokenRing;
|
||||||
break;
|
break;
|
||||||
case ARPHRD_LOOPBACK:
|
case ARPHRD_LOOPBACK:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eLoopback;
|
adapter.eNetworkType = EAdapterType::eLoopback;
|
||||||
break;
|
break;
|
||||||
case ARPHRD_TUNNEL:
|
case ARPHRD_TUNNEL:
|
||||||
case ARPHRD_TUNNEL6:
|
case ARPHRD_TUNNEL6:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eTunnel;
|
adapter.eNetworkType = EAdapterType::eTunnel;
|
||||||
break;
|
break;
|
||||||
case ARPHRD_IPGRE:
|
case ARPHRD_IPGRE:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eIPGRE;
|
adapter.eNetworkType = EAdapterType::eIPGRE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,29 +182,29 @@ namespace Aurora::IO::Net
|
|||||||
switch (pCurrAddresses->IfType)
|
switch (pCurrAddresses->IfType)
|
||||||
{
|
{
|
||||||
case IF_TYPE_OTHER:
|
case IF_TYPE_OTHER:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eOther;
|
adapter.eNetworkType = EAdapterType::eOther;
|
||||||
break;
|
break;
|
||||||
case IF_TYPE_ETHERNET_CSMACD:
|
case IF_TYPE_ETHERNET_CSMACD:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eEthernet;
|
adapter.eNetworkType = EAdapterType::eEthernet;
|
||||||
break;
|
break;
|
||||||
case IF_TYPE_IEEE80211:
|
case IF_TYPE_IEEE80211:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eIEEE80211;
|
adapter.eNetworkType = EAdapterType::eIEEE80211;
|
||||||
break;
|
break;
|
||||||
case IF_TYPE_ISO88025_TOKENRING:
|
case IF_TYPE_ISO88025_TOKENRING:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eTokenRing;
|
adapter.eNetworkType = EAdapterType::eTokenRing;
|
||||||
break;
|
break;
|
||||||
case IF_TYPE_SOFTWARE_LOOPBACK:
|
case IF_TYPE_SOFTWARE_LOOPBACK:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eLoopback;
|
adapter.eNetworkType = EAdapterType::eLoopback;
|
||||||
break;
|
break;
|
||||||
case IF_TYPE_TUNNEL:
|
case IF_TYPE_TUNNEL:
|
||||||
adapter.eNetworkType = ENetworkAdapterType::eTunnel;
|
adapter.eNetworkType = EAdapterType::eTunnel;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter.eNetworkStatus = pCurrAddresses->OperStatus == IfOperStatusUp ?
|
adapter.eNetworkStatus = pCurrAddresses->OperStatus == IfOperStatusUp ?
|
||||||
ENetworkAdapterStatus::eUp :
|
EAdapterStatus::eUp :
|
||||||
ENetworkAdapterStatus::eDown;
|
EAdapterStatus::eDown;
|
||||||
|
|
||||||
auto pAnycast = pCurrAddresses->FirstAnycastAddress;
|
auto pAnycast = pCurrAddresses->FirstAnycastAddress;
|
||||||
if (pAnycast)
|
if (pAnycast)
|
||||||
|
@ -26,12 +26,12 @@ namespace Aurora::IO::Net
|
|||||||
return this->device;
|
return this->device;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENetworkAdapterType NetAdapter::GetAdapterType()
|
EAdapterType NetAdapter::GetAdapterType()
|
||||||
{
|
{
|
||||||
return this->eNetworkType;
|
return this->eNetworkType;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENetworkAdapterStatus NetAdapter::GetAdapterStatus()
|
EAdapterStatus NetAdapter::GetAdapterStatus()
|
||||||
{
|
{
|
||||||
return this->eNetworkStatus;
|
return this->eNetworkStatus;
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ namespace Aurora::IO::Net
|
|||||||
|
|
||||||
EIPProtocol GetFamily() override;
|
EIPProtocol GetFamily() override;
|
||||||
|
|
||||||
ENetworkAdapterType GetAdapterType() override;
|
EAdapterType GetAdapterType() override;
|
||||||
ENetworkAdapterStatus GetAdapterStatus() override;
|
EAdapterStatus GetAdapterStatus() override;
|
||||||
|
|
||||||
const IPAddress &GetAddress() override;
|
const IPAddress &GetAddress() override;
|
||||||
const IPAddress &GetBroadcastAddress() override;
|
const IPAddress &GetBroadcastAddress() override;
|
||||||
@ -51,8 +51,8 @@ namespace Aurora::IO::Net
|
|||||||
IPAddress anycast;
|
IPAddress anycast;
|
||||||
IPAddress subnet;
|
IPAddress subnet;
|
||||||
IPAddress gateway;
|
IPAddress gateway;
|
||||||
ENetworkAdapterType eNetworkType { ENetworkAdapterType::eUnknown };
|
EAdapterType eNetworkType { EAdapterType::eUnknown };
|
||||||
ENetworkAdapterStatus eNetworkStatus { ENetworkAdapterStatus::eUp };
|
EAdapterStatus eNetworkStatus { EAdapterStatus::eUp };
|
||||||
bool dhcp {};
|
bool dhcp {};
|
||||||
AuArray<AuUInt8, 8> mac;
|
AuArray<AuUInt8, 8> mac;
|
||||||
AuUInt64 uTransmitBytesPerSec { 10 * 1000 * 1000 / 8 };
|
AuUInt64 uTransmitBytesPerSec { 10 * 1000 * 1000 / 8 };
|
||||||
|
Loading…
Reference in New Issue
Block a user