mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
100. [cleanup] <isc/random.h> does not need <isc/int.h> or
<isc/mutex.h>. isc_random_t moved to <isc/types.h>.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
|||||||
|
100. [cleanup] <isc/random.h> does not need <isc/int.h> or
|
||||||
|
<isc/mutex.h>. isc_random_t moved to <isc/types.h>.
|
||||||
|
|
||||||
99. [cleanup] Rate limiter now has separate shutdown() and
|
99. [cleanup] Rate limiter now has separate shutdown() and
|
||||||
destroy() functions, and it guarantees that all
|
destroy() functions, and it guarantees that all
|
||||||
queued events are delivered even in the shutdown case.
|
queued events are delivered even in the shutdown case.
|
||||||
|
@@ -19,9 +19,7 @@
|
|||||||
#define ISC_RANDOM_H 1
|
#define ISC_RANDOM_H 1
|
||||||
|
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/int.h>
|
#include <isc/types.h>
|
||||||
#include <isc/mutex.h>
|
|
||||||
#include <isc/result.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Implements a random state pool which will let the caller return a
|
* Implements a random state pool which will let the caller return a
|
||||||
@@ -32,16 +30,18 @@
|
|||||||
|
|
||||||
ISC_LANG_BEGINDECLS
|
ISC_LANG_BEGINDECLS
|
||||||
|
|
||||||
typedef struct {
|
struct isc_random {
|
||||||
unsigned int magic;
|
unsigned int magic;
|
||||||
#if 0
|
#if 0
|
||||||
isc_mutex_t lock;
|
isc_mutex_t lock;
|
||||||
#endif
|
#endif
|
||||||
} isc_random_t;
|
};
|
||||||
|
|
||||||
#define ISC_RANDOM_MAGIC 0x52416e64 /* RAnd. */
|
#define ISC_RANDOM_MAGIC 0x52416e64 /* RAnd. */
|
||||||
#define ISC_RANDOM_VALID(x) ((x) != NULL && (x->magic) == ISC_RANDOM_MAGIC)
|
#define ISC_RANDOM_VALID(x) ((x) != NULL && (x->magic) == ISC_RANDOM_MAGIC)
|
||||||
|
|
||||||
isc_result_t isc_random_init(isc_random_t *r);
|
isc_result_t
|
||||||
|
isc_random_init(isc_random_t *r);
|
||||||
/*
|
/*
|
||||||
* Initialize a random state.
|
* Initialize a random state.
|
||||||
*
|
*
|
||||||
@@ -51,7 +51,8 @@ isc_result_t isc_random_init(isc_random_t *r);
|
|||||||
* r != NULL.
|
* r != NULL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
isc_result_t isc_random_invalidate(isc_random_t *r);
|
isc_result_t
|
||||||
|
isc_random_invalidate(isc_random_t *r);
|
||||||
/*
|
/*
|
||||||
* Invalidate a random state. This will wipe any information contained in
|
* Invalidate a random state. This will wipe any information contained in
|
||||||
* the state and make it unusable.
|
* the state and make it unusable.
|
||||||
@@ -60,7 +61,8 @@ isc_result_t isc_random_invalidate(isc_random_t *r);
|
|||||||
* r be a valid pool.
|
* r be a valid pool.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void isc_random_seed(isc_random_t *r, isc_uint32_t seed);
|
void
|
||||||
|
isc_random_seed(isc_random_t *r, isc_uint32_t seed);
|
||||||
/*
|
/*
|
||||||
* Set the initial seed of the random state. Note that on some systems
|
* Set the initial seed of the random state. Note that on some systems
|
||||||
* the private state isn't all that private, and setting the seed may
|
* the private state isn't all that private, and setting the seed may
|
||||||
@@ -70,7 +72,8 @@ void isc_random_seed(isc_random_t *r, isc_uint32_t seed);
|
|||||||
* r be a valid pool.
|
* r be a valid pool.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void isc_random_get(isc_random_t *r, isc_uint32_t *val);
|
void
|
||||||
|
isc_random_get(isc_random_t *r, isc_uint32_t *val);
|
||||||
/*
|
/*
|
||||||
* Get a random value. Note that on some systems the private state isn't
|
* Get a random value. Note that on some systems the private state isn't
|
||||||
* all that private, and getting a value may alter what other state pools
|
* all that private, and getting a value may alter what other state pools
|
||||||
|
@@ -45,6 +45,7 @@ typedef struct isc_mempool isc_mempool_t;
|
|||||||
typedef struct isc_msgcat isc_msgcat_t;
|
typedef struct isc_msgcat isc_msgcat_t;
|
||||||
typedef struct isc_ondestroy isc_ondestroy_t;
|
typedef struct isc_ondestroy isc_ondestroy_t;
|
||||||
typedef struct isc_netaddr isc_netaddr_t;
|
typedef struct isc_netaddr isc_netaddr_t;
|
||||||
|
typedef struct isc_random isc_random_t;
|
||||||
typedef struct isc_region isc_region_t;
|
typedef struct isc_region isc_region_t;
|
||||||
typedef unsigned int isc_result_t;
|
typedef unsigned int isc_result_t;
|
||||||
typedef struct isc_rwlock isc_rwlock_t;
|
typedef struct isc_rwlock isc_rwlock_t;
|
||||||
|
Reference in New Issue
Block a user