From 10512fc50e6184397206a41c157c09d9b02e9e1a Mon Sep 17 00:00:00 2001 From: David Timber Date: Sat, 11 Jan 2020 18:03:47 +1100 Subject: 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 --- src/util_rt.h | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/util_rt.h') 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 +#include +#include #include +#include + #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); -- cgit