AuroraRuntime/Source/IO/Net/AuNetAdapter.hpp

65 lines
2.0 KiB
C++
Raw Normal View History

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuNetAdapter.hpp
Date: 2022-11-14
Author: Reece
***/
#pragma once
namespace Aurora::IO::Net
{
struct NetAdapter : INetAdapter
{
2023-12-10 15:42:04 +00:00
const AuString &GetName() override;
const AuString &GetDevice() override;
AuUInt16 GetIndex() override;
2023-12-10 15:42:04 +00:00
EIPProtocol GetFamily() override;
EAdapterType GetAdapterType() override;
EAdapterStatus GetAdapterStatus() override;
AuOptional<const IPAddress &> GetAddress() override;
AuOptional<const IPAddress &> GetBroadcastAddress() override;
AuOptional<const IPAddress &> GetAnycastAddress() override;
AuOptional<const IPAddress &> GetSubnetMask() override;
AuOptional<const IPAddress &> GetGateway() override;
const AuList<IPAddress> &GetDNS() override;
2023-12-10 15:42:04 +00:00
AuArray<AuUInt8, 8> GetMacAddress() override;
bool HasDHCP() override;
AuUInt32 GetMTU() override;
AuUInt64 GetTransmitBytesPerSec() override;
AuUInt64 GetReceiveBytesPerSec() override;
// FriendlyName
static AuString GetHostname();
static AuList<AuSPtr<INetAdapter>> GetIPv4s(); // must be called first under lock
static AuList<AuSPtr<INetAdapter>> GetIPv6s(); // followed by me
// other protocols can go here
AuString name;
AuString device;
AuOptional<IPAddress> address;
AuOptional<IPAddress> broadcast;
AuOptional<IPAddress> anycast;
AuOptional<IPAddress> subnet;
AuOptional<IPAddress> gateway;
EAdapterType eNetworkType { EAdapterType::eUnknown };
EAdapterStatus eNetworkStatus { EAdapterStatus::eUp };
bool dhcp {};
AuArray<AuUInt8, 8> mac;
AuUInt64 uTransmitBytesPerSec { 10 * 1000 * 1000 / 8 };
AuUInt64 uReceiveBytesPerSec { 10 * 1000 * 1000 / 8 };
AuUInt32 mtu;
AuList<IPAddress> dns;
AuUInt16 index {};
};
}