From 6e3ae3175b34679cf1e84fc6dc5b9ebe6a9c0478 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 25 May 2018 09:51:34 +0200 Subject: Add getters for the library version CMake generates version.h from version.h.in and sets the major and minor version as specified in CMakeLists.txt and the current git version as returned by `git describe --always`. These values are also added to the C API as NK_get{_major,_minor,}_library_version. --- NK_C_API.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'NK_C_API.cc') diff --git a/NK_C_API.cc b/NK_C_API.cc index 8e005b8..a26b1da 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -25,6 +25,7 @@ #include #include "libnitrokey/LibraryException.h" #include "libnitrokey/cxx_semantics.h" +#include "version.h" #ifdef _MSC_VER #ifdef _WIN32 @@ -353,6 +354,18 @@ extern "C" { m->set_loglevel(level); } + NK_C_API unsigned int NK_get_major_library_version() { + return get_major_library_version(); + } + + NK_C_API unsigned int NK_get_minor_library_version() { + return get_minor_library_version(); + } + + NK_C_API const char* NK_get_library_version() { + return get_library_version(); + } + NK_C_API int NK_totp_set_time(uint64_t time) { auto m = NitrokeyManager::instance(); return get_without_result([&]() { -- cgit v1.2.1