2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Fully implement callback sources, and add a test program to test it.

This commit is contained in:
Michael Graff
2000-06-21 00:04:57 +00:00
parent 8ae26e9f87
commit 96e79f7ede
7 changed files with 270 additions and 92 deletions

View File

@@ -67,15 +67,11 @@ ISC_LANG_BEGINDECLS
/*
* Entropy callback function.
*/
typedef isc_result_t (*isc_entropystart_t)(isc_entropy_t *ent,
isc_entropysource_t *source,
void *arg);
typedef isc_result_t (*isc_entropyget_t)(isc_entropy_t *ent,
isc_entropysource_t *source,
void *arg);
typedef void (*isc_entropystop_t)(isc_entropy_t *ent,
isc_entropysource_t *source,
void *arg);
typedef isc_result_t (*isc_entropystart_t)(isc_entropysource_t *source,
void *arg, isc_boolean_t blocking);
typedef isc_result_t (*isc_entropyget_t)(isc_entropysource_t *source,
void *arg, isc_boolean_t blocking);
typedef void (*isc_entropystop_t)(isc_entropysource_t *source, void *arg);
/***
*** Flags.
@@ -179,12 +175,23 @@ isc_entropy_createcallbacksource(isc_entropy_t *ent,
* Create an entropy source that is polled via a callback. This would
* be used when keyboard input is used, or a GUI input method. It can
* also be used to hook in any external entropy source.
*
* Samples are added via isc_entropy_addcallbacksample(), below.
* _addcallbacksample() is the only function which may be called from
* within an entropy API callback function.
*/
void
isc_entropy_stopcallbacksources(isc_entropy_t *ent);
/*
* Call the stop functions for callback sources that have had their
* start functions called.
*/
isc_result_t
isc_entropy_addcallbacksample(isc_entropysource_t *source, isc_uint32_t sample,
isc_uint32_t extra);
isc_result_t
isc_entropy_addsample(isc_entropysource_t *source, isc_uint32_t sample,
isc_uint32_t extra);
/*
@@ -195,6 +202,9 @@ isc_entropy_addsample(isc_entropysource_t *source, isc_uint32_t sample,
*
* The "extra" parameter is used only to add a bit more unpredictable
* data. It is not used other than included in the hash of samples.
*
* When in an entropy API callback function, _addcallbacksource() must be
* used. At all other times, _addsample() must be used.
*/
isc_result_t

View File

@@ -67,8 +67,8 @@
#define ISC_R_MULTICAST 43 /* invalid use of multicast */
#define ISC_R_NOTFILE 44 /* not a file */
#define ISC_R_NOTDIRECTORY 45 /* not a directory */
#define ISC_R_NRESULTS 46 /* Number of results */
#define ISC_R_QUEUEFULL 46 /* queue is full */
#define ISC_R_NRESULTS 47 /* Number of results */
ISC_LANG_BEGINDECLS