Sindbad~EG File Manager

Current Path : /usr/local/share/doc/libfido2/html/
Upload File :
Current File : //usr/local/share/doc/libfido2/html/fido_dev_set_io_functions.html

<!DOCTYPE html>
<html>
<!-- This is an automatically generated file.  Do not edit.
   Copyright (c) 2018-2021 Yubico AB. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are
   met:
  
      1. Redistributions of source code must retain the above copyright
         notice, this list of conditions and the following disclaimer.
      2. Redistributions in binary form must reproduce the above copyright
         notice, this list of conditions and the following disclaimer in
         the documentation and/or other materials provided with the
         distribution.
  
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   SPDX-License-Identifier: BSD-2-Clause
   -->
<head>
  <meta charset="utf-8"/>
  <link rel="stylesheet" href="style.css" type="text/css" media="all"/>
  <title>FIDO_DEV_SET_IO_FUNCTIONS(3)</title>
</head>
<body>
<table class="head">
  <tr>
    <td class="head-ltitle">FIDO_DEV_SET_IO_FUNCTIONS(3)</td>
    <td class="head-vol">FreeBSD Library Functions Manual</td>
    <td class="head-rtitle">FIDO_DEV_SET_IO_FUNCTIONS(3)</td>
  </tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<code class="Nm">fido_dev_set_io_functions</code>,
  <code class="Nm">fido_dev_set_sigmask</code>,
  <code class="Nm">fido_dev_set_timeout</code>,
  <code class="Nm">fido_dev_set_transport_functions</code>,
  <code class="Nm">fido_dev_io_handle</code> &#x2014;
<div class="Nd">FIDO2 device I/O interface</div>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<code class="In">#include &lt;<a class="In">fido.h</a>&gt;</code>
<div class="Bd Pp">
<pre>
typedef void *fido_dev_io_open_t(const char *);
typedef void  fido_dev_io_close_t(void *);
typedef int   fido_dev_io_read_t(void *, unsigned char *, size_t, int);
typedef int   fido_dev_io_write_t(void *, const unsigned char *, size_t);

typedef struct fido_dev_io {
	fido_dev_io_open_t  *open;
	fido_dev_io_close_t *close;
	fido_dev_io_read_t  *read;
	fido_dev_io_write_t *write;
} fido_dev_io_t;

#ifdef _WIN32
typedef int fido_sigset_t;
#else
typedef sigset_t fido_sigset_t;
#endif

typedef int   fido_dev_rx_t(struct fido_dev *,
                  uint8_t, unsigned char *, size_t, int);
typedef int   fido_dev_tx_t(struct fido_dev *,
                  uint8_t, const unsigned char *, size_t);

typedef struct fido_dev_transport {
	fido_dev_rx_t *rx;
	fido_dev_tx_t *tx;
} fido_dev_transport_t;
</pre>
</div>
<p class="Pp">
  <br/>
  <var class="Ft">int</var>
  <br/>
  <code class="Fn">fido_dev_set_io_functions</code>(<var class="Fa" style="white-space: nowrap;">fido_dev_t
    *dev</var>, <var class="Fa" style="white-space: nowrap;">const fido_dev_io_t
    *io</var>);</p>
<p class="Pp"><var class="Ft">int</var>
  <br/>
  <code class="Fn">fido_dev_set_sigmask</code>(<var class="Fa" style="white-space: nowrap;">fido_dev_t
    *dev</var>, <var class="Fa" style="white-space: nowrap;">const fido_sigset_t
    *sigmask</var>);</p>
<p class="Pp"><var class="Ft">int</var>
  <br/>
  <code class="Fn">fido_dev_set_timeout</code>(<var class="Fa" style="white-space: nowrap;">fido_dev_t
    *dev</var>, <var class="Fa" style="white-space: nowrap;">int ms</var>);</p>
<p class="Pp"><var class="Ft">int</var>
  <br/>
  <code class="Fn">fido_dev_set_transport_functions</code>(<var class="Fa" style="white-space: nowrap;">fido_dev_t
    *dev</var>, <var class="Fa" style="white-space: nowrap;">const
    fido_dev_transport_t *t</var>);</p>
<p class="Pp"><var class="Ft">void *</var>
  <br/>
  <code class="Fn">fido_dev_io_handle</code>(<var class="Fa" style="white-space: nowrap;">const
    fido_dev_t *dev</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
The <code class="Fn">fido_dev_set_io_functions</code>() function sets the I/O
  handlers used by <i class="Em">libfido2</i> to talk to
  <var class="Fa">dev</var>. By default, these handlers are set to the operating
  system's native HID or NFC interfaces. They are defined as follows:
<dl class="Bl-tag">
  <dt><var class="Vt">fido_dev_open_t</var></dt>
  <dd>Receives a <var class="Vt">const char *</var> holding a path and opens the
      corresponding device, returning a non-NULL opaque pointer on success and
      NULL on error.</dd>
  <dt><var class="Vt">fido_dev_close_t</var></dt>
  <dd>Receives the opaque pointer returned by
      <var class="Vt">fido_dev_open_t</var> and closes the device.</dd>
  <dt><var class="Vt">fido_dev_read_t</var></dt>
  <dd>Reads a single transmission unit (HID report, APDU) from a device. The
      first parameter is the opaque pointer returned by
      <var class="Vt">fido_dev_open_t</var>. The second parameter is the read
      buffer, and the third parameter is the read buffer size. The fourth
      parameter is the number of milliseconds the caller is willing to sleep,
      should the call need to block. If this value holds -1,
      <var class="Vt">fido_dev_read_t</var> may block indefinitely. On success,
      the number of bytes read is returned. On error, -1 is returned.</dd>
  <dt><var class="Vt">fido_dev_write_t</var></dt>
  <dd>Writes a single transmission unit (HID report, APDU) to
      <var class="Fa">dev</var>. The first parameter is the opaque pointer
      returned by <var class="Vt">fido_dev_open_t</var>. The second parameter is
      the write buffer, and the third parameter is the number of bytes to be
      written. A <var class="Vt">fido_dev_write_t</var> may block. On success,
      the number of bytes written is returned. On error, -1 is returned.</dd>
</dl>
<p class="Pp">When calling <code class="Fn">fido_dev_set_io_functions</code>(),
    the <var class="Fa">open</var>, <var class="Fa">close</var>,
    <var class="Fa">read</var>, and <var class="Fa">write</var> fields of
    <var class="Fa">io</var> may not be NULL.</p>
<p class="Pp">No references to <var class="Fa">io</var> are held by
    <code class="Fn">fido_dev_set_io_functions</code>().</p>
<p class="Pp">The <code class="Fn">fido_dev_set_sigmask</code>() function may be
    used to specify a non-NULL signal mask <var class="Fa">sigmask</var> to be
    used while <i class="Em">libfido2's</i> default I/O handlers wait on
    <var class="Fa">dev</var>. On UNIX-like operating systems,
    <var class="Vt">fido_sigset_t</var> is defined as
    <var class="Vt">sigset_t</var>. On Windows,
    <var class="Vt">fido_sigset_t</var> is defined as <var class="Vt">int</var>
    and <code class="Fn">fido_dev_set_sigmask</code>() is a no-op.</p>
<p class="Pp">No references to <var class="Fa">sigmask</var> are held by
    <code class="Fn">fido_dev_set_sigmask</code>().</p>
<p class="Pp">The <code class="Fn">fido_dev_set_timeout</code>() function
    informs <i class="Em">libfido2</i> not to block for more than
    <var class="Fa">ms</var> milliseconds while communicating with
    <var class="Fa">dev</var>. If a timeout occurs, the corresponding
    <i class="Em">fido_dev_*</i> function will fail with
    <code class="Dv">FIDO_ERR_RX</code>. If <var class="Fa">ms</var> is -1, then
    <i class="Em">libfido2</i> may block indefinitely. This is the default
    behaviour. When using the Windows Hello backend, <var class="Fa">ms</var> is
    used as a guidance and may be overwritten by the platform.</p>
<p class="Pp">The <code class="Fn">fido_dev_set_transport_functions</code>()
    function sets the transport functions used by <i class="Em">libfido2</i> to
    talk to <var class="Fa">dev</var>. While the I/O handlers are responsible
    for sending and receiving transmission units of initialization and
    continuation packets already formatted by <i class="Em">libfido2</i>, the
    transport handlers are responsible for sending and receiving the CTAPHID
    commands and data directly, as defined in the FIDO Client to Authenticator
    Protocol (CTAP) standard. They are defined as follows:</p>
<dl class="Bl-tag">
  <dt><var class="Vt">fido_dev_tx_t</var></dt>
  <dd>Receives a device, a CTAPHID command to transmit, a data buffer to
      transmit, and the length of the data buffer. On success, 0 is returned. On
      error, -1 is returned.</dd>
  <dt><var class="Vt">fido_dev_rx_t</var></dt>
  <dd>Receives a device, a CTAPHID command whose response the caller expects to
      receive, a data buffer to receive into, the size of the data buffer
      determining the maximum length of a response, and the maximum number of
      milliseconds to wait for a response. On success, the number of bytes read
      into the data buffer is returned. On error, -1 is returned.</dd>
</dl>
<p class="Pp">When transport functions are specified, <i class="Em">libfido2</i>
    will use them instead of the <code class="Dv">read</code> and
    <code class="Dv">write</code> functions of the I/O handlers. However, the
    I/O handlers must still be specified to open and close the device.</p>
<p class="Pp">The <code class="Fn">fido_dev_io_handle</code>() function returns
    the opaque pointer returned by the <code class="Dv">open</code> function of
    the I/O handlers. This is useful mainly for the transport functions, which
    unlike the I/O handlers are passed the <var class="Vt">fido_dev_t</var>
    pointer instead of the opaque I/O handle.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
  VALUES</a></h1>
On success, <code class="Fn">fido_dev_set_io_functions</code>(),
  <code class="Fn">fido_dev_set_transport_functions</code>(),
  <code class="Fn">fido_dev_set_sigmask</code>(), and
  <code class="Fn">fido_dev_set_timeout</code>() return
  <code class="Dv">FIDO_OK</code>. On error, a different error code defined in
  <code class="In">&lt;<a class="In">fido/err.h</a>&gt;</code> is returned.
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<a class="Xr" href="fido_dev_info_manifest.html">fido_dev_info_manifest(3)</a>,
  <a class="Xr" href="fido_dev_open.html">fido_dev_open(3)</a>
<p class="Pp"><cite class="Rs"><span class="RsR">Client to Authenticator
    Protocol (CTAP)</span>,
    <a class="RsU" href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html">https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html</a>,
    <span class="RsQ">FIDO Alliance</span>, <span class="RsD">2021-06-15</span>,
    <span class="RsO">Proposed Standard, Version 2.1</span>.</cite></p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">May 25, 2018</td>
    <td class="foot-os">Yubico&#x00A0;AB</td>
  </tr>
</table>
</body>
</html>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists