Commit 53d0bd53 authored by Francis Dupont's avatar Francis Dupont

[393-global-search-through-leases-by-mac-or-hostname-w-o-specifying-a-subnet-i...

[393-global-search-through-leases-by-mac-or-hostname-w-o-specifying-a-subnet-id] Implemented new commands
parent 5bd76e38
This diff is collapsed.
......@@ -258,6 +258,87 @@ public:
int
leaseGetPageHandler(hooks::CalloutHandle& handle);
/// @brief lease4-get-by-hw-address command handler
///
/// This command attempts to retrieve all IPv4 leases with a particular
/// hardware address.
///
/// Example command:
/// {
/// "command": "lease4-get-by-hw-address",
/// "arguments": {
/// "hwaddr": "00:01:02:03:04:05"
/// }
/// }
///
/// @param handle Callout context - which is expected to contain the
/// get command JSON text in the "command" argument
/// @return 0 if the handler has been invoked successfully, 1 if an
/// error occurs, 3 if no leases are returned.
int
leaseGetByHwAddressHandler(hooks::CalloutHandle& handle);
/// @brief lease4-get-by-client-id command handler
///
/// This command attempts to retrieve all IPv4 leases with a particular
/// Client Id.
///
/// Example command:
/// {
/// "command": "lease4-get-by-client-id",
/// "arguments": {
/// "client-id": "this-is-a-client"
/// }
/// }
///
/// @param handle Callout context - which is expected to contain the
/// get command JSON text in the "command" argument
/// @return 0 if the handler has been invoked successfully, 1 if an
/// error occurs, 3 if no leases are returned.
int
leaseGetByClientIdHandler(hooks::CalloutHandle& handle);
/// @brief lease6-get-by-duid command handler
///
/// This command attempts to retrieve all IPv6 leases with a particular
/// DUID.
///
/// Example command:
/// {
/// "command": "lease6-get-by-duid",
/// "arguments": {
/// "duid": "01:02:03:04:05:06:07:08"
/// }
/// }
///
/// @param handle Callout context - which is expected to contain the
/// get command JSON text in the "command" argument
/// @return 0 if the handler has been invoked successfully, 1 if an
/// error occurs, 3 if no leases are returned.
int
leaseGetByDuidHandler(hooks::CalloutHandle& handle);
/// @brief lease4-get-by-hostname and lease6-get-by-hostname commands
/// handler
///
/// Thesecommands attempt to retrieve all IPv4 or Ipv6 leases with
/// a particular hostname.
///
/// Example command for v4:
/// {
/// "command": "lease4-get-by-hostname",
/// "arguments": {
/// "hostname": "urania.example.org"
/// }
/// }
///
/// @param handle Callout context - which is expected to contain the
/// get command JSON text in the "command" argument
/// @return 0 if the handler has been invoked successfully, 1 if an
/// error occurs, 3 if no leases are returned.
int
leaseGetByHostnameHandler(hooks::CalloutHandle& handle);
/// @brief lease4-del command handler
///
/// This command attempts to delete an IPv4 lease that match selected
......
......@@ -121,6 +121,61 @@ int lease6_get_page(CalloutHandle& handle) {
return (lease_cmds.leaseGetPageHandler(handle));
}
/// @brief This is a command callout for 'lease4-get-by-hw-address' command.
///
/// @param handle Callout handle used to retrieve a command and
/// provide a response.
/// @return 0 if this callout has been invoked successfully,
/// 1 if an error occurs, 3 if no leases are returned.
int lease4_get_by_hw_address(CalloutHandle& handle) {
LeaseCmds lease_cmds;
return (lease_cmds.leaseGetByHwAddressHandler(handle));
}
/// @brief This is a command callout for 'lease4-get-by-client-id' command.
///
/// @param handle Callout handle used to retrieve a command and
/// provide a response.
/// @return 0 if this callout has been invoked successfully,
/// 1 if an error occurs, 3 if no leases are returned.
int lease4_get_by_client_id(CalloutHandle& handle) {
LeaseCmds lease_cmds;
return (lease_cmds.leaseGetByClientIdHandler(handle));
}
/// @brief This is a command callout for 'lease6-get-by-duid' command.
///
/// @param handle Callout handle used to retrieve a command and
/// provide a response.
/// @return 0 if this callout has been invoked successfully,
/// 1 if an error occurs, 3 if no leases are returned.
int lease6_get_by_duid(CalloutHandle& handle) {
LeaseCmds lease_cmds;
return (lease_cmds.leaseGetByDuidHandler(handle));
}
/// @brief This is a command callout for 'lease4-get-by-hostname' command.
///
/// @param handle Callout handle used to retrieve a command and
/// provide a response.
/// @return 0 if this callout has been invoked successfully,
/// 1 if an error occurs, 3 if no leases are returned.
int lease4_get_by_hostname(CalloutHandle& handle) {
LeaseCmds lease_cmds;
return (lease_cmds.leaseGetByHostnameHandler(handle));
}
/// @brief This is a command callout for 'lease6-get-by-hostname' command.
///
/// @param handle Callout handle used to retrieve a command and
/// provide a response.
/// @return 0 if this callout has been invoked successfully,
/// 1 if an error occurs, 3 if no leases are returned.
int lease6_get_by_hostname(CalloutHandle& handle) {
LeaseCmds lease_cmds;
return (lease_cmds.leaseGetByHostnameHandler(handle));
}
/// @brief This is a command callout for 'lease4-del' command.
///
/// @param handle Callout handle used to retrieve a command and
......@@ -201,6 +256,15 @@ int load(LibraryHandle& handle) {
handle.registerCommandCallout("lease6-get-all", lease6_get_all);
handle.registerCommandCallout("lease4-get-page", lease4_get_page);
handle.registerCommandCallout("lease6-get-page", lease6_get_page);
handle.registerCommandCallout("lease4-get-by-hw-address",
lease4_get_by_hw_address);
handle.registerCommandCallout("lease4-get-by-client-id",
lease4_get_by_client_id);
handle.registerCommandCallout("lease6-get-by-duid", lease6_get_by_duid);
handle.registerCommandCallout("lease4-get-by-hostname",
lease4_get_by_hostname);
handle.registerCommandCallout("lease6-get-by-hostname",
lease6_get_by_hostname);
handle.registerCommandCallout("lease4-del", lease4_del);
handle.registerCommandCallout("lease6-del", lease6_del);
handle.registerCommandCallout("lease4-update", lease4_update);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment