aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.h
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2018-05-25 09:51:34 +0200
committerRobin Krahl <me@robin-krahl.de>2018-05-25 10:07:10 +0200
commit6e3ae3175b34679cf1e84fc6dc5b9ebe6a9c0478 (patch)
tree639d4586c6909e79391853a4ebd1908f5ff2eca2 /NK_C_API.h
parentaee920b21d3951d2166ff73a533461e1bdd16e7f (diff)
downloadlibnitrokey-6e3ae3175b34679cf1e84fc6dc5b9ebe6a9c0478.tar.gz
libnitrokey-6e3ae3175b34679cf1e84fc6dc5b9ebe6a9c0478.tar.bz2
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.
Diffstat (limited to 'NK_C_API.h')
-rw-r--r--NK_C_API.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/NK_C_API.h b/NK_C_API.h
index 5985c0b..1bcb65e 100644
--- a/NK_C_API.h
+++ b/NK_C_API.h
@@ -61,7 +61,28 @@ extern "C" {
* Set debug level of messages written on stderr
* @param level (int) 0-lowest verbosity, 5-highest verbosity
*/
- NK_C_API void NK_set_debug_level(const int level);
+ NK_C_API void NK_set_debug_level(const int level);
+
+ /**
+ * Get the major library version, e. g. the 3 in v3.2.
+ * @return the major library version
+ */
+ NK_C_API unsigned int NK_get_major_library_version();
+
+ /**
+ * Get the minor library version, e. g. the 2 in v3.2.
+ * @return the minor library version
+ */
+ NK_C_API unsigned int NK_get_minor_library_version();
+
+ /**
+ * Get the library version as a string. This is the output of
+ * `git describe --always` at compile time, for example "v3.3" or
+ * "v3.3-19-gaee920b".
+ * The return value is a string literal and must not be freed.
+ * @return the library version as a string
+ */
+ NK_C_API const char* NK_get_library_version();
/**
* Connect to device of given model. Currently library can be connected only to one device at once.