1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265 | // Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Kea Hooks Basic
// Commercial End User License Agreement v2.0. See COPYING file in the premium/
// directory.
#include <config.h>
#include <exceptions/exceptions.h>
#include <dhcpsrv/cache_host_data_source.h>
#include <radius.h><--- Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <radius_backend.h><--- Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <radius_log.h><--- Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.
using namespace std;
using namespace isc;
using namespace isc::asiolink;
using namespace isc::dhcp;
namespace isc {
namespace radius {
RadiusBackend::RadiusBackend() : impl_(new RadiusBackendImpl()) {
}
RadiusBackend::~RadiusBackend() {
}
ConstHostCollection
RadiusBackend::getAll(const Host::IdentifierType& /*identifier_type*/,
const uint8_t* /*identifier_begin*/,
const size_t /*identifier_len*/) const {
return (ConstHostCollection());
}
ConstHostCollection
RadiusBackend::getAll4(const isc::dhcp::SubnetID& /*subnet_id*/) const {
return (ConstHostCollection());
}
ConstHostCollection
RadiusBackend::getAll6(const isc::dhcp::SubnetID& /*subnet_id*/) const {
return (ConstHostCollection());
}
ConstHostCollection
RadiusBackend::getAllbyHostname(const std::string& /*hostname*/) const {
return (ConstHostCollection());
}
ConstHostCollection
RadiusBackend::getAllbyHostname4(const std::string& /*hostname*/,
const dhcp::SubnetID& /*subnet_id*/) const {
return (ConstHostCollection());
}
ConstHostCollection
RadiusBackend::getAllbyHostname6(const std::string& /*hostname*/,
const dhcp::SubnetID& /*subnet_id*/) const {
return (ConstHostCollection());
}
isc::dhcp::ConstHostCollection
RadiusBackend::getPage4(const isc::dhcp::SubnetID& /*subnet_id*/,
size_t& /*source_index*/,
uint64_t /*lower_host_id*/,
const dhcp::HostPageSize& /*page_size*/) const {
return (ConstHostCollection());
}
isc::dhcp::ConstHostCollection
RadiusBackend::getPage6(const isc::dhcp::SubnetID& /*subnet_id*/,
size_t& /*source_index*/,
uint64_t /*lower_host_id*/,
const dhcp::HostPageSize& /*page_size*/) const {
return (ConstHostCollection());
}
isc::dhcp::ConstHostCollection
RadiusBackend::getPage4(size_t& /*source_index*/,
uint64_t /*lower_host_id*/,
const dhcp::HostPageSize& /*page_size*/) const {
return (ConstHostCollection());
}
isc::dhcp::ConstHostCollection
RadiusBackend::getPage6(size_t& /*source_index*/,
uint64_t /*lower_host_id*/,
const dhcp::HostPageSize& /*page_size*/) const {
return (ConstHostCollection());
}
ConstHostCollection
RadiusBackend::getAll4(const isc::asiolink::IOAddress& /*address*/) const {
return (ConstHostCollection());
}
ConstHostPtr
RadiusBackend::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 {
return (impl_->get4(subnet_id, identifier_type, identifier_begin,
identifier_len));
}
ConstHostPtr
RadiusBackend::get4(const isc::dhcp::SubnetID& /*subnet_id*/,
const isc::asiolink::IOAddress& /*address*/) const {
return (ConstHostPtr());
}
ConstHostCollection
RadiusBackend::getAll4(const isc::dhcp::SubnetID /*subnet_id*/&,
const isc::asiolink::IOAddress& /*address*/) const {
return (ConstHostCollection());
}
ConstHostPtr
RadiusBackend::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 {
return (impl_->get6(subnet_id, identifier_type, identifier_begin,
identifier_len));
}
ConstHostPtr
RadiusBackend::get6(const isc::asiolink::IOAddress& /*prefix*/,
const uint8_t /*prefix_len*/) const {
return (ConstHostPtr());
}
ConstHostPtr
RadiusBackend::get6(const isc::dhcp::SubnetID& /*subnet_id*/,
const isc::asiolink::IOAddress& /*address*/) const {
return (ConstHostPtr());
}
ConstHostCollection
RadiusBackend::getAll6(const isc::dhcp::SubnetID& /*subnet_id*/,
const isc::asiolink::IOAddress& /*address*/) const {
return (ConstHostCollection());
}
ConstHostCollection
RadiusBackend::getAll6(const isc::asiolink::IOAddress& /*address*/) const {
return (ConstHostCollection());
}
void
RadiusBackend::add(const HostPtr& /*host*/) {
}
bool
RadiusBackend::del(const SubnetID& /*subnet_id*/,
const IOAddress& /*address */) {
return (false);
}
bool
RadiusBackend::del4(const SubnetID& /*subnet_id*/,
const Host::IdentifierType& /*identifier_type*/,
const uint8_t* /*identifier_begin*/,
const size_t /*identifier_len*/) {
return (false);
}
bool
RadiusBackend::del6(const SubnetID& /*subnet_id*/,
const Host::IdentifierType& /*identifier_type*/,
const uint8_t* /*identifier_begin*/,
const size_t /*identifier_len*/) {
return (false);
}
bool
RadiusBackend::setIPReservationsUnique(const bool unique) {
// This backend does not support the mode in which multiple reservations
// for the same IP address are created. If selecting this mode is
// attempted this function returns false to indicate that this is
// not allowed.
return (unique);
}
size_t
RadiusBackend::getUnexpected4() const {
return (impl_->xcount4_);
}
size_t
RadiusBackend::getUnexpected6() const {
return (impl_->xcount6_);
}
RadiusBackendImpl::RadiusBackendImpl() : xcount4_(0), xcount6_(0) {
}
RadiusBackendImpl::~RadiusBackendImpl() {
}
ConstHostPtr
RadiusBackendImpl::get4(const SubnetID& subnet_id,
const Host::IdentifierType& identifier_type,
const uint8_t* identifier_begin,
const size_t identifier_len) {
if (identifier_type != RadiusImpl::instance().id_type4_) {
// Not handle by us. Either it is used by host reservations
// in the configuration or it was left by accident (i.e. forgotten)
// in host-reservation-identifiers.
return (ConstHostPtr());
}
if (InHook::check()) {
// get4Any() was called for an entry not (yet) cached.
return (ConstHostPtr());
}
// Unexpected call.
++xcount4_;
ostringstream id;
for (unsigned i = 0; i < identifier_len; ++i) {
if (i > 0) {
id << ':';
}
id << hex << setfill('0') << setw(2) << identifier_begin[i];
}
LOG_DEBUG(radius_logger, RADIUS_DBG_TRACE, RADIUS_BACKEND_GET4)
.arg(subnet_id)
.arg(id.str())
.arg(Host::getIdentifierName(identifier_type));
return (ConstHostPtr());
}
ConstHostPtr
RadiusBackendImpl::get6(const SubnetID& subnet_id,
const Host::IdentifierType& identifier_type,
const uint8_t* identifier_begin,
const size_t identifier_len) {
if (identifier_type != RadiusImpl::instance().id_type6_) {
// Not handle by us. Either it is used by host reservations
// in the configuration or it was left by accident (i.e. forgotten)
// in host-reservation-identifiers.
return (ConstHostPtr());
}
if (InHook::check()) {
// get6Any() was called for an entry not (yet) cached.
return (ConstHostPtr());
}
// Unexpected call.
++xcount6_;
ostringstream id;
for (unsigned i = 0; i < identifier_len; ++i) {
if (i > 0) {
id << ':';
}
id << hex << setfill('0') << setw(2) << identifier_begin[i];
}
LOG_DEBUG(radius_logger, RADIUS_DBG_TRACE, RADIUS_BACKEND_GET6)
.arg(subnet_id)
.arg(id.str())
.arg(Host::getIdentifierName(identifier_type));
return (ConstHostPtr());
}
} // namespace radius
} // namespace isc
|