unbound: ub_ctx Struct Reference

unbound 0.1

Data Fields
ub_ctx Struct Reference

The context structure. More...

`#include <context.h>`

## Data Fields
lock_basic_type | qqpipe_lock
| mutex on query write pipe
struct tube * | qq_pipe
| the query write pipe
lock_basic_type | rrpipe_lock
| mutex on result read pipe
struct tube * | rr_pipe
| the result read pipe
lock_basic_type | cfglock
| mutex for access to env.cfg, finalized and dothread
int | finalized
| The context has been finalized This is after config when the first resolve is done.
int | created_bg
| is bg worker created yet ?
pid_t | bg_pid
| pid of bg worker process
ub_thread_type | bg_tid
| tid of bg worker thread
pid_t | pipe_pid
| pid when pipes are created.
struct libworker * | thread_worker
| when threaded, the worker that exists in the created thread.
int | dothread
| do threading (instead of forking) for async resolution
int | thr_next_num
| next thread number for new threads
int | logfile_override
| if logfile is overridden
FILE * | log_out
| what logfile to use instead
struct alloc_cache * | alloc_list
| List of alloc-cache-id points per threadnum for notinuse threads.
struct alloc_cache | superalloc
| shared caches, and so on
struct module_env * | env
| module env master value
struct module_stack | mods
| module stack
struct local_zones * | local_zones
| local authority zones
struct ub_randstate * | seed_rnd
| random state used to seed new random state structures
struct ub_event_base * | event_base
| event base for event oriented interface
int | event_base_malloced
| true if the event_base is a pluggable base that is malloced with a user event base inside, if so, clean up the pluggable alloc
struct libworker * | event_worker
| libworker for event based interface
int | next_querynum
| next query number (to try) to use
size_t | num_async
| number of async queries outstanding
rbtree_type | queries
| Tree of outstanding queries.

## Detailed Description

The context structure.

Contains two pipes for async service qq : write queries to the async service pid/tid. rr : read results from the async service pid/tid.

## Field Documentation

## ◆ finalized

int ub_ctx::finalized

The context has been finalized This is after config when the first resolve is done.

The modules are inited (module-init()) and shared caches created.

Referenced by context_finalize(), ub_ctx_add_ta(), ub_ctx_add_ta_autr(), ub_ctx_add_ta_file(), ub_ctx_async(), ub_ctx_config(), ub_ctx_finalize(), ub_ctx_hosts(), ub_ctx_set_fwd(), ub_ctx_set_option(), ub_ctx_set_stub(), ub_ctx_set_tls(), ub_ctx_trustedkeys(), ub_resolve(), ub_resolve_async(), and ub_resolve_event().

## ◆ pipe_pid

pid_t ub_ctx::pipe_pid

pid when pipes are created.

This was the process when the setup was called. Helps with clean up, so we can tell after a fork which side of the fork the delete is on.

Referenced by context_finalize(), and ub_ctx_delete().

## ◆ alloc_list

struct alloc_cache* ub_ctx::alloc_list

List of alloc-cache-id points per threadnum for notinuse threads.

Simply the entire struct alloc_cache with the 'super' member used to link a simply linked list. Reset super member to the superalloc before use.

Referenced by context_obtain_alloc(), context_release_alloc(), and ub_ctx_delete().

## ◆ queries

rbtree_type ub_ctx::queries

Tree of outstanding queries.

Indexed by querynum Used when results come in for async to lookup. Used when cancel is done for lookup (and delete). Used to see if querynum is free for use. Content of type ctx_query.

Referenced by add_bg_result(), context_deserialize_answer(), context_deserialize_cancel(), context_deserialize_new_query(), context_lookup_new_query(), context_new(), find_id(), libworker_bg_done_cb(), libworker_event_done_cb(), process_answer_detail(), ub_cancel(), ub_ctx_create_nopipe(), ub_ctx_delete(), ub_resolve(), and ub_resolve_async().

The documentation for this struct was generated from the following file:

- libunbound/context.h