Kea 2.7.5
|
Resource race avoidance RAII handler. More...
#include <resource_handler.h>
Public Member Functions | |
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. | |
Resource race avoidance RAII handler.
Definition at line 34 of file resource_handler.h.
isc::dhcp::ResourceHandler::ResourceHandler | ( | ) |
Constructor.
Definition at line 23 of file resource_handler.cc.
|
virtual |
bool isc::dhcp::ResourceHandler::isLocked | ( | Lease::Type | type, |
const asiolink::IOAddress & | addr ) |
Checks if a resource is owned by this handler.
type | Type of the resource, member of Lease::Type enum. |
addr | The address or prefix aka the resource. |
Definition at line 77 of file resource_handler.cc.
References isc::asiolink::IOAddress::toBytes().
Referenced by isc::dhcp::ResourceHandler4::isLocked4().
bool isc::dhcp::ResourceHandler::tryLock | ( | Lease::Type | type, |
const asiolink::IOAddress & | addr ) |
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
type | Type of the resource, member of Lease::Type enum. |
addr | The address or prefix aka the resource. |
Definition at line 64 of file resource_handler.cc.
Referenced by isc::dhcp::ResourceHandler4::tryLock4().
void isc::dhcp::ResourceHandler::unLock | ( | Lease::Type | type, |
const asiolink::IOAddress & | addr ) |
Releases a resource.
Remove the resource from the resource container.
type | Type of the resource, member of Lease::Type enum. |
addr | The address or prefix aka the resource. |
when | we do not own the resource. |
Definition at line 85 of file resource_handler.cc.
References isc_throw, isc::asiolink::IOAddress::toBytes(), isc::asiolink::IOAddress::toText(), and isc::dhcp::Lease::typeToText().
Referenced by isc::dhcp::ResourceHandler4::unLock4().