Kea 2.5.8
isc::dhcp::ClientClassDef Class Reference

Embodies a single client class definition. More...

#include <client_class_def.h>

+ Inheritance diagram for isc::dhcp::ClientClassDef:

Public Member Functions

 ClientClassDef (const ClientClassDef &rhs)
 Copy constructor.
 
 ClientClassDef (const std::string &name, const ExpressionPtr &match_expr, const CfgOptionPtr &options=CfgOptionPtr())
 Constructor.
 
virtual ~ClientClassDef ()
 Destructor.
 
bool dependOnClass (const std::string &name) const
 Checks direct dependency.
 
bool equals (const ClientClassDef &other) const
 Compares two ClientClassDef objects for equality.
 
const CfgOptionPtrgetCfgOption () const
 Fetches the class's option collection.
 
const CfgOptionDefPtrgetCfgOptionDef () const
 Fetches the class's option definitions.
 
bool getDependOnKnown () const
 Fetches the depend on known flag aka use host flag.
 
const std::string & getFilename () const
 returns boot-file-name value
 
const ExpressionPtrgetMatchExpr () const
 Fetches the class's match expression.
 
std::string getName () const
 Fetches the class's name.
 
const asiolink::IOAddressgetNextServer () const
 returns next-server value
 
util::Optional< uint32_t > getOfferLft () const
 Returns offer lifetime for the class.
 
util::Triplet< uint32_t > getPreferred () const
 Return preferred-lifetime value.
 
bool getRequired () const
 Fetches the only if required flag.
 
const std::string & getSname () const
 returns server-hostname value
 
std::string getTest () const
 Fetches the class's original match expression.
 
util::Triplet< uint32_t > getValid () const
 Return valid-lifetime value.
 
bool operator!= (const ClientClassDef &other) const
 Inequality operator.
 
bool operator== (const ClientClassDef &other) const
 Equality operator.
 
void setCfgOption (const CfgOptionPtr &cfg_option)
 Sets the class's option collection.
 
void setCfgOptionDef (const CfgOptionDefPtr &cfg_option_def)
 Sets the class's option definition collection.
 
void setDependOnKnown (bool depend_on_known)
 Sets the depend on known flag aka use host flag.
 
void setFilename (const std::string &filename)
 sets the boot-file-name value
 
void setMatchExpr (const ExpressionPtr &match_expr)
 Sets the class's match expression.
 
void setName (const std::string &name)
 Sets the class's name.
 
void setNextServer (const asiolink::IOAddress &addr)
 sets the next-server value
 
void setOfferLft (const util::Optional< uint32_t > &offer_lft)
 Sets offer lifetime for the class.
 
void setPreferred (const util::Triplet< uint32_t > &preferred)
 Sets new preferred lifetime.
 
void setRequired (bool required)
 Sets the only if required flag.
 
void setSname (const std::string &sname)
 sets the server-name value
 
void setTest (const std::string &test)
 Sets the class's original match expression.
 
void setValid (const util::Triplet< uint32_t > &valid)
 Sets new valid lifetime.
 
virtual void test (PktPtr pkt, const ExpressionPtr &expr_ptr)
 Test method which checks if the packet belongs to the class.
 
virtual isc::data::ElementPtr toElement () const
 Unparse a configuration object.
 
- Public Member Functions inherited from isc::data::UserContext
void contextToElement (data::ElementPtr map) const
 Merge unparse a user_context object.
 
data::ConstElementPtr getContext () const
 Returns const pointer to the user context.
 
void setContext (const data::ConstElementPtr &ctx)
 Sets user context.
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor.
 
virtual isc::data::ElementPtr toElement () const =0
 Unparse a configuration object.
 
- Public Member Functions inherited from isc::data::StampedElement
 StampedElement ()
 Constructor.
 
void delServerTag (const std::string &server_tag)
 Deletes server tag.
 
isc::data::ElementPtr getMetadata () const
 Returns an object representing metadata to be returned with objects from the configuration backend.
 
std::set< ServerTaggetServerTags () const
 Returns server tags.
 
bool hasAllServerTag () const
 Checks if the element has 'all' server tag.
 
bool hasServerTag (const ServerTag &server_tag) const
 Checks if the element has the given server tag.
 
void setServerTag (const std::string &server_tag)
 Adds new server tag.
 
- Public Member Functions inherited from isc::data::BaseStampedElement
 BaseStampedElement ()
 Constructor.
 
uint64_t getId () const
 Returns element's database identifier.
 
boost::posix_time::ptime getModificationTime () const
 Returns timestamp.
 
void setId (const uint64_t id)
 Sets element's database identifier.
 
void setModificationTime (const boost::posix_time::ptime &timestamp)
 Sets timestamp to the explicitly provided value.
 
void updateModificationTime ()
 Sets timestamp to the current time.
 

Friends

std::ostream & operator<< (std::ostream &os, const ClientClassDef &x)
 Provides a convenient text representation of the class.
 

Additional Inherited Members

- Static Public Member Functions inherited from isc::data::UserContext
static data::ElementPtr toElement (data::ConstElementPtr map)
 Copy an Element map.
 
- Protected Attributes inherited from isc::data::UserContext
data::ConstElementPtr user_context_
 Pointer to the user context (may be NULL)
 
- Protected Attributes inherited from isc::data::BaseStampedElement
uint64_t id_
 Database identifier of the configuration element.
 
boost::posix_time::ptime timestamp_
 Holds timestamp value.
 

Detailed Description

Embodies a single client class definition.

Definition at line 49 of file client_class_def.h.

Constructor & Destructor Documentation

◆ ClientClassDef() [1/2]

isc::dhcp::ClientClassDef::ClientClassDef ( const std::string &  name,
const ExpressionPtr match_expr,
const CfgOptionPtr options = CfgOptionPtr() 
)

Constructor.

Parameters
nameName to assign to this class
match_exprExpression the class will use to determine membership
optionsCollection of options members should be given

Definition at line 26 of file client_class_def.cc.

References isc_throw.

◆ ClientClassDef() [2/2]

isc::dhcp::ClientClassDef::ClientClassDef ( const ClientClassDef rhs)

Copy constructor.

Definition at line 47 of file client_class_def.cc.

◆ ~ClientClassDef()

isc::dhcp::ClientClassDef::~ClientClassDef ( )
virtual

Destructor.

Definition at line 70 of file client_class_def.cc.

Member Function Documentation

◆ dependOnClass()

bool isc::dhcp::ClientClassDef::dependOnClass ( const std::string &  name) const

Checks direct dependency.

Parameters
nameThe client class name.
Returns
true if the definition depends on the class name, false if not.

Definition at line 215 of file client_class_def.cc.

References isc::dhcp::dependOnClass().

+ Here is the call graph for this function:

◆ equals()

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

Compares two ClientClassDef objects for equality.

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

Definition at line 220 of file client_class_def.cc.

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

◆ getCfgOption()

const CfgOptionPtr & isc::dhcp::ClientClassDef::getCfgOption ( ) const

Fetches the class's option collection.

Definition at line 134 of file client_class_def.cc.

◆ getCfgOptionDef()

const CfgOptionDefPtr & isc::dhcp::ClientClassDef::getCfgOptionDef ( ) const

Fetches the class's option definitions.

Definition at line 124 of file client_class_def.cc.

◆ getDependOnKnown()

bool isc::dhcp::ClientClassDef::getDependOnKnown ( ) const

Fetches the depend on known flag aka use host flag.

Definition at line 114 of file client_class_def.cc.

◆ getFilename()

const std::string & isc::dhcp::ClientClassDef::getFilename ( ) const
inline

returns boot-file-name value

Returns
the vector that contains boot-file-name (may be empty if not defined)

Definition at line 193 of file client_class_def.h.

◆ getMatchExpr()

const ExpressionPtr & isc::dhcp::ClientClassDef::getMatchExpr ( ) const

Fetches the class's match expression.

Definition at line 84 of file client_class_def.cc.

◆ getName()

std::string isc::dhcp::ClientClassDef::getName ( ) const

Fetches the class's name.

Definition at line 74 of file client_class_def.cc.

Referenced by test(), and isc::dhcp::TemplateClientClassDef::test().

◆ getNextServer()

const asiolink::IOAddress & isc::dhcp::ClientClassDef::getNextServer ( ) const
inline

returns next-server value

Returns
next-server value

Definition at line 160 of file client_class_def.h.

◆ getOfferLft()

util::Optional< uint32_t > isc::dhcp::ClientClassDef::getOfferLft ( ) const
inline

Returns offer lifetime for the class.

Returns
offer lifetime value

Definition at line 235 of file client_class_def.h.

◆ getPreferred()

util::Triplet< uint32_t > isc::dhcp::ClientClassDef::getPreferred ( ) const
inline

Return preferred-lifetime value.

Returns
a triplet containing the preferred lifetime.

Definition at line 214 of file client_class_def.h.

◆ getRequired()

bool isc::dhcp::ClientClassDef::getRequired ( ) const

Fetches the only if required flag.

Definition at line 104 of file client_class_def.cc.

◆ getSname()

const std::string & isc::dhcp::ClientClassDef::getSname ( ) const
inline

returns server-hostname value

Returns
the vector that contains server-hostname (may be empty if not defined)

Definition at line 180 of file client_class_def.h.

◆ getTest()

std::string isc::dhcp::ClientClassDef::getTest ( ) const

Fetches the class's original match expression.

Definition at line 94 of file client_class_def.cc.

◆ getValid()

util::Triplet< uint32_t > isc::dhcp::ClientClassDef::getValid ( ) const
inline

Return valid-lifetime value.

Returns
a triplet containing the valid lifetime.

Definition at line 200 of file client_class_def.h.

◆ operator!=()

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

Inequality operator.

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

Definition at line 151 of file client_class_def.h.

References equals().

+ Here is the call graph for this function:

◆ operator==()

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

Equality operator.

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

Definition at line 142 of file client_class_def.h.

References equals().

+ Here is the call graph for this function:

◆ setCfgOption()

void isc::dhcp::ClientClassDef::setCfgOption ( const CfgOptionPtr cfg_option)

Sets the class's option collection.

Parameters
cfg_optionthe option collection to assign the class

Definition at line 139 of file client_class_def.cc.

◆ setCfgOptionDef()

void isc::dhcp::ClientClassDef::setCfgOptionDef ( const CfgOptionDefPtr cfg_option_def)

Sets the class's option definition collection.

Parameters
cfg_option_defthe option definitions to assign the class

Definition at line 129 of file client_class_def.cc.

◆ setDependOnKnown()

void isc::dhcp::ClientClassDef::setDependOnKnown ( bool  depend_on_known)

Sets the depend on known flag aka use host flag.

Parameters
depend_on_knownthe value of the depend on known flag

Definition at line 119 of file client_class_def.cc.

◆ setFilename()

void isc::dhcp::ClientClassDef::setFilename ( const std::string &  filename)
inline

sets the boot-file-name value

Parameters
filenamethe value to be set

Definition at line 187 of file client_class_def.h.

◆ setMatchExpr()

void isc::dhcp::ClientClassDef::setMatchExpr ( const ExpressionPtr match_expr)

Sets the class's match expression.

Parameters
match_exprthe expression to assign the class

Definition at line 89 of file client_class_def.cc.

◆ setName()

void isc::dhcp::ClientClassDef::setName ( const std::string &  name)

Sets the class's name.

Parameters
namethe name to assign the class

Definition at line 79 of file client_class_def.cc.

◆ setNextServer()

void isc::dhcp::ClientClassDef::setNextServer ( const asiolink::IOAddress addr)
inline

sets the next-server value

Parameters
addrthe value to be set

Definition at line 167 of file client_class_def.h.

◆ setOfferLft()

void isc::dhcp::ClientClassDef::setOfferLft ( const util::Optional< uint32_t > &  offer_lft)
inline

Sets offer lifetime for the class.

Parameters
offer_lftthe offer lifetime assigned to the class (may be empty if not defined)

Definition at line 228 of file client_class_def.h.

◆ setPreferred()

void isc::dhcp::ClientClassDef::setPreferred ( const util::Triplet< uint32_t > &  preferred)
inline

Sets new preferred lifetime.

Parameters
preferredNew valid lifetime in seconds.

Definition at line 221 of file client_class_def.h.

◆ setRequired()

void isc::dhcp::ClientClassDef::setRequired ( bool  required)

Sets the only if required flag.

Parameters
requiredthe value of the only if required flag

Definition at line 109 of file client_class_def.cc.

◆ setSname()

void isc::dhcp::ClientClassDef::setSname ( const std::string &  sname)
inline

sets the server-name value

Parameters
snamethe value to be set

Definition at line 174 of file client_class_def.h.

◆ setTest()

void isc::dhcp::ClientClassDef::setTest ( const std::string &  test)

Sets the class's original match expression.

Parameters
testthe original expression to assign the class

Definition at line 99 of file client_class_def.cc.

◆ setValid()

void isc::dhcp::ClientClassDef::setValid ( const util::Triplet< uint32_t > &  valid)
inline

Sets new valid lifetime.

Parameters
validNew valid lifetime in seconds.

Definition at line 207 of file client_class_def.h.

◆ test()

void isc::dhcp::ClientClassDef::test ( PktPtr  pkt,
const ExpressionPtr expr_ptr 
)
virtual

Test method which checks if the packet belongs to the class.

If the packet belongs to the class, the class is added to the packet.

Parameters
pktThe packet checked if it belongs to the class.
expr_ptrExpression the class will use to determine membership

Reimplemented in isc::dhcp::TemplateClientClassDef.

Definition at line 144 of file client_class_def.cc.

References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::EVAL_RESULT, isc::dhcp::evaluateBool(), getName(), LOG_DEBUG, LOG_ERROR, LOG_INFO, and isc::Exception::what().

+ Here is the call graph for this function:

◆ toElement()

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const ClientClassDef x 
)
friend

Provides a convenient text representation of the class.

Definition at line 326 of file client_class_def.cc.


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