Singleton which warehouses the configured binding variables, and evaluation of variables for a given lease and packet pair. More...
#include <binding_variables.h>
Public Member Functions | |
BindingVariableMgr (uint32_t family) | |
Constructor. | |
~BindingVariableMgr ()=default | |
Destructor;. | |
void | configure (data::ConstElementPtr config) |
Configures the manager based on the given configuration. | |
bool | evaluateVariables (dhcp::PktPtr query, dhcp::PktPtr response, dhcp::LeasePtr lease) |
Evaluates the binding variables for a given lease and packet pair. | |
BindingVariableCachePtr | getCache () |
Fetches the current variables cache. | |
Singleton which warehouses the configured binding variables, and evaluation of variables for a given lease and packet pair.
Definition at line 254 of file binding_variables.h.
|
explicit |
Constructor.
family | Protocol family of the expression, either AF_INET or AF_INET6. |
Definition at line 182 of file binding_variables.cc.
References isc_throw.
|
default |
Destructor;.
void isc::lease_cmds::BindingVariableMgr::configure | ( | data::ConstElementPtr | config | ) |
Configures the manager based on the given configuration.
This will clear the binding variable cache and then repopulate it by parsing the configuration. It expects to see a list of one or more binding variable maps similar to the following:
config | JSON element tree containing the binding-variable list. |
DhcpConfigError | if the configuration is invalid. |
Definition at line 192 of file binding_variables.cc.
References isc_throw, isc::data::Element::list, and isc::lease_cmds::BindingVariable::parse().
bool isc::lease_cmds::BindingVariableMgr::evaluateVariables | ( | dhcp::PktPtr | query, |
dhcp::PktPtr | response, | ||
dhcp::LeasePtr | lease ) |
Evaluates the binding variables for a given lease and packet pair.
Iterates over the variables in the cache evaluating each on and added its name and value to the context.
query | Client packet which produced the lease. Variables whose source is "query" will be evaluated against this packet. |
response | Server response conveying the lease. Variables whose source is "response" will be evaluated against this packet. |
lease | Lease whose use-context will be updated with the evaluation results. If the results of the evaluation are identical the the lease's existing binding-variables value, the lease is not altered. This allows a subsequent lease store update to only occur when needed. |
Definition at line 219 of file binding_variables.cc.
References isc::data::Element::create(), isc::data::Element::createMap(), isc::dhcp::evaluateString(), isc_throw, and isc::lease_cmds::BindingVariable::QUERY.
|
inline |
Fetches the current variables cache.
Definition at line 308 of file binding_variables.h.