コード例 #1
0
ファイル: lan.gen.cs プロジェクト: rysavy-ondrej/Distance
        public override bool Equals(object obj)
        {
            AddressMapping that = obj as AddressMapping;

            return(((that != null) &&
                    object.Equals(this.IpAddr, that.IpAddr)) &&
                   object.Equals(this.EthAddr, that.EthAddr));
        }
コード例 #2
0
ファイル: lan.rules.cs プロジェクト: rysavy-ondrej/Distance
        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
            });
        }
コード例 #3
0
ファイル: lan.rules.cs プロジェクト: rysavy-ondrej/Distance
        public override void Define()
        {
            IpSourceEndpoint ipSrc   = null;
            AddressMapping   mapping = null;

            When()
            .Match(() => ipSrc)
            .Match(() => mapping, m => m.IpAddr == ipSrc.IpAddr)
            .Exists <ArpUnanswered>(x => x.Request.EthSrc == mapping.EthAddr)
            .Not <IpDestinationEndpoint>(d => ipSrc.IpAddr == d.IpAddr);
            Then()
            .Yield(_ => new IpAddressMismatch {
                IpAddress = ipSrc.IpAddr, EthAddress = mapping.EthAddr
            });
        }
コード例 #4
0
ファイル: lan.rules.cs プロジェクト: lulzzz/Distance
        public override void Define()
        {
            AddressMapping mapping = null;
            IEnumerable <AddressMapping> conflicts = null;

            When()
            .Match(() => mapping)
            .Query(() => conflicts,
                   c => c.Match <AddressMapping>(
                       m => mapping.IpAddr == m.IpAddr,
                       m => mapping.EthAddr != m.EthAddr)
                   .Collect()
                   .Where(x => x.Any()));

            Then()
            .Yield(_ => new DuplicateAddressDetected {
                IpAddress = mapping.IpAddr, EthAddresses = conflicts.Select(c => c.EthAddr).ToArray()
            });
        }