Kea: isc::radius::CfgAttributes Class Reference

| Kea 3.2.0-git

isc::radius::CfgAttributes Class Reference

Attribute data configuration. More...

`#include <cfg_attribute.h>`

Inheritance diagram for isc::radius::CfgAttributes:
[legend]

## Classes
class | AttributeValue
| Container value class. More...

## Public Member Functions
| CfgAttributes ()
| Constructor.
virtual | ~CfgAttributes ()
void | add (const AttrDefPtr &def, const ConstAttributePtr &attr)
| Adds instance of the attribute to the configuration.
void | add (const AttrDefPtr &def, const ConstAttributePtr &attr, const dhcp::ExpressionPtr &expr, const std::string &test)
| Adds instance of the attribute to the configuration.
void | clear ()
| Clear the container.
size_t | count (const uint8_t type, const uint32_t vendor=0) const
| Counts instance of the attribute in the configuration.
bool | del (const uint8_t type, const uint32_t vendor=0)
| Deletes an attribute from the configuration.
bool | empty () const
| Checks if the object is empty.
ConstAttributePtr | get (const uint8_t type, const uint32_t vendor=0) const
| Get instance of the attribute in the configuration.
Attributes | getAll () const
| Get all attributes in the configuration.
AttrDefPtr | getDef (const uint8_t type, const uint32_t vendor=0) const
| Returns the definition of an attribute.
Attributes | getEvalAll (dhcp::Pkt &pkt)
| Get all evaluated attributes in the configuration.
dhcp::ExpressionPtr | getExpr (const uint8_t type, const uint32_t vendor=0) const
| Returns the expression of an attribute.
std::string | getTest (const uint8_t type, const uint32_t vendor=0) const
| Returns the text expression of an attribute.
size_t | size () const
| Returns the number of elements.
data::ElementPtr | toElement () const override
| Unparse configuration.
Public Member Functions inherited from isc::data::CfgToElement
virtual | ~CfgToElement ()
| Destructor.

## Protected Attributes
boost::multi_index_container< AttributeValue, boost::multi_index::indexed_by< boost::multi_index::hashed_non_unique< boost::multi_index::composite_key< AttributeValue, boost::multi_index::const_mem_fun< AttributeValue, uint32_t, &AttributeValue::getVendor >, boost::multi_index::const_mem_fun< AttributeValue, uint8_t, &AttributeValue::getType > > > > > | container_
| The container.

## Detailed Description

Attribute data configuration.

It is used to store attribute types and values.

For example, it is able to store the following structure: { "name": "User-Name", "type": 1, "expr": "'foobar'" }

Definition at line 38 of file cfg_attribute.h.

## Constructor & Destructor Documentation

## ◆ CfgAttributes()

isc::radius::CfgAttributes::CfgAttributes | ( |  | ) |
| inline

Constructor.

Definition at line 42 of file cfg_attribute.h.

References container_.

## ◆ ~CfgAttributes()

virtual isc::radius::CfgAttributes::~CfgAttributes | ( |  | ) |
| inlinevirtual

Definition at line 46 of file cfg_attribute.h.

References clear().

Here is the call graph for this function:

## Member Function Documentation

## ◆ add() [1/2]

void isc::radius::CfgAttributes::add | ( | const AttrDefPtr & | def,
|  | const ConstAttributePtr & | attr )
| inline

Adds instance of the attribute to the configuration.

Parameters

  def | Pointer to the attribute definition.
  attr | Pointer to the attribute being added.

Definition at line 79 of file cfg_attribute.h.

References add().

Here is the call graph for this function:

## ◆ add() [2/2]

void isc::radius::CfgAttributes::add | ( | const AttrDefPtr & | def,
|  | const ConstAttributePtr & | attr,
|  | const dhcp::ExpressionPtr & | expr,
|  | const std::string & | test )

Adds instance of the attribute to the configuration.

Parameters

  def | Pointer to the attribute definition.
  attr | Pointer to the attribute being added.
  expr | Expression to compute the value.
  test | Original expression.

Definition at line 24 of file cfg_attribute.cc.

References container_, and isc_throw.

Referenced by add().

## ◆ clear()

void isc::radius::CfgAttributes::clear | ( |  | ) |
| inline

Clear the container.

Definition at line 93 of file cfg_attribute.h.

References container_.

Referenced by ~CfgAttributes().

## ◆ count()

size_t isc::radius::CfgAttributes::count | ( | const uint8_t | type,
|  | const uint32_t | vendor = 0 ) const
| inline

Counts instance of the attribute in the configuration.

Parameters

  type | type of the attribute to count.
  vendor | vendor id (default 0).

Returns
  count of attributes with the given type and vendor in the configuration.

Definition at line 103 of file cfg_attribute.h.

References container_.

## ◆ del()

bool isc::radius::CfgAttributes::del | ( | const uint8_t | type,
|  | const uint32_t | vendor = 0 )

Deletes an attribute from the configuration.

Deletes only the first occurrence.

Parameters

  type | type of the attribute to delete.
  vendor | vendor id (default 0).

Returns
  true if found.

Definition at line 35 of file cfg_attribute.cc.

References container_.

## ◆ empty()

bool isc::radius::CfgAttributes::empty | ( |  | ) | const
| inline

Checks if the object is empty.

Returns
  true when the object is empty.

Definition at line 53 of file cfg_attribute.h.

References container_.

## ◆ get()

ConstAttributePtr isc::radius::CfgAttributes::get | ( | const uint8_t | type,
|  | const uint32_t | vendor = 0 ) const

Get instance of the attribute in the configuration.

Parameters

  type | type of the attribute to retrieve.
  vendor | vendor id (default 0).

Returns
  the first instance if exists.

Definition at line 54 of file cfg_attribute.cc.

References container_.

## ◆ getAll()

Attributes isc::radius::CfgAttributes::getAll | ( |  | ) | const

Get all attributes in the configuration.

Returns
  all attributes in the configuration.

Definition at line 81 of file cfg_attribute.cc.

References isc::radius::Attributes::add(), and container_.

Referenced by isc::radius::RadiusServiceParser::checkAttributes().

Here is the call graph for this function:

## ◆ getDef()

AttrDefPtr isc::radius::CfgAttributes::getDef | ( | const uint8_t | type,
|  | const uint32_t | vendor = 0 ) const

Returns the definition of an attribute.

Parameters

  type | type of the attribute.
  vendor | vendor id (default 0).

Returns
  the definition of the attribute.

Definition at line 45 of file cfg_attribute.cc.

References container_.

## ◆ getEvalAll()

Attributes isc::radius::CfgAttributes::getEvalAll | ( | dhcp::Pkt & | pkt | ) |

Get all evaluated attributes in the configuration.

When an attribute has an expression, evaluate the expression into a copy of the attribute. The attribute is skipped if the evaluation returns an empty string.

Parameters

  pkt | The v4 or v6 packet.

Returns
  all evaluated attributes in the configuration.

Definition at line 90 of file cfg_attribute.cc.

References isc::radius::Attributes::add(), container_, isc::dhcp::evaluateString(), and isc::radius::Attribute::fromBytes().

Here is the call graph for this function:

## ◆ getExpr()

ExpressionPtr isc::radius::CfgAttributes::getExpr | ( | const uint8_t | type,
|  | const uint32_t | vendor = 0 ) const

Returns the expression of an attribute.

Parameters

  type | type of the attribute.
  vendor | vendor id (default 0).

Returns
  the expression of the attribute.

Definition at line 63 of file cfg_attribute.cc.

References container_.

## ◆ getTest()

string isc::radius::CfgAttributes::getTest | ( | const uint8_t | type,
|  | const uint32_t | vendor = 0 ) const

Returns the text expression of an attribute.

Parameters

  type | type of the attribute.
  vendor | vendor id (default 0).

Returns
  the text expression of the attribute.

Definition at line 72 of file cfg_attribute.cc.

References container_.

## ◆ size()

size_t isc::radius::CfgAttributes::size | ( |  | ) | const
| inline

Returns the number of elements.

Returns
  the number of elements.

Definition at line 60 of file cfg_attribute.h.

References container_.

Referenced by isc::radius::RadiusServiceParser::checkAttributes().

## ◆ toElement()

ElementPtr isc::radius::CfgAttributes::toElement | ( |  | ) | const
| overridevirtual

Unparse configuration.

Returns
  a pointer to unparsed configuration.

Implements isc::data::CfgToElement.

Definition at line 116 of file cfg_attribute.cc.

References container_, Element::create(), Element::createList(), and Element::createMap().

Here is the call graph for this function:

## Member Data Documentation

## ◆ container_

boost::multi_index_container< AttributeValue, boost::multi_index::indexed_by< boost::multi_index::hashed_non_unique< boost::multi_index::composite_key< AttributeValue, boost::multi_index::const_mem_fun< AttributeValue, uint32_t, &AttributeValue::getVendor >, boost::multi_index::const_mem_fun< AttributeValue, uint8_t, &AttributeValue::getType > > > > > isc::radius::CfgAttributes::container_
| protected

The container.

Definition at line 234 of file cfg_attribute.h.

Referenced by CfgAttributes(), add(), clear(), count(), del(), empty(), get(), getAll(), getDef(), getEvalAll(), getExpr(), getTest(), size(), and toElement().

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

- cfg_attribute.h
- cfg_attribute.cc