Kea 3.1.9
isc::radius::RadiusImpl Class Reference

Radius hooks library implementation. More...

#include <radius.h>

Inheritance diagram for isc::radius::RadiusImpl:

Public Member Functions

 ~RadiusImpl ()
 Destructor.
void checkEarlyGlobalResvLookup ()
 Check the early global host reservations lookup flag.
bool checkHostBackends ()
 Check host backends (cache and radius).
void checkSharedNetworks ()
 Check shared network server configuration.
const ServersgetAccessServers () const
 Get servers for access.
const ServersgetAccountingServers () const
 Get servers for accounting.
isc::asiolink::IOServicePtr getIOContext ()
 Get the hook I/O service.
isc::asiolink::IOServicePtr getIOService ()
 Get the hook I/O service.
void init (data::ElementPtr &config)
 Initialize.
void registerExchange (ExchangePtr exchange)
 Register Exchange.
void reset ()
 Reset the state as it was just created.
bool serveAccess () const
 Check if access is served.
bool serveAccounting () const
 Check if accounting is served.
void setAccessIdleTimer ()
 Set the access idle timer.
void setAccountingIdleTimer ()
 Set the accounting idle timer.
void setIOContext (isc::asiolink::IOServicePtr io_service)
 Set the hook I/O service.
void setIOService (isc::asiolink::IOServicePtr io_service)
 Set the hook I/O service.
void startServices ()
 Start the I/O mechanisms.
data::ElementPtr toElement () const override
 Unparse implementation configuration.
void unregisterExchange (ExchangePtr exchange)
 Unregister Exchange.
Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor.

Static Public Member Functions

static RadiusImplinstance ()
 RadiusImpl is a singleton class.

Public Attributes

boost::shared_ptr< RadiusAccountingacct_
 Pointer to accounting (never null).
boost::shared_ptr< RadiusAccessauth_
 Pointer to access (never null).
RadiusBackendPtr backend_
 Radius backend.
std::string bindaddr_
 bindaddr.
dhcp::CacheHostDataSourcePtr cache_
 Host cache.
bool canonical_mac_address_
 Canonical MAC address.
bool clientid_pop0_
 Client Id pop leading zero(s).
bool clientid_printable_
 Client Id try printable.
unsigned deadtime_
 Deadtime.
std::string dictionary_
 Dictionary path.
bool extract_duid_
 Extract Duid from Client Id.
dhcp::Host::IdentifierType id_type4_
 Identifier type for IPv4.
dhcp::Host::IdentifierType id_type6_
 Identifier type for IPv6.
RadiusProtocol proto_
 Transport protocol.
std::map< uint32_t, uint32_t > remap_
 Subnet ID to NAS port map.
bool reselect_subnet_address_
 Reselect subnet using address.
bool reselect_subnet_pool_
 Reselect subnet using pool.
unsigned retries_
 Retries.
std::string session_history_filename_
 Session history filename.
isc::tcp::TcpClientPtr tcp_client_
 TCP client.
unsigned thread_pool_size_
 Thread pool size.
unsigned timeout_
 Timeout.
boost::shared_ptr< RadiusTlstls_
 Pointer to tls (never null).
UdpClientPtr udp_client_
 UDP client.
bool use_message_authenticator_
 Use Message-Authenticator attribute.

Static Public Attributes

static std::atomic< bool > shutdown_
 Flag which indicates that the instance is shutting down.

Protected Member Functions

 RadiusImpl ()
 Protected constructor.
void cleanup ()
 Clean up members.

Static Protected Member Functions

static const RadiusImplPtrinstancePtr ()
 Returns pointer to the sole instance of radius implementation.

Detailed Description

Radius hooks library implementation.

Definition at line 142 of file radius.h.

Constructor & Destructor Documentation

◆ ~RadiusImpl()

isc::radius::RadiusImpl::~RadiusImpl ( )

Destructor.

Definition at line 187 of file radius.cc.

References cleanup(), LOG_WARN, isc::radius::RADIUS_CLEANUP_EXCEPTION, and isc::radius::radius_logger.

Here is the call graph for this function:

◆ RadiusImpl()

Member Function Documentation

◆ checkEarlyGlobalResvLookup()

void isc::radius::RadiusImpl::checkEarlyGlobalResvLookup ( )

Check the early global host reservations lookup flag.

Exceptions
ConfigErrorwhen the server configuration is not compatible.

Definition at line 488 of file radius.cc.

References isc::dhcp::CfgGlobals::EARLY_GLOBAL_RESERVATIONS_LOOKUP, isc::dhcp::CfgMgr::getStagingCfg(), isc::dhcp::CfgMgr::instance(), and isc_throw.

Referenced by init().

Here is the call graph for this function:

◆ checkHostBackends()

bool isc::radius::RadiusImpl::checkHostBackends ( )

Check host backends (cache and radius).

As a side effect when the host cache backend is found the cache_ field is set.

Todo
: Calls to addBackend() (in particular the cache one) should be moved to Kea core (cf #5562). Note they must be after the load function so currently this method is called at first use.
Returns
true when found, false when an error occurred.

Definition at line 551 of file radius.cc.

References isc::dhcp::HostMgr::addBackend(), cache_, isc::dhcp::HostMgr::getHostDataSource(), isc::dhcp::HostMgr::instance(), LOG_ERROR, isc::radius::RADIUS_ACCESS_HOST_BACKEND_ERROR, isc::radius::RADIUS_ACCESS_NO_HOST_CACHE, and isc::radius::radius_logger.

Here is the call graph for this function:

◆ checkSharedNetworks()

void isc::radius::RadiusImpl::checkSharedNetworks ( )

Check shared network server configuration.

This verifies the compatibility of the server configuration with the RADIUS hook, in particular with shared networks:

  • set the disable single query flag
  • verify that any shared network with more than one subnet uses only global reservations.
    Exceptions
    ConfigErrorwhen the server configuration is not compatible.

Definition at line 497 of file radius.cc.

References isc::dhcp::CfgMgr::getStagingCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::HostMgr::instance(), isc_throw, and isc::dhcp::HostMgr::setDisableSingleQuery().

Referenced by init().

Here is the call graph for this function:

◆ cleanup()

void isc::radius::RadiusImpl::cleanup ( )
protected

◆ getAccessServers()

const Servers & isc::radius::RadiusImpl::getAccessServers ( ) const

Get servers for access.

Returns
Servers to use with access servers.

Definition at line 390 of file radius.cc.

References auth_, proto_, isc::radius::PW_PROTO_TLS, and tls_.

Referenced by isc::radius::RadiusRequest::RadiusRequest().

◆ getAccountingServers()

const Servers & isc::radius::RadiusImpl::getAccountingServers ( ) const

Get servers for accounting.

Returns
Servers to use with accounting servers.

Definition at line 399 of file radius.cc.

References acct_, proto_, isc::radius::PW_PROTO_TLS, and tls_.

Referenced by isc::radius::RadiusRequest::RadiusRequest().

◆ getIOContext()

isc::asiolink::IOServicePtr isc::radius::RadiusImpl::getIOContext ( )
inline

Get the hook I/O service.

Returns
the hook I/O service.

Definition at line 225 of file radius.h.

Referenced by cleanup().

◆ getIOService()

isc::asiolink::IOServicePtr isc::radius::RadiusImpl::getIOService ( )
inline

Get the hook I/O service.

Returns
the hook I/O service.

Definition at line 239 of file radius.h.

Referenced by cleanup().

◆ init()

void isc::radius::RadiusImpl::init ( data::ElementPtr & config)

Initialize.

Parameters
configConfiguration specified for the hooks library.
Exceptions
ConfigErrorwhen configuration fails.

Definition at line 269 of file radius.cc.

References acct_, auth_, backend_, checkEarlyGlobalResvLookup(), checkSharedNetworks(), isc_throw, LOG_ERROR, isc::radius::RadiusConfigParser::parse(), isc::radius::RADIUS_ACCESS_NO_HOST_CACHE, isc::radius::radius_logger, isc::dhcp::HostDataSourceFactory::registeredFactory(), isc::dhcp::HostDataSourceFactory::registerFactory(), session_history_filename_, and tls_.

Here is the call graph for this function:

◆ instance()

RadiusImpl & isc::radius::RadiusImpl::instance ( )
static

RadiusImpl is a singleton class.

This method returns reference to its sole instance.

Returns
the only existing instance of radius implementation.

Definition at line 163 of file radius.cc.

References instancePtr().

Referenced by isc::radius::RadiusAcctHandler::RadiusAcctHandler(), isc::radius::RadiusAcctStatus::RadiusAcctStatus(), isc::radius::RadiusAuthHandler::RadiusAuthHandler(), isc::radius::RadiusAuthStatus::RadiusAuthStatus(), isc::radius::RadiusRequest::RadiusRequest(), isc::radius::RadiusTlsStatus::RadiusTlsStatus(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct4(), isc::radius::RadiusAccounting::buildAcct6(), isc::radius::RadiusAccess::buildAuth(), isc::radius::RadiusAccess::buildAuth(), isc::radius::Exchange::buildRequest(), command_processed(), dhcp4_srv_configured(), dhcp6_srv_configured(), isc::radius::RadiusBackendImpl::get4(), isc::radius::RadiusBackendImpl::get6(), isc::radius::RadiusAccess::getIdentifier(), isc::radius::RadiusAccess::getIdentifier(), isc::radius::getNASPort(), isc::radius::RadiusAccess::IdleTimerCallback(), isc::radius::RadiusAccounting::IdleTimerCallback(), isc::radius::RadiusAcctStatus::invokeCallback(), isc::radius::RadiusAsyncAcct::invokeCallback(), isc::radius::RadiusAsyncAuth::invokeCallback(), isc::radius::RadiusAuthStatus::invokeCallback(), isc::radius::RadiusTlsStatus::invokeCallback(), lease4_decline(), lease4_expire(), lease4_release(), lease4_renew(), lease4_select(), lease6_decline(), lease6_expire(), lease6_rebind(), lease6_release(), lease6_renew(), lease6_select(), load(), isc::radius::RadiusConfigParser::parse(), isc::radius::RadiusServerParser::parse(), isc::radius::RadiusServiceParser::parse(), isc::radius::Exchange::processResponse(), isc::radius::RadiusAccess::setIdleTimer(), isc::radius::RadiusAccounting::setIdleTimer(), isc::radius::RadiusTls::setIdleTimer(), isc::radius::RadiusSyncAcct::start(), isc::radius::RadiusSyncAuth::start(), isc::radius::TcpExchange::start(), subnet4_select(), subnet6_select(), isc::radius::RadiusAccess::terminate4Internal(), isc::radius::RadiusAccess::terminate6Internal(), and unload().

Here is the call graph for this function:

◆ instancePtr()

const RadiusImplPtr & isc::radius::RadiusImpl::instancePtr ( )
staticprotected

Returns pointer to the sole instance of radius implementation.

Returns
Shared pointer to the RadiusImpl instance.

Definition at line 168 of file radius.cc.

References RadiusImpl().

Referenced by instance().

Here is the call graph for this function:

◆ registerExchange()

void isc::radius::RadiusImpl::registerExchange ( ExchangePtr exchange)

Register Exchange.

Parameters
exchangeThe exchange to register.

Definition at line 196 of file radius.cc.

References udp_client_.

Referenced by isc::radius::RadiusAccess::IdleTimerCallback(), and isc::radius::RadiusAccounting::IdleTimerCallback().

◆ reset()

void isc::radius::RadiusImpl::reset ( )

Reset the state as it was just created.

Definition at line 263 of file radius.cc.

References cleanup(), and shutdown_.

Referenced by unload().

Here is the call graph for this function:

◆ serveAccess()

bool isc::radius::RadiusImpl::serveAccess ( ) const

Check if access is served.

Returns
true is access is served, false otherwise.

Definition at line 362 of file radius.cc.

References auth_, proto_, isc::radius::PW_PROTO_TLS, shutdown_, and tls_.

◆ serveAccounting()

bool isc::radius::RadiusImpl::serveAccounting ( ) const

Check if accounting is served.

Returns
true is accounting is served, false otherwise.

Definition at line 376 of file radius.cc.

References acct_, proto_, isc::radius::PW_PROTO_TLS, shutdown_, and tls_.

◆ setAccessIdleTimer()

void isc::radius::RadiusImpl::setAccessIdleTimer ( )

◆ setAccountingIdleTimer()

void isc::radius::RadiusImpl::setAccountingIdleTimer ( )

◆ setIOContext()

void isc::radius::RadiusImpl::setIOContext ( isc::asiolink::IOServicePtr io_service)
inline

Set the hook I/O service.

Parameters
io_servicethe hook I/O service.

Definition at line 232 of file radius.h.

◆ setIOService()

void isc::radius::RadiusImpl::setIOService ( isc::asiolink::IOServicePtr io_service)
inline

Set the hook I/O service.

Parameters
io_servicethe hook I/O service.

Definition at line 246 of file radius.h.

◆ startServices()

void isc::radius::RadiusImpl::startServices ( )

Start the I/O mechanisms.

Start the thread pool for MT or create the IO context for ST.

Definition at line 295 of file radius.cc.

References isc::util::MultiThreadingMgr::detectThreadCount(), isc::dhcp::CfgMultiThreading::extract(), isc::dhcp::CfgMgr::instance(), proto_, isc::radius::PW_PROTO_UDP, tcp_client_, thread_pool_size_, and udp_client_.

Referenced by dhcp4_srv_configured(), and dhcp6_srv_configured().

Here is the call graph for this function:

◆ toElement()

ElementPtr isc::radius::RadiusImpl::toElement ( ) const
overridevirtual

Unparse implementation configuration.

Returns
a pointer to unparsed configuration.

Implements isc::data::CfgToElement.

Definition at line 585 of file radius.cc.

References acct_, auth_, bindaddr_, canonical_mac_address_, clientid_pop0_, clientid_printable_, Element::create(), Element::createList(), Element::createMap(), deadtime_, dictionary_, extract_duid_, isc::dhcp::Host::getIdentifierName(), id_type4_, id_type6_, proto_, isc::radius::protocolToText(), isc::radius::PW_PROTO_TLS, remap_, reselect_subnet_address_, reselect_subnet_pool_, retries_, session_history_filename_, thread_pool_size_, timeout_, tls_, and use_message_authenticator_.

Here is the call graph for this function:

◆ unregisterExchange()

void isc::radius::RadiusImpl::unregisterExchange ( ExchangePtr exchange)

Member Data Documentation

◆ acct_

boost::shared_ptr<RadiusAccounting> isc::radius::RadiusImpl::acct_

◆ auth_

boost::shared_ptr<RadiusAccess> isc::radius::RadiusImpl::auth_

◆ backend_

RadiusBackendPtr isc::radius::RadiusImpl::backend_

Radius backend.

Definition at line 293 of file radius.h.

Referenced by cleanup(), and init().

◆ bindaddr_

std::string isc::radius::RadiusImpl::bindaddr_

◆ cache_

dhcp::CacheHostDataSourcePtr isc::radius::RadiusImpl::cache_

Host cache.

Definition at line 290 of file radius.h.

Referenced by checkHostBackends(), and cleanup().

◆ canonical_mac_address_

bool isc::radius::RadiusImpl::canonical_mac_address_

Canonical MAC address.

Definition at line 299 of file radius.h.

Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().

◆ clientid_pop0_

bool isc::radius::RadiusImpl::clientid_pop0_

Client Id pop leading zero(s).

Definition at line 302 of file radius.h.

Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().

◆ clientid_printable_

bool isc::radius::RadiusImpl::clientid_printable_

Client Id try printable.

Definition at line 305 of file radius.h.

Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().

◆ deadtime_

unsigned isc::radius::RadiusImpl::deadtime_

◆ dictionary_

std::string isc::radius::RadiusImpl::dictionary_

Dictionary path.

Definition at line 266 of file radius.h.

Referenced by isc::radius::RadiusConfigParser::parse(), and toElement().

◆ extract_duid_

bool isc::radius::RadiusImpl::extract_duid_

Extract Duid from Client Id.

Definition at line 311 of file radius.h.

Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().

◆ id_type4_

◆ id_type6_

◆ proto_

◆ remap_

std::map<uint32_t, uint32_t> isc::radius::RadiusImpl::remap_

Subnet ID to NAS port map.

Definition at line 278 of file radius.h.

Referenced by cleanup(), isc::radius::getNASPort(), isc::radius::RadiusConfigParser::parse(), and toElement().

◆ reselect_subnet_address_

bool isc::radius::RadiusImpl::reselect_subnet_address_

Reselect subnet using address.

Definition at line 317 of file radius.h.

Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().

◆ reselect_subnet_pool_

bool isc::radius::RadiusImpl::reselect_subnet_pool_

Reselect subnet using pool.

Definition at line 314 of file radius.h.

Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().

◆ retries_

◆ session_history_filename_

std::string isc::radius::RadiusImpl::session_history_filename_

Session history filename.

Definition at line 323 of file radius.h.

Referenced by cleanup(), init(), isc::radius::RadiusConfigParser::parse(), and toElement().

◆ shutdown_

std::atomic< bool > isc::radius::RadiusImpl::shutdown_
static

◆ tcp_client_

isc::tcp::TcpClientPtr isc::radius::RadiusImpl::tcp_client_

TCP client.

Definition at line 275 of file radius.h.

Referenced by RadiusImpl(), cleanup(), isc::radius::TcpExchange::start(), and startServices().

◆ thread_pool_size_

unsigned isc::radius::RadiusImpl::thread_pool_size_

Thread pool size.

Definition at line 326 of file radius.h.

Referenced by RadiusImpl(), isc::radius::RadiusConfigParser::parse(), startServices(), and toElement().

◆ timeout_

unsigned isc::radius::RadiusImpl::timeout_

◆ tls_

◆ udp_client_

UdpClientPtr isc::radius::RadiusImpl::udp_client_

UDP client.

Definition at line 272 of file radius.h.

Referenced by RadiusImpl(), cleanup(), registerExchange(), startServices(), and unregisterExchange().

◆ use_message_authenticator_

bool isc::radius::RadiusImpl::use_message_authenticator_

Use Message-Authenticator attribute.

Definition at line 338 of file radius.h.

Referenced by RadiusImpl(), isc::radius::RadiusConfigParser::parse(), and toElement().


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