#include <stdint.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <golioth/config.h>
Go to the source code of this file.
◆ GLTH_LOG_BUFFER_HEXDUMP
#define GLTH_LOG_BUFFER_HEXDUMP |
( |
| TAG, |
|
|
| ... ) |
◆ GLTH_LOGD
#define GLTH_LOGD |
( |
| TAG, |
|
|
| ... ) |
◆ GLTH_LOGE
#define GLTH_LOGE |
( |
| TAG, |
|
|
| ... ) |
◆ GLTH_LOGI
#define GLTH_LOGI |
( |
| TAG, |
|
|
| ... ) |
◆ GLTH_LOGV
#define GLTH_LOGV |
( |
| TAG, |
|
|
| ... ) |
◆ GLTH_LOGW
#define GLTH_LOGW |
( |
| TAG, |
|
|
| ... ) |
◆ golioth_sys_free
#define golioth_sys_free |
( |
| ptr | ) |
free((ptr)) |
◆ golioth_sys_malloc
#define golioth_sys_malloc |
( |
| sz | ) |
malloc((sz)) |
◆ golioth_sys_rand
#define golioth_sys_rand |
( |
| ) |
rand() |
◆ golioth_sys_srand
#define golioth_sys_srand |
( |
| seed | ) |
srand((seed)) |
◆ GOLIOTH_SYS_WAIT_FOREVER
#define GOLIOTH_SYS_WAIT_FOREVER -1 |
◆ golioth_sys_mutex_t
◆ golioth_sys_sem_t
◆ golioth_sys_sha256_t
◆ golioth_sys_thread_fn_t
typedef void(* golioth_sys_thread_fn_t) (void *user_arg) |
◆ golioth_sys_thread_t
◆ golioth_sys_timer_fn_t
◆ golioth_sys_timer_t
◆ golioth_sys_client_connected()
void golioth_sys_client_connected |
( |
void * | client | ) |
|
◆ golioth_sys_client_disconnected()
void golioth_sys_client_disconnected |
( |
void * | client | ) |
|
◆ golioth_sys_hex2bin()
size_t golioth_sys_hex2bin |
( |
const char * | hex, |
|
|
size_t | hexlen, |
|
|
uint8_t * | buf, |
|
|
size_t | buflen ) |
Convert a string of hexadecimal values to an array of bytes
- Parameters
-
hex | Pointer at a hexadecimal string. |
hexlen | Length of the hex string. |
buf | A buffer where binary values will be written. |
buflen | Length of the binary buffer. |
- Returns
- GOLIOTH_OK On success
-
GOLIOTH_ERR_FAIL On failure
◆ golioth_sys_msleep()
void golioth_sys_msleep |
( |
uint32_t | ms | ) |
|
◆ golioth_sys_mutex_create()
◆ golioth_sys_mutex_destroy()
◆ golioth_sys_mutex_lock()
◆ golioth_sys_mutex_unlock()
◆ golioth_sys_now_ms()
uint64_t golioth_sys_now_ms |
( |
void | | ) |
|
◆ golioth_sys_sem_create()
golioth_sys_sem_t golioth_sys_sem_create |
( |
uint32_t | sem_max_count, |
|
|
uint32_t | sem_initial_count ) |
◆ golioth_sys_sem_destroy()
◆ golioth_sys_sem_get_fd()
◆ golioth_sys_sem_give()
◆ golioth_sys_sem_take()
◆ golioth_sys_sha256_create()
Create a context for generating a sha256 hash.
Dynamically creates and initializes a context, then returns an opaque handle to the context. The handle is a required parameter for all other Golioth sha256 functions.
- Returns
- Non-NULL The sha256 context handle (success)
-
NULL There was an error creating the context
◆ golioth_sys_sha256_destroy()
Destroys a Golioth sha256 context
Frees memory dynamically allocated for golioth_sys_sha256_t context handle by golioth_sys_sha256_create.
- Parameters
-
sha_ctx | A sha256 context handle |
◆ golioth_sys_sha256_finish()
Finalizes a sha256 hash calculation and outputs to a binary buffer.
- Parameters
-
sha_ctx | A sha256 context handle. |
output | A buffer of exactly 32 bytes where the sha256 value is written. |
- Returns
- GOLIOTH_OK On success
-
GOLIOTH_ERR_FAIL On failure
◆ golioth_sys_sha256_update()
Adds an input buffer into a sha256 hash calculation.
Call on an existing context to add data to the sha256 calculation. May be called repeatedly (eg: each block in a block download) or once for a large data set (eg: calculate the hash after writing all bytes to memory).
- Parameters
-
sha_ctx | A sha256 context handle |
input | Input buffer to be added to the sha256 calculation |
len | Length of the input buffer, in bytes. |
- Returns
- GOLIOTH_OK On success
-
GOLIOTH_ERR_FAIL On failure
◆ golioth_sys_thread_create()
◆ golioth_sys_thread_destroy()
◆ golioth_sys_timer_create()
◆ golioth_sys_timer_destroy()
◆ golioth_sys_timer_reset()
◆ golioth_sys_timer_start()