]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#396,!205] Extended DHCPv4 CB API with the call to fetch audit.
authorMarcin Siodelski <marcin@isc.org>
Mon, 21 Jan 2019 01:24:23 +0000 (02:24 +0100)
committerMarcin Siodelski <marcin@isc.org>
Wed, 30 Jan 2019 09:18:59 +0000 (10:18 +0100)
src/lib/config_backend/constants.h
src/lib/dhcpsrv/config_backend_dhcp4.h
src/lib/dhcpsrv/config_backend_pool_dhcp4.cc
src/lib/dhcpsrv/config_backend_pool_dhcp4.h
src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc
src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h

index 95550b29eea08dfe34934fe7b024f256b4e5a7a1..3feefc237e0406f73b82a212f575533e0e7bd247 100644 (file)
@@ -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
index a0eef73d1d22beed15838abfd6efe32dd1322e25..fd6628d55580e5feea0f11bb5887d16218c63d80 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <cc/stamped_value.h>
 #include <config_backend/base_config_backend.h>
+#include <database/audit_entry.h>
 #include <database/server_selector.h>
 #include <dhcp/option.h>
 #include <dhcp/option_definition.h>
@@ -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.
index 192c85cb3c17be3ae1111a1a571e850c9fda2a87..5b24b5004179ed5c530cb7b2c9b133d3f7fd1601 100644 (file)
@@ -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<AuditEntryCollection, const boost::posix_time::ptime&>
+        (&ConfigBackendDHCPv4::getRecentAuditEntries4, backend_selector,
+         server_selector, audit_entries, modification_time);
+    return (audit_entries);
+}
+
 void
 ConfigBackendPoolDHCPv4::createUpdateSubnet4(const BackendSelector& backend_selector,
                                              const ServerSelector& server_selector,
index 8bedb4f3fab109287582c06ce22cd884e23e13f2..622760278054f20b81a2cb97c1bf8accfd19fe0b 100644 (file)
@@ -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.
index 212344830cc7f2f4d45714278d12cfce67008622..05610dff35e885501d67abc36276fdf5e818abbc 100644 (file)
@@ -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 <test_config_backend_dhcp4.h>
 
 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) {
index bd2aba62dce2e804a61ab6e7506410a57d5a539d..03aaa96afcbc54fd9b465b4b77a71172af6f18f7 100644 (file)
@@ -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.