![]() |
Kea 3.1.0
|
Run Script implementation. More...
#include <run_script.h>
Public Member Functions | |
RunScriptImpl () | |
Constructor. | |
~RunScriptImpl ()=default | |
Destructor. | |
void | configure (isc::hooks::LibraryHandle &handle) |
This function parses and applies configuration parameters. | |
std::string | getName () const |
Get name of the target script. | |
bool | getSync () const |
Get the synchronous call mode for the target script. | |
void | runScript (const isc::asiolink::ProcessArgs &args, const isc::asiolink::ProcessEnvVars &vars) |
Run Script with specified arguments and environment parameters. | |
void | setName (const std::string &name) |
Set name of the target script. | |
void | setSync (const bool sync) |
Set the synchronous call mode for the target script. | |
Static Public Member Functions | |
static void | extractBoolean (isc::asiolink::ProcessEnvVars &vars, const bool value, const std::string &prefix="", const std::string &suffix="") |
Extract boolean data and append to environment. | |
static void | extractClientId (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::ClientIdPtr client_id, const std::string &prefix="", const std::string &suffix="") |
Extract ClientId data and append to environment. | |
static void | extractDUID (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::DuidPtr duid, const std::string &prefix="", const std::string &suffix="") |
Extract DUID data and append to environment. | |
static void | extractHWAddr (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::HWAddrPtr &hwaddr, const std::string &prefix="", const std::string &suffix="") |
Extract HWAddr data and append to environment. | |
static void | extractInteger (isc::asiolink::ProcessEnvVars &vars, const uint64_t value, const std::string &prefix="", const std::string &suffix="") |
Extract integer data and append to environment. | |
static void | extractLease4 (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::Lease4Ptr &lease4, const std::string &prefix="", const std::string &suffix="") |
Extract Lease4 data and append to environment. | |
static void | extractLease6 (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::Lease6Ptr &lease6, const std::string &prefix="", const std::string &suffix="") |
Extract Lease6 data and append to environment. | |
static void | extractLeases4 (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::Lease4CollectionPtr &leases4, const std::string &prefix="", const std::string &suffix="") |
Extract Lease4Collection data and append to environment. | |
static void | extractLeases6 (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::Lease6CollectionPtr &leases6, const std::string &prefix="", const std::string &suffix="") |
Extract Lease6Collection data and append to environment. | |
static void | extractOption (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::OptionPtr option, const std::string &prefix="", const std::string &suffix="") |
Extract Option data and append to environment. | |
static void | extractOptionIA (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::Option6IAPtr option6IA, const std::string &prefix="", const std::string &suffix="") |
Extract Option6IA data and append to environment. | |
static void | extractPkt4 (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::Pkt4Ptr &pkt4, const std::string &prefix="", const std::string &suffix="") |
Extract Pkt4 data and append to environment. | |
static void | extractPkt6 (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::Pkt6Ptr &pkt6, const std::string &prefix="", const std::string &suffix="") |
Extract Pkt6 data and append to environment. | |
static void | extractString (isc::asiolink::ProcessEnvVars &vars, const std::string &value, const std::string &prefix="", const std::string &suffix="") |
Extract string data and append to environment. | |
static void | extractSubnet4 (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::ConstSubnet4Ptr subnet4, const std::string &prefix="", const std::string &suffix="") |
Extract Subnet4 data and append to environment. | |
static void | extractSubnet6 (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::ConstSubnet6Ptr subnet6, const std::string &prefix="", const std::string &suffix="") |
Extract Subnet6 data and append to environment. | |
static void | extractSubOption (isc::asiolink::ProcessEnvVars &vars, const isc::dhcp::OptionPtr option, uint16_t code, const std::string &prefix="", const std::string &suffix="") |
Extract Option SubOption data and append to environment. | |
Run Script implementation.
Definition at line 28 of file run_script.h.
isc::run_script::RunScriptImpl::RunScriptImpl | ( | ) |
Constructor.
Definition at line 21 of file run_script.cc.
|
default |
Destructor.
void isc::run_script::RunScriptImpl::configure | ( | isc::hooks::LibraryHandle & | handle | ) |
This function parses and applies configuration parameters.
Definition at line 25 of file run_script.cc.
References isc::asiolink::ProcessSpawn::ASYNC, Element::boolean, isc::hooks::LibraryHandle::getParameter(), isc_throw, setName(), setSync(), Element::string, and isc::Exception::what().
|
static |
Extract boolean data and append to environment.
vars | The process environment variables. |
value | The value to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 55 of file run_script.cc.
Referenced by extractPkt4(), lease4_expire(), and lease6_expire().
|
static |
Extract ClientId data and append to environment.
vars | The process environment variables. |
client_id | The client id to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 102 of file run_script.cc.
References extractString().
Referenced by extractLease4(), and lease4_renew().
|
static |
Extract DUID data and append to environment.
vars | The process environment variables. |
duid | The duid to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 115 of file run_script.cc.
References extractString().
Referenced by extractLease6(), and extractPkt6().
|
static |
Extract HWAddr data and append to environment.
vars | The process environment variables. |
hwaddr | The hwaddr to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 88 of file run_script.cc.
References extractInteger(), and extractString().
Referenced by extractLease4(), extractLease6(), extractPkt4(), extractPkt6(), and lease4_renew().
|
static |
Extract integer data and append to environment.
vars | The process environment variables. |
value | The value to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 70 of file run_script.cc.
Referenced by extractHWAddr(), extractLease4(), extractLease6(), extractLeases4(), extractLeases6(), extractOptionIA(), extractPkt4(), extractPkt6(), extractSubnet4(), and extractSubnet6().
|
static |
Extract Lease4 data and append to environment.
vars | The process environment variables. |
lease4 | The lease4 to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 223 of file run_script.cc.
References extractClientId(), extractHWAddr(), extractInteger(), extractString(), and isc::dhcp::Lease4::statesToText().
Referenced by extractLeases4(), lease4_decline(), lease4_expire(), lease4_recover(), lease4_release(), and lease4_renew().
|
static |
Extract Lease6 data and append to environment.
vars | The process environment variables. |
lease6 | The lease6 to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 257 of file run_script.cc.
References extractDUID(), extractHWAddr(), extractInteger(), extractString(), isc::dhcp::Lease6::statesToText(), and isc::dhcp::Lease::typeToText().
Referenced by addr6_register(), extractLeases6(), lease6_decline(), lease6_expire(), lease6_rebind(), lease6_recover(), lease6_release(), and lease6_renew().
|
static |
Extract Lease4Collection data and append to environment.
vars | The process environment variables. |
leases4 | The leases4 to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 303 of file run_script.cc.
References extractInteger(), extractLease4(), and extractString().
Referenced by leases4_committed().
|
static |
Extract Lease6Collection data and append to environment.
vars | The process environment variables. |
leases6 | The leases6 to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 322 of file run_script.cc.
References extractInteger(), extractLease6(), and extractString().
Referenced by leases6_committed().
|
static |
Extract Option data and append to environment.
vars | The process environment variables. |
option | The option to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 128 of file run_script.cc.
References extractString().
Referenced by extractPkt4(), extractPkt6(), and extractSubOption().
|
static |
Extract Option6IA data and append to environment.
vars | The process environment variables. |
option6IA | The option6IA to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 155 of file run_script.cc.
References extractInteger(), and extractString().
Referenced by lease6_rebind(), and lease6_renew().
|
static |
Extract Pkt4 data and append to environment.
vars | The process environment variables. |
pkt4 | The pkt4 to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 341 of file run_script.cc.
References isc::dhcp::DHO_DHCP_AGENT_OPTIONS, extractBoolean(), extractHWAddr(), extractInteger(), extractOption(), extractString(), extractSubOption(), isc::dhcp::RAI_OPTION_AGENT_CIRCUIT_ID, and isc::dhcp::RAI_OPTION_REMOTE_ID.
Referenced by lease4_decline(), lease4_release(), lease4_renew(), and leases4_committed().
|
static |
Extract Pkt6 data and append to environment.
vars | The process environment variables. |
pkt6 | The pkt6 to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 422 of file run_script.cc.
References D6O_INTERFACE_ID, D6O_REMOTE_ID, D6O_SUBSCRIBER_ID, extractDUID(), extractHWAddr(), extractInteger(), extractOption(), extractString(), isc::dhcp::Pkt6::RELAY_SEARCH_FROM_CLIENT, and isc::dhcp::Pkt6::UDP.
Referenced by addr6_register(), lease6_decline(), lease6_rebind(), lease6_release(), lease6_renew(), and leases6_committed().
|
static |
Extract string data and append to environment.
vars | The process environment variables. |
value | The value to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 79 of file run_script.cc.
Referenced by addr6_register(), extractClientId(), extractDUID(), extractHWAddr(), extractLease4(), extractLease6(), extractLeases4(), extractLeases6(), extractOption(), extractOptionIA(), extractPkt4(), extractPkt6(), extractSubnet4(), and extractSubnet6().
|
static |
Extract Subnet4 data and append to environment.
vars | The process environment variables. |
subnet4 | The subnet4 to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 177 of file run_script.cc.
References extractInteger(), and extractString().
Referenced by lease4_renew().
|
static |
Extract Subnet6 data and append to environment.
vars | The process environment variables. |
subnet6 | The subnet6 to be exported to target script environment. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 200 of file run_script.cc.
References extractInteger(), and extractString().
|
static |
Extract Option SubOption data and append to environment.
vars | The process environment variables. |
option | The parent option of the suboption to be exported to target script environment. |
code | The code of the suboption. |
prefix | The prefix for the name of the environment variable. |
suffix | The suffix for the name of the environment variable. |
Definition at line 141 of file run_script.cc.
References extractOption().
Referenced by extractPkt4().
|
inline |
Get name of the target script.
Definition at line 245 of file run_script.h.
|
inline |
Get the synchronous call mode for the target script.
Definition at line 259 of file run_script.h.
void isc::run_script::RunScriptImpl::runScript | ( | const isc::asiolink::ProcessArgs & | args, |
const isc::asiolink::ProcessEnvVars & | vars ) |
Run Script with specified arguments and environment parameters.
args | The arguments for the target script. |
vars | The environment variables made available for the target script. |
Definition at line 49 of file run_script.cc.
References isc::asiolink::ProcessSpawn::ASYNC.
|
inline |
Set name of the target script.
name | The name of the target script. |
Definition at line 237 of file run_script.h.
References isc::hooks::HookLibraryScriptsChecker::validatePath().
Referenced by configure().
|
inline |
Set the synchronous call mode for the target script.
sync | The synchronous call mode for the target script. |
Definition at line 252 of file run_script.h.
Referenced by configure().