Kea  2.1.7-git
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. More...
 
bool isLocked4 (const asiolink::IOAddress &addr)
 Checks if a resource is owned by this handler. More...
 
bool tryLock4 (const asiolink::IOAddress &addr)
 Tries to acquires a resource. More...
 
void unLock4 (const asiolink::IOAddress &addr)
 Releases a resource. More...
 
- Public Member Functions inherited from isc::dhcp::ResourceHandler
 ResourceHandler ()
 Constructor. More...
 
virtual ~ResourceHandler ()
 Destructor. More...
 
bool isLocked (Lease::Type type, const asiolink::IOAddress &addr)
 Checks if a resource is owned by this handler. More...
 
bool tryLock (Lease::Type type, const asiolink::IOAddress &addr)
 Tries to acquires a resource. More...
 
void unLock (Lease::Type type, const asiolink::IOAddress &addr)
 Releases a resource. More...
 

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::Lease::TYPE_V4.

◆ 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::Lease::TYPE_V4.

Referenced by isc::dhcp::AllocEngine::getValidLft(), isc::lease_cmds::LeaseCmdsImpl::lease4UpdateHandler(), and isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler().

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


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