Kea 2.7.5
isc::dhcp::IPv6Resrv Class Reference

IPv6 reservation for a host. More...

#include <host.h>

Public Types

enum  Type { TYPE_NA , TYPE_PD }
 Type of the reservation. More...
 

Public Member Functions

 IPv6Resrv (const Type &type, const asiolink::IOAddress &prefix, const uint8_t prefix_len=128)
 Constructor.
 
Option6PDExcludePtr getPDExclude () const
 Returns the Prefix Exclude option.
 
const asiolink::IOAddressgetPrefix () const
 Returns prefix for the reservation.
 
uint8_t getPrefixLen () const
 Returns prefix length.
 
Type getType () const
 Returns reservation type.
 
bool operator!= (const IPv6Resrv &other) const
 Inequality operator.
 
bool operator== (const IPv6Resrv &other) const
 Equality operator.
 
std::string PDExcludetoText () const
 Returns information about the Prefix Exclude option of the reservation the textual format.
 
void set (const Type &type, const asiolink::IOAddress &prefix, const uint8_t prefix_len)
 Sets a new prefix and prefix length.
 
void setPDExclude (const asiolink::IOAddress &excluded_prefix, const uint8_t excluded_prefix_len)
 Sets the Prefix Exclude option.
 
std::string toText (bool display_pd_exclude_option=true) const
 Returns information about the reservation in the textual format.
 

Detailed Description

IPv6 reservation for a host.

This class represents a reservation for a host of a single IPv6 address or prefix (in Host object).

The class holds the address and prefix length, a value of 128 for the latter implying that the reservation is for a single IPv6 address. For prefix delegations it includes an optional Prefix Exclude option.

Definition at line 163 of file host.h.

Member Enumeration Documentation

◆ Type

Type of the reservation.

Currently supported types are NA and PD.

Enumerator
TYPE_NA 
TYPE_PD 

Definition at line 169 of file host.h.

Constructor & Destructor Documentation

◆ IPv6Resrv()

isc::dhcp::IPv6Resrv::IPv6Resrv ( const Type & type,
const asiolink::IOAddress & prefix,
const uint8_t prefix_len = 128 )

Constructor.

Creates a reservation from the IPv6 address and prefix length value. If the prefix length is not specified, the default value of 128 is used. This value indicates that the reservation is made for an IPv6 address.

Parameters
typeReservation type: NA or PD.
prefixAddress or prefix to be reserved.
prefix_lenPrefix length.
Exceptions
isc::BadValueif prefix is not IPv6 prefix, is a multicast address or the prefix length is greater than 128.

Definition at line 86 of file host.cc.

References set().

+ Here is the call graph for this function:

Member Function Documentation

◆ getPDExclude()

Option6PDExcludePtr isc::dhcp::IPv6Resrv::getPDExclude ( ) const
inline

Returns the Prefix Exclude option.

Returns
Prefix Exclude option.

Definition at line 213 of file host.h.

◆ getPrefix()

const asiolink::IOAddress & isc::dhcp::IPv6Resrv::getPrefix ( ) const
inline

Returns prefix for the reservation.

Definition at line 192 of file host.h.

◆ getPrefixLen()

uint8_t isc::dhcp::IPv6Resrv::getPrefixLen ( ) const
inline

Returns prefix length.

Definition at line 197 of file host.h.

◆ getType()

Type isc::dhcp::IPv6Resrv::getType ( ) const
inline

Returns reservation type.

The type of reservation is determined using a prefix length.

Returns
NA for prefix length equal to 128, PD otherwise.

Definition at line 206 of file host.h.

◆ operator!=()

bool isc::dhcp::IPv6Resrv::operator!= ( const IPv6Resrv & other) const

Inequality operator.

Parameters
otherReservation to compare to.

Definition at line 173 of file host.cc.

◆ operator==()

bool isc::dhcp::IPv6Resrv::operator== ( const IPv6Resrv & other) const

Equality operator.

Note
this compares only type, prefix and prefix length.
Parameters
otherReservation to compare to.

Definition at line 166 of file host.cc.

◆ PDExcludetoText()

std::string isc::dhcp::IPv6Resrv::PDExcludetoText ( ) const

Returns information about the Prefix Exclude option of the reservation the textual format.

Definition at line 152 of file host.cc.

◆ set()

void isc::dhcp::IPv6Resrv::set ( const Type & type,
const asiolink::IOAddress & prefix,
const uint8_t prefix_len )

Sets a new prefix and prefix length.

Note
This removes the Prefix Exclude option when it exists.
Parameters
typeReservation type: NA or PD.
prefixNew prefix.
prefix_lenNew prefix length.
Exceptions
isc::BadValueif prefix is not IPv6 prefix, is a multicast address or the prefix length is greater than 128.

Definition at line 96 of file host.cc.

References isc_throw, and TYPE_NA.

Referenced by IPv6Resrv().

◆ setPDExclude()

void isc::dhcp::IPv6Resrv::setPDExclude ( const asiolink::IOAddress & excluded_prefix,
const uint8_t excluded_prefix_len )

Sets the Prefix Exclude option.

Note
excluded_prefix_len == 0 means there's no excluded prefix at all.
Parameters
excluded_prefixspecifies an excluded prefix as per RFC6603.
excluded_prefix_lenspecifies length of an excluded prefix.

Definition at line 120 of file host.cc.

◆ toText()

std::string isc::dhcp::IPv6Resrv::toText ( bool display_pd_exclude_option = true) const

Returns information about the reservation in the textual format.

Parameters
display_pd_exclude_optionWhen true (default) add the Prefix Exclude option if it exists.

Definition at line 132 of file host.cc.

References TYPE_PD.


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