Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 550bbe86d83a7870fdddc73c68e5d2b2 > files > 186

libunbound-devel-1.3.4-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>unbound: libunbound/libunbound.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_fc3ea7a5a61a7a52c4b5d946cda53628.html">libunbound</a>
  </div>
</div>
<div class="contents">
<h1>libunbound.c File Reference</h1>This file contains functions to resolve DNS queries and validate the answers.  
<a href="#_details">More...</a>
<p>
<code>#include &quot;<a class="el" href="unbound_8h.html">libunbound/unbound.h</a>&quot;</code><br>
<code>#include &quot;config.h&quot;</code><br>
<code>#include &quot;<a class="el" href="context_8h.html">libunbound/context.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="libworker_8h.html">libunbound/libworker.h</a>&quot;</code><br>
<code>#include &quot;util/locks.h&quot;</code><br>
<code>#include &quot;<a class="el" href="config__file_8h.html">util/config_file.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="alloc_8h.html">util/alloc.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="module_8h.html">util/module.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="regional_8h.html">util/regional.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="log_8h.html">util/log.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="random_8h.html">util/random.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="net__help_8h.html">util/net_help.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="tube_8h.html">util/tube.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="modstack_8h.html">services/modstack.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="localzone_8h.html">services/localzone.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="infra_8h.html">services/cache/infra.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="rrset_8h.html">services/cache/rrset.h</a>&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#c5d6dac9426cf18b3ca59d2a7b3bef67">ub_ctx_create</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a resolving and validation context.  <a href="#c5d6dac9426cf18b3ca59d2a7b3bef67"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="278c04709b164e86c0214dcd05a8b5f9"></a><!-- doxytag: member="libunbound.c::delq" ref="278c04709b164e86c0214dcd05a8b5f9" args="(rbnode_t *n, void *arg)" -->
static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#278c04709b164e86c0214dcd05a8b5f9">delq</a> (<a class="el" href="structrbnode__t.html">rbnode_t</a> *n, void *arg)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">delete q <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#1f10e004c7856ecf672e3206059b3c61">ub_ctx_delete</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destroy a validation context and free all its resources.  <a href="#1f10e004c7856ecf672e3206059b3c61"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#c296db7be2c82d230bf4dd70aa9a0d1f">ub_ctx_set_option</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *opt, char *val)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set an option for the context.  <a href="#c296db7be2c82d230bf4dd70aa9a0d1f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#860ad85b51c64507f745706ad05e7d7b">ub_ctx_config</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *fname)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">setup configuration for the given context.  <a href="#860ad85b51c64507f745706ad05e7d7b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#e685373bfa94a7f8b9558809d4e1dd13">ub_ctx_add_ta</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *ta)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add a trust anchor to the given context.  <a href="#e685373bfa94a7f8b9558809d4e1dd13"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#9fcba73cc60742365dec62f98267a939">ub_ctx_add_ta_file</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *fname)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add trust anchors to the given context.  <a href="#9fcba73cc60742365dec62f98267a939"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#0af6ff07a32a3f09d422817b36a7b44b">ub_ctx_trustedkeys</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *fname)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add trust anchors to the given context.  <a href="#0af6ff07a32a3f09d422817b36a7b44b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#bf46c727526178ccf4d9366ceb1a4273">ub_ctx_debuglevel</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, int d)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set debug verbosity for the context Output is directed to stderr.  <a href="#bf46c727526178ccf4d9366ceb1a4273"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#157732b65b2658d292f4fb6c44854ace">ub_ctx_debugout</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, void *out)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set debug output (and error output) to the specified stream.  <a href="#157732b65b2658d292f4fb6c44854ace"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#43db4efad8f4b477b36e41de54b896f1">ub_ctx_async</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, int dothread)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set a context behaviour for asynchronous action.  <a href="#43db4efad8f4b477b36e41de54b896f1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#46fad658f6f3887a7b02a1235aabb35f">ub_poll</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Poll a context to see if it has any new results Do not poll in a loop, instead extract the fd below to poll for readiness, and then check, or wait using the wait routine.  <a href="#46fad658f6f3887a7b02a1235aabb35f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#b985cab9df7bf0147ea95d9badf7ca7e">ub_fd</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get file descriptor.  <a href="#b985cab9df7bf0147ea95d9badf7ca7e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1fa5bab9bc58263298cb790af70b1525"></a><!-- doxytag: member="libunbound.c::process_answer_detail" ref="1fa5bab9bc58263298cb790af70b1525" args="(struct ub_ctx *ctx, uint8_t *msg, uint32_t len, ub_callback_t *cb, void **cbarg, int *err, struct ub_result **res)" -->
static int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#1fa5bab9bc58263298cb790af70b1525">process_answer_detail</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, uint8_t *msg, uint32_t len, <a class="el" href="unbound_8h.html#1f287e8f89ab449223a593bb5545d54a">ub_callback_t</a> *cb, void **cbarg, int *err, struct <a class="el" href="structub__result.html">ub_result</a> **res)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">process answer from bg <a class="el" href="structworker.html" title="Structure holding working information for unbound.">worker</a> <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e4f39660779f618166561ea12bdd2a36"></a><!-- doxytag: member="libunbound.c::process_answer" ref="e4f39660779f618166561ea12bdd2a36" args="(struct ub_ctx *ctx, uint8_t *msg, uint32_t len)" -->
static int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#e4f39660779f618166561ea12bdd2a36">process_answer</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, uint8_t *msg, uint32_t len)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">process answer from bg <a class="el" href="structworker.html" title="Structure holding working information for unbound.">worker</a> <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#3c00823f938403236562169229ac0951">ub_process</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Call this routine to continue processing results from the validating resolver (when the fd becomes readable).  <a href="#3c00823f938403236562169229ac0951"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#4652ac120e8bb0d47aa6a55192770b37">ub_wait</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Wait for a context to finish with results.  <a href="#4652ac120e8bb0d47aa6a55192770b37"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#cd6059bfc4d177d0fb99cc608723ee37">ub_resolve</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *name, int rrtype, int rrclass, struct <a class="el" href="structub__result.html">ub_result</a> **result)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform resolution and validation of the target name.  <a href="#cd6059bfc4d177d0fb99cc608723ee37"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#973daeff0ad5cd2102160782cf400f20">ub_resolve_async</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *name, int rrtype, int rrclass, void *mydata, <a class="el" href="unbound_8h.html#1f287e8f89ab449223a593bb5545d54a">ub_callback_t</a> callback, int *async_id)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform resolution and validation of the target name.  <a href="#973daeff0ad5cd2102160782cf400f20"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#7589f23fbf637d94d54aac05ffad8aaf">ub_cancel</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, int async_id)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Cancel an async query in progress.  <a href="#7589f23fbf637d94d54aac05ffad8aaf"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#576ffffb14d64f370db9673024999a37">ub_resolve_free</a> (struct <a class="el" href="structub__result.html">ub_result</a> *result)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Free storage associated with a result structure.  <a href="#576ffffb14d64f370db9673024999a37"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#3b2c4a03359def73812a33b455f42a7e">ub_strerror</a> (int err)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Convert error value to a human readable string.  <a href="#3b2c4a03359def73812a33b455f42a7e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#1db6c2895f16b68d5449f7028c546eca">ub_ctx_set_fwd</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *addr)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set machine to forward DNS queries to, the caching resolver to use.  <a href="#1db6c2895f16b68d5449f7028c546eca"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#22c6cd628bb23e714c36d970a37223b3">ub_ctx_resolvconf</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *fname)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read list of nameservers to use from the filename given.  <a href="#22c6cd628bb23e714c36d970a37223b3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#e8feb715f298d5d47f8988aec7784826">ub_ctx_hosts</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *fname)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read list of hosts from the filename given.  <a href="#e8feb715f298d5d47f8988aec7784826"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ff3bc8e15257cac957e79b4aa9e366fe"></a><!-- doxytag: member="libunbound.c::ub_ctx_finalize" ref="ff3bc8e15257cac957e79b4aa9e366fe" args="(struct ub_ctx *ctx)" -->
static int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#ff3bc8e15257cac957e79b4aa9e366fe">ub_ctx_finalize</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">finalize the context, if not already finalized <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#87db974a1f34be98e7bda7c9046b5d97">ub_ctx_print_local_zones</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Debug routine.  <a href="#87db974a1f34be98e7bda7c9046b5d97"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#31e98853932d432c7156ecb804766898">ub_ctx_zone_add</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *zone_name, char *zone_type)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add a new zone with the zonetype to the local authority info of the library.  <a href="#31e98853932d432c7156ecb804766898"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#30234b19e015233d8e2111ebec3adbc1">ub_ctx_zone_remove</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *zone_name)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Remove zone from local authority info of the library.  <a href="#30234b19e015233d8e2111ebec3adbc1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#992366bb56ef091e0b53f044a12785da">ub_ctx_data_add</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *data)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add localdata to the library local authority info.  <a href="#992366bb56ef091e0b53f044a12785da"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="libunbound_8c.html#ced50b3598a142264577826c137f481c">ub_ctx_data_remove</a> (struct <a class="el" href="structub__ctx.html">ub_ctx</a> *ctx, char *data)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Remove localdata from the library local authority info.  <a href="#ced50b3598a142264577826c137f481c"></a><br></td></tr>
</table>
<hr><h2>Detailed Description</h2>
This file contains functions to resolve DNS queries and validate the answers. 
<p>
Synchonously and asynchronously. <hr><h2>Function Documentation</h2>
<a class="anchor" name="c5d6dac9426cf18b3ca59d2a7b3bef67"></a><!-- doxytag: member="libunbound.c::ub_ctx_create" ref="c5d6dac9426cf18b3ca59d2a7b3bef67" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structub__ctx.html">ub_ctx</a>* ub_ctx_create           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Create a resolving and validation context. 
<p>
The information from /etc/resolv.conf and /etc/hosts is not utilised by default. Use ub_ctx_resolvconf and ub_ctx_hosts to read them. <dl class="return" compact><dt><b>Returns:</b></dt><dd>a new context. default initialisation. returns NULL on error. </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00194">module_env::alloc</a>, <a class="el" href="alloc_8c_source.html#l00097">alloc_init()</a>, <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="config__file_8c_source.html#l00188">config_create_forlib()</a>, <a class="el" href="worker_8c_source.html#l01263">context_query_cmp()</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="log_8c_source.html#l00241">log_err()</a>, <a class="el" href="log_8c_source.html#l00145">log_ident_set()</a>, <a class="el" href="log_8c_source.html#l00081">log_init()</a>, <a class="el" href="context_8h_source.html#l00108">ub_ctx::mods</a>, <a class="el" href="modstack_8c_source.html#l00074">modstack_init()</a>, <a class="el" href="module_8h_source.html#l00203">module_env::need_to_validate</a>, <a class="el" href="context_8h_source.html#l00064">ub_ctx::qq_pipe</a>, <a class="el" href="context_8h_source.html#l00062">ub_ctx::qqpipe_lock</a>, <a class="el" href="context_8h_source.html#l00125">ub_ctx::queries</a>, <a class="el" href="rbtree_8c_source.html#l00094">rbtree_init()</a>, <a class="el" href="context_8h_source.html#l00068">ub_ctx::rr_pipe</a>, <a class="el" href="context_8h_source.html#l00066">ub_ctx::rrpipe_lock</a>, <a class="el" href="context_8h_source.html#l00112">ub_ctx::seed_rnd</a>, <a class="el" href="context_8h_source.html#l00104">ub_ctx::superalloc</a>, <a class="el" href="tube_8c_source.html#l00051">tube_create()</a>, <a class="el" href="tube_8c_source.html#l00082">tube_delete()</a>, <a class="el" href="random_8c_source.html#l00154">ub_initstate()</a>, <a class="el" href="random_8c_source.html#l00181">ub_randfree()</a>, <a class="el" href="log_8c_source.html#l00062">verbosity</a>, and <a class="el" href="module_8h_source.html#l00190">module_env::worker</a>.</p>

<p>Referenced by <a class="el" href="anchor-update_8c_source.html#l00116">do_update()</a>, and <a class="el" href="unbound-host_8c_source.html#l00403">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="1f10e004c7856ecf672e3206059b3c61"></a><!-- doxytag: member="libunbound.c::ub_ctx_delete" ref="1f10e004c7856ecf672e3206059b3c61" args="(struct ub_ctx *ctx)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ub_ctx_delete           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Destroy a validation context and free all its resources. 
<p>
Outstanding async queries are killed and callbacks are not called for them. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context to delete. </td></tr>
  </table>
</dl>

<p>References <a class="el" href="alloc_8c_source.html#l00124">alloc_clear()</a>, <a class="el" href="context_8h_source.html#l00101">ub_ctx::alloc_list</a>, <a class="el" href="context_8h_source.html#l00085">ub_ctx::bg_tid</a>, <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="config__file_8c_source.html#l00511">config_delete()</a>, <a class="el" href="context_8c_source.html#l00371">context_serial_getcmd()</a>, <a class="el" href="context_8h_source.html#l00081">ub_ctx::created_bg</a>, <a class="el" href="libunbound_8c_source.html#l00146">delq()</a>, <a class="el" href="context_8h_source.html#l00088">ub_ctx::dothread</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="module_8h_source.html#l00079">module_env::infra_cache</a>, <a class="el" href="infra_8c_source.html#l00107">infra_delete()</a>, <a class="el" href="context_8h_source.html#l00110">ub_ctx::local_zones</a>, <a class="el" href="localzone_8c_source.html#l00075">local_zones_delete()</a>, <a class="el" href="context_8h_source.html#l00108">ub_ctx::mods</a>, <a class="el" href="modstack_8c_source.html#l00190">modstack_desetup()</a>, <a class="el" href="module_8h_source.html#l00075">module_env::msg_cache</a>, <a class="el" href="context_8h_source.html#l00064">ub_ctx::qq_pipe</a>, <a class="el" href="context_8h_source.html#l00062">ub_ctx::qqpipe_lock</a>, <a class="el" href="context_8h_source.html#l00125">ub_ctx::queries</a>, <a class="el" href="context_8h_source.html#l00068">ub_ctx::rr_pipe</a>, <a class="el" href="context_8h_source.html#l00066">ub_ctx::rrpipe_lock</a>, <a class="el" href="module_8h_source.html#l00077">module_env::rrset_cache</a>, <a class="el" href="rrset_8c_source.html#l00071">rrset_cache_delete()</a>, <a class="el" href="context_8h_source.html#l00112">ub_ctx::seed_rnd</a>, <a class="el" href="slabhash_8c_source.html#l00087">slabhash_delete()</a>, <a class="el" href="alloc_8h_source.html#l00076">alloc_cache::super</a>, <a class="el" href="context_8h_source.html#l00104">ub_ctx::superalloc</a>, <a class="el" href="rbtree_8c_source.html#l00617">traverse_postorder()</a>, <a class="el" href="tube_8c_source.html#l00082">tube_delete()</a>, <a class="el" href="tube_8c_source.html#l00317">tube_read_msg()</a>, <a class="el" href="tube_8c_source.html#l00281">tube_write_msg()</a>, <a class="el" href="context_8h_source.html#l00202">UB_LIBCMD_QUIT</a>, and <a class="el" href="random_8c_source.html#l00181">ub_randfree()</a>.</p>

<p>Referenced by <a class="el" href="anchor-update_8c_source.html#l00116">do_update()</a>, <a class="el" href="asynclook_8c_source.html#l00334">ext_test()</a>, <a class="el" href="unbound-host_8c_source.html#l00364">lookup()</a>, and <a class="el" href="asynclook_8c_source.html#l00366">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="c296db7be2c82d230bf4dd70aa9a0d1f"></a><!-- doxytag: member="libunbound.c::ub_ctx_set_option" ref="c296db7be2c82d230bf4dd70aa9a0d1f" args="(struct ub_ctx *ctx, char *opt, char *val)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_set_option           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>opt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>val</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set an option for the context. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>opt,:</em>&nbsp;</td><td>option name from the unbound.conf config file format. (not all settings applicable). The name includes the trailing ':' for example ub_ctx_set_option("logfile:", "mylog.txt"); This is a power-users interface that lets you specify all sorts of options. For some specific options, such as adding trust anchors, special routines exist. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>val,:</em>&nbsp;</td><td>value of the option. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>: 0 if OK, else error. </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="config__file_8c_source.html#l00226">config_set_option()</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="context_8h_source.html#l00181">UB_AFTERFINAL</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00175">UB_SYNTAX</a>.</p>

<p>Referenced by <a class="el" href="unbound-host_8c_source.html#l00403">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="860ad85b51c64507f745706ad05e7d7b"></a><!-- doxytag: member="libunbound.c::ub_ctx_config" ref="860ad85b51c64507f745706ad05e7d7b" args="(struct ub_ctx *ctx, char *fname)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_config           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>fname</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
setup configuration for the given context. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>fname,:</em>&nbsp;</td><td>unbound config file (not all settings applicable). This is a power-users interface that lets you specify all sorts of options. For some specific options, such as adding trust anchors, special routines exist. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>: 0 if OK, else error. </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="config__file_8c_source.html#l00446">config_read()</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="context_8h_source.html#l00181">UB_AFTERFINAL</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00175">UB_SYNTAX</a>.</p>

<p>Referenced by <a class="el" href="unbound-host_8c_source.html#l00403">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="e685373bfa94a7f8b9558809d4e1dd13"></a><!-- doxytag: member="libunbound.c::ub_ctx_add_ta" ref="e685373bfa94a7f8b9558809d4e1dd13" args="(struct ub_ctx *ctx, char *ta)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_add_ta           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>ta</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add a trust anchor to the given context. 
<p>
The trust anchor is a string, on one line, that holds a valid DNSKEY or DS RR. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. At this time it is only possible to add trusted keys before the first resolve is done. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>ta,:</em>&nbsp;</td><td>string, with zone-format RR on one line. [domainname] [TTL optional] [type] [class optional] [rdata contents] </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="config__file_8c_source.html#l00687">cfg_strlist_insert()</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="config__file_8h_source.html#l00192">config_file::trust_anchor_list</a>, <a class="el" href="context_8h_source.html#l00181">UB_AFTERFINAL</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>.</p>

<p>Referenced by <a class="el" href="unbound-host_8c_source.html#l00403">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="9fcba73cc60742365dec62f98267a939"></a><!-- doxytag: member="libunbound.c::ub_ctx_add_ta_file" ref="9fcba73cc60742365dec62f98267a939" args="(struct ub_ctx *ctx, char *fname)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_add_ta_file           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>fname</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add trust anchors to the given context. 
<p>
Pass name of a file with DS and DNSKEY records (like from dig or drill). <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. At this time it is only possible to add trusted keys before the first resolve is done. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>fname,:</em>&nbsp;</td><td>filename of file with keyfile with trust anchors. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="config__file_8c_source.html#l00687">cfg_strlist_insert()</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="config__file_8h_source.html#l00190">config_file::trust_anchor_file_list</a>, <a class="el" href="context_8h_source.html#l00181">UB_AFTERFINAL</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>.</p>

<p>Referenced by <a class="el" href="anchor-update_8c_source.html#l00116">do_update()</a>, and <a class="el" href="unbound-host_8c_source.html#l00403">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="0af6ff07a32a3f09d422817b36a7b44b"></a><!-- doxytag: member="libunbound.c::ub_ctx_trustedkeys" ref="0af6ff07a32a3f09d422817b36a7b44b" args="(struct ub_ctx *ctx, char *fname)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_trustedkeys           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>fname</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add trust anchors to the given context. 
<p>
Pass the name of a bind-style config file with trusted-keys{}. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. At this time it is only possible to add trusted keys before the first resolve is done. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>fname,:</em>&nbsp;</td><td>filename of file with bind-style config entries with trust anchors. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="config__file_8c_source.html#l00687">cfg_strlist_insert()</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="config__file_8h_source.html#l00194">config_file::trusted_keys_file_list</a>, <a class="el" href="context_8h_source.html#l00181">UB_AFTERFINAL</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>.</p>

<p>Referenced by <a class="el" href="unbound-host_8c_source.html#l00403">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="bf46c727526178ccf4d9366ceb1a4273"></a><!-- doxytag: member="libunbound.c::ub_ctx_debuglevel" ref="bf46c727526178ccf4d9366ceb1a4273" args="(struct ub_ctx *ctx, int d)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_debuglevel           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>d</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set debug verbosity for the context Output is directed to stderr. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>d,:</em>&nbsp;</td><td>debug level, 0 is off, 1 is very minimal, 2 is detailed, and 3 is lots. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, <a class="el" href="config__file_8h_source.html#l00054">config_file::verbosity</a>, and <a class="el" href="log_8c_source.html#l00062">verbosity</a>.</p>

<p>Referenced by <a class="el" href="unbound-host_8c_source.html#l00403">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="157732b65b2658d292f4fb6c44854ace"></a><!-- doxytag: member="libunbound.c::ub_ctx_debugout" ref="157732b65b2658d292f4fb6c44854ace" args="(struct ub_ctx *ctx, void *out)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_debugout           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&nbsp;</td>
          <td class="paramname"> <em>out</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set debug output (and error output) to the specified stream. 
<p>
Pass NULL to disable. Default is stderr. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>out,:</em>&nbsp;</td><td>FILE* out file stream to log to. Type void* to avoid stdio dependency of this header file. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="log_8c_source.html#l00135">log_file()</a>, <a class="el" href="context_8h_source.html#l00094">ub_ctx::log_out</a>, <a class="el" href="context_8h_source.html#l00092">ub_ctx::logfile_override</a>, and <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>.</p>

</div>
</div><p>
<a class="anchor" name="43db4efad8f4b477b36e41de54b896f1"></a><!-- doxytag: member="libunbound.c::ub_ctx_async" ref="43db4efad8f4b477b36e41de54b896f1" args="(struct ub_ctx *ctx, int dothread)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_async           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>dothread</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set a context behaviour for asynchronous action. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>dothread,:</em>&nbsp;</td><td>if true, enables threading and a call to resolve_async() creates a thread to handle work in the background. If false, a process is forked to handle work in the background. Changes to this setting after async() calls have been made have no effect (delete and re-create the context to change). </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8h_source.html#l00088">ub_ctx::dothread</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="context_8h_source.html#l00181">UB_AFTERFINAL</a>, and <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>.</p>

<p>Referenced by <a class="el" href="asynclook_8c_source.html#l00366">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="46fad658f6f3887a7b02a1235aabb35f"></a><!-- doxytag: member="libunbound.c::ub_poll" ref="46fad658f6f3887a7b02a1235aabb35f" args="(struct ub_ctx *ctx)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_poll           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Poll a context to see if it has any new results Do not poll in a loop, instead extract the fd below to poll for readiness, and then check, or wait using the wait routine. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>: 0 if nothing to read, or nonzero if a result is available. If nonzero, call ctx_process() to do callbacks. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00068">ub_ctx::rr_pipe</a>, and <a class="el" href="tube_8c_source.html#l00390">tube_poll()</a>.</p>

</div>
</div><p>
<a class="anchor" name="b985cab9df7bf0147ea95d9badf7ca7e"></a><!-- doxytag: member="libunbound.c::ub_fd" ref="b985cab9df7bf0147ea95d9badf7ca7e" args="(struct ub_ctx *ctx)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_fd           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Get file descriptor. 
<p>
Wait for it to become readable, at this point answers are returned from the asynchronous validating resolver. Then call the ub_process to continue processing. This routine works immediately after context creation, the fd does not change. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>: -1 on error, or file descriptor to use select(2) with. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00068">ub_ctx::rr_pipe</a>, and <a class="el" href="tube_8c_source.html#l00402">tube_read_fd()</a>.</p>

</div>
</div><p>
<a class="anchor" name="3c00823f938403236562169229ac0951"></a><!-- doxytag: member="libunbound.c::ub_process" ref="3c00823f938403236562169229ac0951" args="(struct ub_ctx *ctx)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_process           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Call this routine to continue processing results from the validating resolver (when the fd becomes readable). 
<p>
Will perform necessary callbacks. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>: 0 if OK, else error. </dd></dl>

<p>References <a class="el" href="unbound_8h_source.html#l00127">ub_result::len</a>, <a class="el" href="libunbound_8c_source.html#l00431">process_answer()</a>, <a class="el" href="context_8h_source.html#l00068">ub_ctx::rr_pipe</a>, <a class="el" href="context_8h_source.html#l00066">ub_ctx::rrpipe_lock</a>, <a class="el" href="tube_8c_source.html#l00317">tube_read_msg()</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00185">UB_PIPE</a>.</p>

<p>Referenced by <a class="el" href="asynclook_8c_source.html#l00366">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="4652ac120e8bb0d47aa6a55192770b37"></a><!-- doxytag: member="libunbound.c::ub_wait" ref="4652ac120e8bb0d47aa6a55192770b37" args="(struct ub_ctx *ctx)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_wait           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Wait for a context to finish with results. 
<p>
Calls <a class="el" href="libunbound_8c.html#3c00823f938403236562169229ac0951" title="Call this routine to continue processing results from the validating resolver (when...">ub_process()</a> after the wait for you. After the wait, there are no more outstanding asynchronous queries. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>: 0 if OK, else error. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="unbound_8h_source.html#l00127">ub_result::len</a>, <a class="el" href="context_8h_source.html#l00117">ub_ctx::num_async</a>, <a class="el" href="libunbound_8c_source.html#l00366">process_answer_detail()</a>, <a class="el" href="context_8h_source.html#l00068">ub_ctx::rr_pipe</a>, <a class="el" href="context_8h_source.html#l00066">ub_ctx::rrpipe_lock</a>, <a class="el" href="tube_8c_source.html#l00317">tube_read_msg()</a>, <a class="el" href="tube_8c_source.html#l00397">tube_wait()</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00185">UB_PIPE</a>.</p>

<p>Referenced by <a class="el" href="asynclook_8c_source.html#l00276">ext_thread()</a>.</p>

</div>
</div><p>
<a class="anchor" name="cd6059bfc4d177d0fb99cc608723ee37"></a><!-- doxytag: member="libunbound.c::ub_resolve" ref="cd6059bfc4d177d0fb99cc608723ee37" args="(struct ub_ctx *ctx, char *name, int rrtype, int rrclass, struct ub_result **result)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_resolve           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>rrtype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>rrclass</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structub__result.html">ub_result</a> **&nbsp;</td>
          <td class="paramname"> <em>result</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Perform resolution and validation of the target name. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. The context is finalized, and can no longer accept config changes. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>name,:</em>&nbsp;</td><td>domain name in text format (a zero terminated text string). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>rrtype,:</em>&nbsp;</td><td>type of RR in host order, 1 is A (address). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>rrclass,:</em>&nbsp;</td><td>class of RR in host order, 1 is IN (for internet). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>result,:</em>&nbsp;</td><td>the result data is returned in a newly allocated result structure. May be NULL on return, return value is set to an error in that case (out of memory). </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="unbound_8h_source.html#l00147">ub_result::answer_len</a>, <a class="el" href="unbound_8h_source.html#l00145">ub_result::answer_packet</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8c_source.html#l00054">context_finalize()</a>, <a class="el" href="context_8c_source.html#l00127">context_new()</a>, <a class="el" href="context_8c_source.html#l00101">context_query_delete()</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="rbtree_8h_source.html#l00063">rbnode_t::key</a>, <a class="el" href="libworker_8c_source.html#l00497">libworker_fg()</a>, <a class="el" href="context_8h_source.html#l00150">ctx_query::msg</a>, <a class="el" href="context_8h_source.html#l00152">ctx_query::msg_len</a>, <a class="el" href="context_8h_source.html#l00136">ctx_query::node</a>, <a class="el" href="context_8h_source.html#l00125">ub_ctx::queries</a>, <a class="el" href="rbtree_8c_source.html#l00326">rbtree_delete()</a>, <a class="el" href="context_8h_source.html#l00160">ctx_query::res</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>.</p>

<p>Referenced by <a class="el" href="unbound-host_8c_source.html#l00346">dnslook()</a>, <a class="el" href="anchor-update_8c_source.html#l00063">do_lookup()</a>, <a class="el" href="asynclook_8c_source.html#l00276">ext_thread()</a>, <a class="el" href="asynclook_8c_source.html#l00366">main()</a>, and <a class="el" href="harvest_8c_source.html#l00465">process()</a>.</p>

</div>
</div><p>
<a class="anchor" name="973daeff0ad5cd2102160782cf400f20"></a><!-- doxytag: member="libunbound.c::ub_resolve_async" ref="973daeff0ad5cd2102160782cf400f20" args="(struct ub_ctx *ctx, char *name, int rrtype, int rrclass, void *mydata, ub_callback_t callback, int *async_id)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_resolve_async           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>rrtype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>rrclass</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&nbsp;</td>
          <td class="paramname"> <em>mydata</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="unbound_8h.html#1f287e8f89ab449223a593bb5545d54a">ub_callback_t</a>&nbsp;</td>
          <td class="paramname"> <em>callback</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>async_id</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Perform resolution and validation of the target name. 
<p>
Asynchronous, after a while, the callback will be called with your data and the result. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. If no thread or process has been created yet to perform the work in the background, it is created now. The context is finalized, and can no longer accept config changes. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>name,:</em>&nbsp;</td><td>domain name in text format (a string). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>rrtype,:</em>&nbsp;</td><td>type of RR in host order, 1 is A. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>rrclass,:</em>&nbsp;</td><td>class of RR in host order, 1 is IN (for internet). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>mydata,:</em>&nbsp;</td><td>this data is your own data (you can pass NULL), and is passed on to the callback function. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>callback,:</em>&nbsp;</td><td>this is called on completion of the resolution. It is called as: void callback(void* mydata, int err, struct ub_result* result) with mydata: the same as passed here, you may pass NULL, with err: is 0 when a result has been found. with result: a newly allocated result structure. The result may be NULL, in that case err is set.</td></tr>
  </table>
</dl>
If an error happens during processing, your callback will be called with error set to a nonzero value (and result==NULL). <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>async_id,:</em>&nbsp;</td><td>if you pass a non-NULL value, an identifier number is returned for the query as it is in progress. It can be used to cancel the query. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8c_source.html#l00054">context_finalize()</a>, <a class="el" href="context_8c_source.html#l00127">context_new()</a>, <a class="el" href="context_8c_source.html#l00101">context_query_delete()</a>, <a class="el" href="context_8c_source.html#l00209">context_serialize_new_query()</a>, <a class="el" href="context_8h_source.html#l00081">ub_ctx::created_bg</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="rbtree_8h_source.html#l00063">rbnode_t::key</a>, <a class="el" href="libworker_8c_source.html#l00303">libworker_bg()</a>, <a class="el" href="context_8h_source.html#l00150">ctx_query::msg</a>, <a class="el" href="context_8h_source.html#l00136">ctx_query::node</a>, <a class="el" href="context_8h_source.html#l00117">ub_ctx::num_async</a>, <a class="el" href="context_8h_source.html#l00064">ub_ctx::qq_pipe</a>, <a class="el" href="context_8h_source.html#l00062">ub_ctx::qqpipe_lock</a>, <a class="el" href="context_8h_source.html#l00125">ub_ctx::queries</a>, <a class="el" href="context_8h_source.html#l00138">ctx_query::querynum</a>, <a class="el" href="rbtree_8c_source.html#l00326">rbtree_delete()</a>, <a class="el" href="tube_8c_source.html#l00281">tube_write_msg()</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>, and <a class="el" href="context_8h_source.html#l00185">UB_PIPE</a>.</p>

<p>Referenced by <a class="el" href="asynclook_8c_source.html#l00276">ext_thread()</a>, and <a class="el" href="asynclook_8c_source.html#l00366">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="7589f23fbf637d94d54aac05ffad8aaf"></a><!-- doxytag: member="libunbound.c::ub_cancel" ref="7589f23fbf637d94d54aac05ffad8aaf" args="(struct ub_ctx *ctx, int async_id)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_cancel           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>async_id</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Cancel an async query in progress. 
<p>
Its callback will not be called.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>async_id,:</em>&nbsp;</td><td>which query to cancel. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. This routine can return an error if the async_id passed does not exist or has already been delivered. If another thread is processing results at the same time, the result may be delivered at the same time and the cancel fails with an error. Also the cancel can fail due to a system error, no memory or socket failures. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00140">ctx_query::async</a>, <a class="el" href="context_8h_source.html#l00142">ctx_query::cancelled</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8c_source.html#l00101">context_query_delete()</a>, <a class="el" href="context_8c_source.html#l00335">context_serialize_cancel()</a>, <a class="el" href="context_8h_source.html#l00088">ub_ctx::dothread</a>, <a class="el" href="rbtree_8h_source.html#l00063">rbnode_t::key</a>, <a class="el" href="log_8h_source.html#l00185">log_assert</a>, <a class="el" href="context_8h_source.html#l00150">ctx_query::msg</a>, <a class="el" href="context_8h_source.html#l00136">ctx_query::node</a>, <a class="el" href="context_8h_source.html#l00117">ub_ctx::num_async</a>, <a class="el" href="context_8h_source.html#l00064">ub_ctx::qq_pipe</a>, <a class="el" href="context_8h_source.html#l00062">ub_ctx::qqpipe_lock</a>, <a class="el" href="context_8h_source.html#l00125">ub_ctx::queries</a>, <a class="el" href="rbtree_8c_source.html#l00326">rbtree_delete()</a>, <a class="el" href="rbtree_8c_source.html#l00280">rbtree_search()</a>, <a class="el" href="tube_8c_source.html#l00281">tube_write_msg()</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, <a class="el" href="context_8h_source.html#l00189">UB_NOID</a>, <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>, and <a class="el" href="context_8h_source.html#l00185">UB_PIPE</a>.</p>

<p>Referenced by <a class="el" href="asynclook_8c_source.html#l00276">ext_thread()</a>, and <a class="el" href="asynclook_8c_source.html#l00366">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="576ffffb14d64f370db9673024999a37"></a><!-- doxytag: member="libunbound.c::ub_resolve_free" ref="576ffffb14d64f370db9673024999a37" args="(struct ub_result *result)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ub_resolve_free           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__result.html">ub_result</a> *&nbsp;</td>
          <td class="paramname"> <em>result</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Free storage associated with a result structure. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>result,:</em>&nbsp;</td><td>to free </td></tr>
  </table>
</dl>

<p>References <a class="el" href="unbound_8h_source.html#l00145">ub_result::answer_packet</a>, <a class="el" href="unbound_8h_source.html#l00134">ub_result::canonname</a>, <a class="el" href="unbound_8h_source.html#l00124">ub_result::data</a>, <a class="el" href="unbound_8h_source.html#l00127">ub_result::len</a>, and <a class="el" href="unbound_8h_source.html#l00112">ub_result::qname</a>.</p>

<p>Referenced by <a class="el" href="context_8c_source.html#l00101">context_query_delete()</a>, <a class="el" href="unbound-host_8c_source.html#l00346">dnslook()</a>, <a class="el" href="anchor-update_8c_source.html#l00116">do_update()</a>, <a class="el" href="asynclook_8c_source.html#l00245">ext_callback()</a>, <a class="el" href="asynclook_8c_source.html#l00276">ext_thread()</a>, <a class="el" href="asynclook_8c_source.html#l00366">main()</a>, <a class="el" href="harvest_8c_source.html#l00465">process()</a>, and <a class="el" href="libunbound_8c_source.html#l00366">process_answer_detail()</a>.</p>

</div>
</div><p>
<a class="anchor" name="3b2c4a03359def73812a33b455f42a7e"></a><!-- doxytag: member="libunbound.c::ub_strerror" ref="3b2c4a03359def73812a33b455f42a7e" args="(int err)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char* ub_strerror           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>err</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Convert error value to a human readable string. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>err,:</em>&nbsp;</td><td>error code from one of the ub_val* functions. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to constant text string, zero terminated. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00181">UB_AFTERFINAL</a>, <a class="el" href="context_8h_source.html#l00179">UB_FORKFAIL</a>, <a class="el" href="context_8h_source.html#l00183">UB_INITFAIL</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, <a class="el" href="context_8h_source.html#l00189">UB_NOID</a>, <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>, <a class="el" href="context_8h_source.html#l00185">UB_PIPE</a>, <a class="el" href="context_8h_source.html#l00187">UB_READFILE</a>, <a class="el" href="context_8h_source.html#l00177">UB_SERVFAIL</a>, <a class="el" href="context_8h_source.html#l00171">UB_SOCKET</a>, and <a class="el" href="context_8h_source.html#l00175">UB_SYNTAX</a>.</p>

<p>Referenced by <a class="el" href="unbound-host_8c_source.html#l00389">check_ub_res()</a>, <a class="el" href="asynclook_8c_source.html#l00135">checkerr()</a>, <a class="el" href="unbound-host_8c_source.html#l00346">dnslook()</a>, <a class="el" href="anchor-update_8c_source.html#l00063">do_lookup()</a>, <a class="el" href="anchor-update_8c_source.html#l00116">do_update()</a>, <a class="el" href="asynclook_8c_source.html#l00366">main()</a>, <a class="el" href="asynclook_8c_source.html#l00095">print_result()</a>, and <a class="el" href="harvest_8c_source.html#l00465">process()</a>.</p>

</div>
</div><p>
<a class="anchor" name="1db6c2895f16b68d5449f7028c546eca"></a><!-- doxytag: member="libunbound.c::ub_ctx_set_fwd" ref="1db6c2895f16b68d5449f7028c546eca" args="(struct ub_ctx *ctx, char *addr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_set_fwd           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>addr</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set machine to forward DNS queries to, the caching resolver to use. 
<p>
IP4 or IP6 address. Forwards all DNS requests to that machine, which is expected to run a recursive resolver. If the <a class="el" href="structproxy.html" title="List of proxy fds that return replies from the server to our clients.">proxy</a> is not DNSSEC-capable, validation may fail. Can be called several times, in that case the addresses are used as backup servers.<p>
To read the list of nameservers from /etc/resolv.conf (from DHCP or so), use the call ub_ctx_resolvconf.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. At this time it is only possible to set configuration before the first resolve is done. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>addr,:</em>&nbsp;</td><td>address, IP4 or IP6 in string format. If the addr is NULL, forwarding is disabled. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="config__file_8h_source.html#l00270">config_stub::addrs</a>, <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="config__file_8c_source.html#l00687">cfg_strlist_insert()</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="config__file_8c_source.html#l00497">config_delstubs()</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="net__help_8c_source.html#l00180">extstrtoaddr()</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="config__file_8h_source.html#l00134">config_file::forwards</a>, <a class="el" href="log_8h_source.html#l00185">log_assert</a>, <a class="el" href="config__file_8h_source.html#l00266">config_stub::name</a>, <a class="el" href="config__file_8h_source.html#l00264">config_stub::next</a>, <a class="el" href="context_8h_source.html#l00181">UB_AFTERFINAL</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>, and <a class="el" href="context_8h_source.html#l00175">UB_SYNTAX</a>.</p>

<p>Referenced by <a class="el" href="asynclook_8c_source.html#l00366">main()</a>, and <a class="el" href="libunbound_8c_source.html#l00784">ub_ctx_resolvconf()</a>.</p>

</div>
</div><p>
<a class="anchor" name="22c6cd628bb23e714c36d970a37223b3"></a><!-- doxytag: member="libunbound.c::ub_ctx_resolvconf" ref="22c6cd628bb23e714c36d970a37223b3" args="(struct ub_ctx *ctx, char *fname)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_resolvconf           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>fname</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read list of nameservers to use from the filename given. 
<p>
Usually "/etc/resolv.conf". Uses those nameservers as caching proxies. If they do not support DNSSEC, validation may fail.<p>
Only nameservers are picked up, the searchdomain, ndots and other settings from resolv.conf(5) are ignored.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. At this time it is only possible to set configuration before the first resolve is done. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>fname,:</em>&nbsp;</td><td>file name string. If NULL "/etc/resolv.conf" is used. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="libunbound_8c_source.html#l00712">ub_ctx_set_fwd()</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00187">UB_READFILE</a>.</p>

<p>Referenced by <a class="el" href="unbound-host_8c_source.html#l00403">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="e8feb715f298d5d47f8988aec7784826"></a><!-- doxytag: member="libunbound.c::ub_ctx_hosts" ref="e8feb715f298d5d47f8988aec7784826" args="(struct ub_ctx *ctx, char *fname)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_hosts           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>fname</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read list of hosts from the filename given. 
<p>
Usually "/etc/hosts". These addresses are not flagged as DNSSEC secure when queried for.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. At this time it is only possible to set configuration before the first resolve is done. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>fname,:</em>&nbsp;</td><td>file name string. If NULL "/etc/hosts" is used. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="config__file_8c_source.html#l00687">cfg_strlist_insert()</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="context_8h_source.html#l00078">ub_ctx::finalized</a>, <a class="el" href="config__file_8h_source.html#l00235">config_file::local_data</a>, <a class="el" href="config__file_8h_source.html#l00266">config_stub::name</a>, <a class="el" href="net__help_8c_source.html#l00051">str_is_ip6()</a>, <a class="el" href="context_8h_source.html#l00181">UB_AFTERFINAL</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>, <a class="el" href="context_8h_source.html#l00187">UB_READFILE</a>, and <a class="el" href="context_8h_source.html#l00175">UB_SYNTAX</a>.</p>

<p>Referenced by <a class="el" href="asynclook_8c_source.html#l00366">main()</a>.</p>

</div>
</div><p>
<a class="anchor" name="87db974a1f34be98e7bda7c9046b5d97"></a><!-- doxytag: member="libunbound.c::ub_ctx_print_local_zones" ref="87db974a1f34be98e7bda7c9046b5d97" args="(struct ub_ctx *ctx)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_print_local_zones           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Debug routine. 
<p>
Print the local zone information to debug output. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. Is finalized by the routine. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00110">ub_ctx::local_zones</a>, <a class="el" href="localzone_8c_source.html#l00942">local_zones_print()</a>, <a class="el" href="libunbound_8c_source.html#l00911">ub_ctx_finalize()</a>, and <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>.</p>

</div>
</div><p>
<a class="anchor" name="31e98853932d432c7156ecb804766898"></a><!-- doxytag: member="libunbound.c::ub_ctx_zone_add" ref="31e98853932d432c7156ecb804766898" args="(struct ub_ctx *ctx, char *zone_name, char *zone_type)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_zone_add           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>zone_name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>zone_type</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add a new zone with the zonetype to the local authority info of the library. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. Is finalized by the routine. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>zone_name,:</em>&nbsp;</td><td>name of the zone in text, "example.com" If it already exists, the type is updated. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>zone_type,:</em>&nbsp;</td><td>type of the zone (like for unbound.conf) in text. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="localzone_8c_source.html#l01144">local_zone_str2type()</a>, <a class="el" href="context_8h_source.html#l00110">ub_ctx::local_zones</a>, <a class="el" href="localzone_8c_source.html#l01186">local_zones_add_zone()</a>, <a class="el" href="localzone_8c_source.html#l00914">local_zones_find()</a>, <a class="el" href="localzone_8h_source.html#l00106">local_zone::lock</a>, <a class="el" href="localzone_8h_source.html#l00078">local_zones::lock</a>, <a class="el" href="localzone_8c_source.html#l00124">parse_dname()</a>, <a class="el" href="localzone_8h_source.html#l00109">local_zone::type</a>, <a class="el" href="libunbound_8c_source.html#l00911">ub_ctx_finalize()</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>, and <a class="el" href="context_8h_source.html#l00175">UB_SYNTAX</a>.</p>

</div>
</div><p>
<a class="anchor" name="30234b19e015233d8e2111ebec3adbc1"></a><!-- doxytag: member="libunbound.c::ub_ctx_zone_remove" ref="30234b19e015233d8e2111ebec3adbc1" args="(struct ub_ctx *ctx, char *zone_name)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_zone_remove           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>zone_name</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Remove zone from local authority info of the library. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. Is finalized by the routine. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>zone_name,:</em>&nbsp;</td><td>name of the zone in text, "example.com" If it does not exist, nothing happens. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00110">ub_ctx::local_zones</a>, <a class="el" href="localzone_8c_source.html#l01214">local_zones_del_zone()</a>, <a class="el" href="localzone_8c_source.html#l00914">local_zones_find()</a>, <a class="el" href="localzone_8h_source.html#l00078">local_zones::lock</a>, <a class="el" href="localzone_8c_source.html#l00124">parse_dname()</a>, <a class="el" href="libunbound_8c_source.html#l00911">ub_ctx_finalize()</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00175">UB_SYNTAX</a>.</p>

</div>
</div><p>
<a class="anchor" name="992366bb56ef091e0b53f044a12785da"></a><!-- doxytag: member="libunbound.c::ub_ctx_data_add" ref="992366bb56ef091e0b53f044a12785da" args="(struct ub_ctx *ctx, char *data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_data_add           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>data</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add localdata to the library local authority info. 
<p>
Similar to local-data config statement. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. Is finalized by the routine. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>data,:</em>&nbsp;</td><td>the resource record in text format, for example "www.example.com IN A 127.0.0.1" </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="module_8h_source.html#l00073">module_env::cfg</a>, <a class="el" href="context_8h_source.html#l00072">ub_ctx::cfglock</a>, <a class="el" href="context_8h_source.html#l00106">ub_ctx::env</a>, <a class="el" href="context_8h_source.html#l00110">ub_ctx::local_zones</a>, <a class="el" href="localzone_8c_source.html#l01229">local_zones_add_RR()</a>, <a class="el" href="config__file_8h_source.html#l00087">config_file::msg_buffer_size</a>, <a class="el" href="libunbound_8c_source.html#l00911">ub_ctx_finalize()</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00173">UB_NOMEM</a>.</p>

</div>
</div><p>
<a class="anchor" name="ced50b3598a142264577826c137f481c"></a><!-- doxytag: member="libunbound.c::ub_ctx_data_remove" ref="ced50b3598a142264577826c137f481c" args="(struct ub_ctx *ctx, char *data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ub_ctx_data_remove           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__ctx.html">ub_ctx</a> *&nbsp;</td>
          <td class="paramname"> <em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>data</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Remove localdata from the library local authority info. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ctx,:</em>&nbsp;</td><td>context. Is finalized by the routine. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>data,:</em>&nbsp;</td><td>the name to delete all data from, like "www.example.com". </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if OK, else error. </dd></dl>

<p>References <a class="el" href="context_8h_source.html#l00110">ub_ctx::local_zones</a>, <a class="el" href="localzone_8c_source.html#l01294">local_zones_del_data()</a>, <a class="el" href="localzone_8c_source.html#l00124">parse_dname()</a>, <a class="el" href="libunbound_8c_source.html#l00911">ub_ctx_finalize()</a>, <a class="el" href="context_8h_source.html#l00168">UB_NOERROR</a>, and <a class="el" href="context_8h_source.html#l00175">UB_SYNTAX</a>.</p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Oct 13 06:46:30 2009 for unbound by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>