2022-11-09 20:22:43 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Net.NetworkInformation;
|
2020-02-17 16:28:41 +01:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types
|
|
|
|
|
{
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0xd)]
|
|
|
|
|
struct IpAddressSetting
|
|
|
|
|
{
|
|
|
|
|
[MarshalAs(UnmanagedType.U1)]
|
|
|
|
|
public bool IsDhcpEnabled;
|
|
|
|
|
public IpV4Address Address;
|
|
|
|
|
public IpV4Address IPv4Mask;
|
|
|
|
|
public IpV4Address GatewayAddress;
|
|
|
|
|
|
|
|
|
|
public IpAddressSetting(IPInterfaceProperties interfaceProperties, UnicastIPAddressInformation unicastIPAddressInformation)
|
|
|
|
|
{
|
2023-02-28 04:41:44 +01:00
|
|
|
|
IsDhcpEnabled = OperatingSystem.IsMacOS() || interfaceProperties.DhcpServerAddresses.Count != 0;
|
2020-02-17 16:28:41 +01:00
|
|
|
|
Address = new IpV4Address(unicastIPAddressInformation.Address);
|
|
|
|
|
IPv4Mask = new IpV4Address(unicastIPAddressInformation.IPv4Mask);
|
|
|
|
|
GatewayAddress = new IpV4Address(interfaceProperties.GatewayAddresses[0].Address);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|