Kea 3.1.1
isc::radius::CfgAttributes Class Reference

Attribute data configuration. More...

#include <cfg_attribute.h>

+ Inheritance diagram for isc::radius::CfgAttributes:

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.
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor.
 

Protected Attributes

std::multimap< uint8_t, AttributeValuecontainer_
 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 34 of file cfg_attribute.h.

Constructor & Destructor Documentation

◆ CfgAttributes()

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

Constructor.

Definition at line 38 of file cfg_attribute.h.

References container_.

◆ ~CfgAttributes()

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

Definition at line 42 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
defPointer to the attribute definition.
attrPointer to the attribute being added.

Definition at line 75 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
defPointer to the attribute definition.
attrPointer to the attribute being added.
exprExpression to compute the value.
testOriginal 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 88 of file cfg_attribute.h.

References container_.

Referenced by ~CfgAttributes().

◆ count()

size_t isc::radius::CfgAttributes::count ( const uint8_t type) const
inline

Counts instance of the attribute in the configuration.

Parameters
typetype of the attribute to count.
Returns
count of attributes with the given type in the configuration.

Definition at line 96 of file cfg_attribute.h.

References container_.

◆ del()

bool isc::radius::CfgAttributes::del ( const uint8_t type)

Deletes an attribute from the configuration.

Deletes only the first occurrence.

Parameters
typetype of the attribute to delete.
Returns
true if found.

Definition at line 36 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 49 of file cfg_attribute.h.

References container_.

◆ get()

ConstAttributePtr isc::radius::CfgAttributes::get ( const uint8_t type) const

Get instance of the attribute in the configuration.

Parameters
typetype of the attribute to retrieve.
Returns
the first instance if exists.

Definition at line 55 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 82 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

Returns the definition of an attribute.

Parameters
typetype of the attribute.
Returns
the definition of the attribute.

Definition at line 46 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
pktThe v4 or v6 packet.
Returns
all evaluated attributes in the configuration.

Definition at line 91 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

Returns the expression of an attribute.

Parameters
typetype of the attribute.
Returns
the expression of the attribute.

Definition at line 64 of file cfg_attribute.cc.

References container_.

◆ getTest()

string isc::radius::CfgAttributes::getTest ( const uint8_t type) const

Returns the text expression of an attribute.

Parameters
typetype of the attribute.
Returns
the text expression of the attribute.

Definition at line 73 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 56 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 117 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_

std::multimap<uint8_t, AttributeValue> isc::radius::CfgAttributes::container_
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().


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