internal SystemIPInterfaceProperties(Interop.IpHlpApi.FIXED_INFO fixedInfo, Interop.IpHlpApi.IpAdapterAddresses ipAdapterAddresses)
{
_adapterFlags = ipAdapterAddresses.flags;
_dnsSuffix = ipAdapterAddresses.dnsSuffix;
_dnsEnabled = fixedInfo.enableDns;
_dynamicDnsEnabled = ((ipAdapterAddresses.flags & Interop.IpHlpApi.AdapterFlags.DnsEnabled) > 0);
_multicastAddresses = SystemMulticastIPAddressInformation.ToMulticastIpAddressInformationCollection(
Interop.IpHlpApi.IpAdapterAddress.MarshalIpAddressInformationCollection(ipAdapterAddresses.firstMulticastAddress));
_dnsAddresses = Interop.IpHlpApi.IpAdapterAddress.MarshalIpAddressCollection(ipAdapterAddresses.firstDnsServerAddress);
_anycastAddresses = Interop.IpHlpApi.IpAdapterAddress.MarshalIpAddressInformationCollection(
ipAdapterAddresses.firstAnycastAddress);
_unicastAddresses = SystemUnicastIPAddressInformation.MarshalUnicastIpAddressInformationCollection(
ipAdapterAddresses.firstUnicastAddress);
_winsServersAddresses = Interop.IpHlpApi.IpAdapterAddress.MarshalIpAddressCollection(
ipAdapterAddresses.firstWinsServerAddress);
_gatewayAddresses = SystemGatewayIPAddressInformation.ToGatewayIpAddressInformationCollection(
Interop.IpHlpApi.IpAdapterAddress.MarshalIpAddressCollection(ipAdapterAddresses.firstGatewayAddress));
_dhcpServers = new InternalIPAddressCollection();
if (ipAdapterAddresses.dhcpv4Server.address != IntPtr.Zero)
{
_dhcpServers.InternalAdd(ipAdapterAddresses.dhcpv4Server.MarshalIPAddress());
}
if (ipAdapterAddresses.dhcpv6Server.address != IntPtr.Zero)
{
_dhcpServers.InternalAdd(ipAdapterAddresses.dhcpv6Server.MarshalIPAddress());
}
if ((_adapterFlags & Interop.IpHlpApi.AdapterFlags.IPv4Enabled) != 0)
{
_ipv4Properties = new SystemIPv4InterfaceProperties(fixedInfo, ipAdapterAddresses);
}
if ((_adapterFlags & Interop.IpHlpApi.AdapterFlags.IPv6Enabled) != 0)
{
_ipv6Properties = new SystemIPv6InterfaceProperties(ipAdapterAddresses.ipv6Index,
ipAdapterAddresses.mtu, ipAdapterAddresses.zoneIndices);
}
}