Kea 3.1.0
callouts.cc File Reference

Defines callouts used to generate flexible identifier values. More...

#include <config.h>
#include <util/str.h>
#include <asiolink/asio_wrapper.h>
#include <dhcp/dhcp4.h>
#include <dhcp/dhcp6.h>
#include <dhcp/duid.h>
#include <dhcp/option.h>
#include <dhcp/option6_ia.h>
#include <dhcp/pkt4.h>
#include <dhcp/pkt6.h>
#include <dhcpsrv/host.h>
#include <hooks/hooks.h>
#include <eval/evaluate.h>
#include <eval/token.h>
#include <eval/eval_context.h>
#include <flex_id_log.h>
#include <algorithm>
#include <sstream>
+ Include dependency graph for callouts.cc:

Go to the source code of this file.

Namespaces

namespace  isc
 Defines the logger used by the top-level component of kea-lfc.
 
namespace  isc::flex_id
 

Functions

void isc::flex_id::clearConfiguration ()
 Clears stored configuration.
 
int host4_identifier (CalloutHandle &handle)
 This callout is called at the "host4_identifier" hook.
 
int host6_identifier (CalloutHandle &handle)
 This callout is called at the "host6_identifier" hook.
 
void isc::flex_id::parseAndStoreExpression (bool v6, const std::string &expr)
 Parses expression provided as text.
 
int pkt4_receive (CalloutHandle &handle)
 This callout is called at "pkt4_receive" hook point.
 
int pkt4_send (CalloutHandle &handle)
 This callout is called at "pkt4_send" hook point.
 
int pkt6_receive (CalloutHandle &handle)
 This callout is called at "pkt6_receive" hook point.
 
int pkt6_send (CalloutHandle &handle)
 This callout is called at "pkt6_send" hook point.
 
template<typename PacketType>
void isc::flex_id::retrieveFlexId (CalloutHandle &callout_handle, const Expression &expression, PacketType &pkt, std::vector< uint8_t > &id)
 Retrieves flexible identifier from the context or computes it.
 
void isc::flex_id::storeConfiguration (bool v6, const std::string &expr, const bool apply_to_leases, const bool ignore_iaid)
 Stores expression.
 

Detailed Description

Defines callouts used to generate flexible identifier values.

Definition in file callouts.cc.

Function Documentation

◆ host4_identifier()

int host4_identifier ( CalloutHandle & handle)

This callout is called at the "host4_identifier" hook.

It retrieves v4 packet and then generates flexible identifier for it.

Parameters
handleCalloutHandle which provides access to context.
Returns
0 upon success, non-zero otherwise.

Definition at line 141 of file callouts.cc.

References isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::dhcp::Host::IDENT_FLEX, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::flex_id::retrieveFlexId(), and isc::hooks::CalloutHandle::setArgument().

+ Here is the call graph for this function:

◆ host6_identifier()

int host6_identifier ( CalloutHandle & handle)

This callout is called at the "host6_identifier" hook.

It retrieves the v6 packet and then generates flexible identifier for it.

Parameters
handleCalloutHandle which provides access to context.
Returns
0 upon success, non-zero otherwise.

Definition at line 301 of file callouts.cc.

References isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), isc::dhcp::Host::IDENT_FLEX, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::flex_id::retrieveFlexId(), and isc::hooks::CalloutHandle::setArgument().

+ Here is the call graph for this function:

◆ pkt4_receive()

int pkt4_receive ( CalloutHandle & handle)

This callout is called at "pkt4_receive" hook point.

It replaces existing or inserts new client identifier option into a received packet using flexible identifier value.

Parameters
handleCalloutHandle which provides access to context.
Returns
0 upon success, non-zero otherwise.

Definition at line 182 of file callouts.cc.

References isc::log::DBGLVL_TRACE_BASIC, isc::dhcp::DHO_DHCP_CLIENT_IDENTIFIER, isc::flex_id::flex_id_logger, FLEX_ID_USED_AS_CLIENT_ID, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), LOG_DEBUG, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::flex_id::retrieveFlexId(), isc::hooks::CalloutHandle::setContext(), isc::dhcp::IdentifierType< min_size, max_size >::toText(), and isc::dhcp::Option::V4.

+ Here is the call graph for this function:

◆ pkt4_send()

int pkt4_send ( CalloutHandle & handle)

This callout is called at "pkt4_send" hook point.

It restores client identifier sent by the DHCP client and temporarily replaced in the pkt4_receive callout to flex-id.

Parameters
handleCalloutHandle which provides access to context.
Returns
0 upon success, non-zero otherwise.

Definition at line 238 of file callouts.cc.

References isc::log::DBGLVL_TRACE_BASIC, isc::dhcp::DHO_DHCP_CLIENT_IDENTIFIER, isc::flex_id::flex_id_logger, FLEX_ID_RESTORE_CLIENT_ID, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getContext(), isc::hooks::CalloutHandle::getStatus(), isc_throw, LOG_DEBUG, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, and isc::dhcp::IdentifierType< min_size, max_size >::toText().

+ Here is the call graph for this function:

◆ pkt6_receive()

int pkt6_receive ( CalloutHandle & handle)

This callout is called at "pkt6_receive" hook point.

It replaces existing or inserts new DUID into a received packet using flexible identifier value.

Parameters
handleCalloutHandle which provides access to context.
Returns
0 upon success, non-zero otherwise.

Definition at line 342 of file callouts.cc.

References D6O_CLIENTID, D6O_IA_NA, D6O_IA_PD, isc::log::DBGLVL_TRACE_BASIC, FLEX_ID_IGNORE_IAID_APPLIED_ON_NA, FLEX_ID_IGNORE_IAID_APPLIED_ON_PD, FLEX_ID_IGNORE_IAID_NOT_APPLIED_ON_NA, FLEX_ID_IGNORE_IAID_NOT_APPLIED_ON_PD, isc::flex_id::flex_id_logger, FLEX_ID_USED_AS_DUID, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getStatus(), LOG_DEBUG, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::flex_id::retrieveFlexId(), isc::hooks::CalloutHandle::setContext(), isc::dhcp::IdentifierType< min_size, max_size >::toText(), and isc::dhcp::Option::V6.

+ Here is the call graph for this function:

◆ pkt6_send()

int pkt6_send ( CalloutHandle & handle)

This callout is called at "pkt6_send" hook point.

It restores DUID sent by the DHCP client and temporarily replaced in the pkt6_receive callout to flex-id.

Parameters
handleCalloutHandle which provides access to context.
Returns
0 upon success, non-zero otherwise.

Definition at line 461 of file callouts.cc.

References D6O_CLIENTID, D6O_IA_NA, D6O_IA_PD, isc::log::DBGLVL_TRACE_BASIC, isc::flex_id::flex_id_logger, FLEX_ID_RESTORE_DUID, isc::hooks::CalloutHandle::getArgument(), isc::hooks::CalloutHandle::getContext(), isc::hooks::CalloutHandle::getStatus(), isc_throw, LOG_DEBUG, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, and isc::dhcp::IdentifierType< min_size, max_size >::toText().

+ Here is the call graph for this function: