![]() |
Kea 3.1.3
|
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 uint32_t | toVendorId () const |
To vendor id. | |
virtual std::vector< uint8_t > | toVsaData () const |
To vsa data. | |
![]() | |
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 (handle vendor). | |
static AttributePtr | fromBytes (const std::vector< uint8_t > &bytes) |
Generic factories. | |
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 | fromVsa (const uint8_t type, const uint32_t vendor, const std::string &value) |
From Vendor ID and string data with type. | |
static AttributePtr | fromVsa (const uint8_t type, const uint32_t vendor, const std::vector< uint8_t > &value) |
From Vendor ID and binary data with type. | |
Public Attributes | |
const uint8_t | type_ |
Type. | |
Protected Member Functions | |
Attribute (const uint8_t type) | |
Constructor. | |
RADIUS attribute base class.
Definition at line 43 of file client_attribute.h.
|
inlineexplicitprotected |
Constructor.
Called from derived classes.
type | attribute type. |
Definition at line 51 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 147 of file client_attribute.cc.
References isc_throw.
Referenced by isc::radius::Message::decodeUserPassword(), and isc::radius::Message::encodeUserPassword().
|
static |
From bytes with definition (handle vendor).
Handle Vendor-Specific encapsulation.
def | pointer to attribute definition. |
value | binary value. |
BadValue | on errors. |
Definition at line 100 of file client_attribute.cc.
References fromVsa(), isc_throw, and isc::radius::PW_VENDOR_SPECIFIC.
|
static |
Generic factories.
From bytes (wire format).
bytes | binary attribute. |
BadValue | on errors other than the definition can't be found. |
Definition at line 75 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 155 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(), and isc::radius::Exchange::buildRequest().
|
static |
From IPv4 address with type.
type | type of attribute. |
value | IPv4 address. |
Definition at line 160 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 165 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 170 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 139 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 (handle vendor).
Handle Vendor-Specific encapsulation.
def | pointer to attribute definition. |
value | textual value. |
BadValue | on errors. |
Definition at line 28 of file client_attribute.cc.
References fromVsa(), isc_throw, and isc::radius::PW_VENDOR_SPECIFIC.
Referenced by isc::radius::Attributes::fromElement(), and isc::radius::RadiusAttributeParser::parse().
|
static |
From Vendor ID and string data with type.
type | type of attribute. |
vendor | vendor id. |
value | vsa data. |
Definition at line 176 of file client_attribute.cc.
Referenced by fromBytes(), and fromText().
|
static |
From Vendor ID and binary data with type.
type | type of attribute. |
vendor | vendor id. |
value | vsa data. |
Definition at line 182 of file client_attribute.cc.
|
inline |
Get type.
Definition at line 61 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::AttrVsa::toBytes(), isc::radius::AttrInt::toElement(), isc::radius::AttrIpAddr::toElement(), isc::radius::AttrIpv6Addr::toElement(), isc::radius::AttrIpv6Prefix::toElement(), isc::radius::AttrString::toElement(), isc::radius::AttrVsa::toElement(), isc::radius::AttrInt::toText(), isc::radius::AttrIpAddr::toText(), isc::radius::AttrIpv6Addr::toText(), isc::radius::AttrIpv6Prefix::toText(), isc::radius::AttrString::toText(), and isc::radius::AttrVsa::toText().
|
pure virtual |
Generic get methods.
Value length.
Implemented in isc::radius::AttrInt, isc::radius::AttrIpAddr, isc::radius::AttrIpv6Addr, isc::radius::AttrIpv6Prefix, isc::radius::AttrString, and isc::radius::AttrVsa.
|
pure virtual |
Get value type.
Implemented in isc::radius::AttrInt, isc::radius::AttrIpAddr, isc::radius::AttrIpv6Addr, isc::radius::AttrIpv6Prefix, isc::radius::AttrString, and isc::radius::AttrVsa.
Referenced by toBinary(), toInt(), toIpAddr(), toIpv6Addr(), toIpv6Prefix(), toIpv6PrefixLen(), toString(), toVendorId(), and toVsaData().
|
virtual |
To binary.
TypeError | if the attribute is not a string one. |
Reimplemented in isc::radius::AttrString.
Definition at line 194 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, isc::radius::AttrString, and isc::radius::AttrVsa.
|
virtual |
To integer.
TypeError | if the attribute is not an integer one. |
Reimplemented in isc::radius::AttrInt.
Definition at line 200 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 206 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 212 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 218 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 224 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 188 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, isc::radius::AttrString, and isc::radius::AttrVsa.
|
virtual |
To vendor id.
TypeError | if the attribute is not a vsa one. |
Reimplemented in isc::radius::AttrVsa.
Definition at line 230 of file client_attribute.cc.
References isc::radius::attrValueTypeToText(), getValueType(), and isc_throw.
|
virtual |
To vsa data.
TypeError | if the attribute is not a vsa one. |
Reimplemented in isc::radius::AttrVsa.
Definition at line 236 of file client_attribute.cc.
References isc::radius::attrValueTypeToText(), getValueType(), and isc_throw.
const uint8_t isc::radius::Attribute::type_ |