Kea 3.1.1
isc::radius::Attributes Class Reference

Collection of attributes. More...

#include <client_attribute.h>

+ Inheritance diagram for isc::radius::Attributes:

Public Types

typedef boost::multi_index_container< ConstAttributePtr, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< boost::multi_index::member< Attribute, const uint8_t, &Attribute::type_ > > > > AttributeContainer
 Type of the container.
 

Public Member Functions

 Attributes ()
 constructor.
 
 Attributes (const Attributes &other)
 Copy constructor.
 
virtual ~Attributes ()
 Destructor.
 
void add (const ConstAttributePtr &attr)
 Adds instance of the attribute to the collection.
 
void append (const Attributes &other)
 Append another collection.
 
AttributeContainer::iterator begin ()
 Get the iterator to the beginning.
 
AttributeContainer::const_iterator begin () const
 Get the iterator to the beginning.
 
AttributeContainer::const_iterator cbegin () const
 Get the const iterator to the beginning.
 
AttributeContainer::const_iterator cend () const
 Get the const iterator to the past-the-end.
 
void clear ()
 Clear the collection.
 
size_t count (const uint8_t type) const
 Counts instance of the attribute in the collection.
 
bool del (const uint8_t type)
 Deletes an attribute from the collection.
 
bool empty () const
 Indicates the object is empty.
 
AttributeContainer::iterator end ()
 Get the iterator to the past-the-end.
 
AttributeContainer::const_iterator end () const
 Get the iterator to the past-the-end.
 
ConstAttributePtr get (const uint8_t type) const
 Get instance of the attribute in the collection.
 
size_t size () const
 Returns the number of elements.
 
data::ElementPtr toElement () const override
 Unparse collection.
 
std::string toText (size_t indent=0) const
 Returns text representation of the collection.
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor.
 

Static Public Member Functions

static Attributes fromElement (const data::ConstElementPtr &attr_list)
 Parse collection.
 

Protected Attributes

AttributeContainer container_
 The container.
 

Detailed Description

Collection of attributes.

Definition at line 652 of file client_attribute.h.

Member Typedef Documentation

◆ AttributeContainer

typedef boost::multi_index_container< ConstAttributePtr, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< boost::multi_index::member< Attribute, const uint8_t, &Attribute::type_ > > > > isc::radius::Attributes::AttributeContainer

Type of the container.

Definition at line 670 of file client_attribute.h.

Constructor & Destructor Documentation

◆ Attributes() [1/2]

isc::radius::Attributes::Attributes ( )
inline

constructor.

Definition at line 673 of file client_attribute.h.

References container_.

Referenced by Attributes(), append(), and fromElement().

◆ Attributes() [2/2]

isc::radius::Attributes::Attributes ( const Attributes & other)
inline

Copy constructor.

Parameters
othersource attributes.

Definition at line 679 of file client_attribute.h.

References Attributes(), and container_.

+ Here is the call graph for this function:

◆ ~Attributes()

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

Destructor.

Definition at line 683 of file client_attribute.h.

References clear().

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

void isc::radius::Attributes::add ( const ConstAttributePtr & attr)

Adds instance of the attribute to the collection.

Parameters
attrPointer to the attribute being added (can be null).

Definition at line 616 of file client_attribute.cc.

References container_.

Referenced by append(), fromElement(), isc::radius::CfgAttributes::getAll(), and isc::radius::CfgAttributes::getEvalAll().

◆ append()

void isc::radius::Attributes::append ( const Attributes & other)

Append another collection.

Parameters
otherThe other collection to be appended to this one.

Definition at line 635 of file client_attribute.cc.

References Attributes(), and add().

+ Here is the call graph for this function:

◆ begin() [1/2]

AttributeContainer::iterator isc::radius::Attributes::begin ( )
inline

Get the iterator to the beginning.

Returns
the iterator to the beginning.

Definition at line 756 of file client_attribute.h.

References container_.

◆ begin() [2/2]

AttributeContainer::const_iterator isc::radius::Attributes::begin ( ) const
inline

Get the iterator to the beginning.

Returns
the iterator to the beginning.

Definition at line 763 of file client_attribute.h.

References container_.

◆ cbegin()

AttributeContainer::const_iterator isc::radius::Attributes::cbegin ( ) const
inline

Get the const iterator to the beginning.

Returns
the const iterator to the beginning.

Definition at line 770 of file client_attribute.h.

References container_.

◆ cend()

AttributeContainer::const_iterator isc::radius::Attributes::cend ( ) const
inline

Get the const iterator to the past-the-end.

Definition at line 789 of file client_attribute.h.

References container_.

◆ clear()

void isc::radius::Attributes::clear ( )
inline

Clear the collection.

Definition at line 715 of file client_attribute.h.

References container_.

Referenced by ~Attributes().

◆ count()

size_t isc::radius::Attributes::count ( const uint8_t type) const

Counts instance of the attribute in the collection.

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

Definition at line 642 of file client_attribute.cc.

References container_.

◆ del()

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

Deletes an attribute from the collection.

Delete only the first occurrence.

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

Definition at line 624 of file client_attribute.cc.

References container_.

◆ empty()

bool isc::radius::Attributes::empty ( ) const
inline

Indicates the object is empty.

Returns
true when the object is empty.

Definition at line 690 of file client_attribute.h.

References container_.

◆ end() [1/2]

AttributeContainer::iterator isc::radius::Attributes::end ( )
inline

Get the iterator to the past-the-end.

Returns
the iterator to the past-the-end.

Definition at line 777 of file client_attribute.h.

References container_.

◆ end() [2/2]

AttributeContainer::const_iterator isc::radius::Attributes::end ( ) const
inline

Get the iterator to the past-the-end.

Returns
the iterator to the past-the-end.

Definition at line 784 of file client_attribute.h.

References container_.

◆ fromElement()

Attributes isc::radius::Attributes::fromElement ( const data::ConstElementPtr & attr_list)
static

Parse collection.

attr_list the attribute list to parse.

Returns
parsed collection.

Definition at line 683 of file client_attribute.cc.

References Attributes(), add(), isc::util::encode::decodeHex(), isc::radius::Attribute::fromBytes(), isc::radius::Attribute::fromText(), isc::radius::AttrDefs::getByType(), isc::radius::AttrDefs::instance(), Element::integer, Element::list, Element::map, isc::radius::PW_TYPE_STRING, and Element::string.

Referenced by isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct4(), and isc::radius::RadiusAccounting::buildAcct6().

+ Here is the call graph for this function:

◆ get()

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

Get instance of the attribute in the collection.

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

Definition at line 648 of file client_attribute.cc.

References container_.

Referenced by isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct4(), and isc::radius::RadiusAccounting::buildAcct6().

◆ size()

size_t isc::radius::Attributes::size ( ) const
inline

Returns the number of elements.

Returns
the number of elements.

Definition at line 697 of file client_attribute.h.

References container_.

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

◆ toElement()

ElementPtr isc::radius::Attributes::toElement ( ) const
overridevirtual

Unparse collection.

Returns
a pointer to unparsed collection.

Implements isc::data::CfgToElement.

Definition at line 674 of file client_attribute.cc.

References Element::createList().

+ Here is the call graph for this function:

◆ toText()

string isc::radius::Attributes::toText ( size_t indent = 0) const

Returns text representation of the collection.

Parameters
indentnumber of spaces before printing text.
Returns
string with text representation.

Definition at line 659 of file client_attribute.cc.

Member Data Documentation

◆ container_

AttributeContainer isc::radius::Attributes::container_
protected

The container.

Definition at line 795 of file client_attribute.h.

Referenced by Attributes(), Attributes(), add(), begin(), begin(), cbegin(), cend(), clear(), count(), del(), empty(), end(), end(), get(), and size().


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