I try to avoid the direct use of core/standard macros like GRND_NONBLOCK.
Add f_random specific macros for these GRND_* macros.
build_sources_headers path.h path/common.h
build_sources_headers pipe.h
build_sources_headers print.h print/to.h print/common.h
-build_sources_headers random.h
+build_sources_headers random.h random/common.h
build_sources_headers rip.h rip/utf.h
build_sources_headers serialize.h serialize/common.h
build_sources_headers signal.h signal/common.h
build_sources_headers level_0/path.h level_0/path/common.h
build_sources_headers level_0/pipe.h
build_sources_headers level_0/print.h level_0/print/to.h level_0/print/common.h
-build_sources_headers level_0/random.h
+build_sources_headers level_0/random.h level_0/random/common.h
build_sources_headers level_0/rip.h level_0/rip/utf.h
build_sources_headers level_0/serialize.h level_0/serialize/common.h
build_sources_headers level_0/signal.h level_0/signal/common.h
#include <fll/level_0/type.h>
#include <fll/level_0/string.h>
+// FLL-0 random includes.
+#include <fll/level_0/random/common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* The flags to be passed to getrandom().
*
* Flag bits:
- * - GRND_RANDOM: Random data is taken from the random source, such as /dev/random and not the urandom source.
- * - GRND_NONBLOCK: Does not block when getting the bits.
+ * - F_random_seed_flag_block_not_d: Does not block when getting the bits.
+ * - F_random_seed_flag_source_d: Random data is taken from the random source, such as /dev/random and not the urandom source.
* @param length
* The size within the destination string to copy.
* The standard max size is 255.
* The flags to be passed to getrandom().
*
* Flag bits:
- * - GRND_RANDOM: Random data is taken from the random source, such as /dev/random and not the urandom source.
- * - GRND_NONBLOCK: Does not block when getting the bits.
+ * - F_random_seed_flag_block_not_d: Does not block when getting the bits.
+ * - F_random_seed_flag_source_d: Random data is taken from the random source, such as /dev/random and not the urandom source.
*
* @return
* F_okay on success.
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Random
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines common data to be used for/by project random.
+ *
+ * This is auto-included by random.h and should not need to be explicitly included.
+ */
+#ifndef _F_random_common_h
+#define _F_random_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Defines associated with random seed flags.
+ *
+ * F_random_seed_flag_*:
+ * - block_not: Does not block when getting the bits.
+ * - insecure: Use insecure, aka non-cryptographic, random bytes.
+ * - source: Random data is taken from the random source, such as /dev/random and not the urandom source.
+ */
+#ifndef _di_f_random_seed_flag_d_
+ #define F_random_seed_flag_block_not_d GRND_NONBLOCK
+ #define F_random_seed_flag_source_d GRND_RANDOM
+
+ #ifdef GRND_INSECURE
+ #define F_random_seed_flag_insecure_d GRND_INSECURE
+ #else
+ #define F_random_seed_flag_insecure_d 0x0004
+ #endif // GRND_INSECURE
+#endif // _di_f_random_seed_flag_d_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_random_common_h
build_sources_library random.c
-build_sources_headers random.h
+build_sources_headers random.h random/common.h
build_script yes
build_shared yes
build_sources_library random.c
build_sources_library ../../tests/unit/c/mock-random.c
-build_sources_headers random.h
+build_sources_headers random.h random/common.h
build_script yes
build_shared yes