summaryrefslogtreecommitdiff
path: root/NK_C_API.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2018-06-19 14:24:13 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2018-06-19 14:24:13 +0200
commit9eb759fc6fa0b41ecfbe366b56384e3eb97dd081 (patch)
tree0b454af8b4603b3b5ca3b35e505ea3875e6410c8 /NK_C_API.h
parentaee920b21d3951d2166ff73a533461e1bdd16e7f (diff)
parent5edb645227c00c63badc4fb3cccefa4d7e1bb547 (diff)
downloadlibnitrokey-9eb759fc6fa0b41ecfbe366b56384e3eb97dd081.tar.gz
libnitrokey-9eb759fc6fa0b41ecfbe366b56384e3eb97dd081.tar.bz2
Merge branch 'pr_118'
C API: Storage status getter Closes #118
Diffstat (limited to 'NK_C_API.h')
-rw-r--r--NK_C_API.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/NK_C_API.h b/NK_C_API.h
index 5985c0b..274f908 100644
--- a/NK_C_API.h
+++ b/NK_C_API.h
@@ -52,6 +52,77 @@ extern "C" {
};
/**
+ * Stores the status of a Storage device.
+ */
+ struct NK_storage_status {
+ /**
+ * Indicates whether the unencrypted volume is read-only.
+ */
+ bool unencrypted_volume_read_only;
+ /**
+ * Indicates whether the unencrypted volume is active.
+ */
+ bool unencrypted_volume_active;
+ /**
+ * Indicates whether the encrypted volume is read-only.
+ */
+ bool encrypted_volume_read_only;
+ /**
+ * Indicates whether the encrypted volume is active.
+ */
+ bool encrypted_volume_active;
+ /**
+ * Indicates whether the hidden volume is read-only.
+ */
+ bool hidden_volume_read_only;
+ /**
+ * Indicates whether the hidden volume is active.
+ */
+ bool hidden_volume_active;
+ /**
+ * The major firmware version, e. g. 0 in v0.40.
+ */
+ uint8_t firmware_version_major;
+ /**
+ * The minor firmware version, e. g. 40 in v0.40.
+ */
+ uint8_t firmware_version_minor;
+ /**
+ * Indicates whether the firmware is locked.
+ */
+ bool firmware_locked;
+ /**
+ * The serial number of the SD card in the Storage stick.
+ */
+ uint32_t serial_number_sd_card;
+ /**
+ * The serial number of the smart card in the Storage stick.
+ */
+ uint32_t serial_number_smart_card;
+ /**
+ * The number of remaining login attempts for the user PIN.
+ */
+ uint8_t user_retry_count;
+ /**
+ * The number of remaining login attempts for the admin PIN.
+ */
+ uint8_t admin_retry_count;
+ /**
+ * Indicates whether a new SD card was found.
+ */
+ bool new_sd_card_found;
+ /**
+ * Indicates whether the SD card is filled with random characters.
+ */
+ bool filled_with_random;
+ /**
+ * Indicates whether the stick has been initialized by generating
+ * the AES keys.
+ */
+ bool stick_initialized;
+ };
+
+ /**
* Set debug level of messages written on stderr
* @param state state=True - most messages, state=False - only errors level
*/
@@ -587,6 +658,17 @@ extern "C" {
NK_C_API char* NK_get_status_storage_as_string();
/**
+ * Get the Storage stick status and return the command processing
+ * error code. If the code is zero, i. e. the command was successful,
+ * the storage status is written to the output pointer's target.
+ * The output pointer must not be null.
+ *
+ * @param out the output pointer for the storage status
+ * @return command processing error code
+ */
+ NK_C_API int NK_get_status_storage(struct NK_storage_status* out);
+
+ /**
* Get SD card usage attributes as string.
* Usable during hidden volumes creation.
* Storage only