PS-10068 Adding new KMIP C++ library and making it production ready#24
PS-10068 Adding new KMIP C++ library and making it production ready#24lukin-oleksiy wants to merge 11 commits intoPercona-Lab:masterfrom
Conversation
a9df1b9 to
103e598
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new “modern” KMIP stack by adding the kmipcore C++ protocol/TTLV layer and the kmipclient C++20 high-level client layer, intended to replace the legacy libkmip + kmippp stack.
Changes:
- Added
kmipcorelibrary (TTLV model, serialization buffer, request/response/payload types, parsers, logging/formatting hooks). - Added
kmipclientlibrary (OpenSSL transport, high-level KMIP operations, connection pool, examples, integration-test scaffolding). - Updated top-level build wiring and added docs/comparison material (Doxygen target + comparison doc).
Reviewed changes
Copilot reviewed 73 out of 73 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| CMakeLists.txt | Wires in new subprojects + Doxygen/doc target. |
| Doxyfile | Adds Doxygen configuration. |
| KMIP_MODERN_VS_LEGACY_COMPARISON.md | Documents modern vs legacy stack differences. |
| kmipcore/CMakeLists.txt | Builds/install kmipcore and test executables. |
| kmipcore/.clang-format | Adds formatting rules for kmipcore. |
| kmipcore/include/kmipcore/attributes_parser.hpp | Declares attribute decoding helper. |
| kmipcore/include/kmipcore/key.hpp | Defines core Key model. |
| kmipcore/include/kmipcore/key_parser.hpp | Declares typed Get-response parsing into Key/Secret. |
| kmipcore/include/kmipcore/kmip_attribute_names.hpp | Centralizes attribute-name constants. |
| kmipcore/include/kmipcore/kmip_basics.hpp | Defines core TTLV Element model + KmipException. |
| kmipcore/include/kmipcore/kmip_formatter.hpp | Declares human-readable formatting API. |
| kmipcore/include/kmipcore/kmip_logger.hpp | Declares logging interface + NullLogger. |
| kmipcore/include/kmipcore/kmip_requests.hpp | Adds typed request batch item wrappers. |
| kmipcore/include/kmipcore/kmip_responses.hpp | Adds typed response batch item wrappers. |
| kmipcore/include/kmipcore/kmipcore_version.hpp | Introduces kmipcore version macros. |
| kmipcore/include/kmipcore/response_parser.hpp | Adds ResponseParser API for typed access to batch items. |
| kmipcore/include/kmipcore/secret.hpp | Defines core Secret model. |
| kmipcore/include/kmipcore/serialization_buffer.hpp | Adds reusable TTLV serialization buffer abstraction. |
| kmipcore/include/kmipcore/types.hpp | Adds common typedefs and state string helpers. |
| kmipcore/src/attributes_parser.cpp | Implements attribute element decoding. |
| kmipcore/src/key_parser.cpp | Implements Get-response parsing into Key/Secret. |
| kmipcore/src/kmip_payloads.cpp | Implements Locate payload encode/decode + Attribute model. |
| kmipcore/src/kmip_requests.cpp | Implements higher-level request builders (create/register/locate/revoke). |
| kmipcore/src/kmip_responses.cpp | Implements typed response wrappers parsing. |
| kmipcore/src/response_parser.cpp | Implements response parsing + operation/result formatting. |
| kmipcore/src/serialization_buffer.cpp | Implements SerializationBuffer growth/padding/release. |
| kmipcore/tests/test_core.cpp | Adds basic serialization/deserialization sanity tests. |
| kmipcore/tests/test_serialization_buffer.cpp | Adds SerializationBuffer behavior tests. |
| kmipclient/.clang-format | Adds formatting rules for kmipclient. |
| kmipclient/CHANGELOG.md | Introduces kmipclient changelog. |
| kmipclient/CMakeLists.txt | Builds kmipclient + examples + optional gtest integration tests. |
| kmipclient/README.md | Documents kmipclient API, design, build, and examples. |
| kmipclient/TODO.md | Tracks remaining feature work. |
| kmipclient/examples/example_activate.cpp | Adds activate example program. |
| kmipclient/examples/example_create_aes.cpp | Adds AES create example program. |
| kmipclient/examples/example_destroy.cpp | Adds destroy example program. |
| kmipclient/examples/example_get.cpp | Adds get-key example program. |
| kmipclient/examples/example_get_all_ids.cpp | Adds list-all-ids example program. |
| kmipclient/examples/example_get_attributes.cpp | Adds get-attributes example program. |
| kmipclient/examples/example_get_logger.cpp | Adds get-key-with-logger example program. |
| kmipclient/examples/example_get_name.cpp | Adds get-name/group example program. |
| kmipclient/examples/example_get_secret.cpp | Adds get-secret example program. |
| kmipclient/examples/example_locate.cpp | Adds locate-by-name example program. |
| kmipclient/examples/example_locate_by_group.cpp | Adds locate-by-group example program. |
| kmipclient/examples/example_pool.cpp | Adds multi-threaded pool example program. |
| kmipclient/examples/example_register_key.cpp | Adds register-key example program. |
| kmipclient/examples/example_register_secret.cpp | Adds register-secret example program. |
| kmipclient/examples/example_revoke.cpp | Adds revoke example program. |
| kmipclient/include/kmipclient/Kmip.hpp | Adds facade that owns transport+client. |
| kmipclient/include/kmipclient/KmipClient.hpp | Declares high-level KMIP operations API. |
| kmipclient/include/kmipclient/KmipClientPool.hpp | Declares thread-safe connection pool API. |
| kmipclient/include/kmipclient/KmipIOException.hpp | Declares IO exception type. |
| kmipclient/include/kmipclient/Key.hpp | Declares client-level Key helpers (hex/base64/PEM/generate). |
| kmipclient/include/kmipclient/NetClient.hpp | Declares abstract transport interface. |
| kmipclient/include/kmipclient/NetClientOpenSSL.hpp | Declares OpenSSL BIO transport. |
| kmipclient/include/kmipclient/kmipclient_version.hpp | Introduces kmipclient version macros. |
| kmipclient/include/kmipclient/types.hpp | Re-exports kmipcore types into kmipclient. |
| kmipclient/src/IOUtils.cpp | Implements KMIP framing send/receive + debug logging. |
| kmipclient/src/IOUtils.hpp | Declares IO helper for request/response exchange. |
| kmipclient/src/Key.cpp | Implements PEM parsing + AES key utilities. |
| kmipclient/src/KmipClient.cpp | Implements high-level operations via kmipcore requests/parsers. |
| kmipclient/src/KmipClientPool.cpp | Implements thread-safe pool with RAII borrowed clients. |
| kmipclient/src/NetClientOpenSSL.cpp | Implements OpenSSL BIO TLS transport with timeouts. |
| kmipclient/src/StringUtils.cpp | Implements hex and base64 decoding helpers. |
| kmipclient/src/StringUtils.hpp | Declares string/encoding helper utilities. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Review of
|
|
All Copilot findings fixed; Review of 103e598 fixes:
|
https://perconadev.atlassian.net/browse/PS-10068 The new kmipclient added to replacre kmippp; the new kmipcore library added to replace legacy libkmip; This is AI assited code based on initial implementation: PS-9697 new KMIP C++ client library that replaces midle and top levels of old one For more information please see KMIP_MODERN_VS_LEGACY_COMPARISON.md file
103e598 to
bfd0188
Compare
Review of
|
| /** | ||
| * @brief Base exception for KMIP core protocol/encoding failures. | ||
| */ | ||
| class KmipException : public std::runtime_error { |
There was a problem hiding this comment.
For exceptions with an error code it is better to use std::system_error
class KmipException : public std::system_error {
public:
KmipException (int native_error_code, const std::string &what);
};
const std::error_category &kmip_category() noexcept {
class [[nodiscard]] category_impl : public std::error_category {
public:
[[nodiscard]] const char *name() const noexcept override {
return "kmip";
}
[[nodiscard]] std::string message(int code) const override {
// Convert Error code to std::string here
return code_to_string(code);
}
};
static const category_impl instance;
return instance;
}
[[nodiscard]] inline std::error_code
make_kmip_error_code(int native_error_code) noexcept {
return {native_error_code, kmip_category()};
}
KmipException::KmipException(int native_error_code, const std::string &what)
: std::system_error{make_kmip_error_code(native_error_code), what} {}There was a problem hiding this comment.
Now KmipException is more complex and it handles protocol errors according to the KMIP 1.4 specification.
I think your suggestion was fullfiled.
| #ifndef KMIPCORE_KEY_PARSER_HPP | ||
| #define KMIPCORE_KEY_PARSER_HPP | ||
|
|
||
| #include "kmipcore/key.hpp" |
There was a problem hiding this comment.
Here is a good example where including just xxx_fwd.hpp files would be enough.
1fe4b47 to
6f38b43
Compare
small fixes and big fix of enum->enum class replacement, std::span, passing complex types by const&, fixing missing namespace, advanced KmipException, string_view usage
6f38b43 to
c6badaa
Compare
c6badaa to
077fb2c
Compare
https://perconadev.atlassian.net/browse/PS-10949 1. mission extended time serialization 2. network timeouts 3. IOUtils advanced send 4. fix of server error propagation 5. big cleanup in the kmipclilent public interface
https://perconadev.atlassian.net/browse/PS-10949 API cleanup and refinement. Last fixes from "Review of bfd0188". Fix of docs
https://perconadev.atlassian.net/browse/PS-10949 API cleanup and refinement. Refactoring of attributes processing
https://perconadev.atlassian.net/browse/PS-10949 API cleanup and refinement. Better crypto usage mask handling, AES key sizes
https://perconadev.atlassian.net/browse/PS-10949 API cleanup and refinement. Clean version separation, methods for getting supported versions and server capabilities
22d2db6 to
64d1103
Compare
https://perconadev.atlassian.net/browse/PS-10068
The new kmipclient added to replacre kmippp; the new kmipcore library added to replace legacy libkmip; This is AI assited code based on initial implementation:
PS-9697 new KMIP C++ client library that replaces midle and top levels of old one
For more information please see KMIP_MODERN_VS_LEGACY_COMPARISON.md file