kea-custom-hooks
FeM custom hooks libraries for Kea DHCP
|
Main lease-to-Redis/ARPwatch exporter. More...
#include <Exporter.hpp>
Public Types | |
using | mac_addr_t = isc::dhcp::HWAddr |
using | ip4_addr_t = isc::asiolink::IOAddress |
using | subnet_id_t = isc::dhcp::SubnetID |
using | lease4_t = std::tuple< mac_addr_t, ip4_addr_t, subnet_id_t, std::chrono::seconds > |
Public Member Functions | |
Exporter (HiredisAdapter &redis_adapter, ArpwatchRPC &arpwatch_rpc) | |
Exporter (const Exporter &)=delete | |
Exporter & | operator= (const Exporter &)=delete |
Exporter (Exporter &&)=delete | |
Exporter & | operator= (Exporter &&)=delete |
~Exporter () | |
Worker thread control | |
void | start_worker () |
void | stop_worker () |
Lease queue actions | |
void | push_lease (const mac_addr_t &mac, const ip4_addr_t &ip4, subnet_id_t subnet_id=0, std::chrono::seconds valid_lft=DEFAULT_VALID_LFT) |
void | flush_lease_queue () |
Static Public Attributes | |
static constexpr std::chrono::seconds | REDIS_RECONNECT_WAIT {5} |
static constexpr std::chrono::seconds | DEFAULT_VALID_LFT {600} |
static constexpr double | REDIS_EXPIRE_FACT = 1.5F |
static constexpr std::chrono::milliseconds | LEASE_QUEUE_FLUSH_WAIT {10} |
Main lease-to-Redis/ARPwatch exporter.
This class is the main exporter. It exports all leases provided to it by push_lease()
to the Redis and ARPwatch servers accessible by the provided HiredisAdapter
and ArpwatchRPC
interface.
Assigned leases are queued internally, while a worker thread waits for new leases to arrive and then exports all leases sequentially.
Exported leases are automatically assigned and expire time in Redis, which is currently hard-coded in the class's member variables.
Definition at line 35 of file Exporter.hpp.
using arpwatch::Exporter::ip4_addr_t = isc::asiolink::IOAddress |
Definition at line 39 of file Exporter.hpp.
using arpwatch::Exporter::lease4_t = std::tuple<mac_addr_t, ip4_addr_t, subnet_id_t, std::chrono::seconds> |
Definition at line 41 of file Exporter.hpp.
using arpwatch::Exporter::mac_addr_t = isc::dhcp::HWAddr |
Definition at line 38 of file Exporter.hpp.
using arpwatch::Exporter::subnet_id_t = isc::dhcp::SubnetID |
Definition at line 40 of file Exporter.hpp.
|
inlineexplicit |
Definition at line 48 of file Exporter.hpp.
|
delete |
|
delete |
arpwatch::Exporter::~Exporter | ( | ) |
Definition at line 37 of file Exporter.cpp.
void arpwatch::Exporter::flush_lease_queue | ( | ) |
Definition at line 74 of file Exporter.cpp.
void arpwatch::Exporter::push_lease | ( | const mac_addr_t & | mac, |
const ip4_addr_t & | ip4, | ||
const Exporter::subnet_id_t | subnet_id = 0 , |
||
std::chrono::seconds | valid_lft = DEFAULT_VALID_LFT |
||
) |
Definition at line 61 of file Exporter.cpp.
void arpwatch::Exporter::start_worker | ( | ) |
Definition at line 44 of file Exporter.cpp.
void arpwatch::Exporter::stop_worker | ( | ) |
Definition at line 51 of file Exporter.cpp.
|
staticconstexpr |
Definition at line 44 of file Exporter.hpp.
|
staticconstexpr |
Definition at line 46 of file Exporter.hpp.
|
staticconstexpr |
Definition at line 45 of file Exporter.hpp.
|
staticconstexpr |
Definition at line 43 of file Exporter.hpp.