Lines Matching refs:source

73 get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) {
74 isc_entropy_t *ent = source->ent;
76 int fd = source->sources.file.handle;
80 if (source->bad)
105 source->sources.file.handle = -1;
106 source->bad = ISC_TRUE;
113 get_from_usocketsource(isc_entropysource_t *source, isc_uint32_t desired) {
114 isc_entropy_t *ent = source->ent;
116 int fd = source->sources.usocket.handle;
119 size_t sz_to_recv = source->sources.usocket.sz_to_recv;
121 if (source->bad)
131 switch ( source->sources.usocket.status ) {
141 source->sources.usocket.status =
156 source->sources.usocket.status =
161 source->sources.usocket.status =
195 source->sources.usocket.status =
198 source->sources.usocket.sz_to_recv = sz_to_recv;
221 source->sources.usocket.sz_to_recv -= n;
223 source->sources.usocket.status =
237 source->bad = ISC_TRUE;
238 source->sources.usocket.status = isc_usocketsource_disconnected;
239 source->sources.usocket.handle = -1;
246 * Poll each source, trying to get data from it to stuff into the entropy
255 isc_entropysource_t *source;
308 * Poll each file source to see if we can read anything useful from
322 source = ent->nextsource;
332 switch ( source->type ) {
334 got = get_from_filesource(source, remaining);
338 got = get_from_usocketsource(source, remaining);
346 source = ISC_LIST_NEXT(source, link);
347 if (source == NULL)
348 source = ISC_LIST_HEAD(ent->sources);
350 ent->nextsource = source;
362 * check to see if we have a callback source. If so, call them.
364 source = ISC_LIST_HEAD(ent->sources);
365 while ((remaining != 0) && (source != NULL)) {
370 if (source->type == ENTROPY_SOURCETYPE_CALLBACK)
371 got = get_from_callback(source, remaining, blocking);
379 source = ISC_LIST_NEXT(source, link);
391 isc_entropysource_t *source;
401 source = ISC_LIST_HEAD(ent->sources);
402 while (source != NULL) {
403 if (source->type == ENTROPY_SOURCETYPE_FILE) {
404 fd = source->sources.file.handle;
410 if (source->type == ENTROPY_SOURCETYPE_USOCKET) {
411 fd = source->sources.usocket.handle;
413 switch (source->sources.usocket.status) {
430 source = ISC_LIST_NEXT(source, link);
444 destroyfilesource(isc_entropyfilesource_t *source) {
445 (void)close(source->handle);
449 destroyusocketsource(isc_entropyusocketsource_t *source) {
450 close(source->handle);
494 isc_entropysource_t *source;
509 * the program to look at an actual FIFO as its source of
558 source = isc_mem_get(ent->mctx, sizeof(isc_entropysource_t));
559 if (source == NULL) {
567 source->magic = SOURCE_MAGIC;
568 source->ent = ent;
569 source->total = 0;
570 source->bad = ISC_FALSE;
571 memset(source->name, 0, sizeof(source->name));
572 ISC_LINK_INIT(source, link);
574 source->sources.usocket.handle = fd;
576 source->sources.usocket.status =
579 source->sources.usocket.status =
581 source->sources.usocket.sz_to_recv = 0;
582 source->type = ENTROPY_SOURCETYPE_USOCKET;
584 source->sources.file.handle = fd;
585 source->type = ENTROPY_SOURCETYPE_FILE;
591 ISC_LIST_APPEND(ent->sources, source, link);