Kea 2.5.9
lease_sync_filter.h
Go to the documentation of this file.
1// Copyright (C) 2023-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef HA_LEASE_SYNC_FILTER_H
8#define HA_LEASE_SYNC_FILTER_H
9
10#include <dhcpsrv/lease.h>
11#include <dhcpsrv/subnet.h>
12#include <ha_config.h>
13#include <ha_server_type.h>
14#include <string>
15#include <unordered_set>
16
17namespace isc {
18namespace ha {
19
53public:
54
59 LeaseSyncFilter(const HAServerType& server_type, const HAConfigPtr& config);
60
66 void apply();
67
76 bool shouldSync(const dhcp::LeasePtr& lease) const;
77
78private:
79
87 void conditionallyApplySubnetFilter(const dhcp::SubnetPtr& subnet);
88
90 HAServerType server_type_;
91
93 HAConfigPtr config_;
94
96 std::unordered_set<uint32_t> subnet_ids_;
97};
98
99
100} // end of namespace isc::ha
101} // end of namespace isc
102
103#endif // HA_LEASE_SYNC_FILTER_H
Checks if a lease fetched from the other server should be synchronized into the local lease database.
void apply()
Applies filtering rules based on the current server configuration.
bool shouldSync(const dhcp::LeasePtr &lease) const
Checks if the lease should be accepted or discarded.
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
Definition: subnet.h:449
boost::shared_ptr< Lease > LeasePtr
Pointer to the lease object.
Definition: lease.h:25
boost::shared_ptr< HAConfig > HAConfigPtr
Pointer to the High Availability configuration structure.
Definition: ha_config.h:37
HAServerType
Lists possible server types for which HA service is created.
Defines the logger used by the top-level component of kea-lfc.