コード例 #1
0
        // This constructor is for Vista and newer
        internal SystemIPInterfaceProperties(FixedInfo fixedInfo, IpAdapterAddresses ipAdapterAddresses) {
            adapterFlags = ipAdapterAddresses.flags;
            dnsSuffix = ipAdapterAddresses.dnsSuffix;
            dnsEnabled = fixedInfo.EnableDns;
            dynamicDnsEnabled = ((ipAdapterAddresses.flags & AdapterFlags.DnsEnabled) > 0);

            multicastAddresses = SystemMulticastIPAddressInformation.ToMulticastIpAddressInformationCollection(
                IpAdapterAddress.MarshalIpAddressInformationCollection(ipAdapterAddresses.firstMulticastAddress));
            dnsAddresses = IpAdapterAddress.MarshalIpAddressCollection(ipAdapterAddresses.firstDnsServerAddress);
            anycastAddresses = IpAdapterAddress.MarshalIpAddressInformationCollection(
                ipAdapterAddresses.firstAnycastAddress);
            unicastAddresses = SystemUnicastIPAddressInformation.MarshalUnicastIpAddressInformationCollection(
                ipAdapterAddresses.firstUnicastAddress);
            winsServersAddresses = IpAdapterAddress.MarshalIpAddressCollection(
                ipAdapterAddresses.firstWinsServerAddress);
            gatewayAddresses = SystemGatewayIPAddressInformation.ToGatewayIpAddressInformationCollection(
                IpAdapterAddress.MarshalIpAddressCollection(ipAdapterAddresses.firstGatewayAddress));

            dhcpServers = new IPAddressCollection();
            if (ipAdapterAddresses.dhcpv4Server.address != IntPtr.Zero)
                dhcpServers.InternalAdd(ipAdapterAddresses.dhcpv4Server.MarshalIPAddress());
            if (ipAdapterAddresses.dhcpv6Server.address != IntPtr.Zero)
                dhcpServers.InternalAdd(ipAdapterAddresses.dhcpv6Server.MarshalIPAddress());

            if ((adapterFlags & AdapterFlags.IPv4Enabled) != 0) {
                ipv4Properties = new SystemIPv4InterfaceProperties(fixedInfo, ipAdapterAddresses);
            }

            if ((adapterFlags & AdapterFlags.IPv6Enabled) != 0) {
                ipv6Properties = new SystemIPv6InterfaceProperties(ipAdapterAddresses.ipv6Index, 
                    ipAdapterAddresses.mtu, ipAdapterAddresses.zoneIndices);
            }
        }
 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 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);
     }
 }
コード例 #4
0
 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);
 }
コード例 #6
0
 public AdapterDescription1(string description, uint vendorID, uint deviceID, uint subSystemID, uint revision, UIntPtr dedicatedVideoMemory, UIntPtr dedicatedSystemMemory, UIntPtr sharedSystemMemory, long adapterLuid, AdapterFlags flags)
 {
     Validate.IsNotNull <string>(description, "description");
     if (description.Length >= 0x80)
     {
         ExceptionUtil.ThrowArgumentException("description.Length must be less than 128", "description");
     }
     this.description           = description;
     this.vendorID              = vendorID;
     this.deviceID              = deviceID;
     this.subSysID              = subSystemID;
     this.revision              = revision;
     this.dedicatedVideoMemory  = dedicatedVideoMemory;
     this.dedicatedSystemMemory = dedicatedSystemMemory;
     this.sharedSystemMemory    = sharedSystemMemory;
     this.adapterLuid           = adapterLuid;
     this.flags = flags;
 }
コード例 #7
0
        // 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);
        }
コード例 #8
0
        // This constructor is for Vista and newer
        internal SystemIPInterfaceProperties(FixedInfo fixedInfo, IpAdapterAddresses ipAdapterAddresses)
        {
            adapterFlags      = ipAdapterAddresses.flags;
            dnsSuffix         = ipAdapterAddresses.dnsSuffix;
            dnsEnabled        = fixedInfo.EnableDns;
            dynamicDnsEnabled = ((ipAdapterAddresses.flags & AdapterFlags.DnsEnabled) > 0);

            multicastAddresses = SystemMulticastIPAddressInformation.ToMulticastIpAddressInformationCollection(
                IpAdapterAddress.MarshalIpAddressInformationCollection(ipAdapterAddresses.firstMulticastAddress));
            dnsAddresses     = IpAdapterAddress.MarshalIpAddressCollection(ipAdapterAddresses.firstDnsServerAddress);
            anycastAddresses = IpAdapterAddress.MarshalIpAddressInformationCollection(
                ipAdapterAddresses.firstAnycastAddress);
            unicastAddresses = SystemUnicastIPAddressInformation.MarshalUnicastIpAddressInformationCollection(
                ipAdapterAddresses.firstUnicastAddress);
            winsServersAddresses = IpAdapterAddress.MarshalIpAddressCollection(
                ipAdapterAddresses.firstWinsServerAddress);
            gatewayAddresses = SystemGatewayIPAddressInformation.ToGatewayIpAddressInformationCollection(
                IpAdapterAddress.MarshalIpAddressCollection(ipAdapterAddresses.firstGatewayAddress));

            dhcpServers = new IPAddressCollection();
            if (ipAdapterAddresses.dhcpv4Server.address != IntPtr.Zero)
            {
                dhcpServers.InternalAdd(ipAdapterAddresses.dhcpv4Server.MarshalIPAddress());
            }
            if (ipAdapterAddresses.dhcpv6Server.address != IntPtr.Zero)
            {
                dhcpServers.InternalAdd(ipAdapterAddresses.dhcpv6Server.MarshalIPAddress());
            }

            if ((adapterFlags & AdapterFlags.IPv4Enabled) != 0)
            {
                ipv4Properties = new SystemIPv4InterfaceProperties(fixedInfo, ipAdapterAddresses);
            }

            if ((adapterFlags & AdapterFlags.IPv6Enabled) != 0)
            {
                ipv6Properties = new SystemIPv6InterfaceProperties(ipAdapterAddresses.ipv6Index,
                                                                   ipAdapterAddresses.mtu, ipAdapterAddresses.zoneIndices);
            }
        }
コード例 #9
0
            public static SerializeAdapter GetURLAdapter(string url, SerializeAction action = SerializeAction.INPUT, AdapterFlags flags = AdapterFlags.DEFAULT, string password = "")
            {
                SerializeAdapter adapter = new SerializeAdapter(SerializeAdapter_getURLAdapter(url, action, flags, password));

                return(adapter);
            }
コード例 #10
0
 private static extern IntPtr SerializeAdapter_getURLAdapter(string url, SerializeAction action, AdapterFlags flags, string password);
コード例 #11
0
        // 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);
        }
コード例 #12
0
 private static extern IntPtr DbManager_loadDB(string url, string extension, AdapterFlags flags, UInt32 version, string password, IntPtr associatedData);
コード例 #13
0
 static public Node LoadDB(string url, string extension = "", AdapterFlags flags = 0, UInt32 version = 0, string password = "", Reference associatedData = null)
 {
     return(Reference.CreateObject((DbManager_loadDB(url, extension, flags, version, password, associatedData?.GetNativeReference() ?? IntPtr.Zero))) as Node);
 }