Kea  2.1.7-git
isc::dhcp::ScopedSubOptionsCopy Class Reference

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

#include <pkt.h>

Public Member Functions

 ScopedSubOptionsCopy (const OptionPtr &opt)
 Constructor. More...
 
 ~ScopedSubOptionsCopy ()
 Destructor. More...
 

Detailed Description

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. This can also be used to restore the initial suboptions of an option when the suboptions are changed (e.g. when splitting long options and suboptions). 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.

Definition at line 811 of file pkt.h.

Constructor & Destructor Documentation

◆ ScopedSubOptionsCopy()

isc::dhcp::ScopedSubOptionsCopy::ScopedSubOptionsCopy ( const OptionPtr opt)
inline

Constructor.

Creates a copy of the initial options on an option.

Parameters
optPointer to the option.

Definition at line 819 of file pkt.h.

◆ ~ScopedSubOptionsCopy()

isc::dhcp::ScopedSubOptionsCopy::~ScopedSubOptionsCopy ( )
inline

Destructor.

Restores the initial options on a packet.

Definition at line 828 of file pkt.h.


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