1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* coap_prng.h -- Pseudo Random Numbers
*
* Copyright (C) 2010-2020 Olaf Bergmann <bergmann@tzi.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
/**
* @file coap_prng.h
* @brief Pseudo Random Numbers
*/
/**
* @ingroup application_api
* @defgroup coap_prng Pseudo Random Numbers
* API for generating pseudo random numbers
* @{
*/
/**
* Fills \p buf with \p len random bytes. This is the default implementation for
* coap_prng(). You might want to change contiki_prng_impl() to use a better
* PRNG on your specific platform.
*/
COAP_STATIC_INLINE int
COAP_STATIC_INLINE int
/**
* Data type for random number generator function. The function must
* fill @p len bytes of random data into the buffer starting at @p
* out. On success, the function should return 1, zero otherwise.
*/
typedef int ;
/**
* Replaces the current random number generation function with the
* default function @p rng.
*
* @param rng The random number generation function to use.
*/
void ;
/**
* Seeds the default random number generation function with the given
* @p seed. The default random number generation function will use
* getrandom() if available, ignoring the seed.
*
* @param seed The seed for the pseudo random number generator.
*/
void ;
/**
* Fills @p buf with @p 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 @p len random bytes
* have been written to @p buf, zero otherwise.
*
* @param buf The buffer to fill with random bytes.
* @param len The number of random bytes to write into @p buf.
*
* @return 1 on success, 0 otherwise.
*/
int ;
/* POSIX */
/** @} */
/* COAP_PRNG_H_ */