Пример #1
0
		public V6NetworkCalculator(IPAddress inputIp, IPAddress inputMask)
		{
			Bin.InputIp = inputIp.GetAddressBytes();
			Bin.InputMask = inputMask.GetAddressBytes();

			Result.Class = inputIp.Getv6Class();
			Result.ClassDescription = Result.Class.GetDescription();

			Result.Cidr = BitsSet(inputMask);
			Result.NetworkBits = Result.ClassDescription.Cidr;
			Result.SubnetBits = (Byte) (Result.Cidr - Result.NetworkBits);
			Result.HostBits = (Byte) (128 - Result.Cidr);

			if (Result.HostBits < 50)
				Result.TotalHosts = Convert.ToUInt64(Math.Pow(2, Result.HostBits) - 1);
			else
				Result.TotalHosts = 0;


			if (Result.SubnetBits < 50)
				Result.TotalSubnets = Convert.ToUInt64(Math.Pow(2, Result.SubnetBits));
			else
				Result.TotalSubnets = 0;
		}