}
}
-ConstSubnet4Ptr
-CfgSubnets4::getBySubnetId(const SubnetID& subnet_id) const {
- auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
- auto subnet_it = index.find(subnet_id);
- return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet4Ptr());
-}
-
ConstSubnet4Ptr
CfgSubnets4::getByPrefix(const std::string& subnet_text) const {
auto const& index = subnets_.get<SubnetPrefixIndexTag>();
}
Subnet4Ptr
-CfgSubnets4::getSubnet(const SubnetID id) const {
- /// @todo: Once this code is migrated to multi-index container, use
- /// an index rather than full scan.
- for (auto const& subnet : subnets_) {
- if (subnet->getID() == id) {
- return (subnet);
- }
- }
- return (Subnet4Ptr());
+CfgSubnets4::getSubnet(const SubnetID subnet_id) const {
+ auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
+ auto subnet_it = index.find(subnet_id);
+ return ((subnet_it != index.cend()) ? (*subnet_it) : Subnet4Ptr());
}
Subnet4Ptr
///
/// @return Pointer to the @c Subnet4 object or null pointer if such
/// subnet doesn't exist.
- ConstSubnet4Ptr getBySubnetId(const SubnetID& subnet_id) const;
+ ConstSubnet4Ptr getBySubnetId(const SubnetID& subnet_id) const {
+ return (getSubnet(subnet_id));
+ }
/// @brief Returns const pointer to a subnet which matches the specified
/// prefix in the canonical form.
/// @brief Returns subnet with specified subnet-id value
///
- /// Warning: this method uses full scan. Its use is not recommended for
- /// packet processing.
/// Please use @ref getBySubnetId instead when possible.
///
- /// @return Subnet (or NULL)
+ /// @return Subnet (or null)
Subnet4Ptr getSubnet(const SubnetID id) const;
/// @brief Returns a pointer to a subnet if provided address is in its range.
}
}
-ConstSubnet6Ptr
-CfgSubnets6::getBySubnetId(const SubnetID& subnet_id) const {
- auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
- auto subnet_it = index.find(subnet_id);
- return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet6Ptr());
-}
-
ConstSubnet6Ptr
CfgSubnets6::getByPrefix(const std::string& subnet_text) const {
auto const& index = subnets_.get<SubnetPrefixIndexTag>();
}
Subnet6Ptr
-CfgSubnets6::getSubnet(const SubnetID id) const {
- /// @todo: Once this code is migrated to multi-index container, use
- /// an index rather than full scan.
- for (auto const& subnet : subnets_) {
- if (subnet->getID() == id) {
- return (subnet);
- }
- }
- return (Subnet6Ptr());
+CfgSubnets6::getSubnet(const SubnetID subnet_id) const {
+ auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
+ auto subnet_it = index.find(subnet_id);
+ return ((subnet_it != index.cend()) ? (*subnet_it) : Subnet6Ptr());
}
SubnetIDSet
///
/// @return Pointer to the @c Subnet6 object or null pointer if such
/// subnet doesn't exist.
- ConstSubnet6Ptr getBySubnetId(const SubnetID& subnet_id) const;
+ ConstSubnet6Ptr getBySubnetId(const SubnetID& subnet_id) const {
+ return (getSubnet(subnet_id));
+ }
/// @brief Returns const pointer to a subnet which matches the specified
/// prefix in the canonical form.
/// @brief Returns subnet with specified subnet-id value
///
- /// Warning: this method uses full scan. Its use is not recommended for
- /// packet processing.
/// Please use @ref getBySubnetId instead when possible.
///
- /// @return Subnet (or NULL)
+ /// @return Subnet (or null)
Subnet6Ptr getSubnet(const SubnetID id) const;
/// @brief Selects the subnet using a specified address.