65 lines
1.8 KiB
C++
65 lines
1.8 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;
|
|
|
|
ENetworkAdapterType GetAdapterType() override;
|
|
ENetworkAdapterStatus GetStatus() override;
|
|
|
|
IPAddress GetAddress() override;
|
|
IPAddress GetBroadcastAddress() override;
|
|
IPAddress GetAnycastAddress() override;
|
|
IPAddress GetSubnetMask() override;
|
|
IPAddress GetGateway() override;
|
|
|
|
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;
|
|
IPAddress address;
|
|
IPAddress broadcast;
|
|
IPAddress anycast;
|
|
IPAddress subnet;
|
|
IPAddress gateway;
|
|
ENetworkAdapterType eNetworkType { ENetworkAdapterType::eUnknown };
|
|
ENetworkAdapterStatus eNetworkStatus { ENetworkAdapterStatus::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 {};
|
|
};
|
|
} |