18 #include <boost/shared_ptr.hpp>
19 #include <boost/algorithm/string.hpp>
32 const size_t ADDRESS6_TEXT_MAX_LEN = 39;
42 const size_t HOSTNAME_MAX_LEN = 255;
82 AuthKey(
const std::vector<uint8_t>& key);
92 AuthKey(
const std::string& key);
113 void setAuthKey(
const std::vector<uint8_t>& key);
134 std::string
toText()
const;
150 std::vector<uint8_t> authKey_;
187 const uint8_t prefix_len = 128);
196 return (prefix_len_);
217 const uint8_t prefix_len);
220 std::string
toText()
const;
349 Host(
const uint8_t* identifier,
const size_t identifier_len,
353 const std::string& hostname =
"",
354 const std::string& dhcp4_client_classes =
"",
355 const std::string& dhcp6_client_classes =
"",
357 const std::string& server_host_name =
"",
358 const std::string& boot_file_name =
"",
401 Host(
const std::string& identifier,
const std::string& identifier_name,
404 const std::string& hostname =
"",
405 const std::string& dhcp4_client_classes =
"",
406 const std::string& dhcp6_client_classes =
"",
408 const std::string& server_host_name =
"",
409 const std::string& boot_file_name =
"",
422 void setIdentifier(
const uint8_t* identifier,
const size_t len,
435 void setIdentifier(
const std::string& identifier,
const std::string& name);
480 const uint8_t* value,
481 const size_t length);
487 ipv4_subnet_id_ = ipv4_subnet_id;
494 ipv6_subnet_id_ = ipv6_subnet_id;
499 return (ipv4_subnet_id_);
504 return (ipv6_subnet_id_);
526 return (ipv4_reservation_);
565 hostname_ = hostname;
575 return (boost::algorithm::to_lower_copy(hostname_));
585 return (dhcp4_client_classes_);
595 return (dhcp6_client_classes_);
608 return (next_server_);
620 return (server_host_name_);
632 return (boot_file_name_);
641 return (cfg_option4_);
647 return (cfg_option4_);
656 return (cfg_option6_);
662 return (cfg_option6_);
666 std::string
toText()
const;
686 negative_ = negative;
732 const std::string& class_name);
737 std::vector<uint8_t> identifier_value_;
745 IPv6ResrvCollection ipv6_reservations_;
747 std::string hostname_;
755 std::string server_host_name_;
757 std::string boot_file_name_;
std::string getIdentifierAsText() const
Returns host identifier in a textual form.
std::string toText() const
Returns information about the reservation in the textual format.
boost::shared_ptr< DUID > DuidPtr
const size_t OPTION_FORMATTED_VALUE_MAX_LEN
Maximum length of option value specified in textual format.
boost::shared_ptr< CfgOption > CfgOptionPtr
Non-const pointer.
void setIdentifier(const uint8_t *identifier, const size_t len, const IdentifierType &type)
Replaces currently used identifier with a new identifier.
std::string toText() const
Returns information about the host in the textual format.
const size_t USER_CONTEXT_MAX_LEN
Maximum length of user context.
bool getNegative() const
Return the negative cache flag value.
const asiolink::IOAddress & getNextServer() const
Returns value of next server field (siaddr).
const size_t CLIENT_CLASSES_MAX_LEN
Maximum length of classes stored in a dhcp4/6_client_classes columns.
const ClientClasses & getClientClasses4() const
Returns classes which DHCPv4 client is associated with.
void setHostname(const std::string &hostname)
Sets new hostname.
std::string getLowerHostname() const
Returns reserved hostname in lower case.
ConstCfgOptionPtr getCfgOption4() const
Returns const pointer to the DHCPv4 option data configuration for this host.
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
const size_t BOOT_FILE_NAME_MAX_LEN
Maximum length of the boot file name.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
const asiolink::IOAddress & getPrefix() const
Returns prefix for the reservation.
AuthKey getKey() const
Returns the key.
Base class for user context.
boost::shared_ptr< const CfgOption > ConstCfgOptionPtr
Const pointer.
void setKey(const AuthKey &key)
sets key.
Defines elements for storing the names of client classes.
IPv6Resrv(const Type &type, const asiolink::IOAddress &prefix, const uint8_t prefix_len=128)
Constructor.
static std::vector< uint8_t > getRandomKeyString()
Random string is generated by default will be used for the keys to be used for signing Reconfigure Me...
boost::shared_ptr< Element > ElementPtr
std::vector< HostPtr > HostCollection
Collection of the Host objects.
static std::string getIdentifierName(const IdentifierType &type)
Returns name of the identifier of a specified type.
IPv6 reservation for a host.
const size_t OPTION_SPACE_MAX_LEN
Maximum length of option space name.
bool operator==(const AuthKey &other) const
Equality operator.
CfgOptionPtr getCfgOption6()
Returns pointer to the DHCPv6 option data configuration for this host.
ConstCfgOptionPtr getCfgOption6() const
Returns const pointer to the DHCPv6 option data configuration for this host.
const size_t SERVER_HOSTNAME_MAX_LEN
Maximum length of the server hostname.
const std::string & getServerHostname() const
Returns value of server hostname (sname).
bool hasReservation(const IPv6Resrv &reservation) const
Checks if specified IPv6 reservation exists for the host.
bool operator!=(const IPv6Resrv &other) const
Inequality operator.
const asiolink::IOAddress & getIPv4Reservation() const
Returns reserved IPv4 address.
void setHostId(HostID id)
Sets Host ID (primary key in MySQL, PostgreSQL and Cassandra backends)
std::pair< IPv6ResrvIterator, IPv6ResrvIterator > IPv6ResrvRange
bool operator==(const IPv6Resrv &other) const
Equality operator.
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
std::multimap< IPv6Resrv::Type, IPv6Resrv > IPv6ResrvCollection
Collection of IPv6 reservations for the host.
void addClientClass4(const std::string &class_name)
Adds new client class for DHCPv4.
Host(const uint8_t *identifier, const size_t identifier_len, const IdentifierType &identifier_type, const SubnetID ipv4_subnet_id, const SubnetID ipv6_subnet_id, const asiolink::IOAddress &ipv4_reservation, const std::string &hostname="", const std::string &dhcp4_client_classes="", const std::string &dhcp6_client_classes="", const asiolink::IOAddress &next_server=asiolink::IOAddress::IPV4_ZERO_ADDRESS(), const std::string &server_host_name="", const std::string &boot_file_name="", const AuthKey &auth_key=AuthKey(""))
Constructor.
const std::string & getBootFileName() const
Returns value of boot file name (file).
const std::vector< uint8_t > & getIdentifier() const
Returns the identifier in a binary form.
bool operator!=(const AuthKey &other) const
Inequality operator.
static const IOAddress & IPV4_ZERO_ADDRESS()
Returns an address set to all zeros.
Flexible host identifier.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
IdentifierType getIdentifierType() const
Returns the identifier type.
std::string toText() const
Return text format for keys.
void setServerHostname(const std::string &server_host_name)
Sets new value for server hostname (sname).
void setAuthKey(const std::vector< uint8_t > &key)
Set auth key value from binary.
IPv6ResrvRange getIPv6Reservations() const
Returns all IPv6 reservations.
isc::data::ElementPtr toElement6() const
Unparses (converts to Element representation) IPv6 host.
Represents a device with IPv4 and/or IPv6 reservations.
Type
Type of the reservation.
IPv6ResrvCollection::const_iterator IPv6ResrvIterator
HostID getHostId() const
Returns Host ID (primary key in MySQL, PostgreSQL and Cassandra backends)
const std::vector< uint8_t > & getAuthKey() const
Return auth key.
const std::string & getHostname() const
Returns reserved hostname.
SubnetID getIPv6SubnetID() const
Returns subnet identifier for IPv6 reservations.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void set(const Type &type, const asiolink::IOAddress &prefix, const uint8_t prefix_len)
Sets a new prefix and prefix length.
HWAddrPtr getHWAddress() const
Returns hardware address for which the reservations are made.
void addReservation(const IPv6Resrv &reservation)
Adds new IPv6 reservation.
const ClientClasses & getClientClasses6() const
Returns classes which DHCPv6 client is associated with.
Type getType() const
Returns reservation type.
void addClientClass6(const std::string &class_name)
Adds new client class for DHCPv6.
void setBootFileName(const std::string &boot_file_name)
Sets new value for boot file name (file).
bool hasIPv6Reservation() const
Checks if there is at least one IPv6 reservation for this host.
void setIPv4Reservation(const asiolink::IOAddress &address)
Sets new IPv4 reservation.
void removeIPv4Reservation()
Removes the IPv4 reservation.
IdentifierType
Type of the host identifier.
const size_t TEXT_AUTH_KEY_LEN
Maximum length of authentication keys (coded in hexadecimal).
uint8_t getPrefixLen() const
Returns prefix length.
std::pair< IPv6Resrv::Type, IPv6Resrv > IPv6ResrvTuple
The IOAddress class represents an IP addresses (version agnostic)
const uint8_t AUTH_KEY_LEN
Maximum length of authentication keys - 128 bits.
void setIPv4SubnetID(const SubnetID ipv4_subnet_id)
Sets new IPv4 subnet identifier.
const size_t OPTION_VALUE_MAX_LEN
Maximum length of option value.
isc::data::ElementPtr toElement4() const
Unparses (converts to Element representation) IPv4 host.
static const IdentifierType LAST_IDENTIFIER_TYPE
Constant pointing to the last identifier of the IdentifierType enumeration.
uint64_t HostID
HostID (used only when storing in MySQL, PostgreSQL or Cassandra)
void setNextServer(const asiolink::IOAddress &next_server)
Sets new value for next server field (siaddr).
Container for storing client class names.
SubnetID getIPv4SubnetID() const
Returns subnet identifier for IPv4 reservation.
CfgOptionPtr getCfgOption4()
Returns pointer to the DHCPv4 option data configuration for this host.
void setIPv6SubnetID(const SubnetID ipv6_subnet_id)
Sets new IPv6 subnet identifier.
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
DuidPtr getDuid() const
Returns DUID for which the reservations are made.
void setNegative(bool negative)
Sets the negative cached flag.