Libu2f-emu  0.0.0
Universal 2nd Factor (U2F) Emulation C Library
Data Structures | Functions | Variables
usb.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "message.h"
#include "transaction.h"
#include "transport.h"
#include "u2f-emu.h"
Include dependency graph for usb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  usb_state
 USB transport state. More...
 

Functions

int u2f_emu_vdev_usb_state_init (u2f_emu_vdev *vdev, void **state_ref)
 Init the USB state. More...
 
void u2f_emu_vdev_usb_state_free (void *state)
 Free the USB state. More...
 
void u2f_emu_vdev_usb_process (void *state, const void *packet, size_t size)
 Process incoming data from an USB HID packet. More...
 
bool u2f_emu_vdev_usb_has_response (void *state)
 Check the precense of a response from the USB transport. More...
 
size_t u2f_emu_vdev_usb_get_response (void *state, uint8_t **data)
 Get the response frim the USB transport. More...
 

Variables

transport_info_t usb_transport
 The USB transport. More...
 

Function Documentation

size_t u2f_emu_vdev_usb_get_response ( void *  state,
uint8_t **  data 
)

Get the response frim the USB transport.

Parameters
stateThe USB transport state.
dataThe data ref buffer to put rhe resonse
Returns
The size of the allocated data.
bool u2f_emu_vdev_usb_has_response ( void *  state)

Check the precense of a response from the USB transport.

Parameters
stateThe USB transport state.
Returns
Has response: true. Has no response: false.
void u2f_emu_vdev_usb_process ( void *  state,
const void *  packet,
size_t  size 
)

Process incoming data from an USB HID packet.

Parameters
stateThe USB transport state.
packetThe USB HID packet.
sizeThe size of the USB HID packet.

< Invalid command

< Channel is busy

< Invalid command

void u2f_emu_vdev_usb_state_free ( void *  state)

Free the USB state.

Parameters
stateThe USB transport state.
int u2f_emu_vdev_usb_state_init ( u2f_emu_vdev vdev,
void **  state_ref 
)

Init the USB state.

Parameters
vdevThe virtual device.
state_refThe USB transport state ref.
Returns
Sucess: 0. Failure: -errno.

Variable Documentation

transport_info_t usb_transport

The USB transport.