108 lines
2.3 KiB
C++
108 lines
2.3 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AuNetAdapter.cpp
|
|
Date: 2022-11-14
|
|
Author: Reece
|
|
***/
|
|
#include "Networking.hpp"
|
|
#include "AuNetAdapter.hpp"
|
|
#include "AuNetAdapter.hpp"
|
|
|
|
namespace Aurora::IO::Net
|
|
{
|
|
const AuString &NetAdapter::GetName()
|
|
{
|
|
return this->name.empty() ? this->device : this->name;
|
|
}
|
|
|
|
const AuString &NetAdapter::GetDevice()
|
|
{
|
|
return this->device;
|
|
}
|
|
|
|
EAdapterType NetAdapter::GetAdapterType()
|
|
{
|
|
return this->eNetworkType;
|
|
}
|
|
|
|
EAdapterStatus NetAdapter::GetAdapterStatus()
|
|
{
|
|
return this->eNetworkStatus;
|
|
}
|
|
|
|
EIPProtocol NetAdapter::GetFamily()
|
|
{
|
|
return this->address.ValueOr(IPAddress {}).ip;
|
|
}
|
|
|
|
AuUInt16 NetAdapter::GetIndex()
|
|
{
|
|
return this->index;
|
|
}
|
|
|
|
AuOptional<const IPAddress &> NetAdapter::GetAddress()
|
|
{
|
|
return this->address ?
|
|
this->address.Value() :
|
|
AuOptional<const IPAddress &> {};
|
|
}
|
|
|
|
AuOptional<const IPAddress &> NetAdapter::GetBroadcastAddress()
|
|
{
|
|
return this->broadcast ?
|
|
this->broadcast.Value() :
|
|
AuOptional<const IPAddress &> {};
|
|
}
|
|
|
|
AuOptional<const IPAddress &> NetAdapter::GetAnycastAddress()
|
|
{
|
|
return this->anycast ?
|
|
this->anycast.Value() :
|
|
AuOptional<const IPAddress &> {};
|
|
}
|
|
|
|
AuOptional<const IPAddress &> NetAdapter::GetGateway()
|
|
{
|
|
return this->gateway ?
|
|
this->gateway.Value() :
|
|
AuOptional<const IPAddress &> {};
|
|
}
|
|
|
|
AuOptional<const IPAddress &> NetAdapter::GetSubnetMask()
|
|
{
|
|
return this->subnet ?
|
|
this->subnet.Value() :
|
|
AuOptional<const IPAddress &> {};
|
|
}
|
|
|
|
const AuList<IPAddress> &NetAdapter::GetDNS()
|
|
{
|
|
return this->dns;
|
|
}
|
|
|
|
AuArray<AuUInt8, 8> NetAdapter::GetMacAddress()
|
|
{
|
|
return this->mac;
|
|
}
|
|
|
|
bool NetAdapter::HasDHCP()
|
|
{
|
|
return this->dhcp;
|
|
}
|
|
|
|
AuUInt32 NetAdapter::GetMTU()
|
|
{
|
|
return this->mtu;
|
|
}
|
|
|
|
AuUInt64 NetAdapter::GetTransmitBytesPerSec()
|
|
{
|
|
return this->uTransmitBytesPerSec;
|
|
}
|
|
|
|
AuUInt64 NetAdapter::GetReceiveBytesPerSec()
|
|
{
|
|
return this->uReceiveBytesPerSec;
|
|
}
|
|
} |