Ejemplo n.º 1
0
		public V4NetworkCalculator(IPAddress inputIp, IPAddress inputMask)
		{
			Bin.InputIp = inputIp.GetAddressBytes();
			Bin.InputMask = inputMask.GetAddressBytes();

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

			Result.Cidr = BitsSet(Bin.InputMask);
			Result.NetworkBits = Result.ClassDescription.Cidr;
			Result.SubnetBits = (Byte) (Result.Cidr - Result.NetworkBits);
			Result.HostBits = (Byte) (32 - Result.Cidr);

			Result.TotalHosts = Convert.ToUInt64(Math.Pow(2, Result.HostBits) - 2);
			Result.TotalSubnets = Convert.ToUInt64(Math.Pow(2, Result.SubnetBits));
		}