Lines Matching refs:source

66 get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) {
67 isc_entropy_t *ent = source->ent;
69 int fd = source->sources.file.handle;
73 if (source->bad)
98 source->sources.file.handle = -1;
99 source->bad = ISC_TRUE;
106 get_from_usocketsource(isc_entropysource_t *source, isc_uint32_t desired) {
107 isc_entropy_t *ent = source->ent;
109 int fd = source->sources.usocket.handle;
112 size_t sz_to_recv = source->sources.usocket.sz_to_recv;
114 if (source->bad)
124 switch ( source->sources.usocket.status ) {
134 source->sources.usocket.status =
149 source->sources.usocket.status =
154 source->sources.usocket.status =
188 source->sources.usocket.status =
191 source->sources.usocket.sz_to_recv = sz_to_recv;
214 source->sources.usocket.sz_to_recv -= n;
216 source->sources.usocket.status =
230 source->bad = ISC_TRUE;
231 source->sources.usocket.status = isc_usocketsource_disconnected;
232 source->sources.usocket.handle = -1;
239 * Poll each source, trying to get data from it to stuff into the entropy
248 isc_entropysource_t *source;
301 * Poll each file source to see if we can read anything useful from
315 source = ent->nextsource;
325 switch ( source->type ) {
327 got = get_from_filesource(source, remaining);
331 got = get_from_usocketsource(source, remaining);
339 source = ISC_LIST_NEXT(source, link);
340 if (source == NULL)
341 source = ISC_LIST_HEAD(ent->sources);
343 ent->nextsource = source;
355 * check to see if we have a callback source. If so, call them.
357 source = ISC_LIST_HEAD(ent->sources);
358 while ((remaining != 0) && (source != NULL)) {
363 if (source->type == ENTROPY_SOURCETYPE_CALLBACK)
364 got = get_from_callback(source, remaining, blocking);
372 source = ISC_LIST_NEXT(source, link);
384 isc_entropysource_t *source;
394 source = ISC_LIST_HEAD(ent->sources);
395 while (source != NULL) {
396 if (source->type == ENTROPY_SOURCETYPE_FILE) {
397 fd = source->sources.file.handle;
403 if (source->type == ENTROPY_SOURCETYPE_USOCKET) {
404 fd = source->sources.usocket.handle;
406 switch (source->sources.usocket.status) {
423 source = ISC_LIST_NEXT(source, link);
437 destroyfilesource(isc_entropyfilesource_t *source) {
438 (void)close(source->handle);
442 destroyusocketsource(isc_entropyusocketsource_t *source) {
443 close(source->handle);
487 isc_entropysource_t *source;
502 * the program to look at an actual FIFO as its source of
551 source = isc_mem_get(ent->mctx, sizeof(isc_entropysource_t));
552 if (source == NULL) {
560 source->magic = SOURCE_MAGIC;
561 source->ent = ent;
562 source->total = 0;
563 source->bad = ISC_FALSE;
564 memset(source->name, 0, sizeof(source->name));
565 ISC_LINK_INIT(source, link);
567 source->sources.usocket.handle = fd;
569 source->sources.usocket.status =
572 source->sources.usocket.status =
574 source->sources.usocket.sz_to_recv = 0;
575 source->type = ENTROPY_SOURCETYPE_USOCKET;
577 source->sources.file.handle = fd;
578 source->type = ENTROPY_SOURCETYPE_FILE;
584 ISC_LIST_APPEND(ent->sources, source, link);