Skip to content

Commit d29fbd9

Browse files
author
Razvan Becheriu
committed
[#3710] renamed BackendStore to LegalLogMgr
1 parent d3685c0 commit d29fbd9

38 files changed

+841
-839
lines changed

doc/sphinx/debug-messages.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ Messages printed on debuglevel 40
234234
- DHCPSRV_CFGMGR_UPDATE_SUBNET4
235235
- DHCPSRV_CFGMGR_UPDATE_SUBNET6
236236
- DHCPSRV_CLOSE_DB
237+
- DHCPSRV_FORENSIC_BACKEND_DEREGISTER
238+
- DHCPSRV_FORENSIC_BACKEND_REGISTER
237239
- DHCPSRV_HOOK_LEASE4_RECOVER_SKIP
238240
- DHCPSRV_HOOK_LEASE4_RENEW_SKIP
239241
- DHCPSRV_HOOK_LEASE4_SELECT_SKIP

src/bin/dhcp4/dhcp4_srv.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include <dhcp_ddns/ncr_io.h>
4545
#include <dhcp_ddns/ncr_msg.h>
4646
#include <dhcpsrv/alloc_engine.h>
47-
#include <dhcpsrv/backend_store_factory.h>
47+
#include <dhcpsrv/legal_log_mgr_factory.h>
4848
#include <dhcpsrv/callout_handle_store.h>
4949
#include <dhcpsrv/cb_ctl_dhcp4.h>
5050
#include <dhcpsrv/cfg_expiration.h>
@@ -5131,7 +5131,7 @@ Dhcpv4Srv::getVersion(bool extended) {
51315131
tmp << endl << "- " << version;
51325132
}
51335133
}
5134-
info = BackendStoreFactory::getDBVersions();
5134+
info = LegalLogMgrFactory::getDBVersions();
51355135
if (info.size()) {
51365136
tmp << endl << "forensic backends:";
51375137
for (auto const& version : info) {

src/bin/dhcp4/json_config_parser.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <dhcp4/json_config_parser.h>
2222
#include <dhcp/libdhcp++.h>
2323
#include <dhcp/option_definition.h>
24-
#include <dhcpsrv/backend_store_factory.h>
24+
#include <dhcpsrv/legal_log_mgr_factory.h>
2525
#include <dhcpsrv/cb_ctl_dhcp4.h>
2626
#include <dhcpsrv/cfg_multi_threading.h>
2727
#include <dhcpsrv/cfg_option.h>
@@ -930,7 +930,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
930930
HostDataSourceFactory::logRegistered();
931931

932932
// Log the list of known backends.
933-
BackendStoreFactory::logRegistered();
933+
LegalLogMgrFactory::logRegistered();
934934

935935
// Log the list of known backends.
936936
ConfigBackendDHCPv4Mgr::instance().logRegistered();

src/bin/dhcp6/dhcp6_srv.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include <dhcp_ddns/ncr_io.h>
4242
#include <dhcp_ddns/ncr_msg.h>
4343
#include <dhcpsrv/alloc_engine.h>
44-
#include <dhcpsrv/backend_store_factory.h>
44+
#include <dhcpsrv/legal_log_mgr_factory.h>
4545
#include <dhcpsrv/callout_handle_store.h>
4646
#include <dhcpsrv/cb_ctl_dhcp6.h>
4747
#include <dhcpsrv/cfg_expiration.h>
@@ -5079,7 +5079,7 @@ Dhcpv6Srv::getVersion(bool extended) {
50795079
tmp << endl << "- " << version;
50805080
}
50815081
}
5082-
info = BackendStoreFactory::getDBVersions();
5082+
info = LegalLogMgrFactory::getDBVersions();
50835083
if (info.size()) {
50845084
tmp << endl << "forensic backends:";
50855085
for (auto const& version : info) {

src/bin/dhcp6/json_config_parser.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <dhcp6/json_config_parser.h>
2222
#include <dhcp/libdhcp++.h>
2323
#include <dhcp/iface_mgr.h>
24-
#include <dhcpsrv/backend_store_factory.h>
24+
#include <dhcpsrv/legal_log_mgr_factory.h>
2525
#include <dhcpsrv/cb_ctl_dhcp6.h>
2626
#include <dhcpsrv/cfg_multi_threading.h>
2727
#include <dhcpsrv/cfg_option.h>
@@ -1065,7 +1065,7 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
10651065
HostDataSourceFactory::logRegistered();
10661066

10671067
// Log the list of known backends.
1068-
BackendStoreFactory::logRegistered();
1068+
LegalLogMgrFactory::logRegistered();
10691069

10701070
// Log the list of known backends.
10711071
ConfigBackendDHCPv6Mgr::instance().logRegistered();

src/hooks/dhcp/forensic_log/command_callouts.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <hooks/hooks.h>
1919
#include <util/str.h>
2020
#include <legal_log_log.h>
21-
#include <dhcpsrv/backend_store_factory.h>
21+
#include <dhcpsrv/legal_log_mgr_factory.h>
2222
#include <subnets_user_context.h>
2323

2424
#include <sstream>
@@ -109,7 +109,7 @@ bool isPrefix(ConstElementPtr arguments) {
109109
///
110110
/// Looks for either a lease valid lifetime or expiry from which to
111111
/// generate the duration text using @ref
112-
/// isc::legal_log::BackendStore::genDurationString().
112+
/// isc::legal_log::LegalLogMgr::genDurationString().
113113
///
114114
/// @param handle CalloutHandle which provides access to context.
115115
/// @param os output stream to which the text is output
@@ -120,12 +120,12 @@ void addDuration(CalloutHandle& handle, ostringstream& os, ConstElementPtr& argu
120120
if (!getOptionalInt(arguments, "valid-lft", duration)) {
121121
int64_t expire = 0;
122122
if (getOptionalInt(arguments, "expire", expire)) {
123-
duration = expire - BackendStoreFactory::instance(handle.getCurrentLibrary())->now().tv_sec;
123+
duration = expire - LegalLogMgrFactory::instance(handle.getCurrentLibrary())->now().tv_sec;
124124
}
125125
}
126126

127127
if (duration > 0) {
128-
os << " for " << BackendStore::genDurationString(duration);
128+
os << " for " << LegalLogMgr::genDurationString(duration);
129129
}
130130
}
131131

@@ -188,7 +188,7 @@ bool checkLoggingEnabledSubnet4(ConstElementPtr& arguments) {
188188
/// @param response The command response.
189189
int handleLease4Cmds(CalloutHandle& handle, string& name, ConstElementPtr& arguments,
190190
ConstElementPtr& /*response*/) {
191-
if (!BackendStoreFactory::instance(handle.getCurrentLibrary())) {
191+
if (!LegalLogMgrFactory::instance(handle.getCurrentLibrary())) {
192192
LOG_ERROR(legal_log_logger,
193193
LEGAL_LOG_COMMAND_NO_LEGAL_STORE);
194194
return (1);
@@ -224,7 +224,7 @@ int handleLease4Cmds(CalloutHandle& handle, string& name, ConstElementPtr& argum
224224
try {
225225
auto bin = ClientId::fromText(client_id)->getClientId();
226226
if (str::isPrintable(bin)) {
227-
os << " (" << BackendStore::vectorDump(bin) << ")";
227+
os << " (" << LegalLogMgr::vectorDump(bin) << ")";
228228
}
229229
} catch (...) {
230230
// Ignore any error
@@ -246,7 +246,7 @@ int handleLease4Cmds(CalloutHandle& handle, string& name, ConstElementPtr& argum
246246
}
247247
}
248248

249-
BackendStoreFactory::instance(handle.getCurrentLibrary())->writeln(os.str(), osa.str());
249+
LegalLogMgrFactory::instance(handle.getCurrentLibrary())->writeln(os.str(), osa.str());
250250
} catch (const exception& ex) {
251251
LOG_ERROR(legal_log_logger, LEGAL_LOG_COMMAND_WRITE_ERROR)
252252
.arg(ex.what());
@@ -289,7 +289,7 @@ bool checkLoggingEnabledSubnet6(ConstElementPtr& arguments) {
289289
/// @param response The command response.
290290
int handleLease6Cmds(CalloutHandle& handle, string& name, ConstElementPtr& arguments,
291291
ConstElementPtr& response) {
292-
if (!BackendStoreFactory::instance(handle.getCurrentLibrary())) {
292+
if (!LegalLogMgrFactory::instance(handle.getCurrentLibrary())) {
293293
LOG_ERROR(legal_log_logger,
294294
LEGAL_LOG_COMMAND_NO_LEGAL_STORE);
295295
return (1);
@@ -459,7 +459,7 @@ int handleLease6Cmds(CalloutHandle& handle, string& name, ConstElementPtr& argum
459459
return (status);
460460
}
461461

462-
BackendStoreFactory::instance(handle.getCurrentLibrary())->writeln(os.str(), osa.str());
462+
LegalLogMgrFactory::instance(handle.getCurrentLibrary())->writeln(os.str(), osa.str());
463463
} catch (const exception& ex) {
464464
LOG_ERROR(legal_log_logger, LEGAL_LOG_COMMAND_WRITE_ERROR)
465465
.arg(ex.what());
@@ -483,7 +483,7 @@ int handleLease6Cmds(CalloutHandle& handle, string& name, ConstElementPtr& argum
483483
///
484484
/// @return 0 upon success, non-zero otherwise.
485485
int command_processed(CalloutHandle& handle) {
486-
if (!BackendStoreFactory::instance(handle.getCurrentLibrary())) {
486+
if (!LegalLogMgrFactory::instance(handle.getCurrentLibrary())) {
487487
LOG_ERROR(legal_log_logger,
488488
LEGAL_LOG_COMMAND_NO_LEGAL_STORE);
489489
return (1);

src/hooks/dhcp/forensic_log/lease4_callouts.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <hooks/hooks.h>
1616
#include <util/str.h>
1717
#include <legal_log_log.h>
18-
#include <dhcpsrv/backend_store_factory.h>
18+
#include <dhcpsrv/legal_log_mgr_factory.h>
1919
#include <subnets_user_context.h>
2020

2121
#include <sstream>
@@ -39,13 +39,13 @@ bool getCustomEntry(CalloutHandle& handle, const Pkt4Ptr& query, const Pkt4Ptr&
3939
const Lease4Ptr& /*lease*/, std::string& value) {
4040
bool using_custom_format = false;
4141

42-
auto expression = BackendStoreFactory::instance(handle.getCurrentLibrary())->getRequestFormatExpression();
42+
auto expression = LegalLogMgrFactory::instance(handle.getCurrentLibrary())->getRequestFormatExpression();
4343
if (expression && query) {
4444
value = evaluateString(*expression, *query);
4545
using_custom_format = true;
4646
}
4747

48-
expression = BackendStoreFactory::instance(handle.getCurrentLibrary())->getResponseFormatExpression();
48+
expression = LegalLogMgrFactory::instance(handle.getCurrentLibrary())->getResponseFormatExpression();
4949
if (expression && response) {
5050
value += evaluateString(*expression, *response);
5151
using_custom_format = true;
@@ -109,7 +109,7 @@ std::string genLease4Entry(CalloutHandle& handle,
109109

110110
if (action != Action::RELEASE) {
111111
// <duration>
112-
stream << " for " << BackendStore::genDurationString(lease->valid_lft_) << " to";
112+
stream << " for " << LegalLogMgr::genDurationString(lease->valid_lft_) << " to";
113113
} else {
114114
stream << " from";
115115
}
@@ -125,7 +125,7 @@ std::string genLease4Entry(CalloutHandle& handle,
125125
auto bin = lease->client_id_->getClientId();
126126

127127
if (str::isPrintable(bin)) {
128-
stream << " (" << BackendStore::vectorDump(bin) << ")";
128+
stream << " (" << LegalLogMgr::vectorDump(bin) << ")";
129129
}
130130
}
131131

@@ -143,10 +143,10 @@ std::string genLease4Entry(CalloutHandle& handle,
143143
if (opt) {
144144
const OptionBuffer& id = opt->getData();
145145
if (!id.empty()) {
146-
idstream << "circuit-id: " << BackendStore::vectorHexDump(id);
146+
idstream << "circuit-id: " << LegalLogMgr::vectorHexDump(id);
147147

148148
if (str::isPrintable(id)) {
149-
idstream << " (" << BackendStore::vectorDump(id) << ")";
149+
idstream << " (" << LegalLogMgr::vectorDump(id) << ")";
150150
}
151151
}
152152
}
@@ -160,10 +160,10 @@ std::string genLease4Entry(CalloutHandle& handle,
160160
idstream << " and ";
161161
}
162162

163-
idstream << "remote-id: " << BackendStore::vectorHexDump(id);
163+
idstream << "remote-id: " << LegalLogMgr::vectorHexDump(id);
164164

165165
if (str::isPrintable(id)) {
166-
idstream << " (" << BackendStore::vectorDump(id) << ")";
166+
idstream << " (" << LegalLogMgr::vectorDump(id) << ")";
167167
}
168168
}
169169
}
@@ -177,10 +177,10 @@ std::string genLease4Entry(CalloutHandle& handle,
177177
idstream << " and ";
178178
}
179179

180-
idstream << "subscriber-id: " << BackendStore::vectorHexDump(id);
180+
idstream << "subscriber-id: " << LegalLogMgr::vectorHexDump(id);
181181

182182
if (str::isPrintable(id)) {
183-
idstream << " (" << BackendStore::vectorDump(id) << ")";
183+
idstream << " (" << LegalLogMgr::vectorDump(id) << ")";
184184
}
185185
}
186186
}
@@ -217,7 +217,7 @@ std::string genLease4Entry(CalloutHandle& handle,
217217
///
218218
/// @return returns 0 upon success, non-zero otherwise
219219
int legalLog4Handler(CalloutHandle& handle, const Action& action) {
220-
if (!BackendStoreFactory::instance(handle.getCurrentLibrary())) {
220+
if (!LegalLogMgrFactory::instance(handle.getCurrentLibrary())) {
221221
LOG_ERROR(legal_log_logger,
222222
LEGAL_LOG_LEASE4_NO_LEGAL_STORE);
223223
return (1);
@@ -242,7 +242,7 @@ int legalLog4Handler(CalloutHandle& handle, const Action& action) {
242242
ConstSubnet4Ptr subnet = cfg->getBySubnetId(lease->subnet_id_);
243243

244244
if (!isLoggingDisabled(subnet)) {
245-
BackendStoreFactory::instance(handle.getCurrentLibrary())->writeln(genLease4Entry(handle, query, response,
245+
LegalLogMgrFactory::instance(handle.getCurrentLibrary())->writeln(genLease4Entry(handle, query, response,
246246
lease, action),
247247
lease->addr_.toText());
248248
}

src/hooks/dhcp/forensic_log/lease6_callouts.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <hooks/hooks.h>
2121
#include <util/str.h>
2222
#include <legal_log_log.h>
23-
#include <dhcpsrv/backend_store_factory.h>
23+
#include <dhcpsrv/legal_log_mgr_factory.h>
2424
#include <subnets_user_context.h>
2525

2626
#include <sstream>
@@ -484,15 +484,15 @@ bool getCustomEntry(CalloutHandle& handle, const Pkt6Ptr& query, const Pkt6Ptr&
484484
const Lease6Ptr& lease, std::string& value) {
485485
bool using_custom_format = false;
486486

487-
auto expression = BackendStoreFactory::instance(handle.getCurrentLibrary())->getRequestFormatExpression();
487+
auto expression = LegalLogMgrFactory::instance(handle.getCurrentLibrary())->getRequestFormatExpression();
488488
if (expression && query) {
489489
replaceTokensForLease(expression, lease);
490490

491491
value = evaluateString(*expression, *query);
492492
using_custom_format = true;
493493
}
494494

495-
expression = BackendStoreFactory::instance(handle.getCurrentLibrary())->getResponseFormatExpression();
495+
expression = LegalLogMgrFactory::instance(handle.getCurrentLibrary())->getResponseFormatExpression();
496496
if (expression && response) {
497497
replaceTokensForLease(expression, lease);
498498

@@ -563,7 +563,7 @@ std::string genLease6Entry(CalloutHandle& handle,
563563

564564
if (action != Action::RELEASE) {
565565
// <duration>
566-
stream << " for " << BackendStore::genDurationString(lease->valid_lft_) << " to";
566+
stream << " for " << LegalLogMgr::genDurationString(lease->valid_lft_) << " to";
567567
} else {
568568
stream << " from";
569569
}
@@ -590,10 +590,10 @@ std::string genLease6Entry(CalloutHandle& handle,
590590
if (opt) {
591591
const OptionBuffer id = opt->getData();
592592
if (!id.empty()) {
593-
idstream << "remote-id: " << BackendStore::vectorHexDump(id);
593+
idstream << "remote-id: " << LegalLogMgr::vectorHexDump(id);
594594

595595
if (str::isPrintable(id)) {
596-
idstream << " (" << BackendStore::vectorDump(id) << ")";
596+
idstream << " (" << LegalLogMgr::vectorDump(id) << ")";
597597
}
598598
}
599599
}
@@ -608,10 +608,10 @@ std::string genLease6Entry(CalloutHandle& handle,
608608
idstream << " and ";
609609
}
610610

611-
idstream << "subscriber-id: " << BackendStore::vectorHexDump(id);
611+
idstream << "subscriber-id: " << LegalLogMgr::vectorHexDump(id);
612612

613613
if (str::isPrintable(id)) {
614-
idstream << " (" << BackendStore::vectorDump(id) << ")";
614+
idstream << " (" << LegalLogMgr::vectorDump(id) << ")";
615615
}
616616
}
617617
}
@@ -631,10 +631,10 @@ std::string genLease6Entry(CalloutHandle& handle,
631631
idstream << " and ";
632632
}
633633

634-
location << "interface-id: " << BackendStore::vectorHexDump(id);
634+
location << "interface-id: " << LegalLogMgr::vectorHexDump(id);
635635

636636
if (str::isPrintable(id)) {
637-
location << " (" << BackendStore::vectorDump(id) << ")";
637+
location << " (" << LegalLogMgr::vectorDump(id) << ")";
638638
}
639639
}
640640
}
@@ -671,7 +671,7 @@ std::string genLease6Entry(CalloutHandle& handle,
671671
///
672672
/// @return returns 0 upon success, non-zero otherwise
673673
int legalLog6Handler(CalloutHandle& handle, const Action& action) {
674-
if (!BackendStoreFactory::instance(handle.getCurrentLibrary())) {
674+
if (!LegalLogMgrFactory::instance(handle.getCurrentLibrary())) {
675675
LOG_ERROR(legal_log_logger, LEGAL_LOG_LEASE6_NO_LEGAL_STORE);
676676
return (1);
677677
}
@@ -695,7 +695,7 @@ int legalLog6Handler(CalloutHandle& handle, const Action& action) {
695695
ConstSubnet6Ptr subnet = cfg->getBySubnetId(lease->subnet_id_);
696696

697697
if (!isLoggingDisabled(subnet)) {
698-
BackendStoreFactory::instance(handle.getCurrentLibrary())->writeln(genLease6Entry(handle, query, response,
698+
LegalLogMgrFactory::instance(handle.getCurrentLibrary())->writeln(genLease6Entry(handle, query, response,
699699
lease, action),
700700
genLease6Addr(lease));
701701
}

0 commit comments

Comments
 (0)