Kea  2.3.5-git
isc::dhcp::ClientClassDictionary Class Reference

Maintains a list of ClientClassDef's. More...

#include <client_class_def.h>

+ Inheritance diagram for isc::dhcp::ClientClassDictionary:

Public Member Functions

 ClientClassDictionary ()
 Constructor. More...
 
 ClientClassDictionary (const ClientClassDictionary &rhs)
 
 ~ClientClassDictionary ()
 Destructor. More...
 
void addClass (const std::string &name, const ExpressionPtr &match_expr, const std::string &test, bool required, bool depend_on_known, const CfgOptionPtr &options, CfgOptionDefPtr defs=CfgOptionDefPtr(), isc::data::ConstElementPtr user_context=isc::data::ConstElementPtr(), asiolink::IOAddress next_server=asiolink::IOAddress("0.0.0.0"), const std::string &sname=std::string(), const std::string &filename=std::string(), const util::Triplet< uint32_t > &valid=util::Triplet< uint32_t >(), const util::Triplet< uint32_t > &preferred=util::Triplet< uint32_t >(), bool is_template=false)
 Adds a new class to the list. More...
 
void addClass (ClientClassDefPtr &class_def)
 Adds a new class to the list. More...
 
void createOptions (const CfgOptionDefPtr &cfg_option_def)
 Iterates over the classes in the dictionary and recreates the options. More...
 
bool dependOnClass (const std::string &name, std::string &dependent_class) const
 Checks direct dependency. More...
 
bool empty () const
 Checks if the class dictionary is empty. More...
 
bool equals (const ClientClassDictionary &other) const
 Compares two ClientClassDictionary objects for equality. More...
 
ClientClassDefPtr findClass (const std::string &name) const
 Fetches the class definition for a given class name. More...
 
const ClientClassDefListPtrgetClasses () const
 Fetches the dictionary's list of classes. More...
 
void initMatchExpr (uint16_t family)
 Iterates over the classes in the dictionary and ensures that that match expressions are initialized. More...
 
bool operator!= (const ClientClassDictionary &other) const
 Inequality operator. More...
 
ClientClassDictionaryoperator= (const ClientClassDictionary &rhs)
 Copy assignment operator. More...
 
bool operator== (const ClientClassDictionary &other) const
 Equality operator. More...
 
void removeClass (const std::string &name)
 Removes a given class definition from the dictionary. More...
 
void removeClass (const uint64_t id)
 Removes a client class by id. More...
 
virtual isc::data::ElementPtr toElement () const
 Unparse a configuration object. More...
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor. More...
 

Detailed Description

Maintains a list of ClientClassDef's.

Definition at line 342 of file client_class_def.h.

Constructor & Destructor Documentation

◆ ClientClassDictionary() [1/2]

isc::dhcp::ClientClassDictionary::ClientClassDictionary ( )

Constructor.

Definition at line 320 of file client_class_def.cc.

◆ ClientClassDictionary() [2/2]

isc::dhcp::ClientClassDictionary::ClientClassDictionary ( const ClientClassDictionary rhs)

Definition at line 324 of file client_class_def.cc.

References addClass(), and isc::data::copy().

+ Here is the call graph for this function:

◆ ~ClientClassDictionary()

isc::dhcp::ClientClassDictionary::~ClientClassDictionary ( )

Destructor.

Definition at line 332 of file client_class_def.cc.

Member Function Documentation

◆ addClass() [1/2]

void isc::dhcp::ClientClassDictionary::addClass ( const std::string &  name,
const ExpressionPtr match_expr,
const std::string &  test,
bool  required,
bool  depend_on_known,
const CfgOptionPtr options,
CfgOptionDefPtr  defs = CfgOptionDefPtr(),
isc::data::ConstElementPtr  user_context = isc::data::ConstElementPtr(),
asiolink::IOAddress  next_server = asiolink::IOAddress("0.0.0.0"),
const std::string &  sname = std::string(),
const std::string &  filename = std::string(),
const util::Triplet< uint32_t > &  valid = util::Triplet<uint32_t>(),
const util::Triplet< uint32_t > &  preferred = util::Triplet<uint32_t>(),
bool  is_template = false 
)

Adds a new class to the list.

Parameters
nameName to assign to this class
match_exprExpression the class will use to determine membership
testOriginal version of match_expr
requiredOriginal value of the only if required flag
depend_on_knownUsing host so will be evaluated later
optionsCollection of options members should be given
defsOption definitions (optional)
user_contextUser context (optional)
next_servernext-server value for this class (optional)
snameserver-name value for this class (optional)
filenameboot-file-name value for this class (optional)
validvalid-lifetime triplet (optional)
preferredpreferred-lifetime triplet (optional)
Exceptions
DuplicateClientClassDefif class already exists within the dictionary. See dhcp::ClientClassDef::ClientClassDef() for others.

Definition at line 336 of file client_class_def.cc.

Referenced by ClientClassDictionary(), and operator=().

◆ addClass() [2/2]

void isc::dhcp::ClientClassDictionary::addClass ( ClientClassDefPtr class_def)

Adds a new class to the list.

Parameters
class_defpointer to class definition to add
Exceptions
DuplicateClientClassDefif class already exists within the dictionary, BadValue if the pointer is empty.

Definition at line 370 of file client_class_def.cc.

References findClass(), and isc_throw.

+ Here is the call graph for this function:

◆ createOptions()

void isc::dhcp::ClientClassDictionary::createOptions ( const CfgOptionDefPtr cfg_option_def)

Iterates over the classes in the dictionary and recreates the options.

Parameters
cfg_option_defset of option definitions to use.

Definition at line 503 of file client_class_def.cc.

Referenced by isc::dhcp::CBControlDHCPv4::databaseConfigApply(), and isc::dhcp::CBControlDHCPv6::databaseConfigApply().

◆ dependOnClass()

bool isc::dhcp::ClientClassDictionary::dependOnClass ( const std::string &  name,
std::string &  dependent_class 
) const

Checks direct dependency.

Parameters
nameThe client class name.
[out]dependent_classReference to a variable where the name of the first class depending on the checked class is set.
Returns
true if a definition depends on the class name, false if none.

Definition at line 434 of file client_class_def.cc.

◆ empty()

bool isc::dhcp::ClientClassDictionary::empty ( ) const

Checks if the class dictionary is empty.

Returns
true if there are no classes, false otherwise.

Definition at line 429 of file client_class_def.cc.

◆ equals()

bool isc::dhcp::ClientClassDictionary::equals ( const ClientClassDictionary other) const

Compares two ClientClassDictionary objects for equality.

Parameters
otherOther client class definition to compare to.
Returns
true if descriptors equal, false otherwise.

Definition at line 455 of file client_class_def.cc.

◆ findClass()

ClientClassDefPtr isc::dhcp::ClientClassDictionary::findClass ( const std::string &  name) const

Fetches the class definition for a given class name.

Parameters
namethe name of the desired class
Returns
ClientClassDefPtr to the desired class if found, or an empty pointer if not.

Definition at line 386 of file client_class_def.cc.

Referenced by addClass().

◆ getClasses()

const ClientClassDefListPtr & isc::dhcp::ClientClassDictionary::getClasses ( ) const

Fetches the dictionary's list of classes.

Returns
ClientClassDefListPtr to the list of classes

Definition at line 424 of file client_class_def.cc.

◆ initMatchExpr()

void isc::dhcp::ClientClassDictionary::initMatchExpr ( uint16_t  family)

Iterates over the classes in the dictionary and ensures that that match expressions are initialized.

Parameters
familyClass universe, e.g. AF_INET or AF_INET6.

Definition at line 477 of file client_class_def.cc.

References isc::data::Element::create(), and isc::dhcp::ExpressionParser::parse().

Referenced by isc::dhcp::CBControlDHCPv4::databaseConfigApply(), and isc::dhcp::CBControlDHCPv6::databaseConfigApply().

+ Here is the call graph for this function:

◆ operator!=()

bool isc::dhcp::ClientClassDictionary::operator!= ( const ClientClassDictionary other) const
inline

Inequality operator.

Parameters
otherOther client class dictionary to compare to.
Returns
true if the dictionaries are not equal, false otherwise.

Definition at line 465 of file client_class_def.h.

◆ operator=()

ClientClassDictionary & isc::dhcp::ClientClassDictionary::operator= ( const ClientClassDictionary rhs)

Copy assignment operator.

Parameters
rhsClient class dictionary to be copied from.
Returns
Instance copy.

Definition at line 554 of file client_class_def.cc.

References addClass(), and isc::data::copy().

+ Here is the call graph for this function:

◆ operator==()

bool isc::dhcp::ClientClassDictionary::operator== ( const ClientClassDictionary other) const
inline

Equality operator.

Parameters
otherOther client class dictionary to compare to.
Returns
true if the dictionaries are equal, false otherwise.

Definition at line 456 of file client_class_def.h.

◆ removeClass() [1/2]

void isc::dhcp::ClientClassDictionary::removeClass ( const std::string &  name)

Removes a given class definition from the dictionary.

Removes the class definition from the map if it exists, otherwise no harm, no foul.

Parameters
namethe name of the class to remove

Definition at line 396 of file client_class_def.cc.

◆ removeClass() [2/2]

void isc::dhcp::ClientClassDictionary::removeClass ( const uint64_t  id)

Removes a client class by id.

Parameters
idclass id.

Definition at line 408 of file client_class_def.cc.

◆ toElement()

ElementPtr isc::dhcp::ClientClassDictionary::toElement ( ) const
virtual

Unparse a configuration object.

Returns
a pointer to unparsed configuration

Implements isc::data::CfgToElement.

Definition at line 543 of file client_class_def.cc.

References isc::data::Element::createList().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: