Kea 2.7.6
isc::dhcp::RelayInfoParser Class Reference

parser for additional relay information More...

#include <dhcp_parsers.h>

+ Inheritance diagram for isc::dhcp::RelayInfoParser:

Public Member Functions

 RelayInfoParser (const isc::dhcp::Option::Universe &family)
 constructor
 
void addAddress (const std::string &name, const std::string &address_str, isc::data::ConstElementPtr relay_elem, const isc::dhcp::Network::RelayInfoPtr &relay_info)
 Attempts to add an IP address to list of relay addresses.
 
void parse (const isc::dhcp::Network::RelayInfoPtr &relay_info, isc::data::ConstElementPtr relay_elem)
 parses the actual relay parameters
 
- Public Member Functions inherited from isc::data::SimpleParser
uint16_t getUint16 (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a value converted to uint16_t.
 
uint32_t getUint32 (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a value converted to uint32_t.
 
uint8_t getUint8 (ConstElementPtr scope, const std::string &name)
 Get an uint8_t value.
 
const isc::util::Triplet< uint32_t > parseIntTriplet (const data::ConstElementPtr &scope, const std::string &name)
 Parses an integer triplet.
 

Additional Inherited Members

- Static Public Member Functions inherited from isc::data::SimpleParser
static void checkKeywords (const SimpleKeywords &keywords, isc::data::ConstElementPtr scope)
 Checks acceptable keywords with their expected type.
 
static void checkRequired (const SimpleRequiredKeywords &required, isc::data::ConstElementPtr scope)
 Checks that all required keywords are present.
 
static size_t deriveParams (isc::data::ConstElementPtr parent, isc::data::ElementPtr child, const ParamsList &params)
 Derives (inherits) parameters from parent scope to a child.
 
static isc::asiolink::IOAddress getAddress (const ConstElementPtr &scope, const std::string &name)
 Returns a IOAddress parameter from a scope.
 
static bool getBoolean (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a boolean parameter from a scope.
 
static double getDouble (const ConstElementPtr &scope, const std::string &name)
 Returns a floating point parameter from a scope.
 
static int64_t getInteger (isc::data::ConstElementPtr scope, const std::string &name)
 Returns an integer parameter from a scope.
 
static int64_t getInteger (isc::data::ConstElementPtr scope, const std::string &name, int64_t min, int64_t max)
 Returns an integer parameter from a scope and checks its range.
 
static const data::Element::PositiongetPosition (const std::string &name, const data::ConstElementPtr parent)
 Utility method that returns position of an element.
 
static std::string getString (isc::data::ConstElementPtr scope, const std::string &name)
 Returns a string parameter from a scope.
 
static size_t setDefaults (isc::data::ElementPtr scope, const SimpleDefaults &default_values)
 Sets the default values.
 
static size_t setListDefaults (isc::data::ConstElementPtr list, const SimpleDefaults &default_values)
 Sets the default values for all entries in a list.
 
- Protected Member Functions inherited from isc::data::SimpleParser
template<typename target_type , target_type convert>
target_type getAndConvert (isc::data::ConstElementPtr scope, const std::string &name, const std::string &type_name)
 Returns a converted value from a scope.
 
template<typename int_type >
int_type getIntType (isc::data::ConstElementPtr scope, const std::string &name)
 Returns an integer value with range checking from a scope.
 

Detailed Description

parser for additional relay information

This concrete parser handles RelayInfo structure definitions. So far that structure holds only relay IP (v4 or v6) address, but it is expected that the number of parameters will increase over time.

It is useful for parsing Dhcp<4/6>/subnet<4/6>[x]/relay parameters.

Definition at line 449 of file dhcp_parsers.h.

Constructor & Destructor Documentation

◆ RelayInfoParser()

isc::dhcp::RelayInfoParser::RelayInfoParser ( const isc::dhcp::Option::Universe & family)
explicit

constructor

Parameters
familyspecifies protocol family (IPv4 or IPv6)

Definition at line 304 of file dhcp_parsers.cc.

Member Function Documentation

◆ addAddress()

void isc::dhcp::RelayInfoParser::addAddress ( const std::string & name,
const std::string & address_str,
isc::data::ConstElementPtr relay_elem,
const isc::dhcp::Network::RelayInfoPtr & relay_info )

Attempts to add an IP address to list of relay addresses.

Parameters
namename of the element supplying the address string, (either "ip-address" or "ip-addresses")
address_strstring form of the IP address to add
relay_elemparent relay element (needed for position info)
relay_infoRelayInfo to which the address should be added
Exceptions
isc::dhcp::DhcpConfigErrorif the address string is not a valid IP address, is an address of the wrong family, or is already in the relay address list

Definition at line 336 of file dhcp_parsers.cc.

References isc::data::SimpleParser::getPosition(), isc_throw, isc::dhcp::Option::V4, and isc::dhcp::Option::V6.

Referenced by parse().

+ Here is the call graph for this function:

◆ parse()

void isc::dhcp::RelayInfoParser::parse ( const isc::dhcp::Network::RelayInfoPtr & relay_info,
isc::data::ConstElementPtr relay_elem )

parses the actual relay parameters

The elements currently supported are:

  1. ip-address
  2. ip-addresses

Note that ip-address and ip-addresses are mutually exclusive, with former being deprecated. The use of ip-address will cause an debug log to be emitted, reminded users to switch.

Parameters
relay_infoconfiguration will be stored here
relay_elemElement tree containing the relay and its members
Exceptions
isc::dhcp::DhcpConfigErrorif both or neither of ip-address and ip-addresses are specified.

Definition at line 309 of file dhcp_parsers.cc.

References addAddress(), isc::data::SimpleParser::getPosition(), isc_throw, isc::data::Element::list, and isc::data::Element::map.

Referenced by isc::dhcp::SharedNetwork4Parser::parse(), isc::dhcp::SharedNetwork6Parser::parse(), and isc::dhcp::SubnetConfigParser::parse().

+ Here is the call graph for this function:

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