![]() |
Kea 3.1.1
|
RADIUS attribute definitions. More...
#include <client_dictionary.h>
Public Types | |
typedef std::unordered_map< std::string, std::string > | AttrDefAliases |
Type of the alias table (alias -> standard name map). | |
typedef boost::multi_index_container< AttrDefPtr, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::member< AttrDef, const uint8_t, &AttrDef::type_ > >, boost::multi_index::hashed_unique< boost::multi_index::member< AttrDef, const std::string, &AttrDef::name_ > > > > | AttrDefContainer |
Type of the attribute definition container. | |
typedef boost::multi_index_container< IntCstDefPtr, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::composite_key< IntCstDef, boost::multi_index::member< IntCstDef, const uint8_t, &IntCstDef::type_ >, boost::multi_index::member< IntCstDef, const std::string, &IntCstDef::name_ > > >, boost::multi_index::hashed_unique< boost::multi_index::composite_key< IntCstDef, boost::multi_index::member< IntCstDef, const uint8_t, &IntCstDef::type_ >, boost::multi_index::member< IntCstDef, const uint32_t, &IntCstDef::value_ > > > > > | IntCstDefContainer |
Type of the integer constant definition container. | |
Public Member Functions | |
void | add (AttrDefPtr def) |
Add (or replace) an attribute definition. | |
void | add (IntCstDefPtr def) |
Add (or replace) an integer constant definition. | |
void | checkStandardDefs (const AttrDefList &defs) const |
Check if a list of standard attribute definitions are available and correct. | |
void | clear () |
Clear definitions. | |
AttrDefPtr | getByName (const std::string &name) const |
Get attribute definition by name. | |
IntCstDefPtr | getByName (const uint8_t type, const std::string &name) const |
Get integer constant definition by attribute type and name. | |
AttrDefPtr | getByType (const uint8_t type) const |
Get attribute definition by type. | |
IntCstDefPtr | getByValue (const uint8_t type, const uint32_t value) const |
Get integer constant definition by attribute type and value. | |
std::string | getName (const uint8_t type) const |
Get attribute name. | |
void | readDictionary (const std::string &path) |
Read a dictionary from a file. | |
void | readDictionary (std::istream &is) |
Read a dictionary from an input stream. | |
Static Public Member Functions | |
static AttrDefs & | instance () |
Returns a single instance. | |
Protected Member Functions | |
AttrDefs () | |
Contructor. | |
virtual | ~AttrDefs () |
Destructor. | |
void | parseLine (const std::string &line) |
Parse a dictionary line. | |
Protected Attributes | |
AttrDefAliases | aliases_ |
Attribute aliases. | |
AttrDefContainer | container_ |
Attribute definition container. | |
IntCstDefContainer | ic_container_ |
Integer constant definition container. | |
RADIUS attribute definitions.
Definition at line 109 of file client_dictionary.h.
typedef std::unordered_map<std::string, std::string> isc::radius::AttrDefs::AttrDefAliases |
Type of the alias table (alias -> standard name map).
Definition at line 134 of file client_dictionary.h.
typedef boost::multi_index_container< AttrDefPtr, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::member< AttrDef, const uint8_t, &AttrDef::type_ > >, boost::multi_index::hashed_unique< boost::multi_index::member< AttrDef, const std::string, &AttrDef::name_ > > > > isc::radius::AttrDefs::AttrDefContainer |
Type of the attribute definition container.
Definition at line 131 of file client_dictionary.h.
typedef boost::multi_index_container< IntCstDefPtr, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::composite_key< IntCstDef, boost::multi_index::member< IntCstDef, const uint8_t, &IntCstDef::type_ >, boost::multi_index::member< IntCstDef, const std::string, &IntCstDef::name_ > > >, boost::multi_index::hashed_unique< boost::multi_index::composite_key< IntCstDef, boost::multi_index::member< IntCstDef, const uint8_t, &IntCstDef::type_ >, boost::multi_index::member< IntCstDef, const uint32_t, &IntCstDef::value_ > > > > > isc::radius::AttrDefs::IntCstDefContainer |
Type of the integer constant definition container.
Definition at line 167 of file client_dictionary.h.
|
inlineprotected |
Contructor.
Definition at line 247 of file client_dictionary.h.
References aliases_, container_, and ic_container_.
Referenced by instance().
|
inlineprotectedvirtual |
Destructor.
Definition at line 251 of file client_dictionary.h.
References clear().
void isc::radius::AttrDefs::add | ( | AttrDefPtr | def | ) |
Add (or replace) an attribute definition.
def | attribute definition to add or replace. |
Definition at line 94 of file client_dictionary.cc.
References aliases_, isc::radius::attrValueTypeToText(), container_, and isc_throw.
Referenced by parseLine().
void isc::radius::AttrDefs::add | ( | IntCstDefPtr | def | ) |
Add (or replace) an integer constant definition.
Definition at line 164 of file client_dictionary.cc.
References getName(), ic_container_, and isc_throw.
void isc::radius::AttrDefs::checkStandardDefs | ( | const AttrDefList & | defs | ) | const |
Check if a list of standard attribute definitions are available and correct.
defs | list of standard attribute definitions. |
Definition at line 295 of file client_dictionary.cc.
References isc::radius::attrValueTypeToText(), getByName(), and isc_throw.
Referenced by isc::radius::RadiusConfigParser::parse().
|
inline |
Clear definitions.
Definition at line 194 of file client_dictionary.h.
References aliases_, container_, and ic_container_.
Referenced by ~AttrDefs().
AttrDefPtr isc::radius::AttrDefs::getByName | ( | const std::string & | name | ) | const |
Get attribute definition by name.
name | name to look for. |
Definition at line 77 of file client_dictionary.cc.
References aliases_, and container_.
Referenced by checkStandardDefs(), isc::radius::Attribute::fromText(), isc::radius::Attribute::fromText(), isc::radius::RadiusAttributeParser::parse(), and parseLine().
IntCstDefPtr isc::radius::AttrDefs::getByName | ( | const uint8_t | type, |
const std::string & | name ) const |
Get integer constant definition by attribute type and name.
type | attribute type. |
name | name to look for. |
Definition at line 144 of file client_dictionary.cc.
References ic_container_.
AttrDefPtr isc::radius::AttrDefs::getByType | ( | const uint8_t | type | ) | const |
Get attribute definition by type.
type | type to look for. |
Definition at line 67 of file client_dictionary.cc.
References container_.
Referenced by isc::radius::Attribute::fromBytes(), isc::radius::Attributes::fromElement(), getName(), isc::radius::RadiusAttributeParser::parse(), isc::radius::AttrInt::toElement(), isc::radius::AttrIpAddr::toElement(), isc::radius::AttrIpv6Addr::toElement(), isc::radius::AttrIpv6Prefix::toElement(), and isc::radius::AttrString::toElement().
IntCstDefPtr isc::radius::AttrDefs::getByValue | ( | const uint8_t | type, |
const uint32_t | value ) const |
Get integer constant definition by attribute type and value.
type | attribute type. |
value | value to look for. |
Definition at line 154 of file client_dictionary.cc.
References ic_container_.
Referenced by isc::radius::AttrInt::toText().
string isc::radius::AttrDefs::getName | ( | const uint8_t | type | ) | const |
Get attribute name.
type | type to look for. |
Definition at line 133 of file client_dictionary.cc.
References getByType().
Referenced by add(), isc::radius::AttrInt::toText(), isc::radius::AttrIpAddr::toText(), isc::radius::AttrIpv6Addr::toText(), isc::radius::AttrIpv6Prefix::toText(), and isc::radius::AttrString::toText().
|
static |
Returns a single instance.
AttrDefs is a singleton and this method is the only way of accessing it.
Definition at line 61 of file client_dictionary.cc.
References AttrDefs().
Referenced by isc::radius::Message::decode(), isc::radius::Attribute::fromBytes(), isc::radius::AttrInt::fromBytes(), isc::radius::AttrIpAddr::fromBytes(), isc::radius::AttrIpv6Addr::fromBytes(), isc::radius::AttrIpv6Prefix::fromBytes(), isc::radius::Attributes::fromElement(), isc::radius::Attribute::fromText(), isc::radius::Attribute::fromText(), isc::radius::AttrInt::fromText(), isc::radius::AttrIpAddr::fromText(), isc::radius::AttrIpv6Addr::fromText(), isc::radius::AttrIpv6Prefix::fromText(), isc::radius::RadiusAttributeParser::parse(), isc::radius::RadiusConfigParser::parse(), isc::radius::AttrInt::toElement(), isc::radius::AttrIpAddr::toElement(), isc::radius::AttrIpv6Addr::toElement(), isc::radius::AttrIpv6Prefix::toElement(), isc::radius::AttrString::toElement(), isc::radius::AttrInt::toText(), isc::radius::AttrIpAddr::toText(), isc::radius::AttrIpv6Addr::toText(), isc::radius::AttrIpv6Prefix::toText(), and isc::radius::AttrString::toText().
|
protected |
Parse a dictionary line.
line | line to parse. |
Definition at line 183 of file client_dictionary.cc.
References add(), getByName(), isc_throw, isc::radius::PW_TYPE_INTEGER, isc::radius::textToAttrValueType(), and isc::util::str::tokens().
Referenced by readDictionary().
void isc::radius::AttrDefs::readDictionary | ( | const std::string & | path | ) |
Read a dictionary from a file.
Fills attribute and integer constant definition tables from a dictionary file.
path | dictionary file path. |
Definition at line 258 of file client_dictionary.cc.
References isc_throw, and readDictionary().
Referenced by isc::radius::RadiusConfigParser::parse(), and readDictionary().
void isc::radius::AttrDefs::readDictionary | ( | std::istream & | is | ) |
Read a dictionary from an input stream.
Fills attribute and integer constant definition tables from a dictionary input stream.
is | input stream. |
Definition at line 277 of file client_dictionary.cc.
References isc_throw, and parseLine().
|
protected |
Attribute aliases.
Definition at line 264 of file client_dictionary.h.
Referenced by AttrDefs(), add(), clear(), and getByName().
|
protected |
Attribute definition container.
Definition at line 261 of file client_dictionary.h.
Referenced by AttrDefs(), add(), clear(), getByName(), and getByType().
|
protected |
Integer constant definition container.
Definition at line 267 of file client_dictionary.h.
Referenced by AttrDefs(), add(), clear(), getByName(), and getByValue().