13#include <boost/pointer_cast.hpp>
29 addresses_.push_back(addr);
34 return (!addresses_.empty());
40 return (index.find(addr) != index.end());
98 const int global_index,
106 std::string global_str = global_param->stringValue();
107 if (!global_str.empty()) {
131 for (
auto const& address : addresses) {
135 relay_map->set(
"ip-addresses", address_list);
136 map->set(
"relay", relay_map);
145 if (!classes.empty()) {
147 for (
auto const& it : classes) {
150 map->set(
"evaluate-additional-classes", class_list);
157 map->set(
"renew-timer",
163 map->set(
"rebind-timer",
169 map->set(
"valid-lifetime",
171 map->set(
"min-valid-lifetime",
173 map->set(
"max-valid-lifetime",
179 map->set(
"reservations-global",
185 map->set(
"reservations-in-subnet",
191 map->set(
"reservations-out-of-pool",
197 map->set(
"option-data", opts->toElement());
225 map->set(
"ddns-replace-client-name",
259 map->set(
"cache-max-age",
280 if (!siaddr.get().isV4()) {
294 filename_ = filename;
302 if (!match_client_id_.unspecified()) {
307 if (!authoritative_.unspecified()) {
312 if (!siaddr_.unspecified()) {
317 if (!sname_.unspecified()) {
322 if (!filename_.unspecified()) {
327 if (!offer_lft_.unspecified()) {
337 OptionCustomPtr opt_server_id = boost::dynamic_pointer_cast<OptionCustom>
340 return (opt_server_id->readAddress());
342 }
catch (
const std::exception&) {
354 if (!preferred_.unspecified()) {
355 map->set(
"preferred-lifetime",
357 map->set(
"min-preferred-lifetime",
359 map->set(
"max-preferred-lifetime",
365 std::vector<uint8_t> bin = interface_id_->getData();
367 ifid.resize(bin.size());
369 std::memcpy(&ifid[0], &bin[0], bin.size());
375 if (!rapid_commit_.unspecified()) {
380 if (!pd_allocator_type_.unspecified()) {
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
The IOAddress class represents an IP addresses (version agnostic)
static const IOAddress & IPV4_ZERO_ADDRESS()
Returns an address set to all zeros.
std::string toText() const
Convert the address to a string.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Container for storing client class names.
bool contains(const ClientClass &x) const
returns if class x belongs to the defined classes
void insert(const ClientClass &class_name)
Insert an element.
Acts as a storage vault for D2 client configuration.
void setSiaddr(const util::Optional< asiolink::IOAddress > &siaddr)
Sets siaddr for the network.
void setFilename(const util::Optional< std::string > &filename)
Sets boot file name for the network.
virtual asiolink::IOAddress getServerId() const
Returns binary representation of the dhcp-server-identifier option (54).
virtual data::ElementPtr toElement() const
Unparses network object.
void setSname(const util::Optional< std::string > &sname)
Sets server hostname for the network.
virtual data::ElementPtr toElement() const
Unparses network object.
const IOAddressList & getAddresses() const
Returns const reference to the list of addresses.
void addAddress(const asiolink::IOAddress &addr)
Adds an address to the list of addresses.
bool containsAddress(const asiolink::IOAddress &addr) const
Checks the address list for the given address.
bool hasAddresses() const
Indicates whether or not the address list has entries.
virtual bool clientSupported(const isc::dhcp::ClientClasses &client_classes) const
Checks whether this network supports client that belongs to specified classes.
isc::util::Triplet< uint32_t > t2_
a isc::util::Triplet (min/default/max) holding allowed rebind timer values
void addRelayAddress(const asiolink::IOAddress &addr)
Adds an address to the list addresses in the network's relay info.
util::Optional< std::string > hostname_char_replacement_
A string to replace invalid characters when scrubbing hostnames.
RelayInfo relay_
Relay information.
util::Optional< bool > reservations_out_of_pool_
Enables out-of-pool reservations optimization.
util::Optional< bool > ddns_update_on_renew_
Should Kea perform updates when leases are extended.
util::Optional< std::string > allocator_type_
Allocator used for IP address allocations.
CfgOptionPtr cfg_option_
Pointer to the option data configuration for this subnet.
const IOAddressList & getRelayAddresses() const
Returns the list of relay addresses from the network's relay info.
ClientClasses additional_classes_
Additional classes.
void allowClientClass(const isc::dhcp::ClientClass &class_name)
Sets the supported class to class class_name.
util::Optional< bool > reservations_global_
Enables global reservations.
util::Optional< bool > ddns_override_client_update_
Should Kea perform updates, even if client requested delegation.
util::Optional< bool > reservations_in_subnet_
Enables subnet reservations.
FetchNetworkGlobalsFn fetch_globals_fn_
Pointer to the optional callback used to fetch globally configured parameters inherited to the Networ...
util::Optional< double > t2_percent_
Percentage of the lease lifetime to use when calculating T2 timer.
util::Optional< std::string > ddns_generated_prefix_
Prefix Kea should use when generating domain-names.
util::Optional< double > t1_percent_
Percentage of the lease lifetime to use when calculating T1 timer.
bool hasRelays() const
Indicates if network's relay info has relay addresses.
util::Optional< ClientClass > client_class_
Optional definition of a client class.
virtual data::ElementPtr toElement() const
Unparses network object.
util::Optional< std::string > hostname_char_set_
Regular expression describing invalid characters for client hostnames.
bool hasRelayAddress(const asiolink::IOAddress &address) const
Tests if the network's relay info contains the given address.
void addAdditionalClass(const isc::dhcp::ClientClass &class_name)
Adds class class_name to the additional classes list.
util::Optional< std::string > iface_name_
Holds interface name for which this network is selected.
util::Optional< bool > ddns_send_updates_
Should Kea perform DNS updates.
util::Optional< std::string > ddns_conflict_resolution_mode_
DDNS conflict resolution mode.
util::Optional< bool > store_extended_info_
Should Kea store additional client query data (e.g.
isc::util::Triplet< uint32_t > valid_
a isc::util::Triplet (min/default/max) holding allowed valid lifetime values
const ClientClasses & getAdditionalClasses() const
Returns the additional classes list.
util::Optional< bool > calculate_tee_times_
Enables calculation of T1 and T2 timers.
util::Optional< uint32_t > cache_max_age_
Value in seconds to use as cache maximal age.
ReturnType getGlobalProperty(ReturnType property, const int global_index, const int min_index=-1, const int max_index=-1) const
Returns a value of global configuration parameter with a given index.
util::Optional< bool > ddns_override_no_update_
Should Kea perform updates, even if client requested no updates.
util::Optional< std::string > ddns_qualifying_suffix_
Suffix Kea should use when to qualify partial domain-names.
util::Optional< double > ddns_ttl_percent_
Percentage of the lease lifetime to use for DNS TTL.
util::Optional< D2ClientConfig::ReplaceClientNameMode > ddns_replace_client_name_mode_
How Kea should handle the domain-name supplied by the client.
isc::util::Triplet< uint32_t > t1_
a isc::util::Triplet (min/default/max) holding allowed renew timer values
CfgOptionPtr getCfgOption()
Returns pointer to the option data configuration for this network.
util::Optional< double > cache_threshold_
Percentage of the lease lifetime to use as cache threshold.
T get() const
Retrieves the encapsulated value.
bool empty() const
Checks if the encapsulated value is empty.
void unspecified(bool unspecified)
Modifies the flag that indicates whether the value is specified or unspecified.
T get(T hint) const
Returns value with a hint.
T getMax() const
Returns a maximum allowed value.
T getMin() const
Returns a minimum allowed value.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
std::string ClientClass
Defines a single class name.
boost::shared_ptr< const CfgGlobals > ConstCfgGlobalsPtr
Const shared pointer to a CfgGlobals instance.
@ DHO_DHCP_SERVER_IDENTIFIER
boost::shared_ptr< OptionCustom > OptionCustomPtr
A pointer to the OptionCustom object.
boost::multi_index_container< asiolink::IOAddress, boost::multi_index::indexed_by< boost::multi_index::sequenced< boost::multi_index::tag< IOAddressListListTag > >, boost::multi_index::hashed_unique< boost::multi_index::tag< IOAddressListSetTag >, boost::multi_index::identity< asiolink::IOAddress > > > > IOAddressList
List of IO addresses.
boost::shared_ptr< const CfgOption > ConstCfgOptionPtr
Const pointer.
Defines the logger used by the top-level component of kea-lfc.
#define DHCP4_OPTION_SPACE
global std option spaces
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
Tag for the list of IO addresses as a set.