Kea 3.1.1
radius_backend.h
Go to the documentation of this file.
1// Copyright (C) 2020-2025 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 RADIUS_BACKEND_H
8#define RADIUS_BACKEND_H
9
11
12namespace isc {
13namespace radius {
14
16
24public:
25
28
30 virtual ~RadiusBackend();
31
35
43 getAll(const isc::dhcp::Host::IdentifierType& identifier_type,
44 const uint8_t* identifier_begin,
45 const size_t identifier_len) const override;
46
53 getAll4(const isc::dhcp::SubnetID& subnet_id) const override;
54
61 getAll6(const isc::dhcp::SubnetID& subnet_id) const override;
62
72 getAllbyHostname(const std::string& hostname) const override;
73
84 getAllbyHostname4(const std::string& hostname,
85 const isc::dhcp::SubnetID& subnet_id) const override;
86
97 getAllbyHostname6(const std::string& hostname,
98 const isc::dhcp::SubnetID& subnet_id) const override;
99
106 getPage4(const isc::dhcp::SubnetID& subnet_id,
107 size_t& source_index,
108 uint64_t lower_host_id,
109 const dhcp::HostPageSize& page_size) const override;
110
117 getPage6(const isc::dhcp::SubnetID& subnet_id,
118 size_t& source_index,
119 uint64_t lower_host_id,
120 const dhcp::HostPageSize& page_size) const override;
121
128 getPage4(size_t& source_index,
129 uint64_t lower_host_id,
130 const dhcp::HostPageSize& page_size) const override;
131
138 getPage6(size_t& source_index,
139 uint64_t lower_host_id,
140 const dhcp::HostPageSize& page_size) const override;
141
149 getAll4(const isc::asiolink::IOAddress& address) const override;
150
162 get4(const isc::dhcp::SubnetID& subnet_id,
163 const isc::dhcp::Host::IdentifierType& identifier_type,
164 const uint8_t* identifier_begin,
165 const size_t identifier_len) const override;
166
177 get4(const isc::dhcp::SubnetID& subnet_id,
178 const isc::asiolink::IOAddress& address) const override;
179
188 getAll4(const isc::dhcp::SubnetID& subnet_id,
189 const isc::asiolink::IOAddress& address) const override;
190
202 get6(const isc::dhcp::SubnetID& subnet_id,
203 const isc::dhcp::Host::IdentifierType& identifier_type,
204 const uint8_t* identifier_begin,
205 const size_t identifier_len) const override;
206
216 get6(const isc::asiolink::IOAddress& prefix,
217 const uint8_t prefix_len) const override;
218
229 get6(const isc::dhcp::SubnetID& subnet_id,
230 const isc::asiolink::IOAddress& address) const override;
231
240 getAll6(const isc::dhcp::SubnetID& subnet_id,
241 const isc::asiolink::IOAddress& address) const override;
242
252 getAll6(const isc::asiolink::IOAddress& address) const override;
253
268 virtual void add(const isc::dhcp::HostPtr& host) override;
269
277 virtual bool del(const isc::dhcp::SubnetID& subnet_id,
278 const isc::asiolink::IOAddress& addr) override;
279
290 virtual bool del4(const isc::dhcp::SubnetID& subnet_id,
291 const isc::dhcp::Host::IdentifierType& identifier_type,
292 const uint8_t* identifier_begin,
293 const size_t identifier_len) override;
294
305 virtual bool del6(const isc::dhcp::SubnetID& subnet_id,
306 const isc::dhcp::Host::IdentifierType& identifier_type,
307 const uint8_t* identifier_begin,
308 const size_t identifier_len) override;
309
315 virtual std::string getType() const override {
316 return ("radius");
317 }
318
335 virtual bool setIPReservationsUnique(const bool unique) override;
336
338 size_t getUnexpected4() const;
339
341 size_t getUnexpected6() const;
342
343protected:
345 boost::shared_ptr<RadiusBackendImpl> impl_;
346};
347
349typedef boost::shared_ptr<RadiusBackend> RadiusBackendPtr;
350
353public:
354
357
359 virtual ~RadiusBackendImpl();
360
362
374 get4(const isc::dhcp::SubnetID& subnet_id,
375 const isc::dhcp::Host::IdentifierType& identifier_type,
376 const uint8_t* identifier_begin,
377 const size_t identifier_len);
378
390 get6(const isc::dhcp::SubnetID& subnet_id,
391 const isc::dhcp::Host::IdentifierType& identifier_type,
392 const uint8_t* identifier_begin,
393 const size_t identifier_len);
394
396 size_t xcount4_;
397
399 size_t xcount6_;
400};
401
402} // end of namespace radius
403} // end of namespace isc
404
405#endif // RADIUS_BACKEND_H
Base interface for the classes implementing simple data source for host reservations.
Wraps value holding size of the page with host reservations.
IdentifierType
Type of the host identifier.
Definition host.h:337
Implementation of host backend for Radius.
size_t xcount4_
Unexpected call counter - IPv4.
size_t xcount6_
Unexpected call counter - IPv6.
isc::dhcp::ConstHostPtr get6(const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Returns a host connected to the IPv6 subnet.
isc::dhcp::ConstHostPtr get4(const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
Host backend method in not const variant.
virtual ~RadiusBackendImpl()
Destructor.
virtual ~RadiusBackend()
Destructor.
virtual isc::dhcp::ConstHostCollection getAllbyHostname4(const std::string &hostname, const isc::dhcp::SubnetID &subnet_id) const override
Return all hosts with a hostname in a DHCPv4 subnet.
virtual std::string getType() const override
Return backend type.
virtual isc::dhcp::ConstHostCollection getAllbyHostname6(const std::string &hostname, const isc::dhcp::SubnetID &subnet_id) const override
Return all hosts with a hostname in a DHCPv6 subnet.
virtual isc::dhcp::ConstHostCollection getAllbyHostname(const std::string &hostname) const override
Return all hosts with a hostname.
virtual isc::dhcp::ConstHostCollection getPage6(const isc::dhcp::SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const dhcp::HostPageSize &page_size) const override
Return range of hosts in a specified DHCPv6 subnet.
boost::shared_ptr< RadiusBackendImpl > impl_
Implementation.
virtual void add(const isc::dhcp::HostPtr &host) override
Adds a new host to the collection.
virtual bool del6(const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) override
Attempts to delete a host by (subnet-id6, identifier, identifier-type)
virtual isc::dhcp::ConstHostCollection getAll6(const isc::dhcp::SubnetID &subnet_id) const override
Return all hosts in a specified DHCPv6 subnet.
virtual isc::dhcp::ConstHostCollection getAll(const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const override
From base class.
virtual isc::dhcp::ConstHostPtr get4(const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const override
Returns a host connected to the IPv4 subnet.
size_t getUnexpected4() const
Return unexpected calls for IPv4.
virtual bool del4(const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) override
Attempts to delete a host by (subnet-id4, identifier, identifier-type)
virtual bool setIPReservationsUnique(const bool unique) override
Controls whether IP reservations are unique or non-unique.
virtual bool del(const isc::dhcp::SubnetID &subnet_id, const isc::asiolink::IOAddress &addr) override
Attempts to delete a host by (subnet-id, address)
virtual isc::dhcp::ConstHostPtr get6(const isc::dhcp::SubnetID &subnet_id, const isc::dhcp::Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const override
Returns a host connected to the IPv6 subnet.
virtual isc::dhcp::ConstHostCollection getAll4(const isc::dhcp::SubnetID &subnet_id) const override
Return all hosts in a specified DHCPv4 subnet.
virtual isc::dhcp::ConstHostCollection getPage4(const isc::dhcp::SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const dhcp::HostPageSize &page_size) const override
Return range of hosts in a specified DHCPv4 subnet.
size_t getUnexpected6() const
Return unexpected calls for IPv6.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
Definition host.h:837
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
Definition host.h:843
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition subnet_id.h:25
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
Definition host.h:840
boost::shared_ptr< RadiusBackend > RadiusBackendPtr
Pointer to host backend.
Defines the logger used by the top-level component of kea-lfc.