13#include <boost/pointer_cast.hpp>
29 addresses_.push_back(addr);
34 return (!addresses_.empty());
40 return (index.find(addr) != index.end());
94 const int global_index,
102 std::string global_str = global_param->stringValue();
103 if (!global_str.empty()) {
127 for (
auto const& address : addresses) {
131 relay_map->set(
"ip-addresses", address_list);
132 map->set(
"relay", relay_map);
141 map->set(
"evaluate-additional-classes",
149 map->set(
"renew-timer",
155 map->set(
"rebind-timer",
161 map->set(
"valid-lifetime",
163 map->set(
"min-valid-lifetime",
165 map->set(
"max-valid-lifetime",
171 map->set(
"reservations-global",
177 map->set(
"reservations-in-subnet",
183 map->set(
"reservations-out-of-pool",
189 map->set(
"option-data", opts->toElement());
217 map->set(
"ddns-replace-client-name",
263 map->set(
"cache-max-age",
284 if (!siaddr.
get().isV4()) {
298 filename_ = filename;
306 if (!match_client_id_.unspecified()) {
311 if (!authoritative_.unspecified()) {
316 if (!siaddr_.unspecified()) {
321 if (!sname_.unspecified()) {
326 if (!filename_.unspecified()) {
331 if (!offer_lft_.unspecified()) {
341 OptionCustomPtr opt_server_id = boost::dynamic_pointer_cast<OptionCustom>
344 return (opt_server_id->readAddress());
346 }
catch (
const std::exception&) {
358 if (!preferred_.unspecified()) {
359 map->set(
"preferred-lifetime",
361 map->set(
"min-preferred-lifetime",
363 map->set(
"max-preferred-lifetime",
369 std::vector<uint8_t> bin = interface_id_->getData();
371 ifid.resize(bin.size());
373 std::memcpy(&ifid[0], &bin[0], bin.size());
379 if (!rapid_commit_.unspecified()) {
384 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.
bool empty() const
Check if classes is empty.
virtual isc::data::ElementPtr toElement() const
Returns all class names as an ElementPtr of type ListElement.
bool intersects(const ClientClasses &cclasses) const
returns whether this container has at least one class in common with a given container.
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 a client that belongs to the 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)
Adds class clas_name to the allowed client classes list.
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.
ClientClasses client_classes_
List of client classes allowed to use this network.
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< uint32_t > ddns_ttl_min_
Minimum value to use for DNS TTL.
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
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< uint32_t > ddns_ttl_max_
Maximum value to use for DNS TTL.
util::Optional< double > ddns_ttl_percent_
Percentage of the lease lifetime to use for DNS TTL.
util::Optional< uint32_t > ddns_ttl_
Explicit value 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.
A template representing an optional value.
T get() const
Retrieves the encapsulated value.
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.