OpenVPN 3 Core Library
|
#include <pool.hpp>
Public Member Functions | |
PoolType ()=default | |
void | add_range (const RangeType< ADDR > &range) |
Adds range of addresses to pool (pool will own the addresses). | |
void | add_addr (const ADDR &addr) |
size_t | n_in_use () const noexcept |
Returns number of pool addresses currently in use. | |
size_t | n_free () const noexcept |
Returns number of free pool addresses. | |
bool | acquire_addr (ADDR &dest) |
bool | acquire_specific_addr (const ADDR &addr) |
Acquires a specific address from the pool. | |
void | release_addr (const ADDR &addr) |
virtual void | freelist_fill () |
std::string | to_string () const |
virtual | ~PoolType ()=default |
Private Member Functions | |
auto | is_address_available (const ADDR &addr) -> std::optional< decltype(map.begin())> |
Checks if address is available (free) | |
auto | is_address_in_use (const ADDR &addr) -> std::optional< decltype(map.begin())> |
Checks if address is in use. | |
Private Attributes | |
std::deque< ADDR > | freelist |
std::unordered_map< ADDR, bool > | map |
|
default |
|
virtualdefault |
|
inline |
|
inline |
Acquires a specific address from the pool.
This function attempts to acquire a specific address from the pool. If the address is available, it marks the address as in use and returns true. If the address is not available, it returns false.
addr | The IP address to acquire. |
Definition at line 108 of file pool.hpp.
|
inline |
|
inline |
|
inlinevirtual |
|
inlineprivate |
|
inlineprivate |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
private |
|
private |