 |
Kea
1.5.0
|
Go to the documentation of this file.
26 #include <boost/shared_ptr.hpp>
53 template<
typename ValueType>
67 void setParam(
const std::string& name,
const ValueType& value,
69 values_[name] = value;
70 positions_[name] = position;
81 ValueType
getParam(
const std::string& name)
const {
82 typename std::map<std::string, ValueType>::const_iterator param
85 if (param == values_.end()) {
90 return (param->second);
109 typename std::map<std::string, data::Element::Position>::const_iterator
110 pos = positions_.find(name);
111 if (pos == positions_.end()) {
112 return (parent ? parent->getPosition() :
116 return (pos->second);
130 const ValueType& default_value)
const {
131 typename std::map<std::string, ValueType>::const_iterator param
132 = values_.find(name);
134 if (param == values_.end()) {
135 return (default_value);
138 return (param->second);
149 positions_.erase(name);
161 std::map<std::string, ValueType> values_;
168 std::map<std::string, data::Element::Position> positions_;
173 typedef std::pair<std::string, isc::data::ConstElementPtr>
ConfigPair;
291 const uint16_t address_family);
301 int32_t ptype = 0) = 0;
311 int32_t ptype = 0) = 0;
423 void addAddress(
const std::string& name,
const std::string& address_str,
858 #endif // DHCP_PARSERS_H
void parse(const isc::dhcp::Network::RelayInfoPtr &relay_info, isc::data::ConstElementPtr relay_elem)
parses the actual relay parameters
void parse(CfgOptionDefPtr cfg, isc::data::ConstElementPtr def_list)
Parses a list of option definitions, create them and store in cfg.
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > > >> Subnet6Collection
A collection of Subnet6 objects.
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
To be removed. Please use ConfigError instead.
Parser for IPv6 prefix delegation definitions.
This class parses a single IPv6 subnet.
static Network::HRMode hrModeFromText(const std::string &txt)
Attempts to convert text representation to HRMode enum.
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
virtual void initSubnet(isc::data::ConstElementPtr params, isc::asiolink::IOAddress addr, uint8_t len)=0
Instantiates the subnet based on a given IP prefix and prefix length.
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.
virtual void duplicate_option_warning(uint32_t code, asiolink::IOAddress &addr)
Issues a DHCP6 server specific warning regarding duplicate subnet options.
OptionDefinitionTuple parse(isc::data::ConstElementPtr option_def)
Parses an entry that describes single option definition.
this class parses list of DHCP4 subnets
void parse(PoolStoragePtr pools, data::ConstElementPtr pools_list)
parses the actual structure
The IOAddress class represents an IP addresses (version agnostic)
const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent=data::ConstElementPtr()) const
Returns position of the data element in the configuration string.
PoolStoragePtr pools_
Storage for pools belonging to this subnet.
Parser for IPv4 pool definitions.
virtual ~PoolsListParser()
destructor.
parser for a single pool definition
boost::shared_ptr< BooleanStorage > BooleanStoragePtr
std::vector< SimpleDefault > SimpleDefaults
This specifies all default values in a given scope (e.g. a subnet)
isc::dhcp::Network::RelayInfoPtr relay_info_
Pointer to relay information.
boost::shared_ptr< Network::RelayInfo > RelayInfoPtr
Pointer to the RelayInfo structure.
boost::shared_ptr< Uint32Storage > Uint32StoragePtr
uint16_t address_family_
Address family: AF_INET or AF_INET6.
ValueStorage< std::string > StringStorage
a collection of elements that store string values
PoolPtr poolMaker(asiolink::IOAddress &addr, uint32_t len, int32_t ptype)
Creates a Pool6 object given a IPv6 prefix and the prefix length.
Parser for a list of prefix delegation pools.
Wrapper class that holds MAC/hardware address sources.
void parse(PoolStoragePtr pools, data::ConstElementPtr pools_list)
parses the actual structure
isc::dhcp::SubnetPtr subnet_
Pointer to the created subnet object.
PdPoolParser()
Constructor.
Defines the logger used by the top-level component of kea-dhcp-ddns.
D2ClientConfigPtr parse(isc::data::ConstElementPtr d2_client_cfg)
Parses a given dhcp-ddns element into D2ClientConfig.
ReplaceClientNameMode
Defines the client name replacement modes.
boost::shared_ptr< Pool6 > Pool6Ptr
a pointer an IPv6 Pool
virtual void parse(PoolStoragePtr pools, isc::data::ConstElementPtr pool_structure, const uint16_t address_family)
parses the actual structure
Subnet4Ptr parse(data::ConstElementPtr subnet)
Parses a single IPv4 subnet configuration and adds to the Configuration Manager.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
void delParam(const std::string &name)
Remove the parameter from the store.
Represents the position of the data element within a configuration string.
size_t parse(SrvConfigPtr cfg, data::ConstElementPtr subnets_list)
parses contents of the list
boost::shared_ptr< PoolStorage > PoolStoragePtr
std::vector< PoolPtr > PoolStorage
a collection of pools
This class parses a single IPv4 subnet.
boost::multi_index_container< OptionDescriptor, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< KeyFromKeyExtractor< boost::multi_index::const_mem_fun< Option, uint16_t, &Option::getType >, boost::multi_index::member< OptionDescriptor, OptionPtr, &OptionDescriptor::option_ > > >, boost::multi_index::hashed_non_unique< boost::multi_index::member< OptionDescriptor, bool, &OptionDescriptor::persistent_ > > >> OptionContainer
Multi index container for DHCP option descriptors.
ValueStorage< uint32_t > Uint32Storage
a collection of elements that store uint32 values
virtual ~PoolParser()
destructor.
static const Position & ZERO_POSITION()
Returns Position object with line_ and pos_ set to 0, and with an empty file name.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
void parse(PoolStoragePtr pools, data::ConstElementPtr pd_pool_)
Builds a prefix delegation pool from the given configuration.
OptionSpaceContainer< OptionContainer, OptionDescriptor, std::string > OptionStorage
Collection of containers holding option spaces.
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
Subnet6Ptr parse(data::ConstElementPtr subnet)
Parses a single IPv6 subnet configuration and adds to the Configuration Manager.
std::pair< isc::dhcp::OptionDefinitionPtr, std::string > OptionDefinitionTuple
ValueType getParam(const std::string &name) const
Returns the data value for the given parameter.
boost::shared_ptr< D2ClientConfig > D2ClientConfigPtr
Defines a pointer for D2ClientConfig instances.
void initSubnet(isc::data::ConstElementPtr params, isc::asiolink::IOAddress addr, uint8_t len)
Instantiates the IPv6 Subnet based on a given IPv6 address and prefix length.
void initSubnet(data::ConstElementPtr params, asiolink::IOAddress addr, uint8_t len)
Instantiates the IPv4 Subnet based on a given IPv4 address and prefix length.
Parser for a list of option definitions.
RelayInfoParser(const isc::dhcp::Option::Universe &family)
constructor
void setParam(const std::string &name, const ValueType &value, const data::Element::Position &position)
Stores the the parameter, its value and the position in the store.
Parser for a list of pools.
this class parses a list of DHCP6 subnets
Subnet6ConfigParser()
Constructor.
static size_t setAllDefaults(isc::data::ConstElementPtr d2_config)
Sets all defaults for D2 client configuration.
virtual PoolPtr poolMaker(isc::asiolink::IOAddress &min, isc::asiolink::IOAddress &max, int32_t ptype=0)=0
Creates a Pool object given starting and ending IP addresses.
std::pair< std::string, isc::data::ConstElementPtr > ConfigPair
Combination of parameter name and configuration contents.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
void parse(PoolStoragePtr pools, data::ConstElementPtr pd_pool_list)
Parse configuration entries.
virtual PoolPtr poolMaker(isc::asiolink::IOAddress &addr, uint32_t len, int32_t ptype=0)=0
Creates a Pool object given a IPv4 prefix and the prefix length.
Parser for IPv6 pool definitions.
HRMode
Specifies allowed host reservation mode.
void clear()
Deletes all of the entries from the store.
ValueType getOptionalParam(const std::string &name, const ValueType &default_value) const
Returns the data value for an optional parameter.
boost::shared_ptr< OptionStorage > OptionStoragePtr
Shared pointer to option storage.
Subnet4ConfigParser()
Constructor.
Specialization of the pool list parser for DHCPv6.
void parse(SrvConfig &srv_cfg, isc::data::ConstElementPtr value)
"Parses" control-socket structure
SubnetPtr parse(isc::data::ConstElementPtr subnet)
parses a subnet description and returns Subnet{4,6} structure
Parser for D2ClientConfig.
parser for MAC/hardware acquisition sources
boost::shared_ptr< CfgOption > CfgOptionPtr
Non-const pointer.
Universe
defines option universe DHCPv4 or DHCPv6
Specifies current DHCP configuration.
PoolPtr poolMaker(asiolink::IOAddress &addr, uint32_t len, int32_t ignored)
Creates a Pool4 object given a IPv4 prefix and the prefix length.
boost::shared_ptr< const Element > ConstElementPtr
this class parses a single subnet
Parser for a single option definition.
ValueStorage< bool > BooleanStorage
Storage for parsed boolean values.
Parser for the control-socket structure.
boost::shared_ptr< StringStorage > StringStoragePtr
static const isc::data::SimpleDefaults D2_CLIENT_CONFIG_DEFAULTS
Defaults for the D2 client configuration.
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
parser for additional relay information
CfgOptionPtr options_
Pointer to the options configuration.
A template class that stores named elements of a given data type.
virtual ~SubnetConfigParser()
virtual destructor (does nothing)
size_t parse(SrvConfigPtr cfg, data::ConstElementPtr subnets_list)
parses contents of the list
NameChangeFormat
Defines the list of data wire formats supported.
Specialization of the pool list parser for DHCPv4.
void parse(CfgMACSource &mac_sources, isc::data::ConstElementPtr value)
parses parameters value
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetServerIdIndexTag >, boost::multi_index::const_mem_fun< Network4, asiolink::IOAddress, &Network4::getServerId > > >> Subnet4Collection
A collection of Subnet4 objects.
virtual void parse(PoolStoragePtr pools, isc::data::ConstElementPtr pools_list)=0
parses the actual structure
NameChangeProtocol
Defines the list of socket protocols supported.
SubnetConfigParser(uint16_t family)
constructor