예제 #1
0
        public unsafe override UnicastIPAddressInformationCollection GetUnicastAddresses()
        {
            UnicastIPAddressInformationCollection collection = new UnicastIPAddressInformationCollection();

            Interop.Sys.EnumerateInterfaceAddresses(
                (name, ipAddressInfo) =>
            {
                IPAddress ipAddress = IPAddressUtil.GetIPAddressFromNativeInfo(ipAddressInfo);
                if (!IPAddressUtil.IsMulticast(ipAddress))
                {
                    collection.InternalAdd(new UnixUnicastIPAddressInformation(ipAddress, ipAddressInfo->PrefixLength));
                }
            },
                (name, ipAddressInfo, scopeId) =>
            {
                IPAddress ipAddress = IPAddressUtil.GetIPAddressFromNativeInfo(ipAddressInfo);
                if (!IPAddressUtil.IsMulticast(ipAddress))
                {
                    collection.InternalAdd(new UnixUnicastIPAddressInformation(ipAddress, ipAddressInfo->PrefixLength));
                }
            },
                // Ignore link-layer addresses that are discovered; don't create a callback.
                null);

            return(collection);
        }
예제 #2
0
        protected unsafe void ProcessIpv6Address(Interop.Sys.IpAddressInfo *addressInfo, uint scopeId)
        {
            IPAddress address = IPAddressUtil.GetIPAddressFromNativeInfo(addressInfo);

            AddAddress(address);
            _ipv6ScopeId = scopeId;
        }
예제 #3
0
        protected unsafe void ProcessIpv4Address(Interop.Sys.IpAddressInfo *addressInfo)
        {
            IPAddress ipAddress = IPAddressUtil.GetIPAddressFromNativeInfo(addressInfo);

            AddAddress(ipAddress, addressInfo->PrefixLength);
            _index = addressInfo->InterfaceIndex;
        }
        private unsafe UnicastIPAddressInformationCollection GetUnicastAddresses()
        {
            UnicastIPAddressInformationCollection collection = new UnicastIPAddressInformationCollection();

            Interop.Sys.EnumerateInterfaceAddresses(
                (name, ipAddressInfo, netmaskInfo) =>
            {
                IPAddress ipAddress = IPAddressUtil.GetIPAddressFromNativeInfo(ipAddressInfo);
                if (!IPAddressUtil.IsMulticast(ipAddress))
                {
                    IPAddress netMaskAddress = IPAddressUtil.GetIPAddressFromNativeInfo(netmaskInfo);
                    collection.InternalAdd(new UnixUnicastIPAddressInformation(ipAddress, netMaskAddress));
                }
            },
                (name, ipAddressInfo, scopeId) =>
            {
                IPAddress ipAddress = IPAddressUtil.GetIPAddressFromNativeInfo(ipAddressInfo);
                if (!IPAddressUtil.IsMulticast(ipAddress))
                {
                    collection.InternalAdd(new UnixUnicastIPAddressInformation(ipAddress, IPAddress.Any));
                }
            },
                // Ignore link-layer addresses that are discovered; don't create a callback.
                null);

            return(collection);
        }
예제 #5
0
        protected unsafe void ProcessIpv4Address(Interop.Sys.IpAddressInfo *addressInfo, Interop.Sys.IpAddressInfo *netMask)
        {
            IPAddress ipAddress      = IPAddressUtil.GetIPAddressFromNativeInfo(addressInfo);
            IPAddress netMaskAddress = IPAddressUtil.GetIPAddressFromNativeInfo(netMask);

            AddAddress(ipAddress);
            _netMasks[ipAddress] = netMaskAddress;
        }
예제 #6
0
        protected static unsafe void ProcessIpv6Address(UnixNetworkInterface uni,
                                                        Interop.Sys.IpAddressInfo *addressInfo,
                                                        uint scopeId)
        {
            IPAddress address = IPAddressUtil.GetIPAddressFromNativeInfo(addressInfo);

            uni.AddAddress(address);
            uni._ipv6ScopeId = scopeId;
        }
예제 #7
0
        protected unsafe void ProcessIpv6Address(Interop.Sys.IpAddressInfo *addressInfo, uint scopeId)
        {
            IPAddress address = IPAddressUtil.GetIPAddressFromNativeInfo(addressInfo);

            address.ScopeId = scopeId;
            AddAddress(address, addressInfo->PrefixLength);
            _ipv6ScopeId = scopeId;
            _index       = addressInfo->InterfaceIndex;
        }
예제 #8
0
        protected static unsafe void ProcessIpv4Address(UnixNetworkInterface uni,
                                                        Interop.Sys.IpAddressInfo *addressInfo,
                                                        Interop.Sys.IpAddressInfo *netMask)
        {
            IPAddress ipAddress      = IPAddressUtil.GetIPAddressFromNativeInfo(addressInfo);
            IPAddress netMaskAddress = IPAddressUtil.GetIPAddressFromNativeInfo(netMask);

            uni.AddAddress(ipAddress);
            uni._netMasks[ipAddress] = netMaskAddress;
        }