![]() |
Kea 3.1.1
|
#include <config.h>
#include <asiolink/io_service_mgr.h>
#include <cc/command_interpreter.h>
#include <cc/simple_parser.h>
#include <hooks/hooks.h>
#include <dhcp/pkt4.h>
#include <dhcp/pkt6.h>
#include <dhcpsrv/lease.h>
#include <dhcpsrv/subnet.h>
#include <radius.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/host_mgr.h>
#include <process/daemon.h>
#include <radius_log.h>
#include <radius_parsers.h>
#include <radius_access.h>
#include <radius_accounting.h>
#include <util/multi_threading_mgr.h>
#include <string>
#include <sstream>
#include <vector>
Go to the source code of this file.
Functions | |
int | command_processed (CalloutHandle &handle) |
This callout is called at the "command_processed" hook point. | |
int | dhcp4_srv_configured (CalloutHandle &) |
This function is called by the DHCPv4 server when it is configured. | |
int | dhcp6_srv_configured (CalloutHandle &) |
This function is called by the DHCPv6 server when it is configured. | |
int | lease4_decline (CalloutHandle &handle) |
This callout is called at the "lease4_decline" hook. | |
int | lease4_expire (CalloutHandle &handle) |
This callout is called at the "lease4_expire" hook. | |
int | lease4_release (CalloutHandle &handle) |
This callout is called at the "lease4_release" hook. | |
int | lease4_renew (CalloutHandle &handle) |
This callout is called at the "lease4_renew" hook. | |
int | lease4_select (CalloutHandle &handle) |
This callout is called at the "lease4_select" hook. | |
int | lease6_decline (CalloutHandle &handle) |
This callout is called at the "lease6_decline" hook. | |
int | lease6_expire (CalloutHandle &handle) |
This callout is called at the "lease6_expire" hook. | |
int | lease6_rebind (CalloutHandle &handle) |
This callout is called at the "lease6_rebind" hook. | |
int | lease6_release (CalloutHandle &handle) |
This callout is called at the "lease6_release" hook. | |
int | lease6_renew (CalloutHandle &handle) |
This callout is called at the "lease6_renew" hook. | |
int | lease6_select (CalloutHandle &handle) |
This callout is called at the "lease6_select" hook. | |
int | load (LibraryHandle &handle) |
This function is called when the library is loaded. | |
int | multi_threading_compatible () |
This function is called to retrieve the multi-threading compatibility. | |
int | subnet4_select (CalloutHandle &handle) |
This callout tries to retrieve host information from cache. | |
int | subnet6_select (CalloutHandle &handle) |
This callout tries to retrieve host information from cache. | |
int | unload () |
This function is called when the library is unloaded. | |
int command_processed | ( | CalloutHandle & | handle | ) |
This callout is called at the "command_processed" hook point.
If any lease{4,6}-add/update/del command is issued, this code sends appropriate Radius packets to the accounting server.
handle | callout handle passed to the callout. |
Definition at line 884 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_ADD, isc::radius::EVENT_DEL, isc::radius::EVENT_UPDATE, isc::hooks::CalloutHandle::getArgument(), isc::data::SimpleParser::getInteger(), isc::radius::RadiusImpl::instance(), LOG_ERROR, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, isc::radius::RadiusAccounting::runAsync(), and Element::string.
int dhcp4_srv_configured | ( | CalloutHandle & | ) |
This function is called by the DHCPv4 server when it is configured.
The only purpose of this callout is to retrieve io_service_ reference.
handle | callout handle passed to the callout. |
Definition at line 421 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::asiolink::IOServiceMgr::instance(), isc::radius::RadiusImpl::instance(), isc::asiolink::IOServiceMgr::registerIOService(), and isc::radius::RadiusImpl::startServices().
int dhcp6_srv_configured | ( | CalloutHandle & | ) |
This function is called by the DHCPv6 server when it is configured.
The only purpose of this callout is to retrieve io_service_ reference.
handle | callout handle passed to the callout. |
Definition at line 433 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::asiolink::IOServiceMgr::instance(), isc::radius::RadiusImpl::instance(), isc::asiolink::IOServiceMgr::registerIOService(), and isc::radius::RadiusImpl::startServices().
int lease4_decline | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease4_decline" hook.
It does transmit Accounting-Request with Acct-Status-Type set to Stop.
handle | callout handle passed to the callout. |
Definition at line 643 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_DECLINE, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease4_expire | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease4_expire" hook.
handle | callout handle passed to the callout. |
Definition at line 673 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_EXPIRE, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease4_release | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease4_release" hook.
It does transmit Accounting-Request with Acct-Status-Type set to Stop.
handle | callout handle passed to the callout. |
Definition at line 610 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_RELEASE, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease4_renew | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease4_renew" hook.
It does transmit Accounting-Request with Acct-Status-Type set to Interim-Update.
handle | callout handle passed to the callout. |
Definition at line 577 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_RENEW, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease4_select | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease4_select" hook.
It does transmit Accounting-Request with Acct-Status-Type set to Start if a lease has been assigned.
handle | callout handle passed to the callout. |
Definition at line 536 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_CREATE, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease6_decline | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease6_decline" hook.
handle | callout handle passed to the callout. |
Definition at line 823 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_DECLINE, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease6_expire | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease6_expire" hook.
handle | callout handle passed to the callout. |
Definition at line 852 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_EXPIRE, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease6_rebind | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease6_rebind" hook.
handle | callout handle passed to the callout. |
Definition at line 765 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_REBIND, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease6_release | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease6_release" hook.
handle | callout handle passed to the callout. |
Definition at line 794 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_RELEASE, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease6_renew | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease6_renew" hook.
handle | callout handle passed to the callout. |
Definition at line 736 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_RENEW, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int lease6_select | ( | CalloutHandle & | handle | ) |
This callout is called at the "lease6_select" hook.
handle | callout handle passed to the callout. |
Definition at line 702 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::radius::EVENT_CREATE, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), LOG_ERROR, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::radius::RADIUS_HOOK_FAILED, isc::radius::radius_logger, and isc::radius::RadiusAccounting::runAsync().
int load | ( | LibraryHandle & | handle | ) |
This function is called when the library is loaded.
handle | library handle |
Definition at line 366 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_ERROR, isc::config::CONTROL_RESULT_SUCCESS, isc::dhcp::CfgMgr::getFamily(), isc::process::Daemon::getProcName(), isc::dhcp::CfgMgr::instance(), isc::radius::RadiusImpl::instance(), isc_throw, LOG_ERROR, LOG_INFO, isc::radius::RADIUS_CONFIGURATION_FAILED, isc::radius::RADIUS_INIT_OK, and isc::radius::radius_logger.
int multi_threading_compatible | ( | ) |
This function is called to retrieve the multi-threading compatibility.
Definition at line 411 of file radius_callout.cc.
int subnet4_select | ( | CalloutHandle & | handle | ) |
This callout tries to retrieve host information from cache.
This function is called by the DHCPv4 server when a subnet is being selected. It uses input packet to extract identifier and then looks for host entry in the host cache.
handle | callout handle passed to the callout. |
Definition at line 447 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getParkingLotHandlePtr(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_PARK, CalloutHandle::NEXT_STEP_SKIP, and isc::hooks::CalloutHandle::setStatus().
int subnet6_select | ( | CalloutHandle & | handle | ) |
This callout tries to retrieve host information from cache.
This function is called by the DHCPv4 server when a subnet is being selected. It uses input packet to extract identifier and then looks for host entry in the host cache.
handle | callout handle passed to the callout. |
Definition at line 492 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getParkingLotHandlePtr(), isc::hooks::CalloutHandle::getStatus(), isc::radius::RadiusImpl::instance(), CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_PARK, CalloutHandle::NEXT_STEP_SKIP, and isc::hooks::CalloutHandle::setStatus().
int unload | ( | ) |
This function is called when the library is unloaded.
Definition at line 401 of file radius_callout.cc.
References isc::config::CONTROL_RESULT_SUCCESS, isc::asiolink::IOServiceMgr::instance(), isc::radius::RadiusImpl::instance(), LOG_INFO, isc::radius::RADIUS_DEINIT_OK, isc::radius::radius_logger, isc::radius::RadiusImpl::reset(), and isc::asiolink::IOServiceMgr::unregisterIOService().