Kea: isc::hooks::CalloutHandleAssociate Class Reference

| Kea 3.0.2-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:
[legend]

## Public Member Functions
| CalloutHandleAssociate ()
| Constructor.
CalloutHandlePtr | getCalloutHandle ()
| Returns callout handle.
void | resetCalloutHandle ()
| Reset callout handle.

## Protected Attributes
CalloutHandlePtr | callout_handle_
| Callout handle stored.

## 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.

References callout_handle_.

## 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:

## ◆ resetCalloutHandle()

void isc::hooks::CalloutHandleAssociate::resetCalloutHandle | ( |  | ) |

Reset callout handle.

Definition at line 29 of file callout_handle_associate.cc.

References callout_handle_.

## Member Data Documentation

## ◆ callout_handle_

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

Callout handle stored.

Definition at line 57 of file callout_handle_associate.h.

Referenced by CalloutHandleAssociate(), getCalloutHandle(), and resetCalloutHandle().

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

- callout_handle_associate.h
- callout_handle_associate.cc