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

Go to the source code of this file.

Data Structures

struct  transport_info
 Transport info representation. More...
 
struct  transport
 Transport representation. More...
 

Typedefs

typedef int(* state_init_t) (u2f_emu_vdev *vdev, void **state)
 Transport state init handler. More...
 
typedef void(* state_free_t) (void *state)
 Transport state free handler. More...
 
typedef void(* input_handler_t) (void *state, const void *data, size_t size)
 Input data handler. More...
 
typedef bool(* has_response_t) (void *state)
 Response precense checker. More...
 
typedef size_t(* get_response_t) (void *state, uint8_t **data)
 Response getter. More...
 
typedef void(* set_apdu_t) (void *state, u2f_emu_apdu apdu)
 APDU format setter. More...
 
typedef struct transport_info transport_info_t
 Transport info representation. More...
 

Functions

bool transport_core_new (u2f_emu_vdev *vdev, struct transport_core **core_ref)
 Create a new transport_core that manage all transports. More...
 
void transport_core_free (struct transport_core *core)
 Free all ressource allocated by a transport core. More...
 
const struct transporttransport_get (const struct transport_core *core, u2f_emu_transport type)
 Get a transport from a transport core. More...
 
const transport_info_ttransport_info_get (u2f_emu_transport type)
 Get the transport info for a specific transport type. More...
 

Typedef Documentation

typedef size_t(* get_response_t) (void *state, uint8_t **data)

Response getter.

typedef bool(* has_response_t) (void *state)

Response precense checker.

typedef void(* input_handler_t) (void *state, const void *data, size_t size)

Input data handler.

typedef void(* set_apdu_t) (void *state, u2f_emu_apdu apdu)

APDU format setter.

typedef void(* state_free_t) (void *state)

Transport state free handler.

typedef int(* state_init_t) (u2f_emu_vdev *vdev, void **state)

Transport state init handler.

Transport info representation.

Function Documentation

void transport_core_free ( struct transport_core *  core)

Free all ressource allocated by a transport core.

Parameters
coreThe transport core to free.
bool transport_core_new ( u2f_emu_vdev vdev,
struct transport_core **  core_ref 
)

Create a new transport_core that manage all transports.

Parameters
vdevThe virtual device.
core_refThe reference to the transport core to create.
Returns
Success: true. Failure: false.
const struct transport* transport_get ( const struct transport_core *  core,
u2f_emu_transport  type 
)

Get a transport from a transport core.

Parameters
coreThe transport core.
typeThe transport type.
Returns
Success: the transport. Failure: NULL.
const transport_info_t* transport_info_get ( u2f_emu_transport  type)

Get the transport info for a specific transport type.

Parameters
typeThe transport type.
Returns
Sucesss: The speccific transport info. Failure: NULL.