Kea 2.5.8
isc::dhcp::ResourceHandler4 Class Reference

Resource race avoidance RAII handler for DHCPv4. More...

#include <resource_handler.h>

+ Inheritance diagram for isc::dhcp::ResourceHandler4:

Public Member Functions

virtual ~ResourceHandler4 ()
 Destructor.
 
bool isLocked4 (const asiolink::IOAddress &addr)
 Checks if a resource is owned by this handler.
 
bool tryLock4 (const asiolink::IOAddress &addr)
 Tries to acquires a resource.
 
void unLock4 (const asiolink::IOAddress &addr)
 Releases a resource.
 
- Public Member Functions inherited from isc::dhcp::ResourceHandler
 ResourceHandler ()
 Constructor.
 
virtual ~ResourceHandler ()
 Destructor.
 
bool isLocked (Lease::Type type, const asiolink::IOAddress &addr)
 Checks if a resource is owned by this handler.
 
bool tryLock (Lease::Type type, const asiolink::IOAddress &addr)
 Tries to acquires a resource.
 
void unLock (Lease::Type type, const asiolink::IOAddress &addr)
 Releases a resource.
 

Detailed Description

Resource race avoidance RAII handler for DHCPv4.

Definition at line 179 of file resource_handler.h.

Constructor & Destructor Documentation

◆ ~ResourceHandler4()

virtual isc::dhcp::ResourceHandler4::~ResourceHandler4 ( )
inlinevirtual

Destructor.

Releases owned resources.

Definition at line 185 of file resource_handler.h.

Member Function Documentation

◆ isLocked4()

bool isc::dhcp::ResourceHandler4::isLocked4 ( const asiolink::IOAddress addr)
inline

Checks if a resource is owned by this handler.

Parameters
addrThe address aka the resource.
Returns
true if this handler owns the resource, false otherwise.

Definition at line 203 of file resource_handler.h.

References isc::dhcp::ResourceHandler::isLocked(), and isc::dhcp::Lease::TYPE_V4.

+ Here is the call graph for this function:

◆ tryLock4()

bool isc::dhcp::ResourceHandler4::tryLock4 ( const asiolink::IOAddress addr)
inline

Tries to acquires a resource.

Lookup the resource, if not found insert the resource in the resource container and return true, if found return false

Parameters
addrThe address aka the resource.
Returns
true if the resource was acquired, false if the resource is busy i.e. owned by a handler.

Definition at line 195 of file resource_handler.h.

References isc::dhcp::ResourceHandler::tryLock(), and isc::dhcp::Lease::TYPE_V4.

Referenced by isc::lease_cmds::LeaseCmdsImpl::lease4UpdateHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler(), and isc::dhcp::Dhcpv4Srv::serverDecline().

+ Here is the call graph for this function:

◆ unLock4()

void isc::dhcp::ResourceHandler4::unLock4 ( const asiolink::IOAddress addr)
inline

Releases a resource.

Remove the resource from the resource container.

Parameters
addrThe address aka the resource.
Exceptions
whenwe do not own the resource.

Definition at line 213 of file resource_handler.h.

References isc::dhcp::Lease::TYPE_V4, and isc::dhcp::ResourceHandler::unLock().

+ Here is the call graph for this function:

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