![]() |
Kea 3.1.1
|
RADIUS attribute base class. More...
#include <client_attribute.h>
Public Member Functions | |
virtual | ~Attribute ()=default |
Virtual destructor. | |
uint8_t | getType () const |
Get type. | |
virtual size_t | getValueLen () const =0 |
Generic get methods. | |
virtual AttrValueType | getValueType () const =0 |
Get value type. | |
virtual std::vector< uint8_t > | toBinary () const |
To binary. | |
virtual std::vector< uint8_t > | toBytes () const =0 |
To bytes (wire format). | |
virtual uint32_t | toInt () const |
To integer. | |
virtual asiolink::IOAddress | toIpAddr () const |
To IPv4 address. | |
virtual asiolink::IOAddress | toIpv6Addr () const |
To IPv6 address. | |
virtual asiolink::IOAddress | toIpv6Prefix () const |
To IPv6 prefix. | |
virtual uint8_t | toIpv6PrefixLen () const |
To IPv6 prefix length. | |
virtual std::string | toString () const |
Specific get methods. | |
virtual std::string | toText (size_t indent=0) const =0 |
Returns text representation of the attribute. | |
![]() | |
virtual | ~CfgToElement () |
Destructor. | |
virtual isc::data::ElementPtr | toElement () const =0 |
Unparse a configuration object. | |
Static Public Member Functions | |
static AttributePtr | fromBinary (const uint8_t type, const std::vector< uint8_t > &value) |
From binary with type. | |
static AttributePtr | fromBytes (const AttrDefPtr &def, const std::vector< uint8_t > &value) |
From bytes with definition. | |
static AttributePtr | fromBytes (const std::vector< uint8_t > &bytes) |
From bytes (wire format). | |
static AttributePtr | fromInt (const uint8_t type, const uint32_t value) |
From integer with type. | |
static AttributePtr | fromIpAddr (const uint8_t type, const asiolink::IOAddress &value) |
From IPv4 address with type. | |
static AttributePtr | fromIpv6Addr (const uint8_t type, const asiolink::IOAddress &value) |
From IPv6 address with type. | |
static AttributePtr | fromIpv6Prefix (const uint8_t type, const uint8_t len, const asiolink::IOAddress &value) |
From IPv6 prefix with type. | |
static AttributePtr | fromString (const uint8_t type, const std::string &value) |
From type specific factories. | |
static AttributePtr | fromText (const AttrDefPtr &def, const std::string &value) |
From definition generic factories. | |
static AttributePtr | fromText (const std::string &repr) |
Generic factories. | |
Public Attributes | |
const uint8_t | type_ |
Type. | |
Protected Member Functions | |
Attribute (const uint8_t type) | |
Constructor. | |
RADIUS attribute base class.
Definition at line 40 of file client_attribute.h.
|
inlineexplicitprotected |
Constructor.
Called from derived classes.
type | attribute type. |
Definition at line 48 of file client_attribute.h.
References type_.
|
virtualdefault |
Virtual destructor.
|
static |
From binary with type.
type | type of attribute. |
value | binary value. |
Definition at line 150 of file client_attribute.cc.
References isc_throw.
Referenced by isc::radius::Message::decodeUserPassword(), and isc::radius::Message::encodeUserPassword().
|
static |
From bytes with definition.
def | pointer to attribute definition. |
value | binary value. |
BadValue | on errors. |
Definition at line 116 of file client_attribute.cc.
References isc::radius::AttrInt::fromBytes(), isc::radius::AttrIpAddr::fromBytes(), isc::radius::AttrIpv6Addr::fromBytes(), isc::radius::AttrIpv6Prefix::fromBytes(), isc::radius::AttrString::fromBytes(), isc_throw, isc::radius::PW_TYPE_INTEGER, isc::radius::PW_TYPE_IPADDR, isc::radius::PW_TYPE_IPV6ADDR, isc::radius::PW_TYPE_IPV6PREFIX, and isc::radius::PW_TYPE_STRING.
|
static |
From bytes (wire format).
bytes | binary attribute. |
BadValue | on errors other than the definition can't be found. |
Definition at line 91 of file client_attribute.cc.
References fromBytes(), isc::radius::AttrDefs::getByType(), isc::radius::AttrDefs::instance(), and isc_throw.
Referenced by isc::radius::Message::decode(), fromBytes(), isc::radius::Attributes::fromElement(), isc::radius::CfgAttributes::getEvalAll(), and isc::radius::RadiusAttributeParser::parse().
|
static |
From integer with type.
type | type of attribute. |
value | integer value. |
Definition at line 158 of file client_attribute.cc.
Referenced by isc::radius::RadiusRequest::RadiusRequest(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct4(), isc::radius::RadiusAccounting::buildAcct6(), isc::radius::Exchange::buildRequest(), and fromText().
|
static |
From IPv4 address with type.
type | type of attribute. |
value | IPv4 address. |
Definition at line 163 of file client_attribute.cc.
Referenced by isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct4(), and isc::radius::Exchange::buildRequest().
|
static |
From IPv6 address with type.
type | type of attribute. |
value | IPv6 address. |
Definition at line 168 of file client_attribute.cc.
Referenced by isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct6(), and isc::radius::Exchange::buildRequest().
|
static |
From IPv6 prefix with type.
type | type of attribute. |
len | prefix length. |
value | IPv6 address. |
Definition at line 173 of file client_attribute.cc.
Referenced by isc::radius::RadiusAccounting::buildAcct(), and isc::radius::RadiusAccounting::buildAcct6().
|
static |
From type specific factories.
From string with type.
type | type of attribute. |
value | string value. |
Definition at line 142 of file client_attribute.cc.
References isc_throw.
Referenced by isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct4(), isc::radius::RadiusAccounting::buildAcct6(), isc::radius::RadiusAccess::buildAuth(), and isc::radius::RadiusAccess::buildAuth().
|
static |
From definition generic factories.
From text with definition.
def | pointer to attribute definition. |
value | textual value. |
BadValue | on errors. |
Definition at line 58 of file client_attribute.cc.
References fromInt(), isc::radius::AttrInt::fromText(), isc::radius::AttrIpAddr::fromText(), isc::radius::AttrIpv6Addr::fromText(), isc::radius::AttrIpv6Prefix::fromText(), isc::radius::AttrString::fromText(), isc::radius::AttrDefs::getByName(), isc::radius::AttrDefs::instance(), isc_throw, isc::radius::PW_TYPE_INTEGER, isc::radius::PW_TYPE_IPADDR, isc::radius::PW_TYPE_IPV6ADDR, isc::radius::PW_TYPE_IPV6PREFIX, and isc::radius::PW_TYPE_STRING.
|
static |
Generic factories.
From text.
repr | name=value representation. |
NotFound | if the definition can't be found. |
Definition at line 28 of file client_attribute.cc.
References fromText(), isc::radius::AttrDefs::getByName(), isc::radius::AttrDefs::instance(), isc_throw, and isc::util::str::trim().
Referenced by isc::radius::Attributes::fromElement(), fromText(), and isc::radius::RadiusAttributeParser::parse().
|
inline |
Get type.
Definition at line 58 of file client_attribute.h.
References type_.
Referenced by isc::radius::AttrInt::toBytes(), isc::radius::AttrIpAddr::toBytes(), isc::radius::AttrIpv6Addr::toBytes(), isc::radius::AttrIpv6Prefix::toBytes(), isc::radius::AttrString::toBytes(), 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().
|
pure virtual |
Generic get methods.
Value length.
Implemented in isc::radius::AttrInt, isc::radius::AttrIpAddr, isc::radius::AttrIpv6Addr, isc::radius::AttrIpv6Prefix, and isc::radius::AttrString.
|
pure virtual |
Get value type.
Implemented in isc::radius::AttrInt, isc::radius::AttrIpAddr, isc::radius::AttrIpv6Addr, isc::radius::AttrIpv6Prefix, and isc::radius::AttrString.
Referenced by toBinary(), toInt(), toIpAddr(), toIpv6Addr(), toIpv6Prefix(), toIpv6PrefixLen(), and toString().
|
virtual |
To binary.
TypeError | if the attribute is not a string one. |
Reimplemented in isc::radius::AttrString.
Definition at line 185 of file client_attribute.cc.
References isc::radius::attrValueTypeToText(), getValueType(), and isc_throw.
|
pure virtual |
To bytes (wire format).
Implemented in isc::radius::AttrInt, isc::radius::AttrIpAddr, isc::radius::AttrIpv6Addr, isc::radius::AttrIpv6Prefix, and isc::radius::AttrString.
|
virtual |
To integer.
TypeError | if the attribute is not an integer one. |
Reimplemented in isc::radius::AttrInt.
Definition at line 191 of file client_attribute.cc.
References isc::radius::attrValueTypeToText(), getValueType(), and isc_throw.
|
virtual |
To IPv4 address.
TypeError | if the attribute is not an ipaddr one. |
Reimplemented in isc::radius::AttrIpAddr.
Definition at line 197 of file client_attribute.cc.
References isc::radius::attrValueTypeToText(), getValueType(), and isc_throw.
|
virtual |
To IPv6 address.
TypeError | if the attribute is not an ipv6addr one. |
Reimplemented in isc::radius::AttrIpv6Addr.
Definition at line 203 of file client_attribute.cc.
References isc::radius::attrValueTypeToText(), getValueType(), and isc_throw.
|
virtual |
To IPv6 prefix.
TypeError | if the attribute is not an ipv6prefix one. |
Reimplemented in isc::radius::AttrIpv6Prefix.
Definition at line 209 of file client_attribute.cc.
References isc::radius::attrValueTypeToText(), getValueType(), and isc_throw.
|
virtual |
To IPv6 prefix length.
TypeError | if the attribute is not an ipv6prefix one. |
Reimplemented in isc::radius::AttrIpv6Prefix.
Definition at line 215 of file client_attribute.cc.
References isc::radius::attrValueTypeToText(), getValueType(), and isc_throw.
|
virtual |
Specific get methods.
To string.
TypeError | if the attribute is not a string one. |
Reimplemented in isc::radius::AttrString.
Definition at line 179 of file client_attribute.cc.
References isc::radius::attrValueTypeToText(), getValueType(), and isc_throw.
|
pure virtual |
Returns text representation of the attribute.
indent | number of spaces before printing text. |
Implemented in isc::radius::AttrInt, isc::radius::AttrIpAddr, isc::radius::AttrIpv6Addr, isc::radius::AttrIpv6Prefix, and isc::radius::AttrString.
const uint8_t isc::radius::Attribute::type_ |