unbound 0.1
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

◆ qqpipe_lock

lock_basic_type ub_ctx::qqpipe_lock

mutex on query write pipe

Referenced by ub_cancel(), ub_ctx_create_nopipe(), ub_ctx_delete(), ub_resolve_async(), and ub_stop_bg().

◆ qq_pipe

struct tube* ub_ctx::qq_pipe

◆ rrpipe_lock

lock_basic_type ub_ctx::rrpipe_lock

mutex on result read pipe

Referenced by ub_ctx_create_nopipe(), ub_ctx_delete(), ub_process(), ub_stop_bg(), and ub_wait().

◆ rr_pipe

◆ cfglock

◆ 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().

◆ created_bg

int ub_ctx::created_bg

◆ bg_pid

pid_t ub_ctx::bg_pid

pid of bg worker process

Referenced by libworker_bg(), and ub_stop_bg().

◆ bg_tid

ub_thread_type ub_ctx::bg_tid

tid of bg worker thread

Referenced by libworker_bg(), ub_ctx_delete(), and ub_stop_bg().

◆ 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().

◆ thread_worker

struct libworker* ub_ctx::thread_worker

when threaded, the worker that exists in the created thread.

Referenced by libworker_bg(), and ub_ctx_delete().

◆ dothread

int ub_ctx::dothread

do threading (instead of forking) for async resolution

Referenced by libworker_bg(), ub_cancel(), ub_ctx_async(), ub_ctx_create_event(), ub_ctx_create_ub_event(), ub_ctx_delete(), ub_ctx_set_event(), and ub_stop_bg().

◆ thr_next_num

int ub_ctx::thr_next_num

next thread number for new threads

Referenced by context_obtain_alloc().

◆ logfile_override

int ub_ctx::logfile_override

if logfile is overridden

Referenced by context_finalize(), and ub_ctx_debugout().

◆ log_out

FILE* ub_ctx::log_out

what logfile to use instead

Referenced by context_finalize(), and ub_ctx_debugout().

◆ 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().

◆ superalloc

struct alloc_cache ub_ctx::superalloc

shared caches, and so on

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

◆ env

◆ mods

◆ local_zones

◆ seed_rnd

struct ub_randstate* ub_ctx::seed_rnd

random state used to seed new random state structures

Referenced by libworker_setup(), ub_ctx_create(), ub_ctx_create_nopipe(), and ub_ctx_delete().

◆ event_base

◆ event_base_malloced

int ub_ctx::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

Referenced by ub_ctx_create_event(), and ub_ctx_delete().

◆ event_worker

struct libworker* ub_ctx::event_worker

libworker for event based interface

Referenced by libworker_attach_mesh(), ub_ctx_delete(), ub_ctx_set_event(), and ub_resolve_event().

◆ next_querynum

int ub_ctx::next_querynum

next query number (to try) to use

Referenced by find_id().

◆ num_async

◆ 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: