19#include <boost/shared_ptr.hpp>
20#include <boost/algorithm/string.hpp>
83 AuthKey(
const std::vector<uint8_t>& key);
93 AuthKey(
const std::string& key);
114 void setAuthKey(
const std::vector<uint8_t>& key);
135 std::string
toText()
const;
151 std::vector<uint8_t> authKey_;
189 const uint8_t prefix_len = 128);
198 return (prefix_len_);
214 return (pd_exclude_option_);
228 const uint8_t prefix_len);
237 const uint8_t excluded_prefix_len);
243 std::string
toText(
bool display_pd_exclude_option =
true)
const;
379 Host(
const uint8_t* identifier,
const size_t identifier_len,
383 const std::string& hostname =
"",
384 const std::string& dhcp4_client_classes =
"",
385 const std::string& dhcp6_client_classes =
"",
387 const std::string& server_host_name =
"",
388 const std::string& boot_file_name =
"",
431 Host(
const std::string& identifier,
const std::string& identifier_name,
434 const std::string& hostname =
"",
435 const std::string& dhcp4_client_classes =
"",
436 const std::string& dhcp6_client_classes =
"",
438 const std::string& server_host_name =
"",
439 const std::string& boot_file_name =
"",
459 void setIdentifier(
const uint8_t* identifier,
const size_t len,
472 void setIdentifier(
const std::string& identifier,
const std::string& name);
517 const uint8_t* value,
518 const size_t length);
524 ipv4_subnet_id_ = ipv4_subnet_id;
531 ipv6_subnet_id_ = ipv6_subnet_id;
536 return (ipv4_subnet_id_);
541 return (ipv6_subnet_id_);
563 return (ipv4_reservation_);
602 hostname_ = hostname;
612 return (boost::algorithm::to_lower_copy(hostname_));
622 return (dhcp4_client_classes_);
632 return (dhcp6_client_classes_);
645 return (next_server_);
657 return (server_host_name_);
669 return (boot_file_name_);
678 return (cfg_option4_);
684 return (cfg_option4_);
693 return (cfg_option6_);
699 return (cfg_option6_);
709 std::string
toText()
const;
729 negative_ = negative;
784 const std::string& class_name);
789 std::vector<uint8_t> identifier_value_;
799 std::string hostname_;
807 std::string server_host_name_;
809 std::string boot_file_name_;
Defines elements for storing the names of client classes.
The IOAddress class represents an IP addresses (version agnostic)
static const IOAddress & IPV4_ZERO_ADDRESS()
Returns an address set to all zeros.
bool operator!=(const AuthKey &other) const
Inequality operator.
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...
std::string toText() const
Return text format for keys.
const std::vector< uint8_t > & getAuthKey() const
Return auth key.
void setAuthKey(const std::vector< uint8_t > &key)
Set auth key value from binary.
bool operator==(const AuthKey &other) const
Equality operator.
Container for storing client class names.
Represents a device with IPv4 and/or IPv6 reservations.
void addClientClass4(const std::string &class_name)
Adds new client class for DHCPv4.
void setServerHostname(const std::string &server_host_name)
Sets new value for server hostname (sname).
static size_t getIdentifierMaxLength(const IdentifierType &type)
Get maximum identifier length.
void setHostId(HostID id)
Sets Host ID (primary key in MySQL and PostgreSQL backends)
void encapsulateOptions() const
Encapsulates host-specific options with their suboptions.
const ClientClasses & getClientClasses6() const
Returns classes which DHCPv6 client is associated with.
CfgOptionPtr getCfgOption4()
Returns pointer to the DHCPv4 option data configuration for this host.
void setNegative(bool negative)
Sets the negative cached flag.
std::string toText() const
Returns information about the host in the textual format.
void addClientClass6(const std::string &class_name)
Adds new client class for DHCPv6.
SubnetID getIPv4SubnetID() const
Returns subnet identifier for IPv4 reservation.
IdentifierType
Type of the host identifier.
@ IDENT_FLEX
Flexible host identifier.
IdentifierType getIdentifierType() const
Returns the identifier type.
std::string getLowerHostname() const
Returns reserved hostname in lower case.
void setIdentifier(const uint8_t *identifier, const size_t len, const IdentifierType &type)
Replaces currently used identifier with a new identifier.
SubnetID getIPv6SubnetID() const
Returns subnet identifier for IPv6 reservations.
void setHostname(const std::string &hostname)
Sets new hostname.
const asiolink::IOAddress & getIPv4Reservation() const
Returns reserved IPv4 address.
static const IdentifierType LAST_IDENTIFIER_TYPE
Constant pointing to the last identifier of the IdentifierType enumeration.
void setIdentifierType(const IdentifierType &type)
Set the identifier type.
const std::string & getHostname() const
Returns reserved hostname.
IPv6ResrvRange getIPv6Reservations() const
Returns all IPv6 reservations.
const std::string & getBootFileName() const
Returns value of boot file name (file).
bool hasIPv6Reservation() const
Checks if there is at least one IPv6 reservation for this host.
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::vector< uint8_t > & getIdentifier() const
Returns the identifier in a binary form.
isc::data::ElementPtr toElement6() const
Unparses (converts to Element representation) IPv6 host.
ConstCfgOptionPtr getCfgOption4() const
Returns const pointer to the DHCPv4 option data configuration for this host.
void addReservation(const IPv6Resrv &reservation)
Adds new IPv6 reservation.
const ClientClasses & getClientClasses4() const
Returns classes which DHCPv4 client is associated with.
static std::string getIdentifierName(const IdentifierType &type)
Returns name of the identifier of a specified type.
const std::string & getServerHostname() const
Returns value of server hostname (sname).
void setBootFileName(const std::string &boot_file_name)
Sets new value for boot file name (file).
void setNextServer(const asiolink::IOAddress &next_server)
Sets new value for next server field (siaddr).
CfgOptionPtr getCfgOption6()
Returns pointer to the DHCPv6 option data configuration for this host.
bool hasReservation(const IPv6Resrv &reservation) const
Checks if specified IPv6 reservation exists for the host.
const asiolink::IOAddress & getNextServer() const
Returns value of next server field (siaddr).
ConstCfgOptionPtr getCfgOption6() const
Returns const pointer to the DHCPv6 option data configuration for this host.
std::string getIdentifierAsText() const
Returns host identifier in a textual form.
AuthKey getKey() const
Returns the key.
isc::data::ElementPtr toElement4() const
Unparses (converts to Element representation) IPv4 host.
DuidPtr getDuid() const
Returns DUID for which the reservations are made.
void setIPv4SubnetID(const SubnetID ipv4_subnet_id)
Sets new IPv4 subnet identifier.
void removeIPv4Reservation()
Removes the IPv4 reservation.
void setIPv6SubnetID(const SubnetID ipv6_subnet_id)
Sets new IPv6 subnet identifier.
HWAddrPtr getHWAddress() const
Returns hardware address for which the reservations are made.
void setKey(const AuthKey &key)
sets key.
HostID getHostId() const
Returns Host ID (primary key in MySQL and PostgreSQL backends)
bool getNegative() const
Return the negative cache flag value.
void setIPv4Reservation(const asiolink::IOAddress &address)
Sets new IPv4 reservation.
IPv6 reservation for a host.
void set(const Type &type, const asiolink::IOAddress &prefix, const uint8_t prefix_len)
Sets a new prefix and prefix length.
const asiolink::IOAddress & getPrefix() const
Returns prefix for the reservation.
std::string PDExcludetoText() const
Returns information about the Prefix Exclude option of the reservation the textual format.
Type getType() const
Returns reservation type.
Type
Type of the reservation.
void setPDExclude(const asiolink::IOAddress &excluded_prefix, const uint8_t excluded_prefix_len)
Sets the Prefix Exclude option.
uint8_t getPrefixLen() const
Returns prefix length.
IPv6Resrv(const Type &type, const asiolink::IOAddress &prefix, const uint8_t prefix_len=128)
Constructor.
Option6PDExcludePtr getPDExclude() const
Returns the Prefix Exclude option.
bool operator==(const IPv6Resrv &other) const
Equality operator.
std::string toText(bool display_pd_exclude_option=true) const
Returns information about the reservation in the textual format.
bool operator!=(const IPv6Resrv &other) const
Inequality operator.
boost::shared_ptr< Element > ElementPtr
IPv6ResrvCollection::const_iterator IPv6ResrvIterator
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.
boost::shared_ptr< Option6PDExclude > Option6PDExcludePtr
Pointer to the Option6PDExclude object.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
boost::shared_ptr< DUID > DuidPtr
const size_t CLIENT_CLASSES_MAX_LEN
Maximum length of classes stored in a dhcp4/6_client_classes columns.
std::pair< IPv6ResrvIterator, IPv6ResrvIterator > IPv6ResrvRange
std::vector< HostPtr > HostCollection
Collection of the Host objects.
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
const size_t TEXT_AUTH_KEY_LEN
Maximum length of authentication keys (coded in hexadecimal).
const uint8_t AUTH_KEY_LEN
Maximum length of authentication keys - 128 bits.
std::multimap< IPv6Resrv::Type, IPv6Resrv > IPv6ResrvCollection
Collection of IPv6 reservations for the host.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
uint64_t HostID
HostID (used only when storing in MySQL or PostgreSQL backends)
const size_t ADDRESS6_TEXT_MAX_LEN
Maximum size of an IPv6 address represented as a text string.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
const size_t HOSTNAME_MAX_LEN
Maximum length of the hostname stored in DNS.
const size_t USER_CONTEXT_MAX_LEN
Maximum length of user context.
std::pair< IPv6Resrv::Type, IPv6Resrv > IPv6ResrvTuple
const size_t OPTION_VALUE_MAX_LEN
Maximum length of option value.
const size_t SERVER_HOSTNAME_MAX_LEN
Maximum length of the server hostname.
const size_t BOOT_FILE_NAME_MAX_LEN
Maximum length of the boot file name.
boost::shared_ptr< const CfgOption > ConstCfgOptionPtr
Const pointer.
const size_t OPTION_SPACE_MAX_LEN
Maximum length of option space name.
Defines the logger used by the top-level component of kea-lfc.
Base class for user context.