|
libcoap 4.3.2
|
API for generating pseudo random numbers. More...
Collaboration diagram for Pseudo Random Numbers:Typedefs | |
| typedef int(* | coap_rand_func_t) (void *out, size_t len) |
| Data type for random number generator function. More... | |
Functions | |
| void | coap_set_prng (coap_rand_func_t rng) |
Replaces the current random number generation function with the default function rng. More... | |
| void | coap_prng_init (unsigned int seed) |
Seeds the default random number generation function with the given seed. More... | |
| int | coap_prng (void *buf, size_t len) |
Fills buf with len random bytes using the default pseudo random number generator. More... | |
API for generating pseudo random numbers.
| typedef int(* coap_rand_func_t) (void *out, size_t len) |
Data type for random number generator function.
The function must fill len bytes of random data into the buffer starting at out. On success, the function should return 1, zero otherwise.
Definition at line 53 of file coap_prng.h.
| int coap_prng | ( | void * | buf, |
| size_t | len | ||
| ) |
Fills buf with len random bytes using the default pseudo random number generator.
The default PRNG can be changed with coap_set_prng(). This function returns 1 when len random bytes have been written to buf, zero otherwise.
| buf | The buffer to fill with random bytes. |
| len | The number of random bytes to write into buf. |
Definition at line 140 of file coap_prng.c.
Here is the caller graph for this function:| void coap_prng_init | ( | unsigned int | seed | ) |
Seeds the default random number generation function with the given seed.
The default random number generation function will use getrandom() if available, ignoring the seed.
| seed | The seed for the pseudo random number generator. |
Definition at line 128 of file coap_prng.c.
Here is the caller graph for this function:| void coap_set_prng | ( | coap_rand_func_t | rng | ) |
Replaces the current random number generation function with the default function rng.
| rng | The random number generation function to use. |
Definition at line 123 of file coap_prng.c.