From: Marcin Siodelski Date: Mon, 21 Jan 2019 01:24:23 +0000 (+0100) Subject: [#396,!205] Extended DHCPv4 CB API with the call to fetch audit. X-Git-Tag: 429-Updated-StampedValue-to-support-reals_base~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a607dd8cffa5a25003490f73f859de12ecdb0e52;p=thirdparty%2Fkea.git [#396,!205] Extended DHCPv4 CB API with the call to fetch audit. --- diff --git a/src/lib/config_backend/constants.h b/src/lib/config_backend/constants.h index 95550b29ee..3feefc237e 100644 --- a/src/lib/config_backend/constants.h +++ b/src/lib/config_backend/constants.h @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2018-2019 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 @@ -56,6 +56,10 @@ constexpr unsigned long GLOBAL_PARAMETER_NAME_BUF_LENGTH = 128; constexpr unsigned long GLOBAL_PARAMETER_VALUE_BUF_LENGTH = 65536; +constexpr unsigned long AUDIT_ENTRY_OBJECT_TYPE_BUF_LENGTH = 256; + +constexpr unsigned long AUDIT_ENTRY_LOG_MESSAGE_BUF_LENGTH = 65536; + //*} } // end of namespace isc::cb diff --git a/src/lib/dhcpsrv/config_backend_dhcp4.h b/src/lib/dhcpsrv/config_backend_dhcp4.h index a0eef73d1d..fd6628d555 100644 --- a/src/lib/dhcpsrv/config_backend_dhcp4.h +++ b/src/lib/dhcpsrv/config_backend_dhcp4.h @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -170,6 +171,16 @@ public: getModifiedGlobalParameters4(const db::ServerSelector& selector, const boost::posix_time::ptime& modification_time) const = 0; + /// @brief Retrieves the most recent audit entries. + /// + /// @param selector Server selector. + /// @param modification_time Timestamp being a lower limit for the returned + /// result set, i.e. entries later than specified time are returned. + /// @return Collection of audit entries. + virtual db::AuditEntryCollection + getRecentAuditEntries4(const db::ServerSelector& server_selector, + const boost::posix_time::ptime& modification_time) const = 0; + /// @brief Creates or updates a subnet. /// /// @param server_selector Server selector. diff --git a/src/lib/dhcpsrv/config_backend_pool_dhcp4.cc b/src/lib/dhcpsrv/config_backend_pool_dhcp4.cc index 192c85cb3c..5b24b50041 100644 --- a/src/lib/dhcpsrv/config_backend_pool_dhcp4.cc +++ b/src/lib/dhcpsrv/config_backend_pool_dhcp4.cc @@ -189,6 +189,18 @@ getModifiedGlobalParameters4(const db::BackendSelector& backend_selector, return (parameters); } +AuditEntryCollection +ConfigBackendPoolDHCPv4:: +getRecentAuditEntries4(const db::BackendSelector& backend_selector, + const db::ServerSelector& server_selector, + const boost::posix_time::ptime& modification_time) const { + AuditEntryCollection audit_entries; + getMultiplePropertiesConst + (&ConfigBackendDHCPv4::getRecentAuditEntries4, backend_selector, + server_selector, audit_entries, modification_time); + return (audit_entries); +} + void ConfigBackendPoolDHCPv4::createUpdateSubnet4(const BackendSelector& backend_selector, const ServerSelector& server_selector, diff --git a/src/lib/dhcpsrv/config_backend_pool_dhcp4.h b/src/lib/dhcpsrv/config_backend_pool_dhcp4.h index 8bedb4f3fa..6227602780 100644 --- a/src/lib/dhcpsrv/config_backend_pool_dhcp4.h +++ b/src/lib/dhcpsrv/config_backend_pool_dhcp4.h @@ -204,6 +204,18 @@ public: const db::ServerSelector& server_selector, const boost::posix_time::ptime& modification_time) const; + /// @brief Retrieves the most recent audit entries. + /// + /// @param backend_selector Backend selector. + /// @param server_selector Server selector. + /// @param modification_time Timestamp being a lower limit for the returned + /// result set, i.e. entries later than specified time are returned. + /// @return Collection of audit entries. + virtual db::AuditEntryCollection + getRecentAuditEntries4(const db::BackendSelector& backend_selector, + const db::ServerSelector& server_selector, + const boost::posix_time::ptime& modification_time) const; + /// @brief Creates or updates a subnet. /// /// @param backend_selector Backend selector. diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc index 212344830c..05610dff35 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc +++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2018-2019 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 @@ -10,6 +10,7 @@ #include using namespace isc::data; +using namespace isc::db; namespace isc { namespace dhcp { @@ -184,6 +185,12 @@ TestConfigBackendDHCPv4::getModifiedGlobalParameters4(const db::ServerSelector& return (globals); } +AuditEntryCollection +TestConfigBackendDHCPv4::getRecentAuditEntries4(const db::ServerSelector&, + const boost::posix_time::ptime&) const { + return (AuditEntryCollection()); +} + void TestConfigBackendDHCPv4::createUpdateSubnet4(const db::ServerSelector& /* server_selector */, const Subnet4Ptr& subnet) { diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h index bd2aba62dc..03aaa96afc 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h +++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2018-2019 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 @@ -195,6 +195,16 @@ public: getModifiedGlobalParameters4(const db::ServerSelector& server_selector, const boost::posix_time::ptime& modification_time) const; + /// @brief Retrieves the most recent audit entries. + /// + /// @param server_selector Server selector. + /// @param modification_time Timestamp being a lower limit for the returned + /// result set, i.e. entries later than specified time are returned. + /// @return Collection of audit entries. + virtual db::AuditEntryCollection + getRecentAuditEntries4(const db::ServerSelector& server_selector, + const boost::posix_time::ptime& modification_time) const; + /// @brief Creates or updates a subnet. /// /// @param server_selector Server selector.