From 6af32934226bc5e0f69d988001a284288c1f22b9 Mon Sep 17 00:00:00 2001 From: Andreas Karlsson Date: Wed, 8 Jul 2026 13:07:51 +0200 Subject: [PATCH] Clean up newlines a bit Make the code a bit more consistent by removing duplicate empty lines which were isnerted here and there without a clear pattern plus add some extra newlines for consistency and readability. --- CMakeLists.txt | 1 - kmipclient/CHANGELOG.md | 1 - kmipclient/README.md | 1 - kmipclient/TODO.md | 2 -- kmipclient/include/kmipclient/KeyBase.hpp | 1 + kmipclient/include/kmipclient/Kmip.hpp | 4 ++++ kmipclient/include/kmipclient/KmipClient.hpp | 7 ++----- kmipclient/include/kmipclient/KmipClientPool.hpp | 3 +++ kmipclient/include/kmipclient/NetClient.hpp | 6 +++++- kmipclient/include/kmipclient/NetClientOpenSSL.hpp | 2 ++ kmipclient/src/IOUtils.cpp | 1 - kmipclient/src/KmipClient.cpp | 1 - kmipclient/src/PrivateKey.cpp | 1 - kmipclient/src/PublicKey.cpp | 1 - kmipclient/src/StringUtils.cpp | 4 ++-- kmipclient/src/SymmetricKey.cpp | 1 - kmipclient/src/X509Certificate.cpp | 1 - kmipclient/tests/KmipClientIntegrationTest.cpp | 2 -- kmipclient/tests/KmipClientPoolIntegrationTest.cpp | 1 - kmipcore/CMakeLists.txt | 1 - kmipcore/include/kmipcore/kmip_basics.hpp | 2 -- kmipcore/include/kmipcore/kmip_enums.hpp | 3 --- kmipcore/include/kmipcore/kmip_protocol.hpp | 2 +- kmipcore/include/kmipcore/kmip_requests.hpp | 3 --- kmipcore/include/kmipcore/kmip_responses.hpp | 1 - kmipcore/src/kmip_basics.cpp | 1 - kmipcore/src/kmip_protocol.cpp | 2 +- kmipcore/src/kmip_requests.cpp | 1 - kmipcore/tests/test_core.cpp | 4 ++++ 29 files changed, 25 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abe2177..3d54b3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,6 @@ if(WITH_ASAN) endif() endif() - add_subdirectory(kmipcore) add_subdirectory(kmipclient) diff --git a/kmipclient/CHANGELOG.md b/kmipclient/CHANGELOG.md index c112123..66c2e6c 100644 --- a/kmipclient/CHANGELOG.md +++ b/kmipclient/CHANGELOG.md @@ -14,4 +14,3 @@ Dec, 2025 Version 0.1.1 Apr, 2025 Version 0.1.0 Initial implementation of all functionality available in "kmippp" - diff --git a/kmipclient/README.md b/kmipclient/README.md index 2fcb6d2..aa8c1e8 100644 --- a/kmipclient/README.md +++ b/kmipclient/README.md @@ -839,4 +839,3 @@ connection parameters: ``` example_get_tls_verify ``` - diff --git a/kmipclient/TODO.md b/kmipclient/TODO.md index ad3a9d6..df0caf6 100644 --- a/kmipclient/TODO.md +++ b/kmipclient/TODO.md @@ -14,5 +14,3 @@ The list of things yet to be done 6. Version negotiation with the KMIP server (Default is 1.4) 7. Complete version 2.0 specification support in the scope of current functionality. 8. Additional security features like optional certificates verification, client authentication, etc. - - diff --git a/kmipclient/include/kmipclient/KeyBase.hpp b/kmipclient/include/kmipclient/KeyBase.hpp index 577ab06..6ec86f4 100644 --- a/kmipclient/include/kmipclient/KeyBase.hpp +++ b/kmipclient/include/kmipclient/KeyBase.hpp @@ -93,6 +93,7 @@ namespace kmipclient { /** @brief Build protocol-level representation from the client key object. */ [[nodiscard]] kmipcore::Key to_core_key() const; + /** @brief Build the corresponding client key subclass from protocol-level * data. */ [[nodiscard]] static std::unique_ptr diff --git a/kmipclient/include/kmipclient/Kmip.hpp b/kmipclient/include/kmipclient/Kmip.hpp index 7d5f846..ea02b13 100644 --- a/kmipclient/include/kmipclient/Kmip.hpp +++ b/kmipclient/include/kmipclient/Kmip.hpp @@ -7,6 +7,7 @@ #ifndef KMIP_HPP #define KMIP_HPP + #include "kmipclient/KmipClient.hpp" #include "kmipclient/NetClientOpenSSL.hpp" #include "kmipcore/kmip_protocol.hpp" @@ -14,6 +15,7 @@ #include namespace kmipclient { + /** * @brief Convenience wrapper that owns transport and client instances. * @@ -167,5 +169,7 @@ namespace kmipclient { /** @brief High-level KMIP protocol client bound to @ref m_net_client. */ KmipClient m_client; }; + } // namespace kmipclient + #endif // KMIP_HPP diff --git a/kmipclient/include/kmipclient/KmipClient.hpp b/kmipclient/include/kmipclient/KmipClient.hpp index fdb3cd6..35ddf9b 100644 --- a/kmipclient/include/kmipclient/KmipClient.hpp +++ b/kmipclient/include/kmipclient/KmipClient.hpp @@ -130,7 +130,6 @@ namespace kmipclient { const std::string &name, const std::string &group, const Secret &secret ) const; - /** * @brief Executes KMIP Create to generate a server-side AES key. * @param name Value of the KMIP "Name" attribute. @@ -209,7 +208,6 @@ namespace kmipclient { [[nodiscard]] std::vector op_locate_by_name(const std::string &name, object_type o_type) const; - /** * @brief Executes KMIP Locate using the object group filter. * @param group Group name to match. @@ -246,7 +244,6 @@ namespace kmipclient { std::optional *located_items = nullptr ) const; - /** * @brief Executes KMIP Revoke for a managed object. * @param id Unique identifier of the object to revoke. @@ -263,6 +260,7 @@ namespace kmipclient { const std::string &message, time_t occurrence_time ) const; + /** * @brief Executes KMIP Destroy for a managed object. * @param id Unique identifier of the object to destroy. @@ -305,7 +303,6 @@ namespace kmipclient { std::optional *located_items = nullptr ) const; - /** * @brief Executes KMIP Discover Versions to query supported protocol * versions. @@ -367,7 +364,6 @@ namespace kmipclient { return close_on_destroy_; } - private: NetClient *net_client = nullptr; std::shared_ptr net_client_owner_; @@ -381,4 +377,5 @@ namespace kmipclient { }; } // namespace kmipclient + #endif // KMIP_CLIENT_HPP diff --git a/kmipclient/include/kmipclient/KmipClientPool.hpp b/kmipclient/include/kmipclient/KmipClientPool.hpp index 4f8580f..3b2e8de 100644 --- a/kmipclient/include/kmipclient/KmipClientPool.hpp +++ b/kmipclient/include/kmipclient/KmipClientPool.hpp @@ -62,11 +62,13 @@ namespace kmipclient { public: // ---- Constants // ------------------------------------------------------------- + /** Default upper bound for simultaneously open KMIP connections. */ static constexpr size_t DEFAULT_MAX_CONNECTIONS = 16; // ---- Config // ---------------------------------------------------------------- + /** * @brief Connection and pooling settings used to construct @ref * KmipClientPool. @@ -95,6 +97,7 @@ namespace kmipclient { // ---- BorrowedClient // -------------------------------------------------------- + /** * RAII guard wrapping a single borrowed connection. * diff --git a/kmipclient/include/kmipclient/NetClient.hpp b/kmipclient/include/kmipclient/NetClient.hpp index e0edf8c..0fc4d66 100644 --- a/kmipclient/include/kmipclient/NetClient.hpp +++ b/kmipclient/include/kmipclient/NetClient.hpp @@ -14,6 +14,7 @@ #include namespace kmipclient { + /** * @brief Abstract transport interface used by @ref KmipClient. * @@ -68,12 +69,12 @@ namespace kmipclient { virtual NetClient &operator=(const NetClient &) = delete; NetClient(NetClient &&) = delete; virtual NetClient &operator=(NetClient &&) = delete; + /** * @brief Establishes network/TLS connection to the KMIP server. * Must honor @ref m_timeout_ms for connect + handshake phases. * @return true on successful connection establishment, false otherwise. */ - virtual bool connect() = 0; /** @brief Closes the connection and releases underlying resources. */ virtual void close() = 0; @@ -101,6 +102,7 @@ namespace kmipclient { * @return true when connected, false otherwise. */ [[nodiscard]] bool is_connected() const noexcept { return m_isConnected; } + /** * @brief Sends bytes over the established connection. * @param data Source buffer. @@ -125,5 +127,7 @@ namespace kmipclient { TlsVerificationOptions m_tls_verification{}; std::atomic m_isConnected{false}; }; + } // namespace kmipclient + #endif // KMIP_NET_CLIENT_HPP diff --git a/kmipclient/include/kmipclient/NetClientOpenSSL.hpp b/kmipclient/include/kmipclient/NetClientOpenSSL.hpp index 3bd7a12..e1eb3a3 100644 --- a/kmipclient/include/kmipclient/NetClientOpenSSL.hpp +++ b/kmipclient/include/kmipclient/NetClientOpenSSL.hpp @@ -20,6 +20,7 @@ void BIO_free_all(BIO *); } namespace kmipclient { + /** * @brief OpenSSL BIO-based implementation of @ref NetClient. */ @@ -96,6 +97,7 @@ namespace kmipclient { bool checkConnected(); }; + } // namespace kmipclient #endif // KMIPNETCLILENTOPENSSL_HPP diff --git a/kmipclient/src/IOUtils.cpp b/kmipclient/src/IOUtils.cpp index 948dbe3..ec4ffb3 100644 --- a/kmipclient/src/IOUtils.cpp +++ b/kmipclient/src/IOUtils.cpp @@ -118,7 +118,6 @@ namespace kmipclient { ) ); - return response; } diff --git a/kmipclient/src/KmipClient.cpp b/kmipclient/src/KmipClient.cpp index ecf8bf4..66cb17f 100644 --- a/kmipclient/src/KmipClient.cpp +++ b/kmipclient/src/KmipClient.cpp @@ -196,7 +196,6 @@ namespace kmipclient { .getUniqueIdentifier(); } - std::string KmipClient::op_create_aes_key( const std::string &name, const std::string &group, diff --git a/kmipclient/src/PrivateKey.cpp b/kmipclient/src/PrivateKey.cpp index c1558fe..86b35dc 100644 --- a/kmipclient/src/PrivateKey.cpp +++ b/kmipclient/src/PrivateKey.cpp @@ -9,7 +9,6 @@ namespace kmipclient { - std::unique_ptr PrivateKey::clone() const { return std::make_unique(*this); } diff --git a/kmipclient/src/PublicKey.cpp b/kmipclient/src/PublicKey.cpp index 918804e..30805ee 100644 --- a/kmipclient/src/PublicKey.cpp +++ b/kmipclient/src/PublicKey.cpp @@ -9,7 +9,6 @@ namespace kmipclient { - std::unique_ptr PublicKey::clone() const { return std::make_unique(*this); } diff --git a/kmipclient/src/StringUtils.cpp b/kmipclient/src/StringUtils.cpp index 007f2e5..b14de55 100644 --- a/kmipclient/src/StringUtils.cpp +++ b/kmipclient/src/StringUtils.cpp @@ -12,6 +12,7 @@ #include #include #include + namespace kmipclient { unsigned char char2int(const char input) { @@ -74,5 +75,4 @@ namespace kmipclient { return out; } - -} // namespace kmipclient \ No newline at end of file +} // namespace kmipclient diff --git a/kmipclient/src/SymmetricKey.cpp b/kmipclient/src/SymmetricKey.cpp index a5e01c8..14375e5 100644 --- a/kmipclient/src/SymmetricKey.cpp +++ b/kmipclient/src/SymmetricKey.cpp @@ -44,7 +44,6 @@ namespace kmipclient { } // anonymous namespace - std::unique_ptr SymmetricKey::clone() const { return std::make_unique(*this); } diff --git a/kmipclient/src/X509Certificate.cpp b/kmipclient/src/X509Certificate.cpp index e03f5ba..e72833e 100644 --- a/kmipclient/src/X509Certificate.cpp +++ b/kmipclient/src/X509Certificate.cpp @@ -9,7 +9,6 @@ namespace kmipclient { - std::unique_ptr X509Certificate::clone() const { return std::make_unique(*this); } diff --git a/kmipclient/tests/KmipClientIntegrationTest.cpp b/kmipclient/tests/KmipClientIntegrationTest.cpp index 01bee6a..90d4b31 100644 --- a/kmipclient/tests/KmipClientIntegrationTest.cpp +++ b/kmipclient/tests/KmipClientIntegrationTest.cpp @@ -27,10 +27,8 @@ using namespace kmipclient; - static std::string TESTING_NAME_PREFIX = "tests_"; - // Helper class to manage environment variables class KmipTestConfig { public: diff --git a/kmipclient/tests/KmipClientPoolIntegrationTest.cpp b/kmipclient/tests/KmipClientPoolIntegrationTest.cpp index f6cacfb..b67da58 100644 --- a/kmipclient/tests/KmipClientPoolIntegrationTest.cpp +++ b/kmipclient/tests/KmipClientPoolIntegrationTest.cpp @@ -289,7 +289,6 @@ TEST_F(KmipClientPoolIntegrationTest, PoolCreateAndGet) { } } - // ============================================================================ // Concurrent Operations Tests // ============================================================================ diff --git a/kmipcore/CMakeLists.txt b/kmipcore/CMakeLists.txt index 3747aff..da4f4f3 100644 --- a/kmipcore/CMakeLists.txt +++ b/kmipcore/CMakeLists.txt @@ -5,7 +5,6 @@ project(kmipcore LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) - file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "src/*.cpp") file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS "include/kmipcore/*.hpp") diff --git a/kmipcore/include/kmipcore/kmip_basics.hpp b/kmipcore/include/kmipcore/kmip_basics.hpp index 803ade9..0a0097b 100644 --- a/kmipcore/include/kmipcore/kmip_basics.hpp +++ b/kmipcore/include/kmipcore/kmip_basics.hpp @@ -17,7 +17,6 @@ #include #include - namespace kmipcore { // Forward declaration for SerializationBuffer @@ -201,7 +200,6 @@ namespace kmipcore { [[nodiscard]] uint32_t toInterval() const; }; - } // namespace kmipcore #endif /* KMIPCORE_KMIP_BASICS_HPP */ diff --git a/kmipcore/include/kmipcore/kmip_enums.hpp b/kmipcore/include/kmipcore/kmip_enums.hpp index 186b6f6..b3923c1 100644 --- a/kmipcore/include/kmipcore/kmip_enums.hpp +++ b/kmipcore/include/kmipcore/kmip_enums.hpp @@ -58,7 +58,6 @@ namespace kmipcore { /** Generic sentinel value representing unset enum/int fields. */ inline constexpr std::int32_t KMIP_UNSET = -1; - inline constexpr std::int32_t KMIP_OK = 0; inline constexpr std::int32_t KMIP_NOT_IMPLEMENTED = -1; inline constexpr std::int32_t KMIP_ERROR_BUFFER_FULL = -2; @@ -376,7 +375,6 @@ namespace kmipcore { KMIP_WRAPTYPE_AS_REGISTERED = 0x02 }; - enum class mask_generator : std::uint32_t { // KMIP 1.4 KMIP_MASKGEN_MGF1 = 0x01 @@ -2540,7 +2538,6 @@ namespace kmipcore { inline constexpr std::uint32_t KMIP_SECDATA_EXTENSIONS = static_cast(secret_data_type::KMIP_SECDATA_EXTENSIONS); - } // namespace kmipcore #endif // KMIPCORE_KMIP_ENUMS_HPP diff --git a/kmipcore/include/kmipcore/kmip_protocol.hpp b/kmipcore/include/kmipcore/kmip_protocol.hpp index 2c41011..563d791 100644 --- a/kmipcore/include/kmipcore/kmip_protocol.hpp +++ b/kmipcore/include/kmipcore/kmip_protocol.hpp @@ -15,6 +15,7 @@ #include #include #include + namespace kmipcore { /** @@ -314,7 +315,6 @@ namespace kmipcore { nextBatchItemId_ = 1; } - /** @brief Sets maximum response size hint in request header. */ void setMaxResponseSize(size_t size); /** @brief Returns maximum response size hint from request header. */ diff --git a/kmipcore/include/kmipcore/kmip_requests.hpp b/kmipcore/include/kmipcore/kmip_requests.hpp index 009eb52..751d70f 100644 --- a/kmipcore/include/kmipcore/kmip_requests.hpp +++ b/kmipcore/include/kmipcore/kmip_requests.hpp @@ -25,7 +25,6 @@ namespace kmipcore { // Construct one and pass it directly to RequestMessage::addBatchItem(). // --------------------------------------------------------------------------- - // --------------------------------------------------------------------------- // Template for simple requests that only carry a unique identifier. // --------------------------------------------------------------------------- @@ -58,7 +57,6 @@ namespace kmipcore { /** @brief Typed request alias for KMIP Get Attribute List operation. */ using GetAttributeListRequest = SimpleIdRequest; - /** @brief Request for KMIP Get Attributes operation. */ class GetAttributesRequest : public RequestBatchItem { public: @@ -201,7 +199,6 @@ namespace kmipcore { ); }; - } // namespace kmipcore #endif /* KMIPCORE_KMIP_REQUESTS_HPP */ diff --git a/kmipcore/include/kmipcore/kmip_responses.hpp b/kmipcore/include/kmipcore/kmip_responses.hpp index 69f71ac..d0b7c3a 100644 --- a/kmipcore/include/kmipcore/kmip_responses.hpp +++ b/kmipcore/include/kmipcore/kmip_responses.hpp @@ -299,7 +299,6 @@ namespace kmipcore { std::string clusterInfo_; }; - } // namespace kmipcore #endif /* KMIPCORE_KMIP_RESPONSES_HPP */ diff --git a/kmipcore/src/kmip_basics.cpp b/kmipcore/src/kmip_basics.cpp index 5f7095e..97296af 100644 --- a/kmipcore/src/kmip_basics.cpp +++ b/kmipcore/src/kmip_basics.cpp @@ -64,7 +64,6 @@ namespace kmipcore { } } - void Element::serialize(SerializationBuffer &buf) const { // Write Tag (3 bytes, big-endian) const auto raw_tag = static_cast(tag); diff --git a/kmipcore/src/kmip_protocol.cpp b/kmipcore/src/kmip_protocol.cpp index 31709d7..28f420a 100644 --- a/kmipcore/src/kmip_protocol.cpp +++ b/kmipcore/src/kmip_protocol.cpp @@ -15,6 +15,7 @@ #include #include #include + namespace kmipcore { namespace { @@ -286,7 +287,6 @@ namespace kmipcore { } } - void RequestMessage::setMaxResponseSize(size_t size) { if (size > static_cast(std::numeric_limits::max())) { throw KmipException( diff --git a/kmipcore/src/kmip_requests.cpp b/kmipcore/src/kmip_requests.cpp index b60c380..7a11aaa 100644 --- a/kmipcore/src/kmip_requests.cpp +++ b/kmipcore/src/kmip_requests.cpp @@ -861,5 +861,4 @@ namespace kmipcore { setRequestPayload(payload); } - } // namespace kmipcore diff --git a/kmipcore/tests/test_core.cpp b/kmipcore/tests/test_core.cpp index 2bd8fcf..bed15ad 100644 --- a/kmipcore/tests/test_core.cpp +++ b/kmipcore/tests/test_core.cpp @@ -13,7 +13,9 @@ #include #include #include + using namespace kmipcore; + void test_integer() { auto elem = Element::createInteger(tag::KMIP_TAG_ACTIVATION_DATE, 12345); SerializationBuffer buf_i; @@ -28,6 +30,7 @@ void test_integer() { assert(std::get(decoded->value).value == 12345); std::cout << "Integer test passed" << std::endl; } + void test_structure() { auto root = Element::createStructure(tag::KMIP_TAG_APPLICATION_DATA); auto child1 = Element::createInteger(tag::KMIP_TAG_APPLICATION_NAMESPACE, 10); @@ -680,6 +683,7 @@ void test_typed_response_batch_items() { std::cout << "Typed response batch item tests passed" << std::endl; } + void test_locate_payload() { LocateRequestPayload locReq; locReq.setMaximumItems(10);