Kea 1.5.0
isc::lease_cmds::LeaseCmdsImpl Class Reference

Wrapper class around reservation command handlers. More...

+ Inheritance diagram for isc::lease_cmds::LeaseCmdsImpl:

Classes

class  Parameters
 Parameters specified for lease commands. More...
 

Public Member Functions

Parameters getParameters (bool v6, const ConstElementPtr &args)
 Extracts parameters required for reservation-get and reservation-del.
 
int lease4DelHandler (CalloutHandle &handle)
 lease4-del command handler
 
int lease4UpdateHandler (CalloutHandle &handle)
 lease4-update handler
 
int lease4WipeHandler (CalloutHandle &handle)
 lease4-wipe handler
 
int lease6DelHandler (CalloutHandle &handle)
 lease6-del command handler
 
int lease6UpdateHandler (CalloutHandle &handle)
 lease6-update handler
 
int lease6WipeHandler (CalloutHandle &handle)
 lease6-wipe handler
 
int leaseAddHandler (CalloutHandle &handle)
 lease4-add, lease6-add command handler
 
int leaseGetAllHandler (CalloutHandle &handle)
 lease4-get-all, lease6-get-all commands handler
 
int leaseGetHandler (CalloutHandle &handle)
 lease4-get, lease6-get command handler
 
int leaseGetPageHandler (hooks::CalloutHandle &handle)
 lease4-get-page, lease6-get-page commands handler
 

Detailed Description

Wrapper class around reservation command handlers.

Definition at line 43 of file lease_cmds.cc.

Member Function Documentation

◆ getParameters()

LeaseCmdsImpl::Parameters isc::lease_cmds::LeaseCmdsImpl::getParameters ( bool  v6,
const ConstElementPtr args 
)

Extracts parameters required for reservation-get and reservation-del.

See Parameters class for detailed description of what is expected in the args structure.

Parameters
v6whether addresses allowed are v4 (false) or v6 (true)
argsarguments passed to command
Returns
parsed parameters
Exceptions
BadValueif input arguments don't make sense.

Definition at line 304 of file lease_cmds.cc.

References isc::lease_cmds::LeaseCmdsImpl::Parameters::addr, isc::lease_cmds::LeaseCmdsImpl::Parameters::client_id, isc::lease_cmds::LeaseCmdsImpl::Parameters::duid, isc::dhcp::DUID::fromText(), isc::dhcp::ClientId::fromText(), isc::dhcp::HWAddr::fromText(), isc::lease_cmds::LeaseCmdsImpl::Parameters::hwaddr, isc::lease_cmds::LeaseCmdsImpl::Parameters::iaid, isc::data::Element::integer, isc_throw, isc::asiolink::IOAddress::isV4(), isc::asiolink::IOAddress::isV6(), isc::lease_cmds::LeaseCmdsImpl::Parameters::lease_type, isc::data::Element::map, isc::lease_cmds::LeaseCmdsImpl::Parameters::query_type, isc::data::Element::string, isc::lease_cmds::LeaseCmdsImpl::Parameters::subnet_id, isc::lease_cmds::LeaseCmdsImpl::Parameters::txtToType(), isc::lease_cmds::LeaseCmdsImpl::Parameters::TYPE_ADDR, isc::lease_cmds::LeaseCmdsImpl::Parameters::TYPE_CLIENT_ID, isc::lease_cmds::LeaseCmdsImpl::Parameters::TYPE_DUID, isc::lease_cmds::LeaseCmdsImpl::Parameters::TYPE_HWADDR, isc::dhcp::Lease::TYPE_NA, isc::dhcp::Lease::TYPE_PD, isc::dhcp::Lease::TYPE_TA, and isc::dhcp::Lease::TYPE_V4.

Referenced by lease4DelHandler(), lease6DelHandler(), and leaseGetHandler().

+ Here is the call graph for this function:

◆ lease4DelHandler()

◆ lease4UpdateHandler()

int isc::lease_cmds::LeaseCmdsImpl::lease4UpdateHandler ( CalloutHandle handle)

lease4-update handler

Provides the implementation for isc::lease_cmds::LeaseCmds::lease4UpdateHandler

Parameters
handleCallout context - which is expected to contain the update command JSON text in the "command" argument
Returns
0 upon success, non-zero otherwise

Definition at line 834 of file lease_cmds.cc.

References isc::dhcp::LeaseMgr::addLease(), isc::config::CmdsImpl::cmd_args_, isc::config::CmdsImpl::extractCommand(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::LeaseMgrFactory::instance(), isc_throw, isc::lease_cmds::Lease4Parser::parse(), isc::config::CmdsImpl::setErrorResponse(), isc::config::CmdsImpl::setSuccessResponse(), and isc::dhcp::LeaseMgr::updateLease4().

+ Here is the call graph for this function:

◆ lease4WipeHandler()

int isc::lease_cmds::LeaseCmdsImpl::lease4WipeHandler ( CalloutHandle handle)

lease4-wipe handler

Provides the implementation for isc::lease_cmds::LeaseCmds::lease4WipeHandler

Parameters
handleCallout context - which is expected to contain the wipe command JSON text in the "command" argument
Returns
0 upon success, non-zero otherwise

Definition at line 904 of file lease_cmds.cc.

References isc::config::CmdsImpl::cmd_args_, isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), isc::config::CmdsImpl::extractCommand(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::data::SimpleParser::getUint32(), isc::dhcp::CfgMgr::instance(), isc::dhcp::LeaseMgrFactory::instance(), isc::config::CmdsImpl::setErrorResponse(), isc::config::CmdsImpl::setResponse(), and isc::dhcp::LeaseMgr::wipeLeases4().

+ Here is the call graph for this function:

◆ lease6DelHandler()

◆ lease6UpdateHandler()

int isc::lease_cmds::LeaseCmdsImpl::lease6UpdateHandler ( CalloutHandle handle)

lease6-update handler

Provides the implementation for isc::lease_cmds::LeaseCmds::lease6UpdateHandler

Parameters
handleCallout context - which is expected to contain the update command JSON text in the "command" argument
Returns
0 upon success, non-zero otherwise

Definition at line 869 of file lease_cmds.cc.

References isc::dhcp::LeaseMgr::addLease(), isc::config::CmdsImpl::cmd_args_, isc::config::CmdsImpl::extractCommand(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::LeaseMgrFactory::instance(), isc_throw, isc::lease_cmds::Lease6Parser::parse(), isc::config::CmdsImpl::setErrorResponse(), isc::config::CmdsImpl::setSuccessResponse(), and isc::dhcp::LeaseMgr::updateLease6().

+ Here is the call graph for this function:

◆ lease6WipeHandler()

int isc::lease_cmds::LeaseCmdsImpl::lease6WipeHandler ( CalloutHandle handle)

lease6-wipe handler

Provides the implementation for isc::lease_cmds::LeaseCmds::lease6WipeHandler

Parameters
handleCallout context - which is expected to contain the wipe command JSON text in the "command" argument
Returns
0 upon success, non-zero otherwise
Todo:
: consider extending the code with wipe-leases:

Definition at line 950 of file lease_cmds.cc.

References isc::config::CmdsImpl::cmd_args_, isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), isc::config::CmdsImpl::extractCommand(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::data::SimpleParser::getUint32(), isc::dhcp::CfgMgr::instance(), isc::dhcp::LeaseMgrFactory::instance(), isc::config::CmdsImpl::setErrorResponse(), isc::config::CmdsImpl::setResponse(), and isc::dhcp::LeaseMgr::wipeLeases6().

+ Here is the call graph for this function:

◆ leaseAddHandler()

int isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler ( CalloutHandle handle)

◆ leaseGetAllHandler()

int isc::lease_cmds::LeaseCmdsImpl::leaseGetAllHandler ( CalloutHandle handle)

lease4-get-all, lease6-get-all commands handler

These commands attempt to retrieve all IPv4 or IPv6 leases, or all IPv4 or all IPv6 leases belonging to the particular subnets. If no subnet identifiers are provided, it returns all IPv4 or IPv6 leases from the database.

Parameters
handleCallout context - which is expected to contain the get command JSON text in the "command" argument
Returns
0 upon success, non-zero otherwise.

Definition at line 502 of file lease_cmds.cc.

References isc::config::CmdsImpl::cmd_args_, isc::config::CmdsImpl::cmd_name_, isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_ERROR, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), isc::data::Element::createList(), isc::data::Element::createMap(), isc::config::CmdsImpl::extractCommand(), isc::dhcp::LeaseMgr::getLeases4(), isc::dhcp::LeaseMgr::getLeases6(), isc::dhcp::LeaseMgrFactory::instance(), isc::data::Element::integer, isc_throw, isc::data::Element::list, isc::config::CmdsImpl::setErrorResponse(), and isc::config::CmdsImpl::setResponse().

+ Here is the call graph for this function:

◆ leaseGetHandler()

int isc::lease_cmds::LeaseCmdsImpl::leaseGetHandler ( CalloutHandle handle)

◆ leaseGetPageHandler()

int isc::lease_cmds::LeaseCmdsImpl::leaseGetPageHandler ( hooks::CalloutHandle handle)

lease4-get-page, lease6-get-page commands handler

These commands attempt to retrieve 1 page of leases. The maximum size of the page is specified by the caller. The caller also specifies the last address returned in the previous page. The new page starts from the first address following the address specified by the caller. If the first page should be returned the IPv4 zero address, IPv6 zero address or the keyword "start" should be provided instead of the last address.

Parameters
handleCallout context - which is expected to contain the get commands JSON text in the "command" argument.
Returns
0 if the handler has been invoked successfully, 1 if an error occurs, 3 if no leases are returned.

Definition at line 585 of file lease_cmds.cc.

References isc::config::CmdsImpl::cmd_args_, isc::config::CmdsImpl::cmd_name_, isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_ERROR, isc::config::CONTROL_RESULT_SUCCESS, isc::data::Element::create(), isc::config::createAnswer(), isc::data::Element::createList(), isc::data::Element::createMap(), isc::config::CmdsImpl::extractCommand(), isc::dhcp::LeaseMgr::getLeases4(), isc::dhcp::LeaseMgr::getLeases6(), isc::dhcp::LeaseMgrFactory::instance(), isc::data::Element::integer, isc_throw, isc::config::CmdsImpl::setErrorResponse(), isc::config::CmdsImpl::setResponse(), and isc::data::Element::string.

+ Here is the call graph for this function:

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