13#include <boost/pointer_cast.hpp>
28 addresses_.push_back(addr);
33 return (!addresses_.empty());
38 for (
auto address = addresses_.begin(); address != addresses_.end();
40 if ((*address) == addr) {
109 const std::string& iface =
getIface();
110 if (!iface.empty()) {
117 for (
auto address = addresses.begin(); address != addresses.end(); ++address) {
121 relay_map->set(
"ip-addresses", address_list);
122 map->set(
"relay", relay_map);
126 if (!cclass.empty()) {
132 if (!classes.
empty()) {
135 it != classes.
cend(); ++it) {
138 map->set(
"require-client-classes", class_list);
144 if (!
getT1().unspecified()) {
145 map->set(
"renew-timer",
150 if (!
getT2().unspecified()) {
151 map->set(
"rebind-timer",
157 map->set(
"valid-lifetime",
170 mode =
"out-of-pool";
180 "invalid host reservation mode: " << hrmode);
186 map->set(
"option-data", opts->toElement());
207 OptionCustomPtr opt_server_id = boost::dynamic_pointer_cast<OptionCustom>
210 return (opt_server_id->readAddress());
212 }
catch (
const std::exception&) {
224 map->set(
"preferred-lifetime",
226 (getPreferred().get())));
229 const OptionPtr& ifaceid = getInterfaceId();
231 std::vector<uint8_t> bin = ifaceid->getData();
233 ifid.resize(bin.size());
235 std::memcpy(&ifid[0], &bin[0], bin.size());
241 bool rapid_commit = getRapidCommit();
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.
std::list< ClientClass >::const_iterator const_iterator
Type of iterators.
bool empty() const
Check if classes is empty.
const_iterator cbegin() const
Iterator to the first element.
const_iterator cend() const
Iterator to the past the end element.
virtual asiolink::IOAddress getServerId() const
Returns binary representation of the dhcp-server-identifier option (54).
virtual data::ElementPtr toElement() const
Unparses network object.
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.
void addRelayAddress(const asiolink::IOAddress &addr)
Adds an address to the list addresses in the network's relay info.
RelayInfo relay_
Relay information.
HRMode
Specifies allowed host reservation mode.
@ HR_DISABLED
None - host reservation is disabled.
@ HR_OUT_OF_POOL
Only out-of-pool reservations is allowed.
@ HR_GLOBAL
Only global reservations are allowed.
@ HR_ALL
Both out-of-pool and in-pool reservations are allowed.
Triplet< uint32_t > getValid() const
Return valid-lifetime for addresses in that prefix.
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.
bool hasRelays() const
Indicates if network's relay info has relay addresses.
const isc::dhcp::ClientClass & getClientClass() const
returns the client class
std::string getIface() const
Returns name of the local interface for which this network is selected.
HRMode getHostReservationMode() const
Specifies what type of Host Reservations are supported.
virtual data::ElementPtr toElement() const
Unparses network object.
bool hasRelayAddress(const asiolink::IOAddress &address) const
Tests if the network's relay info contains the given address.
Triplet< uint32_t > getT2() const
Returns T2 (rebind timer), expressed in seconds.
const isc::dhcp::ClientClasses & getRequiredClasses() const
Returns classes which are required to be evaluated.
ClientClass client_class_
Optional definition of a client class.
ClientClasses required_classes_
Required classes.
Triplet< uint32_t > getT1() const
Returns T1 (renew timer), expressed in seconds.
CfgOptionPtr getCfgOption()
Returns pointer to the option data configuration for this subnet.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< Element > ElementPtr
std::string ClientClass
Defines a single class name.
@ 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< Option > OptionPtr
boost::shared_ptr< const CfgOption > ConstCfgOptionPtr
Const pointer.
Defines the logger used by the top-level component of kea-dhcp-ddns.
#define DHCP4_OPTION_SPACE
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.