13#include <boost/pointer_cast.hpp>
29 addresses_.push_back(addr);
34 return (!addresses_.empty());
39 for (
auto address = addresses_.begin(); address != addresses_.end();
41 if ((*address) == addr) {
104 const int global_index,
112 std::string global_str = global_param->stringValue();
113 if (!global_str.empty()) {
137 for (
auto address = addresses.begin(); address != addresses.end(); ++address) {
141 relay_map->set(
"ip-addresses", address_list);
142 map->set(
"relay", relay_map);
151 if (!classes.
empty()) {
154 it != classes.
cend(); ++it) {
157 map->set(
"require-client-classes", class_list);
164 map->set(
"renew-timer",
170 map->set(
"rebind-timer",
176 map->set(
"valid-lifetime",
178 map->set(
"min-valid-lifetime",
180 map->set(
"max-valid-lifetime",
186 map->set(
"reservations-global",
192 map->set(
"reservations-in-subnet",
198 map->set(
"reservations-out-of-pool",
204 map->set(
"option-data", opts->toElement());
232 map->set(
"ddns-replace-client-name",
262 map->set(
"cache-max-age",
279 if (!siaddr.
get().isV4()) {
293 filename_ = filename;
301 if (!match_client_id_.unspecified()) {
306 if (!authoritative_.unspecified()) {
311 if (!siaddr_.unspecified()) {
316 if (!sname_.unspecified()) {
321 if (!filename_.unspecified()) {
331 OptionCustomPtr opt_server_id = boost::dynamic_pointer_cast<OptionCustom>
334 return (opt_server_id->readAddress());
336 }
catch (
const std::exception&) {
348 if (!preferred_.unspecified()) {
349 map->set(
"preferred-lifetime",
351 map->set(
"min-preferred-lifetime",
353 map->set(
"max-preferred-lifetime",
359 std::vector<uint8_t> bin = interface_id_->getData();
361 ifid.resize(bin.size());
363 std::memcpy(&ifid[0], &bin[0], bin.size());
369 if (!rapid_commit_.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.
ClientClassContainer::const_iterator const_iterator
Type of iterators.
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.
const_iterator cbegin() const
Iterators to the first element.
const_iterator cend() const
Iterators to the past the end 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.
CfgOptionPtr cfg_option_
Pointer to the option data configuration for this subnet.
void requireClientClass(const isc::dhcp::ClientClass &class_name)
Adds class class_name to classes required to be evaluated.
const IOAddressList & getRelayAddresses() const
Returns the list of relay addresses from the network's relay info.
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.
util::Optional< std::string > iface_name_
Holds interface name for which this network is selected.
const ClientClasses & getRequiredClasses() const
Returns classes which are required to be evaluated.
util::Optional< bool > ddns_send_updates_
Should Kea perform DNS updates.
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< bool > ddns_use_conflict_resolution_
Used to to tell kea-dhcp-ddns whether or not to use conflict resolution.
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.
ClientClasses required_classes_
Required classes.
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.
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.
std::vector< isc::asiolink::IOAddress > IOAddressList
List of IOAddresses.
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.