12#include <boost/lexical_cast.hpp> 
   26    switch (
static_cast<uint8_t
>(value)) {
 
   36        return (
"ipv6prefix");
 
 
   45    if (name == 
"string") {
 
   47    } 
else if ((name == 
"integer") || (name == 
"date")) {
 
   49    } 
else if (name == 
"ipaddr") {
 
   51    } 
else if (name == 
"ipv6addr") {
 
   53    } 
else if (name == 
"ipv6prefix") {
 
 
   69    auto it = idx.find(type);
 
   70    if (it != idx.end()) {
 
 
   79    auto it = idx.find(name);
 
   80    if (it != idx.end()) {
 
   85        auto ita = idx.find(alias->second);
 
   86        if (ita != idx.end()) {
 
 
   99    auto it1 = idx1.find(def->name_);
 
  100    if (it1 != idx1.end()) {
 
  101        if ((def->type_ == (*it1)->type_) &&
 
  102            (def->value_type_ == (*it1)->value_type_)) {
 
  107                  << 
"' type " << 
static_cast<unsigned>((*it1)->type_)
 
  109                  << 
" by " << 
static_cast<unsigned>(def->type_)
 
  113    auto it0 = idx0.find(def->type_);
 
  114    if (it0 != idx0.end()) {
 
  115        if (def->value_type_ == (*it0)->value_type_) {
 
  117            auto p = pair<string, string>(def->name_, (*it0)->name_);
 
  118            static_cast<void>(
aliases_.insert(p));
 
  122                  << (*it0)->name_ << 
"' type " 
  123                  << 
static_cast<unsigned>((*it0)->type_) << 
" value type " 
  125                  << 
" by '" << def->name_ << 
"' " 
  126                  << 
static_cast<unsigned>(def->type_) << 
" " 
 
  139    oss << 
"Attribute-" << 
static_cast<unsigned>(type);
 
 
  146    auto it = idx.find(boost::make_tuple(type, name));
 
  147    if (it != idx.end()) {
 
 
  156    auto it = idx.find(boost::make_tuple(type, value));
 
  157    if (it != idx.end()) {
 
 
  169    auto it = idx.find(boost::make_tuple(def->type_, def->name_));
 
  170    if (it != idx.end()) {
 
  171        if (def->value_ == (*it)->value_) {
 
  176                  << def->name_ << 
"' for attribute '" << 
getName(def->type_)
 
  177                  << 
"' value " << (*it)->value_ << 
" by " << def->value_);
 
 
  190    if (line[0] == 
'#') {
 
  196    if (tokens.empty()) {
 
  200    if (tokens[0] == 
"ATTRIBUTE") {
 
  201        if (tokens.size() != 4) {
 
  204        const string& name = tokens[1];
 
  205        const string& type_str = tokens[2];
 
  208            int64_t type64 = boost::lexical_cast<int64_t>(type_str);
 
  210            if ((type64 < numeric_limits<uint8_t>::min()) ||
 
  211                (type64 > numeric_limits<uint8_t>::max())) {
 
  214            type = 
static_cast<uint8_t
>(type64);
 
  224    if (tokens[0] == 
"VALUE") {
 
  225        if (tokens.size() != 4) {
 
  228        const string& attr_str = tokens[1];
 
  235                      << 
"' is not an integer attribute");
 
  237        const string& name = tokens[2];
 
  238        const string& value_str = tokens[3];
 
  241            int64_t val = boost::lexical_cast<int64_t>(value_str);
 
  242            if ((val < numeric_limits<int32_t>::min()) ||
 
  243                (val > numeric_limits<uint32_t>::max())) {
 
  246            value = 
static_cast<uint32_t
>(val);
 
 
  260    if (!ifs.is_open()) {
 
  270    } 
catch (
const exception& ex) {
 
 
  289    } 
catch (
const exception& ex) {
 
 
  296    for (
auto const& it : defs) {
 
  303        if (def->type_ != it.type_) {
 
  305                      << 
"for '" << it.name_ << 
"': type is " 
  306                      << 
static_cast<unsigned>(def->type_) << 
", must be " 
  307                      << 
static_cast<unsigned>(it.type_));
 
  309        if (def->value_type_ != it.value_type_) {
 
  311                      << 
"for '" << it.name_ << 
"': value type is " 
 
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
A generic exception that is thrown when an unexpected error condition occurs.
RADIUS attribute definition.
void add(AttrDefPtr def)
Add (or replace) an attribute definition.
static AttrDefs & instance()
Returns a single instance.
void readDictionary(const std::string &path)
Read a dictionary from a file.
AttrDefContainer container_
Attribute definition container.
AttrDefPtr getByName(const std::string &name) const
Get attribute definition by name.
IntCstDefContainer ic_container_
Integer constant definition container.
AttrDefAliases aliases_
Attribute aliases.
std::string getName(const uint8_t type) const
Get attribute 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.
void parseLine(const std::string &line)
Parse a dictionary line.
void checkStandardDefs(const AttrDefList &defs) const
Check if a list of standard attribute definitions are available and correct.
RADIUS integer constant definitions.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< IntCstDef > IntCstDefPtr
Shared pointers to Integer constant definition.
std::list< AttrDef > AttrDefList
List of Attribute definitions.
AttrValueType
Attribute value types.
boost::shared_ptr< AttrDef > AttrDefPtr
Shared pointers to Attribute definition.
AttrValueType textToAttrValueType(const string &name)
AttrValueType name -> value function.
string attrValueTypeToText(const AttrValueType value)
AttrValueType value -> name function.
vector< string > tokens(const string &text, const string &delim, bool escape)
Split string into tokens.
Defines the logger used by the top-level component of kea-lfc.