57 if (family == AF_INET) {
58 if (proc_name !=
"kea-dhcp4") {
60 <<
", expected kea-dhcp4");
63 if (proc_name !=
"kea-dhcp6") {
65 <<
", expected kea-dhcp6");
70 impl->configure(handle);
71 }
catch (
const exception& ex) {
117 args.push_back(
"lease4_renew");
118 impl->runScript(args, vars);
140 args.push_back(
"lease4_expire");
141 impl->runScript(args, vars);
160 args.push_back(
"lease4_recover");
161 impl->runScript(args, vars);
183 handle.
getArgument(
"deleted_leases4", deleted_leases4);
186 args.push_back(
"leases4_committed");
187 impl->runScript(args, vars);
209 args.push_back(
"lease4_release");
210 impl->runScript(args, vars);
232 args.push_back(
"lease4_decline");
233 impl->runScript(args, vars);
262 args.push_back(
"lease6_renew");
263 impl->runScript(args, vars);
292 args.push_back(
"lease6_rebind");
293 impl->runScript(args, vars);
315 args.push_back(
"lease6_expire");
316 impl->runScript(args, vars);
335 args.push_back(
"lease6_recover");
336 impl->runScript(args, vars);
358 handle.
getArgument(
"deleted_leases6", deleted_leases6);
361 args.push_back(
"leases6_committed");
362 impl->runScript(args, vars);
384 args.push_back(
"lease6_release");
385 impl->runScript(args, vars);
407 args.push_back(
"lease6_decline");
408 impl->runScript(args, vars);
437 args.push_back(
"addr6_register");
438 impl->runScript(args, vars);
CalloutNextStep
Specifies allowed next steps.
@ NEXT_STEP_DROP
drop the packet
@ NEXT_STEP_SKIP
skip the next processing step
A generic exception that is thrown when an unexpected error condition occurs.
The IOAddress class represents an IP addresses (version agnostic)
std::string toText() const
Convert the address to a string.
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
uint16_t getFamily() const
Returns address family.
static CfgMgr & instance()
returns a single instance of Configuration Manager
Per-packet callout handle.
CalloutNextStep getStatus() const
Returns the next processing step.
void getArgument(const std::string &name, T &value) const
Get argument.
static std::string getProcName()
returns the process name This value is used as when forming the default PID file name
Run Script implementation.
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 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 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 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 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 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 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 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 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 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 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.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
std::vector< std::string > ProcessArgs
Type of the container holding arguments of the executable being run as a background process.
std::vector< std::string > ProcessEnvVars
Type of the container holding environment variables of the executable being run as a background proce...
boost::shared_ptr< Lease4Collection > Lease4CollectionPtr
A shared pointer to the collection of IPv4 leases.
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
boost::shared_ptr< Option6IA > Option6IAPtr
A pointer to the Option6IA object.
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
boost::shared_ptr< Lease6Collection > Lease6CollectionPtr
A shared pointer to the collection of IPv6 leases.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
boost::shared_ptr< RunScriptImpl > RunScriptImplPtr
The type of shared pointers to Run Script implementations.
isc::log::Logger run_script_logger("run-script-hooks")
Defines the logger used by the top-level component of kea-lfc.
int lease4_recover(CalloutHandle &handle)
handle lease4_recover hook and set environment parameters for the script.
int lease4_release(CalloutHandle &handle)
handle lease4_release hook and set environment parameters for the script.
int lease4_decline(CalloutHandle &handle)
handle lease4_decline hook and set environment parameters for the script.
int leases6_committed(CalloutHandle &handle)
handle leases6_committed hook and set environment parameters for the script.
int lease6_release(CalloutHandle &handle)
handle lease6_release hook and set environment parameters for the script.
int leases4_committed(CalloutHandle &handle)
handle leases4_committed hook and set environment parameters for the script.
int lease6_rebind(CalloutHandle &handle)
handle lease6_rebind hook and set environment parameters for the script.
int multi_threading_compatible()
This function is called to retrieve the multi-threading compatibility.
int lease4_renew(CalloutHandle &handle)
handle lease4_renew hook and set environment parameters for the script.
int unload()
This function is called when the library is unloaded.
int lease6_expire(CalloutHandle &handle)
handle lease6_expire hook and set environment parameters for the script.
int lease4_expire(CalloutHandle &handle)
handle lease4_expire hook and set environment parameters for the script.
int addr6_register(CalloutHandle &handle)
handle addr6_register hook and set environment parameters for the script.
int load(LibraryHandle &handle)
This function is called when the library is loaded.
int lease6_recover(CalloutHandle &handle)
handle lease6_recover hook and set environment parameters for the script.
int lease6_decline(CalloutHandle &handle)
handle lease6_decline hook and set environment parameters for the script.
int lease6_renew(CalloutHandle &handle)
handle lease6_renew hook and set environment parameters for the script.
const isc::log::MessageID RUN_SCRIPT_UNLOAD
const isc::log::MessageID RUN_SCRIPT_LOAD
const isc::log::MessageID RUN_SCRIPT_LOAD_ERROR
@ TYPE_NA
the lease contains non-temporary IPv6 address