Kea 3.1.0
isc::run_script::RunScriptImpl Class Reference

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.
 

Detailed Description

Run Script implementation.

Definition at line 28 of file run_script.h.

Constructor & Destructor Documentation

◆ RunScriptImpl()

isc::run_script::RunScriptImpl::RunScriptImpl ( )

Constructor.

Definition at line 21 of file run_script.cc.

◆ ~RunScriptImpl()

isc::run_script::RunScriptImpl::~RunScriptImpl ( )
default

Destructor.

Member Function Documentation

◆ configure()

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().

+ Here is the call graph for this function:

◆ extractBoolean()

void isc::run_script::RunScriptImpl::extractBoolean ( isc::asiolink::ProcessEnvVars & vars,
const bool value,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract boolean data and append to environment.

Parameters
varsThe process environment variables.
valueThe value to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

◆ extractClientId()

void isc::run_script::RunScriptImpl::extractClientId ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::ClientIdPtr client_id,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract ClientId data and append to environment.

Parameters
varsThe process environment variables.
client_idThe client id to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractDUID()

void isc::run_script::RunScriptImpl::extractDUID ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::DuidPtr duid,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract DUID data and append to environment.

Parameters
varsThe process environment variables.
duidThe duid to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe suffix for the name of the environment variable.

Definition at line 115 of file run_script.cc.

References extractString().

Referenced by extractLease6(), and extractPkt6().

+ Here is the call graph for this function:

◆ extractHWAddr()

void isc::run_script::RunScriptImpl::extractHWAddr ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::HWAddrPtr & hwaddr,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract HWAddr data and append to environment.

Parameters
varsThe process environment variables.
hwaddrThe hwaddr to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractInteger()

void isc::run_script::RunScriptImpl::extractInteger ( isc::asiolink::ProcessEnvVars & vars,
const uint64_t value,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract integer data and append to environment.

Parameters
varsThe process environment variables.
valueThe value to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

◆ extractLease4()

void isc::run_script::RunScriptImpl::extractLease4 ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::Lease4Ptr & lease4,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Lease4 data and append to environment.

Parameters
varsThe process environment variables.
lease4The lease4 to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractLease6()

void isc::run_script::RunScriptImpl::extractLease6 ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::Lease6Ptr & lease6,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Lease6 data and append to environment.

Parameters
varsThe process environment variables.
lease6The lease6 to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractLeases4()

void isc::run_script::RunScriptImpl::extractLeases4 ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::Lease4CollectionPtr & leases4,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Lease4Collection data and append to environment.

Parameters
varsThe process environment variables.
leases4The leases4 to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractLeases6()

void isc::run_script::RunScriptImpl::extractLeases6 ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::Lease6CollectionPtr & leases6,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Lease6Collection data and append to environment.

Parameters
varsThe process environment variables.
leases6The leases6 to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractOption()

void isc::run_script::RunScriptImpl::extractOption ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::OptionPtr option,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Option data and append to environment.

Parameters
varsThe process environment variables.
optionThe option to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractOptionIA()

void isc::run_script::RunScriptImpl::extractOptionIA ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::Option6IAPtr option6IA,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Option6IA data and append to environment.

Parameters
varsThe process environment variables.
option6IAThe option6IA to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractPkt4()

void isc::run_script::RunScriptImpl::extractPkt4 ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::Pkt4Ptr & pkt4,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Pkt4 data and append to environment.

Parameters
varsThe process environment variables.
pkt4The pkt4 to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractPkt6()

void isc::run_script::RunScriptImpl::extractPkt6 ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::Pkt6Ptr & pkt6,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Pkt6 data and append to environment.

Parameters
varsThe process environment variables.
pkt6The pkt6 to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractString()

void isc::run_script::RunScriptImpl::extractString ( isc::asiolink::ProcessEnvVars & vars,
const std::string & value,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract string data and append to environment.

Parameters
varsThe process environment variables.
valueThe value to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

◆ extractSubnet4()

void isc::run_script::RunScriptImpl::extractSubnet4 ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::ConstSubnet4Ptr subnet4,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Subnet4 data and append to environment.

Parameters
varsThe process environment variables.
subnet4The subnet4 to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe 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().

+ Here is the call graph for this function:

◆ extractSubnet6()

void isc::run_script::RunScriptImpl::extractSubnet6 ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::ConstSubnet6Ptr subnet6,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Subnet6 data and append to environment.

Parameters
varsThe process environment variables.
subnet6The subnet6 to be exported to target script environment.
prefixThe prefix for the name of the environment variable.
suffixThe suffix for the name of the environment variable.

Definition at line 200 of file run_script.cc.

References extractInteger(), and extractString().

+ Here is the call graph for this function:

◆ extractSubOption()

void isc::run_script::RunScriptImpl::extractSubOption ( isc::asiolink::ProcessEnvVars & vars,
const isc::dhcp::OptionPtr option,
uint16_t code,
const std::string & prefix = "",
const std::string & suffix = "" )
static

Extract Option SubOption data and append to environment.

Parameters
varsThe process environment variables.
optionThe parent option of the suboption to be exported to target script environment.
codeThe code of the suboption.
prefixThe prefix for the name of the environment variable.
suffixThe suffix for the name of the environment variable.

Definition at line 141 of file run_script.cc.

References extractOption().

Referenced by extractPkt4().

+ Here is the call graph for this function:

◆ getName()

std::string isc::run_script::RunScriptImpl::getName ( ) const
inline

Get name of the target script.

Returns
The name of the target script.

Definition at line 245 of file run_script.h.

◆ getSync()

bool isc::run_script::RunScriptImpl::getSync ( ) const
inline

Get the synchronous call mode for the target script.

Returns
The synchronous call mode for the target script.

Definition at line 259 of file run_script.h.

◆ runScript()

void isc::run_script::RunScriptImpl::runScript ( const isc::asiolink::ProcessArgs & args,
const isc::asiolink::ProcessEnvVars & vars )

Run Script with specified arguments and environment parameters.

Parameters
argsThe arguments for the target script.
varsThe environment variables made available for the target script.

Definition at line 49 of file run_script.cc.

References isc::asiolink::ProcessSpawn::ASYNC.

◆ setName()

void isc::run_script::RunScriptImpl::setName ( const std::string & name)
inline

Set name of the target script.

Parameters
nameThe name of the target script.

Definition at line 237 of file run_script.h.

References isc::hooks::HookLibraryScriptsChecker::validatePath().

Referenced by configure().

+ Here is the call graph for this function:

◆ setSync()

void isc::run_script::RunScriptImpl::setSync ( const bool sync)
inline

Set the synchronous call mode for the target script.

Parameters
syncThe synchronous call mode for the target script.

Definition at line 252 of file run_script.h.

Referenced by configure().


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