2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-28 20:47:48 +00:00

[3274] ClientClass added, Classes renamed to ClientClasses

This commit is contained in:
Tomek Mrugalski 2014-02-03 19:53:14 +01:00
parent 9c9ec6cd3c
commit bc216c2cf0
8 changed files with 21 additions and 18 deletions

View File

@ -456,10 +456,10 @@ public:
} }
boost::scoped_ptr<Dhcpv4Srv> srv_; // DHCP4 server under test boost::scoped_ptr<Dhcpv4Srv> srv_; ///< DHCP4 server under test
int rcode_; // Return code from element parsing int rcode_; ///< Return code from element parsing
ConstElementPtr comment_; // Reason for parse fail ConstElementPtr comment_; ///< Reason for parse fail
isc::dhcp::Classes classify_; // used in client classification isc::dhcp::ClientClasses classify_; ///< used in client classification
}; };
// Goal of this test is a verification if a very simple config update // Goal of this test is a verification if a very simple config update

View File

@ -476,7 +476,7 @@ public:
ConstElementPtr comment_; ///< Comment (see @ref isc::config::parseAnswer) ConstElementPtr comment_; ///< Comment (see @ref isc::config::parseAnswer)
string valid_iface_; ///< Valid network interface name (present in system) string valid_iface_; ///< Valid network interface name (present in system)
string bogus_iface_; ///< invalid network interface name (not in system) string bogus_iface_; ///< invalid network interface name (not in system)
isc::dhcp::Classes classify_; ///< used in client classification isc::dhcp::ClientClasses classify_; ///< used in client classification
}; };
// Goal of this test is a verification if a very simple config update // Goal of this test is a verification if a very simple config update

View File

@ -34,8 +34,11 @@ namespace isc {
namespace dhcp { namespace dhcp {
/// Definition of a single class.
typedef std::string ClientClass;
/// Container for storing client classes /// Container for storing client classes
typedef std::set<std::string> Classes; typedef std::set<ClientClass> ClientClasses;
}; };

View File

@ -581,7 +581,7 @@ public:
/// existing classes. Having it public also solves the problem of returned /// existing classes. Having it public also solves the problem of returned
/// reference lifetime. It is preferred to use @ref inClass and @ref addClass /// reference lifetime. It is preferred to use @ref inClass and @ref addClass
/// should be used to operate on this field. /// should be used to operate on this field.
Classes classes_; ClientClasses classes_;
private: private:

View File

@ -455,7 +455,7 @@ public:
/// ///
/// This field is public, so code can iterate over existing classes. /// This field is public, so code can iterate over existing classes.
/// Having it public also solves the problem of returned reference lifetime. /// Having it public also solves the problem of returned reference lifetime.
Classes classes_; ClientClasses classes_;
protected: protected:
/// Builds on wire packet for TCP transmission. /// Builds on wire packet for TCP transmission.

View File

@ -123,7 +123,7 @@ CfgMgr::getOptionDef(const std::string& option_space,
Subnet6Ptr Subnet6Ptr
CfgMgr::getSubnet6(const std::string& iface, CfgMgr::getSubnet6(const std::string& iface,
const isc::dhcp::Classes& /*classes*/) { const isc::dhcp::ClientClasses& /*classes*/) {
if (!iface.length()) { if (!iface.length()) {
return (Subnet6Ptr()); return (Subnet6Ptr());
@ -144,7 +144,7 @@ CfgMgr::getSubnet6(const std::string& iface,
Subnet6Ptr Subnet6Ptr
CfgMgr::getSubnet6(const isc::asiolink::IOAddress& hint, CfgMgr::getSubnet6(const isc::asiolink::IOAddress& hint,
const isc::dhcp::Classes& /*classes*/) { const isc::dhcp::ClientClasses& /*classes*/) {
// If there's only one subnet configured, let's just use it // If there's only one subnet configured, let's just use it
// The idea is to keep small deployments easy. In a small network - one // The idea is to keep small deployments easy. In a small network - one
@ -180,7 +180,7 @@ CfgMgr::getSubnet6(const isc::asiolink::IOAddress& hint,
} }
Subnet6Ptr CfgMgr::getSubnet6(OptionPtr iface_id_option, Subnet6Ptr CfgMgr::getSubnet6(OptionPtr iface_id_option,
const isc::dhcp::Classes& /*classes*/) { const isc::dhcp::ClientClasses& /*classes*/) {
if (!iface_id_option) { if (!iface_id_option) {
return (Subnet6Ptr()); return (Subnet6Ptr());
} }
@ -211,7 +211,7 @@ void CfgMgr::addSubnet6(const Subnet6Ptr& subnet) {
Subnet4Ptr Subnet4Ptr
CfgMgr::getSubnet4(const isc::asiolink::IOAddress& hint, CfgMgr::getSubnet4(const isc::asiolink::IOAddress& hint,
const isc::dhcp::Classes& /*classes*/) { const isc::dhcp::ClientClasses& /*classes*/) {
// If there's only one subnet configured, let's just use it // If there's only one subnet configured, let's just use it
// The idea is to keep small deployments easy. In a small network - one // The idea is to keep small deployments easy. In a small network - one

View File

@ -170,7 +170,7 @@ public:
/// ///
/// @return a subnet object (or NULL if no suitable match was fount) /// @return a subnet object (or NULL if no suitable match was fount)
Subnet6Ptr getSubnet6(const isc::asiolink::IOAddress& hint, Subnet6Ptr getSubnet6(const isc::asiolink::IOAddress& hint,
const isc::dhcp::Classes& classes); const isc::dhcp::ClientClasses& classes);
/// @brief get IPv6 subnet by interface name /// @brief get IPv6 subnet by interface name
/// ///
@ -180,7 +180,7 @@ public:
/// @param iface_name interface name /// @param iface_name interface name
/// @return a subnet object (or NULL if no suitable match was fount) /// @return a subnet object (or NULL if no suitable match was fount)
Subnet6Ptr getSubnet6(const std::string& iface_name, Subnet6Ptr getSubnet6(const std::string& iface_name,
const isc::dhcp::Classes& classes); const isc::dhcp::ClientClasses& classes);
/// @brief get IPv6 subnet by interface-id /// @brief get IPv6 subnet by interface-id
/// ///
@ -190,7 +190,7 @@ public:
/// ///
/// @return a subnet object /// @return a subnet object
Subnet6Ptr getSubnet6(OptionPtr interface_id, Subnet6Ptr getSubnet6(OptionPtr interface_id,
const isc::dhcp::Classes& classes); const isc::dhcp::ClientClasses& classes);
/// @brief adds an IPv6 subnet /// @brief adds an IPv6 subnet
/// ///
@ -249,7 +249,7 @@ public:
/// ///
/// @return a subnet object /// @return a subnet object
Subnet4Ptr getSubnet4(const isc::asiolink::IOAddress& hint, Subnet4Ptr getSubnet4(const isc::asiolink::IOAddress& hint,
const isc::dhcp::Classes& classes); const isc::dhcp::ClientClasses& classes);
/// @brief adds a subnet4 /// @brief adds a subnet4
void addSubnet4(const Subnet4Ptr& subnet); void addSubnet4(const Subnet4Ptr& subnet);

View File

@ -186,7 +186,7 @@ public:
} }
/// used in client classification (or just empty container for other tests) /// used in client classification (or just empty container for other tests)
isc::dhcp::Classes classify_; isc::dhcp::ClientClasses classify_;
}; };
// This test verifies that multiple option definitions can be added // This test verifies that multiple option definitions can be added
@ -352,7 +352,7 @@ TEST_F(CfgMgrTest, addOptionDefNegative) {
} }
// This test verifies if the configuration manager is able to hold and return // This test verifies if the configuration manager is able to hold and return
// valid leases // valid subnets.
TEST_F(CfgMgrTest, subnet4) { TEST_F(CfgMgrTest, subnet4) {
CfgMgr& cfg_mgr = CfgMgr::instance(); CfgMgr& cfg_mgr = CfgMgr::instance();