Kea: isc::dhcp::TemplateClientClassDef Class Reference

| Kea 3.2.0-git

isc::dhcp::TemplateClientClassDef Class Reference

`#include <client_class_def.h>`

Inheritance diagram for isc::dhcp::TemplateClientClassDef:
[legend]

## Public Member Functions
| TemplateClientClassDef (const std::string &name, const ExpressionPtr &match_expr, const CfgOptionPtr &options=CfgOptionPtr())
| Constructor.
virtual void | test (PktPtr pkt, const ExpressionPtr &expr_ptr) override
| Test method which checks if the packet belongs to the class.
virtual isc::data::ElementPtr | toElement () const override
| Unparse a configuration object.
Public Member Functions inherited from isc::dhcp::ClientClassDef
| 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.
bool | getAdditional () const
| Fetches the only if additional flag.
const CfgOptionPtr & | getCfgOption () const
| Fetches the class's option collection.
const CfgOptionDefPtr & | getCfgOptionDef () 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 ExpressionPtr & | getMatchExpr () const
| Fetches the class's match expression.
std::string | getName () const
| Fetches the class's name.
const asiolink::IOAddress & | getNextServer () 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.
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 | setAdditional (bool additional)
| Sets the only if additional flag.
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 | 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.
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.
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< ServerTag > | getServerTags () 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.

## Static Public Attributes
static const std::string | SPAWN_CLASS_PREFIX
| This is a prefix added to the spawned class name.

## 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

Definition at line 313 of file client_class_def.h.

## Constructor & Destructor Documentation

## ◆ TemplateClientClassDef()

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

Constructor.

Parameters

  name | Name to assign to this class
  match_expr | Expression the class will use to determine membership
  options | Collection of options members should be given

Definition at line 167 of file client_class_def.cc.

References isc::dhcp::ClientClassDef::ClientClassDef().

Here is the call graph for this function:

## Member Function Documentation

## ◆ test()

void isc::dhcp::TemplateClientClassDef::test | ( | PktPtr | pkt,
|  | const ExpressionPtr & | expr_ptr )
| overridevirtual

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

  pkt | The packet checked if it belongs to the class.
  expr_ptr | Expression the class will use to determine membership

Reimplemented from isc::dhcp::ClientClassDef.

Definition at line 174 of file client_class_def.cc.

References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_TEMPLATE_EVAL_ERROR, isc::dhcp::DHCPSRV_TEMPLATE_EVAL_RESULT, isc::dhcp::evaluateString(), isc::dhcp::ClientClassDef::getName(), LOG_DEBUG, LOG_ERROR, SPAWN_CLASS_PREFIX, and isc::Exception::what().

Referenced by toElement().

Here is the call graph for this function:

## ◆ toElement()

ElementPtr isc::dhcp::TemplateClientClassDef::toElement | ( |  | ) | const
| overridevirtual

Unparse a configuration object.

Returns
  a pointer to unparsed configuration

Reimplemented from isc::dhcp::ClientClassDef.

Definition at line 301 of file client_class_def.cc.

References isc::data::Element::create(), test(), and isc::dhcp::ClientClassDef::toElement().

Here is the call graph for this function:

## Member Data Documentation

## ◆ SPAWN_CLASS_PREFIX

const std::string isc::dhcp::TemplateClientClassDef::SPAWN_CLASS_PREFIX
| static

This is a prefix added to the spawned class name.

If incoming packet is associated with the template class, the name of generated spawned class is prepended with this prefix. For example, a packet that associates with the template class "FOO" by evaluating the template class expression to BAR will cause the packet to be assigned to class SPAWN_FOO_BAR.

Definition at line 343 of file client_class_def.h.

Referenced by test().

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

- client_class_def.h
- client_class_def.cc