![]() |
Kea
1.5.0
|
Implements the logic for processing commands pertaining to lease manipulation. More...
#include <lease_cmds.h>
Public Member Functions | |
| LeaseCmds () | |
| Constructor. More... | |
| int | lease4DelHandler (hooks::CalloutHandle &handle) |
| lease4-del command handler More... | |
| int | lease4UpdateHandler (hooks::CalloutHandle &handle) |
| lease4-update handler More... | |
| int | lease4WipeHandler (hooks::CalloutHandle &handle) |
| lease4-wipe handler More... | |
| int | lease6DelHandler (hooks::CalloutHandle &handle) |
| lease6-del command handler More... | |
| int | lease6UpdateHandler (hooks::CalloutHandle &handle) |
| lease6-update handler More... | |
| int | lease6WipeHandler (hooks::CalloutHandle &handle) |
| lease6-wipe handler More... | |
| int | leaseAddHandler (hooks::CalloutHandle &handle) |
| lease4-add, lease6-add command handler More... | |
| int | leaseGetAllHandler (hooks::CalloutHandle &handle) |
| lease4-get-all, lease6-get-all commands handler More... | |
| int | leaseGetHandler (hooks::CalloutHandle &handle) |
| lease4-get, lease6-get command handler More... | |
| int | leaseGetPageHandler (hooks::CalloutHandle &handle) |
| lease4-get-page, lease6-get-page commands handler More... | |
Implements the logic for processing commands pertaining to lease manipulation.
This class is used by the callouts implementing command handlers for lease manipulations.
Definition at line 26 of file lease_cmds.h.
| isc::lease_cmds::LeaseCmds::LeaseCmds | ( | ) |
Constructor.
It creates an instance of the LeaseCmdsImpl.
Definition at line 1051 of file lease_cmds.cc.
| int isc::lease_cmds::LeaseCmds::lease4DelHandler | ( | hooks::CalloutHandle & | handle | ) |
lease4-del command handler
This command attempts to delete an IPv4 lease that match selected criteria. 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.
Two types of parameters are supported: (subnet-id, address) or (subnet-id, identifier-type, identifier).
Example command for deletion by (subnet-id, address): { "command": "lease4-del", "arguments": { "subnet-id": 1, "ip-address": "192.0.2.202" } }
Example command for deletion by (subnet-id, identifier-type, identifier) { "command": "lease4-del", "arguments": { "subnet-id": 1, "identifier-type": "hw-address", "identifier": "00:01:02:03:04:05" } }";
| handle | Callout context - which is expected to contain the delete command JSON text in the "command" argument |
Definition at line 1022 of file lease_cmds.cc.
Referenced by lease4_del().
| int isc::lease_cmds::LeaseCmds::lease4UpdateHandler | ( | hooks::CalloutHandle & | handle | ) |
lease4-update handler
This command attempts to update existing IPv4 lease. The parameters specified will replace existing lease. The only condition is that the IP address must not change. If you want to change the IP address, please use lease4-del and lease4-add instead. 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.
Example command: { "command": "lease4-update", "arguments": { "subnet-id": 44, "ip-address": "192.0.2.1", "hw-address": "1a:1b:1c:1d:1e:1f", "hostname": "newhostname.example.org" } };
The optional 'force-create' boolean parameter may be specified to force the lease to be created if it doesn't exist. By default, this parameter is set to false, which means that the lease is not created.
| handle | Callout context - which is expected to contain the update command JSON text in the "command" argument |
Definition at line 1032 of file lease_cmds.cc.
Referenced by lease4_update().
| int isc::lease_cmds::LeaseCmds::lease4WipeHandler | ( | hooks::CalloutHandle & | handle | ) |
lease4-wipe handler
This commands attempts to remove all IPv4 leases from a specific subnet. Currently the leases are removed from the database, without any processing (like calling hooks or doing DDNS cleanups). 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.
Example command: { "command": "lease4-wipe", "arguments": { "subnet-id": 44 } }";
| handle | Callout context - which is expected to contain the wipe command JSON text in the "command" argument |
Definition at line 1042 of file lease_cmds.cc.
Referenced by lease4_wipe().
| int isc::lease_cmds::LeaseCmds::lease6DelHandler | ( | hooks::CalloutHandle & | handle | ) |
lease6-del command handler
This command attempts to delete a lease that match selected criteria. 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.
Two types of parameters are supported: (subnet-id, address) or (subnet-id, type, iaid, identifier-type, identifier).
Example command for deletion by (subnet-id, address): { "command": "lease6-del", "arguments": { "subnet-id": 1, "ip-address": "192.0.2.202" } }
Example command for deletion by (subnet-id, type, iaid, identifier-type, identifier): { "command": "lease6-del", "arguments": { "subnet-id": 1, "type": "IA_NA", "iaid": 123456, "identifier-type": "hw-address", "identifier": "00:01:02:03:04:05" } }";
| handle | Callout context - which is expected to contain the delete command JSON text in the "command" argument |
Definition at line 1027 of file lease_cmds.cc.
Referenced by lease6_del().
| int isc::lease_cmds::LeaseCmds::lease6UpdateHandler | ( | hooks::CalloutHandle & | handle | ) |
lease6-update handler
This command attempts to update existing IPv6 lease. The parameters specified will replace existing lease. The only condition is that the IP address must not change. If you want to change the IP address, please use lease6-del and lease6-add instead. 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.
Example command: { "command": "lease6-update", "arguments": { "subnet-id": 66, "ip-address": "2001:db8::1", "iaid": 7654321, "duid": "88:88:88:88:88:88:88:88", "hostname": "newhostname.example.org" } }";
The optional 'force-create' boolean parameter may be specified to force the lease to be created if it doesn't exist. By default, this parameter is set to false, which means that the lease is not created.
| handle | Callout context - which is expected to contain the update command JSON text in the "command" argument |
Definition at line 1037 of file lease_cmds.cc.
Referenced by lease6_update().
| int isc::lease_cmds::LeaseCmds::lease6WipeHandler | ( | hooks::CalloutHandle & | handle | ) |
lease6-wipe handler
This commands attempts to remove all IPv4 leases from a specific subnet. Currently the leases are removed from the database, without any processing (like calling hooks or doing DDNS cleanups). 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.
Example command: { "command": "lease4-wipe", "arguments": { "subnet-id": 44 } };
| handle | Callout context - which is expected to contain the wipe command JSON text in the "command" argument |
Definition at line 1047 of file lease_cmds.cc.
Referenced by lease6_wipe().
| int isc::lease_cmds::LeaseCmds::leaseAddHandler | ( | hooks::CalloutHandle & | handle | ) |
lease4-add, lease6-add command handler
This command attempts to add a lease. 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.
This function covers both v4 and v6 leases.
Example command for v4: { "command": "lease4-add", "parameters": { "address": "192.0.2.1", "hwaddr": "00:01:02:03:04:05", "client-id": "this-is-a-client", "valid-lft": 3600, "expire": 12345678, "subnet-id": 1, "fqdn-fwd": true, "fqdn-rev": true, "hostname": "myhost.example.org", "state": 0 } } Example command for v6: { "command": "lease6-add", "arguments": { "subnet-id": 66, "ip-address": "2001:db8:abcd::", "type": "IA_PD", "prefix-len": 48, "duid": "01:02:03:04:05:06:07:08", "iaid": 1234, "preferred-lft": 500, "valid-lft": 1000, "expire": 12345678, "fqdn-fwd": true, "fqdn-rev": true, "hostname": "urania.example.org"" } }
| handle | Callout context - which is expected to contain the add command JSON text in the "command" argument |
Definition at line 1002 of file lease_cmds.cc.
Referenced by lease4_add(), and lease6_add().
| int isc::lease_cmds::LeaseCmds::leaseGetAllHandler | ( | hooks::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.
Example command for IPv4 query by (subnet-ids): { "command": "lease4-get-all", "arguments": { "subnets": [ 1, 2, 3, 4 ] } }
Example command for retrieving all IPv6 leases: { "command": "lease6-get-all", }
| handle | Callout context - which is expected to contain the get command JSON text in the "command" argument |
Definition at line 1012 of file lease_cmds.cc.
Referenced by lease4_get_all(), and lease6_get_all().
| int isc::lease_cmds::LeaseCmds::leaseGetHandler | ( | hooks::CalloutHandle & | handle | ) |
lease4-get, lease6-get command handler
This command attempts to retrieve a lease that match selected criteria. 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.
The following types of parameters are supported:
Example command for query by (subnet-id, address): { "command": "lease4-get", "arguments": { "subnet-id": 1, "ip-address": "192.0.2.202" } }
Example command for query by (subnet-id, identifier-type, identifier) { "command": "lease4-get", "arguments": { "subnet-id": 1, "identifier-type": "hw-address", "identifier": "00:01:02:03:04:05" } }
Example command for query by (subnet-id, type, iana, identifier-type, identifier): { "command": "lease6-get", "arguments": { "subnet-id": 66, "iaid": 42, "type": "IA_NA", "identifier-type": "duid", "identifier": "77:77:77:77:77:77:77:77" } }
| handle | Callout context - which is expected to contain the get command JSON text in the "command" argument |
Definition at line 1007 of file lease_cmds.cc.
Referenced by lease4_get(), and lease6_get().
| int isc::lease_cmds::LeaseCmds::leaseGetPageHandler | ( | hooks::CalloutHandle & | handle | ) |
lease4-get-page, lease6-get-page commands handler
These commands attempt to retrieve 1 page of all IPv4 or IPv6 leases. The 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.
| handle | Callout context - which is expected to contain the get commands JSON text in the "command" argument. |
Definition at line 1017 of file lease_cmds.cc.
Referenced by lease4_get_page(), and lease6_get_page().