Sophie

Sophie

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

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: util/random.h 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_4b581c88b01efb1cf178857b56f0f2fb.html">util</a>
  </div>
</div>
<div class="contents">
<h1>random.h File Reference</h1>Thread safe random functions.  
<a href="#_details">More...</a>
<p>
<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">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="random_8h.html#b5132b212ce16e6966cd8b23566c71bb">ub_systemseed</a> (unsigned int seed)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize the system randomness.  <a href="#b5132b212ce16e6966cd8b23566c71bb"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct <a class="el" href="structub__randstate.html">ub_randstate</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="random_8h.html#3de5dc60edbbcab3d16a501209f70e96">ub_initstate</a> (unsigned int seed, struct <a class="el" href="structub__randstate.html">ub_randstate</a> *from)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize a random generator state for use.  <a href="#3de5dc60edbbcab3d16a501209f70e96"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">long int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="random_8h.html#cc9704b871b1fdc01950954dbe63f63f">ub_random</a> (struct <a class="el" href="structub__randstate.html">ub_randstate</a> *state)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Generate next random number from the state passed along.  <a href="#cc9704b871b1fdc01950954dbe63f63f"></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="random_8h.html#342f021d1703d988c597d467e757101a">ub_randfree</a> (struct <a class="el" href="structub__randstate.html">ub_randstate</a> *state)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Delete the random state.  <a href="#342f021d1703d988c597d467e757101a"></a><br></td></tr>
</table>
<hr><h2>Detailed Description</h2>
Thread safe random functions. 
<p>
Similar to arc4random() with an explicit initialisation routine. <hr><h2>Function Documentation</h2>
<a class="anchor" name="b5132b212ce16e6966cd8b23566c71bb"></a><!-- doxytag: member="random.h::ub_systemseed" ref="b5132b212ce16e6966cd8b23566c71bb" args="(unsigned int seed)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ub_systemseed           </td>
          <td>(</td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>seed</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Initialize the system randomness. 
<p>
Obtains entropy from the system before a chroot or privilege makes it unavailable. You do not have to call this, otherwise ub_initstate does so. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>seed,:</em>&nbsp;</td><td>seed value to create state (if no good entropy is found). </td></tr>
  </table>
</dl>

<p>References <a class="el" href="log_8c_source.html#l00241">log_err()</a>, <a class="el" href="log_8h_source.html#l00052">VERB_OPS</a>, and <a class="el" href="ldns-testpkts_8c.html#a557e5b23b2833d7c1ec0415a1bdd2b1">verbose()</a>.</p>

<p>Referenced by <a class="el" href="daemon_8c_source.html#l00147">daemon_init()</a>, <a class="el" href="random_8c_source.html#l00117">ub_arc4random_stir()</a>, and <a class="el" href="random_8c_source.html#l00154">ub_initstate()</a>.</p>

</div>
</div><p>
<a class="anchor" name="3de5dc60edbbcab3d16a501209f70e96"></a><!-- doxytag: member="random.h::ub_initstate" ref="3de5dc60edbbcab3d16a501209f70e96" args="(unsigned int seed, struct ub_randstate *from)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structub__randstate.html">ub_randstate</a>* ub_initstate           </td>
          <td>(</td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>seed</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structub__randstate.html">ub_randstate</a> *&nbsp;</td>
          <td class="paramname"> <em>from</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Initialize a random generator state for use. 
<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>seed,:</em>&nbsp;</td><td>seed value to create state contents. (ignored for arc4random). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>from,:</em>&nbsp;</td><td>if not NULL, the seed is taken from this random structure. can be used to seed random states via a parent-random-state that is itself seeded with entropy. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>new state or NULL alloc failure. </dd></dl>

<p>References <a class="el" href="log_8c_source.html#l00241">log_err()</a>, <a class="el" href="random_8c_source.html#l00117">ub_arc4random_stir()</a>, and <a class="el" href="random_8c_source.html#l00092">ub_systemseed()</a>.</p>

<p>Referenced by <a class="el" href="daemon_8c_source.html#l00276">daemon_create_workers()</a>, <a class="el" href="libworker_8c_source.html#l00092">libworker_setup()</a>, <a class="el" href="unitmain_8c_source.html#l00401">rnd_test()</a>, <a class="el" href="libunbound_8c_source.html#l00064">ub_ctx_create()</a>, and <a class="el" href="worker_8c_source.html#l00967">worker_init()</a>.</p>

</div>
</div><p>
<a class="anchor" name="cc9704b871b1fdc01950954dbe63f63f"></a><!-- doxytag: member="random.h::ub_random" ref="cc9704b871b1fdc01950954dbe63f63f" args="(struct ub_randstate *state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">long int ub_random           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__randstate.html">ub_randstate</a> *&nbsp;</td>
          <td class="paramname"> <em>state</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Generate next random number from the state passed along. 
<p>
Thread safe, so random numbers are repeatable. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>state,:</em>&nbsp;</td><td>must have been initialised with ub_initstate. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>: random 31 bit value. </dd></dl>

<p>References <a class="el" href="random_8c_source.html#l00085">MAX_VALUE</a>, <a class="el" href="random_8c_source.html#l00073">ub_randstate::rc4</a>, <a class="el" href="random_8c_source.html#l00075">ub_randstate::rc4_ready</a>, and <a class="el" href="random_8c_source.html#l00117">ub_arc4random_stir()</a>.</p>

<p>Referenced by <a class="el" href="daemon_8c_source.html#l00244">daemon_get_shufport()</a>, <a class="el" href="iter__utils_8c_source.html#l00389">iter_ns_probability()</a>, <a class="el" href="iter__utils_8c_source.html#l00286">iter_server_selection()</a>, <a class="el" href="outside__network_8c_source.html#l00985">pending_tcp_query()</a>, <a class="el" href="unitmain_8c_source.html#l00401">rnd_test()</a>, <a class="el" href="outside__network_8c_source.html#l00769">select_id()</a>, <a class="el" href="outside__network_8c_source.html#l00795">select_ifport()</a>, <a class="el" href="outside__network_8c_source.html#l01154">serviced_perturb_qname()</a>, and <a class="el" href="random_8c_source.html#l00117">ub_arc4random_stir()</a>.</p>

</div>
</div><p>
<a class="anchor" name="342f021d1703d988c597d467e757101a"></a><!-- doxytag: member="random.h::ub_randfree" ref="342f021d1703d988c597d467e757101a" args="(struct ub_randstate *state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ub_randfree           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structub__randstate.html">ub_randstate</a> *&nbsp;</td>
          <td class="paramname"> <em>state</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Delete the random state. 
<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>state,:</em>&nbsp;</td><td>to delete. </td></tr>
  </table>
</dl>

<p>Referenced by <a class="el" href="daemon_8c_source.html#l00475">daemon_delete()</a>, <a class="el" href="libworker_8c_source.html#l00071">libworker_delete()</a>, <a class="el" href="unitmain_8c_source.html#l00401">rnd_test()</a>, <a class="el" href="libunbound_8c_source.html#l00064">ub_ctx_create()</a>, <a class="el" href="libunbound_8c_source.html#l00153">ub_ctx_delete()</a>, and <a class="el" href="worker_8c_source.html#l01115">worker_delete()</a>.</p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Oct 13 06:46:32 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>