3.1.1.1.34.2.2 GetSubnetByNetworkIdAndAddressSpace
The GetSubnetByNetworkIdAndAddressSpace procedure can be used to retrieve the IP subnet information on the basis of given NetworkId and AddressSpace in the form of either IPv4Subnet or IPv6Subnet, based on whether it is being invoked against the IPv4- or IPv6-specific table.
The following are the input parameters to this procedure:
Param_NetworkId: This is of type IPAddress.
Param_PrefixLength: This is a signed integer.
Param_AddressSpaceRecordId: This is a signed 64-bit integer.
The following is the output parameter from this procedure.
Result_Subnet: This is of type IPSubnet, specified in section 2.2.4.314.
The following steps are the processing done by this procedure against the data store:
Calculate the StartIP and EndIP based on the Param_NetworkId and Param_PrefixLength.
Look-up the row in ADM_IPBlocksTable that has the same StartIP, EndIP, PrefixLength, and AddressSpaceRecordId equal to Param_AddressSpaceRecordId and Is_Subnet is set to 1. If the row is not present, set the result to NULL and return.
If the row is present in ADM_IPBlocksTable, call the GetSubnetById procedure of ADM_SubnetTable passing RecordId as Param_SubnetId and Param_addressFamily set appropriately based on Param_NetworkId representing an InterNetwork or InterNetworkV6 address.
Return the Result_Subnet from the procedure.