3.1.1.1.4.2.1 GetParentBlockIdForRange

This procedure is used to compute the appropriate IP address block that can be used to compute the IP address block that an address range specified by start IP address, end IP address, and prefix length can map onto. It takes the following input parameters.

Param_StartIPAddress: The start IP address of the address range for which the block mapping is to be computed.

Param_EndIPAddress: The end IP address of the address range for which the block mapping is to be computed.

Param_PrefixLength: The prefix length of the address range for which the block mapping is to be computed.

Param_RecordIdToExclude: This is the block record identifier to exclude from the possible list of blocks that can be used to map the address range. This is useful to get the new address block for a range when the existing address block that maps the range is to be deleted.

This procedure returns the following as output.

Result_MappingBlockRecordId: The record identifier of the block that will be a more appropriate mapping for the range information specified.

The following are the steps involved in computing this:

  1. The address family of the Param_StartIPAddress and Param_EndIPAddress, specified as parameters, determines the simple table within the ADM_IPBlocksTable compound table on which further processing steps are applied.

  2. Enumerate the list of blocks whose StartIPAddress and EndIPAddress encompasses the given Param_StartIPAddress and Param_EndIPAddress completely and which have the prefix length lesser than or equal to the given Param_PrefixLength.

  3. If the Param_RecordIdToExclude is specified and in the resulting set of rows has an entry with RecordId being the given value, exclude the same.

  4. Arrange the resulting set of address block rows in descending order of StartIPAddress, EndIPAddress and PrefixLength of the address block rows.

  5. The first row in the above resulting list will be the most appropriate block to match. Set the Result_MappingBlockRecordId to the record identifier of the appropriate block selected.

  6. If there are no rows which meet the specified conditions available, Result_MappingBlockRecordId will be set to 0.

  7. Return the Result_MappingBlockRecordId.