summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc
blob: b24b404bb7051c62fd5ab0de03e363dbe865eace (plain)
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
// Copyright (C) 2023 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include <config.h>

#include <asiolink/io_address.h>
#include <concrete_lease_mgr.h>

using namespace isc::asiolink;
using namespace isc::db;
using namespace isc::dhcp;
using namespace std;

namespace isc {
namespace dhcp {
namespace test {

ConcreteLeaseMgr::ConcreteLeaseMgr(const DatabaseConnection::ParameterMap&)
    : TrackingLeaseMgr() {
}

ConcreteLeaseMgr::~ConcreteLeaseMgr() {
}

bool
ConcreteLeaseMgr::addLease(const Lease4Ptr&) {
    return (false);
}

bool
ConcreteLeaseMgr::addLease(const Lease6Ptr&) {
    return (false);
}

Lease4Ptr
ConcreteLeaseMgr::getLease4(const IOAddress&) const {
    return (Lease4Ptr());
}

Lease4Collection
ConcreteLeaseMgr::getLease4(const HWAddr&) const {
    return (Lease4Collection());
}

Lease4Ptr
ConcreteLeaseMgr::getLease4(const HWAddr&, SubnetID) const {
    return (Lease4Ptr());
}

Lease4Collection
ConcreteLeaseMgr::getLease4(const ClientId&) const {
    return (Lease4Collection());
}

Lease4Ptr
ConcreteLeaseMgr::getLease4(const ClientId&, SubnetID) const {
    return (Lease4Ptr());
}

Lease4Collection
ConcreteLeaseMgr::getLeases4(SubnetID) const {
    return (Lease4Collection());
}

Lease4Collection
ConcreteLeaseMgr::getLeases4(const std::string&) const {
    return (Lease4Collection());
}

Lease4Collection
ConcreteLeaseMgr::getLeases4() const {
    return (Lease4Collection());
}

Lease4Collection
ConcreteLeaseMgr::getLeases4(const IOAddress& /* lower_bound_address */,
                             const LeasePageSize& /* page_size */) const {
    return (Lease4Collection());
}

Lease6Ptr
ConcreteLeaseMgr::getLease6(Lease::Type /* not used yet */,
                            const IOAddress&) const {
    return (Lease6Ptr());
}

Lease6Collection
ConcreteLeaseMgr::getLeases6(Lease::Type /* not used yet */,
                             const DUID&, uint32_t) const {
    return (leases6_);
}

Lease6Collection
ConcreteLeaseMgr::getLeases6(Lease::Type /* not used yet */,
                             const DUID&, uint32_t, SubnetID) const {
    return (leases6_);
}

Lease6Collection
ConcreteLeaseMgr::getLeases6(const DUID&) const {
    return (leases6_);
}

Lease6Collection
ConcreteLeaseMgr::getLeases6(SubnetID) const {
    return (Lease6Collection());
}

Lease6Collection
ConcreteLeaseMgr::getLeases6(const std::string&) const {
    return (Lease6Collection());
}

Lease6Collection
ConcreteLeaseMgr::getLeases6() const {
    return (Lease6Collection());
}

Lease6Collection
ConcreteLeaseMgr::getLeases6(const IOAddress& /* lower_bound_address */,
                             const LeasePageSize& /* page_size */) const {
    return (Lease6Collection());
};

void
ConcreteLeaseMgr::getExpiredLeases6(Lease6Collection&, const size_t) const {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::getExpiredLeases6 is not"
              " implemented");
}

void
ConcreteLeaseMgr::getExpiredLeases4(Lease4Collection&, const size_t) const {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::getExpiredLeases4 is not"
              " implemented");
}

void
ConcreteLeaseMgr::updateLease4(const Lease4Ptr&) {}

void
ConcreteLeaseMgr::updateLease6(const Lease6Ptr&) {}

bool
ConcreteLeaseMgr::deleteLease(const Lease4Ptr&) {
    return (false);
}

bool
ConcreteLeaseMgr::deleteLease(const Lease6Ptr&) {
    return (false);
}

uint64_t
ConcreteLeaseMgr::deleteExpiredReclaimedLeases4(const uint32_t) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::deleteExpir§edReclaimedLeases4"
              " is not implemented");
}

uint64_t
ConcreteLeaseMgr::deleteExpiredReclaimedLeases6(const uint32_t) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::deleteExpiredReclaimedLeases6"
              " is not implemented");
}

size_t
ConcreteLeaseMgr::wipeLeases4(const SubnetID&) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::wipeLeases4 not implemented");
}

size_t
ConcreteLeaseMgr::wipeLeases6(const SubnetID&) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::wipeLeases6 not implemented");
}

std::string
ConcreteLeaseMgr::checkLimits4(isc::data::ConstElementPtr const& /* user_context */) const {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::checkLimits4() not implemented");
}

std::string
ConcreteLeaseMgr::checkLimits6(isc::data::ConstElementPtr const& /* user_context */) const {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::checkLimits6() not implemented");
}

bool
ConcreteLeaseMgr::isJsonSupported() const {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::isJsonSupported() not implemented");
}

size_t
ConcreteLeaseMgr::getClassLeaseCount(const ClientClass& /* client_class */,
                                     const Lease::Type& /* ltype = Lease::TYPE_V4 */) const {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::getClassLeaseCount() not implemented");
}

void
ConcreteLeaseMgr::recountClassLeases4() {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::recountClassLeases4() not implemented");
}

void
ConcreteLeaseMgr::recountClassLeases6() {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::recountClassLeases6() not implemented");
}

void
ConcreteLeaseMgr::clearClassLeaseCounts() {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::clearClassLeaseCounts() not implemented");
}

void
ConcreteLeaseMgr::deleteExtendedInfo6(const IOAddress& addr) {
    auto relay_id_it = relay_id6_.begin();
    while (relay_id_it != relay_id6_.end()) {
        if ((*relay_id_it)->lease_addr_ == addr) {
            relay_id_it = relay_id6_.erase(relay_id_it);
        } else {
            ++relay_id_it;
        }
    }
    auto remote_id_it = remote_id6_.begin();
    while (remote_id_it != remote_id6_.end()) {
        if ((*remote_id_it)->lease_addr_ == addr) {
            remote_id_it = remote_id6_.erase(remote_id_it);
        } else {
            ++remote_id_it;
        }
    }
}

void
ConcreteLeaseMgr::addRelayId6(const IOAddress& lease_addr,
                              const vector<uint8_t>& relay_id) {
    Lease6ExtendedInfoPtr ex_info;
    ex_info.reset(new Lease6ExtendedInfo(lease_addr, relay_id));
    relay_id6_.push_back(ex_info);
}

void
ConcreteLeaseMgr::addRemoteId6(const IOAddress& lease_addr,
                               const vector<uint8_t>& remote_id) {
    Lease6ExtendedInfoPtr ex_info;
    ex_info.reset(new Lease6ExtendedInfo(lease_addr, remote_id));
    remote_id6_.push_back(ex_info);
}

Lease4Collection
ConcreteLeaseMgr::getLeases4ByRelayId(const OptionBuffer& /* relay_id */,
                                      const IOAddress& /* lower_bound_address */,
                                      const LeasePageSize& /* page_size */,
                                      const time_t& /* qry_start_time = 0 */,
                                      const time_t& /* qry_end_time = 0 */) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases4ByRelayId not implemented");
}

Lease4Collection
ConcreteLeaseMgr::getLeases4ByRemoteId(const OptionBuffer& /* remote_id */,
                                       const IOAddress& /* lower_bound_address */,
                                       const LeasePageSize& /* page_size */,
                                       const time_t& /* qry_start_time = 0 */,
                                       const time_t& /* qry_end_time = 0 */) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases4ByRemoteId not implemented");
}

Lease6Collection
ConcreteLeaseMgr::getLeases6ByRelayId(const DUID& /* relay_id */,
                                      const IOAddress& /* link_addr */,
                                      uint8_t /* link_len */,
                                      const IOAddress& /* lower_bound_address */,
                                      const LeasePageSize& /* page_size */) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases6ByRelayId not implemented");
}

Lease6Collection
ConcreteLeaseMgr::getLeases6ByRemoteId(const OptionBuffer& /* remote_id */,
                                       const IOAddress& /* link_addr */,
                                       uint8_t /* link_len */,
                         const IOAddress& /* lower_bound_address */,
                                       const LeasePageSize& /* page_size*/) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases6ByRemoteId not implemented");
}

Lease6Collection
ConcreteLeaseMgr::getLeases6ByLink(const IOAddress& /* link_addr */,
                                   uint8_t /* link_len */,
                                   const IOAddress& /* lower_bound_address */,
                                   const LeasePageSize& /* page_size */) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases6ByLink not implemented");
}

size_t
ConcreteLeaseMgr::upgradeExtendedInfo4(const LeasePageSize& /* page_size */) {
    return (0);
}

size_t
ConcreteLeaseMgr::buildExtendedInfoTables6(bool /* update */,
                                           bool /* current */) {
    isc_throw(isc::NotImplemented, "ConcreteLeaseMgr:buildExtendedInfoTables6 not implemented");
}

void
ConcreteLeaseMgr::writeLeases4(const std::string&) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::writeLeases4() not implemented");
}

void
ConcreteLeaseMgr::writeLeases6(const std::string&) {
    isc_throw(NotImplemented, "ConcreteLeaseMgr::writeLeases6() not implemented");
}

std::string
ConcreteLeaseMgr::getType() const {
    return (std::string("concrete"));
}

std::string
ConcreteLeaseMgr::getName() const {
    return (std::string("concrete"));
}

std::string
ConcreteLeaseMgr::getDescription() const {
    return (std::string("This is a dummy concrete backend implementation."));
}

std::pair<uint32_t, uint32_t>
ConcreteLeaseMgr::getVersion() const {
    return (make_pair(uint32_t(0), uint32_t(0)));
}

void
ConcreteLeaseMgr::commit() {
}

void
ConcreteLeaseMgr::rollback() {
}

} // end of namespace isc::dhcp::test
} // end of namespace isc::dhcp
} // end of namespace isc