65 lines
2.0 KiB
C++
65 lines
2.0 KiB
C++
/***
|
|
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
|
|
{
|
|
const AuString &GetName() override;
|
|
const AuString &GetDevice() override;
|
|
|
|
AuUInt16 GetIndex() override;
|
|
|
|
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;
|
|
|
|
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 {};
|
|
};
|
|
} |