kea-custom-hooks
FeM custom hooks libraries for Kea DHCP
LocalDBClient.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string_view>
5#include <vector>
6
7#include <asiolink/io_address.h>
8#include <dhcp/hwaddr.h>
9
10#include "AdminDBClient.hpp"
11
12namespace ahri
13{
14struct LocalDBClientPrivate;
22{
23public:
32 constexpr static int DHCP_IDENTIFIER_TYPE_MAC{0};
33
34 LocalDBClient(std::string_view host, std::string_view port, std::string_view username,
35 std::string_view password, std::string_view database);
36 LocalDBClient(const LocalDBClient&) = delete;
38
42 void apply_host_update(const AdminDBClient::HostUpdate& host_update);
49 void apply_host_updates(const std::vector<AdminDBClient::HostUpdate>& host_updates);
50
59 std::vector<AdminDBClient::HostUpdate>
60 compare_full_sync(const std::vector<AdminDBClient::HostUpdate>& full_sync);
61
67 std::vector<AdminDBClient::HostUpdate> query_host_reservation(const isc::dhcp::HWAddr& mac);
68
74 std::vector<AdminDBClient::HostUpdate>
75 query_host_reservation(const isc::asiolink::IOAddress& ip_addr);
76
77private:
78 std::unique_ptr<LocalDBClientPrivate> p_impl;
79};
80} // namespace ahri
Interface to the local Kea database.
LocalDBClient(const LocalDBClient &)=delete
LocalDBClient(std::string_view host, std::string_view port, std::string_view username, std::string_view password, std::string_view database)
void apply_host_updates(const std::vector< AdminDBClient::HostUpdate > &host_updates)
Apply a bunch of host updates to the local Kea database.
std::vector< AdminDBClient::HostUpdate > compare_full_sync(const std::vector< AdminDBClient::HostUpdate > &full_sync)
Compare the current database state to the result of a full sync from AdminDB.
static constexpr int DHCP_IDENTIFIER_TYPE_MAC
Kea DHCP identifier type MAC-adresss.
void apply_host_update(const AdminDBClient::HostUpdate &host_update)
Apply a host update to the local Kea database.
std::vector< AdminDBClient::HostUpdate > query_host_reservation(const isc::dhcp::HWAddr &mac)
Query the database for host reservations with the given MAC.