![]() |
Kea 3.1.9
|
Implements the logic for processing commands pertaining to SFLQ pools and data. More...
#include <sflq_cmds.h>
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 ¶ms, const std::string &name, bool default_value=false) |
| Extracts a boolean from given parameters map. | |
| static dhcp::Lease::Type | extractLeaseType (data::ConstElementPtr ¶ms, uint16_t family) |
| Extracts 'lease-type' from given parameters map. | |
| static void | extractRange (data::ConstElementPtr ¶ms, uint8_t family, asiolink::IOAddress &start_address, asiolink::IOAddress &end_address) |
| Extracts an ip address range from given parameters map. | |
Implements the logic for processing commands pertaining to SFLQ pools and data.
Definition at line 26 of file sflq_cmds.h.
|
inline |
Constructor.
Definition at line 29 of file sflq_cmds.h.
|
inlinevirtual |
Destructor.
Definition at line 32 of file sflq_cmds.h.
|
static |
Creates a success response from a list of SqlPoolInfos.
| pools | list of pools to include in the response. May be 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().
|
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.
| params | Element map containing the command arguments. |
| name | name of the desired parameter. |
| default_value | value to return if the parameter is optional and not specified. |
| BadValue | is 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.
|
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".
| params | Element map containing the command arguments. |
| family | protocol family (AF_INET or AF_INET6). |
| BadValue | if 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.
|
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.
| params | Element map containing the command arguments. | |
| family | protocol family (AF_INET or AF_INET6). | |
| [out] | start_address | IOAddress reference which receives the extracted start-address value |
| [out] | end_address | IOAddress reference which receives the extracted end-address value |
| BadValue | is 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().
| 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 } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
Definition at line 126 of file sflq_cmds.cc.
| 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": { } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
Definition at line 111 of file sflq_cmds.cc.
| 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" } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
Definition at line 121 of file sflq_cmds.cc.
| 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 } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
Definition at line 116 of file sflq_cmds.cc.
| 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" } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
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.
| 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 } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
Definition at line 219 of file sflq_cmds.cc.
| 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": { } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
Definition at line 204 of file sflq_cmds.cc.
| 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" } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
Definition at line 214 of file sflq_cmds.cc.
| 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 } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
Definition at line 209 of file sflq_cmds.cc.
| 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" } }
| handle | Callout context - which is expected to contain the the command JSON text in the "command" argument |
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.