The ValidateIPBlock event describes the common validation rules for an IPBlock, which can be either IPv4Block or IPv6Block. This will be used in IPBlock operations such as UpdateBlock, SaveBlock to validate the client specified IPBlock data. In the following descriptions, Param_IPBlock indicates the IPBlock to validate:
If the Param_IPBlock is IPv4Block, Param_IPBlock.PrefixLength MUST be at least 1 and no more than 30. If the Param_IPBlock is IPv6Block, Param_IPBlock.PrefixLength MUST be at least 1 and no more than 127.
The following mandatory fields MUST be specified:
Performing bitwise AND operation between NetworkId and SubnetMask MUST yield the NetworkId itself.
StartIPAddress MUST be lesser than or equal to EndIPAddress.
Compute MinimumPossibleIPAddress to be the NetworkId itself.
Compute MaximumPossibleIPAddress by performing bitwise OR operation of NetworkId and SubnetMask.
StartIPAddress and EndIPAddress MUST be within the range of MinimumPossibleIPAddress and MaximumPossibleIPAddress.
Initialize ComputedAddressCategory to be AddressCategory.None.
If the Param_IPBlock is IPv4Block, calculate ComputedAddressCategory as follows:
If the StartIPAddress and EndIPAddress completely lies within the public address space as specified in [IANA-IPV4], ComputedAddressCategory is set to AddressCategory.Public.
If the StartIPAddress and EndIPAddress completely lie within the private address space as specified in [RFC1918], ComputedAddressCategory is set to AddressCategory.Private.
If the Param_IPBlock is IPv6Block, calculate ComputedAddressCategory to be AddressCategory.GlobalIPv6Unicast if the range falls within the global unicast range as specified in [RFC4291].
The ComputedAddressCategory MUST NOT be AddressCategory.None and the ComputedAddressCategory MUST be the same as the AddressCategory in range.