Kea: isc::dhcp::ScopedPktOptionsCopy< PktType > Class Template Reference

| Kea 3.0.2-git

isc::dhcp::ScopedPktOptionsCopy< PktType > Class Template Reference

RAII object enabling duplication of the stored options and restoring the original options on destructor. More...

`#include <pkt.h>`

## Public Member Functions
| ScopedPktOptionsCopy (PktType &pkt)
| Constructor.
| ~ScopedPktOptionsCopy ()
| Destructor.

## Detailed Description

template<typename PktType>
class isc::dhcp::ScopedPktOptionsCopy< PktType >

RAII object enabling duplication of the stored options and restoring the original options on destructor.

This object enables duplication of the stored options and restoring the original options on destructor. When the object goes out of scope, the initial options are restored. This is applicable in cases when the server is going to invoke a callout (hook library) where the list of options in the packet will be modified. The use of RAII object eliminates the need for explicitly copying and restoring the list of options and is safer in case of exceptions thrown by callouts and a presence of multiple exit points.

Template Parameters

  PktType | Type of the packet, e.g. Pkt4, Pkt6, Pkt4o6.

Definition at line 1057 of file pkt.h.

## Constructor & Destructor Documentation

## ◆ ScopedPktOptionsCopy()

template<typename PktType>

isc::dhcp::ScopedPktOptionsCopy< PktType >::ScopedPktOptionsCopy | ( | PktType & | pkt | ) |
| inline

Constructor.

Creates a copy of the initial options on a packet.

Parameters

  pkt | Pointer to the packet.

Definition at line 1065 of file pkt.h.

## ◆ ~ScopedPktOptionsCopy()

template<typename PktType>

isc::dhcp::ScopedPktOptionsCopy< PktType >::~ScopedPktOptionsCopy | ( |  | ) |
| inline

Destructor.

Restores the initial options on a packet.

Definition at line 1072 of file pkt.h.

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

- pkt.h