26#ifndef DEFAULT_CONNECTOR_URL
27#define DEFAULT_CONNECTOR_URL "http://127.0.0.1:12345"
34 const char *connector_url;
36 connector_url = getenv(
"DEFAULT_CONNECTOR_URL");
37 if (connector_url == NULL) {
43 fprintf(stderr,
"unable to initialize yubihsm: %s\n",
yh_strerror(
yrc));
57 printf(
"Successfully connected to %s, device is ", received_url);
59 printf(
"not present\n");
64 uint8_t c_major, c_minor, c_patch;
67 printf(
"Connector Version: %hhu.%hhu.%hhu\n", c_major, c_minor, c_patch);
69 uint8_t d_major, d_minor, d_patch;
73 size_t n_algorithms =
sizeof(algorithms);
76 &log_total, &log_used, algorithms, &n_algorithms);
79 printf(
"Device Version: %hhu.%hhu.%hhu\n", d_major, d_minor, d_patch);
80 printf(
"Serial: %d\n",
serial);
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++) {
#define DEFAULT_CONNECTOR_URL
const char * yh_strerror(yh_rc err)
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.