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

Go to the source code of this file.

Data Structures

struct  apdu_state
 APDU transport state. More...
 

Functions

int u2f_emu_vdev_apdu_state_init (u2f_emu_vdev *vdev, void **state_ref)
 Init the APDU state. More...
 
void u2f_emu_vdev_apdu_state_free (void *state)
 Free the APDU state. More...
 
void u2f_emu_vdev_apdu_process (void *state, const void *apdu, size_t size)
 Process incoming data from an APDU. More...
 
bool u2f_emu_vdev_apdu_has_response (void *state)
 Check the precense of a response from the APDU transport. More...
 
size_t u2f_emu_vdev_apdu_get_response (void *state, uint8_t **data)
 Get the response frim the APDU transport. More...
 
void u2f_emu_vdev_apdu_set_apdu (void *state, u2f_emu_apdu apdu)
 Set the APDU formatof the APDU transport. More...
 

Variables

transport_info_t apdu_transport
 The APDU transport. More...
 

Function Documentation

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

Get the response frim the APDU transport.

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

Check the precense of a response from the APDU transport.

Parameters
stateThe APDU transport state.
Returns
Has response: true. Has no response: false.
void u2f_emu_vdev_apdu_process ( void *  state,
const void *  apdu,
size_t  size 
)

Process incoming data from an APDU.

Parameters
stateThe APDU transport state.
apduThe APDU.
sizeThe size of the APDU packet.
void u2f_emu_vdev_apdu_set_apdu ( void *  state,
u2f_emu_apdu  apdu 
)

Set the APDU formatof the APDU transport.

Parameters
stateThe APDU transport state.
apduThe APDU format to set.
void u2f_emu_vdev_apdu_state_free ( void *  state)

Free the APDU state.

Parameters
stateThe APDU transport state.
int u2f_emu_vdev_apdu_state_init ( u2f_emu_vdev vdev,
void **  state_ref 
)

Init the APDU state.

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

Variable Documentation

transport_info_t apdu_transport

The APDU transport.