Example #1
0
        public Boolean IsIPAdressANetworkAddress(IPv4Address address)
        {
            Byte[]  andResult   = ByteHelper.AndArray(_maskAsByte, address.GetBytes());
            Boolean equalResult = ByteHelper.AreEqual(andResult, address.GetBytes());

            return(equalResult);
        }
Example #2
0
 public bool Equals(DUID other)
 {
     if (other is null == true)
     {
         return(false);
     }
     return(ByteHelper.AreEqual(this.Value, other.Value));
 }
Example #3
0
        public bool Equals(IPv4SubnetMask other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(ByteHelper.AreEqual(this._maskAsByte, other._maskAsByte));
        }
Example #4
0
        public Int32 GetSlashNotation()
        {
            foreach (var item in _possibleSubnetMasks)
            {
                if (ByteHelper.AreEqual(item.Value, _maskAsByte) == false)
                {
                    continue;
                }

                return(item.Key);
            }

            return(-1);
        }
Example #5
0
        public IPv4Route(IPv4Address network, IPv4SubnetMask subnetMask)
        {
            Byte[] networkBytes = network.GetBytes();

            Byte[]  and    = ByteHelper.AndArray(subnetMask.GetBytes(), networkBytes);
            Boolean result = ByteHelper.AreEqual(networkBytes, and);

            if (result == false)
            {
                throw new ArgumentException();
            }

            Network    = network;
            SubnetMask = subnetMask;
        }