internal SystemIPInterfaceProperties(FixedInfo fixedInfo, IpAdapterAddresses ipAdapterAddresses)
 {
     this.dnsEnabled = fixedInfo.EnableDns;
     this.index      = ipAdapterAddresses.index;
     this.name       = ipAdapterAddresses.AdapterName;
     this.ipv6Index  = ipAdapterAddresses.ipv6Index;
     if (this.index > 0)
     {
         this.versionSupported |= IPVersion.IPv4;
     }
     if (this.ipv6Index > 0)
     {
         this.versionSupported |= IPVersion.IPv6;
     }
     this.mtu                = ipAdapterAddresses.mtu;
     this.adapterFlags       = ipAdapterAddresses.flags;
     this.dnsSuffix          = ipAdapterAddresses.dnsSuffix;
     this.dynamicDnsEnabled  = (ipAdapterAddresses.flags & AdapterFlags.DnsEnabled) > 0;
     this.multicastAddresses = SystemMulticastIPAddressInformation.ToAddressInformationCollection(ipAdapterAddresses.FirstMulticastAddress);
     this.dnsAddresses       = SystemIPAddressInformation.ToAddressCollection(ipAdapterAddresses.FirstDnsServerAddress, this.versionSupported);
     this.anycastAddresses   = SystemIPAddressInformation.ToAddressInformationCollection(ipAdapterAddresses.FirstAnycastAddress, this.versionSupported);
     this.unicastAddresses   = SystemUnicastIPAddressInformation.ToAddressInformationCollection(ipAdapterAddresses.FirstUnicastAddress);
     if (this.ipv6Index > 0)
     {
         this.ipv6Properties = new SystemIPv6InterfaceProperties(this.ipv6Index, this.mtu);
     }
 }
 internal SystemUnicastIPAddressInformation(IpAdapterInfo ipAdapterInfo, IPExtendedAddress address)
 {
     this.innerInfo = new SystemIPAddressInformation(address.address);
     DateTime time = new DateTime(0x7b2, 1, 1);
     time = time.AddSeconds((double) ipAdapterInfo.leaseExpires);
     TimeSpan span = (TimeSpan) (time - DateTime.UtcNow);
     this.dhcpLeaseLifetime = (long) span.TotalSeconds;
     this.ipv4Mask = address.mask;
 }
        internal SystemUnicastIPAddressInformation(IpAdapterInfo ipAdapterInfo, IPExtendedAddress address)
        {
            this.innerInfo = new SystemIPAddressInformation(address.address);
            DateTime time = new DateTime(0x7b2, 1, 1);

            time = time.AddSeconds((double)ipAdapterInfo.leaseExpires);
            TimeSpan span = (TimeSpan)(time - DateTime.UtcNow);

            this.dhcpLeaseLifetime = (long)span.TotalSeconds;
            this.ipv4Mask          = address.mask;
        }
        internal SystemUnicastIPAddressInformation(IpAdapterUnicastAddress adapterAddress) {
            IPAddress ipAddress = adapterAddress.address.MarshalIPAddress();
            this.innerInfo = new SystemIPAddressInformation(ipAddress, adapterAddress.flags);
            this.prefixOrigin = adapterAddress.prefixOrigin;
            this.suffixOrigin = adapterAddress.suffixOrigin;
            this.dadState = adapterAddress.dadState;
            this.validLifetime = adapterAddress.validLifetime;
            this.preferredLifetime = adapterAddress.preferredLifetime;
            this.dhcpLeaseLifetime = adapterAddress.leaseLifetime;

            this.prefixLength = adapterAddress.prefixLength;

            // IPv6 returns 0.0.0.0 for consistancy with XP
            if (ipAddress.AddressFamily == AddressFamily.InterNetwork) {
                ipv4Mask = PrefixLengthToSubnetMask(prefixLength, ipAddress.AddressFamily);
            }
        }
        internal SystemUnicastIPAddressInformation(Interop.IpHlpApi.IpAdapterUnicastAddress adapterAddress)
        {
            IPAddress ipAddress = adapterAddress.address.MarshalIPAddress();
            _innerInfo = new SystemIPAddressInformation(ipAddress, adapterAddress.flags);
            _prefixOrigin = adapterAddress.prefixOrigin;
            _suffixOrigin = adapterAddress.suffixOrigin;
            _dadState = adapterAddress.dadState;
            _validLifetime = adapterAddress.validLifetime;
            _preferredLifetime = adapterAddress.preferredLifetime;
            _dhcpLeaseLifetime = adapterAddress.leaseLifetime;

            _prefixLength = adapterAddress.prefixLength;

            // IPv6 returns 0.0.0.0 for consistency with down-level platforms.
            if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
            {
                _ipv4Mask = PrefixLengthToSubnetMask(_prefixLength, ipAddress.AddressFamily);
            }
        }
        internal SystemUnicastIPAddressInformation(Interop.IpHlpApi.IpAdapterUnicastAddress adapterAddress)
        {
            IPAddress ipAddress = adapterAddress.address.MarshalIPAddress();

            _innerInfo         = new SystemIPAddressInformation(ipAddress, adapterAddress.flags);
            _prefixOrigin      = adapterAddress.prefixOrigin;
            _suffixOrigin      = adapterAddress.suffixOrigin;
            _dadState          = adapterAddress.dadState;
            _validLifetime     = adapterAddress.validLifetime;
            _preferredLifetime = adapterAddress.preferredLifetime;
            _dhcpLeaseLifetime = adapterAddress.leaseLifetime;

            _prefixLength = adapterAddress.prefixLength;

            // IPv6 returns 0.0.0.0 for consistency with down-level platforms.
            if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
            {
                _ipv4Mask = PrefixLengthToSubnetMask(_prefixLength, ipAddress.AddressFamily);
            }
        }
        internal SystemUnicastIPAddressInformation(IpAdapterUnicastAddress adapterAddress)
        {
            IPAddress ipAddress = adapterAddress.address.MarshalIPAddress();

            this.innerInfo         = new SystemIPAddressInformation(ipAddress, adapterAddress.flags);
            this.prefixOrigin      = adapterAddress.prefixOrigin;
            this.suffixOrigin      = adapterAddress.suffixOrigin;
            this.dadState          = adapterAddress.dadState;
            this.validLifetime     = adapterAddress.validLifetime;
            this.preferredLifetime = adapterAddress.preferredLifetime;
            this.dhcpLeaseLifetime = adapterAddress.leaseLifetime;

            this.prefixLength = adapterAddress.prefixLength;

            // IPv6 returns 0.0.0.0 for consistancy with XP
            if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
            {
                ipv4Mask = PrefixLengthToSubnetMask(prefixLength, ipAddress.AddressFamily);
            }
        }
 public SystemMulticastIPAddressInformation(SystemIPAddressInformation addressInfo)
 {
     innerInfo = addressInfo;
 }
 internal SystemMulticastIPAddressInformation(IpAdapterAddress adapterAddress, IPAddress ipAddress)
 {
     this.innerInfo = new SystemIPAddressInformation(adapterAddress, ipAddress);
     this.adapterAddress = adapterAddress;
 }
 public SystemMulticastIPAddressInformation(SystemIPAddressInformation addressInfo) {
     innerInfo = addressInfo;
 }
 internal SystemUnicastIPAddressInformation(IpAdapterUnicastAddress adapterAddress, IPAddress ipAddress)
 {
     this.innerInfo = new SystemIPAddressInformation(adapterAddress, ipAddress);
     this.adapterAddress = adapterAddress;
     this.dhcpLeaseLifetime = adapterAddress.leaseLifetime;
 }
Esempio n. 12
0
 internal SystemMulticastIPAddressInformation(IpAdapterAddress adapterAddress, IPAddress ipAddress)
 {
     this.innerInfo      = new SystemIPAddressInformation(adapterAddress, ipAddress);
     this.adapterAddress = adapterAddress;
 }
 internal SystemUnicastIPAddressInformation(IpAdapterUnicastAddress adapterAddress, IPAddress ipAddress)
 {
     this.innerInfo         = new SystemIPAddressInformation(adapterAddress, ipAddress);
     this.adapterAddress    = adapterAddress;
     this.dhcpLeaseLifetime = adapterAddress.leaseLifetime;
 }