From dc1cfa6252073ac345412e7df9c5cc0365bb7f11 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 28 Jul 2020 12:29:43 +0200 Subject: Extract Nitrokey Storage only features to separate unit --- libnitrokey/NitrokeyManager.h | 11 ++++++++--- libnitrokey/nk_strndup.h | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 libnitrokey/nk_strndup.h (limited to 'libnitrokey') diff --git a/libnitrokey/NitrokeyManager.h b/libnitrokey/NitrokeyManager.h index 163a799..ba61793 100644 --- a/libnitrokey/NitrokeyManager.h +++ b/libnitrokey/NitrokeyManager.h @@ -40,10 +40,15 @@ namespace nitrokey { using namespace nitrokey::proto; using namespace nitrokey::log; +template +typename T::CommandPayload get_payload(){ + //Create, initialize and return by value command payload + typename T::CommandPayload st; + bzero(&st, sizeof(st)); + return st; +} -#ifdef __WIN32 -char * strndup(const char* str, size_t maxlen); -#endif +#include "nk_strndup.h" class NitrokeyManager { public: diff --git a/libnitrokey/nk_strndup.h b/libnitrokey/nk_strndup.h new file mode 100644 index 0000000..0c96726 --- /dev/null +++ b/libnitrokey/nk_strndup.h @@ -0,0 +1,9 @@ +#ifndef LIBNITROKEY_NK_STRNDUP_H +#define LIBNITROKEY_NK_STRNDUP_H + +#ifdef __WIN32 +char * strndup(const char* str, size_t maxlen); +#endif + + +#endif // LIBNITROKEY_NK_STRNDUP_H -- cgit v1.2.1