Kea  2.1.6-git
isc::hooks::CalloutHandleAssociate Class Reference

Base class for classes which need to be associated with a CalloutHandle object. More...

#include <callout_handle_associate.h>

+ Inheritance diagram for isc::hooks::CalloutHandleAssociate:

Public Member Functions

 CalloutHandleAssociate ()
 Constructor. More...
 
CalloutHandlePtr getCalloutHandle ()
 Returns callout handle. More...
 

Protected Attributes

CalloutHandlePtr callout_handle_
 Callout handle stored. More...
 

Detailed Description

Base class for classes which need to be associated with a CalloutHandle object.

The CalloutHandle is an object used to pass various parameters between Kea and the callouts. The Kea servers usually invoke multiple different callouts for a single packet such as DHCP packet, control command etc. Therefore, it is required to associate this packet with an instance of the callout handle, so this instance can be used for all callouts invoked for this packet.

Previously this association was made by the CalloutHandleStore class. However, with the introduction of parallel processing of packets (DHCP packets parking) it became awkward to use. Attempts to extend this class to hold a map of associations failed because of no easy way to garbage collect unused handles.

The easiest way to deal with this is to provide ownership of the CalloutHandle to the object with which it is associated. The class of this object needs to derive from this class. When the object (e.g. DHCP packet) goes out of scope and is destroyed this instance is destroyed as well.

Definition at line 37 of file callout_handle_associate.h.

Constructor & Destructor Documentation

◆ CalloutHandleAssociate()

isc::hooks::CalloutHandleAssociate::CalloutHandleAssociate ( )

Constructor.

Definition at line 15 of file callout_handle_associate.cc.

Member Function Documentation

◆ getCalloutHandle()

CalloutHandlePtr isc::hooks::CalloutHandleAssociate::getCalloutHandle ( )

Returns callout handle.

The callout handle is created if it doesn't exist. Subsequent calls to this method always return the same handle.

Returns
Pointer to the callout handle.

Definition at line 20 of file callout_handle_associate.cc.

References callout_handle_, and isc::hooks::HooksManager::createCalloutHandle().

+ Here is the call graph for this function:

Member Data Documentation

◆ callout_handle_

CalloutHandlePtr isc::hooks::CalloutHandleAssociate::callout_handle_
protected

Callout handle stored.

Definition at line 54 of file callout_handle_associate.h.

Referenced by getCalloutHandle().


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