| Kea 3.0.2-git

isc::radius::RadiusBackend Class Reference

Host backend for Radius. More...

`#include <radius_backend.h>`

Inheritance diagram for isc::radius::RadiusBackend:
[legend]

## Public Member Functions
| RadiusBackend ()
| Constructor.
virtual | ~RadiusBackend ()
| Destructor.
virtual void | add (const isc::dhcp::HostPtr &host) override
| Adds a new host to the collection.
virtual bool | del (const isc::dhcp::SubnetID &subnet_id, const isc::asiolink::IOAddress &addr) override
| Attempts to delete a host by (subnet-id, address).
virtual bool | del4 (const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) override
| Attempts to delete a host by (subnet-id4, identifier, identifier-type).
virtual bool | del6 (const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) override
| Attempts to delete a host by (subnet-id6, identifier, identifier-type).
virtual isc::dhcp::ConstHostPtr | get4 (const isc::dhcp::SubnetID &subnet_id, const isc::asiolink::IOAddress &address) const override
| Returns a host connected to the IPv4 subnet and having a reservation for a specified IPv4 address.
virtual isc::dhcp::ConstHostPtr | get4 (const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const override
| Returns a host connected to the IPv4 subnet.
virtual isc::dhcp::ConstHostPtr | get6 (const isc::asiolink::IOAddress &prefix, const uint8_t prefix_len) const override
| Returns a host using the specified IPv6 prefix.
virtual isc::dhcp::ConstHostPtr | get6 (const isc::dhcp::SubnetID &subnet_id, const isc::asiolink::IOAddress &address) const override
| Returns a host connected to the IPv6 subnet and having a reservation for a specified IPv6 address or prefix.
virtual isc::dhcp::ConstHostPtr | get6 (const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const override
| Returns a host connected to the IPv6 subnet.
virtual isc::dhcp::ConstHostCollection | getAll (const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const override
| From base class.
virtual isc::dhcp::ConstHostCollection | getAll4 (const isc::asiolink::IOAddress &address) const override
| Returns a collection of hosts using the specified IPv4 address.
virtual isc::dhcp::ConstHostCollection | getAll4 (const isc::dhcp::SubnetID &subnet_id) const override
| Return all hosts in a specified DHCPv4 subnet.
virtual isc::dhcp::ConstHostCollection | getAll4 (const isc::dhcp::SubnetID &subnet_id, const isc::asiolink::IOAddress &address) const override
| Returns all hosts connected to the IPv4 subnet and having a reservation for a specified address.
virtual dhcp::ConstHostCollection | getAll6 (const isc::asiolink::IOAddress &address) const override
| Returns a collection of hosts using the specified IPv6 address/prefix.
virtual isc::dhcp::ConstHostCollection | getAll6 (const isc::dhcp::SubnetID &subnet_id) const override
| Return all hosts in a specified DHCPv6 subnet.
virtual isc::dhcp::ConstHostCollection | getAll6 (const isc::dhcp::SubnetID &subnet_id, const isc::asiolink::IOAddress &address) const override
| Returns all hosts connected to the IPv6 subnet and having a reservation for a specified address or delegated prefix (lease).
virtual isc::dhcp::ConstHostCollection | getAllbyHostname (const std::string &hostname) const override
| Return all hosts with a hostname.
virtual isc::dhcp::ConstHostCollection | getAllbyHostname4 (const std::string &hostname, const isc::dhcp::SubnetID &subnet_id) const override
| Return all hosts with a hostname in a DHCPv4 subnet.
virtual isc::dhcp::ConstHostCollection | getAllbyHostname6 (const std::string &hostname, const isc::dhcp::SubnetID &subnet_id) const override
| Return all hosts with a hostname in a DHCPv6 subnet.
virtual isc::dhcp::ConstHostCollection | getPage4 (const isc::dhcp::SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const dhcp::HostPageSize &page_size) const override
| Return range of hosts in a specified DHCPv4 subnet.
virtual isc::dhcp::ConstHostCollection | getPage4 (size_t &source_index, uint64_t lower_host_id, const dhcp::HostPageSize &page_size) const override
| Return range of hosts.
virtual isc::dhcp::ConstHostCollection | getPage6 (const isc::dhcp::SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const dhcp::HostPageSize &page_size) const override
| Return range of hosts in a specified DHCPv6 subnet.
virtual isc::dhcp::ConstHostCollection | getPage6 (size_t &source_index, uint64_t lower_host_id, const dhcp::HostPageSize &page_size) const override
| Return range of hosts.
virtual std::string | getType () const override
| Return backend type.
size_t | getUnexpected4 () const
| Return unexpected calls for IPv4.
size_t | getUnexpected6 () const
| Return unexpected calls for IPv6.
virtual bool | setIPReservationsUnique (const bool unique) override
| Controls whether IP reservations are unique or non-unique.
Public Member Functions inherited from isc::dhcp::BaseHostDataSource
virtual | ~BaseHostDataSource ()
| Default destructor implementation.
virtual void | commit ()
| Commit Transactions.
virtual isc::db::DatabaseConnection::ParameterMap | getParameters () const
| Return backend parameters.
virtual bool | isUnusable ()
| Flag which indicates if the host manager has at least one unusable connection.
virtual void | rollback ()
| Rollback Transactions.
virtual void | update (HostPtr const &host)
| Attempts to update an existing host entry.

## Protected Attributes
boost::shared_ptr< RadiusBackendImpl > | impl_
| Implementation.

## Additional Inherited Members
Public Types inherited from isc::dhcp::BaseHostDataSource
enum | IdType { ID_HWADDR = 0 , ID_DUID = 1 }
| Specifies the type of an identifier. More...

## Detailed Description

Host backend for Radius.

This backend handles no data. It can be called when:

- an identifier type other than the configured one is used
- by the hook for a new client so not yet in the host cache It is a soft error to call it in another case.

Definition at line 23 of file radius_backend.h.

## Constructor & Destructor Documentation

## ◆ RadiusBackend()

isc::radius::RadiusBackend::RadiusBackend | ( |  | ) |

Constructor.

Definition at line 23 of file radius_backend.cc.

References impl_.

## ◆ ~RadiusBackend()

isc::radius::RadiusBackend::~RadiusBackend | ( |  | ) |
| virtual

Destructor.

Definition at line 26 of file radius_backend.cc.

## Member Function Documentation

## ◆ add()

void isc::radius::RadiusBackend::add | ( | const isc::dhcp::HostPtr & | host | ) |
| override virtual

Adds a new host to the collection.

The implementations of this method should guard against duplicate reservations for the same host, where possible. For example, when the reservation for the same HW address and subnet id is added twice, the implementation should throw an exception. Note, that usually it is impossible to guard against adding duplicated host, where one instance is identified by HW address, another one by DUID.

Not implemented.

Parameters

  host | Pointer to the new `Host` object being added.

Note
  does nothing, in particular does not throw so the entry can be added to the host cache.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 152 of file radius_backend.cc.

## ◆ del()

bool isc::radius::RadiusBackend::del | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | const isc::asiolink::IOAddress & | addr )
| override virtual

Attempts to delete a host by (subnet-id, address).

Not implemented for Radius.

Parameters

  subnet_id | subnet identifier.
  addr | specified address.

Returns
  false.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 156 of file radius_backend.cc.

## ◆ del4()

bool isc::radius::RadiusBackend::del4 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | const isc::dhcp::Host::IdentifierType & | identifier_type,
|  | const uint8_t * | identifier_begin,
|  | const size_t | identifier_len )
| override virtual

Attempts to delete a host by (subnet-id4, identifier, identifier-type).

Not implemented for Radius.

Parameters

  subnet_id | IPv4 Subnet identifier.
  identifier_type | Identifier type.
  identifier_begin | Pointer to a beginning of a buffer containing an identifier.
  identifier_len | Identifier length.

Returns
  false.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 162 of file radius_backend.cc.

## ◆ del6()

bool isc::radius::RadiusBackend::del6 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | const isc::dhcp::Host::IdentifierType & | identifier_type,
|  | const uint8_t * | identifier_begin,
|  | const size_t | identifier_len )
| override virtual

Attempts to delete a host by (subnet-id6, identifier, identifier-type).

Not implemented for Radius.

Parameters

  subnet_id | IPv6 Subnet identifier.
  identifier_type | Identifier type.
  identifier_begin | Pointer to a beginning of a buffer containing an identifier.
  identifier_len | Identifier length.

Returns
  false.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 170 of file radius_backend.cc.

## ◆ get4() [1/2]

ConstHostPtr isc::radius::RadiusBackend::get4 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | const isc::asiolink::IOAddress & | address ) const
| override virtual

Returns a host connected to the IPv4 subnet and having a reservation for a specified IPv4 address.

Not implemented.

Parameters

  subnet_id | Subnet identifier.
  address | reserved IPv4 address.

Returns
  null.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 108 of file radius_backend.cc.

## ◆ get4() [2/2]

ConstHostPtr isc::radius::RadiusBackend::get4 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | const isc::dhcp::Host::IdentifierType & | identifier_type,
|  | const uint8_t * | identifier_begin,
|  | const size_t | identifier_len ) const
| override virtual

Returns a host connected to the IPv4 subnet.

Parameters

  subnet_id | Subnet identifier.
  identifier_type | Identifier type.
  identifier_begin | Pointer to a beginning of a buffer containing an identifier.
  identifier_len | Identifier length.

Returns
  Const `Host` object for which reservation has been made using the specified identifier.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 99 of file radius_backend.cc.

References impl_.

## ◆ get6() [1/3]

ConstHostPtr isc::radius::RadiusBackend::get6 | ( | const isc::asiolink::IOAddress & | prefix,
|  | const uint8_t | prefix_len ) const
| override virtual

Returns a host using the specified IPv6 prefix.

Not implemented.

Parameters

  prefix | IPv6 prefix for which the `Host` object is searched.
  prefix_len | IPv6 prefix length.

Returns
  null.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 129 of file radius_backend.cc.

## ◆ get6() [2/3]

ConstHostPtr isc::radius::RadiusBackend::get6 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | const isc::asiolink::IOAddress & | address ) const
| override virtual

Returns a host connected to the IPv6 subnet and having a reservation for a specified IPv6 address or prefix.

Not implemented.

Parameters

  subnet_id | Subnet identifier.
  address | reserved IPv6 address/prefix.

Returns
  null.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 135 of file radius_backend.cc.

## ◆ get6() [3/3]

ConstHostPtr isc::radius::RadiusBackend::get6 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | const isc::dhcp::Host::IdentifierType & | identifier_type,
|  | const uint8_t * | identifier_begin,
|  | const size_t | identifier_len ) const
| override virtual

Returns a host connected to the IPv6 subnet.

Parameters

  subnet_id | Subnet identifier.
  identifier_type | Identifier type.
  identifier_begin | Pointer to a beginning of a buffer containing an identifier.
  identifier_len | Identifier length.

Returns
  Const `Host` object for which reservation has been made using the specified identifier.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 120 of file radius_backend.cc.

References impl_.

## ◆ getAll()

ConstHostCollection isc::radius::RadiusBackend::getAll | ( | const isc::dhcp::Host::IdentifierType & | identifier_type,
|  | const uint8_t * | identifier_begin,
|  | const size_t | identifier_len ) const
| override virtual

From base class.

Return all hosts connected to any subnet for which reservations have been made using a specified identifier.

Not supported.

Returns
  Empty collection.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 30 of file radius_backend.cc.

## ◆ getAll4() [1/3]

ConstHostCollection isc::radius::RadiusBackend::getAll4 | ( | const isc::asiolink::IOAddress & | address | ) | const
| override virtual

Returns a collection of hosts using the specified IPv4 address.

Not supported.

Parameters

  address | IPv4 address for which the `Host` object is searched.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 94 of file radius_backend.cc.

## ◆ getAll4() [2/3]

ConstHostCollection isc::radius::RadiusBackend::getAll4 | ( | const isc::dhcp::SubnetID & | subnet_id | ) | const
| override virtual

Return all hosts in a specified DHCPv4 subnet.

Not supported.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 37 of file radius_backend.cc.

## ◆ getAll4() [3/3]

ConstHostCollection isc::radius::RadiusBackend::getAll4 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | const isc::asiolink::IOAddress & | address ) const
| override virtual

Returns all hosts connected to the IPv4 subnet and having a reservation for a specified address.

Parameters

  subnet_id | Subnet identifier.
  address | reserved IPv4 address.

Returns
  Empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 114 of file radius_backend.cc.

## ◆ getAll6() [1/3]

ConstHostCollection isc::radius::RadiusBackend::getAll6 | ( | const isc::asiolink::IOAddress & | address | ) | const
| override virtual

Returns a collection of hosts using the specified IPv6 address/prefix.

This method may return multiple `Host` objects if they are connected to different subnets.

Parameters

  address | IPv6 address for which the `Host` object is searched.

Returns
  Empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 147 of file radius_backend.cc.

## ◆ getAll6() [2/3]

ConstHostCollection isc::radius::RadiusBackend::getAll6 | ( | const isc::dhcp::SubnetID & | subnet_id | ) | const
| override virtual

Return all hosts in a specified DHCPv6 subnet.

Not supported.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 42 of file radius_backend.cc.

## ◆ getAll6() [3/3]

ConstHostCollection isc::radius::RadiusBackend::getAll6 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | const isc::asiolink::IOAddress & | address ) const
| override virtual

Returns all hosts connected to the IPv6 subnet and having a reservation for a specified address or delegated prefix (lease).

Parameters

  subnet_id | Subnet identifier.
  address | reserved IPv6 address/prefix.

Returns
  Empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 141 of file radius_backend.cc.

## ◆ getAllbyHostname()

ConstHostCollection isc::radius::RadiusBackend::getAllbyHostname | ( | const std::string & | hostname | ) | const
| override virtual

Return all hosts with a hostname.

This method returns all `Host` objects which represent reservations using a specified hostname.

Parameters

  hostname | The lower case hostname.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 47 of file radius_backend.cc.

## ◆ getAllbyHostname4()

ConstHostCollection isc::radius::RadiusBackend::getAllbyHostname4 | ( | const std::string & | hostname,
|  | const isc::dhcp::SubnetID & | subnet_id ) const
| override virtual

Return all hosts with a hostname in a DHCPv4 subnet.

This method returns all `Host` objects which represent reservations using a specified hostname in a specified subnet.

Parameters

  hostname | The lower case hostname.
  subnet_id | Subnet identifier.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 52 of file radius_backend.cc.

## ◆ getAllbyHostname6()

ConstHostCollection isc::radius::RadiusBackend::getAllbyHostname6 | ( | const std::string & | hostname,
|  | const isc::dhcp::SubnetID & | subnet_id ) const
| override virtual

Return all hosts with a hostname in a DHCPv6 subnet.

This method returns all `Host` objects which represent reservations using a specified hostname in a specified subnet.

Parameters

  hostname | The lower case hostname.
  subnet_id | Subnet identifier.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 58 of file radius_backend.cc.

## ◆ getPage4() [1/2]

isc::dhcp::ConstHostCollection isc::radius::RadiusBackend::getPage4 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | size_t & | source_index,
|  | uint64_t | lower_host_id,
|  | const dhcp::HostPageSize & | page_size ) const
| override virtual

Return range of hosts in a specified DHCPv4 subnet.

Not supported.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 64 of file radius_backend.cc.

## ◆ getPage4() [2/2]

isc::dhcp::ConstHostCollection isc::radius::RadiusBackend::getPage4 | ( | size_t & | source_index,
|  | uint64_t | lower_host_id,
|  | const dhcp::HostPageSize & | page_size ) const
| override virtual

Return range of hosts.

Not supported.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 80 of file radius_backend.cc.

## ◆ getPage6() [1/2]

isc::dhcp::ConstHostCollection isc::radius::RadiusBackend::getPage6 | ( | const isc::dhcp::SubnetID & | subnet_id,
|  | size_t & | source_index,
|  | uint64_t | lower_host_id,
|  | const dhcp::HostPageSize & | page_size ) const
| override virtual

Return range of hosts in a specified DHCPv6 subnet.

Not supported.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 72 of file radius_backend.cc.

## ◆ getPage6() [2/2]

isc::dhcp::ConstHostCollection isc::radius::RadiusBackend::getPage6 | ( | size_t & | source_index,
|  | uint64_t | lower_host_id,
|  | const dhcp::HostPageSize & | page_size ) const
| override virtual

Return range of hosts.

Not supported.

Returns
  Always returns an empty collection of const `Host` objects.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 87 of file radius_backend.cc.

## ◆ getType()

virtual std::string isc::radius::RadiusBackend::getType | ( |  | ) | const
| inline override virtual

Return backend type.

Returns the type of the backend (e.g. "mysql", "memfile" etc.)

Returns
  Type of the backend.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 315 of file radius_backend.h.

## ◆ getUnexpected4()

size_t isc::radius::RadiusBackend::getUnexpected4 | ( |  | ) | const

Return unexpected calls for IPv4.

Definition at line 187 of file radius_backend.cc.

References impl_.

## ◆ getUnexpected6()

size_t isc::radius::RadiusBackend::getUnexpected6 | ( |  | ) | const

Return unexpected calls for IPv6.

Definition at line 192 of file radius_backend.cc.

References impl_.

## ◆ setIPReservationsUnique()

bool isc::radius::RadiusBackend::setIPReservationsUnique | ( | const bool | unique | ) |
| override virtual

Controls whether IP reservations are unique or non-unique.

In a typical case, the IP reservations are unique and backends verify prior to adding a host reservation to the database that the reservation for a given IP address does not exist. In some cases it may be required to allow non-unique IP reservations, e.g. in the case when a host has several interfaces and independently of which interface is used by this host to communicate with the DHCP server the same IP address should be assigned. In this case the `unique` value should be set to false to disable the checks for uniqueness on the backend side.

Parameters

  unique | boolean flag indicating if the IP reservations must be unique within the subnet or can be non-unique.

Returns
  true when addresses must be unique, false otherwise because this backend does not support specifying the same IP address in multiple host reservations.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 178 of file radius_backend.cc.

## Member Data Documentation

## ◆ impl_

boost::shared_ptr<RadiusBackendImpl> isc::radius::RadiusBackend::impl_
| protected

Implementation.

Definition at line 345 of file radius_backend.h.

Referenced by RadiusBackend(), get4(), get6(), getUnexpected4(), and getUnexpected6().

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

- radius_backend.h
- radius_backend.cc