Kea 3.1.1
isc::subnet_cmds::SubnetCmdsImpl Class Reference

Implementation of the SubnetCmds class. More...

Public Member Functions

template<typename SimpleParserType, typename SharedNetworkParserType, typename CfgNetworksType, typename CfgSubnetsType>
ConstElementPtr addNetwork (CfgNetworksType &networks_cfg, CfgSubnetsType &subnets_cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
 Provides a response to a 'network4-add' and 'network6-add' command.
 
template<typename CfgNetworksType, typename CfgSubnetsType>
ConstElementPtr addNetworkSubnet (CfgNetworksType &networks, CfgSubnetsType &subnets, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
 Provides a response to a 'network4-subnet-add' and 'network6-subnet-add' command.
 
template<typename SimpleParserType, typename SubnetConfigParserType, typename CfgType>
ConstElementPtr addSubnet (CfgType &cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &subnet_parameter, const std::string &protocol_version)
 Provides a response to a 'subnet4-add' and 'subnet6-add' command.
 
template<typename CfgNetworksType, typename CfgSubnetsType>
ConstElementPtr delNetwork (CfgNetworksType &networks_cfg, CfgSubnetsType &subnets_cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
 Provides a response to a 'network4-del' and 'network6-del' command.
 
template<typename CfgNetworksType>
ConstElementPtr delNetworkSubnet (CfgNetworksType &networks, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
 Provides a response to a 'network4-subnet-del' and 'network6-subnet-del' command.
 
template<typename CfgType, typename SharedNetworkPtrType>
ConstElementPtr delSubnet (CfgType &cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
 Provides a response to a 'subnet4-del' and 'subnet6-del' command.
 
template<typename NetworkTypePtr, typename CfgType>
ConstElementPtr getNetwork (const CfgType &cfg, const data::ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version) const
 Provides a response to a 'network4-get' or 'network6-get' command.
 
template<typename CfgType>
ConstElementPtr getNetworkList (const CfgType &networks_cfg, const std::string &protocol_type) const
 Returns a response to a 'network4-list' and 'network6-list' command.
 
template<typename SubnetTypePtr, typename CfgType>
ConstElementPtr getSubnet (const CfgType &cfg, const data::ConstElementPtr &arguments, const std::string &command_name, const std::string &subnet_parameter, const std::string &protocol_version) const
 Provides a response to a 'subnet4-get' or 'subnet6-get' command.
 
template<typename CfgType>
ConstElementPtr getSubnetList (const CfgType &cfg, const std::string &protocol_type) const
 Returns a response to a 'subnet4-list' and 'subnet6-list' command.
 
ElementPtr subnetToElement (const Subnet &subnet, bool include_shared_network) const
 Returns essential subnet parameters in Element format.
 
template<typename SimpleParserType, typename SubnetConfigParserType, typename SharedNetworkPtrType, typename SubnetTypePtr, typename CfgType>
ConstElementPtr updateSubnet (CfgType &cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &subnet_parameter, const std::string &protocol_version, UpdateType type=UPDATE_REPLACE)
 Provides a response to a 'subnet4-update' and 'subnet6-update' command.
 

Detailed Description

Implementation of the SubnetCmds class.

It provides generic functions for subnet manipulations.

Definition at line 318 of file subnet_cmds.cc.

Member Function Documentation

◆ addNetwork()

template<typename SimpleParserType, typename SharedNetworkParserType, typename CfgNetworksType, typename CfgSubnetsType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::addNetwork ( CfgNetworksType & networks_cfg,
CfgSubnetsType & subnets_cfg,
const ConstElementPtr & arguments,
const std::string & command_name,
const std::string & protocol_version )
inline

Provides a response to a 'network4-add' and 'network6-add' command.

This method is used for processing 'network4-add' and 'network6-add' commands. It parses received command, adds the network to the current server configuration and provides a response to the controlling client.

Parameters
networks_cfgReference to the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr object.
subnets_cfgReference to the CfgSubnets4Ptr or CfgSubnets6Ptr.
argumentsPointer to the arguments specified in the command.
command_nameOne of the following: 'network4-add' or 'network6-add'.
protocol_versionOne of the following: 'IPv4' or 'IPv6'.
Template Parameters
SimpleParserTypeOne of the SimpleParser4 or SimpleParser6
SharedNetworkParserTypeOne of the SharedNetwork4Parser or SharedNetwork6Parser.
CfgNetworksTypeOne of the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr.
CfgSubnetsTypeOne of the CfgSubnets4Ptr or CfgSubnets6Ptr.
Returns
Pointer to the object representing a response. This pointer is only returned to indicate successful processing of the command. Errors are signaled to a caller by exceptions.

Definition at line 1123 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_SUCCESS, Element::create(), isc::config::createAnswer(), Element::createList(), Element::createMap(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc_throw, Element::list, LOG_INFO, Element::map, isc::subnet_cmds::subnet_cmds_logger, and isc::subnet_cmds::SUBNET_CMDS_NETWORK_ADD.

+ Here is the call graph for this function:

◆ addNetworkSubnet()

template<typename CfgNetworksType, typename CfgSubnetsType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::addNetworkSubnet ( CfgNetworksType & networks,
CfgSubnetsType & subnets,
const ConstElementPtr & arguments,
const std::string & command_name,
const std::string & protocol_version )
inline

Provides a response to a 'network4-subnet-add' and 'network6-subnet-add' command.

This method is used for processing 'network4-subnet-add' and 'network6-subnet-add' commands. It parses received command, adds existing subnet to existing shared network to the current server configuration and provides a response to the controlling client.

Parameters
networksReference to the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr object.
subnetsReference to the CfgSubnets4Ptr or CfgSubnets6Ptr object.
argumentsPointer to the arguments specified in the command.
command_nameOne of the following: 'network4-subnet-add' or 'network6-subnet-add'.
protocol_versionOne of the following: 'IPv4' or 'IPv6'.
Template Parameters
CfgNetworksTypeOne of the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr
CfgSubnetsTypeOne of the CfgSubnets4Ptr or CfgSubnets6Ptr
Returns
Pointer to the object representing a response. This pointer is only returned to indicate successful processing of the command. Errors are signaled to a caller by exceptions.

Definition at line 1384 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), Element::integer, isc_throw, LOG_INFO, Element::map, Element::string, isc::subnet_cmds::subnet_cmds_logger, and isc::subnet_cmds::SUBNET_CMDS_NETWORK_SUBNET_ADD.

+ Here is the call graph for this function:

◆ addSubnet()

template<typename SimpleParserType, typename SubnetConfigParserType, typename CfgType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::addSubnet ( CfgType & cfg,
const ConstElementPtr & arguments,
const std::string & command_name,
const std::string & subnet_parameter,
const std::string & protocol_version )
inline

Provides a response to a 'subnet4-add' and 'subnet6-add' command.

This method is used for processing 'subnet4-add' and 'subnet6-add' commands. It parses received command, adds the subnet to the current server configuration and provides a response to the controlling client.

Parameters
cfgReference to the CfgSubnets4Ptr or CfgSubnets6Ptr object.
argumentsPointer to the arguments specified in the command.
command_nameOne of the following: 'subnet4-add' or 'subnet6-add'.
subnet_parameterOne of the following: 'subnet4' or 'subnet6'.
protocol_versionOne of the following: 'IPv4' or 'IPv6'.
Template Parameters
SimpleParserTypeOne of the SimpleParser4 or SimpleParser6
SubnetConfigParserTypeOne of the Subnet4ConfigParser or Subnet6ConfigParser.
CfgTypeOne of the CfgSubnets4Ptr or CfgSubnets6Ptr.
Returns
Pointer to the object representing a response. This pointer is only returned to indicate successful processing of the command. Errors are signaled to a caller by exceptions.

Definition at line 504 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_SUCCESS, Element::create(), isc::config::createAnswer(), Element::createList(), Element::createMap(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc_throw, Element::list, LOG_INFO, Element::map, isc::subnet_cmds::subnet_cmds_logger, and isc::subnet_cmds::SUBNET_CMDS_SUBNET_ADD.

+ Here is the call graph for this function:

◆ delNetwork()

template<typename CfgNetworksType, typename CfgSubnetsType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::delNetwork ( CfgNetworksType & networks_cfg,
CfgSubnetsType & subnets_cfg,
const ConstElementPtr & arguments,
const std::string & command_name,
const std::string & protocol_version )
inline

Provides a response to a 'network4-del' and 'network6-del' command.

Parameters
networks_cfgReference to the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr object.
subnets_cfgReference to the CfgSubnets4Ptr or CfgSubnets6Ptr.
argumentsPointer to the arguments specified in the command.
command_nameOne of the following: 'network4-del' or 'network6-del'.
protocol_versionOne of the following: 'IPv4' or 'IPv6'.
Template Parameters
CfgNetworksTypeOne of the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr.
CfgSubnetsTypeOne of the CfgSubnets4Ptr or CfgSubnets6Ptr.
Returns
Pointer to the object representing a response. This pointer is only returned to indicate successful processing of the command. Errors are signaled to a caller by exceptions.

Definition at line 1253 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, Element::create(), isc::config::createAnswer(), Element::createList(), Element::createMap(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), isc_throw, LOG_INFO, Element::map, Element::string, isc::subnet_cmds::subnet_cmds_logger, and isc::subnet_cmds::SUBNET_CMDS_NETWORK_DEL.

+ Here is the call graph for this function:

◆ delNetworkSubnet()

template<typename CfgNetworksType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::delNetworkSubnet ( CfgNetworksType & networks,
const ConstElementPtr & arguments,
const std::string & command_name,
const std::string & protocol_version )
inline

Provides a response to a 'network4-subnet-del' and 'network6-subnet-del' command.

This method is used for processing 'network4-subnet-del' and 'network6-subnet-del' commands. It parses received command, removes existing subnet from existing shared network in the current server configuration and provides a response to the controlling client.

Parameters
networksReference to the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr object.
argumentsPointer to the arguments specified in the command.
command_nameOne of the following: 'network4-subnet-add' or 'network6-subnet-add'.
protocol_versionOne of the following: 'IPv4' or 'IPv6'.
Template Parameters
CfgNetworksTypeOne of the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr
Returns
Pointer to the object representing a response. This pointer is only returned to indicate successful processing of the command. Errors are signaled to a caller by exceptions.

Definition at line 1480 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), Element::integer, isc_throw, LOG_INFO, Element::map, Element::string, isc::subnet_cmds::subnet_cmds_logger, and isc::subnet_cmds::SUBNET_CMDS_NETWORK_SUBNET_DEL.

+ Here is the call graph for this function:

◆ delSubnet()

template<typename CfgType, typename SharedNetworkPtrType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::delSubnet ( CfgType & cfg,
const ConstElementPtr & arguments,
const std::string & command_name,
const std::string & protocol_version )
inline

Provides a response to a 'subnet4-del' and 'subnet6-del' command.

Parameters
cfgReference to the CfgSubnets4Ptr or CfgSubnets6Ptr object.
argumentsPointer to the arguments specified in the command.
command_nameOne of the following: 'subnet4-del' or 'subnet6-del'.
protocol_versionOne of the following: 'IPv4' or 'IPv6'.
Template Parameters
CfgTypeOne of the CfgSubnets4Ptr or CfgSubnets6Ptr.
SharedNetworkPtrTypeOne of the SharedNetwork4Ptr or SharedNetwork6Ptr.
Returns
Pointer to the object representing a response. This pointer is only returned to indicate successful processing of the command. Errors are signaled to a caller by exceptions.

Definition at line 854 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), Element::createList(), Element::createMap(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), Element::integer, isc_throw, LOG_INFO, Element::map, isc::subnet_cmds::subnet_cmds_logger, isc::subnet_cmds::SUBNET_CMDS_SUBNET_DEL, and subnetToElement().

+ Here is the call graph for this function:

◆ getNetwork()

template<typename NetworkTypePtr, typename CfgType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::getNetwork ( const CfgType & cfg,
const data::ConstElementPtr & arguments,
const std::string & command_name,
const std::string & protocol_version ) const
inline

Provides a response to a 'network4-get' or 'network6-get' command.

Parameters
cfgReference to the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr object.
argumentsPointer to the arguments specified in the command.
command_nameOne of the following: 'network4-get' or 'network6-get'.
protocol_versionOne of the following: 'IPv4' or 'IPv6'.
Template Parameters
NetworkTypePtrOne of the following types: SharedNetwork4Ptr or SharedNetwork4Ptr.
CfgTypeOne of the following types: CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr holding shared networks configuration.

Definition at line 1040 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), Element::createList(), Element::createMap(), isc_throw, LOG_INFO, Element::map, Element::string, isc::subnet_cmds::subnet_cmds_logger, isc::subnet_cmds::SUBNET_CMDS_NETWORK_GET, and isc::subnet_cmds::SUBNET_CMDS_NETWORK_GET_EMPTY.

+ Here is the call graph for this function:

◆ getNetworkList()

template<typename CfgType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::getNetworkList ( const CfgType & networks_cfg,
const std::string & protocol_type ) const
inline

Returns a response to a 'network4-list' and 'network6-list' command.

Whether this function returns a list of IPv4 or IPv6 networks depends on the type of the cfg object provided by the caller.

Parameters
networks_cfgReference to the CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr object.
protocol_type'IPv4' or 'IPv6', depending on the network types being retrieved.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.
Template Parameters
CfgTypeOne of the following types: CfgSharedNetworks4Ptr or CfgSharedNetworks6Ptr holding shared networks configuration.

Definition at line 985 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, Element::create(), isc::config::createAnswer(), Element::createList(), Element::createMap(), LOG_INFO, isc::subnet_cmds::subnet_cmds_logger, isc::subnet_cmds::SUBNET_CMDS_NETWORK_LIST, and isc::subnet_cmds::SUBNET_CMDS_NETWORK_LIST_EMPTY.

+ Here is the call graph for this function:

◆ getSubnet()

template<typename SubnetTypePtr, typename CfgType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::getSubnet ( const CfgType & cfg,
const data::ConstElementPtr & arguments,
const std::string & command_name,
const std::string & subnet_parameter,
const std::string & protocol_version ) const
inline

Provides a response to a 'subnet4-get' or 'subnet6-get' command.

Parameters
cfgReference to the CfgSubnets4Ptr or CfgSubnets6Ptr object.
argumentsPointer to the arguments specified in the command.
command_nameOne of the following: 'subnet4-get' or 'subnet6-get'.
subnet_parameterOne of the following: 'subnet4' or 'subnet6'.
protocol_versionOne of the following: 'IPv4' or 'IPv6'.
Template Parameters
SubnetTypePtrOne of the following types: ConstSubnet4Ptr or ConstSubnet6Ptr.
CfgTypeOne of the following types: CfgSubnets4Ptr or CfgSubnets6Ptr holding subnets configuration.

Definition at line 392 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), Element::createList(), Element::createMap(), Element::integer, isc_throw, LOG_INFO, Element::map, Element::string, isc::subnet_cmds::subnet_cmds_logger, isc::subnet_cmds::SUBNET_CMDS_SUBNET_GET, and isc::subnet_cmds::SUBNET_CMDS_SUBNET_GET_EMPTY.

+ Here is the call graph for this function:

◆ getSubnetList()

template<typename CfgType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::getSubnetList ( const CfgType & cfg,
const std::string & protocol_type ) const
inline

Returns a response to a 'subnet4-list' and 'subnet6-list' command.

Whether this function returns a list of IPv4 or IPv6 subnets depends on the type of the cfg object provided by the caller.

Parameters
cfgReference to the CfgSubnets4Ptr or CfgSubnets6Ptr object.
protocol_type'IPv4' or 'IPv6', depending on the subnet types being retrieved.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.
Template Parameters
CfgTypeOne of the following types: CfgSubnets4Ptr or CfgSubnets6Ptr holding subnets configuration.

Definition at line 337 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_EMPTY, isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), Element::createList(), Element::createMap(), LOG_INFO, isc::subnet_cmds::subnet_cmds_logger, isc::subnet_cmds::SUBNET_CMDS_SUBNET_LIST, isc::subnet_cmds::SUBNET_CMDS_SUBNET_LIST_EMPTY, and subnetToElement().

+ Here is the call graph for this function:

◆ subnetToElement()

ElementPtr isc::subnet_cmds::SubnetCmdsImpl::subnetToElement ( const Subnet & subnet,
bool include_shared_network ) const
inline

Returns essential subnet parameters in Element format.

subnet details of that subnet will be returned

Returns
id and subnet in Element format

Definition at line 949 of file subnet_cmds.cc.

References Element::create(), isc::data::Element::create(), Element::createMap(), isc::dhcp::Subnet::getID(), isc::dhcp::Subnet::getSharedNetworkName(), and isc::dhcp::Subnet::toText().

Referenced by delSubnet(), and getSubnetList().

+ Here is the call graph for this function:

◆ updateSubnet()

template<typename SimpleParserType, typename SubnetConfigParserType, typename SharedNetworkPtrType, typename SubnetTypePtr, typename CfgType>
ConstElementPtr isc::subnet_cmds::SubnetCmdsImpl::updateSubnet ( CfgType & cfg,
const ConstElementPtr & arguments,
const std::string & command_name,
const std::string & subnet_parameter,
const std::string & protocol_version,
UpdateType type = UPDATE_REPLACE )
inline

Provides a response to a 'subnet4-update' and 'subnet6-update' command.

This method is used for processing 'subnet4-update' and 'subnet6-update' commands. It parses received command, updates the subnet with the given ID in the current server configuration and provides a response to the controlling client.

Parameters
cfgReference to the CfgSubnets4Ptr or CfgSubnets6Ptr object.
argumentsPointer to the arguments specified in the command.
command_nameOne of the following: 'subnet4-update' or 'subnet6-update'.
subnet_parameterOne of the following: 'subnet4' or 'subnet6'.
protocol_versionOne of the following: 'IPv4' or 'IPv6'.
typeThe update type (replace, delta add, delta del).
Template Parameters
SimpleParserTypeOne of the SimpleParser4 or SimpleParser6
SubnetConfigParserTypeOne of the Subnet4ConfigParser or Subnet6ConfigParser.
SharedNetworkPtrTypeOne of the SharedNetwork4 or SharedNetwork6.
SubnetTypePtrOne of the following types: Subnet4Ptr or Subnet6Ptr.
CfgTypeOne of the CfgSubnets4Ptr or CfgSubnets6Ptr.
Returns
Pointer to the object representing a response. This pointer is only returned to indicate successful processing of the command. Errors are signaled to a caller by exceptions.

Definition at line 654 of file subnet_cmds.cc.

References isc::config::CONTROL_RESULT_SUCCESS, Element::create(), isc::config::createAnswer(), Element::createList(), Element::createMap(), DHCP4_OPTION_SPACE, DHCP6_OPTION_SPACE, isc::dhcp::CfgMgr::getCurrentCfg(), isc::data::SimpleParser::getInteger(), isc::dhcp::CfgMgr::instance(), isc_throw, Element::list, LOG_INFO, Element::map, isc::subnet_cmds::subnet_cmds_logger, isc::subnet_cmds::SUBNET_CMDS_SUBNET_UPDATE, and isc::subnet_cmds::UPDATE_REPLACE.

+ Here is the call graph for this function:

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