Kea 2.7.5
isc::dhcp::LFCSetup Class Reference

Represents a configuration for Lease File Cleanup. More...

Public Member Functions

 LFCSetup (asiolink::IntervalTimer::Callback callback)
 Constructor.
 
 ~LFCSetup ()
 Destructor.
 
void execute ()
 Spawns a new process.
 
int getExitStatus () const
 Returns exit code of the last completed cleanup.
 
bool isRunning () const
 Checks if the lease file cleanup is in progress.
 
void setup (const uint32_t lfc_interval, const boost::shared_ptr< CSVLeaseFile4 > &lease_file4, const boost::shared_ptr< CSVLeaseFile6 > &lease_file6, bool run_once_now=false)
 Sets the new configuration for the Lease File Cleanup.
 

Detailed Description

Represents a configuration for Lease File Cleanup.

This class is solely used by the Memfile_LeaseMgr as a configuration information storage for Lease File Cleanup. Internally, it creates the interval timer and assigns a callback function (pointer to which is passed in the constructor), which will be called at the specified intervals to perform the cleanup. It is also responsible for creating and maintaining the object which is used to spawn the new process which executes the kea-lfc program.

This functionality is enclosed in a separate class so as the implementation details are not exposed in the Memfile_LeaseMgr header file and to maintain a single place with the LFC configuration, instead of multiple members and functions scattered in the Memfile_LeaseMgr class.

Definition at line 66 of file memfile_lease_mgr.cc.

Constructor & Destructor Documentation

◆ LFCSetup()

isc::dhcp::LFCSetup::LFCSetup ( asiolink::IntervalTimer::Callback callback)

Constructor.

Assigns a pointer to the function triggered to perform the cleanup. This pointer should point to the appropriate method of the Memfile_LeaseMgr class.

Parameters
callbackA pointer to the callback function.

Definition at line 129 of file memfile_lease_mgr.cc.

◆ ~LFCSetup()

isc::dhcp::LFCSetup::~LFCSetup ( )

Member Function Documentation

◆ execute()

void isc::dhcp::LFCSetup::execute ( )

◆ getExitStatus()

int isc::dhcp::LFCSetup::getExitStatus ( ) const

Returns exit code of the last completed cleanup.

Definition at line 252 of file memfile_lease_mgr.cc.

References isc_throw.

◆ isRunning()

bool isc::dhcp::LFCSetup::isRunning ( ) const

Checks if the lease file cleanup is in progress.

Returns
true if the lease file cleanup is being executed.

Definition at line 247 of file memfile_lease_mgr.cc.

◆ setup()

void isc::dhcp::LFCSetup::setup ( const uint32_t lfc_interval,
const boost::shared_ptr< CSVLeaseFile4 > & lease_file4,
const boost::shared_ptr< CSVLeaseFile6 > & lease_file6,
bool run_once_now = false )

Sets the new configuration for the Lease File Cleanup.

Parameters
lfc_intervalAn interval in seconds at which the cleanup should be performed.
lease_file4A pointer to the DHCPv4 lease file to be cleaned up or null. If this is null, the lease_file6 must be non-null.
lease_file6A pointer to the DHCPv6 lease file to be cleaned up or null. If this is null, the lease_file4 must be non-null.
run_once_nowA flag that causes LFC to be invoked immediately, regardless of the value of lfc_interval. This is primarily used to cause lease file schema upgrades upon startup.

Definition at line 158 of file memfile_lease_mgr.cc.

References isc::dhcp::Memfile_LeaseMgr::appendSuffix(), isc::asiolink::ProcessSpawn::ASYNC, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_MEMFILE_LFC_SETUP, isc::dhcp::Memfile_LeaseMgr::FILE_FINISH, isc::dhcp::Memfile_LeaseMgr::FILE_INPUT, isc::dhcp::Memfile_LeaseMgr::FILE_OUTPUT, isc::dhcp::Memfile_LeaseMgr::FILE_PID, isc::dhcp::Memfile_LeaseMgr::FILE_PREVIOUS, LOG_INFO, and isc::asiolink::IntervalTimer::REPEATING.

+ Here is the call graph for this function:

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