2021-07-06 18:41:11 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Net.NetworkInformation;
|
2020-02-17 15:28:41 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
|
|
|
|
|
{
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 9)]
|
|
|
|
|
struct DnsSetting
|
|
|
|
|
{
|
|
|
|
|
[MarshalAs(UnmanagedType.U1)]
|
|
|
|
|
public bool IsDynamicDnsEnabled;
|
|
|
|
|
public IpV4Address PrimaryDns;
|
|
|
|
|
public IpV4Address SecondaryDns;
|
|
|
|
|
|
|
|
|
|
public DnsSetting(IPInterfaceProperties interfaceProperties)
|
|
|
|
|
{
|
2021-07-06 18:41:11 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IsDynamicDnsEnabled = interfaceProperties.IsDynamicDnsEnabled;
|
|
|
|
|
}
|
|
|
|
|
catch (PlatformNotSupportedException)
|
|
|
|
|
{
|
|
|
|
|
IsDynamicDnsEnabled = false;
|
|
|
|
|
}
|
2021-04-13 01:04:18 +00:00
|
|
|
|
|
|
|
|
|
if (interfaceProperties.DnsAddresses.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
PrimaryDns = new IpV4Address();
|
|
|
|
|
SecondaryDns = new IpV4Address();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PrimaryDns = new IpV4Address(interfaceProperties.DnsAddresses[0]);
|
|
|
|
|
SecondaryDns = new IpV4Address(interfaceProperties.DnsAddresses[interfaceProperties.DnsAddresses.Count > 1 ? 1 : 0]);
|
|
|
|
|
}
|
2020-02-17 15:28:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-13 01:04:18 +00:00
|
|
|
|
}
|