1FIDO_DEV_INFO_MANIFES... BSD Library Functions Manual FIDO_DEV_INFO_MANIFES...
2

NAME

4     fido_dev_info_manifest, fido_dev_info_new, fido_dev_info_free,
5     fido_dev_info_ptr, fido_dev_info_path, fido_dev_info_product,
6     fido_dev_info_vendor, fido_dev_info_manufacturer_string,
7     fido_dev_info_product_string, fido_dev_info_set — FIDO2 device discovery
8     functions
9

SYNOPSIS

11     #include <fido.h>
12
13     int
14     fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen,
15         size_t *olen);
16
17     fido_dev_info_t *
18     fido_dev_info_new(size_t n);
19
20     void
21     fido_dev_info_free(fido_dev_info_t **devlist_p, size_t n);
22
23     const fido_dev_info_t *
24     fido_dev_info_ptr(const fido_dev_info_t *devlist, size_t i);
25
26     const char *
27     fido_dev_info_path(const fido_dev_info_t *di);
28
29     int16_t
30     fido_dev_info_product(const fido_dev_info_t *di);
31
32     int16_t
33     fido_dev_info_vendor(const fido_dev_info_t *di);
34
35     const char *
36     fido_dev_info_manufacturer_string(const fido_dev_info_t *di);
37
38     const char *
39     fido_dev_info_product_string(const fido_dev_info_t *di);
40
41     int
42     fido_dev_info_set(fido_dev_info_t *devlist, size_t i, const char *path,
43         const char *manufacturer, const char *product,
44         const fido_dev_io_t *io, const fido_dev_transport_t *transport);
45

DESCRIPTION

47     The fido_dev_info_manifest() function fills devlist with up to ilen FIDO2
48     devices found by the underlying operating system.  Currently only USB HID
49     devices are supported.  The number of discovered devices is returned in
50     olen, where olen is an addressable pointer.
51
52     The fido_dev_info_new() function returns a pointer to a newly allocated,
53     empty device list with n available slots.  If memory is not available,
54     NULL is returned.
55
56     The fido_dev_info_free() function releases the memory backing *devlist_p,
57     where *devlist_p must have been previously allocated by
58     fido_dev_info_new().  The number n of allocated slots must also be pro‐
59     vided.  On return, *devlist_p is set to NULL.  Either devlist_p or
60     *devlist_p may be NULL, in which case fido_dev_info_free() is a NOP.
61
62     The fido_dev_info_ptr() function returns a pointer to slot number i of
63     devlist.  It is the caller's responsibility to ensure that i is bounded.
64     Please note that the first slot has index 0.
65
66     The fido_dev_info_path() function returns the filesystem path or subsys‐
67     tem-specific identification string of di.
68
69     The fido_dev_info_product() function returns the product ID of di.
70
71     The fido_dev_info_vendor() function returns the vendor ID of di.
72
73     The fido_dev_info_manufacturer_string() function returns the manufacturer
74     string of di.  If di does not have an associated manufacturer string,
75     fido_dev_info_manufacturer_string() returns an empty string.
76
77     The fido_dev_info_product_string() function returns the product string of
78     di.  If di does not have an associated product string,
79     fido_dev_info_product_string() returns an empty string.
80
81     An example of how to use the functions described in this document can be
82     found in the examples/manifest.c file shipped with libfido2.
83
84     The fido_dev_info_set() function initializes an entry in a device list
85     allocated by fido_dev_info_new() with the specified path, manufacturer,
86     and product strings, and with the specified I/O handlers and, optionally,
87     transport functions, as described in fido_dev_set_io_functions(3).  The
88     io argument must be specified; the transport argument may be NULL.  The
89     path, I/O handlers, and transport functions will be used automatically by
90     fido_dev_new_with_info(3) and fido_dev_open_with_info(3).  An application
91     can use this, for example, to substitute mock FIDO2 devices in testing
92     for the real ones that fido_dev_info_manifest() would discover.
93

RETURN VALUES

95     The fido_dev_info_manifest() function always returns FIDO_OK.  If a dis‐
96     covery error occurs, the olen pointer is set to 0.
97
98     On success, the fido_dev_info_set() function returns FIDO_OK.  On error,
99     a different error code defined in <fido/err.h> is returned.
100
101     The pointers returned by fido_dev_info_ptr(), fido_dev_info_path(),
102     fido_dev_info_manufacturer_string(), and fido_dev_info_product_string()
103     are guaranteed to exist until fido_dev_info_free() is called on the cor‐
104     responding device list.
105
106BSD                             March 30, 2022                             BSD
Impressum