diff options
author | Robin Krahl <me@robin-krahl.de> | 2019-01-13 12:05:37 +0100 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2019-01-13 13:27:38 +0100 |
commit | 5d94dece0392ce0d5486097abf8918b6922f85d2 (patch) | |
tree | d860908fa09d46aa26987e5674139d57b271ecba /NK_C_API.h | |
parent | a80378e0c770a503ddaafc0c7aacb78cac667b8f (diff) | |
download | libnitrokey-5d94dece0392ce0d5486097abf8918b6922f85d2.tar.gz libnitrokey-5d94dece0392ce0d5486097abf8918b6922f85d2.tar.bz2 |
Add NK_device_info, NK_list_devices and NK_free_device_info
NK_list_devices corresponds to NitrokeyManager::list_devices. It
returns a linked list of NK_device_info, which has to be freed using the
NK_free_device_info function.
Diffstat (limited to 'NK_C_API.h')
-rw-r--r-- | NK_C_API.h | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -57,6 +57,29 @@ extern "C" { NK_STORAGE = 2 }; + /** + * The connection info for a Nitrokey device as a linked list. + */ + struct NK_device_info { + /** + * The model of the Nitrokey device. + */ + enum NK_device_model model; + /** + * The USB device path for NK_connect_with_path. + */ + char* path; + /** + * The serial number. + */ + char* serial_number; + /** + * The pointer to the next element of the linked list or null + * if this is the last element in the list. + */ + struct NK_device_info* next; + }; + /** * Stores the status of a Storage device. */ @@ -768,6 +791,19 @@ extern "C" { */ NK_C_API char* NK_list_devices_by_cpuID(); + /** + * Returns a linked list of all connected devices, or null if no devices + * are connected or an error occured. The linked list must be freed by + * calling NK_free_device_info. + * @return a linked list of all connected devices + */ + NK_C_API struct NK_device_info* NK_list_devices(); + + /** + * Free a linked list returned by NK_list_devices. + * @param the linked list to free or null + */ + NK_C_API void NK_free_device_info(struct NK_device_info* device_info); /** * Connects to the device with given ID. ID's list could be created with NK_list_devices_by_cpuID. |