kea-custom-hooks
FeM custom hooks libraries for Kea DHCP
callout.cpp
Go to the documentation of this file.
1#include <chrono>
2
3#include <dhcp/dhcp4.h>
4#include <dhcpsrv/lease.h>
5
6#include "Exporter.hpp"
7#include "callout.hpp"
8#include "common.hpp"
9
10extern "C" {
11int lease4_select(isc::hooks::CalloutHandle& handle)
12{
13 isc::dhcp::Lease4Ptr lease4;
14 handle.getArgument("lease4", lease4);
15
16 arpwatch::exporter->push_lease(*lease4->hwaddr_, lease4->addr_, lease4->subnet_id_,
17 std::chrono::seconds{lease4->valid_lft_});
18
19 return 0;
20}
21
22int lease4_renew(isc::hooks::CalloutHandle& handle)
23{
24 isc::dhcp::Lease4Ptr lease4;
25 handle.getArgument("lease4", lease4);
26
27 arpwatch::exporter->push_lease(*lease4->hwaddr_, lease4->addr_, lease4->subnet_id_,
28 std::chrono::seconds{lease4->valid_lft_});
29
30 return 0;
31}
32}
int lease4_select(isc::hooks::CalloutHandle &handle)
Definition: callout.cpp:11
int lease4_renew(isc::hooks::CalloutHandle &handle)
Definition: callout.cpp:22
Declarations for all ahri-related Kea callout handlers.
Common forward declaration for classes and variables.
std::unique_ptr< arpwatch::Exporter > exporter
Definition: init.cpp:26