diff options
author | David Timber <mieabby@gmail.com> | 2020-01-11 18:03:47 +1100 |
---|---|---|
committer | David Timber <mieabby@gmail.com> | 2020-01-11 18:03:47 +1100 |
commit | 10512fc50e6184397206a41c157c09d9b02e9e1a (patch) | |
tree | 5f0779032edf0f0710400ae6c99b9a3f2977735d /src/util_rt.h | |
parent | 129e12d7685a6ea99fde514ad104a0368a19033d (diff) |
staged resolv_worker
* replaced RNG from `rnd` to `mbedtls_ctr_drbg`
* use of `uint_fastN_t` where appropriate
* heartbeat protocol draft
* improved worker scheduling mech
Diffstat (limited to 'src/util_rt.h')
-rw-r--r-- | src/util_rt.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/util_rt.h b/src/util_rt.h index b10f93d..4d03dc6 100644 --- a/src/util_rt.h +++ b/src/util_rt.h @@ -1,9 +1,11 @@ #pragma once -#include "rnd.h" - #include <stddef.h> +#include <stdbool.h> +#include <stdint.h> #include <time.h> +#include <mbedtls/ctr_drbg.h> + #if 0 bool prne_strendsw (const char *str, const char *w) { @@ -17,20 +19,30 @@ bool prne_strendsw (const char *str, const char *w) { } #endif -void prne_succeed_or_die (const int ret); -void prne_empty_func (); +void prne_ok_or_die (const int ret); +void prne_true_or_die (const bool ret); +void prne_empty_func (void); +bool prne_is_nonblock_errno (void); +void prne_die_not_nonblock_err (void); +void prne_close (const int fd); +void prne_shutdown (const int fd, const int how); void *prne_malloc (const size_t se, const size_t cnt); void *prne_realloc (void *ptr, const size_t se, const size_t cnt); void *prne_calloc (const size_t se, const size_t cnt); void prne_free (void *ptr); -void prne_rnd_anum_str (prne_rnd_engine_t *rnd_engine, char *str, const size_t len); +void prne_rnd_anum_str (mbedtls_ctr_drbg_context *rnd, char *str, const size_t len); +char *prne_strnchr (const char *p, const char c, const size_t n); size_t prne_str_shift_spaces (char *str, const size_t len); -struct timespec prne_sub_timespec (const struct timespec *a, const struct timespec *b); -double prne_real_timespec (const struct timespec *ts); -int prne_cmp_timespec (const struct timespec *a, const struct timespec *b); +struct timespec prne_sub_timespec (const struct timespec a, const struct timespec b); +double prne_real_timespec (const struct timespec ts); +int prne_cmp_timespec (const struct timespec a, const struct timespec b); +struct timespec prne_min_timespec (const struct timespec a, const struct timespec b); +struct timespec prne_max_timespec (const struct timespec a, const struct timespec b); char *prne_enc_base64_mem (const uint8_t *data, const size_t size); bool prne_dec_base64_mem (const char *str, const size_t str_len, uint8_t **data, size_t *size); + +bool prne_set_pipe_size (const int fd, const int size); |