Kea 3.1.9
isc::lease_cmds::SflqCmdsImpl Class Reference

Implements the logic for processing commands pertaining to SFLQ pools and data. More...

#include <sflq_cmds.h>

Inheritance diagram for isc::lease_cmds::SflqCmdsImpl:

Public Member Functions

 SflqCmdsImpl ()
 Constructor.
virtual ~SflqCmdsImpl ()
 Destructor.
int sflqPool4DelHandler (hooks::CalloutHandle &handle)
 Delete the SFLQ V4 pool that matches a start and end address.
int sflqPool4GetAllHandler (hooks::CalloutHandle &handle)
 The 'sflq-pool4-get-all' command handler.
int sflqPool4GetByRangeHandler (hooks::CalloutHandle &handle)
 Handles a 'sflq-pool4-by-range' command.
int sflqPool4GetBySubnetHandler (hooks::CalloutHandle &handle)
 The 'sflq-pool4-by-subnet' command handler.
int sflqPool4RebuildHandler (hooks::CalloutHandle &handle)
 The 'sflq-pool4-rebuild' command handler.
int sflqPool6DelHandler (hooks::CalloutHandle &handle)
 Delete the SFLQ V6 pool that matches a start and end address.
int sflqPool6GetAllHandler (hooks::CalloutHandle &handle)
 The 'sflq-pool6-get-all' command handler.
int sflqPool6GetByRangeHandler (hooks::CalloutHandle &handle)
 Handles a 'sflq-pool6-by-range' command.
int sflqPool6GetBySubnetHandler (hooks::CalloutHandle &handle)
 The 'sflq-pool6-by-subnet' command handler.
int sflqPool6RebuildHandler (hooks::CalloutHandle &handle)
 The 'sflq-pool6-rebuild' command handler.

Static Public Member Functions

static data::ConstElementPtr buildGetResponse (dhcp::SflqPoolInfoCollectionPtr pools)
 Creates a success response from a list of SqlPoolInfos.
static bool extractBool (data::ConstElementPtr &params, const std::string &name, bool default_value=false)
 Extracts a boolean from given parameters map.
static dhcp::Lease::Type extractLeaseType (data::ConstElementPtr &params, uint16_t family)
 Extracts 'lease-type' from given parameters map.
static void extractRange (data::ConstElementPtr &params, uint8_t family, asiolink::IOAddress &start_address, asiolink::IOAddress &end_address)
 Extracts an ip address range from given parameters map.

Detailed Description

Implements the logic for processing commands pertaining to SFLQ pools and data.

Definition at line 26 of file sflq_cmds.h.

Constructor & Destructor Documentation

◆ SflqCmdsImpl()

isc::lease_cmds::SflqCmdsImpl::SflqCmdsImpl ( )
inline

Constructor.

Definition at line 29 of file sflq_cmds.h.

◆ ~SflqCmdsImpl()

virtual isc::lease_cmds::SflqCmdsImpl::~SflqCmdsImpl ( )
inlinevirtual

Destructor.

Definition at line 32 of file sflq_cmds.h.

Member Function Documentation

◆ buildGetResponse()

ConstElementPtr isc::lease_cmds::SflqCmdsImpl::buildGetResponse ( dhcp::SflqPoolInfoCollectionPtr pools)
static

Creates a success response from a list of SqlPoolInfos.

Parameters
poolslist of pools to include in the response. May be empty.
Returns
API response structure with a result code of CONTROL_RESULT_SUCCESS if the list of pools is not empty, otherwise CONTROL_RESULT_EMPTY.

Definition at line 420 of file sflq_cmds.cc.

References isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), Element::createList(), and Element::createMap().

Here is the call graph for this function:

◆ extractBool()

bool isc::lease_cmds::SflqCmdsImpl::extractBool ( data::ConstElementPtr & params,
const std::string & name,
bool default_value = false )
static

Extracts a boolean from given parameters map.

Extracts a boolean element from the given map and returns its value. If the parameter is not found in the map, the function will the function will return the default value.

Parameters
paramsElement map containing the command arguments.
namename of the desired parameter.
default_valuevalue to return if the parameter is optional and not specified.
Exceptions
BadValueis either parameter is missing, is not a valid ip address or they do not constitute a valid range.

Definition at line 453 of file sflq_cmds.cc.

References Element::boolean, and isc_throw.

◆ extractLeaseType()

Lease::Type isc::lease_cmds::SflqCmdsImpl::extractLeaseType ( data::ConstElementPtr & params,
uint16_t family )
static

Extracts 'lease-type' from given parameters map.

Extracts a string element, 'lease-type' from the given map For v4 it can be either "V4" or "3", for V6 it can be "IA_NA" "0", "IA_PD", or "2".

Parameters
paramsElement map containing the command arguments.
familyprotocol family (AF_INET or AF_INET6).
Exceptions
BadValueif the parameter is not valid for the protocol family.

Definition at line 468 of file sflq_cmds.cc.

References isc::data::SimpleParser::getString(), isc_throw, isc::dhcp::Lease::TYPE_NA, isc::dhcp::Lease::TYPE_PD, and isc::dhcp::Lease::TYPE_V4.

Here is the call graph for this function:

◆ extractRange()

void isc::lease_cmds::SflqCmdsImpl::extractRange ( data::ConstElementPtr & params,
uint8_t family,
asiolink::IOAddress & start_address,
asiolink::IOAddress & end_address )
static

Extracts an ip address range from given parameters map.

Expects the map to contain valid addresses of the the given family (AF_INET or AF_INET6), specified as 'start-address' and 'end-address' and where the former is less than or equal to the latter.

Parameters
paramsElement map containing the command arguments.
familyprotocol family (AF_INET or AF_INET6).
[out]start_addressIOAddress reference which receives the extracted start-address value
[out]end_addressIOAddress reference which receives the extracted end-address value
Exceptions
BadValueis either parameter is missing, is not a valid ip address or they do not constitute a valid range.

Definition at line 441 of file sflq_cmds.cc.

References isc::data::SimpleParser::getAddress(), isc::asiolink::validateV4Range(), and isc::asiolink::validateV6Range().

Referenced by sflqPool4RebuildHandler(), and sflqPool6RebuildHandler().

Here is the call graph for this function:

◆ sflqPool4DelHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool4DelHandler ( hooks::CalloutHandle & handle)

Delete the SFLQ V4 pool that matches a start and end address.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool4-del", "arguments": { "start-address": "192.0.2.0", "end-address": "192.0.2.255", "force": false } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 126 of file sflq_cmds.cc.

◆ sflqPool4GetAllHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool4GetAllHandler ( hooks::CalloutHandle & handle)

The 'sflq-pool4-get-all' command handler.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool4-get-all", "arguments": { } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 111 of file sflq_cmds.cc.

◆ sflqPool4GetByRangeHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool4GetByRangeHandler ( hooks::CalloutHandle & handle)

Handles a 'sflq-pool4-by-range' command.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool4-get-by-range", "arguments": { "start-address": "192.0.2.0", "end-address": "192.0.2.255" } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 121 of file sflq_cmds.cc.

◆ sflqPool4GetBySubnetHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool4GetBySubnetHandler ( hooks::CalloutHandle & handle)

The 'sflq-pool4-by-subnet' command handler.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool4-get-by-subnet", "arguments": { "subnet-id" : 100 } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 116 of file sflq_cmds.cc.

◆ sflqPool4RebuildHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool4RebuildHandler ( hooks::CalloutHandle & handle)

The 'sflq-pool4-rebuild' command handler.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool4-rebuild", "arguments": { "start-address": "192.0.2.0", "end-address": "192.0.2.255" } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 39 of file sflq_cmds.cc.

References isc::data::SimpleParser::checkKeywords(), isc::data::SimpleParser::checkRequired(), isc::config::CmdsImpl::cmd_args_, isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), isc::config::CmdsImpl::extractCommand(), extractRange(), isc::dhcp::LeaseMgrFactory::instance(), isc::asiolink::IOAddress::IPV4_ZERO_ADDRESS(), isc_throw, isc::lease_cmds::LEASE_CMDS_DBG_COMMAND_DATA, isc::lease_cmds::lease_cmds_logger, LOG_DEBUG, LOG_ERROR, Element::map, isc::config::CmdsImpl::setErrorResponse(), isc::config::CmdsImpl::setResponse(), SFLQ_POOL4_REBUILD, SFLQ_POOL4_REBUILD_FAILED, isc::dhcp::LeaseMgr::sflqCreateFlqPool4(), isc::dhcp::LeaseMgr::sflqPool4Get(), and Element::string.

Here is the call graph for this function:

◆ sflqPool6DelHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool6DelHandler ( hooks::CalloutHandle & handle)

Delete the SFLQ V6 pool that matches a start and end address.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool6-del", "arguments": { "start-address": "3001::", "end-address": "3001::FFFF", "force": false } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 219 of file sflq_cmds.cc.

◆ sflqPool6GetAllHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool6GetAllHandler ( hooks::CalloutHandle & handle)

The 'sflq-pool6-get-all' command handler.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool6-get-all", "arguments": { } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 204 of file sflq_cmds.cc.

◆ sflqPool6GetByRangeHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool6GetByRangeHandler ( hooks::CalloutHandle & handle)

Handles a 'sflq-pool6-by-range' command.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool6-get-by-range", "arguments": { "start-address": "3001::", "end-address": "3001::FFFF" } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 214 of file sflq_cmds.cc.

◆ sflqPool6GetBySubnetHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool6GetBySubnetHandler ( hooks::CalloutHandle & handle)

The 'sflq-pool6-by-subnet' command handler.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool6-get-by-subnet", "arguments": { "subnet-id" : 100 } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 209 of file sflq_cmds.cc.

◆ sflqPool6RebuildHandler()

int isc::lease_cmds::SflqCmdsImpl::sflqPool6RebuildHandler ( hooks::CalloutHandle & handle)

The 'sflq-pool6-rebuild' command handler.

It extracts the command name and arguments from the given CalloutHandle, attempts to process them, and then set's the handle's "response" argument accordingly.

An example command with all supported arguments is shown below: { "command": "sflq-pool6-rebuild", "arguments": { "start-address": "3001::", "end-address": "3001::FF" } }

Parameters
handleCallout context - which is expected to contain the the command JSON text in the "command" argument
Returns
result of the operation

Definition at line 131 of file sflq_cmds.cc.

References isc::data::SimpleParser::checkKeywords(), isc::data::SimpleParser::checkRequired(), isc::config::CmdsImpl::cmd_args_, isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), isc::config::CmdsImpl::extractCommand(), extractRange(), isc::dhcp::LeaseMgrFactory::instance(), isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS(), isc_throw, isc::lease_cmds::LEASE_CMDS_DBG_COMMAND_DATA, isc::lease_cmds::lease_cmds_logger, LOG_DEBUG, LOG_ERROR, Element::map, isc::config::CmdsImpl::setErrorResponse(), isc::config::CmdsImpl::setResponse(), SFLQ_POOL6_REBUILD, SFLQ_POOL6_REBUILD_FAILED, isc::dhcp::LeaseMgr::sflqCreateFlqPool6(), isc::dhcp::LeaseMgr::sflqPool6Get(), and Element::string.

Here is the call graph for this function:

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