Libu2f-emu
0.0.0
Universal 2nd Factor (U2F) Emulation C Library
|
Macros | |
#define | FLOOR_NB(nb, m) ((nb) & ~((m) - 1)) |
#define | CEIL_NB(nb, m) FLOOR_NB(nb + m - 1, m) |
Functions | |
struct message * | message_new (const struct packet_init *init_packet) |
Allocate and initialize a new message from an init packet. More... | |
struct message * | message_new_blank (uint32_t cid, uint8_t cmd) |
Allocate and initialize a new blank message. More... | |
struct message * | message_new_from_data (uint32_t cid, uint8_t cmd, const uint8_t *data, size_t size) |
Allocate and initialize a new message from data. More... | |
struct message * | message_new_from_payload (uint32_t cid, uint8_t cmd, const struct payload *payload) |
Allocate and initialize a new message from payload. More... | |
struct message * | message_copy (const struct message *message) |
Allocate and initialize a new message from another message. More... | |
bool | message_add_data (struct message *message, const uint8_t *data, size_t size) |
Add data to a message. More... | |
bool | message_add_part (struct message *message, const struct packet_cont *cont_packet) |
Add a part to a message. More... | |
bool | message_next_packet (struct message *message, void **packet_ref) |
Get next packet part of a message for sending a message. More... | |
void | message_free (struct message *message) |
Free a message. More... | |
#define CEIL_NB | ( | nb, | |
m | |||
) | FLOOR_NB(nb + m - 1, m) |
#define FLOOR_NB | ( | nb, | |
m | |||
) | ((nb) & ~((m) - 1)) |
bool message_add_data | ( | struct message * | message, |
const uint8_t * | data, | ||
size_t | size | ||
) |
Add data to a message.
message | The message to add data to. |
data | The data to add. |
size | The size of the data. |
bool message_add_part | ( | struct message * | message, |
const struct packet_cont * | cont_packet | ||
) |
Add a part to a message.
message | The message. |
cont_packet | The continuation packet. |
Allocate and initialize a new message from another message.
message | The message to copy. |
void message_free | ( | struct message * | message | ) |
Free a message.
message | The message to free. |
struct message* message_new | ( | const struct packet_init * | init_packet | ) |
Allocate and initialize a new message from an init packet.
init_packet | The initialisation packet of the message. |
struct message* message_new_blank | ( | uint32_t | cid, |
uint8_t | cmd | ||
) |
Allocate and initialize a new blank message.
cid | The channel id. |
cmd | The associated command. |
struct message* message_new_from_data | ( | uint32_t | cid, |
uint8_t | cmd, | ||
const uint8_t * | data, | ||
size_t | size | ||
) |
Allocate and initialize a new message from data.
cid | The channel id. |
cmd | The associated command. |
data | The data to put in the message. |
size | The size of the data. |
struct message* message_new_from_payload | ( | uint32_t | cid, |
uint8_t | cmd, | ||
const struct payload * | payload | ||
) |
Allocate and initialize a new message from payload.
cid | The channel id. |
cmd | The associated command. |
payload | The payload ot put in the message. |
bool message_next_packet | ( | struct message * | message, |
void ** | packet_ref | ||
) |
Get next packet part of a message for sending a message.
message | The message to get the next packet from. |
packet_ref | Packet reference to put the crafted packet. |