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

Go to the source code of this file.

Data Structures

struct  payload
 Payload represenation. More...
 

Macros

#define PAYLOAD_DEF_CAP   1024
 Payload default capacity. More...
 

Functions

struct payloadpayload_new_with_capacity (uint16_t capacity)
 Allocate and initialize a new payload with a capacity. More...
 
struct payloadpayload_new (void)
 Allocate and initialize a new payload with a default capacity. More...
 
struct payloadpayload_new_from_data (const uint8_t *data, size_t size)
 Allocate and initialize a new payload from data. More...
 
bool payload_add_data (struct payload *payload, const uint8_t *data, size_t size)
 Add data to a payload. More...
 
void payload_free (struct payload *payload)
 Free a payload. More...
 

Macro Definition Documentation

#define PAYLOAD_DEF_CAP   1024

Payload default capacity.

Function Documentation

bool payload_add_data ( struct payload payload,
const uint8_t *  data,
size_t  size 
)

Add data to a payload.

Parameters
payloadThe payload to add data to.
dataThe data to add.
sizeThe size of the data.
Returns
Success: true. Failure: false.
void payload_free ( struct payload payload)

Free a payload.

Parameters
payloadThe payload to free.
struct payload* payload_new ( void  )

Allocate and initialize a new payload with a default capacity.

Returns
Success: The new allocated and initialiazed payload. Failure: NULL.
struct payload* payload_new_from_data ( const uint8_t *  data,
size_t  size 
)

Allocate and initialize a new payload from data.

Parameters
dataThe data to put in the payload.
sizeThe size of the data.
Returns
Success: The new allocated and initialized payload. Failure: NULL.
struct payload* payload_new_with_capacity ( uint16_t  capacity)

Allocate and initialize a new payload with a capacity.

Parameters
capacityThe capacity of the payload.
Returns
Success: The new allocated and initialiazed payload. Failure: NULL.