30 {
33
34 const char *connector_url;
35
36 connector_url = getenv("DEFAULT_CONNECTOR_URL");
37 if (connector_url == NULL) {
39 }
40
43 fprintf(stderr,
"unable to initialize yubihsm: %s\n",
yh_strerror(
yrc));
44 exit(EXIT_FAILURE);
45 }
46
49
52
53 char *received_url;
56
57 printf(
"Successfully connected to %s, device is ", received_url);
60 exit(EXIT_FAILURE);
61 }
63
64 uint8_t c_major, c_minor, c_patch;
67 printf(
"Connector Version: %hhu.%hhu.%hhu\n", c_major, c_minor, c_patch);
68
69 uint8_t d_major, d_minor, d_patch;
73 size_t n_algorithms = sizeof(algorithms);
76 &log_total, &log_used, algorithms, &n_algorithms);
78
79 printf(
"Device Version: %hhu.%hhu.%hhu\n", d_major, d_minor, d_patch);
81 printf(
"Log: %d/%d (used/total)\n", log_used, log_total);
82 printf(
"Supported algorithms:\n");
83 for (size_t i = 0; i < n_algorithms; i++) {
87 }
88
91
94
95 return 0;
96}
#define DEFAULT_CONNECTOR_URL
const char * yh_strerror(yh_rc err)
LOGGING_API void printf(Category category, const char *format,...)
bool yh_connector_has_device(yh_connector *connector)
yh_rc yh_algo_to_string(yh_algorithm algo, char const **result)
yh_rc yh_get_connector_version(yh_connector *connector, uint8_t *major, uint8_t *minor, uint8_t *patch)
yh_rc yh_util_get_device_info(yh_connector *connector, uint8_t *major, uint8_t *minor, uint8_t *patch, uint32_t *serial, uint8_t *log_total, uint8_t *log_used, yh_algorithm *algorithms, size_t *n_algorithms)
yh_rc yh_init_connector(const char *url, yh_connector **connector)
yh_rc yh_connect(yh_connector *connector, int timeout)
yh_rc yh_disconnect(yh_connector *connector)
yh_rc yh_get_connector_address(yh_connector *connector, char **const address)
#define YH_MAX_ALGORITHM_COUNT
Max number of algorithms defined here.
@ YHR_GENERIC_ERROR
Return value when encountering an unknown error.
@ YHR_SUCCESS
Returned value when function was successful.