Пример #1
0
        public override void Define()
        {
            IpSourceEndpoint ipSrc   = null;
            AddressMapping   mapping = null;

            When()
            .Match(() => ipSrc, x => LanRulesHelper.IsLinkLocal(x.IpAddr))
            .Match(() => mapping, m => m.IpAddr == ipSrc.IpAddr);
            Then()
            .Yield(_ => new LinkLocalIpAddressUse {
                IpAddress = ipSrc.IpAddr, EthAddress = mapping.EthAddr
            });
        }
Пример #2
0
        public override void Define()
        {
            LocalNetworkPrefix localNetworkPrefix = null;
            IGrouping <AddressScope, AddressMapping> addressClass = null;

            When()
            .Match(() => localNetworkPrefix)
            .Query(() => addressClass, q => q
                   .Match <AddressMapping>()
                   .GroupBy(m => LanRulesHelper.GetAddressScope(m.IpAddr, localNetworkPrefix)));
            Then()
            .Do(ctx => ctx.Info($"{addressClass.Key} hosts: {StringUtils.ToString(addressClass.ToArray())}"));
        }
Пример #3
0
        bool IsLocalOrMulticast(string ipAddr, LocalNetworkPrefix localNetworkPrefix)
        {
            var scope = LanRulesHelper.GetAddressScope(ipAddr, localNetworkPrefix);

            return(scope != AddressScope.RemoteAddress);
        }