Kea 3.1.1
lease_query_callouts.cc File Reference
#include <config.h>
#include <asiolink/io_service.h>
#include <asiolink/io_service_mgr.h>
#include <database/audit_entry.h>
#include <hooks/hooks.h>
#include <dhcpsrv/cfgmgr.h>
#include <lease_query_log.h>
#include <lease_query_impl_factory.h>
#include <blq_service.h>
#include <process/daemon.h>
#include <stats/stats_mgr.h>
#include <string>
#include <vector>
+ Include dependency graph for lease_query_callouts.cc:

Go to the source code of this file.

Functions

int buffer4_receive (CalloutHandle &handle)
 This callout is called at the "buffer4_receive" hook.
 
int buffer6_receive (CalloutHandle &handle)
 This callout is called at the "buffer6_receive" hook.
 
int cb6_updated (CalloutHandle &handle)
 This callout is called at the "cb6_updated" hook.
 
int dhcp4_srv_configured (CalloutHandle &)
 dhcp4_srv_configured callout implementation.
 
int dhcp6_srv_configured (CalloutHandle &handle)
 dhcp6_srv_configured callout implementation.
 
int load (LibraryHandle &handle)
 This function is called when the library is loaded.
 
int multi_threading_compatible ()
 This function is called to retrieve the multi-threading compatibility.
 
int unload ()
 This function is called when the library is unloaded.
 

Function Documentation

◆ buffer4_receive()

int buffer4_receive ( CalloutHandle & handle)

This callout is called at the "buffer4_receive" hook.

If the inbound packet hasn't been unpacked, it is unpacked. If it is anything other than DHCPLEASEQUERY we set the call status to NEXT_STEP_SKIP and return 0 to indicate success (i.e. we ignore the packet).

The query is passed into LeaseQueryImpl4::processQuery() which carries out all aspects of responding to it:

  • Validating the query
  • Searching for matching leases
  • Constructing the response
  • Sending the response to the requester
Returns
0 if the packet was handled appropriately, 1 if an error occurred.
Parameters
handleCalloutHandle.
Returns
0 upon success, non-zero otherwise.

Definition at line 101 of file lease_query_callouts.cc.

References isc::stats::StatsMgr::addValue(), isc::log::DBGLVL_TRACE_BASIC, isc::lease_query::DHCP4_LEASE_QUERY_PACKET_UNPACK_FAILED, isc::lease_query::DHCP4_LEASE_QUERY_PROCESS_FAILED, isc::lease_query::DHCP4_LEASE_QUERY_RECEIVED, isc::dhcp::DHCPLEASEQUERY, isc::hooks::CalloutHandle::getArgument(), isc::lease_query::LeaseQueryImplFactory::getImpl(), isc::hooks::CalloutHandle::getStatus(), isc::stats::StatsMgr::instance(), isc::lease_query::lease_query_logger, isc::lease_query::LeaseQueryImpl4::leaseQueryLabel(), LOG_DEBUG, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::lease_query::LeaseQueryImpl::processQuery(), and isc::hooks::CalloutHandle::setStatus().

+ Here is the call graph for this function:

◆ buffer6_receive()

int buffer6_receive ( CalloutHandle & handle)

This callout is called at the "buffer6_receive" hook.

If the inbound packet hasn't been unpacked, it is unpacked. If it is anything other than DHCPV6_LEASEQUERY we set the call status to NEXT_STEP_SKIP and return 0 to indicate success (i.e. we ignore the packet).

The query is passed into LeaseQueryImpl6::processQuery() which carries out all aspects of responding to it:

  • Validating the query
  • Searching for matching leases
  • Constructing the response
  • Sending the response to the requester
Returns
0 if the packet was handled appropriately, 1 if an error occurred.
Parameters
handleCalloutHandle.
Returns
0 upon success, non-zero otherwise.

Definition at line 183 of file lease_query_callouts.cc.

References isc::stats::StatsMgr::addValue(), isc::log::DBGLVL_TRACE_BASIC, isc::lease_query::DHCP6_LEASE_QUERY_PACKET_UNPACK_FAILED, isc::lease_query::DHCP6_LEASE_QUERY_PROCESS_FAILED, isc::lease_query::DHCP6_LEASE_QUERY_RECEIVED, DHCPV6_LEASEQUERY, isc::hooks::CalloutHandle::getArgument(), isc::lease_query::LeaseQueryImplFactory::getImpl(), isc::hooks::CalloutHandle::getStatus(), isc::stats::StatsMgr::instance(), isc::lease_query::lease_query_logger, isc::lease_query::LeaseQueryImpl6::leaseQueryLabel(), LOG_DEBUG, CalloutHandle::NEXT_STEP_DROP, CalloutHandle::NEXT_STEP_SKIP, isc::lease_query::LeaseQueryImpl::processQuery(), and isc::hooks::CalloutHandle::setStatus().

+ Here is the call graph for this function:

◆ cb6_updated()

int cb6_updated ( CalloutHandle & handle)

This callout is called at the "cb6_updated" hook.

If it detects that any subnets were altered by the update it repopulates the prefix length list.

Parameters
handleCalloutHandle.
Returns
0 upon success, number of expressions that failed otherwise.

Definition at line 348 of file lease_query_callouts.cc.

References isc::db::error, isc::hooks::CalloutHandle::getArgument(), isc::dhcp::CfgMgr::getCurrentCfg(), isc::lease_query::LeaseQueryImplFactory::getImpl(), isc::dhcp::CfgMgr::instance(), and isc::hooks::CalloutHandle::setArgument().

+ Here is the call graph for this function:

◆ dhcp4_srv_configured()

int dhcp4_srv_configured ( CalloutHandle & )

dhcp4_srv_configured callout implementation.

Starts the listener.

Parameters
handlecallout handle.
Returns
0 on success, non-zero otherwise.

Definition at line 334 of file lease_query_callouts.cc.

References isc::lease_query::BulkLeaseQueryService::doStartListener(), isc::lease_query::LeaseQueryImpl::getIOService(), isc::lease_query::LeaseQueryImplFactory::getMutableImpl(), isc::asiolink::IOServiceMgr::instance(), and isc::asiolink::IOServiceMgr::registerIOService().

+ Here is the call graph for this function:

◆ dhcp6_srv_configured()

int dhcp6_srv_configured ( CalloutHandle & handle)

dhcp6_srv_configured callout implementation.

Starts the listener.

Parameters
handlecallout handle.
Returns
0 on success, non-zero otherwise.

Definition at line 378 of file lease_query_callouts.cc.

References isc::lease_query::BulkLeaseQueryService::doStartListener(), isc::db::error, isc::hooks::CalloutHandle::getArgument(), isc::lease_query::LeaseQueryImplFactory::getImpl(), isc::lease_query::LeaseQueryImpl::getIOService(), isc::lease_query::LeaseQueryImplFactory::getMutableImpl(), isc::asiolink::IOServiceMgr::instance(), isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::asiolink::IOServiceMgr::registerIOService(), isc::hooks::CalloutHandle::setArgument(), and isc::hooks::CalloutHandle::setStatus().

+ Here is the call graph for this function:

◆ load()

◆ multi_threading_compatible()

int multi_threading_compatible ( )

This function is called to retrieve the multi-threading compatibility.

Returns
1 which means compatible with multi-threading.

Definition at line 401 of file lease_query_callouts.cc.

◆ unload()