Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > e3a718fcad37ff363f65d6a6e994e272 > files > 289

ldns-devel-1.6.12-1.fc15.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type"
content="text/html;charset=iso-8859-1">
<title>ldns documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<div class="logo">
<img src="LogoInGradientBar2-y100.png"/>
</div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;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 id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="dir_7a7a565456b510ac01baf8655647d8a2.html">ldns</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">util.h</div>  </div>
</div>
<div class="contents">
<a href="util_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * util.h</span>
<a name="l00003"></a>00003 <span class="comment"> *  </span>
<a name="l00004"></a>00004 <span class="comment"> * helper function header file</span>
<a name="l00005"></a>00005 <span class="comment"> * </span>
<a name="l00006"></a>00006 <span class="comment"> * a Net::DNS like library for C</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> * (c) NLnet Labs, 2004</span>
<a name="l00009"></a>00009 <span class="comment"> * </span>
<a name="l00010"></a>00010 <span class="comment"> * See the file LICENSE for the license</span>
<a name="l00011"></a>00011 <span class="comment"> */</span>
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="preprocessor">#ifndef _UTIL_H</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define _UTIL_H</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;inttypes.h&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;unistd.h&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;<a class="code" href="common_8h.html" title="Common definitions for LDNS.">ldns/common.h</a>&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;time.h&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00025"></a>00025 <span class="preprocessor">#endif</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a><a class="code" href="util_8h.html#a5d7f87431299f2e952b54fcd3246e12a">00027</a> <span class="preprocessor">#define dprintf(X,Y) fprintf(stderr, (X), (Y))</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="comment">/* #define      dprintf(X, Y)  */</span>
<a name="l00029"></a>00029 
<a name="l00030"></a><a class="code" href="util_8h.html#a991dc2d5a646a3f66f91ba6b62c93615">00030</a> <span class="preprocessor">#define LDNS_VERSION &quot;1.6.12&quot;</span>
<a name="l00031"></a><a class="code" href="util_8h.html#a52856294dceb4f2e0610d023cc73f6b8">00031</a> <span class="preprocessor"></span><span class="preprocessor">#define LDNS_REVISION ((1&lt;&lt;16)|(6&lt;&lt;8)|(12))</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00036"></a>00036 <span class="preprocessor">#ifdef S_SPLINT_S</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#  define INLINE </span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#  ifdef SWIG</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#    define INLINE static</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor">#  else</span>
<a name="l00042"></a><a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116">00042</a> <span class="preprocessor"></span><span class="preprocessor">#    define INLINE static inline</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#  endif</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00049"></a><a class="code" href="util_8h.html#a828619b138fdeb9756cd3c874d0551c1">00049</a> <span class="preprocessor">#define LDNS_MALLOC(type)               LDNS_XMALLOC(type, 1)</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span>
<a name="l00051"></a><a class="code" href="util_8h.html#aaad6949daea3c6cefd01d19300f6e21a">00051</a> <span class="preprocessor">#define LDNS_XMALLOC(type, count)       ((type *) malloc((count) * sizeof(type)))</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00053"></a><a class="code" href="util_8h.html#a79edd183cbf57142f0742856d6277517">00053</a> <span class="preprocessor">#define LDNS_CALLOC(type, count)        ((type *) calloc((count), sizeof(type)))</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span>
<a name="l00055"></a><a class="code" href="util_8h.html#a1daa1fb0f7475a1efbd1af6f331f933b">00055</a> <span class="preprocessor">#define LDNS_REALLOC(ptr, type)         LDNS_XREALLOC((ptr), type, 1)</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span>
<a name="l00057"></a><a class="code" href="util_8h.html#aef91214266c90875fa06e4a47e734538">00057</a> <span class="preprocessor">#define LDNS_XREALLOC(ptr, type, count)                         \</span>
<a name="l00058"></a>00058 <span class="preprocessor">        ((type *) realloc((ptr), (count) * sizeof(type)))</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span>
<a name="l00060"></a><a class="code" href="util_8h.html#a5e13054aa9b3843e97514228a0bbe909">00060</a> <span class="preprocessor">#define LDNS_FREE(ptr) \</span>
<a name="l00061"></a>00061 <span class="preprocessor">        do { free((ptr)); (ptr) = NULL; } while (0)</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span>
<a name="l00063"></a><a class="code" href="util_8h.html#a6ce207a6b932051fb6bf79356569485e">00063</a> <span class="preprocessor">#define LDNS_DEP     printf(&quot;DEPRECATED FUNCTION!\n&quot;);</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span>
<a name="l00065"></a>00065 <span class="comment">/*</span>
<a name="l00066"></a>00066 <span class="comment"> * Copy data allowing for unaligned accesses in network byte order</span>
<a name="l00067"></a>00067 <span class="comment"> * (big endian).</span>
<a name="l00068"></a>00068 <span class="comment"> */</span>
<a name="l00069"></a>00069 <a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116" title="splint static inline workaround">INLINE</a> uint16_t
<a name="l00070"></a>00070 ldns_read_uint16(<span class="keyword">const</span> <span class="keywordtype">void</span> *src)
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072 <span class="preprocessor">#ifdef ALLOW_UNALIGNED_ACCESSES</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span>        <span class="keywordflow">return</span> ntohs(*(uint16_t *) src);
<a name="l00074"></a>00074 <span class="preprocessor">#else</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span>        uint8_t *p = (uint8_t *) src;
<a name="l00076"></a>00076         <span class="keywordflow">return</span> ((uint16_t) p[0] &lt;&lt; 8) | (uint16_t) p[1];
<a name="l00077"></a>00077 <span class="preprocessor">#endif</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span>}
<a name="l00079"></a>00079 
<a name="l00080"></a>00080 <a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116" title="splint static inline workaround">INLINE</a> uint32_t
<a name="l00081"></a>00081 ldns_read_uint32(<span class="keyword">const</span> <span class="keywordtype">void</span> *src)
<a name="l00082"></a>00082 {
<a name="l00083"></a>00083 <span class="preprocessor">#ifdef ALLOW_UNALIGNED_ACCESSES</span>
<a name="l00084"></a>00084 <span class="preprocessor"></span>        <span class="keywordflow">return</span> ntohl(*(uint32_t *) src);
<a name="l00085"></a>00085 <span class="preprocessor">#else</span>
<a name="l00086"></a>00086 <span class="preprocessor"></span>        uint8_t *p = (uint8_t *) src;
<a name="l00087"></a>00087         <span class="keywordflow">return</span> (  ((uint32_t) p[0] &lt;&lt; 24)
<a name="l00088"></a>00088                 | ((uint32_t) p[1] &lt;&lt; 16)
<a name="l00089"></a>00089                 | ((uint32_t) p[2] &lt;&lt; 8)
<a name="l00090"></a>00090                 |  (uint32_t) p[3]);
<a name="l00091"></a>00091 <span class="preprocessor">#endif</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span>}
<a name="l00093"></a>00093 
<a name="l00094"></a>00094 <span class="comment">/*</span>
<a name="l00095"></a>00095 <span class="comment"> * Copy data allowing for unaligned accesses in network byte order</span>
<a name="l00096"></a>00096 <span class="comment"> * (big endian).</span>
<a name="l00097"></a>00097 <span class="comment"> */</span>
<a name="l00098"></a>00098 <a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116" title="splint static inline workaround">INLINE</a> <span class="keywordtype">void</span>
<a name="l00099"></a>00099 ldns_write_uint16(<span class="keywordtype">void</span> *dst, uint16_t data)
<a name="l00100"></a>00100 {
<a name="l00101"></a>00101 <span class="preprocessor">#ifdef ALLOW_UNALIGNED_ACCESSES</span>
<a name="l00102"></a>00102 <span class="preprocessor"></span>        * (uint16_t *) dst = htons(data);
<a name="l00103"></a>00103 <span class="preprocessor">#else</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span>        uint8_t *p = (uint8_t *) dst;
<a name="l00105"></a>00105         p[0] = (uint8_t) ((data &gt;&gt; 8) &amp; 0xff);
<a name="l00106"></a>00106         p[1] = (uint8_t) (data &amp; 0xff);
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
<a name="l00108"></a>00108 <span class="preprocessor"></span>}
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 <a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116" title="splint static inline workaround">INLINE</a> <span class="keywordtype">void</span>
<a name="l00111"></a>00111 ldns_write_uint32(<span class="keywordtype">void</span> *dst, uint32_t data)
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113 <span class="preprocessor">#ifdef ALLOW_UNALIGNED_ACCESSES</span>
<a name="l00114"></a>00114 <span class="preprocessor"></span>        * (uint32_t *) dst = htonl(data);
<a name="l00115"></a>00115 <span class="preprocessor">#else</span>
<a name="l00116"></a>00116 <span class="preprocessor"></span>        uint8_t *p = (uint8_t *) dst;
<a name="l00117"></a>00117         p[0] = (uint8_t) ((data &gt;&gt; 24) &amp; 0xff);
<a name="l00118"></a>00118         p[1] = (uint8_t) ((data &gt;&gt; 16) &amp; 0xff);
<a name="l00119"></a>00119         p[2] = (uint8_t) ((data &gt;&gt; 8) &amp; 0xff);
<a name="l00120"></a>00120         p[3] = (uint8_t) (data &amp; 0xff);
<a name="l00121"></a>00121 <span class="preprocessor">#endif</span>
<a name="l00122"></a>00122 <span class="preprocessor"></span>}
<a name="l00123"></a>00123 
<a name="l00124"></a>00124 <span class="comment">/* warning. */</span>
<a name="l00125"></a>00125 <a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116" title="splint static inline workaround">INLINE</a> <span class="keywordtype">void</span>
<a name="l00126"></a>00126 ldns_write_uint64_as_uint48(<span class="keywordtype">void</span> *dst, uint64_t data)
<a name="l00127"></a>00127 {
<a name="l00128"></a>00128         uint8_t *p = (uint8_t *) dst;
<a name="l00129"></a>00129         p[0] = (uint8_t) ((data &gt;&gt; 40) &amp; 0xff);
<a name="l00130"></a>00130         p[1] = (uint8_t) ((data &gt;&gt; 32) &amp; 0xff);
<a name="l00131"></a>00131         p[2] = (uint8_t) ((data &gt;&gt; 24) &amp; 0xff);
<a name="l00132"></a>00132         p[3] = (uint8_t) ((data &gt;&gt; 16) &amp; 0xff);
<a name="l00133"></a>00133         p[4] = (uint8_t) ((data &gt;&gt; 8) &amp; 0xff);
<a name="l00134"></a>00134         p[5] = (uint8_t) (data &amp; 0xff);
<a name="l00135"></a>00135 }
<a name="l00136"></a>00136 
<a name="l00137"></a>00137 
<a name="l00144"></a><a class="code" href="structldns__schwartzian__compare__struct.html">00144</a> <span class="keyword">struct </span><a class="code" href="structldns__schwartzian__compare__struct.html" title="Structure to do a Schwartzian-like transformation, for instance when sorting.">ldns_schwartzian_compare_struct</a> {
<a name="l00145"></a><a class="code" href="structldns__schwartzian__compare__struct.html#ad22235b7cd22c7bd47f9274c48f0766f">00145</a>         <span class="keywordtype">void</span> *<a class="code" href="structldns__schwartzian__compare__struct.html#ad22235b7cd22c7bd47f9274c48f0766f">original_object</a>;
<a name="l00146"></a><a class="code" href="structldns__schwartzian__compare__struct.html#afa1af874c6739d346d5f918198fa720e">00146</a>         <span class="keywordtype">void</span> *<a class="code" href="structldns__schwartzian__compare__struct.html#afa1af874c6739d346d5f918198fa720e">transformed_object</a>;
<a name="l00147"></a>00147 };
<a name="l00148"></a>00148 
<a name="l00156"></a><a class="code" href="structldns__struct__lookup__table.html">00156</a> <span class="keyword">struct </span><a class="code" href="structldns__struct__lookup__table.html" title="A general purpose lookup table.">ldns_struct_lookup_table</a> {
<a name="l00157"></a><a class="code" href="structldns__struct__lookup__table.html#aee9c62dd48ab14350f40771c92d2f8db">00157</a>         <span class="keywordtype">int</span> <a class="code" href="structldns__struct__lookup__table.html#aee9c62dd48ab14350f40771c92d2f8db">id</a>;
<a name="l00158"></a><a class="code" href="structldns__struct__lookup__table.html#a45da7ee10e4b7902018fba6dfae2396c">00158</a>         <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="structldns__struct__lookup__table.html#a45da7ee10e4b7902018fba6dfae2396c">name</a>;
<a name="l00159"></a>00159 };
<a name="l00160"></a><a class="code" href="util_8h.html#aab8f46426d28b393a567a5c8c556c79f">00160</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structldns__struct__lookup__table.html" title="A general purpose lookup table.">ldns_struct_lookup_table</a> <a class="code" href="structldns__struct__lookup__table.html" title="A general purpose lookup table.">ldns_lookup_table</a>;
<a name="l00161"></a>00161   
<a name="l00168"></a>00168 <a class="code" href="structldns__struct__lookup__table.html" title="A general purpose lookup table.">ldns_lookup_table</a> *<a class="code" href="util_8c.html#af8897a478378bd8d5c7d434b71b0f4f8">ldns_lookup_by_name</a>(<a class="code" href="structldns__struct__lookup__table.html" title="A general purpose lookup table.">ldns_lookup_table</a> table[],
<a name="l00169"></a>00169                                        <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="structldns__struct__lookup__table.html#a45da7ee10e4b7902018fba6dfae2396c">name</a>);
<a name="l00170"></a>00170 
<a name="l00177"></a>00177 <a class="code" href="structldns__struct__lookup__table.html" title="A general purpose lookup table.">ldns_lookup_table</a> *<a class="code" href="util_8c.html#a42a73e82a0f0bf3ee979190b9cf81957">ldns_lookup_by_id</a>(<a class="code" href="structldns__struct__lookup__table.html" title="A general purpose lookup table.">ldns_lookup_table</a> table[], <span class="keywordtype">int</span> <span class="keywordtype">id</span>);
<a name="l00178"></a>00178 
<a name="l00187"></a>00187 <span class="keywordtype">int</span> <a class="code" href="util_8c.html#ac0cfcc1f93a2aaf7fb61804cf844faef" title="Returns the value of the specified bit The bits are counted from left to right, so bit #0 is the left...">ldns_get_bit</a>(uint8_t bits[], <span class="keywordtype">size_t</span> index);
<a name="l00188"></a>00188 
<a name="l00189"></a>00189 
<a name="l00198"></a>00198 <span class="keywordtype">int</span> <a class="code" href="util_8c.html#a7b16da6f889d76e6653a28038a50824c" title="Returns the value of the specified bit The bits are counted from right to left, so bit #0 is the righ...">ldns_get_bit_r</a>(uint8_t bits[], <span class="keywordtype">size_t</span> index);
<a name="l00199"></a>00199 
<a name="l00210"></a>00210 <span class="keywordtype">void</span> <a class="code" href="util_8c.html#a2d1ca37b28b9053aedc68d9ab4c62cae" title="sets the specified bit in the specified byte to 1 if value is true, 0 if false The bits are counted f...">ldns_set_bit</a>(uint8_t *byte, <span class="keywordtype">int</span> bit_nr, <span class="keywordtype">bool</span> value);
<a name="l00211"></a>00211 
<a name="l00216"></a>00216 <span class="comment">/*@unused@*/</span>
<a name="l00217"></a>00217 <a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116" title="splint static inline workaround">INLINE</a> <span class="keywordtype">long</span>
<a name="l00218"></a>00218 ldns_power(<span class="keywordtype">long</span> a, <span class="keywordtype">long</span> b) {
<a name="l00219"></a>00219         <span class="keywordtype">long</span> result = 1;
<a name="l00220"></a>00220         <span class="keywordflow">while</span> (b &gt; 0) {
<a name="l00221"></a>00221                 <span class="keywordflow">if</span> (b &amp; 1) {
<a name="l00222"></a>00222                         result *= a;
<a name="l00223"></a>00223                         <span class="keywordflow">if</span> (b == 1) {
<a name="l00224"></a>00224                                 <span class="keywordflow">return</span> result;
<a name="l00225"></a>00225                         }
<a name="l00226"></a>00226                 }
<a name="l00227"></a>00227                 a *= a;
<a name="l00228"></a>00228                 b /= 2;
<a name="l00229"></a>00229         }
<a name="l00230"></a>00230         <span class="keywordflow">return</span> result;
<a name="l00231"></a>00231 }
<a name="l00232"></a>00232 
<a name="l00238"></a>00238 <span class="keywordtype">int</span> <a class="code" href="util_8c.html#a04593d78f06d288151bba4719704fa99" title="Returns the int value of the given (hex) digit.">ldns_hexdigit_to_int</a>(<span class="keywordtype">char</span> ch);
<a name="l00239"></a>00239 
<a name="l00245"></a>00245 <span class="keywordtype">char</span> <a class="code" href="util_8c.html#af756fbd794c21244c76ffc1f1e70530d" title="Returns the char (hex) representation of the given int.">ldns_int_to_hexdigit</a>(<span class="keywordtype">int</span> ch);
<a name="l00246"></a>00246 
<a name="l00256"></a>00256 <span class="keywordtype">int</span>
<a name="l00257"></a>00257 <a class="code" href="util_8c.html#a22fb80e94a21a7700835b83279e9110c" title="Converts a hex string to binary data.">ldns_hexstring_to_data</a>(uint8_t *data, <span class="keyword">const</span> <span class="keywordtype">char</span> *str);
<a name="l00258"></a>00258 
<a name="l00263"></a>00263 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="util_8c.html#acfa02e74a31c812d2e4ecf40915b418f" title="Show the internal library version.">ldns_version</a>(<span class="keywordtype">void</span>);
<a name="l00264"></a>00264 
<a name="l00271"></a>00271 time_t <a class="code" href="util_8c.html#ad4a71c049ae1e0b4849a64040a7360fa" title="Convert TM to seconds since epoch (midnight, January 1st, 1970).">mktime_from_utc</a>(<span class="keyword">const</span> <span class="keyword">struct</span> tm *tm);
<a name="l00272"></a>00272 
<a name="l00287"></a>00287 <span class="keyword">struct </span>tm * <a class="code" href="util_8c.html#a093298fb6914785d45feb3be61597aed" title="The function interprets time as the number of seconds since epoch with respect to now using serial ar...">ldns_serial_arithmitics_gmtime_r</a>(int32_t time, time_t now, <span class="keyword">struct</span> tm *result);
<a name="l00288"></a>00288  
<a name="l00308"></a>00308 <span class="keywordtype">int</span> <a class="code" href="util_8c.html#aeda2f1b732e46a3e761aba81129d71e0" title="Init the random source applications should call this if they need entropy data within ldns If openSSL...">ldns_init_random</a>(FILE *fd, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size);
<a name="l00309"></a>00309 
<a name="l00315"></a>00315 uint16_t <a class="code" href="util_8c.html#ad59e2ce028b25f1fbe8d4dbdb2a5b315" title="Get random number.">ldns_get_random</a>(<span class="keywordtype">void</span>);
<a name="l00316"></a>00316 
<a name="l00324"></a>00324 <span class="keywordtype">char</span> *<a class="code" href="util_8c.html#ada923722a7a97fbb7a531cf48b977b8e" title="Encode data as BubbleBabble.">ldns_bubblebabble</a>(uint8_t *data, <span class="keywordtype">size_t</span> len);
<a name="l00325"></a>00325 
<a name="l00326"></a>00326 <span class="preprocessor">#ifndef B32_NTOP</span>
<a name="l00327"></a>00327 <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="util_8h.html#af9e2ce0407b93dfbc1aeeccdc9a5f83a">ldns_b32_ntop</a>(uint8_t <span class="keyword">const</span> *src, <span class="keywordtype">size_t</span> srclength,
<a name="l00328"></a>00328              <span class="keywordtype">char</span> *target, <span class="keywordtype">size_t</span> targsize);
<a name="l00329"></a>00329 <span class="keywordtype">int</span> <a class="code" href="util_8h.html#a5c5431f355f91c46227dd48087a39162">b32_ntop</a>(uint8_t <span class="keyword">const</span> *src, <span class="keywordtype">size_t</span> srclength,
<a name="l00330"></a>00330              <span class="keywordtype">char</span> *target, <span class="keywordtype">size_t</span> targsize);
<a name="l00331"></a>00331 <span class="keywordtype">int</span> <a class="code" href="util_8h.html#a1131c0b74b8b1d94d673aa222d0ef54b">ldns_b32_ntop_extended_hex</a>(uint8_t <span class="keyword">const</span> *src, <span class="keywordtype">size_t</span> srclength,
<a name="l00332"></a>00332              <span class="keywordtype">char</span> *target, <span class="keywordtype">size_t</span> targsize);
<a name="l00333"></a>00333 <span class="keywordtype">int</span> <a class="code" href="util_8h.html#aed79c5491d256070b43664b9b7bc1981">b32_ntop_extended_hex</a>(uint8_t <span class="keyword">const</span> *src, <span class="keywordtype">size_t</span> srclength,
<a name="l00334"></a>00334              <span class="keywordtype">char</span> *target, <span class="keywordtype">size_t</span> targsize);
<a name="l00338"></a>00338 <span class="comment">/*@unused@*/</span>
<a name="l00339"></a>00339 <a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116" title="splint static inline workaround">INLINE</a> <span class="keywordtype">size_t</span> ldns_b32_ntop_calculate_size(<span class="keywordtype">size_t</span> srcsize)
<a name="l00340"></a>00340 {
<a name="l00341"></a>00341         <span class="keywordtype">size_t</span> result = ((((srcsize / 5) * 8) - 2) + 2);
<a name="l00342"></a>00342         <span class="keywordflow">return</span> result;
<a name="l00343"></a>00343 }
<a name="l00344"></a>00344 <span class="preprocessor">#endif </span><span class="comment">/* !B32_NTOP */</span>
<a name="l00345"></a>00345 <span class="preprocessor">#ifndef B32_PTON</span>
<a name="l00346"></a>00346 <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="util_8h.html#a60c8f637673eb6eda1b2ba9416b4acdc">ldns_b32_pton</a>(<span class="keywordtype">char</span> <span class="keyword">const</span> *src, <span class="keywordtype">size_t</span> hashed_owner_str_len, uint8_t *target, <span class="keywordtype">size_t</span> targsize);
<a name="l00347"></a>00347 <span class="keywordtype">int</span> <a class="code" href="util_8h.html#a22d504d674ef6d2a59ab87fd4a0fdba4">b32_pton</a>(<span class="keywordtype">char</span> <span class="keyword">const</span> *src, <span class="keywordtype">size_t</span> hashed_owner_str_len, uint8_t *target, <span class="keywordtype">size_t</span> targsize);
<a name="l00348"></a>00348 <span class="keywordtype">int</span> <a class="code" href="util_8h.html#aacd27728d568173b4e84b920c93f4141">ldns_b32_pton_extended_hex</a>(<span class="keywordtype">char</span> <span class="keyword">const</span> *src, <span class="keywordtype">size_t</span> hashed_owner_str_len, uint8_t *target, <span class="keywordtype">size_t</span> targsize);
<a name="l00349"></a>00349 <span class="keywordtype">int</span> <a class="code" href="util_8h.html#a26b31a9006ac7150bcccd01a28afdce7">b32_pton_extended_hex</a>(<span class="keywordtype">char</span> <span class="keyword">const</span> *src, <span class="keywordtype">size_t</span> hashed_owner_str_len, uint8_t *target, <span class="keywordtype">size_t</span> targsize);
<a name="l00353"></a>00353 <span class="comment">/*@unused@*/</span>
<a name="l00354"></a>00354 <a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116" title="splint static inline workaround">INLINE</a> <span class="keywordtype">size_t</span> ldns_b32_pton_calculate_size(<span class="keywordtype">size_t</span> srcsize)
<a name="l00355"></a>00355 {
<a name="l00356"></a>00356         <span class="keywordtype">size_t</span> result = ((((srcsize) / 8) * 5));
<a name="l00357"></a>00357         <span class="keywordflow">return</span> result;
<a name="l00358"></a>00358 }
<a name="l00359"></a>00359 <span class="preprocessor">#endif </span><span class="comment">/* !B32_PTON */</span>
<a name="l00360"></a>00360 
<a name="l00361"></a>00361 <a class="code" href="util_8h.html#a2eb6f9e0395b47b8d5e3eeae4fe0c116" title="splint static inline workaround">INLINE</a> time_t ldns_time(time_t *t) { <span class="keywordflow">return</span> time(t); }
<a name="l00362"></a>00362 
<a name="l00363"></a>00363 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00364"></a>00364 <span class="preprocessor"></span>}
<a name="l00365"></a>00365 <span class="preprocessor">#endif</span>
<a name="l00366"></a>00366 <span class="preprocessor"></span>
<a name="l00367"></a>00367 <span class="preprocessor">#endif </span><span class="comment">/* !_UTIL_H */</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Jan 11 2012 for ldns by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>