internal SystemNetworkInterface(FixedInfo fixedInfo, IpAdapterInfo ipAdapterInfo)
        {
            this.id              = ipAdapterInfo.adapterName;
            this.name            = string.Empty;
            this.description     = ipAdapterInfo.description;
            this.index           = ipAdapterInfo.index;
            this.physicalAddress = ipAdapterInfo.address;
            this.addressLength   = ipAdapterInfo.addressLength;
            if (ComNetOS.IsWin2K && !ComNetOS.IsPostWin2K)
            {
                this.name = this.ReadAdapterName(this.id);
            }
            if (this.name.Length == 0)
            {
                this.name = this.description;
            }
            SystemIPv4InterfaceStatistics statistics = new SystemIPv4InterfaceStatistics((long)this.index);

            this.operStatus = statistics.OperationalStatus;
            switch (ipAdapterInfo.type)
            {
            case OldInterfaceType.Ppp:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Ppp;
                break;

            case OldInterfaceType.Loopback:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Loopback;
                break;

            case OldInterfaceType.Slip:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Slip;
                break;

            case OldInterfaceType.Fddi:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Fddi;
                break;

            case OldInterfaceType.Ethernet:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Ethernet;
                break;

            case OldInterfaceType.TokenRing:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.TokenRing;
                break;

            default:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Unknown;
                break;
            }
            this.interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterInfo);
        }
 internal SystemNetworkInterface(FixedInfo fixedInfo, IpAdapterAddresses ipAdapterAddresses)
 {
     this.id                  = ipAdapterAddresses.AdapterName;
     this.name                = ipAdapterAddresses.friendlyName;
     this.description         = ipAdapterAddresses.description;
     this.index               = ipAdapterAddresses.index;
     this.physicalAddress     = ipAdapterAddresses.address;
     this.addressLength       = ipAdapterAddresses.addressLength;
     this.type                = ipAdapterAddresses.type;
     this.operStatus          = ipAdapterAddresses.operStatus;
     this.ipv6Index           = ipAdapterAddresses.ipv6Index;
     this.adapterFlags        = ipAdapterAddresses.flags;
     this.interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterAddresses);
 }
 internal SystemNetworkInterface(FixedInfo fixedInfo, IpAdapterAddresses ipAdapterAddresses)
 {
     this.id = ipAdapterAddresses.AdapterName;
     this.name = ipAdapterAddresses.friendlyName;
     this.description = ipAdapterAddresses.description;
     this.index = ipAdapterAddresses.index;
     this.physicalAddress = ipAdapterAddresses.address;
     this.addressLength = ipAdapterAddresses.addressLength;
     this.type = ipAdapterAddresses.type;
     this.operStatus = ipAdapterAddresses.operStatus;
     this.ipv6Index = ipAdapterAddresses.ipv6Index;
     this.adapterFlags = ipAdapterAddresses.flags;
     this.interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterAddresses);
 }
Exemple #4
0
        internal SystemNetworkInterface(Interop.IpHlpApi.FIXED_INFO fixedInfo, Interop.IpHlpApi.IpAdapterAddresses ipAdapterAddresses)
        {
            // Store the common API information.
            _id          = ipAdapterAddresses.AdapterName;
            _name        = ipAdapterAddresses.friendlyName;
            _description = ipAdapterAddresses.description;
            _index       = ipAdapterAddresses.index;

            _physicalAddress = ipAdapterAddresses.address;
            _addressLength   = ipAdapterAddresses.addressLength;

            _type       = ipAdapterAddresses.type;
            _operStatus = ipAdapterAddresses.operStatus;
            _speed      = (long)ipAdapterAddresses.receiveLinkSpeed;

            // API specific info.
            _ipv6Index = ipAdapterAddresses.ipv6Index;

            _adapterFlags        = ipAdapterAddresses.flags;
            _interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterAddresses);
        }
        // Vista+
        internal SystemNetworkInterface(FixedInfo fixedInfo, IpAdapterAddresses ipAdapterAddresses)
        {
            //store the common api information
            id          = ipAdapterAddresses.AdapterName;
            name        = ipAdapterAddresses.friendlyName;
            description = ipAdapterAddresses.description;
            index       = ipAdapterAddresses.index;

            physicalAddress = ipAdapterAddresses.address;
            addressLength   = ipAdapterAddresses.addressLength;

            type       = ipAdapterAddresses.type;
            operStatus = ipAdapterAddresses.operStatus;
            speed      = (long)ipAdapterAddresses.receiveLinkSpeed;

            //api specific info
            ipv6Index = ipAdapterAddresses.ipv6Index;

            adapterFlags        = ipAdapterAddresses.flags;
            interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterAddresses);
        }
        internal SystemNetworkInterface(Interop.IpHlpApi.FIXED_INFO fixedInfo, Interop.IpHlpApi.IpAdapterAddresses ipAdapterAddresses)
        {
            // Store the common API information.
            _id = ipAdapterAddresses.AdapterName;
            _name = ipAdapterAddresses.friendlyName;
            _description = ipAdapterAddresses.description;
            _index = ipAdapterAddresses.index;

            _physicalAddress = ipAdapterAddresses.address;
            _addressLength = ipAdapterAddresses.addressLength;

            _type = ipAdapterAddresses.type;
            _operStatus = ipAdapterAddresses.operStatus;
            _speed = (long)ipAdapterAddresses.receiveLinkSpeed;

            // API specific info.
            _ipv6Index = ipAdapterAddresses.ipv6Index;

            _adapterFlags = ipAdapterAddresses.flags;
            _interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterAddresses);
        }
        // Vista+
        internal SystemNetworkInterface(FixedInfo fixedInfo, IpAdapterAddresses ipAdapterAddresses) {
            //store the common api information
            id = ipAdapterAddresses.AdapterName;
            name = ipAdapterAddresses.friendlyName;
            description = ipAdapterAddresses.description;
            index = ipAdapterAddresses.index;

            physicalAddress = ipAdapterAddresses.address;
            addressLength = ipAdapterAddresses.addressLength;

            type = ipAdapterAddresses.type;
            operStatus = ipAdapterAddresses.operStatus;
            speed = (long)ipAdapterAddresses.receiveLinkSpeed;

            //api specific info
            ipv6Index = ipAdapterAddresses.ipv6Index;

            adapterFlags = ipAdapterAddresses.flags;
            interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterAddresses);
        }
        internal SystemNetworkInterface(FixedInfo fixedInfo, IpAdapterInfo ipAdapterInfo)
        {
            this.id = ipAdapterInfo.adapterName;
            this.name = string.Empty;
            this.description = ipAdapterInfo.description;
            this.index = ipAdapterInfo.index;
            this.physicalAddress = ipAdapterInfo.address;
            this.addressLength = ipAdapterInfo.addressLength;
            if (ComNetOS.IsWin2K && !ComNetOS.IsPostWin2K)
            {
                this.name = this.ReadAdapterName(this.id);
            }
            if (this.name.Length == 0)
            {
                this.name = this.description;
            }
            SystemIPv4InterfaceStatistics statistics = new SystemIPv4InterfaceStatistics((long) this.index);
            this.operStatus = statistics.OperationalStatus;
            switch (ipAdapterInfo.type)
            {
                case OldInterfaceType.Ppp:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Ppp;
                    break;

                case OldInterfaceType.Loopback:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Loopback;
                    break;

                case OldInterfaceType.Slip:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Slip;
                    break;

                case OldInterfaceType.Fddi:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Fddi;
                    break;

                case OldInterfaceType.Ethernet:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Ethernet;
                    break;

                case OldInterfaceType.TokenRing:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.TokenRing;
                    break;

                default:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Unknown;
                    break;
            }
            this.interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterInfo);
        }