Kea 3.1.1
isc::subnet_cmds::SubnetCmds Class Reference

Implements the logic for processing commands pertaining to subnets manipulation. More...

#include <subnet_cmds.h>

Public Member Functions

 SubnetCmds ()
 Constructor.
 
data::ConstElementPtr addNetwork4 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'network4-add' command.
 
data::ConstElementPtr addNetwork4Subnet (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'network4-subnet-add' command.
 
data::ConstElementPtr addNetwork6 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'network6-add' command.
 
data::ConstElementPtr addNetwork6Subnet (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'network6-subnet-add' command.
 
data::ConstElementPtr addSubnet4 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet4-add' command.
 
data::ConstElementPtr addSubnet4Delta (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet4-delta-add' command.
 
data::ConstElementPtr addSubnet6 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet6-add' command.
 
data::ConstElementPtr addSubnet6Delta (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet6-delta-add' command.
 
data::ConstElementPtr delNetwork4 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'network4-del' command.
 
data::ConstElementPtr delNetwork4Subnet (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'network4-subnet-del' command.
 
data::ConstElementPtr delNetwork6 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'network6-del' command.
 
data::ConstElementPtr delNetwork6Subnet (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'network6-subnet-del' command.
 
data::ConstElementPtr delSubnet4 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet4-del' command.
 
data::ConstElementPtr delSubnet4Delta (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet4-delta-del' command.
 
data::ConstElementPtr delSubnet6 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet6-del' command.
 
data::ConstElementPtr delSubnet6Delta (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet6-delta-del' command.
 
data::ConstElementPtr getNetwork4 (const data::ConstElementPtr &arguments) const
 Returns a response to 'network4-get' command.
 
data::ConstElementPtr getNetwork4List () const
 Returns a response to a 'network4-list' command.
 
data::ConstElementPtr getNetwork6 (const data::ConstElementPtr &arguments) const
 Returns a response to 'network6-get' command.
 
data::ConstElementPtr getNetwork6List () const
 Returns a response to a 'network6-list' command.
 
data::ConstElementPtr getSubnet4 (const data::ConstElementPtr &arguments) const
 Returns a response to 'subnet4-get' command.
 
data::ConstElementPtr getSubnet4List () const
 Returns a response to a 'subnet4-list' command.
 
data::ConstElementPtr getSubnet6 (const data::ConstElementPtr &arguments) const
 Returns a response to 'subnet6-get' command.
 
data::ConstElementPtr getSubnet6List () const
 Returns a response to a 'subnet6-list' command.
 
data::ConstElementPtr updateSubnet4 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet4-update' command.
 
data::ConstElementPtr updateSubnet6 (const data::ConstElementPtr &arguments)
 Processes and returns a response to 'subnet6-update' command.
 

Detailed Description

Implements the logic for processing commands pertaining to subnets manipulation.

This class is used by the callouts implementing command handlers for subnets manipulations.

Definition at line 25 of file subnet_cmds.h.

Constructor & Destructor Documentation

◆ SubnetCmds()

isc::subnet_cmds::SubnetCmds::SubnetCmds ( )

Constructor.

It creates an instance of the SubnetCmdsImpl.

Definition at line 1561 of file subnet_cmds.cc.

Member Function Documentation

◆ addNetwork4()

ConstElementPtr isc::subnet_cmds::SubnetCmds::addNetwork4 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'network4-add' command.

Modifying shared network configuration requires a critical section.

This function processes 'network4-add' command by adding specified shared network (with zero or more subnets in it) to the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "network4-add",
"arguments": {
"shared-networks": [
{
"name": "floor13",
"subnet4": [ {
"id": 123,
"subnet": "192.0.2.0/24",
...
} ] // end of subnet4
} ] // end of shared-networks
}
}

Before adding the subnet to the current configuration this method will check for duplicated subnet, i.e. having the same id or subnet prefix. If the subnet duplicates an existing subnets an exception is thrown. The exception is also thrown when any other error occurs.

The successful response has the following structure:

{
"result": 0,
"text": "A new IPv4 shared network added",
"shared-networks": [
{
"name": "floor13"
}
]
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1720 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ addNetwork4Subnet()

ConstElementPtr isc::subnet_cmds::SubnetCmds::addNetwork4Subnet ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'network4-subnet-add' command.

This function processes the 'network4-subnet-add' command by searching for a subnet with specified id and a network with specified name and then adding the subnet to that network.

The command has the following structure:

{
"command": "network4-subnet-add",
"arguments": {
"name": "floor13"
"id": 123
}
}

The successful response has the following structure:

{
"result": 0,
"text": "IPv4 subnet 10.0.0.0/8 (id 123) is now part of shared network 'floor13'"
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1754 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ addNetwork6()

ConstElementPtr isc::subnet_cmds::SubnetCmds::addNetwork6 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'network6-add' command.

This function processes 'network6-add' command by adding specified shared network (with zero or more subnets in it) to the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "network6-add",
"arguments": {
"shared-networks": [
{
"name": "floor13",
"subnet6": [ {
"id": 123,
"subnet": "2001:db8::/48",
...
} ] // end of subnet6
} ] // end of shared-networks
}
}

Before adding the subnet to the current configuration this method will check for duplicated subnet, i.e. having the same id or subnet prefix. If the subnet duplicates an existing subnets an exception is thrown. The exception is also thrown when any other error occurs.

The successful response has the following structure:

{
"result": 0,
"text": "A new IPv6 shared network added",
"shared-networks": [
{
"name": "floor13"
}
]
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1729 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ addNetwork6Subnet()

ConstElementPtr isc::subnet_cmds::SubnetCmds::addNetwork6Subnet ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'network6-subnet-add' command.

This function processes the 'network6-subnet-add' command by searching for a subnet with specified id and a network with specified name and then adding the subnet to that network.

The command has the following structure:

{
"command": "network6-subnet-add",
"arguments": {
"name": "floor13"
"id": 123
}
}

The successful response has the following structure:

{
"result": 0,
"text": "IPv6 subnet 2001:db8::/48 (id 123) is now part of shared network 'floor13'"
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1763 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ addSubnet4()

ConstElementPtr isc::subnet_cmds::SubnetCmds::addSubnet4 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet4-add' command.

Modifying subnet configuration requires a critical section.

This function processes 'subnet4-add' command by adding it to the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "subnet4-add",
"arguments": {
"subnet4": [ {
"id": 123,
"subnet": "10.20.30.0/24",
...
} ]
}
}

Before adding the subnet to the current configuration this method will check for duplicated subnet, i.e. having the same id or subnet prefix. If the subnet duplicates an existing subnets an exception is thrown. The exception is also thrown when any other error occurs.

The successful response has the following structure:

{
"result": 0,
"text": "IPv4 subnet added",
"arguments": {
"subnet4": [
{
"id": 123,
"subnet": "10.20.30.0/24"
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1594 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ addSubnet4Delta()

ConstElementPtr isc::subnet_cmds::SubnetCmds::addSubnet4Delta ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet4-delta-add' command.

This function processes 'subnet4-delta-add' command by adding the specified parameters to the existing subnet already present in the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "subnet4-delta-add",
"arguments": {
"subnet4": [ {
"id": 123,
"subnet": "10.20.30.0/24",
...
} ]
}
}

Before updating the subnet in the current configuration this method will check for existing subnet with the same id and update it by adding the configuration delta. The operation is atomic: either it succeeds or it fails leaving the configuration unchanged and throwing an exception.

The successful response has the following structure:

{
"result": 0,
"text": "IPv4 subnet updated",
"arguments": {
"subnet4": [
{
"id": 123,
"subnet": "10.20.30.0/24"
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1646 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), and isc::subnet_cmds::UPDATE_DELTA_ADD.

+ Here is the call graph for this function:

◆ addSubnet6()

ConstElementPtr isc::subnet_cmds::SubnetCmds::addSubnet6 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet6-add' command.

This function processes 'subnet6-add' command by adding it to the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "subnet6-add",
"arguments": {
"subnet6": [ {
"id": 123,
"subnet": "2001:db8:1::/64",
...
} ]
}
}

Before adding the subnet to the current configuration this method will check for duplicated subnet, i.e. having the same id or subnet prefix. If the subnet duplicates an existing subnets an exception is thrown. The exception is also thrown when any other error occurs.

The successful response has the following structure:

{
"result": 0,
"text": "IPv6 subnet added",
"arguments": {
"subnet6": [
{
"id": 123,
"subnet": "2001:db8:1::/64"
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1603 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ addSubnet6Delta()

ConstElementPtr isc::subnet_cmds::SubnetCmds::addSubnet6Delta ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet6-delta-add' command.

This function processes 'subnet6-delta-add' command by adding the specified parameters to the existing subnet already present in the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "subnet6-delta-add",
"arguments": {
"subnet6": [ {
"id": 123,
"subnet": "2001:db8:1::/64",
...
} ]
}
}

Before updating the subnet in the current configuration this method will check for existing subnet with the same id and update it by adding the configuration delta. The operation is atomic: either it succeeds or it fails leaving the configuration unchanged and throwing an exception.

The successful response has the following structure:

{
"result": 0,
"text": "IPv6 subnet updated",
"arguments": {
"subnet6": [
{
"id": 123,
"subnet": "2001:db8:1::/64"
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1657 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), and isc::subnet_cmds::UPDATE_DELTA_ADD.

+ Here is the call graph for this function:

◆ delNetwork4()

ConstElementPtr isc::subnet_cmds::SubnetCmds::delNetwork4 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'network4-del' command.

This function processes the 'network4-del' command by searching for a subnet by specified name and deleting this shared network from the server configuration. The subnets in this shared network will not be deleted, but instead will be degraded to regular, plain subnets.

The command has the following structure:

{
"command": "network4-del",
"arguments": {
"name": "frog"
}
}

The successful response has the following structure:

{
"result": 0,
"text": "IPv4 shared network 'frog' deleted"
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1738 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ delNetwork4Subnet()

ConstElementPtr isc::subnet_cmds::SubnetCmds::delNetwork4Subnet ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'network4-subnet-del' command.

This function processes the 'network4-subnet-del' command by searching for a subnet with specified id within a network with specified name and then removing the subnet from that network.

The command has the following structure:

{
"command": "network4-subnet-add",
"arguments": {
"name": "floor13"
"id": 123
}
}

The successful response has the following structure:

{
"result": 0,
"text": "IPv4 subnet 10.0.0.0/8 (id 5) is now removed from shared network 'floor13'"
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1772 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ delNetwork6()

ConstElementPtr isc::subnet_cmds::SubnetCmds::delNetwork6 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'network6-del' command.

This function processes the 'network6-del' command by searching for a subnet by specified name and deleting this shared network from the server configuration. The subnets in this shared network will not be deleted, but instead will be degraded to regular, plain subnets.

The command has the following structure:

{
"command": "network6-del",
"arguments": {
"name": "frog"
}
}

The successful response has the following structure:

{
"result": 0,
"text": "IPv6 shared network 'frog' deleted"
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1746 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ delNetwork6Subnet()

ConstElementPtr isc::subnet_cmds::SubnetCmds::delNetwork6Subnet ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'network6-subnet-del' command.

This function processes the 'network6-subnet-del' command by searching for a subnet with specified id within a network with specified name and then removing the subnet from that network.

The command has the following structure:

{
"command": "network4-subnet-del",
"arguments": {
"name": "floor13"
"id": 123
}
}

The successful response has the following structure:

{
"result": 0,
"text": "IPv6 subnet 2001:db8::/32 (id 5) is now removed from shared network 'floor13'"
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1779 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ delSubnet4()

ConstElementPtr isc::subnet_cmds::SubnetCmds::delSubnet4 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet4-del' command.

This function processes the 'subnet4-del' command by searching for a subnet by specified id and deleting this subnet from the server configuration.

The command has the following structure:

{
"command": "subnet4-del",
"arguments": {
"id": 123
}
}

The successful response has the following structure:

{
"result": 0,
"text": "IPv4 subnet 192.0.2.0/24 (id 123) deleted"
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1632 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ delSubnet4Delta()

ConstElementPtr isc::subnet_cmds::SubnetCmds::delSubnet4Delta ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet4-delta-del' command.

This function processes 'subnet4-delta-add' command by removing the specified parameters from the existing subnet already present in the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "subnet4-delta-del",
"arguments": {
"subnet4": [ {
"id": 123,
"subnet": "10.20.30.0/24",
...
} ]
}
}

Before updating the subnet in the current configuration this method will check for existing subnet with the same id and update it by removing the configuration delta. The operation is atomic: either it succeeds or it fails leaving the configuration unchanged and throwing an exception.

The successful response has the following structure:

{
"result": 0,
"text": "IPv4 subnet updated",
"arguments": {
"subnet4": [
{
"id": 123,
"subnet": "10.20.30.0/24"
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1668 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), and isc::subnet_cmds::UPDATE_DELTA_DEL.

+ Here is the call graph for this function:

◆ delSubnet6()

ConstElementPtr isc::subnet_cmds::SubnetCmds::delSubnet6 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet6-del' command.

This function processes the 'subnet6-del' command by searching for a subnet by specified id and deleting this subnet from the server configuration.

The command has the following structure:

{
"command": "subnet6-del",
"arguments": {
"id": 123
}
}

The successful response has the following structure:

{
"result": 0,
"text": "IPv6 subnet 2001:db8:1::/64 (id 123) deleted"
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1639 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ delSubnet6Delta()

ConstElementPtr isc::subnet_cmds::SubnetCmds::delSubnet6Delta ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet6-delta-del' command.

This function processes 'subnet6-delta-del' command by removing the specified parameters from the existing subnet already present in the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "subnet6-delta-del",
"arguments": {
"subnet6": [ {
"id": 123,
"subnet": "2001:db8:1::/64",
...
} ]
}
}

Before updating the subnet in the current configuration this method will check for existing subnet with the same id and update it by removing the configuration delta. The operation is atomic: either it succeeds or it fails leaving the configuration unchanged and throwing an exception.

The successful response has the following structure:

{
"result": 0,
"text": "IPv6 subnet updated",
"arguments": {
"subnet6": [
{
"id": 123,
"subnet": "2001:db8:1::/64"
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1679 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), and isc::subnet_cmds::UPDATE_DELTA_DEL.

+ Here is the call graph for this function:

◆ getNetwork4()

ConstElementPtr isc::subnet_cmds::SubnetCmds::getNetwork4 ( const data::ConstElementPtr & arguments) const

Returns a response to 'network4-get' command.

This function returns an IPv4 shared network by a specified parameter. Currently the only supported parameter is:

  • name, which must be a string

The successful response has the following structure:

{
"result": 0,
"arguments": {
"shared-networks": [
{
"name": "frog",
"interface": "eth1",
"subnet4": [,
{
"subnet": "10.1.2.0/24",
"id": 1,
....
}
]
/ }
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.
Exceptions
BadValueif the arguments are invalid

Definition at line 1706 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ getNetwork4List()

ConstElementPtr isc::subnet_cmds::SubnetCmds::getNetwork4List ( ) const

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

This method retrieves configured IPv4 shared networks and returns them within a command response. The successful response has the following structure:

{
"result": 0,
"text": "2 IPv4 shared networks found",
"arguments": {
"shared-networks": [
{
"name": "frog"
},
{
"name": "parrot"
}
]
}
}
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.

Definition at line 1694 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ getNetwork6()

ConstElementPtr isc::subnet_cmds::SubnetCmds::getNetwork6 ( const data::ConstElementPtr & arguments) const

Returns a response to 'network6-get' command.

This function returns an IPv6 shared network by a specified parameter. Currently the only supported parameter is:

  • name, which must be a string

The successful response has the following structure:

{
"result": 0,
"arguments": {
"shared-networks": [
{
"name": "frog",
"interface": "eth1",
"subnet6": [,
{
"subnet": "2001:db8::/48",
"id": 1,
....
}
]
/ }
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.
Exceptions
BadValueif the arguments are invalid

Definition at line 1712 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ getNetwork6List()

ConstElementPtr isc::subnet_cmds::SubnetCmds::getNetwork6List ( ) const

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

This method retrieves configured IPv6 shared networks and returns them within a command response. The successful response has the following structure:

{
"result": 0,
"text": "2 IPv6 shared networks found",
"arguments": {
"shared-networks": [
{
"name": "frog"
},
{
"name": "parrot"
}
]
}
}
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.

Definition at line 1700 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ getSubnet4()

ConstElementPtr isc::subnet_cmds::SubnetCmds::getSubnet4 ( const data::ConstElementPtr & arguments) const

Returns a response to 'subnet4-get' command.

This function returns an IPv4 subnet by a specified parameter. Currently supported parameters are:

  • subnet, which must be a string specifying subnet prefix, e.g. "10.1.2.0/24".
  • id, which must be an integer specifying subnet identifier.

Only one of those parameters can be specified.

The successful response has the following structure:

{
"result": 0,
"text": "Info about IPv4 subnet 10.1.2.0/24 (id 1) returned",
"arguments": {
"subnet4": [
{
"subnet": "10.1.2.0/24",
"id": 1,
....
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.
Exceptions
BadValueif the arguments are invalid or if no subnet found.

Definition at line 1578 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ getSubnet4List()

ConstElementPtr isc::subnet_cmds::SubnetCmds::getSubnet4List ( ) const

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

This method retrieves configured IPv4 subnets and returns them within a command response. The successful response has the following structure:

{
"result": 0,
"text": "2 IPv4 subnets found",
"arguments": {
"subnets": [
{
"id": 10,
"subnet": "10.0.0.0/8"
},
{
"id": 100,
"subnet": "192.0.2.0/24"
}
]
}
}
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.

Definition at line 1566 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ getSubnet6()

ConstElementPtr isc::subnet_cmds::SubnetCmds::getSubnet6 ( const data::ConstElementPtr & arguments) const

Returns a response to 'subnet6-get' command.

This function returns an IPv6 subnet by a specified parameter. Currently supported parameters are:

  • subnet, which must be a string specifying subnet prefix, e.g. "3000::/16".
  • id, which must be an integer specifying subnet identifier.

Only one of those parameters can be specified.

The successful response has the following structure:

{
"result": 0,
"text": "Info about IPv6 subnet 2001:db8:1::/64 (id 1) returned",
"arguments": {
"subnet6": [
{
"subnet": "2001:db8:1::/64",
"id": 1,
....
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.
Exceptions
BadValueif the arguments are invalid or if no subnet found.

Definition at line 1585 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ getSubnet6List()

ConstElementPtr isc::subnet_cmds::SubnetCmds::getSubnet6List ( ) const

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

This method retrieves configured IPv6 subnets and returns them within a command response. The successful response has the following structure:

{
"result": 0,
"text": "2 IPv6 subnets found",
"arguments": {
"subnets": [
{
"id": 11,
"subnet": "2001:db8:1::/64"
},
{
"id": 233,
"subnet": "3000::/16"
}
]
}
}
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a response to the command.

Definition at line 1572 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ updateSubnet4()

ConstElementPtr isc::subnet_cmds::SubnetCmds::updateSubnet4 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet4-update' command.

This function processes 'subnet4-update' command by replacing it in the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "subnet4-update",
"arguments": {
"subnet4": [ {
"id": 123,
"subnet": "10.20.30.0/24",
...
} ]
}
}

Before replacing the subnet in the current configuration this method will check for existing subnet with the same id and update it by this new subnet. The prefix should not be updated but this case is supported. The operation is atomic: either it succeeds or it fails leaving the configuration unchanged and throwing an exception.

The successful response has the following structure:

{
"result": 0,
"text": "IPv4 subnet updated",
"arguments": {
"subnet4": [
{
"id": 123,
"subnet": "10.20.30.0/24"
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1612 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ updateSubnet6()

ConstElementPtr isc::subnet_cmds::SubnetCmds::updateSubnet6 ( const data::ConstElementPtr & arguments)

Processes and returns a response to 'subnet6-update' command.

This function processes 'subnet6-update' command by replacing existing subnet with a new subnet in the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "subnet6-update",
"arguments": {
"subnet6": [ {
"id": 123,
"subnet": "2001:db8:1::/64",
...
} ]
}
}

Before replacing the subnet in the current configuration this method will check for existing subnet with the same id and update it by this new subnet. The prefix should not be updated but this case is supported. The operation is atomic: either it succeeds or it fails leaving the configuration unchanged and throwing an exception.

The successful response has the following structure:

{
"result": 0,
"text": "IPv6 subnet updated",
"arguments": {
"subnet6": [
{
"id": 123,
"subnet": "2001:db8:1::/64"
}
]
}
}
Parameters
argumentsArguments received for the command.
Returns
Pointer to the isc::data::Element object holding the data structure reflecting a successful response to the command.

Definition at line 1622 of file subnet_cmds.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

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