Example #1
0
        public static void TestCount()
        {
            for (int i = IPv4.BitCount; i >= 0; i--)
            {
                IPv4 addr = IPv4.NetMask(i);
                if (IPv4.GetMaskLength(addr) != i)
                {
                    throw new TestFailedException(
                              String.Format("TestCount {0}", i)
                              );
                }

                IPv4 addrDup = IPv4.Parse(addr.ToString());
                if (addrDup != addr)
                {
                    throw new TestFailedException(
                              String.Format("TestCountDup {0}", i)
                              );
                }
            }
        }
Example #2
0
 public IPv4Network(IPv4 networkAddress, IPv4 networkMask)
 {
     this.maskLength = IPv4.GetMaskLength(networkMask);
     this.ipNetwork  = networkAddress & IPv4.NetMask(this.maskLength);
 }