Kea  2.1.7-git
isc::dhcp::Host Class Reference

Represents a device with IPv4 and/or IPv6 reservations. More...

#include <host.h>

+ Inheritance diagram for isc::dhcp::Host:

Public Types

enum  IdentifierType {
  IDENT_HWADDR, IDENT_DUID, IDENT_CIRCUIT_ID, IDENT_CLIENT_ID,
  IDENT_FLEX
}
 Type of the host identifier. More...
 

Public Member Functions

 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. More...
 
 Host (const std::string &identifier, const std::string &identifier_name, 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. More...
 
void addClientClass4 (const std::string &class_name)
 Adds new client class for DHCPv4. More...
 
void addClientClass6 (const std::string &class_name)
 Adds new client class for DHCPv6. More...
 
void addReservation (const IPv6Resrv &reservation)
 Adds new IPv6 reservation. More...
 
const std::string & getBootFileName () const
 Returns value of boot file name (file). More...
 
CfgOptionPtr getCfgOption4 ()
 Returns pointer to the DHCPv4 option data configuration for this host. More...
 
ConstCfgOptionPtr getCfgOption4 () const
 Returns const pointer to the DHCPv4 option data configuration for this host. More...
 
CfgOptionPtr getCfgOption6 ()
 Returns pointer to the DHCPv6 option data configuration for this host. More...
 
ConstCfgOptionPtr getCfgOption6 () const
 Returns const pointer to the DHCPv6 option data configuration for this host. More...
 
const ClientClassesgetClientClasses4 () const
 Returns classes which DHCPv4 client is associated with. More...
 
const ClientClassesgetClientClasses6 () const
 Returns classes which DHCPv6 client is associated with. More...
 
DuidPtr getDuid () const
 Returns DUID for which the reservations are made. More...
 
HostID getHostId () const
 Returns Host ID (primary key in MySQL and PostgreSQL backends) More...
 
const std::string & getHostname () const
 Returns reserved hostname. More...
 
HWAddrPtr getHWAddress () const
 Returns hardware address for which the reservations are made. More...
 
const std::vector< uint8_t > & getIdentifier () const
 Returns the identifier in a binary form. More...
 
std::string getIdentifierAsText () const
 Returns host identifier in a textual form. More...
 
IdentifierType getIdentifierType () const
 Returns the identifier type. More...
 
const asiolink::IOAddressgetIPv4Reservation () const
 Returns reserved IPv4 address. More...
 
SubnetID getIPv4SubnetID () const
 Returns subnet identifier for IPv4 reservation. More...
 
IPv6ResrvRange getIPv6Reservations (const IPv6Resrv::Type &type) const
 Returns IPv6 reservations of a specified type. More...
 
IPv6ResrvRange getIPv6Reservations () const
 Returns all IPv6 reservations. More...
 
SubnetID getIPv6SubnetID () const
 Returns subnet identifier for IPv6 reservations. More...
 
AuthKey getKey () const
 Returns the key. More...
 
std::string getLowerHostname () const
 Returns reserved hostname in lower case. More...
 
bool getNegative () const
 Return the negative cache flag value. More...
 
const asiolink::IOAddressgetNextServer () const
 Returns value of next server field (siaddr). More...
 
const std::string & getServerHostname () const
 Returns value of server hostname (sname). More...
 
bool hasIPv6Reservation () const
 Checks if there is at least one IPv6 reservation for this host. More...
 
bool hasReservation (const IPv6Resrv &reservation) const
 Checks if specified IPv6 reservation exists for the host. More...
 
void removeIPv4Reservation ()
 Removes the IPv4 reservation. More...
 
void setBootFileName (const std::string &boot_file_name)
 Sets new value for boot file name (file). More...
 
void setHostId (HostID id)
 Sets Host ID (primary key in MySQL and PostgreSQL backends) More...
 
void setHostname (const std::string &hostname)
 Sets new hostname. More...
 
void setIdentifier (const uint8_t *identifier, const size_t len, const IdentifierType &type)
 Replaces currently used identifier with a new identifier. More...
 
void setIdentifier (const std::string &identifier, const std::string &name)
 Replaces currently used identifier with a new identifier. More...
 
void setIPv4Reservation (const asiolink::IOAddress &address)
 Sets new IPv4 reservation. More...
 
void setIPv4SubnetID (const SubnetID ipv4_subnet_id)
 Sets new IPv4 subnet identifier. More...
 
void setIPv6SubnetID (const SubnetID ipv6_subnet_id)
 Sets new IPv6 subnet identifier. More...
 
void setKey (const AuthKey &key)
 sets key. More...
 
void setNegative (bool negative)
 Sets the negative cached flag. More...
 
void setNextServer (const asiolink::IOAddress &next_server)
 Sets new value for next server field (siaddr). More...
 
void setServerHostname (const std::string &server_host_name)
 Sets new value for server hostname (sname). More...
 
isc::data::ElementPtr toElement4 () const
 Unparses (converts to Element representation) IPv4 host. More...
 
isc::data::ElementPtr toElement6 () const
 Unparses (converts to Element representation) IPv6 host. More...
 
std::string toText () const
 Returns information about the host in the textual format. More...
 
- Public Member Functions inherited from isc::data::UserContext
void contextToElement (data::ElementPtr map) const
 Merge unparse a user_context object. More...
 
data::ConstElementPtr getContext () const
 Returns const pointer to the user context. More...
 
void setContext (const data::ConstElementPtr &ctx)
 Sets user context. More...
 

Static Public Member Functions

static std::string getIdentifierAsText (const IdentifierType &type, const uint8_t *value, const size_t length)
 Returns host identifier in textual form. More...
 
static std::string getIdentifierName (const IdentifierType &type)
 Returns name of the identifier of a specified type. More...
 
static IdentifierType getIdentifierType (const std::string &identifier_name)
 Converts identifier name to identifier type. More...
 
- Static Public Member Functions inherited from isc::data::UserContext
static data::ElementPtr toElement (data::ConstElementPtr map)
 Copy an Element map. More...
 

Static Public Attributes

static const IdentifierType LAST_IDENTIFIER_TYPE = IDENT_FLEX
 Constant pointing to the last identifier of the IdentifierType enumeration. More...
 

Additional Inherited Members

- Protected Attributes inherited from isc::data::UserContext
data::ConstElementPtr user_context_
 Pointer to the user context (may be NULL) More...
 

Detailed Description

Represents a device with IPv4 and/or IPv6 reservations.

This class represents a network device which can be identified by a unique property, such as MAC address on the interface or client identifier (DUID), and for which some resources are statically assigned:

  • IPv4 address which the device obtains when it contacts a DHCPv4 server
  • IPv6 address(es) which the device obtains when it contacts a DHCPv6 server
  • IPv6 prefix(es) obtained when the device contacts the DHCPv6 server and requests allocation of prefixes using prefix delegation mechanism
  • hostname which is used for dynamic DNS updates for both DHCPv4 and DHCPv6 exchanges.
  • client classes which the client is associated with
  • DHCP options specifically configured for the device

Note, that "host" in this context has a different meaning from host construed as device attached to a network with (possibly) multiple interfaces. For the MAC address based reservations, each interface on a network device maps to a single Host object as each Host object contains at most one MAC address. So, it is possible that a single device is associated with multiple distinct Host objects if the device has multiple interfaces. Under normal circumstances, a non-mobile dual stack device using one interface should be represented by a single Host object.

A DHCPv6 DUID is common for all interfaces on a device. Therefore, for DUID based reservations a Host object may represent a network device with multiple interfaces. However, since Host objects are grouped by subnets to which device's interfaces are connected a single instance of Host object usually defines reservations for a single interface.

The Host object combines reservations for both IPv4 and IPv6 resources to allow for correlation of the information about the dual stack devices using DHCPv4 and DHCPv6 respectively. For example: both the DHCPv4 and DHCPv6 servers may use the same database for storing host reservations, so the information about the DHCPv4 reservations are available for the DHCPv6 server and vice versa. Also, this approach allows for reserving common resources such as host name for DHCPv4 and DHCPv6 clients.

This class also holds pointers to specific DHCP options reserved for a host. Options instances are held in CfgOption objects. There are two CfgOption objects in this class, one holding DHCPv4 options, another one holding DHCPv6 options.

Todo:
This class offers basic functionality for storing host information. It will need to be extended to allow for the following operations:
  • remove and replace IPv6 reservations
  • remove and replace client classes
  • disable IPv4 reservation without a need to set it to the 0.0.0.0 address Note that the last three operations are mainly required for managing host reservations which will be implemented later.

Definition at line 297 of file host.h.

Member Enumeration Documentation

◆ IdentifierType

Type of the host identifier.

Currently supported identifiers are:

  • hardware address (DHCPv4 and DHCPv6) (identifier name: "hw-address"),
  • DUID (DHCPv4 and DHCPv6) (identifier name: "duid"),
  • circuit identifier (DHCPv4) (identifier name: "circuit-id"),
  • client identifier (DHCPv4) (identifier name: "client-id")
Enumerator
IDENT_HWADDR 
IDENT_DUID 
IDENT_CIRCUIT_ID 
IDENT_CLIENT_ID 
IDENT_FLEX 

Flexible host identifier.

Definition at line 307 of file host.h.

Constructor & Destructor Documentation

◆ Host() [1/2]

isc::dhcp::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.

Creates a Host object using an identifier in a binary format. This is most useful in cases where the identifier is obtained from the database. The constructor will create an instance of the HWAddr or DUID object depending on the identifier type.

Parameters
identifierPointer to the binary value holding an identifier.
identifier_lenLength of the identifier.
identifier_typeType of the identifier (hardware address or DUID).
ipv4_subnet_idIdentifier of the IPv4 subnet to which the host is connected.
ipv6_subnet_idIdentifier of the IPv6 subnet to which the host is connected.
ipv4_reservationAn IPv4 address reserved for the client. If this address is set to 0, there is no reservation.
hostnameHostname to be allocated to both DHCPv4 and DHCPv6 clients. This is empty string if hostname is not allocated.
dhcp4_client_classesA string holding DHCPv4 client class names separated by commas. The names get trimmed by this constructor.
dhcp6_client_classesA string holding DHCPv6 client class names separated by commas. The names get trimmed by this constructor.
next_serverIPv4 address of next server (siaddr).
server_host_nameServer host name (a.k.a. sname).
boot_file_nameBoot file name (a.k.a. file).
auth_keyAuthentication key.
Exceptions
BadValueif the provided values are invalid. In particular, if the identifier is invalid.

Definition at line 137 of file host.cc.

References isc::asiolink::IOAddress::isV4Zero(), setIdentifier(), setIPv4Reservation(), and setNextServer().

+ Here is the call graph for this function:

◆ Host() [2/2]

isc::dhcp::Host::Host ( const std::string &  identifier,
const std::string &  identifier_name,
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.

Creates Host object using an identifier in a textual format. This is useful in cases when the reservation is specified in the server configuration file. Identifiers can be specified in the following formats:

  • "yy:yy:yy:yy:yy:yy"
  • "yyyyyyyyyy",
  • "0xyyyyyyyyyy",
  • "'some identifier'". where y is a hexadecimal digit.

Note that it is possible to use textual representation, e.g. 'some identifier', which is converted to a vector of ASCII codes representing characters in a given string, excluding quotes. This is useful in cases when specific identifiers, e.g. circuit-id are manually assigned user friendly values.

Parameters
identifierIdentifier in the textual format. The expected formats for the hardware address and other identifiers are provided above.
identifier_nameOne of the supported identifiers in the text form as described for IdentifierType.
ipv4_subnet_idIdentifier of the IPv4 subnet to which the host is connected.
ipv6_subnet_idIdentifier of the IPv6 subnet to which the host is connected.
ipv4_reservationAn IPv4 address reserved for the client. If this address is set to 0, there is no reservation.
hostnameHostname to be allocated to both DHCPv4 and DHCPv6 clients. This is empty string if hostname is not allocated.
dhcp4_client_classesA string holding DHCPv4 client class names separated by commas. The names get trimmed by this constructor.
dhcp6_client_classesA string holding DHCPv6 client class names separated by commas. The names get trimmed by this constructor.
next_serverIPv4 address of next server (siaddr).
server_host_nameServer host name (a.k.a. sname).
boot_file_nameBoot file name (a.k.a. file).
auth_keyAuthentication key.
Exceptions
BadValueif the provided values are invalid. In particular, if the identifier is invalid.

Definition at line 175 of file host.cc.

References isc::asiolink::IOAddress::isV4Zero(), setIdentifier(), setIPv4Reservation(), and setNextServer().

+ Here is the call graph for this function:

Member Function Documentation

◆ addClientClass4()

void isc::dhcp::Host::addClientClass4 ( const std::string &  class_name)

Adds new client class for DHCPv4.

Parameters
class_nameClass name.

Definition at line 424 of file host.cc.

◆ addClientClass6()

void isc::dhcp::Host::addClientClass6 ( const std::string &  class_name)

Adds new client class for DHCPv6.

Parameters
class_nameClass name.

Definition at line 430 of file host.cc.

References isc::dhcp::ClientClasses::insert(), and isc::util::str::trim().

+ Here is the call graph for this function:

◆ addReservation()

void isc::dhcp::Host::addReservation ( const IPv6Resrv reservation)

Adds new IPv6 reservation.

Parameters
reservationNew IPv6 reservation to be appended.

Definition at line 380 of file host.cc.

References isc::dhcp::IPv6Resrv::getType(), hasReservation(), isc_throw, and isc::dhcp::IPv6Resrv::toText().

+ Here is the call graph for this function:

◆ getBootFileName()

const std::string& isc::dhcp::Host::getBootFileName ( ) const
inline

Returns value of boot file name (file).

Definition at line 631 of file host.h.

Referenced by toElement4().

◆ getCfgOption4() [1/2]

CfgOptionPtr isc::dhcp::Host::getCfgOption4 ( )
inline

Returns pointer to the DHCPv4 option data configuration for this host.

Returned pointer can be used to add, remove and update options reserved for a host.

Definition at line 640 of file host.h.

Referenced by toElement4().

◆ getCfgOption4() [2/2]

ConstCfgOptionPtr isc::dhcp::Host::getCfgOption4 ( ) const
inline

Returns const pointer to the DHCPv4 option data configuration for this host.

Definition at line 646 of file host.h.

◆ getCfgOption6() [1/2]

CfgOptionPtr isc::dhcp::Host::getCfgOption6 ( )
inline

Returns pointer to the DHCPv6 option data configuration for this host.

Returned pointer can be used to add, remove and update options reserved for a host.

Definition at line 655 of file host.h.

Referenced by toElement6().

◆ getCfgOption6() [2/2]

ConstCfgOptionPtr isc::dhcp::Host::getCfgOption6 ( ) const
inline

Returns const pointer to the DHCPv6 option data configuration for this host.

Definition at line 661 of file host.h.

References isc::dhcp::AuthKey::toText().

+ Here is the call graph for this function:

◆ getClientClasses4()

const ClientClasses& isc::dhcp::Host::getClientClasses4 ( ) const
inline

Returns classes which DHCPv4 client is associated with.

Definition at line 584 of file host.h.

Referenced by toElement4().

◆ getClientClasses6()

const ClientClasses& isc::dhcp::Host::getClientClasses6 ( ) const
inline

Returns classes which DHCPv6 client is associated with.

Definition at line 594 of file host.h.

Referenced by toElement6().

◆ getDuid()

DuidPtr isc::dhcp::Host::getDuid ( ) const

Returns DUID for which the reservations are made.

Returns
Pointer to the DUID structure or null if the reservation is not associated with a DUID.

Definition at line 249 of file host.cc.

References IDENT_DUID.

Referenced by toElement4(), and toElement6().

◆ getHostId()

HostID isc::dhcp::Host::getHostId ( ) const
inline

Returns Host ID (primary key in MySQL and PostgreSQL backends)

Returns
id HostId value (or 0 if not set)

Definition at line 676 of file host.h.

◆ getHostname()

const std::string& isc::dhcp::Host::getHostname ( ) const
inline

Returns reserved hostname.

Definition at line 569 of file host.h.

Referenced by toElement4(), and toElement6().

◆ getHWAddress()

HWAddrPtr isc::dhcp::Host::getHWAddress ( ) const

Returns hardware address for which the reservations are made.

Returns
Pointer to the HWAddr structure or null if the reservation is not associated with a hardware address.

Definition at line 243 of file host.cc.

References isc::dhcp::HTYPE_ETHER, and IDENT_HWADDR.

Referenced by toElement4(), and toElement6().

◆ getIdentifier()

const std::vector< uint8_t > & isc::dhcp::Host::getIdentifier ( ) const

Returns the identifier in a binary form.

Returns
const reference to a vector<uint8_t> holding an identifier value.

Definition at line 212 of file host.cc.

Referenced by toElement4(), and toElement6().

◆ getIdentifierAsText() [1/2]

std::string isc::dhcp::Host::getIdentifierAsText ( ) const

Returns host identifier in a textual form.

Returns
Identifier in the form of type=value.

Definition at line 256 of file host.cc.

Referenced by isc::dhcp::HostMgr::get4Any(), isc::dhcp::HostMgr::get6Any(), isc::dhcp::Dhcpv4Exchange::setHostIdentifiers(), isc::dhcp::Dhcpv6Srv::setHostIdentifiers(), and toText().

◆ getIdentifierAsText() [2/2]

std::string isc::dhcp::Host::getIdentifierAsText ( const IdentifierType type,
const uint8_t *  value,
const size_t  length 
)
static

Returns host identifier in textual form.

Parameters
typeIdentifier type.
valuePointer to a buffer holding identifier.
lengthLength of the identifier.
Returns
Identifier in the form of type=value.

Definition at line 262 of file host.cc.

References isc::util::encode::encodeHex(), IDENT_CIRCUIT_ID, IDENT_CLIENT_ID, IDENT_DUID, IDENT_FLEX, and IDENT_HWADDR.

+ Here is the call graph for this function:

◆ getIdentifierName()

std::string isc::dhcp::Host::getIdentifierName ( const IdentifierType type)
static

Returns name of the identifier of a specified type.

Definition at line 293 of file host.cc.

References IDENT_CIRCUIT_ID, IDENT_CLIENT_ID, IDENT_DUID, IDENT_FLEX, and IDENT_HWADDR.

Referenced by isc::dhcp::HostReservationIdsParser::parseInternal(), and isc::dhcp::CfgHostOperations::toElement().

◆ getIdentifierType() [1/2]

Host::IdentifierType isc::dhcp::Host::getIdentifierType ( ) const

Returns the identifier type.

Definition at line 217 of file host.cc.

Referenced by isc::dhcp::CfgHostOperations::addIdentifierType(), setIdentifier(), toElement4(), and toElement6().

◆ getIdentifierType() [2/2]

Host::IdentifierType isc::dhcp::Host::getIdentifierType ( const std::string &  identifier_name)
static

Converts identifier name to identifier type.

Parameters
identifier_nameIdentifier name.
Returns
Identifier type.

Definition at line 222 of file host.cc.

References IDENT_CIRCUIT_ID, IDENT_CLIENT_ID, IDENT_DUID, IDENT_FLEX, IDENT_HWADDR, and isc_throw.

◆ getIPv4Reservation()

const asiolink::IOAddress& isc::dhcp::Host::getIPv4Reservation ( ) const
inline

Returns reserved IPv4 address.

Returns
IPv4 address or 0.0.0.0 if no IPv4 reservation specified.

Definition at line 525 of file host.h.

Referenced by toElement4().

◆ getIPv4SubnetID()

SubnetID isc::dhcp::Host::getIPv4SubnetID ( ) const
inline

Returns subnet identifier for IPv4 reservation.

Definition at line 498 of file host.h.

◆ getIPv6Reservations() [1/2]

IPv6ResrvRange isc::dhcp::Host::getIPv6Reservations ( const IPv6Resrv::Type type) const

Returns IPv6 reservations of a specified type.

Parameters
typeType of the reservations to be returned (NA or PD).
Returns
A range of iterators pointing to the reservations of the specified type.

Definition at line 392 of file host.cc.

◆ getIPv6Reservations() [2/2]

IPv6ResrvRange isc::dhcp::Host::getIPv6Reservations ( ) const

Returns all IPv6 reservations.

Returns
A range of iterators pointing to the reservations of the specified type.

Definition at line 397 of file host.cc.

Referenced by hasReservation(), and toElement6().

◆ getIPv6SubnetID()

SubnetID isc::dhcp::Host::getIPv6SubnetID ( ) const
inline

Returns subnet identifier for IPv6 reservations.

Definition at line 503 of file host.h.

◆ getKey()

AuthKey isc::dhcp::Host::getKey ( ) const
inline

Returns the key.

Keys are used for signing the Reconfigure Message.

Definition at line 715 of file host.h.

◆ getLowerHostname()

std::string isc::dhcp::Host::getLowerHostname ( ) const
inline

Returns reserved hostname in lower case.

Definition at line 574 of file host.h.

◆ getNegative()

bool isc::dhcp::Host::getNegative ( ) const
inline

Return the negative cache flag value.

When true standard lookup methods return null host pointer instead.

Definition at line 691 of file host.h.

◆ getNextServer()

const asiolink::IOAddress& isc::dhcp::Host::getNextServer ( ) const
inline

Returns value of next server field (siaddr).

Definition at line 607 of file host.h.

Referenced by toElement4().

◆ getServerHostname()

const std::string& isc::dhcp::Host::getServerHostname ( ) const
inline

Returns value of server hostname (sname).

Definition at line 619 of file host.h.

Referenced by toElement4().

◆ hasIPv6Reservation()

bool isc::dhcp::Host::hasIPv6Reservation ( ) const

Checks if there is at least one IPv6 reservation for this host.

Returns
true if there is a reservation for the host, false otherwise.

Definition at line 403 of file host.cc.

◆ hasReservation()

bool isc::dhcp::Host::hasReservation ( const IPv6Resrv reservation) const

Checks if specified IPv6 reservation exists for the host.

Parameters
reservationA reservation to be checked for the host.
Returns
true if the reservation already exists for the host, false otherwise.

Definition at line 408 of file host.cc.

References getIPv6Reservations(), and isc::dhcp::IPv6Resrv::getType().

Referenced by addReservation().

+ Here is the call graph for this function:

◆ removeIPv4Reservation()

void isc::dhcp::Host::removeIPv4Reservation ( )

Removes the IPv4 reservation.

Sets the IPv4 reserved address to 0.

Definition at line 375 of file host.cc.

References isc::asiolink::IOAddress::IPV4_ZERO_ADDRESS().

+ Here is the call graph for this function:

◆ setBootFileName()

void isc::dhcp::Host::setBootFileName ( const std::string &  boot_file_name)

Sets new value for boot file name (file).

Parameters
boot_file_nameNew value of boot file name.
Exceptions
BadValueif boot file name is longer than 128 bytes.

Definition at line 466 of file host.cc.

References isc_throw, and isc::dhcp::Pkt4::MAX_FILE_LEN.

◆ setHostId()

void isc::dhcp::Host::setHostId ( HostID  id)
inline

Sets Host ID (primary key in MySQL and PostgreSQL backends)

Parameters
idHostId value

Definition at line 670 of file host.h.

◆ setHostname()

void isc::dhcp::Host::setHostname ( const std::string &  hostname)
inline

Sets new hostname.

Parameters
hostnameNew hostname.

Definition at line 564 of file host.h.

◆ setIdentifier() [1/2]

void isc::dhcp::Host::setIdentifier ( const uint8_t *  identifier,
const size_t  len,
const IdentifierType type 
)

Replaces currently used identifier with a new identifier.

This method sets a new identifier type and value for a host. This method is called by the Host constructor.

Parameters
identifierPointer to a buffer holding an identifier.
lenLength of the identifier that the identifier points to.
typeIdentifier type.
Exceptions
BadValueif the identifier is invalid.

Definition at line 318 of file host.cc.

References isc_throw.

Referenced by Host().

◆ setIdentifier() [2/2]

void isc::dhcp::Host::setIdentifier ( const std::string &  identifier,
const std::string &  name 
)

Replaces currently used identifier with a new identifier.

This method sets a new identifier type and value for a host. This method is called by the Host constructor.

Parameters
identifierReference to a new identifier in the textual format.
nameOne of the supported identifiers in the text form as described for IdentifierType.
Exceptions
BadValueif the identifier is invalid.

Definition at line 329 of file host.cc.

References isc::util::str::decodeFormattedHexString(), getIdentifierType(), isc_throw, and isc::util::str::quotedStringToBinary().

+ Here is the call graph for this function:

◆ setIPv4Reservation()

void isc::dhcp::Host::setIPv4Reservation ( const asiolink::IOAddress address)

Sets new IPv4 reservation.

The new reservation removes a previous reservation.

Parameters
addressAddress to be reserved for the client.
Exceptions
isc::BadValueif the provided address is not an IPv4 address, is a 0 address or broadcast address.

Definition at line 363 of file host.cc.

References isc_throw, isc::asiolink::IOAddress::isV4(), isc::asiolink::IOAddress::isV4Bcast(), and isc::asiolink::IOAddress::isV4Zero().

Referenced by Host().

+ Here is the call graph for this function:

◆ setIPv4SubnetID()

void isc::dhcp::Host::setIPv4SubnetID ( const SubnetID  ipv4_subnet_id)
inline

Sets new IPv4 subnet identifier.

Parameters
ipv4_subnet_idNew subnet identifier.

Definition at line 486 of file host.h.

◆ setIPv6SubnetID()

void isc::dhcp::Host::setIPv6SubnetID ( const SubnetID  ipv6_subnet_id)
inline

Sets new IPv6 subnet identifier.

Parameters
ipv6_subnet_idNew subnet identifier.

Definition at line 493 of file host.h.

◆ setKey()

void isc::dhcp::Host::setKey ( const AuthKey key)
inline

sets key.

Keys are used for signing the Reconfigure Message.

Definition at line 708 of file host.h.

◆ setNegative()

void isc::dhcp::Host::setNegative ( bool  negative)
inline

Sets the negative cached flag.

Parameters
negativesets whether this is a negative cached host, i.e. a fake host in the cache which indicates non-existence and avoids to lookup in a slow backend.

Definition at line 685 of file host.h.

◆ setNextServer()

void isc::dhcp::Host::setNextServer ( const asiolink::IOAddress next_server)

Sets new value for next server field (siaddr).

Parameters
next_serverNew address of a next server.
Exceptions
isc::BadValueif the provided address is not an IPv4 address, is broadcast address.

Definition at line 444 of file host.cc.

References isc_throw, isc::asiolink::IOAddress::isV4(), and isc::asiolink::IOAddress::isV4Bcast().

Referenced by Host().

+ Here is the call graph for this function:

◆ setServerHostname()

void isc::dhcp::Host::setServerHostname ( const std::string &  server_host_name)

Sets new value for server hostname (sname).

Parameters
server_host_nameNew value for server hostname.
Exceptions
BadValueif hostname is longer than 63 bytes.

Definition at line 457 of file host.cc.

References isc_throw, and isc::dhcp::Pkt4::MAX_SNAME_LEN.

◆ toElement4()

◆ toElement6()

◆ toText()

std::string isc::dhcp::Host::toText ( ) const

Returns information about the host in the textual format.

Definition at line 601 of file host.cc.

References isc::dhcp::ClientClasses::cbegin(), isc::dhcp::ClientClasses::cend(), getIdentifierAsText(), isc::asiolink::IOAddress::isV4Zero(), isc::asiolink::IOAddress::toText(), and isc::dhcp::AuthKey::toText().

+ Here is the call graph for this function:

Member Data Documentation

◆ LAST_IDENTIFIER_TYPE

const IdentifierType isc::dhcp::Host::LAST_IDENTIFIER_TYPE = IDENT_FLEX
static

Constant pointing to the last identifier of the IdentifierType enumeration.

Definition at line 317 of file host.h.

Referenced by isc::dhcp::HostReservationIdsParser::parseInternal().


The documentation for this class was generated from the following files: