![]() |
Kea 3.1.1
|
Attribute data configuration. More...
#include <cfg_attribute.h>
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 |
Counts instance of the attribute in the configuration. | |
bool | del (const uint8_t type) |
Deletes an attribute from the configuration. | |
bool | empty () const |
Checks if the object is empty. | |
ConstAttributePtr | get (const uint8_t type) 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 |
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 |
Returns the expression of an attribute. | |
std::string | getTest (const uint8_t type) const |
Returns the text expression of an attribute. | |
size_t | size () const |
Returns the number of elements. | |
data::ElementPtr | toElement () const override |
Unparse configuration. | |
![]() | |
virtual | ~CfgToElement () |
Destructor. | |
Protected Attributes | |
std::multimap< uint8_t, AttributeValue > | container_ |
The container. | |
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 34 of file cfg_attribute.h.
|
inline |
|
inlinevirtual |
Definition at line 42 of file cfg_attribute.h.
References clear().
|
inline |
Adds instance of the attribute to the configuration.
def | Pointer to the attribute definition. |
attr | Pointer to the attribute being added. |
Definition at line 75 of file cfg_attribute.h.
References add().
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.
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().
|
inline |
Clear the container.
Definition at line 88 of file cfg_attribute.h.
References container_.
Referenced by ~CfgAttributes().
|
inline |
Counts instance of the attribute in the configuration.
type | type of the attribute to count. |
Definition at line 96 of file cfg_attribute.h.
References container_.
bool isc::radius::CfgAttributes::del | ( | const uint8_t | type | ) |
Deletes an attribute from the configuration.
Deletes only the first occurrence.
type | type of the attribute to delete. |
Definition at line 36 of file cfg_attribute.cc.
References container_.
|
inline |
Checks if the object is empty.
Definition at line 49 of file cfg_attribute.h.
References container_.
ConstAttributePtr isc::radius::CfgAttributes::get | ( | const uint8_t | type | ) | const |
Get instance of the attribute in the configuration.
type | type of the attribute to retrieve. |
Definition at line 55 of file cfg_attribute.cc.
References container_.
Attributes isc::radius::CfgAttributes::getAll | ( | ) | const |
Get all attributes in the configuration.
Definition at line 82 of file cfg_attribute.cc.
References isc::radius::Attributes::add(), and container_.
Referenced by isc::radius::RadiusServiceParser::checkAttributes().
AttrDefPtr isc::radius::CfgAttributes::getDef | ( | const uint8_t | type | ) | const |
Returns the definition of an attribute.
type | type of the attribute. |
Definition at line 46 of file cfg_attribute.cc.
References container_.
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.
pkt | The v4 or v6 packet. |
Definition at line 91 of file cfg_attribute.cc.
References isc::radius::Attributes::add(), container_, isc::dhcp::evaluateString(), and isc::radius::Attribute::fromBytes().
ExpressionPtr isc::radius::CfgAttributes::getExpr | ( | const uint8_t | type | ) | const |
Returns the expression of an attribute.
type | type of the attribute. |
Definition at line 64 of file cfg_attribute.cc.
References container_.
string isc::radius::CfgAttributes::getTest | ( | const uint8_t | type | ) | const |
Returns the text expression of an attribute.
type | type of the attribute. |
Definition at line 73 of file cfg_attribute.cc.
References container_.
|
inline |
Returns the number of elements.
Definition at line 56 of file cfg_attribute.h.
References container_.
Referenced by isc::radius::RadiusServiceParser::checkAttributes().
|
overridevirtual |
Unparse configuration.
Implements isc::data::CfgToElement.
Definition at line 117 of file cfg_attribute.cc.
References container_, Element::create(), Element::createList(), and Element::createMap().
|
protected |
The container.
Definition at line 188 of file cfg_attribute.h.
Referenced by CfgAttributes(), add(), clear(), count(), del(), empty(), get(), getAll(), getDef(), getEvalAll(), getExpr(), getTest(), size(), and toElement().